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

imgproc.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include "include/img.h"
#include "include/imgproc.h"

Functions

int imgArithm (IMG *img1, IMG *img2, char operation, float ulimit)
int imgArithmConst (IMG *img, float operand, char operation, float ulimit)
int imgArithmFrame (IMG *img1, IMG *img2, char operation, float ulimit)
int imgThresholdTemplate (IMG *img, float minValue, float maxValue, IMG *timg)
int imgThresholdByTemplate (IMG *img, IMG *template, float thrValue)
int imgAverageTAC (IMG *img, float *tac)
int imgAverageTemplateTAC (IMG *img, IMG *timg, float *tac)
int imgAverageAUC (IMG *img, float *avgauc)
int imgLog10 (IMG *img)
int imgMax (IMG *img, float *maxvalue)
int imgAbsMax (IMG *img, float *maxvalue)
int imgMinMax (IMG *img, float *minvalue, float *maxvalue)
int imgFrameMinMax (IMG *img, int frame, float *minvalue, float *maxvalue)
int imgFrameIntegral (IMG *img, int first, int last, IMG *iimg)
int imgRawCountsPerTime (IMG *img, int operation)
void imgFlipHorizontal (IMG *img)
void imgFlipVertical (IMG *img)
void imgFlipPlanes (IMG *img)
int imgSetScanner (IMG *img, int scanner_type)

Function Documentation

int imgAbsMax IMG img,
float *  maxvalue
 

Searches the max absolute pixel value in the IMG data. Sets maxvalue to the absolute max value with sign.

Returns:
Returns 0, if ok.

int imgArithm IMG img1,
IMG img2,
char  operation,
float  ulimit
 

Simple arithmetics between matching IMG planes and frames. Spefify the operation as one of characters +, -, /, :, *, ., x. Results that are higher than ulimit are set to ulimit.

Returns:
Returns 0, if ok.
Parameters:
img1  The first IMG data
img2  The second IMG data
operation  Operation, one of the characters +, -, /, :, *, ., x
ulimit  Results that are higher than ulimit are set to ulimit

int imgArithmConst IMG img,
float  operand,
char  operation,
float  ulimit
 

Simple arithmetics between IMG and specified constant. Spefify the operation as one of characters +, -, /, :, *, ., x. Results that are higher than ulimit are set to ulimit.

Returns:
Returns 0, if ok.
Parameters:
img  IMG data which is modified
operand  Constant value which is used to modify the data
operation  Operation, one of the characters +, -, /, :, *, ., x
ulimit  Results that are higher than ulimit are set to ulimit

int imgArithmFrame IMG img1,
IMG img2,
char  operation,
float  ulimit
 

Simple arithmetics between matching IMG planes and the first frame of img2. Spefify the operation as one of characters +, -, /, :, *, ., x. Results that are higher than ulimit are set to ulimit.

Returns:
Returns 0, if ok.
Parameters:
img1  IMG data which is modified
img2  Operand IMG data, only the first frame is used
operation  Operation, one of the characters +, -, /, :, *, ., x
ulimit  Results that are higher than ulimit are set to ulimit

int imgAverageAUC IMG img,
float *  avgauc
 

Calculates the Area-Under-Curve of an average time-activity curve of all pixels or bins in the specified IMG data.

Returns:
Returns 0, if ok.
Parameters:
img  (Dynamic) IMG data
avgauc  Allocate float array for the AUC-TAC

int imgAverageTAC IMG img,
float *  tac
 

Calculates an average time-activity curve of all pixels or bins in the specified IMG data.

Returns:
Returns 0, if ok.

int imgAverageTemplateTAC IMG img,
IMG timg,
float *  tac
 

Calculates an average time-activity curve of pixels or bins in the specified IMG data. Template image specifies the pixels that are included in average (0=excluded, otherwise included). If all pixels are to be averaged, then NULL can be given instead of template.

Returns:
Returns 0, if ok.
Parameters:
img  (Dynamic) IMG data from which cluster TAC is computed
timg  Template: 0=excluded, otherwise included
tac  Allocated float array for the TAC

void imgFlipHorizontal IMG img  ) 
 

Flip IMG data horizontally (left-right)

void imgFlipPlanes IMG img  ) 
 

Flip IMG data planes (head-toes). To work properly, the plane numbers must be contiguous.

void imgFlipVertical IMG img  ) 
 

Flip IMG data vertically (up-down)

int imgFrameIntegral IMG img,
int  first,
int  last,
IMG iimg
 

Integration from first frame (0..last) to last frame (first..dimt) to 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.

Returns:
Returns 0 if ok, otherwise >0.
Parameters:
img  (Dynamic) IMG data
first  First frame to include in AUC; 0..dimt-1
last  Last frame to include in AUC; 0..dimt-1
iimg  Pointer to initiated and empty AUC IMG data

int imgFrameMinMax IMG img,
int  frame,
float *  minvalue,
float *  maxvalue
 

Searches the min and max pixel value in one frame (1..dimt) of the IMG data.

Returns:
Returns 0, if ok.

int imgLog10 IMG img  ) 
 

Replace IMG data values by their log10 values.

Returns:
Returns 0, if ok.

int imgMax IMG img,
float *  maxvalue
 

Searche the max pixel value in the IMG data.

Returns:
Returns 0, if ok.

int imgMinMax IMG img,
float *  minvalue,
float *  maxvalue
 

Searches the min and max pixel value in the IMG data.

Returns:
Returns 0, if ok.

int imgRawCountsPerTime IMG img,
int  operation
 

Divide or multiply raw data (sinogram) counts by frame duration. If IMG is not raw data, division is quietly not done.

Returns:
Returns 0 if ok.
Parameters:
img  IMG containing raw data
operation  1=division, 0=multiply

int imgSetScanner IMG img,
int  scanner_type
 

Sets scanner specific parameters in IMG data. If possible, set image zoom before calling this.

Returns:
Returns 0, if ok.
Parameters:
img  IMG data which is filled with scanner specific information
scanner_type  SCANNER_ECAT931, SCANNER_ADVANCE, SCANNER_HRPLUS, SCANNER_HRRT

int imgThresholdByTemplate IMG img,
IMG template,
float  thrValue
 

Threshold IMG by a template. Sets pixel values in img to thrValue, if corresponding pixel value in template is == 0. Only first plane of template is used.

Returns:
Returns 0, if ok.
Parameters:
img  Image to threshold
template  Threshold template (1 frame) where 0=cut off
thrValue  Value which is written in cut off pixels

int imgThresholdTemplate IMG img,
float  minValue,
float  maxValue,
IMG timg
 

Creates a template image based on lower and upper threshold values. This function allocates memory for the template. If pixel value in original image is >=minValue and <=maxValue, the corresponding template pixel is set to 1, otherwise to 0. Only the first frame of images is applied.

Returns:
Returns 0 if ok.
Parameters:
img  Original image
minValue  Lower threshold
maxValue  Upper threshold
timg  Template image


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