SourceXtractorPlusPlus  0.10
Please provide a description of the project.
FitsImageSource.h
Go to the documentation of this file.
1 
17 /*
18  * FitsImageSource.h
19  *
20  * Created on: Feb 21, 2018
21  * Author: mschefer
22  */
23 
24 #ifndef _SEFRAMEWORK_IMAGE_FITSIMAGESOURCE_H_
25 #define _SEFRAMEWORK_IMAGE_FITSIMAGESOURCE_H_
26 
30 
31 #include <iostream>
32 #include <boost/lexical_cast.hpp>
33 
34 
35 namespace SourceXtractor {
36 
37 template <typename T>
38 class FitsImageSource : public ImageSource<T>, public std::enable_shared_from_this<ImageSource<T>> {
39 public:
40 
49  FitsImageSource(const std::string &filename, int hdu_number = 0,
51 
52  FitsImageSource(const std::string &filename, int width, int height,
53  const std::shared_ptr<CoordinateSystem> coord_system = nullptr,
55 
56  virtual ~FitsImageSource() = default;
57 
58  std::string getRepr() const override {
59  return m_filename;
60  }
61 
62  std::shared_ptr<ImageTile<T>> getImageTile(int x, int y, int width, int height) const override;
63 
65  int getWidth() const override {
66  return m_width;
67  }
68 
70  int getHeight() const override {
71  return m_height;
72  }
73 
74  void saveTile(ImageTile<T>& tile) override;
75 
76  template <typename TT>
77  bool readFitsKeyword(const std::string& header_keyword, TT& out_value) {
78  auto i = m_header.find(header_keyword);
79  if (i != m_header.end()) {
80  out_value = boost::lexical_cast<TT>(i->second);
81  return true;
82  }
83  return false;
84  }
85 
86  int getHDU() const {
87  return m_hdu_number;
88  }
89 
90 private:
91 
92  void switchHdu(fitsfile* fptr, int hdu_number) const;
93 
94  void loadHeadFile();
95 
96  int getDataType() const;
97  int getImageType() const;
98 
101 
102  int m_width;
103  int m_height;
104 
106 
108 };
109 
110 }
111 
112 
113 
114 
115 #endif /* _SEFRAMEWORK_IMAGE_FITSIMAGESOURCE_H_ */
STL class.
int getHeight() const override
Returns the height of the image in pixels.
virtual ~FitsImageSource()=default
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
static std::shared_ptr< FitsFileManager > getInstance()
bool readFitsKeyword(const std::string &header_keyword, TT &out_value)
T end(T... args)
std::string getRepr() const override
Human readable representation of this source.
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
STL class.
void switchHdu(fitsfile *fptr, int hdu_number) const
std::shared_ptr< FitsFileManager > m_manager
string filename
Definition: conf.py:63
std::shared_ptr< ImageTile< T > > getImageTile(int x, int y, int width, int height) const override
T find(T... args)
void saveTile(ImageTile< T > &tile) override
std::map< std::string, std::string > m_header
FitsImageSource(const std::string &filename, int hdu_number=0, std::shared_ptr< FitsFileManager > manager=FitsFileManager::getInstance())
int getWidth() const override
Returns the width of the image in pixels.