CASToR  2.0
Tomographic Reconstruction (PET/SPECT/CT)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
oDynamicDataManager.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 ODYNAMICDATAMANAGER_HH
32 #define ODYNAMICDATAMANAGER_HH 1
33 
34 #define DYNAMIC_SWITCH_NOTHING 0
35 #define DYNAMIC_SWITCH_CONTINUE 1
36 #define DYNAMIC_SWITCH_DEFORMATION 2
37 
38 #include "gVariables.hh"
39 #include "gOptions.hh"
40 #include "sOutputManager.hh"
41 
43 class vDataFile;
44 
53 {
54  // -------------------------------------------------------------------
55  // Constructor & Destructor
56  public:
66 
67  // -------------------------------------------------------------------
68  // Public member functions
69  public:
83  int InitDynamicData( int a_nbRespGates, int a_nbCardGates, const string& a_pathTo4DDataSplittingFile,
84  int a_rmMCorrFlag, int a_cMmCorrFlag, int a_dmCorrFlag, int a_pMotionCorrFlag );
92  int SetDynamicSpecificQuantificationFactors(FLTNB** a2p_quantificationFactors);
99  int CheckParameters(int64_t a_nbEvents);
118  int DynamicSwitch(int64_t a_index, uint32_t a_time, int a_bed, int a_th);
119 
120  // -------------------------------------------------------------------
121  // Public Get & Set functions
122  public:
128  inline void SetVerbose(int a_verboseLevel)
129  {m_verbose = a_verboseLevel;};
135  inline void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification)
136  {mp_ID = ap_ImageDimensionsAndQuantification;};
141  inline void SetRespMotionFlagOn()
142  {m_rMotionCorrFlag = true;}
147  inline void SetCardMotionFlagOn()
148  {m_cMotionCorrFlag = true;}
153  inline void SetPMotionFlagOn()
154  {m_pMotionCorrFlag = true;}
159  inline bool IsRespMotionEnabled()
160  {return m_rMotionCorrFlag;}
165  inline bool IsCardMotionEnabled()
166  {return m_cMotionCorrFlag;}
171  inline bool IsPMotionEnabled()
172  {return m_pMotionCorrFlag;}
179  inline int GetCurrentPMotionIndex(int a_th)
180  {return mp_currentPMotionIndex[a_th] ;}
187  inline int GetCurrentTimeFrame(int a_th)
188  {return mp_currentFrameIndex[a_th];}
195  inline int GetCurrentRespGate(int a_th)
196  {return mp_currentRespGateIndex[a_th];}
204  inline int GetCurrentRespImage(int a_th)
205  {return m_rMotionCorrFlag ? 0 : mp_currentRespGateIndex[a_th];}
212  inline int GetCurrentCardGate(int a_th)
213  {return mp_currentCardGateIndex[a_th];}
221  inline int GetCurrentCardImage(int a_th)
222  {return m_cMotionCorrFlag ? 0 : mp_currentCardGateIndex[a_th];}
229  {return m_nbCardGates;}
237  inline int GetPMotionFirstIndexForLMS(int a_fr)
238  //{return m_pMotionCorrFlag ? GetNbIPatMotionSubsets() : m_nbRespGates ;}
239  {return m_pMotionCorrFlag ? mp_framePMotionFirstIndex[a_fr] : 0 ;}
246  inline int GetNb1stMotImgsForLMS(int a_fr)
247  //{return m_pMotionCorrFlag ? GetNbIPatMotionSubsets() : m_nbRespGates ;}
255  {return m_nbPMotionTriggers+1;}
256 
257  // -------------------------------------------------------------------
258  // Private member functions
259  private:
267  int InitDynamicDataGating(const string& a_pathToGateFile);
275  int InitDynamicDataPatientMotion(const string& a_pathToFile);
276 
277  // -------------------------------------------------------------------
278  // Data members
279  private:
281  int m_verbose;
283  // Framing
287  // Respiratory gating
295  // Cardiac gating
303  // Involuntary motion
310 };
311 #endif
int InitDynamicDataGating(const string &a_pathToGateFile)
Initialisation of arrays containing informations about the data splitting and respiratory/cardiac gat...
int GetCurrentRespGate(int a_th)
Return the index indicating the current respiratory gate for this thread.
int CheckParameters(int64_t a_nbEvents)
Check all mandatory parameters.
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...
void SetVerbose(int a_verboseLevel)
set verbosity
void SetRespMotionFlagOn()
set the respiratory motion flag to 'true'
#define FLTNB
Definition: gVariables.hh:81
void SetCardMotionFlagOn()
set the cardiac motion flag to 'true'
int GetCurrentCardImage(int a_th)
return the number of the current cardiac gated image, to be used in the ImageSpace matrices for the r...
This class gathers the information about the dynamic splitting of the data.
void ResetCurrentDynamicIndices()
Reset to 0 the multithreaded dynamic arrays gathering the indices of current frame, gates and involuntary motion.
int GetCurrentCardGate(int a_th)
Return the index indicating the current cardiac gate for this thread.
int GetNb1stMotImgsForLMS(int a_fr)
return the number of first motion (either respiratory or involuntary patient motion) images to be use...
int GetNbIPatMotionSubsets()
return the number of involuntary patient motion transformations
uint16_t * mp_framePMotionFirstIndex
int GetCurrentRespImage(int a_th)
return the number of the current respiratory gated image, to be used in the ImageSpace matrices for t...
int DynamicSwitch(int64_t a_index, uint32_t a_time, int a_bed, int a_th)
This function is called in the reconstruction event loop. It is used to check if the current event be...
int GetNb2ndMotImgsForLMS()
return the number of secundary motion (typically cardiac) images to be used in the ImageSpace matrice...
uint16_t * mp_frameNbPMotionTriggers
~oDynamicDataManager()
oDynamicDataManager destructor.
int GetCurrentTimeFrame(int a_th)
Return the index indicating the current time frame for this thread.
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
set the pointer to the oImageDimensionsAndQuantification object
oDynamicDataManager()
oDynamicDataManager constructor. Initialize the member variables to their default values...
oImageDimensionsAndQuantification * mp_ID
int SetDynamicSpecificQuantificationFactors(FLTNB **a2p_quantificationFactors)
Compute gate-specific quantificative factors using the number of events within each gate...
int64_t ** m2p_indexLastEventCardGate
int InitDynamicDataPatientMotion(const string &a_pathToFile)
Initialisation of involuntary patient motion correction information, if any.
int GetPMotionFirstIndexForLMS(int a_fr)
Declaration of class sOutputManager.
int64_t ** m2p_indexLastEventRespGate
int GetCurrentPMotionIndex(int a_th)
return the number of the current involuntary patient motion image to be used in the ImageSpace matric...
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...
int InitDynamicData(int a_nbRespGates, int a_nbCardGates, const string &a_pathTo4DDataSplittingFile, int a_rmMCorrFlag, int a_cMmCorrFlag, int a_dmCorrFlag, int a_pMotionCorrFlag)
Main function for instanciation and initialization of the member variables and arrays. Call the specific initialization function depending of the type of dataset.
void SetPMotionFlagOn()
set the involuntary patient motion flag to 'true'