Sei sulla pagina 1di 6

2010 7th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE 2010) Tuxtla Gutirrez,

Chiapas, Mxico. September 8-10, 2010.

ECG Feature Extraction via Waveform Segmentation


Antonio Espiritu-Santo-Rincon and Cuauhtemoc Carbajal-Fernandez
Tecnologico de Monterrey, Campus Estado de Mexico Km 3.5 Carretera Lago de Gpe, 52926, Atizapan, Estado de Mexico, MEXICO E-mail: a00463012@itesm.mx, carbajal@itesm.mx
Abstract The analysis of the ECG signal is widely used for detecting a variety of cardiac pathologies. Most of the clinically useful information embedded in the ECG is related to the duration and amplitude of its individual components. Producing algorithms for the automatic extraction of the ECG features is complicated due to the time-varying nature of the signal resulting of variable physiological conditions and the presence of noise. This paper presents an algorithm for detecting the individual components of the ECG signal. First the R wave is precisely detected using wavelets, and then the other ECG features are extracted using a waveform segmentation approach. The algorithm was tested on the QT Database.

Fig. 1. Typical one-cycle ECG signal

KeywordsECG signal, feature extraction, MIT-BIH Arrhythmia Database, QT Database I. I NTRODUCTION The electrocardiogram (ECG) is a diagnostic tool that measures and records the electrical activity of the heart in detail. Being able to interpret these details allows the diagnosis of a wide range of heart problems. One cycle of the normal ECG is composed of a P wave, a QRS complex and a T wave, corresponding to the atrial depolarization, the ventricular depolarization and the rapid repolarization of the ventricles, respectively. A typical one-cycle ECG tracing is shown in Figure 1. Most of the clinically useful information embedded in the ECG is related to the duration and amplitude of its individual components. For instance, the QT c factor is used to diagnose the Long QT Syndrome (LQTS), which causes 4000 deaths in the US each year [1]. LQTS is a pathology that must be monitored 24/7 in order to diagnose it, and should be performed preferentially by portable devices, as stated by Tovar et al. [2]. It is also important to identify the morphology of the T wave. For instance, inverted T waves that are symmetrical, "round-shouldered" can be caused by coronary ischemia [1]. Producing algorithms for the automatic extraction of the ECG features is complicated due to the time-varying nature of the signal resulting of variable physiological conditions and the presence of noise. A signi cant number of techniques have been proposed to detect those features. Zhao et al. proposed a feature extraction method using wavelet transform and support vector machines [3]. Their experiments, carried out on MIT-BIH arrhythmia database [4], were oriented toward

the recognition of arrhythmias and normal beats. They did not try explicitly to detect the different components of the ECG signal. Castro et al. proposed also an algorithm based on the wavelet transform for feature extraction from the ECG signal and recognition of abnormal heartbeats [5]. Tadejko and Rakowski proposed a mathematical morphology based algorithm [6]. The focus of their work is the evaluation of an automatic classi er of the ECG signal for the detection of abnormal beats. Mahmoodabadi et al. described an algorithm for ECG feature extraction based on a multi-resolution wavelet transform [7]. In the rst step, the ECG signal was denoised by removing the corresponding wavelet coef cients at higher scales. Then, QRS complexes were detected and each complex is used to locate the peaks of the individual waves, including onsets and offsets of the P and T waves which are present in one cardiac cycle. They evaluated the algorithm on the MIT-BIH Arrhythmia Database, which consists of 48 ECG recordings. Each one has a duration of 30 min. and includes two leads the modi ed limb lead II and one of the modi ed leads V 1, V 2, V 4 or V 5 [8]. The sampling frequency is 360 Hz with a resolution of 5 microvolts per bit. Two cardiologists have annotated all beats. The large variety of ECG feature extraction algorithms, and the continuous efforts for their enhancement, proves that universally acceptable solution has not been found yet. This paper presents an algorithm for detecting duration and amplitude of the ECG individual components. First the R wave is precisely detected using wavelets. This part of the algorithm has been reported elsewhere [9]. Finally the other ECG features are extracted using a waveform segmentation approach. The algorithm may be summarized as follows. Once the R

IEEE Catalog Number: CFP10827-ART ISBN: 978-1-4244-7314-4 978-1-4244-7314-4/10/$26.00 2010 IEEE

250

2010 7th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE 2010) Tuxtla Gutirrez, Chiapas, Mxico. September 8-10, 2010.
wave has been identi ed, a segmentation of the ECG signal in an RR interval is performed. Within a range of samples, the maximum and minimum of each wave is searched. The maximum and minimum of the Q and S waves are searched independently from the others, as they are based on the R wave location only. P and T are dependant waves; they require some support points in order to determine their location. Those points are de ned as the end of S wave Sof f , the beginning of T wave T on, and the onset of Q wave, Qon. Finally the polarity of the T wave is determined. The rest of this paper is structured as follows. Section 2 details the P QS feature extraction. Section 3 details the T wave location procedure. Section 4 presents the method that searches for the presence of a negative T waveform. Section 5 discusses the results obtained from the application of the algorithm presented to the QT Database [10]. Finally, conclusions are drawn in section 6. II. PQS DETECTION ALGORITHMS The quality of P QS detection methodology depends upon the correct detection of the R waves that identify each individual heart beat. In this work, the R wave is identi ed by the wavelet-based algorithm proposed by Espiritu-Santo and Carbajal [9]. The results obtained from this step are the time indexes of all the R waves presented in the analyzed ECG signal record of the database [4]. The RR time interval is given by RR(i) = R(i + 1) R(i) (1)
Fig. 3. Q wave identi cation (150 samples in this case)

Fig. 2. Possible S waveforms (2000 samples each)

where R(i) represents the actual index of the R wave peak, R(i + 1) the index of the next R wave peak, and RR(i) the time interval between peaks i and i + 1. A. S wave detection The S wave represents the end of the QRS complex, which corresponds to the physiological ventricular depolarization. The search range for the S peak location starts at the R wave location plus an offset of 6 units. The shorter length of the S wave is estimated to be between 0.016 and 0.036 seconds, equivalent to 6 and 13 samples. The upper limit of the range is proportional to the RR interval. The longest length of the RS intervals is found to be around 0.27 seconds, assuming an RR interval of 1.41 seconds. In order to avoid searching within the same amount of samples in each beat, the searching range was reduced with a proportional factor related to the RR interval. Different S wave examples are presented in Figure 2. B. Q wave detection The Q wave represents the onset of the QRS complex. The Q peak location is found in an interval that starts at from 0.02 to 0.06 seconds corresponding to 8 and 22 samples respectively. Making it proportional to the heart beat length will make the range wider for most cases. For example, a patient with a QR interval equal to 8, can have RR equal to 292 and another can have QR equal to 19 and RR equal to 235. In this case, the range will be wider for longer RR

intervals, which can cause the algorithm to incorrectly place the Q wave. The Q wave detection is shown in Figure 3. 1) Q wave onset detection: The onset of Q, Qon, is the point with maximum amplitude before the negative peak of the Q wave. The index search range is Q 12 to Q 5. The Qon index needs correction because some points before it have higher amplitude. In order to correct the Qon index, it is needed to: Calculate the amplitude difference between Q and Qon using Equation 2: level = yQon (i) yQ (i) (2)

Set a proportional amplitude threshold to correct the Qon location to 0.90 if the amplitude difference between P and level is above 0.25, else set the threshold to 0.87. Starting from Qon, nd the rst value with less amplitude than level(i) threshold. Figure 4 presents the correction method of Q wave onset. C. P wave detection The P wave represents the auricular depolarization in the ECG. As this wave can be located near Q or far from it, the range also needs to be proportional to the RR interval.

IEEE Catalog Number: CFP10827-ART ISBN: 978-1-4244-7314-4 978-1-4244-7314-4/10/$26.00 2010 IEEE

251

2010 7th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE 2010) Tuxtla Gutirrez, Chiapas, Mxico. September 8-10, 2010.
III. T WAVE DETECTION The T wave is one of the most complex components to nd. Generating an algorithm to detect it is dif cult due to timevarying conditions, resulting in different approaches to solve this problem, mainly because the T wave might be inverted, leading to misclassi cation. As a rst approach, the T wave will be classi ed as the maximum point between S and the half point of the RR interval. The search area for T is limited to one half of the RR interval and the S wave index. This search interval represents an improvement to the work done by Tan [11], in which the T wave can overlap with the P wave in patients with no detectable P wave.
Fig. 4. Correction of the beginning of the Q wave

A. T wave onset detection The beginning of T wave, T on, is used as a support point in order to determine whether the polarity of T is positive, negative or at. This is an important process because negative or at T waves indicate cardiac ischemia, which is a harmful pathology. The point is searched as the minimum from the S wave to T with a given offset in each side. B. T wave end detection In the biomedical eld the end of the T wave, T of f , has been a point for discussion. Nowadays specialists differ when making the identi cation of the spot. The characteristics than can be used for the correct identi cation are the minimum amplitude after T within a limited range or the slope change when the heart polarization has been concluded. Both methods generate results that are similar, but could differ in presence of noise. 1) Slope method: At rst sight the slope method seems easy to implement as the T wave has a curved shape that become at at its end. Despite that, the amplitude change is so small in each step, that differentiating the signal results useless. Another fact is that measurement noise is an unavoidable characteristic of the ECG signal, which will cause the differentiation method to fail as the result in areas with noise will be greater than the expected. In the left half of gure 6 it can be observed that the differentiated signal lacks of a visible T wave. A method to avoid noise and amplify the T wave form is to add a number of previous values of the signal and then differentiate the result. This process will smooth the signal and will be easier to nd the end of the T wave. A mathematical simpli cation is possible as in Equation 5. SU M = s(i) + s(i 1) + + s(i n) (3) (4) (5)

Fig. 5. P wave search interval

The P R interval duration is beetween 0.09 and 0.19 seconds depending on the RR interval, equivalent to 19 and 38 samples respectively. Within the proportional aspect, the limits are 14% to 22% of the respective RR interval. In contrast with the P wave detection method proposed by Tan and Choi [11], this one does not rely on the difference method for R wave detection. It has also the advantage of detecting P waves with low amplitude and of not including T waves within P wave detection. So, depending on the search area size, two possibilities exist: Narrow search area: 0:81 RR(i) 7 to Q(i) 18. In the case of P wave detection, most cases can be found from :081 RR but patient 111, 209, 215 and 228 have wide QRS complex, moving the P location to 0:71 RR. Wide search area: 0:71 RR(i) 7 to Q(i) 18, considering the 4 patients with wide P R interval. The only disadvantage of this search area is when there is no detectable P wave and the ST segment is depressed, pushing the P wave detection towards the beginning of the search area in equation (6). Figure 5 is a representation of the proportional search intervals.

dif f = SU M (i)

SU M (i

1)

dif f (i) = s(i)

s(i

1)

In order to identify the index of T of f , the amplitude in dif f (i) should be greater than -0.005.

IEEE Catalog Number: CFP10827-ART ISBN: 978-1-4244-7314-4 978-1-4244-7314-4/10/$26.00 2010 IEEE

252

2010 7th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE 2010) Tuxtla Gutirrez, Chiapas, Mxico. September 8-10, 2010.
that tries to differentiate both morphologies was developed; it is based on a point system that considers 5 conditions that are related to negative T conditions. The conditions will have weighted values in order to decide whether T wave is positive or negative. The weighted conditions and values are the following:
Fig. 6. Identi cation of T of f using the slope method

Fig. 7. Identi cation of the T wave using the slope method

2) Sum method: Similar to the previous procedure, the sum method makes the signal smooth by adding previous values. This process will use consecutive decisions. If a point has greater amplitude than all of the previous 3 samples, it can be accepted as a T of f point. Both methods result in different T of f positions that are close to each other. Their difference is around 7 samples, equivalent to 0.0194 seconds. The search intervals for T on and T of f and the methods are presented in gures 6 and 7. Table I is presented in order to summarize the intervals used in sections 2 and 3. It includes the indexes of the lower and the upper limits of the search intervals. The search algorithms provide the indexes which satisfy the maximum or minimum conditions.
TABLE I. Search Intervals
Wave P Q Qon S T on T Beginning 0:71 RR(i) 7 RR(i) 25 Q(i) 12 R(i) + 6 0:7 ((T (i) S (i)) S (i) + 15 End Qon(i) 12 RR(i) 7 Q(i) 5 RR(i)=5 10 T (i) 10 RR(i)=2 Type max min max min min max

1) T on and S difference: In some cases the S T on interval is at and has a concavity near T . In some cases the concavity reaches the same amplitude of the S wave. 2) T and T on difference: Some negative T waves have low amplitude in the T peak if it is referenced to T on. 3) T - S + offset and T on: This indicates the slope before the T spot. If it is negative it can lead to a negative T classi cation. 4) T on T , T T of f : The amplitude difference of these points indicates the morphology of the supposed T wave. Normally T T on is smaller than T T of f , but the second factor can have a low result if the T wave polarity is inverted. 5) T on Sof f proportional factor: This quotient is greater than 0.22 only in T waves that are inverted. The limit must be adjusted for high cardiac frequencies. In normal cases the threshold is set to 0.22. If the current RR interval is less than 250 samples, set it to 0.24. If the amplitude difference between the T and T onset is less than zero set it to -0.05. This last value is related to ventricular tachycardia. If k 4 then T is negative.
TABLE II. Negative T wave weighted conditions
k +1 +1 +1 +2 +4 Operation yT on (i) yS (i) yT (i) yT on (i) yT (i) yS (i) + 5
yT (i) yT of f (i) yT (i) yT on (i) Ton (i) Sof f (i) RR(i)

Condition < 0:05 < 0:25 < 0:08 < 0:4 < threshold

Figure 8 shows how the algorithm works, highlighting in red the negative T waves. Positive T waves are highlighted in blue. In general, the algorithm detects most of the negative T waves, but is not completely accurate. The second adjustment of the threshold value is for ventricular tachycardia (V T ) cases as shown in Figure 9. Those cases have different structure in terms of T and T on amplitude difference. Negative T wave detection can also be used to decide if the QT interval should be calculated with the offset or the peak of T wave in equation (6). QTc = QT RR0:37 (6)

IV. P OSITIVE / NEGATIVE T WAVE DECISION Being able to classify whether T has a positive or a negative form, is an important step towards an effective ECG analysis system. It is important due to the fact that ischemia is the most common pathology when the T wave has negative morphology. It is also important to establish whether or not the T or T of f point is the correct one for a QT c analysis. A method

In the case of a negative T waveform, the QT interval is measured from the detected points referred as Q and T in this paper. Normal T waves involve a QT interval measured from Q to T of f .

IEEE Catalog Number: CFP10827-ART ISBN: 978-1-4244-7314-4 978-1-4244-7314-4/10/$26.00 2010 IEEE

253

2010 7th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE 2010) Tuxtla Gutirrez, Chiapas, Mxico. September 8-10, 2010.
Pn Perror (i) n

Pmean =

i=1

(9)

TABLE III. Feature extraction estimation error results for two les
Samples File 100: Mean Error 1.2 6.0 1.1 0.4 0.0 29 beats Absolute Error 1.7 6.2 1.6 1.6 0.4 File 117: Mean Error -0.1 0.5 -2.4 -4.5 -1.7 29 beats Absolute Error 3.5 2.1 3.5 4.6 1.7

P on P P of f Q R

Fig. 8. Detection of a negative T wave TABLE IV. Average feature extraction results
Samples P on P P of f Q R S T T of f Total: 145 beats Mean Error Absolute Error 7.1 12.5 3.0 7.3 -3.1 6.6 -3.1 7.2 1.2 2.6 -0.2 6.4 3.9 9.8 -1.2 9.3

Fig. 9. Adjustment of th threshold value for Ventricular Tachycardia

V. R ESULTS In order to validate this algorithm, the obtained results were compared with manual determined boundaries from a portion of the QT Database, including the signals that are also part of the MIT Arrhythmia Database. The manual boundaries are annotations made by experts, including the onset, peak and offset of P wave and QRS complex as well the T wave peak and offset. The results presented in this section compare the detection performance of the algorithm against the manual annotations in terms of the samples between them. The analysis presented in Table III includes the absolute error (Equation 8) and the average error (Equation 9). Both error measures are analyzed with the objective of determining whether the algorithm is failing in wave detection, fact that would be re ected in a high-magnitude absolute error. Table IV includes the combined results of the database analyzed signals (sel:100,103,114,117,123). Perror (i) = Palgorithm (i) Pn Pdatabase (i) (7)

jPerror (i)j n IEEE Catalog Number: CFP10827-ART ISBN: 978-1-4244-7314-4 978-1-4244-7314-4/10/$26.00 2010 IEEE PAbsError =
i=1

(8)

Results from Table III demonstrate that the detection method proposed in this paper delivers similar results to the manual annotations of the database [10]. For instance, the errors with greatest magnitude got from the le 100 are related the identi cation of P and T of f ; the average error was equal to 6 samples. In the le 117 the greatest errors are presented in the Q and S waves with an average of 4.7 samples. These errors are attributed to the different diagnosis methods, as le 100 is being annotated near Qon and S while le 117 is annotated near Q and Sof f , and the annotations are sometimes done in a midpoint. Despite the subtle difference between the manual annotations, the time range of the error for each wave is not greater than 0.04 seconds. The last result is presented in the bar plots of Figures 10 and 11, where each range is limited to one standard deviation with the mean error as the base value. Each bar plot order corresponds to the sequence of the ECG waves shown above. For example gure 10 order is fT; T of f; : : : ; S g and gure 11 order is fP on; P; : : : ; T of f g. Results from Table IV demonstrate that P on and T waves present the highest magnitude errors. The maximum absolute error found is equivalent to 0.03 seconds which is attributed to signals with special characteristics such as the lack of P wave (sel114). These results also demonstrate that the database annotations are not completely accurate, as the R wave absolute error is 2.6 samples. This error is attributed to the inexact location of the R wave in the positive peak of the QRS complex. The comparison of the results delivered by the algorithm and the annotations of the le 100, are important for the negative T

254

2010 7th International Conference on Electrical Engineering, Computing Science and Automatic Control (CCE 2010) Tuxtla Gutirrez, Chiapas, Mxico. September 8-10, 2010.
VI. C ONCLUSIONS This paper presents a proposal for PQST wave identi cation that proved to be accurate through visual analysis. The algorithms are simpli ed to the areas where each wave can be found and have been limited to minimum and maximum search. Perhaps this is the greatest disadvantage as the algorithm searches in the complete range even if the selected wave has been found. The negative T wave detection can be de ned with the established weighted values, and results in a simple computing process. Through the analysis of le 100, it has been concluded that the algorithm is performing a correct differentiation. In general, signal segmentation proved to be effective in the PQST wave detection algorithms as the deviation ratio for any of the waves is not greater than 0.04 seconds. In summary, the main contribution of this paper is an effective ECG feature extraction method that relies on wavelets and the search for maxima and minima within limited intervals. Due to its relative simplicity, this method seems adequate for its implementation on low power, portable devices. However, further work should be carried out in order to combine manual annotations and an adaptable algorithm that adjust some parameters depending on the observations made by the specialist. R EFERENCES
[1] Sociedad Mexicana de Cardiologa. Tratados de Cardiologa, Mxico D. F.: Ed. Distribuidora Intersistemas, 2006. [2] B. Tovar-Corona, J. Gonzlez-Villaruel, H. Becerra-Esquivel, A. JurezCarrazco, and A. Espritu-Santo-Rincn, "Prototype of a portable platform for ECG monitoring and diagnostic applications," 5th International Conference on Electrical Engineering, Computing Science and Automatic Control, 2008, CCE '08. pp.223-227, 12-14 Nov. 2008. [3] Qibin Zhao, and Liqing Zhan, ECG Feature Extraction and Classi cation Using Wavelet Transform and Support Vector Machines, International Conference on Neural Networks and Brain, ICNN&B '05, vol. 2, pp. 1089-1092, 2005. [4] Physiobank Archive Index, MIT-BIH Arrhythmia Database, PhysioNet, April 2010. [Online] Available: http://www.physionet.org/physiobank/database/mitdb/ [Accessed: May 19, 2010]. [5] B. Castro, D. Kogan, and A. B. Geva, ECG feature extraction using optimal mother wavelet, The 21st IEEE Convention of the Electrical and Electronic Engineers in Israel, pp. 346-350, 2000. [6] P. Tadejko, and W. Rakowski, Mathematical Morphology Based ECG Feature Extraction for the Purpose of Heartbeat Classi cation, 6th International Conference on Computer Information Systems and Industrial Management Applications, CISIM '07, pp. 322-327, 2007. [7] S. Z. Mahmoodabadi, A. Ahmadian, M. D. Abolhasani, M. Eslami, and J. H. Bidgoli, "ECG Feature Extraction Based on Multiresolution Wavelet Transform," 27th Annual International Conference of the Engineering in Medicine and Biology Society, 2005. IEEE-EMBS 2005, pp.3902-3905, 17-18 Jan. 2006 [8] R. Mark, and G. Moody, MIT-BIH Arrhythmia data base directory, Cambridge: Massachusetts Institute of Technology, 1988. [9] A. Espritu-Santo-Rincn, and C. Carbajal-Fernandez, "Discrete Wavelet Transform and Difference Method Applied to ECG R-wave Detection Algorithms," Electronics, Robotics and Automotive Mechanics Conference, 2010. CERMA '10, unpublished. [10] Physiobank Archive Index, QT Database, PhysioNet, April 2010. [Online] Available: http://www.physionet.org/physiobank/database/qtdb/ [Accessed: May 19, 2010]. [11] K. F. Tan, and K. L. Choi, "Detection of the QRS complex, P wave and T wave in electrocardiogram," First International Conference on Advances in Medical Signal and Information Processing, 2000, (IEE Conf. Publ. No. 476), pp.41-47, 2000.

Fig. 10. Sel100 analysis and deviation range in seconds

Fig. 11. Sel117 analysis and deviation range in seconds

wave detection proposal. In this speci c signal the algorithm is detecting the concavity of the T wave and classifying it as negative. This generates a point shifting in the classi ed waves, the original T on and T waves are renamed as T and T of f respectively. After this shifting process the average error of these waves is around 2 and 6 samples respectively whereas the results would be around 30 samples if the classi ed waves were not shifted. The designed search areas have considered the extreme length conditions for each one of the waves but will not be awless if a signal presents characteristics outside those limits. For further reference, the average processing time of the 30 minute signals, using T IC and T OC commands in MATLAB (Intel Centrino Duo @ 1.5 GHz, 2 GB RAM), is 0.375 seconds. In order to visualize the generalized search areas for the algorithms, Figure 12 is presented.

Fig. 12. Ranges of search for each ECG component

IEEE Catalog Number: CFP10827-ART ISBN: 978-1-4244-7314-4 978-1-4244-7314-4/10/$26.00 2010 IEEE

255

Potrebbero piacerti anche