flatironinstitute / NoRMCorre

Matlab routines for online non-rigid motion correction of calcium imaging data
GNU General Public License v2.0
144 stars 89 forks source link

Some videos exit with error #33

Open jrclimer opened 2 years ago

jrclimer commented 2 years ago

My videos have non-square pixels. In some (but not most) of my videos exit with the following error:

Error using normcorre_batch (line 283)
Index exceeds array bounds.

Here is the code I use to call normcorre_batch:

d1 = size(M1,1);
d2 = size(M1,2);

options_nonrigid = NoRMCorreSetParms(...
    'd1',d1,...
    'd2',d2,...
    ...
    'grid_size',[d1/4,d2/4],...
    'overlap_pre',[d1/16,d2/16],...
    'min_patch_size',[d1/16,d2/16],...
    'min_diff',[d1/32,d2/32,5],...
    'us_fac',50*d2/d1,...    
    'mot_uf',[2048/d1 2048/d2],...
    'max_dev',[d1/(170+2/3) d2/(170+2/3)],...
    'overlap_post',[d1/16 d2/16],...
    'max_shift',[d1/(512/70) d2/(512/70)],...
    ...    
    'bin_width',200,...        
    'init_batch',600,...
    'boundary',NaN);
tic; [M2,shifts2,template2,options_nonrigid] = normcorre_batch(M1,options_nonrigid); toc

A video that crashes normcorre can be found here (https://bit.ly/3hwT2k9).