Estimation of ECG features using LabVIEW.pdf - Technia

68 downloads 73 Views 504KB Size Report
from the ECG signal. Then it detects P-wave, T- wave, QRS complex and their onsets and offsets. LabVIEW and the related toolkits, advanced signal processing  ...
TECHNIA – International Journal of Computing Science and Communication Technologies, VOL. 2, NO. 1, July 2009. (ISSN 0974-3375)

Estimation of ECG features using LabVIEW Channappa Bhyri*, Kalpana.V, S.T.Hamde, and L.M.Waghmare

Abstract—Various methods have been proposed and used for ECG feature extraction with considerable percentage of correct detection. Nevertheless, the problem remains open especially with respect to higher detection accuracy in noisy ECGs. In this work we have developed an algorithm based on wavelet transform approach using LabVIEW 8.6. LabVIEW (Laboratory Virtual Instrument Engineering Workbench) is a graphical programming language that uses icons instead of lines of text to create programs. Unlike text based programming language, LabVIEW uses the data flow programming, where the flow of data determines execution. The flexibility, modular nature and ease to use programming possible with labview, makes it less complex. The proposed algorithm is executed in two stages. Firstly, it preprocesses (denoises) the signal to remove the noise from the ECG signal. Then it detects P-wave, T- wave, QRS complex and their onsets and offsets. LabVIEW and the related toolkits, advanced signal processing toolkit and math script are used to build the graphical programme for both the stages. The algorithm is evaluated with ECG data files, with different ECG morphologies and noise content taken from CSE multilead data base which contains 5000 samples per ECG, recorded at a sampling frequency of 500Hz. Keywords: LabVIEW.

T

ECG,

Feature

Extraction,

Wavelet

Transform,

I. INTRODUCTION

H Biomedical signals are fundamental observations for analyzing the body functions and for diagnosing a wide spectrum of diseases. The analysis of ECG has been widely used for diagnosing many cardiac diseases. The ECG is a graphic record of the duration and magnitude of the electrical activity that is generated by depolarization and repolarization of the atria and ventricles. One cardiac cycle in an ECG consists of the P-QRS-T waves. Most of the clinically useful information in the ECG is found in the intervals and amplitudes defined by its features (characteristics wave peaks and time durations). The development of accurate and quick methods for automatic ECG feature extraction is of major Manuscript received *Channappa.Bhyri is with the Department of Instrumentation Technology, P.D.A.College of Engineering, Gulbarga, Karnataka, India (e-mail: channubhyri@ yahoo.com). Kalpana.V. is with the Department of Instrumentation Technology, P.D.A.College of Engineering, Gulbarga, Karnataka, India (e-mail: kvanjerkhede@ yahoo.co.in). S.T.Hamde is with the Department of Instrumentation Engineering,S.G.G.S. Institute of Engineering and Technology,Nanded, Maharashtra, India(e-mail:[email protected]). L.M.Waghmare is with the Department of Instrumentation Engineering,S.G.G.S. Institute of Engineering and Technology,Nanded, Maharashtra, India(e-mail:[email protected]).

importance. The ECG feature extraction provides fundamental features (amplitudes and intervals) to be used in subsequent automatic analysis. Producing an algorithm for the detection of the P wave, QRS complex and T wave in an ECG is a difficult problem due to the time varying morphology of the signal subject to the physiological conditions and presence of noise. The algorithms in the relevant bibliography adapt a range of different approaches to yield a procedure leading to the denoising and identification of the waves under consideration. These approaches are mainly based on wavelet [1-10], matched filters [11-12], Poisson transform [13], mathematical morphology [14], fuzzy logic [15-19], LabVIEW[2022].From the bibliography[20-21],it is seen that LabVIEW can be used effectively for QRS detection. In the work presented here an algorithm is proposed with low computational complexity using LabVIEW for filtering ECG signals and detection of P wave, T wave, QRS wave and their onsets and offsets. In a virtual instrumentation system, a computer including calculating, storing, replaying, accessing, displaying and file managing etc. are used which realize performing the functions of traditional instrumentation via software. Therefore a Virtual ECG Instrumentation system is a new Instrumentation system, which is much better and flexible with the aid of computer intelligent resource. II. WAVELET TRANSFORM A wavelet is a mathematical function used to divide a given function or continuous time signal into different scale components. Usually one can assign a frequency range to each scale component. Each scale component can then be studied with a resolution that matches its scale. A wavelet transform is the representation of a function by wavelets. The wavelets are scaled and translated copies (known as daughter wavelets) of a finite length or fast decaying oscillating waveform (known as mother wavelet). Wavelet transforms have advantages over traditional Fourier transforms for representing functions that have discontinuities and sharp peaks for accurately deconstructing and reconstructing finite, non-periodic and/or non-stationary signals. The mother wavelet is scaled by a factor of ‘a’ and translated (or shifted) by a factor of ‘b’ to give a ,b

(t )

1 a

t b a

Wavelet transforms provide an approach to multi resolution analysis of a signal and this technique has been used to

320

Bhyri et al.: Estimation of ECG features using LabVIEW

identify the ECG signal features such as P wave, QRS complex and T wave. The wavelet transform provides a description of the signal in the time scale domain, allowing the representation of the temporal features of a signal at different resolutions therefore, it is a suitable tool to analyse the ECG signal, which is characterized by a cyclic occurrence of patterns with different frequency content. Moreover the noise and artifacts affecting the ECG signal also appear at different frequency bands, thus having different contributions at various scales. A large number of known wavelet families and functions provide a rich space in which to search for a wavelet, which will very efficiently represent a signal of interest in a large variety of applications. The choice of the wavelet function depends on the application. Selecting a wavelet function, which closely matches the signal to be processed, is of utmost importance in the wavelet applications. Daubechies wavelet family is similar in shape to QRS complex and their energy spectrum is concentrated around low frequencies. Hence Daubechies WT is more suited for ECG analysis. III. DESCRIPTION 0F THE ALGORITHM The algorithm presented in this section is applied directly at one run over the whole ECG signals which are available as data files. The algorithm is divided into two parts. A. B.

Preprocessing of the ECG signal (Denoising). Feature extraction of the ECG signal.

A. Preprocessing of ECG signal The recorded ECG signal is often contaminated by noise and artifacts that can be within the frequency band of interest and manifest with similar characteristics as the ECG signal itself. In order to extract useful information from the noisy ECG signal, we need to processes the raw ECG signal. Preprocessing ECG signals remove contaminants from the ECG signals. A.1.Removal of Baseline wandering Baseline wandering usually comes from respiration at frequency wandering between 0.15Hz and 0.3Hz and it can be suppressed by a high pass digital filter. Wavelet transform can also be used to remove the baseline wandering by eliminating the trend of the ECG signal. The wavelet transform based approach is better because it introduces no latency and less distortion than the digital filter based approach [21].The LabVIEW ASPT (Advanced signal processing toolkit) provides the WA Detrend virtual instrument which removes the low frequency trend of the signal.

Trend level

level specifies the number of levels of the wavelet decomposition, which is approximately,

Number of decomposition level (1 trend level ) * log 2 ( N ) and for the data base we are using here it is 8. The WA detrend virtual instrument has an option to specify the wavelet type used for the discrete wavelet analysis. The one selected here is Daubechies(db06)wavelet because this wavelet is similar to the real ECG signal and also Daubechies wavelet being orthogonal wavelet is suitable for signal denoising where as biorthogonal wavelet is suitable for signal feature extraction. A.2. Removal of wideband noise After removing baseline wander the resulting ECG signal is more stationary and explicit than the original signal. However, some other types of noise might still affect feature extraction of the ECG signal. The noise may be complex stochastic processes within a wideband, so one cannot remove them by using traditional digital filters. To remove the wideband noises, the Wavelet Denoise Express Virtual instrument is used here. The Express Virtual instrument decomposes the ECG signal into several sub bands by applying the wavelet transform and then modifies each wavelet coefficient by applying a threshold or shrinking a function and finally reconstructs denoised signal. From the threshold setting options available, soft thresholding is selected and the thresholding rule selected is ‘universal’ and the Virtual instrument sets the threshold to sqrt(2xlog(N)).The Virtual instrument offers an option to select either discrete wavelet transform or undecimated wavelet transform to denoise the signal. The transform type used is undecimated wavelet Transform (UWT) to denoise the ECG signal. The UWT has a better balance between smoothness and accuracy than the discrete wavelet transform. The VI diagram and the obtained waveforms are shown in figure 1(a) and 1(b). B. Feature extraction A For the purpose of diagnosis, we often need to extract various features from the preprocessed (denoised) ECG data, such as peaks of P,T,QRS waves and their onsets and offsets of P,T and QRS waves.

log 2 2t log 2 N

Where t is the sampling duration and N is the number of sampling points. The data used here has a sampling duration of 10 secs and 5000 sampling points in total, therefore the trend level is 0.35 according to the above equation. Trend

321

Figure 1(a): VI diagram to remove baseline wander and noise

TECHNIA – International Journal of Computing Science and Communication Technologies, VOL. 2, NO. 1, July 2009. (ISSN 0974-3375)

Figure 1 (b): Original ECG, Base line wander removed signal and Denoised signal

B.1. Detection of peaks A well-chosen wavelet can extract main features from noisy signals by multiresolution analysis. Multiresolution express virtual instrument is used in this algorithm to decompose the ECG signal by 8 level Daubechies(db06) wavelets and then the signal is reconstructed from the approximation coefficients and the detail coefficients of all the frequency bands. After multiresolution analysis peak/valley detection is done. WA multiscale peak detection virtual instrument is used in peak detecting mode to detect P, R, and T points by specifying proper width and threshold. Width specifies the width in number of samples. Threshold specifies the value, which the virtual instrument uses to reject peaks of a particular size. The peak detector uses the following steps to detect the peaks. 1. Performs undecimated discrete wavelet decomposition with the biorthogonal wavelet on the input signal. 2. Searches for zero crossing points in the detail coefficients at all levels. 3. Selects the zero crossing points at the largest scale as the coarse estimation of the real peaks. 4. Searches the fine scale for the corresponding nearest zero crossing point for each detected point. 5. Repeats step four until it reaches the finest scale, which is the first level. In the proposed algorithm one peak detector is used for R wave, another peak detector is used for P and T waves. The VI diagram and waveforms are shown in figure 2(a) and 2(b). Once the R peaks are detected, with reference to this peak the signal is scanned for 50 msec on the left side to get the minimum value and this corresponds to Q peak. Similarly the minimum value on the right side of the R peak corresponds to S peak. This procedure is implemented using mathscript.

Figure 2(a): VI diagram for multiresolution analysis and peak detection

Figure 2 (b): ECG after multiresolution analysis and ECG after peak detection

Mathscript is a LabVIEW tool for executing textual mathematical commands (or expressions). Mathscript node is used to evaluate scripts that are created in the LabVIEW mathscript window. The LabVIEW math script syntax is similar to matlab language syntax. B.2. Detection of onsets and offsets Once all the peaks are detected, these are taken as the references and an optimum window width is selected and the waves are scanned on both the sides of the peaks to get the zero crossing points for obtaining onsets and offsets. If the signal is not crossing zero line, then the minimum values in that window are considered as onsets and offsets. Mathscript is used to evaluate onsets and offsets. The peak values detected using LabVIEW are carried to the mathscript node as inputs and zero crossing points or minimum values(onsets and offsets) are taken as outputs from the mathscript node. IV. RESULTS The detection performance of the proposed LabVIEW based algorithm is tested with different CSE multilead data files. The results obtained are given in the table 1. The results obtained

322

Bhyri et al.: Estimation of ECG features using LabVIEW TABLE 1. Results of P, QRS and T waves detection Lead

1L1

1L2

1L1_mv

1L2_mv

1L3_mv

1L4_mv

P-Wave

Amp in mv 0.027 0.050 0.050 0.047 0.045 0.054 0.051 0.047 0.047 0.038 0.001 0.077 0.172 0.055 0.078 0.062 0.062 0.072 0.063 0.059 0.016 0.048 0.006 0.025 0.050 0.047 0.054 0.052 0.044 0.043 0.027 0.039 0.032 0.056 0.058 0.057 0.060 0.055 0.023 0.009 0.036 0.035 0.047 0.023 0.027 0.006 0.016 0.006 -0.032 -0.044 -0.012 -0.022 -0.003 -0.040 -0.055 -0.052 -0.059 -0.056

Duration in msec 72 86 84 96 96 90 92 96 96 76 56 104 174 96 106 100 106 100 100 96 88 74 18 62 80 86 90 22 94 66 52 44 42 62 70 66 74 76 122 20 188 130 100 86 120 42 32 70 68 74 38 38 12 62 76 78 84 82

Q-wave Amp in mv

R-wave Amp in mv

S-wave Amp in mv

QRS Duration in msec

-0.115 -0.066 -0.058 -0.095 -0.052 -0.054 -0.103 -0.058 -0.069 -0.065 -0.279 -0.119 -0.195 -0.129 -0.116 -0.122 -0.116 -0.126 -0.122 -0.140 -0.089 -0.073 -0.078 -0.084 -0.082 -0.059 -0.038 -0.052 -0.075 -0.070 -0.096 -0.079 -0.100 -0.070 -0.079 -0.068 -0.065 -0.073 -0.060 -0.069 -0.008 -0.028 -0.029 +0.005 -0.007 -0.014 -0.035 -0.028 -0.005 -0.014 0.082 0.069 0.092 0.077 0.082 0.052 0.044 0.054 0.063 0.065

1.103 1.083 1.056 1.103 1.052 1.081 1.109 1.014 1.034 1.067 0.638 0.883 0.819 0.819 0.915 0.873 0.811 0.923 0.833 0.873 0.596 0.589 0.610 0.616 0.596 0.610 0.620 0.605 0.606 0.613 0.589 0.607 0.623 0.594 0.674 0.612 0.600 0.625 0.597 0.603 0.098 0.153 0.156 0.129 0.154 0.116 0.113 0.105 0.110 0.138 -0.604 -0.608 -0.627 -0.596 -0.632 -0.619 -0.620 -0.626 -0.610 -0.604

-0.131 -0.134 -0.145 -0.154 -0.131 -0.136 -0.152 -0.141 -0.166 -0.130 0.017 -0.096 -0.099 -0.086 -0.097 -0.093 -0.099 -0.115 -0.112 -0.092 -0.086 -0.057 -0.070 -0.070 -0.049 -0.063 -0.053 -0.058 -0.068 -0.071 -0.266 -0.259 -0.261 -0.255 -0.255 -0.248 -0.222 -0.232 -0.230 -0.223 -0.222 -0.273 -0.355 -0.288 -0.327 -0.293 -0.285 -0.229 -0.273 -0.270 0.168 0.141 0.140 0.148 0.127 0.131 0.123 0.137 0.142 0.140

160 164 162 182 192 198 182 166 180 166 196 182 190 186 206 220 174 212 212 222 210 212 182 170 194 212 202 162 210 202 108 126 112 118 126 116 126 108 134 140 92 106 94 140 126 108 108 102 102 106 104 102 110 100 120 110 104 136 140 130

323

T-Wave Amp in mv

Duration in msec

0.040 0.021 0.025 0.024 0.024 0.026 0.027 0.036 0.029 0.043 0.046 0.081 0.053 0.037 0.044 0.043 0.043 0.043 0.168 0.148 0.212 0.193 0.191 0.166 0.174 0.160 0.174 0.165 0.156 0.173 0.201 0.172 0.184 0.169 0.154 0.159 0.143 0.151 0.017 0.030 0.006 0.018 0.015 0.025 0.016 0.017 0.009 -0.167 -0.167 -0.214 -0.189 -0.193 -0.175 -0.170 -0.165 -0.163 -0.163

184 128 146 124 136 122 160 66 240 94 130 146 128 100 150 134 122 76 110 110 178 176 150 124 116 114 120 108 128 120 150 144 144 136 128 126 124 128 160 222 68 58 138 170 112 186 118 114 178 144 160 130 120 120 122 116

TECHNIA – International Journal of Computing Science and Communication Technologies, VOL. 2, NO. 1, July 2009. (ISSN 0974-3375)

by this algorithm using LabVIEW for both denoising and feature extractions of ECG signal are comparable with other algorithms reported in the literature. By using the WA Detrend virtual instrument and Wavelet denoising express virtual instrument, baseline wandering and all the irrelevant noise has been successfully removed from the signal without any additional filters.

[11] Felipe.E.Olvera, “Electrocardiogram waveform feature extraction using the matched filter”, 2006. [12] Daniel.T.Kaplam, “Simultaneous QRS detection and feature extraction using simple matched filter basis functions”, IEEE, 1991, 503506. [13] Leena Wahab, “Detection of QRS complexes in ECG signal based on poisson transform and root moments”. [14] H.Gholam Hosseini and H.Nazeran, “Detection and extraction of the ECG signal parameters”, Proceedings of 20th annual International conference of the IEEE Engineering in medicine and biology,1998, Volume 20,Number 1,127-130. [15] W.Zong and D.Jiang, “Automated ECG Rhythm analysis using fuzzy reasoning”, Journal of Computers in Cardiology, IEEE, 1998, Volume 25,69-72. [16] J.Laski and N.Hanzel, “A Fuzzy method for ECG feature extraction”, Proceedings of Ist joint BMEI / EBMS conference,IEEE,1999, 930-934. [17] E.Chowdhary and Lc Ludeman, “Discrimination of cardiac arrythmias using a fuzzy rule based method”, Journal of Computers in Cardiology, IEEE, 1994, 549-552. [18] M.Kundu,M.Nasipuri and D.K.Basu,”A knowledge based approach to ECG interpretation using fuzzy logic”, IEEE Transactions on systems, man and cybernetics, 1998, volume 28, Number 2,237-243. [19] Mrs.B.Anuradha and V.C.Veera reddy, “Cardiac arythmia classification using fuzzy classifiers”, Journal of theoretical and applied information technology, 2008, 353-357. [20] Mihaela Lascu and Dan Lascu, “LabVIEW Electrocardiogram Event and Beat Dection”WSEAS Transactions on computer research,2008, Issue 1, Volume 3,9-18. [21] National Instruments Developer zone, “LabVIEW for ECG signal processing”, 2008. [22] Shuran quin,Zhong Ji, Hongjun Zhu, “The ECG recording and analysis instrumentation based on virtual instrument technology and continuous wavalet transform”, Proceedings of 25th Annual International Conference of the IEEE EBMS, 3176-3179.

V. CONCLUSION The large variety of ECG feature extraction algorithms, and the continuous efforts for their enhancement, proves that universally acceptable solution has not been found yet. Difficulties arise mainly from the huge diversity of the waveform the noise and artifacts accompanying the ECG signals. The main advantage of this graphical programming language is that, it provides a robust and efficient environment and tool for generating very fast, less complex and useful algorithms. ACKNOWLEDGMENT The authors would like to acknowledge the Department of Instrumentation Engineering, S.G.G.S. Institute of Engineering and Technology, Nanded and Department of Instrumentation Technology, P.D.A.College of Engineering, Gulbarga for providing the facilities to carry out this work. REFERENCES [1] Juan Pablo Martinez, Rute Almeida, Salvador Olmos,,”A Wavelet Based ECG Delinator: Evaluation on standard data bases”, IEEE Transactions on Biomedical Engineering. 2004, Vol 51, No (4),570-581. [2] S.Z.Mahamoodabadi, A.Ahmadian, M.D.Abolhasani: “ECG Feature extraction using Daubechies Wavelets”, IEEE, 343-348. [3] Alice de Jesus kozakevicius, Cesar Ramos Rodrigues, Raul ceretta Nunes, Roberto Guerra Fillo , “Adaptive ECG filtering and QRS detection using orthogonal Wavelet transform”. [4] A.Schuck Jr, J.O.Wisback, “QRS Detector pre-processing using the complex wavelet transform”, Proceedings of 25th Annual International Conference of IEEE, 2003, 2590-2593. [5] S.C.Saxena, V.kumar and S.T.Hamde , “Feature Extraction From ECG signals Using Wavelet Transform for disease diagnosis”, International journal of system science, 2002 , volume 33, number13, 1073 -1085. [6] S. Nibhanupadi, R.Youssif and C.purdy, “Data spesific signal denoising using wavelets, with applications to ECG data”, The 47th IEEE International Midwest symposium on circuits and systems, 2004, 219222. [7] J. S. Sahambi, S. N. Tandon and R. K. P. Bhatt, A new approach for on-line ECG characteristics, 409-411. [8] B. Castro, D. Kogan and A. B. Gova, “ECG Feature extraction using optimal mother wavelet”, IEEE, 2000, 346-350. [9] P.de. Chazal, B. G. Celler and R. B. Reilly “Using wavelet coefficient for the classification of the electrocardiogram”, Proceedings of 22nd Annual EBMS International conference, 2000, July 23-28, 64- 67. [10] S.Z.Mahamoodabadi, A.Ahmadian, M.D.Abolhasani and M Eslami, “ECG Feature extraction based on multiresolution wavelet transform”, Proceedings of 27th Annual conference of the IEEE Engineering in medicine and biology, 2005, 3902-3905.

324

Suggest Documents