Individual annotation types are described as both a command-line
tool for annotating WFDB-files, as well as the extension that is appended to
the record name to notate the type. Generally, the types of annotations
that are supported are described below:
atr = manually reviewed and corrected reference annotation files
ann = general annotator file
ecgpuwave = files contain surface ECG demarcation (P, QRS, and T waves)
sqrs/wqrs/gqrs = standard WFDB peak detection for R waves
A more thorough explanation is given in the details. Additionally, files when
being read in are converted from a binary format to a textual format. The raw
data however may be inadequate, as the original annotation may be erroneous.
In these cases, an empty annotation_table object will be returned.
Usage
read_annotation(
record,
annotator,
record_dir = ".",
begin = 0,
end = NA_real_,
header = NULL
)
write_annotation(data, annotator, record, record_dir = ".")Arguments
- record
String that will be used to name the WFDB record. Cannot include extensions, and is not a filepath. alphanumeric characters are acceptable, as well as hyphens (-) and underscores (_)
- annotator
String that is the name of a WFDB-compatible annotation type, serving as the extension for the file that is written containing that annotation. Please see
read_annotation()andwrite_annotation()for further details.- record_dir
File path of directory that should be used read and write files. Defaults to current directory.
- begin, end
A
characterin the format of HH:MM:SS that will be used to help parse the time of the annotation. These parameters together create the time range to extract. The default of 0 is a shortcut for 00:00:00. The seconds argument can include a decimal place.- header
A header file is an optional named list of parameters that will be used to organize and describe the signal input from the data argument. If the type is given, specific additional elements will be searched for, such as the low or high pass filters, colors, or other signal attributes. At minimum, the following elements are required (as cannot be calculated):
frequency = sample frequency in Hertz as
integerlabel = vector of names for each channel as
characterstart_time = date/time object
- data
An
annotation_tablecontaining the 6 invariant columns required by theannotation_table()function
Value
This function will either read in an annotation using the read_annotation() function in the format of an annotation_table object, or write to file/disk an annotation_table to a WFDB-compatible annotation file using the write_annotation() function.
IMPORTANT: as annotation files are created by annotators that were
developed independently, there is a higher chance of an erroroneous file
being created on disk. As such, this function will note an error an return an
empty annotation_table at times.
Annotation files
The following annotation file types are described below.
ecgpuwave
ecgpuwave analyzes an ECG signal from the specified record, detecting the
QRS complexes and locating the beginning, peak, and end of the P, QRS, and
ST-T waveforms. The output of ecgpuwave is written as a standard WFDB-format
annotation file (the extension is "*.ecgpuwave", as would be expected). This
file can be converted into text format using rdann. Further details are
given at the ECGPUWAVE
page.
The type column can be p, t, or N for the peak of the P wave, T wave, and QRS (R peak) directly. The output notation also includes waveform onset XXX and waveform offset XXX. The number column gives further information about each of these type labels.
The number column gives modifier information. If the type classifier is a T wave annotation, the number column can be 0 (normal), 1 (inverted), 2 (positive), 3 (negative), 4 (biphasic negative-positive), 5 (biphasic positive-negative). If the type is an waveform onset or offset, then number can be 0 (P wave), 1 (QRS complex), 2 (T wave).