summaryrefslogtreecommitdiffstats
path: root/src/CudaReconstructionAlgorithm2D.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/CudaReconstructionAlgorithm2D.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/CudaReconstructionAlgorithm2D.cpp')
-rw-r--r--src/CudaReconstructionAlgorithm2D.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/CudaReconstructionAlgorithm2D.cpp b/src/CudaReconstructionAlgorithm2D.cpp
index cf7cb6a..d584fc8 100644
--- a/src/CudaReconstructionAlgorithm2D.cpp
+++ b/src/CudaReconstructionAlgorithm2D.cpp
@@ -115,14 +115,22 @@ bool CCudaReconstructionAlgorithm2D::initialize(const Config& _cfg)
initializeFromProjector();
// Deprecated options
- m_iDetectorSuperSampling = (int)_cfg.self.getOptionNumerical("DetectorSuperSampling", m_iDetectorSuperSampling);
- m_iPixelSuperSampling = (int)_cfg.self.getOptionNumerical("PixelSuperSampling", m_iPixelSuperSampling);
+ try {
+ m_iDetectorSuperSampling = _cfg.self.getOptionInt("DetectorSuperSampling", m_iDetectorSuperSampling);
+ m_iPixelSuperSampling = _cfg.self.getOptionInt("PixelSuperSampling", m_iPixelSuperSampling);
+ } catch (const StringUtil::bad_cast &e) {
+ ASTRA_CONFIG_CHECK(false, "CudaReconstructionAlgorithm2D", "Supersampling options must be integers.");
+ }
CC.markOptionParsed("DetectorSuperSampling");
CC.markOptionParsed("PixelSuperSampling");
// GPU number
- m_iGPUIndex = (int)_cfg.self.getOptionNumerical("GPUindex", -1);
- m_iGPUIndex = (int)_cfg.self.getOptionNumerical("GPUIndex", m_iGPUIndex);
+ try {
+ m_iGPUIndex = _cfg.self.getOptionInt("GPUindex", -1);
+ m_iGPUIndex = _cfg.self.getOptionInt("GPUIndex", m_iGPUIndex);
+ } catch (const StringUtil::bad_cast &e) {
+ ASTRA_CONFIG_CHECK(false, "CudaReconstructionAlgorithm2D", "GPUIndex must be an integer.");
+ }
CC.markOptionParsed("GPUIndex");
if (!_cfg.self.hasOption("GPUIndex"))
CC.markOptionParsed("GPUindex");