v2.0.0
Loading...
Searching...
No Matches
mne_epoch_data.cpp
Go to the documentation of this file.
1//=============================================================================================================
36
37//=============================================================================================================
38// INCLUDES
39//=============================================================================================================
40
41#include "mne_epoch_data.h"
42
43#include <math/numerics.h>
44
45//=============================================================================================================
46// USED NAMESPACES
47//=============================================================================================================
48
49using namespace MNELIB;
50using namespace Eigen;
51using namespace UTILSLIB;
52
53//=============================================================================================================
54// DEFINE MEMBER METHODS
55//=============================================================================================================
56
58: event(-1)
59, eventSample(-1)
60, tmin(-1)
61, tmax(-1)
62, bReject(false)
63, bUserReject(false)
64{
65}
66
67//=============================================================================================================
68
70: epoch(p_MNEEpochData.epoch)
71, event(p_MNEEpochData.event)
72, eventSample(p_MNEEpochData.eventSample)
73, tmin(p_MNEEpochData.tmin)
74, tmax(p_MNEEpochData.tmax)
75, bReject(p_MNEEpochData.bReject)
76, bUserReject(p_MNEEpochData.bUserReject)
77{
78}
79
80//=============================================================================================================
81
85
86//=============================================================================================================
87
88void MNEEpochData::applyBaselineCorrection(const QPair<float, float>& baseline)
89{
90 // Run baseline correction
91 RowVectorXf times = RowVectorXf::LinSpaced(this->epoch.cols(), this->tmin, this->tmax);
92 this->epoch = Numerics::rescale(this->epoch, times, baseline, QString("mean"));
93}
94
95//=============================================================================================================
96
97void MNEEpochData::pick_channels(const RowVectorXi& sel)
98{
99 if (sel.cols() == 0) {
100 qWarning("MNEEpochData::pick_channels - Warning : No channels were provided.\n");
101 return;
102 }
103
104 // Reduce data set
105 MatrixXd selBlock(1,1);
106
107 if(selBlock.rows() != sel.cols() || selBlock.cols() != epoch.cols()) {
108 selBlock.resize(sel.cols(), epoch.cols());
109 }
110
111 for(qint32 l = 0; l < sel.cols(); ++l) {
112 if(sel(l) <= epoch.rows()) {
113 selBlock.row(l) = epoch.row(sel(0,l));
114 } else {
115 qWarning("FiffEvoked::pick_channels - Warning : Selected channel index out of bound.\n");
116 }
117 }
118
119 epoch = selBlock;
120}
Numerics class declaration.
MNEEpochData class declaration.
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