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 {"surge", 1431, 2, 2, "Surge function with AUC as parameter"},
117 {"tradsurge", 1432, 2, 2, "Traditional surge function"},
118 {"surgerecirc", 1433, 2, 3, "Surge function with recirculation"},
119 {"p2bsrc", 1434, 2, 4, "Surge function with recirculation for plasma-to-blood ratio"},
120 {"surgefdgaif", 1435, 2, 5, "Surge function for late FDG AIF with delay"},
121 {"erlangpdf", 1441, 2, 3, "Probability density function of Erlang distribution"},
122 {"hilld", 1801, 2, 0, "Hill function with delay"},
123 {"hilldd", 1811, 2, 0, "derivative of Hill function with delay"},
124 {"hillssd", 1821, 2, 0, "sum of Hill function and derivative with delay"},
125 {"surgerecircd",1833, 2, 4, "Surge function with recirculation and delay"},
126 {"imgprofile", 2111, 2, 0, "image profile"},
127 {"p2brf", 2233, 2, 7, "Rational function for plasma-to-blood ratio"},
128 {"p2bfm2", 2313, 2, 7, "Feng M2 function for plasma-to-blood ratio"},
129 {"p2bhill", 2841, 2, 4, "Hill function for plasma-to-blood ratio"},
130 /* compartmental models */
131 {"FRTM", 0, 1, 4, "full reference tissue model"},
132 {"SRTM", 0, 1, 3, "simplified reference tissue model"},
133 {"RRTM", 0, 1, 3, "reduced reference tissue model"},
134 {"TRTM", 0, 1, 3, "transport-limited reference tissue model"},
135 {"1TCM", 0, 1, 5, "one-tissue compartmental model"},
136 {"2TCM", 0, 1, 7, "two-tissue compartmental model"},
137 {"PAR3TCM", 0, 1, 9, "parallel three-tissue compartmental model"},
138 {"SER3TCM", 0, 1, 9, "serial three-tissue compartmental model"},
139 {"TTM", 0, 1, 2, "transit-time model"},
140 {"radiowater", 0, 1, 4, "radiowater perfusion model"},
141 {"radiowater2", 0, 1, 6, "radiowater perfusion model 2"},
142 {"radiowater-lung", 0, 1, 5, "radiowater perfusion model for lungs"},
143 {"radiowater-liver", 0, 1, 7, "radiowater perfusion model for liver"},
144 {"radiowater-liver-TTM", 0, 1, 6, "radiowater perfusion TTM model for liver"},
145 {"oxygen-brain", 0, 1, 7, "oxygen model for brain"},
146 {"dispdelay", 0, 1, 2, "dispersion and delay in radiowater studies"},
147 /* pharmacokinetic compartment models */
148 {"O1CM", 0, 3, 3, "one-compartment model with first-order absorption and elimination"},
149 {"O2CM", 0, 3, 5, "two-compartment model with first-order absorption and elimination"},
150 /* combinations of functions and models */
151 {"ebolinfdd", 3331,12, 8, "exponential bolus infusion function plus delay and dispersion"},
152 {"", 0, 0, 0, ""}
153};
155/*****************************************************************************/
156
157/*****************************************************************************/
161unsigned int modelNr()
162{
163 unsigned int i=0;
164 while(tpc_model[i].code[0]!='\0') i++;
165 return(i);
166}
167/*****************************************************************************/
168
169/*****************************************************************************/
177 const unsigned int i
178) {
179 if(i>=modelNr()) return((char*)NULL);
180 return(tpc_model[i].code);
181}
182/*****************************************************************************/
183
184/*****************************************************************************/
190unsigned int modelOldId(
192 const unsigned int i
193) {
194 return(tpc_model[i].id);
195}
196/*****************************************************************************/
197
198/*****************************************************************************/
204unsigned int modelOld2New(
206 const unsigned int i
207) {
208 unsigned int n=modelNr();
209 if(i==0) return(0);
210 for(unsigned int j=1; j<n; j++) if(tpc_model[j].id==i) return(j);
211 return(0);
212}
213/*****************************************************************************/
214
215/*****************************************************************************/
223 const unsigned int i
224) {
225 if(i>=modelNr()) return((char*)NULL);
226 return(tpc_model[i].desc);
227}
228/*****************************************************************************/
229
230/*****************************************************************************/
236unsigned int modelCodeIndex(
238 const char *s
239) {
240 if(s==NULL || *s=='\0') return(0);
241 unsigned int i=0;
242 while(tpc_model[i].code[0]!='\0') {
243 if(!strcasecmp(tpc_model[i].code, s)) return(i);
244 i++;
245 }
246 return(0);
247}
248/*****************************************************************************/
249
250/*****************************************************************************/
255unsigned int modelParNr(
257 const unsigned int code
258) {
259 if(code<1 || code>=modelNr()) return(0);
260 return(tpc_model[code].parNr);
261}
262/*****************************************************************************/
263
264/*****************************************************************************/
char * modelCode(const unsigned int i)
Definition modell.c:175
char * modelDesc(const unsigned int i)
Definition modell.c:221
unsigned int modelParNr(const unsigned int code)
Definition modell.c:255
unsigned int modelOldId(const unsigned int i)
Definition modell.c:190
unsigned int modelOld2New(const unsigned int i)
Definition modell.c:204
unsigned int modelNr()
Definition modell.c:161
unsigned int modelCodeIndex(const char *s)
Definition modell.c:236
Header file for library libtpcextensions.
Header file for libtpcmodels.