SourceXtractorPlusPlus  0.13
Please provide a description of the project.
SourceXtractor.cpp
Go to the documentation of this file.
1 
23 #include <typeinfo>
24 #include <map>
25 #include <string>
26 #include <iomanip>
27 
28 #include <boost/program_options.hpp>
29 #include <boost/algorithm/string/predicate.hpp>
31 
32 #include "ElementsKernel/Main.h"
33 #include "ElementsKernel/System.h"
35 
37 #include "Configuration/Utils.h"
38 
40 
48 
50 
53 
55 
78 
80 #include "SEMain/PluginConfig.h"
81 #include "SEMain/Sorter.h"
82 
83 
84 namespace po = boost::program_options;
85 namespace fs = boost::filesystem;
86 using namespace SourceXtractor;
87 using namespace Euclid::Configuration;
88 
90 
91 static const std::string LIST_OUTPUT_PROPERTIES {"list-output-properties"};
92 static const std::string PROPERTY_COLUMN_MAPPING_ALL {"property-column-mapping-all"};
93 static const std::string PROPERTY_COLUMN_MAPPING {"property-column-mapping"};
94 static const std::string DUMP_CONFIG {"dump-default-config"};
95 
96 class GroupObserver : public Observer<std::shared_ptr<SourceGroupInterface>> {
97 public:
98  virtual void handleMessage(const std::shared_ptr<SourceGroupInterface>& group) override {
99  m_list.push_back(group);
100  }
101 
103 };
104 
105 class SourceObserver : public Observer<std::shared_ptr<SourceWithOnDemandProperties>> {
106 public:
107  virtual void handleMessage(const std::shared_ptr<SourceWithOnDemandProperties>& source) override {
108  m_list.push_back(source);
109  }
110 
112 };
113 
115 
116 static void setupEnvironment(void) {
117  // Some parts of boost (including boost::filesystem) can throw an exception when the
118  // locale as configured in the environment is invalid.
119  // We work around that overriding the locale if we find an invalid one.
120  // See https://svn.boost.org/trac10/ticket/10205
121  try {
122  std::locale("");
123  }
124  catch (...) {
125  ::setenv("LC_ALL", "C", 1);
126  }
127 }
128 
129 
130 class SEMain : public Elements::Program {
131 
132  std::shared_ptr<TaskFactoryRegistry> task_factory_registry = std::make_shared<TaskFactoryRegistry>();
133  std::shared_ptr<TaskProvider> task_provider = std::make_shared<TaskProvider>(task_factory_registry);
134  std::shared_ptr<OutputRegistry> output_registry = std::make_shared<OutputRegistry>();
135  SegmentationFactory segmentation_factory {task_provider};
136  OutputFactory output_factory { output_registry };
139  std::make_shared<SourceWithOnDemandPropertiesFactory>(task_provider);
141  std::make_shared<SourceGroupWithOnDemandPropertiesFactory>(task_provider);
142  PartitionFactory partition_factory {source_factory};
143  GroupingFactory grouping_factory {group_factory};
144  DeblendingFactory deblending_factory {source_factory};
145  MeasurementFactory measurement_factory { output_registry };
146  ProgressReporterFactory progress_printer_factory {};
147 
148  bool config_initialized = false;
149  po::options_description config_parameters;
150 
151 public:
152 
153  SEMain(const std::string& plugin_path, const std::vector<std::string>& plugin_list)
154  : plugin_manager { task_factory_registry, output_registry, config_manager_id, plugin_path, plugin_list } {
155  }
156 
160  po::options_description getConfigParameters() {
161  if (!config_initialized) {
162  auto& config_manager = ConfigManager::getInstance(config_manager_id);
163  config_manager.registerConfiguration<SourceXtractorConfig>();
164  config_manager.registerConfiguration<BackgroundConfig>();
165  config_manager.registerConfiguration<SE2BackgroundConfig>();
166  config_manager.registerConfiguration<MemoryConfig>();
167  config_manager.registerConfiguration<BackgroundAnalyzerFactory>();
168  config_manager.registerConfiguration<SamplingConfig>();
169 
171 
172  //plugins need to be registered before reportConfigDependencies()
173  plugin_manager.loadPlugins();
174  task_factory_registry->reportConfigDependencies(config_manager);
175  segmentation_factory.reportConfigDependencies(config_manager);
176  partition_factory.reportConfigDependencies(config_manager);
177  grouping_factory.reportConfigDependencies(config_manager);
178  deblending_factory.reportConfigDependencies(config_manager);
179  measurement_factory.reportConfigDependencies(config_manager);
180  output_factory.reportConfigDependencies(config_manager);
181 
182  config_parameters.add(config_manager.closeRegistration());
183  config_initialized = true;
184  }
185  return config_parameters;
186  }
187 
190  auto options = getConfigParameters();
191 
192  options.add_options() (LIST_OUTPUT_PROPERTIES.c_str(), po::bool_switch(),
193  "List the possible output properties for the given input parameters and exit");
194  options.add_options() (PROPERTY_COLUMN_MAPPING_ALL.c_str(), po::bool_switch(),
195  "Show the columns created for each property");
196  options.add_options() (PROPERTY_COLUMN_MAPPING.c_str(), po::bool_switch(),
197  "Show the columns created for each property, for the given configuration");
198  options.add_options() (DUMP_CONFIG.c_str(), po::bool_switch(),
199  "Dump parameters with default values into a configuration file");
200  progress_printer_factory.addOptions(options);
201 
202  // Allow to pass Python options as positional following --
203  po::positional_options_description p;
204  p.add("python-arg", -1);
205 
206  return {options, p};
207  }
208 
210  template <typename T>
211  static void writeDefault(std::ostream& out, const po::option_description& opt, const boost::any& default_value) {
212  out << opt.long_name() << '=' << boost::any_cast<T>(default_value) << std::endl;
213  }
214 
216  template <typename T>
217  static void writeDefaultMultiple(std::ostream& out, const po::option_description& opt, const boost::any& default_value) {
218  auto values = boost::any_cast<std::vector<T>>(default_value);
219  if (values.empty()) {
220  out << opt.long_name() << '=' << std::endl;
221  }
222  else {
223  for (const auto& v : values)
224  out << opt.long_name() << '=' << v << std::endl;
225  }
226  }
227 
229  void printDefaults() {
230  typedef std::function<void(std::ostream&, const po::option_description&, const boost::any&)> PrinterFunction;
232  {typeid(bool), &writeDefault<bool>},
233  {typeid(int), &writeDefault<int>},
234  {typeid(double), &writeDefault<double>},
235  {typeid(std::string), &writeDefault<std::string>},
236  {typeid(std::vector<std::string>), &writeDefaultMultiple<std::string>}
237  };
238  decltype(printers)::const_iterator printer;
239 
240  auto config_parameters = getConfigParameters();
241  for (const auto& p : config_parameters.options()) {
242  boost::any default_value;
243 
244  std::cout << "# " << p->description() << std::endl;
245  if (!p->semantic()->apply_default(default_value)) {
246  std::cout << '#' << p->long_name() << "=" << std::endl;
247  }
248  else if ((printer = printers.find(default_value.type())) == printers.end()) {
249  std::cout << '#' << p->long_name() << "=<Unknown type " << default_value.type().name() << '>' << std::endl;
250  }
251  else {
252  printer->second(std::cout, *p, default_value);
253  }
254  std::cout << std::endl;
255  }
256 
257  // We need to print the log options manually, as that is set up by Elements
258  std::cout << "# Log level: FATAL, ERROR, WARN, INFO, DEBUG" << std::endl;
259  std::cout << "log-level=INFO" << std::endl;
260  std::cout << "# Log file" << std::endl;
261  std::cout << "#log-file" << std::endl;
262  }
263 
265 
266  // If the user just requested to see the possible output columns we show
267  // them and we do nothing else
268 
269  if (args.at(LIST_OUTPUT_PROPERTIES).as<bool>()) {
270  for (auto& name : output_registry->getOutputPropertyNames()) {
271  std::cout << name << std::endl;
272  }
273  return Elements::ExitCode::OK;
274  }
275 
276  if (args.at(PROPERTY_COLUMN_MAPPING_ALL).as<bool>()) {
277  output_registry->printPropertyColumnMap();
278  return Elements::ExitCode::OK;
279  }
280 
281  if (args.at(DUMP_CONFIG).as<bool>()) {
282  printDefaults();
283  return Elements::ExitCode::OK;
284  }
285 
286  // Elements does not verify that the config-file exists. It will just not read it.
287  // We verify that it does exist here.
288  if (args.find("config-file") != args.end()) {
289  auto cfg_file = args.at("config-file").as<fs::path>();
290  if (cfg_file != "" && !fs::exists(cfg_file)) {
291  throw Elements::Exception() << "The configuration file '" << cfg_file << "' does not exist";
292  }
293  }
294 
295  // Create the progress listener and printer ASAP
296  progress_printer_factory.configure(args);
297  auto progress_mediator = progress_printer_factory.createProgressMediator();
298 
299  // Initialize the rest of the components
300  auto& config_manager = ConfigManager::getInstance(config_manager_id);
301  config_manager.initialize(args);
302 
303  // Configure TileManager
304  auto memory_config = config_manager.getConfiguration<MemoryConfig>();
305  TileManager::getInstance()->setOptions(memory_config.getTileSize(),
306  memory_config.getTileSize(), memory_config.getTileMaxMemory());
307 
308  CheckImages::getInstance().configure(config_manager);
309 
310  task_factory_registry->configure(config_manager);
311  task_factory_registry->registerPropertyInstances(*output_registry);
312 
313  segmentation_factory.configure(config_manager);
314  partition_factory.configure(config_manager);
315  grouping_factory.configure(config_manager);
316  deblending_factory.configure(config_manager);
317  measurement_factory.configure(config_manager);
318  output_factory.configure(config_manager);
319 
320  if (args.at(PROPERTY_COLUMN_MAPPING).as<bool>()) {
321  output_registry->printPropertyColumnMap(config_manager.getConfiguration<OutputConfig>().getOutputProperties());
322  return Elements::ExitCode::OK;
323  }
324 
325  auto detection_image = config_manager.getConfiguration<DetectionImageConfig>().getDetectionImage();
326  auto detection_image_path = config_manager.getConfiguration<DetectionImageConfig>().getDetectionImagePath();
327  auto weight_image = config_manager.getConfiguration<WeightImageConfig>().getWeightImage();
328  bool is_weight_absolute = config_manager.getConfiguration<WeightImageConfig>().isWeightAbsolute();
329  auto weight_threshold = config_manager.getConfiguration<WeightImageConfig>().getWeightThreshold();
330 
331  auto detection_image_coordinate_system = config_manager.getConfiguration<DetectionImageConfig>().getCoordinateSystem();
332  auto detection_image_gain = config_manager.getConfiguration<DetectionImageConfig>().getGain();
333  auto detection_image_saturation = config_manager.getConfiguration<DetectionImageConfig>().getSaturation();
334 
335  auto segmentation = segmentation_factory.createSegmentation();
336 
337  // Prefetcher
338  auto multithreading_config = config_manager.getConfiguration<MultiThreadingConfig>();
339  auto prefetcher = std::make_shared<Prefetcher>(multithreading_config.getThreadPool());
340 
341  // Rest of the stagees
342  auto partition = partition_factory.getPartition();
343  auto source_grouping = grouping_factory.createGrouping();
344  prefetcher->requestProperties(source_grouping->requiredProperties());
345 
346  std::shared_ptr<Deblending> deblending = deblending_factory.createDeblending();
347  std::shared_ptr<Measurement> measurement = measurement_factory.getMeasurement();
348  std::shared_ptr<Output> output = output_factory.getOutput();
349 
350  prefetcher->requestProperties(deblending->requiredProperties());
351 
352  auto sorter = std::make_shared<Sorter>();
353 
354  // Link together the pipeline's steps
355  segmentation->Observable<std::shared_ptr<SourceInterface>>::addObserver(partition);
356  segmentation->Observable<ProcessSourcesEvent>::addObserver(prefetcher);
357  prefetcher->Observable<ProcessSourcesEvent>::addObserver(source_grouping);
358  partition->addObserver(prefetcher);
359  prefetcher->Observable<std::shared_ptr<SourceInterface>>::addObserver(source_grouping);
360  source_grouping->addObserver(deblending);
361  deblending->addObserver(measurement);
362  measurement->addObserver(sorter);
363  sorter->addObserver(output);
364 
365  segmentation->Observable<SegmentationProgress>::addObserver(progress_mediator->getSegmentationObserver());
366  segmentation->Observable<std::shared_ptr<SourceInterface>>::addObserver(progress_mediator->getDetectionObserver());
367  deblending->addObserver(progress_mediator->getDeblendingObserver());
368  measurement->addObserver(progress_mediator->getMeasurementObserver());
369 
370  // Add observers for CheckImages
371  if (CheckImages::getInstance().getSegmentationImage() != nullptr) {
372  segmentation->Observable<std::shared_ptr<SourceInterface>>::addObserver(
373  std::make_shared<DetectionIdCheckImage>());
374  }
375  if (CheckImages::getInstance().getPartitionImage() != nullptr) {
376  measurement->addObserver(
377  std::make_shared<SourceIdCheckImage>());
378  }
379  if (CheckImages::getInstance().getGroupImage() != nullptr) {
380  measurement->addObserver(
381  std::make_shared<GroupIdCheckImage>());
382  }
383  if (CheckImages::getInstance().getMoffatImage() != nullptr) {
384  measurement->addObserver(
385  std::make_shared<MoffatCheckImage>());
386  }
387 
388  auto interpolation_gap = config_manager.getConfiguration<DetectionImageConfig>().getInterpolationGap();
389  auto detection_frame = std::make_shared<DetectionImageFrame>(detection_image, weight_image,
390  weight_threshold, detection_image_coordinate_system, detection_image_gain,
391  detection_image_saturation, interpolation_gap);
392  detection_frame->setLabel(boost::filesystem::basename(detection_image_path));
393 
394  auto background_analyzer = config_manager.getConfiguration<BackgroundAnalyzerFactory>().createBackgroundAnalyzer();
395  auto background_model = background_analyzer->analyzeBackground(detection_frame->getOriginalImage(), weight_image,
396  ConstantImage<unsigned char>::create(detection_image->getWidth(), detection_image->getHeight(), false), detection_frame->getVarianceThreshold());
397 
398  // initial set of the variance and background check images, might be overwritten below
399  CheckImages::getInstance().setBackgroundCheckImage(background_model.getLevelMap());
400  CheckImages::getInstance().setVarianceCheckImage(background_model.getVarianceMap());
401 
402  detection_frame->setBackgroundLevel(background_model.getLevelMap(), background_model.getMedianRms());
403 
404  if (weight_image != nullptr) {
405  if (is_weight_absolute) {
406  detection_frame->setVarianceMap(weight_image);
407  } else {
408  auto scaled_image = MultiplyImage<SeFloat>::create(weight_image, background_model.getScalingFactor());
409  detection_frame->setVarianceMap(scaled_image);
410  }
411  } else {
412  detection_frame->setVarianceMap(background_model.getVarianceMap());
413  }
414  // re-set the variance check image to what's in the detection_frame()
415  CheckImages::getInstance().setVarianceCheckImage(detection_frame->getVarianceMap());
416 
417  const auto& background_config = config_manager.getConfiguration<BackgroundConfig>();
418 
419  // Override background level and threshold if requested by the user
420  if (background_config.isBackgroundLevelAbsolute()) {
422  detection_image->getWidth(), detection_image->getHeight(), background_config.getBackgroundLevel());
423 
424  detection_frame->setBackgroundLevel(background, 0.);
426  }
427 
428  if (background_config.isDetectionThresholdAbsolute()) {
429  detection_frame->setDetectionThreshold(background_config.getDetectionThreshold());
430  }
431  CheckImages::getInstance().setVarianceCheckImage(detection_frame->getVarianceMap());
432 
433  //CheckImages::getInstance().setFilteredCheckImage(detection_frame->getFilteredImage());
434 
435  // Perform measurements (multi-threaded part)
436  measurement->startThreads();
437 
438  try {
439  // Process the image
440  segmentation->processFrame(detection_frame);
441  }
442  catch (const std::exception &e) {
443  logger.error() << "Failed to process the frame! " << e.what();
444  measurement->waitForThreads();
445  return Elements::ExitCode::NOT_OK;
446  }
447 
448  prefetcher->wait();
449  measurement->waitForThreads();
450 
451  CheckImages::getInstance().setFilteredCheckImage(detection_frame->getFilteredImage());
452  CheckImages::getInstance().setThresholdedCheckImage(detection_frame->getThresholdedImage());
453  CheckImages::getInstance().setSnrCheckImage(detection_frame->getSnrImage());
455  TileManager::getInstance()->flush();
456  FitsFileManager::getInstance()->closeAllFiles();
457 
458  size_t n_writen_rows = output->flush();
459 
460  progress_mediator->done();
461 
462  if (n_writen_rows > 0) {
463  logger.info() << n_writen_rows << " sources detected";
464  } else {
465  logger.info() << "NO SOURCES DETECTED";
466  }
467 
468  return Elements::ExitCode::OK;
469  }
470 };
471 
472 
474 
475 public:
477  m_plugin_path(plugin_path), m_plugin_list(plugin_list) {
478  }
479 
480  virtual ~PluginOptionsMain() = default;
481 
482  boost::program_options::options_description defineSpecificProgramOptions() override {
483  auto& config_manager = ConfigManager::getInstance(conf_man_id);
484  config_manager.registerConfiguration<PluginConfig>();
485  auto options = config_manager.closeRegistration();
486  // The following will consume any extra options in the configuration file
487  options.add_options()("*", po::value<std::vector<std::string>>());
488  return options;
489  }
490 
492  auto& config_manager = ConfigManager::getInstance(conf_man_id);
493  config_manager.initialize(args);
494  auto& conf = config_manager.getConfiguration<PluginConfig>();
495  m_plugin_path = conf.getPluginPath();
496  m_plugin_list = conf.getPluginList();
497  return Elements::ExitCode::OK;
498  }
499 
500 private:
501 
502  long conf_man_id = getUniqueManagerId();
505 
506 };
507 
508 
509 static void forwardOptions(int argc, char *const *argv, std::vector<std::string>& plugin_options_input) {
510  for (int i = 0; i < argc; ++i) {
511  std::string option{argv[i]};
512  if (option == "--config-file") {
513  plugin_options_input.emplace_back("--config-file");
514  plugin_options_input.emplace_back(std::string{argv[i + 1]});
515  }
516  if (boost::starts_with(option, "--config-file=")) {
517  plugin_options_input.emplace_back(option);
518  }
519  if (option == "--plugin-directory") {
520  plugin_options_input.emplace_back("--plugin-directory");
521  plugin_options_input.emplace_back(std::string{argv[i + 1]});
522  }
523  if (boost::starts_with(option, "--plugin-directory=")) {
524  plugin_options_input.emplace_back(option);
525  }
526  if (option == "--plugin") {
527  plugin_options_input.emplace_back("--plugin");
528  plugin_options_input.emplace_back(std::string{argv[i + 1]});
529  }
530  if (boost::starts_with(option, "--plugin=")) {
531  plugin_options_input.emplace_back(option);
532  }
533  }
534 }
535 
536 
537 ELEMENTS_API int main(int argc, char* argv[]) {
538  std::string plugin_path {};
539  std::vector<std::string> plugin_list {};
540 
541  // This adds the current directory as a valid location for the default "sourcextractor++.conf" configuration
542  Elements::TempEnv local_env;
543  if (local_env["ELEMENTS_CONF_PATH"].empty()) {
544  local_env["ELEMENTS_CONF_PATH"] = ".:/etc";
545  } else {
546  local_env["ELEMENTS_CONF_PATH"] = ".:" + local_env["ELEMENTS_CONF_PATH"] + ":/etc";
547  }
548 
550 
551  // Try to be reasonably graceful with unhandled exceptions
553 
554  try {
555  // First we create a program which has a sole purpose to get the options for
556  // the plugin paths. Note that we do not want to have this helper program
557  // to handle any other options except of the plugin-directory and plugin, so
558  // we create a subset of the given options with only the necessary ones. We
559  // also turn off the the logging.
560  std::vector<int> masked_indices{};
561  std::vector<std::string> plugin_options_input{};
562  plugin_options_input.emplace_back("DummyProgram");
563  plugin_options_input.emplace_back("--log-level");
564  plugin_options_input.emplace_back("ERROR");
565  forwardOptions(argc, argv, plugin_options_input);
566 
567  int argc_tmp = plugin_options_input.size();
568  std::vector<const char *> argv_tmp(argc_tmp);
569  for (unsigned int i = 0; i < plugin_options_input.size(); ++i) {
570  auto& option_str = plugin_options_input[i];
571  argv_tmp[i] = option_str.data();
572  }
573 
574  CREATE_MANAGER_WITH_ARGS(plugin_options_program, PluginOptionsMain, plugin_path, plugin_list);
575  plugin_options_program.run(argc_tmp, const_cast<char **>(argv_tmp.data()));
576 
577  CREATE_MANAGER_WITH_ARGS(main, SEMain, plugin_path, plugin_list);
578  Elements::ExitCode exit_code = main.run(argc, argv);
579  return static_cast<Elements::ExitCodeType>(exit_code);
580  }
581  catch (const std::exception &e) {
582  logger.fatal() << e.what();
583  return static_cast<Elements::ExitCodeType>(Elements::ExitCode::NOT_OK);
584  }
585  catch (...) {
586  logger.fatal() << "Unknown exception type!";
587  logger.fatal() << "Please, report this as a bug";
588  return static_cast<Elements::ExitCodeType>(Elements::ExitCode::SOFTWARE);
589  }
590 }
SourceXtractor::ConstantImage
Definition: ConstantImage.h:33
SourceObserver
Definition: SourceXtractor.cpp:105
LIST_OUTPUT_PROPERTIES
static const std::string LIST_OUTPUT_PROPERTIES
Definition: SourceXtractor.cpp:91
SourceXtractor::TileManager::getInstance
static std::shared_ptr< TileManager > getInstance()
Definition: TileManager.h:136
SourceXtractor::OutputFactory
Definition: OutputFactory.h:37
SegmentationFactory.h
SourceXtractor::Observer
Observer interface to be used with Observable to implement the Observer pattern.
Definition: Observable.h:38
std::locale
Utils.h
PartitionFactory.h
PROPERTY_COLUMN_MAPPING
static const std::string PROPERTY_COLUMN_MAPPING
Definition: SourceXtractor.cpp:93
DetectionIdCheckImage.h
std::string
STL class.
std::shared_ptr< SourceGroupInterface >
SourceXtractor::CheckImages::setBackgroundCheckImage
void setBackgroundCheckImage(std::shared_ptr< Image< SeFloat >> background_image)
Definition: CheckImages.h:110
SourceXtractor::PluginManager
PluginManager handles the loading of plugins and calls their registration function,...
Definition: PluginManager.h:53
Elements::ProgramManager::onTerminate
static void onTerminate() noexcept
std::exception
STL class.
Temporary.h
std::list
STL class.
CheckImages.h
TaskFactoryRegistry.h
SourceXtractor::PartitionFactory
Definition: PartitionFactory.h:33
SourceObserver::handleMessage
virtual void handleMessage(const std::shared_ptr< SourceWithOnDemandProperties > &source) override
Definition: SourceXtractor.cpp:107
SourceXtractor::TaskFactoryRegistry::registerPropertyInstances
void registerPropertyInstances(OutputRegistry &output_registry)
Definition: TaskFactoryRegistry.cpp:42
std::pair
SourceGrouping.h
std::set_terminate
T set_terminate(T... args)
SourceXtractor::SamplingConfig
Definition: SamplingConfig.h:25
Elements::Logging
std::vector< std::string >
std::map::find
T find(T... args)
SourceXtractor::MeasurementFactory
Definition: MeasurementFactory.h:39
getUniqueManagerId
long getUniqueManagerId()
SourceXtractor::CheckImages::setFilteredCheckImage
void setFilteredCheckImage(std::shared_ptr< Image< SeFloat >> filtered_image)
Definition: CheckImages.h:118
PluginOptionsMain::~PluginOptionsMain
virtual ~PluginOptionsMain()=default
SEMain::plugin_manager
PluginManager plugin_manager
Definition: SourceXtractor.cpp:137
Deblending.h
PluginOptionsMain::m_plugin_path
std::string & m_plugin_path
Definition: SourceXtractor.cpp:503
SourceXtractor::WeightImageConfig
Definition: WeightImageConfig.h:32
SourceXtractor::PluginManager::loadPlugins
void loadPlugins()
loads all the available plugins. Both those linked at compile-time and those loaded at run-time
Definition: PluginManager.cpp:51
SourceGroupWithOnDemandPropertiesFactory.h
SourceXtractor::GroupingFactory
Definition: GroupingFactory.h:41
SourceXtractor::PluginConfig
Definition: PluginConfig.h:31
SourceWithOnDemandPropertiesFactory.h
SourceXtractor::Measurement::startThreads
virtual void startThreads()=0
WeightImageConfig.h
std::function
SourceXtractor::DeblendingFactory
Definition: DeblendingFactory.h:33
SourceXtractor::CheckImages::setSnrCheckImage
void setSnrCheckImage(std::shared_ptr< Image< SeFloat >> snr_image)
Definition: CheckImages.h:126
CREATE_MANAGER_WITH_ARGS
#define CREATE_MANAGER_WITH_ARGS(MANAGER, ELEMENTS_PROGRAM,...)
Euclid::Configuration
SourceXtractor::MemoryConfig
Definition: MemoryConfig.h:31
SEMain::getConfigParameters
po::options_description getConfigParameters()
Definition: SourceXtractor.cpp:160
Prefetcher.h
Elements::ExitCode
ExitCode
MeasurementFactory.h
SEMain::writeDefaultMultiple
static void writeDefaultMultiple(std::ostream &out, const po::option_description &opt, const boost::any &default_value)
Print a multiple-value option.
Definition: SourceXtractor.cpp:217
SourceXtractor::DetectionImageConfig
Provides the detection image.
Definition: DetectionImageConfig.h:38
SEMain::printDefaults
void printDefaults()
Print a configuration file populated with defaults.
Definition: SourceXtractor.cpp:229
SourceXtractor::Measurement::waitForThreads
virtual void waitForThreads()=0
SourceXtractor::CheckImages::getInstance
static CheckImages & getInstance()
Definition: CheckImages.h:136
System.h
SourceXtractor
Definition: Aperture.h:30
SourceXtractor::Deblending::requiredProperties
std::set< PropertyId > requiredProperties() const
Returns the set of required properties to compute the deblending.
Definition: Deblending.cpp:44
SourceXtractor::FitsFileManager::getInstance
static std::shared_ptr< FitsFileManager > getInstance()
Definition: FitsFileManager.h:47
SourceXtractor::TaskFactoryRegistry::configure
virtual void configure(Euclid::Configuration::ConfigManager &manager) override
Method which should initialize the object.
Definition: TaskFactoryRegistry.cpp:36
ELEMENTS_API
#define ELEMENTS_API
std::map::at
T at(T... args)
SEMain::defineProgramArguments
std::pair< po::options_description, po::positional_options_description > defineProgramArguments() override
Return the arguments that the program accepts.
Definition: SourceXtractor.cpp:189
std::ostream
STL class.
BufferedImage.h
SourceXtractor::Observable::addObserver
virtual void addObserver(std::shared_ptr< Observer< T >> observer)
Adds an Observer that will be notified when notify Observers is called.
Definition: Observable.h:59
SourceXtractor::SegmentationFactory
The SegmentationFactory will provide a Segmentation implementation based on the current configuration...
Definition: SegmentationFactory.h:39
setupEnvironment
static void setupEnvironment(void)
Definition: SourceXtractor.cpp:116
std::string::c_str
T c_str(T... args)
SEMain::writeDefault
static void writeDefault(std::ostream &out, const po::option_description &opt, const boost::any &default_value)
Print a simple option.
Definition: SourceXtractor.cpp:211
SourceXtractor::MultiThreadingConfig
Definition: MultiThreadingConfig.h:32
SourceXtractor::OutputRegistry::printPropertyColumnMap
void printPropertyColumnMap(const std::vector< std::string > &properties={})
Definition: OutputRegistry.cpp:70
SourceXtractor::CheckImages::reportConfigDependencies
virtual void reportConfigDependencies(Euclid::Configuration::ConfigManager &manager) const override
Registers all the Configuration dependencies.
Definition: CheckImages.cpp:40
SourceXtractor::ConstantImage::create
static std::shared_ptr< ConstantImage< T > > create(int width, int height, T constant_value)
Definition: ConstantImage.h:42
Elements::Exception
ProcessedImage.h
MoffatCheckImage.h
PluginOptionsMain::PluginOptionsMain
PluginOptionsMain(std::string &plugin_path, std::vector< std::string > &plugin_list)
Definition: SourceXtractor.cpp:476
std::map
STL class.
SEMain::config_parameters
po::options_description config_parameters
Definition: SourceXtractor.cpp:149
PluginOptionsMain::defineSpecificProgramOptions
boost::program_options::options_description defineSpecificProgramOptions() override
Definition: SourceXtractor.cpp:482
DUMP_CONFIG
static const std::string DUMP_CONFIG
Definition: SourceXtractor.cpp:94
BackgroundConfig.h
SourceXtractor::logger
static auto logger
Definition: WCS.cpp:44
DetectionImageConfig.h
MemoryConfig.h
GroupObserver::m_list
std::list< std::shared_ptr< SourceGroupInterface > > m_list
Definition: SourceXtractor.cpp:102
SourceObserver::m_list
std::list< std::shared_ptr< SourceWithOnDemandProperties > > m_list
Definition: SourceXtractor.cpp:111
e
constexpr double e
SourceXtractor::SourceXtractorConfig
Definition: SourceXtractorConfig.h:35
SourceXtractor::ProcessedImage::create
static std::shared_ptr< ProcessedImage< T, P > > create(std::shared_ptr< const Image< T >> image_a, std::shared_ptr< const Image< T >> image_b)
Definition: ProcessedImage.h:54
ProgressReporterFactory.h
Elements::Logging::getLogger
static Logging getLogger(const std::string &name="")
Partition.h
BackgroundAnalyzerFactory.h
SEMain::mainMethod
Elements::ExitCode mainMethod(std::map< std::string, po::variable_value > &args) override
Definition: SourceXtractor.cpp:264
SE2BackgroundConfig.h
std::vector::emplace_back
T emplace_back(T... args)
SourceXtractor::OutputConfig
Definition: OutputConfig.h:36
Elements::ExitCodeType
std::underlying_type< ExitCode >::type ExitCodeType
PluginConfig.h
std::endl
T endl(T... args)
OutputConfig.h
SourceXtractor::CheckImages::configure
virtual void configure(Euclid::Configuration::ConfigManager &manager) override
Method which should initialize the object.
Definition: CheckImages.cpp:67
TaskProvider.h
SourceXtractor::CheckImages::saveImages
void saveImages()
Definition: CheckImages.cpp:253
GroupIdCheckImage.h
GroupingFactory.h
SourceXtractor::BackgroundAnalyzerFactory
Definition: BackgroundAnalyzerFactory.h:36
DeblendingFactory.h
PluginManager.h
OutputRegistry.h
Elements::Program
SourceXtractor::OutputRegistry::getOutputPropertyNames
std::set< std::string > getOutputPropertyNames()
Definition: OutputRegistry.h:149
SourceXtractor::ProgressReporterFactory
Definition: ProgressReporterFactory.h:41
PluginOptionsMain::mainMethod
Elements::ExitCode mainMethod(std::map< std::string, boost::program_options::variable_value > &args) override
Definition: SourceXtractor.cpp:491
SourceXtractor::TaskFactoryRegistry::reportConfigDependencies
virtual void reportConfigDependencies(Euclid::Configuration::ConfigManager &manager) const override
Registers all the Configuration dependencies.
Definition: TaskFactoryRegistry.cpp:29
Elements::Environment
GroupObserver::handleMessage
virtual void handleMessage(const std::shared_ptr< SourceGroupInterface > &group) override
Definition: SourceXtractor.cpp:98
Sorter.h
SEMain
Definition: SourceXtractor.cpp:130
std::map::end
T end(T... args)
SourceXtractor::BackgroundConfig
Definition: BackgroundConfig.h:30
SourceIdCheckImage.h
Main.h
SourceXtractor::Output::flush
virtual size_t flush()=0
PluginOptionsMain
Definition: SourceXtractor.cpp:473
SourceXtractor::CheckImages::setVarianceCheckImage
void setVarianceCheckImage(std::shared_ptr< Image< SeFloat >> variance_image)
Definition: CheckImages.h:114
SourceXtractor::OutputConfig::getOutputProperties
const std::vector< std::string > getOutputProperties()
Definition: OutputConfig.cpp:98
ConfigManager.h
MultiThreadingConfig.h
std::partition
T partition(T... args)
Euclid::Configuration::ConfigManager::getInstance
static ConfigManager & getInstance(long id)
std::vector::data
T data(T... args)
PixelCentroid.h
conf
Definition: conf.py:1
SourceXtractorConfig.h
GroupObserver
Definition: SourceXtractor.cpp:96
SEMain::SEMain
SEMain(const std::string &plugin_path, const std::vector< std::string > &plugin_list)
Definition: SourceXtractor.cpp:153
FitsFileManager.h
SamplingConfig.h
main
ELEMENTS_API int main(int argc, char *argv[])
Definition: SourceXtractor.cpp:537
SourceXtractor::SE2BackgroundConfig
Definition: SE2BackgroundConfig.h:30
forwardOptions
static void forwardOptions(int argc, char *const *argv, std::vector< std::string > &plugin_options_input)
Definition: SourceXtractor.cpp:509
PROPERTY_COLUMN_MAPPING_ALL
static const std::string PROPERTY_COLUMN_MAPPING_ALL
Definition: SourceXtractor.cpp:92
config_manager_id
static long config_manager_id
Definition: SourceXtractor.cpp:89
SourceXtractor::CheckImages::setThresholdedCheckImage
void setThresholdedCheckImage(std::shared_ptr< Image< SeFloat >> thresholded_image)
Definition: CheckImages.h:122
PluginOptionsMain::m_plugin_list
std::vector< std::string > & m_plugin_list
Definition: SourceXtractor.cpp:504
OutputFactory.h