SourceXtractorPlusPlus  0.16
Please provide a description of the project.
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 int getWidth() const = 0;
59 
61  virtual int getHeight() const = 0;
62 
63  virtual std::shared_ptr<ImageChunk<T>> getChunk(int x, int y, int width, int height) const = 0;
64 
66  const PixelCoordinate& end) const {
67  assert(isInside(start.m_x, start.m_y) && isInside(end.m_x, end.m_y));
68  return getChunk(start.m_x, start.m_y, end.m_x - start.m_x + 1, end.m_y - start.m_y + 1);
69  }
70 
72  bool isInside(int x, int y) const {
73  return x >= 0 && y >= 0 && x < getWidth() && y < getHeight();
74  }
75 
76 }; /* End of Image class */
77 
80 
83 
86 
89 
90 } /* namespace SourceXtractor */
91 
92 #endif
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Interface representing an image.
Definition: Image.h:43
virtual std::shared_ptr< ImageChunk< T > > getChunk(int x, int y, int width, int height) const =0
virtual std::string getRepr() const =0
Get a string identifying this image in a human readable manner.
virtual ~Image()=default
Destructor.
virtual int getHeight() const =0
Returns the height of the image in pixels.
virtual int getWidth() const =0
Returns the width of the image in pixels.
std::shared_ptr< ImageChunk< T > > getChunk(const PixelCoordinate &start, const PixelCoordinate &end) const
Definition: Image.h:65
bool isInside(int x, int y) const
Returns true if the given coordinates are inside the image bounds.
Definition: Image.h:72
T end(T... args)
A pixel coordinate made of two integers m_x and m_y.