
* doc/tutorial/tutorial.tex: Fix a compilation issue. * headers.mk: update distributed file list. * mln/win/ball.hh, * mln/core/concept/function.hh: avoid a warning. * mln/util/array.hh, * mln/fun/i2v/array.hh: revert invalid from_to overloads. * mln/fun/internal/array_base.hh: add reserve(). * mln/fun/l2l/relabel.hh: reserve data before appending. * mln/io/pnm/save.hh: Allow images of builtin types to be saved. * tests/geom/Makefile.am, * tests/morpho/Makefile.am, * tests/util/Makefile.am: do not set tests as xfail tests anymore. * tests/unit_test/unit-tests.mk: update unit test list. --- milena/ChangeLog | 26 ++++++++++++++++++++++++++ milena/doc/tutorial/tutorial.tex | 2 +- milena/headers.mk | 2 ++ milena/mln/core/concept/function.hh | 3 ++- milena/mln/fun/i2v/array.hh | 18 ++---------------- milena/mln/fun/internal/array_base.hh | 11 +++++++++++ milena/mln/fun/l2l/relabel.hh | 2 ++ milena/mln/io/pnm/save.hh | 18 ++++++++++++++---- milena/mln/util/array.hh | 8 +------- milena/mln/win/ball.hh | 2 +- milena/tests/geom/Makefile.am | 2 -- milena/tests/morpho/Makefile.am | 3 +-- milena/tests/unit_test/unit-tests.mk | 4 ++++ milena/tests/util/Makefile.am | 3 +-- 14 files changed, 68 insertions(+), 36 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index d793fb8..fbcafd8 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,29 @@ +2009-03-25 Guillaume Lazzara <lazzara@lrde.epita.fr> + + Small fixes. + + * doc/tutorial/tutorial.tex: Fix a compilation issue. + + * headers.mk: update distributed file list. + + * mln/win/ball.hh, + * mln/core/concept/function.hh: avoid a warning. + + * mln/util/array.hh, + * mln/fun/i2v/array.hh: revert invalid from_to overloads. + + * mln/fun/internal/array_base.hh: add reserve(). + + * mln/fun/l2l/relabel.hh: reserve data before appending. + + * mln/io/pnm/save.hh: Allow images of builtin types to be saved. + + * tests/geom/Makefile.am, + * tests/morpho/Makefile.am, + * tests/util/Makefile.am: do not set tests as xfail tests anymore. + + * tests/unit_test/unit-tests.mk: update unit test list. + 2009-03-25 Edwin Carlinet <carlinet@lrde.epita.fr> Clean binarisation processing chain using sharpness. diff --git a/milena/doc/tutorial/tutorial.tex b/milena/doc/tutorial/tutorial.tex index ede9d90..37c37ce 100644 --- a/milena/doc/tutorial/tutorial.tex +++ b/milena/doc/tutorial/tutorial.tex @@ -486,7 +486,7 @@ and/or use the other documentations ressources (\ref{tuto1documentation}). Milena's packages can be downloaded from: -\href{http://www.lrde.epita.fr/Olena/Download} +\href{http://www.lrde.epita.fr/Olena/Download}{http://www.lrde.epita.fr/Olena/Download} On this page you will find the latest and past releases. Currently, we provide only '.tar.gz' and 'tar.bz2' archives. diff --git a/milena/headers.mk b/milena/headers.mk index 1a20506..fd5844c 100644 --- a/milena/headers.mk +++ b/milena/headers.mk @@ -55,6 +55,8 @@ mln/literal/one.hh \ mln/literal/min.hh \ mln/literal/white.hh \ mln/literal/essential.hh \ +mln/world/binary_2d/subsample.hh \ +mln/world/binary_2d/projected_histo.hh \ mln/registration/get_rtransf.hh \ mln/registration/internal/rms.hh \ mln/registration/get_rot.hh \ diff --git a/milena/mln/core/concept/function.hh b/milena/mln/core/concept/function.hh index ff3015f..7cef23c 100644 --- a/milena/mln/core/concept/function.hh +++ b/milena/mln/core/concept/function.hh @@ -507,7 +507,8 @@ namespace mln template <typename E> inline Function_i2b<E>::Function_i2b(const Function_i2b<E>& rhs) - : Function_v2b<E>(rhs) + : Function_v2v<E>(rhs), + Function_v2b<E>(rhs) { } diff --git a/milena/mln/fun/i2v/array.hh b/milena/mln/fun/i2v/array.hh index c140cc3..91fe792 100644 --- a/milena/mln/fun/i2v/array.hh +++ b/milena/mln/fun/i2v/array.hh @@ -196,14 +196,7 @@ namespace mln mlc_converts_to(T,U)::check(); to.reserve(from.nelements()); - - //Special case. Handle background component data. - if (from[0].is_valid()) - to.append(convert::to<U>(from[0])); - else - to.append(U()); - - for (unsigned i = 1; i < from.nelements(); ++i) + for (unsigned i = 0; i < from.nelements(); ++i) to.append(convert::to<U>(from[i])); } @@ -223,14 +216,7 @@ namespace mln mlc_converts_to(T,U)::check(); to.reserve(from.nelements()); - - //Special case. Handle background component data. - if (from[0].is_valid()) - to.append(convert::to<U>(from[0])); - else - to.append(U()); - - for (unsigned i = 1; i < from.size(); ++i) + for (unsigned i = 0; i < from.size(); ++i) to.append(convert::to<U>(from[i])); } diff --git a/milena/mln/fun/internal/array_base.hh b/milena/mln/fun/internal/array_base.hh index 637fab7..d288c53 100644 --- a/milena/mln/fun/internal/array_base.hh +++ b/milena/mln/fun/internal/array_base.hh @@ -57,6 +57,9 @@ namespace mln typedef T result; typedef typename std::vector<T>::reference mutable_result; + /// Pre-allocate space. + void reserve(unsigned n); + /// Set the function size to \p n. void resize(unsigned n); /// Set the function size to \p n and initialize the value with @@ -156,6 +159,14 @@ namespace mln template <typename T> inline void + array_base<T>::reserve(unsigned n) + { + v_.reserve(n); + } + + template <typename T> + inline + void array_base<T>::resize(unsigned n) { v_.resize(n); diff --git a/milena/mln/fun/l2l/relabel.hh b/milena/mln/fun/l2l/relabel.hh index a57f3d4..ef03973 100644 --- a/milena/mln/fun/l2l/relabel.hh +++ b/milena/mln/fun/l2l/relabel.hh @@ -174,6 +174,7 @@ namespace mln { mlc_converts_to(T,L)::check(); + to.reserve(from.nelements()); for (unsigned i = 0; i < from.nelements(); ++i) to.append(convert::to<L>(from[i])); } @@ -193,6 +194,7 @@ namespace mln { mlc_converts_to(T,L)::check(); + to.reserve(from.size()); for (unsigned i = 0; i < from.size(); ++i) to.append(convert::to<L>(from[i])); } diff --git a/milena/mln/io/pnm/save.hh b/milena/mln/io/pnm/save.hh index 12dda4b..5989c92 100644 --- a/milena/mln/io/pnm/save.hh +++ b/milena/mln/io/pnm/save.hh @@ -39,12 +39,14 @@ # include <mln/core/concept/image.hh> # include <mln/core/alias/point2d.hh> +# include <mln/value/concept/scalar.hh> # include <mln/value/rgb.hh> # include <mln/value/rgb8.hh> # include <mln/value/int_u8.hh> # include <mln/metal/templated_by.hh> +# include <mln/metal/not_equal.hh> # include <mln/io/pnm/save_header.hh> # include <mln/io/pnm/macros.hh> @@ -100,11 +102,19 @@ namespace mln void write_value(std::ofstream& file, const V& v) { - // if V is not a struct you are probably trying to write binary images - // use pbm files for binary images - typedef typename V::enc E; + mlc_not_equal(V,bool)::check(); + file.write((char*)(&v), sizeof(V)); + } + + // write a scalar value into for uncontiguous datas + template <typename S> + inline + void write_value(std::ofstream& file, + const value::Scalar<S>& s) + { + typedef typename S::enc E; - E c = v.to_enc(); + E c = s.to_enc(); file.write((char*)(&c), sizeof(E)); } diff --git a/milena/mln/util/array.hh b/milena/mln/util/array.hh index 9e646a5..0363727 100644 --- a/milena/mln/util/array.hh +++ b/milena/mln/util/array.hh @@ -337,13 +337,7 @@ namespace mln to.reserve(from.nelements()); - //Special case. Handle background component data. - if (from[0].is_valid()) - to.append(convert::to<T2>(from[0])); - else - to.append(T2()); - - for (unsigned i = 1; i < from.nelements(); ++i) + for (unsigned i = 0; i < from.nelements(); ++i) to.append(convert::to<T2>(from[i])); } diff --git a/milena/mln/win/ball.hh b/milena/mln/win/ball.hh index 8497237..4dd4807 100644 --- a/milena/mln/win/ball.hh +++ b/milena/mln/win/ball.hh @@ -100,7 +100,7 @@ namespace mln : diameter_(diameter) { mln_precondition(diameter % 2 == 1); - int + unsigned radius = diameter / 2, sqr_radius = radius * radius; typedef point<G,C> P; diff --git a/milena/tests/geom/Makefile.am b/milena/tests/geom/Makefile.am index 728d9a8..c162770 100644 --- a/milena/tests/geom/Makefile.am +++ b/milena/tests/geom/Makefile.am @@ -42,5 +42,3 @@ seed2tiling_roundness_SOURCES = seed2tiling_roundness.cc TESTS = $(check_PROGRAMS) - -XFAIL_TESTS = seed2tiling_roundness diff --git a/milena/tests/morpho/Makefile.am b/milena/tests/morpho/Makefile.am index 6f9008c..fb5f467 100644 --- a/milena/tests/morpho/Makefile.am +++ b/milena/tests/morpho/Makefile.am @@ -86,5 +86,4 @@ meyer_wst_long_CXXFLAGS = $(TESTS_CXXFLAGS_SPEED) TESTS = $(check_PROGRAMS) -XFAIL_TESTS = combined \ - thinning + diff --git a/milena/tests/unit_test/unit-tests.mk b/milena/tests/unit_test/unit-tests.mk index d88724b..c6bf5dd 100644 --- a/milena/tests/unit_test/unit-tests.mk +++ b/milena/tests/unit_test/unit-tests.mk @@ -53,6 +53,8 @@ mln_literal_one \ mln_literal_min \ mln_literal_white \ mln_literal_essential \ +mln_world_binary_2d_subsample \ +mln_world_binary_2d_projected_histo \ mln_registration_get_rtransf \ mln_registration_internal_rms \ mln_registration_get_rot \ @@ -1170,6 +1172,8 @@ mln_literal_one_SOURCES = mln_literal_one.cc mln_literal_min_SOURCES = mln_literal_min.cc mln_literal_white_SOURCES = mln_literal_white.cc mln_literal_essential_SOURCES = mln_literal_essential.cc +mln_world_binary_2d_subsample_SOURCES = mln_world_binary_2d_subsample.cc +mln_world_binary_2d_projected_histo_SOURCES = mln_world_binary_2d_projected_histo.cc mln_registration_get_rtransf_SOURCES = mln_registration_get_rtransf.cc mln_registration_internal_rms_SOURCES = mln_registration_internal_rms.cc mln_registration_get_rot_SOURCES = mln_registration_get_rot.cc diff --git a/milena/tests/util/Makefile.am b/milena/tests/util/Makefile.am index b348587..c1d6c4d 100644 --- a/milena/tests/util/Makefile.am +++ b/milena/tests/util/Makefile.am @@ -39,5 +39,4 @@ tree_to_fast_SOURCES = tree_to_fast.cc tree_to_image_SOURCES = tree_to_image.cc TESTS = $(check_PROGRAMS) -XFAIL_TESTS = tree_to_image \ - tree_fast_to_image + -- 1.5.6.5