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
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 }
00103
00104
00105
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 }
00140
00141 }
00142
00143 }
00144
00145
00146 #endif // !MLN_MORPHO_TREE_DUAL_INPUT_TREE_HH