omicverse.space.map_spatial_auto#
- omicverse.space.map_spatial_auto(adata_rotated, method='phase', library_id=None, library_key=None, res='hires')[source]#
Automatically map and align spatial transcriptomics data.
This function performs automatic alignment of spatial transcriptomics data with the corresponding tissue image using various alignment methods.
- Parameters:
adata_rotated – AnnData Annotated data matrix containing spatial data to be aligned.
method (default:
'phase') – str, optional (default=’phase’) Alignment method to use: - ‘phase’: Phase correlation-based alignment - ‘torch’: Torch-accelerated phase correlationlibrary_id (default:
None) – str or None Spatial library whose image should be aligned. Required when more than one library is present.library_key (default:
None) – str or None Observation column identifying library membership. Required for a multi-library AnnData.res (default:
'hires') – str, default=’hires’ Image resolution used for registration.
- Returns:
- AnnData
Aligned AnnData object with updated spatial coordinates.
Notes
The function automatically selects the best alignment
Results can be verified using spatial plotting functions
Different methods may work better for different data types
Examples
>>> import scanpy as sc >>> import omicverse as ov >>> # Load and preprocess data >>> adata = sc.read_visium(...) >>> # Perform automatic alignment >>> adata_aligned = ov.space.map_spatial_auto( ... adata, ... method='phase' ... )