summaryrefslogtreecommitdiffstats
path: root/src/FanFlatProjectionGeometry2D.cpp
diff options
context:
space:
mode:
authorWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-12-07 16:41:40 +0100
committerWillem Jan Palenstijn <Willem.Jan.Palenstijn@cwi.nl>2018-12-23 16:57:45 +0100
commit8220a50be6bcbddf179bb855b2f7d36436fcca6b (patch)
tree81986f22c74784ff02c88f1d071fae32186e5f89 /src/FanFlatProjectionGeometry2D.cpp
parentcbc2e1079cf40c6f0c08d2f9c54f7b41b678e567 (diff)
downloadastra-8220a50be6bcbddf179bb855b2f7d36436fcca6b.tar.gz
astra-8220a50be6bcbddf179bb855b2f7d36436fcca6b.tar.bz2
astra-8220a50be6bcbddf179bb855b2f7d36436fcca6b.tar.xz
astra-8220a50be6bcbddf179bb855b2f7d36436fcca6b.zip
More gracefully handle config errors in geometries
Diffstat (limited to 'src/FanFlatProjectionGeometry2D.cpp')
-rw-r--r--src/FanFlatProjectionGeometry2D.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/FanFlatProjectionGeometry2D.cpp b/src/FanFlatProjectionGeometry2D.cpp
index da9133c..901cd7c 100644
--- a/src/FanFlatProjectionGeometry2D.cpp
+++ b/src/FanFlatProjectionGeometry2D.cpp
@@ -136,13 +136,21 @@ bool CFanFlatProjectionGeometry2D::initialize(const Config& _cfg)
// Required: DistanceOriginDetector
XMLNode node = _cfg.self.getSingleNode("DistanceOriginDetector");
ASTRA_CONFIG_CHECK(node, "FanFlatProjectionGeometry2D", "No DistanceOriginDetector tag specified.");
- m_fOriginDetectorDistance = node.getContentNumerical();
+ try {
+ m_fOriginDetectorDistance = node.getContentNumerical();
+ } catch (const StringUtil::bad_cast &e) {
+ ASTRA_CONFIG_CHECK(false, "FanFlatProjectionGeometry2D", "DistanceOriginDetector must be numerical.");
+ }
CC.markNodeParsed("DistanceOriginDetector");
// Required: DetectorOriginSource
node = _cfg.self.getSingleNode("DistanceOriginSource");
ASTRA_CONFIG_CHECK(node, "FanFlatProjectionGeometry2D", "No DistanceOriginSource tag specified.");
- m_fOriginSourceDistance = node.getContentNumerical();
+ try {
+ m_fOriginSourceDistance = node.getContentNumerical();
+ } catch (const StringUtil::bad_cast &e) {
+ ASTRA_CONFIG_CHECK(false, "FanFlatProjectionGeometry2D", "DistanceOriginSource must be numerical.");
+ }
CC.markNodeParsed("DistanceOriginSource");
// success