Closed gselzer closed 1 year ago
@gselzer
I'm sorry; it's not clear to me what's happening. Here's my understanding:
Dataset
with a DefaultROITree
attached - can you link me to the rois
property you mentioned?ImagePlus
is created, with its rois
property populated with the DefaultROITree
OverlayHarmonizer
overwrites the rois
property of the ImagePlus
, setting it to null
Is that right?
If the Dataset
has an attached DefaultROITree
, why doesn't it report having an overlay? Is OverlayService.getActiveOverlay(<our display>)
really doing the correct thing, if it's missing the attached DefaultROITree
?
@gselzer
- You have a
Dataset
with aDefaultROITree
attached - can you link me to therois
property you mentioned?
Yeah, that's checked here
2. An `ImagePlus` is created, with its [`rois`](https://github.com/imagej/ImageJ/blob/5addb75455a4fca940a15d1b7aa604ac36cf9079/ij/ImagePlus.java#L56) property populated with the `DefaultROITree`
Well, the DefaultROITree
is converted to a ij.gui.Overlay
, but yes, it is properly populated in the call to ij.ui().show()
, before the events fire.
3. The `OverlayHarmonizer` overwrites the `rois` property of the `ImagePlus`, setting it to `null`
Is that right?
Yup!
If the
Dataset
has an attachedDefaultROITree
, why doesn't it report having an overlay? IsOverlayService.getActiveOverlay(<our display>)
really doing the correct thing, if it's missing the attachedDefaultROITree
?
Well, there is no net.imagej.overlay.OverlayView
on the associated ImageDisplay
- I don't even know if the conversion logic exists, and I also don't know how well the net .imagej.overlay.Overlay
logic is implemented - @ctrueden told me that the ImageJ2 Overlay work is superseded by the imglib2-roi work. We'd have to make a converter to be able to get an Overlay
, created from the DefaultROITree
, from the OverlayService
- I don't know whether it's worth it, and I'm also not sure what the right thing would be...
@gselzer ok I added a test.. does it look reasonable to you?
Currently it's failing because it isn't getting a display, which I am confused about because I thought IJLegacy could run headlessly..?!
I don't know whether it's worth it, and I'm also not sure what the right thing would be...
To me, here we are saying "The ROIService.ROI_PROPERTY
of a Dataset is an overlay", so something else in the IJ2 framework needs to also think that. So what are the candidates for where that logic could go?
My thoughts:
Dataset
is being displayed, its properties are interrogated and the ROITree
is converted to an overlay? That's what you were implying, right?ImageDisplay
's displaying a Dataset
and if that Dataset
has a ROITree
attached..@gselzer ok I added a test.. does it look reasonable to you?
You'll need to ensure that OverlayHarmonizer.updateLegacyImage
is being called like you said it does, once we figure out why it's failing. I can look next week.
Currently it's failing because it isn't getting a display, which I am confused about because I thought IJLegacy could run headlessly..?!
First guess: try actually showing the dataset?
@hinerm the test is now fixed, just had to add a couple extra services! Thanks to @ctrueden for the suggestion.
Suppose we have a
Dataset
, with aDefaultROITree
as therois
property on theDataset
, that we want to display in the legacy UI.To do this, we call
LegacyUIService.show(<our dataset>)
, which will use theLegacyImageMap
to create a synchronizedImagePlus
. Once that is displayed, ImageJ Legacy will fire off aDisplayUpdatedEvent
, which eventually triggersOverlayHarmonizer.updateLegacyImage
. This method usesOverlayService.getActiveOverlay(<our display>)
, which returnsnull
- this overwrites theDefaultROITree
overlay.This PR changes
OverlayHarmonizer
to only update the overlay if the ImageJ2Overlay
returned byOverlayService
is notnull
- this prevents overwriting legacy Overlays unless we have an ImageJ2Overlay
that actually has content.