Skip to main content

A napari plugin for dynamically displaying orthogonal views and syncing events between the different viewers.

Project description

napari-orthogonal-views

License BSD-3 PyPI Python Version tests codecov napari hub npe2 Copier

A napari plugin for dynamically displaying orthogonal views and syncing events between the different viewers.


This napari plugin was generated with copier using the napari-plugin-template.

orthoviews

This plugin is based on this example, with extra display and synchronization functionalities. The crosshair overlay is based on this and this example.

Installation

You can install the latest development version of napari-orthogonal-views via pip:

pip install git+https://github.com/AnniekStok/napari-orthogonal-views.git

Usage

This plugin is not discoverable as a widget, but commands are available in Views>Commands Palette (CMD+SHIFT+P):

  • Show Orthogonal Views
  • Hide Orthogonal Views
  • Toggle Orthogonal Views
  • Remove Orthogonal Views

Once shown, it can also be popped up or collapsed using the checkbox in the bottom right corner 'Show orthogonal views'. Alternatively, you can show the orthogonal views via the console:

from napari_orthogonal_views.ortho_view_manager import show_orthogonal_views
show_orthogonal_views(viewer)

And access the OrthoViewManager via _get_manager:

from napari_orthogonal_views.ortho_view_manager import _get_manager
m = _get_manager(viewer)
m.is_shown()
Out[6]: True

The size of the orthogonal view windows can be adjusted by clicking and dragging the small dot in between the views, optionally one or two views can be hidden entirely. The checkboxes in the bottom right corner can be used to show the crosshair overlay or for more control over camera zoom and axis center syncing. Pressing T on the keyboard will center all views to the current mouse location.

By default, all events (including label editing such as painting) are synced across all views. The different views share the same underlying data array and undo/redo history.

Syncing properties

By default, all layer properties should be synced between the layer on the main viewer and the orthoviews. However, it is possible to have more finegrained control over the synced properties via the set_sync_filters function, as long as it is specified before the orthogonal views are activated.

For example, to disable syncing of all properties on Tracks layers and specifically the contour property on Labels layers:

from napari_orthogonal_views.ortho_view_manager import _get_manager
from napari.layers import Tracks, Labels
m = _get_manager(viewer)
sync_filters = {
    Tracks: {
        "forward_exclude": "*",  # disable all forward sync
        "reverse_exclude": "*",  # disable all reverse sync
    },
    Labels: {
        "forward_exclude": "contour" # exclude contour from forward syncing
    },
}
m.set_sync_filters(sync_filters)

Then add 3D data (e.g. File > Open Sample > napari builtins > Balls (3D)). Activate the labels layer and change the contour value. You should see that the contour property is not synced from main viewer to orthoviews now.

Screen recording

The 'Screen recording' tab offers a quick way to save a stitched image of the viewer with its orthogonal views. It is also possible to slide along a given axis and record a movie that is saved as a .avi file.

Known issues and ongoing work

  • Deprecation warnings on Window._qt_window, LayerList._get_step_size, LayerList._get_extent_world (suppressed for now).
  • After removing the OrthoViewManager with delete_and_cleanup (Remove Orthogonal Views command), the canvas may become temporarily unresponsive. Clicking outside of Napari and then back on the Napari window usually fixes this.

Contributing

Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.

License

Distributed under the terms of the BSD-3 license, "napari-orthogonal-views" is free and open source software

Issues

If you encounter any problems, please file an issue along with a detailed description.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

napari_orthogonal_views-0.2.2.tar.gz (35.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

napari_orthogonal_views-0.2.2-py3-none-any.whl (32.1 kB view details)

Uploaded Python 3

File details

Details for the file napari_orthogonal_views-0.2.2.tar.gz.

File metadata

  • Download URL: napari_orthogonal_views-0.2.2.tar.gz
  • Upload date:
  • Size: 35.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for napari_orthogonal_views-0.2.2.tar.gz
Algorithm Hash digest
SHA256 3ee79e2ea4c396582c1400b21951d4b91fd2aa3a950b835c6888c2df6d88ae74
MD5 a83db8d3df06f91c00770374d1799eed
BLAKE2b-256 088312ce5b6728558a45f285913e16e855f3c1fbd56c775b8d6fa4a5544e113b

See more details on using hashes here.

File details

Details for the file napari_orthogonal_views-0.2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for napari_orthogonal_views-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2494beef7061a7e7d8f353976a936e5982c409fa3671d06698c9062fa8589ed5
MD5 f29bb51126adb18b76b694bfab31b9e7
BLAKE2b-256 b4cf2ed679e79c5bfae9e7be35a1fa96ceaaa9bdba8b319ec2005aa8bef202f2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page