Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

integr.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "include/integr.h"

Functions

int interpolate (double *x, double *y, int nr, double *newx, double *newy, double *newyi, double *newyii, int newnr)
int finterpolate (float *x, float *y, int nr, float *newx, float *newy, float *newyi, float *newyii, int newnr)
int integrate (double *x, double *y, int nr, double *yi)
int fintegrate (float *x, float *y, int nr, float *yi)
int petintegrate (double *x1, double *x2, double *y, int nr, double *newyi, double *newyii)
int fpetintegrate (float *x1, float *x2, float *y, int nr, float *newyi, float *newyii)
int interpolate4pet (double *x, double *y, int nr, double *newx1, double *newx2, double *newy, double *newyi, double *newyii, int newnr)
int finterpolate4pet (float *x, float *y, int nr, float *newx1, float *newx2, float *newy, float *newyi, float *newyii, int newnr)
int petintegral (double *x1, double *x2, double *y, int nr, double *ie, double *iie)
int fpetintegral (float *x1, float *x2, float *y, int nr, float *ie, float *iie)
int petintegrate2fe (double *x1, double *x2, double *y, int nr, double *e, double *ie, double *iie)
int fpetintegrate2fe (float *x1, float *x2, float *y, int nr, float *e, float *ie, float *iie)

Function Documentation

int fintegrate float *  x,
float *  y,
int  nr,
float *  yi
 

float version of integrate()

Parameters:
x  Original x values; duplicates are not allowed, all must be >=0. Data must be sorted by ascending x
y  Original y values
nr  Nr of values
yi  Array for integrals

int finterpolate float *  x,
float *  y,
int  nr,
float *  newx,
float *  newy,
float *  newyi,
float *  newyii,
int  newnr
 

float version of interpolate()

Parameters:
x  Input data x (time) values
y  Input data y values
nr  Number of values in input data
newx  Output data x values
newy  Interpolated (extrapolated) y values; NULL can be given
newyi  Integrals; NULL can be given
newyii  2nd integrals; NULL can be given
newnr  Nr of values in output data

int finterpolate4pet float *  x,
float *  y,
int  nr,
float *  newx1,
float *  newx2,
float *  newy,
float *  newyi,
float *  newyii,
int  newnr
 

float version of interpolate4pet()

Parameters:
x  Times of original data
y  Values of original data
nr  Number of original data values
newx1  PET frame start times
newx2  PET frame end times
newy  Mean value during PET frame, or NULL
newyi  Integral at frame mid time, or NULL
newyii  2nd integral at frame mid time, or NULL
newnr  Number of PET frames

int fpetintegral float *  x1,
float *  x2,
float *  y,
int  nr,
float *  ie,
float *  iie
 

float version of petintegral()

Parameters:
x1  frame start times
x2  frame end times
y  avg value during frame
nr  number of frames
ie  integrals at frame mid time
iie  2nd integrals at frame mid time

int fpetintegrate float *  x1,
float *  x2,
float *  y,
int  nr,
float *  newyi,
float *  newyii
 

Parameters:
x1  Array of frame start times
x2  Array of frame end times
y  Array of y values (avg during each frame)
nr  Nr of frames
newyi  Output: integral values at frame end times, or NULL
newyii  Output: 2nd integral values at frame end times, or NULL

int fpetintegrate2fe float *  x1,
float *  x2,
float *  y,
int  nr,
float *  e,
float *  ie,
float *  iie
 

float version of petinetgrate2fe()

Parameters:
x1  frame start times
x2  frame end times
y  avg value during frame
nr  number of frames
e  values at frame end time
ie  integrals at frame end time
iie  2nd integrals at frame end time

int integrate double *  x,
double *  y,
int  nr,
double *  yi
 

Linear integration from time 0 to x[0..nr-1]. If x[0] is >0, then the beginning is interpolated from it to (0,0).

Returns:
Returns 0 if OK, or 1, if error.
Parameters:
x  Original x values; duplicates are not allowed, all must be >=0. Data must be sorted by ascending x
y  Original y values
nr  Nr of values
yi  Array for integrals

int interpolate double *  x,
double *  y,
int  nr,
double *  newx,
double *  newy,
double *  newyi,
double *  newyii,
int  newnr
 

Linear interpolation and integration.

It is assumed, that both original and new interpolated data represent the actual values at specified time points (not from framed data). The integration is calculated dot-by-dot.

If NULL is spefied for newy[], newyi[] and/or newyii[], their values are not calculated.

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. Negative x (time) values can be processed. If necessary, the data is extrapolated assuming that: 1) y[inf]=y[nr-1] and 2) if x[0]>0 and y[0]>0, then an imaginary line is drawn from (0,0) to (x[0],y[0]).

Parameters:
x  Input data x (time) values
y  Input data y values
nr  Number of values in input data
newx  Output data x values
newy  Interpolated (extrapolated) y values; NULL can be given
newyi  Integrals; NULL can be given
newyii  2nd integrals; NULL can be given
newnr  Nr of values in output data

int interpolate4pet double *  x,
double *  y,
int  nr,
double *  newx1,
double *  newx2,
double *  newy,
double *  newyi,
double *  newyii,
int  newnr
 

Interpolate and integrate TAC to PET frames.

It is assumed, that original data is not from framed data, but that the values represent the actual value at specified time point, which allows the integration to be calculated dot-by-dot.

If NULL is specified for *newy, *newyi and/or *newyii, their values are not calculated.

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. The newx2 must always be higher or equal than newx1. Frames must not overlap. Negative x (time) values can be processed. If necessary, the data is extrapolated assuming that 1) y[inf]=y[nr-1] and 2) if x[0]>0 and y[0]>0, then an imaginary line is drawn from (0,0) to (x[0],y[0]).

Parameters:
x  Times of original data
y  Values of original data
nr  Number of original data values
newx1  PET frame start times
newx2  PET frame end times
newy  Mean value during PET frame, or NULL
newyi  Integral at frame mid time, or NULL
newyii  2nd integral at frame mid time, or NULL
newnr  Number of PET frames

int petintegral double *  x1,
double *  x2,
double *  y,
int  nr,
double *  ie,
double *  iie
 

Integrate PET TAC data to frame mid times. Any of output arrays may be set to NULL if that is not needed. Frames must be in ascending time order. Gaps and small overlap are allowed. If x1[0]>0, then an imaginary line is drawn from (0,0) to (x[0],y[0]).

Returns:
Returns 0 if ok.
Parameters:
x1  frame start times
x2  frame end times
y  avg value during frame
nr  number of frames
ie  integrals at frame mid time
iie  2nd integrals at frame mid time

int petintegrate double *  x1,
double *  x2,
double *  y,
int  nr,
double *  newyi,
double *  newyii
 

Calculates integrals of PET data at frame end times.

Data does not have to be continuous, but it must be increasing in time. For faster performance in repetitive calls, allocate memory for integral[] even if it is not needed.

Returns:
Returns 0 if ok.
Parameters:
x1  Array of frame start times
x2  Array of frame end times
y  Array of y values (avg during each frame)
nr  Nr of frames
newyi  Output: integral values at frame end times, or NULL
newyii  Output: 2nd integral values at frame end times, or NULL

int petintegrate2fe double *  x1,
double *  x2,
double *  y,
int  nr,
double *  e,
double *  ie,
double *  iie
 

Integrate PET TAC data to frame end times. Any of output arrays may be set to NULL if that is not needed. Frames must be in ascending time order. Gaps and small overlap are allowed. If x1[0]>0, then an imaginary line is drawn from (0,0) to (x[0],y[0]).

Returns:
Returns 0 if ok.
Parameters:
x1  frame start times
x2  frame end times
y  avg value during frame
nr  number of frames
e  values at frame end time
ie  integrals at frame end time
iie  2nd integrals at frame end time


Generated on Fri Jan 21 16:17:41 2005 for libPET by  doxygen 1.4.1