v2.0.0
Loading...
Searching...
No Matches
fiff_ch_info.h
Go to the documentation of this file.
1//=============================================================================================================
32
33#ifndef FIFF_CH_INFO_H
34#define FIFF_CH_INFO_H
35
36//=============================================================================================================
37// INCLUDES
38//=============================================================================================================
39
40#include "fiff_global.h"
41#include "fiff_types.h"
42#include "fiff_ch_pos.h"
43
44//=============================================================================================================
45// QT INCLUDES
46//=============================================================================================================
47
48#include <QSharedPointer>
49#include <QString>
50
51//=============================================================================================================
52// EIGEN INCLUDES
53//=============================================================================================================
54
55#include <Eigen/Core>
56#include <memory>
57
58//=============================================================================================================
59// DEFINE NAMESPACE FIFFLIB
60//=============================================================================================================
61
62namespace FIFFLIB
63{
64
65//=============================================================================================================
76{
77public:
78 using SPtr = QSharedPointer<FiffChInfo>;
79 using ConstSPtr = QSharedPointer<const FiffChInfo>;
80 using UPtr = std::unique_ptr<FiffChInfo>;
81 using ConstUPtr = std::unique_ptr<const FiffChInfo>;
82
83 //=========================================================================================================
87 FiffChInfo();
88
89 //=========================================================================================================
95 FiffChInfo(const FiffChInfo &p_FiffChInfo);
96
97 //=========================================================================================================
101 ~FiffChInfo();
102
103 //=========================================================================================================
109 inline static qint32 storageSize();
110
111 //=========================================================================================================
120 static bool checkEegLocations(const QList<FiffChInfo>& chs, int nch);
121
122 //=========================================================================================================
131 bool isValidEeg() const;
132
133 //=========================================================================================================
141 friend bool operator== (const FiffChInfo &a, const FiffChInfo &b);
142
143public:
144 fiff_int_t scanNo;
145 fiff_int_t logNo;
146 fiff_int_t kind;
147 fiff_float_t range;
148 fiff_float_t cal;
150 fiff_int_t unit;
151 fiff_int_t unit_mul;
152 QString ch_name;
153
154 //Convenience members - MATLAB -
155 Eigen::Matrix<float,4,4, Eigen::DontAlign> coil_trans;
156 Eigen::Matrix<float,3,2, Eigen::DontAlign> eeg_loc;
157 fiff_int_t coord_frame;
158
159};
160
161//=============================================================================================================
162// INLINE DEFINITIONS
163//=============================================================================================================
164
166{
167 // On-disk layout: scanNo, logNo, kind, range, cal, chpos, unit, unit_mul, ch_name[16]
168 // (C++ class uses QString but on-disk stores fixed 16-char name)
169 return 3 * sizeof(fiff_int_t) + 2 * sizeof(fiff_float_t)
170 + FiffChPos::storageSize() + 2 * sizeof(fiff_int_t) + 16;
171}
172
173//=============================================================================================================
174
175inline bool operator== (const FiffChInfo &a, const FiffChInfo &b)
176{
177 return (a.scanNo == b.scanNo &&
178 a.logNo == b.logNo &&
179 a.kind == b.kind &&
180 a.cal == b.cal &&
181 a.chpos == b.chpos &&
182 a.unit == b.unit &&
183 a.unit_mul == b.unit_mul &&
184 a.coil_trans.isApprox(b.coil_trans, 0.0001f) &&
185 a.eeg_loc.isApprox(b.eeg_loc, 0.0001f) &&
186 a.coord_frame == b.coord_frame);
187}
188} // NAMESPACE
189
190#endif // FIFF_CH_INFO_H
bool operator==(const BIDSPath &a, const BIDSPath &b)
Coil-frame position record embedded inside FIFF_CH_INFO: coil location and 3x3 EX/EY/EZ orientation t...
Export/import macros and build-info accessors for the FIFFLIB shared library.
#define FIFFSHARED_EXPORT
Definition fiff_global.h:44
Primitive scalar typedefs and forward-compatible aliases backing the FIFF type system.
FIFF file I/O, in-memory data structures and high-level readers/writers.
bool operator==(const FiffChInfo &a, const FiffChInfo &b)
std::unique_ptr< FiffChInfo > UPtr
bool isValidEeg() const
static bool checkEegLocations(const QList< FiffChInfo > &chs, int nch)
static qint32 storageSize()
std::unique_ptr< const FiffChInfo > ConstUPtr
QSharedPointer< const FiffChInfo > ConstSPtr
Eigen::Matrix< float, 3, 2, Eigen::DontAlign > eeg_loc
QSharedPointer< FiffChInfo > SPtr
Eigen::Matrix< float, 4, 4, Eigen::DontAlign > coil_trans
Channel coil-frame placement: origin r0 (m) and orthonormal axes ex / ey / ez in FIFFV_COORD_DEVICE.
Definition fiff_ch_pos.h:63
static qint32 storageSize()