SourceXtractorPlusPlus  0.13
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CleaningConfig.cpp
Go to the documentation of this file.
1 
17 /*
18  * CleaningConfig.cpp
19  *
20  * Created on: 2019 M02 6
21  * Author: mschefer
22  */
23 
26 
28 
30 
31 using namespace Euclid::Configuration;
32 namespace po = boost::program_options;
33 
34 namespace SourceXtractor {
35 
36 static const std::string USE_CLEANING {"use-cleaning"};
37 static const std::string CLEANING_MINAREA {"cleaning-minimum-area"};
38 
39 CleaningConfig::CleaningConfig(long manager_id) : Configuration(manager_id) {
40  declareDependency<DeblendStepConfig>();
41 }
42 
44  return { {"Cleaning", {
45  {USE_CLEANING.c_str(), po::bool_switch(),
46  "Enables the cleaning of sources (removes false detections near bright objects)"},
47  {CLEANING_MINAREA.c_str(), po::value<int>()->default_value(3), "min. # of pixels above threshold"}
48  }}};
49 }
50 
51 void CleaningConfig::initialize(const UserValues& args) {
52  auto min_area = args.at(CLEANING_MINAREA).as<int>();
53  if (args.at(USE_CLEANING).as<bool>()) {
54  if (min_area <= 0) {
55  throw Elements::Exception() << "Invalid " << CLEANING_MINAREA << " value: " << min_area;
56  }
57  getDependency<DeblendStepConfig>().addDeblendStepCreator(
58  [min_area](std::shared_ptr<SourceFactory> source_factory) {
59  return std::make_shared<Cleaning>(source_factory, min_area);
60  }
61  );
62  }
63 }
64 
65 } // SourceXtractor namespace
66 
67 
68 
static const std::string CLEANING_MINAREA
STL class.
std::map< std::string, OptionDescriptionList > getProgramOptions() override
STL class.
void initialize(const UserValues &args) override
static const std::string USE_CLEANING
T c_str(T...args)