CASToR  2.0
Tomographic Reconstruction (PET/SPECT/CT)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
iDataFileSPECT.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 IDATAFILESPECT_HH
32 #define IDATAFILESPECT_HH 1
33 
34 #include "gVariables.hh"
35 #include "vDataFile.hh"
36 #include "vScanner.hh"
37 #include "iEventHistoSPECT.hh"
38 #include "iEventListSPECT.hh"
39 
47 class iDataFileSPECT : public vDataFile
48 {
49  // -------------------------------------------------------------------
50  // Constructor & Destructor
51  public:
61 
62  // -------------------------------------------------------------------
63  // Public member functions
64  public:
73  int ReadSpecificInfoInHeader(bool a_affectQuantificationFlag);
79  int WriteHeader();
85  int ComputeSizeEvent();
92  int PrepareDataFile();
100  int WriteEvent(vEvent* ap_Event, int a_th=0);
108  vEvent* GetEventSpecific(char* ap_buffer, int a_th);
116  int InitAngles(FLTNB* ap_angles);
125  int InitCorToDetectorDistance(FLTNB* ap_CORtoDetectorDistance);
130  void DescribeSpecific();
131 
132  // -------------------------------------------------------------------
133  // Public functions dedicated to the projection script
134  public:
140  int PROJ_InitFile();
147 
148  // -------------------------------------------------------------------
149  // Public Get & Set functions
150  public:
155  inline uint16_t GetNbHeads()
156  {return m_nbHeads;};
161  inline uint16_t GetNbProjections()
162  {return m_nbOfProjections;};
167  inline FLTNB* GetAngles()
168  {return mp_angles;};
174  {return mp_CORtoDetectorDistance;};
180  inline uint16_t GetNbBins(int axis)
181  {return mp_nbOfBins[axis];};
187  inline void SetEventKindFlagOn()
188  {m_eventKindFlag = true;}
196  inline void SetIsotope(string a_value)
197  {m_isotope = a_value;}
202  inline string GetIsotope()
203  {return m_isotope;}
210  inline void SetNbBins(uint16_t a_binTrs, uint16_t a_binAxl)
211  {mp_nbOfBins[0] = a_binTrs; mp_nbOfBins[1]=a_binAxl;}
217  inline void SetNbProjections(uint16_t a_nbProjections)
218  {m_nbOfProjections = a_nbProjections;}
224  inline int GetHeadRotDirection()
225  {return m_headRotDirection;}
231  inline void SetHeadRotDirection(int a_direction)
232  {m_headRotDirection = a_direction;}
238  inline bool GetEventKindFlag()
239  {return m_eventKindFlag;}
245  inline bool GetScatCorrectionFlag()
246  {return m_scatCorrectionFlag;}
252  inline bool GetNormCorrectionFlag()
253  {return m_normCorrectionFlag;}
254 
255  // -------------------------------------------------------------------
256  // Private member functions
257  private:
263  int SetSpecificParametersFrom(vDataFile* ap_DataFile);
284  int WriteHistoEvent(iEventHistoSPECT* ap_Event, int a_th);
292  int WriteListEvent(iEventListSPECT* ap_Event, int a_th);
301 
302  // -------------------------------------------------------------------
303  // Data members
304  private:
305  string m_isotope;
311  uint16_t mp_nbOfBins[2];
313  uint16_t m_nbOfProjections;
316  uint16_t m_nbHeads;
323 };
324 
325 #endif
int CheckSpecificConsistencyWithAnotherDataFile(vDataFile *ap_DataFile)
Check consistency between 'this' and the provided datafile, for specific characteristics.
This class is designed to be a mother virtual class for DataFile.
Definition: vDataFile.hh:103
This header file is mainly used to declare some macro definitions and all includes needed from the st...
bool GetNormCorrectionFlag()
Simply return m_normCorrectionFlag.
int InitAngles(FLTNB *ap_angles)
allocate memory for the mp_angles variable using m_nbProjections and initialize the projection angles...
int ReadSpecificInfoInHeader(bool a_affectQuantificationFlag)
Read through the header file and recover specific SPECT information.
#define FLTNB
Definition: gVariables.hh:81
bool GetEventKindFlag()
Simply return m_eventKindFlag.
iDataFileSPECT()
iDataFileSPECT constructor. Initialize the member variables to their default values.
FLTNB * GetAngles()
int WriteHeader()
Generate a header file according to the data output information.
Inherit from iEventSPECT. Class for SPECT histogram mode events.
void DescribeSpecific()
Implementation of the pure virtual eponym function that simply prints info about the datafile...
int WriteListEvent(iEventListSPECT *ap_Event, int a_th)
Write a SPECT list-mode event.
void SetHeadRotDirection(int a_direction)
initialize the rotation direction of the gamma camera(s)
~iDataFileSPECT()
iDataFileSPECT destructor.
uint16_t m_nbOfProjections
void SetNbProjections(uint16_t a_nbProjections)
initialize the number of projections
void SetIsotope(string a_value)
initialize the isotope string value
int PROJ_GetScannerSpecificParameters()
Get SPECT specific parameters for projections from the scanner object, through the scannerManager...
void SetNbBins(uint16_t a_binTrs, uint16_t a_binAxl)
initialize the bin values
int ComputeSizeEvent()
Computation of the size of each event according to the mandatory/optional correction fields...
Declaration of class vScanner.
int CheckSpecificParameters()
Check parameters specific to SPECT data.
Declaration of class vDataFile.
int CheckFileSizeConsistency()
This function is implemented in child classes Check if file size is consistent. ...
int InitCorToDetectorDistance(FLTNB *ap_CORtoDetectorDistance)
allocate memory for the ap_CORtoDetectorDistance variable using m_nbProjections, and initialize the p...
uint16_t GetNbBins(int axis)
uint16_t GetNbProjections()
Inherit from vDataFile. Class that manages the reading of a SPECT input file (header + data)...
Declaration of class iEventListSPECT.
int GetHeadRotDirection()
Simply return m_headRotDirection.
int WriteHistoEvent(iEventHistoSPECT *ap_Event, int a_th)
Write a SPECT histogram event.
vEvent * GetEventSpecific(char *ap_buffer, int a_th)
Read an event from the position pointed by 'ap_buffer', parse the generic or modality-specific inform...
int PROJ_InitFile()
Initialize the fstream objets for output writing as well as some other variables specific to the Proj...
bool m_ignoreNormCorrectionFlag
int SetSpecificParametersFrom(vDataFile *ap_DataFile)
Initialize all parameters specific to SPECT from the provided datafile.
FLTNB * mp_CORtoDetectorDistance
Declaration of class iEventHistoSPECT.
Mother class for the Event objects.
Definition: vEvent.hh:43
int WriteEvent(vEvent *ap_Event, int a_th=0)
Write event according to the chosen type of data.
FLTNB * GetCORtoDetectorDistance()
void SetEventKindFlagOn()
set to true the flag indicating the presence of the kind of a list-mode event in the datafile ...
uint16_t GetNbHeads()
int PrepareDataFile()
Store different kind of information inside arrays (data relative to specific correction as well as ba...
bool m_ignoreScatCorrectionFlag
uint16_t mp_nbOfBins[2]
bool GetScatCorrectionFlag()
Simply return m_scatCorrectionFlag.
Inherit from iEventSPECT. Class for SPECT list-mode events.