SourceXtractorPlusPlus  0.16
Please provide a description of the project.
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"
32 
33 namespace SourceXtractor {
34 
46 };
47 
48 template<typename T>
49 class Frame {
50 
51 public:
52 
53  class ImageFilter {
54  public:
55  virtual ~ImageFilter() = default;
56  virtual std::shared_ptr<Image<T>> processImage(std::shared_ptr<Image<T>> image, std::shared_ptr<Image<T>> variance, T threshold) const = 0;
57  };
58 
59  Frame(std::shared_ptr<Image<T>> detection_image,
60  std::shared_ptr<WeightImage> variance_map,
61  WeightImage::PixelType variance_threshold,
62  std::shared_ptr<CoordinateSystem> coordinate_system,
63  SeFloat gain, SeFloat saturation, int interpolation_gap);
64 
65  // FIXME: this simplified version is used in unit tests, get rid of it
66  explicit Frame(std::shared_ptr<Image<T>> detection_image,
67  std::shared_ptr<CoordinateSystem> coordinate_system = nullptr,
68  std::shared_ptr<WeightImage> variance_map = nullptr);
69 
70  //
71  // Methods to get the image in one form or another
72  //
73 
75 
76 
77  // Just the original image
79  return m_image;
80  }
81 
82  // Returns the image with bad pixels interpolated (if interpolation is active, otherwise returns original)
84 
85  // Get the image with the background subtracted
87 
88  // Get the image with a filter applied to the subtracted image
90 
91  // Get the filtered image with the detection threshold subtracted from it
93 
94  // Get the SNR image
96 
97  //
98  // Methods to get the image in one form or another
99  //
100 
102 
104 
106  return m_variance_map;
107  }
108 
109  //
110  // Methods to get frame metadata
111  //
112 
114  return m_coordinate_system;
115  }
116 
118  return m_variance_threshold;
119  }
120 
121  SeFloat getGain() const {
122  return m_gain;
123  }
124 
126  return m_saturation;
127  }
128 
130  return m_background_rms;
131  }
132 
134 
136  return m_label;
137  }
138 
139  //
140  // Setters
141  //
142 
143  void setVarianceMap(std::shared_ptr<WeightImage> variance_map);
144 
146 
148 
149  void setDetectionThreshold(T detection_threshold);
150 
151  void setBackgroundLevel(T background_level);
152 
153  void setBackgroundLevel(std::shared_ptr<Image<T>> background_level_map, T background_rms);
154 
156 
157  void setLabel(const std::string &label);
158 
159 private:
160 
161  void applyFilter();
162  void applyInterpolation();
163 
167 
169 
173 
176 
177  int m_interpolation_gap; // max interpolation gap, 0 == no interpolation
178 
184 
186 };
187 
190 
191 }
192 
193 #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:223
void applyInterpolation()
Definition: Frame.cpp:275
std::shared_ptr< Image< T > > getDetectionThresholdMap() const
Definition: Frame.cpp:164
void setFilter(std::shared_ptr< ImageFilter > filter)
Definition: Frame.cpp:240
std::shared_ptr< CoordinateSystem > getCoordinateSystem() const
Definition: Frame.h:113
std::shared_ptr< WeightImage > m_variance_map
Definition: Frame.h:165
std::string m_label
Definition: Frame.h:185
SeFloat m_background_rms
Definition: Frame.h:172
std::shared_ptr< Image< T > > m_interpolated_image
Definition: Frame.h:180
std::shared_ptr< Image< T > > getImage(FrameImageLayer layer) const
Definition: Frame.cpp:74
SeFloat getGain() const
Definition: Frame.h:121
std::shared_ptr< Image< T > > m_background_level_map
Definition: Frame.h:166
std::shared_ptr< WeightImage > getOriginalVarianceMap() const
Definition: Frame.h:105
std::shared_ptr< Image< T > > getOriginalImage() const
Definition: Frame.h:78
void setDetectionThreshold(T detection_threshold)
Definition: Frame.cpp:217
void setLabel(const std::string &label)
Definition: Frame.cpp:249
std::shared_ptr< ImageFilter > m_filter
Definition: Frame.h:179
void setVarianceMap(std::shared_ptr< WeightImage > variance_map)
Definition: Frame.cpp:175
std::shared_ptr< Image< T > > getBackgroundLevelMap() const
Definition: Frame.cpp:205
std::shared_ptr< Image< T > > m_filtered_variance_map
Definition: Frame.h:183
WeightImage::PixelType m_variance_threshold
Definition: Frame.h:175
std::shared_ptr< Image< WeightImage::PixelType > > m_interpolated_variance
Definition: Frame.h:181
WeightImage::PixelType getVarianceThreshold() const
Definition: Frame.h:117
std::shared_ptr< CoordinateSystem > m_coordinate_system
Definition: Frame.h:168
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:135
SeFloat getBackgroundMedianRms() const
Definition: Frame.h:129
SeFloat m_saturation
Definition: Frame.h:171
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< Image< T > > m_filtered_image
Definition: Frame.h:182
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:125
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< T > > m_image
Definition: Frame.h:164
void setVarianceThreshold(WeightImage::PixelType threshold)
Definition: Frame.cpp:190
Interface representing an image.
Definition: Image.h:43
SeFloat32 SeFloat
Definition: Types.h:32
@ LayerVarianceMap
Definition: Frame.h:44
@ LayerFilteredImage
Definition: Frame.h:39
@ LayerOriginalImage
Definition: Frame.h:36
@ LayerDetectionThresholdMap
Definition: Frame.h:45
@ LayerUnfilteredVarianceMap
Definition: Frame.h:43
@ LayerThresholdedImage
Definition: Frame.h:40
@ LayerInterpolatedImage
Definition: Frame.h:37
@ LayerOriginalVarianceMap
Definition: Frame.h:42
@ LayerSubtractedImage
Definition: Frame.h:38
@ LayerSignalToNoiseMap
Definition: Frame.h:41