Você está na página 1de 22

B.

Tech Project

ECG Analysis System

By Manu Rastogi 200101079

Dhirubhai Ambani Institute of Information & Communication Technology Gandhinagar, GUJARAT

April 23, 2005

Dhirubhai Ambani Institute of Information & Communication Technology Gandhinagar, GUJARAT

CERTIFICATE

This is to certify that the Project Report titled ECG Analysis System submitted by Manu Rastogi ID 200101079 for the partial fulllment of the requirements of B.Tech (ICT) degree of the institute embodies the work done by him on campus under my supervision.

Date:

Signature: (Prof. D. Nagchoudhuri)

Date:

Signature: (Prof. C. Parikh)

Acknowledgement

I would like to express my sincere gratitude and appreciation to my mentors, Professor Dipankar Nagchoudhuri and Professor Chetan D. Parikh, for providing me with the opportunity to work in the research area of Higher Order Statistical Analysis and Bio-medical Signal Analysis. In the absence of their invaluable guidance and encouragement at various levels I would not have been able to complete this work. I am also thankful to Prof. Ranjan for allowing me to utilize the facilities of Reliance Infocomm lab at DA-IICT for this project. I am also indebted to Vasudha Chaurey , Vaibhav Garg and Siddharth Mohan for sharing their knowledge and expertise at various stages of the project. Finally I am grateful to Abhinav Asthana, and Mrinal Kanti Rai for their help on tex and all others who directly or indirectly were associated with this project.

Manu Rastogi

ii

Contents
1 Introduction 1.1 ECG or EKG Signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.2 Characteristics of ECG Signal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1.3 Approaches to ECG Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 Background 2.1 Motivation for using Higher order Spectral(Statistics) Analysis (HOSA) 2.2 Quadratic Phase Coupling (QPC) . . . . . . . . . . . . . . . . . . . . . 2.3 Bicoherence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2.4 Finding Bicoherence for a given signal . . . . . . . . . . . . . . . . . . . 2.4.1 bicoher function of HOSA Toolbox ver 2.0 . . . . . . . . . . . . . 2.4.2 Plotting bicoherence and interpreting the plots . . . . . . . . . . 2.5 Bicoherence for ECG beats . . . . . . . . . . . . . . . . . . . . . . . . . 2.6 What does constant Bicoherence mean? . . . . . . . . . . . . . . . . . . 3 Discussion 3.1 Bicoherence based ECG Analysis . . . . . . . . . . 3.2 Steps in ECG Analysis . . . . . . . . . . . . . . . . 3.2.1 Why no lter is required? . . . . . . . . . . 3.2.2 Reasons for an algorithm for Beat detection 3.2.3 Algorithm for beat detection . . . . . . . . 3.2.4 ECG beat Classication . . . . . . . . . . . 4 Conclusion 4.1 Data source for Testing . . . . . . . . . . . 4.2 Statistical Results for Data Tested . . . . . 4.3 Observations made and problems in testing 4.4 Scope for improvement and research . . . . 5 References 1 1 1 2 3 3 3 4 5 6 6 8 8 9 9 9 10 10 10 14 14 14 15 16 16 17

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

. . . .

List of Figures
1.1 1.2 1.3 2.4 2.5 2.6 2.7 3.8 3.9 3.10 3.11 3.12 3.13 3.14 3.15 3.16
ECG beats in a rhythm with an abnormality at the fourth beat

. . . . . . . . . . . . . . . . . . . . . . . A single ECG beat[2] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Relative Power spectra of QRS complex, P and T waves, muscle noise and motion artifacts based on an average of 150 beats[8] . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Bicoherence of a normal beat,MIT-BIH SVDB Database . . . . . . . . . . . . . . . . . . . . . . Bicoherence of an abnormal beat,MIT-BIH SVDB Database . . . . . . . . . . . . . . . . . . . . Value of bicoherence along w=0 for Fig. 2.4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Value of bicoherence along w=0 for Fig. 2.5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ECG Analysis System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ECG Signal: First 1000 samples of MIT-BIH SVDB Database, rec:800.dat . . . . . . . . . . . . ECG signal after ve point derivative . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Derived ECG signal after squaring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . The fourth peak zoomed from the above plot . . . . . . . . . . . . . . . . . . . . . . . . . . . . ECG signal after deriving, squaring and moving window integration . . . . . . . . . . . . . . . Mid Point detection as mentioned in Sec 3.2.3 . . . . . . . . . . . . . . . . . . . . . . . . . . . The fourth beat extracted from the original signal . . . . . . . . . . . . . . . . . . . . . . . . . Plots of windowed mean . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

. . . . . . . . . . . . . . . .

1 1 2 7 7 7 8 10 11 12 12 12 13 13 13 14

iii

ABSTRACT

The Electrocardiogram (ECG) is a representation of the electrical activity of the heart and can be used for detection of heart ailments. The ECG signal is composed of a fundamental beat being repeated at regular intervals of time. Any variations in the fundamental beat or the time of occurrence of the beat would classify it as normal or abnormal. Although the ECG beats appearing at approximately regular intervals of time are not identical in nature the basic shape is preserved. The frequencies contributing to the shape of the beat are strongly phase coupled. The phase coupling present is such that for a range of frequencies, for a normal beat, the ratio of power of the phase coupled frequencies to the total power remains constant. This report exploits techniques for measuring the magnitude of phase coupling present using bicoherence based techniques. Bicoherence, an estimate of Quadratic Phase Coupling, uses higher order moments or higher order analysis of a signal to preserve the phase information present in the signal which is usually lost in the power spectrum estimation. Using windowed mean based approach for estimating the atness along a 2-D slice of the 3-D value of bicoherence it can be concluded whether the beat present is abnormal or normal.

iv

1
1.1

Introduction
ECG or EKG Signals

Electrocardiogram or ECG (EKG) signal is a measure of the electrical activity of the heart [1]. ECG signals are recorded by placing ECG leads on pre-dened positions of the body which pick up the electrical signals from the skin. These electrical signals from the skin can be used for various kinds of analysis like [1]: 1. The underlying rate and rhythm mechanism of the heart. 2. The orientation of the heart (how it is placed) in the chest cavity. 3. Evidence of increased thickness (hypertrophy) of the heart muscle. 4. Evidence of damage to the various parts of the heart muscle. 5. Evidence of acutely impaired blood ow to the heart muscle. 6. Patterns of abnormal electric activity that may predispose the patient to abnormal cardiac rhythm disturbances. The pattern of human ECG is a continuous repetition of a fundamental beat at roughly xed time interval from one another (Fig 1.1 and Fig 1.2). Dierent intervals in this fundamental beat as referred as P,Q,R,S,T and U, as shown in Fig 1.2, each of these are characteristic of a specic kind of electrical activity of the heart. When this fundamental beat pattern is distorted (i.e. the P, QRS, ST, T and U dont adhere to the normal time interval or amplitude relationship between them) or repeated at an irregular time interval, it represents an abnormality in the electrical activity of the heart. These patterns or rather lack of pattern is known as Arrhythmias. Fig 1.1 shows the fourth beat as an irregular pattern appearing prematurely. An arrythmia is classied on the basis of distortion in the fundamental beat and also on the relative occurrence of the arrythmia to normal beats. For instance Fig 1.1 shows Super Ventricular Tachycardia (SVT) or the premature occurrence of only a QRS complex . The frequency of arrhythmia and the nature of arrhythmia prompts a doctor to classify a person as healthy or unhealthy. This project report exploits the variations in Quadratic Phase Coupling (QPC) for the normal and the abnormal heart beats using bicoherence estimation. The report presents techniques for classication of an extracted beat from recorded human ECG signal as normal or abnormal , it doesnt specify the nature of abnormality or whether the person is healthy or unhealthy.

Figure 1.1:
fourth beat

ECG beats in a rhythm with an abnormality at the

Figure 1.2: A single ECG beat[2]

1.2

Characteristics of ECG Signal

ECG signals are low frequency and low amplitude signals. The typical frequency range being 3Hz-70Hz[7] and amplitude values are in ones or twos of millivolts[10]. Fig 1.2 shows that the amplitude values are in millivolts and the time duration is in milliseconds. In addition to P,Q,R,S,T and U waveforms(ref Fig 1.2) ECG waveforms also contain powerline interference,EMG from muscles, motion artifact from the electrode and the skin interference from the other electrosurgery equipment in the room. These noises can be both Gaussian and non-Gaussian. Since ECG signals ar very low frequency signals they are prone to the noise disturbances. Ref 1

to Fig 1.3 from [8] for a view on relative power spectra of dierent ECG components and noise. Since the noise being added is comparable to the ECG data it can result in being classied as ECG data or as an abnormality. The solution is to lter the data before analysis. The problem arises by the fact that noise components both in terms of amplitude (time domain) and frequency (frequency range) overlap with the ECG signal. Implementing any kind of ltering approach would result in loss of ECG signal as well. For instance powerline interference is typically appears as a sharp spike at 50Hz or 60Hz. ECG data is present both at 50Hz/60Hz and around these frequencies. Thus ltering the data would result in the distortion of ECG beats or loss of valuable information.

Figure 1.3: Relative Power spectra of QRS complex, P and T waves, muscle noise and motion artifacts based on an average of 150 beats[8]

1.3

Approaches to ECG Analysis

A lot of work has been accomplished in the eld of ECG signal analysis. Most of the work has been broadly in the eld of designing lters for ECG signals for removing noise components as mentioned in Sec 1.2,beat detection and ECG analysis. For noise removal earlier attempts were to implement FIR, IIR and integer lters[8].With advancements in computing power and ecient algorithms in DSP ltering techniques based on minimization of mean square error(adaptive lters)[13] and time varying lters like Kalman lters have been tried[15]. However as mentioned in Sec 1.2 most of lters end up removing crucial ECG data as well. For beat detection and analysis the work has mainly concentrated in the time-domain. Approaches tried in the time domain can be listed as: 1. Furno and Tompkins presented automata based template matching for eective QRS detection. The automata based technique breaks the fundamental ECG beat into tokens and then uses a state transition diagram for beat detection. The limitation of algorithm comes from the fact that it fails to detect crucial abnormalities like Artial utter or SVT[8]. 2. Dobbs et al. presented the Template crosscorrelation technique. In this technique a predened template of the signal we wish to detect is saved and a crosscorrelation between the two is computed. Depending on the correlation coecient between the two degree of match is predicted. The main disadvantages of this approach is that the template needs to be perfectly aligned to the incoming signal. The technique fails to dierentiate between abnormalities and noise. Since both can be uncorrelated to the template[8]. Another approach of using template based subtraction is similar to the above mention technique except in this case the incoming signal is subtracted from the template stored and detections are made on the basis of the value. Other approaches based on time domain template matching can be found in [12]. 3. Recognition of QRS complexes on the basis of slopes. Pan and Tompkins presented an approach using derivative and moving integrators for QRS detection. Because of the simplistic nature of the algorithm and its accuracy this algorithm has been widely used for QRS detection even after nearly two decades of it being published [8]. This project uses the above mentioned technique for QRS beat detection. 4. Pattern recognition techniques have also been attempted by researchers exploiting the repetitive nature of the beats. However the approach fails as the ECG beats are almost periodic meaning that the pattern 2

of the beats repeats itself at not constant rate but a near constant rate. Another drawback of pattern based approaches stems from the fact that the fundamental beat pattern itself is not of xed duration. Pattern based approach is presented in [14] 5. Owing to the dierent frequency ranges of P,QRS,ST and U segments of the ECG beats computationally heavy systems designed on Filter bank approach have also been constructed.[16] However the study of ECG in the time domain is yet to yield any signicant results. Eorts have also been made in the eld of frequency domain by nding the FFT and analyzing the frequency components. Lately signicant interest has been in using neural network based and knowledge based approaches for beat detection and analysis[18]. This report tries to look beyond the frequency domain by using the Higher Order Spectral Analysis. Use of HOSA for physiological signals is yet to be fully explored. Work done previously on HOSA for ECG signals can be found in [17] and [11]. [11] tries to compare fourier series coecients to Bispectrum(Ref Sec 2.3 Frequencies(BF) of an entire ECG signal to nd the Shape Determining Frequencies(SDF). Where as [17] presents Higher order Auto-Regressive(AR) modeling for arrythmia. However no prior work on HOSA or ECG analysis uses Quadratic Phase Coupling using bicoherence estimation for beat classication.

2
2.1

Background
Motivation for using Higher order Spectral(Statistics) Analysis (HOSA)

HOSA is a eld of statistical signal processing which reveals not only the amplitude information about a signal but also the phase information. The motivations for using HOSA as a tool for ECG analysis can be listed as following: 1. Noise as mentioned in section 1.2 can be both Gaussian and non-Gaussian. The higher order spectrum of a Gaussian signal is identically zero and for a non-Gaussian noise is at. Hence HOSA helps in increasing the SNR of the signal[3]. On the other hand a simple autocorrelation is not prone to these noises and the noises also show up in the power spectrum. 2. HOSA based approaches tend to preserve phase information which is lost in the power spectrum is otherwise lost in the power spectrum. Thus HOSA retains more information than the power spectrum 3. Non-linearities present in the signal also can be estimated using higher order moments.Physiological signals like the ECG are non-linear in nature[4] thus a linear analysis approach like the power spectrum and frequency estimation are not sucient. It is for the above mentioned reasons that HOSA is a better technique for analysis of ECG beats as compared to the conventional autocorrelation and FFT based approaches.

2.2

Quadratic Phase Coupling (QPC)

A common approach to analysis of signals is the estimation of the frequencies and power of the sinusoidal components. If the system is non-linear, say second order, then some of the sinusoidal components would exhibit a harmonic relation relationship to form bifrequencies 1 . Presence of these bifrequencies in the power spectrum does not indicate that they have necessarily been generated by a non-linear system. However if we look at the phase components of these harmonics then for a second-order non-linear system the individual phase components would also add up along with the frequency components, which is not the case for a linear system. Meaning that for a frequency f1 with phase 1 , if passed through a second order non linear system the resultant signal would contain a component 2f1 and 21 . This phenomena of phases adding up can only be observed in a second order non-linear system and not a linear system [5] Consider the following example: Assume a discrete time system y(n) = x(n) + x2 (n) x(n) = cos(f1 n + 1 ) + cos(f2 n + 2 ). (1) (2)

y(n) = cos(f1 + 1 ) + cos(f2 n + 2 ) + cos2 (f1 n + 1 ) + cos2 (f2 n + 2 ) + 2 cos(f1 n + 1 ) cos(f2 n + 2 ) (3)
1 If

three frequencies f1 ,f2 and f3 are such that f3 = f1 + f2 then the triple ( f1 , f2 , f3 ) is said to be a bifrequency.

using 2 cos(A) cos(B) = cos(A + B) + cos(A B) 1 + cos(2A) = cos A y(n) = cos(f1 n + 1 ) + cos(f2 n + 2 ) + 1 + cos(2f1 n + 21 ) + 1 + cos(2f2 n + 22 ) + cos(f1 n + f2 n + 1 + 2 ) + cos(f1 n f2 n + 1 2 ) Note The following bifrequency triples in y(n): Bifrequency Pairs (f1 ,f1 ,2f1 ) (f2 ,f2 ,2f2 ) (f1 ,f2 ,f1 +f2 ) (f2 ,f1 -f2 ,f1 ) Corresponding Phases (1 ,1 ,21 ) (2 ,2 ,22 ) (1 ,2 ,1 +2 ) (2 ,1 -2 ,21 )
2

(4) (5) (6)

In the example above the phase of the component of the frequency f1 +f2 in y(n) is given by 1 +2 , which is the sum of the phases of the st two components of the bifrequency. Since a second order non-linearity gives rise to this such a phase relationship is known as Quadratic Phase Coupling or QPC[5]. Thus if we have some method of measuring the degree of (QPC) between the various frequency components present we can comment on the presence or the absence of second order non-linearity of a signal. Bicoherence is one such measure.

2.3

Bicoherence

Bicoherence is the quantity used to estimate the contribution of the second-order non-linearity to the power in the bifrequencies[5].The Bicoherence bic(1 ,2 )is dened as: bic(1 , 2 ) =| B(w1 , w2 ) | / P (w1 )P (w2 )P (w1 + w2 ) where

(7)

B(w1 , w2 ) =
k= l=

c(k, l)exp[jw1 k + w2 l]

(8)

c(k, l) = E{x(n)x(n + l)}

(9)

c(k,l) is dened as the third order moment of the sequence x(n)or the third order cumulant of x(n). E{.} denotes the expectation. B(w1 ,w2 ) is the 2-D Fourier Transform of c(k,l) and is also known as the Bispectrum. For stationary Gaussian process, the third order cumulant sequence and hence the bispectrum are identically zero.[5] Consider the following example.Let
3

x(n) =
i=1

Ai cos(fi n + i ) + B cos(f3 n + )

(10)

where f3 =f1 +f2 and 3 =1 +2 , phase angles 1 ,2 ,3 and are independent and uniformly distributed over [0,2]. is not equal to the sum of any of the combinations of i . The contribution to the power spectrum of x(n) at frequency f3 is partly due to the quadratic coupling i.e. due to the signal with the phase 3 and due to the non-coupled or the signal with the phase . Thus the fraction of the total power at f3 due to coupling is equal to[5]: A2 /(A2 + B 2 ) 3 3 Now consider the following two scenarios: 1. There are no phase coupled frequencies present in x(n) as dened in equation (10) i.e 3 = 1 + 2 and is not equal to the sum of any combination of i then the fraction of total power at f3 due to coupling would be zero. 2. There are only phase coupled frequencies present in x(n) as dened in equation (10) i.e the value of B as dened in equation (10) is zero then the fraction of total power at f3 due to coupling would be one. 4 (11)

Thus a zero value of equation (11) indicates absence of any phase coupled frequencies in a signal whereas the value of one indicates presence of only phase coupled frequencies. If some processing on the signal results in the above fractions we would be in a position to estimate the presence/absence of phase coupled frequencies. The presence/absence of the phase coupled frequencies would in turn indicate the presence/absence of second order non-linearity in the signal. Bicoherence is one such estimate. To understand bicoherences output consider the following altered version of the above example:
3 3

x(n) =
i=1

Ai cos(fi n + i ) +
i=1

Bi cos(fi n + i )

(12)

As stated in the previous example f3 =f1 +f2 and 3 =1 +2 , phase angles 1 ,2 ,3 and 1 ,2 and 3 are independent and uniformly distributed over [0,2]. i are not equal to the sum of any combination of i and i . The bicoherence as dened in equation ( 7) at (f1 ,f2 ) would be: [ (A2 1 A2 A2 A2 2 3 1 2 ) ][ (A2 + B 2 ) ][ (A2 + B 2 ) ] + B1 2 2 3 3 (13)

Each term within the square bracket is equal to the fraction of the power contributed to the coupling in the bifrequency by the concerned frequency[5]. For instance [A2 /(A2 +B 2 )] is the fraction of the power in the 3 3 frequency f1 contributing to the coupling in (f1 ,f2 ,f3 ). If B2 and B3 are zero then equation (13) reduces to equation (11).

2.4

Finding Bicoherence for a given signal

Finding the bicoherence for a signal x(n) has been described in [5].Suppose x(n) is given with n=0,1,....,N-1. Let N=LM where L and M are integers. The rst step is to break the sequence into L segments of M each as: xl (m) = x(M (l 1) + m) xl m = 0, 1, ....., M 1; l = 1, 2, ..., L (14)

where xl is the sample mean of the l the record. The next step is to take the M-point DFT of each record as Xl (k) = DFTxl (m) k = 0, 1, ..., M 1; l = 1, 2, ..., L. (15)

Estimates of the power spectrum is obtained for each record as Pl (k1 ) = |Xl (k1 )|2 Wp (k1 ) Pl (k2 ) = |Xl (k2 )|2 Wp (k2 ) Pl (k3 ) = |Xl (k1 + k2 )| Wp (k1 + k2 )
2

(16) (17) l = 1, 2, ..., L (18)

Where Wp (k) is a smoothing window. The nal power spectrum estimates are then obtained by averaging over all records as Pl (k1 ) = 1 L
L

Pl (ki )
l=1

i = 1, 2, 3

(19)

For the bispectrum the estimates are obtained as


Bl (k1 , k2 ) = Xl (k1 )Xl (k2 )X1 (k1 + k2 )Wb (k1 , k2 )

l = 1, 2, ..., L

(20)

where * denotes the complex conjugation and Wb (k1 , k2 ) is again a smoothing window. the nal estimate is obtained by averaging over the records as B(k1 , k2 ) = 1 L
L

B(k1 , k2 )
l=1

(21)

The bicoherence estimate is formed by combining the bispectrum and the power estimates as: bic(k , k2 ) = |B(k1 , k2 )|/ Pl (k1 )Pl (k2 )Pl (k3 ) 1 (22)

If a large number of samples and statistically independent records are given then the squared bicoherence estimate as formed above tends to the fraction of the power due to quadratic coupling[5]. 5

2.4.1

bicoher function of HOSA Toolbox ver 2.0

This project uses bicoher function of the Higher Order Spectral Analysis Toolbox ver 2.0 by Ananthram Swami, Jerry M. Mendel, Chrysostomes L. (Max) Nikias to nd the bicoherence. bicoher uses the direct Frequency Division method for bicoherence estimation. Other approaches can be found in [5].The bicoher function has the following format: [bic, waxis] = bicoher(y, nf f t, wind, nsamp, overlap) The parameters have the following meanings: 1. y:The data vector or the time series for which bicoherence has to be found. 2. nt: t length [default = power of two nsamp] actual size used is power of two greater than nsamp 3. wind: species the time-domain window to be applied to each data segment should be of length segsamp (see below). If no window is specied it uses the Hanning window. This corresponds to the smoothing window Wp specied in Sec 2.4. 4. nsamp: samples per segment. Default value chosen is such that there are a minimum of 8 segments. 5. overlap: percentage overlap, allowed range [0,99]. [default = 50]; 6. bic: estimated bicoherence.The output would be a real valued 2-D matrix of size nt x nt with the origin as w=(0,0) at the center point of the matrix. Since digital frequencies fall in the range[-] values to the left and above the origin would correspond to negative frequencies whereas values on the right and below the origin would correspond to positive frequencies. 7. waxis- vector of normalized frequencies(w=F/Fs )2 associated with the rows and columns of bic. 2.4.2 Plotting bicoherence and interpreting the plots

The bicoherence plots as shown in Fig2.4 and Fig2.5 have been plotted using the surf function of MATLAB. The plot shows the bicoherence output on the z-axis and x and the y axis have the absolute frequency in Hz. Absolute frequency is calculated by multiplying w (the output of the bicoher ) method with the sampling frequency. The surf command looks like the following: surf (w F s, w F s, bic) where w and bic are the outputs of the bicoher function as explained in the section above and Fs is the sampling frequency of the input signal. Fig2.6 and Fig2.7 show the 2-D cross-section of the 3-D plots of Fig2.4 and Fig2.5 respectively. The 2-D plot has absolute freq in Hz on the x axis and bicoherence value on the y-axis corresponding to (wslice , wx ). wslice is the frequency along which the cross-section has been taken and wx indicates the frequency from [-pi].The following command can be used for plotting the 2-D cross section plots. plot(w Fs , bic(:, 65), r : ) where w and Fs are the output of bicoher function and the sampling frequency respectively. bic(:,65) denotes the 1-D matrix of all the rows of bic along column number 65 of 2-D matrix bic. This would plot the slice along the frequency present at index number 65 of w i.e. value present at w(65).

2F

is the freq in Hz and Fs is the sampling frequency in Hz

Figure 2.4: Bicoherence of a normal beat,MIT-BIH SVDB Database

Figure 2.5: Bicoherence of an abnormal beat,MIT-BIH SVDB Database

Figure 2.6: Value of bicoherence along w=0 for Fig. 2.4

Figure 2.7: Value of bicoherence along w=0 for Fig. 2.5

2.5

Bicoherence for ECG beats

Bicoherence for ECG signal showed peculiar patterns. Normal beats displayed presence of constant bicoherence for a range of frequencies whereas abnormal or diseased beats displayed a lack of it.(Ref to Fig 2.4 to 2.5). The bicoherence value in case of a normal beat remained constant over a range of frequencies whereas incase of an abnormal beat it dipped in values. This indicates the following: 1. Phase coupling for a normal beat is present for a range of frequencies. 2. The product of the fractions of power of frequencies in (f1 , f2 , f3 ) contributing to coupling remains constant for a patch of frequencies for a normal beat. 3. Phase coupling for an abnormal beat is absent for a range of frequencies. 4. Since bicoherence for an abnormal beat is absent it indicates the absence of particular frequencies or the absence of phase coupling as explained in Sec2.3. The next section explores the nature of time domain signal for which the bicoherence value would stay constant for a range of frequencies.

2.6

What does constant Bicoherence mean?

Constant bicoherence over a range of frequencies is a typical phenomena translating into a very interesting result in the time domain representation. Consider the bicoherence values for (w1 ,w2 ) where f1 w1 f5 and f1 w2 f5 . Assuming that frequencies greater than f5 are absent. From equation (13) we can conclude that bicoherence at (1,2) and (2,1) shall have the same value. Thus equation (13) remains same for (fi ,fj ) and (fj ,fi ). Therefore we consider (13) only for the top diagonal frequencies i.e. only for the following pairs: (1,1),(1,2),(1,3),(1,4),(1,5),(2,2),(2,3),(2,4),(2,5),(3,3),(3,4),(3,5),(4,4),(4,5) and (5,5) Since it is assumed that frequencies greater than f5 are absent therefore value of (13) for (wi ,wj ) where i + j>5 reduces to zero. Thus from the above mentioned pairs we are left with: (1,1),(1,2),(1,3),(1,4),(2,2) and (2,3) Let all these points have the same bicoherence value k. Let us also assume that:
2 yi = A2 /(A2 + Bi ) i i

(23)

Then we have the following equations:


2 2 y1 .y2 = y1 .y2 .y3 = y1 .y3 .y4 = y1 .y4 .y5 = y2 .y4 = y2 .y3 .y5 = k

(24) (25)

Solving the above set of equations result in: y1 = y 3 = y 5 and y 2 = y4 = let (26) be equal to g. A2 k A2 2 4 2 = B2 = g k B4 2 A2 A2 A2 1 = 3 = 5 =g 2 2 2 B1 B3 B5 A4 B4 = A2 B2 A1 B5 = A5 B1 A1 B3 = A3 B1 A5 B3 = A3 B5 (28) (29) (30) (31) (32) k 2 y1 (27) (26)

Thus in the time domain the signal would look like for any arbitrary a1 and b1 : a1 cos(f1 t + 1 ) + b1 cos(f1 t + 1 )+
i=2n+2,n=0

cos(fi t + i ) + P cos(fi t + i )+ (33) cos(fi t + i ) + Q cos(fi t + i )


i=2n+1,n=1

b where P= Qk and Q= a1 Assuming that i+j =i +j but i+j =i +j k 1 The above signal representation leads to the following inferences:

1. The fraction of total power due to coupling at even and odd frequencies would be equal to each other respectively. 2. The ratio of power of coupled components to uncoupled components at even and odd frequencies remains same. 3. The ECG beat being generated consists of both even and odd in constant power ratios and should abide by the above results.

3
3.1

Discussion
Bicoherence based ECG Analysis

As mentioned in section 2.5 normal and abnormal ECG beats showed presence and absence of constant phase coupling.The absence as observed mapped to peaks being present in the bicoherence plot for an abnormal beat. Hence if we are able to test the bicoherence value for presence and the absence of atness we will be in a position to label a beat as normal or abnormal respectively. With this motivation the following sections describe the steps adopted for ECG analysis and classication.

3.2

Steps in ECG Analysis

The detailed algorithm for ECG analysis is shown in Fig3.8. The algorithm broadly consists of the following steps: 1. Splitting incoming ECG signal into beats: Since the objective of the project is to label individual beats as normal or abnormal. The rst step is to split the ECG signal into individual beats. This process of splitting the signal into individual beats is shown in the rst two rows of Fig 3.8. The detailed algorithm with reasons for splitting up the signal into individual beats is given in sec 3.2.3. 2. Bicoherence Calculation: Once the beats have been split up bicoherence for the every beat is calculated as explained in sec 2.4.1. 3. Detection of the atness for a range of frequencies For the sake of simplicity of analysis a 2-D cross-section was taken along w=0 for bicoherence as mentioned in Sec 2.4.2. This 2-D slice or 1-D array was the tested for atness of the ECG beats using a windowed mean based approach. 9

Figure 3.8: ECG Analysis System

3.2.1

Why no lter is required?

Typically the rst step to any nature of an ECG analysis is to obtain the clean ECG signal contaminated by the various noise components as stated in section 1.2. In addition to the reasons mentioned in sec 2.1 the following are the reasons why a lter is not used in a QPC based analysis system: 1. A lter is bound to add phase to the existing signal thereby disrupting the existing phase correlations. 2. The high frequency noise(>=50 Hz) and low frequency noise (<=10 Hz) components would rstly not be phase correlated to the ECG signal secondly even if they are phase correlated they lie outside the frequency range for which phase correlations are observed (10Hz-30Hz).

3.2.2

Reasons for an algorithm for Beat detection

The ECG signal as mentioned earlier in sec 1.2 is repetitive in nature. The question then raises is why do we require a articulate method to detect every beat if we already know the rough beat duration and the time of repetition of ever beat.The following are the reasons for an articulate beat detection algorithm: 1. The ECG signal is roughly periodic in nature meaning the beats do not repeat at the exact intervals of time. 2. The beat duration in itself like the overall ECG signal varies from beat to beat. Meaning that the beat duration would be of the previous duration with the also varying. 3. Ref to Fig1.1. Third beat shows a premature beat occurring. If the signal was split using a xed beat duration the premature beat would have been clubbed either with the second or the fourth beat. It is for the above mentioned reasons that one requires an algorithm for splitting a beat. A lot of work,as mentioned in sec 1.3 has been done for beat detection. 3.2.3 Algorithm for beat detection

A derivative based approach was used for beat detection as given by Pan-Tompkins[8]. The algorithm recognizes beats on the basis of slope, amplitude and width. The prime reason for such an approach was the simplicity of the algorithm from implementation point of view. The following steps were used for beat extraction. 1. Derivation : Take the ve point derivative of the entire signal. The ve point derivative has the following transfer function: H(z) = 0.1(2 + z 1 z 3 2z 4 ) 10 (34)

and is implemented as the following dierence equation: y(nT ) = 2x(nT ) + x(nT T ) x(nT 3T ) 2x(nT 4T ) 10 (35)

2. Square : Squaring the ve point derivation of the signal. y(nT ) = [x(nT )]2 (36)

This operation makes all the data points in the processed signal as positive and amplies the derivative process non-linearly. It boosts the higher frequencies in the signal which are mainly due to the QRS complex. 3. Moving window integral : The slope of the R wave alone is not a guaranteed way to detect a QRS complex. Many abnormal QRS complexes have large amplitudes and long durations but not steep slopes[8]. Thus using the squared derivative alone( i.e. slope alone) we can not extract the information about these. The moving window integration extracts features in addition to the slope of the R wave. It is implemented with the following dierence equation: y(nT ) = x(nT (N 1)T ) + x(nT (N 2)T ) + ... + x(nT ) N (37)

Value of N was chosen to be 20 i.e. 156.3ms for a signal sampled at 128Hz as an approximation to 150ms as given by [8]. 4. Beat Extraction Taking a look at the output of the moving window integral(Ref Fig. 3.13) we realize that corresponding to every QRS complex we get a what looks like an inverted tumbler. The ECG beat starts mid-way, roughly speaking, between the end point of a tumbler and the starting point of the succeeding tumbler and ends at the mid point between a tumblers end and the start point of the other tumbler. What we are essentially doing is that we detect the R point which we assume to be at middle of the inverted tumbler, then we say that the beat lies between the mid points of three consecutive R points. This methodology is an approximate way of detecting beats. The reason this approach works is because the ECG being a nearly periodic signal we would have shifted all the start and stop points by the same amount. Thus the statistical properties for every beat would bear the same nature. However this poses a dierent kind of problem as described in sec 4.3. The resultant waveforms for the above mentioned steps are shown below Fig. 3.9-Fig. 3.15. Once the sample numbers for each of the start and stop for the beat are known, the samples between the start and the stop points of the original ECG signal are passed for calculation of the bicoherence and classication.

Figure 3.9: ECG Signal: First 1000 samples of MIT-BIH SVDB Database, rec:800.dat

11

Figure 3.10: ECG signal after ve point derivative

Figure 3.11: Derived ECG signal after squaring

Figure 3.12: The fourth peak zoomed from the above plot

12

Figure 3.13: ECG signal after deriving, squaring and moving window integration

Figure 3.14: Mid Point detection as mentioned in Sec 3.2.3

Figure 3.15: The fourth beat extracted from the original signal

13

3.2.4

ECG beat Classication

Ref Fig. 2.4-Fig 2.7 . It was observed that along the w=0 slice (Ref sec2.4.2)the bicoherence stayed nearly constant for some time and then dipped very fast for normal beats. In order to nd for which frequencies in general the bicoherence stayed constant. Cross bicoherence of all the normal beats was found out. I was observed that for normal ECG signals for a slice along w=0, the bicoherence value stayed constant for frequencies between 10Hz and 30Hz. Once this was known he following approaches were adopted for detecting if the bicoherence value stayed constant for the above mentioned frequencies: 1. Derivative: The problem with the derivative based approach was that whenever the bicoherence value had ripples, which is normally the case. The derivative showed spikes in the value. 2. Windowed Mean: Taking a windowed mean for the intervals 10Hz-14Hz,15Hz-19Hz,20Hz-24hz and 25Hz-30 Hz. The variance for this sample set along with the maximum value between 10-30Hz was calculated. It was observed that for normal beats the average standard deviation value was 1.456. Therefore the system at the end compared the standard deviation to 1.456 , if the value was less or equal to 1.456 then the beat was labeled as normal else it was labeled as abnormal.(Ref Fig. 3.16)

Figure 3.16: Plots of windowed mean

4
4.1

Conclusion
Data source for Testing

The data source for testing can be obtained from [19]. ECG data available at [19] is classied for various elements and can be downloaded from [19] free of cost. The data comes in a bundle of three les with the extensions of .dat,.hea and .atr. The .dat le contains the ECG data where as .hea contains the header information required for reading this .dat le. The .atr le contains the annotations and the time of annotation. Annotations are a set of symbols adopted by [19] for classication of ECG beats or the occurrence of an event. The annotation time is the time of the occurrence of the event with respect to the starting time of the signal. A list of annotations 14

with their meanings can be found at[19]. The le formats for the above mentioned les are also available at[19]. A series of free programs both in C/C++ and MATLAB are available for reading the data. This project used the source code by ose Garcia Moros and Salvador Olmos, available on MIT-BIH website[19] for reading the ECG data.

4.2

Statistical Results for Data Tested

Record Number 800.dat Normal classied as Normal Normal classied as Abnormal Abnormal classied as Abnormal Abnormal classied as Normal 100.dat Normal classied as Normal Normal classied as Abnormal Abnormal classied as Abnormal Abnormal classied as Normal 16483.dat Normal classied as Normal Normal classied as Abnormal Abnormal classied as Abnormal Abnormal classied as Normal 19090.dat Normal classied as Normal Normal classied as Abnormal Abnormal classied as Abnormal Abnormal classied as Normal 801.dat Normal classied as Normal Normal classied as Abnormal Abnormal classied as Abnormal Abnormal classied as Normal 18177.dat Normal classied as Normal Normal classied as Abnormal Abnormal classied as Abnormal Abnormal classied as Normal 856.dat Normal classied as Normal Normal classied as Abnormal Abnormal classied as Abnormal Abnormal classied as Normal 843.dat Normal classied as Normal Normal classied as Abnormal Abnormal classied as Abnormal Abnormal classied as Normal Data taken from MIT-BIH Database[11] Normal beats correctly detected : 82.79% Normal beats incorrectly detected : 17.21% Abnormal beats correctly detected : 70.13% Abnormal beats incorrectly detected : 29.87% 1033 45 2 4 897 192 22 10 1106 129 43 35 577 195 226 115 632 346 23 52 701 352 0 5 176 351 1 3 770 42 11 17

15

4.3

Observations made and problems in testing

. The following problems were observed while testing the ECG analysis system: 1. A problem observed was the fact that for premature beats the detection of the abnormality took place exactly a beat before the abnormal beat and for late beats it was detected exactly a beat later. The reason for this was attributed to the rough methodology adopted for ECG beat detection. When a premature beat occurred, because of taking the mid-points the beat length of the beat before the premature beat was lessened as a result the phase coupling between the frequencies was absent. Thus the abnormal beat was getting detected a step before or a step later.For instance Fig. 3.16 abnormality is actually at beat 5 however it is detected both at 4. 2. The system picked up 10 seconds of data (sampled at 128 Hz)in one go i.e. 1280 samples from the stored data analyzed, produced results and again picked 10 seconds of data and so on. The xed window size resulted in part of an ECG beat appearing at the end of a window and the other part of the same beat appearing in the other window . Since only a part of the beat appeared in a window the standard deviation was higher and the beat resulted in being classied as abnormal. 3. The data provided by [18] also contains annotations like change in the quality of the signal which have no relevance to the ECG data. While testing this posed as a problem. The problem was when you are doing a one to one matching of the annotations and their times. This kind of annotation would go undetected by the ECG analysis system resulting in a mismatch of the alignment of (annotation time given,annotation given) and (annotation time detected,annotation detected). Thus eectively reducing the accuracy. 4. The annotated data present on [18] varies in the time of annotation. Some databases like the MIT-BIH AFDB database annotate the signal at the start of the beat whereas the others like SVDB database do so towards the end.

4.4

Scope for improvement and research

The following points can be further improved in the system: 1. Beat Detection can be improved so that the problem of premature beat classication as mention in Sec. 3.2.4 can be done away with 2. A better understanding of bicoherence for choosing an appropriate slice instead of w=0Hz needs to be developed. 3. The system presented above merely tries to prove that a bicoherence based ECG classication system is possible , renements in detection of atness of the slice needs to be looked at. 4. Most of the ECG beats lying at the starting and ending of the 1000 size window were classied as abnormal because the windowing resulted in slicing these. Since the beats were incomplete the bicoherence resembled that of an abnormal beat. Thus a better mechanism like adaptive windowing needs to be looked at.

16

References

References
[1] www.medicinenet.com/electrocardiogram ecg or ekg/article.htm, As on April 2005. [2] www.nlm.nih.gov/research/visible/vhpconf98/AUTHORS/WERNER/IMAGES/ECG.GIF, As on April 2005 [3] J.M. Mendel Tutorial on higher order Statistics in signal processing and System theory: theoretical results and some applications, Proc. IEEE, vol. 79 pp. 278-305, Jan 1991 [4] LDR Sandeep Saxena Higher Order Spectrum of Biomedical Signals: Hardware Implementation, M. Tech Thesis, May 2004, IIT-D, India [5] M.R. Raghuveer Time-Domain Approaches to Quadratic Phase Coupling,IEEE Transcations on Automatic Control, Vol. 35, No. 1, January 1990 [6] Gangandeep S. Sandha, Pawan K. Singh, Neha Oberoi, D. Nagchoudhuri Phase Correlations in Human EEG Signal: A Case Study, Second IEEE International Workshop on Electronic Design, Test and Applications, January 2004 [7] Rangayyan RM. Biomedical Signal Analysis: a case study approach.Wiley, New York, NY, 2002. [8] Tompkins WJ. Biomedical Digital Signal Processing. Prentice Hall, Englewood Clis, NJ, 1989. [9] Ananthram Swami, Jerry M. Mendel, Chrysostomes L. (Max) Nikias Higher Order Spectral Analysis Toolbox: Users Guide ver 2.0. [10] http://www.cs.wright.edu/phe/EGR199/Lab 4/, As on April 2005 [11] GVS Chiranjivi, Vamsi Krishna Madasu, Madasu Hanmandlu, Brian C. Lovell Arrhythmia Detection in Human Electrocardiogram [12] tephanie Caswell Schuckers, Xueyan Xu, Michael E. Schuckers, Janice M. Jenkins Ventricular Arrhythmia Detection Using Time-Domain Template Algorithms [13] Laszlo Szilagyi Application of the Kalman Filter in Cardiac Arrythmia Detection, proceedings of the 20th Annual International Conference of the IEEE Engineering in Medicine and Biology Society, Vol. 20, No 1,1998 [14] Vinod V kumar A novel approach to pattern recognition in real time arrythmia detection,REC Trichi [15] Nitish V. Thakor, Yi-Sheng Zhu Applications of Adaptive Filtering to ECG Analysis: Noise Cancellation and Arrythmia Detection, IEEE Transsactions on Biomedical Engineering, Vol. 38, No.8, August 1991. [16] Valtino X. Afonso,Willis J. Tompkins, Truong Q. Nguyen, Shen Luo, Member, ECG Beat Detection Using Filter Banks, IEEE TRANSACTIONS ON BIOMEDICAL ENGINEERING, VOL. 46, NO. 2, FEBRUARY 1999 [17] A.Alliche,K.Mokarani,Higher order Statistics and ECG Classication [18] Ziad Elghazzawi, Fredrich Geheb Knowledge Based System for Arrhythmia Detection,Siemens Medical Systems,Danvers,MA,USA [19] MIT-BIH Databasehttp://www.physionet.org/physiobank/database/ecg, as on April 2005 [20] Meenakshi Sukhiya Low noise power interface design for Higher order Spectral analysis of ECG Signals, M.Tech. thesis, May 2004, IIT-D, India [21] Patrick S. Hamilton,Open Source ECG Analysis Software Documentation http://www.eplimited.com/ [22] Raman Arora,Shailesh Patil Methods of Quadratic Phase Coupling, B.Tech Thesis, Dept. of Electronics and Communications Enineering, NSIT, May 2001. [23] Chrysostomos L. Nikias and Jerry M. Mendel,Signal Processing with Higher Order Spectra, IEEE Signal Processing Magazine, July 1993

17

Você também pode gostar