88 Cerr(
"***** oOptimizerManager::CheckParameters() -> No image dimensions provided !" << endl);
94 Cerr(
"***** oOptimizerManager::CheckParameters() -> No image space provided !" << endl);
100 Cerr(
"***** oOptimizerManager::CheckParameters() -> No or meaningless data mode provided !" << endl);
106 Cerr(
"***** oOptimizerManager::CheckParameters() -> No or meaningless data type provided !" << endl);
112 Cerr(
"***** oOptimizerManager::CheckParameters() -> No or meaningless data specificity provided (emission or transmission) !" << endl);
118 Cerr(
"***** oOptimizerManager::CheckParameters() -> No optimizer options provided !" << endl);
124 Cerr(
"***** oOptimizerManager::CheckParameters() -> Wrong verbosity level provided !" << endl);
139 if (
m_verbose>=1)
Cout(
"oOptimizerManager::Initialize() -> Initialize optimizer and penalty" << endl);
144 Cerr(
"***** oOptimizerManager::Initialize() -> A problem occurred while parsing optimizer options and initializing it !" << endl);
163 string name_optimizer =
"";
164 string list_options_optimizer =
"";
165 string file_options_optimizer =
"";
176 Cerr(
"***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> No optimizer provided !" << endl);
185 if (colon!=string::npos)
192 list_options_optimizer =
"";
195 else if (comma!=string::npos)
202 file_options_optimizer =
"";
210 list_options_optimizer =
"";
213 file_options_optimizer = p_output_manager->
GetPathToConfigDir() +
"/optimizer/" + name_optimizer +
".conf";
222 if (list_optimizer[name_optimizer])
mp_Optimizer = list_optimizer[name_optimizer]();
225 Cerr(
"***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> Optimizer '" << name_optimizer <<
"' does not exist !" << endl);
242 Cerr(
"***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while reading and checking optimizer's configuration file !" << endl);
248 Cerr(
"***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while parsing and reading optimizer's options !" << endl);
254 Cerr(
"***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while checking optimizer parameters !" << endl);
262 string name_penalty =
"";
263 string list_options_penalty =
"";
264 string file_options_penalty =
"";
267 typedef vPenalty *(*maker_penalty) ();
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);
287 if (colon!=string::npos)
294 list_options_penalty =
"";
297 else if (comma!=string::npos)
304 file_options_penalty =
"";
312 list_options_penalty =
"";
315 file_options_penalty = p_output_manager->
GetPathToConfigDir() +
"/optimizer/" + name_penalty +
".conf";
322 if (list_penalty[name_penalty])
mp_Penalty = list_penalty[name_penalty]();
325 Cerr(
"***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> Penalty '" << name_penalty <<
"' does not exist !" << endl);
338 Cerr(
"***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while reading and checking penalty's configuration file !" << endl);
344 Cerr(
"***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while parsing and reading penalty's options !" << endl);
350 Cerr(
"***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while checking penalty parameters !" << endl);
356 Cerr(
"***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while initializing the penalty !" << endl);
362 Cerr(
"***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> Derivatives order allowed by chosen penalty is not compatible with the order required by the optimizer !" << endl);
372 Cerr(
"***** oOptimizerManager::ParseOptionsAndInitializeOptimizerAndPenalty() -> A problem occurred while initializing the optimizer !" << endl);
390 Cerr(
"***** oOptimizerManager::PreDataUpdateStep() -> A problem occurred while applying the pre-data-update step to the optimizer !" << endl);
407 Cerr(
"***** oOptimizerManager::PreImageUpdateStep() -> A problem occurred while applying the pre-image-update step to the optimizer !" << endl);
420 int a_bed,
int a_timeFrame,
int a_respGate,
int a_cardGate,
431 if (multiplicative_correction<=0.)
return 0;
451 Cerr(
"***** oOptimizerManager::DataUpdateStep() -> An error occurred while forward projecting !" << endl);
458 Cerr(
"***** oOptimizerManager::DataUpdateStep() -> An error occurred while performing optional step 1 !" << endl);
466 Cerr(
"***** oOptimizerManager::DataUpdateStep() -> An error occurred while backward projecting the sensitivity !" << endl);
473 Cerr(
"***** oOptimizerManager::DataUpdateStep() -> An error occurred while performing optional step 2 !" << endl);
480 Cerr(
"***** oOptimizerManager::DataUpdateStep() -> An error occurred while computing correction terms !" << endl);
487 Cerr(
"***** oOptimizerManager::DataUpdateStep() -> An error occurred while performing optional step 3 !" << endl);
494 Cerr(
"***** oOptimizerManager::DataUpdateStep() -> An error occurred while backward projecting the correction !" << endl);
501 Cerr(
"***** oOptimizerManager::DataUpdateStep() -> An error occurred while computing FOMs !" << endl);
517 if (
m_verbose>=2)
Cout(
"oOptimizerManager::ImageUpdateStep() -> Proceed to image update" << endl);
521 Cerr(
"***** oOptimizerManager::ImageUpdateStep() -> Problem while updating visited voxels !" << endl);
527 Cerr(
"***** oOptimizerManager::ImageUpdateStep() -> Problem while updating image space !" << endl);
void SetOptimizerID(const string &a_optimizerID)
Set the optimizer ID.
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
void SetPenaltyStrength(FLTNB a_penaltyStrength)
Set the penalty strength.
void SetMultiplicativeCorrection(FLTNB a_multiplicativeCorrection)
This function is used to set the multiplicative correction to be applied during forward and backward ...
bool GetNeedGlobalSensitivity()
Get the boolean saying if the sensitivity has to be computed globally for all data channels and not p...
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.
void SetFOMFlag(bool a_optimizerFOMFlag)
Set the FOM flag specifying if figures-of-merit will be computed or not.
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.
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
Set the pointer to the image dimensions in use.
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.
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...
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 Initialize()
A public function used to initialize the penalty.
void SetNbTOFBins(int a_nbTOFBins)
Set the number of TOF bins in use.
static sAddonManager * GetInstance()
std::map< string, maker_optimizer > mp_listOfOptimizers
void SetDataType(int a_dataType)
Set the data type in use.
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.
bool m_optimizerImageStatFlag
int ParseOptionsAndInitializeOptimizerAndPenalty()
int GetRequiredPenaltyDerivativesOrder()
Get the penalty derivative order needed for this algorithm.
bool GetAcceptPenalty()
Get the boolean saying if the optimizer accepts penalties.
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.
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.
void SetPenaltyID(const string &a_penaltyID)
Set the penalty ID.
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.
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.
void SetImageStatFlag(bool a_optimizerImageStatFlag)
Set the image stat flag specifying if basic statistics about image udpate will be computed or not...
void SetPenalty(vPenalty *ap_penalty)
Set the penalty of the optimizer.
void SetImageSpace(oImageSpace *ap_ImageSpace)
Set the pointer to the image space in use.
int CheckParameters()
A function used to check the parameters settings.
void SetVerbose(int a_verbose)
Set the verbose level.
int GetPenaltyDerivativesOrder()
Get the penalty deratives order.
#define SPEC_TRANSMISSION
int CheckParameters()
A public function used to check the parameters settings.
void SetDataSpec(int a_dataSpec)
Set the data physical specificity in use.
int PreImageUpdateStep()
A public function used to do stuff that need to be done between the loop over events and the image up...
This class is designed to generically described any iterative optimizer.
void SetAttenuationImage(FLTNB *ap_attenuationImage, int a_thread)
Set the attenuation image corresponding to the current thread and current event.
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.
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.
Declaration of class sOutputManager.
Mother class for the Event objects.
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...
std::map< string, maker_penalty > mp_listOfPenalties
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
Set the pointer to the image dimensions in use.
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 'visited' voxels after each subset.
Declaration of class oOptimizerManager.
void SetVerbose(int a_verbose)
Set the verbose level.
FLTNB **** m4p_attenuation
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...
string m_optionsOptimizer
void SetDataMode(int a_dataMode)
Set the data mode in use.
int CheckParameters()
A public function used to check the parameters settings.
Declaration of class sAddonManager.
void SetImageSpace(oImageSpace *ap_ImageSpace)
Set the pointer to the image space in use.