CatenatorOp.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 CATENATOROP_H_
32 #define CATENATOROP_H_
33 
34 #include "ImageOp.h"
35 
36 namespace drain
37 {
38 
39 namespace image
40 {
41 
43 
46 class CatenatorOp : public ImageOp
47 {
48 public:
49 
50 
51  //CatenatorOp(const std::string & p="") : ImageBaseOp("CatenatorOp","Catenates images, mode=vert|depth (vertically or in-depth, by adding channels). Horz not yet implemented.",
52  CatenatorOp(double scale=1.0, double offset=0.0) : ImageOp(__FUNCTION__, "Catenates images"){
53  parameters.link("scale", this->scale = scale);
54  parameters.link("offset", this->offset = offset);
55  //setParameters(p);
56  };
57 
58  CatenatorOp(const CatenatorOp & op){
59  this->parameters.copyStruct(op.parameters, op, *this);
60  };
61 
62  virtual ~CatenatorOp(){};
63  //void process(const ImageFrame &src,Image &dst) const;
64 
65  double scale;
66  double offset;
67 
69  //void catenateInDepth(const MultiFrame &src,Image &dst) const;
70  //void catenateVertically(const MultiFrame &src,Image &dst) const;
71 };
72 
82 {
83 public:
84 
86  /* This default implementation
87  */
88  //virtual
89  //void make Compatible(const ImageFrame & src, Image & dst) const;
90  inline
91  void getDstConf(const ImageConf & src, ImageConf & dst) const {
92  dst.setType(src.getType());
93  dst.setGeometry(src.getWidth(), src.getHeight()*src.getChannelCount(), 1);
94  //dst.initialize(src.getType(), src.getWidth(), src.getHeight()*src.getChannelCount(), 1);
95  }
96 
97  void process(const ImageFrame &src, Image &dst) const; // { process(src, dst, gain, offset); };
98 
99 };
100 
101 
111 {
112 public:
113 
114  void process(const ImageFrame &src, Image &dst) const;
115 };
116 
117 
118 
119 
120 }
121 
122 }
123 
124 #endif /*CATENATOR_H_*/
125 
126 // Drain
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
Operator for concatenating images vertically or as channels.
Definition: CatenatorOp.h:47
Definition: CatenatorOp.h:82
void process(const ImageFrame &src, Image &dst) const
Main interface. Typically splits processing to each channel.
Definition: CatenatorOp.cpp:47
void getDstConf(const ImageConf &src, ImageConf &dst) const
Modifies the geometry and type of dst.
Definition: CatenatorOp.h:91
const std::type_info & getType() const
Linear scaling.
Definition: ImageConf.h:110
void setType(const std::type_info &t)
Set storage type.
Definition: ImageConf.h:121
size_t getChannelCount() const
Set...
Definition: Geometry.h:257
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
Definition: CatenatorOp.h:111
void process(const ImageFrame &src, Image &dst) const
Main interface. Typically splits processing to each channel.
Definition: CatenatorOp.cpp:83
Definition: DataSelector.cpp:1277