-
Notifications
You must be signed in to change notification settings - Fork 38
/
HRV1Analyzer.h
76 lines (60 loc) · 1.62 KB
/
HRV1Analyzer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/// czestotliwosc probkowania dla fft
#define SAMPLING_FFT 500
/// wlacza development mode: zdefiniowana => development mode, niezdefiniowana => standard mode
//#define DEV
/// wlacza tryb debugowania
#define DEBUG
//#define DEBUG_FFT
//#define DEBUG_SIG
//#define DEBUG_WINDOWS
#pragma once
#include <cmath>
#include <vector>
#include "fft/kiss_fft.h"
#include "fft/kiss_fftr.h"
#include "spline/interpolation.h"
#include "ECGRs.h"
#include "ECGHRV1.h"
#include "ECGChannelInfo.h"
#include "ECGSignal.h"
#ifdef DEV // 4 testing
#include "ExampleSignal.h"
#else
#include "ModulesInterfaces.h"
#endif
#define FREQUENCY_FFT (1000/SAMPLING_FFT)
/**
* @class Class for parameters created in HRV1 module
*/
#ifndef DEV // 4 testing
class HRV1Analyzer : public HRV1Module {
#else
class HRV1Analyzer {
#endif
public:
HRV1Analyzer();
~HRV1Analyzer();
void runModule(const ECGInfo &, const ECGRs &, ECGHRV1 &);
#ifndef DEV
void setParams(ParametersTypes &);
#endif
private:
//input parameters
ECGRs rPeaksData;
ECGHRV1* hrv1Data;
//RR peaks signal parameters
double *sig;
double *sigAbsolute;
unsigned int signalSize;
unsigned int sizeFftIndex;
unsigned int signalSampling;
//methods
void prepareSignal();
void prepareSigAbsolute();
void calculateParameters();
double* doFFT(double* sigAfterSpline, int size);
kiss_fft_cpx* copycpx(double *mat, int nframe);
double mean(double *tab, int start, int end);
double std(double *tab, int start, int end);
double* cubicSpline(double* x, double* y, int nframe);
};