SignalInfo

Struct SignalInfo 

Source
pub struct SignalInfo {
Show 14 fields pub file_name: String, pub format: SignalFormat, pub samples_per_frame: Option<u32>, pub skew: Option<u32>, pub byte_offset: Option<u64>, pub adc_gain: Option<f64>, pub baseline: Option<i32>, pub units: Option<String>, pub adc_resolution: Option<u8>, pub adc_zero: Option<i32>, pub initial_value: Option<Sample>, pub checksum: Option<i32>, pub block_size: Option<i32>, pub description: Option<String>,
}
Expand description

Signal specification from a WFDB header signal line.

§Examples

Here are a few examples of a validated signal specification line:

  • 100.dat 212 200 11 1024 995 -22131 0 MLII from MIT-BIH Database
  • data0 8 100 10 0 -53 -1279 0 ECG signal 0 from AHA Database
  • - 16 minimal specification (standard I/O, format 16)
  • sig.dat 16x2:100+512 200(500)/uV 12 2048 0 0 0 Channel A with samples per frame, skew, byte offset, and full ADC specifications

Fields§

§file_name: String

Name of the file containing the signal samples.

§format: SignalFormat

Storage format for the signal.

§samples_per_frame: Option<u32>

Number of samples per frame (default: 1).

§skew: Option<u32>

Number of samples of skew relative to sample 0.

§byte_offset: Option<u64>

Byte offset from beginning of file to sample 0.

§adc_gain: Option<f64>

ADC gain in ADC units per physical unit.

§baseline: Option<i32>

Baseline value in ADC units corresponding to 0 physical units.

§units: Option<String>

Physical unit name (e.g., “mV”, “uV”).

§adc_resolution: Option<u8>

ADC resolution in bits.

§adc_zero: Option<i32>

ADC zero value (center of ADC range).

§initial_value: Option<Sample>

Initial sample value (for difference formats).

§checksum: Option<i32>

Checksum of all samples.

§block_size: Option<i32>

Block size in bytes for special files (usually 0).

§description: Option<String>

Human-readable description of the signal.

Implementations§

Source§

impl SignalInfo

Source

pub const DEFAULT_ADC_GAIN: f64 = 200f64

Default ADC gain (ADC units per physical unit) when omitted.

Source

pub const DEFAULT_ADC_RESOLUTION_AMPLITUDE: u8 = 12u8

Default ADC resolution (bits) for amplitude-format signals.

Source

pub const DEFAULT_ADC_RESOLUTION_DIFFERENCE: u8 = 10u8

Default ADC resolution (bits) for difference-format signals.

Source

pub const DEFAULT_ADC_ZERO: i32 = 0i32

Default ADC zero value when omitted.

Source

pub const DEFAULT_BASELINE: i32 = 0i32

Default baseline value when omitted (equals ADC zero).

Source

pub const DEFAULT_UNITS: &'static str = "mV"

Default physical units when omitted.

Source

pub const DEFAULT_SAMPLES_PER_FRAME: u32 = 1u32

Default samples per frame when omitted.

Source

pub const DEFAULT_SKEW: u32 = 0u32

Default skew when omitted.

Source

pub const DEFAULT_BYTE_OFFSET: u64 = 0u64

Default byte offset when omitted.

Source

pub const DEFAULT_BLOCK_SIZE: i32 = 0i32

Default block size when omitted.

Source

pub fn from_signal_line(line: &str) -> Result<Self>

Build signal information from a signal specification line in a WFDB header.

§Errors

Will return an error if the format of the signal specification line is invalid.

Source

pub fn file_name(&self) -> &str

Get the file name of the signal.

Source

pub const fn format(&self) -> SignalFormat

Get the format of the signal.

Source

pub fn samples_per_frame(&self) -> u32

Get the samples per frame.

Fallback to the default value when omitted.

Source

pub fn skew(&self) -> u32

Get the skew of the signal.

Fallback to the default value when omitted.

Source

pub fn byte_offset(&self) -> u64

Get the byte offset of the signal file.

Fallback to the default value when omitted.

Source

pub fn adc_gain(&self) -> f64

Get the ADC gain of the signal.

Fallback to the default ADC gain when omitted.

Source

pub fn baseline(&self) -> i32

Get the baseline value of the signal.

Fallback to the ADC zero value when omitted.

Source

pub fn units(&self) -> &str

Get the physical units of the signal.

Fallback to the default units when omitted.

Source

pub const fn adc_resolution(&self) -> u8

Get the ADC resolution of the signal.

Returns the specified resolution if present, otherwise returns default based on signal format (12 bits for amplitude formats, 10 for difference).

Source

pub fn adc_zero(&self) -> i32

Get the ADC zero value of the signal.

Fallback to the default ADC zero when omitted.

Source

pub fn initial_value(&self) -> Sample

Get the initial value of the signal.

Fallback to the ADC zero value when omitted.

Source

pub const fn checksum(&self) -> Option<i32>

Get the checksum of the signal.

Source

pub fn block_size(&self) -> i32

Get the block size of the signal file.

Fallback to the default block size when omitted.

Source

pub fn description(&self) -> Option<&str>

Get the description of the signal.

Trait Implementations§

Source§

impl Clone for SignalInfo

Source§

fn clone(&self) -> SignalInfo

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SignalInfo

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for SignalInfo

Source§

fn eq(&self, other: &SignalInfo) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for SignalInfo

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.