9#include "tpcclibConfig.h"
26static char *info[] = {
27 "Non-linear fitting of dual input compartment model, with one tissue",
28 "compartment for each input (parent tracer and its labeled metabolite):",
31 " | Cap | ----> | Ctp | ",
32 " |_____| <---- |_____| ",
37 " | Cam | ----> | Ctm | ",
38 " |_____| <---- |_____| ",
41 "Sample times must be in minutes.",
43 "Usage: @P [Options] ptacfile mtacfile btacfile ttacfile endtime resultfile",
47 " Specify the constraints for model parameters;",
48 " This file with default values can be created by giving this",
49 " option as the only command-line argument to this program.",
50 " Without filename the default values are printed on screen.",
52 " Standard deviations are calculated and saved in results (y),",
53 " or not calculated (N, default).",
54 " Program runs a lot faster if SD and CL are not calculated.",
56 " 95% Confidence limits are calculated and saved in results (y), or",
57 " not calculated (N, default).",
59 " Enter a fixed Vb; fitted by default.",
60 " If Vb (vascular blood volume) is pre-corrected or to be ignored, set",
61 " it to 0; btacfile can be set to 'none'.",
62 " -ref=<Reference region name or filename>",
63 " Specified reference region is fitted using different set of model",
64 " parameter constraints; not necessary if reference region is given",
65 " with one of the following options -BPnd, -BPp, or -DVR.",
66 " -<BPnd|BPp|DVR>=<Reference region name or filename>",
67 " Optional reference region is used to calculate BPnd, BPp, or DVR;",
68 " BPnd=DVroi/DVref-1, BPp=DVroi-DVref, and DVR=DVroi/DVref",
70 " In reference region Vfm is set to equal Vfp.",
72 " Fit-based metabolite corrected regional TACs are written in the file.",
74 " Fitted regional TACs are written in the file.",
76 " Fitted and measured TACs are plotted in specified SVG file.",
79 "Example 1: fitting with default settings",
80 " @P ia919apc.kbq ia919apm.kbq ia919ab.kbq ia919.dft 60 a919k2di.res",
82 "Example 2: Vb is constrained to 0%; DVRs are calculated by dividing DVs",
83 "by the DV of region 'cer'",
84 " @P -Vb=0 -R=cer p25apc.bld p25apm.bld none p25.tac 60 p25k2di.res",
86 "See also: fitk2, fitk4di, logan, fitk4, p2t_di, tacweigh, taccbv",
88 "Keywords: TAC, modelling, distribution volume, reversible uptake, dual-input",
104const int parNr=6, parVb=5;
106double *petmeas, *petsim;
109int fixed_ref_Vfm_eq_Vfp=0;
113static char *parName[] = {
"K1p",
"Vfp",
"R1m",
"Vfm",
"km",
"Vb", 0};
116double func1TCMdi(
int parNr,
double *p,
void*);
123int main(
int argc,
char **argv)
125 int ai, help=0, version=0, verbose=1;
126 int ri, fi, pi, n, ret;
127 int ref=-1, refAdded=0, inputtype;
129 char dfile[FILENAME_MAX], bfile[FILENAME_MAX],
130 pfile[FILENAME_MAX], mfile[FILENAME_MAX],
131 rfile[FILENAME_MAX], ffile[FILENAME_MAX],
132 mcfile[FILENAME_MAX],
133 limfile[FILENAME_MAX], svgfile[FILENAME_MAX];
134 char refname[FILENAME_MAX];
135 char *cptr, tmp[FILENAME_MAX];
136 double f, fitdur, wss;
138 int doBootstrap=0, doSD=0, doCL=0;
139 double *sd, *cl1, *cl2;
142 int tgoNr=0, neighNr=0, iterNr=0, fittedparNr=0;
146 def_pmin[0]=0.0; def_pmax[0]=10.0;
147 def_pmin[1]=0.0; def_pmax[1]=500.0;
148 def_pmin[2]=0.0; def_pmax[2]=10.0;
149 def_pmin[3]=0.0; def_pmax[3]=10.0;
150 def_pmin[4]=0.0; def_pmax[4]=0.0;
151 def_pmin[5]=0.0; def_pmax[5]=0.10;
153 def_pmin_ref[0]=0.0; def_pmax_ref[0]=10.0;
154 def_pmin_ref[1]=0.0; def_pmax_ref[1]=2.0;
155 def_pmin_ref[2]=0.0; def_pmax_ref[2]=10.0;
156 def_pmin_ref[3]=0.0; def_pmax_ref[3]=2.0;
157 def_pmin_ref[4]=0.0; def_pmax_ref[4]=0.0;
158 def_pmin_ref[5]=0.0; def_pmax_ref[5]=0.10;
164 if(argc==1) {
tpcPrintUsage(argv[0], info, stderr);
return(1);}
165 dfile[0]=pfile[0]=mfile[0]=bfile[0]=refname[0]=(char)0;
166 rfile[0]=ffile[0]=limfile[0]=svgfile[0]=mcfile[0]=(char)0;
170 for(ai=1; ai<argc; ai++)
if(*argv[ai]==
'-') {
171 cptr=argv[ai]+1;
if(*cptr==
'-') cptr++;
if(cptr==NULL)
continue;
173 if(strncasecmp(cptr,
"CL", 2)==0) {
174 if(strlen(cptr)==2) {doCL=1;
continue;}
175 cptr+=2;
if(*cptr==
'=') {
177 if(*cptr==
'Y' || *cptr==
'y') {doCL=1;
continue;}
178 if(*cptr==
'N' || *cptr==
'n') {doCL=0;
continue;}
180 }
else if(strncasecmp(cptr,
"SD", 2)==0) {
181 if(strlen(cptr)==2) {doSD=1;
continue;}
182 cptr+=2;
if(*cptr==
'=') {
184 if(*cptr==
'Y' || *cptr==
'y') {doSD=1;
continue;}
185 if(*cptr==
'N' || *cptr==
'n') {doSD=0;
continue;}
187 }
else if(strncasecmp(cptr,
"LIM=", 4)==0 && strlen(cptr)>4) {
188 strlcpy(limfile, cptr+4, FILENAME_MAX);
continue;
189 }
else if(strcasecmp(cptr,
"LIM")==0) {
190 strcpy(limfile,
"stdout");
continue;
191 }
else if(strncasecmp(cptr,
"Vb=", 3)==0 && strlen(cptr)>3) {
193 if(fVb>=0.0 && fVb<1.0) {
194 if(fVb<0.01) fprintf(stderr,
"Warning: Vb was set to %g%%\n", 100.*fVb);
195 def_pmin[parVb]=def_pmax[parVb]=fVb;
196 def_pmin_ref[parVb]=def_pmax_ref[parVb]=fVb;
200 }
else if(strncasecmp(cptr,
"REF=", 4)==0) {
201 strlcpy(refname, cptr+4, FILENAME_MAX);
if(strlen(refname)>0.0)
continue;
202 }
else if(strncasecmp(cptr,
"DVR=", 4)==0) {
203 bp_type=1;
strlcpy(refname, cptr+4, FILENAME_MAX);
204 if(strlen(refname)>0.0)
continue;
205 }
else if(strncasecmp(cptr,
"BPnd=", 5)==0) {
206 bp_type=2;
strlcpy(refname, cptr+5, FILENAME_MAX);
207 if(strlen(refname)>0.0)
continue;
208 }
else if(strncasecmp(cptr,
"BPp=", 4)==0) {
209 bp_type=3;
strlcpy(refname, cptr+4, FILENAME_MAX);
210 if(strlen(refname)>0.0)
continue;
211 }
else if(strcasecmp(cptr,
"refVfm=refVfp")==0) {
212 fixed_ref_Vfm_eq_Vfp=1;
continue;
213 }
else if(strncasecmp(cptr,
"MC=", 3)==0) {
214 strlcpy(mcfile, cptr+3, FILENAME_MAX);
if(strlen(mcfile)>0)
continue;
215 }
else if(strncasecmp(cptr,
"FIT=", 4)==0) {
216 strlcpy(ffile, cptr+4, FILENAME_MAX);
if(strlen(ffile)>0)
continue;
217 }
else if(strncasecmp(cptr,
"SVG=", 4)==0) {
218 strlcpy(svgfile, cptr+4, FILENAME_MAX);
if(strlen(svgfile)>0)
continue;
220 fprintf(stderr,
"Error: invalid option '%s'.\n", argv[ai]);
226 if(help==2) {
tpcHtmlUsage(argv[0], info,
"");
return(0);}
231 for(ai=1; ai<argc; ai++)
if(*argv[ai]!=
'-') {
232 if(!pfile[0]) {
strlcpy(pfile, argv[ai], FILENAME_MAX);
continue;}
233 else if(!mfile[0]) {
strlcpy(mfile, argv[ai], FILENAME_MAX);
continue;}
234 else if(!bfile[0]) {
strlcpy(bfile, argv[ai], FILENAME_MAX);
continue;}
235 else if(!dfile[0]) {
strlcpy(dfile, argv[ai], FILENAME_MAX);
continue;}
236 else if(fitdur<0) {fitdur=
atof_dpi(argv[ai]);
if(fitdur>0.0)
continue;}
237 else if(!rfile[0]) {
strlcpy(rfile, argv[ai], FILENAME_MAX);
continue;}
239 fprintf(stderr,
"Error: too many arguments: '%s'.\n", argv[ai]);
242 if(doSD || doCL) doBootstrap=1;
else doBootstrap=0;
244 if(strcasecmp(bfile,
"NONE")==0) {strcpy(bfile,
""); fVb=0.0;}
248 if(limfile[0] && !pfile[0]) {
250 if(strcasecmp(limfile,
"stdout")!=0 && access(limfile, 0) != -1) {
251 fprintf(stderr,
"Error: parameter constraint file %s exists.\n", limfile);
254 if(verbose>1) printf(
"writing parameter constraints file\n");
257 for(pi=0; pi<parNr; pi++) {
258 sprintf(tmp,
"%s_lower", parName[pi]);
260 sprintf(tmp,
"%s_upper", parName[pi]);
263 for(pi=0; pi<parNr; pi++) {
264 sprintf(tmp,
"ref_%s_lower", parName[pi]);
266 sprintf(tmp,
"ref_%s_upper", parName[pi]);
269 if((ret=
iftWrite(&ift, limfile, 0))!=0) {
270 fprintf(stderr,
"Error in writing '%s': %s\n", limfile, ift.
status);
273 if(strcasecmp(limfile,
"stdout")!=0) fprintf(stdout,
274 "Parameter file %s with initial values written.\n", limfile);
279 if(fitdur==0) fitdur=1.0E+100;
280 else if(fitdur<0) {
tpcPrintUsage(argv[0], info, stderr);
return(1);}
282 fprintf(stderr,
"Error: missing command-line argument; use option --help\n");
288 printf(
"pfile := %s\n", pfile);
289 printf(
"mfile := %s\n", mfile);
290 printf(
"dfile :=%s\n", dfile);
291 printf(
"rfile := %s\n", rfile);
292 printf(
"mcfile := %s\n", mcfile);
293 printf(
"ffile := %s\n", ffile);
294 printf(
"svgfile := %s\n", svgfile);
295 printf(
"limfile := %s\n", limfile);
296 printf(
"bp_type := %d\n", bp_type);
297 printf(
"refname := %s\n", refname);
298 printf(
"fitdur := %g\n", fitdur);
299 printf(
"doBootstrap := %d\n", doBootstrap);
300 printf(
"doSD := %d\n", doSD);
301 printf(
"doCL := %d\n", doCL);
302 printf(
"fixed_ref_Vfm_eq_Vfp := %d\n", fixed_ref_Vfm_eq_Vfp);
313 if(verbose>1) printf(
"reading %s\n", limfile);
314 ret=
iftRead(&ift, limfile, 1, 0);
316 fprintf(stderr,
"Error in reading '%s': %s\n", limfile, ift.
status);
319 if(verbose>10)
iftWrite(&ift,
"stdout", 0);
321 for(pi=0; pi<parNr; pi++) {
322 sprintf(tmp,
"%s_lower", parName[pi]);
324 sprintf(tmp,
"%s_upper", parName[pi]);
327 for(pi=0; pi<parNr; pi++) {
328 sprintf(tmp,
"ref_%s_lower", parName[pi]);
330 sprintf(tmp,
"ref_%s_upper", parName[pi]);
334 if(n==0) {fprintf(stderr,
"Error: invalid parameter file.\n");
return(9);}
337 if(fixed_ref_Vfm_eq_Vfp!=0) {
338 def_pmax_ref[3]=def_pmin_ref[3]=0.0;
341 for(pi=n=0, ret=0; pi<parNr; pi++) {
342 if(def_pmin[pi]<0.0) ret++;
343 if(def_pmax[pi]<def_pmin[pi]) ret++;
344 if(def_pmax[pi]>def_pmin[pi]) n++;
347 fprintf(stderr,
"Error: invalid parameter constraints.\n");
351 fprintf(stderr,
"Error: no model parameters left free for fitting.\n");
355 for(pi=n=0, ret=0; pi<parNr; pi++) {
356 if(def_pmin_ref[pi]<0.0) ret++;
357 if(def_pmax_ref[pi]<def_pmin_ref[pi]) ret++;
358 if(def_pmax_ref[pi]>def_pmin_ref[pi]) n++;
361 fprintf(stderr,
"Error: invalid reference region parameter constraints.\n");
365 fprintf(stderr,
"Error: no ref model parameters left free for fitting.\n");
371 def_pmin[parVb]=def_pmax[parVb]=def_pmin_ref[parVb]=def_pmax_ref[parVb]=fVb;
372 if(def_pmin[parVb]==def_pmax[parVb]) fVb=def_pmin[parVb];
373 if(fVb==0.0) strcpy(bfile,
"");
375 printf(
"bfile := %s\n", bfile);
383 if(verbose>1) printf(
"reading tissue and input data\n");
385 &fitframeNr, &dft, &input, stdout, verbose-2, tmp);
387 fprintf(stderr,
"Error: %s\n", tmp);
390 if(fitframeNr<parNr+1 || input.
frameNr<parNr+1) {
391 fprintf(stderr,
"Error: too few samples in specified fit duration.\n");
395 fprintf(stderr,
"Error: valid plasma TACs must be provided.\n");
400 if(verbose>2) printf(
"setting blood tac to zero\n");
403 fprintf(stderr,
"Error: cannot allocate more memory.\n");
407 for(fi=0; fi<input.
frameNr; fi++) input.
voi[2].
y[fi]=0.0;
410 def_pmin[parVb]=def_pmax[parVb]=fVb=0.0;
411 def_pmin_ref[parVb]=def_pmax_ref[parVb]=0.0;
414 if(fVb>=0.0) printf(
"fVb := %g\n", fVb);
420 fprintf(stdout,
"common_data_weights := %g", dft.
w[0]);
421 for(fi=1; fi<dft.
frameNr; fi++) fprintf(stdout,
", %g", dft.
w[fi]);
422 fprintf(stdout,
"\n");
431 if(verbose>1) printf(
"no reference region data\n");
434 if(verbose>1) printf(
"reading reference region data\n");
437 fprintf(stderr,
"Error in reading '%s': %s\n", refname, tmp);
438 if(verbose>2) printf(
"dftReadReference()=%d\n", n);
443 fprintf(stderr,
"Warning: %s selected of %d reference regions.\n", dft.
voi[ref].
name, n);
445 fprintf(stdout,
"selected reference region := %s\n", dft.
voi[ref].
name);
447 refAdded=0; strcpy(refname,
"");
452 if(verbose>1) printf(
"Reference region: %s\n", dft.
voi[ref].
name );
458 fprintf(stderr,
"Error: cannot allocate more memory.\n");
470 if(verbose>1) printf(
"initializing result data\n");
472 fprintf(stderr,
"Error: cannot setup memory for results.\n");
482 if(refname[0]) strcpy(res.
reffile, refname);
485 if(fVb>=0.0) res.
Vb=100.0*fVb;
else res.
Vb=-1.0;
495 pi=0; strcpy(res.
parname[pi],
"K1p"); strcpy(res.
parunit[pi],
"ml/(min*ml)");
496 pi++; strcpy(res.
parname[pi],
"K1p/k2p"); strcpy(res.
parunit[pi],
"ml/ml");
497 pi++; strcpy(res.
parname[pi],
"K1m/K1p"); strcpy(res.
parunit[pi],
"");
498 pi++; strcpy(res.
parname[pi],
"K1m/k2m"); strcpy(res.
parunit[pi],
"ml/ml");
499 pi++; strcpy(res.
parname[pi],
"km"); strcpy(res.
parunit[pi],
"1/min");
500 pi++; strcpy(res.
parname[pi],
"Vb"); strcpy(res.
parunit[pi],
"%");
505 }
else if(bp_type==2) {
507 }
else {strcpy(res.
parname[pi],
"BPp"); strcpy(res.
parunit[pi],
"");}
509 pi++; strcpy(res.
parname[pi],
"WSS"); strcpy(res.
parunit[pi],
"");
516 fprintf(stderr,
"Error %d in memory allocation for fitted curves.\n", ret);
526 fprintf(stdout,
"fitting regional TACs: ");
527 if(verbose>1) fprintf(stdout,
"\n");
530 for(ri=0; ri<dft.
voiNr; ri++) {
531 if(verbose>2) printf(
"\n %d %s\n", ri, dft.
voi[ri].
name);
534 petmeas=dft.
voi[ri].
y; petsim=fit.
voi[ri].
y;
539 for(pi=0; pi<parNr; pi++) {pmin[pi]=def_pmin[pi]; pmax[pi]=def_pmax[pi];}
541 is_this_ref=1;
if(verbose>2) printf(
"\n this is reference region\n");
542 for(pi=0; pi<parNr; pi++) {
543 pmin[pi]=def_pmin_ref[pi]; pmax[pi]=def_pmax_ref[pi];}
545 for(pi=fittedparNr=0; pi<parNr; pi++)
if(pmax[pi]>pmin[pi]) fittedparNr++;
546 if(ri==0 && verbose>1) {
547 printf(
" constraints :=");
548 for(pi=0; pi<parNr; pi++) printf(
" [%g,%g]", pmin[pi], pmax[pi]);
550 printf(
"fittedparNr := %d\n", fittedparNr);
556 tgoNr=60+30*fittedparNr;
557 neighNr=6*fittedparNr;
560 pmin, pmax, func1TCMdi, NULL, parNr, neighNr,
563 fprintf(stderr,
"\nError in optimization (%d).\n", ret);
574 if(verbose>2) printf(
"\n bootstrapping\n");
577 if(doSD) sd=res.
voi[ri].
sd;
else sd=NULL;
578 if(doCL) {cl1=res.
voi[ri].
cl1; cl2=res.
voi[ri].
cl2;}
else cl1=cl2=NULL;
588 parNr, dft.
w, func1TCMdi, tmp, verbose-4
591 fprintf(stderr,
"Error in bootstrap: %s\n", tmp);
592 for(pi=0; pi<parNr; pi++) {
593 if(doSD) sd[pi]=nan(
"");
594 if(doCL) cl1[pi]=cl2[pi]=nan(
"");
600 if(is_this_ref && fixed_ref_Vfm_eq_Vfp!=0) {
608 if(dft.
voiNr>2 && verbose==1) {fprintf(stdout,
"."); fflush(stdout);}
611 if(verbose>0) {fprintf(stdout,
"\n"); fflush(stdout);}
614 for(ri=0; ri<res.
voiNr; ri++){
616 if(!isnan(res.
voi[ri].
cl1[parVb])) res.
voi[ri].
cl1[parVb]*=100.;
617 if(!isnan(res.
voi[ri].
cl2[parVb])) res.
voi[ri].
cl2[parVb]*=100.;
618 if(!isnan(res.
voi[ri].
sd[parVb])) res.
voi[ri].
sd[parVb]*=100.;
621 if(bp_type==1 || bp_type==2) {
623 for(ri=0; ri<res.
voiNr; ri++) {
629 for(ri=0; ri<res.
voiNr; ri++)
633 for(ri=0; ri<res.
voiNr; ri++)
640 if(verbose>0) {
resPrint(&res); fprintf(stdout,
"\n");}
646 if(verbose>1) printf(
"saving results\n");
647 ret=
resWrite(&res, rfile, verbose-3);
649 fprintf(stderr,
"Error in writing '%s': %s\n", rfile,
reserrmsg);
653 if(verbose>0) fprintf(stdout,
"Model parameters written in %s\n", rfile);
660 if(verbose>1) printf(
"calculating mc curves\n");
666 fprintf(stderr,
"Error: cannot make mc curves.\n");
673 double K1p, k2p, K1m, k2m, km, Vb;
674 for(ri=0; ri<dft2.
voiNr; ri++) {
687 K1p, k2p, 0, 0, 0, 0, 0, km, K1m, k2m,
688 0.0, Vb, 1.0, input.
voi[0].
y2, NULL, NULL, NULL, NULL, NULL, NULL,
691 if(verbose>1) printf(
"error %d in simulation\n", ret);
692 fprintf(stderr,
"Error: cannot calculate metabolite-free curve.\n");
706 if(verbose>1) printf(
"error %d in interpolation\n", ret);
707 fprintf(stderr,
"Error: cannot interpolate metabolite-free curve.\n");
714 if(verbose>1) printf(
"saving mc curves\n");
717 sprintf(dft2.
comments,
"# program := %s\n", tmp);
719 fprintf(stderr,
"Error in writing '%s': %s\n", mcfile,
dfterrmsg);
723 if(verbose>0) printf(
"MC TACs written in %s\n", mcfile);
732 if(svgfile[0] || ffile[0]) {
739 if(verbose>1) printf(
"saving SVG plot\n");
740 sprintf(tmp,
"1TCM fit with dual input: ");
743 0.0, nan(
""), svgfile, verbose-5);
745 fprintf(stderr,
"Error (%d) in writing '%s'.\n", ret, svgfile);
749 if(verbose>0) printf(
"Plots written in %s\n", svgfile);
754 for(ri=fit.
voiNr-1; ri>=0; ri--)
if(fit.
voi[ri].
sw!=0)
760 if(verbose>1) printf(
"saving fitted curves\n");
762 sprintf(fit.
comments,
"# program := %s\n", tmp);
764 fprintf(stderr,
"Error in writing '%s': %s\n", ffile,
dfterrmsg);
768 if(verbose>0) printf(
"Fitted TACs written in %s\n", ffile);
784double func1TCMdi(
int parNr,
double *p,
void *fdata)
787 double K1p, k2p, K1m, k2m, km, Vb, d, wss=0.0;
796 K1p=pa[0]; K1m=pa[2]*K1p; Vb=pa[parVb];
797 if(pa[1]>0.0) k2p=K1p/pa[1];
else k2p=0.0;
798 if(is_this_ref==0 || fixed_ref_Vfm_eq_Vfp==0) {
799 if(pa[3]>0.0) k2m=K1m/(pa[3]);
else k2m=0.0;
801 if(pa[1]>0.0) k2m=K1m/(pa[1]);
else k2m=0.0;
808 K1p, k2p, 0, 0, 0, 0, 0, km, K1m, k2m,
809 0.0, Vb, 1.0, input.
voi[0].
y2, NULL, NULL, NULL, NULL, NULL, NULL, 0);
811 printf(
"error %d in simulation\n", ret);
819 dft.
x1, dft.
x2, petsim, NULL, NULL, fitframeNr);
823 dft.
x, petsim, NULL, NULL, fitframeNr);
825 printf(
"error %d in interpolation\n", ret);
830 for(fi=0; fi<fitframeNr; fi++)
if(dft.
w[fi]>0.0) {
831 d=petmeas[fi]-petsim[fi];
835 if(0) printf(
"%g %g %g %g %g => %g\n", K1p, k2p, K1m, k2m,Vb,wss);
int bootstrap(int iterNr, double *cLim1, double *cLim2, double *SD, double *parameter, double *lowlim, double *uplim, int frameNr, double *origTac, double *fitTac, double *bsTac, int parNr, double *weight, double(*objf)(int, double *, void *), char *status, int verbose)
int modelCheckParameters(int par_nr, double *lower_p, double *upper_p, double *test_p, double *accept_p, double *penalty)
double atof_dpi(char *str)
int dftdup(DFT *dft1, DFT *dft2)
int dftAddmem(DFT *dft, int voiNr)
int dftDelete(DFT *dft, int voi)
int dftWrite(DFT *data, char *filename)
int res_allocate_with_dft(RES *res, DFT *dft)
int iftPutDouble(IFT *ift, char *key, double value, char *cmt_type, int verbose)
int iftRead(IFT *ift, char *filename, int is_key_required, int verbose)
int iftWrite(IFT *ift, char *filename, int verbose)
int iftGetDoubleValue(IFT *ift, int si, const char *key, double *value, int verbose)
int interpolate(double *x, double *y, int nr, double *newx, double *newy, double *newyi, double *newyii, int newnr)
Linear interpolation and integration.
int interpolate4pet(double *x, double *y, int nr, double *newx1, double *newx2, double *newy, double *newyi, double *newyii, int newnr)
Interpolate and integrate TAC to PET frames.
Header file for libtpccurveio.
int resWrite(RES *res, char *filename, int verbose)
#define DFT_TIME_STARTEND
Header file for libtpcmisc.
int tpcProcessStdOptions(const char *s, int *print_usage, int *print_version, int *verbose_level)
size_t strlcpy(char *dst, const char *src, size_t dstsize)
void tpcProgramName(const char *program, int version, int copyright, char *prname, int n)
int tpcHtmlUsage(const char *program, char *text[], const char *path)
void tpcPrintBuild(const char *program, FILE *fp)
void tpcPrintUsage(const char *program, char *text[], FILE *fp)
Header file for libtpcmodel.
int simC4DIvp(double *t, double *ca1, double *ca2, double *cb, int nr, double k1, double k2, double k3, double k4, double k5, double k6, double k7, double km, double k1b, double k2b, double f, double vb, double fa, double *scpet, double *sct1, double *sct2, double *sct3, double *sct1b, double *sctab, double *sctvb, int verbose)
int tgo(double *lowlim, double *uplim, double(*objf)(int, double *, void *), void *objfData, int dim, int neighNr, double *fmin, double *gmin, int samNr, int tgoNr, int verbose)
Header file for libtpcmodext.
int plot_fitrange_svg(DFT *dft1, DFT *dft2, char *main_title, double x1, double x2, double y1, double y2, char *fname, int verbose)
Header file for libtpcsvg.
char studynr[MAX_STUDYNR_LEN+1]
char comments[_DFT_COMMENT_LEN+1]
char plasmafile2[FILENAME_MAX]
char parname[MAX_RESPARAMS][MAX_RESPARNAME_LEN+1]
char plasmafile[FILENAME_MAX]
char datafile[FILENAME_MAX]
char reffile[FILENAME_MAX]
char parunit[MAX_RESPARAMS][MAX_RESPARNAME_LEN+1]
char bloodfile[FILENAME_MAX]
double parameter[MAX_RESPARAMS]
double cl2[MAX_RESPARAMS]
double cl1[MAX_RESPARAMS]
char voiname[MAX_REGIONSUBNAME_LEN+1]
char name[MAX_REGIONNAME_LEN+1]