How To: Measure Colony Size and Intensity#

Extract area, perimeter, circularity, and intensity statistics from detected colonies using MeasureSize, MeasureShape, and MeasureIntensity.

[1]:
import phenotypic as pht
from phenotypic.data import load_yeast_plate
from phenotypic.enhance import GaussianBlur, EnhanceLocalContrast
from phenotypic.detect import OtsuDetector
from phenotypic.measure import MeasureSize, MeasureShape, MeasureIntensity
[2]:
pipeline = pht.ImagePipeline(
    ops=[GaussianBlur(sigma=2.0), EnhanceLocalContrast(clip_limit=0.01), OtsuDetector()],
    meas=[MeasureSize(), MeasureShape(), MeasureIntensity()],
)
df = pipeline.apply_and_measure(load_yeast_plate())

Size Metrics#

[3]:
df[["Size_Area", "Size_IntegratedIntensity"]].describe()
[3]:
Size_Area Size_IntegratedIntensity
count 7.000000 7.000000
mean 16869.857143 9842.796991
std 3076.517210 1929.831898
min 13329.000000 7522.484134
25% 14984.500000 8566.098591
50% 17055.000000 9998.177169
75% 17533.000000 10501.255212
max 22670.000000 13244.210029

Shape Metrics#

[4]:
df[["Shape_Circularity", "Shape_Solidity", "Shape_Eccentricity"]].describe()
[4]:
Shape_Circularity Shape_Solidity Shape_Eccentricity
count 7.000000 7.000000 7.000000
mean 0.894006 36.400345 0.276039
std 0.010850 3.194938 0.041446
min 0.879643 32.498452 0.207857
25% 0.885698 34.510547 0.261318
50% 0.897971 36.520339 0.279115
75% 0.900684 37.271280 0.290936
max 0.907665 42.219969 0.340791

Intensity Metrics#

[5]:
df[["Intensity_MeanIntensity", "Intensity_MedianIntensity", "Intensity_StandardDeviationIntensity"]].describe()
[5]:
Intensity_MeanIntensity Intensity_MedianIntensity Intensity_StandardDeviationIntensity
count 7.000000 7.000000 7.000000
mean 0.582158 0.591675 0.041818
std 0.015325 0.016415 0.003861
min 0.564370 0.574488 0.037359
25% 0.571459 0.579269 0.038207
50% 0.583767 0.591588 0.042502
75% 0.586948 0.597608 0.045163
max 0.610154 0.621897 0.046125

The DataFrame has one row per colony. Filter, sort, and group using standard pandas operations to answer biological questions.