Reference · Atlas
freesurfer
ontology.atlas.freesurfer
FreeSurfer atlas utilities for mapping between region indices and labels.
Loads the FreeSurfer color lookup table and provides helpers to translate between numeric FreeSurfer indices and region labels, exposes the FS86 and aparc label lists, and converts HCP-MMP1 region names to FreeSurfer label conventions.
Functions
fs_mapper
Create a mapping between FreeSurfer indices and labels.
hcp2fs_labels
Convert HCP-MMP1 region names to FreeSurfer cortical label conventions.
idx2label
Convert one or many FreeSurfer indices to labels.
label2idx
Convert one or many FreeSurfer labels to indices.
fs_mapper
ontology.atlas.freesurfer.fs_mapper(output= 'label' )
Create a mapping between FreeSurfer indices and labels.
Parameters
output
str
If “label”, return a mapping id → label. If “index”, return a mapping label → id. Defaults to “label”.
'label'
Returns
dict
dict[int | str, int | str]
Mapping between indices and labels according to the selected output mode.
hcp2fs_labels
ontology.atlas.freesurfer.hcp2fs_labels(hcp_labels)
Convert HCP-MMP1 region names to FreeSurfer cortical label conventions.
Each label is lower-cased and its hemisphere prefix rewritten, mapping l_ to ctx-lh- and r_ to ctx-rh-.
Parameters
hcp_labels
list[str]
HCP-MMP1 region names to convert.
required
Returns
list[str]
The region names rewritten in FreeSurfer label form.
idx2label
ontology.atlas.freesurfer.idx2label(idx)
Convert one or many FreeSurfer indices to labels.
Parameters
idx
int | list[int]
One index or a list of indices.
required
Returns
str | list[str]
str | list[str]: The corresponding label(s).
label2idx
ontology.atlas.freesurfer.label2idx(label)
Convert one or many FreeSurfer labels to indices.
Parameters
label
str | list[str]
One label or a list of labels.
required
Returns
int | list[int]
int | list[int]: The corresponding index/indices.