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

dual_input_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 
00029 
00030 #ifndef MLN_MORPHO_TREE_DUAL_INPUT_TREE_HH
00031 # define MLN_MORPHO_TREE_DUAL_INPUT_TREE_HH
00032 
00033 # include <mln/data/sort_psites.hh>
00034 
00035 # include <mln/morpho/tree/data.hh>
00036 # include <mln/morpho/tree/impl/dual_union_find.hh>
00037 # include <mln/morpho/tree/impl/dual_hqueue.hh>
00038 
00039 namespace mln
00040 {
00041 
00042   namespace morpho
00043   {
00044 
00045     namespace tree
00046     {
00047 
00056       template <typename I, typename N>
00057       inline
00058       data< I, p_array<mln_psite(I)> >
00059       dual_input_max_tree(const Image<I>& f,
00060                           const Image<I>& m,
00061                           const Neighborhood<N>& nbh);
00062 
00063 
00064 # ifndef MLN_INCLUDE_ONLY
00065 
00066       namespace internal
00067       {
00068 
00069         template <typename I, typename N>
00070         inline
00071         data< I, p_array<mln_psite(I)> >
00072         dual_input_max_tree_dispatch(trait::image::quant::any,
00073                                      const I& f,
00074                                      const I& m,
00075                                      const N& nbh)
00076         {
00077           typedef p_array<mln_psite(I)> S;
00078           typedef data<I,S> tree_t;
00079 
00080           S s_f = mln::data::sort_psites_increasing(f);
00081           S s_m = mln::data::sort_psites_increasing(m);
00082 
00083           tree_t tree = impl::generic::dual_union_find(f, m, s_f, s_m, nbh);
00084           return tree;
00085         }
00086 
00087         template <typename I, typename N>
00088         inline
00089         data< I, p_array<mln_psite(I)> >
00090         dual_input_max_tree_dispatch(trait::image::quant::low,
00091                                      const I& f,
00092                                      const I& m,
00093                                      const N& nbh)
00094         {
00095           typedef p_array<mln_psite(I)> S;
00096           typedef data<I,S> tree_t;
00097 
00098           tree_t tree = impl::dual_hqueue(f, m, nbh);
00099           return tree;
00100         }
00101 
00102       } // end of namespace mln::morpho::tree::internal
00103 
00104 
00105       // Facades.
00106       template <typename I, typename N>
00107       inline
00108       morpho::tree::data< I, p_array<mln_psite(I)> >
00109       dual_input_max_tree(const Image<I>& f_,
00110                           const Image<I>& m_,
00111                           const Neighborhood<N>& nbh_)
00112       {
00113         trace::entering("morpho::tree::dual_input_max_tree");
00114 
00115         const I& f = exact(f_);
00116         const I& m = exact(m_);
00117         const N& nbh = exact(nbh_);
00118 
00119         mln_precondition(f.is_valid());
00120         mln_precondition(m.is_valid());
00121         mln_precondition(nbh.is_valid());
00122         mln_precondition(f.domain() == m.domain());
00123 
00124         typedef p_array<mln_psite(I)> S;
00125         typedef data<I,S> tree_t;
00126 
00127         tree_t tree = internal::dual_input_max_tree_dispatch(mln_trait_image_quant(I)(), f, m, nbh);
00128 
00129         trace::exiting("morpho::tree::dual_input_max_tree");
00130         return tree;
00131       }
00132 
00133 
00134 
00135 
00136 
00137 # endif // ! MLN_INCLUDE_ONLY
00138 
00139     } // end of namespace mln::morpho::tree
00140 
00141   } // end of namespace mln::morpho
00142 
00143 } // end of namespace mln
00144 
00145 
00146 #endif // !MLN_MORPHO_TREE_DUAL_INPUT_TREE_HH

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