summaryrefslogtreecommitdiffstats
path: root/src/CudaFDKAlgorithm3D.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <wjp@usecode.org>2015-12-01 12:18:16 +0100
committerWillem Jan Palenstijn <wjp@usecode.org>2015-12-01 12:18:16 +0100
commitdcfd15335549fa8e3e56260791cc4510331f7be6 (patch)
tree48c10731e8ed45224bbfda66a57e5b19225c9c10 /src/CudaFDKAlgorithm3D.cpp
parent44fb28ed0045253f79064a5e09c00ba20abe95d2 (diff)
parentfb44faa449990400861f1869b52f5afc8fefe01b (diff)
downloadastra-dcfd15335549fa8e3e56260791cc4510331f7be6.tar.gz
astra-dcfd15335549fa8e3e56260791cc4510331f7be6.tar.bz2
astra-dcfd15335549fa8e3e56260791cc4510331f7be6.tar.xz
astra-dcfd15335549fa8e3e56260791cc4510331f7be6.zip
Merge pull request #94 from wjp/cuda_options2
Improve option passing via CudaProjector(2D/3D)
Diffstat (limited to 'src/CudaFDKAlgorithm3D.cpp')
-rw-r--r--src/CudaFDKAlgorithm3D.cpp40
1 files changed, 29 insertions, 11 deletions
diff --git a/src/CudaFDKAlgorithm3D.cpp b/src/CudaFDKAlgorithm3D.cpp
index 667d926..625d02a 100644
--- a/src/CudaFDKAlgorithm3D.cpp
+++ b/src/CudaFDKAlgorithm3D.cpp
@@ -35,6 +35,8 @@ $Id$
#include "astra/CudaProjector3D.h"
#include "astra/ConeProjectionGeometry3D.h"
+#include "astra/Logging.h"
+
#include "../cuda/3d/astra3d.h"
using namespace std;
@@ -85,6 +87,24 @@ bool CCudaFDKAlgorithm3D::_check()
}
//---------------------------------------------------------------------------------------
+void CCudaFDKAlgorithm3D::initializeFromProjector()
+{
+ m_iVoxelSuperSampling = 1;
+ m_iGPUIndex = -1;
+
+ CCudaProjector3D* pCudaProjector = dynamic_cast<CCudaProjector3D*>(m_pProjector);
+ if (!pCudaProjector) {
+ if (m_pProjector) {
+ ASTRA_WARN("non-CUDA Projector3D passed to FDK_CUDA");
+ }
+ } else {
+ m_iVoxelSuperSampling = pCudaProjector->getVoxelSuperSampling();
+ m_iGPUIndex = pCudaProjector->getGPUIndex();
+ }
+
+}
+
+//---------------------------------------------------------------------------------------
// Initialize - Config
bool CCudaFDKAlgorithm3D::initialize(const Config& _cfg)
{
@@ -101,20 +121,18 @@ bool CCudaFDKAlgorithm3D::initialize(const Config& _cfg)
return false;
}
- CCudaProjector3D* pCudaProjector = 0;
- pCudaProjector = dynamic_cast<CCudaProjector3D*>(m_pProjector);
- if (!pCudaProjector) {
- // TODO: Report
- }
-
- m_iGPUIndex = (int)_cfg.self.getOptionNumerical("GPUindex", -1);
- CC.markOptionParsed("GPUindex");
+ initializeFromProjector();
- m_iVoxelSuperSampling = 1;
- if (pCudaProjector)
- m_iVoxelSuperSampling = pCudaProjector->getVoxelSuperSampling();
+ // Deprecated options
m_iVoxelSuperSampling = (int)_cfg.self.getOptionNumerical("VoxelSuperSampling", m_iVoxelSuperSampling);
+ m_iGPUIndex = (int)_cfg.self.getOptionNumerical("GPUindex", m_iGPUIndex);
+ m_iGPUIndex = (int)_cfg.self.getOptionNumerical("GPUIndex", m_iGPUIndex);
CC.markOptionParsed("VoxelSuperSampling");
+ CC.markOptionParsed("GPUIndex");
+ if (!_cfg.self.hasOption("GPUIndex"))
+ CC.markOptionParsed("GPUindex");
+
+
m_bShortScan = _cfg.self.getOptionBool("ShortScan", false);
CC.markOptionParsed("ShortScan");