Professional Documents
Culture Documents
Full Thesis PDF
Full Thesis PDF
by
A. B. M. Aowlad Hossain
A Thesis
Submitted to the Department of
Electrical and Electronic Engineering, BVET,
in partial fulfillment of the requirements for the degree of
MASTER OF SCIENCE IN
ELECTRICAL AND ELECTRONIC ENGINEEIUNG
ll~P'l...ij.!.~ill!1
~_
---.-- -
•• ::::::::r
m;:w
NOY..EMBER.200S--
t
:/ ~-===~
.. ililmiji,ilim~"r=;;II
er'
•• '11
1 #10103911
., .I
... ..:=-.---= __ _ _ . ~_'_ ...••...•..•_. J
. -.~--
,
The thesis titled Noise Sensitivity Analysis of Different ECG Detection Algorithms
Submitted by A. B. M. Aowlad Hossain Roll No: 040306225 F Session April 2003
has been accepted as satisfactory in partial fulfillment of the requirement for the
degree of Master of Science in Electrical and Electronic Engineering on 26
November 2005.
BOARD OF EXAMINERS
~ 'I-'/II/6S'
I. Dr. Md. Aynal Haque Chairman
Professor (Supervisor)
Dept. ofEEE, BUET, Dhaka
,,
,
••
ii
CANDIDATE'S DECLARATION
It is hereby declared thal this thesis or any part of it has not been submitted elsewhere
for the award of any degree or diploma.
A. B. M. Aowlad Hossain
-iii
ACKNOWLEDGEMENTS
The author would like to express his indebtedness and gratitude to his supervisor Dr.
Md. Aynal Haque for his endless patience, effective supervision and invaluable
The author wishes to express his thanks and regards to the I-lead of the Department of
Electrical and Electronic Engineering, BUET, Dhaka, for the opportunity to do this
work.
The author also expresses sincere thanks to Dr. A. K. Azad, Professor and I-lead,
Department of Computer Science and Engineering, KUET, Kliulna for his
encouragement in completing the work.
Sincerest gratitude for my family specially to my parents who have always supported
my studies.
Sincerest thanks to friends and colleagues for their encouragement, technical advice
and criticism of the thesis work.
. .
iv
CONTENTS
Acknowlcdgcmcnts iv
Abstract vii
List of Abbreviations viii'
List of Figures ix
List of Tables xl
I INTRODUCTION 1
l.l Historical Background I
1.2 Scope of the Thesis 4
1.3 Organization of the Dissertation 5
3 NOISE DESCRIPTION 26
3.1 Introduction 26
3.2 Disturbances of Physiological Origin 26
3.2.1 Baseline Shift 27 .
3.2.2 Muscle Noise 28
3.2 Disturbances of Technical Origin 29
3.2.1 Power Line Noise 29
3.2.2 Electrode Contact Noise 31
3.2.3 Motion Artifacts 31
3.2.4 Noise Generated by Signal Processing Equipments 32
3.2.5 Electrosurgical Noise 32
v
4 SIMULATION STUDY 33
4.1 Introduction 33
4.2 Description of the Database 33
4.3 Realization in MATLAB@ 34
4.4 ECG Signal Characteristics 35
4.5 Noise Simulation 37
4.5.1 Power Line Noise 38
4.5.2 Electromyographic (EMG) Noise 38
4.5.3 Baseline Drift Noise 41
4.5.4 Abrupt Shift Noise 41
4.5.5 Composite Noise 44
4.6 QRS Detection Algorithms 44
4.6.1 Algorithm Parameter Determination 46
4.6.2 Algorithm Based on Amplitude and First Derivative 46
4.6.3 Algorithm Based on First Derivative 48
4.6.4 Algorithm Based on First and Second Derivative 49
4.6.5 Algorithm Based on Digital Fiiter (FIR) 51
4.6.6 Algorithm Based on Digital Filter (IIR) 53
4.6.7 Neural Network Analysis for QRS Detection 56 .
4.6.7.1 -Forwardpass - 58
4.6.7.2 Back-propagation pass 60
4.6.7.3 QRS Detection 62
4.6.8 Wavelet Transform Analysis for QRS Detection 63
4.6.8.1 Discrete Wavelet Transform and Multiresolution
Analysis 65
4.6.8.2 Wavelet Selection 68
4.6.8.3 Wavelet-based Denoising 68
4.6.8.4 QRS Detection 73 .
4.7 Performance Analysis 75
4.7.1 Analysis for Noise free ECG signal 76
4.7.2 Analysis for Power Line Interference Corrupted ECG Signal 81
4.7.3 Analysis for Base Line Drift Corrupted ECG Signal 83
4.7.4 Analysis for Abrupt Base Line Shift Corrupted ECG Signal 85
4.7.5 Analysis for Electromyographic Noise Corrupted ECG Signal 90
4.7.6 Analysis for Composite Noise Corrupted ECG Signal' 95
5 CONCLUSION 102
5.1 Discussions 102
5.2 Future Perspective 104
APPENDIX 105
REFERENCES 112
vi
ABSTRACT
The electrocardiography is fully non-invasive, totally harmless and quick method for
measuring the electrical activity of the heart. Computer based automatic recognition
of electrocardiogram (ECG) characteristic points is necessary to help physicians for
quick and easy diagnosis of cardiac conditions. Because of its specific shape, the QRS
complex serves as an entry point for almost all automated ECG analysis algorithms.
Despite large variety of existing QRS detection algorithms, large diversity of the QRS
complex waveforms and the noise & artifacts accompanying the ECG signals make
no single algorithm universally acceptable. Also, most recent algorithms are not tested
for noise corrupted ECG signal.
In this thes.is, the noise. sensitivities of different QRS detection algorithms are
analyzed for ECG signal taken from MIT-BIH Arrhythmia database. The algorithms
based on amplitude and first derivative (AFD), first derivative (FD), first and second
derivative (FSD), FIR digital filter, IIR digital filter, neural network (NN) and wavelet
transform (WT) are applied to the ECG corrupted with five different types of
synthesized noise with different noise levels. The noise types are electromyographic
(EMG) interference, 50 Hz power line interference, base line drift due to respiration,
abrupt baseline shift and a composite noise constructed from the other noise types.
The noise levels arc 25%, 50%, 75% and 100%. The origin of noises, their'
characteristics and consequently their effects on QRS complex detection are
discussed.
The number of false positives & negatives and the percentage error rate of QRS
complexes detected are calculated for different types 0 f noisy and noiseless E CG.
None of the algorithms are able to detect all QRS complexes without any error for all
of the noise types at the highest noise level. Algorithms based on digital filter (both
FIR and IIR), NN and WT show very small deviation of error rate to power line and
baseline drift noise up to maximum level. Algorithms based on AFD, FD and FSD are'
insensitive to base line drift but sensitive to power line noise of higher level and order
of derivati~e. Algorithms based on derivatives arc very sensitive to abrupt base line
shift and EMG noise and conventional digital filter cannot eliminate these noises also.
Algorithms based on NN and WT show better performance considering all noise
types. Up to 100% of all noise, total 235 datasets (5,37,070 beats) are used to evaluate
the performance. WT based algorithm gives mean percentage error rate of 7.76%
while NN based algorithm gives 7.84%. The result of this study will help to develop a
more robust ECG detector and this will make ECG interpretation system more
effective. .
. vii
List of Abbreviations
ANN Artificial Neural Network
ANS Autonomic Nervous System
AR . Autoregressive
AV Atrio- Ventricular
BUI Beth Israel Hospital
CWT Continuous Wavelet Transform
DF Digital Filter
DWT Discrete Wavelet Transform
ECG Electrocardiogram
EMG Electromyogram
FIR Finite impulse response
FIXTHRES Fixed Threshold
FFT Fast Fourier Transform
GA Genetic Algorithm
HF High frequency
HMM Hidden Markov Model
HR Heart rate
HRV Heart rate variability
IIR Impulse Response Filter
LBBB Left Bundle Branch Block
LF Low frequency
LMS Least mean square
LVQ Linear Vector Quantization
MIT Massachusetts Institute of Technology
MLP Multi Layer Perceptron
NN Neural Network
QMF Quadrature mirror filter
QRS Q-, R-, and S-waves in electrocardiogram
RBBB Right Bundle Branch Block
SA Sino-Atrial
SD Standard deviation
SOM Self Organizing Map
STFT Short Time Fourier Transform
SURE Stein's Unbiased Risk Estimate
TFR Time Frequency Representation
TLFN Time Lagged Feedforward Network
WT Wavelet Transform
,
viii
List of Figures
2.1 The mechanical and electrical components of the heart 7
2.2 ECG tracing over time 8
2.3 The physiological correspondence between the cardiac cycle and the
ECG signal 8
2.4 Einthoven's triangle showing how leads I, II, and III are recorded II
2.5 12-Lead ECG. A diagram illustrating the position and combinations
of the 12 leads electrocardiogram recordings 12
2.6 A sample Daubechies Wavelet 17
2.7 Multi-layer perceptron 19
2.8 LVQ Network 20
2.9 Prediction Filter 21
3.1 Base line shifted ECG Signal 28
3.2 ECG signal corrupted with muscle (EMG) noise 29
. 3.3 a) Power line interference in ECG signal. b) Frequency spectrum of
power frequency noisy ECG signal 30
3.4 Abrupt base line shift in ECG signal 31
4.1 a) Time and frequency domain representation for one period of an
electrocardiogram signal. b) Time and frequency domain
representation Spectrum of a signal containing many' beats of an
electrocardiogram 36
4.2 ECG corrupted by power line noise of different levels;
(a) 25%, (b) 50%, (c) 75% and (d) 100% 39
4.3 ECG corrupted by electromyographic noise of different levels;
(a) 25%, (b) 50%, (c) 75% and (d) 100% 40
4.4 ECG corrupted by baseline drift noise of different levels;
(a) 25'Yo, (b) 50%, (c) 75% and (d) 100% 42
4.5 ECG corrupted by abrupt baseline shift noise of different levels;
(a) 25%, (b) 50%, (c) 75% and (d) 100% 43
. 4.6 ECG corrupted by composite noise of different levels;
(a) 25%, (b) 50%, (c) 75% and (d) 100% 45
4.7 Response for First Derivative filter 47
4.8 ECG Signal and its First Derivative 47
4.9 Response for Parabolic Smoothing filter 48
4.10 ECG Signal and Parabolic Smoothing filter output 48 '
4.11 Response for Moving Average Filter 49 .
4.12 a) ECG Signal b) Rectified first derivative signal c) Output of
Moving Average Filter d) Rectified second derivative signal e) Sum
of (c) and (d) . 50
4.13 Response for Low Pass Filter (FIR) 51
4.14 a) ECG Signal b) Output of Moving Average Filter c) Output of
Low Pass Filter d) Square of Output to Input Difference of Low Pass
Filter e) Enhancement ofQRS Peaks t) Pruning of False Peaks 52
4.15 Process involved in the QRS detection algorithm 53
4.16 Response for Low Pass Filter (IIR) 54
4.17 Response of High Pass Filter 54
4.18 The relationship of a QRS complex to the moving average
ix
waveform: ECG signal and Output of the moving average filter. QS:
QRS width. W: width of the moving average filter 55
4.19 a) The digitized ECG signal, b) after band pass filtering. c) after
band p ass filtering and differentiating. d) after band pass filtering,
differentiating and squaring. e) the final process; after band pass
filtering, differentiating, squaring and moving average filter 56
4.20 Functional Description of a Single Neuron 57
4.21 A 3-2-2 Configured Multilayer Perceptron with Direct Input-Output
Connection 57
4.22 Block Diagram of the Detection Algorithm 58
4.23 The Time Lagged Feedforward Network 59
4.24 Mean Square Error vs. Epoch Curve during training 62
4.25 a) Noisy Signal b) Noise Removing by NN c) Averaging and
Smoothing d) Match Filtered Signal 63
4.26 Equivalent frequency response of DWT at different scales 65.
x
List of Tables
xi
Chapter 1
INTRODUCTION
ECG is the representation of the bioelectric potential generated by the muscles of the
heart. ECG is a standard tool to diagnose heart diseases. Physicians record ECG easily
and noninvasively by attaching small electrodes to the human body. The Holter ECG
device is used most frequently for recording the ECG. Physicians apply the device to
a patient when they need to monitor his or her ECG to find the few abnormal cycles in
the, ECG throughout the day. They first locate such fiducial points as Q, R, S in the
ECG from which they locate P waves, QRS complexes, T waves and U waves and
then interpret the shapes of those waves and complexes. They calculate parameters to
determine whether the ECG shows signs of cardiac disease or not. The parameters are
the height and the interval of each wave, such as R-R interval, P-P interval, Q-T
interval and S-T segment. The process is very much time consuming i.e. recognition
of the fiducial points and calculations of the parameters is a tedious work.
2
Approximately 1,00,000 cardiac cycles are recorded per patient in a day with a Holler
device. The physicians have to interpret this large amount of ECG data to search for
only a few abnormal cardiac beats in the ECG. Physicians may overlook some
abnormal cycles because they have to interpret such a large amount of data. The ECG
signal may be masked by noise and interference, and the signal features may not bc
readily comprehensible by the visual systems of a human observer. Furthermore, the
variability present in a given type of signal from one subject to another, and the inter-
observer variability inherent ip subjective analysis performed by physicians or
analysts make consistent understanding or evaluation of a~y phenomenon difficult, if
not impossible. Analysis of signals by human observers is almost always
accompanied by perceptual limitations, interpersonal variations, errors caused by'
fatigue, errors caused by the very low rate of incidence of a certain sign of
abnormality, environmental distractions, and so on. These factors created the need not
only for improved instrumentation, but also for the development of methods for
objective analysis via signal processing algorithms implemented in electronic
hardware or on computers. The interpretation of a signal by an expert bears the weight
of the experience 'and expertise of the analyst; however, such analysis is almost
always subjective. Computer a nalysis of biomedical signals, if performed with the
appropriate logic, has the potential to add objective strength to the interpretation of
the expert. Therefore, there is an urgent need for an automatic ECG interpreting
system to help to reduce the burden of ECG interpretation.
between these peaks are compared to threshold. However there are many sources of
noise in a clinical environment that can degrade the ECG signal. To avoid power line
noise and to reduce the influence of the muscle artifact and base line shift, digital
filter used [13]-[15]. Application of the match filter discussed in [16], where the
problem of defining an accurate fudicial point also considered. Most of the current
QRS detector can be divided into two stages: a preprocessor stage to emphasize the
QRS complex and a decision stage to threshold the QRS enhanced signal. Typically
the preprocessor stage consists of both linear and non-linear filtering of the ECG. The
ECG is first band pass filtered to reduce noise and differentiated to emphasize the
large slope of the Rwave; itis then squired to further exploit the high frequency
content of the QRS complex. A short time frequency estimate is obtained by
smoothing the resulting signal with a integrator [13], [15]. Afonso et al. [17] have
proposed filter banks for ECG signal decomposition in separate frequency bands,
where scveral features were independcntly computed and combined in a decision rule.
Artificial ncural network have been widely accepted for pattern recognition tasks.
Their abilities to learn from examples and extract the statistical propertics of the
examples presented during training sessions make them ideal choice for an automated
process that imitates human logic. Several efforts have been made to apply artificial
neural network for the purpose ofECG beat detection [18]-[23]. A time lagged neural,
network was a pplied as a n adaptive filter [18], where current sample predict from
immediately previous samples was also employed to detect QRS complexes. Wavelet
tninsform (WT) has becn applied to ECG analysis specially for QRS detection [24]-
[29]. Discrete wavelet transform (DWT) exhibits local maxima at successive scales at
the time of oCCUrrenceof transients, and since the QRS complex is transient in ECG
signal. Furthermore for its application as filter bank [30], different algorithms based
on wavelet transform proposed. Other approaches reported for QRS detection include
artificial intelligence using hidden Markov models [31], genetic algorithm [32], fuzzy
hybrid neural network [23], mixture of experts approach [33], etc.
The ECG signal is usually contaminated by noise of various origins. The predominant
types of noise are base line wander, power line interference, electromyographi?
(EMG) noise and electrode motion artifacts [2], Noise sensitivities for QRS detection
4
algorithms based on slope and simple digital filters were measured by Friesen et al..
[34] with only 32 second normal ECG data corrupted with different types of
synthesized noise. A wavelet transform based QRS detector is compared with digital
filter and multiplication of backward difference (MOBD) algorithms by S. Kadambe
[24], using two types of noises; power line noise and EMG.noise.
The overall goal of this thesis is to quantify the relative noise susceptibility of
different recent and formerly proposed QRS detection schemes that tested against a
standard database of reasonable size and different types of noise contaminated ECG
signal at different noise level. The result of this study will help in the development of
a more .robust ECG detector by making signal processing more effective.
Chapter 3 provides a background of how the noise generated and describes about the
source of noises from both physiological and technical viewpoint. A brief description
of each noise signal will be given. Additionally, the chapter gives the identification of
the pertinent characteristics of each noise signal.
Chapter 4 gives a description of the materials and methods used in this study..The
ECG database that is used in this work is discussed. This chapter goes into detail
about simulation of different types of noise and about differcnt typcs of QRS
detection algorithms used in this study. These chapters also explains how the
experiments were conducted, the accuracy results, and the meaning of the results and
evaluates and compare the performance of different QRS detection algorithms against
a standard database and against contaminated ECG data corrupted with different types
noise at different level. Finally, this chapter provides an an~lysis of the overall
performance of different QRS detection algorithms used in this study.
.~.
,. \
Chapter 2
2.1 Introduction
One must have a clear idea about the Electrocardiogram (ECG) waves before going
for the recognition of the ECG patterns. Also the knowledge about the structure and
the conducting system of the heart i.e. a clear view of the heart anatomy is also very
important. So, before getting familiar with the ECG detection it would be helpful to
provide some idea about the heart anatomy, the conducting system of the heart, the
generation of ECG waves and it's several parameters. This chapter describes how the
bioelectric potential generated from heart and presents variety of QRS detection
algorithms .
. 2.2 Electrocardiogram
In order to fully appreciate the significance and meaning of the diagnoses of heart
ailments via the ECG, it is important to understand the manner in which the heart
functions The cardiac muscle (heart) is the center of the cardiovascular system. This
muscle pumps life-sustaining blood to the entire body. The blood supplies oxygen and
nutricnts to thc body's organs so that they can perform their designated functions. The
heart is controlled by a very precise electrical system. This system regulates thc
mechanical pumping action of the heart so that the entire cardiovascular system can
function properly. If a problem occurs in the electrical system of the heart, it can have
devastating effects for the entire body.
muscular pump, known as the heart, pumps blood throughout the body. A complex set
of arteries, vessels and capillaries connect the heart to the entire body.
(ECG), for a single heartbeat. The labels indicate the approximate location of the
important waves and components of the ECG signal.
•...•.....• sec
0_04 , 0.2 aee ,
>
~I
=
x
~ - -
T ••
-..- ~
f:
-
i!i T
1 R
~ ...•.- -
Fig. 2.2: ECG tracing over time
The relationship between the ventricular volume, pressure and ECG of the entire
cardiac cycle, systole and diastole can be seen in Fig. 2.3. From these figures, one.
can draw parallel between the heart's activity with the electrocardiograph signal
recorded.
Fig. 2.3: The physiologicalcorrespondencebetweenthe cardiac cycle and the ECG signal.
Node Ventricles
The first stage of a heartbeat begins when the sino-atrial (SA) node of the heart
depolarizes. During this stage, the right atrium is filled with oxygen-devoid blood that
has returned from the circulatory system and the left atrium is filled with oxygcn-rich
blood that has returned from the pulmonary circulation. The SA node, located on the
posterior wall of the right atrium, is the pacemaker of the heart, depolarizing at '
regular time intervals to ensure proper pacing. In a normal heart, the rate at which this
node emits pulses is directly correlated to the amount of work that the heart as doing.
As the body works harder and requires more oxygen-rich blood, the SA node
increases its p ace to satisfy t he demand. The electrical impulse from t he SA node
causes the upper portion of the heart, called the left and right atrium, to dcpolarize.
This depolarization cauSes the atria to contract forcing the blood from these chambers,
downward into the large lower portion of the heart, called the ventricles. The
10
corresponding component of the electrical signal is the P wave. As soon as the atria.
have completely contracted, they begin to repolarize in preparation for the next beat.
The electrical signaturc of the repolarization is not disccmable in the clectrical signal
because it 0 ccurs at the same time as t he ventricular contraction, which yields the
large QRS complex [3].
Following the depolarization of the atria, the depolarizing wave fronts signals
converge at the atrioventricular (AV) node. The AV node serves two very important
purposes. Its first purpose is to bridge the electrical signal from the atria to the
ventricles. T he second purpose is to slow the electrical depolarization to allow the
blood to completely flow from the atria to the ventricles. The electrical depolarization
propagates from the AV node to the His Bundles, which are located at the base of the
ventricles. The His Bundles lead to the bundle branches and then into the purkinje
fibers, which rapidly spread the depolarizing wavefront across both ventricles. This
electrical signal moves rapidly across the ventricular tissue causing the muscles of the
ventricles to pump the blood to the rest of the body. The right ventricle pumps the
oxygen-devoid blood to the pulmonary system for oxygenation. The left ventricle
pushes the oxygen-rich blood to the circulatory system to bring oxygen to the body.
Following the depolarization and contraction, the ventricles begin to repolarize to
prepare for the next cycle.
As long as the heart is operating properly, the process described above repeats
rhythmically with a natural variability. Generally, the resting heartbeat of a healthy
person is about 60-80 BPM [4]. If the electrical system of the heart does not properly
function, the heart's rhythrn can become abnormal. This directly affects the heart's
ability to supply blood to the entire body. To monitor for such problems, physicians
record and analyze the cardiac electrical signals using the electrocardiogram (ECG).
Body tissues are conductors of electricity. Hence the electromotive forces which arise
from heart muscles (myocardium) as a result of electrical activity of cardiac cclls give
rise to clcctric ficlds and current throughout the torso (which is a volumc conductor
11
and is linear, resistive, inhomogeneous, anisotropic, and bounded [35]) and therefore
electric potentials on the skin [36].
loft log
Figure 2.4: Einthoven's triangle showing how leads I, II, and III are recorded
12
Lead I
I ..•...•
6
Fig. 2.5: l2-Lead ECG. A diagram illustrating the position and combinations
of the 12 leads electrocardiogram recordings.
These augmented leads are unipolar in that they measure the electric potential at one
point with respect to a null point (one which doesn't register any significant variation
in electric potential during contraction of the heart).
13
This null point is obtained for each lead by adding the potential from the other two
leads. For example, in lead aVR, the electric potential of the right arm is compared to
a null point which is obtained by adding together the potential of lead aVL and lead
aVF (Figure 2.5).
The ECG measures the change in the .electrical potential across the electrodes. The
recorded potential is converted to a waveform after signal filtering and amplification.
In this work, each waveform will be referred to as a lead.
Hz. The attenuation of the P- and T-wave, baseline drift requires high-pass filtering
and the suppression of incoupling noise is accomplished by a low-pass filter. The
combination of low and high pass means a band-pass filter. In many algorithms high
and low pass filter carried out separately. Some a Igorithms use only the high pass
filter part.
yl (n)=x(n)-x(n-I) (2.3)
IX('ll
where x (n)= {
o Ix('JI<0
and 0 is an amplitude threshold determined from the measured ECG signal x(n). In
most cases the defferentiator from eq" (2.1) is used. Some algorithms also computed
the second derivative. It can be estimated by,
y2(n)=x(n+2)-2x(n)+x(n+2) (2.5)
Typical features z(n) of such algorithms are the differentiated signal itself [6],[7],
z(n)=yl(n) (2.6)
a linear combination of the magnitude of the first and second derivative [12]
or a linear combination of the smoothed first derivative magnitude and ,the magnitude
of the second derivative [10],
15
where the maximum is determined online or from the current signal segment. Most
QRS detector use this or a similar method to determined the threshold.
This nonlinear operation leads to a relative suppression of small values and a slight
smoothing of peaks. The feature signal zen) is formed out of y2(n) by putting
additional sign constraints on the output signal of the low pass with the higher cut off
frequency. The threshold is computed adaptively bye,;, ma.x[z(n)]/8.
The algorithm describes in [15] and [38] uses basically the same preprocessor. The
ECG is band pass filter and afterwards differentiated. The feature signal z(ll) is
computed by squiring and averaging the output of the differentiator. The band pass
and differentiator use filter coefficients that are particularly suited for an
implementation on fixed-point processors with a short word length. For the peak
detection a variable, v is introduced that contains the value of the most recent feature
maximum. Peaks in the feature signal are detected by comparing the feature against.
v. If the feature drops below v /2 a peak is detected. Then the current value of v is
16
taken as the peak height and v is reset tom the current value of the feature signal
v=z(n). The fudicial mark is set to the location of the largest peak in the band-pass
filtered signal in an interval from 225 ms to 125 ms preceding a peak detection. The
fudicial mark and the height of the peak are put into an event vector that is further
processed by the decision stage. In the decision stage, a QRS peak level Lp and a
(2.12)
Where AN and A, are forgetting factors (e.g. A'" 0.98) and Ap is the peak
(2.13)
K,L>O (2.14)
are proposed in [38]. Such filters have a linear phase response and are
computationally highly efficient. They were applied, for example in [14], where (K,
L)=(5,4) at a sampling frequency 250 Hz.
17
...,
Wf(a,b) = If(I)If'".h(l)d1 (2.15) ,
-~
Where If '(1) denotes the complex conjugate of the wavelet If (I). The wavelet
transform use a set of analyzing functions, that allows a variable time and frequency
resolution for different frequency bands. The set of analyzing functions, the wavelet
'f'",1' (I) =
I If (I-a-
.fi - bJ (2.16)
where a and b are the dilation (scale) and translation parameter respectively. The
mother wavelet is a short oscillation with a zero mean as in fig 2.6.
. ... . "'" ._- - -,-_ .... _ .. _._,'----'---' ..-------,._. - .... -, ---_ .. _-..,-
o .08
o .06 -
o .04
o .02
.0.0" -
•0 .0 4 .
• 0 _0 6
,...
.... - - , . _. __ . - .' , ,---
The discrete wavelet transform (DWT) results from discretized scale and translation
parameters; e.g., a=i and b=n.i where j and n are integer numbers. This choice of a
and b leads to the dyadic DWT (DyWT) .
...,
Wf(2j ,b) = ff(l)If',I.h(l)dl (2.17)
-~
18
with
'l'".b ()1=- I
21/2 If/
(t - b)
-21
and j,ne Z
segments, the neural network converges to a point where samples from non-QRS
segments are well predicted. Segments with sudden changes (i.e., QRS segments)
follow a different statistics .and lead to a sudden increase in the prediction error. It
follows that the prediction error e(ll) can be used as a feature signal for QRS
detection.
~(t)
+
Linear Layar
Competitive
Loyer
1nP\l1
Loyer
ECG x(n)
~x(n-l) x(n~2)x(n~) x(n-4)x(n-5)
I x(n-P)
As reported in [22) the results do not reach the results of classical approaches, such as
[15). However, once trained the LVQ network offers fast computations and
furthermore a discrimination between QRS and PVC contraction.
Adaptive Filters
The application of adaptive prediction filters to QItS detection has been investigated
e.g. in [16]. Figure 2.9 shows the structure of an FIR prediction filter. Similar to the
nonlinear case (see the previous section) the objective of the filter is to gain an
estimate x (II) for the current signal sample x(ll) from the past signal values by means
of a weighted superposition; that is,
21
r
x(n) = La,(n)x(n -i) (2.18)
;=1
with the time-variant coefficients a,(n), i=1...P. They are adaptively adjusted
. according to the changing signal statistics. From the literature several adaption rules
for the coefficients are known; e.g. the least mean square (LMS) algorithm
where a(n) = [a,(n), a,(n), , ar(n) f denotes the coefficient vector at time II,
A, is the step size parameter. e(n)=x(n)-x (II ) denotes the prediction error and
X(II)=[ x(II-I), x(n-2), ,x(n-p) f is the vector of the time delayed ECG signal
samples.
1
a.(:; ..... ~ lpln)
. I
__ ,-+1,$
-X{n) ;
-_.~
Fig. 2.9: Prediction Filter.
Further applications of adaptive filters to QRS detection are reported in [30] and [41].
In [30] it was shown that at a sampling frequency of 500 Hz two tap filters are
sufficient for a good prediction performance. In [41] the application of a .
midprediction filter
. p
x(n) = La,x(n-i) (2.20)
k=-P
is proposed.
22
The advantage of this detection method is that not only the QRS complex is
determined but also P- and T-waves. Problems of the method include a necessary
manual segmentation for training prior to the analysis of a record, its patient
dependence and the considerable computational complexity even when the
computationally efficient Viterby algorithm [31] is applied.
Matched Filters
Besides the neural-network-based matched filtering approach in [19], there are linear
matched filtering approaches as, for example reported in [42]. In [42], after some
analog preprocessing steps such as an automatic gain control, the ECG signal is
digitized and further processed by a comb filter (low-pass) with a notch at 50 Hz and
a band-pass filter with cut-off frequencies at 15 Hz and 40 Hz. This digital filter stage
is followed by a matched filter for further improvement of the signal-to-noise ratio
(SNR). The matched filtering is accomplished by
N-I
y(n) = 2:h(i)x(n -i)'
1=0 (2.21 )
where the impulse response h(n) is the time-reversed template of the waveform to be
detected. The impulse response of the matched filter h(n) is manually taken from the.
first cardiac cycles of the current measurements; i.e, it needs to be determined
interactively. For further enhancement of the timing accuracy, the output of the
matched filter is interpolated up to four times the original sampling frequency. The
23
final decision about a QRS complex is taken by comparing the filtered signal against a
fixed threshold. It is reported in [42] that the matched filter also improves the timing
accuracy of the detected R-wave.
Genetic Algorithms
In [32], genetic algorithms have been applied to a combined design of optimal
polynomial filters for the preprocessing of the ECG and the parameters of a decision
stage. Polynomial filters are defined by [32].
M MM.
L';<M (2.22)
where the d j , are delays with respect to the time n. Three different special cases of a
I
= xH (I) = x(t) *- (2.23)
m
and may be computed in the frequency domain as
X ,,(jOJ) = x(jOJ).[- j.sgn(OJ)]
=x(jOJ).H(jOJ) (2.24)
-J
H(jOJ) ={ J (2.25)
Using the fast Fourier transform (FFT), the Hilbert transform can easily be computed.
In [44] the ideal Hilbert transformator is approximated by a band limited (2N +I)-tap
FIR filter with the impulse response h(n). For example, the impulse response for the
filter of the order N =11 is given by [44].
Impulse responses for other filter orders are listed in [44]. The Hilbert transform
xH (n) of the ECG signal xH(n) is used for the computation of the signal envelope [44]
(2.28)
In order to remove ripples from the envelope and to avoid ambiguities in the peak
level detection, the envelope is low-pass filtered. Additionally, in [44] a waveform
adaptive scheme for the removal of low frequency ECG components is proposed.
The method published in [43] is related to the algorithms based on the Hilbert
where XI (n) and x, (n) are the outputs of two orthogonal digital filters; i.e.,
In order to remove noise, the envelope signal x, (n) is smoothed by a four-tap moving
average filter.
investigated. The transforms are defined for multi-channel ECG signals but may also
/~l
L(n,q,i) = 2....
k=i (2.32)
length transform
I~I n
cnergy transform
where n is the number ofECG channels, i is the time index and Llxj.,= :>j.' -xj.,_,.
These formulas are based on the assumption that the derivatives of the ECG channels
can be considered as the elements of a vector. The length of the vector is determined'
from the square root of the second sum in Eq. (2.33). The length transform represents
a temporarily smoothed time course of the vector length. A similar assumption leads
to the encrgy transform, which can be interpreted as the short-term e'ncrgy cstimation
of the vector. The authors [45] state that both transforms are superior to conventional
transforms for feature extraction, whereas the length transform works particularly
NOISE DESCRIPTION
3.1 Introduction
There are many sources of noise that degrade the ECG signal quality. The ECG is
particularly susceptible to low frequency noise, known as baseline shift and ECG
amplitude modulation with respiration, which induces false changes in the ECG
waveform shape. Other noise sources are muscle noise (Electromyographic, EMG);
power-line noise, electrode contact noise, instrumentation noise generated by
electronic d9vices used in signal processing and electrosurgical noise and other less
significant noise sources [2]. The causes of ECG artifacts are poor skin contact, gel
drying up due to exposure to air for long time, damaged cables, skeletal muscle
contraction, electrocautery. While using electrocautery, placing of the ground plate
should such a way that, current path from the surgical site to ground plate is far from
chest. This chapter provides a brief description about sources of noise that degrade the
ECG. signal and identification of the pertinent characteristics of each noise signal will
be given.
Typical parameters:
Amplitude Variation -15 % of peak to peak ECG amplitude
Baseline Variation - 15 % peak to peak ECG amplitude variation at 0.15 to
0.30 Hz
A major problem with baseline shift is that its spectrum is often wide and overlaps
with that 0f the E CG signa!. To design an optimal filter to remove baseline shifts
would, by definition, require a-priori knowledge of the E CG signal spectrum. The
ECG waveform itself is only quasi-stationary so it is impossible to define a fixed
frequency spectrum and how to optimally filter out the '1:Jaseline shift without
removing the important information within the ECG signa!. The signal enhancement
scheme must therefore be carefully designed so that the important information in the
ECG waveform is not lost or distorted. There are periods of very poor quality data
when significant baseline shift energy still remains despite the signal enhancement.
28
(a)
,~,
.:.
t
• • I(H..'
• 1'.'\' '
.;.-,( ..
...:J'n.O •
0:'\01')"
.
.;>(••'~
-------_
4"'''' .
•.•.•••
Ie)
..•••lUI.",'
...•"'. "',.' 1 ~'n
•'• ..•....,
Fig. 3.1: Base line shifted ECG Signal
impulses, and this can be measured from the body surface. Muscle noise is caused by
the random firing of muscle fibers. An example of muscle noise is shown in Figure
3.2. Muscle noise obscures the important features and timing points, such as the P, Q,
R, Sand T peaks. Muscle contractions caused artifactual millivolt level potentials to
be generated. The baseline of electromyogram is usually in the microvolt range and
therefore is usually insignificant, as shown in figure 3.2. Its spectrum spans that of the
ECG signal and so it can never be completely removed with linear filtering.
29
1.4
1.2
0.8
0.6
Typical parameters:
Standard Deviation - 10 percent of peak to peak ECG amplitude
Duration - 50 msec
Frequency Content - de to 10000 Hz
~.'.
30
Harmonics of 50Hz are observed in the power-spectrum of the ECG signal shown in .
Figure 3.3(b).
1(00
(0)
'!{l]
WI
i 0
.t.ClI
• roO)
M>I#I'>I"JJ.j~IM,j/~J.~
" ;\ '(0
Salllp k'es
~'I) 'ffl ;Iro
. ,,,';'10'
:l! H (0)
1 Plll\.rlnt I'IQi;e,*1'IQ11C;
,
I
1~ /-" /
..
1. \
I • 'J \
(lJ )
I 01.
°D
'\f!.,
;)
,
100
I
Ftoqumy (fj~
'!J
1!11 100
Typical parameters:
Frequency content - 50 Hz fundamental with harmonics
Amplitue - up to 50 percent of pick-to-pick ECG Amplitude
If power-line noise is not suppressed it can obscure the P, Q, R, Sand T peaks in the
ECG waveform and distort their true amplitudes. The QRS amplitude, which is used
throughout the system as a physiological constant, will jitter in the presence of power-
line noise and so it is important that is removed. The fundamental harmonic is 50Hz
which lies within the useful spectrum of the ECG waveform. Care has to be taken in
designing a filter to remove unwanted 50Hz power from the signal. The 100Hz peak
shown Figure 3.3 in is outside the useful spectrum of the EeG, so could be removed
by low-pass filtering.
',~
31
Frequency - 60 Hz
Time constant - about 1 second
figure 3.4.
1.6
,.
n !J
u
-
1
. 1 () ~_>OCl 1000 2000 2~:;OO :lOOO
•
32
Typical parameters:
Duration - 100 - 500 msec.
Amplitude - 500 percent of peak-to-peak ECG amplitude.
Typical parameters
Amplitude -:-200 percent of peak to peak ECG amplitude
Frequency Content - Aliased 100 kHz to I MHz
Duration - I to 10 seconds
Chapter 4
SIMULATION STUDY
4.1 Introduction
Noise sensitivity analysis of different QRS detection algorithms against different
types of noisy and noiseless ECG signal is the main focus of this chapter. Evaluation
of these algorithms should be done using well-annotated and validated standard
database. One of the available standard database, MIT-BIH arrhythmia database used
in this study. A key part to understand a particular process is to model it by means of
simulations. Different types of noise described in the previous chapter are simulated
in this chapter. The QRS detection algorithms are implemented and applied against
noisy and noiseless signal. The project demands various mathematical, digital signal
processing, wavelet, and Neural Network designing functions as well as the design of.
Graphical User Interface for the final system. MATLAB package was chosen as base,
which serves as the platform for all the technical computing needs
over 4000 Holter tapes, and the 0 ther 2 5 (the 200 series) were selected to include
examples of uncommon but clinically important that would not be well represented in
a small random sample. The subjects include 25 men aged 32t089yearsand22
women aged 23 to 89 years; approximately 60% of the subjects were inpatients. The
ECG leads varies among the subjects as would be expected in clinical practice, since
surgical dressing and variation in anatomy do not permit use of the same electrode
placement in all cases. In most records, one channel is a modified limb lead II (MLlI),
obtained by placing the electrode on the chest as is standard practice for ambulatory
ECG recording, and the other channel is usually VI (sometimes V2, V3, or V5,
depending on the subject). Altogether there are 116137 QRS complexes in this
database. While some records contain clear R peaks and few artifacts, for some
records the detection of QRS complex is very difficult due to abnormal shapes, noise
and artifacts.
using MATLAB@. The name MATLAB stands for matrix laboratory. MA TLAB is a
MA TLAB is an interactive system whose basic data element is an array that does not
require dimensioning. This allows us to solve many technical computing problems,
especially those with matrix and vector formulations, in a fraction of the time it would
35
take to w rite a program ina scalar n on-interactive language such as Cor Fortran.
Matlab programs can be automatically converted to C or c++ codes by simulink
which is a utility of Matlab. The reason that I have decided to use MATLAB for the
development of this project is its toolboxes. Toolboxes allow user to learn and apply
specialized technology. Toolboxes are comprehensive collections of MATLAB
functions (M-files) that extend the MATLAB environment to solve particular classes
of problems. It includes among others signal processing, wavelet, and neural networks
toolboxes [48].
800
000
'00
200
.200
0 .- -~
.0.6 -0.<1 -0., 0 0.2 OA 0.0
20
'0
0
.20 20 30 '0
-40 -30 .'0
° '0
0.5
..().!i
-,
•••0 -<>0 -2O -'0 0 '0 20 '0 '0
(a)
.500
o 2 5
600
GOO
20 30 40 50 60 70
frequency in Hertz
Spectrum
(b)
Fig. 4.1: a) Time and frequency domain representation for one period of an
electrocardiogram signal. b) Time and frequency domain representation Spectrum ofa
signal containing many beats of an electrocardiogram.
37
Electrosurgical and instrumental noise behaves similarly as random model for EMG
and motion artifact is much like base line drift in respiration, hence these were not
specifically modeled.
38
\
39
o,a
O,S (I)
0,4
0,2
-0,::'
.0 ..04
.0.6
.0.°0 ~oo AOO BOO BOO 1000 1=0 ••• 00 1BOO 1 BOO ~ooo
1,2
O,G
(b)
0,6
0,'
0,2
a
.0,2
.0.4
.0,6
-0.8
0 200 '00 300 BOO '000 , :ilOO 1.400 ''''0
"."" 2000
1,2
0.0
O,G (C)
0,'
0.2
-0.4
.0.0
,,"
o,a
0,6
(d)
0,'
0,"
0
.0.2
-o,A
_D.G
,.
(d)
0.5 -
, .2
, (a)
0,8
0.8
0,'
0.2
-0,2
-0,4
-0.6
-O.B
O 800 '000 1&00 2000 ","00
, .2
(b)
0."
0.6
0,.
0.2 .
0
.0.:>
.0.4
-01.0'
, ,S
(e)
a,1E$
.0.&
, .r.\>
(d)
,
D,S
.0.5
"" (a)
0."
0."
0."
0."
a •
40.2 4
40 ..••
40,&
.Q,fiit
o
""f:\
(b)
0.0
.() ...
"0 a , 0
, .0
(c)
,
0 .••
-0.0
•. S
(d)
0."
-0,'5
,.,
41.4
0
•
500 1000 ,~ =be ~SQC
Fig. 4.5: ECG corrupted by abrupt baseline shift noise of different levels;
(a) 25%. (b) 50%, (c) 75% and (d) 100%
44
Noise intensities were decided upon by approximating the noise levels used by
Friesen et. al. [34]. It is noteworthy that the maximum noise amplitudes used are well
above the typical noise parameters present in an ECG signal.
, ..
,
.
c•.• ,
-0."
..
~.5
~
•. 0
0.5
"
-.
-0.8
,,'DD
,
46
-I .. .l
Fig. 4.7: Response for Difference Equation (4.2)
0.0 • ~ ~ ~
-J L-----.-."
o :.....••.......• "r'.-..-~-,,~•.., ,,-'---J l- - /-_._._-_/""",.,~
l--.--,._~ ,,-'"
_o.~0-----1-00---2-60-.--:;.6.0 ..•00 - !'Sao -000 70'0 000
A QRS candidate occurs when three consecutive points in the first derivative array
exceeds a positive slope threshold and are followed within the next lOOms by two
consecutive points which exceeds the negative slope threshold. All data points in the
ECG between the onset of the rising slope and before the end of the descending slope
must meet or exceed the amplitude threshold.
y(i), y(HI), y(i+2) > 0.1 (4.2)
And y(j),y(j+l) < -0.1 (4.3)
~~P-ilifff~::t
:"i::.
-:.,-;-~:-"
.. -!
.J ..
.. !. .1--~-jE..
: !.; i:
+ .. ' :::::"" '1"
.: 'j.: "j.: "j,:
i,: i,i.,!,!
-j'Y"1'~~-r ":"'-'~'.' ..
i,' ':"!"::::
' : : ::::
1. j'l'l!:":.'"
.,,,,', :,...:.:"i _ ..: -...: .: ":',:<~;:':;'" ... _.. __. .. :,.• :,..,: '::;:.:""_ ......•..... '" "~,.,i".,1..i"jj,
U't. Pr••q •.•••ncy (H",'
The slope threshold is calculated a s a fraction 0f the maximum s lope for t he first
derivative array. In the original only the 1.2 sec of data is considered, but in this
experiment the entire data is used.
-l' ,.........
,..-.-~-~':
-,--
Slope threshold = 0.25max[y(Il)] ; 3 <11 <k-2
.:~-,._"b,=:...J~-=J
mV
o
4,---~--~
100 200 300 ~oo ~oo . 600 700
No. of.empl •••.
&00
:--~-
j 1-.---
-2 .. ~
200
F ••..•t 00<1""'11". or ECG Slgr,..1
Fig. 4.10: ECG Signal and its First Derivative using eq" (4.4)
49
The first derivative array was searched for points, which exceed the slope threshold.
The first point that exceeds the slope threshold is taken as the onset of a QRS
candidate:
y(i) > slope threshold
The rectified first derivative is then smoothed. Smoothing is done to reduce high
frequency noise by averaging several data point together (moving average). Here a
three point moving average filter was used for smoothing (fig. 4.11):
'. ':
!" ,! 1 •• "" "1" .... !._ ... - - --- - -_ .... -- .. 1--. --:--_ .. _-
.
.. _: ..., - - -~... _ .. _.:
.
... .. ; ... , :. 'j, ! _.: . - .... ;.. :- .
.,..;,," ......... . - ..... . ..
, , - .... ,- - ~-.. .. "
. • 'In __
.__ __._i __ L. _.__.. 1 _._.. ._,l__. j. .• ~: ..i.. ...;,
..
__
" <:t <'I,; 0 1 <:I-'.. <:' ". (I ~"'.. (;I::l •.•.:,.. <:t.. •• .••••
r,,-. •..•.•.••u ••nCly CH",,)
This filter derived by cascading two stage of three point central difference derivative
of equation (4.7). The rectified and smoothed first derivative is added to the rectified
second derivative:
50
3<n<k-2 (4.8)
The maximum value of this array is determined and scaled to serve as primary and
secondary thresholds:
Primary threshold = OAma.x[Y3(n)] ; 3<n<k-2
Secondary threshold = 0.05ma.x[Y3(n)] ; 3<n<k-2
The array of the summed first and second derivatives is scaled until a point exceeds
the primary threshold. In order to be classified as a QRS candidate, the next six
consecutive points must all meet or exceed the secondary threshold:
Y3 (i»= primary threshold; 3<n<k-2 (4.9)
;A: ;1
~ '~i~
600
A. ] 700
No. of
800 S8mple~
600
A: 700
iNO'Of
800 Semple1
:."A :
600 700
-INo of
600 Sample
: A:
600 700
j No 01
800 Samplel
In the original version of this algorithm, the second derivative of the rectified ECG
was smoothed, presumably in the same manner as the first derivative. The
performance of the original algorithm was erratic in the presence of no~se and was
substandard when compared to the current form as specified above.
51
The response of the low pass filter for m=6 is shown in fig. 4.13.
Magnitude ResponsB (dB)
-'-r" -'-1 "1""-1"-1""1"]"1 'J """"" _•••• ~-_.,._.~._-!"--~-~'-~'-~.~~--_._'--~--
, . , "
, , , , , ""
" ..,
, , , , " , .
T~F~... r '. r!Trn T" -'.
I , , , , " "
,
-:-:;~:-:-. --;-
~u .
, ," , .
rr
"" ,
:-:~~---~-~-~-:-~:~;~---
0'" ,.",,,,,
, ".. .. . ,.
., ,. ,,"
" r,- - - -,.-
,
-.-. ...•..• .
,,
,,'"". ", """ ",.
, ,
.. ,... ,", .., ." ... ,-",,-,- .-, -.....• .-,' '"' . -,". -
The difference between the input and output of the low pass filter, which is act as a
band-pass filter is then squared:
Y2(n)=(yO(Il)-YI(Il))2; m<ll<k-1II (4.13)
The squared difference is filtered to enhanced the QRS complex:
"+m
Y2(n)=Y2(n){ L:>2(1)}2 ; m<n<k-m (4.14)
I=,,-m
A fourth array is form to discard peaks due to abrupt baseline shift, using the
following fomlUla :
Y4(n)=Y3(1l) if [yo(n)-Yo(n-m)][ Yo (1l)-Yo(ll+m)]>O
Y4(n)=O otherwise (4.15)
52
a)
b)
c)
e)
0' 1
04
0,02
1:0 ?~O 3:0 4:0 ~Q~SE~:~nce~:;l 8:0 9:0 JO
6 O
00:1
0,02
1:0 2~0 3:0 4:0 ~ j:~se p e:a p~~:ing
ks 8:0 9:0 JO
o
o 100 200 300 400 500 600 700 800 900 1000
The maximum value of this array is determined and scaled to form the threshold:
Eee (lc)
Lowp- Hichp.a.
•
Filt.:r
••
rut.!r
Bandpass Filter
N•••••••
o!"QRS
Peak
This filter isolates the predominant QRS energy centered at 15 Hz. Energy of QRS is
between 5Hz-30Hz [20]. The filter implemented in this algorithm is a recursive
integer filter in which poles are located to cancel the zeros on the unit circle of the z
plane or known as the I1R filter. The transfer functions, difference equation and
frequency response for the second order low pass filter is as below and its response'
shown in fig. 4.16. It has a cutoff frequency at 18Hz. This filter eliminates noise such
Transfer Function:
(4.16)
Frequency Response:
Difference Equation:
Y[IIT] = 2Y[IIT - 2T] + x[IIT] - 2x[IIT - 6T]+ x[IIT -12T] (4.18)
:T~--~T:-:~:r::-=
:::~~--:-:~:-~:-T----;~--_-:r-_-~T:-:-::-~_::
M<aQnitud •• R"' ••pan •••• (dS)
. " •• ~. ...' .. .. "1 .. . . .-: ,.. . : : :" ,, , ~,: -"._ ,: .. ,.!:.,.::.,.~.__ ~:..:.: __ .. ,~I,.":._~~_.~._
":.-_L._~_~-.~.'_:~_::_
. ..,-._.,::._~_
..~:_
..-' .••,-' •.:; _.'6..::J.~;.,- f.J,-' 0;),-' ~> 0,;1 n.;'~.\ O.i._ 0,,':'31':' '.l,"l I:' 'H'
U(.. "'requenov (HZ)
The transfer function and difference equation for the high pass filter is as below and
its response shown in fig. 4.17. It has a cutofffrequency at 5Hz. This filter eliminates
(4.19)
Frequency Response:
I H(wT) 1= [256+sin2(16wT)j1l2
cos(wT /2) (4.20)
Difference Equation:
Y[IlT] = Y[IIT - T] - x[nT]/ 32 + x[IIT -16T] - x[IIT -17T] + x[IIT - 32T]/ 32
(4.21)
__, .. ~~gn~ltu':'~._R~_~,p':,
..n~~._~.~_~]
__,.__
...._.... , .
.
"---r--:---r
- .- .
,: :
., .. ,,,.. .. .. -
, , ...,'
,
- -' -,- ..
. ----~-----~----1--- -:-----
,~,
..... .., .,;.... ,.... j .. -' .,... -!" - - ,.... - - - - "j" .. - ". - t - ..- ..'j - - - .,-~..- - - --
r.> -- •••• !--- ..-:- --'"';'.''' ._-:----- ----~-, ~~~~----i---.-l-----
;>,-,
., .~.... .- . '
After the signal has been filtered, it is then differentiated through a five point
differentiator to obtain information on slope of QRS complex and overcome the
baseline drift problem. Its response is similar as shown in fig. 4.9. It also helps to
accentuate QRS complexes relative to P & T wave. Below are the transfer function,
frequency response and the difference equation.
Transfer Function:
H(z) = 0.1(-2z-' - Z-1 + z + 2z') (4.22)
Frequency Response:
l
1 H(wT) 1= 4 T (sin2wT + 2 sin wT)
(4.23)
Difference Equation:
8y[nT] = 2x[nT]+ x[nT - T]-x[nT -3T]- 2x[nT -4T] (4.24)
The previous process and the moving average that will be explained next are linear
processing parts of the QRS detector. The squaring function that the signal now
passes through is a nonlinear operation. This squaring 0 peration besides makes all
data positive; it emphasizes the higher frequency component nonlinearly and
attenuates the lower frequency component. The equation is as follow:
y[n] = x[n]' (4.25)
The last transformation of the signal before the QRS wave detection is done was a
moving average filter, which acts as a smoother and performs a moving window
integrator over 150ms (e.g., 54 points at a sampling rate of 360Hz). Refer to Equation
4.32. Generally, the width of the window should be approximately same as the widest
QRS.
y[nT] =(x[n T-(N-l) TJ +x[nT-(N-l)TJ + +x[ nTJ)1N (4.26)
--~---~--
,....
: : :
------ . ~-_---O-S-)----
~
Fig. 4.18: The relationship of a QRS complex to the moving average waveform: ECG
signal and Output of the moving average filter. QS; QRS width, W; width.
of the moving average filter.
56
a)
_~FJ~,:~: :=J~:~EC~S_ign~_,:~;
500 00 200
;Ad
300 0 500 0 700 BO a 00
Bandpass Filtered
b) a
-50
200 300 400 500 600 BOO 00
100 100
Defferentiated
c). 0
-10
1000,-----,,10¥"0'--
...•
2"'1-00"---"'30;"'0'--..:I4¥'00'-~5'>i0"'0
_",60",0'--~"TOO~~B",,~f"'0_.
~9~¥'0~400
d) 5:t ; : : M ~qUared: M: ~ ~ Mj
400 100 200 300 400 500 600 700 BOO 00 000
Averaged
ej 20
00 100 200 300 400 500 600 700 BOO 900 1000
Fig. 4.19: a) The digitized ECG signal b) after band pass filtering. c) after band pass
filtering and differentiating. d) after band pass filtering, differentiating and
squaring. e) the final process; after band pass filtering, differentiating,
squaring and moving average filter.
Thresholds are set up to detect QRS complexes in the output of the moving average
filter. This algorithm uses a dual threshold technique and a search back for missed
beats.
.x;
..
•
u.r aI.
.Xj
..
X
N
If the neurons are grouped in layer of weighted synapse interconnecting Qnly neurons
in successive layers, the ANN structure is called Multilayer Perceptron model as
shown in fig. 4.21. An MLP model is the most popular and the most studied ANN
model. An MLP consists of an input layer and an output layer, with 0 ne or more
hidden layer in between.
OUt-I
@) ; Sigmoid nudrl
o: l..intIar ncdtl
In_I
Fig. 4.21: A 3-2-2 Configured Multilayer Perceptron with Direct Input-Output
Connection.
application, an MLP can use to model the background noise process. A Time Lagged
Feed forward Network can be applied as an adaptive filter (19), [50). A matc~ed filter
58
E03 L
4 ORS
Tampal£!
..•.
. ~.
II)
The nodes in the hidden layer are represented by the vector V' • Such a vector V",
W(I) (n)
v~')(n) 1M I
(I) ( )
vi')(n) wi~(n) wi~)(n) W2M n x(n-I)
(4.28)
with M=6 and L=5. Thereafter, the output v") is further processed with the nonlinear
(4.29)
which is the output of the hidden layer. Such an output of the hidden layer, according
to eq" (4.29), is propagated further to the next layer. Since the network only has one
hidden layer the next layer is the output layer. The output layer consists of a single
As shown in eq" (4.30) the output of the network IS the weighted and summed
e(n)=x(n)-v~2)(n) (4.31)
(4.32
where the set of C includes. all the neurons in the output layer. The error function is
minimized wjth the use of the LMS algorithm [50] as
&(n) _ &(n)&}(n)5y}(n)Ov}(n)
Ow}(il) &} (n)5y} (n)Ov} (n)Owj (n)
(4.33)
. The correction W}I applied to the synaptic weights is performed with the delta rule
according to:
where 77 is the learning rate. The negative sign in (4.34) is due to the gradient descent
where rp' is the time derivative of the activation function. The learning speed is
accelerated with the addition 0 fa fraction a , of the previous weight update to the
current update. Moreover, the use of a momentum term a. is a possibility to overcome.
the problem of getting stuck in a local minima. The weight updates for the hidden
layer and the output layer are calculated according to:
(4.37)
61
Finally, all the free adjustable synaptic weights, W(II), in the network are updated by
adding (4.36) and (4.37) to the corresponding weights. This issteepest descent rule
where W(II) denote the NN weight vector at the n'th iteration and ~W(II) is the
Le.,
where
->
vector and x, is the expeeted output vector for each training pair i, then
The above deviation is the essence of the Gauss-Newton algorithm. However the
Gauss-Newton algorithm is generally not locally convergent on problems that are
very nonlinear. To improve the situation, the following formula is usually adopted:
. -~\
62
Marquardt algoritlm1 is based on this method and replaces S with the identity matrix
and the update weights can be obtained. To reduce training time Levcnbergc-
Marquardt algorithm is used in this study.
empirically. But this did not show generalize performance against different noisy
ECG signal. To growing the network for better performance new neuron added to the
hidden layer. The growing network was tested against the noisy signal.and it was seen
that a 6-5-1 configuration perform satisfactory. A 6-5-1 MLP configuration was
trained with different sets of 200000 samples noisy signal by Levenberge-Marquardt
algorithm using a adaptive scalar constant (fJ) which is initially 0.00 I with a
increasing factor 10 and decreasing factor 0.1. Plotting the errors in an approximation
is a good way to check generalization. Information has to be obtained from looking at
how the error decreases during training. In general the error used is the Mean Squared
Error (mse) given by:
1 /1-1
MSE
10' .. . .-- . . , ~--- ~-----.
"0"
"0"
Fig. 4.24: Mean Square Error vs. Epoch Curve during training.
63
This TLFN used for simulation process. After averaging and smoothing the output of
TLFN, a matched filter is applied to improve the SNR. It is well-known that the
impulse response h(II), of the matched filter is a time-reversed replica of the event to
be detected, i.e., the QRS complex. The template of the match filter updated after each
beat detection. Figure 4.25 shows noise suppression by TLFN and the output of match
filter.
.. :PE • o 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
b) .J1J~~~~~=qTj
o 500 1000 1500 2000 2500 3000 3500 4000 4500 5000
O.5[ , , , , , , , , , ]
c) .o.:I_j~ti=~'+j:~L
0,06
o
__I,L.~~_~t!jTij=i=8
500 1000
.-------.--.-r--
.....
__
1500 2000 2500 3000 3500 4000
-..---f'--.-------r---.------,---,--,--,----~-----r
4500
--
5000
d) 0.04
0,02
500 1000 1500 2000 2500 3000 3500 4000 4500 5000
The output of the matched filter is then propagated further to the adaptive threshold
function to detect the QRS complex. Such a threshold function uses 60% of peak
amplitude of the previous detected QRS complex in order to adapt the threshold.
• r
64
time a nd frequency domain through time windowing function. The window length
determines a constant time and frequency resolution. Thus, a shorter time windowing
is used in order to capture the transient behavior of a signal; which sacrifice the
frequency resolution. The nature of the real ECG signals is non-periodic and transient;
such signals cannot easily be analyzed by conventional transforms. So, an alternative
mathematical tool wavelet transform can be selected to extract the relevant the timc-
frequency information from a signal. In this work, we stated only some keys
equations and concepts of wavelet transform, more rigorous mathematical treatment
of this subject can be found in [51]. A continuous-time wavelet. transform of /(t) is
defined as:
(4.43)
Here a,b E R,a l' 0 and they are dilating and translating coefficients, respectively.
,
The asterisk denotes a complex conjugate. This multiplication of lal' is for energy
normalization purposes so that the transformed signal will have the same energy at
every scale. The analysis function 'Y(t) , the so-called mother wavelet, is scaled by a,
frequency analysis. The requirement that 'Y(t) has compact temporal and spectral
support (limited by the uncertainty principle of course), upon which set of basis
functions can be defined. The 'Y(t) must have zero mean. This condition can be stated
as,
ro
flfl(t)dt =0 (4.44)
The other main requirement is that the mother wavelet must have finite energy:
ro
The wavelet transform decomposes the signal into different scales with different
levels of resolution by dilating a single prototype function, the mother wavelct.
Furthermore, a mother wavelet has to satisfy that it has a zero net area, which suggest
65
m, n E Z, and Z is the set of positive integers. Substituting (4.46) into (4.43), we have
~
DWT f(m,n) = ff(t)lf: .•(t)dt (4.47)
wavelet '¥(I). The family of dilated mother wavelets of selected a and b constitute an
information redundancy in the discrete wavelet transform. Figure 4.26 shows the
D••
D.'
D.'
0 .•
0.'
0.'
0.3
0.'
0.'
.0 0.• 1.6
P~.-q•.••ncy 1•.• ""'-1
g ...
Fig. 4.26: Equivalent frequency response of DWT at different scales
invited to DWT. The wavelet function and the scaling function represent as impulse
66
responses g(n) and hen), can be viewed as a high-pass and a low-pass filter. For
discrete time signals, discrete wavelet transform is equivalent, according to Mallat's
algorithm, to an octave filter bank [52], and can be implemented as a cascade cells'
[low pass and high pass finite impulse response filters (FIR)], as illustrated in figure
4.27.
I
I
D'(l) I
<VB. /"1
0'(\)
(f.M .1,J:d
I
(a)
ReeonltrUot.d
Ltvtl2 leval 1
Sign.J1
(b)
Fig. 4.27: Filter Bank Implementation ofDWT. a) Decomposition b) Reconstruction.
This multi resolution analysis (MRA) algorithm decomposes a signal into'scales with
different time and frequency resolution. MRA is designed to give good time
resolution and poor frequency resolution at high frequencies and good frequency
resolution and poor time resolution at low frequencies. The fundamental concept
, )
Q
67
involved in MRA is to find the average features and the details of the signal via scalar
products with scaling signals and wavelets. In the ECG signals we have seen, sharp
spikes are observed when QRS occurs. The spikes are typically of high frequency and
we are able to discriminate the QRS spikes with other noises VJrough the
decomposition of MRA into different levels. The differences between different
mother wavelet functions (e.g. Haar, Daubechies, Coiflets, Symlet, biorthogonal and
etc.) consist in how these scaling signals and the wavelets are defined. To have a
unique reconstructed signal from wavelet transform, we need to select the orthogonal
wavelets to perform the transforms. The wavelet decomposition results in levels of
approximated and detailed coefficients. This multi-resolution analysis enables us to
analyze the signal in different frequency bands; therefore, we could observe any
transient in time domain as well as in frequency domain.
The relation between the low-pass and high-pass filter and the scaling function
rjJ (I) and the wavelet '¥ (I) can be states as following:
The relation between the low-pass filter and high-pass filter is not independent to each
other, they are related by:
g[L-l-n]=(-I)" .h[n] (4.50) .
where g[n] is the high-pass, h[n] is the low-pass filter, L is the filter length (total
number of points). Filters satisfying this condition are commonly used in signal
processing, and they are known as the Quadrature Mirror Filters (QMF). The two
filtering and downsampling operation can be expressed by:
A'[k] = L, .r'(t). h[2k-n]
(4.51)
synthesis filters g'[n], and h'[n] (highpass and lowpass, respectively), and then added.
The interesting point here is that the analysis and synthesis filters are identical to each
other, except for a time reversal. Therefore, the reconstruction formula becomes (for'
each layer)
A' [k] =
.
L (D'-'[k] .g[ -II + 2k] + A'.'[k]. /;[-11 + 2k])
- 0.53)
Almost all wavelet based peak detection methods [24]-[27] are based on local
maxima of the wavelet coefficient signals. A number of wavelets proposed in
different literature, such as; quadratic spline wavelet in [25],[ 27] derivative of a
Gaussian smoothing function in [26], symlet in [29].
and the wavelet and scaling filters g(n) and h(n). In practice, the wavelet design can
be started first by choosing the scaling function [53]. In this study, we choose to select
the mother wavelet based on the method of correlation between two signals. Because
shape and smoothness of the scaling function tend to appear in the de-noised signal,
choice of regular wavelet is advised. Wavelets with higher rank in the family are more
regular and smoother. Non-regular distortions in ECG signal were shown, that appear
in the signal after using wavelet denoising procedure were studied. It has been noted
that these distortions have similar shape to the scaling function of the wavelet
transform that is used for signal decomposition. Hence, the type of wavelet used for
signal de-noising has to be selected carefully. It is belter to use regular wavelet, which
resembles shape of the waves in ECG signal. Belter results are obtained if wavelets
with a high rank in the family are used. We choose coiflet2 for denoising and
biorthogonal6.8 for detection process. Most of the energy of the QRS complex lies
between 5 Hz to 30 Hz [IS]. Selection of maximum decomposition levels depends on
this frequency band.
procedure includes decomposing the signal into the detail components, identifYing the
noise components and reconstructing the signal without those components. This is
called the linear denoising approach. The linear denoising approach assumes that the
noise can be found within certain scales, for example, at the finest scales when the
coarsest scales are assumed to be noise free. More sophisticated non-linear
thresholding approach also use for de-noising, which involves discarding the details
exceeding a certain limit. This approach assumes thaI every wavelet coefficient
contains noise and it is distributed over all scales. The non-linear de-noising by both
soft- and hard-thresholding methods can be performed [54]. The hard threshold signal
is x if Ixl> th, and is 0 if Ixl<thoThe soft threshold signal is sign(x)(lxl - th) if Ixl> th
and is 0 if Ixl< tho Hard thresholding can be described as the usual process of setting
to zero the elements whose absolute values are lower than the threshold. Soft
thresholding is an extension of hard thresholding, first setting to zero the elements
whose absolute values are lower than the threshold, and then shrinking the nonzero
coefficients towards 0, as shown in figure 4.28.
th = ~210g, (n.log, (n)) , where n is the number of samples in the signal vector. With
this approach obtaining risks and minimizing them with respect to til values gives a
threshold selection. The method is adaptive through searching a threshold level for
each wavelet decomposition level. A fixed threshold approach FlXTHRES calculates
the threshold with respect to the length of the signal and the estimated threshold is
70
given by liz = ~210g,(n), [54]. The HEURISTIC SURE approach being a variant of
the first, replaces in very noisy conditions the sure with FIXTHRES estimate [55].
Further, the MINIMAX procedure applies a fixed liz = 0.3936 + 0.1829.log(n) [55] to
produce the so-called MINIMAX performance for mean square error against an ideal
case [54].
During simulation it was assume that the noise being normally distributed withzero
mean and v'ariance of I, which means that we have to rescale the threshold values
when dealing with unsealed and nonwhite noise. When normally and uniformly
distributed noises were studied, calculated thresholds were rescaled by the standard
deviation of noise estimated from the finest level of the decomposition of each signal
A
Twenty independent simulations were used to evaluate the performance of the applied
deiJoising methods. The performances of the methods were studied by obtaining
errors within an ECG including 2000 samples. When considering the compactly
supported orthogonal wavelet families (Daubechies, Symlets, Coiflets) with discrete.
transform, the Coiflet wavelet basis was found most suitable. The denoising
performances were very near between these families, however, Coiflets showing
slightly the best performance. The Coiflet wavelet (Coifl) of order N = 2 was used
which had lowest denoising error among Coiflet functions. The error performance
was measured with Lz-norm given by Equation:
(4.54)
where 1 0 denotes the original ECG signal being the same for all simulations, and
XI denotes the ECG signal with added noise after noise removal.
A five level wavelet decomposition of the noisy signal using Coif2 wavelet analyzed
for denoising. The energy for motion artifacts and baseline wander (i.e. noise)
increases for scales greater than five. Figure 4.29 shows the Coif2 scaling and wavelet
71
0.5
0.5
o
o
o
\J
2 4
v
6 a 10
-0.5
o
Decomposliion Iow:pass filler Decomposition high-pass filler
0.5 0.5
O::I----'--,-~-----_._.j
\'i' '-,
O:.f-7, -':"_-':" __ -':"_--~-j
-0.5 -0.5
o 2 4 6 a 10 o 2 4 6 a 10
O. '.'. ,
-0.5 -0.5
o 2 4 6 a 10 0 2 4 6 a 10
(a)
M.""IIUd.
, ,
R•• pon ••• IdB)
,
."'"
'''''''''" ;,;',~,'
.. ,
n,n"
... '..
•.•.
""
•••.• '1•••••
- - .. -
oay,_
n.'
. n,1'
"'-" "'"
..-
.' ...
(b)
72
M."nlt':',~_.,,~,~.~':'~~
_.,._-----~-....,.---"..,.-._-, --'-_ ... ..
.•.(~.~J. ,
_, _-_
...:...._---_.--'-----...;...-
'., '
,"
. .. . I .
" ,
(c)
Fig. 4.29: a) Coif2 scaling and wavelet function and corresponding low-pass and
high-pass decomposition and reconstruction filter coefficient respectively,
b) High-pass filter response, and c) Low-pass filter response.
denoising approach. Values are means and standard deviations of I/;:- ;1.
Thresholding Thresholding selection rule
Nonlinearity SURE FIXTHRES HEURISTIC MINIMAX
SURE
Soft 28.44:f: 6.5 27.71:f:6.66 27.92:f: 6.67 27.88:f: 6.65
In the wavelet based approach, the most efficient noise removing method with soft
thresholding was the FIXTHRES, which gave the lowest error averages (Table 4.1).
In this study for denoising of ECG signal soft thresholding method used with scaling
fixed threshold (FIXTHRES).
73
1
Decomposition scaling function phi
1.5
1
.-------T-------,
Decomposnlon wavelel fUnction psi
i
0.5
o.~I------f ,\,1 II 1"------1
o -0.5
v
I I'
,I
o 5 10 15 o 5 10 15
Decomposition low-pass filler Decomposition high-pass filter
0.*
-0.5
o
:
2
:":
4 6
',;
8
'::0 ~
10 12 14 16
: : J -:H.~:'"~': : ~.~1
o 2 4 6 8 10 12 14 16
Reconstruction scaling function phi Reconstruction wavelet function psi
1
0.5
o
0.:
-05
, tl f--'''-'-- ,
\1v ,I
\. ./ . V
o 5 10 15 o 5 10 15
~.~t
Reconstruction low-pass filler Reconstruction high-pass filler
Fig, 4.30: Bior6.8 scaling and wavelet functions and corresponding low-pass and
high-pass decomposition and reconstruction filter coefficient respectively.
74
The QRS complex detection is accomplished by using the modulus maxima pair of
the wavelet transform coefficients. The transitions in the input denoised ECG signal
correspond to local maxima in the decomposition modulus at different scales. The
frequency content of the ECG characteristic waves is different, .so they are
distinguished at different decomposition scales. The energy of the QRS complex
usually is cover scale I and 2 (scale a=21 and 22 the dyadic sampling grid). Abrupt
shift in base line causes isolated peaks in wavelet transformed signal. After rejecting
all isolated and redundant peaks, the modulus maxima pair of the wavelet transformed
signal is searched for local maxima by peak detection logic with threshold value.
When a local peak exceeds the threshold, it is stored as a QRS candidate and
successive search in vicinity is performed for higher peaks, which could replace the
previous QRS candidate. After a QRS complex is declared, a refractory period of 0.2s
follows, during which no further excitation could cause heart muscle's contraction,
and peaks are not registered. TIle average RR interval of the last ten QRS complexes
75
detected is maintained and if no peak is found within this interval, the threshold is
lowered and a back-search is performed. Highest QRS between two scale taken as
exact. Thus the QRS detector adapts to the changing signal amplitude and prevents
omissions of QRS complexes. The threshold has a lower bound, preventing false
detections of the noise content in the signal.
There are seven basic types of algorithms included in this study. The basic type is
designated by a letter prefix to make analysis simple. "AFD" for algorithm based on
both Amplitude and First Derivative, "FD" for algorithm based on FirstDerivative
only, "FSD" algorithm utilize both First and Second Derivative, "DF]IR" algorithm
used Finite Impulse Response Digital Filter, "DF_IIR" algorithm used Infinite
Impulse Response Digital Filter, "NN" algorithm based on Neural Network and the
last category was designated as "WT" which refers to Wavelet Transform analysis for
QRS detection.
The results obtained from this experiment are given in percentage error rate for all of
the a Igorithms against different levels 0 fag iven type of noise and noiseless E CO
signal separately and mean error rate with standard deviation considering all datasets.
76
Table 4.2 Peiformallce (% Error Rate) of Different Algorithms for Raw ECG Signal
Record No. Total Beats Description Detected beats Error Rate
Beats (%)
NN 2522 0.39
WT 2524 0.32
f
78
Beats (%)
AFD 1944 0.46
115 1653 Normal 1953
FD 1946 0.36
WT 2270 0.79
Junctional escape 5
DF_"R 1613 0.37
NN 1591 1.73
WT 1604 0.93
Fusion PVC
DFJIR 2066 3.28
NN 2003 6.23
WT 1994 6.65
•
79
•
. ~~-~.
e••• 15
w 10
••••
o
'*' 5
o
"<"""N(y)'<;f"LO<Dt--OO(J) O"<"""N(y) '<;f"LO
-r-~~~-r-~
Fig. 4.32: Comparison of the percentage error rate of different QRS Detection
Algorithms for Raw ECG Signal. The marker of X-axis corresponds
different signal from MIT-BIH records.
81
Table 4.3 Performance (% Error Rate) ofDifJerent Algorithmsfor Power Line Noise
Corrupted ECG signal
Algorithms
"E
o
'""
. '0
u 0 Z AFD FD FSD DF FIR DF IIR NN WT
~Z '-0
~
25 0.4 0.31 0.53 0.4 0.35 0.35 0.35
0 50 0.35 0.22 0.53 0.44 0.35 0.35 0.35
-
0
75
100
0'.31
0,04
3.03
308.6
0.53
0.3 I
0.48
0.53
0.35
0.35
0.35
0.35
0.35
0.35
25 1.98 2.26 13.8 0.58 1.13 1.01 0,078
50 4.28 3.58 65.1 0.31 1.13 1.09 0.19
'"
0
11.04 5.48 352.1 0,51 1.13 0.78
75 0.15
100 19.48 10.26 398.3 0.7 1.13 0.82 0.11
-
N
N
50
75
2.07
9.02
19.57
5.09
19.8
3.75
0.44
I,) I
88.17
0.76
0.91
1.02
0.29
0.29
0..8
0.8
,0.29
0.25
100 0.29 0.8 0.25
25 0.54 1.01 2.39 0.86 0.94 1.64 1.13
c :t :t :t :t :t :t :t
0
.~ 0.55 0.69 4.37 0.59 0.92 2.17 1.84
.;; 0.86 1.51 6.03 0.79 0.94 1.64 1.14
"
0 50 :t :t :t :t :t :t :t
"'~
" 1.13 1.47 16.73 0.53 0.9 2.13 1.77
"t:J
c
-
V'"l
:t
75 1.95
:t
3.21
:t
4.94
:t
0.79
:t
0.94
:t
1.63
:t
1.16
:t
3.02 4.89 14.92 0.51 0.89 2.11 1.81
c
'"
" 100 3.63 20.82 8.04 0.8 0.94 1.63 1.16
:::E :t :t :t :t :t :t :t
5.67 65.51 22.12 0.49 0.89 2.1 I.78
83
Fig. 4.33: Comparison of the percentage error rate of different QRS Detection
Algorithms for Power Line Noise Corrupted ECG Signal. The marker of
X-axis corresponds clean signal while successive four points corresponds
25% noise increments with this signal. Error rates greater than 20% are
not shown.
Table 4.4 Performance (% Error Rate) of DifJerent Algorithms for Base Line Drij/
Noise Corrupted ECG Signal
Algorithms
"
'"
'0
"E
8 0 Z AFD FD FSD DF FIR DF_IIR NN WT
"Z .•..
e<: <:>
'$.
0.4 0,31 0.4 0.4 0,35 0.35 0,35
25
0.4 0,31 0,4 0.4 0.35 0.35 0.35
0 50
0
~ 75 0.4 0.31 0.4 0.4 0.35 0,4 0.44
"
0 :!: :!: :!: :!: :!: :!: :I:
"E 0.25 0.5 2.32 0.72 0.9 2.05 1.83
'"
"0
c:: 0,51 0.85 1.64 1.04 0.94 1.61 1.16
;S 75
Vl
:t: :t: :I: :I: :I: :I: :I:
:I:
0,22 0,5' 2.31 0.71 0.89 1.95 1.81
c::
'" 100 0.5 0.85 1.64 1.04 0.94 1.69 1.15
::s" :I: :I: :I: :I: :I: :I: :I:
0,23 0.5 2.3 0,71 0.89 2,06 1.8
85
0-
6 II 16 21
~!J:>.~~FD-~:-;~~-FSD::;:-DF-=-FIR~DFJiR::::e::NN-=+W1J
Fig. 4.34: Comparison of the percentage error rate of different QRS detection
algorithms for base line drift noise corrupted ECG. The marker of X-axis
corresponds clean signal while successive four points corresponds 25%
noise increments with this signal.
4.7.4 Analysis for Abrupt Base Line Shift Corrupted ECG Signal
Abrupt base line shift (motion artifacts) is a slightly greater challenge than the base
line drift due to respiration. The results for this noise type are listed in table 4.5.
Algorithms based on first and second derivative gives the worst result as the noise
level increase (for 100% noise). Abrupt shifts produce spikes in the derivative; in case
of FSD these spikes are almost like QRS complex with small width and may be
detected as QRS. In the first derivative signal the QRS complex gives both negative
and positive slope but the spikes for abrupt shifts have only positive slope. Algorithm
based on first derivative did not used this concept shows a reasonable error rate. AFD
used this concept and shows relatively small increase of error as the noise level
increase. Though algorithms based on digital filter used differentiator in their
intermediate step for signal processing they show better performance than derivative
based algorithms FD and FSD, because they used isolated peak pruning techniques.
For this step DF_FIR consider elements of QRS complex (i.e. Q wave, R wave and S
wave) are each symmetric on the time axis whereas the waveform the spikes due to
abrupt shift are not and DF_IIR consider the width of the QRS complex. DF_IIR
shows slightly better performance than DF]IR. Algorithm based on wavelet
transform gives the best performance against this noise among the algorithms. QRS
complex represents maxima-minima pair in the transformed signal whereas shift in
baseline represent only one maxima. Considering this phenomenon the isolated peaks
- are ignored during QRS detection stage. Algorithm based on neural network also
86
performs well but exhibits slightly low performance than wavelet transform. The error
curves of the algorithms against abrupt base line shift noise corrupted ECG signal are
-
0
75 7.07
15.42
1.71
1.93
68.9
2.6
7.35
1.71
1.94
0.93
1.75
0.19
1.83
100 90.2
0.56
. {;
\
87
Algorithms
"E '-o .~
"
80 ~ 0 AFD FD FSD DF FIR DF IIR NN WT
~Z o Z
50 29.9
-
4.63 1.92 4.81 1.05 0.7 0.74
00
N
50 2.29 14.61 55.1 4.6) 1.97 11.24 1.64
0
N 75 2.11 14.98 97.14 65.45 6.51 ).)2 0.42
0.)) 2.22
25 0.07 0.76 0.29 0.87 0.25
-
N
N 75 4.44 11 5.09 0.95 0.29 2.95 0.25
0
50 0.)4 7.)7 0.6) 0.6) ).1) 1.0) 0.8)
N
N 75 0.24 11.96 0.)9 0.49 6.64 1.12 0
00
50 44.76 9.79 74.4) 24.55 1.)6 12.52 ).6
N
N 75 48.51 5.55 8.82 )3.9 4.82 0.88 4.6)
"t:l
~
o 0
.,
"""'o .~
Algorithms
.,;Z:
" 0 ::f
o ;z:0 AFD FD FSD DF]IR DF_IIR NN WT
e>::
-co
'"
en
:t
75 6.27
:!:
8.03
:t
15.1
:t
5.41
:t
4.51
:!:
2.05
:t
1.55
:t
12.51 11.16 27.74 10.81 9.44 2.52 2.12
.,
co
'" 100 7.39 9.64 23.29 8.26 5.77 2.55 1.89
::E :t :t :t :t :t :t :t
12.87 11.16 34.29 15.51 10.3 3.73 2.83
•
89
" 21 26
" "
6.
., '=6
411 51
"
=UU~
. .. ..'
LUI "
- - ..' - - . . -
"
- - '. - . -
"
.-
11 16 21 26 31 35 41 46 51 66 61 66 71
6 11 16 21 26 31 36 41 46 51 56 61. 66 71
~ 60IU .....•.......k8\TT
' .; .. ; .
1
u.1 40, ..
Cl
o ..., -6 I) /\
~
..
,.: I
1 6 11 16 21 26 31 36 41 46 51 56 61 66 71
~ 40
U.120
Cl
o
I uu=u
.
A
............
.
c>
.
:
.
.
: cs'A...;\I\' ul
1 6 11 16 21 26 31 36 41 46 51 66 61 66 71
6 11
,
,
.
c1Yi\.
.
.
.
16
...
.
.
21
.
.
,
:
.
.
.
26
,
'
.:
.
31 36 41 46
.c
61 66
Rei
61 66 71
: : : : :
': I 6
&
11
£J 1\'
16 21 26 31
~
....
36
"
. -....,
.
" 46
LLL1LL1
.~
51 66 61 66 71
Fig. 4.35: Comparison of the % error rate of different QRS Detection algorithms for
Abrupt Base Line Shift Corrupted ECG Signal. Y-axis shows % error rate
and the marker of X-axis corresponds clean signal while successive four
points corresponds 25% noise increments with this signal. .
90
...o
'"0
. 4-<
"
o .~
Algorithms
u 0
~
"Z ~
o
0
Z AFD FD FSD DF FIR DF_IIR NN WT
-
N
75 15.75 6[0.6 635.7 224.9 164.18 37.31 5.68
N
50 19.71 446.4 462.7 12.64 65.17 4.03 20.41
0
N 75 165.1 458.6 463.5 204.1 97.47 58.29 59.78
-
N
N 75 144.7 324.9 320.8
24.1 46.5 0.73 3.35
0
50 4.39 298.7 314.6 0.63 4.35 1.12 1.76
N
N 75 13.33 424.9 423.5 1.66 102.39 0.98 11.72
"0
~ Algorithms
o . "
""a .~
" 0 ~ 0
"Z
0:: o Z AFO FO FSO OF FIR OF IIR NN WT
:t :t :t :t :t :t :t
c:
-
.8
oj
.;: 50
12.13
89.32
:t
131.6
183.8
:t
188.8
215.3
:t
7.02
22.34
:t
20.31
38.77
:t
2.55
6.85
:t
2.14
11.03
" :t
'"
"0
~
oj
"0
14.22 168.1 223.4 12.65 25.32 3.53 5.09
-c:
oj
C/l
:t
75 81.56
:t
21.13
228.3
:t
203.4
272.9
:t
219.9
25.64
:t
53.73
41.52
:t
47.46
9.3
:t
17.67
10.43
:t
c: 19.21
oj
74.5 269.6
::E" 100 304.6 38.25 51.93 17.53 16.06
:t :t :t :t :t :t :t
'27.04 208.3 218.1 74.05 49.48 26.76 19.21
....
94
400
300
o
~ 200
100
o
6 11 16 21 26 31 36 41 46 51 56 61 66 71
~l 200
, =1.
o 100
o
1
JI\
. .
..•.
~!\
=-JJM
•.•..•..
•jj. ."..••......•
~•.................•..•.
.:._~.~~~
•
66
IilliJ
.....'....
61 66 71
6 11 16 21 26 31 36 41 46 61
6 11 10 21 26 31 36 41 46 51 56 61 66 T1
z
z
6 11 16 21 26 31 36 41 46 51 56 61 66 71
120
60
40
o
6 11 16 21 26 31 36 41 46 51 66 61 66 71
Fig. 4.36: Comparison of the percentage error rate of different QRS detection
algorithms for Electromyographic Noise Corrupted ECG Signal. Y-axis
shows % error rate and the marker of X-axis corresponds clean signal
while successive four points corresponds 25% noise increments with this
signal.
95
increase NN shows better result than WT with small increase of error rate. The error
curves of the algorithms against composite noise corrupted ECG signal are shown in
figure 4.37.
96
97
Algorithms
"0
•• 0 •....
o .~ "
o
Uz ~
o
0
Z
AFD FD FSD DF FIR DF_IIR NN WI
~
N
50 21.68 388.4 442.3 22.85 40.45 11.14 20.41
0
N 75 16.57 431.8 452.1 43.02 17.88 6.09 59.78
0'.
50 3.29 118.8 131.3 1.9 2.53 6.32 6.92
0
N 75 12.21 210.1 212.2 6.96 2.43 7.85 11.85
0
50 0.34 6.84 0.2 0.59 0.2 1.07 1.76
N
N 75 0.93 159.9 191.1 0.68 17.58 1.03 11.72
00
50 42.38 355.6 452.0 52.22 1.66 5.55 53.73
N
N 75 12.66 455.8 473.6 14.32 17.97 5.8 46.03
-
M
N
50
75
9.09
54.74
92.43
309.3
365.9
517.4
1.14
1.53
0.32
4.13
0.83
0.64
9.98
55.5
<l)
"0
•...
o .
'"
'0 Algorithms
u 0 Z
<l)Z ••... FSD DF FIR DF_IIR NN WT
~ 0 AFD FD
'$.
-c
oj
VJ
:l:
75 14.23
:l:
24.66
132.3
:l:
152.1
195
:l:
192.1
10.98
:l:
19.62
13.11
:l:
26.52
2.58
:l:
3.23
4.27
:l:
7.34
c
oj
<l)
100 18.78 182.2 237.1 16.47 21.35 4.28 5.74
:::2
:l: :l: :l: :l: :l: :l: :l:
31.36 173.3 196.7 27.27 32.6 7.78 9.6
99
o
LL
«
:Im
100 - ...
50.
........ __ . -,-
0; /)
o
1 6 11 16 21 26 31 36 41 46 51 66 61 66
6 11 16 21 26 31 36 41 ~ 51 66 61 M 71
6 11 16 21 26 31 36 41 46 51 56 61 66 71
z
z"
o.
26 31 36 41 46 51 66 61 66 71
Fig. 4.37: Comparison of the percentage error rate of different QRS detection
algorithms for Composite Noise Corrupted ECG Signal. Y-axis shows %
error rate and the marker of X-axis corresponds clean signal while
successive four points corresponds 25% noise increments with this signal.
100
% of Noise Algorithms
Level (Up to) Neural Network Based Wavelet transform Based
o 1.77:1:1.88 1.29:1:1.74
25 2.05:t 2.55 1.45:t 2.02
50 2.75:!:4.80 3.35:!: 7.79
75 4.83:t 11.03 5.33:t 12.14
100 7.84:t 17.16 7.76:t 16.75
101
•
_._._---
30 ------ -- - ------- 0
10
~ --------------------- --------------- ---- ---- --- ----------- •
~ 25
~ • 0
-
w 20
0
~ 15
-
--- -----.
°
--- ---0- -------
Q __ 0----«l) .
,
,, __ :=~=
10
___ __-00--- ° __
0_--0-- -0-----
0 Q) ~
----0---------0-----0
5 -----00-0-
___
0
--CfT~---O--
"",,0_ ,....n-.- ..J:'O£)Or.
-----or---=-_..
Mo
0
0 ;;"1 ••,,.
° wrl
, •
I
NN
I
Fig. 4.38: Comparison of the percentage error rate of Neural Network and Wavelet Transform based QRS Detection Algorithms
for all the datasets tested in this experiment. The tested datasets are sorted in order of ascending error rate for the Neural
Network based algorithm. Error rates greater than 40% are not shown.
c
Chapter 5
CONCLUSION
5.1 Discussions
Ambulatory ECG recording IS exposed to many technical and physiological
disturbances, which are not easily prevented or controlled, and consequently the
accuracy of automatic ECG detection can be affected, the detector can miss normal
QRS complexes or detect QRS complex, which are not actual. The purpose of this
study was to assess the accuracy of different QRS detection algorithms with different'
types of noise simulated ECG signal with different morphology. The noise
sensitivities for seven different QRS detection algorithms were measured for ECG
signal corrupted with five different types of synthesized noise. The noise types were
. electromyographic noise, power line interference, baseline drift due to' respiration,
abrupt base line shift, and a composite noise constructed from all of the other noise
types. Among individual noise EMG and abrupt base line shift noises are the most
difficult to suppressed because their frequency spectrum overlaps the spectrum of the
desired ECG signal.
Although digital filters use derivative in their intermediate step, they perform better
than derivative based algorithms because ultimately they form band p ass filter for
QRS complex. For band pass filtering fixed 50 Hz power signal and low frequency
base line drift noise are effectively removed. As a result both digital filter (FIR and
IIR) perfonn well for noiselcss, power line noisy and baseline drifted ECG signal,
while DF_IIR shows slightly better performance than DF_FIR. Although both
algorithms use pruning techniques of isolated peaks due to abrupt base line shift, their
performance decrease as the noise level increase with small rate. Since the Frequency
spectrum of EMG noise overlaps the spectrum of ECG signal, the band pass filter
cannot filter this type of noise effectively. The percentage error rate for both digital
filters increase significantly as noise level increase and give unsatisfactory results.
Neural network based algorithm show slightly better performance than WT.
Considering all the noiseless and up to 100% of all noisy data sets (235 data sets,
5,37,070 beats) it was observed that Wavelet Transform based algorithm gives mean
percentage error rate 7.76% while Neural Network based algorithm gives mean
percentage error rate 7.84%. But Up to 75% noise level NN perform better than WT.
Algorithms based on neural network and wavelet transform shows relatively robust
noise performance. Despite its simplicity, differentiation should be avoided with noisy
data. Digital filters are not suitable for noise whose' frequency band overlaps the
spectrum 0f Q RS complex. Despite its computational burden t he use 0 f a Neural
Network for QRS detection (Nonlinear Prediction) is an interesting academic
exerCIse. Wavelet transforms are fairly novel approaches for processing of non-
stationary signals. As a single detection criterion always has its particular weaknesses,
a combination of algorithms might perform better extracting the strength from each
algorithm.
The use of the composite data in the tuning procedure requires a compromise in the
selection of constants for all of the algorithms. The best choice of parameters for the
composite noise may not yields the best results for other types of noise. The result for
a given noise type can often be improved if the algorithm parameters a re selected
specifically for that noise type. The use of adaptive' thresholding and adaptive peaks
pruning improvc the performance.
( START )
Select Threshold
Slope threshold ~ O.25max[y(n)]
~/
~/"~ :---...
N Next I
<____
If!(i):>
~ slope threshold./' / j=i+1
~----
Iv_ /~
Search adjacent
maximum
and count as QRS
Nexti
y
i=i+1
N
STOP
106
START
N
Nen~
~ y(i), y(H'l), y(I+2) > 0.1
I=i~
y N
N
Nextj
~l}<-o.l j=j+l
Next I
------------ ----
~X(i+l), ,.,XO+l) >= Threshold ~
i=i+1
--------.
-------
.__
._--_._----.------_._--
. _..=-=r:=
__._-~+----
y
Search adjacent (25 sample) maximum
and count a. QRS oomplex
y
..•.•..
N
\
107
START
,.---~l ,
Smooth rectified first derivative Yin)
-
---~~~~---~~---~_._~~~---~----~--
Add smoothed first derivative to rectified
second derivative
n
Select threshold
Primary threshold ~ O.4max[Y,(n)]
Secondary threshold = 0.05max(Y3(n)]
N Next i
i=i+1
START
1
Low pass filter Yl(n)
, .
Select threshold
Threshold ~ 0.1 25max[Y4(n)]
~>
--------th~~--- N JI Next sample
y
I Search adjacent maximum
and count as QRS .
C~)
109
START
_=1
Low. pass filter
--*-- ] differentiator
Squaring operation
Moving average
Select threshold
N Next
~th"'h~ sample
[Y
Search adjacent maXimu:J
[ and count as QRS
~-~~
Next /~~~
sample
Y N
CSTOP~
110
C START)
i
Read the Signal x(n)
Moving average
Match filtering
--------- -----~
N
Next
~ y(n) > threshold
sample
JY
Search valley point between
maxima pair and count as QRS
1__ I.
s~~~le.
y
~
~More data?
N
C-~!O~_~
ill
START
N
~RS1>=QRS2 Exact QRS = QRS2
------
y
ExactQRS = QRS1
CSTOP~
.,
REFERENCES
1999.
[51] I. Daubechies, Ten lectures on wavelets, SIAM, 1992.
[52] S. G. Mallat, "A Theory for Multiresolution Signal Decomposition: The
Wavelet Representation," IEEE Transaction on PatternAnalysis and Machine,
Intelligence. vol. 11, pp. 674-692, 1989.
[53] M. Akay, Detection and Estimation Methods for Biomedical Signals,
Academic Press.
[54] D. L. Donoho, "De-Noising by soft-thresholding," IEEE Trans. 011 Inf.
Theory, vol. 41, pp. 613-627,1995.
[55] M. Misiti, Y. Misiti, G. Oppenheim, and J. M. Poggi, Wavelet Toolboxfor use
with MATLAB. Wavelet Toolbox User's Guide. The MathWorks, Inc., Natick,
1996.
[56] AAMI, Association for the advancement of medical instrumentation,
"Recommended practice for testing alld reporting performance results of
velltricular arrhythmia detection algorithms,"1998.