tomoRecon 1-0
/home/epics/devel/tomoRecon/tomoReconApp/src/grid.h
Go to the documentation of this file.
00001 /*** File grid.h  12:27 PM 11/7/97 **/
00002 
00003 #define ANSI
00004 
00005 /**** System includes */
00006 #include <stdio.h>
00007 #include <stdlib.h>
00008 #include <string.h>
00009 #include <math.h>
00010 #include <stddef.h>
00011 #include <time.h>
00012 #include <sys/stat.h>
00013 
00014 #include <fftw3.h>
00015 
00016 /**** Macros and typedefs ****/
00017 #ifndef max
00018 #define max(A,B) ((A)>(B)?(A):(B))
00019 #endif
00020 #ifndef min
00021 #define min(A,B) ((A)<(B)?(A):(B))
00022 #endif
00023 #define free_matrix(A) (free(*(A)),free(A))
00024 #define abs(A) ((A)>0 ?(A):-(A))
00025 #define pi  3.14159265359
00026 #define TOLERANCE 0.1   /* For comparing centers of two sinograms */
00027 #define LTBL_DEF 512    /* Default lookup table length */
00028 
00030 typedef struct {
00031     float r;  
00032     float i;  
00033 } complex;
00034 
00036 typedef struct {
00037    int n_ang;       
00038    int n_det;       
00039    int geom;              
00040    float *angles;       
00041    float center;        
00042 } sg_struct;
00043 
00045 typedef struct {
00046    float C;             
00047    int nt;          
00048    float lmbda;           
00049    float coefs[15];     
00050 } pswf_struct;
00051 
00053 typedef struct {
00054    pswf_struct *pswf;        
00055    float sampl;                
00056    float MaxPixSiz;          
00057    float R;                          
00058    float X0;                       
00059    float Y0;                       
00060    char fname[16];                   
00061    float (*filter)(float); 
00062    long ltbl;                      
00063    int verbose;            
00064 } grid_struct;
00065 
00066 #ifdef __cplusplus
00067 
00081 class grid {  
00082 public:
00083   grid(grid_struct *GP,sg_struct *SGP, long *imgsiz);
00084   ~grid();
00085   void recon(float center, float** G1,float** G2,float*** S1,float*** S2);
00086   void filphase_su(long pd,float fac, float(*pf)(float),complex *A);
00087   void pswf_su(pswf_struct *pswf,long ltbl, 
00088                long linv, float* wtbl,float* dwtbl,float* winv);
00089   
00090 private:
00091   int flag;       
00092   int n_det;
00093   int n_ang;
00094   long pdim;
00095   long M;
00096   long M0;
00097   long M02;
00098   long ltbl;
00099   float sampl;
00100   float scale;
00101   float L;
00102   float X0;
00103   float Y0;
00104   float *SINE;
00105   float *COSE;
00106   float *wtbl; 
00107   float *dwtbl;
00108   float *work;
00109   float *winv;
00110   float previousCenter;
00111   float (*filter)(float);
00112   complex *cproj;
00113   complex *filphase;
00114   complex **H;
00115   fftwf_complex *HData;
00116   
00117   fftwf_plan forward_1d_plan;
00118   fftwf_plan backward_2d_plan;
00119   int verbose;   /* Debug printing flag */
00120 };
00121 #endif
00122 
00125 #ifdef __cplusplus
00126 extern "C" {
00127 #endif
00128 
00129 /**** Function Prototypes ****/
00130 
00132 void get_pswf(float C, pswf_struct **P);
00133 
00135 float (*get_filter(char *name))(float);
00136 
00137 #ifdef __cplusplus
00138 }
00139 #endif