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

3.1 Signal Information Structures

The siarray argument for isigopen, osigopen, wfdbinit, and osigfopen is a pointer to an array of objects of type WFDB_Siginfo. The first three of these functions fill in the WFDB_Siginfo objects to which siarray points, but the caller must supply initialized WFDB_Siginfo objects to osigfopen. Each object specifies the attributes of a signal:

char *fname

a pointer to a null-terminated string that names the file in which samples of the associated signal are stored. Input signal files are found by prefixing fname with each of the components of the database path in turn (see section The Database Path and Other Environment Variables). fname may include relative or absolute path specifications if necessary; the use of an absolute pathname, combined with an initial null component in WFDB, reduces the time needed to find the signal file to a minimum. If fname is ‘-’, it refers to the standard input or output.

char *desc

a pointer to a null-terminated string without embedded newlines (e.g., ‘ECG lead V1’ or ‘trans-thoracic impedance’). The length of the desc string is restricted to a maximum of WFDB_MAXDSL (defined in ‘<wfdb/wfdb.h>’) characters, not including the null.

char *units

a pointer to a null-terminated string without embedded whitespace. The string specifies the physical units of the signal; if NULL, the units are assumed to be millivolts. The length of the units string is restricted to a maximum of WFDB_MAXUSL (defined in ‘<wfdb/wfdb.h>’) characters (not including the null).

WFDB_Gain gain

the number of analog-to-digital converter units (adus) per physical unit (see previous item) relative to the original analog signal; for an ECG, this is roughly equal to the amplitude of a normal QRS complex. If gain is zero, no amplitude calibration is available; in this case, a gain of WFDB_DEFGAIN (defined in ‘<wfdb/wfdb.h>’) may be assumed.

WFDB_Sample initval

the initial value of the associated signal (i.e., the value of sample number 0).

WFDB_Group group

the signal group number. All signals in a given group are stored in the same file. If there are two or more signals in a group, the file is called a multiplexed signal file. Group numbers begin at 0; arrays of WFDB_Siginfo structures are always kept ordered with respect to the group number, so that signals belonging to the same group are described by consecutive entries in siarray.

int fmt

the signal storage format. The most commonly-used formats are format 8 (8-bit first differences), format 16 (16-bit amplitudes), and format 212 (pairs of 12-bit amplitudes bit-packed into byte triplets). See ‘<wfdb/wfdb.h>’ for a complete list of supported formats. All signals belonging to the same group must be stored in the same format.

int spf

the number of samples per frame. This is 1, for all except oversampled signals in multi-frequency records, for which spf may be any positive integer. Note that non-integer values are not permitted (thus the frame rate must be chosen such that all sampling frequencies used in the record are integer multiples of the frame rate).

int bsize

the block size, in bytes. For signal files that reside on Unix character device special files (or their equivalents), the bsize field indicates how many bytes must be read or written at a time (see section Signals That Are Not Stored in Disk Files). For ordinary disk files, bsize is zero. All signals belonging to a given group have the same bsize.

int adcres

the ADC resolution in bits. Typical ADCs have resolutions between 8 and 16 bits inclusive.

int adczero

the ADC output given an input that falls exactly at the center of the ADC range (normally 0 VDC). Bipolar ADCs produce two’s complement output; for these, adczero is usually zero. For the MIT DB, however, an offset binary ADC was used, and adczero was 1024.

int baseline

the value of ADC output that would map to 0 physical units input. The value of adczero is not synonymous with that of baseline (the isoelectric or physical zero level of the signal); the baseline is a characteristic of the signal, while adczero is a characteristic of the digitizer. The value of baseline need not necessarily lie within the output range of the ADC; for example, if the units are ‘degrees_Kelvin’, and the ADC range is 200–300 degrees Kelvin, baseline corresponds to absolute zero, and lies well outside the range of values actually produced by the ADC.

long nsamp

the number of samples in the signal. (Exception: in multi-frequency records, nsamp is the number of samples divided by spf, see above, i.e., the number of frames.) All signals in a given record must have the same nsamp. If nsamp is zero, the number of samples is unspecified, and the cksum (see the next item) is not used; this is useful for specifying signals that are obtained from pipes, for which the length may not be known.

int cksum

a 16-bit checksum of all samples. This field is not usually accessed by application programs; newheader records checksums calculated by putvec when it creates a new ‘hea’ file, and getvec compares checksums that it calculates against cksum at the end of the record, provided that the entire record was read through without skipping samples.

The number of WFDB_Siginfo structures in siarray is given by the nsig argument of the functions that open signal files. Input and output signal numbers are assigned beginning with 0 in the order in which the signals are given in siarray. Note that input signal 0 and output signal 0 are distinct. Input signal numbers are supplied to aduphys, physadu, adumuv, and muvadu in their first arguments. See section Example 5: Reading Signal Specifications, for an illustration of how to read signal specifications from WFDB_Siginfo structures.

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

George B. Moody (george@mit.edu)