* mln/core/image/imorph/interpolated.hh (mln::interpolate)
* mln/core/image/imorph/tr_image.hh (mln::apply_tr):
New functions.
---
milena/ChangeLog | 8 ++++++
milena/mln/core/image/imorph/interpolated.hh | 25 +++++++++++++++++++
milena/mln/core/image/imorph/tr_image.hh | 34 ++++++++++++++++++++++++++
3 files changed, 67 insertions(+)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 382f48a..41ccdce 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,13 @@
2013-10-09 Roland Levillain <roland(a)lrde.epita.fr>
+ Milena: Add helpers to instantiate mln::interpolated and mln::tr_image.
+
+ * mln/core/image/imorph/interpolated.hh (mln::interpolate)
+ * mln/core/image/imorph/tr_image.hh (mln::apply_tr):
+ New functions.
+
+2013-10-09 Roland Levillain <roland(a)lrde.epita.fr>
+
Milena: Exercise mln::interpolated and mln::tr_image together.
* tests/core/image/imorph/interpolated-tr_image.cc: New.
diff --git a/milena/mln/core/image/imorph/interpolated.hh
b/milena/mln/core/image/imorph/interpolated.hh
index 0c20ac3..9b4aaa9 100644
--- a/milena/mln/core/image/imorph/interpolated.hh
+++ b/milena/mln/core/image/imorph/interpolated.hh
@@ -138,6 +138,22 @@ namespace mln
};
+ /** \brief Helper routine to create an mln::interpolated morphed
+ image.
+
+ Careful, the order of the template parameters is inverted
+ compared to mln::interpolated. This is so that the routine can
+ be used this way:
+
+ \code
+ mln::interpolate<mln::fun::x2v::bilinear>(ima);
+ \encode
+
+ (i.e., so that parameter I can be deduced from \a ima). */
+ template <template <class> class F, typename I>
+ interpolated<I, F> interpolate(Image<I>& ima);
+
+
# ifndef MLN_INCLUDE_ONLY
@@ -216,6 +232,15 @@ namespace mln
}
+ // interpolate.
+
+ template <template <class> class F, typename I>
+ interpolated<I, F> interpolate(Image<I>& ima)
+ {
+ interpolated<I, F> tmp(exact(ima));
+ return tmp;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
diff --git a/milena/mln/core/image/imorph/tr_image.hh
b/milena/mln/core/image/imorph/tr_image.hh
index 3f2451f..f036e40 100644
--- a/milena/mln/core/image/imorph/tr_image.hh
+++ b/milena/mln/core/image/imorph/tr_image.hh
@@ -155,6 +155,19 @@ namespace mln
};
+ /// \brief Helper routine to create an mln::tr_image morphed image.
+ template <typename S, typename I, typename T>
+ tr_image<S, I, T>
+ apply_tr(const Site_Set<S>& s, const Image<I>& ima,
+ const Function_v2v<T>& tr);
+
+ /// \brief Helper routine to create an mln::tr_image morphed
+ /// images. The domain is deduced from \a ima.
+ template <typename I, typename T>
+ tr_image<mln_domain(I), I, T>
+ apply_tr(const Image<I>& ima, const Function_v2v<T>& tr);
+
+
# ifndef MLN_INCLUDE_ONLY
@@ -265,6 +278,27 @@ namespace mln
return tmp;
}
+
+ /// transform.
+
+ template <typename S, typename I, typename T>
+ tr_image<S, I, T>
+ apply_tr(const Site_Set<S>& s, const Image<I>& ima,
+ const Function_v2v<T>& tr)
+ {
+ tr_image<S, I, T> tmp(exact(s), exact(ima), exact(tr));
+ return tmp;
+ }
+
+ template <typename I, typename T>
+ tr_image<mln_domain(I), I, T>
+ apply_tr(const Image<I>& ima, const Function_v2v<T>& tr)
+ {
+ tr_image<mln_domain(I), I, T> tmp(exact(ima).domain(), exact(ima),
+ exact(tr));
+ return tmp;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
--
1.7.10.4