The change from using the 4th to the 5th dimension was in order to
conform with NIfTI. The 4th dimension is reserved for time.
Best regards,
-John
On Tue, 2009-07-07 at 12:29 +0200, Sarang S. Dalal wrote:
> Hello everyone,
>
> I've been using code that has worked under SPM2 and SPM5 to go back
> and forth between coordinates in an individual subject's MRI space to
> MNI space, inspired by John's Gems 5 and 11:
> http://www.sph.umich.edu/~nichols/JohnsGems2.html#Gem5
>
> However, the procedure seems to need updating for SPM8 (and/or perhaps
> for the Nifti format). Just thought I'd share what I've come up with.
>
> Note: the following jobman runs can be done entirely in the GUI, but
> as I'm using the normalization routines outside the standard SPM
> processing stream, I wanted to generate command-line equivalents.
> These have changed since previous versions of SPM as well.
>
> To generate the Deformation file (y_Blah.nii), as spm_sn2def.m no
> longer exists, I do the following -- many thanks to Guillaume for
> getting me started:
> matlabbatch{1}.spm.util.defs.comp{1}.sn2def.matname = {'Blah_sn.mat'};
> matlabbatch{1}.spm.util.defs.comp{1}.sn2def.vox = NaN(1,3);
> matlabbatch{1}.spm.util.defs.comp{1}.sn2def.bb = NaN(2,3);
> matlabbatch{1}.spm.util.defs.ofname = 'Blah';
> matlabbatch{1}.spm.util.defs.fnames = '';
> matlabbatch{1}.spm.util.defs.interp = 1;
> spm_jobman('run',matlabbatch);
>
>
> Then to create the inverse deformation (what would have been called
> iy_Blah.img in SPM2/SPM5):
> matlabbatch{1}.spm.util.defs.comp{1}.inv.comp{1}.sn2def.matname =
> {'Blah_sn.mat'};
> matlabbatch{1}.spm.util.defs.comp{1}.sn2def.vox = NaN(1,3);
> matlabbatch{1}.spm.util.defs.comp{1}.sn2def.bb = NaN(2,3);
> matlabbatch{1}.spm.util.defs.comp{1}.inv.space = {'wBlah.nii,1'};
> matlabbatch{1}.spm.util.defs.ofname = 'iBlah';
> matlabbatch{1}.spm.util.defs.fnames = '';
> matlabbatch{1}.spm.util.defs.interp = 1;
> spm_jobman('run',matlabbatch);
>
> This creates y_iBlah.nii... but for some reason, this volume has
> dimensions [81 98 83 1 3] (i.e., the 3 deformation fields are now
> defined in the fifth dimension rather than fourth). So John's Gem #5
> needs to be modified with the following simple change:
> P = [repmat(P,3,1) [',1,1';',1,2';',1,3']];
>
> Cheers,
> Sarang
>
> --
> Sarang S. Dalal, Ph.D.
> INSERM U821-Dynamique Cérébrale et Cognition
> http://tempest.ucsf.edu/~sarang/
> [log in to unmask]
> tel: +33 4 72 13 89 15
> fax: +33 4 72 13 89 01
>
--
John Ashburner <[log in to unmask]>
|