SourceXtractorPlusPlus
0.11
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
Image
FunctionalImage.h
Go to the documentation of this file.
1
17
/*
18
* @file SEFramework/Image/FunctionalImage.h
19
* @date 27/03/19
20
* @author Alejandro Alvarez Ayllon
21
*/
22
23
#ifndef _SEFRAMEWORK_IMAGE_FUNCTIONALIMAGE_H
24
#define _SEFRAMEWORK_IMAGE_FUNCTIONALIMAGE_H
25
26
#include "
SEFramework/Image/ImageBase.h
"
27
28
namespace
SourceXtractor {
29
30
template
<
typename
T>
31
class
FunctionalImage
:
public
ImageBase
<T> {
32
public
:
33
using
FunctorType
=
std::function<T(int x, int y)>
;
34
35
protected
:
36
FunctionalImage
(
int
width
,
int
height
,
FunctorType
functor)
37
:
m_width
{width},
m_height
{
height
},
m_functor
{functor} {
38
}
39
40
public
:
41
virtual
~FunctionalImage
() =
default
;
42
43
template
<
typename
...Args>
44
static
std::shared_ptr<ImageBase<T>
>
create
(Args&& ... args) {
45
return
std::shared_ptr<FunctionalImage<T>
>(
new
FunctionalImage
{std::forward<Args>(args)...});
46
}
47
48
std::string
getRepr
() const final {
49
return
"FunctionalImage<"
+
std::string
(
m_functor
.
target_type
().name()) +
">"
;
50
}
51
52
T
getValue
(
int
x
,
int
y
)
const
final
{
53
return
m_functor
(
x
,
y
);
54
}
55
56
int
getWidth
() const final {
57
return
m_width
;
58
}
59
60
int
getHeight
() const final {
61
return
m_height
;
62
}
63
64
std::shared_ptr<ImageChunk<T>
>
getChunk
(
int
x
,
int
y
,
int
width
,
int
height
)
const
final
{
65
std::vector<T>
data(
width
*
height
);
66
for
(
int
iy = 0; iy <
height
; ++iy) {
67
for
(
int
ix = 0; ix <
width
; ++ix) {
68
data[ix + iy *
width
] =
m_functor
(
x
+ ix,
y
+ iy);
69
}
70
}
71
return
UniversalImageChunk<T>::create
(
std::move
(data),
width
, height);
72
}
73
74
private
:
75
int
m_width
,
m_height
;
76
FunctorType
m_functor
;
77
};
78
79
}
// end SourceXtractor
80
81
#endif // _SEFRAMEWORK_IMAGE_FUNCTIONALIMAGE_H
SourceXtractor::FunctionalImage::getWidth
int getWidth() const final
Returns the width of the image in pixels.
Definition:
FunctionalImage.h:56
std::shared_ptr
SourceXtractor::ImageBase
Definition:
ImageBase.h:35
std::function< T(int x, int y)>
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition:
MoffatModelFittingTask.cpp:93
SourceXtractor::FunctionalImage::getChunk
std::shared_ptr< ImageChunk< T > > getChunk(int x, int y, int width, int height) const final
Definition:
FunctionalImage.h:64
SourceXtractor::FunctionalImage::getHeight
int getHeight() const final
Returns the height of the image in pixels.
Definition:
FunctionalImage.h:60
SourceXtractor::FunctionalImage::create
static std::shared_ptr< ImageBase< T > > create(Args &&...args)
Definition:
FunctionalImage.h:44
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition:
MoffatModelFittingTask.cpp:93
SourceXtractor::FunctionalImage::FunctionalImage
FunctionalImage(int width, int height, FunctorType functor)
Definition:
FunctionalImage.h:36
std::string
STL class.
SourceXtractor::UniversalImageChunk::create
static std::shared_ptr< UniversalImageChunk< T > > create(Args &&...args)
Definition:
ImageChunk.h:132
std::move
T move(T...args)
SourceXtractor::FunctionalImage::getValue
T getValue(int x, int y) const final
Returns the value of the pixel with the coordinates (x,y)
Definition:
FunctionalImage.h:52
std::function::target_type
T target_type(T...args)
SourceXtractor::FunctionalImage::~FunctionalImage
virtual ~FunctionalImage()=default
std::vector
STL class.
SourceXtractor::FunctionalImage::m_height
int m_height
Definition:
FunctionalImage.h:75
ModelFitting::height
height
Definition:
CompactModelBase.icpp:16
SourceXtractor::FunctionalImage::m_width
int m_width
Definition:
FunctionalImage.h:75
SourceXtractor::FunctionalImage::getRepr
std::string getRepr() const final
Get a string identifying this image in a human readable manner.
Definition:
FunctionalImage.h:48
SourceXtractor::FunctionalImage::m_functor
FunctorType m_functor
Definition:
FunctionalImage.h:76
SourceXtractor::FunctionalImage
Definition:
FunctionalImage.h:31
ModelFitting::width
width
Definition:
CompactModelBase.icpp:16
ImageBase.h
Generated by
1.8.5