SourceXtractorPlusPlus 1.0.3
SourceXtractor++, the next generation SExtractor
Loading...
Searching...
No Matches
VignetArray.h
Go to the documentation of this file.
1
17
18#ifndef _SEIMPLEMENTATION_PLUGIN_VIGNETARRAY_H_
19#define _SEIMPLEMENTATION_PLUGIN_VIGNETARRAY_H_
20
21#include <NdArray/NdArray.h>
22#include <AlexandriaKernel/memory_tools.h>
26
27namespace SourceXtractor {
28
29class VignetArray: public Property {
30public:
32 const auto& representative = vignets.front().get().getVignet();
33
34 if (vignets.size() > 1) {
35 initMultiple(vignets, representative);
36 }
37 else {
38 initSingle(representative);
39 }
40 }
41
45
46private:
47 void initSingle(const VectorImage <DetectionImage::PixelType>& representative) {
49 static_cast<size_t>(representative.getWidth()), static_cast<size_t>(representative.getHeight())
50 };
52
53 for (int x = 0; x < representative.getWidth(); ++x) {
54 for (int y = 0; y < representative.getHeight(); ++y) {
55 m_vignets->at(x, y) = representative.getValue(x, y);
56 }
57 }
58 }
59
61 const VectorImage <DetectionImage::PixelType>& representative) {
63 vignets.size(), static_cast<size_t>(representative.getWidth()), static_cast<size_t>(representative.getHeight())
64 };
66
67 for (size_t v = 0; v < vignets.size(); ++v) {
68 const auto& img = vignets[v].get().getVignet();
69 assert (img.getWidth() == representative.getWidth());
70 assert (img.getHeight() == representative.getHeight());
71 for (int x = 0; x < img.getWidth(); ++x) {
72 for (int y = 0; y < img.getHeight(); ++y) {
73 m_vignets->at(v, x, y) = img.getValue(x, y);
74 }
75 }
76 }
77 }
78
80};
81
82} // end of namespace SourceXtractor
83
84#endif /* _SEIMPLEMENTATION_PLUGIN_VIGNETARRAY_H_ */
Base class for all Properties. (has no actual content).
Definition Property.h:33
int getWidth() const final
Returns the width of the image in pixels.
int getHeight() const final
Returns the height of the image in pixels.
T getValue(int x, int y) const
void initMultiple(const std::vector< std::reference_wrapper< const Vignet > > &vignets, const VectorImage< DetectionImage::PixelType > &representative)
Definition VignetArray.h:60
std::unique_ptr< Euclid::NdArray::NdArray< DetectionImage::PixelType > > m_vignets
Definition VignetArray.h:79
void initSingle(const VectorImage< DetectionImage::PixelType > &representative)
Definition VignetArray.h:47
VignetArray(const std::vector< std::reference_wrapper< const Vignet > > &vignets)
Definition VignetArray.h:31
const Euclid::NdArray::NdArray< DetectionImage::PixelType > & getVignets() const
Definition VignetArray.h:42
std::unique_ptr< T > make_unique(Args &&... args)