Standalone Version of CAT12
Use of the standalone version of CAT12
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 CAT12
- Download the CAT12 standalone version for MacOS (Intel) or Linux (copy the link to your browser if the download does not start automatically or load the latest file for your system with the name cat12_latest_R2017b_MCR* for Linux or cat12_latest_R2023b_MCR* for MacOS here). Please contact me if you need versions for Windows.
- Open the MCR_v93.webloc (for Linux) or the MCR_v232.webloc (for MacOS) link in the installed folder, which automatically downloads the Matlab Runtime for R2017b or R2023b.
- Install the Matlab Runtime with the "v93" or "v232" folder preferably in the same folder.
Use of the standalone version of CAT12
If you prefer to use the standalone version of CAT12 via the GUI, you can call the GUI version with the following command:
/software/CAT12.9_MCR/run_spm12.sh /software/CAT12.9_MCR/v93
In order to use the GUI version, please see the instructions for the standard version.
For the following examples, we assume that the CAT12 standalone version was installed in "/software/CAT12.9_MCR" and the Matlab Runtime in "/software/CAT12.9_MCR/v93" 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/CAT12.9_MCR/standalone/cat_standalone.sh -m /software/CAT12.9_MCR/v93 \
-b /software/CAT12.9_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/CAT12.9_MCR/standalone/cat_standalone.sh -m /software/CAT12.9_MCR/v93 \
-b /software/CAT12.9_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 CAT12 preprocessing batch. The preprocessed data is stored in a folder named after the CAT12 version (e.g. CAT12.9) 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_".
Preprocessing without surface estimation
/software/CAT12.9_MCR/standalone/cat_standalone.sh -m /software/CAT12.9_MCR/v93 \
-b /software/CAT12.9_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/CAT12.9_MCR/standalone/cat_standalone.sh -m /software/CAT12.9_MCR/v93 \
-b /software/CAT12.9_MCR/standalone/cat_standalone_smooth.m \
/data/enigma-data/raw/CAT12.9/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/CAT12.9_MCR/standalone/cat_standalone.sh -m /software/CAT12.9_MCR/v93 \
-b /software/CAT12.9_MCR/standalone/cat_standalone_resample.m \
/data/enigma-data/raw/CAT12.9/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 a the filter size should be set to "0".
Estimate and Save Quality Measures for Volume Data
/software/CAT12.9_MCR/standalone/cat_standalone.sh -m /software/CAT12.9_MCR/v93 \
-b /software/CAT12.9_MCR/standalone/cat_standalone_get_quality.m \
/data/enigma-data/raw/CAT12.9/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/CAT12.9_MCR/standalone/cat_standalone.sh -m /software/CAT12.9_MCR/v93 \
-b /software/CAT12.9_MCR/standalone/cat_standalone_get_quality.m \
/data/enigma-data/raw/CAT12.9/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_mesures_surfaces.csv for external analysis.
Please note the multiple quotes for parameter a1.
Estimate and Save Weighted Overall Image Quality
/software/CAT12.9_MCR/standalone/cat_standalone.sh -m /software/CAT12.9_MCR/v93 \
-b /software/CAT12.9_MCR/standalone/cat_standalone_get_IQR.m \
/data/enigma-data/raw/CAT12.9/report/cat_*.xml \
-a1 "'IQR.txt'"
Estimate weighted overall image quality (before preprocessing) using xml-files in report folder and save quality measures in IQR.txt for external analysis.
Please note the multiple quotes for parameter a1.
Estimate Total Intra-cranial Volume (TIV)
/software/CAT12.9_MCR/standalone/cat_standalone.sh -m /software/CAT12.9_MCR/v93 \
-b /software/CAT12.9_MCR/standalone/cat_standalone_get_TIV.m \
/data/enigma-data/raw/CAT12.9/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 parameter a3 is available only from version r1987 and you must add the parameter a2 in addition.
Estimate mean volumes and mean surface values inside ROI
This step is optional (as an alternative to the ENIGMA Freesurfer protocol).
/software/CAT12.9_MCR/standalone/cat_standalone.sh -m /software/CAT12.9_MCR/v93 \
-b /software/CAT12.9_MCR/standalone/cat_standalone_get_ROI_values.m \
/data/enigma-data/raw/CAT12.9/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 CAT12, 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_parallize.sh:
/software/CAT12.9_MCR/standalone/cat_parallelize.sh -p 8 -l /tmp \
-c "-m /software/CAT12.9_MCR/v93 \
-b /software/CAT12.9_MCR/standalone/cat_standalone_segment_enigma.m" \
/data/enigma-data/raw/sub*.nii
Parallelize CAT12 ENIGMA preprocessing by splitting all sub*.nii files into 8 jobs (processes) and save log file in /tmp folder.