CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
src/optimizer/vPenalty.cc
Go to the documentation of this file.
1 
8 #include "vPenalty.hh"
9 #include "sOutputManager.hh"
10 
11 // =====================================================================
12 // ---------------------------------------------------------------------
13 // ---------------------------------------------------------------------
14 // =====================================================================
15 
17 {
18  // Affect default values
19  m_penaltyID = "";
21  mp_ImageSpace = NULL;
22  m_verbose = 0;
24  m_penaltyStrength = -1.;
25 }
26 
27 // =====================================================================
28 // ---------------------------------------------------------------------
29 // ---------------------------------------------------------------------
30 // =====================================================================
31 
33 {
34 }
35 
36 // =====================================================================
37 // ---------------------------------------------------------------------
38 // ---------------------------------------------------------------------
39 // =====================================================================
40 
41 void vPenalty::ShowHelp()
42 {
43  // Call the specific help function from the children
45 }
46 
47 
48 // =====================================================================
49 // ---------------------------------------------------------------------
50 // ---------------------------------------------------------------------
51 // =====================================================================
52 
54 {
55  // Check image dimensions
57  {
58  Cerr("***** vPenalty::CheckParameters() -> oImageDimensionsAndQuantification is null !" << endl);
59  return 1;
60  }
61  // Check image space
62  if (mp_ImageSpace==NULL)
63  {
64  Cerr("***** vPenalty::CheckParameters() -> oImageSpace is null !" << endl);
65  return 1;
66  }
67  // Check verbose level
68  if (m_verbose<0)
69  {
70  Cerr("***** vPenalty::CheckParameters() -> Verbose level is negative !" << endl);
71  return 1;
72  }
73  // Check penalty strength
74  if (m_penaltyStrength<0.)
75  {
76  Cerr("***** vPenalty::CheckParameters() -> Penalty strength is negative or unset !" << endl);
77  return 1;
78  }
79  // Call the CheckSpecificParameters function of the child
81  {
82  Cerr("***** vPenalty::CheckParameters() -> A problem occurred while checking parameters specific to the penalty module !" << endl);
83  return 1;
84  }
85  // Normal end
86  return 0;
87 }
88 
89 // =====================================================================
90 // ---------------------------------------------------------------------
91 // ---------------------------------------------------------------------
92 // =====================================================================
93 
95 {
96  // Verbose
98  {
99  Cout("vPenalty::Initialize() -> Initialize the penalty with strength (beta): " << m_penaltyStrength << endl);
100  }
101  // Call the specific initialization function of the child
102  if (InitializeSpecific())
103  {
104  Cerr("***** vPenalty::Initialize() -> A problem occurred while initializing stuff specific to the optimizer module !" << endl);
105  return 1;
106  }
107  // Normal end
108  return 0;
109 }
110 
111 // =====================================================================
112 // ---------------------------------------------------------------------
113 // ---------------------------------------------------------------------
114 // =====================================================================
115 
117 {
118  // This function from the mother class intentionnaly does nothing so that it can be overloaded
119  return 0;
120 }
121 
122 // =====================================================================
123 // ---------------------------------------------------------------------
124 // ---------------------------------------------------------------------
125 // =====================================================================
126 
127 int vPenalty::LocalPreProcessingStep(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th)
128 {
129  // This function from the mother class intentionnaly does nothing so that it can be overloaded
130  return 0;
131 }
virtual int InitializeSpecific()=0
A private function used to initialize everything specific to the child penalty.
#define Cerr(MESSAGE)
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.
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.
#define Cout(MESSAGE)
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification