
* headers.mk: add new headers to distribution. * mln/core/internal/site_relative_iterator_base.hh: avoid a warning. * mln/labeling/blobs.hh, * mln/draw/line.hh: use trace::warning. * mln/trace/warning.hh: always print warnings. * mln/fun/x2x/rotation.hh: fix a precondition. * mln/morpho/tree/data.hh: add a missing method. * tests/level/median.cc: add a missing include. * tests/unit_test/Makefile.am, * tests/unit_test/mln_accu_transform_line.cc, * tests/unit_test/mln_convert_impl_from_double_to_value.cc, * tests/unit_test/mln_opt_value.cc: add missing unit_tests. * tests/unit_test/mln_histo_data.cc: rename as... * tests/unit_test/mln_histo_array.cc: ... this. --- milena/ChangeLog | 27 ++++++++++++++++++++ milena/headers.mk | 5 +++- .../core/internal/site_relative_iterator_base.hh | 2 +- milena/mln/draw/line.hh | 13 +++++---- milena/mln/fun/x2x/rotation.hh | 21 +++++++++------ milena/mln/labeling/blobs.hh | 6 ++-- milena/mln/morpho/tree/data.hh | 7 +++++ milena/mln/trace/warning.hh | 11 ++++--- milena/tests/level/median.cc | 1 + milena/tests/unit_test/Makefile.am | 10 ++++++- ...ln_histo_data.cc => mln_accu_transform_line.cc} | 6 ++-- .../mln_convert_impl_from_double_to_value.cc | 11 ++++++++ .../{mln_histo_data.cc => mln_histo_array.cc} | 6 ++-- .../{mln_histo_data.cc => mln_opt_value.cc} | 6 ++-- 14 files changed, 96 insertions(+), 36 deletions(-) copy milena/tests/unit_test/{mln_histo_data.cc => mln_accu_transform_line.cc} (55%) create mode 100644 milena/tests/unit_test/mln_convert_impl_from_double_to_value.cc copy milena/tests/unit_test/{mln_histo_data.cc => mln_histo_array.cc} (60%) rename milena/tests/unit_test/{mln_histo_data.cc => mln_opt_value.cc} (61%) diff --git a/milena/ChangeLog b/milena/ChangeLog index 583f2d7..5dee5c1 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,32 @@ 2009-01-16 Guillaume Lazzara <z@lrde.epita.fr> + Small fixes. + + * headers.mk: add new headers to distribution. + + * mln/core/internal/site_relative_iterator_base.hh: avoid a warning. + + * mln/labeling/blobs.hh, + * mln/draw/line.hh: use trace::warning. + + * mln/trace/warning.hh: always print warnings. + + * mln/fun/x2x/rotation.hh: fix a precondition. + + * mln/morpho/tree/data.hh: add a missing method. + + * tests/level/median.cc: add a missing include. + + * tests/unit_test/Makefile.am, + * tests/unit_test/mln_accu_transform_line.cc, + * tests/unit_test/mln_convert_impl_from_double_to_value.cc, + * tests/unit_test/mln_opt_value.cc: add missing unit_tests. + + * tests/unit_test/mln_histo_data.cc: rename as... + * tests/unit_test/mln_histo_array.cc: ... this. + +2009-01-16 Guillaume Lazzara <z@lrde.epita.fr> + Add soft heap implementation. * headers.mk: add new headers to distribution. diff --git a/milena/headers.mk b/milena/headers.mk index 9380631..a526da5 100644 --- a/milena/headers.mk +++ b/milena/headers.mk @@ -3,7 +3,7 @@ nobase_include_HEADERS = \ mln/version.hh \ mln/histo/all.hh \ -mln/histo/data.hh \ +mln/histo/array.hh \ mln/histo/compute.hh \ mln/histo/compute.spe.hh \ mln/histo/essential.hh \ @@ -263,6 +263,7 @@ mln/convert/to_window.hh \ mln/convert/from_to.hh \ mln/convert/impl/from_value_to_value.hh \ mln/convert/impl/all.hh \ +mln/convert/impl/from_double_to_value.hh \ mln/convert/impl/from_image_to_site_set.hh \ mln/convert/impl/from_float_to_value.hh \ mln/convert/impl/from_int_to_value.hh \ @@ -372,6 +373,7 @@ mln/accu/count_adjacent_vertices.hh \ mln/accu/convolve.hh \ mln/accu/v.hh \ mln/accu/rank_bool.hh \ +mln/accu/transform_line.hh \ mln/accu/min.hh \ mln/accu/transform_directional.hh \ mln/accu/compute.hh \ @@ -425,6 +427,7 @@ mln/math/essential.hh \ mln/math/acos.hh \ mln/math/round_sat.hh \ mln/opt/at.hh \ +mln/opt/value.hh \ mln/binarization/includes.hh \ mln/binarization/all.hh \ mln/binarization/binarization.hh \ diff --git a/milena/mln/core/internal/site_relative_iterator_base.hh b/milena/mln/core/internal/site_relative_iterator_base.hh index 78e42d3..d186b87 100644 --- a/milena/mln/core/internal/site_relative_iterator_base.hh +++ b/milena/mln/core/internal/site_relative_iterator_base.hh @@ -238,7 +238,7 @@ namespace mln template <typename P> inline void - site_relative_iterator_base<S,E>::center_at_(const P& c) + site_relative_iterator_base<S,E>::center_at_(const P&) { // Default is no-op, meaning "no extra code". } diff --git a/milena/mln/draw/line.hh b/milena/mln/draw/line.hh index 096b041..09d8003 100644 --- a/milena/mln/draw/line.hh +++ b/milena/mln/draw/line.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory +// Copyright (C) 2007, 2008, 2009 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -28,10 +29,9 @@ #ifndef MLN_DRAW_LINE_HH # define MLN_DRAW_LINE_HH -/*! \file mln/draw/line.hh - * - * \brief Draw a line in an image. - */ +/// \file mln/draw/line.hh +/// +/// Draw a line in an image. # include <mln/core/concept/image.hh> # include <mln/core/site_set/p_line2d.hh> @@ -76,7 +76,8 @@ namespace mln { I& ima = exact(ima_); mln_precondition(ima.is_valid()); - // if (! ima.has(beg) || ! ima.has(end)) trace::warning("out"); + if (! ima.has(beg) || ! ima.has(end)) + trace::warning("Begin or end site is not part of the given image."); data::paste(pw::cst(v) | p_line2d(beg, end), safe(ima).rw()); } diff --git a/milena/mln/fun/x2x/rotation.hh b/milena/mln/fun/x2x/rotation.hh index ff6bbcf..039fe66 100644 --- a/milena/mln/fun/x2x/rotation.hh +++ b/milena/mln/fun/x2x/rotation.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2007, 2008, 2009 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -53,29 +53,32 @@ namespace mln { template < unsigned n, typename C > algebra::h_mat<n, C> - get_rot_h_mat(const float alpha_, const algebra::vec<3,C>& axis_) + get_rot_h_mat(const float alpha_, const algebra::vec<n,C>& axis_) { - assert(!"get_h_mat : n not implemented"); + mln_assertion(!"get_h_mat : n not implemented"); } template <typename C > algebra::h_mat<3, C> get_rot_h_mat(const float alpha_, const algebra::vec<3,C>& axis_) { - algebra::h_mat<3, C> m_; + //test axis is valid + typedef algebra::vec<3,C> vec_t; + //FIXME: cannot use '!=' operator. + mln_precondition(!(axis_ == vec_t(literal::zero))); const float cos_a = cos(alpha_); const float sin_a = sin(alpha_); const float u = axis_[0]; const float v = axis_[1]; const float w = axis_[2]; - //test axis is valid - assert(u != 0 && v != 0 && w != 0); const float u2 = u * u; const float v2 = v * v; const float w2 = w * w; const float uvw2 = u2 + v2 + w2; + algebra::h_mat<3, C> m_; + m_(0,0) = (u2 + (v2 + w2) * cos_a) / uvw2; m_(0,1) = (u*v * (1 - cos_a) - u * std::sqrt(uvw2) * sin_a) / uvw2; m_(0,2) = (u*w * (1 - cos_a) + v * std::sqrt(uvw2) * sin_a) / uvw2; @@ -103,11 +106,11 @@ namespace mln algebra::h_mat<2, C> get_rot_h_mat(const float alpha_, const algebra::vec<2,C>&) { - algebra::h_mat<2, C> m_; - const float cos_a = cos(alpha_); const float sin_a = sin(alpha_); + algebra::h_mat<2, C> m_; + m_(0,0) = cos_a; m_(0,1) = -sin_a; m_(0,2) = 0; m_(1,0) = sin_a; m_(1,1) = cos_a; m_(1,2) = 0; m_(2,0) = 0; m_(2,1) = 0; m_(2,2) = 1; diff --git a/milena/mln/labeling/blobs.hh b/milena/mln/labeling/blobs.hh index 789eec4..dc2dba0 100644 --- a/milena/mln/labeling/blobs.hh +++ b/milena/mln/labeling/blobs.hh @@ -1,5 +1,5 @@ -// Copyright (C) 2007, 2008 EPITA Research and Development Laboratory -// (LRDE) +// Copyright (C) 2007, 2008, 2009 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -101,7 +101,7 @@ namespace mln // Label this point component. if (nlabels == mln_max(L)) { - std::cerr << "FIXME: labeling aborted!" << std::endl; + trace::warning("labeling aborted!"); return output; } ++nlabels; diff --git a/milena/mln/morpho/tree/data.hh b/milena/mln/morpho/tree/data.hh index c7c7f86..d7871c1 100644 --- a/milena/mln/morpho/tree/data.hh +++ b/milena/mln/morpho/tree/data.hh @@ -105,6 +105,13 @@ namespace mln return parent_(p) == p || f_(parent_(p)) != f_(p); } + bool is_a_non_root_node(const mln_psite(I)& p) const + { + mln_precondition(is_valid()); + mln_precondition(parent_.domain().has(p)); + return f_(parent_(p)) != f_(p); + } + /// \} diff --git a/milena/mln/trace/warning.hh b/milena/mln/trace/warning.hh index c130da6..5e3ba29 100644 --- a/milena/mln/trace/warning.hh +++ b/milena/mln/trace/warning.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2008 EPITA Research and Development Laboratory +// Copyright (C) 2008, 2009 EPITA Research and Development Laboratory +// (LRDE) // // This file is part of the Olena Library. This library is free // software; you can redistribute it and/or modify it under the terms @@ -29,6 +30,7 @@ # define MLN_TRACE_WARNING_HH /// \file mln/trace/warning.hh +/// /// Display warning message in trace output. # include <string> @@ -50,10 +52,9 @@ namespace mln inline void warning(const std::string& message) { - if (!quiet) - std::cout << "Warning: " - << message - << std::endl; + std::cout << "Warning: " + << message + << std::endl; } # endif // ! MLN_INCLUDE_ONLY diff --git a/milena/tests/level/median.cc b/milena/tests/level/median.cc index 0d749e2..40ca061 100644 --- a/milena/tests/level/median.cc +++ b/milena/tests/level/median.cc @@ -31,6 +31,7 @@ /// Test on mln::level::median. #include <mln/core/image/image2d.hh> +#include <mln/level/compare.hh> #include <mln/win/rectangle2d.hh> #include <mln/io/pgm/load.hh> diff --git a/milena/tests/unit_test/Makefile.am b/milena/tests/unit_test/Makefile.am index 2eef268..1d3d7cd 100644 --- a/milena/tests/unit_test/Makefile.am +++ b/milena/tests/unit_test/Makefile.am @@ -4,7 +4,7 @@ include $(top_srcdir)/milena/tests/tests.mk check_PROGRAMS = \ mln_histo_all \ -mln_histo_data \ +mln_histo_array \ mln_histo_compute \ mln_histo_essential \ mln_geom_pmin_pmax \ @@ -260,6 +260,7 @@ mln_convert_to_window \ mln_convert_from_to \ mln_convert_impl_from_value_to_value \ mln_convert_impl_all \ +mln_convert_impl_from_double_to_value \ mln_convert_impl_from_image_to_site_set \ mln_convert_impl_from_float_to_value \ mln_convert_impl_from_int_to_value \ @@ -368,6 +369,7 @@ mln_accu_count_adjacent_vertices \ mln_accu_convolve \ mln_accu_v \ mln_accu_rank_bool \ +mln_accu_transform_line \ mln_accu_min \ mln_accu_transform_directional \ mln_accu_compute \ @@ -419,6 +421,7 @@ mln_math_essential \ mln_math_acos \ mln_math_round_sat \ mln_opt_at \ +mln_opt_value \ mln_binarization_includes \ mln_binarization_all \ mln_binarization_binarization \ @@ -1015,7 +1018,7 @@ mln_subsampling_subsampling \ mln_subsampling_essential mln_histo_all_SOURCES = mln_histo_all.cc -mln_histo_data_SOURCES = mln_histo_data.cc +mln_histo_array_SOURCES = mln_histo_array.cc mln_histo_compute_SOURCES = mln_histo_compute.cc mln_histo_essential_SOURCES = mln_histo_essential.cc mln_geom_pmin_pmax_SOURCES = mln_geom_pmin_pmax.cc @@ -1271,6 +1274,7 @@ mln_convert_to_window_SOURCES = mln_convert_to_window.cc mln_convert_from_to_SOURCES = mln_convert_from_to.cc mln_convert_impl_from_value_to_value_SOURCES = mln_convert_impl_from_value_to_value.cc mln_convert_impl_all_SOURCES = mln_convert_impl_all.cc +mln_convert_impl_from_double_to_value_SOURCES = mln_convert_impl_from_double_to_value.cc mln_convert_impl_from_image_to_site_set_SOURCES = mln_convert_impl_from_image_to_site_set.cc mln_convert_impl_from_float_to_value_SOURCES = mln_convert_impl_from_float_to_value.cc mln_convert_impl_from_int_to_value_SOURCES = mln_convert_impl_from_int_to_value.cc @@ -1379,6 +1383,7 @@ mln_accu_count_adjacent_vertices_SOURCES = mln_accu_count_adjacent_vertices.cc mln_accu_convolve_SOURCES = mln_accu_convolve.cc mln_accu_v_SOURCES = mln_accu_v.cc mln_accu_rank_bool_SOURCES = mln_accu_rank_bool.cc +mln_accu_transform_line_SOURCES = mln_accu_transform_line.cc mln_accu_min_SOURCES = mln_accu_min.cc mln_accu_transform_directional_SOURCES = mln_accu_transform_directional.cc mln_accu_compute_SOURCES = mln_accu_compute.cc @@ -1430,6 +1435,7 @@ mln_math_essential_SOURCES = mln_math_essential.cc mln_math_acos_SOURCES = mln_math_acos.cc mln_math_round_sat_SOURCES = mln_math_round_sat.cc mln_opt_at_SOURCES = mln_opt_at.cc +mln_opt_value_SOURCES = mln_opt_value.cc mln_binarization_includes_SOURCES = mln_binarization_includes.cc mln_binarization_all_SOURCES = mln_binarization_all.cc mln_binarization_binarization_SOURCES = mln_binarization_binarization.cc diff --git a/milena/tests/unit_test/mln_histo_data.cc b/milena/tests/unit_test/mln_accu_transform_line.cc similarity index 55% copy from milena/tests/unit_test/mln_histo_data.cc copy to milena/tests/unit_test/mln_accu_transform_line.cc index 1921ad8..acabfd1 100644 --- a/milena/tests/unit_test/mln_histo_data.cc +++ b/milena/tests/unit_test/mln_accu_transform_line.cc @@ -1,9 +1,9 @@ -// Unit test for mln/histo/data.hh. +// Unit test for mln/accu/transform_line.hh. // Generated by ./build_unit_test.sh, do not modify. // Include the file twice, so we detect missing inclusion guards. -#include <mln/histo/data.hh> -#include <mln/histo/data.hh> +#include <mln/accu/transform_line.hh> +#include <mln/accu/transform_line.hh> int main() { diff --git a/milena/tests/unit_test/mln_convert_impl_from_double_to_value.cc b/milena/tests/unit_test/mln_convert_impl_from_double_to_value.cc new file mode 100644 index 0000000..c1270ba --- /dev/null +++ b/milena/tests/unit_test/mln_convert_impl_from_double_to_value.cc @@ -0,0 +1,11 @@ +// Unit test for mln/convert/impl/from_double_to_value.hh. +// Generated by ./build_unit_test.sh, do not modify. + +// Include the file twice, so we detect missing inclusion guards. +#include <mln/convert/impl/from_double_to_value.hh> +#include <mln/convert/impl/from_double_to_value.hh> + +int main() +{ + // Nothing. +} diff --git a/milena/tests/unit_test/mln_histo_data.cc b/milena/tests/unit_test/mln_histo_array.cc similarity index 60% copy from milena/tests/unit_test/mln_histo_data.cc copy to milena/tests/unit_test/mln_histo_array.cc index 1921ad8..31baac6 100644 --- a/milena/tests/unit_test/mln_histo_data.cc +++ b/milena/tests/unit_test/mln_histo_array.cc @@ -1,9 +1,9 @@ -// Unit test for mln/histo/data.hh. +// Unit test for mln/histo/array.hh. // Generated by ./build_unit_test.sh, do not modify. // Include the file twice, so we detect missing inclusion guards. -#include <mln/histo/data.hh> -#include <mln/histo/data.hh> +#include <mln/histo/array.hh> +#include <mln/histo/array.hh> int main() { diff --git a/milena/tests/unit_test/mln_histo_data.cc b/milena/tests/unit_test/mln_opt_value.cc similarity index 61% rename from milena/tests/unit_test/mln_histo_data.cc rename to milena/tests/unit_test/mln_opt_value.cc index 1921ad8..48469ea 100644 --- a/milena/tests/unit_test/mln_histo_data.cc +++ b/milena/tests/unit_test/mln_opt_value.cc @@ -1,9 +1,9 @@ -// Unit test for mln/histo/data.hh. +// Unit test for mln/opt/value.hh. // Generated by ./build_unit_test.sh, do not modify. // Include the file twice, so we detect missing inclusion guards. -#include <mln/histo/data.hh> -#include <mln/histo/data.hh> +#include <mln/opt/value.hh> +#include <mln/opt/value.hh> int main() { -- 1.5.6.5