• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

component_tree.hh

00001 // Copyright (C) 2008, 2009 EPITA Research and Development Laboratory (LRDE)
00002 //
00003 // This file is part of Olena.
00004 //
00005 // Olena is free software: you can redistribute it and/or modify it under
00006 // the terms of the GNU General Public License as published by the Free
00007 // Software Foundation, version 2 of the License.
00008 //
00009 // Olena is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Olena.  If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 // As a special exception, you may use this file as part of a free
00018 // software project without restriction.  Specifically, if other files
00019 // instantiate templates or use macros or inline functions from this
00020 // file, or you compile this file and link it with other files to produce
00021 // an executable, this file does not by itself cause the resulting
00022 // executable to be covered by the GNU General Public License.  This
00023 // exception does not however invalidate any other reasons why the
00024 // executable file might be covered by the GNU General Public License.
00025 
00026 
00030 
00031 
00032 #ifndef MLN_MORPHO_TREE_COMPONENT_TREE_HH
00033 # define MLN_MORPHO_TREE_COMPONENT_TREE_HH
00034 
00035 # include <mln/data/sort_psites.hh>
00036 # include <mln/morpho/tree/data.hh>
00037 
00038 namespace mln
00039 {
00040 
00041   namespace morpho
00042   {
00043 
00044     namespace tree
00045     {
00046 
00054       template <typename I, typename N>
00055       inline
00056       data< I, p_array<mln_psite(I)> >
00057       min_tree(const Image<I>& f, const Neighborhood<N>& nbh);
00058 
00066       template <typename I, typename N>
00067       inline
00068       data< I, p_array<mln_psite(I)> >
00069       max_tree(const Image<I>& f, const Neighborhood<N>& nbh);
00070 
00071 
00072 # ifndef MLN_INCLUDE_ONLY
00073 
00074       template <typename I, typename N>
00075       inline
00076       data< I, p_array<mln_psite(I)> >
00077       min_tree(const Image<I>& f_, const Neighborhood<N>& nbh_)
00078       {
00079         trace::entering("morpho::tree::min_tree");
00080 
00081         const I& f = exact(f_);
00082         const N& nbh = exact(nbh_);
00083 
00084         mln_precondition(f.is_valid());
00085         mln_precondition(nbh.is_valid());
00086 
00087         typedef p_array<mln_psite(I)> S;
00088         typedef data<I,S> tree_t;
00089 
00090         S s = mln::data::sort_psites_decreasing(f);
00091         tree_t tree(f, s, nbh);
00092 
00093         trace::exiting("morpho::tree::min_tree");
00094         return tree;
00095       }
00096 
00097       template <typename I, typename N>
00098       inline
00099       data< I, p_array<mln_psite(I)> >
00100       max_tree(const Image<I>& f_, const Neighborhood<N>& nbh_)
00101       {
00102         trace::entering("morpho::tree::max_tree");
00103 
00104         const I& f = exact(f_);
00105         const N& nbh = exact(nbh_);
00106 
00107         mln_precondition(f.is_valid());
00108         mln_precondition(nbh.is_valid());
00109 
00110         typedef p_array<mln_psite(I)> S;
00111         typedef data<I,S> tree_t;
00112 
00113         S s = mln::data::sort_psites_increasing(f);
00114         tree_t tree(f, s, nbh);
00115 
00116         trace::exiting("morpho::tree::max_tree");
00117         return tree;
00118       }
00119 
00120 # endif // ! MLN_INCLUDE_ONLY
00121 
00122     } // end of namespace mln::morpho::tree
00123 
00124   } // end of namespace mln::morpho
00125 
00126 } // end of namespace mln
00127 
00128 #endif // !MLN_MORPHO_TREE_COMPONENT_TREE_HH

Generated on Tue Oct 4 2011 15:23:38 for Milena (Olena) by  doxygen 1.7.1