Chapter
Chapter
4
4
Event
Event
Detection
Detection


1
1
Dr. Bülent Yilmaz Dr. Bülent Yilmaz
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 22
Contents
• Introduction
• Problem statement
• Detection of events and waves
•
• QRS QRS detection detection
– – Derivative Derivative based based methods methods
– – Pan Pan Tompkins Tompkins algorithm algorithm
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 33
Introduction
Introduction
• • Biomedical Biomedical signals signals carry carry signatures signatures of of
physiological physiological events events
• • Part Part of a of a signal signal related related to to a a specific specific event event of of
interest interest is is referred referred to to as an as an “ “epoch epoch” ”
• • Analysis Analysis requires requires identification identification of of epochs epochs
– – For For monitoring monitoring and and diagnosis diagnosis
• • The The corresponding corresponding waveform waveform may may be be
segmented segmented and and analyzed analyzed in in terms terms of of its its
– – Amplitude Amplitude, , waveform waveform, time , time duration duration, , intervals intervals
between between events events, , energy energy distribution distribution, , frequency frequency
content content
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 44
Problem
Problem
statement
statement
•
• Given Given a a biomedical biomedical signal signal, , identify identify
discrete discrete signal signal epochs epochs and and correlate correlate
them them with with events events in in the the related related
physiological physiological process process
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 55
Normal ECG
Normal ECG
• • Slow Slow P P wave wave: 0.1 : 0.1 0.2 0.2 mV mV
60 60 80 80 ms ms
• • PQ PQ segment segment: AV : AV delay delay
60 60 80 80 ms ms
– – isoelectric isoelectric
• • QRS QRS complex complex: : sharp sharp
biphasic biphasic or or triphasic triphasic wave wave
of of about about 1 1 mV mV amplitude amplitude
and and 80 80 ms ms duration duration
• • ST ST segment segment: 100 : 100 120 120 ms ms
– – Isoelectric Isoelectric
• • Slow Slow T T wave wave: 0.1 : 0.1 0.3 0.3 mV mV
and and duration duration 120 120 160 160 ms ms
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 66
PCG
PCG
signal
signal
• • S1 S1 occurs occurs at at the the onset onset of of
ventricular ventricular contraction contraction
– – Corresponds Corresponds in in timing timing to to
the the QRS QRS complex complex in in the the
ECG ECG signal signal
• • S2 is S2 is caused caused by by the the
closure closure of of the the semilunar semilunar
valves valves ( (aortic aortic and and
pulmonary pulmonary valves valves) )
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 77
EEG
EEG
signals
signals
• • Delta waves Delta waves
– – 0.5<= f < 4 Hz, appear at 0.5<= f < 4 Hz, appear at
deep deep sleep stages sleep stages
• • Theta waves Theta waves
– – 4 <= f < 8 Hz, appear at the 4 <= f < 8 Hz, appear at the
beginning stages of sleep beginning stages of sleep
• • Alpha waves Alpha waves
– – 8 <= f < 13 Hz, principal 8 <= f < 13 Hz, principal
resting rhythm resting rhythm
– – Auditory and mental arithmetic Auditory and mental arithmetic
tasks with eyes closed tasks with eyes closed
• • Beta waves Beta waves
– – f > 13 Hz, background activity f > 13 Hz, background activity
in tense and anxious subjects in tense and anxious subjects
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 88
Detection
Detection
of
of
Events
Events
and
and
Waves
Waves


1
1
•
• QRS QRS detection detection
– – Derivative Derivative based based methods methods
– – Pan Pan Tompkins Tompkins algorithm algorithm
•
• Correlation Correlation analysis analysis of EEG of EEG channels channels
– – Detection Detection of EEG of EEG rhythms rhythms
– – Template Template matching matching for for EEG EEG spike spike and and wave wave
detection detection
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 99
Detection
Detection
of
of
Events
Events
and
and
Waves
Waves


2
2
•
• Matched Matched filter filter
•
• P P wave wave detection detection
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 10 10
Applications
Applications
•
• ECG ECG rhythm rhythm analysis analysis
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 11 11
QRS
QRS
Detection
Detection
•
• Derivative Derivative based based methods methods
•
• Pan Pan Tompkins Tompkins algorithm algorithm
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 12 12
Derivative
Derivative


based
based
methods
methods
• • QRS QRS might might not not always always be be the the highest highest wave wave in a in a
cardiac cardiac cycle cycle
– – artifacts artifacts may may upset upset the the peak peak search search algorithm algorithm
• • QRS QRS complex complex has has the the largest largest slope slope ( (rate rate of of
change change of of voltage voltage) )
• • Rate Rate of of change change = = derivative derivative operator operator (d/ (d/dt dt) )
• • Derivative Derivative operator operator: :
– – P P and and T T waves waves will will be be suppressed suppressed
– – Output Output is is the the highest highest at at the the QRS QRS
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 13 13
Derivative
Derivative


based
based
algorithm
algorithm
• • Balda et al Balda et al proposed proposed an an algorithm algorithm
– – Three Three point point first first derivative derivative
• • y0[n] =  x[n] y0[n] =  x[n] – – x[n x[n 2]  2] 
– – Second Second derivative derivative
• • y1[n] =  x[n] y1[n] =  x[n] – – 2x[n 2x[n 2] + x[n 2] + x[n 4]  4] 
– – The The two two results results are are weighted weighted and and combined combined
• • y2[n] = 1.3 y0[n] y2[n] = 1.3 y0[n] – – 1.1 y1[n] 1.1 y1[n]
– – The The result result y2[n] is y2[n] is scanned scanned with with a a threshold threshold of 1.0 of 1.0
– – Whenever Whenever threshold threshold is is crossed crossed
• • Subsequent Subsequent 8 8 samples samples also also tested tested against against the the same same
threshold threshold
• • If If at at east east 6 6 pass pass the the threshold threshold test test
– – The The segment segment of of eight eight samples samples is is taken taken to to be a be a part part
of a QRS of a QRS complex complex
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 14 14
Figure
Figure
4.2
4.2
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 15 15
The
The
Pan
Pan


Tompkins
Tompkins
algorithm
algorithm
•
• Pan Pan and and Tompkins Tompkins proposed proposed a a real real 
time QRS time QRS detection detection algorithm algorithm based based on on
– – Slope Slope, , amplitude amplitude, , and and width width of QRS of QRS
complexes complexes
Bandpass
filter
Differentiator Squaring operation
Movingwindow
integrator
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 16 16
Algorithm
Algorithm
details
details
•
•
Recursive
Recursive
LPF
LPF
– – H(z) = (1/32)( (1 H(z) = (1/32)( (1 z z
 6 6
) )
2 2
)/( (1 )/( (1 z z
 1 1
) )
2 2
) )
– – y[n] = 2 y[n y[n] = 2 y[n 1] 1]   y[n y[n 2] + (1/32)[ x[n] 2] + (1/32)[ x[n] 
2x[n 2x[n 6]+x[n 6]+x[n 12] ] 12] ]
•
•
Sampling
Sampling
rate
rate
= 200
= 200
Hz
Hz
,
,
fc
fc
= 11
= 11
Hz
Hz
•
•
Filter
Filter
introduces
introduces
5
5
samples
samples
of
of
delay
delay
(25
(25
ms
ms
)
)
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 17 17
Algorithm
Algorithm
details
details
•
• HPF HPF
•
• Allpass Allpass filter filter minus minus a LPF a LPF
– – H_ H_lp lp(z) = (1 (z) = (1 z z
 32 32
)/(1 )/(1 z z
 1 1
) )
– – y[n] = y[n y[n] = y[n 1] + x[n] 1] + x[n]   x[n x[n 32] 32]
•
• H_ H_hp hp(z) = z (z) = z
 16 16
– – (1/32)H_ (1/32)H_lp lp(z) (z)
– – p[n] = x[n p[n] = x[n 16] 16] – – (1/32)[y[n (1/32)[y[n 1] + x[n] 1] + x[n]   x[n x[n 32]] 32]]
•
• fc fc = 5 = 5 Hz Hz
•
• Filter Filter introduces introduces 80 80 ms ms of of delay delay
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 18 18
Derivative
Derivative
operator
operator
•
•
y[n] = (1/8) [ 2x[n] + x[n
y[n] = (1/8) [ 2x[n] + x[n


1]
1]
–
–
x[n
x[n


3]
3]
–
–
2x[n
2x[n


4] ]
4] ]
– – Approximates Approximates the the ideal d/ ideal d/dt dt operator operator up up
to to 30 30 Hz Hz
•
•
Suppresses
Suppresses
P
P
and
and
T
T
waves
waves
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 19 19
Squaring
Squaring
•
• Makes Makes the the results results positive positive and and
emphasizes emphasizes large large differences differences arising arising from from
QRS QRS complexes complexes
•
• Small Small differences differences arising arising from from P P and and T T
waves waves are are suppressed suppressed
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 20 20
Integration
Integration
• • Multiple Multiple peaks peaks within within the the duration duration of a of a single single
QRS QRS complex complex
• • Smoothing Smoothing of of the the output output of of the the preceding preceding
operations operations through through a a moving moving window window integration integration
filter filter
– – y[n] = (1/N) [ x[n y[n] = (1/N) [ x[n – – (N (N 1)] + x[n 1)] + x[n – – (N (N 2) + 2) + … …+ +
x[n] ] x[n] ]
– – N: N: window window width width (N=30 (N=30 found found to to be be suitable suitable
for for fs fs=200 =200 Hz Hz) )
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 21 21
Adaptive
Adaptive
thresholding
thresholding
•
• A A peak peak is is said said to to be be detected detected whenever whenever
the the final final output output changes changes direction direction within within a a
specified specified interval interval
Dr. Bülent Yilmaz Dr. Bülent Yilmaz BME402: BME402: Biomedical Biomedical Signal Signal Processing ProcessingII II 22 22
Figure
Figure
4.6
4.6