SourceXtractorPlusPlus
0.15
Please provide a description of the project.
SEFramework
SEFramework
Image
RecenterImage.h
Go to the documentation of this file.
1
17
/*
18
* @file SEFramework/Image/WarpImage.h
19
* @date 11/09/18
20
* @author Alejandro Alvarez Ayllon
21
*/
22
23
#ifndef _SEFRAMEWORK_IMAGE_WARPIMAGE_H
24
#define _SEFRAMEWORK_IMAGE_WARPIMAGE_H
25
26
#include "
SEFramework/Image/Image.h
"
27
#include "
SEFramework/Image/ImageAccessor.h
"
28
29
namespace
SourceXtractor
{
30
35
template
<
typename
T>
36
class
RecenterImage
:
public
Image
<T> {
37
protected
:
38
RecenterImage
(
std::shared_ptr
<
const
Image<T>
> img,
const
PixelCoordinate
&new_center) :
m_img
{img},
39
m_center
{new_center} {
40
}
41
42
public
:
43
template
<
typename
... Args>
44
static
std::shared_ptr<RecenterImage<T>
>
create
(Args &&... args) {
45
return
std::shared_ptr<RecenterImage<T>
>(
new
RecenterImage
{std::forward<Args>(args)...});
46
}
47
48
std::string
getRepr
()
const override
{
49
return
"RecenterImage("
+
m_img
->getRepr() +
")"
;
50
}
51
52
int
getWidth
()
const override
{
53
return
m_img
->getWidth();
54
}
55
56
int
getHeight
()
const override
{
57
return
m_img
->getHeight();
58
}
59
60
std::shared_ptr<ImageChunk<T>
>
getChunk
(
int
x
,
int
y
,
int
width,
int
height)
const override
{
61
ImageAccessor<T>
accessor(
m_img
);
62
auto
chunk =
UniversalImageChunk<T>::create
(width, height);
63
auto
img_w = accessor.
getWidth
();
64
auto
img_h = accessor.
getHeight
();
65
for
(
int
iy = 0; iy < height; ++iy) {
66
for
(
int
ix = 0; ix < width; ++ix) {
67
chunk->at(ix, iy) = accessor.
getValue
(
68
(ix +
x
+
m_center
.
m_x
) % img_w,
69
(iy +
y
+
m_center
.
m_y
) % img_h
70
);
71
}
72
}
73
return
chunk;
74
}
75
76
private
:
77
std::shared_ptr<const Image<T>
>
m_img
;
78
PixelCoordinate
m_center
;
79
};
80
81
}
// end SourceXtractor
82
83
#endif // _SEFRAMEWORK_IMAGE_WARPIMAGE_H
SourceXtractor::PixelCoordinate
A pixel coordinate made of two integers m_x and m_y.
Definition:
PixelCoordinate.h:37
SourceXtractor::RecenterImage::m_center
PixelCoordinate m_center
Definition:
RecenterImage.h:78
SourceXtractor::ImageAccessor::getWidth
int getWidth() const override
Returns the width of the image in pixels.
Definition:
ImageAccessor.h:120
SourceXtractor::ImageAccessor
Definition:
ImageAccessor.h:41
std::string
STL class.
std::shared_ptr
STL class.
SourceXtractor::ImageAccessor::getHeight
int getHeight() const override
Returns the height of the image in pixels.
Definition:
ImageAccessor.h:124
SourceXtractor::Image
Interface representing an image.
Definition:
Image.h:43
SourceXtractor::RecenterImage::getChunk
std::shared_ptr< ImageChunk< T > > getChunk(int x, int y, int width, int height) const override
Definition:
RecenterImage.h:60
SourceXtractor::RecenterImage::create
static std::shared_ptr< RecenterImage< T > > create(Args &&... args)
Definition:
RecenterImage.h:44
SourceXtractor
Definition:
Aperture.h:30
SourceXtractor::RecenterImage::RecenterImage
RecenterImage(std::shared_ptr< const Image< T >> img, const PixelCoordinate &new_center)
Definition:
RecenterImage.h:38
SourceXtractor::PixelCoordinate::m_x
int m_x
Definition:
PixelCoordinate.h:38
SourceXtractor::PixelCoordinate::m_y
int m_y
Definition:
PixelCoordinate.h:38
SourceXtractor::RecenterImage::getRepr
std::string getRepr() const override
Get a string identifying this image in a human readable manner.
Definition:
RecenterImage.h:48
SourceXtractor::RecenterImage::m_img
std::shared_ptr< const Image< T > > m_img
Definition:
RecenterImage.h:77
Image.h
SourceXtractor::ImageAccessor::getValue
T getValue(int x, int y)
Definition:
ImageAccessor.h:100
SourceXtractor::RecenterImage::getWidth
int getWidth() const override
Returns the width of the image in pixels.
Definition:
RecenterImage.h:52
SourceXtractor::RecenterImage
Changes the center of an image, wrapping it around the edges.
Definition:
RecenterImage.h:36
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition:
MoffatModelFittingTask.cpp:94
SourceXtractor::UniversalImageChunk::create
static std::shared_ptr< UniversalImageChunk< T > > create(Args &&... args)
Definition:
ImageChunk.h:142
SourceXtractor::RecenterImage::getHeight
int getHeight() const override
Returns the height of the image in pixels.
Definition:
RecenterImage.h:56
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition:
MoffatModelFittingTask.cpp:94
ImageAccessor.h
Generated by
1.8.20