S²M (Single-Subject Morphometry) is an open-source framework for individualized asseS²Ment of brain structural abnormalities using MRI. The software generates subject-specific maps of white and gray matter alterations and focal cortical dysplasia lesions based on normative models derived from healthy controls, enabling the detection and quantification of morphometric abnormalities at the voxel level. S²M supports the evaluation of atrophy, hypertrophy, and focal cortical dysplasia (FCD) recquiring only a high-quality T1-weighted MRI scan (FLAIR image optional). Demographic variables such as age and sex can be incorporated to improve model accuracy but are not required.
The framework features a fully integrated graphical user interface (GUI), providing an accessible workflow without the need for programming expertise. S²M supports both single-subject analyses and automated batch processing of large datasets. Brain tissue metrics are extracted using the CAT toolbox, while all harmonization and statistical mapping procedures are implemented within the S²M framework.
Key Features:
- Gray Matter Analysis: Analysis to identify regions of gray matter atrophies and hypertrophies (normalized and native space maps, slice view pictures and anatomical reports)
- White Matter Analysis: Analysis to identify regions of white matter atrophies and hypertrophies (normalized and native space maps, slice view pictures and anatomical reports)
- Focal Cortical Dysplasia Analysis: Analysis to identify regions suggestive of FCD (normalized and native space maps, slice view pictures and anatomical reports)
- Advanced Site Harmonization: Embedded with S²M_combat to eliminate scanner and sequence biases (e.g., T1w vs. FLAIR) using single-subject projection algebra.
- Biological Confounder Control: Automatic regression for Age, Gender, and Total Intracranial Volume (TIV).
- Fast Non-Parametric Inference: Cluster-based permutation testing with an intelligent caching system for empirical thresholds.
- Outlier & Quality Control: Automated IQR-based outlier detection routines to protect the batch analysis from structural noise during harmonization.
S²M third-party prerequisites:
Before running S²M, ensure you have the following dependencies installed and configured in your MATLAB environment.
- Matlab (The MathWorks Inc.): tested with versions from the 2019b to the 2026a
- Matlab Parallel Computing Toolbox (optional)
- Matlab Parallel Computing Toolbox (optional)
- Statistical Parametric Mapping 25 (SPM)
- Computational Anatomy Toolbox (CAT) Version 3347 (CAT26.0.rc4, from 2026-07-24)
- ComBat Multi-Site Harmonization Tool (Adapted version for S²M included with S²M code)
S²M Installation:
One of the goals during the S²M development was to ensure easy installation, broad hardware and operating system compatibility, and straightforward usability.
To install S²M, download the S²M folder and add it to your MATLAB path. You may also need to download the S²M database or follow the instructions to create your own database using your own reference images.
Getting Started:
The first step is to install S²M, SPM25 and CAT in the MATLAB path.
1 - Download SPM;
2 - Download CAT
For this version of S²M we recommend the CAT Version 3347 (CAT26.0.rc4)
Unzip both downloads and add the uncompressed CAT folder to the SPM toolbox folder (spm > toolbox > cat).
3a - Download S²M Database files (optional, only if you intend to use the provided S²M normative database instead of creating your own, with your own control images).
Unzip the DB folder and add ITS CONTENTS to the folder: SSM_v1.1 > SSM_Enc_DB. Note that each downloaded folder contains some common files, which is fine to replace or ignore if prompted.
3b - Or create your own database using the SSM_CreateDatabase function
4 - Add SPM (with CAT) and S²M to the MATLAB path. For example (replace "/home/user/spm25" with your actual folder path):
In MATLAB Command Window (for example, replace by your real folder path):
>> addpath(genpath('/home/user/spm25'))
>> addpath(genpath('/home/user/SSM-v1.1'))
You can also add each folder separately using the "Set Path" button in MATLAB (Environment tab), selecting "Add with Subfolders".
5a - If you opted to create your own database run:
In MATLAB Command Window:
>> SSM_CreateDatabase
Follow the on-screen instructions to navigate the GUI.
Add the "DB" folder created to the S²M main folder
In MATLAB Command Window:
>> rehash
"rehash" will update the Matlab Path System
5b - To run S²M:
In MATLAB Command Window:
>> s2m or SSM
Follow the on-screen instructions to navigate the GUI. Additional guidance is available through tooltip text for each option.
S²M was developed by Brunno M Campos, Ph.D. (brunno at unicamp dot br)
University of Campinas, Neuroimaging Laboratory
Example images:
Figure 1: S²M graphical user interface (GUI).
Figure 2: Example resut for focal cortical dysplasia (blue maps: drawn ROI; hot-scaled map: S²M FCD result).
Figure 3: Example resut for Grey Matter Atrophy Study on patient with left mesial temporal lobe epilepsy (hot-scaled map: S²M individual atrophy map).
Figure 4: Example of control quality plots.: Top-left, images intercorrelation and outlier detection; Top-Right, Bland-Altman plot for pre-harmonization data; Bottom-left, Bland-Altman plot for post-harmonization data; Bottom-Right, pre and post harmonization batches histograms (mean and individual);
Figure 5: Example of automated generated individual slice view plot;
Figure 6: Example of automated generated individual result anatomical report (Page 1);
Figure 6: Example of automated generated individual result anatomical report (Page 2);
Figure 6: Example of automated generated individual result anatomical report (Page 3);
Figure 6: Example of automated generated individual result anatomical report (Page 4);
