dcnum.feat.feat_contour ======================= .. py:module:: dcnum.feat.feat_contour .. autoapi-nested-parse:: Feature computation: OpenCV moments-based features Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/dcnum/feat/feat_contour/contour/index /autoapi/dcnum/feat/feat_contour/moments/index /autoapi/dcnum/feat/feat_contour/volume/index Functions --------- .. autoapisummary:: dcnum.feat.feat_contour.moments_based_features dcnum.feat.feat_contour.volume_from_contours Package Contents ---------------- .. py:function:: moments_based_features(mask: numpy.ndarray, pixel_size: float, ret_contour: bool = False) Compute moment-based features for a mask image :param mask: 3D stack of 2D boolean mask images to analyze :type mask: np.ndarray :param pixel_size: pixel size of the mask image in µm :type pixel_size: float :param ret_contour: whether to also return the raw contour :type ret_contour: bool .. py:function:: volume_from_contours(contour: list[numpy.ndarray], pos_x: numpy.ndarray, pos_y: numpy.ndarray, pixel_size: float) Calculate the volume of a polygon revolved around an axis The volume estimation assumes rotational symmetry. :param contour: One entry is a 2D array that holds the contour of an event :type contour: list of ndarrays of shape (N,2) :param pos_x: The x coordinate(s) of the centroid of the event(s) [µm] :type pos_x: float ndarray of length N :param pos_y: The y coordinate(s) of the centroid of the event(s) [µm] :type pos_y: float ndarray of length N :param pixel_size: The detector pixel size in µm. :type pixel_size: float :returns: **volume** -- volume in um^3 :rtype: float ndarray .. rubric:: 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. .. rubric:: References - https://de.wikipedia.org/wiki/Kegelstumpf#Formeln - Yields identical results to the Matlab script by Geoff Olynyk `_