SourceXtractorPlusPlus  0.10
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 
35 template<typename T>
36 class Frame {
37 
38 public:
39  class ImageFilter {
40  public:
41  virtual ~ImageFilter() = default;
42  virtual std::shared_ptr<Image<T>> processImage(std::shared_ptr<Image<T>> image, std::shared_ptr<Image<T>> variance, T threshold) const = 0;
43  };
44 
45  Frame(std::shared_ptr<Image<T>> detection_image,
46  std::shared_ptr<WeightImage> variance_map,
47  WeightImage::PixelType variance_threshold,
48  std::shared_ptr<CoordinateSystem> coordinate_system,
49  SeFloat gain, SeFloat saturation, int interpolation_gap);
50 
51  // FIXME: this simplified version is used in unit tests, get rid of it
52  Frame(std::shared_ptr<Image<T>> detection_image,
53  std::shared_ptr<CoordinateSystem> coordinate_system = nullptr,
54  std::shared_ptr<WeightImage> variance_map = nullptr);
55 
56  //
57  // Methods to get the image in one form or another
58  //
59 
60  // Just the original image
62  return m_image;
63  }
64 
65  // Returns the image with bad pixels interpolated (if interpolation is active, otherwise returns original)
67 
68  // Get the image with the background subtracted
70 
71  // Get the image with a filter applied to the subtracted image
73 
74  // Get the filtered image with the detection threshold subtracted from it
76 
77  // Get the SNR image
79 
80  //
81  // Methods to get the image in one form or another
82  //
83 
85 
87 
89  return m_variance_map;
90  }
91 
92  //
93  // Methods to get frame metadata
94  //
95 
97  return m_coordinate_system;
98  }
99 
101  return m_variance_threshold;
102  }
103 
104  SeFloat getGain() const {
105  return m_gain;
106  }
107 
109  return m_saturation;
110  }
111 
113  // FIXME using the 0,0 pixel makes no sense
114  return sqrt(m_variance_map->getValue(0,0)) * m_detection_threshold;
115  }
116 
118 
120  return m_label;
121  }
122 
123  //
124  // Setters
125  //
126 
127  void setVarianceMap(std::shared_ptr<WeightImage> variance_map);
128 
130 
132 
133  void setDetectionThreshold(T detection_threshold);
134 
135  void setBackgroundLevel(T background_level);
136 
137  void setBackgroundLevel(std::shared_ptr<Image<T>> background_level_map);
138 
140 
141  void setLabel(const std::string &label);
142 
143 private:
144 
145  void applyFilter();
146 
150 
152 
155 
158 
159  int m_interpolation_gap; // max interpolation gap, 0 == no interpolation
160 
166 
168 };
169 
172 
173 }
174 
175 #endif /* _SEFRAMEWORK_FRAME_FRAME_H_ */
SourceXtractor::Frame::m_image
std::shared_ptr< Image< T > > m_image
Definition: Frame.h:147
SourceXtractor::Frame::getSubtractedImage
std::shared_ptr< Image< T > > getSubtractedImage() const
Definition: Frame.cpp:84
std::string
STL class.
SourceXtractor::Frame::getVarianceMap
std::shared_ptr< WeightImage > getVarianceMap() const
Definition: Frame.cpp:111
std::shared_ptr
STL class.
SourceXtractor::Frame::getSnrImage
std::shared_ptr< Image< T > > getSnrImage() const
Definition: Frame.cpp:105
SourceXtractor::Frame::getFilteredImage
std::shared_ptr< Image< T > > getFilteredImage() const
Definition: Frame.cpp:90
SourceXtractor::Frame::ImageFilter::processImage
virtual std::shared_ptr< Image< T > > processImage(std::shared_ptr< Image< T >> image, std::shared_ptr< Image< T >> variance, T threshold) const =0
SourceXtractor::Frame::m_saturation
SeFloat m_saturation
Definition: Frame.h:154
SourceXtractor::Frame
Definition: Frame.h:36
SourceXtractor::Frame::getLabel
std::string getLabel() const
Definition: Frame.h:119
SourceXtractor::Image::PixelType
T PixelType
Definition: Image.h:47
Types.h
SourceXtractor::SeFloat
SeFloat32 SeFloat
Definition: Types.h:32
SourceXtractor::Frame::getVarianceThreshold
WeightImage::PixelType getVarianceThreshold() const
Definition: Frame.h:100
SourceXtractor::Frame::getInterpolatedImage
std::shared_ptr< Image< T > > getInterpolatedImage() const
Definition: Frame.cpp:67
SourceXtractor::Frame::m_filtered_image
std::shared_ptr< Image< T > > m_filtered_image
Definition: Frame.h:164
SourceXtractor::Frame::ImageFilter
Definition: Frame.h:39
SourceXtractor::Frame::getOriginalImage
std::shared_ptr< Image< T > > getOriginalImage() const
Definition: Frame.h:61
SourceXtractor::Image
Interface representing an image.
Definition: Image.h:43
SourceXtractor::Frame::m_interpolated_variance
std::shared_ptr< Image< WeightImage::PixelType > > m_interpolated_variance
Definition: Frame.h:163
CoordinateSystem.h
std::sqrt
T sqrt(T... args)
SourceXtractor::Frame::m_background_level_map
std::shared_ptr< Image< T > > m_background_level_map
Definition: Frame.h:149
SourceXtractor::Frame::m_label
std::string m_label
Definition: Frame.h:167
SourceXtractor
Definition: Aperture.h:30
SourceXtractor::Frame::getBackgroundLevelMap
std::shared_ptr< Image< T > > getBackgroundLevelMap() const
Definition: Frame.cpp:170
SourceXtractor::Frame::m_detection_threshold
T m_detection_threshold
Definition: Frame.h:156
SourceXtractor::Frame::m_interpolated_image
std::shared_ptr< Image< T > > m_interpolated_image
Definition: Frame.h:162
SourceXtractor::Frame::m_variance_map
std::shared_ptr< WeightImage > m_variance_map
Definition: Frame.h:148
SourceXtractor::Frame::m_filter
std::shared_ptr< ImageFilter > m_filter
Definition: Frame.h:161
SourceXtractor::Frame::getGain
SeFloat getGain() const
Definition: Frame.h:104
SourceXtractor::Frame::getCoordinateSystem
std::shared_ptr< CoordinateSystem > getCoordinateSystem() const
Definition: Frame.h:96
Image.h
SourceXtractor::Frame::Frame
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:30
SourceXtractor::Frame::applyFilter
void applyFilter()
Definition: Frame.cpp:215
SourceXtractor::Frame::m_filtered_variance_map
std::shared_ptr< Image< T > > m_filtered_variance_map
Definition: Frame.h:165
SourceXtractor::Frame::getUnfilteredVarianceMap
std::shared_ptr< WeightImage > getUnfilteredVarianceMap() const
Definition: Frame.cpp:120
SourceXtractor::Frame::ImageFilter::~ImageFilter
virtual ~ImageFilter()=default
SourceXtractor::Frame::m_variance_threshold
WeightImage::PixelType m_variance_threshold
Definition: Frame.h:157
SourceXtractor::Frame::getThresholdedImage
std::shared_ptr< Image< T > > getThresholdedImage() const
Definition: Frame.cpp:99
SourceXtractor::Frame::getOriginalVarianceMap
std::shared_ptr< WeightImage > getOriginalVarianceMap() const
Definition: Frame.h:88
SourceXtractor::Frame::setVarianceThreshold
void setVarianceThreshold(WeightImage::PixelType threshold)
Definition: Frame.cpp:159
SourceXtractor::Frame::setLabel
void setLabel(const std::string &label)
Definition: Frame.cpp:209
SourceXtractor::Frame::setVarianceMap
void setVarianceMap(std::shared_ptr< WeightImage > variance_map)
Definition: Frame.cpp:148
SourceXtractor::Frame::getSaturation
SeFloat getSaturation() const
Definition: Frame.h:108
SourceXtractor::Frame::getDetectionThreshold
T getDetectionThreshold() const
Definition: Frame.h:112
SourceXtractor::Frame::setFilter
void setFilter(std::shared_ptr< ImageFilter > filter)
Definition: Frame.cpp:201
SourceXtractor::Frame::m_coordinate_system
std::shared_ptr< CoordinateSystem > m_coordinate_system
Definition: Frame.h:151
SourceXtractor::Frame::m_gain
SeFloat m_gain
Definition: Frame.h:153
SourceXtractor::Frame::setDetectionThreshold
void setDetectionThreshold(T detection_threshold)
Definition: Frame.cpp:182
SourceXtractor::Frame::getDetectionThresholdMap
std::shared_ptr< Image< T > > getDetectionThresholdMap() const
Definition: Frame.cpp:137
SourceXtractor::Frame::setBackgroundLevel
void setBackgroundLevel(T background_level)
Definition: Frame.cpp:188
SourceXtractor::Frame::m_interpolation_gap
int m_interpolation_gap
Definition: Frame.h:159