spateo.preprocessing.image#

Image preprocessing.

Module Contents#

Functions#

remove_background(→ Optional[anndata.AnnData])

Preprocessing of an image. Remove background with the global threshold. Pixel intensity is set to 0, for all the

spateo.preprocessing.image.remove_background(adata: anndata.AnnData, threshold: float | str = 'auto', slice: str | None = None, used_img_layer: str | None = None, return_img_layer: str | None = None, inplace: bool = False, show: bool = True) anndata.AnnData | None[source]#

Preprocessing of an image. Remove background with the global threshold. Pixel intensity is set to 0, for all the pixels intensity, less than the threshold value. If the threshold is not provided, it will be calculated by OSTU’s method.

Parameters:
adata

AnnData object.

threshold

Global threshold used. If the threshold is not provided, it will be calculated by OSTU’s method.

slice

Name of the slice.

used_img_layer

Name of used image layer.

return_img_layer

Name of output image layer.

inplace

Perform computation inplace or return result.

show

Show the preprocessed image or not.

Returns:

AnnData.uns[‘spatial’][slice][‘images’][return_img_layer]

The preprocessed image

AnnData.uns[‘spatial’][slice][‘scalefactors’][return_img_layer]

The scale factor for the spots