SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
src
lib
Configuration
SE2BackgroundConfig.cpp
Go to the documentation of this file.
1
17
/*
18
* @file BackgroundConfig.cpp
19
* @author nikoapos
20
*/
21
22
#include <algorithm>
23
#include <ElementsKernel/Logging.h>
24
#include "AlexandriaKernel/StringUtils.h"
25
#include "
SEFramework/Image/ProcessedImage.h
"
26
#include "
SEImplementation/Configuration/SE2BackgroundConfig.h
"
27
28
using namespace
Euclid::Configuration
;
29
namespace
po = boost::program_options;
30
31
namespace
SourceXtractor
{
32
33
static
Elements::Logging
logger
=
Elements::Logging::getLogger
(
"BackgroundConfig"
);
34
35
static
const
std::string
CELLSIZE_VALUE
{
"background-cell-size"
};
36
static
const
std::string
SMOOTHINGBOX_VALUE
{
"smoothing-box-size"
};
37
38
SE2BackgroundConfig::SE2BackgroundConfig
(
long
manager_id
) :
39
Configuration
(
manager_id
), m_cell_size(), m_smoothing_box() {
40
}
41
42
std::map<std::string, Configuration::OptionDescriptionList>
SE2BackgroundConfig::getProgramOptions
() {
43
return
{ {
"Background modelling"
, {
44
{
CELLSIZE_VALUE
.c_str(), po::value<std::string>()->default_value(
std::string
(
"64"
)),
45
"Background mesh cell size to determine a value."
},
46
{
SMOOTHINGBOX_VALUE
.c_str(), po::value<std::string>()->default_value(
std::string
(
"3"
)),
47
"Background median filter size"
}
48
}}};
49
}
50
51
void
SE2BackgroundConfig::initialize
(
const
UserValues
&
args
) {
52
auto
cell_size_str
=
args
.find(
CELLSIZE_VALUE
)->second.as<
std::string
>();
53
auto
smoothing_box_str
=
args
.find(
SMOOTHINGBOX_VALUE
)->second.as<
std::string
>();
54
55
if
(
args
.find(
CELLSIZE_VALUE
) !=
args
.end()) {
56
m_cell_size
= Euclid::stringToVector<int>(
cell_size_str
);
57
}
58
if
(
args
.find(
SMOOTHINGBOX_VALUE
) !=
args
.end()) {
59
m_smoothing_box
= Euclid::stringToVector<int>(
smoothing_box_str
);
60
}
61
62
auto
less_eq_0
= [](
int
v
) {
return
v
<= 0; };
63
auto
less_0
= [](
int
v
) {
return
v
< 0; };
64
65
if
(
std::find_if
(
m_cell_size
.
begin
(),
m_cell_size
.
end
(),
less_eq_0
) !=
m_cell_size
.
end
()) {
66
throw
Elements::Exception
() <<
"There are value(s) < 1 in backgound-cell-size: "
<<
cell_size_str
;
67
}
68
if
(
std::find_if
(
m_smoothing_box
.
begin
(),
m_smoothing_box
.
end
(),
less_0
) !=
m_smoothing_box
.
end
()) {
69
throw
Elements::Exception
() <<
"There are value(s) < 0 in smoothing-box-size: "
<<
smoothing_box_str
;
70
}
71
}
72
73
}
// SourceXtractor namespace
ProcessedImage.h
SE2BackgroundConfig.h
std::string
std::vector::begin
T begin(T... args)
Elements::Exception
Elements::Logging
Elements::Logging::getLogger
static Logging getLogger(const std::string &name="")
Euclid::Configuration::Configuration
SourceXtractor::SE2BackgroundConfig::initialize
void initialize(const UserValues &args) override
Definition
SE2BackgroundConfig.cpp:51
SourceXtractor::SE2BackgroundConfig::m_smoothing_box
std::vector< int > m_smoothing_box
Definition
SE2BackgroundConfig.h:52
SourceXtractor::SE2BackgroundConfig::m_cell_size
std::vector< int > m_cell_size
Definition
SE2BackgroundConfig.h:51
SourceXtractor::SE2BackgroundConfig::getProgramOptions
std::map< std::string, Configuration::OptionDescriptionList > getProgramOptions() override
Definition
SE2BackgroundConfig.cpp:42
SourceXtractor::SE2BackgroundConfig::SE2BackgroundConfig
SE2BackgroundConfig(long manager_id)
Definition
SE2BackgroundConfig.cpp:38
std::vector::end
T end(T... args)
std::find_if
T find_if(T... args)
std::function
std::map
Euclid::Configuration
Euclid::Configuration::logger
static Elements::Logging logger
SourceXtractor
Definition
Aperture.h:30
SourceXtractor::CELLSIZE_VALUE
static const std::string CELLSIZE_VALUE
Definition
SE2BackgroundConfig.cpp:35
SourceXtractor::SMOOTHINGBOX_VALUE
static const std::string SMOOTHINGBOX_VALUE
Definition
SE2BackgroundConfig.cpp:36
Generated by
1.10.0