A simple plugin to filter labels by properties.
This napari plugin was generated with copier using the napari-plugin-template.
This plugin provides the possibility to filter segmentation objects by measurements (shape and intensity). E.g. you segmented your cells, and you want to exclude segmentation objects that have a mean intensity below a certain value.
It is intended for 2D and 3D images.
You can interactively set minimum and maximum thresholds on measurement properties, and napari will show a preview of the selection.
Measurements are based on scikit-image regionprops
. However, not all properties are
implemented, and they are more restricted for 3D images.
- Start napari
- Start the plugin from the menu:
Plugins > Filter labels by properties
- Add a label image
- (optionally) Add a corresponding intensity image with the same (Z)YX shape
- In the widget, select the property you want to filter on
- Adjust the min/max sliders
- When you are ready to create a new label layer click the
Create labels
button in the widget
When dealing with more than 100 label objects in an image, the filtering view update is triggered only once you release the sliders.
Another similar plugin you could consider checking out: napari-skimage-regionprops.
Pixel/Voxel size are read from the napari layer scale attribute (defaults to 1 if not specified when adding the layer).
You can manually enter the size and press the Set
button, which will set the layer scale,
and measure the shape properties with calibrated units
The "Measure projected shape properties" option is only available for 3D images. It measures additional properties of Z-projected labels (including: "area", "convex_area", "circularity" and "perimeter").
The "Measure cytoplasm and cell compartments" is intended for label images that represent nuclei.
With this option selected, cytoplasm and cell masks will be created by a dilation of 5 units (pixels or calibrated).
Measurement in those compartments will be made and be used to filter on.
Create labels
will also add the respective cytoplasm and cell mask layers to the napari viewer.
You can install napari-filter-labels-by-prop
via pip:
pip install napari-filter-labels-by-prop
To install latest development version :
pip install git+https://github.com/loicsauteur/napari-filter-labels-by-prop.git
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.
Distributed under the terms of the BSD-3 license, "napari-filter-labels-by-prop" is free and open source software
If you encounter any problems, please file an issue along with a detailed description.