DigitalSlideArchive / HistomicsUI

A Girder plugin for pathology image annotations and analysis.
Apache License 2.0
57 stars 20 forks source link

Point annotations - missing #125

Closed ds2268 closed 2 years ago

ds2268 commented 2 years ago

I am running a project where pathologists are using point-wise annotations to select particular cells of interest. When clicking on the cells in a fast manner, lots of the cells are not marked and are missed. This is due to HistomicsUI sensitivity to the actual clicking -> it detects that you are trying to move the slide (by the slightest amount) and not to click. Is there some workaround where we can make some "safety margin", that when you are using annotation tools, that it's more sensitive towards putting the annotation there instead of moving the slide around - if the movement detected is really small and annotation tools are selected, put the annotation instead, or both?

Any ideas? This is a real bottleneck in speed, especially when using a stylus pen for making the annotations.

manthey commented 2 years ago

We use the GeoJS library for handling this, and the mapInteractor class allows this to be adjusted. Specifically, from the HistomicsUI client, if you have a reference to the viewer object, this is an instance of the GeoJS map class. From that, you can do something like:

let currentOptions = viewer.interactor.options();
currentOptions.click.cancelOnMove = 10;  // a click can move up to 10 pixels before it is considered a move
viewer.interactor.options(currentOptions)

The default value for cancelOnMove is true, which is any movement is considered a move and not a click. false would be purely time-based to distinguish between clicks and moves. See https://opengeoscience.github.io/geojs/apidocs/geo.mapInteractor.html.

ds2268 commented 2 years ago

That would be exactly what I need @manthey! Can you please point me in HistomicsUI code, where should I put this exactly? Thanks!

Is this here: https://github.com/DigitalSlideArchive/HistomicsUI/blob/b7ca339bdfa2c2fdc2a916420272d21d755a9308/histomicsui/web_client/views/body/ImageView.js#L190

basically just add the settings (as you provided) in this render callback?

manthey commented 2 years ago

Yes, exactly.

You could add it right after this line: https://github.com/DigitalSlideArchive/HistomicsUI/blob/master/histomicsui/web_client/views/body/ImageView.js#L197

ds2268 commented 2 years ago

When I add it like this:

image

...and restart the DSA and run devops/build.sh ... I lose all the plugins in the HistomicsView - I can just see the image and the header.

manthey commented 2 years ago

I left out some parenthesis. interactor is actually a function that returns the map interactor:

let currentOptions = viewer.interactor().options();
currentOptions.click.cancelOnMove = 10;  // a click can move up to 10 pixels before it is considered a move
viewer.interactor().options(currentOptions)

Without that you probably have an exception in the javascript console.

ds2268 commented 2 years ago

Thanks! Seems to work now - I have exactly no JS experience, so I am doing it a bit blindly :). The clicking seems to be better now but will do a test again with the stylus pen and report. Then you can also consider that as a "standard" feature, or at least to be configurable somewhere if deemed useful in the real world.

ds2268 commented 2 years ago

@manthey when you are doing point annotations the points (all of them, including previous ones) are rendered again when you add a new one. It also seems like they are not getting re-rendered after every point added, but every 2,3, X points, as you notice the blink/flash of re-rendering all of them. This makes the labeling process very slow under a high number of points. This can happen when you are labeling manually and come up with thousands of points, but even sooner if you use a semi-automated approach and you add/correct some of them. This makes the process extremely slow.

I noticed that only annotations (i.e. points) under the same annotation file are getting re-rendered. Can I somehow stop re-rendering when adding points under the SAME annotation file and how? Seems like that re-rendering under the current (selected) annotation file is not needed, if others (from other annotation files) are visualized also, without rendering. Thanks!

manthey commented 2 years ago

@ds2268 -- can you check if https://github.com/girder/large_image/pull/871 has fixed the rerendering you were seeing? If you install from dockers, you may need to wait a little bit for new docker images to be published with the changes.

manthey commented 2 years ago

I think this is fully resolved by recent changes. Please reopen if it isn't.