1 Introduction

Cardiovascular disease is one of the main indicators of mortality [2]. To measure the heart activity of a person it is common to use a noninvasive method that consists of to attach electrodes in different parts of the body and record the electrical activity of the heart by an external device [1], thus obtaining electrocardiogram (ECG) signals that measure cardiac activity. This type of signal usually has the amplitude between \(10\,\upmu \)V and 5 mV and frequency between 0.05 and 100 Hz [21].

An ECG signal is composed of a P wave, QRS complex, T wave, and U wave. Several cardiovascular diseases can be manual or automated detected from the analysis of the amplitude, duration, and interval between each of these waves [6, 7, 13]. However, during the acquisition process, various sources of noise can corrupt the ECG signal and, consequently, compromise the diagnosis. Among the types of noise that can corrupt the electrocardiogram signal are the power line interference (PLI), which comes from the cables that carry the ECG information [18], and muscle artifacts (MA), from muscle activity [4].

The detection and removal of noise in electrocardiogram (ECG) signals allow the accuracy in the cardiac diagnosis. Traditional methods based on Fourier transform not ever-present good performance when they are applied at non-stationary signals such, for example, seismic traces and electrocardiograms [14, 15]. In this scenario, the discrete wavelet transforms (DWT) and empirical mode decomposition (EMD) appear at powerful signal denoising tools.

Between the recent works, we can highlight the methods new improved wavelet thresholding (NIWT) [12], the ECG signal denoising by EMD and adaptive switching mean filter (EMD-ASMF) [19], the new power line interference removal based on the stationary wavelet transform (PLI-SWT) [9] and empirical mode decomposition with wavelet transform and non-local means (EMDWAVNLM-1 and EMDWAVNLM-2) [10].

The NIWT method uses a thresholding function based on the sigmoid function when considering the universal threshold. The EMD-ASMF uses the wavelet shrinkage to smooth the three lower-order intrinsic mode functions, IMFs (precisely IMF1, IMF2, and IMF3), applies the switching mean filter in the smoothed signal and then applies a decision process that recovers the R-peaks by the Pan–Tompkins method. The PLI-SWT uses the stationary wavelet transform shrinking and makes use of a new thresholding function designed to work successfully in a wide variety of scenarios. The EMDWAVNLM is composed of two hybrid methods (EMDWAVNLM-1 and EMDWAVNLM-2), EMDWAVNLM-1 applies the non-local means for each IMF, and EMDWAVNLM-2 apply the wavelet threshold for each IMF.

In this paper, we propose a new ECG denoising method called by Noise Reduction by empirical mode decomposition, wavelets and Viterbi algorithm (EMDWAVIT). This method applies the discrete wavelet transform (DWT) over the intrinsic mode functions and processes their wavelet coefficients by the Viterbi algorithm.

In general, noise reduction methods propose a threshold along with a thresholding function. Unlike previous techniques, the EMDWAVIT method processes the detailed wavelet coefficients per cluster. In addition, the EMDWAVIT method takes into account the fact that denoising is a blind technique, because, in practice, we do not know the nature of the noise. Therefore, we can list the two major advantages of EMDWAVIT as follows:

  1. 1.

    The EMDWAVIT method proposes the clustering of the wavelet coefficients, separating the noisy coefficients from those that represent the information;

  2. 2.

    this separation is based on the Hidden Markov Models (HMM) and the Viterbi algorithm. Which, by definition, estimates a hidden generating process, based on the observed data. This is exactly what happens when we obtain a noisy ECG signal in practice, in this case, we have at our disposal observable data, measured through an ECG exam, but we are unable to accurately determine the nature and magnitude of the noise that is corrupting it. That is, in practice, we need to estimate the noise-generating process, which is hidden from the observer.

We compare the performance of the EMDWAVIT method with other six well-known methods: NIWT [12], EMD-ASMF [19], 1DTVD [5], PLI-SWT [9], EMDWAVNLM-1 and EMDWAVNLM-2 [10].

In Sect. 2, we review some basic properties about wavelets, empirical mode decomposition, and Viterbi algorithm. In Sect. 3, we present the proposed EMDWAVIT method and in Sect. 4 we show the simulation results. In Sect. 5 we summarize the major conclusions of this study.

2 Basic Concepts

In this section, we approach three basic concepts used in the EMDWAVIT method: the discrete wavelet transform (DWT) (Sect. 2.1), the empirical mode decomposition (EMD) (Sect. 2.2) and the Viterbi Algorithm (Sect. 2.3).

2.1 Discrete Wavelet Transform

The wavelet theory consists in the approximation of functions by the linear combination of functions called wavelets. The mother and father wavelets, respectively given by \(\psi (\cdot )\) and \(\phi (\cdot )\) are real functions respecting to: \(\psi , \phi \in L^2({\mathbb {R}})\cap L^1({\mathbb {R}})\), \(\int _{{\mathbb {R}}}\psi (t)\hbox {d}t=0\) and \(\int _{{\mathbb {R}}}\phi (t)\hbox {d}t=1\).

Usually, the mother wavelet is bounded and centered on the origin and \(\psi (\cdot )\rightarrow 0\) when \(\mid t \mid \rightarrow \infty \). Considering \(j,k \in {\mathbb {Z}}\) these functions relate which other by the functions \(\psi (t)=\sqrt{2}\sum _{k}h_{k}\phi (2t-k)\) and \(\phi (t)=\sqrt{2}\sum _{k}g_{k}\phi (2t-k)\). Where \(g_k\) and \(h_k\) are the respectives low-pass filter and high-pass filter coefficients respecting to \(h_k=(-1)^k g_{1-k}\).

Fig. 1
figure 1

Flowchart for the EMDWAVIT method

Fig. 2
figure 2

Synthetic ECG signal smoothed by EMDWAVIT method (MA)

From there on, it is possible to build a wavelet sequence given by:

$$\begin{aligned} \psi _{j,k}(t)= & {} 2^{\frac{j}{2}}\psi (2^{j}t-k),\\ \phi _{j,k}(t)= & {} 2^{\frac{j}{2}}\phi (2^{j}t-k). \end{aligned}$$

The Definition 1 formalizes the construction that maps the data from the time domain to the wavelet domain.

Definition 1

(DWT) If \(\mathbf {y}=(y_0,y_1, \) \(\ldots ,y_{N-1})^\prime \) is a signal with length N, such that \(N=2^J, J\in {\mathbb {N}}\). Then, the DWT of \(\mathbf {y}\), according its mother wavelet \(\psi (\cdot )\), is given by:

$$\begin{aligned} d_{j,k}=\sum _{t=0}^{N-1} y_t \psi _{j,k}(t), \end{aligned}$$
(1)

where \(j=0,1,2,\ldots ,J-1\) and \(k=0,1,2,\ldots ,2^j-1\).

In practice, we calculate the DWT using a pyramid algorithm given by Meyer [16] instead of Definition 1. This algorithm consists of an iterative application of the high-pass and low-pass filters that return the detail wavelet coefficients set given by \(\{d_{j,k}\}\). To minimize or remove the noise in a signal we need to decide which one of these detail wavelet coefficients need to have their magnitude reduced or eliminated and then, we need to apply the inverse discrete wavelet transform (IDWT) in these previously processed coefficients.

2.2 Empirical Mode Decomposition

The empirical mode decomposition (EMD) is a method that decomposes the signal in components called intrinsic mode functions (IMFs). The IMFs satisfy two conditions: the difference between the number of zero-crossing and extrema need to be less or equal to one. And, at any point, the mean value defined by the upper and lower envelope is zero. The “Sifting” process extracts the IMFs by the following steps.

Let \({\varvec{x}}(t), \ \ t \in {1,2,\ldots ,N}\) a signal. Let \({\varvec{x}}_{u}(t)\) and \({\varvec{x}}_{l}(t)\), respectively, the upper and lower envelope. The first step consists in to find the mean envelope \({\varvec{m}}_{11}(t)=\frac{{\varvec{x}}_{u}(t)+{\varvec{x}}_{l}(t)}{2}\). In the second step, we define \({\varvec{h}}_{11}(t)={\varvec{x}}(t)-{\varvec{m}}_{11}(t)\). We repeat this procedure \(k \in {\mathbb {N}}\) times, until that \({\varvec{h}}_{1}={\varvec{h}}_{1k}=h_{1(k-1)}-{\varvec{m}}_{1k}\) follows the criteria of IMF or until an termination criteria (usually standard deviation) is satisfied. Then, \({\varvec{h}}_{1}(t)\) is the first IMF.

In the third step, we define \({\varvec{r}}_{1}(t)={\varvec{x}}(t)-{\varvec{h}}_{1}(t)\) and repeat the procedure to find \({\varvec{h}}_{2}(t)\) and, consequently, \({\varvec{r}}_{2}(t)={\varvec{x}}(t)-{\varvec{h}}_{1}(t)-{\varvec{h}}_{2}(t)\). We repeat this process until we find an monotonic function \({\varvec{r}}_{j}(t)={\varvec{x}}(t)-\sum _{n=1}^{L}{\varvec{h}}_{n}(t), L \in {\mathbb {N}}\). Then, we can see that the signal \({\varvec{x}}(t)\) can now be written as:

$$\begin{aligned} {\varvec{x}}(t)={\varvec{r}}_{j}(t)+\sum _{n=1}^{j}{\varvec{h}}_{n}(t) \end{aligned}$$
(2)
Table 1 Synthetic ECG signal corrupted by MA (average SNR input: 5.50 dB)
Table 2 Synthetic ECG signal corrupted by PLI (average SNR input: 14.59 dB)
Fig. 3
figure 3

Box plot for the cases that generate the PRD average values of Table 1

Fig. 4
figure 4

Box plot for the cases that generate the SNR output average values of Table 1

Fig. 5
figure 5

Synthetic ECG signal smoothed by EMDWAVIT method (PLI)

Fig. 6
figure 6

Box plot for the cases that generate the PRD average values of Table 2

Fig. 7
figure 7

Box plot for the cases that generate the SNR output average values of Table 2

2.3 Viterbi Algorithm

The Viterbi algorithm appears in the context of the Hidden Markov Models (HMM). There are two parts in this model: the observed part, \(\{C_t\}_{t\in {\mathbb {N}}^{*}}\), and the unobserved part, \(\{Z_t\}_{t\in {\mathbb {N}}^{*}}\), which together satisfy the Markov property. Each \(C_t\) value in the model \(\{C_t\}_{t\in {\mathbb {N}}^{*}}\), depends on the respective state \(Z_t\) in the Markov Chain \(\{Z_t\}_{t\in {\mathbb {N}}^{*}}\), which is evident in Definition 2.

Definition 2

Let \(\{C_t\}_{t\in {\mathbb {N}}^{*}}\) be a stochastic process. Let \({\varvec{C}}^{(t)}=(C_1,\ldots ,C_t)\) and \({\varvec{Z}}^{(t)}=(Z_1,\ldots ,Z_t)\) be the histories from time 1 to time t. Thus, \(\{C_t\}_{t\in {\mathbb {N}}^{*}}\) is an HMM if the following conditions are satisfied:

$$\begin{aligned}&{\mathbb {P}}(Z_t=z_{t}|{\varvec{Z}}^{(t-1)}={\varvec{z}}^{(t-1)})={\mathbb {P}}(Z_t=z_t|Z_{t-1}=z_{t-1}),\nonumber \\&\quad t=1,2,\ldots , \end{aligned}$$
(3)

and

$$\begin{aligned}&{\mathbb {P}}(C_t = c_t|{\varvec{C}}^{(t-1)} = {\varvec{c}}^{(t-1)},{\varvec{Z}}^{(t)} = {\varvec{z}}^{(t)}) = {\mathbb {P}}(C_t = c_t|Z_t = z_t),\nonumber \\&\quad t=1,2,\ldots , \end{aligned}$$
(4)

where \({\varvec{c}}^{(t)}=(c_1,\ldots ,c_t)\) is the observations sequence for the model, and \({\varvec{z}}^{(t)}=(z_1,\ldots ,z_t)\) is the hidden states sequence.

If the Markov Chain \(\{Z_t\}_{t\in {\mathbb {N}}}\) has m states, \(\{C_t\}_{t\in {\mathbb {N}}}\) is an m-state HMM, and if the hidden state \(Z_{t}=i\) is known, then a distribution can be associated with \(C_t\). In this paper, we consider the Gaussian distribution and \(i \in \{1,2\}\) (that is, a two-state Gaussian HMM).

Estimating an HMM for a sequence of observable data involves estimating the stationary distribution and the transition probabilities of a Markov Chain, as well as the parameters of the distributions associated with each state. In our case, we are working with Gaussian distributions and estimating the means \(\mu _{1},\mu _{2}\) and the standard deviations \(\sigma _{1},\sigma _{2}\). Here, we use the Expectation-Maximization algorithm to estimate these parameters (see [22], for details). With these estimated parameters, it is possible to estimate the most likely hidden sequence \({\varvec{z}}^{(N)}\) of the hidden states using the Viterbi algorithm [8].

3 EMDWAVIT Method

Here, we describe the EMDWAVIT method, which is based on the EMD, DWT, and Viterbi algorithm. The EMDWAVIT method is applied in the following steps (Fig. 1).

Given an N-length noisy signal \({\varvec{y}}\) (obtained from the addition of the noise \({\varvec{e}}\) to a clean signal \({\varvec{x}}\), where \(N=2^J, J\in {\mathbb {N}}\)). In the first step we obtain the IMFs, let \(\mathbf {h}_{n}\) (\(n \in \{1,2,\ldots ,L-3\}\)) the nth IMF obtained from the EMD application to \({\varvec{y}}\) (see Sect. 2.2). In the second step, over each \(\mathbf {h}_{n}\), we apply the DWT to produce the detail wavelet coefficients \(\mathbf {d}=\{d_t \}_{t\in \{1,2,3,\ldots ,N-1\}}\) (see Sect. 2.1). We use the Expectation Maximization algorithm in the third step to obtain a two-state Gaussian HMM given the observation sequence \({\varvec{c}}^{(N-1)}=\mathbf {d}\) (see Sect. 2.3), where \(\mathbf {d}\) is the detail wavelet coefficients (\(c_t=d_t , t\in \{1,2,3,\ldots ,N-1\}\)).

In the fourth step, the Viterbi algorithm [8] is applied to find the most likely sequence \({\varvec{z}}^{(N-1)}\). A two-state Gaussian HMM is considered, and \(z_{t}\in \{1,2\}, t\in \{1,2,3,\ldots ,N-1\}\). In the fifth step, we generate two sets \(D_{1}=\{b_{1i}\}_{i \in \{1,2,\ldots ,N-1\}}\) and \(D_{2}=\{b_{2i}\}_{i \in \{1,2,\ldots ,N-1\}}\) where

$$\begin{aligned} b_{1i}=\left\{ \begin{array}{ll} c_{i},&{} \text{ if } \quad z_{i}=1,\\ 0,&{} \text{ otherwise }, \\ \end{array}\right. \end{aligned}$$

and

$$\begin{aligned} b_{2i}=\left\{ \begin{array}{ll} c_{i},&{} \text{ if } \quad z_{i}=2,\\ 0,&{} \text{ otherwise }. \\ \end{array}\right. \end{aligned}$$
Table 3 Synthetic ECG signal corrupted by PLI and MA (average SNR input: 5.05 dB)
Fig. 8
figure 8

Box plot for the cases that generate the PRD average values of Table 3

In the sixth step, applying the IDWT in the sets \(D_{1}\) and \(D_{2}\), respectively, we obtain \(\hat{\mathbf {h}}_{n1}\) and \(\hat{\mathbf {h}}_{n2}\). We denote for \(\hat{\mathbf {h}}_{n}\), the smoothed signal of \(\mathbf {h}_{n}\), and it’s given by

$$\begin{aligned} \hat{\mathbf {h}}_{n}=\left\{ \begin{array}{ll} \hat{\mathbf {h}}_{n1},&{} \text{ if } \quad \text{ MSE }(\hat{\mathbf {h}}_{n1},\mathbf {h}_{n})<\text{ MSE }(\hat{\mathbf {h}}_{n2},\mathbf {h}_{n}),\\ \hat{\mathbf {h}}_{n2},&{} \text{ otherwise }, \\ \end{array}\right. \end{aligned}$$

where MSE is the mean squared error between two signals.

Fig. 9
figure 9

Box plot for the cases that generate the SNR output average values of Table 3

In the seventh step, we obtain the clean signal estimate \(\hat{{\varvec{x}}}\) by Eq. 2, changing \(\mathbf {h}_{n}\) by \(\hat{\mathbf {h}}_{n}\).

4 Simulation Results

In this section, we present the simulation results for the EMDWAVIT method. Section 4.1 presents the simulation results for the synthetic ECG signal and the Sect. 4.2 presents the simulation results for real ECG signals.

4.1 Synthetic ECG Signal

In this subsection, we consider a synthetic ECG signal and, the noises represented by the Muscle Artifacts (MA) and Power Line Interference (PLI).

Table 4 ANOVA considering MA and PLI noises, synthetic EGC signal
Fig. 10
figure 10

ECG signal named by code 103 smoothed by EMDWAVIT method (MA)

Table 5 Simulation results for the ECG signal named by code 103 corrupted by MA (average SNR input: 8.48 dB)
Table 6 Simulation results for the ECG signal named by code 105 corrupted by MA (average SNR input: 8.62 dB)
Table 7 Simulation results for the ECG signal named by code 106 corrupted by MA (average SNR input: 8.06 dB)
Fig. 11
figure 11

Box plot for the cases that generate the PRD average values of Tables 5, 6 and 7

Fig. 12
figure 12

Box plot for the cases that generate the SNR output average values of Tables 5, 6 and 7

Fig. 13
figure 13

PRD values obtained from each individual execution of the cases that generate the PRD average values of the Tables 5, 6 and 7

Fig. 14
figure 14

SNR output values obtained from each individual execution of the cases that generate the SNR output average values of Tables 5, 6 and 7

The sampling frequency of the synthetic ECG signal is 256 Hz and the Heart rate is 60 beats per minute. Figure 2 presents an example of Synthetic ECG signal denoised by the EMDWAVIT method.

We compare the EMDWAVIT performance with six well-established methods: NIWT, EMD-ASMF, 1DTVD, PLI-SWT, EMDWAVNLM-1 and EMDWAVNLM-2. To do this evaluation, we follow a Monte Carlo simulation.

The Monte Carlo simulation is an approach that seeks to find a populational parameter based on a significant sample. In our case, we will estimate the PRD and the SNR output performance parameters given by:

$$\begin{aligned}&\text{ PRD }(\mathbf {x},\hat{\mathbf {x}})=100\sqrt{\frac{\sum _{i=1}^{N}(x_{i}-{\hat{x}}_{i})^2}{\sum _{i=1}^{N}x_{i}^{2}}} \end{aligned}$$
(5)
$$\begin{aligned}&\hbox {SNR}(\mathbf {x},\hat{\mathbf {x}})=10\log _{10}{\frac{\sum _{i}^{N}x_{i}^2}{\sum _{i}^{N}(x_{i}-{\hat{x}}_{i})^2}}, \end{aligned}$$
(6)

We generate one-hundred noises (MA and PLI). Each of these noises has added to the synthetic ECG signal. In this way, from each clean signal, we obtain one-hundred noisy signals. Over each of these signals, we apply the denoising methods and calculate the performance parameters. We group the mean values of the PRD and SNR output by the database and the SNR input. As grater is the SNR output value and, as lower is the PRD value, better is the performance of the method. Tables 1 and 2 presents, in bold values, the best performances.

The PRD measures the ability of the denoising method to reduce the noise without loss of critical information. The SNR output is a parameter that verifies the proportion of noise in a signal. Table 1 shows the simulation results for the synthetic signal corrupted by Muscle Artifact (MA). The EMDWAVIT has the best performance when compared to the NIWT, EMD-ASMF, 1DTVD, PLI-SWT, EMDWAVNLM-1 and EMDWAVNLM-2 methods. Figures 3 and 4 show the box plot considering all the one-hundred execution of each method that generates the mean values of the SNR output and PRD of Table 1, we can see that the EMDWAVIT method presents the best performance also when we consider the individual values of the PRD and SNR output. Specifically, the maximum value of the PRD between the noise signal and the signal smoothed by the EMDWAVIT is 24.62, it is less than 28.19 that is the minimum PRD value obtained when we consider the other three denoising methods. As well as, the minimum SNR output value obtained by the application of the EMDWAVIT method is 12.17, which is greater than the maximum SNR output value of 10.99 obtained from the application of the other six methods.

Figure 5 shows an example of EMDWAVIT smoothing considering the Synthetic ECG signal corrupted by PLI.

Table 2 shows the simulations results for the synthetic signal corrupted by Power Line Interference (PLI)

Figures 6 and 7 show the box plot considering all the one-hundred executions of each method that generate the mean values of the SNR output and PRD of Table 2, we can see that the EMDWAVIT method presents the best performance also when we consider the individual values of the PRD and SNR output. Considering all of the executions, the maximum value of the PRD for the method EMDWAVIT is 7.06. That is less than the minimum value of 10.99 considering all the three other methods. For the SNR output, the minimum value for the EMDWAVIT is 23.01. It is greater than the maximum value of 19.17 considering all the three other methods. It shows that the method EMDWAVIT also shows a better performance for each PLI simulation.

Table 8 Simulation results for the ECG signal named by code 103 corrupted by PLI (average SNR input: 17.54 dB)
Table 9 Simulation results for the ECG signal named by code 105 corrupted by PLI (average SNR input: 17.67 dB)
Table 10 Simulation results for the ECG signal named by code 106 corrupted by PLI (average SNR input: 17.11 dB)

We also consider mixing these two noises. Table 3 shows the simulation results for the synthetic signal corrupted by PLI and MA.

Figures 8 and 9 show the box plot considering all the one-hundred executions of each method that generate the mean values of the SNR output and PRD of Table 3, we can see that the EMDWAVIT method presents the best performance also when we consider the individual values of the PRD and SNR output. Considering all of the executions, the maximum value of the PRD for the method EMDWAVIT is 27.62. That is less than the minimum value of 28.06 considering all the six other methods. For the SNR output, the minimum value for the EMDWAVIT is 11.17. It is greater than the maximum value of 11.03 considering all the six other methods. It shows that the method EMDWAVIT also shows a better performance for each PLI simulation.

Fig. 15
figure 15

ECG signal named by code 103 smoothed by EMDWAVIT method (PLI)

Fig. 16
figure 16

Box plot for the cases that generate the PRD average values of Tables 8, 9 and 10

Fig. 17
figure 17

Box plot for the cases that generate the SNR output average values of Tables 8, 9 and 10

Fig. 18
figure 18

PRD values obtained from each individual execution of the cases that generate the PRD average values of the Tables 8, 9 and 10

Fig. 19
figure 19

SNR output values obtained from each individual execution of the cases that generate the SNR output average values of Tables 8, 9 and 10

To ensure that there is a significant difference between method performances we can resort to the ANOVA test, see [3, 20] for details. Table 4 shows the p value less than 0.05, it means that there are significant differences between the groups. It is evidence of the results mentioned before.

4.2 Real ECG Signals

In this subsection, we consider four real-world ECG signals obtained from Physionet MIT-BIH arrhythmia database [11, 17]. The names of these signals are represented by 103, 105, and 106. Figure 10 presents an example of the 103 ECG signal denoised by the EMDWAVIT method.

Here, we follow the same approach as in Sect. 4.1, Tables 5, 6 and 7 show the simulation results for the MA noise, in bold values, the best performances. As we can see the EMDWAVIT have the best performance when compared to the NIWT, EMD-ASMF, 1DTVD, PLI-SWT, EMDWAVNLM-1 and EMDWAVNLM-2 methods. Figures 11 and 12 show the boxplot considering all the three-hundred execution of each method that generates the mean values of the SNR output and PRD of Tables 5, 6 and 7. Here, differently from what occurs in the Sect. 4.1, the boxplot graphs do not help enough in the performance analysis when considering all the individual executions, since the intervals where the values are more concentrated have intersections. In this way, we need to adopt a different visual analysis to check if the EMDWAVIT method performs better than the other six methods, also when considering each individual execution. Then, we adopt the graphical representation given by Figs. 13 and 14. These images give us a better view of what happens in individual executions. Note that we generate one-hundred noises for each one of the three real ECG signals, we apply the methods in each one of these noisy signals. Then, each image shows 300 cases to be observed. The EMDWAVIT method is represented in black, and the comparative method is represented in gray. As we can see, the PRD values presented by the EMDWAVIT method, in each individual simulation, are less than the PRD values of the comparative method. And, in the case of SNR output, we have that the values presented by the EMDWAVIT method are greater than the values presented by the comparative method. Therefore, it is possible to conclude that the EMDWAVIT method outperforms the other six methods, even when we consider each individual execution.

Tables 8, 9 and 10 shows the simulation results for the PLI. Figure 15 shows an example of EMDWAVIT smoothing considering the 103 ECG signal corrupted by PLI.

Figures 16 and 17 show the boxplot considering all the one-hundred executions of each method that generate the mean values of the SNR output and PRD of the Tables 8, 9 and 10. Again, differently from what occurs in the Sect. 4.1, the boxplot graphs do not help enough in the performance analysis when considering all the individual executions, since the intervals where the values are more concentrated have intersections. In this way, we need to adopt a different visual analysis to check if the EMDWAVIT method performs better than the other six methods, also when considering each individual execution. Then, we adopt the graphical representation given by Figs. 18 and 19 we can see that the EMDWAVIT method presents the best performance also when we consider the individual values of the PRD and SNR output. These images give us a better view of what happens in individual executions. Note that we generate one-hundred noises for each one of the three real ECG signals, we apply the methods in each one of these noisy signals. Then, each image shows 300 cases to be observed. The EMDWAVIT method is represented in black, and the comparative method is represented in gray. As we can see, the PRD values presented by the EMDWAVIT method, in each individual simulation, are less than the PRD values of the comparative method. And, in the case of SNR output, we have that the values presented by the EMDWAVIT method are greater than the values presented by the comparative method. Therefore, it is possible to conclude that the EMDWAVIT method outperforms the other six methods, even when we consider each individual execution.

Table 11 Simulation results for the ECG signal named by code 103 corrupted by PLI and MA (average SNR input: 7.99 dB)
Table 12 Simulation results for the ECG signal named by code 105 corrupted by PLI and MA (average SNR input: 8.12 dB)
Table 13 Simulation results for the ECG signal named by code 106 corrupted by PLI and MA (average SNR input: 7.57 dB)
Fig. 20
figure 20

Box plot for the cases that generate the PRD average values of Tables 11, 12 and 13

Fig. 21
figure 21

Box plot for the cases that generate the SNR output average values of Tables 11, 12 and 13

Fig. 22
figure 22

PRD values obtained from each individual execution of the cases that generate the PRD average values of Tables  11, 12 and 13

Fig. 23
figure 23

SNR output values obtained from each individual execution of the cases that generate the SNR output average values of Tables 11, 12 and 13

We also consider mixing these two noises. The Tables 11, 12 and 13 show the simulations results for the synthetic signal corrupted by PLI and MA.

Figures 20 and 21 show the boxplot considering all the three-hundred executions of each method that generate the mean values of the SNR output and PRD of the Tables 11, 12 and 13. Again, differently from what occurs in the Sect. 4.1, the boxplot graphs do not help enough in the performance analysis when considering all the individual executions, since the intervals where the values are more concentrated have intersections. In this way, we need to adopt a different visual analysis to check if the EMDWAVIT method performs better than the other six methods, also when considering each individual execution. Then, we adopt the graphical representation given by Figs. 22 and 23 we can see that the EMDWAVIT method presents the best performance also when we consider the individual values of the PRD and SNR output. These images give us a better view of what happens in individual executions. Note that we generate one-hundred noises for each one of the three real ECG signals, we apply the methods in each one of these noisy signals. Then, each image shows 300 cases to be observed. The EMDWAVIT method is represented in black, and the comparative method is represented in gray. As we can see, the PRD values presented by the EMDWAVIT method, in each individual simulation, are less than the PRD values of the comparative method. And, in the case of SNR output, we have that the values presented by the EMDWAVIT method are greater than the values presented by the comparative method. Therefore, it is possible to conclude that the EMDWAVIT method outperforms the other six methods, even when we consider each individual execution.

To ensure that there is a significant difference between method performances we can resort to the ANOVA test, see [3, 20] for details. Table 14 shows the p value less than 0.05, it means that there are significant differences between the groups. It is evidence of the results mentioned before.

The simulations were performed on a Dell computer, Intel (R) Core (TM) i7-8565U CPU 1.80 GHz 1.99 GHz; 8 GB of RAM. The code was developed in the R language, setting the noise generation seed to values from 1 to 100. The computational cost was also evaluated, the execution times of each method, for denoising only one signal, are given by 0.526871919631958 s for the EMDWAVIT method, 0.0553569793701172 s for the 1DTVD method, 0.299518823623657 s for the EMD-ASMF method, 0.0674631595611572 s for the NIWT method, 0.205456018447876 s for PLI-SWT, 0.303828001022339 s for the EMDWAVNLM-1 and 0.274600982666016 s for the EMDWAVNLM-2.

5 Conclusions

This paper has proposed the ECG signal denoising by the new EMDWAVIT method. This method applies the discrete wavelet transform (DWT) over the intrinsic mode functions and processes their wavelet coefficients by the Viterbi algorithm. Monte Carlo simulations have demonstrated that the EMDWAVIT method outperforms other approaches already established in the literature.

Table 14 ANOVA considering MA and PLI noises for real ECG signals