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 <QStringList>
#include <limits>
#include <optional>
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(), Eigen::RowVectorXd *scores=nullptr)
 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, QStringList *bads=nullptr)
 Annotate spans where consecutive samples jump or stay flat, as mne.preprocessing.annotate_amplitude.

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. annotateMusclZscore band-pass filters the signal in the 110–140 Hz range (typical EMG band), z-scores the Hilbert envelope of every channel, combines and smooths the scores and marks samples above a threshold as BAD_muscle. annotateAmplitude marks spans where consecutive samples jump by more than a "peak" threshold or change by less than a "flat" one, and returns channels for which that holds too often as bad.

Both routines reproduce their MNE-Python counterparts mne.preprocessing.annotate_muscle_zscore and mne.preprocessing.annotate_amplitude onset for onset.

Definition in file annotate_artifact.h.