Francisco Zambrano

Research

A reproducible pipeline for cleaning and reconstructing EEG

Problem

My thesis, for my biomedical engineering degree, used EEG data from a Chilean FONDECYT research project. EEG records brain activity through scalp electrodes, but recordings routinely contain channels or time segments with no biological information: loose electrodes, impedance changes, muscle and eye artifacts, line noise. Labs often clean these by hand, which is slow and hard to reproduce.

The goal was one automated protocol that takes raw recordings in and returns usable data out, with every step evaluated by a quantitative metric instead of visual inspection.

Method

The protocol builds on EEGLAB (MATLAB) and published state-of-the-art techniques, chained into one parameterized script:

  1. Load and decimate. Recordings above 500 Hz are halved to 250 Hz to cut compute without losing the band of interest.
  2. High-pass filter at 1 Hz to remove slow drifts from eye movement and impedance changes.
  3. Line-noise removal at 50 Hz and harmonics with CleanLine.
  4. Bad channel and artifact rejection with clean_rawdata and Artifact Subspace Reconstruction (ASR), controlled by a burst criterion k.
  5. Channel reconstruction by spherical spline interpolation (SSI), compared against a geodesic-distance method.
  6. Average re-referencing.
  7. Spectral trial rejection using the 30–100 Hz band to flag muscle contamination.
  8. ICA decomposition and automatic labeling with ICLabel; non-brain components (eye, muscle) are removed.
  9. Dipole fitting with DIPFIT. A component counts as dipolar when its residual variance is below 0.15, the plausibility threshold used in the literature.

Every threshold is a parameter (filter cutoffs, ASR k, label and residual-variance thresholds, epoching window), so the same code runs on different experiments.

Results

The protocol was run on 64-channel recordings (10-10 montage) from 10 subjects. The headline metric is the number of dipolar independent components, a proxy for how much physiologically plausible brain signal survives cleaning.

0 → 79dipolar components across 10 subjects, raw vs. protocol
9 of 10subjects with at least 2 dipolar components after the protocol
k = 20–30ASR setting that balanced signal kept against artifact removal
SubjectDipolar ICs, rawDipolar ICs, after protocol
C1109
C1202
C1300
C1407
C15011
C1609
C17020
C1805
C1904
C21012

One subject (C13) did not improve. With 10 subjects and 64 channels, I treat this as evidence that the protocol works, not as a general benchmark.

The key tuning knob: ASR burst criterion

EEGLAB's default k is 5 to 7. In this dataset lower values removed more artifacts but also discarded more neural signal. A value between 20 and 30 retained far more usable signal while still producing dipolar components, so I recommend it as the default for exploratory analysis. Where signal purity matters more than data volume, such as connectivity or ERP studies, lower values (5 to 12) remain appropriate.

Signal preserved versus ASR burst criterion k
Signal preserved as a function of the ASR burst criterion k. Higher k keeps more signal. (Axis labels in Spanish.)
Independent component classes versus ASR k
Composition of independent components by ICLabel class and dipolarity, for each k. (Labels in Spanish: Dipolar, No Dipolar, Muscular, Ocular, Otros.)
Share of independent components retained versus k
Share of independent components retained for each k. (Labels in Spanish.)
Average power of component activity by ICLabel class
Average power of component activity by ICLabel class (brain, eye, muscle, other).

Channel reconstruction

Removed channels were rebuilt by spherical spline interpolation and scored against the original signal with MAE and MSE per subject, then compared with a geodesic-distance approach.

MAE of spherical spline interpolation by subject
Mean absolute error of spherical spline interpolation per subject, after the most aggressive ASR setting (k = 5).

Limits

Ten subjects and 64 channels bound how far the conclusions extend, and runtime is limited by available RAM. The thesis discussion also notes that artifact reduction was smaller than expected and many components remained artifactual, which held back the number of dipolar components.