v2.0.0
Loading...
Searching...
No Matches
annotate_artifact.h File Reference

Continuous-data annotation of muscle and amplitude artefacts. More...

#include "dsp_global.h"
#include <fiff/fiff_annotations.h>
#include <Eigen/Core>
#include <QString>
#include <limits>
Include dependency graph for annotate_artifact.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  UTILSLIB::AnnotateMusclParams
 Parameters for muscle artifact annotation. More...
struct  UTILSLIB::AnnotateAmplitudeParams
 Parameters for amplitude-based annotation. More...

Namespaces

namespace  FIFFLIB
 FIFF file I/O, in-memory data structures and high-level readers/writers.
namespace  UTILSLIB
 Shared utilities (I/O helpers, spectral analysis, layout management, warp algorithms).

Functions

DSPSHARED_EXPORT FIFFLIB::FiffAnnotations UTILSLIB::annotateMusclZscore (const Eigen::MatrixXd &data, const FIFFLIB::FiffInfo &info, double sfreq, const AnnotateMusclParams &params=AnnotateMusclParams())
 Detect muscle artifacts via high-frequency z-score and annotate bad segments.
DSPSHARED_EXPORT FIFFLIB::FiffAnnotations UTILSLIB::annotateAmplitude (const Eigen::MatrixXd &data, const FIFFLIB::FiffInfo &info, double sfreq, const AnnotateAmplitudeParams &params=AnnotateAmplitudeParams())
 Annotate segments where amplitude exceeds thresholds or is too flat.

Detailed Description

Continuous-data annotation of muscle and amplitude artefacts.

SPDX-License-Identifier: BSD-3-Clause Copyright (c) 2026 MNE-CPP Authors

Author
Christoph Dinh chris.nosp@m.toph.nosp@m..dinh.nosp@m.@mne.nosp@m.-cpp..nosp@m.org
Since
2.2.1
Date
May 2026

The detectors in this header scan continuous MEG / EEG data and emit FIFFLIB::FiffAnnotation intervals marking time segments that should be excluded from downstream averaging, ICA fitting or PSD estimation. annotateMuscleZscore band-pass filters the signal in the 110–140 Hz range (typical EMG band), takes the smoothed envelope across channels and z-scores it against the global median absolute deviation; samples whose z-score exceeds a user threshold are merged into BAD_muscle annotations. annotateAmplitude flags two boundary conditions instead: per-channel peak-to-peak amplitude exceeding an upper limit ("high-amplitude" artefact) and amplitude falling below a lower limit for longer than a minimum duration ("flat" / dead channel).

Both routines mirror the semantics of their MNE-Python counterparts mne.preprocessing.annotate_muscle_zscore and mne.preprocessing.annotate_amplitude so cross-toolchain pipelines produce identical bad-segment lists.

Definition in file annotate_artifact.h.