CASToR  1.0
Tomographic Reconstruction (PET/SPECT)
vImageConvolver.hh
Go to the documentation of this file.
00001 
00009 #ifndef VIMAGECONVOLVER_HH
00010 #define VIMAGECONVOLVER_HH 1
00011 
00012 #include "gVariables.hh"
00013 #include "gOptions.hh"
00014 
00015 class oImageSpace;
00016 class oImageDimensionsAndQuantification;
00017 
00018 
00037 class vImageConvolver
00038 {
00039   // -----------------------------------------------------------------------------------------
00040   // Constructor & Destructor
00041   public:
00048     vImageConvolver();
00056     virtual ~vImageConvolver();
00057 
00058 
00059   // -----------------------------------------------------------------------------------------
00060   // Public member functions
00061   public:
00070     int CheckParameters();
00080     int Initialize();
00091     int ApplyConvolution(FLTNB* ap_image);
00103     int ApplyConvolutionTranspose(FLTNB* ap_image);
00104 
00105 
00106   // -----------------------------------------------------------------------------------------
00107   // Private member functions
00108   private:
00116     void CopyToPaddedImage(FLTNB* ap_inputImage);
00127     virtual int Convolve(FLTNB* ap_outputImage);
00139     virtual int ConvolveTranspose(FLTNB* ap_outputImage);
00140 
00141 
00142   // -----------------------------------------------------------------------------------------
00143   // Pure virtual public member functions that need to be implemented by children
00144   public:
00155     virtual int ReadConfigurationFile(const string& a_fileOptions) = 0;
00166     virtual int ReadOptionsList(const string& a_listOptions) = 0;
00175     virtual void ShowHelp() = 0;
00176 
00177 
00178   // -----------------------------------------------------------------------------------------
00179   // Pure virtual private member functions that need to be implemented by children
00180   private:
00189     virtual int CheckSpecificParameters() = 0;
00201     virtual int BuildConvolutionKernel() = 0;
00202 
00203 
00204   // -----------------------------------------------------------------------------------------
00205   // Public Get & Set functions
00206   public:
00212     inline void SetVerbose(int a_verbose)
00213            {m_verbose = a_verbose;}
00219     inline void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification)
00220            {mp_ImageDimensionsAndQuantification = ap_ImageDimensionsAndQuantification;}
00221 
00222   // -----------------------------------------------------------------------------------------
00223   // Data members
00224   protected:
00225     // Standards
00226     oImageDimensionsAndQuantification* 
00227       mp_ImageDimensionsAndQuantification; 
00228     int m_verbose;                         
00229     // Booleans
00230     bool m_checked;        
00231     bool m_initialized;    
00232     bool m_stationary;     
00233     // Padded image
00234     FLTNB* mp_paddedImage; 
00235     INTNB m_offsetX;       
00236     INTNB m_offsetY;       
00237     INTNB m_offsetZ;       
00238     INTNB m_dimPadX;       
00239     INTNB m_dimPadY;       
00240     INTNB m_dimPadZ;       
00241     INTNB m_dimPadXY;      
00242     INTNB m_dimPadXYZ;     
00243     // Convolution kernel
00244     INTNB m_nbKernels;     
00245     INTNB* mp_dimKernelX;  
00246     INTNB* mp_dimKernelY;  
00247     INTNB* mp_dimKernelZ;  
00248     FLTNB** m2p_kernel;    
00249 };
00250 
00251 
00252 // ----------------------------------------------------------------------
00253 // Part of code that manages the auto declaration of children classes
00254 // ----------------------------------------------------------------------
00255 
00256 // Macro for the function that creates the object
00257 #define FUNCTION_IMAGE_CONVOLVER(CLASS) \
00258   static vImageConvolver *make_image_convolver() { return new CLASS(); };
00259 
00260 // Macro for the class that links the appropriate function to the map of objects
00261 #define CLASS_IMAGE_CONVOLVER(NAME,CLASS)                                                                \
00262   class NAME##ImageConvolverCreator                                                                      \
00263   {                                                                                                      \
00264     public:                                                                                              \
00265       NAME##ImageConvolverCreator()                                                                      \
00266         { sAddonManager::GetInstance()->mp_listOfImageConvolvers[#NAME] = CLASS::make_image_convolver; } \
00267   };                                                                                                     \
00268   static NAME##ImageConvolverCreator ImageConvolverCreator##NAME;
00269 
00270 #endif
 All Classes Files Functions Variables Typedefs Defines