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.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{
00039 
00059     class ICLFilter_API NeighborhoodOp : public UnaryOp {
00060       public:
00061       
00063       virtual ~NeighborhoodOp(){}
00064       
00066 
00076       bool computeROI(const core::ImgBase *poSrc, utils::Point& oROIoffset, utils::Size& oROIsize);
00077   
00079       virtual void applyMT(const core::ImgBase *operand1, core::ImgBase **dst, unsigned int nThreads);
00080       
00082       using UnaryOp::apply;
00083       
00084       protected:
00085       NeighborhoodOp() : m_oMaskSize(1,1), m_oAnchor (0,0) {}
00086       NeighborhoodOp(const utils::Size &size) {
00087         setMask (size);
00088       }
00089       
00090       void setMask(const utils::Size &size) {
00091           m_oMaskSize = adaptSize(size);
00092           m_oAnchor   = utils::Point (m_oMaskSize.width/2, m_oMaskSize.height/2);
00093       }
00094       void setMask(const utils::Size &size, const utils::Point &anchor){
00095         m_oMaskSize = adaptSize(size);
00096         m_oAnchor = anchor;
00097       }
00098       void setROIOffset(const utils::Point &offs){
00099         m_oROIOffset = offs;
00100       }
00101       public:
00102       const utils::Size &getMaskSize() const{
00103         return m_oMaskSize;
00104       } 
00105       const utils::Point &getAnchor() const {
00106         return m_oAnchor;
00107       }
00108       const utils::Point &getROIOffset() const{
00109         return m_oROIOffset;
00110       }
00111       protected:
00112   
00114       virtual bool prepare (core::ImgBase **ppoDst, const core::ImgBase *poSrc);
00115       
00117       virtual bool prepare (core::ImgBase **ppoDst, const core::ImgBase *poSrc, core::depth eDepht);
00118       
00120 
00126       virtual utils::Size adaptSize(const utils::Size &size){ return size; }
00127        
00128       protected:
00130       utils::Size  m_oMaskSize;  
00131       utils::Point m_oAnchor;    
00132       utils::Point m_oROIOffset; 
00133     };
00134   } // namespace filter
00135 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines