Image Component Library (ICL)
ThresholdOp.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLFilter/src/ICLFilter/ThresholdOp.h **
10 ** Module : ICLFilter **
11 ** Authors: Christof Elbrechter, Robert Haschke, Andre Justus **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLFilter/UnaryOp.h>
35 
36 namespace icl {
37  namespace filter{
38 
40 
60 
61  public:
63  enum optype{
64  lt,
65  gt,
69  ltgtVal
70  };
71 
73 
80  ThresholdOp(optype ttype,float lowThreshold=127, float highThreshold=127,float lowVal=0, float highVal=255 );
81 
82 
84  virtual ~ThresholdOp();
85 
87 
91  virtual void apply (const core::ImgBase *poSrc, core::ImgBase **ppoDst);
92 
94  using UnaryOp::apply;
95 
97 
100  float getLowThreshold() const {return m_fLowThreshold;}
101 
103 
106  float getHighThreshold() const {return m_fHighThreshold;}
107 
109 
112  float getLowVal() const {return m_fLowVal;}
114 
117  float getHighVal() const {return m_fHighVal;}
118 
120 
123  optype getType() const {return m_eType;}
124 
126 
129  void setLowThreshold(float lowThreshold) {m_fLowThreshold=lowThreshold;}
130 
132 
135  void setHighThreshold(float highThreshold) {m_fHighThreshold=highThreshold;}
136 
138 
141  void setLowVal(float lowVal) {m_fLowVal=lowVal;}
142 
144 
147  void setHighVal(float highVal) {m_fHighVal=highVal;}
148 
150 
153  void setType(optype type) {m_eType=type;}
154 
155  #define ICL_INSTANTIATE_DEPTH(T) \
156  static void tlt(const core::Img## T*, core::Img##T*, icl##T); \
157  static void tgt(const core::Img## T*, core::Img##T*, icl##T); \
158  static void tltgt(const core::Img## T*, core::Img##T*, icl##T, icl##T); \
159  static void tltVal(const core::Img## T*, core::Img##T*, icl##T, icl##T tVal); \
160  static void tgtVal(const core::Img## T*, core::Img##T*, icl##T, icl##T tVal); \
161  static void tltgtVal(const core::Img## T*, core::Img##T*, icl##T, icl##T, icl##T, icl##T);
163  #undef ICL_INSTANTIATE_DEPTH
164 
165  private:
168  float m_fLowVal;
169  float m_fHighVal;
172  void tlt(const core::ImgBase *poSrc, core::ImgBase **ppoDst, float threshold);
174  void tgt(const core::ImgBase *poSrc, core::ImgBase **ppoDst, float threshold);
176  void tltgt(const core::ImgBase *poSrc, core::ImgBase **ppoDst, float low, float hi);
178  void tltVal(const core::ImgBase *poSrc, core::ImgBase **ppoDst, float threshold, float val);
180  void tgtVal(const core::ImgBase *poSrc, core::ImgBase **ppoDst, float threshold, float val);
182  void tltgtVal(const core::ImgBase *poSrc, core::ImgBase **ppoDst,
183  float low, float lowVal, float hi, float hiVal);
184 
185  };
186 
187  // LATER ... DYNAMIC_UNARY_OP_CREATION_FUNCTION(ThresholdOp);
188 
189  } // namespace filter
190 } // namespace icl
191 
float m_fHighThreshold
Definition: ThresholdOp.h:167
float m_fHighVal
Definition: ThresholdOp.h:169
undocument this line if you encounter any issues!
Definition: Any.h:37
optype
this enum specifiy all possible thresholding operations
Definition: ThresholdOp.h:63
#define ICL_INSTANTIATE_ALL_DEPTHS
Definition: Macros.h:175
Definition: ThresholdOp.h:66
float getHighThreshold() const
returns the upper threshold
Definition: ThresholdOp.h:106
float getLowVal() const
returns the lower value
Definition: ThresholdOp.h:112
void setType(optype type)
sets the type of the thresholding operation
Definition: ThresholdOp.h:153
float m_fLowVal
Definition: ThresholdOp.h:168
void setLowThreshold(float lowThreshold)
sets the lower threshold
Definition: ThresholdOp.h:129
void setHighThreshold(float highThreshold)
sets the upper threshold
Definition: ThresholdOp.h:135
Definition: ThresholdOp.h:65
void setLowVal(float lowVal)
sets the lower value
Definition: ThresholdOp.h:141
void setHighVal(float highVal)
sets the upper value
Definition: ThresholdOp.h:147
float getLowThreshold() const
returns the lower threshold
Definition: ThresholdOp.h:100
Abstract Base class for Unary Operators.
Definition: UnaryOp.h:51
optype getType() const
returns the type of the thresholding operation
Definition: ThresholdOp.h:123
float getHighVal() const
returns the upper value
Definition: ThresholdOp.h:117
ICLQt_API core::Img< T > filter(const core::Img< T > &image, const std::string &filter)
applies a filter operation on the source image (affinity for float)
Class for thresholding operations.
Definition: ThresholdOp.h:59
Definition: ThresholdOp.h:68
Definition: ThresholdOp.h:64
float m_fLowThreshold
Definition: ThresholdOp.h:166
#define ICLFilter_API
Definition: CompatMacros.h:175
virtual void apply(const core::ImgBase *operand1, core::ImgBase **dst)=0
pure virtual apply function, that must be implemented in all derived classes
optype m_eType
Definition: ThresholdOp.h:170
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131
Definition: ThresholdOp.h:67