SourceXtractorPlusPlus 0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
MeasurementFrameConfig.cpp
Go to the documentation of this file.
1
18#include <boost/filesystem.hpp>
19
22
26
28
29using namespace Euclid::Configuration;
30
31namespace SourceXtractor {
32
37
39 const auto& image_infos = getDependency<MeasurementImageConfig>().getImageInfos();
41
42 for (auto& image_info : image_infos) {
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
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 {
75 image_info.m_weight_image,
76 background_model.getScalingFactor());
77 measurement_frame->setVarianceMap(scaled_image);
79 measurement_frame->setVarianceThreshold(image_info.m_weight_threshold*background_model.getScalingFactor());
80 }
81 } else {
82 measurement_frame->setVarianceMap(background_model.getVarianceMap());
83 }
84
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
static CheckImages & getInstance()
std::map< int, std::shared_ptr< MeasurementImageFrame > > m_measurement_frames
void initialize(const UserValues &args) override
@ LayerVarianceMap
Definition Frame.h:45