summaryrefslogtreecommitdiffstats
path: root/src/CudaDartSmoothingAlgorithm3D.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-12-12 11:25:33 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-12-23 16:58:03 +0100
commit74feef4718770d20273aa97f9176484149f178ae (patch)
treed7c52cb57a60cc85d6326901cc71ff09986f11a4 /src/CudaDartSmoothingAlgorithm3D.cpp
parent8220a50be6bcbddf179bb855b2f7d36436fcca6b (diff)
downloadastra-74feef4718770d20273aa97f9176484149f178ae.tar.gz
astra-74feef4718770d20273aa97f9176484149f178ae.tar.bz2
astra-74feef4718770d20273aa97f9176484149f178ae.tar.xz
astra-74feef4718770d20273aa97f9176484149f178ae.zip
Improve config error handling
Diffstat (limited to 'src/CudaDartSmoothingAlgorithm3D.cpp')
-rw-r--r--src/CudaDartSmoothingAlgorithm3D.cpp22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/CudaDartSmoothingAlgorithm3D.cpp b/src/CudaDartSmoothingAlgorithm3D.cpp
index 5903d3c..0dc0631 100644
--- a/src/CudaDartSmoothingAlgorithm3D.cpp
+++ b/src/CudaDartSmoothingAlgorithm3D.cpp
@@ -60,19 +60,19 @@ CCudaDartSmoothingAlgorithm3D::~CCudaDartSmoothingAlgorithm3D()
bool CCudaDartSmoothingAlgorithm3D::initialize(const Config& _cfg)
{
ASTRA_ASSERT(_cfg.self);
- ConfigStackCheck<CAlgorithm> CC("CudaDartSmoothingAlgorithm", this, _cfg);
+ ConfigStackCheck<CAlgorithm> CC("CudaDartSmoothingAlgorithm3D", this, _cfg);
// reconstruction data
XMLNode node = _cfg.self.getSingleNode("InDataId");
- ASTRA_CONFIG_CHECK(node, "CudaDartMask", "No InDataId tag specified.");
- int id = node.getContentInt();
+ ASTRA_CONFIG_CHECK(node, "CudaDartSmoothing3D", "No InDataId tag specified.");
+ int id = StringUtil::stringToInt(node.getContent(), -1);
m_pIn = dynamic_cast<CFloat32VolumeData3DMemory*>(CData3DManager::getSingleton().get(id));
CC.markNodeParsed("InDataId");
// reconstruction data
node = _cfg.self.getSingleNode("OutDataId");
- ASTRA_CONFIG_CHECK(node, "CudaDartMask", "No OutDataId tag specified.");
- id = node.getContentInt();
+ ASTRA_CONFIG_CHECK(node, "CudaDartSmoothing3D", "No OutDataId tag specified.");
+ id = StringUtil::stringToInt(node.getContent(), -1);
m_pOut = dynamic_cast<CFloat32VolumeData3DMemory*>(CData3DManager::getSingleton().get(id));
CC.markNodeParsed("OutDataId");
@@ -84,11 +84,19 @@ bool CCudaDartSmoothingAlgorithm3D::initialize(const Config& _cfg)
CC.markOptionParsed("GPUIndex");
// Option: Intensity
- m_fB = (float)_cfg.self.getOptionNumerical("Intensity", 0.3f);
+ try {
+ m_fB = (float)_cfg.self.getOptionNumerical("Intensity", 0.3f);
+ } catch (const StringUtil::bad_cast &e) {
+ ASTRA_CONFIG_CHECK(false, "CudaDartSmoothing3D", "Intensity must be numerical");
+ }
CC.markOptionParsed("Intensity");
// Option: Radius
- m_iRadius = (unsigned int)_cfg.self.getOptionNumerical("Radius", 1);
+ try {
+ m_iRadius = _cfg.self.getOptionInt("Radius", 1);
+ } catch (const StringUtil::bad_cast &e) {
+ ASTRA_CONFIG_CHECK(false, "CudaDartSmoothing3D", "Radius must be an integer.");
+ }
CC.markOptionParsed("Radius");
_check();