Professional Documents
Culture Documents
DEtect ECG Char Using Wavelet PDF
DEtect ECG Char Using Wavelet PDF
1, JANUARY 1995 21
Abstract-An algorithm based on wavelet transforms (WT’s) which an esophageal electrode is used to get high-amplitude
has been developed for detecting ECG characteristic points. P waves. This method can not be widely applied due to the un-
With the multiscale feature of WT’s, the QRS complex can be comfortable sensation caused by the esophageal electrode and
distinguished from high P or T waves, noise, baseline drift,
and artifacts. The relation between the characteristic points of lead wire. Other algorithms for P wave detection, including
ECG signal and those of modulus maximum pairs of its WT’s the syntactic method [5] and the hidden Markov methold [6],
is illustrated. By using this method, the detection rate of QRS are complex and time-consuming. Gritzali proposed a simple
complexes is above 99.8% for the MIT/BIH database and the method to detect P and T waves by “length transformation”
P and T waves can also be detected, even with serious baseline [7], but it is not robust to noise.
drift and noise.
Wavelet transform is a very promising technique for time-
frequency analysis. By decomposing signals into elementary
I. INTRODUCTION building blocks that are well localized both in time and
B. Equivalent Filter of WT
The discrete Fourier transform of WT is [13]
W 2 )f ( w ) =j ( w ) 4 ( 2 j w ) (a) (b) (C) (d) (e)
G(W)h)&$ j=1 Fig. 1. The relation between the characteristic points of simulation waves
and those of their WT's at different scales. The uniphase wave (a) is symmetric
G(24fWf(w)!&) j=2 and T, = 24-1 - 1 = 7 points. The uniphase wave (b) is not symmetric and
G(2j-'w)H(2j-'w). . . H ( w ) f ( w ) $ ( w ) j > 2 Tb - T, = 2 points. Complex (c) is symmetric and T, = T, = 7 points. h
={ (6) waves (d) and (e),Tdl < re,, T d 2 < Te2.Tel = 24-1 - 1 = 7 points and
Te2 = 24 + 24-' - 2 = 22 points.
where 4 is a smooth function, and f^(w)&w) is the discrete
Fourier transform of the ECG signal d, ( n E 2 ) [13]. From maximum-negative minimum pair with a delay of about 2j-l-
(6), the WT of f ( n ) at scale 2j is equal to a filtered signal of 1 points. The larger the scale, the bigger is the error between
d, that passed through a digital bandpass filter (or high pass the delay and 2j-l- 1. At small scale 2 l , the error is zero. At
filter for scale 2'). Let Q j ( w ) be the transform function of the large scale, the error is still tolerant. For example, in Fig. l(b),
equivalent filter. Then, we have the slope of rising edge is three times larger than that of the
dropping edge, but the error is only two points at ~ c a l e . 2 ~ .
Qj(w) = { z/;:)H(w) j =2
G(2j-'w)H(2j-'w) . . . H ( w ) j > 2.
j=1 From (8), we can see that the beginning point of q: is at
(7) 1 -2jP1, and the ending point of qh is at 2j 2j-l- 2.
So, the onset of a uniphase wave corresponds to the onset of
+
From (4),(3,and (7), we can deduce (see Appendix) a positive maximum-negative minimum pair with a delay of
1-23-l points, and the offset corresponds to an offset with a
&'(U) = -
83-1 c
2Jf2J-1-2
k=1-2J-1
qieikw (8)
+
delay of 2j 2j-l- 2 points, as shown in Fig. l(e).
Corresponding to 250/s ECG sampling rate, the amplitude-
frequency responses of the equivalent digital filters Q j ( w )
(131-2J-lfk = -q;2+23-1-2-k # '3 (j= 1, 2, . . . , 5 ) are illustrated in Fig. 2, and their 3-dB
IC E [l- 23-1,2j + 2j-1 - 21 bandwidths are listed in Table I.
where Q j ( w ) is an FIR digital filter with generalized linear C. Relation Between the Signal Singularity and its W S
phase [2]. The filter is antisymmetric and the time delay of its
Signal singularities often carry the most important infor-
central point is (the delay is considered as 2j-I- 1 points mation. It is important to find the location of singularity
in the algorithm). According to the form of the quadratic spline and characterize the singular degree in signal processing. The
wavelet [ l 11, we know that every uniphase wave, like the (a) singular degree is often described with the Lipschitz exponent
or (b) waves in Fig. 1, corresponds to a positive maximum- [ l l ] . On the pioneer work of Grossman [12], Mallat founded
negative minimum pair of WZ3f(n)at different scales. The the relation between the WT's and singularities of signals [ 111.
wave rising edge corresponds to a negative minimum, and the If wavelet $(x) is the first derivative of a smooth function,
dropping edge corresponds to a positive maximum at different then
scales. The moduli of these maxima or minima corresponding
to the same edge are named as the modulus maximum line. 1) When scale s is small enough, the maxima of 1 W,f (x)1
indicate the locations of sharp variation signal points.
If the uniphase wave is symmetric to its peak, as shown
in Fig. l(a), then its peak corresponds to the zero-crossing
point of the positive maximum-negative minimum pair with 2 ) The function f(z)is Lipschitz cy (0 < Q < 1) over
[a, b ] , if and only if there exists a constant A such that
a delay of exactly 2j-I- 1 points. If the uniphase wave is
for all x E [ a , b ] ,
not symmetric to its peak, as shown in Fig. l(b), then the
peak corresponds to the zero-crossing point of the positive I W 2 J f ( Z ) I5 (9)
LI et al.: DETECTION OF ECG CHARACTERISTIC POINTS USING WAVELET TRANSFORMS 23
a j can be calculated from j = J to j = J + N - 1. When the Next, eliminate redundant modulus maximum lines. Usu-
scale is large enough, a j ( n k ) will decrease to zero, no matter ally, the R wave corresponds to only two modulus maximum
the regularity of the signal at n k [3]. In fact, when j + +CO, lines. But, for some dual R waves or noise in the neighborhood
then [3] (120 ms) of a modulus maximum line, there are two or more
modulus maximum lines, only one of which is useful; the
others are redundant. The redundant modulus maximum lines
are eliminated by the rules described below.
Because the main energy of the QRS complex is at scale 23,
Hence, from (1 1), we can deduce aj 5 - 1 if j is big enough. the modulux maxima at this scale is analyzed. For example,
So, small scales should be selected [3], in order to avoid in the neighborhood (120 ms) of a positive maximum, there
aj 5 - 1. Therefore, a’ = aJ+’’.z+~v-l will be a better are two negative minimum. Let the two minima be Minl
and Min2, their absolute values be AI and A2, respectively,
approximation of the regularity exponent a.
At the characteristic scales from 2l to Z4, we can calculate and the intervals between the minima and maximum beL1
the a1, az, and a3 of a singularity point. The R wave always and L2, respectively. The rules of judging redundant modulus
corresponds to a1 > 0, and mostly a2 > 0. Although maximum lines are as follows:
some modulus maxima of R waves with higher frequency Rule 1: If A1/L1 > 1.2Az/L2, Min2 is redundant.
components decay fast at large scale to make a2 5 0, a1 a2 + Rule 2 : If A2/Lz > 1.2A1/L1, Minl is redundant.
is still greater than zero. For most R waves, their energies at Rule 3: Otherwise, if Minl and Min2 are on the same side of
scale 23 are larger than those at scale 24, and the decay of the positive maximum, then the minimum farther from the
I W 2 3 f ( n k ) l from Z3 to 24 is large enough to make not only maximum is redundant. If Minl and Min2 are on different
a3 < 0, but also a1 + + a2 a3 5 0. For high frequency sides of the maximum, then the minimum following the
noise and interference with sharp irregularities, there are also maximum is redundant.
a1 5 0, a2 5 0, and a3 5 0, hence al+az+a3 5 0. So, from With these judging rules, the R wave edge with the larger
+ +
the value of a1 a2 a3, the R wave, high frequency noise, slope and amplitude, or the positive R wave (corresponding
and interference can not be distinguished. Therefore, only a1 to positive maximum after negative minimum in a modulus
and a2 are selected and we let a’ = “1:“2 in order to make maximum pair) is selected.
a’ > 0 for most of the normal R waves. For distorted R waves, A similar procedure is implemented for the case of one neg-
the increasing of the low frequency components can only make ative minimum and two positive maxima, and the redundant
a’ much larger. So, if the a’ suddenly decreases greatly or even modulus maximum lines can also be eliminated.
becomes negative, the corresponding singularity point must be 5 ) Detection of the R Peak: According to the relation be-
noise or interference, which will be eliminated. tween signal characteristic points and those of WT depicted
4 ) Elimination of Isolation and Redundant Modulus Max- in Section 11, R peak can be located at a zero-crossing point
imum Lines: The frequency bands of motion artifact and of a positive maximum-negative minimum pair at scale 2’.
muscle noise often overlap with that of the QRS complex. After we eliminate the isolation and redundant lines from the
Ordinary bandpass filters can not eliminate or even decrease location set of modulus maximum lines, n:(k = 1 , 2 . . . N2)
their effects. In the location set of modulus maximum lines, in the remaining set is only composed of the locations of the
there may be those created by motion artifact and muscle noise. positive maximum-negative minimum pairs at scale 2’. Thus,
By eliminating isolation and redundant modulus maximum the zero-crossing points of these positive maximum-negative
lines, we can greatly reduce the effects of motion artifact and minimum pairs are found to obtain the locations of R peaks.
muscle noise. In R peak detection, four thresholds { €1, €2, €3, €4) are
First, eliminate isolation modulus maximum lines. The R used for the modulus maxima detection at four different
wave corresponds to a positive maximum-negative minimum scales. These thresholds are updated by the modulus maximum
pair at each characteristic scale and the interval of its two of WT’s of the most recently recognized QRS complex as
modulus maxima at scale 2l is shorter than its width, as follows:
shown in Fig. l(a). Suppose ni is the location of a positive
maximum (negative minimum) of W2,f(n)at scale 2l, and ni If IW23f(ni)I2 2A7 then A,”+1 = A?;
(IC = 1 . . . N I ,IC # 1) is the location of a negative minimum else A,”+’ = 0.875AY
(positive maximum) of W 2 J f ( nat) the same scale. If the + 0.1251W23f(ni)l.
interval between n: and ni (IC # 1) is larger than an interval Let el = 0.3A,”+’ 3 = 1,2.3,4
threshold, the maximum (minimum) at n: is considered the
isolation maximum (minimum). The corresponding modulus where IWZJf(ni)lis the modulus maximum of WT corre-
maximum line is an isolation line and should be eliminated sponding to the R wave. When IWZlf(n3,)12 2A,”, the
from the set of modulus maximum lines. The selected interval parameter A,”+’ maintains its original value so that the sudden
threshold should be approximately the same as the interval of increase of the QRS amplitude would not effect the next
the two modulus maxima created by the widest possible QRS judging.
complex in order that wide QRS complexes are not lost and In most cases, the algorithm correctly detects the R peak.
artifacts and noise are mostly eliminated. In this paper, the However, some tactics based on pioneer work [lo] are still
interval threshold is empirically defined as 120 ms. used to improve the detection.
LI et al.: DETECTION OF ECG CHARACXERISTIC POINTS USING WAVELET TRANSFORMS 25
I \ ', I
I 'I
Tactic 1: Blanking, where events immediately following a the power spectra of ECG signal, noise and artifact [8] and
QRS detection are ignored for a period of 200 ms. the passbands of filter Q j ( w ) at different scales in Table I, the
Tactic 2: Searching back, where previously rejected events energies of T and P waves are mainly at scales z4 and 25.
are reevaluated when a significant time has passed without But, baseline drift is serious at scale 25, so scale 24 is selected
finding a QRS complex. If no QRS complex was detected to detect T and P waves.
within 150% of the latest average RR interval, then we de- The T wave creates a pair of modulus maxima with a
tect the modulus maxima again at scale 23 with a threshold different sign of WzJf(n) at scale 24, within a time window
of 0.5 €3. If a positive maximum and negative minimum of after the detected R peak. Because the T wave is almost
WT are detected and the interval between them is less than symmetric to its peak, the peak of the T wave corresponds
120 ms, then their zero-crossing point is detected and the to the zero-crossing point of the modulus maximum pair with
reevaluated R peak can be found with a modification of 3 a 7 (24-1 - 1) point delay. The onset and offset of the T wave
(= 23-1- 1) points delay. correspond to the onset and offset of the modulus maxima pair
+
with delays of -7 ( 1 -24-1) and 22 (24 24-1- 2) points,
QRS Onset and OfSset Detection respectively. In practice, the points near the onset and offset
After the detection of R peaks, the onset and offset of the of the modulus maximum pair are also approximately zero
QRS complex are also detected. The onset of the QRS complex because the T wave is smoothed by the equivalent filter Q j ( U )
is defined as the beginning of the Q wave (or R wave when at large scale, so those actually detected are inside the interval
Q wave is not present), and the offset of the QRS complex between the onset and offset of the modulus maximum pair,
is defined as the ending of the S wave (or R wave when the as shown in Fig. l(d). When we detect the onset and offset
S wave is not present). of the modulus maxima pair, the onset is actually modified
Ordinarily, the Q and S waves are high frequency and low with a delay of -2 points and the offset is 17 points. These
amplitude waves and their energies are mainly at small scale. practice delays are empirical.
So, we detect the onsets and offsets of QRS complexes at The peak, onset, and offset of the P wave are detected
scale 2 l . From the (c) wave in Fig. 1, we can see that the similarly to those of the T wave within a time window before
onset of QRS corresponds to the beginning of the first modulus the detected R wave.
maximum before the modulus maximum pair created by the
R wave, and the offset of QRS corresponds to the ending IV. RESULTS
of the first modulus maximum after that modulus maximum We used the MIT/BIH arrhythmia database to evaluate our
pair. From the modulus maximum pair of the R wave, the algorithm. Only channel 1 of the two-channel ECG signal in
beginning and ending of the first modulus maxima before and the database was used. The WT's of some ECG signals with
after the modulus maximum pair are detected within a time serious high frequency noise, baseline drift, and artifacts are
window. The reason for detecting the beginning and ending shown in Fig. 3. In Table 11, we list QRS detection rates for
points at scale 2 l , rather than at the original signal, is to avoid records of the MIT/BIH database. The WT algorithm produces
the effect of baseline drift. 65 false positive (FP) beats (0.05%) and 112 false negative
(FN) beats (0.1%) for a total detection failure of 177 beats
C. T and P Wave Detection (0.15%). Record 105 is more noisy than the others; Record
After the detection of the QRS complex, the peaks, onsets, 108 has unusually high and sharp P waves; Record 203 has
and offsets of T and P waves are also detected. According to a great number of QRS complexes with multiform ventricular
26 IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING, VOL. 42, NO. 1, JANUARY 1995
TABLE II
RESULTSOF THE QRS DETEC~ON FOR THE h4IT/TjM DATABASE
ALGOR~THM
Type Total FP FN Failed Failed
detection detection
(beats) (beats) (beats) (beats) (2)
..........................................................
100 2273 0 0 0 0
101 1865 1 0 1 0
102 2187 0 0 0 0.11
103 2084 0 0 0 0
104 2230 8 2 10 0.45
105 2572 15 13 28 1.09
106 2027 2 3 5 0.25
107 2137 0 0 0 0
io8 1763 13 15 28 1.59
109 2532 0 0 0 0
111 2124 1 1 2 0.09
112 2539 2 1 3 0.12
113 1795 2 0 2 0.11
114 1879 3 0 3 0.16
115 1953 0 0 0 0
116 2412 0 1 1 0.04
117 1535 1 0 1 0.07
118 2275 1 0 1 0.04
119 1987 1 0 1 0.05
121 1863 2 1 3 0.16
122 2476 0 0 0 0
123 1518 0 0 0 0
124 1619 0 0 0 0
200 2601 0 1 1 0.04
201 1963 1 12 13 0.66
202 2136 0 1 1 0.05
203 2982 2 24 26 0.87
205 2656 0 1 1 0.04
207 1862 2 3 5 0.27
208 2956 0 4 4 0.14
209 3004 0 0 0 0
210 2647 3 3 6 0.23
212 2748 0 0 0 0
213 3251 0 0 0 0
217 2208 1 1 2 0.09
219 2154 0 0 0 0
220 2048 0 0 0 0
221 2427 0 7 7 0.29
222 2484 1 9 10 0.40
223 2605 0 2 2 0.08
228 2053 3 7 10 0.49
230 2256 0 0 0 0
231 1886 0 0 0 0
232 1780 0 0 0 0
233 3079 0 0 0 0
234 2753 0 0 0 0
-----_____---------_____________________------------------
TOTALS:116137 65 112 177 0.15
arrhythmia; and Record 222 has some non-QRS waves with 1) With multiscale information, it is easy to characterize the
highly unusual morphologies. These records often create more ECG waves, and the QRS complex is easy to distinguish
QRS detection errors with other algorithms [9], [lo], but from high P and T waves, noise, baseline drift, and
significant improvement was achieved with our WT algorithm. interference.
Some ECG records with artifact, serious noise, and baseline 2) A quadratic spline wavelet with compact support is
drift are illustrated in Fig. 4, in which the detected character- used. It has generalized linear phase so there is a
istic points are marked. determinate relation between ECG characteristic points
and the modulus maxima, or the zero-crossing points,
V. CONCLUSION
AND DISCUSSION of the WT’s.
In this paper, we present an algorithm based on WT for the 3) A QRS complex corresponds to a modulus maxima pair
detection of QRS, T, and P waves of ECG. There are several of the WT. On the contrary, an artifact having only a
distinct features to our method. rising or dropping edge in a certain time corresponds
LI et al.: DETECTION OF ECG CHARACTERISTIC POINTS USING WAVELET TRANSFORMS 21
R
R
Fig. 4. The detected ECG waves. The symbol R marks the locations of R peaks, where the positive R waves are marked above and the negative ones
are marked below. The symbols Q and S mark the beginning and ending locations of QRS complexes. The symbols P and T mark the peak locations
and widths of P and T waves, respectively. (a) and @) Different noise. (c) Baseline drift. (d) Artifacts. (e) High P waves. (f) High T waves. (8)
and (h) Multiform ventricular arrhythma beats.
to only one modulus maximum of the WT. So, the relation between the characteristic points of ECG and those
algorithm can greatly reduce the effect of artifact. of their WT’s can be found. Therefore, these wavelets do not
4) The algorithm can detect not only QRS complex, but give detection results as good as the spline wavelets.
also the T and P waves. So, other detailed character- From the results, we know that the onsets and offsets of P
istics, for example, ST segment and RR rate, etc., can and T waves may not be detected to an accuracy required for
easily be obtained. morphological diagnosis when they are influenced seriously
Besides the quadratic spline wavelet, we also used higher by noise or baseline drift or their amplitudes are too small.
order spline wavelets, whose Fourier transforms are as Also, only the uniphase P and T waves are considered in this
follows: paper. This method can be considered for further development
-)
$(w) = i,(sinw/4 2n+1
n = 2,3,4.
and supplemented with other techniques for the biphase P and
T waves, and this will be our further research work.
The algorithm is implemented on a 486-DX33 personal
computer with C Language. Processing 10 min ECG data
The equivalent filters of the WT’s using these wavelets (250/s sampling rate) requires 1 min, on average. This speed is
have bandwidths approximating those of the quadratic spline not good enough to analyze long-time ambulatory ECG data.
wavelet, so the results of ECG detection with these wavelets But, this algorithm is promising with higher speed computers
are almost the same as those with quadratic spline wavelet. or microprocessors.
But, the coefficient series of their equivalent filters is longer The algorithm for detecting ECG characteristic points based
than that of the quadratic spline wavelet, so more time is on WT shows the potential of the WT, especially for process-
required to calculate their WT’s. ing time-varying biomedical signals. The power of WT lies
Daubechies’ orthonormal wavelets [16] are also used in in its multiscale information analysis which can characterize
our experiments. But, the orthonormal wavelet does not have a signal very well. It is clear that the WT method will lead to
linear phase or generalized linear phase [2], so no determinate a new way of biomedical signal processing.
28 IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING, VOL. 42, NO. 1, JANUARY 1995