Real Time Implementation of Analysis of
Real Time Implementation of Analysis of
Abstract - Automatic extraction of time plane features is of ECG beats, P wave features and myocardial
important for cardiac disease diagnosis. ECG signals ischemia through the identification of ST deviations and
January 2012
commonly change their statistical property over time and are P -wave variations in the ECG. These include the use of
highly non- stationary signals. For the analysis of ECG signals
Time Domain Approaches, Artificial Neural Networks,
wavelet transform is a powerful tool. This paper presents a
discrete wavelet transform based system for detection and
Principal Component Analysis, Fuzzy and Neuro-Fuzzy
extraction of P wave, QRS complex, and ST segment. The Systems etc.
features like amplitude, frequency, energy are extracted from While the use of wavelets for analysis and
the Electrocardiogram (ECG) to classify them into normal and classification of biomedical signals, including some 83
arrhythmic. The extracted features are given as input to neural components of the ECG, are well documented [6, 7].
network to classify them into normal and arrhythmic. The Wavelets offer an important information-rich
w
signal from subjects using BioKit(3-lead ECG).The above
proposed to detect these features, our procedure using
wavelet technique provides less computational time and better
accuracy for classification, analysis and characterization of
discrete wavelets proved to be one among the best.
normal and abnormal patterns of ECG.
II. ELECTROCARDIOGRAM
Keywords : P, Qrs, St Segment, Discrete Wavelets,
Cardiological Analysis, Artificial Neural Networks,
Matlab, Lab View.
ie
V
I. INTRODUCTION
T
he ECG is a graphic record of the direction and
magnitude of the electrical activity that is
rly
of the time this starts in the sinoatrial (SA) node and the Ventricular tachycardia is a common, and often lethal,
predominant direction of the impulse across the atria is complication of a myocardial infarction (heart attack).
inferiorly and from right to left. This generates a positive
ii. Bradycardia
deflection in the leads that look at the heart from below.
A slow rhythm, (less than 60 beats/min), is
A typical P wave is is 0.06 to 0.10 sec (60 to 100 ms) in
labeled Bradycardia. This may be caused by a slowed
duration and is 0.2 mv to 0.3 mv in amplitude. As five of
signal from the sinus node (termed sinus Bradycardia),
the six chest leads are mostly on the left side of the
a pause in the normal activity of the sinus node (termed
body and in approximately the same vertical plane there
sinus arrest), or by blocking of the electrical impulse on
will generally not be much difference in the P-wave in
its way from the atria to the ventricles (termed AV block
these leads with small positive deflections seen in each.
or heart block). Bradycardia may also be present in the
Lead V1 looks across the atria and sees the atrial
normally functioning heart of athletes or other well
January 2012
w
the left atrium. The best two leads to examine the P- block have a better prognosis than do those with
wave are leads II and V1 as they look at the atria in cardiographic evidence of a left bundle lesion. [24].
opposite directions. These two leads are typically used When a bundle branch or fascicle becomes injured (due
as rhythm strips as they emphasis the P-wave. (Lead II to underlying heart disease, myocardial infarction, or
looks along the axis of the atria, and V1 looks across the
atria.) Disease processes that cause strain on the right
atrium cause a typical enlargement of the first half of the
ie
cardiac surgery), it may cease to conduct electrical
impulses appropriately. This results in altered pathways
for ventricular depolarization. Since the electrical
V
P-wave. This gives a taller, peaked P-wave. Lung impulse can no longer use the preferred pathway across
disease could lead to right atrial strain and thus this tall the bundle branch, it may move instead through muscle
P-wave is known as P pulmonale. Enlargement of the fibers in a way that both slows the electrical movement
left atrium causes exaggeration of second part of the P- and changes the directional propagation of the
rly
wave and this leads to the typical bifid "m" shape in lead impulses. As a result, there is a loss of ventricular
II, and larger negative deflection in second part of the P- synchrony, ventricular depolarization is prolonged, and
wave in lead V1. This is called P mitrale. there may be a corresponding drop in cardiac output.
b) QRS Complex iv. Ventricular fibrillation
The QRS complex is a structure on the ECG Ventricular fibrillation occurs in the ventricles
Ea
that corresponds to the depolarization of the ventricles. (lower chambers) of the heart; it is always a medical
Because the ventricle s contain more muscle mass than emergency. If left untreated, ventricular fibrillation can
the atria, the QRS complex is larger than the P wave. In lead to death within minutes. When a heart goes into V-
addition, because the His/Purkinje system coordinates fib, effective pumping of the blood stops. V-fib is
the depolarization of the ventricles, the QRS complex considered a form of cardiac arrest, and an individual
tends to look "spiked" rather than rounded due to the suffering from it will not survive unless cardiopulmonary
increase in conduction velocity. A normal QRS complex resuscitation (CPR) and defibrillation are provided
is 0.06 to 0.10 sec (60 to 100 ms) in duration. Not every immediately. Ventricular Fibrillation (VF) and Ventricular
QRS complex contains a Q wave, an R wave, and an S Tachycardia (VT) are life-threatening cardiac arrhythmias
wave. By convention, any combination of these waves generally observed in adults with coronary artery
can be referred to as QRS complex. disease[21].
i. Tachycardia c) ST-SEGMENT
Tachycardia typically refers to a heart rate that The ST segment represents the time between
exceeds the normal range for a resting heart rate. the ventricular depolarisation and the repolarisation. The
Ventricular tachycardia is a potentially life-threatening ST segment begins at the end of the QRS complex
cardiac arrhythmia that originates in the ventricles. It is (called J point) and ends at the beginning of the T wave.
usually a regular, wide complex tachycardia with a rate Normally, the ST segment measures 0.12 second or
between 120 and 250 beats per minute. a. Some less. The precise end of depolarisation (S) is difficult to
tachycardias are relatively harmless and need no determine as some of the ventricular cells are beginning
treatment, but others can be life- threatening [22]. to repolarise. Abnormalities of the ST segment may
consist of either abnormal straightening, depression, or interchangeably. Filter banks are structures that allow a
elevation. ST segment changes can be caused by signal to be decomposed into sub signals through
serious impairments such as hypertension or coronary digital filters, typically at lower sampling figure 2 shows
artery disease. a two-band filter bank.
i. Myocardial Ischemia
Heart disease is the one of the leading causes
of death all over the world with Myocardial Ischemia and
Infarction (collectively called Coronary Heart Disease or
CHD) being the most common among these cardiac
disorders. Myocardial Ischemia and Infarction stem from
the insufficient supply of blood to the heart muscle
January 2012
(myocardium) due to blockages in the coronary artery,
which is responsible for providing blood to the heart. Fig 2 : One- le vel two band perfect reconstruction filter
The development of plaque within the coronary artery bank.
that blocks more than 7000 of the lumen of the vessel
can cause symptoms of Myocardial Ischemia, such as The DWT analyses the signal at different
decreased exercise tolerance and exertional angina to resolution (hence, multiresolution) through the
85
appear. At times this may be the first instance where the decomposition of the signal into several successive
subject begins to experience effects of the suboptimal frequency bands. The DWT utilizes two set of functions
w
relaxation and contraction patterns are affected which property that they can be obtained as the weighted sum
causes variations in the ST-level and T-wave in the of the scaled (Dilated) and shifted version of the scaling
Electrocardiogram (ECG) due to the development of an function itself:
injury current [10] between the ischemic and non-
ischemic regions of the heart. If the blood supply to the
heart muscle is restored, Myocardial Ischemia can be
reversed thus making the early and correct diagnosis of
ie (1)
V
Myocardial Ischemia an imperative task. Myocardial (2)
Infarction, however, is not reversible and represents the
death of heart muscle due to prolonged lack of blood
supply to the heart. Here, h[n] and g[n] are the half band low pass
rly
(compact support) as contrasted with Fourier methods individual steps are described separately in the following
based on sinusoids of infinite duration. It is possible to topics.
analyse any signal by using an alternative approach
called the multi resolution analysis (MRA). MRA, as
implied by its name, analyses the signal at different
frequencies with different resolutions. Every spectral
component is not resolved equally as was the case in
the STFT. 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 Wavelet analysis does this by
using a windowing technique with variable-sized Fig 3 : Block Diagram of ECG characteristic points
regions. Discrete wavelet transform (DWT) is obtained extraction
simply by passing a discrete signal through a filter bank.
Wavelet theory can be understood and a) Denoising And Baseline Drift Removal
developed only by using such digital filters[4]. This is The ECG signal is acquired using Biokit
the meeting point between wavelets and sub band physiograph and abnormal data are collected from
coding and the origin of two different www.physionet.org. Pre-processing of ECG signals
nomenclatures for the same concepts. In fact, wavelet helps us to remove unwanted components in ECG
transform and sub band coding are so closely comprises of Power line interference, Electrode pop or
connected that both terms are often used
© 2011 Global Journals Inc. (US)
Real Time Implementation of Analysis of Ecg Characteristic Points Using Discrete Wavelets
contact noise, Patie nt–electrode motion artifacts, DWT and the approximation (A4 and A6) coefficients
Electromyographic (EMG) noise, Baseline wandering. are reconstructed separately. By subtracting A6
Among these noises, the power line from the A4, QRS complex is extracted.
i n t e r f e r e n c e and the baseline wandering are most
significant and can strongly affect ECG signal analysis. d) St-Segment Detection By Fft Approach
The power line interference is a narrow-band noise An FFT computes the DFT and produces
centered at 60 Hz (or 50 Hz) with a bandwidth of less exactly the same result as evaluating the DFT definition
than 1 Hz. Usually the ECG signal acquis ition directly; the only difference is that an FFT is much faster.
hardware can remove the power line interference. The DFT is defined by the formula. [12][13]
However the baseline wandering and other wideband
noises are not easy to be suppressed by hardware (1)
January 2012
w
the above noises are removed by taking two (3)
approximation level coefficients such as A4 and A10 of
Daubechies wavelet. Because of increasing the levels of
decomposition the baseline wander gets corrected Where as the IFFT can be formulated as-
automatically. Moving Average Algorithm is used to
remove the baseline drift and discrete wavelets are used
to remove the noises for ST segment detection.
ie (4)
V
b) P Wave Extraction
P-wave extraction or isolation can be performed Fast Fourier transform (FFT) is speed-up
by various methods like Emperical Mode Decomposition technique for calculating discrete Fourier transform
(EMD), Fast Fourier Transform, Dyadic Transform, where DFT, which in turn is discrete version of
rly
Application of time window or a moving average filter continuous Fourier transform, which indeed is origin for
etc. Here P wave extraction, was performed by using all its versions. So, historically continuous form of the
Daubechies wavelets. transform was discovered, then discrete form was
c) QRS Complex Extraction created for sampled signals and then algorithm for fast
calculation of discrete version was invented.
Ea
i. R peak detection
Peaks of the R waves in signals from the MLII ALGORITHM
lead have the largest amplitudes among other leads. 1) As one can see the ECG is uneven. Thus our first
In order to detect the peaks, specific details of the step is to straighten it. The idea is to apply direct
signal were selected. Details 2^3 – 2^5 were kept fast Fourier transform (FFT), remove low
and all the details were removed. This procedure frequencies
r e mo v es low frequencies and h i g h frequencies. 2) Restore ECG with the help of inverse FFT (IFFT).
The attained signal sample s were then squared. High 3) Our third step is to find local maxima. To do that
amplitude transitions of the signal were then more we use windowed filter that “sees” only maximum
noticeable, even if R peaks are deformed. Then a in his window and ignores all other values. On this
practically lo wer limit is applied on the signal to remove step we use window of default size.
unrelated noisy peaks. Since n o subsequent beats 4) Now we should remove small values and preserve
will occur in less than 0.25 second, pseudo-beats are significant ones. Here we are using a threshold
also removed. Detectio n of R peaks is very important filter.
because they define the cardiac beats. Heart rate is 5) In this case the result is good but in general case
the important parameter that is detected for we cannot be sure we have all the peaks. So the
analyzing the abnormality in the heart. Heart rate is next step is to adjust filter window size and repeat
calculated based on R-R interval. filtering. (All peaks of the signal detected)
ii. QRS complex extraction 6) Find all the peaks (R-peaks) values.
For QRS complex extraction the d e n o i s e d 7) Create two temporary matrixes according to
ECG signal i s d e c o m p o s e d into 6 levels by using length of the input sequences.
© 2011 Global Journals Inc. (US)
Real Time Implementation of Analysis of Ecg Characteristic Points Using Discrete Wavelets
January 2012
onset by adding 150 samples).
This technique is called as falling edge method
and a small demerit of this method is that here we have
to consider S and j point as same. As our main motto is
to find out Ischemia, so this method can be useful
because in most of the cases; as the S and J point is
87
same in Ischemic condition. This method can also be
implemented for other ECG signals like (ST Segment
w
i. Wavelet Compression
Instead of submitting the ST segments directly Fig 4 : Performing Baseline Drift removal and Noise
to the classification phase, they were pre-processed to cancellation.
reduce the number of classifier parameters. Pre-
processing was performed by using biorthogonal
wavelets, bior1.1 and bior2.2, with decomposition levels
ie
ii. P Wave Extraction
V
ECG SIGNAL
from 1 to 3. 1500
1400
1100
900
600
88
Fig 9 : ST Segment Detection of Standard or Normal ECG Signal
Global Journal of Researches in Engineering ( F ) Volume XII Issue vI Version I
w
ie
Fig10 : Level-2 Wavelet Decomposed ST-Segment of Normal ECG signal.
V
rly
Ea
January 2012
89
w
ie
V
Fig 16 : Isolated P wave and its characteristics
rly
Ea
90
Fig 21 : BPN classification -Tachycardia signal
Global Journal of Researches in Engineering ( F ) Volume XII Issue vI Version I
w
ENHANCEMENT Signal Analysis Using Wavelet Transforms” Bulg.
J.hys. 35 (2008) 68–77.
In this paper, we have proposed an algorithm 7. S. Z. Mahmoodabadi, A. Ahmadian, M. D.
based on discrete wavele t transform for the
extraction of P wave, QRS complex, ST segment. T wave
extraction and analysis is currently under our
research.The above wavelet technique provides less
ie Abolhasani Ecg Feature Extraction
Daubechies Wavelets, Proceedings of the fifth
IASTED International conference, Visulalization,
using
V
imaging and image processing September 7-
computational time and better accuracy for 9,2005,Benidorm,Spain.
classification, analysis and characterization of normal 8. K. Sternickel, “Automatic Pattern Recognition in Ecg
and abnormal patterns of ECG. The automatic feature Time Series”, Computer Methods and Programs in
extraction and classification was implemented using
rly
January 2012
17. A.E. Cetin, A.H. Tewfik, Y. Yardimci, “Coding of Ecg
Signals by Wavelet Transform Extrema”, IEEE, 0-
7803-2127-8/94, pp 544-547, Aug, 1994.
18. P. de Chazal', B. G. Celler' and R. B. Reilly, “Using
Wavelet Coefficient for the Classification of the
Electrocardiogram”, Proceedings of the 22"d Annual
EMBS International Conference, July 23-28, 2000 91
Chicago IL.
w
25, 2004,pp. 1715–172.
20. P.S. Addison, J.N. Watson, G.R. Clegg, M. Holzer,
G. Sterz, C.E.Robertson, “Evaluating Arrhythmias in
ECG Signals using Wavelet Transforms”, IEEE
21.
Engineering in Medicine and Biology,pp 104-109,
Sept/Oct, 2000.
Emran M Abu Anas, Soo Y Lee, Md K
ie
V
Hasan,“Sequential algorithm for life threatening
cardiac pathologies detection based on mean
signal strength and EMD functions”, Anas et al.
BioMedical Engineering OnLine 2010.
rly