nagao.hh

00001 // Copyright (C) 2004  EPITA Research and Development Laboratory
00002 //
00003 // This file is part of the Olena Library.  This library is free
00004 // software; you can redistribute it and/or modify it under the terms
00005 // of the GNU General Public License version 2 as published by the
00006 // Free Software Foundation.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU General Public License
00014 // along with this library; see the file COPYING.  If not, write to
00015 // the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
00016 // MA 02111-1307, USA.
00017 //
00018 // As a special exception, you may use this file as part of a free
00019 // software library without restriction.  Specifically, if other files
00020 // instantiate templates or use macros or inline functions from this
00021 // file, or you compile this file and link it with other files to
00022 // produce an executable, this file does not by itself cause the
00023 // resulting executable to be covered by the GNU General Public
00024 // License.  This exception does not however invalidate any other
00025 // reasons why the executable file might be covered by the GNU General
00026 // Public License.
00027 
00028 
00029 #ifndef OLN_CONVOL_NAGAO_HH
00030 # define OLN_CONVOL_NAGAO_HH
00031 
00032 # include <oln/utils/se_stat.hh>
00033 # include <oln/core/abstract/struct_elt.hh>
00034 # include <oln/core/abstract/image.hh>
00035 # include <oln/core/image.hh>
00036 # include <oln/core/abstract/image_with_type_with_dim.hh>
00037 # include <mlc/array/1d.hh>
00038 # include <mlc/cmp.hh>
00039 
00040 
00041 namespace oln {
00042   namespace convol{
00043     namespace internal {
00049       template <unsigned Size, class S>
00050       struct se_array
00051       {
00053         typedef mlc_exact_type(oln::abstract::struct_elt<S>) struct_elt_type;
00054 
00056         typedef typename mlc::array1d<typename mlc::array1d_info<Size>,
00057                                       struct_elt_type > array_type;
00058 
00060         enum {size = Size};
00061 
00062         se_array():delta_(0){}
00063 
00065         struct_elt_type&
00066         operator[](int i)
00067         {
00068           delta_ = -1;
00069           precondition(0 <= i < Size);
00070           return tab[i];
00071         }
00072 
00074         struct_elt_type
00075         operator[](int i) const
00076         {
00077           precondition(0 <= i < Size);
00078           return tab[i];
00079         }
00080 
00082         coord
00083         delta() const
00084         {
00085           // if not updated, compute the maximum.
00086           if (delta_ <= 0)
00087             {
00088               for (unsigned i = 0; i < Size; ++i)
00089                 if (tab[i].delta() > delta_)
00090                   delta_ = tab[i].delta();
00091             }
00092           postcondition (delta_ >= 0);
00093           return delta_;
00094         }
00095       protected:
00097         array_type tab;
00103         mutable coord delta_;
00104       };
00105 
00121       template<class I, class SE, unsigned Size, typename Sum>
00122       inline Sum
00123       mean_of_smaller_variance(const oln::abstract::image<I> &im,
00124                                const oln_point_type(I) &p,
00125                                const internal::se_array<Size, SE> &w);
00126     } // end namespace internal
00127 
00138     template <class I, unsigned Size, typename SE, typename Sum>
00139     inline oln_concrete_type(I)
00140     nagao_generalized(const oln::abstract::image<I>& in,
00141                       const internal::se_array<Size, SE> &sa);
00142 
00143     template <class I>
00144     inline oln_concrete_type(I)
00145     nagao(const oln::abstract::non_vectorial_image_with_dim<2, I>& in);
00146 
00147 
00148     template <class I>
00149     inline oln_concrete_type(I)
00150     nagao(const oln::abstract::vectorial_image_with_dim<2, I>& in);
00151   } // end namespace convol
00152 
00153 } // end namespace oln
00154 
00155 #include "nagao.hxx"
00156 
00157 #endif // OLENA_CONVOL_NAGAO_HH

Generated on Thu Apr 15 20:13:13 2004 for Olena by doxygen 1.3.6-20040222