libtpcmisc
 All Data Structures Files Functions Variables Enumerator Defines
Functions | Variables
halflife.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <math.h>
#include "include/halflife.h"
#include "include/substitutions.h"
Include dependency graph for halflife.c:

Go to the source code of this file.

Functions

char * hlIsotopeCode (int isotope)
double hlFromIsotope (char *isocode)
double hl2lambda (double halflife)
double hlLambda2factor (double lambda, double frametime, double framedur)
float hlLambda2factor_float (float lambda, float frametime, float framedur)
char * hlCorrectIsotopeCode (char *isocode)
int hlIsotopeFromHalflife (double halflife)

Variables

static char * isotope_code []
static double isotope_halflife []

Function Documentation

double hl2lambda ( double  halflife)

Calculates the isotope lambda from specified halflife.

Parameters:
halflifehalflife time value
Returns:
A negative value is returned in case of error.

Definition at line 139 of file halflife.c.

References M_LN2.

char* hlCorrectIsotopeCode ( char *  isocode)

Check that isotope code, e.g. F-18, is in valid format, containing '-' and in this order. Returns the correct isotope code.

Parameters:
isocodePointer to string "C-11", "11c" etc; contents of this string is not changed, and this is not returned in any case
Returns:
pointer to correct isotope code, and NULL if it was not valid and could not be corrected.

Definition at line 196 of file halflife.c.

References isotope_code.

Referenced by hlFromIsotope().

double hlFromIsotope ( char *  isocode)

Identify the isotope from the specified isotope code string and return the halflife (min). This function checks the validity of the isotope string using hlCorrectIsotopeCode(), but does not change it in any way.

Parameters:
isocodePointer to string "C-11", "18f" etc. This argument is not changed
Returns:
A negative value is returned in case of error.

Definition at line 113 of file halflife.c.

References hlCorrectIsotopeCode(), isotope_code, and isotope_halflife.

Here is the call graph for this function:

char* hlIsotopeCode ( int  isotope)

Isotope code as a string, based on isotope list number.

Parameters:
isotopeindex of PET isotope in the list in halflife.c
Returns:
pointer to static string or "unknown".

Definition at line 93 of file halflife.c.

References isotope_code.

int hlIsotopeFromHalflife ( double  halflife)

Identify the isotope based on its halflife (in minutes).

Parameters:
halflifeHalf-life in minutes
Returns:
the isotope list number, or negative value if not identified.

Definition at line 250 of file halflife.c.

References isotope_halflife.

double hlLambda2factor ( double  lambda,
double  frametime,
double  framedur 
)

Calculate the decay correction factor for specified isotope lambda.

Parameters:
lambdaNegative lambda removes decay correction
frametimeFrame start time, or mid time if framedur<=0
framedurIf unknown, set <0 and give mid time for frametime
Returns:
A negative value is returned in case of error.

Definition at line 153 of file halflife.c.

float hlLambda2factor_float ( float  lambda,
float  frametime,
float  framedur 
)

Calculate the decay correction factor for specified isotope lambda. Version for floats (mainly image data).

Parameters:
lambdaNegative lambda removes decay correction
frametimeFrame start time, or mid time if framedur<=0
framedurIf unknown, set <0 and give mid time for frametime
Returns:
A negative value is returned in case of error.

Definition at line 173 of file halflife.c.


Variable Documentation

char* isotope_code[] [static]
Initial value:
 {
  "Br-75", "Br-76", "Cu-62", "Cu-64", "Fe-52",
  "Ga-68", "Ge-68", "Na-22", "Rb-82", "Zn-62",
  "F-18",  "C-11",  "N-13",  "O-15",  "O-14", "I-124",
0}

Valid isotope codes. Note: when adding isotopes, make sure that all isotopes with one letter are AFTER all two letter isotopes with the same initial letter.

Definition at line 72 of file halflife.c.

Referenced by hlCorrectIsotopeCode(), hlFromIsotope(), and hlIsotopeCode().

double isotope_halflife[] [static]
Initial value:

Isotope half-lives in minutes

Definition at line 78 of file halflife.c.

Referenced by hlFromIsotope(), and hlIsotopeFromHalflife().