Fast, Accurate, and Robust Long-ECG Segmentation Through Multi-Point Iterative Warping and Dynamic Template Generation

Paolo G Cachi
Military Cardiovascular Outcomes Research (MiCOR)


Abstract

Introduction: Accurate segmentation of long-term electrocardiogram (ECG) signals is essential for diagnosing arrhythmias and monitoring cardiac health. While traditional methods, such as wavelet-based approaches, offer reasonable performance in controlled environments, they often fail to maintain reliability in real-world applications due to noise, beat variability, and morphological changes. Two-dimensional warping (2DW) is a promising solution for ECG segmentation that fits an annotated template to individual beats with high precision. However, its practical adoption is constrained by high computational demands and susceptibility to data drift.

Methods: We developed an enhanced 2DW framework integrating dynamic template generation—using an adaptive windowing detector (ADWIN) and beat-to-template cosine similarity tracking to continuously update the template in response to data drift—and multi-point iterative warping, which optimizes the alignment by minimizing the error at two points simultaneously, reducing computational overhead while improving precision. The framework was tested on 104 manually annotated 15-minute two-channel ECG recordings and benchmarked against original 2DW, discrete wavelet transform (DWT), and stationary wavelet transform (SWT). Metrics included sensitivity, robustness (segmentation error variability), and processing time.

Results: The enhanced 2DW framework achieved a sensitivity of 95.6%, slightly outperforming the original 2DW (94.8%) while significantly surpassing SWT (92%) and DWT (86%). It demonstrated superior robustness by minimizing variability in detecting Q-onset, T-offset, and QT interval. QT interval measurement accuracy improved significantly over the original 2DW (P = 0.037). Computational efficiency increased 5-fold, with processing times reduced from 171.44 seconds to 31.35 seconds per sample on an 8-core Apple M2 processor.

Conclusions: By combining dynamic template adaptation and optimized warping, our enhanced 2DW framework delivers improved accuracy, speed, and resilience to noise and arrhythmias in long-term ECG recordings. These advancements address critical challenges in real-time applications such as ambulatory cardiac monitoring, offering a scalable solution for remote patient care in resource-constrained environments.