tomoRecon 1-0
Public Member Functions
tomoRecon Class Reference

Class to do tomography reconstruction. More...

#include <tomoRecon.h>

List of all members.

Public Member Functions

 tomoRecon (tomoParams_t *pTomoParams, float *pAngles)
 Constructor for the tomoRecon class.
virtual ~tomoRecon ()
 Destructor for the tomoRecon class.
virtual int reconstruct (int numSlices, float *center, float *pInput, float *pOutput)
 Function to start reconstruction of a set of slices Sends messages to workerTasks to begin the reconstruction and wakes up the supervisorTasks and workerTasks.
virtual void supervisorTask ()
 Supervisor control task that runs as a separate thread.
virtual void workerTask (int taskNum)
 Worker task that runs as a separate thread.
virtual void sinogram (float *pIn, float *pOut)
 Function to calculate a sinogram.
virtual void poll (int *pReconComplete, int *pSlicesRemaining)
 Function to poll the status of the reconstruction.
virtual void logMsg (const char *pFormat,...)
 Logs messages.

Detailed Description

Class to do tomography reconstruction.

Creates a supervisorTask that supervises the reconstruction process, and a set of workerTask threads that compute the sinograms and do the reconstruction. The reconstruction is done with the GridRec code, originally written at Brookhaven National Lab. Gridrec was modified to be thread-safe. When the class is created it can be used to reconstruct many slices in a single call, and does the reconstruction using multiple threads and cores. The reconstruction function can be called repeatedly to reconstruct more sets of slices. Once the object is created it is restricted to reconstructing with the same set of parameters, with the exception of the rotation center, which can be specified on a slice-by-slice basis. If the reconstruction parameters change (number of X pixels, number of projections, Gridrec parameters, etc.) then the tomoRecon object must be deleted and a new one created.


Constructor & Destructor Documentation

tomoRecon::tomoRecon ( tomoParams_t pTomoParams,
float *  pAngles 
)

Constructor for the tomoRecon class.

Creates the message queues for passing messages to and from the workerTask threads. Creates the thread that execute the supervisorTask function, and numThreads threads that execute the workerTask function.

Parameters:
[in]pTomoParamsA structure containing the tomography reconstruction parameters
[in]pAnglesArray of projection angles in degrees
tomoRecon::~tomoRecon ( ) [virtual]

Destructor for the tomoRecon class.

Calls shutDown() to stop any active reconstruction, which causes workerTasks to exit. Waits for supervisor task to exit, which in turn waits for all workerTasks to exit. Destroys the EPICS message queues, events and mutexes. Closes the debugging file.


Member Function Documentation

void tomoRecon::logMsg ( const char *  pFormat,
  ... 
) [virtual]

Logs messages.

Adds time stamps to each message. Does buffering to prevent messages from multiple threads getting garbled. Adds the appropriate terminator for files (LF) and stdout (CR LF, needed for IDL on Linux). Flushes output after each call, so output appears even if application crashes.

Parameters:
[in]pFormatFormat string
[in]...Additional arguments for vsprintf
void tomoRecon::poll ( int *  pReconComplete,
int *  pSlicesRemaining 
) [virtual]

Function to poll the status of the reconstruction.

Parameters:
[out]pReconComplete0 if reconstruction is still in progress, 1 if it is complete
[out]pSlicesRemainingNumber of slices remaining to be reconstructed
int tomoRecon::reconstruct ( int  numSlices,
float *  center,
float *  pInput,
float *  pOutput 
) [virtual]

Function to start reconstruction of a set of slices Sends messages to workerTasks to begin the reconstruction and wakes up the supervisorTasks and workerTasks.

Parameters:
[in]numSlicesNumber of slices to reconstruct
[in]centerRotation center to use for each slice
[in]pInputPointer to input data [numPixels, numSlices, numProjections]
[out]pOutputPointer to output data [numPixels, numPixels, numSlices]
void tomoRecon::sinogram ( float *  pIn,
float *  pOut 
) [virtual]

Function to calculate a sinogram.

Takes log of data (unless fluorescence flag is set. Optionally does secondary normalization to air in each row of sinogram. Optionally does ring artifact reduction.

Parameters:
[in]pInPointer to normalized data input for this slice [numPixels, slice, numProjections]
[out]pOutPointer to sinogram output [paddedSingramWidth, numProjections]
void tomoRecon::supervisorTask ( ) [virtual]

Supervisor control task that runs as a separate thread.

Reads messages from the workerTasks to update the status of the reconstruction (reconComplete and slicesRemaining). When shutting down waits for events from workerTasks threads indicating that they have all exited.

void tomoRecon::workerTask ( int  taskNum) [virtual]

Worker task that runs as a separate thread.

Multiple worker tasks can be running simultaneously. Each workerTask thread reconstructs slices that it gets from the toDoQueue, and sends messages to the supervisorTask via the doneQueue after reconstructing each pair of slices.

Parameters:
[in]taskNumTask number (0 to numThreads-1) for this tread; used to into arrays of event numbers in the object.

The documentation for this class was generated from the following files: