TPCCLIB
Loading...
Searching...
No Matches
ecattime.c
Go to the documentation of this file.
1
8/*****************************************************************************/
9#include "tpcclibConfig.h"
10/*****************************************************************************/
11#include <stdio.h>
12#include <stdlib.h>
13#include <unistd.h>
14#include <math.h>
15#include <string.h>
16#include <ctype.h>
17#include <time.h>
18/*****************************************************************************/
19#include "libtpcmisc.h"
20#include "libtpcimgio.h"
21/*****************************************************************************/
22
23/*****************************************************************************/
24static char *info[] = {
25 "Change the scan_start_time and time frames in ECAT image or sinogram file",
26 "to refer to the injection time instead of the original delayed",
27 "scan_start_time. Correction for physical decay is changed accordingly",
28 "in images, but not in sinograms.",
29 " ",
30 "Before using this program, PET image must be decay corrected to its",
31 "scan_start_time, but sinogram must not be corrected for decay.",
32 "Please make backup of the original files before using this program.",
33 " ",
34 "Do not use this program for catenation of images; use ecatcat instead.",
35 " ",
36 "Usage: @P [Options] ecatfile [time]",
37 " ",
38 "Optional time is either the time (min) from radiotracer injection",
39 "to the PET scan start time, or, the new scan start time.",
40 "If time is not entered, then program makes no changes to the data, but",
41 "just displays the current scan_start_time and time when the collection of",
42 "the first frame was started.",
43 " ",
44 "Options:",
45 " -stdoptions", // List standard options like --help, -v, etc
46 " ",
47 "Example 1. PET scan is known to have started 30.2 min after tracer injection.",
48 "Times and decay will be corrected to the new scan start time:",
49 " @P s2345dy1.v 30.2",
50 "Example 2. Injection time was 14:00:49, and PET times and decay will be",
51 "corrected to this new scan start time:",
52 " @P s2345dy1.v 14:00:49",
53 " ",
54 "See also: imgdecay, eframe, ecatcat, egetstrt, esetstrt, imgunit",
55 " ",
56 "Keywords: ECAT, image, physical decay, modelling",
57 0};
58/*****************************************************************************/
59
60/*****************************************************************************/
61/* Turn on the globbing of the command line, since it is disabled by default in
62 mingw-w64 (_dowildcard=0); in MinGW32 define _CRT_glob instead, if necessary;
63 In Unix&Linux wildcard command line processing is enabled by default. */
64/*
65#undef _CRT_glob
66#define _CRT_glob -1
67*/
68int _dowildcard = -1;
69/*****************************************************************************/
70
71/*****************************************************************************/
75int main(int argc, char **argv)
76{
77 int ai, help=0, version=0, verbose=1;
78 int ret, m;
79 int fformat=63;
80 int matrixNr, is_image=1;
81 int mode=0; /* 0=just printing, 1=change time with time
82 difference, 2=change time with new start time */
83 char ctifile[FILENAME_MAX], newtime[256], tmp[128], *cptr;
84 FILE *fp;
85 ECAT63_mainheader e63mhdr;
86 ECAT7_mainheader e7mhdr;
87 MATRIXLIST e63mlist;
88 ECAT7_MATRIXLIST e7mlist;
89 ECAT63_imageheader e63ihdr;
90 ECAT7_imageheader e7ihdr;
91 ECAT63_scanheader e63shdr;
92 ECAT7_scanheader e7shdr3d;
93 ECAT7_2Dscanheader e7shdr2d;
94 int hh=-1, mm=-1, ss=-1;
95 int frame_start_time, first_frame_start_time;
96 float decayf, isotope_halflife;
97 double diftime=nan("");
98 double starttime, injtime;
99 struct tm stm;
100
101
102 /*
103 * Get arguments
104 */
105 if(argc==1) {tpcPrintUsage(argv[0], info, stderr); return(1);}
106 ctifile[0]=newtime[0]=(char)0;
107 ecat63InitMatlist(&e63mlist); ecat7InitMatlist(&e7mlist);
108 /* Options */
109 for(ai=1; ai<argc; ai++) if(*argv[ai]=='-') { /* options */
110 cptr=argv[ai]+1; if(*cptr=='-') cptr++; if(cptr==NULL) continue;
111 if(tpcProcessStdOptions(argv[ai], &help, &version, &verbose)==0) continue;
112 fprintf(stderr, "Error: invalid option '%s'.\n", argv[ai]);
113 return(1);
114 } else break;
115
116 /* Print help or version? */
117 if(help==2) {tpcHtmlUsage(argv[0], info, ""); return(0);}
118 if(help) {tpcPrintUsage(argv[0], info, stdout); return(0);}
119 if(version) {tpcPrintBuild(argv[0], stdout); return(0);}
120
121 /* First argument is the filename */
122 if(ai<argc) {
123 /* check that file exists */
124 if(access(argv[ai], 0) == -1) {
125 fprintf(stderr, "Error: file '%s' does not exist.\n", argv[ai]);
126 return(1);
127 }
128 strcpy(ctifile, argv[ai]); ai++;
129 }
130
131 /* If there is argument, then that is the time or time difference */
132 if(ai<argc) {
133 strlcpy(newtime, argv[ai], 256); ai++;
134 mode=1; // file is to be changed, by default with time difference
135 }
136
137 /* If there is still an argument, then that is an error */
138 if(ai<argc) {
139 fprintf(stderr, "Error: invalid argument %s\n", argv[ai]);
140 return(1);
141 }
142
143 /* Is something missing? */
144 if(!ctifile[0]) {
145 fprintf(stderr, "Error: missing command-line argument; try %s --help\n",
146 argv[0]);
147 return(1);
148 }
149
150 /* Try to make sense of the time */
151 if(mode>0) {
152 /* Try to read scan start time */
153 ret=istime(newtime);
154 if(ret==0) {
155 /* Ok it is valid time string */
156 sscanf(newtime, "%d:%d:%d", &hh, &mm, &ss);
157 diftime=nan(""); mode=2;
158 } else {
159 /* Try to read time difference */
160 ret=atof_with_check(newtime, &diftime);
161 if(ret==0) diftime*=-60.0;
162 if(ret!=0 || diftime==0) {
163 fprintf(stderr, "Error: invalid time difference.\n");
164 return(1);
165 }
166 strcpy(newtime, "");
167 }
168 }
169
170 /* In verbose mode print arguments and options */
171 if(verbose>1) {
172 printf("ctifile := %s\n", ctifile);
173 printf("mode := %d\n", mode);
174 if(mode==1) printf("diftime := %g\n", diftime);
175 if(mode==2)
176 printf("required_scan_start_time := %02d:%02d:%02d\n", hh, mm, ss);
177 fflush(stdout);
178 }
179
180
181 /*
182 * Open file (depending on mode for read, or for read&write)
183 */
184 if(verbose>1) printf("opening file %s\n", ctifile);
185 if(mode==0) fp=fopen(ctifile, "rb"); else fp=fopen(ctifile, "r+b");
186 if(fp == NULL) {
187 fprintf(stderr, "Error: cannot open file %s\n", ctifile);
188 return(2);
189 }
190
191 /*
192 * Read main header
193 */
194 if(verbose>2) printf("reading main header in file %s\n", ctifile);
195 /* Try to read ECAT 7.x main header */
196 ret=ecat7ReadMainheader(fp, &e7mhdr);
197 if(ret) {
198 fprintf(stderr, "Error (%d): cannot read main header.\n", ret);
199 fclose(fp); return(3);
200 }
201 /* If header could be read, check for the magic number */
202 if(strncmp(e7mhdr.magic_number, ECAT7V_MAGICNR, 7)==0) {
203 /* This is an ECAT 7.x file */
204 fformat=7;
205 /* Check if file type is supported */
206 if(e7mhdr.file_type!=ECAT7_VOLUME8 &&
207 e7mhdr.file_type!=ECAT7_VOLUME16 &&
208 e7mhdr.file_type!=ECAT7_IMAGE8 &&
209 e7mhdr.file_type!=ECAT7_IMAGE16 &&
210 e7mhdr.file_type!=ECAT7_2DSCAN &&
211 e7mhdr.file_type!=ECAT7_3DSCAN8 &&
212 e7mhdr.file_type!=ECAT7_3DSCAN
213 ) {
214 fprintf(stderr, "Error: illegal file_type in %s\n", ctifile);
215 fclose(fp); return(4);
216 }
217 } else { /* Try to read as ECAT 6.3 file */
218 if((ret=ecat63ReadMainheader(fp, &e63mhdr))) {
219 fprintf(stderr, "Error (%d): cannot read main header.\n", ret);
220 fclose(fp); return(3);
221 }
222 if(verbose>20) ecat63PrintMainheader(&e63mhdr, stdout);
223 /* Check file type */
224 if(e63mhdr.file_type!=IMAGE_DATA &&
225 e63mhdr.file_type!=RAW_DATA) {
226 fprintf(stderr, "Error: illegal file_type in %s\n", ctifile);
227 fclose(fp); return(4);
228 }
229 /* This is ECAT 6.3 file */
230 fformat=63;
231 }
232 if(verbose>1) printf("%s is identified as ECAT %d\n", ctifile, fformat);
233
234 /*
235 * Read and print original scanning start time
236 */
237 injtime=0.0;
238 if(fformat==7) {
239 /* ECAT 7 main header contains scan_start_time as time_t */
240 time_t t=e7mhdr.scan_start_time;
241 if(!gmtime_r(&t, &stm) || !strftime(tmp, 32, "%Y-%m-%d %H:%M:%S", &stm)) {
242 fprintf(stderr, "Error: invalid scan_start_time in %s\n", ctifile);
243 fclose(fp); return(5);
244 }
245 injtime=stm.tm_sec+60*stm.tm_min+3600*stm.tm_hour;
246 } else {
247 /* ECAT 6 main header contains years, months etc as separate numbers */
248 if(!ecat63ScanstarttimeInt(&e63mhdr, tmp)) {
249 fprintf(stderr, "Error: invalid scan_start_time in %s\n", ctifile);
250 fclose(fp); return(5);
251 }
252 injtime=e63mhdr.scan_start_second + 60.0*e63mhdr.scan_start_minute +
253 3600*e63mhdr.scan_start_hour;
254 }
255 if(mode==0 || verbose>0) fprintf(stdout, " scan_start_time := %s\n", tmp);
256 if(verbose>2) fprintf(stdout, "injtime=%g\n", injtime);
257
258
259 /*
260 * Read matrix list and nr
261 */
262 if(verbose>2) fprintf(stdout, " reading matrix list...\n");
263 if(fformat==63) ret=ecat63ReadMatlist(fp, &e63mlist, verbose-2);
264 else ret=ecat7ReadMatlist(fp, &e7mlist, verbose-2);
265 if(ret) {
266 fprintf(stderr, "Error (%d): cannot read matrix list.\n", ret);
267 fclose(fp); return(5);
268 }
269 if((fformat==63 && e63mlist.matrixNr<=0) ||
270 (fformat==7 && e7mlist.matrixNr<=0)) {
271 fprintf(stderr, "Error: matrix list is empty.\n");
272 ecat63EmptyMatlist(&e63mlist); ecat7EmptyMatlist(&e7mlist);
273 fclose(fp); return(5);
274 }
275 if(verbose>10) {
276 if(fformat==63) ecat63PrintMatlist(&e63mlist);
277 else ecat7PrintMatlist(&e7mlist);
278 }
279
280 /*
281 * Read and print the smallest frame start time
282 */
283 if(verbose>2) printf("searching for the earliest frame start time\n");
284 /* Find the smallest frame start time */
285 first_frame_start_time=frame_start_time=0;
286 if(fformat==63) matrixNr=e63mlist.matrixNr;
287 else matrixNr=e7mlist.matrixNr;
288 if(verbose>2) printf("reading subheaders\n");
289 for(m=0; m<matrixNr; m++) {
290 if(fformat==63) {
291 if(e63mhdr.file_type==IMAGE_DATA) {
292 is_image=1;
293 ret=ecat63ReadImageheader(fp, e63mlist.matdir[m].strtblk, &e63ihdr, verbose-4, NULL);
294 frame_start_time=e63ihdr.frame_start_time;
295 } else if(e63mhdr.file_type==RAW_DATA) {
296 is_image=0;
297 ret=ecat63ReadScanheader(fp, e63mlist.matdir[m].strtblk, &e63shdr, verbose-4, NULL);
298 frame_start_time=e63shdr.frame_start_time;
299 }
300 if(ret) {
301 fprintf(stderr, "Error: cannot read matrix %u subheader in '%s'.\n",
302 e63mlist.matdir[m].matnum, ctifile);
303 ecat63EmptyMatlist(&e63mlist); ecat7EmptyMatlist(&e7mlist);
304 fclose(fp); return(6);
305 }
306 } else {
307 if(e7mhdr.file_type==ECAT7_VOLUME8 ||
308 e7mhdr.file_type==ECAT7_VOLUME16 ||
309 e7mhdr.file_type==ECAT7_IMAGE8 ||
310 e7mhdr.file_type==ECAT7_IMAGE16) {
311 is_image=1;
312 ret=ecat7ReadImageheader(fp, e7mlist.matdir[m].strtblk, &e7ihdr);
313 frame_start_time=e7ihdr.frame_start_time;
314 } else if(e7mhdr.file_type==ECAT7_2DSCAN) {
315 is_image=0;
316 ret=ecat7Read2DScanheader(fp, e7mlist.matdir[m].strtblk, &e7shdr2d);
317 frame_start_time=e7shdr2d.frame_start_time;
318 } else if(e7mhdr.file_type==ECAT7_3DSCAN8 ||
319 e7mhdr.file_type==ECAT7_3DSCAN) {
320 is_image=0;
321 ret=ecat7ReadScanheader(fp, e7mlist.matdir[m].strtblk, &e7shdr3d);
322 frame_start_time=e7shdr3d.frame_start_time;
323 }
324 if(ret) {
325 fprintf(stderr, "Error: cannot read matrix %u subheader in '%s'.\n",
326 e7mlist.matdir[m].id, ctifile);
327 ecat63EmptyMatlist(&e63mlist); ecat7EmptyMatlist(&e7mlist);
328 fclose(fp); return(6);
329 }
330 }
331 if(m==0) {
332 first_frame_start_time=frame_start_time;
333 } else {
334 if(frame_start_time<first_frame_start_time)
335 first_frame_start_time=frame_start_time;
336 }
337 } /* next matrix */
338 /* Print it */
339 if(mode==0 || verbose>0)
340 fprintf(stdout, "First frame starts at %g min (%g s)\n",
341 (double)first_frame_start_time/60000.,
342 (double)first_frame_start_time/1000.
343 );
344
345 /*
346 * Quit, if times need not to be changed
347 */
348 if(mode==0) {
349 fclose(fp); ecat63EmptyMatlist(&e63mlist); ecat7EmptyMatlist(&e7mlist);
350 return(0);
351 }
352
353
354 /*
355 * Calculate diftime and new scan start time
356 */
357 if(mode==2) { // user gave new scan start time
358 diftime=(3600*hh+60*mm+ss)-injtime;
359 if(verbose>1) fprintf(stdout, "diftime := %d s\n", (int)diftime);
360 }
361 /* Check that time difference has not been corrected before */
362 if((first_frame_start_time>1000 &&
363 fabs(diftime+(first_frame_start_time/1000.))<15.0)
364 || fabs(diftime)<1.0 ) {
365 fprintf(stderr, "Error: times seem to be already corrected.\n");
366 fclose(fp); ecat63EmptyMatlist(&e63mlist); ecat7EmptyMatlist(&e7mlist);
367 return(8);
368 }
369 /* new scan time */
370 if(fformat==63) {
371 starttime=injtime+diftime;
372 if(verbose>1) fprintf(stdout, "new_starttime := %d s\n", (int)starttime);
373 hh=(int)floor(starttime/3600.0);
374 starttime-=3600*hh; mm=(int)floor(starttime/60.0);
375 starttime-=60*mm; ss=(int)floor(starttime);
376 e63mhdr.scan_start_hour=hh;
377 e63mhdr.scan_start_minute=mm;
378 e63mhdr.scan_start_second=ss;
379 } else {
380 e7mhdr.scan_start_time+=diftime;
381 }
382 ret=0;
383 if(fformat==7) {
384 time_t t=e7mhdr.scan_start_time;
385 if(!gmtime_r(&t, &stm) || !strftime(tmp, 32, "%Y-%m-%d %H:%M:%S", &stm))
386 ret++;
387 } else {
388 if(!ecat63ScanstarttimeInt(&e63mhdr, tmp)) ret++;
389 }
390 if(ret) {
391 fprintf(stderr, "Error: invalid scan_start_time after update\n");
392 ecat63EmptyMatlist(&e63mlist); ecat7EmptyMatlist(&e7mlist);
393 fclose(fp); return(6);
394 }
395 if(verbose>0) fprintf(stdout, " new_scan_start_time := %s\n", tmp);
396
397
398 /*
399 * Calculate decay correction factor for an image
400 */
401 if(is_image!=0) {
402 if(verbose>1) printf("computing decay correction\n");
403 if(fformat==63) isotope_halflife=e63mhdr.isotope_halflife;
404 else isotope_halflife=e7mhdr.isotope_halflife;
405 if(isotope_halflife<=0.0) {
406 fprintf(stderr, "Error: %s does not contain isotope half-life.\n",
407 ctifile);
408 fclose(fp); ecat63EmptyMatlist(&e63mlist); ecat7EmptyMatlist(&e7mlist);
409 return(10);
410 }
411 if(verbose>0)
412 fprintf(stdout, " isotope half-life: %g s\n", isotope_halflife);
413 decayf=exp(-M_LN2*diftime/isotope_halflife);
414 if(verbose>0)
415 fprintf(stdout, " common decay correction factor: %g\n", decayf);
416 } else
417 decayf=1.0;
418
419 /*
420 * Correct matrix subheaders
421 * -frame start time
422 * -change header decay factor only if it has been set previously
423 * -always correct the pixel values for decay (except sinograms)
424 */
425 if(verbose>1)
426 fprintf(stdout, " correcting the %d subheaders...\n", matrixNr);
427 for(m=0; m<matrixNr; m++) {
428 if(fformat==63) {
429 /* read and change */
430 if(e63mhdr.file_type==IMAGE_DATA) {
431 ret=ecat63ReadImageheader(fp, e63mlist.matdir[m].strtblk, &e63ihdr, verbose-4, NULL);
432 e63ihdr.frame_start_time-=(int)(1000.*diftime);
433 e63ihdr.quant_scale*=decayf;
434 if(e63ihdr.decay_corr_fctr>0.0 && e63ihdr.decay_corr_fctr!=1.0)
435 e63ihdr.decay_corr_fctr*=decayf;
436 } else if(e63mhdr.file_type==RAW_DATA) {
437 ret=ecat63ReadScanheader(fp, e63mlist.matdir[m].strtblk, &e63shdr, verbose-4, NULL);
438 e63shdr.frame_start_time-=(int)(1000.*diftime);
439 }
440 if(ret) {
441 fprintf(stderr, "Error: cannot read matrix %u subheader in '%s'.\n",
442 e63mlist.matdir[m].matnum, ctifile);
443 fclose(fp); ecat63EmptyMatlist(&e63mlist); ecat7EmptyMatlist(&e7mlist);
444 return(11);
445 }
446 /* write */
447 if(e63mhdr.file_type==IMAGE_DATA) {
448 ret=ecat63WriteImageheader(fp, e63mlist.matdir[m].strtblk, &e63ihdr);
449 } else if(e63mhdr.file_type==RAW_DATA) {
450 ret=ecat63WriteScanheader(fp, e63mlist.matdir[m].strtblk, &e63shdr);
451 }
452 if(ret) {
453 fprintf(stderr, "Error: cannot write matrix %u subheader in '%s'.\n",
454 e63mlist.matdir[m].matnum, ctifile);
455 fclose(fp); ecat63EmptyMatlist(&e63mlist); ecat7EmptyMatlist(&e7mlist);
456 return(21);
457 }
458
459 } else { // ECAT 7
460 /* read and change */
461 if(e7mhdr.file_type==ECAT7_VOLUME8 ||
462 e7mhdr.file_type==ECAT7_VOLUME16 ||
463 e7mhdr.file_type==ECAT7_IMAGE8 ||
464 e7mhdr.file_type==ECAT7_IMAGE16) {
465 ret=ecat7ReadImageheader(fp, e7mlist.matdir[m].strtblk, &e7ihdr);
466 e7ihdr.frame_start_time-=(int)(1000.*diftime);
467 e7ihdr.scale_factor*=decayf;
468 if(e7ihdr.decay_corr_fctr>0.0 && e7ihdr.decay_corr_fctr!=1.0)
469 e7ihdr.decay_corr_fctr*=decayf;
470 } else if(e7mhdr.file_type==ECAT7_2DSCAN) {
471 ret=ecat7Read2DScanheader(fp, e7mlist.matdir[m].strtblk, &e7shdr2d);
472 e7shdr2d.frame_start_time-=(int)(1000.*diftime);
473 } else if(e7mhdr.file_type==ECAT7_3DSCAN8 ||
474 e7mhdr.file_type==ECAT7_3DSCAN) {
475 ret=ecat7ReadScanheader(fp, e7mlist.matdir[m].strtblk, &e7shdr3d);
476 e7shdr3d.frame_start_time-=(int)(1000.*diftime);
477 }
478 if(ret) {
479 fprintf(stderr, "Error: cannot read matrix %u subheader in '%s'.\n",
480 e7mlist.matdir[m].id, ctifile);
481 fclose(fp); ecat7EmptyMatlist(&e7mlist); ecat63EmptyMatlist(&e63mlist);
482 return(11);
483 }
484 /* write */
485 if(e7mhdr.file_type==ECAT7_VOLUME8 ||
486 e7mhdr.file_type==ECAT7_VOLUME16 ||
487 e7mhdr.file_type==ECAT7_IMAGE8 ||
488 e7mhdr.file_type==ECAT7_IMAGE16) {
489 ret=ecat7WriteImageheader(fp, e7mlist.matdir[m].strtblk, &e7ihdr);
490 } else if(e7mhdr.file_type==ECAT7_2DSCAN) {
491 ret=ecat7Write2DScanheader(fp, e7mlist.matdir[m].strtblk, &e7shdr2d);
492 } else if(e7mhdr.file_type==ECAT7_3DSCAN8 ||
493 e7mhdr.file_type==ECAT7_3DSCAN) {
494 ret=ecat7WriteScanheader(fp, e7mlist.matdir[m].strtblk, &e7shdr3d);
495 }
496 if(ret) {
497 fprintf(stderr, "Error: cannot write matrix %u subheader in '%s'.\n",
498 e7mlist.matdir[m].id, ctifile);
499 fclose(fp); ecat7EmptyMatlist(&e7mlist); ecat63EmptyMatlist(&e63mlist);
500 return(21);
501 }
502 }
503 } /* next matrix */
504
505 /* Rewrite the main header */
506 if(verbose>1) fprintf(stdout, " rewriting corrected main header.\n");
507 if(fformat==63) ret=ecat63WriteMainheader(fp, &e63mhdr);
508 else ret=ecat7WriteMainheader(fp, &e7mhdr);
509 if(ret) {
510 fprintf(stderr, "Error: cannot write the mainheader.\n");
511 fclose(fp); ecat63EmptyMatlist(&e63mlist); ecat7EmptyMatlist(&e7mlist);
512 return(23);
513 }
514
515 if(verbose>0)
516 fprintf(stdout, " corrected mainheader and %d subheaders.\n", matrixNr);
517 fclose(fp);
518 ecat63EmptyMatlist(&e63mlist); ecat7EmptyMatlist(&e7mlist);
519
520 return(0);
521}
522/*****************************************************************************/
523
524/*****************************************************************************/
int istime(char *str)
Definition datetime.c:259
struct tm * gmtime_r(const time_t *t, struct tm *tm)
Convert time_t to GMT struct tm.
Definition datetime.c:22
int atof_with_check(char *double_as_string, double *result_value)
Definition decpoint.c:107
int ecat63ReadMatlist(FILE *fp, MATRIXLIST *ml, int verbose)
Definition ecat63ml.c:46
void ecat63InitMatlist(MATRIXLIST *mlist)
Definition ecat63ml.c:20
void ecat63EmptyMatlist(MATRIXLIST *mlist)
Definition ecat63ml.c:31
void ecat63PrintMatlist(MATRIXLIST *ml)
Definition ecat63ml.c:130
void ecat63PrintMainheader(ECAT63_mainheader *h, FILE *fp)
Definition ecat63p.c:16
char * ecat63ScanstarttimeInt(const ECAT63_mainheader *h, char *buf)
Convert scan_start_time in ECAT 6.3 main header into a null-terminated string of the form YYYY-MM-DD ...
Definition ecat63p.c:391
int ecat63ReadScanheader(FILE *fp, int blk, ECAT63_scanheader *h, int verbose, char *errmsg)
Definition ecat63r.c:377
int ecat63ReadImageheader(FILE *fp, int blk, ECAT63_imageheader *h, int verbose, char *errmsg)
Definition ecat63r.c:187
int ecat63ReadMainheader(FILE *fp, ECAT63_mainheader *h)
Definition ecat63r.c:25
int ecat63WriteImageheader(FILE *fp, int block, ECAT63_imageheader *h)
Definition ecat63w.c:106
int ecat63WriteScanheader(FILE *fp, int block, ECAT63_scanheader *h)
Definition ecat63w.c:242
int ecat63WriteMainheader(FILE *fp, ECAT63_mainheader *h)
Definition ecat63w.c:24
void ecat7InitMatlist(ECAT7_MATRIXLIST *mlist)
Definition ecat7ml.c:15
int ecat7ReadMatlist(FILE *fp, ECAT7_MATRIXLIST *ml, int verbose)
Definition ecat7ml.c:41
void ecat7EmptyMatlist(ECAT7_MATRIXLIST *mlist)
Definition ecat7ml.c:26
void ecat7PrintMatlist(ECAT7_MATRIXLIST *ml)
Definition ecat7ml.c:112
int ecat7ReadScanheader(FILE *fp, int blk, ECAT7_scanheader *h)
Definition ecat7r.c:536
int ecat7ReadMainheader(FILE *fp, ECAT7_mainheader *h)
Definition ecat7r.c:15
int ecat7Read2DScanheader(FILE *fp, int blk, ECAT7_2Dscanheader *h)
Definition ecat7r.c:631
int ecat7ReadImageheader(FILE *fp, int blk, ECAT7_imageheader *h)
Definition ecat7r.c:162
int ecat7WriteScanheader(FILE *fp, int blk, ECAT7_scanheader *h)
Definition ecat7w.c:383
int ecat7WriteImageheader(FILE *fp, int blk, ECAT7_imageheader *h)
Definition ecat7w.c:113
int ecat7Write2DScanheader(FILE *fp, int blk, ECAT7_2Dscanheader *h)
Definition ecat7w.c:450
int ecat7WriteMainheader(FILE *fp, ECAT7_mainheader *h)
Definition ecat7w.c:16
Header file for libtpcimgio.
#define ECAT7_VOLUME8
#define ECAT7_3DSCAN
#define ECAT7_3DSCAN8
#define ECAT7_IMAGE16
#define ECAT7_VOLUME16
#define RAW_DATA
#define ECAT7_IMAGE8
#define IMAGE_DATA
#define ECAT7_2DSCAN
Header file for libtpcmisc.
int tpcProcessStdOptions(const char *s, int *print_usage, int *print_version, int *verbose_level)
Definition proginfo.c:40
size_t strlcpy(char *dst, const char *src, size_t dstsize)
Definition strext.c:245
#define M_LN2
Definition libtpcmisc.h:90
int tpcHtmlUsage(const char *program, char *text[], const char *path)
Definition proginfo.c:213
void tpcPrintBuild(const char *program, FILE *fp)
Definition proginfo.c:383
void tpcPrintUsage(const char *program, char *text[], FILE *fp)
Definition proginfo.c:158
short int scan_start_second
short int scan_start_minute
short int scan_start_hour
ECAT7_MatDir * matdir
short int file_type
char magic_number[14]
MatDir * matdir
int matnum
int strtblk