A Real-Time Adaptive Wavelet Transform-Based QRS Complex ...

7 downloads 21816 Views 349KB Size Report
Cite this paper as: Rudnicki M., Strumiłło P. (2007) A Real-Time Adaptive Wavelet Transform-Based QRS Complex Detector. In: Beliczynski B., Dzielinski A., ...
A Real-Time Adaptive Wavelet Transform-Based QRS Complex Detector Marek Rudnicki and Pawel Strumillo Institute of Electronics, Technical University of L ´ od´z, 211/215 W´ olcza´ nska, 90-924 L ´ od´z, Poland [email protected], [email protected]

Abstract. In this paper, the design and test results of a QRS complex detector are presented. The detection algorithm is based on the Discrete Wavelet Transform and implements an adaptive weighting scheme of the selected transform coefficients in the time domain. It was tested against a standard MIT-BIH Arrhythmia Database of ECG signals for which sensitivity (Se) of 99.54% and positive predictivity (+P ) of 99.52% was achieved. The designed QRS complex detector is implemented on TI TMS320C6713 DSP for real-time processing of ECGs.

1

Introduction

The electrocardiogram (ECG) is a diagnostic signal recorded at standard electrode locations on patients body that reflects electrical activity of cardiac muscles. The dominant feature of the ECG is the pulse like waveform — termed the QRS complex — that corresponds to the vital time instance at which the heart ventricles are depolarised. The QRS complex (typically lasting no longer than 0.1 s) serves as a reference point for most ECG signal processing algorithms, e.g. it is used in heart rate variability analysers, arrhythmia monitors, implantable pacemakers and ECG signal compression techniques. Hence, the more reliable and precise QRS detection, the better quality of ECG analysers can be expected. However, due to inherent ECG signal variability and different sources corrupting it (e.g. power line and RF interferences, muscle artifacts), QRS complex detection is not a trivial task and still remains an important research topic in the computerised ECG analysis [1]. Most of the QRS complex detection algorithms share similar structure that comprises the two major computing stages: signal pre-processing and data classification. The role of the pre-processing stage is to extract signal features that are most relevant to the QRS complex. Then these features are fed to the classification module where the decision about the QRS complex event is undertaken. Approaches within the pre-processing stage are based on linear or nonlinear signal processing techniques (e.g. band-pass filtering, signal transformations, mathematical morphology) whereas in the decision stage, simple threshold-like techniques, statistical methods, or more advanced neuro-fuzzy classifiers are used. See [1] for a comprehensive review and comparison of different algorithms for detecting the QRS complex. The choice of a particular computing technique B. Beliczynski et al. (Eds.): ICANNGA 2007, Part II, LNCS 4432, pp. 281–289, 2007. c Springer-Verlag Berlin Heidelberg 2007 

282

M. Rudnicki and P. Strumillo

for QRS detection depends on whether an on-line or off-line ECG analysis is foreseen. Detection performance of the latter one can be additionally improved by applying the so called back-search techniques. The main difficulty in constructing robust automated QRS complex detectors is due to non-stationarity of both the signal morphology and noise characteristics. This has precluded successful use of early QRS complex detectors that were based solely on the matched filtering concept. Although, Thakor et al. [2] have identified that main spectral components representing the QRS complex are centred around 17 Hz, approaches based on band-pass filters perform insufficiently due to varying temporal spectral features of ECG waveforms. In recent years it has been shown that the wavelet transform [3] is a suitable representation of ECG signals for identifying QRS complex features. It offers an over-determined multiresolution signal representation in the time-scale domain [4,5,6,7]. The idea behind the method proposed here is to apply a scheme for adaptive tracking of wavelet domain features representing the QRS complex so that its detection performance can be continuously maximised. The method was tested both in off-line and on-line DSP implementations [8] on the MIT-BIH Arrhythmia Database annotated recordings [9].

2

Description of the Algorithm

The structure of the algorithm is shown in Fig. 1. It consists of the three main processing steps: pre-processing stage, decision stage and adaptive weighting of the DWT coefficients. Once the ECG signal is transformed into its time-scale representation, the QRS complex detection takes place in this domain. The algorithm is based on adaptive scheme that makes the detection task more robust to continuously varying QRS complex morphology as well as changes in the noise’s bandwidth characteristic.

DWT

Selection of Scales

Weighting

Moving Window Integral

ECG

Preprocessing Stage

QRS

Weight Adjustment

Thresholding

Peak Detection

annotation

Decision Stage Fig. 1. Block diagram of the proposed QRS complex detector

A Real-Time Adaptive Wavelet Transform-Based QRS Complex Detector

283

The developed QRS complex detection algorithm is optimised for MIT-BIH Arrhythmia Database signals, which are sampled at the frequency of 360 Hz. 2.1

The Discrete Wavelet Transform

The advantage of the used DWT is that it is possible to obtain good separation of the QRS complexes from other ECG components and noise in the time-scale plane. The key decision when applying the DWT for signal analysis is the selection of the appropriate prototype wavelet [10]. Because there is no absolute way of selecting the best mother-wavelet function, the tree different wavelets were tested: Haar, Daubechies 4 (D4) and Daubechies 6 (D6) (Fig. 2). The Daubechies wavelet family was considered, because of its compact support and shape resemblance to the shape of QRS complexes [11].

Fig. 2. Haar, Daubechies 4 (D4) and Daubechies 6 (D6) wavelets

Fig. 3 shows sample ECG signal used to illustrate the QRS complex detection procedure. Its discrete time-scale representation is presented in Fig. 4. Note that the absolute values are displayed. 2.2

Selection of Scales and Weighting of the DWT Coefficients

As indicated in Fig. 4 the QRS complex energy is concentrated at some particular scales. Obviously, the DWT decomposition does not provide complete separation of morphological signal features across scales. The scales that mainly reflect the QRS components also capture (to a lesser extent) either noise or signal features such as the P and T waves. By proper selection of those scales for further processing, the ratio between QRS complex energy and energy of other ECG components can be significantly improved. In the described algorithm the DWT coefficients from scales 23 , 24 and 25 (i.e. 3rd , 4th and 5th decomposition level) are used for the purpose of QRS complex detection. The remaining coefficients are neglected. In order to emphasise scales that contain more QRS complex energy than the other signal components, weighting of the DWT coefficients is proposed. There is a different weighting coefficient assigned to each scale and its value is calculated according to the following equation: wi =

Si 2 Ni 2

(1)

284

M. Rudnicki and P. Strumillo 1400 1350 1300 1250 1200 1150 1100 1050 1000 950 900 850 0

200

400

600

800

1000

1200

1400

Fig. 3. Sample ECG signal (recording no. 103 from MIT-BIH Arrhythmia Database) 8 800 700 600 500 400 300 200 100 0

7 6 5 4 3 2 1 0

200

400

600

800

1000

1200

1400

Fig. 4. Absolute values of the DWT coefficients obtained for the D4 wavelet for the ECG signal from Fig. 3; the darker the region, the higher the value of the wavelet coefficient

where Si is the mean of the DWT coefficients from the i-th decomposition level within QRS complex interval and Ni is the mean of the DWT coefficients form the i-th decomposition level outside of the QRS complex. One can interpret wi as a signal-to-noise ratio of the QRS complex to other signal components at a given decomposition level. Therefore, Si2 can be seen as the energy of the QRS complex and Ni2 is equal to the energy of noise and other ECG features. Next, the DWT coefficients are multiplied by those weighting values and the results are summed up across scales. The following equation describes this procedure: 5  wi · di (n) (2) b(n) = i=3

A Real-Time Adaptive Wavelet Transform-Based QRS Complex Detector

285

where n indicates the n-th signal sample, di are the DWT coefficients at the i-th decomposition level and wi are the corresponding weights. The obtained samples b(n) are passed to the next processing step of the algorithm. Fig. 5 shows a plot of the processed signal after this intermediate step. 30000

25000

20000

15000

10000

5000

0 0

200

400

600

800

1000

1200

1400

Fig. 5. The processed signal after weighting the DWT coefficients and summing them up across the selected scales

The following moving window filtering is then used to smooth out multiple peaks corresponding to the QRS complex intervals: y(n) =

1 [b(n − (N − 1)) + b(n − (N − 2)) + · · · + b(n)] N

(3)

where N is the window width. This parameter should be chosen carefully for good performance of the QRS complex detection [12]. In our algorithm filter order N =32 is used. 2.3

Peak Detection and Thresholding

The principle of peak detection is that the monotonicity of the function within a predefined time interval is determined. Whenever it changes from an increasing value to the decreasing one, a new peak is detected and then categorised. The method for peaks classification is based on the algorithm described in [12] with some small modifications. In short, there is a threshold value T which is compared with values of the detected peaks. If a peak is higher than T , it is classified as a true QRS peak and as a noise otherwise. Value of T is recalculated every time a new peak is classified using the following equations: T = PN + η · (PS − PN )

(4)

PS = 0.2 · P + 0.8 · PS

if P is the signal peak

(5)

PN = 0.2 · P + 0.8 · PN

if P is the noise peak

(6)

286

M. Rudnicki and P. Strumillo

where P is the value of the processed peak; PS is the old value of the running estimate of the signal peak; PS is the new value of the running estimate of the signal peak; PN is the old value of the running estimate of the noise peak; PN is the new value of the running estimate of the noise peak; and η is the adjustable coefficient. By changing η one can find the optimal ratio between false positive ans false negative QRS complex detections. The optimal value of η = 0.3 was empirically found for the MIT-BIH recordings and the D4 wavelet was used in the DWT. Additionally, the so-called refractory period is taken into account. During this period that occurs immediately after any QRS complex, the cardiac tissue is not able to respond to any excitation and cause another QRS complex. Length of the refractory period is approx. 0.2 s and all the peaks within this time interval are automatically classified as noise peaks.

3

Adaptive Update of Weights

In order to improve the performance of the algorithm, a concept of continuous on-line adjustment of the weights defined in Sect. 2.2 is introduced. Any shape variations of QRS complexes or changes in noise characteristic are reflected in changes of the DWT coefficients. The weights follow those changes and emphasise scales most relevant to the QRS complexes. For example, if any scale is contaminated by noise, the value of the corresponding weight decreases. Each time a new QRS complex is detected, new values of the weights at the i-th DWT scale are calculated according to the following equation: wi = 0.97 · wi + 0.03 · vi

(7)

where wi is the new value of the running estimate of the weight; wi is the old value of the running estimate of the weight and vi is the current value of the weight calculated from the most recent DWT coefficients. Flow diagram illustrating this weight update scheme inserted in a feedback loop of the proposed QRS detection algorithm is shown in Fig. 6. Update of Weights

ECG

QRS annotation

Preprocessing Stage

Decision Stage

Fig. 6. Flow diagram of the QRS complex detection algorithm

A Real-Time Adaptive Wavelet Transform-Based QRS Complex Detector

4

287

Results

The algorithm was tested against a standard ECG database, i.e. the MIT-BIH Arrhythmia Database. The database consists of 48 half-hour ECG recordings and contains approximately 109,000 manually annotated signal labels. ECG recordings are two channel, however for the purpose of QRS complex detection only the first channel was used (usually the MLII lead). Database signals are sampled at the frequency of 360 Hz with 11-bit resolution spanning signal voltages within ±5 mV range. QRS complex detection statistic measures were computed by the use of the software from the Physionet Toolkit provided with the database. The two most essential parameters we used for describing the overall performance of the QRS complex detector are: sensitivity Se and positive predictivity +P . Obviously, the QRS complex performance depends on the wavelet function used for the DWT. The best results as shown in Table 1 were obtained for the D4 wavelet. TP stands for the number of true positive detections; FP is the number of false positive detections and FN is the number of false negative detections. Table 1. The overall performance of the proposed QRS complex detection algorithm on MIT-BIH Arrhythmia Database recordings for different types of wavelets Wavelet used TP Haar D4 D6

FP FN Se (%) +P (%)

90026 1221 1259 98.62 90864 440 421 99.54 90793 506 492 99.46

98.66 99.52 99.45

The algorithm was tested in two additional configurations. In both cases the D4 wavelet was used as the basis function for the DWT. For those tests the adaptive mechanism of weighting coefficients adjustment was turned off. In the first case the weights were set to unity. Whereas in the second case they were set to values obtained after processing of the first 11 minutes of recording no. 119. The normalised values of those coefficients are given below: w3 = 10.9

w4 = 8.1

w5 = 1.0

(8)

Recording no. 119 was selected as the regular ECG signal with a very low noise level. Table 2 shows the results. Table 2. The performance of the algorithm without the adaptive adjustment of the weighting coefficients Weighting coef. TP

FP FN Se (%) +P (%)

All equal to 1 89281 1770 2004 97.80 As in (8) 90858 449 427 99.53

98.06 99.51

288

M. Rudnicki and P. Strumillo

Additionally, the time accuracy of the detections was estimated. The root mean square of the R-R interval error between the reference annotations and the tested annotations is around 20 ms.

5

Conclusions

This study has confirmed that the DWT can be successfully applied for the QRS complex detection. For our detector tested on the MIT-BIH Arrhythmia Database ECG recordings, the best results were obtained for the Daubechies 4 wavelet. However, as reported in literature, very good detection results can be also obtained for other wavelet families. The proposed scheme for weighting the DWT coefficients, as well as adaptive adjustment of these weights, have significantly improved detector performance. By these means the algorithm becomes more robust to variations in the QRS complex morphology and better adapts to changes in the noise characteristics. The achieved detection sensitivity (Se) and positive predictivity (+P ) are 99.54% and 99.52% correspondingly. However, it must be clear that after the weighting coefficients are adjusted to a certain level, the adaptation scheme gives no significant improvements in the performance and the coefficients do not vary substantially. Detector timing accuracy depends predominantly on the variations in the QRS complex morphology. The R-R interval error between the reference and the obtained annotations can be improved by modifications in the peak detection processing step. Hardware implementation of the algorithm on the TI TMS320C6713 DSP shows that the presented approach can be successfully used in real-time QRS complex detectors [8].

References 1. K¨ ohler, B.U., Hennig, C., Orhlmeister, R.: The principles of software QRS detection. Engineering in Medicine and Biology Magazine, IEEE 21(1) (2002) 42–57 2. Thakor, N.V., Webster, J.G., Tompkins, W.J.: Estimation of QRS complex power spectra for design of a QRS filter. IEEE Transactions on Biomedical Engineering 31(11) (1984) 702–706 3. Mallat, S.: A wavelet tour of signal processing. Academic Press (1998) 4. Kadambe, S., Murray, R., Boudreaux-Bartels, G.F.: Wavelet transform-based QRS complex detector. IEEE Transactions on Biomedical Engineering 46(7) (1999) 838–848 5. Strumillo, P.: Haar wavelet filter for precise detection of the QRS complex in ECGs. In: 5th International Conference on Computers in Medicine Lodz, Poland. (1999) 150–156 6. Alfonso, V.X., Tompkins, W.J., Nguyen, T.Q., Luo, S.: ECG beat detection using filter banks. IEEE Transactions on Biomedical Engineering 46(2) (1999) 192–202 7. Addison, P.S., Watson, J.N., Clegg, G.R., Holzer, M., Sterz, F., Robertson, C.E.: Evaluating arrhythmias in ECG signals using wavelet transforms. Engineering in Medicine and Biology Magazine, IEEE 19(5) (2000) 104–109

A Real-Time Adaptive Wavelet Transform-Based QRS Complex Detector

289

8. Rudnicki, M.: A real-time DSP implementation of wavelet transform-based QRS complex detector. Master’s thesis, Technical University of L ´ od´z (2006) 9. Mark, R., Moody, G.: MIT-BIH Arrhythmia Database Directory. MIT (1988) http://physionet.org/physiobank/ 10. Senhadji, L., Carroult, G., Bellanger, J.J., Passariello, G.: Comparing wavelet transforms for recognizing cardiac patterns. Engineering in Medicine and Biology Magazine, IEEE 14(2) (1995) 167–195 11. Mahmoodabadi, S.Z., Ahmadian, A., Abolhasani, M.D.: ECG feature extraction using Daubechies wavelets. In: Proceedings of the Fifth IASTED International Conference Visualization, Imaging, and Image Processing. (2005) 343–348 12. Tompkins, W.J., ed.: Biomedical Digital Signal Processing. Prentice-Hall International, Inc. (1993)

Suggest Documents