58 using namespace FIFFLIB;
59 using namespace Eigen;
60 using namespace MNELIB;
67 const MatrixXi& matEvents,
72 float fTBaselineFromS,
74 const QMap<QString,double>& mapReject,
75 const QStringList& lExcludeChs,
76 const RowVectorXi& picks)
89 QPair<float, float> baselinePair(fTBaselineFromS, fTBaselineToS);
93 if(!mapReject.isEmpty()){
99 lstEpochDataList.first()->epoch.cols());
105 const MatrixXi& matEvents,
110 float fTBaselineFromS,
112 const QMap<QString,double>& mapReject,
113 const FilterKernel& filterKernel,
114 const QStringList& lExcludeChs,
115 const RowVectorXi& picks)
122 MatrixXi selected = MatrixXi::Zero(1, matEvents.rows());
123 for (p = 0; p < matEvents.rows(); ++p)
125 if (matEvents(p,1) == 0 && matEvents(p,2) == eventType)
127 selected(0,count) = p;
131 selected.conservativeResize(1, count);
133 qInfo(
"[RTPROCESSINGLIB::computeFilteredAverage] %d matching events found",count);
137 RowVectorXi picksNew = picks;
138 if(picks.cols() <= 0) {
139 picksNew.resize(raw.
info.
chs.size());
140 for(
int i = 0; i < raw.
info.
chs.size(); ++i) {
145 fiff_int_t event_samp, from, to;
146 fiff_int_t dropCount = 0;
150 QScopedPointer<MNEEpochData> epoch(Q_NULLPTR);
151 int iFilterDelay = filterKernel.getFilterOrder()/2;
153 for (p = 0; p < count; ++p) {
155 event_samp = matEvents(selected(p),0);
156 from = event_samp + fTMinS*raw.
info.
sfreq;
157 to = event_samp + floor(fTMaxS*raw.
info.
sfreq + 0.5);
161 if(raw.
read_raw_segment(epoch->epoch, timesDummy, from - iFilterDelay, to + iFilterDelay, picksNew)) {
166 times.resize(1, to-from+1);
167 for (qint32 i = 0; i < times.cols(); ++i)
168 times(0, i) = ((float)(from-event_samp+i)) / raw.
info.
sfreq;
171 epoch->event = eventType;
172 epoch->tmin = fTMinS;
173 epoch->tmax = fTMaxS;
175 epoch->bReject = MNEEpochDataList::checkForArtifact(epoch->epoch,
180 if (epoch->bReject) {
185 if(!lstEpochDataList.isEmpty()) {
186 if(epoch->epoch.size() == lstEpochDataList.last()->epoch.size()) {
193 qWarning(
"[MNEEpochDataList::readEpochs] Can't read the event data segments.");
197 qInfo().noquote() <<
"[MNEEpochDataList::readEpochs] Read a total of"<< lstEpochDataList.size() <<
"epochs of type" << eventType <<
"and marked"<< dropCount <<
"for rejection.";
200 QPair<float, float> baselinePair(fTBaselineFromS, fTBaselineToS);
204 if(!mapReject.isEmpty()){
210 lstEpochDataList.first()->epoch.cols());