Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

5th IEEE International Conference on Parallel, Distributed and Grid Computing(PDGC-2018), 20-22 Dec, 2018, Solan, India

MATLAB BASED GUI FOR ECG


ARRHYTHMIA DETECTION USING PAN-
TOMPKIN ALGORITHM
Bhawna Jindal Saudagar
Electronics and communication Electronics and communication
engineering engineering
A.P, JMIT UIET, KUK
Radur, Haryana Kurukshetra, Haryana
bhawnajindal02@gmail.com saudagar97@gmail.com

Ekta Reeta Devi


Electronics and communication Electronics and communication
engineering engineering
AP, UIET AP, UIET
Kurukshetra, Haryana Kurukshetra, Haryana
ekta.tamak@gmail.com reetakuk@gmail.com

Abstract—The purpose of paper is to detect heart • ST segment


arrhythmia which is generated due to irregular heart rhythm. • Arrhythmia Abnormalities.
The heart problem of a person can be noticed by examining the
ECG (Electrocardiogram) signal and withdrawing the various Above mentioned parameters are useful for detecting
features of the ECG signal like RR interval, width of QRS
various heart diseases like Sinus tachycardia, Sinus
complex, P wave, R wave and heart rate. Data for
electrocardiogram signal occupied from MIT-BIH arrhythmia bradycardia, First degree heart block, incomplete bundle
database. Graphical user interface (GUI) has been developed branch block and Ventricular tachycardia etc. A person said
for the detection of arrhythmia using Pan-Tompkins to be abnormal if there is any fluctuation in the morphology
algorithm. Modification has been done in the Pan-Tompkins of the EKG signal and these abnormalities can be identified
algorithm for the detection of abnormalities related to heart by by extracting features of the electrocardiogram signal. EKG
calculating various parameters. This toolbox is developed in signal taken out from MIT-BIH database of arrhythmia and
MATLAB software. Developed GUI is an efficient and effective
way to diagnose heart diseases
time domain analysis performed on it and results has been
demonstrated on the developed GUI. Graphical user
Keywords— ECG(Electrocardiogram), Arrhythmia, Pan- interface is developed in MATLAB software for research
Tompkin, GUI purpose not for clinical diagnosis purposes. It abate a user to
control entire system operation [3]. Electrocardiogram
I. INTRODUCTION
signal processed using Pan-Tompkins algorithm which is
ECG is abbreviated as Electrocardiogram and also known as given by Jiapu pan and Willis J. Tompkins in 1985[4] which
EKG signal. Graphical illustration of electrical activity of is not obsolete for detection of cardiac arrhythmia. So
the heart termed as ECG. The process of measuring the modification has been done in Pan-Tompkins algorithm for
ECG signal by placing electrodes over the human body is arrhythmia diagnosis purpose and a toolbox created.
known as Electrocardiography and the machine used is Developed toolbox represents heart rate, QRS width, Root
Electrocardiograph. ECG signal is generated by the mean square of successive difference of R peaks and
depolarization and repolarization of atrial and ventricle of standard deviation by extracting RR interval from ECG
the heart [1]. Cardiovascular diseases (CVD) are one of morphology. Heart rate variability interpretation can be
main reason of death in whole world as stated by world executed on EKG recording.
health organization (WHO). CVD problem occurs due to
A. ECG Descriptions
variation in normal heart cycle [2]. From ECG signal
following information can be extracted: Heart Anatomy. Human heart consists of four chambers
i.e. left and right atria, right and left ventricle. A tiny mass
• RR interval of the functional tissue exist in the atria known as sinoatrial
• PR interval node (SA node), produce an electrical stimulus which
• The heart rate activates the atria and leads to its depolarization and
• QRS width repolarization. Electrical stimulus reaches the
• QT interval atrioventricular (AV node) node and activates the ventricles.
• R wave Due to depolarization and repolarization of atrium and
• P wave

978-1-5386-6026-3/18/$31©2018 IEEE 754


5th IEEE International Conference on Parallel, Distributed and Grid Computing(PDGC-2018), 20-22 Dec, 2018, Solan, India

ventricle, ECG signal generated. Positive cations i.e. Na⁺ R-Wave. It is a maximum amplitude wave in QRS
and Ca⁺⁺causes depolarization and repolarization [1]. complex. Crest of the R wave is the conventional point
of the cardiac cycle which leads heart period.
U-Wave. Generated due to electrical activity in papillary
muscles.
R-R interval. Difference between two successive R peaks is
known as R-R interval. Its duration is 0.6 to 1.2sec [1]. Also
named as Inter-beat- interval, cardiac cycle spans which
entitled as heart period.
B. ECG Database
Testing of the arrhythmia detection algorithm has been done
from MIT-BIH database of arrhythmia. Database is taken
from ATM bank of physionet website which is acquired
Fig. 1. Human heart[5] from arrhythmia laboratory of Boston's Beth Israel hospital
(BIH). Database comprises the 48 signals. The signals
which we use are single lead signals. The duration of these
ECG Morphology. ECG signal comprises of six signals are 10sec which means 3600 samples. Signal
waves i.e. P-Wave, Q-Wave, R-Wave, S-Wave, T-Wave presented in digital format having 360Hz sampling
and U-Wave and their intervals. Most of the useful frequency, 10mv range and complete annotations of the
information regarding heart is available in the QRS signals are provided at the physionet website.
complexes which is point of interest. The frequency of Approximately 60% of the data were occupied from
EKG signal ranges between 0.10-150 Hertz and voltage inpatients. In this database, quality of signal fluctuates with
measured over the human body by electrode are of order scribbled data in atleast one lead [6].
of hundreds of microvolt to 1 millivolt [1]. General
waveform of ECG signal is shown in figure below:
C. Arrhythmias

Due to the irregular heart rhythm arrhythmia arises which


causes change in heart wave. It is also called as dysrhythmia
[6]. Pumping of blood in heart gets affected due to cardiac
arrhythmia, so it is necessary to detect and analysis various
arrhythmias by performing time domain analysis. Detection
of heart diseases can be done by reckoning the heartrate, RR
interval, R-wave, P-wave and QRS width. Heart rate is
computed by using formula:
Heart Rate = 60/(RR interval) bpm

Some arrhythmia which is computed and detected in this


paper includes Sinus Tachycardia, Bundle branch block,
Sinus Bradycardia, incomplete bundle branch block, Right
Fig. 2. ECG Waveform[1] bundle branch block, Ventricular Tachycardia. Sinus
Tachycardia arises when heart rate is more than 100 bpm
P-Wave. Generated due to depolarization of atria. The and Sinus bradycardia arises when heart rate is less than 60
duration of P-wave is less than 80ms[1].Right atrium is bpm (beats per minute) [11]. Ventricular tachycardia occurs
depolarized firstly then the left atrium is depolarized. when heart rate lies in the range 102 to 250 bpm and QRS
Due to depolarization, an electrical vector generated width greater than 0.12 sec. Bundle branch block occurs due
from atrium which is slightly downward and leftward. to variation in QRS width from its normal range.
PR Interval. Evaluated from beginning of P-wave to the Arrhythmias are computed by heart rate, R-peaks and QRS
starting of QRS complex and ranges from 120 to 200ms width where time domain parameters like SDSD, RMSSD
[1]. added for analysis purpose not for arrhythmia detection.
QRS Complex. It shows the depolarization of left and
right ventricles. Mass of ventricles exceeds the mass of
atria. In QRS complex R-wave has maximum amplitude.
The width of the QRS complex varies from 80 to 100ms II. PAN-TOMPKINS ALGORITHM
[5]. This algorithm was given by Jiapu pan and Willis J.
ST-Segment. It establish a connection between QRS Tompkins in 1985. QRS complex detected by digital study
complex and T wave. of amplitude, width and slope of EKG signal which include
T-Wave. Generated due to repolarization of ventricles. 3 stages:
Its duration is 160ms.
1. Digital filtering linearly.

978-1-5386-6026-3/18/$31©2018 IEEE 755


5th IEEE International Conference on Parallel, Distributed and Grid Computing(PDGC-2018), 20-22 Dec, 2018, Solan, India

2. Non-linear conversion. Fig. 3. Flowchart of proposed algorithm


3. Algorithm for decision making.
As depicted in above flowchart, EKG signal is obtained
Linear process constitutes bandpass filter, moving window from MIT-BIH Arrhythmia database. Electrocardiogram
integrator and derivative. Non-linear conversions perform signal suffered with different type of noise like baseline
by squaring the amplitude of signal. Adaptive thresholding wander, electrode contact noise, power line interference,
and discrimination of T-wave technique are the part of the instrument noise etc. To overcome the effect of noise,
decision rule algorithm. Detection sensitivity escalates due initially signal is passed through bandpass filter whose
to low thresholding after filtering. Dual threshold technique passband range is from 5 to 15 Hz. Low pass and high pass
used to find lost heart beats and condense the false negative filter in cascaded form can also be used in place of bandpass
beats. These thresholds applied on the output of filter and filter. EKG signal is bandpass filtered which eliminates the
moving window integrator [4]. unwanted frequency and gives anticipated range of
frequencies. Lower cut-off frequency must be preferred to
A. Modified Pan-tompkins Algorithm decrease the impact of P and T wave large amplitude and
Pan-Tompkins algorithm does not provide information need upper cut-off frequency to overpower motion artifacts
about arrhythmia of abnormal person, so that in this paper but not fine QRS complexes. Derivative algorithm is applied
some modification in Pan-Tompkins has been done for on ECG signal which offers slope information and amplifies
arrhythmia diagnosis. After the detection of QRS complex, the adverse noise components. Squaring function
R and P-wave, R-R interval and QRS width has been strengthens the slope of the curve acquired from derivative
observed. With the help of R-R intervals we can calculate and limits the false positive peaks due to T- waves. Energy,
heart rate and time domain analysis also performed. A width and amplitude of the QRS complex must be taken out
graphical user interface (GUI) developed for the modified from EKG signal to attain consistent performance which can
arrhythmia detection algorithm which gives a convenient be estimated from integrator. Detection of peaks completed
platform to user for analyzing the ECG signal with its after thresholding which can be automatically adjusted to
adapt changes in the morphology of EKG and heart rate.
extracted features and various abnormalities of patients. The
After the peak detection intervals like PR intervals, ST
block diagram of modified algorithm is illustrated as:
intervals, inter beat interval, QRS width can be computed.
On the basis of calculations various arrhythmias can be
detected. Adaptive thresholding is used in decision making
to decide either it is a QRS complex or not and after that P,
R, Q, S waves detected. Based on these waves R-R interval
has been calculated. On the basis of R-R interval, heart rate
determined. By checking the duration of waves, intervals,
heart rate several arrhythmia detected and time domain
analysis performed which gives results like SDSD (Standard
deviation of successive difference), RMSSD (Root mean
square of successive difference) etc. MATLAB
implementation of Pan-Tompkins algorithm taken from
author Hooman Sedghamiz, Copyright march 2014.

(a)

(b)

978-1-5386-6026-3/18/$31©2018 IEEE 756


5th IEEE International Conference on Parallel, Distributed and Grid Computing(PDGC-2018), 20-22 Dec, 2018, Solan, India

(h)

Fig. 3. Processing of ECG signal from MIT-BIH database: (a) Original


(c) ECG Signal (b) Bandpass filtered signal (c) After derivative filter (d)
Squared Signal (e) MVI Signal (black circles show R peaks, magenta
shows noise, green shows signal level, red shows threshold) (f) QRS of
Filtered Signal (g) QRS on MVI signal (h) Pulse train of QRS complex[4].

HRV (heart rate variability) is a useful tool for study of


EKG in both clinical and research purpose. HRV is outcome
of ANS (autonomic nervous system) directive of the
sinoatrial (SA) node [12]. HRV investigation can be
performed in two ways: the spectral domain and the time
(d) domain. Heart rate variability offers non-invasive method to
evaluate the neuronal effects on cardio-regulatory function.
As demarcated HRV are variations of inter-beat intervals.
Due to interface between parasympathetic and sympathetic
activities a non-linear feedback control system generated
which is caused by HRV fluctuations. Time domain features
result from simple arithmetical calculations. Mostly mean
and variance of RR interval analyzed in time domain.
Frequency (spectral) domain includes decomposition of
series of continuous inter-beat interval into its numerous
(e)
frequency constituents and enumerates them in terms of
power. Spectral points of power spectrum depict amplitude
of heart rate variations offered at different oscillation
frequency. Main clinical states where HRV has been found
valuable in danger of sudden cardiac death after acute
myocardial infarction. HRV usually established to provide
an initial cautionary sign of diabetic neuropathy [12]. The
RMSSD is associated to the high-frequency (HF) energy
ranges from 0.15 Hz to 0.4 Hz. Lower RMSSD values
interrelated with high risk of sudden mysterious death in
epilepsy. The SDRR measures how these intervals vary over
(f) time and is more precise when considered over 24 h because
this longer duration better signifies slower processes [18].

III. DEVELOPMENT OF GUI


GUI stands for Graphical user interface. It is an interface
between human and computer which uses icons, windows
and menus which can be influenced by a click of mouse.
The various advantages of GUI includes simplicity,
consistency, Familiarity. With the help of GUI simulation of
(g) engineering models becomes easier. Instead of running the
whole program in command prompt, it is convenient to
change a single variable in toolbox [3].

978-1-5386-6026-3/18/$31©2018 IEEE 757


5th IEEE International Conference on Parallel, Distributed and Grid Computing(PDGC-2018), 20-22 Dec, 2018, Solan, India

Fig. 5. Developed GUI Fig. 6. Load and plot of ECG Signal

Figure 5 represents a graphical user interface which is


developed in MATLAB and following points explain about
this toolbox:
1. Download ECG signals from Physionet and load the
same in the GUI by clicking on OK button.
2. By clicking on show plot button we can saw the plot of
the QRS complex.
3. We can also observe P and R peaks of ECG signal in the
detect peak block. Fig. 7. Detected QRS complex
4. Parameter calculations are also performed like SDSD,
RMSSD, Avg RR interval, Heart rate and QRS width.
5. With the help of these parameters, type of arrhythmia
detected by clicking on diagnose button.
Design and implementation of GUI includes task defining,
drawing the GUI, then testing the design, code writing for
the same and finally testing code [3].

IV. DISCUSSION & RESULTS

A graphical user interface for arrhythmia detection is


developed. Various ECG signals like 100, 101, 102, 107 etc
are tested on this toolbox with their waves like P, R wave ,
QRS complex and their durations are calculated. With the
help of time domain parameters like RMSSD, SDSD, Avg
RR interval (IBI) and QRS width one can easily diagnose Fig. 8. P wave of ECG (shown by circles)
cardiac problems. Output of various blocks of proposed
algorithm can also be viewed by clicking on the pop-up
push button which is named as show plot in this toolbox.
Peaks of P wave and R wave can be observed seperately by
radio buttons as shown in toolbox. Algorithm works healthy
for signal which is infected with noise. Results of the
proposed algorithm illustrated as:

Fig. 9. R wave of ECG (shown by circles)

978-1-5386-6026-3/18/$31©2018 IEEE 758


5th IEEE International Conference on Parallel, Distributed and Grid Computing(PDGC-2018), 20-22 Dec, 2018, Solan, India

[9] Umer M, Bhatti B, Tariq M et al.,


"Electrocardiogram Feature Extraction and Pattern
Recognition Using a Novel Windowing Algorithm",
Advances in Bioscience and Biotechnology 05:886-
894. doi: 10.4236/abb.2014.511103 2014.
[10] R. Gupta, J. N. Bera, and M. Mitra, “Development of an
embedded system and MATLAB-based GUI for online
acquisition and analysis of ECG signal,” Meas. J. Int. Meas.
Confed., vol. 43, no. 9, pp. 1119–1126, 2010.

[11] http://www.physionet.org

[12] M. P. Tarvainen, J. P. Niskanen, J. A. Lipponen, P. O. Ranta-


aho, and P. A. Karjalainen, “Kubios HRV -Heart rate variability
Fig. 10. Detected Arrhythmias analysis software,” Comput. Methods Programs Biomed., vol.
113, no. 1, pp. 210–220, 2014.
Figure 6 shows the loading and plotting of the ECG signal,
figure 7 represent the detection of QRS complex and figure 8 [13] Y.Ogundepo O, A. Ponnle A, "Development of a
illustrates the P wave, figure 9 displays the R wave, figure 10 Computer-Aided Application for Analyzing ECG Signals
represents type of detected arrhythmia. and Detection of Cardiac Arrhythmia Using Back
Propagation Neural Network - Part II: GUI
Development.", International Journal of Applied
Information Systems 9:26-36. doi: 10.5120/ijais15-
CONCLUSION & FUTURE SCOPE 451379 2015.
In this article we build an efficient, effective and flexible
[14] P. K. Priya and G. U. Reddy, “MATLAB Based GUI for
toolbox using MATLAB which conclude that detection of
Arrhythmia Detection Using Wavelet Transform.,” Int. J. Adv.
QRS complex, R-peak, P-peak with time domain analysis of
Res. Electr. Electron. Instrum. Eng., vol. 4, no. 2, pp. 807–816,
parameters and type of arrhythmia is efficient and easy to
observe in single window screen. Our toolbox can be 2015.
extended further to detect more arrhythmias and false peak
detection can be reduced by using better noise removal [15] Sharma N, Singh Sidhu J," Removal of Noise From ECG
techniques. Developed software can be stretched for clinical Signal Using Adaptive Filtering", Indian Journal of
use. Frequency domain analysis can also be performed. Science and Technology. doi:
10.17485/ijst/2016/v9i48/106424 2015.

[16] R. Rodríguez, A. Mexicano, J. Bila, S. Cervantes, and R. Ponce,


REFERENCES “Feature extraction of electrocardiogram signals by applying
adaptive threshold and principal component analysis,” J. Appl.
Res. Technol., vol. 13, no. 2, pp. 261–269, 2015.

[1] M.Tomar, Anand Kumar Joshi, Arun Tomar, “A Review Paper [17] S. Sahoo, P. Biswal, T. Das, and S. Sabut, “De-noising of ECG
on Analysis of Electrocardiograph ( ECG ) Signal for the Signal and QRS Detection Using Hilbert Transform and
Detection of Arrhythmia Abnormalities,” Int. J. Adv. Res. Electr. Adaptive Thresholding,” Procedia Technol., vol. 25, no.
Electron. Instrum. Eng., vol. 3, no. 10, pp. 12466–12475, 2014. Raerest, pp. 68–75, 2016.

[2] S. Jain, M. K. Ahirwal, A. Kumar, V. Bajaj, and G. K. Singh, [18] Shaffer F, Ginsberg J, "An Overview of Heart Rate
“QRS detection using adaptive filters: A comparative study,” ISA
Trans., vol. 66, pp. 362–375, 2017. Variability Metrics and Norms." Frontiers in Public
Health. doi: 10.3389/fpubh.2017.00258 2017.
[3] M. Zahedi et al., “MATLAB,” Water, vol. 6th, no. 11, pp. 1–14,
2008. [19] Thalange A, Mergu R," HRV Analysis of Arrhythmias Using
[4] J. Pan and J. Willis, “A Real-Time QRS Detection Algorithm,” Linear - Nonlinear Parameters." International Journal of
IEEE Trans. Biomed. Eng., vol. BME-32, no. 3, pp. 230–236, Computer Applications 1:75-80. doi: 10.5120/255-412 2010.
1985. [20] S. Rekik and N. Ellouze, “Enhanced and Optimal Algorithm for
QRS Detection,” Irbm, vol. 38, no. 1, pp. 56–61, 2017.
[5] Jones S ECG notes 2005.
[6] Moody G, Mark R “The impact of the MIT-BIH Arrhythmia
Database,” IEEE Engineering in Medicine and Biology
Magazine., 20:45-50. doi: 10.1109/51.932724 2001.

[7] RakibulIslam M, Hossain R, Ziaul Haque Bhuiyan “Arrhythmia


Detection Technique using basic ECG Parameters.” International
Journal of Computer Applications., 119:11-15. doi:
10.5120/21102-3819 2015 .

[8] H. AL-Ziarjawey, “Heart Rate Monitoring and PQRST Detection


Based on Graphical User Interface with Matlab,” Int. J. Inf.
Electron. Eng., vol. 5, no. 4, pp. 311–316, 2015.

978-1-5386-6026-3/18/$31©2018 IEEE 759

You might also like