libtpcmodext
 All Files Functions Variables Defines
Functions
dftint.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include "include/libtpcmodext.h"
Include dependency graph for dftint.c:

Go to the source code of this file.

Functions

int dftInterpolateCheckStart (DFT *input, DFT *output, char *status)
int dftInterpolateCheckEnd (DFT *input, DFT *output, char *status)
int dftInterpolate (DFT *input, DFT *tissue, DFT *output, char *status)
int dftInterpolateInto (DFT *inp, DFT *tis, char *status)
int dftTimeIntegral (DFT *dft, double t1, double t2, DFT *idft, int calc_mode, char *status)
int dftDerivative_old (DFT *dft, DFT *deriv, char *status)
int dftDerivative (DFT *dft, DFT *deriv, char *status)

Function Documentation

int dftDerivative ( DFT *  dft,
DFT *  deriv,
char *  status 
)

Calculate simple derivatives from regional PET TACs. This must not be used for any quantitative purpose.

Returns:
Returns 0 if successul.
Parameters:
dftDFT struct containing the regional tissue TACs
derivAllocated DFT struct for derivatives
statusPointer to allocated string where the status or error message is written; set to NULL if not needed

Definition at line 617 of file dftint.c.

int dftDerivative_old ( DFT *  dft,
DFT *  deriv,
char *  status 
)

Calculate simple derivatives from regional PET TACs. Old version. Requires that frame start and end times are known.

Returns:
Returns 0 if successul.
Parameters:
dftDFT struct containing the regional tissue TACs
derivAllocated DFT struct for derivatives
statusPointer to allocated string where the status or error message is written; set to NULL if not needed

Definition at line 573 of file dftint.c.

int dftInterpolate ( DFT *  input,
DFT *  tissue,
DFT *  output,
char *  status 
)

Interpolate (and integrate) TAC data to sample times that are given with another TAC data. PET frame lengths are taken into account if available in tissue DFT struct. Input frame lengths are taken into account if the framing is same as with tissue data.

Returns:
Returns 0 if successful, and <>0 in case of an error.
Parameters:
inputData which is interpolated; make sure that time unit is the same as in tissue data; time range is checked to cover the tissue data
tissueData to which (sample times) the interpolation is done
outputPointer to initiated DFT into which interpolated values and integrals will be written
statusPointer to a string (allocated for at least 64 chars) where error message or other execution status will be written; enter NULL, if not needed

Definition at line 173 of file dftint.c.

References check_times_dft_vs_dft(), dftInterpolateCheckEnd(), and dftInterpolateCheckStart().

Referenced by dftReadinput().

Here is the call graph for this function:

int dftInterpolateCheckEnd ( DFT *  input,
DFT *  output,
char *  status 
)

Verify that data to-be-interpolated does not need too much extrapolation in the end, and that samples are not too sparse.

Returns:
Returns 0 if data is fine, 1 if extrapolation can be done, but there may be too few samples, and -1 if extrapolation in the end is impossible.
Parameters:
inputData that will be verified for reliable interpolation
outputData containing sample times for interpolated data
statusPointer to a string (allocated for at least 64 chars) where error message or other execution status will be written; enter NULL, if not needed

Definition at line 104 of file dftint.c.

References MODEXT_TEST.

Referenced by dftInterpolate(), and dftInterpolateInto().

int dftInterpolateCheckStart ( DFT *  input,
DFT *  output,
char *  status 
)

Verify that data to-be-interpolated does not need too much extrapolation in the beginning.

Returns:
Returns 0 if data is fine, 1 if it starts late but extrapolation can be done reliably, and -1 if extrapolation in the beginning would be too risky.
Parameters:
inputData that will be verified for reliable interpolation
outputData containing sample times for interpolated data
statusPointer to a string (allocated for at least 64 chars) where error message or other execution status will be written; enter NULL, if not needed

Definition at line 52 of file dftint.c.

References MODEXT_TEST.

Referenced by dftInterpolate(), dftInterpolateForIMG(), and dftInterpolateInto().

int dftInterpolateInto ( DFT *  inp,
DFT *  tis,
char *  status 
)

Interpolate (and integrate) TAC data to sample times that are given with another TAC data. New TAC is written into existing TAC data. PET frame lengths are taken into account if available in tissue DFT struct. Input frame lengths are taken into account if the framing is same as with tissue data.

Returns:
Returns 0 if successful, and <>0 in case of an error.
Parameters:
inpData which is interpolated; make sure that time unit is the same as in tissue data; time range is checked to cover the tissue data
tisData into which the interpolation is done
statusPointer to a string (allocated for at least 64 chars) where error message or other execution status will be written; enter NULL, if not needed

Definition at line 286 of file dftint.c.

References check_times_dft_vs_dft(), dftInterpolateCheckEnd(), and dftInterpolateCheckStart().

Referenced by dftReadModelingData(), and dftReadReference().

Here is the call graph for this function:

int dftTimeIntegral ( DFT *  dft,
double  t1,
double  t2,
DFT *  idft,
int  calc_mode,
char *  status 
)

Integration of regional TAC data from time1 to time2, i.e. AUC(t1,t2). You may want to test the time range before applyin this routine, because this function accepts relatively large extrapolation large.

Returns:
Returns 0 when call was successful, and >0 in case of an error.
Parameters:
dftRegional TAC data in DFT struct. Number of samples must be at least one. If only one sample, then the integration time range must match with the possible frame start and times. Frames do not have to be continuous in time.
t1Time where to start integration (same unit as in TACs)
t2Time to stop integration (same unit as in TACs); must be higher than t1, except that t1=t2 is acceptable when calc_mode=average
idftPointer to initiated but empty AUC DFT data (output)
calc_modeCalculate integral or average: 0=integral, 1=average
statusPointer to a string (allocated for at least 128 chars) where error message or other execution status will be written; enter NULL, if not needed

Definition at line 379 of file dftint.c.

References MODEXT_TEST.