v2.0.0
Loading...
Searching...
No Matches
RTPROCESSINGLIB::RtAveragingWorker Class Reference

Background worker thread that accumulates and averages epochs in real time. More...

#include <rt_averaging.h>

Signals

void resultReady (const FIFFLIB::FiffEvokedSet &evokedStimSet, const QStringList &lResponsibleTriggerTypes)

Public Member Functions

 RtAveragingWorker (quint32 numAverages, quint32 iPreStimSamples, quint32 iPostStimSamples, quint32 iBaselineFromMSecs, quint32 iBaselineToMSecs, quint32 iTriggerIndex, FIFFLIB::FiffInfo::SPtr pFiffInfo)
void doWork (const Eigen::MatrixXd &matData)
void setAverageNumber (qint32 numAve)
void setPreStim (qint32 samples, qint32 secs)
void setPostStim (qint32 samples, qint32 secs)
void setTriggerChIndx (qint32 idx)
void setArtifactReduction (const QMap< QString, double > &mapThresholds)
void setBaselineActive (bool activate)
void setBaselineFrom (int fromSamp, int fromMSec)
void setBaselineTo (int toSamp, int toMSec)
void reset ()

Protected Member Functions

void doAveraging (const Eigen::MatrixXd &rawSegment)
void fillFrontBuffer (const Eigen::MatrixXd &data, double dTriggerType)
void emitEvoked (double dTriggerType, QStringList &lResponsibleTriggerTypes)
void fillBackBuffer (const Eigen::MatrixXd &data, double dTriggerType)
void mergeData (double dTriggerType)
void generateEvoked (double dTriggerType)
bool controlValuesChanged ()

Protected Attributes

qint32 m_iNumAverages
qint32 m_iPreStimSamples
qint32 m_iNewPreStimSamples
qint32 m_iPostStimSamples
qint32 m_iNewPostStimSamples
qint32 m_iTriggerChIndex
qint32 m_iNewTriggerIndex
float m_fTriggerThreshold
bool m_bActivateThreshold
bool m_bDoBaselineCorrection
QPair< float, float > m_pairBaselineSec
QPair< float, float > m_pairBaselineSamp
FIFFLIB::FiffInfo::SPtr m_pFiffInfo
FIFFLIB::FiffEvokedSet m_stimEvokedSet
QMap< QString, double > m_mapThresholds
QMap< double, QList< Eigen::MatrixXd > > m_mapStimAve
QMap< double, Eigen::MatrixXd > m_mapDataPre
QMap< double, Eigen::MatrixXd > m_mapDataPost
QMap< double, qint32 > m_mapMatDataPostIdx
QMap< double, bool > m_mapFillingBackBuffer

Detailed Description

Background worker thread that accumulates and averages epochs in real time.

Real-time averaging worker

Definition at line 76 of file rt_averaging.h.

Inheritance diagram for RTPROCESSINGLIB::RtAveragingWorker:
Inheritance graph

Constructor & Destructor Documentation

◆ RtAveragingWorker()

RtAveragingWorker::RtAveragingWorker ( quint32 numAverages,
quint32 iPreStimSamples,
quint32 iPostStimSamples,
quint32 iBaselineFromMSecs,
quint32 iBaselineToMSecs,
quint32 iTriggerIndex,
FIFFLIB::FiffInfo::SPtr pFiffInfo )

Creates the real-time averaging object.

Parameters
[in]numAveragesNumber of evkos to average.
[in]iPreStimSamplesNumber of samples averaged before the stimulus.
[in]iPostStimSamplesNumber of samples averaged after the stimulus (including the stimulus).
[in]iBaselineFromMSecsStart of baseline area which was/is used for correction in msecs.
[in]iBaselineToMSecsEnd of baseline area which was/is used for correction in msecs.
[in]iTriggerIndexRow in dex of channel which is to be scanned for triggers.
[in]pFiffInfoAssociated Fiff Information.

Definition at line 49 of file rt_averaging.cpp.

Member Function Documentation

◆ controlValuesChanged()

bool RTPROCESSINGLIB::RtAveragingWorker::controlValuesChanged ( )
inlineprotected

Check if control values have been changed

Returns
True if pre-stimulus samples, post-stimulus samples or trigger channel index differ from their pending new values.

Definition at line 477 of file rt_averaging.h.

◆ doAveraging()

void RtAveragingWorker::doAveraging ( const Eigen::MatrixXd & rawSegment)
protected

do the actual averaging here.

Parameters
[in]rawSegmentIncoming data block (n_channels × n_samples) scanned for triggers and averaged.

Definition at line 209 of file rt_averaging.cpp.

◆ doWork()

void RtAveragingWorker::doWork ( const Eigen::MatrixXd & matData)

Perform one averaging step on new incoming data.

Parameters
[in]matDataData to average.

Definition at line 83 of file rt_averaging.cpp.

◆ emitEvoked()

void RtAveragingWorker::emitEvoked ( double dTriggerType,
QStringList & lResponsibleTriggerTypes )
protected

Definition at line 317 of file rt_averaging.cpp.

◆ fillBackBuffer()

void RtAveragingWorker::fillBackBuffer ( const Eigen::MatrixXd & data,
double dTriggerType )
protected

Prepends incoming data to back/post stim buffer.

Parameters
[in]dataIncoming data block (n_channels × n_samples); excess columns beyond the post-stimulus length are dropped.
[in]dTriggerTypeTrigger type whose post-stimulus buffer is filled.

Definition at line 340 of file rt_averaging.cpp.

◆ fillFrontBuffer()

void RtAveragingWorker::fillFrontBuffer ( const Eigen::MatrixXd & data,
double dTriggerType )
protected

Prepends incoming data to front/pre stim buffer.

Parameters
[in]dataIncoming data block (n_channels × n_samples).
[in]dTriggerTypeTrigger type whose pre-stimulus buffer is updated (-1.0 for the shared buffer).

Definition at line 355 of file rt_averaging.cpp.

◆ generateEvoked()

void RtAveragingWorker::generateEvoked ( double dTriggerType)
protected

Generates the final evoke variable.

Parameters
[in]dTriggerTypeTrigger type whose stored epochs are averaged into the evoked response.

Definition at line 434 of file rt_averaging.cpp.

◆ mergeData()

void RtAveragingWorker::mergeData ( double dTriggerType)
protected

Packs the buffers togehter as one and calcualtes the current running average and emits the result if number of averages has been reached.

Parameters
[in]dTriggerTypeTrigger type whose pre- and post-stimulus buffers are merged.

Definition at line 396 of file rt_averaging.cpp.

◆ reset()

void RtAveragingWorker::reset ( )

Resets the averaged data stored.

Definition at line 499 of file rt_averaging.cpp.

◆ resultReady

void RTPROCESSINGLIB::RtAveragingWorker::resultReady ( const FIFFLIB::FiffEvokedSet & evokedStimSet,
const QStringList & lResponsibleTriggerTypes )
signal

Signal which is emitted when new evoked stimulus data are available.

Parameters
[in]evokedStimSetThe evoked stimulus data set.
[in]lResponsibleTriggerTypesList of all trigger types which lead to the recent emit of a new evoked set.

◆ setArtifactReduction()

void RtAveragingWorker::setArtifactReduction ( const QMap< QString, double > & mapThresholds)

Sets the artifact reduction

Parameters
[in]mapThresholdsThe new map including the current thresholds for the channels.

Definition at line 153 of file rt_averaging.cpp.

◆ setAverageNumber()

void RtAveragingWorker::setAverageNumber ( qint32 numAve)

Sets the number of averages

Parameters
[in]numAvenew number of averages.

Definition at line 98 of file rt_averaging.cpp.

◆ setBaselineActive()

void RtAveragingWorker::setBaselineActive ( bool activate)

Sets the baseline correction on or off

Parameters
[in]activateactivate baseline correction.

Definition at line 166 of file rt_averaging.cpp.

◆ setBaselineFrom()

void RtAveragingWorker::setBaselineFrom ( int fromSamp,
int fromMSec )

Sets the from mSeconds of the baseline area

Parameters
[in]fromSampfrom of baseline area in samples.
[in]fromMSecfrom of baseline area in mSeconds.

Definition at line 183 of file rt_averaging.cpp.

◆ setBaselineTo()

void RtAveragingWorker::setBaselineTo ( int toSamp,
int toMSec )

Sets the to mSeconds of the baseline area

Parameters
[in]toSampto of baseline area in samples.
[in]toMSecto of baseline area in mSeconds.

Definition at line 196 of file rt_averaging.cpp.

◆ setPostStim()

void RtAveragingWorker::setPostStim ( qint32 samples,
qint32 secs )

Sets the number of post stimulus samples

Parameters
[in]samplesnew number of post stimulus samples.
[in]secsnew number of pre stimulus seconds.

Definition at line 137 of file rt_averaging.cpp.

◆ setPreStim()

void RtAveragingWorker::setPreStim ( qint32 samples,
qint32 secs )

Sets the number of pre stimulus samples

Parameters
[in]samplesnew number of pre stimulus samples.
[in]secsnew number of pre stimulus seconds.

Definition at line 128 of file rt_averaging.cpp.

◆ setTriggerChIndx()

void RtAveragingWorker::setTriggerChIndx ( qint32 idx)

Sets the index of the trigger channel which is to be scanned fo triggers

Parameters
[in]idxtrigger channel index.

Definition at line 146 of file rt_averaging.cpp.

Member Data Documentation

◆ m_bActivateThreshold

bool RTPROCESSINGLIB::RtAveragingWorker::m_bActivateThreshold
protected

Whether to do threshold artifact reduction or not.

Definition at line 256 of file rt_averaging.h.

◆ m_bDoBaselineCorrection

bool RTPROCESSINGLIB::RtAveragingWorker::m_bDoBaselineCorrection
protected

Whether to perform baseline correction.

Definition at line 258 of file rt_averaging.h.

◆ m_fTriggerThreshold

float RTPROCESSINGLIB::RtAveragingWorker::m_fTriggerThreshold
protected

Threshold to detect trigger.

Definition at line 254 of file rt_averaging.h.

◆ m_iNewPostStimSamples

qint32 RTPROCESSINGLIB::RtAveragingWorker::m_iNewPostStimSamples
protected

New amount of samples averaged after the stimulus, including the stimulus sample.

Definition at line 249 of file rt_averaging.h.

◆ m_iNewPreStimSamples

qint32 RTPROCESSINGLIB::RtAveragingWorker::m_iNewPreStimSamples
protected

New amount of samples averaged before the stimulus.

Definition at line 246 of file rt_averaging.h.

◆ m_iNewTriggerIndex

qint32 RTPROCESSINGLIB::RtAveragingWorker::m_iNewTriggerIndex
protected

Old row index of the data matrix which is to be scanned for triggers.

Definition at line 252 of file rt_averaging.h.

◆ m_iNumAverages

qint32 RTPROCESSINGLIB::RtAveragingWorker::m_iNumAverages
protected

Number of averages.

Definition at line 243 of file rt_averaging.h.

◆ m_iPostStimSamples

qint32 RTPROCESSINGLIB::RtAveragingWorker::m_iPostStimSamples
protected

Amount of samples averaged after the stimulus, including the stimulus sample.

Definition at line 248 of file rt_averaging.h.

◆ m_iPreStimSamples

qint32 RTPROCESSINGLIB::RtAveragingWorker::m_iPreStimSamples
protected

Amount of samples averaged before the stimulus.

Definition at line 245 of file rt_averaging.h.

◆ m_iTriggerChIndex

qint32 RTPROCESSINGLIB::RtAveragingWorker::m_iTriggerChIndex
protected

Current row index of the data matrix which is to be scanned for triggers.

Definition at line 251 of file rt_averaging.h.

◆ m_mapDataPost

QMap<double, Eigen::MatrixXd> RTPROCESSINGLIB::RtAveragingWorker::m_mapDataPost
protected

The matrix holding post stim data.

Definition at line 269 of file rt_averaging.h.

◆ m_mapDataPre

QMap<double, Eigen::MatrixXd> RTPROCESSINGLIB::RtAveragingWorker::m_mapDataPre
protected

The matrix holding pre stim data.

Definition at line 268 of file rt_averaging.h.

◆ m_mapFillingBackBuffer

QMap<double, bool> RTPROCESSINGLIB::RtAveragingWorker::m_mapFillingBackBuffer
protected

Whether the back buffer is currently getting filled.

Definition at line 271 of file rt_averaging.h.

◆ m_mapMatDataPostIdx

QMap<double, qint32> RTPROCESSINGLIB::RtAveragingWorker::m_mapMatDataPostIdx
protected

Current index inside of the matrix m_matDataPost.

Definition at line 270 of file rt_averaging.h.

◆ m_mapStimAve

QMap<double, QList<Eigen::MatrixXd> > RTPROCESSINGLIB::RtAveragingWorker::m_mapStimAve
protected

the current stimulus average buffer. Holds m_iNumAverages vectors.

Definition at line 267 of file rt_averaging.h.

◆ m_mapThresholds

QMap<QString, double> RTPROCESSINGLIB::RtAveragingWorker::m_mapThresholds
protected

Holds the current thresholds for artifact rejection.

Definition at line 266 of file rt_averaging.h.

◆ m_pairBaselineSamp

QPair<float, float> RTPROCESSINGLIB::RtAveragingWorker::m_pairBaselineSamp
protected

Baseline information in samples form where the seconds are seen relative to the trigger, meaning they can also be negative [from to]

Definition at line 261 of file rt_averaging.h.

◆ m_pairBaselineSec

QPair<float, float> RTPROCESSINGLIB::RtAveragingWorker::m_pairBaselineSec
protected

Baseline information in seconds form where the seconds are seen relative to the trigger, meaning they can also be negative [from to]

Definition at line 260 of file rt_averaging.h.

◆ m_pFiffInfo

FIFFLIB::FiffInfo::SPtr RTPROCESSINGLIB::RtAveragingWorker::m_pFiffInfo
protected

Holds the fiff measurement information.

Definition at line 263 of file rt_averaging.h.

◆ m_stimEvokedSet

FIFFLIB::FiffEvokedSet RTPROCESSINGLIB::RtAveragingWorker::m_stimEvokedSet
protected

Holds the evoked information.

Definition at line 264 of file rt_averaging.h.


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