CAT12 Missing Files

I tried to run a CAT12 MRI segmentation on a nifti file that I had imported into Brainstorm and after about 20-30 minutes of running CAT12 there was an error messages stating two surface files were not found "lh.central and rh.central". I got this message even after updating to the latest version of CAT12. Anyone have any ideas on what is happening?

Does the MRI need to be a "T1.mgz" file in order to work with CAT12?

Pasting the full error message just in case:

372 - cat_main_gintnorm1639
109 - cat_main1639
907 - cat_run_job1639
34 - cat_run_newcatch
865 - run_job
455 - cat_run
29 - cfg_run_cm
1717 - local_runcj
972 - cfg_util
469 - fill_run_job
247 - spm_jobman
318 - Compute
371 - ComputeInteractive
28 - process_segment_cat12
28 - bst_call
609 - @(h,ev)bst_call(@process_segment_cat12,'ComputeInteractive',iSubject,[])

Print 'Graphics' figure to:
C:\Users\rawan.brainstorm\tmp\cat12\report\catreport_E-0318.pdf
Remove "C:\Users\rawan.brainstorm\tmp\cat12\mri\p1E-0318.nii" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\mri\p2E-0318.nii" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\mri\p3E-0318.nii" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\mri\p4E-0318.nii" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\mri\p5E-0318.nii" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\mri\p6E-0318.nii" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\mri\p0E-0318.nii" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\label\catROIs_E-0318.xml" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\surf\lh.central.E-0318.gii" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\surf\lh.sphere.E-0318.gii" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\surf\lh.sphere.reg.E-0318.gii" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\surf\lh.thickness.E-0318" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\surf\lh.pbt.E-0318" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\surf\rh.central.E-0318.gii" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\surf\rh.sphere.E-0318.gii" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\surf\rh.sphere.reg.E-0318.gii" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\surf\rh.thickness.E-0318" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

Remove "C:\Users\rawan.brainstorm\tmp\cat12\surf\rh.pbt.E-0318" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list
and following batches will may not work correctly!

09-Nov-2020 14:38:34 - Done 'CAT12: Segmentation (current release)'
09-Nov-2020 14:38:34 - Done


** Error: Could not import CAT12 folder:
** Surface file was not found: lh.central
** Surface file was not found: rh.central
**

I am trying to run CAT12 segmentation on the ICBM152 template (which I did last week and it worked fine) and I too am running into the same error.

Regarding all your missing files: make sure you do not start another instance of Brainstorm while you run CAT. Starting Brainstorm empties the temporary folder $HOME/.brainstorm/tmp, which includes the temporary folder for cat12, causing the process to fail.

I updated the CAT segmentation and import in Brainstorm, it may help as well:

I did the following:

  • Created a new subject (default anatomy: NO, default channel file: NO)
  • Right-click on subject folder > Use template > ICBM152
  • Delete all the surfaces, keep only the MRI
  • Execute the script below:
% Process: Segment MRI with CAT12
sFiles = bst_process('CallProcess', 'process_segment_cat12', [], [], ...
    'subjectname', 'CAT12_ICBM152', ...
    'nvertices',   15000, ...
    'tpmnii',      {'', 'Nifti1'}, ...
    'sphreg',      1, ...
    'extramaps',   1);

Here is the output of CAT in the Matlab command window:
(@CGaser: see the errors about catROI_CAT12_ICBM152.xml)

SPM12: spm_cat12 (vCAT12.7)                        19:45:38 - 10/11/2020
========================================================================

   _______  ___  _______    
  |  ____/ / _ \ \_   _/   Expert Mode
  | |___  / /_\ \  | |     Computational Anatomy Toolbox
  |____/ /_/   \_\ |_|     CAT12.7 - http://www.neuro.uni-jena.de

 CAT default file:
	C:\Work\Dev\Divers\spm12\toolbox\cat12\cat_defaults.m



------------------------------------------------------------------------
10-Nov-2020 19:45:46 - Running job #1
------------------------------------------------------------------------
10-Nov-2020 19:45:46 - Running 'CAT12: Segmentation (current release)'
External diary log is writen to "of".
Your version of CAT12 is up to date.

------------------------------------------------------------------------
CAT12.7 r1728: 1/1:      .\franc\.brainstorm\tmp\cat12\CAT12_ICBM152.nii
------------------------------------------------------------------------
SANLM denoising (medium):                                            33s
APP: Rough bias correction:                                       
  Initialize                                                          5s
  Estimate background                                                 4s
  Initial correction                                                  7s
  Refine background                                                   4s
  Final correction                                                    7s
  Final scaling                                                       9s
                                                                     41s
Affine registration                                                   4s
Affine registration                                                   7s
SPM preprocessing 1 (estimate 1):                                 
Final fine affine registration failed.
Use fine affine registration from previous step.
  102s
SPM preprocessing 1 (estimate 2):                                    91s
SPM preprocessing 2 (write):                                      
  Write Segmentation                                                 20s
  Update Segmentation                                                28s
  Update Skull-Stripping                                             31s
  Update probability maps                                             6s
                                                                     84s
Global intensity correction:                                         13s
SANLM denoising after intensity normalization (medium):              11s
Fast registration                                                    37s
Local adaptive segmentation (LASstr=0.50):                        
  Prepare maps                                                        5s
  Prepare partitions                                                  1s
  Prepare segments (LASmod = 1.00)                                   13s
  Estimate local tissue thresholds (WM)                              15s
  Estimate local tissue thresholds (GM)                              22s
  Estimate local tissue thresholds (CSF/BG)                           3s
  Intensity transformation                                           62s
  SANLM denoising after LAS (medium)                                 21s
                                                                     21s
ROI segmentation (partitioning):                                  
  Atlas -> subject space                                              9s
  Major structures                                                    6s
  Ventricle detection                                                15s
  Blood vessel detection                                             10s
  WMH detection (WMHCstr=0.50 > WMHCstr'=0.01)                       31s
  Manual stroke lesion detection                                      0s
  Closing of deep structures                                          2s
  Side alignment                                                      5s
  Final corrections                                                   2s
                                                                     81s
Blood vessel correction (BVCstr=0.50):                                1s
Amap using initial SPM12 segmentations (MRF filter strength 0.07):   40s
    AMAP peaks: [CSF,GM,WM] = [0.40±0.07,0.69±0.09,0.97±0.04]
Final cleanup (gcutstr=0.25):                                     
  Level 1 cleanup (ROI estimation)                                    4s
  Level 1 cleanup (brain masking)                                     1s
  Level 2 cleanup (CSF correction)                                    1s
  Level 3 cleanup (CSF/WM PVE)                                        1s
                                                                      8s
Optimized Shooting registration with 2.50:-0.25:1.50 mm (regstr=0.50):
  Template: "C:\Work\Dev\Divers\spm12\toolbox\cat12\templates_volumes\Template_0_IXI555_MNI152_GS.nii"
    1 | 2.50 | 0.0546  0.0000  0.0546
    2 | 2.50 | 0.0547  0.0002  0.0548
    3 | 2.50 | 0.0546  0.0002  0.0549
   16 | 2.25 | 0.0462  0.0002  0.0464
   17 | 2.25 | 0.0455  0.0007  0.0462
   30 | 2.00 | 0.0439  0.0009  0.0448
   31 | 2.00 | 0.0420  0.0013  0.0432
   44 | 1.75 | 0.0404  0.0015  0.0419
   45 | 1.75 | 0.0390  0.0018  0.0409
   58 | 1.50 | 0.0367  0.0020  0.0387
   59 | 1.50 | 0.0352  0.0024  0.0376
Shooting registration with 2.50:-0.25:1.50 mm takes:                117s
  Prepare output                                                     18s
                                                                    135s
  Jacobian determinant (RMS): 0.005 0.026 0.043 0.056 0.067 |  0.069682 
           Template Matching: 0.164 0.137 0.126 0.117 0.106 |  0.105606 
Write result maps:                                                   14s
Surface and thickness estimation:                                 
lh:
  Thickness estimation (0.50 mm³):                                
    WM distance:                                                     47s
    CSF distance:                                                    22s
    PBT2x thickness:                                                 14s
                                                                     96s
  Create initial surface                                             49s
  Topology correction and surface refinement:                       108s
  Correction of central surface in highly folded areas               19s
  Refine central surface                                            129s
  Correction of central surface in highly folded areas 2             15s
  Spherical mapping with areal smoothing                            148s
  Spherical registration                                            338s
    Euler number / defect number / defect size: -50 / 25 / 1.29% 

rh:
  Thickness estimation (0.50 mm³):                                
    WM distance:                                                     51s
    CSF distance:                                                    22s
    PBT2x thickness:                                                 14s
                                                                    100s
  Create initial surface                                             50s
  Topology correction and surface refinement:                       113s
  Correction of central surface in highly folded areas               12s
  Refine central surface                                            126s
  Correction of central surface in highly folded areas 2             15s
  Spherical mapping with areal smoothing                            148s
  Spherical registration                                            333s
    Euler number / defect number / defect size: -62 / 28 / 1.59% 

cb:
  Thickness estimation (0.50 mm³):                                
    WM distance:                                                     11s
    CSF distance:                                                     7s
    PBT2x thickness:                                                  5s
                                                                     26s
  Create initial surface                                             13s
  Topology correction and surface refinement:                        41s
  Correction of central surface in highly folded areas               46s
  Refine central surface                                            338s
  Correction of central surface in highly folded areas 2             27s
  Spherical mapping with areal smoothing                            284s
  Spherical registration                                            425s
    Euler number / defect number / defect size: -426 / 52 / 8.84% 

Final cerebral surface processing results: 
  Average thickness:                     3.3823 ± 1.0296 mm
  Surface intensity / position RMSE:     0.0670 / 0.0926
  Euler number / defect number / defect size: 183.3 / 35.0 / 3.90% 
  Display thickness: C:\Users\franc\.brainstorm\tmp\cat12\surf\lh.thickness.CAT12_ICBM152
  Display thickness: C:\Users\franc\.brainstorm\tmp\cat12\surf\rh.thickness.CAT12_ICBM152
  Display thickness: C:\Users\franc\.brainstorm\tmp\cat12\surf\cb.thickness.CAT12_ICBM152
  Surface ROI estimation:                                         Surface and thickness estimation takes:                            3119s
ROI estimation in native space:                                   
    0s
Quality check:                                                        6s
Developer display mode!
Print 'Graphics' figure to: 
  C:\Users\franc\.brainstorm\tmp\cat12\report\catreport_CAT12_ICBM152.pdf

------------------------------------------------------------------------
CAT preprocessing takes 66 minute(s) and 12 second(s).
Image Quality Rating (IQR):  86.18% (B)
Segmentations are saved in C:\Users\franc\.brainstorm\tmp\cat12\mri
Reports are saved in C:\Users\franc\.brainstorm\tmp\cat12\report
Labels are saved in C:\Users\franc\.brainstorm\tmp\cat12\label
------------------------------------------------------------------------

  Remove "C:\Users\franc\.brainstorm\tmp\cat12\label\catROI_CAT12_ICBM152.xml" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list 
and following batches will may not work correctly!

  Remove "C:\Users\franc\.brainstorm\tmp\cat12\report\catlog_CAT12_ICBM152.txt" from dependency list because it does not exist!
One or multiple files do not exist and were removed from the dependency list 
and following batches will may not work correctly!

10-Nov-2020 20:52:02 - Done    'CAT12: Segmentation (current release)'
10-Nov-2020 20:52:02 - Running 'Extract additional surface parameters'

     1/1) Extract parameters for C:\Users\franc\.brainstorm\tmp\cat12\surf\lh.central.CAT12_ICBM152.gii
             3s - Display C:\Users\franc\.brainstorm\tmp\cat12\surf\lh.gyrification.CAT12_ICBM152
            22s - Display C:\Users\franc\.brainstorm\tmp\cat12\surf\lh.depth.CAT12_ICBM152
             3s - Display C:\Users\franc\.brainstorm\tmp\cat12\surf\rh.gyrification.CAT12_ICBM152
            23s - Display C:\Users\franc\.brainstorm\tmp\cat12\surf\rh.depth.CAT12_ICBM152
10-Nov-2020 20:52:53 - Done    'Extract additional surface parameters'
10-Nov-2020 20:52:53 - Done

If you look in the folder $HOME/.brainstorm/tmp/cat12 after the process is done, you will find the output of CAT. Make a copy of this folder if you think you might need to re-import the subject later.
This includes the quality control reports, in the report subfolder:
catreportj_CAT12_small

In Brainstorm, the surfaces, atlases and surface measures are imported correctly:
image image image image image

image image

PS: There are some bugs that are currently discussed with @CGaser and documented on GitHub:
Bugs CAT12 v1728

Thank you for your response. How would the script change if I wanted to use my own MRI (nifti file) instead of the ICBM152 template? Do I need to run it through FreeSurfer in order to get a T1.mgz file before running CAT12?

In Brainstorm:

  1. Create a new subject (Default anatomy: NO, Default channel file: NO)
  2. Right-click on the subject > Import MRI (from any file format, no need to run FreeSurfer before, any .nii or event DICOM would work)
  3. Right-click on the MRI > CAT12 MRI segmentation

You can reproduce the same thing using Brainstorm scripts generated from the Pipeline Editor (with the Process1 box empty):

  1. Import > Import anatomy > Import MRI
  2. Import > Import anatomy > Segment MRI with CAT12

https://neuroimage.usc.edu/brainstorm/Tutorials/PipelineEditor#Saving_a_pipeline
https://neuroimage.usc.edu/brainstorm/Tutorials/Scripting