SOAPy_st.tl.adata_from_mask

SOAPy_st.tl.adata_from_mask(adata: AnnData, mask: ndarray, location: Literal['all', 'in', 'out'] = 'in', spatial_in_obsm: str = 'spatial', radius: float | None = None) AnnData

Generate a new adata object through the selected mask region.

Parameters

adataanndata.AnnData

An AnnData object containing spatial omics data and spatial information.

masknumpy.ndarray

A binarized image data of ROI.

locationstr, optional

‘in’: The selected spots inside the contours. ‘out’: The selected spots outside the contours. ‘all’: both of ‘in’ and ‘out’.

spatial_in_obsmstr, optional

The key of spatial coordinates in adata.obsm

radiusfloat

The range of the point whose included in the calculation.

Returns

anndata.Anndata object