Standalone Version of CAT26
Use of the standalone version of CAT26
The advantage of the standalone version is that no Matlab license is required. Only the (free) Matlab Runtime has to be downloaded. However, there are some limitations (e.g. no parallelization and no interactive help in the GUI version) and the standalone version is mainly intended to run without GUI on Unix systems.
Installation of the standalone version of CAT26
- Download the CAT26.0 standalone version for MacOS (ARM64, Silicon), MacOS (Intel), Linux or Windows.
- Unzip the file. This creates the folder "cat_standalone", which you can rename and move to your preferred location (e.g. "/software/CAT26.0_MCR").
- Download the Matlab Runtime R2023b for MacOS (ARM64, Silicon), MacOS (Intel), Linux or Windows and install it preferably in the same folder. The installer creates the subfolder "R2023b". On Linux, you can also install it without GUI:
unzip MATLAB_Runtime_R2023b_Update_10_glnxa64.zip -d mcr_installer
sudo mcr_installer/install -agreeToLicense yes -destinationFolder /software/CAT26.0_MCR
Use of the standalone version of CAT26
If you prefer to use the standalone version of CAT via the GUI, you can call the GUI version with the following command:
/software/CAT26.0_MCR/run_spm.sh /software/CAT26.0_MCR/R2023b
Please note that the start script is now always named "run_spm.sh" (instead of "run_spm25.sh" in CAT12.9). On Windows, start the GUI version with "spm.exe". The shell scripts in the following examples require Linux or MacOS.
In order to use the GUI version, please see the instructions for the standard version.
For the following examples, we assume that the CAT standalone version was installed in "/software/CAT26.0_MCR" and the Matlab Runtime in "/software/CAT26.0_MCR/R2023b" and your T1-data are located in "/data/enigma-data/raw" and are named "sub*.nii.gz".
See the help text of standalone/cat_standalone.sh for more examples and a description of additional options.
DICOM Import
/software/CAT26.0_MCR/standalone/cat_standalone.sh -m /software/CAT26.0_MCR/R2023b \
-b /software/CAT26.0_MCR/standalone/cat_standalone_dicom2nii.m /data/enigma-data/dicom/*.dcm \
-a1 "'patid_date'" -a2 "{'raw'}"
Import DICOM files *.dcm and save converted nifti files in directory "raw" with structure
<PatientID>/<StudyDate-StudyTime>/<ProtocollName>
Other options for directory structure are:
| flat |
No directory hierarchy |
| series |
<ProtocollName> |
| patid_date |
<PatientID>/<StudyDate-StudyTime>/<ProtocollName> |
| patid |
<PatientID>/<ProtocollName> |
| date_time |
<StudyDate-StudyTime>/<ProtocollName> |
Please note the multiple quotes for parameter a1.
Preprocessing
/software/CAT26.0_MCR/standalone/cat_standalone.sh -m /software/CAT26.0_MCR/R2023b \
-b /software/CAT26.0_MCR/standalone/cat_standalone_segment_enigma.m \
/data/enigma-data/raw/sub*.nii.gz
Unzip and preprocess (segment) the files sub*.nii.gz using the ENIGMA CAT preprocessing batch. The preprocessed data is stored in a folder named after the CAT version (i.e. CAT26.0) and in separate subfolders (mri, surf, label and report) located in this folder. Data that contain non-brain areas (e.g. bias-corrected images in native space) are de-faced after preprocessing and saved with the prefix "anon_".
If your data are organized in BIDS format, the folder CAT26.0 is created in the BIDS root folder and the results are saved in CAT26.0/sub-*/[ses-*/]anat. In this case, please adapt the paths in the following examples.
Preprocessing without surface estimation
/software/CAT26.0_MCR/standalone/cat_standalone.sh -m /software/CAT26.0_MCR/R2023b \
-b /software/CAT26.0_MCR/standalone/cat_standalone_segment_enigma.m \
-a "matlabbatch{1}.spm.tools.cat.estwrite.output.surface = 0;" /data/enigma-data/raw/sub*.nii.gz
Same as above, but skip surface extraction.
Smoothing of Volume Data
This step is optional if you intend to statistically analyze your VBM data.
/software/CAT26.0_MCR/standalone/cat_standalone.sh -m /software/CAT26.0_MCR/R2023b \
-b /software/CAT26.0_MCR/standalone/cat_standalone_smooth.m \
/data/enigma-data/raw/CAT26.0/mri/mwp1sub*.nii -a1 "[6 6 6]" -a2 "'s6'"
Smooth the modulated and warped segmentations for gray matter with 6mm and prepend the string "s6" to the smoothed files. Optionally also smooth the white matter segmentations (i.e. mwp2*) and the warped segmentations without modulation (i.e. wp1* and wp2*) and also consider different smoothing sizes.
The recommended smoothing size for analyzing the volume data is 6mm. In order to use the data for machine learning with
NeuroMiner no smoothing is necessary.
Please note the multiple quotes for parameter a2.
Resample and Smooth Surface Data
/software/CAT26.0_MCR/standalone/cat_standalone.sh -m /software/CAT26.0_MCR/R2023b \
-b /software/CAT26.0_MCR/standalone/cat_standalone_resample.m \
/data/enigma-data/raw/CAT26.0/surf/lh.thickness.sub* -a1 "12" -a2 "1"
Resample and smooth the thickness files lh.thickness.sub* with 12mm and save the resampled meshes as 32k mesh (HCP conform meshes). Only the left surface file has to be defined. The right hemisphere is processed automatically.
The recommended smoothing size for analyzing the surface data is 12mm. In order to use the data for machine learning with
NeuroMiner no smoothing is necessary and the filter size should be set to "0".
Estimate and Save Quality Measures for Volume Data
/software/CAT26.0_MCR/standalone/cat_standalone.sh -m /software/CAT26.0_MCR/R2023b \
-b /software/CAT26.0_MCR/standalone/cat_standalone_get_quality.m \
/data/enigma-data/raw/CAT26.0/mri/mwp1sub*.nii -a1 "'Quality_measures_volumes.csv'" -a2 "1"
Estimate sample homogeneity (after preprocessing) using mean z-scores with global scaling with TIV for the modulated and warped segmentations for gray matter and save quality measures in the file Quality_measures_volumes.csv for external analysis.
Please note the multiple quotes for parameter a1.
Estimate and Save Quality Measures for Surface Data
/software/CAT26.0_MCR/standalone/cat_standalone.sh -m /software/CAT26.0_MCR/R2023b \
-b /software/CAT26.0_MCR/standalone/cat_standalone_get_quality.m \
/data/enigma-data/raw/CAT26.0/surf/s12.mesh.thickness.resampled_32k.sub* \
-a1 "'Quality_measures_surfaces.csv'"
Estimate sample homogeneity (after preprocessing) using mean z-scores for resampled and smoothed thickness values and save quality measures in Quality_measures_surfaces.csv for external analysis.
Please note the multiple quotes for parameter a1.
Estimate and Save Weighted Overall Image Quality
/software/CAT26.0_MCR/standalone/cat_standalone.sh -m /software/CAT26.0_MCR/R2023b \
-b /software/CAT26.0_MCR/standalone/cat_standalone_get_IQR.m \
/data/enigma-data/raw/CAT26.0/report/cat_*.xml \
-a1 "'SIQR.txt'"
Estimate weighted overall image quality (before preprocessing) using xml-files in report folder and save the structural image quality ratings (SIQR) in SIQR.txt for external analysis. Please note that SIQR replaces the former IQR of CAT12.9 and both measures are not directly comparable.
Please note the multiple quotes for parameter a1.
Estimate Total Intra-cranial Volume (TIV)
/software/CAT26.0_MCR/standalone/cat_standalone.sh -m /software/CAT26.0_MCR/R2023b \
-b /software/CAT26.0_MCR/standalone/cat_standalone_get_TIV.m \
/data/enigma-data/raw/CAT26.0/report/cat_*.xml -a1 "'TIV.txt'" -a2 "1" -a3 "0"
Save TIV values for all selected data in TIV.txt. Please note the multiple quotes to define the output name with a1.
The parameter a2 allows you to save only the TIV (1) or additionally to save also the global volumes for GM, WM, CSF, and WM hyperintensities (0). With parameter a3 you can add file names to the 1st column: 0 - save values only; 1 - add file name; 2 - add folder and file names.
Please note that you must also define parameter a2 if you use parameter a3.
Estimate mean volumes and mean surface values inside ROI
This step is optional (as an alternative to the ENIGMA Freesurfer protocol).
/software/CAT26.0_MCR/standalone/cat_standalone.sh -m /software/CAT26.0_MCR/R2023b \
-b /software/CAT26.0_MCR/standalone/cat_standalone_get_ROI_values.m \
/data/enigma-data/raw/CAT26.0/label/catROI*.xml -a1 "'ROI'"
Save mean surface values (e.g. cortical thickness) and mean volumes (in ml) for all selected data in a csv-file. The csv-file is named "ROI_" followed by the atlas name and the name of the measure (e.g. thickness or Vgm).
Please note the multiple quotes to define the ROI name.
Parallelization of the standalone version
In contrast to the Matlab standard version of CAT, the standalone version only supports serial preprocessing of multiple files. In order to speed up preprocessing and to distribute your jobs or batches to several processors or cores, you can use the script standalone/cat_parallelize.sh:
/software/CAT26.0_MCR/standalone/cat_parallelize.sh -p 8 -l /tmp \
-c "-m /software/CAT26.0_MCR/R2023b \
-b /software/CAT26.0_MCR/standalone/cat_standalone_segment_enigma.m" \
/data/enigma-data/raw/sub*.nii
Parallelize CAT ENIGMA preprocessing by splitting all sub*.nii files into 8 jobs (processes) and save log file in /tmp folder.