24#include <boost/regex.hpp>
26using boost::regex_match;
38namespace po = boost::program_options;
53 return { {
"Detection image", {
55 "Path to a fits format image to be used as detection image."},
57 "Detection image gain in e-/ADU (0 = infinite gain)"},
59 "Detection image flux scale"},
61 "Detection image saturation level (0 = no saturation)"},
63 "Interpolate bad pixels in detection image"},
65 "Maximum number if pixels to interpolate over"}
79 boost::regex hdu_regex(
".*\\[[0-9]*\\]$");
111 double detection_image_gain = 0, detection_image_saturate = 0;
112 auto img_metadata = fits_image_source->getMetadata();
114 if (img_metadata.count(
"GAIN")){
116 if (
double* double_gain = boost::get<double>(&img_metadata.at(
"GAIN").m_value)){
117 detection_image_gain = *double_gain;
118 }
else if (
int64_t *int64_gain = boost::get<int64_t>(&img_metadata.at(
"GAIN").m_value)){
119 detection_image_gain = (double) *int64_gain;
126 if (img_metadata.count(
"SATURATE")){
128 if (
double* double_saturate = boost::get<double>(&img_metadata.at(
"SATURATE").m_value)){
129 detection_image_saturate = *double_saturate;
130 }
else if (
int64_t *int64_saturate = boost::get<int64_t>(&img_metadata.at(
"SATURATE").m_value)){
131 detection_image_saturate = (double) *int64_saturate;
141 else if (img_metadata.count(
"FLXSCALE")) {
143 if (
double* f_scale = boost::get<double>(&img_metadata.at(
"FLXSCALE").m_value)){
145 }
else if (
int64_t *int64_f_scale = boost::get<int64_t>(&img_metadata.at(
"FLXSCALE").m_value)){
157 extension.
m_gain = detection_image_gain;
188 throw Elements::Exception() <<
"getDetectionImage() call on not initialized DetectionImageConfig";
195 throw Elements::Exception() <<
"getCoordinateSystem() call on not initialized DetectionImageConfig";
State & getCurrentState()