TPCCLIB
|
linear interpolation and integration of PET and blood/plasma TACs. More...
#include "libtpcmodel.h"
Go to the source code of this file.
Functions | |
int | interpolate (double *x, double *y, int nr, double *newx, double *newy, double *newyi, double *newyii, int newnr) |
Linear interpolation and integration. | |
int | finterpolate (float *x, float *y, int nr, float *newx, float *newy, float *newyi, float *newyii, int newnr) |
float version of interpolate(). | |
int | integrate (double *x, double *y, int nr, double *yi) |
int | fintegrate (float *x, float *y, int nr, float *yi) |
float version of integrate(). | |
int | petintegrate (double *x1, double *x2, double *y, int nr, double *newyi, double *newyii) |
int | fpetintegrate (float *x1, float *x2, float *y, int nr, float *newyi, float *newyii) |
Calculates integrals of PET data at frame end times. Float version of petintegrate(). | |
int | interpolate4pet (double *x, double *y, int nr, double *newx1, double *newx2, double *newy, double *newyi, double *newyii, int newnr) |
Interpolate and integrate TAC to PET frames. | |
int | finterpolate4pet (float *x, float *y, int nr, float *newx1, float *newx2, float *newy, float *newyi, float *newyii, int newnr) |
Interpolate and integrate TAC to PET frames. Float version of interpolate4pet(). | |
int | petintegral (double *x1, double *x2, double *y, int nr, double *ie, double *iie) |
Integrate PET TAC data to frame mid times. | |
int | fpetintegral (float *x1, float *x2, float *y, int nr, float *ie, float *iie) |
Integrate PET TAC data to frame mid times. Float version of petintegral(). | |
int | petintegrate2fe (double *x1, double *x2, double *y, int nr, double *e, double *ie, double *iie) |
Integrate PET TAC data to frame end times. | |
int | fpetintegrate2fe (float *x1, float *x2, float *y, int nr, float *e, float *ie, float *iie) |
Integrate PET TAC data to frame end times. Float version of petintegrate2fe(). | |
linear interpolation and integration of PET and blood/plasma TACs.
Definition in file integr.c.
int fintegrate | ( | float * | x, |
float * | y, | ||
int | nr, | ||
float * | yi ) |
float version of integrate().
Linear integration from time 0 to x[0..nr-1]. If x[0] is >0 and x[0]<=(x[1]-x[0]), then the beginning is interpolated from it to (0,0).
x | Original x values; duplicates are not allowed, all must be >=0. Data must be sorted by ascending x |
y | Original y values |
nr | Nr of values |
yi | Array for integrals |
Definition at line 300 of file integr.c.
int finterpolate | ( | float * | x, |
float * | y, | ||
int | nr, | ||
float * | newx, | ||
float * | newy, | ||
float * | newyi, | ||
float * | newyii, | ||
int | newnr ) |
float version of interpolate().
It is assumed that both original and new interpolated data represent the actual values at specified time points (not from framed data). The integration is calculated dot-by-dot.
If NULL is specified for newy[], newyi[] and/or newyii[], their values are not calculated.
Original data and new x values must be sorted by ascending x. Subsequent x values can have equal values, enabling the use of step functions. Negative x (time) values can be processed. If necessary, the data is extrapolated assuming that: 1) y[inf]=y[nr-1] and 2) if x[0]>0, y[0]>0 and x[0]<=x[1]-x[0], then an imaginary line is drawn from (0,0) to (x[0],y[0]).
x | Input data x (time) values |
y | Input data y values |
nr | Number of values in input data |
newx | Output data x values |
newy | Interpolated (extrapolated) y values; NULL can be given if not needed |
newyi | Integrals; NULL can be given if not needed |
newyii | 2nd integrals; NULL can be given if not needed |
newnr | Nr of values in output data |
Definition at line 161 of file integr.c.
Referenced by finterpolate4pet(), and imgTimeIntegral().
int finterpolate4pet | ( | float * | x, |
float * | y, | ||
int | nr, | ||
float * | newx1, | ||
float * | newx2, | ||
float * | newy, | ||
float * | newyi, | ||
float * | newyii, | ||
int | newnr ) |
Interpolate and integrate TAC to PET frames. Float version of interpolate4pet().
It is assumed, that original data is not from framed data, but that the values represent the actual value at specified time point, which allows the integration to be calculated dot-by-dot.
If NULL is specified for *newy, *newyi and/or *newyii, their values are not calculated.
Original data and new x values must be sorted by ascending x. Subsequent x values can have equal values, enabling the use of step functions. PET frames can overlap, but interpolation may then be slower. Negative x (time) values can be processed. If necessary, the data is extrapolated assuming that 1) y[inf]=y[nr-1] and 2) if x[0]>0 and y[0]>0 and x[0]>x[1]-x[0], then an imaginary line is drawn from (0,0) to (x[0],y[0]).
x | Times of original data |
y | Values of original data |
nr | Number of original data values |
newx1 | PET frame start times; frames may overlap |
newx2 | PET frame end times; frames may overlap |
newy | Mean value during PET frame, or NULL if not needed; calculation may be faster if newyi is calculated too |
newyi | Integral at frame mid time, or NULL if not needed |
newyii | 2nd integral at frame mid time, or NULL if not needed |
newnr | Number of PET frames |
Definition at line 646 of file integr.c.
int fpetintegral | ( | float * | x1, |
float * | x2, | ||
float * | y, | ||
int | nr, | ||
float * | ie, | ||
float * | iie ) |
Integrate PET TAC data to frame mid times. Float version of petintegral().
Any of output arrays may be set to NULL if that is not needed. Frames must be in ascending time order. Gaps and small overlap are allowed. If x1[0]>0 and x1[0]<=x2[0]-x1[0], then an imaginary line is drawn from (0,0) to (x[0],y[0]).
x1 | frame start times |
x2 | frame end times |
y | avg value during frame |
nr | number of frames |
ie | integrals at frame mid time |
iie | 2nd integrals at frame mid time |
Definition at line 838 of file integr.c.
Referenced by img_logan(), and img_patlak().
int fpetintegrate | ( | float * | x1, |
float * | x2, | ||
float * | y, | ||
int | nr, | ||
float * | newyi, | ||
float * | newyii ) |
Calculates integrals of PET data at frame end times. Float version of petintegrate().
Data does not have to be continuous, but it must be increasing in time. For faster performance in repetitive calls, allocate memory for integral[] even if it is not needed. If x1[0] is >0 AND x1[0] is <=(x2[0]-x1[0]), then the beginning is interpolated from (0, 0) to (x1[0], y1[0]*x1[0]/x) where x is midtime of the first frame.
x1 | Array of frame start times |
x2 | Array of frame end times |
y | Array of y values (avg during each frame) |
nr | Nr of frames |
newyi | Output: integral values at frame end times, or NULL |
newyii | Output: 2nd integral values at frame end times, or NULL |
Definition at line 418 of file integr.c.
int fpetintegrate2fe | ( | float * | x1, |
float * | x2, | ||
float * | y, | ||
int | nr, | ||
float * | e, | ||
float * | ie, | ||
float * | iie ) |
Integrate PET TAC data to frame end times. Float version of petintegrate2fe().
Any of output arrays may be set to NULL if that is not needed. Frames must be in ascending time order. Gaps and small overlap are allowed. If x1[0]>0 and x1[0]<=x2[0]-x1[0], then an imaginary line is drawn from (0,0) to (x[0],y[0]).
x1 | frame start times |
x2 | frame end times |
y | avg value during frame |
nr | number of frames |
e | values at frame end time |
ie | integrals at frame end time |
iie | 2nd integrals at frame end time |
Definition at line 974 of file integr.c.
int integrate | ( | double * | x, |
double * | y, | ||
int | nr, | ||
double * | yi ) |
Linear integration from time 0 to x[0..nr-1]. If x[0] is >0 and x[0]<=(x[1]-x[0]), then the beginning is interpolated from it to (0,0).
x | Original x values; duplicates are not allowed, all must be >=0. Data must be sorted by ascending x |
y | Original y values |
nr | Nr of values |
yi | Array for integrals |
Definition at line 271 of file integr.c.
Referenced by dftReadReference().
int interpolate | ( | double * | x, |
double * | y, | ||
int | nr, | ||
double * | newx, | ||
double * | newy, | ||
double * | newyi, | ||
double * | newyii, | ||
int | newnr ) |
Linear interpolation and integration.
It is assumed that both original and new interpolated data represent the actual values at specified time points (not from framed data). The integration is calculated dot-by-dot.
If NULL is specified for newy[], newyi[] and/or newyii[], their values are not calculated.
Original data and new x values must be sorted by ascending x. Subsequent x values can have equal values, enabling the use of step functions. Negative x (time) values can be processed. If necessary, the data is extrapolated assuming that: 1) y[inf]=y[nr-1] and 2) if x[0]>0, y[0]>0 and x[0]<=x[1]-x[0], then an imaginary line is drawn from (0,0) to (x[0],y[0]).
x | Input data x (time) values |
y | Input data y values |
nr | Number of values in input data |
newx | Output data x values |
newy | Interpolated (extrapolated) y values; NULL can be given if not needed |
newyi | Integrals; NULL can be given if not needed |
newyii | 2nd integrals; NULL can be given if not needed |
newnr | Nr of values in output data |
Definition at line 28 of file integr.c.
Referenced by bfIrr2TCM(), bfRadiowater(), dftDivideFrames(), dftDoubleFrames(), dftInterpolate(), dftInterpolateInto(), dftReadinput(), dftTimeIntegral(), and interpolate4pet().
int interpolate4pet | ( | double * | x, |
double * | y, | ||
int | nr, | ||
double * | newx1, | ||
double * | newx2, | ||
double * | newy, | ||
double * | newyi, | ||
double * | newyii, | ||
int | newnr ) |
Interpolate and integrate TAC to PET frames.
It is assumed, that original data is not from framed data, but that the values represent the actual value at specified time point, which allows the integration to be calculated dot-by-dot.
If NULL is specified for *newy, *newyi and/or *newyii, their values are not calculated.
Original data and new x values must be sorted by ascending x. Subsequent x values can have equal values, enabling the use of step functions. PET frames can overlap, but interpolation may then be slower. Negative x (time) values can be processed. If necessary, the data is extrapolated assuming that 1) y[inf]=y[nr-1] and 2) if x[0]>0 and y[0]>0 and x[0]>x[1]-x[0], then an imaginary line is drawn from (0,0) to (x[0],y[0]).
x | Times of original data |
y | Values of original data |
nr | Number of original data values |
newx1 | PET frame start times; frames may overlap |
newx2 | PET frame end times; frames may overlap |
newy | Mean value during PET frame, or NULL if not needed; calculation may be faster if newyi is calculated too |
newyi | Integral at frame mid time, or NULL if not needed |
newyii | 2nd integral at frame mid time, or NULL if not needed |
newnr | Number of PET frames |
Definition at line 510 of file integr.c.
Referenced by bfIrr2TCM(), bfRadiowater(), dftAutointerpolate(), dftInterpolate(), dftInterpolateForIMG(), dftInterpolateInto(), img_k1_using_ki(), img_logan(), and img_patlak().
int petintegral | ( | double * | x1, |
double * | x2, | ||
double * | y, | ||
int | nr, | ||
double * | ie, | ||
double * | iie ) |
Integrate PET TAC data to frame mid times.
Any of output arrays may be set to NULL if that is not needed. Frames must be in ascending time order. Gaps and small overlap are allowed. If x1[0]>0 and x1[0]<=x2[0]-x1[0], then an imaginary line is drawn from (0,0) to (x[0],y[0]).
x1 | frame start times |
x2 | frame end times |
y | avg value during frame |
nr | number of frames |
ie | integrals at frame mid time |
iie | 2nd integrals at frame mid time |
Definition at line 771 of file integr.c.
Referenced by dftInterpolate(), dftInterpolateForIMG(), dftInterpolateInto(), dftReadinput(), img_k1_using_ki(), img_logan(), and img_patlak().
int petintegrate | ( | double * | x1, |
double * | x2, | ||
double * | y, | ||
int | nr, | ||
double * | newyi, | ||
double * | newyii ) |
Calculates integrals of PET data at frame end times.
Data does not have to be continuous, but it must be increasing in time. For faster performance in repetitive calls, allocate memory for integral[] even if it is not needed. If x1[0] is >0 AND x1[0] is <=(x2[0]-x1[0]), then the beginning is interpolated from (0, 0) to (x1[0], y1[0]*x1[0]/x) where x is midtime of the first frame.
x1 | Array of frame start times |
x2 | Array of frame end times |
y | Array of y values (avg during each frame) |
nr | Nr of frames |
newyi | Output: integral values at frame end times, or NULL |
newyii | Output: 2nd integral values at frame end times, or NULL |
Definition at line 334 of file integr.c.
Referenced by dftReadReference().
int petintegrate2fe | ( | double * | x1, |
double * | x2, | ||
double * | y, | ||
int | nr, | ||
double * | e, | ||
double * | ie, | ||
double * | iie ) |
Integrate PET TAC data to frame end times.
Any of output arrays may be set to NULL if that is not needed. Frames must be in ascending time order. Gaps and small overlap are allowed. If x1[0]>0 and x1[0]<=x2[0]-x1[0], then an imaginary line is drawn from (0,0) to (x[0],y[0]).
x1 | frame start times |
x2 | frame end times |
y | avg value during frame |
nr | number of frames |
e | values at frame end time |
ie | integrals at frame end time |
iie | 2nd integrals at frame end time |
Definition at line 905 of file integr.c.