CAT12 tissue segmentation error

i uploaded a T1 MRI in brainstorm, following the "import subject anatomy" tutorial. I started the MNI normalisation and checked the fiducial points as described in the Tutorial.
I also installed the SPM and Cat12 Plugin. Then I followed the Tutorial " MRI Segmentation with CAT12"
Unfortunately the results for the tissue segmentation i get, look like this:

when i then check the MRI registration like this,


it appears to be more or less correct.

Do you have any idea what my mistake is, or what i need to do differently to get a correct display of the tissues?

Best regards,

@schwoon Can you please an example MRI?
(upload the zipped .nii file somewhere and post the download link here)

If you cannot share it publicly you may:

  1. anonymize it first (right-click > Deface) - but make sure you still get the same behavior from CAT12 with the defaced volume before sharing it
  2. send it as a private message on this forum to me and @CGaser (developer of CAT12)


Thank you for sharing this example.

I imported the file in a new subject, without setting the fiducials, and I executed CAT12 (right-click on the MRI > MRI segmentation > CAT12).
And it seems to work correctly:

Hello Francois,

i tried it again and it works as long as i only upload that one MRI into the subject.
As soon as i coregister other MRIs using SPM, (which i have to to determine the electrode positions in the postimplant MRI), i get the wrong result. Although i still only click on the first MRI for the MNI segmentation via CAT12.
Could that be why it doesn´t work for me?

Thank you very much for your help.

Yes, it is possible that Brainstorm selects additional files as a T2 file, or uses the wrong file in input. This is probably a bug I need to fix.

Can you please describe the exact sequence of interface clicks you are doing, so I can try to reproduce it on my end?

Additionally, the full imported subject anatomy would help me :

  • create a new subject,
  • import/coregister all the MRI/CT volumes you need
  • right-click on the subject > File > Export subject
  • upload the zip file somewhere and share the link with me
  • start the CAT12 computation by right-clicking on the first MRI in the folder - only to make sure that this configuration leads to the error on your computer.

I create the subject:

  1. import anatomy folder --> 15000 vertices on the cortex --> MNI normalization with maff 8--> i do not change the fiducials --> save (i tried starting cat12 at this point, with a test subject and it works perfectly fine and i get correct results)
  2. right click on the subject --> import MRI (as the file setting i have "all MRI files") --> coregister with SPM --> reslice the volume: yes
  3. right click on the subject --> import MRI (as the file setting i have "all MRI files") -->
    grafik (i click ja here)
    --> SPM coregistration--> reslice
  4. the last MRI exactly like the second

Then i right click on the first MRI --> MRI segmentation --> CAT12--> leads to the error i send you a picture of

I uploaded the subject anatomy here.

Thank you for the test data. You can delete it now.

I did the following:

  • I loaded the subject (menu File > Load protocol > Import subject from zip),
  • right-clicked on the first MRI (T1) > MRI segmentation > CAT12
  • Number of vertices: 15000
  • Extra volumes: NO
  • Cortical maps: NO
  • Delete existing files: YES

The tissue segmentation seems to be working correctly:

I have no idea what could go wrong here.
@CGaser Any idea?

Could it be just a display problem?
Double-click on the file "tissues_cat12", navigate in the volume.
Is the anatomy label at the top-right corner of the MRI viewer showing correct labels? Or does it show what the colors seem to indicate?

Thank you,
I downloaded the zip file that i sent you and tried it again to doublecheck and it works.
When i then try it exactly as i described earlier by importing the MRIs etc. it does not work and it is not only a display problem. I really have no idea what i am doing wrong here.

Difficult to say. I also have tried to process the image and it was running without any issues...

So i have my original subject (P1) with the 4 MRIs that i sent you and the subject, created from the zip file (P1 zip). As you can see it only works with the latter:

To me that makes absolutely no sense at all, because the zip file was created from the original P1 subject.
The settings for the two subjects (which are in the same protocol) are identical, :


the only difference is that i already registered electrodes in the P1 subject. So to check if that was the problem, i deleted those electrodes and tried the segmentation again. It did not work. Could there still be some problem when i import functional data before starting the CAT12 segmentation?

We have also tried tried exporting the entire protocol as a zip file, and tried to run the segmentation on a different computer but that does not work either.

In total i have 15 subjects with 3-4 MRIs each and the CAT12 segmentation only works correctly in three of them, although i imported the MRIs in the same way (as described earlier) and used T1 weighted images.

Since it is only a few clicks to create a subject, register the MRIs and start the CAT 12 segmentation and i described to you exactly what i did (and also used the tutorial as a guideline), i feel like there is not that much room for mistake on my side and there must be some kind of problem.

Do you have any more ideas what else i could try to fix this issue?

As I mentioned previously, one possible problem is that the volume given to CAT12 is not the correct one.

First, reload the subject to make sure that what is shown in the database explorer is really what is available on the hard drive (Right-click on the subject > Reload).

To inspect the inputs that are given to CAT12, put a breakpoint in function process_segment_cat12.m at line 162 (beginning of function Compute) = click on the line number.
Then start again CAT12. When the debugger stops, you can inspect the contents of all the variables that are passed to the function. Execute the code line by line (button "Step") until line 273 (CAT12 startup) in order to check which MRI file is selected (variable T1FileBst).
Repeat the same operation for the two subject (P1 and P1_zip), and check whether there are any differences in the inputs in two cases.

One last comment:
In your import pipeline, you mention that the first step is "Import anatomy folder": There is no folder here, but a single volume. I don't know if this can cause any problem, but you should the menu "Import MRI" instead.