
* mln/data/wrap.hh: New. * mln/data/all.hh: Include this new file. --- milena/ChangeLog | 8 +++ milena/mln/data/all.hh | 1 + milena/mln/data/{all.hh => wrap.hh} | 90 +++++++++++++++++++--------------- 3 files changed, 59 insertions(+), 40 deletions(-) copy milena/mln/data/{all.hh => wrap.hh} (50%) diff --git a/milena/ChangeLog b/milena/ChangeLog index b6f9ce4..8896a5f 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,11 @@ +2009-10-28 Guillaume Lazzara <z@lrde.epita.fr> + + Add data::wrap. + + * mln/data/wrap.hh: New. + + * mln/data/all.hh: Include this new file. + 2009-10-22 Guillaume Lazzara <z@lrde.epita.fr> Small fixes. diff --git a/milena/mln/data/all.hh b/milena/mln/data/all.hh index bc77272..de00450 100644 --- a/milena/mln/data/all.hh +++ b/milena/mln/data/all.hh @@ -72,6 +72,7 @@ namespace mln //<<lrde # include <mln/data/was.median.hh> //>> +# include <mln/data/wrap.hh> diff --git a/milena/mln/data/all.hh b/milena/mln/data/wrap.hh similarity index 50% copy from milena/mln/data/all.hh copy to milena/mln/data/wrap.hh index bc77272..1e30f04 100644 --- a/milena/mln/data/all.hh +++ b/milena/mln/data/wrap.hh @@ -1,5 +1,4 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development -// Laboratory (LRDE) +// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) // // This file is part of Olena. // @@ -24,55 +23,66 @@ // exception does not however invalidate any other reasons why the // executable file might be covered by the GNU General Public License. -#ifndef MLN_DATA_ALL_HH -# define MLN_DATA_ALL_HH +#ifndef MLN_DATA_WRAP_HH +# define MLN_DATA_WRAP_HH /// \file /// -/// File that includes all data-related routines. +/// \brief Routine to wrap values such as 0 -> 0 and [1, lmax] maps to [1, +/// Lmax] (using modulus). + + +#include <mln/core/concept/image.hh> + +#include <mln/data/transform.hh> +#include <mln/fun/v2v/wrap.hh> namespace mln { - /// Namespace of image processing routines related to pixel data. namespace data { - /// Implementation namespace of data namespace. - namespace impl { + /*! \brief Routine to wrap values such as 0 -> 0 and [1, lmax] maps to [1, + Lmax] (using modulus). + + \param[in] v The target value type. + \param[in] input Input image. + + \return An image with wrapped values. + */ + template <typename V, typename I> + mln_ch_value(I, V) + wrap(const V& v, const Image<I>& input); + + +# ifndef MLN_INCLUDE_ONLY + - /// Generic implementation namespace of data namespace. - namespace generic {} + template <typename V, typename I> + mln_ch_value(I, V) + wrap(const V& v, const Image<I>& input_) + { + trace::entering("mln::data::wrap"); + (void) v; + const I& input = exact(input_); + + mln_precondition(input.is_valid()); + + mln_ch_value(I, V) + output = data::transform(input, fun::v2v::wrap<V>()); + + trace::exiting("mln::data::wrap"); + return output; } - } -} - - -# include <mln/data/abs.hh> -# include <mln/data/apply.hh> -# include <mln/data/approx/all.hh> -# include <mln/data/compare.hh> -# include <mln/data/compute.hh> -# include <mln/data/convert.hh> -# include <mln/data/fast_median.hh> -# include <mln/data/fill.hh> -# include <mln/data/median.hh> -# include <mln/data/naive/all.hh> -# include <mln/data/paste.hh> -# include <mln/data/replace.hh> -# include <mln/data/saturate.hh> -# include <mln/data/sort_offsets.hh> -# include <mln/data/sort_psites.hh> -# include <mln/data/stretch.hh> -# include <mln/data/to_enc.hh> -# include <mln/data/transform.hh> -# include <mln/data/update.hh> -//<<lrde -# include <mln/data/was.median.hh> -//>> - - - -#endif // ! MLN_DATA_ALL_HH + +# endif // ! MLN_INCLUDE_ONLY + + } // end of namespace mln::data + +} // end of namespace mln + + +#endif // ! MLN_DATA_WRAP_HH -- 1.5.6.5