Interactive image visualization with napari#

napari is a python-based image viewer. This notebooks demonstrates how to remote control it from python.

See also

For opening an image, we still use scikit-image:

import napari
from import imread
import napari_segment_blobs_and_things_with_membranes as nsbatm
import napari_skimage_regionprops as nsr
# Create an empty viewer
viewer = napari.Viewer()

First we load an image and show it in the viewer.

image = imread('../../data/nuclei.tif')

<Image layer 'image' at 0x1e423868df0>

With this command, we can make a screenshot of napari and save it in our notebook.


Cell segmentation#

We can also segment the nuclei and show them on top of the image.

label_image = nsbatm.voronoi_otsu_labeling(image, spot_sigma=9)

# add labels to viewer
label_layer = viewer.add_labels(label_image)

You can visualize labelled objects as overlay (per default)


… or as opaque contours

label_layer.contour = 2
label_layer.opacity = 1


Quantitative measurements#

We can also derive quantitative measurements and attach them to the napari viewer.

nsr.regionprops_table(image, label_image, napari_viewer=viewer)

Napari status bar display of label properties disabled because and