SourceXtractorPlusPlus
0.15
Please provide a description of the project.
SEFramework
SEFramework
Image
ClippedImage.h
Go to the documentation of this file.
1
18
#ifndef _SEFRAMEWORK_IMAGE_CLIPPEDIMAGE_H_
19
#define _SEFRAMEWORK_IMAGE_CLIPPEDIMAGE_H_
20
21
#include "
SEFramework/Image/Image.h
"
22
23
namespace
SourceXtractor
{
24
30
template
<
typename
T>
31
class
ClippedImage
:
public
Image
<T> {
32
private
:
33
47
ClippedImage
(
std::shared_ptr
<
const
Image<T>
> img,
int
x
,
int
y
,
int
w,
int
h)
48
:
m_img
{img},
m_clip_x
{
x
},
m_clip_y
{
y
},
m_clip_w
{w},
m_clip_h
{h} {
49
assert(img->getWidth() -
m_clip_x
>=
m_clip_w
);
50
assert(img->getHeight() -
m_clip_y
>=
m_clip_h
);
51
}
52
53
public
:
54
55
template
<
typename
...Args>
56
static
std::shared_ptr<ClippedImage<T>
>
create
(Args&& ...args) {
57
return
std::shared_ptr<ClippedImage<T>
>(
new
ClippedImage<T>
(std::forward<Args>(args)...));
58
}
59
60
std::string
getRepr
()
const override
{
61
return
"Clipped("
+
m_img
->getRepr() +
")"
;
62
}
63
64
int
getWidth
()
const override
{
65
return
m_clip_w
;
66
}
67
68
int
getHeight
()
const override
{
69
return
m_clip_h
;
70
}
71
72
std::shared_ptr<ImageChunk<T>
>
getChunk
(
int
x
,
int
y
,
int
width,
int
height)
const override
{
73
return
m_img
->getChunk(
x
+
m_clip_x
,
y
+
m_clip_y
, width, height);
74
}
75
76
private
:
77
std::shared_ptr<const Image<T>
>
m_img
;
78
int
m_clip_x
,
m_clip_y
;
79
int
m_clip_w
,
m_clip_h
;
80
};
81
82
}
// end of namespace SourceXtractor
83
84
#endif // _SEFRAMEWORK_IMAGE_CLIPPEDIMAGE_H_
std::string
STL class.
std::shared_ptr
STL class.
SourceXtractor::ClippedImage::getChunk
std::shared_ptr< ImageChunk< T > > getChunk(int x, int y, int width, int height) const override
Definition:
ClippedImage.h:72
SourceXtractor::ClippedImage::m_clip_w
int m_clip_w
Definition:
ClippedImage.h:79
SourceXtractor::ClippedImage::m_clip_y
int m_clip_y
Definition:
ClippedImage.h:78
SourceXtractor::Image
Interface representing an image.
Definition:
Image.h:43
SourceXtractor::ClippedImage
Definition:
ClippedImage.h:31
SourceXtractor::ClippedImage::getHeight
int getHeight() const override
Returns the height of the image in pixels.
Definition:
ClippedImage.h:68
SourceXtractor
Definition:
Aperture.h:30
Image.h
SourceXtractor::ClippedImage::getWidth
int getWidth() const override
Returns the width of the image in pixels.
Definition:
ClippedImage.h:64
SourceXtractor::ClippedImage::m_img
std::shared_ptr< const Image< T > > m_img
Definition:
ClippedImage.h:77
SourceXtractor::ClippedImage::ClippedImage
ClippedImage(std::shared_ptr< const Image< T >> img, int x, int y, int w, int h)
Definition:
ClippedImage.h:47
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition:
MoffatModelFittingTask.cpp:94
SourceXtractor::ClippedImage::m_clip_x
int m_clip_x
Definition:
ClippedImage.h:78
SourceXtractor::ClippedImage::create
static std::shared_ptr< ClippedImage< T > > create(Args &&...args)
Definition:
ClippedImage.h:56
SourceXtractor::ClippedImage::getRepr
std::string getRepr() const override
Get a string identifying this image in a human readable manner.
Definition:
ClippedImage.h:60
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition:
MoffatModelFittingTask.cpp:94
SourceXtractor::ClippedImage::m_clip_h
int m_clip_h
Definition:
ClippedImage.h:79
Generated by
1.8.20