Image Component Library (ICL)
|
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/LocalThresholdOp.h ** 00010 ** Module : ICLFilter ** 00011 ** Authors: Christof Elbrechter, 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 #include <ICLUtils/Size.h> 00035 #include <vector> 00036 #include <ICLUtils/Uncopyable.h> 00037 00038 namespace icl{ 00039 namespace filter{ 00040 00042 class IntegralImgOp; 00043 class UnaryCompareOp; 00044 class BinaryCompareOp; 00047 00048 00164 class LocalThresholdOp : public UnaryOp, public utils::Uncopyable{ 00165 public: 00166 00168 enum algorithm{ 00169 regionMean, 00170 tiledNN, 00171 tiledLIN 00172 }; 00173 00175 00181 LocalThresholdOp(unsigned int maskSize=10, float globalThreshold=0, float gammaSlope=0); 00182 00183 00185 LocalThresholdOp(algorithm a, int maskSize=10, float globalThreshold=0, float gammaSlope=0); 00186 00187 00189 ~LocalThresholdOp(); 00190 00192 00195 virtual void apply(const core::ImgBase *src, core::ImgBase **dst); 00196 00198 using UnaryOp::apply; 00199 00201 void setMaskSize(unsigned int maskSize); 00202 00204 void setGlobalThreshold(float globalThreshold); 00205 00207 void setGammaSlope(float gammaSlope); 00208 00210 void setup(unsigned int maskSize, float globalThreshold, algorithm a=regionMean, float gammaSlope=0); 00211 00213 unsigned int getMaskSize() const; 00214 00216 float getGlobalThreshold() const; 00217 00219 float getGammaSlope() const; 00220 00222 algorithm getAlgorithm() const ; 00223 00225 void setAlgorithm(algorithm a); 00226 00227 private: 00228 00230 template<algorithm a> 00231 void apply_a(const core::ImgBase *src, core::ImgBase **dst); 00232 00234 // property unsigned int m_maskSize; 00235 00237 // property float m_globalThreshold; 00238 00240 // property float m_gammaSlope; 00241 00243 core::ImgBase *m_roiBufSrc; 00244 00246 core::ImgBase *m_roiBufDst; 00247 00249 IntegralImgOp *m_iiOp; 00250 00253 00255 BinaryCompareOp *m_cmp; 00256 00258 core::ImgBase *m_tiledBuf1; 00259 00261 core::ImgBase *m_tiledBuf2; 00262 00263 }; 00264 00265 } // namespace filter 00266 }