CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
code/include/scanner/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"
14 #include "sRandomNumberGenerator.hh"
15 
24 #define GEO_ROT_CW 0
25 
26 #define GEO_ROT_CCW 1
27 
29 class sScannerManager;
30 
39 class vScanner
40 {
41  // -------------------------------------------------------------------
42  // Constructor & Destructor
43  public:
48  vScanner();
52  virtual ~vScanner();
53 
54 
55  // -------------------------------------------------------------------
56  // Public member functions
57  public:
62  void Describe();
67  virtual void DescribeSpecific() = 0;
76  virtual int Instantiate(bool a_scannerFileIsLUT) = 0;
85  virtual int BuildLUT(bool a_scannerFileIsLUT) = 0;
92  virtual int CheckParameters() = 0;
99  virtual int Initialize() = 0;
114  virtual int GetPositionsAndOrientations( int a_index1, int a_index2,
115  FLTNB ap_Position1[3], FLTNB ap_Position2[3],
116  FLTNB ap_Orientation1[3], FLTNB ap_Orientation2[3],
117  FLTNB* ap_POI1 = NULL, FLTNB* ap_POI2 = NULL ) = 0;
130  virtual int GetRdmPositionsAndOrientations( int a_index1, int a_index2,
131  FLTNB ap_Position1[3], FLTNB ap_Position2[3],
132  FLTNB ap_Orientation1[3], FLTNB ap_Orientation2[3] ) = 0;
143  virtual int GetPositionWithRandomDepth( int a_index1, int a_index2, FLTNB ap_Position1[3], FLTNB ap_Position2[3] ) = 0;
157  virtual int GetTwoCorners( int a_index1, int a_index2,
158  FLTNB ap_CornerInf1[3], FLTNB ap_CornerSup1[3],
159  FLTNB ap_CornerInf2[3], FLTNB ap_CornerSup2[3]) = 0;
177  virtual int GetEdgesCenterPositions( int a_index1, int a_index2,
178  FLTNB ap_pos_line_point1[3], FLTNB ap_pos_line_point2[3],
179  FLTNB ap_pos_point1_x[4], FLTNB ap_pos_point1_y[4], FLTNB ap_pos_point1_z[4],
180  FLTNB ap_pos_point2_x[4], FLTNB ap_pos_point2_y[4], FLTNB ap_pos_point2_z[4] ) = 0;
192  virtual int ComputeLUT();
204  virtual int LoadLUT();
210  virtual int GetSystemNbElts() = 0;
220  virtual int IsAvailableLOR(int a_elt1, int a_elt2);
226  virtual void ShowHelp() = 0;
234  virtual int GetGeometricInfoFromDataFile(string a_path) = 0;
240  inline int GetScannerType()
241  {return m_scannerType;}
247  string GetScannerTypeString();
253  inline void SetVerbose(int a_verboseLevel)
254  {m_verbose = a_verboseLevel;}
261  {mp_ID = ap_ID;}
272  inline virtual FLTNB GetDetectionElementSizeTrans() = 0;
277  inline virtual FLTNB GetDetectionElementSizeAxial() = 0;
278 
279  // -------------------------------------------------------------------
280  // PET dedicated functions (only overloaded by PET scanner class)
281  public:
290  virtual int SetPETMaxAxialDiffmm(FLTNB a_maxAxialDiffmm);
291 
300  virtual int SetRotDirection( string a_rotDirection );
301 
310  virtual int PROJ_GetPETSpecificParameters(FLTNB* ap_maxRingDiff);
311 
312 
313  // -------------------------------------------------------------------
314  // SPECT dedicated functions (only surcharged by SPECT scanner classes)
315  public:
331  virtual int GetSPECTSpecificParameters( uint16_t* ap_nbOfProjections,
332  uint16_t* ap_nbHeads,
333  FLTNB* ap_acquisitionZoom,
334  uint16_t* ap_nbOfBins,
335  FLTNB* ap_pixSizeXY,
336  FLTNB*& ap_angles,
337  FLTNB*& ap_CORtoDetectorDistance,
338  int* ap_headRotDirection );
349  virtual int GetCTSpecificParameters( uint16_t* ap_nbOfProjections,
350  FLTNB*& ap_angles,
351  int* ap_detectorRotDirection );
360  virtual int PROJ_SetSPECTNbBins( uint16_t* ap_nbOfBins );
369  virtual int PROJ_SetSPECTNbProjections( uint32_t a_nbOfProjections );
378  virtual int PROJ_SetSPECTAngles( FLTNB* ap_projectionAngles );
387  virtual int PROJ_SetSPECTCORtoDetectorDistance( FLTNB a_CORtoDetectorDistance );
395  virtual uint16_t PROJ_GetSPECTNbProjections(); // required for analytic projection (computations of indices for projection main loops in sScannerManager)
403  virtual uint16_t PROJ_GetSPECTNbPixels(); // required for analytic projection (computations of index for projection main loops in sScannerManager)
404 
405 
406  // -------------------------------------------------------------------
407  // Private member functions
408  private:
409 
410 
411  // -------------------------------------------------------------------
412  // Data members
413  protected:
415  int m_verbose;
423 };
424 
425 
426 // ----------------------------------------------------------------------
427 // Part of code that manages the auto declaration of children classes
428 // ----------------------------------------------------------------------
429 
430 // Macro for the function that creates the object
431 #define FUNCTION_SCANNER(CLASS) \
432  static vScanner *make_scanner() { return new CLASS(); };
433 
434 // Macro for the class that links the appropriate function to the map of objects
435 #define CLASS_SCANNER(NAME,CLASS) \
436  class NAME##ScannerCreator \
437  { \
438  public: \
439  NAME##ScannerCreator() \
440  { sAddonManager::GetInstance()->mp_listOfScannerTypes[#NAME] = CLASS::make_scanner; } \
441  }; \
442  static NAME##ScannerCreator ScannerCreator##NAME;
443 
444 #endif
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
virtual int PROJ_SetSPECTNbBins(uint16_t *ap_nbOfBins)
oImageDimensionsAndQuantification * mp_ID
Declaration of class oMatrix.
virtual FLTNB GetDetectionElementSizeAxial()=0
virtual int PROJ_SetSPECTNbProjections(uint32_t a_nbOfProjections)
virtual int PROJ_GetPETSpecificParameters(FLTNB *ap_maxRingDiff)
virtual int SetPETMaxAxialDiffmm(FLTNB a_maxAxialDiffmm)
virtual FLTNB GetDetectionElementSizeTrans()=0
virtual int PROJ_SetSPECTAngles(FLTNB *ap_projectionAngles)
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.
virtual int GetPositionWithRandomDepth(int a_index1, int a_index2, FLTNB ap_Position1[3], FLTNB ap_Position2[3])=0
virtual uint16_t PROJ_GetSPECTNbProjections()
return the total number of projections for a SPECT acquisition
virtual int GetGeometricInfoFromDataFile(string a_path)=0
virtual int CheckParameters()=0
This function is implemented in child classes. Check that all parameters have been correctly initia...
virtual int BuildLUT(bool a_scannerFileIsLUT)=0
virtual int Initialize()=0
This function is implemented in child classes. Check initialization and set several parameters to t...
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
virtual uint16_t PROJ_GetSPECTNbPixels()
return the total number of pixels for a SPECT reconstruction
virtual void DescribeSpecific()=0
A pure virtual function used to describe the specific parts of the scanner.
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ID)
virtual int SetRotDirection(string a_rotDirection)
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
Singleton class that Instantiate and initialize the scanner object.
virtual ~vScanner()
vScanner destructor.
void Describe()
A function used to describe the generic parts of the datafile.
virtual int ComputeLUT()
Virtual function which should be implemented by the child classes. It computes the LUT of the scann...
string GetScannerTypeString()
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)
void SetVerbose(int a_verboseLevel)
virtual int PROJ_SetSPECTCORtoDetectorDistance(FLTNB a_CORtoDetectorDistance)
virtual int GetSystemNbElts()=0
This is a pure virtual method that must be implemented by children.
Structure designed for basic matrices operations.
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...
virtual int Instantiate(bool a_scannerFileIsLUT)=0
virtual int IsAvailableLOR(int a_elt1, int a_elt2)
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
virtual int GetCTSpecificParameters(uint16_t *ap_nbOfProjections, FLTNB *&ap_angles, int *ap_detectorRotDirection)
Generic class for scanner objects.