Keywords

1 Introduction

Heart rate variability (HRV) is produced in the periodical change of heart beat intervals, which is one of the important indices for reflecting the sympathetic nerve and vagus nerve activity’s balance in the autonomic nervous system. It can be used for many diseases’ prediction or diagnoses, such as sudden cardiac death, coronary heart disease, heart failure, hypertension, diabetes, Parkinsonʼs disease and apnea disease, etc. [1]. However, HRV is derived from ECG signals, ECG signals’ acquisition needs many electrodes and multifarious wires. At the same time, ECG signals acquisitioned by monitoring equipment often contain interferences caused by many factors, including human movement. In recent years, many scholars have carried out extensive research on interferences detection, such as W. Karlen proposed a method of repeatedly using Gaussian filter and cross-correlation for PPG signals quality evaluation which can realize the interferences detection in PPG signals further [2]. The method needs segment PPG signals earlier. But because of the noise and artifacts, the segmentation accuracy is hard to guarantee, which leads the accuracy of algorithm is not high. C. Orphanidou proposed quality evaluation method based on RR intervals [3]. The method is achieved by adaptive template matching theory, but template generation process is very complicated, thus the algorithm is very complex and the real-timeliness becomes poor. Li Qiao proposed machine learning method to classify multichannel ECG signals based on signal quality indices (SQI) [4]. The SQI of each channel signal is extracted first, then using SVM to complete the classification. Although the accuracy of the algorithm is high, as it is aiming at off-line data, the real-timeliness of the algorithm is not so good.

In addition, HRV in ECG signals interferences is difficult to directly be extracted, nowadays, which is mainly estimated by means of the synchronously acquisitioned PPG signals. In 2014, Physionet web site launched a competition entitled “Robust Detection of Heart Beats in Multimodal Data”, aiming at estimating heart rate in ECG interferences through multi-channel signal fusion. Because pulse rate variability (PRV) is also derived from small changes in the period of heart beat, contains body’s physiological and pathological rich information. Compared with HRV, PRV is extracted from PPG signals, the acquisition of PPG signals doesn’t need many electrodes and multifarious wires, so it’s easy for mobile portable medical instrument. A large number of studies have shown that PRV and HRV have a clear correlation. Even in the condition of the body at rest, PRV can directly replace HRV to reflect the characteristics of heart beat [5]. Therefore, massive papers in the competition use PRV directly as HRV in ECG signals interferences. But in fact there are tiny differences between HRV and PRV, directly using PRV to estimate HRV in ECG signals interferences will inevitably produce errors, which makes some disease detection methods or system based on HRV to be less reliable or even invalid.

To solve above problems, on the basis of existing research, we proposed ECG signals interferences detection algorithm based on the principle of short-time autocorrelation and the HRV estimation method in ECG signals interferences based on PPG signals, then applied them to 2014 competition data in Physionet to analyze their accuracy and real-timeliness.

2 Materials and Method

2.1 Data

The Challenge 2014 Training Set data (Challenge/2014/Set-p) [6] in the Physionet web site is used as the experimental data. This database provides 100 groups of data from patients with cardiovascular disease and healthy adults, each group includes seven channels synchronously acquisitioned data, including ECG, blood pressure (BP) and EEG, etc., the first of which is ECG signals, the remaining signals can be any of a variety of simultaneously recorded physiologic signals that may be useful for robust beat detection. The sampling frequency is 250 Hz. The database contains signals at most 10 min in length or occasionally shorter. Because BP signals is the other form of PPG, we regarded BP as PPG, and then ECG and PPG signals were chosen as the experimental data.

2.2 Method

The HRV estimation method in ECG signals interferences based on PPG signals which is proposed, mainly includes ECG signals and PPG signals filtering, ECG interferences detection and HRV estimation.

ECG Interferences Detection.

According to the characteristics of ECG and PPG signals, the integral coefficient notch filter and low-pass filter are designed in paper [7], which are used to filter out the repressible noises and interferences in ECG and PPG signals first. Then, according to the short-time autocorrelation of ECG signals, smooth degree, and dynamic variation coefficient based on short-time autocorrelation, setting threshold detects interferences. The overall process is shown in Fig. 1.

Fig. 1.
figure 1

Overall block diagram of ECG signals interferences detection

ECG Signals Short-Time Autocorrelation.

Signal’s autocorrelation function can be used in the analysis of the similarity of the same signal at different time or the different signals. Using the sliding window iterative method calculates the autocorrelation function called short-term autocorrelation function. As shown in Fig. 2, the core of the sliding window iteration is: adding a new sampling data and weeding out the old one in one fixed window (window width is N, here, N = 2*f s). That is, when window moves every time, the latest sampling data will be in the window of Nth bit, the original old data will move left with one bit, the first data (the earliest data) will be removed.

Fig. 2.
figure 2

Sliding window iteration schematic diagram

Setting the window width as N sampling points, ensuring that every window has two full of ECG signals waveforms at least. The sliding window iterative algorithm for calculating the autocorrelation function is defined as:

$$ R\left( k \right) = \left\{ \begin{aligned} & \sum\limits_{n = 1}^{N - k} {x\left( n \right)x\left( {n + k} \right),1 \le n \le N} \\ & \sum\limits_{n = 1}^{N - k} {x\left( n \right)x\left( {n + k} \right) + x\left( {n - k} \right)x\left( n \right) - x\left( {n - N} \right)x\left( {n - N + k} \right),n > N} \\ \end{aligned} \right. $$
(1)

In Eq. (1), k is signal delay points (namely autocorrelation sequence number); N is sampling points for each window sequence (i.e., the length of each window). Then, normalizing the autocorrelation function R(k) to r(k) with the min-max normalization method.

Smooth Degree.

Using the ratio of signal extreme value point number and the signal length evaluates smooth degree (SD), for one dimensional signal with a length of m, the more extreme value points (up to m − 2) it has, the rougher it will be. Defined smooth degree as:

$$ SD = 1 - \frac{{N_{e} }}{m - 2} $$
(2)

In Eq. (2), Ne is the number of extreme value points. The closer to 1 the SD be, the smoother the signal will be, when SD = 1, the signal is a straight line.

Using sliding window method detects the SD of ECG signals short-time autocorrelation function, considering the algorithm’s real-timeliness and accuracy requirements, determining the window width is 30 sampling points through a large number of experiments.

Dynamic Variation Coefficient.

Defining the dynamic variation coefficient with local mean and variance of ECG signals as:

$$ DVC\left( i \right) = \frac{Var\left( i \right)}{Mean\left( i \right)} $$
(3)

In Eq. (3), DVC (i) is variation coefficient of r(i), r(i) is ECG signals short-time autocorrelation function of the ith sampling point. i = 1, 2, 3, …; Var(i) and Mean(i) are the dynamic mean and dynamic variance of a part of signals with the end of r(i), respectively. Figure 3 is the calculation process of dynamic mean and dynamic variance.

Fig. 3.
figure 3

Calculation process of dynamic mean and dynamic variance

Using sliding window iterative method calculates dynamic mean and variance. The dynamic mean is:

$$ Mean\left( i \right) = \left\{ \begin{aligned} \frac{S\left( i \right)}{i}\;\;\;\;\;\; & i \le w \\ \frac{S\left( i \right)}{w}\;\;\;\;\;\; & i > w \\ \end{aligned} \right. $$
(4)

In Eq. (4), w is sliding window width. Being similar to the calculation of smooth degree, setting window width w = 30 sample points; Mean(i) represents the mean of the sampling points in the current window; S(i) is the total sample values in the window which can be obtained by iteration method, especially, S(1) = r(1):

$$ S\left( i \right) = \left\{ \begin{aligned} S\left( {i - 1} \right) + r\left( i \right)\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; & i \le w \\ S\left( {i - 1} \right) + r\left( i \right) - r\left( {i - w} \right)\;\;\;\;\;\;\;\;\;\; & i > w \\ \end{aligned} \right. $$
(5)

Similarly, dynamic variance is:

$$ Var\left( i \right) = \left\{ \begin{aligned} \frac{{S1\left( \text{i} \right)}}{i}\;\;\;\;\;\;\;\;\;\; & i \le w \\ \frac{{S1\left( \text{i} \right)}}{w}\;\;\;\;\;\;\;\;\;\; & i > w \\ \end{aligned} \right. $$
(6)

In Eq. (6),

$$ S1\left( i \right) = \left\{ \begin{aligned} S1\left( {i - 1} \right) + \left( {r\left( i \right) - Mean\left( i \right)} \right)^{2} \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\; & i \le w \\ S1\left( {i - 1} \right) + \left( {r\left( i \right) - Mean\left( i \right)} \right)^{2} - \left( {r\left( {i - w} \right) - Mean\left( {i - w} \right)} \right)^{2} \;\;\;\;\;\;\;\;\;\; & i > w \\ \end{aligned} \right. $$
(7)

In Eq. (7), S1(1) = 0. Then, normalizing dynamic variance to the scope of [0, 1] with the method of min-max normalization.

ECG Signal Interferences Detection.

The threshold value is set to judge ECG signals interferences with the combination of ECG signals’ short-term autocorrelation function value, smooth degree and dynamic variation coefficient. Through calculating the mean of smooth degree thresholds and dynamic variation coefficient thresholds of 100 groups of data in the database, respectively, the final thresholds are obtained. That is, the final smooth degree threshold is 0.85 and dynamic variation coefficient threshold is 0.7. ECG signals interferences are detected by Eq. (8):

$$ ECG = \left\{ \begin{aligned} 1,\;\;\;\;\; & SD\left( w \right) \le 0.85\quad and\quad DCV\left( w \right) \ge 0.7 \\ 0,\;\;\;\;\; & others \\ \end{aligned} \right. $$
(8)

In Eq. (8), ‘1’ represents interferences, ‘0’ represents the normal; SD(w) is smooth degree of the signal, DVC (w) is dynamic variation coefficient of the signal.

HRV Estimation in ECG Interferences.

At present, the estimation of HRV in ECG signals interferences is directly replaced with PRV of synchronously acquisitioned PPG signals, but the prediction accuracy and real-timeliness is not high. So, in order to improve the estimation accuracy and real-timeliness, the improved sliding window iterative DFT algorithm is used to estimate instantaneous PRV real-timely, and then the estimated PRV is regarded as HRV in ECG interferences.

Improved Sliding Window Iterative DFT Algorithm.

For periodic signal \( \left\{ {x\left( k \right)} \right\},k = 0, \ldots ,M, \) M is the length of signal. Assuming that there are N sampling points in the period T, the sampling period τ = T/N, angular frequency \( \omega = 2\pi /T \). So the signal’s fundamental component \( \left\{ {x_{1} \left( k \right)} \right\} \) can be obtained by:

$$ x_{1} \left( k \right) = A_{1} \cos \left( {\omega k\tau } \right) + B_{1} \sin \left( {\omega k\tau } \right) $$
(9)
$$ A_{1} = \frac{2}{N}\sum\limits_{{i = N_{cur} }}^{{N_{cur} - N + 1}} {x\left( {i\tau } \right)} \cos \left( {\omega i\tau } \right) $$
(10)
$$ B_{1} = \frac{2}{N}\sum\limits_{{i = N_{cur} }}^{{N_{cur} - N + 1}} {x\left( {i\tau } \right)} \sin \left( {\omega i\tau } \right) $$
(11)

Being based on this theory, an improved method of sliding window iterative DFT had been proposed in paper [8], which can improve the real-timeliness of algorithm further. Figure 4 is the schematic diagram of the improved sliding window iterative DFT.

Fig. 4.
figure 4

Improved sliding window iterative DFT schematic diagram

In Fig. 4, S a and S b are two iterative process variables of sliding window DFT.

$$ S_{a} \left( k \right) = \sum\limits_{i = N - k + 1}^{N} {x\left( i \right)} \cos \left( {\frac{2\pi }{N}i} \right) $$
(12)
$$ S_{b} \left( k \right) = \sum\limits_{i = N - k + 1}^{N} {x\left( i \right)} \sin \left( {\frac{2\pi }{N}i} \right) $$
(13)

In the process of the movement of the window, new data point \( x\left( k \right) \) is located in the window of Nth bit all the time, that is, \( x\left( k \right) = x\left( {N_{c} } \right) \) thus:

$$ \begin{aligned} x_{1} \left( k \right) & = x_{1} \left( {N_{c} } \right) \\ & = A_{1} \cos \left( {\omega \tau N_{c} } \right) + B_{1} \sin \left( {\omega \tau N_{c} } \right) \\ & = A_{1} \cos \left( {\frac{2\pi }{N} \times N} \right) + B_{1} \sin \left( {\frac{2\pi }{N} \times N} \right) \\ & = A_{1} = \frac{2}{N}S_{a} \left( k \right) \\ \end{aligned} $$
(14)

Compared to the traditional sliding window iterative DFT algorithm, it can significantly reduce the calculation amount and can be effectively used to extract fundamental wave signal real-timely.

The Extraction of PRV.

Through applying the improved sliding window iterative DFT algorithm for PPG signals which are synchronously acquisitioned with ECG interferences, the fundamental wave are obtained, which can reflect the periodic change of PPG signals. So, period Δt′ of fundamental wave signal scan effectively reflect the change of period Δt of PPG signals. Its maximum value is the peak (\( {\text{P}}^{\prime} \) wave), which is easy to detect. So the fundamental wave can replace the PPG signals to realize the detection of PRV signal. The main peak of the fundamental wave signals is denoted as \( pp\left( i \right),i = 1,2, \ldots ,n - 1,n \) is the amount of \( {\text{P}}^{\prime} \) wave, then, PRV(i) is:

$$ PRV\left( i \right) = \frac{60}{{pp\left( i \right)/f_{s} }} $$
(15)

In Eq. (15), f s is sampling frequency. The PRV extracted is regarded as HRV in ECG interferences.

3 Results and Discussion

3.1 ECG Interferences Detection Results

The signals interferences are annotated by Yang Xiaohua first, who is the chief physician in hospital of Lanzhou University of Technology. Then, 100 groups of data in the database are tested, and the algorithm accuracy is evaluated. Counting the number of interferences sections which are detected correctly by proposed algorithm, namely true positives (TP); the number of interferences sections which are detected falsely, namely false positives (FP); as well as the missing interferences sections number, namely false negatives (FN). Evaluating the accuracy (Positive Predictivity, +P) and sensitivity (Se) of the algorithm.

$$ + P = \frac{TP}{TP + FP} $$
(16)
$$ S_{e} = \frac{TP}{TP + FN} $$
(17)

In addition, the proposed method is compared with ECG signals interferences detection algorithm based on repeated gaussian filter and cross-correlation in paper [2] and the algorithm based on RR intervals in paper [3] which are commonly used. The result is shown in Table 1. The ‘Time’ in Table 1 represents the running time of a length of 2 min ECG signals. The simulation results of the ECG intercepted from the database are shown in Figs. 5, 6 and 7, respectively.

Table 1. 100 groups of ECG signals interferences detection results statistics
Fig. 5.
figure 5

ECG and ECG interferences detection result

Fig. 6.
figure 6

ECG interferences detection results compared with the algorithm in paper [2]

Fig. 7.
figure 7

ECG interferences detection results compared with the algorithm in paper [3]

It can be seen that detection accuracy and sensitivity are both higher than the method proposed in paper [2] and paper [3] from Table 1. In addition, the proposed method takes shorter time. This is due to the algorithm which proposed in paper [2] mainly relies on the accurate segmentation of signals earlier. The algorithm proposed in paper [3] essentially depends on the correct detection of R wave. But they are both hard to segment or detect accurately because of noises and interferences. Also, we can see that the algorithms they proposed detect the normal ECG waves as interferences in Figs. 6 and 7, so the algorithms accuracy is not higher than algorithm proposed. In addition, as the algorithm in paper [2] needs filter with Gaussian filter repeatedly during the period of heart beat segmentation, so the real-timeliness becomes poor. Similarly, the algorithm in paper [3] needs to perform adaptive template matching after R waves detection, but the template generation process is complex. So the algorithm complexity is enhanced, and real-timeliness becomes poor. In a word, the algorithm we proposed can detect ECG interferences more accurately and more real-timely.

3.2 HRV Estimation Results in ECG Interferences

Experiments.

Selecting the number of 200 clean ECG signals sections from the database, after filtering process, using dynamic difference threshold method [9] extracts R wave, getting RR interval sequences further, then HRV = 60/(RR(i)/f s )(bpm), the sampling frequency is f s , this HRV is considered as true heart rate variability (THRV); 200 clean sections of PPG signals which are synchronous with ECG signals interferences are intercepted, too. Then, using the proposed method estimates HRV from them, which is regarded as estimated heart rate variability (EHRV).

Experiments Results and Analysis.

EHRV is compared with THRV from the aspects of absolute error, relative error, the maximum absolute error, mean relative error and root mean square error, etc. The mean of each parameters is calculated further, respectively, that is, calculating mean maximum absolute error (MMAE); mean relative error (MRE); mean root mean square error (MRMSE) and mean standard deviation (MSD). Similarly, PRV which are extracted with the same method with THRV from PPG signals is compared with THRV; Finally, analyzing the error of proposed algorithm and the traditional PRV directly replaced HRV algorithm. The results are shown in Table 2. The ‘Time’ represents the running time of a length of 1 min signal. It can be seen from Table 2, accuracy of the algorithm proposed is higher than PRV directly replaced algorithm. This is because PRV and HRV have tiny difference, so directly replaced algorithm will reduce the accuracy. Meanwhile, due to the characteristics of sliding window iterative DFT algorithm, it takes shorter time than PRV directly replaced algorithm, obviously. Comparing the proposed algorithm with THRV and PRV based on a length of 40 s ECG signals (188 m(100000:110000)) intercepted from database, the result is shown in Fig. 8.

Table 2. Error analysis of HRV estimation
Fig. 8.
figure 8

Comparing result of HRV estimation algorithms

4 Conclusion

Aiming at the problem of HRV estimation in ECG interferences, a new method is proposed to estimate HRV in ECG interferences from PPG signals segments which are synchronously acquisitioned with ECG interferences. The proposed method is compared with the PRV directly replaced HRV algorithm. The results show that the method proposed can more accurately and more real-timely estimate HRV in ECG signals interferences. To sum up, the method we proposed can avoid influence of interferences, reduce the false alarm rate of monitor, improve the quality of diagnosis and emergency levels, meanwhile, which has an important application value in areas such as clinical diagnosis, disease monitoring and prevention.