CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
code/include/algorithm/vAlgorithm.hh
Go to the documentation of this file.
1 
8 #ifndef VALGORITHM_HH
9 #define VALGORITHM_HH 1
10 
11 #include "gVariables.hh"
12 #include "oImageDimensionsAndQuantification.hh"
13 #include "oProjectorManager.hh"
14 #include "oImageConvolverManager.hh"
15 #include "oImageProcessingManager.hh"
16 #include "oOptimizerManager.hh"
17 #include "oDeformationManager.hh"
18 #include "oDynamicModelManager.hh"
19 #include "oImageSpace.hh"
20 #include "vDataFile.hh"
21 #include "sChronoManager.hh"
22 
23 
30 {
31  // Constructor & Destructor
32  public:
38  vAlgorithm();
43  virtual ~vAlgorithm();
44 
45 
46 
47  // -------------------------------------------------------------------
48  // Public member functions
49  public:
55  int Run();
75  int RunCPU();
76  #ifdef CASTOR_GPU
77 
84  int RunGPU();
85  #endif
86 
91  inline void SetSaveSensitivityHistoFlag(bool a_saveSensitivityHistoFlag)
92  {m_saveSensitivityHistoFlag = a_saveSensitivityHistoFlag;}
98  inline void SetSaveSubsetImageFlag(bool a_saveImageAfterSubsets)
99  {m_saveImageAfterSubsets = a_saveImageAfterSubsets;}
105  inline void SetSaveDynamicBasisCoefficientImages(bool a_saveDynamicBasisCoefficients)
106  {m_saveDynamicBasisCoefficients = a_saveDynamicBasisCoefficients;}
112  inline void SetOptimizerManager(oOptimizerManager* ap_OptimizerManager)
113  {mp_OptimizerManager = ap_OptimizerManager;}
119  inline void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification)
120  {mp_ID = ap_ImageDimensionsAndQuantification;}
126  inline void SetImageSpace(oImageSpace* ap_ImageSpace)
127  {mp_ImageSpace = ap_ImageSpace;}
133  inline void SetProjectorManager(oProjectorManager* ap_ProjectorManager)
134  {mp_ProjectorManager = ap_ProjectorManager;}
140  inline void SetImageConvolverManager(oImageConvolverManager* ap_ImageConvolverManager)
141  {mp_ImageConvolverManager = ap_ImageConvolverManager;}
147  inline void SetImageProcessingManager(oImageProcessingManager* ap_ImageProcessingManager)
148  {mp_ImageProcessingManager = ap_ImageProcessingManager;}
154  inline void SetDynamicModelManager(oDynamicModelManager* ap_DynamicModelManager)
155  {mp_DynamicModelManager = ap_DynamicModelManager;}
161  inline void SetDeformationManager(oDeformationManager* ap_DeformationManager)
162  {mp_DeformationManager = ap_DeformationManager;}
168  inline void SetDataFile(vDataFile** a2p_DataFile)
169  {m2p_DataFile = a2p_DataFile;}
175  inline void SetGPUflag(bool a_flagGPU)
176  {m_flagGPU = a_flagGPU;}
182  inline void SetVerbose(int a_verboseLevel)
183  {m_verbose = a_verboseLevel;}
189  inline void SetNbBeds(int a_nbBeds)
190  {m_nbBeds = a_nbBeds;}
196  inline void SetPathInitImage(string a_pathToInitialImage)
197  {m_pathToInitialImg = a_pathToInitialImage;}
203  inline void SetPathToAttenuationImage(string a_pathToAttenuationImage)
204  {m_pathToAtnImg = a_pathToAttenuationImage;}
210  inline void SetPathToSensitivityImage(string a_pathToSensitivityImage)
211  {m_pathToSensitivityImg = a_pathToSensitivityImage;}
217  inline void SetPathToMultiModalImage(vector<string> a_pathToMultiModalImage)
218  {m_pathToMultiModalImg = a_pathToMultiModalImage;}
227  int SetNbIterationsAndSubsets(const string& a_nbIterationsSubsets);
239  int SetOutputIterations(const string& a_outputIterations);
245  virtual int InitSpecificOptions(string a_specificOptions);
250  virtual void ShowHelpSpecific(){}
251 
252 
253  // -------------------------------------------------------------------
254  // Protected member functions
255  protected:
261  virtual int StepBeforeIterationLoop();
267  virtual int StepAfterIterationLoop();
274  virtual int StepBeforeSubsetLoop(int a_iteration);
281  virtual int StepAfterSubsetLoop(int a_iteration);
289  virtual int StepPreProcessInsideSubsetLoop(int a_iteration, int a_subset);
297  virtual int StepPostProcessInsideSubsetLoop(int a_iteration, int a_subset);
307  virtual int StepInnerLoopInsideSubsetLoop(int a_iteration, int a_subset, int a_bed) = 0;
312  virtual int StepImageOutput(int a_iteration, int a_subset = -1) = 0;
313 
314 
315  // -------------------------------------------------------------------
316  // Data members
317  protected:
321  int m_verbose;
322  bool m_flagGPU;
332  int m_nbBeds;
334  string m_pathToAtnImg;
336  vector<string> m_pathToMultiModalImg;
342 };
343 
344 #endif
345 
346 
347 
348 
349 
350 
351 
352 
353 
354 
355 
356 
357 
This class is designed to be a mother virtual class for DataFile.
void SetGPUflag(bool a_flagGPU)
virtual void ShowHelpSpecific()
Show help for the child algorithm.
virtual int InitSpecificOptions(string a_specificOptions)
void SetDynamicModelManager(oDynamicModelManager *ap_DynamicModelManager)
void SetSaveSubsetImageFlag(bool a_saveImageAfterSubsets)
int SetNbIterationsAndSubsets(const string &a_nbIterationsSubsets)
oImageDimensionsAndQuantification * mp_ID
vector< string > m_pathToMultiModalImg
void SetPathInitImage(string a_pathToInitialImage)
int RunCPU()
Perform the iterative loop of the algorithm. Function designed to be executed on the CPU only...
void SetOptimizerManager(oOptimizerManager *ap_OptimizerManager)
This class is designed to manage the optimization part of an iterative reconstruction.
virtual int StepBeforeSubsetLoop(int a_iteration)
int Run()
Just call either the RunCPU or the RunGPU function as asked for.
oOptimizerManager * mp_OptimizerManager
virtual int StepImageOutput(int a_iteration, int a_subset=-1)=0
virtual int StepInnerLoopInsideSubsetLoop(int a_iteration, int a_subset, int a_bed)=0
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
oImageProcessingManager * mp_ImageProcessingManager
void SetPathToAttenuationImage(string a_pathToAttenuationImage)
virtual int StepPostProcessInsideSubsetLoop(int a_iteration, int a_subset)
vAlgorithm()
vAlgorithm constructor. Initialize the member variables to their default values.
void SetImageConvolverManager(oImageConvolverManager *ap_ImageConvolverManager)
void SetProjectorManager(oProjectorManager *ap_ProjectorManager)
This class is designed to manage the use of dynamic model in the reconstruction.
virtual int StepPreProcessInsideSubsetLoop(int a_iteration, int a_subset)
virtual int StepBeforeIterationLoop()
This function is called at the beginning of the RunCPU function.
void SetSaveDynamicBasisCoefficientImages(bool a_saveDynamicBasisCoefficients)
virtual ~vAlgorithm()
vAlgorithm destructor.
void SetImageProcessingManager(oImageProcessingManager *ap_ImageProcessingManager)
This class is designed to manage the different image convolvers and to apply them.
oImageConvolverManager * mp_ImageConvolverManager
void SetSaveSensitivityHistoFlag(bool a_saveSensitivityHistoFlag)
oProjectorManager * mp_ProjectorManager
virtual int StepAfterSubsetLoop(int a_iteration)
oDeformationManager * mp_DeformationManager
This class is designed to manage the image-based deformation part of the reconstruction.
This class is designed to manage the different image processing modules and to apply them...
void SetPathToMultiModalImage(vector< string > a_pathToMultiModalImage)
This class is designed to manage the projection part of the reconstruction.
virtual int StepAfterIterationLoop()
This function is called at the end of the RunCPU function.
This is the base class for reconstructions, containing a framework with iteration and data subset loo...
This class holds all the matrices in the image domain that can be used in the algorithm: image...
int SetOutputIterations(const string &a_outputIterations)
This class is designed to manage all dimensions and quantification related stuff. ...
void SetDataFile(vDataFile **a2p_DataFile)
void SetImageSpace(oImageSpace *ap_ImageSpace)
void SetDeformationManager(oDeformationManager *ap_DeformationManager)
void SetVerbose(int a_verboseLevel)
oDynamicModelManager * mp_DynamicModelManager
void SetPathToSensitivityImage(string a_pathToSensitivityImage)