CASToR  3.0
Tomographic Reconstruction (PET/SPECT/CT)
oDeformationManager.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 ODEFORMATIONMANAGER_HH
31 #define ODEFORMATIONMANAGER_HH 1
32 
33 #include "gVariables.hh"
34 #include "vDeformation.hh"
35 #include "vDataFile.hh"
36 
37 // =====================================================================
38 // ---------------------------------------------------------------------
39 // ---------------------------------------------------------------------
40 // =====================================================================
49 #define DEF_RESP_MOT 0
50 
51 #define DEF_CARD_MOT 1
52 
53 #define DEF_IPAT_MOT 2
54 
55 #define DEF_DUAL_MOT 3
56 
58 class vDataFile;
59 
60 
61 
73 {
74  // Constructor & Destructor
75  public:
81 
87 
88 
89  // -------------------------------------------------------------------
90  // Public member functions
91  public:
98  int CheckParameters();
105  int Initialize();
127  int InitImageForDeformation(oImageSpace* ap_Image);
128 
129 
130  // -------------------------------------------------------------------
131  // Public Get & Set functions
132  public:
138  inline void SetVerbose(int a_verboseLevel)
139  {m_verbose = a_verboseLevel;}
146  inline void SetDataMode(int a_dataMode)
147  {m_dataMode = a_dataMode;}
153  inline void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification)
154  {mp_ID = ap_ImageDimensionsAndQuantification;}
161  inline void SetOptions(const string& a_options)
162  {m_options = a_options;}
163 
169  inline void SetNbTransformations(int a_nbTransformations)
170  {m_nbTransformations = a_nbTransformations;}
171 
177  void SetMotionType(int a_motionType);
178 
184  inline bool UseDeformationResp()
185  {return m_UseDeformationResp;}
191  inline bool UseDeformationCard()
192  {return m_UseDeformationCard;}
198  inline bool UseDeformationInv()
199  {return m_UseDeformationIPat;}
206  inline int GetNbSensImagesRespDeformation(int a_value)
207  {if (UseDeformationResp()
208  || UseDeformationInv() ) return 0;
209  else return a_value;}
216  inline int GetNbSensImagesCardDeformation(int a_value)
217  {if (UseDeformationCard()) return 0; else return a_value;}
218 
219  #ifdef CASTOR_OMP
220 
225  inline void SetDeformationRequirement(INTNB a_th)
226  {mp_deformationRequirement[a_th] = true;}
233  inline bool GetDeformationRequirement(INTNB a_th)
234  {return mp_deformationRequirement[a_th];}
240  bool AllThreadsRequireDeformation();
245  void UnsetDeformationRequirements();
246  #endif
247 
248  // -------------------------------------------------------------------
249  // Deformation functions
265  //int ApplyDeformationForSensitivityGeneration(oImageSpace* ap_Image, int a_defDirection, int fr, int rg, int cg);
266  int ApplyDeformationForSensitivityGeneration(oImageSpace* ap_Image, int a_defDirection, int idx, int fr, int rg, int cg);
285  int PerformDeformation(oImageSpace* ap_Image);
295  int TestDeformationOnImage(FLTNB* ap_inputImage, FLTNB* ap_outputImage, int a_direction, int a_defIdx);
296 
297  // -------------------------------------------------------------------
298  // Private member functions
299  private:
313 
314 
315  // -------------------------------------------------------------------
316  // Data members
317  private:
318  // Image dimensions
320  // Options for each deformation type
321  string m_options;
323  // Deformation objects and associated bool
329  // Variable indicating the current gate/index of the motion
332  // Number of gates for cyclic motion
335  // Verbose level
336  int m_verbose;
337  // Data mode
339  // Has been checked ?
340  bool m_checked;
341  // Has been initialized ?
343  #ifdef CASTOR_OMP
344  bool* mp_deformationRequirement;
346  #endif
347 };
348 
349 #endif
int GetNbSensImagesCardDeformation(int a_value)
return the required number of cardiac images in the sensitivity image depending on the cardiac deform...
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...
int GetNbSensImagesRespDeformation(int a_value)
return the required number of respiratory images in the sensitivity image depending on the respirator...
int PerformDeformation(oImageSpace *ap_Image)
Apply deformations during reconstruction.
oImageDimensionsAndQuantification * mp_ID
int ParseOptionsAndInitializeDeformations()
Parse respiratory/cardiac/involuntary patient motion options contained in the previously provided str...
#define FLTNB
Definition: gVariables.hh:81
bool UseDeformationInv()
Indicate if the involuntary patient motion deformation is enabled.
int ApplyDeformationForSensitivityGeneration(oImageSpace *ap_Image, int a_defDirection, int idx, int fr, int rg, int cg)
Apply deformations during the list-mode sensitivity image generation.
void SetMotionType(int a_motionType)
Set the nature of motion correction (Deformation type macro)
void SetDataMode(int a_dataMode)
Set the mode of reconstruction.
int ApplyDeformationsToBackwardImage(oImageSpace *ap_Image)
Apply final backward deformations on the backward image.
bool UseDeformationCard()
Indicate if the cardiac motion deformation is enabled.
int InitImageForDeformation(oImageSpace *ap_Image)
If deformation is enabled, ask the Image Space to initialize the temporary backward image for deforma...
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
Set the image dimensions in use.
Declaration of class vDataFile.
This is the mother class of image-based transformation class.
Definition: vDeformation.hh:64
void InstantiateImageForDeformation(oImageSpace *ap_Image)
If deformation is enabled, ask the Image Space to Instantiate the temporary backward image for deform...
Declaration of class vDeformation.
int CheckParameters()
This function is used to check parameters after the latter have been all set using Set functions...
#define INTNB
Definition: gVariables.hh:92
void SetVerbose(int a_verboseLevel)
Set the verbose level.
This class is designed to manage the image-based deformation part of the reconstruction.
~oDeformationManager()
Destructor of oDeformationManager. Free memory from all allocated tabs.
bool UseDeformationResp()
Indicate if the respiratory motion deformation is enabled.
int Initialize()
Set the flags for the different motion types and instanciate/initialize deformation objects through t...
This class holds all the matrices in the image domain that can be used in the algorithm: image...
Definition: oImageSpace.hh:60
int TestDeformationOnImage(FLTNB *ap_inputImage, FLTNB *ap_outputImage, int a_direction, int a_defIdx)
Apply deformation specified by arguments on provided input image, for testing purposes.
This class is designed to manage all dimensions and quantification related stuff. ...
oDeformationManager()
Constructor of oDeformationManager. Simply set all data members to default values.
vDeformation * mp_Deformation
void SetNbTransformations(int a_nbTransformations)
Set the total number of transformations/deformations.
void DeallocateImageForDeformation(oImageSpace *ap_Image)
If deformation is enabled, ask the Image Space to free memory of the temporary backward image for def...
void SetOptions(const string &a_options)
Set the motion options contained in the provided string, and the related number of gates...