tomoRecon 1-0
|
Class to reconstruct parallel beam tomography data using the Gridrec FFT code. More...
#include <grid.h>
Public Member Functions | |
grid (grid_struct *GP, sg_struct *SGP, long *imgsiz) | |
Constructor for the grid object. | |
~grid () | |
Destructor for the grid class Releases memory allocated by constructor. | |
void | recon (float center, float **G1, float **G2, float ***S1, float ***S2) |
Reconstructs two real slice images from their sinograms. | |
void | filphase_su (long pd, float fac, float(*pf)(float), complex *A) |
Sets up the complex array, filphase[]. | |
void | pswf_su (pswf_struct *pswf, long ltbl, long linv, float *wtbl, float *dwtbl, float *winv) |
Set up lookup tables for convolvent (used in Phase 1 of grid::recon()), and for the final correction factor (used in Phase 3). |
Class to reconstruct parallel beam tomography data using the Gridrec FFT code.
This code was originally written by Bob Marr and Graham Campbell from Brookhaven National Laboratory. Unfortunately they never published a paper on it, so there is no good reference.
The original version was written in C and used static C variables to share information between functions. It was thus not thread safe. This version is converted to C++, and all variables that are shared between functions are private member data. It is thus thread safe as long as each thread creates its own grid object.
The original version used the Numerical Recipes FFT functions four1 and fourn. I had previously written wrapper routines that maintained the Numerical Recipes API, but used the FFTW library for faster FFTs. Those wrapper routines were also not thread-safe, and they copied data, so were somewhat inefficient. This version of Gridrec has been changed to use the FFTW API directly, it no longer uses the Numerical Recipes API.
grid::grid | ( | grid_struct * | GP, |
sg_struct * | SGP, | ||
long * | imgsiz | ||
) |
Constructor for the grid object.
Allocates memory that used internally.
Creates lookup tables of sine and cosine functions for efficiency.
Creates the FFTW plans for 1-D and 2-D FFTs. This operation can require several seconds for large arrays. This overhead time only occurs the very first time the sinograms of a particular size are reconstructed by an application because FFTW caches the plans internally.
NOTE: Because FFTW plan creation is not thread-safe this constructor is also not thread-safe. If multiple grid objects are being created then their creation must be protected by a mutex so that the constructor is not be called by multiple threads at the same time. Once the grid object is created then then it is fully thread-safe.
[in] | GP | Pointer to a grid_struct structure that defines the grid reconstruction parameters |
[in] | SGP | Pointer to an sg_struct structure that defines the sinogram parameters |
[out] | imgsiz | The size of the reconstructed images the grid will produce =float[imgsiz, imgsiz] |
grid::~grid | ( | ) |
Destructor for the grid class Releases memory allocated by constructor.
NOTE: Memory allocated with fftwf_malloc must be freed with fftwf_free or crashes will result!
void grid::filphase_su | ( | long | pd, |
float | center, | ||
float(*)(float) | pf, | ||
complex * | A | ||
) |
Sets up the complex array, filphase[].
Each element of filphase consists of a real filter factor [obtained from the function, (*pf)()], multiplying a complex phase factor (derived from the parameter, center).
void grid::pswf_su | ( | pswf_struct * | pswf, |
long | ltbl, | ||
long | linv, | ||
float * | wtbl, | ||
float * | dwtbl, | ||
float * | winv | ||
) |
Set up lookup tables for convolvent (used in Phase 1 of grid::recon()), and for the final correction factor (used in Phase 3).
void grid::recon | ( | float | center, |
float ** | G1, | ||
float ** | G2, | ||
float *** | S1, | ||
float *** | S2 | ||
) |
Reconstructs two real slice images from their sinograms.
This uses the "gridding" algorithm applied to complex data.
[in] | center | The rotation center to be used for these two slices |
[in] | G1 | Array of pointers to the data for each projection of the first sinogram |
[in] | G2 | Array of pointers to the data for each projection of the second sinogram |
[out] | S1 | Array of pointers to pointers to the data for each row of the reconstruction for the first slice |
[out] | S2 | Array of pointers to pointers to the data for each row of the reconstruction for the second slice |