SourceXtractorPlusPlus
0.8
Please provide a description of the project.
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
SEFramework
SEFramework
FITS
FitsWriter.h
Go to the documentation of this file.
1
17
/*
18
* FitsWriter.h
19
*
20
* Created on: May 23, 2017
21
* Author: mschefer
22
*/
23
24
#ifndef _SEFRAMEWORK_IMAGE_FITSWRITER_H_
25
#define _SEFRAMEWORK_IMAGE_FITSWRITER_H_
26
27
#include "
ElementsKernel/Logging.h
"
28
#include "
SEFramework/CoordinateSystem/CoordinateSystem.h
"
29
#include "
SEFramework/Image/Image.h
"
30
#include "
SEFramework/Image/WriteableBufferedImage.h
"
31
#include "
SEFramework/FITS/FitsImageSource.h
"
32
#include "
SEFramework/FITS/TemporaryFitsImageSource.h
"
33
34
namespace
SourceXtractor {
35
36
static
Elements::Logging
fitsWriterLogger
=
Elements::Logging::getLogger
(
"FitsWriter"
);
37
43
class
FitsWriter
{
44
45
public
:
46
50
virtual
~FitsWriter
() =
default
;
51
52
template
<
typename
T>
53
static
void
writeFile
(
const
Image<T>
&image,
const
std::string
&
filename
,
54
const
std::shared_ptr<CoordinateSystem>
coord_system =
nullptr
) {
55
auto
target_image = newImage<T>(
filename
, image.
getWidth
(), image.
getHeight
(), coord_system);
56
57
// FIXME optimize the copy by using tile boundaries, image chunks, etc
58
for
(
int
y
= 0;
y
< image.
getHeight
();
y
++) {
59
for
(
int
x
= 0;
x
< image.
getWidth
();
x
++) {
60
target_image->setValue(
x
,
y
, image.
getValue
(
x
,
y
));
61
}
62
}
63
}
64
65
template
<
typename
T>
66
static
std::shared_ptr<WriteableImage<T>
>
newImage
(
const
std::string
&
filename
,
int
width,
int
height,
67
const
std::shared_ptr<CoordinateSystem>
coord_system =
nullptr
) {
68
fitsWriterLogger
.
debug
() <<
"Creating file "
<<
filename
;
69
auto
image_source = std::make_shared<FitsImageSource<T>>(
filename
, width, height, coord_system);
70
return
WriteableBufferedImage<T>::create
(image_source);
71
}
72
73
template
<
typename
T>
74
static
std::shared_ptr<WriteableImage<T>
>
newTemporaryImage
(
const
std::string
&pattern,
int
width,
int
height,
75
bool
auto_remove =
true
) {
76
fitsWriterLogger
.
debug
() <<
"Creating temporary fits file"
;
77
auto
image_source = std::make_shared<TemporaryFitsImageSource<T>>(pattern, width, height, auto_remove);
78
return
WriteableBufferedImage<T>::create
(image_source);
79
}
80
81
82
};
/* End of FitsReader class */
83
84
}
/* namespace SourceXtractor */
85
86
87
88
89
90
#endif
/* _SEFRAMEWORK_IMAGE_FITSWRITER_H_ */
TemporaryFitsImageSource.h
std::shared_ptr
Logging.h
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition:
MoffatModelFittingTask.cpp:92
SourceXtractor::Image::getHeight
virtual int getHeight() const =0
Returns the height of the image in pixels.
Elements::Logging::debug
void debug(const std::string &logMessage)
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition:
MoffatModelFittingTask.cpp:92
SourceXtractor::WriteableBufferedImage::create
static std::shared_ptr< WriteableBufferedImage< T > > create(std::shared_ptr< const ImageSource< T >> source, std::shared_ptr< TileManager > tile_manager=TileManager::getInstance())
Definition:
WriteableBufferedImage.h:46
std::string
STL class.
FitsImageSource.h
Image.h
SourceXtractor::FitsWriter::newTemporaryImage
static std::shared_ptr< WriteableImage< T > > newTemporaryImage(const std::string &pattern, int width, int height, bool auto_remove=true)
Definition:
FitsWriter.h:74
SourceXtractor::fitsWriterLogger
static Elements::Logging fitsWriterLogger
Definition:
FitsWriter.h:36
SourceXtractor::Image::getValue
virtual T getValue(int x, int y) const =0
Returns the value of the pixel with the coordinates (x,y)
conf.filename
string filename
Definition:
conf.py:63
WriteableBufferedImage.h
Elements::Logging
SourceXtractor::FitsWriter::~FitsWriter
virtual ~FitsWriter()=default
Destructor.
CoordinateSystem.h
SourceXtractor::FitsWriter::newImage
static std::shared_ptr< WriteableImage< T > > newImage(const std::string &filename, int width, int height, const std::shared_ptr< CoordinateSystem > coord_system=nullptr)
Definition:
FitsWriter.h:66
SourceXtractor::Image
Interface representing an image.
Definition:
Image.h:43
SourceXtractor::FitsWriter::writeFile
static void writeFile(const Image< T > &image, const std::string &filename, const std::shared_ptr< CoordinateSystem > coord_system=nullptr)
Definition:
FitsWriter.h:53
SourceXtractor::FitsWriter
Definition:
FitsWriter.h:43
Elements::Logging::getLogger
static Logging getLogger(const std::string &name="")
SourceXtractor::Image::getWidth
virtual int getWidth() const =0
Returns the width of the image in pixels.
Generated by
1.8.5