v2.0.0
Loading...
Searching...
No Matches
mne_epoch_data.cpp
Go to the documentation of this file.
1//=============================================================================================================
17
18//=============================================================================================================
19// INCLUDES
20//=============================================================================================================
21
22#include "mne_epoch_data.h"
23
24#include <math/numerics.h>
25
26//=============================================================================================================
27// USED NAMESPACES
28//=============================================================================================================
29
30using namespace MNELIB;
31using namespace Eigen;
32using namespace UTILSLIB;
33
34//=============================================================================================================
35// DEFINE MEMBER METHODS
36//=============================================================================================================
37
39: event(-1)
40, eventSample(-1)
41, tmin(-1)
42, tmax(-1)
43, bReject(false)
44, bUserReject(false)
45{
46}
47
48//=============================================================================================================
49
51: epoch(p_MNEEpochData.epoch)
52, event(p_MNEEpochData.event)
53, eventSample(p_MNEEpochData.eventSample)
54, tmin(p_MNEEpochData.tmin)
55, tmax(p_MNEEpochData.tmax)
56, bReject(p_MNEEpochData.bReject)
57, bUserReject(p_MNEEpochData.bUserReject)
58{
59}
60
61//=============================================================================================================
62
66
67//=============================================================================================================
68
69void MNEEpochData::applyBaselineCorrection(const QPair<float, float>& baseline)
70{
71 // Run baseline correction
72 RowVectorXf times = RowVectorXf::LinSpaced(this->epoch.cols(), this->tmin, this->tmax);
73 this->epoch = Numerics::rescale(this->epoch, times, baseline, QString("mean"));
74}
75
76//=============================================================================================================
77
78void MNEEpochData::pick_channels(const RowVectorXi& sel)
79{
80 if (sel.cols() == 0) {
81 qWarning("MNEEpochData::pick_channels - Warning : No channels were provided.\n");
82 return;
83 }
84
85 // Reduce data set
86 MatrixXd selBlock(1,1);
87
88 if(selBlock.rows() != sel.cols() || selBlock.cols() != epoch.cols()) {
89 selBlock.resize(sel.cols(), epoch.cols());
90 }
91
92 for(qint32 l = 0; l < sel.cols(); ++l) {
93 if(sel(l) <= epoch.rows()) {
94 selBlock.row(l) = epoch.row(sel(0,l));
95 } else {
96 qWarning("FiffEvoked::pick_channels - Warning : Selected channel index out of bound.\n");
97 }
98 }
99
100 epoch = selBlock;
101}
Single epoch (one trial slice of preprocessed sensor data) with timing and rejection metadata.
General numerical helpers: GCD, log2, histogram binning, baseline rescaling, sparsity tests.
Core MNE data structures (source spaces, source estimates, hemispheres).
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
static Eigen::MatrixXd rescale(const Eigen::MatrixXd &data, const Eigen::RowVectorXf &times, const QPair< float, float > &baseline, QString mode)
void pick_channels(const Eigen::RowVectorXi &sel)
void applyBaselineCorrection(const QPair< float, float > &baseline)
Eigen::MatrixXd epoch
FIFFLIB::fiff_int_t eventSample
FIFFLIB::fiff_int_t event