111 cout <<
"This optimizer is the Block Sequential Regularized Expectation Maximization (BSREM) algorithm from S. Ahn and" << endl;
112 cout <<
"J. Fessler, IEEE TMI, May 2003, vol. 22, pp. 613-626. Its abbreviated name in this paper is BSREM-II." << endl;
113 cout <<
"This algorithm is the only one to have proven convergence using subsets. Its implementation is entirely based" << endl;
114 cout <<
"on the reference paper. It may have numerical problems when a full field-of-view is used, because of the sharp" << endl;
115 cout <<
"sensitivity loss at the edges of the cylindrical field-of-view. As it is simply based on the gradient, penalty" << endl;
116 cout <<
"terms must have a derivative order of at least one. Without penalty, it reduces to OSEM but where the sensitivity" << endl;
117 cout <<
"is not dependent on the current subset. This is a requirement of the algorithm, explaining why it starts by" << endl;
118 cout <<
"computing the global sensitivity before going through iterations. The algorithm is restricted to histograms." << endl;
119 cout <<
"The following options can be used:" << endl;
120 cout <<
" initial image value: to set the uniform voxel value for the initial image" << endl;
121 cout <<
" minimum image value: to set the minimum allowed image value (parameter 't' in the reference paper)" << endl;
122 cout <<
" maximum image value: to set the maximum allowed image value (parameter 'U' in the reference paper)" << endl;
123 cout <<
" relaxation factor type: type of relaxation factors (can be one of the following: 'classic')" << endl;
124 cout <<
"Relaxation factors of type 'classic' correspond to what was proposed in the reference paper in equation (31)." << endl;
125 cout <<
"This equation gives: alpha_n = alpha_0 / (gamma * iter_num + 1)" << endl;
126 cout <<
"The iteration number 'iter_num' is supposed to start at 0 so that for the first iteration, alpha_0 is used." << endl;
127 cout <<
"This parameter can be provided using the following keyword: 'relaxation factor classic initial value'." << endl;
128 cout <<
"The 'gamma' parameter can be provided using the following keyword: 'relaxation factor classic step size'." << endl;
138 string key_word =
"";
142 key_word =
"initial image value";
145 Cerr(
"***** iOptimizerBSREM::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
149 key_word =
"minimum image value";
152 Cerr(
"***** iOptimizerBSREM::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
156 key_word =
"maximum image value";
159 Cerr(
"***** iOptimizerBSREM::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
164 key_word =
"relaxation factor type";
167 Cerr(
"***** iOptimizerBSREM::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
170 if (buffer ==
"classic")
174 key_word =
"relaxation factor classic initial value";
177 Cerr(
"***** iOptimizerBSREM::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
181 key_word =
"relaxation factor classic step size";
184 Cerr(
"***** iOptimizerBSREM::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
190 Cerr(
"***** iOptimizerBSREM::ReadConfigurationFile() -> Provided type of the relaxation factors (" << buffer <<
") is not recognized" << endl);
207 const int nb_options = 5;
208 FLTNB options[nb_options];
210 if (
ReadStringOption(a_optionsList, options, nb_options,
",",
"BSREM configuration"))
212 Cerr(
"***** iOptimizerBSREM::ReadOptionsList() -> Failed to correctly read the list of options !" << endl
213 <<
" Note: if you are not using the classic relaxation, you must for now use the configuration file" << endl);
237 Cerr(
"***** iOptimizerBSREM::CheckSpecificParameters() -> Should provide a relaxation factor type !" << endl);
243 Cerr(
"***** iOptimizerBSREM::CheckSpecificParameters() -> Provided initial image value (" <<
m_initialValue <<
") must be strictly positive !" << endl);
249 Cerr(
"***** iOptimizerBSREM::CheckSpecificParameters() -> Provided minimum image value (" <<
m_minimumImageValue <<
") must be strictly positive ! !" << endl);
255 Cerr(
"***** iOptimizerBSREM::CheckSpecificParameters() -> Provided maximum image value (" <<
m_maximumImageValue <<
") must be positive and superior to twice the minimum image value !" << endl);
264 Cerr(
"***** iOptimizerBSREM::CheckSpecificParameters() -> Provided relaxation factors initial value (" <<
m_relaxationFactorInitialValue <<
") must be strictly positive ! !" << endl);
270 Cerr(
"***** iOptimizerBSREM::CheckSpecificParameters() -> Provided relaxation factors step size (" <<
m_relaxationFactorInitialValue <<
") must be strictly positive ! !" << endl);
308 Cout(
"iOptimizerBSREM::InitializeSpecific() -> Use the BSREM optimizer" << endl);
316 Cout(
" --> Relaxation factors type: classic" << endl);
322 Cerr(
"***** iOptimizerBSREM::InitializeSpecific() -> Provided relaxation factors type (" <<
m_relaxationFactorType <<
") is not recognized !" << endl);
346 if (
m_verbose>=1)
Cout(
"iOptimizerBSREM::PreImageUpdateSpecificStep() -> Compute penalty term" << endl);
351 Cerr(
"***** iOptimizerBSREM::PreImageUpdateSpecificStep() -> A problem occurred while computing the penalty pre-processing step !" << endl);
365 bool problem =
false;
369 #pragma omp parallel for private(v) schedule(guided) 375 th = omp_get_thread_num();
380 Cerr(
"***** iOptimizerBSREM::PreImageUpdateSpecificStep() -> A problem occurred while computing the penalty local pre-processing step for voxel " << v <<
" !" << endl);
389 Cerr(
"***** iOptimizerBSREM::PreImageUpdateSpecificStep() -> A problem occurred inside the multi-threaded loop, stop now !" << endl);
406 Cerr(
"***** iOptimizerBSREM::PostDataUpdateSpecificStep -> Unknown relaxation factors type (" <<
m_relaxationFactorType <<
") !" << endl);
420 FLTNB a_multiplicativeCorrections,
FLTNB a_additiveCorrections,
FLTNB a_blankValue,
435 FLTNB a_multiplicativeCorrections,
FLTNB a_additiveCorrections,
FLTNB a_blankValue,
439 FLTNB numerator = a_data - a_forwardModel;
441 if (a_forwardModel==0.) *ap_backwardValues = 0.;
443 else *ap_backwardValues = numerator / a_forwardModel;
454 FLTNB a_sensitivity,
FLTNB* ap_correctionValues,
455 INTNB a_voxel,
int a_tbf,
int a_rbf,
int a_cbf )
461 if (*ap_correctionValues==0.)
return 0;
473 *ap_newImageValue = ((
HPFLTNB)a_currentImageValue) + image_update_factor;
void ShowHelpSpecific()
A function used to show help about the child optimizer.
iOptimizerBSREM()
The constructor of iOptimizerBSREM.
int m_requiredPenaltyDerivativesOrder
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)
This function performs the image update step specific to the optimizer.
int GetNbCardBasisFunctions()
Get the number of cardiac basis functions.
int ReadOptionsList(const string &a_optionsList)
A function used to read options from a list of options.
#define BSREM_RELAXATION_CLASSIC
bool m_listmodeCompatibility
HPFLTNB m_relaxationFactorStepSize
HPFLTNB m_maximumImageValue
HPFLTNB m_relaxationFactorInitialValue
int ReadConfigurationFile(const string &a_configurationFile)
A function used to read options from a configuration file.
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
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.
int GetNbTimeBasisFunctions()
Get the number of time basis functions.
int CheckSpecificParameters()
A private function used to check the parameters settings specific to the child optimizer.
Declaration of class iOptimizerBSREM.
FLTNB **** m4p_firstDerivativePenaltyImage
int InitializeSpecific()
This function is used to initialize specific stuff to the child optimizer.
bool m_needGlobalSensitivity
bool m_emissionCompatibility
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)
This function compute the weight associated to the provided event (for sensitivity computation) ...
virtual int GlobalPreProcessingStep()
A public function computing a global pre-processing step for the penalty.
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...
bool m_histogramCompatibility
#define BSREM_NOT_DEFINED
HPFLTNB m_minimumImageValue
#define KEYWORD_MANDATORY
HPFLTNB m_relaxationFactor
~iOptimizerBSREM()
The destructor of iOptimizerBSREM.
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...
int m_relaxationFactorType
Declaration of class sOutputManager.
oImageSpace * mp_ImageSpace
int GetNbThreadsForImageComputation()
Get the number of threads used for image operations.
INTNB GetNbVoxXYZ()
Get the total number of voxels.
int PreImageUpdateSpecificStep()
A private function used to compute the penalty term of the BSREM algorithm.
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)
This function performs the data space operations specific to the optimizer (computes the values to be...
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.
int GetNbRespBasisFunctions()
Get the number of respiratory basis functions.
virtual FLTNB ComputeFirstDerivative(int a_tbf, int a_rbf, int a_cbf, INTNB a_voxel, int a_th)=0
A public function computing the derivative of the penalty.