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 merged hires 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.

imagefilepath, optional (Default: None)

Optional path to previously prepared overlapped tissue image to use in the merged object.

dist_factfloat, 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 within dist_fact*med_dist of a prior non-overlapping spot are deemed to be overlap.

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’s AnnData prior to calling visium_stitcher.stitch().

Input

xmlpathfilename

XML output of aligning the Visium hires images within TrakEM2.

fieldstr, 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.