diff options
Diffstat (limited to 'src/CudaDartMaskAlgorithm3D.cpp')
-rw-r--r-- | src/CudaDartMaskAlgorithm3D.cpp | 30 |
1 files changed, 21 insertions, 9 deletions
diff --git a/src/CudaDartMaskAlgorithm3D.cpp b/src/CudaDartMaskAlgorithm3D.cpp index 7d9aed2..99b0a8d 100644 --- a/src/CudaDartMaskAlgorithm3D.cpp +++ b/src/CudaDartMaskAlgorithm3D.cpp @@ -60,19 +60,19 @@ CCudaDartMaskAlgorithm3D::~CCudaDartMaskAlgorithm3D() bool CCudaDartMaskAlgorithm3D::initialize(const Config& _cfg) { ASTRA_ASSERT(_cfg.self); - ConfigStackCheck<CAlgorithm> CC("CudaDartMaskAlgorithm", this, _cfg); + ConfigStackCheck<CAlgorithm> CC("CudaDartMaskAlgorithm3D", this, _cfg); // reconstruction data XMLNode node = _cfg.self.getSingleNode("SegmentationDataId"); - ASTRA_CONFIG_CHECK(node, "CudaDartMask", "No SegmentationDataId tag specified."); - int id = node.getContentInt(); + ASTRA_CONFIG_CHECK(node, "CudaDartMask3D", "No SegmentationDataId tag specified."); + int id = StringUtil::stringToInt(node.getContent(), -1); m_pSegmentation = dynamic_cast<CFloat32VolumeData3DMemory*>(CData3DManager::getSingleton().get(id)); CC.markNodeParsed("SegmentationDataId"); // reconstruction data node = _cfg.self.getSingleNode("MaskDataId"); - ASTRA_CONFIG_CHECK(node, "CudaDartMask", "No MaskDataId tag specified."); - id = node.getContentInt(); + ASTRA_CONFIG_CHECK(node, "CudaDartMask3D", "No MaskDataId tag specified."); + id = StringUtil::stringToInt(node.getContent(), -1); m_pMask = dynamic_cast<CFloat32VolumeData3DMemory*>(CData3DManager::getSingleton().get(id)); CC.markNodeParsed("MaskDataId"); @@ -83,16 +83,28 @@ bool CCudaDartMaskAlgorithm3D::initialize(const Config& _cfg) if (!_cfg.self.hasOption("GPUindex")) CC.markOptionParsed("GPUIndex"); - // Option: Connectivity - m_iConn = (unsigned int)_cfg.self.getOptionNumerical("Connectivity", 8); + // Option: Connectivity + try { + m_iConn = _cfg.self.getOptionInt("Connectivity", 8); + } catch (const StringUtil::bad_cast &e) { + ASTRA_CONFIG_CHECK(false, "CudaDartMask3D", "Connectivity must be an integer."); + } CC.markOptionParsed("Connectivity"); // Option: Threshold - m_iThreshold = (unsigned int)_cfg.self.getOptionNumerical("Threshold", 1); + try { + m_iThreshold = _cfg.self.getOptionInt("Threshold", 1); + } catch (const StringUtil::bad_cast &e) { + ASTRA_CONFIG_CHECK(false, "CudaDartMask3D", "Threshold must be an integer."); + } CC.markOptionParsed("Threshold"); // 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, "CudaDartMask3D", "Radius must be an integer."); + } CC.markOptionParsed("Radius"); _check(); |