Image Component Library (ICL)
LUTOp3Channel.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/LUTOp3Channel.h **
10 ** Module : ICLFilter **
11 ** Authors: Christof Elbrechter **
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 <ICLUtils/Uncopyable.h>
35 #include <ICLCore/Img.h>
36 #include <ICLFilter/UnaryOp.h>
37 #include <vector>
38 
39 namespace icl {
40  namespace filter{
41 
43 
153  template<class T>
155  public:
156 
158 
163  public:
165  Plugin(){}
167 
172  Plugin(int ref1, int ref2, int ref3, int thresh){
173  m_aiRef[0] = ref1;
174  m_aiRef[1] = ref2;
175  m_aiRef[2] = ref3;
176  m_iThresh = thresh;
177  }
179  virtual ~Plugin(){}
180 
182 
195  virtual T transform(int v1, int v2, int v3){
196  return ::sqrt( ::pow((float) (v1-m_aiRef[0]),2) +
197  ::pow((float) (v2-m_aiRef[1]),2) +
198  ::pow((float) (v3-m_aiRef[2]),2) ) /
199  ::sqrt(3.0) < m_iThresh ? T(255) : T(0);
200  }
201  private:
202 
204  int m_aiRef[3];
205 
208  };
209 
211 
216  LUTOp3Channel(Plugin *p=0, icl8u shift=0);
217 
219  virtual ~LUTOp3Channel();
220 
222 
225  virtual void apply(const core::ImgBase *src, core::ImgBase **dst);
226 
228  using UnaryOp::apply;
229 
231 
235  void setPlugin(Plugin *p);
236 
239  Plugin *p = m_poPlugin;
240  m_poPlugin = 0;
241  return p;
242  }
243 
244  private:
245 
248 
251 
254  };
255 
256  } // namespace filter
257 } // namespace icl
258 
ICLQt_API ImgQ sqrt(const ImgQ &image)
calls sqrt( each pixel)
Plugin(int ref1, int ref2, int ref3, int thresh)
Constructor.
Definition: LUTOp3Channel.h:172
undocument this line if you encounter any issues!
Definition: Any.h:37
Class interface for un-copyable classes.
Definition: Uncopyable.h:64
Ipp8u icl8u
8Bit unsigned integer type for the ICL
Definition: BasicTypes.h:64
Internal plugin class for the LUTOp3Channel.
Definition: LUTOp3Channel.h:162
core::Img< T > m_oLUT
Image that holds the lut data.
Definition: LUTOp3Channel.h:247
virtual ~Plugin()
Destructor.
Definition: LUTOp3Channel.h:179
Plugin * m_poPlugin
Current plugin pointer.
Definition: LUTOp3Channel.h:250
Abstract Base class for Unary Operators.
Definition: UnaryOp.h:51
virtual T transform(int v1, int v2, int v3)
Transformation function.
Definition: LUTOp3Channel.h:195
int m_iThresh
euclidean distance threshold
Definition: LUTOp3Channel.h:207
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)
ICLQt_API ImgQ thresh(const ImgQ &image, float threshold)
performs an image binarisation for each channel with given threshold
#define ICLFilter_API
Definition: CompatMacros.h:175
Plugin * removePlugin()
removes the internal plugin so it is not deleted with the LUTOp
Definition: LUTOp3Channel.h:238
virtual void apply(const core::ImgBase *operand1, core::ImgBase **dst)=0
pure virtual apply function, that must be implemented in all derived classes
Plugin()
Empty constructor.
Definition: LUTOp3Channel.h:165
ImgBase is the Image-Interface class that provides save access to underlying Img-template .
Definition: ImgBase.h:131
class for applying table look-up transformation to 3-channel integer-valued images
Definition: LUTOp3Channel.h:154
icl8u m_ucShift
channel range increment (...)
Definition: LUTOp3Channel.h:253