libtpcimgio
 All Data Structures Files Functions Variables Typedefs Enumerator Macros Pages
Functions
imgdecay.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include <string.h>
#include <ctype.h>
#include "halflife.h"
#include "branch.h"
#include "include/img.h"
#include "include/imgdecay.h"

Go to the source code of this file.

Functions

int imgDecayCorrection (IMG *image, int mode)
 
char * imgIsotope (IMG *img)
 
int imgSetDecayCorrFactors (IMG *image, int mode)
 
int imgBranchingCorrection (IMG *image, int mode, int verbose, char *status)
 

Function Documentation

int imgBranchingCorrection ( IMG image,
int  mode,
int  verbose,
char *  status 
)
Corrects image data for branching fraction (mode=1) or removes correction
(mode=0). Removal is primarily based on branching factor stored in 
IMG struct, secondarily on isotope; after removal, branching factor is
set to 1, and pixel values and calibration factor are multiplied with it.
Correction is based on branching fractions in branch.h; pixel values and
calibration factor are divided by it, and its value is stored in IMG struct.

Note that this function can not know if branching fraction correction is
included in the data (as it usually is) or not.
Returns
Returns 0 if ok.
Parameters
imagePointer to IMG data
modeBranching fraction correction (1) or removal of correction (0)
verboseVerbose level; if zero, then nothing is printed into stdout or stderr
statusPointer to allocated string where error message will be written; NULL, if not needed.

Definition at line 178 of file imgdecay.c.

References IMG::branchingFraction, IMG::calibrationFactor, IMG::dimt, IMG::dimx, IMG::dimy, IMG::dimz, IMG_STATUS_OCCUPIED, IMG::isotopeHalflife, IMG::m, and IMG::status.

int imgDecayCorrection ( IMG image,
int  mode 
)

Corrects (mode=1) or removes correction (mode=0) for physical decay. Removal is based on existing decay correction factors, when possible.

Parameters
imagepointer to IMG data
mode0=Remove decay correction; 1=Correct for decay
Returns
0 if ok, 1 image status is not 'occupied', 2 decay already corrected/not corrected, 3 image frame times missing

Definition at line 64 of file imgdecay.c.

References IMG::decayCorrection, IMG::decayCorrFactor, IMG::dimt, IMG::dimx, IMG::dimy, IMG::dimz, IMG::end, IMG_DC_CORRECTED, IMG_DC_NONCORRECTED, IMG_STATUS_OCCUPIED, IMG_TEST, IMG::isotopeHalflife, IMG::m, IMG::start, and IMG::status.

char* imgIsotope ( IMG img)

Returns pointer to string describing the isotope in image data

Parameters
imgimage stucture
Returns
pointer to string

Definition at line 119 of file imgdecay.c.

References IMG::isotopeHalflife.

Referenced by ecat63AddImg(), ecat63WriteAllImg(), img2sif(), imgSetEcat63MHeader(), and imgSetEcat7MHeader().

int imgSetDecayCorrFactors ( IMG image,
int  mode 
)

Sets (mode=1) or removes (mode=0) decay correction factors in IMG. IMG pixel data is not changed.

Parameters
imagepointer to IMG data
modefactors are calculated for decay correction (1) or for removing decay correction (0)
Returns
0 if ok, 1 image status is not 'occupied', 2 invalid exponent value, 3 image frame times are missing

Definition at line 135 of file imgdecay.c.

References IMG::decayCorrection, IMG::decayCorrFactor, IMG::dimt, IMG::end, IMG_DC_CORRECTED, IMG_DC_NONCORRECTED, IMG_STATUS_OCCUPIED, IMG::isotopeHalflife, IMG::start, and IMG::status.

Referenced by test_create_img().