v2.0.0
Loading...
Searching...
No Matches
FSLIB::FsLabelUtils Class Reference

Stateless utilities that grow, split and convert FsLabel objects on a FreeSurfer triangular surface. More...

#include <fs_label_utils.h>

Static Public Member Functions

static FsLabel growLabel (const FsLabel &label, const FsSurface &surface, int nSteps)
 Grow a label by expanding along the surface mesh.
static QList< FsLabelsplitLabel (const FsLabel &label, const FsSurface &surface)
 Split a label into connected components.
static QList< FsLabelstcToLabel (const Eigen::MatrixXd &stcData, const Eigen::VectorXi &vertices, const FsSurface &surface, double dThreshold=0.0, int iHemi=0)
 Convert a source estimate to labels by thresholding.
static Eigen::MatrixXd labelsToStc (const QList< FsLabel > &labels, const Eigen::VectorXi &stcVertices, int nTimes)
 Convert labels to a binary source estimate mask.
static QList< QSet< int > > buildAdjacency (const Eigen::MatrixX3i &tris, int nVerts)
 Build adjacency list from surface triangle mesh.

Detailed Description

Stateless utilities that grow, split and convert FsLabel objects on a FreeSurfer triangular surface.

All operations take an FsSurface as the topology source and treat its triangle faces as the vertex adjacency graph. The helpers are static because labels carry their own state and the surface is supplied per call, mirroring the function-based API used by MNE-Python.

Definition at line 68 of file fs_label_utils.h.

Member Function Documentation

◆ buildAdjacency()

QList< QSet< int > > FsLabelUtils::buildAdjacency ( const Eigen::MatrixX3i & tris,
int nVerts )
static

Build adjacency list from surface triangle mesh.

Parameters
[in]trisTriangle matrix (n_tris × 3).
[in]nVertsTotal number of vertices.
Returns
Adjacency list: for each vertex, the set of neighbor vertices.

Definition at line 43 of file fs_label_utils.cpp.

◆ growLabel()

FsLabel FsLabelUtils::growLabel ( const FsLabel & label,
const FsSurface & surface,
int nSteps )
static

Grow a label by expanding along the surface mesh.

Starting from the seed vertices in the label, expands outward by nSteps along surface edges (breadth-first).

Parameters
[in]labelThe seed label to grow from.
[in]surfaceThe surface providing vertex adjacency.
[in]nStepsNumber of expansion steps.
Returns
Grown label containing original + expanded vertices.

Definition at line 67 of file fs_label_utils.cpp.

◆ labelsToStc()

MatrixXd FsLabelUtils::labelsToStc ( const QList< FsLabel > & labels,
const Eigen::VectorXi & stcVertices,
int nTimes )
static

Convert labels to a binary source estimate mask.

Creates a matrix of ones for vertices inside the labels, zeros otherwise.

Parameters
[in]labelsLabels to convert.
[in]stcVerticesVertex indices of the target STC space.
[in]nTimesNumber of time points.
Returns
Binary mask (n_vertices × n_times).

Definition at line 266 of file fs_label_utils.cpp.

◆ splitLabel()

QList< FsLabel > FsLabelUtils::splitLabel ( const FsLabel & label,
const FsSurface & surface )
static

Split a label into connected components.

Uses the surface mesh to identify connected sub-labels.

Parameters
[in]labelThe label to split.
[in]surfaceThe surface providing vertex adjacency.
Returns
List of sub-labels (connected components).

Definition at line 124 of file fs_label_utils.cpp.

◆ stcToLabel()

QList< FsLabel > FsLabelUtils::stcToLabel ( const Eigen::MatrixXd & stcData,
const Eigen::VectorXi & vertices,
const FsSurface & surface,
double dThreshold = 0.0,
int iHemi = 0 )
static

Convert a source estimate to labels by thresholding.

Vertices whose absolute value exceeds the threshold at any time point are grouped into connected labels on the surface.

Parameters
[in]stcDataSource estimate data (n_vertices × n_times).
[in]verticesVertex indices in the source estimate.
[in]surfaceThe surface providing positions and adjacency.
[in]dThresholdAbsolute threshold for inclusion (default 0.0 = include all).
[in]iHemiHemisphere id (0=lh, 1=rh).
Returns
List of labels (connected components above threshold).

Definition at line 208 of file fs_label_utils.cpp.


The documentation for this class was generated from the following files: