Using LabVIEW to process ECG signals

Publisher:DazzlingGazeLatest update time:2015-08-03 Source: vihomeKeywords:LabVIEW Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
  Table of contents

  1. ECG signal preprocessing

  2. Feature extraction of ECG signals

  3. Summary

  4. More related resources

 

  The electrocardiogram is a technique for recording the bioelectric currents generated by the heart. Clinicians can use the electrocardiogram to assess the patient's heart condition and make further diagnoses. ECG recordings are obtained by sampling the bioelectric currents sensed by several electrodes (leads). A typical single-cycle electrocardiogram waveform is shown in Figure 1.

 

 

Figure 1 Typical single-cycle ECG waveform

 

  Generally speaking, the recorded ECG signal will be contaminated by noise and artificially introduced artifacts, which are in the frequency band of interest and have similar characteristics to the ECG signal itself. In order to extract useful information from the noisy ECG signal, we need to process the original ECG signal.

  Functionally, the processing of ECG signals can be roughly divided into two stages: preprocessing and feature extraction (as shown in Figure 2). The preprocessing stage removes and reduces the noise in the original ECG signal, while the feature extraction stage extracts diagnostic information from the ECG signal.

 

 

Figure 2 Typical ECG signal processing flow chart

 

  Using LabVIEW and related toolboxes, such as the Advanced Signal Processing Toolbox (ASPT) and the Digital Filter Design Toolbox (DFDT), users can easily create signal processing applications for two stages, including eliminating baseline drift, removing noise, QRS complex wave detection, fetal heart rate detection, etc. This article focuses on the use of LabVIEW for typical ECG signal processing methods. [page]

  1. ECG signal preprocessing

  ECG signal preprocessing can help users remove contamination from ECG signals. Broadly speaking, ECG signal contamination can be divided into the following categories:

  • Power line interference

  • Electrode separation or contact noise

  • Artifacts introduced by patient electrode movement

  • Electromyographic (EMG) noise

  • Benchmark drift

  Among these noises, power line interference and reference drift are the most important and can strongly affect ECG signal analysis. In addition to these two noises, other noises may also distort ECG signals due to their wideband and complex random processes. Power line interference is a narrowband noise centered at 60 Hz (or 50 Hz) with a bandwidth of less than 1Hz. Usually, ECG signal acquisition hardware can eliminate power line interference. However, reference drift and other broadband noise are difficult to suppress through hardware devices. Software design has become a more powerful and feasible offline ECG signal processing method. Users can use the following methods to eliminate reference drift and other broadband noise.

 

  Eliminate reference drift

  Baseline drift is usually caused by breathing and has a frequency between 0.15 and 0.3 Hz. It can be suppressed by using a high-pass digital filter. Users can also use wavelet transform to eliminate baseline drift by detrending the ECG signal.

  1. Digital filter method

  The DFDT toolbox in LabVIEW provides a graphical and interactive method for quickly and efficiently designing and implementing finite impulse response (FIR) or infinite impulse response (IIR) filters. For example, you can use the Classical Filter Design Express VI to design a Kaiser window FIR high-pass filter to eliminate reference drift. Figure 3 shows an example of a high-pass filter. You can use the flowchart of this example VI to eliminate reference drift.

 

Figure 3. Design and use of a high-pass filter to eliminate reference drift.

 

  2. Wavelet transform method

  In addition to digital filters, wavelet transform is also an effective method to eliminate signals within a specified frequency band. The LabVIEW ASPT toolbox provides WA Detrend VI, which can eliminate the low-frequency trend of the signal. Figure 4 shows an example of using WA Detrend VI to eliminate baseline drift.

 

 

Figure 4 Using WA Detrend VI to eliminate baseline drift

  This example uses the Daubechies6 (db06) wavelet because it is similar to the actual ECG signal. In this example, the ECG signal has a sampling period of 60 seconds and a total of 1200 sampling points. According to the following formula, the trend level is 0.5:

 

 

  Where t is the sampling period and N is the number of sampling points.

  Figure 5 shows the original ECG signal, as well as the ECG signals processed by the digital filter-based method and the wavelet transform-based method. You can see that the processed ECG signal contains almost no baseline drift information while maintaining the main characteristics of the original ECG signal. You can also notice that the wavelet transform-based method is more advantageous because it does not introduce delay and has less distortion than the digital filter-based method.

 

 

Figure 5 Comparison of digital filter-based and wavelet transform-based methods

 

  Eliminating broadband noise

  After eliminating the baseline drift, the ECG signal is clearer and more stable than the original signal. However, other types of noise still affect the feature extraction of the ECG signal. These noises are complex random processes with wide bandwidths, so traditional digital filters cannot be used. In order to eliminate broadband noise, Wavelet Denoise Express VI is needed.

  This Express VI first applies wavelet transform to decompose the ECG signal into subbands, then adjusts the wavelet coefficients using threshold or shrinkage functions, and finally reconstructs the signal after removing noise. The following figure shows an example of using undecimated wavelet transform (UWT) on an ECG signal. [page]

 

 

Figure 6 Using UWT to eliminate broadband noise in ECG signals

  Compared with discrete wavelet transform (DWT), UWT has a better trade-off between smoothness and accuracy. By comparing the denoised ECG signal with the undenoised ECG signal, as shown in Figure 7, it can be found that the broadband noise is greatly suppressed while the details of the ECG signal remain unchanged.

 

 

Figure 7 ECG signals before and after UWT denoising

 

  2. Feature extraction of ECG signals

  For diagnosis, various features need to be extracted from the preprocessed ECG data, including QRS complex wave detection, QRS complex wave amplitude, PR interval, ST interval, fetal heart rate, etc. This section will mainly discuss QRS complex wave detection and fetal ECG extraction.

  QRS complex detection

  Detecting the R peak and QRS complex in the ECG signal can provide information about heart rate, conduction velocity, various tissue states in the heart, and various abnormalities. It provides a basis for the diagnosis of heart disease, so it has attracted great attention in the field of ECG signal processing. However, noise and time-varying morphology make detection very difficult.

  Because wavelets can extract and analyze the main features of noisy signals with the advantage of multi-resolution, many wavelet-based detection methods have been proposed in recent years. In this paper, the WA Multiscale Peak Detection VI in the LabVIEW ASPT toolbox is used to detect Q, R, and S points. Before peak/trough detection, the ECG signal is decomposed into 8-level Daubechies6 (db06) wavelets using Multiresolution Analysis Express VI (as shown in Figure 9), and then the signal is reconstructed using D4 and D5 subbands. The reason why D4 and D5 subbands can be used for reconstruction is that almost all QRS details are in these two subbands, which makes QRS detection more accurate.

 

 

Figure 8 Implementation of multi-resolution analysis of ECG signals and QRS wave detection

 

  Figure 9 shows the ECG signal after wavelet multi-resolution analysis (MRA) and peak/trough detection, as well as the original ECG signal (from the MIT-BIH database). In this figure, you can see that the peaks and troughs (especially the Q and S points) become more obvious after wavelet multi-resolution analysis.

 

 

Figure 9 Original ECG signal, ECG signal after MSA, and ECG signal after peak/trough detection

 

  After the QRS complex wave is detected, other methods can be used for feature analysis. For example, the RR interval signal can be used to perform heart rate variation (HRV) analysis to show the status of the heart and nervous system.

 

  Fetal ECG signal extraction

  The fetal electrocardiogram (FECG) can be obtained from the maternal abdominal ECG signal (AECG), and the fetal heart rate (FHR) can be extracted, which shows the heart state of the fetus. Figure 10 shows the position of the leads in the 8-channel maternal ECG signal processing system. The ECG signal of the mother's chest is obtained from the chest leads, while the ECG signal of the abdomen is obtained from the abdominal leads. In this section, we use the following two methods to extract the fetal heart rate: independent component analysis (ICA) and adaptive filtering.

 

 

Figure 10 The location of the leads in the 8-channel maternal ECG signal processing system (including 5 abdominal leads and 3 chest leads)

 [page]

  1. ICA method

  The ICA method is used to reconstruct independent implicit signals from multi-channel observations. Assuming that the observation X is the superposition of the source signal S, it can be written as:

X = AS

  Where A represents the mixing matrix. The statistical independence assumption of the signal S allows you to estimate two unknown quantities S and A from the observation X. Here, the ECG signal of the pregnant woman and the ECG signal of the fetus can be regarded as independent components, that is, part of S, and the ECG signal measurement records of 8 channels constitute X. Through the ICA method, it is possible to obtain an estimate of S, which means that you can obtain the ECG signals of the pregnant woman and the fetus.

  The ASPT toolbox provides TSA Independent Component Analysis VI, which allows users to easily build an FHR extraction application, as shown in Figure 11. In Figure 11, the 8-channel ECG signal (obtained from the 8-channel system mentioned above) is the input of the ICA function, and the fetal ECG signal can be obtained at the output as part of the independent component. Figure 12 shows the ECG signal of the pregnant woman's abdomen and the ECG signal of the fetus extracted by ICA. From the ECG signal of the fetus, you can find that the ECG signal of the pregnant woman is effectively suppressed, so that the FHR can be accurately and conveniently obtained.

 

Figure 11 ICA method for fetal heart rate extraction

 

Figure 12 FHR extraction using ICA

 

  2. Adaptive filtering method

  An adaptive filter is a filter that can adjust its coefficients to optimize a specific performance indicator. Adaptive filters are widely used in various industries, one of which is adaptive noise cancellation, as shown in Figure 13.

 

 

Figure 13 Adaptive noise cancellation structure

  In this example, the purpose of the adaptive filter is to minimize the difference between the reference signal and the noisy signal, and the coefficients of the filter are automatically adjusted according to this minimization process. The reference signal is the chest signal of the pregnant woman, the noisy signal is the abdominal signal of the pregnant woman, and the ECG signal of the fetus is the difference between the two. Figure 14 shows the LabVIEW implementation of this method.

 

 

Figure 14 Adaptive filter method for FHR extraction

As shown in Figure 15, an adaptive filter with appropriate order and step size can track and predict the ECG signal of a pregnant woman, and the ECG signal of the fetus is the prediction error.

 

 

Figure 15 FHR extraction using adaptive filter

 

  3. Conclusion

  LabVIEW and the associated signal processing toolbox can provide a robust and efficient environment and tools to solve ECG signal processing problems. This application note shows how to use these powerful tools to easily and quickly remove noise, analyze, and extract ECG signals in heart disease diagnosis and ECG signal processing research. At the same time, these tools can be used in other biomedical signal processing applications, such as magnetic resonance imaging (MRI) and electroencephalography (EEG).

Keywords:LabVIEW Reference address:Using LabVIEW to process ECG signals

Previous article:Design of Pulse Signal Detection System Based on LabVIEW
Next article:LabVIEW 1.0 Programming Environment (Graphics and Text)

Recommended ReadingLatest update time:2024-11-23 15:11

LabVIEW Robotics Module - Special Algorithms and APIs in the Robotics Palette
Overview This tutorial introduces the robotics algorithms that come with the LabVIEW Robotics Module software. From sensors to path planning, you can use this product to design the next generation of complex automation systems. The LabVIEW Robotics Module comes with a new, fully functional Robotics palette that co
[Test Measurement]
LabVIEW Robotics Module - Special Algorithms and APIs in the Robotics Palette
How to generate executable files/setup files in LabVIEW
How to create EXE and SETUP files Conditions: Labview Professional Edition Below, taking the Chinese version of Labview8.2 and a simple test system as an example, the specific steps for creating EXE files and SETUP files (installation files) are introduced. How to create an EXE file: 1. Place all the required files
[Test Measurement]
Serial communication between PC and inverter using LabVIEW
In view of the characteristics of tribological experimental research, this paper adopts the widely used LabVIEW programming language to develop a serial communication program for controlling the operating frequency of the TECO 7200MA inverter. Due to the particularity of tribological testing machines and tribol
[Microcontroller]
Creating a Block Diagram in LabVIEW
  After creating the front panel, the controls in the front panel window correspond to terminals in the block diagram window. Select "Window → Show Block Diagram" (shortcut key: ) in the main menu of the front panel window, or double-click the added block diagram object to switch the front panel design interface to the
[Test Measurement]
Creating a Block Diagram in LabVIEW
Analysis of the method of naming files by time in LabVIEW
    I spent a long time this morning naming the collected data files using the system time, so I am going to organize them now, both for future use and to provide a reference for colleagues who have the same problem!     The screenshot of the program is as follows:    In the figure, "Basic Path" is used to
[Test Measurement]
Analysis of the method of naming files by time in LabVIEW
Design of multi-physics field measurement system for marine environment using LabVIEW
1. Introduction In recent years, with the increase of human efforts in ocean development, research on the ocean has become more extensive and in-depth. Correspondingly, various environmental physical fields in the ocean have also become the focus of research. Because the understanding of the physical field of
[Test Measurement]
Design of multi-physics field measurement system for marine environment using LabVIEW
Design of signal amplitude eigenvalue obtaining system based on LABVIEW
introduction   LabVIEW has two basic windows, the front panel window and the flowchart window. The front panel window is used to set control objects and display objects, which is equivalent to the display screen or pointer of a conventional instrument; the flowchart window is used to write and display the graphical
[Test Measurement]
Design of signal amplitude eigenvalue obtaining system based on LABVIEW
Test of the volt-ampere characteristics of a single junction transistor based on LabVIEW
The unijunction transistor is a new type of electronic device developed in recent years. It has an important electrical property, namely the negative resistance characteristic, which can greatly simplify the structure of various pulse generating unit circuits such as self-excited multivibrator, step wave generator a
[Test Measurement]
Test of the volt-ampere characteristics of a single junction transistor based on LabVIEW
Latest Test Measurement Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号