+ All Categories
Home > Documents > ECG Filtering Aksela

ECG Filtering Aksela

Date post: 12-Mar-2015
Category:
Upload: maxhsb
View: 67 times
Download: 2 times
Share this document with a friend
34
ECG Filtering ECG Filtering T-61.181 T-61.181 – Biomedical Signal Processing – Biomedical Signal Processing Presentation 11.11.2004 Presentation 11.11.2004 Matti Aksela ( Matti Aksela ( [email protected] [email protected] ) )
Transcript
Page 1: ECG Filtering Aksela

ECG FilteringECG Filtering

T-61.181 T-61.181 – Biomedical Signal Processing – Biomedical Signal Processing

Presentation 11.11.2004Presentation 11.11.2004

Matti Aksela (Matti Aksela ([email protected]@hut.fi))

Page 2: ECG Filtering Aksela

ContentsContents

Very brief introduction to ECG Very brief introduction to ECG Some common ECG Filtering tasksSome common ECG Filtering tasks

Baseline wander filteringBaseline wander filtering Power line interference filteringPower line interference filtering Muscle noise filteringMuscle noise filtering

SummarySummary

Page 3: ECG Filtering Aksela

A Very brief introductionA Very brief introduction

To quote the book:To quote the book:

””Here a general prelude to ECG signal Here a general prelude to ECG signal processing and the content of this processing and the content of this chapter (3-5 pages) will be included.”chapter (3-5 pages) will be included.”

Very nice, but let’s take a little more Very nice, but let’s take a little more detail for those of us not quite so detail for those of us not quite so familiar with the subject...familiar with the subject...

Page 4: ECG Filtering Aksela

A Brief introduction to A Brief introduction to ECGECG

The electrocardiogram (ECG) is a time-varying The electrocardiogram (ECG) is a time-varying signal reflecting the ionic current flow which signal reflecting the ionic current flow which causes the cardiac fibers to contract and causes the cardiac fibers to contract and subsequently relax. The surface ECG is obtained subsequently relax. The surface ECG is obtained by recording the potential difference between two by recording the potential difference between two electrodes placed on the surface of the skin. A electrodes placed on the surface of the skin. A single normal cycle of the ECG represents the single normal cycle of the ECG represents the successive atrial depolarisation/repolarisation and successive atrial depolarisation/repolarisation and ventricular depolarisation/repolarisation which ventricular depolarisation/repolarisation which occurs with every heart beat. occurs with every heart beat.

Simply put, the ECG (EKG) is a device that Simply put, the ECG (EKG) is a device that measures and records the electrical activity of the measures and records the electrical activity of the heart from electrodes placed on the skin in heart from electrodes placed on the skin in specific locationsspecific locations

Page 5: ECG Filtering Aksela

What the ECG is used What the ECG is used for?for?

Screening test for coronary artery disease, Screening test for coronary artery disease, cardiomyopathies, left ventricular hypertrophycardiomyopathies, left ventricular hypertrophy

Preoperatively to rule out coronary artery diseasePreoperatively to rule out coronary artery disease Can provide information in the precence of metabolic Can provide information in the precence of metabolic

alterations such has hyper/hypo calcemia/kalemia etc.alterations such has hyper/hypo calcemia/kalemia etc. With known heart disease, monitor progression of the With known heart disease, monitor progression of the

diseasedisease Discovery of heart disease; infarction, coronal Discovery of heart disease; infarction, coronal

insufficiency as well as myocardial, valvular and insufficiency as well as myocardial, valvular and cognitial heart diseasecognitial heart disease

Evaluation of ryhthm disordersEvaluation of ryhthm disorders All in all, it is the basic cardiologic test and is widely All in all, it is the basic cardiologic test and is widely

applied in patients with suspected or known heart applied in patients with suspected or known heart diseasedisease

Page 6: ECG Filtering Aksela

Measuring ECGMeasuring ECG

ECG commonly measured via 12 ECG commonly measured via 12 specifically placed leadsspecifically placed leads

Page 7: ECG Filtering Aksela

Typical ECGTypical ECG

A typical ECG period consists of A typical ECG period consists of P,Q,R,S,T and U wavesP,Q,R,S,T and U waves

Page 8: ECG Filtering Aksela

ECG WavesECG Waves P wave: the P wave: the

sequential activation sequential activation (depolarization) of the (depolarization) of the right and left atriaright and left atria

QRS comples: right QRS comples: right and left ventricular and left ventricular depolarizationdepolarization

T wave: ventricular T wave: ventricular repolarizationrepolarization

U wave: origin not U wave: origin not clear, probably clear, probably ”afterdepolarizations” ”afterdepolarizations” in the ventrices in the ventrices

Page 9: ECG Filtering Aksela

ECG ExampleECG Example

Page 10: ECG Filtering Aksela

ECG FilteringECG Filtering Three common noise sources Three common noise sources

Baseline wanderBaseline wander Power line interferencePower line interference Muscle noiseMuscle noise

When filtering any biomedical signal care When filtering any biomedical signal care should be taken not to alter the desired should be taken not to alter the desired information in any wayinformation in any way

A major concern is how the QRS complex A major concern is how the QRS complex influences the output of the filter; to the influences the output of the filter; to the filter they often pose a large unwanted filter they often pose a large unwanted impulseimpulse

Possible distortion caused by the filter Possible distortion caused by the filter should be carefully quantifiedshould be carefully quantified

Page 11: ECG Filtering Aksela

Baseline WanderBaseline Wander

Page 12: ECG Filtering Aksela

Baseline WanderBaseline Wander

Baseline wander, or extragenoeous low-Baseline wander, or extragenoeous low-frequency high-bandwidth components, can frequency high-bandwidth components, can be caused by:be caused by: Perspiration (effects electrode impedance)Perspiration (effects electrode impedance) RespirationRespiration Body movementsBody movements

Can cause problems to analysis, especially Can cause problems to analysis, especially when exmining the low-frequency ST-T when exmining the low-frequency ST-T segmentsegment

Two main approaches used are linear filtering Two main approaches used are linear filtering and polynomial fittingand polynomial fitting

Page 13: ECG Filtering Aksela

BW – Linear, time-invariant BW – Linear, time-invariant filteringfiltering

Basically make a highpass filter to cut of the lower-Basically make a highpass filter to cut of the lower-frequency components (the baseline wander)frequency components (the baseline wander)

The cut-off frequency should be selected so as to The cut-off frequency should be selected so as to ECG signal information remains undistorted while as ECG signal information remains undistorted while as much as possible of the baseline wander is removed; much as possible of the baseline wander is removed; hence the lowest-frequency component of the ECG hence the lowest-frequency component of the ECG should be saught. should be saught.

This is generally thought to be definded by the This is generally thought to be definded by the slowest heart rate. The heart rate can drop to 40 slowest heart rate. The heart rate can drop to 40 bpm, implying the lowest frequency to be 0.67 Hz. bpm, implying the lowest frequency to be 0.67 Hz. Again as it is not percise, a sufficiently lower cutoff Again as it is not percise, a sufficiently lower cutoff frequency of about 0.5 Hz should be used.frequency of about 0.5 Hz should be used.

A filter with linear phase is desirable in order to A filter with linear phase is desirable in order to avoid phase distortion that can alter various avoid phase distortion that can alter various temporal realtionships in the cardiac cycletemporal realtionships in the cardiac cycle

Page 14: ECG Filtering Aksela

Linear phase response Linear phase response can be obtained with can be obtained with finite impulse response, finite impulse response, but the order needed but the order needed will easily grow very will easily grow very high (approximately high (approximately 2000, see book for 2000, see book for details)details) Figure shows leves 400 Figure shows leves 400

(dashdot) and 2000 (dashdot) and 2000 (dashed) and a 5th order (dashed) and a 5th order forward-bacward filter forward-bacward filter (solid)(solid) The complexity can be reduced by for example forward-The complexity can be reduced by for example forward-

backward IIR filtering. This has some drawbacks, backward IIR filtering. This has some drawbacks, however:however: not real-time (the backward part...)not real-time (the backward part...) application becomes increasingly difficult at higher sampling application becomes increasingly difficult at higher sampling

rates as poles move closer to the unit circle, resulting in rates as poles move closer to the unit circle, resulting in unstabilityunstability

hard to extend to time-varying cut-offs (will be discussed shortly)hard to extend to time-varying cut-offs (will be discussed shortly)

Page 15: ECG Filtering Aksela

Another way of reducing filter complexity Another way of reducing filter complexity is to insert zeroes into a FIR impulse is to insert zeroes into a FIR impulse response, resulting in a comb filter that response, resulting in a comb filter that attenuates not only the desired baseline attenuates not only the desired baseline wander but also multiples of the original wander but also multiples of the original samping rate. samping rate. It should be noted, that this resulting multi-It should be noted, that this resulting multi-

stopband filter can severely distort also stopband filter can severely distort also diagnostic information in the signaldiagnostic information in the signal

Page 16: ECG Filtering Aksela

Yet another way of reducing filter Yet another way of reducing filter complexity is by first decimating and complexity is by first decimating and then again interpolating the signalthen again interpolating the signal

Decimation removes the high-frequency Decimation removes the high-frequency content, and now a lowpass filter can content, and now a lowpass filter can be used to output an estimate of the be used to output an estimate of the baseline wanderbaseline wander

The estimate is interpolated back to the The estimate is interpolated back to the original sampling rate and subtracted original sampling rate and subtracted from the original signalfrom the original signal

Page 17: ECG Filtering Aksela

BW – Linear, time-variant BW – Linear, time-variant filteringfiltering

Baseline wander can also be of higher frequency, Baseline wander can also be of higher frequency, for example in stress tests, and in such situations for example in stress tests, and in such situations using the minimal heart rate for the base can be using the minimal heart rate for the base can be inefficeient.inefficeient.

By noting how the ECG spectrum shifts in By noting how the ECG spectrum shifts in frequency when heart rate increases, one may frequency when heart rate increases, one may suggest coupling the cut-off frequency with the suggest coupling the cut-off frequency with the prevailing heart rate insteadprevailing heart rate instead

Schematic Schematic example of example of Baseline noise Baseline noise and the ECG and the ECG Spectrum at aSpectrum at aa) lower heart a) lower heart raterateb) higher heart b) higher heart raterate

Page 18: ECG Filtering Aksela

Time-varying cut-off frequency should be Time-varying cut-off frequency should be inversely proportional to the distance between inversely proportional to the distance between the RR peaksthe RR peaks In practise an upper limit must be set to avoid In practise an upper limit must be set to avoid

distortion in very short RR intervalsdistortion in very short RR intervals A single prototype filter can be designed and A single prototype filter can be designed and

subjected to simple transformations to yield the subjected to simple transformations to yield the other filtersother filters

How to represent the How to represent the ”prevailing heart rate””prevailing heart rate” A simple but useful way is A simple but useful way is

just to estiamet the length just to estiamet the length of the interval between R of the interval between R peaks, the RR intervalpeaks, the RR interval

Linear interpolation for Linear interpolation for interior valuesinterior values

Page 19: ECG Filtering Aksela

BW – Polynomial FittingBW – Polynomial Fitting One alternative to basline removal is to fit One alternative to basline removal is to fit

polynomials to representative points in the polynomials to representative points in the ECGECG Knots selected from a Knots selected from a

”silent” segment, often ”silent” segment, often the best choise is the PQ the best choise is the PQ intervalinterval

A polynomial is fitted so A polynomial is fitted so that it passes through that it passes through every knot in a smooth every knot in a smooth fashionfashion

This type of baseline This type of baseline removal requires the QRS removal requires the QRS complexes to have been complexes to have been identified and the PQ identified and the PQ interval localizedinterval localized

Page 20: ECG Filtering Aksela

Higher-order polynomials can provide a Higher-order polynomials can provide a more accurate estimate but at the cost of more accurate estimate but at the cost of additional computational complexityadditional computational complexity

A popular approach is the cubic spline A popular approach is the cubic spline estimation techniqueestimation technique third-order polynomials are fitted to successive third-order polynomials are fitted to successive

sets of triple knotssets of triple knots By using the third-order polynomial from the By using the third-order polynomial from the

Taylor series and requiring the estimate to pass Taylor series and requiring the estimate to pass through the knots and estimating the first through the knots and estimating the first derivate linearly, a solution can be foundderivate linearly, a solution can be found

Performance is critically dependent on the Performance is critically dependent on the accuracy of knot detection, PQ interval accuracy of knot detection, PQ interval detection is difficult in more noisy conditionsdetection is difficult in more noisy conditions

Polynomial fitting can also adapt to the Polynomial fitting can also adapt to the heart rate (as the heart rate increases, heart rate (as the heart rate increases, more knots are available), but performs more knots are available), but performs poorly when too few knots are availablepoorly when too few knots are available

Page 21: ECG Filtering Aksela

Baseline Wander Baseline Wander ComparsionComparsion

a)a) Original ECGOriginal ECG

b)b) time-invariant time-invariant filteringfiltering

c)c) heart rate heart rate dependent dependent filteringfiltering

d)d) cubic spline cubic spline fittingfitting

An comparison of the methods for baseline An comparison of the methods for baseline wander removal at a heart rate of 120 beats per wander removal at a heart rate of 120 beats per minuteminute

Page 22: ECG Filtering Aksela

Power Line InterferencePower Line Interference Electromagnetic fields from power lines Electromagnetic fields from power lines

can cause 50/60 Hz sinusoidal can cause 50/60 Hz sinusoidal interference, possibly accompanied by interference, possibly accompanied by some of its harmonicssome of its harmonics

Such noise can cause problems Such noise can cause problems interpreting low-amplitude waveforms and interpreting low-amplitude waveforms and spurious waveforms can be introduced.spurious waveforms can be introduced.

Naturally precautions should be taken to Naturally precautions should be taken to keep power lines as far as possible or keep power lines as far as possible or shield and ground them, but this is not shield and ground them, but this is not always possiblealways possible

Page 23: ECG Filtering Aksela

PLI – Linear FilteringPLI – Linear Filtering A very simple approach to filtering power line A very simple approach to filtering power line

interference is to create a filter defined by a interference is to create a filter defined by a comple-conjugated pair of zeros that lie on comple-conjugated pair of zeros that lie on the unit circle at the interfering frequency the unit circle at the interfering frequency ωω00 This notch will of course also attenuate ECG This notch will of course also attenuate ECG

waveforms constituted by frequencies close to waveforms constituted by frequencies close to ωω00

The filter can be improved by adding a pair of The filter can be improved by adding a pair of complex-conjugated poles positioned at the same complex-conjugated poles positioned at the same angle as the zeros, but at a radius. The radius then angle as the zeros, but at a radius. The radius then determines the notch bandwith.determines the notch bandwith.

Another problem presents; this causes increased Another problem presents; this causes increased transient response time, resulting in a ringing transient response time, resulting in a ringing artifact after the transientartifact after the transient

Page 24: ECG Filtering Aksela

• More sophisticated filters can be constructed for, More sophisticated filters can be constructed for, for example a narrower notchfor example a narrower notch

• However, increased frequency resolution is always However, increased frequency resolution is always traded for decreased time resolution, meaning that traded for decreased time resolution, meaning that it is not possible to design a linear time-invariant it is not possible to design a linear time-invariant filter to remove the noise without causing ringingfilter to remove the noise without causing ringing

Pole-zero diagram for Pole-zero diagram for two second-order IIR two second-order IIR filters with idential filters with idential locations of zeros, but locations of zeros, but with radiuses of 0.75 with radiuses of 0.75 and 0.95and 0.95

Page 25: ECG Filtering Aksela

PLI – Nonlinear FilteringPLI – Nonlinear Filtering One possibility is to create a nonlinear filter which One possibility is to create a nonlinear filter which

buildson the idea of subtracting a sinusoid, buildson the idea of subtracting a sinusoid, generated by the filter, from the observed signal generated by the filter, from the observed signal x(n)x(n) The amplitude of the sinusoid The amplitude of the sinusoid v(n) = sin(v(n) = sin(ωω00n)n) is adapted to is adapted to

the power line interference of the observed signal through the power line interference of the observed signal through the use of an error function the use of an error function e(n) = x(n) – v(n)e(n) = x(n) – v(n)

The error function is dependent of the DC level of The error function is dependent of the DC level of x(n)x(n), but , but that can be removed by using for example the first difference that can be removed by using for example the first difference ::

e’(n) = e(n) – e(n-1)e’(n) = e(n) – e(n-1) Now depending on the sign of Now depending on the sign of e’(n)e’(n), the value of , the value of v(n)v(n) is is

updated by a negative or positive increment updated by a negative or positive increment αα,,

v*(n) = v(n) + v*(n) = v(n) + αα sgn(e’(n)) sgn(e’(n))

Page 26: ECG Filtering Aksela

The output signal is obtained by subtracting The output signal is obtained by subtracting the interference estimate from the input,the interference estimate from the input,

y(n) = x(n) – v*(n)y(n) = x(n) – v*(n) If If αα is too small, the filter poorly tracks is too small, the filter poorly tracks

changes in the power line interference changes in the power line interference amplitude. Conversely, too large a amplitude. Conversely, too large a αα causes causes extra noise due to the large step alterationsextra noise due to the large step alterations

Filter convergence:a) pure sinusoidb) output of filter

with α=1c) output of filter

with α=0.2

Page 27: ECG Filtering Aksela

PLI – Comparison of linear PLI – Comparison of linear and nonlinear filteringand nonlinear filtering

Comparison of power Comparison of power line interference line interference removal:removal:

a)a) original signaloriginal signal

b)b) scond-order IIR filterscond-order IIR filter

c)c) nonlinear filter with nonlinear filter with transient transient suppression, suppression, α = 10 μV

Page 28: ECG Filtering Aksela

PLI – Estimation-PLI – Estimation-SubtractionSubtraction

One can also estimate the amplitude and One can also estimate the amplitude and phase of the interference from an phase of the interference from an isoelectric sgment, and then subtract the isoelectric sgment, and then subtract the estimated segment from the entire cycleestimated segment from the entire cycle Bandpass filtering around the interference can Bandpass filtering around the interference can

be usedbe used The location of the segment The location of the segment

can be defined, for example, by can be defined, for example, by the PQ interval, or with some the PQ interval, or with some other detection criteria. If the other detection criteria. If the interval is selected poorly, for interval is selected poorly, for example to include parts of the example to include parts of the P or Q wave, the interference P or Q wave, the interference might be overestimated and might be overestimated and actually cause an increase in actually cause an increase in the interferencethe interference

Page 29: ECG Filtering Aksela

The sinusoid fitting can be solved by minimizing the The sinusoid fitting can be solved by minimizing the mean square error between the observed signal and mean square error between the observed signal and the sinusoid model the sinusoid model

The estimation-subtraction technique can also work The estimation-subtraction technique can also work adaptively by computing the fitting weights for adaptively by computing the fitting weights for example using a LMS algorithm and a reference input example using a LMS algorithm and a reference input (possibly from wall outlet)(possibly from wall outlet) Weights modified for each time instant to minimize MSE Weights modified for each time instant to minimize MSE

between power line frequency and the observed signalbetween power line frequency and the observed signal

As the fitting As the fitting interval grows, the interval grows, the stopband becomes stopband becomes increasingly narrow increasingly narrow and passband and passband increasingly flat, increasingly flat, however at the cost however at the cost of the increasing of the increasing oscillatory oscillatory phenomenon (Gibbs phenomenon (Gibbs phenomenon)phenomenon)

Page 30: ECG Filtering Aksela

Muscle Noise FilteringMuscle Noise Filtering Muscle noise can cause severe problems as Muscle noise can cause severe problems as

low-amplitude waveforms can be obstructed low-amplitude waveforms can be obstructed Especially in recordings during exerciseEspecially in recordings during exercise

Muscle noise is not associated with narrow Muscle noise is not associated with narrow band filtering, but is more difficult since the band filtering, but is more difficult since the spectral content of the noise considerably spectral content of the noise considerably overlaps with that of the PQRST complexoverlaps with that of the PQRST complex

However, ECG is a repetitive signal and thus However, ECG is a repetitive signal and thus techniques like ensemle averaging can be usedtechniques like ensemle averaging can be used Successful reduction is restricted to one QRS Successful reduction is restricted to one QRS

morphology at a time and requires several beats to morphology at a time and requires several beats to become availablebecome available

Page 31: ECG Filtering Aksela

MN – Time-varying lowpass MN – Time-varying lowpass filteringfiltering

A time-varying lowpass filter with variable A time-varying lowpass filter with variable frequency response, for example Gaussian frequency response, for example Gaussian impulse response, may be used. impulse response, may be used. Here a width function Here a width function ββ(n)(n) defined the width of the defined the width of the

gaussian, gaussian,

h(k,n) ~ eh(k,n) ~ e- - ββ(n)k(n)k22

The width function is designed to reflect local signal The width function is designed to reflect local signal properties such that the smooth segments of the properties such that the smooth segments of the ECG are subjected to considerable filtering whereas ECG are subjected to considerable filtering whereas the steep slopes (QRS) remains essentially unalteredthe steep slopes (QRS) remains essentially unaltered

By making By making ββ(n)(n) proportional to derivatives of the proportional to derivatives of the signal slow changes cause small signal slow changes cause small ββ(n)(n) , resulting in , resulting in slowly decaying impulse response, and vice versa.slowly decaying impulse response, and vice versa.

Page 32: ECG Filtering Aksela

MN – Other MN – Other considerationsconsiderations

Also other already mentioned techniques Also other already mentioned techniques may be applicable;may be applicable; the time-varying lowpass filter examined with the time-varying lowpass filter examined with

baseline wander baseline wander the method for power line interference based on the method for power line interference based on

trunctated series expansionstrunctated series expansions However, a notable problem is that the However, a notable problem is that the

methods tend to create artificial waves, methods tend to create artificial waves, little or no smoothing in the QRS comples little or no smoothing in the QRS comples or other serious distortionsor other serious distortions

Muscle noise filtering remains largely an Muscle noise filtering remains largely an unsolved problemunsolved problem

Page 33: ECG Filtering Aksela

ConclusionsConclusions Both baseline wander and powerline interference Both baseline wander and powerline interference

removal are mainly a question of filtering out a removal are mainly a question of filtering out a narrow band of lower-than-ECG frequency narrow band of lower-than-ECG frequency interference. interference. The main problems are the resulting artifacts and how to The main problems are the resulting artifacts and how to

optimally remove the noiseoptimally remove the noise Muscle noise, on the other hand, is more difficult Muscle noise, on the other hand, is more difficult

as it overlaps with actual ECG dataas it overlaps with actual ECG data For the varying noise types (baseline wander and For the varying noise types (baseline wander and

muscle noise) an adaptive approach seems quite muscle noise) an adaptive approach seems quite appropriate, if the detection can be done well. For appropriate, if the detection can be done well. For power line interference, the nonlinear approach power line interference, the nonlinear approach seems valid as ringing artifacts are almost seems valid as ringing artifacts are almost unavoidable otherwiseunavoidable otherwise

Page 34: ECG Filtering Aksela

The main thing...The main thing...

The main idea to take home from this The main idea to take home from this section would, in my opinion be, to always section would, in my opinion be, to always take note of why you are doing the filtering. take note of why you are doing the filtering. The ”best” way depends on what is most The ”best” way depends on what is most important for the next step of processing – important for the next step of processing – in many cases preserving the true ECG in many cases preserving the true ECG waveforms can be more important than waveforms can be more important than obtaining a mathematically pleasing ”low obtaining a mathematically pleasing ”low error” solution. But then again – doesn’t error” solution. But then again – doesn’t that apply quite often anyway?that apply quite often anyway?


Recommended