24 if(h1==NULL || h2==NULL)
return(1);
102 if(h1==NULL || h2==NULL)
return(1);
105 for(i=0; i<126; i++) h2->
fill1[i]=h1->
fill1[i];
131 for(i=0; i<22; i++) h2->
fill2[i]=h1->
fill2[i];
154 if(verbose>0) printf(
"ecat63EditMHeader('%s', '%s')\n", field, value);
155 si=atoi(value); f=atof(value);
157 if(strcmp(field,
"ecat_format")==0 || strcmp(field,
"magic_number")==0) {
159 }
else if(strcmp(field,
"fill1")==0) {
161 }
else if(strcmp(field,
"original_file_name")==0) {
163 }
else if(strcmp(field,
"sw_version")==0) {
165 }
else if(strcmp(field,
"data_type")==0) {
166 if(si<0)
return(2);
else h->
data_type=si;
167 }
else if(strcmp(field,
"system_type")==0) {
169 }
else if(strcmp(field,
"file_type")==0) {
170 if(si<0)
return(2);
else h->
file_type=si;
171 }
else if(strcmp(field,
"node_id")==0 || strcmp(field,
"serial_number")==0) {
173 }
else if(strcmp(field,
"scan_start_day")==0) {
175 }
else if(strcmp(field,
"scan_start_month")==0) {
177 }
else if(strcmp(field,
"scan_start_year")==0) {
179 }
else if(strcmp(field,
"scan_start_hour")==0) {
181 }
else if(strcmp(field,
"scan_start_minute")==0) {
183 }
else if(strcmp(field,
"scan_start_second")==0) {
185 }
else if(strcmp(field,
"scan_start_time")==0) {
186 int YYYY, MM, DD, hh, mm, ss, n;
187 n=sscanf(value,
"%d-%d-%d %d:%d:%d", &YYYY, &MM, &DD, &hh, &mm, &ss);
188 if(n!=6 && n!=3)
return(2);
197 }
else if(strcmp(field,
"isotope_code")==0 || strcmp(field,
"isotope_name")==0) {
199 }
else if(strcmp(field,
"isotope_halflife")==0) {
201 }
else if(strcmp(field,
"radiopharmaceutical")==0) {
203 }
else if(strcmp(field,
"gantry_tilt")==0) {
205 }
else if(strcmp(field,
"gantry_rotation")==0) {
207 }
else if(strcmp(field,
"bed_elevation")==0) {
209 }
else if(strcmp(field,
"rot_source_speed")==0) {
211 }
else if(strcmp(field,
"wobble_speed")==0) {
213 }
else if(strcmp(field,
"transm_source_type")==0) {
215 }
else if(strcmp(field,
"axial_fov")==0) {
217 }
else if(strcmp(field,
"transaxial_fov")==0) {
219 }
else if(strcmp(field,
"transaxial_samp_mode")==0) {
221 }
else if(strcmp(field,
"coin_samp_mode")==0) {
223 }
else if(strcmp(field,
"axial_samp_mode")==0) {
225 }
else if(strcmp(field,
"calibration_factor")==0) {
227 }
else if(strcmp(field,
"calibration_units")==0) {
229 }
else if(strcmp(field,
"compression_code")==0) {
231 }
else if(strcmp(field,
"study_name")==0) {
233 }
else if(strcmp(field,
"patient_id")==0) {
235 }
else if(strcmp(field,
"patient_name")==0) {
237 }
else if(strcmp(field,
"patient_sex")==0) {
239 }
else if(strcmp(field,
"patient_age")==0) {
241 }
else if(strcmp(field,
"patient_height")==0) {
243 }
else if(strcmp(field,
"patient_weight")==0) {
245 }
else if(strcmp(field,
"patient_dexterity")==0) {
247 }
else if(strcmp(field,
"physician_name")==0) {
249 }
else if(strcmp(field,
"operator_name")==0) {
251 }
else if(strcmp(field,
"study_description")==0) {
253 }
else if(strcmp(field,
"acquisition_type")==0) {
255 }
else if(strcmp(field,
"bed_type")==0) {
257 }
else if(strcmp(field,
"septa_type")==0) {
259 }
else if(strcmp(field,
"facility_name")==0) {
261 }
else if(strcmp(field,
"num_planes")==0) {
263 }
else if(strcmp(field,
"num_frames")==0) {
265 }
else if(strcmp(field,
"num_gates")==0) {
267 }
else if(strcmp(field,
"num_bed_pos")==0) {
269 }
else if(strcmp(field,
"init_bed_position")==0) {
271 }
else if(strcmp(field,
"bed_offset")==0) {
272 sscanf(value,
"%f %f %f %f %f %f %f %f %f %f %f %f %f %f %f",
279 }
else if(strcmp(field,
"plane_separation")==0) {
281 }
else if(strcmp(field,
"lwr_sctr_thres")==0) {
283 }
else if(strcmp(field,
"lwr_true_thres")==0) {
285 }
else if(strcmp(field,
"upr_true_thres")==0) {
287 }
else if(strcmp(field,
"collimator")==0) {
289 }
else if(strcmp(field,
"user_process_code")==0) {
291 }
else if(strcasecmp(field,
"FILL2")==0) {
293 cptr=strtok(value,
" \t,;\n\r");
294 for(
int i=0; i<20; i++) {
295 if(cptr==NULL)
break;
296 h->
fill2[i]=(
short int)atoi(cptr);
297 cptr=strtok(NULL,
" \t,;\n\r");
int ecat63EditMHeader(ECAT63_mainheader *h, char *field, char *value, int verbose)
int ecat63CopyMainheader(ECAT63_mainheader *h1, ECAT63_mainheader *h2)
int ecat63CopyScanheader(ECAT63_scanheader *h1, ECAT63_scanheader *h2)
Header file for libtpcimgio.
size_t strlcpy(char *dst, const char *src, size_t dstsize)
char radiopharmaceutical[32]
short int scan_start_month
short int compression_code
short int scan_start_second
short int transaxial_samp_mode
short int rot_source_speed
short int acquisition_type
short int calibration_units
short int scan_start_year
char original_file_name[20]
char study_description[32]
short int transm_source_type
short int scan_start_minute
char user_process_code[10]
short int axial_samp_mode
short int scan_start_hour