This program implements the beat-by-beat comparison algorithm described in Testing and Reporting Performance Results of Ventricular Arrhythmia Detection Algorithms, an AAMI Recommended Practice (AAMI ECAR-1987). Using options -C, -L, or -S, bxb implements the beat-by-beat comparison algorithm specified by the current American National Standard for ambulatory ECG analyzers (ANSI/AAMI EC38-1994). bxb is the reference implementation of these algorithms, and must be used to obtain the beat-by-beat performance statistics cited in EC38 in order to be in compliance with the standard. The EC38 comparison algorithm includes all of the ECAR statistics (so that both sets of requirements are satisfied by using the EC38 algorithm), with additional statistics on detection of supraventricular ectopic beats (SVEBs). The -C, -L, and -S options also gather statistics on RR interval errors, which were considered for inclusion in EC38, but were eventually dropped from it.
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 (called the `algorithm' annotation file in EC-38 and in ECAR).
Options include:
The statistics gathered by bxb are based on tallies of `matching' annotations in the reference and test annotation files. Matching annotations need not have exactly equal annotation times; the match window specifies the maximum absolute difference in annotation times that is permitted for matching annotations. bxb measures the total shutdown time in the test annotation file as the sum of all intervals that begin with a `shutdown' annotation and that end with a `resume' annotation. (If a period of shutdown does not end before the end of the record, the creator of the annotation file should nevertheless write a `resume' annotation at the end of the record, in order to permit correct shutdown accounting.) This program follows the convention for `shutdown' and `resume' annotations adopted for reference annotation files of the European ST-T database, a convention compatible with that established for the MIT-BIH Arrhythmia Database: `shutdown' annotations are NOISE annotations with bits 4 and 5 (i.e., the `16' bit and the `32' bit) of the subtype field both set; `resume' annotations are NOISE annotations with any other subtype. The convention used in AHA Database reference files, in which unreadable intervals are marked by only one `shutdown' annotation placed near the middle of the interval, is also acceptable; in this case, shutdown is assumed to begin 150 ms after the previous annotation, and it is assumed to end 150 ms before the following annotation.
At most one of -c, -C, -l, -L, -O, -s, and -S can be given as an option. If `-' is given as a file argument, reports are written on the standard output. If no options are specified, bxb writes standard reports on the standard output (equivalent to using the option -s -). 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, bxb can be used repeatedly to build up a line-format table for multiple records, for further processing by sumstats(1) .
The -o option produces an output annotation file with annotator name bxb. The output annotation file contains exact copies of all of the test annotator's beat labels that match those of the reference annotator, as well as NOTE annotations that describe all mismatches. Mismatched annotation types are mapped into the AAMI `test label' mnemonics (N, V, F, Q, O, and X; if the -C, -L, or -S option is also specified, the mnemonics also include S). The `aux' field of each NOTE annotation indicates the element of the confusion matrix in which the mismatch is tallied (e.g., Nv represents an event called a normal beat by the reference annotator and a ventricular ectopic beat by the test annotator). NOTE annotations that correspond to beats missed by the test annotator are placed at the sample indicated by the reference annotation; all others are placed at that indicated by the test annotation.
The -O option produces a similar output annotation file, in this case containing not only beat labels but all others as well. No summary report is produced if -O is specified. NOTE annotations produced using -O contain unmapped annotation mnemonics from the input annotation files. This option, if used together with -f 0 -w 0, identifies all discrepancies between a pair of annotation files. It can be especially useful for developing reference annotation files for new records.
The -v option specifies that
each beat label mismatch is described on the standard output in a format
similar to:
N(120188)/V(120191)
where the letters indicate the AAMI
mnemonics corresponding to the reference and test annotators' beat labels,
and the numbers indicate the time fields (sample numbers) of the reference
and test annotations respectively. Note that O and X mnemonics are generated
by bxb as placeholders for missing beat labels; you will not find them
in the input annotation files.
The shell variable DB should be set and exported (see setdb(1) ).