CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
code/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 #include "sChronoManager.hh"
17 
26 #define USE_TOFHISTO 1
27 
28 #define USE_TOFLIST 2
29 
30 #define USE_NOTOF 3
31 
55 {
56  // -------------------------------------------------------------------
57  // Constructor & Destructor
58  public:
65  vProjector();
73  virtual ~vProjector();
74 
75 
76  // -------------------------------------------------------------------
77  // Public member functions
78  public:
84  void ShowHelp();
90  static void ShowCommonHelp();
96  int ReadCommonOptionsList(const string& a_optionsList);
105  int CheckParameters();
115  int Initialize();
138  int Project(int a_direction, oProjectionLine* ap_ProjectionLine, uint32_t* ap_index1, uint32_t* ap_index2, int a_nbIndices);
139 
140 
141  // -------------------------------------------------------------------
142  // Virtual but not pure for children
143  public:
154 
155 
156  // -------------------------------------------------------------------
157  // Pure virtual public member functions that need to be implemented by children
158  public:
169  virtual int ReadConfigurationFile(const string& a_configurationFile) = 0;
180  virtual int ReadOptionsList(const string& a_optionsList) = 0;
181 
182 
183  // -------------------------------------------------------------------
184  // Pure virtual private member functions that need to be implemented by children
185  private:
194  virtual void ShowHelpSpecific() = 0;
203  virtual int CheckSpecificParameters() = 0;
213  virtual int InitializeSpecific() = 0;
223  virtual int ProjectWithoutTOF( int a_direction, oProjectionLine* ap_ProjectionLine ) = 0;
234  virtual int ProjectTOFListmode( int a_direction, oProjectionLine* ap_ProjectionLine ) = 0;
245  virtual int ProjectTOFHistogram( int a_direction, oProjectionLine* ap_ProjectionLine ) = 0;
246 
247 
248  // -------------------------------------------------------------------
249  // Public Get & Set functions
250  public:
256  inline void SetVerbose(int a_verbose)
257  {m_verbose = a_verbose;}
263  inline void SetScanner(vScanner* ap_Scanner)
264  {mp_Scanner = ap_Scanner;}
270  inline void SetSensitivityMode(bool a_sensitivityMode)
271  {m_sensitivityMode = a_sensitivityMode;}
277  inline void SetApplyTOF(int a_applyTOF)
278  {m_TOFMethod = a_applyTOF;}
284  inline void SetApplyPOI(bool a_applyPOI)
285  {m_applyPOI = a_applyPOI;}
292  int SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification);
310  inline void SetMask(bool* ap_mask){ mp_mask = ap_mask; m_hasMask = true;}
317  inline FLTNB GetTOFResolutionInMm(int a_resolution)
318  {return mp_TOFResolutionInMm[a_resolution];}
325  inline FLTNB GetTOFProbabilities(int a_resolution)
326  {return mp_TOFProbabilities[a_resolution];}
333  inline FLTNB GetTOFOffsetInMm(int a_resolution)
334  {return mp_TOFOffsetInMm[ a_resolution ];}
340  inline void SetTOFResolutionInMm(FLTNB* ap_TOFResolutionInMm)
341  {mp_TOFResolutionInMm = ap_TOFResolutionInMm;}
347  inline void SetTOFProbabilities(FLTNB* ap_TOFProbabilities)
348  {mp_TOFProbabilities = ap_TOFProbabilities;}
354  inline void SetTOFOffsetInMm(FLTNB* ap_TOFOffsetsInMm)
355  {mp_TOFOffsetInMm = ap_TOFOffsetsInMm;}
362  {return m_TOFMeasurementRangeInMm;}
368  inline void SetTOFMeasurementRangeInMm(FLTNB a_TOFMeasurementRangeInMm)
369  {m_TOFMeasurementRangeInMm = a_TOFMeasurementRangeInMm;}
375  inline void SetTOFEventResolutionFlag(FLTNB a_TOFEventResolutionFlag)
376  {m_TOFEventResolutionFlag = a_TOFEventResolutionFlag;}
382  {return m_TOFEventResolutionFlag;}
383 
390  {return m_TOFBinSizeInMm;}
396  inline void SetTOFBinSizeInMm(FLTNB a_TOFBinSizeInMm)
397  {m_TOFBinSizeInMm = a_TOFBinSizeInMm;}
398 
403  inline int GetNbTOFResolutions()
404  {return m_nbTOFResolutions;}
405 
411  inline void SetNbTOFResolutions(int a_nbTOFResolutions)
412  {m_nbTOFResolutions = a_nbTOFResolutions;}
413 
414  // -------------------------------------------------------------------
415  // Data members
416  protected:
417  // Few data from the oImageDimensionsAndQuantification to avoid getting them too often
422  // Image dimensions
425  // Scanner
427  // TOF related
444  // Voxel mask to remove voxels from projection
445  bool* mp_mask;
446  bool m_hasMask;
447  // Flag for POI
448  bool m_applyPOI;
449  // Flag for sensitivity computation
451  // Flag that says if the projector is compatible with SPECT attenuation correction
453  // Flag that says if the projection is compatible with compression
454  // (i.e. when the crystal indices in the projection line will be -1 as they are not unique for a given event)
456  // Verbosity
457  int m_verbose;
458  // Has been checked ?
459  bool m_checked;
460  // Has been initialized ?
462 };
463 
464 // ----------------------------------------------------------------------
465 // Part of code that manages the auto declaration of children classes
466 // ----------------------------------------------------------------------
467 
468 // Macro for the function that creates the object
469 #define FUNCTION_PROJECTOR(CLASS) \
470  static vProjector *make_projector() { return new CLASS(); };
471 
472 // Macro for the class that links the appropriate function to the map of objects
473 #define CLASS_PROJECTOR(NAME,CLASS) \
474  class NAME##ProjectorCreator \
475  { \
476  public: \
477  NAME##ProjectorCreator() \
478  { sAddonManager::GetInstance()->mp_listOfProjectors[#NAME] = CLASS::make_projector; } \
479  }; \
480  static NAME##ProjectorCreator ProjectorCreator##NAME;
481 
482 #endif
FLTNB GetTOFBinSizeInMm()
This function is used to get the size in mm of a TOF bin.
static void ShowCommonHelp()
This function is used to print out some help about the use of options common to all projectors...
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.
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
FLTNB GetTOFMeasurementRangeInMm()
This function is used to get the TOF measurement range in mm.
virtual int ProjectWithoutTOF(int a_direction, oProjectionLine *ap_ProjectionLine)=0
void SetScanner(vScanner *ap_Scanner)
void SetTOFResolutionInMm(FLTNB *ap_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)
void SetNbTOFResolutions(int a_nbTOFResolutions)
virtual void ShowHelpSpecific()=0
A function used to show help about the child module.
virtual ~vProjector()
The destructor of vProjector.
void SetTOFOffsetInMm(FLTNB *ap_TOFOffsetsInMm)
This function is used to set the TOF Offset in use.
void SetTOFBinSizeInMm(FLTNB a_TOFBinSizeInMm)
int CheckParameters()
A public function used to check the parameters settings.
void SetTOFEventResolutionFlag(FLTNB a_TOFEventResolutionFlag)
This function sets the per-event TOF resolution flag.
void SetTOFMeasurementRangeInMm(FLTNB a_TOFMeasurementRangeInMm)
FLTNB GetTOFOffsetInMm(int a_resolution)
This function is used to get the TOF offsets.
FLTNB GetTOFResolutionInMm(int a_resolution)
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
FLTNB GetTOFProbabilities(int a_resolution)
This function is used to get the TOF probability.
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. ...
void SetTOFProbabilities(FLTNB *ap_TOFProbabilities)
This function is used to set the TOF probabilities in use.
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.
Declaration of class oProjectionLine.
int SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
void SetSensitivityMode(bool a_sensitivityMode)
Generic class for scanner objects.