Hi Rik,
There's nothing to be scared of with the spm_jobman structures. If you create
a single job, you can save it as a .m file. This can then be tidied up to
make it a bit more clear. Once you have this, then it is a simple matter of
running the data structure with spm_jobman. For example, importing the data
into a form that DARTEL can use could be by:
matnames = {'/home/john/data/image1_seg_sn.mat'
'/home/john/data/image2_seg_sn.mat'
'/home/john/data/image3_seg_sn.mat'};
jobs{1}.tools{1}.dartel{1}.initial = struct(...
'matnames',{matnames},...
'odir', {{'/home/john/data'}},...
'bb', nan(2,3), 'vox', 1.5,...
'image', 0, 'GM', 1, 'WM', 1, 'CSF', 0);
spm_jobman('run',jobs);
Actually running the DARTEL registration bit is by simultaneously matching the
imported grey and white matter images to their common averages:
images = {{'/home/john/data/rc1image1.nii,1'
'/home/john/data/rc1image2.nii,1'
'/home/john/data/rc1image3.nii,1'};
{'/home/john/data/rc2image1.nii,1'
'/home/john/data/rc2image2.nii,1'
'/home/john/data/rc2image3.nii,1'}};
param = struct(...
'its',{3,3,3,3,3,3},...
'rparam',{[4; 2; 1e-6],[2; 1; 1e-6],[1; 0.5; 1e-6],...
[0.5; 0.25; 1e-6],[0.25; 0.125; 1e-6],[0.125;0.0625; 1e-6]},...
'K',{0,0,1,2,4,6},...
'slam',{16,8,4,2,1,0.5});
settings = struct('template','Template', 'rform',0,...
'param',param,...
'optim', struct('lmreg',0.01, 'cyc', 3, 'its', 3));
jobs{1}.tools{1}.dartel{1}.warp = struct('images',{images},...
'settings',settings);
spm_jobman('run',jobs);
Creating modulated and warped grey and white matter is then by:
jobs{1}.tools{1}.dartel{1}.crt_warped = struct(...
'flowfields', {{'/home/john/data/u_rc1image1_Template.nii'
'/home/john/data/u_rc1image2_Template.nii'
'/home/john/data/u_rc1image3_Template.nii'}},...
'images', {{{'/home/john/data/rc1image1.nii'
'/home/john/data/rc1image2.nii'
'/home/john/data/rc1image3.nii'}
{'/home/john/data/rc2image1.nii'
'/home/john/data/rc2image2.nii'
'/home/john/data/rc2image3.nii'}}},...
'jactransf', 1, 'K', 6, 'interp', 1);
spm_jobman('run',jobs);
Alternatively, you may wish to write warped versions of the original images:
jobs{1}.tools{1}.dartel{1}.crt_warped = struct(...
'flowfields', {{'/home/john/data/u_rc1image1_Template.nii'
'/home/john/data/u_rc1image2_Template.nii'
'/home/john/data/u_rc1image3_Template.nii'}},...
'images', {{{'/home/john/data/image1.nii'
'/home/john/data/image2.nii'
'/home/john/data/image3.nii'}}},...
'jactransf', 0, 'K', 6, 'interp', 1);
spm_jobman('run',jobs);
Smoothing the grey matter by 8mm (isotropic) can then be done by:
clear jobs
jobs{1}.spatial{1}.smooth = struct('data',{...
'/home/john/data/mwrc1image1.nii,1'
'/home/john/data/mwrc1image2.nii,1'
'/home/john/data/mwrc1image2.nii,1'},...
'fwhm', [8,8,8], 'dtype',0);
spm_jobman('run',jobs);
Notice the parallels between what you see in the job manager user interface,
and in the data structures. The meanings of the various fields are
documented via the user interface (or the manual), and should hopefully be
fairly straightforward.
Essentially, all the arguments that would be used are bundled together into a
common structure. If you take the smoothing job, then the
"jobs{1}.spatial{1}.smooth" part of the job structure says that it is a
smoothing job. "jobs" is common to everything. "spatial" indicates that it
is in the "spatial" pulldown menu. "smooth" indicates that the smoothing
routine should be called.
The individual fields that are passed to the smoothing routine are "data",
"fwhm" and "dtype".
My hope was that these data structures, saved in a common format such as XML
or whatever, could eventually have been used by various databasing projects
in order to describe what has actually happened to the data. Doesn't look
like this is going to pan out though.
All the best,
-John
On Tuesday 05 August 2008 12:39, Rik Henson wrote:
> Carlton/John -
>
> I don't suppose either of you have a Matlab batch script for a DARTEL
> VBM analysis in the form of a sequence of function calls to the relevant
> spm*.m functions? (This is how I prefer to batch). It would greatly help
> me get up to speed with DARTEL.
>
> Thanks
> Rik
>
> Carlton Chu wrote:
> > Hi Ze:
> >
> > There is no one simple button for VBM analysis, rather you have to go
> > through several stages by yourself.
> > For the most current version of SPM5, first, you can use the
> > segmentation button to segment the images. You don't really need to
> > generate any output images at this stage, but it is recommended to at
> > least generate the native space Grey Matter map to see if something
> > goes wrong.
> > After applying the segmentation, you should get some sn_*.mat
> > parameter files, go to TASKS->Tools->DARTEL tool->Initial Import, and
> > import those parameter files to generate rc1*.nii,rc2*.nii
> > Then select Run Dartel (create template) to generate the deformation
> > parameters.
> > After that, you can then select "create warped", remmeber to choose
> > "Modulation" in the option.
> >
> > Smooth those modulated, normalized images, and use the Basic models to
> > analys your VBM.
> >
> > See the complete guide for DARTEL
> > http://www.fil.ion.ucl.ac.uk/~john/misc/dartel_guide.pdf
> >
> > Best,
> > Carlton
> >
> > zewang wrote:
> >> Dear all,
> >> I'm trying to do VBM using the latest update, but I can't find
> >> "VBM" in
> >> the toolbox. Instead, I found "PET&VBM" the button after I launched
> >> spm in
> >> matlab. Should I download a separate toolbox from Christian's web
> >> (which is
> >> down now)? Another question is if the separate VBM toolbox is not
> >> necessary, does
> >> this mean VBM in spm5 will not generate a local template?
> >>
> >> Thanks.
> >>
> >> ---------------------------------------------
> >> Ze Wang, Ph. D
> >> Center for functional neuroimaging,
> >> Dept of Neurology,
> >> Medicine school, University of Pennsylvania
> >> 3400 Spruce Stree,
> >> 3W Gates building,
> >> Philadelphia, PA 19104
> >> Tel: 215-662-7341
|