function [blankvid] = reconstructMovement(options, d1, d2, d3) % online motion correction through DFT subpixel registration % Based on the dftregistration.m function from Manuel Guizar and Jim Fienup % Adapted from NoRMCorre by Emily Redington % INPUTS % options: options structure for motion correction % d1, d2, d3: shape parameters created from the registration process % OUTPUTS (none) %% set default parameters if not present if ~exist('options','var') || isempty(options) options = NoRMCorreSetParms('d1',sizY(1),'d2',sizY(2)); if nd > 2; options.d3 = sizY(3); end end grid_size = options.grid_size; mot_uf = options.mot_uf; min_patch_size = options.min_patch_size; %% setup grids for patches [xx_s,xx_f,yy_s,yy_f,zz_s,zz_f,xx_us,xx_uf,yy_us,yy_uf,zz_us,zz_uf] = construct_grid(grid_size,mot_uf,d1,d2,d3,min_patch_size); blankvid = zeros(d1, d2, 2); for i = 1:length(xx_s) for j = 1:length(yy_s) blankvid(xx_s(i):xx_f(i), yy_s(j):yy_f(j), 1) = i; blankvid(xx_s(i):xx_f(i), yy_s(j):yy_f(j), 2) = j; end end end