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.LGPL **
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 <ICLUtils/CompatMacros.h>
00034 #include <ICLFilter/UnaryOp.h>
00035 
00036 namespace icl {
00037   namespace filter{
00038     
00040 
00059     class ICLFilter_API ThresholdOp : public UnaryOp {
00060   
00061      public:
00063         enum optype{
00064           lt,
00065           gt,
00066           ltgt,
00067           ltVal,
00068           gtVal,
00069           ltgtVal
00070         };
00071         
00073 
00080         ThresholdOp(optype ttype,float lowThreshold=127, float highThreshold=127,float lowVal=0, float highVal=255 );
00081         
00082         
00084         virtual ~ThresholdOp();
00085         
00087 
00091         virtual void apply (const core::ImgBase *poSrc, core::ImgBase **ppoDst);
00092         
00094         using UnaryOp::apply;
00095   
00097 
00100         float getLowThreshold() const {return m_fLowThreshold;}
00101   
00103 
00106         float getHighThreshold() const {return m_fHighThreshold;}
00107         
00109 
00112         float getLowVal() const {return m_fLowVal;}
00114 
00117         float getHighVal() const {return m_fHighVal;}
00118         
00120 
00123         optype getType() const {return m_eType;}
00124         
00126 
00129         void setLowThreshold(float lowThreshold) {m_fLowThreshold=lowThreshold;}
00130   
00132 
00135         void setHighThreshold(float highThreshold) {m_fHighThreshold=highThreshold;}
00136         
00138 
00141         void setLowVal(float lowVal) {m_fLowVal=lowVal;}
00142         
00144 
00147         void setHighVal(float highVal) {m_fHighVal=highVal;}
00148         
00150 
00153         void setType(optype type) {m_eType=type;}
00154         
00155   #define ICL_INSTANTIATE_DEPTH(T)                                        \
00156         static void tlt(const core::Img## T*, core::Img##T*, icl##T);         \
00157         static void tgt(const core::Img## T*, core::Img##T*, icl##T);                 \
00158         static void tltgt(const core::Img## T*, core::Img##T*, icl##T, icl##T);       \
00159         static void tltVal(const core::Img## T*, core::Img##T*, icl##T, icl##T tVal); \
00160         static void tgtVal(const core::Img## T*, core::Img##T*, icl##T, icl##T tVal); \
00161         static void tltgtVal(const core::Img## T*, core::Img##T*, icl##T, icl##T, icl##T, icl##T);
00162         ICL_INSTANTIATE_ALL_DEPTHS
00163   #undef ICL_INSTANTIATE_DEPTH
00164   
00165      private:
00166         float m_fLowThreshold;
00167         float m_fHighThreshold;
00168         float m_fLowVal;
00169         float m_fHighVal;
00170         optype m_eType;
00172         void tlt(const core::ImgBase *poSrc, core::ImgBase **ppoDst, float threshold);
00174         void tgt(const core::ImgBase *poSrc, core::ImgBase **ppoDst, float threshold);
00176         void tltgt(const core::ImgBase *poSrc, core::ImgBase **ppoDst, float low, float hi);
00178         void tltVal(const core::ImgBase *poSrc, core::ImgBase **ppoDst, float threshold, float val);
00180         void tgtVal(const core::ImgBase *poSrc, core::ImgBase **ppoDst, float threshold, float val);
00182         void tltgtVal(const core::ImgBase *poSrc, core::ImgBase **ppoDst, 
00183                      float low, float lowVal, float hi, float hiVal);
00184   
00185      };
00186   
00187     // LATER ... DYNAMIC_UNARY_OP_CREATION_FUNCTION(ThresholdOp);
00188   
00189   } // namespace filter
00190 } // namespace icl
00191 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines