CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
vOptimizer Class Referenceabstract

This class is designed to generically described any iterative optimizer. More...

#include <vOptimizer.hh>

Inheritance diagram for vOptimizer:
Inheritance graph
Collaboration diagram for vOptimizer:
Collaboration graph

Public Member Functions

 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)
 A public function used to compute the model: forward projection of the provided event. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
virtual int ImageUpdateStep ()
 A public function used to perform the image update step of the optimizer. More...
 
virtual int ReadConfigurationFile (const string &a_configurationFile)=0
 A function used to read options from a configuration file. More...
 
virtual int ReadOptionsList (const string &a_optionsList)=0
 A function used to read options from a list of options. More...
 
void SetVerbose (int a_verbose)
 Set the verbose level. More...
 
void SetImageDimensionsAndQuantification (oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
 Set the pointer to the image dimensions in use. More...
 
void SetImageSpace (oImageSpace *ap_ImageSpace)
 Set the pointer to the image space in use. More...
 
void SetNbTOFBins (int a_nbTOFBins)
 Set the number of TOF bins in use. More...
 
void SetDataMode (int a_dataMode)
 Set the data mode in use. More...
 
void SetDataType (int a_dataType)
 Set the data type in use. More...
 
void SetDataSpec (int a_dataSpec)
 Set the data physical specificity in use. More...
 
void SetAttenuationImage (FLTNB *ap_attenuationImage, int a_thread)
 Set the attenuation image corresponding to the current thread and current event. More...
 
void SetFOMFlag (bool a_optimizerFOMFlag)
 Set the FOM flag specifying if figures-of-merit will be computed or not. More...
 
void SetImageStatFlag (bool a_optimizerImageStatFlag)
 Set the image stat flag specifying if basic statistics about image udpate will be computed or not. More...
 
void SetNumbersOfIterationsAndSubsets (int a_nbIterations, int *ap_nbSubsets)
 Set these numbers of iterations and subsets. More...
 
void SetCurrentIteration (int a_currentIteration)
 Set the current iteration. More...
 
void SetCurrentSubset (int a_currentSubset)
 Set the current subset. More...
 
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)
 Set the optimizer ID. More...
 
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)
 Set the penalty of the optimizer. More...
 
bool GetNeedGlobalSensitivity ()
 Get the boolean saying if the sensitivity has to be computed globally for all data channels and not per subset. More...
 

Protected Member Functions

FLTNB ComputeSensitivity (FLTNB ****a4p_sensitivityImage, int a_timeBasisFunction, int a_respBasisFunction, int a_cardBasisFunction, int a_voxel)
 A function used to compute the sensitivity of a given voxel and a given set of dynamic basis functions. More...
 
FLTNB ForwardProject (oProjectionLine *ap_Line, FLTNB *ap_image=NULL)
 A function used to forward project the provided image (or 1 if NULL), based on the provided oProjectionLine. More...
 
void BackwardProject (oProjectionLine *ap_Line, FLTNB *ap_image, FLTNB a_value)
 A function used to backward project the provided value into the provided image, based on the provided oProjectionLine. More...
 

Protected Attributes

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
 

Private Member Functions

virtual int PreDataUpdateSpecificStep ()
 A private function used to perform any step required by the child optimizer, before the loop on event inside the subset loop. More...
 
virtual int PreImageUpdateSpecificStep ()
 A private function used to perform any step required by the child optimizer, between the loop on event and the image update step. More...
 
virtual void ShowHelpSpecific ()=0
 A function used to show help about the child module. More...
 
virtual int CheckSpecificParameters ()=0
 A private function used to check the parameters settings specific to the child optimizer. More...
 
virtual int InitializeSpecific ()=0
 A private function used to initialize everything specific to the child optimizer. More...
 
virtual 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)=0
 A private function used to compute the sensitivity weight associated to the provided data. More...
 
virtual 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)=0
 A private function used to compute the correction term in the data space from the provided data. More...
 
virtual int ImageSpaceSpecificOperations (FLTNB a_currentImageValue, FLTNB *ap_newImageValue, FLTNB a_sensitivity, FLTNB *ap_correctionValues, INTNB a_voxel, int tbf=-1, int rbf=-1, int cbf=-1)=0
 A private function used to update the image value from the provided data. More...
 

Detailed Description

This class is designed to generically described any iterative optimizer.

This class is an abstract one, in the sense that it cannot be used on its own because several pure virtual functions belong to it. Its children are implementations of actual optimizers. Everywhere in the code, this parent class should be used instead of any of its children. The optimizer is created by the oOptimizerManager is used during the iterative process of the algorithm through the call of multiple functions. All functions prefixed by DataStepX are called within the DataUpdateStep() function of the oOptimizerManager. The other main function is the ImageUpdateStep() function called by the eponym function from the manager. Anyway, all these aforementioned functions are virtual, but are designed to be flexible enaugh for any kind of optimizer. Finally, a particular optimizer (a child of this vOptimizer) will be characterized by the implementation of some pure virtual functions, some for options and initialization management, and three particular ones that really describe what this particular optimizer does: SensitivitySpecificOperations(), DataSpaceSpecificOperations() and ImageSpaceSpecificOperations(). Read the description of these functions below to get more details.

Definition at line 59 of file vOptimizer.hh.

Constructor & Destructor Documentation

◆ vOptimizer()

vOptimizer::vOptimizer ( )

The constructor of vOptimizer.

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 37 of file vOptimizer.cc.

◆ ~vOptimizer()

vOptimizer::~vOptimizer ( )
virtual

The destructor of vOptimizer.

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. It is virtual, so that it is automatically called when a child object is deleted.

Definition at line 83 of file vOptimizer.cc.

Here is the call graph for this function:

Member Function Documentation

◆ BackwardProject()

void vOptimizer::BackwardProject ( oProjectionLine ap_Line,
FLTNB ap_image,
FLTNB  a_value 
)
protected

A function used to backward project the provided value into the provided image, based on the provided oProjectionLine.

Parameters
oProjectionLine*ap_Line
FLTNB*ap_image
FLTNBa_value

Based on the data type, the function calls the projection function of the oProjectionLine class to backward project the value into the image taking the multiplicative terms into account, and eventually dealing with the SPECT attenuation.

Definition at line 1135 of file vOptimizer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckParameters()

int vOptimizer::CheckParameters ( )

A public function used to check the parameters settings.

This function does not take any parameter and is used to check that all mandatory members were correctly parameterized. At the end, it calls the pure virtual CheckSpecificParameters() function implemented by children.

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

Definition at line 254 of file vOptimizer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ CheckSpecificParameters()

private virtual int vOptimizer::CheckSpecificParameters ( )
privatepure virtual

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.

Implemented in iOptimizerModifiedEMForMRFPenalizedML, iOptimizerBSREM, iOptimizerOneStepLate, iOptimizerMLTR, iOptimizerPenalizedPreconditionedGradientML, iOptimizerTemplate, iOptimizerNEGML, iOptimizerOriginalAML, iOptimizerLandweber, and iOptimizerMLEM.

Here is the caller graph for this function:

◆ ComputeSensitivity()

FLTNB vOptimizer::ComputeSensitivity ( FLTNB ****  a4p_sensitivityImage,
int  a_timeBasisFunction,
int  a_respBasisFunction,
int  a_cardBasisFunction,
int  a_voxel 
)
protected

A function used to compute the sensitivity of a given voxel and a given set of dynamic basis functions.

Parameters
FLTNB****a4p_sensitivityImage
inta_timeBasisFunction
inta_respBasisFunction
inta_cardBasisFunction
inta_voxel
inta_nbSubsets

This function computes the sensitivity for a given set of dynamic basis functions and for a given number of subsets. It loops over the dynamic frames and gates to compute the sensitivity based on basis functions coefficients. In list-mode, as the sensitivity is computed for the whole FOV, the value is divided by the current number of subsets of the current iteration, given as a parameter.

Returns
The computed sensitivity

Definition at line 1150 of file vOptimizer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DataSpaceSpecificOperations()

private virtual int vOptimizer::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 
)
privatepure virtual

A private function used to compute the correction term in the data space from the provided data.

Parameters
FLTNBa_data
FLTNBa_forwardModel
FLTNB*ap_backwardValues
FLTNBa_multiplicativeCorrections
FLTNBa_additiveCorrections
FLTNBa_blankValue
FLTNBa_quantificationFactor
oProjectionLine*ap_Line

This function is pure virtual, so must be implemented by specific optimizers. The computed correction term must be put at the ap_backwardValues pointer. All potentially useful information is provided as parameters. This is the operation that the optimization algorithm performs in the data space, in the loop on events. Note that the multiplicate corrections parameter only includes such correction specific to the event; in other words, it does not include the quantification factor which is given separately.

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

Implemented in iOptimizerModifiedEMForMRFPenalizedML, iOptimizerBSREM, iOptimizerMLTR, iOptimizerOneStepLate, iOptimizerTemplate, iOptimizerPenalizedPreconditionedGradientML, iOptimizerNEGML, iOptimizerOriginalAML, iOptimizerLandweber, and iOptimizerMLEM.

Here is the caller graph for this function:

◆ DataStep1ForwardProjectModel()

int vOptimizer::DataStep1ForwardProjectModel ( oProjectionLine ap_Line,
vEvent ap_Event,
int  a_bed,
int  a_timeFrame,
int  a_respGate,
int  a_cardGate,
int  a_thread 
)
virtual

A public function used to compute the model: forward projection of the provided event.

Parameters
oProjectionLine*ap_Line
vEvent*ap_Event
inta_bed
inta_timeFrame
inta_respGate
inta_cardGate
inta_thread

Inside the DataUpdateStep() of the oOptimizerManager, this is the first function called. This function performs the forward projection of the provided event, following the provided projection line. It takes all dynamic dimensions into account, including the intrinsic basis functions. Note that this function uses the ForwardProject() function that automatically deals with attenuation for SPECT and includes all multiplicative terms theoretically included in the system matrix. Then, all additive corrections are added to the forward projection. So the unit of the resulting model is the same as the data. The result of this forward projection is put in the m2p_forwardValues table (for the given thread). The other dimension of this table is for the TOF bins.

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

Definition at line 642 of file vOptimizer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DataStep2Optional()

int vOptimizer::DataStep2Optional ( oProjectionLine ap_Line,
vEvent ap_Event,
int  a_bed,
int  a_timeFrame,
int  a_respGate,
int  a_cardGate,
int  a_thread 
)
virtual

A public function which does nothing but being virtual.

Parameters
oProjectionLine*ap_Line
vEvent*ap_Event
inta_bed
inta_timeFrame
inta_respGate
inta_cardGate
inta_thread

Inside the DataUpdateStep() of the oOptimizerManager, this is the second function called. This function can be overloaded by specific optimizers if needed.

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

Definition at line 721 of file vOptimizer.cc.

Here is the caller graph for this function:

◆ DataStep3BackwardProjectSensitivity()

int vOptimizer::DataStep3BackwardProjectSensitivity ( oProjectionLine ap_Line,
vEvent ap_Event,
int  a_bed,
int  a_timeFrame,
int  a_respGate,
int  a_cardGate,
int  a_thread 
)
virtual

A public function used to back-project the sensitivity terms for the provided event.

Parameters
oProjectionLine*ap_Line
vEvent*ap_Event
inta_bed
inta_timeFrame
inta_respGate
inta_cardGate
inta_thread

Inside the DataUpdateStep() of the oOptimizerManager, this is the third function called. This function is only called when using histogram data. Before performing the back-projection into the sensitivity image, it calls the pure virtual SensitivitySpecificOperations() function whose role is simply to provide the weight associated to the projection line. Note that this function uses the BackwardProject() function that automatically deals with attenuation for SPECT and includes all multiplicative terms theoretically included in the system matrix.

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

Definition at line 734 of file vOptimizer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DataStep4Optional()

int vOptimizer::DataStep4Optional ( oProjectionLine ap_Line,
vEvent ap_Event,
int  a_bed,
int  a_timeFrame,
int  a_respGate,
int  a_cardGate,
int  a_thread 
)
virtual

A public function which does nothing but being virtual.

Parameters
oProjectionLine*ap_Line
vEvent*ap_Event
inta_bed
inta_timeFrame
inta_respGate
inta_cardGate
inta_thread

Inside the DataUpdateStep() of the oOptimizerManager, this is the fourth function called. This function can be overloaded by specific optimizers if needed.

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

Definition at line 774 of file vOptimizer.cc.

Here is the caller graph for this function:

◆ DataStep5ComputeCorrections()

int vOptimizer::DataStep5ComputeCorrections ( oProjectionLine ap_Line,
vEvent ap_Event,
int  a_bed,
int  a_timeFrame,
int  a_respGate,
int  a_cardGate,
int  a_thread 
)
virtual

A public function used to compute the correction terms in the data space, for the provided event.

Parameters
oProjectionLine*ap_Line
vEvent*ap_Event
inta_bed
inta_timeFrame
inta_respGate
inta_cardGate
inta_thread

Inside the DataUpdateStep() of the oOptimizerManager, this is the fifth function called. Its role is to compute the correction terms in the data space, based on the forward model and the data. In order to be specific to each optimizer, it calls the pure virtual function DataSpaceSpecificOperations(), where the computation is done. The correction terms are put in the m3p_backwardValues (a dimension for threads, one for the number of backward images and the last for TOF bins).

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

Definition at line 787 of file vOptimizer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DataStep6Optional()

int vOptimizer::DataStep6Optional ( oProjectionLine ap_Line,
vEvent ap_Event,
int  a_bed,
int  a_timeFrame,
int  a_respGate,
int  a_cardGate,
int  a_thread 
)
virtual

A public function which does nothing but being virtual.

Parameters
oProjectionLine*ap_Line
vEvent*ap_Event
inta_bed
inta_timeFrame
inta_respGate
inta_cardGate
inta_thread

Inside the DataUpdateStep() of the oOptimizerManager, this is the sixth function called. This function can be overloaded by specific optimizers if needed.

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

Definition at line 823 of file vOptimizer.cc.

Here is the caller graph for this function:

◆ DataStep7BackwardProjectCorrections()

int vOptimizer::DataStep7BackwardProjectCorrections ( oProjectionLine ap_Line,
vEvent ap_Event,
int  a_bed,
int  a_timeFrame,
int  a_respGate,
int  a_cardGate,
int  a_thread 
)
virtual

A public function used to back-project the correction terms into the backward correction image.

Parameters
oProjectionLine*ap_Line
vEvent*ap_Event
inta_bed
inta_timeFrame
inta_respGate
inta_cardGate
inta_thread

Inside the DataUpdateStep() of the oOptimizerManager, this is the seventh function called. This function performs the backward projection of the correction terms held into the m3p_backwardValues, for the provided event and following the provided projection line. It takes all dynamic dimensions into account, including the intrinsic basis functions. Note that this function uses the BackwardProject() function that automatically deals with attenuation for SPECT and automatically includes all multiplicative terms theoretically included in the system matrix.

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

Definition at line 836 of file vOptimizer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ DataStep8ComputeFOM()

int vOptimizer::DataStep8ComputeFOM ( oProjectionLine ap_Line,
vEvent ap_Event,
int  a_timeFrame,
int  a_respGate,
int  a_cardGate,
int  a_thread 
)
virtual

A public function used to update the computation of figures-of-merit in the data space.

Parameters
oProjectionLine*ap_Line
vEvent*ap_Event
inta_timeFrame
inta_respGate
inta_cardGate
inta_thread

Inside the DataUpdateStep() of the oOptimizerManager, this is the eighth function called. This function updates the computation of figures-of-merit in the data space for the provided event. It uses the m4p_FOMXXX structures. The computation is done only if the FOM flag is set. For the moment, log-likelihood and RMSE are computed.

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

Definition at line 891 of file vOptimizer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ForwardProject()

FLTNB vOptimizer::ForwardProject ( oProjectionLine ap_Line,
FLTNB ap_image = NULL 
)
protected

A function used to forward project the provided image (or 1 if NULL), based on the provided oProjectionLine.

Parameters
oProjectionLine*ap_Line
FLTNB*ap_image = NULL

Based on the data type, the function calls the projection function of the oProjectionLine class to forward project the image taking the multiplicative terms into account, and eventually dealing with the SPECT attenuation.

Returns
The computed forward projection

Definition at line 1120 of file vOptimizer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetAcceptPenalty()

public inline bool vOptimizer::GetAcceptPenalty ( )
inline

Get the boolean saying if the optimizer accepts penalties.

Returns
true if m_requiredPenaltyDerivativesOrder is higher than the default -1 value, false otherwise

Definition at line 591 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ GetInitialValue()

public inline FLTNB vOptimizer::GetInitialValue ( )
inline

Get the initial image value (for initialization)

Returns
m_initialValue

Definition at line 562 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ GetNbBackwardImages()

public inline int vOptimizer::GetNbBackwardImages ( )
inline

Get the number of backward images used by the specific optimizer.

Returns
m_nbBackwardImages

Definition at line 555 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ GetNeedGlobalSensitivity()

public inline bool vOptimizer::GetNeedGlobalSensitivity ( )
inline

Get the boolean saying if the sensitivity has to be computed globally for all data channels and not per subset.

This is only relevant for histogram data

Returns
m_needGlobalSensitivity

Definition at line 606 of file vOptimizer.hh.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetOptimizerID()

const string& vOptimizer::GetOptimizerID ( )
inline

Definition at line 577 of file vOptimizer.hh.

◆ GetRequiredPenaltyDerivativesOrder()

public inline int vOptimizer::GetRequiredPenaltyDerivativesOrder ( )
inline

Get the penalty derivative order needed for this algorithm.

Returns
m_requiredPenaltyDerivativesOrder

Definition at line 584 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ ImageSpaceSpecificOperations()

private virtual int vOptimizer::ImageSpaceSpecificOperations ( FLTNB  a_currentImageValue,
FLTNB ap_newImageValue,
FLTNB  a_sensitivity,
FLTNB ap_correctionValues,
INTNB  a_voxel,
int  tbf = -1,
int  rbf = -1,
int  cbf = -1 
)
privatepure virtual

A private function used to update the image value from the provided data.

Parameters
FLTNBa_currentImageValue
FLTNB*ap_newImageValue
FLTNBa_sensitivity
FLTNB*ap_correctionValues
INTNBa_voxel

This function is pure virtual, so must be implemented by specific optimizers. The old values are provided, as well as the location of the new that will be calculated. This is the operation that the optimization algorithm performs in the image update step, after the loop on events. Note that based on the number of backward images used by the specific optimizer, there can be multiple correction values in ap_correctionValues, explaining why it is provided as a pointer. Note also that this function is only called for non-zero sensitivity, so no need to check it. The design of this function will evolve in order to take into account optimizers with penalties and alternated optimizers like MLAA which estimate the attenuation at the same time.

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

Implemented in iOptimizerModifiedEMForMRFPenalizedML, iOptimizerBSREM, iOptimizerMLTR, iOptimizerOneStepLate, iOptimizerTemplate, iOptimizerPenalizedPreconditionedGradientML, iOptimizerNEGML, iOptimizerOriginalAML, iOptimizerLandweber, and iOptimizerMLEM.

Here is the caller graph for this function:

◆ ImageUpdateStep()

int vOptimizer::ImageUpdateStep ( )
virtual

A public function used to perform the image update step of the optimizer.

Parameters
inta_iteration
inta_nbSubsets

This function is called by the eponym function from the oOptimizerManager. It will manage the dynamic loops, compute the sensitivity using the private ComputeSensitivity() function, and update each voxel according to the specific optimizer by calling the pure virtual ImageSpaceSpecificOperations() function.

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

Definition at line 954 of file vOptimizer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Initialize()

int vOptimizer::Initialize ( )

A public function used to initialize the optimizer.

This function does not take any parameter and is used to initialize everything that should be initialized. At the end, it calls the pure virtual InitializeSpecific() function implemented by children.

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

Definition at line 349 of file vOptimizer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitializeSpecific()

private virtual int vOptimizer::InitializeSpecific ( )
privatepure virtual

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.

Implemented in iOptimizerModifiedEMForMRFPenalizedML, iOptimizerBSREM, iOptimizerOneStepLate, iOptimizerMLTR, iOptimizerPenalizedPreconditionedGradientML, iOptimizerTemplate, iOptimizerNEGML, iOptimizerOriginalAML, iOptimizerLandweber, and iOptimizerMLEM.

Here is the caller graph for this function:

◆ PreDataUpdateSpecificStep()

int vOptimizer::PreDataUpdateSpecificStep ( )
privatevirtual

A private function used to perform any step required by the child optimizer, before the loop on event inside the subset loop.

The vOptimizer implementation just does nothing. It is called by the PreDataUpdateStep() function. It is virtual so it can be overloaded by the child optimizer if needed.

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

Definition at line 468 of file vOptimizer.cc.

Here is the caller graph for this function:

◆ PreDataUpdateStep()

int vOptimizer::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)

It does some reseting for the FOM computation. At the end, it calls the PreDataUpdateSpecificStep() function, which does nothing but being virtual, so it can be overloaded to perform specific stuff at this step by specific optimizers that would need to do so.

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

Definition at line 431 of file vOptimizer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ PreImageUpdateSpecificStep()

int vOptimizer::PreImageUpdateSpecificStep ( )
privatevirtual

A private function used to perform any step required by the child optimizer, between the loop on event and the image update step.

The vOptimizer implementation just does nothing. It is called by the PreImageUpdateStep() function. It is virtual so it can be overloaded by the child optimizer if needed.

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

Reimplemented in iOptimizerModifiedEMForMRFPenalizedML, iOptimizerBSREM, iOptimizerOneStepLate, iOptimizerMLTR, iOptimizerPenalizedPreconditionedGradientML, and iOptimizerTemplate.

Definition at line 631 of file vOptimizer.cc.

Here is the caller graph for this function:

◆ PreImageUpdateStep()

int vOptimizer::PreImageUpdateStep ( )

A public function used to do stuff that need to be done between the loop over events and the image update step.

It does some reseting for the FOM computation. At the end, it calls the PreImageUpdateSpecificStep() function, which does nothing but being virtual, so it can be overloaded to perform specific stuff at this step by specific optimizers that would need to do so.

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

Definition at line 479 of file vOptimizer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ReadConfigurationFile()

public virtual int vOptimizer::ReadConfigurationFile ( const string &  a_configurationFile)
pure virtual

A function used to read options from a configuration file.

Parameters
conststring& a_configurationFile

This function implements the reading of all options associated to a child optimizer, from a configuration file. It is pure virtual so is implemented by children. It checks the reading status but not the options values that will be checked by the CheckSpecificParameters() function.

Returns
An integer reflecting the reading success; 0 if success, another value otherwise.

Implemented in iOptimizerBSREM, iOptimizerNEGML, iOptimizerOriginalAML, iOptimizerMLTR, iOptimizerModifiedEMForMRFPenalizedML, iOptimizerLandweber, iOptimizerOneStepLate, iOptimizerMLEM, iOptimizerPenalizedPreconditionedGradientML, and iOptimizerTemplate.

Here is the caller graph for this function:

◆ ReadOptionsList()

public virtual int vOptimizer::ReadOptionsList ( const string &  a_optionsList)
pure virtual

A function used to read options from a list of options.

Parameters
conststring& a_optionsList

This function implements the reading of all options associated to a child optimizer, from a list of options. It is pure virtual so is implemented by children. It checks the reading status but not the options values that will be checked by the CheckSpecificParameters() function.

Returns
An integer reflecting the reading success; 0 if success, another value otherwise.

Implemented in iOptimizerBSREM, iOptimizerNEGML, iOptimizerOriginalAML, iOptimizerMLTR, iOptimizerModifiedEMForMRFPenalizedML, iOptimizerLandweber, iOptimizerOneStepLate, iOptimizerMLEM, iOptimizerPenalizedPreconditionedGradientML, and iOptimizerTemplate.

Here is the caller graph for this function:

◆ SensitivitySpecificOperations()

private virtual int vOptimizer::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 
)
privatepure virtual

A private function used to compute the sensitivity weight associated to the provided data.

Parameters
FLTNBa_data
FLTNBa_forwardModel
FLTNB*ap_weight
FLTNBa_multiplicativeCorrections
FLTNBa_additiveCorrections
FLTNBa_blankValue
FLTNBa_quantificationFactor
oProjectionLine*ap_Line

This function is pure virtual, so must be implemented by specific optimizers. The computed sensitivity term must be put at the ap_weight pointer. All potentially useful information is provided as parameters. Note that the multiplicate corrections parameter only includes such correction specific to the event; in other words, it does not include the quantification factor which is given separately.

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

Implemented in iOptimizerModifiedEMForMRFPenalizedML, iOptimizerBSREM, iOptimizerMLTR, iOptimizerOneStepLate, iOptimizerTemplate, iOptimizerPenalizedPreconditionedGradientML, iOptimizerNEGML, iOptimizerOriginalAML, iOptimizerLandweber, and iOptimizerMLEM.

Here is the caller graph for this function:

◆ SetAttenuationImage()

public inline void vOptimizer::SetAttenuationImage ( FLTNB ap_attenuationImage,
int  a_thread 
)
inline

Set the attenuation image corresponding to the current thread and current event.

Parameters
FLTNB*ap_attenuationImage
inta_thread

Definition at line 512 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ SetCurrentIteration()

public inline void vOptimizer::SetCurrentIteration ( int  a_currentIteration)
inline

Set the current iteration.

Parameters
inta_currentIteration

Definition at line 541 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ SetCurrentSubset()

public inline void vOptimizer::SetCurrentSubset ( int  a_currentSubset)
inline

Set the current subset.

Parameters
inta_currentSubset

Definition at line 548 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ SetDataMode()

public inline void vOptimizer::SetDataMode ( int  a_dataMode)
inline

Set the data mode in use.

Parameters
inta_dataMode

Definition at line 490 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ SetDataSpec()

public inline void vOptimizer::SetDataSpec ( int  a_dataSpec)
inline

Set the data physical specificity in use.

Parameters
inta_dataSpec

Definition at line 504 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ SetDataType()

public inline void vOptimizer::SetDataType ( int  a_dataType)
inline

Set the data type in use.

Parameters
inta_dataType

Definition at line 497 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ SetFOMFlag()

public inline void vOptimizer::SetFOMFlag ( bool  a_optimizerFOMFlag)
inline

Set the FOM flag specifying if figures-of-merit will be computed or not.

Parameters
boola_optimizerFOMFlag

Definition at line 519 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ SetImageDimensionsAndQuantification()

public inline void vOptimizer::SetImageDimensionsAndQuantification ( oImageDimensionsAndQuantification ap_ImageDimensionsAndQuantification)
inline

Set the pointer to the image dimensions in use.

Parameters
oImageDimensionsAndQuantification*ap_ImageDimensionsAndQuantification

Definition at line 469 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ SetImageSpace()

public inline void vOptimizer::SetImageSpace ( oImageSpace ap_ImageSpace)
inline

Set the pointer to the image space in use.

Parameters
oImageSpace*ap_ImageSpace

Definition at line 476 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ SetImageStatFlag()

public inline void vOptimizer::SetImageStatFlag ( bool  a_optimizerImageStatFlag)
inline

Set the image stat flag specifying if basic statistics about image udpate will be computed or not.

Parameters
boola_optimizerImageStatFlag

Definition at line 526 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ SetNbTOFBins()

public inline void vOptimizer::SetNbTOFBins ( int  a_nbTOFBins)
inline

Set the number of TOF bins in use.

Parameters
inta_nbTOFBins

Definition at line 483 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ SetNumbersOfIterationsAndSubsets()

public inline void vOptimizer::SetNumbersOfIterationsAndSubsets ( int  a_nbIterations,
int *  ap_nbSubsets 
)
inline

Set these numbers of iterations and subsets.

Parameters
inta_nbIterations
int*ap_nbSubsets

Definition at line 534 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ SetOptimizerID()

public inline void vOptimizer::SetOptimizerID ( const string &  a_optimizerID)
inline

Set the optimizer ID.

Parameters
conststring& a_optimizerID

Definition at line 569 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ SetPenalty()

public inline void vOptimizer::SetPenalty ( vPenalty ap_penalty)
inline

Set the penalty of the optimizer.

Parameters
vPenalty*ap_penalty

Definition at line 598 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ SetVerbose()

public inline void vOptimizer::SetVerbose ( int  a_verbose)
inline

Set the verbose level.

Parameters
inta_verboseLevel

Definition at line 462 of file vOptimizer.hh.

Here is the caller graph for this function:

◆ ShowHelp()

void vOptimizer::ShowHelp ( )

A function used to show help about the optimizer.

This function simply calls the ShowHelpSpecific() function implemented by children.

Definition at line 233 of file vOptimizer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowHelpSpecific()

private virtual void vOptimizer::ShowHelpSpecific ( )
privatepure virtual

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.

Implemented in iOptimizerModifiedEMForMRFPenalizedML, iOptimizerBSREM, iOptimizerOneStepLate, iOptimizerMLTR, iOptimizerPenalizedPreconditionedGradientML, iOptimizerTemplate, iOptimizerNEGML, iOptimizerOriginalAML, iOptimizerLandweber, and iOptimizerMLEM.

Here is the caller graph for this function:

◆ UpdateVisitedVoxels()

int vOptimizer::UpdateVisitedVoxels ( )

A public function used to update the 'visited' voxels after each subset.

This function is called at the end of each subset. Based on the sensitivity image, it labels which voxel has been visited or not during each subset. At the end of the iteration, all voxels that have not been visited in any subset are set to 0. There is a dedicated matrix in the oImageSpace to keep track of visited voxels. Practically, this avoids having those never visited voxels trapped in their initial value if the latter is different from 0.

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

Definition at line 919 of file vOptimizer.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m2p_attenuationImage

FLTNB** vOptimizer::m2p_attenuationImage
protected

The attenuation image currently in use for the current event, one per thread (used for SPECT)

Definition at line 674 of file vOptimizer.hh.

◆ m2p_forwardValues

FLTNB** vOptimizer::m2p_forwardValues
protected

Buffer for forward projected values, as many as threads and as many as TOF bins

Definition at line 661 of file vOptimizer.hh.

◆ m3p_backwardValues

FLTNB*** vOptimizer::m3p_backwardValues
protected

Buffer for values to be back-projected, as many as threads, as many as TOF bins and as many as backward images

Definition at line 662 of file vOptimizer.hh.

◆ m4p_FOMLogLikelihood

HPFLTNB**** vOptimizer::m4p_FOMLogLikelihood
protected

The log-likelihood, as many as frames, respiratory gates, cardiac gates and threads

Definition at line 682 of file vOptimizer.hh.

◆ m4p_FOMNbBins

uint64_t**** vOptimizer::m4p_FOMNbBins
protected

The number of bins contributing to the FOM computation, as many as frames, respiratory gates, cardiac gates and threads

Definition at line 684 of file vOptimizer.hh.

◆ m4p_FOMNbData

HPFLTNB**** vOptimizer::m4p_FOMNbData
protected

The number of data (counts) contributing to the FOM computation, as many as frames, respiratory gates, cardiac gates and threads

Definition at line 685 of file vOptimizer.hh.

◆ m4p_FOMPenalty

HPFLTNB**** vOptimizer::m4p_FOMPenalty
protected

The contribution of the penalty to the objective function

Definition at line 686 of file vOptimizer.hh.

◆ m4p_FOMRMSE

HPFLTNB**** vOptimizer::m4p_FOMRMSE
protected

The RMSE, as many as frames, respiratory gates, cardiac gates and threads

Definition at line 683 of file vOptimizer.hh.

◆ m_currentIteration

int vOptimizer::m_currentIteration
protected

Current iteration number

Definition at line 678 of file vOptimizer.hh.

◆ m_currentSubset

int vOptimizer::m_currentSubset
protected

Current subset number

Definition at line 679 of file vOptimizer.hh.

◆ m_dataMode

int vOptimizer::m_dataMode
protected

The mode of the data (list-mode or histogram)

Definition at line 671 of file vOptimizer.hh.

◆ m_dataSpec

int vOptimizer::m_dataSpec
protected

The physical specificity of the data (EMISSION or TRANSMISSION)

Definition at line 673 of file vOptimizer.hh.

◆ m_dataType

int vOptimizer::m_dataType
protected

The type of the data (PET, SPECT, ...)

Definition at line 672 of file vOptimizer.hh.

◆ m_emissionCompatibility

bool vOptimizer::m_emissionCompatibility
protected

A flag saying if the optimizer is compatible with emission data

Definition at line 666 of file vOptimizer.hh.

◆ m_histogramCompatibility

bool vOptimizer::m_histogramCompatibility
protected

A flag saying if the optimizer is compatible with histogram data

Definition at line 665 of file vOptimizer.hh.

◆ m_initialValue

FLTNB vOptimizer::m_initialValue
protected

The initial value of the image for the specific optimizer

Definition at line 663 of file vOptimizer.hh.

◆ m_listmodeCompatibility

bool vOptimizer::m_listmodeCompatibility
protected

A flag saying if the optimizer is compatible with list-mode data

Definition at line 664 of file vOptimizer.hh.

◆ m_nbBackwardImages

int vOptimizer::m_nbBackwardImages
protected

The number of backward images used by the specific optimizer

Definition at line 659 of file vOptimizer.hh.

◆ m_nbIterations

int vOptimizer::m_nbIterations
protected

Number of iterations

Definition at line 676 of file vOptimizer.hh.

◆ m_nbTOFBins

int vOptimizer::m_nbTOFBins
protected

The number of TOF bins in use

Definition at line 660 of file vOptimizer.hh.

◆ m_needGlobalSensitivity

bool vOptimizer::m_needGlobalSensitivity
protected

Say that the sensitivity has to be computed at the beginning of the reconstruction process from the whole set of data channels with histogram data, as opposed to the computation from data channels only belonging to the current subset

Definition at line 699 of file vOptimizer.hh.

◆ m_optimizerFOMFlag

bool vOptimizer::m_optimizerFOMFlag
protected

A flag saying if figures-of-merit are computed in the data space

Definition at line 681 of file vOptimizer.hh.

◆ m_optimizerID

string vOptimizer::m_optimizerID
protected

String containing the name provided as the class identifer in the children classes

Definition at line 657 of file vOptimizer.hh.

◆ m_optimizerImageStatFlag

bool vOptimizer::m_optimizerImageStatFlag
protected

A flag saying if some basic statistics about image update are computed

Definition at line 688 of file vOptimizer.hh.

◆ m_requiredPenaltyDerivativesOrder

int vOptimizer::m_requiredPenaltyDerivativesOrder
protected

The penalty derivatives order required by the specific optimizer (-1 if none)

Definition at line 697 of file vOptimizer.hh.

◆ m_transmissionCompatibility

bool vOptimizer::m_transmissionCompatibility
protected

A flag saying if the optimizer is compatible with transmission data

Definition at line 667 of file vOptimizer.hh.

◆ m_verbose

int vOptimizer::m_verbose
protected

The verbose level

Definition at line 658 of file vOptimizer.hh.

◆ mp_correctionStatMean

HPFLTNB* vOptimizer::mp_correctionStatMean
protected

The mean additive update correction value, one per thread to be thread safe

Definition at line 694 of file vOptimizer.hh.

◆ mp_correctionStatVariance

HPFLTNB* vOptimizer::mp_correctionStatVariance
protected

The variance of additive update correction values, one per thread to be thread safe

Definition at line 695 of file vOptimizer.hh.

◆ mp_ImageDimensionsAndQuantification

oImageDimensionsAndQuantification* vOptimizer::mp_ImageDimensionsAndQuantification
protected

Pointer to the image dimensions and quantification object

Definition at line 669 of file vOptimizer.hh.

◆ mp_ImageSpace

oImageSpace* vOptimizer::mp_ImageSpace
protected

Pointer to the image space object in use

Definition at line 670 of file vOptimizer.hh.

◆ mp_imageStatMax

FLTNB* vOptimizer::mp_imageStatMax
protected

The maximum image value, one per thread to be thread safe

Definition at line 691 of file vOptimizer.hh.

◆ mp_imageStatMean

HPFLTNB* vOptimizer::mp_imageStatMean
protected

The mean image value, one per thread to be thread safe

Definition at line 692 of file vOptimizer.hh.

◆ mp_imageStatMin

FLTNB* vOptimizer::mp_imageStatMin
protected

The minimum image value, one per thread to be thread safe

Definition at line 690 of file vOptimizer.hh.

◆ mp_imageStatNbVox

INTNB* vOptimizer::mp_imageStatNbVox
protected

The number of voxels contributing to the image statistics, one per thread to be thread safe

Definition at line 689 of file vOptimizer.hh.

◆ mp_imageStatVariance

HPFLTNB* vOptimizer::mp_imageStatVariance
protected

The image variance value, one per thread to be thread safe

Definition at line 693 of file vOptimizer.hh.

◆ mp_nbSubsets

int* vOptimizer::mp_nbSubsets
protected

Numbers of subsets

Definition at line 677 of file vOptimizer.hh.

◆ mp_Penalty

vPenalty* vOptimizer::mp_Penalty
protected

Penalty of the algorithm

Definition at line 698 of file vOptimizer.hh.


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