 Research
 Open Access
New approach for Twave end detection on electrocardiogram: Performance in noisy conditions
 Carlos R VázquezSeisdedos†^{1},
 João Evangelista Neto†^{2, 3, 4}Email author,
 Enrique J Marañón Reyes^{1},
 Aldebaro Klautau^{2} and
 Roberto C Limão de Oliveira^{2}
https://doi.org/10.1186/1475925X1077
© VázquezSeisdedos et al; licensee BioMed Central Ltd. 2011
 Received: 14 March 2011
 Accepted: 9 September 2011
 Published: 9 September 2011
Abstract
Background
The detection of Twave end points on electrocardiogram (ECG) is a basic procedure for ECG processing and analysis. Several methods have been proposed and tested, featuring high accuracy and percentages of correct detection. Nevertheless, their performance in noisy conditions remains an open problem.
Methods
A new approach and algorithm for Twave end location based on the computation of Trapezium's areas is proposed and validated (in terms of accuracy and repeatability), using signals from the Physionet QT Database. The performance of the proposed algorithm in noisy conditions has been tested and compared with one of the most used approaches for estimating the Twave end point: the method based on the threshold on the first derivative.
Results
The results indicated that the proposed approach based on Trapezium's areas outperformed the baseline method with respect to accuracy and repeatability. Also, the proposed method is more robust to wideband noise.
Conclusions
The trapeziumbased approach has a good performance in noisy conditions and does not rely on any empirical threshold. It is very adequate for use in scenarios where the levels of broadband noise are significant.
Keywords
 Detection Error
 Tend Point
 Broadband Noise
 Noisy Condition
 Threshold Factor
Background
The Electrocardiogram (ECG) analysis is the heart diagnostic technique most used in the clinical practice due to its excellent benefitcost relationship. From the ECG signal, the following features are evaluated: amplitude, morphology and duration of its waves, intervals and segments as well as their appearance sequence.
Three variants of studies with QT interval have been done: (a) QT mean duration or QT length (QTL), (b) QT time variability or QT variability (QTV), and (c) spatial variability or QT dispersion (QTD). The last two ones are measures of the ventricular repolarization (VR) heterogeneity degree and they are typically computed using the standard deviations of QT intervals series measured through the time or the different ECG leads.
The prolongation of QTL was reported as a predictor of sudden death in patients with myocardial infarction [1]. QTD and QTV are techniques relatively recent in comparison with QTL, but there are reports of studies showing high QTV for isquemic patients [2] and high QTD as a marker of tachycardia ventricular [3].
As mentioned before, ECG signals are very often contaminated by noise and interferences. In [4] several sources of these are described and modelled: electromiographic (EMG) noise (due to muscle contractions), instrumentation noise generated by electronic devices, electrode contact noise, motion artefacts, electrosurgical noise, powerline interference and baseline drift due to respiration. In situations of high physical activity (ex. during the realization of physical exercises or stress tests), the EMG noise is the main source of error in the Tend detection because their random nature strongly affects the slow transition speed around each Twave end. This type of noise has broadband frequency characteristics which overlap with the frequency spectrum of Twave, and also occur in instrumentation noise. The motivation of this work has been to research an algorithm for Tend detection that is the least sensitive to the presence of broadband noise or Gaussian white noise (WN). The detection of Twave end (Te) point on ECG with high accuracy is determinant for QTV analysis because of its small variability (few milliseconds), mainly, in presence of broadband noise. For instance, if a sampling period is equal to 4 ms, a detection error of 4 samples (16 ms) could introduce a negative bias on the diagnostic.
Various methods have been proposed for detection of Tend point based on: intersection of lines [5], threshold on the amplitude of T wave [6], threshold on the first derivative of ECG signal [7], computation of: distances [8], angles [9] and areas [10], correlation with a template [11], mathematical models of ECG [12], and wavelet transform [13], among others methods. All have some advantages and some drawbacks in relation to complexity, computational cost, waveforms morphological variations, noise sensitivity and Tend dependence on threshold. It is not the purpose of this paper to review all the existing methods for Tend point detection. Instead, we will briefly summarize one of the methods mentioned earlier, because of its popularity over the years and in order to contrast the novelty of the method proposed in this paper.
I. Tend point detection based on threshold method on the first derivative (THD)
This method is based on the principle that the derivative of an isoelectrical segment (after reducing the noise and eliminating the line base drifts) is approximately null, while the derivative of the ECG waves, is not. It defines the Twave end as the point where the derivative crosses a certain threshold proportional to the Twave derivative maximum absolute value [7].
When K is high (for example, 10), the detected point will be nearer to the isoeletric segment, otherwise it will be nearer to the point of minimum (maximum) slope after the Twave peak for a positive (negative) Twave. This method has been applied to several studies, and demonstrated as robust. It is cheaper in terms of numerical computation and very useful to determine the Twave end for signals with small TP segments (for example, during intense exercise) because it predicts the Tend point from the computation of the maximum (or minimum) slope of the last segment of Twave and doesn't need any reference point in the TP segment. However, it has the problem of the empiric selection of the threshold that must be adapted to the level of an eventually nonstationary noise.
Up to our knowledge there are only three studies about the influence of noise on the accuracy of the Twave end detection. In [14] the RTend interval (from the Rpeak to the Twave end) is analysed using two computergenerated ECG signals with a single morphology of the Twave. In [15], the effect of noise is analysed based on the statistical indexes computed, again, from eight different estimations of "QT interval" time series, using simulated signals with only 6 different morphologies. In both papers the results express the measure of a differential interval that depends on the onset and offset positions simultaneously and not only on Twave end, as in this work. In [16] the Tend location error is studied by adding random noise to fifty morphologies of synthetic ECG recordings, but not using real signals.
The aim of this paper is to propose a new approach for the location of Twave end, and show its high performance (in terms of accuracy) in presence of noise using several morphologies of real signals from QT Database (QTDB) [17]. The proposed method is compared to the previous method, which was chose due to its wide use.
Methods
It is convenient to clarify that this paper considers only Twave end detection. Obviously, the Rwave point needs to be estimated first in order to delimit an interval that contains the Twave. Because the R point detection has been broadly described, no further discussion on this subject is pursued in this paper. Any Rwave detector with demonstrated robustness can be used. In [18] there is an extensive review of recent approaches for Rwave detection.
I. Method and Algorithm of the Trapezium's Areas
The trapezium's area (TRA) approach presupposes that T peaks are located, through the search of maxima and local minima in a window whose beginning is the previous peak of the R wave. During this search, the morphology can be also identified using some existing approaches, for example, the method proposed on [7]. Since our objective is to characterize the accuracy of the new Tend detector in presence of noise, we will consider an ideal detector which provides several values for the Twave peaks positions, similar to those annotated by the cardiologists.
The TRA method is based on the calculation of successive areas of a rectangular trapezium with three fixed vertexes and one mobile vertex: (x _{ i } , y _{ i } ), which is shifted through the signal, from (x _{ m } , y _{ m } ) to (x _{ r } , y _{ i } ), while the total area is computed. Twave end is defined as the point where the area A of the trapezium is maximum (Figure 3).
where:

(x _{ m } , y _{ m }) is the abscissa and the ordinate, respectively, of a point with the highest absolute derivative inside the Twave and after the last peak (maximum or minimum). The derivative value on this point is a minimum negative for positive Twaves and is a maximum positive for the negative Twaves.

(x _{ r } , y _{ r }) is the abscissa and the ordinate, respectively, of a reference point located on the TP isoelectric segment. The exact location is not very important as long as the point is beyond the Twave end.

(x _{ i } , y _{ i }) is the abscissa and ordinate, respectively, of a mobile point among the two points mentioned before.
As shown in Figure 3, the area A will be a:

minimum or zero when (x _{ i } , y _{ i }) is on the vertexes (x _{ r } , y _{ r }) or (x _{ m } , y _{ m }), respectively.

maximum when (x _{ i } , y _{ i }) is on the end of the Twave
The TRA algorithm is based on the method described previously. The steps of this algorithm are the following:
Preprocessing
 1)
Highpass filtering of the ECG signal (Butterworth, zerophase, 4^{th} order, cutoff frequency equal to 0.5 Hz) to reduce baseline wander.
 2)
Lowpass filtering of ECG obtained in (1) (Butterworth, zero phase, 4^{th} order, cutoff frequency equal to 30 Hz) to reduce noise.
Processing (assuming Twave peak positions)
 3)
Determination of the point identified as "x _{ m } " located in the segment after the T peak, which has a minimum (maximum) value in the first derivative, and be after the maximum (minimum) for a Twave positive (negative). For that, the algorithm searches in a 200 ms window, starting from the Twave peak (maximum or minimum). This segment is appropriate to embrace the x _{ m } point in the final segment of the wave T.
 4)
Determination of a point identifies as "x _{ r } " located inside the isoelectric segment and searched in a window between 200 ms and 400 ms, from the peak (maximum or minimum) of the Twave, preferably with a value of the first derivative near to zero. If no point satisfies this condition, the central point is chosen. Actually, the exact position of this point is not very important as long as it is beyond the T end point.
 5)
Calculation of the trapeziums areas of all the points located between "x _{ m } " and "x _{ r } ".
Decision rule
 6)
Identification of the point with maximum area identified as the Twave end.
II. Evaluation of the Trapezium's Areas Method: database and parameters
The evaluation of the Trapezium's areas method was performed with the QTDB, which constitutes a standard to validate and compare the Twave end detection algorithms.
This database consists of 105 15min twolead ECG recordings sampled at 250 Hz. It includes a variety of Twave morphologies chosen from several MITBIH databases (Arrhythmia, Supraventricular Arrhythmia, Normal Sinus Rhythm, ST Change Database, LongTerm Database, Sudden Death) and European STT Database. In 105 records, 3542 Twave ends have been annotated by one cardiologist and in 11 of these records another cardiologist annotated 402 Twave ends, being a total of 3944 beats. In each record, at least 30 beats have been manually annotated by cardiologists, labeling the end of the T wave (and others fiducial points). We discard some beats of poor quality for Twave end location: 703 of the 3542 annotated by cardiologist 1 and 129 of the 402 annotated by cardiologist 2, to give a total of 3112 detected beats.
Traditionally [18], four parameters have been used in the detector's validation:
Sensitivity, Positive Predictivity, the mean and the standard deviation of the detection errors, that is, the time difference between the automatic and the cardiologist annotation. In this work, we only computed the last two ones because of our assumption that the R and T peaks are located by an exemplar method (S = 100%, P = 100%).
 1.
Best beat per record (BB): the best result that minimizes the detection error among the two Twave end computed positions is chosen as the real Tend. This procedure was first adopted in [13] and later in [10]. The justification given in [13] is that the cardiologist has made his annotation by looking at both leads and his decision is based on the best lead. In clinical practice, this criterion requires a robust automatic decision rule.
 2.
Best lead per record (BL): the best ECG lead which contributes with the biggest number of Twave end points, according to the previous criterion, is chosen [19]. If the contributions of Tend are equal, the first lead is selected. This procedure is more realistic from the viewpoint of a human operator.
 (1)
for each annotated beat (by both cardiologists) on each record, the detection errors are computed,
 (2)
for each record i, the mean (M _{i}) and standard deviation (S _{i}) of the detection errors are calculated,
 (3)
for all records, the mean of all M _{i} (me) and the mean of all S _{i} (sd) are computed.
I. Performance in noisy conditions: Comparison between methods
Since each original approach (and its corresponding algorithm) uses different types of filtering, their performance could depend on the characteristics of the filters. To homogenize this dependence, the preprocessing used for the algorithm of the trapezes was the same for the first derivative method.
To be consistent with the clinical practice, for each record of QTDB, the "best ECG lead" was selected. As the signalnoise ratio (S/N) for each Twave (in the same lead) is different, it is not feasible to add noise by controlling the S/N ratio of the global lead. To guarantee a uniform noise level the control parameter will be the Twave peak amplitude (A _{TWP}) beat by beat. Broadband noise was simulated as zero mean WN added to ECG signal.
 1.
Highpass filtering followed by lowpass filtering like the preprocessing described for the TRA algorithm.
 2.
Obtain the reference Twave end using the method X (T _{ RX } ). The sub index "X" will be "D" for the threshold on the first derivative method; and T for the trapezium's areas method.
 3.
Compute the reference Twave peak amplitude (A _{TWP}) using the values of expert's annotations.
 4.
For each beat of filtered ECG signal, add WN of amplitude equal to N% of A _{TWP}, N = {1%, 5%, 10%, 20%}. For each level of noise, WN was generated 200 times and added back to filtered ECG signal; then it was lowpass filtered like in step 2, and the mean of 200 respective estimates of Twave ends was computed. This value becomes the Twave end for the level of noise N and method X (T _{ NX } ).
 5.
Obtain the successive estimates of the Twave end for each beat i, level of noise N and method X (T _{ NXi } ).
 6.Compute the modular percentage relative error (E _{ NX } ) for the algorithm "X" and level of noise N according to the following expression:${E}_{NX}=\overline{\sum _{i=1}^{k}\left\left(\frac{{T}_{NXi}{T}_{RXi}}{{T}_{RXi}}\right)\right}\times 100$(2)
where,
k is the total number of beats annotated by both cardiologist (3112)
T _{ NXi } is the ith Twave end obtained by algorithm X when the level of noise is N% of A _{TWP}. N = {3%, 5%, 10%, 20%},
T _{ RXi } is the ith reference Twave end for the algorithm X. For the algorithm of threshold on first derivative (THD), we use the following threshold factors: K = 2 (50%), K = 5 (20%) and K = 10 (10%).
E _{ NX } is the overall mean of the modular relativedetectionerrors due to added noise. It gives an idea of the upward or backward displacement (i.e. absolute) of the Tend position due to the effect of the noise. Therefore, E _{NX} is a measure of the method performance in noisy conditions. Signal processing was done on Matlab 7.7 (The MathWorks, Inc, Natick, MA).
Results and Discussion
I. Evaluation of the Trapezium's algorithm
The results of Table 1 show that, in terms of error mean value and SD, the proposed algorithm outperforms the other compared algorithm for both criteria. By examining the errors of the proposed algorithm, it has been observed that the large errors are mainly due to the incorrect elimination of the line base drifts when it changes abruptly. Thus, it is important to develop more accurate and robust methods (ex. adaptative or non linear filtering methods) for eliminating the line base drifts without deforming the morphology of the Twave final segment.
The obtained results are very similar to those reported by other Twave end detectors [10–13, 16], because the slight differences (in the mean detection error) are smaller than or around one sample (4 ms). The standard deviation for our algorithm is around two (three) samples for the BB (BL) criterion, which is within the expert tolerance limits (30,6 ms for the standard deviation) [20] and presents an excellent repeatability value in comparison with several algorithms presented in the last ten years [10–13, 16]. As we know, the annotation of the Twave end has not been adopted yet by specialists causing a high standard deviation among specialists.
II. Comparison between algorithms: Performance in noisy conditions
Comparison of modular percentage relative errors (E _{NX}) between the Trapezium's algorithm and THD algorithm (threshold factor is equal to 10%).
E _{NX}  3%  5%  10%  20% 

TRA  0.0029  0.0031  0.0038  0.0044 
THD 10%  0.049  0.050  0.093  0.137 
Significance level  p ≤ 0.071  p ≤ 0.135  p ≤ 0.047  p ≤ 0.047 
For the threshold of 50%, the mean error of the THD algorithm is the smallest, reaffirming the results described in [7] and is highest for the threshold K = 10. In [7], it was only considered the case with K = 2 (50%) because experimentally it showed the best performance. Nevertheless for K = 2, the Tend point is more far from the true end.
The better performance in the presence of noise of the TRA algorithm can be justified because the computation of areas corresponds to an integration process and therefore, attenuates the noise (lowpass filtering effect). In contraposition, the differentiation process that is implicit in the threshold algorithm is equivalent to a highpass filtering and therefore, amplifies the effects of noise (high pass filtering effect).
The selected noise levels are very high in some cases, mainly for some records of the QTDB which have high levels of noise where (and in spite of the lowpass filtering) the added levels increase considerably the present noise. For other practical situations, the level of noise is smaller, and the most attractive (distinctive) feature of the proposed algorithm is that it doesn't use any threshold factor, independently of the operation conditions (noises, interferences and devices).
Conclusions
This work presented the algorithm of the trapezes, a new method to estimate the Twave end that presents a low computational cost and mathematical simplicity. The proposed method showed a good performance in noisy conditions and it does not depend on any empiric threshold factor. The obtained results suggest the adoption of the Trapezium's approach in scenarios where the ECG is strongly contaminated by noise. The use of this approach could be extended to delineate the onset and offset of the other waves in ECG.
Notes
Declarations
Acknowledgements
This work was supported by the Cuban Higher Education Ministry (MES in Spanish), Brazilian National Council of Research (CNPq in Portuguese), and Brazilian Foundation of Help to the Research of the Amazon State of (FAPEAM in Portuguese).
Authors’ Affiliations
References
 Schuartz PJ, Wolf S: QT interval prolongation as predictor of sudden death in patients with myocardial infarction. Circulation 1978, 57: 1074–1079.View ArticleGoogle Scholar
 Vrtovec B, Starc V, Starc R: Beattobeat QT interval Variability in Coronary Patients. Journal of Electrocardiology 2000, 33: 119–125. 10.1016/S00220736(00)800680View ArticleGoogle Scholar
 Puljevic D, Smalcelj A, Durakovic Z, Goldner V: QT dispersion, daily variations, QT interval adaptation and late potentials as risk markers for ventricular tachycardia. European Heart Journal 1997, 18: 1343–1349.View ArticleGoogle Scholar
 Friesen GM, Jannette TC, Jadallah M A, Yates SL, Quint SR, Nagle HT: A comparison of the noise sensitivity of nine QRS detection algorithms. IEEE Trans Biomed Eng 1990, 37: 85–98. 10.1109/10.43620View ArticleGoogle Scholar
 Ferreti GF, Re L, Zayat M, Mazzara D, Rimatori C, Pupita G, Mannello B, Russo P: A New Method for the Simultaneous Measurement of the RR and QT Intervals in Ambulatory ECG Recordings. Computers in Cardiology, IEEE Computer Society 1992, 171–174.View ArticleGoogle Scholar
 McLaughlin NB, Campbell RW, Murray A: Comparison of automatic QT measurement techniques in the normal 12 lead electrocardiogram. Br Heart J 1995, 74: 84–89. 10.1136/hrt.74.1.84View ArticleGoogle Scholar
 Laguna P, Thakor NV, Caminal P, Jane R, Yoon HR, Bayes de Luna A: New algorithm for QT interval analysis in 24hour Holter ECG: performance and applications. Med Biol Eng Comput 1990, 28: 67–73. 10.1007/BF02441680View ArticleGoogle Scholar
 Helfenbein ED, Zhou SH, Lindauer JM, Field DQ, Gregg RE, Wang JJ, Kresge SS, Michaud FP: An algorithm for continuous realtime QT interval monitoring. Journal of Electrocardiology 2006, 39: S123S127. 10.1016/j.jelectrocard.2006.05.018View ArticleGoogle Scholar
 Daskalov IK, Christov II: Automatic detection of the electrocardiogram Twave end. Med Biol Eng Comput 1999, 37: 348–353. 10.1007/BF02513311View ArticleGoogle Scholar
 Zhang Q, Illanes Manriquez A, Médigue C, Papelier Y, Sorine M: An Algorithm for Robust and Efficient Location of TWave Ends in Electrocardiograms. IEEE Trans Biomed Eng 2006, 53: 2544–2552.View ArticleGoogle Scholar
 Last T, Nugent CD, Owens FJ: Multicomponent based cross correlation beat detection in electrocardiogram analysis. Biomed Eng Online 2004, 3: 26. [http://www.biomedicalengineeringonline.com/content/3/1/26] 10.1186/1475925X326View ArticleGoogle Scholar
 Vila J, Gang Y, Presedo J, FernándezDelgado M, Barro S, Malik M: A new approach for TU complex characterization. IEEE Trans Biomed Eng 2000, 47: 764–772. 10.1109/10.844227View ArticleGoogle Scholar
 MartÄ±nez JP, Almeida R, Olmos S, Rocha AP, Laguna P: A WaveletBased ECG Delineator: Evaluation on Standard Databases. IEEE Trans Biomed Eng 2004, 51: 570–581. 10.1109/TBME.2003.821031View ArticleGoogle Scholar
 Porta A, Baselli G, Lambardi F, Cerutti S, Antolini R, Del Greco M, Ravelli F, Nollo G: Performance assessment of standard algorithms for dynamic RT interval measurement: Comparison between RTapex and RTend approach. Med Biol Eng Comput 1998, 36: 35–42. 10.1007/BF02522855View ArticleGoogle Scholar
 Tikkanen PE, Sellin LC, Kinnunen HO, Huikuri H V: Using simulated noise to define optimal QT intervals for computer analysis of ambulatory ECG. Medical Engineering & Physics 1999, 21: 15–25. 10.1016/S13504533(99)000181View ArticleGoogle Scholar
 Martinez A, Alcaraz R, Rieta JJ: Application of the phasor transform for automatic delineation of singlelead ECG fiducial points. Physiol Meas 2010, 31: 1467–1485. 10.1088/09673334/31/11/005View ArticleGoogle Scholar
 Laguna P, Mark R, Golberger A, Moody GB: A database for evaluation of algorithms for measurement of QT and other waveform intervals in the ECG. Computers in Cardiology 1997, 24: 673–676.Google Scholar
 Kö hler BU, Hennig C, Orglmeister R: The principles of software QRS detection. IEEE Eng Med Biol Mag 2002, 21: 42–57. 10.1109/51.993193View ArticleGoogle Scholar
 Jane R, Blasi A, García J, Laguna P: Evaluation of an automatic detector of waveforms limits in holter ECG with the QT database. Computers in Cardiology 1997, 24: 295–298.Google Scholar
 The CSE Working Party: Recommendations for measurement standards in quantitative electrocardiography. Eur Heart J 1985, 6: 815–825.Google Scholar
Copyright
This article is published under license to BioMed Central Ltd. This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.