CASToR  1.1
Tomographic Reconstruction (PET/SPECT)
 All Classes Files Functions Variables Typedefs Macros Groups Pages
oImageSpace.hh
Go to the documentation of this file.
1 
9 #ifndef OIMAGESPACE_HH
10 #define OIMAGESPACE_HH 1
11 
12 #include "gVariables.hh"
14 #include "oDeformationManager.hh"
15 #include "oInterfileIO.hh"
16 
17 class vOptimizer;
18 
19 
20 
42 {
43  // Constructor & Destructor
44  public:
49  oImageSpace();
53  ~oImageSpace();
54 
55 
56  // -------------------------------------------------------------------
57  // Public member functions
58  public:
59 
60  // Let these pointers public to simplify getting them in other classes
151  // -------------------------------------------------------------------
156  void InstantiateImage();
161  void DeallocateImage();
173  void DeallocateForwardImage();
180  void InstantiateBackwardImageFromDynamicBasis(int a_nbBackwardImages);
208  void InstantiateSensitivityImage(const string& a_pathToSensitivityImage);
222  int InitAnatomicalImage(const string& a_pathToAnatomicalImage);
235  int InitMaskImage(const string& a_pathToImage);
240  void DeallocateMaskImage();
241 
242 
250  void InstantiateOutputImage();
280  void DeallocateOutputImage();
295  int InitImage(const string& a_pathToInitialImage, FLTNB a_value);
300  void InitBackwardImage();
311  int InitSensitivityImage(const string& a_pathToSensitivityImage);
330  int LoadInitialImage(const string& a_pathToImage);
336  void ComputeOutputImage();
342  int ApplyOutputFOVMasking();
348  int ApplyOutputFlip();
356  int SaveOutputImage(int a_iteration, int a_subset = -1);
362  void SaveDebugImage(const string& a_name);
369  int SaveSensitivityImage(const string& a_pathToSensitivityImage);
374  void PrepareForwardImage();
379  void Reduce();
386 
387 
388  // -------------------------------------------------------------------
389  // Functions for List-Mode Sensitivity Generation process
390 
396  void LMS_InstantiateImage();
414  void LMS_DeallocateImage();
441  int InitAttenuationImage(const string& a_pathToAtnImage);
449  int LoadAttenuationImage(const string& a_pathToImage);
455  void LMS_CopyAtnToImage();
482  void ReduceBackwardImage(int a_imageIndex, int a_timeIndex, int a_respIndex, int a_cardIndex);
491  int LMS_SaveSensitivityImage(const string& a_pathToSensitivityImage, oDeformationManager* ap_DeformationManager);
492 
493 
494  // -------------------------------------------------------------------
495  // Functions for ANALYTICAL PROJECTION process
496 
505  void PROJ_InstantiateProjectionImage(int a_nbProjs, int a_nbPixels);
513  void PROJ_DeallocateProjectionImage(int a_nbProjs);
520  int PROJ_InitImage(const string& a_pathToInitialImage);
527  int PROJ_LoadInitialImage(const string& a_pathToImage);
536 
537 
538  // -------------------------------------------------------------------
539  // Public Get and Set functions
540  public:
546  inline void SetVerbose(int a_verboseLevel)
547  {m_verbose = a_verboseLevel;}
553  inline void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification)
554  {mp_ID = ap_ImageDimensionsAndQuantification;}
559  inline int GetNbBackwardImages()
560  {return m_nbBackwardImages;}
565  inline bool IsLoadedSensitivity()
566  {return m_loadedSensitivity;}
571  inline bool IsLoadedAnatomical()
572  {return m_loadedAnatomical;}
577  inline bool IsLoadedMask()
578  {return m_loadedMask;}
584  inline bool Checked()
585  {return mp_ID!=NULL && m_verbose!=-1;}
586 
587 
588  // -------------------------------------------------------------------
589  // Data members
590  private:
592  int m_verbose;
597 };
598 
599 #endif
FLTNB **** m4p_forwardImage
Definition: oImageSpace.hh:68
void LMS_InstantiateImage()
Allocate memory for the main image matrices (for list-mode sensitivity generation) ...
This header file is mainly used to declare some macro definitions and all includes needed from the st...
void DeallocateBwdImageForDeformation()
Free memory for the buffer backward image required for image-based deformation.
Definition: oImageSpace.cc:794
FLTNB ** m2p_projectionImage
Definition: oImageSpace.hh:144
Declaration of class oImageDimensionsAndQuantification.
void DeallocateBackwardImageFromDynamicBasis()
Free memory for the backward image matrices.
Definition: oImageSpace.cc:247
int m_nbBackwardImages
Definition: oImageSpace.hh:596
#define FLTNB
Definition: gVariables.hh:55
int InitMaskImage(const string &a_pathToImage)
Memory allocation and initialization for the mask image.
Definition: oImageSpace.cc:593
int PROJ_InitImage(const string &a_pathToInitialImage)
Load the initial image for the analytical projection.
void DeallocateImage()
Free memory for the main image matrices.
Definition: oImageSpace.cc:100
void InitSensImageForDeformation()
Initialize the buffer sensitivity image dedicated to image-based deformation, if required (histogram ...
int LMS_SaveSensitivityImage(const string &a_pathToSensitivityImage, oDeformationManager *ap_DeformationManager)
Call the interfile function to write the sensitivity image on disk.
void LMS_PrepareForwardImage()
Copy current image in forward-image buffer (for list-mode sensitivity generation) ...
void Reduce()
Merge parallel results into the matrix of the backward image matrix of the first thread. Also for MPI.
Declaration of class oDeformationManager.
bool IsLoadedSensitivity()
Definition: oImageSpace.hh:565
int ApplyOutputFOVMasking()
Mask the outside of the transaxial FOV based on the m_fovOutPercent.
~oImageSpace()
oImageSpace destructor.
Definition: oImageSpace.cc:57
void DeallocateSensitivityImage()
Free memory for the sensitivity image matrices.
Definition: oImageSpace.cc:444
void InstantiateImage()
Allocate memory for the main image matrices.
Definition: oImageSpace.cc:64
int PROJ_SaveProjectionImage()
Save an image of the projected data (for analytic projection)
void InstantiateBackwardImageFromDynamicBasis(int a_nbBackwardImages)
Allocate memory for the backward image matrices and set the number of backward images for the whole c...
Definition: oImageSpace.cc:202
FLTNB **** m4p_anatomicalImage
Definition: oImageSpace.hh:93
bool m_loadedSensitivity
Definition: oImageSpace.hh:593
void LMS_InstantiateForwardImage()
Allocate memory for the forward image matrices (for list-mode sensitivity generation) ...
void InstantiateSensitivityImage(const string &a_pathToSensitivityImage)
Allocate the sensitivity image matrices.
Definition: oImageSpace.cc:369
oImageDimensionsAndQuantification * mp_ID
Definition: oImageSpace.hh:591
void LMS_CopyAtnToImage()
Copy the attenuation image contained in the 'm2p_attenuation' matrix inside the m2p_image matrix...
int InitAttenuationImage(const string &a_pathToAtnImage)
Memory allocation and initialisation for the attenuation image using either :
Definition: oImageSpace.cc:966
int InitImage(const string &a_pathToInitialImage, FLTNB a_value)
Initialize the main image, either using:
void DeallocateVisitedVoxelsImage()
Free memory for the image matrix containing binary information regarding which 3D voxels have been vi...
Definition: oImageSpace.cc:909
void SaveDebugImage(const string &a_name)
Just a debug function dedicated to write any kind of image on disk in raw format, for debugging purpo...
void DeallocateAnatomicalImage()
Free memory for the anatomical image.
Definition: oImageSpace.cc:563
bool IsLoadedMask()
Definition: oImageSpace.hh:577
void DeallocateMaskImage()
Free memory for the mask image.
Definition: oImageSpace.cc:634
int PROJ_LoadInitialImage(const string &a_pathToImage)
Load the initial image for the analytical projection.
FLTNB * mp_visitedVoxelsImage
Definition: oImageSpace.hh:104
void PROJ_DeallocateProjectionImage(int a_nbProjs)
Free memory for the projection image for analytical projection.
void PrepareForwardImage()
Copy current image matrix in the forward-image buffer matrix.
FLTNB ****** m6p_backwardImage
Definition: oImageSpace.hh:75
void InitBwdImageForDeformation()
Initialize the buffer backward image dedicated to image-based deformation.
FLTNB **** m4p_image
Definition: oImageSpace.hh:61
void InstantiateBwdImageForDeformation()
Memory allocation for the buffer backward image required for image-based deformation.
Definition: oImageSpace.cc:755
void InstantiateVisitedVoxelsImage()
Memory allocation and initialization for the image matrix containing binary information regarding whi...
Definition: oImageSpace.cc:889
void CleanNeverVisitedVoxels()
Based on the visitedVoxelsImage, clean the never visited voxels in the image. This function must be c...
bool m_loadedMask
Definition: oImageSpace.hh:595
int LoadAttenuationImage(const string &a_pathToImage)
Load the attenuation image provided by the user in the m2p_attenuation matrix.
void LMS_DeallocateSensitivityImage()
Free memory for the sensitivity image matrices (for list-mode sensitivity generation) ...
int InitAnatomicalImage(const string &a_pathToAnatomicalImage)
Memory allocation and initialization for the anatomical image matrices.
Definition: oImageSpace.cc:510
int SaveOutputImage(int a_iteration, int a_subset=-1)
Call the interfile function to write output image on disk.
void LMS_DeallocateImage()
Free memory for the main image matrices (for list-mode sensitivity generation)
void ComputeOutputImage()
int LoadInitialImage(const string &a_pathToImage)
Load the initial image provided by the user in the corresponding matrix.
FLTNB **** m4p_outputImage
Definition: oImageSpace.hh:115
int GetNbBackwardImages()
Definition: oImageSpace.hh:559
FLTNB * mp_maskImage
Definition: oImageSpace.hh:100
void InstantiateForwardImage()
Allocate memory for the forward image matrices.
Definition: oImageSpace.cc:133
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
set the pointer to the oImageDimensionsAndQuantification object
Definition: oImageSpace.hh:553
void PROJ_InstantiateProjectionImage(int a_nbProjs, int a_nbPixels)
Instanciate and initialize projection image for analytical projection.
void ReduceBackwardImage(int a_imageIndex, int a_timeIndex, int a_respIndex, int a_cardIndex)
Merge parallel results into the backward image matrix of the first thread for the specific image / ti...
This class is designed to generically described any iterative optimizer.
Definition: vOptimizer.hh:36
int ApplyOutputFlip()
Just flip the output image.
This class is designed to manage the image-based deformation part of the reconstruction.
bool m_loadedAnatomical
Definition: oImageSpace.hh:594
void InstantiateBackwardImageFromDynamicBins()
Allocate memory for the backward image matrices and initialize them.
Definition: oImageSpace.cc:290
void SetVerbose(int a_verboseLevel)
set verbosity
Definition: oImageSpace.hh:546
void LMS_DeallocateAttenuationImage()
Free memory for the Attenuation image matrices (for analytical projection or list-mode sensitivity ge...
Definition: oImageSpace.cc:928
void DeallocateOutputImage()
Free memory for the Image matrices dedicated to output writing on disk.
Definition: oImageSpace.cc:708
FLTNB ***** m5p_defTmpBackwardImage
Definition: oImageSpace.hh:124
bool IsLoadedAnatomical()
Definition: oImageSpace.hh:571
This class holds all the matrices in the image domain that can be used in the algorithm: image...
Definition: oImageSpace.hh:41
void DeallocateSensImageForDeformation()
Definition: oImageSpace.cc:859
FLTNB **** m4p_defTmpSensitivityImage
Definition: oImageSpace.hh:135
This class is designed to manage all dimensions and quantification related stuff. ...
oImageSpace()
oImageSpace constructor. Initialize the member variables to their default values. ...
Definition: oImageSpace.cc:28
This group of functions manages Interfile image file format.
FLTNB **** m4p_attenuation
Definition: oImageSpace.hh:108
void LMS_CopyAtnToForwardImage()
Copy the attenuation image contained in the 'm2p_attenuation' matrix inside the m4p_forwardImage matr...
void InstantiateSensImageForDeformation()
Memory allocation for the buffer sensitivity image required for image-based deformation (only for PET...
Definition: oImageSpace.cc:830
bool Checked()
Simply check that the image dimensions and verbosity has been set.
Definition: oImageSpace.hh:584
int SaveSensitivityImage(const string &a_pathToSensitivityImage)
Call the interfile function to write the sensitivity image on disk.
void DeallocateBackwardImageFromDynamicBins()
Free memory of the backward image matrices.
Definition: oImageSpace.cc:326
void InitBackwardImage()
Initialize each voxel of the backward images to 0, also for sensitivity if not loaded (estimated on t...
int InitSensitivityImage(const string &a_pathToSensitivityImage)
Initialization for the sensitivity image matrices.
void LMS_InstantiateSensitivityImage()
Allocate memory for the sensitivity image matrices (for list-mode sensitivity generation) ...
void DeallocateForwardImage()
Free memory for the forward image matrices.
Definition: oImageSpace.cc:169
FLTNB ***** m5p_sensitivity
Definition: oImageSpace.hh:85
void LMS_CopyBackwardToSensitivity()
void InstantiateOutputImage()
Instanciate Image matrices dedicated to output writing on disk.
Definition: oImageSpace.cc:661
void LMS_DeallocateForwardImage()
Free memory for the forward image matrices (for list-mode sensitivity generation) ...