7#include "tpcclibConfig.h"
37 printf(
"%s(img, sif, %d, %d, %d, ...)\n", __func__, copy_header, copy_frames, copy_counts);
45 if(verbose>0) printf(
" image does not contain frame times.\n");
49 if(copy_counts==2) copy_counts=1;
53 if(copy_counts==2 &&
imgHasCounts(img)!=0) copy_counts=1;
57 if(verbose>0) printf(
" image does not contain isotope halflife.\n");
59 if(copy_counts==2) copy_counts=1;
67 }
else if((copy_frames || copy_counts) && sif->
sampleNr!=img->
dimt) {
72 if((copy_frames || copy_counts) && sif->
tacNr<2) {
80 if(verbose>1) printf(
" copying header fields.\n");
88 if(verbose>1) printf(
" copying frame times.\n");
89 for(
int i=0; i<img->
dimt; i++) {
90 sif->
x1[i]=img->
x1[i]; sif->
x2[i]=img->
x2[i]; sif->
x[i]=img->
x[i];
97 if(verbose>1) printf(
" copying count data.\n");
98 for(
int i=0; i<img->
dimt; i++) {
106 if(verbose>1) printf(
" creating count data.\n");
108 fprintf(stderr,
"Warning: imgToSIF() does not yet guess counts.\n"); fflush(stderr);
110 for(
int i=0; i<img->
dimt; i++) {
141 printf(
"%s(img, sif, %d, %d, %d, ...)\n", __func__, copy_header, copy_frames, copy_counts);
148 if(verbose>1) printf(
" copying header.\n");
150 if(ret!=
TPCERROR_OK && verbose>0) fprintf(stderr,
"Warning: cannot read scan start time in SIF\n");
152 if(img->
isot==
ISOTOPE_UNKNOWN && verbose>0) fprintf(stderr,
"Warning: cannot read isotope in SIF\n");
157 if(verbose>1) printf(
" copying frame times.\n");
159 for(
int fi=0; fi<img->
dimt; fi++) {
160 img->
x1[fi]=sif->
x1[fi];
161 img->
x2[fi]=sif->
x2[fi];
162 img->
x[fi]=0.5*(img->
x1[fi]+img->
x2[fi]);
168 if(verbose>1) printf(
" copying count data.\n");
172 for(
int fi=0; fi<img->
dimt; fi++) {
178 for(
int fi=0; fi<img->
dimt; fi++)
int imgHasTimes(IMG *img)
int imgHasCounts(IMG *img)
int imgToSIF(IMG *img, TAC *sif, int copy_header, int copy_frames, int copy_counts, int verbose)
int imgFromSIF(IMG *img, TAC *sif, int copy_header, int copy_frames, int copy_counts, int verbose)
char studyNr[MAX_STUDYNR_LEN+1]
IFT h
Optional (but often useful) header information.
int tacAllocate(TAC *tac, int sampleNr, int tacNr)
int tacAllocateMoreSamples(TAC *tac, int addNr)
Allocate memory for more samples in TAC data.
int tacAllocateMore(TAC *tac, int tacNr)
int tacGetIsotope(TAC *tac)
void tacSetIsotope(TAC *tac, int isotope)
int tacSetHeaderScanstarttime(IFT *h, const char *s)
int tacGetHeaderScanstarttime(IFT *h, char *s, TPCSTATUS *status)
int tacGetHeaderStudynr(IFT *h, char *s, TPCSTATUS *status)
int tacSetHeaderStudynr(IFT *h, const char *s)
@ WEIGHTING_OFF
Not weighted or weights not available (weights for all included samples are 1.0).
@ WEIGHTING_UNKNOWN
Not known; usually assumed that not weighted.
@ TPCERROR_FAIL
General error.
@ TPCERROR_INVALID_FORMAT
Invalid file format.
@ TPCERROR_OUT_OF_MEMORY
Cannot allocate memory.
Header file for libtpcimage.
@ ISOTOPE_UNKNOWN
Unknown.
@ TAC_FORMAT_SIF
Scan information file.