CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
include/projector/vProjector.hh
Go to the documentation of this file.
1 
8 #ifndef VPROJECTOR_HH
9 #define VPROJECTOR_HH 1
10 
11 #include "gVariables.hh"
12 #include "vEvent.hh"
13 #include "oProjectionLine.hh"
14 #include "vScanner.hh"
15 #include "oImageDimensionsAndQuantification.hh"
16 
25 #define USE_TOFHISTO 1
26 
27 #define USE_TOFLIST 2
28 
29 #define USE_NOTOF 3
30 
53 class vProjector
54 {
55  // -------------------------------------------------------------------
56  // Constructor & Destructor
57  public:
64  vProjector();
72  virtual ~vProjector();
73 
74 
75  // -------------------------------------------------------------------
76  // Public member functions
77  public:
83  void ShowHelp();
89  static void ShowCommonHelp();
95  int ReadCommonOptionsList(const string& a_optionsList);
104  int CheckParameters();
114  int Initialize();
137  int Project(int a_direction, oProjectionLine* ap_ProjectionLine, uint32_t* ap_index1, uint32_t* ap_index2, int a_nbIndices);
138 
139 
140  // -------------------------------------------------------------------
141  // Virtual but not pure for children
142  public:
153 
154 
155  // -------------------------------------------------------------------
156  // Pure virtual public member functions that need to be implemented by children
157  public:
168  virtual int ReadConfigurationFile(const string& a_configurationFile) = 0;
179  virtual int ReadOptionsList(const string& a_optionsList) = 0;
180 
181 
182  // -------------------------------------------------------------------
183  // Pure virtual private member functions that need to be implemented by children
184  private:
193  virtual void ShowHelpSpecific() = 0;
202  virtual int CheckSpecificParameters() = 0;
212  virtual int InitializeSpecific() = 0;
222  virtual int ProjectWithoutTOF( int a_direction, oProjectionLine* ap_ProjectionLine ) = 0;
233  virtual int ProjectTOFListmode( int a_direction, oProjectionLine* ap_ProjectionLine ) = 0;
244  virtual int ProjectTOFHistogram( int a_direction, oProjectionLine* ap_ProjectionLine ) = 0;
245 
246 
247  // -------------------------------------------------------------------
248  // Public Get & Set functions
249  public:
255  inline void SetVerbose(int a_verbose)
256  {m_verbose = a_verbose;}
262  inline void SetScanner(vScanner* ap_Scanner)
263  {mp_Scanner = ap_Scanner;}
269  inline void SetSensitivityMode(bool a_sensitivityMode)
270  {m_sensitivityMode = a_sensitivityMode;}
276  inline void SetApplyTOF(int a_applyTOF)
277  {m_TOFMethod = a_applyTOF;}
283  inline void SetApplyPOI(bool a_applyPOI)
284  {m_applyPOI = a_applyPOI;}
291  int SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification);
309  inline void SetMask(bool* ap_mask){ mp_mask = ap_mask; m_hasMask = true;}
316  {return m_TOFResolutionInMm;}
322  inline void SetTOFResolutionInMm(FLTNB a_TOFResolutionInMm)
323  {m_TOFResolutionInMm = a_TOFResolutionInMm;}
330  {return m_TOFMeasurementRangeInMm;}
336  inline void SetTOFMeasurementRangeInMm(FLTNB a_TOFMeasurementRangeInMm)
337  {m_TOFMeasurementRangeInMm = a_TOFMeasurementRangeInMm;}
344  {return m_TOFBinSizeInMm;}
350  inline void SetTOFBinSizeInMm(FLTNB a_TOFBinSizeInMm)
351  {m_TOFBinSizeInMm = a_TOFBinSizeInMm;}
357  inline void SetReadPerEventTOFResolution(bool a_readPerEventTOFResolution)
358  { m_readPerEventTOFResolution = a_readPerEventTOFResolution;}
359  // -------------------------------------------------------------------
360  // Data members
361  protected:
362  // Few data from the oImageDimensionsAndQuantification to avoid getting them too often
363  FLTNB mp_sizeVox[3];
364  INTNB mp_nbVox[3];
365  INTNB m_nbVoxXY;
366  FLTNB mp_halfFOV[3];
367  // Image dimensions
370  // Scanner
372  // TOF related
373  int m_TOFMethod;
385  // Voxel mask to remove voxels from projection
386  bool* mp_mask;
387  bool m_hasMask;
388  // Flag for POI
389  bool m_applyPOI;
390  // Flag for sensitivity computation
391  bool m_sensitivityMode;
392  // Flag that says if the projector is compatible with SPECT attenuation correction
394  // Flag that says if the projection is compatible with compression
395  // (i.e. when the crystal indices in the projection line will be -1 as they are not unique for a given event)
397  // Verbosity
398  int m_verbose;
399  // Has been checked ?
400  bool m_checked;
401  // Has been initialized ?
402  bool m_initialized;
403 };
404 
405 // ----------------------------------------------------------------------
406 // Part of code that manages the auto declaration of children classes
407 // ----------------------------------------------------------------------
408 
409 // Macro for the function that creates the object
410 #define FUNCTION_PROJECTOR(CLASS) \
411  static vProjector *make_projector() { return new CLASS(); };
412 
413 // Macro for the class that links the appropriate function to the map of objects
414 #define CLASS_PROJECTOR(NAME,CLASS) \
415  class NAME##ProjectorCreator \
416  { \
417  public: \
418  NAME##ProjectorCreator() \
419  { sAddonManager::GetInstance()->mp_listOfProjectors[#NAME] = CLASS::make_projector; } \
420  }; \
421  static NAME##ProjectorCreator ProjectorCreator##NAME;
422 
423 #endif
static void ShowCommonHelp()
This function is used to print out some help about the use of options common to all projectors...
bool GetCompatibilityWithSPECTAttenuationCorrection()
virtual int ReadOptionsList(const string &a_optionsList)=0
This class is designed to generically described any on-the-fly projector.
virtual int ReadConfigurationFile(const string &a_configurationFile)=0
vProjector()
The constructor of vProjector.
void SetMask(bool *ap_mask)
int Initialize()
A public function used to initialize the projector.
virtual int ProjectTOFHistogram(int a_direction, oProjectionLine *ap_ProjectionLine)=0
int Project(int a_direction, oProjectionLine *ap_ProjectionLine, uint32_t *ap_index1, uint32_t *ap_index2, int a_nbIndices)
void SetVerbose(int a_verbose)
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
Declaration of class oProjectionLine.
virtual int ProjectWithoutTOF(int a_direction, oProjectionLine *ap_ProjectionLine)=0
void SetScanner(vScanner *ap_Scanner)
void SetTOFResolutionInMm(FLTNB a_TOFResolutionInMm)
virtual int CheckSpecificParameters()=0
A private function used to check the parameters settings specific to the child projector.
int ReadCommonOptionsList(const string &a_optionsList)
void SetApplyTOF(int a_applyTOF)
virtual void ShowHelpSpecific()=0
A function used to show help about the child module.
virtual ~vProjector()
The destructor of vProjector.
void SetTOFBinSizeInMm(FLTNB a_TOFBinSizeInMm)
int CheckParameters()
A public function used to check the parameters settings.
void SetReadPerEventTOFResolution(bool a_readPerEventTOFResolution)
This function is used to set flag informing that TOF resolution should be read per event from datafil...
void SetTOFMeasurementRangeInMm(FLTNB a_TOFMeasurementRangeInMm)
FLTNB GetTOFResolutionInMm()
This function is used to get the TOF resolution in mm.
This class is designed to manage and store system matrix elements associated to a vEvent...
virtual int ProjectTOFListmode(int a_direction, oProjectionLine *ap_ProjectionLine)=0
virtual int InitializeSpecific()=0
A private function used to initialize everything specific to the child projector. ...
void SetApplyPOI(bool a_applyPOI)
This class is designed to manage all dimensions and quantification related stuff. ...
virtual INTNB EstimateMaxNumberOfVoxelsPerLine()
This function is used to compute and provide an estimate of the maximum number of voxels that could c...
void ShowHelp()
A function used to show help about the projector.
int SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
void SetSensitivityMode(bool a_sensitivityMode)
Generic class for scanner objects.