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 FsLabel | growCircularLabel (const FsSurface &surface, const QVector< int > &seeds, double extentMm, int hemi, const QString &name) |
| Grow a circular label around seed vertices, as mne.grow_labels does for one seed set. | |
| static QList< FsLabel > | splitLabel (const FsLabel &label, const FsSurface &surface) |
| Split a label into connected components. | |
| static QList< FsLabel > | stcToLabel (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. | |
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 71 of file fs_label_utils.h.
|
static |
Build adjacency list from surface triangle mesh.
| [in] | tris | Triangle matrix (n_tris × 3). |
| [in] | nVerts | Total number of vertices. |
Definition at line 45 of file fs_label_utils.cpp.
|
static |
Grow a circular label around seed vertices, as mne.grow_labels does for one seed set.
Vertices within extentMm geodesic distance along the mesh edges are included, following mne's label growing (a distance found later is lowered but not propagated again). The label values are the distances in whole millimetres, as in MNE-Python.
| [in] | surface | Surface of the hemisphere. |
| [in] | seeds | Seed vertices. |
| [in] | extentMm | Maximum geodesic distance in mm. |
| [in] | hemi | Hemisphere (0 = lh, 1 = rh). |
| [in] | name | Label name; "-lh" / "-rh" is appended unless present. |
Definition at line 126 of file fs_label_utils.cpp.
|
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).
| [in] | label | The seed label to grow from. |
| [in] | surface | The surface providing vertex adjacency. |
| [in] | nSteps | Number of expansion steps. |
Definition at line 69 of file fs_label_utils.cpp.
|
static |
Convert labels to a binary source estimate mask.
Creates a matrix of ones for vertices inside the labels, zeros otherwise.
| [in] | labels | Labels to convert. |
| [in] | stcVertices | Vertex indices of the target STC space. |
| [in] | nTimes | Number of time points. |
Definition at line 320 of file fs_label_utils.cpp.
|
static |
Split a label into connected components.
Like mne Label.split("contiguous"): the parts keep the label's positions and values, come largest first and are named <name>_div<i>, before a trailing -lh / -rh.
| [in] | label | The label to split. |
| [in] | surface | The surface providing vertex adjacency (empty: every vertex is its own part). |
Definition at line 192 of file fs_label_utils.cpp.
|
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.
| [in] | stcData | Source estimate data (n_vertices × n_times). |
| [in] | vertices | Vertex indices in the source estimate. |
| [in] | surface | The surface providing positions and adjacency. |
| [in] | dThreshold | Absolute threshold for inclusion (default 0.0 = include all). |
| [in] | iHemi | Hemisphere id (0=lh, 1=rh). |
Definition at line 262 of file fs_label_utils.cpp.