spateo.segmentation.external.cellpose¶
Use Cellpose for cell identification and labeling. https://github.com/MouseLand/cellpose
Attributes¶
Functions¶
Module Contents¶
- spateo.segmentation.external.cellpose._cellpose(img: numpy.ndarray, model: typing_extensions.Literal[cyto, nuclei] | cellpose.models.CellposeModel = 'nuclei', **kwargs) numpy.ndarray [source]¶
Run Cellpose on the provided image.
- Parameters:
- img
Image as a Numpy array.
- model
Cellpose model to use. Can be one of the two pretrained models: * cyto: Labeled cytoplasm * nuclei: Labeled nuclei Or any generic CellposeModel model.
- **kwargs
Additional keyword arguments to
Cellpose.eval()
function.
- Returns:
Numpy array containing cell labels.
- spateo.segmentation.external.cellpose.cellpose(adata: anndata.AnnData, model: typing_extensions.Literal[cyto, nuclei] | cellpose.models.CellposeModel = 'nuclei', diameter: int | None = None, normalize: bool = True, equalize: float = 2.0, layer: str = SKM.STAIN_LAYER_KEY, out_layer: str | None = None, **kwargs)[source]¶
Run Cellpose to label cells from a staining image.
- Parameters:
- adata
Input Anndata
- model
Cellpose model to use. Can be one of the two pretrained models: * cyto: Labeled cytoplasm * nuclei: Labeled nuclei Or any generic CellposeModel model.
- diameter
Expected diameter of each segmentation (cells for model=”cyto”, nuclei for model=”nuclei”). Can be None to run automatic detection.
- normalize
Whether or not to percentile-normalize the image. This is an argument to
Cellpose.eval()
.- equalize
Controls the clip_limit argument to the
clahe()
function. Set this value to a non-positive value to turn off equalization.- layer
Layer that contains staining image. Defaults to stain.
- out_layer
Layer to put resulting labels. Defaults to {layer}_labels.
- **kwargs
Additional keyword arguments to
Cellpose.eval()
function.
- Returns:
Numpy array containing cell labels.