Background worker for real-time sensor data streaming. More...
#include <rtsensordataworker.h>
Public Slots | |
| void | streamData () |
Signals | |
| void | newRtSensorColors (const QString &surfaceKey, const QVector< uint32_t > &colors) |
| void | newRtRawSensorData (const Eigen::VectorXf &data) |
Public Member Functions | |
| RtSensorDataWorker (QObject *parent=nullptr) | |
| void | addData (const Eigen::VectorXf &data) |
| void | clear () |
| void | setMappingMatrix (QSharedPointer< Eigen::MatrixXf > mat) |
| void | setNumberAverages (int numAvr) |
| void | setColormapType (const QString &name) |
| void | setThresholds (double min, double max) |
| void | setLoopState (bool enabled) |
| void | setSFreq (double sFreq) |
| void | setStreamSmoothedData (bool bStreamSmoothedData) |
Background worker for real-time sensor data streaming.
RtSensorDataWorker processes incoming sensor measurement data in a background thread. It manages a data queue, performs averaging, applies a dense mapping matrix (MEG or EEG sensor → surface vertex), normalises values symmetrically, and converts them to per-vertex ABGR colours for rendering.
This worker is driven by a timer in the RtSensorDataController and follows the same architecture as RtSourceDataWorker, adapted for dense sensor-to-surface mapping instead of sparse source interpolation.
Definition at line 70 of file rtsensordataworker.h.

|
explicit |
Constructor.
| [in] | parent | Parent QObject. |
Definition at line 53 of file rtsensordataworker.cpp.
| void RtSensorDataWorker::addData | ( | const Eigen::VectorXf & | data | ) |
Add a new sensor measurement vector to the streaming queue. The vector contains one measurement per picked sensor channel.
| [in] | data | Sensor measurement vector (nChannels x 1). |
Definition at line 60 of file rtsensordataworker.cpp.
| void RtSensorDataWorker::clear | ( | ) |
Clear all queued data and reset averaging state.
Definition at line 81 of file rtsensordataworker.cpp.
|
signal |
Emitted when raw (non-mapped) sensor data is available.
| [in] | data | Raw sensor measurement vector. |
|
signal |
Emitted when new per-vertex color data is ready for rendering.
| [in] | surfaceKey | Surface key identifying the target surface. |
| [in] | colors | Per-vertex ABGR color array. |
| void RtSensorDataWorker::setColormapType | ( | const QString & | name | ) |
Set the colormap type used for color conversion.
| [in] | name | Colormap name ("MNE", "Hot", "Jet", "Viridis", "Cool", "RedBlue"). |
Definition at line 109 of file rtsensordataworker.cpp.
| void RtSensorDataWorker::setLoopState | ( | bool | enabled | ) |
Enable or disable looping (replay from beginning when queue is exhausted).
| [in] | enabled | True to enable looping. |
Definition at line 133 of file rtsensordataworker.cpp.
| void RtSensorDataWorker::setMappingMatrix | ( | QSharedPointer< Eigen::MatrixXf > | mat | ) |
Set the dense mapping matrix (sensor → surface vertices). This matrix is typically produced by FieldMap::computeMegMapping() or computeEegMapping(). Size: (nVertices × nChannels).
| [in] | mat | Dense mapping matrix. |
Definition at line 93 of file rtsensordataworker.cpp.
| void RtSensorDataWorker::setNumberAverages | ( | int | numAvr | ) |
Set the number of samples to average before emitting.
| [in] | numAvr | Number of averages (1 = no averaging). |
Definition at line 101 of file rtsensordataworker.cpp.
| void RtSensorDataWorker::setSFreq | ( | double | sFreq | ) |
Set the sampling frequency of the incoming data.
| [in] | sFreq | Sampling frequency in Hz. |
Definition at line 141 of file rtsensordataworker.cpp.
| void RtSensorDataWorker::setStreamSmoothedData | ( | bool | bStreamSmoothedData | ) |
Toggle between emitting per-vertex color data (smoothed) and raw sensor values.
When enabled (default), streamData() performs mapping + normalization + color conversion and emits newRtSensorColors(). When disabled, it emits newRtRawSensorData() with the raw measurement vector, which can be used for GPU-side mapping.
| [in] | bStreamSmoothedData | True for smoothed colors (default), false for raw. |
Definition at line 149 of file rtsensordataworker.cpp.
| void RtSensorDataWorker::setThresholds | ( | double | min, |
| double | max ) |
Set explicit normalization thresholds instead of auto-normalization. When set, the symmetric auto-normalization is replaced by fixed thresholds. Values below min are mapped to 0, above max to 1.
Pass min == 0 and max == 0 to re-enable auto-normalization.
| [in] | min | Lower threshold (values below are at colormap start). |
| [in] | max | Upper threshold (values above are at colormap end). |
Definition at line 117 of file rtsensordataworker.cpp.
|
slot |
Stream one frame of data. Called by the controller's timer. Pops data from the queue, averages, maps to surface, normalises symmetrically, and emits per-vertex colors.
Definition at line 157 of file rtsensordataworker.cpp.