CASToR  2.0
Tomographic Reconstruction (PET/SPECT/CT)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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-2018 all CASToR contributors listed below:
18 
19  --> current contributors: Thibaut MERLIN, Simon STUTE, Didier BENOIT, Claude COMTAT, Marina FILIPOVIC, Mael MILLARDET
20  --> past contributors: Valentin VIELZEUF
21 
22 This is CASToR version 2.0.
23 */
24 
31 #include "oOptimizerManager.hh"
32 #include "sOutputManager.hh"
33 #include "sAddonManager.hh"
34 
35 // =====================================================================
36 // ---------------------------------------------------------------------
37 // ---------------------------------------------------------------------
38 // =====================================================================
39 
41 {
42  // Image dimensions
44  // Image space
45  mp_ImageSpace = NULL;
46  // Data mode
48  // Data type
50  // Data spec
52  // Number of TOF bins
53  m_nbTOFBins = 0;
54  // Optimizer and penalty options
55  m_optionsOptimizer = "";
56  m_optionsPenalty = "";
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 }
75 
76 // =====================================================================
77 // ---------------------------------------------------------------------
78 // ---------------------------------------------------------------------
79 // =====================================================================
80 
82 {
83  // Check image dimensions
85  {
86  Cerr("***** oOptimizerManager::CheckParameters() -> No image dimensions provided !" << endl);
87  return 1;
88  }
89  // Check image space
90  if (mp_ImageSpace==NULL)
91  {
92  Cerr("***** oOptimizerManager::CheckParameters() -> No image space provided !" << endl);
93  return 1;
94  }
95  // Check data mode
97  {
98  Cerr("***** oOptimizerManager::CheckParameters() -> No or meaningless data mode provided !" << endl);
99  return 1;
100  }
101  // Check data type
103  {
104  Cerr("***** oOptimizerManager::CheckParameters() -> No or meaningless data type provided !" << endl);
105  return 1;
106  }
107  // Check data spec
109  {
110  Cerr("***** oOptimizerManager::CheckParameters() -> No or meaningless data specificity provided (emission or transmission) !" << endl);
111  return 1;
112  }
113  // Check optimizer options
114  if (m_optionsOptimizer=="")
115  {
116  Cerr("***** oOptimizerManager::CheckParameters() -> No optimizer options provided !" << endl);
117  return 1;
118  }
119  // Check verbosity
120  if (m_verbose<0)
121  {
122  Cerr("***** oOptimizerManager::CheckParameters() -> Wrong verbosity level provided !" << endl);
123  return 1;
124  }
125  // Normal end
126  return 0;
127 }
128 
129 // =====================================================================
130 // ---------------------------------------------------------------------
131 // ---------------------------------------------------------------------
132 // =====================================================================
133 
135 {
136  // Verbose
137  if (m_verbose>=1) Cout("oOptimizerManager::Initialize() -> Initialize optimizer and penalty" << endl);
138 
139  // Parse projector options and initialize them
141  {
142  Cerr("***** oOptimizerManager::Initialize() -> A problem occured while parsing optimizer options and initializing it !" << endl);
143  return 1;
144  }
145 
146  // Normal end
147  return 0;
148 }
149 
150 // =====================================================================
151 // ---------------------------------------------------------------------
152 // ---------------------------------------------------------------------
153 // =====================================================================
154 
156 {
157  // ---------------------------------------------------------------------------------------------------
158  // Manage optimizer options
159  // ---------------------------------------------------------------------------------------------------
160 
161  string name_optimizer = "";
162  string list_options_optimizer = "";
163  string file_options_optimizer = "";
164 
165  // This is for the automatic initialization of the optimizer and penalty
166  typedef vOptimizer *(*maker_optimizer) ();
167 
168  // ______________________________________________________________________________
169  // Get the optimizer name in the options and isolate the real optimizer's options
170 
171  // First check emptyness of the options
172  if (m_optionsOptimizer=="")
173  {
174  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> No optimizer provided !" << endl);
175  return 1;
176  }
177 
178  // Search for a colon ":", this indicates that a configuration file is provided after the optimizer name
179  size_t colon = m_optionsOptimizer.find_first_of(":");
180  size_t comma = m_optionsOptimizer.find_first_of(",");
181 
182  // Case 1: we have a colon
183  if (colon!=string::npos)
184  {
185  // Get the optimizer name before the colon
186  name_optimizer = m_optionsOptimizer.substr(0,colon);
187  // Get the configuration file after the colon
188  file_options_optimizer = m_optionsOptimizer.substr(colon+1);
189  // List of options is empty
190  list_options_optimizer = "";
191  }
192  // Case 2: we have a comma
193  else if (comma!=string::npos)
194  {
195  // Get the optimizer name before the first comma
196  name_optimizer = m_optionsOptimizer.substr(0,comma);
197  // Get the list of options after the first comma
198  list_options_optimizer = m_optionsOptimizer.substr(comma+1);
199  // Configuration file is empty
200  file_options_optimizer = "";
201  }
202  // Case 3: no colon and no comma (a single optimizer name)
203  else
204  {
205  // Get the optimizer name
206  name_optimizer = m_optionsOptimizer;
207  // List of options is empty
208  list_options_optimizer = "";
209  // Build the default configuration file
210  sOutputManager* p_output_manager = sOutputManager::GetInstance();
211  file_options_optimizer = p_output_manager->GetPathToConfigDir() + "/optimizer/" + name_optimizer + ".conf";
212  }
213 
214  // ______________________________________________________________________________
215  // Construct and initialize the optimizer
216 
217  // Get optimizer's listfrom addon manager
218  std::map <string,maker_optimizer> list_optimizer = sAddonManager::GetInstance()->mp_listOfOptimizers;
219  // Create the optimizer
220  if (list_optimizer[name_optimizer]) mp_Optimizer = list_optimizer[name_optimizer]();
221  else
222  {
223  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> Optimizer '" << name_optimizer << "' does not exist !" << endl);
224  return 1;
225  }
226  // Set parameters
236  // Provide configuration file if any (child specific function)
237  if (file_options_optimizer!="" && mp_Optimizer->ReadConfigurationFile(file_options_optimizer))
238  {
239  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occured while reading and checking optimizer's configuration file !" << endl);
240  return 1;
241  }
242  // Provide options if any (child specific function)
243  if (list_options_optimizer!="" && mp_Optimizer->ReadOptionsList(list_options_optimizer))
244  {
245  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occured while parsing and reading optimizer's options !" << endl);
246  return 1;
247  }
248  // Check parameters (mother generic function that will call the child specific function at the end)
250  {
251  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occured while checking optimizer parameters !" << endl);
252  return 1;
253  }
254  // Initialize the optimizer (mother generic function that will call the child specific function at the end)
255  if (mp_Optimizer->Initialize())
256  {
257  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occured while initializing the optimizer !" << endl);
258  return 1;
259  }
260 
261  // ---------------------------------------------------------------------------------------------------
262  // Manage penalty options (not yet implemented, a lot of work to do)
263  // ---------------------------------------------------------------------------------------------------
264  /* Do not remove
265  string name_penalty = "";
266  string list_options_penalty = "";
267  string file_options_penalty = "";
268 
269  // This is for the automatic initialization of the penalty
270  typedef vPenalty *(*maker_penalty) ();
271 
272  // ______________________________________________________________________________
273  // Get the penalty name in the options and isolate the real penalty's options
274 
275  // If no penalty, then return now
276  if (m_optionsPenalty=="")
277  {
278  return 0;
279  }
280  // Otherwise, check if the optimizer accepts penalties
281  else
282  {
283  if (!mp_Optimizer->GetAcceptPenalty())
284  {
285  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> Penalty provided while the selected optimizer does not accept penalties !" << endl);
286  Cerr(" Remove penalty or change for another optimizer that accepts penalties." << endl);
287  return 1;
288  }
289  }
290 
291  // Search for a colon ":", this indicates that a configuration file is provided after the penalty name
292  colon = m_optionsPenalty.find_first_of(":");
293  comma = m_optionsPenalty.find_first_of(",");
294 
295  // Case 1: we have a colon
296  if (colon!=string::npos)
297  {
298  // Get the penalty name before the colon
299  name_penalty = m_optionsPenalty.substr(0,colon);
300  // Get the configuration file after the colon
301  file_options_penalty = m_optionsPenalty.substr(colon+1);
302  // List of options is empty
303  list_options_penalty = "";
304  }
305  // Case 2: we have a comma
306  else if (comma!=string::npos)
307  {
308  // Get the penalty name before the first comma
309  name_penalty = m_optionsPenalty.substr(0,comma);
310  // Get the list of options after the first comma
311  list_options_penalty = m_optionsPenalty.substr(comma+1);
312  // Configuration file is empty
313  file_options_penalty = "";
314  }
315  // Case 3: no colon and no comma (a single penalty name)
316  else
317  {
318  // Get the penalty name
319  name_penalty = m_optionsPenalty;
320  // List of options is empty
321  list_options_penalty = "";
322  // Build the default configuration file
323  sOutputManager* p_output_manager = sOutputManager::GetInstance();
324  file_options_penalty = p_output_manager->GetPathToConfigDir() + "/penalty/" + name_optimizer + ".conf";
325  }
326 
327  // ______________________________________________________________________________
328  // Construct and initialize the penalty
329 
330  // Get penalty's list from addon manager
331  std::map <string,maker_penalty> list_penalty = sAddonManager::GetInstance()->mp_listOfPenalties;
332  // Create the penalty
333  if (list_penalty[name_penalty]) mp_Penalty = list_penalty[name_penalty]();
334  else
335  {
336  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> Penalty '" << name_penalty << "' does not exist !" << endl);
337  return 1;
338  }
339  // Set parameters
340  mp_Penalty->SetImageDimensionsAndQuantification(mp_ImageDimensionsAndQuantification);
341  mp_Penalty->SetVerbose(m_verbose);
342  // Check parameters
343  if (mp_Penalty->CheckParameters())
344  {
345  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occured while checking penalty parameters !" << endl);
346  return 1;
347  }
348  // Provide configuration file if any
349  if (file_options_penalty!="" && mp_Penalty->ReadAndCheckConfigurationFile(file_options_penalty))
350  {
351  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occured while reading and checking penalty's configuration file !" << endl);
352  return 1;
353  }
354  // Provide options if any
355  if (list_options_penalty!="" && mp_Penalty->ReadAndCheckOptionsList(list_options_penalty))
356  {
357  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occured while parsing and reading penalty's options !" << endl);
358  return 1;
359  }
360  // Initialize the penalty
361  if (mp_Penalty->Initialize())
362  {
363  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occured while initializing the penalty !" << endl);
364  return 1;
365  }
366  // Check that the derivatives order of the penalty is compatible with the optimizer
367  if (mp_Penalty->GetPenaltyEnergyFunctionDerivativesOrder() != mp_Optimizer->GetPenaltyEnergyFunctionDerivativesOrder())
368  {
369  Cerr("***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> Derivatives order allowed by chosen penalty is not compatible with the order accepted by the optimizer !" << endl);
370  return 1;
371  }
372  */
373 
374  // Normal end
375  return 0;
376 }
377 
378 // =====================================================================
379 // ---------------------------------------------------------------------
380 // ---------------------------------------------------------------------
381 // =====================================================================
382 
383 int oOptimizerManager::PreDataUpdateStep(int a_iteration, int a_nbIterations, int a_subset, int* ap_nbSubsets)
384 {
385  // Simply call the homonymous function from the vOptimizer
386  if (mp_Optimizer->PreDataUpdateStep(a_iteration, a_nbIterations, a_subset, ap_nbSubsets))
387  {
388  Cerr("***** oOptimizerManager::PreDataUpdateStep() -> A problem occured while applying the pre-data-update step to the optimizer !" << endl);
389  return 1;
390  }
391  // Normal end
392  return 0;
393 }
394 
395 // =====================================================================
396 // ---------------------------------------------------------------------
397 // ---------------------------------------------------------------------
398 // =====================================================================
399 
400 int oOptimizerManager::PostDataUpdateStep(int a_iteration, int a_nbIterations, int a_subset, int* ap_nbSubsets)
401 {
402  // Simply call the homonymous function from the vOptimizer
403  if (mp_Optimizer->PostDataUpdateStep(a_iteration, a_nbIterations, a_subset, ap_nbSubsets))
404  {
405  Cerr("***** oOptimizerManager::PostDataUpdateStep() -> A problem occured while applying the post-data-update step to the optimizer !" << endl);
406  return 1;
407  }
408  // Normal end
409  return 0;
410 }
411 
412 // =====================================================================
413 // ---------------------------------------------------------------------
414 // ---------------------------------------------------------------------
415 // =====================================================================
416 
418  int a_bed, int a_timeFrame, int a_respGate, int a_cardGate,
419  int a_iteration, int a_thread)
420 {
421  // ---------------------------------------------------------------------------------
422  // Deal with all multiplicative correction factors to be included in the projections
423  // ---------------------------------------------------------------------------------
424 
425  // Compute the global multiplicative correction factor
426  FLTNB multiplicative_correction = ap_Event->GetMultiplicativeCorrections() * mp_ImageDimensionsAndQuantification->GetQuantificationFactor(a_bed,a_timeFrame, a_respGate, a_cardGate);
427 
428  // Do nothing if the multiplicative correction factor is null or negative
429  if (multiplicative_correction<=0.) return 0;
430 
431  // Set the multiplicative correction to the oProjectionLine so that it is part of the system matrix and automatically applied
432  ap_Line->SetMultiplicativeCorrection(multiplicative_correction);
433 
434  // Set the current attenuation image for SPECT attenuation correction
435  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);
436 
437  // --------------------------------------------------------------------------------
438  // Decompose the data update step into 4 steps mandatory steps and 3 optional steps
439  // --------------------------------------------------------------------------------
440 
441  // Mandatory 1: Compute model (forward-projection + additive background)
442  if (mp_Optimizer->DataStep1ForwardProjectModel( ap_Line, ap_Event, a_bed, a_timeFrame, a_respGate, a_cardGate, a_thread ))
443  {
444  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occured while forward projecting !" << endl);
445  return 1;
446  }
447 
448  // Optional 1: Do what is done in the child optimizer
449  if (mp_Optimizer->DataStep2Optional( ap_Line, ap_Event, a_bed, a_timeFrame, a_respGate, a_cardGate, a_iteration, a_thread ))
450  {
451  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occured while performing optional step 1 !" << endl);
452  return 1;
453  }
454 
455  // Mandatory 2: Compute sensitivity in histogram mode
456  if (ap_Event->GetDataMode()==MODE_HISTOGRAM && mp_Optimizer->DataStep3BackwardProjectSensitivity( ap_Line, ap_Event, a_bed, a_timeFrame, a_respGate, a_cardGate, a_thread ))
457  {
458  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occured while backward projecting the sensitivity !" << endl);
459  return 1;
460  }
461 
462  // Optional 2: Do what is done in the child optimizer
463  if (mp_Optimizer->DataStep4Optional( ap_Line, ap_Event, a_bed, a_timeFrame, a_respGate, a_cardGate, a_iteration, a_thread ))
464  {
465  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occured while performing optional step 2 !" << endl);
466  return 1;
467  }
468 
469  // Mandatory 3: Compute the correction terms
470  if (mp_Optimizer->DataStep5ComputeCorrections( ap_Line, ap_Event, a_bed, a_timeFrame, a_respGate, a_cardGate, a_thread ))
471  {
472  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occured while computing correction terms !" << endl);
473  return 1;
474  }
475 
476  // Optional 3: Do what is done in the child optimizer
477  if (mp_Optimizer->DataStep6Optional( ap_Line, ap_Event, a_bed, a_timeFrame, a_respGate, a_cardGate, a_iteration, a_thread ))
478  {
479  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occured while performing optional step 3 !" << endl);
480  return 1;
481  }
482 
483  // Mandatory 4: Backproject correction terms
484  if (mp_Optimizer->DataStep7BackwardProjectCorrections( ap_Line, ap_Event, a_bed, a_timeFrame, a_respGate, a_cardGate, a_thread ))
485  {
486  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occured while backward projecting the correction !" << endl);
487  return 1;
488  }
489 
490  // Compute FOM is asked for
491  if (m_optimizerFOMFlag && mp_Optimizer->DataStep8ComputeFOM( ap_Line, ap_Event, a_timeFrame, a_respGate, a_cardGate, a_thread ))
492  {
493  Cerr("***** oOptimizerManager::DataUpdateStep() -> An error occured while computing FOMs !" << endl);
494  return 1;
495  }
496 
497  // End
498  return 0;
499 }
500 
501 // =====================================================================
502 // ---------------------------------------------------------------------
503 // ---------------------------------------------------------------------
504 // =====================================================================
505 
506 int oOptimizerManager::ImageUpdateStep(int a_iteration, int a_nbSubsets)
507 {
508  // Verbose
509  if (m_verbose>=2) Cout("oOptimizerManager::ImageUpdateStep() -> Proceed to image update" << endl);
510 
511  // Update visited voxels
513  {
514  Cerr("***** oOptimizerManager::ImageUpdateStep() -> Problem while updating visited voxels !" << endl);
515  return 1;
516  }
517 
518  // Manage penalty computation
519  if (mp_Penalty!=NULL)
520  {
521  // Loops on frames, etc ...
522  }
523 
524  // Image update step
525  if (mp_Optimizer->ImageUpdateStep( a_iteration, a_nbSubsets ))
526  {
527  Cerr("***** oOptimizerManager::ImageUpdateStep() -> Problem while updating image space !" << endl);
528  return 1;
529  }
530 
531  // End
532  return 1;
533 }
534 
535 // =====================================================================
536 // ---------------------------------------------------------------------
537 // ---------------------------------------------------------------------
538 // =====================================================================
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
virtual int ImageUpdateStep(int a_iteration, int a_nbSubsets)
A public function used to perform the image update step of the optimizer.
Definition: vOptimizer.cc:825
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:59
#define TYPE_PET
Definition: vDataFile.hh:74
#define TYPE_UNKNOWN
Definition: vDataFile.hh:72
#define MODE_LIST
Definition: vDataFile.hh:57
#define FLTNB
Definition: gVariables.hh:81
virtual int DataStep6Optional(oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_iteration, int a_thread)
A public function which does nothing but being virtual.
Definition: vOptimizer.cc:701
void SetFOMFlag(bool a_optimizerFOMFlag)
Set the FOM flag specifying if figures-of-merit will be computed or not.
Definition: vOptimizer.hh:537
virtual int ReadConfigurationFile(const string &a_configurationFile)=0
A function used to read options from a configuration file.
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
Set the pointer to the image dimensions in use.
Definition: vOptimizer.hh:487
virtual FLTNB GetMultiplicativeCorrections()=0
This is a pure virtual function implemented in the child classes.
virtual int DataStep4Optional(oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_iteration, int a_thread)
A public function which does nothing but being virtual.
Definition: vOptimizer.cc:652
static sOutputManager * GetInstance()
Instanciate the singleton object and Initialize member variables if not already done, return a pointer to this object otherwise.
int PostDataUpdateStep(int a_iteration, int a_nbIterations, int a_subset, int *ap_nbSubsets)
A public function used to do stuff that need to be done at the beginning of a subset (before the data...
Definition: vOptimizer.cc:442
#define TYPE_SPECT
Definition: vDataFile.hh:76
#define TYPE_CT
Definition: vDataFile.hh:78
oImageSpace * mp_ImageSpace
virtual int ReadOptionsList(const string &a_optionsList)=0
A function used to read options from a list of options.
int Initialize()
A function used to initialize the manager and the optimizer it manages.
int PostDataUpdateStep(int a_iteration, int a_nbIterations, int a_subset, int *ap_nbSubsets)
A function that simply calls the eponym function from the vOptimizer.
int GetDataMode()
Definition: vEvent.hh:132
void SetNbTOFBins(int a_nbTOFBins)
Set the number of TOF bins in use.
Definition: vOptimizer.hh:501
static sAddonManager * GetInstance()
std::map< string, maker_optimizer > mp_listOfOptimizers
void SetDataType(int a_dataType)
Set the data type in use.
Definition: vOptimizer.hh:515
int ParseOptionsAndInitializeOptimizerAndPenalty()
#define Cerr(MESSAGE)
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:612
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:519
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...
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:769
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:544
#define SPEC_UNKNOWN
Definition: vDataFile.hh:89
int CheckParameters()
A function used to check the parameters settings.
#define SPEC_TRANSMISSION
Definition: vDataFile.hh:93
int ImageUpdateStep(int a_iteration, int a_nbSubsets)
A function dedicated to the update step in the image space (performed after the loop on events) ...
int DataUpdateStep(oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_iteration, int a_thread)
A function dedicated to the update step in the data space (for each event inside the loop) ...
void SetDataSpec(int a_dataSpec)
Set the data physical specificity in use.
Definition: vOptimizer.hh:522
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:530
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:322
Declaration of class sOutputManager.
Mother class for the Event objects.
Definition: vEvent.hh:43
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:665
#define SPEC_EMISSION
Definition: vDataFile.hh:91
int PreDataUpdateStep(int a_iteration, int a_nbIterations, int a_subset, int *ap_nbSubsets)
A public function used to do stuff that need to be done at the beginning of a subset (before the data...
Definition: vOptimizer.cc:400
int PreDataUpdateStep(int a_iteration, int a_nbIterations, int a_subset, int *ap_nbSubsets)
A function that simply calls the eponym function from the vOptimizer.
virtual int DataStep2Optional(oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_iteration, int a_thread)
A public function which does nothing but being virtual.
Definition: vOptimizer.cc:599
oOptimizerManager()
The constructor of oOptimizerManager.
int UpdateVisitedVoxels()
A public function used to update the 'visited' voxels after each subset.
Definition: vOptimizer.cc:797
Declaration of class oOptimizerManager.
#define MODE_UNKNOWN
Definition: vDataFile.hh:55
#define Cout(MESSAGE)
void SetVerbose(int a_verbose)
Set the verbose level.
Definition: vOptimizer.hh:480
FLTNB **** m4p_attenuation
Definition: oImageSpace.hh:137
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:714
void SetDataMode(int a_dataMode)
Set the data mode in use.
Definition: vOptimizer.hh:508
int CheckParameters()
A public function used to check the parameters settings.
Definition: vOptimizer.cc:227
Declaration of class sAddonManager.
void SetImageSpace(oImageSpace *ap_ImageSpace)
Set the pointer to the image space in use.
Definition: vOptimizer.hh:494