TPCCLIB
|
Check and set fit duration from data. More...
#include "libtpcmodext.h"
Go to the source code of this file.
Functions | |
int | fittime_from_dft (DFT *dft, double *startTime, double *endTime, int *first, int *last, int verbose) |
int | fittime_from_img (IMG *img, double *fittime, int verbose) |
int | check_times_dft_vs_img (IMG *img, DFT *dft, int verbose) |
int | check_times_dft_vs_dft (DFT *dft1, DFT *dft2, int verbose) |
int | copy_times_from_img_to_dft (IMG *img, DFT *dft, int verbose) |
int | getActualSamplenr (DFT *dft, int ri) |
double | dftEndtime (DFT *dft) |
double | imgEndtime (IMG *img) |
int | dftMatchTimeunits (DFT *dft1, DFT *dft2, int *tunit2, int verbose) |
Check and set fit duration from data.
Definition in file fittime.c.
Check whether sample times are the same (or very close to) in two DFT structs. Data sets are not edited. If DFT structs contain different sample number, then only common nr of samples are compared.
dft1 | Pointer to first DFT data; times can be both seconds or minutes, if unit is correctly set. |
dft2 | Pointer to second DFT data; times can be both seconds or minutes, if unit is correctly set; sample nr may be different than in dft1. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 169 of file fittime.c.
Referenced by dftInterpolate(), dftInterpolateForIMG(), and dftInterpolateInto().
Check whether DFT sample times are the same (or very close to) as the frame times in IMG. This would suggest that DFT data originates from the same or similar PET scan. Specified data sets are not edited. If frame nr is different, then only the common frames are compared.
img | Pointer to IMG data; times must be in sec as usual. |
dft | Pointer to DFT data; times can be both seconds or minutes, if unit is correctly set; sample nr may be different than in IMG. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 109 of file fittime.c.
Referenced by img_logan(), and img_patlak().
Copies frame times (especially start and end times, but also mid times) from an IMG data into DFT data, and sets DFT 'header' to indicate that frame start and end times are present.
img | Pointer to IMG data; times must be in sec as usual. |
dft | Pointer to DFT data; times can be both seconds or minutes, if unit is correctly set; sample nr may be smaller than in IMG. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 246 of file fittime.c.
Referenced by dftInterpolateForIMG(), img_logan(), and img_patlak().
double dftEndtime | ( | DFT * | dft | ) |
Get TAC end time. Sample times are assumed to be sorted to increasing order.
dft | Pointer to DFT TAC structure. |
Definition at line 315 of file fittime.c.
Referenced by imgReadModelingData().
Make sure that time units in two DFT structs are the same, converting units when necessary, optionally saving original units so that units can be converted back to what they were using dftTimeunitConversion().
dft1 | Pointer to DFT struct 1. |
dft2 | Pointer to DFT struct 2; sample time units are changed to match the data in dft1. |
tunit2 | Pointer for original time unit in DFT 2; enter NULL if not needed. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 358 of file fittime.c.
Referenced by dftInterpolateCheckEnd(), and dftInterpolateCheckStart().
int fittime_from_dft | ( | DFT * | dft, |
double * | startTime, | ||
double * | endTime, | ||
int * | first, | ||
int * | last, | ||
int | verbose ) |
Reset user-defined fit time range to comply with DFT data.
dft | Pointer to DFT containing (regional tissue) data; times can be in minutes or seconds, as long as units are defined. |
startTime | Pointer containing originally the requested fit start time (min). This is changed to contain the time of the first included frame. Unit must be minutes. Initially, set to <0 to start from the beginning of the data. |
endTime | Pointer containing originally the requested fit end time (min). This is changed to contain the time of the last included frame. Unit must be minutes. Initially, set to <0 or to a very large value to reach to the end of data. |
first | Function writes the index of the first included sample (frame) here. |
last | Function writes the index of the last included sample (frame) here. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 16 of file fittime.c.
Referenced by dftReadModelingData(), and imgReadModelingData().
int fittime_from_img | ( | IMG * | img, |
double * | fittime, | ||
int | verbose ) |
Get the IMG frame end time of the last frame that is inside (mid time before) the specified maximum fittime.
img | Pointer to IMG |
fittime | Pointer containing originally the fit time maximum, after this the last included IMG frame end time. Unit must be seconds. Initially, set to <0 or to a very large value to include all frames. |
verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 74 of file fittime.c.
Referenced by imgReadModelingData().
int getActualSamplenr | ( | DFT * | dft, |
int | ri ) |
Returns the actual TAC sample number, not including NaNs, samples with negative x, duplicate samples, or samples with zero weights (if data is weighted).
dft | Pointer to TAC data in DFT struct; must be sorted by increasing x. |
ri | Region index [0..voiNr-1]. |
Definition at line 288 of file fittime.c.
double imgEndtime | ( | IMG * | img | ) |
Get IMG end time. Frame times are assumed to be sorted to increasing order.
img | Pointer to IMG structure. |
Definition at line 339 of file fittime.c.
Referenced by imgReadModelingData().