Documente Academic
Documente Profesional
Documente Cultură
Brigham & Women’s Hospital is designing a wire- order to accommodate many patients and caregivers,
less monitoring system for patients in the waiting and allocate time to other tasks such as location
area of the Emergency Department. A real–time ECG tracking, alarm handling, storage and retrieval of his-
algorithm is required to monitor and alert changes torical data, and resource management. Also, system
in patients that have not yet been admitted to the dependability is tightly tied to an accurate screening
Emergency Room. For this purpose, three simple of alarms. Response times may improve only if false
algorithms are compared in terms of processing time, alarms are kept to a minimum. To conform to all these
beat detection accuracy and heart rate (HR) esti- requirements, the selected ECG processing algorithm
mation. Varying amounts of noise were added to must be fast, noise resistant and accurate.
records from the MIT-BIH Arrhythmia Database [1] This paper presents an evaluation of three different
to mimic expected waiting room conditions. Some ECG processing algorithms for SMART Central. The
recommendations regarding selection of an algorithm first one, a peak detection algorithm (Peak), is an
and further processing of HR series are presented. improved version from a simple peak detector [4]
originally used to test the SMART system. The other
Introduction two, a slope detector (SQRS) [5] and a Length–
Patients who arrive at a hospital Emergency De- Transform based algorithm (WQRS) [6] are easily
partment (ED) are triaged and sent to a waiting accessible on the web [1]. They were selected for their
area until a caregiver becomes available. It is not simplicity and ease of integration into a streaming
uncommon to wait for a very long time for medi- database. Many more algorithm descriptions can be
cal attention, especially if the initial triage did not found in [7], which gives an overview of the state of
detect an impending medical condition. The SMART the art in ECG processing.
(Scalable Medical Alert and Response Technology)
project aims to monitor those patients in order to Methods
help triage, assist in resource management and pro- Our testbed was programmed in C++. It provides
vide better tools to evaluate patients [2]. The goal a similar streaming-database framework to SMART
is to develop a scalable system, easy to deploy in Central, and allows us to perform tests on standard
emergency situations and locations, and dependable databases simply by adding interfaces to them. Data
in terms of avoiding false alarms and misdirections. are streamed to a small buffer, which is processed
The monitoring devices will include a single– by one of the algorithms and then forwarded to an
lead ECG and a SpO2 sensor. Both signals will be output buffer. Our testbed also has the ability to save
timestamped and buffered in a portable device and the output as annotations in PhysioNet–compatible
sent wirelessly to the SMART Central. Then, the data [1] format or as Matlab / Octave [8] readable text
are directed to a streaming database with processing files. Once tested and tuned, code migration from our
nodes. These computation nodes will transform, in testbed to SMART Central is straightforward.
real–time, the raw data streams into more usable The data set used for testing was the complete
information [3] such as heart rate (HR). MIT-BIH Arrhythmia Database [1], available online
ECG algorithms must meet certain requirements in at www.physionet.org. We selected this database to
order to be useful for the SMART project. As patients try to mimic the ED conditions: different patients with
walk around or even shift in place while in the waiting varying heart conditions. The MIT-BIH Arrhythmia
area, artifacts from sensor displacement, muscle noise Database contains 48 half-hour ECG recordings from
and baseline wander appear in the signal. The scalable 47 different subjects. To evaluate their sensitivity to
premise implies that the processing must be fast, in noise, we generated 6 different noise level recordings
Amplitude
any signal on their database. We selected 6 different -100
noise and baseline wander. Noise is added after the Fig. 1. Peak Algorithm. A beat is detected if the window
first 5 minutes of the signal, in alternating 2 minutes maximum is also the segment maximum and both are greater than
segments of noise and clean signal. a threshold.
In order to provide maximum portability, we want
2000
the algorithms to be independent of signal amplitude 1000
Amplitude
-1000
and also to automate the testing of all of the records. Fig. 2. SQRS Algorithm. A beat is detected when the filtered
The test consists of running each one of the three signal crosses a threshold 2 to 4 times. When there are more than
4 crossings the position is marked as an artifact.
algorithms on the 288 data files. Each test is run
twice, once to save computation times and once to ECG signal [5]. Using a variable threshold, it detects
generate a file with beat annotations. The annotations and identifies QRS complexes from artifacts. The C
are compared to the reference annotations by an code was extracted from PhysioNet [1] web site and
external program, and aggregated by noise level. We adapted to handle data streams.
used PhysioNet’s “bxb” program to compare beat to The filter mask is [1 4 6 4 1 -1 -4 -6 -4 -1] and has
beat annotations using the default values: comparison its maximum gain at 0.1 · Fs or 36 Hz for a signal
begins after the first 5 minutes and the matching sampled at 360 Hz. This convolution filter is applied
window is 0.15 s long. Finally, we computed HR from to a vector containing the last 10 values acquired from
the annotations and post–processed them in Octave. the ECG signal, to enhance its slope. If the filtered
signal is greater than a threshold, the time is saved
Algorithm Descriptions and the algorithm enters a decision phase. Two to
A. Peak detector four of these detections within 160ms of each other
The Peak detector algorithm is applied directly to indicate that a normal beat was identified. More than
the ECG data. It uses a 167 ms window, divided in 4 detections within 200ms of each other indicate an
three 55.6 ms segments. This limits our maximum artifact. After a decision has been made, the algorithm
detectable beat frequency to 360 BPM. It scans the is reset. Once every 2 seconds, if there is no detection,
whole range looking for the maximum value. If the the threshold is reduced by 1/16th . If there are more
maximum value is on the central segment and is than 4 detections, the threshold is increased by 1/16th .
higher than a threshold, the position is marked as a Every time a normal beat is detected, the threshold is
beat and its amplitude is saved as the new threshold. recalculated, asymptotically converging to 1/4 of the
At each new possible beat, the threshold is updated, maximum filter output obtained so far. Fig. 2 shows
using a linear decay between the previous beat ampli- the SQRS filter output for the same ECG signal used
tude and the current window maximum, at a variable in fig. 1.
rate of
last beat ampl. − current peak ampl. 72 C. WQRS algorithm
· (1)
2 60 The original WQRS algorithm was obtained from
The threshold may only decrease unless it is set by PhysioNet [1] and adapted to handle data streams. It
a new beat detection. Fig. 1 shows an example, in is based on the Length Transform [6] of the ECG.
which an extra beat is detected due to a high P wave For a discrete, one channel signal, the Length
and a rising baseline. Transform of a signal x[n] using a window q can
be calculated by:
B. SQRS algorithm
i+q−1
X p
SQRS algorithm uses a Finite Impulse Response Li = 1 + (xk − xk−1 )2 (2)
(FIR) filter as an approximation to the slope of an k=i
60000
60
[%]
50000
50 Peak Alg. Se
40000
40 Peak Alg. +P
30000 SQRS Alg. Se
20000 30 SQRS Alg. +P
20 WQRS Alg. Se
10000 WQRS Alg. +P
0 10
0 1 2 3 4 5 24 dB 18 dB 12 dB 6 dB 0 dB -6 dB
Time [s] SNR
Fig. 3. WQRS Algorithm. A beat is detected if the Length Fig. 4. Sensitivity and Positive Predictivity by algorithm and noise
Transform of the signal is higher than a threshold. level.
TABLE I B EAT POSITIONS FOR FIGURES 1, 2 AND 3. data points collected at a sampling rate of 360 Hz
Reference beats [s] 0.43 1.58 2.76 – 3.91 and spanning 1806 s. Consequently, the final running
Peak alg. beats [s] 0.40 1.56 2.73 3.74 3.89 times are directly comparable.
SQRS alg. beats [s] 0.39 1.54 2.72 – 3.87 The results are shown in table II. These are only
WQRS alg. beats [s] 0.43 1.58 2.76 – 3.92
WQRS J-points [s] 0.53 1.69 2.87 – 4.02
useful as a reference for how the algorithms compare
to each other. The actual computation time will de-
pend on the processor used and the signal sampling
Our implementation considers a window length of
frequency. The estimated load for the initial SMART
130 ms, in order to maximize the detection of QRS
deployment goal of 16 simultaneous ECGs sampled
complexes. After the transformation, the output is
at 200 Hz is
compared to a threshold and then further tested for a
rising slope of the Length Transform. This algorithm Alg. run time 200
Alg. load [%] = · · 16 · 100 (3)
has the extra ability to mark the end of the QRS 1806 360
complex, also known as J–point. Fig. 3 shows the Using equation 3, the estimated maximum load from
Length Transform of the ECG signal from fig. 1, and running the algorithms is 1.47% for Peak, 2.41% for
the detected onset and offset of the QRS complex. SQRS and 5.06% for WQRS algorithm. In a stream-
ing database environment, the load is the computation
D. Beat detection
time required by unit time of fed data.
Table I shows the detected beat positions reported
by the algorithms for the original ECG signal from B. Beat Detection Accuracy
Fig. 1. The reference beat positions are obtained from Beat detection accuracy is normally evaluated using
the annotation file associated to the clean record. Note two parameters [7]: Sensitivity (Se) and Positive
that there is a small shift in beat positions. However, Predictivity (+P ).
they are all within 150 ms of the reference, and thus
TP TP
considered matching beats. The only unmatched beat Se = , +P = (4)
in our example was detected by the Peak algorithm TP + FN TP + FP
at 3.74 s. where,
T P : number of true positive detections.
Results F N : number of false negatives or missed beats.
A. Processing Time F P : number of false positives or false beats.
The tests were performed on an AMD AthlonTM Table III shows the aggregated T P , F N and F P
64 Processor 3200+, running at 2 GHz, with 1 GB obtained in each case. A total of 547,710 beats were
physical memory. The computation time was mea- tested for each algorithm, resulting in either detected
sured from the start of reading the data into the input beats (T P ) or missed beats (F N ). Table IV and figure
buffer until all the nodes that were chained to that 4 show the results by noise level. WQRS algorithm
input buffer had completed their tasks. All records provides the best Se for the whole noise range, while
from MIT-BIH Arrhythmia Database have 650,000 SQRS has the best +P up to 0 dB SNR. SQRS Se
TABLE II AVERAGE COMPUTATION TIME BY NOISE LEVEL of 19.33% at -6 dB SNR deserves special note. It is
Noise Peak alg. SQRS alg. WQRS alg. unexpected to obtain a Se under 50% for an algorithm
(SNR) mean time [s] mean time [s] mean time [s] that has a Se > 95% for clean signals. Since noise
24 dB 2.982 4.992 10.636 is introduced in alternating 2 minute intervals, the
18 dB 2.949 5.002 10.578
12 dB 2.977 5.020 10.255 expected Se for a very noisy test signal is close to
6 dB 2.993 4.964 10.127 50%. Upon closer examination, it is apparent that the
0 dB 3.070 4.717 10.003 threshold is increased during the noisy interval to a
-6 dB 2.985 4.706 10.090
Average 2.993 4.900 10.281 point that it takes almost the whole clean interval to
return to a suitable range.
Alg. TP FN FP Se +P 500
Amp.
SQRS 402,284 145,426 36,553 73.45 91.67 -500
WQRS 500,700 47,010 117,595 91.42 80.98 ECG
Peak Beats
-1000 SQRS Beats
WQRS Beats
-1500 Ref Beats
410 415 420 425 430
TABLE IV A LGORITHM Se AND +P [%] BY NOISE LEVEL . time [s]
(a) Beat detection in a 20 s. sample from record 119 with 6 dB
Noise Peak alg. SQRS alg. WQRS alg. SNR. Noise ends at 500 s.
(SNR) Se +P Se +P Se +P
24 dB 91.92 93.85 95.96 99.69 98.37 96.87 450
HR Peak alg.
18 dB 91.54 92.90 95.74 99.57 98.27 95.45 400 HR SQRS alg.
HR WQRS alg.
350
12 dB 88.93 86.60 94.51 98.22 97.00 84.09 300
Reference HR
HR
0 dB 68.86 69.18 50.17 79.31 87.27 71.73 200
150
-6 dB 64.42 65.76 19.33 53.43 73.07 65.93 100
50
0
410 415 420 425 430
HR
HR errors come from both missed beats (F N ) and
200
150
250
FN 1 − Se FP 1 − +P
HR
200
= , = (6) 150
TP Se TP +P 100
50
40
30
20 noise episode, as is the case of figure 6(d).
10
0
24 dB 18 dB 12 dB 6 dB 0 dB -6 dB
Table V confirms these observations when we post–
SNR process the HR series for the whole database. As an
Fig. 5. Heart Rate error probability. indication of the HR variability, the standard deviation