Australas Phys Eng Sci Med DOI 10.1007/s13246-012-0149-x
TECHNICAL PAPER
A new approach of QRS complex detection based on matched filtering and triangle character analysis Yanjun Li • Hong Yan • Feng Hong Jinzhong Song
•
Received: 7 November 2011 / Accepted: 13 June 2012 Australasian College of Physical Scientists and Engineers in Medicine 2012
Abstract QRS complex detection usually provides the fundamentals to automated electrocardiogram (ECG) analysis. In this paper, a new approach of QRS complex detection without the stage of noise suppression was developed and evaluated, which was based on the combination of two techniques: matched filtering and triangle character analysis. Firstly, a template of QRS complex was selected automatically by the triangle character in ECG, and then it was time-reversed after removing its direct current component. Secondly, matched filtering was implemented at low computational cost by finite impulse response, which further enhanced QRS complex and attenuated non-QRS regions containing P-wave, T-wave and various noise components. Subsequently, triangle structure-based threshold decision was processed to detect QRS complexes. And RR intervals and triangle structures were further analyzed for the reduction of false-positive and false-negative detections. Finally, the performance of the proposed algorithm was tested on all 48 records of the MIT-BIH Arrhythmia Database. The results demonstrated that the detection rate reached 99.62 %, the sensitivity got 99.78 %, and the positive prediction was 99.85 %. In addition, the proposed method was able to identify QRS complexes reliably even under the condition of poor signal quality. Keywords Electrocardiogram QRS complex detection Matched filter QRS triangle
Y. Li H. Yan (&) F. Hong J. Song China Astronaut Research and Training Center, Beijing, China e-mail:
[email protected]
Introduction QRS complex is usually the most striking waveform in an electrocardiogram (ECG), which provides the fundamentals for automated ECG analysis. Therefore, seeking for a reliable QRS detection algorithm is important for automatic ECG diagnosis. QRS detection approaches have been proposed for over decades, e.g., filter banks [1], derivativebased algorithms [2–5], wavelet transforms [6, 7], Hilbert transform [8], matched filter [9], digital filters, artificial neural networks [1], genetic algorithms, adaptive filtering, hidden Markov models [1], length and energy transforms [1], mathematical morphology [1], et al. However, these algorithms have the common characteristic of requiring a preprocessing stage over the entire ECG signal before QRS detection, which increases the computational burden. Therefore, techniques without preprocessing are desirable when concerning in real time applications. On the other hand, these methods also have some common disadvantages. Methods of derivative-based algorithms, digital filters, length and energy transforms perform poorly on ECG interfered severely by high frequency noise, e.g. electromyogram (EMG) and abrupt potential change. Methods of matched filter, artificial neural networks, genetic algorithms, adaptive filtering, hidden Markov models are faced with the issue of requiring samples training or referenced signal. Besides, most methods meet with the common problems of too many parameters to calculate, too many complicated steps to finish, and too heavy burden of mathematical operation which prevent their usage in real time implementation. Therefore, achieving a simple way with high accuracy to QRS detection is still remarkable. QRS detection algorithm which uses a specific QRS template is considered to be the best way to prevent the QRS detection performance being degraded from the undesired
123
Australas Phys Eng Sci Med
Theory Matched filtering Frequency intervals of QRS complex were typically from about 10 to about 25 Hz [1]. However, the main frequency component of QRS complex changes obviously from one person to another because of the difference of gender, health state, age, individual character, et al. The different QRS spectra of different subjects make the usage of fixed band-pass filter rather ineffective and even risky. Therefore, filter with self-adaptive quality usually performs better than fixed band-pass filter during QRS detection, which responds with large waves to QRS regions and attenuates components of artifacts, P-wave, T-wave and baseline drift, simultaneously. The matched filter is usually providing an optimal signal-to-noise ratio (SNR) to QRS complex for each patient by selecting a good representative QRS complex interactively or unsupervised. Matched filter is optimized in attenuating noise with minimal possible interference to QRS complex, which is important to achieve an improved reliability to QRS detection. Moreover, fast speed in operation will be obtained when matched filter is implemented by FIR filtering, as is accomplished by Eq. (1) f1 ðnÞ ¼
N 1 X i¼0
123
where the impulse response {s} is the coefficient of FIR filter, which is equal to a QRS template that inverted in time, N is the length of the QRS template; {f0} is the input signal and {f1} is the output signal. Triangle character In previous study [10], we had used barycenter of QRS triangle to remove baseline wandering, which got better results in baseline wandering correction than filtering and function fitting methods. With a detailed study, we found that triangle character is also useful in detecting QRS complex. A triangle is defined by setting the onset point, peak point and offset point of a wave as three apexes of a triangle. In this way, the morphology of a wave is simplified as a triangle. A typical triangle extracted from a signal is shown in Fig. 1, and it could be any wave of P, Q, R, S, T, U or noise related waveform, which exists not only in an original ECG signal but also in its filtered signal. Because the waveform morphology of QRS complex is usually different from that of P-wave, T-wave, U-wave or noise related waveform, character of QRS triangle is also different from that of P-wave triangle, T-wave triangle, U-wave triangle and noise related triangle, which constitutes the foundation of triangle-based QRS detection. In this paper, triangle amplitude indices are defined from Eqs. (2) to (4), and time span indices are defined from Eqs. (5) to (7), slope indices are defined from Eqs. (8) to (10). These amplitude, time span and slope indices are used to identify QRS triangles in original ECG, and to locate QRS regions in filtered signal. Usually regions of QRS complex in filtered signals are more significant than that in original ECG. The QRS fiducial point is set at the location of the peak in upward QRS complex, or the valley in downward QRS complex. Supposed that triangle ABC in Fig. 1 is a QRS triangle of original ECG. Set point ‘A’ as the starting point of R-wave, ‘C’ the ending point and ‘B’ the peak point of R-wave. As a result, a QRS triangle is gotten which formed in DABC. 2 B (Bx,By)
1.5
Amplitude(mV)
noises that contributed from baseline drifts and artifacts such as electrode motion or power-line interference, and from other ECG components whose morphologies are similar with that of QRS complex (high T-waves for example). However, since the traditional template-matched technique involves intensive cross correlation-based similarity measurement between the QRS template and the windowed ECG segment, such a heavy computational burden might somehow undesirably restrict its use. Besides, QRS template is often extracted manually, which must be avoided in automatic analysis. In this study, a fast and reliable algorithm of QRS complex detection was proposed. Firstly, QRS template was extracted and transformed to the finite impulse response (FIR) coefficients without ECG preprocessing. Subsequently, matched filtering was performed by FIR filter and all triangles in matched signal were detected. Decision rules were applied to extract QRS triangles in matched signal, and RR intervals were achieved. Then, RR intervals and triangle structures were analyzed for the reduction of false-positive (FP) and false-negative (FN) detections. Finally, QRS complexes were located in original ECG according to QRS triangles in matched signals.
1 0.5 0 -0.5 A (Ax,Ay)
-1 0
C (Cx,Cy)
0.02
0.04
0.06
0.08
Time(s)
sðiÞf0 ðn iÞ;
ð1Þ
Fig. 1 A triangle in an original ECG or in its filtered ECG, with A, B and C as its three apexes
Australas Phys Eng Sci Med
The QRS complex is judged to be upward when the sign of kBA is positive and the sign of kCB is negative. Conversely, QRS complex is found to be downward if the sign of kBA is negative and the sign of kCB is positive.
The block diagram of the method is shown in Fig. 2, and details of the processing stages were presented in the following subsections.
hBA ¼ By Ay
ð2Þ
Extraction of QRS template
hBC ¼ By Cy
ð3Þ
h ¼ hBA þhBC
ð4Þ
wCA ¼ Cx Ax
ð5Þ
wBA ¼ Bx Ax
ð6Þ
wCB ¼ Cx Bx
ð7Þ
The impulse response of the matched filter is traditional manually taken from a few cardiac cycles, i.e., it needs to be determined interactively. However, QRS template was extracted unsupervised in this paper with 10 s length ECG. The stages of QRS template extraction were expressed as follows:
kBA ¼
x Ax 1 BX ½f ðiÞf ði1Þ Bx Ax i¼A þ1
ð8Þ
x Bx 1 CX ½f ðiÞf ði1Þ Cx Bx i¼B þ1
ð9Þ
raw ECG
x
kCB ¼
Extraction of QRS template
x
k¼jkBA jþjkCB j;
ð10Þ
where Ax is the x-coordinate and Ay the y-coordinate of point ‘A’; f stands for original ECG or filtered ECG. Values of |kBA|, |kCB| and k of QRS complex are usually bigger than those of non-QRS regions, which reveals that slope of QRS complex is usually steeper than that of other waves.
Detection of all apexes 'Q' in the first 10 seconds' waveform of raw ECG Set the first 10 seconds' wave of raw ECG 'f0'= 'g'. Detection of all triangles { A1B1C1} in 'g' based on 'Q' (1) Set B1= Q; (2) Find A1 and C1 according to B1 in 'g'; (3) A1B1C1 was constructed with A1, B1 and C1 as apexes. Selection of QRS candidate triangles { A2B2C2} from { A1B1C1} (1) Threshold was calculated for the selection of QRS candidate triangles; (2) B2 was selected from B1, then A2 and C2 corresponding to B2 were also gotten ; (3) QRS candidate triangles { A2B2C2} were constructed with A2, B2 and C2 as apexes. Selection of QRS candidate templates { A3B3C3} from { A2B2C2}, and construction of FIR coefficients 'b' (1) Threshold was calculated for the selection of QRS template; (2) QRS candidate templates { A3B3C3} were selected from QRS candidate triangles { A2B2C2}; (3) QRS template 'm' was constructed based on QRS candidate templates { A3B3C3}; (4) FIR coefficients 'b' were obtained by time-reversing the alternating current component of QRS template. FIR coefficients
Methods In this paper, original ECG was defined as ‘f0’, the first 10 s signal of ‘f0’ was named ‘g’, and the matched filtered signal that gotten from ‘f0’ was defined as ‘f1’. The overall process of QRS detection combined with algorithm evaluation was divided into five stages: (1)
(2) (3)
(4) (5)
QRS template ‘m’ was extracted automatically from ‘g’, and then was converted to be coefficients ‘b’ of FIR filter. Linear matched filtering was implemented on ‘f0’ by FIR filter, and the filtered result ‘f1’ was output. QRS triangles in ‘f1’ were detected, and RR intervals were achieved. Then RR intervals and triangle structures in ‘f1’ were analyzed to put right the FP and FN detections, respectively. QRS complexes in ‘f0’ were located according to the positions of QRS regions in ‘f1’. The performance of the proposed method was assessed using public standard manually annotated ECG database, namely, the MIT-BIH Arrhythmia Database. The performance of the proposed method was also compared with several classical methods of QRS complexes detection.
raw ECG
Matched filtering f1=filter(b,1, f0) ‘f0’ are input samples of raw ECG without noise eliminating, ‘f1’ are output samples of the matched filter, and ‘filter’ was the filtering function in MATLAB platform filtered ECG
Detection of QRS regions in filtered ECG Detection of all apexes ‘Q’ in filtered ECG ‘f1’ Detection of all triangles { A1B1C1} in ‘f1’ based on 'Q' (1) Set B1= Q; (2) Find A1 and C1 according to B1 in ‘f1’ ; (3) A1B1C1 was constructed with A1, B1 and C1 as apexes; (4) Set P1=B1 Selection of coarse QRS triangles { A2B2C2} from { A1B1C1} (1) Threshold was calculated for the selection of coarse QRS triangles; (2) B2 was selected from B1, then A2 and C2 corresponding to B2 were also gotten ; (3) Coarse QRS triangles { A2B2C2} were constructed with A2, B2 and C2 as apexes; (4) Set P2=B2 Correction of false-positive, selection of QRS triangles { A3B3C3} from { A2B2C2} (1) The lower limit of RR interval was chosen; (2) False-positive ones were deleted from {P2}, and the subset {P3} of set {P2} were gotten; (3) Set B3=P3, and QRS triangles { A3B3C3} were gotten. Correction of false-negative, construction of QRS triangles { A4B4C4} based on {P3} and {P1} (1) Time interval series {t3} were obtained from points {P3}; (2) Expected RR interval series {tm} were obtained after the median filtering to {t3}; (3) Case of t3(n)>1.5*tm(n) was further examined to correct the false-negative detections; (4) {P4} were obtained by combining {P3} and false-negative ones that found in {P1}; (5) Set B4=P4, and QRS triangles { A4B4C4} were gotten. position of QRS regions in filtered ECG
raw ECG
Location of QRS complexes in raw ECG (1) Maximum and minimum were found respectively in region [P4-3WR, P4+WR] of ‘f0’ for each point in {P4}, with WR as the width of QRS template; (2) Position and direction of QRS complex in ‘f0’ were found by comparing the slope of the points in maximum and minimum. position of QRS complexes in raw ECG
Fig. 2 Block diagram of the method
123
Australas Phys Eng Sci Med
(1) (2)
(3)
(4)
All apexes were detected in ‘g’, and were named as points ‘B1’. Points ‘A1’ and ‘C1’ corresponding to ‘B1’ were extracted respectively, and triangles {DA1B1C1} with A1, B1 and C1 as apexes were constructed in ‘g’. Triangles {DA1B1C1} that satisfied certain thresholds were selected as QRS candidate triangles {DA2B2C2} in ‘g’. A QRS candidate triangle that satisfied certain thresholds was selected as QRS template ‘m’, and the direct current (DC) component of QRS template was removed. After that QRS template without DC component was time-reversed to be FIR coefficients ‘b’.
Detection of all apexes in template-learning stage To judge whether a point ‘Pt’ was a peak point or not, its adjacent points were introduced. Peaks were detected by comparing each point ‘Pt’ in ‘g’ against its ‘N’ adjacent points backward and ‘N’ adjacent points forward, respectively. If all adjacent points backward and forward were no bigger than the value of ‘Pt’, then ‘Pt’ was defined as a detected peak ‘Q’. A peak point in position ‘d’ of ‘g’ must satisfy the condition that g(d) C g(d - i) && g(d) C g(d ? i), where i = 1, 2,…,N, and N is the number of sampling points at the sampling frequency ‘Fs’ during the time span ‘t’. Detected apexes were set as points ‘B1’. Unit of ‘Fs’ was sampling points per second, and ‘t’ as seconds. N was derived by Eq. (11), with t = 0.01 s. N¼bFs tc
ð11Þ
Detection of all triangles in template-learning stage Points ‘A1’ corresponding to ‘B1’ were extracted as follows: initially set n ¼ bFs 0:02c; got the initial x-coordinate of ‘A1’ by Eq. (12), and got kBA by Eq. (8). The precise position of the triangle beginning point ‘A1’ was located by searching backward from its initial position. The search continued (as n = n ? 1) until a value of ‘n’ was found to satisfy the inequation g(B1x - n) - g(B1x – n - 1) B 0.1 9 kBA. The final position of ‘A1’ was placed as Eq. (12). A1x = B1x n;
ð12Þ
where n bFs 0:02c: Points ‘C1’ corresponding to ‘B1’ were extracted as follows: initially set n ¼ bFs 0:02c; got the initial xcoordinate of ‘C1’ by Eq. (13), and got kCB by Eq. (9). The precise position of the triangle ending point ‘C1’ was located by searching forward from its initial position. The search continued (as n = n ? 1) until a value of ‘n’ was found to satisfy the inequation g(B1x ? n) - g(B1x ? n ? 1) B -0.1 9 kCB. The final position of ‘C1’ was placed as Eq. (13).
123
C1x ¼ B1x þ n;
ð13Þ
where n bFs 0:02c: As a result, triangles {DA1B1C1} with A1, B1 and C1 as apexes were constructed in ‘g’. Selection of some QRS candidate triangles QRS candidate triangles {DA2B2C2} selected from {DA1B1C1} must satisfy the following conditions: they were QRS triangles; more importantly, the morphology of QRS candidate triangles was the most common and frequent mode of all QRS triangles. The rest triangles in {DA1B1C1} which excluded QRS candidate triangles were defined as ‘dross’ triangles, i.e. ‘dross’ triangles contained not only P-wave triangles, T-wave triangles, U-wave triangles and noise related triangles, but also some QRS triangles which rarely appeared in ‘g’. This stage discarded the ‘dross’ triangles and selected the essential triangles as QRS candidate triangles. To determine whether a triangle was classified as QRS triangle or not, indices of time span and amplitude were compared to certain threshold, respectively. A threshold Thm_hBC for the selection of QRS candidate triangles was calculated as follows: set Th_hBC(j) as the biggest {hBC} in x-coordinate extent [2 9 (j - 1) 9 Fs, 2 9 j 9 Fs], and assumed the number of points ‘B1’ in x-coordinate extent [2 9 (j 1) 9 Fs, 2 9 j 9 Fs] was M, then Th_hBC(j) was gotten by Eq. (14). After that, the final threshold Thm_hBC was derived from Th_hBC, as Eq. (15). Th_hBC was computed every 2 s, and Thm_hBC was unique in the first 10 s waveform of raw ECG. Th hBC ð jÞ ¼ maxð½hBC ðn1 Þ hBC ðn2 Þ. . .hBC ðni Þ. . .hBC ðnM ÞÞ; ð14Þ where ni satisfies the inequation 2 9 (j - 1) 9 Fs B B1x(n1) \ B1x(n2) \ \ B1x(ni) \ \ B1x(nM) B 2 9 j 9 Fs. Thm hBC ¼ 0:3 median(½Th hBC ð1Þ Th hBC ð2Þ Th hBC ð3Þ Th hBC ð4Þ Th hBC ð5Þ
ð15Þ
Triangles {DA1B1C1} that satisfied the inequation wCA [ bFs 0:04c && wCA \ bFs 0:32c && (hBA [ 0.4 9 hBC || 0.4 9 hBA \ hBC) && hBC [ Thm_hBC) were selected as QRS candidate triangles {DA2B2C2}. Set the serial number of points B2 corresponding to points B1 was ‘nth’, then points A2, B2 and C2 were obtained from Eqs. (16) to (18), respectively. A2 = A1 ðnthÞ
ð16Þ
B2 = B1 ðnthÞ
ð17Þ
C2 = C1 ðnthÞ
ð18Þ
Construction of QRS template from QRS candidate triangles
(a)
A threshold Thm_k for the selection of QRS template was calculated as follows: set Th_k(j) as the biggest {k} in xcoordinate extent [2 9 (j - 1) 9 Fs, 2 9 j 9 Fs], and assumed the number of points ‘B2’ in x-coordinate extent [2 9 (j - 1) 9 Fs, 2 9 j 9 Fs] was M, then Th_k(j) was gotten by Eq. (19). After that, the final threshold Thm_k was derived from Th_k, as Eq. (20). Th_k was computed every 2 s, and Thm_k was unique in the first 10 s waveform of raw ECG.
Amplitude(mV)
Australas Phys Eng Sci Med
Th kð jÞ = maxð½kðn1 Þ kðn2 Þ. . .kðni Þ. . .kðnM ÞÞ;
(b)
an ECG signal with all peaks
Thm k ¼0:5 medianð½Th kð1Þ Th kð2Þ Th kð3Þ Th kð4Þ Th kð5Þ
1 0
where ‘m’ represents mean value computing to ‘m’, and index ‘i’ satisfies 1 B i B Cx - Ax ? 1. WR ¼ Cx Ax þ1
ð23Þ
b ¼ ½sðWR Þ s ðWR 1Þ. . .sðiÞ. . .sð2Þ s ð1Þ;
ð24Þ
where index ‘i’ satisfies 1 B i B WR. Most time indices in this paper were appropriately selected as ratios to the ECG sampling frequency Fs, or ratios to the QRS template width WR. In this way, waveforms of the QRS complex and T-wave would not be
0.8
1.2
onset
peak
offset
2 1
-1
ð22Þ
ECG
3
QRS candidate triangles {DA2B2C2} that satisfied the inequation k [ Thm_k && k \ 6 9 Thm_k could be used as QRS candidate templates {DA3B3C3}, i.e. points A3, B3 and C3 were the subset of points A2, B2 and C2, respectively. Too small k might be P-wave triangles or T-wave triangles, and too big k might be impulse noise. Any detected QRS triangle from QRS candidate templates {DA3B3C3} could be used as QRS template ‘m’, as applied of Eq. (21).
sðiÞ ¼ mðiÞ m;
0.4
an ECG signal with all triangles
0
where index ‘i’ satisfied Ax B i B Cx. Alternating current (AC) component ‘s’ was obtained by removing the DC component from QRS template ‘m’, as Eq. (22). The length of {s} was defined as WR, as given by Eq. (23), which was determined in accordance with the sampling rate of the original ECG signal. After that, AC component of QRS template was time-reversed to be used as FIR coefficients ‘b’, as Eq. (24).
0
Time(s)
ð20Þ
ð21Þ
peak
2
-1
Amplitude(mV)
ð19Þ
where ni satisfies the inequation 2 9 (j - 1) 9 Fs B B2x (n1) \ B2x(n2) \ \ B2x(ni) \ \ B2x(nM) B 2 9 j 9 Fs.
m¼½gðAx ÞgðAx þ1Þ. . .gðiÞ. . .gðCx Þ;
ECG
3
0
0.4
0.8
1.2
Time(s) an ECG signal with QRS triangles
(c)
ECG
Amplitude(mV)
3
onset
peak
offset
2 1 0 -1
0
0.4
0.8
1.2
Time(s)
Fig. 3 Extraction of QRS template, a all detected peaks in ECG, b all detected triangles in ECG, c QRS candidate triangles in ECG
merged together, and usually only one peak would be responded in filtered signal to one single QRS complex in raw ECG. An example of QRS template extraction is illustrated in Fig. 3. Firstly, all peak points were indicated in Fig. 3a. Secondly, not only QRS triangles but also other triangles of P-wave, T-wave and noise were detected, which are shown in Fig. 3b. Finally, QRS triangles were extracted and QRS template had been obtained, as shown in Fig. 3c. Matched filtering Since the template-matched technique which based on similarity measurement was usually implemented by intensive cross correlation between the QRS template and the windowed ECG segments, such a heavy computational
123
Australas Phys Eng Sci Med an ECG signal 3 2 1 0
ð25Þ
0
Amplitude(mV)
(b)
0.4
(3) (4)
(5)
Apexes of points ‘B1’ were detected in ‘f1’. Points ‘A1’ and ‘C1’ corresponding to ‘B1’ were extracted respectively, and triangles {DA1B1C1} with A1, B1 and C1 as apexes were constructed in ‘f1’. Triangles {DA1B1C1} that satisfied certain thresholds were selected as QRS triangles {DA2B2C2} in ‘f1’. Correction of FP was applied to QRS triangles {DA2B2C2} in ‘f1’, and corrected QRS triangles {DA3B3C3} were gotten. Correction of FN was applied to QRS triangles {DA3B3C3} in ‘f1’, and the final QRS triangles {DA4B4C4} were achieved.
Detection of all apexes in filtered ECG The peak points ‘Q’ in ‘f1’ which satisfied the condition wBA [ bWR 0:3c && wCB [ bWR 0:3c consisted the apexes series ‘B1’.
123
1.2
filtered ECG
peak
20 10 0 0
(c)
0.4
Time(s)
0.8
1.2
matched filtered ECG with triangles
30
filtered ECG
onset
peak
offset
20 10 0 -10
0
(d)
0.4
Time(s)
0.8
1.2
matched filtered ECG with QRS triangles
30
filtered ECG
onset
peak
offset
20 10 0 -10
0
(e) Amplitude(mV)
(1) (2)
0.8
matched filtered ECG with peak points
0.4
Detection of QRS regions in filtered ECG Matched filter made QRS complex detection easier and more credible in ‘f1’ than in ‘f0’. The stages for QRS complex detection in ‘f1’ were as follows:
Time(s)
30
-10
Amplitude(mV)
where ‘f0’ are input samples of raw ECG without noise eliminating, ‘f1’ are output samples of the matched filter, and ‘filter’ was the filtering function in MATLAB platform. The goal of matched filter is to form a signal that responds with high peaks to QRS occurrences and is relatively low in non-QRS regions, which is based on shaperesponsive instead of energy-responsive. The function of matched filter is like a band-pass filter, that suppresses low frequency noise of baseline wandering and high frequency noise of power-line interference and electromyography (EMG) interference. Moreover, matched filter is the optimal band-pass to QRS complex location when its filter coefficients are derived from QRS template, and peaks produced by QRS complex are significantly higher than those caused by non-QRS regions, e.g. T-wave and artifacts. An example of matched filtering is shown in Fig. 4. In original ECG of Fig. 4a, amplitude of T-wave was higher than that of R-wave. After matched filtering in Fig. 4b, amplitude of R-wave was obviously higher than that of T-wave.
-1
Amplitude(mV)
f1 = filterðb; 1; f0 Þ;
(a) Amplitude(mV)
burden somehow undesirably restricted its use in real time application [7]. However, the computational load of matched filter that implemented by FIR filter was very light, as shown in Eq. (25), which was nevertheless crucial for improving the time efficiency of QRS detection.
Time(s)
0.8
1.2
ECG with R wave peaks ECG
4
R wave peak
2 0 0
0.4
Time(s)
0.8
1.2
Fig. 4 An example of the proposed QRS detection algorithm, a an original ECG with clear waves of P, Q, R, S, T, b matched filtered signal with all detected peaks, c matched filtered signal with all detected triangles, d matched filtered signal with all detected QRS triangles, e original ECG with detected R peaks
Detection of all triangles in filtered ECG Points ‘A1’ corresponding to ‘B1’ were extracted as follows: initially set n ¼ bWR 0:3c; got the initial x-coordinate of ‘A1’ by Eq. (12), and got kBA by Eq. (8). The precise position of the triangle beginning point ‘A1’ was located by searching backward from its initial position. The search continued (as n = n ? 1) until a value of ‘n’ was found to satisfy the inequation f1(B1x - n) - f1(B1x – n - 1) B 0.3 9 kBA. The final position of ‘A1’ was placed as Eq. (12).
Australas Phys Eng Sci Med
Points ‘C1’ corresponding to ‘B1’ were extracted as follows: initially set n ¼ bWR 0:3c; got the initial xcoordinate of ‘C1’ by Eq. (13), and got kCB by Eq. (9). The precise position of the triangle ending point ‘C1’ was located by searching forward from its initial position. The search continued (as n = n ? 1) until a value of ‘n’ was found to satisfy the inequation f1(B1x ? n) - f1(B1x ? n ? 1) B -0.3 9 kCB. The final position of ‘C1’ was placed as Eq. (13). As a result, {DA1B1C1} with A1, B1 and C1 as apexes were constructed in ‘f1’, and points B1 of triangles {DA1B1C1} were defined as points series {P1}. Selection of coarse QRS triangles in filtered ECG ‘Coarse’ QRS triangles represented the detected ‘QRS triangles’ which might involve a few FP and FN detections. A large number of ‘fake’ QRS triangles often presented in triangles {DA1B1C1}, and a threshold Thm_h for the selection of QRS triangles was calculated. Firstly, set Th_h(j) as the biggest {h} in x-coordinate extent of [2 9 (j - 1) 9 Fs, 2 9 j 9 Fs], and assumed the number of triangles detected in ‘f1’ was M, then Th_h(j) was gotten by Eq. (26). Subsequently, the amplitude threshold Thm_h for the extraction of triangles {DA2B2C2} from {DA1B1C1} was obtained by Eq. (27). Th hð jÞ = maxð½hðn1 Þ hðn2 Þ. . .hðni Þ. . .hðnM ÞÞ;
ð26Þ
where ni satisfies the inequation 2 9 (j - 1) 9 Fs B B1x(n1) \ B1x(n2) \ \ B1x(ni) \ \ B1x(nM) B 2 9 j 9 Fs. Thm h ¼ 0:5 median ð½Th hð1Þ Th hð2Þ Th hð3Þ Th hð4Þ Th hð5ÞÞ
ð27Þ
Time index wCA and amplitude indices hBA, hBC, and h were used in the triangles selection step with regard to every detected triangle. Triangles selection was applied using the features of amplitude and time. Triangles {DA1B1C1} that satisfied the inequation wCA [ bFs 0:04c && wCA \ bWR 6c && (hBA [ 0.3 9 hBC && 0.3 9 hBA \ hBC) && h [ 0.4 9 Thm_h && (hBA [ 0.2 9 Thm_h || hBC [ 0.2 9 Thm_h) were selected as QRS candidate triangles {DA2B2C2}, and points B2 of triangles {DA2B2C2} were defined as points series {P2}. Correction of FP in filtered ECG Further decision rules were applied in order to reduce the number of FP detections, which put constraints on the timing feature to exclude QRS-like artifacts. According to the medical definition [5], the duration of normal RR interval usually ranges from 0.4 to 1.2 s. Jezior et al. [11] reported that a short RR interval which lower than 250 ms is a strong
indicator to sudden death. Bjerregaard [12] stated that only 5 % of patients had a pause RR interval that exceeding 1,750 ms. Based on the above stated research, a lower limit for RR interval should be 250 ms. To reduce the FN detections induced by the FP correction, threshold value of RR interval was defined as 0.25 s, i.e. if the RR interval of P2(n) - P2(n - 1) is less than 0.25 s, then either P2(n) or P2(n - 1) was a FP peak. As a result, on condition of P2(n) - P2(n - 1) \ bFs 0:25c; P2(n - 1) was the FP one and was deleted when f1(P2(n)) C f1(P2(n - 1)). On the contrary, P2(n) was the FP one and was deleted if f1(P2(n)) \ f1(P2(n - 1)). Finally, the subset {P3} from set {P2} were gotten, then triangles {DA3B3C3} that corresponding to apexes {P3} were extracted from {DA2B2C2} that corresponding to apexes {P2}. Correction of FN in filtered ECG This step was based on examining the conditions by applying some limits to the successive RR intervals which derived from apexes {P3} and the relationships between adjacent RR intervals. Time interval series {t3} were obtained from points {P3} by Eq. (28). Expected RR intervals named series {tm} were obtained after the median filtering to {t3}, as given by Eq. (29). t3 ðnÞ¼ðP3 ðnþ1Þ P3 ðnÞÞ=Fs ;
ð28Þ
where t3(n) is the nth RR interval, P3(n) and P3(n ? 1) are adjacent points of {P3}. tm ðnÞ = medianð½t3 ðn2Þ t3 ðn1Þ t3 ðnÞ t3 ðnþ1Þ t3 ðnþ2ÞÞ ð29Þ The missed peaks were generally found when the successive RR intervals had abnormally high value, which was superior to a suspect upper limit that reflects physiologically unreasonable values. The situation of t3(n) [ 1.5 9 tm(n) was perhaps produced by bradycardia or FN detection. Missed beats were corrected by checking the peaks of ‘P1’ in ‘f1’ whose amplitudes were bigger than a certain threshold. A FN was assumed to be found if the maximum value ‘Hmx’ of {h} that located in extent of [0.8 9 P3(n) ? 0.2 9 P3(n ? 1), 0.2 9 P3(n) ? 0.8 9 P3(n ? 1)] was bigger than 0.2 9 Thm_h, and the position of ‘Hmx’ was marked as the position of the FN one. R-wave peaks in ‘f1’ that called {P4} were obtained by combining the points {P3} and FN ones that found in {P1}, then triangles {DA4B4C4} corresponding to apexes {P4} were constructed. Location of QRS complex in raw ECG This stage was matching the positions of those extreme points {P4} in ‘f1’ to the original signal ‘f0’. Firstly, the extreme values of maximum and minimum in region [P4 - 3 9 WR,
123
Australas Phys Eng Sci Med
which could be downloaded from the URL ‘‘http:// physionet.org/physiobank/database/mitdb/’’. It contains 48 half-hour recordings of annotated ECG with a sampling rate of 360 Hz and 11 bit resolution over a 10 mV range. While some records contain clear R peaks and few artifacts (e.g., records 100–107), for some records the detection of QRS complexes is very difficult due to abnormal shapes, noise, and artifacts (e.g., records 108 and 207). Record 208 (Figs. 5, 6) gives a typical example for the described QRS detection above, which shows the characteristics of premature ventricular contraction (PVC) and normal beat in high SNR ECG. The output in each stage of this QRS
(a)
original ECG of Record 208 with corresponding QRS annotation 2
Amplitude(mV)
P4 ? WR] were found respectively in ‘f0’ for each point in {P4}. Maximum ‘Amx’ with position ‘Pmx’, and minimum ‘Amn’ with position ‘Pmn’ were found in extent of [P4 3 9 WR, P4 ? WR] respectively. Pmx - bFs 0:04c, Pmx and Pmx ? bFs 0:04c were used as x-coordinate of Ax, Bx and Cx respectively, then a triangle was constructed and the index ‘k’ called ‘Kmx’ was obtain by Eq. (10). In the same way, a triangle was constructed by three apexes of Pmn bFs 0:04c; Pmn and Pmn ? bFs 0:04c; and index ‘k’ namely ‘Kmn’ was obtained by Eq. (10). Then position and direction of QRS complex in ‘f0’ were found by comparing the slope of the points in maximum and minimum. Usually the slope of QRS complex is steeper than that of non-QRS waves. Consequently, an upward R-wave was found in position of ‘Pmx’ when Kmx C Kmn, otherwise a downward R-wave was found in position of ‘Pmn’ when Kmx \ Kmn. Generally, the window width for searching R-wave peaks in ‘f0’ should multiple to the duration WR of QRS template. With the consideration of the time delay that caused by FIR filtering, the window limits were set as [P4 - 3WR, P4 ? WR].
1 0 -1 N -2
1
F
V
2
N
V
3
V
N
4
V
5
6
Time(s)
Evaluation of the QRS detection algorithm
original ECG with all detected peak points
(b) 3
ECG
Amplitude(mV)
The QRS detection algorithm in medical usage requires the evaluation of the detection performance. Furthermore, to achieve comparable and reproducible results, the evaluation needs to be carried out on standard databases. Evaluation method
peak
2 1 0 -1 1
Se = TP/ðTP + FNÞ
ð30Þ
+P = TP/ðTP + FPÞ
ð31Þ
TL = TP + FN
ð32Þ
DER = ðFP + FNÞ=TL;
ð33Þ
2
3
4
5
6
Time(s) original ECG with all detected triangles
(c) 3
ECG
Amplitude(mV)
Sensitivity (Se) was calculated by Eq. (30), positive prediction (?P) by Eq. (31), and detection error rate (DER) of QRS detection from Eqs. (32) to (33).
onset
peak
offset
2 1 0 -1 1
2
3
4
5
6
Time(s)
Standard ECG databases Most frequently, the MIT-BIH Arrhythmia Database [13] is used to evaluate the performance of QRS detection,
123
original ECG with candidate triangles for QRS template
(d)
3 QRS template
Amplitude(mV)
where TP denotes the number of true positive detections, FN denotes the number of false-negatives, FP denotes the number of false-positives, and TL is the total number of QRS in annotation file. A FN occurs when the algorithm fails to detect a true beat (actual QRS) quoted in the corresponding annotation file, and a FP represents a false beat detection. The lower of the DER, the higher of the detection precision.
ECG
onset
peak
offset
2 1 0 -1 1
2
3
Time(s) 4
5
6
Fig. 5 Extraction of QRS template in record 208, a original ECG with corresponding QRS annotation, ‘N’ denotes normal beat, ‘V’ denotes PVC, ‘F’ denotes fusion of ventricular and normal beat, b peak apexes detection, c triangles detection, d QRS template selection from detected QRS triangles, the second triangle is used as QRS template in record 208
Australas Phys Eng Sci Med original ECG of Record 208 with corresponding QRS annotation
Amplitude(mV)
1 0 -1 V -2 853
N 854
F
V 855
N 856
F
V
N
857
matched filtered ECG with all detected peaks
(b)
2
0
854
855
Time(s)
40
onset
peak
20 0 -20 853
854
855
856
857
filtered ECG
0
854
855
856
857
filtered ECG
peak
0
(h)
peak
Amplitude(mV)
Amplitude(mV)
40 20 0
855
858
854
855
856
857
858
Time(s)
filtered ECG
854
857
20
-20 853
858
peaks after false-negative correction in matched filtered ECG
-20 853
856
40
Time(s)
(g)
offset
peaks after false-positive correction in matched filtered ECG
(f) peak
20
855
peak
0
Amplitude(mV)
Amplitude(mV)
40
854
onset
Time(s)
matched filtered ECG with extracted peaks
-20 853
858
20
-20 853
858
filtered ECG
40
Time(s)
(e)
857
matched filtered ECG with extracted triangles
(d) offset
Amplitude(mV)
Amplitude(mV)
filtered ECG
856
Time(s)
matched filtered ECG with all detected triangles
(c)
peak
20
-20 853
858
filtered ECG
40
Amplitude(mV)
(a)
856
857
858
R-wave peaks in original ECG 3
original ECG
upward R-wave
2 1 0 -1 853
Time(s)
854
855
856
857
858
Time(s)
Fig. 6 QRS complexes detection in record 208, a original ECG with corresponding QRS annotation, ‘N’ denotes normal beat, ‘V’ denotes PVC, ‘F’ denotes fusion of ventricular and normal beat, b peak apexes detection in matched filtered ECG, c triangles detection in matched filtered ECG, d QRS triangles selection in matched filtered
ECG, e R peaks in matched filtered ECG, f peak points after FP correction in matched filtered ECG, no changes from e, g peak points after FN correction in matched filtered ECG, no changes from f, h location of R-wave peaks in original ECG
detection algorithm is shown by Figs. 5 and 6. In triangles detection stage during QRS template extraction, not only QRS triangles but also other waves were indicated, as shown Fig. 5c. Further stage of QRS triangles extraction was indispensable. Moreover, it does not matter when some QRS triangles are omitted during the template extraction stage. As illustrated in Fig. 5d, two FN occurrence, because the QRS template must be safely selected from those true and most common QRS triangles that already detected even at the cost of FN ones. A QRS template is constructed by the ECG wave within one true QRS triangle. After matched filtering, regions in filtered signal as Fig. 6b corresponding to QRS complexes in raw ECG as
Fig. 6a were significantly enhanced, while other regions were relatively attenuated that corresponding to the undesired peaks of P-waves, T-waves and noises, which contributed greatly to the final stage of simple thresholding and decision-making for QRS complex.
Results Performance of the proposed method The proposed algorithm was realized using MATLAB codes and then was tested based on MIT-BIH Arrhythmia
123
Australas Phys Eng Sci Med
Database excluding episodes of ventricular flutter waves which only presented in the record 207. Only one channel of each record (lead MLII mostly) was applied for QRS detection with the aim of comparing with other published works. QRS detection results in Table 1 were very promising, as QRS detection rate of 99.62 %, sensitivity of 99.78 % and positive prediction of 99.85 % was achieved, although only modest detection results were achieved for some records in the database by the algorithm. In general, most FP detections were mainly due to too poor signal quality, i.e., noisy signals; and FN detections were induced by too small QRS complexes or sudden level changes to QRS complexes. The results shown in Table 1 by the proposed algorithm confirmed the ability to discriminate between true peaks and spurious ones by means of triangle morphological checking. The indices of amplitude, slope and successive RR interval, were used to detect previously missed peaks, by means of decreasing thresholds. In addition, some false peaks were found and eliminated by using RR interval limits. However, the proposed algorithm did not perform well on records 108, 203, 207 and 208. Actually, 65.98 % of FN ones and 72.62 % of FP ones were induced by those four records. The reason was that those records include multi origins problems such as high grade noise, multiform PVCs, abnormal high P-wave, high frequency noises, irregular RR events, QRS morphology changes, and significant changes of amplitude between adjacent QRS complex. Although the proposed algorithm did not perform very well on the records mentioned above, the results were still satisfying, as the worst error rate for record 108 is only 4.42 %. Comparison among different algorithms Comparison results with several other researches [2–8] were summarized in Table 2, which were organized in ascending sort by DER. In particular, Chen et al. [7] did not show the records of 106, 108 and 228, so that their overall error was calculated from 45 records. It can be observed from Table 2 that the proposed algorithm succeeds to have the third highest sensitivity among these eight algorithms, and the second highest positive prediction. Furthermore, the overall error of the proposed algorithm is the third lowest among the compared algorithms, since Yeha and Wanga [5] showed the lowest. Although the proposed detector with algorithms of Yeha and Wanga [5] and Benitez et al. [8] showed similar performances (both failure rates were \0.4 %) for QRS complexes detection, the proposed detector have the advantages as follows: (1) (2)
Preprocessing stage of ECG denoising is removed. QRS template is automatically extracted without supervision.
123
(3)
(4)
Matched filter is implemented by finite impulse response (FIR) filter at fast speed, which takes the place of cross correlation calculation. QRS complexes are located by structure analyzing of triangles in ECG, which makes the QRS detection stage very simple and prompt.
On the other hand, comparison results using five selected records were summarized in Table 3. Nevertheless result of every single record was never shown by Benitez et al. [8] or Madeiro et al. [6]. Comparison results from Table 3 showed that the proposed method succeeds to have the lowest DER for record 222, second lowest DER for records 105, 108 and 201, but the highest DER for record 203 because of multi patterns problems. Therefore, according to the results reported in Table 3, it could be concluded that the proposed method using triangle morphology as detection principle and RR timing for detection correction is suitable for time-varying morphology changes signals such as the records 201 and 222, and suitable for signals including high motion artifacts or high frequency noises such as the records 105 and 203.
Discussion Correction of FP and FN Among all ECG components, QRS complex usually has the most significant feature. However, it is acknowledged that QRS complex is varying with the physical variations and is also affected by noise as time evolves. Since some false peaks are thought to be QRS complex, or some true peaks are missed, correction based on RR intervals in this paper was introduced to identify whether the detected peaks were false or true. The correction stage to false detections consists of a search back technique, adaptive thresholds and the limits of RR intervals. The record 200 (Fig. 7) is characterized by PVC and high frequency noises, which is a typical example of FP correction. However, when the lower RR limit is too small, some FP ones may be reserved as their corresponding RR intervals are thought to be normal. On the contrary, when the lower RR limit is too big, some true detection ones may be discarded as their corresponding RR intervals are smaller than the lower RR limit. The record 106 (Fig. 8) presents morphological changes of QRS complexes, which is shown as a typical example of FN correction. Some wide PVCs responded small waves in filtered signal, e.g. the second PVC of Fig. 8, because the FIR coefficients of record 106 was derived from a normal QRS complex. However, some PVCs with narrow intervals responded obvious waves and were easy to identify, as the first PVC of Fig. 8. When a RR interval is abnormally high, it may be brought by arrhythmia or FN detection. Both PVCs and
Australas Phys Eng Sci Med Table 1 QRS detection results of the proposed algorithm using the MIT-BIH Arrhythmia Database (Excluding Episodes of Ventricular Flutter)
No.
Record
Lead
Total beats
1
100
MLII
2273
0
0
2
101
MLII
1865
1
1
3
102
V5
2187
0
0
100
100
4
103
MLII
2084
0
0
100
100
0
5
104
V5
2229
2
0
100
0.09
6
105
MLII
2572
14
16
99.46
99.39
1.17
7
106
MLII
2027
7
7
99.66
99.66
0.69
8
107
MLII
2137
15
10
99.30
99.53
1.17
9
108
V1
1763
34
44
98.07
97.52
10
109
MLII
2532
3
0
99.88
100
0.12
11
111
MLII
2124
1
0
99.95
100
0.05
12
112
MLII
2539
0
0
100
100
0
13
113
MLII
1795
0
0
100
100
0
14
114
MLII
1879
2
0
100
0.11
15 16
115 116
MLII V1
1953 2412
0 0
0 0
100 100
100 100
0 0
17
117
MLII
1535
0
0
100
100
0
18
118
MLII
2278
0
0
100
100
0
19
119
MLII
1987
0
0
100
100
0
20
121
MLII
1863
1
0
100
0.05
21
122
MLII
2476
0
0
100
100
0
22
123
MLII
1518
0
0
100
100
0
23
124
MLII
1619
0
0
100
100
0
24
200
MLII
2601
2
0
99.92
100
0.08
25
201
MLII
1963
6
0
99.69
100
0.31
26
202
MLII
2136
0
0
100
0
27
203
MLII
2980
82
46
97.25
98.44
4.30
28
205
MLII
2656
3
1
99.89
99.96
0.15
29
207
MLII
1860
24
10
98.71
99.46
1.83
30
208
MLII
2955
21
22
99.30
99.26
1.46
31 32
209 210
MLII MLII
3005 2650
0 10
0 7
100 99.62
100 99.74
0 0.64
33
212
MLII
2748
0
0
100
100
0
34
213
MLII
3251
0
0
100
100
35
214
MLII
2262
7
2
36
215
MLII
3363
0
1
37
217
MLII
2208
6
0
38
219
MLII
2154
1
0
39
220
MLII
2048
0
0
40
221
MLII
2427
1
0
41
222
MLII
2483
0
0
42
223
MLII
2605
0
0
43
228
V1
2053
1
0
44
230
MLII
2256
0
0
100
45
231
MLII
1571
0
0
46 47
232 233
MLII MLII
1780 3079
0 0
48
234
MLII
2753 109494
48 Patients totally
FN (beats)
FP (beats)
Se (%)
?P (%)
100
100
99.95
99.91
99.89
99.95
100
99.69 100
99.95
99.91 99.97
DER (%) 0 0.11 0
4.42
0 0.40 0.03
99.73
100
0.27
99.95
100
0.05
100
100
0
100
0.04
100
100
0
100
100
0
100
0.05
100
0
100
100
0
0 1
100 100
100 99.97
0 0.03
0
0
100
100
0
244
168
99.96
99.95
99.78
99.85
0.38
123
Australas Phys Eng Sci Med Table 2 Comparison of the results among different algorithms on MIT-BIH Arrhythmia Database Methods
Total records
Total beats
FN (beats)
FP (beats)
Se (%)
?P (%)
DER (%)
Yeha and Wanga [5]
48
109809
166
58
99.85
99.95
0.20
Benitez et al. [8]
48
109809
203
187
99.81
99.83
0.36
Proposed detector
48
109494
244
168
99.78
99.85
0.38
Adnane et al. [3]
48
109494
253
393
99.77
99.64
0.59
Pan and Tompkins [2]
48
109809
277
507
99.75
99.54
0.71
Paoletti et al. [4]
48
109809
379
565
99.66
99.49
0.86
Chen et al. [7]
45
102654
459
529
99.55
99.49
0.97
Madeiro et al. [6]
48
109494
1686
1073
98.46
99.02
2.52
FN (beats)
DER (%)
Proposed detector
105
2572
16
14
1.17
Adnane et al. [3]
Chen et al. [7]
Pan and Tompkins [2]
Paoletti et al. [4]
Yeha and Wanga [5]
108
1763
44
34
4.42
201 203
1963 2980
0 46
6 82
0.31 4.30
222
2483
0
0
0
105
2572
28
6
1.32
108
1763
55
28
4.71
201
1963
0
3
0.15
203
2980
27
53
2.68
222
2483
3
0
0.13
105
2572
78
5
3.23
108
1763
–
–
–
201
1963
0
21
1.07
203
2980
87
18
3.52
222
2483
1
0
0.04
105
2572
67
22
3.46
108
1763
199
22
12.54
201 203
1963 2980
0 53
10 30
0.51 2.78
222
2483
101
81
7.33
105
2572
73
31
4.04
108
1763
207
19
12.81
201
1963
2
17
0.96
203
2982
57
41
3.28
222
2484
112
92
8.21
105
2555
0
17
0.66
108
1757
6
0
0.34
201
1963
0
20
1.02
203
2964
16
2
0.60
222
2484
0
5
0.20
Note The dash ‘‘–’’ expresses not reported record
too small normal QRS complexes may respond small waves in filtered signal, which may be remedied when a second searching process is made with a smaller amplitude threshold.
123
Amplitude(mV)
FP (beats)
original ECG of Record 200 with corresponding QRS annotation 2 0 -2 V -4 609
N
V
610
N 611
V
N
612
V
613
614
Time(s)
(b) Amplitude(mV)
Total beats
matched filtered ECG with peak points 20
false-positive
filtered ECG
peak
10 0 -10 609
610
611
612
613
614
Time(s)
(c) Amplitude(mV)
Record
peak points after false-positive correction in matched filtered ECG 20
false-positive correction
filtered ECG
peak
10 0 -10 609
610
611
612
613
614
Time(s)
(d) Amplitude(mV)
Methods
(a)
peak points after false-negative correction in matched filtered ECG 20
filtered ECG
peak
10 0 -10 609
610
611
612
613
614
Time(s)
(e) Amplitude(mV)
Table 3 Comparison of the results among different algorithms on five typical records
R-wave peaks in original ECG 4 original ECG
downward R-wave
upward R-wave
2 0 -2 609
610
611
612
613
614
Time(s)
Fig. 7 QRS complexes detection in record 200 which contaminated by seriously noise, a original ECG with corresponding QRS annotation, ‘N’ denotes normal beat, ‘V’ denotes PVC, b R peaks in matched filtered ECG, c FP correction of peak points in matched filtered ECG, a FP beat has been discarded, d FN correction of peak points in matched filtered ECG, no changes from c, e R-wave peaks location in original ECG, here R-wave of beats ‘V’ is downward, and reversely R-wave of beats ‘N’ is upward
Australas Phys Eng Sci Med
Amplitude(mV)
(a)
original ECG of Record 106 with corresponding QRS annotation 2 0
-2
V
91
V
N 92
V
V
93
N
94
95
96
Time(s)
Amplitude(mV)
(b)
(2)
matched filtered ECG with peak points filtered ECG
40 false-negative
20
peak
false-negative
0 -20 91
92
93
94
95
96
Time(s)
Amplitude(mV)
(c)
peak points after false-positive correction in matched filtered ECG filtered ECG
40
peak
(3)
20 0 -20 91
92
93
94
95
96
Time(s)
Amplitude(mV)
(d)
peak points after false-negative correction in matched filtered ECG filtered ECG
40 false-negative correction 20
peak
false-negative correction
0 -20 91
92
93
94
95
96
Time(s) R-wave peaks in original ECG
Amplitude(mV)
(e) 4
original ECG
upward R-wave
2 0 -2 91
92
93
94
95
96
Time(s)
(4) Fig. 8 QRS complexes detection in record 106 a original ECG with corresponding QRS annotation, ‘N’ denotes normal beat, ‘V’ denotes PVC, b R peaks in matched filtered ECG, c FP correction of peak points in matched filtered ECG, no changes from b, d FN correction of peak points in matched filtered ECG, two FN beats have been complemented, e R-wave peaks location in original ECG, here both beats ‘V’ and beats ‘N’ in R-waves are upward
However, when the amplitude threshold is too small, some non-QRS complex may be thought to be QRS complex. On the contrary, when the amplitude threshold is too big, some true QRS complex may be missed. To resolve this problem, amplitude threshold was calculated during the learning stage from the first 10 s ECG, and small amplitude threshold was introduced during the stage of FN correction. Predominance of the proposed method The predominance of the proposed method was as follows: (1)
QRS template was extracted simply, automatically, and reliably. QRS template is crucially important to
(5)
template-based QRS detection algorithms, as a nonQRS template may induce wrong results. However, the proposed detector got a quite simple but reliable solution to select QRS template by analyzing the triangle characters. The stage of ECG denoising was canceled. The ECG collected from body surface is composed of actual cardiac electrical activity and various noises such as baseline drifts, power-line interference and motion artifacts [7]. In order to effectively improve the QRS detection, most presented method demanded an appropriate procedure for noise reduction before QRS detection. However, this proposed method accelerated running speed without the stage of denoising preprocessing. Optimized filtering was applied for the enhancement of QRS complex. Optimized filtering, i.e., matching filter is considered to be the best way to achieve good accuracy for QRS detection when ECG contains similar QRS waveform shape. Matched filtering enhances QRS regions greatly and suppresses non-QRS regions simultaneously, just like a proper band-pass filtering. In addition, FIR-based matched filter operation is a simple but adaptive one, which greatly reduces computational load but does not weaken the steep slope features of QRS complex. At this stage, the matched filtering was purely for the enhancement of QRS complex, which made the decision stage quite simple. As shown in Fig. 9b, matched filtering performed very well to ECG that interfered with EMG. As EMG is usually one of the most common noise which reduces the signal quality, such a property is really marvelous. QRS detection was realized by triangle measurement. Compared with classical index of peak height, additional information of timing and morphological features in triangles is used together for QRS detection. To improve the detection precision and reduce the number of misdetections, decision rules to QRS detection combines amplitude threshold, time span threshold, slope threshold of QRS candidate triangles, which makes QRS complex detection precisely. Reliable results were achieved for QRS complex detection. As revealed in Table 2, most QRS detection algorithms at presented got sensitivities and specificities above 99.5 %. For the purpose of actually clinical applications, the higher performance, the better; the faster speed, the better; the simpler realization mode, the better. The proposed detector in this paper achieved both sensitivities and specificities about 99.8 % with easy detection rules to deal with noisy or pathological ECG, and the implementation of the detector was very simple by triangle structure analyzing.
123
Australas Phys Eng Sci Med
(a)
original ECG with QRS annotation
2
N
N
N
N
N
0 -2 240
242
244
246
Amplitude(mV)
Amplitude(mV)
(a)
Amplitude(mV)
(b)
matched filtered ECG
20 0 -20 240
242
244
246
Amplitude(mV)
Time(s)
1 0 -1 -2
original ECG with QRS annotation
N
N
927
929
Amplitude(mV)
10 0 -10 927
929
Time(s)
931
933
original ECG with QRS annotation
2 N
0
N
N
N N
-2 1080
1082
N 1084
1086
20 10 0 -10 -20 1080
matched filtered ECG false-negative false-negative
false-positive
false-positive 1082
1084
1086
Time(s)
Fig. 9 QRS complexes detection in record 108 a original ECG interfered by EMG, b matched filtered ECG from a, c original ECG interfered by instantaneous poor contact between electrode and body surface, d matched filtered ECG from c, e original ECG interfered by motion artifacts, f matched filtered ECG from e
The proposed method sometimes outperformed the existing methods on poor quality signal, which was tested by one record ‘118e06’ of which SNR = 6 dB from the MIT-BIH Noise Stress Test Database [14], which could be downloaded from the URL ‘‘http:// physionet.org/physiobank/database/nstdb/’’. Record ‘118e06’ was created by adding noise to clean recordings ‘118’ from the MIT-BIH Arrhythmia Database [14]. As shown in Fig. 10a, some QRS-like noise exists among these true QRS complexes. Comparing the filtered signals that derived from Hilbert transform as Fig. 10b, band-pass filtering as Fig. 10c, wavelet transforms as Fig. 10d, length and energy transforms as Fig. 10e, and matched filtering as Fig. 10f, best feature signal was derived from
123
R
R
328
(b)
329
R
Time(s)
330
331
filtered ECG after Hilbert transform
2 1 0 328
(c)
329
Time(s)
330
331
filtered ECG after band-pass filtering
1 0 -1 328
(d)
329
Time(s)
330
331
filtered ECG after wavelet transforms
1 0 -1 328
329
(e)
Time(s)
330
331
filtered ECG after length and energy transforms
1 0 328
329
N
Time(s)
(f)
(6)
original ECG in record 118 whose SRN=6dB R
false-negative
Amplitude(mV)
Amplitude(mV)
933
matched filtered ECG
(e) Amplitude(mV)
931
Time(s)
(d)
Amplitude(mV)
N
N
N
N
Amplitude(mV)
Amplitude(mV)
(c)
Amplitude(mV)
Time(s)
1 0 -1 -2 -3
(f)
Time(s)
330
331
filtered ECG after matched filtering
10 0 -10 328
329
Time(s)
330
331
Fig. 10 QRS complex detection in record 118 with SNR as 6 dB a original ECG interfered by noise, b filtered ECG by Hilbert transform, c filtered ECG by band-pass filtering, d filtered ECG by wavelet transforms, e filtered ECG by length and energy transforms, f filtered ECG by matched filtering
matched filtering as least false detections was found in Fig. 10f by simple threshold decision. Great differences were observed when different approaches to QRS complex enhancement were employed in Fig. 10. FP detections had been found in Fig. 10b, c and e, by the method of Hilbert transform, band-pass filtering, and length and energy transforms, respectively. Both wavelet transforms and matched filtering had detected all QRS complexes of Fig. 10a, but is was more difficult and complicated to choose wavelet than to select QRS template, which made matched filtering the most effective way for QRS complex detection in ECG of Fig 10a. Deficiency of the proposed method The matched filtering needs a proper template. When a non-QRS waveform was chosen as a ‘QRS template’,
Australas Phys Eng Sci Med
Amplitude(mV)
(a)
others may become the missing heat-beats during ECG cycle segmentation.
original exercised ECG 3 2 1 T
T
T
0 R
T
-1 0
T R
R
0.5
1
Conclusion
T
R
R
1.5
R 2
2.5
Time(s)
(b)
matched filtered ECG by QRS template 20
Amplitude(mV)
R 10
R
R
T
R
T
T
R
R T
T
T
0
-10
0
0.5
1
1.5
2
2.5
Time(s)
Amplitude(mV)
(c)
matched filtered ECG by T-wave template 40
T
T
T
T
T
T
20 R
R
R
R
R
R
0
-20
0
0.5
1
1.5
2
2.5
Time(s)
A simple, robust, and reliable algorithm of QRS complex detection was proposed in this paper, which combined matched filtering with triangle morphological features. Reliable results of QRS detection had been accomplished based on MIT-BIH Arrhythmia Database. Compared to the classical detectors, the matched filtering based on QRS template is customized and adaptive to an individual subject. On the other hand, triangle-based character is applied to select QRS template and QRS triangles in ECG simply and effectively. Moreover, the overall computational structure of the proposed algorithm is adapt to detect QRS complex in high time efficiency. Furthermore, the proposed algorithm is capable of giving good results in noisy and multiform ECG signals. Acknowledgments This work was supported in part by Advanced Space Medico-Engineering Research Project of China (SJ201006), and supported by State Key Laboratory of Space Medicine Fundamentals and Application, China Astronaut Research and Training Center (SMFA12B09).
Fig. 11 Selection of QRS template in an exercised ECG a original exercised ECG, b matched filtered ECG by QRS template, c matched filtered ECG by ‘T-wave template’
References wrong results might be induced. An exercised ECG is shown in Fig. 11a, in which the amplitude of T-wave is higher than that of R-wave, and the time span of TP-segment is very short, which indicates the high level of physical load. However, matched filtering performed well when QRS complex was used as the QRS template, as shown in Fig. 11b. Whereas, QRS regions in filtered ECG were suppressived and T-wave regions were enhanced relatively when T-wave was chosen as ‘QRS template’ in Fig. 11c. However, QRS template was safely selected in this paper from those most common QRS triangles even at the cost of FN ones during learning stage. On the other hand, the matched filtering was based on the similarity of waveform morphology. As a result, when the morphology of T-wave or other waves are very similar with that of QRS complex, wrong detections may increase. PVC mostly leads to wide and bizarre waveforms, whose waveform morphology is often multiform. When the frequency component of QRS complex of PVC and that of QRS template were overlapped, significant QRS regions were responded to PVC after being filtered. On the contrary, some small PVCs omitted in filtered ECG were corrected later by FN correction, as shown in Fig. 8d, while
1. Ko¨hler BU, Hennig C, Orglmeister R (2002) The principles of software QRS detection. IEEE Eng Med Biol 1:42–57 2. Pan J, Tompkins WJ (1985) A real-time QRS detection algorithm. IEEE Trans Biomed Eng 32(3):230–236 3. Adnane M, Jiang ZW, Choi S (2009) Development of QRS detection algorithm designed for wearable cardiorespiratory system. Comput Methods Programs Biomed 93:20–31 4. Paoletti M, Marchesi C (2006) Discovering dangerous patterns in long-term ambulatory ECG recordings using a fast QRS detection algorithm and explorative data analysis. Comput Methods Programs Biomed 82:20–30 5. Yeha YC, Wanga WJ (2008) QRS complexes detection for ECG signal: the Difference Operation Method. Comput Methods Programs Biomed 91:245–254 6. Madeiro JPV, Cortez P, Oliveira F et al (2007) A new approach to QRS segmentation based on wavelet bases and adaptive threshold technique. Med Eng Phys 29:26–37 7. Chen SW, Chen HC, Chan HL (2006) A real-time QRS detection method based on moving-averaging incorporating with wavelet denoising. Comput Methods Programs Biomed 82:187–195 8. Benitez DS, Gaydecki PA, Zaidi A et al (2000) A new QRS detection algorithm based on the Hilbert transform. Comput Cardiol 27:379–382 9. Ruha A, Sallinen S, Nissil S (1997) A real-time microprocessor QRS detector system with a 1-ms timing accuracy for the measurement of ambulatory HRV. IEEE Trans Biomed Eng 44(3): 159–167 10. Song JZ, Yan H, Li YJ et al (2010) Research on electrocardiogram baseline wandering correction based on wavelet transform,
123
Australas Phys Eng Sci Med QRS barycenter fitting, and regional method. Australas Phys Eng Sci Med 33:279–283 11. Jezior MR, Kent SM, Atwood JE (2005) Exercise testing in Wolff–Parkinson–White syndrome: case report with ECG and literature review. Chest 127(4):1454–1457 12. Bjerregaard P (1983) Mean 24 h heart rate, minimal heart rate and pauses in healthy subjects 40–79 years of age. Eur Heart J 4:44–51
123
13. Moody GB, Mark RG (2001) The impact of the MIT-BIH Arrhythmia Database. IEEE Eng Med Biol 20(3):45–50 14. Goldberger AL, Amaral LAN, Glass L et al (2000) PhysioBank, PhysioToolkit, and PhysioNet: components of a new research resource for complex physiologic signals. Circulation 101(23): 215–220