v2.0.0
Loading...
Searching...
No Matches
UTILSLIB::BadChannelDetect Class Reference

Automated detection of bad MEG/EEG channels using flat, variance, and correlation criteria. More...

#include <bad_channel_detect.h>

Public Types

using Params = BadChannelDetectParams

Static Public Member Functions

static QVector< int > detect (const Eigen::MatrixXd &matData, const Params &params=Params())
static QVector< int > detectFlat (const Eigen::MatrixXd &matData, double dThreshold=1e-13)
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)

Detailed Description

Automated detection of bad MEG/EEG channels using flat, variance, and correlation criteria.

// Run all three detectors with default parameters
QVector<int> bad = BadChannelDetect::detect(matData, p);
// Or run individual detectors
QVector<int> flat = BadChannelDetect::detectFlat(matData);
QVector<int> noisy = BadChannelDetect::detectHighVariance(matData);
QVector<int> weird = BadChannelDetect::detectLowCorrelation(matData);
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)

Definition at line 108 of file bad_channel_detect.h.

Member Typedef Documentation

◆ Params

Convenience alias so callers can still write BadChannelDetect::Params.

Definition at line 111 of file bad_channel_detect.h.

Member Function Documentation

◆ detect()

QVector< int > BadChannelDetect::detect ( const Eigen::MatrixXd & matData,
const Params & params = Params() )
static

Run all three detectors and return the union of bad channel row indices.

The order of the returned indices is ascending and each index appears at most once.

Parameters
[in]matDataData matrix (n_channels × n_samples), calibrated (SI units).
[in]paramsDetection parameters.
Returns
Sorted list of bad channel row indices (0-based).

Definition at line 93 of file bad_channel_detect.cpp.

◆ detectFlat()

QVector< int > BadChannelDetect::detectFlat ( const Eigen::MatrixXd & matData,
double dThreshold = 1e-13 )
static

Detect flat (dead) channels.

A channel is flat if its peak-to-peak amplitude over the whole segment is < dThreshold.

Parameters
[in]matDataData matrix (n_channels × n_samples).
[in]dThresholdMinimum peak-to-peak amplitude (SI units). Default 1e-13 T (0.1 fT).
Returns
Row indices of flat channels.

Definition at line 115 of file bad_channel_detect.cpp.

◆ detectHighVariance()

QVector< int > BadChannelDetect::detectHighVariance ( const Eigen::MatrixXd & matData,
double dZThresh = 4.0 )
static

Detect high-variance (noisy) channels.

Computes the per-channel standard deviation, then flags any channel whose z-score (relative to the median and MAD across channels) exceeds dZThresh. Using the median/MAD makes the test robust to a few very bad channels.

Parameters
[in]matDataData matrix (n_channels × n_samples).
[in]dZThreshZ-score threshold (default 4.0).
Returns
Row indices of high-variance channels.

Definition at line 129 of file bad_channel_detect.cpp.

◆ detectLowCorrelation()

QVector< int > BadChannelDetect::detectLowCorrelation ( const Eigen::MatrixXd & matData,
double dCorrThresh = 0.4,
int iNeighbours = 5 )
static

Detect low-correlation (isolated) channels.

For each channel, computes the mean absolute Pearson correlation with its iNeighbours nearest channels on each side of the channel list. A channel is flagged if this mean falls below dCorrThresh.

This detector is most useful for sensor arrays where physically close channels share common signal; it is less meaningful for widely-spaced EEG reference montages.

Parameters
[in]matDataData matrix (n_channels × n_samples).
[in]dCorrThreshMinimum acceptable mean absolute correlation (default 0.4).
[in]iNeighboursChannels on each side (default 5).
Returns
Row indices of low-correlation channels.

Definition at line 184 of file bad_channel_detect.cpp.


The documentation for this class was generated from the following files: