#include <stdio.h>#include <string.h>#include <math.h>#include <stdlib.h>#include <time.h>#include "include/libtpcmodext.h"Go to the source code of this file.
Functions | |
| int | dftReadinput (DFT *input, DFT *tissue, char *filename, int *filetype, double *ti1, double *ti2, char *status) |
| int | dftReadReference (DFT *tissue, char *filename, int *filetype, int *ref_index, char *status) |
| int | dftReadModelingData (char *tissuefile, char *inputfile1, char *inputfile2, char *inputfile3, double *fitdur, int *fitframeNr, DFT *tis, DFT *inp, FILE *loginfo, int verbose, char *status) |
| int | dftRobustMinMaxTAC (DFT *dft, int tacindex, double *minx, double *maxx, double *miny, double *maxy, int *mini, int *maxi) |
| int dftReadinput | ( | DFT * | input, |
| DFT * | tissue, | ||
| char * | filename, | ||
| int * | filetype, | ||
| double * | ti1, | ||
| double * | ti2, | ||
| char * | status | ||
| ) |
Read DFT format input TAC data to match the time frames in the specified tissue DFT file. Instead of input filename, a reference region name can be given: then all the matching tacs (based on roi names) are moved from the roi data to the input data, with the best match as first tac. Input data is interpolated (if necessary) and also integrated to y2[]. Input time and concentration units are tried to be converted to be the same as in tissue data.
| input | Input data, previous contents are cleared |
| tissue | PET data containing frames and possible input regions |
| filename | Input data filename, or region name in PET data |
| filetype | Type of input, as found out here; 1 and 2 =tac, 3=fit, 5=region name; enter NULL, if not needed |
| ti1 | First time of input data before interpolation (in tissue time units); use this to check that required time range was measured; NULL if not needed |
| ti2 | Last time of input data before interpolation (in tissue time units); use this to check that required time range was measured; 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 70 of file dftinput.c.
References dftInterpolate(), and MODEXT_TEST.
| int dftReadModelingData | ( | char * | tissuefile, |
| char * | inputfile1, | ||
| char * | inputfile2, | ||
| char * | inputfile3, | ||
| double * | fitdur, | ||
| int * | fitframeNr, | ||
| DFT * | tis, | ||
| DFT * | inp, | ||
| FILE * | loginfo, | ||
| int | verbose, | ||
| char * | status | ||
| ) |
Read tissue and input data for modeling. Time units are converted to min and input calibration units to units of tissue data. Input data is NOT interpolated to tissue times. If input data extends much further than fit duration, the last part is removed to save computation time in simulations. Input data is verified not to end too early, and not to start too late.
| tissuefile | Tissue data filename; one time sample is sufficient here |
| inputfile1 | 1st input data filename |
| inputfile2 | 2nd input data filename (or NULL if only not needed) |
| inputfile3 | 3rd input data filename (or NULL if only not needed) |
| fitdur | Fit duration (in minutes); shortened if longer than tissue data |
| fitframeNr | Nr of time frames (samples) in tissue data that are inside fitdur will be written here |
| tis | Pointer to initiated DFT into which tissue data will be written |
| inp | Pointer to initiated DFT into which input data (plasma and/or blood) will be written |
| loginfo | Give file pointer (for example stdout) where log information is printed; NULL if not needed; warnings will be printed in stderr anyway. |
| verbose | Verbose level; if zero, then only warnings are printed into stderr |
| 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 365 of file dftinput.c.
References dftInterpolateInto(), and fittime_from_dft().
| int dftReadReference | ( | DFT * | tissue, |
| char * | filename, | ||
| int * | filetype, | ||
| int * | ref_index, | ||
| char * | status | ||
| ) |
Read DFT format reference region TAC data and add it into DFT already containing other tissue TACs, if reference region TAC(s) are be given in a separate file. Alternative the reference region name can be given, which will then be selected from existing tissue TACs. Reference TACs are marked in DFT with sw=2 (best name match) or sw=1; if reference region file contains several TACs then the one which contains name 'mean' or 'avg' or has shortest total name length is given value sw=2. When necessary, reference data is interpolated and units converted to match the existing tissue DFT. Reference TAC is also integrated into y2[].
| tissue | PET data containing existing tissue TACs, possibly also reference regions |
| filename | Reference TAC filename, or region name in previous data |
| filetype | Type of input, as found out here; 1 and 2 =tac, 3=fit, 5=region name; enter NULL, if not needed |
| ref_index | Index of the best reference region; enter 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 228 of file dftinput.c.
References dftInterpolateInto(), and MODEXT_TEST.
| int dftRobustMinMaxTAC | ( | DFT * | dft, |
| int | tacindex, | ||
| double * | minx, | ||
| double * | maxx, | ||
| double * | miny, | ||
| double * | maxy, | ||
| int * | mini, | ||
| int * | maxi | ||
| ) |
Robust search of the min and max values of DFT TAC data. Data may contain NaN's, and indivial outliers are not taken as min or max.
| dft | Pointer to the DFT TAC data to search |
| tacindex | Index of the only TAC which is searched for min and max; <0 if all |
| minx | Pointer to X at TAC min; set to NULL if not needed |
| maxx | Pointer to X at TAC max; set to NULL if not needed |
| miny | Pointer to min Y; set to NULL if not needed |
| maxy | Pointer to max Y; set to NULL if not needed |
| mini | Index of min TAC; set to NULL if not needed |
| maxi | Index of max TAC; set to NULL if not needed |
Definition at line 631 of file dftinput.c.
1.8.0