Biomedical User Group Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

How to write an ECG feature extractor with HRV analyzer using Biomedical Toolkit VIs

Introduction

LabVIEW Biomedical Toolkit provides VIs for ECG signal processing, such as feature extractor and HRV analysis. This article is to introduce how to write an ECG feature extractor with HRV analyzer using Biomedical Toolkit VIs. You can refer to LabVIEW for ECG Signal Processing and Using LabVIEW for Heart Rate Variability Analysis for more information about ECG and HRV analysis.

ECG Feature Extractor

The process of ECG feature extractor includes 4 steps:

  1. Acquire ECG signal from DAQ or read from file.
  2. Preprocess ECG signal, including filtering and rectification.
  3. Extract features.
  4. (Optional) Visualize and analyze the extraction results.

Following is a typical example for ECG feature extractor:

Write ECG 1.PNG

In step 1, Read Biosignal Express VI is used to read ECG signals from file. You can replace it with Biosignal DAQ Express VI if you want to acquire ECG signals from DAQ.

In step 2, Biosignal Filtering VIs are used to filter the ECG signal. For ECG input, use a 10-25Hz bandpass filter to make the QRS waves easier to be detected. For raw ECG input, use a lowpass filter to remove the high frequency noise in the original signal, to make the feature extraction result more accurate.

The filtering causes a latency of the ECG signal, which should be eliminated in order to keep the accuracy of extracted results. This can be simply done by discarding the first N/2 points of the first block of filtered ECG signal, where N equals to the order of the filter.

Write ECG 2.png

In Step 3, ECG Feature Extractor VI is used. You can choose to extract all features (including the time of P, QRS, and T waves) or only QRS waves through the polymorphic selector. When you need to extract all features, you should connect both raw ECG and ECG. raw ECG can be the original signal or slightly processed using low-pass filter (the signal amplitude should not be changed a lot).

Step 4 is optional. You can visualize the extracted features like the following figure. Search “ECG Feature Extractor” in NI Example Finder for more information.

Write ECG 3.png

You can also analyze the statistics of extracted ECG features. Such as the mean value and standard deviation of heart rate, QRS width, etc.

Write ECG 4.png

HRV Analyzer

After extracting ECG features, you can analyze the heart rate variability. It is very simple to obtain the RR intervals from ECG features by subtracting adjacent R positions:

Write ECG 5.png

Then you can use VIs in Biomedical->Biosignal Measurement->ECG->HRV Analysis palette to analyze the RR intervals. HRV Statistics VI, HRV Histogram VI and HRV Poincare Plot VI can be directly used like:

Write ECG 6.png

HRV FFT Spectrum VI, HRV AR Spectrum VI and HRV STFT Spectrogram VI are polymorphic VIs. Because the RR intervals obtained from the ECG features are unevenly and not re-sampled, you should choose Unevenly Sampled RR from the polymorphic selector. In this situation, raw RR and RR are both required inputs. raw RR must be the original signal and not be processed. For RR, it is recommended that you detrend the RR intervals in order to eliminate the DC components.

Following is a typical usage of HRV FFT Spectrum VI. LabVIEW Biomedical Toolkit provides a control for displaying HRV Spectrum in VLF, LF and HF bands. You can find it at Biomedical->Biosignal on the controls palette. After dropping this control, a helper VI will be generated on the block diagram, and you can connect it to HRV FFT Spectrum VI or HRV AR Spectrum VI directly as shown in the figure.

Write ECG 7.png

Comments
Gavko
Member
Member
on

Hi, thank you, can you upload the example from first picture? 🙂 

DeniseK
Member
Member
on

Where can i find this ? 

DeniseK_0-1579519727897.png

Martin_Sokolov
Member
Member
on

So, you are not willing to share the project?

Contributors