Struct QrsDetector

Source
pub struct QrsDetector<FMW, FB>
where FMW: Size<f32>, FB: Size<f32>,
{ /* private fields */ }
Expand description

Find QRS complex in real-time sampled ECG signal.

§Type parameters:

The QrsDetector is built upon generic_array. This has an unfortunate implementation detail where the internal buffer sizes must be set on the type level.

  • FMW - number of samples representing 350ms, as typenum::U*
  • FB - number of samples representing 50ms, as typenum::U*

These type parameters are checked at runtime and if incorrect and the error message will contain the correct sizes.

Implementations§

Source§

impl<FMW, FB> QrsDetector<FMW, FB>
where FMW: Size<f32>, FB: Size<f32>,

Source

pub fn new(fs: SamplingFrequency) -> Self

Returns a new QRS detector for signals sampled at fs sampling frequency.

§Arguments
  • fs - The sampling frequency of the processed signal. For more information see SamplingFrequencyExt.
§Example
use qrs_detector::sampling::*;
use qrs_detector::QrsDetector;
use qrs_detector::typenum::{U150, U25};

// Assuming 500 samples per second
// Type parameters must be 300ms and 50ms in number of samples
let detector: QrsDetector<U150, U25> = QrsDetector::new(500.sps());
Source

pub fn clear(&mut self)

Reset the internal state of the detector

Source

pub fn update(&mut self, sample: f32) -> Option<u32>

Process a sample. Returns Some sample index if a QRS complex is detected.

Auto Trait Implementations§

§

impl<FMW, FB> Freeze for QrsDetector<FMW, FB>

§

impl<FMW, FB> RefUnwindSafe for QrsDetector<FMW, FB>

§

impl<FMW, FB> Send for QrsDetector<FMW, FB>

§

impl<FMW, FB> Sync for QrsDetector<FMW, FB>

§

impl<FMW, FB> Unpin for QrsDetector<FMW, FB>

§

impl<FMW, FB> UnwindSafe for QrsDetector<FMW, FB>

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> 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> Same for T

Source§

type Output = T

Should always be Self
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.