A plugin to read whole-slide images within napari.
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).
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.
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.
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
.
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, in various ways:
napari CMU-1.svs
from napari import Viewer
viewer = Viewer()
viewer.open("CMU-1.svs", plugin="napari-wsi")
from napari import Viewer
from napari_wsi.backends.openslide import OpenSlideStore
viewer = Viewer()
store = OpenSlideStore("CMU-1.svs")
store.to_viewer(viewer)
- 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.