Correlation-edge sampling of CAT12 gray matter maps for AD/MCI classification using structural MRI.
This repository contains the analysis code for a structural MRI study comparing correlation-edge sampling with conventional edge extraction, whole-gray-matter PCA, and direct high-correlation voxel selection for AD/MCI classification.
The proposed method constructs a voxel-wise Pearson association map between CAT12 modulated normalized gray matter maps and AD/MCI labels using the training set only. A 3D Sobel operator is then applied to the absolute association map, and the top-k gradient voxels are used as the correlation-edge mask.
The repository includes:
run_experiment.py: main experiments for direct edge, mean edge, and correlation-edge feature routes.run_experiment_2_1.py: supplementary experiments for whole-GM PCA/CNN and correlation top-k without edge.explainable_v2.py: mask aggregation and explainability analysis comparing correlation-edge with correlation top-k without edge.config.py: configuration for the main experiments.config_2_1.py: configuration for the supplementary experiments.
The code expects the following local project structure:
project_root/
vbm_data.xlsx
GM/
<subject>.nii
<subject>.nii
...
The metadata file must contain:
subject
label
where subject matches the NIfTI file name without extension and label is encoded as:
1 = AD
0 = MCI
The input images are CAT12 mwp1 modulated normalized gray matter maps.
The ADNI data are not included in this repository. Access to ADNI data requires application and approval through the ADNI data portal.
A CUDA-enabled PyTorch environment is recommended for the 3D CNN experiments. The experiments in the manuscript were run on a server with three NVIDIA RTX 5090 GPUs and a 72-core CPU.
Install Python dependencies with:
pip install -r requirements.txtPyTorch installation depends on the local CUDA version. If the default pip install torch is not suitable for your system, install PyTorch following the official instructions:
https://pytorch.org/get-started/locally/
The scripts use fixed configuration files and do not require command-line arguments.
python run_experiment.pyOutputs are written to:
edge_results/<time_tag>/
performance.xlsx
train_val_test.json
This script evaluates:
- direct edge
- mean edge
- correlation-edge
with:
- PCA + Linear SVM
- PCA + Logistic Regression
- small 3D CNN
python run_experiment_2_1.pyOutputs are written to:
edge_results_2_1/<time_tag>/
performance.xlsx
train_val_test.json
This script evaluates:
- whole-GM PCA/CNN
- correlation top-k without edge
python explainable_v2.pyOutputs are written to:
explainable_results/
explainability_stats.txt
corr_edge_seed2024_topk30000.nii.gz
corr_topk_no_edge_seed2024_topk30000.nii.gz
mask_3d_seed2024_topk30000.png
...
The explainability script compares correlation-edge with correlation top-k without edge using:
- 26-neighbor local density
- connected-component concentration
- Dice/Jaccard overlap
- non-edge high-correlation ratio
- 3D mask visualization
The main experiment includes:
direct edge
mean edge
correlation-edge
The supplementary experiment includes:
whole GM
correlation top-k without edge
All masks and preprocessing operations that can leak label information are constructed from the training set only.
The main output of each experiment is a single Excel workbook containing all model metrics and selected validation-based results. The scripts also save the train/validation/test split JSON for reproducibility.
- The code assumes all CAT12 gray matter images share the same shape and affine.
- The scripts use repeated random seeds rather than k-fold cross-validation.
- Hyperparameter candidates are defined as fixed tuples in the configuration files.
- The code is intended for research reproducibility and requires local access to ADNI-derived CAT12 gray matter maps.
If you use this repository, please cite the associated manuscript once available.