|
TPCCLIB
|
Header file for libtpcidi. More...
#include "tpcclibConfig.h"#include "libtpcmisc.h"#include "libtpcmodel.h"#include "libtpcsvg.h"#include "libtpccurveio.h"#include "libtpcimgio.h"#include "libtpcimgp.h"#include "libtpcmodext.h"Go to the source code of this file.
Functions | |
| int | imgCircleMask (IMG *img, int zi, double cx, double cy, double r, double mv, double *smv, int verbose) |
| int | imgRingMask (IMG *img, int zi, double cx, double cy, double r1, double r2, double mv, double *smv, int verbose) |
| int | imgSimulateRing (IMG *img, int fi, int zi, double cx, double cy, double r1, double r2, double vr, double vi, double vo, int verbose) |
| int | simMyocDiameterCurve (DFT *dft, double t1, double t2, double hbr, double maxdiam, double mindiam) |
| int | imgSimulateSphere (IMG *img, int fi, double cx, double cy, double cz, double r1, double r2, double vr, double vi, double vo, int verbose) |
| int | heartRecoverySpilloverCorrectionFactors (double R, double d, double s, double Vb, double *FMM, double *FMB, double *FBM, double *FBB) |
| int | imgMaskPixelTACs (IMG *img, IMG *mask, double thrs, DFT *dft, int verbose) |
| int | imgGetConcWeightedPeakPos (IMG *img, float thrs, IMG_PIXEL *pos, int verbose) |
| double | rcPeakPET (double FWHM, double R) |
| int | idiSimulateTubeVol (VOL *vol, int zi, double cx, double cy, double r, double FWHM, double cbkg, double cblo) |
| int | idiSimulateTubeImg (IMG *img, int zi, double cx, double cy, double r, double *cbkg, double *cblo) |
| int | idiSimulateTubeImgPlane (int simmet, IMG *img, int zi, double cx, double cy, double r, double FWHM, double *cbkg, double *cblo) |
Header file for libtpcidi.
Definition in file libtpcidi.h.
|
extern |
Calculate recovery and spillover correction coefficients.
Based on Henze E, Huang S-C, Ratib O, Hoffman E, Phelps ME, Schelbert HR. Measurements of regional tissue and blood-pool radiotracer concentrations from serial tomographic images of the heart. J Nucl Med. 1983;24:987-996.
| R | radius of cavity and circular ROI (mm). |
| d | thickness of myocardium (mm). |
| s | spatial resolution (mm); s = FWHM/(2*SQRT(2*LN(2))). |
| Vb | Vascular volume fraction in myocardium; Henze et al assumed 0.1. |
| FMM | Pointer to resulting correction coefficient FMM, see the article. |
| FMB | Pointer to resulting correction coefficient FMB, see the article. |
| FBM | Pointer to resulting correction coefficient FBM, see the article. |
| FBB | Pointer to resulting correction coefficient FBB, see the article. |
Definition at line 37 of file heartcorr.c.
|
extern |
Simulate dynamic image surrounding a circular object extending across image planes (vessel).
| img | Pointer to allocated dynamic image; volume must contain pixel sizes and dimensions, and the same time frames as the TAC data. |
| zi | Plane index [0..dimz-1]. |
| cx | X distance of circle centre (mm) from the upper left corner of the image. |
| cy | Y distance of circle centre (mm) from the upper left corner of the image. |
| r | Radius of vessel (mm). |
| cbkg | Array of background activities; size must be the same as img frame number. |
| cblo | Array of vessel activities; can be higher or lower than background; size must be the same as img frame number. |
Definition at line 81 of file vessel.c.
|
extern |
Simulate image surrounding a circular object extending across image planes (bar or vessel). This function applies currently two methods to simulate the spill-over and spill-in effects:
Method 1. is based on Germano et al. JNM 1992; 33: 613-620. This equation can not be used to estimate recovery coefficient or the true activity concentration inside the vessel, but only to fit the radius of the vessel (see Germano), which then can be used to calculate the RC.
Method 2. simulates just the vessel without PVE; add 2D Gaussian smoothing later.
To simulate the circular vessel correctly in 2D image matrix use the equations in Brix et al. Nuklearmedizin 2002;41:184-190 instead; however, that would require numerical solution to double integrals, which may be either slow or error-prone for fitting purposes.
| simmet | Simulation method: 0=Germano, -1 or 1=No PVE. |
| img | Pointer to allocated dynamic image; volume must contain pixel sizes and dimensions, and the same time frames as the TAC data. |
| zi | Plane index [0..dimz-1]. |
| cx | X distance of circle centre (mm) from the upper left corner of the image. |
| cy | Y distance of circle centre (mm) from the upper left corner of the image. |
| r | Radius of vessel (mm). |
| FWHM | FWHM (mm). |
| cbkg | Array of background activities; size must be the same as img frame number. |
| cblo | Array of vessel activities; can be higher or lower than background; size must be the same as img frame number. |
Definition at line 143 of file vessel.c.
|
extern |
Simulate image volume surrounding a circular object extending across image planes (bar or vessel). Based on Germano et al. JNM 1992; 33: 613-620.
This equation can not be used to estimate recovery coefficient or the true activity concentration inside the vessel, but only to fit the radius of the vessel (see Germano), which then can be used to calculate the RC.
To simulate the circular vessel correctly in 2D image matrix use the equations in Brix et al. Nuklearmedizin 2002;41:184-190 instead; however, that would require numerical solution to double integrals, which may be either slow or error-prone for fitting purposes.
In this version, the activity is calculated as an average of four samples inside the pixel.
| vol | Pointer to allocated image volume; volume must contain pixel sizes and dimensions |
| zi | Plane index [0..dimz-1]. |
| cx | X distance of circle centre (mm) from the upper left corner of the image. |
| cy | Y distance of circle centre (mm) from the upper left corner of the image. |
| r | Radius of vessel (mm). |
| FWHM | FWHM (mm). |
| cbkg | Background activity. |
| cblo | Vessel activity; can be higher or lower than background. |
Definition at line 26 of file vessel.c.
|
extern |
Simulate a mask image of circle with specified radius.
The applied method is only approximate at pixel borders (pixel is divided into 5x5 subpixels).
| img | Pointer to allocated static or dynamic image; image must contain pixel sizes and dimensions; mask values are added to pixel values, thus you may need to set pixel values to zero before calling this function. |
| zi | Plane index [0..dimz-1]. |
| cx | X distance of circle centre (mm) from the upper left corner of the image. |
| cy | Y distance of circle centre (mm) from the upper left corner of the image. |
| r | Radius of circle (mm). |
| mv | Mask value; this value is added to each pixel value that fits inside the radius; the pixels that are partially inside the radius will get fraction of mask value. |
| smv | Pointer to value where the sum of added mask pixel values is written; enter NULL if not needed. Use this to validate the results. |
| verbose | Verbose level; set to <=0 to prevent all prints to stdout. |
Definition at line 16 of file circle.c.
Referenced by imgRingMask().
Calculates concentration weighted peak position from a sum image.
| img | Pointer to allocated image from which the peak position is searched. If IMG struct contains more than one times frame, then only the first one is used. |
| thrs | Threshold fraction (0<thrs<1) between image min and max. |
| pos | Pointer to pixel position structure. |
| verbose | Verbose level; set to <=0 to prevent all prints to stdout and stderr. |
Definition at line 14 of file peak.c.
Extract TACs of every image voxel which has a value > thrs in the mask image.
Mask value is saved as region 'size' in DFT. Mainly for testing IDI methods.
| img | Pointer to allocated image from which the weighted TAC is calculated. |
| mask | Pointer to mask image; x, y, and z dimensions must be the same as in the image to which the mask is applied. |
| thrs | Mask threshold: pixels with mask values above this are included in TACs. |
| dft | Pointer to initiated DFT struct where pixel TACs will be written; any previous contents are deleted. |
| verbose | Verbose level; set to <=0 to prevent all prints to stdout . |
Definition at line 17 of file idimask.c.
|
extern |
Simulate a mask image of ring with specified inner and outer radius.
The applied method is only approximate at pixel borders (pixel is divided into 5x5 subpixels).
| img | Pointer to allocated static or dynamic image; image must contain pixel sizes and dimensions; mask values are added to pixel values, thus you may need to set pixel values to zero before calling this function. |
| zi | Plane index [0..dimz-1]. |
| cx | X distance of circle centre (mm) from the upper left corner of the image. |
| cy | Y distance of circle centre (mm) from the upper left corner of the image. |
| r1 | Inner radius of circle (mm). |
| r2 | Outer radius of circle (mm). |
| mv | Mask value; this value is added to each pixel value that fits inside the radius; the pixels that are partially inside the radius will get fraction of mask value. |
| smv | Pointer to value where the sum of added mask pixel values is written; enter NULL if not needed. Use this to validate the results. |
| verbose | Verbose level; set to <=0 to prevent all prints to stdout. |
Definition at line 77 of file circle.c.
|
extern |
Simulate an image of ring with specified inner and outer radius and activity in the ring and inside and outside of it. The applied method is only approximate at pixel borders (pixel is divided into 5x5 subpixels). PET resolution effects are not simulated.
| img | Pointer to allocated static or dynamic image; image must contain pixel sizes and dimensions; values are added to any existing pixel values, thus you may need to set pixel values to zero before calling this function. |
| fi | Frame index [0..dimt-1]. |
| zi | Plane index [0..dimz-1]. |
| cx | X distance of circle centre (mm) from the upper left corner of the image. |
| cy | Y distance of circle centre (mm) from the upper left corner of the image. |
| r1 | Inner radius of circle (mm). |
| r2 | Outer radius of circle (mm). |
| vr | Ring value; this value is added to each pixel value that fits inside the radius's; the pixels that are partially inside the ring will get fraction of the value. |
| vi | Inside value; this value is added to each pixel value that fits inside the inner radius; the pixels that are partially inside the radius will get fraction of the value. |
| vo | Outside value; this value is added to each pixel value that fits outside the outer radius; the pixels that are partially outside the radius will get fraction of the value. |
| verbose | Verbose level; set to <=0 to prevent all prints to stdout. |
Definition at line 17 of file heart.c.
|
extern |
Simulate a 3D image of circle with specified inner and outer radius and activity in the circle and inside and outside of it.
The applied method is only approximate at pixel borders (pixel is divided into 5x5 subpixels). PET resolution effects are not simulated.
| img | Pointer to allocated static or dynamic image; image must contain pixel sizes and dimensions; values are added to any existing pixel values, thus you may need to set pixel values to zero before calling this function. |
| fi | Frame index [0..dimt-1]. |
| cx | X distance of circle centre (mm) from the upper left corner of the image. |
| cy | Y distance of circle centre (mm) from the upper left corner of the image. |
| cz | Z distance of circle centre (mm) from the upper left corner of the image. |
| r1 | Inner radius of circle (mm). |
| r2 | Outer radius of circle (mm). |
| vr | Sphere wall value; this value is added to each pixel value that fits inside the radius's; the pixels that are partially inside the wall will get fraction of the value. |
| vi | Inside value; this value is added to each pixel value that fits inside the inner radius; the pixels that are partially inside the radius will get fraction of the value. |
| vo | Outside value; this value is added to each pixel value that fits outside the outer radius; the pixels that are partially outside the radius will get fraction of the value. |
| verbose | Verbose level; set to <=0 to prevent all prints to stdout. |
Definition at line 154 of file heart.c.
|
extern |
Calculate the traditional recovery coefficient (RC) of peak value of a circular radioactive object in 2D PET image, assuming that the object length in 3D is relatively long, and assuming that activity of background is zero.
True object activity A0 can be calculated using RC, background activity Abkg, and measured peak activity Aexp using equation A0 = Abkg + (Aexp - Abkg)/RC , or if Abkg=0, A0 = Aexp/RC.
References: Germano et al. JNM 1992; 33: 613-620 and Brix et al. Nuklearmedizin 2002;41:184-190.
| FWHM | Full-width half-maximum value. |
| R | Radius of the object. |
Definition at line 24 of file recovery.c.
|
extern |
Calculate the inner LV cavity diameter as a function of time for simulations.
10 samples per heart beat will be calculated. Fractional increase/decrease rate is fixed and coded in here.
| dft | Pointer to initiated DFT struct where diameter curve will be written. |
| t1 | Start time (s). |
| t2 | Stop time (s). |
| hbr | Heart rate (beats/min). |
| maxdiam | Maximum inner diameter (mm). |
| mindiam | Minimum inner diameter (mm). |
Definition at line 96 of file heart.c.