Welcome to Visium stitcher’s documentation!
Stitch multiple Visium slides together
- visium_stitcher.stitch(adatas, image=None, dist_fact=1.5)
Perform a series of affine transformations on individual Visium sample images/spot coordinates, then merge them into a single multi-sample
AnnData
. The output object has the mergedhires
image stored in.uns['spatial']['joint']
, with the scale factors factored into each sample’s spot coordinates and set to 1 in the object. The spot diameter is derived from the first object, and multiplied by the corresponding scale factor.Input
- adataslist of
AnnData
Must have a 2x3 affine transformation matrix, as defined here, stored in
.uns['transform']
. The raw feature count matrix should be loaded for accurate overlap evaluation. The samples will be given image/spot priority based on the order of the objects in the list.- image
filepath
, optional (Default:None
) Optional path to previously prepared overlapped tissue image to use in the merged object.
- dist_fact
float
, optional (Default: 1.5) For the first object in the list,
med_dist
is defined as the median of the distances between each spot and its closest neighbour. For subsequent samples, spots that fall withindist_fact*med_dist
of a prior non-overlapping spot are deemed to be overlap.
- adataslist of
- visium_stitcher.transform_finder(xmlpath, field='@file_path')
Load affine transformation matrices from a TrakEM2 XML file. Returns a dictionary with the values of the specified field (to help determine which sample/image the transform corresponds to) as the keys, and their corresponding transforms as the values. Store the matrices in
.uns['transform']
of the appropriate slide’sAnnData
prior to callingvisium_stitcher.stitch()
.Input
- xmlpath
filename
XML output of aligning the Visium hires images within TrakEM2.
- field
str
, optional (default:"@file_path"
) The XML field to be used to label the individual layers in the transform dictionary. The default is
"@file_path"
, the path to each input image provided to TrakEM2. Another possibility is"@title"
, storing the layer name.
- xmlpath