CASToR  1.1
Tomographic Reconstruction (PET/SPECT)
 All Classes Files Functions Variables Typedefs Macros Groups Pages
oIterativeAlgorithm.hh
Go to the documentation of this file.
1 
8 #ifndef OITERATIVEALGORITHM_HH
9 #define OITERATIVEALGORITHM_HH 1
10 
11 #include "gVariables.hh"
13 #include "oProjectorManager.hh"
16 #include "oOptimizerManager.hh"
17 #include "oDeformationManager.hh"
18 #include "oDynamicModelManager.hh"
19 #include "oImageSpace.hh"
20 #include "vDataFile.hh"
21 
22 
23 
24 
31 {
32  // Constructor & Destructor
33  public:
44  virtual ~oIterativeAlgorithm();
45 
46 
47 
48  // -------------------------------------------------------------------
49  // Public member functions
50  public:
56  int Iterate();
78  int IterateCPU();
79  #ifdef CASTOR_GPU
80 
88  int IterateGPU();
89  #endif
90 
95  inline void SetSaveSensitivityHistoFlag(bool a_saveSensitivityHistoFlag) {m_saveSensitivityHistoFlag = a_saveSensitivityHistoFlag;}
101  inline void SetSaveSubsetImageFlag(bool a_saveImageAfterSubsets) {m_saveImageAfterSubsets = a_saveImageAfterSubsets;}
107  inline void SetOptimizerManager(oOptimizerManager* ap_OptimizerManager) {mp_OptimizerManager = ap_OptimizerManager;}
113  inline void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification) {mp_ID = ap_ImageDimensionsAndQuantification;};
119  inline void SetImageSpace(oImageSpace* ap_ImageSpace) {mp_ImageSpace = ap_ImageSpace;};
125  inline void SetProjectorManager(oProjectorManager* ap_ProjectorManager) {mp_ProjectorManager = ap_ProjectorManager;};
131  inline void SetImageConvolverManager(oImageConvolverManager* ap_ImageConvolverManager) {mp_ImageConvolverManager = ap_ImageConvolverManager;}
137  inline void SetImageProcessingManager(oImageProcessingManager* ap_ImageProcessingManager) {mp_ImageProcessingManager = ap_ImageProcessingManager;}
143  inline void SetDynamicModelManager(oDynamicModelManager* ap_DynamicModelManager) {mp_DynamicModelManager = ap_DynamicModelManager;}
149  inline void SetDeformationManager(oDeformationManager* ap_DeformationManager) {mp_DeformationManager = ap_DeformationManager;}
155  inline void SetDataFile(vDataFile** a2p_DataFile) {m2p_DataFile = a2p_DataFile;};
161  inline void SetGPUflag(bool a_flagGPU) {m_flagGPU = a_flagGPU;};
167  inline void SetVerbose(int a_verboseLevel) {m_verbose = a_verboseLevel;};
173  inline void SetNbBeds(int a_nbBeds) {m_nbBeds = a_nbBeds;};
179  inline void SetPathInitImage(string a_pathToInitialImage) {m_pathToInitialImg = a_pathToInitialImage;};
185  inline void SetPathToAttenuationImage(string a_pathToAttenuationImage) {m_pathToAtnImg = a_pathToAttenuationImage;};
191  inline void SetPathToSensitivityImage(string a_pathToSensitivityImage) {m_pathToSensitivityImg = a_pathToSensitivityImage;};
197  inline void SetPathToAnatomicalImage(string a_pathToAnatomicalImage) {m_pathToAnatomicalImg = a_pathToAnatomicalImage;};
203  inline void SetPathToMaskImage(string a_pathToMaskImage) {m_pathToMaskImg = a_pathToMaskImage;};
212  int SetNbIterationsAndSubsets(const string& a_nbIterationsSubsets);
224  int SetOutputIterations(const string& a_outputIterations);
232  virtual int InitSpecificOptions(string a_specificOptions);
233 
234 
235 
236  // -------------------------------------------------------------------
237  // Protected member functions
238  protected:
246  virtual int StepBeforeIterationLoop();
254  virtual int StepAfterIterationLoop();
261  virtual int StepBeforeSubsetLoop(int a_iteration);
272  virtual int StepAfterSubsetLoop(int a_iteration);
286  virtual int StepPreProcessInsideSubsetLoop(int a_iteration, int a_subset);
300  virtual int StepPostProcessInsideSubsetLoop(int a_iteration, int a_subset);
316  virtual int StepInnerLoopInsideSubsetLoop(int a_iteration, int a_subset, int a_bed);
317 
318 
319 
320  // -------------------------------------------------------------------
321  // ----- Functions related to OpenMP barrier -----
326  void ThreadBarrierIncrement();
332  bool ThreadBarrierFlag();
338  bool ThreadBarrierCheck();
344  void ThreadBarrierSetOff();
350  void ThreadBarrierSetOn();
351 
352 
353 
354  // -------------------------------------------------------------------
355  // Data members
356  protected:
360  int m_verbose;
361  bool m_flagGPU;
371  int m_nbBeds;
373  string m_pathToAtnImg;
380 };
381 
382 #endif
383 
384 
385 
386 
387 
388 
389 
390 
391 
392 
393 
394 
395 
This class is designed to be a mother virtual class for Datafile.
Definition: vDataFile.hh:67
This header file is mainly used to declare some macro definitions and all includes needed from the st...
Declaration of class oDynamicModelManager.
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
Set the Image Dimensions and Quantification Object.
Declaration of class oImageDimensionsAndQuantification.
int Iterate()
Just call either the IterateCPU or the IterateGPU function as asked for.
int SetNbIterationsAndSubsets(const string &a_nbIterationsSubsets)
Set the number of iterations and subsets.
void SetGPUflag(bool a_flagGPU)
Set the GPU flag.
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 o...
void SetProjectorManager(oProjectorManager *ap_ProjectorManager)
Set the Projector Manager Object.
void SetSaveSensitivityHistoFlag(bool a_saveSensitivityHistoFlag)
Set the flag that specifies if the sensitivity image in histogram mode has to be saved for each subse...
void SetDeformationManager(oDeformationManager *ap_DeformationManager)
Set the Deformation Manager Object.
Declaration of class oDeformationManager.
virtual int StepAfterIterationLoop()
This function is called at the end of the IterateCPU function.
void SetPathToSensitivityImage(string a_pathToSensitivityImage)
Set path to the sensitivity image.
This class is designed to manage the optimization part of an iterative reconstruction.
void ThreadBarrierSetOff()
Disable the thread locking variable (thread safe), and reset the number of waiting threads to 0...
void ThreadBarrierSetOn()
Enable the thread locking variable (thread safe), and reset the number of waiting threads to 0...
oIterativeAlgorithm()
oIterativeAlgorithm constructor. Initialize the member variables to their default values...
int SetOutputIterations(const string &a_outputIterations)
Set the selected output iterations.
void SetVerbose(int a_verboseLevel)
Set Verbosity.
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.
bool ThreadBarrierCheck()
Check if all the threads are currently in waiting condition.
virtual int StepAfterSubsetLoop(int a_iteration)
This function is called after finishing the subset loop.
oImageProcessingManager * mp_ImageProcessingManager
bool ThreadBarrierFlag()
Check if the m_releaseThreads boolean is enabled or not.
oImageConvolverManager * mp_ImageConvolverManager
void SetSaveSubsetImageFlag(bool a_saveImageAfterSubsets)
Set the flag that specifies if the image has to be saved for each subset.
Declaration of class oImageConvolverManager.
oDynamicModelManager * mp_DynamicModelManager
This class is designed to manage the use of dynamic model in the reconstruction.
Declaration of class vDataFile.
virtual int StepPostProcessInsideSubsetLoop(int a_iteration, int a_subset)
void SetNbBeds(int a_nbBeds)
Set number of beds (bed positions)
oDeformationManager * mp_DeformationManager
void SetImageProcessingManager(oImageProcessingManager *ap_ImageProcessingManager)
Set the Image Processing Manager Object.
void SetPathInitImage(string a_pathToInitialImage)
Set path to an initial image.
This class is designed to manage the different image convolvers and to apply them.
void SetPathToAttenuationImage(string a_pathToAttenuationImage)
This function is used to set the path to the attenuation image.
void SetPathToMaskImage(string a_pathToMaskImage)
Set path to a mask image.
virtual int StepBeforeIterationLoop()
This function is called at the beginning of the IterateCPU function.
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.
This class is designed to manage the image-based deformation part of the reconstruction.
Declaration of class oImageSpace.
This class is designed to manage the different image processing modules and to apply them...
This class is designed to manage the projection part of the reconstruction.
Declaration of class oImageProcessingManager.
virtual int InitSpecificOptions(string a_specificOptions)
Set the selected output iterations.
This class holds all the matrices in the image domain that can be used in the algorithm: image...
Definition: oImageSpace.hh:41
virtual int StepBeforeSubsetLoop(int a_iteration)
This function is called before starting the subset loop.
void SetImageSpace(oImageSpace *ap_ImageSpace)
Set the Image Space Object.
void SetImageConvolverManager(oImageConvolverManager *ap_ImageConvolverManager)
Set the Image Convolver Manager Object.
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 for...
This class is designed to manage all dimensions and quantification related stuff. ...
oOptimizerManager * mp_OptimizerManager
Declaration of class oOptimizerManager.
void SetPathToAnatomicalImage(string a_pathToAnatomicalImage)
Set path to an anatomical image.
oProjectorManager * mp_ProjectorManager
void SetOptimizerManager(oOptimizerManager *ap_OptimizerManager)
Set the Optimizer Manager Object.
Declaration of class oProjectorManager.
void ThreadBarrierIncrement()
Increment (thread safe) the m_nbThreadsWaiting variable.
void SetDataFile(vDataFile **a2p_DataFile)
Set the list of DataFile.
void SetDynamicModelManager(oDynamicModelManager *ap_DynamicModelManager)
Set the Dynamic Model Manager Object.
oImageDimensionsAndQuantification * mp_ID
virtual ~oIterativeAlgorithm()
oIterativeAlgorithm destructor.