CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
vPenalty.cc
Go to the documentation of this file.
1 /*
2 This file is part of CASToR.
3 
4  CASToR is free software: you can redistribute it and/or modify it under the
5  terms of the GNU General Public License as published by the Free Software
6  Foundation, either version 3 of the License, or (at your option) any later
7  version.
8 
9  CASToR is distributed in the hope that it will be useful, but WITHOUT ANY
10  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12  details.
13 
14  You should have received a copy of the GNU General Public License along with
15  CASToR (in file GNU_GPL.TXT). If not, see <http://www.gnu.org/licenses/>.
16 
17 Copyright 2017-2019 all CASToR contributors listed below:
18 
19  --> Didier BENOIT, Claude COMTAT, Marina FILIPOVIC, Thibaut MERLIN, Mael MILLARDET, Simon STUTE, Valentin VIELZEUF
20 
21 This is CASToR version 3.0.
22 */
23 
30 #include "vPenalty.hh"
31 #include "sOutputManager.hh"
32 
33 // =====================================================================
34 // ---------------------------------------------------------------------
35 // ---------------------------------------------------------------------
36 // =====================================================================
37 
39 {
40  // Affect default values
41  m_penaltyID = "";
43  mp_ImageSpace = NULL;
44  m_verbose = 0;
46  m_penaltyStrength = -1.;
47 }
48 
49 // =====================================================================
50 // ---------------------------------------------------------------------
51 // ---------------------------------------------------------------------
52 // =====================================================================
53 
55 {
56 }
57 
58 // =====================================================================
59 // ---------------------------------------------------------------------
60 // ---------------------------------------------------------------------
61 // =====================================================================
62 
64 {
65  // Call the specific help function from the children
67 }
68 
69 
70 // =====================================================================
71 // ---------------------------------------------------------------------
72 // ---------------------------------------------------------------------
73 // =====================================================================
74 
76 {
77  // Check image dimensions
79  {
80  Cerr("***** vPenalty::CheckParameters() -> oImageDimensionsAndQuantification is null !" << endl);
81  return 1;
82  }
83  // Check image space
84  if (mp_ImageSpace==NULL)
85  {
86  Cerr("***** vPenalty::CheckParameters() -> oImageSpace is null !" << endl);
87  return 1;
88  }
89  // Check verbose level
90  if (m_verbose<0)
91  {
92  Cerr("***** vPenalty::CheckParameters() -> Verbose level is negative !" << endl);
93  return 1;
94  }
95  // Check penalty strength
96  if (m_penaltyStrength<0.)
97  {
98  Cerr("***** vPenalty::CheckParameters() -> Penalty strength is negative or unset !" << endl);
99  return 1;
100  }
101  // Call the CheckSpecificParameters function of the child
103  {
104  Cerr("***** vPenalty::CheckParameters() -> A problem occurred while checking parameters specific to the penalty module !" << endl);
105  return 1;
106  }
107  // Normal end
108  return 0;
109 }
110 
111 // =====================================================================
112 // ---------------------------------------------------------------------
113 // ---------------------------------------------------------------------
114 // =====================================================================
115 
117 {
118  // Verbose
120  {
121  Cout("vPenalty::Initialize() -> Initialize the penalty with strength (beta): " << m_penaltyStrength << endl);
122  }
123  // Call the specific initialization function of the child
124  if (InitializeSpecific())
125  {
126  Cerr("***** vPenalty::Initialize() -> A problem occurred while initializing stuff specific to the optimizer module !" << endl);
127  return 1;
128  }
129  // Normal end
130  return 0;
131 }
132 
133 // =====================================================================
134 // ---------------------------------------------------------------------
135 // ---------------------------------------------------------------------
136 // =====================================================================
137 
139 {
140  // This function from the mother class intentionnaly does nothing so that it can be overloaded
141  return 0;
142 }
143 
144 // =====================================================================
145 // ---------------------------------------------------------------------
146 // ---------------------------------------------------------------------
147 // =====================================================================
148 
149 int vPenalty::LocalPreProcessingStep(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th)
150 {
151  // This function from the mother class intentionnaly does nothing so that it can be overloaded
152  return 0;
153 }
virtual int InitializeSpecific()=0
A private function used to initialize everything specific to the child penalty.
int m_penaltyDerivativesOrder
Definition: vPenalty.hh:293
oImageSpace * mp_ImageSpace
Definition: vPenalty.hh:289
FLTNB m_penaltyStrength
Definition: vPenalty.hh:294
virtual int LocalPreProcessingStep(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th)
A public function computing a local pre-processing step for the penalty.
Definition: vPenalty.cc:149
string m_penaltyID
Definition: vPenalty.hh:285
virtual void ShowHelpSpecific()=0
A function used to show help about the child module.
int Initialize()
A public function used to initialize the penalty.
Definition: vPenalty.cc:116
void ShowHelp()
A function used to show help about the penalty.
Definition: vPenalty.cc:63
int m_verbose
Definition: vPenalty.hh:291
vPenalty()
The constructor of vPenalty.
Definition: vPenalty.cc:38
#define Cerr(MESSAGE)
virtual ~vPenalty()
The destructor of vPenalty.
Definition: vPenalty.cc:54
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
Definition: vPenalty.hh:288
virtual int GlobalPreProcessingStep()
A public function computing a global pre-processing step for the penalty.
Definition: vPenalty.cc:138
Declaration of class vPenalty.
#define VERBOSE_NORMAL
int CheckParameters()
A public function used to check the parameters settings.
Definition: vPenalty.cc:75
virtual int CheckSpecificParameters()=0
A private function used to check the parameters settings specific to the child penalty.
#define INTNB
Definition: gVariables.hh:92
Declaration of class sOutputManager.
#define Cout(MESSAGE)