Next: SQRS(1) Up: WFDB Applications Guide Previous: SNIP(1)On This Page

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 num and chan attributes).

sortann rewrites the annotation file specified by record and annotator, arranging its contents in canonical (time, num, 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, num, 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).

The working memory required by sortann is approximately 10 times the size of the annotation file. Since annotation files are rarely as large as 1 megabyte and available memory is rarely less than 10 megabytes, it is unlikely that sortann will exhaust available memory, however.

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


Table of Contents

Up: WFDB Applications Guide


Please e-mail your comments and suggestions to webmaster@physionet.org, or post them to:

PhysioNet
MIT Room E25-505A
77 Massachusetts Avenue
Cambridge, MA 02139 USA

Updated 10 June 2022