SourceXtractorPlusPlus  0.11
Please provide a description of the project.
ThresholdedImage.h
Go to the documentation of this file.
1 
17 /*
18  * ThresholdedImage.h
19  *
20  * Created on: Jan 10, 2018
21  * Author: mschefer
22  */
23 
24 #ifndef _SEFRAMEWORK_IMAGE_THRESHOLDEDIMAGE_H_
25 #define _SEFRAMEWORK_IMAGE_THRESHOLDEDIMAGE_H_
26 
27 #include <memory>
28 
32 
33 namespace SourceXtractor {
34 
40 template <typename T>
41 class ThresholdedImage : public ImageBase<T> {
42 
43 protected:
44 
45  ThresholdedImage(std::shared_ptr<const Image<T>> image, std::shared_ptr<const Image<T>> variance_map, T threshold_multiplier)
46  : m_image(image), m_variance_map(variance_map), m_threshold_multiplier(threshold_multiplier) {
47  assert(m_image->getWidth() == m_variance_map->getWidth());
48  assert(m_image->getHeight() == m_variance_map->getHeight());
49  };
50 
51 public:
52 
56  virtual ~ThresholdedImage() = default;
57 
59  std::shared_ptr<const Image<T>> image, std::shared_ptr<const Image<T>> variance_map, T threshold_multiplier) {
60  return std::shared_ptr<ThresholdedImage<T>>(new ThresholdedImage<T>(image, variance_map, threshold_multiplier));
61  }
62 
63  std::string getRepr() const override {
64  return "ThresholdedImage(" + m_image->getRepr() + ")";
65  }
66 
67  using Image<T>::getValue;
68  T getValue(int x, int y) const override {
69  return m_image->getValue(x, y) - sqrt(m_variance_map->getValue(x, y)) * m_threshold_multiplier;
70  }
71 
72  int getWidth() const override {
73  return m_image->getWidth();
74  }
75 
76  int getHeight() const override {
77  return m_image->getHeight();
78  }
79 
80 private:
83 
84 }; /* End of ThresholdedImage class */
85 
86 } /* namespace SourceXtractor */
87 
88 #endif /* _SEFRAMEWORK_IMAGE_THRESHOLDEDIMAGE_H_ */
ImageBase.h
SourceXtractor::ThresholdedImage::m_image
std::shared_ptr< const Image< T > > m_image
Definition: ThresholdedImage.h:81
std::string
STL class.
std::shared_ptr
STL class.
ConstantImage.h
SourceXtractor::ThresholdedImage::m_variance_map
std::shared_ptr< const Image< T > > m_variance_map
Definition: ThresholdedImage.h:81
SourceXtractor::Image
Interface representing an image.
Definition: Image.h:43
std::sqrt
T sqrt(T... args)
SourceXtractor::ThresholdedImage::create
static std::shared_ptr< ThresholdedImage< T > > create(std::shared_ptr< const Image< T >> image, std::shared_ptr< const Image< T >> variance_map, T threshold_multiplier)
Definition: ThresholdedImage.h:58
SourceXtractor
Definition: Aperture.h:30
SourceXtractor::ThresholdedImage::getWidth
int getWidth() const override
Returns the width of the image in pixels.
Definition: ThresholdedImage.h:72
SourceXtractor::ThresholdedImage::m_threshold_multiplier
T m_threshold_multiplier
Definition: ThresholdedImage.h:82
SourceXtractor::ThresholdedImage::getRepr
std::string getRepr() const override
Get a string identifying this image in a human readable manner.
Definition: ThresholdedImage.h:63
Image.h
SourceXtractor::ThresholdedImage::getValue
T getValue(int x, int y) const override
Returns the value of the pixel with the coordinates (x,y)
Definition: ThresholdedImage.h:68
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition: MoffatModelFittingTask.cpp:93
SourceXtractor::ThresholdedImage
Used to subtract a constant value from an Image.
Definition: ThresholdedImage.h:41
SourceXtractor::ThresholdedImage::getHeight
int getHeight() const override
Returns the height of the image in pixels.
Definition: ThresholdedImage.h:76
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition: MoffatModelFittingTask.cpp:93
SourceXtractor::ImageBase
Definition: ImageBase.h:35
SourceXtractor::ThresholdedImage::~ThresholdedImage
virtual ~ThresholdedImage()=default
Destructor.
SourceXtractor::ThresholdedImage::ThresholdedImage
ThresholdedImage(std::shared_ptr< const Image< T >> image, std::shared_ptr< const Image< T >> variance_map, T threshold_multiplier)
Definition: ThresholdedImage.h:45