[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

5.1 File Types

There are four types of files supported by the WFDB library:


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Header Files

Header files have names of the form ‘record.hea’, where record is the record name. (MIT DB records are named 100–124 and 200–234 with some numbers missing. AHA DB records are named 1001–1010, 2001–2010, 3001–3010, 4001–4010, 5001–5010, 6001–6010, 7001–7010, and 8001–8010. ESC DB records are named e0103–e1304, with many numbers missing.) Header files are text files, with lines terminated by ASCII carriage-return/line-feed pairs, created by newheader, setheader, or setmsheader, from which isigopen, osigopen, and wfdbinit read the names of the signal files and their attributes as given in the array of WFDB_Siginfo objects; sampfreq also reads a header file to determine the sampling frequency used for a record.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Signal Files

Signal files usually have names of the form ‘record.dat’. (The .dat suffix is conventional, but not required; any file name acceptable to the operating system is permissible.) Signal files are binary, and usually contain either 16-bit amplitudes (format 16), pairs of 12-bit amplitudes bit-packed into byte triplets (format 212), or 8-bit first differences (format 8). (See ‘<wfdb/wfdb.h>’ for information about other formats that are supported.) The functions that read and write signal files perform appropriate transformations so that the samples visible to the application program are always amplitudes of type int (at least 16 bits), regardless of the signal file format.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Annotation Files

Annotation files have names of the form ‘record.annotator’. Those named ‘record.atr’ are reference annotation files (assumed to be correct). Annotation files are binary, and contain records of variable length that average slightly over 16 bits per annotation.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

Calibration Files

Unlike header, signal, and annotation files, calibration files are not associated with individual records. A calibration file is needed only if you have records containing signals other than ECGs; in this case, it is likely that a single calibration file will be adequate for use with all of your records. Calibration files are text files, with lines terminated by ASCII carriage-return/line-feed pairs, created by newcal, from which calopen reads the calibration list (see section Calibration Information Structures). The WFDB Software Package includes a standard calibration file, ‘wfdbcal’, in the ‘data’ directory.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

EDF Files

European Data Format (EDF) was defined in 1990, and it has become a very widely supported open format for exchange of recorded physiologic signals, especially polysomnograms. EDF files encapsulate functional equivalents of header and signal files, and EDF+ files can also include annotation streams (stored as signals).

EDF files begin with an embedded (text) header containing specifications of the signals and a limited amount of demographic information, followed by the binary samples of the signals. Within each block of samples, typically one second to one minute in length, all samples of the first signal are stored consecutively, followed by all samples of the second signal, etc.

EDF files can be read directly using WFDB library version 10.4.5 and later. The name of the file, which must include a ’.’ and cannot end in ’.hea’, can be passed as a record name to any WFDB library function that accepts record names. Although the WFDB library does not support EDF as an output format, the ‘mit2edf’ application included in the WFDB Software Package can convert anything readable by the WFDB library into EDF.

EDF+, defined in 2003, is backwards-compatible with EDF (any EDF reader, including the WFDB library, can read EDF+), but the additional features of EDF+, including methods for reading annotations and recognizing signal discontinuities (which are marked by annotations), are available only from EDF+-specific readers. The WFDB library does not currently include built-in support for the additional features of EDF+, but annotation streams are available as signals, so it is possible for an application using the WFDB library to provide its own means of decoding annotation streams as they are read.

Further information about EDF and EDF+ is available at http://www.edfplus.info/.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

AHA Format Files

The “AHA Format” was defined in 1980 for storage of database records on 9-track digital tape. Signal files in AHA format are in format 16, with two signals multiplexed into one file (see section Multiplexed Signal Files), and may be read and written using getvec and putvec. AHA-format annotation files are binary, and contain fixed-length (16-byte) annotation records. An annotation file in AHA format may be read or written using getann or putann, if the stat field of the WFDB_Anninfo object is set to WFDB_AHA_READ or WFDB_AHA_WRITE before opening the file. annopen recognizes the format of input annotation files automatically and prints a warning if the format does not match what was expected on the basis of stat. AHA format annotation files may be converted to standard format without loss of information, and doing so reduces the storage requirement by a factor of eight.

Yet another format has been used more recently for distribution of AHA DB files on floppy diskettes and CDROMs. This format is compatible with neither the original AHA format nor with any of the formats supported directly by the WFDB library. Programs ‘a2m’ and ‘ad2m’, supplied with the WFDB Software Package, can convert files in this format (as well as those in the original AHA format) to the standard formats.


[ < ] [ > ]   [ << ] [ Up ] [ >> ]

George B. Moody (george@mit.edu)