1 /* 2 --------------------------------------------------------------------------- 3 Copyright (C) 2014 Alois Schloegl 4 Copyright (C) 2003 Eugenio Cervesato & Giorgio De Odorico. 5 Developed at the Associazione per la Ricerca in Cardiologia - Pordenone - Italy. 6 7 This program is free software; you can redistribute it and/or 8 modify it under the terms of the GNU General Public License 9 as published by the Free Software Foundation; either version 2 10 of the License, or (at your option) any later version. 11 12 This program is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 GNU General Public License for more details. 16 17 You should have received a copy of the GNU General Public License 18 along with this program; if not, write to the Free Software 19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 20 --------------------------------------------------------------------------- 21 */ 22 // structures.h header file 23 24 #ifndef __STRUCTURES_H__ 25 #define __STRUCTURES_H__ 26 #include <time.h> 27 28 /* 29 // obsolete definition 30 #define int_S int8_t 31 #define int_M int16_t 32 #define int_L int32_t 33 #define U_int_S uint8_t 34 #define U_int_M uint16_t 35 #define U_int_L uint32_t 36 #define dec_S float 37 #define dec_M double 38 #define dec_L long double 39 */ 40 #define str char 41 42 #define bool char 43 #define true 1 44 #define false 0 45 #define TRUE 1 46 #define FALSE 0 47 48 struct alfabetic 49 { 50 uint16_t number; 51 const char *sentence; 52 }; 53 54 struct numeric 55 { 56 uint16_t value; 57 uint8_t unit; 58 }; 59 60 struct section_header 61 { 62 uint16_t CRC; 63 uint16_t ID; 64 uint32_t length; 65 uint8_t version; 66 uint8_t protocol_version; 67 char *word; 68 }; 69 70 struct file_header 71 { 72 uint16_t CRC; 73 uint32_t length; 74 }; 75 76 struct pointer_section 77 { 78 uint32_t index; 79 int16_t ID; 80 uint32_t length; 81 }; 82 83 struct device_info 84 { 85 uint16_t institution_number; 86 uint16_t department_number; 87 uint16_t ID; 88 uint8_t type; 89 uint8_t manifacturer; 90 char *model_description; 91 uint8_t protocol_revision_number; 92 uint8_t category; 93 uint8_t language; 94 uint8_t capability[4]; 95 uint8_t AC; 96 char *analysing_program_revision_number; 97 char *serial_number_device; 98 char *device_system_software; 99 char *device_SCP_implementation_software; 100 char *manifacturer_trade_name; 101 }; 102 103 struct info_drug 104 { 105 uint8_t table; 106 uint8_t classes; 107 uint8_t drug_code; 108 uint16_t length; 109 }; 110 111 struct Time_Zone 112 { 113 int16_t offset; 114 uint16_t index; 115 const char *description; 116 }; 117 118 struct demographic 119 { 120 char *first_name; 121 char *last_name; 122 char *ID; 123 char *second_last_name; 124 struct numeric age; 125 time_t date_birth2; // by E.C. feb 2006 126 struct numeric height; 127 struct numeric weight; 128 uint8_t sex; 129 uint8_t race; 130 uint16_t systolic_pressure; 131 uint16_t diastolic_pressure; 132 }; 133 134 struct clinic 135 { 136 uint16_t number_drug; 137 struct info_drug *drug; 138 char *text_drug; 139 140 uint16_t number_diagnose; 141 struct numeric *diagnose; 142 char *text_diagnose; 143 144 char *referring_physician; 145 char *latest_confirming_physician; 146 char *technician_description; 147 148 uint16_t number_text; 149 struct numeric *free_text; 150 char *text_free_text; 151 152 uint16_t number_hystory; 153 struct numeric *medical_hystory; 154 155 uint16_t number_free_hystory; 156 struct numeric *free_medical_hystory; 157 char *text_free_medical_hystory; 158 }; 159 160 struct descriptive 161 { 162 struct device_info acquiring; 163 struct device_info analyzing; 164 char *acquiring_institution; 165 char *analyzing_institution; 166 char *acquiring_department; 167 char *analyzing_department; 168 char *room; 169 uint8_t stat_code; 170 }; 171 172 struct device 173 { 174 time_t date_acquisition2; // by E.C. feb 2006 175 time_t time_acquisition2; // by E.C. feb 2006 176 uint16_t baseline_filter; 177 uint16_t lowpass_filter; 178 uint8_t other_filter[4]; 179 char *sequence_number; 180 struct numeric electrode_configuration; 181 struct Time_Zone TZ; 182 }; 183 184 struct table_H 185 { 186 uint8_t bit_prefix; 187 uint8_t bit_code; 188 uint8_t TMS; 189 int16_t base_value; 190 uint32_t base_code; 191 }; 192 193 struct f_lead 194 { 195 uint8_t number; 196 bool subtraction; 197 bool all_simultaneously; 198 uint8_t number_simultaneously; 199 }; 200 201 struct lead 202 { 203 uint8_t ID; 204 uint32_t start; 205 uint32_t end; 206 }; 207 208 struct Subtraction_Zone 209 { 210 uint16_t beat_type; 211 uint32_t SB; 212 uint32_t fc; 213 uint32_t SE; 214 }; 215 216 struct Protected_Area 217 { 218 uint32_t QB; 219 uint32_t QE; 220 }; 221 222 struct f_BdR0 223 { 224 uint16_t length; 225 uint16_t fcM; 226 uint16_t AVM; 227 uint16_t STM; 228 uint16_t number_samples; 229 uint8_t encoding; 230 }; 231 232 struct f_Res 233 { 234 uint16_t AVM; 235 uint16_t STM; 236 uint16_t number; 237 uint16_t number_samples; 238 uint8_t encoding; 239 bool bimodal; 240 uint8_t decimation_factor; 241 }; 242 243 struct spike 244 { 245 uint16_t time; 246 int16_t amplitude; 247 uint8_t type; 248 uint8_t source; 249 uint8_t index; 250 uint16_t pulse_width; 251 }; 252 253 struct global_measurement 254 { 255 uint8_t number; 256 uint16_t number_QRS; 257 uint8_t number_spike; 258 uint16_t average_RR; 259 uint16_t average_PP; 260 uint16_t ventricular_rate; 261 uint16_t atrial_rate; 262 uint16_t QT_corrected; 263 uint8_t formula_type; 264 uint16_t number_tag; 265 }; 266 267 struct additional_measurement 268 { 269 uint8_t ID; 270 uint8_t byte[5]; 271 }; 272 273 struct BdR_measurement 274 { 275 uint16_t P_onset; 276 uint16_t P_offset; 277 uint16_t QRS_onset; 278 uint16_t QRS_offset; 279 uint16_t T_offset; 280 int16_t P_axis; 281 int16_t QRS_axis; 282 int16_t T_axis; 283 }; 284 285 struct info 286 { 287 uint8_t type; 288 char *date; 289 char *time; 290 uint8_t number; 291 }; 292 293 struct header_lead_measurement 294 { 295 uint16_t number_lead; 296 uint16_t number_lead_measurement; 297 }; 298 299 struct lead_measurement_block 300 { 301 uint16_t ID; 302 int16_t P_duration; 303 int16_t PR_interval; 304 int16_t QRS_duration; 305 int16_t QT_interval; 306 int16_t Q_duration; 307 int16_t R_duration; 308 int16_t S_duration; 309 int16_t R1_duration; 310 int16_t S1_duration; 311 int16_t Q_amplitude; 312 int16_t R_amplitude; 313 int16_t S_amplitude; 314 int16_t R1_amplitude; 315 int16_t S1_amplitude; 316 int16_t J_point_amplitude; 317 int16_t Pp_amplitude; 318 int16_t Pm_amplitude; 319 int16_t Tp_amplitude; 320 int16_t Tm_amplitude; 321 int16_t ST_slope; 322 int16_t P_morphology; 323 int16_t T_morphology; 324 int16_t iso_electric_segment_onset_QRS; 325 int16_t iso_electric_segment_offset_QRS; 326 int16_t intrinsicoid_deflection; 327 uint16_t quality_recording[8]; 328 int16_t ST_amplitude_Jplus20; 329 int16_t ST_amplitude_Jplus60; 330 int16_t ST_amplitude_Jplus80; 331 int16_t ST_amplitude_JplusRR16; 332 int16_t ST_amplitude_JplusRR8; 333 }; 334 335 struct statement_coded 336 { 337 uint8_t sequence_number; 338 uint16_t length; 339 uint8_t type; 340 uint16_t number_field; 341 }; 342 343 //_____________________________________ 344 //structs for sections: 2, 3, 4, 5, 6 345 //_____________________________________ 346 struct DATA_DECODE 347 { 348 struct table_H *t_Huffman; 349 uint16_t *flag_Huffman; 350 351 struct lead *data_lead; 352 struct f_lead flag_lead; 353 354 struct Protected_Area *data_protected; 355 struct Subtraction_Zone *data_subtraction; 356 357 struct f_BdR0 flag_BdR0; 358 uint16_t *length_BdR0; 359 uint8_t *samples_BdR0; 360 int32_t *Median; 361 362 struct f_Res flag_Res; 363 uint16_t *length_Res; 364 uint8_t *samples_Res; 365 int32_t *Residual; 366 367 int32_t *Reconstructed; 368 }; 369 370 struct TREE_NODE 371 //struttura di un nodo dell'albero 372 { 373 struct TREE_NODE *next_0; 374 struct TREE_NODE *next_1; 375 int16_t row; 376 }; 377 378 //_____________________________________ 379 //structs for sections: 7, 10 380 //_____________________________________ 381 struct DATA_RECORD 382 { 383 struct global_measurement data_global; 384 struct spike *data_spike; 385 uint8_t *type_BdR; 386 struct BdR_measurement *data_BdR; 387 struct additional_measurement *data_additional; 388 389 struct header_lead_measurement header_lead; 390 struct lead_measurement_block *lead_block; 391 }; 392 393 //_____________________________________ 394 //structs for sections: 1, 8, 11 395 //_____________________________________ 396 struct DATA_INFO 397 { 398 struct demographic ana; 399 struct clinic cli; 400 struct descriptive des; 401 struct device dev; 402 403 struct info flag_report; 404 struct numeric *text_dim; 405 char *text_report; 406 407 struct info flag_statement; 408 struct statement_coded *data_statement; 409 char *text_statement; 410 }; 411 412 #endif /*__STRUCTURES_H__*/ 413 //_____________________________________ 414