Research Paper
Noise Removal of ECG Signals using Discrete Wavelet Transform
Cajetan M. Akujuobi* and Basil A. Kandah
Department of Electrical and Computer Engineering, Prairie View A&M University, 100 University Drive, Prairie View, Texas 77446, USA. *Corresponding author, Cajetan M. Akujuobi, Email: cmakujuobi@pvamu.edu
Received 2 February 2017, revised 23 October 2017, accepted 23 October 2017.
Publication Date (Web): October 23, 2017
© Frontiers in Science, Technology, Engineering and Mathematics
Abstract
In the diagnosis of heart problems, electrocardiogram (ECG) is used in the recording and evaluation of the electrical activities of the heart. ECG is a non-linear, non-stationary signal which is distorted by different types of noise e.g. baseline drift, power line interference, electrode contact noise and electromyogram (EMG) interference. Since the traditional methods such as the fast Fourier Transform (FFT) may not be good enough for transient signals, we experimented with the discrete wavelet transform (DWT) for our work. Wavelet transform is one of the most useful novel tools for signal analysis, and it is broadly used in biomedical signal processing and signal noise removal applications. We collected the ECG signals from the MIT-BIH arrhythmia database. The ECG signal that we are removing noise from is decomposed up to 5 Levels using different types of wavelets. MATLAB Wavelet Toolbox is used in developing the algorithms for the noise removal process in the ECG signal. The noise free ECG signal is compared with the original signal using Signal-to-Noise Ratio (SNR), Peak Signal-to-Noise Ratio (PSNR), Mean Square Error (MSE), and Maximum Squared Error (MAXERR). The results show that Wavelet transform is a powerful tool for the analysis of ECG signal with Daubechies-4 performing much better than the others.
Keywords
Electrocardiogram, ECG signal, Non-stationary signal, Noise removal, Discrete wavelet transform
Introduction
The electrocardiogram (ECG or EKG) is a recording test of the electrical activities of the heart that is broadly used for the diagnosis of heart diseases. It is used to evaluate the heart performance and determine any problems that might occur, National Heart, Lung, and Blood Institute (2011). ECG is a non-linear, non-stationary signal which is distorted by different types of noises e.g. baseline drift, power line interference, electrode contact noise, electromyogram (EMG) interference (Limaya, H. and Deshmukh 2016; Tareen, S.G. 2008). The ECG signal is characterized by six peaks and valleys, which are traditionally labeled as P, Q, R, S, T, and U, as shown in Figure 1, Zhao et al (2011).
Figure 1. Ideal ECG signal. (Source: Zhao et al, 2011).
ECG signal noise removal is the process of isolating the essential signal component from unwanted signals to obtain a noise free ECG signal that provides more accurate diagnosis. The earlier method of ECG signal analysis was established on time domain only (Singh and Kaur 2013; Limaya and Deshmukh 2016). But this is not enough to analyze all the characteristics of the ECG signal. The frequency components of a signal are necessary. To achieve this, Fast Fourier Transform (FFT) method is used. But the restriction of the FFT is that the method cannot give information concerning the exact location of frequency components. Hence, the use of the Short Term Fourier Transform (STFT) as a solution. However, the main restriction of the STFT is that the tuning of time - frequency is not an optimum solution. Therefore, we decided to experiment what we felt should be a more appropriate method to solve this problem. The wavelet transform seems to be the most effective method for this purpose (Akujuobi and Baraniecki 1994; Akujuobi et al 2001; El-Dahshan 2010).
Some of the methods used for noise removal of the ECG signals are adaptive filtering (Zhao et al 2011), FIR filtering (Rani et al 2011; Chinchkhede 2011), and Wavelet transform (El-Dahshan 2010; Tikkaren 1999; Banerjee et al 2012). Adaptive filtering is the most commonly used method for noise removal. Wavelet transform is the recent approach with different types of wavelet families. Wavelet transform methods provide the best performance for non-stationary signals that make them appropriate for ECG signal analysis. This paper compares two namely Daubechies-4 and Symlet types of wavelets and then determines which type gives the better performance.
The objectives of this research are to:
• To develop an ECG noise removal method based on Discrete Wavelet Transform (DWT).
• To evaluate and determine which wavelet type gives better noise removal performance between the different types of the two wavelet families by calculating the Signal-to-Noise Ratio, Peak Signal-to-Noise Ratio, Mean Square Error, and Maximum Squared Error and compare the results.
• To calculate the heart beat rate (beats per minute) in order to determine which type of cardiac arrhythmia the patient may have.
The earlier methods for noise filtering were based on digital filters (Mbachu et al 2011). proposed a technique using the FIR filter with Kaiser window in order to remove the noises in the ECG signal. They have designed Kaiser window based low pass filter to remove high frequency noise, high pass filter to remove low frequency noise like baseline wander and notch filter to remove power line frequency noise in the ECG signal with sampling frequency of 1KHz and the order of the filter that they used was 100. They also designed the cascade of all these filters. Bai et al (2004) made a comparison of a general notch filter, comb notch filter, and equiripple notch filter. They evaluated the performance with respect to mean square error. The results show that the equiripple notch filter successfully kept the detail of the signal at the expense of higher filter order. The comb and general notch filters degrade the features of the ECG signal.
Rani et al (2011) made a comparative study of the use of FIR and IIR filters in removing baseline noises present in ECG signal. Chinchkhede et al (2011) investigated the improvement of raw and noisy ECG signals by various window based FIR filters. The Power Spectral Density and spectrogram analysis were carried out to study the effect of noise on ECG. In order to measure the performance of noise removal, they calculated SNR of the processed ECG, and determined the correlation coefficient to find the mismatch between raw ECG and filtered noisy ECG. The designed FIR filter with Kaiser window worked excellently well as they compared them to the Blackman, Blackman-Harris, and Gaussian filters in removing baseline wandering and power line interference under different noisy conditions.
There are two main types of source separation methods, independent component analysis (ICA) and principal component analysis (PCA). Independent component analysis considers the noise signals as an independent entity in the ECG signal, on the other hand, principal component analysis considers it as a statistical tool that decorrelates the different signal components from ECG data. Chawla (2011) proposed a method that deals with principal component analysis followed by different versions of independent component analysis application for ECG segmentation.
Recently, the wavelet-based analysis is one of the common methods for ECG denoising, because of its high accuracy in time-frequency resolution. In discrete wavelet transform (DWT), the signal is analyzed with different frequency bands in which a combination of different coefficients can be used to identify the noise components in order to eliminate them to get a clean signal. Banerjee et al (2012) proposed a dyadic DWT decomposition and reconstruction using Daubechies wavelet with faily good results. Their technique provided a quick and easy noise removal method for bandwidth and muscle noise. Wavelet-based noise removal method can effectively remove the noise components. In wavelet-based thresholding methods, the coefficients are adjusted after wavelet decomposition by the use of threshold values that can be set as hard thresholding or soft thresholding.
In hard thresholding, the coefficient values that are below the threshold are set to zero, therefore, eliminating the noise associated with those components of the signal. In soft thresholding, the values that are below the threshold are reduced by the same magnitude from their original values. We studied the Daubechies-4 and the Symlet types of wavelet transforms and did a comparative analysis of the two and their suitability for the noise removal of the ECG signals.
Theory and Method
Traditionally, the Fourier transform has been a useful method to analyze the frequency components of the signal. However, Fourier transform is good for stationary signals but not for non-stationary or transient signals hence the use of Short Time Fourier Transform (STFT). But STFT uses a constant window in its analysis of the signals hence introducing errors. Wavelet transform overcomes these shortcomings with its translation and localization properties. The translated version wavelets locate the areas of concern, whereas the scaled version wavelets give us the ability to analyze the signal in different scales, (Akujuobi and Baraniecki 1994; Akujuobi, et al 2001; El-Dahshan 2010).
The wavelet transform is the most recent solution to overcome the restrictions of the Fourier transform and the STFT. The window is translated along the signal and for every location, the spectrum is calculated. Then this process is repeated with a slightly shorter (or longer) window for every new cycle. Eventually, the result will be a collection of time-frequency representations of the signal, all with different resolutions that represent the multiresolution analysis.
Multi-Resolution Analysis (MRA)
One of the main advantages of wavelet transform is its ability to express a signal f(t) as a limit of successive approximations, each level of the signal is more accurate than the level before. These successive approximations identify different resolution levels. A multi-resolution analysis (MRA) is a technique to construct the signal with different resolution levels. This involves a sequence {Vm : m _ integers} of embedded subspaces of L2 that satisfies the following relations:
Each subspace included in the one before as the following:
V-2 _ V-1 _ V0 _ V1 _ V2 · · · Vm _ Vm+1 (1)
The union of all subspaces spans the entire L2 space so that:
is dense in L2 (2)
The intersection of subspaces is the empty set so that:
(3)
Each subspace gives a specific resolution so that f(x) _ Vm if and only if f(2x) _ Vm+1 for all integers m.
There exists a function such that
(4)
is an orthogonal basis for V0 so that
(5)
The function
is called the scaling function or father wavelet.
In the multi-resolution analysis, we can use the wavelet basis functions as a complete expansion basis for a given function f(x) in L2. More than that, it connects between the scaling function
(x) and wavelet function (mother wavelet) and constructs a wavelet basis to use. For wavelet analysis, the principle is to establish an advantage of certain features of the system so that it gives a qualified time-frequency representation (Akujuobi and Baraniecki 1994; Akujuobi, et al 2001; El-Dahshan 2010).
Discrete Wavelet Transform (DWT)
The discrete wavelet transform is a type of wavelet transform for which the wavelets are discretely sampled. Like other wavelet transforms, one of the main advantage of DWT that it has over Fourier transforms is a temporal resolution: it captures both frequency and location information. We can solve the problems of redundancy and impracticality by discretizing the time-scale parameters. In discrete wavelet transform (DWT), the signal is analyzed to different frequency bands in which a combination of different coefficients can be used to identify the noise components in order to eliminate them to get a clean signal. Suppose we have an original signal (the signal with the noise), we apply a high pass filter and a low pass filter on the samples based on convolution techniques.
We apply the high pass filter in order to preserve the high frequency components and apply the low pass filter in order to preserve the low frequency components. Then we apply downsampling on the high frequency components to get the detail coefficients, and also we apply downsampling on the low frequency components to get the approximation coefficients, this process called decomposition as we can see in Figure 2.
To reconstruct the signal, the inverse is applied. The signal is reproduced by upsampling the detail coefficients and then applying a high pass filter to get the high frequency components. We also do the upsampling for the approximation coefficients then apply a low pass filter to get the low frequency components. We then do the summation between the high frequency and low frequency components in order to get the original signal or the reconstructed signal. This is called the reconstruction process as we can see in Figure 3.
Figure 2. Discrete wavelet transform (DWT) (decomposition)
Figure 3. Inverse discrete wavelet transform (IDWT) (reconstruction)
Research Method
We collected the ECG Signals from the MIT-BIH arrhythmia database [Online] (2016). We collected several samples numbed as 100-124. The ECG signals are then analyzed (decomposed) and synthesized (reconstructed) up to 5 levels using different types of wavelets as shown in Figures 4 and 5 respectively. MATLAB Wavelet Toolbox is used for the ECG processing, (MATLAB, 2010). We compared the noise removed ECG signal from the original ECG signal using Signal-to-Noise Ratio (SNR), Peak Signal-to-Noise Ratio (PSNR), Mean Square Error (MSE), and Maximum Squared Error (MAXERR).
Figure 4. Discrete wavelet transform (DWT) for five levels.
Figure 5. Inverse discrete wavelet transform (IDWT) for five levels.
Similar to the one-level decomposition, when the next level of decomposition is performed the process will still result in two sub-signals. The approximation of the previous level will fall into the details and approximation sub-signals in the next level. In our procedure, we did the denoising using wavelets for five levels.
ECG Noise Removal Method
The noise removal method follows the process of decomposing the ECG signal into five levels of wavelet transform by using the Daubechies-4 and Symlet types of wavelets, then determining a threshold value through a loop to find the value where the minimum error is obtained between the detailed coefficients of thresholded noisy signal and the original.
The method is divided into seven steps:
Step 1: Eliminate Baseline Drift: The baseline drift is efficiently removed by Smoothing the Signal using a moving average filter then Span the moving average, and this elimination can be done by using the smooth function in MATLAB.
Step 2: Apply Wavelet Transform: Perform a multilevel wavelet analysis using Daubechies-4 and Symlet types of wavelets. This results in the low and high pass filter coefficients (approximation and detail coefficients), thereby removing noise (the high frequency component) of the ECG signal using Wavelet Transform.
Step 3: Thresholding: Finding the threshold value by finding the average between the maximum value and the mean value of the ECG signal.
Step 4: Calculate the R-R intervals: The R-R intervals is the intervals between the R-Peaks as shown in Figure 6.
Step 5: Calculate the Heart Beat Rate: Calculating the Heart Beat Rate using the formula:
(6)
Step 6: Calculate the Signal-to-Noise Ratio, Peak Signal-to-Noise Ratio, Mean Square Error, and Maximum Squared Error using the MATLAB built in functions.
Step 7: Plot the Original Signal, Baseline drift Elimination, Main ECG Signal after noise removal and R detected signal using the plot function in MATLAB.
The steps are shown in a flowchart form in Figure 7.
Figure 6. R-R interval.
Figure 7. Noise removal from ECG signal flowchart.
Performance Metrics
Several statistical parameters were used in the method used. The statistical parameters of the ECG samples are used as a basis for comparison between the original signal (the signal with the noise) and the noise removed signal in order to determine which type of wavelets gives the best performance.
An overview of the statistical parameters are presented as follows.
Signal-to-Noise Ratio (SNR)
The signal-to-noise ratio is a measure used to compare the desired signal to the noise. SNR is the ratio between the signal power and the noise power, often expressed in decibels. The signal-to-noise ratio is given by the following equation:
(7)
where Psignal is the power of the signal, and Pnoise is the power of the noise.
Peak Signal-to-Noise Ratio (PSNR)
Peak signal-to-noise ratio is a term for the ratio between the maximum possible power of a signal and the power of noise, and it is used to measure the efficiency of the wavelet.
The peak signal-to-noise ratio is given by the following equation:
(8)
Where MAX is the maximum possible value of the signal and MSE is mean square error.
Mean Square Error (MSE)
The mean square error (MSE) measures the mean of the squares of the errors, that is, the difference between the estimator and what is estimated.
The mean square error is given by the following equation:
(9)
where n represents the number of samples and
is the square of the errors
Maximum Squared Error (MAXERR)
Maximum Squared Error is the maximum absolute squared deviation of the data from the approximation.
The maximum squared error is given by the following equation:
(10)
The performance of the noise removal method and the wavelet type is determined by calculating the previous performance metrics. These metrics determine the quality of the noise removal method and the wavelet type that gives the best results. We will discuss the obtained results from the simulation using the discussed method below.
Figure 8. Original ECG signal (Source: MIT-BIH Arrhythmia Database)
.
Figure 9. Noise removed ECG signal using Daubechies-4 DWT
Figure 10. Noise removed ECG signal using Symlet DWT
Table 1. Results for Symlet Wavelet.
Table 2. Results for Daubechies-4 Wavelet.
Results and Discussion
The results are as shown for the Symlet and Daubechies types of wavelets. Figure 8 shows a sample of the original ECG signal (signal plus noise) as loaded from the MIT-BIH Arrhythmia database. Figure 9 is the noise removed ECG signal using Daubechies-4 wavelet. Figure 10 is the noise removed ECG signal using Symlet wavelet. Table 1 shows the result of the SNR, PSNR, MSE, MAXERR, BPM and Exact BPT based on the Symlet wavelet for different ECG record numbered 100-124. The mean was calculated for each of the statistical measures. Table 2 shows the results using Daubechies-4 wavelet with similar calculations as done for the results shown in Table 2.
Conclusion
The Wavelet transform is a powerful tool for the analysis of ECG signals. The DWT based on the results of this research work has shown to be a very useful tool in the noise removal of ECG signals. It is a widely used application in the field of biomedical signal processing. The results indicate that the Daubehies-4 type of wavelets performed better than the Symlet type of wavelets even though in some cases the results were very close.
References
Akujuobi CM and Baraniecki AZ (1994) “A Comparative Analysis of Wavelets and Fractals,” In: 2D and 3D Digital Signal Processing Techniques and Applications, Control and Dynamic Systems Series, C. T. Leondes (Ed.), Vol. 67, pp. 143-197, Academic Press, Inc.
Akujuobi CM, Odejide O, and Fudge G (2001) “Development of Wavelet Based Signal Detection and Measurement Algorithm,” Proceedings of ASEE 6th Global Colloquium on Engineering Education, Istanbul, Turkey, Oct. 1-4.
Bai Y, Chu WY, Chen CY, Lee YT, Tsai YC, and Tsai CH (2004) “Adjustable 60 HZ Noise Reduction by a Notch Filter for ECG signals” Proceedings of the 21st IEEE Instrumentation and Measurement Technology Conference, Vol. 3, pp. 1706-1711.
Banerjee S, Gupta R, and Mitra M (2012) “Delineation of ECG characteristic features using multiresolution wavelet analysis method,” Measurement, 45, 474–87.
Chawla MPS (2011) “PCA and ICA processing methods for removal of artifacts and noise in electrocardiograms: a survey and comparison,” Applied Soft Computing, 11, 2216–2226.
Chinchkhede KD, Yadav GS, Hirekhan SR, and Solanke DR (2011) “On the Implementation of FIR Filter with Various Windows for Enhancement of ECG signal,” Int. J. Eng. Sci. Technol., 3, 2031-2040
El-Dahshan E (2010) “Genetic algorithm and wavelet hybrid scheme for ECG signal denoising,” Telecommunication Systems, Vol. 46, pp. 209-215.
Limaya H and Deshmukh VV (2016) “ECG Noise Sources and Various Noise Removal Techniques: A Survey,” Int. J. Appl. Innovation Eng. Management, 5, 86-92.
MATLAB (2010) http://www.mathworks.com/help/
wavelet/index.html. (assessed on October 22, 2017)
Mbachu CB, Onoh GN, Idigo VE, Ifeagwu EN, and Nnebe SU (2011) “Processing ECG Signal with Kaiser Window- Based FIR Digital Filters,” Int. J. Eng. Sci. Technol., 3, 6775-6783.
National Heart, Lung, and Blood Institute (2011) "What Is Arrhythmia?" http://www.nhlbi.nih.
gov,https://en.wikipedia.org/wiki/Cardiac_arrhythmia (assessed on October 22, 2017)
Rani S, Kaur A, and Ubhi JS (2011) “Comparative Study of FIR and IIR filters for the Removal of Baseline Noises from ECG Signal,” Int. J. Comput. Sci. Information Technol.,Vol. 2 (3).
Singh G and Kaur R (2013) “Removal of EMG Interference from Electrocardiogram Using Back Propagation,” Int. J. Innovative Res. Comput. Communication Eng., Vol. 1, No. 6, pp. 1300-1305.
Tareen SG (2008) “Removal of Power Line Interference and other Single Frequency Tones from Signals,” M.Sc. Thesis, Computer Science and Electronics, Malardalen University, Sweden.
The MIT-BIH Arrhythmia Database [Online] (2016) http://physionet.org/physiobank/database/mitdb/ (assessed on October 22, 2017)
Tikkanen PE (1999). “Nonlinear Wavelet and Wavelet Packet Denoising of Electrocardiogram Signal,” Biological Cybernetics, Vol. 80, No. 4, pp. 259-267.
Zhao Z, Luo Y, and Lu Q (2011) “Adaptive Noise Removal of ECG Signal Based On Ensemble Empirical Mode Decomposition,” In: Adaptive Filtering Applications, Lino Garcia (Ed.), InTech
Citation:
Cajetan M. Akujuobi and Basil A. Kandah (2018) Noise removal of ECG signals using discrete wavelet transform, Frontiers in Science, Technology, Engineering and Mathematics, Volume 2, Issue 2, 82-91