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

Segments continuous raw data into fixed-length epochs locked to events. More...

#include <epoch_extractor.h>

Public Types

using Params = EpochExtractorParams

Static Public Member Functions

static QVector< MNELIB::MNEEpochDataextract (const Eigen::MatrixXd &matData, const QVector< int > &eventSamples, double dSFreq, const Params &params=Params(), const QVector< int > &eventCodes=QVector< int >())
static Eigen::MatrixXd average (const QVector< MNELIB::MNEEpochData > &epochs)
static QVector< MNELIB::MNEEpochDatarejectMarked (const QVector< MNELIB::MNEEpochData > &epochs)

Detailed Description

Segments continuous raw data into fixed-length epochs locked to events.

p.dTmin = -0.2; // 200 ms pre-stimulus
p.dTmax = 0.8; // 800 ms post-stimulus
p.dBaseMin = -0.2;
p.dBaseMax = 0.0;
p.dThreshold = 150e-6; // 150 µV peak-to-peak rejection
QVector<MNELIB::MNEEpochData> epochs =
EpochExtractor::extract(matRawData, eventSamples, sFreq, p);
// Good epochs only
QVector<MNELIB::MNEEpochData> clean =
static QVector< MNELIB::MNEEpochData > rejectMarked(const QVector< MNELIB::MNEEpochData > &epochs)
static QVector< MNELIB::MNEEpochData > extract(const Eigen::MatrixXd &matData, const QVector< int > &eventSamples, double dSFreq, const Params &params=Params(), const QVector< int > &eventCodes=QVector< int >())
EpochExtractorParams Params

Definition at line 105 of file epoch_extractor.h.

Member Typedef Documentation

◆ Params

Convenience alias so callers can still write EpochExtractor::Params.

Definition at line 108 of file epoch_extractor.h.

Member Function Documentation

◆ average()

MatrixXd EpochExtractor::average ( const QVector< MNELIB::MNEEpochData > & epochs)
static

Compute the grand average (ERP/ERF) across all non-rejected epochs.

Parameters
[in]epochsVector of extracted epochs (output of extract()).
Returns
Mean data matrix (n_channels × n_epoch_samples), or empty matrix if no good epochs.

Definition at line 157 of file epoch_extractor.cpp.

◆ extract()

QVector< MNEEpochData > EpochExtractor::extract ( const Eigen::MatrixXd & matData,
const QVector< int > & eventSamples,
double dSFreq,
const Params & params = Params(),
const QVector< int > & eventCodes = QVector<int>() )
static

Extract epochs from a continuous raw data matrix.

For each event sample index the function:

  1. Cuts a window [tmin, tmax] around the event.
  2. Applies mean baseline correction over [baseMin, baseMax] (if bApplyBaseline and the window is valid).
  3. Marks the epoch for rejection if any channel has peak-to-peak > dThreshold (and dThreshold > 0).

Epochs whose window extends outside the data boundaries are silently skipped.

Parameters
[in]matDataContinuous raw data (n_channels × n_samples), calibrated (SI units).
[in]eventSamples0-based sample indices of events.
[in]dSFreqSampling frequency in Hz.
[in]paramsExtraction parameters.
[in]eventCodesOptional per-event integer codes stored in MNEEpochData::event. Must be empty or the same length as eventSamples.
Returns
Vector of MNEEpochData (one per valid event). Rejected epochs are included with MNEEpochData::bReject == true so callers can choose whether to exclude them.

Definition at line 84 of file epoch_extractor.cpp.

◆ rejectMarked()

QVector< MNEEpochData > EpochExtractor::rejectMarked ( const QVector< MNELIB::MNEEpochData > & epochs)
static

Return only the epochs that are NOT marked for rejection.

Parameters
[in]epochsInput epoch vector.
Returns
Subset of epochs with bReject == false.

Definition at line 182 of file epoch_extractor.cpp.


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