You are on page 1of 5

2013 INTERNATIONAL CONFERENCE ON COMPUTING, ELECTRICAL AND ELECTRONIC ENGINEERING (ICCEEE)

Heart Disease Diagnostic Graphical User Interface


Using Fractal Dimension

Jacqueline. J. George Eman Mohammed Saeed Mohammed


Electronics Department, Sudan University of Science and Electronics Department, Sudan University of Science and
Technology, Khartoum, Sudan Technology, Khartoum, Sudan
Email: jaco_john@hotmail.com Email: emanmohammed66@yahoo.com

Abstract— Heart diseases are among the main causes of death in


atria. The AV junction fails to conduct every atrial action
the world. Therefore, it is necessary to have proper methods to potential. The P Wave is not distinguishable as the atria are
determine the cardiac condition of the patient. ECG signals of the firing off all over. In Premature Atrial Contraction (PAC) the
heart being a self-similar object; can well be considered for atria cell fires an early impulse before the SA node which
fractal analysis. In this paper the Fractal Dimension method was causes the heart to beat earlier causing irregularity in the heart
used to distinguish and analyze three specific heart diseases rhythm. This often gives rise to atypical P wave. The next beat
namely Premature Atrial Contraction (PAC), Premature often has a compensatory pause, so that the interval between
Ventricular Contraction (PVC), and Atrial Fibrillation from the the previous and subsequent beats is twice the normal R-R
normal ECG signal. The ECG signals used were taken from three timing [1]. So the detection of PVC, PAC, and Atrial
databases, the MIT-BIH Arrhythmia Database, the MIT-BIH Fibrillation has an important clinical significance.
Normal Sinus Rhythm Database, and the Intracardiac Atrial Fractal Dimension is a mathematical method that measures
Fibrillation Database. Rescaled range method was used to the degree of fractal boundary fragmentation or irregularity
determine the specific range of fractal dimension for each over multiple scales. In this paper the Fractal Dimension
disease. The obtained range of fractal dimension for a healthy method is used to distinguish the three specific heart diseases
person was 1.73–1.81, for PVC patients was 1.34–1.44, for PAC from a normal ECG signal. A GUI is designed using MATLAB
patients was 1.49–1.69 and for Atrial Fibrillation patients was to diagnose an ECG signal from its Fractal Dimension range.
1.11–1.30. A Graphical User Interface (GUI) was designed using This reduces the doctor’s workload by using computerized
MATLAB program to calculate the Fractal Dimension, to
analysis of ECG waveforms.
distinguish between the ECG signals of a healthy person and
patients with the three specific heart diseases from the raw ECG
data. The results showed that the methodological analysis does II. DESIGN STAGES
provide a significant clinical advantage, and matches the doctor’s The diagnostic system designed, is used to calculate the
opinion.
Fractal Dimension, to distinguish between the ECG signal of a
Keywords— Fractal Dimension, PAC, PVC, Atrial Fibrillation, healthy person and patients with three specific heart diseases
Rescaled range, GUI. from a raw ECG data. The diagnostic system consist of two
stages; a preprocessing stage where the noise is removed from
I. INTRODUCTION the ECG signal and a processing stage where the calculation of
the fractal dimension takes place as shown in Fig.1.
An Electrocardiogram (ECG) signal gives significant
information for the cardiologist to detect cardiac diseases [2].
A significant amount of research and development effort has
been devoted on the detection of cardiac disease, but still it
cannot get control on the death rate. In this paper three types of
heart diseases were considered; Premature Ventricular
Contraction (PVC), Premature Atrial Contraction (PAC), and
Atrial Fibrillation. In Premature Ventricular Contraction (PVC)
also known as extra systole, the ventricles fire an early impulse
before the sino atrial (SA) node (the normal heartbeat initiator)
which causes the heart to beat earlier causing irregularity in the
heart rhythm. The electric signal propagates through muscle,
not Purkinje system. QRS duration is prolonged and the shape
Fig. 1. Design Stages of the Diagnostic System
is usually very different from normal. T wave is usually
inverted. In Atrial Fibrillation many sites within the atria fire
electrical impulses in an irregular fashion causing irregular A. ECG Records
heart rhythm, ventricular rate of 100-150 BPM, and irregular The ECG signal used, was taken from three databases:
RR intervals. The Atria do not beat (no coordinated
contraction), which may lead to blood clot formation within

978-1-4673-6232-0/13/$31.00 ©2013 IEEE 336


1. The MIT-BIH Normal Sinus Rhythm Database (18 records) fractus or fraction/ broken. Fractal Dimension is a number
[5]. which is often a non integer that measures the degree of fractal
2. The MIT-BIH arrhythmia Database (18 records of PVC boundary fragmentation or irregularity over multiple scales.
patients, 8 records of PAC patients) [5]. The concept of fractals is that they have a large degree of self
similarity within themselves [4]. A self-similar shape is a
3. The Intracardiac Atrial Fibrillation Database (28 records) shape composed of a basic pattern which is repeated at
[5]. multiple (or infinite) scale. Since, that the ECG signal of a
Lead II is chosen for the whole analysis due to it human heart is a self similar object, then it must have a fractal
representative characteristics for identifying the common heart dimension. To calculate the fractal dimension three processes
beats. Fig.2 Shows the ECG signal of a patient with Premature has to be done; determining the rescaled range, estimating the
Ventricular Contraction (PVC). Hurst Exponent and finally determining the fractal dimension.

1) Rescaled Range Determination


1250

1200

1150
Rescaled range analysis is a statistical method used to
1100 analyze long records of natural phenomena. Two factors are
1050
used in this analysis; the range (R) and the standard deviation
1000
(S) [2]. The ratio R/S is known as the rescaled range, and it is
described by the following empirical relations:
950

[R N / S N] α NH
900

850
0 500 1000 1500 2000 2500 3000 3500 4000
(1)
Log2 [R N/SN] = C + H Log2 (N) (2)
Fig. 2. ECG Signal of a PVC Patient.
where:
B. Preprocessing Stage N: refers to the slot size value,
C: is a constant [2].
Baseline drift is one of the common problems in ECG H: is Hurst Exponent
signal. This type of artifacts must be eliminated because it
affects the whale shape of the ECG signal in order to avoid Fig. 4 shows the procedure for calculating the rescaled range
wrong diagnosis. A Moving Average filter was chosen to (R N/SN) for any time series.
remove this kind of noise. It is a very simple Low Pass FIR
(Finite Impulse Response) filter commonly used for
smoothing and filtering an array of sampled signal. It takes M
samples of input signal at a time and averages those M-
samples to produce a single output point signal [3]. Fig.3
shows the ECG signal before and after removing the baseline
drift.
Input Data
1300

1200
Microvolts

1100

1000

900

800
0 500 1000 1500 2000 2500 3000 3500 4000
Seconds

Subtract Baseline Drift


300

200
Microvolts

100

-100
0 500 1000 1500 2000 2500 3000 3500 4000
Seconds

Fig. 4. Rescaled Range Calculation Procedure.


Fig. 3. The ECG Signal Before and After Baseline Drift Removal.
Where µN is the mean value, SN is the standard deviation, and
C. Processing Stage RN is the adjusted range [4].

The mathematical method used to process the ECG is the 2) Hurst Exponent Estimation
Fractal Dimension. The term fractal was coined from the Latin The Hurst Exponent is the measure of the smoothness of
fractal time series based on the asymptotic behavior of the

337
rescaled range of the process. It is estimated by calculating the The Fractal Dimension (D) is calculated from the Hurst
average rescaled range over multiple regions of the data [2]. exponent (H) using the relation:
To estimate the Hurst Exponent from the rescaled range the D=2-H 0≤H≤1 (3)
following steps are applied;

a. The rescaled range (R/S) is calculated at each point in


time, for a time series over a total duration N using the
procedure mention in Fig. 4.
b. The total duration N is divided into two segments each
N/2. The Rescaled Range (R/S) of each segment is
calculated and then the average (R/S) of both segments
(R/S Ave) is evaluated. The entire process is repeated for
successively smaller intervals over the data set, dividing
each segment obtained in each step into two and
calculating R/S for each segment and evaluating the
average (R/S). At 32 points the subdivision stops, since
the regions get too small [2]. Fig.5 shows the average
rescaled range over multiple regions of data.

Fig. 6. Fitted Straight Line by Log-Log Plot.


Fig. 7.
Fig.6 shows that the calculated slope is 0.5927, so the Hurst
Exponent H=0.5927. The Fractal Dimension (D) is simply
D = 2-H = 1.4073.
The preprocessing and processing stages applied to the ECG
signal in Fig.1 (patient with Premature Ventricular
Contraction (PVC)) were applied to all the records in the three
databases. Table II shows the distinct range of the Fractal
Dimension obtained from all three databases.
TABLE II. DISTINCT RANGE OF FRACTAL DIMENSION FOR SAMPLE ECG
SIGNAL.
Sample ECG signal Range
Healthy Person 1.73 – 1.81
Patients with PAC 1.49 – 1.69
Fig. 5. Average Rescaled Range over Multiple Regions of Data [2]. Patients with PVC 1.34 – 1.44
Table I. shows the calculated average rescale range of the Patients with Atrial Fibrillation 1.11 – 1. 30
ECG signal in Fig.3 (patient with Premature Ventricular
Contraction (PVC)) over multiple regions of the data. III. ECG GRAPHICAL USER INTERFACE DESIGN
A Graphical User Interface (GUI) was designed using
TABLE I. AVERAGE RESCALED RANGE OF ECG SIGNAL OVER
MULTIPLE REGIONS OF DATA MATLAB, to load an ECG signal and test if it is for a healthy,
Slot Size, N Log (N) Log (R/S) PVC, PAC, or Atrial Fibrillation patient by calculating it‘s
2 2
Fractal Dimension
1024 10 6.6027
512 9 6.3117
256 8 6.0875
128 7 5.5916
64 6 4.6247
32 5 3.5648

To estimate the Hurst exponent the values of log2(R/S) are


plotted versus log2 (N). The slope of the best fitting line gives
the estimation of the Hurst exponent (H) [2]. This is done
through an ordinary least squares regression procedure where
a line is plotted through a cloud of points, and both constant
coefficients C and H are calculated for the following line
equation
Log2 [R N/SN] = C + H Log2 (N)
Fig.6 shows the slope plotted using the values in Table I Fig. 8. Designed GUI for ECG Signal Analysis.
1) Fractal Dimension Determination The GUI allows the user to load an ECG signal from any
file by pressing the “Load Signal” button; the loaded signal is

338
then plotted in the lower empty axis, where it is compared
with the normal ECG Signal. By pressing the “Calc Fractal
Dimension” button, the value of the fractal dimension is
calculated and compared with Table II. The diagnosis of the
patient’s condition would then be displayed.

II. RESULTS AND DISCUSSION


After designing the GUI, four different scenarios were
carried out to diagnose patients with the different heart
diseases mentioned.

SCENARIO 1: ECG SIGNAL OF A PATIENT WITH PVC


The signal was loaded by selecting it from the MIT-BIH
Arrhythmia Database file. As an example file 106 was Fig. 11. Signal of a Patient with PAC.
selected as shown in Fig. 8.

Fig. 12. Signal of a Patient with Atrial Fibrillation.


Fig. 9. Selected Signal File From MIT-BIH Arrhythmia Database. SCENARIO 4: ECG SIGNAL OF A HEALTHY PERSON
After the signal was loaded, the Fractal Dimension is
calculated by pressing the “Calc Fractal Dimension” button Fig. 12 shows the fractal dimension and the diagnosis
and the value of the Fractal Dimension is calculated and the when an ECG signal of a healthy patient was loaded into the
diagnosis appear as shown in Fig. 9. GUI

Fig. 13. Signal of a Healthy Person.


Fig. 10. Signal of a Patient with PVC. Fig. 14.
SCENARIO 2: ECG SIGNAL OF A PATIENT WITH PAC V. CONCLUSION
In this paper the fractal dimension method is used to detect
Fig. 10 shows the fractal dimension and the diagnosis when the heart diseases. ECG signal of the heart being a self-similar
an ECG signal of a patient with PAC was loaded into the GUI object; can well be considered for fractal analysis. Fractal
SCENARIO 3: ECG SIGNAL OF A PATIENT WITH ATRIAL Dimension method was used to analyze three specific heart
FIBRILLATION diseases PAC, PVC, and Atrial Fibrillation.
In this scenario an ECG signal of a patient with Atrial ECG signals used were taken from three databases. The
Fibrillation was loaded into the GUI. Fig. 11 shows the rescaled range method was used to determine the specific
diagnosis. range of fractal dimension for each disease. The obtained

339
range of fractal dimension for a healthy person was 1.73–1.81,
for PVC patients was 1.34–1.44, for PAC patients was 1.49–
1.69 and for Atrial Fibrillation patients was 1.11–1.30. A
Graphical User Interface (GUI) was designed using MATLAB
to help in diagnosing the ECG signal by calculating its Fractal
Dimension. The results showed that the Fraction Dimension
performs well in classifying the different ECG signals.

REFERENCES
[1] Jennifer Lynn Kowalak, Carol Turkington, “ECG Interpretation”,
Lippincott Manual of Nursing Practice Series, Lippincott
Williams & Wilkins, 150-200, 2007.
[2] Malhar Kale & Ferry Butar Butar, “Fractal Analysis of Time
Series and Distribution Properties of Hurst Exponent”, Journal of
Mathematical Sciences & Mathematics Education, Vol. 5, No. 1,
2011.
[3] L. Sornmo, “Time-varying Filtering For Removal of Baseline
Wander in Exercise ECGs”, in Proc. Conf. Computers in
Cardiology, pp. 145-148,1991.
[4] “Fractals and Fractal Dimension”,
http://www.vanderbilt.edu/AnS/psychology/cogsci/chaos/worksh
op/Fractals.html
[5] Goldberger, et al., 2000, “PhysioBank, PhysioToolkit, and
PhysioNet: Components of a New Research Resource for
Complex Physiologic Signals”. Circulation 101(23): pp e215-
e220 [Circulation Electronic Pages;
http://circ.ahajournals.org/cgi/content/full/101/23/e215].

340

You might also like