summaryrefslogtreecommitdiffstats
path: root/src/CudaSirtAlgorithm3D.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/CudaSirtAlgorithm3D.cpp')
-rw-r--r--src/CudaSirtAlgorithm3D.cpp86
1 files changed, 32 insertions, 54 deletions
diff --git a/src/CudaSirtAlgorithm3D.cpp b/src/CudaSirtAlgorithm3D.cpp
index abbb9fd..1fa0da2 100644
--- a/src/CudaSirtAlgorithm3D.cpp
+++ b/src/CudaSirtAlgorithm3D.cpp
@@ -38,6 +38,8 @@ $Id$
#include "astra/ConeVecProjectionGeometry3D.h"
#include "astra/CudaProjector3D.h"
+#include "astra/Logging.h"
+
#include "../cuda/3d/astra3d.h"
using namespace std;
@@ -90,7 +92,27 @@ bool CCudaSirtAlgorithm3D::_check()
return true;
}
-//---------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------
+void CCudaSirtAlgorithm3D::initializeFromProjector()
+{
+ m_iVoxelSuperSampling = 1;
+ m_iDetectorSuperSampling = 1;
+ m_iGPUIndex = -1;
+
+ CCudaProjector3D* pCudaProjector = dynamic_cast<CCudaProjector3D*>(m_pProjector);
+ if (!pCudaProjector) {
+ if (m_pProjector) {
+ ASTRA_WARN("non-CUDA Projector3D passed to SIRT3D_CUDA");
+ }
+ } else {
+ m_iVoxelSuperSampling = pCudaProjector->getVoxelSuperSampling();
+ m_iDetectorSuperSampling = pCudaProjector->getDetectorSuperSampling();
+ m_iGPUIndex = pCudaProjector->getGPUIndex();
+ }
+
+}
+
+//--------------------------------------------------------------------------------------
// Initialize - Config
bool CCudaSirtAlgorithm3D::initialize(const Config& _cfg)
{
@@ -108,28 +130,20 @@ bool CCudaSirtAlgorithm3D::initialize(const Config& _cfg)
return false;
}
- CCudaProjector3D* pCudaProjector = 0;
- pCudaProjector = dynamic_cast<CCudaProjector3D*>(m_pProjector);
- if (!pCudaProjector) {
- // TODO: Report
- }
+ initializeFromProjector();
- m_iGPUIndex = (int)_cfg.self.getOptionNumerical("GPUindex", -1);
- CC.markOptionParsed("GPUindex");
-
-
- m_iVoxelSuperSampling = 1;
- m_iDetectorSuperSampling = 1;
- if (pCudaProjector) {
- // New interface
- m_iVoxelSuperSampling = pCudaProjector->getVoxelSuperSampling();
- m_iDetectorSuperSampling = pCudaProjector->getDetectorSuperSampling();
- }
// Deprecated options
m_iVoxelSuperSampling = (int)_cfg.self.getOptionNumerical("VoxelSuperSampling", m_iVoxelSuperSampling);
m_iDetectorSuperSampling = (int)_cfg.self.getOptionNumerical("DetectorSuperSampling", m_iDetectorSuperSampling);
+ m_iGPUIndex = (int)_cfg.self.getOptionNumerical("GPUindex", m_iGPUIndex);
+ m_iGPUIndex = (int)_cfg.self.getOptionNumerical("GPUIndex", m_iGPUIndex);
CC.markOptionParsed("VoxelSuperSampling");
CC.markOptionParsed("DetectorSuperSampling");
+ CC.markOptionParsed("GPUIndex");
+ if (!_cfg.self.hasOption("GPUIndex"))
+ CC.markOptionParsed("GPUindex");
+
+
m_pSirt = new AstraSIRT3d();
@@ -189,10 +203,6 @@ void CCudaSirtAlgorithm3D::run(int _iNrIterations)
ASTRA_ASSERT(m_bIsInitialized);
const CProjectionGeometry3D* projgeom = m_pSinogram->getGeometry();
- const CConeProjectionGeometry3D* conegeom = dynamic_cast<const CConeProjectionGeometry3D*>(projgeom);
- const CParallelProjectionGeometry3D* par3dgeom = dynamic_cast<const CParallelProjectionGeometry3D*>(projgeom);
- const CParallelVecProjectionGeometry3D* parvec3dgeom = dynamic_cast<const CParallelVecProjectionGeometry3D*>(projgeom);
- const CConeVecProjectionGeometry3D* conevec3dgeom = dynamic_cast<const CConeVecProjectionGeometry3D*>(projgeom);
const CVolumeGeometry3D& volgeom = *m_pReconstruction->getGeometry();
bool ok = true;
@@ -201,39 +211,7 @@ void CCudaSirtAlgorithm3D::run(int _iNrIterations)
ok &= m_pSirt->setGPUIndex(m_iGPUIndex);
- ok &= m_pSirt->setReconstructionGeometry(volgeom.getGridColCount(),
- volgeom.getGridRowCount(),
- volgeom.getGridSliceCount());
-
- if (conegeom) {
- ok &= m_pSirt->setConeGeometry(conegeom->getProjectionCount(),
- conegeom->getDetectorColCount(),
- conegeom->getDetectorRowCount(),
- conegeom->getOriginSourceDistance(),
- conegeom->getOriginDetectorDistance(),
- conegeom->getDetectorSpacingX(),
- conegeom->getDetectorSpacingY(),
- conegeom->getProjectionAngles());
- } else if (par3dgeom) {
- ok &= m_pSirt->setPar3DGeometry(par3dgeom->getProjectionCount(),
- par3dgeom->getDetectorColCount(),
- par3dgeom->getDetectorRowCount(),
- par3dgeom->getDetectorSpacingX(),
- par3dgeom->getDetectorSpacingY(),
- par3dgeom->getProjectionAngles());
- } else if (parvec3dgeom) {
- ok &= m_pSirt->setPar3DGeometry(parvec3dgeom->getProjectionCount(),
- parvec3dgeom->getDetectorColCount(),
- parvec3dgeom->getDetectorRowCount(),
- parvec3dgeom->getProjectionVectors());
- } else if (conevec3dgeom) {
- ok &= m_pSirt->setConeGeometry(conevec3dgeom->getProjectionCount(),
- conevec3dgeom->getDetectorColCount(),
- conevec3dgeom->getDetectorRowCount(),
- conevec3dgeom->getProjectionVectors());
- } else {
- ASTRA_ASSERT(false);
- }
+ ok &= m_pSirt->setGeometry(&volgeom, projgeom);
ok &= m_pSirt->enableSuperSampling(m_iVoxelSuperSampling, m_iDetectorSuperSampling);