QuadTreeOp.h
1 /*
2 
3 MIT License
4 
5 Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
6 
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software and associated documentation files (the "Software"), to deal
9 in the Software without restriction, including without limitation the rights
10 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11 copies of the Software, and to permit persons to whom the Software is
12 furnished to do so, subject to the following conditions:
13 
14 The above copyright notice and this permission notice shall be included in all
15 copies or substantial portions of the Software.
16 
17 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 SOFTWARE.
24 
25 */
26 /*
27 Part of Rack development has been done in the BALTRAD projects part-financed
28 by the European Union (European Regional Development Fund and European
29 Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30 */
31 #ifndef QuadTreeOP_H_
32 #define QuadTreeOP_H_
33 
34 #include "ImageOp.h"
35 
36 namespace drain
37 {
38 
39 namespace image
40 {
41 // help copy
42 
43 
45 
65 class QuadTreeOp : public ImageOp {
66 
67 public:
68 
69  QuadTreeOp(size_t width=0, size_t height=0, const std::string & interpolation = "n") : ImageOp(__FUNCTION__, "Resize geometry and scale intensities") {
70  this->parameters.link("width", this->width=width, "pix");
71  this->parameters.link("height", this->height=height, "pix");
72  this->parameters.link("interpolation", this->interpolation=interpolation, "n=nearest,b=bilinear");
73  }
74 
75  size_t width;
76  size_t height;
77  std::string interpolation;
78 
79  virtual
80  // void make Compatible(const ImageFrame & src, Image & dst) const;
81  void getDstConf(const ImageConf & src, ImageConf & dst) const;
82 
84 
87  virtual
88  void process(const ImageFrame & src, ImageFrame & dst) const;
89 
91 
94  virtual
95  inline
96  void process(const ImageFrame & src, const ImageFrame & srcAlpha, ImageFrame & dst, ImageFrame & dstAlpha) const {
97  process(src, dst);
98  process(srcAlpha, dstAlpha);
99  }
100 
101 
102 
103 };
104 
105 
106 } // image::
107 
108 } // drain::
109 
110 #endif /*ResizeOP_H_*/
111 
112 // Drain
Struct for image (excluding data)
Definition: ImageConf.h:333
Image with static geometry.
Definition: ImageFrame.h:67
virtual int srcAlpha() const
Tell if alpha channel(s) is required in input.
Definition: ImageMod.h:66
Base class for image processing functions.
Definition: ImageOp.h:49
ImageOp(const std::string &name=__FUNCTION__, const std::string &description="")
Definition: ImageOp.h:156
QuadTrees the image, stretching the image correspondingly.
Definition: QuadTreeOp.h:65
virtual void process(const ImageFrame &src, ImageFrame &dst) const
The main functionality called by traverseFrame() after image compatibility check and tmp allocations.
Definition: QuadTreeOp.cpp:45
virtual void process(const ImageFrame &src, const ImageFrame &srcAlpha, ImageFrame &dst, ImageFrame &dstAlpha) const
The main functionality called by traverseFrame() after image compatibility check and tmp allocations.
Definition: QuadTreeOp.h:96
virtual void getDstConf(const ImageConf &src, ImageConf &dst) const
Given source image, determine respective dest image configuration.
Definition: QuadTreeOp.cpp:38
Definition: DataSelector.cpp:1277