SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SegmentationFactory.cpp
Go to the documentation of this file.
1
22
23#include <iostream>
24
25#include "Configuration/ConfigManager.h"
26
30
35
36#ifdef WITH_ML_SEGMENTATION
38#endif
39
41
42using namespace Euclid::Configuration;
43
44namespace SourceXtractor {
45
50
55
57 auto segmentation_config = manager.getConfiguration<SegmentationConfig>();
58 m_algorithm = segmentation_config.getAlgorithmOption();
59 m_filter = segmentation_config.getFilter();
60 m_lutz_window_size = segmentation_config.getLutzWindowSize();
61 m_bfs_max_delta = segmentation_config.getBfsMaxDelta();
62 m_model_path = segmentation_config.getOnnxModelPath();
63 m_ml_threshold = segmentation_config.getMLThreashold();
64
65 auto assoc_config = manager.getConfiguration<AssocModeConfig>();
66 m_catalogs = assoc_config.getCatalogs();
67}
68
70 auto segmentation = std::make_shared<Segmentation>(m_filter);
71 switch (m_algorithm) {
73 //FIXME Use a factory from parameter
74 segmentation->setLabelling<LutzSegmentation>(
76 break;
78 segmentation->setLabelling<BFSSegmentation>(
80 break;
81#ifdef WITH_ML_SEGMENTATION
83 segmentation->setLabelling<MLSegmentation>(
85 break;
86#endif
88 {
89 segmentation->setLabelling<AssocSegmentation>(
91 break;
92 }
94 default:
95 throw Elements::Exception("Unknown segmentation algorithm.");
96 }
97
98 return segmentation;
99}
100
101} // SEImplementation namespace
Implements a Segmentation based on CNN.
Implements a Segmentation based on the BFS algorithm.
Implements a Segmentation based on CNN.
Used to select a Segmentation algorithm.
void reportConfigDependencies(Euclid::Configuration::ConfigManager &manager) const override
Registers all the Configuration dependencies.
std::shared_ptr< DetectionImageFrame::ImageFilter > m_filter
void configure(Euclid::Configuration::ConfigManager &manager) override
Method which should initialize the object.
std::vector< std::vector< AssocModeConfig::CatalogEntry > > m_catalogs
std::shared_ptr< TaskProvider > m_task_provider
std::shared_ptr< Segmentation > createSegmentation() const
SegmentationFactory(std::shared_ptr< TaskProvider > task_provider)
Constructor.
SegmentationConfig::Algorithm m_algorithm
T make_shared(T... args)