stlearn.add.add_mask(adata: AnnData, imgpath: Union[Path, str], key: str = 'mask', copy: bool = False) Optional[AnnData][source]

Adding binary mask image to the Anndata object

  • adata – Anndata object.

  • imgpath – Image mask path.

  • key – Label for mask.

  • copy – Return a copy instead of writing to adata.


  • Depending on copy, returns or updates adata with the following fields.

  • **mask_image** (adata.uns field) – Array format of image, saving by Pillow package.