SourceXtractorPlusPlus
0.21
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
SEFramework
SEFramework
FITS
FitsImageSource.h
Go to the documentation of this file.
1
18
/*
19
* FitsImageSource.h
20
*
21
* Created on: Feb 21, 2018
22
* Author: mschefer
23
*/
24
25
#ifndef _SEFRAMEWORK_IMAGE_FITSIMAGESOURCE_H_
26
#define _SEFRAMEWORK_IMAGE_FITSIMAGESOURCE_H_
27
28
#include <memory>
29
#include <vector>
30
#include <map>
31
32
#include <boost/lexical_cast.hpp>
33
34
#include "FilePool/FileManager.h"
35
#include "
SEFramework/CoordinateSystem/CoordinateSystem.h
"
36
#include "
SEFramework/Image/ImageSourceWithMetadata.h
"
37
#include "
SEFramework/FITS/FitsFile.h
"
38
#include "
SEUtils/VariantCast.h
"
39
40
41
namespace
SourceXtractor
{
42
43
using
Euclid::FilePool::FileManager
;
44
using
Euclid::FilePool::FileHandler
;
45
46
class
FitsImageSource
:
public
ImageSource
,
public
std::enable_shared_from_this
<ImageSource> {
47
public
:
48
49
58
explicit
FitsImageSource
(
const
std::string
& filename,
int
hdu_number
= 0,
59
ImageTile::ImageType
image_type
=
ImageTile::AutoType
,
60
std::shared_ptr<FileManager>
manager
=
FileManager::getDefault
());
61
62
FitsImageSource
(
const
std::string
& filename,
int
width,
int
height,
63
ImageTile::ImageType
image_type
,
64
const
std::shared_ptr<CoordinateSystem>
coord_system
=
nullptr
,
65
bool
append =
false
,
66
bool
empty_primary
=
false
,
67
std::shared_ptr<FileManager>
manager
=
FileManager::getDefault
());
68
69
virtual
~FitsImageSource
() =
default
;
70
71
std::string
getRepr
()
const override
{
72
return
m_filename
;
73
}
74
76
int
getWidth
()
const override
{
77
return
m_width
;
78
}
79
81
int
getHeight
()
const override
{
82
return
m_height
;
83
}
84
86
int
getDepth
()
const
{
87
return
m_depth
;
88
}
89
90
void
setLayer
(
int
layer
);
91
92
std::shared_ptr<ImageTile>
getImageTile
(
int
x
,
int
y
,
int
width,
int
height)
const override
;
93
94
void
saveTile
(
ImageTile
&
tile
)
override
;
95
96
template
<
typename
TT>
97
bool
readFitsKeyword
(
const
std::string
&
header_keyword
,
TT
&
out_value
)
const
{
98
auto
&
headers
=
getMetadata
();
99
auto
i
=
headers
.find(
header_keyword
);
100
if
(
i
!=
headers
.end()) {
101
out_value
=
VariantCast<TT>
(
i
->second.m_value);
102
return
true
;
103
}
104
return
false
;
105
}
106
107
int
getHDU
()
const
{
108
return
m_hdu_number
;
109
}
110
111
ImageTile::ImageType
getType
()
const override
{
112
return
m_image_type
;
113
}
114
115
std::unique_ptr<std::vector<char>
>
getFitsHeaders
(
int
&
number_of_records
)
const
;
116
117
const
std::map<std::string, MetadataEntry>
&
getMetadata
()
const override
;
118
119
void
setMetadata
(
const
std::string
&
key
,
const
MetadataEntry
& value)
override
;
120
121
private
:
122
void
switchHdu
(
fitsfile
*
fptr
,
int
hdu_number
)
const
;
123
124
int
getDataType
()
const
;
125
126
int
getImageType
()
const
;
127
128
std::string
m_filename
;
129
std::shared_ptr<FileManager>
m_file_manager
;
130
std::shared_ptr<FileHandler>
m_handler
;
131
132
int
m_hdu_number
;
133
134
int
m_width
;
135
int
m_height
;
136
int
m_depth
;
137
ImageTile::ImageType
m_image_type
;
138
139
int
m_current_layer
;
140
};
141
142
}
143
144
145
#endif
/* _SEFRAMEWORK_IMAGE_FITSIMAGESOURCE_H_ */
CoordinateSystem.h
FitsFile.h
ImageSourceWithMetadata.h
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition
MoffatModelFittingTask.cpp:94
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition
MoffatModelFittingTask.cpp:94
VariantCast.h
std::string
Euclid::FilePool::FileManager
Euclid::FilePool::FileManager::getDefault
static std::shared_ptr< FileManager > getDefault()
SourceXtractor::FitsImageSource
Definition
FitsImageSource.h:46
SourceXtractor::FitsImageSource::m_file_manager
std::shared_ptr< FileManager > m_file_manager
Definition
FitsImageSource.h:129
SourceXtractor::FitsImageSource::getType
ImageTile::ImageType getType() const override
Definition
FitsImageSource.h:111
SourceXtractor::FitsImageSource::getRepr
std::string getRepr() const override
Human readable representation of this source.
Definition
FitsImageSource.h:71
SourceXtractor::FitsImageSource::setLayer
void setLayer(int layer)
Definition
FitsImageSource.cpp:275
SourceXtractor::FitsImageSource::m_width
int m_width
Definition
FitsImageSource.h:134
SourceXtractor::FitsImageSource::m_filename
std::string m_filename
Definition
FitsImageSource.h:128
SourceXtractor::FitsImageSource::getWidth
int getWidth() const override
Returns the width of the image in pixels.
Definition
FitsImageSource.h:76
SourceXtractor::FitsImageSource::getMetadata
const std::map< std::string, MetadataEntry > & getMetadata() const override
Definition
FitsImageSource.cpp:327
SourceXtractor::FitsImageSource::readFitsKeyword
bool readFitsKeyword(const std::string &header_keyword, TT &out_value) const
Definition
FitsImageSource.h:97
SourceXtractor::FitsImageSource::m_hdu_number
int m_hdu_number
Definition
FitsImageSource.h:132
SourceXtractor::FitsImageSource::getImageTile
std::shared_ptr< ImageTile > getImageTile(int x, int y, int width, int height) const override
Definition
FitsImageSource.cpp:209
SourceXtractor::FitsImageSource::getDepth
int getDepth() const
Returns the depth of the image in pixels.
Definition
FitsImageSource.h:86
SourceXtractor::FitsImageSource::m_image_type
ImageTile::ImageType m_image_type
Definition
FitsImageSource.h:137
SourceXtractor::FitsImageSource::~FitsImageSource
virtual ~FitsImageSource()=default
SourceXtractor::FitsImageSource::saveTile
void saveTile(ImageTile &tile) override
Definition
FitsImageSource.cpp:234
SourceXtractor::FitsImageSource::FitsImageSource
FitsImageSource(const std::string &filename, int hdu_number=0, ImageTile::ImageType image_type=ImageTile::AutoType, std::shared_ptr< FileManager > manager=FileManager::getDefault())
Definition
FitsImageSource.cpp:74
SourceXtractor::FitsImageSource::getFitsHeaders
std::unique_ptr< std::vector< char > > getFitsHeaders(int &number_of_records) const
Definition
FitsImageSource.cpp:282
SourceXtractor::FitsImageSource::m_height
int m_height
Definition
FitsImageSource.h:135
SourceXtractor::FitsImageSource::getHeight
int getHeight() const override
Returns the height of the image in pixels.
Definition
FitsImageSource.h:81
SourceXtractor::FitsImageSource::m_depth
int m_depth
Definition
FitsImageSource.h:136
SourceXtractor::FitsImageSource::getImageType
int getImageType() const
Definition
FitsImageSource.cpp:374
SourceXtractor::FitsImageSource::getDataType
int getDataType() const
Definition
FitsImageSource.cpp:358
SourceXtractor::FitsImageSource::setMetadata
void setMetadata(const std::string &key, const MetadataEntry &value) override
Definition
FitsImageSource.cpp:332
SourceXtractor::FitsImageSource::m_handler
std::shared_ptr< FileHandler > m_handler
Definition
FitsImageSource.h:130
SourceXtractor::FitsImageSource::switchHdu
void switchHdu(fitsfile *fptr, int hdu_number) const
Definition
FitsImageSource.cpp:258
SourceXtractor::FitsImageSource::getHDU
int getHDU() const
Definition
FitsImageSource.h:107
SourceXtractor::FitsImageSource::m_current_layer
int m_current_layer
Definition
FitsImageSource.h:139
SourceXtractor::ImageSource
Definition
ImageSource.h:55
SourceXtractor::ImageTile
Definition
ImageTile.h:34
SourceXtractor::ImageTile::ImageType
ImageType
Definition
ImageTile.h:37
SourceXtractor::ImageTile::AutoType
@ AutoType
Definition
ImageTile.h:38
std::enable_shared_from_this
std::function
SourceXtractor
Definition
Aperture.h:30
Euclid::FilePool::FileHandler
SourceXtractor::MetadataEntry
Definition
ImageSource.h:42
Generated by
1.10.0