CASToR  2.0
Tomographic Reconstruction (PET/SPECT/CT)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
vScanner.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 VSCANNER_HH
32 #define VSCANNER_HH 1
33 
34 #include "gVariables.hh"
35 #include "sOutputManager.hh"
36 #include "oMatrix.hh"
38 
47 #define GEO_ROT_CW 0
48 
49 #define GEO_ROT_CCW 1
50 
52 class sScannerManager;
53 
62 class vScanner
63 {
64  // -------------------------------------------------------------------
65  // Constructor & Destructor
66  public:
71  vScanner();
75  virtual ~vScanner();
76 
77 
78  // -------------------------------------------------------------------
79  // Public member functions
80  public:
85  void Describe();
90  virtual void DescribeSpecific() = 0;
99  virtual int Instantiate(bool a_scannerFileIsLUT) = 0;
108  virtual int BuildLUT(bool a_scannerFileIsLUT) = 0;
115  virtual int CheckParameters() = 0;
122  virtual int Initialize() = 0;
137  virtual int GetPositionsAndOrientations( int a_index1, int a_index2,
138  FLTNB ap_Position1[3], FLTNB ap_Position2[3],
139  FLTNB ap_Orientation1[3], FLTNB ap_Orientation2[3],
140  FLTNB* ap_POI1 = NULL, FLTNB* ap_POI2 = NULL ) = 0;
153  virtual int GetRdmPositionsAndOrientations( int a_index1, int a_index2,
154  FLTNB ap_Position1[3], FLTNB ap_Position2[3],
155  FLTNB ap_Orientation1[3], FLTNB ap_Orientation2[3] ) = 0;
166  virtual int GetPositionWithRandomDepth( int a_index1, int a_index2, FLTNB ap_Position1[3], FLTNB ap_Position2[3] ) = 0;
180  virtual int GetTwoCorners( int a_index1, int a_index2,
181  FLTNB ap_CornerInf1[3], FLTNB ap_CornerSup1[3],
182  FLTNB ap_CornerInf2[3], FLTNB ap_CornerSup2[3]) = 0;
200  virtual int GetEdgesCenterPositions( int a_index1, int a_index2,
201  FLTNB ap_pos_line_point1[3], FLTNB ap_pos_line_point2[3],
202  FLTNB ap_pos_point1_x[4], FLTNB ap_pos_point1_y[4], FLTNB ap_pos_point1_z[4],
203  FLTNB ap_pos_point2_x[4], FLTNB ap_pos_point2_y[4], FLTNB ap_pos_point2_z[4] ) = 0;
215  virtual int ComputeLUT();
227  virtual int LoadLUT();
233  virtual int GetSystemNbElts() = 0;
243  virtual int IsAvailableLOR(int a_elt1, int a_elt2);
249  virtual void ShowHelp() = 0;
257  virtual int GetGeometricInfoFromDataFile(string a_path) = 0;
263  inline int GetScannerType()
264  {return m_scannerType;}
270  string GetScannerTypeString();
276  inline void SetVerbose(int a_verboseLevel)
277  {m_verbose = a_verboseLevel;}
284  {mp_ID = ap_ID;}
295  inline virtual FLTNB GetDetectionElementSizeTrans() = 0;
300  inline virtual FLTNB GetDetectionElementSizeAxial() = 0;
301 
302  // -------------------------------------------------------------------
303  // PET dedicated functions (only overloaded by PET scanner class)
304  public:
313  virtual int SetPETMaxAxialDiffmm(FLTNB a_maxAxialDiffmm);
314 
323  virtual int SetRotDirection( string a_rotDirection );
324 
333  virtual int PROJ_GetPETSpecificParameters(FLTNB* ap_maxRingDiff);
334 
335 
336  // -------------------------------------------------------------------
337  // SPECT dedicated functions (only surcharged by SPECT scanner classes)
338  public:
354  virtual int GetSPECTSpecificParameters( uint16_t* ap_nbOfProjections,
355  uint16_t* ap_nbHeads,
356  FLTNB* ap_acquisitionZoom,
357  uint16_t* ap_nbOfBins,
358  FLTNB* ap_pixSizeXY,
359  FLTNB*& ap_angles,
360  FLTNB*& ap_CORtoDetectorDistance,
361  int* ap_headRotDirection );
372  virtual int GetCTSpecificParameters( uint16_t* ap_nbOfProjections,
373  FLTNB*& ap_angles,
374  int* ap_detectorRotDirection );
383  virtual int PROJ_SetSPECTNbBins( uint16_t* ap_nbOfBins );
392  virtual int PROJ_SetSPECTNbProjections( uint32_t a_nbOfProjections );
401  virtual int PROJ_SetSPECTAngles( FLTNB* ap_projectionAngles );
410  virtual int PROJ_SetSPECTCORtoDetectorDistance( FLTNB a_CORtoDetectorDistance );
418  virtual uint16_t PROJ_GetSPECTNbProjections(); // required for analytic projection (computations of indices for projection main loops in sScannerManager)
426  virtual uint16_t PROJ_GetSPECTNbPixels(); // required for analytic projection (computations of index for projection main loops in sScannerManager)
427 
428 
429  // -------------------------------------------------------------------
430  // Private member functions
431  private:
432 
433 
434  // -------------------------------------------------------------------
435  // Data members
436  protected:
438  int m_verbose;
446 };
447 
448 
449 // ----------------------------------------------------------------------
450 // Part of code that manages the auto declaration of children classes
451 // ----------------------------------------------------------------------
452 
453 // Macro for the function that creates the object
454 #define FUNCTION_SCANNER(CLASS) \
455  static vScanner *make_scanner() { return new CLASS(); };
456 
457 // Macro for the class that links the appropriate function to the map of objects
458 #define CLASS_SCANNER(NAME,CLASS) \
459  class NAME##ScannerCreator \
460  { \
461  public: \
462  NAME##ScannerCreator() \
463  { sAddonManager::GetInstance()->mp_listOfScannerTypes[#NAME] = CLASS::make_scanner; } \
464  }; \
465  static NAME##ScannerCreator ScannerCreator##NAME;
466 
467 #endif
virtual int PROJ_SetSPECTNbBins(uint16_t *ap_nbOfBins)
Set SPECT number of Bins.
Definition: vScanner.cc:326
virtual FLTNB GetDetectionElementSizeAxial()=0
This header file is mainly used to declare some macro definitions and all includes needed from the st...
virtual int PROJ_SetSPECTNbProjections(uint32_t a_nbOfProjections)
Set SPECT number of views.
Definition: vScanner.cc:347
#define FLTNB
Definition: gVariables.hh:81
virtual int PROJ_GetPETSpecificParameters(FLTNB *ap_maxRingDiff)
Get geometric PET specific parameters to initialize the datafile.
Definition: vScanner.cc:224
virtual int SetPETMaxAxialDiffmm(FLTNB a_maxAxialDiffmm)
Set the maximal axial difference in mm between 2 crystals forming a lor.
Definition: vScanner.cc:203
virtual FLTNB GetDetectionElementSizeTrans()=0
virtual int PROJ_SetSPECTAngles(FLTNB *ap_projectionAngles)
Set SPECT projection angles.
Definition: vScanner.cc:371
oMatrix * mp_positionMatrix_out
Definition: vScanner.hh:443
virtual int GetGeometricInfoFromDataFile(string a_path)=0
This function is implemented in child classes Recover geometric informations specific to the scanne...
virtual void ShowHelp()=0
This function is implemented in child classes Display help specific to the scanner class...
vScanner()
vScanner constructor. Initialize the member variables to their default values.
Definition: vScanner.cc:39
FLTNB m_defaultBedDisplacementInMm
Definition: vScanner.hh:445
virtual uint16_t PROJ_GetSPECTNbProjections()
return the total number of projections for a SPECT acquisition
Definition: vScanner.cc:412
virtual int CheckParameters()=0
This function is implemented in child classes. Check that all parameters have been correctly initia...
virtual int Initialize()=0
This function is implemented in child classes. Check initialization and set several parameters to t...
virtual uint16_t PROJ_GetSPECTNbPixels()
return the total number of pixels for a SPECT reconstruction
Definition: vScanner.cc:432
oImageDimensionsAndQuantification * mp_ID
Definition: vScanner.hh:439
virtual void DescribeSpecific()=0
A pure virtual function used to describe the specific parts of the scanner.
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ID)
Set the pointer to the image dimensions and quantification object.
Definition: vScanner.hh:283
oMatrix * mp_rotationMatrix
Definition: vScanner.hh:441
virtual int Instantiate(bool a_scannerFileIsLUT)=0
This function is implemented in child classes. Read the mandatory fields from the scanner file and al...
virtual int SetRotDirection(string a_rotDirection)
Set rotation direction of the system.
Definition: vScanner.cc:290
Singleton class that Instantiate and initialize the scanner object.
virtual ~vScanner()
vScanner destructor.
Definition: vScanner.cc:58
void Describe()
A function used to describe the generic parts of the datafile.
Definition: vScanner.cc:76
int m_verbose
Definition: vScanner.hh:438
virtual int ComputeLUT()
Virtual function which should be implemented by the child classes. It computes the LUT of the scann...
Definition: vScanner.cc:136
Declaration of class oMatrix.
string GetScannerTypeString()
Definition: vScanner.cc:101
bool m_allParametersChecked
Definition: vScanner.hh:440
virtual int GetSPECTSpecificParameters(uint16_t *ap_nbOfProjections, uint16_t *ap_nbHeads, FLTNB *ap_acquisitionZoom, uint16_t *ap_nbOfBins, FLTNB *ap_pixSizeXY, FLTNB *&ap_angles, FLTNB *&ap_CORtoDetectorDistance, int *ap_headRotDirection)
Recover geometric SPECT specific parameters from the scanner to initialize the datafile.
Definition: vScanner.cc:238
virtual int GetRdmPositionsAndOrientations(int a_index1, int a_index2, FLTNB ap_Position1[3], FLTNB ap_Position2[3], FLTNB ap_Orientation1[3], FLTNB ap_Orientation2[3])=0
This is a pure virtual method that must be implemented by children. Get random positions of the sca...
void SetVerbose(int a_verboseLevel)
Set verbosity.
Definition: vScanner.hh:276
Declaration of class sRandomNumberGenerator.
virtual int PROJ_SetSPECTCORtoDetectorDistance(FLTNB a_CORtoDetectorDistance)
Set distance between center of rotation and SPECT detectors.
Definition: vScanner.cc:392
virtual int GetSystemNbElts()=0
This is a pure virtual method that must be implemented by children.
virtual int GetTwoCorners(int a_index1, int a_index2, FLTNB ap_CornerInf1[3], FLTNB ap_CornerSup1[3], FLTNB ap_CornerInf2[3], FLTNB ap_CornerSup2[3])=0
This is a pure virtual method that must be implemented by children. Get the cartesian coordinaters ...
int m_scannerType
Definition: vScanner.hh:437
FLTNB GetDefaultBedDisplacementInMm()
Definition: vScanner.hh:289
Declaration of class sOutputManager.
oMatrix * mp_positionMatrix_ref
Definition: vScanner.hh:442
Structure designed for basic matrices operations.
Definition: oMatrix.hh:42
This class is designed to manage all dimensions and quantification related stuff. ...
virtual int LoadLUT()
Virtual function which should be implemented by the child classes. Load a precomputed scanner LUT...
Definition: vScanner.cc:159
virtual int IsAvailableLOR(int a_elt1, int a_elt2)
This function is implemented in child classes. Check if the LOR is available according to the scann...
Definition: vScanner.cc:181
int m_rotDirection
Definition: vScanner.hh:444
virtual int GetPositionsAndOrientations(int a_index1, int a_index2, FLTNB ap_Position1[3], FLTNB ap_Position2[3], FLTNB ap_Orientation1[3], FLTNB ap_Orientation2[3], FLTNB *ap_POI1=NULL, FLTNB *ap_POI2=NULL)=0
This is a pure virtual method that must be implemented by children. Get the central positions and o...
virtual int GetPositionWithRandomDepth(int a_index1, int a_index2, FLTNB ap_Position1[3], FLTNB ap_Position2[3])=0
This is a pure virtual method that must be implemented by children. Get the positions of scanner el...
virtual int GetCTSpecificParameters(uint16_t *ap_nbOfProjections, FLTNB *&ap_angles, int *ap_detectorRotDirection)
Recover geometric CT specific parameters from the scanner to initialize the datafile.
Definition: vScanner.cc:268
int GetScannerType()
Definition: vScanner.hh:263
Generic class for scanner objects.
Definition: vScanner.hh:62
virtual int BuildLUT(bool a_scannerFileIsLUT)=0
This function is implemented in child classes. Instantiate the scanner look-up-table (LUT) ...
virtual int GetEdgesCenterPositions(int a_index1, int a_index2, FLTNB ap_pos_line_point1[3], FLTNB ap_pos_line_point2[3], FLTNB ap_pos_point1_x[4], FLTNB ap_pos_point1_y[4], FLTNB ap_pos_point1_z[4], FLTNB ap_pos_point2_x[4], FLTNB ap_pos_point2_y[4], FLTNB ap_pos_point2_z[4])=0
This is a pure virtual method that must be implemented by children. Get the cartesian coordinaters ...