CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
code/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);
110  virtual FLTNB ComputePenaltyValue(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th) = 0;
123  virtual FLTNB ComputeFirstDerivative(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th) = 0;
136  virtual FLTNB ComputeSecondDerivative(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th) = 0;
137 
138 
139  // -------------------------------------------------------------------
140  // Public Get & Set functions
141  public:
147  inline void SetVerbose(int a_verbose)
148  {m_verbose = a_verbose;}
154  inline void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification)
155  {mp_ImageDimensionsAndQuantification = ap_ImageDimensionsAndQuantification;}
161  inline void SetImageSpace(oImageSpace* ap_ImageSpace)
162  {mp_ImageSpace = ap_ImageSpace;}
168  inline void SetPenaltyStrength(FLTNB a_penaltyStrength)
169  {m_penaltyStrength = a_penaltyStrength;}
176  {return m_penaltyStrength;}
183  {return m_penaltyDerivativesOrder;}
189  inline void SetPenaltyID(const string& a_penaltyID)
190  {m_penaltyID = a_penaltyID;}
195  inline const string& GetPenaltyID()
196  {return m_penaltyID;}
197 
198 
199  // -----------------------------------------------------------------------------------------
200  // Pure virtual private member functions that need to be implemented by child optimizers
201  private:
210  virtual int CheckSpecificParameters() = 0;
219  virtual void ShowHelpSpecific() = 0;
229  virtual int InitializeSpecific() = 0;
230 
231 
232  // -------------------------------------------------------------------
233  // Virtual public member functions that may be overloaded by specific child penalties
234  public:
235 
246  virtual int ReadConfigurationFile( const string& a_configurationFile ) = 0;
257  virtual int ReadOptionsList( const string& a_optionsList ) = 0;
258 
259  // -------------------------------------------------------------------
260  // Data members
261  protected:
262  // Penalty ID
263  string m_penaltyID;
264  // Image dimensions
268  // Verbosity
269  int m_verbose;
270  // Order of penalty derivatives
273 };
274 
275 
276 // ---------------------------------------------------------------------
277 // Part of code that manages the auto declaration of children classes
278 // ---------------------------------------------------------------------
279 
280 // Macro for the function that creates the object
281 #define FUNCTION_PENALTY(CLASS) \
282  static vPenalty *make_penalty() { return new CLASS(); };
283 
284 // Macro for the class that links the appropriate function to the map of objects
285 #define CLASS_PENALTY(NAME,CLASS) \
286  class NAME##PenaltyCreator \
287  { \
288  public: \
289  NAME##PenaltyCreator() \
290  { sAddonManager::GetInstance()->mp_listOfPenalties[#NAME] = CLASS::make_penalty; } \
291  }; \
292  static NAME##PenaltyCreator PenaltyCreator##NAME;
293 
294 #endif
void SetPenaltyID(const string &a_penaltyID)
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)
const string & GetPenaltyID()
virtual int LocalPreProcessingStep(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th)
FLTNB GetPenaltyStrength()
Get the penalty strength.
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.
This class is designed to generically described any penalty applied to MAP algorithms.
int GetPenaltyDerivativesOrder()
Get the penalty deratives order.
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.
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