Introduction

The electrocardiogram (ECG) signal is a graphical representation of electrical activity of heart. The ECG is one of the most important biological signals and is used for diagnosis of cardiac abnormalities. The main artifacts which corrupt the ECG signal are baseline wander (BW), power-line interference (PI), muscle artifacts and motion artifacts. The occurrence of these artifacts in an ECG signal makes it difficult to detect abnormality in the heart. Powerline interference is a high frequency noise with a frequency of 50/60 Hz and corrupts the ECG signal during data acquisition [17]. Different techniques have been proposed for powerline interference reduction based on adaptive filters, non linear filter banks, genetic algorithms etc [513, 1518]. Adaptive filter as a noise canceller for powerline interference requires an external signal for noise cancellation. In empirical mode decomposition (EMD) based powerline interference reduction, the first intrinsic mode function was used for noise removal. Sometimes, a component of R-wave may also be present in the first intrinsic mode function; hence a notch filter on the first intrinsic mode function was applied before using it for adaptive noise cancellation. A new method for removal of PI in ECG signals based on EMD and discrete wavelet transform was described in [5]. Empirical wavelet transform (EWT) and adaptive filter based powerline interference methods were discussed in [23]. Different methods of powerline interference reduction based on EMD with different adaptive filter structures and subtraction methods were presented in [6]. In EMD based PI removal methods, the first Intrinsic mode function is used either in the adaptive filter structure or is subtracted from the noisy ECG after some pre-processing to obtain noise free ECG [5, 6]. However if the signal is already noise free, the first Intrinsic mode function will no more provide an estimate of powerline frequency and thus the adaptive filter structure will distort the ECG signal. The baseline wander on the other hand is a low frequency noise. The frequency range of baseline wander varies from 0.05 to 0.7 Hz [8]. It is generally caused by movement of patients due to breathing, coughing, anxiety, stress or pain, and motion of electrodes [18]. Large baseline wander may change the duration and shape of ST segment, and may result in the loss of lower amplitude peaks such as P and T waves [6]. A number of techniques have been proposed in literature for baseline wander correction in ECG signals. A traditional approach for baseline wander noise removal is to use a high pass filter having a cut off frequency of 0.7 Hz [7]. However there may be an overlap between baseline Wander noise and low frequency component of an ECG signal [20]. In such a situation, baseline wander removal using a high pass filter will change the morphology of original ECG signal, mainly, the ST segment. Thus, the use of a high pass filter is not always a good choice for baseline wander removal. Many different techniques commonly used for removal of baseline wander noise are based on adaptive filtering, wavelet method and (EMD) [9, 2022]. The EMD based approach for baseline wander correction is based on partial reconstruction of signal using a few intrinsic mode functions. However, the baseline wander noise may be dispersed over a number of intrinsic mode functions. Thus computing the optimum number of modes for partial reconstruction is not automated. A new technique for signal denoising using a hybrid approach of EMD, discrete wavelet transform (DWT), and constrained least squares (CLS) was proposed in [24]. In this approach, the noisy signal was decomposed into a series of intrinsic mode functions using EMD. Then, each intrinsic mode function was denoised using wavelet thresholding and finally a weighted sum of the denoised intrinsic mode functions was performed after weight estimation by CLS except the residue [24]. Recently, variational mode decomposition has been proposed and is being applied for denoising purpose [2528]. In [26], a similar approach as discussed in [24] was used where variational mode decomposition was utilized in place of EMD. Lahmiri in [28] presented a comparative study between EMD-DWT approach and VMD-DWT approach for signal denoising. Simulation results indicate that the VMD-DWT approach delivers better results than the conventional EMD–DWT [28]. In this paper, new methods are proposed for powerline interference and baseline wander noise removal from ECG signals using EWT. The EWT is a relatively new method that is still being researched and applications for it are being found. This work uses the EWT method to deliver an innovative approach to an old filter problem. Powerline interference and baseline wander noise is removed by using a subtraction method based on empirical wavelet transform. The ECG contaminated with powerline frequency is decomposed into two modes through EWT using optimized boundary. The last mode so obtained is preprocessed and subtracted from the noisy ECG to obtain noise free ECG signal. For baseline wander correction, noisy ECG is decomposed into two modes using EWT using different boundary. The first mode provides an estimate of baseline drift and is subtracted from the noisy ECG to obtain ECG signal free of baseline wander.

2. Materials and methods

Empirical wavelet transform

Empirical wavelet transform is a fully adaptive and data—driven signal processing technique with well defined mathematical background and is analogous to the empirical mode decomposition. The EMD adaptively decomposes a time series into a sum of ‘well-behaved’ AM-FM components. The EMD algorithm is a data driven approach and it propose to decompose a signal according to its contained information [2]. Despite of its lack of mathematical theory and high computational complexity, EMD is widely being used in various fields of engineering. A new approach for decomposing a time series into different modes is the Empirical Wavelet Transform and is based on the design of an adaptive wavelet filter bank [1]. EWT provide a more consistent decomposition while, the EMD exhibits too much modes, which are sometime really difficult to interpret [1]. EWT first computes the fast Fourier transform (FFT) of the signal, then computes the boundaries based on the segmentation of Fourier spectrum, and finally extracts the oscillatory modes using an adaptive wavelet filter bank based on the boundaries computed [1]. The EWT algorithm is briefly introduced here in the following steps:

  1. 1.

    Compute the FFT to the signal S(t), to obtain its frequency spectrum S(ω). Find the maxima in the spectrum S(ω) of the signal with their corresponding frequencies. Let the spectrum consist of P maxima with frequencies ω i , i = 1, 2…………..P. Arrange the maxima in the descending order.

  2. 2.

    In the next step, the segmentation mechanism of Fourier spectrum is performed. Suppose, we wish to separate the Fourier spectrum {0, π} into N (N ≤ P) segments, then only first (N − 1) maxima are kept (excluding 0 and π). The boundary Ω i of each segment is then defined as the center of two consecutive maxima.

    $${{\Omega }_{i}}=\frac{{{\omega }_{i}}+{{\omega }_{i+1}}}{2} .$$

    Thus we get a set of boundaries Ω = {Ω i }, i = 1, 2… N − 1.

  1. 3.

    Design an adaptive wavelet filter bank consisting of a low-pass filter (scaling function) and (N − 1) band pass filters (wavelet functions) based on the detected boundaries. For mathematical equations of empirical scaling and wavelet function the readers are requested to refer [1].

  2. 4.

    Finally, the extracted modes are defined as the output of scaling function and wavelet functions.

For more detailed description of EWT the authors can refer to [1].

Proposed methods

Powerline interference (PI) cancellation Method

We have utilized EWT algorithm to eliminate powerline interference from ECG signal. We decompose the noisy ECG (ECG + PI) into two modes using EWT with optimized boundary. How the optimized boundary frequency is computed is discussed in more detail subsequently. The segmentation mechanism and the boundary detection procedure are explained more clearly in Fig. 1. Figure 1a represents a clean ECG signal, Fig. 1b shows a noisy ECG with powerline interference, the spectrum of which is shown in Fig. 1c. Figure 1d shows the spectrum {0, π} of noisy ECG with the corresponding boundary computed for the construction of empirical wavelet function and scaling function. To separate the powerline frequency from the ECG spectrum, we can decompose the ECG into two modes using EWT. If we wish to decompose the noisy ECG into two modes, we need to specify one boundary in the noisy data spectrum. Generally, the boundary is specified as the mid-point between two major maxima. Thus we obtain a boundary which lies in between the maximum peak of ECG and the powerline frequency. Then we design a low pass filter and high pass filter using empirical scaling and wavelet function respectively. The wavelet function will separate the powerline frequency and thus the output of wavelet function can be subtracted from the noisy ECG to obtain clean ECG signal. However if the ECG signal is already clean (without powerline interference) or if the signal to noise ratio (SNR) of the noisy ECG is low, in such a case, the boundary will be computed as the mid-point between two major peaks of the ECG spectrum and thus the subtraction process will remove the actual spectrum of the ECG signal. Thus, we propose a different approach to optimize the boundary frequency. Since powerline frequency is having constant frequency of 50/60 Hz. The peak in the noisy data spectrum due to PI will occur at a fixed frequency of w n ,{0–π} (corresponding to 50/60 Hz). In Fig. 1d, the peak of powerline frequency occurs at w n  = 1.23 which corresponds to data length of 1500 samples, sampling rate of 256 Hz and PI of 50 Hz. The filter bank is designed based on the boundary specified; the boundary thus cannot be specified at the peak location of PI. However, it must be specified before the peak location so that the entire spectrum of the noise get passed. Here we compute the boundary as w′ n = w n − T n/2, where T n = 2τ n and τn = γw n . For γ = 0.25 and w n = 1.23, w′ n = 0.9225 (refer to Fig. 1d). The empirical scaling function and wavelet function are shown in Fig. 1e, f respectively along with the extracted modes in Fig. 1g, h. As evident from Fig. 1h, the second mode provides an accurate estimate of PI and thus can be directly subtracted from the noisy ECG to obtain clean ECG signal. However in some case, the the second mode is not true estimate of PI as shown in Fig. 2a, b. This happens generally when the signal to noise ratio of noisy ECG is low. In such a case, we apply a smoothing operator along with a band pass filter to smooth the estimated mode before subtraction. The smoothing operator first detects all the maxima and minima in the estimated mode.

Fig. 1
figure 1

Segmentation of fourier spectrum of Noisy ECG (ECG + PI) a clean ECG b noisy ECG c spectrum of noisy ECG d computed boundary e scaling function f wavelet function g first mode of EWT h second mode of EWT

Fig. 2
figure 2

a Estimate of powerline frequency obtain from the empirical wavelet function b zoomed version of ‘a’ c smoothed signal

Then we compute the mean (m) and the standard deviation (std) of the maxima and the minima of the mode. The magnitude of each maxima is compared with m ± 2 × std. If the magnitude of the peak is greater than (m + 2 × std) or less than (m  2 × std), we define a window between the preceding and the succeeding minima on both sides of the current maxima. The portion of signal within this window and having magnitude greater than zero is scaled by a factor of m×{x/max}. where x is the signal within the window and max is the maximum ampltude of x. A simillar approach is used for minima. The output after this operation is further passed through a band pass filter having a bandwidth of {49–50} Hz. The smoothed signal is shown in Fig. 2c. This signal is then subtracted from ECG to obtain noise free ECG signal.

Based upon this discussion, the proposed algorithm for PI removal from ECG is briefly outlined as below:

  1. 1.

    Consider a noisy ECG signal, S(n), corrupted with powerline interference noise i.e. S(n) = ECG + PI.

  2. 2.

    Compute the optimum boundary for the construction of empirical wavelet filter bank.

  3. 3.

    Decompose the noisy ECG signal into two modes (M1 and M2) using the empirical wavelet transform.

  4. 4.

    Smooth the second mode (M2) using a smoothing operator and a band pass filter.

  5. 5.

    Subtract the smoothed mode from the noisy ECG signal to obtain noise free ECG. This provides us ECG signal, which is free from PI.

Removal of baseline wander noise

We have used the same EWT technique for removing the baseline wander noise from ECG signal. Since baseline wander noise is a low frequency noise generally <0.7 Hz, we compute a different boundary for the elimination of baseline wander noise. Since baseline wander noise is generally limited to 0.7 Hz, hence we compute the boundary frequency w n corresponding to 0.7 Hz. We again decompose the noisy ECG (ECG + BW) into two modes. The first mode estimates the baseline wander noise and the noise free signal is obtained by subtracting the first mode from the noisy ECG signal. This method of baseline wander removal is outlined below:

  1. 1.

    Consider a noisy ECG signal, X(n), corrupted with baseline wander noise i.e. X(n) = ECG + BW.

  2. 2.

    Compute the boundary frequency (corresponding to 0.7 Hz) for the construction of empirical wavelet filter bank.

  3. 3.

    Decompose the noisy ECG signal into two modes using the empirical wavelet transform.

  4. 4.

    Substract the first mode from the noisy ECG to obtain noise free ECG. This provides us ECG signal, which is free from baseline wander.

Results

In this section the quantitative and qualitative results of the proposed methods are presented. A comparative study of the proposed methods with some pre-existing methods is also presented.

Databases used for ECG signals and noise recordings

In the simulation study, synthetic ECG as well as real ECG recordings are considered for the performance evaluation of the proposed algorithms. In order to quantify the performance of a filtering approach, the pure noise free signals are mandatory. The simulation study was carried out using signals that are completely free of noise. This study was performed using synthetic signals. Synthetic ECG signals are taken from physionet with a sampling frequency of 256 Hz. In addition, Realistic ECG recordings from MIT-BIH Arrhythmia Database http://www.physionet.org/physiobank/database/mitbih/) and PTB Diagnostic ECG database (http://www.physionet.org/physiobank/database/ptbdb/) are used for testing the methods and gaining a qualitative feel on how the method works. MIT-BIH arrhythmia database includes 48 half-hour recordings of two leads of ECG signals at a sampling frequency of 360 Hz with 11-bit resolution over a 10 mV range. The PTB diagnostic database includes 549 recordings from 290 different subjects. Each subject is represented by one to five recordings. Each recording includes 15 signals measured simultaneously by the conventional 12 leads (i, ii, iii, avr, avl, avf, v1, v2, v3, v4, v5, v6) along with the 3 Frank lead ECGs (vx, vy, vz). The recordings are sampled with a sampling frequency of 1KHz with 16-bit resolution over the ±16.384 mV range and have variable duration (from 30 s to 2 min approximately). The baseline wander recordings (BW1 and BW2) have been taken from the MIT-BIH Noise Stress Test database (http://www.physionet.org/physiobank/database/nstdb/). For powerline interference, we have generated sine waves of 50 Hz with varying amplitude and phase. The noisy ECG records are obtained by adding noise (BW/PI) to the ECG signals at different levels of signal to noise ratio. The noise is scaled by an appropriate factor corresponding to a pre-defined input signal to noise ratio before addition with the original ECG. Two parameters are chosen for performance evaluation: output signal to noise ratio and correlation coefficient between original clean ecg x(n) signal and the denoised ecg signal y(n).

$$\text{Output signal to noise ratio}=10\text{ }{{\log }_{10}}\left( \frac{\frac{1}{N}\mathop{\sum }_{n=0}^{N-1}{{\left| y\left( n \right) \right|}^{2}}}{\frac{1}{N}\mathop{\sum }_{n=0}^{N-1}{{\left| x\left( n \right)-y\left( n \right) \right|}^{2}}} \right)$$
(1)
$$\text{Correlation coefficient}=\frac{E((x-\mu x)(y-\mu y))}{\left( \sigma x \right)(\sigma y)}$$
(2)

where E denotes the expectation operator, \(\mu x\) and \(\mu y\) are the mean values of x(n) and y(n) and \(\sigma x\) and \(\sigma y\) denotes the standard deviation of x(n) and y(n) respectively. All the results were simulated in matlab. We also compare the proposed algorithms with other methods including a standard Butterworth filter (a notch filter for the elimination of power line interference and a high pass filter for the removal of baseline wander) and EMD based methods.

Performance of PI removal method

We compare the performance of the proposed powerline interference removal method with the existing technique of EMD based indirect subtraction method [6] and also with a standard Butterworth notch filter with a cut off frequency of 50 Hz. Different methods for powerline interference reduction based on subtraction methods and adaptive structures were described in [6]. The authors concluded that EMD based indirect subtraction method provides better results as compared to others. For each record used in this simulation study, 5 segments of 2000 samples have been taken. The performance evaluation parameters represent the averaged valves over all the frames involved in the analysis. Table 1 presents the results for the removal of powerline interference of 50 Hz for a synthetic signal. Table 1 show the averaged output signal to noise ratio and correlation coefficient for 5 segments. From these results, it is observed that the proposed method performs better than the other existing ones. For realistic ECG record we have tested the algorithm on different records from MIT-BIH arrhythmia database. Figure 3a, b show the performance of proposed algorithm for record 100 and record 103 from the MIT-BIH arrhythmia database respectively. As evident from Fig. 3, the proposed method provides significant improvement in output signal-to-noise ratio. Table 2 compares the correlation coefficient between the original ECG and the denoised ECG for record 100 and record 103. As evident from Table 2, the proposed method outperforms the others in terms of correlation coefficient. Figure 4 shows the original ECG and the denoised ECG using various methods for a simulated ECG and record 100 from MIT-BIH arrhythmia database.

Table 1 Comparison of proposed PI removal method with EMD based Method and Notch filter averaged over 5 segments for a synthetic ECG signal
Fig. 3
figure 3

Comparative performance of the proposed PI removal method in term of signal to noise ratio (dB), with EMD based method and Notch filter for a record 100 b record 103

Table 2 Comparison of correlation coefficient for proposed PI removal method with EMD based Method and Notch filter averaged over 5 segments for record 100 and record 103 from MIT-BIH arrhythmia database

Performance of baseline wander removal method

Both Qualitative and Quantitative results are presented for baseline wander removal. The baseline wander removal method was first evaluated on PTB diagnostic database. To demonstrate the performance of the proposed EWT based BW removal method, two different subjects from PTB database showing different behavior in baseline wander noise were analyzed. Figure 5 shows the record number 255 (lead number 1) from PTB database in which the BW decreases with almost constant slope. The estimate of BW obtained along with denoised signal and a detailed portion of the denoised signal is also shown in Fig. 5. A closer look into the output ECG indicates no baseline drift for the entire signal duration. The second example includes the subject number 150 (lead number 6) in which the BW increases randomly. The original ECG recording, the estimated BW and the denoised ECG are shown in Fig. 6. A visual inspection of Fig. 6 shows no BW in the denoised ECG signal. For Quantitative evaluation record 100 and record 103 from MIT-BIH arrhythmia database are considered. The performance evaluation parameter used is the output signal to noise ratio and correlation coefficient. Table 3 shows the comparative study of the proposed method with EMD based method and Butterworth high pass filter (cut off frequency is 0.7 Hz) for record 100 and record 103 respectively. In the EMD based method, the noisy ECG is decomposed into intrinsic mode functions and the last three intrinsic mode functions are discarded to reconstruct the clean signal. It can be seen that the proposed method provides a better output signal to noise ratio and correlation coefficient as compared to other methods.

Fig. 4
figure 4

Clean ECG and denoised ECG using various methods for a simulated ECG b record 100

Fig. 5
figure 5

Baseline wander removal for the PTB database subject 255 (lead number 1): from top to bottom original ECG with estimate of BW, denoised ECG signal, details of denoised signal

Fig. 6
figure 6

Baseline wander removal for the PTB database subject 150 (lead number 6): from top to bottom original ECG with estimate of BW, denoised ECG signal, details of denoised signal

Table 3 Comparison of proposed baseline wander removal method with EMD based method and high pas filter for record 100 and 103 from MIT-BIH arrhythmia database

Complete denoising method

Two different methods are presented, one for powerline interference filtering and the other for baseline wander filtering. However a signal may be corrupted by both the type of noise. For complete denoising, the two algorithms described here can be used sequentially. In Fig. 7. We have shown the performance of complete denoising approach with different possible cases. The complete denoising method is able to filter in all cases; without noise, as well as with one or the two types of noise.

Fig. 7
figure 7

Performance of the complete denoising method. Top row ac clean ECG; PI filtered signal and BW filtered signal. Second row df ECG with PI; PI filtered signal and BW filtered signal. Third row gi ECG with BW; PI filtered signal and BW filtered signal. Last row jl ECG with PI and BW; PI filtered signal and BW filtered signal

Discussion

Essentially, the proposed methods consist on low-pass/band-pass filtering where the cut off frequency is obtained from the analysis of the data spectrum. In proposed algorithm for PI removal, the output SNR increases with an increase in input SNR. However, in case of EMD method, the SNR increases first and then decreases because at low input SNR the EMD algorithm does not provide an accurate estimate of the powerline frequency. In case of Notch filtering, the output SNR increases with a decrease in input SNR but the improvement is less. For BW removal, the empirical wavelet filter is essentially having the same cut off frequency as that of the Butterworth filter but it provides a bit high output SNR as compared to the Butterworth filter because of its frequency response characteristic. For complete denoising, the two algorithms can be used sequentially since the two filters in the two cases have different pass bands and thus do not affect the performance of each other. In the sequential operation we first removed the PI and then BW. However the two operations may be applied in reverse order as well. The simulated ECG represents an ideal case and is not a realistic ECG record. In such a case, the various denoising techniques perform well since the powerline frequency can be eliminated efficiently. In case of simulated ECG, It was observed that the EWT based method and EMD based method are able to extract almost exactly the clean ECG from the noisy ECG, whereas the Notch filter attenuates the magnitude of R-peak. Hence the improvement in the performance of the proposed method over EMD based method is not much, whereas this improvement is significant as compared to the Notch filter based method. Also, in case of synthetic ECG, output SNR is high since the input signal is noise free and the denoised signal traces the input signal. Since the denoised signal and the original signal almost replicate each-other, the correlation coefficient is almost equal for the different cases. Still, there is a bit improvement in the results, in terms of output SNR as well as correlation coefficient which indicates the proposed methodology can be better option to remove noise from ECG signals. However, as compared to realistic ECG, the output SNR is not as high as in case of synthetic ECG, since there is a variation in the amplitude range over the entire signal and the denoised signal doesn’t trace exactly the original signal. However, the improvement in SNR for the proposed method is significant as compared to the other methods. Since the proposed method provides a better estimate of the original signal, there is a significant improvement in the correlation coefficient for proposed method as compared to EMD method and Notch filter.

Conclusion

This study presents new methods for powerline interference cancellation and baseline wander correction in ECG signals based on Empirical wavelet transform. In clinical environment during data acquisition, the ECG signals are often corrupted by powerline interference from the recording instruments and baseline wander due to movement of patients. EWT is a new technique for extracting the different modes embedded in a signal and works similar to EMD. As EMD is complex and slow process, EWT is used in this paper for powerline interference reduction and baseline wander removal. When EWT is applied on the noisy signal, the estimate of powerline interference is provided by the last mode whereas the baseline is estimated by the first mode. Thus separating these modes from the noisy ECG signal provides the noise free ECG. Performance evaluation reveals that, compared to standard filters and EMD based algorithms, the proposed methods provide considerable improvement in output signal-to-noise ratio and shows higher correlation between the original ECG and the denoised ECG signal.