summaryrefslogtreecommitdiffstats
path: root/src/CudaFDKAlgorithm3D.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-10-07 18:14:39 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-10-09 11:42:43 +0200
commit43a38c117405f99e3a1b498f899de4ba6d01a044 (patch)
tree1d8fe2f08b6a07c1303ca3de7fc6d05d36aad41e /src/CudaFDKAlgorithm3D.cpp
parent0ebd8dfe60cc0d1f05d65d3840278defce0da091 (diff)
downloadastra-43a38c117405f99e3a1b498f899de4ba6d01a044.tar.gz
astra-43a38c117405f99e3a1b498f899de4ba6d01a044.tar.bz2
astra-43a38c117405f99e3a1b498f899de4ba6d01a044.tar.xz
astra-43a38c117405f99e3a1b498f899de4ba6d01a044.zip
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.
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");