Sie sind auf Seite 1von 6

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


evaluated an electrocardiogram (ECG) feature extraction system based on the multi-resolution wavelet transform. ECG signals from Modified Lead II (MLII) are chosen for processing. The result of applying two wavelet filters (D4 and D6) of different length on the signal is compared. The wavelet filter with scaling function more closely similar to the shape of the ECG signal achieved better detection. In the first step, the ECG signal was de-noised by removing the corresponding wavelet coefficients at higher scales. Then, QRS complexes are detected and each complex is used to locate the peaks of the individual waves, including onsets and offsets of the P and T waves which are present in one cardiac cycle. We evaluated the algorithm on MIT-BIH Database, the manually annotated database, for validation purposes. The proposed QRS detector achieved sensitivity of and a positive predictivity of 99.18% 2.75 over the validation database. 98.00% 4.45

Producing an algorithm for the detection of the P wave, QRS complex and T wave in an ECG is a difficult problem due to the time-varying morphology of the signal subject to physiological conditions and the presence of noise [4]. Recently, a number of techniques have been proposed to detect these features [1-3][11]. Here our procedure using Daubechies wavelets is introduced. II. MATERIALS AND METHODS A. Wavelet Transform Mathematically speaking, the wavelet transform is a convolution of the wavelet function (t ) with the signal x(t ) . Orthonormal dyadic discrete wavelets are associated with scaling functions (t ) . The scaling function can be convolved with the signal to produce approximation coefficients S . The discrete wavelet transform (DWT) can be written as:
Tm, n = x(t ) m, n (t )dt

Key Words: ECG, Beat Detection, P-QRS-T waves,


Daubechies wavelets, Feature Extraction.

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 graphic record of the direction and magnitude of the electrical activity that is generated by depolarization and repolarization of the atria and ventricles. One cardiac cycle in an ECG signal consists of the P-QRS-T waves (Fig. 1). Most of the clinically useful information in the ECG is found in the intervals and amplitudes defined by its features (characteristic wave peaks and time durations). The development of accurate and quick methods for automatic ECG feature extraction is of major importance, especially for the analysis of long recordings (Holters and ambulatory systems). In fact, beat detection is necessary to determine the heart rate, and several related arrhythmias such as Tachycardia, Bradycardia and Heart Rate Variation; it is also necessary for further processing of the signal in order to detect abnormal beats [8]. The ECG feature extraction system provides fundamental features (amplitudes and intervals) to be used in subsequent automatic analysis.

and we can reconstruct the original. The approximation coefficient of the signal at the scale m and location n can be presented by:
S m , n = x (t ) m , n (t ) dt

(1)

In practice our discrete input signal S 0, n is of finite length N , which is an integer power of 2: N = 2 M . Thus the range of scales that can be investigated is 0 < m < M . A discrete approximation of the signal can be shown as

x0 (t ) = xM (t ) + d m (t )
m =1

(2)

where the mean signal approximation at scale M is

480-816

343

xM (t ) = S M , nM , n (t )

(3)

and the detail signal approximation corresponding to scale m is defined for a finite length signal as
d m (t ) =
2 M m 1 n=0

T m, n m, n (t )

(4)

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 ) d m (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 ) d 2 (t ) d 3(t )

(6)

corresponding to the successive stripping of high frequency information (contained within the d m (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 D4 and D6 wavelets were used in the decomposition.

Fig. 1: Multiresolution decomposition of ECG signal containing short burst of noise. (a) Using D4 (b) Using D6. Source signal, x[n], and 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 21 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 find better understanding of wavelet transform. A 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 obviously overlap at higher scales. While working with details of the signal, these overlaps between discrete 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.

Fig. 2: Signal approximation using D6. Source signal, x[n], and omitted signal details of order m, (-) D2m.

Fig. 3: A normal ECG Signal and frequency distribution. The frequency response of the wavelet details is also shown. Source signal, x[n], and signal details of order m, D2m.

C. Description of the Algorithms


The algorithms presented in this section are applied directly at one run over the whole digitized ECG signal which are saved as data files provided by Physionet.

Fig. 4: Description of the ECG feature extraction algorithm

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 which is designated to extract certain features of the ECG signal. The description of the ECG feature extraction algorithm is shown in Fig. 4. First, the peak of the QRS complex with its high dominated amplitude in the signal is detected. Then Q and S waves are detected. The Zero voltage level of the signal is found next. P and T waves along with their onsets and offsets are the last things to be found. 1) R Detection : Peaks of the R waves in signals from the MLII lead have the largest amplitudes among other leads. In order to detect the peaks, specific details of the signal were selected. The procedure of the R wave detection algorithm is shown in Fig. 5.a . Details 23 25 were kept and all the details were removed. This procedure removed low frequencies and high frequencies. The attained signal samples were then squared. High amplitude transitions of the signal were then more noticeable, even if R peaks are deformed (Fig. 6). Then a practically lower limit is applied on the signal to remove unrelated noisy peaks. Because no subsequent beats happen less than .25 second, pseudo-beats are also removed. Detection of R peaks is very important because they define the cardiac beats and the exactness of all forthcoming detections is dependent on this. 2) QS Detection :

Q and S peaks occurs about the R peak with in 0.1 Second. In order to make the peaks noticeable, all the details of the signal were removed up to detail 25. The approximation signal remained, was searched for extermum points about the R peaks formerly detected. The left point denoted the Q peak and the right one denotes the S peak. The procedure of the Q and S waves detection algorithm is shown in Fig. 5.b . A normal QRS complex indicates that the electrical impulse has progressed normally from the bundle of His to the Purkinje network through the right and left bundle branches and that normal depolarization of the right and left ventricles has occurred. 3) Zero level Detection: One would think that the electrocardiograph machines for recording electrocardiograms could determine when no current is flowing around the heart. However, many stray currents exist in the body, such as currents resulting from skin potentials and from differences in ionic concentrations in different parts of the body. These stray currents make it impossible for one to predetermine the exact zero reference level in the electrocardiogram. At the end of the QRS complex, no current is flowing around the heart. Even the current of injury disappears at this point and the potential of the electrocardiogram at this instant is zero. This point is known as the J point. Most people, however, are 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 the ECG signal which can then be used to annotate the signal as shown in Fig. 7.
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 R peaks. (d) Detecting Q and S waves along with zero levels of the 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 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, annotations, and specifications of signal attributes. MIT DB records are each 30 minutes in duration, and are 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 record contains about 2000 beat annotations, and smaller numbers of rhythm and signal quality annotations [5]. The test protocols described in EC57 standard, require that, for each record, the output of the device has been recorded in an annotation file (the test annotation file), in the same format as the reference annotation file for that record. The programs "bxb," "rxr," "epic," and "mxm" (either the versions supplied on the MITBIH Arrhythmia Database CD-ROM or any later versions released by MIT) or equivalent should be used to perform the comparisons between the test annotation files and the reference annotation files [6]. In order to test the beat detection algorithm which

Fig. 7: An output annotated signal using the developed program.

is related to R peak detection, an annotation file was generated. The results of the comparisons, using "bxb" program is shown in Table 1.

IV. DISCUSSION and CONCLUSION The wavelet based detector, in contrast to most QRS detectors found in the literature, allows taking advantage of characteristics of time-scale analysis. Implementing multi-resolution analysis and successive stripping of the signal (signal details, d m (t ) ) and using signal approximation by compounding the signal details were our basic tools. D6 family of Daubechies wavelets showed better results in contrast to D4. Most of the details of the signal are contained at lower scales (mostly scale 25) which need less decomposition, so faster application of the wavelet. The absence of very 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 interfering noises easily. Keeping certain details (scales 23 25) and squaring of the remaining signal approximation result in good detection of R peaks. The 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, help us to easily find the ST segment shift with out the need for J point detection which is usually hard to detect. Again using certain details (24 28) made P and T waves more noticeable. The proposed wavelet based feature extraction system achieved good detection performance on the MIT BIH database. The QRS detector attained sensitivity of 99.18% 2.75 and a positive predictivity of 98.00% 4.45 on the first lead of the validation databases among 46 records. All the formerly proposed (to our knowledge) algorithms were based on beat by beat detection which are more easily achievable. The novelty of our procedure resides on its application in one run of the algorithm. That is, the whole signal samples are processed all at once, taking the possibility of each kind of beats into account. We have also tested our algorithm in beat by beat processing which have shown to be quite good. The results are better as is reported here in Table 1. The results for 2 records (102 and 104) of the database were not reported, because they do not contain the signal of MLII lead. Our procedure, the feature extraction using Daubechies wavlets, is the basic for automatic ECG arrhythmia detection which is of our concern in the future to come.

[10] Daubechies, I., Ten Lectures on Wavelets, SIAM, Philadelphia, 1992. [11] J.S Sahambi, S.N. Tandon and R.K.P. Bhatt, Using Wavelet Transform for ECG Characterization, IEEE Eng. in Med. and Bio., 1997.

Table 1: Sensitivity (Se) and Positive Predictivity (PP) Results of comparison between manual and automatic beat annotation of signals. Signal Records (Rec.) are chosen form MIT DB. Rec. 100 101 103 105 106 107 118 119 200 201 202 203 205 207 208 209 210 212 213 214 215 217 219 x_108 x_109 x_111 x_112 x_113 x_114 x_115 x_116 x_117 x_121 x_122 x_123 x_124 x_220 x_221 x_222 Se 100.00% (1830/1830) 99.87% (1515/1516) 100.00% (1691/1691) 82.77% (1682/2057) 99.63% (1625/1631) 99.94% (1721/1722) 100.00% (1821/1821) 100.00% (1604/1604) 99.91% (2126/2128) 100.00% (553/553) 99.94% (1582/1583) 94.73% (2303/2431) 99.49% (2162/2173) 99.62% (1553/1559) 96.67% (2324/2404) 99.92% (2438/2440) 97.99% (2099/2142) 100.00% (2240/2240) 99.96% (2634/2635) 99.73% (1816/1821) 99.63% (2708/2718) 99.94% (1790/1791) 94.52% (1621/1715) 99.12% (339/342) 100.00% (526/526) 100.00% (423/423) 100.00% (519/519) 100.00% (350/350) 100.00% (337/337) 100.00% (383/383) 100.00% (480/480) 100.00% (306/306) 100.00% (367/367) 100.00% (511/511) 100.00% (301/301) 100.00% (313/313) 99.77% (429/430) 100.00% (491/491) 100.00% (445/445) PP 100.00% (1830/1830) 99.61% (1514/1520) 100.00% (1691/1692) 81.49% (1682/2057) 99.94% (1625/1626) 96.96% (1721/1775) 99.67% (1821/1827) 99.07% (1604/1619) 98.20% (2126/2165) 99.64% (553/555) 99.87% (1582/1584) 98.76% (2303/2332) 99.95% (2162/2163) 98.73% (1553/1567) 96.99% (2324/2396) 100.00% (2438/2438) 99.71% (2099/2105) 100.00% (2240/2240) 100.00% (2634/2634) 99.84% (1816/1819) 100.00% (2708/2708) 96.34% (1790/1858) 94.30% (1621/1719) 93.13% (339/364) 99.81% (526/527) 99.76% (423/424) 98.48% (519/527) 79.55% (350/440) 99.41% (337/339) 100.00% (383/383) 100.00% (480/480) 86.93% (306/352) 99.19% (367/370) 100.00% (511/511) 100.00% (301/301) 100.00% (313/313) 100.00% (429/429) 100.00% 491/491) 99.55% (445/447)

REFFERENCES
[1] Juan Pablo Martnez, Rute Almeida, Salvador Olmos, Ana Paula Rocha, and Pablo Laguna, A Wavelet-Based ECG Delineator: Evaluation on Standard Databases, IEEE Trans. Biomed. Eng., Vol. 51, No. 4, 2004. [2] Krishna Prasad and J. S. Sahambi , Classification of ECG Arrhythmias using Multi-Resolution Analysis and Neural Networks, IEEE Trans. Biomed. Eng., 2003. [3] Cuiwei Li, Chongxun Zheng, and Changfeng Tai, Detection of ECG Characteristic Points using Wavelet Transforms, IEEE Trans. Biomed. Eng., Vol. 42, No. 1, 1995. [4] Paul S Addison, The illustrated wavelet transform handbook, (IOP Pub., 2002). [5] George B. Moody, WFDB programmers guide (Tenth Edition, 2003). [6] Association for the Advancement of Medical Instrumentation, EC57 Testing and reporting. performance results of cardiac rhythm and ST segment measurement algorithms, (1999). [7] Guyton and Hall, Textbook of Medical Physiology (Tenth Edition,W.B. Saunders Co., 2001). [8] Robert J. Huzar, Basic Dysrhythmias, Interpretation and Management (C.V. Mosby Co., 1988). [9] Amara Grap, An Introduction to Wavelets, IEEE Comp. Sc. And Eng., Vol. 2, No. 2, 1995.

348

Das könnte Ihnen auch gefallen