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 | setVisualizationMode (VisualizationMode mode) |
| void | applySourceEstimateColors (const QVector< uint32_t > &colors) |
| void | clearSourceEstimateColors () |
| void | updateBuffers (QRhi *rhi, QRhiResourceUpdateBatch *u) |
| QRhiBuffer * | vertexBuffer () const |
| QRhiBuffer * | indexBuffer () 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-ref access to CPU-side vertex data (used by merged rendering).
|
| const QVector< uint32_t > & | indexDataRef () const |
| | Const-ref access to CPU-side index data (used by merged rendering).
|
| quint64 | vertexGeneration () const |
| | Monotonically increasing counter bumped whenever vertex data changes.
|
| 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) |
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 90 of file brainsurface.h.
◆ VisualizationMode
◆ TissueType
| Enumerator |
|---|
| TissueUnknown | |
| TissueBrain | |
| TissueSkin | |
| TissueOuterSkull | |
| TissueInnerSkull | |
Definition at line 113 of file brainsurface.h.
◆ BrainSurface()
| DISP3DLIB::BrainSurface::BrainSurface |
( |
| ) |
|
◆ ~BrainSurface()
| DISP3DLIB::BrainSurface::~BrainSurface |
( |
| ) |
|
|
default |
◆ addAnnotation()
Add annotation data directly.
- Parameters
-
| [in] | annotation | Input annotation data. |
Definition at line 270 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 305 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 511 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 648 of file brainsurface.cpp.
◆ clearSourceEstimateColors()
| void DISP3DLIB::BrainSurface::clearSourceEstimateColors |
( |
| ) |
|
Clear source estimate overlay colors and restore curvature-based coloring.
Definition at line 322 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 598 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 195 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 190 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 149 of file brainsurface.cpp.
◆ fromSurface()
Load geometry from a FreeSurfer surface.
- Parameters
-
| [in] | surf | Input FreeSurfer surface. |
Definition at line 103 of file brainsurface.cpp.
◆ 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 814 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 180 of file brainsurface.h.
◆ indexBuffer()
| QRhiBuffer * DISP3DLIB::BrainSurface::indexBuffer |
( |
| ) |
const |
◆ indexCount()
| uint32_t DISP3DLIB::BrainSurface::indexCount |
( |
| ) |
const |
|
inline |
◆ indexDataRef()
| const QVector< uint32_t > & DISP3DLIB::BrainSurface::indexDataRef |
( |
| ) |
const |
|
inline |
Const-ref access to CPU-side index data (used by merged rendering).
- Returns
- Reference to the internal triangle index array, valid while this surface lives.
Definition at line 322 of file brainsurface.h.
◆ 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 680 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 136 of file brainsurface.h.
◆ 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 258 of file brainsurface.cpp.
◆ maxX()
| float DISP3DLIB::BrainSurface::maxX |
( |
| ) |
const |
Get maximum X coordinate.
- Returns
- Maximum X value.
Definition at line 457 of file brainsurface.cpp.
◆ minX()
| float DISP3DLIB::BrainSurface::minX |
( |
| ) |
const |
Get minimum X coordinate.
- Returns
- Minimum X value.
Definition at line 447 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 340 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 147 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 870 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 882 of file brainsurface.cpp.
◆ setTissueType()
| void DISP3DLIB::BrainSurface::setTissueType |
( |
TissueType | type | ) |
|
|
inline |
Set the tissue type (Brain, Skin, Skull, etc.).
- Parameters
-
Definition at line 158 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 332 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 281 of file brainsurface.cpp.
◆ setVisualizationMode()
Set the visualization mode (FsSurface, FsAnnotation, Scientific).
- Parameters
-
Definition at line 288 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 478 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 467 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 303 of file brainsurface.h.
◆ updateBuffers()
| void DISP3DLIB::BrainSurface::updateBuffers |
( |
QRhi * | rhi, |
|
|
QRhiResourceUpdateBatch * | u ) |
Update graphics buffers (vertex/index) on the GPU.
- Parameters
-
| [in] | rhi | Pointer to QRhi instance. |
| [in] | u | Resource update batch. |
Definition at line 528 of file brainsurface.cpp.
◆ vertexBuffer()
| QRhiBuffer * DISP3DLIB::BrainSurface::vertexBuffer |
( |
| ) |
const |
◆ vertexCount()
| uint32_t DISP3DLIB::BrainSurface::vertexCount |
( |
| ) |
const |
|
inline |
◆ vertexDataRef()
| const QVector< VertexData > & DISP3DLIB::BrainSurface::vertexDataRef |
( |
| ) |
const |
|
inline |
Const-ref access to CPU-side vertex data (used by merged rendering).
- Returns
- Reference to the internal vertex array, valid while this surface lives.
Definition at line 313 of file brainsurface.h.
◆ vertexGeneration()
| quint64 DISP3DLIB::BrainSurface::vertexGeneration |
( |
| ) |
const |
|
inline |
Monotonically increasing counter bumped whenever vertex data changes.
- Returns
- Current vertex data generation counter.
Definition at line 332 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 245 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 232 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 634 of file brainsurface.cpp.
◆ ModeAnnotation
◆ ModeScientific
◆ ModeSourceEstimate
◆ ModeSurface
The documentation for this class was generated from the following files: