CASToR  1.0
Tomographic Reconstruction (PET/SPECT)
sScannerManager.hh
Go to the documentation of this file.
00001 
00008 #ifndef SSCANNERMANAGER_HH
00009 #define SSCANNERMANAGER_HH 1
00010 
00011 #include "gVariables.hh"
00012 #include "gOptions.hh"
00013 #include "sOutputManager.hh"
00014 #ifdef _WIN32
00015 #include "oDirentWin32.hh"
00016 #else
00017 #include "dirent.h"
00018 #endif
00019 #include "vScanner.hh"
00020 
00021 
00022 
00029 #define SCANNER_UNKNOWN -1
00030 
00031 #define SCANNER_PET 0
00032 
00033 #define SCANNER_SPECT_PINHOLE 1
00034 
00035 #define SCANNER_SPECT_CONVERGENT 2
00036 
00037 #define SCANNER_CT 3
00038 
00039 #define SCANNER_SINOGRAM 4
00040 
00049 class sScannerManager
00050 {
00051   // -----------------------------------------------------------------------------------------
00052   // Constructor & Destructor
00053   public:
00060     static sScannerManager* GetInstance() 
00061     {
00062       if (mp_Instance == NULL)
00063         mp_Instance = new sScannerManager();
00064       return mp_Instance;
00065     }
00066 
00067   // -----------------------------------------------------------------------------------------
00068   // Public member functions
00069   public:
00075     int CheckParameters();
00083     int Initialize();
00091     int ShowScannersDescription();
00098     int FindScannerSystem(string a_scannerName);
00105     int BuildScannerObject();
00113     int GetGeometricInfoFromDatafile(string a_pathToDataFilename);
00120     int InstantiateScanner();
00126     int BuildLUT();
00134     int GetScannerLayerNbRings(int a_layer);
00135 
00136 
00137   // -------------------------------------------------------------------
00138   // Get & Set functions
00139   public:
00144     inline bool HasUserScannerFile()
00145            {return m_hasUserScannerFile;}
00150     inline string GetPathToScannerFile()
00151            {return m_pathToScannerFile;}
00156     inline string GetScannerName()
00157            {return m_scannerName;}
00163     inline int GetScannerType()
00164            {return (mp_Scanner!=NULL) ? mp_Scanner->GetScannerType() : SCANNER_UNKNOWN ;}
00169     inline vScanner* GetScannerObject()
00170            {return mp_Scanner;}
00175     inline int GetSystemNbElts()
00176            {return mp_Scanner->GetSystemNbElts();}
00182     inline void SetVerbose(int a_verboseLevel)
00183            {m_verbose = a_verboseLevel;};
00190     inline void SetSaveLUTFlag(bool a_flag)
00191            {m_saveLUTFlag = a_flag;}
00198     inline bool SaveLUTFlag()
00199            {return m_saveLUTFlag;}
00200     
00201     
00202   // -------------------------------------------------------------------
00203   // Analytical projection functions
00204   public:
00211     int64_t PROJ_GetModalityStopValueMainLoop();
00219     int64_t PROJ_GetModalityStartValueInnerLoop(int64_t a_elt1);
00236     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);
00243     int64_t PROJ_GetProgressionFinalValue();
00244 
00245 
00246   // -------------------------------------------------------------------
00247   // Functions dedicated to transfer geometric information for Projection, from the main class to the scanner class (Set)
00248   //                                                                       from the scanner class to the datafile (Get, for datafile header writing)
00249   public:
00250     // RECONSTRUCTION
00263     int GetSPECTSpecificParameters(uint16_t* ap_nbOfProjections, 
00264                                    uint16_t* ap_nbHeads, 
00265                                    uint16_t* ap_nbOfBins, 
00266                                    FLTNB*  ap_pixSizeXY,
00267                                    FLTNB*& ap_angles, 
00268                                    FLTNB*& ap_CORtoDetectorDistance,
00269                                    int* ap_headRotDirection);
00270     // ANALYTICAL PROJECTION
00278     int PROJ_GetPETSpecificParameters(int* a_maxRingDiff);
00286     int PROJ_SetPETSpecificParameters(int a_maxRingDiff);
00300     int PROJ_SetSPECTSpecificParameters(uint16_t* ap_nbOfBins,
00301                                         uint32_t a_nbOfProjections, 
00302                                         FLTNB a_firstAngle, 
00303                                         FLTNB a_stepAngle, 
00304                                         FLTNB* ap_projectionAngles, 
00305                                         FLTNB a_CORtoDetectorDistance,
00306                                         string a_rotDirection);
00307 
00308 
00309   // -------------------------------------------------------------------
00310   // Private member functions
00311   private:
00318     sScannerManager();
00322     ~sScannerManager();
00323     // Prevent the compiler to generate methods to copy the object :
00324     sScannerManager(sScannerManager const&){};
00325     void operator=(sScannerManager const&){};
00333     int GetAvailableScanners(vector<string> *ap_scannerNames);
00334 
00335 
00336   // -------------------------------------------------------------------
00337   // Data members
00338   private:
00339     static sScannerManager* mp_Instance; 
00340     vScanner* mp_Scanner;                
00341     int m_verbose;                       
00342     string m_pathToScannerFile;          
00343     string m_scannerName;                
00344     bool m_hasUserScannerFile;           
00345     bool m_hasGenericScannerFile;        
00346     bool m_allParametersChecked;         
00347     bool m_saveLUTFlag;                  
00348 };
00349 
00350 #endif
 All Classes Files Functions Variables Typedefs Defines