Software Credentialed Access

NeuroBrowser: Rapid Annotation of Interictal Epileptiform Discharges via Template Matching under Dynamic Time Warping

Jin Jing M. Brandon Westover

Published: July 2, 2026. Version: 1.0.0


When using this resource, please cite: (show more options)
Jing, J., & Westover, M. B. (2026). NeuroBrowser: Rapid Annotation of Interictal Epileptiform Discharges via Template Matching under Dynamic Time Warping (version 1.0.0). Brain Data Science Platform. https://doi.org/10.60508/555k-1c08.

Abstract

EEG interpretation relies on experts who are in short supply, creating a need for automated pattern-recognition systems to assist with interpretation. Progress has been limited by a lack of expert-annotated data. We developed NeuroBrowser, an integrated system for EEG review and rapid waveform annotation whose core is ultrafast template matching under Dynamic Time Warping (DTW). An expert marks one example of a target waveform; NeuroBrowser then rapidly finds every similar waveform in the recording and asks the expert only to accept or reject the suggestions.

In the original study, NeuroBrowser reduced the time required to annotate interictal epileptiform discharges (IEDs) by 20-90% (mean ~70%), and was used to extract 19,000+ IEDs from 100 patient EEG recordings - to our knowledge the largest annotated database of IEDs at the time. While tailored to IEDs in scalp EEG, the approach generalizes to other waveforms and signal types.


Background

Epilepsy affects ~65 million people worldwide, and EEG is central to its diagnosis. Manual review of EEG for interictal epileptiform discharges is slow and requires scarce expert time, which in turn limits the annotated datasets needed to train automated detectors. NeuroBrowser attacks this bottleneck with a human-in-the-loop, example-driven search: rather than annotating every waveform from scratch, an expert supplies a template and adjudicates candidate matches surfaced by fast similarity search.

Dynamic Time Warping is a robust similarity measure for time series because it tolerates local stretching and compression of the time axis - well suited to the morphological variability of spikes. DTW has historically been considered too slow for interactive use; NeuroBrowser overcomes this with the UCR Suite / "Trillion" lower-bounding algorithm (Rakthanmanon et al., KDD 2012; E. Keogh and T. Rakthanmanon are co-authors of this work), which prunes the search with cheap lower bounds and early abandoning.


Software Description

This release accompanies the open-source reimplementation of the NeuroBrowser matching engine (see Code below) and provides a small, fully de-identified demo dataset so that the method can be run and reproduced end-to-end.

Demo dataset (in the code repository)

  • data/Callbacks/Templates.mat - 221 spike templates (3 s at 128 Hz) with five fiducial points each.
  • data/Data/<subject>_SEG_<id>.mat - 24 de-identified 10 s, 19-channel EEG event segments (common-average montage) with expert vote scores.

Coverage caveat. The full corpus of 19,000+ IEDs from 100 patients described in the paper is not part of this initial release; the demo bundle is a representative, release-approved subset sufficient to run the matcher and reproduce the core spike-vs-background separation result. The full credentialed dataset may be released here in a future version under the BDSP data-use agreement.


Technical Implementation

Data

Thirty-minute scalp EEG recordings from 100 patients with epilepsy (Massachusetts General Hospital), recorded from 19 electrodes (10-20 system), down-sampled to 128 Hz, high-pass filtered at 0.1 Hz with a 60 Hz notch.

Template matching under DTW

A short expert-selected template (query) is compared to every equal-length subsequence of the EEG under a Sakoe-Chiba-band-constrained DTW distance. Signals are band-pass filtered (1-40 Hz) and transformed with a Teager non-linear energy operator to emphasize spike morphology before matching.

Ultrafast similarity search (UCR Suite)

Four ideas make DTW fast enough for interactive use: (1) online z-normalization, (2) the LB_Kim and (3) LB_Keogh lower bounds with early abandoning, and (4) reordered early-abandoning DTW. Candidates are pruned with cheap lower bounds before any full DTW is computed.

Human-in-the-loop annotation

The expert (i) provides templates and (ii) accepts or rejects suggested matches. Accepted waveforms are marked in the EEG and accumulated into the annotated database.


Installation and Requirements

Install the reference implementation from GitHub:

git clone https://github.com/bdsp-core/neurobrowser.git
cd neurobrowser
pip install -e ".[plot,dev]"

Requires Python 3.9+, NumPy, and SciPy (matplotlib for the figures). An optional C accelerator compiles automatically for ~120x faster similarity search; a pure-Python fallback is used if no C compiler is present.


Usage Notes

Code

The reference implementation lives on GitHub at https://github.com/bdsp-core/neurobrowser (BSD-3-Clause). It is a pure-Python (NumPy/SciPy) port of the DTW template-matching engine, with an optional C accelerator implementing the full UCR Suite cascade (~120x faster, identical results).

Install

git clone https://github.com/bdsp-core/neurobrowser.git
cd neurobrowser
pip install -e ".[plot,dev]"

Quick start

import neurobrowser as nb
templates = nb.load_templates("data/Callbacks/Templates.mat")
event     = nb.load_event("data/Data/s117_SEG_10783.mat")
res = nb.match_event(event, templates)
print(res.template_index, res.distance, res.location)

Reproduce

python examples/demo_match.py      --data data
python examples/reproduce_fig2b.py --data data   # spike vs background DTW separation
python examples/benchmark.py                     # speed: naive vs Python vs C

Search your own signals

dist, loc = nb.ucr_knn_dtw(query, data, r=0.05, k=3)

Release Notes

Version 1.0.0 - initial release accompanying the open-source Python reimplementation of the NeuroBrowser DTW template-matching engine (Jing et al., J. Neurosci. Methods 274, 2016, doi:10.1016/j.jneumeth.2016.02.025), including a de-identified demo dataset and reproduction scripts.


Ethics

The EEG data were collected at Massachusetts General Hospital under Institutional Review Board approval and analyzed in de-identified form.


Acknowledgements

This work was supported in part by the Singapore Ministry of Education (MOE) Tier 1 grants M4010982.040 and M4011102.040 (J. Jing and J. Dauwels); NIH-NINDS K23 NS090900, the Rappaport Foundation, and the Andrew David Heitman Neuroendovascular Research Fund (M. B. Westover); and NIH-NINDS R01 NS062092 (S. S. Cash). We are grateful to Dr. Andrew James Cole and Dr. Catherine J. Chu at Massachusetts General Hospital for their collaboration and assistance.


Conflicts of Interest

M. Brandon Westover is a co-founder of, scientific advisor to, consultant for, and has a personal equity interest in Beacon Biosignals. Jin Jing receives author royalties from Springer Publishing. There are no other competing interests related to this work.


Share
Access

Access Policy:
Only credentialed users who sign the DUA can access the files.

License (for files):
BDSP Credentialed Health Data License 1.5.0

Data Use Agreement:
BDSP Credentialed Health Data Use Agreement

Required training:

Corresponding Author
You must be logged in to view the contact information.

Files