* green/mln/display: New directory.
* green/mln/display/display_histo.hh: New library file.
* green/mln/display/project_histo.hh: New library file.
* green/mln/fun/v2v/log.hh: New library file.
---
trunk/milena/sandbox/ChangeLog | 9 ++
.../sandbox/green/mln/display/display_histo.hh | 92 +++++++++++++++++++
.../sandbox/green/mln/display/project_histo.hh | 97 ++++++++++++++++++++
trunk/milena/sandbox/green/mln/fun/v2v/log.hh | 70 ++++++++++++++
4 files changed, 268 insertions(+), 0 deletions(-)
create mode 100644 trunk/milena/sandbox/green/mln/display/display_histo.hh
create mode 100644 trunk/milena/sandbox/green/mln/display/project_histo.hh
create mode 100644 trunk/milena/sandbox/green/mln/fun/v2v/log.hh
diff --git a/trunk/milena/sandbox/ChangeLog b/trunk/milena/sandbox/ChangeLog
index 2ab7bd8..eac8803 100644
--- a/trunk/milena/sandbox/ChangeLog
+++ b/trunk/milena/sandbox/ChangeLog
@@ -1,3 +1,12 @@
+2009-10-15 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Make Th�o projection for histogram available.
+
+ * green/mln/display: New directory.
+ * green/mln/display/display_histo.hh: New library file.
+ * green/mln/display/project_histo.hh: New library file.
+ * green/mln/fun/v2v/log.hh: New library file.
+
2009-10-14 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
Add spaces to conform to the LRDE coding norm.
diff --git a/trunk/milena/sandbox/green/mln/display/display_histo.hh
b/trunk/milena/sandbox/green/mln/display/display_histo.hh
new file mode 100644
index 0000000..d34914c
--- /dev/null
+++ b/trunk/milena/sandbox/green/mln/display/display_histo.hh
@@ -0,0 +1,92 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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_DISPLAY_DISPLAY_HISTO_HH
+# define MLN_DISPLAY_DISPLAY_HISTO_HH
+
+# include <mln/data/stretch.hh>
+# include <mln/fun/v2v/log.hh>
+# include <mln/display/project_histo.hh>
+# include <mln/accu/math/sum.hh>
+
+/// \file
+///
+/// \brief Allow the complete visualization of a 3d histogram by projection.
+///
+/// The 3d histogram is projected in red/green space by accumulating around the
+/// the blue dimension (green and blue composantes are being correlated). In
+/// fact, we sum in along the blue direction. Then, we stretch value to feet
+/// pgm format.
+
+
+namespace mln
+{
+
+ namespace display
+ {
+
+ // Forward declaration.
+ image2d<value::int_u8>
+ display_histo3d_unsigned(const image3d<unsigned>& histo);
+
+#ifndef MLN_INCLUDE_ONLY
+
+ /// \brief Allow the visualization of a 3d histogram by projection.
+ ///
+ /// The 3d histogram is projected in red/green space by
+ /// accumulating around the the blue dimension (green and blue
+ /// composantes are being correlated). In fact, we sum in along
+ /// the blue direction. Then, we stretch value to feet pgm
+ /// format.
+ ///
+ /// \parameter[in] histo the histogram in 3d.
+ /// \result return a equivalent 2d image.
+
+
+ image2d<value::int_u8>
+ display_histo3d_unsigned(const image3d<unsigned>& histo)
+ {
+ typedef accu::math::sum<unsigned,unsigned> t_sum;
+ typedef value::int_u8 t_int_u8;
+ typedef fun::v2v::log<float> t_log;
+
+ image2d<unsigned> proj = project_histo<t_sum,2>(histo);
+ image2d<t_int_u8> proj_int = data::stretch(t_int_u8(),
+ data::transform(proj,
+ t_log()));
+ return proj_int;
+ }
+
+#endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace mln::transform
+
+} // end of namespace mln
+
+
+#endif // ! MLN_DISPLAY_DISPLAY_HISTO_HH
diff --git a/trunk/milena/sandbox/green/mln/display/project_histo.hh
b/trunk/milena/sandbox/green/mln/display/project_histo.hh
new file mode 100644
index 0000000..63ea84e
--- /dev/null
+++ b/trunk/milena/sandbox/green/mln/display/project_histo.hh
@@ -0,0 +1,97 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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_DISPLAY_PROJECT_HISTO_HH
+# define MLN_DISPLAY_PROJECT_HISTO_HH
+
+# include <mln/core/image/image2d.hh>
+# include <mln/core/image/image3d.hh>
+# include <mln/core/image/dmorph/unproject_image.hh>
+# include <mln/fun/v2v/projection.hh>
+
+# include <mln/accu/image/init.hh>
+# include <mln/accu/image/take.hh>
+# include <mln/accu/image/to_result.hh>
+
+/// \file
+///
+/// \brief Allow the visualization of 3d histogram.
+/// The 3d histogram is projected in 2d such as the data in that direction
+/// are accumulated to the two others.
+
+namespace mln
+{
+
+ namespace display
+ {
+
+ // Forward declaration.
+ template <typename A, unsigned direction, typename V>
+ image2d<mln_result(A)>
+ project_histo(const image3d<V>& histo);
+
+#ifndef MLN_INCLUDE_ONLY
+
+ /// \brief Allow the visualization of 3d histogram.
+ ///
+ /// The 3d histogram is projected in 2d such as the data in that direction
+ /// are accumulated to the two others.
+ ///
+ /// Parameter A is the type of accumulator, for instance, accu::math::sum.
+ /// Parameter direction is the way of the projection, for instance blue one.
+ /// Parameter V is the value we use to accumulate information.
+ ///
+ /// \prameter[in] the histogram 3d.
+ /// \result the 2d projection of the 3d histogram.
+
+ template <typename A, unsigned direction, typename V>
+ image2d<mln_result(A)>
+ project_histo(const image3d<V>& histo)
+ {
+ typedef fun::v2v::projection<point3d,direction> t_projection;
+
+ image2d<A> histo_accu(histo.nrows(), histo.ncols());
+
+ accu::image::init(histo_accu);
+
+ accu::image::take(unproject(histo_accu,
+ histo.domain(),
+ t_projection()).rw(),
+ histo);
+
+ return accu::image::to_result(histo_accu);
+ }
+
+#endif // ! MLN_INCLUDE_ONLY
+
+
+ } // end of namespace mln::transform
+
+} // end of namespace mln
+
+
+#endif // ! MLN_DISPLAY_PROJECT_HISTO_HH
diff --git a/trunk/milena/sandbox/green/mln/fun/v2v/log.hh
b/trunk/milena/sandbox/green/mln/fun/v2v/log.hh
new file mode 100644
index 0000000..d6905fa
--- /dev/null
+++ b/trunk/milena/sandbox/green/mln/fun/v2v/log.hh
@@ -0,0 +1,70 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena 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 Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project 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_FUN_V2V_LOG_HH
+# define MLN_FUN_V2V_LOG_HH
+
+/// \file
+///
+/// \brief Take the logarithm of each pixel value.
+
+namespace mln
+{
+
+ namespace fun
+ {
+
+ namespace v2v
+ {
+
+ /// \brief Take the logarithm of each pixel value.
+ ///
+ /// \ingroup modfunv2v
+
+ template <typename T>
+ struct log : Function_v2v< log<T> >
+ {
+ typedef T argument;
+ typedef T result;
+
+ result operator()(const argument v) const
+ {
+ mln_precondition(v > -1);
+
+ result tmp = std::log(v+1);
+
+ return tmp;
+ }
+ };
+
+ } // end of namespace mln::fun::v2v
+
+ } // end of namespace mln::fun
+
+} // end of namespace mln
+
+#endif // ! MLN_FUN_V2V_LOG_HH
--
1.5.6.5