TPCCLIB
Loading...
Searching...
No Matches
modell.c
Go to the documentation of this file.
1
4/*****************************************************************************/
5#include "tpcclibConfig.h"
6/*****************************************************************************/
7#include <stdio.h>
8#include <stdlib.h>
9#include <math.h>
10#include <time.h>
11#include <string.h>
12/*****************************************************************************/
13#include "tpcextensions.h"
14/*****************************************************************************/
15#include "tpcmodels.h"
16/*****************************************************************************/
17
18/*****************************************************************************/
21typedef struct TPC_MODEL {
23 char *code;
26 unsigned int id;
28 unsigned int type;
30 unsigned int parNr;
32 char *desc;
33} TPC_MODEL;
34/*****************************************************************************/
35
36/*****************************************************************************/
51static TPC_MODEL tpc_model[]={
52 {"unknown", 0, 0, 0, "unknown"},
53 /* mathematical functions */
54 {"level", 100, 2, 1, "f(x)=A"},
55 {"line", 101, 2, 2, "line"},
56 {"pol2", 102, 2, 3, "2nd degree polynomial"},
57 {"pol3", 103, 2, 4, "3rd degree polynomial"},
58 {"pol4", 104, 2, 5, "4th degree polynomial"},
59 {"pol5", 105, 2, 6, "5th degree polynomial"},
60 {"pol6", 106, 2, 7, "6th degree polynomial"},
61 {"pol7", 107, 2, 8, "7th degree polynomial"},
62 {"pol8", 108, 2, 9, "8th degree polynomial"},
63 {"pol9", 109, 2, 10, "9th degree polynomial"},
64 {"ratf11", 211, 2, 0, "1st/1st order rational function"},
65 {"ratf21", 221, 2, 0, "2nd/1st order rational function"},
66 {"ratf22", 222, 2, 0, "2nd/2nd order rational function"},
67 {"ratf32", 232, 2, 0, "3rd/2nd order rational function"},
68 {"ratf33", 233, 2, 0, "3rd/3rd order rational function"},
69 {"1exp", 301, 2, 0, "single exponential"},
70 {"2exp", 302, 2, 0, "sum of 2 exponentials"},
71 {"3exp", 303, 2, 0, "sum of 3 exponentials"},
72 {"4exp", 304, 2, 0, "sum of 4 exponentials"},
73 {"5exp", 305, 2, 0, "sum of 5 exponentials"},
74 {"lundq1", 321, 2, 0, "Lundqvist function"},
75 {"lundq2", 322, 2, 0, "sum of 2 Lundqvist functions"},
76 {"lundq3", 323, 2, 0, "sum of 3 Lundqvist functions"},
77 {"ebolinf", 331, 2, 0, "exponential bolus infusion function"},
78 {"ebolinfrw", 332, 2, 0, "Kudomi's exponential bolus infusion function for radiowater"},
79 {"ebolinfaz", 334, 2, 0, "exponential bolus function approaching zero"},
80 {"ppfpk11195", 351, 2, 0, "exp function for PK11195 plasma parent fraction"},
81 {"igam", 401, 2, 2, "Lower incomplete gamma function divided by gamma function"},
82 {"igamc", 402, 2, 2, "Upper incomplete gamma function divided by gamma function"},
83 {"ppfigam", 403, 2, 5, "Inverted gamma cdf for plasma parent fraction"},
84 {"mpfhill", 841, 2, 0, "Hill function"},
85 {"ppfhill", 842, 2, 0, "Hill function (1-f(x))"},
86 {"ppfhille", 843, 2, 0, "Hill function (1-f(x)) with ascending or descending end"},
87 {"mpfb", 844, 2, 0, "Hill function with background"},
88 {"ppfb", 845, 2, 0, "Hill function (A-f(x))"},
89 {"ppfehill1", 846, 2, 0, "Extended Hill function for plasma parent fraction"},
90 {"mpfehill1", 847, 2, 0, "Extended Hill function for plasma metabolite fraction"},
91 {"ppfefill2", 848, 2, 0, "Extended Hill function #2 for plasma parent fraction"},
92 {"mpfehill2", 849, 2, 0, "Extended Hill function #2 for plasma metabolite fraction"},
93 {"mpfmamede", 851, 2, 0, "Mamede function"},
94 {"ppfmamede", 852, 2, 0, "Mamede function (1-f(x)"},
95 {"ppfmeyer", 861, 2, 0, "Meyer function for plasma parent fraction"},
96 {"mpfmeyer", 862, 2, 0, "Meyer function for plasma metabolite fraction"},
97 {"ppfemeyer", 863, 2, 0, "extended Meyer function for plasma parent fraction"},
98 {"mpfemeyer", 864, 2, 0, "extended Meyer function for plasma metabolite fraction"},
99 {"ppf3hill", 871, 2, 0, "1-3 metabolite Hill function for plasma parent fraction"},
100 {"mpf3hill1", 872, 2, 0, "1-3 metabolite Hill function for plasma metab1 fraction"},
101 {"mpf3hill2", 873, 2, 0, "1-3 metabolite Hill function for plasma metab2 fraction"},
102 {"mpf3hill3", 874, 2, 0, "1-3 metabolite Hill function for plasma metab3 fraction"},
103 {"ppf3pow", 881, 2, 0, "1-3 metabolite power function for plasma parent fraction"},
104 {"mpf3pow1", 882, 2, 0, "1-3 metabolite power function for plasma metab1 fraction"},
105 {"mpf3pow2", 883, 2, 0, "1-3 metabolite power function for plasma metab2 fraction"},
106 {"mpf3pow3", 884, 2, 0, "1-3 metabolite power function for plasma metab3 fraction"},
107 {"step", 1010, 2, 2, "Step function with x values and y values after those"},
108 {"ratf32d", 1232, 2, 0, "3rd/2nd order rational function with delay"},
109 {"fengm2s", 1312, 2, 5, "PTAC function with two exponentials"},
110 {"fengm2", 1313, 2, 7, "PTAC function with three exponentials"},
111 {"fengm2e", 1314, 2, 9, "PTAC function with four exponentials"},
112 {"gammav", 1401, 2, 4, "Gamma variate"},
113 {"gammavb", 1402, 2, 0, "Gamma variate with background"},
114 {"weibullcdfd", 1421, 2, 4, "Weibull cdf with delay"},
115 {"weibullcdfdd",1423, 2, 5, "Weibull cdf and pdf sum with delay"},
116 {"dmsurge", 1430, 2, 0, "Sum of surge functions with delay"},
117 {"surge", 1431, 2, 2, "Surge function with AUC as parameter"},
118 {"tradsurge", 1432, 2, 2, "Traditional surge function"},
119 {"surgerecirc", 1433, 2, 3, "Surge function with recirculation"},
120 {"p2bsrc", 1434, 2, 4, "Surge function with recirculation for plasma-to-blood ratio"},
121 {"surgefdgaif", 1435, 2, 5, "Surge function for late FDG AIF with delay"},
122 {"erlangpdf", 1441, 2, 3, "Probability density function of Erlang distribution"},
123 {"hilld", 1801, 2, 0, "Hill function with delay"},
124 {"hilldd", 1811, 2, 0, "derivative of Hill function with delay"},
125 {"hillssd", 1821, 2, 0, "sum of Hill function and derivative with delay"},
126 {"surgerecircd",1833, 2, 4, "Surge function with recirculation and delay"},
127 {"imgprofile", 2111, 2, 0, "image profile"},
128 {"p2brf", 2233, 2, 7, "Rational function for plasma-to-blood ratio"},
129 {"p2bfm2", 2313, 2, 7, "Feng M2 function for plasma-to-blood ratio"},
130 {"p2bhill", 2841, 2, 4, "Hill function for plasma-to-blood ratio"},
131 /* compartmental models */
132 {"FRTM", 0, 1, 4, "full reference tissue model"},
133 {"SRTM", 0, 1, 3, "simplified reference tissue model"},
134 {"RRTM", 0, 1, 3, "reduced reference tissue model"},
135 {"TRTM", 0, 1, 3, "transport-limited reference tissue model"},
136 {"1TCM", 0, 1, 5, "one-tissue compartmental model"},
137 {"2TCM", 0, 1, 7, "two-tissue compartmental model"},
138 {"PAR3TCM", 0, 1, 9, "parallel three-tissue compartmental model"},
139 {"SER3TCM", 0, 1, 9, "serial three-tissue compartmental model"},
140 {"TTM", 0, 1, 2, "transit-time model"},
141 {"radiowater", 0, 1, 4, "radiowater perfusion model"},
142 {"radiowater2", 0, 1, 6, "radiowater perfusion model 2"},
143 {"radiowater-lung", 0, 1, 5, "radiowater perfusion model for lungs"},
144 {"radiowater-liver", 0, 1, 7, "radiowater perfusion model for liver"},
145 {"radiowater-liver-TTM", 0, 1, 6, "radiowater perfusion TTM model for liver"},
146 {"oxygen-brain", 0, 1, 7, "oxygen model for brain"},
147 {"dispdelay", 0, 1, 2, "dispersion and delay in radiowater studies"},
148 /* pharmacokinetic compartment models */
149 {"O1CM", 0, 3, 3, "one-compartment model with first-order absorption and elimination"},
150 {"O2CM", 0, 3, 5, "two-compartment model with first-order absorption and elimination"},
151 /* combinations of functions and models */
152 {"ebolinfdd", 3331,12, 8, "exponential bolus infusion function plus delay and dispersion"},
153 {"", 0, 0, 0, ""}
154};
156/*****************************************************************************/
157
158/*****************************************************************************/
162unsigned int modelNr()
163{
164 unsigned int i=0;
165 while(tpc_model[i].code[0]!='\0') i++;
166 return(i);
167}
168/*****************************************************************************/
169
170/*****************************************************************************/
178 const unsigned int i
179) {
180 if(i>=modelNr()) return((char*)NULL);
181 return(tpc_model[i].code);
182}
183/*****************************************************************************/
184
185/*****************************************************************************/
191unsigned int modelOldId(
193 const unsigned int i
194) {
195 return(tpc_model[i].id);
196}
197/*****************************************************************************/
198
199/*****************************************************************************/
205unsigned int modelOld2New(
207 const unsigned int i
208) {
209 unsigned int n=modelNr();
210 if(i==0) return(0);
211 for(unsigned int j=1; j<n; j++) if(tpc_model[j].id==i) return(j);
212 return(0);
213}
214/*****************************************************************************/
215
216/*****************************************************************************/
224 const unsigned int i
225) {
226 if(i>=modelNr()) return((char*)NULL);
227 return(tpc_model[i].desc);
228}
229/*****************************************************************************/
230
231/*****************************************************************************/
237unsigned int modelCodeIndex(
239 const char *s
240) {
241 if(s==NULL || *s=='\0') return(0);
242 unsigned int i=0;
243 while(tpc_model[i].code[0]!='\0') {
244 if(!strcasecmp(tpc_model[i].code, s)) return(i);
245 i++;
246 }
247 return(0);
248}
249/*****************************************************************************/
250
251/*****************************************************************************/
256unsigned int modelParNr(
258 const unsigned int code
259) {
260 if(code<1 || code>=modelNr()) return(0);
261 return(tpc_model[code].parNr);
262}
263/*****************************************************************************/
264
265/*****************************************************************************/
char * modelCode(const unsigned int i)
Definition modell.c:176
char * modelDesc(const unsigned int i)
Definition modell.c:222
unsigned int modelParNr(const unsigned int code)
Definition modell.c:256
unsigned int modelOldId(const unsigned int i)
Definition modell.c:191
unsigned int modelOld2New(const unsigned int i)
Definition modell.c:205
unsigned int modelNr()
Definition modell.c:162
unsigned int modelCodeIndex(const char *s)
Definition modell.c:237
Header file for library libtpcextensions.
Header file for libtpcmodels.