#include <stdio.h>#include <string.h>#include <math.h>#include <stdlib.h>#include <time.h>#include "libtpcmisc.h"#include "include/libtpcmodext.h"Go to the source code of this file.
Functions | |
| int | extrapolate_monoexp (DFT *dft, double *fittime, int *min_nr, int max_nr, double mintime, double extr_to, DFT *ext, FILE *loginfo, char *status) |
| int | dftAutointerpolate (DFT *dft, DFT *dft2, double endtime) |
| int | dftDoubleFrames (DFT *dft, DFT *dft2) |
| int | dftDivideFrames (DFT *dft, int voi_index, int add_nr, DFT *dft2) |
| int | dft_end_line (DFT *dft, double *fittime, int *min_nr, int max_nr, double mintime, int check_impr, FIT *fit, FILE *loginfo, char *status) |
| int | dft_ln (DFT *dft1, DFT *dft2) |
| int dft_end_line | ( | DFT * | dft, |
| double * | fittime, | ||
| int * | min_nr, | ||
| int | max_nr, | ||
| double | mintime, | ||
| int | check_impr, | ||
| FIT * | fit, | ||
| FILE * | loginfo, | ||
| char * | status | ||
| ) |
Fits line to the end-part of TACs. By default, the included data points are determined based on maximum adjusted R^2 from at least three points; regression to the larger number of points is used in case difference in adjusted R^2 values is not larger than 0.0001.
| dft | Pointer to original TAC data |
| fittime | By default, the search for the best line fit is started from the last sample towards the first sample; set fit time to -1 to use this default. However, if the end phase is unreliable or very noisy, you may want to set fittime to include only certain time range from the beginning. Function will write here the fittime that was actually used. |
| min_nr | The minimum number of samples used in searching the best fit; at least 2, but 3 is recommended. If data is very noisy, then this number may need to be increased. Function will write here the nr of samples that was actually used. This can be used as an alternative to mintime or in addition to it. |
| max_nr | The maximum number of samples used in searching the best fit; must be higher than min_nr, or set to -1 to not to limit the number. |
| mintime | Minimum time range used in searching the best fit. If data is very noisy, then this may need to be set, otherwise setting mintime to -1 will use the default. This can be used as an alternative to min_nr or in addition to it. |
| check_impr | Linear fitting can be applied to all data subsets in the fit time range (check_impr=0), or fitting is stopped when increasing n does not improve the adjusted R^2 (check_impr=1); the latter mode is for compatibility with WinNonlin. |
| fit | Pointer to data for fitted parameters. Struct must be initiated. Any existing data is deleted. Additionally, adjusted R^2 is written as 3rd (non-documented) parameter. |
| loginfo | Give file pointer (for example stdout) where log information is printed; NULL if not needed |
| status | Pointer 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 540 of file extrapolate.c.
| int dft_ln | ( | DFT * | dft1, |
| DFT * | dft2 | ||
| ) |
Natural logarithm (ln) transformation for TAC concentrations.
| dft1 | Pointer to original TAC data |
| dft2 | Pointer to allocated memory for ln transformed TAC data; enter NULL, if original data is to be overwritten by ln transformed values. |
Definition at line 703 of file extrapolate.c.
| int dftAutointerpolate | ( | 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.
| dft | Data to be interpolated is read from this struct |
| dft2 | Interpolated data is written in this struct; must be initiated; any previous content is deleted |
| endtime | The length of interpolated/extrapolated data |
Definition at line 306 of file extrapolate.c.
References MODEXT_TEST.
| int dftDivideFrames | ( | DFT * | dft, |
| int | voi_index, | ||
| int | add_nr, | ||
| DFT * | dft2 | ||
| ) |
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.
| dft | Data to be interpolated into more time frames is read from this struct |
| voi_index | Region index [0..voiNr-1] that is interpolated; <0 means all VOIs |
| add_nr | Nr of extra time frames that are created from each original frame; valid numers are 1-100; 1 doubles the frame number |
| dft2 | Interpolated data is written in this struct; must be initiated, may be allocated but do not need to be; any previous content is deleted |
Definition at line 434 of file extrapolate.c.
References MODEXT_TEST.
| int dftDoubleFrames | ( | DFT * | dft, |
| DFT * | dft2 | ||
| ) |
Doubles the TAC sample number by making each sample/frame into two by linear interpolation. Only data in y arrays are interpolated; data in y2 and y3 are not used.
| dft | Data to be interpolated is read from this struct |
| dft2 | Interpolated data is written in this struct; must be initiated; any previous content is deleted |
Definition at line 371 of file extrapolate.c.
| int extrapolate_monoexp | ( | DFT * | dft, |
| double * | fittime, | ||
| int * | min_nr, | ||
| int | max_nr, | ||
| double | mintime, | ||
| double | extr_to, | ||
| DFT * | ext, | ||
| FILE * | loginfo, | ||
| char * | status | ||
| ) |
Extrapolation of exponentially decreasing tail of PET radiotracer plasma curves. This is accomplished by fitting line to the end-part of the plot of the natural logarithm of tracer concentration against time. By default, the included data points are determined based on maximum adjusted R^2 from at least three points; fit to the larger number of points is used in case difference in adjusted R^2 values is not larger than 0.0001. This function is used and tested with program extrapol.
| dft | Pointer to original TAC data |
| fittime | By default, the search for the best line fit is started from the last sample towards the first sample; set fit time to -1 to use this default. However, if the end phase is unreliable or very noisy, you may want to set fittime to include only certain time range from the beginning. Function will write here the fittime that was actually used. |
| min_nr | The minimum number of samples used in searching the best fit; at least 2, but 3 is recommended. If data is very noisy, then this number may need to be increased. Function will write here the nr of samples that was actually used. This can be used as an alternative to mintime or in addition to it. |
| max_nr | The maximum number of samples used in searching the best fit; must be higher than min_nr, or set to -1 to not to limit the number. |
| mintime | Minimum time range used in searching the best fit. If data is very noisy, then this may need to be set, otherwise setting mintime to -1 will use the default. This can be used as an alternative to min_nr or in addition to it. |
| extr_to | Last extrapolated sample time in same time units than in the data |
| ext | Pointer to data for extrapolated TACs. Struct must be initiated. Any existing data is deleted. |
| loginfo | Give file pointer (for example stdout) where log information is printed; NULL if not needed |
| status | Pointer 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 87 of file extrapolate.c.
1.8.0