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

annstr, anndesc, and ecgstr

 
char *annstr(int code)
char *anndesc(int code)
char *ecgstr(int code)
Return:

(char *)
pointer to a printable string that describes the code, or NULL

These functions translate the annotation code specified by their argument into a string (see section 4. Annotation Codes). Illegal or undefined codes are translated by annstr and ecgstr into decimal numerals surrounded by brackets (e.g., `[55]'); anndesc returns NULL in such cases. The strings returned by annstr are mnemonics (usually only one character), which may be modified either by setannstr or by the presence of modification labels in an input annotation file (see section annstr, anndesc, and ecgstr). The strings returned by anndesc are brief descriptive strings, usually those given in the table of annotation codes (see section 4. Annotation Codes). The strings returned by ecgstr are usually the same as those returned by annstr, but they can be modified only by setecgstr, and not by the presence of modification labels as for annstr. The intent is that ecgstr should be used rather than annstr only when it is necessary that a fixed set of mnemonics be used, independent of any modification labels.

Here is a little program that prints a table of the codes, mnemonic strings, and descriptions:

 
#include <stdio.h>
#include <wfdb/wfdb.h>
#include <wfdb/ecgcodes.h>

main()
{
    int i;

    printf("Code\tMnemonic\tDescription\n");
    for (i = 1; i <= ACMAX; i++) {
        printf("%3d\t%s", i, annstr(i));
        if (anndesc(i) != NULL)
            printf("\t\t%s", anndesc(i));
        printf("\n");
    }
}

(See http://www.physionet.org/physiotools/wfdb/examples/exannstr.c for a copy of this program.)

ACMAX is defined in `<wfdb/ecgcodes.h>'. The range from 1 through ACMAX includes all legal annotation codes; if you run this program, you will find some undefined but legal annotation codes in this range. See section Example 3: An Annotation Printer, for another illustration of the use of annstr. (annstr and anndesc were first introduced in WFDB library version 5.3.)


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

George B. Moody (george@mit.edu)