libtpcmodext
 All Files Functions Variables Defines
Functions
misc.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <time.h>
#include "include/libtpcmodext.h"
Include dependency graph for misc.c:

Go to the source code of this file.

Functions

int dftInterpolateForIMG (DFT *input, IMG *img, int frame_nr, DFT *output, double *ti1, double *ti2, int verbose, char *status)
int imgTimeIntegral (IMG *img, float t1, float t2, IMG *iimg, int calc_mode, char *status)

Function Documentation

int dftInterpolateForIMG ( DFT *  input,
IMG *  img,
int  frame_nr,
DFT *  output,
double *  ti1,
double *  ti2,
int  verbose,
char *  status 
)

Interpolate (and integrate) TAC data to sample times that are given with IMG data. Input frame lengths are taken into account if they are available in DFT or if the framing is the same as in IMG data.

Returns:
Returns 0 if successful, and <>0 in case of an error.
Parameters:
inputData which is interpolated
imgData to which (sample times) the interpolation is done
frame_nrNumber of IMG frames that are needed; can be set to 0 if all frames can be included
outputPointer to initiated DFT into which interpolated values and integrals will be written at input sample times and units
ti1First time of input data before interpolation (in input time units); use this to check that required time range was measured; NULL if not needed
ti2Last time of input data before interpolation (in input time units); use this to check that required time range was measured; NULL if not needed
verboseVerbose level; set to zero to not to print any comments
statusPointer 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 110 of file misc.c.

References check_times_dft_vs_dft(), copy_times_from_img_to_dft(), and dftInterpolateCheckStart().

Here is the call graph for this function:

int imgTimeIntegral ( IMG *  img,
float  t1,
float  t2,
IMG *  iimg,
int  calc_mode,
char *  status 
)

Integration of dynamic image from time1 to time2, storing integrals in iimg, which is allocated here. Frames do not have to be continuous in time. Time unit in integral is sec. Raw data (sinogram) must be divided by frame durations before calling this. You may want to test the time range before applyin this routine, because this function accepts relatively large extrapolation large.

Returns:
Returns errstatus, which is STATUS_OK (0) when call was successful, and >0 in case of an error.
Parameters:
imgIMG data; preferrably dynamic, if static, then the specified time range must match with the frame time
t1Time where to start integration (sec)
t2Time to stop integration (sec); must be higher than t1
iimgPointer to initiated but empty AUC IMG data
calc_modeCalculate integral or average: 0=integral, 1=average
statusPointer to a string (allocated for at least 128 chars) where error message or other execution status will be written; enter NULL, if not needed

Definition at line 236 of file misc.c.