MNE-CPP 0.1.9
A Framework for Electrophysiology
Loading...
Searching...
No Matches
mne_epoch_data.cpp
Go to the documentation of this file.
1//=============================================================================================================
37//=============================================================================================================
38// INCLUDES
39//=============================================================================================================
40
41#include "mne_epoch_data.h"
42
43#include <utils/mnemath.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, tmin(-1)
60, tmax(-1)
61, bReject(false)
62{
63}
64
65//=============================================================================================================
66
68: epoch(p_MNEEpochData.epoch)
69, event(p_MNEEpochData.event)
70, tmin(p_MNEEpochData.tmin)
71, tmax(p_MNEEpochData.tmax)
72, bReject(p_MNEEpochData.bReject)
73{
74}
75
76//=============================================================================================================
77
81
82//=============================================================================================================
83
84void MNEEpochData::applyBaselineCorrection(const QPair<float, float>& baseline)
85{
86 // Run baseline correction
87 RowVectorXf times = RowVectorXf::LinSpaced(this->epoch.cols(), this->tmin, this->tmax);
88 this->epoch = MNEMath::rescale(this->epoch, times, baseline, QString("mean"));
89}
90
91//=============================================================================================================
92
93void MNEEpochData::pick_channels(const RowVectorXi& sel)
94{
95 if (sel.cols() == 0) {
96 qWarning("MNEEpochData::pick_channels - Warning : No channels were provided.\n");
97 return;
98 }
99
100 // Reduce data set
101 MatrixXd selBlock(1,1);
102
103 if(selBlock.rows() != sel.cols() || selBlock.cols() != epoch.cols()) {
104 selBlock.resize(sel.cols(), epoch.cols());
105 }
106
107 for(qint32 l = 0; l < sel.cols(); ++l) {
108 if(sel(l) <= epoch.rows()) {
109 selBlock.row(l) = epoch.row(sel(0,l));
110 } else {
111 qWarning("FiffEvoked::pick_channels - Warning : Selected channel index out of bound.\n");
112 }
113 }
114
115 epoch = selBlock;
116}
MNEMath class declaration.
MNEEpochData class declaration.
void pick_channels(const Eigen::RowVectorXi &sel)
void applyBaselineCorrection(const QPair< float, float > &baseline)
Eigen::MatrixXd epoch
static Eigen::MatrixXd rescale(const Eigen::MatrixXd &data, const Eigen::RowVectorXf &times, const QPair< float, float > &baseline, QString mode)