omicverse.space.map_spatial_manual

omicverse.space.map_spatial_manual(adata_rotated, offset)[source]

Manually adjust spatial transcriptomics data alignment.

This function allows manual adjustment of the alignment between spatial transcriptomics data and the tissue image using specified offsets.

Parameters:
  • adata_rotated – AnnData Annotated data matrix containing spatial data to be aligned.

  • offset – tuple (dx, dy) tuple specifying the manual offset to apply.

Returns:

AnnData

Aligned AnnData object with manually adjusted spatial coordinates.

Notes

  • Useful for fine-tuning automatic alignment results

  • Offset values are in pixel coordinates

  • Positive dx moves spots right, positive dy moves spots down

Examples

>>> import scanpy as sc
>>> import omicverse as ov
>>> # Load data
>>> adata = sc.read_visium(...)
>>> # Apply manual offset
>>> adata_aligned = ov.space.map_spatial_manual(
...     adata,
...     offset=(10, -5)  # Move 10 pixels right, 5 pixels up
... )