neurospin / pypreprocess

Preprocessing scripts for neuro imaging
105 stars 66 forks source link

Update the probabilistic maps for the Segmentation? #254

Open estheryclin opened 7 years ago

estheryclin commented 7 years ago

Because we have had issues that data of two subjects cannot be segmented correctly. We found that pypreprocess is using the probabilistic maps for SPM8 '/i2bm/local/spm12/toolbox/OldSeg/grey.nii', '/i2bm/local/spm12/toolbox/OldSeg/white.nii', '/i2bm/local/spm12/toolbox/OldSeg/csf.nii'

When we tried with the latest probabilistic maps for SPM12, it solved our problems. /i2bm/local/spm12/tmp/TMP.nii.1 % grey matter /i2bm/local/spm12/tmp/TMP.nii.2 % white matter /i2bm/local/spm12/tmp/TMP.nii.3 % CSF /i2bm/local/spm12/tmp/TMP.nii.4 % bone /i2bm/local/spm12/tmp/TMP.nii.5 % soft tissue /i2bm/local/spm12/tmp/TMP.nii.6 % air/background

Do you have any concern to keep the SPM8 maps, or could it be updated to the SPM12 version? Thanks!

mrahim commented 7 years ago

Actually "OldSeg" in spm12 (equivalent to "Segment" in spm8) needs grey/white/csf.nii to carry the segmentation. "Segment" in spm12 (equivalent to "NewSegment" in spm8) needs TPM/tpm.nii.

Could you copy/paste your script ?

estheryclin commented 7 years ago

You mean the MATLAB code for the step Segment? Below it is.

stage = stage + 1;
stage_segmentation = stage;

matlabbatch{stage}.spm.spatial.preproc.channel.vols = {anatfile };
matlabbatch{stage}.spm.spatial.preproc.warp.write = [0 1];
matlabbatch{stage}.spm.spatial.preproc.channel.biasreg = 0.001;
matlabbatch{stage}.spm.spatial.preproc.channel.biasfwhm = 60;
matlabbatch{stage}.spm.spatial.preproc.channel.write = [0 1];
ngaus  = [1 1 2 3 4 2];
native = [1 1 1 0 0 0];
for c = 1:6 % tissue class c
    matlabbatch{stage}.spm.spatial.preproc.tissue(c).tpm = {
        fullfile(spm('dir'), 'tpm', sprintf('TPM.nii,%d', c))};
    matlabbatch{stage}.spm.spatial.preproc.tissue(c).ngaus = ngaus(c);
    matlabbatch{stage}.spm.spatial.preproc.tissue(c).native = [native(c) 0];
    matlabbatch{stage}.spm.spatial.preproc.tissue(c).warped = [0 0];
end
matlabbatch{stage}.spm.spatial.preproc.warp.mrf = 1;
matlabbatch{stage}.spm.spatial.preproc.warp.cleanup = 1;
matlabbatch{stage}.spm.spatial.preproc.warp.reg = [0 0.001 0.5 0.05 0.2];
matlabbatch{stage}.spm.spatial.preproc.warp.affreg = 'mni';
matlabbatch{stage}.spm.spatial.preproc.warp.fwhm = 0;
matlabbatch{stage}.spm.spatial.preproc.warp.samp = 3;
matlabbatch{stage}.spm.spatial.preproc.warp.write = [1 1];
mrahim commented 7 years ago

Well, I was expecting pypreprocess script :)

Anyway, this looks like Segment in spm12 which uses tpm.nii

In pypreprocess, if you do newsegment = True in your config file, it will use spm12 tpms.

estheryclin commented 7 years ago

Yes, I've seen the "newsegment" option in my config file. I will try it out, thank you! :)

chrplr commented 6 years ago

If we now accept that spm12 is the default, we should not use newsegment=True, but just segment=True, right?