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.4.tar.gz (111.1 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.4-py3-none-any.whl (132.7 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for napari_segmentation_toolbox-0.0.4.tar.gz
Algorithm Hash digest
SHA256 887fa9d81ace6cbddf8dd491ec035d9820b02dd7f47b05db4d603ad91564a002
MD5 594d34a1e69fdbe036bd2ae7553eef84
BLAKE2b-256 186309d2f2bd0f8d24d435160ee2a49132e34e4c516760c40614bee2a2c1b647

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for napari_segmentation_toolbox-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ab484b11f09bdd4f49ae2513dfb4a881bc7d4065526011af7e1df3311ef38462
MD5 e3179d9bfe5e32e385406f0c4daa688e
BLAKE2b-256 c7aa9656e402cd3adca3159468fff39adc3a7939b8be10f958b9bf25df617f83

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