ECG Signal Denoising by Discrete Wavelet Transform

The denoising of electrocardiogram (ECG) represents the entry point for the processing of this signal. The widely algorithms for ECG denoising are based on discrete wavelet transform (DWT). In the other side the performances of denoising process considerably influence the operations that follow. These performances are quantified by some ratios such as the output signal on noise (SNR) and the mean square error (MSE) ratio. This is why the optimal selection of denoising parameters is strongly recommended. The aim of this work is to define the optimal wavelet function to use in DWT decomposition for a specific case of ECG denoising. The choice of the appropriate threshold method giving the best performances is also presented in this work. Finally the criterion of selection of levels in which the DWT decomposition must be performed is carried on this paper. This study is applied on the electromyography (EMG), baseline drift and power line interference (PLI) noises. Keywords—baseline drift, denoising, disrete wavelet transform, ECG signal, EMG signal, MSE, PLI, SNR.


Introduction
The electrocardiogram (ECG) signal represents the electrical activity of the heart. This signal is useful for the diagnosis and discovery of cardiac diseases.
The analysis of the ECG signal is based on the algorithmic structure given in Fig 1. This structure is devided into a preprocessing stage including filtering process and a decision stage including features detection such as R peak, QRS complex. The different features of ECG signal are given in Fig 2 and

RR interval
Interval between two R waves. Denotes the heart rate. Normal resting heart rate is between 60 to 100 bpm 0.6 s to 1.2 s P Wave During normal atrial depolarization, the electrical impulse travels from the sino-atrial node to the atrio-ventricular node and spreads from the right atrium to the left atrium. This generates the P wave.
80 ms PR Interval It represents the delay taken by the electrical impulse to travel from the sino-atrial node through the atrio-ventricular node and into the ventricles. 120 ms to 200 ms QRS complex It represents the rapid depolarization of the right and left ventricles. Due to the larger muscle mass of the ventricles as compared to the atria, the QRS complex has a larger amplitude than the P wave.

ms to 120 ms
The ECG signal is always affected by various noises due to its low frequency-band (0. . This band contains different internal and externel noises. The most important noises are [3]: ! Muscle artifact (electromyography EMG) : The signals resulting from muscle contraction is assumed to be transient bursts of zero-mean band-limited Gaussian noise. Electromyogram (EMG) interferences generate rapid fluctuation which is very faster than ECG signal. ! Baseline wander (BW): Can be caused by perspiration, respiration and body movements. Baseline wander can cause problems to analysis, especially when examining the low-frequency components of ECG signal. ! Power line interferences (PLI): Due to the loss of contact between the electrode and skin. The transient interference occurred at the measurement system input can result large artifacts since the ECG signal is usually capacitive coupled with the system.
The various types of noise are illustarted in Fig 3. Considering this contamination of the ECG signal by these different types of noise, the denoising becomes an exclusive requirement..
In the litterature, many approaches have been poposed for the removal of noise from the ECG signal. The adaptative filters and discret wavelet transform based technics are much famous. The methods based on filter banks [4,5,6,7] affect the waves presented in the ECG signal espicially the P and R waves [8]. The technics based on empirical mode decomposition (EMD) [9,10,11] present some disavantages such as the lack of robustness to a small perturbations and the high computional complexity [8].
The methods based on discrete wavelet transform (DWT) are increasingly used and offer an important solution to deal with this issue.
Several works propose the use of different sets of wavelet coefficients and thresholding techniques of DWT [12,13,14,15,16]. The quality of denoising process depends on some parameters such as the wavelet function used in DWT, the level of the DWT decompositon and the selection of threshold method. Unfortunately, the choice of the appropriate parameters of denoising based DWT is seldom justified in most works.
The purposes of this work are the choice of the convenent wavelet for the ECG denoising using DWT, the determination of levels for DWT decomposition and the selection of threshold method. This paper is organized as follows, section 2 presents a theory background while section 3 gives method and materials. Next, section 4 shows the qualitative results of simulation and finally the conclusion is given in section 5.

2
Theory background

Discrete wavelet transform (DWT)
The DWT is a powerful tool for the analysis of non-stationary signals. This transform is widely used in ECG denoising.
In the DWT, the signal is expressed as a linear combination of the sum of the product of the wavelet coefficients and mother wavelet. The DWT decomposes the signal into approximate and detail information thereby helping in analysing it at different frequency bands with different resolutions. The DWT is the discrete form of continuous wavelet transform (CWT) given in the following equation [17]: Where: ! ! is the signal and http://www.i-joe.org The parameter ! is the dilatation of wavelet (scale) and the parameter ! defines a translation of the wavelet and indicates the time localization, ! ! ! is the complex conjugate of the analysing mother wavelet !! ! .
In order to define the DWT the following assumptions are made: Where ! describes the shifting and ! is the scale (! !!0, 1, 2 … ! ! 0, 1, 2…..). The above formulas combined with the assumption of discretization of ! ! produce the DWT given by: Where ! ! !! !! ! ! ! and ! is the total number of samples. The aim of the DWT is to decompose a signal into different resolutions using high pass and low pass filters. Regarding the equations of decomposition, consider: Where ! ! is the half band low pass filter, ! ! is the half band high pass filter, ! ! are the approximation coefficients and ! ! are the detail coefficients. ! ! is the discrete form of the original signal.
The DWT decomposition at level 2 can be represented by the block given in Fig 4. HPF: high pass filter LPF: low pass filter

Inverse DWT (IDWT)
The denoised signal can be reconstructed using the updated details coefficients of DWT after the estimation of noise on these coefficients. The updated details are performed using the thresholding stage.

Thresholding
Thresholding algorithms. The algorithms proposed by Donoho and Johnston can reduce the noise by shrinking or scaling the detail coefficients smaller than threshold. Two kind of threshold are used [18]: • Hard threshold: • Soft threshold: Where ! ! are the updated detail coefficients, ! ! are the detail coefficients of DWT decomposition of noisy signal and ! is the threshold.
The Threshold selection. There are many methods for obtaining threshold values. In this section we present the widely formulas used in denoising process [3,19].
In this formula, ! is the deviation of noise and ! is the number of samples in noisy signal.
Where ! ! is the ! !! element of the vector ! corresponding to the minimum risk, ! contains the square of detail coefficients. The elements of risk vector ! are given in the following formula: ! is the length of signal vector.! • Heuristic SURE: The threshold is selected using a combination of universal and rigorous SURE. Let threshold obtained from universal method is ! ! and ! ! the threshold from rigorous SURE. The Heuristic SURE gives the threshold according the given equation: ! is the length of signal vector.
• Minmax criterion: This method finds the threshold using Minimax principle. It uses a fixed threshold to yield Minimax performance for mean square error against an ideal procedure. The threshold is given by: Where !! ! !"#$%&! ! !" ! !!!"#$ ! , ! !" are details coefficients at unit scale and ! is the length of signal vector.

Materials and methods
In this work a comparison of DWT denoising performances for different type of mother wavelet and different threshold methods is established for an additive noise. The evaluation study is realized according the diagram given in  The pure ECG signal is imported from apnea data base [23] with 100 samples per second and 16bits per sample. The noise is generated using MA TLAB®. The noisy ECG ! ! ! is obtained by mixing the pure ECG and noise. The kind of noises are carried out in this study are the EMG, the baseline drift and the power line interference noises.
The performances of denoising process are evaluated using the following parameters: • Input SNR (Signal on Noise Ratio) : This ratio is defined in the following formula: • Output SNR: This ration is given in the equation below.
Considering the randomness of the noise and in order to obtain the most accurate performance parameters possible, we evaluate these parameters as being an average of the values obtained at each iteration of the execution of the de-noise process. We have considered about a hundred iterations

Removal of EMG noise
For the EMG noise , simulated by an additive gaussien noise, different wavelet are used to compute the DWT coefficients. In this case we use the same thresholding method in order to select the convenent wavelet. In the second case, different methods of thresholding are used for the chosen wavelet. The aim of this case is to specify the best method of thresholding to use for removal of EMG noise. In order to determine the appropriate levels for DWT decomposition of ECG signal, the third case of study is done.

Removal of baseline drift
For baseline wander correction, the noise is simulated by a sinusoidal signal with a frequency range of 0 -0.5Hz. We use DWT to decompose the noisy ECG at different levels. The ideal frequency range of each level is listed in Table 2 [14]. According the results given in this table, the denoised signal ! ! ! can be performed using the formula 16 by eliminating the approximation coefficient ! ! which corresponds to the frequency range of baseline drift noise.

Power line interference (PLI) reduction
In order to synthesize the PLI, a sinusoidal signal having 50 Hz / 60 Hz of frequency is superimposed on the ECG signal. According the correspondence given in the Table 2, we decompose the noisy signal in level 2 which corresponds to the frequency range of this noise signal. We estimate the impact of this noise on details coefficients using the appropriate method of threshold. Then after, the denoised signal is reconstructed using the updated coefficients.

4
Results and discussion

Removal of EMG noise
The first case of study is to select an optimal wavelet for ECG denoising. This selection is based on the output SNR and MSE. For this purpose we compute output SNR corresponding to different values of input SNR for different types of wavelet function (Haar, Daubechie 6, Symlet 8, BiorSpline 3.5, Coiflet 4). The Fig 8 and Fig 9 show the comparison of output SNR for different wavelet.
In terms of this comparison the optimal wavelet functions are symlet 8 and coifflet 4. Furthermore, the soft threshold gives the best output SNR. To further prove the selection of these wavelet functions, we compute the MSE corresponding to different values of input SNR for different type of wavelet function. The comparison of MSE is given in Fig 10. As shown in the Fig 10, both Symlet 8 and Coiflet 4 wavelet functions give the best MSE than the other functions.  The second case of study consists to define the appropriate threshold method for ECG denoising. In this study we use the Symlet 8 wavelet function to compute the DWT coefficients and we apply different methods of threshold. Here also, the selection of threshold method is based on the output SNR and the MSE. The results of this case study are given in Fig 11 and Fig 12. Following these results, it can be confirmed that both rigorous SURE and heuristic SURE threshold methods give the best performances for DWT denoising.
In the third case of study, we propose to determine the best level for the DWT decomposition. The simulation of this study is done with the following parameters: Symlet 8 wavelet function, rigorous SURE threshold method. The study consists to apply different levels (2, 4, 6 and 8) of DWT decomposition and then we compute the output SNR and the MSE. The results of this study are summarized in Fig 13 and      Based on these results we can confirm that DWT decomposition at levels greater than level 4 gives best performances for denoising.
In order to summarize the results obtained in the case studies above, an example of DWT denoising signal is given in Fig 15.

Baseline wander correction
In this study we mix the pure ECG with a sinusoidal signal considered as a baseline drift. We decompose the noisy signal at level 8 using symlet 8 wavelet function and we reconstruct the denoised signal according the formula (16). The simulation result of this process is given in Fig 16. In the objective of evaluating the baseline drift correction we perform the output SNR and MSE for each wavelet function with DWT decomposition at level 8. The results are given in Table 3. As shown in this table, all the wavelet functions Daubechie 6 (db 6), Symlet 8 (sym 8), Coiflet 4 (coif 4) and BiorSpline 3.5 can be used for the purpose of removal baseline wander.

PLI reduction
In this study some optimal denoising parameters will be determined such as the wavelet function, the method of denoising and the proof of the choice of level 2 of DWT decomposition.
In order to select the appropriate wavelet function, we apply different types of wavelet functions for DWT decomposition at level 2, we use the rigorous SURE as threshold method and we compute the output SNR and the MSE parameters for an input SNR of 3 dB. The result of this part of study is summarized in Table 4.
As given in this table we conclude that BiorSplines 3.5 (Bior 3.5) wavelet function is the appropriate for PLI reduction.  The second part of this study consists to define the best method of threshold for PLI reduction. Indeed, we apply different method of threshold under the following conditions: Bior 3.5 as wavelet function, DWT decomposition at level 2 and an input SNR of 3 dB. The results of this study are given in Table 5. It's clear that the rigorous SURE method is better suited for the estimation of the threshold. In order to prove the choice made at the outset regarding level 2 of decomposition, we propose the last part of this study. Indeed, we apply different levels of DWT decomposition under the following conditions: Bior 3.5 as wavelet function, rigorous SURE as threshold method and an input SNR of 3 dB. The Table 6 summarizes the result of this part of study.

Conclusion
At the end of this work and in accordance with the results obtained in the previous sections, multiple conclusions can be issued. The first conclusion is about the appropriate wavelet function for ECG denoising. Indeed, the wavelet functions Symlet 8 and Coiflet 4 are to be better more than any other wavelet for the process of removal of EMG and baseline wander. On the other hand, to eliminate PLI, it is recommended to use the Bior 3.5 wavelet function. The second conclusion concerns the level of DWT decomposition. It's appropriate to select levels greater than level 4 in the cases of removal of EMG and baseline wander, but in the case PLI reduction the level 2 give the best performances.
The third conclusion is about the optimal threshold method to use in the process of ECG denoising based DWT. Indeed, the soft threshold combined with rigorous SURE gives the best performances in all the cases of denoising.