MouseLand / suite2p

cell detection in calcium imaging recordings
http://www.suite2p.org
GNU General Public License v3.0
350 stars 241 forks source link

Error with Compute Z-Position function #983

Open kdc14641 opened 1 year ago

kdc14641 commented 1 year ago

I am currently using suite2p v0.13.1, and when I attempt to use the compute z-position feature on the GUI, I get the error message below.

Traceback (most recent call last): File "C:\Users\hpenv\anaconda3\envs\suite2p\lib\site-packages\suite2p\gui\reggui.py", line 761, in self.computeZ.clicked.connect(lambda: self.compute_z(parent)) File "C:\Users\hpenv\anaconda3\envs\suite2p\lib\site-packages\suite2p\gui\reggui.py", line 831, in compute_z ops, zcorr = registration.compute_zpos(self.zstack, self.ops[0]) File "C:\Users\hpenv\anaconda3\envs\suite2p\lib\site-packages\suite2p\registration\zalign.py", line 177, in compute_zpos cfRefImag = rigid.phasecorr_reference(refImg=Z, File "C:\Users\hpenv\anaconda3\envs\suite2p\lib\site-packages\suite2p\registration\rigid.py", line 66, in phasecorr_reference cfRefImg = complex_fft2(img=refImg) File "C:\Users\hpenv\anaconda3\envs\suite2p\lib\site-packages\suite2p\registration\utils.py", line 291, in complex_fft2 next_fast_len(Lx)))) if pad_fft else np.conj(fft2(img)) File "C:\Users\hpenv\anaconda3\envs\suite2p\lib\site-packages\suite2p\registration\utils.py", line 52, in fft2 data_torch = torch.from_numpy(data) TypeError: can't convert np.ndarray of type numpy.uint16. The only supported types are: float64, float32, float16, complex64, complex128, int64, int32, int16, int8, uint8, and bool.

I believe this issue was brought up in thread #756 where the fix was to add a piece of code to Line 26 in registration\utils.py. However, in the current version's code, line 26 falls in the middle of a comment block. As such, I'm not sure how to resolve the error I'm getting.

I would appreciate any advice and help with this issue!