Segmentation Toolbox
Toolbox for viewing, analyzing, and manually correcting (cell) segmentation in napari.
Toolbox for viewing, analyzing and correcting (cell) segmentation in 2D, 3D or 4D (t, z, y, x) (virtual) arrays.
This napari plugin was generated with Cookiecutter using @napari's cookiecutter-napari-plugin template.
Installation
You can install napari-segmentation-toolbox via pip:
To install latest development version :
pip install napari-segmentation-toolbox
Usage
The aim is to serve as a toolbox that provides easy access to functionalities from and
that can help to explore and correct segmentation data.
- Orthogonal views for 3D data (also available
).
- Copy labels from a 2-5 dimensional array with multiple segmentation options to your current 2-5 dimensional label layer.
- Label connected components, keep the largest connected cluster of labels, keep the largest fragment per label.
- Smooth labels using a median filter.
- Compute label boundaries.
- Erode/dilate labels (scipy.ndimage and scikit-image).
- Binarize an image or labels layer by applying an intensity threshold.
- Image calculator for mathematical operations between two images.
- Select/delete labels using a mask.
- Binary mask interpolation in the z or time dimension.
- Explore label properties in a table widget and a Matplotlib plot.
- Filter and color regions by properties.
Copy labels between different labels layers
|
2D/3D/4D labels can be copied from a source layer to a target layer via SHIFT+CLICK. The data in the source layer should have the same shape as the target layer, but can optionally have one extra dimension (e.g. stack multiple segmentation solutions as channels). To copy labels, select a 'source' and a 'target' labels layer in the dropdown. By default, the source layer will be displayed as contours. Select whether to copy a slice, a volume, or a series across time. Checking Use source label value keeps the original label values. Selecting Preserve target labels only allows copying into background (0) regions. Otherwise, SHIFT+CLICK replaces the existing label region. |
|
Connected component analysis
There are shortcut buttons for connected components labeling, keeping the largest cluster of connected labels, and to keep the largest fragment per label.
Select / delete labels that overlap with a binary mask
All labels that share any pixel overlap with the mask are selected or removed.
Binary mask interpolation
It is possible to interpolate a 3D or 4D mask to fill in the region in between. In 3D, this means creating a 3D volume from slices, in 4D this means creating a time series of a volume that linearly 'morphs' into a different shape.
|
|
|
Measuring label properties
You can measure label properties, including intensity (if a matching image layer is provided), area/volume, perimeter/surface area, circularity/sphericity, ellipse/ellipsoid axes in the 'Region Properties' tab. The plugin uses scikit-image regionprops with extended properties for 3D shapes based on methods from PoreSpy. Make sure you set the dimensions correctly in the 'Extra layer controls' tab, to distinguish between measuring in 2D + time, 3D, and 3D + time, depending on your layer dimensions (2D to 4D). Once finished, a table displays the measurements, and a filter widget allows you to select objects matching a condition. The measurements are also displayed in the 'Plot'-tab for each layer for which you ran the region properties calculation.
See also
This plugin has taken inspiration from other napari plugins with similar and more advanced functionalities for measuring features, such as:
Contributing
Contributions are very welcome. Tests can be run with tox, please ensure the coverage at least stays the same before you submit a pull request.
License
Distributed under the terms of the BSD-3 license, "napari-segmentation-toolbox" is free and open source software
Issues
If you encounter any problems, please file an issue along with a detailed description.
Version:
- 0.0.7
Last updated:
- 2026-03-06
First released:
- 2025-12-12
License:
- Copyright (c) 2023, Anniek Sto...
Python versions supported:
Operating system:
- Information not submitted
Requirements:
- napari>=0.6.2
- numpy>=2
- scipy>=1.17
- scikit-image>=0.25
- dask[array]>=2025
- dask_image>=2025
- matplotlib>=3.9
- napari-orthogonal-views>=0.1.0
- napari[all]; extra == "all"
- tox; extra == "testing"
- pytest; extra == "testing"
- pytest-cov; extra == "testing"
- pytest-qt; extra == "testing"
- napari[qt]; extra == "testing"

