Hi Giorgio,
> Hi all, here I am again, for a hint on the use of spm_segment from the
> command line.
All the necessary parameters are actually documented in the code, but I
agree it is sometimes a little tedious to follow the calls :) I think
what you are interested in is unified segmentation (default in spm5 and
spm8), which is realized using spm_preproc and other functions (not
spm_segment, which may explain your unsatisfactory results). You could
try something like
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);
for the general options. In order to specify your own tissue maps, try
something like
opts_seg.tpm = char(fullfile(spm('Dir'),'tpm','my_grey.img'),...
fullfile(spm('Dir'),'tpm','my_white.img'),...
fullfile(spm('Dir'),'tpm','my_csf.img'));
or whatever you want to call them or wherever you want so store them.
You can then produce the parameters with
results = spm_preproc('your_3D_here', opts_seg);
and save them using
[po,pin] = spm_prep2sn(results);
spm_prep2sn(results);
Then, set the options as in
opts_write = struct('biascor',0,...
'GM',[0 0 1],...
'WM',[0 0 1],...
'CSF',[0 0 1],...
'cleanup',1);
or any other combination of files you may be interested in writing out,
and write the data using
spm_preproc_write(po,opts_write);
I hope this gives you some clues.
Best,
Marko
PS: Disregard all of the above if you use spm2, but you know you should
not do that, right :) ?
> This is my code:
>
> function segment(filename)
> global defaults % spm_defaults is called in the main program, with
> global defaults
>
> PG = char( ...
> 'spm5\tpm\grey.nii', ...
> 'spm5\tpm\white.nii', ...
> 'spm5\tpm\csf.nii') ;
>
> flags = defaults.segment;
> spm_segment(filename,PG,flags);
>
>
> Is that right? I am not so sure.
> Before calling this function, I coregistered my image with a template
> (T1_template.nii) which is coregistered with grey.nii etc.
> Is this the right procedure (coregistering with a template, then using
> the three WM/GM/CSF templates for segmentation)?
>
> In reality, even from the GUI I am not always getting good results, I
> admit, so there must be something wrong somewhere....
>
> Thanks for your attention!
> Best regards
> Giorgio
>
--
=====================================================================
Marko Wilke (Dr.med./M.D.)
[log in to unmask]
Universitäts-Kinderklinik University Children's Hospital
Abt. III (Neuropädiatrie) Dept. III (Pediatric neurology)
Hoppe-Seyler-Str. 1, D - 72076 Tübingen
Tel.: (+49) 07071 29-83416 Fax: (+49) 07071 29-5473
=====================================================================
|