CASToR  2.0
Tomographic Reconstruction (PET/SPECT/CT)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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-2018 all CASToR contributors listed below:
18 
19  --> current contributors: Thibaut MERLIN, Simon STUTE, Didier BENOIT, Claude COMTAT, Marina FILIPOVIC, Mael MILLARDET
20  --> past contributors: Valentin VIELZEUF
21 
22 This is CASToR version 2.0.
23 */
24 
31 #ifndef SSCANNERMANAGER_HH
32 #define SSCANNERMANAGER_HH 1
33 
34 #include "gVariables.hh"
35 #include "gOptions.hh"
36 #include "sOutputManager.hh"
37 #ifdef _WIN32
38 #include "oDirentWin32.hh"
39 #else
40 #include "dirent.h"
41 #endif
42 #include "vScanner.hh"
43 
52 #define SCANNER_UNKNOWN -1
53 
54 #define SCANNER_PET 0
55 
56 #define SCANNER_SPECT_PINHOLE 1
57 
58 #define SCANNER_SPECT_CONVERGENT 2
59 
60 #define SCANNER_CT 3
61 
62 #define SCANNER_SINOGRAM 4
63 
73 {
74  // -----------------------------------------------------------------------------------------
75  // Constructor & Destructor
76  public:
84  {
85  if (mp_Instance == NULL)
87  return mp_Instance;
88  }
89 
90  // -----------------------------------------------------------------------------------------
91  // Public member functions
92  public:
97  void Describe();
103  int CheckParameters();
111  int Initialize();
126  int FindScannerSystem(string a_scannerName);
135  int InitScannerWithFile(string a_pathScanFile, string a_scannerName, int a_fileTypeFlag);
142  int BuildScannerObject();
150  int GetGeometricInfoFromDataFile(string a_pathToDataFilename);
157  int InstantiateScanner();
163  int BuildLUT();
180  int GetModalityFromString(string a_systemStr);
181 
182 
183  // -------------------------------------------------------------------
184  // Get & Set functions
185  public:
190  inline bool HasUserScannerFile()
191  {return m_hasUserScannerFile;}
196  inline string GetPathToScannerFile()
197  {return m_pathToScannerFile;}
202  inline string GetScannerName()
203  {return m_scannerName;}
209  inline int GetScannerType()
210  {return (mp_Scanner!=NULL) ? mp_Scanner->GetScannerType() : SCANNER_UNKNOWN ;}
216  {return mp_Scanner;}
221  inline int GetSystemNbElts()
222  {return mp_Scanner->GetSystemNbElts();}
228  inline void SetVerbose(int a_verboseLevel)
229  {m_verbose = a_verboseLevel;}
236  {mp_ID = ap_ID;}
243  inline void SetSaveLUTFlag(bool a_flag)
244  {m_saveLUTFlag = a_flag;}
251  inline bool SaveLUTFlag()
252  {return m_saveLUTFlag;}
253 
254 
255  // -------------------------------------------------------------------
256  // Analytical projection functions
257  public:
272  int64_t PROJ_GetModalityStartValueInnerLoop(int64_t a_elt1);
289  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);
297 
298 
299  // -------------------------------------------------------------------
300  // Functions dedicated to transfer geometric information for Projection, from the main class to the scanner class (Set)
301  // from the scanner class to the datafile (Get, for datafile header writing)
302  public:
303  // RECONSTRUCTION
317  int GetSPECTSpecificParameters(uint16_t* ap_nbOfProjections,
318  uint16_t* ap_nbHeads,
319  FLTNB* ap_acquisitionZoom,
320  uint16_t* ap_nbOfBins,
321  FLTNB* ap_pixSizeXY,
322  FLTNB*& ap_angles,
323  FLTNB*& ap_CORtoDetectorDistance,
324  int* ap_headRotDirection);
333  int GetCTSpecificParameters(uint16_t* ap_nbOfProjections,
334  FLTNB*& ap_angles,
335  int* ap_headRotDirection);
336  // ANALYTICAL PROJECTION
344  int PROJ_GetPETSpecificParameters(FLTNB* ap_maxAxialDiffmm);
352  int PROJ_SetPETSpecificParameters(FLTNB a_maxAxialDiffmm);
366  int PROJ_SetSPECTSpecificParameters(uint16_t* ap_nbOfBins,
367  uint32_t a_nbOfProjections,
368  FLTNB a_firstAngle,
369  FLTNB a_stepAngle,
370  FLTNB* ap_projectionAngles,
371  FLTNB a_CORtoDetectorDistance,
372  string a_rotDirection);
373 
374 
375  // -------------------------------------------------------------------
376  // Private member functions
377  private:
384  sScannerManager();
389  // Prevent the compiler to generate methods to copy the object :
391  void operator=(sScannerManager const&){};
399  int GetAvailableScanners(vector<string> *ap_scannerNames);
400 
401 
402  // -------------------------------------------------------------------
403  // Data members
404  private:
408  int m_verbose;
410  string m_scannerName;
415 };
416 
417 #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:263
Generic class for scanner objects.
Definition: vScanner.hh:62
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...