A Channel-Dependent Algorithm for Heart Beats ...

1 downloads 0 Views 2MB Size Report
aimed at detecting heart beat positions in ... (Pan-Tompkins) developed to detect beat positions in ECG .... pacemakers; most had ventricular ectopic beats.
A Channel-Dependent Algorithm for Heart Beats Detection in ECG Recordings Víctor Mondelo, María J. Lado, Arturo J. Méndez, Xosé A. Vila and Leandro Rodríguez-Liñares Department of Computer Science, ESEI Universidade de Vigo Ourense, Spain

(vmondelo, mrpepa, mrarthur, anton, leandro)@uvigo.es Abstract — This paper proposes a computerized technique aimed at detecting heart beat positions in electrocardiograms (ECGs). The algorithm was implemented by adapting one of the most popular methods (Pan-Tompkins) developed to detect beat positions in ECG records, to be used in different leads of multi-channel ECGs. First, the Pan-Tompkins algorithm was programmed, and next, a lead-dependent version was implemented, adapting thesholds for each of the ECG channels. The original algorithm was tested with the MITBIH Arrhythmia Database, while the performance of the improved technique was tested on the different channels of records from the St. Petersburg Database. For the original Pan-Tompkins algorithm, a sensitivity of Se = 99.81% was obtained, with a positive predictivity (P+) = 99.85%. The F-Score was 0.9587, and the RMS RR Interval Error (RMSRRIE) resulted to be 4,480.46 ms. For the modified algorithm, results yielded an average value for Se = 99.92%, P+ = 99.98%, F-Score = 0.9718, and a mean value of 111.05 ms. for the RMSRRIE. Results indicate that our improved method provides similar better sensitivity and positive predictivity, increased F-Score, and it significantly reduces the temporal error when estimating the positions of QRS complexes (combination of Q, R and S waves representing ventricular depolarization in an ECG signal). Keywords - electrocardiogram; QRS; heart beat detection, single-channel, multi-channel. I. INTRODUCTION One of the main causes of death in developed countries continues to be heart attack [1]. Even although many efforts are being made to reduce mortality rates due to cardiovascular disease (CVD), this type of disease is responsible of a high percentage of cases of the total deaths [2], [3]. It is clear that an early detection of the cardiac disease could reduce these mortality rates and, thus, contribute to the improvement in the health system, decreasing costs associated to treatments and hospitalization periods [4]. The electrocardiogram (ECG) reflects the electrical activity of the heart. Each heart contraction spreads an electrical impulse, which is recorded by several electrodes placed on the skin. The heart is composed of muscle cells that generate the mentioned contraction, and allow the transmission of the

electrical impulse [5]. Each beat is composed by a series of waves, caused by voltage variation of the cardiac cells, being one of the most important the Q, R and S waves, that form the QRS complex, which corresponds to a ventricular depolarization. The cardiac cycle includes two stages: a relaxation diastole and a contraction systole. The first phase includes the movement of blood from the atria into the ventricles, and starts when the ventricles begin to relax. The contraction systole is the response to an electrochemical stimulus to the heart cells [5]. The ECG analysis may provide information about the state of the heart, and is one of the most employed tools by clinicians to diagnose cardiac diseases and to detect abnormalities in the heart function. The analysis of an ECG consists of detecting beat positions, and delineating the waves composing each beat. For this task, it can be useful to have a deep knowledge about the features of the waves constituting it. Each beat is divided into three stages: 1) auricular depolarization (P wave), 2) ventricular depolarization (QRS complex) and ventricular depolarization (T wave). These three stages are continuously repeating in the ECG signal, representing heartbeats along the time. The analysis of the ECG is a time-consuming task. Many researchers have dedicated their efforts to develop automated algorithms to detect heartbeats, providing promising results in both detection and delineation of waves, and obtaining rates of success when detecting beats greater than 99.5 % [6], [7]. Most of the algorithms that can be found in literature to detect beats include varied techniques, such as filter banks [6], Hidden Markov Models [8], fusion of wave peaks with energy detectors [9], independent component analysis [10], wavelets, [11] or neural networks [12]. Other example is the well-known Pan-Tompkins algorithm, aimed at detecting beats in single-channel ECG recordings [13]. It is based on the slope, amplitude and width of the signal, and it is divided into two stages: 1) preprocessing: the ECG record is prepared for the detection of beats, removing (or reducing) noise, and 2) decision: smoothing the signal, and enlarging the slope and width of the QRS complex. In this stage, threshold values are applied to the signal, and noise peaks are rejected; this allows the detection of the signal peaks, which correspond to the QRS waves positions.

Most of the algorithms to detect beats, included the PanTompkins method, work on single-channel ECG recordings. However, in many occasions, different errors can occur, due to signal degradation or presence of noise, leading to inaccuracy in beat position detection, false positives, or even no detection. It is clear that, if we could use all channels of a multi-lead ECG recording for beat detection, the method could be more robust and efficient. The main goal of this work is to develop a channeldependent version of the Pan-Tompkins algorithm, adapted to all leads of a multi-channel ECG recording, in order to get better results in the detection rates, and that could be used to help specialists in the early detection of cardiac disease.

A. Pan-Tompkins Algorithm The Pan-Tompkins algorithm [3] applies over singlechannel ECG recordings, and detects heartbeat positions. The method is divided into two main stages: 1.

Preprocessing: several filters are applied over the ECG signal, trying to reduce noise by smoothing the signal. At the same time, both the slope and the width of the QRS complexes are magnified. In this way, an output modified signal was constructed.

2.

Decision: signal peaks are labeled as QRS complexes, after applying several thresholds to the output signal; specifically, the following threshold values were used:

II. DATABASES To assess the validity of our algorithms to detect heart beats in ECG recordings, we have used two public databases, described in the following Subsections. A. MIT-BIH Arrhythmia Database The MIT-BIH Arrhythmia Database contains 48 half-hour excerpts of two-channel ambulatory ECG recordings, belonging to 47 subjects, from the Boston's Beth Israel Hospital (now the Beth Israel Deaconess Medical Center). The recordings were digitized at 360 samples per second per channel with 11-bit resolution over a 10 mV range. From the 48 recordings, 23 were randomly selected from a set of 4000 24-hour ambulatory ECG recordings, and 25 were selected from the same set, in order to include less common but clinically significant arrhythmias that would not be wellrepresented in a small random sample. All the recordings were manually and independently annotated by a minimum number of two cardiologists [14], [15]. This database was used to test our implementation of the original Pan-Tompkins method [13]. B. St. Petersburg Database The St. Petersburg Database is constituted by 75 recordings extracted from 32 Holter records, from patients undergoing tests for coronary artery disease. None of the patients had pacemakers; most had ventricular ectopic beats. From the 32 patients, 17 were men and 15 were women, all of them aged between 18-80 years. All the recordings were annotated, being each record 30 minutes long, and with 12 leads, sampled at 257 Hz. The preference for a record to be included in the database was to belong to a patient suffering from ischemia, coronary artery disease, conduction abnormalities, and arrhythmias [15]. This database was used to measure the performance of the improved version of the Pan-Tompkins algorithm [13], because it contained multichannel ECG recordings. III. ALGORITHM IMPLEMENTATION As stated before, we have implemented: 1) the original PanTompkins algorithm [13], and 2) a channel-dependent version of the former algorithm. These implementations are described in the following paragraphs.

I1 = NPKI + 0.25 × (SPKI − NPKI) I2 = 0.5 × threshold I1

(1) (2)

SPKI and NPKI are the running estimates of the signal and noise peak values, respectively. Value threshold I2 is used only if threshold I1 fails to find a QRS complex within a certain distance from the previously detected one. B. Channel-Dependent Algorithm We have already mentioned that the Pan-Tompkins algorithm was developed to detect beat positions using only information from one single channel of the ECG. To extend the technique to multi-lead ECG signal, and once we have proved our implementation of the Pan-Tompkins method, we have implemented a modified version of this algorithm, by adapting thresholds and filtering procedures for each channel, in an adaptive way. As far as we know, this approach cannot be found in the literature. The method is a 2-step process, involving: 1.

Threshold adjustment: the fixed value of 0.25 in (1) was adapted to each channel. For this task, the value was replaced by a T threshold value, and leaddependent. In this way, this threshold was calculated with the expression: I1 = NPKI + T × (SPKI − NPKI)

(3)

For the value 0.5, present in (2), no modifications were performed. Table I shows the T values experimentally determined and optimized for each ECG channel. Threshold values were selected to maximize both sensititity and positive predictivity, explained later in the text. With these values, beat positions were detected over all the ECG recordings.

TABLE I.

2.

THRESHOLD VALUES ADAPTED FOR EACH ECG CHANNEL

ECG leads V6

T value

AVR, V2, V5

0.10

V1, V2, V3

0.08

I, II, III, AVF

0.05

AVL

0.02

0.25

V. RESULTS AND DISCUSSION In this work, we have first implemented the original PanTompkins algorithm, and next, we have developed a modified, improved version to work in multi-channel ECG recordings. In the following paragraphs, we present the results obtained in both implementations. 1.

Reduction of false positives: step 1 yielded better results when detecting the QRS complexes than the Pan-Tompkins algorithm; however, a new problem arose, since some false positives appear, due to the relaxation in the decision levels.

The first algorithm was developed employing the MIT-BIH Arrhythmia Database, obtaining a sensitivity of 99.81% with a corresponding P+ = 99.85%. The F-score and RMSRRIE were also calculated, yielding respectively, the values of 0.9983, and 1,261.19. Fig. 1 shows an example of the detection process over a single-channel ECG recording.

Then, a rule was established over the distance between consecutive beats. If the distance between one beat and its previous one was less than a certain value D, the beat was rejected. Otherwise, the beat was considered a real beat and kept. The value D was experimentally determined to maximize the detection rates, and was set to 40% of the median of the RR values (distance between beats) of each channel, calculated from the beats detected in step 1. IV. VALIDATION As it was explained before, we have developed two algorithms, and validated them employing two different databases. The MIT-BIH Arrhythmia Database was employed to validate our implementation of the Pan-Tompkins algorithm, and the St. Petersburg Database, containing multi-lead ECG recordings, was used to measure the detection ability of the modified version. Four well-known measures were used to validate our models, calculated from the TP (number of correctly detected beats), FN (undetected beats), and FP (number of false positives): 

(4)

(5)

F-Score: measure of the test accuracy. It is expressed as: F-Score = 2 x (P+ x Se) / (P+ + Se)



The channel-dependent version of this algorithm, adapted to multi-lead ECG recordings, was tested with the St. Petersburg Database. An example of the detection process over two different leads of the ECG recording is presented in Fig. 2.

Positive Predictivity (P+): measure of the probability for a real beat to be detected as real. It can be calculated from: P+ = TP / (TP + FP)



2.

Sensitivity (Se): measure of the proportion of real beats that are correctly identified as beats. It is given by: Se = TP / (TP + FN)



Figure 1. Beat detection in a single-channel ECG recording.

(6)

RMS (Root Mean Square) RR Interval Error (RMSRRIE), being the RR interval the distance between two consecutive beats.

Figure 2. B Beat detection in two different leads of a multi-channel ECG recording.

In this case, the F-Score and RMSRRIE were calculated and compared with the corresponding values of the unmodified version of the algorithm. For the channel-dependent implementation, we have obtained an average F-Score = 0.9718, and a mean RMSRRIE = 111.05. Values for sensitivity and positive predictivity were Se = 99.92%, and P+ = 99.98% These average values were calculated as the mean value of the F-Scores and RMSRRIE obtained for each individual channel. For example, for channel I, the F-score for the original Pan-Tompkins method was 0.9017, increasing this value to 0.9446 in our version. The corresponding RMSRRIE were 26,396.43 and 185.57, respectively. Similar values were obtained for each channel. In all cases, results were clearly higher in the improved implementation, related to those obtained with the original version of the Pan-Tompkins algorithm. This improvement was really remarkable in some “difficult-to-detect” ECG recordings, due to noise problems, signal degradation, or lack of a complete signal. An example can be ECG record I28, channel I, with a Se = 0.28%, P+ = 44.44% when detecting beats with the original Pan-Tompkins method, and Se = 99.01%, P+ = 99.22%, when the detection was performed employing the channel-dependent algorihtm VI. DISCUSSION Beat characterization is one of the most important tasks that must be performed by clinicians in order to detect cardiac abnormalities. Given the importance of this work, detection, as well as posterior classification of beats, are critical factors in diagnosing CVDs. When evaluating techniques for beat detection in ECG signals, a database of ECG recording should be used, where the presence of beats must be well established. In many ocasions, comparison of the different methods is not an easy task, because researchers employ different databases to test their algorithms, and uniform conditions to collect all the ECG data are not always provided. To solve this problem, many public databases are accesible to investigators, who can, in this way, test their algorithms and compare them with other researchers’ works, under the same ECG conditions. In this way, many research groups have developed algorithms to dectect beats in ECG recordings, and tested their methods employing the MIT-BIH Arrhythmia Database. Afonso et al. [6]. obtained a Se = 99.59%, and a P+ = 99.56%. Results of Martínez et al. were Se = 99.80%, and P+ = 99.86% [11]. Lee et al. developed a method that provided Se = 99.69%, and P+ = 99.88% [16]. The technique implementd by Fard et al. [17] yielded Se = 99.79%, and P+ = 99.89%. Finally, Elgendi obtained Se = 99.78%, and P+ = 99.87%. When comparing our results with those previous values, we can observe that P+ is similar, and Se is slightly better.

Even altough we have obtained very acceptable values for sensitivity and positive predictivity, as well as for the F-score and for the RMSRRIE, we are aware that detection of beats in single-channel ECG recordings can be limited by several aspects, such as the quality of the signal, the presence of noise, or the loss of several parts of the signal. A posible solution to these detection problems could be the implementation of a method capable of detecting beats along the different channels of a multi-lead ECG signal. It has already been stated that, at present, the majority of techniques detect beats in single-channel ECGs, and only a few papers can be found in the literature, dealing with multi-channel beat detection. This is the case of the paper of Yochum et al. [19], or Mehta and Lingayat 
[20]. In this reaserch paper, and making use of our implementation of the Pan-Tompkins method, we have devised this single-channel method, by adapting threhsolds and filtering procedures for each channel. We believe that our detection results can be used as a part of a further algorithm to detect beats with a multi-channel detection method.
 VII. CONCLUSIONS Since many years ago, ECG signals have been used as a powerful tool to diagnose cardiac diseases. In particular, many computerized methods to detect beats have been developed by researchers. A large number of techniques are aimed at detecting QRS complexes and other heart waves in singlechannel ECG recordings. We have also developed a computerized method to detect beats in ECG recordings. The method was implemented taking as starting point the Pan-Tompkins algorithm, that was improved and modified to be capable of dealing with multichannel ECG signals. Results achieved with our system indicate that the algorithm can be a useful technique to help clinicians in the diagnosis of cardiac abnormalities. Future work will address the issue of implementing an algorithm that combines the detection information provided by each channel, in order to detect beats in multi-lead ECG signals. REFERENCES [1]

[2]

[3]

[4]

[5]

World Health Organization, Fact sheet no. 317, Cardiovascular diseases (CVDs) (2007). http://www.who.int/mediacentre/factsheets/fs317/en/index.html. R. Ocaña-Riola, E. Blanco-Reina, E. Moreno-Navarro, and J.M. Mayoral-Cortés, “Age- period-cohort effects on mortality from cerebrovascular disease in southern Spain,” Journal of Stroke Cerebrovascular, vol. 23(9), pp. 2274–2282, 2014. D. Mozaffarian, E.J. Benjamin, A.S. Go AS, et al, “Executive Summary: Heart Disease and Stroke Statistics-2016 Update: A Report From the American Heart Association,” Circulation, vol. 133(4), pp. 447–454, 2016. S.S. Lim, T.A. Gaziano, E. Gakidou, et al., “Prevention of cardiovascular disease in high-risk individuals in low-income and middle-income countries: health effects and costs,” Lancet, vol. 370(9604), pp. 2054–2062, 2007. Thaler MS, “The only EKG book you’ll ever need,” Lippincott Williams & Wilkins, 2007.

[6]

[7]

[8]

[9]

[10]

[11]

[12]

[13]

[14]

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(2), pp. 192–202, 1999. M. Adnane, Z. Jiang, and S. Choi, ”Development of QRS detection algorithm designed 
for wearable cardiorespiratory system,” Computer Methods and Programs in Biomedicine, vol. 93(1), pp- 20–31, 2009. R.V. Andreao, B. Dorizzi, J. Boudy, AND J.C.M. Mota, “ST-segment analysis using hidden Markov Model beat segmentation: application to ischemia detection,” In Computers in Cardiology, pp. 381-384, 2004. A.E. Johnson, J. Behar, F. Andreotti, G.D. Clifford, and J. Oster, “Multimodal heart beat detection using signal quality indices,” Physiological Measurement, vol. 36(8), pp. 1665, 2015. J. Kuzilek, and L. Lhotska, “Electrocardiogram beat detection enhancement using Independent Component Analysis,” Medical Engineering & Physics, vol. 35(6), pp. 704-711, 2013. J.P. Martínez, R. Almeida, S. Olmos, A.P. Rocha, and P. Laguna, “A wavelet-based ECG delineator: evaluation on standard databases,” IEEE Transactions on Biomedical Engineering, vol. 51(4), pp. 570-581, 2004. S. Osowski, and T.H.Linh, “ECG beat recognition using fuzzy hybrid neural network,” IEEE Transactions on Biomedical Engineering, vol. 48(11), pp. 1265-1271, 2001. J. Pan, and W.J. Tompkins, “A real-time QRS detection algorithm,” IEEE Transactions on Biomedical Engineering, vol. 3, pp. 230–236, 1985. G.B. Moody, and R.G. Mark, “The impact of the MIT-BIH Arrhythmia Database,” IEEE Engineering in Medicine and Biology,” vol. 20(3), pp. 45-50, 2001.

[15] A.L. Goldberger, L.A.N. Amara, L. Glass, J.M. Hausdorff, P.Ch. Ivanov, R.G. Mark, J.E. Mietus, G.B. Moody, C.-K. Peng, and H.E. Stanley, “PhysioBank, PhysioToolkit, and PhysioNet: Components of a New Research Resource for Complex Physiologic Signals,” Circulation, vol. 101(23), pp. e215-e220, 2001 [Circulation Electronic Pages; http://circ.ahajournals.org/content/101/23/e215.full]. [16] J. Lee, K. Jeong, J. Yoon, and M. Lee, M, “A simple real-time QRS detection algorithm. In Engineering in Medicine and Biology Society, 1996. Bridging Disciplines for Biomedicine. Proceedings of the 18th Annual International Conference of the IEEE, vol. 4, pp. 1396-1398, 1996. [17] P.J.M. Fard, M. Moradi, and M.Tajvidi, “A novel approach in R peak detection using 
Hybrid Complex Wavelet (HCW), “International Journal of Cardiology, vol. 124(2), pp. 250–253, 2008. [18] M. Elgendi, “Fast QRS detection with an optimized knowledge-based method: Evaluation on 11 standard ECG databases,” PloS One, vol. 8(9), pp. e73557, 2013.
 [19] M. Yochum, C. Renaud, and S. Jacquir, “Automatic detection of P, QRS and T patterns 
in 12-leads ECG signal based on CWT,” Biomedical Signal Processing, vol. 25, pp 46–52, 2016. 
 [20] S. S. Mehta and N. S. Lingayat, “Application of support vector machine for the detection of P-and T-waves in 12-lead electrocardiogram,” Computer Methods and Programs in Biomedicine, vol. 93(1), pp. 46–60, 2009.

Suggest Documents