CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
iDataFilePET.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 IDATAFILEPET_HH
31 #define IDATAFILEPET_HH 1
32 
33 #include "gVariables.hh"
34 #include "vDataFile.hh"
35 
43 class iDataFilePET : public vDataFile
44 {
45  // -------------------------------------------------------------------
46  // Constructor & Destructor
47  public:
52  iDataFilePET();
56  ~iDataFilePET();
57 
58  // -------------------------------------------------------------------
59  // Public member functions
60  public:
69  int ReadSpecificInfoInHeader(bool a_affectQuantificationFlag);
75  int WriteHeader();
81  int ComputeSizeEvent();
88  int PrepareDataFile();
96  int WriteEvent(vEvent* ap_Event, int a_th);
104  vEvent* GetEventSpecific(char* ap_buffer, int a_th);
109  void DescribeSpecific();
110 
111  // -------------------------------------------------------------------
112  // Public Get & Set functions
113  public:
118  inline bool GetTOFInfoFlag()
119  {return m_TOFInfoFlag;}
124  inline void SetTOFInfoFlag()
125  {m_TOFInfoFlag = true;}
130  inline bool GetIgnoreTOFFlag()
131  {return m_ignoreTOFFlag;}
136  inline void SetTOFResolutionInPs(FLTNB a_TOFResolutionInPs)
137  {m_TOFResolutionInPs = a_TOFResolutionInPs;}
143  {return m_TOFResolutionInPs;}
148  inline int GetNbTOFBins()
149  {return m_nbTOFBins;}
155  {return m_TOFBinSizeInPs;}
166  inline void SetTOFMeasurementRangeInPs(FLTNB a_TOFMeasurementRangeInPs)
167  {m_TOFMeasurementRangeInPs = a_TOFMeasurementRangeInPs;}
173  {return m_TOFMeasurementRangeInPs;}
179  {return m_maxAxialDiffmm;}
184  inline void SetMaxNumberOfLinesPerEvent(uint16_t a_value)
185  {m_maxNumberOfLinesPerEvent = a_value;}
190  inline uint16_t GetMaxNumberOfLinesPerEvent()
199  inline void SetIsotope(string a_value)
200  {m_isotope = a_value;}
205  inline string GetIsotope()
206  {return m_isotope;}
212  inline void SetIgnoreTOFFlag(bool a_ignoreTOFFlag)
213  {m_ignoreTOFFlag = a_ignoreTOFFlag;}
220  inline void SetEventKindFlagOn()
221  {m_eventKindFlag = true;}
228  {m_atnCorrectionFlag = true;}
235  {m_normCorrectionFlag = true;}
242  {m_scatCorrectionFlag = true;}
249  {m_randCorrectionFlag = true;}
255  inline bool GetNormCorrectionFlag()
256  {return m_normCorrectionFlag;}
262  inline bool GetAtnCorrectionFlag()
263  {return m_atnCorrectionFlag;}
269  inline bool GetEventKindFlag()
270  {return m_eventKindFlag;}
276  inline bool GetScatCorrectionFlag()
277  {return m_scatCorrectionFlag;}
283  inline bool GetRandCorrectionFlag()
284  {return m_randCorrectionFlag;}
285 
286  // -------------------------------------------------------------------
287  // Public functions dedicated to the projection script
288  public:
294  int PROJ_InitFile();
301 
302  // -------------------------------------------------------------------
303  // Private member functions
304  private:
310  int SetSpecificParametersFrom(vDataFile* ap_DataFile);
324  int WriteListEvent(iEventListPET* ap_Event, int a_th=0);
332  int WriteHistoEvent(iEventHistoPET* ap_Event, int a_th);
348 
349  // -------------------------------------------------------------------
350  // Data members
351  private:
354  string m_isotope;
371 };
372 
373 #endif
int WriteEvent(vEvent *ap_Event, int a_th)
Write event according to the chosen type of data.
bool m_randCorrectionFlag
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.
bool GetTOFInfoFlag()
FLTNB GetTOFMeasurementRangeInPs()
FLTNB m_TOFMeasurementRangeInPs
void SetAtnCorrectionFlagOn()
set to true the flag indicating the presence of attenuation correction factors in the datafile ...
int PROJ_GetScannerSpecificParameters()
Get PET specific parameters for projections from the scanner object, through the scannerManager.
#define FLTNB
Definition: gVariables.hh:81
bool m_ignoreNormCorrectionFlag
bool m_ignoreTOFFlag
void DescribeSpecific()
Implementation of the pure virtual eponym function that simply prints info about the datafile...
FLTNB m_maxAxialDiffmm
void SetScatterCorrectionFlagOn()
set to true the flag indicating the presence of scatter correction factors in the datafile ...
int CheckSpecificConsistencyWithAnotherDataFile(vDataFile *ap_DataFile)
Check consistency between &#39;this&#39; and the provided datafile, for specific characteristics.
iDataFilePET()
iDataFilePET constructor. Initialize the member variables to their default values.
Definition: iDataFilePET.cc:38
int ReadSpecificInfoInHeader(bool a_affectQuantificationFlag)
Read through the header file and gather specific PET information.
Definition: iDataFilePET.cc:76
void SetEventKindFlagOn()
set to true the flag indicating the presence of the kind of a list-mode event in the datafile TODO ch...
int CheckSpecificParameters()
Check parameters specific to PET data.
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...
bool m_ignoreScatCorrectionFlag
int ComputeSizeEvent()
Computation of the size of each event according to the mandatory/optional correction fields...
bool m_eventKindFlag
string GetIsotope()
FLTNB m_TOFBinSizeInPs
void SetIsotope(string a_value)
initialize the isotope string value
Inherit from iEventPET. Class for PET list-mode events.
Inherit from iEventPET. Class for PET histogram mode events.
~iDataFilePET()
iDataFilePET destructor.
Definition: iDataFilePET.cc:69
Declaration of class vDataFile.
bool m_ignoreAttnCorrectionFlag
FLTNB GetTOFQuantizationBinSizeInPs()
bool GetScatCorrectionFlag()
Simply return m_scatCorrectionFlag.
int SetSpecificParametersFrom(vDataFile *ap_DataFile)
Initialize all parameters specific to PET from the provided datafile.
void SetRandomCorrectionFlagOn()
set to true the flag indicating the presence of random correction factors in the datafile ...
uint16_t GetMaxNumberOfLinesPerEvent()
bool GetEventKindFlag()
Simply return m_eventKindFlag.
int WriteHistoEvent(iEventHistoPET *ap_Event, int a_th)
Write a PET histogram event.
int WriteHeader()
Generate a header file according to the data output information.
int PROJ_InitFile()
Initialize the fstream objets for output writing as well as some other variables specific to the Proj...
FLTNB m_TOFResolutionInPs
FLTNB m_TOFQuantizationBinSizeInPs
void SetIgnoreTOFFlag(bool a_ignoreTOFFlag)
Set a boolean that that if we ignore TOF information or not.
FLTNB GetTOFBinSizeInPs()
FLTNB GetTOFResolutionInPs()
int PrepareDataFile()
Store different kind of information inside arrays (data relative to specific correction as well as ba...
void SetTOFResolutionInPs(FLTNB a_TOFResolutionInPs)
FLTNB GetMaxAxialDiffmm()
bool GetIgnoreTOFFlag()
Mother class for the Event objects.
Definition: vEvent.hh:42
string m_isotope
bool GetRandCorrectionFlag()
Simply return m_randCorrectionFlag.
void SetNormCorrectionFlagOn()
set to true the flag indicating the presence of normalization correction factors in the datafile ...
int GetNbTOFBins()
int CheckFileSizeConsistency()
This function is implemented in child classes Check if file size is consistent. ...
void SetTOFInfoFlag()
Enable ToF flag in the datafile.
bool m_atnCorrectionFlag
bool m_normCorrectionFlag
uint16_t m_maxNumberOfLinesPerEvent
bool GetAtnCorrectionFlag()
Simply return m_atnCorrectionFlag.
Inherit from vDataFile. Class that manages the reading of a PET input file (header + data)...
Definition: iDataFilePET.hh:43
bool m_scatCorrectionFlag
void SetMaxNumberOfLinesPerEvent(uint16_t a_value)
set the max number of line per event in the datafile
void SetTOFMeasurementRangeInPs(FLTNB a_TOFMeasurementRangeInPs)
bool m_ignoreRandCorrectionFlag
int WriteListEvent(iEventListPET *ap_Event, int a_th=0)
Write a PET list-mode event.