Controller for real-time source estimate streaming. More...
#include <rtsourcedatacontroller.h>
Signals | |
| void | newSmoothedDataAvailable (const QVector< uint32_t > &colorsLh, const QVector< uint32_t > &colorsRh) |
| void | newRawDataAvailable (const Eigen::VectorXd &dataLh, const Eigen::VectorXd &dataRh) |
| void | newInterpolationMatrixLeftAvailable (QSharedPointer< Eigen::SparseMatrix< float > > interpMat) |
| void | newInterpolationMatrixRightAvailable (QSharedPointer< Eigen::SparseMatrix< float > > interpMat) |
Public Member Functions | |
| RtSourceDataController (QObject *parent=nullptr) | |
| ~RtSourceDataController () override | |
| void | addData (const Eigen::VectorXd &data) |
| void | setInterpolationMatrixLeft (QSharedPointer< Eigen::SparseMatrix< float > > mat) |
| void | setInterpolationMatrixRight (QSharedPointer< Eigen::SparseMatrix< float > > mat) |
| void | setStreamingState (bool state) |
| bool | isStreaming () const |
| void | setTimeInterval (int msec) |
| void | setNumberAverages (int numAvr) |
| void | setColormapType (const QString &name) |
| void | setThresholds (double min, double mid, double max) |
| void | setLoopState (bool enabled) |
| void | setSFreq (double sFreq) |
| void | clearData () |
| void | setSurfaceColor (const QVector< uint32_t > &baseColorsLh, const QVector< uint32_t > &baseColorsRh) |
| void | setStreamSmoothedData (bool bStreamSmoothedData) |
| void | setInterpolationFunction (const QString &sInterpolationFunction) |
| void | setCancelDistance (double dCancelDist) |
| void | setInterpolationInfoLeft (const Eigen::MatrixX3f &matVertices, const QVector< QVector< int > > &vecNeighborVertices, const QVector< int > &vecSourceVertices) |
| void | setInterpolationInfoRight (const Eigen::MatrixX3f &matVertices, const QVector< QVector< int > > &vecNeighborVertices, const QVector< int > &vecSourceVertices) |
| void | recomputeInterpolation () |
| void | setVisualizationType (int iVisType) |
| void | setAnnotationInfoLeft (const Eigen::VectorXi &vecLabelIds, const QList< FSLIB::Label > &lLabels, const Eigen::VectorXi &vecVertNo) |
| void | setAnnotationInfoRight (const Eigen::VectorXi &vecLabelIds, const QList< FSLIB::Label > &lLabels, const Eigen::VectorXi &vecVertNo) |
Controller for real-time source estimate streaming.
RtSourceDataController orchestrates real-time source estimate streaming. It manages a background data worker thread, an optional background interpolation matrix worker thread, and a timer that drives the data flow.
The controller provides a simple public API for:
On-the-fly recomputation:
Usage:
Definition at line 98 of file rtsourcedatacontroller.h.

|
explicit |
Constructor. Creates the worker and background thread.
| [in] | parent | Parent QObject. |
Definition at line 53 of file rtsourcedatacontroller.cpp.
|
override |
Destructor. Stops the worker thread and cleans up.
Definition at line 100 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::addData | ( | const Eigen::VectorXd & | data | ) |
Add a source estimate data vector to the streaming queue. The vector should contain source values for all sources (LH + RH concatenated).
| [in] | data | Source activity vector (nSourcesLH + nSourcesRH). |
Definition at line 122 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::clearData | ( | ) |
Clear all queued data and reset the worker state.
Definition at line 230 of file rtsourcedatacontroller.cpp.
| bool RtSourceDataController::isStreaming | ( | ) | const |
Check if streaming is active.
Definition at line 165 of file rtsourcedatacontroller.cpp.
|
signal |
Emitted when a new left hemisphere interpolation matrix has been computed.
| [in] | interpMat | Sparse interpolation matrix (nVertices x nSources). |
|
signal |
Emitted when a new right hemisphere interpolation matrix has been computed.
| [in] | interpMat | Sparse interpolation matrix (nVertices x nSources). |
|
signal |
Emitted when raw (non-interpolated) data is available.
| [in] | dataLh | Source values for left hemisphere. |
| [in] | dataRh | Source values for right hemisphere. |
|
signal |
Emitted when new interpolated per-vertex color data is available for rendering.
| [in] | colorsLh | Per-vertex ABGR color array for the left hemisphere. |
| [in] | colorsRh | Per-vertex ABGR color array for the right hemisphere. |
| void RtSourceDataController::recomputeInterpolation | ( | ) |
Trigger an asynchronous recomputation of the interpolation matrices. The new matrices will be automatically forwarded to the data worker.
Definition at line 298 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setAnnotationInfoLeft | ( | const Eigen::VectorXi & | vecLabelIds, |
| const QList< FSLIB::Label > & | lLabels, | ||
| const Eigen::VectorXi & | vecVertNo ) |
Set annotation info for the left hemisphere.
| [in] | vecLabelIds | Per-vertex label IDs. |
| [in] | lLabels | FreeSurfer Labels. |
| [in] | vecVertNo | Source vertex numbers. |
Definition at line 340 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setAnnotationInfoRight | ( | const Eigen::VectorXi & | vecLabelIds, |
| const QList< FSLIB::Label > & | lLabels, | ||
| const Eigen::VectorXi & | vecVertNo ) |
Set annotation info for the right hemisphere.
| [in] | vecLabelIds | Per-vertex label IDs. |
| [in] | lLabels | FreeSurfer Labels. |
| [in] | vecVertNo | Source vertex numbers. |
Definition at line 351 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setCancelDistance | ( | double | dCancelDist | ) |
Set the cancel distance for on-the-fly matrix computation. Distances larger than this are ignored in the interpolation.
| [in] | dCancelDist | Cancel distance in meters. |
Definition at line 267 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setColormapType | ( | const QString & | name | ) |
Set the colormap type.
| [in] | name | Colormap name ("Hot", "Jet", "Viridis", "Cool", "RedBlue"). |
Definition at line 194 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setInterpolationFunction | ( | const QString & | sInterpolationFunction | ) |
Set the interpolation function for on-the-fly matrix computation.
| [in] | sInterpolationFunction | Function name ("linear", "gaussian", "square", "cubic"). |
Definition at line 258 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setInterpolationInfoLeft | ( | const Eigen::MatrixX3f & | matVertices, |
| const QVector< QVector< int > > & | vecNeighborVertices, | ||
| const QVector< int > & | vecSourceVertices ) |
Set the surface and source geometry for the left hemisphere. Used for on-the-fly interpolation matrix computation.
| [in] | matVertices | Vertex positions (nVerts x 3). |
| [in] | vecNeighborVertices | Per-vertex neighbor index lists. |
| [in] | vecSourceVertices | Source vertex indices into the surface. |
Definition at line 276 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setInterpolationInfoRight | ( | const Eigen::MatrixX3f & | matVertices, |
| const QVector< QVector< int > > & | vecNeighborVertices, | ||
| const QVector< int > & | vecSourceVertices ) |
Set the surface and source geometry for the right hemisphere. Used for on-the-fly interpolation matrix computation.
| [in] | matVertices | Vertex positions (nVerts x 3). |
| [in] | vecNeighborVertices | Per-vertex neighbor index lists. |
| [in] | vecSourceVertices | Source vertex indices into the surface. |
Definition at line 287 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setInterpolationMatrixLeft | ( | QSharedPointer< Eigen::SparseMatrix< float > > | mat | ) |
Set the interpolation matrix for the left hemisphere.
| [in] | mat | Sparse interpolation matrix (nVerticesLH x nSourcesLH). |
Definition at line 132 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setInterpolationMatrixRight | ( | QSharedPointer< Eigen::SparseMatrix< float > > | mat | ) |
Set the interpolation matrix for the right hemisphere.
| [in] | mat | Sparse interpolation matrix (nVerticesRH x nSourcesRH). |
Definition at line 141 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setLoopState | ( | bool | enabled | ) |
Enable or disable looping (replay data when queue is exhausted).
| [in] | enabled | True to enable looping. |
Definition at line 212 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setNumberAverages | ( | int | numAvr | ) |
Set the number of samples to average before emitting.
| [in] | numAvr | Number of averages (1 = no averaging). |
Definition at line 185 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setSFreq | ( | double | sFreq | ) |
Set the sampling frequency of the incoming data.
| [in] | sFreq | Sampling frequency in Hz. |
Definition at line 221 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setStreamingState | ( | bool | state | ) |
Start or stop the streaming.
| [in] | state | True to start, false to stop. |
Definition at line 150 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setStreamSmoothedData | ( | bool | bStreamSmoothedData | ) |
Toggle between emitting interpolated color data (smoothed) and raw source values split by hemisphere.
| [in] | bStreamSmoothedData | True for smoothed colors (default), false for raw. |
Definition at line 249 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setSurfaceColor | ( | const QVector< uint32_t > & | baseColorsLh, |
| const QVector< uint32_t > & | baseColorsRh ) |
Set the base surface colors for both hemispheres. Sub-threshold vertices will display these colors (e.g., curvature or annotation coloring) instead of being transparent.
| [in] | baseColorsLh | Per-vertex ABGR colors for the left hemisphere. |
| [in] | baseColorsRh | Per-vertex ABGR colors for the right hemisphere. |
Definition at line 239 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setThresholds | ( | double | min, |
| double | mid, | ||
| double | max ) |
Set the normalization thresholds.
| [in] | min | Lower threshold. |
| [in] | mid | Mid-point threshold. |
| [in] | max | Upper threshold. |
Definition at line 203 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setTimeInterval | ( | int | msec | ) |
Set the streaming interval (time between frames).
| [in] | msec | Interval in milliseconds (default: 17ms ≈ 60fps). |
Definition at line 172 of file rtsourcedatacontroller.cpp.
| void RtSourceDataController::setVisualizationType | ( | int | iVisType | ) |
Set the visualization type (interpolation-based or annotation-based).
| [in] | iVisType | 0 = InterpolationBased, 1 = AnnotationBased. |
Definition at line 331 of file rtsourcedatacontroller.cpp.