CASToR  2.0
Tomographic Reconstruction (PET/SPECT/CT)
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
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-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 ODEFORMATIONMANAGER_HH
32 #define ODEFORMATIONMANAGER_HH 1
33 
34 #include "gVariables.hh"
35 #include "vDeformation.hh"
36 #include "vDataFile.hh"
37 
38 // =====================================================================
39 // ---------------------------------------------------------------------
40 // ---------------------------------------------------------------------
41 // =====================================================================
50 #define DEF_RESP_MOT 0
51 
52 #define DEF_CARD_MOT 1
53 
54 #define DEF_IPAT_MOT 2
55 
56 #define DEF_DUAL_MOT 3
57 
59 class vDataFile;
60 
61 
62 
74 {
75  // Constructor & Destructor
76  public:
82 
88 
89 
90  // -------------------------------------------------------------------
91  // Public member functions
92  public:
99  int CheckParameters();
106  int Initialize();
127  void 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 
220  // -------------------------------------------------------------------
221  // Deformation functions
237  //int ApplyDeformationForSensitivityGeneration(oImageSpace* ap_Image, int a_defDirection, int fr, int rg, int cg);
238  int ApplyDeformationForSensitivityGeneration(oImageSpace* ap_Image, int a_defDirection, int idx, int fr, int rg, int cg);
257  int PerformDeformation(oImageSpace* ap_Image);
267  int TestDeformationOnImage(FLTNB* ap_inputImage, FLTNB* ap_outputImage, int a_direction, int a_defIdx);
268 
269  // -------------------------------------------------------------------
270  // Private member functions
271  private:
285 
286 
287  // -------------------------------------------------------------------
288  // Data members
289  private:
290  // Image dimensions
292  // Options for each deformation type
293  string m_options;
295  // Deformation objects and associated bool
301  // Variable indicating the current gate/index of the motion
303  int16_t* mp_curPatMotIdx;
305  // Number of gates for cyclic motion
308  // Verbose level
309  int m_verbose;
310  // Data mode
312  // Has been checked ?
313  bool m_checked;
314  // Has been initialized ?
316 };
317 
318 #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:103
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.
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:65
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...
void SetVerbose(int a_verboseLevel)
Set the verbose level.
void InitImageForDeformation(oImageSpace *ap_Image)
If deformation is enabled, ask the Image Space to initialize the temporary backward image for deforma...
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:61
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...