-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEcgParam.java
258 lines (224 loc) · 6.68 KB
/
EcgParam.java
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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
public class EcgParam {
/****************************************************************
* GLOBAL ECG PARAMETERS:
****************************************************************/
private int N; /* Number of heart beats */
private double hrstd; /* Heart rate std */
private double hrmean; /* Heart rate mean */
private double lfhfratio; /* LF/HF ratio */
private int sfecg; /* ECG sampling frequency */
private int sf; /* Internal sampling frequency */
private double amplitude; /* Amplitude for the plot area */
private int seed; /* Seed */
private double anoise; /* Amplitude of additive uniform noise*/
private int period;
/* Define frequency parameters for rr process
* flo and fhi correspond to the Mayer waves and respiratory rate respectively
*/
private double flo; /* Low frequency */
private double fhi; /* High frequency */
private double flostd; /* Low frequency std */
private double fhistd; /* High frequency std */
/* Order of extrema: [P Q R S T] */
private double[] theta = new double[5]; /* ti not in radians*/
private double[] a = new double[5];
private double[] b = new double[5];
/* Animation variables */
private long ecgAnimateInterval;
/* Flag to know if all parameters are valid */
private boolean allParametersValid;
/** Creates a new instance of EcgParam */
public EcgParam() {
resetParameters();
}
/****************************************************************
* GLOBAL Set/Get Parameter Functions:
****************************************************************/
public void setN(int value){
N = value;
allParametersValid = false;
}
public int getN(){
return N;
}
public void setHrStd(double value){
hrstd = value;
allParametersValid = false;
}
public double getHrStd(){
return hrstd;
}
public void setHrMean(double value){
hrmean = value;
allParametersValid = false;
}
public double getHrMean(){
return hrmean;
}
public void setLfHfRatio(double value){
lfhfratio = value;
allParametersValid = false;
}
public double getLfHfRatio(){
return lfhfratio;
}
public void setSfEcg(int value){
sfecg = value;
ecgAnimateInterval = (long)(1000/(sfecg));
allParametersValid = false;
}
public int getSfEcg(){
return sfecg;
}
public void setSf(int value){
sf = value;
allParametersValid = false;
}
public int getSf(){
return sf;
}
public void setAmplitude(double value){
amplitude = value;
allParametersValid = false;
}
public double getAmplitude(){
return amplitude;
}
public void setSeed(int value){
seed = value;
allParametersValid = false;
}
public int getSeed(){
return seed;
}
public void setANoise(double value){
anoise = value;
allParametersValid = false;
}
public double getANoise(){
return anoise;
}
public void setPeriod(int value){
period = value;
allParametersValid = false;
}
public int getPeriod(){
return period;
}
public void setFLo(double value){
flo = value;
allParametersValid = false;
}
public double getFLo(){
return flo;
}
public void setFHi(double value){
fhi = value;
allParametersValid = false;
}
public double getFHi(){
return fhi;
}
public void setFLoStd(double value){
flostd = value;
allParametersValid = false;
}
public double getFLoStd(){
return flostd;
}
public void setFHiStd(double value){
fhistd = value;
allParametersValid = false;
}
public double getFHiStd(){
return fhistd;
}
public void setTheta(int index, double value){
theta[index] = value;
allParametersValid = false;
}
public double getTheta(int index){
return theta[index];
}
public void setA(int index, double value){
a[index] = value;
allParametersValid = false;
}
public double getA(int index){
return a[index];
}
public void setB(int index, double value){
b[index] = value;
allParametersValid = false;
}
public double getB(int index){
return b[index];
}
public void setEcgAnimateInterval(long value){
ecgAnimateInterval = value;
allParametersValid = false;
}
public long getEcgAnimateInterval(){
return ecgAnimateInterval;
}
/****************************************************************
* Functions:
****************************************************************/
/*
* check to see if all parameters are valid
*/
public boolean isValid(){
return allParametersValid;
}
/*
* In this function, it can be enforced
* adicional rules.
*/
public boolean checkParameters(){
boolean RetValue = true;
allParametersValid = true;
// Check the Internal frequency respect to ECG frequency
if(((int)Math.IEEEremainder(sf, sfecg)) != 0){
RetValue = false;
allParametersValid = false;
}
return RetValue;
}
/*
* ReInit the Button Parameters' values
*/
public void resetParameters(){
/* General Intergace parameters */
N = 256;
sfecg = 256;
sf = 512;
anoise = 0.1;
hrmean = 60.0;
hrstd = 1.0;
seed = 1;
amplitude = 1.4;
flo = 0.1;
fhi = 0.25;
flostd = 0.01;
fhistd = 0.01;
lfhfratio = 0.5;
/* ECG morphology: Order of extrema: [P Q R S T] */
theta[0]= -60.0;
theta[1]= -15.0;
theta[2]= 0.0;
theta[3]= 15.0;
theta[4]= 90.0;
a[0]= 1.2;
a[1]= -5.0;
a[2]= 30.0;
a[3]= -7.5;
a[4]= 0.75;
b[0]= 0.25;
b[1]= 0.1;
b[2]= 0.1;
b[3]= 0.1;
b[4]= 0.4;
ecgAnimateInterval = 1; //(long)(1000/(sfecg));
allParametersValid = true;
}
}