CAT12 Segmentation Failing

Dear Brainstorm Community,

I am returning to Brainstorm after a few months of not using it. Accordingly, I decided to update both Brainstorm and CAT12.

I am trying to use CAT12 within BST to segment participants' anatomical files. However, I am running into this issue.

> SPM> Iteration #1: Log-likelihood 0.770950
> SPM> Iteration #2: Log-likelihood 0.853131
> SPM> Iteration #3: Log-likelihood 0.946073
> SPM> Iteration #4: Log-likelihood 1.024596
> SPM> Iteration #5: Log-likelihood 1.106162
> SPM> Iteration #6: Log-likelihood 1.196995
> SPM> Iteration #7: Log-likelihood 1.246495
> SPM> Iteration #8: Log-likelihood 1.264483
> SPM> Iteration #9: Log-likelihood 1.269033
> SPM> Iteration #10: Log-likelihood 1.269304
> SPM> Iteration #11: Log-likelihood 1.269231
> SPM> Iteration #12: Log-likelihood 1.269315
> SPM> Iteration #13: Log-likelihood 1.269263
> SPM> Iteration #14: Log-likelihood 1.269318
> SPM> Iteration #1: Log-likelihood 1.277045
> SPM> Iteration #2: Log-likelihood 1.277694
> SPM> Iteration #3: Log-likelihood 1.277826
> SPM> Iteration #4: Log-likelihood 1.277816
> SPM> Iteration #5: Log-likelihood 1.277829
> BST> Emptying temporary directory...
> Item 'Relative BIDS folder', field 'val': Item must be a string.
> Item 'Relative BIDS folder', field 'val': Item must be a string.
> 
> SPM12: spm_cat12 (vCAT12.8-Beta)                   18:44:48 - 04/08/2021
> ========================================================================
> 
>    _______  ___  _______    
>   |  ____/ / _ \ \_   _/   Expert Mode
>   | |___  / /_\ \  | |     Computational Anatomy Toolbox
>   |____/ /_/   \_\ |_|     CAT12.8-Beta - http://www.neuro.uni-jena.de
> 
>  CAT default file:
> 	/Users/prabhjotdhami/Documents/MATLAB/Add-Ons/spm12/toolbox/cat12/cat_defaults.m
> 
> Item 'Relative BIDS folder', field 'val': Item must be a string.
> Item 'Relative BIDS folder', field 'val': Item must be a string.
> Item atlases: No field(s) named
> neuromorphometrics
> lpba40
> cobra
> aal3
> anatomy3
> ibsr
> julichbrain
> hammers
> mori
> thalamus
> Schaefer2018_100Parcels_17Networks_order
> Schaefer2018_200Parcels_17Networks_order
> Schaefer2018_400Parcels_17Networks_order
> Schaefer2018_600Parcels_17Networks_order
> Item atlas: No field(s) named
> warped
> dartel
> 
> 
> ------------------------------------------------------------------------
> 04-Aug-2021 18:44:53 - Running job #1
> ------------------------------------------------------------------------
> 04-Aug-2021 18:44:53 - Running 'CAT12: Segmentation'
> 04-Aug-2021 18:44:55 - Failed  'CAT12: Segmentation'
> Error using cat_vol_findfiles (line 288)
> Startfolder (/Users/prabhjotdhami/Documents/MATLAB/Add-Ons/spm12/toolbox/cat12/templates_volumes/) not found or no folder.
> In file "/Users/prabhjotdhami/Documents/MATLAB/Add-Ons/spm12/toolbox/cat12/cat_vol_findfiles.m" (v1791), function "cat_vol_findfiles" at line 288.
> In file "/Users/prabhjotdhami/Documents/MATLAB/Add-Ons/spm12/toolbox/cat12/cat_run.m" (v1860), function "update_job" at line 920.
> In file "/Users/prabhjotdhami/Documents/MATLAB/Add-Ons/spm12/toolbox/cat12/cat_run.m" (v1860), function "cat_run" at line 625.
> 
> The following modules did not run:
> Failed: CAT12: Segmentation
> 
> Your version of CAT12 is up-to-date.

Any help would be greatly appreciated.

Best,
Paul

I suspect there is something wrong with your installation of SPM/CAT. It looks like some of the installation folders are missing.
Make sure your SPM installation is also up-do-date.

If you are expecting to use CAT mainly from Brainstorm, it would be a safer to let Brainstorm install it:

  • Edit your MATLAB path: Remove all the references to SPM and CAT
  • Restart Matlab, make sure that typing "spm" or "cat12" in the Matlab command window return an error
  • Start Brainstorm, install SPM12 and CAT12 as plugins: https://neuroimage.usc.edu/brainstorm/Tutorials/Plugins

@CGaser Any other suggestion?

When I start CAT12 with the latest version of SPM12/CAT12/Brainstorm, I get something like this (including the CAT12 install):

BST> Starting Brainstorm:
BST> =================================
BST> Version: 17-Jul-2021
BST> Compiling main interface files...
BST> Emptying temporary directory...
BST> Deleting old process reports...
BST> Loading configuration file...
BST> Checking internet connectivity... ok
BST> Initializing user interface...
BST> Starting OpenGL engine... hardware
BST> Reading process folder...
BST> Loading current protocol...
BST> =================================
 
BST> Checking latest online version for cat12...
BST> Processing dependencies: cat12 requires: spm12 
BST> Downloading URL : http://www.neuro.uni-jena.de/cat12/cat12_latest.zip
BST> Saving to file  : C:\Users\franc\.brainstorm\plugins\cat12\plugin.zip
BST> Adding plugin spm12 to path: C:\Users\franc\.brainstorm\plugins\spm12\spm12
BST> Executing callback LoadedFcn: spm('defaults','EEG');
BST> Adding plugin cat12 to path: C:\Users\franc\.brainstorm\plugins\cat12\cat12
BST> Executing callback InstalledFcn: LinkCatSpm(1);
BST> Deleting existing SPM12 toolbox: rmdir /q /s "C:\Users\franc\.brainstorm\plugins\spm12\spm12\toolbox\cat12"
BST> Creating symbolic link: mklink /D "C:\Users\franc\.brainstorm\plugins\spm12\spm12\toolbox\cat12" "C:\Users\franc\.brainstorm\plugins\cat12\cat12"
SPM12 template found: C:\Users\franc\.brainstorm\defaults\spm\TPM.nii
BST> Processing dependencies: cat12 requires: spm12 
BST> Plugin cat12 already loaded: C:\Users\franc\.brainstorm\plugins\cat12
BST> Emptying temporary directory...

SPM12: spm_cat12 (vCAT12.8-Beta)                   11:04:58 - 07/08/2021
========================================================================

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

 CAT default file:
	C:\Users\franc\.brainstorm\plugins\spm12\spm12\toolbox\cat12\cat_defaults.m

Item atlas: No field(s) named
warped
dartel
Your version of CAT12 is up-to-date.


------------------------------------------------------------------------
07-Aug-2021 11:05:12 - Running job #1
------------------------------------------------------------------------
07-Aug-2021 11:05:12 - Running 'CAT12: Segmentation'

------------------------------------------------------------------------
CAT12.8-Beta r1860: 1/1:  .\.brainstorm\tmp\cat12\Subject01_cat12_1860.n
------------------------------------------------------------------------
SANLM denoising (medium):                                            46s
APP: Rough bias correction:                                       
  Initialize                                                         10s
  Estimate background                                                 6s
  Initial correction                                                  9s
  Refine background                                                   6s
  Final correction                                                    7s
  Final scaling                                                       9s
                                                                     56s
Correct center-of-mass                                                4s
Affine registration                                                  13s
SPM preprocessing 1 (estimate 1 - TPM registration):                 84s
...

Thank you Francois, your suggestion of installing CAT12 through Brainstorm plugin and updating SPM12 seems to have solved the issue.