spatialdata icon indicating copy to clipboard operation
spatialdata copied to clipboard

questions about alignment in Figure 2b

Open yuling999666 opened this issue 1 year ago • 4 comments

Hi @joshmoore , when you mapped each element (xenium rep1, xenium rep2, visium) to the 'aligned' coordinate system, did you use gene expression data? I have checked the code for paper_reproducibility, and I think you didn't consider gene expression data but spatial coordinates. Is that correct? Thank you.

yuling999666 avatar Jan 03 '25 23:01 yuling999666

Hi @yuling999666, the affine mapping has been derived with the aim of aligning the full resolution H&E image for Visium and the two full resolution IF images for Xenium. The spatial locations (expression data) are mapped to the images, so the mapping of the images induces a mapping of the spatial locations as well.

Alternative approaches (e.g., STalign) derive the mapping from the transcript data (considering the density maps of the transcripts). For our purposes, an affine transformation gave a satisfactory alignment for meaningful downstream analyses; for more complex tissues, you can choose to align the data with external methods and save the external alignment into the spatialdata object.

LucaMarconato avatar Jan 04 '25 00:01 LucaMarconato

Hi @yuling999666, the affine mapping has been derived with the aim of aligning the full resolution H&E image for Visium and the two full resolution IF images for Xenium. The spatial locations (expression data) are mapped to the images, so the mapping of the images induces a mapping of the spatial locations as well.

Alternative approaches (e.g., STalign) derive the mapping from the transcript data (considering the density maps of the transcripts). For our purposes, an affine transformation gave a satisfactory alignment for meaningful downstream analyses; for more complex tissues, you can choose to align the data with external methods and save the external alignment into the spatialdata object.

Hi @LucaMarconato , thank you for the reply. So I need to select the landmarks manually for mapping? It seems that the affine mapping for alignment cannot be used on ST data without images? Thanks!

yuling999666 avatar Jan 04 '25 03:01 yuling999666

It can be used as the affine transformation can be computed externally or with other methods (see for instance a more elaborate example here https://github.com/scverse/spatialdata-notebooks/blob/main/notebooks/paper_reproducibility/lundeberg.ipynb, I would not try to run the whole notebook because it's too large, but just have a look at the alignment part). But I agree, with ST data the landmark based approach would be less precise.

LucaMarconato avatar Jan 04 '25 14:01 LucaMarconato

It can be used as the affine transformation can be computed externally or with other methods (see for instance a more elaborate example here https://github.com/scverse/spatialdata-notebooks/blob/main/notebooks/paper_reproducibility/lundeberg.ipynb, I would not try to run the whole notebook because it's too large, but just have a look at the alignment part). But I agree, with ST data the landmark based approach would be less precise.

Hi @LucaMarconato , thank you for the response. I appreciate it.

yuling999666 avatar Jan 06 '25 15:01 yuling999666