CAT12 - 5 tissue segmentation

Hi Francois,
I just discovered Cat12 implementation inside brainstorm, and it is working great !!
That's why i was wondering if we could use it for nirstorm.

To compute our forward model, we need to have a segmented MRI into 5 tissue where each voxel is labeled from 1 to 5 (1:scalp, 2:skull, 3:CSF, 4: gray, 5:white matter). SPM12 (and therefore Cat12, i guess) should be able to generate it, but i can't find it in the output of folder.

Do you think it could be possible to have it ?

Best regards,
Edouard

With the new FEM developments (https://neuroimage.usc.edu/brainstorm/Tutorials/FemMesh), we are implementing new tools to compute and store in the database segmented MRIs.

You can obtain a volume with 5 labels using FieldTrip (which uses the tissue segmentation from SPM).
Right-click on your MRI > FieldTrip MRI segmentation, you'll get a new volume named "tissues".
(you need to have FieldTrip installed, or use the compiled version of Brainstorm)

image image
image

@CGaser Can we get such volume using CAT12?

Hi Francois,

CAT12 also supports writing more than the 3 common tissue classes. In order to also write the remaining 3 tissue classes (i.e. 3 background classes) you can either change the "cat.output.TPMC.native" parameter in cat_defaults.m or use the expert mode in CAT12 to enable GUI selection of this feature. You can also add the following line to your batch file (example for native space):
matlabbatch{1}.spm.tools.cat.estwrite.output.TPMC.native = 1;
If you intend to write the images rather in MNI space the "native" filed should be replaced by "warped".

Best,
Christian

forgot to add, that you have to create your label image after that procedure, because label images in CAT12 are always restricted to the 3 common tissue classes.

Best,

Christian

If I add this line
matlabbatch{1}.spm.tools.cat.estwrite.output.TPMC.native = 1;
to the script, I would get in output an additional .nii file which would be the equivalent of the TPM.nii but in subject space?
And I would use the script you sent me by email to create a labeled volume with 5 labels?
It would be interesting to save it in the database for other purposes (FEM computation especially), similarly to what we've done with FieldTrip.

What is it added cost for this extra option (computation time and storage)?

@CGaser
I'm not sure I understand the impact of this additional parameter:
matlabbatch{1}.spm.tools.cat.estwrite.output.TPMC.native = 1;
What is the difference supposed to be?

With or without this option, I still have 3 files in output in the mri folder:
p0subjid.nii (CSF+GM+WM), p1subjid.nii (GM), p2subjid.nii (WM).

Is there a way to get the skin and bone masks?

Sorry, it's a bit more tricky and some options (even if defined in cat_defaults.m) are only available in expert mode You have to call cat12('expert') before running a batch. Then, the 3 additional segmentation p4-6 are saved. Furthermore, you also have to enable the CSF image:
matlabbatch{1}.spm.tools.cat.estwrite.output.CSF.native = 1;
This takes not more computation time than the standard segmentation. If you need the images in normalized space (or rigid/affine), take a look at the cat_defaults.m fiel for the different saving options.
The complicated use of expert options will be changed very likely in the final CAT12.7 version.

Best,

Christian

You have to call cat12('expert') before running a batch

This command opens 3 figures that we don't really want to see when working in batch mode from Brainstorm (the SPM12 graphics window, the input window, the cat12 figure with the buttons).

Is there a way to start CAT in expert mode in a different way?

This will be possible with the new version we are working on...

Best,

Christian

Great!
Any idea when this will be released?

Last question: I could get all the p1..6.nii files with your last indications.
With the logic of the code you sent me, I get very noisy separation for the skin (4) and skull layers (5). There are plenty of isolated "skull voxels" in the skin layer (example below: select voxel is classified as skull).
Is this expected, or am I doing something wrong?
Any quick and easy solution for improving this?

Thanks for all your help!

@edelaire
I've just posted a first version of the code to get the tissues from CAT12:

We'll need to refine this with the next version of CAT.

Wow. i was not expecting so many answer so quickly. I'll go over them during the weekend and do test with field trip and CAT12 and report the result here.

Thanks a lot for your help :slight_smile:

@GuyRens, I guess you were also interested in segmentation for NIRS usage, so this topic might interest you :slight_smile:

1 Like

Hi @Francois

I did some test, it's working great with Cat12 !!
Just a few comment :

  • The order of the tissue is reversed from what is used in nirstorm. Current version output is 5:scalp, 4:skull, 3:CSF, 2: gray, 1:white matter when NIRSTORM use 1:scalp, 2:skull, 3:CSF, 4: gray, 5:white matter. Is it possible to change that ?

  • It might be that my computer is too old, but even if the segmentation is really fast (<60min), then the importation is also taking ~1hour. It seems that the nearest neighbour search step is taking a lot of time.

  • When using the overlay option to display segmentation over MRI, it's actually hard to see the anatomical MRI under the segmentation. And the transparency cursor doesn't change anything.

also, for my personal knowledge, do you think it could be possible to refine this segmentation using an additional T2 image ?

edit : [quote="Francois, post:10, topic:19129"]
Last question: I could get all the p1..6.nii files with your last indications.
With the logic of the code you sent me, I get very noisy separation for the skin (4) and skull layers (5). There are plenty of isolated "skull voxels" in the skin layer (example below: select voxel is classified as skull).
Is this expected, or am I doing something wrong?
Any quick and easy solution for improving this?
[/quote]

Yes, I was worried about that too. but it seems we have the same behavior in the colin27 template that was made by Thomas :

Best regards,
Edouard

so few segmentation result every time displayed as an overlay with MRI. Used 15000 vertex each time.

on ICBM :

On the nirstorm version of Colin27 template (to be compared with my previous post).
I guess we have this large bock because we don't have the bottom of the MRI ?

and for the sake of fun I did the segmentation one of my own MRI acquired few years ago (might try to compare with more recent one ahah):

Quick question, what is the surface used for the cortex ?

No, we're aligning on other programs using this convention, we won't change it.

It might be that my computer is too old, but even if the segmentation is really fast (<60min), then the importation is also taking ~1hour. It seems that the nearest neighbour search step is taking a lot of time.

Indeed, this is terrible, but it will get faster soon.
The CAT developers are working on a new version of CAT12 that will include much faster algorithms to project the FSAverage atlases to the subject space.

When using the overlay option to display segmentation over MRI, it's actually hard to see the anatomical MRI under the segmentation. And the transparency cursor doesn't change anything.

It's the transparency slider in the panel Data options that you should adjust.

also, for my personal knowledge, do you think it could be possible to refine this segmentation using an additional T2 image ?

@CGaser?

Quick question, what is the surface used for the cortex ?

I'm sorry, I'm not sure what you're asking for here. Can you be more specific?

An additional T2 will usually not help (except for better skull-stripping) because the contrast between gray and white matter is rather low and will lower the segmentation accuracy compared to the use of T1 weighted data only.

Best,

Christian

Hi @edelaire,

I de-activated notifications from brainstorm and just recently noticed this post.
Thank you so much for calling this to my attention.
I'm still working on all aspects of cortical reconstruction of fNIRS data in nirstorm.
I was trying to do segmentation in freesurfer, but this will be extremely helpful. To bad I only noticed it now..

Many thanks again

Guy