DigitalSlideArchive / HistomicsUI

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

Mapping paired annotations - generate and map bounding box annotations against existing point annotations #38

Open cramraj8 opened 5 years ago

cramraj8 commented 5 years ago

I have a task to generate and map bounding box annotations and point annotations to represent each cell in the WSI. But currently, I don't find any efficient pairing mechanisms between 2 different annotation types to represent one entity(cell).

For my cell detection project, pathologists already made point annotations on the cell centroids. Now I have the task to generate bounding box annotations enclosing each cell.

I am wondering to have a UI option so that first we click a point annotation(which represents one cell), and the backend should be able to remember the very last clicked point annotation unique ID(or center coordinates). Then we do usual rectangular drawing with other clicks around that cell corners. When the drawing is done, the backend will make a mapping between the point annotation unique ID and rectangular annotation unique ID(or mapping between center coordinates and corner coordinates).

How feasible is to have a UI option for this pairing task? Is this the best way to generate and map a rectangular annotation or are there any better UI option?

cooperlab commented 5 years ago

This is an interesting problem. We should discuss on a call with @dgutman @kheffah to get their inputs. I can imagine some other applications where pairing annotations could be useful but the UI component is a bit tricky.

kheffah commented 5 years ago

@cramraj8 I had a similar thought when I wanted to link annotations to fields of view .. i.e. that a certain annotations are part of a field of view. From a backend perspective this is not hard; all I needed to so was add the id of the FOV to the properties of the individual points. But that was a trivial example; yours is more nuanced since you can't just say "if a point is in a bounding box then it belongs to it" -- bounding boxes overlap. The tricky part is how to do this in the UI, I like your suggested mechanism, but with some modifications. Here's how I think this could be done; @manthey can chime in if the implementation makes sense: 1- We add an attribute to annotations called "linked_annotations", which is a list of ids of linked annotations. 2- When the user holds down a specific keyboard shortcut while left clicking, for example Shift+LeftClick, the clicked annotation's "linked_annotations" list is "primed". For example, I Shift+click on an FOV. 3- The user continues to hold down the keyboard key and left clicks all annotations you want to link to the first clicked annotation. In this example, I choose all nuclei I want associated with that FOV. This is exactly like the multi-select feature, and I suspect much of the functionality can be re-purposed for this application.