From 15dbd4841704bbbdc4095c0d7579aa3225f29a90 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Wed, 12 Jun 2019 16:47:15 +0300
Subject: [PATCH] Fix for config value getting

---
 applications/reconstruct/include/ftl/ray_cast_sdf.hpp   | 2 +-
 components/renderers/cpp/src/display.cpp                | 2 +-
 components/renderers/cpp/src/rgbd_display.cpp           | 4 ++--
 components/rgbd-sources/src/algorithms/fixstars_sgm.cpp | 4 ++--
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/applications/reconstruct/include/ftl/ray_cast_sdf.hpp b/applications/reconstruct/include/ftl/ray_cast_sdf.hpp
index 206e37c5d..658e8ceeb 100644
--- a/applications/reconstruct/include/ftl/ray_cast_sdf.hpp
+++ b/applications/reconstruct/include/ftl/ray_cast_sdf.hpp
@@ -15,7 +15,7 @@ public:
 	CUDARayCastSDF(nlohmann::json& config) : ftl::Configurable(config) {
 		auto &cfg = ftl::config::resolve(config);
 		create(parametersFromConfig(cfg));
-		hash_render_ = cfg.value("hash_renderer", false);
+		hash_render_ = value("hash_renderer", false);
 	}
 
 	~CUDARayCastSDF(void) {
diff --git a/components/renderers/cpp/src/display.cpp b/components/renderers/cpp/src/display.cpp
index 4a7d88e44..c255a8bcc 100644
--- a/components/renderers/cpp/src/display.cpp
+++ b/components/renderers/cpp/src/display.cpp
@@ -21,7 +21,7 @@ Display::Display(nlohmann::json &config, std::string name) : ftl::Configurable(c
 	//cv::namedWindow("Image", cv::WINDOW_KEEPRATIO);
 
 #if defined HAVE_PCL
-	if (config.value("points", false)) {
+	if (value("points", false)) {
 		pclviz_ = pcl::visualization::PCLVisualizer::Ptr(new pcl::visualization::PCLVisualizer ("FTL Cloud: " + name));
 		pclviz_->setBackgroundColor (255, 255, 255);
 		pclviz_->addCoordinateSystem (1.0);
diff --git a/components/renderers/cpp/src/rgbd_display.cpp b/components/renderers/cpp/src/rgbd_display.cpp
index 4d31132e2..0623bf38c 100644
--- a/components/renderers/cpp/src/rgbd_display.cpp
+++ b/components/renderers/cpp/src/rgbd_display.cpp
@@ -42,7 +42,7 @@ static void setMouseAction(const std::string& winName, const MouseAction &action
 }
 
 Display::Display(nlohmann::json &config) : ftl::Configurable(config) {
-	name_ = config.value("name", string("View [")+std::to_string(viewcount__)+string("]"));
+	name_ = value("name", string("View [")+std::to_string(viewcount__)+string("]"));
 	viewcount__++;
 
 	init();
@@ -50,7 +50,7 @@ Display::Display(nlohmann::json &config) : ftl::Configurable(config) {
 
 Display::Display(nlohmann::json &config, Source *source)
 		: ftl::Configurable(config) {
-	name_ = config.value("name", string("View [")+std::to_string(viewcount__)+string("]"));
+	name_ = value("name", string("View [")+std::to_string(viewcount__)+string("]"));
 	viewcount__++;
 	init();
 }
diff --git a/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp b/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp
index 7efb04b37..1267b168e 100644
--- a/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp
+++ b/components/rgbd-sources/src/algorithms/fixstars_sgm.cpp
@@ -11,10 +11,10 @@ using cv::Mat;
 
 FixstarsSGM::FixstarsSGM(nlohmann::json &config) : Disparity(config) {
 	ssgm_ = nullptr;
-	use_filter_ = config.value("use_filter", false);
+	use_filter_ = value("use_filter", false);
 	// note: (max_disp_ << 4) libsgm subpixel accuracy.
 	//       What is the impact in the filter? (possible artifacts)
-	filter_ = cv::cuda::createDisparityBilateralFilter(max_disp_ << 4, config.value("filter_radius", 25), config.value("filter_iter", 1));
+	filter_ = cv::cuda::createDisparityBilateralFilter(max_disp_ << 4, value("filter_radius", 25), value("filter_iter", 1));
 }
 
 void FixstarsSGM::compute(const cv::Mat &l, const cv::Mat &r, cv::Mat &disp) {
-- 
GitLab