File: pt_qrs.h

package info (click to toggle)
edfbrowser 2.14%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,552 kB
  • sloc: cpp: 84,514; ansic: 13,113; sh: 178; xml: 19; makefile: 13
file content (153 lines) | stat: -rw-r--r-- 2,763 bytes parent folder | download
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
149
150
151
152
153
/*
***************************************************************************
*
* Author: Teunis van Beelen
*
* Copyright (C) 2020 - 2025 Teunis van Beelen
*
* Email: teuniz@protonmail.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 3 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, see <http://www.gnu.org/licenses/>.
*
***************************************************************************
*/



#ifndef PT_QRS_INCLUDED
#define PT_QRS_INCLUDED



#ifdef __cplusplus
extern "C" {
#endif


#define PT_LPF_LEN         (13)
#define PT_HPF_LEN         (33)
#define PT_DIFF_LEN         (5)
#define PT_QRS_RR_AVG_LEN   (8)
#define PT_MWI_LEN         (30)


typedef struct
{
/******** begin down sampling section ********/
  double ds_ratio;
  double ds_smpl_pos;
  double ds_old_val;

  long long ds_num_smpl;

  int ds_ravg_len;
  int ds_ravg_idx;
  int ds_sf_out;

  double *ds_ravg_buf;
/******** end down sampling section ********/

  /* high threshold max peak index */
  int idx_ht;
  /* low threshold max peak index */
  int idx_lt;

  int pk_det_start;

  double slope_last;
  double slope_lt;

  int del_comp;

  int lpf_idx;
  double lpfx[PT_LPF_LEN];
  double lpfy[PT_LPF_LEN];

  int hpf_idx;
  double hpfx[PT_HPF_LEN];
  double hpfy[PT_HPF_LEN];
  double hpf_out;
  double hpf_out_old;

  /* max peak with low threshold */
  double hpf_out_lt;

  int diff_idx;
  double diffx[PT_DIFF_LEN];

  double sqr_out;
  double sqr_out_clip;

  int mwi_idx;
  double mwix[PT_MWI_LEN];
  double mwi_out;
  double mwi_out_old;

  /* max peak with low threshold */
  double mwi_out_lt;

  double peaki;
  double spki;
  double npki;

  double threshold_i1;
  double threshold_i2;

  int smpls_last_pk;

  double peakf;
  double spkf;
  double npkf;

  double threshold_f1;
  double threshold_f2;

  int rr_avg_idx1;
  int rr_avg_idx2;
  int rr_avg_x1[PT_QRS_RR_AVG_LEN];
  int rr_avg_x2[PT_QRS_RR_AVG_LEN];
  int rr_average1;
  int rr_average2;
  int rr_low_limit;
  int rr_high_limit;
  int rr_missed_limit;
  int rr_regular;
} ptqrsset_t;


ptqrsset_t * create_pt_qrs(double, double);
void free_pt_qrs(ptqrsset_t *);
int run_pt_qrs(double, ptqrsset_t *);

#ifdef __cplusplus
} /* extern "C" */
#endif


#endif