metaspace_converter.anndata_to_array module
- metaspace_converter.anndata_to_array.anndata_to_image_array(adata, layer=None)[source]
Extracts an array of ion images from an AnnData object (that has been generated through the
metaspace_to_anndata
function).- Parameters:
- Return type:
- Returns:
A three-dimensional Numpy array in the following shape
Dimension 0: Number of ion images in the order of
adata.var_names
Dimension 1: Image height
adata.uns["metaspace"]["image_size"]["y"]
Dimension 2: Image width
adata.uns["metaspace"]["image_size"]["x"]
- Raises:
ValueError – If the AnnData object has been modified. E.g. Pixel have been removed/added and the number of pixels and their coordinates do not match the original image dimensions.