Skip to main content

Toolbox for viewing, analyzing, and manually correcting (cell) segmentation in napari.

Project description

napari-segmentation-toolbox

License BSD-3 PyPI Python Version tests codecov napari hub

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 SciPy and scikit-image that can help to explore and correct segmentation data.

  • Orthogonal views for 3D data (also available separately).
  • 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

copy_labels

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.
copy_labels

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.

conncomp

Select / delete labels that overlap with a binary mask

All labels that share any pixel overlap with the mask are selected or removed. select_delete

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.

interpolate labelinterpolation gif

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.

table_widget

See also

This plugin has taken inspiration from other napari plugins with similar and more advanced functionalities for measuring features, such as:

  • napari-skimage-regionprops
  • napari-pyclesperanto-assistant
  • morphometrics
  • napari-clusters-plotter

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.

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_segmentation_toolbox-0.0.7.tar.gz (112.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

napari_segmentation_toolbox-0.0.7-py3-none-any.whl (133.9 kB view details)

Uploaded Python 3

File details

Details for the file napari_segmentation_toolbox-0.0.7.tar.gz.

File metadata

File hashes

Hashes for napari_segmentation_toolbox-0.0.7.tar.gz
Algorithm Hash digest
SHA256 435842084f5e62720136378877a4456d6a44a9e4399360ae5b1def3f1f4481ba
MD5 9d8d99f2fa5da5efc5141ece9fb5e785
BLAKE2b-256 9e62e637881bb8a70aec456dd7afab4cd54b269fafbf49538835d43b582b750b

See more details on using hashes here.

File details

Details for the file napari_segmentation_toolbox-0.0.7-py3-none-any.whl.

File metadata

File hashes

Hashes for napari_segmentation_toolbox-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 10e6be2c50ebe2c19e6a3003ee3750520eb483f6766b087785fb132d8d7bc5a4
MD5 24205c82a30159b4c6eea39959f18c14
BLAKE2b-256 1dd7ccc80576bae95683ad5d141a7011937e83133ff7d9be677a056159bdb4ee

See more details on using hashes here.

Supported by

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