Investigation of Adaptive Filtering for Noise Cancellation inECG signals

0 downloads 0 Views 220KB Size Report
always contaminated by a drift and interference caused by several bioelectric ... Adaptive Filters for noise cancellation and analysis ECG signals. Keywords: ...
Second International Multisymposium on Computer and Computational Sciences

Investigation of Adaptive Filtering for Noise Cancellation in ECG signals Soroor Behbahani Biomedical Engineering Department, Science and Research Branch, Islamic Azad University, Tehran, Iran. Member of Young Researcher Club of Biomedical Engineering Department, Science and Research Branch, Islamic Azad University, Tehran, Iran. [email protected] standard approach is to make use of several noisy signals by recording from the same source. This consists of using a number of noise cancellation systems in parallel with one primary input to each system [1]. The estimated signal is obtained by selecting the best one in the sense of some criterion from the multi-channel output signal [5]. Adaptive Filters are best used in cases where signal conditions or system parameters are slowly changing and the filter is to be adjusted to compensate for this change. The least mean squares (LMS) criterion is a search algorithm that can be used to provide the strategy for adjusting the filter coefficients. A number of adaptive structures have been used for different applications in adaptive filtering: 1. Noise Cancellation. Figure 1 shows the adaptive structure modified for a noise cancellation application. The desired signal d is corrupted by uncorrelated additive noise n. The input to the adaptive filter is a noise nƍ that is correlated with the noise n. The noise nƍ could come from the same source as n but modified by the environment. The adaptive filter’s output y is adapted to the noise n. When this happens, the error signal approaches the desired signal d. The overall output is this error signal and not the adaptive filter’s output y.

Abstract New generation of medical treatment has been supported by computerized processes. Signals recorded from the human body provide valuable information about the biological activities of body organs. The organs’ characteristic topologies with temporal and spectral, properties, can be correlated with a normal or pathological function. In response to dynamic changes in the behavior of those organs, the signals exhibit timevarying, non-stationary responses. The signals are always contaminated by a drift and interference caused by several bioelectric phenomena, or by various types of noise, such as intrinsic noise from the recorder and noise from electrode-skin contact. In this paper we utilize Adaptive Filters for noise cancellation and analysis ECG signals. Keywords: Adaptive Filter, Noise Cancellation, ECG Signal, Matlab Program

1. Introduction Biomedical signals like heart wave commonly change their statistical properties over time tending to be non-stationary. Unfortunately there is no universal method to reduce noise because the probability distributions of noise are different [7, 13]. Noise cancellation is a special case of optimal filtering which can be applied when some information about the reference noise signal is available. The noise cancellation technique has many applications, e.g. speech processing, echo cancellation and enhancement, antenna array processing, biomedical signal and image processing and so on[1-4]. The standard methods of noise cancellation use only one primary signal [1]. However, in many applications, especially in biomedical signal processing, we are able to measure several primary signals. Often this possibility can help to improve the performance of noise cancellation procedure. The

0-7695-3039-7/07 $25.00 © 2007 IEEE DOI 10.1109/IMSCCS.2007.77

Figure 1.Adaptive Filter structure for noise cancellation 2. System Identification. Figure 2 shows an adaptive filter structure that can be used for system identification or modeling. The same input is to an unknown system in parallel with an Adaptive Filter. The error signal e is the

144

difference between the response of the unknown system d and the response of the adaptive filter y. This error signal is feed back to the adaptive filter and is used to update the Adaptive Filter’s coefficients until the overall output y = d. When this happens, the adaptation process is finished, and e approaches zero. In this scheme, the Adaptive Filter models the unknown system.

only two weights or coefficients. This structure is shown in Figure 4 . (b) Adaptive channel equalization used in a modem to reduce channel distortion resulting from the high speed of data transmission over telephone channels. The LMS is well suited for a number of applications, including adaptive echo and noise cancellation, and prediction. Other variants of the LMS algorithm have been employed, such as the sign-error LMS, the sign-data LMS, and the sign-sign LMS. 1. For the sign-error LMS algorithm, the equation will be

wk (n 1) wk (n)  E sgn[e(n)]x(n  k) (1) where sgn is the signum function,

Figure 2. Adaptive Filter structure for system identification

2. For the sign-data LMS algorithm, the equation will be

The LMS is well suited for a number of applications including adaptive echo and noise cancellation, equalization, and prediction. Other variants of the LMS algorithm have been employed, such as the sign-error LMS, the sign-data LMS, and the sign-sign LMS. The LMS algorithm has been quite useful in adaptive equalizers, telephone cancellers, and so forth. Other methods, such as the recursive least squares (RLS) algorithm [6], can offer faster convergence than the basic LMS but at the expense of more computations. 3. Adaptive predictor. Figure 3 shows an adaptive predictor structure which can provide an estimate of an input.

wk (n 1) wk (n)  Ee(n)sgn[x(n  k)]

(2)

For the sign-sign LMS algorithm, (1) becomes

wk (n 1) wk (n)  E sgne(n) sgn[x(n  k)]

(3)

2. Adaptive Noise Cancellation When doctors are examining a patient on-line and want to review the electrocardiogram (ECG) of the patient in realtime, there is a good chance that the ECG signal has been contaminated by a 60-Hz noise source. To allow doctors to view the best signal that can be obtained, we need to develop an adaptive filter to remove the contaminating signal in order to better obtain and interpret the ECG data.

Figure 3. Adaptive predictor structure. 4. Additional structures have been implemented, such as: (a) Notch with two weights, which can be used to notch or cancel/reduce a sinusoidal noise signal. This structure has

Figure 4. Adaptive predictor structure.

145

(6)

The LMS adaptive filter written with use of MatLab functions designed to remove the contaminating signal, as shown in Fig. 5. The ECG signal, s is the original uncontaminated input signal of program. The desired output is the contaminated ECG signal t. The Adaptive Filter will do its best to reproduce this contaminated signal but it only knows about the original 60 Hz noise source, v. Thus, it can only reproduce the part of t that is linearly correlated with v, which is m. In effect, the Adaptive Filter will attempt to mimic the noise path filter, so that the output of the filter a will be close to the contaminating noise m. In this way the error e will be close to the original uncontaminated ECG signal s. We call (s+m) the primary input and a the reference signal.

b(k  1) b(k )  2D.e(k ) Where,

W ( K ) [1w( k ) 2 w( k )... i w( k ) ]T is a set of filter weights at time k, and row of the weight matrix. And

P T (k )

2

2

(m a)  s  2.sm 2.s.a

is the ith

[1 p ( k ) 2 p ( k )... i p ( k ) ]T

is the input vector at time k of the samples from the reference signal. The error is :

Since the Adaptive Filter output is a and the error is, then the mean , then the mean square error (MSE) is:

e2 ((s  m)  a)2 (s  m)2  2.(s  m).a  a2

(7)

e(k)=t(k)-a(k)=(s(k)+m(k))-a(k) where t is the desired primary input from the ECG to be filtered, and a(k) is the filter output that is the best least squared estimate of t(k). For simplicity, we use a single sine wave noise source.[15]

(4)

Since signal and noise are uncorrelated, the MSE is:

E [e 2 ]

3. EXPERIMENTAL RESULTS

E [( m  a ) 2 ]  E [ s 2 ] (5)

3.1 Matlab program

Minimizing the MSE results in a filter error that is the best least squares estimate of the signal s. The Adaptive Filter extracts the signal, or eliminates noise, by iteratively minimizing the MSE between the primary and the reference inputs [15].

First of all, we must define the noise signal v, the ECG signal s and the filtered noise m. We will assume: the ECG signal is a white (uncorrelated from one time step to the next) random signal, and the noise source is a 60-Hz sine wave. The “error” signal e is the overall desired output of the adaptive structure. This error signal is the difference between the desired signal and additive noise, and the Adaptive Filter’s output, a. All sine signals used are generated with MATLAB as you see below:

2.1 The Least Mean Square (LMS) Algorithm The LMS algorithm is an iterative technique for minimizing the mean square error (MSE) between the primary input and the reference signal [14]. The Adaptive Filter weights are updated by using the LMS algorithm. The LMS algorithm can be written in matrix notation:

fid = fopen(); F2= fread(fid,'bit'); [m,n]=size(F2); of=F2(::m,); [ma,nb]=size(of); of=of'; ecg=of(,:); t=(:);A1=0.8; q=rand; vnoise=A1*sin((2*pi*60*t)+q); rnoise1 =a*(wgn(,,))/ p; %a and p are experimental values ecg=ecg+vnoise+rnoise1'; %noise removing N=10;mu=0.01; coeffs=ones(1,N); ha = adaptfilt.lms(N,mu); set(ha,'coefficients',coeffs);

Figure 5. Noise cancellation system

W(K 1) W(K)  2D.e(k).pT (K) 146

noise1=rnoise1+vnoise'; [y,e] = filter(ha,noise1,ecg);

ORIGINAL ECG 1 0.5 0 -0.5

3.2 Matlab Simulations and results

-1 -1.5 -2

In first experiment, MIT-BIH Arrhythmia Database data were used as the input: reference annotation (106.atr), data file (106.dat), and header file (106.hea).The result is shown in Fig. 6. In the second experiment, MIT-BIH Arrhythmia Database data were used as the input: reference annotation (220.atr), data file (220.dat), and header file (220.hea). The result is shown in Fig. 7. , In the third experiment, MITBIH Arrhythmia Database data were used as the input:reference annotation (202.atr), data file (202.dat), and header file (202.hea).The result is shown in Fig. 8 and In the fourth experiment, MITBIH Arrhythmia Database data were used as the input: reference annotation (116.atr), data file (116.dat), and header file (116.hea).The result is shown in Fig. 9. In all result figures, the first signal is the original ECG, thesecond is ECG+noise, and the third signal is adaptive filter result.

0

100

200

300

400

500 time

600

700

800

900

1000

600

700

800

900

1000

600

700

800

900

1000

ECG + NOISE 4 2 0 -2 -4

0

100

200

300

400

500 time adap.filter result

2 1 0 -1 -2 -3

0

100

200

300

400

500 time

Figure 7. First experiment, MIT-BIH Arrhythmia, data file 106.dat

ORIGINAL ECG

ORIGINAL ECG

-8

-7 -8

-9

-9

-10

-10

-11 -11 -12

-12 0

500

1000

1500 time

2000

2500

3000

0

500

1000

1500 time

2000

2500

3000

2000

2500

3000

2000

2500

3000

ECG + NOISE

ECG + NOISE

-7

-6

-8 -8

-9 -10

-10 -11

-12

-12 -14

0

500

1000

1500 time

2000

2500

-13

3000

0

500

1000

adap.filter result -6

-7

-7

-8

-8

-9

-9

-10

-10

-11

-11 -12

1500 time adap.filter result

-12 0

500

1000

1500 time

2000

2500

3000

-13

Figure 6. First experiment, MIT-BIH Arrhythmia, data file 106.dat

0

500

1000

1500 time

Figure 8. Third experiment, MIT-BIH Arrhythmia, data file 200.dat

147

[5] S.M. Kuo and J. Chen, Multiple-microphone acoustic echocancellation system with the partial adaptive process, DigitalSignal Processing: A Review Journal, 3 (1993) 54-63. [6] R. Chassaing, Digital Signal Processing with C and theTMS320C30,Wiley, New York,1992. [7] M. Jansen, Noise reduction by wavelet thresholding(NewYork, Springer Verlag, 2000). [8] C. Li, C. Zheng, C. Tai, Detection of ECG characteristic points using wavelet transforms, IEEE Trans. on Biomedical Engineering, 42(1), 1995, 21-28. [9] C. M. Stein, Estimation of the mean of a multivariate normal distribution, Annals of Statistics 9, 1981, 11351151. [10] S. G. Mallat, A theory for multiresolution signal decomposition, the wavelet representation, IEEE, Transactions on Pattern Analysis and Machine Intelligence 11, 1989, 674-693. [11] W. Härdle, G. Kerkyacharian, D. Picard, A. Tsybakov, Wavelets, approximation and statistical applications, Seminaire Paris-Berlin, Paris, sep 1997, 1284. [12] D. Donoho, I. Johnstone, Adapting to unknown smoothness via wavelet shrinkage, Journal of the merican Statistical Association 90, 1995, 1200- 1224. [13] F. Mochimaru, Y. Fujimoto, Y. Ishikawa, Detecting the fetal electrocardiogram by wavelet theory-based methods, Progress in Biomedical Research, 7(3), sep 2002, 185-193. [14] X. Zhou, P. Engler, M.G. Coblentz, “Adaptive filter application in fetal electrocardiography,” Fifth Annual IEEE Symposium on Computer-Based Medical Systems, pp. 656– 662, 1992. [15] Investigation of Adaptive Filtering for Noisy ECG Signals, Nian Zhang, Bernt Askildsen, and Brian T. Hemmelman, 1-4244-0166-6/06/$20.00 ©2006 IEEE. [16] K. J. Eriksen “Non-Distorting Post-Acquisition LineFrequency for Evoked Potentials, Proceedings of the IEEE EMBS 10th Annual International Conference, p. 1168, 1988. [17] M. Ferdjallah and R. E. Barr “Adaptive Digital Notch Filter Design on the Unit Circle for the Removal of Ower line Noise from Biomedical Signals”, IEEE Trans. On Biomedical Engineering, vol. 41, no. 6, pp. 529–536, 1994. [18] M. V. Dragosevic, and S. S. Stankovic “An Adaptive Notch Filter with Improved Tracking Properties”, IEEE Trans. Signal Processing, vol. 43, no. 9, pp. 2068–2078, 1995. [19] J. G. Proakis, and D. G. Manolakis “Digital Signal Processing”, Prentice Hall , 3rd Ed., pp. 343–345, USA, 1996. [20] J. R. Glover “Adaptive Noise Canceling Applied to Sinusoidal Interferences”, IEEE Trans. on Acoustics,

ORIGINAL ECG 1.5 1 0.5 0 -0.5 -1 -1.5

0

100

200

300

400

500 time

600

700

800

900

1000

600

700

800

900

1000

600

700

800

900

1000

ECG + NOISE 3 2 1 0 -1 -2

0

100

200

300

400

500 time adap.filter result

2 1 0 -1

-2

0

100

200

300

400

500 time

Figure 9. forth experiment, MIT-BIH Arrhythmia, data file116.dat

4. Conclusions Adaptive Filtering with LMS algorithm was simulated and tested for noise cancellation in ECG signals. As a result, it requires very little computational power or memory while still maintaining the ability to handle complex signal processing. We compared this method with the reliability of the non-fault tolerant adaptive filters. The experimental results showed the this program is highly reliable. The non-fault tolerant Adaptive Filters can not give the right response after the 500th time step. But with using this program, we could give the best ECG signal whitout losing parts of signal. Thus the adaptive filter approach as described herein can be applied to readily remove 60Hz artifact noise while minimally distorting the true ECG signals.

Reference [1] B. Widrow and E. Walach, Adaptive Inverse Control, Prentice-Hall, Inc., S.S.Series, N.J. (1996). [2] S. Haykin, Adaptive Filter Theory, Englewood Cliffs, N.J.:Prentice-Hall, Inc., 3rd Edition (1996). [3] M. Feder, A.V. Oppenheim, E. Weistein, Maximum likelihoodnoise cancellation using the EM algorithm, IEEE Trans. onAcoustics, Speech and Signal Processing, 37 (1989) 04-216. [4] S.A. Billings and C.F. Fung, Recurrent radial basis functionnetwork for adaptive noise cancellation, Neural Networks, 8(1995) 273-290.

148

Speech, and Signal Processing, vol. ASSP-25, no. 6, pp. 484–491, 1977. [21] R. H. Kwong, and E. W. Johnston “A Variable Step Size LMS Algorithm”, IEEE Trans. Signal Processing, vol. 40, no. 7, pp.1633–1642, 1992. [22] A. M. Kuzminskiy “A Robust Step Size Adaptation Scheme for LMS Adaptive Filters”, IEEE Workshop on Digital Signal Processing, pp. 33–36, 1997. [23] Adaptive Notch Filter for EEG Signals Based on the LMS Algorithm with Variable Step-Size Parameter, The Johns Hopkins University, March 16–18, 2005

149