#include <stdio.h>#include <stdlib.h>#include <math.h>#include "include/integr.h"#include "include/simulate.h"Go to the source code of this file.
Functions | |
| int | simC3s (double *t, double *ca, int nr, double k1, double k2, double k3, double k4, double k5, double k6, double *ct, double *cta, double *ctb, double *ctc) |
| int | simC3p (double *t, double *ca, int nr, double k1, double k2, double k3, double k4, double k5, double k6, double *ct, double *cta, double *ctb, double *ctc) |
| int | simC3vs (double *t, double *ca, double *cb, int nr, double k1, double k2, double k3, double k4, double k5, double k6, double f, double vb, double fa, double *cpet, double *cta, double *ctb, double *ctc, double *ctab, double *ctvb) |
| int | simC3vp (double *t, double *ca, double *cb, int nr, double k1, double k2, double k3, double k4, double k5, double k6, double f, double vb, double fa, double *cpet, double *cta, double *ctb, double *ctc, double *ctab, double *ctvb) |
| int | simC2l (double *t, double *ca, int nr, double k1, double k2, double k3, double kLoss, double *ct, double *cta, double *ctb) |
| int | simC2vl (double *t, double *ca, double *cb, int nr, double k1, double k2, double k3, double kL, double f, double vb, double fa, double *cpet, double *cta, double *ctb, double *ctab, double *ctvb) |
| int | simC3vpKLoss (double *t, double *ca, double *cb, int nr, double k1, double k2, double k3, double k4, double k5, double k6, double kLoss, double f, double vb, double fa, double *cpet, double *cta, double *ctb, double *ctc, double *ctab, double *ctvb) |
| int | simRTCM (double *t, double *cr, int nr, double R1, double k2, double k3, double k4, double *ct, double *cta, double *ctb) |
| int | simSRTM (double *t, double *cr, int nr, double R1, double k2, double BP, double *ct) |
| int | simTRTM (double *t, double *cr, int nr, double R1, double k2, double k3, double *ct) |
| int | simHuangmet (double *t, double *ctot, int nr, double k01, double k12, double k21, double k03, double k34, double k43, double *c0, double *c1, double *c3) |
| int | simTPCMOD0009c (double *t, double *ctot, int nr, double km, double k1m, double k2m, double k3m, double k4m, double *ca, double *cm) |
| int | simMBF (double *t, double *ci, int nr, double k1, double k2, double Vfit, double *ct) |
| int | simC1 (double *t, double *ca, int nr, double k1, double k2, double *ct) |
| int | simC3DIvs (double *t, double *ca1, double *ca2, double *cb, int nr, double k1, double k2, double k3, double k4, double k5, double k6, 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 | simDispersion (double *x, double *y, int n, double tau1, double tau2, double *tmp) |
| int simC1 | ( | double * | t, |
| double * | ca, | ||
| int | nr, | ||
| double | k1, | ||
| double | k2, | ||
| double * | ct | ||
| ) |
Simulates tissue TAC using 1 tissue compartment model plasma TAC, at plasma TAC times.
Memory for ct must be allocated in the calling program.
The units of rate constants must be related to the time unit; 1/min and min, or 1/sec and sec.
| t | Array of time values |
| ca | Array of arterial activities |
| nr | Number of values in TACs |
| k1 | Rate constant of the model |
| k2 | Rate constant of the model |
| ct | Pointer for TAC array to be simulated; must be allocated |
Definition at line 1368 of file simulate.c.
Referenced by simDispersion().
| int simC2l | ( | double * | t, |
| double * | ca, | ||
| int | nr, | ||
| double | k1, | ||
| double | k2, | ||
| double | k3, | ||
| double | kLoss, | ||
| double * | ct, | ||
| double * | cta, | ||
| double * | ctb | ||
| ) |
Simulates tissue TAC using 2 tissue compartment model (in series) and plasma TAC, at plasma TAC times. In contrary to the common model, kLoss represents a direct loss rate from the 2nd tissue compartment to venous plasma.
Memory for ct must be allocated in the calling program. To retrieve the separate tissue compartment TACs, pointer to allocated memory for cta and ctb can be given; if compartmental TACs are not required, NULL pointer can be given instead.
The units of rate constants must be related to the time unit; 1/min and min, or 1/sec and sec.
| t | Array of time values |
| ca | Array of arterial activities |
| nr | Number of values in TACs |
| k1 | Rate constant of the model |
| k2 | Rate constant of the model |
| k3 | Rate constant of the model |
| kLoss | Rate constant of the model |
| ct | Pointer for TAC array to be simulated; must be allocated |
| cta | Pointer for 1st compartment TAC to be simulated, or NULL |
| ctb | Pointer for 2nd compartment TAC to be simulated, or NULL |
Definition at line 562 of file simulate.c.
| int simC2vl | ( | double * | t, |
| double * | ca, | ||
| double * | cb, | ||
| int | nr, | ||
| double | k1, | ||
| double | k2, | ||
| double | k3, | ||
| double | kL, | ||
| double | f, | ||
| double | vb, | ||
| double | fa, | ||
| double * | cpet, | ||
| double * | cta, | ||
| double * | ctb, | ||
| double * | ctab, | ||
| double * | ctvb | ||
| ) |
Simulates tissue TAC using 2 tissue compartment model and plasma TAC, at plasma TAC times, considering also arterial and venous vasculature. The efflux from 2nd tissue compartment (at rate kL) goes directly to blood.
Memory for cpet must be allocated in the calling program. To retrieve the separate tissue compartment TACs, pointer to allocated memory for cta, ctb, ctab and/or ctvb can be given; if compartmental TACs are not required, NULL pointer can be given instead.
The units of rate constants must be related to the time unit; 1/min and min, or 1/sec and sec.
If blood flow is set to 0, function assumes that f>>k1, and Cvb=Cab.,
| t | Array of time values |
| ca | Array of arterial plasma activities |
| cb | Array of arterial blood activities |
| nr | Number of values in TACs |
| k1 | Rate constant of the model |
| k2 | Rate constant of the model |
| k3 | Rate constant of the model |
| kL | Rate constant of the model |
| f | Blood flow; if 0, function assumes that f>>k1, and Cvb=Cab. |
| vb | Vascular volume fraction |
| fa | Arterial fraction of vascular volume |
| cpet | Pointer for TAC array to be simulated; must be allocated |
| cta | Pointer for 1st compartment TAC to be simulated, or NULL |
| ctb | Pointer for 2nd compartment TAC to be simulated, or NULL |
| ctab | Pointer for arterial TAC in tissue, or NULL |
| ctvb | Pointer for venous TAC in tissue, or NULL |
Definition at line 652 of file simulate.c.
| int simC3DIvs | ( | double * | t, |
| double * | ca1, | ||
| double * | ca2, | ||
| double * | cb, | ||
| int | nr, | ||
| double | k1, | ||
| double | k2, | ||
| double | k3, | ||
| double | k4, | ||
| double | k5, | ||
| double | k6, | ||
| double | k1b, | ||
| double | k2b, | ||
| double | f, | ||
| double | vb, | ||
| double | fa, | ||
| double * | scpet, | ||
| double * | sct1, | ||
| double * | sct2, | ||
| double * | sct3, | ||
| double * | sct1b, | ||
| double * | sctab, | ||
| double * | sctvb | ||
| ) |
Simulates tissue TAC using dual-input tissue compartment model (1-3 compartments in series for tracer1, and 1 compartment for tracer2) at plasma TAC times, considering also contribution of arterial and venous vasculature. The units of rate constants must be related to the time unit; 1/min and min, or 1/sec and sec. If blood flow is set to 0, function assumes that f>>k1, and Cvb=Cab.
| t | Array of time values |
| ca1 | Array of arterial plasma activities of tracer1 |
| ca2 | Array of arterial plasma activities of tracer1 |
| cb | Array of arterial blood activities |
| nr | Number of values in TACs |
| k1 | Rate constant of the model for tracer1 |
| k2 | Rate constant of the model for tracer1 |
| k3 | Rate constant of the model for tracer1 |
| k4 | Rate constant of the model for tracer1 |
| k5 | Rate constant of the model for tracer1 |
| k6 | Rate constant of the model for tracer1 |
| k1b | Rate constant of the model for tracer2 |
| k2b | Rate constant of the model for tracer2 |
| f | Blood flow; if 0, function assumes that f>>k1, and Cvb=Cab. |
| vb | Vascular volume fraction |
| fa | Arterial fraction of vascular volume |
| scpet | Pointer for TAC array to be simulated; must be allocated |
| sct1 | Pointer for 1st tracer1 compartment TAC, or NULL if not needed |
| sct2 | Pointer for 2nd tracer1 compartment TAC, or NULL if not needed |
| sct3 | Pointer for 3rd tracer1 compartment TAC, or NULL if not needed |
| sct1b | Pointer for 1st tracer2 compartment TAC, or NULL if not needed |
| sctab | Pointer for arterial TAC in tissue, or NULL if not needed |
| sctvb | Pointer for venous TAC in tissue, or NULL if not needed |
Definition at line 1436 of file simulate.c.
| int simC3p | ( | double * | t, |
| double * | ca, | ||
| int | nr, | ||
| double | k1, | ||
| double | k2, | ||
| double | k3, | ||
| double | k4, | ||
| double | k5, | ||
| double | k6, | ||
| double * | ct, | ||
| double * | cta, | ||
| double * | ctb, | ||
| double * | ctc | ||
| ) |
Simulates tissue TAC using 1-3 tissue compartment model (2nd and 3rd compartments in parallel) and plasma TAC, at plasma TAC times.
Memory for ct must be allocated in the calling program. To retrieve the separate tissue compartment TACs, pointer to allocated memory for cta, ctb and/or ctc can be given; if compartmental TACs are not required, NULL pointer can be given instead.
The units of rate constants must be related to the time unit; 1/min and min, or 1/sec and sec.
| t | Array of time values |
| ca | Array of arterial activities |
| nr | Number of values in TACs |
| k1 | Rate constant of the model |
| k2 | Rate constant of the model |
| k3 | Rate constant of the model |
| k4 | Rate constant of the model |
| k5 | Rate constant of the model |
| k6 | Rate constant of the model |
| ct | Pointer for TAC array to be simulated; must be allocated |
| cta | Pointer for 1st compartment TAC to be simulated, or NULL |
| ctb | Pointer for 2nd compartment TAC to be simulated, or NULL |
| ctc | Pointer for 3rd compartment TAC to be simulated, or NULL |
Definition at line 203 of file simulate.c.
| int simC3s | ( | double * | t, |
| double * | ca, | ||
| int | nr, | ||
| double | k1, | ||
| double | k2, | ||
| double | k3, | ||
| double | k4, | ||
| double | k5, | ||
| double | k6, | ||
| double * | ct, | ||
| double * | cta, | ||
| double * | ctb, | ||
| double * | ctc | ||
| ) |
Simulates tissue TAC using 1-3 tissue compartment model (in series) and plasma TAC, at plasma TAC times.
Memory for ct must be allocated in the calling program. To retrieve the separate tissue compartment TACs, pointer to allocated memory for cta, ctb and/or ctc can be given; if compartmental TACs are not required, NULL pointer can be given instead.
The units of rate constants must be related to the time unit; 1/min and min, or 1/sec and sec.
| t | Array of time values |
| ca | Array of arterial activities |
| nr | Number of values in TACs |
| k1 | Rate constant of the model |
| k2 | Rate constant of the model |
| k3 | Rate constant of the model |
| k4 | Rate constant of the model |
| k5 | Rate constant of the model |
| k6 | Rate constant of the model |
| ct | Pointer for TAC array to be simulated; must be allocated |
| cta | Pointer for 1st compartment TAC to be simulated, or NULL |
| ctb | Pointer for 2nd compartment TAC to be simulated, or NULL |
| ctc | Pointer for 3rd compartment TAC to be simulated, or NULL |
Definition at line 94 of file simulate.c.
References SIMULATE_TEST.
| int simC3vp | ( | double * | t, |
| double * | ca, | ||
| double * | cb, | ||
| int | nr, | ||
| double | k1, | ||
| double | k2, | ||
| double | k3, | ||
| double | k4, | ||
| double | k5, | ||
| double | k6, | ||
| double | f, | ||
| double | vb, | ||
| double | fa, | ||
| double * | cpet, | ||
| double * | cta, | ||
| double * | ctb, | ||
| double * | ctc, | ||
| double * | ctab, | ||
| double * | ctvb | ||
| ) |
Simulates tissue TAC using 1-3 tissue compartment model (2nd and 3rd compartments in parallel) and plasma TAC, at plasma TAC times, considering also arterial and venous vasculature.
Memory for cpet must be allocated in the calling program. To retrieve the separate tissue compartment TACs, pointer to allocated memory for cta, ctb, ctc, ctab and/or ctvb can be given; if compartmental TACs are not required, NULL pointer can be given instead.
The units of rate constants must be related to the time unit; 1/min and min, or 1/sec and sec.
If blood flow is set to 0, function assumes that f>>k1, and Cvb=Cab.,
| t | Array of time values |
| ca | Array of arterial plasma activities |
| cb | Array of arterial blood activities |
| nr | Number of values in TACs |
| k1 | Rate constant of the model |
| k2 | Rate constant of the model |
| k3 | Rate constant of the model |
| k4 | Rate constant of the model |
| k5 | Rate constant of the model |
| k6 | Rate constant of the model |
| f | Blood flow; if 0, function assumes that f>>k1, and Cvb=Cab. |
| vb | Vascular volume fraction |
| fa | Arterial fraction of vascular volume |
| cpet | Pointer for TAC array to be simulated; must be allocated |
| cta | Pointer for 1st compartment TAC to be simulated, or NULL |
| ctb | Pointer for 2nd compartment TAC to be simulated, or NULL |
| ctc | Pointer for 3rd compartment TAC to be simulated, or NULL |
| ctab | Pointer for arterial TAC in tissue, or NULL |
| ctvb | Pointer for venous TAC in tissue, or NULL |
Definition at line 437 of file simulate.c.
| int simC3vpKLoss | ( | double * | t, |
| double * | ca, | ||
| double * | cb, | ||
| int | nr, | ||
| double | k1, | ||
| double | k2, | ||
| double | k3, | ||
| double | k4, | ||
| double | k5, | ||
| double | k6, | ||
| double | kLoss, | ||
| double | f, | ||
| double | vb, | ||
| double | fa, | ||
| double * | cpet, | ||
| double * | cta, | ||
| double * | ctb, | ||
| double * | ctc, | ||
| double * | ctab, | ||
| double * | ctvb | ||
| ) |
Simulates tissue TAC using 3 tissue compartmental model with two parallel compartments, and plasma TAC, at plasma TAC sample times, considering also arterial and venous vasculature. The efflux from 3rd tissue compartment (C) goes directly to blood at rate kLoss.
Memory for cpet must be allocated in the calling program. To retrieve the separate tissue compartment TACs, pointer to allocated memory for cta, ctb, ctab and/or ctvb can be given; if compartmental TACs are not required, NULL pointer can be given instead.
The units of rate constants must be related to the time unit; 1/min and min, or 1/sec and sec.
If blood flow is set to 0, function assumes that f>>k1, and Cvb=Cab.,
| t | Array of sample times |
| ca | Array of arterial plasma activities |
| cb | Array of arterial blood activities |
| nr | Number of sample values in TACs |
| k1 | Rate constant of the model |
| k2 | Rate constant of the model |
| k3 | Rate constant of the model |
| k4 | Rate constant of the model |
| k5 | Rate constant of the model |
| k6 | Rate constant of the model |
| kLoss | Rate constant of the model |
| f | Blood flow; if 0, function assumes that f>>k1, and Cvb=Cab. |
| vb | Vascular volume fraction |
| fa | Arterial fraction of vascular volume |
| cpet | Pointer for TAC array to be simulated; must be allocated |
| cta | Pointer for 1st tissue compartment TAC to be simulated, or NULL |
| ctb | Pointer for 2nd compartment TAC to be simulated, or NULL |
| ctc | Pointer for 3rd compartment TAC to be simulated, or NULL |
| ctab | Pointer for arterial TAC in tissue, or NULL |
| ctvb | Pointer for venous TAC in tissue, or NULL |
Definition at line 765 of file simulate.c.
| int simC3vs | ( | double * | t, |
| double * | ca, | ||
| double * | cb, | ||
| int | nr, | ||
| double | k1, | ||
| double | k2, | ||
| double | k3, | ||
| double | k4, | ||
| double | k5, | ||
| double | k6, | ||
| double | f, | ||
| double | vb, | ||
| double | fa, | ||
| double * | cpet, | ||
| double * | cta, | ||
| double * | ctb, | ||
| double * | ctc, | ||
| double * | ctab, | ||
| double * | ctvb | ||
| ) |
Simulates tissue TAC using 1-3 tissue compartment model (in series) and plasma TAC, at plasma TAC times, considering also arterial and venous vasculature.
Memory for cpet must be allocated in the calling program. To retrieve the separate tissue compartment TACs, pointer to allocated memory for cta, ctb, ctc, ctab and/or ctvb can be given; if compartmental TACs are not required, NULL pointer can be given instead.
The units of rate constants must be related to the time unit; 1/min and min, or 1/sec and sec.
If blood flow is set to 0, function assumes that f>>k1, and Cvb=Cab.,
| t | Array of time values |
| ca | Array of arterial plasma activities |
| cb | Array of arterial blood activities |
| nr | Number of values in TACs |
| k1 | Rate constant of the model |
| k2 | Rate constant of the model |
| k3 | Rate constant of the model |
| k4 | Rate constant of the model |
| k5 | Rate constant of the model |
| k6 | Rate constant of the model |
| f | Blood flow; if 0, function assumes that f>>k1, and Cvb=Cab. |
| vb | Vascular volume fraction |
| fa | Arterial fraction of vascular volume |
| cpet | Pointer for TAC array to be simulated; must be allocated |
| cta | Pointer for 1st compartment TAC to be simulated, or NULL |
| ctb | Pointer for 2nd compartment TAC to be simulated, or NULL |
| ctc | Pointer for 3rd compartment TAC to be simulated, or NULL |
| ctab | Pointer for arterial TAC in tissue, or NULL |
| ctvb | Pointer for venous TAC in tissue, or NULL |
Definition at line 309 of file simulate.c.
| int simDispersion | ( | double * | x, |
| double * | y, | ||
| int | n, | ||
| double | tau1, | ||
| double | tau2, | ||
| double * | tmp | ||
| ) |
Simulate the effect of dispersion on a time-activity curve.
| x | Array of sample times |
| y | Array of sample values, which will be replaced here by dispersion added values |
| n | Nr of samples |
| tau1 | First dispersion time constant (zero if no dispersion); in same time unit as sample times |
| tau2 | 2nd dispersion time constant (zero if no dispersion); in same time unit as sample times |
| tmp | Array for temporary data, for at least n samples |
Definition at line 1569 of file simulate.c.
References simC1().
| int simHuangmet | ( | double * | t, |
| double * | ctot, | ||
| int | nr, | ||
| double | k01, | ||
| double | k12, | ||
| double | k21, | ||
| double | k03, | ||
| double | k34, | ||
| double | k43, | ||
| double * | c0, | ||
| double * | c1, | ||
| double * | c3 | ||
| ) |
Simulation of TACs of parent tracer, and 1-2 of its metabolites in plasma using Huang's compartmental model.
The units of model parameters must be related to the sample time unit; 1/min and min, or 1/sec and sec.
Pointers to memory for output TACs must be specified, or NULL if TAC is not needed.
| t | Input: Sample times (preferably with short intervals) |
| ctot | Input: Measured total plasma TAC |
| nr | Input: Nr of samples |
| k01 | Input: Model parameters |
| k12 | Input: Model parameters |
| k21 | Input: Model parameters |
| k03 | Input: Model parameters |
| k34 | Input: Model parameters |
| k43 | Input: Model parameters |
| c0 | Output: unchanged (parent) tracer TAC |
| c1 | Output: TAC of the 1st metabolite |
| c3 | Output: TAC of the 2nd metabolite |
Definition at line 1105 of file simulate.c.
References SIMULATE_TEST.
| int simMBF | ( | double * | t, |
| double * | ci, | ||
| int | nr, | ||
| double | k1, | ||
| double | k2, | ||
| double | Vfit, | ||
| double * | ct | ||
| ) |
Simulate myocardial tissue TAC using Iida's compartment model. Memory for ct must be allocated in the calling program. The units of rate constants must be related to the time unit; 1/min and min, or 1/sec and sec. Function returns 0 when succesful, else a value >= 1.
| t | Array of time values |
| ci | Input activities |
| nr | Number of values in TACs |
| k1 | Apparent k1 |
| k2 | Apparent k2 |
| Vfit | Vfit |
| ct | Pointer for TAC array to be simulated; must be allocated |
Definition at line 1305 of file simulate.c.
| int simRTCM | ( | double * | t, |
| double * | cr, | ||
| int | nr, | ||
| double | R1, | ||
| double | k2, | ||
| double | k3, | ||
| double | k4, | ||
| double * | ct, | ||
| double * | cta, | ||
| double * | ctb | ||
| ) |
Simulates tissue TAC using reference tissue compartment model (original) and reference region TAC, at reference region TAC times.
Memory for ct must be allocated in the calling program. To retrieve the separate tissue compartment TACs, pointer to allocated memory for cf and/or cb can be given; if compartmental TACs are not required, NULL pointer can be given instead.
The units of rate constants must be related to the time unit; 1/min and min, or 1/sec and sec.
| t | Array of time values |
| cr | Reference region activities |
| nr | Number of values in TACs |
| R1 | Ratio K1/K1' |
| k2 | Rate constant of the model |
| k3 | Rate constant of the model |
| k4 | Rate constant of the model |
| ct | Pointer for TAC array to be simulated; must be allocated |
| cta | Pointer for 1st compartment TAC to be simulated, or NULL |
| ctb | Pointer for 2nd compartment TAC to be simulated, or NULL |
Definition at line 891 of file simulate.c.
| int simSRTM | ( | double * | t, |
| double * | cr, | ||
| int | nr, | ||
| double | R1, | ||
| double | k2, | ||
| double | BP, | ||
| double * | ct | ||
| ) |
Simulates tissue TAC using reference tissue compartment model (simplified) and reference region TAC, at reference region TAC times.
Memory for ct must be allocated in the calling program.
The units of rate constants must be related to the time unit; 1/min and min, or 1/sec and sec.
| t | Array of time values |
| cr | Reference region activities |
| nr | Number of values in TACs |
| R1 | Ratio K1/K1' |
| k2 | Rate constant of the model |
| BP | Binding potential |
| ct | Pointer for TAC array to be simulated; must be allocated |
Definition at line 973 of file simulate.c.
| int simTPCMOD0009c | ( | double * | t, |
| double * | ctot, | ||
| int | nr, | ||
| double | km, | ||
| double | k1m, | ||
| double | k2m, | ||
| double | k3m, | ||
| double | k4m, | ||
| double * | ca, | ||
| double * | cm | ||
| ) |
Simulate parent tracer TAC using plasma metabolite model TPCMOD0009C, http://www.turkupetcentre.net/reports/tpcmod0009_app_c.pdf
| t | Sample times |
| ctot | Total plasma TAC |
| nr | Sample number |
| km | km |
| k1m | k1m |
| k2m | k2m |
| k3m | k3m |
| k4m | k4m |
| ca | Pointer to array where parent tracer TAC will be written; NULL, if not needed. |
| cm | Pointer to array where metabolized tracer TAC will be written; NULL, if not needed. |
Definition at line 1217 of file simulate.c.
| int simTRTM | ( | double * | t, |
| double * | cr, | ||
| int | nr, | ||
| double | R1, | ||
| double | k2, | ||
| double | k3, | ||
| double * | ct | ||
| ) |
Simulates tissue TAC using reference tissue compartment model (transport limited in ref region) and reference region TAC, at reference region TAC times.
Memory for ct must be allocated in the calling program.
The units of rate constants must be related to the time unit; 1/min and min, or 1/sec and sec.
| t | Array of time values |
| cr | Reference region activities |
| nr | Number of values in TACs |
| R1 | Ratio K1/K1' |
| k2 | Rate constant of the model |
| k3 | Rate constant of the model |
| ct | Pointer for TAC array to be simulated; must be allocated |
Definition at line 1039 of file simulate.c.
1.8.0