ddt  1.0.0
imageCoords.hpp
Go to the documentation of this file.
1 
21 #ifndef IMAGECOORDS_HPP
22 #define IMAGECOORDS_HPP
23 
24 #include <cpl.h>
25 #include <sys/stat.h>
26 
27 #include <algorithm>
28 #include <cctype>
29 #undef I
30 #undef arg
31 
32 #include "ddt/dataAcquisition.hpp"
33 #include "ddt/dataFile.hpp"
34 #include "ddt/ddtLogger.hpp"
35 #include "ddt/imageError.hpp"
36 #include "ddt/imageIO.hpp"
37 #include "ddt/imageProc.hpp"
38 #include "ddt/imageStats.hpp"
39 
40 const double DEG_PER_HOUR = 360.0 / 24.0;
41 const double DEG_PER_MINUTE = 15.0 / 60.0;
42 const double DEG_PER_SECOND = 0.25 / 60.0;
43 
44 namespace ddt {
45 
53 class ImageCoords {
54  public:
58  ImageCoords(const int image_width, const int image_height,
59  const bool rotate_flag, const bool flip_x_flag,
60  const bool flip_y_flag);
61 
65  virtual ~ImageCoords() = default;
66 
71  void set_logger(ddt::DdtLogger* const in_logger);
72 
82  bool WorldCoordinatesDegreesFromCanvas(const cpl_wcs* const wcs,
83  const double x_canvas,
84  const double y_canvas, double* alpha,
85  double* delta);
86 
96  bool CanvasCoordinatesFromWorldCoordinatesDegrees(const cpl_wcs* const wcs,
97  const double alpha,
98  const double delta,
99  double* const x_canvas,
100  double* const y_canvas);
101 
112  bool WorldCoordinatesDegreesFromImage(const cpl_wcs* const wcs,
113  const double x_image,
114  const double y_image,
115  double* const alpha,
116  double* const delta) const;
117 
128  bool ImageCoordinatesFromWorldCoordinatesDegrees(const cpl_wcs* const wcs,
129  const double alpha,
130  const double delta,
131  double* const x_image,
132  double* const y_image) const;
133 
139  const cpl_matrix* WorldCoordinatesCdMatrix(const cpl_wcs* const wcs) const;
140 
148  void ConvertCanvasToImage(const double x_canvas, const double y_canvas,
149  double* const x_image, double* const y_image) const;
150 
158  void ConvertImageToCanvas(const double x_image, const double y_image,
159  double* const x_canvas,
160  double* const y_canvas) const;
161 
166  void set_RotateFlag(const bool rot_flag);
167 
172  bool get_RotateFlag() const;
173 
178  void set_FlipXFlag(const bool flip_flag);
179 
185  bool get_FlipXFlag() const;
186 
191  void set_FlipYFlag(const bool flip_flag);
192 
198  bool get_FlipYFlag() const;
199 
203  int get_ImageWidth() const;
204 
209  void set_ImageWidth(const int in_image_width);
210 
214  int get_ImageHeight() const;
215 
220  void set_ImageHeight(const int in_image_height);
221 
228  static std::string RaDegToHMS(double deg);
229 
236  static double HMSToRaDeg(const std::string hms);
237 
244  static std::string DecDegToDMS(double deg);
245 
252  static double DMSToDecDeg(const std::string dms);
253 
254  protected:
259 
260  private:
264  int image_width;
265 
269  int image_height;
270 
274  bool rotate_flag;
275 
279  bool flip_x_flag;
280 
284  bool flip_y_flag;
285 
291  bool IsNotFlippedNotRotated() const;
292 
298  bool IsNotFlippedRotated() const;
299 
305  bool IsXFlippedNotRotated() const;
306 
311  bool IsXFlippedRotated() const;
312 
318  bool IsYFlippedNotRotated() const;
319 
324  bool IsYFlippedRotated() const;
325 
331  bool IsXYFlippedNotRotated() const;
332 
338  bool IsXYFlippedRotated() const;
339 
343  void Init();
344 };
345 
346 } // namespace ddt
347 
348 #endif /* IMAGECOORDS_HPP */
349 
Definition: ddtLogger.hpp:51
Definition: imageCoords.hpp:53
void set_ImageHeight(const int in_image_height)
Definition: imageCoords.cpp:431
int get_ImageHeight() const
Definition: imageCoords.cpp:428
void set_FlipYFlag(const bool flip_flag)
Definition: imageCoords.cpp:406
void set_ImageWidth(const int in_image_width)
Definition: imageCoords.cpp:423
bool ImageCoordinatesFromWorldCoordinatesDegrees(const cpl_wcs *const wcs, const double alpha, const double delta, double *const x_image, double *const y_image) const
Definition: imageCoords.cpp:168
bool get_FlipYFlag() const
Definition: imageCoords.cpp:417
bool get_FlipXFlag() const
Definition: imageCoords.cpp:414
void set_RotateFlag(const bool rot_flag)
Definition: imageCoords.cpp:396
static double HMSToRaDeg(const std::string hms)
Definition: imageCoords.cpp:242
void set_FlipXFlag(const bool flip_flag)
Definition: imageCoords.cpp:401
const cpl_matrix * WorldCoordinatesCdMatrix(const cpl_wcs *const wcs) const
Definition: imageCoords.cpp:208
ddt::DdtLogger * logger
Definition: imageCoords.hpp:258
void ConvertImageToCanvas(const double x_image, const double y_image, double *const x_canvas, double *const y_canvas) const
Definition: imageCoords.cpp:359
static std::string DecDegToDMS(double deg)
Definition: imageCoords.cpp:269
bool WorldCoordinatesDegreesFromCanvas(const cpl_wcs *const wcs, const double x_canvas, const double y_canvas, double *alpha, double *delta)
Definition: imageCoords.cpp:44
static std::string RaDegToHMS(double deg)
Definition: imageCoords.cpp:217
static double DMSToDecDeg(const std::string dms)
Definition: imageCoords.cpp:297
virtual ~ImageCoords()=default
bool CanvasCoordinatesFromWorldCoordinatesDegrees(const cpl_wcs *const wcs, const double alpha, const double delta, double *const x_canvas, double *const y_canvas)
Definition: imageCoords.cpp:82
void set_logger(ddt::DdtLogger *const in_logger)
Definition: imageCoords.cpp:38
int get_ImageWidth() const
Definition: imageCoords.cpp:420
bool WorldCoordinatesDegreesFromImage(const cpl_wcs *const wcs, const double x_image, const double y_image, double *const alpha, double *const delta) const
Definition: imageCoords.cpp:125
void ConvertCanvasToImage(const double x_canvas, const double y_canvas, double *const x_image, double *const y_image) const
Definition: imageCoords.cpp:321
ImageCoords(const int image_width, const int image_height, const bool rotate_flag, const bool flip_x_flag, const bool flip_y_flag)
Definition: imageCoords.cpp:25
bool get_RotateFlag() const
Definition: imageCoords.cpp:411
Data acquisition class, offers access to data stream acquisition functions. This file is part of the ...
Data file class, offers access to FITS file functions. This file is part of the DDT Image Handling Li...
Class to wrap the usage of log4cplus as logging utility. This file provides a wrapper class for the u...
const double DEG_PER_HOUR
Definition: imageCoords.hpp:40
const double DEG_PER_MINUTE
Definition: imageCoords.hpp:41
const double DEG_PER_SECOND
Definition: imageCoords.hpp:42
Image error handling function declaration. This file is part of the DDT Image Handling Library and pr...
Image IO function declaration. This file is part of the DDT Image Handling Library and provides funct...
Image processing function declaration. This file is part of the DDT Image Handling Library and provid...
Image analysis and statistic function declaration. This file is part of the DDT Image Handling Librar...
Definition: ddtClient.hpp:39