v2.0.0
Loading...
Searching...
No Matches
fs_annotation.h File Reference

Reader for FreeSurfer per-vertex annotation (parcellation) files such as lh.aparc.annot. More...

#include "fs_global.h"
#include "fs_colortable.h"
#include <QString>
#include <QSharedPointer>
#include <Eigen/Core>
Include dependency graph for fs_annotation.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  FSLIB::FsAnnotation
 Single-hemisphere FreeSurfer parcellation: vertex → region label plus embedded colortable. More...

Namespaces

namespace  FSLIB
 FreeSurfer surface, annotation and parcellation I/O for mne-cpp.

Detailed Description

Reader for FreeSurfer per-vertex annotation (parcellation) files such as lh.aparc.annot.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.0.0
Date
March 2026

A FreeSurfer .annot file assigns one parcellation label to each surface vertex and ships the colour-lookup table needed to render it. It is the output of mris_ca_label / mri_annotation2label and is produced by recon-all for every standard atlas (Desikan-Killiany aparc, Destrieux aparc.a2009s, aparc.DKTatlas40, Brodmann BA, …). The file is big-endian and has the layout:

  • int32 num_vertices
  • num_vertices × (int32 vertex_index, int32 packed_rgba_label)
  • optional TAG_OLD_COLORTABLE / TAG_NEW_COLORTABLE block carrying the embedded colortable (struct names + RGBA), parsed into an FsColortable

The per-vertex label is the int32 obtained by packing R + (G ≪ 8) + (B ≪ 16) + (A ≪ 24) of the assigned region’s colortable entry; reverse mapping from packed value to colortable row yields the anatomical name. Format reference: utils/read_annotation.c in FreeSurfer.

This class loads one hemisphere; combine two instances via FsAnnotationSet for whole-brain parcellations.

Definition in file fs_annotation.h.