v2.0.0
Loading...
Searching...
No Matches
DECODINGLIB::MlIcaLabel Class Reference

Static utility that labels ICA components against EOG/ECG references and a muscle spectral heuristic. More...

#include <decoding_ica_label.h>

Static Public Member Functions

static QList< IcaLabelResultclassify (const Eigen::MatrixXd &matSources, const Eigen::MatrixXd &matEog, const Eigen::MatrixXd &matEcg, double dSFreq, double dEogThresh=0.3, double dEcgThresh=0.3)
static QVector< int > findArtifactComponents (const QList< IcaLabelResult > &labels)
static double maxAbsCorrelation (const Eigen::VectorXd &source, const Eigen::MatrixXd &matRef)
static double muscleScore (const Eigen::VectorXd &source, double dSFreq)

Detailed Description

Static utility that labels ICA components against EOG/ECG references and a muscle spectral heuristic.

classify walks the rows of the source matrix and applies, in order, the EOG correlation test, the ECG correlation test and the high-frequency muscle test; the first one whose score exceeds its threshold wins, otherwise the component is labelled Brain. The thresholds default to the canonical 0.3 used by the MNE-Python helpers and can be tightened or loosened per call. findArtifactComponents is the convenience that returns just the indices of the rejected components in the order expected by the ICA reconstruction code, making it a one-liner to wire automatic cleaning into a real-time pipeline.

The two scoring primitives — maxAbsCorrelation and muscleScore — are exposed publicly so an interactive viewer can display the per-component evidence behind each decision and let the user override the label without having to recompute the ICA itself. The class has no state, deleted constructor, and no virtual methods; it is purely a namespaced collection of pure functions.

QList<IcaLabelResult> labels = MlIcaLabel::classify(
icaSources, eogData, ecgData, sFreq);
QVector<int> artIdx = MlIcaLabel::findArtifactComponents(labels);
static QList< IcaLabelResult > classify(const Eigen::MatrixXd &matSources, const Eigen::MatrixXd &matEog, const Eigen::MatrixXd &matEcg, double dSFreq, double dEogThresh=0.3, double dEcgThresh=0.3)
static QVector< int > findArtifactComponents(const QList< IcaLabelResult > &labels)

Definition at line 135 of file decoding_ica_label.h.

Member Function Documentation

◆ classify()

QList< IcaLabelResult > MlIcaLabel::classify ( const Eigen::MatrixXd & matSources,
const Eigen::MatrixXd & matEog,
const Eigen::MatrixXd & matEcg,
double dSFreq,
double dEogThresh = 0.3,
double dEcgThresh = 0.3 )
static

Classify each ICA component using reference signals and spectral heuristics.

Parameters
[in]matSourcesICA sources (n_components x n_samples).
[in]matEogEOG reference channels (n_eog x n_samples). Can be empty.
[in]matEcgECG reference channels (n_ecg x n_samples). Can be empty.
[in]dSFreqSampling frequency in Hz.
[in]dEogThreshCorrelation threshold for EOG classification (default 0.3).
[in]dEcgThreshCorrelation threshold for ECG classification (default 0.3).
Returns
Label results for each component.

Definition at line 74 of file decoding_ica_label.cpp.

◆ findArtifactComponents()

QVector< int > MlIcaLabel::findArtifactComponents ( const QList< IcaLabelResult > & labels)
static

Extract indices of artifact components (EOG, ECG, muscle).

Parameters
[in]labelsLabel results from classify().
Returns
0-based indices of artifact components.

Definition at line 134 of file decoding_ica_label.cpp.

◆ maxAbsCorrelation()

double MlIcaLabel::maxAbsCorrelation ( const Eigen::VectorXd & source,
const Eigen::MatrixXd & matRef )
static

Compute the maximum absolute Pearson correlation between a source and reference channels.

Parameters
[in]sourceSource time course (n_samples).
[in]matRefReference channels (n_ref x n_samples).
Returns
Maximum |r| across reference channels.

Definition at line 149 of file decoding_ica_label.cpp.

◆ muscleScore()

double MlIcaLabel::muscleScore ( const Eigen::VectorXd & source,
double dSFreq )
static

Compute a simple spectral power ratio heuristic for muscle artifact detection. Muscle artifacts typically have high power above 30 Hz.

Parameters
[in]sourceSource time course (n_samples).
[in]dSFreqSampling frequency in Hz.
Returns
Ratio of high-frequency to total power (0 = no muscle, 1 = all muscle).

Definition at line 183 of file decoding_ica_label.cpp.


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