ECGPUWAVE 1.3.4

File: <base>/src/matlab/HEADER.shtml (6,615 bytes)
<!--#set var="TITLE" value="ecgpuwave (MATLAB/Octave version)"-->
<!--#include virtual="/pn/head.shtml"-->

<p>
This MATLAB m-code software in this directory (see links near the end of this
page) reimplements the algorithms used by the <a href="..">Fortran version of
<tt>ecgpuwave</tt></a> for detecting the onsets, peaks, and ends of P,
QRS, and T waves in the ECG.  The main function is <tt>limits.m</tt>.
Its required input parameters are:
<dl>
<dt>dirhea</dt><dd>directory where the record header file is</dd>
<dt>dirsig</dt><dd>directory where the record data file is</dd>
<dt>dirann</dt><dd>directory where the record annotation file is</dd>
<dt>ecgnr</dt><dd>name of the record</dd>
<dt>anot</dt><dd>name of the annotator (the suffix of the annotation file
  name, such as 'atr')</dd>
<dt>typerec</dt><dd>type of record format (0=MIT format, 1=Lund format)</dd>
<dl>

<p>
In addition, these optional input parameters can be used to override the
program's default values:
<dl>
<dt>res</dt><dd>results format (0=structure, 1=text; default: 0)</dd>
<dt>nl</dt><dd>number corresponding to the processing lead (default: 1)</dd>
<dt>ti</dt><dd>beginning of the processing (default: '0:00')</dd>
<dt>tf</dt><dd>end of the processing (default: 'end')
<dt>nbo_flag</dt><dd>include (0) or exclude (1) abnormal beats (default: 0)</dd>
<dt>Kq</dt><dd>threshold for Q wave beginning (default: 1.5)</dd>
<dt>Kr</dt><dd>threshold for R wave beginning and end (default: 5)</dd>
<dt>Ks</dt><dd>threshold for S wave end (default: 3)</dd>
<dt>Krr</dt><dd>threshold for R' wave end in case of QRS complexes with RSR'
 morphology (default: 5)</dd>
<dt>Kpb</dt><dd>threshold for P wave beginning (default: 1.35)</dd>
<dt>Kpe</dt><dd>threshold for P wave end (default: 2)</dd>
<dt>Ktb</dt><dd>threshold for T wave beginning (default: 2)</dd>
<dt>Kte</dt><dd>threshold for T wave end (default: 3.5)</dd>
<dt>pco</dt><dd>threshold for T wave morphology classification (default: 8)</dd>
</dl>

<p>The output parameters are:
<dl>
<dt>banot</dt><dd>annotation structures, containing:
<ul>
<li><b>banot.time</b>: position of the annotation (in samples)
<li><b>banot.anntyp</b>: 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
<li><b>banot.subtyp</b>: reserved field
<li><b>banot.chan</b>: channel to which annotations correspond
<li><b>banot.num</b>: 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
<ul>
</ul></dd>
<dt>QT</dt>
<dd>structure with the value of QT interval (QT.val)
 and the position of the corresponding beat (QT.pos)</dd>
<dt>QTC</dt><dd>structure with the values of the QT interval corrected by
 Bazett's formula and the position of the corresponding beat (QTC.val, QTC.pos)
 </dd>
<dt>QW</dt><dd>structure with Q wave amplitude and peak position
 (QW.val, QW.pos)</dd>
<dt>RW</dt><dd>structure with R wave amplitude and peak position
 (RW.val, RW.pos)</dd>
<dt>SW</dt><dd>structure with S wave amplitude and peak position
 (SW.val, SW.pos)</dd>
<dt>QRS</dt><dd>structure with the value of the QRS interval and the position
 of the corresponding beat (QRS.val, QRS.pos)
</dl>

<p>
The function <tt>limits.m</tt> can be divided in the following blocks:
<ol>
<li>First, it reads the record header and data from the corresponding directories. The input functions included here (<tt>readheader.m</tt>, <tt>opensig.m</tt>,
and <tt>getvec.m</tt>) read most
PhysioBank-compatible formats.  The functions <tt>gethdsig.m</tt> and <tt>getsig.m</tt> (available from the authors) can be used to read Lund formats.

<li> 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'.  <em>If no annotation file is supplied, <tt>limits.m</tt>
attempts to use <tt>basicECG.m</tt> and <tt>qrsdet.m</tt> to detect the
QRS complexes, but these files have not been contributed by their authors
and are not available here, so this attempt will <b>fail</b> unless you have
obtained or reimplemented these functions.  PhysioToolkit includes several
QRS detectors that can generate an annotation file if necessary;  these
include <a href="/physiotools/wag/gqrs-1.htm">gqrs</a>,
<a href="/physiotools/wag/sqrs-1.htm">sqrs</a>,
and <a href="/physiotools/wag/wqrs-1.htm">wqrs</a> (all written in C and
included in the <a href="/physiotools/wfdb.shtml">WFDB Software Package</a>),
as well as the <a href="../">original Fortran version of ecgpuwave</a>,
which includes its own QRS detector.</em>

<li> The detection of the beginning, peak and end of the ECG waves is
 accomplished with the following functions:
<ul>
<li><tt>lynfilt.m</tt>: filters the ECG signal to obtain intermediate signals
<li><tt>proces.m</tt>: processes the intermediate signal to obtain the wave
 limits
<li><tt>qrsbound.m</tt>: classifies QRS complexes based on their morphology
 and obtains the position and limits of the different QRS waves using
 <tt>buscaR.m</tt>, <tt>buscaQ.m</tt> and <tt>buscaS.m</tt>
<li><tt>buscaR.m</tt>: 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
<li><tt>buscaQ.m</tt>: obtains the beginning of the Q wave
<li><tt>buscaS.m</tt>: obtains the end of the S wave
<li><tt>pbound.m</tt>: detects the P wave, giving its position, beginning and
 end, and its classification (normal or inverted)
<li><tt>tbound.m</tt>: 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
<li><tt>buscacero.m</tt>: returns the first zero-crossing in a signal segment
<li><tt>buscapic2.m</tt>: returns the position and value of the peaks in a
 signal segment, avoiding peaks of only one sample
<li><tt>buscaruido.m</tt>: returns the mean level of noise in a signal segment 
<li><tt>calc_rr.m</tt>: computes the mean RR interval for each beat
<li><tt>crearumbral.m</tt>: gives the position of the first sample of a signal
 segment that crosses an specific threshold
<li><tt>testpic.m</tt>: checks if the position of a wave peak obtained by the
 derivative criterion corresponds to a peak in the ECG signal
</ul>
</ol>