Combinations of Different FIR Windows for Removal of Baseline and Power Line Noise from Electrocardiogram

Electrocardiogram (ECG) is a vital tool used for diagnosing various heart diseases. It is the graphical representation of the electrical activity of the heart. But the electrocardiographic signals are often corrupted by noise from diverse sources. The most significant noises that corrupt ECG signal are power line interference and baseline wanders. It is necessary to reduce the amount of these disturbances from ECG signal for proper identification and interpretation of heart condition. This paper investigates the performance of the different 'Band stop filter-High Pass filter' combinations of window based FIR filter for removing the baseline wander and power line noise present in electrocardiogram. The ECG signal is generated and then noises are added to the ECG signal using MATLAB® where filters are designed and analyzed using Filter Design and Analysis Tool (FDATool). 49 different 'Band stop filter-High Pass filter' combinations are made using seven different FIR windows namely Bartlett, Chebyshev, Hamming, Hann, Kaiser, Rectangular, Triangular. For filter order of 350 and 450, the performance of different window combinations are compared and analyzed in terms of Signal power, Peak-to-peak value, Signal to Noise Ratio (SNR) and Mean Square Error (MSE) of the filtered output. A further analysis of the waveforms of the filtered output show that the combinations where both the bandstop and highpass filters are either Kaiser or Rectangular window i.e. Kaiser-Kaiser, Kaiser-Rectangular, Rectangular-Kaiser and Rectangular-Rectangular windows give the best performance in reducing both the baseline noise and high frequency power line noise. It is also found that the reduction of baseline noise is better if 450 filter order is used instead of 350 order in the above mentioned best four combinations, although the amount of delay for 450 order is slightly higher.


Introduction
Electrocardiogram (ECG), a very common test to check heart's functionality, is the process of measuring electrical activity of one's heart.ECG looks at the heart's rhythm and rate to confirm or rule out any possible heart disease of a patient with cardiovascular complaints.A significant number of patients with severe cardiac symptoms are treated in the emergency room (ER) and in the intensive care unit (ICU).In those cases, the need of an early and accurate diagnosis as well as rapid and appropriate therapy reinforce the importance of electrocardiography.But the ECG signal can be corrupted with various types of high and low frequency noises and the most critical of them are the interference from power line distribution (50/60 Hz frequency) and baseline wanders (typically less than 1 Hz frequency).So removal of these noises is a challenge for proper diagnosis of heart diseases.Various methods were developed for the elimination of different types of noises existing in the ECG signal during the last two decades.
Kaiser window based FIR digital filter was used by Mbachu et al. for denoising ECG signal (Mbachu, Onoh, Idigo, Ifeagwu & Nnebe, 2011).In this work high pass and low pass filters were designed using kaiser window for the removal of low frequency noise (baseline wander) and high frequency noise (more than 100 Hz) respectively, whereas the Kaiser window based notch filter was designed for eliminating power line noises.The sampling frequency of the ECG signal was 1000 Hz and the order of the used filter was 100.All three filters were also cascaded at the end for removing all the noises together.Rao et al. considered various filters and evaluated Signal to Noise Ratio (SNR), Power Spectral Density (PSD), Mean Square Error (MSE), where Kaiser Window showed the best result (Rao & Usharani, 2013).The filters designed with 300 order show the best outcome in comparison to the filter of order 450 and 600.Ahmad et al. used window based FIR filtering algorithms (Ahmad, Ansari & Dey, 2015).In this work, the filter order of 500 was designed and using the band stop filters with bandwidth of 48-52 Hz the authors showed that, the Kaiser window based filter outperforms the rest of window based filters by giving lowest MSE and highest SNR.Various windows like Gaussian window, Kaiser window, Blackman Harris window and Blackman window are used by Chinchkhede et al. for developing the FIR filter for noise reduction from ECG and their performances are compared in terms of output SNR and correlation (chinchkhede, Yadav, Hirekhan & Solanke, 2011).Chandrakar et al. studied the performance of FIR filter based on different windows and IIR filter for removing the artifacts from ECG signal and found that window based FIR filters perform better than IIR (Chandrakar, Yadav & Chandra, 2013).The FIR filter with Kaiser window was found to be more effective in denoising with less distortion in the waveform, whereas Rectangular window distorts the waveform much resulting in inappropriate diagnosis.Mittal et al. observed Hamming, Kaiser and Chebyshev windows and compared the waveforms where Chebyshev window showed best outcome providing the highest Signal-to-Noise Ratio (SNR) at the order of 100 (Mittal & Rege, 2015).FIR type -I filter and Butterworth IIR filter were introduced by Kumar et al. for elimination of ECG noise (Kumar, Ahmad & Rai, 2012).J. A. Van Alste proposed that the power line noise and baseline wander in ECG can be removed by linear phase filtering (Alste & Schilder, 1985).The method based on NR (Non Recursive) FIR filtering reduced filter coefficients without losing the spectral properties.Kadam et al. designed equiripple FIR filter for eliminating power line frequency component (Kadam & Bhaskar, 2012).Elliptical digital filter was designed by Chavan et al. and it is shown that the introduced filter works better than chebyshev type I, II and butterworth (Chavan, Agrawala & Uplane, 2005).Notch filter and Band Pass filter were used by Kasar et al. for reducing power line noise and base line wander (Kasar, Mishra & Joshi, 2014).The authors used Band Pass filter and Notch filter in this work to remove baseline wander and power line interference and compared the performance of both the filters in terms of SNR It is found that Notch filter performs better than Band Pass filter for denoising the ECG.
In this paper, the combinations of Band stop filter (to remove power line noise) and High Pass filter (to remove Baseline noise) based on seven different FIR windows (total 49 different combinations) are investigated to find out the best combinations for removing the Baseline and power line noise from corrupted ECG signal.Filter order of 350 and 450 are used for performance investigation.After applying the Band Stop-High Pass filter combinations to the noisy ECG, four parameters namely signal power, Peak to peak value, SNR and MSE are measured and calculated from the filtered output and using these parameters at first 14 combinations from 49 are identified that performs better.Finally, the best 4 combinations are found out analyzing the noisy and filtered output waveforms.

Methodology
At first an electrocardiogram (ECG) signal having amplitude of 1.2 mV is generated in MATLAB with a sampling frequency of 1 kHz.The duration of the generated ECG signal is 10 seconds.The Power Line noise is generated as a 50 Hz sinusoidal signal with amplitude of 0.03 mV.The Baseline noise has one sine and one cosine wave component at frequencies of 0.20 Hz and 0.30 Hz and the amplitudes of the waves are 200 and 250 micro-volts respectively.These two noises are added to the ECG signal.

Results and Analysis
The signal power of the original ECG signal (without noise) is -12.87 dB and the Peak-to-Peak value is 1.786 mV.
As mentioned earlier, 7 types of FIR window are used in this work to remove the baseline wander and powerline noise and using these windows, either as band stop filter or as high pass filter, 49 combinations are made.The noisy ECG signal is passed through different window combinations and different signal parameters namely the Signal power, Peak to Peak value, Signal to Noise Ratio (SNR), Mean Square Error (MSE) of the filtered output are measured and calculated.For filter order of 350 and 450, the values of all these parameters are listed in Table 1 to Table 7.  ii) the Peak-to-Peak value of the filtered output is close to the original ECG Peak-to-Peak value (1.786 mV) iii) the SNR of the filtered output is higher and iv) the MSE of the filtered output is smaller.By analyzing the data from Table 1 to Table 7 it can be said that all the combinations that use Kaiser or Rectangular window, either as band stop or high pass, provide better results.These 14 combinations are highlighted as bold in the tables.
Figure 4 to figure 10 illustrate the removal of noise using these 14 combinations for 350 filter order.It can be seen from the figures that the baseline noise is almost removed (the base of the filtered output signal is shifted close to the base of the original signal) by all 14 combinations, but the high frequency power line noise is still present in the filtered output for most of the combinations except for the combinations where both the bandstop and highpass filters are either Kaiser or Rectangular window i.e.Kaiser-Kaiser (figure 8), Kaiser-Rectangular (figure 8), Rectangular-Kaiser (figure 9) and Rectangular-Rectangular (figure 9) windows show the best performance in removing both the baseline noise and high frequency power line noise.
Figure 11 and figure 12 show that if 450 filter order is used instead of 350 order in the above mentioned best four combinations the baseline noise is almost completely removed.However, the amount of delay for 450 order is a little higher than for 350 order.From the above analysis, it can be concluded that the best results in reducing the baseline wander and power line noise are obtained using the FIR window combinations where both the bandstop and highpass filters are either Kaiser or Rectangular window having filter order of 450.

Conclusion
This paper investigates the performance of the different 'Band stop filter-High Pass filter' combinations based on seven different FIR windows for removing the baseline wander and power line noise from the corrupted ECG signal.The filters are designed with the order of 350 and 450.The high pass filter has cut-off frequency of 1.5 Hz and the band stop filter has cut-off frequency between 48.5 Hz to 51.5 Hz. 49 distinct 'Band Stop-High Pass' filter combinations are made using seven different FIR windows and applied to the noisy ECG.For all the combinations, four parameters namely signal power, peak to peak value, SNR and MSE are calculated from the filtered output and evaluating these parameters at first 14 combinations are identified that give better performances.After analyzing the filtered output signal for a filter order of 350 it is found that the baseline noise is mostly removed by all 14 combinations, but the high frequency power line noise is present in the filtered output for all the combinations except for the combinations where both the bandstop and highpass filters are either Kaiser or Rectangular window i.e.Kaiser-Kaiser, Kaiser-Rectangular Rectangular-Kaiser and Rectangular-Rectangular windows show the best performance in reducing both the baseline noise and high frequency power line noise.A further analysis show that if filter order of 450 is used instead of 350 order in the best four combinations, the baseline noise is almost completely reduced and an acceptable signal waveform is found.However, the amount of delay for 450 order is slightly higher than for 350 order.
The generated original ECG signal and noisy ECG signal are shown in figure1 and baseline noise and power line noise are illustrated in figure1and figure 2 respectively.Filter Design and Analysis Tool (FDATool) in MATLAB is used to design the following FIR window based filter.Window To remove the Power Line interference band stop filter (based on above mentioned window) with cut off frequency between 48.5 to 51.5 Hz and to remove the Baseline noise the High pass filter (based on above mentioned window) with cut off frequency 1.5 Hz are used.Two different filter orders of 350 and 450 are applied.The Signal Processing Tool (SPTool) of MATLAB is used to analyze the signals.The noisy signal is passed through different FIR window combinations and the filtered outputs are found.Then these signals are exported in MATLAB workspace for further analysis.The block diagram of the step by step methodology is shown in figure 3.

Figure 1 .
Figure 1.Generated original ECG signal and Noisy ECG (corrupted by Baseline and Powerline noise), Baseline noise is illustrated

Figure 3 .
Figure 3. Step by step Methodology

Table 2 .
Values of different signal parameters using the combinations of Chebyshev window (as Bandstop filter) with other windows (as highpass filter) for filter order of 350 and 450

Table 5 .
Values of different signal parameters using the combinations of Kaiser window (as Bandstop filter) with other windows (as highpass filter) for filter order of 350 and 450

Table 7 .
Values of different signal parameters of the filtered output using the combinations of Triangular window (as Bandstop filter) with other windows (as highpass filter) for filter order of 350 and 450 Among the 49 combinations listed in Table-1 to Table-7 the better combinations are those for which the following results are obtained: i) the signal power of the filtered output is close to the original ECG signal power(-12.87dB)

Table 7
summarizes the performances of the best four window combinations i.e.Kaiser-Kaiser, Kaiser-Rectangular, Rectangular-Kaiser and Rectangular-Rectangular for filter order of both 350 and 450.From this table it can seen that for 450 filter order these four combinations give maximum SNR, minimum MSE and Peak to Peak value of the filtered output become close to the original ECG.

Table 7 .
Performance of the best four FIR window combinations in terms of Peak to Peak value, SNR and MSE for filter order of 350 and 450