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, CLAHE
from phenotypic.detect import OtsuDetector
from phenotypic.measure import MeasureSize, MeasureShape, MeasureIntensity
[2]:
pipeline = pht.ImagePipeline(
    ops=[GaussianBlur(sigma=2.0), CLAHE(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 9.000000 9.000000
mean 13022.000000 7611.638046
std 7822.634291 4614.804011
min 1.000000 0.417128
25% 13265.000000 7496.736623
50% 15974.000000 9187.353835
75% 17006.000000 9988.807077
max 22337.000000 13087.327242

Shape Metrics#

[4]:
df[["Shape_Circularity", "Shape_Solidity", "Shape_Eccentricity"]].describe()
[4]:
Shape_Circularity Shape_Solidity Shape_Eccentricity
count 7.000000 7.000000 9.000000
mean 0.645563 35.970507 0.216800
std 0.067261 3.078440 0.127882
min 0.510927 32.051948 0.000000
25% 0.637557 34.176161 0.214815
50% 0.654747 36.115014 0.265906
75% 0.674367 36.926526 0.281954
max 0.729419 41.421217 0.338132

Intensity Metrics#

[5]:
df[["Intensity_MeanIntensity", "Intensity_MedianIntensity", "Intensity_StandardDeviationIntensity"]].describe()
[5]:
Intensity_MeanIntensity Intensity_MedianIntensity Intensity_StandardDeviationIntensity
count 9.000000 9.000000 9.000000
mean 0.550580 0.557417 0.031153
std 0.066774 0.070707 0.017925
min 0.417128 0.417128 0.000000
25% 0.565152 0.574650 0.035816
50% 0.575144 0.582211 0.037242
75% 0.585904 0.595740 0.042424
max 0.611042 0.622127 0.044072

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