Loading...
Searching...
No Matches
MultiThresholdOp.h
1/*
2
3MIT License
4
5Copyright (c) 2017 FMI Open Development / Markus Peura, first.last@fmi.fi
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software and associated documentation files (the "Software"), to deal
9in the Software without restriction, including without limitation the rights
10to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11copies of the Software, and to permit persons to whom the Software is
12furnished to do so, subject to the following conditions:
13
14The above copyright notice and this permission notice shall be included in all
15copies or substantial portions of the Software.
16
17THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23SOFTWARE.
24
25*/
26/*
27Part of Rack development has been done in the BALTRAD projects part-financed
28by the European Union (European Regional Development Fund and European
29Neighbourhood Partnership Instrument, Baltic Sea Region Programme 2007-2013)
30*/
31#ifndef MULTITHRESHOLD_OP_H_
32#define MULTITHRESHOLD_OP_H_
33
34#include "ImageOp.h"
35
36namespace drain
37{
38
39namespace image
40{
41
42
43
44class MultiThresholdOp : public ImageOp {
45
46public:
47
48 inline
49 MultiThresholdOp() : drain::image::ImageOp(__FUNCTION__, "Change values outside given range to target.min and target.max") {
50 parameters.link("range", range.tuple(), "accepted values [min:max]").fillArray = true;
51 //parameters.link("target", target.tuple(), "substitutes for rejected values [low:high]").fillArray = true;
52 parameters.link("min", target.min, "value set below range.min"); //.fillArray = true;
53 parameters.link("max", target.max, "value set above range.max"); //.fillArray = true;
54
55 range.set(0.0, 1.0); // linear range
56 target.set(0.0,1.0); // substitite values (2 distinct values)
57
58 };
59
62
63 virtual inline
64 void traverseChannels(const ImageTray<const Channel> & src, ImageTray<Channel> & dst) const {
65 // drain::Logger mout(__FILE__, __FUNCTION__);
67 // traverseChannelsEqually(src, dst);
68 // traverseChannelsRepeated(src, dst);
69 // traverseMultiChannel(src, dst);
70 };
71
72
74 virtual
75 void traverseChannel(const Channel & src, Channel &dst) const;
76
78 virtual
79 void traverseChannel(const Channel &src, const Channel &srcAlpha, Channel &dst, Channel &dstAlpha) const;
80
81
82};
83
84} // image::
85
86} // drain::
87
88#endif /*COPYOP_H_*/
89
90// Drain
Definition Range.h:52
Image with static geometry.
Definition ImageChannel.h:60
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
void traverseChannelsSeparately(const ImageTray< const Channel > &src, ImageTray< Channel > &dst) const
Process each (src,dst) channel pair independently. Raise error if their counts differ.
Definition ImageOp.cpp:340
Container applicable for Channels and Images, with alpha support.
Definition ImageTray.h:267
Definition MultiThresholdOp.h:44
virtual void traverseChannel(const Channel &src, Channel &dst) const
Apply to single channel.
Definition MultiThresholdOp.cpp:42
Definition DataSelector.cpp:1277