v2.0.0
Loading...
Searching...
No Matches
fiff_evoked_set.h
Go to the documentation of this file.
1//=============================================================================================================
30
31#ifndef FIFF_EVOKED_SET_H
32#define FIFF_EVOKED_SET_H
33
34//=============================================================================================================
35// INCLUDES
36//=============================================================================================================
37
38#include "fiff_info.h"
39#include "fiff_evoked.h"
40#include "fiff_global.h"
41
42#include <Eigen/Core>
43#include <QVector>
44
45//=============================================================================================================
46// QT INCLUDES
47//=============================================================================================================
48
49#include <QIODevice>
50#include <QList>
51#include <QSharedPointer>
52#include <QStringList>
53
54//=============================================================================================================
55// EIGEN INCLUDES
56//=============================================================================================================
57
58#include <Eigen/Core>
59#include <memory>
60
61//=============================================================================================================
62// DEFINE NAMESPACE MNELIB
63//=============================================================================================================
64
65namespace FIFFLIB
66{
67
68class FiffRawData;
69
70//=============================================================================================================
80struct FIFFSHARED_EXPORT RejectionParams {
81 float stimIgnore = 0.0f;
82 float megGradReject = 2000e-13f;
83 float megMagReject = 3e-12f;
84 float eegReject = 100e-6f;
85 float eogReject = 150e-6f;
86 float ecgReject = 0.0f;
87 float megGradFlat = 0.0f;
88 float megMagFlat = 0.0f;
89 float eegFlat = 0.0f;
90 float eogFlat = 0.0f;
91 float ecgFlat = 0.0f;
92};
93
94//=============================================================================================================
106 QString comment;
107 QVector<unsigned int> events;
108 unsigned int nextEvent = 0;
109 unsigned int prevEvent = 0;
110 unsigned int ignore = 0;
111 unsigned int prevIgnore = 0;
112 unsigned int nextIgnore = 0;
113 float delay = 0.0f;
114 float tmin = -0.2f;
115 float tmax = 0.5f;
116 float bmin = 0.0f;
117 float bmax = 0.0f;
118 bool doBaseline = false;
119 bool doStdErr = false;
120 bool doAbs = false;
121 float color[3] = {0,0,0};
122};
123
124//=============================================================================================================
135 QString comment;
136 QList<AverageCategory> categories;
137 RejectionParams rej;
138 bool fixSkew = false;
139 QString filename;
140 QString eventFile;
141 QString logFile;
142};
143
144//=============================================================================================================
154{
155
156public:
157 using SPtr = QSharedPointer<FiffEvokedSet>;
158 using ConstSPtr = QSharedPointer<const FiffEvokedSet>;
159 using UPtr = std::unique_ptr<FiffEvokedSet>;
160 using ConstUPtr = std::unique_ptr<const FiffEvokedSet>;
161
162 //=========================================================================================================
167
168 //=========================================================================================================
174 FiffEvokedSet(QIODevice& p_IODevice);
175
176 //=========================================================================================================
182 FiffEvokedSet(const FiffEvokedSet& p_FiffEvokedSet);
183
184 //=========================================================================================================
189
190 //=========================================================================================================
194 void clear();
195
196 //=========================================================================================================
207 FiffEvokedSet pick_channels(const QStringList& include = defaultQStringList,
208 const QStringList& exclude = defaultQStringList) const;
209
210 //=========================================================================================================
221 bool compensate_to(FiffEvokedSet &p_FiffEvokedSet,
222 fiff_int_t to) const;
223
224 //=========================================================================================================
234 bool find_evoked(const FiffEvokedSet& p_FiffEvokedSet) const;
235
236 //=========================================================================================================
254 static bool read(QIODevice& p_IODevice,
255 FiffEvokedSet& p_FiffEvokedSet,
256 QPair<float,float> baseline = defaultFloatPair,
257 bool proj = true);
258
259 //=========================================================================================================
266 bool save(const QString &fileName) const;
267
268 //=========================================================================================================
277 static FiffEvokedSet computeGrandAverage(const QList<FiffEvokedSet> &evokedSets);
278
279 //=========================================================================================================
293 const AverageDescription &desc,
294 const Eigen::MatrixXi &events,
295 QString &log);
296
297 //=========================================================================================================
308 static bool checkArtifacts(const Eigen::MatrixXd &epoch,
309 const FiffInfo &info,
310 const QStringList &bads,
311 const RejectionParams &rej,
312 QString &reason);
313
324 static void subtractBaseline(Eigen::MatrixXd &epoch, int bminSamp, int bmaxSamp);
325
326public:
327 FiffInfo info;
328 QList<FiffEvoked> evoked;
329};
330} // NAMESPACE
331
332#ifndef metatype_fiffevokedset
333#define metatype_fiffevokedset
334Q_DECLARE_METATYPE(FIFFLIB::FiffEvokedSet);
335#endif
336
337#ifndef metatype_fiffevokedsetsptr
338#define metatype_fiffevokedsetsptr
339Q_DECLARE_METATYPE(FIFFLIB::FiffEvokedSet::SPtr);
340#endif
341
342#endif // FIFF_EVOKED_SET_H
float eogFlat
float ecgReject
float eegFlat
float megGradReject
float megGradFlat
float megMagFlat
float ecgFlat
float megMagReject
Q_DECLARE_METATYPE(FIFFLIB::FiffEvokedSet)
float eogReject
float eegReject
Full FIFF measurement metadata: everything from FIFFB_MEAS / FIFFB_MEAS_INFO needed to interpret a re...
Export/import macros and build-info accessors for the FIFFLIB shared library.
#define FIFFSHARED_EXPORT
Definition fiff_global.h:44
Single averaged evoked response: time axis, samples, baseline, channel info and processing history.
FIFF file I/O, in-memory data structures and high-level readers/writers.
One averaging category in an MNE-C ave-description file: trigger logic, timing window,...
QVector< unsigned int > events
unsigned int nextIgnore
unsigned int nextEvent
unsigned int prevIgnore
unsigned int prevEvent
unsigned int ignore
Top-level MNE-C ave-description record: comment, category list, shared rejection limits and output fi...
RejectionParams rej
QList< AverageCategory > categories
std::unique_ptr< const FiffEvokedSet > ConstUPtr
bool compensate_to(FiffEvokedSet &p_FiffEvokedSet, fiff_int_t to) const
FiffEvokedSet(QIODevice &p_IODevice)
bool find_evoked(const FiffEvokedSet &p_FiffEvokedSet) const
std::unique_ptr< FiffEvokedSet > UPtr
static void subtractBaseline(Eigen::MatrixXd &epoch, int bminSamp, int bmaxSamp)
Subtract baseline from each channel of an epoch.
static bool checkArtifacts(const Eigen::MatrixXd &epoch, const FiffInfo &info, const QStringList &bads, const RejectionParams &rej, QString &reason)
static FiffEvokedSet computeAverages(const FiffRawData &raw, const AverageDescription &desc, const Eigen::MatrixXi &events, QString &log)
FiffEvokedSet(const FiffEvokedSet &p_FiffEvokedSet)
QSharedPointer< const FiffEvokedSet > ConstSPtr
FiffEvokedSet pick_channels(const QStringList &include=defaultQStringList, const QStringList &exclude=defaultQStringList) const
QSharedPointer< FiffEvokedSet > SPtr
static FiffEvokedSet computeGrandAverage(const QList< FiffEvokedSet > &evokedSets)
static bool read(QIODevice &p_IODevice, FiffEvokedSet &p_FiffEvokedSet, QPair< float, float > baseline=defaultFloatPair, bool proj=true)
QList< FiffEvoked > evoked
bool save(const QString &fileName) const