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.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 <ICLUtils/Uncopyable.h> 00035 #include <ICLUtils/Size.h> 00036 #include <ICLFilter/UnaryOp.h> 00037 #include <vector> 00038 00039 namespace icl{ 00040 namespace filter{ 00041 00043 class IntegralImgOp; 00044 class UnaryCompareOp; 00045 class BinaryCompareOp; 00048 00049 00165 class ICLFilter_API LocalThresholdOp : public UnaryOp, public utils::Uncopyable{ 00166 public: 00167 00169 enum algorithm{ 00170 regionMean, 00171 tiledNN, 00172 tiledLIN 00173 }; 00174 00176 00182 LocalThresholdOp(unsigned int maskSize=10, float globalThreshold=0, float gammaSlope=0); 00183 00184 00186 LocalThresholdOp(algorithm a, int maskSize=10, float globalThreshold=0, float gammaSlope=0); 00187 00188 00190 ~LocalThresholdOp(); 00191 00193 00196 virtual void apply(const core::ImgBase *src, core::ImgBase **dst); 00197 00199 using UnaryOp::apply; 00200 00202 void setMaskSize(unsigned int maskSize); 00203 00205 void setGlobalThreshold(float globalThreshold); 00206 00208 void setGammaSlope(float gammaSlope); 00209 00211 void setup(unsigned int maskSize, float globalThreshold, algorithm a=regionMean, float gammaSlope=0); 00212 00214 unsigned int getMaskSize() const; 00215 00217 float getGlobalThreshold() const; 00218 00220 float getGammaSlope() const; 00221 00223 algorithm getAlgorithm() const ; 00224 00226 void setAlgorithm(algorithm a); 00227 00228 private: 00229 00231 template<algorithm a> 00232 void apply_a(const core::ImgBase *src, core::ImgBase **dst); 00233 00235 // property unsigned int m_maskSize; 00236 00238 // property float m_globalThreshold; 00239 00241 // property float m_gammaSlope; 00242 00244 core::ImgBase *m_roiBufSrc; 00245 00247 core::ImgBase *m_roiBufDst; 00248 00250 IntegralImgOp *m_iiOp; 00251 00254 00256 BinaryCompareOp *m_cmp; 00257 00259 core::ImgBase *m_tiledBuf1; 00260 00262 core::ImgBase *m_tiledBuf2; 00263 00264 }; 00265 00266 } // namespace filter 00267 }