v2.0.0
Loading...
Searching...
No Matches
UTILSLIB::Xdawn Class Reference

Event-related response enhancement with xDAWN spatial filtering. More...

#include <xdawn.h>

Static Public Member Functions

static XdawnResult fit (const QVector< MNELIB::MNEEpochData > &epochs, int iTargetEvent=1, int nComponents=2, double dReg=1e-6)
static Eigen::MatrixXd apply (const Eigen::MatrixXd &matEpoch, const XdawnResult &result)
static Eigen::MatrixXd denoise (const Eigen::MatrixXd &matEpoch, const XdawnResult &result, int nComponents=-1)
static QVector< MNELIB::MNEEpochDatadenoiseEpochs (const QVector< MNELIB::MNEEpochData > &epochs, const XdawnResult &result, int nComponents=-1)

Detailed Description

Event-related response enhancement with xDAWN spatial filtering.

Typical usage:

auto xd = Xdawn::fit(epochs, 1, 4);
Eigen::MatrixXd comp = Xdawn::apply(epoch.epoch, xd); // 4 x n_samples
Eigen::MatrixXd den = Xdawn::denoise(epoch.epoch, xd, 2); // n_channels x n_samples
static Eigen::MatrixXd apply(const Eigen::MatrixXd &matEpoch, const XdawnResult &result)
Definition xdawn.cpp:236
static XdawnResult fit(const QVector< MNELIB::MNEEpochData > &epochs, int iTargetEvent=1, int nComponents=2, double dReg=1e-6)
Definition xdawn.cpp:90
static Eigen::MatrixXd denoise(const Eigen::MatrixXd &matEpoch, const XdawnResult &result, int nComponents=-1)
Definition xdawn.cpp:252

Definition at line 95 of file xdawn.h.

Member Function Documentation

◆ apply()

MatrixXd Xdawn::apply ( const Eigen::MatrixXd & matEpoch,
const XdawnResult & result )
static

Project one epoch into xDAWN component space.

Parameters
[in]matEpochEpoch data (n_channels x n_samples).
[in]resultResult from fit().
Returns
Component activations (n_components x n_samples).

Definition at line 236 of file xdawn.cpp.

◆ denoise()

MatrixXd Xdawn::denoise ( const Eigen::MatrixXd & matEpoch,
const XdawnResult & result,
int nComponents = -1 )
static

Reconstruct one epoch from the first nComponents xDAWN components.

If nComponents <= 0 or exceeds the fitted dimensionality, all fitted components are used.

Parameters
[in]matEpochEpoch data (n_channels x n_samples).
[in]resultResult from fit().
[in]nComponentsNumber of leading xDAWN components to keep.
Returns
Denoised epoch (n_channels x n_samples).

Definition at line 252 of file xdawn.cpp.

◆ denoiseEpochs()

QVector< MNEEpochData > Xdawn::denoiseEpochs ( const QVector< MNELIB::MNEEpochData > & epochs,
const XdawnResult & result,
int nComponents = -1 )
static

Apply denoise() to all epochs in the vector, preserving metadata.

Parameters
[in]epochsInput epochs.
[in]resultResult from fit().
[in]nComponentsNumber of leading xDAWN components to keep.
Returns
Copy of the input epochs with denoised epoch matrices.

Definition at line 275 of file xdawn.cpp.

◆ fit()

XdawnResult Xdawn::fit ( const QVector< MNELIB::MNEEpochData > & epochs,
int iTargetEvent = 1,
int nComponents = 2,
double dReg = 1e-6 )
static

Fit xDAWN spatial filters for a target event code.

Uses non-rejected epochs only. The target signal covariance is estimated from the average of epochs whose MNEEpochData::event equals iTargetEvent. The noise covariance is estimated from residuals around the class-wise average for each event type.

Parameters
[in]epochsInput epochs.
[in]iTargetEventEvent code whose ERP/ERF should be enhanced.
[in]nComponentsNumber of xDAWN components to retain.
[in]dRegRelative diagonal regularisation added to the noise covariance.
Returns
XdawnResult containing filters, patterns, and covariances.

Definition at line 90 of file xdawn.cpp.


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