An Efficient QRS Complex Detection Algorithm using Optimal ... - wseas

2 downloads 0 Views 1MB Size Report
Department of Electrical and Electronics Engineering a,. Department ..... beats undetected. Detection ratio. No. of beats undetected. Detection ratio. No. of beats.
Proc. of the 6th WSEAS Int. Conf. on Signal Processing, Computational Geometry & Artificial Vision, Elounda, Greece, August 21-23, 2006 (pp50-55)

An Efficient QRS Complex Detection Algorithm using Optimal Wavelet G.SELVAKUMAR a,1, K.BOOPATHY BAGAN b,2, Department of Electrical and Electronics Engineering a, Department of Electronics b, Institute of Road and Transport Technology 1, Erode, Tamilnadu. Madras Institute of Technology 2, Chromepet, Chennai, Tamilnadu. INDIA. [email protected]

Abstract: - This paper analyses the application of wavelets for the efficient detection of QRS complex in ECG. Wavelets provide simultaneous time and frequency information. In this research, the effects of the properties of different wavelet functions, such as time/frequency localization and linearity, on the accuracy of QRS detection are examined. Initially, a wavelet transform filtering is applied to the signal. Then the QRS complex localization is performed using a maximum detection and peak classification algorithm. The algorithm is applied on the ECG registrations from the MIT-BIH database. This paper concludes that the uses of wavelets improve the average detection ratio and that the wavelet functions that support symmetry and compactness provide better results. Key-words: - ECG, QRS Complex, Wavelets, Cubic Spline, Haar, Daubechies wavelets.

1. Introduction The QRS Complex is the most striking waveform within the ECG. Since it reflects the electrical activity of the heart during the ventricular contraction, the time of its occurrences and its shape provide much information about the current state of the heart. Due to its characteristic shape [Fig.1], QRS complex detection provides the fundamentals for almost all automated ECG analysis algorithms. Accurate detection of QRS is an important issue in many clinical conditions. The automation of the QRS detection process is not an easy task due to the fact that the morphologies of many normal as well as abnormal QRS complexes differ widely. The presence of noise and the other characteristic waves of ECG such as P and T waves can hinder the detection of QRS complexes. A number of techniques have

been devised by the researchers to detect QRS complex [4,5,6]. Though bandpass filtering and temporal filtering of the signal are used for QRS complex detection, the selection of the bandwidth of the filter and the width of the sliding window is not a simple decision [3,7]. Researchers have attempted to use wavelets for QRS detection [1,3,8,9,10,12,13] to overcome some of these issues. In addition, wavelet analysis provides flexibility and adaptability. Also the researchers have the choice of the function and level of decomposition for this application. This paper reports efforts to determine the most suitable wavelets for the purpose of QRS complex detection.

Proc. of the 6th WSEAS Int. Conf. on Signal Processing, Computational Geometry & Artificial Vision, Elounda, Greece, August 21-23, 2006 (pp50-55)

In digital form equation (1) becomes,

Wxb =

δ

∑c

k

⋅ xb + k

(3)

k = −δ

where δ reflects the length of the interval in which the wavelet is defined, and the coefficients contain the wavelet and the energy normalizing factor.

2.1 Optimal Wavelet

Fig 1. Normal ECG waveform

2. Introduction to Wavelets The wavelet transform is a mathematical tool for decomposing a signal into a set of orthogonal waveforms localized both in time and frequency domains. The decomposition produces coefficients, which are functions of the scale (of the wavelet function) and position (shift across the signal). A wavelet which is limited in time and frequency is called “mother wavelet”. Scaling and translation of the mother wavelet gives a family of basis functions called “daughter wavelets”. The wavelet transform of a time signal at any scale is the convolution of the signal and a time-scaled daughter wavelet. Scaling and translation of the mother wavelet is a mechanism by which the transform adapts to the spectral and temporal changes in the signal being analyzed. The continuous wavelet transform for the signal x(t) is defined as:

W(a, b ) =

1 a



∫ x(t ) ψ⋅

−∞

*

t −b dt   a 



-∞

2.1.1 Reconstruction The ability to reconstruct the signal from the decomposition coefficients is very important. The orthogonal, orthonormal and bi-orthogonal wavelet families assure high reconstruction capability.

2.1.2 Energy Preservation Preserving the energy under the transformation is obtained by the use of the orthogonal wavelet family. But biorthogonal wavelet family does not preserve the energy.

(1)

where a and b are the dilation (scaling) and translation parameters, respectively. A wide variety of functions can be chosen as mother wavelet ψ, provided ψ(t) Є L2 and

∫ψ (t ) ⋅ dt = 0

Choosing a wavelet function that optimally fits the signal depends on the application and the signal itself. There are several characteristics that should be considered [2,11]. They are the ability to reconstruct the signal from the wavelet decomposition, to preserve the energy under transformation and the symmetry of the wavelet function. We examined a set of orthogonal and biorthogonal wavelet families that hold the above characteristics.

(2)

2.1.3 Symmetry Symmetry of wavelet function is another important characteristic since it avoids a drift of the information in the signal during the reconstruction process. This property improves the position accuracy. The biorthogonal wavelet family possesses this property.

Proc. of the 6th WSEAS Int. Conf. on Signal Processing, Computational Geometry & Artificial Vision, Elounda, Greece, August 21-23, 2006 (pp50-55)

3. Wavelet Selection for QRS Detection To determine the choice of the wavelets, the properties of the QRS must be examined. QRS has the highest slope, has a characteristic shape and the event is localized in time. The shape of the signal is maintained if the phase shift is linear. Thus one requirement of the wavelet is that it should be a symmetrical function. Time localization is important because the ECG events are transient. Spline wavelet is a bi-orthogonal wavelet. It has properties satisfying the two requirements discussed above. They are the first derivatives of smoothing functions and are symmetrical. The higher order of the spline wavelet results in the sharper frequency response of the equivalent FIR filter. This is always desirable in wavelet transform. But the higher order spline wavelet is a longer coefficient series, leading to more computational time. Therefore the Cubic Spline wavelet (Fig. 2) is assumed to have the high enough order for this application. It is defined as:

 t2  ψ (t ) =exp − 2  cos(2πft ) − λ  β 

and provides time localization. It also provides ease in computation but does not provide the frequency localization.

Fig. 3 Haar Wavelet The Daubechies 3 (Db3) wavelet (Fig. 4) is a wavelet function that includes partial properties for all the ECG signal requirements.

(4)

The reader may refer to [11] for more details.

Fig. 4 Daubechies 3 Wavelet

This paper presents a comparison of the efficiencies of the wavelets discussed above in the detection of QRS complex.

4. Data

Fig 2. Cubic Spline Wavelet

Another important wavelet is Haar wavelet (Fig. 3), which is compact in time

The MIT-BIH database [14] is used for the analysis. The database consists of tens of hours of ECG signal. All the records are dual channel ECG signals. Cardiologists have manually identified the time of occurrence and classified the type of QRS complex anomaly for each record making it suitable for this study.

Proc. of the 6th WSEAS Int. Conf. on Signal Processing, Computational Geometry & Artificial Vision, Elounda, Greece, August 21-23, 2006 (pp50-55)

5. Methodology The detection of QRS complex is done in two steps. First, the wavelet transform is applied to obtain a transformed signal, which contains a few maxima and minima in each period. In the next step, these extreme values are detected, and the peaks of the maxima preceded by a long ascent and followed by a long descent of the signal are declared to coincide with the peaks of the R waves (QRS complex).

5.1 Wavelet filtering The wavelet transforms are first applied to the ECG signals. For instance, consider the Cubic Spline wavelet. The output function of this wavelet transform will be our filtered signal. The parameters of this filtering are the attenuation factor, β and the base frequency, f. Our goal is to find out those parameter values, which contribute the most to a good QRS detection ratio. In the similar way, the wavelet filtering is applied to the ECG registrations using Haar and Db3 wavelets.

5.2 QRS complex detection This is done using the transformed signal. The series of consecutive maxima and minima are first determined. Then the maxima, which occur after a long ascent and are followed by a long descent, will be declared the peaks of the R waves. The exact threshold value of the criterion ‘long’ is determined at the beginning from the maximal value of the ascents in the first few seconds. But the output signal of the transform defined according to equation (3), has values only in the range (-1 to 1), a fixed threshold in the range 0.35 to 0.60 always leads to acceptable results.

5.3 Changing the parameters efficient QRS detection

for

The efficiency, stability and reliability of this method has been examined by adjusting the values of the main parameters

of each wavelet filtering, and checking how the detection ratio is improved. In the case of Cubic Spline wavelet, the main parameters are β and f. The basic frequency, f has a strong influence on the detection ratio. Its value has to be around the dominating frequency of R wave. By choosing the value between 12 Hz to 20 Hz, we obtain a very good detection ratio. The attenuation factor, β is chosen in such a way, that it limits the mother wavelet’s values at the boundaries of the interval by 3 to 5% of its maximum. The width of the interval in which the mother wavelet is defined, should be chosen as 2-2.5 periods of the cosine function in the wavelet’s definition.

6. Results and Conclusion The algorithm has been tested using the ECG registrations from the MIT-BIH database. Table 1 gives a summary of results showing the efficiency of different wavelets in detecting the QRS complexes. The results clearly show that the detection ratio of the QRS complexes has been improved by this method, giving a strong justification for the use of wavelets for QRS complex detection. It can be observed from the results that the detection ratio ranges between 98.53% and 100%. In most arrhythmia free cases, there has been no failure of QRS detection. From the average detection ratio, it can be stated that, the Cubic Spline wavelet is more suitable for this application because it reduces the probability of error in the detection of QRS complex and gives a maximum average detection ratio of 99.54%. Thus it can be concluded that a wavelet with symmetrical function of higher order is suitable for QRS complex detection.

Proc. of the 6th WSEAS Int. Conf. on Signal Processing, Computational Geometry & Artificial Vision, Elounda, Greece, August 21-23, 2006 (pp50-55)

ECG Registration Number 100 101 103 104 108 115 122 203 222 233 Total

Cubic Spline Haar Db3 Total Detection No. of Detection No. of Detection No. of beats ratio beats ratio beats ratio beats undetected undetected undetected 2273 4 99.82 19 99.16 12 99.47 1865 5 99.73 21 98.87 10 99.46 2084 2 99.90 18 99.13 7 99.66 2229 12 99.46 28 98.74 18 99.19 1774 19 98.92 26 98.53 25 98.59 1953 6 99.69 22 98.87 14 99.28 2476 8 99.67 17 99.31 19 99.23 2980 16 99.46 37 98.75 24 99.19 2483 13 99.47 27 98.91 31 98.75 3079 21 99.31 39 98.73 34 98.89 23196 106 99.54 254 98.90 194 99.16 Table 1: Test results showing the detection ratio of different wavelets

References: [1] C.Li, C.Zheng and C.Tai, “Detection of ECG characteristic points using wavelet transforms”, IEEE Transactions on Biomedical Engineering, Vol. 42, No. 1, Jan, 1995, pp. 21-28. [2] B.Castro, D.Kogan, and A.B.Geva, “ECG feature extraction using optimal mother wavelet”, IEEE EMBE International Conference, 2000, pp. 346350. [3] S.Kadambe, R.Murray and G.F. Boudreaux-Bartels, “Wavelet transform based QRS complex detector”, IEEE transaction on Biomedical Engineering, Vol. 46, no. 7, July, 1999, pp. 838-848. [4] A.Ruha, S.Sallinen and S.Nissila, “A real-time microprocessor QRS detector system with a 1ms timing accuracy for measurement of ambulatory HRV”, IEEE Transactions on Biomedical Engineering, vol.44, no. 3, March, 1997, pp. 159-167. [5] V.X.Afonso, W.J.Tompkins, T.Q.Nguyen and S.Luo, “ECG beat detection using filter banks”, IEEE Transactions on Biomedical Engineering, vol.46, no. 2, Feb, 1999, pp. 192-202.

[6] P.S. Hamilton and W.J.Tompkins, “Quantitative investigation of QRS detection rules using the MIT-BIH arrhythmia database”, IEEE Transactions on Biomedical Engineering, vol. BME-33, no. 12, Dec, 1986, pp. 1157-1165. [7] N.V.Thakor, J.G.Webster and W.J.Tompkins, “Estimation of QRS complex power spectra for design of a QRS filter”, IEEE Transactions on Biomedical Engineering, vol. BME-31, no. 11, Nov, 1986, pp. 702-706. [8] B.Bardie, “Wavelet packet based compression of single lead ECG”, IEEE Transactions on Biomedical Engineering, vol.43, no. 5, May, 1996, pp. 493-501. [9] G.Ramakrishna and S.Saha, “ECG coding by wavelet based linear prediction”, IEEE Transactions on Biomedical Engineering, vol.44, no. 12, Dec, 1997, pp. 1253-1261. [10] M.L.Hilton, “Wavelet and wavelet packet compression of electrocardiograms”, IEEE Transactions on Biomedical Engineering, vol.44, no. 4, May, 1997, pp. 394-402.

Proc. of the 6th WSEAS Int. Conf. on Signal Processing, Computational Geometry & Artificial Vision, Elounda, Greece, August 21-23, 2006 (pp50-55)

[11] R.Rao and A.Bopardikar, “Wavelet transforms: Introduction to theory and applications”, Addison-Wesley, 1998. [12] Romero Legarreta, PS Addison and N Grubb, “R-wave detection using continuous wavelet modulus maxima”, IEEE proceedings on Computers in Cardiology, Vol. 30, 2003, pp. 565-568.

[13] Romero I, Serrano L and Ayesta, “ECG frequency domain features extraction: A new characteristic for arrhythmias classification”, Conference of the IEEE engineering in medicine and biology society, 2001. [14] MIT-BIH (http://www.physionet.org)