SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
CoreThresholdPartitionConfig.cpp
Go to the documentation of this file.
1
17/*
18 * CoreThresholdPartitionConfig.cpp
19 *
20 * Created on: May 28, 2019
21 * Author: mkuemmel@usm.lmu.de
22 */
23
24#include <Configuration/ProgramOptionsHelper.h>
25
27
32
33
34namespace po = boost::program_options;
35using namespace Euclid::Configuration;
36
37namespace SourceXtractor {
38
39static const std::string CORE_THRESHOLD {"core-threshold-value" };
40static const std::string CORE_MINAREA {"core-minimum-area" };
41static const std::string CORE_THRESH_USE {"partition-corethreshold" };
42
51
53 return {{"Core threshold partitioning", {
54 {CORE_THRESHOLD.c_str(), po::value<double>()->default_value(0.0), "The core threshold level"},
55 {CORE_MINAREA.c_str(), po::value<int>()->default_value(0), "The minimum pixel area for partitioning"},
56 {CORE_THRESH_USE.c_str(), po::value<bool>()->default_value(false), "Activate core threshold partitioning"}
57 }}};
58}
59
61 m_core_threshold = args.find(CORE_THRESHOLD)->second.as<double>();
62 m_core_minarea = args.find(CORE_MINAREA)->second.as<int>();
63
64 if (m_core_threshold < 0.) {
65 throw Elements::Exception() << "Invalid " << CORE_THRESHOLD << " value: " << m_core_threshold;
66 }
67 if (m_core_minarea < 0) {
68 throw Elements::Exception() << "Invalid " << CORE_MINAREA << " value: " << m_core_minarea;
69 }
70
71 if (getDependency<DetectionFrameConfig>().getDetectionFrames().size() > 0) {
72 if (m_core_threshold > 0.0 && m_core_minarea > 0 && args.at(CORE_THRESH_USE).as<bool>()) {
73 double core_threshold = m_core_threshold;
74 int core_minarea = m_core_minarea;
75 getDependency<PartitionStepConfig>().addPartitionStepCreator([core_threshold, core_minarea](std::shared_ptr<SourceFactory>)
76 { return std::make_shared<CoreThresholdPartitionStep>(core_threshold, core_minarea); } );
77 }
78 }
79}
80
84
88
89} // end SExtractor
T at(T... args)
static ConfigManager & getInstance(long id)
std::map< std::string, boost::program_options::variable_value > UserValues
std::map< std::string, OptionDescriptionList > getProgramOptions() override
T find(T... args)
T make_shared(T... args)
static const std::string CORE_MINAREA
static const std::string CORE_THRESH_USE
static const std::string CORE_THRESHOLD