tomoRecon 1-0
|
00001 /* 00002 * tomoRecon.h 00003 * 00004 * C++ class for doing computed tomography reconstruction using Gridrec. 00005 * 00006 * This runs the reconstruction using multiple threads, each thread reconstructing a set of slices. 00007 * 00008 * It uses the EPICS libCom library for OS-independent functions for threads, mutexes, message queues, etc. 00009 * 00010 * Author: Mark Rivers 00011 * 00012 * Created: July 9, 2012 00013 */ 00014 00015 #include <epicsMessageQueue.h> 00016 #include <epicsThread.h> 00017 00018 #include "grid.h" 00019 00021 typedef struct { 00022 int sliceNumber; 00023 float center; 00024 float *pIn1; 00025 float *pIn2; 00026 float *pOut1; 00027 float *pOut2; 00028 } toDoMessage_t; 00029 00031 typedef struct { 00032 int sliceNumber; 00033 int numSlices; 00034 double sinogramTime; 00035 double reconTime; 00036 } doneMessage_t; 00037 00039 typedef struct { 00040 int numThreads; 00041 int numPixels; 00042 int maxSlices; 00043 int numProjections; 00044 int paddedSinogramWidth; 00045 int airPixels; 00046 int ringWidth; 00047 int fluorescence; 00048 int debug; 00049 char debugFileName[256]; 00050 // These are gridRec parameters 00051 int geom; 00052 float pswfParam; 00053 float sampl; 00054 float MaxPixSiz; 00055 float R; 00056 float X0; 00057 float Y0; 00058 char fname[16]; 00059 int ltbl; 00060 } tomoParams_t; 00061 00062 #ifdef __cplusplus 00063 00065 typedef struct { 00066 class tomoRecon *pTomoRecon; 00067 int taskNum; 00068 } workerCreateStruct; 00069 00083 class tomoRecon { 00084 public: 00085 tomoRecon(tomoParams_t *pTomoParams, float *pAngles); 00086 virtual ~tomoRecon(); 00087 virtual int reconstruct(int numSlices, float *center, float *pInput, float *pOutput); 00088 virtual void supervisorTask(); 00089 virtual void workerTask(int taskNum); 00090 virtual void sinogram(float *pIn, float *pOut); 00091 virtual void poll(int *pReconComplete, int *pSlicesRemaining); 00092 virtual void logMsg(const char *pFormat, ...); 00093 00094 private: 00095 void shutDown(); 00096 tomoParams_t *pTomoParams_; 00097 int numPixels_; 00098 int numSlices_; 00099 int numProjections_; 00100 int paddedWidth_; 00101 int numThreads_; 00102 float *pAngles_; 00103 float *pInput_; 00104 float *pOutput_; 00105 int queueElements_; 00106 int debug_; 00107 FILE *debugFile_; 00108 int reconComplete_; 00109 int slicesRemaining_; 00110 int shutDown_; 00111 epicsMessageQueueId toDoQueue_; 00112 epicsMessageQueueId doneQueue_; 00113 epicsEventId supervisorWakeEvent_; 00114 epicsEventId supervisorDoneEvent_; 00115 epicsEventId *workerWakeEvents_; 00116 epicsEventId *workerDoneEvents_; 00117 epicsMutexId fftwMutex_; 00118 }; 00119 #endif