forked from RTMilliken/EDFbrowser
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ecg_filter.h
153 lines (123 loc) · 4.92 KB
/
ecg_filter.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
***************************************************************************
*
* Author: Teunis van Beelen
*
* Copyright (C) 2011, 2012, 2013, 2014, 2015 Teunis van Beelen
*
* teuniz@gmail.com
*
***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
***************************************************************************
*
* This version of GPL is at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
*
***************************************************************************
*/
#ifndef ecg_filter_INCLUDED
#define ecg_filter_INCLUDED
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
struct ecg_filter_settings{
int avgfilter_50_size;
double *avgfilter_50_buf;
int avgfilter_50_idx;
double avgfilter_50_mean;
double *avgfilter_50_buf_bu;
int avgfilter_50_idx_bu;
double avgfilter_50_mean_bu;
int avgfilter_35_size;
double *avgfilter_35_buf;
int avgfilter_35_idx;
double avgfilter_35_mean;
double *avgfilter_35_buf_bu;
int avgfilter_35_idx_bu;
double avgfilter_35_mean_bu;
int avgfilter_25_size;
double *avgfilter_25_buf;
int avgfilter_25_idx;
double avgfilter_25_mean;
double *avgfilter_25_buf_bu;
int avgfilter_25_idx_bu;
double avgfilter_25_mean_bu;
double *SV;
int SV_sz;
int SV_idx;
double SV_bu[3];
int SV_idx_bu;
int runin;
int runin_bu;
int M_startslope;
int M_endslope;
int smpl_n;
double M[5];
int M_idx;
double M_avg;
double drain;
double top;
double sf;
double *F;
int F_size;
int F_idx;
int F_wd;
double F_value;
double F_sf_factor;
int R[5];
int R_idx;
int R_avg;
double R_value;
int R_startslope;
int R_endslope;
double bpm;
double bitvalue;
int M_startslope_bu;
int M_endslope_bu;
int smpl_n_bu;
double M_bu[5];
int M_idx_bu;
double M_avg_bu;
double drain_bu;
double top_bu;
double *F_bu;
int F_idx_bu;
double F_value_bu;
int R_bu[5];
int R_idx_bu;
int R_avg_bu;
double R_value_bu;
int R_startslope_bu;
int R_endslope_bu;
double bpm_bu;
int bu_filled;
double *stat_buf;
long long *stat_smpl_buf;
int stat_buf_idx;
int sample_cntr;
double T_peak_avg;
double T_peak_avg_bu;
};
struct ecg_filter_settings * create_ecg_filter(double, double, int);
double run_ecg_filter(double, struct ecg_filter_settings *);
void free_ecg_filter(struct ecg_filter_settings *);
void ecg_filter_save_buf(struct ecg_filter_settings *);
void ecg_filter_restore_buf(struct ecg_filter_settings *);
void reset_ecg_filter(struct ecg_filter_settings *);
int ecg_filter_get_beat_cnt(struct ecg_filter_settings *);
long long * ecg_filter_get_onset_beatlist(struct ecg_filter_settings *);
double * ecg_filter_get_interval_beatlist(struct ecg_filter_settings *);
#endif