SourceXtractorPlusPlus  0.13
Please provide a description of the project.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
ProcessingImageSource.h
Go to the documentation of this file.
1 
17 /*
18  * ProcessingImageSource.h
19  *
20  * Created on: May 2, 2018
21  * Author: mschefer
22  */
23 
24 #ifndef _SEFRAMEWORK_IMAGE_PROCESSINGIMAGESOURCE_H_
25 #define _SEFRAMEWORK_IMAGE_PROCESSINGIMAGESOURCE_H_
26 
29 
30 namespace SourceXtractor {
31 
32 template <typename T>
33 class ProcessingImageSource : public ImageSource, public std::enable_shared_from_this<ImageSource> {
34 public:
35 
37 
38  virtual ~ProcessingImageSource() = default;
39 
40  std::shared_ptr<ImageTile> getImageTile(int x, int y, int width, int height) const override {
41  auto tile = ImageTile::create(ImageTile::getTypeValue(T()), x, y, width, height, (const_cast<ProcessingImageSource*>(this))->shared_from_this());
42 
43  generateTile(m_image, *tile, x, y, width, height);
44 
45  return tile;
46  }
47 
48  void saveTile(ImageTile& /*tile*/) override {
49  assert(false);
50  }
51 
53  int getWidth() const override {
54  return m_image->getWidth();
55  }
56 
58  int getHeight() const override {
59  return m_image->getHeight();
60  }
61 
62  ImageTile::ImageType getType() const override {
63  return ImageTile::getTypeValue(T());
64  }
65 
66 protected:
67  virtual void generateTile(const std::shared_ptr<Image<T>>& image, ImageTile& tile, int x, int y, int width, int height) const = 0;
68 
70  return m_image->getRepr();
71  }
72 
73 private:
75 };
76 
77 }
78 
79 
80 
81 #endif /* _SEFRAMEWORK_IMAGE_PROCESSINGIMAGESOURCE_H_ */
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > x
std::shared_ptr< Image< T > > m_image
std::shared_ptr< ImageTile > getImageTile(int x, int y, int width, int height) const override
std::shared_ptr< DependentParameter< std::shared_ptr< EngineParameter > > > y
STL class.
virtual void generateTile(const std::shared_ptr< Image< T >> &image, ImageTile &tile, int x, int y, int width, int height) const =0
int getHeight() const override
Returns the height of the image in pixels.
int getWidth() const override
Returns the width of the image in pixels.
static std::shared_ptr< ImageTile > create(ImageType image_type, int x, int y, int width, int height, std::shared_ptr< ImageSource > source=nullptr)
Definition: ImageTile.cpp:96
Interface representing an image.
Definition: Image.h:43
ProcessingImageSource(std::shared_ptr< Image< T >> image)
static ImageType getTypeValue(float)
Definition: ImageTile.h:109
ImageTile::ImageType getType() const override