CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
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-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 IDATAFILESPECT_HH
31 #define IDATAFILESPECT_HH 1
32 
33 #include "gVariables.hh"
34 #include "vDataFile.hh"
35 #include "vScanner.hh"
36 #include "iEventHistoSPECT.hh"
37 #include "iEventListSPECT.hh"
38 
46 class iDataFileSPECT : public vDataFile
47 {
48  // -------------------------------------------------------------------
49  // Constructor & Destructor
50  public:
60 
61  // -------------------------------------------------------------------
62  // Public member functions
63  public:
72  int ReadSpecificInfoInHeader(bool a_affectQuantificationFlag);
78  int WriteHeader();
84  int ComputeSizeEvent();
91  int PrepareDataFile();
99  int WriteEvent(vEvent* ap_Event, int a_th=0);
107  vEvent* GetEventSpecific(char* ap_buffer, int a_th);
115  int InitAngles(FLTNB* ap_angles);
124  int InitCorToDetectorDistance(FLTNB* ap_CORtoDetectorDistance);
129  void DescribeSpecific();
130 
131  // -------------------------------------------------------------------
132  // Public functions dedicated to the projection script
133  public:
139  int PROJ_InitFile();
146 
147  // -------------------------------------------------------------------
148  // Public Get & Set functions
149  public:
154  inline uint16_t GetNbHeads()
155  {return m_nbHeads;};
160  inline uint16_t GetNbProjections()
161  {return m_nbOfProjections;};
166  inline FLTNB* GetAngles()
167  {return mp_angles;};
173  {return mp_CORtoDetectorDistance;};
179  inline uint16_t GetNbBins(int axis)
180  {return mp_nbOfBins[axis];};
186  inline void SetEventKindFlagOn()
187  {m_eventKindFlag = true;}
194  {m_scatCorrectionFlag = true;}
202  inline void SetIsotope(string a_value)
203  {m_isotope = a_value;}
208  inline string GetIsotope()
209  {return m_isotope;}
216  inline void SetNbBins(uint16_t a_binTrs, uint16_t a_binAxl)
217  {mp_nbOfBins[0] = a_binTrs; mp_nbOfBins[1]=a_binAxl;}
223  inline void SetNbProjections(uint16_t a_nbProjections)
224  {m_nbOfProjections = a_nbProjections;}
230  inline void SetNbHeads(uint16_t a_nbHeads)
231  {m_nbHeads = a_nbHeads;}
237  inline int GetHeadRotDirection()
238  {return m_headRotDirection;}
244  inline void SetHeadRotDirection(int a_direction)
245  {m_headRotDirection = a_direction;}
251  inline bool GetEventKindFlag()
252  {return m_eventKindFlag;}
258  inline bool GetScatCorrectionFlag()
259  {return m_scatCorrectionFlag;}
265  inline bool GetNormCorrectionFlag()
266  {return m_normCorrectionFlag;}
267 
268  // -------------------------------------------------------------------
269  // Private member functions
270  private:
276  int SetSpecificParametersFrom(vDataFile* ap_DataFile);
297  int WriteHistoEvent(iEventHistoSPECT* ap_Event, int a_th);
305  int WriteListEvent(iEventListSPECT* ap_Event, int a_th);
314 
315  // -------------------------------------------------------------------
316  // Data members
317  private:
318  string m_isotope;
324  uint16_t mp_nbOfBins[2];
326  uint16_t m_nbOfProjections;
329  uint16_t m_nbHeads;
336 };
337 
338 #endif
int CheckSpecificConsistencyWithAnotherDataFile(vDataFile *ap_DataFile)
Check consistency between &#39;this&#39; and the provided datafile, for specific characteristics.
void SetNbHeads(uint16_t a_nbHeads)
initialize the number of cameras
This class is designed to be a mother virtual class for DataFile.
Definition: vDataFile.hh:102
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 &#39;ap_buffer&#39;, 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:42
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]
void SetScatterCorrectionFlagOn()
set to true the flag indicating the presence of scatter correction factors in the datafile ...
bool GetScatCorrectionFlag()
Simply return m_scatCorrectionFlag.
Inherit from iEventSPECT. Class for SPECT list-mode events.