CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
code/include/projector/oProjectionLine.hh
Go to the documentation of this file.
1 
8 #ifndef OPROJECTIONLINE_HH
9 #define OPROJECTIONLINE_HH 1
10 
11 #include "gVariables.hh"
12 #include "oImageDimensionsAndQuantification.hh"
13 
30 #define IMAGE_COMPUTATION_STRATEGY 1
31 
37 #define FIXED_LIST_COMPUTATION_STRATEGY 2
38 
42 #define ADAPTATIVE_LIST_COMPUTATION_STRATEGY 3
43 
54 #define FORWARD 0
55 
56 #define BACKWARD 1
57 
59 class vProjector;
60 
61 
70 {
71  // -------------------------------------------------------------------
72  // Constructor & Destructor
73  public:
88 
89  // -------------------------------------------------------------------
90  // Public member functions
91  public:
99  int CheckParameters();
106  int Initialize();
111  void ComputeLineLength();
117  bool NotEmptyLine();
122  void Reset();
127  void ApplyOffset();
132  void ApplyBedOffset();
141  INTNB GetVoxelIndex(int a_direction, int a_TOFBin, INTNB a_voxelInLine);
150  void AddVoxelInTOFBin(int a_direction, int a_TOFBin, INTNB a_voxelIndice, FLTNB a_voxelWeight);
161  void AddVoxelAllTOFBins(int a_direction, INTNB a_voxelIndex, FLTNB a_voxelWeight, HPFLTNB* a_tofWeights, INTNB a_tofBinFirst, INTNB a_tofBinLast);
169  void AddVoxel(int a_direction, INTNB a_voxelIndice, FLTNB a_voxelWeight);
178  FLTNB ForwardProject(FLTNB* ap_image = NULL);
190  FLTNB ForwardProjectWithSPECTAttenuation(FLTNB* ap_attenuation, FLTNB* ap_image = NULL);
199  void BackwardProject(FLTNB* ap_image, FLTNB a_value);
211  void BackwardProjectWithSPECTAttenuation(FLTNB* ap_attenuation, FLTNB* ap_image, FLTNB a_value);
218  FLTNB ComputeLineIntegral(int a_direction);
219 
220 
221  // -------------------------------------------------------------------
222  // Get functions
223  public:
232  inline FLTNB GetVoxelWeights(int a_direction, int a_TOFBin, INTNB a_voxelInLine)
233  {return m3p_voxelWeights[a_direction][a_TOFBin][a_voxelInLine];}
241  inline INTNB GetCurrentNbVoxels (int a_direction, int a_TOFBin)
242  {return m2p_currentNbVoxels[a_direction][a_TOFBin];}
248  inline int GetNbTOFBins()
249  {return m_nbTOFBins;}
255  inline FLTNB GetLength()
256  {return m_length;}
263  {return m_computationStrategy;}
269  inline FLTNB* GetPosition1()
270  {return mp_position1;}
276  inline FLTNB* GetPosition2()
277  {return mp_position2;}
284  {return mp_bufferPosition1;}
291  {return mp_bufferPosition2;}
298  {return mp_orientation1;}
305  {return mp_orientation2;}
312  {return mp_bufferOrientation1;}
319  {return mp_bufferOrientation2;}
325  inline FLTNB* GetPOI1()
326  {return mp_POI1;}
332  inline FLTNB* GetPOI2()
333  {return mp_POI2;}
340  {return m_TOFMeasurementInPs;}
341 
347  inline int GetIndex1()
348  {return m_index1;}
354  inline int GetIndex2()
355  {return m_index2;}
361  inline int GetThreadNumber()
362  {return m_threadNumber;}
369  {return m_bedOffset;}
370 
371 
372  // -------------------------------------------------------------------
373  // Set functions
374  public:
380  inline void SetLength(FLTNB a_length)
381  {m_length = a_length;}
387  inline void SetPOI1(FLTNB* ap_POI1)
388  {mp_POI1 = ap_POI1;}
394  inline void SetPOI2(FLTNB* ap_POI2)
395  {mp_POI2 = ap_POI2;}
401  inline void SetTOFMeasurementInPs(FLTNB a_TOFMeasurementInPs)
402  {m_TOFMeasurementInPs = a_TOFMeasurementInPs;}
403 
409  inline void SetIndex1(int a_index1)
410  {m_index1 = a_index1;}
416  inline void SetIndex2(int a_index2)
417  {m_index2 = a_index2;}
423  inline void SetNbTOFBins(int a_nbTOFBins)
424  {m_nbTOFBins = a_nbTOFBins;}
430  inline void SetCurrentTOFBin(int a_TOFBin)
431  {m_currentTOFBin = a_TOFBin;}
437  inline void SetMatchedProjectors(bool a_UseMatchedProjectors)
438  {m_useMatchedProjectors = a_UseMatchedProjectors;}
444  inline void SetPOIResolution(FLTNB* ap_POIResolution)
445  {mp_POIResolution = ap_POIResolution;}
451  inline void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification)
452  {mp_ImageDimensionsAndQuantification = ap_ImageDimensionsAndQuantification;}
458  inline void SetComputationStrategy(int a_computationStrategy)
459  {m_computationStrategy = a_computationStrategy;}
465  inline void SetForwardProjector(vProjector* ap_Projector)
466  {mp_ForwardProjector = ap_Projector;}
472  inline void SetBackwardProjector(vProjector* ap_Projector)
473  {mp_BackwardProjector = ap_Projector;}
479  inline void SetThreadNumber(int a_threadNumber)
480  {m_threadNumber = a_threadNumber;}
486  inline void SetMultiplicativeCorrection(FLTNB a_multiplicativeCorrection)
487  {m_multiplicativeCorrection = a_multiplicativeCorrection;}
493  inline void SetVerbose(int a_verbose)
494  {m_verbose = a_verbose;}
500  inline void SetBedOffset(FLTNB a_bedOffset)
501  {m_bedOffset = a_bedOffset;}
502 
503 
504  // -------------------------------------------------------------------
505  // Data members
506  private:
507 
508  // Verbose level
509  int m_verbose;
510  // Has been checked ?
511  bool m_checked;
512  // Has been initialized ?
515  // ---------------------------------------------------------------------------------------------------
516  // Common stuff
517  // ---------------------------------------------------------------------------------------------------
518 
519  // The thread number associated to this projection line
521  // The current multiplicative correction factor (that will be applied during forward and backward projections)
523  // Image dimensions
526  // The computation strategy for multiple lines (see comments above)
528  // The bed offset (when multiple bed positions are reconstructed simultaneously
530  // The number of TOF bins, TOF resolution and measurement
534  // The POI and its resolution along the 3 axis
538  // This is the length of the line
540  // These are the positions and orientations of the two end points (the buffer ones are used only as buffer when compression)
549  // These are the indices associated to the two end points (in case of compression, set to -1)
550  int m_index1;
551  int m_index2;
552  // The rest of the data members can be different for forward and backward operations.
553  // However only one operation can be used for simple forward or backward needs.
554  // This is managed by this boolean flag that said if we use matched projectors or not.
559  // ------------------------------------------------------------------------------------------------------
560  // For the rest below, the first pointer is used to discriminate between forward and backward projectors,
561  // while the second pointer discriminates between TOF bins
562  // ------------------------------------------------------------------------------------------------------
563 
564  // The allocated number of voxels corresponds to the maximum number of contributing
565  // voxels a line of the ProjectionLine can handle. Whereas the current number of voxels
566  // is the number of voxels that a line is currently using, when using the LIST_COMPUTATION
567  // strategy.
570  // This contains the voxels indices for each lines, when using the both LIST_COMPUTATION strategies
572  // This contains the voxels weights for both computation strategies
574 };
575 
576 #endif
~oProjectionLine()
The destructor of oProjectionLine.
FLTNB * GetOrientation1()
This function is used to get the pointer to the mp_orientation1 (3-values tab).
FLTNB * GetPOI1()
This function is used to get the pointer to POI of point 1 (3-values tab).
FLTNB ForwardProjectWithSPECTAttenuation(FLTNB *ap_attenuation, FLTNB *ap_image=NULL)
void AddVoxelAllTOFBins(int a_direction, INTNB a_voxelIndex, FLTNB a_voxelWeight, HPFLTNB *a_tofWeights, INTNB a_tofBinFirst, INTNB a_tofBinLast)
FLTNB GetTOFMeasurementInPs()
This function is used to get the TOF measurement in ps.
This class is designed to generically described any on-the-fly projector.
FLTNB * GetBufferPosition2()
This function is used to get the pointer to the mp_bufferPosition2 (3-values tab).
void SetMultiplicativeCorrection(FLTNB a_multiplicativeCorrection)
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
FLTNB * GetBufferPosition1()
This function is used to get the pointer to the mp_bufferPosition1 (3-values tab).
FLTNB GetLength()
This function is used to get the length of the line.
FLTNB * GetOrientation2()
This function is used to get the pointer to the mp_orientation2 (3-values tab).
int GetThreadNumber()
This function is used to get the thread number associated to this line.
void SetMatchedProjectors(bool a_UseMatchedProjectors)
int GetComputationStrategy()
This function is used to get the computation strategy.
FLTNB GetBedOffset()
This function is used to get the axial bed offset associated to this line.
oProjectionLine()
The constructor of oProjectionLine.
void ComputeLineLength()
Simply compute and update the m_length using the associated mp_position1 and mp_position2.
INTNB GetVoxelIndex(int a_direction, int a_TOFBin, INTNB a_voxelInLine)
void BackwardProject(FLTNB *ap_image, FLTNB a_value)
int GetIndex2()
This function is used to get the index associated to point 2.
void ApplyOffset()
Apply the offset of oImageDimensionsAndQuantification to the mp_position1 and mp_position2.
void SetPOIResolution(FLTNB *ap_POIResolution)
FLTNB * GetPosition1()
This function is used to get the pointer to the mp_position1 (3-values tab).
FLTNB * GetBufferOrientation1()
This function is used to get the pointer to the mp_bufferOrientation1 (3-values tab).
void BackwardProjectWithSPECTAttenuation(FLTNB *ap_attenuation, FLTNB *ap_image, FLTNB a_value)
INTNB GetCurrentNbVoxels(int a_direction, int a_TOFBin)
void AddVoxel(int a_direction, INTNB a_voxelIndice, FLTNB a_voxelWeight)
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
void Reset()
Reset length and all the voxel indices and weights tabs.
void SetThreadNumber(int a_threadNumber)
void SetTOFMeasurementInPs(FLTNB a_TOFMeasurementInPs)
FLTNB * GetBufferOrientation2()
This function is used to get the pointer to the mp_bufferOrientation2 (3-values tab).
bool NotEmptyLine()
This function is used to know if the line contains any voxel contribution.
This class is designed to manage and store system matrix elements associated to a vEvent...
FLTNB GetVoxelWeights(int a_direction, int a_TOFBin, INTNB a_voxelInLine)
void SetForwardProjector(vProjector *ap_Projector)
FLTNB ForwardProject(FLTNB *ap_image=NULL)
void SetBackwardProjector(vProjector *ap_Projector)
int GetNbTOFBins()
This function is used to get the number of TOF bins in use.
This class is designed to manage all dimensions and quantification related stuff. ...
FLTNB * GetPosition2()
This function is used to get the pointer to the mp_position2 (3-values tab).
void SetComputationStrategy(int a_computationStrategy)
FLTNB * GetPOI2()
This function is used to get the pointer to POI of point 2 (3-values tab).
void AddVoxelInTOFBin(int a_direction, int a_TOFBin, INTNB a_voxelIndice, FLTNB a_voxelWeight)
int CheckParameters()
A function used to check the parameters settings.
int Initialize()
A function used to initialize a bunch of stuff after parameters have been checked.
int GetIndex1()
This function is used to get the index associated to point 1.
void ApplyBedOffset()
Apply the bed offset of m_bedOffset to the mp_position1 and mp_position2.
FLTNB ComputeLineIntegral(int a_direction)