v2.0.0
Loading...
Searching...
No Matches
DISP3DRHILIB::RtSensorDataWorker Class Reference

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)

Detailed Description

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.

Inheritance diagram for DISP3DRHILIB::RtSensorDataWorker:
Inheritance graph

Constructor & Destructor Documentation

◆ RtSensorDataWorker()

RtSensorDataWorker::RtSensorDataWorker ( QObject * parent = nullptr)
explicit

Constructor.

Parameters
[in]parentParent QObject.

Definition at line 53 of file rtsensordataworker.cpp.

Member Function Documentation

◆ addData()

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.

Parameters
[in]dataSensor measurement vector (nChannels x 1).

Definition at line 60 of file rtsensordataworker.cpp.

◆ clear()

void RtSensorDataWorker::clear ( )

Clear all queued data and reset averaging state.

Definition at line 81 of file rtsensordataworker.cpp.

◆ newRtRawSensorData

void DISP3DRHILIB::RtSensorDataWorker::newRtRawSensorData ( const Eigen::VectorXf & data)
signal

Emitted when raw (non-mapped) sensor data is available.

Parameters
[in]dataRaw sensor measurement vector.

◆ newRtSensorColors

void DISP3DRHILIB::RtSensorDataWorker::newRtSensorColors ( const QString & surfaceKey,
const QVector< uint32_t > & colors )
signal

Emitted when new per-vertex color data is ready for rendering.

Parameters
[in]surfaceKeySurface key identifying the target surface.
[in]colorsPer-vertex ABGR color array.

◆ setColormapType()

void RtSensorDataWorker::setColormapType ( const QString & name)

Set the colormap type used for color conversion.

Parameters
[in]nameColormap name ("MNE", "Hot", "Jet", "Viridis", "Cool", "RedBlue").

Definition at line 109 of file rtsensordataworker.cpp.

◆ setLoopState()

void RtSensorDataWorker::setLoopState ( bool enabled)

Enable or disable looping (replay from beginning when queue is exhausted).

Parameters
[in]enabledTrue to enable looping.

Definition at line 133 of file rtsensordataworker.cpp.

◆ setMappingMatrix()

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).

Parameters
[in]matDense mapping matrix.

Definition at line 93 of file rtsensordataworker.cpp.

◆ setNumberAverages()

void RtSensorDataWorker::setNumberAverages ( int numAvr)

Set the number of samples to average before emitting.

Parameters
[in]numAvrNumber of averages (1 = no averaging).

Definition at line 101 of file rtsensordataworker.cpp.

◆ setSFreq()

void RtSensorDataWorker::setSFreq ( double sFreq)

Set the sampling frequency of the incoming data.

Parameters
[in]sFreqSampling frequency in Hz.

Definition at line 141 of file rtsensordataworker.cpp.

◆ setStreamSmoothedData()

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.

Parameters
[in]bStreamSmoothedDataTrue for smoothed colors (default), false for raw.

Definition at line 149 of file rtsensordataworker.cpp.

◆ setThresholds()

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.

Parameters
[in]minLower threshold (values below are at colormap start).
[in]maxUpper threshold (values above are at colormap end).

Definition at line 117 of file rtsensordataworker.cpp.

◆ streamData

void RtSensorDataWorker::streamData ( )
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.


The documentation for this class was generated from the following files: