SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
Frame.h
Go to the documentation of this file.
1
17/*
18 * Frame.h
19 *
20 * Created on: Mar 13, 2017
21 * Author: mschefer
22 */
23
24#ifndef _SEFRAMEWORK_FRAME_FRAME_H_
25#define _SEFRAMEWORK_FRAME_FRAME_H_
26
27#include <algorithm>
28
29#include "SEUtils/Types.h"
33
34namespace SourceXtractor {
35
48
49template<typename T>
50class Frame {
51
52public:
53
55 public:
56 virtual ~ImageFilter() = default;
57 virtual std::shared_ptr<Image<T>> processImage(std::shared_ptr<Image<T>> image, std::shared_ptr<Image<T>> variance, T threshold) const = 0;
58 };
59
60 Frame(std::shared_ptr<Image<T>> detection_image,
62 WeightImage::PixelType variance_threshold,
63 std::shared_ptr<CoordinateSystem> coordinate_system,
64 SeFloat gain, SeFloat saturation, int interpolation_gap);
65
66 // FIXME: this simplified version is used in unit tests, get rid of it
67 explicit Frame(std::shared_ptr<Image<T>> detection_image,
68 std::shared_ptr<CoordinateSystem> coordinate_system = nullptr,
69 std::shared_ptr<WeightImage> variance_map = nullptr);
70
71 //
72 // Methods to get the image in one form or another
73 //
74
76
77
78 // Just the original image
82
83 size_t getHduIndex() const {
84 return m_hdu_index;
85 }
86
87 void setHduIndex(size_t hdu_index) {
88 m_hdu_index = hdu_index;
89 }
90
91 // Metadata of the original image
95
97 m_metadata = metadata;
98 };
99
100 // Returns the image with bad pixels interpolated (if interpolation is active, otherwise returns original)
102
103 // Get the image with the background subtracted
105
106 // Get the image with a filter applied to the subtracted image
108
109 // Get the filtered image with the detection threshold subtracted from it
111
112 // Get the SNR image
114
115 //
116 // Methods to get the image in one form or another
117 //
118
120
122
126
127 //
128 // Methods to get frame metadata
129 //
130
134
138
139 SeFloat getGain() const {
140 return m_gain;
141 }
142
144 return m_saturation;
145 }
146
150
152
154 return m_label;
155 }
156
157 //
158 // Setters
159 //
160
162
164
166
167 void setDetectionThreshold(T detection_threshold);
168
169 void setBackgroundLevel(T background_level);
170
171 void setBackgroundLevel(std::shared_ptr<Image<T>> background_level_map, T background_rms);
172
174
175 void setLabel(const std::string &label);
176
177private:
178
181
185
187
191
194
195 int m_interpolation_gap; // max interpolation gap, 0 == no interpolation
196
202
204 size_t m_hdu_index = 0;
206};
207
210
211}
212
213#endif /* _SEFRAMEWORK_FRAME_FRAME_H_ */
virtual std::shared_ptr< Image< T > > processImage(std::shared_ptr< Image< T > > image, std::shared_ptr< Image< T > > variance, T threshold) const =0
std::shared_ptr< Image< T > > getSnrImage() const
Definition Frame.cpp:141
void setBackgroundLevel(T background_level)
Definition Frame.cpp:230
const std::map< std::string, MetadataEntry > & getMetadata() const
Definition Frame.h:92
void applyInterpolation()
Definition Frame.cpp:282
std::shared_ptr< CoordinateSystem > getCoordinateSystem() const
Definition Frame.h:131
std::shared_ptr< Image< T > > getDetectionThresholdMap() const
Definition Frame.cpp:164
void setFilter(std::shared_ptr< ImageFilter > filter)
Definition Frame.cpp:247
std::shared_ptr< WeightImage > m_variance_map
Definition Frame.h:183
std::shared_ptr< Image< DetectionImage::PixelType > > m_interpolated_image
Definition Frame.h:198
std::shared_ptr< Image< T > > getImage(FrameImageLayer layer) const
Definition Frame.cpp:74
SeFloat getGain() const
Definition Frame.h:139
void setBackgroundLevel(std::shared_ptr< Image< T > > background_level_map, T background_rms)
Definition Frame.cpp:236
std::shared_ptr< Image< DetectionImage::PixelType > > m_background_level_map
Definition Frame.h:184
size_t getHduIndex() const
Definition Frame.h:83
void setDetectionThreshold(T detection_threshold)
Definition Frame.cpp:224
void setLabel(const std::string &label)
Definition Frame.cpp:256
std::shared_ptr< ImageFilter > m_filter
Definition Frame.h:197
void setVarianceMap(std::shared_ptr< WeightImage > variance_map)
Definition Frame.cpp:175
std::shared_ptr< Image< T > > getBackgroundLevelMap() const
Definition Frame.cpp:212
std::shared_ptr< Image< DetectionImage::PixelType > > m_filtered_variance_map
Definition Frame.h:201
std::shared_ptr< WeightImage > getOriginalVarianceMap() const
Definition Frame.h:123
std::shared_ptr< Image< WeightImage::PixelType > > m_interpolated_variance
Definition Frame.h:199
WeightImage::PixelType getVarianceThreshold() const
Definition Frame.h:135
Frame(std::shared_ptr< Image< T > > detection_image, std::shared_ptr< WeightImage > variance_map, WeightImage::PixelType variance_threshold, std::shared_ptr< CoordinateSystem > coordinate_system, SeFloat gain, SeFloat saturation, int interpolation_gap)
Definition Frame.cpp:31
std::shared_ptr< CoordinateSystem > m_coordinate_system
Definition Frame.h:186
std::shared_ptr< Image< T > > getInterpolatedImage() const
Definition Frame.cpp:112
std::shared_ptr< WeightImage > getUnfilteredVarianceMap() const
Definition Frame.cpp:153
std::string getLabel() const
Definition Frame.h:153
SeFloat getBackgroundMedianRms() const
Definition Frame.h:147
std::map< std::string, MetadataEntry > m_metadata
Definition Frame.h:205
void setHduIndex(size_t hdu_index)
Definition Frame.h:87
Frame(std::shared_ptr< Image< T > > detection_image, std::shared_ptr< CoordinateSystem > coordinate_system=nullptr, std::shared_ptr< WeightImage > variance_map=nullptr)
Definition Frame.cpp:52
std::shared_ptr< Image< T > > getOriginalImage() const
Definition Frame.h:79
std::shared_ptr< Image< DetectionImage::PixelType > > m_filtered_image
Definition Frame.h:200
void setMetadata(const std::map< std::string, MetadataEntry > &metadata)
Definition Frame.h:96
DetectionImage::PixelType m_detection_threshold
Definition Frame.h:192
std::shared_ptr< Image< T > > getThresholdedImage() const
Definition Frame.cpp:135
std::shared_ptr< Image< T > > getFilteredImage() const
Definition Frame.cpp:129
SeFloat getSaturation() const
Definition Frame.h:143
std::shared_ptr< Image< T > > getSubtractedImage() const
Definition Frame.cpp:123
std::shared_ptr< WeightImage > getVarianceMap() const
Definition Frame.cpp:147
std::shared_ptr< Image< DetectionImage::PixelType > > m_image
Definition Frame.h:182
void setVarianceThreshold(WeightImage::PixelType threshold)
Definition Frame.cpp:190
Interface representing an image.
Definition Image.h:44
@ LayerVarianceMap
Definition Frame.h:45
@ LayerFilteredImage
Definition Frame.h:40
@ LayerOriginalImage
Definition Frame.h:37
@ LayerDetectionThresholdMap
Definition Frame.h:46
@ LayerUnfilteredVarianceMap
Definition Frame.h:44
@ LayerThresholdedImage
Definition Frame.h:41
@ LayerInterpolatedImage
Definition Frame.h:38
@ LayerOriginalVarianceMap
Definition Frame.h:43
@ LayerSubtractedImage
Definition Frame.h:39
@ LayerSignalToNoiseMap
Definition Frame.h:42
SeFloat32 SeFloat
Definition Types.h:32
Frame< DetectionImage::PixelType > DetectionImageFrame
Definition Frame.h:208
Frame< MeasurementImage::PixelType > MeasurementImageFrame
Definition Frame.h:209