Thursday, May 31, 2012

Algorithms for ECG Signal Analysis


Algorithms for ECG Signal Analysis


ECG Signal Analysis: Abnormality Detection

The flowchart below breaks down the tasks needed to accomplish signal analysis in greater detail. Both LabVIEW and Matlab were used to accomplish these tasks.
Figure 1
Signal Analysis Flow Chart
Signal Analysis Flow Chart (graphics1.png)

Matlab Implementation of Filter Banks Analysis

Many scenarios deal with signals which contain specific energy distributions in the frequency domain. For example, with regard to the ECG, a significant proportion of the energy from the QRS complex extends to a frequency of 40 Hz, and even more if the Q, R, and S waves have very sharp morphologies. The P and T waves, in general, have a significant proportion of their energy only up to 10 Hz. Thus, a strategic approach to detecting heartbeats is to analyze different sub-bands of the ECG, rather than just the output of one filter which maximizes SNR of the QRS.
In this filter bank analysis technique we use 5 sub-bands, each one has bandwidth 5Hz. The ECG signal is processed by those 5 sub-band filters and downsampled. The downsampled signal is
Figure 2
Figure 2 (graphics2.png)
A variety of features which are indicative of the QRS complex can be designed by combining sub-bands of interest from l = 0, 1, … , M-1. For example a sum-of-absolute values feature P1 can be computed using sub-bands 1, 2, and 3.
Figure 3
Figure 3 (graphics3.png)
P1 has a value which corresponds to the energy in the frequency band [5.6, 22.5] Hz. Similarly, P2 and P3 can be computed using sub-bands {1, 2, 3, 4}, and {2, 3, 4}, respectively, and these values are proportional to the energy in their respective sub-bands. Heuristic beat detection logic can be used to incorporate some of the above features which are indicative of the QRS complex.
Figure 4 gives an overview of the sequential levels in the beat detection algorithm. The goal of the detection algorithm is to maximize the number of true positives (TP’s), while keeping the number of false negatives (FN’s) and false positives (FP’s) to a minimum. Since it is not possible to arrive at this goal using one simple detector, multiple detectors with complementary FN’s and FP’s performances are simultaneously operated and the results of each fused together to arrive at an overall decision. The advantage of this strategy is that multiple features which are indicative of the QRS complex can be used to detect beats.
Figure 4
Beat Detection Algorithm Schematic
Beat Detection Algorithm Schematic (graphics4.png)
A one-channel beat detection block is described in Figure 5.
Figure 5
Schematic of One-Channel Beat Detection Block
Schematic of One-Channel Beat Detection Block (graphics5.png)
The detection strength Ds of an incoming feature (e.g., P1, P2, P3) is determined by comparing with the signal and noise levels (SL and NL, respectively):
Figure 6
Figure 6 (graphics6.png)
If a feature’s value is less than NL then Ds is limited at 0, and if it is above SL then DS is limited to one. When a feature has a greater than a specified threshold (preset between zero and one) it is classified as a signal peak and the signal history is updated with the feature’s value. If the feature has a smaller than the threshold it is classified as a noise peak and the noise history is updated with the feature’s value.
The detail operations of each level can be found in the paper by V. Afonso et al (ECG beat detection using filter banks, IEEE Trans. Biomed. Eng. 46: 1999). Also, download and runECGmain.m to test out filter banks. Supplementary mfiles: nqrsdetect.mECGSigProc.m,t.matx.mat.

LabVIEW Programming for Signal Processing and Interfacing

LabVIEW is used to not only process and acquire the signal, but to also develop an user friendly interface that automatically alerts the user to any abnormalities or arrhythmias detected. This particular ECG is developed to detect left ventricular hypertrophy and old myocardial infarction. It will also automatically display the heart rate and whether or not the patient’s heart rate is within a healthy range.
Figure 7: This view of the the GUI shows a normal, healthy ECG signal. The indicator lights (6) will change color depending on the diagnosis. Additionally, the green trace turns red if any abnormality or arrhythmia is detected.
The Graphical User Interface
The Graphical User Interface (graphics7.png)
The user interface consists of several useful features. First, there is a text input for the patient’s name to avoid confusion in the clinic. Second, the ECG chart is automatically updated with the name and live signal data. Third, the user can control the data acquisition periods. The heart rate and any abnormalities are displayed in the patient report. The warning lights to the left of the patient report correspond to the current condition of the patient’s ECG. If everything is normal, the green light is on and the signal is green. If an arrhythmia is detected, the yellow light turns on and a warning message will appear in the patient report that indicates the type. Similarly, the orange light turns on if an abnormality is detected and a warning message appears in the report. For either of these, the ECG trace turns red in the chart window. A red light indicates that no recognizable signal is being detected. This can mean that the patient has flat-lined, that the circuit board is not powered or that the leads are not connected properly. As a result, the warning message will ask the user to check the lead and power connections. Finally, the form can be reset between patients. You can download our VI here to test it out.

14 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Dear Guru, I am doing an ECG identification project. Would be glad if you can send me the code on detecting the QRS waveform for segmentation.
    elyasaad@gmail.com

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. could you send me the code. end21am@gmail.com

    ReplyDelete
  6. excuse me i wonder if u could send me a matlab code for myocardial detection
    fikremaryam21@gmail.com

    ReplyDelete
  7. could you please mail the source code to m.nehachangappa@gmail.com. I am working on a similar project related to heart monitoring and alarming systems.

    ReplyDelete
  8. could u send me d code ngliangshen@gmail.com

    ReplyDelete
  9. could u send me d code ngliangshen@gmail.com

    ReplyDelete
  10. hello there. i would like to buy your ecg project. do u mind email me im.farisady@gmail.com so we can have a word?

    ReplyDelete
  11. could u send me d code aykutdiker@gmail.com

    ReplyDelete
  12. can you please help me and send me the code at snamuna@hotmail.com

    ReplyDelete
  13. Guru, please send mi the source code because, i am working on the detection of arrhythmia project. please help me and send on mukspg23@gmail.com.

    thnx Guru...

    ReplyDelete
  14. Dear sir,
    I am working on ECG signal analysis in optiwave please help me sir please give me MATLAB code for ecg signal analysis so that I can performs me idea in that system
    my email I'd is ak9613@gmail.com

    Thank you sir

    ReplyDelete