Renderable cortical surface mesh with per-vertex color, curvature data, and GPU buffer management.
More...
#include <brainsurface.h>
|
| | BrainSurface () |
| | ~BrainSurface () |
| void | setVisible (bool visible) |
| bool | isVisible () const |
| void | setHemi (int hemi) |
| void | setTissueType (TissueType type) |
| TissueType | tissueType () const |
| int | hemi () const |
| void | fromSurface (const FSLIB::FsSurface &surf) |
| void | fromBemSurface (const MNELIB::MNEBemSurface &surf, const QColor &color=Qt::white) |
| void | createFromData (const Eigen::MatrixX3f &vertices, const Eigen::MatrixX3i &triangles, const QColor &color) |
| void | createFromData (const Eigen::MatrixX3f &vertices, const Eigen::MatrixX3f &normals, const Eigen::MatrixX3i &triangles, const QColor &color) |
| bool | loadAnnotation (const QString &path) |
| void | addAnnotation (const FSLIB::FsAnnotation &annotation) |
| void | labelElements (int verticesPerElement) |
| void | setVisualizationMode (VisualizationMode mode) |
| void | applySourceEstimateColors (const QVector< uint32_t > &colors) |
| void | clearSourceEstimateColors () |
| GpuStream | geometryStream () const |
| GpuStream | colorStream () const |
| GpuStream | annotationStream () const |
| GpuStream | indexStream () const |
| const RenderKey & | renderKey () const |
| uint32_t | indexCount () const |
| uint32_t | vertexCount () const |
| Eigen::MatrixX3f | vertexPositions () const |
| Eigen::MatrixX3f | vertexNormals () const |
| QVector< uint32_t > | triangleIndices () const |
| const QVector< VertexData > & | vertexDataRef () const |
| const QVector< uint32_t > & | colorsRef () const |
| const QVector< uint32_t > & | annotationColorsRef () const |
| float | minX () const |
| float | maxX () const |
| void | boundingBox (QVector3D &min, QVector3D &max) const |
| bool | intersects (const QVector3D &rayOrigin, const QVector3D &rayDir, float &dist, int &vertexIdx) const |
| QString | getAnnotationLabel (int vertexIdx) const |
| int | getAnnotationLabelId (int vertexIdx) const |
| void | setSelectedRegion (int regionId) |
| void | translateX (float offset) |
| void | transform (const QMatrix4x4 &m) |
| void | applyTransform (const QMatrix4x4 &m) |
| std::vector< Eigen::VectorXi > | computeNeighbors () const |
| Eigen::MatrixX3f | verticesAsMatrix () const |
| void | setUseDefaultColor (bool useDefault) |
| void | setColor (const QColor &color) |
| void | setSelected (bool selected) |
| bool | isSelected () const |
| int | selectedRegionId () const |
| int | selectedVertexStart () const |
| void | setSelectedVertexRange (int start, int count) |
| std::optional< uint32_t > | selectedLabel () const |
Renderable cortical surface mesh with per-vertex color, curvature data, and GPU buffer management.
BrainSurface manages the geometry and visual properties of a single brain mesh.
Definition at line 81 of file brainsurface.h.
◆ VisualizationMode
◆ TissueType
| Enumerator |
|---|
| TissueUnknown | |
| TissueBrain | |
| TissueSkin | |
| TissueOuterSkull | |
| TissueInnerSkull | |
Definition at line 104 of file brainsurface.h.
◆ BrainSurface()
| DISP3DLIB::BrainSurface::BrainSurface |
( |
| ) |
|
|
default |
◆ ~BrainSurface()
| DISP3DLIB::BrainSurface::~BrainSurface |
( |
| ) |
|
|
default |
◆ addAnnotation()
Add annotation data directly.
- Parameters
-
| [in] | annotation | Input annotation data. |
Definition at line 219 of file brainsurface.cpp.
◆ annotationColorsRef()
| const QVector< uint32_t > & DISP3DLIB::BrainSurface::annotationColorsRef |
( |
| ) |
const |
|
inline |
- Returns
- Per-vertex packed ABGR annotation colours, valid while this surface lives.
Definition at line 345 of file brainsurface.h.
◆ annotationStream()
| GpuStream DISP3DLIB::BrainSurface::annotationStream |
( |
| ) |
const |
- Returns
- Annotation colour stream (packed ABGR per vertex, 0 where unlabelled).
Definition at line 87 of file brainsurface.cpp.
◆ applySourceEstimateColors()
| void DISP3DLIB::BrainSurface::applySourceEstimateColors |
( |
const QVector< uint32_t > & | colors | ) |
|
Apply source estimate colors to vertices.
- Parameters
-
| [in] | colors | Vector of packed ABGR colors, one per vertex. |
Definition at line 274 of file brainsurface.cpp.
◆ applyTransform()
| void DISP3DLIB::BrainSurface::applyTransform |
( |
const QMatrix4x4 & | m | ) |
|
Apply a transformation to the surface starting from the original data. Note: This prevents transformation accumulation.
- Parameters
-
| [in] | m | Transformation matrix. |
Definition at line 396 of file brainsurface.cpp.
◆ boundingBox()
| void DISP3DLIB::BrainSurface::boundingBox |
( |
QVector3D & | min, |
|
|
QVector3D & | max ) const |
Get bounding box of the surface.
- Parameters
-
| [out] | min | Minimum coordinates. |
| [out] | max | Maximum coordinates. |
Definition at line 458 of file brainsurface.cpp.
◆ clearSourceEstimateColors()
| void DISP3DLIB::BrainSurface::clearSourceEstimateColors |
( |
| ) |
|
Clear source estimate overlay colors and restore curvature-based coloring.
Definition at line 290 of file brainsurface.cpp.
◆ colorsRef()
| const QVector< uint32_t > & DISP3DLIB::BrainSurface::colorsRef |
( |
| ) |
const |
|
inline |
- Returns
- Per-vertex packed ABGR colours, valid while this surface lives.
Definition at line 337 of file brainsurface.h.
◆ colorStream()
| GpuStream DISP3DLIB::BrainSurface::colorStream |
( |
| ) |
const |
- Returns
- Colour stream (packed ABGR per vertex; alpha carries the curvature grey on cortex).
Definition at line 82 of file brainsurface.cpp.
◆ computeNeighbors()
| std::vector< Eigen::VectorXi > DISP3DLIB::BrainSurface::computeNeighbors |
( |
| ) |
const |
Compute neighbor vertices from triangle connectivity. Required for surface-constrained distance calculations.
- Returns
- Vector of neighbor indices for each vertex.
Definition at line 408 of file brainsurface.cpp.
◆ createFromData() [1/2]
| void DISP3DLIB::BrainSurface::createFromData |
( |
const Eigen::MatrixX3f & | vertices, |
|
|
const Eigen::MatrixX3f & | normals, |
|
|
const Eigen::MatrixX3i & | triangles, |
|
|
const QColor & | color ) |
Create surface from raw vertex, normal and triangle data.
- Parameters
-
| [in] | vertices | Nx3 matrix of vertex positions. |
| [in] | normals | Nx3 matrix of vertex normals. |
| [in] | triangles | Mx3 matrix of triangle indices. |
| [in] | color | FsSurface color. |
Definition at line 166 of file brainsurface.cpp.
◆ createFromData() [2/2]
| void DISP3DLIB::BrainSurface::createFromData |
( |
const Eigen::MatrixX3f & | vertices, |
|
|
const Eigen::MatrixX3i & | triangles, |
|
|
const QColor & | color ) |
Create surface from raw vertex and triangle data. Vertex normals are the sums of the adjacent face normals.
- Parameters
-
| [in] | vertices | Nx3 matrix of vertex positions. |
| [in] | triangles | Mx3 matrix of triangle indices. |
| [in] | color | FsSurface color. |
Definition at line 161 of file brainsurface.cpp.
◆ fromBemSurface()
| void DISP3DLIB::BrainSurface::fromBemSurface |
( |
const MNELIB::MNEBemSurface & | surf, |
|
|
const QColor & | color = Qt::white ) |
Load geometry from a MNE BEM surface.
- Parameters
-
| [in] | surf | Input BEM surface. |
| [in] | color | Base color for the surface. |
Definition at line 142 of file brainsurface.cpp.
◆ fromSurface()
Load geometry from a FreeSurfer surface.
- Parameters
-
| [in] | surf | Input FreeSurfer surface. |
Definition at line 120 of file brainsurface.cpp.
◆ geometryStream()
| GpuStream DISP3DLIB::BrainSurface::geometryStream |
( |
| ) |
const |
◆ getAnnotationLabel()
| QString DISP3DLIB::BrainSurface::getAnnotationLabel |
( |
int | vertexIdx | ) |
const |
Get the annotation label name for a given vertex.
- Parameters
-
| [in] | vertexIdx | Index of the vertex. |
- Returns
- FsLabel name.
Definition at line 742 of file brainsurface.cpp.
◆ getAnnotationLabelId()
| int DISP3DLIB::BrainSurface::getAnnotationLabelId |
( |
int | vertexIdx | ) |
const |
◆ hemi()
| int DISP3DLIB::BrainSurface::hemi |
( |
| ) |
const |
|
inline |
Get the hemisphere index.
- Returns
- Hemisphere index (0=LH, 1=RH).
Definition at line 171 of file brainsurface.h.
◆ indexCount()
| uint32_t DISP3DLIB::BrainSurface::indexCount |
( |
| ) |
const |
|
inline |
◆ indexStream()
| GpuStream DISP3DLIB::BrainSurface::indexStream |
( |
| ) |
const |
- Returns
- Triangle index stream (three uint32 per triangle).
Definition at line 92 of file brainsurface.cpp.
◆ intersects()
| bool DISP3DLIB::BrainSurface::intersects |
( |
const QVector3D & | rayOrigin, |
|
|
const QVector3D & | rayDir, |
|
|
float & | dist, |
|
|
int & | vertexIdx ) const |
Test ray intersection with this surface.
- Parameters
-
| [in] | rayOrigin | Ray origin in world/local space (object is assumed at 0,0,0 usually unless transformed externally). Note: The BrainSurface vertices are typically already transformed (e.g. by View3D model matrix logic? No, BrainView applies matrix in shader. The vertices here are raw. So ray must be transformed to local space OR vertices transformed to world. |
| [in] | rayDir | Ray direction (normalized). |
| [out] | dist | Distance to intersection. |
| [in,out] | vertexIdx | Index of the vertex closest to the intersection. |
- Returns
- True if intersected.
Definition at line 640 of file brainsurface.cpp.
◆ isSelected()
| bool DISP3DLIB::BrainSurface::isSelected |
( |
| ) |
const |
|
inline |
◆ isVisible()
| bool DISP3DLIB::BrainSurface::isVisible |
( |
| ) |
const |
|
inline |
Check if the surface is visible.
- Returns
- True if visible.
Definition at line 127 of file brainsurface.h.
◆ labelElements()
| void DISP3DLIB::BrainSurface::labelElements |
( |
int | verticesPerElement | ) |
|
Give each run of vertices its own label key, so one element of a batched mesh (e.g. one digitizer sphere) can be highlighted on its own.
- Parameters
-
| [in] | verticesPerElement | Number of consecutive vertices per element. |
Definition at line 245 of file brainsurface.cpp.
◆ loadAnnotation()
| bool DISP3DLIB::BrainSurface::loadAnnotation |
( |
const QString & | path | ) |
|
Load annotation data from file.
- Parameters
-
| [in] | path | Path to the .annot file. |
- Returns
- True if successful.
Definition at line 208 of file brainsurface.cpp.
◆ maxX()
| float DISP3DLIB::BrainSurface::maxX |
( |
| ) |
const |
Get maximum X coordinate.
- Returns
- Maximum X value.
Definition at line 344 of file brainsurface.cpp.
◆ minX()
| float DISP3DLIB::BrainSurface::minX |
( |
| ) |
const |
Get minimum X coordinate.
- Returns
- Minimum X value.
Definition at line 334 of file brainsurface.cpp.
◆ renderKey()
| const RenderKey & DISP3DLIB::BrainSurface::renderKey |
( |
| ) |
const |
|
inline |
- Returns
- Identity of this surface in the renderer's GPU cache.
Definition at line 285 of file brainsurface.h.
◆ selectedLabel()
| std::optional< uint32_t > DISP3DLIB::BrainSurface::selectedLabel |
( |
| ) |
const |
- Returns
- Annotation-stream value of the highlighted vertices (selected region or vertex range), or nothing when no part of the surface is highlighted.
Definition at line 789 of file brainsurface.cpp.
◆ selectedRegionId()
| int DISP3DLIB::BrainSurface::selectedRegionId |
( |
| ) |
const |
|
inline |
◆ selectedVertexStart()
| int DISP3DLIB::BrainSurface::selectedVertexStart |
( |
| ) |
const |
|
inline |
◆ setColor()
| void DISP3DLIB::BrainSurface::setColor |
( |
const QColor & | color | ) |
|
Set the colour of a surface without curvature (BEM, sensors, digitizers, source spaces).
- Parameters
-
| [in] | color | New colour; its alpha is the opacity of the holographic shader. |
Definition at line 307 of file brainsurface.cpp.
◆ setHemi()
| void DISP3DLIB::BrainSurface::setHemi |
( |
int | hemi | ) |
|
|
inline |
Set the hemisphere index.
- Parameters
-
| [in] | hemi | 0 for Left, 1 for Right. |
Definition at line 138 of file brainsurface.h.
◆ setSelected()
| void DISP3DLIB::BrainSurface::setSelected |
( |
bool | selected | ) |
|
◆ setSelectedRegion()
| void DISP3DLIB::BrainSurface::setSelectedRegion |
( |
int | regionId | ) |
|
Set the selected region for highlighting.
- Parameters
-
| [in] | regionId | The ID of the region to highlight. |
Definition at line 773 of file brainsurface.cpp.
◆ setSelectedVertexRange()
| void DISP3DLIB::BrainSurface::setSelectedVertexRange |
( |
int | start, |
|
|
int | count ) |
Highlight a contiguous range of vertices (e.g. a single sphere in a batched mesh). Pass start=-1 to clear the vertex range highlight.
- Parameters
-
| [in] | start | First vertex index to highlight (-1 to clear). |
| [in] | count | Number of vertices to highlight. |
Definition at line 783 of file brainsurface.cpp.
◆ setTissueType()
| void DISP3DLIB::BrainSurface::setTissueType |
( |
TissueType | type | ) |
|
|
inline |
Set the tissue type (Brain, Skin, Skull, etc.).
- Parameters
-
Definition at line 149 of file brainsurface.h.
◆ setUseDefaultColor()
| void DISP3DLIB::BrainSurface::setUseDefaultColor |
( |
bool | useDefault | ) |
|
Set/Get whether to use the default surface color.
- Parameters
-
| [in] | useDefault | True to use the surface's default color as base, false for white. |
Definition at line 299 of file brainsurface.cpp.
◆ setVisible()
| void DISP3DLIB::BrainSurface::setVisible |
( |
bool | visible | ) |
|
Set the visibility of the surface.
- Parameters
-
| [in] | visible | True if visible. |
Definition at line 259 of file brainsurface.cpp.
◆ setVisualizationMode()
Set the visualization mode (FsSurface, FsAnnotation, Scientific).
- Parameters
-
Definition at line 266 of file brainsurface.cpp.
◆ tissueType()
| TissueType DISP3DLIB::BrainSurface::tissueType |
( |
| ) |
const |
|
inline |
◆ transform()
| void DISP3DLIB::BrainSurface::transform |
( |
const QMatrix4x4 & | m | ) |
|
Apply a generic 4x4 transformation matrix to all vertices and normals.
- Parameters
-
| [in] | m | Transformation matrix. |
Definition at line 364 of file brainsurface.cpp.
◆ translateX()
| void DISP3DLIB::BrainSurface::translateX |
( |
float | offset | ) |
|
Translate all vertices along the X axis.
- Parameters
-
| [in] | offset | Amount to translate. |
Definition at line 354 of file brainsurface.cpp.
◆ triangleIndices()
| QVector< uint32_t > DISP3DLIB::BrainSurface::triangleIndices |
( |
| ) |
const |
|
inline |
Get the triangle index buffer.
- Returns
- Copy of the index data, three vertex indices per triangle.
Definition at line 321 of file brainsurface.h.
◆ vertexCount()
| uint32_t DISP3DLIB::BrainSurface::vertexCount |
( |
| ) |
const |
|
inline |
◆ vertexDataRef()
| const QVector< VertexData > & DISP3DLIB::BrainSurface::vertexDataRef |
( |
| ) |
const |
|
inline |
- Returns
- Current vertex geometry, valid while this surface lives.
Definition at line 329 of file brainsurface.h.
◆ vertexNormals()
| Eigen::MatrixX3f DISP3DLIB::BrainSurface::vertexNormals |
( |
| ) |
const |
Get a copy of the current vertex normals.
- Returns
- Nx3 matrix of the current vertex normals.
Definition at line 195 of file brainsurface.cpp.
◆ vertexPositions()
| Eigen::MatrixX3f DISP3DLIB::BrainSurface::vertexPositions |
( |
| ) |
const |
Get a copy of the current vertex positions.
- Returns
- Nx3 matrix of the current (possibly transformed) vertex positions.
Definition at line 182 of file brainsurface.cpp.
◆ verticesAsMatrix()
| Eigen::MatrixX3f DISP3DLIB::BrainSurface::verticesAsMatrix |
( |
| ) |
const |
Get vertex positions as Eigen matrix.
- Returns
- Nx3 matrix of vertex positions.
Definition at line 444 of file brainsurface.cpp.
◆ ModeAnnotation
◆ ModeScientific
◆ ModeSourceEstimate
◆ ModeSurface
The documentation for this class was generated from the following files: