Official implementation of Unified Lifespan Brain Region Parcellation from Structural MR Images (BrainParc)
"BrainParc: Unified Lifespan Brain Parcellation with Anatomy-guided Progressive Transmission", ISMRM, 2025, [Jiameng Liu, Feihong Liu, Kaicong Sun, Caiwen Jiang, Yulin Wang, Tianyang Sun, Feng Shi and Dinggang Shen]
"BrainParc: Unified Lifespan Brain Parcellation from Structural MR Images", Nature Computational Science, 2026, [Jiameng Liu, Feihong Liu, Kaicong Sun, Zhiming Cui, Tianyang Sun, Zehong Cao, Jiawei Huang, Shuwei Bai, Yulin Wang, Yulong Dou, Kaicheng Zhang, Caiwen Jiang, Yuyan Ge, Han Zhang, Feng Shi and Dinggang Shen]
The entire BrainParc framework includes two parts:
-
Brain extraction:Prerequisit for following brain tissue segmentation and region parcellation. We designed and trained an Automatic skull-strip (AutoStrip) method for lifespan T1w MRI data.- You can find the detailed implementation and pretrained model of AutoStrip can in this Repo. This repo mainly introduce the implementation details of the tissue segmentation and region parcellation part of BrainParc.
-
Tissue segmentation and region parcellation: Unified Lifespan Brain Region Parcellation (BrainParc) framework which leverage the anatomical information invariant to intensity and contrast, enabling accurate, robust, and longitudinally consistent parcellation across heterogeneous dataset without the need for fine-tuning.
- 2026.03: Paper accepted to Nature Computational Science, 2026.
- 2026.02: Code and pretrained model released.
- 2025.05: Abstract accepted to ISMRM, 2025.
- [] Update multi-model version
- Release training code
- Release pretrained model
- Release inference script
Step 1: Data Preparation Organize your project directory as follows to reproduce BrainParc on your own data
Experiments/ βββ csvfile/ # Training, validation, & testing splits β βββ file_list.csv # Each line: [IDs, folder, fold] βββ data/ # Data folder β βββ HCPA/ β β βββ sub001/ β β βββ brain.nii.gz # skull-stripped T1w data β β βββ tissue.nii.gz # ground-truth tissue maps β β βββ dk-struct.nii.gz # ground-truth dk struture maps β βββ HCPD/ β βββ HCPY/ βββ Results/ βββ BrainParc/ βββ checkpoints/ # Saved every 10 epochs βββ log/ β βββ log βββ pred/ # Validation results per epoch
Note: The relative training, testing, and validation split should be recorded in file_list.csv. The example for file_list.csv is shown below:
| IDs | folder | fold |
|---|---|---|
| sub001 | HCPY | 1 |
| sub002 | HCPY | 2 |
| sub003 | HCPY | 3 |
| sub001 | HCPD | 1 |
| sub002 | HCPD | 2 |
| sub003 | HCPD | 3 |
| sub004 | HCPD | 3 |
| sub001 | HCPA | 3 |
You are required performing the following steps for training BrainParc using your own data:
-
Brain Extraction:Please first remove brain skull using our AutoStrip. -
Edge Extraction:Extracte the brain edge maps using sobel filter, you can refer to this script for extract brain sobel edge maps.python ./Code/Inference/Step01_Intensity_2_Edge.py --input /path/to/input/brain.nii.gz --output /path/to/save/extracted/edge/maps
After the data preprocess, your data directory should be:
Experiments/ βββ csvfile/ # Training, validation, & testing splits β βββ file_list.csv # Each line: [IDs, folder, fold] βββ data/ # Data folder β βββ HCPA/ β β βββ sub001/ β β βββ brain.nii.gz # skull-stripped T1w data β β βββ brain_edge.nii.gz # extracted brain edge maps β β βββ tissue.nii.gz # ground-truth tissue maps β β βββ dk-struct.nii.gz # ground-truth dk struture maps β βββ HCPD/ β βββ HCPY/ βββ Results/ βββ BrainParc/ βββ checkpoints/ # Saved every 10 epochs βββ log/ β βββ log βββ pred/ # Validation results per epoch
-
Please find the implementation of BrainParc in ./Code folder with following format
Code βββ config β βββ __init__.py β βββ config.py # Configuration for model training βββ dataset β βββ __init__.py β βββ basic.py # Basic function for data loading β βββ dataset.py # Data loader βββ network β βββ __init__.py β βββ basic.py # Basic function for model construction β βββ Joint_Parc_96.py # Main framework for progressive segmentation model βββ trainSegNetMS_Joint_DDP.py # Training script using DDP βββ utils βββ __init__.py βββ loss.py # Volume-aware adaptive weight loss function βββ utils.py
-
Training scripts
python -m torch.distributed.run --nproc_per_node=2 --nnodes=1 --master_port 10086 ./Code/trainSegNetMS_Joint_DDP.py --platform bme --save_path ParcJoint --file_list file_list.csv --batch_size 2 --resume -1 --weight 1
We provided three infant and two child/adult samples in Test_Sample. You can also test BrainParc on your own data structured as:
Test_Sample/ βββ sub001_infant_infantile/ β βββ brain.nii.gz βββ sub002_infant_isointense/ β βββ brain.nii.gz βββ sub003_infant_adult_like/ β βββ brain.nii.gz βββ sub004_child/ β βββ brain.nii.gz βββ sub005_adult/ βββ brain.nii.gz
- Skull-striping
- Please first conduct skull-stripping on your own data using our AutoStrip
- Brain edge extraction
Run likewise for other data samples with appropriate
python ./Code/Inference/Step01_Intensity_2_Edge.py --input ./Test_Samples/sub001_infant_infantile/brain.nii.gz --output ./Test_Samples/sub001_infant_infantile/brain_edge.nii.gz
--inputand--outputparameters. The processed data should include the following files:
brain.nii.gz, brain_edge.nii.gz
- Tissue segmentation and region parcellation
python ./Code/Inference/Step02_BrainParc.py --input_brain ./Test_Samples/sub001_infant_infantile/brain.nii.gz --input_edge ./Test_Samples/sub001_infant_infantile/brain_edge.nii.gz --output_tissue ./Test_Samples/sub001_infant_infantile/tissue.nii.gz --output_dk ./Test_Samples/sub001_infant_infantile/dk-struct.nii.gz --norm_orientation 1 --norm_spacing 1 --standard_space [0.8, 0.8, 0.8]
- --model_path: pretrained model path
- --input_brain: path to brain.nii.gz
- --input_edge: path to brain_edge.nii.gz
- --output_tissue: path to tissue.nii.gz
- --output_dk: path to dk-struct.nii.gz
- --norm_orientation: whether normalize image orientation to RPI, default=1
- --norm_spacing: whether normalize image spacing to standard_spacing, default=1
You can download our pretrained model through the following link:
- We segment MRI brain according to dk structrue atlas, each label in our BrainParc are shown below:
A detailed label correspondence of our dk-struct and tissue maps can be find at Label_cor.xlsx This mapping is also used during training to maintain structural consistency between the tissue maps and dk-struct labels.
Copyright IDEA Lab, School of Biomedical Engineering, ShanghaiTech University, Shanghai, China.
This project is licensed under the MIT License. See the LICENSE file for details.
If you have any questions or suggestions, please feel free to contact the corresponding author:
π§ Jiameng Liu: JiamengLiu.PRC@gmail.com