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