SourceXtractorPlusPlus  0.12
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SegmentationFactory.cpp
Go to the documentation of this file.
1 
23 #include <iostream>
24 
26 
30 
33 
35 
36 using namespace Euclid::Configuration;
37 
38 namespace SourceXtractor {
39 
40 SegmentationFactory::SegmentationFactory(std::shared_ptr<TaskProvider> task_provider)
41  : m_algorithm(SegmentationConfig::Algorithm::UNKNOWN),
42  m_task_provider(task_provider), m_lutz_window_size(0) {
43 }
44 
47 }
48 
50  auto segmentation_config = manager.getConfiguration<SegmentationConfig>();
51  m_algorithm = segmentation_config.getAlgorithmOption();
52  m_filter = segmentation_config.getFilter();
53  m_lutz_window_size = segmentation_config.getLutzWindowSize();
54 }
55 
57 
58  auto segmentation = std::make_shared<Segmentation>(m_filter);
59  switch (m_algorithm) {
61  //FIXME Use a factory from parameter
62  segmentation->setLabelling<LutzSegmentation>(
63  std::make_shared<SourceWithOnDemandPropertiesFactory>(m_task_provider), m_lutz_window_size);
64  break;
66  default:
67  throw Elements::Exception("Unknown segmentation algorithm.");
68  }
69 
70  return segmentation;
71 }
72 
73 } // SEImplementation namespace
std::shared_ptr< DetectionImageFrame::ImageFilter > m_filter
void configure(Euclid::Configuration::ConfigManager &manager) override
Method which should initialize the object.
SegmentationConfig::Algorithm m_algorithm
void reportConfigDependencies(Euclid::Configuration::ConfigManager &manager) const override
Registers all the Configuration dependencies.
Used to select a Segmentation algorithm.
std::shared_ptr< TaskProvider > m_task_provider
std::shared_ptr< Segmentation > createSegmentation() const