Skip to main content

A toolbox for annotating objects one by one in nD

Project description


License BSD-3 PyPI Python Version tests codecov napari hub

A toolbox for annotating objects one by one in nD.

This plugin contains some tools to make 2D/3D (and technically any dimensional) annotation easier. Main features:

  • auto-filling labels
  • label slice interpolation (geometric mean, RPSV representation)
  • minimal contour segmentation

If the napari-bbox plugin is also installed (see Installation), you can also

  • list objects annotated with bounding boxes
  • visualize selected objects from different projections

This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.


You can install napari-nD-annotator via pip:

pip install napari-nD-annotator

The plugin is also available in napari-hub, to install it directly from napari, please refer to plugin installation instructions at the official napari website.

Optional packages

There are some functionalities which require additional Python packages.

Bounding boxes

The bounding box and object list functionality requires the napari-bbox Python package. If you want to use these features, install napari-bbox separately either using pip or directly from napari. You can also install it together with this plugin:

pip install napari-nD-annotator[bbox]

[!WARNING] The napari-bbox plugin currently works only with napari<=0.4.17. Do not install it with newer versions.

Minimal surface

To use the minimal surface method, you will need the minimal-surface Python package as well. Please install it using pip:


pip install minimal-surface

Or bundled with the plugin:

pip install napari-nD-annotator[ms]

[!WARNING] The minimal-surface package is only available for Windows at the time. We are actively working on bringing it to Linux and Mac systems as well.

If you would like to install all optional packages, use

pip install napari-nD-annotator[all]

If any problems occur during installation or while using the plugin, please file an issue.


You can start napari with the plugin's widgets already opened as:

napari -w napari-nD-annotator "Object List" "Annotation Toolbox"

Bounding boxes

The main idea is to create bounding boxes around objects we want to annotate, crop them, and annotate them one by one. This has mainly two advantages when visualizing in 3D:

  1. We don't have to load the whole data into memory
  2. The surrounding objects won't occlude the annotated ones, making it easier to check the annotation.

Bounding boxes can be created from the Object list widget. The dimensionality of the bounding box layer will be determined from the image layer. As bounding boxes are created, a small thumbnail will be displayed.

The proposed pipeline goes as follows:

  1. Create a bounding box layer
  2. Select data parts using the bounding boxes
  3. Select an object from the object list
  4. Annotate the object
  5. Repeat from 3.

Slice interpolation

The Interpolation tab contains tools for estimating missing annotation slices from existing ones. There are multiple options:

  • Geometric: the interpolation will be determined by calculating the average of the corresponding contour points.
  • RPSV: A more sophisticated average contour calculation, see the preprint here.
  • Distance-based: a signed distance transform is applied to the annotations. The missing slices will be filled in using their weighted sum.

Note: Geometric and RPSV interpolation works only when there's a single connected mask on each slice. If you want to interpolate disjoint objects (e.g. dividing cells), use distance based interpolation instead.

Note: Distance-based interpolation might give bad results if some masks are too far away from each other on the same slice and there's a big offset compared to the other slice used in the interpolation. If you get unsatisfactory results, try annotating more slices (skip less frames).

Minimal contour

This plugin can estimate a minimal contour, which is calculated from a point set on the edges of the object, which are provided by the user. This contour will follow some kind of image feature (pixels with high gradient or high/low intensity). Features:

  • With a single click a new point can be added to the set. This will also extend the contour with the curve shown in red
  • A double click will close the curve by adding both the red and gray curves to the minimal contour
  • When holding Shift, the gray and red highlight will be swapped, so the other curve can be added to the contour
  • With the Ctrl button down a straight line can be added instead of the minimal path
  • If the anchor points were misplaced, the last point can be removed by right-clicking, or the whole point set can be cleared by pressing Esc
  • The Param value at the widget will decide, how strongly should the contour follow edges on the image. Higher value means higher sensitivity to image data, while a lower value will be closer to straight lines.
  • Different features can be used, like image gradient or pixel intensities, and also user-defined features (using Python)
    • the image is accessed as the image variable, and the features should be stored in the features variable in the small code editor widget

This functionality can be used by selecting the Minimal Contour tab in the Annotation Toolbox widget, which will create a new layer called Anchors.

Warning: Do not remove the Anchors layer!

Warning: Some utility layers appear in the layer list when using the plugin. These are marked with a lock (:lock:) symbol. Do not remove them or modify their data, as this will most probably break the plugin! However, you can change their appearance, e.g. their color settings.



Custom feature:


Action Mouse Keyboard
Increment selected label Shift + Wheel ⬆️ E
Decrement selected label Shift + Wheel ⬇️ Q
Previous slice Ctrl + Wheel ⬆️* A
Next slice Ctrl + Wheel ⬇️* D
Increase paint brush size of labels layer Alt + Wheel ⬆️ W
Decrease paint brush size of labels layer Alt + Wheel ⬇️ S
Interpolate - Ctrl+I
Change between 'Anchors' and the labels layer - Ctrl+Tab
Jump to layer #i - Ctrl+'i'**

*Built-in functionality of napari

**i: 0-9

Note: you can check the list of available shortcuts by clicking the ? button in the bottom right corner of the main widget.


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


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-nD-annotator-0.2.3.tar.gz (615.4 kB view hashes)

Uploaded Source

Built Distributions

napari_nD_annotator-0.2.3-cp312-cp312-win_amd64.whl (976.7 kB view hashes)

Uploaded CPython 3.12 Windows x86-64

napari_nD_annotator-0.2.3-cp312-cp312-win32.whl (938.6 kB view hashes)

Uploaded CPython 3.12 Windows x86

napari_nD_annotator-0.2.3-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ x86-64

napari_nD_annotator-0.2.3-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (3.2 MB view hashes)

Uploaded CPython 3.12 manylinux: glibc 2.17+ i686

napari_nD_annotator-0.2.3-cp312-cp312-macosx_10_9_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.12 macOS 10.9+ x86-64

napari_nD_annotator-0.2.3-cp311-cp311-win_amd64.whl (989.2 kB view hashes)

Uploaded CPython 3.11 Windows x86-64

napari_nD_annotator-0.2.3-cp311-cp311-win32.whl (947.0 kB view hashes)

Uploaded CPython 3.11 Windows x86

napari_nD_annotator-0.2.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ x86-64

napari_nD_annotator-0.2.3-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (3.2 MB view hashes)

Uploaded CPython 3.11 manylinux: glibc 2.17+ i686

napari_nD_annotator-0.2.3-cp311-cp311-macosx_10_9_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.11 macOS 10.9+ x86-64

napari_nD_annotator-0.2.3-cp310-cp310-win_amd64.whl (988.3 kB view hashes)

Uploaded CPython 3.10 Windows x86-64

napari_nD_annotator-0.2.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view hashes)

Uploaded CPython 3.10 manylinux: glibc 2.17+ x86-64

napari_nD_annotator-0.2.3-cp310-cp310-macosx_10_9_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.10 macOS 10.9+ x86-64

napari_nD_annotator-0.2.3-cp39-cp39-win_amd64.whl (985.9 kB view hashes)

Uploaded CPython 3.9 Windows x86-64

napari_nD_annotator-0.2.3-cp39-cp39-win32.whl (946.1 kB view hashes)

Uploaded CPython 3.9 Windows x86

napari_nD_annotator-0.2.3-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.2 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

napari_nD_annotator-0.2.3-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (3.1 MB view hashes)

Uploaded CPython 3.9 manylinux: glibc 2.17+ i686

napari_nD_annotator-0.2.3-cp39-cp39-macosx_10_9_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

napari_nD_annotator-0.2.3-cp38-cp38-win_amd64.whl (993.2 kB view hashes)

Uploaded CPython 3.8 Windows x86-64

napari_nD_annotator-0.2.3-cp38-cp38-win32.whl (952.1 kB view hashes)

Uploaded CPython 3.8 Windows x86

napari_nD_annotator-0.2.3-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.3 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

napari_nD_annotator-0.2.3-cp38-cp38-manylinux_2_17_i686.manylinux2014_i686.whl (3.2 MB view hashes)

Uploaded CPython 3.8 manylinux: glibc 2.17+ i686

napari_nD_annotator-0.2.3-cp38-cp38-macosx_10_9_x86_64.whl (1.4 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

Supported by

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