CASToR
1.1
Tomographic Reconstruction (PET/SPECT)
|
This is the main class for iterative reconstructions, that manages the iteration loops.
This class manages an iterative reconstruction of any kind, using a vDataFile, and through the use of an oProjector, an oOptimizer, a oConvolver, a oImageSpace.
More...
#include <oIterativeAlgorithm.hh>
Public Member Functions | |
oIterativeAlgorithm () | |
oIterativeAlgorithm constructor. Initialize the member variables to their default values. More... | |
virtual | ~oIterativeAlgorithm () |
oIterativeAlgorithm destructor. More... | |
int | Iterate () |
Just call either the IterateCPU or the IterateGPU function as asked for. More... | |
int | IterateCPU () |
Perform the iterative loop of the algorithm, call the different object for optimization, projection, update, etc. 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 | 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 | SetPathToAnatomicalImage (string a_pathToAnatomicalImage) |
Set path to an anatomical image. 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 int | InitSpecificOptions (string a_specificOptions) |
Set the selected output iterations. More... | |
Protected Member Functions | |
virtual int | StepBeforeIterationLoop () |
This function is called at the beginning of the IterateCPU function. More... | |
virtual int | StepAfterIterationLoop () |
This function is called at the end of the IterateCPU function. More... | |
virtual int | StepBeforeSubsetLoop (int a_iteration) |
This function is called before starting the subset loop. More... | |
virtual int | StepAfterSubsetLoop (int a_iteration) |
This function is called after finishing the subset loop. More... | |
virtual 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... | |
virtual int | StepPostProcessInsideSubsetLoop (int a_iteration, int a_subset) |
virtual 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... | |
void | ThreadBarrierIncrement () |
Increment (thread safe) the m_nbThreadsWaiting variable. More... | |
bool | ThreadBarrierFlag () |
Check if the m_releaseThreads boolean is enabled or not. More... | |
bool | ThreadBarrierCheck () |
Check if all the threads are currently in waiting condition. More... | |
void | ThreadBarrierSetOff () |
Disable the thread locking variable (thread safe), and reset the number of waiting threads to 0. More... | |
void | ThreadBarrierSetOn () |
Enable the thread locking variable (thread safe), and reset the number of waiting threads to 0. More... | |
Protected Attributes | |
int | m_nbIterations |
int * | mp_nbSubsets |
bool * | mp_outputIterations |
int | m_verbose |
bool | m_flagGPU |
oImageDimensionsAndQuantification * | mp_ID |
vDataFile ** | m2p_DataFile |
oProjectorManager * | mp_ProjectorManager |
oOptimizerManager * | mp_OptimizerManager |
oDeformationManager * | mp_DeformationManager |
oDynamicModelManager * | mp_DynamicModelManager |
oImageSpace * | mp_ImageSpace |
oImageConvolverManager * | mp_ImageConvolverManager |
oImageProcessingManager * | mp_ImageProcessingManager |
int | m_nbBeds |
string | m_pathToInitialImg |
string | m_pathToAtnImg |
string | m_pathToSensitivityImg |
string | m_pathToAnatomicalImg |
string | m_pathToMaskImg |
bool | m_saveSensitivityHistoFlag |
bool | m_saveImageAfterSubsets |
bool | m_generalizedImplementation |
This is the main class for iterative reconstructions, that manages the iteration loops.
This class manages an iterative reconstruction of any kind, using a vDataFile, and through the use of an oProjector, an oOptimizer, a oConvolver, a oImageSpace.
Definition at line 30 of file oIterativeAlgorithm.hh.
oIterativeAlgorithm::oIterativeAlgorithm | ( | ) |
oIterativeAlgorithm constructor. Initialize the member variables to their default values.
Definition at line 32 of file oIterativeAlgorithm.cc.
|
virtual |
oIterativeAlgorithm destructor.
Definition at line 68 of file oIterativeAlgorithm.cc.
|
virtual |
Set the selected output iterations.
a_specificOptions |
Not Implemented yet
Definition at line 1008 of file oIterativeAlgorithm.cc.
int oIterativeAlgorithm::Iterate | ( | ) |
Just call either the IterateCPU or the IterateGPU function as asked for.
Definition at line 249 of file oIterativeAlgorithm.cc.
int oIterativeAlgorithm::IterateCPU | ( | ) |
Perform the iterative loop of the algorithm, call the different object for optimization, projection, update, etc. Function designed to be executed on the CPU only.
Loops over the iterations, subsets, bed position
Call functions related to each steps of iterative reconstruction:
StepBeforeIterationLoop()
/ Loop on iterations
| StepBeforeSubsetLoop(iteration)
| / Loop on subsets
| | StepPreProcessInsideSubsetLoop(iteration,subset)
| | / Loop on bed positions
| | | StepInnerLoopInsideSubsetLoop(iteration,subset,bed)
| | StepPostProcessInsideSubsetLoop(iteration,subset)
| StepAfterSubsetLoop(iteration)
StepAfterIterationLoop()
Definition at line 288 of file oIterativeAlgorithm.cc.
|
inline |
Set the list of DataFile.
a2p_DataFile |
Definition at line 155 of file oIterativeAlgorithm.hh.
|
inline |
Set the Deformation Manager Object.
ap_DeformationManager |
Definition at line 149 of file oIterativeAlgorithm.hh.
|
inline |
Set the Dynamic Model Manager Object.
ap_DynamicModelManager |
Definition at line 143 of file oIterativeAlgorithm.hh.
|
inline |
Set the GPU flag.
a_flagGPU |
Definition at line 161 of file oIterativeAlgorithm.hh.
|
inline |
Set the Image Convolver Manager Object.
ap_ImageConvolverManager |
Definition at line 131 of file oIterativeAlgorithm.hh.
|
inline |
Set the Image Dimensions and Quantification Object.
ap_ImageDimensionsAndQuantification |
Definition at line 113 of file oIterativeAlgorithm.hh.
|
inline |
Set the Image Processing Manager Object.
ap_ImageProcessingManager |
Definition at line 137 of file oIterativeAlgorithm.hh.
|
inline |
Set the Image Space Object.
ap_ImageSpace |
Definition at line 119 of file oIterativeAlgorithm.hh.
|
inline |
Set number of beds (bed positions)
a_nbBeds |
Definition at line 173 of file oIterativeAlgorithm.hh.
int oIterativeAlgorithm::SetNbIterationsAndSubsets | ( | const string & | a_nbIterationsSubsets | ) |
Set the number of iterations and subsets.
a_nbIterationsSubsets |
The provided string is a list of iteration:subset pairs separated by commas.
Definition at line 203 of file oIterativeAlgorithm.hh.
|
inline |
Set the Optimizer Manager Object.
ap_OptimizerManager |
Definition at line 107 of file oIterativeAlgorithm.hh.
int oIterativeAlgorithm::SetOutputIterations | ( | const string & | a_outputIterations | ) |
Set the selected output iterations.
a_outputIterations |
The provided string is a list of couple a:b separated by commas.
It means that we save one iteration over a until b is reached.
"b" must be incrementing for each successive couples. If the list is empty, we save all iterations by default.
If the list is equal to "-1", then we save only the last iteration.
Definition at line 156 of file oIterativeAlgorithm.cc.
|
inline |
Set path to an initial image.
a_pathToInitialImage |
Definition at line 179 of file oIterativeAlgorithm.hh.
|
inline |
Set path to an anatomical image.
a_pathToAnatomicalImage |
Definition at line 197 of file oIterativeAlgorithm.hh.
|
inline |
This function is used to set the path to the attenuation image.
string | a_pathToAttenuationImage |
Definition at line 185 of file oIterativeAlgorithm.hh.
|
inline |
Set path to a mask image.
a_pathToMaskImage |
Definition at line 203 of file oIterativeAlgorithm.hh.
|
inline |
Set path to the sensitivity image.
a_pathToSensitivityImage |
Definition at line 191 of file oIterativeAlgorithm.hh.
|
inline |
Set the Projector Manager Object.
ap_ProjectorManager |
Definition at line 125 of file oIterativeAlgorithm.hh.
|
inline |
Set the flag that specifies if the sensitivity image in histogram mode has to be saved for each subset/iteration.
bool | a_saveSensitivityHistoFlag |
Definition at line 95 of file oIterativeAlgorithm.hh.
|
inline |
Set the flag that specifies if the image has to be saved for each subset.
bool | a_saveImageAfterSubsets |
Definition at line 101 of file oIterativeAlgorithm.hh.
|
inline |
Set Verbosity.
a_verboseLevel |
Definition at line 167 of file oIterativeAlgorithm.hh.
|
protectedvirtual |
This function is called at the end of the IterateCPU function.
Free Memory for the imageSpace and some managers
Definition at line 978 of file oIterativeAlgorithm.cc.
|
protectedvirtual |
This function is called after finishing the subset loop.
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
Definition at line 912 of file oIterativeAlgorithm.cc.
|
protectedvirtual |
This function is called at the beginning of the IterateCPU function.
Initialization and memory allocation for the imageSpace and some managers
Definition at line 417 of file oIterativeAlgorithm.cc.
|
protectedvirtual |
This function is called before starting the subset loop.
a_iteration | : iteration index |
Definition at line 482 of file oIterativeAlgorithm.cc.
|
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.
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)
Definition at line 560 of file oIterativeAlgorithm.cc.
|
protectedvirtual |
Definition at line 797 of file oIterativeAlgorithm.cc.
|
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.
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)
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
Definition at line 506 of file oIterativeAlgorithm.cc.
|
protected |
Check if all the threads are currently in waiting condition.
Definition at line 1071 of file oIterativeAlgorithm.cc.
|
protected |
Check if the m_releaseThreads boolean is enabled or not.
Definition at line 1051 of file oIterativeAlgorithm.cc.
|
protected |
Increment (thread safe) the m_nbThreadsWaiting variable.
Definition at line 1030 of file oIterativeAlgorithm.cc.
|
protected |
Disable the thread locking variable (thread safe), and reset the number of waiting threads to 0.
Definition at line 1089 of file oIterativeAlgorithm.cc.
|
protected |
Enable the thread locking variable (thread safe), and reset the number of waiting threads to 0.
Definition at line 1109 of file oIterativeAlgorithm.cc.
|
protected |
Pointer to the array of vDataFile object
Definition at line 363 of file oIterativeAlgorithm.hh.
|
protected |
Do we use GPU or not (default=false)
Definition at line 361 of file oIterativeAlgorithm.hh.
|
protected |
No purpose yet. For upcoming features
Definition at line 379 of file oIterativeAlgorithm.hh.
|
protected |
number of bed FOVs (1 datafile by bed) (default=-1)
Definition at line 371 of file oIterativeAlgorithm.hh.
|
protected |
Number of iterations (default=1)
Definition at line 357 of file oIterativeAlgorithm.hh.
|
protected |
String containing the path to an anatomical image
Definition at line 375 of file oIterativeAlgorithm.hh.
|
protected |
String of the path to the attenuation images
Definition at line 373 of file oIterativeAlgorithm.hh.
|
protected |
String containing the path to an initialization image
Definition at line 372 of file oIterativeAlgorithm.hh.
|
protected |
String containing the path to a mask image
Definition at line 376 of file oIterativeAlgorithm.hh.
|
protected |
String containing the path to a sensitivity image
Definition at line 374 of file oIterativeAlgorithm.hh.
|
protected |
Flag specifying that the image has to be saved after each subset
Definition at line 378 of file oIterativeAlgorithm.hh.
|
protected |
Flag specifying that the sensitivity image has to be saved for each subset/iteration in histogram mode
Definition at line 377 of file oIterativeAlgorithm.hh.
|
protected |
Verbosity (default=-1)
Definition at line 360 of file oIterativeAlgorithm.hh.
|
protected |
Pointer to the Deformation Manager object
Definition at line 366 of file oIterativeAlgorithm.hh.
|
protected |
Pointer to the Dynamic Model Manager object
Definition at line 367 of file oIterativeAlgorithm.hh.
|
protected |
Pointer to the oImageDimensionsAndQuantification object
Definition at line 362 of file oIterativeAlgorithm.hh.
|
protected |
Pointer to the Image Convolver Manager object
Definition at line 369 of file oIterativeAlgorithm.hh.
|
protected |
Pointer to the Image Processing Manager object
Definition at line 370 of file oIterativeAlgorithm.hh.
|
protected |
Pointer to the Image Space object
Definition at line 368 of file oIterativeAlgorithm.hh.
|
protected |
Number of subsets (default=1)
Definition at line 358 of file oIterativeAlgorithm.hh.
|
protected |
Pointer to the Optimizer Manager object
Definition at line 365 of file oIterativeAlgorithm.hh.
|
protected |
A boolean for each iteration saying if we save it or not
Definition at line 359 of file oIterativeAlgorithm.hh.
|
protected |
Pointer to the Projector Manager object
Definition at line 364 of file oIterativeAlgorithm.hh.