SourceXtractorPlusPlus
0.19
SourceXtractor++, the next generation SExtractor
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
SEFramework
SEFramework
Image
SubImage.h
Go to the documentation of this file.
1
18
#ifndef _SEFRAMEWORK_IMAGE_SUBIMAGE_H_
19
#define _SEFRAMEWORK_IMAGE_SUBIMAGE_H_
20
21
#include <memory>
22
23
#include "
SEFramework/Image/Image.h
"
24
#include "
SEFramework/Image/ImageAccessor.h
"
25
26
namespace
SourceXtractor {
27
33
template
<
typename
T>
34
class
SubImage
:
public
Image
<T> {
35
protected
:
36
SubImage
(
std::shared_ptr
<
const
Image<T>
> image,
const
PixelCoordinate
&offset,
int
width
,
int
height
)
37
:
m_image
(image),
m_offset
(offset),
m_width
(width),
m_height
(height) {
38
assert(offset.
m_x
>= 0 && offset.
m_y
>= 0 && width > 0 && height > 0 &&
39
offset.
m_x
+ width <= image->
getWidth
() && offset.
m_y
+ height <= image->
getHeight
());
40
}
41
42
SubImage
(
std::shared_ptr
<
const
Image<T>
> image,
int
x
,
int
y
,
int
width
,
int
height
)
43
:
m_image
(image),
m_offset
(x, y),
m_width
(width),
m_height
(height) {
44
assert(x >= 0 && y >= 0 && width > 0 && height > 0 &&
45
x + width <= image->
getWidth
() && y + height <= image->
getHeight
());
46
}
47
48
public
:
52
virtual
~SubImage
() =
default
;
53
54
template
<
typename
... Args>
55
static
std::shared_ptr<SubImage<T>
>
create
(Args &&... args) {
56
return
std::shared_ptr<SubImage<T>
>(
new
SubImage
{std::forward<Args>(args)...});
57
}
58
59
std::string
getRepr
()
const override
{
60
return
"SubImage("
+
m_image
->getRepr() +
", "
+
std::to_string
(
m_offset
.
m_x
) +
", "
+
std::to_string
(
m_offset
.
m_y
) +
", "
+
std::to_string
(
m_width
) +
", "
+
std::to_string
(
m_height
) +
")"
;
61
}
62
63
int
getWidth
()
const override
{
64
return
m_width
;
65
}
66
67
int
getHeight
()
const override
{
68
return
m_height
;
69
}
70
71
std::shared_ptr<ImageChunk<T>
>
getChunk
(
int
x
,
int
y
,
int
width
,
int
height
)
const override
{
72
return
m_image
->getChunk(x +
m_offset
.
m_x
, y +
m_offset
.
m_y
, width, height);
73
}
74
75
private
:
76
std::shared_ptr<const Image<T>
>
m_image
;
77
PixelCoordinate
m_offset
;
78
int
m_width
,
m_height
;
79
};
80
81
}
/* namespace SourceXtractor */
82
83
#endif
/* _SEFRAMEWORK_IMAGE_SUBIMAGE_H_ */
SourceXtractor::PixelCoordinate::m_y
int m_y
Definition:
PixelCoordinate.h:38
std::shared_ptr
SourceXtractor::SubImage::m_width
int m_width
Definition:
SubImage.h:78
SourceXtractor::SubImage::getHeight
int getHeight() const override
Returns the height of the image in pixels.
Definition:
SubImage.h:67
SourceXtractor::SubImage::m_height
int m_height
Definition:
SubImage.h:78
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition:
MoffatModelFittingTask.cpp:94
std::to_string
T to_string(T...args)
ImageAccessor.h
SourceXtractor::SubImage::getChunk
std::shared_ptr< ImageChunk< T > > getChunk(int x, int y, int width, int height) const override
Definition:
SubImage.h:71
SourceXtractor::SubImage::getWidth
int getWidth() const override
Returns the width of the image in pixels.
Definition:
SubImage.h:63
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition:
MoffatModelFittingTask.cpp:94
std::string
STL class.
Image.h
SourceXtractor::SubImage::m_image
std::shared_ptr< const Image< T > > m_image
Definition:
SubImage.h:76
SourceXtractor::SubImage::m_offset
PixelCoordinate m_offset
Definition:
SubImage.h:77
SourceXtractor::SubImage::~SubImage
virtual ~SubImage()=default
Destructor.
SourceXtractor::PixelCoordinate
A pixel coordinate made of two integers m_x and m_y.
Definition:
PixelCoordinate.h:37
ModelFitting::height
height
Definition:
CompactModelBase.icpp:19
SourceXtractor::SubImage::SubImage
SubImage(std::shared_ptr< const Image< T >> image, int x, int y, int width, int height)
Definition:
SubImage.h:42
SourceXtractor::Image
Interface representing an image.
Definition:
Image.h:43
SourceXtractor::SubImage
Part of another image.
Definition:
SubImage.h:34
SourceXtractor::SubImage::SubImage
SubImage(std::shared_ptr< const Image< T >> image, const PixelCoordinate &offset, int width, int height)
Definition:
SubImage.h:36
ModelFitting::width
width
Definition:
CompactModelBase.icpp:19
SourceXtractor::SubImage::getRepr
std::string getRepr() const override
Get a string identifying this image in a human readable manner.
Definition:
SubImage.h:59
SourceXtractor::SubImage::create
static std::shared_ptr< SubImage< T > > create(Args &&...args)
Definition:
SubImage.h:55
SourceXtractor::PixelCoordinate::m_x
int m_x
Definition:
PixelCoordinate.h:38
Generated by
1.8.5