[Update 2024/05/29] Training / Inference code will be available soon.
Official PyTorch Implementation for the Learning Cortical Anomaly through Masked Encoding for Unsupervised Heterogeneity Mapping.
A new Self-Supervised framework designed for Unsupervised Anomaly Detection of brain disorders using 3D cortical surface features.
- Clone the repo:
git clone [email protected]:chadHGY/CAM.git
cd CAM
- Install the required packages:
conda create -n cam python=3.10
conda activate cam
pip install -r requirements.txt
To easily demonstrate the usage of CAM, we provide a toy dataset in the data
directory. The toy dataset contains 10 subjects from IXI dataset. For each subject we will extract 4 cortical surface features using FreeSurfer (Curvature, Sulci, Thickness, Volume).
-
Data Preprocessing: Please make sure you have gone through FreeSurfer's
recon-all pipeline
to extract the cortical surface features. The surface features should be found under each subject'ssurf
directory. You can find the already processed toy data in thedata/freesurfer
directory. -
Data Postprocessing: Here we provide a simple script to convert the surface features to a numpy array.
# training set
python src/data_postprocessing.py --freesurfer_dir data/freesurfer/ --subject_list data/train_subjects.txt --output_dir data/sphere/train/ --in_ch thickness volume curv sulc --annot_file aparc --hemi lh
# validation set
python src/data_postprocessing.py --freesurfer_dir data/freesurfer/ --subject_list data/val_subjects.txt --output_dir data/sphere/val/ --in_ch thickness volume curv sulc --annot_file aparc --hemi lh
# testing set
python src/data_postprocessing.py --freesurfer_dir data/freesurfer/ --subject_list data/test_subjects.txt --output_dir data/sphere/test/ --in_ch thickness volume curv sulc --annot_file aparc --hemi lh
python src/train.py --data_dir /path/to/your/postprocessed/data --output_dir /path/to/your/output
python src/inference.py --data_dir /path/to/your/postprocessed/data --output_dir /path/to/your/output
If you find this repository useful for your research, please use the following.
@article{yang2023learning,
title={Learning Cortical Anomaly through Masked Encoding for Unsupervised Heterogeneity Mapping},
author={Yang, Hao-Chun and Andreassen, Ole and Westlye, Lars Tjelta and Marquand, Andre F and Beckmann, Christian F and Wolfers, Thomas},
journal={arXiv preprint arXiv:2312.02762},
year={2023}
}
- IXI data: https://brain-development.org/ixi-dataset/
- Sphere postprocessing code borrowed from:
- We would like to thank all participants in this study, making the work possible. This work was supported the German Research Foundation (DFG) Emmy Noether with reference 513851350 (TW), the Cluster of Excellence with reference 390727645 (TW) and the BMBF-funded de.NBI Cloud within the German Network for Bioinformatics Infrastructure (de.NBI) (031A532B, 031A533A, 031A533B, 031A534A, 031A535A, 031A537A, 031A537B, 031A537C, 031A537D, 031A538A).