parameter extraction of ecg signals in real-time

0 downloads 0 Views 88KB Size Report
PARAMETER EXTRACTION OF ECG SIGNALS. IN REAL-TIME. U. Kunzmann. 1. , G. von Wagner. 1. , J. Schöchlin. 1. , A. Bolz. 1,2. 1. Medical Information ...
PARAMETER EXTRACTION OF ECG SIGNALS IN REAL-TIME U. Kunzmann1, G. von Wagner1, J. Schöchlin1, A. Bolz1,2 1

Medical Information Technology, FZI Forschungszentrum Informatik Karlsruhe, Germany 2 Institute for Biomedical Engineering, Universität Karlsruhe (TH), Germany [email protected]

Abstract In order for a mobile ECG recorder to be able to classify a heart rhythm online, the significant parameters must be extracted. The relevant parameters are the beginning, peak and end of the QRS-complex, the P- and T-waves, the ST-segment and other significant intervals, such as the RR-interval. The aim of the development was, firstly, stable, realtime-capable QRS detection, which finally achieved values for sensitivity of 98.9% and a positive predictivity of 99.9% on standard ECG databases. Also, a filterbased detection of P- and T-waves was implemented, which can also be performed in real-time on a microcontroller platform. Keywords QRS detection, standard ECG databases, time domain, P- and T-wave detection, simulation

Motivation Long-term ECG-monitoring plays a key role in heart disease analysis. The long-term objective, however, is to automate the ECG event classification in order to further enhance medical treatment. In order to classify the ECG signal, a reliable extraction of the characteristic ECG parameters is needed. The research objective is the development of an ECG parameter detection algorithm which can fulfill the defined requirements. The algorithm will be implemented on mobile devices and needs to be robust against noise and artifacts, which often occur in such an environment. At the same time, the algorithm needs to be fast and resourceefficient, which requires straight signal processing with minimum iterations.

Materials Detection algorithms are implemented in Matlab / Simulink produced by MathWorks, Inc. [1]. This software allows easy programming for technical applications and signal processing. A simulation model was created to develop and implement the parameter extraction algorithms, which were then evaluated by comparing the new test annotation file with the existing reference annotation file of the ECG signal. For more details on the simulation model, see [2]. For this evaluation process, internationally-recognized databases with ECG signals and reference annotations have been used. Most of them are listed on PhysioNet [3]. The following three databases served for QRS detection:

• MIT DB: The Massachusetts Institute of Technology – Beth Israel Hospital Arrhythmia Database [4] • AHA DB: The American Heart Association ECG Database [5] • ESC DB: The European Society of Cardiology ST-T Database [6] A special database served for evaluating the algorithm’s noise sensitivity: • NST DB: The MIT-BIH Noise Stress Test Database [4] The quality of the entire ECG signal parameter vector, including the P- and T-waves, was tested using the following database: • QT DB: The QT Database [7] These databases are the only available public source for the comprehensive testing of ECG classification algorithms with a minimum of statistical constraints.

Methods R

R RR-Interval

P

P T

T PEnd

TEnd

PBegin Q

S

Q S

Figure 1: Parameters of the ECG signal in the time domain A completely detected ECG signal vector contains the following parameters (compare Figure 1): • P-wave: Time of the beginning, maximum, end; amplitude • QRS: Time of the beginning, R-spike, end; amplitude • T-wave: Time of the maximum/minimum (depending on the polarization), 2nd extremum (if available), end; amplitude • ST: deviation and slope • Derived parameters: RR-interval, PQ-interval, QT-length The QRS complex is detected first. The T- and P-waves are then detected with a different algorithm from the

ECG signal vector. Afterwards, the remaining parameters are derived. The flowchart in Figure 2 shows the major detection steps. ST Segment QRS Detection

ECG signal

Parameter Extraction Signal processing

T Wave Detection

P Wave Detection

Before the detection of a QRS complex starts, the algorithm checks the existence of noise in the signal. In case of noise, the algorithm stops, since no reliable detection can be assured (see Figure 3). In addition, the time between two QRS complexes needs to be at least 0.2s. This time refers to the physiologic refractory time and ensures that a high T-wave is not falsely detected as a QRS-complex .

Figure 2: Flowchart of parameter vector detection

Start

ECG-Signal

MOBD

Artefact Detection

QRS Detection Fast signal processing was the main criterion for selecting the different QRS detection algorithms. The algorithms of Saxena [8], So [9] and the Multiplication Of the Backward Difference (MOBD) [10] satisfy this criterion best and have been implemented and tested with two sample ECG records of the MIT DB. The ECG recording 100 does not contain any noise, while the recording 104 includes disturbed signals. The best existing QRS detection algorithm was then selected for further performance improvement. In making this decision, the positive predictivity (+P) was rated higher than the sensitivity (SE), because later in development, minimization of false positives is more difficult than increasing the algorithm’s sensitivity. The test results for both statistical parameters are shown for all three algorithms in Table 1.

no

no

Noise detected ? yes

Distance to last QRS > 1.5 * RR-interval ?

HighThres divided by 2

Distance to last QRS > 0.2s ?

no

yes QRS Detection

no

QRS detected ?

no

Table 1: Evaluation of the different QRS detection algorithms for two ECG signals Algorithm Saxena So MOBD

Signal Record 100 Record 104 Record 100 Record 104 Record 100 Record 104

SE [%] +P [%] 100.00 97.73 75.81 47.96 100.00 99.23 92.74 79.31 100.00 100.00 86.29 87.70

The MOBD algorithm showed the best performance with the highest sensitivity and positive predictivity for the undisturbed signal, and a significantly greater positive predictivity for the disturbed one. With a time delay of four samples under optimal signal conditions, it is also the fastest algorithm of the three tested. Therefore, the developed QRS detection algorithm has been based on the MOBD algorithm. The key element of the MOBD algorithm is the one-point derivative of the ECG signal u and the sgn-function, ensuring stable and fast slope detection, as can be seen in equation (1). A value of N=4 has been chosen. x[n] = u[n] − u[n-1]

 0, if sgn (x[n-k ]) ≠ sgn (x[n-(k + 1)]) , k = 0,1,K N- 2 (1)

y( n) =  N −1  kΠ=0 x[n-k ]

, else

Decision tree optimization and dynamic threshold adaptation were identified to further enhance the algorithm and reach even better detection results. Also, noise and artifact detection are implemented.

yes

no

yes

Current RR-interval < ¼ * mean RR-interval or < 0.3s ?

HighThres > 1/100 of mean MOBD-amplitude ?

yes Increase HighThres

yes Adapt HighThres

End

Figure 3: Flow chart of the QRS detection algorithm The MOBD signal needs to have two peaks in order to detect a QRS complex. Two different thresholds are implemented (HighThres and LowThres), since the peak amplitudes may vary. The relation between both thresholds is set to: 1 (2) LowThres = ⋅ HighThres 5

5

1

A

B

C

D

Figure 4: Possible peak combinations of the QRS complex in the MOBD signal Figure 4 shows possible combinations of the two peaks. A QRS-complex is only detected if at least one of the two peaks crosses HighThres (upper line in Figure 4) and the other peak crosses at least LowThres (lower line in Figure 4). Constellations A, B and C in Figure 4 are

valid QRS complexes, since they fulfill the described criteria. Figure 4.D is not a valid QRS-complex, since both peaks are lower than HighThres. The amplitude of the MOBD signal changes significantly within one signal. Therefore, an adaptation of HighThres and LowThres is needed. The adaptation depends mainly on the following heuristic rules: • The mean RR interval: if the distance to the last detected QRS complex > 1.5 times the mean RR interval Æ HighThres=1/2 HighThres If actual RR-interval < ¼ the mean RR interval Æ HighThres=5/4 HighThres • The mean MODB amplitude: If HighThres < 1/100 mean MOBD amplitude Æ HighThres = 1/100 mean MOBD amplitude • The amount of HighThres/4 crossings of the MOBD signal within 0.7 s (NCross): If NCross < 15, an artifact is detected and HighThres is increased. At the end of the artifact, HighThres is set to the original value. The QRS beginning is detected when LowThres is crossed by the MOBD signal for the first time. The QRS end is detected after the second peak has been detected and LowThres is not crossed again within 47 ms. The last time LowThres was crossed is defined as the end of the QRS complex. ST-segment The ST deviation is derived 80 ms after the endpoint of the QRS complex, if the RR-interval is greater than 0.7s. If the RR-interval is smaller than 0.7s, the amplitude is measured 60ms after the QRS complex has ended. The slope is calculated for the following 20 ms [11]. T- and P-wave detection A different algorithm is used for the T- and P-wave detection, based on the Joeng algorithm [12]. Joeng’s equation is in non-causal form. Since future values are not available, it has to be transformed into a causal form:

∑ D (n) =

8

(4 − i) X (n − i) i =0

(3) 60 The remaining signal is smoothed with a moving average filter. The algorithm searches for the T-wave, after a QRScomplex has been detected. The T-wave is expected within a specific time window (see Figure 5). The start and duration of the window depends on the RR-interval [13]: If the RR-interval > 0.7 s: TwaveWindowBegin = 0.08s after QRS end TwaveWindowEnd = 0.44s If RR-interval < 0.7 s: TwaveWindowBegin = 0.04s after QRS end TwaveWindowEnd= (0.7RR-interval-0.06) s

Figure 5: Search windows for T- and P-wave location Within this window, the minimum, maximum and order of the slopes of the derived function are important for detecting the T-wave. Biphasic T-waves can be identified in the same way. The change of slope, as well as the end of the T-wave, is detected based on thresholds. The slope must include positive and negative values and the slope magnitude needs to be at least 0.006 mV/s for a T-wave to be detected. The P-wave is located between the end of the T-wave and the beginning of a new QRS complex (see Figure 5). The detection rule for a P-wave is a positive slope followed by a negative slope. The magnitude of both slopes has to be greater than 0.004 mV/s. The algorithm searches for this combination, until the beginning of a new QRS complex is detected. The last wave detected is the P-wave. This ensures that a U-wave is not falsely detected as a P-wave.

Results The QRS detection algorithm was tested with the MIT DB, the AHA DB, and the ESC DB. The implemented algorithm works very reliably for the tested databases, since sensitivity and positive predictivity of 98.89% and 99.87%, respectively, were reached (see Table 2). Compared to the MIT DB and the AHA DB, the ESC DB provides the largest amount of beats, and therefore has the highest influence on the overall weighted performance. Table 2: Results for QRS detection Database MIT AHA ESC Total

No. of beats Se [%] 91283 98.86 181564 97.61 753391 99.21 1026238 98.89

+P [%] 99.73 99.83 99.90 99.87

It is possible to test the algorithm’s noise sensitivity with the NST DB. Table 3 shows the results for the different signal-tonoise-ratios (SNR). The reliability of the algorithm varies with different SNRs. The algorithm still works reliably for SNRs greater than 12 dB. Results get significantly worse with lower SNRs. The detection algorithm of all parameters is evaluated based on the QT DB. The results of the QRS detection are as good as expected compared to the single QRS

detection (see Table 4). The P- and T-wave detection had lower sensitivity results. The positive predictivity is better, but not nearly as good as the QRS detection. Table 3: QRS detection results tested with the NST DB SNR [dB] -6 0 6 12 18 24

No. of beats 3577 3577 3577 3577 3577 3577

Se [%] 76.18 87.36 95.47 98.49 99.83 99.94

+P [%] 68.52 78.72 91.48 99.52 99.92 99.89

References [1] [2]

Table 4: Results for the entire parameter extraction, tested with the first channel of the QT DB . Parameter No. of Se [%] +P [%] beats P-Begin 3104 69.33 87.73 P-Peak 3104 73.81 93.40 P-End 3104 77.58 98.21 QRS-Begin 3533 99.01 99.74 QRS-Peak 3533 99.18 99.94 QRS-End 3533 99.18 99.94 T-Peak 3466 86.48 89.95 T-End 3459 77.77 81.86

tivity levels acceptable for implementation in technical applications. One reason for the unsatisfying P- and Twave detection capabilities, especially the great variety of detected waveform locations, is the fact that fixed thresholds have been used for detection. Implementation of threshold adaptation, like the one used in QRS detection, will most likely bring significant improvement.

Mean

STD

0.003 -0.012 -0.019 -0.020 0.008 0.026 -0.040 -0.068

0.068 0.040 0.035 0.010 0.006 0.011 0.035 0.046

The graph in Figure 6 compares the overall mean error to the maximum and minimum mean errors of each detection. It also shows the standard deviation (STD). The QRS complex is detected only a few samples too early or too late, which is acceptable. The T-wave, however, is detected much later than the actual annotation mark, so needs further enhancement.

[3] [4]

[5] [6]

[7]

[8]

[9]

[10]

Figure 6: Standard deviation and mean error of the parameter vector

[11]

Conclusion and Discussion

[12]

The developed QRS detection algorithm is very reliable with a positive predictivity of 99.87% and a sensitivity of 98.86%. It only needs four samples to detect the R peak and an acceptable 47 ms to find the end of the complex. The QRS detection is also insensitive to SNRs up to 12dB. In case of VT/VF, the algorithm has only limited ability to detect the QRS complex, since VT/VF may be misinterpreted as artifacts. A possible solution could be the implementation of an additional VT/VF detector. The P- and T-wave detection algorithm still needs improvement before reaching sensitivity and positive predic-

[13]

The MathWorks, Inc., http://www.mathworks.com G. von Wagner, U. Kunzmann, J.Schöchlin, A. Bolz, „Simulation Methods for the online extraction of the ECG Parameters under Matlab/Simulink”, Biomedizinische Technik, Vol. 47, 2002 PhysioNet: Research Resource for Complex Physiologic Signals, http://www.physionet.org A.L. Goldberger, et al., “PhysioBank, PhysioToolkit, and Physionet: Components of a New Research Resource for Complex Physiologic Signals” Circulation, Vol. 101(23), pp. 215-220, 2000 ECRI, http://www.healthcare.ecri.org A. Taddei, et al., “The European ST-T Database: standard for evaluating systems for the analysis of ST-T changes in ambulatory electrocardiography”. European Heart Journal, Vol. 13, pp. 1164-1172, 1992 P. Laguna, R.G. Mark, A. Goldberger, G.B. Moody, „A Database for Evaluation of the Algorithms for Measurement of the QT and Other Waveform Intervals in the ECG”, Computers in Cardiology, Vol. 24, pp. 673-676, 1997 S.C. Saxena, A. Sharma, and S.C. Chaudhary, “Data compression and feature extraction of the ECG signals” International Journal of Systems Science, Vol. 23(5), pp. 483-498, 1997 H.H. So and K.L. Chan, “A Comparison of three QRS-Detection Algorithms Using the AHA ECG Database”, Proceedings of the Annual International Conference of the IEEE Engineering in Medicine and Biology Society, Vol. 13, pp. 586-587, 1991 T.A. Wrublewski, Y.Sun, and J.A. Beyer, “Real-time early detection of R waves of the ECG signals”, Engineering in Medicine and Biology Society, Vol. 1, pp. 38-39, 1989 B.-D. Gonska, R. Heinecker, EKG in Klinik und Praxis, Stuttgart, New York: Thieme, 1999 H.-K. Joeng, K.-K Kim, S.C. Hwang, and M.-H. Lee, “A new Algorithm for P-Wave detection in the ECG Signal”, Proceedings of the Annual International Conference of the IEEE Engineering in Medicine and Biology Society, Vol. 1, pp. 42-43, 1989 P. Laguna, et al., “New Algorithm for QT Interval Analysis in 24-hour Holter ECG: Performance and Applications”, Med. & Biol. Eng. & Comput., Vol. 28, pp. 67-73, 1990

Suggest Documents