diff options
author | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2018-12-12 11:25:33 +0100 |
---|---|---|
committer | Willem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl> | 2018-12-23 16:58:03 +0100 |
commit | 74feef4718770d20273aa97f9176484149f178ae (patch) | |
tree | d7c52cb57a60cc85d6326901cc71ff09986f11a4 /src/CudaRoiSelectAlgorithm.cpp | |
parent | 8220a50be6bcbddf179bb855b2f7d36436fcca6b (diff) | |
download | astra-74feef4718770d20273aa97f9176484149f178ae.tar.gz astra-74feef4718770d20273aa97f9176484149f178ae.tar.bz2 astra-74feef4718770d20273aa97f9176484149f178ae.tar.xz astra-74feef4718770d20273aa97f9176484149f178ae.zip |
Improve config error handling
Diffstat (limited to 'src/CudaRoiSelectAlgorithm.cpp')
-rw-r--r-- | src/CudaRoiSelectAlgorithm.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/CudaRoiSelectAlgorithm.cpp b/src/CudaRoiSelectAlgorithm.cpp index cccbbe7..efeb04c 100644 --- a/src/CudaRoiSelectAlgorithm.cpp +++ b/src/CudaRoiSelectAlgorithm.cpp @@ -62,12 +62,12 @@ CCudaRoiSelectAlgorithm::~CCudaRoiSelectAlgorithm() bool CCudaRoiSelectAlgorithm::initialize(const Config& _cfg) { ASTRA_ASSERT(_cfg.self); - ConfigStackCheck<CAlgorithm> CC("CudaDartMaskAlgorithm", this, _cfg); + ConfigStackCheck<CAlgorithm> CC("CudaDartRoiSelectAlgorithm", this, _cfg); // reconstruction data XMLNode node = _cfg.self.getSingleNode("DataId"); ASTRA_CONFIG_CHECK(node, "CudaRoiSelect", "No DataId tag specified."); - int id = node.getContentInt(); + int id = StringUtil::stringToInt(node.getContent(), -1); m_pData = dynamic_cast<CFloat32VolumeData2D*>(CData2DManager::getSingleton().get(id)); CC.markNodeParsed("DataId"); @@ -79,7 +79,11 @@ bool CCudaRoiSelectAlgorithm::initialize(const Config& _cfg) CC.markOptionParsed("GPUIndex"); // Option: Radius - m_fRadius = (unsigned int)_cfg.self.getOptionNumerical("Radius", 0.0f); + try { + m_fRadius = _cfg.self.getOptionNumerical("Radius", 0.0f); + } catch (const StringUtil::bad_cast &e) { + ASTRA_CONFIG_CHECK(false, "CudaDartRoiSelect", "Radius must be numerical."); + } CC.markOptionParsed("Radius"); _check(); |