CASToR  2.0
Tomographic Reconstruction (PET/SPECT/CT)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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-2018 all CASToR contributors listed below:
18 
19  --> current contributors: Thibaut MERLIN, Simon STUTE, Didier BENOIT, Claude COMTAT, Marina FILIPOVIC, Mael MILLARDET
20  --> past contributors: Valentin VIELZEUF
21 
22 This is CASToR version 2.0.
23 */
24 
31 #ifndef VPROJECTOR_HH
32 #define VPROJECTOR_HH 1
33 
34 #include "gVariables.hh"
35 #include "vEvent.hh"
36 #include "oProjectionLine.hh"
37 #include "vScanner.hh"
39 
48 #define USE_TOFBIN 1
49 
50 #define USE_TOFPOS 2
51 
52 #define USE_NOTOF 3
53 
77 {
78  // -------------------------------------------------------------------
79  // Constructor & Destructor
80  public:
87  vProjector();
95  virtual ~vProjector();
96 
97 
98  // -------------------------------------------------------------------
99  // Public member functions
100  public:
106  void ShowHelp();
112  static void ShowCommonHelp();
118  int ReadCommonOptionsList(const string& a_optionsList);
127  int CheckParameters();
137  int Initialize();
160  int Project(int a_direction, oProjectionLine* ap_ProjectionLine, uint32_t* ap_index1, uint32_t* ap_index2, int a_nbIndices);
161 
162 
163  // -------------------------------------------------------------------
164  // Virtual but not pure for children
165  public:
176 
177 
178  // -------------------------------------------------------------------
179  // Pure virtual public member functions that need to be implemented by children
180  public:
191  virtual int ReadConfigurationFile(const string& a_configurationFile) = 0;
202  virtual int ReadOptionsList(const string& a_optionsList) = 0;
203 
204 
205  // -------------------------------------------------------------------
206  // Pure virtual private member functions that need to be implemented by children
207  private:
216  virtual void ShowHelpSpecific() = 0;
225  virtual int CheckSpecificParameters() = 0;
235  virtual int InitializeSpecific() = 0;
245  virtual int ProjectWithoutTOF( int a_direction, oProjectionLine* ap_ProjectionLine ) = 0;
256  virtual int ProjectWithTOFPos( int a_direction, oProjectionLine* ap_ProjectionLine ) = 0;
267  virtual int ProjectWithTOFBin( int a_direction, oProjectionLine* ap_ProjectionLine ) = 0;
268 
269 
270  // -------------------------------------------------------------------
271  // Public Get & Set functions
272  public:
278  inline void SetVerbose(int a_verbose)
279  {m_verbose = a_verbose;}
285  inline void SetScanner(vScanner* ap_Scanner)
286  {mp_Scanner = ap_Scanner;}
292  inline void SetSensitivityMode(bool a_sensitivityMode)
293  {m_sensitivityMode = a_sensitivityMode;}
299  inline void SetApplyTOF(int a_applyTOF)
300  {m_applyTOF = a_applyTOF;}
306  inline void SetApplyPOI(bool a_applyPOI)
307  {m_applyPOI = a_applyPOI;}
314  int SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification);
332  inline void SetMask(bool* ap_mask){ mp_mask = ap_mask; m_hasMask = true;}
333 
334  // -------------------------------------------------------------------
335  // Data members
336  protected:
337  // Few data from the oImageDimensionsAndQuantification to avoid getting them too often
342  // Image dimensions
345  // Scanner
347  // Integer flag to say if TOF are applied and how
350  // Flag for POI
351  bool m_applyPOI;
352  // Flag for sensitivity computation
354  // Flag that says if the projector is compatible with SPECT attenuation correction
356  // Flag that says if the projection is compatible with compression
357  // (i.e. when the crystal indices in the projection line will be -1 as they are not unique for a given event)
359  // Verbosity
360  int m_verbose;
361  // Has been checked ?
362  bool m_checked;
363  // Has been initialized ?
365  bool* mp_mask;
366  bool m_hasMask;
367 };
368 
369 // ----------------------------------------------------------------------
370 // Part of code that manages the auto declaration of children classes
371 // ----------------------------------------------------------------------
372 
373 // Macro for the function that creates the object
374 #define FUNCTION_PROJECTOR(CLASS) \
375  static vProjector *make_projector() { return new CLASS(); };
376 
377 // Macro for the class that links the appropriate function to the map of objects
378 #define CLASS_PROJECTOR(NAME,CLASS) \
379  class NAME##ProjectorCreator \
380  { \
381  public: \
382  NAME##ProjectorCreator() \
383  { sAddonManager::GetInstance()->mp_listOfProjectors[#NAME] = CLASS::make_projector; } \
384  }; \
385  static NAME##ProjectorCreator ProjectorCreator##NAME;
386 
387 #endif
bool m_applyPOI
Definition: vProjector.hh:351
This header file is mainly used to declare some macro definitions and all includes needed from the st...
bool m_checked
Definition: vProjector.hh:362
bool m_compatibleWithSPECTAttenuationCorrection
Definition: vProjector.hh:355
Declaration of class oImageDimensionsAndQuantification.
FLTNB mp_sizeVox[3]
Definition: vProjector.hh:338
static void ShowCommonHelp()
This function is used to print out some help about the use of options common to all projectors...
Definition: vProjector.cc:112
INTNB m_nbVoxXY
Definition: vProjector.hh:340
void SetMask(bool *ap_mask)
Set a mask for voxels.
Definition: vProjector.hh:332
INTNB mp_nbVox[3]
Definition: vProjector.hh:339
#define FLTNB
Definition: gVariables.hh:81
void SetScanner(vScanner *ap_Scanner)
Set the pointer to the scanner in use.
Definition: vProjector.hh:285
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
Definition: vProjector.hh:344
This class is designed to generically described any on-the-fly projector.
Definition: vProjector.hh:76
vProjector()
The constructor of vProjector.
Definition: vProjector.cc:40
int Initialize()
A public function used to initialize the projector.
Definition: vProjector.cc:228
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:263
virtual int ProjectWithTOFBin(int a_direction, oProjectionLine *ap_ProjectionLine)=0
A function to project with TOF binned information.
bool GetCompatibilityWithSPECTAttenuationCorrection()
Definition: vProjector.hh:319
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:299
int ReadCommonOptionsList(const string &a_optionsList)
This function is used to read options common to all projectors given as a string. ...
Definition: vProjector.cc:147
void SetVerbose(int a_verbose)
Set the verbose level.
Definition: vProjector.hh:278
Declaration of class oProjectionLine.
virtual void ShowHelpSpecific()=0
A function used to show help about the child module.
bool m_initialized
Definition: vProjector.hh:364
bool m_sensitivityMode
Definition: vProjector.hh:353
bool * mp_mask
Definition: vProjector.hh:365
virtual ~vProjector()
The destructor of vProjector.
Definition: vProjector.cc:73
void SetSensitivityMode(bool a_sensitivityMode)
Set the sensitivity mode on or off.
Definition: vProjector.hh:292
Declaration of class vScanner.
int CheckParameters()
A public function used to check the parameters settings.
Definition: vProjector.cc:170
virtual int ReadOptionsList(const string &a_optionsList)=0
A function used to read options from a list of options.
virtual int ReadConfigurationFile(const string &a_configurationFile)=0
A function used to read options from a configuration file.
Declaration of class vEvent.
bool GetCompatibilityWithCompression()
Definition: vProjector.hh:325
bool m_hasMask
Definition: vProjector.hh:366
FLTNB m_TOFnbSigmas
Definition: vProjector.hh:349
#define INTNB
Definition: gVariables.hh:92
This class is designed to manage and store system matrix elements associated to a vEvent...
virtual int ProjectWithTOFPos(int a_direction, oProjectionLine *ap_ProjectionLine)=0
A function to project with TOF continuous information.
virtual int InitializeSpecific()=0
A private function used to initialize everything specific to the child projector. ...
FLTNB mp_halfFOV[3]
Definition: vProjector.hh:341
This class is designed to manage all dimensions and quantification related stuff. ...
void SetApplyPOI(bool a_applyPOI)
Set the POI mode.
Definition: vProjector.hh:306
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:253
bool m_compatibleWithCompression
Definition: vProjector.hh:358
void ShowHelp()
A function used to show help about the projector.
Definition: vProjector.cc:133
int SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
Set the pointer to the image dimensions in use and copy locally some often use variables.
Definition: vProjector.cc:83
vScanner * mp_Scanner
Definition: vProjector.hh:346
Generic class for scanner objects.
Definition: vScanner.hh:62
int m_applyTOF
Definition: vProjector.hh:348