* mln/make/image3d.hh: create an image3d from a single image.
---
milena/ChangeLog | 6 ++++++
milena/mln/make/image3d.hh | 23 +++++++++++++++++++++++
2 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/milena/ChangeLog b/milena/ChangeLog
index 3344c86..d4ee97a 100644
--- a/milena/ChangeLog
+++ b/milena/ChangeLog
@@ -1,5 +1,11 @@
2009-02-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add a new overload of make::image3d.
+
+ * mln/make/image3d.hh: create an image3d from a single image.
+
+2009-02-02 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Check if the rotation is correct.
* mln/fun/x2x/rotation.hh: add a new check while creating the rotation
diff --git a/milena/mln/make/image3d.hh b/milena/mln/make/image3d.hh
index 67855d9..bff73ff 100644
--- a/milena/mln/make/image3d.hh
+++ b/milena/mln/make/image3d.hh
@@ -55,6 +55,11 @@ namespace mln
mln::image3d<mln_value(I)>
image3d(const util::array<I>& ima);
+ /// Create an image3d from a 2D images.
+ ///
+ template <typename I>
+ mln::image3d<mln_value(I)>
+ image3d(const I& ima);
# ifndef MLN_INCLUDE_ONLY
@@ -80,6 +85,24 @@ namespace mln
return output;
}
+
+ template <typename I>
+ inline
+ mln::image3d<mln_value(I)>
+ image3d(const I& ima)
+ {
+ mlc_is_a(mln_pset(I), Box)::check();
+ mln_precondition(ima.is_valid());
+
+ mln::box2d b = ima.domain();
+ mln::box3d b_ = make::box3d(0, b.pmin().row(), b.pmin().col(),
+ 0, b.pmax().row(), b.pmax().col());
+ mln::image3d<mln_value(I)> output(b_);
+ data::paste(ima, slice(output, 0).rw());
+
+ return output;
+ }
+
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::make
--
1.5.6.5