SORTANN(1)

NAME
sortann - rearrange annotations in canonical order

SYNOPSIS
sortann -r record -a annotator [ options ... ]

DESCRIPTION
Applications that use the WFDB library (version 9.7 and later versions) may write annotations in any order. Most applications that read annotations, however, expect to find them in time order (with simultaneous annotations ordered by their chan attributes).

sortann rewrites the annotation file specified by record and annotator, arranging its contents in canonical (time and chan) order. By default, WFDB applications run sortann as needed (from within wfdbquit or oannclose). If the environment variable WFDBNOSORT has been set (to any value), sortann will not be run automatically, and a warning message will be printed instead. In most such cases, you should run sortann as instructed by the warning message before reading the annotation file with any other WFDB application.

If the input contains two or more annotations with the same time and chan fields, only the last one is copied. As a special case of this policy, if the last such annotation has anntyp = 0 (NOTQRS), no annotation is written at that location. Thus a program that generates input for sortann can effectively delete a previously written annotation by writing a NOTQRS annotation at the same location.

The sorted (output) annotation file is always written to the current directory. If the input annotation file is in the current directory, sortann replaces it unless you specify a different output annotator name (using the -o option). Note that the output annotation file is likely to be slightly shorter than the input file, since more compact storage is usually possible when all annotations are sorted.

If the input annotations are already in the correct order, no output is written unless you have used the -o option.

If you attempt to sort a very large annotation file, sortann may run out of memory. If this happens, use the -f and -t options to work on the file in sections of any convenient size, one at a time, then use mrgann(1) to concatenate the sections. Note that you must specify an output annotator name (with -o) when using the -f or -t options (to avoid replacing the entire input file with a sorted subset of its contents).

Running out of memory is unlikely unless:

1.  you have less than 2 Mb of memory and you are attempting to sort a 24-hour or longer annotation file.

2.  you have compiled sortann using a 16-bit compiler and you are attempting to sort more than about 4000 annotations (note that the precompiled versions of sortann for MS-DOS and UNIX do not have this limitation).

Options include:

-f time
    Begin at the specified time. By default, sortann starts at the beginning of the record.

-h  Print a usage summary.

-o output-annotator
    Write output to the annotation file specified by output-annotator and (as specified using -r) record. By default, sortann replaces the input annotation file.

-t time
    Stop at the specified time.

The -f and -t options may be used to select a portion of an annotation file for processing.

ENVIRONMENT

It may be necessary to set and export the shell variable WFDB (see setwfdb(1)).

SEE ALSO
mrgann(1), setwfdb(1)

AUTHOR
George B. Moody (george@mit.edu)

SOURCE
http://www.physionet.org/physiotools/wfdb/app/sortann.c