v2.0.0
Loading...
Searching...
No Matches
fiff_ch_info.cpp
Go to the documentation of this file.
1//=============================================================================================================
20
21//=============================================================================================================
22// INCLUDES
23//=============================================================================================================
24
25#include "fiff_ch_info.h"
26#include "fiff_constants.h"
27
28//=============================================================================================================
29// USED NAMESPACES
30//=============================================================================================================
31
32using namespace FIFFLIB;
33
34//=============================================================================================================
35// DEFINE MEMBER METHODS
36//=============================================================================================================
37
39: scanNo(0)
40, logNo(0)
41, kind(0)
42, range(1.0f)
43, cal(1.0f)
44, unit(0)
45, unit_mul(0)
46, ch_name(QString(""))
47, coil_trans()
48, eeg_loc()
50{
51 coil_trans.setIdentity();
52 eeg_loc.setZero();
53}
54
55//=============================================================================================================
56
58: scanNo(p_FiffChInfo.scanNo)
59, logNo(p_FiffChInfo.logNo)
60, kind(p_FiffChInfo.kind)
61, range(p_FiffChInfo.range)
62, cal(p_FiffChInfo.cal)
63, chpos(p_FiffChInfo.chpos)
64, unit(p_FiffChInfo.unit)
65, unit_mul(p_FiffChInfo.unit_mul)
66, ch_name(p_FiffChInfo.ch_name)
67, coil_trans(p_FiffChInfo.coil_trans)
68, eeg_loc(p_FiffChInfo.eeg_loc)
69, coord_frame(p_FiffChInfo.coord_frame)
70{
71}
72
73//=============================================================================================================
74
78
79//=============================================================================================================
80
81bool FiffChInfo::checkEegLocations(const QList<FiffChInfo>& chs, int nch)
82{
83 const float close = 0.02f;
84 for (int k = 0; k < nch; k++) {
85 if (chs.at(k).kind == FIFFV_EEG_CH) {
86 if (chs.at(k).chpos.r0.norm() < close) {
87 qCritical("Some EEG channels do not have locations assigned.");
88 return false;
89 }
90 }
91 }
92 return true;
93}
94
95//=============================================================================================================
96
98{
99 constexpr float TOO_CLOSE = 1e-4f;
100 return kind == FIFFV_EEG_CH
101 && chpos.r0.norm() >= TOO_CLOSE
102 && chpos.coil_type != FIFFV_COIL_NONE;
103}
Symbolic FIFF tag, block, value, unit and channel-type constants shared across FIFFLIB.
#define FIFFV_EEG_CH
#define FIFFV_COORD_UNKNOWN
#define FIFFV_COIL_NONE
FIFF channel descriptor record (FIFF_CH_INFO): per-channel logical/scanner numbers,...
FIFF file I/O, in-memory data structures and high-level readers/writers.
bool isValidEeg() const
static bool checkEegLocations(const QList< FiffChInfo > &chs, int nch)
Eigen::Matrix< float, 3, 2, Eigen::DontAlign > eeg_loc
Eigen::Matrix< float, 4, 4, Eigen::DontAlign > coil_trans