QRS Detection Based on an Advanced Multilevel Algorithm

This paper presents an advanced multilevel algorithm used for the QRS complex detection. This method is based on three levels. The first permits the extraction of higher peaks using an adaptive thresholding technique. The second allows the QRS region detection. The last level permits the detection of Q, R and S waves. The proposed algorithm shows interesting results compared to recently published methods. The perspective of this work is the implementation of this method on an embedded system for a real time ECG monitoring system.


INTRODUCTION
The electrocardiogram (ECG), as illustrated in Fig. 1, presents the electrical activity of the heart.This activity is collected on a patient by electrodes placed on the surface of his skin.The heart is made of muscle cells that conduct electrical impulses.In addition, there are specialized cells organized into a preferential conduction tissue and endowed with the power to depolarize spontaneously, creating cardiac automatism [1].The ECG is an essential element both in patient monitoring or diagnosis of cardiovascular disease.The theoretical basis and practice of cardiac electrical activity recording were set out by Einthoven.in 1901.
The analyses of the ECG signal permit to evaluate the heart condition of the patients.This signal contains different waves that present repolarization and depolarization of the heart muscle [2][3][4][5].Among these waves, the QRS complex corresponds to the depolarization of the ventricles.This complex shows a large amplitude compared to other waves.This gives it a top priority during the diagnosis of the ECG signal.The QRS complex represents three contiguous waves following the P wave, namely the waves Q, R and S. By definition, the Q wave is the first negative wave, the R wave is the first positive wave, and the S wave is first negative wave after the R wave [6][7].The average duration of the QRS complex is 0.08 s.It must remain below 0.12 s.Above, it is most often an asynchronous depolarization of two ventricles associated with intraventricular conduction disorder [1].
The automatic processing of the ECG signal is a major challenge to researchers and the engineers in the different tasks of research that deal with this signal, likewise, the ECG signal denoising, the QRS complex detection and the real time monitoring [8][9].The ECG signal could be affected by several types of noise, which influence negatively on this signal [10][11][12].e.g., the baseline wandering, the high frequency noise and the power line interference.These noises are attested in the recording of the ECG signal.Fluctuations of the baseline are internal noises that disturb the ECG signal.These fluctuations are due to respiration and patient motion during the recording of this signal.The high frequency noises beyond the frequency of the normal ECG signal, which is variable between 0.5 Hz and 150 Hz.These noises are caused by the extra-cardiac muscle activity.The power line interferences are induced by the electrical power supply of appliances.After the ECG signal denoising, the QRS complex detection is the first steps of any analyses of ECG signal's waves.The extraction of this complex is a major issue of the ECG signal processing and it presents an important task for researchers from long time.This difficulty is due to the different morphology of the ECG signal, as illustrated in Fig. 2. Several research works have been proposed to deal with this task.e.g., derivative algorithms [13][14][15], artificial neural networks [9], DWT [16][17], filter banks [9].The problem with the majority of these methods is the high complexity of the implementation in the embedded systems.As a solution for this problem, this paper proposes an efficient method based on a multilevel algorithm to solve this issue.This method is based on three levels, namely the extraction of higher peaks using an adaptive thresholding technique, the QRS region detection and the detection of Q, R and S waves.This method is tested on some of the MIT-BIH arrhythmia signals.
The perspective of this work is the implementation of this method on an embedded system for the ECG monitoring system.This gives the possibility of evaluating the patient's cardiac status in real time.This paper is organized as follows, after the introduction, the next section presents the advanced multilevel algorithm based on adaptive thresholding technique.Next, the results section shows the qualitative and the quantitative results and comparisons of this method over some of the MIT-BIH arrhythmia signals as presented in [1].Afterwards, the discussion section proposes a detailed analysis of the results.Finally, the last section concludes this paper.

A. ECG Signal denoising
The ECG signal is fragile to different kinds of noises.This makes of the filtering step an essential element of every sort of analysis of the ECG signal.
In our case, we have proposed an efficient solution of the baseline wandering correction and the high frequency noises, which will be presented in further works.The power line interference (50Hz or 60Hz) is not treated with this solution considering the perspective of implementation of this method in an embedded system with a DC supply.This denoising approach shows interesting results in the case of the baseline wandering issue, as shown in Fig. 3, as well as the high frequency noises as presented in Fig. 4.

B. Advanced multilevel algorithm
Fig. 5 presents the diagram of the proposed method.The first step presents the ECG signal denoising.Then, the advanced multilevel algorithm, which consists of three levels, namely the extraction of higher peaks using an adaptive thresholding technique, the detection of the QRS region and the detection of Q, R and S waves. 1) The extraction of higher peaks: This level is the major element of this method.It permits to locate the position of the QRS complex in the ECG signal.In this level we propose an adaptive thresholding technique.The aim of this technique is to introduce an adaptive threshold, which vary according to the maximum of a moving window.The threshold value is chosen as follows: Where β presents the threshold value, M A is the maximum value of the moving window and α is the adaptive thresholding coefficient.
The length of the moving window is 5 seconds that permits to compare every QRS to its neighbours and extract the majority of these complex.In addition, this length doesn't allow to have a large difference between the largest and smallest QRS in this window.This due to the behaviour of the ECG signal, which changes gradually.Therefore, the right choice of the window's length guarantees the high performance of this method.
The MIT-BIH arrhythmia database is frequently used in the evaluation of different algorithms in several thematic interested by the ECG signal [18].This database contains 48 records; each record is of 30 min length with 360 Hz sampling frequency [18].This means that the window's length is 1800 samples (5 seconds) and the signal length is 650000 samples (30 minutes).The maximum heartbeats are estimated at 160 beats per minute (bpm).Therefore, the minimum interval between two complexes corresponds to 145 samples for this method.
Following is the algorithm of the adaptive thresholding technique, where X(i) is the absolute value of the original signal and W(i) is the result of this level:
The condition of the decrease is that the numbers of peaks should be lesser than 5 peaks, which is corresponding to 60 bpm.
To simplify the analysis, it is recommended to divide the original signal.This permits to readily analyse the conduct of the proposed method.
2) The detection of the QRS region: After the extraction of the higher peaks, this level consists of the detection of the QRS regions around these peaks.As presented in Fig. 3, the S waves in some cases could be higher than the R waves in the absolute value of the original signal.In order to select the right QRS region around a peak, this method proposes to select this region differently depending on the nature of the peaks.
Following is the algorithm of the adaptive thresholding technique, where U(i) is the original signal, X(i) is the absolute value of the original signal and Q(i) is the result of this level: Algorithm of the QRS region extraction: As presented in this algorithm, the length of the QRS region is 60 samples, which presents to the maximum duration of the QRS complex.This duration corresponds to 160 milliseconds.This coefficient permits to extract the maximum of the peaks present in the moving window.
The decrease condition of this coefficient is that the numbers of peaks should be lesser than 5 peaks, which is corresponding to 60 bpm.
As shown in the condition {2.1}, the position of the QRS region depends to the nature of the peaks.If the peak represents the R wave, then the length of the QRS region will be divided equally around this peak.Otherwise, if the peak represents the S wave, then the position of the QRS region will be selected to make the R wave in the middle of this region.
3) The detection of the waves Q, R and S: This level permits the detection of the waves present in the QRS complex.The algorithm of the detection of the waves Q, R and S is as follows: Algorithm of the QRS region extraction:

III. RESULTS
The simulation results have been drawn using MATLAB R2014a.The use of a standard database is recommended to assess the effectiveness of the proposed method.In this paper, the MIT-BIH Arrhythmia signals from n°100 to n°108, as presented in [1], are used in the evaluation of the proposed algorithm.

A. Qualitative results:
The qualitative results show some figures taken from the simulation using MATLAB.These figures allow to perceive the detection of all peaks separately in order to analyse the quality of the extraction.Fig. 6,7 and 8 presents the results of the R peaks detected in the signals n°107, 104 and 106 respectively.Fig. 9 and 10 presents the process of the proposed method in the signals n°105 and 106 respectively.

B. Quantitative results:
The quantitative results permit to evaluate statistically the efficiency of the proposed method.The evaluation is established by using the following statistical parameters, true beats (TB), true positive (TP), false negative (FN), False positive (FP), positive predictivity (Pp), sensitivity (Se) and error rate.The true positive is the true detected beats.The false positive is the false detected beats.The false negative is the undetected beats.The total beats is the total number of beats presented in the original signal.The positive predictivity, the sensitivity and the error rate are defined as follows: 1 presents the statistical results of the proposed method compared to some theoretical methods recently published [1,19,20].This results are related to the detection of the QRS regions over these methods and the proposed one.

IV. DISCUSSION
The proposed approach provides an important solution of the detection of the QRS complex.This method consists of three levels.The first permits the extraction of higher peaks using an adaptive thresholding technique.The second allows the QRS region detection.The last level permits the detection of Q, R and S waves.Fig. 6, 7 and 8 present the extraction of the R peaks.As shown in these figures, the proposed method provides an important solution for the complex morphologies of the ECG signal.Fig. 9 and 10 show the process of the proposed method.As presented in these figures, this process assures a high extraction's quality of the QRS waves presents in the analysed signal.
The quantitative results, as presented in the table 1, show competitive statistics compared to some theoretical results where the implementation is complex.This comparison is focused in the database signals from 100 to 108.The average error of the proposed method in these signals is 0.53%, which is lesser that the comparative methods.The error of the method presented in [19] is closer to the result of the proposed approach.Whereas the Advanced Multilevel Algorithm presents a simple algorithm to deal with the QRS extraction task, the implementation of this algorithm in an embedded system is simple, unlike the method proposed by [19] which is complex.The sensitivity result of the proposed approach is higher that the comparative methods.This signified that the proposed method permits the minimum of the false negative in the signals presented in the table 1.The result of the positive predictivity presents a competitive result of 99.71%.The qualitative and the quantitative results show that, spite of the simplicity of this method, the advanced multilevel algorithm presents a very important solution for the extraction of the QRS complex.
V. CONCLUSION This paper presents an advanced multilevel algorithm used for the QRS complex detection.This method is based on three levels.The first permits the extraction of higher peaks using an adaptive thresholding technique.The second allows the QRS region detection.The last level permits the detection of the waves Q, R and S.
The aim of this method is to present a simple algorithm to deal with the QRS complex extraction.The result of this method should be competitive with the high quality of the extraction presented in the recent research works, despite of the complexity of these works.These results allow us to implement this method in an embedded system with an assured quality of the extraction.
As presented in the qualitative and the quantitative results, the proposed approach shows interesting results.The high quality of the extraction as well as the competitiveness of the statistical results is assured.As a conclusion, spite of the simplicity of this method, the advanced multilevel algorithm presents a very important solution for the extraction of the QRS complex.The next step of this work is to implement this method in a real-time system.The purpose of this step is to develop a wireless monitoring prototype using an embedded system.The system proposed for this work is a Digital Signal Processor (DSP).This gives the possibility of evaluating the patient's cardiac status in real time.

Fig. 5 .
Fig. 5.The diagram of the proposed method

Fig. 6 .
Fig. 6.The R peaks detection of the signal n°107: (a) Original signal, (b) Detection of the higher peacks

Fig. 9 .Fig. 10 .
Fig. 9.The process of the proposed method of the signal n°105: (a) Original signal, (b) First level result, (c) Second level result, (d) Third level result