How To: Correct Grid Rotation#
Apply GridAligner to straighten plates that were scanned at a slight angle. This improves grid detection accuracy for downstream well-level analysis.
[1]:
import phenotypic as pht
from phenotypic.data import load_yeast_plate
from phenotypic.correction import GridAligner
from phenotypic.detect import OtsuDetector
from phenotypic.enhance import GaussianBlur, CLAHE
Load and Detect#
[2]:
plate = load_yeast_plate()
pipeline = pht.ImagePipeline(
ops=[GaussianBlur(sigma=2.0), CLAHE(clip_limit=0.01), OtsuDetector()]
)
plate = pipeline.apply(plate)
plate.dash(overlay=True, show_grid=True)
Data type cannot be displayed: application/vnd.plotly.v1+json
Apply Grid Alignment#
GridAligner detects the dominant rotation angle from colony positions and rotates the image to straighten the grid.
[3]:
aligner = GridAligner()
plate = aligner.apply(plate)
plate.dash(overlay=True, show_grid=True)
Data type cannot be displayed: application/vnd.plotly.v1+json
The gridlines should now align more closely with the colony rows and columns. Place GridAligner after initial detection in your pipeline so it can use detected colony positions to compute the rotation angle.