spateo.io.image_utils#

Helper functions about image layer processing.

Module Contents#

Functions#

add_image_layer(→ anndata.AnnData)

A helper function that add an image layer to AnnData object.

spateo.io.image_utils.add_image_layer(adata: anndata.AnnData, img: numpy.ndarray, scale_factor: float, slice: str | None = None, img_layer: str | None = None) anndata.AnnData[source]#

A helper function that add an image layer to AnnData object.

Parameters:
adata

AnnData object.

img

The image data.

scale_factor

The scale factor of the image. Define: pixels/DNBs

slice

Name of the slice. Will be used when displaying multiple slices.

img_layer

Name of the image layer.

Returns:

adata

uns[‘spatial’][slice][‘images’][img_layer]

The stored image

uns[‘spatial’][slice][‘scalefactors’][img_layer]

The scale factor for the spots

Return type:

AnnData