ecgpuwave (MATLAB/Octave version)

The new PhysioNet website is available at: https://physionet.org. We welcome your feedback.

This MATLAB m-code software in this directory (see links near the end of this page) reimplements the algorithms used by the Fortran version of ecgpuwave for detecting the onsets, peaks, and ends of P, QRS, and T waves in the ECG. The main function is limits.m. Its required input parameters are:

dirhea
directory where the record header file is
dirsig
directory where the record data file is
dirann
directory where the record annotation file is
ecgnr
name of the record
anot
name of the annotator (the suffix of the annotation file name, such as 'atr')
typerec
type of record format (0=MIT format, 1=Lund format)

In addition, these optional input parameters can be used to override the program's default values:

res
results format (0=structure, 1=text; default: 0)
nl
number corresponding to the processing lead (default: 1)
ti
beginning of the processing (default: '0:00')
tf
end of the processing (default: 'end')
nbo_flag
include (0) or exclude (1) abnormal beats (default: 0)
Kq
threshold for Q wave beginning (default: 1.5)
Kr
threshold for R wave beginning and end (default: 5)
Ks
threshold for S wave end (default: 3)
Krr
threshold for R' wave end in case of QRS complexes with RSR' morphology (default: 5)
Kpb
threshold for P wave beginning (default: 1.35)
Kpe
threshold for P wave end (default: 2)
Ktb
threshold for T wave beginning (default: 2)
Kte
threshold for T wave end (default: 3.5)
pco
threshold for T wave morphology classification (default: 8)

The output parameters are:

banot
annotation structures, containing:
  • banot.time: position of the annotation (in samples)
  • banot.anntyp: type of annotation (one of: '(': wave beginning, ')': wave end, 'p': P peak, 'N': position of the QRS given in the input annotation file, 'Q': Q peak, 'R': R peak, 'S': S peak, 't': T peak
  • banot.subtyp: reserved field
  • banot.chan: channel to which annotations correspond
  • banot.num: one of: 0: beginning, peak, or end of P wave, QRS position, or normal T wave; 1: beginning or end of QRS, or inverted T wave; 2: beginning or end of T wave, or up T wave; 3: down T wave; 4: biphasic negative-positive T wave; 5: biphasic positive-negative T wave
QT
structure with the value of QT interval (QT.val) and the position of the corresponding beat (QT.pos)
QTC
structure with the values of the QT interval corrected by Bazett's formula and the position of the corresponding beat (QTC.val, QTC.pos)
QW
structure with Q wave amplitude and peak position (QW.val, QW.pos)
RW
structure with R wave amplitude and peak position (RW.val, RW.pos)
SW
structure with S wave amplitude and peak position (SW.val, SW.pos)
QRS
structure with the value of the QRS interval and the position of the corresponding beat (QRS.val, QRS.pos)

The function limits.m can be divided in the following blocks:

  1. First, it reads the record header and data from the corresponding directories. The input functions included here (readheader.m, opensig.m, and getvec.m) read most PhysioBank-compatible formats. The functions gethdsig.m and getsig.m (available from the authors) can be used to read Lund formats.
  2. Second, it reads the annotation file from its corresponding directory to obtain the QRS position given by an external annotator. If the annotator used is Aristotle, the input parameter anot='ari'. If no annotation file is supplied, limits.m attempts to use basicECG.m and qrsdet.m to detect the QRS complexes, but these files have not been contributed by their authors and are not available here, so this attempt will fail unless you have obtained or reimplemented these functions. PhysioToolkit includes several QRS detectors that can generate an annotation file if necessary; these include gqrs, sqrs, and wqrs (all written in C and included in the WFDB Software Package), as well as the original Fortran version of ecgpuwave, which includes its own QRS detector.
  3. The detection of the beginning, peak and end of the ECG waves is accomplished with the following functions:
    • lynfilt.m: filters the ECG signal to obtain intermediate signals
    • proces.m: processes the intermediate signal to obtain the wave limits
    • qrsbound.m: classifies QRS complexes based on their morphology and obtains the position and limits of the different QRS waves using buscaR.m, buscaQ.m and buscaS.m
    • buscaR.m: determines the morphology of the QRS complex; if it is of RSR' type it obtains the significant points, otherwise, it gives the position of the R wave
    • buscaQ.m: obtains the beginning of the Q wave
    • buscaS.m: obtains the end of the S wave
    • pbound.m: detects the P wave, giving its position, beginning and end, and its classification (normal or inverted)
    • tbound.m: classifies the T wave based on its morphology (normal, inverted, upward, downward, biphasic negative-positive, biphasic positive-negative); and obtains the position, beginning and end of the T wave
    • buscacero.m: returns the first zero-crossing in a signal segment
    • buscapic2.m: returns the position and value of the peaks in a signal segment, avoiding peaks of only one sample
    • buscaruido.m: returns the mean level of noise in a signal segment
    • calc_rr.m: computes the mean RR interval for each beat
    • crearumbral.m: gives the position of the first sample of a signal segment that crosses an specific threshold
    • testpic.m: checks if the position of a wave peak obtained by the derivative criterion corresponds to a peak in the ECG signal
Icon  Name                        Last modified      Size  Description
[DIR] Parent Directory - [   ] ecgpuwave-m.tar.gz 03-Apr-2012 16:17 44K gzip-compressed tar archive of m-code sources [   ] ecgpuwave-m.zip 18-Mar-2009 15:00 56K zip archive of m-code sources [DIR] ecgpuwave-m/ 03-Apr-2012 14:57 - m-code sources

Questions and Comments

If you would like help understanding, using, or downloading content, please see our Frequently Asked Questions.

If you have any comments, feedback, or particular questions regarding this page, please send them to the webmaster.

Comments and issues can also be raised on PhysioNet's GitHub page.

Updated Friday, 28-Oct-2016 22:58:42 CEST

PhysioNet is supported by the National Institute of General Medical Sciences (NIGMS) and the National Institute of Biomedical Imaging and Bioengineering (NIBIB) under NIH grant number 2R01GM104987-09.