CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
code/include/image/vDeformation.hh
Go to the documentation of this file.
1 
8 #ifndef VDEFORMATION_HH
9 #define VDEFORMATION_HH 1
10 
11 #include "gVariables.hh"
12 
13 // These definitions are used to simply discriminate between forward and backward deformation
14 #define FORWARD_DEFORMATION 0
15 #define BACKWARD_DEFORMATION 1
16 
17 class oImageSpace;
19 
43 {
44  // -----------------------------------------------------------------------------------------
45  // Constructor & Destructor
46  public:
51  vDeformation();
56  virtual ~vDeformation();
57 
58 
59  // -----------------------------------------------------------------------------------------
60  // Public member functions
61  public:
67  inline void SetImageDimensionsAndQuantification( oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification )
68  {mp_ID = ap_ImageDimensionsAndQuantification;}
74  inline void SetVerbose( int a_verbose )
75  {m_verbose = a_verbose;}
82  inline void SetNbTransformations( int a_nbTransformations )
83  {m_nbTransformations = a_nbTransformations;}
90  virtual int CheckParameters();
97  virtual int CheckSpecificParameters() = 0;
105  virtual int ReadAndCheckConfigurationFile( const string& a_fileOptions ) = 0;
113  virtual int ReadAndCheckOptionsList( const string& a_listOptions ) = 0;
120  virtual int Initialize() = 0;
126  virtual void ShowHelp() = 0;
127 
128 
129  // -----------------------------------------------------------------------------------------
130  // Reconstruction deformation function
131  public:
146  virtual int PerformDeformation( oImageSpace* ap_Image, int a_defIdx, int a_fr, int a_rimg, int a_cimg );
147 
148 
162  virtual int PerformHistoSensitivityDeformation( oImageSpace* ap_Image, int a_defIdx, int fr, int rimg, int cimg );
174  virtual int ApplyDeformationsToBackwardImage( oImageSpace* ap_Image, int a_fr, int a_defIdx );
186  virtual int ApplyDeformationsToHistoSensitivityImage( oImageSpace* ap_Image, int a_fr, int a_defIdx );
201  virtual int PerformSensitivityDeformation( oImageSpace* ap_Image, int a_defDirection, int a_defIdx, int fr, int rg, int cg );
212  virtual int ApplyDeformations( FLTNB* ap_inputImage, FLTNB* ap_outputImage, int a_direction, int a_defIdx ) = 0;
213 
214 
215  /*
216  \fn Tlerp
217  \param ap_inputImage : input image matrix
218  \param ap_outputImage : output image matrix
219  \param iov : index of the voxel to interpolate in the output image
220  \param iiv : index of the input image central voxel for interpolation
221  \param dx : x-axis difference between output voxel cartesian position after transformation and center of estimated vox position
222  \param dy : y-axis difference between output voxel cartesian position after transformation and center of estimated vox position
223  \param dz : z-axis difference between output voxel cartesian position after transformation and center of estimated vox position
224  \brief This function performs a trilinear interpolation for a specific voxel
225  \todo : perhaps use padded image in order to avoid if statements
226  \return 0 if success, other value otherwise.
227  */
228  int Tlerp(HPFLTNB *ap_inputImage, HPFLTNB *ap_outputImage, uint32_t iov, uint32_t iiv, FLTNB dX, FLTNB dY, FLTNB dZ);
229 
230 
231 
232 
233  // -----------------------------------------------------------------------------------------
234  // Data members
235  protected:
237  int m_verbose;
239  int m_checked;
241 };
242 
243 
244 // ----------------------------------------------------------------------
245 // Part of code that manages the auto declaration of children classes
246 // ----------------------------------------------------------------------
247 
248 // Macro for the function that creates the object
249 #define FUNCTION_DEFORMATION(CLASS) \
250  static vDeformation *make_deformation() { return new CLASS(); };
251 
252 // Macro for the class that links the appropriate function to the map of objects
253 #define CLASS_DEFORMATION(NAME,CLASS) \
254  class NAME##DeformationCreator \
255  { \
256  public: \
257  NAME##DeformationCreator() \
258  { sAddonManager::GetInstance()->mp_listOfDeformations[#NAME] = CLASS::make_deformation; } \
259  }; \
260  static NAME##DeformationCreator DeformationCreator##NAME;
261 
262 #endif
void SetVerbose(int a_verbose)
vDeformation()
Constructor of vDeformation. Simply set all data members to default values.
virtual ~vDeformation()
Destructor of vDeformation.
virtual int ApplyDeformationsToBackwardImage(oImageSpace *ap_Image, int a_fr, int a_defIdx)
void SetNbTransformations(int a_nbTransformations)
virtual int PerformDeformation(oImageSpace *ap_Image, int a_defIdx, int a_fr, int a_rimg, int a_cimg)
virtual int PerformHistoSensitivityDeformation(oImageSpace *ap_Image, int a_defIdx, int fr, int rimg, int cimg)
virtual int Initialize()=0
This function is used to initialize specific data related to the child deformation model...
virtual int CheckParameters()
This function is used to check parameters after the latter have been all set using Set functions...
int Tlerp(HPFLTNB *ap_inputImage, HPFLTNB *ap_outputImage, uint32_t iov, uint32_t iiv, FLTNB dX, FLTNB dY, FLTNB dZ)
virtual int ApplyDeformations(FLTNB *ap_inputImage, FLTNB *ap_outputImage, int a_direction, int a_defIdx)=0
This is the mother class of image-based transformation class.
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
oImageDimensionsAndQuantification * mp_ID
virtual int PerformSensitivityDeformation(oImageSpace *ap_Image, int a_defDirection, int a_defIdx, int fr, int rg, int cg)
This class holds all the matrices in the image domain that can be used in the algorithm: image...
This class is designed to manage all dimensions and quantification related stuff. ...
virtual int ReadAndCheckConfigurationFile(const string &a_fileOptions)=0
virtual int CheckSpecificParameters()=0
This function is used to check the parameters of the child functions before initialization if require...
virtual int ReadAndCheckOptionsList(const string &a_listOptions)=0
virtual void ShowHelp()=0
This function is used to print out specific help about the deformation and its options. It is pure virtual so must be implemented by children.
virtual int ApplyDeformationsToHistoSensitivityImage(oImageSpace *ap_Image, int a_fr, int a_defIdx)