Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LDDMM error: IndexError: index 1 is out of bounds for dimension 0 with size 1 #39

Open
OMIC-coding opened this issue Dec 9, 2024 · 1 comment

Comments

@OMIC-coding
Copy link


IndexError Traceback (most recent call last)
Cell In[132], line 26
10 # keep all other parameters default
11 params = {'L':L,'T':T,
12 'niter': 200,
13 'pointsI': pointsI,
(...)
23 'epV': 5e1
24 }
---> 26 out = STalign.LDDMM([YI,XI], I, [YJ,XJ], J, **params)

File ~/.local/lib/python3.10/site-packages/STalign/STalign.py:1074, in LDDMM(xI, I, xJ, J, pointsI, pointsJ, L, T, A, v, xv, a, p, expand, nt, niter, diffeo_start, epL, epT, epV, sigmaM, sigmaB, sigmaA, sigmaR, sigmaP, device, dtype, muB, muA)
1072 else:
1073 raise Exception(f'If inputting an initial v, must input both xv and v')
-> 1074 extentV = extent_from_x(xv)
1075 dv = torch.as_tensor([x[1]-x[0] for x in xv],device=device,dtype=dtype)
1079 fv = [torch.arange(n,device=device,dtype=dtype)/n/d for n,d in zip(XV.shape,dv)]

File ~/.local/lib/python3.10/site-packages/STalign/STalign.py:857, in extent_from_x(xJ)
834 def extent_from_x(xJ):
835 ''' Given a set of pixel locations, returns an extent 4-tuple for use with np.imshow.
836
837 Note inputs are locations of pixels along each axis, i.e. row column not xy.
(...)
855
856 '''
--> 857 dJ = [x[1]-x[0] for x in xJ]
858 extentJ = ( (xJ[1][0] - dJ[1]/2.0).item(),
859 (xJ[1][-1] + dJ[1]/2.0).item(),
860 (xJ[0][-1] + dJ[0]/2.0).item(),
861 (xJ[0][0] - dJ[0]/2.0).item())
862 return extentJ

File ~/.local/lib/python3.10/site-packages/STalign/STalign.py:857, in (.0)
834 def extent_from_x(xJ):
835 ''' Given a set of pixel locations, returns an extent 4-tuple for use with np.imshow.
836
837 Note inputs are locations of pixels along each axis, i.e. row column not xy.
(...)
855
856 '''
--> 857 dJ = [x[1]-x[0] for x in xJ]
858 extentJ = ( (xJ[1][0] - dJ[1]/2.0).item(),
859 (xJ[1][-1] + dJ[1]/2.0).item(),
860 (xJ[0][-1] + dJ[0]/2.0).item(),
861 (xJ[0][0] - dJ[0]/2.0).item())
862 return extentJ

IndexError: index 1 is out of bounds for dimension 0 with size 1

@OMIC-coding
Copy link
Author

A simple affine alignment is needed to align the single-cell spatial transcriptomics dataset with the H&E staining image. So I performed non-linear local alignments via LDDMM. However, I encountered the bug illustrated as above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant