cortex-lab / Suite2P

Tools for processing 2P recordings
Other
122 stars 66 forks source link

Skipping image registration #80

Closed jenwallace closed 6 years ago

jenwallace commented 7 years ago

Hi, if I try to run the master_file with ops0.doRegistration = 0, I get the following error:

Error using zeros NaN and Inf not allowed.

Error in loadAndBin (line 9) mov = zeros(numel(ops.yrange), numel(ops.xrange), ops.NavgFramesSVD, 'single');

Error in get_svdForROI (line 20) mov = loadAndBin(ops, Ly, Lx, nimgbatch, nt0);

Error in sourcery (line 5) [ops, U0, model, U2] = get_svdForROI(ops);

Error in run_pipeline (line 83) [ops, stat, model] = sourcery(ops);

Error in master_file (line 89) run_pipeline(db, ops0);

Everything is running fine on the same data set if I go ahead and do the registration. Can you tell me what I'm doing wrong or if this is a bug? Thanks!

marius10p commented 7 years ago

It's probably a bug. We made some re-organizations recently and this probably broke. We don't really use this option, since it's almost the same speed to do the registration or not. Most of the time is spent loading tiffs and writing the binary files.

We'll try to fix it soon.

mkrumin commented 7 years ago

I think this is exactly the point, if you have already done the loading tiffs/registration/writing binary files you don't want to redo this if you only want to re-run ROI detection with different parameters, for example. I though that the doRegistration flag applies to all three substeps (including tiffs and binaries), and not only to the registration itself.

marius10p commented 7 years ago

ops.doRegistration is simply supposed to load tiffs and write them to a binary without registration.

What Michael wants is in fact already working automatically: as long as the binary file is in the right place, with the right name, and the "regops" file exists, then Suite2p finds them and skips all three substeps of registration.

mkrumin commented 7 years ago

Oh, great. Didn't know that it works that way. Thanks.

ghost commented 7 years ago

I similarly encounter this same exact error/issue when I skip registration, however my motivation is different for wanting to skip the registration. Sometimes we wish to run segmentation on data that we have motion-corrected either in real time during acquisition or after using a different registration approach. Being able to just perform segmentation on tiffs without the need to have previously run suite2p registration on those particular tifs would be a nice feature.

as31 commented 7 years ago

Reg2P.m: ops1{i}.Nframes(k) = ops1{i}.Nframes(k) + size(dwrite,3); is missing from line 255

Reg2P.m and blockReg2P.m: ops1{i}.badframes = false(sum(ops1{i}.Nframes), 1); needs to be initialized in the "else" portion of the last doRegistration flag

These 3 additional lines (which are used elsewhere) fixes the issue

carsen-stringer commented 7 years ago

I've fixed this now, let me know if this is still an issue. Thanks for the help @as31