SourceXtractorPlusPlus
0.15
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/Image.h
"
27
#include "
SEFramework/Image/ImageChunk.h
"
28
29
namespace
SourceXtractor {
30
42
template
<
typename
T,
typename
I = T>
43
class
FunctionalImage
:
public
Image
<T> {
44
public
:
45
using
FunctorType
=
std::function<T(int x, int y, I v)>
;
46
47
protected
:
48
FunctionalImage
(
std::shared_ptr
<
const
Image<I>
> img,
FunctorType
functor)
49
:
m_img
{
std::move
(img)},
m_functor
{functor} {
50
}
51
52
public
:
53
virtual
~FunctionalImage
() =
default
;
54
55
template
<
typename
...Args>
56
static
std::shared_ptr<FunctionalImage<T, I>
>
create
(Args&& ... args) {
57
return
std::shared_ptr<FunctionalImage<T, I>
>(
new
FunctionalImage
{std::forward<Args>(args)...});
58
}
59
60
std::string
getRepr
() const final {
61
return
"FunctionalImage<"
+
std::string
(
m_functor
.
target_type
().name()) +
">"
;
62
}
63
64
int
getWidth
() const final {
65
return
m_img
->getWidth();
66
}
67
68
int
getHeight
() const final {
69
return
m_img
->getHeight();
70
}
71
72
std::shared_ptr<ImageChunk<T>
>
getChunk
(
int
x
,
int
y
,
int
width
,
int
height
)
const
final
{
73
auto
in_chunk =
m_img
->getChunk(
x
,
y
,
width
,
height
);
74
auto
chunk =
UniversalImageChunk<T>::create
(
width
,
height
);
75
for
(
int
iy = 0; iy <
height
; ++iy) {
76
for
(
int
ix = 0; ix <
width
; ++ix) {
77
chunk->at(ix, iy) =
m_functor
(ix +
x
, iy +
y
, in_chunk->getValue(ix, iy));
78
}
79
}
80
return
chunk;
81
}
82
83
private
:
84
std::shared_ptr<const Image<I>
>
m_img
;
85
FunctorType
m_functor
;
86
};
87
88
}
// end SourceXtractor
89
90
#endif // _SEFRAMEWORK_IMAGE_FUNCTIONALIMAGE_H
std::shared_ptr
SourceXtractor::FunctionalImage::m_functor
FunctorType m_functor
Definition:
FunctionalImage.h:85
SourceXtractor::FunctionalImage::create
static std::shared_ptr< FunctionalImage< T, I > > create(Args &&...args)
Definition:
FunctionalImage.h:56
std::function< T(int x, int y, I v)>
SourceXtractor::FunctionalImage::getChunk
std::shared_ptr< ImageChunk< T > > getChunk(int x, int y, int width, int height) const final
Definition:
FunctionalImage.h:72
SourceXtractor::FunctionalImage::FunctionalImage
FunctionalImage(std::shared_ptr< const Image< I >> img, FunctorType functor)
Definition:
FunctionalImage.h:48
x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
Definition:
MoffatModelFittingTask.cpp:94
SourceXtractor::FunctionalImage::m_img
std::shared_ptr< const Image< I > > m_img
Definition:
FunctionalImage.h:84
SourceXtractor::FunctionalImage::getRepr
std::string getRepr() const final
Get a string identifying this image in a human readable manner.
Definition:
FunctionalImage.h:60
y
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Definition:
MoffatModelFittingTask.cpp:94
SourceXtractor::FunctionalImage::~FunctionalImage
virtual ~FunctionalImage()=default
std::string
STL class.
Image.h
SourceXtractor::UniversalImageChunk::create
static std::shared_ptr< UniversalImageChunk< T > > create(Args &&...args)
Definition:
ImageChunk.h:142
std::move
T move(T...args)
std::function::target_type
T target_type(T...args)
ImageChunk.h
ModelFitting::height
height
Definition:
CompactModelBase.icpp:19
SourceXtractor::FunctionalImage::getHeight
int getHeight() const final
Returns the height of the image in pixels.
Definition:
FunctionalImage.h:68
SourceXtractor::Image
Interface representing an image.
Definition:
Image.h:43
SourceXtractor::FunctionalImage
Definition:
FunctionalImage.h:43
ModelFitting::width
width
Definition:
CompactModelBase.icpp:19
SourceXtractor::FunctionalImage::getWidth
int getWidth() const final
Returns the width of the image in pixels.
Definition:
FunctionalImage.h:64
Generated by
1.8.5