SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
Image.h
Go to the documentation of this file.
1
22
23#ifndef _SEFRAMEWORK_IMAGE_IMAGE_H
24#define _SEFRAMEWORK_IMAGE_IMAGE_H
25
26#include <cstdint>
27#include <memory>
28
29#include "SEUtils/Types.h"
31
32namespace SourceXtractor {
33
34template <typename T>
35class ImageChunk;
36
37
43template <typename T>
44class Image {
45
46public:
47
48 using PixelType = T;
49
53 virtual ~Image() = default;
54
56 virtual std::string getRepr() const = 0;
57
59 virtual int getWidth() const = 0;
60
62 virtual int getHeight() const = 0;
63
64 virtual std::shared_ptr<ImageChunk<T>> getChunk(int x, int y, int width, int height) const = 0;
65
67 const PixelCoordinate& end) const {
68 assert(isInside(start.m_x, start.m_y) && isInside(end.m_x, end.m_y));
69 return getChunk(start.m_x, start.m_y, end.m_x - start.m_x + 1, end.m_y - start.m_y + 1);
70 }
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#endif
Interface representing an image.
Definition Image.h:44
std::shared_ptr< ImageChunk< T > > getChunk(const PixelCoordinate &start, const PixelCoordinate &end) const
Definition Image.h:66
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.
virtual std::shared_ptr< ImageChunk< T > > getChunk(int x, int y, int width, int height) const =0
bool isInside(int x, int y) const
Returns true if the given coordinates are inside the image bounds.
Definition Image.h:73
T end(T... args)
Image< SeFloat > WeightImage
Alias for the weight image, to make easier its type modification.
Definition Image.h:86
Image< std::int64_t > FlagImage
Alias for the flag image, to make easier its type modification.
Definition Image.h:89
Image< SeFloat > MeasurementImage
Alias for the measurement image, to make easier its type modification.
Definition Image.h:83
Image< SeFloat > DetectionImage
Alias for the detection image, to make easier its type modification.
Definition Image.h:80
A pixel coordinate made of two integers m_x and m_y.