Heart rate variability (HRV) is derived from the R-R interval, which depends on the precise localization of R-peaks within an electrocardiogram (ECG) signal. However, current algorithm assessment methods prioritize the R-peak detection's sensitivity rather than the precision of pinpointing the exact R-peak positions. As a result, it is of great value to develop an R-peak detection algorithm with high-precision R-peak localization. This paper introduces a novel R-peak localization algorithm that involves modifications to the well-established Pan-Tompkins (PT) algorithm. The algorithm was implemented as follows. First, the raw ECG signal $ X\left(i\right) $ was band-pass filtered (5–35 Hz) to obtain a preprocessed signal $ Y\left(i\right) $. Second, $ Y\left(i\right) $ was squared to enhance the QRS complex, followed by a 5 Hz low-pass filter to obtain the QRS envelope, which was transformed into a window signal $ W\left(i\right) $ by dynamic threshold with a minimum width of 200 ms to mark the QRS complex. Third, $ Y\left(i\right) $ was used to generate QRS template $ T\left(n\right) $ automatically, and then the R-peak was identified by a template matching process to find the maximum absolute value of all cross-correlation values between $ T\left(n\right) $ and $ Y\left(i\right) $. The proposed algorithm achieved a sensitivity (SE) of 99.78%, a positive prediction value (PPV) of 99.78% and data error rate (DER) of 0.44% in R-peak localization for the MIT-BIH Arrhythmia database. The annotated-detected error (ADE), which represents the error between the annotated R-peak location and the detected R-peak location, was 8.35 ms for the MIT-BIH Arrhythmia database. These results outperformed the results obtained using the classical Pan-Tompkins algorithm which yielded an SE of 98.87%, a PPV of 99.14%, a DER of 1.98% and an ADE of 21.65 ms for the MIT-BIH Arrhythmia database. It can be concluded that the algorithm can precisely detect the location of R-peaks and may have the potential to enhance clinical applications of HRV analysis.
Citation: Diguo Zhai, Xinqi Bao, Xi Long, Taotao Ru, Guofu Zhou. Precise detection and localization of R-peaks from ECG signals[J]. Mathematical Biosciences and Engineering, 2023, 20(11): 19191-19208. doi: 10.3934/mbe.2023848
Heart rate variability (HRV) is derived from the R-R interval, which depends on the precise localization of R-peaks within an electrocardiogram (ECG) signal. However, current algorithm assessment methods prioritize the R-peak detection's sensitivity rather than the precision of pinpointing the exact R-peak positions. As a result, it is of great value to develop an R-peak detection algorithm with high-precision R-peak localization. This paper introduces a novel R-peak localization algorithm that involves modifications to the well-established Pan-Tompkins (PT) algorithm. The algorithm was implemented as follows. First, the raw ECG signal $ X\left(i\right) $ was band-pass filtered (5–35 Hz) to obtain a preprocessed signal $ Y\left(i\right) $. Second, $ Y\left(i\right) $ was squared to enhance the QRS complex, followed by a 5 Hz low-pass filter to obtain the QRS envelope, which was transformed into a window signal $ W\left(i\right) $ by dynamic threshold with a minimum width of 200 ms to mark the QRS complex. Third, $ Y\left(i\right) $ was used to generate QRS template $ T\left(n\right) $ automatically, and then the R-peak was identified by a template matching process to find the maximum absolute value of all cross-correlation values between $ T\left(n\right) $ and $ Y\left(i\right) $. The proposed algorithm achieved a sensitivity (SE) of 99.78%, a positive prediction value (PPV) of 99.78% and data error rate (DER) of 0.44% in R-peak localization for the MIT-BIH Arrhythmia database. The annotated-detected error (ADE), which represents the error between the annotated R-peak location and the detected R-peak location, was 8.35 ms for the MIT-BIH Arrhythmia database. These results outperformed the results obtained using the classical Pan-Tompkins algorithm which yielded an SE of 98.87%, a PPV of 99.14%, a DER of 1.98% and an ADE of 21.65 ms for the MIT-BIH Arrhythmia database. It can be concluded that the algorithm can precisely detect the location of R-peaks and may have the potential to enhance clinical applications of HRV analysis.
[1] | K. M. Dalmeida, G. L. Masala, HRV features as viable physiological markers for stress detection using wearable devices, Sensors, 21 (2021), 2873. https://doi.org/10.3390/s21082873 doi: 10.3390/s21082873 |
[2] | T. Dan, H. Yeheng, A. Cole, A. Roger, S. Rashmi, G. Yang, et al., The benefits of heart rate variability (HRV) in the assessment of health and exercise performance, Imaging J. Clin. Med. Sci., 9 (2022), 11–14. https://doi.org/10.17352/2455-8702.000136 doi: 10.17352/2455-8702.000136 |
[3] | A. R. Schwerdtfeger, C. Rominger, Feelings from the heart: Developing HRV decrease-trigger algorithms via multilevel hyperplane simulation to detect psychosocially meaningful episodes in everyday life, Psychophysiology, 58 (2021). https://doi.org/10.1111/psyp.13914 |
[4] | E. Mejía-Mejía, K. Budidha, T. Y. Abay, J. M. May, P. A. Kyriacou, Heart rate variability (HRV) and pulse rate variability (PRV) for the assessment of autonomic responses, Front. Physiol., 11 (2020). https://doi.org/10.3389/fphys.2020.00779 |
[5] | M. Frasch, Comprehensive HRV estimation pipeline in Python using Neurokit2: Application to sleep physiology, Methodsx, 9 (2022), 101782. https://doi.org/10.1016/j.mex.2022.101782 doi: 10.1016/j.mex.2022.101782 |
[6] | D. Romero, R. Jane, Relationship between sleep stages and HRV response in obstructive sleep apnea patients, in IEEE Engineering in Medicine and Biology Society. Annual International Conference, 2021 (2021), 5535. https://doi.org/10.1109/EMBC46164.2021.9630148 |
[7] | S. Raj, K. C. Ray, O. Shankar, Development of robust, fast and efficient QRS complex detector: A methodological review, Australas. Phys. Eng. Sci. Med., 41 (2018), 581–600. https://doi.org/10.1007/s13246-018-0670-7 doi: 10.1007/s13246-018-0670-7 |
[8] | B. Köhler, C. Hennig, R. Orglmeister, The principles of software QRS detection, Eng. Med. Biol. Mag., 21 (2002), 42–57. https://doi.org/10.1109/51.993193 doi: 10.1109/51.993193 |
[9] | B. R. Hopenfeld, Multiple channel electrocardiogram QRS detection by temporal pattern search, preprint, 2021. https://doi.org/10.1101/2021.08.15.456413 |
[10] | J. Rahul, M. Sora, L. Sharma, A novel and lightweight P, QRS, and T-peaks detector using adaptive thresholding and template waveform, Comput. Biol. Med., 132 (2021), 104307. https://doi.org/10.1016/j.compbiomed.2021.104307 doi: 10.1016/j.compbiomed.2021.104307 |
[11] | T. Sa, F. B. Reguig, The QRS complex detection using morphological filtering, Arch. Biomed. Sci. Eng., 2019 (2019), 1–6. https://doi.org/10.17352/abse.000011 doi: 10.17352/abse.000011 |
[12] | T. W. Bae, K. K. Kwon, Efficient real-time R and QRS detection method using a pair of derivative filters and max filter for portable ECG device, Appl. Sci., 9 (2019), 4128. https://doi.org/10.3390/app9194128 doi: 10.3390/app9194128 |
[13] | C. Nayak, S. Saha, R. Kar, D. Mandal, An efficient QRS complex detection using optimally designed digital differentiator, Circuits Syst. Signal Process., 38 (2019). https://doi.org/10.1007/s00034-018-0880-y |
[14] | S. Tabakov, I. Iliev, V. Krasteva, Online digital filter and QRS detector applicable in low resource ECG monitoring systems, Ann. Biomed. Eng., 36 (2008), 1805–1815. https://doi.org/10.1007/s10439-008-9553-5 doi: 10.1007/s10439-008-9553-5 |
[15] | N. Bui, G. Byun, The comparison features of ECG signal with different sampling frequencies and filter methods for real-time measurement, Symmetry, 13 (2021), 1461. https://doi.org/10.3390/sym13081461 doi: 10.3390/sym13081461 |
[16] | L. Bachi, L. Billeci, M. Varanini, QRS detection based on medical knowledge and cascades of moving average filters, Appl. Sci., 11 (2021), 6995. https://doi.org/10.3390/app11156995 doi: 10.3390/app11156995 |
[17] | F. Guendouzi, M. Attari, QRS complex detection in ECG signals using empirical wavelet transform and flower pollination algorithm, Period. Polytech. Electr. Eng. Comput. Sci., 66 (2022). https://doi.org/10.3311/PPee.20535 |
[18] | K. Daqrouq, A. Alkhateeb, W. Ahmad, E. Khalaf, M. Awad, E. Noeth, et al., A universal ECG signal classification system using the wavelet transform, Neural Network World, 32 (2022), 43–54. https://doi.org/10.14311/NNW.2022.32.003 doi: 10.14311/NNW.2022.32.003 |
[19] | W. Xu, F. Du, A robust QRS complex detection method based on Shannon energy envelope and Hilbert transform, J. Mech. Med. Biol., 22 (2022). https://doi.org/10.1142/S0219519422400139 |
[20] | H. Sharma, K. Sharma, ECG-derived respiration based on iterated Hilbert transform and Hilbert vibration decomposition, Australas. Phys. Eng. Sci. Med., 41 (2018). https://doi.org/10.1007/s13246-018-0640-0 |
[21] | J. P. D. V. Madeiro, J. A. L. Marques, T. Han, R. C. Pedrosa, Evaluation of mathematical models for QRS feature extraction and QRS morphology classification in ECG signals, Measurement, 156 (2020), 107580. https://doi.org/10.1016/j.measurement.2020.107580 doi: 10.1016/j.measurement.2020.107580 |
[22] | Y. Li, X. Tang, Z. Xu, H. Yan, A novel approach to phase space reconstruction of single lead ECG for QRS complex detection, Biomed. Signal Process. Control, 39 (2018), 405–415. https://doi.org/10.1016/j.bspc.2017.06.007 doi: 10.1016/j.bspc.2017.06.007 |
[23] | J. Rahul, M. Sora, L. D. Sharma, Dynamic thresholding based efficient QRS complex detection with low computational overhead, Biomed. Signal Process. Control, 67 (2021), 102519. https://doi.org/10.1016/j.bspc.2021.102519 doi: 10.1016/j.bspc.2021.102519 |
[24] | T. Nguyen, T. Nguyen, B. Ngo, R peak determination using a WDFR algorithm and adaptive threshold, Appl. Comput. Sci., 18 (2022), 19–30. https://doi.org/10.35784/acs-2022-18 doi: 10.35784/acs-2022-18 |
[25] | S. Modak, L. Y. Taha, E. Abdel-Raheem, A novel method of QRS detection using time and amplitude thresholds with statistical false peak elimination, IEEE Access, 9 (2021), 46079–46092. https://doi.org/10.1109/ACCESS.2021.3067179 doi: 10.1109/ACCESS.2021.3067179 |
[26] | S. K. Mukhopadhyay, S. Krishnan, Robust identification of QRS-complexes in electrocardiogram signals using a combination of interval and trigonometric threshold values, Biomed. Signal Process. Control, 61 (2020). https://doi.org/10.1016/j.bspc.2020.102007 |
[27] | X. Lu, M. Pan, Y. Yu, QRS detection based on improved adaptive threshold, J. Healthcare Eng., 2018 (2018), 1–8. https://doi.org/10.1155/2018/5694595 doi: 10.1155/2018/5694595 |
[28] | D. S. Benitez. A simple algorithm for detection of QRS onset in single channel ECG signals, in 2017 CHILEAN Conference on Electrical, Electronics Engineering, Information and Communication Technologies (CHILECON), (2017), 1–6. https://doi.org/10.1109/CHILECON.2017.8229647 |
[29] | H. Ahsan, C. Karmakar, J. Yearwood, Impact of ECG dataset diversity on generalization of CNN model for detecting QRS complex, IEEE Access, 7 (2019), 93275–93285. https://doi.org/10.1109/ACCESS.2019.2927726 doi: 10.1109/ACCESS.2019.2927726 |
[30] | Y. Brosnan, X. Dong, T. Lu, Inter-patient CNN-LSTM for QRS complex detection in noisy ECG signals, IEEE Access, 7 (2019), 169359–169370. https://doi.org/10.1109/ACCESS.2019.2955738 doi: 10.1109/ACCESS.2019.2955738 |
[31] | Y. Xiang, Z. Lin, J. Meng, Automatic QRS complex detection using two-level convolutional neural network, Biomed. Eng. Online, 17 (2018). https://doi.org/10.1186/s12938-018-0441-4 |
[32] | K. Zhao, Y. Li, G. Wang, Y. Pu, Y. Lian, A robust QRS detection and accurate R-peak identification algorithm for wearable ECG sensors, Sci. China Inf. Sci., 64 (2021). https://doi.org/10.1007/s11432-020-3150-2 |
[33] | J. Pan, W. Tompkins, A real-time QRS detection algorithm, Biomed. Eng. IEEE Trans., 32 (1985), 230–236. https://doi.org/10.1109/TBME.1985.325532 doi: 10.1109/TBME.1985.325532 |
[34] | M. A. Z. Fariha, R. Ikeura, S. Hayakawa, S. Tsutsumi, Analysis of Pan-Tompkins algorithm performance with noisy ECG signals, J. Phys. Conf. Ser., 1532 (2020), 12022. https://doi.org/10.1088/1742-6596/1532/1/012022 doi: 10.1088/1742-6596/1532/1/012022 |
[35] | G. B. Moody, R. G. Mark, The impact of the MIT-BIH arrhythmia database, IEEE Eng. Med. Biol. Mag., 20 (2001), 45–50. https://doi.org/10.1109/51.932724 doi: 10.1109/51.932724 |
[36] | A. Goldberger, L. A. Amaral, L. Glass, J. Hausdorff, P. Ivanov, R. Mark, et al., PhysioBank, PhysioToolkit, and PhysioNet: Components of a new research resource for complex physiologic signals, Circulation, 101 (2000), E215–E220. https://doi.org/10.1161/01.CIR.101.23.e215 doi: 10.1161/01.CIR.101.23.e215 |
[37] | D. Makowski, T. Pham, Z. J. Lau, J. C. Brammer, F. Lespinasse, H. Pham, et al., NeuroKit2: A python toolbox for neurophysiological signal processing, Behav. Res. Methods, 53 (2021), 1689–1696. https://doi.org/10.3758/s13428-020-01516-y doi: 10.3758/s13428-020-01516-y |
[38] | T. Nguyen, X. Qin, A. Dinh, F. Bui, Low resource complexity R-peak detection based on triangle template matching and moving average filter, Sensors, 19 (2019), 3997. https://doi.org/10.3390/s19183997 doi: 10.3390/s19183997 |
[39] | F. Liu, C. Liu, X. Jiang, Z. Zhang, Y. Zhang, J. Li, et al., Performance analysis of ten common QRS detectors on different ECG application cases, J. Healthcare Eng., 2018 (2018), 1–8. https://doi.org/10.1155/2018/9050812 doi: 10.1155/2018/9050812 |
[40] | B. Porr, L. Howell, R-peak detector stress test with a new noisy ECG database reveals significant performance differences amongst popular detectors, preprint, 2019. https://doi.org/10.1101/722397 |
[41] | U. Zalabarria, E. Irigoyen, R. Martinez, A. Lowe, Online robust R-peaks detection in noisy electrocardiograms using a novel iterative smart processing algorithm, Appl. Math. Comput., 369 (2020), 124839. https://doi.org/10.1016/j.amc.2019.124839 doi: 10.1016/j.amc.2019.124839 |
[42] | M. U. Zahid, S. Kiranyaz, T. Ince, O. C. Devecioglu, M. E. H. Chowdhury, A. Khandakar, et al., Robust R-peak detection in low-quality Holter ECGs using 1D convolutional neural network, IEEE Trans. Biomed. Eng., 69 (2022), 119–128. https://doi.org/10.1109/TBME.2021.3088218 doi: 10.1109/TBME.2021.3088218 |