Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve labels transfer to ImageJ #324

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Improve labels transfer to ImageJ #324

wants to merge 1 commit into from

Conversation

gselzer
Copy link
Collaborator

@gselzer gselzer commented Mar 17, 2025

This PR provides the ability to transfer napari Labels to the ImageJ UI. Notably, it provides two different pathways:

  1. As the image: When a Labels layer is provided as the image, napari-imagej will convert the Labels layer to an ImgLabeling, and then will display the index image.
  2. As rois: When a Labels layer is provided as the rois, napari-imagej will convert the Labels layer to ROITree (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:

  1. Loaded in the brick sample image in napari
  2. Manually annotated two labels on a new Layer
  3. Using the detailed image transfer button, transferred the Labels as an image to get (V) in the bottom left corner
  4. Using the detailed image transfer button, transferred brick as an image and Labels as rois to get brick (V) in the bottom right corner.

image

Concerns

Working around imagej-common: Arguably imagej-common (maybe here) and/or imagej-legacy should shoulder the burden of correctly displaying ImgLabelings. 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)

@gselzer gselzer added the enhancement New feature or request label Mar 17, 2025
@gselzer gselzer requested a review from hinerm March 17, 2025 18:24
@gselzer gselzer self-assigned this Mar 17, 2025
@ian-coccimiglio
Copy link

Now we're cooking - this is great.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exception when Exporting Labels Layer to ImageJ
2 participants