EdfDecoder
An instance of EdfDecoder is used to decode an EDF file, or rather a buffer extracted from a
EDF file. To specify the input, use the method .setInput(buf)
, then launch the decoding
with the method .decode()
and finally get the content as an object with .getOutput()
.
If the output is null
, then the parser was not able to decode the file.
_decodeData(byteOffset, header)
[PRIVATE] Decodes the data. Must be called after the header is decoded.
parameter | type | description |
---|---|---|
byteOffset |
Number
|
byte size of the header |
header |
_decodeHeader
[PRIVATE] Decodes the header or the file
constructor
Create a EdfDecoder.
decode
Decode the EDF file buffer set as input. This is done in two steps, first the header and then the data.
getOutput
Get the output as an object. The output contains the the header (Object), the raw (digital) signal as a Int16Array and the physical (scaled) signal as a Float32Array.
Object
:
the output.
setInput(buff)
Set the buffer (most likey from a file) that contains some EDF data
parameter | type | description |
---|---|---|
buff |
ArrayBuffer
|
buffer from a file |
Edf(header, rawSignals, physicalSignals)
An instance of Edf is usually given as output of an EdfDecoder. It provides an interface with a lot of helper function to query information that were extracted from en .edf file, such as header information, getting a signal at a given record or concatenating records of a given signal.
Keep in mind that the number of records in an edf file can be decoded by arbitrary measures, or it can be 1 second per records, etc.
parameter | type | description |
---|---|---|
header | ||
rawSignals | ||
physicalSignals |
getNumberOfRecords
get the number of records per signal. Note: most of the time, records from the same signal are contiguous in time.
Number
:
the number of records
getNumberOfSignals
get the number of signals. Note: a signal can have more than one record
Number
:
the number of signals
getPatientID
Get the patien ID
String
:
ID
getPhysicalSignal(index, record)
Get the physical (scaled) signal at a given index and record
parameter | type | description |
---|---|---|
index |
Number
|
index of the signal |
record |
Number
|
index of the record |
Float32Array
:
the physical signal in Float32
getPhysicalSignalConcatRecords(index, recordStart, howMany)
Get concatenated contiguous records of a given signal, the index of the first record and the number of records to concat. Notice: this allocates a new buffer of an extented size.
parameter | type | description |
---|---|---|
index |
Number
|
index of the signal |
recordStart |
Number
|
index of the record to start with |
howMany |
Number
|
Number of records to concatenate |
Float32Array
:
the physical signal in Float32
getRawSignal(index, record)
Get the raw (digital) signal at a given index and record
parameter | type | description |
---|---|---|
index |
Number
|
index of the signal |
record |
Number
|
index of the record |
Int16Array
:
the physical signal in Int16
getRecordDuration
Get the duration in second of a single record
Number
:
duration
getRecordingID
Get the ID of the recording
String
:
the ID
getRecordingStartDate
Get the date and the time at which the recording has started
Date
:
the date
getReservedField(index)
Get the value of the reserved field, global (from header) or specific to a signal. Notice: reserved are rarely used.
parameter | type | description |
---|---|---|
index |
Number
|
if not specified, get the header's reserved field. If [0, nbSignals[ get the reserved field specific for the given signal |
String
:
the data of the reserved field.
getSignalDigitalMax(index)
Get the digital maximum for a given signal index
parameter | type | description |
---|---|---|
index |
Number
|
index of the signal |
Number
getSignalDigitalMin(index)
Get the digital minimum for a given signal index
parameter | type | description |
---|---|---|
index |
Number
|
index of the signal |
Number
getSignalLabel(index)
Get the label for a given signal index
parameter | type | description |
---|---|---|
index |
Number
|
index of the signal |
String
getSignalNumberOfSamplesPerRecord(index)
Get the number of samples per record for a given signal index
parameter | type | description |
---|---|---|
index |
Number
|
index of the signal |
Number
getSignalPhysicalMax(index)
Get the physical maximum for a given signal index
parameter | type | description |
---|---|---|
index |
Number
|
index of the signal |
Number
getSignalPhysicalMin(index)
Get the physical minimum for a given signal index
parameter | type | description |
---|---|---|
index |
Number
|
index of the signal |
Number
getSignalPhysicalUnit(index)
Get the unit (dimension label) used for a given signal index. E.g. this can be 'uV' when the signal is an EEG
parameter | type | description |
---|---|---|
index |
Number
|
index of the signal |
String
:
the unit name
getSignalPrefiltering(index)
Get the unit prefiltering info for a given signal index.
parameter | type | description |
---|---|---|
index |
Number
|
index of the signal |
String
:
the prefiltering info
getSignalSamplingFrequency(index)
Get the sampling frequency in Hz of a given signal
parameter | type | description |
---|---|---|
index |
Number
|
index of the signal |
Number
:
frequency in Hz
getSignalTransducerType(index)
Get the transducer type info for a given signal index.
parameter | type | description |
---|---|---|
index |
Number
|
index of the signal |
String
:
the transducer type info