Custom Atlases¶
fsatlas supports user-provided atlases in addition to its built-in catalog. Pass a file path to --atlas instead of an atlas ID. Four file formats are supported.
LUT Requirement¶
Every atlas — built-in or custom — requires a lookup table (LUT): a TSV file mapping integer indices to region labels. The LUT drives the output schema (each row in the output corresponds to one LUT entry).
Minimum required columns:
| Column | Description |
|---|---|
index |
Integer label value in the atlas file |
label |
Human-readable region name |
hemisphere |
lh, rh, or bilateral (inferred from name if omitted) |
Additional columns (e.g. network, color_r, color_g, color_b) are preserved in the output.
Pass a LUT with --lut:
Generating a LUT from .annot files¶
Use the generate-lut command to extract the embedded colour table from a .annot file pair:
fsatlas generate-lut \
--lh-annot /path/to/lh.myatlas.annot \
--rh-annot /path/to/rh.myatlas.annot \
--output myatlas_lut.tsv
For catalog atlases (including FreeSurfer builtins):
fsatlas generate-lut --atlas desikan --output desikan_lut.tsv
fsatlas generate-lut --atlas schaefer400-7 --output schaefer400-7_lut.tsv
Surface Atlases (.annot)¶
Custom surface atlases must be FreeSurfer annotation files in fsaverage space.
File Requirements¶
- Format:
.annot(FreeSurfer annotation) - Space:
fsaverage(or compatible surface) - Naming convention:
{hemi}.{atlas_name}.annot - e.g.,
lh.myatlas.annotandrh.myatlas.annot - Both hemispheres must be in the same directory
Usage¶
Provide either hemisphere; fsatlas auto-detects the other:
fsatlas extract \
--atlas /path/to/atlases/lh.myatlas.annot \
--lut /path/to/myatlas_lut.tsv \
-o ./results
Or generate the LUT on-the-fly first:
fsatlas generate-lut \
--lh-annot /path/to/lh.myatlas.annot \
--rh-annot /path/to/rh.myatlas.annot \
--output myatlas_lut.tsv
fsatlas extract \
--atlas /path/to/lh.myatlas.annot \
--lut myatlas_lut.tsv \
-o ./results
What happens internally¶
- fsatlas detects the format from the
.annotextension. - For each subject and hemisphere,
mri_surf2surftransfers the annotation to subject space: mris_anatomical_statsextracts 9 cortical measures per parcel.- Measures are merged onto the LUT → wide-format output.
Volumetric Atlases (.nii / .nii.gz)¶
Custom volumetric atlases must be integer-labeled NIfTI files in MNI152 space.
File Requirements¶
- Format:
.niior.nii.gz - Space: MNI152NLin6Asym (FSL standard) or MNI152NLin2009cAsym
- Values: integer labels (0 = background)
Usage¶
fsatlas extract \
--atlas /path/to/my_subcortical_atlas.nii.gz \
--lut /path/to/lut.tsv \
-o ./results
What happens internally¶
mri_vol2volregisters the atlas to each subject's native space via thetalairach.xfm:mri_segstatsextracts 7 volumetric/intensity measures per label.- Measures are merged onto the LUT → wide-format output.
CIFTI Dense Label Atlases (.dlabel.gii)¶
CIFTI .dlabel.gii files contain per-vertex surface parcellations (HCP-style).
File Requirements¶
- Format:
.dlabel.gii - Space:
fsaverage(or another surface space) - Naming:
{hemi}.{atlas_name}.dlabel.gii
Usage¶
fsatlas extract \
--atlas /path/to/lh.myatlas.dlabel.gii \
--format dlabel_gii \
--lut /path/to/lut.tsv \
-o ./results
What happens internally¶
mris_convert --dlabel-to-annotconverts the.dlabel.giito a.annotfile.- The rest of the pipeline is identical to the
.annotsurface path.
FreeSurfer 7.4+ required
mris_convert --dlabel-to-annot is available in FreeSurfer ≥ 7.4. FreeSurfer 8.x is recommended.
GCA Atlases (.gca)¶
FreeSurfer .gca (Gaussian Classifier Atlas) files define probabilistic subcortical segmentations.
File Requirements¶
- Format:
.gca(FreeSurfer Gaussian Classifier Atlas) - Requires
mri/transforms/talairach.m3zin each subject directory
Usage¶
fsatlas extract \
--atlas /path/to/myatlas.gca \
--format gca \
--lut /path/to/lut.tsv \
-o ./results
What happens internally¶
mri_ca_labelapplies the GCA to each subject'snorm.mgzusingtalairach.m3z:mri_segstatsextracts volumetric/intensity measures from the resulting segmentation.- Measures are merged onto the LUT → wide-format output.
Format Detection¶
fsatlas auto-detects the format from the file extension:
| Extension | Detected format |
|---|---|
.annot |
annot |
.nii, .nii.gz |
nifti |
.dlabel.gii, .label.gii |
dlabel_gii |
.gca |
gca |
Override with --format when auto-detection is ambiguous:
Tips and Best Practices¶
Verify fsaverage space
Before using a custom surface atlas, confirm it was created in fsaverage space. Many atlas repositories provide both fsaverage and other surface spaces — download the correct version.
Check MNI registration
For volumetric atlases, confirm the NIfTI header reports MNI space. You can check with nibabel:
Label 0 is background
mri_segstats ignores label 0. Ensure all background voxels are labeled 0 in your NIfTI or GCA-produced volume.
Hemisphere in the LUT
For volumetric atlases, adding a hemisphere column to your LUT TSV avoids relying on name-based inference. This is especially useful for atlases with non-standard region naming.
Atlas caching
Transferred atlas files are cached in each subject's mri/atlas/ or label/ directory. Re-runs skip the transfer step unless --force is passed.
Affine registration only (nifti)
The NIfTI handler uses the affine talairach.xfm. For atlases that require non-linear (deformable) registration, register manually and pass the native-space result as a volumetric atlas. The GCA handler uses the non-linear talairach.m3z.