Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

simulate.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "include/integr.h"
#include "include/dft.h"
#include "include/simulate.h"

Functions

int c3sSIM (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 c3pSIM (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 c3vsSIM (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 c3vpSIM (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 autointerpolateDFT (DFT *dft, DFT *dft2, double endtime)
int c2lSIM (double *t, double *ca, int nr, double k1, double k2, double k3, double kLoss, double *ct, double *cta, double *ctb)
int c2vlSIM (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 rtcmSIM (double *t, double *cr, int nr, double R1, double k2, double k3, double k4, double *ct, double *cta, double *ctb)
int srtmSIM (double *t, double *cr, int nr, double R1, double k2, double BP, double *ct)
int trtmSIM (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)

Function Documentation

int autointerpolateDFT DFT dft,
DFT dft2,
double  endtime
 

Interpolates TACs to automatically determined sample times with smaller intervals in the beginning. Only data in y arrays are interpolated; data in y2 and y3 are not used.

Returns:
Function returns 0 when succesful, else a value >= 1.
Parameters:
dft  Data to be interpolated is read from this array
dft2  Interpolated data is written in this array
endtime  The length of interpolated/extrapolated data

int c2lSIM 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.

Returns:
Function returns 0 when succesful, else a value >= 1.
Parameters:
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

int c2vlSIM 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.",

Returns:
Function returns 0 when succesful, else a value >= 1.
Parameters:
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

int c3pSIM 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.

Returns:
Function returns 0 when succesful, else a value >= 1.
Parameters:
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

int c3sSIM 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.

Returns:
Function returns 0 when succesful, else a value >= 1.
Parameters:
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

int c3vpSIM 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.",

Returns:
Function returns 0 when succesful, else a value >= 1.
Parameters:
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

int c3vsSIM 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.",

Returns:
Function returns 0 when succesful, else a value >= 1.
Parameters:
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

int rtcmSIM 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.

Returns:
Function returns 0 when succesful, else a value >= 1.
Parameters:
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

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.

Returns:
Returns 0, if ok.
Parameters:
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

int srtmSIM 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.

Returns:
Function returns 0 when succesful, else a value >= 1.
Parameters:
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

int trtmSIM 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.

Returns:
Function returns 0 when succesful, else a value >= 1.
Parameters:
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


Generated on Fri Jan 21 16:17:42 2005 for libPET by  doxygen 1.4.1