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

Multi-canvas experiments #13

Closed
wants to merge 8 commits into from
Closed

Multi-canvas experiments #13

wants to merge 8 commits into from

Conversation

aganders3
Copy link
Owner

This is an experiment in napari multi-canvas with an attempt to minimize breaking API changes. Tests are almost green!

There are some hacks and inefficiencies here, but in general it's working. The idea is you get a list of canvases (_MultiCanvas objects) as part of the ViewerModel. These canvases take ownership of the dims and camera, allowing you to have multiple views of the same data.

ViewerModel maintains dims and camera properties that simply delegate to a primary/active (right now just the first) canvas.

Since slice/view data currently lives on the layer model, the data must be resliced whenever the canvas changes. I'm going to start looking at this next.

Here's a brief demo:

Screen.Recording.2023-06-09.at.2.37.41.PM.mov

@aganders3
Copy link
Owner Author

Here's an updated screenshot of this WIP

import napari
import numpy as np

viewer = napari.Viewer()

viewer.open_sample('napari', 'cells3d')
viewer.add_canvas()
viewer.add_canvas()
viewer.add_canvas()

viewer.dims.ndisplay = 3
viewer._canvases[1].dims.order = (2, 1, 0)
viewer._canvases[3].dims.order = (2, 0, 1)

if __name__ == "__main__":
    napari.run()
Screenshot 2023-08-30 at 1 49 51 PM

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

Successfully merging this pull request may close these issues.

1 participant