epicmp - ANSI/AAMI-standard episode-by-episode annotation comparator
epicmp
-r record -a reference-annotator test-annotator [ options ... ]
This
program implements the VF, AF, and ST episode-by-episode comparison algorithms
specified by the current American National Standard for ambulatory ECG
analyzers (ANSI/AAMI EC38:2007). epicmp is the reference implementation
of these algorithms, and must be used to obtain the episode-by-episode performance
statistics cited in EC38 in order to be in compliance with the standard
(see EC38, section 5.2.14).
Input to this program consists of two annotation
files associated with the same record. One of these is designated the reference
annotation file, the other the test annotation file.
Options include:
- -A
file
- Append atrial fibrillation detection reports to the specified file.
- -f time
- Begin the comparison at the specified time (default: 5 minutes after
the beginning of the record).
- -h
- Print a usage summary.
- -i time
- Exclude episodes
shorter than time (default: 0 seconds) from episode statistics.
- -I time
- Exclude
episodes shorter than time (default: 0 seconds) from episode and duration
statistics. (At most one of -i and -I may be used.)
- -l
- Write reports in line
format (default: matrix format).
- -L
- Same as -l.
- -S file1 file2
- Append ischemic
ST episode detection reports to file1, and ST deviation measurements to
file2.
- -S0 file1 file2
- As for -S, but report on signal 0 only.
- -S1 file1 file2
- As for -S, but report on signal 1 only.
- -t time
- Stop the comparison at the
specified time (default: the end of the record if it is defined, the end
of the reference annotation file otherwise; if time is 0, the comparison
ends when the end of either annotation file is reached).
- -V
- Append ventricular
flutter and fibrillation detection reports to the specified file.
- -x
- Exclude
periods of atrial fibrillation from calculations of atrial fibrillation
positive predictivity, as required by EC38:1998 (default: include these
periods, as required by EC38:2007).
The episode and duration statistics
gathered by epicmp are based on tallies of overlapping episodes in the
reference and test annotation files. Duration statistics give weight to
each episode or detection in proportion to its duration. Episode statistics
give equal weight to each episode or detection, irrespective of length;
each test-annotated episode that meets the criteria for overlap (see below)
with a reference-annotated episode is counted as a true positive. Episodes
are defined as follows (see <wfdb/ecgcodes.h> for definitions of annotation
types):
- Atrial fibrillation episodes
- begin with a RHYTHM annotation, with
the aux field containing the text ‘(AFIB’, and end with any other RHYTHM
annotation (or at the end of the record). Reference-marked episodes of atrial
flutter (begun by RHYTHM annotations with the text ‘(AFL’) are excluded from
AF comparisons (i.e., the test annotator is neither penalized nor rewarded
for its treatment of atrial flutter in this context). Any amount of overlap
is sufficient to qualify a test episode as a true positive.
- Ventricular
fibrillation or flutter episodes
- begin with a VFON annotation, and end
with a VFOFF annotation (or at the end of the record). RHYTHM annotations
are ignored in this context by epicmp. Any amount of overlap is sufficient
to qualify a test episode as a true positive.
- Ischemic ST episodes
- begin
with a STCH annotation, with the aux field containing the text ‘(STns’, and
end with another STCH annotation, with the text ‘STns)’ (or at the end of
the record). Between these annotations, the extremum (the time at which
the absolute value of the ST deviation is greatest) is marked with another
STCH annotation, with the text ‘ASTnsm’; this annotation may be omitted
in the test annotation file. In these annotations, n is ‘0’ or ‘1’, and denotes
the affected signal; s is ‘+’ for episodes of ST elevation, or ‘-’ for episodes
of ST depression; and m is the ST deviation in microvolts, relative to
a reference level established from the first 30 seconds of the record.
The values of s and m are not significant for the episode comparison made
by epicmp. When using the -S0 or -S1 options, n must be 0 or 1 respectively;
other STCH annotations are ignored. When using the -S option, the value
of n is ignored: each ‘(STns’ annotation increments a counter, and each
‘STns)’ annotation decrements the counter; in this context, ST episodes
begin when the counter becomes positive and end when the counter reaches
zero (or at the end of the record). To qualify a test episode as a true
positive for purposes of determining ST episode sensitivity, it must overlap
at least 50% of the reference episode, or the overlap must include the
reference-marked extremum. To qualify a test episode as a true positive
for purposes of determining ST episode positive predictivity, the reference
episode must overlap at least 50% of the test episode, or the overlap must
include the test-marked extremum, if present.
The second file generated when
using the ‘-S’, ‘-S0’, or ‘-S1’ options contains comparisons of ST deviation measurements
wherever such measurements are available in the reference annotation files.
In the existing databases, these appear only at extrema within each annotated
ischemic (or non-ischemic) ST episode, as described above. For purposes of
comparison of ST deviation measurements, test ST measurements for each
signal are read from the aux field of beat annotations, which should contain
text of the format ‘m n’ (where m and n are the measured ST deviations for
signals 0 and 1 respectively). If these measurements are missing from any
test beat annotation, epicmp assumes that they have not changed since they
last appeared. epicmp ignores ‘AST...’ annotations in the test annotation file
when making this comparison. In the output file, any test measurements
that deviate from the reference measurements by more than 100 microvolts
are tagged with an asterisk (‘*’). plotstm(1)
can produce a scatter plot
of these data using this file as input.
At least one of the options ‘-A’, ‘-S’,
‘-S0’, ‘-S1’, and ‘-V’ must be used. If ‘-’ is given as a file argument, reports are
written on the standard output. The output generated by selecting -l or
-L includes column headings only if a file other than ‘-’ is specified, and
only if the specified file does not already exist. In this way, epicmp
can be used repeatedly to build up line-format tables for multiple records,
for further processing by sumstats(1)
.
It may be necessary to
set and export the shell variable WFDB (see setwfdb(1)
).
- non-standard
comparison selected
- The -f, -i, -I, and -t options modify the comparison algorithms
used by epicmp in ways not permitted by EC38. These options are provided
for the use of developers, who may find them useful for obtaining a more
detailed understanding of algorithm errors.
Since epicmp performs multiple
passes over its input files, it cannot be used at the end of a pipe.
Between
1992 and 2002, this program was known as epic; the name was changed to
avoid conflict with a new but widely distributed IRC chat client also named
epic. By analogy to bxb, mxm, and rxr, this program should have been called
exe, which would have created interesting possibilities for confusion.
bxb(1)
, ecgeval(1)
, mxm(1)
, plotstm(1)
, rxr(1)
, setwfdb(1)
, sumstats(1)
Evaluating ECG Analyzers (in the WFDB Applications Guide)
American National Standard ANSI/AAMI EC38:1998, Ambulatory Electrocardiographs;
available from AAMI, 1110 N Glebe Road, Suite 220, Arlington, VA 22201
USA (http://www.aami.org/).
George B. Moody (george@mit.edu)
http://www.physionet.org/physiotools/wfdb/app/epicmp.c
Table of Contents
Up: WFDB Applications Guide
Please e-mail your comments and suggestions to webmaster@physionet.org, or post them to:
PhysioNet
MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA
Updated 8 March 2019