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_ */
SourceXtractor::FitsImageSource::m_filename
std::string m_filename
Definition: FitsImageSource.h:99
SourceXtractor::FitsImageSource::loadHeadFile
void loadHeadFile()
Definition: FitsImageSource.cpp:213
SourceXtractor::FitsImageSource
Definition: FitsImageSource.h:38
SourceXtractor::FitsImageSource::m_height
int m_height
Definition: FitsImageSource.h:103
std::string
STL class.
std::shared_ptr
STL class.
conf.filename
string filename
Definition: conf.py:63
std::map::find
T find(T... args)
SourceXtractor::FitsImageSource::getRepr
std::string getRepr() const override
Human readable representation of this source.
Definition: FitsImageSource.h:58
SourceXtractor::FitsImageSource::getImageType
int getImageType() const
CoordinateSystem.h
SourceXtractor::FitsImageSource::m_header
std::map< std::string, std::string > m_header
Definition: FitsImageSource.h:107
SourceXtractor::ImageTile
Definition: ImageTile.h:57
SourceXtractor::FitsImageSource::saveTile
void saveTile(ImageTile< T > &tile) override
Definition: FitsImageSource.cpp:174
SourceXtractor::FitsImageSource::m_hdu_number
int m_hdu_number
Definition: FitsImageSource.h:105
SourceXtractor
Definition: Aperture.h:30
SourceXtractor::FitsFileManager::getInstance
static std::shared_ptr< FitsFileManager > getInstance()
Definition: FitsFileManager.h:47
SourceXtractor::FitsImageSource::~FitsImageSource
virtual ~FitsImageSource()=default
std::enable_shared_from_this
SourceXtractor::FitsImageSource::m_width
int m_width
Definition: FitsImageSource.h:102
SourceXtractor::FitsImageSource::getWidth
int getWidth() const override
Returns the width of the image in pixels.
Definition: FitsImageSource.h:65
std::map< std::string, std::string >
SourceXtractor::FitsImageSource::getHDU
int getHDU() const
Definition: FitsImageSource.h:86
SourceXtractor::ImageSource
Definition: ImageSource.h:41
SourceXtractor::FitsImageSource::getHeight
int getHeight() const override
Returns the height of the image in pixels.
Definition: FitsImageSource.h:70
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition: MoffatModelFittingTask.cpp:93
SourceXtractor::FitsImageSource::FitsImageSource
FitsImageSource(const std::string &filename, int hdu_number=0, std::shared_ptr< FitsFileManager > manager=FitsFileManager::getInstance())
Definition: FitsImageSource.cpp:62
ImageSource.h
std::map::end
T end(T... args)
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition: MoffatModelFittingTask.cpp:93
SourceXtractor::FitsImageSource::getImageTile
std::shared_ptr< ImageTile< T > > getImageTile(int x, int y, int width, int height) const override
Definition: FitsImageSource.cpp:150
SourceXtractor::FitsImageSource::m_manager
std::shared_ptr< FitsFileManager > m_manager
Definition: FitsImageSource.h:100
SourceXtractor::FitsImageSource::getDataType
int getDataType() const
SourceXtractor::FitsImageSource::readFitsKeyword
bool readFitsKeyword(const std::string &header_keyword, TT &out_value)
Definition: FitsImageSource.h:77
FitsFileManager.h
SourceXtractor::FitsImageSource::switchHdu
void switchHdu(fitsfile *fptr, int hdu_number) const
Definition: FitsImageSource.cpp:197