A Combined Syntactical and Statistical Approach for R Peak ... - MDPI

6 downloads 0 Views 3MB Size Report
Jun 7, 2018 - Ectopic beats caused by misdetection or arrhythmic events can ... beat rhythms are not directly caused by the ANS, significantly affects HRV ...
algorithms Article

A Combined Syntactical and Statistical Approach for R Peak Detection in Real-Time Long-Term Heart Rate Variability Analysis David Pang 1 and Tomohiko Igasaki 2, * 1 2

*

ID

Department of Human and Environmental Informatics, Graduate School of Science and Technology, Kumamoto University, Kumamoto 860-8555, Japan; [email protected] Field of Biomedical and Welfare Engineering, Division of Informatics and Energy, Faculty of Advanced Science and Technology, Kumamoto University, Kumamoto 860-8555, Japan Correspondence: [email protected]; Tel.: +81-96-342-3613

Received: 30 November 2017; Accepted: 5 June 2018; Published: 7 June 2018

 

Abstract: Long-term heart rate variability (HRV) analysis is useful as a noninvasive technique for autonomic nervous system activity assessment. It provides a method for assessing many physiological and pathological factors that modulate the normal heartbeat. The performance of HRV analysis systems heavily depends on a reliable and accurate detection of the R peak of the QRS complex. Ectopic beats caused by misdetection or arrhythmic events can introduce bias into HRV results, resulting in significant problems in their interpretation. This study presents a novel method for long-term detection of normal R peaks (which represent the normal heartbeat in electrocardiographic signals), intended specifically for HRV analysis. The very low computational complexity of the proposed method, which combines and exploits the advantages of syntactical and statistical approaches, enables real-time applications. The approach was validated using the Massachusetts Institute of Technology–Beth Israel Hospital Normal Sinus Rhythm and the Fantasia database, and has a sensitivity, positive predictivity, detection error rate, and accuracy of 99.998, 99.999, 0.003, and 99.996%, respectively. Keywords: electrocardiogram (ECG); real-time R peak detection; long-term heart rate variability (HRV) analysis; automata; normal sinus rhythm (NSR)

1. Introduction Electrocardiography (ECG) is the graphical representation of the electrical activity of the heart over periods of time. ECG signals can generally be acquired through simple noninvasive recordings and manifest as a series of waves characterized by three main wave types: P, QRS, and T. The QRS complex is the most distinctive feature in ECG signals indicating the heartbeat, and its fiducial marker is the peak of the R wave (Figure 1). Heartbeat regulation is performed by the autonomic nervous system (ANS), which influences many vital organs in the body [1]. Thus, inter-heartbeat intervals, which are usually measured using the RR intervals in an ECG, are constantly fluctuating. The heart rate variability (HRV) reflects the ANS activity, a relationship that provides considerable insight into many physiological and pathological factors that influence the normal heart rhythm [2–4]. Long-term HRV analysis has been proven helpful for clinical professionals in identifying autonomic impairment and providing prognoses of patient condition. The analysis can support the delivery of suitable medical treatments and prevent the development of diseases.

Algorithms 2018, 11, 83; doi:10.3390/a11060083

www.mdpi.com/journal/algorithms

Algorithms 2018, 11, 83 Algorithms 2018, 11, x FOR PEER REVIEW

2 of 12 2 of 12

Figure 1. A typical electrocardiography (ECG) waveform and RR interval. Figure 1. A typical electrocardiography (ECG) waveform and RR interval.

Because of its usefulness, our goal is to develop a system for a real-time long-term HRV analysis of its usefulness, goal is to develop a system for a real-time long-term that Because can be embedded into a our bedside monitor for use in intensive care units or highHRV care analysis units to that can be embedded into a bedside monitor for use in intensive care units or high care units to provide a quantitative assessment of long-term outcomes for patients [5]. Such analysis requires that provide a quantitative assessment of long-term outcomes for patients [5]. Such analysis requires that the analyzed HRV only reflects the ANS activity. Accordingly, ensuring that processed beats are the analyzed only reflects ANS activity. Accordingly, ensuring that processed beats are normal normal beatsHRV is essential for anthe effective analysis. In addition, the presence of arrhythmic events, in beats essential for an effective analysis. In addition, the presence of arrhythmic events, in which whichisbeat rhythms are not directly caused by the ANS, significantly affects HRV analysis. To beat rhythms areevents not directly caused data, by thesome ANS,authors significantly affects HRV analysis. eliminate more such eliminate such from tracked proposed excluding signalsTo containing events tracked some[6], authors excluding signals containing 10 ectopic than 10from ectopic beatsdata, per hour whileproposed others recommended accepting ectopicmore beatsthan comprising up beats per hour [6], while others recommended accepting ectopic beats comprising up to 5 [7], 8 [8],a to 5 [7], 8 [8], 10 [9,10], or even 15% [11] of all RR intervals. The study reported herein represents 10 [9,10], component or even 15%of [11] of all RR on intervals. The study reported herein represents a specific component specific our work HRV analysis systems, for which we intend to detect only the of our work on HRV analysis systems, for which we intend to detect only the normal heartbeat and normal heartbeat and exclude ectopic or arrhythmic heartbeats [5]. exclude ectopic or arrhythmic heartbeats [5]. In long-term R peak detection, noises that can distort the ECG signal, such as muscle noise, In long-term R peak thatmotion, can distort the ECGwander signal, caused such asbymuscle noise, some artefacts arising fromdetection, electrode noises and body and baseline perspiration some artefacts arising electrodeprobability and body motion, and baseline caused by perspiration and respiration, have from an increased of occurrence. Such wander noises make long-term R peak and respiration, have an increased probability of occurrence. Such noises make long-term peak detection more difficult in terms of both accuracy and effect on the physiological variabilityRof the detection more difficult in terms of both accuracy and effect on the physiological variability of the QRS QRS complex itself. A long-term HRV analysis requires a reliable and customized R peak detector to complex A long-term analysis requires a reliable customized peak detector to provide provide itself. information on an HRV uninterrupted series of normal and RR intervals. In R fact, a single misdetection information on an uninterrupted series of normal RR intervals. In fact, a single misdetection of an or R of an R peak can undermine the results of further analyses (e.g., time-domain, frequency-domain, peak can undermine results of further analyses (e.g.,method time-domain, frequency-domain, or nonlinear nonlinear analysis). the In this work, we propose a new designed to accurately detect in real analysis). In this work, we propose a new method designed to accurately detect in real time R HRV peak time the R peak of normal heartbeats from long-term ECG signals specifically intendedthe for of normal heartbeats from long-term ECG signals specifically intended for HRV analysis. analysis. A useful criterion criterion ininlong-term long-termECG ECGmonitoring monitoring is the energy consumption efficiency. A useful is the energy consumption efficiency. The The proposed method meets this criterion and that of computational efficiency. Moreover, it proposed method meets this criterion and that of computational efficiency. Moreover, it is is much much faster ForFor instance, finite impulse response (FIR)(FIR) filtersfilters are typically used faster than thanmost mostexisting existingmethods. methods. instance, finite impulse response are typically in the ECG preprocessing stage and have computational costs of at least (m × n), where m and n are then used in the ECG preprocessing stage and have computational costs of at least (m × n), where m and kernel and data sizes, respectively. Cascades of more than one FIR filter are commonly used, as is done are the kernel and data sizes, respectively. Cascades of more than one FIR filter are commonly used, in band-reject Depending the method, stage can employ as bandpass is done inorbandpass or filters. band-reject filters. on Depending on the the detection method, the detection stageeven can more complex computations or, at least, computations that are not less complex than O(n). In contrast, employ even more complex computations or, at least, computations that are not less complex than the proposed method a computational to n at theproportional preprocessing O(n). In contrast, thehas proposed method cost has proportional a computational cost to stage n at and the apreprocessing cost proportional k atathe stage,towhere k is a fraction of n.where This reduced computational stagetoand costdetection proportional k at the detection stage, k is a fraction of n. This complexity has been proven useful inhas ourbeen implementation of ainclient-based HRV detector It is also reduced computational complexity proven useful our implementation of a [5]. client-based appropriate for [5]. other in whichfor energy or implementations HRV detector It applications, is also appropriate otherconsumption applications,isina concern, which energy consumption that is a present limited processing resources (e.g., portable embedded devices). concern, or implementations that present limited processing resources (e.g., portable embedded The remainder of this paper is organized as follows: Section 2 describes the preprocessing method devices). and how peaks are detected; Section 3 describesas how performance the proposed The Rremainder of this paper is organized follows: Sectionis2improved describesusing the preprocessing algorithm and its overall low cost; and Section 4 concludes the paper. method and how R peaks are detected; Section 3 describes how performance is improved using the proposed algorithm and its overall low cost; and Section 4 concludes the paper.

Algorithms 2018, 11, 83

3 of 12

Algorithms 2018, 11, x FOR PEER REVIEW

3 of 12 3 of 12

Algorithms 2018, 11, x FOR PEER REVIEW 2. Materials and Methods

2. Materials and Methods

2. Materials andthe Methods Figure 2 shows proposed method comprising a preprocessing stage followed by a detection Figure 2 shows the proposed method comprising a preprocessing stage followed by a detection stage.stage. TheFigure preprocessing stage has two internal phases involving vectorization and removal. 2 shows the comprising stage followed by noise a detection The preprocessingproposed stage hasmethod two internal phasesa preprocessing involving vectorization and noise removal. stage. The preprocessing stage has two internal phases involving vectorization and noise removal. This stage is meant to perform signalsignal conditioning whilewhile reducing the amount of data, thereby making This stage is meant to perform conditioning reducing the amount of data, thereby This stage issucceeding meant to perform signal conditioning reducing theforamount of data, thereby the succeeding simpler andsimpler faster. After a signal suitable for processing is obtained, automata making thestep step and faster. Afterwhile a signal suitable processing is obtained, making succeeding step simpler and from faster. Afteraaprobability signal suitable forthe processing is obtained, recognize thethe candidate R peaks from a probability function selects correct peak. automata recognize the candidate R which peaks which function selects the correct peak. automata recognize the candidate R peaks from which a probability function selects the correct peak.

Figure Blockdiagram diagramof of ECG ECG signal Figure 2. 2. Block signalprocessing. processing. Figure 2. Block diagram of ECG signal processing.

2.1. Vectorization Process 2.1. Vectorization Process 2.1. Vectorization Process FIR filters are commonly used in the first signal processing stage; however, such filters have FIRdrawbacks. filters are commonly used thefirst firstsignal signal processing processing stage; however, filters have FIR filters are commonly used ininthe stage; however, such filters several For instance, their implementation can introduce a phase shiftsuch and modify thehave several drawbacks. For instance, their implementation can introduce a phase shift and modify the several drawbacks. For instance, their implementation can introduce a phase shift and modify morphology of the signal in a manner unsuitable for the succeeding process. Moreover, they have a the morphology of the signal in a manner unsuitable for the succeeding process. Moreover, they have morphology of the cost signal in a proportional manner unsuitable succeeding Moreover, they ahave computational at least to (m × n)for forthe kernel and data process. sizes m and n, respectively. computational cost at least proportional to (m × n) for kernel and data sizes m and n, respectively. Considering cost that at anleast ECG proportional is essentially atographical representation the sizes electrical activity in the a computational (m × n) for kernel andofdata m and n, respectively. Considering that an ECG is simplification essentially a graphical representation of the electrical activity in the heart, we common methods from computer as polyline Considering thatapply an ECG is essentially a graphical representation of thegraphics, electricalsuch activity in the heart, heart, we apply common simplification methods from computer graphics, such as polyline simplification, has a computational complexity of O(n) and reduces amount of data to a we apply common which simplification methods from computer graphics, such the as polyline simplification, simplification, which has athe computational of O(n) reduces the amount of to data fraction of n. We call this vectorizationcomplexity process because it and employs a concept similar thattoofa whichfraction has a computational complexity of O(n) and because reducesit the amount of data to a fraction of n. We call this the vectorization process employs a concept similar to thatthe of of n. converting bitmap images to vector images in computer graphics. Figure 3 illustrates We call this the vectorization process because it employs a concept similar to that of converting bitmap converting bitmap vectorization process.images to vector images in computer graphics. Figure 3 illustrates the images to vector images vectorization process.in computer graphics. Figure 3 illustrates the vectorization process.

Figure 3. Vectorization process. Figure 3. Vectorization process.

Figure 3. Vectorization process. In vectorizing the signal data, we first define 11 slope ranges (Table 1), each having a threshold In vectorizing the signal data, wethe first define 11 as slope ranges (Table 1), each having a threshold based on the peak-to-peak voltage of ECG signal follows: based on the peak-to-peak voltage of the ECG signal as follows: In vectorizing the signal data, we first define 11 slope ranges (Table 1), each having a threshold = 0.65 Vppt as + 0.35Vppt −1 (1) based on the peak-to-peak voltage ofVpp the ECG signal Vpp = 0.65 Vppt + 0follows: .35Vppt −1 (1) where Vppt is the maximum peak-to-peak voltage of the ECG signal over 2 s, and Vppt−1 is the where Vpp t is the maximum peak-to-peak voltage the ECG V pp = 0.65V ppt +of0.35V ppt−1signal over 2 s, and Vppt−1 is the (1) previous value of Vppt. previous value of Vppt.

where Vppt is the maximumTable peak-to-peak voltage ofvectorize the ECGthe signal overpoints. 2 s, and Vppt −1 is the previous 1. Slope ranges used to ECG data Table 1. Slope ranges used to vectorize the ECG data points. value of Vppt . Symbol Slope Range Symbol Slope Range The vectorization algorithm combines consecutive lines with the same slope range into a single Slope11 slope ≥ 0.007Vpp Slope11 slope ≥ 0.007Vpp straight line (Figure 3). This method a reduced number of data points and a reduction of Slope10 results in 0.007Vpp > slope ≥ 0.0056Vpp Slope10 0.007Vpp >> slope ≥≥ 0.0056Vpp 0.0056Vpp slope 0.0042Vpp unnecessary signal fluctuationsSlope09 while preserving the data features. The resulting lines are encoded Slope09 0.0056Vpp >> slope slope ≥≥ 0.0021Vpp 0.0042Vpp Slope08 0.0042Vpp using 11 alphabetic symbols. Slope08 0.0042Vpp > slope ≥ 0.0021Vpp Slope07 Slope07

0.0021Vpp > slope ≥ 0.0007Vpp 0.0021Vpp > slope ≥ 0.0007Vpp

Algorithms 2018, 11, 83

4 of 12

Table 1. Slope ranges used to vectorize the ECG data points. Algorithms 2018, 11, x FOR PEER REVIEW Symbol

Slope Range

4 of 12

Slope11 ≥ 0.007Vpp Slope06 0.0007Vpp > slope ≥ slope −0.0009Vpp Slope10 > slope ≥ 0.0056Vpp Slope05 −0.0009Vpp > 0.007Vpp slope ≥ −0.0027Vpp Slope09 > slope ≥ 0.0042Vpp Slope04 −0.0027Vpp >0.0056Vpp slope ≥ −0.0054Vpp Slope08 0.0042Vpp > slope ≥ 0.0021Vpp Slope03 −0.0054Vpp > slope ≥ −0.0072Vpp Slope07 0.0021Vpp > slope ≥ 0.0007Vpp Slope02 −0.0072Vpp0.0007Vpp > slope ≥ −0.009Vpp Slope06 > slope ≥ −0.0009Vpp Slope01 slope −0.009Vpp> slope ≥ −0.0027Vpp Slope05 − slope ≥ −0.0054Vpp Slope03combines consecutive−lines 0.0054Vpp slope ≥ −slope 0.0072Vpp The vectorization algorithm with >the same range into a single Slope02 −0.0072Vpp ≥ points −0.009Vpp straight line (Figure 3). This method results in a reduced number >ofslope data and a reduction of Slope01 slope < −0.009Vpp

unnecessary signal fluctuations while preserving the data features. The resulting lines are encoded using 11 alphabetic symbols.

2.2. Noise Removal 2.2. Noise Removal

The vectorization process results in consecutive points containing both voltage and time data, The vectorization process results in consecutive pointsofcontaining both voltage andistime which are stored in a linked list data structure. One benefit the vectorization process thatdata, it reduces which are stored in a linked list data structure. One benefit of the vectorization process is that it noise based on the slope fluctuation. After vectorization, noise is further removed in a process that reduces noise based on the slope fluctuation. After vectorization, noise is further removed in a eliminates all small fluctuations that can be considered noise based on their amplitude and duration. process that eliminates all small fluctuations that can be considered noise based on their amplitude All spikes of amplitude 0.06Vppbelow and 0.06Vpp duration below 25 ms are25eliminated by deleting all and duration. All spikesbelow of amplitude and duration below ms are eliminated by the corresponding data points within each spike period. Figure 4 presents the combined result of deleting all the corresponding data points within each spike period. Figure 4 presents the combined vectorization and noise removal. result of vectorization and noise removal.

Figure 4. Final result of the vectorization and noise-removal processes.

Figure 4. Final result of the vectorization and noise-removal processes.

2.3. Automata Recognizer

2.3. Automata Recognizer

An ECG signal is reduced to 11 slope types after it is vectored. Then, the signal sequence of slopes is treated a sequence symbols can be recognized a finite automata An ECG signal as is reduced to of 11 alphabetic slope types after itthat is vectored. Then, the by signal sequence of slopes recognizer. Finite automata are abstract algorithms used recognize by sequences a process is treated as a sequence of alphabetic symbols that can be to recognized a finite using automata recognizer. commonly as syntactic recognition. this process, other using ECG signal parameters (e.g.,known Finite automataknown are abstract algorithms used toInrecognize sequences a process commonly voltage level and time interval) become additional inputs. Figure 5 illustrates the automata as syntactic recognition. In this process, other ECG signal parameters (e.g., voltage level and time transition diagram, and Table 2 shows the transition function.

interval) become additional inputs. Figure 5 illustrates the automata transition diagram, and Table 2 shows the transition function.

Algorithms 2018, 11, 83

5 of 12

Algorithms 2018, 11, x FOR PEER REVIEW

5 of 12

Figure 5. (a) Relation of the ECG signal sequence to the automata states and other ECG parameters Figure 5. (a) Relation of the ECG signal sequence to the automata states and other ECG parameters and (b) the automata’s state transition diagram. and (b) the automata’s state transition diagram.

Symbol a Symbol ab bc cd d e e ff g hg ih ji

Table 2. Automata recognizer transition functions. Table 2. Automata recognizer transition functions. Function

slope ≤Function Slope10

slope = Slope11 slope ≤ Slope10 ¬a= Slope11 slope ¬(b ∨ d ∨ ¬ e a∨ f ) ¬( b ∨ d ∨ )e ∨∨(V f ) > 0.7V )) ∧ (t < 50) (0 ≤ slope ≤ Slope10) ∧ ((VQR > 0.02V pp pp R (0 ≤ slope ≤ Slope10) ∧ ((VQR > 0.02Vpp ) ∨R (VR > 0.7V pp )) ∧ ( t R < 50) ( Slope01 < slope < 0 ) ∧ ( t < 50 ) ( Slope01 < slope < 0) ∧ (t R 0.7Vpp )

( 20 < tQRS < 200) ∨ (VRS > 0.7V pp ) j The automata recognizer attempts to extract an R wave from an ECG signal. The automata remain in state N until suspecting to have detected an R wave. The automata enter the QR state once they The automata recognizer attempts to extract an R wave from an ECG signal. The automata begin to detect the high slope of an R wave. The signal slope would normally tend to decrease just remain in state N until suspecting to have detected an R wave. The automata enter the QR state once after thebegin peaktoofdetect the Rthe wave, which the automata enter thewould Ru state. The automata enter the they highatslope of point an R wave. The signal slope normally tend to decrease Rdjust state when the slope signal becomes The signal might oscillate between Ru and after the peak of theofRthe wave, at which pointnegative. the automata enter the Ru state. The automata enter Rdthe near the peak of an R wave. An ECG signal will normally sharply decrease after reaching the Rd state when the slope of the signal becomes negative. The signal might oscillate between Ru R peak until it reaches a minimum (mostAn negative) value, which point thedecrease automata enter the RS the state, and Rd near the peak of an R wave. ECG signal willatnormally sharply after reaching following which willa finally switch into the Sp state, thethe acceptance the the R wave. R peak until it they reaches minimum (most negative) value,representing at which point automataof enter RS Thefollowing transitionwhich function that the slope range analyzed over the wave inof Figure state, theyshows will finally switch into the Sp state, representing the segment acceptance the R 5a wave. is sufficient for detection. The range could be reduced to make the process even faster; however, Thewe transition shows thatrange the slope range over the wave Furthermore, segment in Figure 5a at present, use thefunction abovementioned aiming foranalyzed future developments. reducing sufficient for detection. could be reducedthat to make thebe process at theisrange might lead to aThe lossrange of signal features would usefuleven forfaster; otherhowever, applications. present, we use the abovementioned range aiming for future developments. Furthermore, reducing The number of automata states can also be simplified by combining Rd and Ru into one state; however, range mightoflead a loss of signal features thatwas would be useful for otherthe applications. The ourthe development the to syntactic recognition method simplified by keeping states separate.

Algorithms 2018, 11, 83

6 of 12

2.4. Probability Function The automata recognizer produces one or more R peak candidate points. We apply the following probability function to eliminate any false positives:

P=

 0     t )2  − (tn +2σ−  5.5σ2  e 

tn < 240 ms

   1    2   − (tn −2σ−2 t) 5.5σ e

  t − 2σ ≤ tn ≤ t + 2σ  tn > t + 2σ

tn < t − 2σ

 (2)

where

• • • •

P = probability function of the next R peak; tn = time interval of the next R peak; t = mean of the RR interval; and σ = standard deviation of the RR interval.

The final scores of each candidate are calculated as follows after obtaining a probability value for each R peak candidate: Score = P × (VRS × priority   (3) 1.0 t n −1 < t ∧ t n > t priority = 0.75 otherwise The R peak candidate with the highest score is then selected as the detected R peak. 2.5. Evaluation Setup We examined modified limb lead II (MLII) ECG signals necessary for long-term ECG recording to validate the proposed method. The MLII signals were obtained by placing the ground electrode at the left infraclavicular fossa, the negative electrode at the right infraclavicular fossa, and the positive electrode on the left lower abdomen or just beneath the last rib. We obtained the signal data from the Massachusetts Institute of Technology–Beth Israel Hospital Normal Sinus Rhythm (MIT–BIH NSR) database [12,13], which is an Open Data Commons Public Domain database. This database included 18 long-term ECG recordings of subjects referred to the Arrhythmia Laboratory at Boston’s Beth Israel Hospital. The subjects in the database had no significant arrhythmias and included five men aged 26 to 45 and 13 women aged 20 to 50. We also tested the proposed method with the Fantasia database [12–14]. This database comprised 20 young (21–34 years old) and 20 elderly (68–85 years old) rigorously screened healthy subjects, who underwent 120 min of continuous ECG recording digitized at 250 samples per second. All subjects remained in a resting state in a sinus rhythm while watching the movie Fantasia (Disney, 1940) to help maintaining wakefulness. We implemented the proposed method using C++ coding. We originally intended to feed the ECG data through an analog-to-digital converter into our long-term HRV monitoring system at 1000 samples per second; however, we developed a separate program for validation purposes. The input data of the validation program was formatted as a comma-separated value (CSV) format file generated from the MIT-BIH NSR and the Fantasia databases. To simulate the real implementation, we resampled the original signals from the datasets to 1000 samples per second using linear interpolation. The implementation was included in the real-time HRV analysis system, where the data were serialized. The client received the serial data, detected the R peak, sent the results to the server, and deleted the data. Hence, the client memory did not store a large amount of ECG data, and the computation time was not affected by the data serialization. We consider that the two evaluated

Algorithms 2018, 11, x FOR PEER REVIEW

7 of 12

interpolation. The implementation was included in the real-time HRV analysis system, where the data were serialized. The client received the serial data, detected the R peak, sent the results to the Algorithms 2018, 11, 83 7 of 12 server, and deleted the data. Hence, the client memory did not store a large amount of ECG data, and the computation time was not affected by the data serialization. We consider that the two evaluated datasets, which werecan resampled, can beasconsidered as representative becausesampling a 1000-Hz datasets, which were resampled, be considered representative because a 1000-Hz rate sampling rate is commonly used forrecording. practical ECG recording. is commonly used for practical ECG then testedthe theproposed proposedmethod method on on the the first first 10,000 NSR WeWe then tested 10,000 ss of ofeach eachrecord recordininthe theMIT-BIH MIT-BIH NSR database and compared the results with the existing results from other studies. We excluded records database and compared the results with the existing results from other studies. We excluded records #f1o07, #f2o05, #f2o08,#f2o10, #f2o10,and and#f2y09 #f2y09 from from the the Fantasia Fantasia database many #f1o07, #f2o05, #f2o08, databasebecause becausethey theycontained contained many arrhythmic beats with the negative peak deflection, which are considered as outliers for HRV arrhythmic beats with the negative peak deflection, which are considered as outliers for HRV analysis. analysis. The proposed method was tested on a 2.4 GHz Intel Core i7-4700HQ CPU, 12 GB-memory The proposed method was tested on a 2.4 GHz Intel Core i7-4700HQ CPU, 12 GB-memory Windows 8.1 Windows 8.1 notebook. Windows 8.1 is a multi-tasking operating system that processes multiple notebook. Windows 8.1 is a multi-tasking operating system that processes multiple tasks in addition tasks in addition to our program. Hence, we measured the elapsed time of our proposed method five to our program. Hence, we measured the elapsed time of our proposed method five times per record times per record and calculated the mean value for each record. We also set our program to have the andhighest calculated the in mean value for eachofrecord. We alsosystem. set our program to have the highest priority in priority the task manager the operating the taskWe manager the operating system. focusedofon obtaining uninterrupted beats from the acquired ECG data. Thus, we included We focused on obtaining uninterrupted beats This from allowed the acquired we included all signal series for the test with no exceptions. us toECG judgedata. the Thus, detector’s ability toall signal series for the test with no exceptions. This allowed us to judge the detector’s ability to recognize recognize unreadable signals caused by very-high amplitude noise, very-low signal amplitude, loss unreadable signals caused byofvery-high amplitude signal amplitude, loss of signal, of signal, or a combination these factors [15]. Suchnoise, error very-low signals were noted as “isolated QRS-like or artefacts” a combination of of these factors [15]. 6). Such signals werethe noted as “isolated QRS-like instead R peaks (Figure Weerror manually marked R peaks and analyzed bothartefacts” signal instead types.of R peaks (Figure 6). We manually marked the R peaks and analyzed both signal types.

Figure Occurrenceofofthe thesignal signalnoted notedas as an an “isolated “isolated QRS-like [12,13,15]. Figure 6. 6. Occurrence QRS-likeartefact” artefact”ininrecord record#16272 #16272 [12,13,15].

We evaluated the performance of the proposed method using four performance metrics: We evaluated the performance of the proposed method using four performance metrics: sensitivity sensitivity (Se), which represents the ability of the algorithm to detect true R peaks; positive (Se), which represents the ability the algorithm to detect truealgorithm R peaks; positive predictivity rate true (PPR), predictivity rate (PPR), which of represents the ability of the to discriminate between which the ability of the algorithm to discriminate between true and peaks; detection and represents false R peaks; detection error rate (DER), which is used to evaluate thefalse totalRdetection error error rate (DER), which is used to evaluate the total detection error over all R peaks; and accuracy (Ac), over all R peaks; and accuracy (Ac), which is calculated as the proportion of correctly identified R which is over calculated as the proportion of correctly identified R peaks over all cases. peaks all cases.

Se Se==

TP TP × 100% ×100% TP TP++ FN FN

PPR =

PPR = DER =

TP × 100% TP TP + FP

×100%

FP TP++ FN FP × 100% TotalQRS

FPTP + FN DER ××100% Ac = = 100% TPTotal + FNQRS + FP

(4) (4)

(5) (5)

(6) (6)

(7)

A true-positive (TP) occurred when an R peak was correctly detected by the proposed algorithm, TP whereas a false-negative (FN) occurred missed, and a false-positive (FP) occurred (7) Acwhen = an R peak was ×100% when noise was detected as an R peak. TP + FN + FP

Algorithms 2018, 11, 83

8 of 12

3. Results Tables 3 and 4 summarize the performance of the proposed method on the evaluated databases. Table 3. Performance evaluation of the proposed method using the Massachusetts Institute of Technology–Beth Israel Hospital Normal Sinus Rhythm (MIT–BIH NSR) database. PPR: positive predictivity rate; DER: detection error rate; Se: sensitivity; Ac: accuracy. Record #

Total Beats

Se (%)

PPR (%)

DER (%)

Ac (%)

Processing Time (ms)

16265 16272 16273 16420 16483 16539 16773 16786 16795 17052 17453 18177 18184 19088 19090 19093 19140 19830 Mean

14,809 10,485 13,629 13,555 15,638 11,952 12,464 12,222 13,819 11,496 14,463 14,900 13,876 15,332 13,350 11,663 14,436 18,925 13,272

100 100 100 100 99.994 100 99.984 100 100 100 100 100 100 100 100 100 100 99.903 99.993

100 100 100 100 99.994 100 100 100 100 100 100 100 100 100 100 100 100 99.995 99.999

0 0 0 0 0.013 0 0.016 0 0 0 0 0 0 0 0 0 0 0.103 0.007

100 100 100 100 99.987 100 99.984 100 100 100 100 100 100 100 100 100 100 99.898 99.993

310 413 269 253 407 383 331 296 501 338 283 510 377 527 417 286 480 47 385

Table 4. Performance evaluation of the proposed method using the Fantasia database. Record #

Total Beats

Se (%)

PPR (%)

DER (%)

Ac (%)

Processing Time (ms)

f1o01 f1o02 f1o03 f1o04 f1o05 f1o06 f1o08 f1o09 f1o10 f1y01 f1y02 f1y03 f1y04 f1y05 f1y06 f1y07 f1y08 f1y09 f1y10 f2o01 f2o02 f2o03 f2o04 f2o06 f2o07 f2o09 f2y01 f2y02 f2y03 f2y04 f2y05 f2y06 f2y07 f2y08 f2y10 Mean

7169 6823 7728 6230 5730 6231 8488 4925 8241 8709 7035 7643 5511 6965 7086 5947 7289 8021 8693 7234 6372 6541 6902 5249 5891 6072 8042 6574 6807 8603 9244 6851 6506 7249 7113 13,272

100 100 100 99.952 100 99.968 99.976 99.959 100 100 100 100 100 99.986 99.958 100 100 100 100 99.986 99.984 100 100 100 100 99.951 99.923 100 100 99.977 99.838 100 100 99.724 99.859 99.957

100 100 100 99.968 100 100 99.976 100 100 100 100 100 100 99.986 99.972 99.983 100 100 100 100 99.953 100 100 100 100 99.967 100 100 100 99.988 99.989 100 100 99.917 99.972 99.991

0 0 0 0.080 0 0.032 0.047 0.041 0 0 0 0 0 0.029 0.071 0.017 0 0 0 0.014 0.063 0 0 0 0 0.082 0.037 0 0 0.035 0.173 0 0 0.360 0.169 0.053

100 100 100 99.920 100 99.968 99.953 99.959 100 100 100 100 100 99.971 99.930 99.983 100 100 100 99.986 99.937 100 100 100 100 99.918 99.963 100 100 99.965 99.827 100 100 99.642 99.831 99.947

386 492 545 253 341 377 325 391 369 549 493 514 248 272 262 247 541 522 412 543 548 274 441 264 202 276 333 215 230 540 278 167 214 368 240 362

Algorithms 2018, 11, 83

9 of 12

Tables 5 and 6 present a comparison of the results obtained by the proposed method and other methods [16–18], from which the proposed method obtained the highest performance. Table 5. Performance comparison with the MIT-BIH NSR database. Method

Se (%)

PPR (%)

DER (%)

Ac (%)

Proposed Sharma et al. [16] Elgendi et al. [17] Pan and Tompkins [18]

99.993 99.361 99.99 96.91

99.999 99.426 99.96 99.97

0.007 1.212 -

99.993 98.808 -

Table 6. Performance comparison with the Fantasia database. Method

Se (%)

PPR (%)

DER (%)

Ac (%)

Proposed Sharma et al. [16] Elgendi et al. [17] Pan and Tompkins [18]

99.957 99.90 99.98 89.16

99.991 99.91 99.87 99.89

0.053 0.19 -

99.947 99.81 -

The average elapsed time for the R peak detection on the MIT-BIH NSR database was approximately 385 ms per 10,000 s at 1000 samples per second, resulting in a processing time per sample of approximately 38.5 ns. When tested using the Fantasia database, the total time for R peak detection over 249,746 s of recording was 12,672 ms at 1000 samples per second, resulting in a processing time per sample of approximately 36.2 ns. 4. Discussion We propose a new method of detecting R peaks from acquired long-term ECG data for use in HRV analysis. The proposed method combines a syntactical with a statistical approach to address the problem of signal recognition. The use of a preprocessing step reduces the complexity of the syntactical recognition step, thereby making this inherently fast process even faster, and resulting in an overall process that is very fast and computationally efficient. The performance of the method was verified using the MIT–BIH NSR and Fantasia databases. The results from the MIT–BIH NSR database showed that it had a sensitivity, positive predictivity rate, detection error rate, and accuracy of 99.998, 99.999, 0.003, and 99.996%, respectively. Meanwhile, the Fantasia database showed that it had a sensitivity, positive predictivity rate, detection error rate, and accuracy of 99.957, 99.991, 0.053, and 99.947%, respectively. The Fantasia database showed poorer results than the MIT–BIH NSR database because the proposed method failed to recognize the typical waveform that sometimes occurred in the database annotated as beats (Figure 7). Figure 8 demonstrates a real example of the effect of R peak misdetection from the proposed method compared to the actual R peaks during HRV analysis. The misdetection occurred once in MIT–BIH NSR database record #19830 from 2670 s to 2700 s. We used a windows length of 30 s to show the difference of the HRV analysis with a single misdetection compared to that with no misdetection in the HRV frequency domain analysis. The misdetection greatly changed the frequency component compared to the actual NN interval without misdetection. Hence, the misdetection of the R peaks must be minimized in the HRV analysis.

Algorithms 2018, 11, 83 Algorithms 2018, x FORPEER PEERREVIEW REVIEW Algorithms 2018, 11,11, x FOR

10 of 12 10 of 1012 of 12

Figure andc)c)Typical Typicalwaveforms, waveforms, which which sometimes sometimes occurred asas beats in in Figure 7. 7. (a,(a, b,b,and occurredand andwere wereannotated annotated beats Figure 7. (a, b, and c) Typical waveforms, which sometimes occurred and were annotated as beats in the Fantasia database, but cannot be recognized by the automata as heartbeats [12–15]. the Fantasia database, but cannot be recognized by the automata as heartbeats [12–15]. the Fantasia database, but cannot be recognized by the automata as heartbeats [12–15].

Figure 8. A single misdetection of the R peak results in wrong NN intervals, which can greatly modify the result of the frequency analysis of the HRV as compared to the actual analysis without Figure 8.8.AAsingle single misdetection of the R peak results in wrong NN intervals, which can greatly Figure misdetection. misdetection of the R peak results in wrong NN intervals, which can greatly modify modify the result of the frequency HRV astocompared the actual analysis without the result of the frequency analysis ofanalysis the HRVof asthe compared the actual to analysis without misdetection.

misdetection. The method needed 33.6 and 38.5 ns processing time per sample when tested with the MIT–BIH

NSR and Fantasia databases, respectively. The records needed different processing times, but were The method needed 33.6 and 38.5 ns processing time per sample when tested with the MIT–BIH The method 33.6 and 38.5Although ns processing time per sample with the MIT–BIH evaluated with needed the same duration. the computation time when neededtested in the preprocessing NSR and Fantasia databases, respectively. The records needed different processing times, but were NSR and Fantasia databases, different related processing times, stage was proportional to therespectively. number n ofThe datarecords points, needed it had variations to noise. In but fact,were a evaluated with the same duration. Although the computation time needed in the preprocessing stage evaluated with the same duration. Although the computation time needed in the preprocessing change in the signal slope can lead to a different branch in the preprocessing algorithm, which has a was proportional to the number n of data points, it had variations related to noise. In fact, a change stage wasdifferent proportional to thetime number n of data points, it had variations related to noise. In fact, a slightly processing compared to other branches. in the signal slope can lead to a different branch in the preprocessing algorithm, which has a slightly changeThe in the signal slopestage can resulted lead to aindifferent branch thenext preprocessing which preprocessing m data points forinthe stage, wherealgorithm, m was lower thanhas n. a different processingtime timeneeded compared to other branches. The computation bycompared the automata in the branches. recognition stage was proportional to m. When slightly different processing time to other The preprocessing stage resulted in m Fantasia data points for the next stage, where was lower than evaluated with the MIT–BIH NSR in and databases, the stage, average timemm needed for than the The preprocessing stage resulted m data points for the next where was lower n. n. preprocessing The computation time needed by the86% automatatotal in the recognition stage was the proportional approximately processing time, average of to The computationstage timewas needed by the automataofinthe the recognition stage waswhereas proportional to m. When m. recognition When evaluated with theapproximately MIT–BIH NSR14% andof Fantasia databases, the time. average time needed for stage the total processing This observation evaluated with the needed MIT–BIH NSR and Fantasia databases, the average time needed for the theconfirmed preprocessing stage was approximately 86% of the total processing time, whereas the average that the preprocessing method reduced the time needed for the recognition of the R of preprocessing stage was approximately 86% of the total processing time, whereas the average of peaks. recognition stage needed approximately 14% of FIR the filters, total processing time. This time observation As a comparison, other methods use cascading each with a computation of (m recognition stage needed approximately 14% of the total processing time. This observation confirmed that the reduced needed forn the ofnext the R × n), where m is thepreprocessing kernel size andmethod n is the data size. the Suchtime filters result in datarecognition points for the confirmed that the preprocessing method reduced the time needed for the recognition of the R peaks. a comparison, other methods cascading FIR filters, each with a computation stage,As followed by a relatively complexuse algorithm for R peak detection. A faster processing time time of peaks. As a comparison, other methods use cascading FIR filters, each with a computation time of (m that themproposed method on aSuch morefilters limited processor whenpoints compared (mmeans × n), where is the kernel sizecan andbenimplemented is the data size. result in n data for the × n), where m is the kernel size and n is the data size. Such filters result in n data points for the next to stage, other methods. next followed by a relatively complex algorithm for R peak detection. A faster processing time stage, followed by a relatively complex algorithm for R peak detection. A faster processing time The the proposed R peak detection was designed to exclusively measurewhen the normal RR to means that proposed method can bemethod implemented on a more limited processor compared means that the proposed method can be implemented on a more limited processor when compared interval (or NN interval) for HRV analysis. Hence, using this method to detect arrhythmic beats other methods. to presents other methods. limitations, especially whenmethod a negative QRS complex occurs. Any The proposed R peak detection was deflection designed of to the exclusively measure the normal The proposed R peak detection method waswould, designed to exclusively measureAsthe normal RR improvement for recognizing all types of beat therefore, be challenging. mentioned RR interval (or NN interval) for HRV analysis. Hence, using this method to detect arrhythmic

interval (or NN interval) for HRV analysis. Hence, using this method to detect arrhythmic beats presents limitations, especially when a negative deflection of the QRS complex occurs. Any improvement for recognizing all types of beat would, therefore, be challenging. As mentioned

Algorithms 2018, 11, 83

11 of 12

beats presents limitations, especially when a negative deflection of the QRS complex occurs. Any improvement for recognizing all types of beat would, therefore, be challenging. As mentioned earlier, using other details to classify types of arrhythmias would be possible in future works because we preserved many ECG signal features during the preprocessing stage. Author Contributions: T.I. conceived the experiments and contributed the analysis tools. D.P. designed and performed the experiments, analyzed the data, and drafted the manuscript. Both D.P. and T.I. approved the final manuscript. Acknowledgments: The authors would like to express our gratitude to Jun-ichi Maehara and Saiseikai Kumamoto Hospital for cooperation and guidance in this study. Conflicts of Interest: The authors declare no conflict of interest.

References 1.

2.

3. 4. 5.

6. 7.

8.

9.

10. 11.

12.

13. 14.

Robinson, B.F.; Epstein, S.E.; Beiser, G.D.; Braunwald, E. Control of the heart rate by the autonomic nervous system in man on the interrelation between baroreceptor mechanisms & exercise. Circulation 1966, 19, 400–411. Camm, A.J.; Malik, M.; Bigger, J.T.; Breithardt, G.; Cerutti, S.; Cohen, R.J.; Coumel, P.; Fallen, E.L.; Kennedy, H.L.; Kleiger, R.E.; et al. Heart rate variability: Standards of measurement, physiological interpretation, and clinical use. Task for of the European society of cardiology and the North American society for pacing and electrophysiology. Circulation 1996, 93, 1043–1065. Acharya, U.R.; Joseph, K.P.; Kannathal, N.; Lim, C.M.; Suri, J.S. Heart rate variability: A review. Med. Biol. Eng. Comput. 2006, 44, 1031–1051. [CrossRef] [PubMed] Acharya, R.; Krishnan, S.M.; Spaan, J.A.; Suri, J.S. Advances in Cardiac Signal Processing; Springer: Berlin/Heidelberg, Germany, 2007. Pang, D.; Igasaki, T.; Maehara, J. Long-term monitoring of heart rate variability toward practical use in intensive/high care unit. In Proceedings of the 9th Biomedical Engineering International Conference (BMEiCON), Luang Prabang, Laos, 7–9 December 2016; pp. 1–6. Kleiger, R.E.; Stein, P.K.; Bosner, M.S.; Rottman, J.N. Time domain measurements of heart rate variability. Cardiol. Clin. 1992, 10, 487–498. [PubMed] Pruvot, E.; Thonet, G.; Vesin, J.M.; van-Melle, G.; Seidl, K.; Schmidinger, H.; Brachmann, J.; Jung, W.; Hoffmann, E.; Tavernier, R.; et al. Heart rate dynamics at the onset of ventricular tachyarrhythmias as retrieved from implantable cardioverter-defibrillators in patients with coronary artery disease. Circulation 2000, 101, 2398–2404. [CrossRef] [PubMed] Lombardi, F.; Porta, A.; Marzegalli, M.; Favale, S.; Santini, M.; Vincenti, A.; De Rosa, A. Implantable Cardioverter Defibrillator-Heart Rate Variability Italian Study Group. Heart rate variability patterns before ventricular tachycardia onset in patients with an implantable cardioverter defibrillator. Participating Investigators of ICD-HRV Italian Study Group. Am. J. Cardiol. 2000, 86, 959–963. [PubMed] Meyerfeldt, U.; Wessel, N.; Schütt, H.; Selbig, D.; Schumann, A.; Voss, A.; Kurths, J.; Ziehmann, C.; Dietz, R.; Schirdewan, A. Heart rate variability before the onset of ventricular tachycardia: Differences between slow and fast arrhythmias. Int. J. Cardiol. 2002, 84, 141–151. [CrossRef] Tsuji, H.; Venditti, F.J.; Manders, E.S.; Evans, J.C.; Larson, M.G.; Feldman, C.L.; Levy, D. Determinants of heart rate variability. J. Am. Coll. Cardiol. 1996, 28, 1539–1546. [CrossRef] Ozdemir, O.; Soylu, M.; Demir, A.D.; Topaloglu, S.; Alyan, O.; Geyik, B.; Kutuk, E. Increased sympathetic overactivity as cause of exercise-induced ventricular tachycardia in patients with normal coronary arteries. Texas Heart Inst. J. 2003, 30, 100–104. Goldberger, A.L.; Amaral, L.A.N.; Glass, L.; Hausdorff, J.M.; Ivanov, P.C.; Mark, R.G.; Mietus, J.E.; Moody, G.B.; Peng, C.K.; Stanley, H.E. PhysioBank, PhysioToolkit, and PhysioNet: Components of a New Research Resource for Complex Physiologic Signals. Circulation 2000, 101, e215–e220. [CrossRef] [PubMed] PhysioBank ATM. Available online: https://physionet.org/cgi-bin/atm/ATM (accessed on 30 November 2017). Iyengar, N.; Peng, C.K.; Morin, R.; Goldberger, A.L.; Lipsitz, L.A. Age-related alterations in the fractal scaling of cardiac interbeat interval dynamics. Am. J. Physiol. 1996, 271, 1078–1084. [CrossRef] [PubMed]

Algorithms 2018, 11, 83

15. 16. 17. 18.

12 of 12

PhysioBank Annotations. Available online: https://physionet.org/physiobank/annotations.shtml#noise (accessed on 30 November 2017). Sharma, L.D.; Sunkaria, R.K. A robust QRS detection using novel pre-processing techniques and kurtosis based enhanced efficiency. Measurement 2016, 87, 194–204. [CrossRef] Elgendi, M. Revisiting QRS detection methodologies for portable, wearable, battery-operated, and wireless ECG systems. PLoS ONE 2014, 9, e84018. [CrossRef] [PubMed] Pan, J.; Tompkins, W. A real-time QRS detection algorithm. IEEE Trans. Biomed. Eng. 1985, 32, 230–236. [CrossRef] [PubMed] © 2018 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).

Suggest Documents