CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
include/optimizer/vPenalty.hh
Go to the documentation of this file.
1 
8 #ifndef VPENALTY_HH
9 #define VPENALTY_HH 1
10 
11 #include "gVariables.hh"
12 #include "oImageDimensionsAndQuantification.hh"
13 #include "oImageSpace.hh"
14 #include "vDataFile.hh"
15 #include "oProjectionLine.hh"
16 
26 class vPenalty
27 {
28  // -------------------------------------------------------------------
29  // Constructor & Destructor
30  public:
37  vPenalty();
45  virtual ~vPenalty();
46 
47 
48  // -------------------------------------------------------------------
49  // Public member functions
50  public:
51 
57  void ShowHelp();
66  int CheckParameters();
75  int Initialize();
83  virtual int GlobalPreProcessingStep();
97  virtual int LocalPreProcessingStep(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th);
108  virtual FLTNB ComputePenaltyValue(FLTNB* ap_image, INTNB a_voxel, int a_th) = 0;
119  virtual FLTNB ComputeFirstDerivative(FLTNB* ap_image, INTNB a_voxel, int a_th) = 0;
130  virtual FLTNB ComputeSecondDerivative(FLTNB* ap_image, INTNB a_voxel, int a_th) = 0;
131 
132 
133  // -------------------------------------------------------------------
134  // Public Get & Set functions
135  public:
141  inline void SetVerbose(int a_verbose)
142  {m_verbose = a_verbose;}
148  inline void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification)
149  {mp_ImageDimensionsAndQuantification = ap_ImageDimensionsAndQuantification;}
155  inline void SetImageSpace(oImageSpace* ap_ImageSpace)
156  {mp_ImageSpace = ap_ImageSpace;}
162  inline void SetDataFile(vDataFile* ap_DataFile)
163  {mp_DataFile = ap_DataFile;}
169  inline void SetPenaltyStrength(FLTNB a_penaltyStrength)
170  {m_penaltyStrength = a_penaltyStrength;}
177  {return m_penaltyStrength;}
184  {return m_penaltyDerivativesOrder;}
190  inline void SetPenaltyID(const string& a_penaltyID)
191  {m_penaltyID = a_penaltyID;}
196  inline const string& GetPenaltyID()
197  {return m_penaltyID;}
198 
199 
200  // -----------------------------------------------------------------------------------------
201  // Pure virtual private member functions that need to be implemented by child optimizers
202  private:
211  virtual int CheckSpecificParameters() = 0;
220  virtual void ShowHelpSpecific() = 0;
230  virtual int InitializeSpecific() = 0;
231 
232 
233  // -------------------------------------------------------------------
234  // Virtual public member functions that may be overloaded by specific child penalties
235  public:
236 
247  virtual int ReadConfigurationFile( const string& a_configurationFile ) = 0;
258  virtual int ReadOptionsList( const string& a_optionsList ) = 0;
259 
260  // -------------------------------------------------------------------
261  // Data members
262  protected:
263  // Penalty ID
264  string m_penaltyID;
265  // Image dimensions
270  // Verbosity
271  int m_verbose;
272  // Order of penalty derivatives
275 };
276 
277 
278 // ---------------------------------------------------------------------
279 // Part of code that manages the auto declaration of children classes
280 // ---------------------------------------------------------------------
281 
282 // Macro for the function that creates the object
283 #define FUNCTION_PENALTY(CLASS) \
284  static vPenalty *make_penalty() { return new CLASS(); };
285 
286 // Macro for the class that links the appropriate function to the map of objects
287 #define CLASS_PENALTY(NAME,CLASS) \
288  class NAME##PenaltyCreator \
289  { \
290  public: \
291  NAME##PenaltyCreator() \
292  { sAddonManager::GetInstance()->mp_listOfPenalties[#NAME] = CLASS::make_penalty; } \
293  }; \
294  static NAME##PenaltyCreator PenaltyCreator##NAME;
295 
296 #endif
void SetPenaltyID(const string &a_penaltyID)
This class is designed to be a mother virtual class for DataFile.
virtual int ReadOptionsList(const string &a_optionsList)=0
virtual int InitializeSpecific()=0
A private function used to initialize everything specific to the child penalty.
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
void SetVerbose(int a_verbose)
virtual int LocalPreProcessingStep(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th)
virtual void ShowHelpSpecific()=0
A function used to show help about the child module.
int Initialize()
A public function used to initialize the penalty.
void ShowHelp()
A function used to show help about the penalty.
vPenalty()
The constructor of vPenalty.
virtual ~vPenalty()
The destructor of vPenalty.
virtual int GlobalPreProcessingStep()
A public function computing a global pre-processing step for the penalty.
void SetDataFile(vDataFile *ap_DataFile)
Set the image space in use.
This class is designed to generically described any penalty applied to MAP algorithms.
void SetPenaltyStrength(FLTNB a_penaltyStrength)
int CheckParameters()
A public function used to check the parameters settings.
virtual int CheckSpecificParameters()=0
A private function used to check the parameters settings specific to the child penalty.
const string & GetPenaltyID()
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 FLTNB ComputeSecondDerivative(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th)=0
virtual FLTNB ComputeFirstDerivative(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th)=0
void SetImageSpace(oImageSpace *ap_ImageSpace)
virtual int ReadConfigurationFile(const string &a_configurationFile)=0
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
virtual FLTNB ComputePenaltyValue(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th)=0