CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
vProjector.hh
Go to the documentation of this file.
1 /*
2 This file is part of CASToR.
3 
4  CASToR is free software: you can redistribute it and/or modify it under the
5  terms of the GNU General Public License as published by the Free Software
6  Foundation, either version 3 of the License, or (at your option) any later
7  version.
8 
9  CASToR is distributed in the hope that it will be useful, but WITHOUT ANY
10  WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11  FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
12  details.
13 
14  You should have received a copy of the GNU General Public License along with
15  CASToR (in file GNU_GPL.TXT). If not, see <http://www.gnu.org/licenses/>.
16 
17 Copyright 2017-2019 all CASToR contributors listed below:
18 
19  --> Didier BENOIT, Claude COMTAT, Marina FILIPOVIC, Thibaut MERLIN, Mael MILLARDET, Simon STUTE, Valentin VIELZEUF
20 
21 This is CASToR version 3.0.
22 */
23 
30 #ifndef VPROJECTOR_HH
31 #define VPROJECTOR_HH 1
32 
33 #include "gVariables.hh"
34 #include "vEvent.hh"
35 #include "oProjectionLine.hh"
36 #include "vScanner.hh"
38 
47 #define USE_TOFHISTO 1
48 
49 #define USE_TOFLIST 2
50 
51 #define USE_NOTOF 3
52 
76 {
77  // -------------------------------------------------------------------
78  // Constructor & Destructor
79  public:
86  vProjector();
94  virtual ~vProjector();
95 
96 
97  // -------------------------------------------------------------------
98  // Public member functions
99  public:
105  void ShowHelp();
111  static void ShowCommonHelp();
117  int ReadCommonOptionsList(const string& a_optionsList);
126  int CheckParameters();
136  int Initialize();
159  int Project(int a_direction, oProjectionLine* ap_ProjectionLine, uint32_t* ap_index1, uint32_t* ap_index2, int a_nbIndices);
160 
161 
162  // -------------------------------------------------------------------
163  // Virtual but not pure for children
164  public:
175 
176 
177  // -------------------------------------------------------------------
178  // Pure virtual public member functions that need to be implemented by children
179  public:
190  virtual int ReadConfigurationFile(const string& a_configurationFile) = 0;
201  virtual int ReadOptionsList(const string& a_optionsList) = 0;
202 
203 
204  // -------------------------------------------------------------------
205  // Pure virtual private member functions that need to be implemented by children
206  private:
215  virtual void ShowHelpSpecific() = 0;
224  virtual int CheckSpecificParameters() = 0;
234  virtual int InitializeSpecific() = 0;
244  virtual int ProjectWithoutTOF( int a_direction, oProjectionLine* ap_ProjectionLine ) = 0;
255  virtual int ProjectTOFListmode( int a_direction, oProjectionLine* ap_ProjectionLine ) = 0;
266  virtual int ProjectTOFHistogram( int a_direction, oProjectionLine* ap_ProjectionLine ) = 0;
267 
268 
269  // -------------------------------------------------------------------
270  // Public Get & Set functions
271  public:
277  inline void SetVerbose(int a_verbose)
278  {m_verbose = a_verbose;}
284  inline void SetScanner(vScanner* ap_Scanner)
285  {mp_Scanner = ap_Scanner;}
291  inline void SetSensitivityMode(bool a_sensitivityMode)
292  {m_sensitivityMode = a_sensitivityMode;}
298  inline void SetApplyTOF(int a_applyTOF)
299  {m_TOFMethod = a_applyTOF;}
305  inline void SetApplyPOI(bool a_applyPOI)
306  {m_applyPOI = a_applyPOI;}
313  int SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification);
331  inline void SetMask(bool* ap_mask){ mp_mask = ap_mask; m_hasMask = true;}
338  {return m_TOFResolutionInMm;}
344  inline void SetTOFResolutionInMm(FLTNB a_TOFResolutionInMm)
345  {m_TOFResolutionInMm = a_TOFResolutionInMm;}
352  {return m_TOFMeasurementRangeInMm;}
358  inline void SetTOFMeasurementRangeInMm(FLTNB a_TOFMeasurementRangeInMm)
359  {m_TOFMeasurementRangeInMm = a_TOFMeasurementRangeInMm;}
366  {return m_TOFBinSizeInMm;}
372  inline void SetTOFBinSizeInMm(FLTNB a_TOFBinSizeInMm)
373  {m_TOFBinSizeInMm = a_TOFBinSizeInMm;}
374  // -------------------------------------------------------------------
375  // Data members
376  protected:
377  // Few data from the oImageDimensionsAndQuantification to avoid getting them too often
382  // Image dimensions
385  // Scanner
387  // TOF related
399  // Voxel mask to remove voxels from projection
400  bool* mp_mask;
401  bool m_hasMask;
402  // Flag for POI
403  bool m_applyPOI;
404  // Flag for sensitivity computation
406  // Flag that says if the projector is compatible with SPECT attenuation correction
408  // Flag that says if the projection is compatible with compression
409  // (i.e. when the crystal indices in the projection line will be -1 as they are not unique for a given event)
411  // Verbosity
412  int m_verbose;
413  // Has been checked ?
414  bool m_checked;
415  // Has been initialized ?
417 };
418 
419 // ----------------------------------------------------------------------
420 // Part of code that manages the auto declaration of children classes
421 // ----------------------------------------------------------------------
422 
423 // Macro for the function that creates the object
424 #define FUNCTION_PROJECTOR(CLASS) \
425  static vProjector *make_projector() { return new CLASS(); };
426 
427 // Macro for the class that links the appropriate function to the map of objects
428 #define CLASS_PROJECTOR(NAME,CLASS) \
429  class NAME##ProjectorCreator \
430  { \
431  public: \
432  NAME##ProjectorCreator() \
433  { sAddonManager::GetInstance()->mp_listOfProjectors[#NAME] = CLASS::make_projector; } \
434  }; \
435  static NAME##ProjectorCreator ProjectorCreator##NAME;
436 
437 #endif
bool m_applyPOI
Definition: vProjector.hh:403
This header file is mainly used to declare some macro definitions and all includes needed from the st...
bool m_checked
Definition: vProjector.hh:414
bool m_compatibleWithSPECTAttenuationCorrection
Definition: vProjector.hh:407
Declaration of class oImageDimensionsAndQuantification.
FLTNB mp_sizeVox[3]
Definition: vProjector.hh:378
FLTNB GetTOFBinSizeInMm()
This function is used to get the size in mm of a TOF bin.
Definition: vProjector.hh:365
FLTNB m_TOFNbSigmas
Definition: vProjector.hh:389
static void ShowCommonHelp()
This function is used to print out some help about the use of options common to all projectors...
Definition: vProjector.cc:118
INTNB m_nbVoxXY
Definition: vProjector.hh:380
void SetMask(bool *ap_mask)
Set a mask for voxels.
Definition: vProjector.hh:331
INTNB mp_nbVox[3]
Definition: vProjector.hh:379
#define FLTNB
Definition: gVariables.hh:81
void SetScanner(vScanner *ap_Scanner)
Set the pointer to the scanner in use.
Definition: vProjector.hh:284
FLTNB m_TOFGaussianNormCoef
Definition: vProjector.hh:397
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
Definition: vProjector.hh:384
#define HPFLTNB
Definition: gVariables.hh:83
This class is designed to generically described any on-the-fly projector.
Definition: vProjector.hh:75
vProjector()
The constructor of vProjector.
Definition: vProjector.cc:39
int m_TOFMethod
Definition: vProjector.hh:388
int Initialize()
A public function used to initialize the projector.
Definition: vProjector.cc:251
bool m_TOFWeightingFcnPrecomputedFlag
Definition: vProjector.hh:391
bool m_TOFBinProperProcessingFlag
Definition: vProjector.hh:392
HPFLTNB * mp_TOFWeightingFcn
Definition: vProjector.hh:393
virtual int ProjectWithoutTOF(int a_direction, oProjectionLine *ap_ProjectionLine)=0
A function to project without TOF.
int Project(int a_direction, oProjectionLine *ap_ProjectionLine, uint32_t *ap_index1, uint32_t *ap_index2, int a_nbIndices)
A function use to computed the projection elements with respect to the provided parameters.
Definition: vProjector.cc:424
FLTNB GetTOFMeasurementRangeInMm()
This function is used to get the TOF measurement range in mm.
Definition: vProjector.hh:351
bool GetCompatibilityWithSPECTAttenuationCorrection()
Definition: vProjector.hh:318
void SetTOFBinSizeInMm(FLTNB a_TOFBinSizeInMm)
This function is used to set the size of a TOF bin in mm.
Definition: vProjector.hh:372
virtual int CheckSpecificParameters()=0
A private function used to check the parameters settings specific to the child projector.
void SetApplyTOF(int a_applyTOF)
Set the TOF mode.
Definition: vProjector.hh:298
int ReadCommonOptionsList(const string &a_optionsList)
This function is used to read options common to all projectors given as a string. ...
Definition: vProjector.cc:160
void SetVerbose(int a_verbose)
Set the verbose level.
Definition: vProjector.hh:277
Declaration of class oProjectionLine.
virtual void ShowHelpSpecific()=0
A function used to show help about the child module.
bool m_initialized
Definition: vProjector.hh:416
bool m_sensitivityMode
Definition: vProjector.hh:405
bool * mp_mask
Definition: vProjector.hh:400
virtual ~vProjector()
The destructor of vProjector.
Definition: vProjector.cc:80
void SetSensitivityMode(bool a_sensitivityMode)
Set the sensitivity mode on or off.
Definition: vProjector.hh:291
Declaration of class vScanner.
virtual int ProjectTOFHistogram(int a_direction, oProjectionLine *ap_ProjectionLine)=0
A function to project with TOF binned information.
int CheckParameters()
A public function used to check the parameters settings.
Definition: vProjector.cc:184
virtual int ReadOptionsList(const string &a_optionsList)=0
A function used to read options from a list of options.
FLTNB m_TOFResolutionInMm
Definition: vProjector.hh:396
virtual int ReadConfigurationFile(const string &a_configurationFile)=0
A function used to read options from a configuration file.
void SetTOFMeasurementRangeInMm(FLTNB a_TOFMeasurementRangeInMm)
This function is used to set the TOF measurement range in mm.
Definition: vProjector.hh:358
Declaration of class vEvent.
virtual int ProjectTOFListmode(int a_direction, oProjectionLine *ap_ProjectionLine)=0
A function to project with TOF continuous information.
FLTNB GetTOFResolutionInMm()
This function is used to get the TOF resolution in mm.
Definition: vProjector.hh:337
void SetTOFResolutionInMm(FLTNB a_TOFResolutionInMm)
This function is used to set the TOF resolution in use.
Definition: vProjector.hh:344
bool GetCompatibilityWithCompression()
Definition: vProjector.hh:324
bool m_hasMask
Definition: vProjector.hh:401
#define INTNB
Definition: gVariables.hh:92
This class is designed to manage and store system matrix elements associated to a vEvent...
FLTNB m_TOFPrecomputedSamplingFactor
Definition: vProjector.hh:398
virtual int InitializeSpecific()=0
A private function used to initialize everything specific to the child projector. ...
FLTNB m_TOFBinSizeInMm
Definition: vProjector.hh:394
FLTNB m_TOFMeasurementRangeInMm
Definition: vProjector.hh:395
FLTNB mp_halfFOV[3]
Definition: vProjector.hh:381
This class is designed to manage all dimensions and quantification related stuff. ...
void SetApplyPOI(bool a_applyPOI)
Set the POI mode.
Definition: vProjector.hh:305
virtual INTNB EstimateMaxNumberOfVoxelsPerLine()
This function is used to compute and provide an estimate of the maximum number of voxels that could c...
Definition: vProjector.cc:414
bool m_compatibleWithCompression
Definition: vProjector.hh:410
void ShowHelp()
A function used to show help about the projector.
Definition: vProjector.cc:146
int SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
Set the pointer to the image dimensions in use and copy locally some often use variables.
Definition: vProjector.cc:89
vScanner * mp_Scanner
Definition: vProjector.hh:386
Generic class for scanner objects.
Definition: vScanner.hh:61
INTNB m_TOFWeightingFcnNbSamples
Definition: vProjector.hh:390