|
TPCCLIB
|
Linear interpolation and integration. More...
#include "tpcclibConfig.h"#include <stdio.h>#include <stdlib.h>#include <math.h>#include <time.h>#include <string.h>#include "tpcextensions.h"#include "tpcli.h"Go to the source code of this file.
Functions | |
| double | liFirstStepSize (double *x, const int nr) |
| Find the initial x step size. | |
| unsigned int | simSamples (double initStep, double maxStep, double endTime, int mode, double *x) |
| int | liInterpolate (double *x, double *y, const int nr, double *newx, double *newy, double *newyi, double *newyii, const int newnr, const int se, const int ee, const int verbose) |
| Linear interpolation and/or integration with trapezoidal method. | |
| int | liInterpolateForPET (double *x, double *y, const int nr, double *newx1, double *newx2, double *newy, double *newyi, double *newyii, const int newnr, const int se, const int ee, const int verbose) |
| Linear TAC interpolation and/or integration to PET frames. | |
Linear interpolation and integration.
Definition in file interpolate.c.
| double liFirstStepSize | ( | double * | x, |
| const int | nr ) |
Find the initial x step size.
| x | Array of x (time) values; must be sorted by ascending x, but consecutive points may have the same x. Negative x is accepted. Array must not contain NaNs. |
| nr | Number of samples in data. |
Definition at line 25 of file interpolate.c.
Referenced by liInterpolate().
| int liInterpolate | ( | double * | x, |
| double * | y, | ||
| const int | nr, | ||
| double * | newx, | ||
| double * | newy, | ||
| double * | newyi, | ||
| double * | newyii, | ||
| const int | newnr, | ||
| const int | se, | ||
| const int | ee, | ||
| const int | verbose ) |
Linear interpolation and/or integration with trapezoidal method.
PET data must be frequently sampled to get accurate results. AUC calculation is started from time 0 or first input sample time, whichever is smaller. Very simple data extrapolation can be optionally enabled. Results will be wrong if data contains NaNs. To get the same result as with interpolate() in the libtpcmodel, set se=3 and ee=1.
| x | Array of input data x (time) values; obligatory. Data must be sorted by ascending x, but consecutive points may have the same x. Negative x is accepted, AUCs are then started from the first x, otherwise from 0. Array must not contain NaNs. |
| y | Array of input data y (concentration) values; obligatory. Array must not contain NaNs. |
| nr | Number of samples in input data; obligatory. |
| newx | Array of output data x values; obligatory. Must be in ascending order. Negative x is accepted. Array must not contain NaNs. |
| newy | Array for interpolated (extrapolated) y values; NULL can be given if not needed. |
| newyi | Array for integrals (AUCs); NULL can be given if not needed. |
| newyii | Arrays for 2nd integrals; NULL can be given if not needed. |
| newnr | Nr of samples in output data; obligatory. |
| se | Extrapolation setting for the start of data:
|
| ee | Extrapolation setting for the end of data:
|
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout |
Definition at line 139 of file interpolate.c.
Referenced by bfm1TCM(), liInterpolateForPET(), tacAUC(), tacDelay(), tacDelayCMFit(), tacInput2sim(), tacInterpolate(), and tacInterpolateInto().
| int liInterpolateForPET | ( | double * | x, |
| double * | y, | ||
| const int | nr, | ||
| double * | newx1, | ||
| double * | newx2, | ||
| double * | newy, | ||
| double * | newyi, | ||
| double * | newyii, | ||
| const int | newnr, | ||
| const int | se, | ||
| const int | ee, | ||
| const int | verbose ) |
Linear TAC interpolation and/or integration to PET frames.
PET data must be frequently sampled to get accurate results. AUC calculation is started from time 0 or first input sample time, whichever is smaller. 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. Results will be wrong if data contains NaNs. Very simple data extrapolation can be optionally enabled. To get the same result as with interpolate4pet() in the libtpcmodel, set se=3 and ee=1.
| x | Array of input data x (time) values; obligatory. Data must be sorted by ascending x, but consecutive points may have the same x. Negative x is accepted, AUCs are then started from the first x, otherwise from 0. |
| y | Array of input data y (concentration) values; obligatory. |
| nr | Number of samples in input data; obligatory. |
| newx1 | Array of PET frame start times for output data; obligatory. Must be in ascending order. Negative times are accepted. |
| newx2 | Array of PET frame end times for output data; obligatory. Must be in ascending order. Negative times are accepted, but frame duration (x2-x1) must be >=0. |
| newy | Array for mean concentration values for each PET frame; NULL can be given if not needed. |
| newyi | Array for integrals (AUCs) at frame middle times; NULL can be given if not needed. |
| newyii | Arrays for 2nd integrals at frame middle times; NULL can be given if not needed. |
| newnr | Nr of samples in output data; obligatory. |
| se | Extrapolation setting for the start of data:
|
| ee | Extrapolation setting for the end of data:
|
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 317 of file interpolate.c.
Referenced by bfm1TCM(), tacDelay(), tacDelayCMFit(), tacInterpolate(), tacInterpolateInto(), and tacInterpolateToEqualLengthFrames().
| unsigned int simSamples | ( | double | initStep, |
| double | maxStep, | ||
| double | endTime, | ||
| int | mode, | ||
| double * | x ) |
Create sample times with more frequent sampling in the beginning.
| initStep | Initial sampling frequency. |
| maxStep | Maximal sampling frequency which is never exceeded; enter 0 to set it automatically. |
| endTime | End time; last sample will usually be later. |
| mode | Sampling scheme:
|
| x | Allocated array for the samples; NULL if only computing the number of samples. |
Definition at line 50 of file interpolate.c.