SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
src
lib
Plugin
CoreThresholdPartition
CoreThresholdPartitionConfig.cpp
Go to the documentation of this file.
1
17
/*
18
* CoreThresholdPartitionConfig.cpp
19
*
20
* Created on: May 28, 2019
21
* Author: mkuemmel@usm.lmu.de
22
*/
23
24
#include <Configuration/ProgramOptionsHelper.h>
25
26
#include "
SEImplementation/Plugin/CoreThresholdPartition/CoreThresholdPartitionConfig.h
"
27
28
#include "
SEImplementation/Plugin/CoreThresholdPartition/CoreThresholdPartitionStep.h
"
29
#include "
SEImplementation/Configuration/PartitionStepConfig.h
"
30
#include "
SEImplementation/Configuration/MultiThresholdPartitionConfig.h
"
31
32
33
namespace
po = boost::program_options;
34
using namespace
Euclid::Configuration
;
35
36
namespace
SourceXtractor
{
37
38
static
const
std::string
CORE_THRESHOLD
{
"core-threshold-value"
};
39
static
const
std::string
CORE_MINAREA
{
"core-minimum-area"
};
40
static
const
std::string
CORE_THRESH_USE
{
"partition-corethreshold"
};
41
42
CoreThresholdPartitionConfig::CoreThresholdPartitionConfig
(
long
manager_id
)
43
:
Configuration
(
manager_id
), m_core_threshold(0.), m_core_minarea(0) {
44
declareDependency<PartitionStepConfig>
();
45
46
ConfigManager::getInstance
(
manager_id
).
registerDependency
<
CoreThresholdPartitionConfig
,
MultiThresholdPartitionConfig
>();
47
}
48
49
std::map<std::string, Configuration::OptionDescriptionList>
CoreThresholdPartitionConfig::getProgramOptions
() {
50
return
{{
"Core threshold partitioning"
, {
51
{
CORE_THRESHOLD
.c_str(), po::value<double>()->default_value(0.0),
"The core threshold level"
},
52
{
CORE_MINAREA
.c_str(), po::value<int>()->default_value(0),
"The minimum pixel area for partitioning"
},
53
{
CORE_THRESH_USE
.c_str(), po::value<bool>()->default_value(
false
),
"Activate core threshold partitioning"
}
54
}}};
55
}
56
57
void
CoreThresholdPartitionConfig::initialize
(
const
UserValues
&
args
) {
58
m_core_threshold
=
args
.find(
CORE_THRESHOLD
)->second.as<
double
>();
59
m_core_minarea
=
args
.find(
CORE_MINAREA
)->second.as<
int
>();
60
61
if
(
m_core_threshold
< 0.) {
62
throw
Elements::Exception
() <<
"Invalid "
<<
CORE_THRESHOLD
<<
" value: "
<<
m_core_threshold
;
63
}
64
if
(
m_core_minarea
< 0) {
65
throw
Elements::Exception
() <<
"Invalid "
<<
CORE_MINAREA
<<
" value: "
<<
m_core_minarea
;
66
}
67
68
if
(
m_core_threshold
> 0.0 &&
m_core_minarea
> 0 &&
args
.at(
CORE_THRESH_USE
).as<
bool
>()) {
69
double
core_threshold
=
m_core_threshold
;
70
int
core_minarea
=
m_core_minarea
;
71
getDependency<PartitionStepConfig>
().addPartitionStepCreator([
core_threshold
,
core_minarea
](
std::shared_ptr<SourceFactory>
)
72
{
return
std::make_shared<CoreThresholdPartitionStep>
(
core_threshold
,
core_minarea
); } );
73
}
74
}
75
76
const
double
&
CoreThresholdPartitionConfig::getCoreThreshold
()
const
{
77
return
m_core_threshold
;
78
}
79
80
const
int
&
CoreThresholdPartitionConfig::getCoreMinArea
()
const
{
81
return
m_core_minarea
;
82
}
83
84
}
// end SExtractor
CoreThresholdPartitionConfig.h
CoreThresholdPartitionStep.h
MultiThresholdPartitionConfig.h
PartitionStepConfig.h
std::string
Elements::Exception
Euclid::Configuration::ConfigManager::registerDependency
void registerDependency()
Euclid::Configuration::ConfigManager::getInstance
static ConfigManager & getInstance(long id)
Euclid::Configuration::Configuration
SourceXtractor::CoreThresholdPartitionConfig::m_core_minarea
int m_core_minarea
Definition
CoreThresholdPartitionConfig.h:48
SourceXtractor::CoreThresholdPartitionConfig::initialize
void initialize(const UserValues &args) override
Definition
CoreThresholdPartitionConfig.cpp:57
SourceXtractor::CoreThresholdPartitionConfig::CoreThresholdPartitionConfig
CoreThresholdPartitionConfig(long manager_id)
Definition
CoreThresholdPartitionConfig.cpp:42
SourceXtractor::CoreThresholdPartitionConfig::getCoreThreshold
const double & getCoreThreshold() const
Definition
CoreThresholdPartitionConfig.cpp:76
SourceXtractor::CoreThresholdPartitionConfig::getCoreMinArea
const int & getCoreMinArea() const
Definition
CoreThresholdPartitionConfig.cpp:80
SourceXtractor::CoreThresholdPartitionConfig::m_core_threshold
double m_core_threshold
Definition
CoreThresholdPartitionConfig.h:47
SourceXtractor::CoreThresholdPartitionConfig::getProgramOptions
std::map< std::string, OptionDescriptionList > getProgramOptions() override
Definition
CoreThresholdPartitionConfig.cpp:49
SourceXtractor::MultiThresholdPartitionConfig
Definition
MultiThresholdPartitionConfig.h:32
std::function
std::map
Euclid::Configuration
SourceXtractor
Definition
Aperture.h:30
SourceXtractor::CORE_MINAREA
static const std::string CORE_MINAREA
Definition
CoreThresholdPartitionConfig.cpp:39
SourceXtractor::CORE_THRESH_USE
static const std::string CORE_THRESH_USE
Definition
CoreThresholdPartitionConfig.cpp:40
SourceXtractor::CORE_THRESHOLD
static const std::string CORE_THRESHOLD
Definition
CoreThresholdPartitionConfig.cpp:38
Generated by
1.10.0