WFDB Software Package 10.7.0
(3,537 bytes)
.TH ANNOT 5 "1 August 2002" "WFDB software 10.2.7" "WFDB Applications Guide"
.SH NAME
annot \- WFDB annotation file formats
.SH SYNOPSIS
\fB#include <wfdb/ecgcodes.h>\fR
.SH DESCRIPTION
Programs compiled with the WFDB library (\fB-lwfdb\fP) can read annotation
files in two formats. The preferred format (MIT format) is compact
(averaging slightly over two bytes per annotation) and extensible, and is
normally used for on-line annotation files. The alternative format
(AHA DB distribution format) uses 16 bytes per annotation, and is normally
used only for exchange of files between institutions on 9-track tape.
Both formats are binary, but readable on any machine without reformatting.
WFDB library applications can distinguish between the formats automatically
when opening a file for input.
.SS MIT format:
.PP
Each annotation occupies an even number of bytes. The first byte in each
pair is the least significant byte.
The six most significant bits (\fIA\fR) of each byte pair are the
annotation type code, and the ten remaining bits (\fII\fR) specify the time
of the annotation, measured in sample intervals from the previous annotation
(or from the beginning of the record for the first annotation).
If 0 < \fIA\fR <= \fBACMAX\fR, then \fIA\fR is defined in
\fB<wfdb/ecgcodes.h>\fR. Several other possibilities exist:
.TP
\fIA\fR = \fBSKIP\fR [59.]
\fII\fR = 0;
the next four bytes are the interval in PDP-11 long
integer format (the high 16 bits first, then the low 16 bits, with the low byte
first in each pair).
.TP
\fIA\fR = \fBNUM\fR [60.]
\fII\fR = annotation \fBnum\fR field for current and subsequent
annotations; otherwise, assume previous annotation \fBnum\fR
(initially 0).
.TP
\fIA\fR = \fBSUB\fR [61.]
\fII\fR = annotation \fBsubtyp\fR field for current annotation only;
otherwise, assume \fBsubtyp\fR = 0.
.TP
\fIA\fR = \fBCHN\fR [62.]
\fII\fR = annotation \fBchan\fR field for current and subsequent annotations;
otherwise, assume previous \fBchan\fR (initially 0).
.TP
\fIA\fR = \fBAUX\fR [63.]
\fII\fR = number of bytes of auxiliary information
(which is contained in the next \fII\fR bytes); an extra
null, not included in the byte count, is appended if \fII\fR is odd.
.TP
\fIA\fR = \fII\fR = 0: End of file.
.SS AHA format:
.PP
All annotations occupy exactly 16 bytes. Within each block, the first byte is
unused, the second byte contains the AHA annotation code (an ASCII character;
see \fB<wfdb/ecgmap.h>\fR), the third through sixth bytes contain the time (see
below) in PDP-11 long integer format as above, and the seventh and eighth bytes
contain an annotation serial number.
.PP
In annotation files taken directly from the AHA database distribution
tapes, the last eight bytes in each annotation are unused, and the
time is given in milliseconds measured from the beginning of the
annotated segment of the record. In AHA-format annotation files
generated by WFDB library applications, annotation times are given in
sample intervals from the beginning of the record, and the last eight
bytes of each annotation contain the MIT annotation subtype (in the
ninth byte), the MIT annotation code (in the tenth byte), and up to
six ASCII characters (in the remaining bytes) used to describe
\fBRHYTHM\fR and \fBNOTE\fR annotations.
.SH SEE ALSO
\fBheader\fR(5), \fBsignal\fR(5), \fBwfdbcal\fR(5)
.br
\fIWFDB Programmer's Guide\fP
.SH AUTHOR
George B. Moody (george@mit.edu). The original MIT annotation format
was designed by Paul Schluter, and the AHA annotation format was designed
by Russ Hermes.