9 #include "sOutputManager.hh" 10 #include "iDataFilePET.hh" 59 cout <<
"This optimizer is a modified MLEM algorithm where the image voxel values are attenuation factors" << endl;
60 cout <<
"and the data are taken as the logarithm of ACF values associated to PET histogram data." << endl;
61 cout <<
"It is numerically implemented in the multiplicative form (as opposed to the gradient form)." << endl;
62 cout <<
"It truncates ACF lower than 1 to 1 to satisfy the positivity constraint." << endl;
63 cout <<
"Note that although physicists are used to attenuation values in 1/cm, the reconstructed image units" << endl;
64 cout <<
"are 1/mm as the whole castor code is using mm." << endl;
65 cout <<
"Subsets can be used." << endl;
66 cout <<
"The following options can be used (in this particular order when provided as a list):" << endl;
67 cout <<
" initial image value: to set the uniform voxel value for the initial image" << endl;
68 cout <<
" denominator threshold: to set the threshold of the data space denominator under which the ratio is set to 1" << endl;
69 cout <<
" minimum image update: to set the minimum of the image update factor under which it stays constant (0 or a negative value" << endl;
70 cout <<
" means no minimum thus allowing a 0 update)" << endl;
71 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;
72 cout <<
" no maximum)" << endl;
84 key_word =
"initial image value";
87 Cerr(
"***** iOptimizerMLMuMap::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
91 key_word =
"denominator threshold";
94 Cerr(
"***** iOptimizerMLMuMap::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
98 key_word =
"minimum image update";
101 Cerr(
"***** iOptimizerMLMuMap::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
105 key_word =
"maximum image update";
108 Cerr(
"***** iOptimizerMLMuMap::ReadConfigurationFile() -> Failed to get the '" << key_word <<
"' keyword !" << endl);
123 const int nb_options = 4;
124 FLTNB options[nb_options];
126 if (
ReadStringOption(a_optionsList, options, nb_options,
",",
"MLEM configuration"))
128 Cerr(
"***** iOptimizerMLMuMap::ReadOptionsList() -> Failed to correctly read the list of options !" << endl);
150 Cerr(
"***** iOptimizerMLMuMap->CheckSpecificParameters() -> Provided initial image value (" <<
m_initialValue <<
") must be strictly positive !" << endl);
156 Cerr(
"***** iOptimizerMLMuMap->CheckSpecificParameters() -> Provided data space denominator threshold (" <<
m_dataSpaceDenominatorThreshold <<
") must be strictly positive !" << endl);
168 Cerr(
"***** iOptimizerMLMuMap->CheckSpecificParameters() -> Can only reconstruct ACF from PET histogram data !" << endl);
172 if (!(dynamic_cast<iDataFilePET*>(
mp_DataFile))->GetAtnCorrectionFlag())
174 Cerr(
"***** iOptimizerMLMuMap->CheckSpecificParameters() -> ACF must be provided into the PET histogram data !" << endl);
208 Cerr(
"***** oOptimizerMLMuMap->InitializeSpecific() -> A problem occured while reseting the quantification factors !" << endl);
214 Cout(
"iOptimizerMLMuMap::InitializeSpecific() -> Use the MLEM optimizer" << endl);
220 else Cerr(
"!!!!! The minimum update value is not set, if using subsets, voxels could be trapped in 0 value causing some negative bias !" << endl);
234 FLTNB a_multiplicativeCorrections,
FLTNB a_additiveCorrections,
FLTNB a_blankValue,
238 *ap_weight = a_multiplicativeCorrections;
249 FLTNB a_multiplicativeCorrections,
FLTNB a_additiveCorrections,
FLTNB a_blankValue,
262 int a_bed,
int a_timeFrame,
int a_respGate,
int a_cardGate,
272 FLTNB acf = (
dynamic_cast<iEventPET*
>(ap_Event))->GetAtnCorrFactor();
276 if (acf<1.) acf = 1.;
292 FLTNB a_sensitivity,
FLTNB* ap_correctionValues,
293 INTNB a_voxel,
int a_tbf,
int a_rbf,
int a_cbf )
296 FLTNB image_update_factor = *ap_correctionValues / a_sensitivity;
302 *ap_newImageValue = a_currentImageValue * image_update_factor;
int CheckSpecificParameters()
A private function used to check the parameters settings specific to the child optimizer.
~iOptimizerMLMuMap()
The destructor of iOptimizerMLMuMap.
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 DataStep5ComputeCorrections(oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
Overload of the vOptimizer function. See implementation for more details.
bool m_listmodeCompatibility
void SetIgnoreNormCorrectionFlag(bool a_ignoreNormCorrectionFlag)
Set the boolean m_ignoreNormCorrectionFlag to a_ignoreNormCorrectionFlag.
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 perform the image update step specific to the optimizer.
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
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) ...
int ReadOptionsList(const string &a_optionsList)
A function used to read options from a list of options.
void ShowHelpSpecific()
A function used to show help about the child optimizer.
void SetIgnoreScatCorrectionFlag(bool a_ignoreScatCorrectionFlag)
Set the boolean m_ignoreScatCorrectionFlag to a_ignoreScatCorrectionFlag.
int ResetQuantificationFactors()
If already initialized, set the quantification factors to 1.
FLTNB ** m2p_forwardValues
FLTNB *** m3p_backwardValues
bool m_emissionCompatibility
FLTNB m_dataSpaceDenominatorThreshold
FLTNB m_maximumImageUpdateFactor
bool m_histogramCompatibility
void SetIgnoreFdurCorrectionFlag(bool a_ignoreFdurCorrectionFlag)
Set the boolean m_ignoreFdurCorrectionFlag to a_ignoreFdurCorrectionFlag.
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...
void SetIgnoreBratCorrectionFlag(bool a_ignoreBratCorrectionFlag)
Set the boolean m_ignoreBratCorrectionFlag to a_ignoreBratCorrectionFlag.
#define KEYWORD_MANDATORY
FLTNB m_minimumImageUpdateFactor
Inherit from vEvent. Main PET class for the Event objects.
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...
void SetIgnoreCaliCorrectionFlag(bool a_ignoreCaliCorrectionFlag)
Set the boolean m_ignoreCaliCorrectionFlag to a_ignoreCaliCorrectionFlag.
void SetIgnoreRandCorrectionFlag(bool a_ignoreRandCorrectionFlag)
Set the boolean m_ignoreRandCorrectionFlag to a_ignoreRandCorrectionFlag.
int InitializeSpecific()
This function is used to initialize specific stuff to the child optimizer.
Mother class for the Event objects.
void SetIgnoreDecaCorrectionFlag(bool a_ignoreDecaCorrectionFlag)
Set the boolean m_ignoreDecaCorrectionFlag to a_ignoreDecaCorrectionFlag.
iOptimizerMLMuMap()
The constructor of iOptimizerMLMuMap.
Declaration of class iOptimizerMLMuMap.
void SetCurrentTOFBin(int a_TOFBin)
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...
Inherit from vDataFile. Class that manages the reading of a PET input file (header + data)...
int ReadConfigurationFile(const string &a_configurationFile)
A function used to read options from a configuration file.