summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-05-26 15:36:42 +0200
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2015-06-04 17:24:20 +0200
commit0985154228a63db25e9a0a0165994221d9b97a91 (patch)
treeca5c090b9c2cd320dc1598abb66198f198e8ce46 /src
parent167ec3f4e1cbe4eb856474cb515291261955b053 (diff)
downloadastra-0985154228a63db25e9a0a0165994221d9b97a91.tar.gz
astra-0985154228a63db25e9a0a0165994221d9b97a91.tar.bz2
astra-0985154228a63db25e9a0a0165994221d9b97a91.tar.xz
astra-0985154228a63db25e9a0a0165994221d9b97a91.zip
Use supersampling options from CudaProjector3D
Diffstat (limited to 'src')
-rw-r--r--src/CudaBackProjectionAlgorithm3D.cpp14
-rw-r--r--src/CudaCglsAlgorithm3D.cpp22
-rw-r--r--src/CudaFDKAlgorithm3D.cpp13
-rw-r--r--src/CudaForwardProjectionAlgorithm3D.cpp16
-rw-r--r--src/CudaSirtAlgorithm3D.cpp23
-rw-r--r--src/ReconstructionAlgorithm3D.cpp18
6 files changed, 88 insertions, 18 deletions
diff --git a/src/CudaBackProjectionAlgorithm3D.cpp b/src/CudaBackProjectionAlgorithm3D.cpp
index fbb8f28..e8e0433 100644
--- a/src/CudaBackProjectionAlgorithm3D.cpp
+++ b/src/CudaBackProjectionAlgorithm3D.cpp
@@ -32,6 +32,7 @@ $Id$
#include "astra/AstraObjectManager.h"
+#include "astra/CudaProjector3D.h"
#include "astra/ConeProjectionGeometry3D.h"
#include "astra/ParallelProjectionGeometry3D.h"
#include "astra/ParallelVecProjectionGeometry3D.h"
@@ -102,9 +103,20 @@ bool CCudaBackProjectionAlgorithm3D::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");
- m_iVoxelSuperSampling = (int)_cfg.self.getOptionNumerical("VoxelSuperSampling", 1);
+
+
+ m_iVoxelSuperSampling = 1;
+ if (pCudaProjector)
+ m_iVoxelSuperSampling = pCudaProjector->getVoxelSuperSampling();
+ m_iVoxelSuperSampling = (int)_cfg.self.getOptionNumerical("VoxelSuperSampling", m_iVoxelSuperSampling);
CC.markOptionParsed("VoxelSuperSampling");
CFloat32ProjectionData3DMemory* pSinoMem = dynamic_cast<CFloat32ProjectionData3DMemory*>(m_pSinogram);
diff --git a/src/CudaCglsAlgorithm3D.cpp b/src/CudaCglsAlgorithm3D.cpp
index 3457b81..f527dc5 100644
--- a/src/CudaCglsAlgorithm3D.cpp
+++ b/src/CudaCglsAlgorithm3D.cpp
@@ -32,6 +32,7 @@ $Id$
#include "astra/AstraObjectManager.h"
+#include "astra/CudaProjector3D.h"
#include "astra/ConeProjectionGeometry3D.h"
#include "astra/ParallelVecProjectionGeometry3D.h"
#include "astra/ConeVecProjectionGeometry3D.h"
@@ -106,12 +107,27 @@ bool CCudaCglsAlgorithm3D::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");
- m_iDetectorSuperSampling = (int)_cfg.self.getOptionNumerical("DetectorSuperSampling", 1);
- CC.markOptionParsed("DetectorSuperSampling");
- m_iVoxelSuperSampling = (int)_cfg.self.getOptionNumerical("VoxelSuperSampling", 1);
+
+ 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);
CC.markOptionParsed("VoxelSuperSampling");
+ CC.markOptionParsed("DetectorSuperSampling");
m_pCgls = new AstraCGLS3d();
diff --git a/src/CudaFDKAlgorithm3D.cpp b/src/CudaFDKAlgorithm3D.cpp
index 467e641..667d926 100644
--- a/src/CudaFDKAlgorithm3D.cpp
+++ b/src/CudaFDKAlgorithm3D.cpp
@@ -32,6 +32,7 @@ $Id$
#include "astra/AstraObjectManager.h"
+#include "astra/CudaProjector3D.h"
#include "astra/ConeProjectionGeometry3D.h"
#include "../cuda/3d/astra3d.h"
@@ -100,9 +101,19 @@ 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");
- m_iVoxelSuperSampling = (int)_cfg.self.getOptionNumerical("VoxelSuperSampling", 1);
+
+ m_iVoxelSuperSampling = 1;
+ if (pCudaProjector)
+ m_iVoxelSuperSampling = pCudaProjector->getVoxelSuperSampling();
+ m_iVoxelSuperSampling = (int)_cfg.self.getOptionNumerical("VoxelSuperSampling", m_iVoxelSuperSampling);
CC.markOptionParsed("VoxelSuperSampling");
m_bShortScan = _cfg.self.getOptionBool("ShortScan", false);
diff --git a/src/CudaForwardProjectionAlgorithm3D.cpp b/src/CudaForwardProjectionAlgorithm3D.cpp
index e29b5a9..46dab12 100644
--- a/src/CudaForwardProjectionAlgorithm3D.cpp
+++ b/src/CudaForwardProjectionAlgorithm3D.cpp
@@ -97,18 +97,28 @@ bool CCudaForwardProjectionAlgorithm3D::initialize(const Config& _cfg)
// optional: projector
node = _cfg.self.getSingleNode("ProjectorId");
+ CCudaProjector3D* pCudaProjector = 0;
+ m_pProjector = 0;
if (node) {
id = boost::lexical_cast<int>(node.getContent());
m_pProjector = CProjector3DManager::getSingleton().get(id);
- } else {
- m_pProjector = 0; // TODO: or manually construct default projector?
+ pCudaProjector = dynamic_cast<CCudaProjector3D*>(CProjector3DManager::getSingleton().get(id));
+ m_pProjector = pCudaProjector;
+ if (!pCudaProjector) {
+ // TODO: Report
+ }
}
CC.markNodeParsed("ProjectorId");
// GPU number
m_iGPUIndex = (int)_cfg.self.getOptionNumerical("GPUindex", -1);
CC.markOptionParsed("GPUindex");
- m_iDetectorSuperSampling = (int)_cfg.self.getOptionNumerical("DetectorSuperSampling", 1);
+
+
+ m_iDetectorSuperSampling = 1;
+ if (pCudaProjector)
+ m_iDetectorSuperSampling = pCudaProjector->getDetectorSuperSampling();
+ m_iDetectorSuperSampling = (int)_cfg.self.getOptionNumerical("DetectorSuperSampling", m_iDetectorSuperSampling);
CC.markOptionParsed("DetectorSuperSampling");
// success
diff --git a/src/CudaSirtAlgorithm3D.cpp b/src/CudaSirtAlgorithm3D.cpp
index 5ad131b..abbb9fd 100644
--- a/src/CudaSirtAlgorithm3D.cpp
+++ b/src/CudaSirtAlgorithm3D.cpp
@@ -36,6 +36,7 @@ $Id$
#include "astra/ParallelProjectionGeometry3D.h"
#include "astra/ParallelVecProjectionGeometry3D.h"
#include "astra/ConeVecProjectionGeometry3D.h"
+#include "astra/CudaProjector3D.h"
#include "../cuda/3d/astra3d.h"
@@ -107,12 +108,28 @@ bool CCudaSirtAlgorithm3D::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");
- m_iDetectorSuperSampling = (int)_cfg.self.getOptionNumerical("DetectorSuperSampling", 1);
- CC.markOptionParsed("DetectorSuperSampling");
- m_iVoxelSuperSampling = (int)_cfg.self.getOptionNumerical("VoxelSuperSampling", 1);
+
+
+ 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);
CC.markOptionParsed("VoxelSuperSampling");
+ CC.markOptionParsed("DetectorSuperSampling");
m_pSirt = new AstraSIRT3d();
diff --git a/src/ReconstructionAlgorithm3D.cpp b/src/ReconstructionAlgorithm3D.cpp
index 86b8ab2..f975ace 100644
--- a/src/ReconstructionAlgorithm3D.cpp
+++ b/src/ReconstructionAlgorithm3D.cpp
@@ -106,14 +106,18 @@ bool CReconstructionAlgorithm3D::initialize(const Config& _cfg)
XMLNode node;
int id;
-#if 0
+
// projector
- node = _cfg.self->getSingleNode("ProjectorId");
- ASTRA_CONFIG_CHECK(node, "Reconstruction3D", "No ProjectorId tag specified.");
- id = boost::lexical_cast<int>(node->getContent());
- m_pProjector = CProjector3DManager::getSingleton().get(id);
- ASTRA_DELETE(node);
-#endif
+ node = _cfg.self.getSingleNode("ProjectorId");
+ m_pProjector = 0;
+ if (node) {
+ id = boost::lexical_cast<int>(node.getContent());
+ m_pProjector = CProjector3DManager::getSingleton().get(id);
+ if (!m_pProjector) {
+ // TODO: Report
+ }
+ }
+ CC.markNodeParsed("ProjectorId");
// sinogram data
node = _cfg.self.getSingleNode("ProjectionDataId");