Abstract
This paper introduces an algorithm for ECG beat detection for portable monitoring systems using the continuous wavelet transform technique. It uses the Mexican-Hat wavelet as an analyzing wavelet. The central frequency of the corresponding band-pass filter frequency response is chosen to be 32 Hz after performing scale analysis. It relies on the adaptive threshold technique to minimize the number of false positive beats and therefore guarantee robustness against high motion artifact noise levels, it also relies on search back to avoid missing real heart beats and hence obtain a high sensitivity. The algorithm was implemented using MATLAB and has a sensitivity Se = 99.37% and a positive predictivity P+ = 99.83% with the MIT-BIH arrhythmia database. Furthermore, in order to test the performance of the algorithm against motion artifact noise, a noise stress test was performed by adding motion artifact noise to the ECG records of the same database at various signal to noise ratio values. The results of the noise stress test were benchmarked against some existing algorithms in the literature such as Pan and Tompkins and Romero.
Similar content being viewed by others
Avoid common mistakes on your manuscript.
1 Introduction
Interest in mobile health care has been rising in recent years due to the increase in people’s health awareness. Specifically, the need for electrocardiogram (ECG) portable monitoring system has risen as it has an important role in supervising the patient’s heart and predicting cardiac arrhythmias. A portable cardiac monitoring system, i.e. Holter system, is an electronic system that records the ECG signal continuously in ambulatory conditions via electrodes attached to the skin of the patient. Such a Holter system has the ability to detect heart beats via an embedded signal processor using digital signal processing techniques in order to compute heart rate variability (HRV) and support doctors in their decision to give medication for patients in case of cardiac malfunctioning [1, 2]. In ambulatory conditions, the Holter system should meet several requirements in order to efficiently perform its task, namely ultra-low energy operation for long battery lifetime, accuracy of heart beat detection, small size for wearability, and low weight of the electronic device [3, 4]. In order to obtain accurate heartbeat detection, the algorithm should be able to deal with several types of noise aggressors added to the ECG signal. These signals are mainly the Electromyography signal (EMG), baseline wander, 50/60 Hz power-line frequency components, and especially electrode motion artifact noise [5–7]. The motion artifact is a noise introduced to the ECG as a result of the variation of the electrode skin impedance due to movement of the patient. In fact, electrode movement causes skin deformations around the electrode site which in turn cause changes in the electrical characteristics of the skin around the electrode. This noise signal results in poor ECG signal quality and as a result, a possibly erroneous clinical diagnosis, since the shape of such noise mimics that of the normal QRS complex and its frequency spectrum overlaps with that of the ECG [3, 8, 9]. The beat detection issue in the ECG signal with motion artifact was addressed in several ways in the literature. Many approaches adopted motion artifact reduction using adaptive filtering [10–12], blind source separation (BSS) [13, 14] or the discrete wavelet transform [9] in order to remove motion artifacts, obtain a clean ECG signal and facilitate heart beat detection. These techniques are complex and consume much power for portable device applications [15]. In addition, there are several technical difficulties that prevent these techniques from obtaining good results especially when the level of noise is high. This paper introduces a beat detection algorithm developed to perform in ambulatory conditions and to have a high robustness against high levels of motion artifact noise. It is based on the adaptive threshold continuous wavelet transform technique with the Mexican-Hat wavelet.
2 Literature Review
Motion artifact removal is the step preceding beat detection. It consists of de-noising the signal by subtracting motion artifacts to allow improved beat detection performance. Both adaptive filtering and Blind Source Separation are techniques used for this task; a reference signal correlated with motion artifact is often needed for this operation.
2.1 Motion Artifacts Reduction
The adaptive filtering technique has been used in the literature as a method to remove motion artifacts [10–12, 16], specifically Least mean square (LMS) and Recursive Least Square (RLS) techniques were adopted to subtract such a motion artifact from the bio-potential signal and make the beat detection operation easier. The LMS uses gradients of the mean square error to update coefficients in real time. The RLS technique recursively updates coefficients of the filter to minimize a cost function. Both of these techniques need a time varying reference signal having a good correlation with the motion artifacts in order to update the parameters of the adaptive filter online. This reference signal can be obtained by measuring the skin-electrode impedance (SEI) [17] or the skin stretching via accelerometers [18] or by capacitive ECG sensing [19]. However these attempts had limited results, especially for higher noise levels, since the measured reference signal did not have good correlation with noise [19].
The blind source separation technique consists of separating two uncorrelated signals (ECG and motion artifacts) by the means of linearly independent multi-lead ECG recording. Principal Component Analysis (PCA) and Independent Component Analysis (ICA) were used in the literature [13, 14]. Both techniques attempt to determine independent vectors onto which the input signal is projected in order to separate the motion artifact from the ECG signal. These techniques are known to achieve good results but they require a large processing budget and a large memory space because of their high algorithmic complexity [15].
2.2 Heart Beat Detection Algorithms
Heart beat detection algorithms aim to accurately detect QRS complexes without missing any beat or wrongly detect extra beats, even if the beats show up before expected (tachycardia) or after expected (bradycardia) or of an unexpected shape (Premature Ventricular Contraction, atrial fibrillation). In the literature, the QRS detection algorithms adopted several steps including linear filtering, nonlinear filtering, moving average and thresholding. In particular, band-pass filtering and thresholding are common steps of all algorithms because of the role of the band-pass filtering in amplifying the QRS sequence and minimizing the noise and the role of thresholding for decision making [20].
One of the most basic algorithms for ECG beat detection that was developed in 1985 is Pan and Tompkins algorithm [21]. It estimated that the power spectral density of the QRS complex is contained within the frequency band of 5–12 Hz. Therefore it used cascaded low-pass and high-pass filters to select that frequency band, followed by signal differentiation and a nonlinear operation that squares the resulting signal and finally a moving average filter. Moreover this approach sets two thresholds: one of the noise level estimation and another for the QRS level estimation. The most important feature of this algorithm is the search back property that sets a time interval, based on the previous RR intervals, if no heart beat was detected within this interval (for example because it has an amplitude below the threshold) then the highest peak within that interval is likely to be considered as a heartbeat. However, this algorithm is not suitable for portable applications since it is not adapted to deal with motion artifact noise.
The discrete wavelet transform technique has been used for heart beat detection since it is considered to have a good time-frequency resolution [22]. It consists of decomposing the signal spectrum into several sub-bands depending on the chosen mother wavelet, allowing the representation of the ECG signal temporal features at different resolutions. This transform is performed using cascaded wavelets that have characteristics of low-pass and high-pass filters followed by down-sampling as shown in Fig. 1. The decision is made after computing a signal by a General Likelihood Ratio Test (GLRT) formula. If the signal exceeds a threshold, then it is considered as a real heartbeat. This technique gave a high detection performance with the MIT database [23, 24], and is also considered to be of low power consumption. However, its performance in portable applications with high motion artifact noise levels is not reported in the literature.
In order to perform the beat detection task, Romero et al. [25] used the CWT technique and precisely the Mexican-Hat wavelet, the selected band-pass filter has a central frequency of 18 Hz. The algorithm takes three-second length data segments to be convolved with the wavelet. Heart beat detection is performed in the CWT domain when the corresponding Modulus Maxima is higher than a threshold. In order to make the algorithm less sensitive to peaks that occur due to high levels of noise, the threshold varies adaptively across time by using a weighted sum of the previous threshold (thold) and the newly calculated threshold (thcurrent). However, this algorithm did not yield good results when performing the noise stress test with MIT database records as the P+ decreases to 80% for an SNR equal to 0 dB. This degradation is due to the fact that the selected frequency band does not decrease the effect of motion artifacts and therefore a lot of false positive beats were detected.
3 Methods
The wavelet transform is a technique that, by a linear transformation, converts a signal into another form that makes certain aspects of the original signal more amenable to study and some features easier to spot. The wavelet transform expression of a continuous signal \({\text{x}}\left( {\text{t}} \right)\) is given by:
where \(\psi^{*}\) is the complex conjugate of the chosen wavelet, \(a\) is the scale of
the wavelet or the dilation parameter and \(b\) is the location parameter of the wavelet. The wavelet function must satisfy these mathematical criteria:
-
1.
A wavelet must have a finite energy, that is:
$$E = \mathop \int \limits_{ - \infty }^{ + \infty } \left| {\psi \left( t \right)} \right|^{2} dt < \infty$$(2) -
2.
If \(\widehat{\psi }\left( f \right)\) is the Fourier Transform of \(\psi \left( t \right)\) that is:
$$\widehat{\psi }\left( f \right) = \mathop \int \limits_{ - \infty }^{\infty } \psi \left( t \right)e^{ - j2\pi ft} dt$$(3)then the following condition must hold:
$$C_{g} = \mathop \int \limits_{0}^{\infty } \frac{{\left| {\widehat{\psi }\left( f \right)} \right|^{2} }}{f} df < \infty$$(4)
This means that the wavelet has no zero frequency component i.e. \(\widehat{\uppsi }\left( 0 \right) = 0\) or the wavelet \({\uppsi }\left( {\text{t}} \right)\) has a zero mean. This implies also that the wavelet’s frequency response is a band-pass filter.
3.1 Wavelet Selection
The Mexican hat wavelet is selected as an analyzing wavelet for several reasons:
-
Its impulse response (see Fig. 2) resembles the shape of the QRS complex and therefore it is likely to output a high peak when convoluted with a real heartbeat.
-
Its frequency response (see Fig. 3) is a band-pass filter, which reduces the low frequency noise such as the baseline wander as well as the high frequency noise namely the electromyography.
-
Ease of variation of the scale \(a\) and therefore the variation of central frequency and cutoff frequencies of the band-pass filter.
The equation of the Mexican hat wavelet is:
The corresponding frequency characteristic of that wavelet is represented in Fig. 3.
The relation between central frequency fc and scale \(a\) is:
The wavelet convoluted with the ECG signal outputs a signal with singularities (peaks) that correspond to the position of the QRS complex. These singularities are called Modulus Maxima (MM) (see Fig. 5a) and are defined as follows [26]:
3.2 Scale Selection
All heart beat detection algorithms adopt band-pass filtering to get rid of undesired high frequencies as the electromyography and low frequencies of baseline wandering [27]. But the frequency range suited to the application differs from one algorithm to another. In order to determine the best scale of the Mexican- hat wavelet i.e. the best frequency band, a set of clean ECG signals from the MIT database was selected, to which motion artifact noise was added with a signal to noise ratio (SNR) equal to 6 dB (see Fig. 5) using the noise stress test function (NST) of the WFDB toolbox available on the physionet website [28]. All these signals were convolved with wavelets of frequency response that have central frequencies ranging from 10 Hz to 40 Hz as shown in Fig. 4. For each scale, the average Modulus Maxima value of all real heartbeats was computed using the beat annotation of MIT database records. Besides, peaks that do not correspond to real heart beats (potential false positive beats) with a Modulus Maxima value greater than half of the average value previously computed are counted for each scale. This operation was performed for the records 100, 103, 107, 112, 113, 115, 117, 118 and 119.
Figure 4 shows that the number of Modulus Maxima that correspond to motion artifact noise decreases gradually for all the ECG records starting from 10 Hz till reaching around 30 Hz. It stabilizes for some records and starts to increase again for others starting from 32 Hz. This means that for all the records, the number of Modulus Maxima that are likely to be considered as false positive beats is minimal for a scale corresponding to the central frequency 32 Hz. For this reason, and so as to avoid the high frequencies of electromyography noise (having a frequency range of 35–40 Hz) the wavelet whose central frequency of the corresponding band-pass filter frequency characteristic is 32 Hz (i.e. scale a = 0.0079) has been chosen as an analyzing wavelet for this algorithm. This scale reduces most the effect of motion artifacts by reducing the value of the corresponding Modulus Maxima.
3.3 Adaptive Threshold
After computing the CWT signal for the chosen scale, a threshold value is set depending on the Modulus Maxima value. The value of the threshold adaptively varies across time, after a new peak is detected, following this equation:
As a result the threshold adapts to the variations of the Modulus maxima values (Fig. 5)
3.4 Search Back Property
As in Pan and Tompkins’ algorithm [21], the search-back property is adopted for this algorithm. In fact, if there is no peak detected with MM greater than the current threshold within a time period of 1.66 × (previous RR interval), then the threshold value is divided by 2 and search-back operation is performed for another peak value. This technique enables to avoid missing beats with low modulus Maxima especially with the high adaptive threshold value that has been adopted.
4 Results and Discussion
To compare the results achieved by our developed algorithm to other algorithms in the literature the standard MIT database [29] was chosen as a reference database. The MIT database contains 48 half-hour ambulatory ECG recordings, obtained from 47 subjects studied by the BIH Arrhythmia Laboratory between 1975 and 1979. It is the most commonly used database in the literature. To evaluate the performance of the algorithm, Sensitivity Se and positive predictivity P+ are computed using (9) and (10), respectively:
Here, TP (true positive), FN (false negative) and FP (false positive) represent the number of correctly detected QRS complexes, the number of missed detections and the number of extra-detections, respectively.
As a first step, the algorithm was tested across the 48 records without motion artifact noise being added and the results are shown in Table 1 and its performance was benchmarked with state of the art algorithms Table 2
As a second step and in order to test the performance of the algorithm against various levels of motion artifact, and benchmark it with the state of the art algorithms, the same clean ECG records of the MIT database selected in Fig. 4 were used. Using the NST function, motion artifact noise was added to each of these records by an SNR respectively of 24, 18, 12, 06 and 0 dB. Figure 5 shows a portion of clean ECG signal of record 100 and the same portion when motion artifact of SNR 6 dB was added. The results of the noise stress test for record 100 are plotted in Fig. 6. It can be seen that this algorithm performs better than the other algorithms both in sensitivity and positive predictivity. In fact the sensitivity remains close to 100% even for SNR= 0 dB. As for the positive predictivity it is clear that the performance decreases slowly as the noise level increases from 24 to 6 dB and then decreases drastically beyond this value to reach 90% for SNR = 0 dB, but it still performs much better than Romero’s and Pan and Tompkins’s algorithms that reach 80 and 75% respectively for the same SNR value.
The results of the noise stress test for the records 123, 202, 212, 213, 219, 220, 221,230,231,232 and 234 are presented in Table 3.
5 Conclusion
We developed a single scale Continuous Wavelet Transform based algorithm, designed to adapt to ECG beat detection in portable conditions where the motion artifacts dominates. Such a choice was made to achieve the best compromise between low power consumption for long battery lifetime and high accuracy for the reliability of the portable system. It gave reasonable results when being tested at reasonable SNR levels (24, 18 and 12 dB). However, when the noise level is excessively high (0 dB) the results are not reliable and another solution should be sought.
Furthermore, as a future step, this algorithm should be implemented in a DSP in order to measure its power consumption and benchmark it with existing devices.
References
Yoon, H. (2013). An automated motion artifact removal algorithm in electrocardiogram based on independent component analysis. In eTELEMED: The fifth international conference on eHealth telemedicine and social medicine.
Shi, F. (2012). Development of automatic motion artifact detection in mobile ECG monitor based on wavelet transforms. In IEEE international conference on intelligent control, automatic detection and high-end equipment (ICADE).
Nakano, M. (2012). Instantaneous heart rate detection using short-time autocorrelation for wearable healthcare systems. In Annual international conference of the IEEE engineering in medicine and biology society (EMBC).
Shrestha, S. (2011). Optimized R peak detection algorithm for ultra-low power ECG systems. In Biomedical circuits and systems conference (BioCAS) IEEE.
Ko, B.-h. (2012). Motion artifact reduction in electrocardiogram using adaptive filtering based on half-cell potential monitoring. In Annual international conference of the IEEE engineering in medicine and biology society (EMBC).
Friesen, G. M. (1990). A Comparison of the noise sensitivity of nine QRS detection algorithms. Transactions on Biomedical Engineering, IEEE, pp. 85–98.
Kadambe, S. (1999). Wavelet transform-based QRS complex detector. Transactions on Biomedical Engineering IEEE, pp. 838–848.
Burbank, D. P. (1978). Reducing skin potential motion artefact by skin abrasion. Medical & Biological Engineering & Computing, 16, 31–38.
Kirst, M. (2011). Using DWT for ECG motion artifact reduction with noise-correlating signals. In 33rd annual international conference of the IEEE EMBS Boston, MA.
Hamilton, P. S. (2000). Comparison of methods for adaptive removal of motion artifact. Computers in Cardiology, 27, 383–386.
Romero, I. (2012). Adaptive filtering in ECG denoising: A comparative study. Computers in Cardiology, 39, 45–48.
Romero, I. (2011) Motion artifact reduction in ambulatory ECG monitoring: An integrated system approach. In Proceedings of Wireless Health Conference.
Chawla, M. P. S. (2009). A comparative analysis of principal component and independent component techniques for electrocardiograms. Neural Computing and Applications, 18(6), 539–556.
Chawla, M. P. S. (2008) A new statistical PCA–ICA algorithm for location of R-peaks in ECG, page numbers. International Journal of Cardiology, 146–148.
Kim, H. (2014). A configurable and low power mixed-signal SoC for portable ECG monitoring applications. IEEE Transactions on Biomedical Circuits and Systems, 8(2), 257–267.
Tong, D. (2002). A, Adaptive reduction of motion artifacts in the electrocardiogram. In Proceedings on the second joint EMBS/BMES conference Houston, TX, USA.
Kim, S. (2010). A 2.4 A continuous time skin electrode impedance measurement circuit for motion artifact monitoring in ECG acquisition systems. In IEEE symposium on VLSI circuits (VLSIC).
Yoon, S. W. (2008). Adaptive motion artifact reduction using 3-Axis accelerometer in E-textile ECG measurement system. Journal of Medical Systems, 32(2), 101–106.
Eilebrecht, B. (2011). Motion artifact removal from capacitive ECG measurement by means of adaptive filtering. In 5th European conference of the international federation for medical and biological engineering.
Afonso, V. X. (1993). ECG QRS detection. Biomedical digital signal processing (pp. 236–264). Englewood Cliffs: Prentice-Hall.
Pan, J. (1985). A real time QRS detection algorithm. IEEE Transactions on Biomedical Engineering, 32, 230–236.
Min, Y.-J. (2013). Design of wavelet based ECG detector for implantable cardiac pacemakers. IEEE Transactions on Biomedical Circuits and Systems, 7, 426–436.
Martinez, J. P. (2004). A wavelet based ECG delineator: Evaluation on standard databases. IEEE Transactions on Biomedical Engineering, 51, 570–581.
Rodrigues, J. N. (2005). Digital implementation for a cardiac event detector for cardiac pacemakers. IEEE Transactions on Circuits and Systems, 52, 2686–2698.
Romero, I. (2009). Low power robust beat detection in ambulatory cardiac monitoring. In IEEE biomedical circuits and systems conference BioCAS.
Legarreta, I. R., et al. (2005). Continuous wavelet transform modulus maxima analysis of the electrocardiogram: Beat characterisation and beat-to-beat measurement. International Journal of Wavelets, Multiresolution and Information Processing, 3(01), 19–42.
Elgendi, M. (2013). Fast QRS detection with an optimized knowledge-based method: Evaluation on 11 standard ECG databases. PLoS One, 8(9), e73557.
Inan, O. T. (2006). Robust neural network based classification of premature ventricular contraction using wavelet transform and timing interval features. IEEE Transactions on Biomedical Engineering, 53, 2507–2515.
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Smaoui, G., Young, A. & Abid, M. Single Scale CWT Algorithm for ECG Beat Detection for a Portable Monitoring System. J. Med. Biol. Eng. 37, 132–139 (2017). https://doi.org/10.1007/s40846-016-0212-2
Received:
Accepted:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s40846-016-0212-2