https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Make linear::convolve work properly with heterogenous types.
* tests/core/routine/primary.cc: New.
* tests/core/routine/Makefile.am: Update.
* tests/border/duplicate.cc: Layout.
* mln/core/routine/primary.hh: Complete.
* mln/core/internal/image_morpher.hh
(unmorph_): New overload from const target.
* mln/accu/convolve.hh: New.
* mln/accu/all.hh: Update.
(todo): New.
* mln/border/duplicate.hh: Fix.
* mln/extension/adjust_duplicate.hh: New.
* mln/linear/convolve.hh: Update.
mln/accu/all.hh | 7 +
mln/accu/convolve.hh | 148 +++++++++++++++++++++++++++++++++++++
mln/border/duplicate.hh | 140 ++++++++++++++++++++++-------------
mln/core/internal/image_morpher.hh | 16 +++-
mln/core/routine/primary.hh | 49 +++++++++++-
mln/extension/adjust_duplicate.hh | 112 ++++++++++++----------------
mln/linear/convolve.hh | 24 +++---
tests/border/duplicate.cc | 2
tests/core/routine/Makefile.am | 4 -
tests/core/routine/primary.cc | 46 +++++++++++
10 files changed, 420 insertions(+), 128 deletions(-)
Index: tests/core/routine/primary.cc
--- tests/core/routine/primary.cc (revision 0)
+++ tests/core/routine/primary.cc (revision 0)
@@ -0,0 +1,46 @@
+// Copyright (C) 2008 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
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+/// \file tests/core/routine/primary.cc
+///
+/// Tests on mln::primary.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/core/image/sub_image.hh>
+#include <mln/core/routine/primary.hh>
+
+
+
+int main()
+{
+ using namespace mln;
+
+ image2d<int> ima(1, 1);
+ box2d b = ima.domain();
+
+ mln_assertion(primary((ima | b) | b).id_() == ima.id_());
+}
Index: tests/core/routine/Makefile.am
--- tests/core/routine/Makefile.am (revision 2774)
+++ tests/core/routine/Makefile.am (working copy)
@@ -6,11 +6,13 @@
clone \
exact \
extend \
- initialize
+ initialize \
+ primary
clone_SOURCES = clone.cc
exact_SOURCES = exact.cc
extend_SOURCES = extend.cc
initialize_SOURCES = initialize.cc
+primary_SOURCES = primary.cc
TESTS = $(check_PROGRAMS)
Index: tests/border/duplicate.cc
--- tests/border/duplicate.cc (revision 2774)
+++ tests/border/duplicate.cc (working copy)
@@ -1,4 +1,5 @@
// Copyright (C) 2007, 2008 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
@@ -70,6 +71,5 @@
mln_assertion(ima.element(22) == 8);
mln_assertion(ima.element(23) == 9);
mln_assertion(ima.element(24) == 9);
-
}
Index: mln/core/routine/primary.hh
--- mln/core/routine/primary.hh (revision 2774)
+++ mln/core/routine/primary.hh (working copy)
@@ -42,9 +42,17 @@
namespace mln
{
+ // Forward declaration.
+ namespace internal
+ {
+ template <typename I> struct primary_type;
+ }
+
+
/// FIXME: Doc!
template <typename I>
- void primary(const Image<I>& ima);
+ const typename internal::primary_type<I>::ret&
+ primary(const Image<I>& input);
# ifndef MLN_INCLUDE_ONLY
@@ -60,7 +68,8 @@
template <typename I, typename C>
struct primary_type_helper
{
- typedef typename primary_type<mln_delegatee(I)>::ret ret;
+ typedef typename I::delegatee D;
+ typedef typename primary_type<D>::ret ret;
};
template <typename I>
@@ -79,6 +88,37 @@
// Routine.
+ template <typename I>
+ const typename internal::primary_type<I>::ret&
+ primary_(const Image<I>& input); // Forward declaration.
+
+ template <typename I>
+ inline
+ const typename internal::primary_type<I>::ret&
+ primary_(trait::image::category::primary,
+ const Image<I>& input)
+ {
+ return exact(input);
+ }
+
+ template <typename I>
+ inline
+ const typename internal::primary_type<I>::ret&
+ primary_(trait::image::category::morpher,
+ const Image<I>& input)
+ {
+ return primary_(exact(input).unmorph_());
+ }
+
+ template <typename I>
+ inline
+ const typename internal::primary_type<I>::ret&
+ primary_(const Image<I>& input)
+ {
+ return primary_(mln_trait_image_category(I)(),
+ input);
+ }
+
} // end of namespace mln::internal
@@ -87,8 +127,11 @@
template <typename I>
inline
- void primary(const Image<I>&)
+ const typename internal::primary_type<I>::ret&
+ primary(const Image<I>& input)
{
+ mln_precondition(exact(input).has_data());
+ return internal::primary_(input);
}
Index: mln/core/internal/image_morpher.hh
--- mln/core/internal/image_morpher.hh (revision 2774)
+++ mln/core/internal/image_morpher.hh (working copy)
@@ -65,9 +65,12 @@
I* delegatee_();
- /// Give the morphed image.
+ /// Give the morphed image (mutable version).
I& unmorph_();
+ /// Give the morphed image (const version).
+ mlc_const(I)& unmorph_() const;
+
/* \brief Test if this image has been initialized; default impl.
*
@@ -154,6 +157,17 @@
template <typename I, typename T, typename S, typename E>
inline
+ mlc_const(I)&
+ image_morpher<I, T, S, E>::unmorph_() const
+ {
+ mlc_const(I)* ptr = delegatee_();
+ mln_assertion(ptr != 0);
+ return *ptr;
+ }
+
+
+ template <typename I, typename T, typename S, typename E>
+ inline
image_morpher<I, T, S, E>::operator I() const
{
mln_precondition(exact(this)->has_data());
Index: mln/linear/convolve.hh
--- mln/linear/convolve.hh (revision 2774)
+++ mln/linear/convolve.hh (working copy)
@@ -38,8 +38,8 @@
# include <mln/core/concept/image.hh>
# include <mln/core/concept/weighted_window.hh>
-# include <mln/border/resize.hh>
-# include <mln/border/duplicate.hh>
+# include <mln/extension/adjust_duplicate.hh>
+# include <mln/accu/convolve.hh>
@@ -105,21 +105,23 @@
const W& w_win = exact(w_win_);
internal::convolve_tests(input, w_win);
- // extension::adjust_duplicate(input, w_win);
+ extension::adjust_duplicate(input, w_win);
typedef mln_concrete(I) O;
O output;
initialize(output, input);
+ accu::convolve<mln_value(I), mln_weight(W)> a;
+
mln_piter(I) p(input.domain());
mln_qiter(W) q(w_win, p);
for_all(p)
{
- mln_value(O) v = literal::zero;
+ a.init();
for_all(q) if (input.has(q))
- v += input(q) * q.w();
- output(p) = v;
+ a.take(input(q), q.w());
+ output(p) = a.to_result();
}
trace::exiting("linear::impl::generic::convolve");
@@ -140,23 +142,25 @@
const W& w_win = exact(w_win_);
internal::convolve_tests(input, w_win);
- // extension::adjust_duplicate(input, w_win);
+ extension::adjust_duplicate(input, w_win);
typedef mln_concrete(I) O;
O output;
initialize(output, input);
mln_pixter(O) p_out(output);
+ accu::convolve<mln_value(I), mln_weight(W)> a;
+
mln_pixter(const I) p(input);
mln_qixter(const I, W) q(p, w_win);
for_all_2(p, p_out)
{
- mln_value(O) v = literal::zero;
+ a.init();
unsigned i = 0;
for_all(q)
- v += w_win.w(i++) * q.val();
- p_out.val() = v;
+ a.take(q.val(), w_win.w(i++));
+ p_out.val() = a.to_result();
}
trace::exiting("linear::impl::convolve_fastest");
Index: mln/accu/all.hh
--- mln/accu/all.hh (revision 2774)
+++ mln/accu/all.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -35,6 +36,8 @@
* \todo Update accumulators s.a. count so that they are like min_/min.
*
* \todo Propagate those updates to mln/estim/.
+ *
+ * \todo Update the include list...
*/
@@ -46,6 +49,7 @@
{
/// Implementation namespace of accumulator namespace.
namespace impl {}
+
/// Internal namespace of accumulators.
namespace internal {}
}
@@ -55,6 +59,7 @@
# include <mln/accu/bbox.hh>
# include <mln/accu/count.hh>
+# include <mln/accu/convolve.hh>
# include <mln/accu/histo.hh>
# include <mln/accu/max.hh>
# include <mln/accu/mean.hh>
Index: mln/accu/convolve.hh
--- mln/accu/convolve.hh (revision 0)
+++ mln/accu/convolve.hh (revision 0)
@@ -0,0 +1,148 @@
+// Copyright (C) 2008 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
+// of the GNU General Public License version 2 as published by the
+// Free Software Foundation.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this library; see the file COPYING. If not, write to
+// the Free Software Foundation, 51 Franklin Street, Fifth Floor,
+// Boston, MA 02111-1307, USA.
+//
+// As a special exception, you may use this file as part of a free
+// software library without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to
+// produce an executable, this file does not by itself cause the
+// resulting executable to be covered by the GNU General Public
+// License. This exception does not however invalidate any other
+// reasons why the executable file might be covered by the GNU General
+// Public License.
+
+#ifndef MLN_ACCU_CONVOLVE_HH
+# define MLN_ACCU_CONVOLVE_HH
+
+/*! \file mln/accu/convolve.hh
+ *
+ * \brief Define an accumulator that computes a convolution.
+ */
+
+# include <mln/accu/internal/base.hh>
+# include <mln/value/ops.hh>
+# include <mln/literal/zero.hh>
+
+
+namespace mln
+{
+
+ namespace accu
+ {
+
+
+ /*! \brief Generic convolution accumulator class.
+ *
+ * Parameters \c T1 and \c T2 are the type of values to be
+ * convolved. Parameter \c R is the result type.
+ */
+ template <typename T1, typename T2,
+ typename R = mln_sum_x(T1, T2)>
+ struct convolve : public mln::accu::internal::base< R, convolve<T1,T2,R>
>
+ {
+ typedef std::pair<T1,T2> argument;
+
+ convolve();
+
+ /// Manipulators.
+ /// \{
+ void init();
+ void take(const argument& t);
+ void take(const T1& t1, const T2& t2);
+ void take(const convolve<T1,T2,R>& other);
+ /// \}
+
+ /// Get the value of the accumulator.
+ R to_result() const;
+
+ /// Check whether this accu is able to return a result.
+ /// Always true here.
+ bool is_valid() const;
+
+ protected:
+
+ typedef mln_sum_x(T1, T2) S;
+ S s_;
+ };
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ template <typename T1, typename T2, typename R>
+ inline
+ convolve<T1,T2,R>::convolve()
+ {
+ init();
+ }
+
+ template <typename T1, typename T2, typename R>
+ inline
+ void
+ convolve<T1,T2,R>::init()
+ {
+ static S zero = literal::zero;
+ s_ = zero;
+ }
+
+ template <typename T1, typename T2, typename R>
+ inline
+ void
+ convolve<T1,T2,R>::take(const argument& t)
+ {
+ s_ += t.first * t.second;
+ }
+
+ template <typename T1, typename T2, typename R>
+ inline
+ void
+ convolve<T1,T2,R>::take(const T1& t1, const T2& t2)
+ {
+ s_ += t1 * t2;
+ }
+
+ template <typename T1, typename T2, typename R>
+ inline
+ void
+ convolve<T1,T2,R>::take(const convolve<T1,T2,R>& other)
+ {
+ s_ += other.s_;
+ }
+
+ template <typename T1, typename T2, typename R>
+ inline
+ R
+ convolve<T1,T2,R>::to_result() const
+ {
+ return s_;
+ }
+
+ template <typename T1, typename T2, typename R>
+ inline
+ bool
+ convolve<T1,T2,R>::is_valid() const
+ {
+ return true;
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::accu
+
+} // end of namespace mln
+
+
+#endif // ! MLN_ACCU_CONVOLVE_HH
Index: mln/border/duplicate.hh
--- mln/border/duplicate.hh (revision 2774)
+++ mln/border/duplicate.hh (working copy)
@@ -1,4 +1,5 @@
-// Copyright (C) 2007 EPITA Research and Development Laboratory
+// Copyright (C) 2007, 2008 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
@@ -34,8 +35,9 @@
*/
# include <mln/core/concept/image.hh>
-# include <mln/level/memset_.hh>
-# include <mln/core/pixel.hh>
+# include <mln/core/routine/primary.hh>
+# include <mln/core/box_runstart_piter.hh>
+# include <mln/border/get.hh>
namespace mln
@@ -64,37 +66,37 @@
template <typename I>
inline
- void duplicate_1d_(const I& ima)
+ void duplicate_1D(I& ima)
{
- trace::entering("border::impl::duplicate_1d_");
+ trace::entering("border::impl::duplicate_1D");
typedef mln_psite(I) P;
- typename I::line_piter pl(ima.domain());
- unsigned len_c = exact(ima).bbox().len(P::dim - 1);
+ mln_box_runstart_piter(I) pl(ima.domain());
+ unsigned len_c = ima.bbox().len(P::dim - 1);
unsigned border = ima.border ();
for (unsigned i = 0; i < border; ++i)
- const_cast<I&>(ima)[i] = ima[border];
+ ima.element(i) = ima.element(border);
unsigned st = border + len_c - 1;
for (unsigned i = st + 1; i < ima.nelements (); ++i)
- const_cast<I&>(ima)[i] = ima[st];
+ ima.element(i) = ima.element(st);
- trace::exiting("border::impl::duplicate_1d_");
+ trace::exiting("border::impl::duplicate_1D");
}
template <typename I>
inline
- void duplicate_2d_(const I& ima)
+ void duplicate_2D(I& ima)
{
- trace::entering("border::impl::duplicate_2d_");
+ trace::entering("border::impl::duplicate_2D");
typedef mln_psite(I) P;
- typename I::line_piter pl(ima.domain());
+ mln_box_runstart_piter(I) pl(ima.domain());
unsigned border = ima.border ();
unsigned border_2x = 2 * ima.border ();
- unsigned len_c = exact(ima).bbox().len(1);
- unsigned len_r = exact(ima).bbox().len(0);
+ unsigned len_c = ima.bbox().len(1);
+ unsigned len_r = ima.bbox().len(0);
unsigned real_len_c = len_c + border_2x;
unsigned st;
@@ -103,43 +105,42 @@
{
st = ima.index_of_point (pl);
for (unsigned i = 1; i <= border; ++i)
- const_cast<I&>(ima)[st - i] = ima[st];
+ ima.element(st - i) = ima.element(st);
st = st + len_c - 1;
for (unsigned i = 1; i <= border; ++i)
- const_cast<I&>(ima)[st + i] = ima[st];
+ ima.element(st + i) = ima.element(st);
}
// Duplicate n first * border line
st = real_len_c * border;
for (unsigned k = 0; k < border; ++k)
for (unsigned i = 0; i < real_len_c; ++i)
- const_cast<I&>(ima)[k * real_len_c + i] = ima[st + i];
+ ima.element(k * real_len_c + i) = ima.element(st + i);
// Duplicate n last * border line
st = real_len_c * (border + len_r - 1);
for (unsigned k = 1; k <= border; ++k)
for (unsigned i = st; i < st + real_len_c; ++i)
- const_cast<I&>(ima)[k * real_len_c + i] = ima[i];
+ ima.element(k * real_len_c + i) = ima.element(i);
- trace::exiting("border::impl::duplicate_2d_");
+ trace::exiting("border::impl::duplicate_2D");
}
template <typename I>
inline
- void duplicate_3d_(const Image<I>& ima_)
+ void duplicate_3D(I& ima)
{
- trace::entering("border::impl::duplicate_3d_");
+ trace::entering("border::impl::duplicate_3D");
- const I& ima = exact(ima_);
mln_precondition(ima.has_data());
typedef mln_psite(I) P;
- typename I::line_piter pl(ima.domain());
+ mln_box_runstart_piter(I) pl(ima.domain());
unsigned border = ima.border ();
unsigned border_2x = 2 * ima.border ();
- unsigned len_c = exact(ima).bbox().len(P::dim - 1);
- unsigned len_r = exact(ima).bbox().len(1);
- unsigned len_s = exact(ima).bbox().len(0);
+ unsigned len_c = ima.bbox().len(P::dim - 1);
+ unsigned len_r = ima.bbox().len(1);
+ unsigned len_s = ima.bbox().len(0);
unsigned real_len_c = len_c + border_2x;
unsigned real_len_r = len_r + border_2x;
unsigned face = real_len_c * real_len_r;
@@ -155,10 +156,10 @@
{
st = ima.index_of_point (pl);
for (unsigned i = 1; i <= border; ++i)
- const_cast<I&>(ima)[st - i] = ima[st];
+ ima.element(st - i) = ima.element(st);
st = st + len_c - 1;
for (unsigned i = 1; i <= border; ++i)
- const_cast<I&>(ima)[st + i] = ima[st];
+ ima.element(st + i) = ima.element(st);
pl.next ();
}
@@ -166,57 +167,96 @@
st = border * face + k * face + border * real_len_c ;
for (unsigned j = 1; j <= border; ++j)
for (unsigned i = 0; i < real_len_c; ++i)
- const_cast<I&>(ima)[st - j * real_len_c + i] = ima[st + i];
+ ima.element(st - j * real_len_c + i) = ima.element(st + i);
// Duplicate n last * border line
st = border * face + k * face + (len_r + border - 1) * real_len_c ;
for (unsigned j = 1; j <= border; ++j)
for (unsigned i = 0; i < real_len_c; ++i)
- const_cast<I&>(ima)[st + j * real_len_c + i] = ima[st + i];
+ ima.element(st + j * real_len_c + i) = ima.element(st + i);
}
// Duplicate n first * border face
st = border * face;
for (unsigned k = 0; k < border; ++k)
for (unsigned i = 0; i < face; ++i)
- const_cast<I&>(ima)[k * face + i] = ima[st + i];
+ ima.element(k * face + i) = ima.element(st + i);
// Duplicate n last * border face
st = (len_s + border - 1) * face;
for (unsigned k = 1; k <= border; ++k)
for (unsigned i = 0; i < face; ++i)
- const_cast<I&>(ima)[st + k * face + i] = ima[st + i];
+ ima.element(st + k * face + i) = ima.element(st + i);
- trace::exiting("border::impl::duplicate_3d_");
+ trace::exiting("border::impl::duplicate_3D");
}
} // end of namespace mln::border::impl
- // Facade.
+ namespace internal
+ {
template <typename I>
- inline
- void duplicate(const Image<I>& ima_)
+ void duplicate_dispatch_on(metal::int_<1>, I& ima)
{
- trace::entering("border::duplicate");
+ impl::duplicate_1D(ima);
+ }
- const I& ima = exact(ima_);
- mln_precondition(ima.has_data());
+ template <typename I>
+ void duplicate_dispatch_on(metal::int_<2>, I& ima)
+ {
+ impl::duplicate_2D(ima);
+ }
- mlc_is(mln_trait_image_speed(I), trait::image::speed::fastest)::check();
+ template <typename I>
+ void duplicate_dispatch_on(metal::int_<3>, I& ima)
+ {
+ impl::duplicate_3D(ima);
+ }
- typedef mln_psite(I) P;
+ template <typename I>
+ void duplicate_dispatch_on(trait::image::speed::fastest,
+ const Image<I>& ima)
+ {
+ typedef mln_site(I) P;
+ duplicate_dispatch_on(metal::int_<P::dim>(),
+ const_cast<I&>(exact(ima)));
+ }
- if (!ima.border ())
- return;
+ template <typename I>
+ void duplicate_dispatch_on(trait::image::speed::any,
+ const Image<I>& ima)
+ {
+ // No-op.
+ }
+
+ template <typename I>
+ void duplicate_dispatch_on(const Image<I>& ima)
+ {
+ duplicate_dispatch_on(mln_trait_image_speed(I)(),
+ ima);
+ }
+
+ template <typename I>
+ void duplicate_dispatch(const Image<I>& ima)
+ {
+ duplicate_dispatch_on(primary(ima));
+ }
+
+ } // end of namespace mln::border::internal
+
+
+ // Facade.
+
+ template <typename I>
+ void duplicate(const Image<I>& ima)
+ {
+ trace::entering("border::duplicate");
+ mln_precondition(exact(ima).has_data());
- if (P::dim == 1)
- impl::duplicate_1d_(ima);
- if (P::dim == 2)
- impl::duplicate_2d_(ima);
- if (P::dim == 3)
- impl::duplicate_3d_(ima);
+ if (border::get(ima) != 0)
+ internal::duplicate_dispatch(ima);
trace::exiting("border::duplicate");
}
Index: mln/extension/adjust_duplicate.hh
--- mln/extension/adjust_duplicate.hh (revision 2769)
+++ mln/extension/adjust_duplicate.hh (working copy)
@@ -25,18 +25,19 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-#ifndef MLN_CORE_EXTENSION_ADJUST_FILL_HH
-# define MLN_CORE_EXTENSION_ADJUST_FILL_HH
+#ifndef MLN_CORE_EXTENSION_ADJUST_DUPLICATE_HH
+# define MLN_CORE_EXTENSION_ADJUST_DUPLICATE_HH
-/*! \file mln/extension/adjust_fill.hh
+/*! \file mln/extension/adjust_duplicate.hh
*
- * \brief Adjust then fill the domain extension.
+ * \brief Adjust the size of the domain extension then duplicate the
+ * image inner boundary.
*
* \todo Fix doc.
*/
# include <mln/border/adjust.hh>
-# include <mln/extension/fill.hh>
+# include <mln/border/duplicate.hh>
# include <mln/geom/delta.hh>
@@ -46,63 +47,56 @@
namespace extension
{
- /*! Fill the domain extension of image \p ima with the
- * single value \p v.
+ /*! Fill the domain extension of image \p ima by duplicating the
+ * image inner boundary.
*
* \param[in,out] ima The image whose domain extension is to be filled.
- * \param[in] val The value to assign.
*
* \pre \p ima has to be initialized.
- *
- * \todo Optimize with memset if possible.
*/
template <typename I, typename W>
- void adjust_fill(const Image<I>& ima,
- const Window<W>& win,
- const mln_value(I)& val);
+ void adjust_duplicate(const Image<I>& ima,
+ const Window<W>& win);
template <typename I, typename W>
- void adjust_fill(const Image<I>& ima,
- const Weighted_Window<W>& wwin,
- const mln_value(I)& val);
+ void adjust_duplicate(const Image<I>& ima,
+ const Weighted_Window<W>& wwin);
template <typename I, typename N>
- void adjust_fill(const Image<I>& ima,
- const Neighborhood<N>& nbh,
- const mln_value(I)& val);
+ void adjust_duplicate(const Image<I>& ima,
+ const Neighborhood<N>& nbh);
template <typename I>
- void adjust_fill(const Image<I>& ima,
- unsigned delta,
- const mln_value(I)& val);
+ void adjust_duplicate(const Image<I>& ima,
+ unsigned delta);
+
+
# ifndef MLN_INCLUDE_ONLY
namespace impl
{
- template <typename I, typename V>
- void do_adjust_fill(const I& ima,
- unsigned delta,
- const V& val)
+ template <typename I>
+ void do_adjust_duplicate(const I& ima,
+ unsigned delta)
{
mln_precondition(exact(ima).has_data());
// mln_precondition(exact(win_like).is_valid());
border::adjust(ima, delta);
- extension::fill(ima, val);
+ border::duplicate(ima);
}
- template <typename I, typename W, typename V>
- void do_adjust_fill(const I& ima,
- const W& win_like,
- const V& val)
+ template <typename I, typename W>
+ void do_adjust_duplicate(const I& ima,
+ const W& win_like)
{
mln_precondition(exact(ima).has_data());
// mln_precondition(exact(win_like).is_valid());
border::adjust(ima, geom::delta(win_like));
- extension::fill(ima, val);
+ border::duplicate(ima);
}
} // end of namespace mln::extension::impl
@@ -111,43 +105,39 @@
// Facades.
template <typename I, typename W>
- void adjust_fill(const Image<I>& ima,
- const Window<W>& win,
- const mln_value(I)& val)
- {
- trace::entering("extension::adjust_fill");
- impl::do_adjust_fill(ima, win, val);
- trace::exiting("extension::adjust_fill");
+ void adjust_duplicate(const Image<I>& ima,
+ const Window<W>& win)
+ {
+ trace::entering("extension::adjust_duplicate");
+ impl::do_adjust_duplicate(ima, win);
+ trace::exiting("extension::adjust_duplicate");
}
template <typename I, typename W>
- void adjust_fill(const Image<I>& ima,
- const Weighted_Window<W>& wwin,
- const mln_value(I)& val)
- {
- trace::entering("extension::adjust_fill");
- impl::do_adjust_fill(ima, wwin, val);
- trace::exiting("extension::adjust_fill");
+ void adjust_duplicate(const Image<I>& ima,
+ const Weighted_Window<W>& wwin)
+ {
+ trace::entering("extension::adjust_duplicate");
+ impl::do_adjust_duplicate(ima, wwin);
+ trace::exiting("extension::adjust_duplicate");
}
template <typename I, typename N>
- void adjust_fill(const Image<I>& ima,
- const Neighborhood<N>& nbh,
- const mln_value(I)& val)
- {
- trace::entering("extension::adjust_fill");
- impl::do_adjust_fill(ima, nbh, val);
- trace::exiting("extension::adjust_fill");
+ void adjust_duplicate(const Image<I>& ima,
+ const Neighborhood<N>& nbh)
+ {
+ trace::entering("extension::adjust_duplicate");
+ impl::do_adjust_duplicate(ima, nbh);
+ trace::exiting("extension::adjust_duplicate");
}
template <typename I>
- void adjust_fill(const Image<I>& ima,
- unsigned delta,
- const mln_value(I)& val)
- {
- trace::entering("extension::adjust_fill");
- impl::do_adjust_fill(ima, delta, val);
- trace::exiting("extension::adjust_fill");
+ void adjust_duplicate(const Image<I>& ima,
+ unsigned delta)
+ {
+ trace::entering("extension::adjust_duplicate");
+ impl::do_adjust_duplicate(ima, delta);
+ trace::exiting("extension::adjust_duplicate");
}
@@ -158,4 +148,4 @@
} // end of namespace mln
-#endif // ! MLN_CORE_EXTENSION_FILL_HH
+#endif // ! MLN_CORE_EXTENSION_DUPLICATE_HH
Property changes on: mln/extension/adjust_duplicate.hh
___________________________________________________________________
Added: svn:mergeinfo