Biosignal filtering and artifact rejection Biosignal processing, 521273S Autumn 2012
Motivation 1) Artifact removal: for example power line non-stationarity due to baseline variation muscle or eye movement artifacts in EEG or ECG Solution?: epoch rejection due to artifacts
Motivation 2) Enhancement of useful information bandpass filtering finding certain signal waveforms such as eye blins from EEG or QRS complexes from ECG smoothing for illustrative purposes
FIR Finite impulse response (FIR) filter Stable Simple to implement Linear phase response Symmetrical impulse response All frequencies have the same amount of delay no phase distortion y( n) N 1 0 H( z) h( ) x( n ) N 1 0 h( ) z
FIR structure Source: http://www.netrino.com/publications/glossary/filters.php
FIR 0.12 0.1 0.08 0.06 0.04 Magnitude (db) 50 0-50 -100 0 20 40 60 80 100 120 Frequency (Hz) 0.02 0-0.02-0.04 0 5 10 15 20 25 30 35 40 45 Phase (degrees) 0-200 -400-600 -800 0 20 40 60 80 100 120 Frequency (Hz) Lowpass filter, order 44 (N=45), positive symmetry. fs=256 Hz, Fp=13 Hz, Rp=4 db, Fs=19 Hz, Rs=38 db Characteristics: passband, transition band, stopband, ripple, attenuation, sampling frequency
IIR Infinite impulse response filters Feedbac system Normally fewer coefficients that with FIR Used for sharp cut-off (notch filters for example) Can become unstable or performance degrade if not designed with care Pole-zero diagram Nonlinear phase characteristics causes phase distortion altering harmonic relationhips frequency components have different time delays (often undesirable) M N M M N N z b z a z b b z z a z a a z H 1 0 1 1 1 1 0 1... 1... ) ( M N n y b n x a n x h n y 1 0 0 ) ( ) ( ) ( ) ( ) (
Source: http://www.triplecorrelation.com/courses/fundsp/iiroverview.pdf
Smoothing: averaging filter Average of sliding window of size N samples FIR filter y( n) 1 N N 1 0 x( n )
Smoothing: Hanning filter H( z) 1 [1 4 2z z 1 2 ]
Smoothing: Butterworth lowpass filtering Butterworth lowpass filter - Select suitable order and cutoff frequency
Synchronized averaging Filter noise by averaging several signals containing the same events Often simple/complex pulses Signals must first be time-synchronized Averaging of flash visual ERP s from EEG
Notch/comb filter Often used for 50/60 Hz power line artifact filtering Narrow stop-band in basic and harmonic frequencies Be careful with the aliased harmonics Can be implemented as FIR or IIR Ruha et al. (1997)
Notch/comb filter Original signal Filtering result
Trend removal (detrending) High-pass filtering time-domain: difference filter frequency-domain: DFT Trend removal with other methods Savitzy-Golay filter IPG-FMH (in-place growing FIR median hybrid)
Difference filtering, version 1 First-order difference operator: T=sampling interval 1 y( n) [ x( n) x( n 1)] T
Difference filtering, version 2 Modified first-order difference operator: - T=sampling interval - Additional pole inserted at zero frequency to steepen the y transition band 1 1 1 z H( z) 1 T 1 0.995z 1 ( n) [ x( n) x( n 1)] 0.995y( n 1) T
Detrending: Butterworth highpass filter Select suitable order and cutoff frequency
Savitzy-Golay filter S-G filters are called polynomial or leastsquares smoothing filters Fits a polynomial of given degree optimally to a signal window In a sliding time window (frame), a polynomial curve is fitted to signal, and its middle value in the frame is taen as a smoothened value Decomposes the signal into a trend signal and residual signal The trend component can be interpreted as the useful signal component or the noise component, depending on the application Can be realized as a fast FIR filter 4 2 0-2 ORIGINAL -4 0 200 400 600 800 1000 1200 1400 1600 1800 2000 POLYNOMIAL ORDER 3, FRAME SIZE 21 4 2 0-2 -4 0 200 400 600 800 1000 1200 1400 1600 1800 2000 POLYNOMIAL ORDER 3, FRAME SIZE 41 4 2 0-2 -4 0 200 400 600 800 1000 1200 1400 1600 1800 2000
IPG-FMH In-place growing FIR-median hybrid filters (IPG-FMH) are based on median filtering and FIR-filtering Median filter: taes the median value within a signal window as filter output value Has robust nature against noise Pulses longer than root signal are detected reliably, shorter pulses are removed Suitable also for trend estimation of signals Preserves sharp edges in trend better than linear low-pass filter Attenuates wide-band noise effectively Wichman et al. (1990)
Wiener filtering Optimal filter that taes into account statistical characteristics of signal and noise processes Noise spectrum S and desired signal spectrum S d must be nown or estimated W ( ) 1 1 S ( ) S d ( )
LMS adaptive filtering (least mean square) Situation: an interfering signal component is summed to the actual biosignal Filter aims to subtract the interfering signal x from the noisy biosignal y The interference signal x is usually measured independently and simultaneously with another sensor device In an ideal situation, the interference signal x is identical to the interference component in y; only the amplitude and sign must be determined before subtraction (one filter weight is enough) Sometimes only a correlated version of the interference can be measured; the filter adapts the interference signal shape optimally to the interference signal component that appears in y (many filter weights are needed) Be careful with the possible delay between the interference signal and biosignal x e n 1 LMS, y w ( i) i0 (EOG) w ( 2 i 1) W x i wi elms, y (EEG+EOG) - x i e (EEG)
LMS adaptive filtering (least mean square) Based on steepest descent optimization algorithm, where the n filter weights are updated at every sample iteratively according to local gradients on error surface Learning rate parameter 0 < < 1/l max l max : largest eigenvalue of data correlation matrix should be adaptive if data is nonstationary Proper initialization of filter weights is important E.g., letting the filter adapt for a while without outputting anything (wors on-line) E.g., running filter bacwards in time to initialize (wors off-line) x e n 1 LMS, y w ( i) i0 (EOG) W x i y (EEG+EOG) - e (EEG) w i( 1) wi 2eLMS, x i
Example: removing respiration effects from heart rate data
Example: removing ocular artifacts from EEG 150 100 50 0-50 -100-150 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2 x 10 4 400 200 0-200 -400-600 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2 x 10 4 150 100 50 0-50 -100-150 1 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8 1.9 2 x 10 4
Adaptive filtering of ECG
Selected references Journal articles on two trend detectors Wichman R, Astola JT, Heinonen PJ, Neuvo YA (1990) FIR-Median Hybrid Filters with excellent transient response in noisy conditions. IEEE Trans. Acoust., Speech, Signal Processing 38:2108-2117. Original Savitsy-Golay paper: http://pubs.acs.org/cgibin/archive.cgi/ancham/1964/36/i08/pdf/ac60214a047.pdf Boos on signal processing basics Ifeachor EC, Jervis BW. Digital Signal Processing: A Practical Approach. Addison-Wesley, reprint 1996, pp. 279-287, 375-383, 550-551, 561-563, 697-706. Orfanidis, SJ. Introduction to Signal Processing. Prentice-Hall, Englewood Cliffs, NJ, 1996, pp. 434-441.