Skip to main content

FsColortable

Namespace: FSLIB  ·  Library: FreeSurfer Library

#include <fs/fs_colortable.h>

class FSLIB::FsColortable

FreeSurfer colour lookup table: region name + RGBA + packed label, indexed by entry.

Backs the colour/structure mapping used by FsAnnotation and by any caller that needs to translate a packed .annot label into the matching anatomical name and RGBA colour. The container is a thin value object: rows of table align with struct_names, and the label column matches the per-vertex integer stored in .annot files so direct equality lookup is sufficient.

src/examples/ex_fs/main.cpp
FsAnnotation aparc("sample", 0, "aparc", subjectsDir);
FsColortable& colors = aparc.getColortable();
QList<FsLabel> regions;
QList<RowVector4i> regionColors;
aparc.toLabels(white, regions, regionColors);

Public Methods​

FsColortable()​

Default constructor.


clear()​

Initializes colortable.


getLabelIds()​

Ids encoded in the colortable.

Returns:

  • Eigen::VectorXi — ids.

getNames()​

Names encoded in the colortable.

Returns:

  • QStringList — ids.

getRGBAs()​

RGBAs encoded in the colortable.

Returns:

  • Eigen::MatrixX4i — RGBAs.

Example​

Used in examples​

ex_fs​

FreeSurfer library: surfaces, curvature, parcellations, labels and an atlas volume.

src/examples/ex_fs/main.cpp, line 129
FsAnnotation aparc("sample", 0, "aparc", subjectsDir);
FsColortable& colors = aparc.getColortable();
QList<FsLabel> regions;
QList<RowVector4i> regionColors;
aparc.toLabels(white, regions, regionColors);
int precentral = -1;
for (int i = 0; i < regions.size(); ++i) {
if (regions[i].name == "precentral-lh") {
precentral = i;
}
}
// nibabel.freesurfer.read_annot: 36 table entries; mne.read_labels_from_annot: 34 labels, precentral-lh 9505 vertices
ok &= expect(colors.getNames().size() == 36 && regions.size() == 34 && precentral >= 0 && regions[precentral].vertices.size() == 9505,

Authors of this file​