Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
NeighborhoodOp.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/NeighborhoodOp.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 
00035 namespace icl {
00036   namespace filter{
00038 
00058     class NeighborhoodOp : public UnaryOp {
00059       public:
00060       
00062       virtual ~NeighborhoodOp(){}
00063       
00065 
00075       bool computeROI(const core::ImgBase *poSrc, utils::Point& oROIoffset, utils::Size& oROIsize);
00076   
00078       virtual void applyMT(const core::ImgBase *operand1, core::ImgBase **dst, unsigned int nThreads);
00079       
00081       using UnaryOp::apply;
00082       
00083       protected:
00084       NeighborhoodOp() : m_oMaskSize(1,1), m_oAnchor (0,0) {}
00085       NeighborhoodOp(const utils::Size &size) {
00086         setMask (size);
00087       }
00088       
00089       void setMask(const utils::Size &size) {
00090           m_oMaskSize = adaptSize(size);
00091           m_oAnchor   = utils::Point (m_oMaskSize.width/2, m_oMaskSize.height/2);
00092       }
00093       void setMask(const utils::Size &size, const utils::Point &anchor){
00094         m_oMaskSize = adaptSize(size);
00095         m_oAnchor = anchor;
00096       }
00097       void setROIOffset(const utils::Point &offs){
00098         m_oROIOffset = offs;
00099       }
00100       public:
00101       const utils::Size &getMaskSize() const{
00102         return m_oMaskSize;
00103       } 
00104       const utils::Point &getAnchor() const {
00105         return m_oAnchor;
00106       }
00107       const utils::Point &getROIOffset() const{
00108         return m_oROIOffset;
00109       }
00110       protected:
00111   
00113       virtual bool prepare (core::ImgBase **ppoDst, const core::ImgBase *poSrc);
00114       
00116       virtual bool prepare (core::ImgBase **ppoDst, const core::ImgBase *poSrc, core::depth eDepht);
00117       
00119 
00125       virtual utils::Size adaptSize(const utils::Size &size){ return size; }
00126        
00127       protected:
00129       utils::Size  m_oMaskSize;  
00130       utils::Point m_oAnchor;    
00131       utils::Point m_oROIOffset; 
00132     };
00133   } // namespace filter
00134 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines