Reader and in-memory representation of a single FreeSurfer triangular surface (e.g. lh.pial, rh.white, lh.inflated). More...
#include "fs_global.h"#include <QSharedPointer>#include <QDataStream>#include <iostream>#include <Eigen/Core>

Go to the source code of this file.
Classes | |
| class | FSLIB::FsSurface |
| In-memory FreeSurfer triangular cortical surface for one hemisphere. More... | |
Namespaces | |
| namespace | FSLIB |
| FreeSurfer surface, annotation and parcellation I/O for mne-cpp. | |
Reader and in-memory representation of a single FreeSurfer triangular surface (e.g. lh.pial, rh.white, lh.inflated).
SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors
A FreeSurfer surface file stores one cortical hemisphere as a closed triangular mesh: a list of vertex positions in Tk-surface RAS millimetres followed by a list of triangle faces given as indices into that vertex array. The reader handles the two binary container variants emitted by FreeSurfer’s MRISwrite():
QUAD_FILE_MAGIC_NUMBER (0xFFFFFE), whose quad faces are split into two triangles on load.TRIANGLE_FILE_MAGIC_NUMBER (0xFFFFFE) produced by current versions of mris_convert and recon-all, with a textual created by / filename header line preceding the little-endian 24-bit magic.Magic numbers, file layout and the implicit big-endian byte order all follow utils/mrisurf_io.c (in particular mrisReadTriangleFile and mrisReadQuadFile) and the public reference in freesurfer/utils/read_surf.c. Coordinates are returned in millimetres in the FreeSurfer Tk-surface RAS frame; conversion to scanner RAS requires the vox2ras-tkr / vox2ras-scanner transform pair from the subject’s orig.mgz and is intentionally left to callers.
The class also accepts the subject_id + throughout the MNE-Python and mne-c stack and resolves it against hemi + usedsurf shorthand$SUBJECTS_DIR/ <id>/surf/{lh|rh}.<surf>, so existing analysis scripts port across without path rewrites.
Definition in file fs_surface.h.