.. _measurement-op-measureshape: MeasureShape ============ Measure the form of each detected colony. Parameters and usage: :py:class:`MeasureShape `. - **One row per:** detected colony - **Written to:** ``deliverables/measurements.csv`` (every operation, with your metadata joined) and ``deliverables/measurements_by_feature/MeasureShape.csv``, each with a ``.parquet`` beside it - **Columns:** 8 .. _measurement-info-shape: :doc:`SHAPE ` --------------------------------------------------------- .. versionchanged:: 0.20.0 Colony size magnitudes moved from :class:`~phenotypic.schema.SHAPE` to :class:`~phenotypic.schema.SIZE`: :class:`~phenotypic.measure.MeasureSize` is now their only source, and :class:`~phenotypic.measure.MeasureShape` emits form descriptors only. The radius columns were rebuilt so each name matches its value. Retired columns are not aliased, and stores written by earlier versions keep their old column names. A run started before 0.20.0 must be re-run with ``--overwrite``, not resumed. Resuming reuses the images it already finished, with their old column names. ============================== ================================ Retired column Successor ============================== ================================ ``Shape_Area`` ``Size_Area`` ``Shape_Perimeter`` ``Size_Perimeter`` ``Shape_ConvexArea`` ``Size_ConvexArea`` ``Shape_BboxArea`` ``Size_BboxArea`` ``Shape_MajorAxisLength`` ``Size_MajorAxisLength`` ``Shape_MinorAxisLength`` ``Size_MinorAxisLength`` ``Shape_MinFeretDiameter`` ``Size_MinFeretDiameter`` ``Shape_MaxFeretDiameter`` ``Size_MaxFeretDiameter`` ``Shape_MaxRadius`` ``Size_InscribedRadius`` ``Shape_MeanRadius`` ``Shape_MeanBoundaryDist`` ``Shape_MedianRadius`` ``Shape_MedianBoundaryDist`` ============================== ================================ New columns: ``Size_MedianRadius``, ``Size_MeanRadius``, ``Size_RobustMeanRadius`` and ``Size_MaxRadius``, all measured from one center, the centroid of the distance-transform peak. **Same name, different value:** ``Size_MedianRadius``, ``Size_MeanRadius`` and ``Size_MaxRadius`` are *not* the retired ``Shape_MedianRadius``, ``Shape_MeanRadius`` and ``Shape_MaxRadius``. Compare old data against the successor in the table above (identical except for colonies touching another colony or the image border, which now measure to that edge), never against the same-named ``Size_`` column. Model outputs are named by the stripped label, so ``_MaxRadius_*``, ``_MeanRadius_*`` and ``_MedianRadius_*`` fitted before and after 0.20.0 share a name but not a meaning. .. list-table:: Metric family: **Shape** :header-rows: 1 :class: phenotypic-measurement-table * - Column - Description - Type * - ``Shape_Circularity`` - Calculated as :math:`\frac{4\pi*\text{Area}}{\text{Perimeter}^2}`. Measures how closely a colony approximates a perfect circle (value = 1). Values < 1 indicate irregular colony morphology, which may result from genetic mutations, environmental stress, or mixed microbial populations on agar plates. - :bdg-ref-primary:`Tier 2 · Descriptive trait ` * - ``Shape_Eccentricity`` - Measure of colony elongation, ranging from 0 (perfect circle) to 1 (highly elongated). Values near 0 indicate compact, radially symmetric growth typical of healthy bacterial colonies, while higher values may suggest directional growth, motility, or environmental gradients on the agar surface. - :bdg-ref-primary:`Tier 2 · Descriptive trait ` * - ``Shape_Solidity`` - Ratio of actual colony area to its convex hull area (Area/ConvexArea). Values near 1 indicate compact, solid colonies with minimal indentations. Lower values (< 0.9) may indicate invasive growth, colony spreading, or the presence of clearing zones around colonies. Can slightly exceed 1, because the hull passes through pixel centers. - :bdg-ref-primary:`Tier 2 · Descriptive trait ` * - ``Shape_Extent`` - Ratio of colony area to its bounding box area (ObjectArea/BboxArea). Measures how efficiently the colony fills its allocated space. Compact colonies have higher extent values, while spread-out or irregular colonies have lower values. - :bdg-ref-primary:`Tier 2 · Descriptive trait ` * - ``Shape_Compactness`` - Calculated as :math:`\frac{\text{Perimeter}^2}{4\pi*\text{Area}}`. Inverse of circularity (ranges from 1 for perfect circles to higher values for irregular shapes). Measures colony shape complexity - compact, circular colonies have values near 1, while irregular or filamentous colonies have much higher values. - :bdg-ref-primary:`Tier 2 · Descriptive trait ` * - ``Shape_Orientation`` - Angle (in radians) between the colony's major axis and the horizontal axis. Measures colony alignment and growth directionality. Random orientations are typical for most bacterial colonies, while consistent orientations may indicate environmental gradients or mechanical stresses during plating. - :bdg-ref-primary:`Tier 2 · Descriptive trait ` * - ``Shape_MeanBoundaryDist`` - Mean Euclidean distance from each colony pixel to the nearest background pixel, computed on the object in isolation. This is a measure of interior thickness, not a radius: for an ideal disk of radius R it equals :math:`R/3`, one third of Size_InscribedRadius. Thin appendages on a compact body (runners, a hyphal fringe) pull that ratio below 1/3; a uniformly thin, elongated colony raises it toward 1/2. The image border counts as an edge. - :bdg-ref-primary:`Tier 2 · Descriptive trait ` * - ``Shape_MedianBoundaryDist`` - Median Euclidean distance from each colony pixel to the nearest background pixel, computed on the object in isolation. This is a measure of interior thickness, not a radius: for an ideal disk of radius R it equals :math:`R(1 - 1/\sqrt{2}) \approx 0.293R`. More robust to boundary raggedness than MeanBoundaryDist. See Size_RobustMeanRadius and Size_MaxRadius for the colony's radial extent. The image border counts as an edge. - :bdg-ref-primary:`Tier 2 · Descriptive trait `