shape_detection#
Module with routines for shape and size detection of objects such as cells.
Note
The shape detection is based on a seeded and masked watershed. The module is based on the ndimage library. For faster implementation of intensity and radial measurements see the modules listed below.
See also
ClearMap.Analysis.Measurements.MeasureExpression
, ClearMap.Analysis.Measurements.MeasureRadius
- detect_shape(source, seeds, threshold=None, verbose=False, processes=None)[source]#
Detect object shapes by generating a labeled image from seeds.
Arguments
- sourcearray, str or Source
Source image.
- seedsarray, str or Source
Cell centers as point coordinates.
- thresholdfloat or None
Threshold to determine mask for watershed, pixel below this are treated as background. If None, the seeds are expanded indefinitely.
- verbose :bool
If True, print progress info.
Returns
- shapesarray
Labeled image, where each label indicates an object.
- find_intensity(source, label, max_label=None, method='sum', verbose=False)[source]#
Find integrated intensity given object shapes as labeled image.
Arguments
- sourcearray, str, or Source
Source to measure intensities from.
- labelarray, str, or Source
Labeled image with a separate label for each object.
- max_labelint or None
Maximal label to include. If None, use all.
- method{‘sum’, ‘mean’, ‘max’, ‘min’}
Method to use to measure the intensities in each object’s area.
- verbosebool
If True, print progress information.
Returns
- intensitiesarray
Measured intensities.
- find_size(label, max_label=None, verbose=False)[source]#
Find size given object shapes as a labled image
Arguments
- labelarray, str or Source
Labeled image in which each object has its own label.
- max_labelint or None
Maximal label to include, if None use all label.
- verbosebool
Print progress info.
Returns
- sizesarray
Measured intensities