CASToR  1.1
Tomographic Reconstruction (PET/SPECT)
 All Classes Files Functions Variables Typedefs Macros Groups Pages
oProjectionLine.hh
Go to the documentation of this file.
1 
8 #ifndef OPROJECTIONLINE_HH
9 #define OPROJECTIONLINE_HH 1
10 
11 #include "gVariables.hh"
13 
14 
31 #define IMAGE_COMPUTATION_STRATEGY 1
32 
38 #define FIXED_LIST_COMPUTATION_STRATEGY 2
39 
43 #define ADAPTATIVE_LIST_COMPUTATION_STRATEGY 3
44 
55 #define FORWARD 0
56 
57 #define BACKWARD 1
58 
60 class vProjector;
61 
62 
71 {
72  // -------------------------------------------------------------------
73  // Constructor & Destructor
74  public:
89 
90  // -------------------------------------------------------------------
91  // Public member functions
92  public:
100  int CheckParameters();
107  int Initialize();
112  void ComputeLineLength();
118  bool NotEmptyLine();
123  void Reset();
128  void ApplyOffset();
133  void ApplyBedOffset();
142  INTNB GetVoxelIndex(int a_direction, int a_TOFBin, INTNB a_voxelInLine);
151  void AddVoxelInTOFBin(int a_direction, int a_TOFBin, INTNB a_voxelIndice, FLTNB a_voxelWeight);
159  void AddVoxel(int a_direction, INTNB a_voxelIndice, FLTNB a_voxelWeight);
168  FLTNB ForwardProject(FLTNB* ap_image = NULL);
180  FLTNB ForwardProjectWithSPECTAttenuation(FLTNB* ap_attenuation, FLTNB* ap_image = NULL);
189  void BackwardProject(FLTNB* ap_image, FLTNB a_value);
201  void BackwardProjectWithSPECTAttenuation(FLTNB* ap_attenuation, FLTNB* ap_image, FLTNB a_value);
208  FLTNB ComputeLineIntegral(int a_direction);
209 
210 
211  // -------------------------------------------------------------------
212  // Get functions
213  public:
222  inline FLTNB GetVoxelWeights(int a_direction, int a_TOFBin, INTNB a_voxelInLine)
223  {return m3p_voxelWeights[a_direction][a_TOFBin][a_voxelInLine];}
231  inline INTNB GetCurrentNbVoxels (int a_direction, int a_TOFBin)
232  {return m2p_currentNbVoxels[a_direction][a_TOFBin];}
238  inline int GetNbTOFBins()
239  {return m_nbTOFBins;}
245  inline FLTNB GetLength()
246  {return m_length;}
253  {return m_computationStrategy;}
259  inline FLTNB* GetPosition1()
260  {return mp_position1;}
266  inline FLTNB* GetPosition2()
267  {return mp_position2;}
274  {return mp_bufferPosition1;}
281  {return mp_bufferPosition2;}
288  {return mp_orientation1;}
295  {return mp_orientation2;}
302  {return mp_bufferOrientation1;}
309  {return mp_bufferOrientation2;}
315  inline FLTNB* GetPOI1()
316  {return mp_POI1;}
322  inline FLTNB* GetPOI2()
323  {return mp_POI2;}
330  {return m_TOFResolution;}
337  {return m_TOFMeasurement;}
344  {return m_TOFBinSize;}
350  inline int GetIndex1()
351  {return m_index1;}
357  inline int GetIndex2()
358  {return m_index2;}
364  inline int GetThreadNumber()
365  {return m_threadNumber;}
372  {return m_bedOffset;}
373 
374 
375  // -------------------------------------------------------------------
376  // Set functions
377  public:
383  inline void SetLength(FLTNB a_length)
384  {m_length = a_length;}
390  inline void SetPOI1(FLTNB* ap_POI1)
391  {mp_POI1 = ap_POI1;}
397  inline void SetPOI2(FLTNB* ap_POI2)
398  {mp_POI2 = ap_POI2;}
404  inline void SetTOFMeasurement(FLTNB a_TOFMeasurement)
405  {m_TOFMeasurement = a_TOFMeasurement;}
411  inline void SetTOFBinSize(FLTNB a_TOFBinSize)
412  {m_TOFBinSize = a_TOFBinSize;}
418  inline void SetIndex1(int a_index1)
419  {m_index1 = a_index1;}
425  inline void SetIndex2(int a_index2)
426  {m_index2 = a_index2;}
432  inline void SetNbTOFBins(int a_nbTOFBins)
433  {m_nbTOFBins = a_nbTOFBins;}
439  inline void SetCurrentTOFBin(int a_TOFBin)
440  {m_currentTOFBin = a_TOFBin;}
446  inline void SetMatchedProjectors(bool a_UseMatchedProjectors)
447  {m_UseMatchedProjectors = a_UseMatchedProjectors;}
453  inline void SetTOFResolution(FLTNB a_TOFResolution)
454  {m_TOFResolution = a_TOFResolution;}
460  inline void SetPOIResolution(FLTNB* ap_POIResolution)
461  {mp_POIResolution = ap_POIResolution;}
467  inline void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification)
468  {mp_ImageDimensionsAndQuantification = ap_ImageDimensionsAndQuantification;}
474  inline void SetComputationStrategy(int a_computationStrategy)
475  {m_computationStrategy = a_computationStrategy;}
481  inline void SetForwardProjector(vProjector* ap_Projector)
482  {mp_ForwardProjector = ap_Projector;}
488  inline void SetBackwardProjector(vProjector* ap_Projector)
489  {mp_BackwardProjector = ap_Projector;}
495  inline void SetThreadNumber(int a_threadNumber)
496  {m_threadNumber = a_threadNumber;}
502  inline void SetMultiplicativeCorrection(FLTNB a_multiplicativeCorrection)
503  {m_multiplicativeCorrection = a_multiplicativeCorrection;}
509  inline void SetVerbose(int a_verbose)
510  {m_verbose = a_verbose;}
516  inline void SetBedOffset(FLTNB a_bedOffset)
517  {m_bedOffset = a_bedOffset;}
518 
519 
520  // -------------------------------------------------------------------
521  // Data members
522  private:
523 
524  // Verbose level
525  int m_verbose;
526  // Has been checked ?
527  bool m_checked;
528  // Has been initialized ?
531  // ---------------------------------------------------------------------------------------------------
532  // Common stuff
533  // ---------------------------------------------------------------------------------------------------
534 
535  // The thread number associated to this projection line
537  // The current multiplicative correction factor (that will be applied during forward and backward projections)
539  // Image dimensions
542  // The computation strategy for multiple lines (see comments above)
544  // The bed offset (when multiple bed positions are reconstructed simultaneously
546  // The number of TOF bins, TOF resolution and measurement
552  // The POI and its resolution along the 3 axis
556  // This is the length of the line
558  // These are the positions and orientations of the two end points (the buffer ones are used only as buffer when compression)
567  // These are the indices associated to the two end points (in case of compression, set to -1)
568  int m_index1;
569  int m_index2;
570  // The rest of the data members can be different for forward and backward operations.
571  // However only one operation can be used for simple forward or backward needs.
572  // This is managed by this boolean flag that said if we use matched projectors or not.
577  // ------------------------------------------------------------------------------------------------------
578  // For the rest below, the first pointer is used to discriminate between forward and backward projectors,
579  // while the second pointer discriminates between TOF bins
580  // ------------------------------------------------------------------------------------------------------
581 
582  // The allocated number of voxels corresponds to the maximum number of contributing
583  // voxels a line of the ProjectionLine can handle. Whereas the current number of voxels
584  // is the number of voxels that a line is currently using, when using the LIST_COMPUTATION
585  // strategy.
588  // This contains the voxels indices for each lines, when using the both LIST_COMPUTATION strategies
590  // This contains the voxels weights for both computation strategies
592 };
593 
594 #endif
This header file is mainly used to declare some macro definitions and all includes needed from the st...
void SetMultiplicativeCorrection(FLTNB a_multiplicativeCorrection)
This function is used to set the multiplicative correction to be applied during forward and backward ...
~oProjectionLine()
The destructor of oProjectionLine.
Declaration of class oImageDimensionsAndQuantification.
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)
Forward projects the provided image for the current TOF bin with an inner loop on the attenuation (fo...
void SetThreadNumber(int a_threadNumber)
This function is used to set the thread number of this particular line.
#define FLTNB
Definition: gVariables.hh:55
void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification *ap_ImageDimensionsAndQuantification)
This function is used to set the pointer to the oImageDimensionsAndQuantification in use...
void SetMatchedProjectors(bool a_UseMatchedProjectors)
This function is used to set the boolean that says if we use matched projectors.
This class is designed to generically described any on-the-fly projector.
Definition: vProjector.hh:54
FLTNB * GetBufferPosition2()
This function is used to get the pointer to the mp_bufferPosition2 (3-values tab).
FLTNB * mp_bufferOrientation1
vProjector * mp_ForwardProjector
FLTNB GetTOFMeasurement()
This function is used to get the TOF measurement.
void SetCurrentTOFBin(int a_TOFBin)
This function is used to set the current TOF bin that is used.
void SetLength(FLTNB a_length)
This function is used to set the length of the line.
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.
int GetComputationStrategy()
This function is used to get the computation strategy.
void SetIndex2(int a_index2)
This function is used to set the index m_index1 of point 2.
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.
FLTNB GetTOFResolution()
This function is used to get the TOF resolution.
INTNB GetVoxelIndex(int a_direction, int a_TOFBin, INTNB a_voxelInLine)
This function is used to get the contributing voxel index of the provided direction, TOF bin and voxel rank.
INTNB *** m3p_voxelIndices
void BackwardProject(FLTNB *ap_image, FLTNB a_value)
Simply backward projects the provided value inside the provided image, for the current TOF bin...
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.
FLTNB * GetPosition1()
This function is used to get the pointer to the mp_position1 (3-values tab).
void SetComputationStrategy(int a_computationStrategy)
This function is used to set the computation strategy in use.
FLTNB *** m3p_voxelWeights
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)
Backward project the provided value inside the provided image with an inner loop on the attenuation (...
void AddVoxel(int a_direction, INTNB a_voxelIndice, FLTNB a_voxelWeight)
This function is used to add a voxel contribution to the line, assuming TOF bin 0 (i...
void SetBedOffset(FLTNB a_bedOffset)
This function is used to set the bed offset.
void SetNbTOFBins(int a_nbTOFBins)
This function is used to set the number of TOF bins in use.
INTNB GetCurrentNbVoxels(int a_direction, int a_TOFBin)
This function is used to get the current number of contributing voxels to the line.
void SetPOI2(FLTNB *ap_POI2)
This function is used to set the POI of point 2.
void Reset()
Reset length and all the voxel indices and weights tabs.
FLTNB * GetBufferOrientation2()
This function is used to get the pointer to the mp_bufferOrientation2 (3-values tab).
void SetTOFBinSize(FLTNB a_TOFBinSize)
This function is used to set the size of a TOF bin in ps.
void SetVerbose(int a_verbose)
This function is used to set the verbose level.
bool NotEmptyLine()
This function is used to know if the line contains any voxel contribution.
FLTNB m_multiplicativeCorrection
void SetIndex1(int a_index1)
This function is used to set the index m_index1 of point 1.
void SetBackwardProjector(vProjector *ap_Projector)
This function is used to set the pointer to the backward projector.
void SetPOI1(FLTNB *ap_POI1)
This function is used to set the POI of point 1.
#define INTNB
Definition: gVariables.hh:64
This class is designed to manage and store system matrix elements associated to a vEvent...
void SetPOIResolution(FLTNB *ap_POIResolution)
This function is used to set the POI resolution along the 3 axes.
void SetForwardProjector(vProjector *ap_Projector)
This function is used to set the pointer to the forward projector.
FLTNB ForwardProject(FLTNB *ap_image=NULL)
Simply forward projects the provided image if not null, or else 1, for the current TOF bin...
FLTNB * mp_bufferPosition1
void SetTOFResolution(FLTNB a_TOFResolution)
This function is used to set the TOF resolution in use.
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 GetVoxelWeights(int a_direction, int a_TOFBin, INTNB a_voxelInLine)
This function is used to get the contributing voxel weight of the provided direction, TOF bin and voxel rank.
FLTNB * mp_bufferOrientation2
FLTNB * GetPosition2()
This function is used to get the pointer to the mp_position2 (3-values tab).
void SetTOFMeasurement(FLTNB a_TOFMeasurement)
This function is used to set the TOF measurement associated to the line.
FLTNB GetTOFBinSize()
This function is used to get the size in ps of a TOF bin.
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
INTNB ** m2p_allocatedNbVoxels
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)
This function is used to add a voxel contribution to the line and provided TOF bin.
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.
FLTNB * mp_bufferPosition2
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.
INTNB ** m2p_currentNbVoxels
vProjector * mp_BackwardProjector
FLTNB ComputeLineIntegral(int a_direction)
It simply computes the sum of all voxels contributions following the provided direction.