Technique for Detection of QRS Complex and P Wave from ECG Signal

DOI : 10.17577/IJERTV2IS111162

Download Full-Text PDF Cite this Publication

Text Only Version

Technique for Detection of QRS Complex and P Wave from ECG Signal

Snehal Thalkar Prof. Dhananjay Upasani

Dept. of Electronics & Telecommunication Dept. of Electronics &Telecommunication SITS, Narhe, Pune SITS, Narhe, Pune

Abstract

P-wave characteristics in the human ECG are an important source of information in the diagnosis of atrial conduction pathology. But diagnosis by visual inspection is a difficult task since the P-wave is relatively small and noise masking is present in it. Hence most effective tool called wavelet transform is used for detection of QRS complex hence automated diagnosis of P wave takes place. Once QRS complex is identified in ECG signal; it can be used as a landmark for identification of P wave. P wave which has to be analyze is compared with normal control group and an abnormal group. A comparison can also made between characteristics derived from individual P-waves, a signal-averaged P-wave for each subject and standard cardio logical measures of duration, terminal force and duration divided by the PR segment. Otherwise comparison can be made on the basis of P wave duration, PR segment and PR interval.

.

  1. Introduction

    The electrical activity of the heart muscles can be represent using Electrocardiogram(ECG). Three major waves of electric signals appear on the ECG. Each one shows a different part of the heartbeat. The first wave is called the P wave. It records the electrical activity of the heart's upper two chambers (atria). The second and largest wave, the QRS wave, records the electrical activity of the heart's lower two chambers (ventricles).The third wave is the T wave. It records the heart's return to the resting state. By studying the shape and size of the waves, the time duration between waves, and the rate and regularity of beating diagnosis of various diseases associated with heart takes place. The analysis of ECG is widely used for diagnosing many cardiac diseases including ischemia and arrhythmias.

    The electrocardiogram (ECG) is a recording of the surface potential created by the electrophysiological processes of the cardiac cycle. This paper focuses on automated detection of the QRS complex and P-wave so as to perform analysis.

    Fig.1ECG Signal

    Abnormalities in the P-wave may be produced by structural changes, such as left atrial enlargement (LAE) or inter-atrial block (IAB).These atrial conditions, can produce significant alterations to the electrical signature of atrial activity. It is necessary to detect and analyze this low amplitude ECG signal automatically so that proper diagnosis of disease can takes place. P wave is slow and low in amplitude near about 0.1 to 0.2 mv with maximum duration of 120 ms. Magnitude of the P wave never exceeds 0.25mV. PR interval is approximately between 0.12 and 0.2 Seconds. QRS wave lasts for 0.06-0.1 Seconds. QT interval is about 40% of the R wave to the next R wave when the body is not in the state of exercise. Frequency components present in QRS complex are within the range of 3 to 40 Hz and in P wave within range of 2.5 to 13.5 Hz.

  2. Literature survey

    In time domain analysis of ECG signal the analysis of additional or hidden Information is not possible. Hence transform from one domain to another is required. A mathematical operation that takes a function or sequence and maps it into another one is

    called transform. The transform of a function may give additional or hidden information about the original function, which may not be available otherwise. The transform of a function or sequence may require less storage, hence provide data compression or reduction. An operation may be easier to apply on the transformed function, rather than the original function.

    Thus Frequency domain representation of the function was used by using fast fourier transform(FFT). Hence Perfect knowledge of what frequencies exists was obtained , but no information about where these frequencies are located in time.

    Hence short time Fourier transform come into existence to obtain the information of location of frequency in time. But again both time and frequency resolutions cannot be arbitrarily high. We cannot precisely know at what time instance a frequency component is located. We can only know what interval of frequencies are present in which time intervals. And in this STFT window size was fixed.

    Wavelet analysis is superior to time domain analysis for identifying patients at increased risk of clinical deterioration. The transient nature of the ECG makes it ideal for WT analysis. WT allows a powerful analysis of non stationary signals, making it ideally suited for the high resolution interrogation of the ECG over a wide range of applications. The continuous wavelet transform (CWT) is a timefrequency analysis method which differs from the more traditional short time Fourier transform (STFT) by allowing arbitrarily high localization in time of high frequency signal features [11].

    The CWT does this by having a variable window width, which is related to the scale of observation, a flexibility that allows for the isolation of the high frequency features. Another important distinction from the STFT is that the CWT is not limited to using sinusoidal analyzing functions. Rather, a large selection of localized waveforms can be employed as long as they satisfy specified mathematical criteria [17].

    Wavelet transform (WT) is designed to give good time resolution and poor frequency resolution at high frequencies, and good frequency resolution and poor time resolution at low frequencies. This approach is useful for ECG signals since ECG signals are characterized by high frequency components for short durations and low frequency components for long durations. WT allows a powerful analysis of non stationary signals, making it ideally suited for the high resolution interrogation of the ECG over a wide range of applications [11].

    Numerous QRS detection algorithms such as derivative based algorithms , Filtering Techniques

    artificial neural networks , genetic algorithms, syntactic methods , Hilbert transform , Markov models etc. are existed. Recently few other methods based on pattern recognition , moving- averaging etc are proposed for the detection of QRS complex. Once the position of the QRS complex is obtained, the location of other components of ECG like P, T waves and ST segment etc. are found relative to the position of QRS, in order to analyze the complete cardiac period.

    Artificial neural network can be applied in nonlinear signal processing, classification and optimization. In ECG signal processing mostly the multilayer perceptron (MLP), radial basis function (RBF) networks and learning vector quantization(LVQ) networks are used. But we have to train the network as per requirement. The MLP and RBF networks are trained by supervised learning algorithms and the LVQ network is adjusted in an unsupervised manner[18].

    Neural network as adaptive nonlinear predictor is used for QRS detection. Prediction error can be used as feature signal for QRS detection. The objective is to predict the current signal value x(n) from its past values x(n-i ), i>0.

    Learning vector quantization network for QRS detection offers fast computation once trained and also provide discrimination between QRS and premature ventricular contraction.hes But the result do not reach the results of classical approach[18].

    Hidden Markov models model the observed data sequence by a probability function that varies according to the state of an underlying (hidden) Markov chain. Hidden Markov model is useful for th detection of P wave, QRS complex, T wave but this method include necessary manual segmentation for training prior to the analysis of record. This method is patient dependent and computational complexity is also very high[18].

    Wavelet Transform uses a set of analyzing functions that allows a variable time and frequency resolution for different frequency bands. Peak detection method uses an approach of singularity detection and classification using local maxima of the wavelet coefficient signals. The Wavelet transform yields a time-scale representation similar to the time-frequency representation of the short-time Fourier transform (STFT). In contrast to the STFT, the WT uses a set of analyzing functions that allows a variable time and frequency resolution for different frequency bands. The scale parameter a of the WT is comparable to the frequency parameter of the STFT. The mother wavelet is a short oscillation with zero mean. The correspondence between singularities of a function f(t ) and local maxima in its wavelet transform Wf(a,t) is investigated. It is shown that singularities correspond to pairs of modulus maxima across several scales clarifies

    the correspondence between a signal with singularities and its wavelet coefficients. Peak classification is accomplished by the computation of the singularity degree.

  3. Proposed system

    The Wavelet transform can be defined as the correlation between the given signal and the mother wavelet (t) such as Haar, Daubechies, Morlet, Mexican hat etc. which is obtained by translating and scaling mother wavelet along the signal. The WT may be termed as the continuous Wavelet transform (CWT), the discrete Wavelet transform (DWT), stationary Wavelet transform (SWT) and the Wavelet packet transform (WPT) depending on applications in different fields.The CWT is particularly good at separating the short high frequency outbursts of a typical localized bearing defect from long duration low frequency signal components[16].

    Fig.2Daubechies Wavelet[18]

    The CWT is a correlation between a wavelet at different scales and the signal x(t) (the data to be analyzed) with the scale (or the frequency) , to measure a similarity . It is computed by changing the scale of the analysis window function by shifting the window function in time, multiplying by the signal, and integrating over all times. Such a wavelet is generally referred as mother wavelet.

    = ) (1)

    Where , Normalization factor to ensure that all Wavelets have the same energy. b is a translation parameter and a is a scale parameter.

    The kernel functions used in Wavelet transform are all obtained from one prototype function, by scaling and translating the prototype function

    CWT x(t) (a,b) = w(a,b) = *() dt (2)

    Where ,

    CWT of x(t) at scale a and translation b.

    a is a scale parameter which is a measure of frequency.

    b is a Translation parameter which is a measure of

    time

    is a Normalization factor. X(t) is a Signal to be analyzed.

    () is a mother wavelet , all kernels are obtained by translating(shifting) and scaling of mother wavelet.

    W(a,b) is the cross correlation of the signal x(t) with the mother wavelet at scale a, at the lag of b. If x(t) is similar to the mother wavelet at this scale and lag, then W(a,b) will be large.

    Wavelet transform uses variable length window. Because of variable length window both time and frequency resolutions can be arbitrarily high. Time resolution means how well two spikes in time can be separated from each other in the transform domain and frequency resolution means how well two spectral components can be separated from each other in the transform domain[17].

    Analysis windows of different lengths are used for different frequencies. For the analysis of high frequencies use narrower window which uses small scale for better time resolution. While for the analysis of low frequencies use wider window which uses large scale for better frequency resolution. Scale is inversely proportional to frequency.

    If we use discretization

    = )

    We get,

    = )

    = ) (3)

    Where a is sampled on log scale and b is sampled at a higher rate when a is small that is

    a =

    b = k. .

    where and are constants and j, k are integers Then discret(ized) wavelet transform (DWT) pair can

    be given as,

    Apply threshold to remove high frequency component

    Apply threshold to remove high frequency component

    W(a,b) (4)

    =

    Where,

    x(t) = (5)

    Find R wave peak

    Find R wave peak

    for the reconstruction

    x(t) = +

    where

    are approximation coefficients at scale

    are detail coefficients at scale and below.

    (6)

    Wavelet decompose for S wave

    Wavelet decompose for S wave

    Apply threshold to remove high frequency components

    Apply threshold to remove high frequency components

    It is very much essential to smoothen the ECG signal. For removing baseline drift two different filters are used. Those filters are Butterworth filter and median filter. After removing baseline drift QRS complex has

    Find S wave peak

    Find S wave peak

    to identify which is used as landmark for identifying P wave peak then onset and offset points of P wave has to

    calculate so as to obtain detail P wave information. The detail flowchart of proposed work is as follows:

    Search window of 100 ms prior to R wave to find Q wave peak

    Search window of 100 ms prior to R wave to find Q wave peak

    Read input raw ECG signal from database

    Search window of 50-250 ms prior to QRS complex to find P wave peak

    Read input raw ECG signal from database

    Search window of 50-250 ms prior to QRS complex to find P wave peak

    Calculate onset and offset points of P wave

    Calculate onset and offset points of P wave

    Noise Removal Techniques used

    Butterworth LPF for removal of baseline drift

    QRS complex identification

    QRS complex identification

    Wavelet decompose for R wave

    Wavelet decompose for R wave

    Median Filter for removal of baseline

    P wave duration, PR segment and PR interval has to calculate for

    P wave duration, PR segment and PR interval has to calculate for

    Fig. 3 Flow graph of Proposed Work

    ECG signal of 10 sec duration is used for analysis purpose. This ECG contains various kinds of noises among which baseline wandering is major artifact. This baseline wander is a small 0.5 Hz frequency

    component. So apply various filters like Butterworth low pass filter and median filter. Use fourth order low pass Butterworth filter and set cut off frequency to 0.5 Hz and this cut off frequency should be normalized between 0 and 1.The output of Butterworth filter is baseline drift of 0.5 Hz. Now we have to subtract this output of Butterworth filter from original noisy ECG so that baseline drift get completely eliminated from noisy ECG and we will get drift free ECG signal.

    Second filter used for removing baseline drift is median filter. Median filter replace each entry by median of neighbourhood entries. First apply 200 ms width median filter for noisy ECG which removes P wave and QRS complex from ECG signal then apply 600 ms width median filter which removes T wave from ECG signal. Now all waves get eliminated from ECG signal so remaining part is baseline drift. So subtract this complete output of median filter from noisy ECG so that baseline drift get completely eliminated from noisy ECG and we will get drift free ECG signal.

    Once we obtain smooth ECG we have to focus on QRS complex identification which includes identification of peak of Q wave, R wave and S wave separately. First focus on R wave as it is a highest peak among all peaks having magnitude of near about 1mv. QRS complex consist of frequency component within the range of 10 to 25 Hz. So apply wavelet transform to ECG signal so that all high frequency components get eliinated from signal. Daubechies wavelet is used. This is achieved by applying thresholding to detailed coefficients which are associated with high frequency. Once high frequency noisy components eliminated we have to apply local maxima so as to detect singularity peak which can be achieve by setting minimum peak height to 0.5 mv. This maximum value will be nothing but R wave. Similarly we have to obtain S peak but for finding S peak we have to invert ECG signal so as to obtain local maxima and we will get singularity peak which will be S wave.

    For finding peak of Q wave apply a search window of 100 ms prior to R peak. If instead of search window, we apply wavelet and then obtain local maxima point as per done in previous method then we will get S wave instead of Q wave. So apply search window of 100 ms . Once we obtain QRS complex apply search window of 50-250 ms prior to Q wave so as to find peak of P wave. So maximum search for span of 25 samples and find peak within that span. Set minimum peak height of 0.1mv for identifying peak. Maximum duration of PR interval is 210 ms. So for identifying onset and offset points of P wave apply a search window of 210 ms.

    Once we obtain all peaks i.e peak of P wave, Q wave, R wave, S wave, P wave onset point and P wave offset points; obtain P wave duration, PQ segment and PQ interval. On the basis of these three parameters analyze the signal whether it is normal or abnormal.

  4. Results

    Fig.4 ECG Signal for 10 Second Duration

    Fig.5 ECG Signal After Removing Baseline Drift Using Butterworth Filter

    Fig.6 ECG Signal After Removing Baseline Drift Using Median Filter

    Fig.7 P Peak, Q Peak, R Peak, S Peak, Onset and Offset Points of P Wave Detected

  5. Discussion

    Median filter efficiently removes baseline drift from ECG signal than Butterworth low pass filter. Wavelet based approach is advantageous in the diagnosis of low amplitude and dispersed P waves. For R peak detection second level of wavelet decomposition gives better result while for S peak detection third level of decomposition is efficient. Visual inspection of ECG is a difficult task. Wavelet transform Gives better results than initial approaches like discrete Fourier transform (DFT), Short time Fourier transform(STFT) etc. Once QRS is identified it can be used as landmark for identification of P wave peak. Take P wave peak as reference for finding onset and offset points of P wave. On the basis of P wave duration, PR segment and PR interval, normal and abnormal P wave and hence normal or atrial fibrillated can be categorized. MIT-BIH database is used for ECG signals.

  6. References

  1. A. Dierya,c, D. Rowlandsa,c, T.R.H. Cutmorea,b,d,, D. Jamesa,c,e Automated ECG diagnostic P-wave analysis using wavelets. computer methods and programs in biomedicine 1 0 1 ( 2 0 1 1 ) 3343.

  2. S. Petrutiu, J. Ng, G.M. Nijm, H. Al-Angari, S. Swiryn, A.V.Sahakian, Atrial fibrillation and waveform characterization, IEEE Engineering in Medicine and Biology Magazine 25 (6) (2006) 2430.

  3. J. Carlson, R. Johansson, S.B. Olsson, Classification of electrocardiographic P-wave morphology, IEEE Transactions on Biomedical Engineering 48 (4) (2001) 401 405.

  4. P. Sasikala, Dr. R.S.D. Wahidabanu, Robust R Peak and QRS detection inElectrocardiogram using Wavelet Transform, (IJACSA) International Journal of Advanced Computer Science and Applications,Vol. 1, No.6, December 2010

  5. C. Li, C. Zheng, C. Tai, Detection of ECG characteristic points using wavelet transforms, IEEE Transactions on Biomedical Engineering 42 (1) (1995) 2128.

  6. E.E. Cureton, R.B. DAgostino, Factor Analysis: An Applied Approach, Lawrence Erlbaum Associates, New Jersey.

  7. R.A. Johnson, D.W. Wichern, Applied Multivariate Statistical Analysis, 5th ed., Pearson Education International, New Jersey, 2002 (chapter 11).

  8. B.G.Tabachnick, L.S. Fidell, Using Multivariate Statistics, 5th ed., Pearson Education Inc., Sydney, 2007

  9. A Cabasson1, L Dang2, JM Vesin1, A Buttu1, R Ab¨acherli3, R Leber3, L Kappenberger4, P-wave Indices to Detect Susceptibility to Atrial Fibrillation.

  10. Samantha POLI (a), Vincenzo Barbaro (b), Pietro Bartolini (b), Giovanni Calcaglinini (b) and Federica Censi (b), Prediction of atrial fibrillation from surface ECG: review of methods and algorithms, Ann Ist Super Sanità 2003;39(2):195-203.

  11. Paul S Addison, Wavelet transforms and the ECG: a review, Institute Of Physics Publishing, Physiol. Meas. 26 (2005) R155R199.

  12. M.A. Elbey1, M. Oylumlu1, A. Akil1, S. Demirtas2, F. Ertas1, E. Erdogan3, A. Tasal3, A. Bacaksiz3, Z. Simsek4,

    H. Kaya1, A. Akyuz1, Relation of interatrial duration and p wave terminal force as a novel indicator of severe mitral regurgitation, European Review for Medical and Pharmacological Sciences, 2012; 16: 1576-1581.

  13. lifeinthefastlane.com

  14. Abdelhamid Daamouchea, Latifa Hamamib, Naif Alajlanc, Farid Melgania, A wavelet optimization approach for ECG signal classification, journal homepage: www.elsevier.com/locate/bspc, Biomedical Signal Processing and Control 7 (2012) 342 349

  15. P. Ghorbanian1, A. Ghaffari2, A. Jalali1, C. Nataraj1, Heart Arrhythmia detection Using Continuous Wavelet Transform and Principal Component Analysis with Neural Network Classifier, 1 Department of Mechanical Engineering, Villanova University, Villanova, PA, USA 2 Department of Mechanical Engineering, K.N.Toosi University of Technology, Tehran, Iran.

  16. P.SASIKALA1 , Dr. R.S.D. WahidaBanu2, Extraction of P wave and T wave in Electrocardiogram using Wavelet Transform, P.Sasikala et al, / (IJCSIT) International Journal

    of Computer Science and Information Technologies, Vol. 2 (1) , 2011, 489-493.

  17. Apoorv Gautam1 and Maninder Kaur2, ECG Analysis using Continuous Wavelet Transform (CWT), IOSR Journal of Engineering Apr. 2012, Vol. 2(4) pp: 632-635.

  18. Bert Uwe Kohler, Carsten Hennig, Reinhold Orglmeister,The principles of software QRS detection., department of electrical engineering, biomedical electronics group, Berlin university of technology.

Leave a Reply