From 167ec3f4e1cbe4eb856474cb515291261955b053 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 22 May 2015 14:56:28 +0200 Subject: Add supersampling options to Cuda Projectors --- include/astra/CudaProjector2D.h | 6 ++++++ include/astra/CudaProjector3D.h | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'include/astra') diff --git a/include/astra/CudaProjector2D.h b/include/astra/CudaProjector2D.h index a571851..ecfca41 100644 --- a/include/astra/CudaProjector2D.h +++ b/include/astra/CudaProjector2D.h @@ -121,9 +121,15 @@ public: virtual std::string description() const; + Cuda2DProjectionKernel getProjectionKernel() const { return m_projectionKernel; } + int getVoxelSuperSampling() const { return m_iVoxelSuperSampling; } + int getDetectorSuperSampling() const { return m_iDetectorSuperSampling; } + protected: Cuda2DProjectionKernel m_projectionKernel; + int m_iVoxelSuperSampling; + int m_iDetectorSuperSampling; }; //---------------------------------------------------------------------------------------- diff --git a/include/astra/CudaProjector3D.h b/include/astra/CudaProjector3D.h index a181531..1d570fe 100644 --- a/include/astra/CudaProjector3D.h +++ b/include/astra/CudaProjector3D.h @@ -115,11 +115,14 @@ public: Cuda3DProjectionKernel getProjectionKernel() const { return m_projectionKernel; } + int getVoxelSuperSampling() const { return m_iVoxelSuperSampling; } + int getDetectorSuperSampling() const { return m_iDetectorSuperSampling; } protected: Cuda3DProjectionKernel m_projectionKernel; - + int m_iVoxelSuperSampling; + int m_iDetectorSuperSampling; }; -- cgit v1.2.3 From 43a38c117405f99e3a1b498f899de4ba6d01a044 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Wed, 7 Oct 2015 18:14:39 +0200 Subject: Improve option passing through CudaProjector3D Not all constructors were reading options from the projector. Also allow passing GPUIndex via CudaProjector3D. Thanks to Nicola Vigano for part of the patch. --- include/astra/CudaBackProjectionAlgorithm3D.h | 2 ++ include/astra/CudaCglsAlgorithm3D.h | 2 ++ include/astra/CudaFDKAlgorithm3D.h | 2 ++ include/astra/CudaForwardProjectionAlgorithm3D.h | 1 + include/astra/CudaProjector3D.h | 2 ++ include/astra/CudaSirtAlgorithm3D.h | 2 ++ 6 files changed, 11 insertions(+) (limited to 'include/astra') diff --git a/include/astra/CudaBackProjectionAlgorithm3D.h b/include/astra/CudaBackProjectionAlgorithm3D.h index 2d98218..74aeec8 100644 --- a/include/astra/CudaBackProjectionAlgorithm3D.h +++ b/include/astra/CudaBackProjectionAlgorithm3D.h @@ -147,6 +147,8 @@ protected: */ bool m_bSIRTWeighting; + + void initializeFromProjector(); }; // inline functions diff --git a/include/astra/CudaCglsAlgorithm3D.h b/include/astra/CudaCglsAlgorithm3D.h index 77c41c1..3e4084b 100644 --- a/include/astra/CudaCglsAlgorithm3D.h +++ b/include/astra/CudaCglsAlgorithm3D.h @@ -161,6 +161,8 @@ protected: bool m_bAstraCGLSInit; int m_iDetectorSuperSampling; int m_iVoxelSuperSampling; + + void initializeFromProjector(); }; // inline functions diff --git a/include/astra/CudaFDKAlgorithm3D.h b/include/astra/CudaFDKAlgorithm3D.h index 1b025f1..63f07fd 100644 --- a/include/astra/CudaFDKAlgorithm3D.h +++ b/include/astra/CudaFDKAlgorithm3D.h @@ -152,6 +152,8 @@ protected: int m_iGPUIndex; int m_iVoxelSuperSampling; bool m_bShortScan; + + void initializeFromProjector(); }; // inline functions diff --git a/include/astra/CudaForwardProjectionAlgorithm3D.h b/include/astra/CudaForwardProjectionAlgorithm3D.h index bdd1356..4198d56 100644 --- a/include/astra/CudaForwardProjectionAlgorithm3D.h +++ b/include/astra/CudaForwardProjectionAlgorithm3D.h @@ -122,6 +122,7 @@ protected: int m_iGPUIndex; int m_iDetectorSuperSampling; + void initializeFromProjector(); }; // inline functions diff --git a/include/astra/CudaProjector3D.h b/include/astra/CudaProjector3D.h index 1d570fe..da88d6d 100644 --- a/include/astra/CudaProjector3D.h +++ b/include/astra/CudaProjector3D.h @@ -117,12 +117,14 @@ public: Cuda3DProjectionKernel getProjectionKernel() const { return m_projectionKernel; } int getVoxelSuperSampling() const { return m_iVoxelSuperSampling; } int getDetectorSuperSampling() const { return m_iDetectorSuperSampling; } + int getGPUIndex() const { return m_iGPUIndex; } protected: Cuda3DProjectionKernel m_projectionKernel; int m_iVoxelSuperSampling; int m_iDetectorSuperSampling; + int m_iGPUIndex; }; diff --git a/include/astra/CudaSirtAlgorithm3D.h b/include/astra/CudaSirtAlgorithm3D.h index fda4635..379720e 100644 --- a/include/astra/CudaSirtAlgorithm3D.h +++ b/include/astra/CudaSirtAlgorithm3D.h @@ -175,6 +175,8 @@ protected: bool m_bAstraSIRTInit; int m_iDetectorSuperSampling; int m_iVoxelSuperSampling; + + void initializeFromProjector(); }; // inline functions -- cgit v1.2.3 From 003663649a191fc5bc011d6e5424496576b5e793 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Thu, 8 Oct 2015 11:24:49 +0200 Subject: 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. --- include/astra/CudaBackProjectionAlgorithm.h | 5 +--- include/astra/CudaCglsAlgorithm.h | 9 ++------ include/astra/CudaEMAlgorithm.h | 8 ++----- .../astra/CudaFilteredBackProjectionAlgorithm.h | 3 +++ include/astra/CudaForwardProjectionAlgorithm.h | 27 +++++++++++----------- include/astra/CudaProjector2D.h | 2 ++ include/astra/CudaReconstructionAlgorithm2D.h | 22 ++++-------------- include/astra/CudaSartAlgorithm.h | 7 ++---- include/astra/CudaSirtAlgorithm.h | 9 ++------ include/astra/ReconstructionAlgorithm2D.h | 3 +++ 10 files changed, 35 insertions(+), 60 deletions(-) (limited to 'include/astra') 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 -- cgit v1.2.3 From 33668f347d7fdcd700fc5e4e34153cbba7889c01 Mon Sep 17 00:00:00 2001 From: Willem Jan Palenstijn Date: Fri, 9 Oct 2015 11:46:05 +0200 Subject: Fix whitespace --- include/astra/CudaEMAlgorithm.h | 4 ++-- include/astra/CudaForwardProjectionAlgorithm.h | 4 ++-- include/astra/CudaSartAlgorithm.h | 4 ++-- include/astra/CudaSirtAlgorithm.h | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) (limited to 'include/astra') diff --git a/include/astra/CudaEMAlgorithm.h b/include/astra/CudaEMAlgorithm.h index d313f7c..a9d2711 100644 --- a/include/astra/CudaEMAlgorithm.h +++ b/include/astra/CudaEMAlgorithm.h @@ -68,8 +68,8 @@ public: * @param _pReconstruction VolumeData2D object for storing the reconstructed volume. */ bool initialize(CProjector2D* _pProjector, - CFloat32ProjectionData2D* _pSinogram, - CFloat32VolumeData2D* _pReconstruction); + CFloat32ProjectionData2D* _pSinogram, + CFloat32VolumeData2D* _pReconstruction); /** Get a description of the class. * diff --git a/include/astra/CudaForwardProjectionAlgorithm.h b/include/astra/CudaForwardProjectionAlgorithm.h index 097d499..449a610 100644 --- a/include/astra/CudaForwardProjectionAlgorithm.h +++ b/include/astra/CudaForwardProjectionAlgorithm.h @@ -96,8 +96,8 @@ public: * @return success */ bool initialize(CProjector2D* _pProjector, - CFloat32VolumeData2D* _pVolume, - CFloat32ProjectionData2D* _pSinogram); + CFloat32VolumeData2D* _pVolume, + CFloat32ProjectionData2D* _pSinogram); /** Get all information parameters diff --git a/include/astra/CudaSartAlgorithm.h b/include/astra/CudaSartAlgorithm.h index 53d1e7b..c22dc4f 100644 --- a/include/astra/CudaSartAlgorithm.h +++ b/include/astra/CudaSartAlgorithm.h @@ -89,8 +89,8 @@ public: * @param _pReconstruction VolumeData2D object for storing the reconstructed volume. */ bool initialize(CProjector2D* _pProjector, - CFloat32ProjectionData2D* _pSinogram, - CFloat32VolumeData2D* _pReconstruction); + CFloat32ProjectionData2D* _pSinogram, + CFloat32VolumeData2D* _pReconstruction); /** Get a description of the class. * diff --git a/include/astra/CudaSirtAlgorithm.h b/include/astra/CudaSirtAlgorithm.h index 751d612..929ac30 100644 --- a/include/astra/CudaSirtAlgorithm.h +++ b/include/astra/CudaSirtAlgorithm.h @@ -102,8 +102,8 @@ public: * @param _pReconstruction VolumeData2D object for storing the reconstructed volume. */ bool initialize(CProjector2D* _pProjector, - CFloat32ProjectionData2D* _pSinogram, - CFloat32VolumeData2D* _pReconstruction); + CFloat32ProjectionData2D* _pSinogram, + CFloat32VolumeData2D* _pReconstruction); /** Get a description of the class. * -- cgit v1.2.3