Improve labels transfer to ImageJ #324
Open
+12
−5
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR provides the ability to transfer napari
Labels
to the ImageJ UI. Notably, it provides two different pathways:Labels
layer is provided as the image, napari-imagej will convert theLabels
layer to anImgLabeling
, and then will display the index image.Labels
layer is provided as the rois, napari-imagej will convert theLabels
layer toROITree
(using @elevans' wonderful work in Add conversion support for index images to ImgLib2 and legacy ImageJ ROIs pyimagej#283), then attached and displayed as ROIs. Note that this pathway required the bump in the pyimagej min version.You can see the results in the image below, where I:
brick
sample image in napariLabels
as an image to get(V)
in the bottom left cornerbrick
as an image andLabels
as rois to getbrick (V)
in the bottom right corner.Concerns
Working around imagej-common: Arguably imagej-common (maybe here) and/or imagej-legacy should shoulder the burden of correctly displaying
ImgLabeling
s. I decided to avoid an implementation there because (a) it would take longer to be usable from napari-imagej and (b) I had a feeling the changes could be involved. @hinerm thoughts on this?Closes #321 (cc @ian-coccimiglio)