SourceXtractorPlusPlus
1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
src
lib
Plugin
Vignet
VignetConfig.cpp
Go to the documentation of this file.
1
17
/*
18
* @file VignetConfig.cpp
19
* @author mkuemmel
20
*/
21
22
#include <AlexandriaKernel/StringUtils.h>
23
#include "
SEFramework/Image/ProcessedImage.h
"
24
#include "
SEImplementation/Plugin/Vignet/VignetConfig.h
"
25
26
using namespace
Euclid::Configuration
;
27
namespace
po
=
boost::program_options
;
28
29
namespace
SourceXtractor
{
30
31
static
const
std::string
VIGNET_SIZE
{
"vignet-size"
};
32
static
const
std::string
VIGNET_DEFAULT_PIXVAL
{
"vignet-default-pixval"
};
33
34
VignetConfig::VignetConfig
(
long
manager_id) :
35
Configuration
(manager_id),
36
m_vignet_size
(),
37
m_vignet_default_pixval
() {
38
}
39
40
std::map<std::string, Configuration::OptionDescriptionList>
VignetConfig::getProgramOptions
() {
41
return
{ {
"Vignet output"
, {
42
{
VIGNET_SIZE
.c_str(), po::value<std::string>()->default_value(
std::string
(
"15,15"
)),
43
"X- and Y-size of the vignet."
},
44
{
VIGNET_DEFAULT_PIXVAL
.c_str(), po::value<double>()->default_value(
std::nan
(
""
)),
//Note: the SE2 value is "1.0E30", but nan is more consistent
45
"Default pixel value for the vignet data"
},
46
}}};
47
}
48
49
void
VignetConfig::initialize
(
const
UserValues
& args) {
50
auto
vignet_iter = args.
find
(
VIGNET_SIZE
);
51
if
(vignet_iter != args.
end
()) {
52
auto
vignet_str = vignet_iter->second.as<
std::string
>();
53
auto
vignet_vector =
Euclid::stringToVector<int>
(vignet_str);
54
if
(vignet_vector.
size
() > 2) {
55
throw
Elements::Exception
() <<
VIGNET_SIZE
<<
" only accepts one or two numbers"
;
56
}
57
m_vignet_size
[0] = vignet_vector.
front
();
58
m_vignet_size
[1] = vignet_vector.
back
();
59
if
(
m_vignet_size
[0] < 0 ||
m_vignet_size
[1] < 0) {
60
throw
Elements::Exception
() <<
VIGNET_SIZE
<<
" only accept positive numbers"
;
61
}
62
}
63
if
(args.
find
(
VIGNET_DEFAULT_PIXVAL
) != args.
end
()) {
64
m_vignet_default_pixval
= args.
find
(
VIGNET_DEFAULT_PIXVAL
)->second.as<
double
>();
65
}
66
}
67
68
}
// SourceXtractor namespace
ProcessedImage.h
VignetConfig.h
std::string::back
T back(T... args)
std::string
Elements::Exception
Euclid::Configuration::Configuration::Configuration
Configuration(long manager_id)
Euclid::Configuration::Configuration::UserValues
std::map< std::string, boost::program_options::variable_value > UserValues
SourceXtractor::VignetConfig::VignetConfig
VignetConfig(long manager_id)
Definition
VignetConfig.cpp:34
SourceXtractor::VignetConfig::m_vignet_size
std::array< int, 2 > m_vignet_size
Definition
VignetConfig.h:51
SourceXtractor::VignetConfig::getProgramOptions
std::map< std::string, Configuration::OptionDescriptionList > getProgramOptions() override
Definition
VignetConfig.cpp:40
SourceXtractor::VignetConfig::initialize
void initialize(const UserValues &args) override
Definition
VignetConfig.cpp:49
SourceXtractor::VignetConfig::m_vignet_default_pixval
double m_vignet_default_pixval
Definition
VignetConfig.h:52
std::map::end
T end(T... args)
std::map::find
T find(T... args)
std::string::front
T front(T... args)
std::map
Euclid::Configuration
Euclid::stringToVector
std::vector< T > stringToVector(std::string str, const std::string &separators=std::string(", "))
SourceXtractor
Definition
Aperture.h:30
SourceXtractor::VIGNET_SIZE
static const std::string VIGNET_SIZE
Definition
VignetConfig.cpp:31
SourceXtractor::VIGNET_DEFAULT_PIXVAL
static const std::string VIGNET_DEFAULT_PIXVAL
Definition
VignetConfig.cpp:32
boost::program_options
std::nan
T nan(T... args)
std::string::size
T size(T... args)
Generated by
1.15.0