**6. Conclusion**

This chapter presents and validates an algorithm based on the CWT with splines for the automatic measurement of QTd in the ECG quasi-orthogonal leads DI, aVF and V2. This algorithm permits the evaluation of the CWT in any integer scale which enables to use a wider range of scales and therefore to reduce noise and artifacts. In addition, the filters implemented in the algorithm based on *B*-splines are iterated discrete convolutions of moving sums, so that it can be computed without any multiplication, which results in a very efficient algorithm. Some functions of wavelet toolbox of MATLAB® related with this algorithm are as follows: the *spline* for cubic spline data interpolation, *cwt* that implements the CWT and *gauswavf* that returns the first order derivate of the Gaussian wavelet.

This new algorithm is based on the multilead generalization of a previous algorithm for single-lead detection of characteristic points of the QRS complex and T wave. It includes the identification of more types of morphologies of these waves, which are common in the analysis of several ECG leads and heart diseases. To evaluate its performance, ECG recordings of standard annotated databases MIT-BIH, QTDB and CSEDB were used. The results showed that the developed algorithm provides a reliable and accurate QRS detection and delineation of Qi and Te, with standard deviation of the errors within the tolerance limits for variations with respect to the measurements made by different experts.

The QTd algorithm was applied in two studies. In the first one, QTd was evaluated as a discriminator of patients with CKD from normal subjects. The results showed that QTd was significantly larger in CKD patients than in normal subjects, which agrees with similar studies. In the second study, QTd was analyzed in four patients with CKD before, during and after the HD treatment. The results showed that all the patients have an increase of QTd during HD and post-HD, which has been associated with malign ventricular arrhythmias and sudden death in previous studies.

Future applications of this algorithm will focus on to evaluate dispersion in other ECG ventricular activity intervals like JT (from S wave end to T wave end) and Tpe (from T wave peak to T wave end), in order to determine whether they improve the identification of CKD patients with risk of malign ventricular arrhythmias compared with QT dispersion.
