Skip to main content
Biomedical Engineering Letters logoLink to Biomedical Engineering Letters
. 2018 Apr 21;8(3):259–266. doi: 10.1007/s13534-018-0064-5

The application of ECG cancellation in diaphragmatic electromyographic by using stationary wavelet transform

Guo Luo 1,, Zhi Yang 1
PMCID: PMC6208538  PMID: 30603209

Abstract

In this paper, we present and investigate a special kind of stationary wavelet algorithm using “inverse” hard threshold to eliminate the electrocardiogram (ECG) interference included in diaphragmatic electromyographic (EMGdi). Differing from traditional wavelet hard threshold, “inverse” hard threshold is used to shrink strong coefficients of ECG interference and reserve weak coefficients of EMGdi signal. Meanwhile, a novel QRS location algorithm is proposed for the position detection of R wave by using low frequency coefficients in this paper. With the proposed method, raw EMGdi is decomposed by wavelet at fifth scale. Then, each ECG interference threshold is calculated by mean square, which is estimated by wavelet coefficients in the ECG cycle at each level. Finally, ECG interference wavelet coefficients are removed by “inverse” hard threshold, and then the de-noised signal is reconstructed by wavelet coefficients. The simulation and clinical EMGdi de-noising results show that the “inverse” hard threshold investigated in this paper removes the ECG interference in EMGdi availably and reserves its signal characteristics effectively, as compared to wavelet threshold.

Keywords: Stationary wavelet algorithm, Electrocardiography interference cancellation, Diaphragmatic electromyographic signals, “Inverse” hard threshold

Introduction

As weak bioelectricity signals, diaphragmatic electromyographic (EMGdi) is produced in the process of breathing, which contains a lot of physiological characteristics. In medicine field, EMGdi is used for diagnosis of chronic obstructive pulmonary disease (COPD) [13] and obstructive sleep apnea hypoventilation syndrome (OSAS) [46].

Skin surface electrode collection [79] and esophageal electrode collection [10, 11] are two kinds of mainstream methods in procedure of EMGdi signal collection. However, as a biosensor, safety and precision are the most important factors we must concern, and esophageal electrode collection has best performance in safety and precision. EMGdi collected from esophageal electrode collection is always corrupted by strong electrocardiography (ECG). Its characteristic can divide in two parts, one is that ECG interrupt has higher amplitude than EMGdi at time domain, the other is that there has frequency overlap between EMGdi and ECG in frequency domain. Muscle fatigue can be diagnosed by spectrum analysis of muscle electrical signal, but frequency overlap is the great trouble in detection of diaphragmatic muscle fatigue [12].

At present, various algorithms were proposed to remove the ECG from EMGdi. Independent component analysis was used for separating ECG from EMGdi [13], however, this method required 5 channels to record EMGdi signal, which consumed much more hardware resources. As a tradition signal processing method, high pass filter removed low frequency and kept high frequency [14], which was not effective way to eliminate ECG noise in EMGdi. As mentioned above, the situation of frequency overlap between ECG and EMGdi would be not suitable for high pass filter.

Time–frequency characteristic of wavelet transform can reflect the change of local short signal, therefore, wavelet transform was widely used in non-stationary biological signal [1518]. According to the distribution characteristic of ECG, wavelet threshold algorithm was used to localize QRS position and set up the de-noised threshold [13, 17, 18]. Most of the ECG interference were removed in this algorithm, but it still had several shortcomings: firstly, wavelet coefficients that are bigger than threshold are ignored, which lead to loss information of EMGdi; secondly, the proportions of threshold are adjusted by experimental experience; finally, the detection of QRS peak location is based on correlation arithmetic large scale coefficients, which may result in inaccuracy of QRS location. Aiming at the drawbacks of wavelet threshold algorithm, “inverse” hard threshold processing algorithm based on stationary wavelet transform and method using the square of low frequency coefficients to localize QRS peak are proposed in this paper.

Stationary wavelet transform

The orthogonal wavelet filter coefficients of H and Z can be described as hj and gj, Zr is interpolation zero padding operation, thus, the coefficients of Hr and Gr can be represented as Zrh and Zrg, which means that 2r-1 zero are interpolated in each of two coefficients in hj and gj. We define S as original signal, and signal decomposed by stationary wavelet is in the following form

cj+1=Hjcjdj+1=G[j]cj 1

where c0 = S, H0=H, G0=G, cj+1 is approximation coefficients, dj+1 is detail coefficients.Signal reconstruction can be represented as follows

cj=Rεcj+1,dj+1 2

where Rε is reconstruction operation. Differed with orthogonal wavelet, the filter of stationary wavelet is up-sampling, therefore, it can avoid Gibbs oscillation when using hard threshold to eliminate noise coefficients [19, 20].

De-noised algorithm based on stationary wavelet transform

The algorithm presented in this paper can be concluded as following steps.

  1. After EMGdi decomposed by fourth scale, we can get approximation coefficients Wa4 and detail coefficients Wd4,,Wd1. In order to concisely express, Wx(i,j) was used to stand for each level wavelet coefficients, where x is either a or b, i is the number of level, j is abscissa of wavelet coefficients.

  2. The square of low frequency wavelet coefficients defined as Coef(j)=Wa4(j)2 is used to enlarge amplitude coefficients between EMGdi and ECG. The detection of ECG peak can be written as
    Coef(j)>k×meanCoef(j) 3
    where k is proportion of detection threshold, n is signal length.

    In order to verify the effectiveness of different algorithm for solving the problem of detection of QRS wave, Orthogonal Wavelet Transform (OWT) algorithm [13, 17, 18] and Max Min Difference (MMD) algorithm [21] are used for comparing with Stationary Wavelet Transform (SWT) algorithm proposed in this paper. Besides, we use MIT-BIH arrhythmia ECG data [22] as the objects of QRS wave detection with different signal to noise ratio (SNR). In this database, No. 100 data regarded as pure ECG signal with interception of 30 s is selected for testing. In the process of experiment, it is very necessary to add gauss white noise to the pure ECG data, as the aim of paper is the detection of QRS wave in the EMGdi signal. ECG signal with 50 db SNR is shown in Fig. 1a, comparing with three algorithms, we see that the result of QRS detection using MMD algorithm and SWT algorithm have a better performance. As shown in Fig. 2a, when the SNR dips to 20 db, the ECG signal is completely drowned by noise. It is seen from Fig. 2b, c that the effects of QRS detection by using OWT algorithm and MMD algorithm are more easily affected by noise. However, from Fig. 2d, SWT algorithm developed in this paper is more effective on solving the problem of QRS detection in a strong noise environment. The circle symbols “o” denote location of R peak.

    In order to further demonstrate the merit of SWT algorithm, we use 15 cases of ECG signal with different SNR as objects for QRS detection. The input SNR is from 0 to 70 and QRS detection accuracy of each cases of SNR is obtained by calculating the average accuracy rate of 10,000 times. As shown in Fig. 3, the accuracy rate of QRS detection in different SNR by applying SWT algorithm can obtain highest accuracy rate in those three algorithms.

    The raw EMGdi signal and its QRS detection are shown in Fig. 4.

  3. Although ECG noise can be inhibited by wavelet threshold algorithm, its thresholds in each wavelet level are determined by personal experiment experience [17], which may cause experience error. In order to avoid this error, based on Donoho algorithm [23], the improvement method of threshold is proposed in this paper. The general threshold is λ=σ2lnN, where N is the length of noise, σ is the mean square error of noise, and it can be estimated by wavelet coefficients dj, its expression can be written as

    σ=mediandj/0.6745 4

    The threshold obtained from (4) is global, which is used in j level. However, global threshold is not reliable in EMGdi de-noising, as ECG noise is located in period and has larger amplitude in EMGdi. We regard T as the time cycle of ECG and its equation is as following

    T=(Pos(f)-Pos(1))/(f-1) 5
    where f is the total number of ECG. We choose 0.4 * T to be ECG disturbed region and regard before and after peak region ratio as 6:4, which means that ECG coefficients are dominant in region of Pos(t)-0.24×T,Pos(t)+0.16×T, where t[1,f]. Traditional hard threshold [8] is described as
    Newk(x)=k(x),k(x)>λ0,k(x)<λ 6
    where Newk(x) is the coefficients processed by hard threshold. On the contrast, we preserve the small coefficients as EMGdi signal and remove the big coefficients as ECG noise so that we define “inverse” hard threshold as following function
    NewWx(i,j)=Wx(i,j)Wx(i,j)<λ0,Wx(i,j)>λ 7
    where NewWx(i,j) is the coefficients processed by “inverse” hard threshold. In this algorithm, we only process the coefficients located in disturbed region and keep the other coefficients as same as before.
  4. We can obtain de-noised EMGdi signal by reconstructing stationary wavelet coefficients processed by this algorithm.

Fig. 1.

Fig. 1

a ECG signal with 50 db SNR; b QRS detection using OWT algorithm; c QRS detection using MMD algorithm; d QRS detection using SWT algorithm

Fig. 2.

Fig. 2

a ECG signal with 20 db SNR; b QRS detection using OWT algorithm; c QRS detection using MMD algorithm; d QRS detection using SWT algorithm

Fig. 3.

Fig. 3

The accuracy rate of QRS detection in different SNR

Fig. 4.

Fig. 4

a Raw EMGdi signal; b QRS detection using SWT

Experiment result and analysis

In order to test the effectiveness of “inverse” hard threshold algorithm, we apply wavelet threshold and algorithm of this paper to de-noise clinical and simulated EMGdi.

Simulated EMGdi de-noising result

As a biological signal, EMGdi is non-stationary signal and has the characteristic of random signal. When we do the actions of breathing in and breathing out, the outline of EMGdi is similar as sine signal. Consequently, simulated pure EMGdi signal is generated by multiplying zero mean Gaussian white noise by sine signal with a appropriate filter [17, 24], just as shown in Fig. 5a. As mentioned above, after low-pass filter, QRS waves are the main interference in clinical EMGdi. Thus, we use the MATLAB simulation program to generate QRS waves [25], just as shown in Fig. 5b.

Fig. 5.

Fig. 5

Simulated signal: a QRS interference; b pure EMGdi signal

Simulated EMGdi signal is generated by adding pure EMGdi signal with QRS interference, which is shown in Fig. 6a. Just as shown in Fig. 6b, wavelet threshold algorithm has capacity to cancel coefficients in EMGdi, but it also eliminates some useful coefficients of EMGdi, which lead to the obvious local sag in ECG peak. The processed EMGdi using “inverse” hard threshold is shown in Fig. 6b, which has the excellent performance in keeping the edge characteristic of EMGdi, and the phenomenon of attenuation in ECG noise location disappears after EMGdi de-noising.

Fig. 6.

Fig. 6

a EMGdi overlap ECG noise; b wavelet threshold de-noising result; c “inverse” hard threshold de-noising result

It is obvious shown in Fig. 7a that the energy of contaminated EMGdi is concentrated at low frequency range from 0 to 50 Hz and its amplitude is much higher than pure EMGdi. Power spectrum of de-noised EMGdi using wavelet threshold is a little bit lower than pure EMGdi, just as shown in Fig. 7b. Compared with wavelet threshold, we can observer in Fig. 7c that power spectrum of EMGdi de-noised by “inverse” hard threshold is much more close to pure EMGdi.

Fig. 7.

Fig. 7

a Power spectrum before de-noising; b EMGdi de-noised by wavelet threshold; c EMGdi de-noised by “inverse” hard threshold

In order to further illustrate the superiority of “inverse” hard threshold algorithm, we use the signal to noise ratio (SNR) and power spectrum relative error to evaluate the performance of the two algorithms. The SNR is defined as follows

SNR=10×logi=1Ns02(i)i=1Ns0(i)-s(i)2 8

where s0 is pure signal, s is de-noised signal, N is the length of signal. Power spectrum relative error (PSRE) is usually to assess the error of power spectrum between de-noised EMGdi and pure EMGdi [17]. Its equation is written as

δ=0f0PTf-Pf20f0PT2f 9

where PT is power spectrum of pure signal, P is power spectrum of de-noised signal, f0 is the upper bound of frequency.

From the view of Fig. 7 and the data analysis of Table 1, “inverse” hard threshold algorithm can achieve better performance than wavelet threshold in simulated EMGdi de-noising.

Table 1.

PSRE and SNR

Corrupted EMGdi Wavelet threshold “Inverse” hard threshold
SNR (db) − 5.85 6.10 10.79
PSRE (%) 10,028.15 7.26 1.08

Clinical EMGdi de-noising result

Clinical EMGdi experimental data were collected from patients with lung illness in Guangzhou Institute of Respiratory Diseases with duration of 15 s, as shown in Fig. 8a. We respectively use wavelet threshold and “inverse” hard threshold to process clinical EMGdi, Fig. 8b shows the result processed by wavelet threshold algorithm, Fig. 8c shows the result processed by “inverse” hard threshold algorithm. Compared with Fig. 8b, c, the outline of EMGdi filtered by “inverse” hard threshold is more enrich than EMGdi processed by wavelet threshold. From the power spectrum analysis in Fig. 9b, energy distribution of EMGdi processed by wavelet threshold is a little lower than EMGdi processed by “inverse” hard threshold in frequency domain.

Fig. 8.

Fig. 8

a Raw EMGdi; b EMGdi de-noised by wavelet threshold; c EMGdi de-noised by “inverse” hard threshold

Fig. 9.

Fig. 9

a Power spectrum difference between raw EMGdi and EMGdi de-noised by “inverse” hard threshold; b power spectrum difference between EMGdi processed by wavelet threshold and EMGdi processed by “inverse” hard threshold

As a clinical signal, we can not accurately obtain its real signal, thus, SNR and PSRE are not useful to evaluate the efficient of algorithms. Clinical EMGdi is usually assessed by median frequency and total power after de-noising [13, 17, 18]. Total power is denoted as following

Pow=fPf 10

and median frequency is defined as

fm=ff×PffPf 11

where P is power spectrum, f is frequency.

The power spectrum of EMGdi is mainly distributed in the range from 25 to 250 Hz, but ECG interference is concentrated from 0 to 55 Hz. The vast majority energy is located in low frequency in raw EMGdi. After filtered by wavelet threshold and “inverse” hard threshold, median frequency of EMGdi transfer to high frequency. As shown in Table 2, median frequency of EMGdi processed by wavelet threshold is 138.37 Hz, and median frequency of EMGdi processed by “inverse” hard threshold is 108.36 Hz. In literatures [13, 17, 18], normal median frequency of EMGdi is in the range from 80 to 117 Hz after removing the ECG interference. Median frequency of EMGdi de-noised by “inverse” hard threshold is closer to normal EMGdi than wavelet threshold. Besides, “inverse” hard threshold preserve more energy than wavelet threshold.

Table 2.

Median frequency and total power

EMGdi before de-noising Wavelet threshold “Inverse” hard threshold
Median frequency (Hz) 57.29 138.37 108.36
Total power (mV2/Hz) 3000 834 1000

Conclusion

Based on the characteristic of EMGdi, a new algorithm is proposed in this paper, which includes applying low frequency coefficients square to locate the peak of ECG and using “inverse” hard threshold to eliminate ECG interference coefficients. The value of threshold has a great effective on EMGdi de-noising, and in this paper threshold is constructed by Donoho shrink algorithm. Compared with orthogonal wavelet, when we use hard threshold to eliminate noise coefficients and reconstruct signal from coefficients, stationary wavelet can avoid Gibbs oscillation.

Compared with OWT algorithm and MMD algorithm, SWT algorithm investigated in this paper can achieve highest accuracy in QRS detection. From the analysis of experimental results, we use SNR, PSRE, median frequency and total energy to evaluate two algorithms, and the results shows that each index in “inverse” hard threshold is more superior than wavelet threshold. However, the interference in EMGdi collected from electrodes are complex, which not only have ECG noise but also have some other biological signal. In this paper, we focus on how to remove ECG interference. How to eliminate some other biological signal is still a question we need to continue to explore.

Conflict of interest

The authors declare that they have no conflict of interests in relation to the work in this article.

Ethical approval

Approval was obtained from the Guangzhou Institute of Respiratory Disease for experiments involving human subjects.

References

  • 1.Luo YM, Moxham J. Measurement of neural respiratory drive in patients with COPD. Respir Physiol Neurobiol. 2005;146(2–3):165–174. doi: 10.1016/j.resp.2004.12.014. [DOI] [PubMed] [Google Scholar]
  • 2.Jolley CJ, Luo YM, Steier J, et al. Neural respiratory drive and breathlessness in COPD. Eur Respir J. 2015;45(2):355. doi: 10.1183/09031936.00063014. [DOI] [PubMed] [Google Scholar]
  • 3.Qin YY, Steier J, Jolley C, et al. Efficiency of neural drive during exercise in patients with COPD and healthy subjects. Chest. 2010;138(6):1309. doi: 10.1378/chest.09-2824. [DOI] [PubMed] [Google Scholar]
  • 4.He BT, Lu G, Xiao SC, et al. Coexistence of OSA may compensate for sleep related reduction in neural respiratory drive in patients with COPD. Thorax. 2017;72(3):256. doi: 10.1136/thoraxjnl-2016-208467. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 5.Luo YM, Wu HD, Tang J, et al. Neural respiratory drive during apnoeic events in obstructive sleep apnoea. Eur Respir J. 2008;31(3):650–657. doi: 10.1183/09031936.00049907. [DOI] [PubMed] [Google Scholar]
  • 6.Luo YM, Tang J, Jolley C, et al. Distinguishing obstructive from central sleep apnea events: diaphragm electromyogram and esophageal pressure compared. Chest. 2009;135(5):1133–1141. doi: 10.1378/chest.08-1695. [DOI] [PubMed] [Google Scholar]
  • 7.Rutkove SB, Pacheck A, Sanchez B. Sensitivity distribution simulations of surface electrode configurations for electrical impedance myography. Muscle Nerve. 2017;56(5):887–895. doi: 10.1002/mus.25561. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 8.Kim JH, Lee SM, Lee SH. Capacitive monitoring of bio and neuro signals. Biomed Eng Lett. 2014;4(2):142–148. doi: 10.1007/s13534-014-0139-x. [DOI] [Google Scholar]
  • 9.Fujii S, Kasuya M, Kurihara K. Characterization of Platinum electrode surfaces by electrochemical surface forces measurement. J Phys Chem C. 2017;121(47):26406–26413. doi: 10.1021/acs.jpcc.7b09301. [DOI] [Google Scholar]
  • 10.Ramsook AH, Molgat-Seon Y, Schaeffer MR, et al. Effects of inspiratory muscle training on respiratory muscle electromyography and dyspnea during exercise in healthy men. J Appl Physiol. 2017;122(5):1267–1275. doi: 10.1152/japplphysiol.00046.2017. [DOI] [PMC free article] [PubMed] [Google Scholar]
  • 11.Ramsook AH, Mitchell RA, Bell T, et al. Is parasternal intercostal EMG an accurate surrogate of respiratory neural drive and biomarker of dyspnea during cycle exercise testing? Respir Physiol Neurobiol. 2017;242:40–44. doi: 10.1016/j.resp.2017.03.003. [DOI] [PubMed] [Google Scholar]
  • 12.Rocha VDA, Carmo JCD, Nascimento FADO. Weighted-cumulated S-EMG muscle fatigue estimator. IEEE J Biomed Health Inform. 2017;PP(99):1. doi: 10.1109/JBHI.2017.2783849. [DOI] [PubMed] [Google Scholar]
  • 13.Wu FY, Tong F, Yang Z. EMGdi signal enhancement based on ICA decomposition and wavelet transform. Appl Soft Comput. 2016;43:561–571. doi: 10.1016/j.asoc.2016.03.002. [DOI] [Google Scholar]
  • 14.Isaksen J, Leber R, Schmid R, et al. Quantification of the first-order high-pass filter’s influence on the automatic measurements of the electrocardiogram. Comput Methods Programs Biomed. 2017;139:163–169. doi: 10.1016/j.cmpb.2016.11.003. [DOI] [PubMed] [Google Scholar]
  • 15.Mowla MR, Ng SC, Zilany MSA, et al. Artifacts-matched blind source separation and wavelet transform for multichannel EEG denoising. Biomed Signal Process Control. 2015;22:111–118. doi: 10.1016/j.bspc.2015.06.009. [DOI] [Google Scholar]
  • 16.Li S, Lin J. The optimal de-noising algorithm for ECG using stationary wavelet transform. In: Wri world congress on computer science and information engineering. IEEE Computer Society; 2009. pp. 469–73.
  • 17.Zhan CJ, Yeung LF, Yang Z. A wavelet-based adaptive filter for removing ECG interference in EMGdi signals. J Electromyogr Kinesiol. 2010;20(3):542–549. doi: 10.1016/j.jelekin.2009.07.007. [DOI] [PubMed] [Google Scholar]
  • 18.Wu FY, Yang K, Yang Z, et al. Compressed acquisition and denoising recovery of EMGdi signal in WSNs and IoT. IEEE Trans Ind Inform. 2017;PP(99):1. [Google Scholar]
  • 19.Blakely C, Gelb A, Navarra A. An automated method for recovering piecewise smooth functions on spheres free from Gibbs oscillations. Sampl Theory Signal Image Process. 2007;6(3):323–346. [Google Scholar]
  • 20.Amat S, Dadourian K, Liandrat J. On a C2-nonlinear subdivision scheme avoiding Gibbs oscillations. 2008. arXiv:0812.2562v1[math.NA].
  • 21.Pandit D, Zhang L, Liu C, et al. A lightweight QRS detector for single lead ECG signals using a max-min difference algorithm. Comput Methods Programs Biomed. 2017;144:61–75. doi: 10.1016/j.cmpb.2017.02.028. [DOI] [PubMed] [Google Scholar]
  • 22.Moody GB, Mark RG. The impact of the MIT-BIH arrhythmia database. IEEE Eng Med Biol Mag Q Mag Eng Med Biol Soc. 2001;20(3):45. doi: 10.1109/51.932724. [DOI] [PubMed] [Google Scholar]
  • 23.Donoho DL, Maleki A, Montanari A. Message passing algorithms for compressed sensing: II. Analysis and validation. In: Information theory. IEEE; 2010. pp. 1–5.
  • 24.Deng YC, Wolf W, Schnell R, et al. New aspects to event synchronous cancellation of ECG interference: an application of the method in diaphragmatic EMG signals. IEEE Trans Biomed Eng. 2000;47(9):1177–1184. doi: 10.1109/10.867924. [DOI] [PubMed] [Google Scholar]
  • 25.Karthik R. ECG simulation using Matlab. http://webscripts.softpedia.com/scriptDownload/ECG-simulation-using-MATLAB-Download-32785.html. August 10th 2007/ November 28th 2012.

Articles from Biomedical Engineering Letters are provided here courtesy of Springer

RESOURCES