olena-2.0-154-g1e0a65a Move display_enlarged to kn.

* mln/world/k1/display_enlarged.hh, * tests/world/k1/display_enlarged.cc: Move... * mln/world/kn/display_enlarged.hh, * tests/world/kn/display_enlarged.cc: ... here. * tests/world/k1/Makefile.am, * tests/world/kn/Makefile.am: Update targets. --- milena/ChangeLog | 13 +++++ milena/mln/world/{k1 => kn}/display_enlarged.hh | 50 ++++++++++---------- milena/tests/world/k1/Makefile.am | 2 - milena/tests/world/kn/Makefile.am | 2 + milena/tests/world/{k1 => kn}/display_enlarged.cc | 12 ++--- 5 files changed, 44 insertions(+), 35 deletions(-) rename milena/mln/world/{k1 => kn}/display_enlarged.hh (74%) rename milena/tests/world/{k1 => kn}/display_enlarged.cc (90%) diff --git a/milena/ChangeLog b/milena/ChangeLog index 04ceae2..bc3b35c 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,18 @@ 2012-10-29 Guillaume Lazzara <z@lrde.epita.fr> + Move display_enlarged to kn. + + * mln/world/k1/display_enlarged.hh, + * tests/world/k1/display_enlarged.cc: Move... + + * mln/world/kn/display_enlarged.hh, + * tests/world/kn/display_enlarged.cc: ... here. + + * tests/world/k1/Makefile.am, + * tests/world/kn/Makefile.am: Update targets. + +2012-10-29 Guillaume Lazzara <z@lrde.epita.fr> + Fix level comparisons. * mln/fun/v2b/compare.hh, diff --git a/milena/mln/world/k1/display_enlarged.hh b/milena/mln/world/kn/display_enlarged.hh similarity index 74% rename from milena/mln/world/k1/display_enlarged.hh rename to milena/mln/world/kn/display_enlarged.hh index fa437d4..5d1ef50 100644 --- a/milena/mln/world/k1/display_enlarged.hh +++ b/milena/mln/world/kn/display_enlarged.hh @@ -28,8 +28,8 @@ /// \brief Create a new image where 2 faces are enlarged for better /// visualization. -#ifndef MLN_WORLD_K1_DISPLAY_ENLARGED_HH -# define MLN_WORLD_K1_DISPLAY_ENLARGED_HH +#ifndef MLN_WORLD_KN_DISPLAY_ENLARGED_HH +# define MLN_WORLD_KN_DISPLAY_ENLARGED_HH # include <mln/core/alias/point2d.hh> # include <mln/world/kn/is_0_face.hh> @@ -45,7 +45,7 @@ namespace mln namespace world { - namespace k1 + namespace kn { /*! \brief Create a new image where 2 faces are enlarged for better @@ -64,7 +64,7 @@ namespace mln . - - - . - - - . \endverbatim - \param[in] ima_k1 A 2D image immersed in K1. + \param[in] ima_kn A 2D image immersed in KN. \param[in] zoom The number of times 2 faces must be duplicated (must be odd). @@ -75,7 +75,7 @@ namespace mln */ template <typename I> mln_concrete(I) - display_enlarged(const Image<I>& ima_k1, unsigned zoom); + display_enlarged(const Image<I>& ima_kn, unsigned zoom); # ifndef MLN_INCLUDE_ONLY @@ -85,30 +85,30 @@ namespace mln template <typename I> mln_concrete(I) - display_enlarged(const Image<I>& ima_k1_, unsigned zoom_) + display_enlarged(const Image<I>& ima_kn_, unsigned zoom_) { - trace::entering("mln::world::k1::display_enlarged"); + trace::entering("mln::world::kn::display_enlarged"); - mln_precondition(exact(ima_k1_).is_valid()); + mln_precondition(exact(ima_kn_).is_valid()); mln_assertion(zoom_ % 2); - const I& ima_k1 = exact(ima_k1_); + const I& ima_kn = exact(ima_kn_); int shift = zoom_ - 1; // No zoom: return original image. if (zoom_ == 1) - return ima_k1; + return ima_kn; - mln_concrete(I) output(make::box2d(ima_k1.domain().pmin().row() * shift, - ima_k1.domain().pmin().col() * shift, - ima_k1.domain().pmax().row() * shift, - ima_k1.domain().pmax().col() * shift)); + mln_concrete(I) output(make::box2d(ima_kn.domain().pmin().row() * shift, + ima_kn.domain().pmin().col() * shift, + ima_kn.domain().pmax().row() * shift, + ima_kn.domain().pmax().col() * shift)); const mln::def::coord - min_row = geom::min_row(ima_k1), - max_row = geom::max_row(ima_k1), - min_col = geom::min_col(ima_k1), - max_col = geom::max_col(ima_k1); + min_row = geom::min_row(ima_kn), + max_row = geom::max_row(ima_kn), + min_col = geom::min_col(ima_kn), + max_col = geom::max_col(ima_kn); for (mln::def::coord row = min_row; row <= max_row; ++row) { @@ -116,39 +116,39 @@ namespace mln { if (kn::is_0_face(row, col)) { - output.at_(row * shift, col * shift) = ima_k1.at_(row, col); + output.at_(row * shift, col * shift) = ima_kn.at_(row, col); } else if (kn::is_1_face_vertical(row, col)) { for (mln::def::coord j = -(shift - 1); j < (shift + 3); ++j) - output.at_(row * shift + j, col * shift) = ima_k1.at_(row, col); + output.at_(row * shift + j, col * shift) = ima_kn.at_(row, col); } else if (kn::is_1_face_horizontal(row, col)) { for (mln::def::coord j = -(shift - 1); j < (shift + 3); ++j) - output.at_(row * shift, col * shift + j) = ima_k1.at_(row, col); + output.at_(row * shift, col * shift + j) = ima_kn.at_(row, col); } else if (kn::is_2_face(row, col)) { for (mln::def::coord i = -(shift - 1); i < (shift + 3); ++i) for (mln::def::coord j = -(shift - 1); j < (shift + 3); ++j) - output.at_(row * shift + i, col * shift + j) = ima_k1.at_(row, col); + output.at_(row * shift + i, col * shift + j) = ima_kn.at_(row, col); } } } - trace::exiting("mln::world::k1::display_enlarged"); + trace::exiting("mln::world::kn::display_enlarged"); return output; } # endif // ! MLN_INCLUDE_ONLY - } // end of namespace mln::world::k1 + } // end of namespace mln::world::kn } // end of namespace mln::world } // end of namespace mln -#endif // ! MLN_WORLD_K1_DISPLAY_ENLARGED_HH +#endif // ! MLN_WORLD_KN_DISPLAY_ENLARGED_HH diff --git a/milena/tests/world/k1/Makefile.am b/milena/tests/world/k1/Makefile.am index 3ff9c81..3c1e29c 100644 --- a/milena/tests/world/k1/Makefile.am +++ b/milena/tests/world/k1/Makefile.am @@ -17,7 +17,6 @@ include $(top_srcdir)/milena/tests/tests.mk check_PROGRAMS = \ - display_enlarged \ fill_0_from_1_faces \ fill_1_from_2_faces \ fill_0_from_primary_faces \ @@ -29,7 +28,6 @@ check_PROGRAMS = \ is_primary_face \ un_immerse -display_enlarged_SOURCES = display_enlarged.cc fill_0_from_1_faces_SOURCES = fill_0_from_1_faces.cc fill_1_from_2_faces_SOURCES = fill_1_from_2_faces.cc fill_0_from_primary_faces_SOURCES = fill_0_from_primary_faces.cc diff --git a/milena/tests/world/kn/Makefile.am b/milena/tests/world/kn/Makefile.am index d7d2fbe..9a52eb6 100644 --- a/milena/tests/world/kn/Makefile.am +++ b/milena/tests/world/kn/Makefile.am @@ -21,6 +21,7 @@ SUBDIRS = \ border check_PROGRAMS = \ + display_enlarged \ fill_0_1_faces_internal_border \ fill_0_from_1_faces \ fill_0_from_2_faces \ @@ -41,6 +42,7 @@ check_PROGRAMS = \ saturate \ un_immerse +display_enlarged_SOURCES = display_enlarged.cc fill_0_1_faces_internal_border_SOURCES = fill_0_1_faces_internal_border.cc fill_0_from_1_faces_SOURCES = fill_0_from_1_faces.cc fill_0_from_2_faces_SOURCES = fill_0_from_2_faces.cc diff --git a/milena/tests/world/k1/display_enlarged.cc b/milena/tests/world/kn/display_enlarged.cc similarity index 90% rename from milena/tests/world/k1/display_enlarged.cc rename to milena/tests/world/kn/display_enlarged.cc index 3365fbe..33b5909 100644 --- a/milena/tests/world/k1/display_enlarged.cc +++ b/milena/tests/world/kn/display_enlarged.cc @@ -26,13 +26,9 @@ /// \file #include <mln/core/image/image2d.hh> -#include <mln/world/k1/display_enlarged.hh> -#include <mln/world/k1/immerse.hh> -#include <mln/make/box2d.hh> +#include <mln/world/kn/display_enlarged.hh> #include <mln/data/compare.hh> -#include <mln/debug/println.hh> - int main() { using namespace mln; @@ -80,19 +76,19 @@ int main() image2d<int> ima = make::image(vals, point2d(-1, -1)); { - image2d<int> enlarged = world::k1::display_enlarged(ima, 1); + image2d<int> enlarged = world::kn::display_enlarged(ima, 1); mln_assertion(ima == enlarged); } { image2d<int> ref3 = make::image(vals3, point2d(-2, -2)); - image2d<int> enlarged = world::k1::display_enlarged(ima, 3); + image2d<int> enlarged = world::kn::display_enlarged(ima, 3); mln_assertion(ref3 == enlarged); } { image2d<int> ref5 = make::image(vals5, point2d(-4, -4)); - image2d<int> enlarged = world::k1::display_enlarged(ima, 5); + image2d<int> enlarged = world::kn::display_enlarged(ima, 5); mln_assertion(ref5 == enlarged); } } -- 1.7.2.5
participants (1)
-
Guillaume Lazzara