00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
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     } 
00123 
00124   } 
00125 
00126 } 
00127 
00128 #endif // !MLN_MORPHO_TREE_COMPONENT_TREE_HH