8 #include "iOptimizerMLEM.hh" 9 #include "sOutputManager.hh" 58 cout <<
"This optimizer is the standard MLEM (for Maximum Likelihood Expectation Maximization)." << endl;
59 cout <<
"It is numerically implemented in the multiplicative form (as opposed to the gradient form)." << endl;
60 cout <<
"It truncates negative data to 0 to satisfy the positivity constraint." << endl;
61 cout <<
"If subsets are used, it naturally becomes the OSEM optimizer." << endl;
62 cout <<
"With transmission data, the log-converted pre-corrected data are used as in J. Nuyts et al: \"Iterative reconstruction" << endl;
63 cout <<
"for helical CT: a simulation study\", Phys. Med. Biol., vol. 43, pp. 729-737, 1998." << endl;
64 cout <<
"The following options can be used (in this particular order when provided as a list):" << endl;
65 cout <<
" initial image value: to set the uniform voxel value for the initial image" << endl;
66 cout <<
" denominator threshold: to set the threshold of the data space denominator under which the ratio is set to 1" << endl;
67 cout <<
" minimum image update: to set the minimum of the image update factor under which it stays constant (0 or a negative value" << endl;
68 cout <<
" means no minimum thus allowing a 0 update)" << endl;
69 cout <<
" maximum image update: to set the maximum of the image update factor over which it stays constant (0 or a negative value means" << endl;
70 cout <<
" no maximum)" << endl;
82 key_word =
"initial image value";
85 Cerr(
"***** iOptimizerMLEM::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
89 key_word =
"denominator threshold";
92 Cerr(
"***** iOptimizerMLEM::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
96 key_word =
"minimum image update";
99 Cerr(
"***** iOptimizerMLEM::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
103 key_word =
"maximum image update";
106 Cerr(
"***** iOptimizerMLEM::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
121 const int nb_options = 4;
122 FLTNB options[nb_options];
124 if (
ReadStringOption(a_optionsList, options, nb_options,
",",
"MLEM configuration"))
126 Cerr(
"***** iOptimizerMLEM::ReadOptionsList() -> Failed to correctly read the list of options !" << endl);
148 Cerr(
"***** iOptimizerMLEM->CheckSpecificParameters() -> Provided initial image value (" <<
m_initialValue <<
") must be strictly positive !" << endl);
154 Cerr(
"***** iOptimizerMLEM->CheckSpecificParameters() -> Provided data space denominator threshold (" <<
m_dataSpaceDenominatorThreshold <<
") must be strictly positive !" << endl);
166 Cerr(
"***** iOptimizerMLEM->CheckSpecificParameters() -> Cannot reconstruct list-mode transmission data !" << endl);
183 Cout(
"iOptimizerMLEM::InitializeSpecific() -> Use the MLEM optimizer" << endl);
189 else Cerr(
"!!!!! The minimum update value is not set, if using subsets, voxels could be trapped in 0 value causing some negative bias !" << endl);
203 FLTNB a_multiplicativeCorrections,
FLTNB a_additiveCorrections,
FLTNB a_blankValue,
218 FLTNB a_multiplicativeCorrections,
FLTNB a_additiveCorrections,
FLTNB a_blankValue,
225 if (a_data<0.) a_data = 0.;
228 else *ap_backwardValues = 1.;
234 a_data -= a_additiveCorrections;
235 a_forwardModel -= a_additiveCorrections;
239 if (a_data<1. || a_forwardModel<1. || a_data>a_blankValue || a_forwardModel>a_blankValue)
241 *ap_backwardValues = 1.;
245 a_data = log(a_blankValue/a_data);
246 a_forwardModel = log(a_blankValue/a_forwardModel);
249 else *ap_backwardValues = 1.;
261 FLTNB a_sensitivity,
FLTNB* ap_correctionValues,
262 INTNB a_voxel,
int a_tbf,
int a_rbf,
int a_cbf )
265 FLTNB image_update_factor = *ap_correctionValues / a_sensitivity;
271 *ap_newImageValue = a_currentImageValue * image_update_factor;
FLTNB m_dataSpaceDenominatorThreshold
int ImageSpaceSpecificOperations(FLTNB a_currentImageValue, FLTNB *ap_newImageValue, FLTNB a_sensitivity, FLTNB *ap_correctionValues, INTNB a_voxel, int a_tbf=-1, int a_rbf=-1, int a_cbf=-1)
int ReadStringOption(const string &a_input, T *ap_return, int a_nbElts, const string &sep, const string &a_option)
Parse the 'a_input' string corresponding to the 'a_option' into 'a_nbElts' elements, using the 'sep' separator. The results are returned in the templated 'ap_return' dynamic templated array. Call "ConvertFromString()" to perform the correct conversion depending on the type of the data to convert.
bool m_listmodeCompatibility
int ReadOptionsList(const string &a_optionsList)
int DataSpaceSpecificOperations(FLTNB a_data, FLTNB a_forwardModel, FLTNB *ap_backwardValues, FLTNB a_multiplicativeCorrections, FLTNB a_additiveCorrections, FLTNB a_blankValue, FLTNB a_quantificationFactor, oProjectionLine *ap_Line)
int CheckSpecificParameters()
A private function used to check the parameters settings specific to the child optimizer.
int InitializeSpecific()
This function is used to initialize specific stuff to the child optimizer.
bool m_emissionCompatibility
bool m_histogramCompatibility
iOptimizerMLEM()
The constructor of iOptimizerMLEM.
#define KEYWORD_MANDATORY
#define SPEC_TRANSMISSION
FLTNB m_maximumImageUpdateFactor
bool m_transmissionCompatibility
This class is designed to generically described any iterative optimizer.
This class is designed to manage and store system matrix elements associated to a vEvent...
~iOptimizerMLEM()
The destructor of iOptimizerMLEM.
int ReadConfigurationFile(const string &a_configurationFile)
FLTNB m_minimumImageUpdateFactor
int SensitivitySpecificOperations(FLTNB a_data, FLTNB a_forwardModel, FLTNB *ap_weight, FLTNB a_multiplicativeCorrections, FLTNB a_additiveCorrections, FLTNB a_blankValue, FLTNB a_quantificationFactor, oProjectionLine *ap_Line)
void ShowHelpSpecific()
A function used to show help about the child optimizer.
int ReadDataASCIIFile(const string &a_file, const string &a_keyword, T *ap_return, int a_nbElts, bool a_mandatoryFlag)
Look for "a_nbElts" elts in the "a_file" file matching the "a_keyword" string passed as parameter a...