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

Feature request: display() should be able to add images to an existing viewer #1086

Closed
kevinyamauchi opened this issue Mar 16, 2019 · 6 comments
Assignees

Comments

@kevinyamauchi
Copy link
Collaborator

I think it would be useful if display() had the option to add the image as a new layer to an existing Napari viewer. This is super useful for comparing the image before/after a processing step (e.g., filtering).

Thoughts, @kne42 and @ambrosejcarr ?

@kevinyamauchi
Copy link
Collaborator Author

I am happy to take a stab at this if you all agree that it's useful.

@ambrosejcarr
Copy link
Member

ambrosejcarr commented Mar 18, 2019

This is super useful for comparing the image before/after a processing step (e.g., filtering).

Could you help me understand what advantage there is to having the images be on the same viewer vs just tabbing back and forth between different viewers? Are you using transparency somehow?

@kevinyamauchi
Copy link
Collaborator Author

I think the main reason including multiple ImageStack in the same viewer is useful is that it keeps them aligned. That way as you pan and zoom between different features, you can immediately compare how they are changed between different processing steps.

In terms of how to compare, I sometimes use opacity as you mentioned, but I mostly hide/show specific layers (the eyeball on the right hand side tool bar).

@ambrosejcarr
Copy link
Member

I think the main reason including multiple ImageStack in the same viewer is useful is that it keeps them aligned. That way as you pan and zoom between different features, you can immediately compare how they are changed between different processing steps.

Got it, makes sense to me! It'd be great if you would take a stab at this. How do you imagine changing the interface to support a persistent viewer?

@kevinyamauchi
Copy link
Collaborator Author

I propose to add an optional input argument that takes a napari Viewer object. If a Viewer object is provided, display() would append the image/spots as new layers in the provided Viewer.

The display() returns the Viewer object, so the usage pattern would be:

# Look at the unprocessed image
viewer = display(stack=unprocessed_stack)

# Do some filtering
ghp = Filter.GaussianHighPass(sigma=3)
high_passed = ghp.run(primary_image, verbose=True, in_place=False)

# Admire your results
display(stack=high_passed, viewer=viewer)

A question I have: my understanding is that the Viewer object would be passed by reference display(). When the user passes in a Viewer to append to, should display() return the reference to the Viewer object or nothing?

@kevinyamauchi kevinyamauchi self-assigned this Mar 18, 2019
@kne42
Copy link
Collaborator

kne42 commented Mar 18, 2019

Sounds like a great API to me. It should return the same viewer as passed in :)

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

No branches or pull requests

3 participants