diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2015-10-08 11:24:49 +0200 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2015-10-09 12:10:31 +0200 |
commit | 003663649a191fc5bc011d6e5424496576b5e793 (patch) | |
tree | c7ae9cc0b3982ca461038f8c678dae834584b605 /include/astra | |
parent | 43a38c117405f99e3a1b498f899de4ba6d01a044 (diff) | |
download | astra-003663649a191fc5bc011d6e5424496576b5e793.tar.gz astra-003663649a191fc5bc011d6e5424496576b5e793.tar.bz2 astra-003663649a191fc5bc011d6e5424496576b5e793.tar.xz astra-003663649a191fc5bc011d6e5424496576b5e793.zip |
Improve option passing through CudaProjector2D
Not all constructors were reading options from the projector.
Also allow passing GPUIndex via CudaProjector2D.
Also refactor CudaReconstructionAlgorithm::initialize/check
to avoid code duplication with ReconstructionAlgorithm.
Diffstat (limited to 'include/astra')
-rw-r--r-- | include/astra/CudaBackProjectionAlgorithm.h | 5 | ||||
-rw-r--r-- | include/astra/CudaCglsAlgorithm.h | 9 | ||||
-rw-r--r-- | include/astra/CudaEMAlgorithm.h | 8 | ||||
-rw-r--r-- | include/astra/CudaFilteredBackProjectionAlgorithm.h | 3 | ||||
-rw-r--r-- | include/astra/CudaForwardProjectionAlgorithm.h | 27 | ||||
-rw-r--r-- | include/astra/CudaProjector2D.h | 2 | ||||
-rw-r--r-- | include/astra/CudaReconstructionAlgorithm2D.h | 22 | ||||
-rw-r--r-- | include/astra/CudaSartAlgorithm.h | 7 | ||||
-rw-r--r-- | include/astra/CudaSirtAlgorithm.h | 9 | ||||
-rw-r--r-- | include/astra/ReconstructionAlgorithm2D.h | 3 |
10 files changed, 35 insertions, 60 deletions
diff --git a/include/astra/CudaBackProjectionAlgorithm.h b/include/astra/CudaBackProjectionAlgorithm.h index 84899b0..2450376 100644 --- a/include/astra/CudaBackProjectionAlgorithm.h +++ b/include/astra/CudaBackProjectionAlgorithm.h @@ -85,13 +85,10 @@ public: * @param _pProjector Projector Object. (Ignored) * @param _pSinogram ProjectionData2D object containing the sinogram data. * @param _pReconstruction VolumeData2D object for storing the reconstructed volume. - * @param _iGPUindex GPU to use. - * @param _iPixelSuperSampling Square root of number of samples per voxel, used to compute the backprojection */ bool initialize(CProjector2D* _pProjector, CFloat32ProjectionData2D* _pSinogram, - CFloat32VolumeData2D* _pReconstruction, - int _iGPUindex = -1, int _iPixelSuperSampling = 1); + CFloat32VolumeData2D* _pReconstruction); /** Get a description of the class. * diff --git a/include/astra/CudaCglsAlgorithm.h b/include/astra/CudaCglsAlgorithm.h index c51093c..6aa0343 100644 --- a/include/astra/CudaCglsAlgorithm.h +++ b/include/astra/CudaCglsAlgorithm.h @@ -91,18 +91,13 @@ public: /** Initialize class, use sequential order. * - * @param _pProjector Projector Object. (Ignored) + * @param _pProjector Projector Object. (Optional) * @param _pSinogram ProjectionData2D object containing the sinogram * @param _pReconstruction VolumeData2D for storing the reconstruction - * @param _iGPUindex Index of GPU to use. (Starting at 0.) - * @param _iDetectorSuperSampling Supersampling factor for the FP. - * @param _iPixelSuperSampling Square root of number of samples per voxel, used to compute the backprojection */ bool initialize(CProjector2D* _pProjector, CFloat32ProjectionData2D* _pSinogram, - CFloat32VolumeData2D* _pReconstruction, - int _iGPUindex = -1, int _iDetectorSuperSampling = 1, - int _iPixelSuperSampling = 1); + CFloat32VolumeData2D* _pReconstruction); /** Get a description of the class. * diff --git a/include/astra/CudaEMAlgorithm.h b/include/astra/CudaEMAlgorithm.h index 97eb7ca..d313f7c 100644 --- a/include/astra/CudaEMAlgorithm.h +++ b/include/astra/CudaEMAlgorithm.h @@ -63,17 +63,13 @@ public: /** Initialize class. * - * @param _pProjector Projector Object. (Ignored) + * @param _pProjector Projector Object. (Optional) * @param _pSinogram ProjectionData2D object containing the sinogram data. * @param _pReconstruction VolumeData2D object for storing the reconstructed volume. - * @param _iGPUindex GPU to use. - * @param _iDetectorSuperSampling Supersampling factor for the FP. */ bool initialize(CProjector2D* _pProjector, CFloat32ProjectionData2D* _pSinogram, - CFloat32VolumeData2D* _pReconstruction, - int _iGPUindex = -1, int _iDetectorSuperSampling = 1, - int _iPixelSuperSampling = 1); + CFloat32VolumeData2D* _pReconstruction); /** Get a description of the class. * diff --git a/include/astra/CudaFilteredBackProjectionAlgorithm.h b/include/astra/CudaFilteredBackProjectionAlgorithm.h index 33445b6..cf1f19f 100644 --- a/include/astra/CudaFilteredBackProjectionAlgorithm.h +++ b/include/astra/CudaFilteredBackProjectionAlgorithm.h @@ -85,6 +85,9 @@ protected: AstraFBP* m_pFBP; bool m_bAstraFBPInit; + + void initializeFromProjector(); + virtual bool requiresProjector() const { return false; } }; // inline functions diff --git a/include/astra/CudaForwardProjectionAlgorithm.h b/include/astra/CudaForwardProjectionAlgorithm.h index d172a7a..097d499 100644 --- a/include/astra/CudaForwardProjectionAlgorithm.h +++ b/include/astra/CudaForwardProjectionAlgorithm.h @@ -33,16 +33,15 @@ $Id$ #include "Algorithm.h" -#include "ParallelProjectionGeometry2D.h" -#include "VolumeGeometry2D.h" - -#include "Float32ProjectionData2D.h" -#include "Float32VolumeData2D.h" - #ifdef ASTRA_CUDA namespace astra { +class CProjector2D; +class CProjectionGeometry2D; +class CFloat32ProjectionData2D; +class CFloat32VolumeData2D; + /** * \brief * This class contains a GPU implementation of an algorithm that creates a forward projection @@ -91,19 +90,15 @@ public: /** Initialize class. * - * @param _pVolumeGeometry Geometry of the volume. - * @param _pProjectionGeometry Geometry of the projection. + * @param _pProjector Projector2D object. (Optional) * @param _pVolume VolumeData2D object containing the phantom to compute sinogram from * @param _pSinogram ProjectionData2D object to store sinogram data in. - * @param _iGPUindex Index of GPU to use. (Starting at 0.) - * @param _iDetectorSuperSampling Number of samples per detector element, used to compute the forward projection * @return success */ - bool initialize(CProjectionGeometry2D* _pProjectionGeometry, - CVolumeGeometry2D* _pVolumeGeometry, + bool initialize(CProjector2D* _pProjector, CFloat32VolumeData2D* _pVolume, - CFloat32ProjectionData2D* _pSinogram, - int _iGPUindex = -1, int _iDetectorSuperSampling = 1); + CFloat32ProjectionData2D* _pSinogram); + /** Get all information parameters * @@ -147,6 +142,9 @@ public: void setGPUIndex(int _iGPUIndex); protected: + //< Optional Projector2D object + CProjector2D* m_pProjector; + //< ProjectionData2D object containing the sinogram. CFloat32ProjectionData2D* m_pSinogram; //< VolumeData2D object containing the phantom. @@ -157,6 +155,7 @@ protected: //< Number of rays per detector element int m_iDetectorSuperSampling; + void initializeFromProjector(); }; // inline functions diff --git a/include/astra/CudaProjector2D.h b/include/astra/CudaProjector2D.h index ecfca41..2b4bacb 100644 --- a/include/astra/CudaProjector2D.h +++ b/include/astra/CudaProjector2D.h @@ -124,12 +124,14 @@ public: Cuda2DProjectionKernel getProjectionKernel() const { return m_projectionKernel; } int getVoxelSuperSampling() const { return m_iVoxelSuperSampling; } int getDetectorSuperSampling() const { return m_iDetectorSuperSampling; } + int getGPUIndex() const { return m_iGPUIndex; } protected: Cuda2DProjectionKernel m_projectionKernel; int m_iVoxelSuperSampling; int m_iDetectorSuperSampling; + int m_iGPUIndex; }; //---------------------------------------------------------------------------------------- diff --git a/include/astra/CudaReconstructionAlgorithm2D.h b/include/astra/CudaReconstructionAlgorithm2D.h index e19bb8f..dc93a1a 100644 --- a/include/astra/CudaReconstructionAlgorithm2D.h +++ b/include/astra/CudaReconstructionAlgorithm2D.h @@ -70,28 +70,13 @@ public: /** Initialize class. * - * @param _pProjector Projector Object. (Ignored) + * @param _pProjector Projector Object. (Optional) * @param _pSinogram ProjectionData2D object containing the sinogram data. * @param _pReconstruction VolumeData2D object for storing the reconstructed volume. */ - bool initialize(CProjector2D* _pProjector, - CFloat32ProjectionData2D* _pSinogram, - CFloat32VolumeData2D* _pReconstruction); - - /** Initialize class. - * - * @param _pProjector Projector Object. (Ignored) - * @param _pSinogram ProjectionData2D object containing the sinogram data. - * @param _pReconstruction VolumeData2D object for storing the reconstructed volume. - * @param _iGPUindex GPU to use. - * @param _iDetectorSuperSampling Supersampling factor for the FP. - * @param _iPixelSuperSampling Square root of number of samples per voxel, used to compute the backprojection - */ virtual bool initialize(CProjector2D* _pProjector, CFloat32ProjectionData2D* _pSinogram, - CFloat32VolumeData2D* _pReconstruction, - int _iGPUindex = -1, int _iDetectorSuperSampling = 1, - int _iPixelSuperSampling = 1); + CFloat32VolumeData2D* _pReconstruction); /** Clear this class. @@ -166,6 +151,9 @@ protected: int m_iGPUIndex; bool m_bAlgoInit; + + void initializeFromProjector(); + virtual bool requiresProjector() const { return false; } }; // inline functions diff --git a/include/astra/CudaSartAlgorithm.h b/include/astra/CudaSartAlgorithm.h index b370bd0..53d1e7b 100644 --- a/include/astra/CudaSartAlgorithm.h +++ b/include/astra/CudaSartAlgorithm.h @@ -84,16 +84,13 @@ public: /** Initialize class. * - * @param _pProjector Projector Object. (Ignored) + * @param _pProjector Projector Object. (Optional) * @param _pSinogram ProjectionData2D object containing the sinogram data. * @param _pReconstruction VolumeData2D object for storing the reconstructed volume. - * @param _iGPUindex GPU to use. - * @param _iDetectorSuperSampling Supersampling factor for the FP. */ bool initialize(CProjector2D* _pProjector, CFloat32ProjectionData2D* _pSinogram, - CFloat32VolumeData2D* _pReconstruction, - int _iGPUindex = -1, int _iDetectorSuperSampling = 1); + CFloat32VolumeData2D* _pReconstruction); /** Get a description of the class. * diff --git a/include/astra/CudaSirtAlgorithm.h b/include/astra/CudaSirtAlgorithm.h index 607889a..751d612 100644 --- a/include/astra/CudaSirtAlgorithm.h +++ b/include/astra/CudaSirtAlgorithm.h @@ -97,18 +97,13 @@ public: /** Initialize class. * - * @param _pProjector Projector Object. (Ignored) + * @param _pProjector Projector Object. (Optional) * @param _pSinogram ProjectionData2D object containing the sinogram data. * @param _pReconstruction VolumeData2D object for storing the reconstructed volume. - * @param _iGPUindex GPU to use. - * @param _iDetectorSuperSampling Supersampling factor for the FP. - * @param _iPixelSuperSampling Square root of number of samples per voxel, used to compute the backprojection */ bool initialize(CProjector2D* _pProjector, CFloat32ProjectionData2D* _pSinogram, - CFloat32VolumeData2D* _pReconstruction, - int _iGPUindex = -1, int _iDetectorSuperSampling = 1, - int _iPixelSuperSampling = 1); + CFloat32VolumeData2D* _pReconstruction); /** Get a description of the class. * diff --git a/include/astra/ReconstructionAlgorithm2D.h b/include/astra/ReconstructionAlgorithm2D.h index 60584e0..ac87c4f 100644 --- a/include/astra/ReconstructionAlgorithm2D.h +++ b/include/astra/ReconstructionAlgorithm2D.h @@ -208,6 +208,9 @@ protected: //< Use the fixed reconstruction mask? bool m_bUseSinogramMask; + + //< Specify if initialize/check should check for a valid Projector + virtual bool requiresProjector() const { return true; } }; // inline functions |