|
TPCCLIB
|
Header file for libtpcrec. More...
#include "tpcclibConfig.h"#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include <float.h>#include <ctype.h>#include <time.h>#include "libtpcmisc.h"#include "libtpcimgio.h"Go to the source code of this file.
Data Structures | |
| struct | ELLIPSE |
| Ellipse on two dimensional plane. More... | |
| struct | PRMAT |
| struct | RADON |
Functions | |
| void | ellipseInit (ELLIPSE *ell) |
| void | ellipseEmpty (ELLIPSE *ell) |
| void | ellipseInfo (ELLIPSE *ell) |
| int | ellipseAllocate (ELLIPSE *ell, int imgDim) |
| int | ellipseSetFromParams (ELLIPSE *ell, int imgDim, float *semis, float *cent, float incli, float val) |
| int | ellipseReadEllipse (FILE *fp, ELLIPSE *ell) |
| int | ellipseSaveEllipse (ELLIPSE *ell, FILE *fp) |
| float | ellipseGetMajor (ELLIPSE *ell) |
| float | ellipseGetMinor (ELLIPSE *ell) |
| float | ellipseGetCenterX (ELLIPSE *ell) |
| float | ellipseGetCenterY (ELLIPSE *ell) |
| float | ellipseGetInclination (ELLIPSE *ell) |
| int | ellipseGetImgSize (ELLIPSE *ell) |
| int | ellipseGetValue (ELLIPSE *ell) |
| int ** | ellipseGetArray (ELLIPSE *ell) |
| int | ellipseIsInside (ELLIPSE *ell, int row, int col) |
| int | fbp (float *sinogram, int rays, int views, int dim, int filter, float cutoff, float *image) |
| int | imgFBP (IMG *scn, IMG *img, int imgDim, float zoom, int filter, float cutoff, float shiftX, float shiftY, float rotation, int verbose) |
| int | fbpMakeFilter (float *sinFFT, float *cosFFT, float cutoff, int filter, int lenFFT, int views, float *fbpFilter, int verbose) |
| void | fbp_fft_bidir_complex_radix2 (float *real, float *imag, int direct, int n, float *sine, float *cosine) |
| void | fbp_back_proj (float *prj, float *imgCorner, int imgDim, int view, int views, int rays, float offsX, float offsY, float *sinB, float *sinBrot) |
| void | fbp_back_proj_round (float *prj, float *imgOrigin, int imgDim, int view, int views, int rays, float offsX, float offsY, float bpZoom, float *sinB, float *sinBrot) |
| int | imgMRP (IMG *scn, IMG *img, int imgDim, float zoom, float shiftX, float shiftY, float rotation, int maxIterNr, int skipPriorNr, float beta, int maskDim, int osSetNr, int verbose) |
| void | mrpUpdate (float *coef, float *img, float *oimg, int n) |
| void | mrpProjectionCorrection (float *measured, float *proj, float *correct, int os_sets, int rays, int views) |
| int | mrp (float *sinogram, int rays, int views, int iter, int os_sets, int maskdim, float zoom, float beta, int skip_prior, int dim, float *image, int verbose) |
| void | do_prior (float *img, float beta, float *med_coef, int dim, float small, int maskdim, float *maxm) |
| float | med9 (float *inp, int dim) |
| float | med21 (float *inp, int dim) |
| void | prmatInit (PRMAT *mat) |
| void | prmatEmpty (PRMAT *mat) |
| int | prmatAllocate (PRMAT *mat, int set, unsigned int rows, unsigned int *coords) |
| unsigned int | prmatGetNV (PRMAT *mat) |
| unsigned int | prmatGetNB (PRMAT *mat) |
| unsigned int | prmatGetID (PRMAT *mat) |
| unsigned int | prmatGetPIX (PRMAT *mat) |
| unsigned int | prmatGetPixCoord (PRMAT *mat, int row) |
| unsigned int | prmatGetRays (PRMAT *mat, int row) |
| unsigned int | prmatGetBinView (PRMAT *mat, int row, int ind) |
| unsigned int | prmatGetRows (PRMAT *mat) |
| unsigned int | prmatGetPixels (PRMAT *mat, int row) |
| unsigned int | prmatGetCoord (PRMAT *mat, int row, int pix) |
| unsigned int | prmatGetXCoord (PRMAT *mat, int row, int pix) |
| unsigned int | prmatGetYCoord (PRMAT *mat, int row, int pix) |
| float | prmatGetFactor (PRMAT *mat, int row, int pix) |
| float | prmatGetMajor (PRMAT *mat) |
| float | prmatGetMinor (PRMAT *mat) |
| float | prmatGetMin (PRMAT *mat) |
| float | prmatGetMax (PRMAT *mat) |
| float | prmatGetFactorSum (PRMAT *mat) |
| float | prmatGetFactorSqrSum (PRMAT *mat, int row) |
| int | prmatReadMatrix (char *fname, PRMAT *mat) |
| int | prmatSaveMatrix (PRMAT *mat) |
| void | radonEmpty (RADON *radtra) |
| int | radonSet (RADON *radtra, int mode, int imgDim, int viewNr, int binNr) |
| int | radonGetMO (RADON *radtra) |
| int | radonGetID (RADON *radtra) |
| int | radonGetNV (RADON *radtra) |
| int | radonGetNB (RADON *radtra) |
| float | radonGetSD (RADON *radtra) |
| int | radonGetHI (RADON *radtra) |
| int | radonGetCB (RADON *radtra) |
| float | radonGetSin (RADON *radtra, int nr) |
| int | radonFwdTransform (RADON *radtra, int set, int setNr, float *imgdata, float *scndata) |
| int | radonFwdTransformEA (RADON *radtra, int set, int setNr, float *imgdata, float *scndata) |
| int | radonFwdTransformSA (RADON *radtra, int set, int setNr, float *imgdata, float *scndata) |
| int | radonFwdTransformPRM (PRMAT *mat, int set, int setNr, float *imgdata, float *scndata) |
| int | radonBackTransform (RADON *radtra, int set, int setNr, float *scndata, float *imgdata) |
| int | radonBackTransformEA (RADON *radtra, int set, int setNr, float *scndata, float *imgdata) |
| int | radonBackTransformSA (RADON *radtra, int set, int setNr, float *imgdata, float *scndata) |
| int | radonBackTransformPRM (PRMAT *mat, int set, int setNr, float *scndata, float *imgdata) |
| int | radonSetBases (RADON *radtra, ELLIPSE *elli, PRMAT *mat) |
| int | radonSetBasesEA (RADON *radtra, ELLIPSE *elli, PRMAT *mat) |
| int | radonSetLUT (RADON *radtra, ELLIPSE *elli, PRMAT *mat) |
| int | radonSetLORS (RADON *radtra, ELLIPSE *elli, PRMAT *mat) |
| void | recSinTables (int views, float *sinB, float *sinBrot, float rotation) |
| void | recInterpolateSinogram (float *srcsino, float *newsino, int srcrays, int newrays, int views) |
| int | bit_rev_int (int x, int n) |
| void | set_os_set (int os_sets, int *set_seq) |
| int | recGetStatistics (float *buf, int n, float *osum, float *omin, float *omax, int skip_zero_mins) |
| int | imgReprojection (IMG *img, IMG *scn, int verbose) |
| int | reprojection (float *image, int dim, int rays, int views, float bpzoom, float *sinogram, int verbose) |
| void | viewReprojection (float *idata, float *sdata, int view, int dim, int viewNr, int rayNr, float *sinB, float *sinBrot, float offsX, float offsY, float bpZoom) |
| void | reprojectionAvg3 (float *data, int n) |
| void | reprojectionAvg5 (float *data, int n) |
| void | reprojectionMed3 (float *data, int n) |
| void | viewBackprojection (float *prj, float *idata, int dim, int view, int viewNr, int rayNr, float *sinB, float *sinBrot, float offsX, float offsY, float bpZoom) |
| int | trmrp (float *bla, float *tra, int dim, float *image, int iter, int sets, int rays, int views, int maskdim, float zoom, float beta, float axial_fov, float sample_distance, int skip_prior, int osl, float shiftX, float shiftY, float rotation, int verbose) |
Variables | |
| int | ELLIPSE_TEST |
| Drive in test mode if not 0. | |
| int | ELLIPSE_VERBOSE |
| Drive in verbose mode if not 0. | |
| int | PRMAT_TEST |
| If not 0 drive in test mode. | |
| int | PRMAT_VERBOSE |
| If not 0 drive in verbose mode. | |
| int | RADON_TEST |
| Drive in test mode if not 0. | |
| int | RADON_VERBOSE |
| Drive in verbose mode if not 0. | |
Header file for libtpcrec.
Definition in file libtpcrec.h.
| anonymous enum |
Definition at line 147 of file libtpcrec.h.
| anonymous enum |
Definition at line 82 of file libtpcrec.h.
| anonymous enum |
Definition at line 246 of file libtpcrec.h.
| anonymous enum |
Definition at line 152 of file libtpcrec.h.
| anonymous enum |
Definition at line 151 of file libtpcrec.h.
| anonymous enum |
Definition at line 26 of file libtpcrec.h.
|
extern |
Bit-reverse for integers in a list, used by set_os_set().
| x | Integer to bit-convert. |
| n | Number of elements. |
Definition at line 77 of file recutil.c.
Referenced by set_os_set().
|
extern |
Do prior in MRP reconstruction.
| img | Float array of size dim*dim containing the image data. |
| beta | Beta value. |
| med_coef | Median coefficients, an array of size dim*dim, calculated here. |
| dim | Image dimensions. |
| small | Limit for too small values. |
| maskdim | Mask dimensions; 3 or 5. |
| maxm | Max median coefficient; enter NULL if not needed. |
Definition at line 77 of file mrprior.c.
|
extern |
Allocates memory for ELLIPSE data. Normally used only in SET-functions.
| ell | pointer to ellipse for which the allocation is done. |
| imgDim | size of the image plane on which the ellipse is to be done. |
Definition at line 94 of file ellipse.c.
Referenced by ellipseSetFromParams().
|
extern |
Frees the memory allocated for ellipse. All data is cleared.
| ell | pointer to ellipse to be emptied. |
Definition at line 47 of file ellipse.c.
Referenced by ellipseReadEllipse().
|
extern |
Returns the ellipse array of the given ellipse.
Ellipse array contains n x n items, single item is one if it is inside the ellipse and zero otherwise. Coordinates on a two dimensional plane are numbered from upper left corner.
| ell | pointer to ellipse. |
Definition at line 339 of file ellipse.c.
|
extern |
|
extern |
|
extern |
|
extern |
|
extern |
Returns the major semiaxe of the ellipse.
| ell | pointer to ellipse. |
Definition at line 254 of file ellipse.c.
Referenced by radonSetBases(), and radonSetBasesEA().
|
extern |
Returns the minor semiaxe of the ellipse.
| ell | pointer to ellipse. |
Definition at line 265 of file ellipse.c.
Referenced by radonSetBases(), and radonSetBasesEA().
|
extern |
|
extern |
|
extern |
Initializes ELLIPSE datatype for use. To be used before any use of ELLIPSE type variables.
| ell | pointer to ellipse to be initialized. |
Definition at line 23 of file ellipse.c.
|
extern |
Tests whether the given pixel is inside the given ellipse or not.
| ell | ellipse on which the testing is to be done. |
| row | row coordinate of a pixel. |
| col | column coordinate of a pixel. |
Definition at line 352 of file ellipse.c.
Referenced by radonSetBases(), radonSetBasesEA(), and radonSetLUT().
|
extern |
Reads one ellipse from the given file to the given ELLIPSE structure.
A coordinate file contains the parameters of the ellipses in one line in the following order: Coordinate 1: v the additive intensity value of the ellipse Coordinate 2: a the length of the horizontal semi-axis of the ellipse Coordinate 3: b the length of the vertical semi-axis of the ellipse Coordinate 4: x the x-coordinate of the center of the ellipse Coordinate 5: y the y-coordinate of the center of the ellipse Coordinate 6: p the angle (in degrees) between the horizontal semi-axis of the ellipse and the x-axis of the image
Coordinate 7: d the image dimension
| fp | A pointer to open file containing ellipse(s) in correct format. |
| ell | pointer to ELLIPSE structure where the read ellipse is to be set. |
Definition at line 198 of file ellipse.c.
|
extern |
|
extern |
Sets the ellipse according to given coordinates and image dimension.
| ell | pointer to ellipse for which the setting is to be done. |
| imgDim | size of the image plane. |
| semis | major and minor semiaxis of the ellipse. |
| cent | center of the ellipse. |
| incli | inclination of the ellipse. |
| val | value inside the ellipse. |
Definition at line 119 of file ellipse.c.
Referenced by ellipseReadEllipse().
|
extern |
Filtered back-projection (FBP) reconstruction of one 2D data matrix given as an array of floats.
Image cannot be zoomed (zoom=1), rotated, or shifted.
| sinogram | Pointer to float array containing rays*views sinogram values. |
| rays | Nr of rays (bins or columns) in sinogram data. |
| views | Nr of views (rows) in sinogram data. |
| dim | Image x and y dimensions; must be an even number, preferrably the same as number of rays, but there is no reason for it to be any larger than that. |
| filter | Filter: 0=None, 1=Ramp, 2=Butter, 3=Hann, 4=Hamm, 5=Parzen, 6=Shepp. |
| cutoff | Noise cut-off (for example 0.3). |
| image | Pointer to pre-allocated image data; size must be at least dim*dim. |
Definition at line 20 of file fbp.c.
|
extern |
Backprojection with all projection profiles overlapping the image area.
| prj | pointer to projection data |
| imgCorner | pointer to destination image (upper left corner) |
| imgDim | image dimension |
| view | projection view number |
| views | number of projection views |
| rays | number of rays |
| offsX | x offset |
| offsY | y offset |
| sinB | Sine tables |
| sinBrot | SinBrot array |
Definition at line 599 of file fbp.c.
Referenced by imgFBP().
|
extern |
Backprojection with projection profiles NOT overlapping the image area.
The corner pixels are left unchanged.
| prj | pointer to projection data |
| imgOrigin | pointer to image origin (center) |
| imgDim | image dimension |
| view | projection view number |
| views | number of projection views |
| rays | number of rays |
| offsX | x offset in pixels |
| offsY | y offset in pixels |
| bpZoom | Zoom |
| sinB | Sine tables |
| sinBrot | sinBrot array |
Definition at line 655 of file fbp.c.
|
extern |
In-place bidirectional radix-2 discrete FFT of complex data, applying pre-computed sine and cosine tables.
Adapted from subroutine FOUREA listed in Programs for Digital Signal Processing Edited by Digital Signal Processing Committee IEEE Acoustics Speech and Signal Processing Committee Chapter 1 Section 1.1 Page 1.1-4,5
| real | Array of real part complex data |
| imag | Array of imaginary part complex data |
| direct | direction: 0 and 1=forward FFT, -1=inverse FFT |
| n | Array length |
| sine | Sine table |
| cosine | Cosine table |
Definition at line 512 of file fbp.c.
|
extern |
Compute filter coefficients for FBP reconstruction.
The filter is made by multiplying a ramp by a window function, according to the filter type.
| sinFFT | Sine table for FFT |
| cosFFT | Cosine table for FFT |
| cutoff | Noise cut-off |
| filter | Filter code: 0=None, 1=Ramp, 2=Butter, 3=Hann, 4=Hamm, 5=Parzen, 6=Shepp. |
| lenFFT | length of FFT array; must be 256, 512, 1024, 2048, ... |
| views | nr of scan views (dim y) |
| fbpFilter | filter array for FBP (output); allocated outside with size lenFFT+1 |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout |
Definition at line 382 of file fbp.c.
|
extern |
Filtered back-projection (FBP) reconstruction using data in IMG struct.
| scn | Sinogram (input) data. |
| img | Image (output) data; allocated here. |
| imgDim | Image dimension (size, usually 128 or 256); must be an even number. |
| zoom | Zoom factor (for example 2.45) |
| filter | Filter code: 0=None, 1=Ramp, 2=Butter, 3=Hann, 4=Hamm, 5=Parzen, 6=Shepp. |
| cutoff | Noise cut-off (for example 0.3). |
| shiftX | Possible shifting in x dimension (mm). |
| shiftY | Possible shifting in y dimension (mm). |
| rotation | Possible image rotation (in degrees). |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 108 of file fbp.c.
|
extern |
Median Root Prior (MRP) reconstruction using data in IMG struct.
| scn | Sinogram (input) data. Data must be normalization and attenuation corrected. |
| img | Image (output) data; allocated here. |
| imgDim | Image dimension (size, usually 128 or 256); must be an even number. |
| zoom | Zoom factor (for example 2.45 for the brain); 1=no zooming. |
| shiftX | Possible shifting in x dimension (mm). |
| shiftY | Possible shifting in y dimension (mm). |
| rotation | Possible image rotation, -180 - +180 (in degrees). |
| maxIterNr | Nr of iterations, for example 150. |
| skipPriorNr | Number of iterations to skip before prior; usually 1. |
| beta | Beta, 0.01 - 0.9; usually 0.3 for emission, 0.9 for transmission. |
| maskDim | Median filter mask dimension; 3 or 5 (9 or 21 pixels). |
| osSetNr | Number of Ordered Subset sets; 1, 2, 4, ... 128. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 21 of file mrp.c.
Image reprojection to 2D sinogram.
| img | Pointer to IMG struct containing the input image data. img->sizez is used to determine the scanner specific parameters including sinogram dimensions. |
| scn | Pointer to initiated IMG struct in which the sinogram will be written. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout |
Definition at line 16 of file reprojection.c.
|
extern |
Compute 5x5 median without corners from image data inside float array.
| inp | Pointer to central pixel in image data, around which the median is computed. |
| dim | Image dimensions. |
Definition at line 49 of file mrprior.c.
Referenced by do_prior(), and trmrp().
|
extern |
Compute 3x3 median from image data inside float array.
| inp | Pointer to central pixel in image data, around which the median is computed. |
| dim | Image dimensions. |
Definition at line 15 of file mrprior.c.
Referenced by do_prior(), and trmrp().
|
extern |
Median Root Prior (MRP) reconstruction of one 2D data matrix given as an array of floats.
| sinogram | Pointer to float array containing rays*views sinogram values. Data must be normalization and attenuation corrected. |
| rays | Nr of rays (bins or columns) in sinogram data. |
| views | Nr of views (rows) in sinogram data. |
| iter | Nr of iterations. |
| os_sets | Length of ordered subset process order array; 1, 2, 4, ... 128. |
| maskdim | Mask dimension; 3 or 5 (9 or 21 pixels). |
| zoom | Reconstruction zoom. |
| beta | Beta. |
| skip_prior | Number of iteration before prior; usually 1. |
| dim | Image x and y dimensions; must be an even number, preferably the same as number of rays, but there is no reason for it to be any larger than that. |
| image | Pointer to pre-allocated image data; size must be at least dim*dim. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 262 of file mrp.c.
Referenced by imgMRP().
|
extern |
Calculate correction factors for EM-ML reconstruction. These factors will we back-projected over the image in order to get the ML-coefficients.
Divides the measured projection (sinogram) by the re-projected ray sum. If the divisor is close to zero, the factor is set to 0. The factor is not allowed to exceed a limit or to be negative.
| measured | Measured sinogram data. |
| proj | Projection data. |
| correct | Correction matrix. |
| os_sets | Number of OS sets. |
| rays | Sinogram rays. |
| views | Sinogram views. |
Definition at line 229 of file mrp.c.
Referenced by mrp().
|
extern |
Update an image according to a set of coefficients.
Performs a pixel-by-pixel multiplication between the current image and the coefficients. The result is non-negative.
| coef | Pointer to an array of coefficients, of length n. |
| img | Pointer to an array containing source image data, of length n. |
| oimg | Pointer to an array containing output image data, of length n. |
| n | Array lengths |
Definition at line 201 of file mrp.c.
Referenced by mrp().
|
extern |
Allocates memory for PRMAT data. Normally used only in SET-functions.
Allocates memory for look-up table if set = 0 and for projection matrix otherwise.
| mat | pointer to projection matrix for which the allocation is done. |
| set | tells for which part of the structure allocation is to be done. |
| rows | number of rows in a matrix. |
| coords | list of number of entries in each row. |
Definition at line 105 of file prmat.c.
Referenced by prmatReadMatrix(), radonSetLORS(), and radonSetLUT().
|
extern |
Frees the memory allocated for mat. All data is cleared.
| mat | pointer to projection matrix to be emptied. |
Definition at line 56 of file prmat.c.
Referenced by prmatReadMatrix(), and radonSetLORS().
|
extern |
Returns coordinates of a line of response in place (row,ind) in the look-up table.
| mat | pointer to a projection matrix. |
| row | the row index. |
| ind | the (non-zero) lor index. |
Definition at line 253 of file prmat.c.
Referenced by prmatSaveMatrix().
|
extern |
Returns coordinate of a pixel in place (row,pix) in the given projection matrix.
| mat | pointer to a projection matrix. |
| row | the row index. |
| pix | the (non-zero) pixel index. |
Definition at line 297 of file prmat.c.
|
extern |
Returns factor (weighting coefficient) for a pixel in place (row,pix) in given projection matrix.
| mat | pointer to a projection matrix. |
| row | the row index. |
| pix | the (non-zero) pixel index. |
Definition at line 342 of file prmat.c.
Referenced by radonBackTransformPRM(), and radonFwdTransformPRM().
|
extern |
Returns square sum of all factors in given projection matrix in given row.
| mat | pointer to a projection matrix. |
| row | row index for accessing factors. |
Definition at line 409 of file prmat.c.
Referenced by prmatSaveMatrix(), and radonSetLORS().
|
extern |
Returns sum of all factors in given projection matrix. For initializing image matrix.
| mat | pointer to a projection matrix. |
Definition at line 397 of file prmat.c.
|
extern |
Returns the image dimension in the geometrics.
| mat | pointer to a projection matrix. |
Definition at line 197 of file prmat.c.
Referenced by radonBackTransformPRM(), and radonFwdTransformPRM().
|
extern |
Returns major semiaxe of the FOV in given projection matrix.
| mat | pointer to a projection matrix. |
|
extern |
|
extern |
|
extern |
|
extern |
Returns the number of bins (distances) in the geometrics.
| mat | pointer to a projection matrix. |
Definition at line 186 of file prmat.c.
Referenced by radonBackTransformPRM(), and radonFwdTransformPRM().
|
extern |
Returns the number of views (angles) in the geometrics.
| mat | pointer to a projection matrix. |
Definition at line 175 of file prmat.c.
Referenced by radonBackTransformPRM(), and radonFwdTransformPRM().
|
extern |
Returns number of rows (pixels) in the look-up table.
| mat | pointer to a projection matrix. |
Definition at line 210 of file prmat.c.
Referenced by prmatReadMatrix(), and prmatSaveMatrix().
|
extern |
Returns coordinates of a pixel in place 'row' in the look-up table.
| mat | pointer to a projection matrix. |
| row | index of the pixel whose coordinates are to be returned. |
Definition at line 223 of file prmat.c.
Referenced by prmatSaveMatrix().
|
extern |
Returns number of pixels intersected by the given line of response.
| mat | pointer to the projection matrix. |
| row | index of the line of response for which the number of pixels is returned. |
Definition at line 282 of file prmat.c.
Referenced by prmatReadMatrix(), prmatSaveMatrix(), radonBackTransformPRM(), radonFwdTransformPRM(), radonSetLORS(), and radonSetLUT().
|
extern |
Returns the number of lines of response (rays) intersecting the pixel in place 'row'.
| mat | pointer to a projection matrix. |
| row | index of the pixel for which the number of lors is returned. |
Definition at line 237 of file prmat.c.
Referenced by prmatReadMatrix(), and prmatSaveMatrix().
|
extern |
Returns number of rows (lines of response) in the given projection matrix.
| mat | pointer to the projection matrix. |
Definition at line 267 of file prmat.c.
Referenced by prmatSaveMatrix(), and radonSetLORS().
|
extern |
Returns the x-coordinate of a pixel in place (row,pix) in the given projection matrix.
| mat | pointer to a projection matrix. |
| row | the row index. |
| pix | the (non-zero) pixel index. |
Definition at line 312 of file prmat.c.
Referenced by prmatSaveMatrix(), radonBackTransformPRM(), radonFwdTransformPRM(), radonSetLORS(), and radonSetLUT().
|
extern |
Returns the y-coordinate of a pixel in place (row,pix) in the given projection matrix.
| mat | pointer to a projection matrix. |
| row | the row index. |
| pix | the (non-zero) pixel index. |
Definition at line 327 of file prmat.c.
Referenced by prmatSaveMatrix(), radonBackTransformPRM(), radonFwdTransformPRM(), radonSetLORS(), and radonSetLUT().
|
extern |
Initializes PRMAT datatype for use. To be utilised before any use of PRMAT type variables.
| mat | pointer to projection matrix to be initialized. |
Definition at line 22 of file prmat.c.
Referenced by radonSetLORS().
|
extern |
Reads one projection matrix from the given file to the given PRMAT structure mat.
| fname | file name to read. |
| mat | pointer to the projection matrix datatype. |
Definition at line 550 of file prmat.c.
|
extern |
Adds the given projection matrix to the file called prTDXXYY.prm. Where T is the type of the scanner (E=ECAT931 and G=GE Advance), D is the type of discretisation (0='0/1', 1='length of intersection' and 2='exact area'), XX is the major semiaxe of the FOV, and YY the minor semiaxe. If file already exists it is NOT created or rewritten.
| mat | pointer to the projection matrix to be saved. |
Definition at line 428 of file prmat.c.
|
extern |
Transforms the given sinogram in Radon domain to spatial domain. Parameters of the discrete Radon transform are stored in the RADON object. Transform is calculated only in those angles belonging into given subset. Subset contains angles starting from the index 'set' with spacing 'setNr'. Discretisation model utilised in this function is '0/1' or 'length of intersection' according to the given RADON object.
| radtra | contains an initialized radon transform object. |
| set | tells which set is to be utilized; 0 < set < setNr-1 |
| setNr | number of subsets |
| scndata | v x b vector contains the projections. |
| imgdata | n x n vector for storing the back-projection. |
Definition at line 1429 of file radon.c.
|
extern |
Same as 'radonBackTransform()' but discretisation model in this function is 'exact area'.
| radtra | contains an initialized radon transform object. |
| set | tells which set is to be utilized; 0 < set < setNr-1 |
| setNr | number of subsets |
| scndata | v x b vector contains the projections. |
| imgdata | n x n vector for storing the back-projection. |
Definition at line 1696 of file radon.c.
|
extern |
Transforms the given sinogram in Radon domain to spatial domain. Transform is calculated by multiplying with the transpose of the given projection matrix from the right. Transform is calculated only in those angles belonging into given subset. Subset contains angles starting from the index 'set' with spacing 'setNr'. Discretisation model utilised in this function is '0/1', 'length of intersection' or 'exact area' according to the given projection matrix.
| mat | pointer to structure where coordinates and values are stored. |
| set | tells which set is to be utilized; 0 < set < setNr-1 |
| setNr | number of subsets |
| scndata | v x b vector contains the projections. |
| imgdata | n x n vector for storing the back-projection. |
Definition at line 2503 of file radon.c.
|
extern |
Same as 'radonBackTransform()' but discretisation model in this function is 'linear interpolation' or 'nearest neighbour interpolation' according to the given Radon transform object.
| radtra | contains an initialized radon transform object. |
| set | tells which set is to be utilized; 0 < set < setNr-1 |
| setNr | number of subsets |
| scndata | v x b vector contains the projections. |
| imgdata | n x n vector for storing the back-projection. |
Definition at line 2415 of file radon.c.
|
extern |
Frees the memory allocated for radon transform. All data is cleared.
| radtra | pointer to transform data to be emptied |
Definition at line 27 of file radon.c.
|
extern |
Performs the perpendicular model of the radon transform for the given vector in spatial domain. The discretisation mode is chosen according to transform object, discretisation mode is 0 or 1. Transform is performed in those angles belonging in the given subset. The set of coincidence lines is divided into subsets in the following way: let i be the number of subsets, then every ith angle in the base set and the ones symmetrical with it belong to the same subset.
| radtra | contains an initialized radon transform object. |
| set | tells which set is to be utilized; 0 < set < setNr-1 |
| setNr | number of subsets |
| imgdata | contains pixel values for every pixel in dim*dim image grid. |
| scndata | viewNr*binNr vector for storing the projection |
Definition at line 216 of file radon.c.
|
extern |
Same as 'radonFwdTransform()' but discretisation model in this function is 'exact area'.
| radtra | contains an initialized radon transform object. |
| set | tells which set is to be utilized; 0 < set < setNr-1 |
| setNr | number of subsets |
| imgdata | contains pixel values for every pixel in dim*dim image grid. |
| scndata | viewNr*binNr vector for storing the projection |
Definition at line 550 of file radon.c.
|
extern |
Transforms the given intensity image in spatial domain to Radon domain. Transform is calculated by multiplying with the given projection matrix from the left. Transform is calculated only in those angles belonging into given subset. Subset contains angles starting from the index 'set' with spacing 'setNr'. Discretisation model utilised in this function is '0/1', 'length of intersection' or 'exact area' according to the given projection matrix.
| mat | contains an initialised projection matrix |
| set | tells which set is to be utilized; 0 < set < setNr-1 |
| setNr | number of subsets (spacing between indices) |
| imgdata | contains pixel values for every pixel in dim*dim image grid. |
| scndata | viewNr*binNr vector for storing the projection |
Definition at line 1328 of file radon.c.
|
extern |
Same as 'radonFwdTransform()' but discretisation model in this function is 'linear interpolation' or 'nearest neighbour interpolation' according to the given Radon transform object.
| radtra | contains an initialized radon transform object. |
| set | tells which set is to be utilized; 0 < set < setNr-1 |
| setNr | number of subsets |
| imgdata | contains pixel values for every pixel in dim*dim image grid. |
| scndata | viewNr*binNr vector for storing the projection |
Definition at line 1238 of file radon.c.
|
extern |
Returns the center bin in this radon transform.
| radtra | radon transform for which the center bin is to be returned. |
Definition at line 180 of file radon.c.
Referenced by radonBackTransform(), radonBackTransformEA(), radonFwdTransform(), radonFwdTransformEA(), and radonSetLUT().
|
extern |
Returns the half index of the bins in this radon transform.
| radtra | radon transform for which the half index is to be returned. |
Definition at line 169 of file radon.c.
Referenced by radonBackTransform(), radonBackTransformEA(), radonFwdTransform(), radonFwdTransformEA(), radonSetBases(), radonSetBasesEA(), and radonSetLUT().
|
extern |
Returns the image dimension in this radon transform.
| radtra | radon transform for which the image dimension is to be returned. |
Definition at line 128 of file radon.c.
Referenced by radonBackTransform(), radonBackTransformEA(), radonBackTransformSA(), radonFwdTransform(), radonFwdTransformEA(), radonFwdTransformSA(), radonSetBases(), radonSetBasesEA(), radonSetLORS(), and radonSetLUT().
|
extern |
Returns the discretization model of this radon transform.
| radtra | radon transform for which the mode is to be returned. |
Definition at line 119 of file radon.c.
Referenced by radonBackTransform(), radonBackTransformSA(), radonFwdTransform(), radonFwdTransformSA(), radonSetBases(), and radonSetBasesEA().
|
extern |
Returns the number of bins in this radon transform.
| radtra | radon transform for which the number of bins is to be returned. |
Definition at line 148 of file radon.c.
Referenced by radonBackTransform(), radonBackTransformEA(), radonBackTransformSA(), radonFwdTransform(), radonFwdTransformEA(), radonFwdTransformSA(), radonSetBases(), radonSetBasesEA(), radonSetLORS(), and radonSetLUT().
|
extern |
Returns the number of views in this radon transform.
| radtra | radon transform for which the number of views is to be returned. |
Definition at line 138 of file radon.c.
Referenced by radonBackTransform(), radonBackTransformEA(), radonBackTransformSA(), radonFwdTransform(), radonFwdTransformEA(), radonFwdTransformSA(), radonSetBases(), radonSetBasesEA(), radonSetLORS(), and radonSetLUT().
|
extern |
Returns the sample distance in this radon transform.
| radtra | radon transform for which the sample distance is to be returned. |
Definition at line 159 of file radon.c.
Referenced by radonBackTransform(), radonBackTransformEA(), radonFwdTransform(), radonFwdTransformEA(), radonSetBases(), radonSetBasesEA(), and radonSetLUT().
|
extern |
Returns the sine for given angle (index).
| radtra | radon transform for which the sine is to be returned. |
| nr | index of the angle to be returned (angle=nr*pi/radonGetNB(RADON)). |
Definition at line 192 of file radon.c.
Referenced by radonBackTransform(), radonBackTransformEA(), radonBackTransformSA(), radonFwdTransform(), radonFwdTransformEA(), radonFwdTransformSA(), radonSetBases(), and radonSetBasesEA().
|
extern |
Sets the data for the 2-D Radon transform.
| radtra | radon transform for which the paramaters are to be set |
| mode | discretisation mode |
| imgDim | image dimension |
| viewNr | Number of views (angles) |
| binNr | Number of bins (distances) |
Definition at line 62 of file radon.c.
Sets the coordinates and factors for intersected pixels according to given special Radon transform operator for every coincidence line in the BASE set. Base set includes coincidence lines in range [0,pi/4].
| radtra | special Radon transform operator. |
| elli | field of view. |
| mat | pointer to the datastructure where coordinates and values are to be stored. |
Definition at line 2602 of file radon.c.
Same as 'radonSetBases()' but discretisation model in this function is 'exact area'.
| radtra | special Radon transform operator. |
| elli | field of view. |
| mat | pointer to the datastructure where coordinates and values are to be stored. |
Definition at line 2984 of file radon.c.
Sets the coordinates and factors for intersected pixels according to given special Radon transform operator for EVERY line of response.
| radtra | special Radon transform operator. |
| elli | field of view. |
| mat | pointer to the datastructure where coordinates and values are stored for the base lines. |
Definition at line 3925 of file radon.c.
Sets a look-up table containing coordinates of lines of response intersecting pixels inside a field of view. Lines of response contributing to a pixel are searched from already set projection matrix.
| radtra | special Radon transform operator. |
| elli | field of view. |
| mat | pointer to the datastructure where coordinates and values are to be stored. |
Definition at line 3719 of file radon.c.
|
extern |
Get the sum and minimum and maximum values from a list of floats, optionally ignoring zero values from the minimum.
| buf | Pointer to the float array of length n. |
| n | Array size. |
| osum | Sum of array values is returned here; enter NULL if not needed. |
| omin | Minimum value is returned here; enter NULL if not needed. |
| omax | Maximum value is returned here; enter NULL if not needed. |
| skip_zero_mins | Skip zero values when determining the minimum; 1 or 0. |
Definition at line 154 of file recutil.c.
Referenced by mrp().
|
extern |
Interpolate sinogram so that the sinogram bin width is the same as the image pixel width.
| srcsino | Source sinogram data, size of srcrays*views. |
| newsino | New interpolated sinogram data calculated here; must be allocated with size newrays*views. |
| srcrays | Number of rays (bins, columns) in the original sinogram. |
| newrays | Number of rays (bin, columns) in the new interpolated sinogram. |
| views | Number of projection views (angles, rows) in both sinograms. |
Definition at line 37 of file recutil.c.
|
extern |
Pre-compute the sine tables for back-projection.
| views | Number of views (sinogram rows). |
| sinB | Array of sine values, length 3*views/2 |
| sinBrot | Array of sine values with rotation, length 3*views/2; enter NULL if not needed. |
| rotation | Rotation (degrees). |
Definition at line 12 of file recutil.c.
Referenced by fbp(), imgFBP(), imgMRP(), imgReprojection(), mrp(), reprojection(), and trmrp().
|
extern |
Reprojection of one 2D image matrix to sinogram when data is provided as arrays of floats.
| image | Pointer to float array containing dim*dim image pixel values. |
| dim | Image x and y dimensions; must be an even number. |
| rays | Nr of rays (bins or columns) in sinogram data. |
| views | Nr of views (rows) in sinogram data; usually larger or equal to the image dimensions. |
| bpzoom | Backprojection zoom factor; imagezoom*dim/rays |
| sinogram | Pointer to pre-allocated sinogram data; size must be at least rays*views. |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout |
Definition at line 154 of file reprojection.c.
Referenced by atnMake().
|
extern |
Average over three samples for image reprojection (1D 3-point mean).
| data | Pointer to data array |
| n | Array length |
Definition at line 293 of file reprojection.c.
Referenced by imgReprojection(), and reprojection().
|
extern |
Average over five samples for image reprojection (1D 5-point mean).
| data | Pointer to data array |
| n | Array length |
Definition at line 314 of file reprojection.c.
Referenced by imgReprojection(), and reprojection().
|
extern |
Median over three samples for image reprojection (1D 3-point median).
| data | Pointer to data array |
| n | Array length |
Definition at line 336 of file reprojection.c.
|
extern |
Make the Ordered Subset process order (bit-reversed sequence).
| os_sets | Nr of OS sets. |
| set_seq | Array of length os_sets to be filled here. |
Definition at line 113 of file recutil.c.
|
extern |
Median Root Prior (MRP) reconstruction of one 2D data matrix given as an array of floats.
| bla | Float array containing rays*views blank sinogram values. Data must be normalization-corrected. |
| tra | Float array containing rays*views transmission sinogram values. Data must be normalization-corrected. |
| dim | Image x and y dimensions. |
| image | Pointer to pre-allocated image data; size must be at least dim*dim; log-transformed attenuation correction factors will be written in here. |
| iter | Nr of iterations. |
| os_sets | Length of ordered subset process order array; 1, 2, 4, ... 128. |
| rays | Nr of rays (bins or columns) in sinogram data. |
| views | Nr of views (rows) in sinogram data. |
| maskdim | Mask dimension; 3 or 5 (9 or 21 pixels). |
| zoom | Reconstruction zoom. |
| beta | Beta. |
| axial_fov | Axial field-of-view in mm (found in transmission mainheader in cm). |
| sample_distance | Sample distance in mm (found in transmission subheader in cm). |
| skip_prior | Number of iteration before prior; usually 1. |
| osl | Use OSL-type (0 or 1). |
| shiftX | Possible shifting in x dimension (mm). |
| shiftY | Possible shifting in y dimension (mm). |
| rotation | Possible image rotation, -180 - +180 (in degrees). |
| verbose | Verbose level; if zero, then nothing is printed to stderr or stdout. |
Definition at line 21 of file trmrp.c.
Referenced by atnMake().
|
extern |
Back-projection of one angle (view)
| prj | Pointer to source projection data. |
| idata | Pointer to output image data of size dim*dim (upper left corner). |
| dim | Image dimension; must be an even number |
| view | Projection view (in order to get correct sine from tables) |
| viewNr | Number of projection views (sinogram rows) (to get correct sine from tables) |
| rayNr | Number of rays (bins, columns) |
| sinB | Pre-computed sine table for reprojection. |
| sinBrot | Pre-computed sine table for reprojection with rotation. |
| offsX | x offset in pixels; shift_x/pixsize. |
| offsY | y offset in pixels; shift_x/pixsize. |
| bpZoom | Zoom |
Definition at line 359 of file reprojection.c.
|
extern |
Reprojection of one angle (view)
| idata | Pointer to source input image data of size dim*dim |
| sdata | Pointer to preallocated output sinogram projection view (angle, row) |
| view | Projection view (in order to get correct sine from tables) |
| dim | Image dimension; must be an even number |
| viewNr | Number of projection views (sinogram rows) (to get correct sine from tables) |
| rayNr | Number of rays (bins, columns) |
| sinB | Pre-computed sine table for reprojection. |
| sinBrot | Pre-computed sine table for reprojection with rotation. |
| offsX | x offset in pixels; shift_x/pixsize. |
| offsY | y offset in pixels; shift_x/pixsize. |
| bpZoom | Zoom |
Definition at line 216 of file reprojection.c.
Referenced by imgReprojection(), mrp(), reprojection(), and trmrp().
|
extern |
Drive in verbose mode if not 0.
Definition at line 9 of file ellipse.c.
Referenced by ellipseAllocate(), ellipseEmpty(), ellipseGetArray(), ellipseGetCenterX(), ellipseGetCenterY(), ellipseGetImgSize(), ellipseGetInclination(), ellipseGetMajor(), ellipseGetMinor(), ellipseGetValue(), ellipseInit(), ellipseReadEllipse(), and ellipseSaveEllipse().
|
extern |
If not 0 drive in verbose mode.
Definition at line 9 of file prmat.c.
Referenced by prmatAllocate(), prmatEmpty(), prmatInit(), prmatReadMatrix(), and prmatSaveMatrix().
|
extern |
Drive in verbose mode if not 0.
Definition at line 13 of file radon.c.
Referenced by radonBackTransformEA(), radonEmpty(), radonFwdTransform(), radonFwdTransformEA(), and radonSet().