Parcellation
Overview
Once you have obtained a topology-corrected volumetric segmentation, you can proceed to the surface-based pipeline to obtain whole-hemisphere cortical parcellations in standard neuroanatomical atlases.
This step runs locally (CPU only; no GPU required).
The pipeline prepares the data, computes necessary transformations, performs surface modeling and topology stabilization, and generates atlas-based parcellations.
Requirements
FreeSurfer installed locally (tested with FreeSurfer 7.4.0 on Linux)
Python dependencies listed in
dependencies.txtInstall using:pip install -r dependencies.txt
A topology-corrected volumetric segmentation (e.g., 10-label output)
Optional: 1mm Conforming
You may run the pipeline at 1mm resolution by conforming the MRI and segmentation to MNI space.
Reference snippet: https://github.com/Pulkit-Khandelwal/purple-mri/blob/main/misc_scripts/flip_conform.sh
Running the Surface-Based Pipeline
Clone the repository and run run_surface_pipeline.sh from within
the purple_mri directory.
Inputs
The script requires the following arguments:
freesurfer_path— path to the FreeSurfer installationworking_dir— directory where outputs will be storedmri_path— directory containing MRI images (NIfTI)segm_path— directory containing topology-corrected segmentationsexternal_atlases_path— directory containing additional atlas resourcesnum_threads— number of CPU threadshemis— hemisphere flag (rhorlh)
Data Organization
Place MRI volumes in
mri_pathPlace corresponding segmentation volumes in
segm_pathEnsure MRI and segmentation filenames match exactly (both ending in
.nii.gz)Place
fsaverageinworking_dir
Command
cd purple_mri
bash run_surface_pipeline.sh \
freesurfer_path \
working_dir \
mri_path \
segm_path \
external_atlases_path \
num_threads \
rh
Atlases
The pipeline produces parcellations in commonly used atlases, including:
Desikan–Killiany–Tourville (DKT)
Schaefer
Glasser
von Economo–Koskinas
Outputs
Typical outputs include:
White and pial cortical surfaces
Native-space atlas parcellations
ROI-level statistics
Vertex-wise cortical measures (e.g., thickness)
Next Step
Proceed to:
for vertex-wise and ROI-wise statistical modeling.