SourceXtractorPlusPlus  0.14
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 
34 
36 
37 using namespace Euclid::Configuration;
38 
39 namespace SourceXtractor {
40 
41 SegmentationFactory::SegmentationFactory(std::shared_ptr<TaskProvider> task_provider)
42  : m_algorithm(SegmentationConfig::Algorithm::UNKNOWN),
43  m_task_provider(task_provider), m_lutz_window_size(0) {
44 }
45 
48 }
49 
51  auto segmentation_config = manager.getConfiguration<SegmentationConfig>();
52  m_algorithm = segmentation_config.getAlgorithmOption();
53  m_filter = segmentation_config.getFilter();
54  m_lutz_window_size = segmentation_config.getLutzWindowSize();
55  m_bfs_max_delta = segmentation_config.getBfsMaxDelta();
56 }
57 
59 
60  auto segmentation = std::make_shared<Segmentation>(m_filter);
61  switch (m_algorithm) {
63  //FIXME Use a factory from parameter
64  segmentation->setLabelling<LutzSegmentation>(
65  std::make_shared<SourceWithOnDemandPropertiesFactory>(m_task_provider), m_lutz_window_size);
66  break;
68  segmentation->setLabelling<BFSSegmentation>(
69  std::make_shared<SourceWithOnDemandPropertiesFactory>(m_task_provider), m_bfs_max_delta);
70  break;
72  default:
73  throw Elements::Exception("Unknown segmentation algorithm.");
74  }
75 
76  return segmentation;
77 }
78 
79 } // SEImplementation namespace
Implements a Segmentation based on the BFS algorithm.
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