summaryrefslogtreecommitdiffstats
path: root/src/CudaBackProjectionAlgorithm3D.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-12-01 12:27:44 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-12-01 12:27:44 +0100
commitfff0e6dba508744f540bcf5efff76f676fe7af48 (patch)
tree5f33544e7d79b59501a5dd63a4922722eed8a98b /src/CudaBackProjectionAlgorithm3D.cpp
parent0d5947a0e8e7d6f86c7591a96d877dfe14b187e4 (diff)
parentdcfd15335549fa8e3e56260791cc4510331f7be6 (diff)
downloadastra-fff0e6dba508744f540bcf5efff76f676fe7af48.tar.gz
astra-fff0e6dba508744f540bcf5efff76f676fe7af48.tar.bz2
astra-fff0e6dba508744f540bcf5efff76f676fe7af48.tar.xz
astra-fff0e6dba508744f540bcf5efff76f676fe7af48.zip
Merge branch 'master' into python-plugins
Conflicts: python/astra/utils.pyx
Diffstat (limited to 'src/CudaBackProjectionAlgorithm3D.cpp')
-rw-r--r--src/CudaBackProjectionAlgorithm3D.cpp37
1 files changed, 34 insertions, 3 deletions
diff --git a/src/CudaBackProjectionAlgorithm3D.cpp b/src/CudaBackProjectionAlgorithm3D.cpp
index fbb8f28..c9d9447 100644
--- a/src/CudaBackProjectionAlgorithm3D.cpp
+++ b/src/CudaBackProjectionAlgorithm3D.cpp
@@ -32,11 +32,14 @@ $Id$
#include "astra/AstraObjectManager.h"
+#include "astra/CudaProjector3D.h"
#include "astra/ConeProjectionGeometry3D.h"
#include "astra/ParallelProjectionGeometry3D.h"
#include "astra/ParallelVecProjectionGeometry3D.h"
#include "astra/ConeVecProjectionGeometry3D.h"
+#include "astra/Logging.h"
+
#include "../cuda/3d/astra3d.h"
using namespace std;
@@ -86,6 +89,24 @@ bool CCudaBackProjectionAlgorithm3D::_check()
}
//---------------------------------------------------------------------------------------
+void CCudaBackProjectionAlgorithm3D::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 BP3D_CUDA");
+ }
+ } else {
+ m_iVoxelSuperSampling = pCudaProjector->getVoxelSuperSampling();
+ m_iGPUIndex = pCudaProjector->getGPUIndex();
+ }
+
+}
+
+//---------------------------------------------------------------------------------------
// Initialize - Config
bool CCudaBackProjectionAlgorithm3D::initialize(const Config& _cfg)
{
@@ -102,10 +123,18 @@ bool CCudaBackProjectionAlgorithm3D::initialize(const Config& _cfg)
return false;
}
- m_iGPUIndex = (int)_cfg.self.getOptionNumerical("GPUindex", -1);
- CC.markOptionParsed("GPUindex");
- m_iVoxelSuperSampling = (int)_cfg.self.getOptionNumerical("VoxelSuperSampling", 1);
+ initializeFromProjector();
+
+ // 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");
+
+
CFloat32ProjectionData3DMemory* pSinoMem = dynamic_cast<CFloat32ProjectionData3DMemory*>(m_pSinogram);
ASTRA_ASSERT(pSinoMem);
@@ -139,6 +168,8 @@ bool CCudaBackProjectionAlgorithm3D::initialize(CProjector3D* _pProjector,
m_pSinogram = _pSinogram;
m_pReconstruction = _pReconstruction;
+ initializeFromProjector();
+
// success
m_bIsInitialized = _check();
return m_bIsInitialized;