SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
ConstantImage.h
Go to the documentation of this file.
1
17/*
18 * ConstantImage.h
19 *
20 * Created on: Jan 12, 2017
21 * Author: mschefer
22 */
23
24#ifndef _SEFRAMEWORK_IMAGE_CONSTANTIMAGE_H_
25#define _SEFRAMEWORK_IMAGE_CONSTANTIMAGE_H_
26
29
30namespace SourceXtractor {
31
32template <typename T>
33class ConstantImage : public Image<T> {
34protected:
35
36 ConstantImage(int width, int height, T constant_value)
37 : m_width(width), m_height(height), m_constant_value(constant_value) {}
38
39
40public:
41
42 static std::shared_ptr<ConstantImage<T>> create(int width, int height, T constant_value) {
43 return std::shared_ptr<ConstantImage<T>>(new ConstantImage(width, height, constant_value));
44 }
45
46 virtual ~ConstantImage() = default;
47
48 std::string getRepr() const final {
49 return "ConstantImage<" + std::to_string(m_width) + "," + std::to_string(m_height) + ">(" +
51 }
52
53 int getHeight() const final {
54 return m_height;
55 }
56
57 int getWidth() const final {
58 return m_width;
59 }
60
61 std::shared_ptr<ImageChunk<T>> getChunk(int /*x*/, int /*y*/, int width, int height) const final {
62 return UniversalImageChunk<T>::create(std::vector<T>(width * height, m_constant_value), width, height);
63 }
64
65private:
66
70
71};
72
73}
74
75
76#endif /* _SEFRAMEWORK_IMAGE_CONSTANTIMAGE_H_ */
std::string getRepr() const final
Get a string identifying this image in a human readable manner.
std::shared_ptr< ImageChunk< T > > getChunk(int, int, int width, int height) const final
ConstantImage(int width, int height, T constant_value)
virtual ~ConstantImage()=default
int getHeight() const final
Returns the height of the image in pixels.
int getWidth() const final
Returns the width of the image in pixels.
static std::shared_ptr< ConstantImage< T > > create(int width, int height, T constant_value)
Interface representing an image.
Definition Image.h:44
static std::shared_ptr< UniversalImageChunk< T > > create(Args &&... args)
Definition ImageChunk.h:144
T to_string(T... args)