SourceXtractorPlusPlus
0.10
Please provide a description of the project.
SEFramework
SEFramework
FITS
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
27
#include "
SEFramework/CoordinateSystem/CoordinateSystem.h
"
28
#include "
SEFramework/Image/ImageSource.h
"
29
#include "
SEFramework/FITS/FitsFileManager.h
"
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,
50
std::shared_ptr<FitsFileManager>
manager =
FitsFileManager::getInstance
());
51
52
FitsImageSource
(
const
std::string
&
filename
,
int
width,
int
height,
53
const
std::shared_ptr<CoordinateSystem>
coord_system =
nullptr
,
54
std::shared_ptr<FitsFileManager>
manager =
FitsFileManager::getInstance
());
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
99
std::string
m_filename
;
100
std::shared_ptr<FitsFileManager>
m_manager
;
101
102
int
m_width
;
103
int
m_height
;
104
105
int
m_hdu_number
;
106
107
std::map<std::string, std::string>
m_header
;
108
};
109
110
}
111
112
113
114
115
#endif
/* _SEFRAMEWORK_IMAGE_FITSIMAGESOURCE_H_ */
std::shared_ptr
STL class.
ImageSource.h
SourceXtractor::FitsImageSource::m_height
int m_height
Definition:
FitsImageSource.h:103
SourceXtractor::FitsImageSource::getHeight
int getHeight() const override
Returns the height of the image in pixels.
Definition:
FitsImageSource.h:70
SourceXtractor::FitsImageSource::~FitsImageSource
virtual ~FitsImageSource()=default
FitsFileManager.h
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition:
MoffatModelFittingTask.cpp:93
SourceXtractor::FitsImageSource::getDataType
int getDataType() const
SourceXtractor::FitsFileManager::getInstance
static std::shared_ptr< FitsFileManager > getInstance()
Definition:
FitsFileManager.h:47
SourceXtractor::FitsImageSource::readFitsKeyword
bool readFitsKeyword(const std::string &header_keyword, TT &out_value)
Definition:
FitsImageSource.h:77
std::map::end
T end(T... args)
SourceXtractor::FitsImageSource::getRepr
std::string getRepr() const override
Human readable representation of this source.
Definition:
FitsImageSource.h:58
std::map< std::string, std::string >
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition:
MoffatModelFittingTask.cpp:93
SourceXtractor::FitsImageSource::getImageType
int getImageType() const
SourceXtractor::FitsImageSource::m_filename
std::string m_filename
Definition:
FitsImageSource.h:99
std::string
STL class.
SourceXtractor::FitsImageSource::loadHeadFile
void loadHeadFile()
Definition:
FitsImageSource.cpp:213
SourceXtractor::FitsImageSource::m_hdu_number
int m_hdu_number
Definition:
FitsImageSource.h:105
SourceXtractor
Definition:
Aperture.h:30
SourceXtractor::ImageTile
Definition:
ImageTile.h:57
SourceXtractor::FitsImageSource::switchHdu
void switchHdu(fitsfile *fptr, int hdu_number) const
Definition:
FitsImageSource.cpp:197
SourceXtractor::FitsImageSource::m_manager
std::shared_ptr< FitsFileManager > m_manager
Definition:
FitsImageSource.h:100
conf.filename
string filename
Definition:
conf.py:63
SourceXtractor::FitsImageSource::getImageTile
std::shared_ptr< ImageTile< T > > getImageTile(int x, int y, int width, int height) const override
Definition:
FitsImageSource.cpp:150
std::enable_shared_from_this
SourceXtractor::FitsImageSource::getHDU
int getHDU() const
Definition:
FitsImageSource.h:86
CoordinateSystem.h
SourceXtractor::ImageSource
Definition:
ImageSource.h:41
std::map::find
T find(T... args)
SourceXtractor::FitsImageSource::saveTile
void saveTile(ImageTile< T > &tile) override
Definition:
FitsImageSource.cpp:174
SourceXtractor::FitsImageSource::m_header
std::map< std::string, std::string > m_header
Definition:
FitsImageSource.h:107
SourceXtractor::FitsImageSource::m_width
int m_width
Definition:
FitsImageSource.h:102
SourceXtractor::FitsImageSource
Definition:
FitsImageSource.h:38
SourceXtractor::FitsImageSource::FitsImageSource
FitsImageSource(const std::string &filename, int hdu_number=0, std::shared_ptr< FitsFileManager > manager=FitsFileManager::getInstance())
Definition:
FitsImageSource.cpp:62
SourceXtractor::FitsImageSource::getWidth
int getWidth() const override
Returns the width of the image in pixels.
Definition:
FitsImageSource.h:65
Generated by
1.8.15