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//=============================================================================================================
83{
84 float stimIgnore = 0.0f;
85 float megGradReject = 2000e-13f;
86 float megMagReject = 3e-12f;
87 float eegReject = 100e-6f;
88 float eogReject = 150e-6f;
89 float ecgReject = 0.0f;
90 float megGradFlat = 0.0f;
91 float megMagFlat = 0.0f;
92 float eegFlat = 0.0f;
93 float eogFlat = 0.0f;
94 float ecgFlat = 0.0f;
95};
96
97//=============================================================================================================
111{
112 QString comment;
113 QVector<unsigned int> events;
114 unsigned int nextEvent = 0;
115 unsigned int prevEvent = 0;
116 unsigned int ignore = 0;
117 unsigned int prevIgnore = 0;
118 unsigned int nextIgnore = 0;
119 float delay = 0.0f;
120 float tmin = -0.2f;
121 float tmax = 0.5f;
122 float bmin = 0.0f;
123 float bmax = 0.0f;
124 bool doBaseline = false;
125 bool doStdErr = false;
126 bool doAbs = false;
127 float color[3] = {0, 0, 0};
128};
129
130//=============================================================================================================
143{
144 QString comment;
145 QList<AverageCategory> categories;
147 bool fixSkew = false;
148 QString filename;
149 QString eventFile;
150 QString logFile;
151};
152
153//=============================================================================================================
165{
166public:
167 using SPtr = QSharedPointer<FiffEvokedSet>;
168 using ConstSPtr = QSharedPointer<const FiffEvokedSet>;
169 using UPtr = std::unique_ptr<FiffEvokedSet>;
170 using ConstUPtr = std::unique_ptr<const FiffEvokedSet>;
171
172 //=========================================================================================================
177
178 //=========================================================================================================
184 FiffEvokedSet(QIODevice& p_IODevice);
185
186 //=========================================================================================================
192 FiffEvokedSet(const FiffEvokedSet& p_FiffEvokedSet);
193
194 //=========================================================================================================
205 FiffEvokedSet& operator=(const FiffEvokedSet& other) = default;
206
207 //=========================================================================================================
212
213 //=========================================================================================================
217 void clear();
218
219 //=========================================================================================================
230 FiffEvokedSet pick_channels(const QStringList& include = defaultQStringList,
231 const QStringList& exclude = defaultQStringList) const;
232
233 //=========================================================================================================
244 bool compensate_to(FiffEvokedSet& p_FiffEvokedSet,
245 fiff_int_t to) const;
246
247 //=========================================================================================================
257 bool find_evoked(const FiffEvokedSet& p_FiffEvokedSet) const;
258
259 //=========================================================================================================
277 static bool read(QIODevice& p_IODevice,
278 FiffEvokedSet& p_FiffEvokedSet,
279 QPair<float, float> baseline = defaultFloatPair,
280 bool proj = true);
281
282 //=========================================================================================================
289 bool save(const QString& fileName) const;
290
291 //=========================================================================================================
300 static FiffEvokedSet computeGrandAverage(const QList<FiffEvokedSet>& evokedSets);
301
302 //=========================================================================================================
316 const AverageDescription& desc,
317 const Eigen::MatrixXi& events,
318 QString& log);
319
320 //=========================================================================================================
331 static bool checkArtifacts(const Eigen::MatrixXd& epoch,
332 const FiffInfo& info,
333 const QStringList& bads,
334 const RejectionParams& rej,
335 QString& reason);
336
347 static void subtractBaseline(Eigen::MatrixXd& epoch, int bminSamp, int bmaxSamp);
348
349public:
351 QList<FiffEvoked> evoked;
352};
353} // NAMESPACE
354
355#ifndef metatype_fiffevokedset
356#define metatype_fiffevokedset
358#endif
359
360#ifndef metatype_fiffevokedsetsptr
361#define metatype_fiffevokedsetsptr
363#endif
364
365#endif // FIFF_EVOKED_SET_H
Q_DECLARE_METATYPE(FIFFLIB::FiffEvokedSet)
Single averaged evoked response: time axis, samples, baseline, channel info and processing history.
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
FIFF file I/O, in-memory data structures and high-level readers/writers.
qint32 fiff_int_t
Definition fiff_types.h:86
Artifact-rejection thresholds for the MNE-C batch averaging pipeline (gradiometer / magnetometer / EE...
One averaging category in an MNE-C ave-description file: trigger logic, timing window,...
QVector< unsigned int > events
Top-level MNE-C ave-description record: comment, category list, shared rejection limits and output fi...
QList< AverageCategory > categories
Set of FiffEvoked instances sharing one FiffInfo, plus channel-picking and compensation helpers.
bool compensate_to(FiffEvokedSet &p_FiffEvokedSet, fiff_int_t to) const
static FiffEvokedSet computeAverages(const FiffRawData &raw, const AverageDescription &desc, const Eigen::MatrixXi &events, QString &log)
bool find_evoked(const FiffEvokedSet &p_FiffEvokedSet) const
FiffEvokedSet & operator=(const FiffEvokedSet &other)=default
static FiffEvokedSet computeGrandAverage(const QList< FiffEvokedSet > &evokedSets)
FiffEvokedSet(QIODevice &p_IODevice)
QSharedPointer< const FiffEvokedSet > ConstSPtr
static bool checkArtifacts(const Eigen::MatrixXd &epoch, const FiffInfo &info, const QStringList &bads, const RejectionParams &rej, QString &reason)
static void subtractBaseline(Eigen::MatrixXd &epoch, int bminSamp, int bmaxSamp)
Subtract baseline from each channel of an epoch.
FiffEvokedSet pick_channels(const QStringList &include=defaultQStringList, const QStringList &exclude=defaultQStringList) const
QSharedPointer< FiffEvokedSet > SPtr
FiffEvokedSet(const FiffEvokedSet &p_FiffEvokedSet)
static bool read(QIODevice &p_IODevice, FiffEvokedSet &p_FiffEvokedSet, QPair< float, float > baseline=defaultFloatPair, bool proj=true)
std::unique_ptr< const FiffEvokedSet > ConstUPtr
std::unique_ptr< FiffEvokedSet > UPtr
QList< FiffEvoked > evoked
bool save(const QString &fileName) const
Full FIFF measurement info: per-channel descriptors, sampling and filter setup, projectors,...
Definition fiff_info.h:90
Continuous FIFF raw recording: FiffInfo plus a random-access directory of FIFF_DATA_BUFFER tags.