
Index: olena/ChangeLog from Giovanni Palma <giovanni@lrde.epita.fr> * oln/morpho/attribute_closing_opening.hh: Make the opening/closing choice at compile time. * oln/morpho/attribute_union_find.hh: Likewise. * oln/utils/histogram.hh: Add a distrib sort functor. Index: NEWS --- NEWS Tue, 10 Feb 2004 15:35:04 +0100 palma_g (oln/0_NEWS 1.18 640) +++ NEWS Tue, 10 Feb 2004 17:19:37 +0100 palma_g (oln/0_NEWS 1.18 640) @@ -11,7 +11,7 @@ rectangle, volume, height, maxvalue, minvalue). * Change the color conversion system - - CIE RGB is the main color system e.g. it can be converted + - CIE RGB is the main color system i.e. it can be converted directly into any other color system. - Conversion between 2 color systems should pass by the RGB one. Index: olena/oln/utils/histogram.hh --- olena/oln/utils/histogram.hh Fri, 06 Feb 2004 16:02:37 +0100 palma_g (oln/10_histogram. 1.6.1.14.1.4 640) +++ olena/oln/utils/histogram.hh Tue, 10 Feb 2004 17:13:39 +0100 palma_g (oln/10_histogram. 1.6.1.14.1.4 640) @@ -523,6 +523,30 @@ *(ptr[unsigned(im[p] - ntg_min_val(val))]++) = p; } + // to select staticly the good distrib_sort + template <bool reverse> + struct select_distrib_sort + { + template <class I> + void + operator ()(const oln::abstract::image<I>& im, + std::vector<oln_point_type(I)> &v) + { + distrib_sort_inv(im, v); + } + }; + + template <> + struct select_distrib_sort<true> + { + template <class I> + void + operator ()(const oln::abstract::image<I>& im, + std::vector<oln_point_type(I)> &v) + { + distrib_sort(im, v); + } + }; } // end of namespace utils } // end of namespace oln Index: olena/oln/morpho/attribute_closing_opening.hh --- olena/oln/morpho/attribute_closing_opening.hh Mon, 09 Feb 2004 18:57:03 +0100 palma_g (oln/q/49_attribute_ 1.12 640) +++ olena/oln/morpho/attribute_closing_opening.hh Tue, 10 Feb 2004 16:52:24 +0100 palma_g (oln/q/49_attribute_ 1.12 640) @@ -43,9 +43,10 @@ const abstract::neighborhood<N>& Ng, const attr_lambda_type(A) &lambda) { + typedef N toto; typedef tarjan::tarjan_set<oln_concrete_type(I), A > tarjan_set_type; - tarjan_set_type area_closing(input.exact(), attr_env_type(A)()); - return area_closing.get_comptute(lambda, Ng, true); + tarjan_set_type attr_closing(input.exact(), attr_env_type(A)()); + return attr_closing.template get_comptute<true>(lambda, Ng); } // attribute opening @@ -56,8 +57,8 @@ const attr_lambda_type(A) &lambda) { typedef tarjan::tarjan_set<oln_concrete_type(I), A > tarjan_set_type; - tarjan_set_type area_opening(input.exact(), attr_env_type(A)()); - return area_opening.get_comptute(lambda , Ng, false); + tarjan_set_type attr_opening(input.exact(), attr_env_type(A)()); + return attr_opening.template get_comptute<false>(lambda, Ng); } } // !internal Index: olena/oln/morpho/attribute_union_find.hh --- olena/oln/morpho/attribute_union_find.hh Mon, 09 Feb 2004 18:57:03 +0100 palma_g (oln/q/50_attribute_ 1.10 640) +++ olena/oln/morpho/attribute_union_find.hh Tue, 10 Feb 2004 17:15:02 +0100 palma_g (oln/q/50_attribute_ 1.10 640) @@ -171,20 +171,16 @@ // bool closing = true -> a closing is performed, // an opening otherwise. - template<class N> + template<bool closing, class N> image_type get_comptute(const lambda_type & lambda, - const abstract::neighborhood<N>& Ng, - const bool closing) + const abstract::neighborhood<N>& Ng) { lambda_ = λ std::vector<point_type> I(input_.npoints()); - if (closing) - oln::utils::distrib_sort(input_, I); - else - oln::utils::distrib_sort_inv(input_, I); + oln::utils::select_distrib_sort<closing>()(input_, I); level::fill(aux_data_, ntg_sup_val(lambda_type)); aux_data_.border_adapt_assign(Ng.delta(), ntg_sup_val(lambda_type)); -- Giovanni Palma EPITA - promo 2005 - membre d'EpX - LRDE Mob. : +33 (0)6 60 97 31 74