CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
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 
29 class vAlgorithm
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);
233  inline void SetNbSkippedIterations(const string& a_skippedIterations)
234  {m_nbSkippedIterations = atoi(a_skippedIterations.c_str());}
246  int SetOutputIterations(const string& a_outputIterations);
252  virtual int InitSpecificOptions(string a_specificOptions);
257  virtual void ShowHelpSpecific(){}
258 
259 
260  // -------------------------------------------------------------------
261  // Protected member functions
262  protected:
268  virtual int StepBeforeIterationLoop();
274  virtual int StepAfterIterationLoop();
281  virtual int StepBeforeSubsetLoop(int a_iteration);
288  virtual int StepAfterSubsetLoop(int a_iteration);
296  virtual int StepPreProcessInsideSubsetLoop(int a_iteration, int a_subset);
304  virtual int StepPostProcessInsideSubsetLoop(int a_iteration, int a_subset);
314  virtual int StepInnerLoopInsideSubsetLoop(int a_iteration, int a_subset, int a_bed) = 0;
319  virtual int StepImageOutput(int a_iteration, int a_subset = -1) = 0;
320 
321 
322  // -------------------------------------------------------------------
323  // Data members
324  protected:
325  int m_nbIterations;
327  int* mp_nbSubsets;
328  bool* mp_outputIterations;
329  int m_verbose;
330  bool m_flagGPU;
340  int m_nbBeds;
341  string m_pathToInitialImg;
342  string m_pathToAtnImg;
343  string m_pathToSensitivityImg;
344  vector<string> m_pathToMultiModalImg;
348 };
349 
350 #endif
351 
352 
353 
354 
355 
356 
357 
358 
359 
360 
361 
362 
363 
This class is designed to be a mother virtual class for DataFile.
void SetGPUflag(bool a_flagGPU)
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 SetNbBeds(int a_nbBeds)
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
virtual void ShowHelpSpecific()
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 SetNbSkippedIterations(const string &a_skippedIterations)
Set the number of first iterations to be skipped.
void SetDeformationManager(oDeformationManager *ap_DeformationManager)
void SetVerbose(int a_verboseLevel)
oDynamicModelManager * mp_DynamicModelManager
void SetPathToSensitivityImage(string a_pathToSensitivityImage)