CASToR  1.1
Tomographic Reconstruction (PET/SPECT)
 All Classes Files Functions Variables Typedefs Macros Groups Pages
vScanner.hh
Go to the documentation of this file.
1 
8 #ifndef VSCANNER_HH
9 #define VSCANNER_HH 1
10 
11 #include "gVariables.hh"
12 #include "sOutputManager.hh"
13 #include "oMatrix.hh"
15 
16 
17 
18 
19 
28 #define GEO_ROT_CW 0
29 
30 #define GEO_ROT_CCW 1
31 
37 class sScannerManager;
38 
39 
48 class vScanner
49 {
50  // -------------------------------------------------------------------
51  // Constructor & Destructor
52  public:
57  vScanner();
61  virtual ~vScanner();
62 
63 
64  // -------------------------------------------------------------------
65  // Public member functions
66  public:
75  virtual int Instantiate(bool a_scannerFileIsLUT) = 0;
84  virtual int BuildLUT(bool a_scannerFileIsLUT) = 0;
91  virtual int CheckParameters() = 0;
98  virtual int Initialize() = 0;
113  virtual int GetPositionsAndOrientations( int a_index1, int a_index2,
114  FLTNB ap_Position1[3], FLTNB ap_Position2[3],
115  FLTNB ap_Orientation1[3], FLTNB ap_Orientation2[3],
116  FLTNB* ap_POI1 = NULL, FLTNB* ap_POI2 = NULL ) = 0;
129  virtual int GetRdmPositionsAndOrientations( int a_index1, int a_index2,
130  FLTNB ap_Position1[3], FLTNB ap_Position2[3],
131  FLTNB ap_Orientation1[3], FLTNB ap_Orientation2[3] ) = 0;
142  virtual int GetPositionWithRandomDepth( int a_index1, int a_index2, FLTNB ap_Position1[3], FLTNB ap_Position2[3] ) = 0;
156  virtual int GetTwoCorners( int a_index1, int a_index2,
157  FLTNB ap_CornerInf1[3], FLTNB ap_CornerSup1[3],
158  FLTNB ap_CornerInf2[3], FLTNB ap_CornerSup2[3]) = 0;
170  virtual int ComputeLUT();
182  virtual int LoadLUT();
188  virtual int GetSystemNbElts() = 0;
198  virtual int IsAvailableLOR(int a_elt1, int a_elt2);
204  virtual void ShowHelp() = 0;
212  virtual int GetGeometricInfoFromDatafile(string a_path) = 0;
218  inline int GetScannerType()
219  {return m_scannerType;}
225  inline void SetVerbose(int a_verboseLevel)
226  {m_verbose = a_verboseLevel;}
233 
234 
235  // -------------------------------------------------------------------
236  // PET dedicated functions (only overloaded by PET scanner class)
237  public:
246  virtual int SetPETMaxRingDiff(int a_maxRingDiff);
254  virtual int GetScannerLayerNbRings(int a_layer);
255 
264  virtual int SetRotDirection( string a_rotDirection );
265 
274  virtual int PROJ_GetPETSpecificParameters(int* ap_maxRingDiff);
275 
276 
277  // -------------------------------------------------------------------
278  // SPECT dedicated functions (only surcharged by SPECT scanner classes)
279  public:
294  virtual int GetSPECTSpecificParameters( uint16_t* ap_nbOfProjections,
295  uint16_t* ap_nbHeads,
296  uint16_t* ap_nbOfBins,
297  FLTNB* ap_pixSizeXY,
298  FLTNB*& ap_angles,
299  FLTNB*& ap_CORtoDetectorDistance,
300  int* ap_headRotDirection );
309  virtual int PROJ_SetSPECTNbBins( uint16_t* ap_nbOfBins );
318  virtual int PROJ_SetSPECTNbProjections( uint32_t a_nbOfProjections );
327  virtual int PROJ_SetSPECTAngles( FLTNB* ap_projectionAngles );
336  virtual int PROJ_SetSPECTCORtoDetectorDistance( FLTNB a_CORtoDetectorDistance );
344  virtual uint16_t PROJ_GetSPECTNbProjections(); // required for analytic projection (computations of indices for projection main loops in sScannerManager)
352  virtual uint16_t PROJ_GetSPECTNbPixels(); // required for analytic projection (computations of index for projection main loops in sScannerManager)
353 
354 
355  // -------------------------------------------------------------------
356  // Private member functions
357  private:
358 
359 
360  // -------------------------------------------------------------------
361  // Data members
362  protected:
364  int m_verbose;
371 };
372 
373 
374 // ----------------------------------------------------------------------
375 // Part of code that manages the auto declaration of children classes
376 // ----------------------------------------------------------------------
377 
378 // Macro for the function that creates the object
379 #define FUNCTION_SCANNER(CLASS) \
380  static vScanner *make_scanner() { return new CLASS(); };
381 
382 // Macro for the class that links the appropriate function to the map of objects
383 #define CLASS_SCANNER(NAME,CLASS) \
384  class NAME##ScannerCreator \
385  { \
386  public: \
387  NAME##ScannerCreator() \
388  { sAddonManager::GetInstance()->mp_listOfScannerTypes[#NAME] = CLASS::make_scanner; } \
389  }; \
390  static NAME##ScannerCreator ScannerCreator##NAME;
391 
392 #endif
virtual int PROJ_SetSPECTNbBins(uint16_t *ap_nbOfBins)
Set SPECT number of Bins.
Definition: vScanner.cc:268
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:289
#define FLTNB
Definition: gVariables.hh:55
virtual int PROJ_SetSPECTAngles(FLTNB *ap_projectionAngles)
Set SPECT projection angles.
Definition: vScanner.cc:313
oMatrix * mp_positionMatrix_out
Definition: vScanner.hh:368
virtual int PROJ_GetPETSpecificParameters(int *ap_maxRingDiff)
Get geometric PET specific parameters to initialize the datafile.
Definition: vScanner.cc:176
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:28
virtual uint16_t PROJ_GetSPECTNbProjections()
return the total number of projections for a SPECT acquisition
Definition: vScanner.cc:354
virtual int GetScannerLayerNbRings(int a_layer)
Return an error by default.
Definition: vScanner.cc:155
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:374
FLTNB m_multiBedDisplacementInMm
Definition: vScanner.hh:370
oMatrix * mp_rotationMatrix
Definition: vScanner.hh:366
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:232
Singleton class that Instantiate and initialize the scanner object.
virtual ~vScanner()
vScanner destructor.
Definition: vScanner.cc:46
int m_verbose
Definition: vScanner.hh:364
virtual int ComputeLUT()
Virtual function which should be implemented by the child classes. It computes the LUT of the scann...
Definition: vScanner.cc:70
Declaration of class oMatrix.
bool m_allParametersChecked
Definition: vScanner.hh:365
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:225
Declaration of class sRandomNumberGenerator.
FLTNB GetMultiBedDisplacementInMm()
Definition: vScanner.hh:231
virtual int GetSPECTSpecificParameters(uint16_t *ap_nbOfProjections, uint16_t *ap_nbHeads, 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:204
virtual int PROJ_SetSPECTCORtoDetectorDistance(FLTNB a_CORtoDetectorDistance)
Set distance between center of rotation and SPECT detectors.
Definition: vScanner.cc:334
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:363
virtual int GetGeometricInfoFromDatafile(string a_path)=0
This function is implemented in child classes Recover geometric informations specific to the scanne...
virtual int SetPETMaxRingDiff(int a_maxRingDiff)
Set the maximal ring difference.
Definition: vScanner.cc:137
Declaration of class sOutputManager.
oMatrix * mp_positionMatrix_ref
Definition: vScanner.hh:367
Structure designed for basic matrices operations.
Definition: oMatrix.hh:20
virtual int LoadLUT()
Virtual function which should be implemented by the child classes. Load a precomputed scanner LUT...
Definition: vScanner.cc:93
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:115
int m_rotDirection
Definition: vScanner.hh:369
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...
int GetScannerType()
Definition: vScanner.hh:218
Generic class for scanner objects.
Definition: vScanner.hh:48
virtual int BuildLUT(bool a_scannerFileIsLUT)=0
This function is implemented in child classes. Instantiate the scanner look-up-table (LUT) ...