loki.preprocess.prepare_data_for_alignment

loki.preprocess.prepare_data_for_alignment(data_path, scale_type='tissue_hires_scalef')

Prepares data for alignment by reading an AnnData object and preparing the high-resolution tissue image.

Parameters:
  • data_path – The path to the AnnData (.h5ad) file containing the Visium data.

  • scale_type – The type of scale factor to use (tissue_hires_scalef by default).

Returns:

  • ad: AnnData object containing the spatial transcriptomics data.

  • ad_coor: Numpy array of scaled spatial coordinates (adjusted for the specified resolution).

  • img: High-resolution tissue image, normalized to 8-bit unsigned integers.

Raises:

ValueError: If required data (e.g., scale factors, spatial coordinates, or images) is missing.