v2.0.0
Loading...
Searching...
No Matches
RTPROCESSINGLIB Namespace Reference

Real-time signal processing (filtering, averaging, HPI fitting, noise reduction). More...

Classes

struct  FilterObject
class  FilterOverlapAdd
 Filtering with FFT convolution and the overlap add method for continous data streams. More...
class  CosineFilter
 Creates a cosine filter response in the frequency domain. More...
class  FilterIO
 Processes txt files which hold filter coefficients. More...
class  FilterParameter
 The FilterParameter class. More...
class  FilterKernel
 The FilterKernel class provides methods to create/design a FIR filter kernel. More...
class  ParksMcClellan
 The ParksMcClellan class provides the ParksMcClellan filter desing algorithm. More...
class  RtAveragingWorker
 Real-time averaging worker. More...
class  RtAveraging
 Real-time averaging. More...
class  RtConnectivityWorker
 Real-time connectivity worker. More...
class  RtConnectivity
 Real-time connectivity estimation. More...
struct  RtCovComputeResult
class  RtCov
 Real-time covariance worker. More...
class  RtHpiWorker
 Real-time HPI worker. More...
class  RtHpi
 Real-time Head Coil Positions estimation. More...
struct  RtInvOpInput
class  RtInvOpWorker
 Real-time inverse operator worker. More...
class  RtInvOp
 Real-time inverse operator estimation. More...
class  RtNoise
 Real-time Noise estimation. More...

Functions

FIFFLIB::FiffEvoked computeAverage (const FIFFLIB::FiffRawData &raw, const Eigen::MatrixXi &matEvents, float fTMinS, float fTMaxS, qint32 eventType, bool bApplyBaseline, float fTBaselineFromS, float fTBaselineToS, const QMap< QString, double > &mapReject, const QStringList &lExcludeChs=QStringList(), const Eigen::RowVectorXi &vecPicks=Eigen::RowVectorXi())
FIFFLIB::FiffEvoked computeFilteredAverage (const FIFFLIB::FiffRawData &raw, const Eigen::MatrixXi &matEvents, float fTMinS, float fTMaxS, qint32 eventType, bool bApplyBaseline, float fTBaselineFromS, float fTBaselineToS, const QMap< QString, double > &mapReject, const FilterKernel &filterKernel, const QStringList &lExcludeChs=QStringList(), const Eigen::RowVectorXi &vecPicks=Eigen::RowVectorXi())
QList< Eigen::MatrixXi > toEventMatrix (QMap< int, QList< QPair< int, double > > > mapTriggers)
QMap< int, QList< QPair< int, double > > > detectTriggerFlanksMax (const Eigen::MatrixXd &data, const QList< int > &lTriggerChannels, int iOffsetIndex, double dThreshold, bool bRemoveOffset, int iBurstLengthSamp=100)
QList< QPair< int, double > > detectTriggerFlanksMax (const Eigen::MatrixXd &data, int iTriggerChannelIdx, int iOffsetIndex, double dThreshold, bool bRemoveOffset, int iBurstLengthSamp=100)
QMap< int, QList< QPair< int, double > > > detectTriggerFlanksGrad (const Eigen::MatrixXd &data, const QList< int > &lTriggerChannels, int iOffsetIndex, double dThreshold, bool bRemoveOffset, const QString &type, int iBurstLengthSamp=100)
QList< QPair< int, double > > detectTriggerFlanksGrad (const Eigen::MatrixXd &data, int iTriggerChannelIdx, int iOffsetIndex, double dThreshold, bool bRemoveOffset, const QString &type, int iBurstLengthSamp=100)
bool filterFile (QIODevice &pIODevice, QSharedPointer< FIFFLIB::FiffRawData > pFiffRawData, int type, double dCenterfreq, double dBandwidth, double dTransition, double dSFreq, int iOrder=4096, int designMethod=FilterKernel::m_designMethods.indexOf(FilterParameter("Cosine")), const Eigen::RowVectorXi &vecPicks=Eigen::RowVectorXi(), bool bUseThreads=true)
bool filterFile (QIODevice &pIODevice, QSharedPointer< FIFFLIB::FiffRawData > pFiffRawData, const RTPROCESSINGLIB::FilterKernel &filterKernel, const Eigen::RowVectorXi &vecPicks=Eigen::RowVectorXi(), bool bUseThreads=false)
Eigen::MatrixXd filterData (const Eigen::MatrixXd &matData, int type, double dCenterfreq, double dBandwidth, double dTransition, double dSFreq, int iOrder=1024, int designMethod=FilterKernel::m_designMethods.indexOf(FilterParameter("Cosine")), const Eigen::RowVectorXi &vecPicks=Eigen::RowVectorXi(), bool bUseThreads=true, bool bKeepOverhead=false)
Eigen::MatrixXd filterData (const Eigen::MatrixXd &mataData, const RTPROCESSINGLIB::FilterKernel &filterKernel, const Eigen::RowVectorXi &vecPicks=Eigen::RowVectorXi(), bool bUseThreads=true, bool bKeepOverhead=false)
Eigen::MatrixXd filterDataBlock (const Eigen::MatrixXd &mataData, const Eigen::RowVectorXi &vecPicks, const RTPROCESSINGLIB::FilterKernel &filterKernel, bool bUseThreads=true)
void filterChannel (FilterObject &channelDataTime)
bool performIcp (const QSharedPointer< MNELIB::MNEProjectToSurface > mneSurfacePoints, const Eigen::MatrixXf &matPointCloud, FIFFLIB::FiffCoordTrans &transFromTo, float &fRMSE, bool bScale=false, int iMaxIter=20, float fTol=0.001, const Eigen::VectorXf &vecWeitgths=vecDefaultWeigths)
bool fitMatchedPoints (const Eigen::MatrixXf &matSrcPoint, const Eigen::MatrixXf &matDstPoint, Eigen::Matrix4f &matTrans, float fScale=1.0, bool bScale=false, const Eigen::VectorXf &vecWeitgths=vecDefaultWeigths)
bool discard3DPointOutliers (const QSharedPointer< MNELIB::MNEProjectToSurface > mneSurfacePoints, const Eigen::MatrixXf &matPointCloud, const FIFFLIB::FiffCoordTrans &transFromTo, Eigen::VectorXi &vecTake, Eigen::MatrixXf &matTakePoint, float fMaxDist=0.0)
const char * buildDateTime ()
const char * buildHash ()
const char * buildHashLong ()
Eigen::MatrixXd makeSpharaProjector (const Eigen::MatrixXd &matBaseFct, const Eigen::VectorXi &vecIndices, int iOperatorDim, int iNBaseFct, int iSkip=0)

Variables

const Eigen::VectorXf vecDefaultWeigths

Detailed Description

Real-time signal processing (filtering, averaging, HPI fitting, noise reduction).

Function Documentation

◆ buildDateTime()

const char * RTPROCESSINGLIB::buildDateTime ( )

Returns build date and time.

Definition at line 46 of file rtprocessing_global.cpp.

◆ buildHash()

const char * RTPROCESSINGLIB::buildHash ( )

Returns abbreviated build git hash.

Definition at line 50 of file rtprocessing_global.cpp.

◆ buildHashLong()

const char * RTPROCESSINGLIB::buildHashLong ( )

Returns full build git hash.

Definition at line 54 of file rtprocessing_global.cpp.

◆ computeAverage()

FIFFLIB::FiffEvoked RTPROCESSINGLIB::computeAverage ( const FIFFLIB::FiffRawData & raw,
const Eigen::MatrixXi & matEvents,
float fTMinS,
float fTMaxS,
qint32 eventType,
bool bApplyBaseline,
float fTBaselineFromS,
float fTBaselineToS,
const QMap< QString, double > & mapReject,
const QStringList & lExcludeChs = QStringList(),
const Eigen::RowVectorXi & vecPicks = Eigen::RowVectorXi() )

Computes the average for given fiff raw data.

Parameters
[in]rawThe raw data.
[in]matEventsThe events provided in samples and event kinds.
[in]fTMinSThe start time relative to the event in seconds.
[in]fTMaxSThe end time relative to the event in seconds.
[in]eventTypeThe event type.
[in]bApplyBaselineWhether to use baseline correction (mode=mean).
[in]fTBaselineFromSThe start baseline correction time relative to the event in seconds.
[in]fTBaselineToSThe end baseline correction time relative to the event in seconds.
[in]mapRejectThe thresholds per channel type to reject epochs.
[in]lExcludeChsList of channel names to exclude.
[in]vecPicksWhich channels to pick.

◆ computeFilteredAverage()

FIFFLIB::FiffEvoked RTPROCESSINGLIB::computeFilteredAverage ( const FIFFLIB::FiffRawData & raw,
const Eigen::MatrixXi & matEvents,
float fTMinS,
float fTMaxS,
qint32 eventType,
bool bApplyBaseline,
float fTBaselineFromS,
float fTBaselineToS,
const QMap< QString, double > & mapReject,
const FilterKernel & filterKernel,
const QStringList & lExcludeChs = QStringList(),
const Eigen::RowVectorXi & vecPicks = Eigen::RowVectorXi() )

Computes the filtered average for given fiff raw data.

Parameters
[in]rawThe raw data.
[in]matEventsThe events provided in samples and event kinds.
[in]fTMinSThe start time relative to the event in seconds.
[in]fTMaxSThe end time relative to the event in seconds.
[in]eventTypeThe event type.
[in]bApplyBaselineWhether to use baseline correction (mode=mean).
[in]fTBaselineFromSThe start baseline correction time relative to the event in seconds.
[in]fTBaselineToSThe end baseline correction time relative to the event in seconds.
[in]filterKernelThe filter kernel to use when reading the fiff raw data.
[in]mapRejectThe thresholds per channel type to reject epochs.
[in]lExcludeChsList of channel names to exclude.
[in]vecPicksWhich channels to pick.

◆ detectTriggerFlanksGrad() [1/2]

QMap< int, QList< QPair< int, double > > > RTPROCESSINGLIB::detectTriggerFlanksGrad ( const Eigen::MatrixXd & data,
const QList< int > & lTriggerChannels,
int iOffsetIndex,
double dThreshold,
bool bRemoveOffset,
const QString & type,
int iBurstLengthSamp = 100 )

detectTriggerFlanksGrad detects flanks from a given data matrix in row wise order. This function uses a simple gradient to locate the triggers.

Parameters
[in]datathe data used to find the trigger flanks.
[in]lTriggerChannelsThe indeces of the trigger channels.
[in]iOffsetIndexthe offset index gets added to the found trigger flank index.
[in]iThresholdthe gradient threshold value used to find the trigger flank.
[in]bRemoveOffsetremove the first sample as offset.
[in]typedetect rising or falling flank. Use "Rising" or "Falling" as input.
[in]iBurstLengthMsThe length in samples which is skipped after a trigger was found.
Returns
This map holds the indices of the channels which are to be read from data. For each index/channel the found triggers and corresponding signal values are written to the value of the map.

◆ detectTriggerFlanksGrad() [2/2]

QList< QPair< int, double > > RTPROCESSINGLIB::detectTriggerFlanksGrad ( const Eigen::MatrixXd & data,
int iTriggerChannelIdx,
int iOffsetIndex,
double dThreshold,
bool bRemoveOffset,
const QString & type,
int iBurstLengthSamp = 100 )

detectTriggerFlanksGrad detects flanks from a given data matrix in row wise order. This function uses a simple gradient to locate the triggers.

Parameters
[in]datathe data used to find the trigger flanks.
[in]iTriggerChannelIdxthe index of the trigger channel in the matrix.
[in]iOffsetIndexthe offset index gets added to the found trigger flank index.
[in]iThresholdthe gradient threshold value used to find the trigger flank.
[in]bRemoveOffsetremove the first sample as offset.
[in]typedetect rising or falling flank. Use "Rising" or "Falling" as input.
[in]iBurstLengthMsThe length in samples which is skipped after a trigger was found.
Returns
This list holds the found trigger indices and corresponding signal values.

◆ detectTriggerFlanksMax() [1/2]

QMap< int, QList< QPair< int, double > > > RTPROCESSINGLIB::detectTriggerFlanksMax ( const Eigen::MatrixXd & data,
const QList< int > & lTriggerChannels,
int iOffsetIndex,
double dThreshold,
bool bRemoveOffset,
int iBurstLengthSamp = 100 )

detectTriggerFlanks detects flanks from a given data matrix in row wise order. This function uses a simple maxCoeff function implemented by eigen to locate the triggers.

Parameters
[in]datathe data used to find the trigger flanks.
[in]lTriggerChannelsThe indeces of the trigger channels.
[in]iOffsetIndexthe offset index gets added to the found trigger flank index.
[in]dThresholdthe signal threshold value used to find the trigger flank.
[in]bRemoveOffsetremove the first sample as offset.
[in]iBurstLengthMsThe length in samples which is skipped after a trigger was found.
Returns
This map holds the indices of the channels which are to be read from data. For each index/channel the found triggersand corresponding signal values are written to the value of the map.

◆ detectTriggerFlanksMax() [2/2]

QList< QPair< int, double > > RTPROCESSINGLIB::detectTriggerFlanksMax ( const Eigen::MatrixXd & data,
int iTriggerChannelIdx,
int iOffsetIndex,
double dThreshold,
bool bRemoveOffset,
int iBurstLengthSamp = 100 )

detectTriggerFlanks detects flanks from a given data matrix in row wise order. This function uses a simple maxCoeff function implemented by eigen to locate the triggers.

Parameters
[in]datathe data used to find the trigger flanks.
[in]iTriggerChannelIdxthe index of the trigger channel in the matrix.
[in]iOffsetIndexthe offset index gets added to the found trigger flank index.
[in]dThresholdthe signal threshold value used to find the trigger flank.
[in]bRemoveOffsetremove the first sample as offset.
[in]iBurstLengthMsThe length in samples which is skipped after a trigger was found.
Returns
This list holds the found trigger indices and corresponding signal values.

◆ discard3DPointOutliers()

bool RTPROCESSINGLIB::discard3DPointOutliers ( const QSharedPointer< MNELIB::MNEProjectToSurface > mneSurfacePoints,
const Eigen::MatrixXf & matPointCloud,
const FIFFLIB::FiffCoordTrans & transFromTo,
Eigen::VectorXi & vecTake,
Eigen::MatrixXf & matTakePoint,
float fMaxDist = 0.0 )

Discard outliers compared to a given 3D surface

Parameters
[in]mneSurfacePointsThe MNEProjectToSurface object that contains the surface triangles etc. (To).
[in]matPointCloudThe destination point set to be registrated (From).
[in,out]transFromToThe forward transformation matrix.
[in]vecTakeThe index of taken digitizers.
[in]matTakePointThe the digitizer points to take.
[in]fMaxDistThe maximum distance to the surface in mm, defaults to 0 mm.
Returns
Wether the discarding was succesfull.

◆ filterChannel()

void RTPROCESSINGLIB::filterChannel ( RTPROCESSINGLIB::FilterObject & channelDataTime)

This function is used to filter row-wise in parallel threads

Parameters
[in]channelDataTimeThe channel data to perform the filtering on.

Definition at line 376 of file filter.cpp.

◆ filterData() [1/2]

Eigen::MatrixXd RTPROCESSINGLIB::filterData ( const Eigen::MatrixXd & mataData,
const RTPROCESSINGLIB::FilterKernel & filterKernel,
const Eigen::RowVectorXi & vecPicks = Eigen::RowVectorXi(),
bool bUseThreads = true,
bool bKeepOverhead = false )

Calculates the filtered version of the raw input data based on a given list filters The data needs to be present all at once. For continous filtering via overlap add use the FilterOverlapAdd class.

Parameters
[in]mataDataThe data which is to be filtered.
[in]filterKernelThe list of filter kernels to use.
[in]vecPicksChannel indexes to filter. Default is filter all channels.
[in]bUseThreadsWhether to use multiple threads. Default is set to true.
[in]bKeepOverheadWhether to keep the delayed part of the data after filtering. Default is set to false .
Returns
The filtered data in form of a matrix.

◆ filterData() [2/2]

Eigen::MatrixXd RTPROCESSINGLIB::filterData ( const Eigen::MatrixXd & matData,
int type,
double dCenterfreq,
double dBandwidth,
double dTransition,
double dSFreq,
int iOrder = 1024,
int designMethod = FilterKernel::m_designMethods.indexOf(FilterParameter("Cosine")),
const Eigen::RowVectorXi & vecPicks = Eigen::RowVectorXi(),
bool bUseThreads = true,
bool bKeepOverhead = false )

Creates a user designed filter kernel and filters the raw input data. The data needs to be present all at once. For continous filtering via overlap add use the FilterOverlapAdd class.

Parameters
[in]matDataThe data which is to be filtered.
[in]typeThe type of the filter: LPF, HPF, BPF, NOTCH (from enum FilterType).
[in]dCenterfreqThe center of the frequency.
[in]dBandwidthThe filter bandwidth. Ignored if FilterType is set to LPF,HPF. If NOTCH/BPF: bandwidth of stop-/passband.
[in]dTransitionThe transistion band determines the width of the filter slopes (steepness).
[in]dSFreqThe input data sampling frequency.
[in]iOrderRepresents the order of the filter, the higher the higher is the stopband attenuation. Default is 1024 taps.
[in]designMethodThe design method to use. Choose between Cosine and Tschebyscheff. Defaul is set to Cosine.
[in]vecPicksChannel indexes to filter. Default is filter all channels.
[in]bUseThreadsWhether to use multiple threads. Default is set to true.
[in]bKeepOverheadWhether to keep the delayed part of the data after filtering. Default is set to false .
Returns
The filtered data in form of a matrix.

◆ filterDataBlock()

Eigen::MatrixXd RTPROCESSINGLIB::filterDataBlock ( const Eigen::MatrixXd & mataData,
const Eigen::RowVectorXi & vecPicks,
const RTPROCESSINGLIB::FilterKernel & filterKernel,
bool bUseThreads = true )

Calculates the filtered version of the raw input data block. Always returns the data with half the filter length delay in the front and back.

Parameters
[in]mataDataThe data which is to be filtered.
[in]vecPicksThe used channel as index in RowVector.
[in]filterKernelThe FilterKernel to to filter the data with.
[in]bUseThreadsWhether to use multiple threads.
Returns
The filtered data in form of a matrix with half the filter length delay in the front and back.

◆ filterFile() [1/2]

bool RTPROCESSINGLIB::filterFile ( QIODevice & pIODevice,
QSharedPointer< FIFFLIB::FiffRawData > pFiffRawData,
const RTPROCESSINGLIB::FilterKernel & filterKernel,
const Eigen::RowVectorXi & vecPicks = Eigen::RowVectorXi(),
bool bUseThreads = false )

Filters data from an input file based on an exisiting filter kernel and writes the filtered data to a pIODevice.

Parameters
[in]pIODeviceThe IO device to write to.
[in]pFiffRawDataThe fiff raw data object to read from.
[in]filterKernelThe list of filter kernels to use.
[in]vecPicksChannel indexes to filter. Default is filter all channels.
[in]bUseThreadshether to use multiple threads. Default is set to true.
Returns
Returns true if successfull, false otherwise.

◆ filterFile() [2/2]

bool RTPROCESSINGLIB::filterFile ( QIODevice & pIODevice,
QSharedPointer< FIFFLIB::FiffRawData > pFiffRawData,
int type,
double dCenterfreq,
double dBandwidth,
double dTransition,
double dSFreq,
int iOrder = 4096,
int designMethod = FilterKernel::m_designMethods.indexOf(FilterParameter("Cosine")),
const Eigen::RowVectorXi & vecPicks = Eigen::RowVectorXi(),
bool bUseThreads = true )

Creates a user designed filter kernel, filters data from an input file and writes the filtered data to a pIODevice.

Parameters
[in]pIODeviceThe IO device to write to.
[in]pFiffRawDataThe fiff raw data object to read from.
[in]typeThe type of the filter: LPF, HPF, BPF, NOTCH (from enum FilterType).
[in]dCenterfreqThe center of the frequency.
[in]dBandwidthThe filter bandwidth. Ignored if FilterType is set to LPF,HPF. If NOTCH/BPF: bandwidth of stop-/passband.
[in]dTransitionThe transistion band determines the width of the filter slopes (steepness).
[in]dSFreqThe input data sampling frequency.
[in]iOrderRepresents the order of the filter, the higher the higher is the stopband attenuation. Default is 4096 taps.
[in]designMethodThe design method to use. Choose between Cosine and Tschebyscheff. Defaul is set to Cosine.
[in]vecPicksChannel indexes to filter. Default is filter all channels.
[in]bUseThreadshether to use multiple threads. Default is set to true.
Returns
Returns true if successfull, false otherwise.

◆ fitMatchedPoints()

bool RTPROCESSINGLIB::fitMatchedPoints ( const Eigen::MatrixXf & matSrcPoint,
const Eigen::MatrixXf & matDstPoint,
Eigen::Matrix4f & matTrans,
float fScale = 1.0,
bool bScale = false,
const Eigen::VectorXf & vecWeitgths = vecDefaultWeigths )

Corresponding point set registration using quaternions.

Parameters
[in]matSrcPointThe source point set.
[in]matDstPointThe destination point set.
[in,out]matTransThe forward transformation matrix.
[in,out]fScaleThe scaling parameter, defaults to 1.0.
[in]bScaleWether to apply scaling or not. Should be false for matching data sets, defaults to false.
[in]vecWeitgthsThe weitghts to apply , defaults to zeros.
Returns
Wether the matching was succesfull.

◆ makeSpharaProjector()

Eigen::MatrixXd RTPROCESSINGLIB::makeSpharaProjector ( const Eigen::MatrixXd & matBaseFct,
const Eigen::VectorXi & vecIndices,
int iOperatorDim,
int iNBaseFct,
int iSkip = 0 )

Constructs a SPHARA operator.

Parameters
[in]matBaseFctThe SPHARA basis functions.
[in]vecIndicesThe indices of the positions in the final oeprator which are to be filled with the basis functions weights (i.e. these indices could respond to the indices of gradioemteres in a VectorView system).
[in]iOperatorDimThe dimensions of the final SPHARA operator. Make sure that these correspond to the dimensions of the data matrix you want tol multiply with the SPHARA operator.
[in]iNBaseFctThe number of SPHARA basis functions to take.
[in]iSkipThe value to skip when reading the vecIndices variabel. I.e. use this when dealing with VectorView triplets, which include two gradiometers.
Returns
Returns the final SPHARA operator with dimensions (iOperatorDim,iOperatorDim).

◆ performIcp()

bool RTPROCESSINGLIB::performIcp ( const QSharedPointer< MNELIB::MNEProjectToSurface > mneSurfacePoints,
const Eigen::MatrixXf & matPointCloud,
FIFFLIB::FiffCoordTrans & transFromTo,
float & fRMSE,
bool bScale = false,
int iMaxIter = 20,
float fTol = 0.001,
const Eigen::VectorXf & vecWeitgths = vecDefaultWeigths )

The ICP algorithm to register a point cloud with a surface.

Parameters
[in]mneSurfacePointsThe MNEProjectToSurface object that contains the surface triangles etc. (To).
[in]matPointCloudThe point cloud to be registrated (From).
[in,out]transFromToThe forward transformation matrix. It can contain an initial transformatin (e.g. from fiducial alignment).
[in,out]fRMSEThe resulting Root-Mean-Square-Error in m.
[in]bScaleWether to apply scaling or not. Should be false for matching data sets, defaults to false.
[in]iMaxIterThe maximum number of iterations for the icp algorithms, defaults to 20.
[in]fTolThe destination point set to be reistrated, defaults to 0.001.
[in]vecWeitgthsThe weitghts to apply, defaults to zeros.
Returns
Wether the registration was succesfull.

◆ toEventMatrix()

QList< MatrixXi > RTPROCESSINGLIB::toEventMatrix ( QMap< int, QList< QPair< int, double > > > mapTriggers)

Transforms QMap with stored information about events per stim channel to a list of event matrices.

Parameters
[in]mapTriggersThe QMap to be transformed.
[in]Alist of transformed Eigen matrices.

Definition at line 58 of file detecttrigger.cpp.

Variable Documentation

◆ vecDefaultWeigths

const Eigen::VectorXf RTPROCESSINGLIB::vecDefaultWeigths

Definition at line 78 of file icp.h.