Dipjyoti the contraction and relaxation of the atria

Dipjyoti Bisharad1,Debakshi Dey1, Brinda Bhowmick1 1 NationalInstitute of Technology Silchar, Silchar – 788010, Assam, India{dipjyotibisharad.nit, deydebakshi16, brindabhowmick}@gmail.comAbstract.

Electrocardiography (ECG or EKG) is a largely used methodto establish human heart condition and determine if there is any anomaly incardiac behavior. There are several cardiac events in patients with high riskswhich require prompt detection. For this, physicians take help of computer systemsto analyze ECG. One of the initial phases of computerized inspection of ECGsignals is to minutely segment an ECG signal, which is to site the exact onsetand offset locations of P and T waves respectively which mark the beginning andend of one cardiac cycle.

In this paper, we put forward a fast technique thatis able to accurately identify the P and T waves using local windows around Rpeaks and thus can segment an ECG cycle from a larger ECG record. The proposedmethod has been tested on standard QT database and high accuracies of more than99% and 97% are achieved on detecting P waves and T waves respectively.Keywords: electrocardiogram,pattern recognition, ECG features, ECG delineation.1   IntroductionAn ECG signal arises from theelectrical activity of the heart that synchronizes the contraction andrelaxation of the atria and ventricles of the heart. The analysis of ECG signalcan be used to identify various abnormal electrical activities of heart.

And thedetection of the characteristic points of ECG signal also help in diagnosis ofcardiac diseases. One cardiac cycle in a ECG signal comprises P, QRS and T wavecomplexes.ECG analysis is aquite mature field in today’s scenario. Lots of work have been performed tilldate for determining characteristic points in ECG signals. But most of theseare computationally expensive because of using complex signal processingtechniques.

Best services for writing your paper according to Trustpilot

Premium Partner
From $18.00 per page
4,8 / 5
Writers Experience
Recommended Service
From $13.90 per page
4,6 / 5
Writers Experience
From $20.00 per page
4,5 / 5
Writers Experience
* All Partners were chosen among 50+ writing services by our Customer Satisfaction Team

In 11, the Pan Tompkins proposed a method which recognizes theQRS complexes using the information on the signal’s slope, amplitude and width.12 uses wavelet transform method to detect all the P, QRS and T complexes butwhen noise influences seriously, the detection of P and T onsets and offsets isnot much accurate. Hidden Markov Model is used to detect P wave along with QRScomplex in 13.

In 14, P and T waves detection is based on length transformationtechnique. We see detection of P and T wave peaks implemented on Xilinx fpgabased on slope detection in 15. A new and fast version of ECG delineationalgorithm is introduced in 16 which is using line fitting but is not robustagainst certain arrhythmias where no wave is detected. 17 uses Support VectorMachine to detect P and T waves. In 18 the QRS complexes have been clusteredinto different groups using self-organizing neural networks for detection.

Thealgorithm proposed in 19 for P and T waves detection and delineation is based on digital fractionalorder differentiation. 20 shows detection of wave boundaries inmulti-lead ecg signals giving better performance for measurements of T wavesthan the other characteristic waveforms. However, asevident from the literature, much of the work has been concentrated on QRSsegmentation and only few reported works concentrate on identifying P and Twaves. In our paper, we aim towards segmenting an ECG cycle by detecting the Pand T complexes in a reliable and robust way using local windowing.

Theproposed method gives a very high detection accuracy and has O(n) computational complexity withrespect to length of the ECG signal.This paper is organized as follows. In section 2, we present a shortdiscussion on the composition of ECG signal and its characteristic waveforms,Section 3 describes briefly the dataset that has been used to evaluate theproposed method.

In section 4, we discuss the methodologies and algorithmsimplemented in this work. The results that the evaluation has yielded are shownin section 5. We finally conclude the paper in section 6.2   Review ofthe Structure of ECG SignalThe different chambers of heart during oneheartbeat in a human being undergo  depolarizationand repolarization which generate electrical signals. The magnitude anddirection of these electrical events are captured by the ECG. During onecardiac cycle, an electrical event takes place which is indicated by one of themultiple waveforms contained in the components of a normal ECG tracing. The ECGsignal begins with a short and upward P wave which indicates atrialdepolarization. The QRS complex follows it which signifies ventricularrepolarization.

After this, the T wave is observed which is usually a smallupward waveform but it may be inverted in some cases 3. Each of these waveshas a characteristic duration. The P wave lasts for about 80 ms. One ST-segmentduration varies from 80 ms to 120 ms. Duration of one ST-Interval is 320 ms4.  Fig.1. Schematic diagramof single ECG wave.

{src: http://www.rn.org/courses/} 3   Descriptionof DatasetThere are many datasets available for thestudy and analysis of ECG data. We use the QT database in this paper containing105 records, with each record for 15 minutes duration5, the sampling frequencyof all the records being 250 Hz. This database has been created by integratingnew data from Holter recordings of patients into the MIT-BIH ArrhythmiaDatabase, theEuropean Society of Cardiology ST-T Database and a number of other databases6-7.

Moreover, we can compare our obtainedresults with the P and T complexes annotated in this QT database.4   MethodologyIt is quite evident from the review ofECG signal that the P and T have distinct physical characteristics. Also if Rpeak is known, then these two points can be identified from its neighborhoodwith fair accuracy. For instance, P peak can be approximated as the local maximabetween the R peak of the corresponding wave and T peak of the previous wave.  4.1   Preprocessing the signals The digitized ECG data from thedatabase is filtered with a bandpass FIR filter with lower and upper cutofffrequency of 3 Hz and 45 Hz respectively to remove noises originating due toelectromyogram (EMG) signals, high frequency interferences, DC offset andbaseline wandering 8.

From the filtered signal, the R peak is extracted usingthe R segmentation algorithm proposed by Hamilton in 9. 4.2   Detection of the peak of P wave The next step after locating R peaks isto locate P peaks. Since P peak can be approximated as the local maxima betweenT peak of the previous waveform and R peak of the present waveform. But as theregion between T and R peaks is quite extended, can be noisy and can have multiplepeaks and troughs, so it can lead to increased false positives if we considerthis entire region.

Hence, we choose a reduced context window of 100 msduration which is offset from R peak by 100 ms on the left  as shown in Fig 2. The peak of P wave istaken as maximum of the values in the context window.                                Fig. 2. The points A and B indicate the beginning and end of the context window respectively for the detection of P peak; A and B are 100 ms apart; Point B is 100 ms offset from R.

4.3   Detection of the peak of T waveIt is more difficult to accuratelydetect T wave than detetcing QRS complex. This is due to low signal-to-noiseratio (SNR), low amplitudes, variation in morphology and amplitude and probableoverlapping of P and T waves 10. Thus the initially filtered signal is againpassed through a 2nd order butterworth filter having lower and upper cutofffrequency of 0.5 Hz and 25 Hz. As already mentioned before in section 2, T wavemay be inverted in certain cases. Hence, within the context window, the T peakcan be either the maxima or minima, depending on which one has the maximumabsolute magnitude.

To eliminate this uncertainty, all the values within thewindow are squared. Thus T peak will necessarily be at the location of thevalue having maximum squared magnitude. However, there is a glitch. In casethere is an inverted T peak, the voltage level at the peak might lie below 0 V,and possibly in between 0 mV and -1 mV.

In that case, squaring a value between0 and 1 will, in turn, reduce its magnitude. Thus a threshold of 1mV is addedto all the values before squaring them.T peaks occur fairly long after QRS wave and may be present inan extended region. Thus the size of context window is increased to 200 msduration and is offset to the right by 200 ms from the position of R peak.

Fig.5 shows the window boundaries A and B for locating T peak. Fig. 3. The points A and B indicate the beginning and end of the context window respectively for the detection of T peak; A and B are 200 ms apart; Point A is 200 ms offset from R.

  5   Results andDiscussionsIn this section we present aquantitative evaluation of our model. By applying the methods described insection 4, we annotate all the 105 records in QT database and compare ourannotations with the annotations given in the dataset. There are a total of 9annotation files contained in the dataset. To evaluate our proposed method, wechose two of the annotation files from the dataset. The first one is .pu0 annotation which contains waveformboundary measurements which are automatically determined for all beats. Thesecond set of annotation files considered is .q1c annotation which contains manually determined waveformboundary measurements for a small fraction of beats.

We compared our resultsagainst reference annotations allowing for a 5% tolerance level; that is, aprediction is deemed correct if its value falls within a range of ±5% of thereference value. Table 1. Evaluation results.

Wave Annotation Total number of correct predictions Total number of incorrect predictions Overall Accuracy Median Accuracy P .pu0 88652 88 0.9990 1.0 .

q1c 2724 189 0.935 1.0 T .pu0 73133 2093 0.9721 1.0 .

q1c 2323 1040 0.6908 1.0  As an evaluation metric, for each P and T, we list the totalnumber of correct predictions, total number of incorrect predictions, overallaccuracy and median accuracy across 105 records achieved by our proposed methodfor respective peaks and troughs.The results are extremelyimpressive. We obtain 100% median accuracy on 105 records for all the wavesacross both the reference annotations. We also obtain very staggering overallaccuracy on .pu0 annotations.

However the accuracy for .q1c is not as good asthat for .pu0. However manual inspection of .q1c annotations showed that someannotations were fairly deviated from where they ought to be. We think thatsmall sample size of .q1c annotations accompanied with inaccurate annotationsmight have affected the statistics that resulted in lower accuracy.It is also observed from Table 1.

that the overall accuracy for T peak detection is lower than the P peak. It hasbeen pointed out that detecting T peaks is in fact a non trivial task. Theapproximation used to detect boundaries of T wave in this proposed method worksefficiently for normal ECG signal but may give inaccurate results for certainkinds of abnormal ECG signals. We acknowledge this as a limitation of ourproposed method.

6   ConclusionIn this work, we demonstrated a robustand fast method to segment ECG signals by detecting the peak of P and T waves.The knowledge of P and T waves automatically gives an approximate boundary ofan ECG cycle. The algorithm runs in linear time with respect to size of ECGinput data because the algorithm is essentially finding maximum or minimumvalue within an array of numbers. The method is highly accurate, particularlyfor normal ECG signals.  AcknowledgmentsThe authors would like to thankInnovation & Entrepreneurship Development Centre, NIT Silchar for fundingthis project. The authors are also grateful to Mr.

Arkajyoti Saha and Ms.Maitrayee Deb of Silchar Medical College and Hospital for their valuable inputsand suggestions.References1 Baldonado, M., Chang, C.

-C.K., Gravano, L.,Paepcke, A.: The Stanford Digital Library Metadata Architecture. Int.

J. Digit.Libr. 1 (1997) 108–1212 di Bernardo, D.

and Murray, A., 2002. Origin on theelectrocardiogram of U-waves and abnormal U-wave inversion.

 Cardiovascularresearch, 53(1), pp.202-208.3 Hoffman, B.

F. and Cranefield, P.F.

,1960. Electrophysiology of the Heart.McGraw-Hill, Blakiston Division.4 Joshi, Anand Kumar, ArunTomar, and MangeshTomar.”A Review Paper on Analysis of Electrocardiograph (ECG) Signal for the Detectionof Arrhythmia Abnormalities.” International Journal of AdvancedResearch in Electrical, Electronics and Instrumentation Engineering 3, no.

10 (2014).5 Laguna P, Mark RG, Goldberger AL, Moody GB. A Database for Evaluation of Algorithms for Measurement of QT and OtherWaveform Intervals in the ECG.

Computers in Cardiology24:673-676 (1997)6 Moody GB, Mark RG. The impact of the MIT-BIHArrhythmia Database. IEEE Eng in Med andBiol 20(3):45-50 (May-June 2001). (PMID: 11446209)7 Taddei A, Distante G, Emdin M, Pisani P, Moody GB,Zeelenberg C, Marchesi C. The European ST-T Database: standard for evaluatingsystems for the analysis of ST-T changes in ambulatory electrocardiography.

European Heart Journal13: 1164-1172 (1992)8  Thakor,Nitish V., and Y-S. Zhu.

“Applications of adaptive filtering to ECGanalysis: noise cancellation and arrhythmia detection.” IEEE transactions on biomedical engineering 38.8(1991): 785-794.9  Hamilton, P.”Open source ECG analysis.” In Computersin Cardiology, IEEE (2002): 101-104.10  Elgendi,Mohamed, Bjoern Eskofier, and Derek Abbott. “Fast T wave detectioncalibrated by clinical knowledge with annotation of P and T waves.

” Sensors 15, no. 7 (2015):17693-17714.11 Pan, Jiapu, and Willis J.

Tompkins. “Areal-time QRS detection algorithm.”IEEEtransactions on biomedical engineering 3 (1985): 230-236.12 Li, Cuiwei,Chongxun Zheng, and Changfeng Tai. “Detection of ECG characteristic pointsusing wavelet transforms.

“IEEETransactions on biomedical Engineering 42, no. 1 (1995): 21-28.13 Coast, Douglas A., Richard M. Stern, Gerald G.Cano, and Stanley A.

Briller. “An approach to cardiac arrhythmia analysisusing hidden Markov models.”IEEETransactions on biomedical Engineering 37, no. 9 (1990): 826-836.14 Gritzali, F., G.

Frangakis, and G. Papakonstantinou. “Detection of the P and T waves in anECG.” Computers and BiomedicalResearch 22, no. 1(1989): 83-91.

15 Chatterjee, H. K.,R. Gupta, and M. Mitra. “Real time P and T wave detection from ECG usingFPGA.” Procedia Technology4 (2012): 840-844.

16 Leutheuser, Heike, Stefan Gradl,Lars Anneken, Martin Arnold, Nadine Lang, Stephan Achenbach, and Bjoern M.Eskofier. “Instantaneous P-and T-wave detection: Assessment of three ECGfiducial points detection algorithms.” In Wearable and Implantable Body Sensor Networks (BSN), 2016 IEEE 13thInternational Conference on, pp. 329-334. IEEE, 2016.17 Mehta, S. S.

, and N. S. Lingayat.”Detection of P and T-waves in Electrocardiogram.” In Proceedings of the world congress onEngineering and computer science, pp. 22-24. 2008.

18 Lagerholm, Martin, Carsten Peterson,Guido Braccini, Lars Edenbrandt, and Leif Sornmo. “Clustering ECGcomplexes using Hermite functions and self-organizing maps.”IEEE Transactions on Biomedical Engineering47, no. 7 (2000): 838-848.19 Goutas, Ahcène,Youcef Ferdi, Jean-Pierre Herbeuval, Malika Boudraa, and Bachir Boucheham.”Digital fractional order differentiation-based algorithm for P andT-waves detection and delineation.” ITBM-RBM 26, no.

2(2005): 127-132. 20 Laguna, Pablo,Raimon Jané, and Pere Caminal. “Automatic detection of wave boundaries inmultilead ECG signals: Validation with the CSE database.

” Computers and biomedicalresearch 27, no. 1(1994): 45-60.