imagej / imagej-legacy

ImageJ+ImageJ2 compatibility layer
https://imagej.net/libs/imagej-legacy
BSD 2-Clause "Simplified" License
16 stars 25 forks source link

Create an OverlayDisplay for displaying Overlays #297

Closed gselzer closed 1 year ago

gselzer commented 1 year ago

Sometimes you have an Overlay (or a ROITree) without a backing image - this happens in napari, where the Shapes layers are completely disconnected from "image" data - and you want to display it in the original ImageJ UI - this new OverlayDisplay/OverlayDisplayViewer should do the trick

gselzer commented 1 year ago

@hinerm here's a concern that I have - what should we do if there's already an Overlay on the current ImagePlus? What if we want to call this many times on different overlays? Is there a way that we could merge the Overlays, or should we continue "overwriting" the Overlay as we do now?

gselzer commented 1 year ago

Instead of doing this, can we just make napari-imagej smarter about what it does with napari shapes layers? Do we really need to hack up ImageJ Legacy some more to accommodate this use case?

@ctrueden that depends on whether or not it is reasonable to expect ij.ui().show(<my DefaultROITree>) to work. Are there situations where you'd want to be able to show a collection of shapes without backing image data? Naively, I'd guess there are, and if so then I think we need to do something like this. If not, then we will have to make some HACKy changes to napari-imagej.

ctrueden commented 1 year ago

@gselzer I described my proposal for napari-imagej above in my review. I do not think this approach would be HACKy in the slightest.

About ij.ui().show(roiTree): if we wanted that to work, shouldn't the change be in imagej-common, adding a ROITreeDisplay, rather than here in imagej-legacy?

gselzer commented 1 year ago

@gselzer I described my proposal for napari-imagej above in my review. I do not think this approach would be HACKy in the slightest.

Oop, didn't see that when I replied. Thanks.

About ij.ui().show(roiTree): if we wanted that to work, shouldn't the change be in imagej-common, adding a ROITreeDisplay, rather than here in imagej-legacy?

Probably, although I think some of this work could be copied over. Nevertheless, we can come back to this work if we decide to implement a ROITreeDisplay.