Skip to main content
NIHPA Author Manuscripts logoLink to NIHPA Author Manuscripts
. Author manuscript; available in PMC: 2011 Jul 12.
Published in final edited form as: Comput Cardiol (2010). 2010 Sep 26;37:489–492.

A Comparison of IIR and Wavelet Filtering for Noise Reduction of the ECG

JS Sørensen 1,2, L Johannesen 1,2, USL Grove 1,2, K Lundhus 1,2, J-P Couderc 2, C Graff 1
PMCID: PMC3134259  NIHMSID: NIHMS302673  PMID: 22068831

Abstract

This study compares the ability to preserve information and reduce noise contaminants on the ECG for five wavelet filters and three IIR filters. Two 3-lead Holter ECGs were used. White Gaussian Noise was added to the first ECG in increments of 10% coverage. The second ECG contained alternating muscle transients and noise-free segments. Computation times and SNR improvements for different noise coverages were calculated and compared. RMS errors were calculated from noise-free segments on the ECG with transient muscle noise. Wavelet filters improved SNR more than IIR filters when the signal coverage was more than 50% noise. In contrast, the computation times were shorter for IIR filters (6 s) than for wavelet filters (88 s). On the ECG with transient muscle noise there was a trade-off in performance between wavelet and IIR filtering. In a clinical setting where the amount of noise is unknown, using IIR filters appears to be preferred for consistent performance.

1. Introduction

The electrocardiogram (ECG) is routinely used to diagnose cardiac patients. However, noise contamination of the ECG such as baseline wander, power line interference and muscle activities can pollute the ECG and reduce the clinical value of an ECG tracing. Consequently, filtering of the ECG is a necessary pre-processing step to ensure a reduction of these polluting components while providing an appropriate conservation of the signal information relevant for clinicians. This task remains a challenge of modern quantitative electrocardiography and while American Heart Association (AHA) has defined standard filtering requirements for clinical ECG equipment [1], there is a continuous incentive to develop better methods to improve signal-to-noise ratio of the ECG.

Baseline wander and power-line noise both have confined power spectra making the use of narrowband linear time-invariant filters ideal. However, muscle interferences generate non-stationary noise with spectral overlap with the normal ECG waves, thus complicating the de-noising task [2]. Wavelet transformations have been proposed as a filtering option to remove muscle interferences [35], but these studies have been limited to one or two wavelet function families. In this study, we investigate five different families of wavelet filtering techniques using threshold-based methods reported by Donoho and Johnstone [6]. We evaluate the wavelet functions and the thresholding definitions on ECGs with real and simulated noise. Importantly, the computation time was also considered since this is an important factor when applying the filters to long-term ECG recordings, e.g. 24-hour Holter.

2. Methods

2.1. ECG data

A 24-hour Holter recording was randomly selected from the Telemetric and Holter ECG Warehouse (THEW) from the Healthy database (E-HOL-3-201-003) [7]. A recording with a sample rate of 200 Hz, and was recorded using 3 pseudo-orthogonal leads. Lead X was used.

A signal with simulated noise was created by visually identifying a noise-free interval (21 seconds), and adding simulated white noise. The interval was selected to begin and end between cardiac beats (between the T- and P-wave) as illustrated in figure 1. The average heart rate in this interval was 88 beats per minute. The noise-free interval was repeated to achieve a length equal to 24-hour Holter recordings. This length was chosen to estimate the computation time and get a consistent estimate of the added noise.

Figure 1.

Figure 1

A noise free interval was identified in a 24-hour Holter recording.

In another recording an interval with transient muscle activity was visually identified (140 seconds). Part of this signal is illustrated in figure 2. The average heart rate was 78 beats per minute. This interval was used to evaluate the filters on a recording with real transient muscle activity.

Figure 2.

Figure 2

Part of the recording with transient muscle noise.

2.2. Performance measures

Two segments were defined in a recording with simulated muscle noise components: a non-noise and noise segment, as illustrated in figure 3.

Figure 3.

Figure 3

Addition of non-stationary white gaussian noise gives rise to two segments: non-noise and noise. In this case the coverage is 50%, and the SNR was 15 dB.

In the noise segment white Gaussian noise with constant mean and variance was added and the signal to noise (SNR) improvement after filtering was calculated as:

SNR=10log10n=0Nx[n]2n=0N(xdn[n]x[n])2

where x[n] is the simulated signal before noise is added and xdn[n] is the filtered signal with added noise. The initial SNR in the noise segment was 15 dB. The length of the noise segment was varied to simulate different amounts of noise. By changing the length of the noise segment, the noise coverage of the simulated recording was changed. Coverages were varied between 10 and 100% in increments of 10% of the total length of the simulated recording.

The root mean square error (RMSE) was calculated in the non-noise segment, to quantify how well the information of the signal was preserved. The RMSE was defined by:

RMSE=n=0N(xdn[n]x[n])2N

For each amount of coverage, the ECG with simulated noise was filtered using the Symmlet 8 (used in illustrations), Daubechies 4, Coiflets 4, Bior 3.5 and Haar mother wavelets. The soft and hard thresholding methods were used as well as the thresholding method proposed by Su and Zhao [3], which combines the soft and hard thresholding methods. For each thresholding method the discrete wavelet transform (DWT) and the stationary wavelet transform (SWT) were used. The decomposition level of the wavelet transform was kept constant at 6 (100 to 1.56 Hz) to cover the frequency spectrum of the ECG. Then we evaluated how the choice of mother wavelet affected the SNR and RMSE, and separately the effect of thresholding method and wavelet transformation. As a reference, the performance of the wavelet filters was compared with low-pass bidirectional IIR filters having cutoff frequencies of 35, 45 and 55 Hz and order 5.

The computation time on the 24-hour Holter recording was calculated on an Intel Core2 Duo T9600, 2.80 GHz, 6 MB cache with 4GB DDR3 1067 MHz RAM running MATLAB R2009b (Mathworks Inc, Natick, MA) with the signal processing and wavelet toolbox.

Ideally, the output of the optimal filter has a perfect noise removal, no distortion and low computation time. This criterion was used to select one wavelet filter and one IIR filter to be used on the ECG with transient muscle activity. For this signal the RMSE of the non-noise and noise segment were calculated using the selected wavelet and IIR filters.

3. Results

The computation time on a 24-hour Holter recording was 6 seconds for the IIR filters, 88 seconds using the DWT and 272 seconds using the SWT.

The panel A of figure 4 shows how the choice of IIR and wavelet filters can affect the improvement in SNR across noise coverage. Thresholding of wavelet coefficients was done using the method proposed by Su and Zhao [3].

Figure 4.

Figure 4

Panel A: Improvement in SNR as a function of noise coverage. Panel B: ECG beat before and after filtering with Symmlet 8 at 90% coverage. Panel C: The same beat at a coverage of 20%.

The SNR improvements for IIR filters were constant across noise coverage. An IIR filter with a cutoff frequency of 45 Hz had the best SNR improvement (3.1 dB). The performance of the wavelet filters depended on the noise coverage. At a low coverage the wavelet filters: Daubechies 4, Symmlet 8, Coiflets 4 and Bior 3.5 were outperformed (1 dB at 10%) by the IIR filters. At higher coverages (above 50%) these wavelet filters outperformed the IIR filters (2.5 dB at 100%). The Haar wavelet performed better than the IIR filters regardless of coverage but Haar was outperformed by the other wavelet filters when noise coverage exceeded 60%. In figure 4, beats extracted from the noise segment at 90% (panel B) and 20% (panel C) coverages are shown. At low coverage the filter did not remove the added noise. However, as the coverage increased the wavelet filter removed the noise.

Figure 5, panel A, shows how the choice of wavelet affects RMSE across coverage.

Figure 5.

Figure 5

Panel A: RMSE as a function of noise coverage. Panel B: An ECG beat before and after filtering with Symmlet 8 at 90% coverage. Panel C: The same beat at a coverage of 20%.

The IIR filter with a cutoff frequency of 55 Hz had the lowest RMSE of 1.2. The RMSE of the Daubechies 4, Symmlet 8, Coiflets 4 and Bior 3.5 wavelets had linear trends (RMSE ≈ 0.85 at 10% and RMSE ≈ 2.25 at 90%). The Haar wavelet had a constant RMSE up to 40% coverage after which a linear increase to 4 was seen at 90% coverage. As illustrated by the Symmlet 8 wavelet in figure 5, filtering preserved the signal information at 20% coverage, while the PR and ST-segment were distorted at 90% coverage.

Figure 6 shows how the choice of thresholding techniques and wavelet transformations affected the improvement in SNR.

Figure 6.

Figure 6

Improvements in SNR for different coverages and thresholding methods.

Thresholding using the DWT and SWT had similar performance trends across coverages but the SWT gave better SNR improvements compared to the DWT, figure 6. There was practically no difference between hard thresholding and the method proposed by Su and Zhao [3]. Soft thresholding performed best between 10 and 50% coverage. Above 50% coverage, the performance for soft thresholding started to decrease.

Figure 7 supports these findings as the RMSE of the soft thresholding increased more rapidly when reaching about 50% noise coverage. The DWT and SWT again showed similar trends with the DWT having the largest RMSE.

Figure 7.

Figure 7

RMSE in the non-noise segment for different coverages and thresholding methods.

The ECG with alternating muscle transients was filtered using the IIR filter with a cutoff frequency of 55 Hz, and using the Coiflet 2 wavelet (SWT) with a hard threshold. These two were selected as they were found to be associated the best performance. The coverage of the recording was 45.3%. The RMSE of the noise and non-noise segments for the IIR filter were 1.17 and 0.72 respectively, and 1.46 and 0.93 for the wavelet filtering.

4. Discussion and conclusions

Filtering is an important step in the processing of the surface ECG signal. This study investigated some of the different factors influencing threshold based wavelet de-noising of the ECG and compared the performance of these filters with IIR filters.

We demonstrated that the performance of wavelet filtering is affected by how much of the signal is covered by noise. At low coverage, the IIR filters removed noise better than the wavelet filters. On the other hand at high coverage the wavelet filters have the best noise reduction because the threshold estimation improves. However, it is important to note that there is a trade-off between preservation of signal information and noise reduction for the wavelet filters. If a wavelet filter has a high noise reduction it will also have a reduced ability to preserve the signal information.

If wavelet filtering is used it is also important to choose the proper thresholding technique and wavelet transformation. Our results suggest that the hard thresholding method and the method proposed by Su and Zhao [3] both can be used as they have similar filter performances. Soft thresholding should not be used, if the coverage of the signal exceeds about 70%. In this case the estimated threshold becomes too large resulting in a significant shrinkage of the wavelet coefficients, which in turn results in distortion of the ECG morphology. However, for coverage values below 50% the soft thresholding performs better than the hard thresholding method and the method proposed by Su and Zhao [3]. The latter method combines hard and soft thresholding methods but our results indicate that this was not optimal either. It is possible that the combination factor which is used in this technique to combine the hard and soft thresholding methods was not optimal. This value was set to 15 as suggested by Su and Zhao [3].

Our results also indicated a considerable computational time difference between the SWT, DWT and IIR filters. This difference could be partially attributed to the algorithm implementation. The large difference between the wavelet transforms and the IIR filters could be reduced by another implementation e.g. in C/C++. However, as the SWT is a redundant transformation the computation will always be considerable longer than for the DWT or IIR filtering. Finally, our results also showed that the choice of mother wavelet does not have a critical effect on the performance of the wavelet filtering.

The results of RMSE calculations on the ECG with transient muscle activity revealed that the wavelet filtering had a slightly better performance in the noise segments compared to the IIR filters. This result would appear to favor wavelet filters but wavelet filtering also distorted the clean part of the signal more than IIR filters so the choice of filter depends on the setting. Noise coverage appears to be important for the performance of wavelet filters and in a 24-hour Holter recording, muscle noise might only be present in a small fraction of a recording. In this case an IIR performs better than a wavelet filter. In addition, the IIR filter is computationally more efficient, and we believe that IIR filters are a good option for general purpose ECG filtering.

Acknowledgments

Data used for this research was provided by the Telemetric and Holter ECG Warehouse (THEW) of the University of Rochester, NY, USA.

References

  • 1.Kligfield P, Gettes L, Bailey J, et al. Recommendations for the Standardization and Interpretation of the Electrocardiogram. J Am Coll Cardiol. 2007;49:276–281. doi: 10.1016/j.jacc.2007.01.024. [DOI] [PubMed] [Google Scholar]
  • 2.Sornmo L, Laguna P. Bioelectrical Signal Processing in Cardiac and Neurological Applications. 2. Elsevier Science and Technology Books; 2005. pp. 453–485. [Google Scholar]
  • 3.Su L, Zhao G. De-Noising of ECG Signal Using Translation-Invariant Wavelet De-Noising Method with Improved Threshold. Conf Proc IEEE Eng Med Biol Soc. 2005;7:5946–5949. doi: 10.1109/IEMBS.2005.1615845. [DOI] [PubMed] [Google Scholar]
  • 4.Muralidhar GUM, Varadarajan S. ECG De-Noising using improved thresholding based on Wavelet transforms. Int J Inf Comput Secur. 2009;9(9):221–225. [Google Scholar]
  • 5.Alfaouri M, Daqrouq K. ECG Signal Denoising By Wavelet Transform Thresholding. Am J Appl Sci. 2008;5:276–281. [Google Scholar]
  • 6.Donoho D, Johnstone I. Ideal spatial adaptation by wavelet shrinkage. Biometrika. 1994;81:425–455. [Google Scholar]
  • 7.Couderc JP. The Telemetric and Holter ECG Warehouse Initiative (THEW): a Data Repository for the Design, Implementation and Validation of ECG related Technologies. Conf Proc IEEE Eng Med Biol Soc. 2010:6252–6255. doi: 10.1109/IEMBS.2010.5628067. [DOI] [PMC free article] [PubMed] [Google Scholar]

RESOURCES