summaryrefslogtreecommitdiffstats
path: root/src/Projector3D.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2014-12-08 11:32:50 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2014-12-08 11:32:50 +0100
commitaa7491e356dfa04057fb94fc349c60300e60bd7b (patch)
tree12890ef9bb3894f3cc28620aafbafd871b1f3c04 /src/Projector3D.cpp
parent817f0fd5a5b9484f77012bd773cd01053e1f81a4 (diff)
downloadastra-aa7491e356dfa04057fb94fc349c60300e60bd7b.tar.gz
astra-aa7491e356dfa04057fb94fc349c60300e60bd7b.tar.bz2
astra-aa7491e356dfa04057fb94fc349c60300e60bd7b.tar.xz
astra-aa7491e356dfa04057fb94fc349c60300e60bd7b.zip
Implement loading geometries into Projector3D
Diffstat (limited to 'src/Projector3D.cpp')
-rw-r--r--src/Projector3D.cpp37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/Projector3D.cpp b/src/Projector3D.cpp
index f8fddf4..ea18480 100644
--- a/src/Projector3D.cpp
+++ b/src/Projector3D.cpp
@@ -28,6 +28,12 @@ $Id$
#include "astra/Projector3D.h"
+#include "astra/VolumeGeometry3D.h"
+#include "astra/ParallelProjectionGeometry3D.h"
+#include "astra/ParallelVecProjectionGeometry3D.h"
+#include "astra/ConeProjectionGeometry3D.h"
+#include "astra/ConeVecProjectionGeometry3D.h"
+
namespace astra
{
@@ -84,6 +90,37 @@ bool CProjector3D::_check()
bool CProjector3D::initialize(const Config& _cfg)
{
assert(_cfg.self);
+ ConfigStackCheck<CProjector3D> CC("Projector3D", this, _cfg);
+
+ XMLNode* node;
+
+ node = _cfg.self->getSingleNode("ProjectionGeometry");
+ ASTRA_CONFIG_CHECK(node, "Projector3D", "No ProjectionGeometry tag specified.");
+ std::string type = node->getAttribute("type");
+ CProjectionGeometry3D* pProjGeometry = 0;
+ if (type == "parallel3d") {
+ pProjGeometry = new CParallelProjectionGeometry3D();
+ } else if (type == "parallel3d_vec") {
+ pProjGeometry = new CParallelVecProjectionGeometry3D();
+ } else if (type == "cone") {
+ pProjGeometry = new CConeProjectionGeometry3D();
+ } else if (type == "cone_vec") {
+ pProjGeometry = new CConeVecProjectionGeometry3D();
+ } else {
+ // Invalid geometry type
+ }
+ pProjGeometry->initialize(Config(node)); // this deletes node
+ m_pProjectionGeometry = pProjGeometry;
+ ASTRA_CONFIG_CHECK(m_pProjectionGeometry->isInitialized(), "Projector3D", "ProjectionGeometry not initialized.");
+ CC.markNodeParsed("ProjectionGeometry");
+
+ node = _cfg.self->getSingleNode("VolumeGeometry");
+ ASTRA_CONFIG_CHECK(node, "Projector3D", "No VolumeGeometry tag specified.");
+ CVolumeGeometry3D* pVolGeometry = new CVolumeGeometry3D();
+ pVolGeometry->initialize(Config(node)); // this deletes node
+ m_pVolumeGeometry = pVolGeometry;
+ ASTRA_CONFIG_CHECK(m_pVolumeGeometry->isInitialized(), "Projector2D", "VolumeGeometry not initialized.");
+ CC.markNodeParsed("VolumeGeometry");
return true;
}