Create PAR data for use in testing TPCCLIB.
More...
#include "tpcclibConfig.h"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include "tpcpar.h"
Go to the source code of this file.
Create PAR data for use in testing TPCCLIB.
Definition in file parexample.c.
◆ parExamplePerfectBolus()
Create PAR data containing function parameters for perfect bolus TAC, starting from zero and approaching zero after the peak.
- Note
- For use in algorithm and software tests.
Creates Gamma variate function (gammav) function with zero delay and with p[1]=1. Maximum is at 1.2 s and max value is 100 kBq/mL. Integral from 0 to infinity is 326.19382 (p[0]*p[2]^2).
- Returns
- enum tpcerror (TPCERROR_OK when successful).
- Author
- Vesa Oikonen
- See also
- parInit, parExampleTTACs, simBTAC
- Parameters
-
| d | Pointer to initiated PAR struct, which will be allocated and filled here; any previous content will be deleted. |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 120 of file parexample.c.
126 {
127 int verbose=0;
if(status!=NULL) verbose=status->
verbose;
128 if(verbose>0) printf("%s(par)\n", __func__);
129
130
131 if(d==NULL) {
134 }
136
137 int ret, pi, parNr;
138
139
144
145 iftPut(&d->
h,
"studynr",
"ptac1401", 1, NULL);
146 iftPut(&d->
h,
"analysis_time",
"2016-07-05 15:40:03", 1, NULL);
147 iftPut(&d->
h,
"program",
"libtpcpar (c) 2016", 1, NULL);
148 iftPut(&d->
h,
"datafile",
"ptac1401.tac",1,NULL);
149 iftPut(&d->
h,
"weighting",
"no", 1, NULL);
152
157
158 sprintf(d->
r[0].
name,
"bolus");
159
165 d->
r[0].
wss=0.0E+000;
166
167 pi=0; d->
r[0].
p[pi]=226.523;
168 pi++; d->
r[0].
p[pi]=1.0;
169 pi++; d->
r[0].
p[pi]=1.2;
170 pi++; d->
r[0].
p[pi]=0.0;
171
174}
int iftPut(IFT *ift, const char *key, const char *value, char comment, TPCSTATUS *status)
unsigned int modelParNr(const unsigned int code)
unsigned int modelCodeIndex(const char *s)
int parAllocate(PAR *par, int parNr, int tacNr)
void statusSet(TPCSTATUS *s, const char *func, const char *srcfile, int srcline, tpcerror error)
IFT h
Optional (but often useful) header information.
char name[MAX_PARNAME_LEN+1]
char name[MAX_TACNAME_LEN+1]
int verbose
Verbose level, used by statusPrint() etc.
@ TPCERROR_NO_DATA
File contains no data.
char * unitName(int unit_code)
@ PAR_FORMAT_CSV_INT
International CSV.
◆ parExampleTTACs()
| int parExampleTTACs |
( |
PAR * | d, |
|
|
int | type, |
|
|
TPCSTATUS * | status ) |
Create PAR data containing function parameters for typical-looking PET TTACs for use in algorithm and software tests.
Creates three fengm2 functions with zero delay.
- Returns
- enum tpcerror (TPCERROR_OK when successful).
- Author
- Vesa Oikonen
- See also
- parInit, parExamplePerfectBolus
- Parameters
-
| d | Pointer to initiated PAR struct, which will be allocated and filled here; any previous content will be deleted. |
| type | TTAC type; currently unused |
| status | Pointer to status data; enter NULL if not needed |
Definition at line 24 of file parexample.c.
32 {
33 int verbose=0;
if(status!=NULL) verbose=status->
verbose;
34 if(verbose>0) printf("%s(par, %d)\n", __func__, type);
35
36
37 if(d==NULL) {
40 }
42
43 int ret, pi, ri, parNr;
44
45
50
51 iftPut(&d->
h,
"studynr",
"ttac1313", 1, NULL);
52 iftPut(&d->
h,
"analysis_time",
"2016-07-01 15:05:43", 1, NULL);
53 iftPut(&d->
h,
"program",
"libtpcpar (c) 2016", 1, NULL);
54 iftPut(&d->
h,
"datafile",
"ttac1313.tac",1,NULL);
55 iftPut(&d->
h,
"weighting",
"no", 1, NULL);
58
66
67 for(ri=0; ri<d->
tacNr; ri++) {
73 d->
r[ri].
wss=0.0E+000;
74 }
75
76 ri=0;
77 strcpy(d->
r[ri].
name,
"fast");
78 pi=0; d->
r[ri].
p[pi]=200.;
79 pi++; d->
r[ri].
p[pi]=-0.8;
80 pi++; d->
r[ri].
p[pi]=50.;
81 pi++; d->
r[ri].
p[pi]=-0.2;
82 pi++; d->
r[ri].
p[pi]=20.;
83 pi++; d->
r[ri].
p[pi]=-0.005;
84 pi++; d->
r[ri].
p[pi]=0.0;
85 ri++;
86 strcpy(d->
r[ri].
name,
"moder");
87 pi=0; d->
r[ri].
p[pi]=50.;
88 pi++; d->
r[ri].
p[pi]=-0.2;
89 pi++; d->
r[ri].
p[pi]=50.;
90 pi++; d->
r[ri].
p[pi]=-0.02;
91 pi++; d->
r[ri].
p[pi]=3.;
92 pi++; d->
r[ri].
p[pi]=-0.001;
93 pi++; d->
r[ri].
p[pi]=0.0;
94 ri++;
95 strcpy(d->
r[ri].
name,
"slow");
96 pi=0; d->
r[ri].
p[pi]=5.;
97 pi++; d->
r[ri].
p[pi]=-0.05;
98 pi++; d->
r[ri].
p[pi]=70.;
99 pi++; d->
r[ri].
p[pi]=-0.001;
100 pi++; d->
r[ri].
p[pi]=30.;
101 pi++; d->
r[ri].
p[pi]=-0.0005;
102 pi++; d->
r[ri].
p[pi]=0.0;
103
106}