Class WfdbSegmentReader
java.lang.Object
com.framed.communicator.driver.protocol.mimic.WfdbSegmentReader
Decodes the raw ADC samples of a single WFDB segment from its
.dat file.
WFDB stores samples frame-interleaved: for n signals the on-disk sample
sequence is sig0[0], sig1[0], …, sig(n-1)[0], sig0[1], …. The flat sample index of
signal s in frame f is therefore k = f*n + s. This reader supports the
three formats occurring in the MIMIC-III Waveform Database:
- 80 — 8-bit offset binary; one byte per sample,
adc = byte - 128. - 16 — 16-bit little-endian two's complement; two bytes per sample.
- 212 — two 12-bit two's-complement samples packed into three bytes.
The whole segment file is held in memory; segments in this database are individually small
enough (tens of MB at most) for this to be acceptable and it keeps random frame access simple.
All signals of a segment are expected to share one .dat file and one format, as MIMIC-III
segments do.
-
Method Summary
Modifier and TypeMethodDescriptionintadc(int signalIndex, long frame) Decodes the raw ADC value of signalsignalIndexin frameframe.longintstatic WfdbSegmentReaderopen(Path datPath, List<WfdbSignal> signals, long numFramesHint) Opens the.datfile for a segment described bysignals.
-
Method Details
-
open
public static WfdbSegmentReader open(Path datPath, List<WfdbSignal> signals, long numFramesHint) throws IOException Opens the.datfile for a segment described bysignals.- Parameters:
datPath- the segment's signal filesignals- the segment header's signal specifications (all sharingdatPath)numFramesHint- the samples-per-signal count from the segment header; when<= 0the frame count is derived from the file length- Returns:
- a reader positioned over the decoded samples
- Throws:
IOException- if the file cannot be readUnsupportedOperationException- if the signals use a format this reader cannot decodeIllegalArgumentException- if the signals mix formats or files
-
numFrames
public long numFrames()- Returns:
- the number of decodable frames (samples per signal) in this segment
-
numSignals
public int numSignals()- Returns:
- the number of signals per frame
-
adc
public int adc(int signalIndex, long frame) Decodes the raw ADC value of signalsignalIndexin frameframe.- Parameters:
signalIndex- zero-based signal (column) indexframe- zero-based frame index,0 <= frame <numFrames()- Returns:
- the sign-corrected raw ADC sample value
-
