SourceXtractorPlusPlus  0.15
Please provide a description of the project.
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
SourceXtractor::SegmentationFactory::createSegmentation
std::shared_ptr< Segmentation > createSegmentation() const
Definition: SegmentationFactory.cpp:58
SegmentationFactory.h
Euclid::Configuration::ConfigManager::registerConfiguration
void registerConfiguration()
SourceXtractor::SegmentationFactory::m_filter
std::shared_ptr< DetectionImageFrame::ImageFilter > m_filter
Definition: SegmentationFactory.h:56
std::shared_ptr< TaskProvider >
Euclid::Configuration::ConfigManager
BackgroundConvolution.h
SourceXtractor::LutzSegmentation
Definition: LutzSegmentation.h:38
SourceXtractor::SegmentationFactory::configure
void configure(Euclid::Configuration::ConfigManager &manager) override
Method which should initialize the object.
Definition: SegmentationFactory.cpp:50
Euclid::Configuration::ConfigManager::getConfiguration
T & getConfiguration()
SourceWithOnDemandPropertiesFactory.h
SourceXtractor::SegmentationFactory::reportConfigDependencies
void reportConfigDependencies(Euclid::Configuration::ConfigManager &manager) const override
Registers all the Configuration dependencies.
Definition: SegmentationFactory.cpp:46
SourceXtractor::SegmentationFactory::m_lutz_window_size
int m_lutz_window_size
Definition: SegmentationFactory.h:61
VectorImage.h
SourceXtractor::BFSSegmentation
Implements a Segmentation based on the BFS algorithm.
Definition: BFSSegmentation.h:31
Euclid::Configuration
ImageProcessingList.h
SourceXtractor::SegmentationFactory::m_algorithm
SegmentationConfig::Algorithm m_algorithm
Definition: SegmentationFactory.h:58
LutzSegmentation.h
SourceXtractor
Definition: Aperture.h:30
SourceXtractor::SegmentationConfig
Used to select a Segmentation algorithm.
Definition: SegmentationConfig.h:36
Elements::Exception
SourceXtractor::SegmentationFactory::m_task_provider
std::shared_ptr< TaskProvider > m_task_provider
Definition: SegmentationFactory.h:59
SourceXtractor::SegmentationFactory::m_bfs_max_delta
int m_bfs_max_delta
Definition: SegmentationFactory.h:62
SourceXtractor::SegmentationConfig::Algorithm::BFS
@ BFS
BFSSegmentation.h
SourceXtractor::SegmentationConfig::Algorithm::LUTZ
@ LUTZ
SourceXtractor::SegmentationConfig::Algorithm::UNKNOWN
@ UNKNOWN
ConfigManager.h