cleanup-2008 2042: Starting the migration point -> site.

https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena Index: ChangeLog from Thierry Geraud <thierry.geraud@lrde.epita.fr> Starting the migration point -> site. This patch is a start to fix the point / site ambiguity due to genericity. The main idea is to deactivate the point-related macros so that a lot of "non-generic" code does not work anymore. We change mln_[d]point(I) into mln_[d]psite(I) in order to have "probably-generic" code work again. Then fix code from the doc tutorial examples. Step 1. * mln/core/macros.hh (mln_point, mln_point_): Deactivate. (mln_dpoint, mln_dpoint_): Likewise. Step 2. * mln/subsampling/subsampling.hh, * mln/subsampling/gaussian_subsampling.hh, * mln/debug/println_with_border.spe.hh, * mln/core/translate_image.hh, * mln/core/sparse_encode.hh, * mln/core/interpolated.hh, * mln/core/value_encode.hh, * mln/core/mono_obased_rle_encode.hh, * mln/core/pixel.hh, * mln/core/t_image.hh, * mln/core/mono_rle_encode.hh, * mln/core/tr_image.hh, * mln/core/init.hh, * mln/core/obased_rle_encode.hh, * mln/core/rle_encode.hh, * mln/core/a_point_of.hh, * mln/draw/line.hh, * mln/draw/box.hh, * mln/level/fill.hh, * mln/level/memset_.hh, * mln/level/median.hh, * mln/level/paste.spe.hh, * mln/linear/line_convolve.hh, * mln/linear/gaussian.hh, * mln/make/pixel.hh, * mln/make/voronoi.hh, * mln/border/fill.hh, * mln/border/duplicate.hh, * mln/border/mirror.hh, * mln/convert/to_window.hh, * mln/convert/to_p_set.hh, * mln/convert/to_w_window.hh, * mln/geom/pmin_pmax.hh, * mln/geom/resize.hh, * mln/morpho/erosion_fast.hh, * mln/morpho/rank_filter.hh, * mln/morpho/Rd.hh, * mln/morpho/dilation_fast.hh, * mln/display/color_pretty.hh, * mln/canvas/chamfer.hh, * mln/canvas/browsing/dir_struct_elt_incr_update.hh, * mln/canvas/browsing/directional.hh, * mln/canvas/labeling.hh, * mln/util/greater_point.hh, * mln/util/lemmings.hh, * sandbox/duhamel/translate_image.hh, * sandbox/duhamel/canvas_chamfer.hh, * sandbox/duhamel/canvas_labeling.hh, * sandbox/duhamel/labeling_algo.hh, * sandbox/duhamel/border_duplicate.hh, * sandbox/duhamel/draw_mesh.hh, * sandbox/duhamel/debug_print_3d_with_border.hh, * sandbox/duhamel/labeling_cpy_from_mln.hh, * sandbox/duhamel/border_fill.hh, * sandbox/duhamel/labeling_level.hh, * sandbox/duhamel/labeling.hh, * sandbox/nivault/median.hh, * sandbox/jardonnet/subsampling/gaussian_subsampling.hh, * sandbox/jardonnet/subsampling/sub_sampled_image.hh, * sandbox/jardonnet/registration/tools.hh, * sandbox/jardonnet/registration/chamfer.hh, * sandbox/geraud/cs2d/cs2d_morpho.hh, * sandbox/garrigues/image_identity/interpolated.hh, * sandbox/folio/canevas_dt.hh (mln_point(I)): Rename as... (mln_psite(I)): ...this. (mln_dpoint(I)): Rename as... (mln_dpsite(I)): ...this. Step 3. * doc/tutorial/examples/p_array.2.cc: New test; == on window<D>. * mln/core/window.hh (operator==): New. (is_symmetric): Rewrite. (include): Remove dependencies to box, dpoint, and sym. (todo): New one. * mln/core/dpoints_pixter.hh (point_site): Remove dependency. * mln/core/concept/value_iterator.hh: Likewise. * mln/core/concept/site_set.hh: Likewise. * mln/core/concept/window.hh (operator==): Remove; this operator cannot be general. * mln/geom/bbox.hh (bbox): Remove all overloads except... (bbox): ...this and rewrite it. * mln/util/set.hh: Add inheritance from Object. (operator): New bunch of operators. doc/tutorial/examples/p_array.2.cc | 2 mln/border/duplicate.hh | 8 - mln/border/fill.hh | 8 - mln/border/mirror.hh | 2 mln/canvas/browsing/dir_struct_elt_incr_update.hh | 4 mln/canvas/browsing/directional.hh | 2 mln/canvas/chamfer.hh | 2 mln/canvas/labeling.hh | 2 mln/convert/to_p_set.hh | 8 - mln/convert/to_w_window.hh | 6 mln/convert/to_window.hh | 6 mln/core/a_point_of.hh | 4 mln/core/concept/site_set.hh | 1 mln/core/concept/value_iterator.hh | 3 mln/core/concept/window.hh | 32 ---- mln/core/dpoints_pixter.hh | 17 +- mln/core/init.hh | 2 mln/core/interpolated.hh | 4 mln/core/macros.hh | 20 +-- mln/core/mono_obased_rle_encode.hh | 12 - mln/core/mono_rle_encode.hh | 12 - mln/core/obased_rle_encode.hh | 12 - mln/core/pixel.hh | 10 - mln/core/rle_encode.hh | 12 - mln/core/sparse_encode.hh | 12 - mln/core/t_image.hh | 42 +++--- mln/core/tr_image.hh | 6 mln/core/translate_image.hh | 16 +- mln/core/value_encode.hh | 12 - mln/core/window.hh | 24 ++- mln/debug/println_with_border.spe.hh | 2 mln/display/color_pretty.hh | 24 +-- mln/draw/box.hh | 12 - mln/draw/line.hh | 4 mln/geom/bbox.hh | 116 ++++++------------ mln/geom/pmin_pmax.hh | 12 - mln/geom/resize.hh | 2 mln/level/fill.hh | 6 mln/level/median.hh | 12 - mln/level/memset_.hh | 4 mln/level/paste.spe.hh | 2 mln/linear/gaussian.hh | 8 - mln/linear/line_convolve.hh | 2 mln/make/pixel.hh | 8 - mln/make/voronoi.hh | 2 mln/morpho/Rd.hh | 6 mln/morpho/dilation_fast.hh | 4 mln/morpho/erosion_fast.hh | 4 mln/morpho/rank_filter.hh | 2 mln/subsampling/gaussian_subsampling.hh | 4 mln/subsampling/subsampling.hh | 4 mln/util/greater_point.hh | 4 mln/util/lemmings.hh | 28 ++-- mln/util/set.hh | 54 ++++++++ sandbox/duhamel/border_duplicate.hh | 8 - sandbox/duhamel/border_fill.hh | 20 +-- sandbox/duhamel/canvas_chamfer.hh | 2 sandbox/duhamel/canvas_labeling.hh | 4 sandbox/duhamel/debug_print_3d_with_border.hh | 2 sandbox/duhamel/draw_mesh.hh | 2 sandbox/duhamel/labeling.hh | 2 sandbox/duhamel/labeling_algo.hh | 4 sandbox/duhamel/labeling_cpy_from_mln.hh | 4 sandbox/duhamel/labeling_level.hh | 2 sandbox/duhamel/translate_image.hh | 16 +- sandbox/folio/canevas_dt.hh | 4 sandbox/garrigues/image_identity/interpolated.hh | 4 sandbox/geraud/cs2d/cs2d_morpho.hh | 2 sandbox/jardonnet/registration/chamfer.hh | 22 +-- sandbox/jardonnet/registration/tools.hh | 4 sandbox/jardonnet/subsampling/gaussian_subsampling.hh | 4 sandbox/jardonnet/subsampling/sub_sampled_image.hh | 40 +++--- sandbox/nivault/median.hh | 10 - 73 files changed, 394 insertions(+), 391 deletions(-) Index: doc/tutorial/examples/p_array.2.cc --- doc/tutorial/examples/p_array.2.cc (revision 2040) +++ doc/tutorial/examples/p_array.2.cc (working copy) @@ -60,6 +60,8 @@ std::cout << "win = " << win << std::endl << std::endl; + mln_assertion(win == win); + util::index i; mln_qiter_(W) j(win, i); int n = arr.nsites(); Index: mln/subsampling/subsampling.hh --- mln/subsampling/subsampling.hh (revision 2040) +++ mln/subsampling/subsampling.hh (working copy) @@ -51,7 +51,7 @@ inline mln_concrete(I) subsampling(const Image<I>& input, - const mln_dpoint(I)& first_p, + const mln_dpsite(I)& first_p, const mln_coord(I)& gap); # ifndef MLN_INCLUDE_ONLY @@ -92,7 +92,7 @@ inline mln_concrete(I) subsampling(const Image<I>& input, - const mln_dpoint(I)& first_p, + const mln_dpsite(I)& first_p, const mln_coord(I)& gap) { trace::entering("subsampling::subsampling"); Index: mln/subsampling/gaussian_subsampling.hh --- mln/subsampling/gaussian_subsampling.hh (revision 2040) +++ mln/subsampling/gaussian_subsampling.hh (working copy) @@ -56,7 +56,7 @@ inline mln_concrete(I) gaussian_subsampling(const Image<I>& input, float sigma - const mln_dpoint(I)& first_p, + const mln_dpsite(I)& first_p, const mln_coord(I)& gap); # ifndef MLN_INCLUDE_ONLY @@ -66,7 +66,7 @@ inline mln_concrete(I) gaussian_subsampling(const Image<I>& input, float sigma, - const mln_dpoint(I)& first_p, + const mln_dpsite(I)& first_p, const mln_coord(I)& gap) { trace::entering("subsampling::gaussian_subsampling"); Index: mln/debug/println_with_border.spe.hh --- mln/debug/println_with_border.spe.hh (revision 2040) +++ mln/debug/println_with_border.spe.hh (working copy) @@ -79,7 +79,7 @@ void println_with_border(const box3d& b, const I& input) { - typedef mln_point(I) P; + typedef mln_psite(I) P; std::size_t len_s = b.len(P::dim - 3); std::size_t len_r = b.len(P::dim - 2); Index: mln/core/macros.hh --- mln/core/macros.hh (revision 2040) +++ mln/core/macros.hh (working copy) @@ -97,11 +97,11 @@ # define mln_delta_(T) T::delta /// \} -/// Shortcuts to access the dpoint type associated to T. -/// \{ -# define mln_dpoint(T) typename T::dpoint -# define mln_dpoint_(T) T::dpoint -/// \} +// /// Shortcuts to access the dpoint type associated to T. +// /// \{ +// # define mln_dpoint(T) typename T::dpoint +// # define mln_dpoint_(T) T::dpoint +// /// \} /// Shortcuts to access the dpsite type associated to T. /// \{ @@ -221,11 +221,11 @@ # define mln_psite_(T) T::psite /// \} -/// Shortcuts to access the point type associated to T. -/// \{ -# define mln_point(T) typename T::point -# define mln_point_(T) T::point -/// \} +// /// Shortcuts to access the point type associated to T. +// /// \{ +// # define mln_point(T) typename T::point +// # define mln_point_(T) T::point +// /// \} // q Index: mln/core/translate_image.hh --- mln/core/translate_image.hh (revision 2040) +++ mln/core/translate_image.hh (working copy) @@ -53,7 +53,7 @@ template <typename I> struct data_< translate_image<I> > { - data_(I& ima, const mln_dpoint(I) dp); + data_(I& ima, const mln_dpsite(I) dp); I ima_; @@ -61,7 +61,7 @@ box2d bb_; /// Delta point of translation. - const mln_dpoint(I) dp_; + const mln_dpsite(I) dp_; }; } // end of namespace mln::internal @@ -114,7 +114,7 @@ using super_::has_data; /// Constructors. - translate_image(I& ima, const mln_dpoint(I) dp); + translate_image(I& ima, const mln_dpsite(I) dp); translate_image(); /// Return domain of translated_image. @@ -141,7 +141,7 @@ template <typename I> inline - data_< translate_image<I> >::data_(I& ima, const mln_dpoint(I) dp) + data_< translate_image<I> >::data_(I& ima, const mln_dpsite(I) dp) : ima_ (ima), dp_ (dp) { @@ -159,7 +159,7 @@ template <typename I> inline - translate_image<I>::translate_image(I& ima, const mln_dpoint(I) dp) + translate_image<I>::translate_image(I& ima, const mln_dpsite(I) dp) { mln_precondition(ima.has_data()); this->data_ = new internal::data_< translate_image<I> >(ima, dp); @@ -175,7 +175,7 @@ inline bool translate_image<I>::has(const mln_psite(I)& p) const { - mln_point(I) np = p - this->data_->dp_; + mln_psite(I) np = p - this->data_->dp_; return this->data_->ima_.has(np); } @@ -185,7 +185,7 @@ translate_image<I>::operator()(const mln_psite(I)& p) const { mln_assertion(this->has(p)); - mln_point(I) np = p - this->data_->dp_; + mln_psite(I) np = p - this->data_->dp_; return this->data_->ima_(np); } @@ -196,7 +196,7 @@ translate_image<I>::operator()(const mln_psite(I)& p) { mln_assertion(this->has(p)); - mln_point(I) np = p - this->data_->dp_; + mln_psite(I) np = p - this->data_->dp_; return this->data_->ima_(np); } Index: mln/core/window.hh --- mln/core/window.hh (revision 2040) +++ mln/core/window.hh (working copy) @@ -34,15 +34,13 @@ * * \todo Make naming coherent: we have window (without '_') but * point_, neighb_, etc. + * + * \todo Code other comparisons (< and <=). */ # include <mln/core/internal/window_base.hh> # include <mln/core/internal/basic_window_impl.hh> -# include <mln/core/dpoint.hh> -# include <mln/core/box.hh> -# include <mln/convert/to_dpoint.hh> -# include <mln/geom/sym.hh> # include <mln/metal/is_a.hh> @@ -89,6 +87,15 @@ + /*! \brief Equality comparison between windows \p lhs and \p rhs. + * + * \relates mln::window<D> + */ + template <typename D> + bool operator==(const window<D>& lhs, const window<D>& rhs); + + + # ifndef MLN_INCLUDE_ONLY // window<D> @@ -105,7 +112,8 @@ inline bool window<D>::is_symmetric() const { - return geom::sym(*this) == *this; + window<D> cpy = *this; + return cpy.sym() == *this; } template <typename D> @@ -134,6 +142,12 @@ return ostr << win.dps_hook(); } + template <typename D> + bool operator==(const window<D>& lhs, const window<D>& rhs) + { + return lhs.dps_hook() == rhs.dps_hook(); + } + # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln Index: mln/core/sparse_encode.hh --- mln/core/sparse_encode.hh (revision 2040) +++ mln/core/sparse_encode.hh (working copy) @@ -47,7 +47,7 @@ ** @return sparse_image */ template <typename I> - sparse_image<mln_point(I), mln_value(I)> + sparse_image<mln_psite(I), mln_value(I)> sparse_encode(const Image<I>& input, bool ignore_zero = true); # ifndef MLN_INCLUDE_ONLY @@ -69,16 +69,16 @@ template <typename I> inline - sparse_image<mln_point(I), mln_value(I)> + sparse_image<mln_psite(I), mln_value(I)> sparse_encode(const Image<I>& input, bool ignore_zero) { - typedef mln_point(I) P; + typedef mln_psite(I) P; - sparse_image<mln_point(I), mln_value(I)> output; + sparse_image<mln_psite(I), mln_value(I)> output; const I& ima = exact(input); mln_piter(I) p (exact(input).domain()); unsigned len = 0; - mln_point(I) rstart; + mln_psite(I) rstart; std::vector< mln_value(I) > rvalue; rvalue.clear(); @@ -93,7 +93,7 @@ } else if ((!ignore_zero || ima(p) != literal::zero) && - on_the_same_line(rstart, mln_point(I)(p), len)) + on_the_same_line(rstart, mln_psite(I)(p), len)) { ++len; rvalue.push_back(ima(p)); Index: mln/core/dpoints_pixter.hh --- mln/core/dpoints_pixter.hh (revision 2040) +++ mln/core/dpoints_pixter.hh (working copy) @@ -37,7 +37,6 @@ # include <vector> # include <mln/core/concept/pixel_iterator.hh> -# include <mln/core/concept/point_site.hh> # include <mln/core/internal/pixel_impl.hh> @@ -70,7 +69,7 @@ template <typename Dps, typename Pref> dpoints_fwd_pixter(I& image, const Dps& dps, - const Point_Site<Pref>& p_ref); + const Pref& p_ref); /// \brief Constructor (using a generalized pixel). /// @@ -122,7 +121,7 @@ /// Reference value the image mln_qlf_value(I)** value_ref_; /// Reference pixel / point in the image - const mln_point(I)* p_ref_; + const mln_psite(I)* p_ref_; /// \} }; @@ -153,7 +152,7 @@ template <typename Dps, typename Pref> dpoints_bkd_pixter(I& image, const Dps& dps, - const Point_Site<Pref>& p_ref); + const Pref& p_ref); /// \brief Constructor (using a generalized pixel). /// @@ -205,7 +204,7 @@ /// Reference value the image mln_qlf_value(I)** value_ref_; /// Reference pixel / point in the image - const mln_point(I)* p_ref_; + const mln_psite(I)* p_ref_; /// \} }; @@ -222,11 +221,11 @@ inline dpoints_fwd_pixter<I>::dpoints_fwd_pixter(I& image, const Dps& dps, - const Point_Site<Pref>& p_ref) + const Pref& p_ref) : super_(image) { mln_precondition(image.has_data()); - p_ref_ = & exact(p_ref).to_point(); + p_ref_ = & exact(p_ref).to_site(); value_ref_ = 0; init_(dps); } @@ -333,11 +332,11 @@ inline dpoints_bkd_pixter<I>::dpoints_bkd_pixter(I& image, const Dps& dps, - const Point_Site<Pref>& p_ref) + const Pref& p_ref) : super_(image) { mln_precondition(image.has_data()); - p_ref_ = & exact(p_ref).to_point(); + p_ref_ = & exact(p_ref).to_site(); value_ref_ = 0; init_(dps); } Index: mln/core/interpolated.hh --- mln/core/interpolated.hh (revision 2040) +++ mln/core/interpolated.hh (working copy) @@ -158,7 +158,7 @@ inline bool interpolated<I>::has(const mln::algebra::vec<I::point::dim, float>& v) const { - mln_point(I) p; + mln_psite(I) p; for (unsigned i = 0; i < I::point::dim; ++i) p[i] = static_cast<int>(round(v[i])); return this->data_->ima_.has(p); @@ -169,7 +169,7 @@ mln_value(I) interpolated<I>::operator()(const mln::algebra::vec<I::point::dim, float>& v) const { - mln_point(I) p; + mln_psite(I) p; for (unsigned i = 0; i < I::point::dim; ++i) p[i] = static_cast<int>(round(v[i])); mln_assertion(this->data_->ima_.has(p)); Index: mln/core/value_encode.hh --- mln/core/value_encode.hh (revision 2040) +++ mln/core/value_encode.hh (working copy) @@ -48,7 +48,7 @@ ** @return value_enc_image */ template <typename I> - value_enc_image<mln_point(I), mln_value(I)> + value_enc_image<mln_psite(I), mln_value(I)> value_encode(const Image<I>& input, bool ignore_zero = true); # ifndef MLN_INCLUDE_ONLY @@ -70,15 +70,15 @@ template <typename I> inline - value_enc_image<mln_point(I), mln_value(I)> + value_enc_image<mln_psite(I), mln_value(I)> value_encode(const Image<I>& input, bool ignore_zero) { - value_enc_image<mln_point(I), mln_value(I)> output; + value_enc_image<mln_psite(I), mln_value(I)> output; const I& ima = exact(input); mln_piter(I) p (exact(input).domain()); unsigned len = 0; - mln_point(I) rstart; + mln_psite(I) rstart; mln_value(I) rvalue; for_all(p) @@ -92,12 +92,12 @@ } else if (rvalue == ima(p) - && on_the_same_line(rstart, mln_point(I)(p))) + && on_the_same_line(rstart, mln_psite(I)(p))) ++len; else { //FIXME is it right?? - output.insert(p_run<mln_point(I)>(rstart, len), rvalue); + output.insert(p_run<mln_psite(I)>(rstart, len), rvalue); if ((len = (!ignore_zero || ima(p) != literal::zero))) { rstart = p; Index: mln/core/mono_obased_rle_encode.hh --- mln/core/mono_obased_rle_encode.hh (revision 2040) +++ mln/core/mono_obased_rle_encode.hh (working copy) @@ -47,7 +47,7 @@ ** @return mono_obased_rle_image. */ template <typename I> - mono_obased_rle_image<mln_point(I), mln_value(I)> + mono_obased_rle_image<mln_psite(I), mln_value(I)> mono_obased_rle_encode(const Image<I>& input, bool ignore_zero = true); # ifndef MLN_INCLUDE_ONLY @@ -69,15 +69,15 @@ template <typename I> inline - mono_obased_rle_image<mln_point(I), mln_value(I)> + mono_obased_rle_image<mln_psite(I), mln_value(I)> mono_obased_rle_encode(const Image<I>& input, bool ignore_zero) { - typedef mln_point(I) P; + typedef mln_psite(I) P; const I& ima = exact(input); mln_piter(I) p (exact(input).domain()); unsigned len = 0; - mln_point(I) rstart; + mln_psite(I) rstart; mln_value(I) rvalue; std::set< mln_value(I) > sv; @@ -87,7 +87,7 @@ sv.insert(ima(p)); } - mono_obased_rle_image<mln_point(I), mln_value(I)> output(sv); + mono_obased_rle_image<mln_psite(I), mln_value(I)> output(sv); for_all(p) if (!ignore_zero || ima(p) != literal::zero || len) { @@ -99,7 +99,7 @@ } else if (rvalue == ima(p) - && on_the_same_line(rstart, mln_point(I)(p))) + && on_the_same_line(rstart, mln_psite(I)(p))) ++len; else { Index: mln/core/pixel.hh --- mln/core/pixel.hh (revision 2040) +++ mln/core/pixel.hh (working copy) @@ -54,10 +54,10 @@ pixel(I& image); /// Constructor. - pixel(I& image, const mln_point(I)& p); + pixel(I& image, const mln_psite(I)& p); /// Change the pixel to the one at point \p p. - void change_to(const mln_point(I)& p); + void change_to(const mln_psite(I)& p); /// Test if this pixel is valid. bool is_valid() const; @@ -78,7 +78,7 @@ template <typename I> inline - pixel<I>::pixel(I& image, const mln_point(I)& p) + pixel<I>::pixel(I& image, const mln_psite(I)& p) : super(image) { mln_precondition(this->image_.has(p)); @@ -88,7 +88,7 @@ template <typename I> inline void - pixel<I>::change_to(const mln_point(I)& p) + pixel<I>::change_to(const mln_psite(I)& p) { mln_precondition(this->image_.has(p)); this->value_ptr_ = & this->image_(p); @@ -102,7 +102,7 @@ if (this->value_ptr_ == 0 || ! this->image_.has_data()) return false; int o = this->value_ptr_ - this->image_.buffer(); - mln_point(I) p = this->image_.point_at_offset(o); + mln_psite(I) p = this->image_.point_at_offset(o); return this->image_.has(p); } Index: mln/core/t_image.hh --- mln/core/t_image.hh (revision 2040) +++ mln/core/t_image.hh (working copy) @@ -57,7 +57,7 @@ /// \param dim2 The second dimension to be swapped. /// \param box The bounding box (domain) of the morphed image. data_(I& ima, unsigned dim1, unsigned dim2, - mln::box_<mln_point(I)>& box); + mln::box_<mln_psite(I)>& box); /// Underlying image. I ima_; @@ -67,7 +67,7 @@ unsigned dim2_; /// \} /// The bounding box of the morphed image. - mln::box_<mln_point(I)> box_; + mln::box_<mln_psite(I)> box_; }; } // end of namespace mln::internal @@ -127,25 +127,25 @@ bool has_data() const; /// Test if a pixel value is accessible at \p p. - bool has(const mln_point(I)& p) const; + bool has(const mln_psite(I)& p) const; /// Give the definition domain. - const box_<mln_point(I)>& domain() const; + const box_<mln_psite(I)>& domain() const; /// Read-only access of pixel value at point site \p p. - mln_rvalue(I) operator()(const mln_point(I)& p) const; + mln_rvalue(I) operator()(const mln_psite(I)& p) const; /// Read-write access of pixel value at point site \p p. - lvalue operator()(const mln_point(I)& p); + lvalue operator()(const mln_psite(I)& p); /// Give the set of values of the image. const vset& values() const; protected: /// Exchange components \a dim1_ and \a dim2_ of point \a p. - mln_point(I) transpose_(const mln_point(I)& p) const; + mln_psite(I) transpose_(const mln_psite(I)& p) const; /// Exchange components \a dim1 and \a dim2 of point \a p. - mln_point(I) exchange_coords_(const mln_point(I)& p, + mln_psite(I) exchange_coords_(const mln_psite(I)& p, unsigned dim1, unsigned dim2) const; }; @@ -174,7 +174,7 @@ inline data_< t_image<I> >::data_(I& ima, unsigned dim1, unsigned dim2, - mln::box_<mln_point(I)>& box) + mln::box_<mln_psite(I)>& box) : ima_(ima), dim1_(dim1), dim2_(dim2), box_(box) @@ -194,7 +194,7 @@ // We don't use mln::t_image::transpose here, since one its // prerequisite is that data_ is initialized, which is not done // yet at this point. - box_<mln_point(I)> box(exchange_coords_(ima.bbox().pmin(), dim1, dim2), + box_<mln_psite(I)> box(exchange_coords_(ima.bbox().pmin(), dim1, dim2), exchange_coords_(ima.bbox().pmax(), dim1, dim2)); this->data_ = new internal::data_< t_image<I> >(ima, dim1, dim2, box); } @@ -210,7 +210,7 @@ template <typename I> inline bool - t_image<I>::has(const mln_point(I)& p) const + t_image<I>::has(const mln_psite(I)& p) const { mln_precondition(this->has_data()); return this->delegatee_()->has(transpose_(p)); @@ -218,8 +218,8 @@ template <typename I> inline - mln_point(I) - t_image<I>::transpose_(const mln_point(I)& p) const + mln_psite(I) + t_image<I>::transpose_(const mln_psite(I)& p) const { mln_precondition(this->has_data()); return exchange_coords_(p, this->data_->dim1_, this->data_->dim2_); @@ -227,11 +227,11 @@ template <typename I> inline - mln_point(I) - t_image<I>::exchange_coords_(const mln_point(I)& p, + mln_psite(I) + t_image<I>::exchange_coords_(const mln_psite(I)& p, unsigned dim1, unsigned dim2) const { - mln_point(I) tmp(p); + mln_psite(I) tmp(p); tmp[dim1] = p[dim2]; tmp[dim2] = p[dim1]; return tmp; @@ -239,7 +239,7 @@ template <typename I> inline - const box_<mln_point(I)>& + const box_<mln_psite(I)>& t_image<I>::domain() const { mln_precondition(this->has_data()); @@ -249,7 +249,7 @@ template <typename I> inline mln_rvalue(I) - t_image<I>::operator()(const mln_point(I)& p) const + t_image<I>::operator()(const mln_psite(I)& p) const { mln_precondition(this->has(p)); return (*this->delegatee_())(transpose_(p)); @@ -258,7 +258,7 @@ template <typename I> inline typename internal::morpher_lvalue_<I>::ret - t_image<I>::operator()(const mln_point(I)& p) + t_image<I>::operator()(const mln_psite(I)& p) { mln_precondition(this->has(p)); return (*this->delegatee_())(transpose_(p)); @@ -279,7 +279,7 @@ t_image<I> swap_coords(Image<I>& ima, unsigned dim1, unsigned dim2) { - typedef mln_point(I) P; + typedef mln_psite(I) P; mln_precondition(dim1 != dim2); mln_precondition(dim1 <= P::dim && dim2 <= P::dim); t_image<I> tmp(exact(ima), dim1, dim2); @@ -291,7 +291,7 @@ t_image<const I> swap_coords(const Image<I>& ima, unsigned dim1, unsigned dim2) { - typedef mln_point(I) P; + typedef mln_psite(I) P; mln_precondition(dim1 != dim2); mln_precondition(dim1 <= P::dim && dim2 <= P::dim); t_image<const I> tmp(exact(ima), dim1, dim2); Index: mln/core/mono_rle_encode.hh --- mln/core/mono_rle_encode.hh (revision 2040) +++ mln/core/mono_rle_encode.hh (working copy) @@ -47,7 +47,7 @@ ** @return mono_rle_image */ template <typename I> - mono_rle_image<mln_point(I), mln_value(I)> + mono_rle_image<mln_psite(I), mln_value(I)> mono_rle_encode(const Image<I>& input, mln_value(I) val); # ifndef MLN_INCLUDE_ONLY @@ -69,16 +69,16 @@ template <typename I> inline - mono_rle_image<mln_point(I), mln_value(I)> + mono_rle_image<mln_psite(I), mln_value(I)> mono_rle_encode(const Image<I>& input, mln_value(I) val) { - typedef mln_point(I) P; + typedef mln_psite(I) P; - mono_rle_image<mln_point(I), mln_value(I)> output(val); + mono_rle_image<mln_psite(I), mln_value(I)> output(val); const I& ima = exact(input); mln_piter(I) p (exact(input).domain()); unsigned len = 0; - mln_point(I) rstart; + mln_psite(I) rstart; for_all(p) if (ima(p) == val || len) @@ -90,7 +90,7 @@ } else if (val == ima(p) - && on_the_same_line(rstart, mln_point(I)(p))) + && on_the_same_line(rstart, mln_psite(I)(p))) ++len; else { Index: mln/core/tr_image.hh --- mln/core/tr_image.hh (revision 2040) +++ mln/core/tr_image.hh (working copy) @@ -175,7 +175,7 @@ inline bool tr_image<T,I>::has(const algebra::vec<I::point::dim, float>& v) const { - mln_point(I) p; + mln_psite(I) p; algebra::vec<I::point::dim, float> v2 = this->data_->tr_.inv()(v); for (unsigned i = 0; i < I::point::dim; ++i) p[i] = static_cast<int>(round(v2[i])); @@ -186,7 +186,7 @@ inline bool tr_image<T,I>::has(const algebra::vec<I::point::dim, float>& v) const { - mln_point(I) p; + mln_psite(I) p; algebra::vec<I::point::dim, float> v2 = this->data_->tr_.inv()(v); for (unsigned i = 0; i < I::point::dim; ++i) p[i] = static_cast<int>(round(v2[i])); @@ -198,7 +198,7 @@ mln_value(I) tr_image<T,I>::operator()(const algebra::vec<I::point::dim, float>& v) const { - mln_point(I) p; + mln_psite(I) p; algebra::vec<I::point::dim, float> v2 = this->data_->tr_.inv()(v); for (unsigned i = 0; i < I::point::dim; ++i) p[i] = static_cast<int>(round(v2[i])); Index: mln/core/init.hh --- mln/core/init.hh (revision 2040) +++ mln/core/init.hh (working copy) @@ -78,7 +78,7 @@ inline void init_(tag::bbox_t, B& b, const Image<I>& ima) { - b = geom::bbox(ima); + b = geom::bbox(ima.domain()); } template <typename I> Index: mln/core/obased_rle_encode.hh --- mln/core/obased_rle_encode.hh (revision 2040) +++ mln/core/obased_rle_encode.hh (working copy) @@ -47,7 +47,7 @@ ** @return obased_rle_image */ template <typename I> - obased_rle_image<mln_point(I), mln_value(I)> + obased_rle_image<mln_psite(I), mln_value(I)> obased_rle_encode(const Image<I>& input, bool ignore_zero = true); # ifndef MLN_INCLUDE_ONLY @@ -69,15 +69,15 @@ template <typename I> inline - obased_rle_image<mln_point(I), mln_value(I)> + obased_rle_image<mln_psite(I), mln_value(I)> obased_rle_encode(const Image<I>& input, bool ignore_zero) { - typedef mln_point(I) P; + typedef mln_psite(I) P; const I& ima = exact(input); mln_piter(I) p (exact(input).domain()); unsigned len = 0; - mln_point(I) rstart; + mln_psite(I) rstart; mln_value(I) rvalue; std::set< mln_value(I) > sv; @@ -87,7 +87,7 @@ sv.insert(ima(p)); } - obased_rle_image<mln_point(I), mln_value(I)> output(sv); + obased_rle_image<mln_psite(I), mln_value(I)> output(sv); for_all(p) if (!ignore_zero || ima(p) != literal::zero || len) { @@ -99,7 +99,7 @@ } else if (rvalue == ima(p) - && on_the_same_line(rstart, mln_point(I)(p))) + && on_the_same_line(rstart, mln_psite(I)(p))) ++len; else { Index: mln/core/concept/value_iterator.hh --- mln/core/concept/value_iterator.hh (revision 2040) +++ mln/core/concept/value_iterator.hh (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -34,7 +34,6 @@ */ # include <mln/core/concept/iterator.hh> -# include <mln/core/concept/point_site.hh> namespace mln Index: mln/core/concept/window.hh --- mln/core/concept/window.hh (revision 2040) +++ mln/core/concept/window.hh (working copy) @@ -34,6 +34,7 @@ # include <mln/core/concept/object.hh> # include <mln/core/concept/iterator.hh> +# include <mln/core/p_array.hh> namespace mln @@ -75,16 +76,6 @@ }; - /*! \brief Equality comparison between windows \p lhs and \p rhs. - * - * \relates mln::Window - * - * \todo Move into mln/set/compare.hh and delegate to replace this special impl. - */ - template <typename Wl, typename Wr> - bool operator==(const Window<Wl>& lhs, const Window<Wr>& rhs); - - # ifndef MLN_INCLUDE_ONLY @@ -101,27 +92,6 @@ typedef mln_bkd_qiter(E) bkd_qiter; } - template <typename Wl, typename Wr> - inline - bool operator==(const Window<Wl>& lhs, const Window<Wr>& rhs) - { - // FIXME: Same grid! - typedef mln_point(Wl) P; - - mln_fwd_qiter(Wl) ql(exact(lhs), P::origin); - mln_fwd_qiter(Wr) qr(exact(rhs), P::origin); - - for (ql.start(), qr.start(); - ql.is_valid() && qr.is_valid(); - ql.next(), qr.next()) - if (ql != qr) - return false; // difference found - - // both windows are equal only if both browsings are completed at - // the same time: - return ! ql.is_valid() && ! qr.is_valid(); - } - # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln Index: mln/core/concept/site_set.hh --- mln/core/concept/site_set.hh (revision 2040) +++ mln/core/concept/site_set.hh (working copy) @@ -37,7 +37,6 @@ * \todo Check optional methods s.a. nsites and bbox. */ -# include <mln/core/concept/point_site.hh> # include <mln/core/concept/site_iterator.hh> # include <mln/trait/site_sets.hh> # include <mln/metal/not_equal.hh> Index: mln/core/rle_encode.hh --- mln/core/rle_encode.hh (revision 2040) +++ mln/core/rle_encode.hh (working copy) @@ -47,7 +47,7 @@ ** @return rle_image */ template <typename I> - rle_image<mln_point(I), mln_value(I)> + rle_image<mln_psite(I), mln_value(I)> rle_encode(const Image<I>& input, bool ignore_zero = true); # ifndef MLN_INCLUDE_ONLY @@ -69,16 +69,16 @@ template <typename I> inline - rle_image<mln_point(I), mln_value(I)> + rle_image<mln_psite(I), mln_value(I)> rle_encode(const Image<I>& input, bool ignore_zero) { - typedef mln_point(I) P; + typedef mln_psite(I) P; - rle_image<mln_point(I), mln_value(I)> output; + rle_image<mln_psite(I), mln_value(I)> output; const I& ima = exact(input); mln_piter(I) p (exact(input).domain()); unsigned len = 0; - mln_point(I) rstart; + mln_psite(I) rstart; mln_value(I) rvalue; for_all(p) @@ -92,7 +92,7 @@ } else if (rvalue == ima(p) - && on_the_same_line(rstart, mln_point(I)(p))) + && on_the_same_line(rstart, mln_psite(I)(p))) ++len; else { Index: mln/core/a_point_of.hh --- mln/core/a_point_of.hh (revision 2040) +++ mln/core/a_point_of.hh (working copy) @@ -43,14 +43,14 @@ * \brief Give a point of an image. */ template <typename I> - mln_point(I) a_point_of(const Image<I>& ima); + mln_psite(I) a_point_of(const Image<I>& ima); # ifndef MLN_INCLUDE_ONLY template <typename I> inline - mln_point(I) a_point_of(const Image<I>& ima_) + mln_psite(I) a_point_of(const Image<I>& ima_) { const I& ima = exact(ima_); mln_piter(I) p(ima.domain()); Index: mln/draw/line.hh --- mln/draw/line.hh (revision 2040) +++ mln/draw/line.hh (working copy) @@ -61,7 +61,7 @@ */ template <typename I> void line(Image<I>& ima, - const mln_point(I)& beg, const mln_point(I)& end, + const mln_psite(I)& beg, const mln_psite(I)& end, const mln_value(I)& v); @@ -70,7 +70,7 @@ template <typename I> inline void line(Image<I>& ima, - const mln_point(I)& beg, const mln_point(I)& end, + const mln_psite(I)& beg, const mln_psite(I)& end, const mln_value(I)& v) { mln_precondition(exact(ima).has_data()); Index: mln/draw/box.hh --- mln/draw/box.hh (revision 2040) +++ mln/draw/box.hh (working copy) @@ -74,15 +74,15 @@ { mln_precondition(exact(ima).has_data()); - mln_point(I) pmin = exact(b).pmin(); - mln_point(I) pmax = exact(b).pmax(); + mln_psite(I) pmin = exact(b).pmin(); + mln_psite(I) pmax = exact(b).pmax(); mln_precondition(exact(ima).has(pmin) && exact(ima).has(pmax)); - mln_point(I) p1 (pmin[0], pmin[1]); - mln_point(I) p2 (pmax[0], pmin[1]); - mln_point(I) p3 (pmin[0], pmax[1]); - mln_point(I) p4 (pmax[0], pmax[1]); + mln_psite(I) p1 (pmin[0], pmin[1]); + mln_psite(I) p2 (pmax[0], pmin[1]); + mln_psite(I) p3 (pmin[0], pmax[1]); + mln_psite(I) p4 (pmax[0], pmax[1]); draw::line (ima, p1, p2, v); draw::line (ima, p2, p4, v); Index: mln/level/fill.hh --- mln/level/fill.hh (revision 2040) +++ mln/level/fill.hh (working copy) @@ -91,10 +91,10 @@ * \todo Take benefit from quantization when possible. */ template <typename I> - void fill(Image<I>& ima, mln_value(I) (*(&f))(const mln_point(I)& p)); + void fill(Image<I>& ima, mln_value(I) (*(&f))(const mln_psite(I)& p)); template <typename I> - void fill_f(Image<I>& ima, mln_value(I) (*f)(const mln_point(I)& p)); + void fill_f(Image<I>& ima, mln_value(I) (*f)(const mln_psite(I)& p)); /*! Fill the image \p ima with the values given by the array \p arr. @@ -198,7 +198,7 @@ template <typename I> inline void fill_f(Image<I>& ima_, - mln_value(I) (*f)(const mln_point(I)& p)) + mln_value(I) (*f)(const mln_psite(I)& p)) { trace::entering("level::fill_f"); Index: mln/level/memset_.hh --- mln/level/memset_.hh (revision 2040) +++ mln/level/memset_.hh (working copy) @@ -70,7 +70,7 @@ * \pre \p p + \p n is <= \p input size. */ template <typename I> - void memset_(I& input, const mln_point(I)& p, + void memset_(I& input, const mln_psite(I)& p, const mln_value(I)& v, std::size_t n); @@ -139,7 +139,7 @@ template <typename I> inline - void memset_(I& input, const mln_point(I)& p, + void memset_(I& input, const mln_psite(I)& p, const mln_value(I)& v, std::size_t n) { trace::entering("level::memset_"); Index: mln/level/median.hh --- mln/level/median.hh (revision 2040) +++ mln/level/median.hh (working copy) @@ -97,8 +97,8 @@ template <typename I, typename W, typename O> struct median_t { - typedef mln_point(I) P; - typedef mln_dpoint(I) D; + typedef mln_psite(I) P; + typedef mln_dpsite(I) D; // i/o @@ -195,7 +195,7 @@ O& output; // aux data - mln_point(I) p; + mln_psite(I) p; accu::median<mln_vset(I)> med; // ctor @@ -224,13 +224,13 @@ } inline - void add_point(mln_point(I) pt) + void add_point(mln_psite(I) pt) { med.take(input(pt)); } inline - void remove_point(mln_point(I) pu) + void remove_point(mln_psite(I) pu) { med.untake(input(pu)); } @@ -308,7 +308,7 @@ mlc_converts_to(mln_value(I), mln_value(O))::check(); mln_precondition(exact(output).domain() == exact(input).domain()); - typedef mln_point(I) P; + typedef mln_psite(I) P; mln_precondition(dir < P::dim); mln_precondition(length % 2 == 1); Index: mln/level/paste.spe.hh --- mln/level/paste.spe.hh (revision 2040) +++ mln/level/paste.spe.hh (working copy) @@ -63,7 +63,7 @@ void paste_lines_(const I& data, J& destination) { trace::entering("level::impl::paste_lines_"); - typedef mln_point(I) P; + typedef mln_psite(I) P; std::size_t n = data.bbox().len(P::dim - 1); // FIXME: Works only for raw data images // FIXME: For linear data images, we should get the len for each line... Index: mln/linear/line_convolve.hh --- mln/linear/line_convolve.hh (revision 2040) +++ mln/linear/line_convolve.hh (working copy) @@ -71,7 +71,7 @@ { mln_precondition(exact(output).domain() == exact(input).domain()); linear::convolve(input, - make::w_window_line<mln_dpoint(I)>(weights), + make::w_window_line<mln_dpsite(I)>(weights), output); } Index: mln/linear/gaussian.hh --- mln/linear/gaussian.hh (revision 2040) +++ mln/linear/gaussian.hh (working copy) @@ -157,10 +157,10 @@ void recursivefilter_(I& ima, const recursivefilter_coef_& c, - const mln_point(I)& start, - const mln_point(I)& finish, + const mln_psite(I)& start, + const mln_psite(I)& finish, int len, - const mln_dpoint(I)& d) + const mln_dpsite(I)& d) { std::vector<WorkType> tmp1(len); std::vector<WorkType> tmp2(len); @@ -195,7 +195,7 @@ - c.d[1] * tmp1[2] - c.d[2]*tmp1[1] - c.d[3] * tmp1[0]; - mln_point(I) current(start + d + d + d + d); + mln_psite(I) current(start + d + d + d + d); for (mln_coord(I) i = 4; i < len; ++i) { tmp1[i] = Index: mln/make/pixel.hh --- mln/make/pixel.hh (revision 2040) +++ mln/make/pixel.hh (working copy) @@ -43,18 +43,18 @@ /// Create a mln::pixel from a constant image \p ima and a point \p p. template <typename I> - mln::pixel<const I> pixel(const Image<I>& ima, const mln_point(I)& p); + mln::pixel<const I> pixel(const Image<I>& ima, const mln_psite(I)& p); /// Create a mln::pixel from a mutable image \p ima and a point \p p. template <typename I> - mln::pixel<I> pixel(Image<I>& ima, const mln_point(I)& p); + mln::pixel<I> pixel(Image<I>& ima, const mln_psite(I)& p); # ifndef MLN_INCLUDE_ONLY template <typename I> inline - mln::pixel<const I> pixel(const Image<I>& ima, const mln_point(I)& p) + mln::pixel<const I> pixel(const Image<I>& ima, const mln_psite(I)& p) { mln::pixel<const I> tmp(exact(ima), p); return tmp; @@ -62,7 +62,7 @@ template <typename I> inline - mln::pixel<I> pixel(Image<I>& ima, const mln_point(I)& p) + mln::pixel<I> pixel(Image<I>& ima, const mln_psite(I)& p) { mln::pixel<I> tmp(exact(ima), p); return tmp; Index: mln/make/voronoi.hh --- mln/make/voronoi.hh (revision 2040) +++ mln/make/voronoi.hh (working copy) @@ -94,7 +94,7 @@ { if (orig(p) != 0) { - X x = mln_point(I)(p); + X x = mln_psite(I)(p); tab_mean[orig(p) - min].take(x); } } Index: mln/border/fill.hh --- mln/border/fill.hh (revision 2040) +++ mln/border/fill.hh (working copy) @@ -66,8 +66,8 @@ { trace::entering("border::impl::fill_size_1_"); - typedef mln_point(I) P; - typedef mln_point(I) P; + typedef mln_psite(I) P; + typedef mln_psite(I) P; typename I::line_piter pl(ima.domain()); std::size_t len_r = ima.bbox().len(P::dim - 1); std::size_t st = 0; @@ -93,7 +93,7 @@ { trace::entering("border::impl::fill_size_n_"); - typedef mln_point(I) P; + typedef mln_psite(I) P; typename I::line_piter pl(ima.domain()); std::size_t len_r = ima.bbox().len(P::dim - 1); std::size_t st = 0; @@ -121,7 +121,7 @@ { trace::entering("border::fill"); - typedef mln_point(I) P; + typedef mln_psite(I) P; const I& ima = exact(ima_); mlc_is(mln_trait_image_speed(I), trait::image::speed::fastest)::check(); Index: mln/border/duplicate.hh --- mln/border/duplicate.hh (revision 2040) +++ mln/border/duplicate.hh (working copy) @@ -69,7 +69,7 @@ { trace::entering("border::impl::duplicate_1d_"); - typedef mln_point(I) P; + typedef mln_psite(I) P; typename I::line_piter pl(ima.domain()); std::size_t len_c = exact(ima).bbox().len(P::dim - 1); std::size_t border = ima.border (); @@ -90,7 +90,7 @@ { trace::entering("border::impl::duplicate_2d_"); - typedef mln_point(I) P; + typedef mln_psite(I) P; typename I::line_piter pl(ima.domain()); std::size_t border = ima.border (); std::size_t border_2x = 2 * ima.border (); @@ -134,7 +134,7 @@ const I& ima = exact(ima_); mln_precondition(ima.has_data()); - typedef mln_point(I) P; + typedef mln_psite(I) P; typename I::line_piter pl(ima.domain()); std::size_t border = ima.border (); std::size_t border_2x = 2 * ima.border (); @@ -207,7 +207,7 @@ mlc_is(mln_trait_image_speed(I), trait::image::speed::fastest)::check(); - typedef mln_point(I) P; + typedef mln_psite(I) P; if (!ima.border ()) return; Index: mln/border/mirror.hh --- mln/border/mirror.hh (revision 2040) +++ mln/border/mirror.hh (working copy) @@ -198,7 +198,7 @@ mln_precondition(ima.has_data()); mlc_is(mln_trait_image_speed(I), trait::image::speed::fastest)::check(); - typedef mln_point(I) P; + typedef mln_psite(I) P; if (!ima.border ()) return; Index: mln/convert/to_window.hh --- mln/convert/to_window.hh (revision 2040) +++ mln/convert/to_window.hh (working copy) @@ -73,7 +73,7 @@ /// Convert a binary image \p ima into a window. template <typename I> - window<mln_dpoint(I)> to_window(const Image<I>& ima); + window<mln_dpsite(I)> to_window(const Image<I>& ima); /// Convert a point set \p pset into a window. template <typename S> @@ -141,12 +141,12 @@ depth in milena/core/concepts/README. */ template <typename I> inline - window<mln_dpoint(I)> to_window(const Image<I>& ima_) + window<mln_dpsite(I)> to_window(const Image<I>& ima_) { const I& ima = exact(ima_); mln_precondition(ima.has_data()); // FIXME: Check that ima is binary! - typedef mln_dpoint(I) D; + typedef mln_dpsite(I) D; typedef mln_point(D) P; window<D> win; mln_piter(I) p(ima.domain()); Index: mln/convert/to_p_set.hh --- mln/convert/to_p_set.hh (revision 2040) +++ mln/convert/to_p_set.hh (working copy) @@ -57,7 +57,7 @@ /// Convert a binary image \p ima into a point set. template <typename I> - p_set<mln_point(I)> to_p_set(const Image<I>& ima); + p_set<mln_psite(I)> to_p_set(const Image<I>& ima); /// Convert a Window \p win into a point set. template <typename W> @@ -90,7 +90,7 @@ template <typename I> inline - p_set<mln_point(I)> to_p_set(const Image<I>& ima_) + p_set<mln_psite(I)> to_p_set(const Image<I>& ima_) { const I& ima = exact(ima_); mln_precondition(ima.has_data()); @@ -98,8 +98,8 @@ // FIXME: Check that ima is binary! // mln::metal::templated_by<mln_value(I), bool >::check(); - typedef mln_dpoint(I) D; - typedef mln_point(I) P; + typedef mln_dpsite(I) D; + typedef mln_psite(I) P; p_set<P> pset; mln_piter(I) p(ima.domain()); for_all(p) Index: mln/convert/to_w_window.hh --- mln/convert/to_w_window.hh (revision 2040) +++ mln/convert/to_w_window.hh (working copy) @@ -45,19 +45,19 @@ /// Convert an image \p input into a weighted window. template <typename I> - w_window<mln_dpoint(I), mln_value(I)> to_w_window(const Image<I>& input); + w_window<mln_dpsite(I), mln_value(I)> to_w_window(const Image<I>& input); # ifndef MLN_INCLUDE_ONLY template <typename I> inline - w_window<mln_dpoint(I), mln_value(I)> to_w_window(const Image<I>& input_) + w_window<mln_dpsite(I), mln_value(I)> to_w_window(const Image<I>& input_) { const I& input = exact(input_); mln_precondition(input.has_data()); // FIXME: Check that input is scalar? - typedef mln_dpoint(I) D; + typedef mln_dpsite(I) D; typedef mln_point(D) P; w_window<D, mln_value(I)> w_win; mln_piter(I) p(input.domain()); Index: mln/geom/pmin_pmax.hh --- mln/geom/pmin_pmax.hh (revision 2040) +++ mln/geom/pmin_pmax.hh (working copy) @@ -64,7 +64,7 @@ /// Compute the minimum and maximum points when browsing with /// iterator \p p. template <typename I> - std::pair<mln_point(I), mln_point(I)> + std::pair<mln_psite(I), mln_psite(I)> pmin_pmax(const Site_Iterator<I>& p); @@ -72,7 +72,7 @@ /// when browsing with iterator \p p. template <typename I> void - pmin_pmax(const Site_Iterator<I>& p, mln_point(I)& pmin, mln_point(I)& pmax); + pmin_pmax(const Site_Iterator<I>& p, mln_psite(I)& pmin, mln_psite(I)& pmax); @@ -84,7 +84,7 @@ template <typename I> inline void - pmin_pmax(const Site_Iterator<I>& p_, mln_point(I)& pmin, mln_point(I)& pmax) + pmin_pmax(const Site_Iterator<I>& p_, mln_psite(I)& pmin, mln_psite(I)& pmax) { I p = exact(p_); // a copy of p_ @@ -94,7 +94,7 @@ pmin = pmax = p; // update with remaining points - typedef mln_point(I) P; + typedef mln_psite(I) P; for_all_remaining(p) for (unsigned i = 0; i < P::dim; ++i) if (p[i] < pmin[i]) @@ -105,10 +105,10 @@ template <typename I> inline - std::pair<mln_point(I), mln_point(I)> + std::pair<mln_psite(I), mln_psite(I)> pmin_pmax(const Site_Iterator<I>& p) { - typedef mln_point(I) P; + typedef mln_psite(I) P; std::pair<P, P> tmp; pmin_pmax(p, tmp.first, tmp.second); // Calls the previous version. return tmp; Index: mln/geom/bbox.hh --- mln/geom/bbox.hh (revision 2040) +++ mln/geom/bbox.hh (working copy) @@ -1,4 +1,4 @@ -// Copyright (C) 2007 EPITA Research and Development Laboratory +// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -32,14 +32,14 @@ * * \brief Several routines to compute the precise bounding box of some * objects. + * + * \todo Re-activate precondition so introduce + * "set::nsites(Site_Set)"... + * + * \todo Add a static check "domain is ok for bbox (like grid)". */ -# include <mln/core/concept/image.hh> -# include <mln/core/concept/site_set.hh> # include <mln/core/concept/box.hh> -# include <mln/core/concept/window.hh> -# include <mln/core/concept/weighted_window.hh> -# include <mln/geom/pmin_pmax.hh> namespace mln @@ -48,96 +48,66 @@ namespace geom { - - /// Compute the precise bounding box of a window \p win when - /// centered at the origin. - template <typename W> - box_<mln_point(W)> bbox(const Window<W>& win); - - - /// Compute the precise bounding box of a weighted window \p w_win - /// when centered at the origin. - template <typename W> - box_<mln_point(W)> bbox(const Weighted_Window<W>& w_win); - - /// Compute the precise bounding box of a point set \p pset. template <typename S> - box_<mln_point(S)> bbox(const Site_Set<S>& pset); - - - /// Compute the precise bounding box of an image \p ima. - template <typename I> - box_<mln_point(I)> bbox(const Image<I>& ima); - + box_<mln_site(S)> bbox(const Site_Set<S>& pset); # ifndef MLN_INCLUDE_ONLY - template <typename W> - inline - box_<mln_point(W)> bbox(const Window<W>& win_) - { - const W& win = exact(win_); - mln_precondition(! win.is_empty()); - - typedef mln_point(W) P; - mln_qiter(W) q(win, P::origin); - std::pair<P, P> pp = geom::pmin_pmax(q); - - box_<P> tmp(pp.first, pp.second); - return tmp; - } - - template <typename W> - inline - box_<mln_point(W)> bbox(const Weighted_Window<W>& w_win) - { - return bbox(exact(w_win).win()); - } - - namespace impl { template <typename S> - inline - box_<mln_point(S)> bbox_(const Site_Set<S>& pset_) + box_<mln_site(S)> bbox_(trait::site_set::bbox::known, + const S& pset) { - const S& pset = exact(pset_); - typedef mln_point(S) P; - std::pair<P, P> pp = geom::pmin_pmax(pset); - box_<P> tmp(pp.first, pp.second); - return tmp; + return pset.bbox(); } - template <typename B> - inline - box_<mln_point(B)> bbox_(const Box<B>& pset_) + template <typename S> + box_<mln_site(S)> bbox_(trait::site_set::bbox::unknown, + const S& pset) { - return exact(pset_); + typedef mln_site(S) P; + P pmin, pmax; + + // Init with first point. + mln_piter(S) p(pset); + p.start(); + mln_precondition(p.is_valid()); + pmin = pmax = p; + + // Update with remaining points. + for_all_remaining(p) + for (unsigned i = 0; i < P::dim; ++i) + if (p[i] < pmin[i]) + pmin[i] = p[i]; + else + if (p[i] > pmax[i]) + pmax[i] = p[i]; + + box_<P> bb(pmin, pmax); + return bb; } } // end of namespace mln::geom::impl + + // Facade. + template <typename S> inline - box_<mln_point(S)> bbox(const Site_Set<S>& pset) + box_<mln_site(S)> bbox(const Site_Set<S>& pset) { - mln_precondition(exact(pset).npoints() != 0); - box_<mln_point(S)> tmp = impl::bbox_(exact(pset)); - mln_postcondition(tmp <= exact(pset).bbox()); - return tmp; - } + trace::entering("geom::bbox"); +// mln_precondition(set::is_empty(pset) != 0); + box_<mln_site(S)> b = impl::bbox_(mln_trait_site_set_bbox(S)(), + exact(pset)); - template <typename I> - inline - box_<mln_point(I)> bbox(const Image<I>& ima_) - { - const I& ima = exact(ima_); - mln_precondition(ima.has_data()); - return bbox(ima.domain()); + trace::exiting("geom::bbox"); + return b; } # endif // ! MLN_INCLUDE_ONLY Index: mln/geom/resize.hh --- mln/geom/resize.hh (revision 2040) +++ mln/geom/resize.hh (working copy) @@ -149,7 +149,7 @@ mlc_is(mln_trait_image_speed(I), trait::image::speed::fastest)::check(); I output; - typedef mln_point(I) P; + typedef mln_psite(I) P; /// FIXME : Find a better way for the disjunction. Index: mln/morpho/erosion_fast.hh --- mln/morpho/erosion_fast.hh (revision 2040) +++ mln/morpho/erosion_fast.hh (working copy) @@ -79,8 +79,8 @@ template <typename I, typename W, typename O> struct erosion_fast_t { - typedef mln_point(I) P; - typedef mln_dpoint(I) D; + typedef mln_psite(I) P; + typedef mln_dpsite(I) D; // i/o Index: mln/morpho/rank_filter.hh --- mln/morpho/rank_filter.hh (revision 2040) +++ mln/morpho/rank_filter.hh (working copy) @@ -69,7 +69,7 @@ mln_concrete(I) output; initialize(output, input); - accu::rank_<mln_value(I)> accu(k, convert::to_p_array(win, mln_point(I)()).npoints()); + accu::rank_<mln_value(I)> accu(k, convert::to_p_array(win, mln_psite(I)()).npoints()); mln_piter(I) p(input.domain()); mln_qiter(W) q(win, p); for_all(p) Index: mln/morpho/Rd.hh --- mln/morpho/Rd.hh (revision 2040) +++ mln/morpho/Rd.hh (working copy) @@ -77,7 +77,7 @@ template <typename I> inline - std::vector<mln_point(I)> histo_reverse_sort(const I& ima) + std::vector<mln_psite(I)> histo_reverse_sort(const I& ima) { std::vector<unsigned> h = compute_histo(ima); // preparing output data @@ -85,7 +85,7 @@ loc[255] = 0; for (int l = 254; l >= 0; --l) loc[l] = loc[l+1] + h[l+1]; - std::vector<mln_point(I)> vec(ima.domain().npoints()); + std::vector<mln_psite(I)> vec(ima.domain().npoints()); // storing output data mln_piter(I) p(ima.domain()); for_all(p) @@ -97,7 +97,7 @@ template <typename I, typename N> struct Rd { - typedef mln_point(I) point; + typedef mln_psite(I) point; typedef mln_value(I) value; // in: Index: mln/morpho/dilation_fast.hh --- mln/morpho/dilation_fast.hh (revision 2040) +++ mln/morpho/dilation_fast.hh (working copy) @@ -79,8 +79,8 @@ template <typename I, typename W, typename O> struct dilation_fast_t { - typedef mln_point(I) P; - typedef mln_dpoint(I) D; + typedef mln_psite(I) P; + typedef mln_dpsite(I) D; // i/o Index: mln/display/color_pretty.hh --- mln/display/color_pretty.hh (revision 2040) +++ mln/display/color_pretty.hh (working copy) @@ -82,9 +82,9 @@ template <typename I> typename trait::image_from_mesh < mln_mesh(I), value::rgb8 >::ret color_pretty_rgb(const Image<I>& input_, - const p_set<mln_point(I) >& s1_, - const p_set<mln_point(I) >& s2_, - const p_set<mln_point(I) >& s3_); + const p_set<mln_psite(I) >& s1_, + const p_set<mln_psite(I) >& s2_, + const p_set<mln_psite(I) >& s3_); # ifndef MLN_INCLUDE_ONLY @@ -142,9 +142,9 @@ inline typename trait::image_from_mesh < mln_mesh(I), value::rgb8 >::ret color_pretty_rgb(const Image<I>& input_, - const p_set<mln_point(I) >& s1_, - const p_set<mln_point(I) >& s2_, - const p_set<mln_point(I) >& s3_) + const p_set<mln_psite(I) >& s1_, + const p_set<mln_psite(I) >& s2_, + const p_set<mln_psite(I) >& s3_) { trace::entering("display::impl::color_pretty_rgb"); @@ -154,21 +154,21 @@ level::fill(output, value::rgb8(0, 0, 0)); { - mln_piter(p_set<mln_point(I) >) p(s1_); + mln_piter(p_set<mln_psite(I) >) p(s1_); for_all(p) output(p).red() = 255; } { - mln_piter(p_set<mln_point(I) >) p(s2_); + mln_piter(p_set<mln_psite(I) >) p(s2_); for_all(p) output(p).green() = 255; } { - mln_piter(p_set<mln_point(I) >) p(s3_); + mln_piter(p_set<mln_psite(I) >) p(s3_); for_all(p) output(p).blue() = 255; @@ -207,9 +207,9 @@ inline typename trait::image_from_mesh < mln_mesh(I), value::rgb8 >::ret color_pretty_rgb(const Image<I>& input_, - const p_set<mln_point(I) >& s1_, - const p_set<mln_point(I) >& s2_, - const p_set<mln_point(I) >& s3_) + const p_set<mln_psite(I) >& s1_, + const p_set<mln_psite(I) >& s2_, + const p_set<mln_psite(I) >& s3_) { trace::entering("display::color_pretty_rgb"); Index: mln/canvas/chamfer.hh --- mln/canvas/chamfer.hh (revision 2040) +++ mln/canvas/chamfer.hh (working copy) @@ -50,7 +50,7 @@ { typedef typename F::I I; typedef typename F::W W; - typedef mln_point(I) point; + typedef mln_psite(I) point; F& f; Index: mln/canvas/browsing/dir_struct_elt_incr_update.hh --- mln/canvas/browsing/dir_struct_elt_incr_update.hh (revision 2040) +++ mln/canvas/browsing/dir_struct_elt_incr_update.hh (working copy) @@ -105,7 +105,7 @@ mln_precondition(f.dir < f.dim); typedef typename F::I I; - const mln_point(I) + const mln_psite(I) pmin = f.input.domain().pmin(), pmax = f.input.domain().pmax(); @@ -115,7 +115,7 @@ pmin_dir_plus_half_length = pmin_dir + f.length / 2, pmax_dir_minus_half_length = pmax_dir - f.length / 2; - mln_point(I) pt, pu; + mln_psite(I) pt, pu; typedef mln_coord(I)& coord_ref; coord_ref Index: mln/canvas/browsing/directional.hh --- mln/canvas/browsing/directional.hh (revision 2040) +++ mln/canvas/browsing/directional.hh (working copy) @@ -94,7 +94,7 @@ mln_precondition(f.dir < f.dim); typedef typename F::I I; - mln_point(I) + mln_psite(I) pmin = f.input.domain().pmin(), pmax = f.input.domain().pmax(); Index: mln/canvas/labeling.hh --- mln/canvas/labeling.hh (revision 2040) +++ mln/canvas/labeling.hh (working copy) @@ -282,7 +282,7 @@ { mln_bkd_pixter(const I) p(f.input); - typedef window<mln_dpoint(I)> W; + typedef window<mln_dpsite(I)> W; W win = mln::convert::to_upper_window(f.nbh); mln_qixter(const I, W) n(p, win); Index: mln/util/set.hh --- mln/util/set.hh (revision 2040) +++ mln/util/set.hh (working copy) @@ -41,7 +41,7 @@ # include <algorithm> # include <iostream> -# include <mln/core/contract.hh> +# include <mln/core/concept/object.hh> # include <mln/util/less.hh> @@ -75,7 +75,7 @@ * \see mln::util::less */ template <typename T> - class set + class set : public Object< mln::util::set<T> > { public: @@ -197,6 +197,19 @@ }; + template <typename T> + bool operator == (const set<T>& lhs, const set<T>& rhs); + + + template <typename T> + bool operator < (const set<T>& lhs, const set<T>& rhs); + + + template <typename T> + bool operator <= (const set<T>& lhs, const set<T>& rhs); + + + # ifndef MLN_INCLUDE_ONLY template <typename T> @@ -326,6 +339,43 @@ return ostr; } + template <typename T> + bool operator == (const set<T>& lhs, const set<T>& rhs) + { + const unsigned n = lhs.nelements(); + if (rhs.nelements() != n) + return false; + for (unsigned i = 0; i < n; ++i) + if (lhs[i] != rhs[i]) + return false; + return true; + } + + template <typename T> + bool operator < (const set<T>& lhs, const set<T>& rhs) + { + return lhs.nelements() < rhs.nelements() && lhs <= rhs; + } + + template <typename T> + bool operator <= (const set<T>& lhs, const set<T>& rhs) + { + const unsigned + nl = lhs.nelements(), + nr = rhs.nelements(); + if (nl > nr) + return false; + // Every element of lhs can be found in rhs. + for (unsigned l = 0, r = 0; l < nl; ++l, ++r) + { + while (rhs[r] != lhs[l] && r < nr) + ++r; + if (r == nr) + return false; // lhs[l] has not been found in rhs. + } + return true; + } + # endif // ! MLN_INCLUDE_ONLY } // end of namespace mln::util Index: mln/util/greater_point.hh --- mln/util/greater_point.hh (revision 2040) +++ mln/util/greater_point.hh (working copy) @@ -44,7 +44,7 @@ class greater_point { public: - typedef mln_point(I) point; + typedef mln_psite(I) point; greater_point(const Image<I>& ima); @@ -73,7 +73,7 @@ template <typename I> bool - greater_point<I>::operator()(const mln_point(I)& x, const mln_point(I)& y) + greater_point<I>::operator()(const mln_psite(I)& x, const mln_psite(I)& y) { return ima_(x) > ima_(y); } Index: mln/util/lemmings.hh --- mln/util/lemmings.hh (revision 2040) +++ mln/util/lemmings.hh (working copy) @@ -49,14 +49,14 @@ template <typename I> struct lemmings_ : public Object< lemmings_<I> > { - lemmings_(const Image<I>& ima, const mln_point(I)& pt, - const mln_dpoint(I)& dpt, const mln_value(I)& val); + lemmings_(const Image<I>& ima, const mln_psite(I)& pt, + const mln_dpsite(I)& dpt, const mln_value(I)& val); - mln_point(I) operator()(); + mln_psite(I) operator()(); const I& ima_; - mln_point(I) pt_; - const mln_dpoint(I)& dpt_; + mln_psite(I) pt_; + const mln_dpsite(I)& dpt_; const mln_value(I)& val_; }; @@ -74,9 +74,9 @@ ** ima. */ template <typename I> - mln_point(I) - lemmings(const Image<I>& ima, const mln_point(I)& pt, - const mln_dpoint(I)& dpt, const mln_value(I)& val); + mln_psite(I) + lemmings(const Image<I>& ima, const mln_psite(I)& pt, + const mln_dpsite(I)& dpt, const mln_value(I)& val); # ifndef MLN_INCLUDE_ONLY @@ -84,8 +84,8 @@ template <typename I> inline - lemmings_<I>::lemmings_(const Image<I>& ima, const mln_point(I)& pt, - const mln_dpoint(I)& dpt, const mln_value(I)& val) + lemmings_<I>::lemmings_(const Image<I>& ima, const mln_psite(I)& pt, + const mln_dpsite(I)& dpt, const mln_value(I)& val) : ima_(exact(ima)), pt_(pt), dpt_(dpt), @@ -94,7 +94,7 @@ } template <typename I> - mln_point(I) + mln_psite(I) lemmings_<I>::operator()() { while (ima_.domain().has(pt_) && ima_(pt_) == val_) @@ -103,9 +103,9 @@ } template <typename I> - mln_point(I) - lemmings(const Image<I>& ima, const mln_point(I)& pt, - const mln_dpoint(I)& dpt, const mln_value(I)& val) + mln_psite(I) + lemmings(const Image<I>& ima, const mln_psite(I)& pt, + const mln_dpsite(I)& dpt, const mln_value(I)& val) { lemmings_<I> lm(ima, pt, dpt, val); return lm(); Index: sandbox/duhamel/translate_image.hh --- sandbox/duhamel/translate_image.hh (revision 2040) +++ sandbox/duhamel/translate_image.hh (working copy) @@ -51,11 +51,11 @@ template <typename I> struct data_< translate_image<I> > { - data_(I& ima, const mln_dpoint(I) dp); + data_(I& ima, const mln_dpsite(I) dp); I ima_; box2d bb_; - const mln_dpoint(I) dp_; + const mln_dpsite(I) dp_; }; } // end of namespace mln::internal @@ -101,7 +101,7 @@ using super_::has_data; /// Constructors. - translate_image(I& ima, const mln_dpoint(I) dp); + translate_image(I& ima, const mln_dpsite(I) dp); translate_image(); /// Return domain of translated_image. @@ -127,7 +127,7 @@ // internal::data_< translate_image<I,S> > template <typename I> - data_< translate_image<I> >::data_(I& ima, const mln_dpoint(I) dp) + data_< translate_image<I> >::data_(I& ima, const mln_dpsite(I) dp) : ima_ (ima), dp_ (dp) { @@ -144,7 +144,7 @@ } // end of namespace mln::internal template <typename I> - translate_image<I>::translate_image(I& ima, const mln_dpoint(I) dp) + translate_image<I>::translate_image(I& ima, const mln_dpsite(I) dp) { mln_precondition(ima.has_data()); this->data_ = new internal::data_< translate_image<I> >(ima, dp); @@ -158,7 +158,7 @@ template <typename I> bool translate_image<I>::has(const mln_psite(I)& p) const { - mln_point(I) np = p - this->data_->dp_; + mln_psite(I) np = p - this->data_->dp_; return this->data_->ima_.has(np); } @@ -167,7 +167,7 @@ translate_image<I>::operator()(const mln_psite(I)& p) const { mln_assertion(this->has(p)); - mln_point(I) np = p - this->data_->dp_; + mln_psite(I) np = p - this->data_->dp_; return this->data_->ima_(np); } @@ -177,7 +177,7 @@ translate_image<I>::operator()(const mln_psite(I)& p) { mln_assertion(this->has(p)); - mln_point(I) np = p - this->data_->dp_; + mln_psite(I) np = p - this->data_->dp_; return this->data_->ima_(np); } Index: sandbox/duhamel/canvas_chamfer.hh --- sandbox/duhamel/canvas_chamfer.hh (revision 2040) +++ sandbox/duhamel/canvas_chamfer.hh (working copy) @@ -46,7 +46,7 @@ typedef typename F::I I; typedef typename F::W W; - typedef mln_point(I) point; + typedef mln_psite(I) point; chamfer(F& f) : f(f) Index: sandbox/duhamel/canvas_labeling.hh --- sandbox/duhamel/canvas_labeling.hh (revision 2040) +++ sandbox/duhamel/canvas_labeling.hh (working copy) @@ -170,7 +170,7 @@ typedef typename F::N N; typedef typename F::O O; typedef typename F::S S; - typedef mln_point(I) point; + typedef mln_psite(I) point; // aux: mln_ch_value(O, bool) deja_vu; @@ -294,7 +294,7 @@ typedef typename F::N N; typedef typename F::O O; typedef typename F::S S; - typedef mln_point(I) point; + typedef mln_psite(I) point; labeling_fast(F& f) : f(f) Index: sandbox/duhamel/labeling_algo.hh --- sandbox/duhamel/labeling_algo.hh (revision 2040) +++ sandbox/duhamel/labeling_algo.hh (working copy) @@ -82,7 +82,7 @@ for_all(p) { - X x = mln_point(I)(p); + X x = mln_psite(I)(p); tab_mean[ima(p) - min].take(x); for_all (n) if (ima.has(n)) if (ima(p) != ima(n)) @@ -132,7 +132,7 @@ { if (orig(p) != 0) { - X x = mln_point(I)(p); + X x = mln_psite(I)(p); tab_mean[orig(p) - min].take(x); } } Index: sandbox/duhamel/border_duplicate.hh --- sandbox/duhamel/border_duplicate.hh (revision 2040) +++ sandbox/duhamel/border_duplicate.hh (working copy) @@ -73,7 +73,7 @@ const I& ima = exact(ima_); mln_precondition(ima.has_data()); - typedef mln_point(I) P; + typedef mln_psite(I) P; typename I::line_piter pl(ima.domain()); std::size_t len_c = exact(ima).bbox().len(P::dim - 1); std::size_t border = ima.border (); @@ -92,7 +92,7 @@ const I& ima = exact(ima_); mln_precondition(ima.has_data()); - typedef mln_point(I) P; + typedef mln_psite(I) P; typename I::line_piter pl(ima.domain()); std::size_t border = ima.border (); std::size_t border_2x = 2 * ima.border (); @@ -131,7 +131,7 @@ const I& ima = exact(ima_); mln_precondition(ima.has_data()); - typedef mln_point(I) P; + typedef mln_psite(I) P; typename I::line_piter pl(ima.domain()); std::size_t border = ima.border (); std::size_t border_2x = 2 * ima.border (); @@ -196,7 +196,7 @@ template <typename I> void duplicate(const Fast_Image<I>& ima_) { - typedef mln_point(I) P; + typedef mln_psite(I) P; const I& ima = exact(ima_); mln_precondition(ima.has_data()); Index: sandbox/duhamel/draw_mesh.hh --- sandbox/duhamel/draw_mesh.hh (revision 2040) +++ sandbox/duhamel/draw_mesh.hh (working copy) @@ -20,7 +20,7 @@ point2d p2, mln_value(I) link_v) { - mln_dpoint(I) d = p1 - p2; + mln_dpsite(I) d = p1 - p2; std::cout << "dx = " << d[0] Index: sandbox/duhamel/debug_print_3d_with_border.hh --- sandbox/duhamel/debug_print_3d_with_border.hh (revision 2040) +++ sandbox/duhamel/debug_print_3d_with_border.hh (working copy) @@ -43,7 +43,7 @@ const I& ima = exact(input_); mln_precondition(ima.has_data()); - typedef mln_point(I) P; + typedef mln_psite(I) P; std::size_t len_s = exact(ima).bbox().len(P::dim - 3); std::size_t len_r = exact(ima).bbox().len(P::dim - 2); Index: sandbox/duhamel/labeling_cpy_from_mln.hh --- sandbox/duhamel/labeling_cpy_from_mln.hh (revision 2040) +++ sandbox/duhamel/labeling_cpy_from_mln.hh (working copy) @@ -56,7 +56,7 @@ typedef typename F::N N; typedef typename F::O O; typedef typename F::S S; - typedef mln_point(I) point; + typedef mln_psite(I) point; // aux: mln_ch_value(O, bool) deja_vu; @@ -165,7 +165,7 @@ typedef typename F::N N; typedef typename F::O O; typedef typename F::S S; - typedef mln_point(I) point; + typedef mln_psite(I) point; labeling_fast(F& f) : f(f) Index: sandbox/duhamel/border_fill.hh --- sandbox/duhamel/border_fill.hh (revision 2040) +++ sandbox/duhamel/border_fill.hh (working copy) @@ -68,7 +68,7 @@ const I& ima = exact(ima_); mln_precondition(ima.has_data()); - typedef mln_point(I) P; + typedef mln_psite(I) P; std::size_t border = ima.border (); std::size_t len = exact(ima).bbox().len(P::dim - 1); @@ -87,7 +87,7 @@ const I& ima = exact(ima_); mln_precondition(ima.has_data()); - typedef mln_point(I) P; + typedef mln_psite(I) P; std::size_t border = ima.border (); std::size_t len = exact(ima).bbox().len(P::dim - 1); std::size_t i = 0; @@ -106,7 +106,7 @@ const I& ima = exact(ima_); mln_precondition(ima.has_data()); - typedef mln_point(I) P; + typedef mln_psite(I) P; std::size_t border = ima.border (); std::size_t border_2x = 2 * border; @@ -139,7 +139,7 @@ const I& ima = exact(ima_); mln_precondition(ima.has_data()); - typedef mln_point(I) P; + typedef mln_psite(I) P; std::size_t border = ima.border (); std::size_t border_2x = 2 * border; @@ -169,7 +169,7 @@ // const I& ima = exact(ima_); // mln_precondition(ima.has_data()); -// typedef mln_point(I) P; +// typedef mln_psite(I) P; // std::size_t border = ima.border (); // std::size_t border_2x = 2 * border; @@ -222,9 +222,9 @@ template <typename I> void fill_size_1_(const Fast_Image<I>& ima_, const mln_value(I)& v) { - typedef mln_point(I) P; + typedef mln_psite(I) P; const I& ima = exact(ima_); - typedef mln_point(I) P; + typedef mln_psite(I) P; typename I::line_piter pl(ima.domain()); std::size_t len_r = exact(ima).bbox().len(P::dim - 1); std::size_t st = 0; @@ -245,9 +245,9 @@ template <typename I> void fill_size_n_(const Fast_Image<I>& ima_, const mln_value(I)& v) { - typedef mln_point(I) P; + typedef mln_psite(I) P; const I& ima = exact(ima_); - typedef mln_point(I) P; + typedef mln_psite(I) P; typename I::line_piter pl(ima.domain()); std::size_t len_r = exact(ima).bbox().len(P::dim - 1); std::size_t st = 0; @@ -270,7 +270,7 @@ template <typename I> void fill(const Fast_Image<I>& ima_, const mln_value(I)& v) { - typedef mln_point(I) P; + typedef mln_psite(I) P; const I& ima = exact(ima_); mln_precondition(ima.has_data()); Index: sandbox/duhamel/labeling_level.hh --- sandbox/duhamel/labeling_level.hh (revision 2040) +++ sandbox/duhamel/labeling_level.hh (working copy) @@ -101,7 +101,7 @@ mln_bkd_pixter(const I) p(f.input); // mln_nixter(const I, N) n(p, f.nbh); - typedef window<mln_dpoint(I)> W; + typedef window<mln_dpsite(I)> W; W win = convert::to_upper_window(f.nbh); mln_qixter(const I, W) n(p, win); Index: sandbox/duhamel/labeling.hh --- sandbox/duhamel/labeling.hh (revision 2040) +++ sandbox/duhamel/labeling.hh (working copy) @@ -33,7 +33,7 @@ typedef typename F::N N; typedef typename F::O O; typedef typename F::S S; - typedef mln_point(I) point; + typedef mln_psite(I) point; // // aux: // mln_ch_value(O, bool) deja_vu; Index: sandbox/nivault/median.hh --- sandbox/nivault/median.hh (revision 2040) +++ sandbox/nivault/median.hh (working copy) @@ -90,7 +90,7 @@ template <typename I, typename O> struct median_dir_t { - typedef mln_point(I) point; + typedef mln_psite(I) point; enum { dim = point::dim }; // i/o @@ -100,7 +100,7 @@ O& output; // aux data - const mln_point(I) + const mln_psite(I) pmin = input.domain().pmin(), pmax = input.domain().pmax(); const mln_coord(I) @@ -132,9 +132,9 @@ { } - void process(const mln_point(I)& p_) + void process(const mln_psite(I)& p_) { - mln_point(I) + mln_psite(I) p = p_, pt = p, pu = p; @@ -241,7 +241,7 @@ Image<O>& output) { mln_precondition(exact(output).domain() == exact(input).domain()); - typedef mln_point(I) P; + typedef mln_psite(I) P; mln_precondition(dir < P::dim); mln_precondition(length % 2 == 1); impl::median_dir_(exact(input), exact(win), exact(output)); Index: sandbox/jardonnet/subsampling/gaussian_subsampling.hh --- sandbox/jardonnet/subsampling/gaussian_subsampling.hh (revision 2040) +++ sandbox/jardonnet/subsampling/gaussian_subsampling.hh (working copy) @@ -56,7 +56,7 @@ inline mln_concrete(I) gaussian_subsampling(const Image<I>& input, float sigma, - const mln_dpoint(I)& first_p, + const mln_dpsite(I)& first_p, const mln_coord(I)& gap); # ifndef MLN_INCLUDE_ONLY @@ -66,7 +66,7 @@ inline mln_concrete(I) gaussian_subsampling(const Image<I>& input, float sigma, - const mln_dpoint(I)& first_p, + const mln_dpsite(I)& first_p, const mln_coord(I)& gap) { trace::entering("subsampling::gaussian_subsampling"); Index: sandbox/jardonnet/subsampling/sub_sampled_image.hh --- sandbox/jardonnet/subsampling/sub_sampled_image.hh (revision 2040) +++ sandbox/jardonnet/subsampling/sub_sampled_image.hh (working copy) @@ -55,13 +55,13 @@ /// /// \param ima The underlying image. /// \param box The bounding box (domain) of the morphed image. - data_(I& ima, mln::box_<mln_point(I)>& box); + data_(I& ima, mln::box_<mln_psite(I)>& box); /// Underlying image. I ima_; /// The bounding box of the morphed image. - mln::box_<mln_point(I)> box_; + mln::box_<mln_psite(I)> box_; }; } // end of namespace mln::internal @@ -95,33 +95,33 @@ /// Give the definition domain. - const box_<mln_point(I)>& domain() const; + const box_<mln_psite(I)>& domain() const; /// Test if this image has been initialized. bool has_data() const; /// Test if a pixel value is accessible at \p p. - bool has(const mln_point(I)& p) const; + bool has(const mln_psite(I)& p) const; /// Give the set of values of the image. const vset& values() const; /// Read-only access of pixel value at point site \p p. - mln_rvalue(I) operator()(const mln_point(I)& p) const; + mln_rvalue(I) operator()(const mln_psite(I)& p) const; /// Read-write access of pixel value at point site \p p. - lvalue operator()(const mln_point(I)& p); + lvalue operator()(const mln_psite(I)& p); public: - sub_sampled_image(I& ima, const mln_point(I)& first_p, int gap); + sub_sampled_image(I& ima, const mln_psite(I)& first_p, int gap); - void set_sampling(const mln_point(I)& first_p, int gap); + void set_sampling(const mln_psite(I)& first_p, int gap); protected: /// Compute physical coordinates. - mln_point(I) translate_coords_(const mln_point(I)& p) const; + mln_psite(I) translate_coords_(const mln_psite(I)& p) const; - const mln_point(I)& first_p; + const mln_psite(I)& first_p; int gap; }; @@ -135,7 +135,7 @@ template <typename I> inline - data_< sub_sampled_image<I> >::data_(I& ima, mln::box_<mln_point(I)>& box) + data_< sub_sampled_image<I> >::data_(I& ima, mln::box_<mln_psite(I)>& box) : ima_(ima), box_(box) { } @@ -144,17 +144,17 @@ template <typename I> - sub_sampled_image<I>::sub_sampled_image(I& ima, const mln_point(I)& first_p, int gap) + sub_sampled_image<I>::sub_sampled_image(I& ima, const mln_psite(I)& first_p, int gap) : first_p(first_p), gap(gap) { - box_<mln_point(I)> box(ima.bbox().pmin(),ima.bbox().pmax()); + box_<mln_psite(I)> box(ima.bbox().pmin(),ima.bbox().pmax()); this->data_ = new internal::data_< sub_sampled_image<I> >(ima, box); } template <typename I> inline - const box_<mln_point(I)>& + const box_<mln_psite(I)>& sub_sampled_image<I>::domain() const { mln_precondition(this->has_data()); @@ -184,7 +184,7 @@ template <typename I> inline bool - sub_sampled_image<I>::has(const mln_point(I)& p) const + sub_sampled_image<I>::has(const mln_psite(I)& p) const { mln_precondition(this->has_data()); return this->delegatee_()->has(translate_coords_(p)); @@ -193,7 +193,7 @@ template <typename I> inline mln_rvalue(I) - sub_sampled_image<I>::operator()(const mln_point(I)& p) const + sub_sampled_image<I>::operator()(const mln_psite(I)& p) const { mln_precondition(this->has(p)); return (*this->delegatee_())(translate_coords_(p)); @@ -202,7 +202,7 @@ template <typename I> inline typename internal::morpher_lvalue_<I>::ret - sub_sampled_image<I>::operator()(const mln_point(I)& p) + sub_sampled_image<I>::operator()(const mln_psite(I)& p) { mln_precondition(this->has(p)); return (*this->delegatee_())(translate_coords_(p)); @@ -210,11 +210,11 @@ template <typename I> inline - mln_point(I) - sub_sampled_image<I>::translate_coords_(const mln_point(I)& p) const + mln_psite(I) + sub_sampled_image<I>::translate_coords_(const mln_psite(I)& p) const { - return mln_point(I)(algebra::vec<2, int>(p) * gap + algebra::vec<2, int>(first_p)); + return mln_psite(I)(algebra::vec<2, int>(p) * gap + algebra::vec<2, int>(first_p)); } Index: sandbox/jardonnet/registration/tools.hh --- sandbox/jardonnet/registration/tools.hh (revision 2040) +++ sandbox/jardonnet/registration/tools.hh (working copy) @@ -134,12 +134,12 @@ // to_p_array template <typename I> inline - p_array<mln_point(I)> + p_array<mln_psite(I)> to_p_array(const Image<I>& img_) { const I& img = exact(img_); - p_array<mln_point(I)> a; + p_array<mln_psite(I)> a; mln_piter(I) p(img.domain()); for_all(p) Index: sandbox/jardonnet/registration/chamfer.hh --- sandbox/jardonnet/registration/chamfer.hh (revision 2040) +++ sandbox/jardonnet/registration/chamfer.hh (working copy) @@ -46,9 +46,9 @@ * \pre \p img has to be initialized. */ template<typename I, typename T> - std::pair<mln_ch_value(I, T), mln_ch_value(I, mln_point(I))> + std::pair<mln_ch_value(I, T), mln_ch_value(I, mln_psite(I))> chamfer(const Image<I>& input_, - w_window<mln_dpoint(I), T> chamfer); + w_window<mln_dpsite(I), T> chamfer); # ifndef MLN_INCLUDE_ONLY @@ -67,18 +67,18 @@ template<typename Q, typename I, typename T> inline void - chamfer_pass(const w_window<mln_dpoint(I), T> chamfer, + chamfer_pass(const w_window<mln_dpsite(I), T> chamfer, const I& input, mln_ch_value(I, T)& outputDistance, - mln_ch_value(I, mln_point(I))& outputNearest) + mln_ch_value(I, mln_psite(I))& outputNearest) { - typedef w_window<mln_dpoint(I), T> W; + typedef w_window<mln_dpsite(I), T> W; Q p(input.domain()); mln_qiter(W) q(chamfer, p); for_all(p) { - std::pair<T, mln_point(I)> min(mln_max(T), p); + std::pair<T, mln_psite(I)> min(mln_max(T), p); for_all(q) if (input.has(q) && outputDistance(q) != mln_max(T)) @@ -108,11 +108,11 @@ template<typename I, typename T> inline - std::pair<mln_ch_value(I, T), mln_ch_value(I, mln_point(I))> + std::pair<mln_ch_value(I, T), mln_ch_value(I, mln_psite(I))> chamfer(const Image<I>& input_, - w_window<mln_dpoint(I), T> chamfer) + w_window<mln_dpsite(I), T> chamfer) { - typedef w_window<mln_dpoint(I), T> W; + typedef w_window<mln_dpsite(I), T> W; const I& input = exact(input_); mln_precondition(input.has_data()); @@ -120,7 +120,7 @@ mln_ch_value(I, T) outputDistance; initialize(outputDistance, input); - mln_ch_value(I, mln_point(I)) outputNearest; + mln_ch_value(I, mln_psite(I)) outputNearest; initialize(outputNearest, input); // Initialization. @@ -143,7 +143,7 @@ impl::chamfer_pass<mln_bkd_piter(I)> (chamfer, input, outputDistance, outputNearest); - return std::pair<mln_ch_value(I, T), mln_ch_value(I, mln_point(I))> + return std::pair<mln_ch_value(I, T), mln_ch_value(I, mln_psite(I))> (outputDistance, outputNearest); } Index: sandbox/geraud/cs2d/cs2d_morpho.hh --- sandbox/geraud/cs2d/cs2d_morpho.hh (revision 2040) +++ sandbox/geraud/cs2d/cs2d_morpho.hh (working copy) @@ -23,7 +23,7 @@ mln_piter(I) p(input.domain()); for_all(p) { - mln_point(I) p_ = p; + mln_psite(I) p_ = p; input(p) = p_.row() % 2 ? // Odd so horizontal edge and vertical cells. Index: sandbox/garrigues/image_identity/interpolated.hh --- sandbox/garrigues/image_identity/interpolated.hh (revision 2040) +++ sandbox/garrigues/image_identity/interpolated.hh (working copy) @@ -151,7 +151,7 @@ template <typename I> bool interpolated<I>::has(const mln::algebra::vec<I::point::dim, float>& v) const { - mln_point(I) p; + mln_psite(I) p; for (unsigned i = 0; i < I::point::dim; ++i) p[i] = static_cast<int>(round(v[i])); return this->data_->ima_.has(p); @@ -161,7 +161,7 @@ mln_value(I) interpolated<I>::operator()(const mln::algebra::vec<I::point::dim, float>& v) const { - mln_point(I) p; + mln_psite(I) p; for (unsigned i = 0; i < I::point::dim; ++i) p[i] = static_cast<int>(round(v[i])); mln_assertion(this->data_->ima_.has(p)); Index: sandbox/folio/canevas_dt.hh --- sandbox/folio/canevas_dt.hh (revision 2040) +++ sandbox/folio/canevas_dt.hh (working copy) @@ -31,7 +31,7 @@ typedef typename F::I I; typedef typename F::N N; typedef typename F::L L; - typedef mln_point(I) point; + typedef mln_psite(I) point; mln_ch_value(I, L) output; @@ -56,7 +56,7 @@ typedef typename F::I I; typedef typename F::N N; typedef typename F::L L; - typedef mln_point(I) point; + typedef mln_psite(I) point; mln_ch_value(I, L) output;
participants (1)
-
Thierry Geraud