Skip to main content

A plugin to read whole-slide images within napari.

Project description

napari-wsi

PyPI napari hub Tests Maturity Level-1

A plugin to read whole-slide images within napari.


Installation via pip

You can install napari-wsi via pip:

pip install "napari-wsi[all]>=1.0"

This automatically installs all optional backends, as a shortcut for:

pip install "napari-wsi[openslide,rasterio,wsidicom]>=1.0"

In addition, to be able to read images using the openslide backend, it is required to install the OpenSlide library itself, for example by installing the openslide-bin python package (also via pip).

Installation via conda

You can also install napari-wsi via conda:

conda install -c conda-forge "napari-wsi>=1.0"

This already installs all optional dependencies, including OpenSlide.

Description

This napari plugin provides a widget for reading various whole-slide image formats using a common zarr store inteface, based on the libraries openslide, rasterio, and wsidicom.

Quickstart

After installation, open the Plugins menu in the viewer and select WSI Reader to open the widget. Then select a Backend to use, select a Path to open, and click Load.

The napari viewer displaying a sample image.

If sRGB is selected in the Color Space menu and an ICC profile is attached to the given image, a transformation to this color space will be applied when the image data is read. Otherwise, the raw RGB image data will be displayed.

This plugin can also be used to open image files via drag and drop into the viewer window. The file suffixes '.bif', '.ndpi', '.scn', '.svs' are registered with the openslide backend, while the suffixes '.tif' and '.tiff' are registered with the rasterio backend. These files can also be opened directly from the command line or from a python script:

napari CMU-1.svs
from napari import Viewer

viewer = Viewer()
viewer.open("CMU-1.svs", plugin="napari-wsi")

It is also possible to use the different backend classes directly, in which case some more features are available, for example:

from napari import Viewer
from napari_wsi.backends.openslide import OpenSlideStore

viewer = Viewer()

# Display the image in the sRGB color space and a physical coordinate system:
store = OpenSlideStore("CMU-1.svs", color_space="sRGB")
(layer,) = store.to_viewer(viewer, spatial_transform=True)
assert layer.metadata["color_space"] == "sRGB"

# Display a scale bar to indicate milli- or micrometers, depending on the zoom level:
viewer.scale_bar.visible = True
viewer.scale_bar.colored = True
from napari import Viewer
from napari_wsi.backends.wsidicom import WSIDicomStore
from requests.auth import HTTPBasicAuth
from wsidicom import WsiDicomWebClient

viewer = Viewer()
client = WsiDicomWebClient.create_client("...", auth=HTTPBasicAuth("...", "..."))
store = WSIDicomStore(client=client, study_uid="...", series_uids="...")
store.to_viewer(viewer)

The sample images used above are part of the OpenSlide test data (see Aperio and DICOM).

Known Issues & Other Notes

  • This plugin is prototype research software and there may be breaking changes with each release of the plugin, which is also the case for current releases of the napari viewer itself.
  • The wsidicom backend supports loading annotations together with the image data. However, this may take several minutes, depending on the number and complexity of the annotations. When loading more than a few thousand polygon annotations, make sure that the experimental "triangles speedup" setting is enabled.

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_wsi-1.2.1.tar.gz (4.2 MB view details)

Uploaded Source

Built Distribution

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

napari_wsi-1.2.1-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file napari_wsi-1.2.1.tar.gz.

File metadata

  • Download URL: napari_wsi-1.2.1.tar.gz
  • Upload date:
  • Size: 4.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.29

File hashes

Hashes for napari_wsi-1.2.1.tar.gz
Algorithm Hash digest
SHA256 108182561e6306cc35f694cbf5be10eca38de251a74ae1b3834231f80bb0a925
MD5 3c6b6f37e9ca588ddf24455cd32b501a
BLAKE2b-256 68ba24ab4f6aeb8b690b173f3e288633d5007030dd01ae23d70ed1326a63cf00

See more details on using hashes here.

File details

Details for the file napari_wsi-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: napari_wsi-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 22.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.29

File hashes

Hashes for napari_wsi-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0c89491c842be4e78aa456dfa104a30941372c57c2c63c87669998c477bb4d7c
MD5 dd431c32df038888adeb9f1230dee8df
BLAKE2b-256 3529e634eafb9dc8e4a715789429ca1ec5b954c25f4f8d8bbe5c7c90b5377e35

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