Class WfdbHeader
java.lang.Object
com.framed.communicator.driver.protocol.mimic.WfdbHeader
A parsed WFDB header
(
.hea) file, covering the three header flavours used by the
MIMIC-III Waveform Database:
- Master (multi-segment) header — its record line carries a
/numSegmentssuffix and it lists oneWfdbHeader.Segmentper line instead of signal specifications. Segments whose name is"~"are gaps (WfdbHeader.Segment.gap()); the_layoutsegment has zero length and points at the layout header. - Layout header — a single-segment header whose signal lines use the placeholder
file
"~"and format0; it establishes the canonical signal order, gains and names for a variable-layout record. - Segment header — a single-segment header whose signal lines reference a real
.datfile; this is the source of truth for decoding that segment.
The parser is deliberately lenient: comment lines (starting with #) and blank lines are
skipped, and trailing optional numeric fields on a signal line may be omitted.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordA segment reference on a master (multi-segment) header line. -
Method Summary
Modifier and TypeMethodDescriptionbaseTime()booleanlongstatic WfdbHeaderParses the header file atpath.static WfdbHeaderParses header content already read into lines.doublesegments()signals()
-
Method Details
-
parse
Parses the header file atpath.- Parameters:
path- the.heafile to read- Returns:
- the parsed header
- Throws:
IOException- if the file cannot be readIllegalArgumentException- if the record line is malformed
-
parse
Parses header content already read into lines. Exposed for testing without touching the file system.- Parameters:
rawLines- the lines of a.heafile, in order- Returns:
- the parsed header
- Throws:
IllegalArgumentException- if no valid record line is present
-
recordName
- Returns:
- the record identifier (without any
/numSegmentssuffix)
-
isMultiSegment
public boolean isMultiSegment()- Returns:
trueif this is a master multi-segment header (hassegments())
-
samplingFrequency
public double samplingFrequency()- Returns:
- the sampling frequency in Hz (WFDB default
250if the field was absent)
-
numSamplesPerSignal
public long numSamplesPerSignal()- Returns:
- the declared number of samples per signal (
0if unspecified)
-
baseTime
- Returns:
- the base time string (
HH:MM:SS[.fff]) from the record line, ornull
-
segments
- Returns:
- the ordered segment list for a master header (empty for single-segment headers)
-
signals
- Returns:
- the ordered signal specifications for a single-segment/layout header (empty otherwise)
-
