diff options
-rw-r--r-- | include/astra/Projector3D.h | 4 | ||||
-rw-r--r-- | matlab/mex/mexDataManagerHelpFunctions.cpp | 2 | ||||
-rw-r--r-- | src/CudaProjector3D.cpp | 19 | ||||
-rw-r--r-- | src/Projector3D.cpp | 37 |
4 files changed, 44 insertions, 18 deletions
diff --git a/include/astra/Projector3D.h b/include/astra/Projector3D.h index ec81bc8..d565962 100644 --- a/include/astra/Projector3D.h +++ b/include/astra/Projector3D.h @@ -34,13 +34,13 @@ $Id$ #include "Globals.h" #include "Config.h" -#include "ProjectionGeometry3D.h" -#include "VolumeGeometry3D.h" namespace astra { class CSparseMatrix; +class CProjectionGeometry3D; +class CVolumeGeometry3D; /** This is a base interface class for a three-dimensional projector. Each subclass should at least diff --git a/matlab/mex/mexDataManagerHelpFunctions.cpp b/matlab/mex/mexDataManagerHelpFunctions.cpp index 2985a9d..5e6020b 100644 --- a/matlab/mex/mexDataManagerHelpFunctions.cpp +++ b/matlab/mex/mexDataManagerHelpFunctions.cpp @@ -296,7 +296,7 @@ allocateDataObject(const std::string & sDataType, cfg.self = xml->getRootNode(); // FIXME: Change how the base class is created. (This is duplicated - // in Projector2D.cpp.) + // in Projector3D.cpp.) std::string type = cfg.self->getAttribute("type"); astra::CProjectionGeometry3D* pGeometry = 0; if (type == "parallel3d") { diff --git a/src/CudaProjector3D.cpp b/src/CudaProjector3D.cpp index 4687825..c31b789 100644 --- a/src/CudaProjector3D.cpp +++ b/src/CudaProjector3D.cpp @@ -28,6 +28,9 @@ $Id$ #include "astra/CudaProjector3D.h" +#include "astra/VolumeGeometry3D.h" +#include "astra/ProjectionGeometry3D.h" + namespace astra { @@ -102,21 +105,7 @@ bool CCudaProjector3D::initialize(const Config& _cfg) return false; } - // TODO: These should go to the parent. - - // ProjectionGeometry - XMLNode* node = _cfg.self->getSingleNode("ProjectionGeometry"); - // TODO: Implement - ASTRA_DELETE(node); - CC.markNodeParsed("ProjectionGeometry"); - - // ReconstructionGeometry - node = _cfg.self->getSingleNode("VolumeGeometry"); - // TODO: Implement - ASTRA_DELETE(node); - CC.markNodeParsed("VolumeGeometry"); - - node = _cfg.self->getSingleNode("ProjectionKernel"); + XMLNode* node = _cfg.self->getSingleNode("ProjectionKernel"); m_projectionKernel = ker3d_default; if (node) { std::string sProjKernel = node->getContent(); 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; } |