Cite this as
Taouli SA, Bereksi-Reguig F (2019) The QRS complex detection using morphological filtering. Biomed Sci Eng 5(1): 001-006. DOI: 10.17352/abse.000011This article presents a method of QRS complex detection and more precisely the R wave in an electrocardiogram (ECG) based on the mathematics morphology which calls upon the four operators’ morphology, erosion, dilation, opening and closing. These operators are combined with a window relocated which is called the structuring element. Morphological filtering uses the structuring element to extract the shape information from ECG signal. The effectiveness of the proposed algorithm is tested by using recordings obtained from the MIT-BIH arrhythmia database. Experiment results show that the proposed algorithm outperforms the other algorithms.
The ECG signal is characterized by five peaks and valleys labelled by the letters P, Q, R, S, T as shown in figure 1.
The QRS complex is the most prominent wave component within the electrocardiogram. It reflects the electrical activity of heart during the ventricular contraction and the time of its occurrence.
A great number of methods were proposed for detection of the waves of ECG signal [1-7]. The majority of these methods are based on filtering or the thresholding adaptive, which shows the limitation of the application. Very few algorithms function well for the detection of all the landmarks such as the beginning and the end of the P wave, the T wave and QRS complex (also known under the name: extremes of the waves of ECG signal).
The principal disadvantage of filtering is that the variations of the frequency of the waves of ECG signal can influence its performance. This entrained being able a detection of false positions of the waves and consequently a bad detection of the QRS complex positions. In the same way the techniques of thresholding suffer their sensitivity to the noise which is high and a bad effectiveness in the treatment from odd morphologies (case of the R peaks reversed). Consequently, of the more elaborate techniques of treatment of the signals are necessary to facilitate the development of new algorithms of detection with a higher precision of detection.
Among these techniques the nonlinear filtering, which must be proven that the operators morphologies of dilation and erosion satisfy causality and the additive property of semi-group is required by the analysis of multi-scale [13-15] for signals of any dimension with local maxima and local minima which correspond to point singular.
The landmarks of ECG signal, such as the Q wave, the R peak, the S wave, the beginning and the end of the P wave and the T wave can be regarded as singular points [8].
Trahanias [9] use morphological mathematics for detecting RR peaks. Thus, a structuring element of similar triangular shape of the shape of the R wave and a fixed thresholding to extract the heart rhythm. In [10] present morphological filtering to suppress noise and baseline ECG signal. Sun et al. [11]. Use three steps to detect peak R: the morphological derivative called the gradient, the multi-scale morphological operations, and a thresholding that relies on the histogram.
The overall difference between our method and the method cited in [9] and [11] is the selection of the structuring element with respect to shape and size to extract information from the signal. Also, we did not use a thresholding but [9] and [11] uses thresholding to detect peak R. Thus, the morphological filtering algorithm remains fixed, to detect positive or negative peaks.
In our work, the algorithm developed for detection bench marks of the waves of ECG signal, based on Morphological Filtering (MF).
In morphological filtering [12], each signal is looked like a set, and the geometrical characteristics are modified by the morphological convolution of ECG signal with a structuring element, which is characterized by a simple form and the size. By varying the structuring element we can extract the various types of information starting from ECG signal. By the application of the mathematical morphology, defined in different operators morphology and the sensitivity of noise can be reduced by the method of the morphological filtering. Moreover, the problem of the deviation of position is existed in the techniques of the transformation of wavelets [6] but can be cancelled in the morphological transformation because of non-linearity.
A Morphological filtering is very widespread in the field of signal treatment and the image processing because of its robustness and its simple and fast calculation [8-12].
The mathematical morphology, based on operations of sets, provides an approach to the development of the nonlinear methods of treatment of the signals, in which the form of the information of a signal is, incorporated [14]. In these operations, the result of a whole of data transformed by another whole depends on the forms of the two implied sets. A structuring element must be designed according to the shape information of the signal which must be extracted.
There are two basic morphological operators: erosion and dilation .
The opening and closing are the operators derived defined in terms from erosion and dilation [14,15].
These operators are described in detail in below with the corresponding mathematical expressions. In this article, f (n) indicates discrete ECG signal of N size points (Figure 1a), and symmetrical structuring element the M points.
The expression below definite the erosion of function f (n) (ECG) by a structuring element B:
Erosion is characterized by the reduction of the peaks of signal and widened transformation the valleys. This transformation is an operator of shrinkage in which the values of are always lower than f.
Dilation
The expression (2) below definite the dilation of the function f (noisy ECG) by a structuring element B:
This transformation with for properties in the morphological filtering of filled the valleys and to widen the peaks of ECG signal. The dilation is an operation of expansion in which the values of are increasingly larger than f.
The opening is the application of the operator erosion then of the operator dilation with the same structuring element:
Closing is the “opposite” operation of the opening, i.e. which one applies first of all dilation then erosion (always by keeping the same structuring element):
is also less rich in detail than the function initial f.
This transformation by closing fills the valleys, removes holes. In general, the starting whole is not found because part of the form eliminated by erosion cannot be recreates by a dilation. The transformation of opening is more regular (less details) than the original signal f.
The transformation by opening operator removes the peaks but preserves the valleys.
The two operations of opening and closing are idempotent, i.e. that the result is invariant after iterations:
The operators “closing” and “opening” behave like filters; one will speak about “Morphological Filter”.
After the selection of the operator morphology, the structuring element (SE) is the next component of the morphological analysis to define. Generally, only when the form of the signal is matched with those of the structuring element that the signal can be preserved. Consequently, the form, length (domain) and size it (amplitude) structuring element should be selected according to the signal to be analyzed. The forms of the structuring element can vary regularly or irregularly, such as a triangle, line (flat), or a half-circle.
As that was described, the combination of the operator’s morphology «Closing + Ouverture» forms the morphological filter. The use of the operators’ morphology for the QRS complex detection was described [13]. Mathematical morphology is based on the limits of erosion and dilation.
To obtain the two functions eroded and dilated the f (n)
Whether, f : F→ I and B → I and b: B I, which are indicated the discrete functions, where the sets F and B are underlined by F = {0.1, …, N – 1} et B = {0.1, …., M - 1}. I is the sets of the integer.
The following formula illustrates the dilation of the function F (ECG filtered) by the structuring element B:
The values of are always lower the f.
The dilation of the function F (ECG filtered) by the structuring element B is given by:
The values of are always higher of f
Erosion and dilation are combined for additional operations.
The opening (o) is defined by the operation of erosion followed by dilation. Closing (•), is defined like a dilation followed by an erosion.
The two operators manipulate the signals in a comparable way. I.e., that the opening removes the peaks positive but preserves the valleys. For the closing of f with the same structuring element (flat) which must be removed all the valleys (peaks negative).
The detection of RR interval can be accomplished that after a good detection of R peak. This detection passes by three stages.
A stage which permit to locate the R peaks positive by the opened operation and another stage which allow to locate the R peaks negative by the application of the closed operation. The final stage to lead to these peaks and of the valleys is the subtraction of ECG signal filtered f with the two preceding operations.
The following formula illustrates the extraction of the R peaks positive:
Peaks (RR) = f – (f o B) (9)
And the following formula illustrates the extraction of the valleys or the R peaks negative:
Valleys (RR) = f – (f • B) (10)
The two preceding formulas are equivalent to:
(Peaks + valleys) (RR)= f – (f o B • B) (11)
The structuring element B is used to detect the peaks and the valleys. In this case is regarded as a geometrical form “segment horizontal various lengths”. The following formula shows the function of the structuring element B:
Where K is constant
One of the problems of the morphological approach to determine the optimal value of K. If it is too small, the transformation will be sensitive to the high frequency noise, and the peaks are incorrectly given. However k which must be lower width of R peaks. The researchers are indicated excellent results by the use of the values between (55-60) ms [16].
The morphological approach is evaluated on some reference ECG signals, available from the universal MIT–BIH arrhythmia database [17]. This base contains 48 recordings with a sampling rate of 360 Hz.
For each input ECG signal (filtered), the following procedures were executed:
(i) a pretreatment of ECGs signals; (ii) the signal is operated by the opening for the detection of the peaks positive; (iii) followed by the operation of closing to detect the peaks negative; (iv) after a subtraction enters the filtered signal and the signal detected by opening followed by a closing in order to extract the peaks from QRS complex.
ECG Signal is contaminated by the noises in their recordings in particular the noise of 50-60 Hz and the base line of frequency between 0-1 HZ. The data base is filtered by a five-order pass band Butterworth filter. On figure 2 is respectively illustrated the stages of the QRS complex detection of ECG filtered (recording 100). This figure illustrates the performance of the algorithm: in the detection of RR rate/rhythm. In fact to generate a rate of heart beat RR, the stages of treatment realized and which constitute overall all the stages of morphological filter summarize as follows.
First of all, ECG signal is opened by an element structuring B, which means the application of two operators of morphologies “erosion + dilation”, to locate the peaks positive and to preserve the valleys. This operation “opening”, generates a signal constitute of the valleys (or peaks negative) which are located by the operation of closing “dilation + erosion”. The final stage to lead to the detection of peaks RR is the subtraction of ECG signal filtered with the signal generated by (f o B • B).
The structuring element B is used for the detection of RR peaks. In this case is regarded as a geometrical form “segment horizontal various lengths”. The figure 3a, represents a pathological signal of recording 107. We can notice that the amplitude of the T wave is almost half of R peak. In addition, we used the structuring element with sizes different in the operations morphologies from the opening and closing.
In the figure 3b, the size of the structuring element is lower 55 ms, which meant bad localization of the peak and valleys in the stage of opening and closing.
The figure 2c, illustrates a good performance of detection rate/rhythm RR by the use of the structuring element B with a variable size between (50-60) ms.
The results which one obtained show that the length of the structuring element in the operation of opening and closing plays a very significant role for the detection of RR peaks.
The application of the proposed method by the operators’ morphologies on the recordings (108-109-119-212), gives very satisfactory results as that is illustrated; in figures 4-7.
The selection of the structuring element is very important to follow the variation of RR wave morphology. The figures 4-7 show a variation of the morphology of each QRS complex cycle and the results present a good detection of the RR peaks.
More than 20000 beats of ECG signals are annotated from the database of arrhythmia MIT-BIH. It is employed to evaluate the detection proposed of the morphological filtering.
In order to quantify the performance of the QRS complex detection of ECG signal by the technique proposed, two parameters are used: the Predictivity (P) and sensitivity (Se).
The sensibility (Se) is defined by the equation according to:
Se = TP / (TP + FN)
And the Positive Predictivity (+P) which is the fraction of detections that are real events and it is defined by,
+P = TP / (TP + FP)
Where FN (False Negatives) denotes the number of missed detections, FP (False Positives) represents the number of extra detections and TP (True Positives) is the number of the correctly detected QRS complexes.
The proposed method is compared with Christov’s method [18], Zero Crossing Counts Method (ZCCM) [19], and the Empirical Mode Decomposition (EMD) [2] as shown in table 1.
The experimental result shows that the proposed method performs better as compared to above four methods and allows a reliable and accurate detection of the QRS complexes.
New algorithm based on the mathematical morphology, named the filtering morphological, which was developed for the QRS complex detection of ECG signal. This algorithm is very robust vis-a-vis to the morphology variations of ECG signal and the speed of calculates.
However, the detection of QRS complex consisted three stages; the first is the positive peak detection used operators morphology (opening) followed by closing to detect the negative peaks. Finally, the subtraction of ECG filtered signal and the signal to detect by the operators of opening and closing in order to extract RR peaks. In addition, the structuring element is the key of this detection to extract the shape information from ECG signal. All ECGs from the MIT/BIH database have year evaluation set, show that more interesting performances compared to “Christov’ S”, Zero Crossing Counts Method and Empirical Mode Decomposition method, are obtained.
Subscribe to our articles alerts and stay tuned.
PTZ: We're glad you're here. Please click "create a new query" if you are a new visitor to our website and need further information from us.
If you are already a member of our network and need to keep track of any developments regarding a question you have already submitted, click "take me to my Query."