phenotypic.refine.GridOversizedObjectRemover#
- class phenotypic.refine.GridOversizedObjectRemover[source]#
Bases:
GridObjectRefinerRemove objects that are larger than their grid cell allows.
- Intuition:
In pinned colony grids, each cell should contain at most one colony of limited extent. Objects spanning nearly an entire cell width/height are often merged colonies, agar edges, or segmentation spillover. Removing these oversized objects improves the reliability of per-cell analysis.
- Why this is useful for agar plates:
Grid-based assays assume spatial confinement. Oversized detections disrupt row/column statistics and bias growth comparisons. Filtering them stabilizes downstream measurements.
- Use cases:
Dropping merged blobs that span adjacent positions.
Removing strong edge artifacts near the plate rim that intrude into the grid.
- Caveats:
If genuine colonies expand to fill the cell (late time points), this remover may exclude real growth.
Highly irregular grids or mis-registered edges can cause over- removal; ensure grid metadata is accurate.
- (No public attributes)
Examples
Remove objects larger than their grid cell allows
>>> from phenotypic.refine import GridOversizedObjectRemover >>> op = GridOversizedObjectRemover() >>> image = op.apply(image, inplace=True)
Methods
__init__Applies the operation to an image, either in-place or on a copy.
Drop references to the UI widgets.
Push internal state into widgets.
Return (and optionally display) the root widget.
- __del__()#
Automatically stop tracemalloc when the object is deleted.
- __getstate__()#
Prepare the object for pickling by disposing of any widgets.
This ensures that UI components (which may contain unpickleable objects like input functions or thread locks) are cleaned up before serialization.
Note
This method modifies the object state by calling dispose_widgets(). Any active widgets will be detached from the object.
- apply(image, inplace=False)#
Applies the operation to an image, either in-place or on a copy.
- widget(image: Image | None = None, show: bool = False) Widget#
Return (and optionally display) the root widget.
- Parameters:
- Returns:
The root widget.
- Return type:
ipywidgets.Widget
- Raises:
ImportError – If ipywidgets or IPython are not installed.