SciPy 2023

View, annotate, and analyze multi-dimensional images in Python with napari
07-13, 16:30–17:00 (America/Chicago), Amphitheater 204

napari is an n-dimensional image viewer for Python. If you’ve ever tried plt.imshow(arr) and made Matplotlib unhappy because arr has more than two dimensions, then napari might be for you! napari will gladly display higher-dimensional arrays by providing sliders to explore additional dimensions. But napari can also: overlay derived data, such as points, segmentations, polygons, surfaces, and more; and annotate and edit these data, using standard data structures like NumPy or Zarr arrays, allowing you to seamlessly weave exploration, computation, and annotation in image analysis.


napari is an n-dimensional image viewer for Python. If you’ve ever tried plt.imshow(arr) and made Matplotlib unhappy because arr has more than two dimensions, then napari might be for you!

The napari canvas can be 2D or 3D. When you give napari an array with more dimensions than the canvas, it will automatically create sliders for those additional dimensions, allowing you to rapidly explore your full data, rather than a few sampled slices.

Image analysis and visualization involves more than images though: feature detection algorithms result in points, segmentation results in label images, annotation results in shapes such as rectangles or polygons, and more. Napari provides layers that can be displayed on top of each other or side by side, allowing users of Scientific Python to gain a rapid understanding of the algorithms they’re using — where they work well and where they might go wrong.

Sometimes, image analysis algorithms get you this far, but not quite far enough. In such cases, it’s useful to manually curate their output, then continue with downstream steps of an analysis. Napari provides editing tools for its layer types, allowing one for example to add missing points to the output of a peak detection algorithm, remove incorrect ones, paint over incorrect parts of a segmentation, or draw polygons around missed objects of interest. The resulting data points are saved in standard Scientific Python data structures, such as NumPy or Zarr arrays.

This design makes it easy to seamlessly weave together image exploration, image computation, processing, and analysis, and data annotation, curation, and editing.

Napari provides a plugin interface, allowing developers to extend napari’s capabilities, providing users with novel ways to interact with their data. Because napari provides both a library accessible within Python, IPython, and Jupyter, and a standalone executable script, we have even found that napari plugins can be an effective way to help collaborators run Python image analysis workflows without needing to launch Python.

In this talk, I’ll introduce napari’s history, demonstrate all the features described above, and discuss current limitations and where we’re going.

I'm a research scientist helping other scientists get insights from their image data using Python. I've been using Python since 2008, and the main scientific Python ecosystem (NumPy, SciPy, & co) since 2010. In 2012, on a whim, I went to my first SciPy (US) conference, and it changed my life! I realised that "open source" didn't mean just posting the code online. It meant actively collaborating on code with other scientists, across vast distances and at different times. Before you could say "import numpy as np", I had joined the scikit-image team, written a paper about it, written a whole book on SciPy (!), started new collaborative, open source libraries, and just generally been all-in on Scientific Python. I've been coming back to SciPy as often as I can to pay it forward for new folks in our community! 😊

This speaker also appears in: