Closed Nick-Eagles closed 3 months ago
Update: I tried the same code but with lower resolution images, and out = STalign.LDDMM([YI,XI],I,[YJ,XJ],J,**params)
runs without the error, but out['A']
is mostly nan
:
tensor([[nan, nan, nan],
[nan, nan, nan],
[0., 0., 1.]], device='cuda:0', dtype=torch.float64)
Dear Nick,
This tutorial for aligning Visium datasets may be useful to you: https://jef.works/blog/2023/11/05/aligning-visium-using-STalign-with-reticulate/ In general, for aligning two Visium datasets, I would recommend aligning the Cytassist images and then applying the transformation onto the spots to move them into the aligned coordinate space (rather than rasterizing spots because spots are uniformly gridded and contain no cell density information in their positions)
This tutorial also described some matrix dimensions and parameters to be careful about: https://jef.works/blog/2024/04/11/stalign-at-single-cell-resolution/
Hope this helps, Jean
Hello,
I'm getting the error
OverflowError: cannot convert float infinity to integer
when calling theSTalign.LDDMM()
function. I'll attach the full traceback at the bottom, but I suspect I'm likely giving bad inputs to the function, and so I'll describe a bit more how I'm attempting to useSTalign
.I'm attempting to align two Visium H&E samples that were obtained with some overlap in the XY plane but at different depths (partial overlap). I'm loading both images with
STalign.normalize(np.array(Image.open(x), dtype = np.float64) / 256)
wherex
is the path to thetissue_hires_image.png
file from Spaceranger. This is my first point of confusion, as this tutorial shows loading a Visium H&E a similar way, but I also see from this previous issue (particularly this comment) that perhapsSTalign.rasterize
should be used instead?Following along the tutorial, I manually annotate landmarks then find an initial affine transform from them, which is working well. I'm particularly interesting in getting the non-linear transform working though, and invoked
Stalign.LDDMM
just as in the tutorial:This proceeds for about an hour (using a GPU), ultimately giving the error
OverflowError: cannot convert float infinity to integer
. Here's the full traceback if it's helpful, though it looks like it's actually occurring in the plotting of the results:Thanks so much in advance! This seems like a powerful tool and I'm excited to get it working.
Best, -Nick