CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
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-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 ODYNAMICDATAMANAGER_HH
31 #define ODYNAMICDATAMANAGER_HH 1
32 
33 #define DYNAMIC_SWITCH_NOTHING 0
34 #define DYNAMIC_SWITCH_CONTINUE 1
35 #define DYNAMIC_SWITCH_DEFORMATION 2
36 #define DYNAMIC_SWITCH_END_LOOP 3
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_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;}
238  inline int GetPMotionFirstIndexForFrame(int a_fr)
239  {return m_pMotionCorrFlag ? mp_framePMotionFirstIndex[a_fr] : 0 ;}
240 
248  inline int GetPMotionLastIndexForFrame(int a_fr)
249  {return m_pMotionCorrFlag ? mp_framePMotionLastIndex[a_fr] : 0 ;}
250 
257  inline int GetNb1stMotImgsForLMS(int a_fr)
259 
260 
267  inline int GetNbPMotionTriggers(int a_fr)
268  {return mp_frameNbPMotionTriggers[a_fr];}
269 
277  inline FLTNB GetListPMotionWeightInFrameForLMS(int a_fr, int a_pmsset)
278  {return m2p_listPMotionWeightInFrame[a_fr][a_pmsset] ;}
279 
280 
287  {return m_nbPMotionTriggers+1;}
288 
293  inline bool GateDurationProvided()
295  // -------------------------------------------------------------------
296  // Private member functions
297  private:
305  int InitDynamicDataGating(const string& a_pathToGateFile);
313  int InitDynamicDataPatientMotion(const string& a_pathToFile);
314 
315  // -------------------------------------------------------------------
316  // Data members
317  private:
319  int m_verbose;
321  // Framing
325  // Respiratory gating
333  // Cardiac gating
341  // Common gating
345  // Involuntary motion
354 };
355 #endif
int GetPMotionLastIndexForFrame(int a_fr)
if patient motion is enabled, return the last index of patient motion for the frame fr...
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:102
HPFLTNB ** m2p_listPMotionWeightInFrame
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 &#39;true&#39;
#define FLTNB
Definition: gVariables.hh:81
void SetCardMotionFlagOn()
set the cardiac motion flag to &#39;true&#39;
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.
#define HPFLTNB
Definition: gVariables.hh:83
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...
FLTNB GetListPMotionWeightInFrameForLMS(int a_fr, int a_pmsset)
return the weight of a patient motion subset in terms of duration, for a specific frame ...
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 InitDynamicData(int a_nbRespGates, int a_nbCardGates, const string &a_pathTo4DDataSplittingFile, int a_rmMCorrFlag, int a_cMmCorrFlag, 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.
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...
int GetPMotionFirstIndexForFrame(int a_fr)
if patient motion is enabled, return the first index of patient motion for the frame fr...
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.
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 GetNbPMotionTriggers(int a_fr)
return the number of involuntary patient motion triggers
void SetPMotionFlagOn()
set the involuntary patient motion flag to &#39;true&#39;