dcnum.feat.feat_contour
Feature computation: OpenCV moments-based features
Submodules
Functions
|
Compute moment-based features for a mask image |
|
Calculate the volume of a polygon revolved around an axis |
Package Contents
- dcnum.feat.feat_contour.moments_based_features(mask: numpy.ndarray, pixel_size: float, ret_contour: bool = False)[source]
Compute moment-based features for a mask image
- Parameters:
mask (np.ndarray) – 3D stack of 2D boolean mask images to analyze
pixel_size (float) – pixel size of the mask image in µm
ret_contour (bool) – whether to also return the raw contour
- dcnum.feat.feat_contour.volume_from_contours(contour: list[numpy.ndarray], pos_x: numpy.ndarray, pos_y: numpy.ndarray, pixel_size: float)[source]
Calculate the volume of a polygon revolved around an axis
The volume estimation assumes rotational symmetry.
- Parameters:
contour (list of ndarrays of shape (N,2)) – One entry is a 2D array that holds the contour of an event
pos_x (float ndarray of length N) – The x coordinate(s) of the centroid of the event(s) [µm]
pos_y (float ndarray of length N) – The y coordinate(s) of the centroid of the event(s) [µm]
pixel_size (float) – The detector pixel size in µm.
- Returns:
volume – volume in um^3
- Return type:
float ndarray
Notes
The computation of the volume is based on a full rotation of the upper and the lower halves of the contour from which the average is then used.
The volume is computed radially from the center position given by (
pos_x,pos_y). For sufficiently smooth contours, such as densely sampled ellipses, the center position does not play an important role. For contours that are given on a coarse grid, as is the case for deformability cytometry, the center position must be given.References
Yields identical results to the Matlab script by Geoff Olynyk <https://de.mathworks.com/matlabcentral/fileexchange/36525-volrevolve>`_