An Algorithm Based on the Continuous Wavelet Transform with Splines for the Automatic Measurement of QT Dispersion: Validation and Application in Chronic Kidney Disease An Algorithm Based on the Continuous Wavelet Transform with Splines for the Automatic Measurement of QT Dispersion: Validation and Application in Chronic Kidney Disease

Chronic kidney disease (CKD) is considered a risk factor for the development of car- diovascular disease. QT interval is an electrocardiographic parameter that quantifies the duration of ventricular repolarization. An increase of its spatial variability measured from the selected leads of a standard electrocardiogram (ECG), named QT dispersion (QTd), is considered a risk factor for malign ventricular arrhythmias and sudden death in the CKD. An algorithm for automatic measurement of QTd in the ECG leads DI, aVF and V2 using the continuous wavelet transform with splines is presented. Validation of QRS complex detection has been done on records from MIT-BIH database, and the accuracy is 99.5%. Validation of detection of QRS wave onset and T wave end has been done on records from CSE and QT databases, and the measurements were within the tolerance limits for deviations with respect to the manual measurements defined by the experts. The algorithm was applied in two studies. In the first study, QTd was evaluated in nor mal subjects and patients with CKD. In the second study, QTd was analyzed in patients with CKD before, during and after the hemodialysis treatment. In both studies, the algorithm had a good performance for the QTd analysis. This new algorithm is based on the multilead generalization of a previous algorithm for sin-gle-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 analy sis 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 discrimi nator 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.


Introduction
According to the World Health Organization (WHO), cardiovascular diseases (CVDs) are the number one cause of death globally, and an estimated 17.7 million people died from CVDs in 2015, representing 31% of all global deaths, of these deaths, an estimated 7.4 million were due to coronary heart disease (CHD) [1].CHD is a narrowing or blockage of the blood vessels that supply blood and oxygen to the heart, then, the cells in the region served by the vessel will behave abnormally due to hypoxia (myocardial ischemia) or may die (myocardial infarction) [2].In Mexico, data of the National Institute of Statistics and Geography (INEGI) showed that in 2015, the heart diseases are the main cause of death, and the most frequent is the ischemic heart disease (IHD) [3].
The kidneys are a pair of bean-shaped organs that lie on either side of the spine in the lower middle of the back.Its main function is to remove soluble waste products and excess water and electrolytes from the bloodstream.Chronic kidney disease (CKD) is defined as abnormalities of kidney structure or function, present for 3 months or more, with implications for health [4].Abnormalities in kidney structure (damage) usually precede abnormalities in function.CKD is divided into five stages of increasing severity.Stage 5 referred to as kidney failure or end-stage renal disease (ESRD) is traditionally considered as the most serious outcome of CKD because there is total or near-total loss of kidney function and patients require treatment with dialysis or transplantation.
CKD is considered a risk factor for the development of cardiovascular disease (CVD) because patients with CKD are more likely to die of CVD than to develop kidney failure [4,5].Primary types of CVDs with a high prevalence in CKD are arterial vascular disease in its two subtypes: atherosclerosis and arteriosclerosis, and cardiomyopathy.Clinical presentations of atherosclerosis include IHD, manifested as angina, myocardial infarction and sudden cardiac death, which is common in CKD, cerebrovascular disease, peripheral vascular disease and heart failure [5].Patients with ESRD requiring maintenance hemodialysis (HD) have a high mortality rate, which is primarily attributable to CVD, including ventricular arrhythmias and sudden death, and the incidence of arrhythmias increases during and immediately after HD [6,7].
Therefore, the use and development of noninvasive techniques such as electrocardiography, which records the electrical activity generated by the muscles of the heart in the surface of the body, open a useful perspective for diagnosis and treatment in patients with heart diseases such as ischemia and infarction.The electrocardiogram (ECG) is the waveform produced by this electrical activity of the heart and its generation depends on four electrophysiological processes such as the formation of electrical impulse in the main heart pacemaker (sinoatrial node), the transmission of this impulse through specialized fibers in the conduction, the activation (depolarization) and the recovery (repolarization) of the myocardium [8].
The electrical activity generated by the heart can be modeled as a vector whose magnitude and direction change throughout the cardiac cycle.To record the different projections of this vector, several electrodes are attached to the body in different locations known as leads.Because each lead measures the ECG between two points from different directions, amplitudes, polarities, times and durations of the ECG components vary between leads, so these have been standardized.The lead system most accepted in clinical practice is the standard 12-lead system, that is, the combination of the bipolar limb leads I, II and III, the augmented unipolar limb leads aVR, aVL and aVF and the six unipolar precordial leads V1-V6.Limb leads (I, II, III) derive signals from the left arm (LA), the right arm (RA) and the left leg (LL).The right leg (RL) electrode is the common reference in the amplifier [8].
In Figure 1, waves and intervals of interest of the ECG are shown.The P, QRS and T waves reflect the rhythmic electrical depolarization and repolarization of the myocardium associated with the contractions of the atria and ventricles.The P wave represents depolarization of the atrial musculature.The QRS complex is the combined result of the repolarization of the atria and the depolarization of the ventricles, which occur almost simultaneously.The T wave represents repolarization of the ventricles.Time intervals like RR and QT are important in electrocardiographic diagnosis because they reflect electrophysiological processes of heart and autonomic nervous system (ANS) and carry clinical implications when they lie outside the range of the normal variation.The RR interval measured from the R wave peak to the peak of the next consecutive R wave is the interval between consecutive heart beats, and it determines the heart rate (HR).The QT interval measured from the Q wave onset to the T wave end reflects the total period of ventricular depolarization and repolarization, and it is used in clinical electrocardiology to quantify the duration of ventricular repolarization [9].Prolongation of the QT interval is recognized as an indicator of an increased risk of malignant ventricular arrhythmias and/or sudden cardiac death in various clinical conditions such as myocardial infarction or ischemia, electrolyte or metabolic imbalance or the action of various drugs [9,10].Also, QT interval has an interlead space variability, which led to the hypothesis that the differences between electrocardiographic leads might reflect regional differences in repolarization.Based on experimental and clinical electrophysiological studies which supported the evidence that increased heterogeneity of repolarization may be responsible for generation of malignant ventricular arrhythmias, the interlead variation of QT interval duration was proposed as an index of arrhythmia susceptibility [10].This measure was termed QT dispersion (QTd), and it was defined as the difference between the maximum and minimum QT interval on the standard 12-lead ECG [11].
Increased QTd has been associated with an increased risk for ventricular arrhythmias and sudden death in the general population and in various clinical conditions, among them, CKD is common.Several studies have reported that QTd increased in patients with ESRD, particularly after the end of HD [6,12], so that it may be useful to identify patients at high risk for overall and cardiovascular mortality [13].However, this index is affected by: an inaccurate measurement of the QT interval because of different definitions for the T wave end (with and without fusion with U or P waves), influence of HR, no simultaneous ECG leads recordings and number of ECG leads and of the ECG lead system used [14].
As beat-by-beat manual measurement of QTd on three orthogonal ECG leads is impractical in routine clinical practice, the development of accurate and robust methods for automatic detection of characteristic points of QRS and T waves is important in electrocardiographic diagnosis, in particular for the analysis of long recordings [15].Wavelet transform is a suitable tool that has been used to determine peaks and limits of ECG waves because of its ability to detect transients and of its robustness in front of noise and artifacts [16][17][18].This chapter presents the development of an algorithm based on the continuous wavelet transform (CWT) with splines for the automatic measurement of QTd in the quasi-orthogonal leads DI, aVF and V2, and its application for the analysis of QTd in patients with CKD.

Wavelet transform
Wavelet transforms at different scales describe the time characteristics of a signal in different frequency bands, but the analysis is restricted to scales that are powers of two [19].The use of B-splines as base functions permits the evaluation of the CWT in any integer scale [20], which enables to use a wider range of scales and to reduce noise and artifacts more efficiently.This feature can allow the direct application of the algorithm over the raw ECG signal without any preprocessing stage because frequency filtering is performed when the CWT is computed.
The CWT of a time-continuous signal x ( t ) is defined as: where ψ * ( t ) is the complex conjugate of the analyzing wavelet function ψ ( t ) , and a and b are the scale and translation parameters, respectively.The function ψ ( t ) compresses or dilates depending on a , which enables the CWT to extract the low-and high-frequency components of x ( t ) .
To implement the CWT, a and b are usually discretized.If a is discretized over a sequence 2 j (j = 1, 2, …) , the analysis is restricted to scales that are powers of two, and the result is the dyadic wavelet transform that can be computed with Mallat's algorithm [19].
In this chapter, B-splines have been used which allow the evaluation of the CWT in any integer scale [20].In this formulation, the input signal x ( t ) and the analyzing wavelet ψ ( t ) are both polynomial splines of degree n 1 and n 2 , respectively.The splines considered are constructed from polynomial segments of degree n of unit length that are smoothly connected together at joining points called knots in such a way that guarantees the continuity of the function and its derivatives up to order (n−1) [21] Assuming that the input signal x ( t ) is characterized in terms of its B-spline expansion of degree n 1 and the sequence of B-spline coefficients c ( k ) Likewise, the wavelet ψ ( t ) is a spline of degree n 2 with its B-spline expansion B-splines satisfy a two-scale equation for any integer m , where m is not restricted to a power of two; thus, the wavelet expanded by a factor m can be expressed as: where the sequence u m n 2 ( k ) , when n 2 and m are not both even, is given by z transform, with Therefore, the resulting CWT at scale m evaluated at integer time samples is a polynomial spline function given by: where the notation 2 ) represents the upsampling of the sequence p by a factor of m , the filter u m n 2 is equivalent to a cascade of ( n 2 + 1) filters of moving average of order ( m − 1 ) with an offset k 0 that ensures its symmetry, b n developed by Arregui (written in MATLAB ® , The MathWorks Inc.) [22] calculates the CWT of the discrete signal x ( t ) at the integer scale m of the cubic spline wavelet ( n 2 = 3 ) with expansion coefficients spline p , where x ( t ) is considered a spline of order n 1 = 1 .Implementation of the program spwav is based on the fast algorithm proposed by Unser et al. [20], which is done in the following three steps: 1. Initialization: calculus of the B-spline coefficients c ( k ) that interpolate the signal x ( t ) and the convolution with the B-spline of order n 2 .2. Iterated moving sum: calculus of the scalar products of the signal x ( t ) with the B-splines of order n 2 dilated by a factor m and divided by the root of m .3. Zero-padded filter: filtering with the expansion coefficients, spline of the basis wavelet p upsampling (with zeros) by a factor of m to obtain wavelet coefficients.
The selected wavelet function ψ ( t ) is the first derivative of a fourth-order cubic B-spline expanded by two, which leads to the sequence p = (− 1, − 4, − 5, 0, 5, 4, 1) given in Table 1 of [20].This wavelet is similar to the first derivative of a Gaussian function so that it yields good time and frequency resolution (Figure 2).
The Fourier transform of the wavelet at five scales (e = 1, 2, 3, 8 and 10) at a sampling frequency of 500 Hz is shown in Figure 3, and their −3 db bandwidths are listed in Table 1.
In Table 2, the −3 dB bandwidths of the Fourier transform of the wavelet at four scales for the sampling rates of 250-1000 Hz are listed, which correspond to three ECG databases used in this study.MIT-BIH Arrhythmia database (MITDB) [23], QT database (QTDB) [24] and CSE multilead measurement database (CSEDB) [25] used for the validation of the algorithm have sampling rates of 360, 250 and 500 Hz, respectively.The PTB Diagnostic ECG Database (PTBDB) [26,27] and the E-HOL-12-0051-016 database of the Telemetric and Holter ECG Warehouse of the University of Rochester (THEWDB) [28] used for the application have a sampling rate of 1000 Hz.
Figure 4 shows the relation between the characteristic points of ECG and its CWT at four scales.Because of the form of the wavelet function selected, each distinct wave of the ECG corresponds to a pair of local maxima of the modulus (Pmm) of the CTW at each different scale with a zero crossing between them that corresponds to its peak.The rising slope of each wave Topics in Splines and Applications yields a minimum and the falling slope yields a maximum [16].According to the spectrum of the ECG waves [29], most of the energy of the ECG signal lies within the scales 2-10 (Figure 3).P and T waves have their major component at scales 8 and 10, but higher scales can be affected

Description of the algorithm
The algorithm for automatic measurement of QTd in the quasi-orthogonal leads DI, aVF and V2 is based on the multilead generalization of a previous algorithm for single-lead detection of characteristic points of the QRS complex and T wave using the CWT with splines [18].This new algorithm for multilead detection includes the identification of more types of morphologies of QRS complex and T waves [30], which are integrated with the previous algorithm for single-lead detection.Figure 5 shows the algorithm proposed which is organized in four modules.In the first module, different kinds of QRS complexes and T-waves are detected and identified.In the second module, the algorithm detects the Q wave onset, R wave peak and T wave end, which is based on an algorithm for single-lead detection previously mentioned [18].Next, the algorithm measures the QT and RR intervals from detections of significant points in each quasi-orthogonal lead.Finally, the algorithm calculates QTd as the difference in duration between the longest and shortest QT intervals measured on the three quasi-orthogonal leads and HR.

Detection of different kinds of QRS complex and T wave
As a first step in this stage, polarity of QRS complex and T wave is identified.QRS complex corresponds to a Pmm of the CTW and the scale used is w2, where it has its major component.
Then, the highest positive peak (Wpq) and its nearest negative peak backwards (Wnq) are searched within the first 2 s of the record in order to define the position of these peaks.If Wnq position is before the Wpq position, then the type complex is qRs, which is defined as positive QRS.If Wnq position is after the Wpq position, then the type complex is rS, which is defined as negative QRS (Figure 6).Flowchart of polarity detection of the QRS complex is shown in Figure 2 of [30].
To determine the type of QRS complex once its polarity is defined, two algorithms are applied depending if QRS complex is positive or negative.The algorithm to determine the type of QRS complex with positive polarity when R is higher, it defines if Q or S wave is present as follows.
From the onset of the Pmm corresponding to the R wave at scale w2, Q wave is present if the nearest positive peak backwards is larger than a defined positive threshold.From the end of this Pmm, S wave is present if the nearest negative peak forward is lower than a defined negative threshold.These peaks are detected by looking inside a search window defined by the maximal duration of both waves.This algorithm detects and identifies the morphologies qR, qRs, R and Rs (Figure 7).Flowchart of the QRS complex type detection when R is higher is shown in Figure 5 of [30].The algorithm to determine the QRS complex with negative polarity when S is higher, it defines if Q or R wave is present as follows.From the onset of the Pmm corresponding to the S wave at scale w2, R wave is present if the nearest negative peak backwards is lower than a defined negative threshold.From this point, Q wave is present if the nearest positive peak backwards is larger than a defined positive threshold.These peaks are detected by looking inside a search window defined by the maximal duration of both waves.This algorithm detects and identifies the morphologies qrS, rS and QS. Figure 8 shows rS complex type and its CWT at scale w2.Flowchart of the QRS complex type detection when S is higher is shown in Figure 6 of [30].
Identification of polarity and type of T wave is performed with two algorithms.The first one classifies T wave into only two types: positive and negative (although it is biphasic, ascending or descending) as follows.As T wave corresponds to a Pmm of the CWT and only in this procedure, the scale used is w4 to enhance its characteristics.The highest positive peak (Wpt) and its nearest negative peak backwards (Wnt) larger than a defined threshold are searched from the end of the Pmm corresponding to R or S wave in a window whose limits depend on HR [31].If Wnt position is before the Wpt position, then the T wave is positive or normal (Figure 9a).If Wnt position is after the Wpt position, then the T wave is inverted or negative.Flowchart of polarity detection of the T wave is shown in Figure 3 of [30].
The second algorithm to determine the type of T wave is applied after, once the R or S wave position is defined by the algorithm for single detection of characteristic points Topics in Splines and Applications described later [18], and before the T wave detection.To identify T waves, the same procedure used for detecting of Wpt and Wnt of Pmm of T wave described earlier is used.
According to the comparison of the absolute values of these peaks with defined thresholds and its position, the algorithm classifies five types of T waves: positive, negative, ascending, descending and biphasic (Figure 9b).Flowchart of the T wave type detection is shown in Figure 4 of [30].Topics in Splines and Applications

QRS detection
QRS complex is the most characteristic waveform in the ECG due to its shape with high amplitude, which makes its detection easier than other ECG waves.Its accurate detection in the presence of noise and interferences is the most important task in the ECG automatic analysis because it is used as a reference in the cardiac cycle to perform a more detailed analysis of other ECG waves, segments and intervals, as automated measurement of HR and QT interval.

Topics in Splines and Applications
According to the wavelet function selected, QRS complex corresponds to a Pmm of the CWT at selected scale, where the R wave peak (Rp) corresponds to the zero crossing observed between the Pmm (Figure 6).The developed algorithm [18] detects the QRS by using the scale w2 and the Pmm corresponding to the R wave by defined threshold comparing inside a search window defined by the average RR interval and the last RR interval calculated [31].
From that Pmm, the start of the Q wave defined as Qi (or the start of R wave (Ri) in the absence of Q wave) corresponds to the zero crossing preceding the Pmm; the end of the S wave defined as Se (or the end of the R wave in the absence of the S wave) corresponds to the zero crossing after the Pmm (Figure 10).Those zero crossings are detected by looking inside a search window defined by the maximal duration of both waves.Flowcharts of the Rp and Qi (Ri) detection algorithms are shown in Figures 11 and 12, respectively.

T wave detection
Because of the low-frequency components of T wave [29], scale w3 of the CWT was used for its detection.The process for detection of positive and negative T waves is as follows: from the end of the Pmm of the Rp, we define a search window whose length decreases when RR diminishes [31]; inside that window, we look for the Pmm corresponding to the T wave that exceeds a defined threshold.The end of this Pmm and the zero crossing between them, corresponds to, respectively, the end (Te) and the peak (Tp) of the T wave.Detection and identification of ascending, descending and biphasic types depend on the number, polarity and absolute values of the found local maxima (Wpt) or minimum (Wnt).Figure 13 shows peak and end of the positive and biphasic T wave and their characteristic points of CWT at scale w3.Flowchart of the Tp and Te detection algorithm of T wave monophasic or biphasic is shown in Figure 14.

Measurement of QT and RR intervals and calculus of QTd and HR
Once Qi and Te have been detected, the algorithm measures the QT and RR interval points in each quasi-orthogonal lead.Finally, the algorithm calculates QTd as the difference in duration between the longest and the shortest QT intervals measured in the three quasi-orthogonal leads, in which each QT interval is the average of three consecutive QT intervals.HR is calculated from the average of RR intervals measured in the same leads, in which each RR interval is the average of two consecutive RR intervals.

QRS detection
The developed algorithm for QRS detection [18] has been first tested on eight 30 min recordings resampled to 500 Hz from the MITDB [23], in which only channel 1 of the two-channel ECG recordings was used.The selected recordings included serious noise bursts, baseline drifts and movement artifacts.Topics in Splines and Applications

Delineation of characteristic points of the QRS complex and T wave
The developed algorithm for delineation of Qi and Se of the QRS complex and Te of the T wave has been tested on 25 recordings from the CSE database [25], which includes 15 ECG leads and manual annotations on them.Table 4 shows the average (m) and standard deviation (sd) Tolerance limits for deviations according to experts [31] sd (CSE) 6. 5 30.6 Values are in ms; m, mean; sd, standard deviation.of the difference between the (WT-based) automatic and the (CSE) manual (annotated) location of those characteristic points.The results for that difference are within the tolerance limits accepted by the CSE experts, as shown in the last row of Table 4 [32].
Also, the algorithm has been tested on 15 recordings from MITDB included in the QTDB [24].Within each record of two channels, between 30 and 100 representative beats were manually annotated by cardiologists, who identified among other characteristic points of ECG waves, Qi of the QRS-complex and Te of the T-wave.Channel 1 was used in most recordings, in case of ECG distorted, channel 2 was used.Table 5 shows the mean (m) and standard deviation (sd) of the differences between the manual measurements (C1) and automatic measurements (WT) of Qi and Te for each record.The results for the differences between WT and C1 are within the tolerances for deviations with respect to the measurements made by the CSE experts, as shown in the last row of Table 5 [32].
Figure 15 shows some ECG excerpts of records with different T wave morphologies from QTDB with the manual annotations (square symbol) and the automatic detections (star symbol).It can be seen that Qi and Te are well determined by the algorithm, and its accuracy is comparable to a manual measurement of human experts.

Application in chronic kidney disease
The QTd algorithm was applied in two studies.In the first study, QTd was evaluated in normal subjects and patients with CKD.In the second study, QTd was analyzed in patients with CKD before, during and after the HD treatment.

QTd analysis in normal subjects and patients with CKD
In this study, 14 ECG recordings belonging to the PTBDB were used [26,27], where the quasi-orthogonal leads DI, aVF and V2 have been analyzed to obtain QTd.This database includes records of healthy people and patients with different pathologies.The study group was of seven normal subjects (two women and five men, age 66 ± 3.6 years) and seven renal insufficiency patients (three women and four men, age 70 ± 4.5 years).QTd corresponding to both groups was compared by the Wilcoxon rank sum test, where p < 0.05 was considered statistically significant.

QTd analysis in patients with CKD before, during and after hemodialysis
In this study, four ECG records of patients with CKD in the stage referred to as kidney failure or ESRD of the THEWDB [28], before (pre-HD), during and after (post-HD) HD session were used.For each patient, the three quasi-orthogonal leads DI, aVF and V2 have been analyzed to obtain QTd in a period of 10 h, in which pre-HD, HD and post-HD periods correspond to the hours 1, 2-6 and 7-10, respectively.Figure 16 shows the dynamics of QTd averaged every 15 min in a period of 10 h of the four CKD patients.It is observed 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 [6,12].

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.

Figure 1 .
Figure 1.Waves and intervals of interest of the ECG.

1 + n 2 +1
is the B-spline representation of a spline of order n 1 + n 2 + 1 and c ( k ) ′ s are the B-spline coefficients.The program w = spwav ( x, m, p, n 2 , n 1 )

Figure 2 .
Figure 2. First derivate of a fourth-order B-spline expanded by a factor of two.

Figure 3 .
Figure 3. Amplitude-frequency responses of equivalent filters at five scales for 500 Hz sampling rate.

Figure 5 .
Figure 5. Flowchart of the algorithm for automatic measurement of QTd in the leads DI, aVF and V2.

Figure 6 .
Figure 6.Polarity of QRS complexes and their CWT at scale w2.(a) Positive and (b) negative.

Figure 8 .
Figure 8. rS complex type and its CWT at scale w2.

Figure 10 .
Figure 10.Onset, peak and end of the QRS complex and its CWT at scale w2.

Figure 13 .
Figure 13.Peak and end of T waves and their CWT at scale w3.(a) Positive and (b) biphasic.

Figure 14 .
Figure 14.Flowchart of the Tp and Te detection algorithm of T wave monophasic or biphasic.

Figure 15 .
Figure 15.Automatic detections (star) and manual annotations (square) of Qi and Te with different types of morphologies of QRS complex and T wave in patterns of two beats of four records from QTDB.(a) rS positive T wave, (b) qRs biphasic T wave, (c) Rs biphasic T wave and (d) qR negative T wave.

Table 1 .
Frequency response of equivalent filters at five scales for 500 Hz sampling rate.

Table 2 .
Frequency response of equivalent filters at four scales for sampling rates of 250 and 1000 Hz.
An Algorithm Based on the Continuous Wavelet Transform with Splines for the Automatic… http://dx.doi.org/10.5772/intechopen.74864by baseline wandering.If the ECG is contaminated with high-frequency noise, scales 2 and 3 are the most affected.

Table 3
shows that QRS detector had 81 false QRS detections of 17,095 beats (0.47%); 51 of them were false positives and 30 were false negatives.

Table 3 .
Validation results for the QRS detection algorithm applied to eight records from the MITDB.

Table 4 .
Validation results for delineation algorithm of characteristic points Qi, Se and Te on 25 annotated recordings of the CSEDB.

Table 5 .
Validation results of the delineation algorithm of characteristic points Qi and Te for 15 recordings from the QTDB in ms.

Table 6 shows
QTd and HR in both groups.Difference in HR in both groups is not significant and therefore HR influence is similar in both groups [(67.7 ± 9) beats/min vs. (70.8±12)beats/ min, p = 0.53].QTd was significantly larger in patients with CKD than in normal subjects [(67.7 ± 28) ms vs.(21.4 ± 12), p = 0.0041].The results obtained showed that the algorithm is effective to differentiate both groups.

Table 6 .
QTd and HR in seven normal subjects and seven CKD patients.An Algorithm Based on the Continuous Wavelet Transform with Splines for the Automatic… http://dx.doi.org/10.5772/intechopen.74864 QTd in ms; HR in beats/min; m, mean; sd, standard deviation; p value is from Wilcoxon rank sum test.