SourceXtractorPlusPlus  0.11
Please provide a description of the project.
VignetArray.h
Go to the documentation of this file.
1 
18 #ifndef _SEIMPLEMENTATION_PLUGIN_VIGNETARRAY_H_
19 #define _SEIMPLEMENTATION_PLUGIN_VIGNETARRAY_H_
20 
21 #include <NdArray/NdArray.h>
26 
27 namespace SourceXtractor {
28 
29 class VignetArray: public Property {
30 public:
32  const auto& representative = vignets.front().get().getVignet();
33 
34  if (vignets.size() > 1) {
35  std::vector<size_t> shape{
36  vignets.size(), static_cast<size_t>(representative.getWidth()), static_cast<size_t>(representative.getHeight())
37  };
38  m_vignets = Euclid::make_unique<Euclid::NdArray::NdArray<DetectionImage::PixelType>>(shape);
39 
40  for (size_t v = 0; v < vignets.size(); ++v) {
41  const auto& img = vignets[v].get().getVignet();
42  assert (img.getWidth() == representative.getWidth());
43  assert (img.getHeight() == representative.getHeight());
44  for (int x = 0; x < img.getWidth(); ++x) {
45  for (int y = 0; y < img.getHeight(); ++y) {
46  m_vignets->at(v, x, y) = img.getValue(x, y);
47  }
48  }
49  }
50  }
51  else {
52  std::vector<size_t> shape{
53  static_cast<size_t>(representative.getWidth()), static_cast<size_t>(representative.getHeight())
54  };
55  m_vignets = Euclid::make_unique<Euclid::NdArray::NdArray<DetectionImage::PixelType>>(shape);
56 
57  for (int x = 0; x < representative.getWidth(); ++x) {
58  for (int y = 0; y < representative.getHeight(); ++y) {
59  m_vignets->at(x, y) = representative.getValue(x, y);
60  }
61  }
62  }
63  }
64 
66  return *m_vignets;
67  }
68 
69 private:
71 };
72 
73 } // end of namespace SourceXtractor
74 
75 #endif /* _SEIMPLEMENTATION_PLUGIN_VIGNETARRAY_H_ */
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
Base class for all Properties. (has no actual content)
Definition: Property.h:33
VignetArray(const std::vector< std::reference_wrapper< const Vignet >> &vignets)
Definition: VignetArray.h:31
T get(T... args)
T size(T... args)
STL class.
STL class.
std::unique_ptr< Euclid::NdArray::NdArray< DetectionImage::PixelType > > m_vignets
Definition: VignetArray.h:70
const Euclid::NdArray::NdArray< DetectionImage::PixelType > & getVignets() const
Definition: VignetArray.h:65