RecomposeOp.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 Recompose_OP_H_
32 #define Recompose_OP_H_
33 
34 #include "ImageOp.h"
35 
36 namespace drain
37 {
38 
39 namespace image
40 {
41 
42 
44 
63 class RecomposeOp : public ImageOp
64 {
65 
66 public:
67 
68  inline
69  RecomposeOp(const std::string & views = "fia") : ImageOp (__FUNCTION__, "Recompose image.") {
70  parameters.link("views", this->views = views, "i=image,f=imageWithAlpha,r=red,g=green,b=blue,a=alpha");
71  };
72 
73  inline
74  RecomposeOp(const RecomposeOp & op) : ImageOp(op) {
75  parameters.copyStruct(op.getParameters(), op, *this);
76  }
77 
78  virtual
79  void getDstConf(const ImageConf & src, ImageConf & dst) const;
80 
81  virtual
82  void process(const ImageFrame & src, Image & dst) const;
83 
84  //virtual
85  //void traverseChannels(const ImageTray<const Channel> & src, ImageTray<Channel> & dst) const;
86 
87 
88 protected:
89 
90  std::string views;
91 
92 };
93 
94 } // image::
95 
96 } // drain::
97 
98 #endif // Recompose_OP_H_
void copyStruct(const ReferenceMap &m, const T &src, T &dst, extLinkPolicy policy=RESERVE)
Experimental. Copies references and values of a structure to another.
Definition: ReferenceMap.h:399
Struct for image (excluding data)
Definition: ImageConf.h:333
Image with static geometry.
Definition: ImageFrame.h:67
Base class for image processing functions.
Definition: ImageOp.h:49
ImageOp(const std::string &name=__FUNCTION__, const std::string &description="")
Definition: ImageOp.h:156
Class for multi-channel digital images. Supports dynamic typing with base types (char,...
Definition: Image.h:184
Create vertical image composed of separate views.
Definition: RecomposeOp.h:64
virtual void process(const ImageFrame &src, Image &dst) const
Main interface. Typically splits processing to each channel.
Definition: RecomposeOp.cpp:86
virtual void getDstConf(const ImageConf &src, ImageConf &dst) const
Given source image, determine respective dest image configuration.
Definition: RecomposeOp.cpp:38
Definition: DataSelector.cpp:1277