Você está na página 1de 7

See discussions, stats, and author profiles for this publication at: https://www.researchgate.

net/publication/228612034

ECG feature extraction using Daubechies wavelets

Conference Paper · January 2005

CITATIONS READS

145 7,965

3 authors, including:

Alireza Ahmadian
Tehran University of Medical Sciences
190 PUBLICATIONS 1,285 CITATIONS

SEE PROFILE

Some of the authors of this publication are also working on these related projects:

calculation and compensation of brain shift by using intra-operative ultrasound View project

Parsiss navigation system View project

All content following this page was uploaded by Alireza Ahmadian on 17 March 2014.

The user has requested enhancement of the downloaded file.


ECG FEATURE EXTRACTION USING DAUBECHIES WAVELETS
S. Z. Mahmoodabadi1,2(MSc), A. Ahmadian1,2 (Phd), M. D. Abolhasani1,2(Phd)
szarei@razi.tums.ac.ir , ahmadian@sina.tums.ac.ir , abolhassanim@sina.tums.ac.ir

1- Tehran University of Medical Sciences (TUMS), Tehran, Iran


2- Research Center for Science and Technology in Medicine (RCSTIM), Tehran, Iran

Abstract: In this work, we have developed and Producing an algorithm for the detection of the P wave,
evaluated an electrocardiogram (ECG) feature QRS complex and T wave in an ECG is a difficult
extraction system based on the multi-resolution wavelet problem due to the time-varying morphology of the
transform. ECG signals from Modified Lead II (MLII) signal subject to physiological conditions and the
are chosen for processing. The result of applying two presence of noise [4]. Recently, a number of techniques
wavelet filters (D4 and D6) of different length on the have been proposed to detect these features [1-3][11].
signal is compared. The wavelet filter with scaling Here our procedure using Daubechies wavelets is
function more closely similar to the shape of the ECG introduced.
signal achieved better detection. In the first step, the
ECG signal was de-noised by removing the II. MATERIALS AND METHODS
corresponding wavelet coefficients at higher scales.
Then, QRS complexes are detected and each complex is A. Wavelet Transform
used to locate the peaks of the individual waves,
including onsets and offsets of the P and T waves which Mathematically speaking, the wavelet transform is a
are present in one cardiac cycle. We evaluated the convolution of the wavelet function  (t) with the
algorithm on MIT-BIH Database, the manually signal x(t) . Orthonormal dyadic discrete wavelets are
annotated database, for validation purposes. The
proposed QRS detector achieved sensitivity of associated with scaling functions  (t) . The scaling
99.18%  2.75 and a positive predictivity of function can be convolved with the signal to produce
98.00%  4.45 over the validation database. approximation coefficients S . The discrete wavelet
transform (DWT) can be written as:
Key Words: ECG, Beat Detection, P-QRS-T waves,
Daubechies wavelets, Feature Extraction. 

 Tm,n   x(t) m,n (t)dt



I. INTRODUCTION
 By choosing an orthonormal wavelet basis,  m,n (t) ,
The analysis of the ECG has been widely used for
diagnosing many cardiac diseases. The ECG is a
and we can reconstruct the original. The
graphic record of the direction and magnitude of the approximation coefficient of the signal at the scale m
electrical activity that is generated by depolarization and location n can be presented by:
and repolarization of the atria and ventricles. One
cardiac cycle in an ECG signal consists of the P-QRS-T Sm, n  
 x(t)m,n (t)dt (1)
waves (Fig. 1). Most of the clinically useful information
in the ECG is found in the intervals and amplitudes
In practice our discrete input signal S0,n is of finite
defined by its features (characteristic wave peaks and
time durations). The development of accurate and quick length N , which is an integer power of 2: N  2M .
methods for automatic ECG feature extraction is of Thus the range of scales that can be investigated is
major importance, especially for the analysis of long 0  m  M . A discrete approximation of the signal can
recordings (Holters and ambulatory systems). In fact, be shown as
beat detection is necessary to determine the heart rate,
and several related arrhythmias such as Tachycardia, M
Bradycardia and Heart Rate Variation; it is also x0 (t)  xM (t)   d m (t) (2)
necessary for further processing of the signal in order to m1
detect abnormal beats [8]. The ECG feature extraction
system provides fundamental features (amplitudes and where the mean signal approximation at scale M is
intervals) to be used in subsequent automatic analysis.

480-816 343
xM (t)  SM ,nM ,n (t) (3)

and the detail signal approximation corresponding to


scale m is defined for a finite length signal as

2M m 1
dm (t)   T m,n m,n (t) (4)
n0

Adding the approximation of the signal at scale index


M to the sum of all detail signal components across
scales gives the approximation of the original signal at
scale index 0. The signal approximation at a specific
scale was a combination of the approximation and
detail at the next lower scale.

xm (t)  xm1(t)  dm (t) (5)

If scale m  3 was chosen, it can be shown that the


signal approximation is given by

x3(t)  x0 (t)  d1(t)  d2 (t) d 3(t) (6)

corresponding to the successive stripping of high


frequency information (contained within the dm (t) )
from the original signal at each step [4]. This is referred
to as multiresolution analysis of a signal using wavelet
transform, and is the basic of our procedure.

B. Prototype Wavelet Used

The large number of known wavelet families and


functions provides a rich space in which to search for a
wavelet which will very efficiently represent a signal of
interest in a large variety of applications. Wavelet
families include Biorthogonal, Coiflet, Harr, Symmlet,
Daubechies wavelets [10], etc. There is no absolute way
to choose a certain wavelet. The choice of the wavelet
function depends on the application. The Haar wavelet
algorithm has the advantage of being simple to compute
and easy to understand. The Daubechies algorithm is
conceptually more complex and has a slightly higher
computational overhead. But, the Daubechies algorithm
picks up detail that is missed by the Haar wavelet
algorithm. Even if a signal is not well represented by
one member of the Db family, it may still be efficiently
represented by another. Selecting a wavelet function
which closely matches the signal to be processed is of
utmost importance in wavelet applications [9].
Daubechies wavelet family are similar in shape to QRS
complex and their energy spectrum are concentrated
around low frequencies. Fig. 1 shows the details of an
ECG signal with a short burst of noise added to its end.
Below the signal the details for eight wavelet scales are
shown which are scaled for better illustration. Adding Fig. 1: Multiresolution decomposition of ECG signal containing short
burst of noise. (a) Using D4 (b) Using D6. Source signal, x[n], and
D4 and D6 wavelets were used in the decomposition. signal details of order m, D2m.

344
The original signal is shown at the top of the plot.
Below the signal the details for eight wavelet scales are
shown which are scaled for better illustration. Adding
together all these details plus the remaining signal
approximation (which is the signal mean) returns the
original signal. Four points are noticeable from the
plots. First, most of the details of the signal are
contained at scale 25. The second point to notice is that
the high frequency burst of noise is captured at the
smallest scales, namely 22 and 21. The third is the
appearance of Daubechies D4 and D6 scaling functions
at higher scales. The last one is the more similarity of
D6 scaling function to QRS complex than to D4, as it
can be seen by the details of the signal at scale 25.
Because of the latter property the D6 wavelet is
implemented here. Fig. 2 describes approximation of
the signal showed in Fig. 1. The signal is approximated
by omitting the signal's details beginning from scale 2 1
to 28. It is clear that high frequency components
decrease as lower details are removed from the original
signal. As these lower details are removed, signal
becomes smoother and the noise on the T wave in the
left of the figure disappears. We can also see that the
peaks of QRS complexes flatten and P and T waves,
containing lower frequencies becomes more visible. If
the frequency distribution of details is drawn we may Fig. 2: Signal approximation using D6. Source signal, x[n], and
find better understanding of wavelet transform. A omitted signal details of order m, (-) D2m.
normal ECG signal along with its frequency distribution
is shown in Fig. 3. The signal is sampled at 360
sample/second, so the range of real frequency
component of the signal is between 0 to 180 Hz. A
normal signal is used here to omit the interference of
abnormal beats in frequency distribution. The frequency
response of the original signal shows its main
concentration in the lower frequency range 2 – 40 Hz.
The signal had a large dc component which was
removed to enhance other frequency components of the
signal. The frequency response of the wavelets details is
also shown which are exaggerated to clearly show their
distribution. It can be seen that details at lower scales
constitutes the higher frequencies of the signal.
Although the frequency distribution of the details does
not overlap each other at lower scales up to 23, they
Fig. 3: A normal ECG Signal and frequency distribution. The
obviously overlap at higher scales. While working with frequency response of the wavelet details is also shown. Source
details of the signal, these overlaps between discrete signal, x[n], and signal details of order m, D2m.
distributions should be taken into consideration. The
last plot shows the overall frequency response of the
signal approximation including details up to 28. It
matches the original signal frequency response well
while removing the dc and low frequency components
which are not of concern in processing.

C. Description of the Algorithms

The algorithms presented in this section are applied


directly at one run over the whole digitized ECG signal Fig. 4: Description of the ECG feature extraction algorithm
which are saved as data files provided by Physionet.

345
Fig. 5: Detection procedure. a) R wave detection b) Q & S Waves detection. c) Zero level detection. d) P & T detection.

There are actually four separate algorithms, each of Q and S peaks occurs about the R peak with in 0.1
which is designated to extract certain features of the Second. In order to make the peaks noticeable, all the
ECG signal. The description of the ECG feature details of the signal were removed up to detail 2 5. The
extraction algorithm is shown in Fig. 4. First, the peak approximation signal remained, was searched for
of the QRS complex with its high dominated amplitude extermum points about the R peaks formerly detected.
in the signal is detected. Then Q and S waves are The left point denoted the Q peak and the right one
detected. The Zero voltage level of the signal is found denotes the S peak. The procedure of the Q and S
next. P and T waves along with their onsets and offsets waves detection algorithm is shown in Fig. 5.b . A
are the last things to be found. normal QRS complex indicates that the electrical
impulse has progressed normally from the bundle of
1) R Detection : His to the Purkinje network through the right and left
bundle branches and that normal depolarization of the
Peaks of the R waves in signals from the MLII lead right and left ventricles has occurred.
have the largest amplitudes among other leads. In order
to detect the peaks, specific details of the signal were 3) Zero level Detection:
selected. The procedure of the R wave detection
algorithm is shown in Fig. 5.a . Details 2 3 – 25 were One would think that the electrocardiograph machines
kept and all the details were removed. This procedure for recording electrocardiograms could determine when
removed low frequencies and high frequencies. The no current is flowing around the heart. However, many
attained signal samples were then squared. High stray currents exist in the body, such as currents
amplitude transitions of the signal were then more resulting from skin potentials and from differences in
noticeable, even if R peaks are deformed (Fig. 6). Then ionic concentrations in different parts of the body.
a practically lower limit is applied on the signal to These stray currents make it impossible for one to
remove unrelated noisy peaks. Because no subsequent predetermine the exact zero reference level in the
beats happen less than .25 second, pseudo-beats are also electrocardiogram. At the end of the QRS complex, no
removed. Detection of R peaks is very important current is flowing around the heart. Even the current of
because they define the cardiac beats and the exactness injury disappears at this point and the potential of the
of all forthcoming detections is dependent on this. electrocardiogram at this instant is zero. This point is
known as the J point. Most people, however, are
2) QS Detection : conditioned to consider the TP segment of the

346
electrocardiogram as the reference level rather than the
J point which is much easier to be found correctly [7].
By experiment we found that the voltage at this level is
closely equal to the zero crossing of the approximation
signal, keeping details 21 – 25, before the Q peak. There
is another zero crossing after the S peak. Comparing
these two points is essential for detecting current of
injury and ST segment shift. The procedure of the zero
level detection algorithm is shown in Fig. 5.c .

4) P and T Wave Detection:

These waves are more noticeable when keeping details


24 – 28. At these levels, lower frequencies and high
frequency ripples of the signal are removed. The
extermums of the signal before and after the zero
crossings about each R peak which are formerly
detected denote P and T peaks. Zero crossings of the
signal about the P and T peaks which were detected are
the onset and offset points of the waves, respectively.
The procedure of the P and T waves detection algorithm
is shown in Fig. 5.d .

Implementing these algorithms provides the features of Fig. 6: Detection of P-Q-R-S-T waves a sample of ECG signal. (a)
Original signal. (b) Removing dc and low frequencies. (c) Detecting
the ECG signal which can then be used to annotate the R peaks. (d) Detecting Q and S waves along with zero levels of the
signal as shown in Fig. 7. signal. (e) Detecting P and T waves.

III. RESULTS and VALIDATION

Results for beat Detection

The databases for which the program was designed


consist of a small number of records, each of which is
quite large (typically a megabyte or more). Database
records usually originate as multi-channel analog tape
recordings that have been digitized and stored as disk Fig. 7: An output annotated signal using the developed program.
files. Records are identified by record names, which are
three-digit numbers for MIT DB records. A record is
comprised of several files, which contain signals, is related to R peak detection, an annotation file was
annotations, and specifications of signal attributes. MIT generated. The results of the comparisons, using "bxb"
DB records are each 30 minutes in duration, and are program is shown in Table 1.
annotated throughout; by this we mean that each beat
(QRS complex) is described by a label called an
annotation. Typically an annotation file for an MIT DB IV. DISCUSSION and CONCLUSION
record contains about 2000 beat annotations, and
smaller numbers of rhythm and signal quality The wavelet based detector, in contrast to most QRS
annotations [5]. The test protocols described in EC57 detectors found in the literature, allows taking
standard, require that, for each record, the output of the advantage of characteristics of time-scale analysis.
device has been recorded in an annotation file (the “test Implementing multi-resolution analysis and successive
annotation file”), in the same format as the reference stripping of the signal (signal details, d m (t) ) and using
annotation file for that record. The programs "bxb," signal approximation by compounding the signal details
"rxr," "epic," and "mxm" (either the versions supplied were our basic tools. D6 family of Daubechies wavelets
on the MIT–BIH Arrhythmia Database CD-ROM or showed better results in contrast to D4. Most of the
any later versions released by MIT) or equivalent details of the signal are contained at lower scales
should be used to perform the comparisons between the (mostly scale 25) which need less decomposition, so
test annotation files and the reference annotation files faster application of the wavelet. The absence of very
[6]. In order to test the beat detection algorithm which low (< 2 Hz) and very high (> 40 Hz) frequency
concentration of the ECG signal helped us to denoise

347
the signal from movement artifacts and external [10] Daubechies, I., Ten Lectures on Wavelets, SIAM,
interfering noises easily. Keeping certain details (scales Philadelphia, 1992.
23 – 25) and squaring of the remaining signal [11] J.S Sahambi, S.N. Tandon and R.K.P. Bhatt, Using
Wavelet Transform for ECG Characterization, IEEE Eng.
approximation result in good detection of R peaks. The
in Med. and Bio., 1997.
peaks were detected among several types of beats in
more than 20 minutes signal durations. Choosing
certain details (21 – 25) of the signal made Q and S
peaks easy to find. Zero level detection procedure used, Table 1: Sensitivity (Se) and Positive Predictivity (PP) Results of
help us to easily find the ST segment shift with out the comparison between manual and automatic beat annotation of signals.
Signal Records (Rec.) are chosen form MIT DB.
need for J point detection which is usually hard to
detect. Again using certain details (24 – 28) made P and Rec. Se PP
T waves more noticeable. The proposed wavelet based
100 100.00% (1830/1830) 100.00% (1830/1830)
feature extraction system achieved good detection
101 99.87% (1515/1516) 99.61% (1514/1520)
performance on the MIT – BIH database. The QRS
detector attained sensitivity of 99.18%  2.75 and a 103 100.00% (1691/1691) 100.00% (1691/1692)
positive predictivity of 98.00%  4.45 on the first lead 105 82.77% (1682/2057) 81.49% (1682/2057)
of the validation databases among 46 records. All the 106 99.63% (1625/1631) 99.94% (1625/1626)
formerly proposed (to our knowledge) algorithms were 107 99.94% (1721/1722) 96.96% (1721/1775)
based on beat by beat detection which are more easily 118 100.00% (1821/1821) 99.67% (1821/1827)
achievable. The novelty of our procedure resides on its
119 100.00% (1604/1604) 99.07% (1604/1619)
application in one run of the algorithm. That is, the
whole signal samples are processed all at once, taking 200 99.91% (2126/2128) 98.20% (2126/2165)
the possibility of each kind of beats into account. We 201 100.00% (553/553) 99.64% (553/555)
have also tested our algorithm in beat by beat 202 99.94% (1582/1583) 99.87% (1582/1584)
processing which have shown to be quite good. The 203 94.73% (2303/2431) 98.76% (2303/2332)
results are better as is reported here in Table 1. The 205 99.49% (2162/2173) 99.95% (2162/2163)
results for 2 records (102 and 104) of the database were
207 99.62% (1553/1559) 98.73% (1553/1567)
not reported, because they do not contain the signal of
MLII lead. Our procedure, the feature extraction using 208 96.67% (2324/2404) 96.99% (2324/2396)
Daubechies wavlets, is the basic for automatic ECG 209 99.92% (2438/2440) 100.00% (2438/2438)
arrhythmia detection which is of our concern in the 210 97.99% (2099/2142) 99.71% (2099/2105)
future to come. 212 100.00% (2240/2240) 100.00% (2240/2240)
213 99.96% (2634/2635) 100.00% (2634/2634)
214 99.73% (1816/1821) 99.84% (1816/1819)
REFFERENCES
215 99.63% (2708/2718) 100.00% (2708/2708)
[1] Juan Pablo Martínez, Rute Almeida, Salvador Olmos, Ana 217 99.94% (1790/1791) 96.34% (1790/1858)
Paula Rocha, and Pablo Laguna, A Wavelet-Based ECG 219 94.52% (1621/1715) 94.30% (1621/1719)
Delineator: Evaluation on Standard Databases, IEEE
x_108 99.12% (339/342) 93.13% (339/364)
Trans. Biomed. Eng., Vol. 51, No. 4, 2004.
[2] Krishna Prasad and J. S. Sahambi , Classification of ECG x_109 100.00% (526/526) 99.81% (526/527)
Arrhythmias using Multi-Resolution Analysis and Neural x_111 100.00% (423/423) 99.76% (423/424)
Networks, IEEE Trans. Biomed. Eng., 2003. x_112 100.00% (519/519) 98.48% (519/527)
[3] Cuiwei Li, Chongxun Zheng, and Changfeng Tai,
Detection of ECG Characteristic Points using Wavelet x_113 100.00% (350/350) 79.55% (350/440)
Transforms, IEEE Trans. Biomed. Eng., Vol. 42, No. 1, x_114 100.00% (337/337) 99.41% (337/339)
1995. x_115 100.00% (383/383) 100.00% (383/383)
[4] Paul S Addison, The illustrated wavelet transform
x_116 100.00% (480/480) 100.00% (480/480)
handbook, (IOP Pub., 2002).
[5] George B. Moody, WFDB programmer’s guide (Tenth x_117 100.00% (306/306) 86.93% (306/352)
Edition, 2003). x_121 100.00% (367/367) 99.19% (367/370)
[6] Association for the Advancement of Medical
x_122 100.00% (511/511) 100.00% (511/511)
Instrumentation, EC57 – Testing and reporting.
performance results of cardiac rhythm and ST segment x_123 100.00% (301/301) 100.00% (301/301)
measurement algorithms, (1999). x_124 100.00% (313/313) 100.00% (313/313)
[7] Guyton and Hall, Textbook of Medical Physiology (Tenth x_220 99.77% (429/430) 100.00% (429/429)
Edition,W.B. Saunders Co., 2001).
[8] Robert J. Huzar, Basic Dysrhythmias, Interpretation and x_221 100.00% (491/491) 100.00% 491/491)
Management (C.V. Mosby Co., 1988). x_222 100.00% (445/445) 99.55% (445/447)
[9] Amara Grap, An Introduction to Wavelets, IEEE Comp.
Sc. And Eng., Vol. 2, No. 2, 1995.

348

View publication stats

Você também pode gostar