Background worker for real-time source estimate streaming. More...
#include <rtsourcedataworker.h>
Public Slots | |
| void | streamData () |
Signals | |
| void | newRtSmoothedData (const QVector< uint32_t > &colorsLh, const QVector< uint32_t > &colorsRh) |
| void | newRtRawData (const Eigen::VectorXd &dataLh, const Eigen::VectorXd &dataRh) |
Public Member Functions | |
| RtSourceDataWorker (QObject *parent=nullptr) | |
| void | addData (const Eigen::VectorXd &data) |
| void | clear () |
| void | setInterpolationMatrixLeft (QSharedPointer< Eigen::SparseMatrix< float > > mat) |
| void | setInterpolationMatrixRight (QSharedPointer< Eigen::SparseMatrix< float > > mat) |
| 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 | setStreamSmoothedData (bool bStreamSmoothedData) |
| void | setSurfaceColor (const QVector< uint32_t > &baseColorsLh, const QVector< uint32_t > &baseColorsRh) |
Background worker for real-time source estimate streaming.
RtSourceDataWorker processes incoming source estimate data in a background thread. It manages a data queue, performs averaging, applies interpolation matrices, and converts source values to per-vertex ABGR colors for rendering.
This worker is driven by a timer in the RtSourceDataController.
Definition at line 68 of file rtsourcedataworker.h.

|
explicit |
Constructor.
| [in] | parent | Parent QObject. |
Definition at line 53 of file rtsourcedataworker.cpp.
| void RtSourceDataWorker::addData | ( | const Eigen::VectorXd & | data | ) |
Add a new source estimate data vector to the streaming queue. The vector contains source values for all sources (LH + RH concatenated).
| [in] | data | Source activity vector (nSources x 1). |
Definition at line 60 of file rtsourcedataworker.cpp.
| void RtSourceDataWorker::clear | ( | ) |
Clear all queued data.
Definition at line 81 of file rtsourcedataworker.cpp.
|
signal |
Emitted when new 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 color data is ready 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 RtSourceDataWorker::setColormapType | ( | const QString & | name | ) |
Set the colormap type used for color conversion.
| [in] | name | Colormap name ("Hot", "Jet", "Viridis", "Cool", "RedBlue"). |
Definition at line 117 of file rtsourcedataworker.cpp.
| void RtSourceDataWorker::setInterpolationMatrixLeft | ( | QSharedPointer< Eigen::SparseMatrix< float > > | mat | ) |
Set the interpolation matrix for the left hemisphere.
| [in] | mat | Sparse interpolation matrix (nVertices x nSourcesLH). |
Definition at line 93 of file rtsourcedataworker.cpp.
| void RtSourceDataWorker::setInterpolationMatrixRight | ( | QSharedPointer< Eigen::SparseMatrix< float > > | mat | ) |
Set the interpolation matrix for the right hemisphere.
| [in] | mat | Sparse interpolation matrix (nVertices x nSourcesRH). |
Definition at line 101 of file rtsourcedataworker.cpp.
| void RtSourceDataWorker::setLoopState | ( | bool | enabled | ) |
Enable or disable looping (replay from beginning when queue is exhausted).
| [in] | enabled | True to enable looping. |
Definition at line 135 of file rtsourcedataworker.cpp.
| void RtSourceDataWorker::setNumberAverages | ( | int | numAvr | ) |
Set the number of samples to average before emitting.
| [in] | numAvr | Number of averages (1 = no averaging). |
Definition at line 109 of file rtsourcedataworker.cpp.
| void RtSourceDataWorker::setSFreq | ( | double | sFreq | ) |
Set the sampling frequency of the incoming data.
| [in] | sFreq | Sampling frequency in Hz. |
Definition at line 143 of file rtsourcedataworker.cpp.
| void RtSourceDataWorker::setStreamSmoothedData | ( | bool | bStreamSmoothedData | ) |
Toggle between emitting interpolated color data (smoothed) and raw source values split by hemisphere.
When enabled (default), streamData() performs interpolation + colormap conversion and emits newRtSmoothedData(). When disabled, it emits newRtRawData() with the raw source values per hemisphere, which can be used for GPU-side interpolation.
| [in] | bStreamSmoothedData | True for smoothed colors (default), false for raw. |
Definition at line 161 of file rtsourcedataworker.cpp.
| void RtSourceDataWorker::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 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 151 of file rtsourcedataworker.cpp.
| void RtSourceDataWorker::setThresholds | ( | double | min, |
| double | mid, | ||
| double | max ) |
Set the threshold values for normalization.
| [in] | min | Lower threshold (values below are transparent). |
| [in] | mid | Mid-point threshold (fade-in range). |
| [in] | max | Upper threshold (values above are clamped). |
Definition at line 125 of file rtsourcedataworker.cpp.
|
slot |
Stream one frame of data. Called by the controller's timer. Pops data from the queue, averages, interpolates, and emits per-vertex colors.
Definition at line 169 of file rtsourcedataworker.cpp.