CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
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-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 VSCANNER_HH
31 #define VSCANNER_HH 1
32 
33 #include "gVariables.hh"
34 #include "sOutputManager.hh"
35 #include "oMatrix.hh"
37 
46 #define GEO_ROT_CW 0
47 
48 #define GEO_ROT_CCW 1
49 
51 class sScannerManager;
52 
61 class vScanner
62 {
63  // -------------------------------------------------------------------
64  // Constructor & Destructor
65  public:
70  vScanner();
74  virtual ~vScanner();
75 
76 
77  // -------------------------------------------------------------------
78  // Public member functions
79  public:
84  void Describe();
89  virtual void DescribeSpecific() = 0;
98  virtual int Instantiate(bool a_scannerFileIsLUT) = 0;
107  virtual int BuildLUT(bool a_scannerFileIsLUT) = 0;
114  virtual int CheckParameters() = 0;
121  virtual int Initialize() = 0;
136  virtual int GetPositionsAndOrientations( int a_index1, int a_index2,
137  FLTNB ap_Position1[3], FLTNB ap_Position2[3],
138  FLTNB ap_Orientation1[3], FLTNB ap_Orientation2[3],
139  FLTNB* ap_POI1 = NULL, FLTNB* ap_POI2 = NULL ) = 0;
152  virtual int GetRdmPositionsAndOrientations( int a_index1, int a_index2,
153  FLTNB ap_Position1[3], FLTNB ap_Position2[3],
154  FLTNB ap_Orientation1[3], FLTNB ap_Orientation2[3] ) = 0;
165  virtual int GetPositionWithRandomDepth( int a_index1, int a_index2, FLTNB ap_Position1[3], FLTNB ap_Position2[3] ) = 0;
179  virtual int GetTwoCorners( int a_index1, int a_index2,
180  FLTNB ap_CornerInf1[3], FLTNB ap_CornerSup1[3],
181  FLTNB ap_CornerInf2[3], FLTNB ap_CornerSup2[3]) = 0;
199  virtual int GetEdgesCenterPositions( int a_index1, int a_index2,
200  FLTNB ap_pos_line_point1[3], FLTNB ap_pos_line_point2[3],
201  FLTNB ap_pos_point1_x[4], FLTNB ap_pos_point1_y[4], FLTNB ap_pos_point1_z[4],
202  FLTNB ap_pos_point2_x[4], FLTNB ap_pos_point2_y[4], FLTNB ap_pos_point2_z[4] ) = 0;
214  virtual int ComputeLUT();
226  virtual int LoadLUT();
232  virtual int GetSystemNbElts() = 0;
242  virtual int IsAvailableLOR(int a_elt1, int a_elt2);
248  virtual void ShowHelp() = 0;
256  virtual int GetGeometricInfoFromDataFile(string a_path) = 0;
262  inline int GetScannerType()
263  {return m_scannerType;}
269  string GetScannerTypeString();
275  inline void SetVerbose(int a_verboseLevel)
276  {m_verbose = a_verboseLevel;}
283  {mp_ID = ap_ID;}
294  inline virtual FLTNB GetDetectionElementSizeTrans() = 0;
299  inline virtual FLTNB GetDetectionElementSizeAxial() = 0;
300 
301  // -------------------------------------------------------------------
302  // PET dedicated functions (only overloaded by PET scanner class)
303  public:
312  virtual int SetPETMaxAxialDiffmm(FLTNB a_maxAxialDiffmm);
313 
322  virtual int SetRotDirection( string a_rotDirection );
323 
332  virtual int PROJ_GetPETSpecificParameters(FLTNB* ap_maxRingDiff);
333 
334 
335  // -------------------------------------------------------------------
336  // SPECT dedicated functions (only surcharged by SPECT scanner classes)
337  public:
353  virtual int GetSPECTSpecificParameters( uint16_t* ap_nbOfProjections,
354  uint16_t* ap_nbHeads,
355  FLTNB* ap_acquisitionZoom,
356  uint16_t* ap_nbOfBins,
357  FLTNB* ap_pixSizeXY,
358  FLTNB*& ap_angles,
359  FLTNB*& ap_CORtoDetectorDistance,
360  int* ap_headRotDirection );
371  virtual int GetCTSpecificParameters( uint16_t* ap_nbOfProjections,
372  FLTNB*& ap_angles,
373  int* ap_detectorRotDirection );
382  virtual int PROJ_SetSPECTNbBins( uint16_t* ap_nbOfBins );
391  virtual int PROJ_SetSPECTNbProjections( uint32_t a_nbOfProjections );
400  virtual int PROJ_SetSPECTAngles( FLTNB* ap_projectionAngles );
409  virtual int PROJ_SetSPECTCORtoDetectorDistance( FLTNB a_CORtoDetectorDistance );
417  virtual uint16_t PROJ_GetSPECTNbProjections(); // required for analytic projection (computations of indices for projection main loops in sScannerManager)
425  virtual uint16_t PROJ_GetSPECTNbPixels(); // required for analytic projection (computations of index for projection main loops in sScannerManager)
426 
427 
428  // -------------------------------------------------------------------
429  // Private member functions
430  private:
431 
432 
433  // -------------------------------------------------------------------
434  // Data members
435  protected:
437  int m_verbose;
445 };
446 
447 
448 // ----------------------------------------------------------------------
449 // Part of code that manages the auto declaration of children classes
450 // ----------------------------------------------------------------------
451 
452 // Macro for the function that creates the object
453 #define FUNCTION_SCANNER(CLASS) \
454  static vScanner *make_scanner() { return new CLASS(); };
455 
456 // Macro for the class that links the appropriate function to the map of objects
457 #define CLASS_SCANNER(NAME,CLASS) \
458  class NAME##ScannerCreator \
459  { \
460  public: \
461  NAME##ScannerCreator() \
462  { sAddonManager::GetInstance()->mp_listOfScannerTypes[#NAME] = CLASS::make_scanner; } \
463  }; \
464  static NAME##ScannerCreator ScannerCreator##NAME;
465 
466 #endif
virtual int PROJ_SetSPECTNbBins(uint16_t *ap_nbOfBins)
Set SPECT number of Bins.
Definition: vScanner.cc:325
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:346
#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:223
virtual int SetPETMaxAxialDiffmm(FLTNB a_maxAxialDiffmm)
Set the maximal axial difference in mm between 2 crystals forming a lor.
Definition: vScanner.cc:202
virtual FLTNB GetDetectionElementSizeTrans()=0
virtual int PROJ_SetSPECTAngles(FLTNB *ap_projectionAngles)
Set SPECT projection angles.
Definition: vScanner.cc:370
oMatrix * mp_positionMatrix_out
Definition: vScanner.hh:442
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:38
FLTNB m_defaultBedDisplacementInMm
Definition: vScanner.hh:444
virtual uint16_t PROJ_GetSPECTNbProjections()
return the total number of projections for a SPECT acquisition
Definition: vScanner.cc:411
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:431
oImageDimensionsAndQuantification * mp_ID
Definition: vScanner.hh:438
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:282
oMatrix * mp_rotationMatrix
Definition: vScanner.hh:440
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:289
Singleton class that Instantiate and initialize the scanner object.
virtual ~vScanner()
vScanner destructor.
Definition: vScanner.cc:57
void Describe()
A function used to describe the generic parts of the datafile.
Definition: vScanner.cc:75
int m_verbose
Definition: vScanner.hh:437
virtual int ComputeLUT()
Virtual function which should be implemented by the child classes. It computes the LUT of the scann...
Definition: vScanner.cc:135
Declaration of class oMatrix.
string GetScannerTypeString()
Definition: vScanner.cc:100
bool m_allParametersChecked
Definition: vScanner.hh:439
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:237
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:275
Declaration of class sRandomNumberGenerator.
virtual int PROJ_SetSPECTCORtoDetectorDistance(FLTNB a_CORtoDetectorDistance)
Set distance between center of rotation and SPECT detectors.
Definition: vScanner.cc:391
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:436
FLTNB GetDefaultBedDisplacementInMm()
Definition: vScanner.hh:288
Declaration of class sOutputManager.
oMatrix * mp_positionMatrix_ref
Definition: vScanner.hh:441
Structure designed for basic matrices operations.
Definition: oMatrix.hh:41
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:158
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:180
int m_rotDirection
Definition: vScanner.hh:443
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:267
int GetScannerType()
Definition: vScanner.hh:262
Generic class for scanner objects.
Definition: vScanner.hh:61
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 ...