torchcell.sga.quantify_plate_image_cellpose

quantify_plate_image_cellpose(path: str, model: Any, cfg: CellposeSegConfig | None = None, overlay_path: str | None = None, return_masks: bool = False, precomputed_masks: ndarray | None = None) → PlateSegResult[source]

Segment a backlit plate with Cellpose-SAM and quantify colonies onto the fitted array grid.

Returns a PlateSegResult whose table matches the classical quantify_plate_image schema (row, col, size, circularity, flags, cx, cy); flags codes: C low circularity, E straddles gel edge, M multiple colonies on the well (rejected downstream).

precomputed_masks skips the Cellpose forward pass and re-runs only the grid/gel/assignment/scoring on a given instance-mask array (model may be None) – for re-deriving the grid (e.g. relaxation) from cached masks without a GPU. If those masks are already Otsu-tightened, pass tighten_size=False so they are not tightened twice.