CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
sScannerManager.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 SSCANNERMANAGER_HH
31 #define SSCANNERMANAGER_HH 1
32 
33 #include "gVariables.hh"
34 #include "gOptions.hh"
35 #include "sOutputManager.hh"
36 #ifdef _WIN32
37 #include "oDirentWin32.hh"
38 #else
39 #include "dirent.h"
40 #endif
41 #include "vScanner.hh"
42 
51 #define SCANNER_UNKNOWN -1
52 
53 #define SCANNER_PET 0
54 
55 #define SCANNER_SPECT_PINHOLE 1
56 
57 #define SCANNER_SPECT_CONVERGENT 2
58 
59 #define SCANNER_CT 3
60 
61 #define SCANNER_SINOGRAM 4
62 
72 {
73  // -----------------------------------------------------------------------------------------
74  // Constructor & Destructor
75  public:
83  {
84  if (mp_Instance == NULL)
86  return mp_Instance;
87  }
88 
89  // -----------------------------------------------------------------------------------------
90  // Public member functions
91  public:
96  void Describe();
102  int CheckParameters();
110  int Initialize();
125  int FindScannerSystem(string a_scannerName);
134  int InitScannerWithFile(string a_pathScanFile, string a_scannerName, int a_fileTypeFlag);
141  int BuildScannerObject();
149  int GetGeometricInfoFromDataFile(string a_pathToDataFilename);
156  int InstantiateScanner();
162  int BuildLUT();
179  int GetModalityFromString(string a_systemStr);
180 
181 
182  // -------------------------------------------------------------------
183  // Get & Set functions
184  public:
189  inline bool HasUserScannerFile()
190  {return m_hasUserScannerFile;}
195  inline string GetPathToScannerFile()
196  {return m_pathToScannerFile;}
201  inline string GetScannerName()
202  {return m_scannerName;}
208  inline int GetScannerType()
209  {return (mp_Scanner!=NULL) ? mp_Scanner->GetScannerType() : SCANNER_UNKNOWN ;}
215  {return mp_Scanner;}
220  inline int GetSystemNbElts()
221  {return mp_Scanner->GetSystemNbElts();}
227  inline void SetVerbose(int a_verboseLevel)
228  {m_verbose = a_verboseLevel;}
235  {mp_ID = ap_ID;}
242  inline void SetSaveLUTFlag(bool a_flag)
243  {m_saveLUTFlag = a_flag;}
250  inline bool SaveLUTFlag()
251  {return m_saveLUTFlag;}
252 
253 
254  // -------------------------------------------------------------------
255  // Analytical projection functions
256  public:
271  int64_t PROJ_GetModalityStartValueInnerLoop(int64_t a_elt1);
288  int64_t PROJ_GetCurrentProgression(int64_t a_elt1, int64_t a_elt2, int64_t* ap_nbEltsArray, int a_nbRGates, int a_nbCGates, int a_fr, int a_rg, int a_cg);
296 
297 
298  // -------------------------------------------------------------------
299  // Functions dedicated to transfer geometric information for Projection, from the main class to the scanner class (Set)
300  // from the scanner class to the datafile (Get, for datafile header writing)
301  public:
302  // RECONSTRUCTION
316  int GetSPECTSpecificParameters(uint16_t* ap_nbOfProjections,
317  uint16_t* ap_nbHeads,
318  FLTNB* ap_acquisitionZoom,
319  uint16_t* ap_nbOfBins,
320  FLTNB* ap_pixSizeXY,
321  FLTNB*& ap_angles,
322  FLTNB*& ap_CORtoDetectorDistance,
323  int* ap_headRotDirection);
332  int GetCTSpecificParameters(uint16_t* ap_nbOfProjections,
333  FLTNB*& ap_angles,
334  int* ap_headRotDirection);
335  // ANALYTICAL PROJECTION
343  int PROJ_GetPETSpecificParameters(FLTNB* ap_maxAxialDiffmm);
351  int PROJ_SetPETSpecificParameters(FLTNB a_maxAxialDiffmm);
365  int PROJ_SetSPECTSpecificParameters(uint16_t* ap_nbOfBins,
366  uint32_t a_nbOfProjections,
367  FLTNB a_firstAngle,
368  FLTNB a_stepAngle,
369  FLTNB* ap_projectionAngles,
370  FLTNB a_CORtoDetectorDistance,
371  string a_rotDirection);
372 
373 
374  // -------------------------------------------------------------------
375  // Private member functions
376  private:
383  sScannerManager();
388  // Prevent the compiler to generate methods to copy the object :
390  void operator=(sScannerManager const&){};
398  int GetAvailableScanners(vector<string> *ap_scannerNames);
399 
400 
401  // -------------------------------------------------------------------
402  // Data members
403  private:
407  int m_verbose;
409  string m_scannerName;
414 };
415 
416 #endif
This header file is mainly used to declare some macro definitions and all includes needed from the st...
sScannerManager(sScannerManager const &)
static sScannerManager * GetInstance()
Instanciate the singleton object and Initialize member variables if not already done, return a pointer to this object otherwise.
int GetAvailableScanners(vector< string > *ap_scannerNames)
Gather all the names of the header files (.geom & .hscan) in the repository folder in the vector<stri...
int64_t PROJ_GetModalityStartValueInnerLoop(int64_t a_elt1)
Get the start value for the inner loop of analytic projection depending on the modality.
#define FLTNB
Definition: gVariables.hh:81
int FindScannerSystem(string a_scannerName)
Look for a file matching with the scanner name in parameter inside the scanner repository.
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)
A simple utility function which returns the integer corresponding to the system string passed in pa...
static sScannerManager * mp_Instance
string GetPathToScannerFile()
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)
Transfer geometric information recovered from the datafile to the scanner object. ...
void SetSaveLUTFlag(bool a_flag)
Set to on the flag indicating a LUT generated by a geom file should be written on disk or not...
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.
Declaration of class vScanner.
Singleton class that Instantiate and initialize the scanner object.
int PROJ_SetPETSpecificParameters(FLTNB a_maxAxialDiffmm)
Deliver to the PET scanner object all informations provided from the datafile header.
bool SaveLUTFlag()
Get flag indicating a LUT generated by a geom file should be written on disk or not.
vScanner * GetScannerObject()
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)
Deliver to the SPECT scanner object all informations provided from the acquisition parameters...
void operator=(sScannerManager const &)
int Initialize()
Initialization : .
virtual int GetSystemNbElts()=0
This is a pure virtual method that must be implemented by children.
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ID)
Set the pointer to the image dimensions and quantification object.
vScanner * mp_Scanner
Declaration of class sOutputManager.
oImageDimensionsAndQuantification * mp_ID
int64_t PROJ_GetCurrentProgression(int64_t a_elt1, int64_t a_elt2, int64_t *ap_nbEltsArray, int a_nbRGates, int a_nbCGates, int a_fr, int a_rg, int a_cg)
Get numerator value according to the modality to compute percent progression during the analytical pr...
This class is designed to manage all dimensions and quantification related stuff. ...
This file is used for all kind of different functions designed for options parsing and ASCII file rea...
void Describe()
Call the eponym function from the Scanner object (if initialized)
void SetVerbose(int a_verboseLevel)
set verbosity
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)
Transfer geometric information recovered from the datafile to the scanner object. ...
int GetGeometricInfoFromDataFile(string a_pathToDataFilename)
Call the specialized function of the scanner object in order to get geometric informations from the d...
int PROJ_GetPETSpecificParameters(FLTNB *ap_maxAxialDiffmm)
Transfer addresses to each geometric parameter of the PET scanner objets to the corresponding pointer...
int GetScannerType()
Definition: vScanner.hh:262
Generic class for scanner objects.
Definition: vScanner.hh:61
int InitScannerWithFile(string a_pathScanFile, string a_scannerName, int a_fileTypeFlag)
Initialize member variables (file path, file type, and scanner name) with the provided arguments...