CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
oOptimizerManager.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 "oOptimizerManager.hh"
31 #include "sOutputManager.hh"
32 #include "sAddonManager.hh"
33 
34 // =====================================================================
35 // ---------------------------------------------------------------------
36 // ---------------------------------------------------------------------
37 // =====================================================================
38 
40 {
41  // Image dimensions
43  // Image space
44  mp_ImageSpace = NULL;
45  // Data mode
47  // Data type
49  // Data spec
51  // Number of TOF bins
52  m_nbTOFBins = 0;
53  // Optimizer and penalty options
54  m_optionsOptimizer = "";
55  m_optionsPenalty = "";
56  m_penaltyStrength = -1.;
57  // Optimizer and penalty
58  mp_Optimizer = NULL;
59  mp_Penalty = NULL;
60  // Verbosity
61  m_verbose = 0;
62  // Optimizer FOM computation, and image update stat flags
63  m_optimizerFOMFlag = false;
65 }
66 
67 // =====================================================================
68 // ---------------------------------------------------------------------
69 // ---------------------------------------------------------------------
70 // =====================================================================
71 
73 {
74  if (mp_Optimizer) delete(mp_Optimizer);
75  if (mp_Penalty) delete(mp_Penalty);
76 }
77 
78 // =====================================================================
79 // ---------------------------------------------------------------------
80 // ---------------------------------------------------------------------
81 // =====================================================================
82 
84 {
85  // Check image dimensions
87  {
88  Cerr("***** oOptimizerManager::CheckParameters() -> No image dimensions provided !" << endl);
89  return 1;
90  }
91  // Check image space
92  if (mp_ImageSpace==NULL)
93  {
94  Cerr("***** oOptimizerManager::CheckParameters() -> No image space provided !" << endl);
95  return 1;
96  }
97  // Check data mode
99  {
100  Cerr("***** oOptimizerManager::CheckParameters() -> No or meaningless data mode provided !" << endl);
101  return 1;
102  }
103  // Check data type
105  {
106  Cerr("***** oOptimizerManager::CheckParameters() -> No or meaningless data type provided !" << endl);
107  return 1;
108  }
109  // Check data spec
111  {
112  Cerr("***** oOptimizerManager::CheckParameters() -> No or meaningless data specificity provided (emission or transmission) !" << endl);
113  return 1;
114  }
115  // Check optimizer options
116  if (m_optionsOptimizer=="")
117  {
118  Cerr("***** oOptimizerManager::CheckParameters() -> No optimizer options provided !" << endl);
119  return 1;
120  }
121  // Check verbosity
122  if (m_verbose<0)
123  {
124  Cerr("***** oOptimizerManager::CheckParameters() -> Wrong verbosity level provided !" << endl);
125  return 1;
126  }
127  // Normal end
128  return 0;
129 }
130 
131 // =====================================================================
132 // ---------------------------------------------------------------------
133 // ---------------------------------------------------------------------
134 // =====================================================================
135 
137 {
138  // Verbose
139  if (m_verbose>=1) Cout("oOptimizerManager::Initialize() -> Initialize optimizer and penalty" << endl);
140 
141  // Parse projector options and initialize them
143  {
144  Cerr("***** oOptimizerManager::Initialize() -> A problem occurred while parsing optimizer options and initializing it !" << endl);
145  return 1;
146  }
147 
148  // Normal end
149  return 0;
150 }
151 
152 // =====================================================================
153 // ---------------------------------------------------------------------
154 // ---------------------------------------------------------------------
155 // =====================================================================
156 
158 {
159  // ---------------------------------------------------------------------------------------------------
160  // Manage optimizer options
161  // ---------------------------------------------------------------------------------------------------
162 
163  string name_optimizer = "";
164  string list_options_optimizer = "";
165  string file_options_optimizer = "";
166 
167  // This is for the automatic initialization of the optimizer and penalty
168  typedef vOptimizer *(*maker_optimizer) ();
169 
170  // ______________________________________________________________________________
171  // Get the optimizer name in the options and isolate the real optimizer's options
172 
173  // First check emptyness of the options
174  if (m_optionsOptimizer=="")
175  {
176  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> No optimizer provided !" << endl);
177  return 1;
178  }
179 
180  // Search for a colon ":", this indicates that a configuration file is provided after the optimizer name
181  size_t colon = m_optionsOptimizer.find_first_of(":");
182  size_t comma = m_optionsOptimizer.find_first_of(",");
183 
184  // Case 1: we have a colon
185  if (colon!=string::npos)
186  {
187  // Get the optimizer name before the colon
188  name_optimizer = m_optionsOptimizer.substr(0,colon);
189  // Get the configuration file after the colon
190  file_options_optimizer = m_optionsOptimizer.substr(colon+1);
191  // List of options is empty
192  list_options_optimizer = "";
193  }
194  // Case 2: we have a comma
195  else if (comma!=string::npos)
196  {
197  // Get the optimizer name before the first comma
198  name_optimizer = m_optionsOptimizer.substr(0,comma);
199  // Get the list of options after the first comma
200  list_options_optimizer = m_optionsOptimizer.substr(comma+1);
201  // Configuration file is empty
202  file_options_optimizer = "";
203  }
204  // Case 3: no colon and no comma (a single optimizer name)
205  else
206  {
207  // Get the optimizer name
208  name_optimizer = m_optionsOptimizer;
209  // List of options is empty
210  list_options_optimizer = "";
211  // Build the default configuration file
212  sOutputManager* p_output_manager = sOutputManager::GetInstance();
213  file_options_optimizer = p_output_manager->GetPathToConfigDir() + "/optimizer/" + name_optimizer + ".conf";
214  }
215 
216  // ______________________________________________________________________________
217  // Construct and initialize the optimizer
218 
219  // Get optimizer's listfrom addon manager
220  std::map <string,maker_optimizer> list_optimizer = sAddonManager::GetInstance()->mp_listOfOptimizers;
221  // Create the optimizer
222  if (list_optimizer[name_optimizer]) mp_Optimizer = list_optimizer[name_optimizer]();
223  else
224  {
225  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> Optimizer '" << name_optimizer << "' does not exist !" << endl);
226  return 1;
227  }
228  // Set parameters
229  mp_Optimizer->SetOptimizerID(name_optimizer);
239  // Provide configuration file if any (child specific function)
240  if (file_options_optimizer!="" && mp_Optimizer->ReadConfigurationFile(file_options_optimizer))
241  {
242  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while reading and checking optimizer's configuration file !" << endl);
243  return 1;
244  }
245  // Provide options if any (child specific function)
246  if (list_options_optimizer!="" && mp_Optimizer->ReadOptionsList(list_options_optimizer))
247  {
248  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while parsing and reading optimizer's options !" << endl);
249  return 1;
250  }
251  // Check parameters (mother generic function that will call the child specific function at the end)
253  {
254  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while checking optimizer parameters !" << endl);
255  return 1;
256  }
257 
258  // ---------------------------------------------------------------------------------------------------
259  // Manage penalty options
260  // ---------------------------------------------------------------------------------------------------
261 
262  string name_penalty = "";
263  string list_options_penalty = "";
264  string file_options_penalty = "";
265 
266  // This is for the automatic initialization of the penalty
267  typedef vPenalty *(*maker_penalty) ();
268 
269  // ______________________________________________________________________________
270  // Get the penalty name in the options and isolate the real penalty's options
271 
272  // Do we have some penalty provided ?
273  if (m_optionsPenalty!="")
274  {
275 
276  // Otherwise, check if the optimizer accepts penalties
278  {
279  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> Penalty provided while the selected optimizer does not accept penalties !" << endl);
280  Cerr(" Remove penalty or change for another optimizer that accepts penalties." << endl);
281  return 1;
282  }
283  // Search for a colon ":", this indicates that a configuration file is provided after the penalty name
284  colon = m_optionsPenalty.find_first_of(":");
285  comma = m_optionsPenalty.find_first_of(",");
286  // Case 1: we have a colon
287  if (colon!=string::npos)
288  {
289  // Get the penalty name before the colon
290  name_penalty = m_optionsPenalty.substr(0,colon);
291  // Get the configuration file after the colon
292  file_options_penalty = m_optionsPenalty.substr(colon+1);
293  // List of options is empty
294  list_options_penalty = "";
295  }
296  // Case 2: we have a comma
297  else if (comma!=string::npos)
298  {
299  // Get the penalty name before the first comma
300  name_penalty = m_optionsPenalty.substr(0,comma);
301  // Get the list of options after the first comma
302  list_options_penalty = m_optionsPenalty.substr(comma+1);
303  // Configuration file is empty
304  file_options_penalty = "";
305  }
306  // Case 3: no colon and no comma (a single penalty name)
307  else
308  {
309  // Get the penalty name
310  name_penalty = m_optionsPenalty;
311  // List of options is empty
312  list_options_penalty = "";
313  // Build the default configuration file
314  sOutputManager* p_output_manager = sOutputManager::GetInstance();
315  file_options_penalty = p_output_manager->GetPathToConfigDir() + "/optimizer/" + name_penalty + ".conf";
316  }
317  // ______________________________________________________________________________
318  // Construct and initialize the penalty
319  // Get penalty's list from addon manager
320  std::map <string,maker_penalty> list_penalty = sAddonManager::GetInstance()->mp_listOfPenalties;
321  // Create the penalty
322  if (list_penalty[name_penalty]) mp_Penalty = list_penalty[name_penalty]();
323  else
324  {
325  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> Penalty '" << name_penalty << "' does not exist !" << endl);
326  return 1;
327  }
328  // Set parameters
329  mp_Penalty->SetPenaltyID(name_penalty);
335  // Provide configuration file if any
336  if (file_options_penalty!="" && mp_Penalty->ReadConfigurationFile(file_options_penalty))
337  {
338  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while reading and checking penalty's configuration file !" << endl);
339  return 1;
340  }
341  // Provide options if any
342  if (list_options_penalty!="" && mp_Penalty->ReadOptionsList(list_options_penalty))
343  {
344  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while parsing and reading penalty's options !" << endl);
345  return 1;
346  }
347  // Check parameters
349  {
350  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while checking penalty parameters !" << endl);
351  return 1;
352  }
353  // Initialize the penalty
354  if (mp_Penalty->Initialize())
355  {
356  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while initializing the penalty !" << endl);
357  return 1;
358  }
359  // Check that the derivatives order of the penalty is compatible with the optimizer
361  {
362  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> Derivatives order allowed by chosen penalty is not compatible with the order required by the optimizer !" << endl);
363  return 1;
364  }
365  }
366 
367  // ---------------------------------------------------------------------------------------------------
368  // Finally initialize the optimizer (mother generic function that will call the child specific function at the end)
369  // ---------------------------------------------------------------------------------------------------
370  if (mp_Optimizer->Initialize())
371  {
372  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while initializing the optimizer !" << endl);
373  return 1;
374  }
375 
376  // Normal end
377  return 0;
378 }
379 
380 // =====================================================================
381 // ---------------------------------------------------------------------
382 // ---------------------------------------------------------------------
383 // =====================================================================
384 
386 {
387  // Simply call the homonymous function from the vOptimizer
389  {
390  Cerr("***** oOptimizerManager::PreDataUpdateStep() -> A problem occurred while applying the pre-data-update step to the optimizer !" << endl);
391  return 1;
392  }
393  // Normal end
394  return 0;
395 }
396 
397 // =====================================================================
398 // ---------------------------------------------------------------------
399 // ---------------------------------------------------------------------
400 // =====================================================================
401 
403 {
404  // Simply call the homonymous function from the vOptimizer
406  {
407  Cerr("***** oOptimizerManager::PreImageUpdateStep() -> A problem occurred while applying the pre-image-update step to the optimizer !" << endl);
408  return 1;
409  }
410  // Normal end
411  return 0;
412 }
413 
414 // =====================================================================
415 // ---------------------------------------------------------------------
416 // ---------------------------------------------------------------------
417 // =====================================================================
418 
420  int a_bed, int a_timeFrame, int a_respGate, int a_cardGate,
421  int a_thread)
422 {
423  // ---------------------------------------------------------------------------------
424  // Deal with all multiplicative correction factors to be included in the projections
425  // ---------------------------------------------------------------------------------
426 
427  // Compute the global multiplicative correction factor
428  FLTNB multiplicative_correction = ap_Event->GetMultiplicativeCorrections() * mp_ImageDimensionsAndQuantification->GetQuantificationFactor(a_bed,a_timeFrame, a_respGate, a_cardGate);
429 
430  // Do nothing if the multiplicative correction factor is null or negative
431  if (multiplicative_correction<=0.) return 0;
432 
433  // With transmission data, we include a correction factor to convert the default
434  // mm-1 unit of CASToR into cm-1 which is the standard attenuation unit in physics
435  // (this means that the image is reconstructed in cm-1)
436  if (m_dataSpec==SPEC_TRANSMISSION) multiplicative_correction *= 10.;
437 
438  // Set the multiplicative correction to the oProjectionLine so that it is part of the system matrix and automatically applied
439  ap_Line->SetMultiplicativeCorrection(multiplicative_correction);
440 
441  // Set the current attenuation image for SPECT attenuation correction
442  if (m_dataType==TYPE_SPECT && mp_ImageSpace->m4p_attenuation!=NULL) mp_Optimizer->SetAttenuationImage(mp_ImageSpace->m4p_attenuation[a_timeFrame][a_respGate][a_cardGate], a_thread);
443 
444  // --------------------------------------------------------------------------------
445  // Decompose the data update step into 4 steps mandatory steps and 3 optional steps
446  // --------------------------------------------------------------------------------
447 
448  // Mandatory 1: Compute model (forward-projection + additive background)
449  if (mp_Optimizer->DataStep1ForwardProjectModel( ap_Line, ap_Event, a_bed, a_timeFrame, a_respGate, a_cardGate, a_thread ))
450  {
451  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occurred while forward projecting !" << endl);
452  return 1;
453  }
454 
455  // Optional 1: Do what is done in the child optimizer
456  if (mp_Optimizer->DataStep2Optional( ap_Line, ap_Event, a_bed, a_timeFrame, a_respGate, a_cardGate, a_thread ))
457  {
458  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occurred while performing optional step 1 !" << endl);
459  return 1;
460  }
461 
462  // Mandatory 2: Compute sensitivity in histogram mode
464  && mp_Optimizer->DataStep3BackwardProjectSensitivity( ap_Line, ap_Event, a_bed, a_timeFrame, a_respGate, a_cardGate, a_thread ))
465  {
466  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occurred while backward projecting the sensitivity !" << endl);
467  return 1;
468  }
469 
470  // Optional 2: Do what is done in the child optimizer
471  if (mp_Optimizer->DataStep4Optional( ap_Line, ap_Event, a_bed, a_timeFrame, a_respGate, a_cardGate, a_thread ))
472  {
473  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occurred while performing optional step 2 !" << endl);
474  return 1;
475  }
476 
477  // Mandatory 3: Compute the correction terms
478  if (mp_Optimizer->DataStep5ComputeCorrections( ap_Line, ap_Event, a_bed, a_timeFrame, a_respGate, a_cardGate, a_thread ))
479  {
480  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occurred while computing correction terms !" << endl);
481  return 1;
482  }
483 
484  // Optional 3: Do what is done in the child optimizer
485  if (mp_Optimizer->DataStep6Optional( ap_Line, ap_Event, a_bed, a_timeFrame, a_respGate, a_cardGate, a_thread ))
486  {
487  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occurred while performing optional step 3 !" << endl);
488  return 1;
489  }
490 
491  // Mandatory 4: Backproject correction terms
492  if (mp_Optimizer->DataStep7BackwardProjectCorrections( ap_Line, ap_Event, a_bed, a_timeFrame, a_respGate, a_cardGate, a_thread ))
493  {
494  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occurred while backward projecting the correction !" << endl);
495  return 1;
496  }
497 
498  // Compute FOM is asked for
499  if (m_optimizerFOMFlag && mp_Optimizer->DataStep8ComputeFOM( ap_Line, ap_Event, a_timeFrame, a_respGate, a_cardGate, a_thread ))
500  {
501  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occurred while computing FOMs !" << endl);
502  return 1;
503  }
504 
505  // End
506  return 0;
507 }
508 
509 // =====================================================================
510 // ---------------------------------------------------------------------
511 // ---------------------------------------------------------------------
512 // =====================================================================
513 
515 {
516  // Verbose
517  if (m_verbose>=2) Cout("oOptimizerManager::ImageUpdateStep() -> Proceed to image update" << endl);
518  // Update visited voxels
520  {
521  Cerr("***** oOptimizerManager::ImageUpdateStep() -> Problem while updating visited voxels !" << endl);
522  return 1;
523  }
524  // Image update step
526  {
527  Cerr("***** oOptimizerManager::ImageUpdateStep() -> Problem while updating image space !" << endl);
528  return 1;
529  }
530  // End
531  return 0;
532 }
533 
534 // =====================================================================
535 // ---------------------------------------------------------------------
536 // ---------------------------------------------------------------------
537 // =====================================================================
void SetOptimizerID(const string &a_optimizerID)
Set the optimizer ID.
Definition: vOptimizer.hh:569
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
void SetPenaltyStrength(FLTNB a_penaltyStrength)
Set the penalty strength.
Definition: vPenalty.hh:190
void SetMultiplicativeCorrection(FLTNB a_multiplicativeCorrection)
This function is used to set the multiplicative correction to be applied during forward and backward ...
#define MODE_HISTOGRAM
Definition: vDataFile.hh:58
#define TYPE_PET
Definition: vDataFile.hh:73
#define TYPE_UNKNOWN
Definition: vDataFile.hh:71
#define MODE_LIST
Definition: vDataFile.hh:56
bool GetNeedGlobalSensitivity()
Get the boolean saying if the sensitivity has to be computed globally for all data channels and not p...
Definition: vOptimizer.hh:606
#define FLTNB
Definition: gVariables.hh:81
virtual int ReadConfigurationFile(const string &a_configurationFile)=0
A function used to read options from a configuration file and check that the corresponding values are...
virtual int DataStep2Optional(oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
A public function which does nothing but being virtual.
Definition: vOptimizer.cc:721
void SetFOMFlag(bool a_optimizerFOMFlag)
Set the FOM flag specifying if figures-of-merit will be computed or not.
Definition: vOptimizer.hh:519
int PreImageUpdateStep()
A function that simply calls the eponym function from the vOptimizer.
virtual int ReadConfigurationFile(const string &a_configurationFile)=0
A function used to read options from a configuration file.
virtual int ImageUpdateStep()
A public function used to perform the image update step of the optimizer.
Definition: vOptimizer.cc:954
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
Set the pointer to the image dimensions in use.
Definition: vOptimizer.hh:469
virtual FLTNB GetMultiplicativeCorrections()=0
This is a pure virtual function implemented in the child classes.
static sOutputManager * GetInstance()
Instanciate the singleton object and Initialize member variables if not already done, return a pointer to this object otherwise.
#define TYPE_SPECT
Definition: vDataFile.hh:75
#define TYPE_CT
Definition: vDataFile.hh:77
oImageSpace * mp_ImageSpace
virtual int ReadOptionsList(const string &a_optionsList)=0
A function used to read options from a list of options.
int PreDataUpdateStep()
A public function used to do stuff that need to be done at the beginning of a subset (before the data...
Definition: vOptimizer.cc:431
int Initialize()
A function used to initialize the manager and the optimizer it manages.
int DataUpdateStep(oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
A function dedicated to the update step in the data space (for each event inside the loop) ...
int GetDataMode()
Definition: vEvent.hh:131
int Initialize()
A public function used to initialize the penalty.
Definition: vPenalty.cc:116
void SetNbTOFBins(int a_nbTOFBins)
Set the number of TOF bins in use.
Definition: vOptimizer.hh:483
static sAddonManager * GetInstance()
std::map< string, maker_optimizer > mp_listOfOptimizers
void SetDataType(int a_dataType)
Set the data type in use.
Definition: vOptimizer.hh:497
virtual int DataStep6Optional(oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
A public function which does nothing but being virtual.
Definition: vOptimizer.cc:823
int ParseOptionsAndInitializeOptimizerAndPenalty()
#define Cerr(MESSAGE)
int GetRequiredPenaltyDerivativesOrder()
Get the penalty derivative order needed for this algorithm.
Definition: vOptimizer.hh:584
bool GetAcceptPenalty()
Get the boolean saying if the optimizer accepts penalties.
Definition: vOptimizer.hh:591
Singleton class that manages output writing on disk (images, sinograms, etc). It also manages loggi...
const string & GetPathToConfigDir()
Return the path to the CASTOR config directory.
virtual int DataStep3BackwardProjectSensitivity(oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
A public function used to back-project the sensitivity terms for the provided event.
Definition: vOptimizer.cc:734
int PreDataUpdateStep()
A function that simply calls the eponym function from the vOptimizer.
vOptimizer * mp_Optimizer
virtual int DataStep1ForwardProjectModel(oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
A public function used to compute the model: forward projection of the provided event.
Definition: vOptimizer.cc:642
void SetPenaltyID(const string &a_penaltyID)
Set the penalty ID.
Definition: vPenalty.hh:211
FLTNB GetQuantificationFactor(int a_bed, int a_frame, int a_respGate, int a_cardGate)
Get the quantification factor corresponding to the provided bed, frame, respiratory and cardiac gates...
This class is designed to generically described any penalty applied to MAP algorithms.
Definition: vPenalty.hh:48
virtual int DataStep8ComputeFOM(oProjectionLine *ap_Line, vEvent *ap_Event, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
A public function used to update the computation of figures-of-merit in the data space.
Definition: vOptimizer.cc:891
void SetImageStatFlag(bool a_optimizerImageStatFlag)
Set the image stat flag specifying if basic statistics about image udpate will be computed or not...
Definition: vOptimizer.hh:526
void SetPenalty(vPenalty *ap_penalty)
Set the penalty of the optimizer.
Definition: vOptimizer.hh:598
#define SPEC_UNKNOWN
Definition: vDataFile.hh:88
void SetImageSpace(oImageSpace *ap_ImageSpace)
Set the pointer to the image space in use.
Definition: vPenalty.hh:183
int CheckParameters()
A function used to check the parameters settings.
void SetVerbose(int a_verbose)
Set the verbose level.
Definition: vPenalty.hh:169
int GetPenaltyDerivativesOrder()
Get the penalty deratives order.
Definition: vPenalty.hh:204
#define SPEC_TRANSMISSION
Definition: vDataFile.hh:92
int CheckParameters()
A public function used to check the parameters settings.
Definition: vPenalty.cc:75
void SetDataSpec(int a_dataSpec)
Set the data physical specificity in use.
Definition: vOptimizer.hh:504
int PreImageUpdateStep()
A public function used to do stuff that need to be done between the loop over events and the image up...
Definition: vOptimizer.cc:479
This class is designed to generically described any iterative optimizer.
Definition: vOptimizer.hh:59
void SetAttenuationImage(FLTNB *ap_attenuationImage, int a_thread)
Set the attenuation image corresponding to the current thread and current event.
Definition: vOptimizer.hh:512
This class is designed to manage and store system matrix elements associated to a vEvent...
~oOptimizerManager()
The destructor of oOptimizerManager.
int Initialize()
A public function used to initialize the optimizer.
Definition: vOptimizer.cc:349
virtual int DataStep4Optional(oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
A public function which does nothing but being virtual.
Definition: vOptimizer.cc:774
Declaration of class sOutputManager.
Mother class for the Event objects.
Definition: vEvent.hh:42
virtual int DataStep5ComputeCorrections(oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
A public function used to compute the correction terms in the data space, for the provided event...
Definition: vOptimizer.cc:787
std::map< string, maker_penalty > mp_listOfPenalties
#define SPEC_EMISSION
Definition: vDataFile.hh:90
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
Set the pointer to the image dimensions in use.
Definition: vPenalty.hh:176
int ImageUpdateStep()
A function dedicated to the update step in the image space (performed after the loop on events) ...
virtual int ReadOptionsList(const string &a_optionsList)=0
A function used to read options from a list of options.
oOptimizerManager()
The constructor of oOptimizerManager.
int UpdateVisitedVoxels()
A public function used to update the &#39;visited&#39; voxels after each subset.
Definition: vOptimizer.cc:919
Declaration of class oOptimizerManager.
#define MODE_UNKNOWN
Definition: vDataFile.hh:54
#define Cout(MESSAGE)
void SetVerbose(int a_verbose)
Set the verbose level.
Definition: vOptimizer.hh:462
FLTNB **** m4p_attenuation
Definition: oImageSpace.hh:128
virtual int DataStep7BackwardProjectCorrections(oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
A public function used to back-project the correction terms into the backward correction image...
Definition: vOptimizer.cc:836
void SetDataMode(int a_dataMode)
Set the data mode in use.
Definition: vOptimizer.hh:490
int CheckParameters()
A public function used to check the parameters settings.
Definition: vOptimizer.cc:254
Declaration of class sAddonManager.
void SetImageSpace(oImageSpace *ap_ImageSpace)
Set the pointer to the image space in use.
Definition: vOptimizer.hh:476