CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
Public Member Functions | Private Member Functions | Private Attributes | List of all members
iOptimizerMLEM Class Reference

This class implements the Maximum Likelihood Expectation Maximization algorithm. More...

#include <iOptimizerMLEM.hh>

Inheritance diagram for iOptimizerMLEM:
Inheritance graph
Collaboration diagram for iOptimizerMLEM:
Collaboration graph

Public Member Functions

 iOptimizerMLEM ()
 The constructor of iOptimizerMLEM. More...
 
 ~iOptimizerMLEM ()
 The destructor of iOptimizerMLEM. More...
 
int ReadConfigurationFile (const string &a_configurationFile)
 
int ReadOptionsList (const string &a_optionsList)
 
 iOptimizerMLEM ()
 
 ~iOptimizerMLEM ()
 
int ReadConfigurationFile (const string &a_configurationFile)
 
int ReadOptionsList (const string &a_optionsList)
 
- Public Member Functions inherited from vOptimizer
 vOptimizer ()
 The constructor of vOptimizer. More...
 
virtual ~vOptimizer ()
 The destructor of vOptimizer. More...
 
void ShowHelp ()
 A function used to show help about the optimizer. More...
 
int CheckParameters ()
 A public function used to check the parameters settings. More...
 
int Initialize ()
 A public function used to initialize the optimizer. More...
 
int UpdateVisitedVoxels ()
 A public function used to update the 'visited' voxels after each subset. More...
 
int PreDataUpdateStep ()
 A public function used to do stuff that need to be done at the beginning of a subset (before the data update step; i.e. the loop over all events) More...
 
int PreImageUpdateStep ()
 A public function used to do stuff that need to be done between the loop over events and the image update step. More...
 
virtual int DataStep1ForwardProjectModel (oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int DataStep2Optional (oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int DataStep3BackwardProjectSensitivity (oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int DataStep4Optional (oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int DataStep5ComputeCorrections (oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int DataStep6Optional (oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int DataStep7BackwardProjectCorrections (oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int DataStep8ComputeFOM (oProjectionLine *ap_Line, vEvent *ap_Event, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int ImageUpdateStep ()
 A public function used to perform the image update step of the optimizer. More...
 
void SetVerbose (int a_verbose)
 
void SetImageDimensionsAndQuantification (oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
 
void SetImageSpace (oImageSpace *ap_ImageSpace)
 
void SetNbTOFBins (int a_nbTOFBins)
 
void SetDataMode (int a_dataMode)
 
void SetDataType (int a_dataType)
 
void SetDataSpec (int a_dataSpec)
 
void SetAttenuationImage (FLTNB *ap_attenuationImage, int a_thread)
 
void SetFOMFlag (bool a_optimizerFOMFlag)
 
void SetImageStatFlag (bool a_optimizerImageStatFlag)
 
void SetNumbersOfIterationsAndSubsets (int a_nbIterations, int *ap_nbSubsets)
 
void SetCurrentIteration (int a_currentIteration)
 
void SetCurrentSubset (int a_currentSubset)
 
int GetNbBackwardImages ()
 Get the number of backward images used by the specific optimizer. More...
 
FLTNB GetInitialValue ()
 Get the initial image value (for initialization) More...
 
void SetOptimizerID (const string &a_optimizerID)
 
const string & GetOptimizerID ()
 
int GetRequiredPenaltyDerivativesOrder ()
 Get the penalty derivative order needed for this algorithm. More...
 
bool GetAcceptPenalty ()
 Get the boolean saying if the optimizer accepts penalties. More...
 
void SetPenalty (vPenalty *ap_penalty)
 
bool GetNeedGlobalSensitivity ()
 Get the boolean saying if the sensitivity has to be computed globally for all data channels and not per subset. More...
 
 vOptimizer ()
 
virtual ~vOptimizer ()
 
void ShowHelp ()
 
int CheckParameters ()
 
int Initialize ()
 
int UpdateVisitedVoxels ()
 
int PreDataUpdateStep ()
 
int PreImageUpdateStep ()
 
virtual int DataStep1ForwardProjectModel (oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int DataStep2Optional (oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int DataStep3BackwardProjectSensitivity (oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int DataStep4Optional (oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int DataStep5ComputeCorrections (oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int DataStep6Optional (oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int DataStep7BackwardProjectCorrections (oProjectionLine *ap_Line, vEvent *ap_Event, int a_bed, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int DataStep8ComputeFOM (oProjectionLine *ap_Line, vEvent *ap_Event, int a_timeFrame, int a_respGate, int a_cardGate, int a_thread)
 
virtual int ImageUpdateStep ()
 
void SetVerbose (int a_verbose)
 
void SetImageDimensionsAndQuantification (oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
 
void SetImageSpace (oImageSpace *ap_ImageSpace)
 
void SetDataFile (vDataFile *ap_DataFile)
 Set the data file in use. More...
 
void SetNbTOFBins (int a_nbTOFBins)
 
void SetDataMode (int a_dataMode)
 
void SetDataType (int a_dataType)
 
void SetDataSpec (int a_dataSpec)
 
void SetAttenuationImage (FLTNB *ap_attenuationImage, int a_thread)
 
void SetFOMFlag (bool a_optimizerFOMFlag)
 
void SetImageStatFlag (bool a_optimizerImageStatFlag)
 
void SetNumbersOfIterationsAndSubsets (int a_nbSubIterationsTotal, int *ap_nbSubsets)
 
void SetOutputIterations (bool *ap_outputIterations)
 Set the selected output iterations. More...
 
void SetCurrentIteration (int a_currentTotalSubIteration)
 
int GetNbSubIterationsInOneIteration ()
 Get the number of sub iterations in one iteration. More...
 
void SetImageConvolverManager (oImageConvolverManager *ap_ImageConvolverManager)
 Set the Image Convolver Manager Object. More...
 
void SetCurrentSubset (int a_currentSubset)
 
int GetNbBackwardImages ()
 
FLTNB GetInitialValue ()
 
void SetOptimizerID (const string &a_optimizerID)
 
const string & GetOptimizerID ()
 
int GetRequiredPenaltyDerivativesOrder ()
 
bool GetAcceptPenalty ()
 
void SetPenalty (vPenalty *ap_penalty)
 
bool GetNeedGlobalSensitivity ()
 
void EnterPreIteration ()
 Set pre-process flag to true. More...
 
void ExitPreIteration ()
 Set pre-process flag to false. More...
 
bool NeedPreIteration ()
 Say if the optimizer needs a pre-process loop before iterations are done. More...
 
void EnterPostIteration ()
 Set post-process flag to true. More...
 
void ExitPostIteration ()
 Set post-process flag to false. More...
 
bool NeedPostIteration ()
 Say if the optimizer needs a post-process loop after iterations are done. More...
 

Private Member Functions

void ShowHelpSpecific ()
 A function used to show help about the child optimizer. More...
 
int CheckSpecificParameters ()
 A private function used to check the parameters settings specific to the child optimizer. More...
 
int InitializeSpecific ()
 This function is used to initialize specific stuff to the child optimizer. More...
 
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)
 
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 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)
 
void ShowHelpSpecific ()
 A function used to show help about the child module. More...
 
int CheckSpecificParameters ()
 A private function used to check the parameters settings specific to the child optimizer. More...
 
int InitializeSpecific ()
 A private function used to initialize everything specific to the child optimizer. More...
 
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)
 
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 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)
 

Private Attributes

FLTNB m_dataSpaceDenominatorThreshold
 
FLTNB m_minimumImageUpdateFactor
 
FLTNB m_maximumImageUpdateFactor
 

Additional Inherited Members

- Protected Member Functions inherited from vOptimizer
FLTNB ComputeSensitivity (FLTNB ****a4p_sensitivityImage, int a_timeBasisFunction, int a_respBasisFunction, int a_cardBasisFunction, int a_voxel)
 
FLTNB ForwardProject (oProjectionLine *ap_Line, FLTNB *ap_image=NULL)
 
void BackwardProject (oProjectionLine *ap_Line, FLTNB *ap_image, FLTNB a_value)
 
FLTNB ComputeSensitivity (FLTNB ****a4p_sensitivityImage, int a_timeBasisFunction, int a_respBasisFunction, int a_cardBasisFunction, int a_voxel)
 
FLTNB ForwardProject (oProjectionLine *ap_Line, FLTNB *ap_image=NULL)
 
void BackwardProject (oProjectionLine *ap_Line, FLTNB *ap_image, FLTNB a_value)
 
- Protected Attributes inherited from vOptimizer
string m_optimizerID
 
int m_verbose
 
int m_nbBackwardImages
 
int m_nbTOFBins
 
FLTNB ** m2p_forwardValues
 
FLTNB *** m3p_backwardValues
 
FLTNB m_initialValue
 
bool m_listmodeCompatibility
 
bool m_histogramCompatibility
 
bool m_emissionCompatibility
 
bool m_transmissionCompatibility
 
oImageDimensionsAndQuantificationmp_ImageDimensionsAndQuantification
 
oImageSpacemp_ImageSpace
 
int m_dataMode
 
int m_dataType
 
int m_dataSpec
 
FLTNB ** m2p_attenuationImage
 
int m_nbIterations
 
int * mp_nbSubsets
 
int m_currentIteration
 
int m_currentSubset
 
bool m_optimizerFOMFlag
 
HPFLTNB **** m4p_FOMLogLikelihood
 
HPFLTNB **** m4p_FOMRMSE
 
uint64_t **** m4p_FOMNbBins
 
HPFLTNB **** m4p_FOMNbData
 
HPFLTNB **** m4p_FOMPenalty
 
bool m_optimizerImageStatFlag
 
INTNBmp_imageStatNbVox
 
FLTNBmp_imageStatMin
 
FLTNBmp_imageStatMax
 
HPFLTNBmp_imageStatMean
 
HPFLTNBmp_imageStatVariance
 
HPFLTNBmp_correctionStatMean
 
HPFLTNBmp_correctionStatVariance
 
int m_requiredPenaltyDerivativesOrder
 
vPenaltymp_Penalty
 
bool m_needGlobalSensitivity
 
vDataFilemp_DataFile
 
oImageConvolverManagermp_ImageConvolverManager
 
int m_nbSubSteps
 
int * mp_nbSubIterationsInSubSteps
 
int m_nbSubIterationsInOneIteration
 
int m_nbSubIterationsTotal
 
bool * mp_outputIterations
 
int m_currentTotalSubIteration
 
int m_currentSubStep
 
int m_currentSubIterationInSubStep
 
bool m_needPreIteration
 
bool m_isInPreIteration
 
bool m_needPostIteration
 
bool m_isInPostIteration
 

Detailed Description

This class implements the Maximum Likelihood Expectation Maximization algorithm.

This class inherits from vOptimizer and implements the classical MLEM algorithm for likelihood maximization. It is implemented in its multiplicative form.

Definition at line 21 of file code/include/optimizer/iOptimizerMLEM.hh.

Constructor & Destructor Documentation

◆ iOptimizerMLEM() [1/2]

iOptimizerMLEM::iOptimizerMLEM ( )

The constructor of iOptimizerMLEM.

This is the default and unique constructor. It does not take any parameter and its role is only to affect default values to each member of the class.

Definition at line 16 of file code/src/optimizer/iOptimizerMLEM.cc.

◆ ~iOptimizerMLEM() [1/2]

iOptimizerMLEM::~iOptimizerMLEM ( )

The destructor of iOptimizerMLEM.

This is the default and unique destructor. It does not take any parameter and its role is only to free or delete all structures that were built by this class.

Definition at line 47 of file code/src/optimizer/iOptimizerMLEM.cc.

◆ iOptimizerMLEM() [2/2]

iOptimizerMLEM::iOptimizerMLEM ( )

◆ ~iOptimizerMLEM() [2/2]

iOptimizerMLEM::~iOptimizerMLEM ( )

Member Function Documentation

◆ CheckSpecificParameters() [1/2]

int iOptimizerMLEM::CheckSpecificParameters ( )
privatevirtual

A private function used to check the parameters settings specific to the child optimizer.

This function is used to check that all parameters specific to the optimizer are correctly set within allowed values. It is called by the CheckParameters() function of the mother class. It is the implementation of the pure virtual function inherited from the abstract mother class vOptimizer.

Returns
An integer reflecting the check status; 0 if no problem, another value otherwise.

Implements vOptimizer.

Definition at line 143 of file code/src/optimizer/iOptimizerMLEM.cc.

◆ CheckSpecificParameters() [2/2]

int iOptimizerMLEM::CheckSpecificParameters ( )
privatevirtual

A private function used to check the parameters settings specific to the child optimizer.

This function is used to check that all parameters specific to the optimizer are correctly set within allowed values. It is called by the CheckParameters() function. It is pure virtual so is implemented by children.

Returns
An integer reflecting the check status; 0 if no problem, another value otherwise.

Implements vOptimizer.

◆ DataSpaceSpecificOperations() [1/2]

int iOptimizerMLEM::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 
)
privatevirtual

Implements vOptimizer.

Definition at line 217 of file code/src/optimizer/iOptimizerMLEM.cc.

◆ DataSpaceSpecificOperations() [2/2]

int iOptimizerMLEM::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 
)
privatevirtual

Implements vOptimizer.

◆ ImageSpaceSpecificOperations() [1/2]

int iOptimizerMLEM::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 
)
privatevirtual

Implements vOptimizer.

Definition at line 260 of file code/src/optimizer/iOptimizerMLEM.cc.

◆ ImageSpaceSpecificOperations() [2/2]

int iOptimizerMLEM::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 
)
privatevirtual

Implements vOptimizer.

◆ InitializeSpecific() [1/2]

int iOptimizerMLEM::InitializeSpecific ( )
privatevirtual

This function is used to initialize specific stuff to the child optimizer.

It is called by the public Initialize() function from the mother.

Returns
An integer reflecting the initialization status; 0 if no problem, another value otherwise.

Implements vOptimizer.

Definition at line 178 of file code/src/optimizer/iOptimizerMLEM.cc.

◆ InitializeSpecific() [2/2]

int iOptimizerMLEM::InitializeSpecific ( )
privatevirtual

A private function used to initialize everything specific to the child optimizer.

This function is used to initialize everything specific to the optimizer that should be initialized. It is called by the Initialize() function. It is pure virtual so is implemented by children.

Returns
An integer reflecting the initialization status; 0 if no problem, another value otherwise.

Implements vOptimizer.

◆ ReadConfigurationFile() [1/2]

int iOptimizerMLEM::ReadConfigurationFile ( const string &  a_configurationFile)
virtual

Implements vOptimizer.

◆ ReadConfigurationFile() [2/2]

int iOptimizerMLEM::ReadConfigurationFile ( const string &  a_configurationFile)
virtual

Implements vOptimizer.

Definition at line 78 of file code/src/optimizer/iOptimizerMLEM.cc.

Here is the call graph for this function:

◆ ReadOptionsList() [1/2]

int iOptimizerMLEM::ReadOptionsList ( const string &  a_optionsList)
virtual

Implements vOptimizer.

◆ ReadOptionsList() [2/2]

int iOptimizerMLEM::ReadOptionsList ( const string &  a_optionsList)
virtual

Implements vOptimizer.

Definition at line 118 of file code/src/optimizer/iOptimizerMLEM.cc.

Here is the call graph for this function:

◆ SensitivitySpecificOperations() [1/2]

int iOptimizerMLEM::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 
)
privatevirtual

Implements vOptimizer.

◆ SensitivitySpecificOperations() [2/2]

int iOptimizerMLEM::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 
)
privatevirtual

Implements vOptimizer.

Definition at line 202 of file code/src/optimizer/iOptimizerMLEM.cc.

◆ ShowHelpSpecific() [1/2]

void iOptimizerMLEM::ShowHelpSpecific ( )
privatevirtual

A function used to show help about the child module.

This function must describe what the optimizer does and how to use it. It describes in details the different parameters of the optimizer, and how to set them through the use of a configuration file or a list of options. It is pure virtual so is implemented by children. It is private because called by the public ShowHelp() function.

Implements vOptimizer.

◆ ShowHelpSpecific() [2/2]

void iOptimizerMLEM::ShowHelpSpecific ( )
privatevirtual

A function used to show help about the child optimizer.

This function must describe what the module does and how to use it. It describes in details the different parameters of the optimizer, and how to set them through the use of a configuration file or a list of options. It is the implementation of the pure virtual function inherited from the abstract class vOptimizer. It is called by the public ShowHelp() function.

Implements vOptimizer.

Definition at line 56 of file code/src/optimizer/iOptimizerMLEM.cc.

Member Data Documentation

◆ m_dataSpaceDenominatorThreshold

FLTNB iOptimizerMLEM::m_dataSpaceDenominatorThreshold
private

Threshold applied to the denominator of the data space operation to avoid 0-divisions or too high ratios

Definition at line 160 of file code/include/optimizer/iOptimizerMLEM.hh.

◆ m_maximumImageUpdateFactor

FLTNB iOptimizerMLEM::m_maximumImageUpdateFactor
private

Maximum allowed image update factor (null or negative values mean no restriction)

Definition at line 162 of file code/include/optimizer/iOptimizerMLEM.hh.

◆ m_minimumImageUpdateFactor

FLTNB iOptimizerMLEM::m_minimumImageUpdateFactor
private

Minimum allowed image update factor, useful to avoid voxels trapped in 0 value (null or negative values mean no restriction)

Definition at line 161 of file code/include/optimizer/iOptimizerMLEM.hh.


The documentation for this class was generated from the following files: