|
TPCCLIB
|
Header file for libtpccm. More...
#include "tpcclibConfig.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>Go to the source code of this file.
Data Structures | |
| struct | ICMPARC |
Functions | |
| int | simMBF (double *t, double *ci, const int nr, const double k1, const double k2, const double Vfit, double *ct) |
| int | simC1 (double *t, double *ca, const int nr, const double k1, const double k2, double *ct) |
| int | simC1_i (double *t, double *cai, const int nr, const double k1, const double k2, double *ct) |
| int | simC1_d (double *t, double *ca, const int nr, const double k1, const double k2, double *ct) |
| int | simC2 (double *t, double *ca, const int nr, const double k1, const double k2, const double k3, const double k4, double *ct, double *cta, double *ctb) |
| int | simC2_i (double *t, double *cai, const int nr, const double k1, const double k2, const double k3, const double k4, double *ct, double *cta, double *ctb) |
| int | simC3s (double *t, double *ca, const 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, const int nr, const double k1, const double k2, const double k3, const double k4, const double k5, const double k6, const double f, const double vb, const double fa, const int vvm, double *cpet, double *cta, double *ctb, double *ctc, double *ctab, double *ctvb) |
| int | simC3p (double *t, double *ca, const int nr, const double k1, const double k2, const double k3, const double k4, const double k5, const double k6, double *ct, double *cta, double *ctb, double *ctc) |
| int | simC3vp (double *t, double *ca, double *cb, const int nr, const double k1, const double k2, const double k3, const double k4, const double k5, const double k6, const double f, const double vb, const double fa, const int vvm, double *cpet, double *cta, double *ctb, double *ctc, double *ctab, double *ctvb) |
| int | simC2l (double *t, double *ca, const int nr, const double k1, const double k2, const double k3, const double kLoss, double *ct, double *cta, double *ctb) |
| int | simC2vl (double *t, double *ca, double *cb, const int nr, const double k1, const double k2, const double k3, const double kL, const double f, const double vb, const double fa, const int vvm, double *cpet, double *cta, double *ctb, double *ctab, double *ctvb) |
| int | simC3vpKLoss (double *t, double *ca, double *cb, const int nr, const double k1, const double k2, const double k3, const double k4, const double k5, const double k6, const double kLoss, const double f, const double vb, const double fa, const int vvm, double *cpet, double *cta, double *ctb, double *ctc, double *ctab, double *ctvb) |
| int | simRTCM (double *t, double *cr, const int nr, const double R1, const double k2, const double k3, const double k4, double *ct, double *cta, double *ctb) |
| int | simSRTM (double *t, double *cr, const int nr, const double R1, const double k2, const double BP, double *ct) |
| int | simTRTM (double *t, double *cr, const int nr, const double R1, const double k2, double k3, double *ct) |
| int | simC1DI (double *t, double *cba, double *cbb, const int nr, const double k1a, const double k1b, const double k2, double *ct) |
| int | simC3DIvs (double *t, double *ca1, double *ca2, double *cb, const int nr, const double k1, const double k2, const double k3, const double k4, const double k5, const double k6, const double k1b, const double k2b, const double f, const double vb, const double fa, const int vvm, double *scpet, double *sct1, double *sct2, double *sct3, double *sct1b, double *sctab, double *sctvb) |
| int | simC4DIvp (double *t, double *ca1, double *ca2, double *cb, const int nr, const double k1, const double k2, const double k3, const double k4, const double k5, const double k6, const double k7, const double km, const double k1b, const double k2b, const double f, const double vb, const double fa, const int vvm, double *scpet, double *sct1, double *sct2, double *sct3, double *sct1b, double *sctab, double *sctvb, const int verbose) |
| int | simC4DIvs (double *t, double *ca1, double *ca2, double *cb, const int nr, const double k1, const double k2, const double k3, const double k4, const double k5, const double k6, const double k7, const double km, const double k1b, const double k2b, const double f, const double vb, const double fa, const int vvm, double *scpet, double *sct1, double *sct2, double *sct3, double *sct1b, double *sctab, double *sctvb, const int verbose) |
| int | simDispersion (double *x, double *y, const int n, const double tau1, const double tau2, double *tmp) |
| int | corDispersion (double *x, double *y, const int n, const double tau, double *tmp) |
| int | simTTM (double *t, double *c0, const int n, const double k, const int cn, double *cout) |
| int | simTTM_i (double *t, double *c0i, const int n, const double k, const int cn, double *cout) |
| int | simOxygen (double *t, double *ca1, double *ca2, double *ca1i, double *ca2i, const int n, const double k1a, const double k2a, const double km, const double k1b, const double k2b, const double vb, const double fa, const int vvm, double *scpet, double *sct1, double *sct2, double *sctab, double *sctvb1, double *sctvb2, double *scvb1, double *scvb2, const int verbose) |
| int | convolve1D (double *data, const int n, double *kernel, const int m, double *out) |
| Calculates the convolution sum of a discrete real data set data[0..n-1] and a discretized response function kernel[0..m]. | |
| int | simIsSteadyInterval (double *x, const int n, double *f) |
| void | icmparcInit (ICMPARC *d) |
| int | icmparcAddMetabolites (ICMPARC *d, unsigned const int mNr) |
| int | icmparcAllocateTACs (ICMPARC *d, unsigned const int sNr, const int sub) |
| void | icmparcFree (ICMPARC *d) |
| int | simBTAC (double *t, const unsigned int nr, ICMPARC *p, double *cb) |
| int | simBM1 (double *t, double *ct, const int nr, const double k, double *cp) |
Header file for libtpccm.
Header file for compartmental model library.
Definition in file tpccm.h.
| int convolve1D | ( | double * | data, |
| const int | n, | ||
| double * | kernel, | ||
| const int | m, | ||
| double * | out ) |
Calculates the convolution sum of a discrete real data set data[0..n-1] and a discretized response function kernel[0..m].
Convolution is not aware of the step size (default is 1); if step size is not 1 (it usually isn't), the step size must be taken into account either when computing the kernel or by scaling the convolution sum.
| data | Data array of length n-1 to be convolved, including any user-defined zero-padding. |
| n | Nr of data values. |
| kernel | Response function values in an array of length m. |
| m | Length of kernel array. |
| out | The convolved sum data is returned in out[0..n-1]; this must not overlap the input data. |
Definition at line 27 of file convolut.c.
| int corDispersion | ( | double * | x, |
| double * | y, | ||
| const int | n, | ||
| const double | tau, | ||
| double * | tmp ) |
Correct time-activity curve for the effect of dispersion.
Data must be noise-free and have very short sampling intervals. The units of rate constants must be related to the TAC time units; 1/min and min, or 1/sec and sec.
| x | Array of sample times; must be in increasing order and >=0. |
| y | Array of sample values, which will be replaced here by dispersion corrected values. |
| n | Nr of samples. |
| tau | Dispersion time constant (zero if no dispersion); in same time unit as sample times. |
| tmp | Array for temporary data, for at least n samples; enter NULL to let function to allocate and free the temporary space. |
Definition at line 88 of file simdispersion.c.
| int icmparcAddMetabolites | ( | ICMPARC * | d, |
| unsigned const int | mNr ) |
Add sub-structures for metabolite(s) in parent ICMPARC structure.
| d | Pointer to parent ICMPARC; can itself be a sub-structure. |
| mNr | Number of metabolites to add. |
Definition at line 43 of file simblood.c.
| int icmparcAllocateTACs | ( | ICMPARC * | d, |
| unsigned const int | sNr, | ||
| const int | sub ) |
Allocate space for optional TACs inside ICMPARC structure.
| d | Pointer to ICMPARC. |
| sNr | Number of TAC samples (array lengths); set to zero to just free previous data. |
| sub | Allocate (1) or do not allocate (0) space for TACs inside sub-structures. |
Definition at line 72 of file simblood.c.
Referenced by icmparcAllocateTACs().
| void icmparcFree | ( | ICMPARC * | d | ) |
Free memory that is (optionally) allocated inside the ICMPARC structure or in its sub-structures. Field values are not changed, except for pointers to allocated memory that are set to NULL.
| d | Pointer to ICMPARC. |
Definition at line 125 of file simblood.c.
Referenced by icmparcAddMetabolites(), and icmparcFree().
| void icmparcInit | ( | ICMPARC * | d | ) |
Initiate the ICMPARC structure before any use.
| d | Pointer to ICMPARC. |
Definition at line 20 of file simblood.c.
Referenced by icmparcAddMetabolites().
| int simBM1 | ( | double * | t, |
| double * | ct, | ||
| const int | nr, | ||
| const double | k, | ||
| double * | cp ) |
Calculate metabolite correct input curve from total input curve using simplistic 1K model dCmetabolite(t)/dt = k*Cparent(t) and since Ctotal(t) = Cparent(t) + Cmetabolite(t), we calculate metabolite corrected curve as dCparent(t)/dt = dCtotal(t)/dt - k*Cparent(t). Note that this model may result in negative parent values.
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. |
| ct | Array of total activities. |
| nr | Number of values in TACs. |
| k | Rate constant of the model. |
| cp | Pointer for metabolite corrected data array to be simulated; must be allocated. |
Definition at line 275 of file simblood.c.
| int simBTAC | ( | double * | t, |
| const unsigned int | nr, | ||
| ICMPARC * | p, | ||
| double * | c_BA ) |
Simulate BTAC using compartmental model. NOT FUNCTIONAL!
| t | Array of sample time values; must be non-negative and in increasing order. |
| nr | Number of values (samples) in TACs. |
| p | Pointer to data structure containing simulation parameters. |
| c_BA | Pointer for arterial BTAC array to be simulated; must be allocated. NULL can be given, if TAC space is allocated inside p structure. |
Definition at line 154 of file simblood.c.
| int simC1 | ( | double * | t, |
| double * | ca, | ||
| const int | nr, | ||
| const double | k1, | ||
| const double | k2, | ||
| double * | ct ) |
Simulate tissue TAC using 1 tissue compartmental model and 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 93 of file sim1cm.c.
Referenced by bfm1TCM(), and simDispersion().
| int simC1_d | ( | double * | t, |
| double * | ca, | ||
| const int | nr, | ||
| const double | k1, | ||
| const double | k2, | ||
| double * | ct ) |
Simulate tissue TAC using 1 tissue compartmental model and input TAC, at input TAC times.
This version is directly based on ODE, and does not use integral of input TAC.
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 229 of file sim1cm.c.
| int simC1_i | ( | double * | t, |
| double * | cai, | ||
| const int | nr, | ||
| const double | k1, | ||
| const double | k2, | ||
| double * | ct ) |
Simulate tissue TAC using 1 tissue compartmental model and plasma TAC, at plasma TAC times.
This version uses integral of arterial TAC as input function. Only advantage over simC1() is that the calculation of integral can be fully controlled and possibly more precise in some situations.
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. |
| cai | Array of AUC 0-t 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 164 of file sim1cm.c.
| int simC1DI | ( | double * | t, |
| double * | cba, | ||
| double * | cbb, | ||
| const int | nr, | ||
| const double | k1a, | ||
| const double | k1b, | ||
| const double | k2, | ||
| double * | ct ) |
Simulate tissue TAC using dual-input tissue compartment model with a single tissue compartment.
Simulates tissue TAC using dual-input tissue compartment model (1 compartment, common for both inputs) at input TAC times. Vascular volume is not accounted for. 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. |
| cba | Array of concentrations of input A. |
| cbb | Array of concentrations of input B. |
| nr | Number of values in TACs. |
| k1a | Rate constant of the model for input A (from blood to C1). |
| k1b | Rate constant of the model for input B (from blood to C1). |
| k2 | Rate constant of the model (from C1 to blood). |
| ct | Pointer for TAC array to be simulated; must be allocated. |
Definition at line 30 of file simdicm.c.
| int simC2 | ( | double * | t, |
| double * | ca, | ||
| const int | nr, | ||
| const double | k1, | ||
| const double | k2, | ||
| const double | k3, | ||
| const double | k4, | ||
| double * | ct, | ||
| double * | cta, | ||
| double * | ctb ) |
Simulate tissue TAC using two-tissue compartment model 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 and/or 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. |
| 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 31 of file sim2cm.c.
| int simC2_i | ( | double * | t, |
| double * | cai, | ||
| const int | nr, | ||
| const double | k1, | ||
| const double | k2, | ||
| const double | k3, | ||
| const double | k4, | ||
| double * | ct, | ||
| double * | cta, | ||
| double * | ctb ) |
Simulate tissue TAC using two-tissue compartment model 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 and/or 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.
This version uses integral of arterial TAC as input function. Only advantage over simC2() is that the calculation of integral can be fully controlled and possibly more precise in some situations.
| t | Array of time values. |
| cai | Array of AUC 0-t 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. |
| 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 124 of file sim2cm.c.
| int simC2l | ( | double * | t, |
| double * | ca, | ||
| const int | nr, | ||
| const double | k1, | ||
| const double | k2, | ||
| const double | k3, | ||
| const double | kLoss, | ||
| double * | ct, | ||
| double * | cta, | ||
| double * | ctb ) |
Simulate 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 169 of file simkloss.c.
| int simC2vl | ( | double * | t, |
| double * | ca, | ||
| double * | cb, | ||
| const int | nr, | ||
| const double | k1, | ||
| const double | k2, | ||
| const double | k3, | ||
| const double | kL, | ||
| const double | f, | ||
| const double | vb, | ||
| const double | fa, | ||
| const int | vvm, | ||
| double * | cpet, | ||
| double * | cta, | ||
| double * | ctb, | ||
| double * | ctab, | ||
| double * | ctvb ) |
Simulate 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. |
| vvm | Vascular volume modelling: set to 0 to use Cpet = Vb*Cb + (1-Vb)*Ct, or set to 1 to use Cpet = Vb*Cb + Ct. |
| 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 261 of file simkloss.c.
| int simC3DIvs | ( | double * | t, |
| double * | ca1, | ||
| double * | ca2, | ||
| double * | cb, | ||
| const int | nr, | ||
| const double | k1, | ||
| const double | k2, | ||
| const double | k3, | ||
| const double | k4, | ||
| const double | k5, | ||
| const double | k6, | ||
| const double | k1b, | ||
| const double | k2b, | ||
| const double | f, | ||
| const double | vb, | ||
| const double | fa, | ||
| const int | vvm, | ||
| double * | scpet, | ||
| double * | sct1, | ||
| double * | sct2, | ||
| double * | sct3, | ||
| double * | sct1b, | ||
| double * | sctab, | ||
| double * | sctvb ) |
Simulate tissue TAC using dual-input tissue compartment model with compartments in series.
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, but no exchange between compartments for tracer1 and tracer2. 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 tracer2. |
| cb | Array of arterial blood activities. |
| nr | Number of values in TACs. |
| k1 | Rate constant of the model for tracer1 (from plasma to C1). |
| k2 | Rate constant of the model for tracer1 (from C1 to plasma). |
| k3 | Rate constant of the model for tracer1 (from C1 to C2). |
| k4 | Rate constant of the model for tracer1 (from C2 to C1). |
| k5 | Rate constant of the model for tracer1 (from C2 to C3). |
| k6 | Rate constant of the model for tracer1 (from C3 to C2). |
| k1b | Rate constant of the model for tracer2 (from plasma to C4). |
| k2b | Rate constant of the model for tracer2 (from C4 to plasma). |
| f | Blood flow; if 0, function assumes that f>>k1, and Cvb=Cab. |
| vb | Vascular volume fraction. |
| fa | Arterial fraction of vascular volume. |
| vvm | Vascular volume modelling: set to 0 to use Cpet = Vb*Cb + (1-Vb)*Ct, or set to 1 to use Cpet = Vb*Cb + Ct. |
| 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 101 of file simdicm.c.
| int simC3p | ( | double * | t, |
| double * | ca, | ||
| const int | nr, | ||
| const double | k1, | ||
| const double | k2, | ||
| const double | k3, | ||
| const double | k4, | ||
| const double | k5, | ||
| const double | k6, | ||
| double * | ct, | ||
| double * | cta, | ||
| double * | ctb, | ||
| double * | ctc ) |
Simulate 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 33 of file sim3cmp.c.
| int simC3s | ( | double * | t, |
| double * | ca, | ||
| const int | nr, | ||
| double | k1, | ||
| double | k2, | ||
| double | k3, | ||
| double | k4, | ||
| double | k5, | ||
| double | k6, | ||
| double * | ct, | ||
| double * | cta, | ||
| double * | ctb, | ||
| double * | ctc ) |
Simulate tissue TAC using 1-3 tissue compartment model (compartments 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 32 of file sim3cms.c.
| int simC3vp | ( | double * | t, |
| double * | ca, | ||
| double * | cb, | ||
| const int | nr, | ||
| const double | k1, | ||
| const double | k2, | ||
| const double | k3, | ||
| const double | k4, | ||
| const double | k5, | ||
| const double | k6, | ||
| const double | f, | ||
| const double | vb, | ||
| const double | fa, | ||
| const int | vvm, | ||
| double * | cpet, | ||
| double * | cta, | ||
| double * | ctb, | ||
| double * | ctc, | ||
| double * | ctab, | ||
| double * | ctvb ) |
Simulate 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 ct 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. |
| vvm | Vascular volume modelling: set to 0 to use Cpet = Vb*Cb + (1-Vb)*Ct, or set to 1 to use Cpet = Vb*Cb + Ct. |
| 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 140 of file sim3cmp.c.
| int simC3vpKLoss | ( | double * | t, |
| double * | ca, | ||
| double * | cb, | ||
| const int | nr, | ||
| const double | k1, | ||
| const double | k2, | ||
| const double | k3, | ||
| const double | k4, | ||
| const double | k5, | ||
| const double | k6, | ||
| const double | kLoss, | ||
| const double | f, | ||
| const double | vb, | ||
| const double | fa, | ||
| const int | vvm, | ||
| double * | cpet, | ||
| double * | cta, | ||
| double * | ctb, | ||
| double * | ctc, | ||
| double * | ctab, | ||
| double * | ctvb ) |
Simulate 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. |
| vvm | Vascular volume modelling: set to 0 to use Cpet = Vb*Cb + (1-Vb)*Ct, or set to 1 to use Cpet = Vb*Cb + Ct. |
| 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 36 of file simkloss.c.
| int simC3vs | ( | double * | t, |
| double * | ca, | ||
| double * | cb, | ||
| const int | nr, | ||
| const double | k1, | ||
| const double | k2, | ||
| const double | k3, | ||
| const double | k4, | ||
| const double | k5, | ||
| const double | k6, | ||
| const double | f, | ||
| const double | vb, | ||
| const double | fa, | ||
| const int | vvm, | ||
| double * | cpet, | ||
| double * | cta, | ||
| double * | ctb, | ||
| double * | ctc, | ||
| double * | ctab, | ||
| double * | ctvb ) |
Simulate tissue TAC using 1-3 tissue compartment model (compartments in series) and plasma TAC, at plasma TAC times, considering also arterial and venous vasculature.
Memory for ct 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. |
| vvm | Vascular volume modelling: set to 0 to use Cpet = Vb*Cb + (1-Vb)*Ct, or set to 1 to use Cpet = Vb*Cb + Ct. |
| 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 143 of file sim3cms.c.
| int simC4DIvp | ( | double * | t, |
| double * | ca1, | ||
| double * | ca2, | ||
| double * | cb, | ||
| const int | nr, | ||
| const double | k1, | ||
| const double | k2, | ||
| const double | k3, | ||
| const double | k4, | ||
| const double | k5, | ||
| const double | k6, | ||
| const double | k7, | ||
| const double | km, | ||
| double | k1b, | ||
| const double | k2b, | ||
| const double | f, | ||
| const double | vb, | ||
| double | fa, | ||
| const int | vvm, | ||
| double * | scpet, | ||
| double * | sct1, | ||
| double * | sct2, | ||
| double * | sct3, | ||
| double * | sct1b, | ||
| double * | sctab, | ||
| double * | sctvb, | ||
| const int | verbose ) |
Simulate tissue TAC using dual-input tissue compartment model (compartments 2 and 3 in parallel for tracer1, and 1 compartment for tracer2) at plasma TAC sample times, considering also contribution of arterial and venous vasculature, and transfer of tracer1 to tracer2.
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. Reference: TPCMOD0001 Appendix C. Tested with program p2t_di -parallel.
| t | Array of time values. |
| ca1 | Array of arterial plasma activities of tracer1 (parent tracer). |
| ca2 | Array of arterial plasma activities of tracer2 (metabolite). |
| cb | Array of (total) arterial blood activities. |
| nr | Number of values in TACs. |
| k1 | Rate constant of the model for tracer1 (from plasma to C1). |
| k2 | Rate constant of the model for tracer1 (from C1 to plasma). |
| k3 | Rate constant of the model for tracer1 (from C1 to C2). |
| k4 | Rate constant of the model for tracer1 (from C2 to C1). |
| k5 | Rate constant of the model for tracer1 (from C1 to C3). |
| k6 | Rate constant of the model for tracer1 (from C3 to C1). |
| k7 | Rate constant of the model for tracer1 (from C3 to plasma). |
| km | Rate constant of the model (from tracer1 in C1 to tracer2 in C4). |
| k1b | Rate constant of the model for tracer2 (from plasma to C4). |
| k2b | Rate constant of the model for tracer2 (from C4 to plasma). |
| f | Blood flow; if 0, function assumes that f>>k1, and Cvb=Cab. |
| vb | Vascular volume fraction (0<=Vb<1). |
| fa | Arterial fraction of vascular volume (0<=fa<=1). |
| vvm | Vascular volume modelling: set to 0 to use Cpet = Vb*Cb + (1-Vb)*Ct, or set to 1 to use Cpet = Vb*Cb + Ct. |
| 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. |
| verbose | Verbose level; if zero, then nothing is printed into stdout or stderr. |
Definition at line 251 of file simdicm.c.
| int simC4DIvs | ( | double * | t, |
| double * | ca1, | ||
| double * | ca2, | ||
| double * | cb, | ||
| const int | nr, | ||
| const double | k1, | ||
| const double | k2, | ||
| const double | k3, | ||
| const double | k4, | ||
| const double | k5, | ||
| const double | k6, | ||
| const double | k7, | ||
| const double | km, | ||
| double | k1b, | ||
| double | k2b, | ||
| double | f, | ||
| double | vb, | ||
| double | fa, | ||
| const int | vvm, | ||
| double * | scpet, | ||
| double * | sct1, | ||
| double * | sct2, | ||
| double * | sct3, | ||
| double * | sct1b, | ||
| double * | sctab, | ||
| double * | sctvb, | ||
| const int | verbose ) |
Simulate 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, and transfer of tracer1 to tracer2.
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. Reference: TPCMOD0001 Appendix B. Tested with program p2t_di -series.
| t | Array of time values. |
| ca1 | Array of arterial plasma activities of tracer1 (parent tracer). |
| ca2 | Array of arterial plasma activities of tracer2 (metabolite). |
| cb | Array of (total) arterial blood activities. |
| nr | Number of values in TACs. |
| k1 | Rate constant of the model for tracer1 (from plasma to C1). |
| k2 | Rate constant of the model for tracer1 (from C1 to plasma). |
| k3 | Rate constant of the model for tracer1 (from C1 to C2). |
| k4 | Rate constant of the model for tracer1 (from C2 to C1). |
| k5 | Rate constant of the model for tracer1 (from C2 to C3). |
| k6 | Rate constant of the model for tracer1 (from C3 to C2). |
| k7 | Rate constant of the model for tracer1 (from C3 to plasma). |
| km | Rate constant of the model (from tracer1 in C1 to tracer2 in C4). |
| k1b | Rate constant of the model for tracer2 (from plasma to C4). |
| k2b | Rate constant of the model for tracer2 (from C4 to plasma). |
| f | Blood flow; if 0, function assumes that f>>k1, and Cvb=Cab. |
| vb | Vascular volume fraction. |
| fa | Arterial fraction of vascular volume. |
| vvm | Vascular volume modelling: set to 0 to use Cpet = Vb*Cb + (1-Vb)*Ct, or set to 1 to use Cpet = Vb*Cb + Ct. |
| 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. |
| verbose | Verbose level; if zero, then nothing is printed into stdout or stderr. |
Definition at line 441 of file simdicm.c.
| int simDispersion | ( | double * | x, |
| double * | y, | ||
| const int | n, | ||
| const double | tau1, | ||
| const double | tau2, | ||
| double * | tmp ) |
Simulate the effect of dispersion on a time-activity curve.
The units of rate constants must be related to the TAC time units; 1/min and min, or 1/sec and sec.
| x | Array of sample times; must be in increasing order. |
| 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; enter NULL to let function to allocate and free the temporary space. |
Definition at line 26 of file simdispersion.c.
| int simIsSteadyInterval | ( | double * | x, |
| const int | n, | ||
| double * | f ) |
Check whether given values have steady intervals, with the first interval starting at zero. Optionally return the interval, or in case of uneven intervals, the shortest interval.
| x | Array of values to check; must be sorted in ascending order. |
| n | Size of the data array; at least two. |
| f | Pointer for the interval, either the common or the shortest interval; enter NULL, if not needed. |
Definition at line 66 of file convolut.c.
| int simMBF | ( | double * | t, |
| double * | ci, | ||
| const int | nr, | ||
| const double | k1, | ||
| const double | k2, | ||
| const 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.
| 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 28 of file sim1cm.c.
| int simOxygen | ( | double * | t, |
| double * | ca1, | ||
| double * | ca2, | ||
| double * | ca1i, | ||
| double * | ca2i, | ||
| const int | n, | ||
| const double | k1a, | ||
| const double | k2a, | ||
| const double | km, | ||
| const double | k1b, | ||
| const double | k2b, | ||
| const double | vb, | ||
| const double | fa, | ||
| const int | vvm, | ||
| double * | scpet, | ||
| double * | sct1, | ||
| double * | sct2, | ||
| double * | sctab, | ||
| double * | sctvb1, | ||
| double * | sctvb2, | ||
| double * | scvb1, | ||
| double * | scvb2, | ||
| const int | verbose ) |
Simulate tissue and venous blood TACs using dual-input compartment model for [O-15]O2 (one tissue compartment for [O-15]O2, and another tissue compartment for its metabolite [O-15]H2O). Based on Mintun et al. J Nucl Med. 1984;25(2):177-187.
The units of rate constants must be related to the time unit of the data; 1/min and min, or 1/sec and sec.
| t | Array of sample times. |
| ca1 | Array of arterial blood activities of tracer1 ([O-15]O2). |
| ca2 | Array of arterial blood activities of tracer2 ([O-15]H2O). |
| ca1i | Array of AUC 0-t of arterial tracer1 activities; NULL if not available. |
| ca2i | Array of AUC 0-t of arterial tracer2 activities; NULL if not available. |
| n | Nr of samples (array lengths). |
| k1a | Rate constant of the model for tracer1 (from blood to C1). |
| k2a | Rate constant of the model for tracer1 (from C1 to blood). |
| km | Rate constant of the model (from tracer1 in C1 to tracer2 in C2). |
| k1b | Rate constant of the model for tracer2 (from blood to C2). |
| k2b | Rate constant of the model for tracer2 (from C2 to blood). |
| vb | Vascular volume fraction [0-1]. |
| fa | Arterial fraction of vascular volume [0-1]. |
| vvm | Vascular volume modelling: set to 0 to use Cpet = Vb*Cb + (1-Vb)*Ct, or set to 1 to use Cpet = Vb*Cb + Ct. |
| scpet | Pointer for TTAC array to be simulated; allocate in the calling program or set to NULL if not needed. |
| sct1 | Simulated TAC of tracer1 in tissue; allocate in the calling program or set to NULL if not needed. |
| sct2 | Simulated TAC of tracer2 in tissue; allocate in the calling program or set to NULL if not needed. |
| sctab | Total arterial contribution to PET TTAC; allocate in the calling program or set to NULL if not needed. |
| sctvb1 | Venous tracer1 contribution to PET TAC; allocate in the calling program or set to NULL if not needed. |
| sctvb2 | Venous tarcer1 contribution to PET TAC; allocate in the calling program or set to NULL if not needed. |
| scvb1 | Venous BTAC of tracer1; allocate in the calling program or set to NULL if not needed. |
| scvb2 | Venous BTAC of tracer2; allocate in the calling program or set to NULL if not needed. |
| verbose | Verbose level; if zero, then nothing is printed into stdout or stderr. |
Definition at line 29 of file simoxygen.c.
| int simRTCM | ( | double * | t, |
| double * | cr, | ||
| const int | nr, | ||
| const double | R1, | ||
| const double | k2, | ||
| const double | k3, | ||
| const double | k4, | ||
| double * | ct, | ||
| double * | cta, | ||
| double * | ctb ) |
Simulate tissue TAC using full 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 32 of file simrtcm.c.
| int simSRTM | ( | double * | t, |
| double * | cr, | ||
| const int | nr, | ||
| const double | R1, | ||
| const double | k2, | ||
| const double | BP, | ||
| double * | ct ) |
Simulate tissue TAC using simplified reference tissue input 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.
| 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 114 of file simrtcm.c.
| int simTRTM | ( | double * | t, |
| double * | cr, | ||
| const int | nr, | ||
| const double | R1, | ||
| const double | k2, | ||
| const double | k3, | ||
| double * | ct ) |
Simulate 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 182 of file simrtcm.c.
| int simTTM | ( | double * | t, |
| double * | c0, | ||
| const int | n, | ||
| const double | k, | ||
| const int | cn, | ||
| double * | cout ) |
Simulate output of n-compartmental transit-time model, at input TAC sample times.
The units of rate constant must be related to the time unit; 1/min and min, or 1/sec and sec.
| t | Array of time values. |
| c0 | Array of input values. |
| n | Number of values in TACs. |
| k | Rate constant of the model. |
| cn | Number of compartments (cn>0). |
| cout | Pointer for TAC array to be simulated; must be allocated. |
Definition at line 144 of file simdispersion.c.
| int simTTM_i | ( | double * | t, |
| double * | c0i, | ||
| const int | n, | ||
| const double | k, | ||
| const int | cn, | ||
| double * | cout ) |
Simulate output of n-compartmental transit-time model, at input TAC sample times.
This version uses integral of input function, enabling user to fully control the calculation of integral, which is more precise when input is based on an integrable mathematical function.
The units of rate constant must be related to the time unit; 1/min and min, or 1/sec and sec.
| t | Array of time values. |
| c0i | Array of AUC 0-t of input function. |
| n | Number of values in TACs. |
| k | Rate constant of the model. |
| cn | Number of compartments (cn>0). |
| cout | Pointer for TAC array to be simulated; must be allocated. |
Definition at line 227 of file simdispersion.c.