BSPII Ch3 Filtering Time 2008

download BSPII Ch3 Filtering Time 2008

of 15

Transcript of BSPII Ch3 Filtering Time 2008

  • 7/31/2019 BSPII Ch3 Filtering Time 2008

    1/15

    1

    11

    ChapterChapter33

    TimeTime--domaindomain FilteringFiltering

    forforRemovalRemoval ofofArtifactsArtifacts

    Dr. BDr. Blent Ylent Ylmazlmaz

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 22

    Contents

    TimeTime--domain filtersdomain filters SynchronizedSynchronized averagingaveraging

    MovingMoving--averageaverage filtersfilters

    DerivativeDerivative--basedbased operatorsoperators toto removeremove lowlow--frequencyfrequency artifactsartifacts

    Applications: Removal of artifacts in the ECG

  • 7/31/2019 BSPII Ch3 Filtering Time 2008

    2/15

  • 7/31/2019 BSPII Ch3 Filtering Time 2008

    3/15

    3

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 55

    SynchronizedSynchronized averagingaveraging

    Linear filters failLinear filters fail When the signal and noise spectra overlapWhen the signal and noise spectra overlap

    Synchronized signal averagingSynchronized signal averaging ccan separate aan separate arepetitive signal from noise w/o disturbing the signalrepetitive signal from noise w/o disturbing the signal

    AlignmentAlignment of the waveforms is importantof the waveforms is important NoNo frequencyfrequency--domaindomain filteringfiltering isis necessarynecessary

    IfIfnoise is random with zero mean andnoise is random with zero mean anduncorrelateduncorrelated with the signalwith the signal aaveragingveraging willwillimprove SNRimprove SNR

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 66

    ERP & SEPERP & SEP ERP:ERP: EventEvent--relatedrelated potentialpotential

    SEP:SEP: SSoommaattoosseennssoorryy evokedevoked potentialpotential

    TheThe somatosensorysomatosensory systemsystem isis thethe sensorysensorysystemsystem ofofsomaticsomatic sensationsensation.. TheThe sense ofsense oftouchtouch isis mediatedmediated byby thethe

    somatosensorysomatosensory systemsystem.. TouchTouch maymay simplysimply bebeconsideredconsidered oneone ofoffivefive humanhuman sensessenses;; howeverhowever,, whenwhenaa personperson touchestouches somethingsomething ororsomebodysomebody thisthis givesgivesriserise toto variousvarious feelingsfeelings:: thethe perceptionperception ofofpressurepressure((hencehence shapeshape,, softnesssoftness,, texturetexture,, vibrationvibration,, etcetc.),.),relativerelative temperaturetemperature andand sometimessometimes painpain.. ThusThus thethetermterm ""touchtouch" is" is actuallyactually thethe combinedcombined termterm forforseveralseveralsensessenses.. InIn medicinemedicine,, thethe colloquialcolloquial termterm ""touchtouch" is" isusuallyusually replacedreplaced withwith somaticsomatic sensessenses,, toto betterbetterreflectreflect thethe varietyvariety ofofmechanismsmechanisms involvedinvolved..

  • 7/31/2019 BSPII Ch3 Filtering Time 2008

    4/15

    4

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 77

    ExamplesExamples::

    ERPsERPs andand SEPsSEPs Epochs obtained a number of times by

    repeated application of the stimulus

    Stimulus is used to align the epochs

    Averaging is then performed

    ECG signals filtered by detecting the QRS complexes and

    their position to align the waveforms

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 88

    AlgorithmAlgorithm

    M repetitionsM repetitions --> SNR increase by a factor> SNR increase by a factorMM Obtain a number of realizationsObtain a number of realizations Determine a reference pointDetermine a reference point

    Trigger if external stimulationTrigger if external stimulation

    Repetitive eventsRepetitive events QRS complexes in the ECG or S1 and S2 in the PCGQRS complexes in the ECG or S1 and S2 in the PCG

    Extract parts corresponding to events and add themExtract parts corresponding to events and add themto a bufferto a buffer

    Divide the results in the buffer by the # of eventsDivide the results in the buffer by the # of eventsaddedadded

  • 7/31/2019 BSPII Ch3 Filtering Time 2008

    5/15

    5

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 99

    ExampleExample:: VisualVisual ERPsERPs

    Averaging over10 repetitions

    Averaging over20 repetitions

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 1010

    ExampleExample:: NoisyNoisy ECGECG signalsignal

    Sample QRS complexSample QRS complex First beat used as aFirst beat used as a

    template (86 ms)template (86 ms)

    Template matchingTemplate matching

    Normalized crossNormalized cross--correlationcorrelation

    CrossCross--correlation peakscorrelation peaks(value is 1) at the(value is 1) at thelocations of QRSlocations of QRS

    Choose an appropriateChoose an appropriatethreshold (be careful!)threshold (be careful!)

  • 7/31/2019 BSPII Ch3 Filtering Time 2008

    6/15

    6

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 1111

    ExampleExample:: NoisyNoisy ECGECG signalsignal

    TwoTwo ECGECG cyclescyclesextractedextracted usingusing triggertrigger

    pointspoints fromfrom crosscross--

    correlationcorrelation functionfunction

    SynchronizedSynchronized averagingaveragingperformedperformed

    1111 cyclescycles averagedaveraged

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 1212

    Problem:Problem:

    ProposePropose a timea time--domaindomain techniquetechnique totoremoveremove randomrandom noisenoise givengiven onlyonly oneone

    realizationrealization ofofthethe signalsignal ororeventevent ofofinterestinterest..

  • 7/31/2019 BSPII Ch3 Filtering Time 2008

    7/15

    7

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 1313

    SolutionSolution:: MovingMoving--averageaverage filtersfilters

    TemporalTemporal averagingaveraging forfornoisenoise removalremoval

    y[n] =y[n] = bbkk x[nx[n--k]k] bbkk:: filterfiltercoefficientscoefficients, k = 0, k = 0 NN

    N:N: orderorderofofthethe filterfilter

    TheThe effecteffect ofofdivisiondivision byby thethe numbernumberofof

    samplessamples usedused isis includedincluded inin thethe valuesvalues ofoffilterfiltercoefficientscoefficients

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 1414

    MAFMAF

    H(z)=bH(z)=b00+b+b11zz--11+b+b22zz

    --22++++bbNNzz--NN

    SpecialSpecial MAF:MAF: HanningHanning filterfilter

    H(z)=(1/4)[1+2zH(z)=(1/4)[1+2z--11+z+z--22]] DoubleDouble zerozero at z=at z=--11

  • 7/31/2019 BSPII Ch3 Filtering Time 2008

    8/15

    8

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 1515

    AdvantagesAdvantages andand attributesattributes of MAFof MAF

    h[k] has ah[k] has a finitefinite numbernumberofoftermsterms FIRFIR filterfilter

    NoNo recursionrecursion, no, no feedbackfeedback

    TheThe outputoutput dependsdepends onlyonly onon thethe presentpresent inputinputsamplesample andand aa fewfew pastpast inputinput samplessamples

    FilterFilteris a set of tapis a set of tap weightsweights ofofthethe delaydelay stagesstages

    NoNo polespoles exceptexcept at z=0at z=0

    InherentlyInherently stablestable

    LinearLinearphasephase SymmetricSymmetric ororantisymmetricantisymmetric taptap weightsweights

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 1616

    HanningHanning FilterFilter

    H(w)=(1/4)[1+2eH(w)=(1/4)[1+2e--jwjw+e+e--j2wj2w]]

    H(w)=(1/4)[{2+2cos(w)}eH(w)=(1/4)[{2+2cos(w)}e--jwjw]]

  • 7/31/2019 BSPII Ch3 Filtering Time 2008

    9/15

    9

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 1717

    HanningHanning filterfilter

    -- LowpassLowpass filterfilter withwith

    linearlinear phasephase

    -- MagnitudeMagnitude andand

    phasephase responseresponse assistassist

    inin undestandingundestanding thethe

    effecteffect ofofthethe filterfilter ononthethe frequencyfrequency

    componentscomponents ofofthethe

    signalsignal andand noisenoise

    MagnitudeMagnitude responseresponse = |(1/2){1+= |(1/2){1+coscos(w)}|(w)}|

    PhasePhase responseresponse == --ww

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 1818

    MovingMoving averageaverage filterfilter(8(8--pointpoint))

    H(w) = (1/8) exp(-jwk) =(1/8) [1+ exp(-j4w) {1+2cosw+2cos2w+2cos3w}]

  • 7/31/2019 BSPII Ch3 Filtering Time 2008

    10/15

    10

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 1919

    IllustrationIllustration ofofapplicationapplication::FilteringFiltering withwith 88--pointpoint MAMA

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 2020

    ProblemProblem

    DevelopDevelop a timea time--domaindomain techniquetechnique totoremoveremove basebase--lineline driftdrift inin thethe ECGECG signalsignal

  • 7/31/2019 BSPII Ch3 Filtering Time 2008

    11/15

    11

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 2121

    DerivativeDerivative--basedbased operatorsoperatorstoto removeremove lowlow--frequencyfrequency artifactsartifacts

    DerivativeDerivative operatoroperatorin timein time--domaindomain RemovesRemoves partsparts thatthat areare constantconstant

    LargeLarge changeschanges inin thethe inputinput -->> highhigh valuesvalues inin

    thethe outputoutput

    BoostBoost HFHF componentscomponents andand suppresssuppress LFLFcomponentscomponents

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 2222

    DerivativeDerivative operatoroperator

    d/d/dtdt -->> multiplicationmultiplication bybyjwjw ororj2*pi*fj2*pi*f

    GainGain ofofthethe freqfreq responseresponse, H(w)=, H(w)=jwjw

    startsstarts withwith 00 andand increasesincreases linearlylinearly SecondSecond--orderorderderivativederivative operatoroperatordd22/dt/dt22

    H(w) =H(w) = --ww22

    QuadraticQuadratic increaseincrease inin gaingain forforHFHF componentscomponents

  • 7/31/2019 BSPII Ch3 Filtering Time 2008

    12/15

  • 7/31/2019 BSPII Ch3 Filtering Time 2008

    13/15

  • 7/31/2019 BSPII Ch3 Filtering Time 2008

    14/15

    14

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 2727

    SolutionSolution

    ToTo obtainobtain highhigh gaingain inin thethe lowlow frequenciesfrequenciesplaceplace aa polepole onon thethe realreal axisaxis ((zerozero))

    frequencyfrequency at z=0.995at z=0.995

    H(z)=(1/T)[(1H(z)=(1/T)[(1--zz--11)/(1)/(1--0.995z0.995z--11)])]

    H(z)=(1/T)[(zH(z)=(1/T)[(z--1)/(z1)/(z--0.995)]0.995)]

    y[n]=(1/T)(x[n]y[n]=(1/T)(x[n]--x[nx[n--1])+0.995y[n1])+0.995y[n--1]1]

    pole

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 2828

    MagnitudeMagnitude andand phasephase responseresponse

  • 7/31/2019 BSPII Ch3 Filtering Time 2008

    15/15

    Dr. BDr. Blent Ylent Ylmazlmaz BME402:BME402: BiomedicalBiomedical SignalSignal ProcessingProcessing--IIII 2929

    RemovalRemoval ofofwanderwander