v2.0.0
Loading...
Searching...
No Matches
bad_channel_detect.h
Go to the documentation of this file.
1//=============================================================================================================
28
29#ifndef BAD_CHANNEL_DETECT_DSP_H
30#define BAD_CHANNEL_DETECT_DSP_H
31
32//=============================================================================================================
33// INCLUDES
34//=============================================================================================================
35
36#include "dsp_global.h"
37
38//=============================================================================================================
39// EIGEN INCLUDES
40//=============================================================================================================
41
42#include <Eigen/Core>
43
44//=============================================================================================================
45// QT INCLUDES
46//=============================================================================================================
47
48#include <QVector>
49
50//=============================================================================================================
51// DEFINE NAMESPACE UTILSLIB
52//=============================================================================================================
53
54namespace UTILSLIB
55{
56
57//=============================================================================================================
60{
61 // Flat signal
62 double dFlatThreshold = 1e-13;
63
64 // High variance
65 double dVarZThresh = 4.0;
66
67 // Low correlation
68 double dCorrThresh = 0.4;
69 int iNeighbours = 5;
70};
71
72//=============================================================================================================
88{
89public:
91
92 //=========================================================================================================
103 static QVector<int> detect(const Eigen::MatrixXd& matData,
104 const Params& params = Params());
105
106 //=========================================================================================================
117 static QVector<int> detectFlat(const Eigen::MatrixXd& matData,
118 double dThreshold = 1e-13);
119
120 //=========================================================================================================
133 static QVector<int> detectHighVariance(const Eigen::MatrixXd& matData,
134 double dZThresh = 4.0);
135
136 //=========================================================================================================
154 static QVector<int> detectLowCorrelation(const Eigen::MatrixXd& matData,
155 double dCorrThresh = 0.4,
156 int iNeighbours = 5);
157
158private:
159 //=========================================================================================================
164 static double pearsonCorr(const Eigen::RowVectorXd& a, const Eigen::RowVectorXd& b);
165
166 //=========================================================================================================
170 static double median(QVector<double> values);
171};
172
173} // namespace UTILSLIB
174
175#endif // BAD_CHANNEL_DETECT_DSP_H
Export/import macros and namespace declaration for the DSP library.
#define DSPSHARED_EXPORT
Definition dsp_global.h:50
Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).
Bad-channel detection parameters (defined outside class to avoid Clang/GCC default-argument issues wi...
Automated detection of bad MEG/EEG channels using flat, variance, and correlation criteria.
BadChannelDetectParams Params
static QVector< int > detect(const Eigen::MatrixXd &matData, const Params &params=Params())
static QVector< int > detectHighVariance(const Eigen::MatrixXd &matData, double dZThresh=4.0)
static QVector< int > detectLowCorrelation(const Eigen::MatrixXd &matData, double dCorrThresh=0.4, int iNeighbours=5)
static QVector< int > detectFlat(const Eigen::MatrixXd &matData, double dThreshold=1e-13)