Calling SPM segentation with T1 and T2

hello Francois,

Do you think it could be possible to call SPM segmentation using the T1 and T2 images as input ?
I think the first lines of the piepline (brainstorm3/toolbox/anatomy/mri_normalize_segment.m at master · brainstorm-tools/brainstorm3 · GitHub) can be modified to the following script when the user is selecting 2 MRI (eg T1 and T2) in the GUI.

Note that using T1 and T2 is especially important for nirs as we need to have a good estimate of the CSF layer.

matlabbatch{1}.spm.spatial.preproc.channel(1).vols = {[NiiFile ',1']};
matlabbatch{1}.spm.spatial.preproc.channel(1).biasreg = 0.001;
matlabbatch{1}.spm.spatial.preproc.channel(1).biasfwhm = 60;
matlabbatch{1}.spm.spatial.preproc.channel(1).write = [0 0];
matlabbatch{1}.spm.spatial.preproc.channel(2).vols = {[NiiFile2 ',1']};
matlabbatch{1}.spm.spatial.preproc.channel(2).biasreg = 0.001;
matlabbatch{1}.spm.spatial.preproc.channel(2).biasfwhm = 60;
matlabbatch{1}.spm.spatial.preproc.channel(2).write = [0 0];

Best regards,
Edouard

Hi @edelaire

We recommend to the user to include the T1 and T2 for the FEM head model generation,
and the current implementation of the Headreco within Brainstorm can use both T1 and T2 for better segmentation of the CSF and the skull. And headreco calls internally SPM-CAT.

Best

For better segmentation of the T1+T2 images, it would be probably more indicated to use SimNIBS indeed. See process_fem_mesh.m.

However, if we can improve the SPM segmentation easily (much faster and lighter in terms of dependencies), let's do it.

@edelaire Have you tested the batch you propose here?
Where did you find references explaining how to write a multi-channel batch?
How did you evaluate the quality of the output?

Hello

Thank you @tmedani, I will try tomorrow. For the T1 and T2, I guess I should import them in brainstorm and then register and reslice the T2 to the T1 image; and then launch the FEM or should I use the image created by fressurfer (eg after recon -all)? Especially, I saw that the output T2 of free surfer is cut to contains only the brain (eg no eye or skull)

However, even if it's looks great, I am not sure I will be able to use it since; right now, for nirs we need to have: -the head shape, the cortical surface, and the segmentation of the head in 5 tissue as generated by SPM (eg one value per voxel of the MRI). I will try t see if Mcxlab also support FEM mesh as input for the segmentation :slight_smile:

However, if we can improve the SPM segmentation easily (much faster and lighter in terms of dependencies), let's do it.

I actually generated the batch using the GUI of SPM and ask it to generate the Matlab script. This is actually similar to what is done at the beginning of process_fem_mesh (brainstorm3/toolbox/process/functions/process_fem_mesh.m at master · brainstorm-tools/brainstorm3 · GitHub). I think we can call this pipeline without creating the FEM mesh.

How did you evaluate the quality of the output?

That's the issue. It looks actually very similar and since we don't have any ground truth I find it very difficult to say this pipeline is better than another. Even Cat12 with just the T1 image seems to be giving very similar results. So I am very confused about what pipeline I should use. For now, I identified 3 main pipelines that would give me the head surface, cortical surface, and segmentation. (with the possibility to use BET from fsl to remove any suspicious skin that would appear in the background of the segmentation like in Noisy segmentation - #3 by edelaire)

1/ Cat12 on the T1 image
2/ Using Freesurfer on T1 and T2 to generate Head surface, and cortical surface; and SPM12 on T1 (and T2) to generate the segmentation. ( a variant is to use only the SPM segmentation result to complete the ASEG segmentation created by Freesurfer that only contains white matter; grey matter and CSF).
3/ Using one of the pipelines to generate a FEM mesh ( brain2mesh or SimNIBS)

But again, comparing the output seems complicated without ground truth. I will try to see if the developers of Mcxlab have any recommendations on how to generate this segmentation.

Edit: I tried Brain2mesh but tetgen is failing. From the tutorial, it means that I might have intersecting surfaces; but we cannot check when launching Brain2mesh directly from the T1 and T2 images.

Regards,
Édouard

1 Like

I actually generated the batch using the GUI of SPM and ask it to generate the Matlab script.

Good! I added the option to run the SPM Segment batch with 2 channels T1+T2.
If there is a file with the tag "t2" in its comment in the subject, the GUI would ask whether you want to use it in the computation. For the process version, I added an option "Use T2 when available".

Thanks for the suggestion.
Can you please try it and let me know if it works with your files?

Especially, I saw that the output T2 of free surfer is cut to contains only the brain (eg no eye or skull)

For what I understood, the T2 is mostly useful to refine the cortical surface.

For the T1 and T2, I guess I should import them in brainstorm and then register and reslice the T2 to the T1 image;

I don't know whether the T2 should be resliced on the T2 for the various segmentation methods. This might result in a loss of resolution...
@tmedani?

For the the SPM Segment: maybe you can try this yourself (whether you need to coregister T1+T2 first, or whether SPM does this coregistration anyway when there are multiple channels)?

Hi @edelaire

sorry for late reply,

I have started an advanced FEM tuto here, you can have a look
https://neuroimage.usc.edu/brainstorm/Tutorials/tutoFEMadvanced?highlight=(FEM)

Once the FEM mesh with SimNIbs is done, you will have the tissues in the database, and you can extract the surfaces of the FEM mesh easily (right click> extract surfaces). Then you can build any model you want.

You can also have a look at the headreco.py script from where the SPM-CAT batch is called, I think it can help you to reproduce and adapt your code from there.

@Francois

If I remember well, with SimNibs we don't need to reslice the volume, even more we don't need to co-register the T2 to the T1 from Braintorm, all these steps are handeled by SimNibs Headreco.
However, if we use the roast pipeline, I think reslicing is required either from Brainstorm or with adding an argument to the roast command line.