SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEImplementation
src
lib
Configuration
MeasurementFrameConfig.cpp
Go to the documentation of this file.
1
18
#include <boost/filesystem.hpp>
19
20
#include "
SEFramework/Image/ConstantImage.h
"
21
#include "
SEFramework/Image/ProcessedImage.h
"
22
23
#include "
SEImplementation/Background/BackgroundAnalyzerFactory.h
"
24
#include "
SEImplementation/Configuration/MeasurementImageConfig.h
"
25
#include "
SEImplementation/CheckImages/CheckImages.h
"
26
27
#include "
SEImplementation/Configuration/MeasurementFrameConfig.h
"
28
29
using namespace
Euclid::Configuration
;
30
31
namespace
SourceXtractor
{
32
33
MeasurementFrameConfig::MeasurementFrameConfig
(
long
manager_id
) :
Configuration
(
manager_id
) {
34
declareDependency<MeasurementImageConfig>
();
35
declareDependency<BackgroundAnalyzerFactory>
();
36
}
37
38
void
MeasurementFrameConfig::initialize
(
const
UserValues
&) {
39
const
auto
&
image_infos
=
getDependency<MeasurementImageConfig>
().getImageInfos();
40
const
auto
&
background_analyzer_factory
=
getDependency<BackgroundAnalyzerFactory>
();
41
42
for
(
auto
&
image_info
:
image_infos
) {
43
auto
measurement_frame
=
std::make_shared<MeasurementImageFrame>
(
44
image_info
.m_measurement_image,
45
image_info
.m_weight_image,
46
image_info
.m_weight_threshold,
47
image_info
.m_coordinate_system,
48
image_info
.m_gain,
49
image_info
.m_saturation_level,
50
false
);
51
52
auto
background_analyzer
=
background_analyzer_factory
.createBackgroundAnalyzer(
image_info
.m_weight_type);
53
auto
background_model
=
background_analyzer
->analyzeBackground(
54
image_info
.m_measurement_image,
55
image_info
.m_weight_image,
56
ConstantImage<unsigned char>::create
(
image_info
.m_measurement_image->getWidth(),
57
image_info
.m_measurement_image->getHeight(),
false
),
58
measurement_frame
->getVarianceThreshold());
59
60
if
(
image_info
.m_is_background_constant) {
61
measurement_frame
->setBackgroundLevel(
image_info
.m_constant_background_value);
62
}
else
{
63
measurement_frame
->setBackgroundLevel(
background_model
.getLevelMap(),
background_model
.getMedianRms());
64
}
65
66
std::stringstream
label
;
67
label
<< boost::filesystem::basename(
image_info
.m_path) <<
"_"
<<
image_info
.m_image_hdu;
68
measurement_frame
->setLabel(
label
.str());
69
70
if
(
image_info
.m_weight_image !=
nullptr
) {
71
if
(
image_info
.m_absolute_weight) {
72
measurement_frame
->setVarianceMap(
image_info
.m_weight_image);
73
}
else
{
74
auto
scaled_image
=
MultiplyImage<SeFloat>::create
(
75
image_info
.m_weight_image,
76
background_model
.getScalingFactor());
77
measurement_frame
->setVarianceMap(
scaled_image
);
78
if
(
image_info
.m_weight_threshold <
std::numeric_limits<WeightImage::PixelType>::max
())
79
measurement_frame
->setVarianceThreshold(
image_info
.m_weight_threshold*
background_model
.getScalingFactor());
80
}
81
}
else
{
82
measurement_frame
->setVarianceMap(
background_model
.getVarianceMap());
83
}
84
85
m_measurement_frames
[
image_info
.m_id] =
measurement_frame
;
86
87
CheckImages::getInstance
().addMeasurementBackgroundCheckImage(
image_info
.m_id,
measurement_frame
->getBackgroundLevelMap());
88
CheckImages::getInstance
().addMeasurementVarianceCheckImage(
image_info
.m_id,
measurement_frame
->getImage(
FrameImageLayer::LayerVarianceMap
));
89
}
90
91
}
92
93
}
94
BackgroundAnalyzerFactory.h
CheckImages.h
ConstantImage.h
MeasurementFrameConfig.h
MeasurementImageConfig.h
ProcessedImage.h
std::stringstream
Euclid::Configuration::Configuration
SourceXtractor::CheckImages::getInstance
static CheckImages & getInstance()
Definition
CheckImages.h:158
SourceXtractor::ConstantImage
Definition
ConstantImage.h:33
SourceXtractor::MeasurementFrameConfig::m_measurement_frames
std::map< int, std::shared_ptr< MeasurementImageFrame > > m_measurement_frames
Definition
MeasurementFrameConfig.h:43
SourceXtractor::MeasurementFrameConfig::MeasurementFrameConfig
MeasurementFrameConfig(long manager_id)
Definition
MeasurementFrameConfig.cpp:33
SourceXtractor::MeasurementFrameConfig::initialize
void initialize(const UserValues &args) override
Definition
MeasurementFrameConfig.cpp:38
std::function
std::map
Euclid::Configuration
SourceXtractor
Definition
Aperture.h:30
SourceXtractor::LayerVarianceMap
@ LayerVarianceMap
Definition
Frame.h:45
std::numeric_limits
Generated by
1.10.0