SourceXtractorPlusPlus
0.10
Please provide a description of the project.
SEImplementation
src
lib
Segmentation
SegmentationFactory.cpp
Go to the documentation of this file.
1
23
#include <iostream>
24
25
#include "
Configuration/ConfigManager.h
"
26
27
#include "
SEFramework/Image/VectorImage.h
"
28
#include "
SEFramework/Source/SourceWithOnDemandPropertiesFactory.h
"
29
#include "
SEFramework/Image/ImageProcessingList.h
"
30
31
#include "
SEImplementation/Segmentation/BackgroundConvolution.h
"
32
#include "
SEImplementation/Segmentation/LutzSegmentation.h
"
33
34
#include "
SEImplementation/Segmentation/SegmentationFactory.h
"
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
45
void
SegmentationFactory::reportConfigDependencies
(
Euclid::Configuration::ConfigManager
& manager)
const
{
46
manager.
registerConfiguration
<
SegmentationConfig
>();
47
}
48
49
void
SegmentationFactory::configure
(
Euclid::Configuration::ConfigManager
& manager) {
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
56
std::shared_ptr<Segmentation>
SegmentationFactory::createSegmentation
()
const
{
57
58
auto
segmentation = std::make_shared<Segmentation>(
m_filter
);
59
switch
(
m_algorithm
) {
60
case
SegmentationConfig::Algorithm::LUTZ
:
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
;
65
case
SegmentationConfig::Algorithm::UNKNOWN
:
66
default
:
67
throw
Elements::Exception
(
"Unknown segmentation algorithm."
);
68
}
69
70
return
segmentation;
71
}
72
73
}
// SEImplementation namespace
SourceXtractor::SegmentationFactory::createSegmentation
std::shared_ptr< Segmentation > createSegmentation() const
Definition:
SegmentationFactory.cpp:56
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:39
SourceXtractor::SegmentationFactory::configure
void configure(Euclid::Configuration::ConfigManager &manager) override
Method which should initialize the object.
Definition:
SegmentationFactory.cpp:49
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:45
SourceXtractor::SegmentationFactory::m_lutz_window_size
int m_lutz_window_size
Definition:
SegmentationFactory.h:61
VectorImage.h
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::SegmentationConfig::Algorithm::LUTZ
@ LUTZ
SourceXtractor::SegmentationConfig::Algorithm::UNKNOWN
@ UNKNOWN
ConfigManager.h
ModuleType::UNKNOWN
@ UNKNOWN
Generated by
1.8.17