CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
include/scanner/sScannerManager.hh
Go to the documentation of this file.
1 
8 #ifndef SSCANNERMANAGER_HH
9 #define SSCANNERMANAGER_HH 1
10 
11 #include "gVariables.hh"
12 #include "gOptions.hh"
13 #include "sOutputManager.hh"
14 #ifdef _WIN32
15 #include "oDirentWin32.hh"
16 #else
17 #include "dirent.h"
18 #endif
19 #include "vScanner.hh"
20 
29 #define SCANNER_UNKNOWN -1
30 
31 #define SCANNER_PET 0
32 
33 #define SCANNER_SPECT_PINHOLE 1
34 
35 #define SCANNER_SPECT_CONVERGENT 2
36 
37 #define SCANNER_CT 3
38 
39 #define SCANNER_SINOGRAM 4
40 
49 class sScannerManager
50 {
51  // -----------------------------------------------------------------------------------------
52  // Constructor & Destructor
53  public:
61  {
62  if (mp_Instance == NULL)
64  return mp_Instance;
65  }
66 
67  // -----------------------------------------------------------------------------------------
68  // Public member functions
69  public:
74  void Describe();
80  int CheckParameters();
88  int Initialize();
103  int FindScannerSystem(string a_scannerName);
112  int InitScannerWithFile(string a_pathScanFile, string a_scannerName, int a_fileTypeFlag);
119  int BuildScannerObject();
127  int GetGeometricInfoFromDataFile(string a_pathToDataFilename);
134  int InstantiateScanner();
140  int BuildLUT();
157  int GetModalityFromString(string a_systemStr);
158 
159 
160  // -------------------------------------------------------------------
161  // Get & Set functions
162  public:
167  inline bool HasUserScannerFile()
168  {return m_hasUserScannerFile;}
173  inline string GetPathToScannerFile()
174  {return m_pathToScannerFile;}
179  inline string GetScannerName()
180  {return m_scannerName;}
186  inline int GetScannerType()
187  {return (mp_Scanner!=NULL) ? mp_Scanner->GetScannerType() : SCANNER_UNKNOWN ;}
193  {return mp_Scanner;}
198  inline int GetSystemNbElts()
199  {return mp_Scanner->GetSystemNbElts();}
205  inline void SetVerbose(int a_verboseLevel)
206  {m_verbose = a_verboseLevel;}
213  {mp_ID = ap_ID;}
220  inline void SetSaveLUTFlag(bool a_flag)
221  {m_saveLUTFlag = a_flag;}
228  inline bool SaveLUTFlag()
229  {return m_saveLUTFlag;}
230 
231 
232  // -------------------------------------------------------------------
233  // Analytical projection functions
234  public:
249  int64_t PROJ_GetModalityStartValueInnerLoop(int64_t a_elt1);
262  int64_t PROJ_GetCurrentProgression(int64_t a_elt1, int64_t a_elt2, int64_t* ap_nbEltsArray, uint16_t a_nbDynImgProcessed);
270 
271 
272  // -------------------------------------------------------------------
273  // Functions dedicated to transfer geometric information for Projection, from the main class to the scanner class (Set)
274  // from the scanner class to the datafile (Get, for datafile header writing)
275  public:
276  // RECONSTRUCTION
290  int GetSPECTSpecificParameters(uint16_t* ap_nbOfProjections,
291  uint16_t* ap_nbHeads,
292  FLTNB* ap_acquisitionZoom,
293  uint16_t* ap_nbOfBins,
294  FLTNB* ap_pixSizeXY,
295  FLTNB*& ap_angles,
296  FLTNB*& ap_CORtoDetectorDistance,
297  int* ap_headRotDirection);
306  int GetCTSpecificParameters(uint16_t* ap_nbOfProjections,
307  FLTNB*& ap_angles,
308  int* ap_headRotDirection);
309  // ANALYTICAL PROJECTION
317  int PROJ_GetPETSpecificParameters(FLTNB* ap_maxAxialDiffmm);
325  int PROJ_SetPETSpecificParameters(FLTNB a_maxAxialDiffmm);
339  int PROJ_SetSPECTSpecificParameters(uint16_t* ap_nbOfBins,
340  uint32_t a_nbOfProjections,
341  FLTNB a_firstAngle,
342  FLTNB a_stepAngle,
343  FLTNB* ap_projectionAngles,
344  FLTNB a_CORtoDetectorDistance,
345  string a_rotDirection);
346 
347 
348  // -------------------------------------------------------------------
349  // Private member functions
350  private:
357  sScannerManager();
362  // Prevent the compiler to generate methods to copy the object :
364  void operator=(sScannerManager const&){};
372  int GetAvailableScanners(vector<string> *ap_scannerNames);
373 
374 
375  // -------------------------------------------------------------------
376  // Data members
377  private:
378  static sScannerManager* mp_Instance;
381  int m_verbose;
382  string m_pathToScannerFile;
383  string m_scannerName;
384  bool m_hasUserScannerFile;
387  bool m_saveLUTFlag;
388 };
389 
390 #endif
sScannerManager(sScannerManager const &)
static sScannerManager * GetInstance()
int GetAvailableScanners(vector< string > *ap_scannerNames)
int64_t PROJ_GetModalityStartValueInnerLoop(int64_t a_elt1)
int FindScannerSystem(string a_scannerName)
Declaration of class vScanner.
int BuildScannerObject()
Instantiate the specific scanner object related to the modality, and set verbosity of scanner object...
int64_t PROJ_GetProgressionFinalValue()
Get numerator value according to the modality to compute percent progression during the projection pr...
#define SCANNER_UNKNOWN
int GetModalityFromString(string a_systemStr)
static sScannerManager * mp_Instance
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)
int CheckParameters()
Check if all parameters have been correctly initialized, and call the CheckParameters function of the...
int InstantiateScanner()
Instantiate scanner using the related function in the scanner classes.
sScannerManager()
sScannerManager constructor.
int BuildLUT()
Call the eponym function of the scanner class.
Singleton class that Instantiate and initialize the scanner object.
int PROJ_SetPETSpecificParameters(FLTNB a_maxAxialDiffmm)
int64_t PROJ_GetCurrentProgression(int64_t a_elt1, int64_t a_elt2, int64_t *ap_nbEltsArray, uint16_t a_nbDynImgProcessed)
int ShowScannersDescription()
Get the description associated to the different scanners and print all on screen. Walk through the ...
~sScannerManager()
sScannerManager destructor.
int PROJ_SetSPECTSpecificParameters(uint16_t *ap_nbOfBins, uint32_t a_nbOfProjections, FLTNB a_firstAngle, FLTNB a_stepAngle, FLTNB *ap_projectionAngles, FLTNB a_CORtoDetectorDistance, string a_rotDirection)
void operator=(sScannerManager const &)
oImageDimensionsAndQuantification * mp_ID
int Initialize()
Initialization : .
virtual int GetSystemNbElts()=0
This is a pure virtual method that must be implemented by children.
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ID)
This class is designed to manage all dimensions and quantification related stuff. ...
void Describe()
Call the eponym function from the Scanner object (if initialized)
void SetVerbose(int a_verboseLevel)
int64_t PROJ_GetModalityStopValueMainLoop()
Get the stop value for the main loop of analytic projection depending on the modality.
int GetCTSpecificParameters(uint16_t *ap_nbOfProjections, FLTNB *&ap_angles, int *ap_headRotDirection)
int GetGeometricInfoFromDataFile(string a_pathToDataFilename)
int PROJ_GetPETSpecificParameters(FLTNB *ap_maxAxialDiffmm)
Generic class for scanner objects.
int InitScannerWithFile(string a_pathScanFile, string a_scannerName, int a_fileTypeFlag)