CASToR  1.0
Tomographic Reconstruction (PET/SPECT)
oProjectionLine.hh
Go to the documentation of this file.
00001 
00008 #ifndef OPROJECTIONLINE_HH
00009 #define OPROJECTIONLINE_HH 1
00010 
00011 #include "gVariables.hh"
00012 #include "oImageDimensionsAndQuantification.hh"
00013 
00014 
00029 #define IMAGE_COMPUTATION_STRATEGY 1
00030 
00036 #define FIXED_LIST_COMPUTATION_STRATEGY 2
00037 
00041 #define ADAPTATIVE_LIST_COMPUTATION_STRATEGY 3
00042 
00051 #define FORWARD 0
00052 
00053 #define BACKWARD 1
00054 
00056 class vProjector;
00057 
00058 
00066 class oProjectionLine
00067 {
00068   // -------------------------------------------------------------------
00069   // Constructor & Destructor
00070   public:
00077     oProjectionLine();
00084     ~oProjectionLine();
00085 
00086   // -------------------------------------------------------------------
00087   // Public member functions
00088   public:
00096     int CheckParameters();
00103     int Initialize();
00108     void ComputeLineLength();
00114     bool NotEmptyLine();
00119     void Reset();
00124     void ApplyOffset();
00133     INTNB GetVoxelIndex(int a_direction, int a_TOFBin, INTNB a_voxelInLine);
00142     void AddVoxelInTOFBin(int a_direction, int a_TOFBin, INTNB a_voxelIndice, FLTNB a_voxelWeight);
00150     void AddVoxel(int a_direction, INTNB a_voxelIndice, FLTNB a_voxelWeight);
00159     FLTNB ForwardProject(FLTNB* ap_image = NULL);
00171     FLTNB ForwardProjectWithSPECTAttenuation(FLTNB* ap_attenuation, FLTNB* ap_image = NULL);
00180     void BackwardProject(FLTNB* ap_image, FLTNB a_value);
00192     void BackwardProjectWithSPECTAttenuation(FLTNB* ap_attenuation, FLTNB* ap_image, FLTNB a_value);
00199     FLTNB ComputeLineIntegral(int a_direction);
00200 
00201 
00202   // -------------------------------------------------------------------
00203   // Get functions
00204   public:
00213     inline FLTNB GetVoxelWeights(int a_direction, int a_TOFBin, INTNB a_voxelInLine)
00214            {return m3p_voxelWeights[a_direction][a_TOFBin][a_voxelInLine];}
00222     inline INTNB GetCurrentNbVoxels (int a_direction, int a_TOFBin)
00223            {return m2p_currentNbVoxels[a_direction][a_TOFBin];}
00229     inline int GetNbTOFBins()
00230            {return m_nbTOFBins;}
00236     inline FLTNB GetLength()
00237            {return m_length;}
00243     inline int GetComputationStrategy()
00244            {return m_computationStrategy;}
00250     inline FLTNB* GetPosition1()
00251            {return mp_position1;}
00257     inline FLTNB* GetPosition2()
00258            {return mp_position2;}
00264     inline FLTNB* GetBufferPosition1()
00265            {return mp_bufferPosition1;}
00271     inline FLTNB* GetBufferPosition2()
00272            {return mp_bufferPosition2;}
00278     inline FLTNB* GetOrientation1()
00279            {return mp_orientation1;}
00285     inline FLTNB* GetOrientation2()
00286            {return mp_orientation2;}
00292     inline FLTNB* GetBufferOrientation1()
00293            {return mp_bufferOrientation1;}
00299     inline FLTNB* GetBufferOrientation2()
00300            {return mp_bufferOrientation2;}
00306     inline FLTNB* GetPOI1()
00307            {return mp_POI1;}
00313     inline FLTNB* GetPOI2()
00314            {return mp_POI2;}
00320     inline int GetIndex1()
00321            {return m_index1;}
00327     inline int GetIndex2()
00328            {return m_index2;}
00334     inline int GetThreadNumber()
00335            {return m_threadNumber;}
00336 
00337 
00338   // -------------------------------------------------------------------
00339   // Set functions
00340   public:
00346     inline void SetLength(FLTNB a_length)
00347            {m_length = a_length;}
00353     inline void SetPOI1(FLTNB* ap_POI1)
00354            {mp_POI1 = ap_POI1;}
00360     inline void SetPOI2(FLTNB* ap_POI2)
00361            {mp_POI2 = ap_POI2;}
00367     inline void SetTOFMeasurement(FLTNB a_TOFMeasurement)
00368            {m_TOFMeasurement = a_TOFMeasurement;}
00374     inline void SetIndex1(int a_index1)
00375            {m_index1 = a_index1;}
00381     inline void SetIndex2(int a_index2)
00382            {m_index2 = a_index2;}
00388     inline void SetNbTOFBins(int a_nbTOFBins)
00389            {m_nbTOFBins = a_nbTOFBins;}
00395     inline void SetCurrentTOFBin(int a_TOFBin)
00396            {m_currentTOFBin = a_TOFBin;}
00402     inline void SetMatchedProjectors(bool a_UseMatchedProjectors)
00403            {m_UseMatchedProjectors = a_UseMatchedProjectors;}
00409     inline void SetTOFResolution(FLTNB a_TOFResolution)
00410            {m_TOFResolution = a_TOFResolution;}
00416     inline void SetPOIResolution(FLTNB* ap_POIResolution)
00417            {mp_POIResolution = ap_POIResolution;}
00423     inline void SetImageDimensionsAndQuantification(oImageDimensionsAndQuantification* ap_ImageDimensionsAndQuantification)
00424            {mp_ImageDimensionsAndQuantification = ap_ImageDimensionsAndQuantification;}
00430     inline void SetComputationStrategy(int a_computationStrategy)
00431            {m_computationStrategy = a_computationStrategy;}
00437     inline void SetForwardProjector(vProjector* ap_Projector)
00438            {mp_ForwardProjector = ap_Projector;}
00444     inline void SetBackwardProjector(vProjector* ap_Projector)
00445            {mp_BackwardProjector = ap_Projector;}
00451     inline void SetThreadNumber(int a_threadNumber)
00452            {m_threadNumber = a_threadNumber;}
00458     inline void SetMultiplicativeCorrection(FLTNB a_multiplicativeCorrection)
00459            {m_multiplicativeCorrection = a_multiplicativeCorrection;}
00465     inline void SetVerbose(int a_verbose)
00466            {m_verbose = a_verbose;}
00467 
00468 
00469   // -------------------------------------------------------------------
00470   // Data members
00471   private:
00472 
00473     // Verbose level
00474     int m_verbose;                         
00475     // Has been checked ?
00476     bool m_checked;                        
00477     // Has been initialized ?
00478     bool m_initialized;                    
00480     // ---------------------------------------------------------------------------------------------------
00481     // Common stuff
00482     // ---------------------------------------------------------------------------------------------------
00483 
00484     // The thread number associated to this projection line
00485     int m_threadNumber;                    
00486     // The current multiplicative correction factor (that will be applied during forward and backward projections)
00487     FLTNB m_multiplicativeCorrection;      
00488     // Image dimensions
00489     oImageDimensionsAndQuantification* 
00490       mp_ImageDimensionsAndQuantification; 
00491     // The computation strategy for multiple lines (see comments above)
00492     int m_computationStrategy;             
00493     // The number of TOF bins, TOF resolution and measurement
00494     int m_nbTOFBins;                       
00495     FLTNB m_TOFResolution;                 
00496     FLTNB m_TOFMeasurement;                
00497     int m_currentTOFBin;                   
00498     // The POI and its resolution along the 3 axis
00499     FLTNB* mp_POI1;                        
00500     FLTNB* mp_POI2;                        
00501     FLTNB* mp_POIResolution;               
00502     // This is the length of the line
00503     FLTNB m_length;                        
00504     // These are the positions and orientations of the two end points (the buffer ones are used only as buffer when compression)
00505     FLTNB* mp_position1;                   
00506     FLTNB* mp_position2;                   
00507     FLTNB* mp_bufferPosition1;             
00508     FLTNB* mp_bufferPosition2;             
00509     FLTNB* mp_orientation1;                
00510     FLTNB* mp_orientation2;                
00511     FLTNB* mp_bufferOrientation1;          
00512     FLTNB* mp_bufferOrientation2;          
00513     // These are the indices associated to the two end points (in case of compression, set to -1)
00514     int m_index1;                          
00515     int m_index2;                          
00516     // The rest of the data members can be different for forward and backward operations.
00517     // However only one operation can be used for simple forward or backward needs.
00518     // This is managed by this boolean flag that said if we use matched projectors or not.
00519     bool m_UseMatchedProjectors;           
00520     vProjector* mp_ForwardProjector;       
00521     vProjector* mp_BackwardProjector;      
00523     // ------------------------------------------------------------------------------------------------------
00524     // For the rest below, the first pointer is used to discriminate between forward and backward projectors,
00525     // while the second pointer discriminates between TOF bins
00526     // ------------------------------------------------------------------------------------------------------
00527 
00528     // The allocated number of voxels corresponds to the maximum number of contributing
00529     // voxels a line of the ProjectionLine can handle. Whereas the current number of voxels
00530     // is the number of voxels that a line is currently using, when using the LIST_COMPUTATION
00531     // strategy.
00532     INTNB** m2p_allocatedNbVoxels;         
00533     INTNB** m2p_currentNbVoxels;           
00534     // This contains the voxels indices for each lines, when using the both LIST_COMPUTATION strategies
00535     INTNB*** m3p_voxelIndices;             
00536     // This contains the voxels weights for both computation strategies
00537     FLTNB*** m3p_voxelWeights;             
00538 };
00539 
00540 #endif
 All Classes Files Functions Variables Typedefs Defines