You are on page 1of 123

Early Myocardial Infarction Detection

By
Kasturi Joshi
Edward Labrador
(Team # 17)



A Project Report
Presented to
The Faculty of Department of General Engineering
San Jose State University


In Partial Fulfillment
Of the Requirements for the Degree
Master of Science in Engineering
May 2009
Early Myocardial Infarction Detection ii




















2009
Kasturi Joshi
Edward Labrador

ALL RIGHTS RESERVED
Early Myocardial Infarction Detection iii



APPROVED FOR THE DEPARTMENT OF GENERAL ENGINEERING




Dr. Leonard Wesley


Dr. Mallika Keralapura


Dr. Sudhi Gautam


APPROVED FOR THE UNIVERSITY








Early Myocardial Infarction Detection iv

Abstract
Cardiovascular heart disease, such as myocardial infarction, is the number one leading cause of
death in United States. Having the ability to detect the symptoms and the ability to detect the
onset of myocardial infarction can greatly decrease the mortality and morbidity of patients. This
project report presents the ability of detecting the onset of symptoms of myocardial infarction
using electrocardiogram (ECG). The proposed technique for identifying the isoelectric ST-
segment of an ECG is by using Biorthogonal Wavelet Transform. The ST-segment is then
compared to an isoelectric baseline, using the PQ segment, which determines if theres a
presence of myocardial infarction. An ST-segment that deviates from the baseline by 1mV is a
probable myocardial infarction. Having an ST elevation for more than 5 minutes determines that
a myocardial infarction is present and a patient needs to be alerted. A program based on Matlab
software was written to perform the identification of myocardial infarction. ECG datasets were
gathered from Physiobanks Automated Teller Machine database. The accuracy of the written
code and its ability to detect true positive myocardial infarction was determined using the ROC
analysis. The performance of the code showed that it can accurately determine true positives and
true negatives in an ECG dataset. The accuracy of this project was proven to approximately 73%
from the 54 ECG datasets tested from 5 different physiobank databases.








Early Myocardial Infarction Detection v

ACKNOWLEDGEMENT

We would like to express our gratitude to Prof. Dr. Mallika Keralapura, Dept of Electrical
Engineering, San Jose State University and Dr. Sudhi Gautam for their generous guidance,
encouragement, direction and support in completing this project.
We would like extend our sincere gratitude to Prof. Leonard P. Wesley, Dept. of Computer
Engineering for an opportunity to pursue ENGR 298 course under his guidance, precious
suggestions, and advice.
We would also like to extend our special thanks to the members of our family. Without their
support and encouragement this project would not be complete.




- Kasturi Joshi
- Edward Labrador




Early Myocardial Infarction Detection vi

Table of Contents
List of Figures .............................................................................................................................. viii
List of Tables .................................................................................................................................. ix
List of Equations ............................................................................................................................. x
I.Objective ....................................................................................................................................... 1
II.Introduction ................................................................................................................................. 1
III.Anatomy of Heart ....................................................................................................................... 2
IV.Physiology of Heart ................................................................................................................... 5
V.Myocardial Infarction .................................................................................................................. 7
a.Diagnostic Studies to detect Myocardial Infarction ............................................................... 11
i.Blood Analysis ..................................................................................................................... 11
ii.Imaging ............................................................................................................................... 14
iii.Electrical Activity Monitoring ........................................................................................... 16
VI.Electrocardiography ................................................................................................................. 16
a.Measuring ECG ...................................................................................................................... 18
VII.Wavelet Transforms ............................................................................................................... 23
VIII.Introduction to Early Myocardial Infarction Detection System ............................................ 33
a.Background............................................................................................................................. 33
b.Materials and Method ............................................................................................................ 36
i.Database Description .......................................................................................................... 36
ii.Method for ST-elevation detection ..................................................................................... 37
IX.Testing and Verification .......................................................................................................... 47
a.Results..................................................................................................................................... 47
b.Discussion............................................................................................................................... 48
X.Economic Justification .............................................................................................................. 50
a.Executive Summary ................................................................................................................ 50
b.Problem Statement.................................................................................................................. 52
c.Solution and Value Proposition .............................................................................................. 52
d.Market Size ............................................................................................................................. 53
e.Competitors............................................................................................................................. 55
f.Customers ................................................................................................................................ 56
Early Myocardial Infarction Detection vii

g.Cost ......................................................................................................................................... 57
i.Fixed costs ........................................................................................................................... 57
ii.Variable Costs .................................................................................................................... 58
h.Price Point .............................................................................................................................. 59
i.SWOT Assessment ................................................................................................................... 59
j.Investment Capital Requirement ............................................................................................. 60
k.Personnel ................................................................................................................................ 62
l.Business and Revenue Model .................................................................................................. 63
m.Strategic Alliances/Partners .................................................................................................. 64
n.Profit and Loss ....................................................................................................................... 64
i.Demand Assumptions ........................................................................................................... 65
ii.Product Assumptions .......................................................................................................... 65
o.Exit Strategy ........................................................................................................................... 66
XI.Future Directions ..................................................................................................................... 67
XII.Conclusion .............................................................................................................................. 68
XIII.References ............................................................................................................................. 70
Appendix A ................................................................................................................................... 74
Appendix B ................................................................................................................................... 87
Appendix C ................................................................................................................................. 110
Appendix D ................................................................................................................................. 112


Early Myocardial Infarction Detection viii

List of Figures
Figure 1: Anatomy of Heart [Source: Heart Information Center (2006)] ...................................... 3
Figure 2: Electrical Conduction System of the Heart Bundle Branch Block of Heart [Source:
Heart Information Center (2006)] ................................................................................................... 6
Figure 3: Myocardial Infarction [Source: Coronary Artery Disease, 2008] ................................... 8
Figure 4: Resulting zones from Myocardial Infarction [Source: Myocardial Infarction (2009)] .. 9
Figure 5: An ECG with the major peaks and intervals. (Vibes Electrocardiogram, n.d.) ........... 19
Figure 6: Illustrates the cause of deflection of an ECG (O Grady, M.R., n.d.) .......................... 19
Figure 7: An Einthoven's triangle with Lead I, II, and III. .......................................................... 20
Figure 8: Axial representation of Lead I, II, III, aVR, aVL, and aVF. (O'Grady, M.R., n.d.) .... 21
Figure 9: Typical ECG waveform [Source: Jouck. P.P.H. (2004)] .............................................. 22
Figure 10: 2.4 Biorthogonal Wavelet and ECG Signal ............................................................... 31
Figure 11: Types of Biorthogonal Wavelets available in Wavelet Toolbox 3.0 of Matlab 7.1 ... 32
Figure 12: Normal ECG waveform on Strip Chart [Source: Barron Jon, 2007] .......................... 34
Figure 13: Dyadic Wavelet Transform of ECG signal [Source: Jouck. P.P.H. (2004)] ............... 38
Figure 14: Biorthogonal Wavelet Transform of ECG Signal from 2
1
to2
4
level ......................... 39
Figure 15: Method for ECG Parameters Detection [Source: Tompkins, 2000] ........................... 40
Figure 16: Filter expressed in Direct Form II transposed structure [Source: Matlab7.1R14 Help]
....................................................................................................................................................... 41
Figure 17: Baseline Wander elimination ...................................................................................... 42
Figure 18: R-peak Detection and PQSTJK extraction of ECG wave at level 2
4
.......................... 43
Figure 19: Shows an intuitive GUI result for an ECG data with no MI detected ......................... 45
Figure 20: Shows an intuitive GUI result for an ECG data with an MI detected. ........................ 45
Figure 21: Flowchart for ST-elevation detection ......................................................................... 46
Figure 22: Receiver Operating Characteristic Curve ................................................................... 49
Figure 23: An estimate of myocardial infarction prevalence in the United States ....................... 53
Figure 24: An estimate of new and recurrent incidence of myocardial infarction in the United
States ............................................................................................................................................. 54
Figure 25: The direct and indirect cost of myocardial infarction per year ................................... 54
Figure 26: Initial Investment Requirement of MI Detector device .............................................. 61
Figure 27: Yearly Model of MI Detector device .......................................................................... 61
Figure 28: The quarterly model of SMART Medical Devices ..................................................... 66




Early Myocardial Infarction Detection ix

List of Tables
Table 1: Macroscopic & Microscopic Findings of MI [Source: Klatt.E.C, 2008] ....................... 12
Table 2: Typical Amplitudes and Durations for ECG signal [Source: Saritha. et.al. (2008)] ...... 35
Table 3: Testing Results for ST-change detection program ......................................................... 48
Table 4: Data Points for ROC Curve ............................................................................................ 49
Table 5: Fixed cost of MI Detector device ................................................................................... 58
Table 6: Variable cost of MI detector device ................................................................................ 59
Table 7: SWOT assessment of MI Detector medical device ........................................................ 60
Table 8: The break-even table of MI Detector device .................................................................. 62
Table 9: The quarterly model of SMART Medical Devices ......................................................... 66
















Early Myocardial Infarction Detection x

List of Equations
Equation (1) Fourier Transform .................................................................................................... 24
Equation (2) Short Time Fourier Transform ................................................................................. 25
Equation (3) Mother Wavelet ....................................................................................................... 26
Equation (4) Continuous Wavelet Transform ............................................................................... 26
Equation (5) Complete Equation for Continuous Wavelet Transform ......................................... 26
Equation (6)Scaling and Mother Wavelet Function of Biorthogonal Wavelet ............................. 29
Equation (7)Dual Scaling and Mother Wavelet Function of Biorthogonal Wavelet .................... 30
Equation (8)Frequency Dilation for Biorthogonal Wavelet ......................................................... 30
Equation (9)Frequency Wavelet for Biorthogonal Wavelet ......................................................... 30
Equation (10)Biorthogonal Wavelet Decomposition .................................................................... 30
Equation (11)Signal Filtering Equation ........................................................................................ 41
















Early Myocardial Infarction Detection 1

I. Objective
The objective of this project is to create a smart algorithm that can detect the elements of
an electrocardiogram (ECG) and determine if symptoms of myocardial infarction are present.
The algorithm is written in MATLAB, but when coupled with a portable ECG machine, can
provide greater protection against mortality and morbidity associated to myocardial infarction.
II. Introduction
Myocardial Infarction (MI) is commonly referred to as Heart Attack. A heart attack
is defined by World Health Federation as a condition which occurs when the hearts supply of
blood is stopped (World Health Federation, 2009). It is highly important to understand the
meaning of the words myocardial infarction in order to diagnose the disease. The word
myocardial means related to the heart muscle and the word infarction means tissue death due
to lack of oxygen and myocardial infarction means heart muscle or tissue death due to lack of
oxygen. When the hearts blood supply is restricted, a sequence of injurious events occur
beginning with subendocardial or transmural ischemia, followed by necrosis, and eventual
fibrosis (scarring) if the supply isnt restored in an appropriate period of time (Yanowitz, 2006).
The American heart association defines myocardial infarction as the damaging or death of an
area of the heart muscle (myocardium) resulting from blocked blood supply to the area; medical
term for a heart attack (American, 2008).
The need for early diagnosis of myocardial infarction is apparent from the statistics
estimated by American heart association. The United States American Heart Association
estimates 80,700,000 people suffered with some form of cardiovascular symptom, out of which
8,100,000 suffered from myocardial infarction alone. The heart disease and stroke statistics for
Early Myocardial Infarction Detection 2

the year 2008 by the American Heart Association publishes that there are 600,000 new
incidences of myocardial infarction reported annually and 320,000 recurrent attacks annually.
Hospital stays in 2005 were recorded as 1.8 million in-patients, which amounted to $256 billion
dollars in direct and indirect cost of myocardial infarction. American Heart Associations
statistics also show that Heart Attacks are still the leading cause of death in the United States of
America.
Myocardial Infarction is not a fatal condition if proper medical help is received at the
right time. MI can be diagnosed by various diagnostic tools like Angiogram, Echocardiogram,
Blood Analysis, Chest X-ray and the oldest and most trusted tool by the doctors ECG or
electrocardiography. Not only is ECG the oldest tool available to monitor the electrical activity
of the heart, it is also the most efficient diagnostic tool, giving speedy diagnosis compared to the
other available tool for monitoring heart activity. Early recognition of symptoms of myocardial
infarction can reduce the morbidity and mortality of patients. The literature shows that
continuous monitoring of heart electrical activity decreases the changes of fatal myocardial
infarction and the project aims at developing an algorithm that can easily be incorporated in the
current available portable and wireless ECG machines to create a standalone state of the art
smart medical device for giving an early warning against the imminent myocardial infarction.
III. Anatomy of Heart
It is important to understand the anatomy of the heart in order to understand what
myocardial infarction is and why does it occur. Heart is a muscular organ that supplies blood
through the body. It is located between the lungs in the left side of the sternum. The heart has
Early Myocardial Infarction Detection 3

four chambers as can be seen in Figure 1 below. The four chambers are Right Atrium, Right
Ventricle, Left Atrium and Left Ventricle.








Figure 1: Anatomy of Heart [Source: Heart Information Center (2006)]
Right Atrium: This chamber consists of de-oxygenated blood that returns from the body,
this de-oxygenated blood is then passed on to the Right Ventricle through the tricuspid
valve.
Tricuspid Valve: It is a one-way valve that controls the flow of blood from the Right
Atrium to the Right Ventricle.
Right Ventricle: It is a chamber that consists of de-oxygenated blood which is passed into
the lungs for oxygenation via the pulmonary valve.
Pulmonary Valve: It is a one-way valve that controls the flow of blood from Right
Ventricle to the pulmonary arteries.
Early Myocardial Infarction Detection 4

Pulmonary Arteries: These arteries supply de-oxygenated blood to the lungs where the
blood gets oxygenated.
Pulmonary Veins: After the blood passes to the lungs from the pulmonary arteries, the
blood gets oxygenated and flows from the lungs to the pulmonary veins, the pulmonary
veins supply the oxygenated blood from the lungs to the Left Atrium.
Left Atrium: This is the chamber where the oxygenated blood enters from the pulmonary
vein. The blood from the left atrium is then forced into the left ventricle via the mitral
valve.
Mitral Valve: It is a one-way valve that controls the flow of blood from the left atrium to
the left ventricle.
Left Ventricle: The oxygenated blood enters the left ventricle through the mitral valve
and is then forced from the left ventricle into the aorta through the aortic valve.
Aortic Valve: It is a one-way valve that controls the flow of blood from the left ventricle
to the aorta.
Aorta: It is largest artery in the body and the aorta branches into smaller arteries. The
aorta carries the oxygenated blood from the heart to the other parts of the body.
The Texas Heart Institute gives some interesting and fun facts about heart and they are
listed below:
Heart Weighs between 7 and 15 ounces (200 to 425 grams) and is little larger than the
size of the fist
In a lifetime, the heart expands and contracts 3.5 billion times
Early Myocardial Infarction Detection 5

In a day, heart pumps 2,000 gallons (7,571 liters) of blood and the heart beats 100,000
times
IV. Physiology of Heart
With understanding the anatomy of heart, this section would discuss the physiology of
the heart, the electrical conductivity that drives the heart and pumps the blood throughout the
body. The heart is made of cardiac muscle tissue that contracts and relaxes throughout the
lifetime of a person and this contraction and relaxation of the muscles drives the blood from the
heart. The contraction and relaxation of the cardiac muscle is in a rhythm, when the cardiac
muscles of the hearts ventricles contract, it is called as systole and when the cardiac muscles of
hearts ventricles relax, it is called as diastole. A network of nerve fibers coordinates the
contraction and relaxation of the cardiac muscles tissue to obtain an efficient, wave-like pumping
action of the heart (Cardiovascular Consultants, 2006).
Figure 2 shows the diagram of heart with some of the key elements of labeled that are
necessary in understanding the physiology of heart. Sinoatrial node commonly known as the SA
node is the natural pacemaker of the heart. It triggers an electrical impulse that produces a
heartbeat. The impulse trigger passes through the atria and causes the muscles to contract. The
impulse that travels from the SA node reaches the Atrioventricular node commonly known as the
AV node after the contraction of the atrium muscles. The AV node triggers another pulse which
now causes the ventricles to contract.
Early Myocardial Infarction Detection 6








Figure 2: Electrical Conduction System of the Heart Bundle Branch Block of Heart [Source:
Heart Information Center (2006)]
The ventricular contraction is brought about by the bundle of His which receives the
triggering impulse from the AV node. The bundle of His then divides the impulse into the left
bundle branch and the right bundle branch, which in turn contracts the left and right ventricles.
The contraction and the relaxation of the heart muscles thus brought about by the SA and the AV
nodes is wavelike and in rhythm. The rhythmic wavelike activity can be heard by the doctors
using the stethoscope. It can also be imaged using echocardiography that uses the principle of
ultrasound or heart imaging. Electrocardiography is another diagnostic tool for monitoring the
rhythmic electrical activity of the heart. Subsequent sections will introduce the principle behind
electrocardiography along with its advantages and disadvantages.
This rhythmic electrical activity of the heart sometimes is lost and the electrical impulse
cannot travel throughout the heart because part of the hearts conduction system is blocked
(Heart Information Center, 2006) due build of plaque, cholesterol deposits in the arteries that
supply blood to the heart. This is one of the reasons that lead to the arrhythmic electrical activity
of the heart. There are several ways to diagnose the cause of loss of rhythm in the conduction of
Early Myocardial Infarction Detection 7

heart. Chest X-ray, Angiogram, echocardiogram and electrocardiogram are some of the
diagnostic tools that aid in defining the cause of blockage of the arteries supplying blood to the
heart. Myocardial Infarction is one such condition that results due to the blockage of the artery
supplying blood to the heart. What is myocardial infarction and how it is caused is discussed in
the next section.
V. Myocardial Infarction
Myocardial Infarction is a type of ischemic heart disease. Myocardial infarction (MI) is
the irreversible necrosis of heart muscle secondary to prolonged ischemia (Samer Garas et al.
2008). It is caused due to relative insufficiency of oxygen to the heart muscles called cardiac
muscles. Myocardial Infarction is associated with acute coronary syndrome and approximately
90% of MIs result from an acute thrombus that obstructs an atherosclerotic coronary artery
(Samer Garas et al. 2008).
Myocardial Infarction can result due to the following causes:
Occlusive intracoronary thrombus - a thrombus overlying an ulcerated or fissured
stenotic plaque causes 90% of transmural acute myocardial infarctions (Klatt E.C,
2008).
Vasospasm - with or without coronary atherosclerosis and possible association with
platelet aggregation (Klatt E.C, 2008).
Emboli - from left sided mural thrombosis, vegetative endocarditis, or paradoxic emboli
from the right side of heart through a patent foramen ovale (Klatt E.C, 2008).
Narrowing and hardening of heart muscles is process that is known in the medical terms
as Atherosclerosis. Atherosclerosis when happens in the arteries that supply blood to the heart,
Early Myocardial Infarction Detection 8

it results in coronary heart diseases. There are various coronary heart diseases and myocardial
infarction is one of the types of coronary heart disease. When the blood supply of the heart
muscles is hampered, it can lead to chest pain called angina and if angina is not treated, it may
result in heart attack. The blood vessels that supply blood to heart are called the coronary
arteries. There are three coronary arteries that supply blood to the heart. These three coronary
arteries supply blood to three different areas of heart muscles cells. Since the area of these heart
muscles cells is known, myocardial infarction can occur in the anterior, lower, and the lateral
heart territory (The Myocardial Infarction-Heart Attack, 2006). Over the years cholesterol and
other fatty substances in the blood get deposited on the arterial wall and builds to form a Plaque
or Atheroma. The plaque build up obstructs the flow of blood to the heart muscle. This is
depicted in the figure 3 below.








Figure 3: Myocardial Infarction [Source: Coronary Artery Disease, 2008]
The obstruction of blood flow across the coronary artery develops a pain in the chest
called angina. It also develops pain in the arms, around the neck and back of the chest. Necrosis
Early Myocardial Infarction Detection 9

of heart tissue begins when the plaque bursts and causes a blood clot that blocks the artery
completely. This cuts off the blood supply to an area of the heart. As the supply of oxygen to the
blocked artery stops, the heart muscle cells start to die. The dying heart muscle cells constitute
the zone of infarction as can be seen in figure 4. The area of heart muscle cells surrounding the
zone of infarction is called the zone of injury (as seen in figure 4), the heart muscle cells in this
area do not die but the working of those heart cells is hampered to an extent that the cells are
rendered non-functional. This is called a heart attack or myocardial infarction; it causes
permanent damage to that area of the heart. The zone surrounding the zone of injury is the zone
of ischemia; the heart muscle cells in this region are partially functional. If enough heart muscle
is damaged the heart may beat irregular or may even stop beating altogether.







Figure 4: Resulting zones from Myocardial Infarction [Source: Myocardial Infarction (2009)]
There are patterns that are observed by the cardiologists in prognosis of myocardial
infarction cases, they are as follows:
Transmural infarct - involving the entire thickness of the left ventricular wall from
endocardium to epicardium, usually the anterior free wall and posterior free wall and
Early Myocardial Infarction Detection 10

septum with extension into the RV wall in 15-30%. Isolated infarcts of RV and right
atrium are extremely rare (Klatt E.C, 2008).
Subendocardial infarct - multifocal areas of necrosis confined to the inner 1/3-1/2 of the
left ventricular wall. These do not show the same evolution of changes seen in a
transmural MI (Klatt E.C, 2008).
When myocardial infarction occurs there is gradual necrosis of heart tissue. The necrosis
of the heart tissue happens over a period of time and may vary with depending on the size of the
infarct. Table 1 gives the pathologic findings in terms of timeline for the necrosis of heart tissue.
It is well known that first myocardial infarction may not be fatal but subsequent infarcts
may prove fatal depending on the damage done by the previous infarcts. This also would change
the timeline for the necrosis of heart tissue and may result in sudden death. Sudden death is
defined as death occurring within an hour of onset of symptoms (Klatt E.C, 2008). Some pre-
existing conditions that may prove dangerous for subsequent infarcts are as follows:
Arrhythmias and conduction defects, with possible sudden death (Klatt E.C, 2008).
Extension of infarction, or re-infarction (Klatt E.C, 2008).
Congestive heart failure (pulmonary edema) (Klatt E.C, 2008).
Cardiogenic shock (Klatt E.C, 2008).
Pericarditis (Klatt E.C, 2008).
Mural thrombosis, with possible embolization (Klatt E.C, 2008).
Myocardial wall rupture, with possible tamponade (Klatt E.C, 2008).
Papillary muscle ruptures, with possible valvular insufficiency (Klatt E.C, 2008).
Ventricular aneurysm formation (Klatt E.C, 2008).
Early Myocardial Infarction Detection 11

After understanding what and how myocardial infarction occurs, it is now essential to
know how to get myocardial infarction diagnosed. As mentioned already in the introduction
there are several ways for diagnosis of myocardial infarction. The next section will describe a
few different diagnostic tools that diagnose myocardial infarction.
a. Diagnostic Studies to detect Myocardial Infarction
The diagnostic tools for studying myocardial infarction have been divided into three
types and they are as follows:
i. Blood Analysis
During the period of myocardial infarction the dying heart muscle cells release different
types of enzymes called as cardiac enzymes. These different cardiac enzymes are present in the
bloodstream at different intervals of time. The cardiac enzymes can be seen in the bloodstream as
early as start of the infarct. Blood analysis for these different enzymes can reveal the crucial
information for diagnosis of myocardial infarction.
The different cardiac enzymes are as follows:
Troponin (Samer Garas et al.,2008)
This enzyme plays a major role in diagnosis of myocardial infarction. The reason is
because Troponin I and T are structural components of cardiac muscle (Klatt E.C., 2008). The
level of troponins can be found in the bloodstream as early as 3 to 12 hours in myocardial
infarction. The levels of this enzyme will also remain elevated in the bloodstream for up to 2
weeks into myocardial infarction. The reason for troponin not being considered as the only blood
analysis enzyme is because another account of myocardial infarction happening in the time
period of already elevated levels of troponins will go unnoticed and may prove fatal.
Early Myocardial Infarction Detection 12

Table 1: Macroscopic & Microscopic Findings of MI [Source: Klatt.E.C, 2008]
Time of Onset
Gross Morphologic Findings
18-24 Hours
Pallor of myocardium
24-72 Hours
Pallor with some hyperemia
3-7 Days
Hyperemic border with central yellowing
10-21 Days
Maximally yellow and soft with vascular margins
7 Weeks
White fibrosis
Time of Onset
Microscopic Morphologic Finding
1-3 Hours
Wavy myocardial fibers
2-3 Hours
Staining defect with tetrazolium or basic fuchsin dye
4-12 Hours
Coagulation necrosis with loss of cross striations, contraction bands,
edema, hemorrhage, and early neutrophlic infiltrate
18-24 Hours
Continuing coagulation necrosis, pyknosis of nuclei, and marginal
contraction bands
24-72 Hours
Total loss of nuclei and striations along with heavy nuetrophilic infiltrate
3-7 Days
Macrophage and monoclear infiltration begin, fibrovascular response
begins
10-21 Days
Fibrovascular response with prominent granulation
7 Weeks
Fibrosis

Early Myocardial Infarction Detection 13

Also, troponin elevations have been found in other forms of conditions like renal failure
and also conditions related to skeletal muscles.
Creatine Kinase (Samer Garas et al.,2008)
This enzyme consists of 3 sub-enzymes. Each type of enzyme is related to a particular
part of the body. creatine kinase with muscle subunits (CK-MM), which is found mainly in
skeletal muscle; creatine kinase with brain subunits (CK-BB), predominantly found in the brain;
and myocardial muscle creatine kinase (CK-MB), which is found mainly in the heart (Samer
Garas et al.,2008). Creatine kinase (CK-MB) along with troponin is usually obtained together to
provide better diagnosis of myocardial infarction. The sensitivity of creatine kinase is
approximately 95%.
Myglobin (Samer Garas et al.,2008)
This is a type of protein that is found in both skeletal as well as cardiac muscles. The
function of myoglobin is to bind oxygen. This makes the identifying level of myoglobin in the
bloodstream important as it would help in determining the amount of injury made to the heart
muscle in myocardial infarction. Rise in the level of myoglobin is present even before creatine
kinase-MB, but the rise may or may not be related to myocardial infarction alone.
Lactate Dehydrogenase (Klatt E.C., 2008)
This enzyme like creatine kinase consists of 5 different enzymes and like all the other
enzymes does not help in diagnosis of myocardial infarction alone. When used in conjunction
with the other types of enzymes, the blood analysis for these enzymes gives excellent myocardial
Early Myocardial Infarction Detection 14

infarction diagnosis. It begins to rise in 12 to 24 hours following MI, and peaks in 2 to 3 days,
gradually dissipating in 5 to 14 days (Klatt E.C., 2008).
There are other blood analysis tests that are done as part of diagnosis for myocardial
infarction and they are as follows:
Complete blood cell count
Chemistry Profile
Lipid level Profile
C-reactive Protein (CRP)
These above mentioned blood analysis types are not specifically related in diagnosis of
myocardial infarction alone and are utilized as diagnostic methods for other types of conditions
and diseases as well.
ii. Imaging
There are several Imaging diagnostic tools available for diagnosis of myocardial
infarction. The imaging diagnostic tools are as follows:
Chest Radiography (Samer Garas et al.,2008)
Chest Radiography is another word for Chest X-ray. This imaging technique does not
provide results that are specific to myocardial infarction detection, but is usually done as one of
the first step towards assessing any patient admitted in an emergency room with a heart
condition. A chest Radiograph is used for assessing the size of the heart and also conditions such
as pneumonia that might be one of the reasons for certain types of heart conditions. The details
Early Myocardial Infarction Detection 15

revealed in a chest radiogram are mostly anatomic and macroscopic, for microscopic details
other imaging tools like angiogram proves helpful.
Echocardiography (Samer Garas et al.,2008)
Echocardiogram is an excellent imaging tool for cardiologists. It provides the extent of
the infarction and assesses overall left ventricle (LV) and right ventricle (RV) function (Samer
Garas et al., 2008). It also helps in diagnosis of different complications of the heart valves.
Echocardiography is an imaging tool is generally required by the physicians when all the other
tests are questionable or inconclusive.
Myocardial Perfusion Imaging (Samer Garas et al.,2008)
This imaging tool is generally used for patients with after heart attack to assess the
damage done to the heart muscle tissue by previous infarctions. This tool is also used for
prognosis of patients entering the emergency room with serious heart conditions.
Cardiac Angiography (Samer Garas et al.,2008)
Cardiac Angiography more commonly known as angiogram is a technique where a radio
opaque dye is inserted in the blood stream via the femoral artery and then a chest X-ray of the
patient is obtained to diagnose blockages in the coronary arteries. This type of imaging technique
has become very common in the recent years. The process through which is radio opaque dye is
inserted is called cardiac catherization. It is an imaging technique which is minimally invasive
and requires local anesthesia.
Early Myocardial Infarction Detection 16

iii. Electrical Activity Monitoring
Probably the most reliable and oldest available tool for measuring electrical activity of
the heart is Electrocardiography or more commonly known as ECG. ECG is considered as the
first diagnostic tool when evaluating patients with suspected Myocardial Infarction. It is
confirmatory of the diagnosis in approximately 80% of cases.
Electrocardiography when used as a diagnostic tool in myocardial infarction can yield the
following prognosis:
To rule out the Right Ventricular infarct, ECG recording on the right-sided setting for
patients with inferior Myocardial Infarction (Samer Garas et al., 2008).
Obtain daily serial ECGs for the first 2-3 days and additionally as needed (Samer Garas
et al., 2008).
Convex ST-segment elevation with upright or inverted T waves is generally indicative of
MI in the appropriate clinical setting (Samer Garas et al., 2008).
ST depression and T-wave changes may also indicate evolution of NSTEMI (Samer
Garas et al., 2008).
A more detailed description of what electrocardiography is and how it is used as a
diagnostic tool for monitoring electrical activity of the heart is given in the following section.
VI. Electrocardiography
Patients suffering from S-T elevated myocardial infarction can be diagnosed with
several type of diagnostic methodology. One of which is by using electrocardiography. The
recorded trace of electrocardiography is called an electrocardiogram (ECG).
Early Myocardial Infarction Detection 17

Electrocardiography is a non-invasive diagnostic procedure that records the electrical current
transmitted by the heart all over the body. The electrical current can be picked up by an
electrical sensing device, which is attached to an ECG machine. The electrical sensing devices
are strategically placed on the body surface to detect heart impulses. They can be placed in the
arms and legs. The recorded ECG is the representation of the depolarization and re-polarization
of the heart and can diagnose a patient by looking at the characteristics of the traced ECG
readings (Klabunde, R.E., 2007).
Every beating of the heart, an electrical impulse is generated and transmitted to the
myocardium which causes the pumping action of the heart and provides blood throughout the
body. There are 3 main deflections in an ECG: the P-wave, the QRS complex, and the T-wave.
The P-wave records the electrical activity of the atria. It starts from the SA node, which
generates an impulse. It causes an excitation to the atria and I then picked up by the AV node.
The P-wave usually lasts for about 0.8 to 0.1 seconds (80 to 100 ms). The impulse travels from
the AV node to the Bundle of His, which generates an isoelectric pattern in the ECG.
A trace between the onset of the P-wave to the onset of the QRS complex is called the P-R
interval. It is the representation of the onset atrial depolarization and the onset of ventricular
depolarization. The P-R interval has a period of 0.12 to 0.20 seconds (120 to 200 ms).
The next main deflection of an ECG is the QRS complex. It represents the ventricular
depolarization. The impulse travels from the Bundle of His to the ventricular walls through the
left and right bundle branches. The impulse causes contraction of the ventricular walls, which
causes the blood to be pumped out to the lungs and body. The QRS complex has a short
Early Myocardial Infarction Detection 18

duration, usually lasts for 0.06 to 0.1 seconds (60 to 100 ms). The short duration indicates that
the ventricular depolarization happens in a relatively quick time.
After the QRS complex, an isoelectric line called an S-T segment occurs, at which, there
is a complete depolarization in the ventricles. The isoelectric line of the S-T segment is very
important in diagnosing heart conditions in a patient, since a depressed or elevated S-T segment
represents a cardiac ischemia.
The last major deflection in an ECG is the T-wave. The T-wave represents the re-
polarization of the ventricles. It has a longer trace in the ECG reading. It is sometime followed
by a U-wave, which represents the remainder of the ventricular re-polarization.
The trace between the ventricular depolarization and re-polarization is called the Q-T
interval. The range of the Q-T interval is between 0.2 and 0.4 seconds (200 and 400 ms). The
duration of the Q-T interval is important in detecting certain types of tachyarrhythmias.
a. Measuring ECG
Electrical sensing devices or electrodes are placed strategically on top of the body to
detect the electrical activity of the heart and diagnose patients with different heart anomalies. In
addition, the recorded trace of the ECG is not always recorded as shown in figure 5. The trace
depends on the position of the lead.
The leads are placed on the body can be described as a positive lead and a negative lead.
The electrical impulse that is generated in the heart travels in parallel to the direction of the lead.
If the direction moves toward the positive lead, then a positive deflection takes place, on the
other hand, if the direction of the impulse moves toward the negative lead, then a negative
deflection takes place. This action is illustrated in figure 6.



Figure 5: An ECG with the major peaks and intervals. (Vibes Electrocardiogram, n.d.)

Figure 6: Illustrates the cause of deflection of an ECG (O Grady, M.R., n.d.)
Early Myocardial Infarction Detection
An ECG with the major peaks and intervals. (Vibes Electrocardiogram, n.d.)
Illustrates the cause of deflection of an ECG (O Grady, M.R., n.d.)
Early Myocardial Infarction Detection 19

An ECG with the major peaks and intervals. (Vibes Electrocardiogram, n.d.)

Illustrates the cause of deflection of an ECG (O Grady, M.R., n.d.)
Early Myocardial Infarction Detection 20

Electrodes are placed in the arms and legs, which are called the Einthoven's triangle. The
Einthovens triangle, shown in figure 7, is composed of Leads I, II, and III, which are the basic
electrodes of the 12 lead ECG system.





Figure 7: An Einthoven's triangle with Lead I, II, and III.
There are 3 additional leads that are developed from leads I, II, and III. They are called
the augmented limb leads, aVR, aVL, and aVF. The augmented limb leads views the heart in
different vectors compared to the original leads. It is the recording between one limb and two
other limbs. aVR, augmented vector right, is a recording between the positive lead in the right
arm and a combination of negative leads in the left arm and left leg. aVL, augmented vector left,
is between the positive lead of the left arm and combination of negative leads in the right arm
and left leg. aVF, augmented vector foot, is between the positive lead of the left foot and
combination of right arm and left arm.
Leads I, II, III, aVR, aVL, and aVF represents the hexial reference system which
determines the electrical axis of the heart. All leads are in the frontal plane axis as shown in
figure 8.
Lead I
Lead II Lead III
_
+
_
_
+ +


Figure 8: Axial representation of Lead I, II, III, aVR, aVL, and aVF. (O'Grady, M.R., n.d.)
Precordial leads, V1, V2, V3, V4, V5, and V6, are also called
are strategically placed on the chest overlying the heart or its vicinity. Unlike leads I, II, III, aVR,
aVL and aVF, the precordial leads records ECG in the horizontal plane. The precordial leads are
V1, V2, and V3 are called the right precordial leads; while V4, V5, and V6 are called left
precordial leads and all precordial leads are unipolar, which means it can be a positive lead or a
negative lead. The precordial leads provide different view of the electrical activity of the
and they are very useful in identifying the P
The ECG waveform follows a pattern that describes the physiological meaning of the
conduction of heart. Figure 9 shows such a typical waveform. The description for the typical
waveform with its analogous conduction activity is as follows:
Early Myocardial Infarction Detection

Axial representation of Lead I, II, III, aVR, aVL, and aVF. (O'Grady, M.R., n.d.)
Precordial leads, V1, V2, V3, V4, V5, and V6, are also called chest leads because they
are strategically placed on the chest overlying the heart or its vicinity. Unlike leads I, II, III, aVR,
aVL and aVF, the precordial leads records ECG in the horizontal plane. The precordial leads are
e right precordial leads; while V4, V5, and V6 are called left
precordial leads and all precordial leads are unipolar, which means it can be a positive lead or a
negative lead. The precordial leads provide different view of the electrical activity of the
and they are very useful in identifying the P-wave of an ECG recording.
The ECG waveform follows a pattern that describes the physiological meaning of the
conduction of heart. Figure 9 shows such a typical waveform. The description for the typical
veform with its analogous conduction activity is as follows:
Early Myocardial Infarction Detection 21
Axial representation of Lead I, II, III, aVR, aVL, and aVF. (O'Grady, M.R., n.d.)
chest leads because they
are strategically placed on the chest overlying the heart or its vicinity. Unlike leads I, II, III, aVR,
aVL and aVF, the precordial leads records ECG in the horizontal plane. The precordial leads are
e right precordial leads; while V4, V5, and V6 are called left
precordial leads and all precordial leads are unipolar, which means it can be a positive lead or a
negative lead. The precordial leads provide different view of the electrical activity of the heart
The ECG waveform follows a pattern that describes the physiological meaning of the
conduction of heart. Figure 9 shows such a typical waveform. The description for the typical
Early Myocardial Infarction Detection 22

The first deflection, termed the P-wave is due to the depolarization of the atria
(Jouck. P.P.H., 2004).
The large QRS-complex is due to the depolarization of the ventricles. This is the
complex with the highest amplitude (Jouck. P.P.H., 2004).
The last and most significant part for this report is the T-wave. It corresponds to
the ventricular repolarization of the heart (Jouck. P.P.H., 2004).
Figure 9: Typical ECG waveform [Source: Jouck. P.P.H. (2004)]

Early Myocardial Infarction Detection 23

VII. Wavelet Transforms
Signal transformation aides in converting signal from Time domain to Frequency domain.
It is of very importance to be able convert the signal from time domain to frequency domain to
get the complete information carried by the signal. There are many different mathematical
transformations available for converting time domain signal to frequency domain and vice a
versa. Typically physiological signals are present in time domain i.e. the signal has a time value
and the amplitude value. What is also hidden in this type of signal is its frequency value. When
the time domain signal is converted in frequency domain, the hidden frequency values of the
signal can be found out. It is important to know the frequency component of a signal to
completely define and/or analyze the signal. Hence, mathematical signal transformation plays a
crucial role in signal analysis and signal representation that are the key elements in determining
the ECG signal and hence important for this project.
There are several mathematical transformation tools available, hence choosing the
transformation tool that best suites the signal that is under measurement is of high importance.
Some of the mathematical signal transformation tools are listed below:
Fourier Transform
Short Time Fourier Transform
Wigner Distribution
Laplace Transform
Z-Transform
Wavelet Transform
Fast Fourier Transform
Hilbert Transform
Early Myocardial Infarction Detection 24

Radon Transform
Linear Canonical Transform
The list of transform above is no way a complete list; there are several other
mathematical transformations available. Choice of transform for a particular type of application
is critical. There are certain conditions based on which the choice of the transform to be used for
a particular application is based on. The conditions were crucial in deciding type of transform to
be used for ECG signal processing were as follows:
Type of application
Type of signal, stationary or non-stationary
The choice of transform made for this project was Biorthogonal Wavelet Transform. The
reason for choosing this type of mathematical signal transformation was done methodologically.
For most of the engineering applications, Fourier transform is popular (Polikar Robi, 2001).
Fourier transforms can provide signal representation either in time domain or the frequency
domain. The equation 1 for Fourier Transform is given as follows:
() = ] x(t) - e
-2at
dt

-
..(1)
What Fourier transforms fails to provide is the time instant at which the frequency value
is present and hence is not a transform of choice for non-stationary signal. Since ECG signal is
non-stationary signal Fourier transform was not a favored choice for doing ECG signal analysis
in this project.
The next suitable mathematical transformation is the Short Time Fourier Transformation.
As the name suggests, short time Fourier transform is similar to Fourier transform but there is a
Early Myocardial Infarction Detection 25

small difference between then which is In STFT, the signal is divided into small enough
segments, where these segments (portions) of the signal can be assumed to be stationary
(Polikar Robi, 2001). The equation 2 for Short Time Fourier Transform is given as follows:

X
(o)
(, ) = ]
|() -
-
( -

)] -
-]2n]t

t
-t
(2)
Short Time Fourier Transform does overcome the limitation of signal representation with
known time instant of frequency. But there is a limitation to using Short Time Fourier Transform
too, which is the segments of the signal called window have fixed width and it may not be useful
for a signal that has multiple frequencies varying rapidly throughout the signal. If the width of
the segment or the window is chosen such that it narrow, then the signal transformation obtained
has good time resolution but poor frequency resolution, on the other hand, if the width of the
window is chosen such that it is wide, then the signal transformation obtained has poor time
resolution but good frequency resolution. For getting both good time resolution as well as good
frequency resolution, the width of the window should be varied across the signal during the
signal transformation such that both time and frequency component of the signal does not get
compromised. Due to this limitation of Short Time Fourier Transform, Wavelet Transform was
originally developed. For this project, the signal under measurement ECG that is non-stationary
signal that has varying frequency levels throughout the signal, and with addition of noise, it
would be difficult to use short time Fourier transform for this project, hence Wavelet Transform
was chosen.
Like short time Fourier transform, wavelet transform are similar in the sense that the
signal is multiplied with a function, similar to the window function in the STFT, and the
transform is computed separately for different segments of the time-domain signal (Polikar
Early Myocardial Infarction Detection 26

Robi, 2001). There are differences in Short Time Fourier Transform and Wavelet Transform
though and they are as follows:
The Fourier transforms of the windowed signals are not taken, and therefore single peak
will be seen corresponding to a sinusoid, i.e., negative frequencies are not computed
(Polikar Robi, 2001).
The width of the window is changed as the transform is computed for every single
spectral component, which is probably the most significant characteristic of the wavelet
transform (Polikar Robi, 2001).
The continuous wavelet transform has a time scaling and a time shifting function (t)
called as the mother wavelet. The time scaling and the time shifting function given by equation 3
and the continuous wavelet transform are given by equation 4 and 5.

u,
(t) =
1
|u|

t-
u
(3)
Where o A e
] (t)

-
=

q
= ]
(|q(u|)
2
|u|

-
u <
The conditions above state that (t) is bandpass and sufficiently smooth. Assuming that
|| (t) || = 1, the definition above ensures that ||
u,1
(t)||=1 for all o and ( Schniter Phil,2005).

C
(, z) = ] x(t)q
,x
(t)

-
dt..(4)
x(t) =
1
C
q
] ]

C
(,z) q
,x
(t)

2
dzd

-
(5)
Early Myocardial Infarction Detection 27

Explaining the above equations in simple words mean that continuous wavelet transform
can decompose the signal into a collection of shifted and stretched versions different scales.
Wavelet transform is thus a time-scale analysis and scale is inverse of frequency.
There are different types of wavelets available and few of the wavelet transforms are listed
below:
Haar
Morlet
Mexican Hat
Meyer
Quadratic Spline
Dyadic Spline Wavelet
Debauchies
Biorthogonal
Gaussian
There are several other types of wavelets and each type of wavelet is different from one
to the other by properties such as symmetry, singularity etc. The selection of wavelets for ECG
signal processing is done based on the following parameters:
Orthogonal Vs. Non-Orthogonal: a non-orthogonal analysis involves high
redundancy at larger scales (Bhatia et al, 2006).
Complex or real valued wavelet function: a complex wavelet providing
information about both amplitude and phase is better suitable for oscillatory
signal behaviour whereas real valued wavelet function only returns a single signal
Early Myocardial Infarction Detection 28

modulus that can be used to isolate signal peaks and discontinuities (Bhatia et al,
2006).
Width of the wavelet function: this directly acts on the analysis resolution that is
for wavelet the result of balance between the length of analysis of samples
window in time frequency axes (Bhatia et al, 2006).
Shape of the mother wavelet: wavelet filtering can be viewed as an adapted filter
looking for the highest correlation between the ECG signal to analyze and the
considered wavelet (Bhatia et al, 2006).
For ECG parameter estimation, it is desirable that the basis function (wavelets) be
symmetric/antisymmetric (Sivannarayana et al. 1999). It is also desirable that the basis have a
minimum number of sign changes which will simplify the steps in the parameters estimation
algorithm (Sivannarayana et al. 1999). Out of the wavelets listed above Biorthogonal Wavelet
was the choice of wavelet for this project because it satisfies the properties that are required for
ECG signal analysis. To understand Biorthogonal Wavelets, it is important to understand the
concepts of dual basis. Consider a two-dimensional coordinate space. Any two vectors {e
1
, e
2
}
that are not parallel can form a basis for the space. If the angle between the two vectors happens
to be 90 degrees, we have an orthogonal basis (Wolfram Research, 2009).
Any vector
A
- in this space can be written uniquely as a superposition of the two basis
vectors:
A
- =
1

1
+
2

2
. If the basis is orthogonal,

]
= o
]
and the component

along

is
given by the inner product

A
- =
1

1
+
2

2
=

. However, if the basis is not


orthogonal,

is no longer given by the inner product of


A
-and

. In order to calculate the


component

, we introduce another set of basis vectors{


1

,
2

], called the dual of {e


1
, e
2
}. The
Early Myocardial Infarction Detection 29

dual basis satisfies

.
]
= o
]
and the space spanned by the dual basis is called the dual space
of the original space. In terms of the dual basis, the components of a vector along the basis {e
1
,
e
2
} can be calculated as

.
A
-= _
] ]

.
]
=

(Wolfram Research, 2009) . Similarly, for a


nonorthogonal basis {

()] of a function space, we can introduce dual basis {

()]
by(

,
]
) = ]
i

()

-

]
() = o
]
. A function f(t) can be decomposed as a superposition
of the nonorthogonal basis{

()] using a set of dual basis functions{

()]:
() = _

() = _ (

, )

()

. We will tacitly assume that the function space and its dual
are the same, a condition satisfied by L
2
. Therefore, the roles of dual basis and the original basis
can be interchanged and we obtain() = _ (

(). When {

()] is orthogonal, we have


the obvious relation

= (Wolfram Research, 2009).


The dilations and translations of the scaling function {
]
()] constitute a basis for V
j
and,
similarly, {
]
()] for W
j
. To define a dual multiresolution analysis with dual subspaces{
]

]
and {
]

] generated from a dual scaling function

and a dual mother wavelet

, respectively.
In terms of subspaces, the above biorthogonality conditions can be expressed as

]

,
]

on
]

or =

(Wolfram Research, 2009).


By definition, a scaling function and a mother wavelet satisfy the dilation equation and the
wavelet equation, respectively. So we have
q(t) = V2_ h

q(2t -)d (t) = V2_ g

(2t -)

(6)
and
Early Myocardial Infarction Detection 30

q

(t) = V2_ h

(2t -)d

(t) = V2_ g

(2t -)

..(7)
The roles of the two functions and

or and

can be interchanged. Or if we "take the


dual" of the above equations (define o
=
= o), we obtain the following relations,

k

= (
1,k
,

) = V] ( -)

() on
k

= (
1,k
,

) = V ] ( -

() (Wolfram Research, 2009).


In frequency space, the above dilation and wavelet equations 6 and 7 assume the form
q

(m) =
m
2
q

m
2
d

(m) =
m
2
q

m
2
.(8)
and
q

(m) =
m
2
q

m
2
d

(m) =
m
2
q

m
2
..(9)
As before,E() is defined by E() = _
k

-koV2
k
, and G(), E

(), and

() are
defined analogously (Wolfram Research, 2009).
The biorthogonality conditions can be translated into conditions on the filter coefficients using
the dilation and wavelet equations. These conditions are
E

()E()

+E

( +n)E( +n)

= on

()()

( +n)( +n)

()E()

( +n)E( +n)

= on E

()()

+E

( +n)( +n)

=
Using
]
-, () = _
I I
-() and
]
-, () = _
I I
-(), the relations for
wavelet decomposition becomes (Wolfram Research, 2009):

-1
= _ h

-2

d d

-1
= _ g

-2

.(10)
Early Myocardial Infarction Detection 31

Figure 11 below shows the typical shapes of biorthogonal and reverse biorthogonal wavelets
available in the Matlab 7.1 Release 14 Wavelet Toolbox 3.0 Biorthogonal Wavelets 2.4 were
chosen because of the near shape of the ECG signal and that of the 2.4 biorthogonal wavelet.
This can be seen in the figure 10.






Figure 10: 2.4 Biorthogonal Wavelet and ECG Signal
Early Myocardial Infarction Detection 32























Figure 11: Types of Biorthogonal Wavelets available in Wavelet Toolbox 3.0 of Matlab 7.1
R 14[Source: Matlab7.1R14 Help]

Early Myocardial Infarction Detection 33

VIII. Introduction to Early Myocardial Infarction Detection System
After having acquired the background for understanding how myocardial infarction
occurs and what the ways and means to diagnose it are, we move on to discuss about the
specifics that are crucial to understand the algorithm for early myocardial infarction detection.
The subsequent section will discuss the specifications that were considered, the features of the
algorithm, the detailed functions, and the steps to get to early myocardial infarction detection.
During the last few years telemetry monitoring has become the most widely used for of
monitoring system and telemetry monitoring of cardiovascular diseases is gaining popularity.
Hence, it is important to have a telemetry device monitoring the condition of heart to warn onset
of myocardial infarction. The method presented in the project is to detect ST-changes in the ECG
of the patient based on wavelet signal processing technique to warn onset of myocardial
infarction. The testing for the method is done using the following databases from Physiobank
organization:
MIT-BIH ST change Database
Long-term ST Change Database
European ST-T Database
MIT-BIH Normal Sinus Rhythm Database
MIT-BIH Noise Stress Test Database
a. Background
The typical frequency range for ECG signal is between 0.5 to 100Hz. Table 2 below
gives the typical wave durations and amplitudes that are present in ECG signal which is the
physiological signal under measurement for this project. Figure 12 shows the normal ECG
Early Myocardial Infarction Detection 34

waveform on a strip chart paper. It shows how to interpret data from a strip chart into the actual
amplitude and time values that are of interest. Changes in the ST-segment of the ECG may
indicate that there is a deficiency in the blood supply to the heart muscle (Tompkins Willis,
2000).





Figure 12: Normal ECG waveform on Strip Chart [Source: Barron Jon, 2007]
The detection of the ECG waveform is based on the on the duration and amplitude
measurements given in the table 2 and figure 10. Matlab 7.1 was used for the programming of
the code for ST-elevation detection. The signal processing for the ECG waveform was done by
using Biorthogonal Wavelets. For using Wavelets Wavelet Toolbox3.0 from the Matlab software
was used. The use of Biorthogonal Wavelet was based on the symmetry, and the fact that the
shape of the biorthogonal wavelets is closest to that of the ECG Waveform, giving precision
accuracy to the time-scale conversion. By using Biorthogonal wavelets it is possible to get
complete reconstruction of the signal.
The ST-segment represents the period of the ECG just after depolarization, the QRS
complex, and just before the repolarization, the T- wave(Tompkins, Willis, 2000). The ST-
Early Myocardial Infarction Detection 35

segment is isoelectric in normal ECG and hence the elevation of ST-segment is tested for by
comparison between isoelectric line and the ST-segment. The next section describes the features
and functions of early myocardial infarction detection.
Table 2: Typical Amplitudes and Durations for ECG signal [Source: Saritha. et.al. (2008)]
Amplitude
P-Wave 0.25 mV
R-Wave 1.60 mV
Q-Wave 25% of R-Wave
T-Wave 0.1 to 0.5 mV
Duration
P-R Interval 0.12 to 0.20 s
Q-T Interval 0.35 to 044 s
S-T Interval 0.05 to 0.15 s
P-Wave Interval 0.11 s
QRS Interval 0.09 s

The most important function of early myocardial infarction detection is that it warns the
patient of the imminent attack as early as 20 minutes before the actual attack. In typical cases, a
patient would only go to the emergency room when the heart attack has already happened. This
reduces the time for the doctors to treat it. If the patient and the doctor are warned early of the
imminent attack, the doctor gets the much needed time to curb the intensity of the attack by
providing medication faster. By having the ST-elevation detection program installed on a
Early Myocardial Infarction Detection 36

portable ECG machine having wireless transmission capability will make the best standalone
telemetry device available for treating myocardial infarction related conditions.
b. Materials and Method
i. Database Description
As described above there were five databases that were used for testing the method
proposed for detecting onset myocardial infarction. The databases are developed and managed
by Physiobank organization. Physiobank is a database of well-characterized digital recordings
of physiologic signals and related data for use by the biomedical research community
(Goldberger et al. 2000).
MIT-BIH ST change database has ECG recordings from long exercise stress tests and
exhibit transient ST depression (Albrecht P., 1983). There are some recordings in this database
that consists of ST-elevation too.
Long-term ECG database consists of ECG recordings from 80 subjects chosen to exhibit
a variety of events of ST segment changes, including ischemic ST episodes, axis-related non-
ischemic ST episodes, episodes of slow ST level drift, and episodes containing mixtures of these
phenomena (Franc Jager. et al, 2003).
European ST-T database consist of ambulatory ECG recordings from 79 subjects
(Taddei, A.et al. 1992).
MIT-BIH Normal Sinus Rhythm database consists of recordings from 18 subjects. The
database comes from the Arrhythmia Laboratory at the Bostons Beth Israel Deaconess Medical
Center (Goldberger et al. 2000).
Early Myocardial Infarction Detection 37

The fifth and the last database that was tested for the method described in this report for
ST-segment changes was that of MIT-BIH Noise Stress Test Database. This database consists of
ambulatory ECG recordings. The noise recordings were made using physically active
volunteers and standard ECG recorders, leads, and electrodes; the electrodes were placed on the
limbs in positions in which the subjects' ECGs were not visible (Moody GB, 1984).
Out of the available ECG recordings from the databases described above, 17 recordings
were tested from MIT-BIH ST Change Database, 5 from MIT-BIH Noise Stress Test Database, 6
from the Long-Term ST Database, 13 from the MIT-BIH Normal Sinus Rhythm Database and
14 recording were randomly selected and tested for ST-segment change using the method
described in the next section.
ii. Method for ST-elevation detection
The warning of the imminent myocardial infarction is done through the use of different
filtering techniques, followed by the signal processing to ensure accurate ECG signal extraction
and estimation. Electromagnetic Interference (EMI), muscle activity (EMG), bowel movements,
and electric line interference are often always embedded in ECG signal and constitute noise in
the ECG signal. It is important to be able to remove this noise in order to have a good ECG
parameter estimation. The presence of this noise also changes the baseline for the ECG signal, it
is also important for ECG parameter extraction and estimation to be able to remove the baseline
wander before the actual ECG signal parameters are extracted. This is done by having a baseline
wander cancellation along with efficient signal filtering to remove electric line, EMI, EMG and
other types of noise from the ECG signal. After eliminating the baseline wander the ECG signal
was converted into time-scale domain for further analysis. Converting the ECG signal into time-
scale domain was done because Wavelet Transformation (WT) has shown to be substantially
Early Myocardial Infarction Detection 38

noise proof in ECG segmentation and thus appropriate for ST-T segment extraction
(Milosavljevi Neboja, et al.2006). The signal was decomposed into 4 scales ranging from 2
1
to
2
4
. Figure 13 shows sample decomposed scales using Dyadic Wavelets for ECG signal.
Figure 13: Dyadic Wavelet Transform of ECG signal [Source: Jouck. P.P.H. (2004)]

It can be interpreted from Figure 13 that wavelet transform at small scales reflects the
high frequency components of the signal and, at large scales, the low frequency components. The
energy contained at certain scales depends on the center frequency of the used wavelet (Jouck.
P.P.H., 2004).
Early Myocardial Infarction Detection 39

2
4
scale was used to detect the R-peak because most energies of a typical QRS- complex are at
scales 2
3
and 2
4
. QRS complex with high frequency components, the energy at scale 2
2
is
larger than that at 2
3
(Jouck. P.P.H., 2004). According to Wenli Chen et al. 2007, the high
frequency noises like the electric line interference, muscle activity, bowel movement activity,
electromagnetic interference is concentrated in the lower scales of 2
1
and 2
2
, while the levels 2
3
and 2
4
constitute for less noise compared to the lower scales. This can also be seen in figure 14.
Wenli Chen et al. 2007 summarize that the frequency of the QRS complex is mainly present in
the 2
3
and 2
4
scales. Since the scale 2
4
shows less noise compared to 2
3
, in this project we chose
scale 2
4
for R-peak detection.
Figure 14: Biorthogonal Wavelet Transform of ECG Signal from 2
1
to2
4
level
The R-peak detection was followed by detecting point S and Q. (Pam, Tompkins, 1985)
method was utilized for detection of the R-peaks. After finding R-peaks (Tompkins, 2000)
method was used for detecting points S, Q, T-peak, T-point, J-point as seen in figure 15.
Early Myocardial Infarction Detection 40



Figure 15: Method for ECG Parameters Detection [Source: Tompkins, 2000]
The first inflection point before Q point was chosen as point K and P point was found, the
distance between point P and point K is the isoelectric line. The isoelectric line was then
compared to the ST-segment for checking the elevation or depression of the ST-segment in all
the ECG waveforms. The algorithm for the ST-change detection program is divided in several
subsections and is as follows:
1. Signal Filtering and Baseline Wander Correction
After getting the ECG dataset, the first step was to remove the inherent noise from the
ECG signal. The typical noises that affect the ECG signal are electric or power line interference
of 60Hz, EMG or the muscle activity that gets captured along with the ECG measuring
electrodes, bowel movements also called EGG movement; EEG sometimes may interfere with
ECG signal and constitute noise. Electromagnetic interference is also seen in the ECG signal. It
thus becomes important to remove the noise from the signal for accurate and precise ECG
Early Myocardial Infarction Detection 41

parameter detection and extraction. The filtering technique applied in this project is a simple FIR
filter.

Figure 16: Filter expressed in Direct Form II transposed structure [Source: Matlab7.1R14 Help]
Figure 16 can also be expressed as:
y(n)=(1)*x(n)+b(2)*x(n-1)++b(nb+1)*x(n-nb)-a(2)*y(n-1)--a(na+1)*y(n-na).(11)
After filtering the signal using the FIR filter, the filtered signal was passed through
median filters to correct for the baseline wander correction. The process followed included
passing the filtered signal through a 200ms median filter that eliminates the QRS complex from
the signal. This median filtered signal was again passed through a 600ms median filter to
eliminate the T-wave from the signal. This final filtered signal is the signal that consists of the
noise that changes the baseline through the signal. The difference between the FIR filtered signal
and the final median filtered signal thus gives the baseline wander eliminated signal. The
baseline wander elimination process in shown in figure 17, where the first plot if of the FIR
filtered signal, the second plot is of the first median filtered signal, while the third plot is of the
second median filtered signal, the final plot shows the baseline wander eliminated signal.
Early Myocardial Infarction Detection 42

Figure 17: Baseline Wander elimination
2. R-Peak Detection
The R-peak detection was carried out by using the Pan, Tompkins 1985 method of R-
peak detection. The method uses the threshold level to calculate the maximum amplitude in the
ECG waveform. The threshold level set for the R-peak detection in the ST-change program is
approximately 0.6. The R-peak detection was done in the time-scale domain at level 2
4
. Same
level was utilized to estimate the other key points in the ECG waveform. Figure 18 shows the
final ECG waveform with all the detected points along with its legend.
3. Heart Rate Measurement
It is essential to calculate the heart rate of the patient in order to determine accurate
measurement and approximation of the PQSTJK points on the ECG waveform; hence heart rate
was calculated from the datasets after for every minute of data scanned. The heart is calculated
by taking the difference in time between consecutive R-peaks.
Early Myocardial Infarction Detection 43


Figure 18: R-peak Detection and PQSTJK extraction of ECG wave at level 2
4

4. Detection of S, Q, T, T-peak, J, K, P point
Tompkins method for ST-segment analyzer was followed to compute J, T-peak, and T-
point (Tompkins, 2000). The algorithm for estimating the Q and S point was derived from
Tompkins method of ST-segment analyzer. After detecting R-peak, knowing the QRS complex
duration to be 60ms, points Q and S were estimated as the first inflection points to the left and
the right of R-peak respectively. After estimating the S-point, J-point was estimated to be first
inflection point after S-point to the right of R-peak. T-peak was estimated to between R-peak+
400ms to J-point+80ms. T-point was later on estimated from T-peak to T-point duration of 35ms
to the R-peak side. Similarly K-point was estimated to be the first inflection point after Q on the
left side of the R-peak, and P-point was estimated to be the first inflection point after K-point on
the P-peak side. The detection of point is depicted in figure 18 above.

Early Myocardial Infarction Detection 44

5. Isoelectric line and ST-segment Computation
After the estimation of all the relevant points in the ECG waveform, the isoelectric line
and the ST-segment were computed. For the isoelectric line the mean value for point P and point
K was computed and for ST-segment the mean value for point J and point T was computed.
Single ST-deviation as an absolute amplitude change between ST point and PR point values
greater than 0.1mV (Milosavljevi Neboja, et al.2006). The computed values for both
isoelectric and the ST segment were then compared within a range of 0.1mV range.
The complete code for the ST-segment change program is available in Appendix A section of
this report. The generalized flow chart for the above described algorithm is given figure 21. The
next section describes the testing and verification done using the datasets and the results obtained
are also presented.
6. Graphical User Interface (GUI)
A graphical user interface was created using Matlabs GUIDE to create an intuitive
interface to check for any abnormalities in an ECG data that is being tested. The ECG dataset
name was given as the File name. After typing the File name, the start button activates the GUI
program. The GUI consists of three axes figures. The first one from the top is original, unfiltered
noisy signal that is being fed to the program. The second is the filetered and base line wander
corrected signal. The third shows how the detection and estimation of parameters is being done
in the program. The figures are refreshed after the every minute of procesing of the data. The
GUI processes 5 minutes of the ECG dataset that is being fed to it. An ECG data that passes the
test will show a No ST Detected message (figure 19) and an ECG data that has an ST-segment
changes predicting abnormality, will show a Warning message (figure 20).



Figure 19: Shows an intuitive GUI result for an ECG data with no MI detected
Figure 20: Shows an intuitive GUI result for an ECG data with an MI detected.

Early Myocardial Infarction Detection
Shows an intuitive GUI result for an ECG data with no MI detected
Shows an intuitive GUI result for an ECG data with an MI detected.
Early Myocardial Infarction Detection 45

Shows an intuitive GUI result for an ECG data with no MI detected

Shows an intuitive GUI result for an ECG data with an MI detected.
Early Myocardial Infarction Detection 46
























Figure 21: Flowchart for ST-elevation detection
Load the.mat Data set File and the
Header File
Read the Header File and get required
variables (Gain, Frequency)
Filter the Data set and correct the
baseline wanders
Is
ST>ISO
Detect PQRST Wave
Compute Isoelectric line (ISO)
and ST segment
Check the ECG Signal
for 1minute
Show MI Warning
End
Start
NO
YES
Go to the next minutes signal
Early Myocardial Infarction Detection 47

IX. Testing and Verification
Extensive testing of the ST-change detection program was done to ensure the code
estimates the ST-segment changes effectively. Receiver Operating Characteristic curve better
known as ROC curve are useful for organizing classifiers and visualizing their performance
(Fawcett Tom, 2006). ROC graphs are used for showing the tradeoff between the true positive
rate and false positive rate. The next section discusses the results that were obtained during the
testing.
The total processing time for a minute of dataset was found to be ranging between 4
seconds to 10 seconds depending on the sampling frequency of the datasets. Calculation of Heart
Rate every minute of data processing was done to account for the change in the heart rate. The
testing and verification results are provided in the next section.
a. Results
A total of 54 datasets were tested. Random datasets from the five described databases
were selected for the testing. The datasets were tested with the ST-change program and cross
checked visually. The time interval for every dataset evaluated was one minute with a total of 5
minutes for each dataset. Out of every database close to 10 samples were analyzed. Out of the
54, 41 were True Positive whereas 13 were False Positive. 15 datasets from databases that have
ST-change gave 100% accuracy and 11 datasets from normal sinus rhythm and noise stress
showed no change in ST-segment i.e. again gave 100% accuracy rate. Other 15 datasets
comprising of both the ST-change and the normal ECG database were accurate for 80%, 70%,
50% and 40% respectively. The other two accuracy levels 50% and 40% were chosen only for
doing the ROC analysis. The overall accuracy of the algorithm was found to be approximately
Early Myocardial Infarction Detection 48

73% from the ROC analysis. Table 3 shows the details for the testing of databases. The detailed
testing results are in Appendix B of this report.
Table 3: Testing Results for ST-change detection program
Observed Frequencies Cumulative Rates
Diagnostic
Levels
False
Postive
True
Positive
False
Positive
True
Positive
90% 4 26 0.3077 0.6341
80% 1 4 0.3846 0.7317
70% 2 4 0.5385 0.8293
50% 1 4 0.6154 0.9248
40% 5 3 1 1
Total 13 41

A more detailed version of the database testing is available in Appendix C part of this report. The
cumulative rates were calculated using the mathematical formulae developed by Lowry, Richard
2008. Table 4 shows the plotted point for ROC curve followed by the ROC curve in Figure 22.
b. Discussion
Based on the results it can be said with confidence that the ST- change detection program
produces overall better results that many available method for ST measurement. Unlike many
other ST detection algorithms, this ST-change detection program also takes into consideration
the change in the Heart Rate, which if ignored might not give precise ECG parameters estimation
and result wrong ST-change predictions. Using Biorthogonal wavelets gives precise
transformation points due to the similarity of shape between the ECG signal and that of the
biorthogonal wavelets.



Table
False Positive Rate
(1-Specificity)
Figure 22:
Early Myocardial Infarction Detection
Table 4: Data Points for ROC Curve
False Positive Rate
Specificity)
True Positive Rates
(Sensitivity)
0.05 0.1612
0.1 0.3553
0.15 0.4688
0.2 0.5494
0.25 0.6118
0.3 0.6629
0.35 0.706
0.4 0.7434
0.45 0.7764
0.5 0.8059
0.55 0.8326
0.6 0.857
0.65 0.8794
0.7 0.9001
0.75 0.9194
0.8 0.9375
0.85 0.9545
0.9 0.9705
0.95 0.9856
: Receiver Operating Characteristic Curve
Early Myocardial Infarction Detection 49

Early Myocardial Infarction Detection 50

Use of Wavelet transforms speeds the signal processing of the ECG, which decreases the
overall processing time for ST-segment estimation. Use of single level ECG parameter
estimation reduces the time required for reconstruction of the signal. Also, faster dataset
processing gives faster ECG parameter estimation, which gives faster response on the change in
ST-segment, since the processing time for the ST-change detection program was found to be
approximately 8 seconds. This shows that the fast algorithm of the ST-change detection program
in real time ECG signal analysis will provide real time response, which is crucial in the case of
myocardial infarction detection.
X. Economic Justification
a. Executive Summary
SMART Medical Devices Company is an established medical device company that
design and sells medical diagnostic devices. It currently does not have a portable ECG device in
the market. SMART Medical Device Company wants to develop a portable ECG device that can
analyze physiological signals to detect the onset of myocardial infarction.
Myocardial infarction is defined by the American Heart Association as the damaging or
death of the heart muscles due to the blockage of blood supply. Diagnosing patients and
detecting the symptoms, before the onset of myocardial infarction, is important to increase the
mortality rate of patients. There are several ways to diagnose myocardial infarction and one of
which is by using electrocardiogram (ECG) devices. Most of the ECG devices in the market are
bulky and are not suitable for everyday use. In addition, most ECG devices are installed in
hospitals where doctors or nurse can readily give diagnosis to patients. But, time is of the
essence for doctors and nurses and they cannot be with the patients all the time. Furthermore,
Early Myocardial Infarction Detection 51

hospitals are loaded with patients that only need short-term care. In 2008 alone, there were more
than 33 million short-term, acute patients that stayed in non-federal hospitals. (American
Hospital Directory, 2008)
One of the ways to reduce the numbers of short-term, acute patients staying in hospitals is
by using a portable diagnostic device such as a small ECG device. It can be worn 24/7 with ease
and comfort to patients. Healthcare providers can prescribe this device and unload hospitals with
extra cost related to myocardial infarction disease. But to be useful, the portable ECG device
must be smart and be able to process input data from the patients without the aid of a physician.
The smart analytical tool that SMART Medical Devices develops complements the portable
ECG device of the company since it can detect myocardial infarction without the aide of a
doctor.
Portable ECG devices are already in the market. Some are manufactured and marketed
by big company competitors such as Philips Healthcare, Welch Allyn, and GE Medical. They
gather ECG data from the patients and collect them to be sent by the patient to the doctor for
further analysis. Some of them also have simple analytical tool to diagnose the patient. On the
other hand, SMART Medical Devices ECG device has an algorithm that uses wavelet transform
methodology as a smart analytical tool to analyze the ECG data coming form the patient. It can
perform real-time analysis of the ECG data and can instantly notify the patient if there is an onset
of myocardial infarction. Then a doctor can confirm the diagnosis remotely or as soon as the
patient arrives in the hospital.
In 2009, myocardial infarction had a prevalence of 8 million Americans and an estimated
incidence of 900,000. Furthermore, coronary heart disease (CHD), which includes myocardial
Early Myocardial Infarction Detection 52

infarction, has a death rate of 144.4 in the United States. (American Heart Association, 2009) A
smart portable ECG device with smart analytical tool can greatly reduce that numbers.
For this project, a funding of $ 1.5 million is needed to start for the coding of the smart
analytical software. The funding will be needed to acquire computer hardware and software
licenses. Majority of the funds will go to the salary of the team, which composes of five
software engineers, with different levels of expertise. It is estimated that the breakeven point
will be reached on the third quarter of the product release, assuming the company will sell 500
units in the first year and with a price point of $2,000.
b. Problem Statement
The ability to detect the symptoms of myocardial infarction before the disease becomes
severe is important to save the life of a patient. The best way to diagnose and identify the
symptoms of myocardial infarction is ECG. Current ECG diagnostic devices do not have a smart
analytical function to analyze ECG data. Theres a need to analyze ECG data from patients
prone to myocardial infarction without the immediate aid of doctors or nurses. This can greatly
increase the mortality rate of a patient and reduce the burden caused by myocardial infarction to
hospitals.
c. Solution and Value Proposition
This projects main focus is to develop an analytical tool that can analyze the ECG data
of patients. The software can be installed in a portable ECG device developed by SMART
Medical Devices. This project can greatly leverage the company to be the best in the industry.
A well-made, and cost efficient portable ECG device that can accurately and efficiently diagnose
patients can facilitate the realization of this mission.


d. Market Size
Theres a huge market for portable medical devices that diagnose heart diseas
disease is the number one cause of death in the United States. Every year, the American Heart
Association estimates the prevalence of myocardial infarction. From 2003 to 2009, there was an
estimated increase of 3.95% in the prevalence of myoc
in figure 23).
Figure 23: An estimate of myocardial infarction prevalence in the United States
and Stroke Statistics - 2003 Update, Heart Disease and Stroke Statistics
Disease and Stroke Statistics - 2005 Update, Heart Disease and Stroke Statistics
Heart Disease and Stroke Statistics
Update, Heart Disease and Stroke Statistics
And from the same period, there was an increase of 8.09% of new and recurrent attacks
of myocardial infarction in the United St
The 2009 estimated direct and indirect cost of myocardial infarction was estimated to be $165
billion compared to $133 billion in 2004, a 24% increase
Early Myocardial Infarction Detection
Theres a huge market for portable medical devices that diagnose heart diseas
disease is the number one cause of death in the United States. Every year, the American Heart
Association estimates the prevalence of myocardial infarction. From 2003 to 2009, there was an
estimated increase of 3.95% in the prevalence of myocardial infarction in the United States (
An estimate of myocardial infarction prevalence in the United States
2003 Update, Heart Disease and Stroke Statistics - 204 Update, Heart
2005 Update, Heart Disease and Stroke Statistics
Heart Disease and Stroke Statistics - 2007 Update, Heart Disease and Stroke Statistics
Update, Heart Disease and Stroke Statistics - 2009 Update)
And from the same period, there was an increase of 8.09% of new and recurrent attacks
of myocardial infarction in the United States (Seen in figure 24).
The 2009 estimated direct and indirect cost of myocardial infarction was estimated to be $165
billion compared to $133 billion in 2004, a 24% increase (Seen in figure 25).
Early Myocardial Infarction Detection 53
Theres a huge market for portable medical devices that diagnose heart diseases. Heart
disease is the number one cause of death in the United States. Every year, the American Heart
Association estimates the prevalence of myocardial infarction. From 2003 to 2009, there was an
United States (Seen

An estimate of myocardial infarction prevalence in the United States (Heart Disease
204 Update, Heart
2005 Update, Heart Disease and Stroke Statistics - 2006 Update,
2007 Update, Heart Disease and Stroke Statistics - 2008
And from the same period, there was an increase of 8.09% of new and recurrent attacks
The 2009 estimated direct and indirect cost of myocardial infarction was estimated to be $165


Figure 24: An estimate of new and recurrent incidence of
States(Heart Disease and Stroke Statistics
2005 Update, Heart Disease and Stroke Statistics
Statistics - 2007 Update, Heart Disease and Stroke Statistics
Stroke Statistics

Figure 25: The direct and indirect cost of myocardial infarction per year
Stroke Statistics - 2004 Update, Heart
Disease and Stroke Statistics - 2006 Update, Heart Disease and Stroke Statistics
Heart Disease and Stroke Statistics
Early Myocardial Infarction Detection
An estimate of new and recurrent incidence of myocardial infarction in the United
Heart Disease and Stroke Statistics - 204 Update, Heart Disease and Stroke Statistics
2005 Update, Heart Disease and Stroke Statistics - 2006 Update, Heart Disease and Stroke
Disease and Stroke Statistics - 2008 Update, Heart Disease and
Stroke Statistics - 2009 Update)
The direct and indirect cost of myocardial infarction per year (Heart Disease and
4 Update, Heart Disease and Stroke Statistics - 2005 Update, Heart
2006 Update, Heart Disease and Stroke Statistics
Heart Disease and Stroke Statistics - 2008 Update, Heart Disease and Stroke Statistics
Update)
Early Myocardial Infarction Detection 54

myocardial infarction in the United
204 Update, Heart Disease and Stroke Statistics -
2006 Update, Heart Disease and Stroke
2008 Update, Heart Disease and

Heart Disease and
2005 Update, Heart
2006 Update, Heart Disease and Stroke Statistics - 2007 Update,
2008 Update, Heart Disease and Stroke Statistics - 2009
Early Myocardial Infarction Detection 55

In 2009, there are a total of 7.9 million cases of myocardial infarction in the United
States. Every 34 seconds, an American will suffer a heart attack, and from that, 25% men and
38% women will die within the first year after suffering a heart attack. In 2005, the recorded
number of deaths due to myocardial infarction was more 150,000 Americans (American Heart
Association, 2009).
Giving patients, who are prone to heart attacks or who had suffered an initial heart attack,
an access to a portable ECG device can greatly decrease their mortality rate.
The US market for home monitoring is expected to increase over 5% annually to $1.8
Billion in 2012 (Demand for Home Medical, n.d.). SMART Medical Devices will market the MI
Detector, a portable ECG device with the smart algorithm, in the United States.
e. Competitors
Heart monitoring device is a big market, considering that these devices diagnose the
number one cause of death in the United States. With such, there are many competitors in this
industry. Philips Healthcare, a part of Koninklijke Philips Electronics N.V. (Royal Philips
Electronics), developed an ECG Holter device, DigiTrak XT. It can monitor and record the
patients ECG data for up to 7 days. The recorded data are then transferred to personal computer
using Philips Healthcares software and analyzed before sending the data securely sent to a data
center. The Philips Healthcare DigiTrak XT Holter device can cost almost $9,000.
Welch Allyn, another company that develops ECG Holter devices, has HR 100 and HR
300 ECG Holter devices that record, and store patients data. The recorded data are also
downloaded to a personal computer and analyzed using proprietary algorithm to detect any
abnormalities in the patients recorded ECG data. It is sold online and cost approximately
$3,000.
Early Myocardial Infarction Detection 56

GE Healthcare, a part of General Electric Company, developed SEER Light compact
digital recorder, a compact ECG Holter device that can record ECG data for up to 48 hours. It is
a part of GE Healthcares ambulatory system to analyze the patients ECG data for any
anomalies. After monitoring the patient, the data is downloaded and analyzed using an advance
algorithm and can be stored to a central database, which is run by proprietary software. The
device can be purchased for almost $9,000.
Omron Healthcare has a portable ECG Monitor, HCG-801, which can be used by patients
whenever symptoms of heart disease occur. It has a large screen that can display the ECG data
from the patient, but the data also needs to be downloaded to a computer for analysis. The
device is cheap and is found online for almost $500.
All of the devices mentioned are ECG Holter devices that can monitor the patients heart
activity for 24 hours or more. They are portable and can be worn for a long period of time
without impeding day-to-day activities of patients. The portable and easy to use MI Detector
device by SMART Medical Devices will be a Holter device, which can provide constant and real
time analysis of ECG devices. The advantage of the MI Detector over the competitors is that it
can monitor the patient and process the data recorded in the portable ECG device without
downloading the data to a personal computer.
f. Customers
The target markets for SMART Medical Devices MI Detector are physicians that will
prescribe the ECG monitoring device to patients. This ECG device is considered a
prescription device since it monitors physiological functions of the patient. Special training
needs to be administered to the patient before a patient can bring the device home. The device
will be particularly marketed to doctors specializing in heart conditions. And since this device
Early Myocardial Infarction Detection 57

will be regulated under the Food and Drug Administration (FDA) law, this device will be
marketed initially in the United States.
The device can be purchased by individual patients in pharmacies or through online
channel, granted they have a prescription from their physician. The MI Detector device can be
covered by Medicare or Health Insurance or can be purchased, out-of-pocket, at a manufacturer
suggested retail price (MSRP).
g. Cost
There are several factors that influence the cost of MI Detector. The MI Detector device
is composed of a hardware and software components. The hardware component is outsourced to
an Original Equipment Manufacturer (OEM), which has a proven record for manufacturing
quality-made medical devices.
The software component is developed in-house and is designed by SMART Medical
Devices software department.
The total cost in designing, developing, marketing, delivering and servicing the MI
detector is estimated from different cost drivers.
i. Fixed costs
Fixed costs are expenses that do not change and are not based on the activity to develop
and market the device. Majority of the fixed cost associated with the MI Detector consists of
salary of software engineers. The software development team is composed of two level 1 or 2
software engineers, three level 4 to 5 software engineers, and a department manager. Other costs
associated with the fixed costs of MI Detector device are: the purchase of software licenses and
hardware components as well as other development cost for improving the algorithm of the MI
Detector. The fixed cost of MI Detector is listed in table 5.
Early Myocardial Infarction Detection 58

ii. Variable Costs
Variable costs are cost drivers that are associated with the activity from developing to
servicing the MI Detector device. It varies from time to time due to the number of volume of
producing and selling the device. Since an OEM vendor manufactures the MI Detector device,
there is no associated cost with manufacturing. Logistics and manufacturing contracts are major
cost drivers for this device, which consists of contracting the manufacturing to an OEM
manufacturer, receiving and delivery of the device from the OEM manufacturer to the sales
channel, and keeping the inventory in order. Other cost drivers are sales and marketing, the
support staff and the initial regulatory and legal requirements to manufacture and sell the device.
Table 6 illustrates the variable costs of MI Detector device.
Table 5: Fixed cost of MI Detector device
Fixed Cost 2009 2010 2011 2012 2013

Hardware and License $6,000.00 $1,000.00 $1,000.00 $1,000.00 $1,000.00
Software Engineer
Salary
Level 1/2 Engineers (2) $100,000.00 $105,000.00 $110,250.00 $115,762.50 $121,550.63
Level 4/5 Engineers (3) $300,000.00 $315,000.00 $330,750.00 $347,287.50 $364,651.88
Department Manager $120,000.00 $126,000.00 $132,300.00 $138,915.00 $145,860.75
Total S. Engr Salary $520,000.00 $546,000.00 $573,300.00 $601,965.00 $632,063.26
Development Cost $50,000.00 $0.00 $0.00 $0.00 $0.00
Business Expense $100,000.00 $100,000.00 $100,000.00 $100,000.00 $100,000.00
Total Fixed Cost $676,000.00 $647,000.00 $674,300.00 $702,965.00 $733,063.26
Early Myocardial Infarction Detection 59

h. Price Point
The price of the MI Detector device will be below the competitors prices. The MI Device will
be sold with an MSRP of $2,000, which is well below the competitors. The device, when purchased
initially, is a complete device since all the analytical processing is done in the device. Occasional
accessory replacement is necessary after every use to ensure accurate ECG data recording and analysis.
Table 6: Variable cost of MI detector device
Variable Cost 2009 2010 2011 2012 2013

Marketing Salary $150,000.00 $157,500.00 $165,375.00 $173,643.75 $182,325.94
Support Staff $150,000.00 $157,500.00 $165,375.00 $173,643.75 $182,325.94
Logistics and
Contracts $500,000.00 $500,000.00 $500,000.00 $500,000.00 $500,000.00
Regulatory and Legal $50,000.00 $5,000.00 $5,000.00 $5,000.00 $5,000.00
Total Variable Cost $850,000.00 $820,000.00 $835,750.00 $852,287.50 $869,651.88

i. SWOT Assessment
The device itself has much strength and some weaknesses. The SWOT assessment of the
MI Detector device is shown in table 7.






Early Myocardial Infarction Detection 60

Table 7: SWOT assessment of MI Detector medical device
Strengths Weaknesses
Provides real-time and accurate
analysis of ECG data
Data does not need to be
downloaded for processing
Portable and easy to use
Can be worn several hours per
day
Since the device is a product in the
company portfolio, patients may
be hesitant to try and use the
product
Opportunities Threats
There are currently no other
major medical device company
that offers the same product that
we offer
Other medical device companies
might develop similar products
with similar price point
j. Investment Capital Requirement
The MI Detector device is composed of two components: Hardware and Software. Since
the MI Detector devices major component is the smart software installed to diagnose
myocardial infarction, majority of the funding will be focused on the software development
team. In addition, SMART Medical Devices will outsource the manufacturing of the portable
ECG device to an OEM company. Thus, the capital required to fund the project will primarily
be divided down for software engineers salaries, and the logistics of the portable device. The
initial year will require a budget of $1.5 million to fund the initial development of the product.
The company is expected to become profitable with this device on the second year of
developing and selling the device, as shown in figure 26. The company is expected to become
profitable with this device on the second year of developing and selling the device, as shown in
figure 27.


Figure 26: Initial Investment Requirement of MI Detector device
Figure 27
Having a price point of $2,000 and an estimate of 500 units sold on the first year, the
company will have a loss of $500,000 on the first year. With an estimated sales increase of 20%
every year or 5% every quarter, the company is estimated to gain profit
the fifth year. (Shown in table 8)

$0
$200,000
$400,000
$600,000
$800,000
$1,000,000
$1,200,000
$1,400,000
$1,600,000
$1,800,000
C
o
s
t
s
-$1,000,000
$0
$1,000,000
$2,000,000
$3,000,000
$4,000,000
$5,000,000
1
S
a
l
e
s
Revenue
Early Myocardial Infarction Detection
Initial Investment Requirement of MI Detector device
27: Yearly Model of MI Detector device
Having a price point of $2,000 and an estimate of 500 units sold on the first year, the
company will have a loss of $500,000 on the first year. With an estimated sales increase of 20%
every year or 5% every quarter, the company is estimated to gain profit of almost $2.5 million on


Fixed Cost Variable Cost Investment
Initial Investment
2 3 4
Year
Yearly Model
Revenue Total Cost Profit and Loss
Early Myocardial Infarction Detection 61

Initial Investment Requirement of MI Detector device

Having a price point of $2,000 and an estimate of 500 units sold on the first year, the
company will have a loss of $500,000 on the first year. With an estimated sales increase of 20%
of almost $2.5 million on
5
Early Myocardial Infarction Detection 62

Table 8: The break-even table of MI Detector device

2009 2010 2011 2012 2013
Number of Units sold 520 1200 1440 1730 2100
Price $2,000 $2,000 $2,000 $2,000 $2,000
Revenue $1,040,000 $2,400,000 $2,880,000 $3,460,000 $4,200,000
Fixed Cost $676,000 $647,000 $674,300 $702,965 $733,063
Variable Cost $850,000 $820,000 $835,750 $852,288 $869,652
Total Cost $1,526,000 $1,467,000 $1,510,050 $1,555,253 $1,602,715
Profit and Loss -$486,000 $933,000.00 $1,369,950.00 $1,904,748 $2,597,285

k. Personnel
This project only justifies the requirements of the software development team of SMART
Medical Devices. This project is required to develop the smart analytical software of the MI
Detector device. The software development team of the company consists of five software
engineers with varying levels, and a department manager. The members of the development
team are currently employed at SMART Medical Devices.
A department manager will oversee the development of the project and needs to have
skills and knowledge to drive the project forward. The department manager should have an
experience in project management and can deal well with different levels of the company.
There are three level 4 to 5 software engineers with the following minimum
qualifications to develop the project:
At least 5 years experience
Have a BS or MS degree in Computer Engineering/Electrical
Engineering/Mechanical Engineering/Biomedical Engineering
Experience in hardware and software development
Early Myocardial Infarction Detection 63

Two level 1 or 2 software engineers are also employed for this project to help in
developing the algorithm of the MI Detector. Minimum qualifications for these positions are the
following:
1 or 2 years experience in software and/or hardware projects
BS Degree in Computer Engineering/Electrical Engineering/Mechanical
Engineering/Biomedical Engineering
Experience in software language
Able to work without supervision
l. Business and Revenue Model
SMART Medical Devices have an established sales and marketing team. The device will
be sold to patients through direct and indirect sales. The device will be marketed initially in the
United States after obtaining the necessary permit from the FDA. SMART Medical Devices will
use direct marketing techniques through advertising and attending conventions and events.
SMART Medical Devices will also utilize the well-established sales force of the company and
market the device through contract sales.
The company website will also feature the MI Detector device and consumers will be
able to purchase the device online. Marketing materials will also be posted to educate consumers
on the features and benefits of MI Detector.
The company will approach insurance companies, for greater acceptance by the consumer
and having an insurance reimbursement codes will greatly increase the chances of selling the
device. Even though the device will be covered by the insurance, consumers will be willing to
pay, out-of-pocket, for the MI Detector due to the great benefits it can provide.
Early Myocardial Infarction Detection 64

The company elected to manufacture the device through an OEM company that are
reputed for their quality-made medical devices. Having an OEM company manufacturer, the
device is expected to minimize the cost and increases profit to the company.
The MI Detector will have an MSRP of $2,000 which is comparable or well below the
price of the competitor. Other accessories of the device will also be sold with a less or
comparable prices.
m. Strategic Alliances/Partners
SMART Medical Device Company will partner with physicians to develop the MI
Detector. Having the inputs and comments of doctors during the design phase can greatly
leverage the device to be the best diagnostic device in diagnosing myocardial infarction.
Partnership with a well-known hospital can be a great promotional tool and can provide good
benefits in both ends. Consumers take medical advices from well known institutions and
medical institutions can give a technological achievement when a medical device proves to be
effective and efficient.
Also, a well-established partnership with the OEM manufacturer is in place to deliver the
best diagnostic device in the market.
n. Profit and Loss
The company will outsource the manufacturing of the MI Detector ECG device to
minimize its expenses. Majority of the fixed costs are attributed to the salary of the software
development team. It will also cover for the expenses to develop the smart algorithm of the ECG
device. Those expenses consist of the hardware equipments needed and other business expenses
such as utilities and rent. The rest of the expenses are expected to be variable, giving the
company to expand as needed.
Early Myocardial Infarction Detection 65

i. Demand Assumptions
The SMART Medical Devices considers 100% of all patients with myocardial infarction
as a potential customer of MI Detector device.
In 2009, there is an estimated 7.9 million Americans with myocardial infarction
condition
An annual incidence of 610,000 and 325,000 new and recurrent attacks of myocardial
infarction
Every 34 seconds, an American will suffer myocardial infarction
25% of men and 38% of women die within the first year of having the diagnosed with
myocardial infarction; 50% of men and women age under 65, will die within 8 years.
ii. Product Assumptions
In the initial quarter, no products will be sold in the market, since the MI Detector device
is still in development phase. It is expected to be in the market on the third quarter of 2009. An
initial sale of 500 units in the first year is expected and is conservatively anticipated to grow 5%
per quarter or 20% per year. Table 9 and figure 28, illustrates the quarterly model with 5%
quarterly growth.
With the assumption that there are no unforeseen circumstances, the company is expected
to break even on the third quarter of its release. On the second year, it is expected that the
demand will pick up and will see the continued growth and success of MI Detector ECG device.






Table 9: The quarterly model of SMART Medical Devices
Q2 2009 Q3 2009
Number of
Units sold
0
Price $2,000.00 $2,000.00
Revenue $0.00 $500,000.00
Fixed Cost $225,000.00 $225,000.00
Variable
Cost
$285,000.00 $285,000.00
Total Cost $510,000.00 $510,000.00
Profit &
Loss
-$510,000.00 -$10,000.00
Figure 28: The quarterly model of SMART Medical Devices
o. Exit Strategy
The company will lose revenue on the first year due to the development phase and initial
introduction of MI Detector to the market. The company is estimated to be profitable from the
first year to the fifth year, and beyond.
Even though the company expects to be profitable on the third quarter of selling the
device, unforeseen circumstances may arise and can alter the financial forecast of the company.
If the company does not make any profits
management may elect to discontinue marketing and selling the device.
-$600.00
-$400.00
-$200.00
$0.00
$200.00
$400.00
$600.00
$800.00
1
$

T
h
o
u
s
a
n
d
s
Revenue
Early Myocardial Infarction Detection
The quarterly model of SMART Medical Devices
Q3 2009 Q4 2009 Q1 2010 Q2 2010
250 265 275 290
$2,000.00 $2,000.00 $2,000.00 $2,000.00
$500,000.00 $530,000.00 $550,000.00 $580,000.00 $609,000.00
$225,000.00 $225,000.00 $225,000.00 $225,000.00 $225,000.00
$285,000.00 $285,000.00 $205,000.00 $205,000.00 $205,000.00
$510,000.00 $510,000.00 $430,000.00 $430,000.00 $430,000.00
$10,000.00 $20,000.00 $120,000.00 $150,000.00 $179,000.00


The quarterly model of SMART Medical Devices
revenue on the first year due to the development phase and initial
introduction of MI Detector to the market. The company is estimated to be profitable from the
to the fifth year, and beyond.
Even though the company expects to be profitable on the third quarter of selling the
device, unforeseen circumstances may arise and can alter the financial forecast of the company.
ny does not make any profits from this device, SMART Medical Devices
management may elect to discontinue marketing and selling the device.
2 3 4 5 6
Quarterly
Break Even Analysis
Revenue Total Cost Profit & Loss
Early Myocardial Infarction Detection 66
Q3 2010 Q4 2010
305 320
$2,000.00 $2,000.00
$609,000.00 $639,450.00
$225,000.00 $225,000.00
$205,000.00 $205,000.00
$430,000.00 $430,000.00
$179,000.00 $209,450.00

revenue on the first year due to the development phase and initial
introduction of MI Detector to the market. The company is estimated to be profitable from the
Even though the company expects to be profitable on the third quarter of selling the
device, unforeseen circumstances may arise and can alter the financial forecast of the company.
m this device, SMART Medical Devices
7
Early Myocardial Infarction Detection 67

Since SMART Medical Devices developed a smart analytical tool to analyze ECG data, the
company will sell the copyrights of the software algorithm to established portable ECG
manufacturing company to get back the investment made for MI Detector. The company may
also elect to market only the smart analytical software to patients with existing portable ECG
devices. Having smart analytical software installed in their portable ECG devices can greatly
increase the efficacy of those machines to detect myocardial infarction. The other appropriate
exit stratergy will be market the smart algorithm as add-on for computer programs and mobiles
and market and sell the smart algorithm as a healthcare application.
XI. Future Directions
We have developed a ST-change detection program that can accurately analyze ECG data
and can determine if it contains any traits of ST-segment elevation or depression and based on
the analysis predicatively warn onset of myocardial infarction. This project, we believe, can
greatly decrease the morbidity and mortality of patients that are prone to have myocardial
infarction, as well as, those that are suffering from it.
Although the project is successful in diagnosing myocardial infarction, there are still many
issues that need to be addressed. The project was developed using datasets gathered from the
Physiobank database. Applying the project directly to patients and the ability to analyze data in
real-time can help us better understand the myocardial infarction condition which can lead to
improved analytical decisions. This can be done using the Real Time Toolbox that is present in
Matlab 7.1 software, the connection to the ECG machine can be made through a USB port and
the real-time data can be captured and analyzed. With an addition of few hardware components it
will be possible to have a standalone bedside ST-change monitoring device.
Early Myocardial Infarction Detection 68

The project was designed using the Matlab software. The group wanted to port the program
to a portable ECG device that can be comfortably worn by patients for a prolonged period of
time. This can effectively and efficiently diagnose the patient and eliminate missed diagnosis.
Another future consideration is by having wireless communication capability to the portable
ECG device. Personal area network (PAN) such as Bluetooth was considered to create a
wireless probe that connects wirelessly to a base ECG device. The ECG device is then
connected wirelessly to the hospital or doctor through wide area network (WAN) such wireless
internet or WI-FI. Telecardiology is rising in popularity and incorporating wireless internet to
the ECG device can provide long distance diagnosis to the patients by their physician and give
patients the freedom to roam outside the reach of hospitals. With telecardiology in mind, an
ECG with a GPS feature can give patients an additional security.
XII. Conclusion
The algorithm created in MATLAB was successful in detecting the different segments of
ECG signal from the Physiobank database. The QRS complex was detected and was used to
identify the ST-segment. The code was able to detect the abnormalities in the ST segment with
high accuracy. It was also successful in eliminating noises and baseline drifts that can degrade
the accuracy of the algorithm.
With the use of biorthogonal wavelets the ECG signal processing was made faster so that
when real time ECG signal is fed to the algorithm, the processing of the ECG signal and the
resultant warning in the case of abnormality will be close to the actual signal. The algorithm was
successful in identifying ST-segment changes/abnormalities for single lead ECG signal.
Early Myocardial Infarction Detection 69

Incorporating this algorithm into a 12-lead ECG monitoring system will make a standalone
myocardial infarction detection device.



Early Myocardial Infarction Detection 70

XIII. References

Albrecht P. (1983). S-T segment characterization for long-term automated ECG analysis. M.S.
Thesis, MIT Dept. of Electrical Engineering and Computer Science, (1983)

American Heart Association. (2002). Heart Disease and Stroke Statistics - 2003 Update. Dallas,
TX: American Heart Association.
American Heart Association. (2003). Heart Disease and Stroke Statistics - 2004 Update. Dallas,
TX: American Heart Association.
American Heart Association. (2005). Heart Disease and Stroke Statistics - 2005 Update. Dallas,
TX: American Heart Association.
American Heart Association. (2006). Heart Disease and Stroke Statistics - 2006 Update. Dallas,
TX: American Heart Association.
American Heart Association. (2007). Heart Disease and Stroke Statistics - 2007 Update. Dallas,
TX: American Heart Association.
American Heart Association. (2008). Heart Disease and Stroke Statistics - 2008 Update. Dallas,
TX: American Heart Association.
American Heart Association (2008). What is a Heart Attack? Life after Heart Attack, Diseases
and Conditions, American Heart Association (2008). Retrieved on November 6
th
2008 from
http://www.americanheart.org/presenter.jhtml?identifier=3038238
American Heart Association. (2009). Heart Disease and Stroke Statistics - 2009 Update. Dallas,
TX: American Heart Association.

American Hospital Directory - Hospital Statistics by State. (2008, August 6). Retrieved March
28, 2009, from http://ahd.com/state_statistics.html

Barron Jon (2007). Secrets of the Heart. Baseline of Health Foundation (2007). Retrieved on
6
th
April 2009 from http://www.jonbarron.org/heart-health-program/07-02-2007.php

Bhatia Praval, Boudy Jerome, Varejao Rodrigo (2006). Wavelet transformation and pre-
selection of mother wavelets for ECG signal processing Proceedings of the 24
th
IASTED
International Multi-conference. Biomedical Engineering February 2006.

Cardiovascular Consultants (2006). Physiology. Retrieved on March 28
th
2009 from
http://www.cardioconsult.com/Physiology/

Coronary Artery Disease (2008). Up to Date. Retrieved on 07
th
December 2008 from
http://www.uptodate.com/patients/content/images/card_pix/Coronary_artery_disease.jpg
Early Myocardial Infarction Detection 71

Demand for Home Medical Equipment to Exceed $10 b. (n.d.). Retrieved March 28, 2009, from
www.expresshealthcaremgmt.com/200903/market16.shtml

Fawcett Tom (2005). An introduction to ROC Analysis. Pattern Recognition letters 2006,
Issue # 27. Pages: 861-874. Retrieved on April 3
rd
2009 from
http://www.csee.usf.edu/~candamo/site/papers/ROCintro.pdf

Franc Jager, Alessandro Taddei, George B. Moody, Michele Emdin, Gorazd Antolic, Roman
Dorn, Ales Smrdel, Carlo Marchesi, and Roger G. Mark. Long-term ST database: a
reference for the development and evaluation of automated ischaemia detectors and for
the study of the dynamics of myocardial ischaemia. Medical & Biological Engineering &
Computing 41(2):172-183 (2003)

Goldberger, A. L.,Amaral, L. A. N.,Glass, L., Hausdorff, J. M. and Ivanov, P. Ch.,Mark, R. G.,
Mietus, J. E., Moody, G. B., Peng, C.-K., Stanley, H. E.(2000). {PhysioBank,
PhysioToolkit, and PhysioNet}: Components of a New Research Resource for
Complex Physiologic Signals" June 13
th
2000. Journal: Circulation, Volume: 101,
Issue # 23. Pages: e215--e220. Retrieved on 22
nd
November 2008 from
http://circ.ahajournals.org/cgi/content/full/101/23/e215

Heart Information Center (2006). Anatomy of Heart. Texas Heart Institute (July 2006).
Retrieved on 17
th
March 2009 from
http://www.texasheart.org/HIC/ANATOMY/anatomy2.cfm

Heart Information Center (2006). Bundle Branch Block. Texas Heart Institute (February
2009). Retrieved on 25
th
March 2009 from
http://www.texasheart.org/HIC/Topics/Cond/bbblock.cfm

Jouck. P.P.H. (2004). Application of the Wavelet Transform Modulus Maxima to the T-wave
Detection in Cardiac Signals December 2004. Retreived on 17
th
March 2009 from
http://www.personeel.unimaas.nl/Westra/PhDMaBa-
teaching/GraduationStudents/PJouck2004/PJouck2004verslag.pdf

Klabunde, R. E. (2007, April 6). ECG Introduction. Retrieved April 4, 2009, from
http://www.cvphysiology.com/Arrhythmias/A009.htm

Klatt E.C. (2008). Myocardial Infarction The University of Utah Eccles Health Sciences
Library (2008). Retrieved on 29
th
March 2009 from
http://library.med.utah.edu/WebPath/TUTORIAL/MYOCARD/MYOCARD.html

Lowry, Richard (2008). Simple ROC Curve Analysis: Version 1. VassarStat: Web Site for
Statistical Computation 2001-2009. Retrieved on April 3
rd
2009 from
http://faculty.vassar.edu/lowry/roc1.html#down

Milosavljevi Neboja., Petrovi Aleksandar. (2006). ST Segment Change Detection by Means
of Wavelets. 8
th
Seminar on Neural Networks Applications in Electrical Engineering,
NEUREL-2006. http://www.ewh.ieee.org/reg/8/conferences.html.
Early Myocardial Infarction Detection 72


Moody GB, Muldrow WE, Mark RG. A noise stress test for arrhythmia detectors. Computers in
Cardiology 1984; 11:381-384.

Myocardial Infarction (2009). Myocardial Infarction. The Free Dictionary by Farlex.
Retrieved on 29
th
March 2009 from http://medical-
dictionary.thefreedictionary.com/Myocaridal+infarction">myocardial infarction</a>

O'Grady, M. R., & O'Sullivan, M. L. (n.d.). VetGo Cardiology. Retrieved April 4, 2009, from
http://www.vetgo.com/cardio/concepts/concsect.php?conceptkey=165

Pan Jiapu., Tompkins Willis. J. (1985). A Real-Time QRS Detection Algorithm. IEEE
Transactions on Biomedical Engineering, Vol. BME-32, Issue #3, March 1985,
Pages:230-236.

Polikar Robi (2001). The Engineers ultimate guide to wavelet analysis. The Wavelet Tutorial.
College of Engineering, Rowan University (2001). Retrieved on 5
th
April 2009 from
http://users.rowan.edu/~polikar/WAVELETS/WTtutorial.html

Poul-Erik Paulev(2000). Textbook in Medical Physiology and Pathophysiology Essentials and
Clinical Problems- Chapter 10: Cardiac Performances and Disorders. Copenhagen Medical
Publishers 1999-2000. Retrieved on 29
th
March 2009 from
http://www.mfi.ku.dk/ppaulev/chapter10/chap_10.htm

Samer Garas, Maziar Zafari (2008). Myocardial Infarction. EMedicine from WebMD (August
2008). Retrieved on 27
th
March 2009 from http://emedicine.medscape.com/article/155919-
overview

Saritha.C., Sukanya. V., Murthy. Narasimha. Y. (2008) . ECG Signal Analysis using Wavelet
Transforms. Journal of Bulg. J. Physics(2008). Issue 35. Pages: 68-77.

Schniter Phil (2005). Continous Wavelet Transform. Creative Commons Attribution License.
Connexious module: m10418. Version: 2:13. June 9
th
, 2005. Retrieved on April 5
th
2009
from http://cnx.org/content/m10418/latest/

Sivannarayana N., Reddy D.C. (1999). Biorthogonal Wavelet Transforms for ECG Parameters
Estimation. Journal Medical Engineering and Physics (1999) Issue: 21Pages: 167-174.

Taddei, A., Distante, G., Emdin, M., Pisani, P., Moody, G.B., Zeelenberg, C., and Marchesi, C.
The European ST-T Database: standard for evaluating systems for the analysis of ST-T
changes in ambulatory electrocardiography. European Heart Journal 13: 1164-1172
(1992).

The Myocardial Infarction Heart Attack (2006). The Causes: The Myocardial Infarction: The
Cardiovascular Diseases. Heart and Vessels (July 2006). Retrieved on 29
th
March 2009
from http://www.heart-vessels.com/cardiovascular-diseases/heart-attack-myocardial-
infarction6.php
Early Myocardial Infarction Detection 73


Tompkins Willis. J. (2000). Biomedical Digital Signal Processing. Chapter 13: ECG Analysis
System. Prentice Hall (2000). Pages: 271-272.

VIBES Electrocardiogram Mosaic. (n.d.). Retrieved April 4, 2009, from
http://www.vanth.org/vibes/electro.html

Wenli Chen., Zhiwen Mo., Wen Guo. (2007) Detection of QRS Complexes Using Wavelet
Transforms and Golden Section Search Advances in Intelligent Systems Research ISKE-
2007 Proceedings. Retrieved on March 18
th
2009 from http://www.atlantis-
press.com/php/download_paper.php?id=1195.

Wolfram Research (2009) . Biorthogonal Wavelets. Documentation: Wavelet Explorer:
Fundamentals of Wavletes. Retrieved on April 8
th
2009 from
http://documents.wolfram.com/applications/wavelet/FundamentalsofWavelets/1.6.1.html

World Heart Federation (2009). Cardiovascular Diseases.
http://www.world-heart-federation.org/cardiovascular-health/heart-disease/different-heart-
diseases/#c434

Yanowitz G.Frank (2006). IX. Myocardial Infarction. The Alan E. Lindsay ECG Learning
Center in Cyberspace. Spencer S. Eccles Health Sciences Library University of Utah
Health Services Center (2006). Retrieved on November 6
th
2008 from
http://library.med.utah.edu/kw/ecg/ecg_outline/Lesson9/index.html#Intro











Early Myocardial Infarction Detection 74

Appendix A

Code for Matlab Program
clear all;
clc;
close all;
%***************************************************************
% Get Data & User Inputs
%***************************************************************
Fileloc = 'C:\MATLAB7\Work\';
Filename = input('Enter ECG File Name = ','s'); % Input Filename
Headerfile = strcat(Filename,'.hea'); % Header In TXT
Format
load (Filename); % .mat file for Data
%***************************************************************
% Load Header Data
%***************************************************************
fprintf(1,'\nK> Loading Data from Header File %s ...\n',
Headerfile);
signalh = fullfile(Fileloc, Headerfile);
fid1 = fopen(signalh,'r');
z = fgetl(fid1);
A = sscanf(z, '%*s %d %d',[1,2]);
nosig = A(1); % Number Of Signals
sfreq = A(2);
clear A;
z = fgetl(fid1);
A = sscanf(z, '%*s %*d %d %d %d %d',[1,4]);
gain = A(1); % Integers Per mV
clear A;
Early Myocardial Infarction Detection 75

S = sfreq*60;
counter1=0;
counter2=0;
counter3=0;
for n = 0:5
tic
j = S*n+1:1:S*(n+1);
D = val(j);
dat = length (D);
k = 1:1:dat;
D = D(k)/gain;
%***************************************************************
%Signal filter and Base line wander correction
%***************************************************************
D= transpose (D);
windowSize = 5;
filsig = filter (ones(1,windowSize)/windowSize,1,D);
y = medfilt1(filsig,200); % 1st median filter
s1 = y;
clear y;
y = medfilt1(s1,600); % 2nd median filter
D = filsig - y;
clear s1;
clear y;
pack;

%***************************************************************
% Manipulate Data So We Only Look At What The User Wants
%***************************************************************
D = transpose (D);
Early Myocardial Infarction Detection 76

D = cwt (D, 1:4, 'bior2.4'); %Performing Continuous Wavelet
Transform using Biorthogonal
Wavelet to ECG_1
D = transpose (D);
x = D (:,4);
clear D;
%***************************************************************
% R-Peak Detection
%***************************************************************
thresh = 0.6;
% create time axis
len = length (x);
tt = 1/sfreq:1/sfreq:ceil(len/sfreq);
t = tt(1:len);
max_h = max (x(round(len/4):round(3*len/4)));%segment search
area first find the
highest bumps in
the ECG_1
poss_reg = x>(thresh*max_h); %then build an array of segments to
look in
%find indices into boudaries of
each segment
left = find(diff([0 poss_reg'])==1); % remember to zero pad at
start
right = find(diff([poss_reg' 0])==-1); % remember to zero pad at
end
%loop through all possibilities
for(i=1:length(left))
[maxval(i) maxloc(i)] = max( x(left(i):right(i)) );
Early Myocardial Infarction Detection 77

[minval(i) minloc(i)] = min( x(left(i):right(i)) );
maxloc(i) = maxloc(i)-1+left(i); % add offset of present
location
minloc(i) = minloc(i)-1+left(i); % add offset of present
location
end
R_index = maxloc;
R_t = t(maxloc);
R_amp = maxval;
%***************************************************************
% Heart Rate Calculation
%***************************************************************
for j = 2:length (R_t)
HR(j)= R_t(j)-R_t(j-1);
end
H_R = 60/(mean (HR));
fprintf (1,'\nK> Heart Rate is %d \n',H_R);
%***************************************************************
% S-Point Detection
%***************************************************************
R_len= length (R_index);
for j = 1:R_len
IR1 = R_index(j);
for i = IR1:IR1+ (round(sfreq*0.03)*(H_R/72))
if i == length (x)|i==0
S_index(j)= 1;
S_amp(j) = x(1,1);
S_t(j) = t(1,1);
break
end
Early Myocardial Infarction Detection 78

if x(i,1)< x(i+1,1) && x(i,1)< x(i-1,1)
S_index(j)= i;
S_amp(j) = x(i,1);
S_t(j) = t(1,i);
break
end
end
end
%***************************************************************
% Q-Point Detection
%***************************************************************
for j = 1:R_len
IR1 = R_index(j);
for i = IR1:-1:IR1- (round(sfreq*0.03 *(H_R/72)))
if i == 0|i==length (x)
Q_index(j)= 1;
Q_amp(j) = x(1,1);
Q_t(j) = t(1,1);
break
end
if x(i,1)< x(i+1,1) && x(i,1)< x(i-1,1)
Q_index(j)= i;
Q_amp(j) = x(i,1);
Q_t(j) = t(1,i);
break
end
end
end

Early Myocardial Infarction Detection 79

%***************************************************************
% J-Point Detection
%***************************************************************
S_len = length (S_index);
for j = 1:S_len
IS1= S_index(j);
for i=IS1:IS1+ (round(sfreq*0.03) *(H_R/72))
if i==0
J_index(j)=1;
J_amp(j)= x(1,1);
J_t(j)= t(1,1);
break
end
if i> length (x)
break
end
if x(i,1)>=0
J_index(j)=i;
J_amp(j)= x(i,1);
J_t(j)= t(1,i);
break
end
end
end
%***************************************************************
% T-Peak Detection
%***************************************************************
J_len = length (J_index);
for j = 1: J_len
P1 = R_index(j)+ (round(sfreq*0.4) *(H_R/72));
Early Myocardial Infarction Detection 80

P2 = J_index (j)+ (round(sfreq*0.08) *(H_R/72));
if P1> length (x)|P2> length (x)
break
end
if P1 > P2
[T_peak(j),T_peak_index(j)] = max(x(P2:P1));
T_peak_index(j) = T_peak_index(j)+ P2;
else
[T_peak(j),T_peak_index(j)] = max(x(P1:P2));
T_peak_index(j) = T_peak_index(j)+ P1;
end
T_peak_t (j)= t(T_peak_index (j));
end



%***************************************************************
% T-Point (T onset) Detection via T-peak
%***************************************************************
T_len = length (T_peak_index);
for j = 1:T_len
IT1 = T_peak_index(j);
for i = IT1:-1:IT1-(round(sfreq*0.035) *(H_R/72))
TP_index(j)=i;
TP_amp(j)=x(i,1);
TP_t(j)=t(1,i);
end
end

Early Myocardial Infarction Detection 81

%***************************************************************
% K-Point
%***************************************************************
Q_len = length (Q_index);
for j = 1:Q_len
IQ1 = Q_index(j);
for i=IQ1:-1:IQ1- (round(sfreq*0.03) *(H_R/72))
if i == 0
K_index(j) = 1;
K_amp(j)= x(1,1);
K_t(j)=t(1,1);
break
end
if x(i,1)>=0
K_index(j) = i;
K_amp(j)= x(i,1);
K_t(j)=t(1,i);
break
end
end
if i == 0
K_index(j) = 1;
K_amp(j)= x(1,1);
K_t(j)=t(1,1);
break
end
if x(i,1)< x(i+1,1) && x(i,1)< x(i-1,1)
K_index(j) = i;
if K_index(j)==0
Early Myocardial Infarction Detection 82

K_index(j)=1;
end
K_amp(j)= x(i,1);
K_t(j)=t(1,i);
end

end

%***************************************************************
% P-Point Detection via K+80ms
%***************************************************************
K_len = length (K_index);
for j = 1:K_len
IK1 = K_index(j);
for i=IK1:-1:IK1- (round(sfreq*0.08) *(H_R/72))
if i ==0
P_index(j) = 1;
P_amp(j)= x(1,1);
P_t(j)=t(1,1);
break
end
P_index(j) = i;
P_amp(j)= x(i,1);
P_t(j)=t(1,i);
end
end



Early Myocardial Infarction Detection 83

%***************************************************************
% Calculation of Isoelectric Line
%***************************************************************
j = 1:1:K_len;
ISO(j) = mean(x(P_index(j):K_index(j)));
%***************************************************************
% Calculation of ST-segment
%***************************************************************
a = length (J_index);
b = length (TP_index);
if a==b;
j = 1:1:J_len;
ST(j) = mean(x(J_index(j):TP_index(j)));
end
if a>b
j = 1:1:b;
ST(j) = mean(x(J_index(j):TP_index(j)));
end
if a<b
j = 1:1:a;
ST(j) = mean(x(J_index(j):TP_index(j)));
End
%***************************************************************
% Comparison of ISO and ST
%***************************************************************
a = length (ISO);
b = length (ST);
if a==b
for j = 1:a
counter1=counter1+1;
if (ISO(j))>= (ST(j)+0.0001) && ISO(j)>=ST(j)-
0.0001|ISO(j)==ST(j)
Early Myocardial Infarction Detection 84

counter2=counter2+1;
else
counter3=counter3+1;
end
end
end

if a<b
for j=1:a
counter1=counter1+1;
if ISO(j)>=ST(j)+0.0001 && ISO(j)>=ST(j)-
0.0001|ISO(j)==ST(j)
counter2=counter2+1;
else
counter3=counter3+1;
end
end
end

if a>b
for j=1:b
counter1=counter1+1;
if ISO(j)>=ST(j)+0.0001 && ISO(j)>=ST(j)-
0.0001|ISO(j)==ST(j)
counter2=counter2+1;
else
counter3=counter3+1;
end
Early Myocardial Infarction Detection 85

end
end
clear ISO;
clear ST;
toc
fprintf(1,'\nK> %d loop completed %n \n',n);
end
fprintf (1,'\nK> total number of signals evaluated is %d
\n',counter1)
fprintf (1,'\nK> total number of signals without MI is %d
\n',counter2)
fprintf (1,'\nK> total number of signals with MI is %d
\n',counter3)
if counter3/counter1>=0.95
fprintf(1,'\nK>WARNING: MI\n');
else
fprintf(1,'\nK>No MI\n');
end
%***************************************************************
%Plotting Function
%***************************************************************
figure
subplot(2,1,1)
plot(t,x), grid on;
title('Level 4 2^4 Biorthogonal Wavelet Transformed ECG Signal')
ylabel('ECG')
subplot(2,1,2)
plot(t,x,'b');hold on;
plot(S_t,S_amp,'+r'), grid on; hold on;
plot(R_t,R_amp,'+k'); hold on;
Early Myocardial Infarction Detection 86

plot (Q_t, Q_amp, '+g'); hold on;
plot (T_peak_t,T_peak, '+y');hold on;
plot (TP_t,TP_amp, '+m');hold on;
plot (J_t,J_amp,'+c');hold on;
plot (K_t,K_amp,'*r');hold on;
plot (P_t,P_amp,'*m');
title('Biorthogonal Wavelet Transformed ECG Signal with Q-Peaks
(green), R-Peaks (black),S-Peaks (red)')
ylabel('ECG+S+R+Q+P+J')
hold off;
fprintf(1,'\nK> Analysis Complete \n');
%***************************************************************
% End of Code
%***************************************************************


























Early Myocardial Infarction Detection 87

Appendix B
he Graphical user inerface for the software code developed is as follows:
function varargout = GUISTchange(varargin)
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @GUISTchange_OpeningFcn,
...
'gui_OutputFcn', @GUISTchange_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end
if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State,
varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
Early Myocardial Infarction Detection 88

end
%***************************************************************
% Get Data & User Inputs
%***************************************************************
function edit1_Callback(hObject, eventdata, handles)
Fname = get(hObject,'string');
handles.Filename = Fname;
guidata(hObject, handles);
function edit2_Callback(hObject, eventdata, handles)
handles.Filename = '';
handles.Result = '';
handles.output = hObject;
guidata(hObject, handles);
function varargout = GUISTchange_OutputFcn(hObject, eventdata,
handles)
varargout{1} = handles.output;
Fileloc = 'C:\MATLAB7\Work\';
Headerfile = strcat(handles.Filename,'.hea'); % Header
In TXT Format
Early Myocardial Infarction Detection 89

load (handles.Filename); % .mat file for Data
%***************************************************************
% Load Header Data
%***************************************************************
signalh = fullfile(Fileloc, Headerfile);
fid1 = fopen(signalh,'r');
z = fgetl(fid1);
A = sscanf(z, '%*s %d %d',[1,2]);
nosig = A(1); % Number Of Signals
sfreq = A(2);
clear A;
z = fgetl(fid1);
A = sscanf(z, '%*s %*d %d %d %d %d',[1,4]);
gain = A(1); % Integers Per mV
clear A;
S = sfreq*60;
counter1=0;
counter2=0;
Early Myocardial Infarction Detection 90

counter3=0;
for n = 0:4
j = S*n+1:1:S*(n+1);
D = val(j);
dat = length (D);
k = 1:1:dat;
D = D(k)/gain;
%***************************************************************
%Signal filter and Base line wander correction
%***************************************************************
D= transpose (D);
axes(handles.axes1)
plot (D,'g');
title ('\it{Original Signal for ECG}');
ylabel ('Amplitude in Volts');
xlabel ('# of Samples');
%set(handles.axes1,'XMinorTick','on');
set(handles.axes1,'Color','k');
Early Myocardial Infarction Detection 91

drawnow;
windowSize = 5;
filsig = filter (ones(1,windowSize)/windowSize,1,D);
y = medfilt1(filsig,200); % 1st median filter
s1 = y;
clear y;
y = medfilt1(s1,600); % 2nd median filter
D = filsig - y;
axes(handles.axes2)
plot (D,'g');
title ('\it{Filtered Baseline Wander Corrected Signal for
ECG}');
ylabel ('Amplitude in Volts');
xlabel ('# of Samples');
set(handles.axes2,'Color','k');
drawnow;
clear s1;
clear y;
Early Myocardial Infarction Detection 92

pack;
%***************************************************************
% Manipulate Data So We Only Look At What The User Wants
%***************************************************************
D = transpose (D);
D = cwt (D, 1:4, 'bior2.4'); %Performing Continuous Wavelet
Transform using Biorthogonal Wavelet to ECG_1
D = transpose (D);
D_1 = D (:,1);
D_2 = D (:,2);
D_3 = D (:,3);
x = D (:,4);
clear D;
%***************************************************************
% R-Peak Detection
%***************************************************************
thresh = 0.6;
% create time axis
len = length (x);
Early Myocardial Infarction Detection 93

tt = 1/sfreq:1/sfreq:ceil(len/sfreq);
t = tt(1:len);
max_h = max (x(round(len/4):round(3*len/4)));%segment search
area first find the highest bumps in the ECG_1
poss_reg = x>(thresh*max_h); %then build an array of segments to
look in
left = find(diff([0 poss_reg'])==1); % remember to zero pad at
start
right = find(diff([poss_reg' 0])==-1); % remember to zero pad at
end
for(i=1:length(left))
[maxval(i) maxloc(i)] = max( x(left(i):right(i)) );
[minval(i) minloc(i)] = min( x(left(i):right(i)) );
maxloc(i) = maxloc(i)-1+left(i); % add offset of present
location
minloc(i) = minloc(i)-1+left(i); % add offset of present
location
end
R_index = maxloc;
Early Myocardial Infarction Detection 94

R_t = t(maxloc);
R_amp = maxval;
%***************************************************************
% Heart Rate Calculation
%***************************************************************
for j = 2:length (R_t)
HR(j)= R_t(j)-R_t(j-1);
end
H_R = 60/(mean (HR));
%***************************************************************
% S-Point Detection
%***************************************************************
R_len= length (R_index);
for j = 1:R_len
IR1 = R_index(j);
for i = IR1:IR1+ (round(sfreq*0.03*(H_R/72)))
if i == length (x)|i==0
S_index(j)= 1;
S_amp(j) = x(1,1);
Early Myocardial Infarction Detection 95

S_t(j) = t(1,1);
break
end
if x(i,1)< x(i+1,1) && x(i,1)< x(i-1,1)
S_index(j)= i;
S_amp(j) = x(i,1);
S_t(j) = t(1,i);
break
end
end
end
%***************************************************************
% Q-Point Detection
%***************************************************************
for j = 1:R_len
IR1 = R_index(j);
for i = IR1:-1:IR1- (round(sfreq*0.03*(H_R/72)))
if i == 0|i==length (x)|i-1==0
Early Myocardial Infarction Detection 96

Q_index(j)= 1;
Q_amp(j) = x(1,1);
Q_t(j) = t(1,1);
break
end
if x(i,1)< x(i+1,1) && x(i,1)< x(i-1,1)
Q_index(j)= i;
Q_amp(j) = x(i,1);
Q_t(j) = t(1,i);
break
end
end
end
%***************************************************************
% J-Point Detection
%***************************************************************
S_len = length (S_index);
for j = 1:S_len
Early Myocardial Infarction Detection 97

IS1= S_index(j);
foundj = 0;
for i=IS1:IS1+ (round(sfreq*0.03*(H_R/72)))
if i==0
J_index(j)=1;
J_amp(j)= x(1,1);
J_t(j)= t(1,1);
foundj = 1;
break
end
if i > length (x)
break
end
if x(i,1)>=0
J_index(j)=i;
J_amp(j)= x(i,1);
J_t(j)= t(1,i);
foundj = 1;
Early Myocardial Infarction Detection 98

break
end
end
if foundj == 0
J_index(j)=1;
J_amp(j)= x(1,1);
J_t(j)= t(1,1);
end
end
%***************************************************************
% T-Peak Detection
%***************************************************************
J_len = length (J_index);
for j = 1: J_len
P1 = R_index(j)+ (round(sfreq*0.4*(H_R/72)));
P2 = J_index (j)+ (round(sfreq*0.08*(H_R/72)));
if P1> length (x)|P2> length (x)
break
Early Myocardial Infarction Detection 99

end
if P1 > P2
[T_peak(j),T_peak_index(j)] = max(x(P2:P1));
T_peak_index(j) = T_peak_index(j)+ P2;
else
[T_peak(j),T_peak_index(j)] = max(x(P1:P2));
T_peak_index(j) = T_peak_index(j)+ P1;
end
T_peak_t (j)= t(T_peak_index (j));
end

%***************************************************************
% T-Point (T onset) Detection via T-peak
%***************************************************************
T_len = length (T_peak_index);
for j = 1:T_len
IT1 = T_peak_index(j);
for i = IT1:-1:IT1-(round(sfreq*0.035*(H_R/72)))
Early Myocardial Infarction Detection 100

TP_index(j)=i;
TP_amp(j)=x(i,1);
TP_t(j)=t(1,i);
end
end
%***************************************************************
% K-Point
%***************************************************************
Q_len = length (Q_index);
for j = 1:Q_len
IQ1 = Q_index(j);
foundk = 0;
for i=IQ1:-1:IQ1- (round(sfreq*0.03*(H_R/72)))
if i == 0
K_index(j) = 1;
K_amp(j)= x(1,1);
K_t(j)=t(1,1);
foundk = 1;
Early Myocardial Infarction Detection 101

break
end
if x(i,1)>=0
K_index(j) = i;
K_amp(j)= x(i,1);
K_t(j)=t(1,i);
foundk = 1;
break
end
end
if foundk == 0
K_index(j)=1;
K_amp(j)= x(i,1);
K_t(j)=t(1,i);
end
end

Early Myocardial Infarction Detection 102

%***************************************************************
% P-Point Detection via K+80ms
%***************************************************************
K_len = length (K_index);
for j = 1:K_len
IK1 = K_index(j);
for i=IK1:-1:IK1- (round(sfreq*0.08*(H_R/72)))
if i ==0
P_index(j) = 1;
P_amp(j)= x(1,1);
P_t(j)=t(1,1);
break
end
P_index(j) = i;
P_amp(j)= x(i,1);
P_t(j)=t(1,i);
end
end
Early Myocardial Infarction Detection 103

%***************************************************************
% Calculation of Isoelectric Line
%***************************************************************
j = 1:1:K_len;
ISO(j) = mean(x(P_index(j):K_index(j)));
%***************************************************************
% Calculation of ST-segment
%***************************************************************
a = length (J_index);
b = length (TP_index);
if a==b;
j = 1:1:J_len;
ST(j) = mean(x(J_index(j):TP_index(j)));
end
if a>b
j = 1:1:b;
ST(j) = mean(x(J_index(j):TP_index(j)));
end
if a<b
Early Myocardial Infarction Detection 104

j = 1:1:a;
ST(j) = mean(x(J_index(j):TP_index(j)));
end
%***************************************************************
% Comparison of ISO and ST
%***************************************************************
a = length (ISO);
b = length (ST);
if a==b
for j = 1:a
counter1=counter1+1;
if (ISO(j)>= ST(j)+0.0001 && ISO(j)>=ST(j)-
0.0001)|ISO(j)==ST(j)
%fprintf(1,'\nK>No MI\n');
counter2=counter2+1;
else
counter3=counter3+1;
end
Early Myocardial Infarction Detection 105

end
end
if a<b
for j=1:a
counter1=counter1+1;
if (ISO(j)>=ST(j)+0.0001 && ISO(j)>=ST(j)-
0.0001)|ISO(j)==ST(j)
counter2=counter2+1;
else
counter3=counter3+1;
end
end
end

if a>b
for j=1:b
counter1=counter1+1;
Early Myocardial Infarction Detection 106

if (ISO(j)>=ST(j)+0.0001 && ISO(j)>=ST(j)-
0.0001)|ISO(j)==ST(j)
counter2=counter2+1;
else
counter3=counter3+1;
end
end
end
clear ISO;
clear ST;
if counter3/counter1>=0.90
fprintf(1,'\nK>WARNING: Possible MI\n');
else
fprintf(1,'\nK>No MI\n');
end
axes(handles.axes3)
plot(t,x,'g');hold on;
plot(S_t,S_amp,'+r'), hold on;
Early Myocardial Infarction Detection 107

plot(R_t,R_amp,'+w'); hold on;
plot (Q_t, Q_amp, '+b'); hold on;
plot (T_peak_t,T_peak, '+y');hold on;
plot (TP_t,TP_amp, '+m');hold on;
plot (J_t,J_amp,'+c');hold on;
plot (K_t,K_amp,'Marker','+','color',[1,0.4,0.6]);hold on;
plot (P_t,P_amp,'Marker','+','color',[0.4,0,0.6]);
title('Biorthogonal Wavelet Transformed ECG Signal with Q-Peaks
(green), R-Peaks (black),S-Peaks (red)')
ylabel('ECG+S')
hold off;
ylabel ('Amplitude in Volts');
xlabel ('Time in seconds');
set(handles.axes3,'Color','k');
drawnow;
end
if counter3/counter1>=0.90
fprintf(1,'\nK>WARNING: Call 9-1-1 & Get Help\n');
Early Myocardial Infarction Detection 108

handles.Result = 'WARNING: Call 9-1-1 & Get Help';
else
fprintf(1,'\nK>No ST-Changes Detected\n');
handles.Result = 'No ST-Changes Detected';
end
guidata(hObject, handles);
set(handles.edit2,'String',handles.Result);
function edit1_CreateFcn(hObject, eventdata, handles)
if ispc
set(hObject,'BackgroundColor','white');
else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundC
olor'));
end
function edit2_CreateFcn(hObject, eventdata, handles)
if ispc
set(hObject,'BackgroundColor','White');
Early Myocardial Infarction Detection 109

else
set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundC
olor'));
end
function figure1_ResizeFcn(hObject, eventdata, handles)
%***************************************************************
% End Of Code
%***************************************************************

Early Myocardial Infarction Detection 110

Appendix C
Testing Results
Dataset Name Sample # MI No MI
Total # of
Signals
MIT-BIH ST Change Database 327m 268 0 268
5 minutes of data tested 325m 375 0 375
324m 248 62 319
323m 375 85 460
322m 254 241 495
321m 378 0 378
320m 0 411 411
319m 133 407 540
318m 565 169 734
317m 144 213 357
316m 115 425 540
315m 379 0 379
314m 181 252 433
313m 105 345 450
312m 375 0 375
311m 83 308 391
310m 0 514 514
European ST Database e0103m 60 245 305
5 minutes of data tested e0105m 0 273 273
e0107m 0 330 330
e0113m 305 0 305
e0111m 310 0 310
e0119m 240 60 300
e0121m 302 77 379
e0123m 299 71 370
e0125m 349 0 349
e0127m 293 74 367
e0133m 265 0 265
e0139m 156 234 390
e0147m 265 0 265
e0155m 203 148 351
MIT-BIH Noise Stress Database 118e00m 0 361 361
5 minutes of data tested 118e06m 0 361 361
118e12m 0 361 361
118e18m 0 361 361
118e24m 0 361 361
Longterm ST Database s20021m 431 0 431
5 minutes of data tested s20111m 456 0 456
Early Myocardial Infarction Detection 111

s20141m 590 0 590
s20651 530 0 530
s20231m 511 0 511
s20081m 429 89 518
MIT-BIH Normal Sinus Rhythm
Database
16265m 0 298 298
5 minutes of data tested 16272m 0 328 328
18184m 292 179 471
19093m 234 68 302
19140m 196 248 444
19830m 0 156 156
16273m 0 279 279
16420m 273 180 453
16483m 290 57 347
16773m 88 324 412
16786m 0 318 318
17453m 171 248 419
18177m 0 175 175

Results with 100% accuracy for MI
Results with 100% accuracy for Normal ECG













Early Myocardial Infarction Detection 112

Appendix D
Receiver Operating Characteristics Curve Datasheet
Sample # MI NMI Total
Percentage
Correct
Percentage
Wrong Databse Name
327m 268 0 268 100 0 MIT-BIH ST Change
325m 375 0 375 100 0
324m 248 62 319 77.74294671 19.43573668
323m 375 85 460 81.52173913 18.47826087
322m 254 241 495 51.31313131 48.68686869
321m 378 0 378 100 0
320m 0 411 411 0 100
319m 133 407 540 24.62962963 75.37037037
318m 565 169 734 76.97547684 23.02452316
317m 144 213 357 40.33613445 59.66386555
316m 115 425 540 21.2962963 78.7037037
315m 379 0 379 100 0
314m 181 252 433 41.80138568 58.19861432
313m 105 345 450 23.33333333 76.66666667
312m 375 0 375 100 0
311m 83 308 391 21.22762148 78.77237852
310m 0 514 514 0 100
e0103m 60 245 305 19.67213115 80.32786885 European ST
e0105m 0 273 273 0 100
e0107m 0 330 330 0 100
e0113m 305 0 305 100 0
e0111m 310 0 310 100 0
e0119m 240 60 300 80 20
e0121m 302 77 379 79.68337731 20.31662269
e0123m 299 71 370 80.81081081 19.18918919
e0125m 349 0 349 100 0
e0127m 293 74 367 79.83651226 20.16348774
e0133m 265 0 265 100 0
e0139m 156 234 390 40 60
e0147m 265 0 265 100 0
e0155m 203 148 351 57.83475783 42.16524217
118e00m 0 361 361 0 100
MIT-BIH Noise Stress
Test
118e06m 0 361 361 0 100
118e12m 0 361 361 0 100
118e18m 0 361 361 0 100
118e24m 0 361 361 0 100
Early Myocardial Infarction Detection 113

s20021m 431 0 431 100 0 Longterm ST change
s20111m 456 0 456 100 0
s20141m 590 0 590 100 0
s20651 530 0 530 100 0
s20231m 511 0 511 100 0
s20081m 429 89 518 82.81853282 17.18146718
16265m 0 298 298 0 100 Normal Sinus Rhythm
16272m 0 328 328 0 100
18184m 292 179 471 61.99575372 38.00424628
19093m 234 68 302 77.48344371 22.51655629
19140m 196 248 444 44.14414414 55.85585586
19830m 0 156 156 0 100
16273m 0 279 279 0 100
16420m 273 180 453 60.26490066 39.73509934
16483m 290 57 347 83.57348703 16.42651297
16773m 88 324 412 21.3592233 78.6407767
16786m 0 318 318 0 100
17453m 171 248 419 40.81145585 59.18854415
18177m 0 175 175 0 100

Diagnostic Level
90%
80%
70%
50%
40%

You might also like