SourceXtractorPlusPlus  0.10
Please provide a description of the project.
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 
27 
28 namespace SourceXtractor {
29 
34 template<typename T>
35 class RecenterImage : public ImageBase<T> {
36 protected:
37  RecenterImage(std::shared_ptr<const Image<T>> img, const PixelCoordinate &new_center) : m_img{img},
38  m_center{new_center} {
39  }
40 
41 public:
42  template<typename... Args>
43  static std::shared_ptr<RecenterImage<T>> create(Args &&... args) {
44  return std::shared_ptr<RecenterImage<T>>(new RecenterImage{std::forward<Args>(args)...});
45  }
46 
47  std::string getRepr() const override {
48  return "RecenterImage(" + m_img->getRepr() + ")";
49  }
50 
51  int getWidth() const override {
52  return m_img->getWidth();
53  }
54 
55  int getHeight() const override {
56  return m_img->getHeight();
57  }
58 
59  T getValue(int x, int y) const override {
60  x = (x + m_center.m_x) % m_img->getWidth();
61  y = (y + m_center.m_y) % m_img->getHeight();
62  return m_img->getValue(x, y);
63  }
64 
65 private:
68 };
69 
70 } // end SourceXtractor
71 
72 #endif // _SEFRAMEWORK_IMAGE_WARPIMAGE_H
ImageBase.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:67
std::string
STL class.
std::shared_ptr
STL class.
SourceXtractor::Image
Interface representing an image.
Definition: Image.h:43
SourceXtractor::RecenterImage::create
static std::shared_ptr< RecenterImage< T > > create(Args &&... args)
Definition: RecenterImage.h:43
SourceXtractor
Definition: Aperture.h:30
SourceXtractor::RecenterImage::RecenterImage
RecenterImage(std::shared_ptr< const Image< T >> img, const PixelCoordinate &new_center)
Definition: RecenterImage.h:37
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:47
SourceXtractor::RecenterImage::m_img
std::shared_ptr< const Image< T > > m_img
Definition: RecenterImage.h:66
SourceXtractor::RecenterImage::getWidth
int getWidth() const override
Returns the width of the image in pixels.
Definition: RecenterImage.h:51
SourceXtractor::RecenterImage
Changes the center of an image, wrapping it around the edges.
Definition: RecenterImage.h:35
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition: MoffatModelFittingTask.cpp:93
SourceXtractor::RecenterImage::getHeight
int getHeight() const override
Returns the height of the image in pixels.
Definition: RecenterImage.h:55
SourceXtractor::RecenterImage::getValue
T getValue(int x, int y) const override
Returns the value of the pixel with the coordinates (x,y)
Definition: RecenterImage.h:59
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition: MoffatModelFittingTask.cpp:93
SourceXtractor::ImageBase
Definition: ImageBase.h:35