feat: SSF step detector

This commit is contained in:
2026-03-03 00:33:03 +01:00
parent c5acce5699
commit 40e10c1718
4 changed files with 268 additions and 10 deletions

View File

@@ -0,0 +1,54 @@
//
// Created by david on 03.03.2026.
//
#ifndef PASADASUPERPROJECT_SSF_FILTER_H
#define PASADASUPERPROJECT_SSF_FILTER_H
#include "iir_filter.h"
#define FPS 60
#define MAX_BPM 300
/**
* Sum-Slope Function filter.
*
* See Zong et al, 2003: An open-source algorithm to detect onset of arterial blood pressure pulses.
*/
class SsfFilter {
protected:
size_t sw;
Filt f_delta_u;
Filt f_window;
public:
SsfFilter(size_t upslope_width);
double filter(double val);
};
/**
* Provides dirac pulses upon steps, based on SSF input.
*
* Settling time is LEN_INIT (currently 3.0 sec),
* no steps are detected before.
*/
class SsfStepDetector {
protected:
const size_t LEN_INIT;
const size_t LEN_TH_WIN;
size_t num_samples;
double ssf_threshold;
size_t len_refr;
size_t n_refr;
bool is_refr;
double nm1_ssf;
Filt f_ssf_mean;
public:
/**
* @param len_refr duration of refractory period, in samples
*/
SsfStepDetector(size_t len_refr);
double filter(double val);
double peek_threshold();
};
#endif //PASADASUPERPROJECT_SSF_FILTER_H