header_table()
modifies the data.table
class to work with
header data. The header data is read in from a similar format as to that of
WFDB files and should be compatible/interchangeable when writing out to disk.
The details extensively cover the type of data that is input. Generally, this
function is called by read_*_header()
functions and will generally not be
called by the end-user.
Usage
header_table(
record_name = character(),
number_of_channels = integer(),
frequency = 250,
samples = integer(),
start_time = strptime(Sys.time(), "%Y-%m-%d %H:%M:%OSn"),
ADC_saturation = integer(),
file_name = character(),
storage_format = 16L,
ADC_gain = 200L,
ADC_baseline = ADC_zero,
ADC_units = "mV",
ADC_resolution = 12L,
ADC_zero = 0L,
initial_value = ADC_zero,
checksum = 0L,
blocksize = 0L,
label = character(),
info_strings = list(),
additional_gain = 1,
low_pass = integer(),
high_pass = integer(),
color = "#000000",
scale = integer()
)
is_header_table(x)
Arguments
- record_name
A
character
vector of record line information- number_of_channels
An
integer
describing number of signals- frequency
A
numeric
value of sampling frequency, 250 Hz default- samples
An
integer
for the number of samples- start_time
The
POSIXct
time of recording, with miliseconds included. For example,strptime(start_time, "%Y-%m-%d %H:%M%:%OSn")
where as described inbase::strptime()
- ADC_saturation
An
integer
representing ADC saturation- file_name
A
character
for the signal specific information- storage_format
An
integer
of the bits for the storage format, 16-bit default- ADC_gain
An
integer
of ADC gain, default of 200- ADC_baseline
An
integer
of ADC baseline, defaults to ADC_zero- ADC_units
A
character
to describe ADC units, "mV" is default- ADC_resolution
An
integer
for ADC resolution, default is 12- ADC_zero
An
integer
for ADC zero, defaults to 0- initial_value
An
integer
for the initial value, defaults to ADC_zero value- checksum
An
integer
that serves as the checksum- blocksize
An
integer
of the block size- label
A
character
description of the signal- info_strings
A
list
of strings that will be written as an appendix to the header file, usually containing information about the channels, (e.g. list of colors, extra labels, etc).- additional_gain
A
numeric
Additional gain, defaults to 1.0- low_pass
An
integer
Low pass filter- high_pass
An
integer
High pass filter- color
A
character
Color as hexadecimal format, defaults to black- scale
An
integer
Scale- x
A
data.table
object that serves as the header table
Value
A header_table
object that is an extension of the data.table
class. This contains an adaptation of the function arguments, allowing for
compatibility with the WFDB class.
Details
The header_table
object is relatively complex in that it directly
deals with properties of the signal, and allows compatibility with WFDB
files and other raw header files for other signal objects. It can be written
out using write_wfdb()
.
Header file structure
There are three components to the header file:
Record line that contains the following information, in the order documented, however pieces may be missing based on different parameters. From left to right...
Record name
Number of signals: represents number of segments/channels
Sampling frequency (optional)
Number of samples (optional)
Time: in HH:MM:SS format (optional)
Date: in DD/MM/YYYY (optional)
Signal specification lines contains specifications for individual signals, and there must be as many signal lines as there are reported by the above record line. From left to right....
File name: usually *.dat
Format
integer
: represents storage type, e.g. 8-bit or 16-bitADC gain: ADC units per physical unit (optional)
Baseline: corresponds to 0 physical units, sep = '*(0)" (optional)
Units: with '/' as a field separator e.g '*/mV' (optional)
ADC resolution
integer
: bits, usually 8 or 16 (optional)ADC zero: represents middle of ADC input range (optional)
Initial value (optional)
Checksum (optional)
Block size (optional)
Description: text or label information (optional)
Info strings are unstructured lines that contains information about the record. Usually are descriptive. Starts with initial '#' without preceding white space at beginning of line.