% load two VMRs vmr1 = xff(sourcevmr); vmr2 = xff(targetvmr); % run coregistration (requires SPM5 or SPM8 on the path!!) % vmr2 is the target space (stationary), vmr1 the one to be resampled! trf = vmrspmcoreg(vmr1, vmr2) % resample vmr1 using sinc (lanczos3) interpolation vmr1_in_vmr2_space = vmr1.ApplyTRF(trf, struct('method', 'lanczos3')); % save TRF and VMR [sourcepath, sourcefile] = fileparts(sourcevmr); if isempty(sourcepath) sourcepath = '.'; end [nullpath, targetfile] = fileparts(targetvmr); trf.SaveAs(sprintf('%s/%s-TO-%s.trf', sourcepath, sourcefile, targetfile)); vmr1_in_vmr2_space.SaveAs(sprintf('%s/%s-TO-%s.vmr', sourcepath, sourcefile, targetfile)); % clear objects clearxffobjects({vmr1, vmr2, trf, vmr1_in_vmr2_space});