Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
ThresholdOp.h
Go to the documentation of this file.
00001 /********************************************************************
00002 **                Image Component Library (ICL)                    **
00003 **                                                                 **
00004 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld          **
00005 **                         Neuroinformatics Group                  **
00006 ** Website: www.iclcv.org and                                      **
00007 **          http://opensource.cit-ec.de/projects/icl               **
00008 **                                                                 **
00009 ** File   : ICLFilter/src/ICLFilter/ThresholdOp.h                  **
00010 ** Module : ICLFilter                                              **
00011 ** Authors: Christof Elbrechter, Robert Haschke, Andre Justus      **
00012 **                                                                 **
00013 **                                                                 **
00014 ** GNU LESSER GENERAL PUBLIC LICENSE                               **
00015 ** This file may be used under the terms of the GNU Lesser General **
00016 ** Public License version 3.0 as published by the                  **
00017 **                                                                 **
00018 ** Free Software Foundation and appearing in the file LICENSE.GPL  **
00019 ** included in the packaging of this file.  Please review the      **
00020 ** following information to ensure the license requirements will   **
00021 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt                **
00022 **                                                                 **
00023 ** The development of this software was supported by the           **
00024 ** Excellence Cluster EXC 277 Cognitive Interaction Technology.    **
00025 ** The Excellence Cluster EXC 277 is a grant of the Deutsche       **
00026 ** Forschungsgemeinschaft (DFG) in the context of the German       **
00027 ** Excellence Initiative.                                          **
00028 **                                                                 **
00029 ********************************************************************/
00030 
00031 #pragma once
00032 
00033 #include <ICLFilter/UnaryOp.h>
00034 
00035 namespace icl {
00036   namespace filter{
00037     
00039 
00058      class ThresholdOp : public UnaryOp {
00059   
00060      public:
00062         enum optype{
00063           lt,
00064           gt,
00065           ltgt,
00066           ltVal,
00067           gtVal,
00068           ltgtVal
00069         };
00070         
00072 
00079         ThresholdOp(optype ttype,float lowThreshold=127, float highThreshold=127,float lowVal=0, float highVal=255 );
00080         
00081         
00083         virtual ~ThresholdOp();
00084         
00086 
00090         virtual void apply (const core::ImgBase *poSrc, core::ImgBase **ppoDst);
00091         
00093         using UnaryOp::apply;
00094   
00096 
00099         float getLowThreshold() const {return m_fLowThreshold;}
00100   
00102 
00105         float getHighThreshold() const {return m_fHighThreshold;}
00106         
00108 
00111         float getLowVal() const {return m_fLowVal;}
00113 
00116         float getHighVal() const {return m_fHighVal;}
00117         
00119 
00122         optype getType() const {return m_eType;}
00123         
00125 
00128         void setLowThreshold(float lowThreshold) {m_fLowThreshold=lowThreshold;}
00129   
00131 
00134         void setHighThreshold(float highThreshold) {m_fHighThreshold=highThreshold;}
00135         
00137 
00140         void setLowVal(float lowVal) {m_fLowVal=lowVal;}
00141         
00143 
00146         void setHighVal(float highVal) {m_fHighVal=highVal;}
00147         
00149 
00152         void setType(optype type) {m_eType=type;}
00153         
00154   #define ICL_INSTANTIATE_DEPTH(T)                                        \
00155         static void tlt(const core::Img## T*, core::Img##T*, icl##T);         \
00156         static void tgt(const core::Img## T*, core::Img##T*, icl##T);                 \
00157         static void tltgt(const core::Img## T*, core::Img##T*, icl##T, icl##T);       \
00158         static void tltVal(const core::Img## T*, core::Img##T*, icl##T, icl##T tVal); \
00159         static void tgtVal(const core::Img## T*, core::Img##T*, icl##T, icl##T tVal); \
00160         static void tltgtVal(const core::Img## T*, core::Img##T*, icl##T, icl##T, icl##T, icl##T);
00161         ICL_INSTANTIATE_ALL_DEPTHS
00162   #undef ICL_INSTANTIATE_DEPTH
00163   
00164      private:
00165         float m_fLowThreshold;
00166         float m_fHighThreshold;
00167         float m_fLowVal;
00168         float m_fHighVal;
00169         optype m_eType;
00171         void tlt(const core::ImgBase *poSrc, core::ImgBase **ppoDst, float threshold);
00173         void tgt(const core::ImgBase *poSrc, core::ImgBase **ppoDst, float threshold);
00175         void tltgt(const core::ImgBase *poSrc, core::ImgBase **ppoDst, float low, float hi);
00177         void tltVal(const core::ImgBase *poSrc, core::ImgBase **ppoDst, float threshold, float val);
00179         void tgtVal(const core::ImgBase *poSrc, core::ImgBase **ppoDst, float threshold, float val);
00181         void tltgtVal(const core::ImgBase *poSrc, core::ImgBase **ppoDst, 
00182                      float low, float lowVal, float hi, float hiVal);
00183   
00184      };
00185   
00186     // LATER ... DYNAMIC_UNARY_OP_CREATION_FUNCTION(ThresholdOp);
00187   
00188   } // namespace filter
00189 } // namespace icl
00190 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines