30 if(verbose>0) printf(
"ecat7EditMHeader('%s', '%s')\n", field, value);
31 si=atoi(value); f=atof(value);
32 if(strcmp(field,
"magic_number")==0) {
34 }
else if(strcmp(field,
"original_file_name")==0) {
36 }
else if(strcmp(field,
"sw_version")==0) {
38 }
else if(strcmp(field,
"system_type")==0) {
40 }
else if(strcmp(field,
"file_type")==0) {
42 }
else if(strcmp(field,
"serial_number")==0) {
44 }
else if(strcmp(field,
"scan_start_time")==0) {
48 if(verbose>3) printf(
" year=%d\n", stm.tm_year);
49 if(verbose>1) printf(
" hour=%d\n", stm.tm_hour);
61 }
else if(strcmp(field,
"isotope_name")==0) {
63 }
else if(strcmp(field,
"isotope_halflife")==0) {
65 }
else if(strcmp(field,
"radiopharmaceutical")==0) {
67 }
else if(strcmp(field,
"gantry_tilt")==0) {
69 }
else if(strcmp(field,
"gantry_rotation")==0) {
71 }
else if(strcmp(field,
"bed_elevation")==0) {
73 }
else if(strcmp(field,
"intrinsic_tilt")==0) {
75 }
else if(strcmp(field,
"wobble_speed")==0) {
77 }
else if(strcmp(field,
"transm_source_type")==0) {
79 }
else if(strcmp(field,
"distance_scanned")==0) {
81 }
else if(strcmp(field,
"transaxial_fov")==0) {
83 }
else if(strcmp(field,
"angular_compression")==0) {
85 }
else if(strcmp(field,
"coin_samp_mode")==0) {
87 }
else if(strcmp(field,
"axial_samp_mode")==0) {
89 }
else if(strcmp(field,
"ecat_calibration_factor")==0) {
91 }
else if(strcmp(field,
"calibration_units")==0) {
93 }
else if(strcmp(field,
"calibration_units_label")==0) {
95 }
else if(strcmp(field,
"compression_code")==0) {
97 }
else if(strcmp(field,
"study_type")==0) {
99 }
else if(strcmp(field,
"patient_id")==0) {
101 }
else if(strcmp(field,
"patient_name")==0) {
103 }
else if(strcmp(field,
"patient_sex")==0) {
105 }
else if(strcmp(field,
"patient_dexterity")==0) {
107 }
else if(strcmp(field,
"patient_age")==0) {
109 }
else if(strcmp(field,
"patient_height")==0) {
111 }
else if(strcmp(field,
"patient_weight")==0) {
113 }
else if(strcmp(field,
"patient_birth_date")==0) {
116 timet=time(NULL);
gmtime_r(&timet, &st);
117 if(sscanf(value,
"%d-%d-%d", &yy, &mm, &dd)!=3)
return(2);
118 st.tm_mday=dd; st.tm_mon=mm-1; st.tm_year=yy-1900;
119 st.tm_hour=12; st.tm_min=0; st.tm_sec=0; st.tm_isdst=-1;
121 }
else if(strcmp(field,
"physician_name")==0) {
123 }
else if(strcmp(field,
"operator_name")==0) {
125 }
else if(strcmp(field,
"study_description")==0) {
127 }
else if(strcmp(field,
"acquisition_type")==0) {
129 }
else if(strcmp(field,
"patient_orientation")==0) {
131 }
else if(strcmp(field,
"facility_name")==0) {
133 }
else if(strcmp(field,
"num_planes")==0) {
135 }
else if(strcmp(field,
"num_frames")==0) {
137 }
else if(strcmp(field,
"num_gates")==0) {
139 }
else if(strcmp(field,
"num_bed_pos")==0) {
141 }
else if(strcmp(field,
"init_bed_position")==0) {
143 }
else if(strcmp(field,
"bed_position")==0) {
144 sscanf(value,
"%f %f %f %f %f %f %f %f %f %f %f %f %f %f %f",
151 }
else if(strcmp(field,
"plane_separation")==0) {
153 }
else if(strcmp(field,
"lwr_sctr_thres")==0) {
155 }
else if(strcmp(field,
"lwr_true_thres")==0) {
157 }
else if(strcmp(field,
"upr_true_thres")==0) {
159 }
else if(strcmp(field,
"user_process_code")==0) {
161 }
else if(strcmp(field,
"acquisition_mode")==0) {
163 }
else if(strcmp(field,
"bin_size")==0) {
165 }
else if(strcmp(field,
"branching_fraction")==0) {
167 }
else if(strcmp(field,
"dose_start_time")==0) {
171 }
else if(strcmp(field,
"dosage")==0) {
173 }
else if(strcmp(field,
"well_counter_corr_factor")==0) {
175 }
else if(strcmp(field,
"data_units")==0) {
177 }
else if(strcmp(field,
"septa_state")==0) {
179 }
else if(strncasecmp(field,
"FILL_CTI", 8)==0) {
181 cptr=strtok(value,
" \t,;\n\r");
182 for(
int i=0; i<6; i++) {
183 if(cptr==NULL)
break;
184 h->
fill_cti[i]=(
short int)atoi(cptr);
185 cptr=strtok(NULL,
" \t,;\n\r");
214 if(verbose>0) printf(
"ecat7EditSHeader('%s', '%s')\n", field, value);
216 si=atoi(value); ii=atoi(value); f=atof(value);
218 if(strcasecmp(field,
"DATA_TYPE")==0) {
220 }
else if(strcasecmp(field,
"NUM_DIMENSIONS")==0) {
222 }
else if(strcasecmp(field,
"NUM_R_ELEMENTS")==0) {
224 }
else if(strcasecmp(field,
"NUM_ANGLES")==0) {
226 }
else if(strcasecmp(field,
"CORRECTIONS_APPLIED")==0) {
228 }
else if(strncasecmp(field,
"NUM_Z_ELEMENTS", 14)==0) {
229 cptr=strtok(value,
" \t,;\n\r");
230 for(i=0; i<64; i++) {
231 if(cptr==NULL)
break;
233 cptr=strtok(NULL,
" \t,;\n\r");
235 }
else if(strcasecmp(field,
"RING_DIFFERENCE")==0) {
237 }
else if(strcasecmp(field,
"STORAGE_ORDER")==0) {
239 }
else if(strcasecmp(field,
"AXIAL_COMPRESSION")==0) {
241 }
else if(strcasecmp(field,
"X_RESOLUTION")==0) {
243 }
else if(strcasecmp(field,
"V_RESOLUTION")==0) {
245 }
else if(strcasecmp(field,
"Z_RESOLUTION")==0) {
247 }
else if(strcasecmp(field,
"W_RESOLUTION")==0) {
249 }
else if(strncasecmp(field,
"FILL_GATE", 9)==0) {
250 cptr=strtok(value,
" \t,;\n\r");
252 if(cptr==NULL)
break;
254 cptr=strtok(NULL,
" \t,;\n\r");
256 }
else if(strcasecmp(field,
"GATE_DURATION")==0) {
258 }
else if(strcasecmp(field,
"R_WAVE_OFFSET")==0) {
260 }
else if(strcasecmp(field,
"NUM_ACCEPTED_BEATS")==0) {
262 }
else if(strcasecmp(field,
"SCALE_FACTOR")==0) {
264 }
else if(strcasecmp(field,
"SCAN_MIN")==0) {
266 }
else if(strcasecmp(field,
"SCAN_MAX")==0) {
268 }
else if(strcasecmp(field,
"PROMPTS")==0) {
270 }
else if(strcasecmp(field,
"DELAYED")==0) {
272 }
else if(strcasecmp(field,
"MULTIPLES")==0) {
274 }
else if(strcasecmp(field,
"NET_TRUES")==0) {
276 }
else if(strcasecmp(field,
"TOT_AVG_COR")==0) {
278 }
else if(strcasecmp(field,
"TOT_AVG_UNCOR")==0) {
280 }
else if(strcasecmp(field,
"TOTAL_COIN_RATE")==0) {
282 }
else if(strcasecmp(field,
"FRAME_START_TIME")==0) {
284 }
else if(strcasecmp(field,
"FRAME_DURATION")==0) {
286 }
else if(strcasecmp(field,
"DEADTIME_CORRECTION_FACTOR")==0) {
288 }
else if(strncasecmp(field,
"FILL_CTI", 8)==0) {
289 cptr=strtok(value,
" \t,;\n\r");
290 for(i=0; i<90; i++) {
291 if(cptr==NULL)
break;
292 h->
fill_cti[i]=(
short int)atoi(cptr);
293 cptr=strtok(NULL,
" \t,;\n\r");
295 }
else if(strncasecmp(field,
"FILL_USER", 9)==0) {
296 cptr=strtok(value,
" \t,;\n\r");
297 for(i=0; i<50; i++) {
298 if(cptr==NULL)
break;
300 cptr=strtok(NULL,
" \t,;\n\r");
302 }
else if(strncasecmp(field,
"UNCOR_SINGLES", 13)==0) {
303 cptr=strtok(value,
" \t,;\n\r");
304 for(i=0; i<128; i++) {
305 if(cptr==NULL)
break;
307 cptr=strtok(NULL,
" \t,;\n\r");
334 if(verbose>0) printf(
"ecat7EditVHeader('%s', '%s')\n", field, value);
336 si=atoi(value); ii=atoi(value); f=atof(value);
338 if(strcasecmp(field,
"DATA_TYPE")==0) {
340 }
else if(strcasecmp(field,
"NUM_DIMENSIONS")==0) {
342 }
else if(strcasecmp(field,
"X_DIMENSION")==0) {
344 }
else if(strcasecmp(field,
"Y_DIMENSION")==0) {
346 }
else if(strcasecmp(field,
"Z_DIMENSION")==0) {
348 }
else if(strcasecmp(field,
"X_OFFSET")==0) {
350 }
else if(strcasecmp(field,
"Y_OFFSET")==0) {
352 }
else if(strcasecmp(field,
"Z_OFFSET")==0) {
354 }
else if(strcasecmp(field,
"RECON_ZOOM")==0) {
356 }
else if(strcasecmp(field,
"SCALE_FACTOR")==0) {
358 }
else if(strcasecmp(field,
"IMAGE_MIN")==0) {
360 }
else if(strcasecmp(field,
"IMAGE_MAX")==0) {
362 }
else if(strcasecmp(field,
"X_PIXEL_SIZE")==0) {
364 }
else if(strcasecmp(field,
"Y_PIXEL_SIZE")==0) {
366 }
else if(strcasecmp(field,
"Z_PIXEL_SIZE")==0) {
368 }
else if(strcasecmp(field,
"FRAME_DURATION")==0) {
370 }
else if(strcasecmp(field,
"FRAME_START_TIME")==0) {
372 }
else if(strcasecmp(field,
"FILTER_CODE")==0) {
374 }
else if(strcasecmp(field,
"X_RESOLUTION")==0) {
376 }
else if(strcasecmp(field,
"Y_RESOLUTION")==0) {
378 }
else if(strcasecmp(field,
"Z_RESOLUTION")==0) {
380 }
else if(strcasecmp(field,
"NUM_R_ELEMENTS")==0) {
382 }
else if(strcasecmp(field,
"NUM_ANGLES")==0) {
384 }
else if(strcasecmp(field,
"Z_ROTATION_ANGLE")==0) {
386 }
else if(strcasecmp(field,
"DECAY_CORR_FCTR")==0) {
388 }
else if(strcasecmp(field,
"PROCESSING_CODE")==0) {
390 }
else if(strcasecmp(field,
"GATE_DURATION")==0) {
392 }
else if(strcasecmp(field,
"R_WAVE_OFFSET")==0) {
394 }
else if(strcasecmp(field,
"NUM_ACCEPTED_BEATS")==0) {
396 }
else if(strcasecmp(field,
"FILTER_CUTOFF_FREQUENCY")==0) {
398 }
else if(strcasecmp(field,
"FILTER_RESOLUTION")==0) {
400 }
else if(strcasecmp(field,
"FILTER_RAMP_SLOPE")==0) {
402 }
else if(strcasecmp(field,
"FILTER_ORDER")==0) {
404 }
else if(strcasecmp(field,
"FILTER_SCATTER_FRACTION")==0) {
406 }
else if(strcasecmp(field,
"FILTER_SCATTER_SLOPE")==0) {
408 }
else if(strcasecmp(field,
"ANNOTATION")==0) {
410 }
else if(strcasecmp(field,
"MT_1_1")==0) {
412 }
else if(strcasecmp(field,
"MT_1_2")==0) {
414 }
else if(strcasecmp(field,
"MT_1_3")==0) {
416 }
else if(strcasecmp(field,
"MT_2_1")==0) {
418 }
else if(strcasecmp(field,
"MT_2_2")==0) {
420 }
else if(strcasecmp(field,
"MT_2_3")==0) {
422 }
else if(strcasecmp(field,
"MT_3_1")==0) {
424 }
else if(strcasecmp(field,
"MT_3_2")==0) {
426 }
else if(strcasecmp(field,
"MT_3_3")==0) {
428 }
else if(strcasecmp(field,
"RFILTER_CUTOFF")==0) {
430 }
else if(strcasecmp(field,
"RFILTER_RESOLUTION")==0) {
432 }
else if(strcasecmp(field,
"RFILTER_CODE")==0) {
434 }
else if(strcasecmp(field,
"RFILTER_ORDER")==0) {
436 }
else if(strcasecmp(field,
"ZFILTER_CUTOFF")==0) {
438 }
else if(strcasecmp(field,
"ZFILTER_RESOLUTION")==0) {
440 }
else if(strcasecmp(field,
"ZFILTER_CODE")==0) {
442 }
else if(strcasecmp(field,
"ZFILTER_ORDER")==0) {
444 }
else if(strcasecmp(field,
"MT_1_4")==0) {
446 }
else if(strcasecmp(field,
"MT_2_4")==0) {
448 }
else if(strcasecmp(field,
"MT_3_4")==0) {
450 }
else if(strcasecmp(field,
"SCATTER_TYPE")==0) {
452 }
else if(strcasecmp(field,
"RECON_TYPE")==0) {
454 }
else if(strcasecmp(field,
"RECON_VIEWS")==0) {
456 }
else if(strncasecmp(field,
"FILL_CTI", 8)==0) {
458 cptr=strtok(value,
" \t,;\n\r");
459 for(
int i=0; i<87; i++) {
460 if(cptr==NULL)
break;
461 h->
fill_cti[i]=(
short int)atoi(cptr);
462 cptr=strtok(NULL,
" \t,;\n\r");
464 }
else if(strncasecmp(field,
"FILL_USER", 9)==0) {
466 cptr=strtok(value,
" \t,;\n\r");
467 for(
int i=0; i<50; i++) {
468 if(cptr==NULL)
break;
470 cptr=strtok(NULL,
" \t,;\n\r");
int get_datetime(char *str, struct tm *date, int verbose)
time_t timegm(struct tm *tm)
Inverse of gmtime, converting struct tm to time_t.
struct tm * gmtime_r(const time_t *t, struct tm *tm)
Convert time_t to GMT struct tm.
int ecat7EditMHeader(ECAT7_mainheader *h, char *field, char *value, int verbose)
int ecat7EditSHeader(ECAT7_scanheader *h, char *field, char *value, int verbose)
int ecat7EditVHeader(ECAT7_imageheader *h, char *field, char *value, int verbose)
Header file for libtpcimgio.
size_t strlcpy(char *dst, const char *src, size_t dstsize)
short int compression_code
float well_counter_corr_factor
char user_process_code[10]
short int angular_compression
short int calibration_units
short int acquisition_mode
short int calibration_units_label
float ecat_calibration_factor
short int transm_source_type
short int acquisition_type
char study_description[32]
short int axial_samp_mode
char radiopharmaceutical[32]
short int patient_orientation
char original_file_name[32]