CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
Public Member Functions | Protected Member Functions | List of all members
iIterativeAlgorithm Class Reference

#include <iIterativeAlgorithm.hh>

Inheritance diagram for iIterativeAlgorithm:
Inheritance graph
Collaboration diagram for iIterativeAlgorithm:
Collaboration graph

Public Member Functions

 iIterativeAlgorithm ()
 
 ~iIterativeAlgorithm ()
 
int InitSpecificOptions (string a_specificOptions)
 
- Public Member Functions inherited from vAlgorithm
 vAlgorithm ()
 vAlgorithm constructor. Initialize the member variables to their default values. More...
 
virtual ~vAlgorithm ()
 vAlgorithm destructor. More...
 
int Run ()
 Just call either the RunCPU or the RunGPU function as asked for. More...
 
int RunCPU ()
 Perform the iterative loop of the algorithm. Function designed to be executed on the CPU only. More...
 
void SetSaveSensitivityHistoFlag (bool a_saveSensitivityHistoFlag)
 Set the flag that specifies if the sensitivity image in histogram mode has to be saved for each subset/iteration. More...
 
void SetSaveSubsetImageFlag (bool a_saveImageAfterSubsets)
 Set the flag that specifies if the image has to be saved for each subset. More...
 
void SetSaveDynamicBasisCoefficientImages (bool a_saveDynamicBasisCoefficients)
 Set the flag that specifies if the dynamic basis functions coefficients images have to be saved. More...
 
void SetOptimizerManager (oOptimizerManager *ap_OptimizerManager)
 Set the Optimizer Manager Object. More...
 
void SetImageDimensionsAndQuantification (oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
 Set the Image Dimensions and Quantification Object. More...
 
void SetImageSpace (oImageSpace *ap_ImageSpace)
 Set the Image Space Object. More...
 
void SetProjectorManager (oProjectorManager *ap_ProjectorManager)
 Set the Projector Manager Object. More...
 
void SetImageConvolverManager (oImageConvolverManager *ap_ImageConvolverManager)
 Set the Image Convolver Manager Object. More...
 
void SetImageProcessingManager (oImageProcessingManager *ap_ImageProcessingManager)
 Set the Image Processing Manager Object. More...
 
void SetDynamicModelManager (oDynamicModelManager *ap_DynamicModelManager)
 Set the Dynamic Model Manager Object. More...
 
void SetDeformationManager (oDeformationManager *ap_DeformationManager)
 Set the Deformation Manager Object. More...
 
void SetDataFile (vDataFile **a2p_DataFile)
 Set the list of DataFile. More...
 
void SetGPUflag (bool a_flagGPU)
 Set the GPU flag. More...
 
void SetVerbose (int a_verboseLevel)
 Set Verbosity. More...
 
void SetNbBeds (int a_nbBeds)
 Set number of beds (bed positions) More...
 
void SetPathInitImage (string a_pathToInitialImage)
 Set path to an initial image. More...
 
void SetPathToAttenuationImage (string a_pathToAttenuationImage)
 This function is used to set the path to the attenuation image. More...
 
void SetPathToSensitivityImage (string a_pathToSensitivityImage)
 Set path to the sensitivity image. More...
 
void SetPathToMultiModalImage (vector< string > a_pathToMultiModalImage)
 Set path to multimodal images. More...
 
void SetPathToMaskImage (string a_pathToMaskImage)
 Set path to a mask image. More...
 
int SetNbIterationsAndSubsets (const string &a_nbIterationsSubsets)
 Set the number of iterations and subsets. More...
 
int SetOutputIterations (const string &a_outputIterations)
 Set the selected output iterations. More...
 
virtual void ShowHelpSpecific ()
 Show help for the child algorithm. More...
 

Protected Member Functions

int StepBeforeIterationLoop ()
 This function is called at the beginning of the RunCPU function. More...
 
int StepAfterIterationLoop ()
 This function is called at the end of the RunCPU function. More...
 
int StepBeforeSubsetLoop (int a_iteration)
 This function is called before starting the subset loop. More...
 
int StepAfterSubsetLoop (int a_iteration)
 This function is called after finishing the subset loop. More...
 
int StepPreProcessInsideSubsetLoop (int a_iteration, int a_subset)
 This function is called right after starting the subset loop. Apply any kind of processing on the forward image before projections. More...
 
int StepPostProcessInsideSubsetLoop (int a_iteration, int a_subset)
 
int StepInnerLoopInsideSubsetLoop (int a_iteration, int a_subset, int a_bed)
 This function is called inside the subset loop and manages the main loop over the events
The loop over the events is multithreaded, and involves a thread lock in the case of image-based deformation. More...
 
int StepImageOutput (int a_iteration, int a_subset=-1)
 This function deals with everything about saving output images from the reconstruction. More...
 

Additional Inherited Members

- Protected Attributes inherited from vAlgorithm
int m_nbIterations
 
int * mp_nbSubsets
 
bool * mp_outputIterations
 
int m_verbose
 
bool m_flagGPU
 
oImageDimensionsAndQuantificationmp_ID
 
vDataFile ** m2p_DataFile
 
oProjectorManagermp_ProjectorManager
 
oOptimizerManagermp_OptimizerManager
 
oDeformationManagermp_DeformationManager
 
oDynamicModelManagermp_DynamicModelManager
 
oImageSpacemp_ImageSpace
 
oImageConvolverManagermp_ImageConvolverManager
 
oImageProcessingManagermp_ImageProcessingManager
 
int m_nbBeds
 
string m_pathToInitialImg
 
string m_pathToAtnImg
 
string m_pathToSensitivityImg
 
vector< string > m_pathToMultiModalImg
 
string m_pathToMaskImg
 
bool m_saveSensitivityHistoFlag
 
bool m_saveImageAfterSubsets
 
bool m_saveDynamicBasisCoefficients
 

Detailed Description

Definition at line 52 of file iIterativeAlgorithm.hh.

Constructor & Destructor Documentation

◆ iIterativeAlgorithm()

iIterativeAlgorithm::iIterativeAlgorithm ( )

Definition at line 39 of file iIterativeAlgorithm.cc.

◆ ~iIterativeAlgorithm()

iIterativeAlgorithm::~iIterativeAlgorithm ( )

Definition at line 48 of file iIterativeAlgorithm.cc.

Member Function Documentation

◆ InitSpecificOptions()

int iIterativeAlgorithm::InitSpecificOptions ( string  a_specificOptions)
virtual
Parameters
a_specificOptions
Returns
0

Reimplemented from vAlgorithm.

Definition at line 626 of file iIterativeAlgorithm.cc.

◆ StepAfterIterationLoop()

int iIterativeAlgorithm::StepAfterIterationLoop ( )
protectedvirtual

This function is called at the end of the RunCPU function.

Free Memory for the imageSpace and some managers

Returns
0 if success, positive value otherwise.

Reimplemented from vAlgorithm.

Definition at line 525 of file iIterativeAlgorithm.cc.

Here is the call graph for this function:

◆ StepAfterSubsetLoop()

int iIterativeAlgorithm::StepAfterSubsetLoop ( int  a_iteration)
protectedvirtual

This function is called after finishing the subset loop.

Parameters
a_iteration: iteration index

Clean the main images from never visited voxels
Apply post-convolution/post-processing if needed
Write output images on disk as requested by the user

Returns
0 if success, positive value otherwise.

Reimplemented from vAlgorithm.

Definition at line 499 of file iIterativeAlgorithm.cc.

Here is the call graph for this function:

◆ StepBeforeIterationLoop()

int iIterativeAlgorithm::StepBeforeIterationLoop ( )
protectedvirtual

This function is called at the beginning of the RunCPU function.

Initialization and memory allocation for the imageSpace and some managers

Returns
0 if success, positive value otherwise.

Reimplemented from vAlgorithm.

Definition at line 57 of file iIterativeAlgorithm.cc.

Here is the call graph for this function:

◆ StepBeforeSubsetLoop()

int iIterativeAlgorithm::StepBeforeSubsetLoop ( int  a_iteration)
protectedvirtual

This function is called before starting the subset loop.

Parameters
a_iteration: iteration index
Returns
0 if success, positive value otherwise.

Reimplemented from vAlgorithm.

Definition at line 88 of file iIterativeAlgorithm.cc.

Here is the call graph for this function:

◆ StepImageOutput()

int iIterativeAlgorithm::StepImageOutput ( int  a_iteration,
int  a_subset = -1 
)
protectedvirtual

This function deals with everything about saving output images from the reconstruction.

It applies post-smoothing, post-processing, output masking, and save dynamic basis coefficients if asked for.

Implements vAlgorithm.

Definition at line 547 of file iIterativeAlgorithm.cc.

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

◆ StepInnerLoopInsideSubsetLoop()

int iIterativeAlgorithm::StepInnerLoopInsideSubsetLoop ( int  a_iteration,
int  a_subset,
int  a_bed 
)
protectedvirtual

This function is called inside the subset loop and manages the main loop over the events
The loop over the events is multithreaded, and involves a thread lock in the case of image-based deformation.

Parameters
a_iteration: iteration index
a_subset: subset index
a_bed: bed position

Step 1: Get the current event for that thread index
Step 2: Call the dynamic switch function that updates the current frame and gate numbers, and also detects involuntary patient motion
Perform image-based deformation if needed (thread lock is required)
Step 3: Compute the projection line
Step 4: Optimize in the data space (forward-proj, update, backward-proj)

Returns
0 if success, positive value otherwise.

Implements vAlgorithm.

Definition at line 154 of file iIterativeAlgorithm.cc.

Here is the call graph for this function:

◆ StepPostProcessInsideSubsetLoop()

int iIterativeAlgorithm::StepPostProcessInsideSubsetLoop ( int  a_iteration,
int  a_subset 
)
protectedvirtual

Reimplemented from vAlgorithm.

Definition at line 401 of file iIterativeAlgorithm.cc.

Here is the call graph for this function:

◆ StepPreProcessInsideSubsetLoop()

int iIterativeAlgorithm::StepPreProcessInsideSubsetLoop ( int  a_iteration,
int  a_subset 
)
protectedvirtual

This function is called right after starting the subset loop. Apply any kind of processing on the forward image before projections.

This function is called right after starting the subset loop.
Apply any kind of image processing on the backward image and main image after backprojections.

Parameters
a_iteration: iteration index
a_subset: subset index

Copy current main image into forward image matrix
Reinitialize backward image and 4D gating indices
Apply image processing/convolution on the forward image matrix (image to be projeted)

Returns
0 if success, positive value otherwise.
Parameters
a_iteration: iteration index
a_subset: subset index

Synchronize parallel results
Apply image deformation/processing/convolution on the backward image
Update the image using the optimizer functions
Apply dynamic model/image processing/convolution on the main image

Returns
0 if success, positive value otherwise.

Reimplemented from vAlgorithm.

Definition at line 104 of file iIterativeAlgorithm.cc.

Here is the call graph for this function:

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