18 #include <boost/filesystem.hpp>
32 MeasurementFrameConfig::MeasurementFrameConfig(
long manager_id) :
Configuration(manager_id) {
33 declareDependency<MeasurementImageConfig>();
34 declareDependency<BackgroundAnalyzerFactory>();
38 const auto& image_infos = getDependency<MeasurementImageConfig>().getImageInfos();
39 const auto& background_analyzer_factory = getDependency<BackgroundAnalyzerFactory>();
41 for (
auto& image_info : image_infos) {
42 auto measurement_frame = std::make_shared<MeasurementImageFrame>(
43 image_info.m_measurement_image,
44 image_info.m_weight_image,
45 image_info.m_weight_threshold,
46 image_info.m_coordinate_system,
48 image_info.m_saturation_level,
51 auto background_analyzer = background_analyzer_factory.createBackgroundAnalyzer(image_info.m_weight_type);
52 auto background_model = background_analyzer->analyzeBackground(
53 image_info.m_measurement_image,
54 image_info.m_weight_image,
56 image_info.m_measurement_image->getHeight(),
false),
57 measurement_frame->getVarianceThreshold());
59 if (image_info.m_is_background_constant) {
60 measurement_frame->setBackgroundLevel(image_info.m_constant_background_value);
62 measurement_frame->setBackgroundLevel(background_model.getLevelMap(), background_model.getMedianRms());
66 label << boost::filesystem::basename(image_info.m_path) <<
"_" << image_info.m_image_hdu;
67 measurement_frame->setLabel(label.
str());
69 if (image_info.m_weight_image !=
nullptr) {
70 if (image_info.m_absolute_weight) {
71 measurement_frame->setVarianceMap(image_info.m_weight_image);
74 image_info.m_weight_image,
75 background_model.getScalingFactor());
76 measurement_frame->setVarianceMap(scaled_image);
79 measurement_frame->setVarianceMap(background_model.getVarianceMap());