CASToR  3.2
Tomographic Reconstruction (PET/SPECT/CT)
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 
69 class oProjectionLine
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;}
347  {return m_TOFResolutionInPs;}
348 
354  inline int GetIndex1()
355  {return m_index1;}
361  inline int GetIndex2()
362  {return m_index2;}
368  inline int GetThreadNumber()
369  {return m_threadNumber;}
376  {return m_bedOffset;}
377 
378 
379  // -------------------------------------------------------------------
380  // Set functions
381  public:
387  inline void SetLength(FLTNB a_length)
388  {m_length = a_length;}
394  inline void SetPOI1(FLTNB* ap_POI1)
395  {mp_POI1 = ap_POI1;}
401  inline void SetPOI2(FLTNB* ap_POI2)
402  {mp_POI2 = ap_POI2;}
408  inline void SetTOFMeasurementInPs(FLTNB a_TOFMeasurementInPs)
409  {m_TOFMeasurementInPs = a_TOFMeasurementInPs;}
415  inline void SetTOFSigmaInPs(FLTNB a_TOFSigmaInPs)
416  { m_TOFResolutionInPs = a_TOFSigmaInPs;}
417 
423  inline void SetIndex1(int a_index1)
424  {m_index1 = a_index1;}
430  inline void SetIndex2(int a_index2)
431  {m_index2 = a_index2;}
437  inline void SetNbTOFBins(int a_nbTOFBins)
438  {m_nbTOFBins = a_nbTOFBins;}
444  inline void SetCurrentTOFBin(int a_TOFBin)
445  {m_currentTOFBin = a_TOFBin;}
451  inline void SetMatchedProjectors(bool a_UseMatchedProjectors)
452  {m_useMatchedProjectors = a_UseMatchedProjectors;}
458  inline void SetPOIResolution(FLTNB* ap_POIResolution)
459  {mp_POIResolution = ap_POIResolution;}
464  inline int GetNbCustomFLTData()
465  {return m_nbCustomFLTData;}
466 
471  inline int GetNbCustomINTData()
472  {return m_nbCustomINTData;}
473 
479  inline void SetNbCustomFLTData( int a_value )
480  {m_nbCustomFLTData = a_value;}
486  inline void SetNbCustomINTData( int a_value )
487  {m_nbCustomINTData = a_value;}
493  {return mp_customFLTData;}
494 
500  {return mp_customINTData;}
501 
507  inline EVTFLTDATA GetCustomFLTData(int a_idx)
508  {return mp_customFLTData[ a_idx ];}
509 
515  inline EVTINTDATA GetCustomINTData(int a_idx)
516  {return mp_customINTData[ a_idx ];}
517 
524  inline void SetCustomFLTData(EVTFLTDATA* ap_pointer)
525  {mp_customFLTData = ap_pointer;}
532  inline void SetCustomINTData(EVTINTDATA* ap_pointer)
533  {mp_customINTData = ap_pointer;}
534 
540  inline void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification)
541  {mp_ImageDimensionsAndQuantification = ap_ImageDimensionsAndQuantification;}
547  inline void SetComputationStrategy(int a_computationStrategy)
548  {m_computationStrategy = a_computationStrategy;}
554  inline void SetForwardProjector(vProjector* ap_Projector)
555  {mp_ForwardProjector = ap_Projector;}
561  inline void SetBackwardProjector(vProjector* ap_Projector)
562  {mp_BackwardProjector = ap_Projector;}
568  inline void SetThreadNumber(int a_threadNumber)
569  {m_threadNumber = a_threadNumber;}
575  inline void SetMultiplicativeCorrection(FLTNB a_multiplicativeCorrection)
576  {m_multiplicativeCorrection = a_multiplicativeCorrection;}
582  inline void SetVerbose(int a_verbose)
583  {m_verbose = a_verbose;}
589  inline void SetBedOffset(FLTNB a_bedOffset)
590  {m_bedOffset = a_bedOffset;}
596  inline void SetEventIndex(int a_eventIndex)
597  {m_eventIndex = a_eventIndex;}
602  inline int64_t GetEventIndex()
603  {return m_eventIndex;}
604 
605 
606  // -------------------------------------------------------------------
607  // Data members
608  private:
609 
610  // Verbose level
611  int m_verbose;
612  // Has been checked ?
613  bool m_checked;
614  // Has been initialized ?
615  bool m_initialized;
617  // ---------------------------------------------------------------------------------------------------
618  // Common stuff
619  // ---------------------------------------------------------------------------------------------------
620 
621  // The thread number associated to this projection line
622  int m_threadNumber;
623  // The current multiplicative correction factor (that will be applied during forward and backward projections)
625  // Image dimensions
628  // The computation strategy for multiple lines (see comments above)
630  // The bed offset (when multiple bed positions are reconstructed simultaneously
632  // The number of TOF bins, TOF resolution and measurement
633  int m_nbTOFBins;
636  int m_currentTOFBin;
637  // The POI and its resolution along the 3 axis
638  FLTNB* mp_POI1;
639  FLTNB* mp_POI2;
641  // Pointer to optional additionnal data present in the event, and related variable
646  // This is the length of the line
647  FLTNB m_length;
648  // These are the positions and orientations of the two end points (the buffer ones are used only as buffer when compression)
657  // These are the indices associated to the two end points (in case of compression, set to -1)
658  int m_index1;
659  int m_index2;
660  // The rest of the data members can be different for forward and backward operations.
661  // However only one operation can be used for simple forward or backward needs.
662  // This is managed by this boolean flag that said if we use matched projectors or not.
666  int64_t m_eventIndex;
668  // ------------------------------------------------------------------------------------------------------
669  // For the rest below, the first pointer is used to discriminate between forward and backward projectors,
670  // while the second pointer discriminates between TOF bins
671  // ------------------------------------------------------------------------------------------------------
672 
673  // The allocated number of voxels corresponds to the maximum number of contributing
674  // voxels a line of the ProjectionLine can handle. Whereas the current number of voxels
675  // is the number of voxels that a line is currently using, when using the LIST_COMPUTATION
676  // strategy.
679  // This contains the voxels indices for each lines, when using the both LIST_COMPUTATION strategies
681  // This contains the voxels weights for both computation strategies
683 };
684 
685 #endif
void SetEventIndex(int a_eventIndex)
Set current index associated to the event.
~oProjectionLine()
The destructor of oProjectionLine.
#define EVTINTDATA
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)
EVTFLTDATA GetCustomFLTData(int a_idx)
This class is designed to generically described any on-the-fly projector.
void SetMultiplicativeCorrection(FLTNB a_multiplicativeCorrection)
FLTNB GetTOFResolutionInPs() const
This function is used to get the TOF standard deviation in ps.
oImageDimensionsAndQuantification * mp_ImageDimensionsAndQuantification
void SetTOFSigmaInPs(FLTNB a_TOFSigmaInPs)
This function is used to set the TOF standard deviation associated with the line. ...
void SetMatchedProjectors(bool a_UseMatchedProjectors)
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)
void ApplyOffset()
Apply the offset of oImageDimensionsAndQuantification to the mp_position1 and mp_position2.
void SetPOIResolution(FLTNB *ap_POIResolution)
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 SetCustomINTData(EVTINTDATA *ap_pointer)
int64_t GetEventIndex()
Get current index associated to the event.
void Reset()
Reset length and all the voxel indices and weights tabs.
void SetThreadNumber(int a_threadNumber)
void SetTOFMeasurementInPs(FLTNB a_TOFMeasurementInPs)
bool NotEmptyLine()
This function is used to know if the line contains any voxel contribution.
#define EVTFLTDATA
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)
This class is designed to manage all dimensions and quantification related stuff. ...
void SetComputationStrategy(int a_computationStrategy)
void SetCustomFLTData(EVTFLTDATA *ap_pointer)
void SetBedOffset(FLTNB a_bedOffset)
void SetNbTOFBins(int a_nbTOFBins)
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.
void ApplyBedOffset()
Apply the bed offset of m_bedOffset to the mp_position1 and mp_position2.
EVTINTDATA GetCustomINTData(int a_idx)
FLTNB ComputeLineIntegral(int a_direction)