SourceXtractorPlusPlus  0.12
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Image.h
Go to the documentation of this file.
1 
23 #ifndef _SEFRAMEWORK_IMAGE_IMAGE_H
24 #define _SEFRAMEWORK_IMAGE_IMAGE_H
25 
26 #include <memory>
27 
28 #include "SEUtils/Types.h"
30 
31 namespace SourceXtractor {
32 
33 template <typename T>
34 class ImageChunk;
35 
36 
42 template <typename T>
43 class Image {
44 
45 public:
46 
47  using PixelType = T;
48 
52  virtual ~Image() = default;
53 
55  virtual std::string getRepr() const = 0;
56 
58  virtual T getValue(int x, int y) const = 0;
59 
60  T getValue(PixelCoordinate pc) const {
61  return getValue(pc.m_x, pc.m_y);
62  }
63 
65  virtual int getWidth() const = 0;
66 
68  virtual int getHeight() const = 0;
69 
70  virtual std::shared_ptr<ImageChunk<T>> getChunk(int x, int y, int width, int height) const = 0;
71 
73  bool isInside(int x, int y) const {
74  return x >= 0 && y >= 0 && x < getWidth() && y < getHeight();
75  }
76 
77 }; /* End of Image class */
78 
81 
84 
87 
90 
91 } /* namespace SourceXtractor */
92 
93 
94 #endif
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
virtual std::string getRepr() const =0
Get a string identifying this image in a human readable manner.
virtual int getHeight() const =0
Returns the height of the image in pixels.
virtual ~Image()=default
Destructor.
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
virtual std::shared_ptr< ImageChunk< T > > getChunk(int x, int y, int width, int height) const =0
STL class.
virtual T getValue(int x, int y) const =0
Returns the value of the pixel with the coordinates (x,y)
A pixel coordinate made of two integers m_x and m_y.
bool isInside(int x, int y) const
Returns true if the given coordinates are inside the image bounds.
Definition: Image.h:73
Interface representing an image.
Definition: Image.h:43
T getValue(PixelCoordinate pc) const
Definition: Image.h:60
virtual int getWidth() const =0
Returns the width of the image in pixels.