Hi Christian,
> I am writing a script that relies on calling several spm functions directly.
Yep, I like to do that, too :)
> pm_segment has proven difficult to get to work properly. In particular, I'm having difficulty making it do the same work as a regular run of the segment module in the gui. Any direct call to the function gives me a very poor output (.nii files) and no .mat files that can be used later during normalization. Judging from the graphics reporting the progress it seems like the segment module does a couple of things before running the segmentation function. Any help on how to best make this work without relying on a batch would be greatly appreciated.
I think you may use the wrong function. If you are interested in unified
segmentation, the functions to call are spm_preproc, spm_prep2sn, and
spm_preproc_write. I include an example below. If you really are
interested in the old style of segmentation, I do not think it will give
you normalization parameters (instead, it will actually expect them).
Hope this helps,
Marko
% === start of snippet ===
% first, set options (watch out for line breaks)
opts_seg = struct('ngaus',[2 2 2 4], 'warpreg',1, 'warpco',25,
'biasreg',1.0000e-004, 'biasfwhm',50, 'regtype','mni', 'fudge',5,
'msk','', 'samp',3);
opts_write = struct('biascor',0,'GM',[0 0 1],'WM',[0 0 1],'CSF',[0 0
1], 'cleanup',1);
% segment dataset
results = spm_preproc(ana, opts_seg);
% process generated spatial normalization parameters
[po,pin] = spm_prep2sn(results);
% save parameters
spm_prep2sn(results);
% write out segmented data
spm_preproc_write(po,opts_write);
% === end of snippet ===
--
____________________________________________________
PD Dr. med. Marko Wilke
Facharzt für Kinder- und Jugendmedizin
Leiter, Experimentelle Pädiatrische Neurobildgebung
Universitäts-Kinderklinik
Abt. III (Neuropädiatrie)
Marko Wilke, MD, PhD
Pediatrician
Head, Experimental Pediatric Neuroimaging
University Children's Hospital
Dept. III (Pediatric Neurology)
Hoppe-Seyler-Str. 1
D - 72076 Tübingen, Germany
Tel. +49 7071 29-83416
Fax +49 7071 29-5473
[log in to unmask]
http://www.medizin.uni-tuebingen.de/kinder/epn
____________________________________________________
|