FPGA-Implementation of Wavelet-based Denoising

0 downloads 0 Views 2MB Size Report
from the ECG signal using Xilinx System Generator for. DSP. It is high-level software tool that enables the use of. Matlab/Simulink environment to create and ...
FPGA-Implementation of Wavelet-based Denoising Technique to Remove Power-Line Interference from ECG Signal Mohammed Bahoura and Hassan Ezzaidi

Abstract— This paper presents a real-time implementation on FPGA of a wavelet-based denoising technique applied to remove power-line interference from ECG signal. The soft-threshold is applied to the wavelet coefficients using the universal threshold estimated in the subband that includes the power-line frequency response. This real-time architecture presents two characteristics: 1) equalization of the filter path delays, and 2) estimation of the noise level from only a few samples. Experimental results show that the proposed architecture remove efficiently the power-line interference from ECG signal.

I. INTRODUCTION The electrocardiogram (ECG) is a graphic representation of the electrical activity of the heart, obtained by placing electrodes at specific locations on the body surface. The ECG remains the most used tool in the diagnosis of cardiovascular diseases. However, ECG records are often corrupted by different types of noises and artifacts such as powerline interference (50/60 Hz), baseline wander, motion artifacts, muscle contraction and instrumentation noise [1]. The power-line noise is characterized by a 50/60 Hz sinusoidal interference noise that make the analysis and interpretation of the ECG more difficult, as the delineation of low-amplitude waveforms becomes unreliable and false waveforms may be introduced [2]. This interference is dues to differences in electrode impedance and leakage currents through the patient body and cables that cannot be suppressed even by an infinite common mode rejection ratio (CMRR) of modern instrumentation amplifiers [3]. Despite the analog hardware solutions that have been developed to reduce this interference by appropriately shielding and grounding, the power-line interference is not significantly reduced [2], [3]. Consequently, digital signal processing methods would inevitably used to remove this interference. Several methods were proposed in the last three decades to remove the power line interference from the ECG signals. These methods have used first the notch filtering, adaptive filtering and to recently the wavelet transform [4]–[6]. The wavelet-based techniques are usually based on the Donoho algorithm [7] that consists to apply a thresholding function to the wavelet coefficients at different scales. The main idea of this algorithm is that the wavelet coefficients with smaller magnitudes than the preset threshold are caused by noise and replaced by zero, and the others with larger amplitudes than M. Bahoura is with the Department of Engineering, University of Quebec at Rimouski, 300, all´ee des Ursulines, Rimouski, Qc, Canada.

Mohammed [email protected] H. Ezzaidi is with the Department of Applied Sciences, University of Quebec at Chicoutimi, 550, boul. de l’Universit´e, Chicoutimi, Qc, Canada.

[email protected]

the preset threshold are caused by the original signal mainly and kept (hard-thresholding case) or shrunk (soft-thresholding case) [8]. Then the denoised signal could be obtained from the resulting wavelet coefficients. In this paper, we implement on FPGA a wavelet-based denoising algorithm to remove the power-line (50/60Hz) from the ECG signal using Xilinx System Generator for DSP. It is high-level software tool that enables the use of Matlab/Simulink environment to create and verify hardware designs for Xilinx FPGAs [9]. II. METHOD A. Principle Donoho [7] proposed an original algorithm to recover a signal x(n) by thresholding the wavelet coefficients of the observed signal y(n). y(n) = x(n) + b(n)

n = 0, . . . , N − 1

(1)

where N is the frame length of the observed signal and b(n) is an additional Gaussian white noise. If the dyadic algorithm proposed by Mallat [10] is used, N must be a power-of-2. The wavelet-based denoising algorithm can be summarized in three steps: • Wavelet transform of the noisy signal, • Thresholding the resulting wavelet coefficients, • Transformation back to obtain the cleaned signal. Donoho and Johnstone [11] define the soft-thresholding function by  if wk > λ  wk − λ wk + λ if wk < −λ TλS (wk ) = (2)  0 if |wk | ≤ λ where λ ≥ 0 is the threshold and wk represents a wavelet coefficient to be thresholded. They proposed a universal threshold λ for the WT : p λ = σ 2 log(N ) (3) with σ = MAD/0.6745, where N is the length of the analyzed signal y(n) and σ is the noise level. MAD is the median absolute deviation estimated using the first level coefficients MAD = median(|w − median(w)|)

(4)

On the other hand, Johnstone and Silverman [12] studied the correlated noise situation and proposed a level–dependent threshold p (5) λj = σj 2 log(N ) with σj = MADj /0.6745 and MADj is the median absolute deviation of the wavelet coefficients, estimated on level j.

Fig. 1.

Flow chart of the proposed real-time denoising algorithm based on a 3-level wavelet decomposition/reconstruction architecture.

Fig. 2. Implementation of the proposed wavelet-based denoising technique (Fig. 1) using Xilinx System Generator blockset. Each operation is identified by e and G, e respectively. Subsystems are detailed in Fig. 3. the label on the block. The blocks LO D, HI D, LO R and HI R correspond to the filters H, G, H

B. Real-time denoising architecture The proposed architecture is based on the Donoho denoising algorithm described in the previous subsection. Because the power-line signal is a narrow-band signal, the noise was estimated using the 2nd level wavelet coefficients that correspond to the frequency band of this signal. This algorithm is reorganized to meet the real-time condition in which the signal is processed sample by sample unlike frame by frame. Fig. 1 presents the flow chart of the proposed real-time architecture, while Fig. 2 presents the real-time implementation using Xilinx system generator blockset. 1) Wavelet decomposition/reconstruction: The proposed wavelet-based denoising technique is based on a 3-level decomposition/reconstruction tree. As shown in Fig. 1, the forward discrete wavelet transform (DWT) uses a pair of lowpass (H) and highpass (G) filters, named also quadrature mirror filter (QMF). However, the inverse wavelet transform (IDWT) e and highpass (G) e filters. Table I uses a pair of lowpass (H) gives the coefficients of the analyis/synthesis filters that are derived from the Daubechies 5 wavelet. They are implemented using the direct-form of the finite impulse response (FIR) filters (Fig. 3).

TABLE I C OEFFICIENTS OF THE FILTERS BASED ON THE DAUBECHIES 5 WAVELET. Tap 0 1 2 3 4 5 6 7 8 9

H 0.003335725285002 -0.012580751999016 -0.006241490213012 0.077571493840065 -0.032244869585030 -0.242294887066190 0.138428145901103 0.724308528438574 0.603829269797473 0.160102397974125

G -0.160102397974125 0.603829269797473 -0.724308528438574 0.138428145901103 0.242294887066190 -0.032244869585030 -0.077571493840065 -0.006241490213012 0.012580751999016 0.003335725285002

e H 0.160102397974125 0.603829269797473 0.724308528438574 0.138428145901103 -0.242294887066190 -0.032244869585030 0.077571493840065 -0.006241490213012 -0.012580751999016 0.003335725285002

e G 0.003335725285002 0.012580751999016 -0.006241490213012 -0.077571493840065 -0.032244869585030 0.242294887066190 0.138428145901103 -0.724308528438574 0.603829269797473 -0.160102397974125

2) Threshold estimator: The universal threshold (Eq. 3) computation is based on the noise level estimation, which is obtained by calculating the MAD (Eq. 4) of the wavelet coefficients at the 2nd level. However, the MAD is usually approximated by median(|w|). We recall that the median value of a set of M data is obtained by: a) sorting the set in ascending order, and b) selecting the value of the middle datum if M is odd, or finding the mean of the two middle data if M is even. As shown in Fig. 3, the threshold estimator block is composed of two sublocks: a) the absolute value subblock that provides the absolute value of the wavelet coefficients

Fig. 3.

Description of the subsystems used in Fig. 2

at the second level, and b) the median value subblock that computes the median of the absolute values of the last M wavelet coefficients at the second level. The median value subblock uses a serial input register to keep the last M samples followed by a parallel sorter [13] that uses a basic subblock to sort adjacent data values (A and B) into high (H) andplow (L). Thus, the threshold is computed by λ = MAD( 2log(N )/0.6745), where N is the size of the used signal frame (N = 4M due to the double down-sampling by 2). 3) Thresholding: Fig. 3 presents an implementation of the soft thresholding function (Eq. 2). The universal threshold is applied to the detail coefficients of each level. 4) Equalization of the filter path delays: To ensure a perfect reconstruction of the DWT-IDWT schema in real-time, the

delay of various filter paths must be equalized. Let τH , e τG , τHe and τGe the group delays of the filters H, G, H e respectively. The delay of each path is obtained by and G, summing the delays of the cascaded filters using the Noble identities [14]. When using filters based on the Daubechies 5 wavelet, τH + τHe = τG + τGe = 9. In this case, τ1 = τ2 = 0 and the overall delay is given by τ = 7(τH + τHe ) = 63. By equalizing the four paths, one can deduce τ3 = 9 and τ4 = 27. Each path delay is divided on two quasi-equal parts placed before and after the thresholding block (Fig. 2). III. E XPERIMENTS AND R ESULTS The proposed architecture was implemented on FPGA using Xilinx System Generator for DSP and XUP Virtex-II Pro development board. The analysis/sysnthesis filters are based

Fig. 5. Results of the wavelet-based denoising architecture obtained with real ECG signal corrupted by power-line (50 Hz). The corrupted signal y[n] is given on top, followed by the filtered output x b[n] for various median data length. Fig. 4. Results of the wavelet-based denoising architecture obtained with artificial ECG signal corrupted by a 60 Hz sine wave. The original signal x[n] is given on top, followed by the noised version y[n] and the filtered output x b[n] for various median data length.

on an orthogonal wavelet (Daubechies 5). Coefficients and group delays of the used filters are computed using wfilters and grpdelay functions of Matlab. Fig. 4 presents the results obtained with artificial ECG signal corrupted by additional 60 Hz sine wave, while Fig. 5 presents the ones obtained by real ECG signal contaminated by the power-line (50 Hz) during recording. Both signals are sampled at 360 Hz. Except for the convergence period, the noise was efficiently removed. However, this method cause insignificant pseudo-Gibbs phenomena in Q and R waves that can be suppressed by translation-invariant wavelet denoising algorithm [8]. The denoising performances are not affected by the median data length. It can be noted the delay of 63 samples between the output x b(n) and the input y(n). IV. CONCLUSION A real-time wavelet-based denoising technique was implemented on FPGA to remove power-line from ECG signal. Very interesting results are obtained with the soft-thresholding function using a standard threshold estimated on the wavelet coefficient subband that includes the power-line frequency response. In the future, more advanced methods for estimating the noise level will be implemented and tested on real and artificial ECG signals. R EFERENCES [1] Y. Wu, R. M. Rangayyan, Y. Zhou, and S. C. Ng, “Filtering electrocardiographic signals using an unbiased and normalized adaptive noise reduction system,” Medical Engineering & Physics, vol. 31, no. 1, pp. 17–26, 2009.

[2] L. S¨ornmo and P. Laguna, “Electrocardiogram (ECG) Signal Processing,” in Wiley Encyclopedia of Biomedical Engineering, M. Akay, Ed. Wiley, 2006, vol. 2, pp. 1298–1313. [3] C. Levkov, G. Mihov, R. Ivanov, I. Daskalov, I. Christov, and I. Dotsinsky, “Removal of power-line interference from the ecg: a review of the subtraction procedure,” BioMedical Engineering OnLine, vol. 4, no. 1, p. 50, 2005. [4] P. E. Tikkanen, “Nonlinear wavelet and wavelet packet denoising of electrocardiogram signal,” Biological Cybernetics, vol. 80, no. 4, pp. 259–267, 1999. [5] E. Ercelebi, “Electrocardiogram signals de-noising using lifting-based discrete wavelet transform,” Computers in Biology and Medicine, vol. 34, no. 6, pp. 479–493, 2004. [6] S. Poornachandra, “Wavelet-based denoising using subband dependent threshold for ECG signals,” Digital Signal Processing, vol. 18, no. 1, pp. 49–55, 2008. [7] D. L. Donoho, “Nonlinear wavelet methods for recovering signals, images, and densities from indirect and noisy data,” Proceedings of Symposia in Applied Mathematics, vol. 47, pp. 173–205, 1993. [8] L. Su and G. Zhao, “De-noising of ECG signal using translationinvariant wavelet de-noising method with improved thresholding,” in Engineering in Medicine and Biology Society, 2005. IEEE-EMBS 2005. 27th Annual International Conference of the, 1-4 Sept. 2005, pp. 5946 –5949. [9] M. Bahoura and H. Ezzaidi, “FPGA-implementation of a sequential adaptive noise canceller using Xilinx System Generator,” in Proceedings of the 21th IEEE International Conference on Microelectronics (ICM’09), 19-22 dec. 2009, pp. 213 –216. [10] S. Mallat, “A Theory for Multiresolution Signal Decomposition: The Wavelet Representation,” Pattern Analysis and Machine Intelligence, IEEE Transactions on, vol. 11, pp. 674–693, July 1989. [11] D. L. Donoho, “De-noising by soft-thresholding,” IEEE Trans. Inform. Theory, vol. 41, pp. 613–627, May 1995. [12] I. M. Johnstone and B. W. Silverman, “Wavelet threshold estimators for data with correlated noise,” J. Roy. Statist. Soc. B, vol. 59, pp. 319–351, 1997. [13] J. Martinez, R. Cumplido, and C. Feregrino, “An FPGA-based parallel sorting architecture for the Burrows wheeler transform,” in Proceedings of the 2005 International Conference on Reconfigurable Computing and FPGAs, 7 pp., 2005. [14] Signal Processing Blockset 7 User’s Guide. Natick, MA: The MathWorks, Inc., 2010.