Olena-patches
Threads by month
- ----- 2025 -----
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
December 2007
- 11 participants
- 54 discussions
#122: [TRAITS] image_if_base
---------------------+------------------------------------------------------
Reporter: duhamel | Owner: Olena Team
Type: defect | Status: new
Priority: major | Milestone: Olena 1.0ß
Component: Milena | Version: 1.0
Keywords: |
---------------------+------------------------------------------------------
In source:trunk/milena/mln/core/internal/image_if_base.hh data trait is
suspect.
For example an image_if from an image1d has always data trait raw !
--
Ticket URL: <https://trac.lrde.org/olena/ticket/122>
Olena <http://olena.lrde.epita.fr>
Olena, a generic and efficient C++ image library.
2
1
22 Dec '07
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Move mathematical morphology-related tests into tests/morpho.
* tests/Makefile.am (SUBDIRS): Add morpho.
(morpho_contrast, morpho_dilation, morpho_dilation_max_h)
(morpho_erosion, morpho_erosion_min_h, morpho_gradient)
(morpho_hit_or_miss, morpho_laplacian, morpho_opening_area)
(morpho_thinning):
Remove.
(morpho_contrast_SOURCES, morpho_dilation_SOURCES)
(morpho_dilation_max_h_SOURCES, morpho_erosion_SOURCES)
(morpho_erosion_min_h_SOURCES, morpho_gradient_SOURCES)
(morpho_hit_or_miss_SOURCES, morpho_laplacian_SOURCES)
(morpho_opening_area_SOURCES, morpho_thinning_SOURCES):
Remove.
* tests/morpho/Makefile.am (check_PROGRAMS): New.
(contrast_SOURCES, dilation_SOURCES, dilation_max_h_SOURCES)
(erosion_SOURCES, erosion_min_h_SOURCES, gradient_SOURCES)
(hit_or_miss_SOURCES, laplacian_SOURCES, opening_area_SOURCES)
(thinning_SOURCES): New.
(TESTS): New.
* tests/morpho/contrast.cc,
* tests/morpho/dilation.cc,
* tests/morpho/dilation_max_h.cc,
* tests/morpho/erosion.cc,
* tests/morpho/erosion_min_h.cc,
* tests/morpho/gradient.cc,
* tests/morpho/hit_or_miss.cc,
* tests/morpho/laplacian.cc,
* tests/morpho/opening_area.cc,
* tests/morpho/thinning.cc:
Rename and move as...
* tests/morpho_contrast.cc,
* tests/morpho_dilation.cc,
* tests/morpho_dilation_max_h.cc,
* tests/morpho_erosion.cc,
* tests/morpho_erosion_min_h.cc,
* tests/morpho_gradient.cc,
* tests/morpho_hit_or_miss.cc,
* tests/morpho_laplacian.cc,
* tests/morpho_opening_area.cc,
* tests/morpho_thinning.cc:
...these.
Makefile.am | 21 +--------------------
core/Makefile.am | 2 --
morpho/Makefile.am | 25 +++++++++++++++++++++++++
3 files changed, 26 insertions(+), 22 deletions(-)
Index: tests/Makefile.am
--- tests/Makefile.am (revision 1625)
+++ tests/Makefile.am (working copy)
@@ -17,6 +17,7 @@
labeling \
level \
logical \
+ morpho \
norm \
set \
util \
@@ -87,16 +88,6 @@
metal_pow \
metal_unconst \
metal_vec \
- morpho_contrast \
- morpho_dilation \
- morpho_dilation_max_h \
- morpho_erosion \
- morpho_erosion_min_h \
- morpho_gradient \
- morpho_hit_or_miss \
- morpho_laplacian \
- morpho_opening_area \
- morpho_thinning \
\
pixel \
pixter1d \
@@ -200,16 +191,6 @@
metal_pow_SOURCES = metal_pow.cc
metal_unconst_SOURCES = metal_unconst.cc
metal_vec_SOURCES = metal_vec.cc
-morpho_contrast_SOURCES = morpho_contrast.cc
-morpho_dilation_SOURCES = morpho_dilation.cc
-morpho_dilation_max_h_SOURCES = morpho_dilation_max_h.cc
-morpho_erosion_SOURCES = morpho_erosion.cc
-morpho_erosion_min_h_SOURCES = morpho_erosion_min_h.cc
-morpho_gradient_SOURCES = morpho_gradient.cc
-morpho_hit_or_miss_SOURCES = morpho_hit_or_miss.cc
-morpho_laplacian_SOURCES = morpho_laplacian.cc
-morpho_opening_area_SOURCES = morpho_opening_area.cc
-morpho_thinning_SOURCES = morpho_thinning.cc
pixel_SOURCES = pixel.cc
pixter1d_SOURCES = pixter1d.cc
Index: tests/core/Makefile.am
--- tests/core/Makefile.am (revision 1625)
+++ tests/core/Makefile.am (working copy)
@@ -41,6 +41,4 @@
p_queue_SOURCES = p_priority_queue_fast.cc
p_queue_fast_SOURCES = p_priority_queue_fast.cc
-
-
TESTS = $(check_PROGRAMS)
Index: tests/morpho/Makefile.am
--- tests/morpho/Makefile.am (revision 1625)
+++ tests/morpho/Makefile.am (working copy)
@@ -1,3 +1,28 @@
## Process this file through Automake to create Makefile.in -*- Makefile -*-
include $(top_srcdir)/milena/tests/tests.mk
+
+check_PROGRAMS = \
+ contrast \
+ dilation \
+ dilation_max_h \
+ erosion \
+ erosion_min_h \
+ gradient \
+ hit_or_miss \
+ laplacian \
+ opening_area \
+ thinning
+
+contrast_SOURCES = contrast.cc
+dilation_SOURCES = dilation.cc
+dilation_max_h_SOURCES = dilation_max_h.cc
+erosion_SOURCES = erosion.cc
+erosion_min_h_SOURCES = erosion_min_h.cc
+gradient_SOURCES = gradient.cc
+hit_or_miss_SOURCES = hit_or_miss.cc
+laplacian_SOURCES = laplacian.cc
+opening_area_SOURCES = opening_area.cc
+thinning_SOURCES = thinning.cc
+
+TESTS = $(check_PROGRAMS)
1
0
https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Fix mln::mesh_image.
* mln/core/mesh_image.hh
(internal::data_< mesh_image<P, V> >::mesh_): Turn this attribute
into a reference to mesh_p<P>.
(init_(tag::image_t, mesh_image<P, V>&, const mesh_image<P, V>&)):
New specialization for mesh_image.
(mesh_image<P, V>::init_): New method.
Use it...
(mesh_image<P, V>::mesh_image): ...in this ctor.
* mln/core/mesh_p_piter.hh (mesh_p_piter_<P>::to_point)
(mesh_p_piter_<P>::to_psite): Don't check the validity of the
iterator, as it is incompatible with the current convention on the
use of window/neighborhood iterators.
* mln/core/mesh_p.hh: Add a FIXME.
* mln/draw/mesh.hh
(draw::mesh(Image<I>&, const mesh_image<P, V>&, mln_value(I))):
Add a third argument to choose the value used to print edges.
* tests/core/mesh_image.cc: Adjust.
Perform dilation and erosion on graph-based images (i.e.,
mesh_image objects).
mln/core/mesh_image.hh | 59 ++++++++++++++++++++++++++++++++++++++++++++---
mln/core/mesh_p.hh | 3 ++
mln/core/mesh_p_piter.hh | 20 +++++++++++++++
mln/draw/mesh.hh | 18 +++++++++++---
tests/core/mesh_image.cc | 52 +++++++++++++++++++++++++++++++++++------
5 files changed, 137 insertions(+), 15 deletions(-)
Index: mln/core/mesh_image.hh
--- mln/core/mesh_image.hh (revision 1624)
+++ mln/core/mesh_image.hh (working copy)
@@ -58,7 +58,7 @@
data_(mesh_p<P>& mesh, std::vector<V>& val);
std::vector<V> val_;
- mesh_p<P> mesh_;
+ mesh_p<P>& mesh_;
};
} // end of namespace mln::internal
@@ -117,6 +117,9 @@
mesh_image(mesh_p<P>& mesh, std::vector<V>& val);
mesh_image();
+ /// Initialize an empty image.
+ void init_(mesh_p<P>& mesh, std::vector<V>& val);
+
/// Read-only access of pixel value at point site \p p.
const V& operator()(const mesh_psite<P>& p) const;
@@ -126,6 +129,7 @@
/// Give the set of values of the image.
const vset& values() const;
+ // FIXME: Keep this name?
const std::vector<V>& data_values () const;
const mesh_p<P>& domain() const;
@@ -137,11 +141,39 @@
const P& access_location_link_node2 (const unsigned& i) const;
};
-
+ // Fwd decl.
+ template <typename P, typename V>
+ void init_(tag::image_t,
+ mesh_image<P, V>& target, const mesh_image<P, V>& model);
# ifndef MLN_INCLUDE_ONLY
+ /*-----------------.
+ | Initialization. |
+ `-----------------*/
+
+ template <typename P, typename V>
+ inline
+ void init_(tag::image_t,
+ mesh_image<P, V>& target, const mesh_image<P, V>& model)
+ {
+ /* FIXME: Unfortunately, we cannot simply use
+
+ target.init_(model.domain(), model.data_values ());
+
+ here, since domain() and data_values() return const data, and
+ init_ expects non mutable data. These constness problems exist
+ also in mesh_psite (see uses of const_cast<>). Hence the
+ inelegant use of const_cast<>'s. */
+ target.init_(const_cast<mesh_p<P>&> (model.domain()),
+ const_cast<std::vector<V>&> (model.data_values ()));
+ }
+
+ /*-------.
+ | Data. |
+ `-------*/
+
namespace internal
{
template <typename P, typename V>
@@ -154,11 +186,15 @@
} // end of namespace mln::internal
+ /*---------------.
+ | Construction. |
+ `---------------*/
+
template <typename P, typename V>
inline
mesh_image<P, V>::mesh_image(mesh_p<P>& mesh, std::vector<V>& val)
{
- this->data_ = new internal::data_< mesh_image<P, V> > (mesh, val);
+ init_(mesh, val);
}
template <typename P, typename V>
@@ -169,6 +205,23 @@
template <typename P, typename V>
inline
+ void
+ mesh_image<P, V>::init_(mesh_p<P>& mesh, std::vector<V>& val)
+ {
+ /* FIXME: We leak memory here: calling init_ twice loses the
+ previous content pointed by data_.
+
+ We should definitely write down formal guidelines on
+ initializaion and memory management in general! */
+ this->data_ = new internal::data_< mesh_image<P, V> > (mesh, val);
+ }
+
+ /*---------------.
+ | Manipulation. |
+ `---------------*/
+
+ template <typename P, typename V>
+ inline
const V&
mesh_image<P, V>::operator()(const mesh_psite<P>& p) const
{
Index: mln/core/mesh_p_piter.hh
--- mln/core/mesh_p_piter.hh (revision 1624)
+++ mln/core/mesh_p_piter.hh (working copy)
@@ -174,7 +174,17 @@
const P&
mesh_p_piter_<P>::to_point() const
{
+ /* We don't check whether the iterator is valid before returning
+ the value using
+
mln_precondition(is_valid());
+
+ since this method may be called *before* the iterator is
+ actually initialized. This is the case for instance when this
+ point iterator (say, P) is used to initialize another iterator
+ on window or neighborhood (say, Q); most of the time, for_all()
+ is responsible for the initialization of P, but it takes place
+ *after* the creation of Q. */
return p_;
}
@@ -183,7 +193,17 @@
const mesh_psite<P>&
mesh_p_piter_<P>::to_psite() const
{
+ /* We don't check whether the iterator is valid before returning
+ the value using
+
mln_precondition(is_valid());
+
+ since this method may be called *before* the iterator is
+ actually initialized. This is the case for instance when this
+ point iterator (say, P) is used to initialize another iterator
+ on window or neighborhood (say, Q); most of the time, for_all()
+ is responsible for the initialization of P, but it takes place
+ *after* the creation of Q. */
return psite_;
}
Index: mln/core/mesh_p.hh
--- mln/core/mesh_p.hh (revision 1624)
+++ mln/core/mesh_p.hh (working copy)
@@ -75,6 +75,9 @@
graph gr_;
std::vector<P> loc_;
// FIXME: (Roland) Is it really useful/needed?
+ /* 2007-12-19: It seems so, since mesh_image must implement a method
+ named bbox(). Now the question is: should each image type have a
+ bounding box? */
box_<P> bb_;
};
Index: mln/draw/mesh.hh
--- mln/draw/mesh.hh (revision 1624)
+++ mln/draw/mesh.hh (working copy)
@@ -45,6 +45,10 @@
namespace draw
{
+ /* FIXME: `draw::mesh' is not a good name. These functions do not
+ actually draw the mesh/mesh_image; it *converts* it to a
+ printable image. These functions should be put elsewhere
+ (e.g., in debug::). */
/*! Draw an image \p ima from a mesh_p \p m, with value \p node_v
* for nodes, value \p link_v for links and 0 for the background.
@@ -67,15 +71,20 @@
* \param[in,out] ima The image to be drawn.
* \param[in] mesh The mesh_image which contains nodes, links
* positions and the values of it.
+ * \param[in] link_v The value to assign to pixels which contains links,
+ * defaulting to 1.
*
*/
+ // FIXME: The type of the last argument cannot always been
+ // constructed from `int'! We should remove this last argument.
template <typename I, typename P, typename V>
void
- mesh(Image<I>& ima, const mesh_image<P, V>& mesh);
+ mesh(Image<I>& ima, const mesh_image<P, V>& mesh,
+ mln_value(I) link_v = 1);
# ifndef MLN_INCLUDE_ONLY
- // FIXME: Add assertions on the size of the image: it must be big
+ // FIXME: Add assertions on the size of the image: it must be large
// enough to hold the reprensentation of the graph.
template <typename I, typename P>
@@ -100,7 +109,8 @@
template <typename I, typename P, typename V>
inline
void
- mesh(Image<I>& ima, const mesh_image<P, V>& mesh)
+ mesh(Image<I>& ima, const mesh_image<P, V>& mesh,
+ mln_value(I) link_v)
{
level::fill(ima, 0);
@@ -108,7 +118,7 @@
line (exact(ima),
mesh.access_location_link_node1 (i),
mesh.access_location_link_node2 (i),
- 1);
+ link_v);
for (unsigned i = 0; i < mesh.domain().gr_.nb_node_; ++i)
exact(ima)(mesh.domain().loc_[i]) = mesh.data_values ()[i];
Index: tests/core/mesh_image.cc
--- tests/core/mesh_image.cc (revision 1624)
+++ tests/core/mesh_image.cc (working copy)
@@ -25,10 +25,8 @@
// reasons why the executable file might be covered by the GNU General
// Public License.
-/*! \file tests/core/mesh_image.cc
- *
- * \brief Tests on mln::mesh_image.
- */
+/// \file tests/core/mesh_image.cc
+/// \brief Tests on mln::mesh_image.
#include <vector>
@@ -37,6 +35,9 @@
#include <mln/core/mesh_elt_window.hh>
#include <mln/core/mesh_window_piter.hh>
+#include <mln/morpho/dilation.hh>
+
+#include <mln/draw/mesh.hh>
#include <mln/debug/iota.hh>
#include <mln/debug/println.hh>
@@ -86,9 +87,32 @@
ima_t ima(mesh, values);
// Initialize values.
debug::iota(ima);
- // The printed result does not show the graph, only the values.
+ // Print the image.
+ /* FIXME: Unfortunately, displaying mesh images is not easy right
+ now (2007-12-19). We could use
+
debug::println(ima);
+ but there's not specialization working for mesh_image; the one
+ selected by the compiler is based on a 2-D bbox, and expects the
+ interface of mesh_image to work with points (not psites).
+ Moreover, this iplementation only shows *values*, not the graph
+ itslef.
+
+ An alternative is to use draw::mesh (which, again, is misnamed),
+ but it doesn't show the values, only the nodes and edges of the
+ graph.
+
+ The current solution is a mix between draw::mesh and hand-made
+ iterations. */
+ image2d<int> ima_rep(ima.bbox());
+ // We use the value 9 in draw::mesh instead of the default (which is
+ // 1) to represent edges to distinguish it from nodes holding a
+ // value of 1.
+ draw::mesh (ima_rep, ima, 9);
+ debug::println (ima_rep);
+
+
/*------------.
| Iterators. |
`------------*/
@@ -99,11 +123,11 @@
std::cout << "ima (" << p << ") = " << ima(p) << std::endl;
// Manual iterations over the neighborhoods of each point site of IMA.
+ /* FIXME: In fact, this class should be named
+ `mesh_elt_neighborhood' (there's no such thing as an elementary
+ window on a mesh/graph!). */
typedef mesh_elt_window<point2d> win_t;
win_t win;
- // Reinitialize P, otherwise Q will trigger an assertion about P
- // being unable to convert to a valid mesh_piter object.
- p.start();
mln_qiter_(win_t) q(win, p);
for_all (p)
{
@@ -112,4 +136,16 @@
for_all (q)
std::cout << " " << q << " (level = " << ima(q) << ")" << std::endl;
}
+
+ /*-------------------------.
+ | Processing mesh images. |
+ `-------------------------*/
+
+ mesh_image<point2d, int> ima_dil = morpho::dilation(ima, win);
+ draw::mesh(ima_rep, ima_dil, 9);
+ debug::println(ima_rep);
+
+ mesh_image<point2d, int> ima_ero = morpho::erosion(ima, win);
+ draw::mesh(ima_rep, ima_ero, 9);
+ debug::println(ima_rep);
}
1
0
21 Dec '07
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-12-21 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Fix for unit tests and moving initialize.
* mln/accu/median_alt.hh,
* mln/core/image2d.hh,
* mln/core/internal/image_base.hh,
* mln/level/was.median.hh,
* mln/linear/gaussian.hh: Fix.
* mln/core/concept/image.hh: Move initialize...
* mln/core/initialize.hh: New. ...here.
---
accu/median_alt.hh | 2 -
core/concept/image.hh | 30 -----------------
core/image2d.hh | 1
core/initialize.hh | 74 ++++++++++++++++++++++++++++++++++++++++++++
core/internal/image_base.hh | 3 -
level/was.median.hh | 7 ++++
linear/gaussian.hh | 5 ++
7 files changed, 88 insertions(+), 34 deletions(-)
Index: trunk/milena/mln/core/initialize.hh
===================================================================
--- trunk/milena/mln/core/initialize.hh (revision 0)
+++ trunk/milena/mln/core/initialize.hh (revision 1624)
@@ -0,0 +1,74 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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_CORE_INITIALIZE_HH
+# define MLN_CORE_INITIALIZE_HH
+
+/*! \file mln/core/initialize.hh
+ *
+ * \brief Definition of function that initialize an image from another
+ * one.
+ */
+
+# include <mln/core/concept/image.hh>
+
+namespace mln
+{
+
+ /*! Initialize the image \p target with data extracted from image \p model.
+ *
+ * \param[in, out] target The image to be initialized.
+ * \param[in] model The image to provide data for the initialization.
+ *
+ * \pre (not target.has_data) and model.has_data
+ */
+ template <typename I, typename J>
+ void initialize(Image<I>& target, const Image<J>& model);
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+
+ template <typename I, typename J>
+ inline
+ void initialize(Image<I>& target, const Image<J>& model)
+ {
+ trace::entering("core::initialize");
+ mln_precondition(! exact(target).has_data());
+ mln_precondition(exact(model).has_data());
+
+ init_(tag::image, exact(target), exact(model));
+
+ mln_postcondition(exact(target).has_data());
+ trace::exiting("core::initialize");
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+#endif // ! MLN_CORE_INITIALIZE_HH
Index: trunk/milena/mln/core/internal/image_base.hh
===================================================================
--- trunk/milena/mln/core/internal/image_base.hh (revision 1623)
+++ trunk/milena/mln/core/internal/image_base.hh (revision 1624)
@@ -252,7 +252,4 @@
} // end of namespace mln
-# include <mln/core/init.hh>
-
-
#endif // ! MLN_CORE_INTERNAL_IMAGE_BASE_HH
Index: trunk/milena/mln/core/concept/image.hh
===================================================================
--- trunk/milena/mln/core/concept/image.hh (revision 1623)
+++ trunk/milena/mln/core/concept/image.hh (revision 1624)
@@ -117,19 +117,6 @@
};
-
- /*! Initialize the image \p target with data extracted from image \p model.
- *
- * \param[in, out] target The image to be initialized.
- * \param[in] model The image to provide data for the initialization.
- *
- * \pre (not target.has_data) and model.has_data
- */
- template <typename I, typename J>
- void initialize(Image<I>& target, const Image<J>& model);
-
-
-
# ifndef MLN_INCLUDE_ONLY
template <typename E>
@@ -181,25 +168,10 @@
m8 = 0;
}
- template <typename I, typename J>
- inline
- void initialize(Image<I>& target, const Image<J>& model)
- {
- trace::entering("core::initialize");
- mln_precondition(! exact(target).has_data());
- mln_precondition(exact(model).has_data());
-
- init_(tag::image, exact(target), exact(model));
-
- mln_postcondition(exact(target).has_data());
- trace::exiting("core::initialize");
- }
-
-
# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln
-
+# include <mln/core/initialize.hh>
#endif // ! MLN_CORE_CONCEPT_IMAGE_HH
Index: trunk/milena/mln/core/image2d.hh
===================================================================
--- trunk/milena/mln/core/image2d.hh (revision 1623)
+++ trunk/milena/mln/core/image2d.hh (revision 1624)
@@ -36,6 +36,7 @@
# include <mln/core/internal/image_primary.hh>
# include <mln/core/internal/fixme.hh>
# include <mln/core/box2d.hh>
+# include <mln/core/init.hh>
# include <mln/border/thickness.hh>
# include <mln/value/set.hh>
Index: trunk/milena/mln/level/was.median.hh
===================================================================
--- trunk/milena/mln/level/was.median.hh (revision 1623)
+++ trunk/milena/mln/level/was.median.hh (revision 1624)
@@ -35,6 +35,13 @@
# include <mln/geom/shift.hh>
# include <mln/core/window2d.hh>
+# include <mln/geom/min_col.hh>
+# include <mln/geom/max_col.hh>
+# include <mln/geom/max_row.hh>
+# include <mln/geom/min_row.hh>
+# include <mln/set/diff.hh>
+# include <mln/accu/median.hh>
+# include <mln/win/hline2d.hh>
namespace mln
{
Index: trunk/milena/mln/linear/gaussian.hh
===================================================================
--- trunk/milena/mln/linear/gaussian.hh (revision 1623)
+++ trunk/milena/mln/linear/gaussian.hh (revision 1624)
@@ -35,10 +35,13 @@
*/
# include <mln/core/concept/image.hh>
+# include <mln/core/point2d.hh>
# include <mln/level/paste.hh>
+# include <mln/geom/ncols.hh>
+# include <mln/geom/nrows.hh>
# include <vector>
-
+# include <cmath>
namespace mln
{
Index: trunk/milena/mln/accu/median_alt.hh
===================================================================
--- trunk/milena/mln/accu/median_alt.hh (revision 1623)
+++ trunk/milena/mln/accu/median_alt.hh (revision 1624)
@@ -71,7 +71,7 @@
protected:
- histo_on_set<S> h_;
+ histo<S> h_;
const S& s_; // derived from h_
std::size_t sum_minus_, sum_plus_;
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-12-21 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Clean internal namespace in core.
* mln/core/a_point_of.hh,
* mln/core/cast_image.hh,
* mln/core/clone.hh,
* mln/core/decorated_image.hh,
* mln/core/dpoint.hh,
* mln/core/dpoint1d.hh,
* mln/core/dpoint2d.hh,
* mln/core/dpoint3d.hh,
* mln/core/dpoints_piter.hh,
* mln/core/dpoints_pixter.hh,
* mln/core/exact.hh,
* mln/core/fi_adaptor.hh,
* mln/core/hexa.hh,
* mln/core/image2d.hh,
* mln/core/image3d.hh,
* mln/core/image_if.hh,
* mln/core/image_if_interval.hh,
* mln/core/image_if_value.hh,
* mln/core/interpolated.hh,
* mln/core/mesh_image.hh,
* mln/core/mesh_p.hh,
* mln/core/mono_obased_rle_image.hh,
* mln/core/mono_rle_image.hh,
* mln/core/obased_rle_image.hh,
* mln/core/plain.hh,
* mln/core/rle_image.hh,
* mln/core/safe.hh,
* mln/core/sparse_image.hh,
* mln/core/sub_image.hh,
* mln/core/t_image.hh,
* mln/core/tr_image.hh,
* mln/core/translate_image.hh: Clean and fix in internal namespace
Doxygen comments.
---
a_point_of.hh | 4 +++-
cast_image.hh | 5 +++--
clone.hh | 3 ++-
decorated_image.hh | 10 ++++++----
dpoint.hh | 2 +-
dpoint1d.hh | 9 ++++++++-
dpoint2d.hh | 9 ++++++++-
dpoint3d.hh | 9 ++++++++-
fi_adaptor.hh | 2 +-
hexa.hh | 2 +-
image2d.hh | 2 +-
image3d.hh | 2 +-
image_if.hh | 3 +--
image_if_interval.hh | 2 +-
image_if_value.hh | 4 +---
interpolated.hh | 1 +
mesh_image.hh | 1 +
mesh_p.hh | 2 +-
mono_obased_rle_image.hh | 1 +
mono_rle_image.hh | 1 +
obased_rle_image.hh | 1 +
plain.hh | 1 +
rle_image.hh | 1 +
safe.hh | 1 +
sparse_image.hh | 1 +
sub_image.hh | 1 +
t_image.hh | 2 +-
tr_image.hh | 1 +
translate_image.hh | 1 +
29 files changed, 60 insertions(+), 24 deletions(-)
Index: trunk/milena/mln/core/dpoint1d.hh
===================================================================
--- trunk/milena/mln/core/dpoint1d.hh (revision 1622)
+++ trunk/milena/mln/core/dpoint1d.hh (revision 1623)
@@ -56,13 +56,20 @@
namespace mln
{
- // FIXME: Doc!
+ /*!
+ * \brief Definition of a shortcut for delta point in 1d.
+ * \{
+ */
+
const dpoint1d before = make::dpoint1d( -1 );
const dpoint1d after = make::dpoint1d( +1 );
const dpoint1d ind_dec = before;
const dpoint1d ind_inc = after;
+ /*! \}
+ */
+
} // end of namespace mln
Index: trunk/milena/mln/core/dpoint2d.hh
===================================================================
--- trunk/milena/mln/core/dpoint2d.hh (revision 1622)
+++ trunk/milena/mln/core/dpoint2d.hh (revision 1623)
@@ -56,12 +56,19 @@
namespace mln
{
- // FIXME: Doc!
+ /*!
+ * \brief Definition of a shortcut for delta point in 2d.
+ * \{
+ */
const dpoint2d up = make::dpoint2d( -1, 0 );
const dpoint2d down = make::dpoint2d( +1, 0 );
const dpoint2d left = make::dpoint2d( 0, -1 );
const dpoint2d right = make::dpoint2d( 0, +1 );
+ /*!
+ * \}
+ */
+
} // end of namespace mln
Index: trunk/milena/mln/core/dpoints_piter.hh
===================================================================
Index: trunk/milena/mln/core/dpoint3d.hh
===================================================================
--- trunk/milena/mln/core/dpoint3d.hh (revision 1622)
+++ trunk/milena/mln/core/dpoint3d.hh (revision 1623)
@@ -56,7 +56,10 @@
namespace mln
{
- // FIXME: Doc!
+ /*!
+ * \brief Definition of a shortcut for delta point in 3d.
+ * \{
+ */
const dpoint3d sagittal_dec = make::dpoint3d( 0, 0, -1);
const dpoint3d sagittal_inc = make::dpoint3d( 0, 0, +1);
const dpoint3d axial_dec = make::dpoint3d( 0, -1, 0);
@@ -64,6 +67,10 @@
const dpoint3d coronal_dec = make::dpoint3d(-1, 0, 0);
const dpoint3d coronal_inc = make::dpoint3d(+1, 0, 0);
+ /*!
+ * \}
+ */
+
} // end of namespace mln
Index: trunk/milena/mln/core/decorated_image.hh
===================================================================
--- trunk/milena/mln/core/decorated_image.hh (revision 1622)
+++ trunk/milena/mln/core/decorated_image.hh (revision 1623)
@@ -62,7 +62,7 @@
typedef mln::value::proxy<const E> lvalue;
};
- /// \internal
+ /// \internal Data structure for \c mln::decorated_image<I,D>.
template <typename I, typename D>
struct data_< decorated_image<I,D> >
{
@@ -76,8 +76,10 @@
- // FIXME: Doc!
-
+ /*!
+ * \brief Class of decorated image : FIXME Doc
+ *
+ */
template <typename I, typename D>
struct decorated_image :
public internal::decorated_image_impl_< I, decorated_image<I,D> >,
@@ -133,7 +135,7 @@
namespace internal
{
- // \internal internal::data_< decorated_image<I,S> >
+ /// \internal internal::data_< decorated_image<I,S> >
template <typename I, typename D>
inline
data_< decorated_image<I,D> >::data_(I& ima, const D& deco)
Index: trunk/milena/mln/core/translate_image.hh
===================================================================
--- trunk/milena/mln/core/translate_image.hh (revision 1622)
+++ trunk/milena/mln/core/translate_image.hh (revision 1623)
@@ -49,6 +49,7 @@
namespace internal
{
+ /// \internal Data structure for \c mln::translate_image<I>.
template <typename I>
struct data_< translate_image<I> >
{
Index: trunk/milena/mln/core/image_if.hh
===================================================================
--- trunk/milena/mln/core/image_if.hh (revision 1622)
+++ trunk/milena/mln/core/image_if.hh (revision 1623)
@@ -49,11 +49,10 @@
template <typename I, typename F> struct image_if;
- /// \internal internal::data_.
-
namespace internal
{
+ /// \internal Data structure for \c mln::image_if<I,F>.
template <typename I, typename F>
struct data_< image_if<I,F> > : data_< Super >
{
Index: trunk/milena/mln/core/exact.hh
===================================================================
Index: trunk/milena/mln/core/mesh_p.hh
===================================================================
--- trunk/milena/mln/core/mesh_p.hh (revision 1622)
+++ trunk/milena/mln/core/mesh_p.hh (revision 1623)
@@ -49,7 +49,7 @@
template<typename P> class mesh_p_piter_;
template<typename P>
- struct mesh_p : public internal::point_set_base_< P, mesh_p<P> >
+ struct mesh_p : public internal::point_set_base_< mesh_psite<P>, mesh_p<P> >
{
typedef util::graph<void> graph;
Index: trunk/milena/mln/core/dpoints_pixter.hh
===================================================================
Index: trunk/milena/mln/core/rle_image.hh
===================================================================
--- trunk/milena/mln/core/rle_image.hh (revision 1622)
+++ trunk/milena/mln/core/rle_image.hh (revision 1623)
@@ -49,6 +49,7 @@
namespace internal
{
+ /// \internal Data structure for \c mln::rle_image<P,T>.
template <typename P, typename T>
struct data_< rle_image<P,T> >
{
Index: trunk/milena/mln/core/hexa.hh
===================================================================
--- trunk/milena/mln/core/hexa.hh (revision 1622)
+++ trunk/milena/mln/core/hexa.hh (revision 1623)
@@ -50,7 +50,7 @@
namespace internal
{
-
+ /// \internal Data structure for \c mln::hexa<I>.
template <typename I>
struct data_< hexa<I> >
{
Index: trunk/milena/mln/core/tr_image.hh
===================================================================
--- trunk/milena/mln/core/tr_image.hh (revision 1622)
+++ trunk/milena/mln/core/tr_image.hh (revision 1623)
@@ -51,6 +51,7 @@
namespace internal
{
+ /// \internal Data structure for \c mln::tr_image<T,I>.
template <typename T, typename I>
struct data_< tr_image<T,I> >
{
Index: trunk/milena/mln/core/interpolated.hh
===================================================================
--- trunk/milena/mln/core/interpolated.hh (revision 1622)
+++ trunk/milena/mln/core/interpolated.hh (revision 1623)
@@ -49,6 +49,7 @@
namespace internal
{
+ /// \internal Data structure for \c mln::interpolated<I>.
template <typename I>
struct data_< interpolated<I> >
{
Index: trunk/milena/mln/core/image_if_value.hh
===================================================================
--- trunk/milena/mln/core/image_if_value.hh (revision 1622)
+++ trunk/milena/mln/core/image_if_value.hh (revision 1623)
@@ -49,11 +49,9 @@
template <typename I> struct image_if_value;
- /// \internal internal::data_.
-
namespace internal
{
-
+ /// \internal Data structure for \c mln::image_if_value<I>.
template <typename I>
struct data_< image_if_value<I> > : data_< Super >
{
Index: trunk/milena/mln/core/image_if_interval.hh
===================================================================
--- trunk/milena/mln/core/image_if_interval.hh (revision 1622)
+++ trunk/milena/mln/core/image_if_interval.hh (revision 1623)
@@ -57,10 +57,10 @@
template <typename I> struct image_if_interval;
- /// \internal internal::data_.
namespace internal
{
+ /// \internal Data structure for \c mln::image_if_interval<I>.
template <typename I>
struct data_< image_if_interval<I> > : data_< Super >
{
Index: trunk/milena/mln/core/mono_rle_image.hh
===================================================================
--- trunk/milena/mln/core/mono_rle_image.hh (revision 1622)
+++ trunk/milena/mln/core/mono_rle_image.hh (revision 1623)
@@ -49,6 +49,7 @@
namespace internal
{
+ /// \internal Data structure for \c mln::mono_rle_image<P,T>.
template <typename P, typename T>
struct data_< mono_rle_image<P,T> >
{
Index: trunk/milena/mln/core/cast_image.hh
===================================================================
--- trunk/milena/mln/core/cast_image.hh (revision 1622)
+++ trunk/milena/mln/core/cast_image.hh (revision 1623)
@@ -50,7 +50,7 @@
namespace internal
{
- /// \internal
+ /// \internal Data structure for \c mln::cast_image_<T,I>.
template <typename T, typename I>
struct data_< cast_image_<T,I> >
{
@@ -75,7 +75,8 @@
- /*! \brief FIXME
+ /*! \brief Class of image morpher which takes an image to change its
+ * data type.
*
*/
template <typename T, typename I>
Index: trunk/milena/mln/core/mesh_image.hh
===================================================================
--- trunk/milena/mln/core/mesh_image.hh (revision 1622)
+++ trunk/milena/mln/core/mesh_image.hh (revision 1623)
@@ -51,6 +51,7 @@
namespace internal
{
+ /// \internal Data structure for \c mln::mesh_image<P,V>.
template <typename P, typename V>
struct data_< mesh_image<P, V> >
{
Index: trunk/milena/mln/core/obased_rle_image.hh
===================================================================
--- trunk/milena/mln/core/obased_rle_image.hh (revision 1622)
+++ trunk/milena/mln/core/obased_rle_image.hh (revision 1623)
@@ -50,6 +50,7 @@
namespace internal
{
+ /// \internal Data structure for \c mln::obased_rle_image<P,T>.
template <typename P, typename T>
struct data_< obased_rle_image<P,T> >
{
Index: trunk/milena/mln/core/safe.hh
===================================================================
--- trunk/milena/mln/core/safe.hh (revision 1622)
+++ trunk/milena/mln/core/safe.hh (revision 1623)
@@ -50,6 +50,7 @@
namespace internal
{
+ /// \internal Data structure for \c mln::safe_image<I>.
template <typename I>
struct data_< safe_image<I> >
{
Index: trunk/milena/mln/core/mono_obased_rle_image.hh
===================================================================
--- trunk/milena/mln/core/mono_obased_rle_image.hh (revision 1622)
+++ trunk/milena/mln/core/mono_obased_rle_image.hh (revision 1623)
@@ -51,6 +51,7 @@
namespace internal
{
+ /// \internal Data structure for \c mln::mono_obased_rle_image<P,T>.
template <typename P, typename T>
struct data_< mono_obased_rle_image<P,T> >
{
Index: trunk/milena/mln/core/sub_image.hh
===================================================================
--- trunk/milena/mln/core/sub_image.hh (revision 1622)
+++ trunk/milena/mln/core/sub_image.hh (revision 1623)
@@ -50,6 +50,7 @@
namespace internal
{
+ /// \internal Data structure for \c mln::sub_image<I,S>.
template <typename I, typename S>
struct data_< sub_image<I,S> >
{
Index: trunk/milena/mln/core/dpoint.hh
===================================================================
--- trunk/milena/mln/core/dpoint.hh (revision 1622)
+++ trunk/milena/mln/core/dpoint.hh (revision 1623)
@@ -54,7 +54,7 @@
/*! \brief Generic delta-point class.
*
- * Parameters are \c n the dimension of the space and \c C the
+ * Parameters are \c M the dimension of the space and \c C the
* coordinate type in this space.
*/
template <typename M, typename C>
Index: trunk/milena/mln/core/sparse_image.hh
===================================================================
--- trunk/milena/mln/core/sparse_image.hh (revision 1622)
+++ trunk/milena/mln/core/sparse_image.hh (revision 1623)
@@ -49,6 +49,7 @@
namespace internal
{
+ /// \internal Data structure for \c mln::sparse_image<P,T>.
template <typename P, typename T>
struct data_< sparse_image<P,T> >
{
Index: trunk/milena/mln/core/clone.hh
===================================================================
--- trunk/milena/mln/core/clone.hh (revision 1622)
+++ trunk/milena/mln/core/clone.hh (revision 1623)
@@ -41,7 +41,8 @@
namespace mln
{
- /*! Clone the image \p ima with the values of the image \p data.
+ /*! \brief Clone the image \p ima with the values of the image \p
+ * data.
*
* \param[in] ima The image to be cloneed.
* \result The clone.
Index: trunk/milena/mln/core/plain.hh
===================================================================
--- trunk/milena/mln/core/plain.hh (revision 1622)
+++ trunk/milena/mln/core/plain.hh (revision 1623)
@@ -51,6 +51,7 @@
namespace internal
{
+ /// \internal Data structure for \c mln::plain<I>.
template <typename I>
struct data_< plain<I> >
{
Index: trunk/milena/mln/core/t_image.hh
===================================================================
--- trunk/milena/mln/core/t_image.hh (revision 1622)
+++ trunk/milena/mln/core/t_image.hh (revision 1623)
@@ -46,7 +46,7 @@
namespace internal
{
- /// \internal Data held by a mln::t_image.
+ /// \internal Data structure for \c mln::t_image<I>.
template <typename I>
struct data_< t_image<I> >
{
Index: trunk/milena/mln/core/image2d.hh
===================================================================
--- trunk/milena/mln/core/image2d.hh (revision 1622)
+++ trunk/milena/mln/core/image2d.hh (revision 1623)
@@ -59,7 +59,7 @@
namespace internal
{
- /// \internal
+ /// \internal Data structure for \c mln::image2d<T>.
template <typename T>
struct data_< image2d<T> >
{
Index: trunk/milena/mln/core/fi_adaptor.hh
===================================================================
--- trunk/milena/mln/core/fi_adaptor.hh (revision 1622)
+++ trunk/milena/mln/core/fi_adaptor.hh (revision 1623)
@@ -61,7 +61,7 @@
namespace internal
{
- /// \internal
+ /// \internal Data structure for \c mln::fi_adaptor<I>.
template <typename I>
struct data_< fi_adaptor<I> >
{
Index: trunk/milena/mln/core/image3d.hh
===================================================================
--- trunk/milena/mln/core/image3d.hh (revision 1622)
+++ trunk/milena/mln/core/image3d.hh (revision 1623)
@@ -60,7 +60,7 @@
namespace internal
{
- /// \internal
+ /// \internal Data structure for \c mln::image3d<T>.
template <typename T>
struct data_< image3d<T> >
{
Index: trunk/milena/mln/core/a_point_of.hh
===================================================================
--- trunk/milena/mln/core/a_point_of.hh (revision 1622)
+++ trunk/milena/mln/core/a_point_of.hh (revision 1623)
@@ -39,7 +39,9 @@
namespace mln
{
- /// Give a point of an image.
+ /*!
+ * \brief Give a point of an image.
+ */
template <typename I>
mln_point(I) a_point_of(const Image<I>& ima);
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-12-20 Simon Nivault <simon.nivault(a)lrde.epita.fr>
Some fixes for unit/sanity tests.
* mln/accu/median_alt.hh,
* mln/accu/v.hh,
* mln/arith/min.spe.hh,
* mln/arith/revert.spe.hh,
* mln/arith/times.spe.hh,
* mln/convert/to_rgb.hh,
* mln/convert/to_tiles.hh,
* mln/convert/to_w_window.hh,
* mln/core/dpoints_piter.hh,
* mln/core/hexa_piter.hh,
* mln/core/interpolated.hh,
* mln/core/line_piter.hh,
* mln/core/p_runs.hh,
* mln/core/runs_psite.hh,
* mln/core/t_image.hh,
* mln/core/tr_image.hh,
* mln/core/tr_mesh.hh,
* mln/core/translate_image.hh,
* mln/debug/iota.spe.hh,
* mln/debug/println.spe.hh,
* mln/debug/println_with_border.spe.hh,
* mln/fun/v2v/saturate.hh,
* mln/geom/seeds2tiling.hh,
* mln/geom/seeds2tiling_roundness.hh,
* mln/histo/compute.spe.hh,
* mln/io/abort.hh,
* mln/io/pfm/load.hh,
* mln/io/pfm/save.hh,
* mln/io/pnm/max_component.hh,
* mln/labeling/level.spe.hh,
* mln/level/apply.spe.hh,
* mln/level/approx/median.hh,
* mln/level/assign.spe.hh,
* mln/level/fast_median.hh,
* mln/level/fill.spe.hh,
* mln/level/paste.spe.hh,
* mln/level/take.spe.hh,
* mln/level/transform.spe.hh,
* mln/level/was.median.hh,
* mln/linear/gaussian.hh,
* mln/logical/and.spe.hh,
* mln/logical/and_not.spe.hh,
* mln/logical/not.spe.hh,
* mln/logical/or.spe.hh,
* mln/morpho/dilation_fast.hh,
* mln/morpho/erosion.spe.hh,
* mln/morpho/erosion_fast.hh,
* mln/morpho/thick_miss.hh,
* mln/trait/image/props.hh,
* mln/util/tree_fast_to_image.hh,
* mln/util/tree_to_image.hh,
* tests/level/approx/median.cc: Fix
* tests/h_vec.cc: Rename as...
* tests/core/h_vec.cc: ...this.
---
mln/accu/median_alt.hh | 2
mln/accu/v.hh | 1
mln/arith/min.spe.hh | 4 +
mln/arith/revert.spe.hh | 4 +
mln/arith/times.spe.hh | 4 +
mln/convert/to_rgb.hh | 1
mln/convert/to_tiles.hh | 2
mln/convert/to_w_window.hh | 2
mln/core/dpoints_piter.hh | 1
mln/core/hexa_piter.hh | 1
mln/core/interpolated.hh | 2
mln/core/line_piter.hh | 2
mln/core/p_runs.hh | 1
mln/core/runs_psite.hh | 2
mln/core/t_image.hh | 2
mln/core/tr_image.hh | 1
mln/core/tr_mesh.hh | 2
mln/core/translate_image.hh | 1
mln/debug/iota.spe.hh | 4 +
mln/debug/println.spe.hh | 4 +
mln/debug/println_with_border.spe.hh | 4 +
mln/fun/v2v/saturate.hh | 1
mln/geom/seeds2tiling.hh | 1
mln/geom/seeds2tiling_roundness.hh | 1
mln/histo/compute.spe.hh | 4 +
mln/io/abort.hh | 2
mln/io/pfm/load.hh | 3 +
mln/io/pfm/save.hh | 1
mln/io/pnm/max_component.hh | 3 +
mln/labeling/level.spe.hh | 4 +
mln/level/apply.spe.hh | 4 +
mln/level/approx/median.hh | 8 +--
mln/level/assign.spe.hh | 4 +
mln/level/fast_median.hh | 4 +
mln/level/fill.spe.hh | 4 +
mln/level/paste.spe.hh | 4 +
mln/level/take.spe.hh | 4 +
mln/level/transform.spe.hh | 4 +
mln/level/was.median.hh | 2
mln/linear/gaussian.hh | 1
mln/logical/and.spe.hh | 5 +-
mln/logical/and_not.spe.hh | 4 +
mln/logical/not.spe.hh | 4 +
mln/logical/or.spe.hh | 4 +
mln/morpho/dilation_fast.hh | 1
mln/morpho/erosion.spe.hh | 4 +
mln/morpho/erosion_fast.hh | 1
mln/morpho/thick_miss.hh | 4 -
mln/trait/image/props.hh | 10 ++++
mln/util/tree_fast_to_image.hh | 1
mln/util/tree_to_image.hh | 1
tests/core/h_vec.cc | 73 +++++++++++++++++++++++++++++++++++
tests/level/approx/median.cc | 7 +--
53 files changed, 207 insertions(+), 18 deletions(-)
Index: trunk/milena/tests/h_vec.cc (deleted)
===================================================================
Index: trunk/milena/tests/level/approx/median.cc
===================================================================
--- trunk/milena/tests/level/approx/median.cc (revision 1621)
+++ trunk/milena/tests/level/approx/median.cc (revision 1622)
@@ -52,9 +52,10 @@
win::octagon2d oct(13);
border::thickness = 52;
- image2d<int_u8>
- lena = io::pgm::load("../../../img/lena.pgm"),
- out(lena.domain());
+ image2d<int_u8> lena;
+
+ io::pgm::load(lena, "../../../img/lena.pgm");
+ image2d<int_u8> out(lena.domain());
// level::approx::median(lena, rect, out);
level::approx::median(lena, oct, out);
Index: trunk/milena/tests/core/h_vec.cc
===================================================================
--- trunk/milena/tests/core/h_vec.cc (revision 0)
+++ trunk/milena/tests/core/h_vec.cc (revision 1622)
@@ -0,0 +1,73 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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/h_vec.cc
+ *
+ * \brief Tests on mln::h_vec.
+ */
+
+#include <mln/core/h_vec.hh>
+#include <mln/core/point3d.hh>
+
+using namespace mln;
+
+
+void run_in_3d(const metal::vec<3, int>&)
+{
+}
+
+void run_in_3d_h(const h_vec<3, int>&)
+{
+}
+
+
+void foo(const mln::h_vec<3,float>&)
+{
+}
+
+
+int main()
+{
+
+ metal::vec<3, int> x;
+ h_vec<3, int> w = x.to_h_vec();
+
+ typedef h_vec<3, int> p3d;
+ p3d p;
+ run_in_3d(p.to_vec());
+
+ point3d k;
+ run_in_3d(k);
+ run_in_3d_h(k.to_h_vec());
+
+ {
+ metal::vec<3,float> v;
+ h_vec<3,float> w(v.to_h_vec());
+ w = v.to_h_vec();
+ foo(v.to_h_vec());
+ }
+}
Index: trunk/milena/mln/trait/image/props.hh
===================================================================
--- trunk/milena/mln/trait/image/props.hh (revision 1621)
+++ trunk/milena/mln/trait/image/props.hh (revision 1622)
@@ -34,6 +34,7 @@
*/
# include <string>
+# include <mln/trait/undef.hh>
# include <mln/trait/value/kind.hh>
@@ -206,9 +207,18 @@
/// \{
// Fwd decl. (used by trait::image::space_from_point).
+ namespace grid
+ {
+ struct tick;
+ struct square;
+ struct hexa;
+ struct cube;
+ }
+
template <typename M, typename C> struct point_;
typedef point_<grid::tick, int> point1d;
typedef point_<grid::square, int> point2d;
+ typedef point_<grid::hexa, int> point2d_h;
typedef point_<grid::cube, int> point3d;
namespace trait
Index: trunk/milena/mln/debug/iota.spe.hh
===================================================================
--- trunk/milena/mln/debug/iota.spe.hh (revision 1621)
+++ trunk/milena/mln/debug/iota.spe.hh (revision 1622)
@@ -33,6 +33,10 @@
* \brief Specializations for mln::debug::iota.
*/
+# ifndef MLN_DEBUG_IOTA_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_DEBUG_IOTA_HH
+
# include <mln/core/concept/image.hh>
Index: trunk/milena/mln/debug/println_with_border.spe.hh
===================================================================
--- trunk/milena/mln/debug/println_with_border.spe.hh (revision 1621)
+++ trunk/milena/mln/debug/println_with_border.spe.hh (revision 1622)
@@ -33,6 +33,10 @@
* \brief Specializations for mln::debug::println_with_border.
*/
+# ifndef MLN_DEBUG_PRINTLN_WITH_BORDER_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_DEBUG_PRINTLN_WITH_BORDER_HH
+
# include <mln/core/concept/image.hh>
# include <mln/core/concept/window.hh>
# include <mln/debug/format.hh>
Index: trunk/milena/mln/debug/println.spe.hh
===================================================================
--- trunk/milena/mln/debug/println.spe.hh (revision 1621)
+++ trunk/milena/mln/debug/println.spe.hh (revision 1622)
@@ -33,6 +33,10 @@
* \brief Specializations for mln::debug::println.
*/
+# ifndef MLN_DEBUG_PRINTLN_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_DEBUG_PRINTLN_HH
+
# include <mln/core/concept/image.hh>
# include <mln/core/concept/window.hh>
# include <mln/debug/format.hh>
Index: trunk/milena/mln/histo/compute.spe.hh
===================================================================
--- trunk/milena/mln/histo/compute.spe.hh (revision 1621)
+++ trunk/milena/mln/histo/compute.spe.hh (revision 1622)
@@ -33,6 +33,10 @@
* \brief Specializations of histogram computation.
*/
+# ifndef MLN_HISTO_COMPUTE_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_HISTO_COMPUTE_HH
+
# ifndef MLN_INCLUDE_ONLY
Index: trunk/milena/mln/core/dpoints_piter.hh
===================================================================
--- trunk/milena/mln/core/dpoints_piter.hh (revision 1621)
+++ trunk/milena/mln/core/dpoints_piter.hh (revision 1622)
@@ -34,6 +34,7 @@
* iterators.
*/
+# include <vector>
# include <mln/core/internal/point_iterator_base.hh>
# include <mln/core/concept/point_site.hh>
Index: trunk/milena/mln/core/translate_image.hh
===================================================================
--- trunk/milena/mln/core/translate_image.hh (revision 1621)
+++ trunk/milena/mln/core/translate_image.hh (revision 1622)
@@ -37,6 +37,7 @@
# include <mln/core/internal/image_identity.hh>
# include <mln/core/box2d.hh>
+# include <mln/core/line_piter.hh>
namespace mln
Index: trunk/milena/mln/core/tr_image.hh
===================================================================
--- trunk/milena/mln/core/tr_image.hh (revision 1621)
+++ trunk/milena/mln/core/tr_image.hh (revision 1622)
@@ -39,6 +39,7 @@
# include <mln/core/internal/image_identity.hh>
# include <mln/metal/vec.hh>
+# include <mln/value/set.hh>
namespace mln
Index: trunk/milena/mln/core/hexa_piter.hh
===================================================================
--- trunk/milena/mln/core/hexa_piter.hh (revision 1621)
+++ trunk/milena/mln/core/hexa_piter.hh (revision 1622)
@@ -36,6 +36,7 @@
# include <mln/core/internal/piter_adaptor.hh>
# include <mln/core/box2d.hh>
+# include <mln/core/box2d_h.hh>
# include <mln/core/inplace.hh>
namespace mln
Index: trunk/milena/mln/core/line_piter.hh
===================================================================
--- trunk/milena/mln/core/line_piter.hh (revision 1621)
+++ trunk/milena/mln/core/line_piter.hh (revision 1622)
@@ -36,7 +36,7 @@
*/
# include <mln/core/internal/point_iterator_base.hh>
-
+# include <mln/core/box.hh>
namespace mln
{
Index: trunk/milena/mln/core/interpolated.hh
===================================================================
--- trunk/milena/mln/core/interpolated.hh (revision 1621)
+++ trunk/milena/mln/core/interpolated.hh (revision 1622)
@@ -38,7 +38,7 @@
# include <mln/core/internal/image_identity.hh>
# include <mln/metal/vec.hh>
-
+# include <mln/value/set.hh>
namespace mln
{
Index: trunk/milena/mln/core/runs_psite.hh
===================================================================
--- trunk/milena/mln/core/runs_psite.hh (revision 1621)
+++ trunk/milena/mln/core/runs_psite.hh (revision 1622)
@@ -34,7 +34,6 @@
*/
# include <mln/core/concept/point_site.hh>
-# include <mln/core/p_runs.hh>
namespace mln
@@ -188,5 +187,6 @@
} // end of namespace mln
+# include <mln/core/p_runs.hh>
#endif // ! MLN_CORE_INTERNAL_RUNS_PSITE_HH
Index: trunk/milena/mln/core/tr_mesh.hh
===================================================================
--- trunk/milena/mln/core/tr_mesh.hh (revision 1621)
+++ trunk/milena/mln/core/tr_mesh.hh (revision 1622)
@@ -35,7 +35,7 @@
*/
# include <mln/core/concept/mesh.hh>
-# include <mln/core/bool.hh>
+# include <mln/metal/bool.hh>
namespace mln
Index: trunk/milena/mln/core/t_image.hh
===================================================================
--- trunk/milena/mln/core/t_image.hh (revision 1621)
+++ trunk/milena/mln/core/t_image.hh (revision 1622)
@@ -35,7 +35,7 @@
# include <mln/core/internal/image_morpher.hh>
# include <mln/core/box.hh>
-
+# include <mln/value/set.hh>
namespace mln
{
Index: trunk/milena/mln/core/p_runs.hh
===================================================================
--- trunk/milena/mln/core/p_runs.hh (revision 1621)
+++ trunk/milena/mln/core/p_runs.hh (revision 1622)
@@ -52,7 +52,6 @@
template <typename P> struct p_runs_fwd_piter_;
template <typename P> struct p_runs_bkd_piter_;
-
/*! \brief p_runs_ class represent a point set used in run_image_ class.
*
* Parameter \c P is the type of the image point.
Index: trunk/milena/mln/arith/times.spe.hh
===================================================================
--- trunk/milena/mln/arith/times.spe.hh (revision 1621)
+++ trunk/milena/mln/arith/times.spe.hh (revision 1622)
@@ -34,6 +34,10 @@
*
*/
+# ifndef MLN_ARITH_TIMES_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_ARITH_TIMES_HH
+
# include <mln/arith/includes.hh>
Index: trunk/milena/mln/arith/min.spe.hh
===================================================================
--- trunk/milena/mln/arith/min.spe.hh (revision 1621)
+++ trunk/milena/mln/arith/min.spe.hh (revision 1622)
@@ -33,6 +33,10 @@
* \brief Specializations for mln::arith::min.
*/
+# ifndef MLN_ARITH_MIN_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_ARITH_MIN_HH
+
# include <mln/core/concept/image.hh>
# ifndef MLN_INCLUDE_ONLY
Index: trunk/milena/mln/arith/revert.spe.hh
===================================================================
--- trunk/milena/mln/arith/revert.spe.hh (revision 1621)
+++ trunk/milena/mln/arith/revert.spe.hh (revision 1622)
@@ -34,6 +34,10 @@
*
*/
+# ifndef MLN_ARITH_REVERT_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_ARITH_REVERT_HH
+
# include <mln/core/concept/image.hh>
# include <mln/trait/value_.hh>
Index: trunk/milena/mln/level/was.median.hh
===================================================================
--- trunk/milena/mln/level/was.median.hh (revision 1621)
+++ trunk/milena/mln/level/was.median.hh (revision 1622)
@@ -33,6 +33,8 @@
* \brief Obsolete routines for median filtering.
*/
+# include <mln/geom/shift.hh>
+# include <mln/core/window2d.hh>
namespace mln
{
Index: trunk/milena/mln/level/transform.spe.hh
===================================================================
--- trunk/milena/mln/level/transform.spe.hh (revision 1621)
+++ trunk/milena/mln/level/transform.spe.hh (revision 1622)
@@ -34,6 +34,10 @@
*
*/
+# ifndef MLN_LEVEL_TRANSFORM_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_LEVEL_TRANSFORM_HH
+
# include <mln/core/concept/image.hh>
# include <mln/core/concept/function.hh>
Index: trunk/milena/mln/level/paste.spe.hh
===================================================================
--- trunk/milena/mln/level/paste.spe.hh (revision 1621)
+++ trunk/milena/mln/level/paste.spe.hh (revision 1622)
@@ -33,6 +33,10 @@
* \brief Specializations for mln::level::paste.
*/
+# ifndef MLN_LEVEL_PASTE_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_LEVEL_PASTE_HH
+
# include <mln/level/memcpy_.hh>
Index: trunk/milena/mln/level/fast_median.hh
===================================================================
--- trunk/milena/mln/level/fast_median.hh (revision 1621)
+++ trunk/milena/mln/level/fast_median.hh (revision 1622)
@@ -37,6 +37,10 @@
# include <mln/core/window2d.hh>
# include <mln/accu/median.hh>
# include <mln/geom/shift.hh>
+# include <mln/geom/min_col.hh>
+# include <mln/geom/min_row.hh>
+# include <mln/geom/max_col.hh>
+# include <mln/geom/max_row.hh>
# include <mln/set/diff.hh>
Index: trunk/milena/mln/level/assign.spe.hh
===================================================================
--- trunk/milena/mln/level/assign.spe.hh (revision 1621)
+++ trunk/milena/mln/level/assign.spe.hh (revision 1622)
@@ -34,6 +34,10 @@
*
*/
+# ifndef MLN_LEVEL_ASSIGN_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_LEVEL_ASSIGN_HH
+
# include <mln/core/concept/image.hh>
Index: trunk/milena/mln/level/take.spe.hh
===================================================================
--- trunk/milena/mln/level/take.spe.hh (revision 1621)
+++ trunk/milena/mln/level/take.spe.hh (revision 1622)
@@ -33,6 +33,10 @@
* \brief Specializations for mln::level::take.
*/
+# ifndef MLN_LEVEL_TAKE_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_LEVEL_TAKE_HH
+
# include <mln/core/concept/accumulator.hh>
# include <mln/core/concept/image.hh>
Index: trunk/milena/mln/level/approx/median.hh
===================================================================
--- trunk/milena/mln/level/approx/median.hh (revision 1621)
+++ trunk/milena/mln/level/approx/median.hh (revision 1622)
@@ -120,22 +120,22 @@
{
clock_t c = clock();
level::median(input, win::diag2d(len), tmp1);
- std::cout << float(clock() - c) / CLOCKS_PER_SEC << std::endl;
+ std::cout << "diag " << float(clock() - c) / CLOCKS_PER_SEC << std::endl;
}
{
clock_t c = clock();
level::median(tmp1, win::backdiag2d(len), tmp2);
- std::cout << float(clock() - c) / CLOCKS_PER_SEC << std::endl;
+ std::cout << "back " << float(clock() - c) / CLOCKS_PER_SEC << std::endl;
}
{
clock_t c = clock();
level::median(tmp2, win::hline2d(len), tmp1);
- std::cout << float(clock() - c) / CLOCKS_PER_SEC << std::endl;
+ std::cout << "hlin " << float(clock() - c) / CLOCKS_PER_SEC << std::endl;
}
{
clock_t c = clock();
level::median(tmp1, win::vline2d(len), output);
- std::cout << float(clock() - c) / CLOCKS_PER_SEC << std::endl;
+ std::cout << "vlin " << float(clock() - c) / CLOCKS_PER_SEC << std::endl;
}
}
Index: trunk/milena/mln/level/apply.spe.hh
===================================================================
--- trunk/milena/mln/level/apply.spe.hh (revision 1621)
+++ trunk/milena/mln/level/apply.spe.hh (revision 1622)
@@ -33,6 +33,10 @@
* \brief Specializations for mln::level::apply.
*/
+# ifndef MLN_LEVEL_APPLY_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_LEVEL_APPLY_HH
+
# include <mln/core/concept/image.hh>
# include <mln/core/concept/function.hh>
Index: trunk/milena/mln/level/fill.spe.hh
===================================================================
--- trunk/milena/mln/level/fill.spe.hh (revision 1621)
+++ trunk/milena/mln/level/fill.spe.hh (revision 1622)
@@ -34,6 +34,10 @@
*
*/
+# ifndef MLN_LEVEL_FILL_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_LEVEL_FILL_HH
+
# include <cstring>
# include <mln/core/concept/image.hh>
Index: trunk/milena/mln/linear/gaussian.hh
===================================================================
--- trunk/milena/mln/linear/gaussian.hh (revision 1621)
+++ trunk/milena/mln/linear/gaussian.hh (revision 1622)
@@ -37,6 +37,7 @@
# include <mln/core/concept/image.hh>
# include <mln/level/paste.hh>
+# include <vector>
namespace mln
Index: trunk/milena/mln/accu/median_alt.hh
===================================================================
--- trunk/milena/mln/accu/median_alt.hh (revision 1621)
+++ trunk/milena/mln/accu/median_alt.hh (revision 1622)
@@ -48,7 +48,7 @@
* value set with type \c S.
*/
template <typename S>
- struct median_alt : : public mln::accu::internal::base_< mln_value(S), median_alt<S> >
+ struct median_alt : public mln::accu::internal::base_< mln_value(S), median_alt<S> >
{
typedef mln_value(S) argument;
Index: trunk/milena/mln/accu/v.hh
===================================================================
--- trunk/milena/mln/accu/v.hh (revision 1621)
+++ trunk/milena/mln/accu/v.hh (revision 1622)
@@ -36,6 +36,7 @@
# include <mln/core/concept/meta_accumulator.hh>
# include <mln/accu/internal/base.hh>
# include <mln/metal/is_a.hh>
+# include <mln/util/pix.hh>
namespace mln
Index: trunk/milena/mln/convert/to_tiles.hh
===================================================================
--- trunk/milena/mln/convert/to_tiles.hh (revision 1621)
+++ trunk/milena/mln/convert/to_tiles.hh (revision 1622)
@@ -38,6 +38,8 @@
# include <mln/geom/nrows.hh>
# include <mln/geom/ncols.hh>
+# include <vector>
+
namespace mln
{
Index: trunk/milena/mln/convert/to_rgb.hh
===================================================================
--- trunk/milena/mln/convert/to_rgb.hh (revision 1621)
+++ trunk/milena/mln/convert/to_rgb.hh (revision 1622)
@@ -35,6 +35,7 @@
* \todo Re-write.
*/
+# include <mln/value/rgb.hh>
namespace mln
{
Index: trunk/milena/mln/convert/to_w_window.hh
===================================================================
--- trunk/milena/mln/convert/to_w_window.hh (revision 1621)
+++ trunk/milena/mln/convert/to_w_window.hh (revision 1622)
@@ -34,7 +34,7 @@
*/
# include <mln/core/concept/image.hh>
-# include <mln/core/window.hh>
+# include <mln/core/w_window.hh>
namespace mln
Index: trunk/milena/mln/geom/seeds2tiling_roundness.hh
===================================================================
--- trunk/milena/mln/geom/seeds2tiling_roundness.hh (revision 1621)
+++ trunk/milena/mln/geom/seeds2tiling_roundness.hh (revision 1622)
@@ -36,6 +36,7 @@
# include <map>
+# include <mln/core/concept/neighborhood.hh>
# include <mln/core/p_priority_queue_fast.hh>
# include <mln/core/clone.hh>
# include <mln/accu/mean.hh>
Index: trunk/milena/mln/geom/seeds2tiling.hh
===================================================================
--- trunk/milena/mln/geom/seeds2tiling.hh (revision 1621)
+++ trunk/milena/mln/geom/seeds2tiling.hh (revision 1622)
@@ -35,6 +35,7 @@
# include <map>
+# include <mln/core/concept/neighborhood.hh>
# include <mln/core/p_queue.hh>
# include <mln/core/clone.hh>
# include <mln/accu/mean.hh>
Index: trunk/milena/mln/fun/v2v/saturate.hh
===================================================================
--- trunk/milena/mln/fun/v2v/saturate.hh (revision 1621)
+++ trunk/milena/mln/fun/v2v/saturate.hh (revision 1622)
@@ -36,6 +36,7 @@
# include <mln/core/concept/function.hh>
# include <mln/metal/converts_to.hh>
# include <mln/trait/value_.hh>
+# include <mln/value/cast.hh>
namespace mln
Index: trunk/milena/mln/morpho/erosion_fast.hh
===================================================================
--- trunk/milena/mln/morpho/erosion_fast.hh (revision 1621)
+++ trunk/milena/mln/morpho/erosion_fast.hh (revision 1622)
@@ -37,6 +37,7 @@
# include <mln/core/concept/image.hh>
# include <mln/core/window.hh>
+# include <mln/core/dpoint2d.hh>
# include <mln/geom/shift.hh>
# include <mln/set/diff.hh>
Index: trunk/milena/mln/morpho/thick_miss.hh
===================================================================
--- trunk/milena/mln/morpho/thick_miss.hh (revision 1621)
+++ trunk/milena/mln/morpho/thick_miss.hh (revision 1622)
@@ -62,8 +62,8 @@
const Window<Wfg>& win_fg, const Window<Wbg>& win_bg)
{
trace::entering("morpho::thick_miss");
- mln_precondition(exact(output).domain() == exact(input).domain());
- mln_precondition(exact(win_miss).is_centered());
+ // FIXME: Fix the following line (win_miss ??)
+// mln_precondition(exact(win_miss).is_centered());
mln_precondition(set::inter(exact(win_fg), exact(win_bg)).is_empty());
mln_concrete(I)
Index: trunk/milena/mln/morpho/erosion.spe.hh
===================================================================
--- trunk/milena/mln/morpho/erosion.spe.hh (revision 1621)
+++ trunk/milena/mln/morpho/erosion.spe.hh (revision 1622)
@@ -28,6 +28,10 @@
#ifndef MLN_MORPHO_EROSION_SPE_HH
# define MLN_MORPHO_EROSION_SPE_HH
+# ifndef MLN_MORPHO_EROSION_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_MORPHO_EROSION_HH
+
# include <mln/win/octagon2d.hh>
# include <mln/win/rectangle2d.hh>
Index: trunk/milena/mln/morpho/dilation_fast.hh
===================================================================
--- trunk/milena/mln/morpho/dilation_fast.hh (revision 1621)
+++ trunk/milena/mln/morpho/dilation_fast.hh (revision 1622)
@@ -37,6 +37,7 @@
# include <mln/core/concept/image.hh>
# include <mln/core/window.hh>
+# include <mln/core/dpoint2d.hh>
# include <mln/geom/shift.hh>
# include <mln/set/diff.hh>
Index: trunk/milena/mln/io/pfm/save.hh
===================================================================
--- trunk/milena/mln/io/pfm/save.hh (revision 1621)
+++ trunk/milena/mln/io/pfm/save.hh (revision 1622)
@@ -40,6 +40,7 @@
# include <iostream>
# include <fstream>
+# include <mln/core/point2d.hh>
# include <mln/geom/size2d.hh>
# include <mln/metal/equal.hh>
# include <mln/metal/bexpr.hh>
Index: trunk/milena/mln/io/pfm/load.hh
===================================================================
--- trunk/milena/mln/io/pfm/load.hh (revision 1621)
+++ trunk/milena/mln/io/pfm/load.hh (revision 1622)
@@ -37,6 +37,9 @@
*
*/
+# include <iostream>
+# include <fstream>
+
# include <mln/core/image2d.hh>
# include <mln/value/int_u8.hh>
Index: trunk/milena/mln/io/abort.hh
===================================================================
--- trunk/milena/mln/io/abort.hh (revision 1621)
+++ trunk/milena/mln/io/abort.hh (revision 1622)
@@ -36,6 +36,8 @@
*
*/
+# include <iostream>
+
namespace mln
{
Index: trunk/milena/mln/io/pnm/max_component.hh
===================================================================
--- trunk/milena/mln/io/pnm/max_component.hh (revision 1621)
+++ trunk/milena/mln/io/pnm/max_component.hh (revision 1622)
@@ -36,6 +36,9 @@
* value type.
*/
+# include <mln/value/rgb.hh>
+# include <mln/value/int_u.hh>
+
namespace mln
{
Index: trunk/milena/mln/logical/or.spe.hh
===================================================================
--- trunk/milena/mln/logical/or.spe.hh (revision 1621)
+++ trunk/milena/mln/logical/or.spe.hh (revision 1622)
@@ -34,6 +34,10 @@
*
*/
+# ifndef MLN_LOGICAL_OR_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_LOGICAL_OR_HH
+
# include <mln/core/concept/image.hh>
# ifndef MLN_INCLUDE_ONLY
Index: trunk/milena/mln/logical/not.spe.hh
===================================================================
--- trunk/milena/mln/logical/not.spe.hh (revision 1621)
+++ trunk/milena/mln/logical/not.spe.hh (revision 1622)
@@ -34,6 +34,10 @@
*
*/
+# ifndef MLN_LOGICAL_NOT_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_LOGICAL_NOT_HH
+
# include <mln/core/concept/image.hh>
Index: trunk/milena/mln/logical/and_not.spe.hh
===================================================================
--- trunk/milena/mln/logical/and_not.spe.hh (revision 1621)
+++ trunk/milena/mln/logical/and_not.spe.hh (revision 1622)
@@ -34,6 +34,10 @@
*
*/
+# ifndef MLN_LOGICAL_AND_NOT_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_LOGICAL_AND_NOT_HH
+
# include <mln/core/concept/image.hh>
Index: trunk/milena/mln/logical/and.spe.hh
===================================================================
--- trunk/milena/mln/logical/and.spe.hh (revision 1621)
+++ trunk/milena/mln/logical/and.spe.hh (revision 1622)
@@ -34,8 +34,11 @@
*
*/
-# include <mln/core/concept/image.hh>
+# ifndef MLN_LOGICAL_AND_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_LOGICAL_AND_HH
+# include <mln/core/concept/image.hh>
# ifndef MLN_INCLUDE_ONLY
Index: trunk/milena/mln/util/tree_to_image.hh
===================================================================
--- trunk/milena/mln/util/tree_to_image.hh (revision 1621)
+++ trunk/milena/mln/util/tree_to_image.hh (revision 1622)
@@ -36,6 +36,7 @@
*
*/
+# include <mln/core/concept/image.hh>
# include <mln/util/tree.hh>
# include <mln/core/p_set.hh>
Index: trunk/milena/mln/util/tree_fast_to_image.hh
===================================================================
--- trunk/milena/mln/util/tree_fast_to_image.hh (revision 1621)
+++ trunk/milena/mln/util/tree_fast_to_image.hh (revision 1622)
@@ -36,6 +36,7 @@
*
*/
+# include <mln/core/concept/image.hh>
# include <mln/util/tree_fast.hh>
# include <mln/core/p_set.hh>
# include <list>
Index: trunk/milena/mln/labeling/level.spe.hh
===================================================================
--- trunk/milena/mln/labeling/level.spe.hh (revision 1621)
+++ trunk/milena/mln/labeling/level.spe.hh (revision 1622)
@@ -33,6 +33,10 @@
* \brief Specialization for mln::labeling::level.
*/
+# ifndef MLN_LABELING_LEVEL_HH
+# error "Forbidden inclusion of *.spe.hh"
+# endif // ! MLN_LABELING_LEVEL_HH
+
# include <mln/border/adjust.hh>
# include <mln/border/fill.hh>
# include <mln/value/other.hh>
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-12-20 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add include in mln/canvas/chamfer.hh.
* mln/canvas/chamfer.hh: Add includes.
---
chamfer.hh | 3 +++
1 file changed, 3 insertions(+)
Index: trunk/milena/mln/canvas/chamfer.hh
===================================================================
--- trunk/milena/mln/canvas/chamfer.hh (revision 1620)
+++ trunk/milena/mln/canvas/chamfer.hh (revision 1621)
@@ -33,6 +33,9 @@
* \brief Apply chamfer algorithm to a binary image.
*/
+# include <mln/core/internal/image_morpher.hh>
+# include <mln/geom/sym.hh>
+
namespace mln
{
namespace canvas
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-12-19 Matthieu Garrigues <garrigues(a)lrde.epita.fr>
Rewrite graylevel types.
* mln/value/gray.hh: Rename as...
* mln/value/internal/gray_.hh: ...this. Gray_<n> is a graylevel
encoded on n bits. It can represent value greater than pow(2, n).
* mln/value/internal/gray_f.hh: New, gray_f is a graylevel encoded on
a float. It can represent value greater than 1.
* mln/value/glf.hh: New, alias to graylevel_f.
* mln/value/graylevel.hh: graylevel<n> is a graylevel encoded on n
bits. its interoperability type is gray_<n>.
* mln/value/graylevel_f.hh: New. graylevel_f is a graylevel encoded on
a float01_f.
* tests/value/graylevel.cc: Unit tests on graylevel.
* tests/value/graylevel_f.cc: Unit tests on graylevel_f.
* tests/value/graylevel_f_full.cc: Full tests on graylevel_f.
* tests/value/graylevel_full.cc: Full tests on graylevel.
Misc.
* mln/trait/value_.hh: (mln_trait_value_nature_) New,
(mln_trait_value_quant_) new,
(mln_trait_value_kind_) new.
* mln/metal/math/max.hh: (mlc_max) New,
(mlc_max_int) new.
* tests/arith/revert_full.cc: Add a test on int_u8.
* mln/accu/count.hh: Add a fixme to add an take without argument.
* mln/core/fi_adaptor.hh: Disable a precondition because it doesn't
work on rgb values.
---
mln/accu/count.hh | 1
mln/core/fi_adaptor.hh | 2
mln/metal/math/max.hh | 2
mln/trait/value_.hh | 3
mln/value/glf.hh | 55 +++
mln/value/graylevel.hh | 178 ++++++-----
mln/value/graylevel_f.hh | 299 ++++++++++++++++++
mln/value/internal/gray_.hh | 633 ++++++++++++++++++++++++++++++++++++++++
mln/value/internal/gray_f.hh | 273 +++++++++++++++++
tests/arith/revert_full.cc | 2
tests/value/graylevel.cc | 87 +++++
tests/value/graylevel_f.cc | 61 +++
tests/value/graylevel_f_full.cc | 102 ++++++
tests/value/graylevel_full.cc | 102 ++----
14 files changed, 1666 insertions(+), 134 deletions(-)
Index: trunk/milena/tests/arith/revert_full.cc
===================================================================
--- trunk/milena/tests/arith/revert_full.cc (revision 1619)
+++ trunk/milena/tests/arith/revert_full.cc (revision 1620)
@@ -266,6 +266,8 @@
chk<value::int_s8>();
std::cerr << "on int_s16:" << std::endl;
chk<value::int_s16>();
+ std::cerr << "on int_u8:" << std::endl;
+ chk<value::int_u8>();
std::cerr << "on unsigned:" << std::endl;
chk<unsigned>();
}
Index: trunk/milena/tests/value/graylevel_f.cc
===================================================================
--- trunk/milena/tests/value/graylevel_f.cc (revision 0)
+++ trunk/milena/tests/value/graylevel_f.cc (revision 1620)
@@ -0,0 +1,61 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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/value/graylevel_f.cc
+ *
+ * \brief Tests on mln::value::graylevel_f.
+ */
+
+#include <mln/value/graylevel.hh>
+#include <mln/value/glf.hh>
+#include <mln/literal/all.hh>
+
+
+int main()
+{
+ using namespace mln;
+ using value::glf;
+
+ using literal::black;
+ using literal::medium_gray;
+ using literal::white;
+
+
+ // Literals.
+ {
+ glf a = medium_gray;
+ glf b = medium_gray;
+ //a == 0.5f;
+ mln_assertion(0.5f == a.to_enc());
+ //a == b;
+ mln_assertion(b == a);
+
+ a *= 2;
+ mln_assertion(a == white);
+ mln_assertion(a.to_enc() == 1.f);
+ }
+}
Index: trunk/milena/tests/value/graylevel_full.cc
===================================================================
--- trunk/milena/tests/value/graylevel_full.cc (revision 1619)
+++ trunk/milena/tests/value/graylevel_full.cc (revision 1620)
@@ -32,7 +32,8 @@
*
*/
-#include <mln/value/graylevel2.hh>
+#include <mln/value/gl8.hh>
+#include <mln/value/gl16.hh>
#include <mln/value/int_u8.hh>
#include <mln/literal/black.hh>
@@ -68,11 +69,9 @@
gl16 c = d;
mln_assertion(c == d);
- gl8 e = gray(white);
- std::cout << e << std::endl;
- std::cout << gray(white) << std::endl;
+ gl8 e = white;
- mln_assertion(gray(e) == gray(white));
+ mln_assertion(e == white);
gl8 f = 12;
gl8 g = f;
@@ -87,6 +86,9 @@
gl8 a(white);
gl16 b(white);
+ a = white;
+ b = white;
+
mln_assertion(a == b);
mln_assertion(a.value() == float(255));
mln_assertion(b.value() == float(65535));
@@ -125,7 +127,7 @@
mln_assertion(b.value() == float(2));
a = b;
- mln_assertion(a.value() == float(2 / 257));
+ mln_assertion(a.value() == float(2 / 256));
signed char c = 51;
a = c;
@@ -167,14 +169,18 @@
a = 42;
b = 16969;
b += a;
- std::cout << "b = " << b << std::endl;
- std::cout << "res = " << float(42 * 256 + 128 + 16969) << std::endl;
- mln_assertion(b.value() == float((42 * 256 + 128 + 16969) ));
+ mln_assertion(b.value() == float((42 * 256 + 16969) ));
+
+ a = 42;
+ b = 16969;
+ b = b + a;
+
+ mln_assertion(b.value() == float((42 * 256 + 16969) ));
a = 42;
b = 16969;
b = a + b;
- mln_assertion(b.value() == float((42 * 256 + 128 + 16969) ));
+ mln_assertion(b.value() == float((42 * 256 + 16969) ));
// misc
a = 255;
@@ -184,10 +190,7 @@
a = 0;
b = 65535;
- //FIXME for tomorow: this doesn't work.
a = a + b;
- std::cout << "a = " << a << std::endl;
- std::cout << "a + b = " << a + b << std::endl;
mln_assertion(a.value() == float(255));
}
@@ -211,26 +214,23 @@
b = 5969;
a = b;
- std::cout << "a.value() = " << int(a.value()) << std::endl;
- std::cout << "should be " << (b.value() / 256) << std::endl;
{
a = 42;
- gl8 t;
+ gl16 t;
+
t = a - b;
t = t + b;
- std::cout << t << " == " << a << std::endl;
mln_assertion(a == t);
}
a = 42;
a = a - b;
- std::cout << int(a.value()) << ":" << floor(42 - b.value() / 256.0) << std::endl;
- mln_assertion(a.value() == float((42 - b.value() / 256) ));
+ mln_assertion(a.value() == (42 * 256 - b.value()) / 256 );
a = 42;
b = 9969;
a -= b;
- mln_assertion(a.value() == float((42 - round(float(b.value()) / 256)) ));
+ mln_assertion(a.value() == (42 * 256 - b.value()) / 256 );
// gl16 <- gl8 - gl16
@@ -250,6 +250,8 @@
a = a - b;
mln_assertion(a.value() == float(255));
+ gl8(255) - gl16(65535);
+ mln_assertion( gl8(255) == gl16(65535) );
a = 255;
b = 65535;
a = a - b;
@@ -257,33 +259,16 @@
// ...
{
- graylevel<2> a = 2;
+ graylevel<2> a = 1;
graylevel<3> b = 5;
graylevel<2> c;
graylevel<3> d;
- c = a - b;
- d = a - b;
+ c = b - a;
+ d = b - a;
mln_assertion(c == d);
}
- {
-
- // ...
- gl8 a = 42;
- gl16 b = 5969;
- gl8 p;
- p = b;
- gl8 q;
- gl8 r;
-
- q = a - p;
- r = a - b;
- std::cout << int(q.value()) << " " << int(r.value()) << std::endl;
- mln_assertion(q == r);
-
- }
-
}
// Multiplication
@@ -294,35 +279,36 @@
// gl8 <- gl8 * gl8
a = 8;
a *= a;
- std::cout << a << std::endl;
- mln_assertion(a.value() == 42);
+ mln_assertion(a.value() == 64);
- a = 21;
+ a = 7;
a = a * a;
- mln_assertion(a.value() == 42);
+ mln_assertion(a.value() == 49);
// gl8 <- gl8 * gl16
a = 10;
- b = 5969;
+ b = 20;
a = a * b;
- mln_assertion(a.value() == float((10 * b.value() / 256) ));
+ mln_assertion(a.value() == float((10 * 256* b.value())/256));
a = 10;
- b = 16969;
+ b = 16;
a *= b;
- mln_assertion(a.value() == float((10 * b.value() / 256) ));
+ mln_assertion(a.value() == float((10 * 256* b.value())/256));
+
+ mln_assertion((gl8(12) * gl16(12345)).to_enc() == float((12 * 256* 12345)));
// gl16 <- gl8 * gl16
a = 10;
- b = 5969;
+ b = 24;
b *= a;
- mln_assertion(b.value() == float((10 * 256 * 5969) ));
+ mln_assertion(b.value() == float((10 * 256 * 24) ));
a = 10;
- b = 5969;
+ b = 24;
b = a * b;
- mln_assertion(b.value() == float((10 * 256 * 5969) ));
+ mln_assertion(b.value() == float((10 * 256 * 24) ));
// misc
a = 255;
@@ -337,8 +323,8 @@
// ...
{
- graylevel<2> a = 2;
- graylevel<3> b = 5;
+ graylevel<2> a = 1;
+ graylevel<3> b = 2;
graylevel<2> c;
graylevel<3> d;
@@ -351,7 +337,7 @@
// ...
gl8 a = 7;
- gl16 b = 5969;
+ gl16 b = 596;
gl8 p;
p = b;
@@ -360,11 +346,9 @@
gl8 r;
q = a * p;
- r = a * b;
- std::cout << int(q.value()) << " " << int(r.value()) << std::endl;
- mln_assertion(q == r);
-
+ r = a * b / 256;
}
}
+ // FIXME : division
}
Index: trunk/milena/tests/value/graylevel_f_full.cc
===================================================================
--- trunk/milena/tests/value/graylevel_f_full.cc (revision 0)
+++ trunk/milena/tests/value/graylevel_f_full.cc (revision 1620)
@@ -0,0 +1,102 @@
+// Copyright (C) 2006, 2007 EPITA Research and Development Laboratory
+//
+// 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/value/graylevel_f_full.cc
+ *
+ * \brief Full tests on mln::value::graylevel_f.
+ */
+
+#include <mln/value/graylevel.hh>
+#include <mln/value/glf.hh>
+#include <mln/value/gl8.hh>
+#include <mln/value/gl16.hh>
+#include <mln/literal/all.hh>
+
+
+int main()
+{
+ using namespace mln;
+ using value::glf;
+ using value::gl8;
+ using value::gl16;
+ using value::graylevel;
+
+ using literal::black;
+ using literal::medium_gray;
+ using literal::white;
+
+ // Constructions
+ {
+ glf a;
+
+ glf b = 0.42;
+ mln_assertion(b.value() == 0.42f);
+
+ glf c = 0.42;
+ mln_assertion(c.value() == 0.42f);
+
+ glf d = c;
+ mln_assertion(d.value() == 0.42f);
+
+ glf e = 0;
+ mln_assertion(e.value() == 0.f);
+
+ graylevel<24> f = mlc_pow_int(2, 24) - 1;
+ glf g = f;
+ mln_assertion(g.value() == 1.f);
+
+ graylevel<24> h = 0;
+ glf i = h;
+ mln_assertion(i.value() == 0.f);
+ }
+
+ // Literals
+ {
+ glf a(white);
+ mln_assertion(a == white);
+ mln_assertion(a.value() == 1.f);
+ glf d = white;
+ mln_assertion(d == white);
+ mln_assertion(d.value() == 1.f);
+
+ glf b(black);
+ mln_assertion(b == black);
+ mln_assertion(b.value() == 0.f);
+ glf e = black;
+ mln_assertion(e == black);
+ mln_assertion(e.value() == 0.f);
+
+ glf c(medium_gray);
+ mln_assertion(c == medium_gray);
+ mln_assertion(c.value() == 0.5f);
+ glf f = medium_gray;
+ mln_assertion(f == medium_gray);
+ mln_assertion(f.value() == 0.5f);
+ }
+
+ // FIXME : addition, multiplication, division.
+}
Index: trunk/milena/tests/value/graylevel.cc
===================================================================
--- trunk/milena/tests/value/graylevel.cc (revision 0)
+++ trunk/milena/tests/value/graylevel.cc (revision 1620)
@@ -0,0 +1,87 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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/value/graylevel.cc
+ *
+ * \brief Tests on mln::value::graylevel. Tests operations between
+ * graylevel of different encodings.
+ *
+ */
+
+#include <mln/value/gl8.hh>
+#include <mln/value/gl16.hh>
+#include <mln/value/int_u8.hh>
+
+#include <mln/literal/black.hh>
+#include <mln/literal/white.hh>
+
+
+
+int main()
+{
+ using namespace mln::value;
+
+ using mln::literal::white;
+ using mln::literal::black;
+
+ gl8 a(white);
+ gl8 b(white);
+
+ a = b;
+ mln_assertion(a == b);
+
+ {
+ gl8 a(10);
+ gl8 b(10);
+
+ gl8 c = a + b;
+ }
+ {
+ gl8 a(white);
+ gl8 b(white);
+ gl8 c;
+ c = (a + b) / 2;
+
+ mln_assertion(c == white);
+ mln_assertion(c.value() == 255);
+
+ c = a;
+ mln_assertion(c == white);
+
+ c = (a * 2) / 2;
+ mln_assertion(c == white);
+
+ c = c / 6;
+ }
+
+ {
+ gl8 c = white;
+ mln_assertion(c == white);
+ mln_assertion(c.value() == float(255));
+ }
+
+}
Index: trunk/milena/mln/trait/value_.hh
===================================================================
--- trunk/milena/mln/trait/value_.hh (revision 1619)
+++ trunk/milena/mln/trait/value_.hh (revision 1620)
@@ -45,8 +45,11 @@
# define mln_trait_value_nature(V) typename mln::trait::value_< V >::nature
+# define mln_trait_value_nature_(V) mln::trait::value_< V >::nature
# define mln_trait_value_kind(V) typename mln::trait::value_< V >::kind
+# define mln_trait_value_kind_(V) mln::trait::value_< V >::kind
# define mln_trait_value_quant(V) typename mln::trait::value_< V >::quant
+# define mln_trait_value_quant_(V) mln::trait::value_< V >::quant
# define mln_nbits(V) mln::trait::value_< V >::nbits
Index: trunk/milena/mln/core/fi_adaptor.hh
===================================================================
--- trunk/milena/mln/core/fi_adaptor.hh (revision 1619)
+++ trunk/milena/mln/core/fi_adaptor.hh (revision 1620)
@@ -244,7 +244,7 @@
data_< fi_adaptor<I> >::sync_with_adaptee_()
{
mln_precondition(fi_ima_.isValid());
- mln_precondition(fi_ima_.getBitsPerPixel() == 8 * sizeof(mln_value(I)));
+ //FIXME: doesnt work for rgb: mln_precondition(fi_ima_.getBitsPerPixel() == 8 * sizeof(mln_value(I)));
deallocate_();
b_ = make::box2d(fi_ima_.getHeight(),
Index: trunk/milena/mln/metal/math/max.hh
===================================================================
--- trunk/milena/mln/metal/math/max.hh (revision 1619)
+++ trunk/milena/mln/metal/math/max.hh (revision 1620)
@@ -36,6 +36,8 @@
# include <mln/metal/bool.hh>
# include <mln/metal/int.hh>
+# define mlc_max(X, Y) typename mln::metal::math::max< X, Y >::ret
+# define mlc_max_int(x, y) mln::metal::math::max_int< x, y >::value
namespace mln
{
Index: trunk/milena/mln/accu/count.hh
===================================================================
--- trunk/milena/mln/accu/count.hh (revision 1619)
+++ trunk/milena/mln/accu/count.hh (revision 1620)
@@ -58,6 +58,7 @@
count_();
void init();
+ // FIXME : should we add a take() without argument?
void take(const argument&);
void take(const count_<T>& other);
Index: trunk/milena/mln/value/gray.hh (deleted)
===================================================================
Index: trunk/milena/mln/value/graylevel.hh
===================================================================
--- trunk/milena/mln/value/graylevel.hh (revision 1619)
+++ trunk/milena/mln/value/graylevel.hh (revision 1620)
@@ -39,11 +39,12 @@
# include <mln/core/contract.hh>
# include <mln/metal/math/pow.hh>
+# include <mln/metal/math/max.hh>
# include <mln/metal/bexpr.hh>
# include <mln/literal/ops.hh>
# include <mln/value/int_u.hh>
-# include <mln/value/gray.hh>
+# include <mln/value/internal/gray_.hh>
# include <mln/trait/value_.hh>
@@ -60,8 +61,9 @@
}
namespace value
{
+
/// \{ Fwd decls.
- class gray;
+ class gray_;
template <unsigned n> struct graylevel;
struct float01_f;
/// \}
@@ -71,36 +73,38 @@
namespace trait
{
- // FIXME: Change into
- // - for op::plus: mln::value::graylevel<1 + (n > m ? n : m)>
- // - for op::times: mln::value::graylevel<n + m>
- // - ...
template < unsigned n, unsigned m >
struct set_precise_binary_< op::plus, mln::value::graylevel<n>, mln::value::graylevel<m> >
{
- typedef mln::value::gray ret;
+ typedef mln::value::internal::gray_< mlc_max_int(n, m) > ret;
};
template < unsigned n, unsigned m >
struct set_precise_binary_< op::minus, mln::value::graylevel<n>, mln::value::graylevel<m> >
{
- typedef mln::value::gray ret;
+ typedef mln::value::internal::gray_< mlc_max_int(m, n) > ret;
};
template < unsigned n, unsigned m >
struct set_precise_binary_< op::times, mln::value::graylevel<n>, mln::value::graylevel<m> >
{
- typedef mln::value::gray ret;
+ typedef mln::value::internal::gray_<mlc_max_int(m, n)> ret;
};
+ template < unsigned n, unsigned m >
+ struct set_precise_binary_< op::div, mln::value::graylevel<n>, mln::value::graylevel<m> >
+ {
+ // FIXME : correct?
+ typedef mln::value::internal::gray_< mlc_max_int(m, n) > ret;
+ };
template < unsigned n, typename I >
struct set_binary_< op::times,
mln::value::Integer, mln::value::graylevel<n>,
mln::value::Integer, I >
{
- typedef mln::value::gray ret;
+ typedef mln::value::internal::gray_<n> ret;
};
template < typename I, unsigned n >
@@ -108,7 +112,7 @@
mln::value::Integer, I,
mln::value::Integer, mln::value::graylevel<n> >
{
- typedef mln::value::gray ret;
+ typedef mln::value::internal::gray_<n> ret;
};
@@ -117,7 +121,7 @@
mln::value::Integer, mln::value::graylevel<n>,
mln::value::Floating, F >
{
- typedef float ret;
+ typedef mln::value::internal::gray_f ret;
};
template < typename F, unsigned n >
@@ -125,7 +129,7 @@
mln::value::Floating, F,
mln::value::Integer, mln::value::graylevel<n> >
{
- typedef float ret;
+ typedef mln::value::internal::gray_f ret;
};
@@ -134,7 +138,7 @@
{
typedef mln_value_equiv(S) E;
typedef mlc_equal(E, float) is_float; // FIXME: Or double...
- typedef mlc_if(is_float, float, mln::value::gray) ret;
+ typedef mlc_if(is_float, float, mln::value::internal::gray_<n>) ret;
};
template < unsigned n, typename S >
@@ -144,7 +148,6 @@
mln::value::scalar_<S>) ret;
};
-
// 'graylevel<n>' as a value.
template <unsigned n>
@@ -178,6 +181,62 @@
{
/// General gray-level class on n bits.
+
+ // Return types of the operators +-*/.
+
+ // Operators + - return the interoperability type to allow
+ // operations like (gl8(255) + gl8(255)) / 2. + - with int and
+ // float are not allowed.
+
+ // If you really need to act with the value
+ // of the gray_<n> (the encoding). use the to_enc() method.
+ //
+
+ // |--------------------------------------------|
+ // | + || gl | glf |gray_i | int | float |
+ // |============================================|
+ // |gl ||gray_i|gray_f |gray_i | X | X |
+ // |--------------------------------------------|
+ // |glf || |gray_f |gray_f | X | X |
+ // |--------------------------------------------|
+ // |gray|| |gray_i | X | X |
+ // |--------------------------------------------|
+
+ // |--------------------------------------------|
+ // | - || gl | glf |gray_i | int | float |
+ // |============================================|
+ // |gl ||gray_i|gray_f |gray_i | X | X |
+ // |--------------------------------------------|
+ // |glf || |gray_f |gray_f | X | X |
+ // |--------------------------------------------|
+ // |gray|| |gray_i | X | X |
+ // |--------------------------------------------|
+
+ // |--------------------------------------------|
+ // | * || gl | glf |gray_i | int | float |
+ // |============================================|
+ // |gl ||gray_i|gray_f |gray_i |gray_i |gray_f |
+ // |--------------------------------------------|
+ // |glf || |gray_f |gray_f |gray_f |gray_f |
+ // |--------------------------------------------|
+ // |gray|| |gray_i |gray_i |gray_f |
+ // |--------------------------------------------|
+
+ // |--------------------------------------------|
+ // | / || gl | glf |gray_i | int | float |
+ // |============================================|
+ // |gl ||gray_i|gray_f |gray_i |gray_i |gray_i |
+ // |--------------------------------------------|
+ // |glf || |gray_f |gray_f |gray_f |gray_f |
+ // |--------------------------------------------|
+ // |gray|| |gray_i |gray_i |gray_f |
+ // |--------------------------------------------|
+
+ /// Valid convertions :
+ // glf -> gl (round)
+ // gl -> gray_i
+ // gray_i-> gl
+
template <unsigned n>
struct graylevel
:
@@ -185,38 +244,30 @@
public internal::value_like_< int_u<n>, // Equivalent.
mln_enc(int_u<n>), // Encoding.
- gray, // Interoperation.
+ internal::gray_<n>,// Interoperation.
graylevel<n> > // Exact.
{
/// Constructor without argument.
graylevel();
-
+ /// Copy constructor.
+ graylevel(const graylevel<n>& rhs);
+ /// Assigment.
+ graylevel<n>& operator=(const graylevel<n>& rhs);
/// Constructor from int.
graylevel(int val);
-
/// Assigment with int.
graylevel<n>& operator=(int val);
-
- /// Constructor from gray.
- graylevel(const gray& rhs);
-
- /// Assigment with gray.
- graylevel<n>& operator=(const gray& rhs);
-
-
- /// Copy constructor.
- graylevel(const graylevel<n>& rhs);
-
- /// Assigment.
- graylevel<n>& operator=(const graylevel<n>& rhs);
+ /// Constructor from graylevel_f.
+ graylevel(const graylevel_f& rhs);
+ /// Assigment with graylevel_f.
+ graylevel<n>& operator=(const graylevel_f& rhs);
/// Constructor from any graylevel.
template <unsigned m>
graylevel(const graylevel<m>& rhs);
-
/// Assigment with any graylevel.
template <unsigned m>
graylevel<n>& operator=(const graylevel<m>& rhs);
@@ -229,11 +280,12 @@
graylevel(const literal::white_t&);
/// \}
+
/// Assigment with literals.
/// \{
- graylevel<n>& operator=(const literal::white_t&);
- graylevel<n>& operator=(const literal::medium_gray_t&);
graylevel<n>& operator=(const literal::black_t&);
+ graylevel<n>& operator=(const literal::medium_gray_t&);
+ graylevel<n>& operator=(const literal::white_t&);
/// \}
@@ -266,49 +318,46 @@
template <unsigned n>
std::ostream& operator<<(std::ostream& ostr, const graylevel<n>& g);
-
- /// Aliases.
- typedef graylevel<8> gl8;
- typedef graylevel<16> gl16;
- typedef graylevel<32> gl32;
-
-
-
+ // graylevel<n> + graylevel<m>
template <unsigned n, unsigned m>
- gray
+ mln_trait_op_plus(graylevel<n>, graylevel<m>)
operator+(const graylevel<n>& lhs, const graylevel<m>& rhs);
+ // graylevel<n> - graylevel<m>
template <unsigned n, unsigned m>
- gray
+ mln_trait_op_minus(graylevel<n>, graylevel<m>)
operator-(const graylevel<n>& lhs, const graylevel<m>& rhs);
+ // graylevel<n> * graylevel<m>
template <unsigned n, unsigned m>
- gray
+ mln_trait_op_times(graylevel<n>, graylevel<m>)
operator*(const graylevel<n>& lhs, const graylevel<m>& rhs);
// With Integer.
+ // graylevel<n> * Integer<I>
template <unsigned n, typename I>
- gray
+ mln_trait_op_times(graylevel<n>, Integer<I>)
operator*(const graylevel<n>& lhs, const Integer<I>& rhs);
+ // Integer<I> * graylevel<n>
template <typename I, unsigned n>
- gray
+ mln_trait_op_times(Integer<I>, graylevel<n>)
operator*(const Integer<I>& lhs, const graylevel<n>& rhs);
// With Floating.
+ // graylevel<n> * Floating<F>
template <unsigned n, typename F>
- float
+ mln_trait_op_times(graylevel<n>, Floating<F>)
operator*(const graylevel<n>& lhs, const Floating<F>& rhs);
+ // Floating<F>, graylevel<n>
template <typename F, unsigned n>
- float
+ mln_trait_op_times(Floating<F>, graylevel<n>)
operator*(const Floating<F>& lhs, const graylevel<n>& rhs);
-
-
# ifndef MLN_INCLUDE_ONLY
// Graylevel<n>.
@@ -341,25 +390,6 @@
return *this;
}
-
- template <unsigned n>
- inline
- graylevel<n>::graylevel(const gray& g)
- {
- gray tmp = g.to_nbits(n);
- this->v_ = tmp.value();
- }
-
- template <unsigned n>
- inline
- graylevel<n>&
- graylevel<n>::operator=(const gray& g)
- {
- gray tmp = g.to_nbits(n);
- this->v_ = tmp.value();
- return *this;
- }
-
template <unsigned n>
inline
graylevel<n>::graylevel(const graylevel<n>& rhs)
@@ -381,7 +411,7 @@
inline
graylevel<n>::graylevel(const graylevel<m>& rhs)
{
- *this = gray(rhs).to_nbits(n);
+ *this = internal::gray_<m>(rhs);
}
template <unsigned n>
@@ -390,7 +420,7 @@
graylevel<n>&
graylevel<n>::operator=(const graylevel<m>& rhs)
{
- *this = gray(rhs).to_nbits(n);
+ *this = internal::gray_<m>(rhs);
return *this;
}
@@ -427,6 +457,7 @@
return *this;
}
+
template <unsigned n>
inline
graylevel<n>::graylevel(const literal::white_t&)
@@ -443,7 +474,6 @@
return *this;
}
-
template <unsigned n>
inline
unsigned
@@ -494,7 +524,7 @@
return ostr << g.value() << "/gl" << n; // FIXME: Be more explicit!
}
- // The remaining operators are in mln/value/gray.hh.
+ // The remaining operators are in mln/value/internal/gray_.hh.
# endif // ! MLN_INCLUDE_ONLY
Index: trunk/milena/mln/value/graylevel_f.hh
===================================================================
--- trunk/milena/mln/value/graylevel_f.hh (revision 0)
+++ trunk/milena/mln/value/graylevel_f.hh (revision 1620)
@@ -0,0 +1,299 @@
+// Copyright (C) 2006, 2007 EPITA Research and Development Laboratory
+//
+// 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_VALUE_GRAYLEVEL_F_HH
+# define MLN_VALUE_GRAYLEVEL_F_HH
+
+/*! \file mln/value/graylevel_f.hh
+ *
+ * \brief Definition of the mln::value::graylevel_f class.
+ */
+
+# include <iostream>
+
+# include <mln/value/ops.hh>
+
+# include <mln/core/contract.hh>
+# include <mln/metal/math/pow.hh>
+# include <mln/metal/bexpr.hh>
+# include <mln/literal/ops.hh>
+
+# include <mln/value/float01_f.hh>
+# include <mln/value/internal/gray_.hh>
+# include <mln/trait/value_.hh>
+
+
+namespace mln
+{
+
+ namespace literal
+ {
+ /// \{ Fwd decls.
+ struct black_t;
+ struct medium_gray_t;
+ struct white_t;
+ /// \}
+ }
+ namespace value
+ {
+ /// \{ Fwd decls.
+ namespace internal {class gray_f; }
+ struct graylevel_f;
+ template <unsigned n> struct graylevel;
+ struct float01_f;
+ /// \}
+ }
+
+
+
+ namespace trait
+ {
+
+
+ template < template <class, class> class Name>
+ struct set_precise_binary_< Name, mln::value::graylevel_f, mln::value::graylevel_f >
+ {
+ typedef mln::value::internal::gray_f ret;
+ };
+
+ template <>
+ struct set_precise_binary_< op::greater, mln::value::graylevel_f, mln::value::graylevel_f >
+ {
+ typedef bool ret;
+ };
+
+ template <>
+ struct set_precise_binary_< op::eq, mln::value::graylevel_f, mln::value::graylevel_f >
+ {
+ typedef bool ret;
+ };
+
+ /// Forward declaration.
+ template <typename T> struct value_;
+
+ // 'graylevel_f' as a value.
+ template <>
+ struct value_<mln::value::graylevel_f>
+ {
+ private:
+ typedef mln::value::graylevel_f self_;
+ typedef mln::value::float01_f equiv_;
+
+ public:
+
+ enum {
+ nbits = mln_nbits(equiv_),
+ card = 0
+ };
+
+ typedef trait::value::nature::floating nature;
+ typedef trait::value::kind::gray kind;
+ typedef mln_trait_value_quant_(equiv_) quant;
+
+ static const equiv_ min() { return 0; }
+ static const equiv_ max() { return 1; }
+ static const equiv_ epsilon() { return mln_epsilon(equiv_); }
+
+ typedef float sum;
+ };
+
+ } // end of namespace mln::trait
+
+
+
+ namespace value
+ {
+
+ /// General gray-level class on n bits.
+ struct graylevel_f
+ :
+ public Floating< graylevel_f >,
+
+ public internal::value_like_< float01_f, // Equivalent.
+ mln_enc_(float01_f),// Encoding.
+ internal::gray_f, // Interoperation.
+ graylevel_f > // Exact.
+ {
+ /// Constructor without argument.
+ graylevel_f();
+ /// Copy constructor.
+ graylevel_f(const graylevel_f& rhs);
+ /// Assigment.
+ graylevel_f& operator=(const graylevel_f& rhs);
+
+
+ /// Constructor from float.
+ graylevel_f(float val);
+ /// Assigment with float.
+ graylevel_f& operator=(float val);
+
+ /// Constructor from graylevel.
+ template <unsigned n>
+ graylevel_f(const graylevel<n>& rhs);
+ /// Assigment with graylevel.
+ template <unsigned n>
+ graylevel_f& operator=(const graylevel<n>& rhs);
+
+ /// Ctors with literals.
+ /// \{
+ graylevel_f(const literal::black_t&);
+ graylevel_f(const literal::medium_gray_t&);
+ graylevel_f(const literal::white_t&);
+ /// \}
+
+ /// Assigment with literals.
+ /// \{
+ graylevel_f& operator=(const literal::black_t&);
+ graylevel_f& operator=(const literal::medium_gray_t&);
+ graylevel_f& operator=(const literal::white_t&);
+ /// \}
+
+ /// Access to std type.
+ float value() const;
+ };
+
+
+ // Operators.
+
+ /// Op<<.
+ std::ostream& operator<<(std::ostream& ostr, const graylevel_f& g);
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // graylevel_f.
+
+ inline
+ graylevel_f::graylevel_f()
+ {
+ }
+
+
+ inline
+ graylevel_f::graylevel_f(float val)
+ {
+ this->v_ = val;
+ }
+
+ inline
+ graylevel_f&
+ graylevel_f::operator=(float val)
+ {
+ this->v_ = val;
+ return *this;
+ }
+
+ template <unsigned n>
+ graylevel_f::graylevel_f(const graylevel<n>& rhs)
+ {
+ this->v_ = rhs.to_float();
+ }
+
+ template <unsigned n>
+ graylevel_f&
+ graylevel_f::operator=(const graylevel<n>& rhs)
+ {
+ this->v_ = rhs.to_float();
+ }
+
+ inline
+ graylevel_f::graylevel_f(const graylevel_f& rhs)
+ {
+ this->v_ = rhs.v_;
+ }
+
+ inline
+ graylevel_f&
+ graylevel_f::operator=(const graylevel_f& rhs)
+ {
+ this->v_ = rhs.v_;
+ return *this;
+ }
+
+ inline
+ graylevel_f::graylevel_f(const literal::black_t&)
+ {
+ this->v_ = 0.0f;
+ }
+
+ inline
+ graylevel_f&
+ graylevel_f::operator=(const literal::black_t&)
+ {
+ this->v_ = 0.0f;
+ return *this;
+ }
+
+ inline
+ graylevel_f::graylevel_f(const literal::medium_gray_t&)
+ {
+ this->v_ = 0.5f;
+ }
+
+ inline
+ graylevel_f&
+ graylevel_f::operator=(const literal::medium_gray_t&)
+ {
+ this->v_ = 0.5f;
+ return *this;
+ }
+
+ inline
+ graylevel_f::graylevel_f(const literal::white_t&)
+ {
+ this->v_ = 1.0f;
+ }
+
+ inline
+ graylevel_f&
+ graylevel_f::operator=(const literal::white_t&)
+ {
+ this->v_ = 1.0f;
+ return *this;
+ }
+
+ inline
+ float
+ graylevel_f::value() const
+ {
+ return this->v_;
+ }
+
+ // Operators.
+
+ inline
+ std::ostream& operator<<(std::ostream& ostr, const graylevel_f& g)
+ {
+ return ostr << g.value() << "/gl_f"; // FIXME: Be more explicit!
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln::value
+
+ } // end of namespace mln
+
+#endif // ! MLN_VALUE_GRAYLEVEL_F_HH
Index: trunk/milena/mln/value/glf.hh
===================================================================
--- trunk/milena/mln/value/glf.hh (revision 0)
+++ trunk/milena/mln/value/glf.hh (revision 1620)
@@ -0,0 +1,55 @@
+// Copyright (C) 2007 EPITA Research and Development Laboratory
+//
+// 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_VALUE_GLF_HH
+# define MLN_VALUE_GLF_HH
+
+/*! \file mln/value/glf.hh
+ *
+ * \brief Define the alias value::glf.
+ */
+
+# include <mln/value/graylevel_f.hh>
+
+
+namespace mln
+{
+
+ namespace value
+ {
+
+
+ /// Alias for 8 bit graylevel.
+ typedef graylevel_f glf;
+
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+
+#endif // ! MLN_VALUE_GLF_HH
Index: trunk/milena/mln/value/internal/gray_.hh
===================================================================
--- trunk/milena/mln/value/internal/gray_.hh (revision 0)
+++ trunk/milena/mln/value/internal/gray_.hh (revision 1620)
@@ -0,0 +1,633 @@
+// Copyright (C) 2006, 2007 EPITA Research and Development Laboratory
+//
+// 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_VALUE_INTERNAL_GRAY__HH
+# define MLN_VALUE_INTERNAL_GRAY__HH
+
+/*! \file mln/value/internal/gray_.hh
+ *
+ * \brief FIXME.
+ *
+ */
+
+# include <iostream>
+# include <cmath>
+
+# include <mln/metal/math/max.hh>
+# include <mln/metal/math/pow.hh>
+
+# include <mln/value/graylevel.hh>
+# include <mln/value/graylevel_f.hh>
+# include <mln/value/concept/integer.hh>
+
+
+namespace mln
+{
+
+ namespace literal
+ {
+ /// \{ Fwd decls.
+ struct black_t;
+ struct white_t;
+ /// \}
+ }
+
+ namespace value
+ {
+ /// \{ Fwd decls.
+ template <unsigned N> class graylevel;
+ class graylevel_f;
+ namespace internal { template <unsigned n> class gray_; }
+ /// \}
+ }
+
+
+ namespace trait
+ {
+
+ template < template <class, class> class Name, unsigned n, unsigned m>
+ struct set_precise_binary_< Name, mln::value::internal::gray_<n>, mln::value::internal::gray_<m> >
+ {
+ typedef mln::value::internal::gray_< mlc_max_int(n, m) > ret;
+ };
+
+ template <unsigned n, unsigned m>
+ struct set_precise_binary_< op::greater, mln::value::internal::gray_<n>, mln::value::internal::gray_<m> >
+ {
+ typedef bool ret;
+ };
+
+ template <unsigned n, unsigned m>
+ struct set_precise_binary_< op::eq, mln::value::internal::gray_<n>, mln::value::internal::gray_<m> >
+ {
+ typedef bool ret;
+ };
+
+ // 'gray_' as a value.
+
+ template <unsigned n>
+ struct value_< mln::value::internal::gray_<n> >
+ {
+ private:
+ typedef mln::value::internal::gray_<n> self_;
+ public:
+
+ enum {
+ nbits = 8 * (sizeof(unsigned) + sizeof(long)),
+ card = 0
+ };
+
+ typedef trait::value::nature::integer nature; // FIXME: Or scalar?
+ typedef trait::value::kind::gray kind;
+ typedef trait::value::quant::high quant;
+
+ static const self_ min();
+ static const self_ max();
+ static const self_ epsilon();
+
+ typedef self_ sum; // FIXME: OK?
+ };
+
+ } // end of namespace mln::trait
+
+
+
+ namespace value
+ {
+
+ namespace internal
+ {
+
+ /// \internal General gray-level class where n bits is not know at compile-time.
+ /// This class is used for exchange between gray-level types purpose.
+ template <unsigned n>
+ class gray_
+ :
+ public Integer< gray_<n> >,
+
+ public internal::value_like_< int, // Equivalent.
+ int, // Encoding.
+ gray_<n>, // Interoperation.
+ gray_<n> > // Exact.
+
+ {
+ public:
+
+ /// Encoding associated type.
+ typedef int enc;
+
+ /// Equivalent associated type.
+ typedef int equiv;
+
+ /// Constructor without argument.
+ gray_();
+ /// Constructor with int.
+ gray_(int val);
+
+ /// \{ Constructors/assignments with literals.
+ explicit gray_(const literal::white_t&);
+ explicit gray_(const literal::black_t&);
+ /// \}
+
+
+ /// \{ Constructors/assigments with graylevel.
+ template <unsigned m>
+ gray_(const graylevel<m>& val);
+ template <unsigned m>
+ gray_<n>& operator=(const graylevel<m>& val);
+ /// \}
+
+ /// Access to std type.
+ int value() const;
+
+ /// Return an equivalent gray_ encoded on \p nbits bits.
+ template <unsigned m>
+ operator gray_<m>() const;
+
+ /// Convertion to graylevel.
+ template <unsigned m>
+ operator graylevel<m>() const;
+
+ /// Convertion to graylevel_f.
+// operator graylevel_f() const;
+ };
+
+
+ // Operators.
+
+ template <unsigned n>
+ std::ostream& operator<<(std::ostream& ostr, const gray_<n>& g);
+
+ template <unsigned n, unsigned m>
+ bool operator==(const gray_<n>& lhs, const gray_<m>& rhs);
+ template <unsigned n, unsigned m>
+ bool operator<(const gray_<n>& lhs, const gray_<m>& rhs);
+
+ template <unsigned n, unsigned m>
+ mln_trait_op_plus(gray_<n>, gray_<m>)
+ operator+(const gray_<n>& lhs, const gray_<m>& rhs);
+
+ template <unsigned n, unsigned m>
+ mln_trait_op_minus(gray_<n>, gray_<m>)
+ operator-(const gray_<n>& lhs, const gray_<m>& rhs);
+
+ template <unsigned n>
+ gray_<n> operator*(int s, const gray_<n>& rhs);
+ template <unsigned n>
+ gray_<n> operator*(const gray_<n>& lhs, int s);
+ template <unsigned n>
+ gray_<n> operator/(const gray_<n>& lhs, int s);
+
+ } // end of namespace mln::value::internal
+
+} // end of namespace mln::value
+
+
+
+# ifndef MLN_INCLUDE_ONLY
+
+ namespace value
+ {
+ namespace internal
+ {
+
+ template <unsigned n_src, unsigned n_dest>
+ inline
+ long convert(int val)
+ {
+ using typename mln::metal::int_;
+ typedef mlc_max(int_<n_dest - n_src> , int_<n_src - n_dest>) m;
+
+ if (n_dest == n_src)
+ return val;
+ else
+ if (n_dest > n_src)
+ return val * mlc_pow_int(2, m::value);
+ else
+ return val / mlc_pow_int(2, m::value);
+ }
+
+ // Gray_<N>.
+
+ template <unsigned n>
+ inline
+ gray_<n>::gray_()
+ {
+ }
+
+ template <unsigned n>
+ template <unsigned m>
+ gray_<n>::gray_(const graylevel<m>& g)
+ {
+ this->v_ = convert<m, n>(g.value());
+ }
+
+ template <unsigned n>
+ template <unsigned m>
+ inline
+ gray_<n>&
+ gray_<n>::operator=(const graylevel<m>& g)
+ {
+ this->v_ = convert<m, n>(g.value());
+ return *this;
+ }
+
+ template <unsigned n>
+ inline
+ gray_<n>::gray_(const literal::white_t&)
+ {
+ this->v_ = mlc_pow_int(2, n) - 1;
+ }
+
+ template <unsigned n>
+ inline
+ gray_<n>::gray_(const literal::black_t&)
+ {
+ this->v_ = 0;
+ }
+
+ template <unsigned n>
+ inline
+ gray_<n>::gray_(int val)
+ {
+ this->v_ = val;
+ }
+
+ template <unsigned n>
+ inline
+ int
+ gray_<n>::value() const
+ {
+ return this->v_;
+ }
+
+ template <unsigned n>
+ template <unsigned m>
+ inline
+ gray_<n>::operator gray_<m>() const
+ {
+ return gray_<m>(convert<n, m>(this->v_));
+ }
+
+
+ template <unsigned n>
+ template <unsigned m>
+ inline
+ gray_<n>::operator graylevel<m>() const
+ {
+ graylevel<m> tmp(convert<n, m>(this->v_));
+ mln_assertion(tmp.value() < std::pow(2.f, int(m)));
+ return tmp;
+ }
+
+
+ // Operators.
+
+ template <unsigned n>
+ inline
+ std::ostream& operator<<(std::ostream& ostr, const gray_<n>& g)
+ {
+ return ostr << g.value() << "g/" << n << "bits";
+ }
+
+ template <unsigned n, unsigned m>
+ inline
+ bool operator==(const gray_<n>& lhs, const gray_<m>& rhs)
+ {
+ if (n == m)
+ return internal::gray_<mlc_max_int(n, m)>(lhs).value() ==
+ internal::gray_<mlc_max_int(n, m)>(rhs).value();
+ if (n > m)
+ {
+ gray_<n> down = rhs;
+ gray_<n> up(down.value() +
+ mlc_pow_int(2, m));
+ return (lhs.value() >= down.value() && lhs.value() < up.value());
+ }
+ else
+ {
+ gray_<m> down = lhs;
+ gray_<m> up(down.value() +
+ mlc_pow_int(2, n));
+ return (rhs.value() >= down.value() && rhs.value() < up.value());
+ }
+ }
+
+ template <unsigned n, unsigned m>
+ inline
+ bool operator<(const gray_<n>& lhs, const gray_<m>& rhs)
+ {
+ if (m == n)
+ return lhs.value() < rhs.value();
+ if (n > m)
+ return lhs.value() < gray_<n>(rhs).value();
+ else
+ return gray_<m>(lhs).value() < rhs.value();
+ }
+
+ template <unsigned n, unsigned m>
+ inline
+ mln_trait_op_plus(gray_<n>, gray_<m>)
+ operator+(const gray_<n>& lhs, const gray_<m>& rhs)
+ {
+ typedef mln_trait_op_plus(gray_<n>, gray_<m>) ret;
+ if (n > m)
+ {
+ ret tmp(ret(lhs).value() + ret(rhs).value());
+ return tmp;
+ }
+ else
+ {
+ ret tmp(ret(lhs).value() + ret(rhs).value());
+ return tmp;
+ }
+ }
+
+ template <unsigned n, unsigned m>
+ inline
+ mln_trait_op_minus(gray_<n>, gray_<m>)
+ operator-(const gray_<n>& lhs, const gray_<m>& rhs)
+ {
+ typedef mln_trait_op_minus(gray_<n>, gray_<m>) ret;
+
+
+ if (lhs == rhs)
+ return ret(0);
+ if (n == m)
+ return ret(lhs.value() - rhs.value());
+ if (n > m)
+ {
+ ret l = rhs;
+ mln_assertion(lhs.value() >= l.value());
+ ret tmp(lhs.value() - l.value());
+ return tmp;
+ }
+ else
+ {
+ ret l = lhs;
+ mln_assertion(l.value() >= rhs.value());
+ ret tmp(l.value() - rhs.value());
+ return tmp;
+ }
+ }
+
+ template <unsigned n, unsigned m>
+ inline
+ mln_trait_op_times(gray_<n>, gray_<m>)
+ operator*(const gray_<n>& lhs, const gray_<m>& rhs)
+ {
+ typedef mln_trait_op_times(gray_<n>, gray_<m>) ret;
+
+ return ret(ret(lhs).value() * ret(rhs).value());
+ }
+
+ template <unsigned n>
+ inline
+ gray_<n> operator*(int s, const gray_<n>& rhs)
+ {
+ gray_<n> tmp(rhs.value() * s);
+ return tmp;
+ }
+
+ template <unsigned n>
+ inline
+ gray_<n> operator*(const gray_<n>& lhs, int s)
+ {
+ gray_<n> tmp(lhs.value() * s);
+ return tmp;
+ }
+
+ template <unsigned n>
+ inline
+ gray_<n> operator/(const gray_<n>& lhs, int s)
+ {
+ mln_precondition(s != 0);
+ gray_<n> tmp(lhs.value() / s);
+ return tmp;
+ }
+
+ } // end of namespace mln::value::internal
+
+ // Graylevel operators.
+
+ // Op gl == Int
+
+ template <typename I, unsigned n>
+ inline
+ bool
+ operator==(const Integer<I>& lhs, const graylevel<n>& rhs)
+ {
+ return rhs.value() == exact(lhs);
+ }
+
+ // Op gl == gl
+
+ template <unsigned n, unsigned m>
+ inline
+ bool
+ operator==(const graylevel<n>& lhs, const graylevel<m>& rhs)
+ {
+ return internal::gray_<n>(rhs) == internal::gray_<m>(lhs);
+ }
+
+ // Op gl + gl
+
+ template <unsigned n, unsigned m>
+ inline
+ mln_trait_op_plus(graylevel<n>, graylevel<m>)
+ operator+(const graylevel<n>& lhs, const graylevel<m>& rhs)
+ {
+ return internal::gray_<n>(lhs) + internal::gray_<m>(rhs);
+ }
+
+ // Op gl - gl
+
+ template <unsigned n, unsigned m>
+ inline
+ mln_trait_op_minus(graylevel<n>, graylevel<m>)
+ operator-(const graylevel<n>& lhs, const graylevel<m>& rhs)
+ {
+ return internal::gray_<n>(lhs) - internal::gray_<m>(rhs);
+ }
+
+ // Op gl * gl
+
+ template <unsigned n, unsigned m>
+ inline
+ mln_trait_op_times(graylevel<n>, graylevel<m>)
+ operator*(const graylevel<n>& lhs, const graylevel<m>& rhs)
+ {
+ return internal::gray_<n>(lhs) * internal::gray_<m>(rhs);
+ }
+
+ // Op symm gl * Int
+
+ template <unsigned n, typename I>
+ inline
+ mln_trait_op_times(graylevel<n>, Integer<I>)
+ operator*(const graylevel<n>& lhs, const Integer<I>& rhs)
+ {
+ return internal::gray_<n>(lhs) * int(exact(rhs));
+ }
+
+ template <typename I, unsigned n>
+ inline
+ mln_trait_op_times(Integer<I>, graylevel<n>)
+ operator*(const Integer<I>& lhs, const graylevel<n>& rhs)
+ {
+ return internal::gray_<n>(rhs) * int(exact(lhs));
+ }
+
+ // Op symm gl * Float
+
+ template <unsigned n, typename F>
+ inline
+ mln_trait_op_times(graylevel<n>, Floating<F>)
+ operator*(const graylevel<n>& lhs, const Floating<F>& rhs)
+ {
+ return lhs.to_float() * exact(rhs);
+ }
+
+ template <typename F, unsigned n>
+ inline
+ mln_trait_op_times(Floating<F>, graylevel<n>)
+ operator*(const Floating<F>& lhs, const graylevel<n>& rhs)
+ {
+ return rhs.to_float() * exact(lhs);
+ }
+
+
+
+ // Op * scalar
+
+ namespace internal
+ {
+
+ template <typename ret>
+ struct helper_gray__op_;
+
+ template <unsigned n>
+ struct helper_gray__op_< gray_<n> >
+ {
+ template <unsigned m, typename S>
+ inline
+ static gray_<n> times(const graylevel<m>& lhs, const scalar_<S>& rhs)
+ {
+ gray_<n> tmp(lhs.value() * rhs.to_equiv());
+ return tmp;
+ }
+ template <unsigned m, typename S>
+ inline
+ static gray_<n> div(const graylevel<m>& lhs, const scalar_<S>& rhs)
+ {
+ gray_<n> tmp(lhs.value() / rhs.to_equiv());
+ return tmp;
+ }
+ };
+
+ template <>
+ struct helper_gray__op_< float >
+ {
+ template <unsigned n, typename S>
+ inline
+ static float times(const graylevel<n>& lhs, const scalar_<S>& rhs)
+ {
+ float tmp(lhs.to_float() * float(rhs.to_equiv()));
+ return tmp;
+ }
+ template <unsigned n, typename S>
+ inline
+ static float div(const graylevel<n>& lhs, const scalar_<S>& rhs)
+ {
+ float tmp(lhs.to_float() / float(rhs.to_equiv()));
+ return tmp;
+ }
+ };
+
+ } // end of namespace mln::value::internal
+
+ template <unsigned n, typename S>
+ inline
+ mln_trait_op_times(graylevel<n>, scalar_<S>)
+ operator*(const graylevel<n>& lhs, const scalar_<S>& rhs)
+ {
+ typedef mln_trait_op_times(graylevel<n>, scalar_<S>) ret;
+ return internal::helper_gray__op_<ret>::times(lhs, rhs);
+ }
+
+ template <unsigned n, typename S>
+ inline
+ mln_trait_op_div(graylevel<n>, scalar_<S>)
+ operator/(const graylevel<n>& lhs, const scalar_<S>& rhs)
+ {
+ mln_precondition(rhs.to_equiv() != 0);
+ typedef mln_trait_op_div(graylevel<n>, scalar_<S>) ret;
+ return internal::helper_gray__op_<ret>::div(lhs, rhs);
+ }
+
+ } // end of namespace mln::value
+
+
+
+namespace trait
+{
+
+ // 'gray_<n>' as a value.
+
+ template <unsigned n>
+ inline
+ const mln::value::internal::gray_<n>
+ value_< mln::value::internal::gray_<n> >::min()
+ {
+ return mln::value::internal::gray_<n>(1, 0);
+ }
+
+ template <unsigned n>
+ inline
+ const mln::value::internal::gray_<n>
+ value_< mln::value::internal::gray_<n> >::max()
+ {
+ return mln::value::internal::gray_<n>(1, 1);
+ }
+
+ template <unsigned n>
+ inline
+ const mln::value::internal::gray_<n>
+ value_< mln::value::internal::gray_<n> >::epsilon()
+ {
+ return mln::value::internal::gray_<n>(1, 0); // Means '0'.
+ }
+
+} // end of namespace mln::trait
+
+
+# endif // ! MLN_INCLUDE_ONLY
+
+} // end of namespace mln
+
+
+#endif // ! MLN_INTERNAL_VALUE_GRAY__HH
Index: trunk/milena/mln/value/internal/gray_f.hh
===================================================================
--- trunk/milena/mln/value/internal/gray_f.hh (revision 0)
+++ trunk/milena/mln/value/internal/gray_f.hh (revision 1620)
@@ -0,0 +1,273 @@
+// Copyright (C) 2006, 2007 EPITA Research and Development Laboratory
+//
+// 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_VALUE_INTERNAL_GRAY_F_HH
+# define MLN_VALUE_INTERNAL_GRAY_F_HH
+
+/*! \file mln/value/internal/gray_f.hh
+ *
+ * \brief Definition of the mln::value::gray_f class.
+ */
+
+# include <iostream>
+
+# include <mln/value/ops.hh>
+
+# include <mln/core/contract.hh>
+# include <mln/metal/math/pow.hh>
+# include <mln/math/two_pow.hh>
+# include <mln/metal/bexpr.hh>
+# include <mln/literal/ops.hh>
+
+# include <mln/value/float01_f.hh>
+# include <mln/value/gray.hh>
+# include <mln/trait/value_.hh>
+
+
+namespace mln
+{
+
+ namespace literal
+ {
+ /// \{ Fwd decls.
+ struct black_t;
+ struct medium_gray_t;
+ struct white_t;
+ /// \}
+ }
+ namespace value
+ {
+ /// \{ Fwd decls.
+ class gray;
+ struct gray_f;
+ struct float01_f;
+ /// \}
+ }
+
+
+
+ namespace trait
+ {
+
+
+ template < template <class, class> class Name>
+ struct set_precise_binary_< Name, mln::value::gray_f, mln::value::gray_f >
+ {
+ typedef mln::value::gray_f ret;
+ };
+
+ struct set_precise_binary_< op::greater, mln::value::gray_f, mln::value::gray_f >
+ {
+ typedef bool ret;
+ };
+
+ struct set_precise_binary_< op::eq, mln::value::gray_f, mln::value::gray_f >
+ {
+ typedef bool ret;
+ };
+
+ // Nessecary??
+// template <typename F>
+// struct set_binary_< op::eq,
+// mln::value::Floating, mln::value::gray_f,
+// mln::value::Floating, F >
+// {
+// typedef bool ret;
+// };
+
+ /// Forward declaration.
+ template <typename T> struct value_;
+
+ // 'gray_f' as a value.
+ template <>
+ struct value_<mln::value::gray_f>
+ {
+ private:
+ typedef mln::value::gray_f self_;
+ typedef float equiv_;
+
+ public:
+
+ enum {
+ nbits = mln_nbits(equiv_),
+ card = 0
+ };
+
+ typedef trait::value::nature::floating nature;
+ typedef trait::value::kind::gray kind;
+ typedef mln_trait_value_quant_(equiv_) quant;
+
+ static const equiv_ min() { return 0; }
+ static const equiv_ max() { return 1; }
+ static const equiv_ epsilon() { return mln_epsilon(equiv_); }
+
+ typedef float sum;
+ };
+
+ } // end of namespace mln::trait
+
+
+
+ namespace value
+ {
+
+ namespace internal
+ {
+
+ /// \internal General gray-level class on n bits.
+ struct gray_f
+ :
+ public Floating< gray_f >,
+
+ public internal::value_like_< float, // Equivalent.
+ float, // Encoding.
+ gray_f, // Interoperation.
+ gray_f > // Exact.
+ {
+ /// Constructor without argument.
+ gray_f();
+
+ /// \{ Constructors/assigments with gray_f.
+ gray_f(const gray_f& rhs);
+ gray_f& operator=(const gray_f& rhs);
+ /// \}
+
+ /// \{ Constructors/assigments with float.
+ gray_f(float val);
+ gray_f& operator=(float val);
+ /// \}
+
+ /// \{ Constructors/assigments with graylevel_f.
+ gray_f(const graylevel_f& val);
+ gray_f& operator=(const graylevel_f& val);
+ /// \}
+
+ /// Convertion to graylevel<n>
+ template <unsigned m>
+ operator graylevel<m>() const;
+
+ /// Convertion to graylevel_f
+ operator graylevel_f() const;
+
+ /// Access to std type.
+ float value() const;
+ };
+
+ // Operators.
+
+ /// \internal Op<<.
+ std::ostream& operator<<(std::ostream& ostr, const gray_f& g);
+
+# ifndef MLN_INCLUDE_ONLY
+
+ // gray_f.
+
+ inline
+ gray_f::gray_f()
+ {
+ }
+
+ inline
+ gray_f::gray_f(const gray_f& g)
+ : v_(g.v_)
+ {
+ }
+
+ inline
+ gray_f&
+ gray_f::operator=(const gray_f& g)
+ {
+ this->v_ = g.v_;
+ return *this;
+ }
+
+ inline
+ gray_f::gray_f(float val)
+ {
+ this->v_ = val;
+ }
+
+ inline
+ gray_f&
+ gray_f::operator=(float val)
+ {
+ this->v_ = val;
+ return *this;
+ }
+
+ inline
+ gray_f&
+ gray_f::gray_f(const graylevel_f& rhs)
+ : v_(rhs.v_)
+ {
+ }
+
+ inline
+ gray_f&
+ gray_f::gray_f& operator=(const graylevel_f& rhs)
+ {
+ this->v_ = rhs.v_;
+ return *this;
+ }
+
+ template <unsigned m>
+ inline
+ gray_f::operator graylevel<m>() const
+ {
+ return graylevel<m>(round(this->v_ * (mlc_pow_int(2, m) - 1)));
+ }
+
+ inline
+ gray_f::operator graylevel_f() const
+ {
+ return graylevel_f(this->v_);
+ }
+
+ inline
+ float
+ gray_f::value() const
+ {
+ return this->v_;
+ }
+
+ // Operators.
+
+ inline
+ std::ostream& operator<<(std::ostream& ostr, const gray_f& g)
+ {
+ return ostr << g.value() << "/gl_f"; // FIXME: Be more explicit!
+ }
+
+# endif // ! MLN_INCLUDE_ONLY
+
+ } // end of namespace mln::value::internal
+
+ } // end of namespace mln::value
+
+} // end of namespace mln
+
+#endif // ! MLN_VALUE_GRAY_F_HH
1
0
URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2007-12-19 Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr>
Add briefs to fill out user documentation.
* mln/accu/bbox.hh,
* mln/accu/compute.hh,
* mln/accu/count.hh,
* mln/accu/histo.hh,
* mln/accu/max.hh,
* mln/accu/max_h.hh,
* mln/accu/mean.hh,
* mln/accu/median.hh,
* mln/accu/median_alt.hh,
* mln/accu/min.hh,
* mln/accu/min_h.hh,
* mln/accu/min_max.hh,
* mln/accu/nil.hh,
* mln/accu/p.hh,
* mln/accu/pair.hh,
* mln/accu/sum.hh,
* mln/accu/take.hh,
* mln/accu/v.hh,
* mln/core/concept/function.hh,
* mln/core/mesh_window_piter.hh,
* mln/fun/v2v/linear.hh,
* mln/trait/promote.hh,
* mln/util/ordpair.hh,
* mln/value/lut_vec.hh,
* mln/value/set.hh: Fix briefs of structures/classes of these files.
* doc/Makefile.am: Remove the generation of the TODO list in user
documentation.
---
doc/Makefile.am | 1
mln/accu/bbox.hh | 2 -
mln/accu/compute.hh | 13 +++++++-
mln/accu/count.hh | 9 ++++-
mln/accu/histo.hh | 4 +-
mln/accu/max.hh | 6 ++-
mln/accu/max_h.hh | 2 -
mln/accu/mean.hh | 7 ++--
mln/accu/median.hh | 4 +-
mln/accu/median_alt.hh | 4 +-
mln/accu/min.hh | 6 ++-
mln/accu/min_h.hh | 4 +-
mln/accu/min_max.hh | 2 -
mln/accu/nil.hh | 8 +++--
mln/accu/p.hh | 8 +++--
mln/accu/pair.hh | 8 ++---
mln/accu/sum.hh | 6 ++-
mln/accu/take.hh | 2 -
mln/accu/v.hh | 8 +++--
mln/core/concept/function.hh | 66 +++++++++++++++++++++++++++++++-----------
mln/core/mesh_window_piter.hh | 9 +++--
mln/fun/v2v/linear.hh | 5 +--
mln/trait/promote.hh | 8 +++--
mln/util/ordpair.hh | 9 +++--
mln/value/lut_vec.hh | 2 -
mln/value/set.hh | 4 +-
26 files changed, 139 insertions(+), 68 deletions(-)
Index: trunk/milena/doc/Makefile.am
===================================================================
--- trunk/milena/doc/Makefile.am (revision 1618)
+++ trunk/milena/doc/Makefile.am (revision 1619)
@@ -32,6 +32,7 @@
-e 's,HIDE_FRIEND_COMPOUNDS = NO,HIDE_FRIEND_COMPOUNDS = YES,g' \
-e 's,HIDE_IN_BODY_DOCS = NO,HIDE_IN_BODY_DOCS = YES,g' \
-e 's,INTERNAL_DOCS = YES,INTERNAL_DOCS = NO,g' \
+ -e 's,GENERATE_TODOLIST = YES,GENERATE_TODOLIST = NO,g' \
-e 's,PROJECT_NUMBER = \",PROJECT_NUMBER = \"User documentation ,g'
EXTRA_DIST = Doxyfile.in
Index: trunk/milena/mln/trait/promote.hh
===================================================================
--- trunk/milena/mln/trait/promote.hh (revision 1618)
+++ trunk/milena/mln/trait/promote.hh (revision 1619)
@@ -61,9 +61,11 @@
};
- /// Default case when one type is involved twice: the promotion
- /// type is the same as the input type (so actually there is no
- /// promotion).
+ /*!
+ * \brief Default case when one type is involved twice: the
+ * promotion type is the same as the input type (so actually there
+ * is no promotion).
+ */
template <typename T>
struct set_binary_< promote, Object, T, Object, T >
{
Index: trunk/milena/mln/core/mesh_window_piter.hh
===================================================================
--- trunk/milena/mln/core/mesh_window_piter.hh (revision 1618)
+++ trunk/milena/mln/core/mesh_window_piter.hh (revision 1619)
@@ -28,9 +28,12 @@
#ifndef MLN_CORE_MESH_WINDOW_PITER_HH
# define MLN_CORE_MESH_WINDOW_PITER_HH
-// FIXME: Doc.
-
-// FIXME: Shall we rename `piter' as `qiter'?
+/*!
+ * \file mln/core/mesh_window_piter.hh
+ *
+ * \brief Definition of point iterator of mesh window.
+ *
+ */
# include <mln/core/concept/point_iterator.hh>
# include <mln/core/mesh_p.hh>
Index: trunk/milena/mln/core/concept/function.hh
===================================================================
--- trunk/milena/mln/core/concept/function.hh (revision 1618)
+++ trunk/milena/mln/core/concept/function.hh (revision 1619)
@@ -41,6 +41,7 @@
/// \{
/// Fwd decls.
+
template <typename E> struct Function;
template <typename E> struct Function_v2v;
template <typename E> struct Function_i2v;
@@ -85,8 +86,12 @@
template <>
struct Function_v2v<void> { typedef Function<void> super; };
- /// Base class for implementation of function-objects from value to
- /// value.
+ /*!
+ * \brief Base class for implementation of function-objects from
+ * value to value.
+ *
+ * The parameter \a E is the exact type.
+ */
template <typename E>
struct Function_v2v : public Function<E>
{
@@ -102,8 +107,13 @@
template <>
struct Function_i2v<void> { typedef Function_v2v<void> super; };
- /// Base class for implementation of function-objects from index to
- /// value.
+
+ /*!
+ * \brief Base class for implementation of function-objects from
+ * index to value.
+ *
+ * The parameter \a E is the exact type.
+ */
template <typename E>
struct Function_i2v : public Function_v2v<E>
{
@@ -119,8 +129,12 @@
template <>
struct Function_p2v<void> { typedef Function_v2v<void> super; };
- /// Base class for implementation of function-objects from point to
- /// value.
+ /*!
+ * \brief Base class for implementation of function-objects from point to
+ * value.
+ *
+ * The parameter \a E is the exact type.
+ */
template <typename E>
struct Function_p2v : public virtual Function_v2v<E>
{
@@ -136,8 +150,12 @@
template <>
struct Function_v2b<void> { typedef Function_v2v<void> super; };
- /// Base class for implementation of function-objects from value to
- /// bool.
+ /*!
+ * \brief Base class for implementation of function-objects from value to
+ * bool.
+ *
+ * The parameter \a E is the exact type.
+ */
template <typename E>
struct Function_v2b : public virtual Function_v2v<E>
{
@@ -154,8 +172,12 @@
template <>
struct Function_p2b<void> { typedef Function_p2v<void> super; }; // FIXME
- /// Base class for implementation of function-objects from point to
- /// bool.
+ /*!
+ * \brief Base class for implementation of function-objects from point to
+ * bool.
+ *
+ * The parameter \a E is the exact type.
+ */
template <typename E>
struct Function_p2b : public Function_p2v<E>,
public Function_v2b<E>
@@ -173,8 +195,12 @@
template <>
struct Function_p2p<void> { typedef Function_p2v<void> super; }; // FIXME
- /// Base class for implementation of function-objects from point to
- /// point.
+ /*!
+ * \brief Base class for implementation of function-objects from point to
+ * point.
+ *
+ * The parameter \a E is the exact type.
+ */
template <typename E>
struct Function_p2p : public Function_p2v<E>
{
@@ -190,8 +216,12 @@
template <>
struct Function_x2x<void> { typedef Function_v2v<void> super; }; // FIXME
- /// Base class for implementation of function-objects from vector to
- /// vector.
+ /*!
+ * \brief Base class for implementation of function-objects from vector to
+ * vector.
+ *
+ * The parameter \a E is the exact type.
+ */
template <typename E>
struct Function_x2x : public Function_v2v<E>
{
@@ -203,8 +233,12 @@
// Vector <-> Vector.
- /// Base class for implementation of bijective function-objects from
- /// vector to vector.
+ /*!
+ * \brief Base class for implementation of bijective function-objects from
+ * vector to vector.
+ *
+ * The parameter \a E is the exact type.
+ */
template <typename E>
struct Bijection_x2x : public Function_x2x< E >
{
Index: trunk/milena/mln/accu/nil.hh
===================================================================
--- trunk/milena/mln/accu/nil.hh (revision 1618)
+++ trunk/milena/mln/accu/nil.hh (revision 1619)
@@ -47,7 +47,8 @@
namespace accu
{
- /*! Define an accumulator that does nothing.
+ /*!
+ * \brief Define an accumulator that does nothing.
*/
template <typename T>
struct nil_ : public mln::accu::internal::base_< util::ignore , nil_<T> >
@@ -66,8 +67,9 @@
};
-
- // FIXME: Doc!
+ /*!
+ * \brief Meta accumulator for nil.
+ */
struct nil : public Meta_Accumulator< nil >
{
template <typename V>
Index: trunk/milena/mln/accu/min.hh
===================================================================
--- trunk/milena/mln/accu/min.hh (revision 1618)
+++ trunk/milena/mln/accu/min.hh (revision 1619)
@@ -46,7 +46,7 @@
{
- /*! Generic min accumulator class.
+ /*! \brief Generic min accumulator class.
*
* The parameter \c T is the type of values.
*/
@@ -74,7 +74,9 @@
template <typename I> struct min_< util::pix<I> >;
- // FIXME: Doc!
+ /*!
+ * \brief Meta accumulator for min.
+ */
struct min : public Meta_Accumulator< min >
{
template <typename T>
Index: trunk/milena/mln/accu/take.hh
===================================================================
--- trunk/milena/mln/accu/take.hh (revision 1618)
+++ trunk/milena/mln/accu/take.hh (revision 1619)
@@ -44,7 +44,7 @@
namespace accu
{
- /*! Make an accumulator take the pixels of the image \p input.
+ /*! \brief Make an accumulator take the pixels of the image \p input.
*
* \param[in] input The input image.
* \param[in,out] a The accumulator.
Index: trunk/milena/mln/accu/max.hh
===================================================================
--- trunk/milena/mln/accu/max.hh (revision 1618)
+++ trunk/milena/mln/accu/max.hh (revision 1619)
@@ -46,7 +46,7 @@
{
- /*! Generic max accumulator class.
+ /*! \brief Generic max accumulator class.
*
* The parameter \c T is the type of values.
*/
@@ -74,7 +74,9 @@
template <typename I> struct max_< util::pix<I> >;
- // FIXME: Doc!
+ /*!
+ * \brief Meta accumulator for max.
+ */
struct max : public Meta_Accumulator< max >
{
template <typename T>
Index: trunk/milena/mln/accu/histo.hh
===================================================================
--- trunk/milena/mln/accu/histo.hh (revision 1618)
+++ trunk/milena/mln/accu/histo.hh (revision 1619)
@@ -50,7 +50,8 @@
{
- /*! Generic histogram class over a value set with type \c S.
+ /*!
+ * \brief Generic histogram class over a value set with type \c S.
*/
template <typename S>
struct histo : public mln::accu::internal::base_< const std::vector<std::size_t>& , histo<S> >
@@ -83,7 +84,6 @@
std::size_t sum_;
};
-
template <typename S>
std::ostream& operator<<(std::ostream& ostr, const histo<S>& h);
Index: trunk/milena/mln/accu/min_max.hh
===================================================================
--- trunk/milena/mln/accu/min_max.hh (revision 1618)
+++ trunk/milena/mln/accu/min_max.hh (revision 1619)
@@ -50,7 +50,7 @@
namespace accu
{
- /*! Generic min and max accumulator class.
+ /*! \brief Generic min and max accumulator class.
*
* The parameter \c V is the type of values.
*/
Index: trunk/milena/mln/accu/count.hh
===================================================================
--- trunk/milena/mln/accu/count.hh (revision 1618)
+++ trunk/milena/mln/accu/count.hh (revision 1619)
@@ -44,7 +44,10 @@
{
- /*! Generic counter accumulator class.
+ /*!
+ * \brief Generic counter accumulator class.
+ *
+ * The parameter \a T is the type to be count.
*/
template <typename T>
struct count_ : public mln::accu::internal::base_< std::size_t , count_<T> >
@@ -67,7 +70,9 @@
};
- // FIXME: Doc!
+ /*!
+ * \brief Meta accumulator for count.
+ */
struct count : public Meta_Accumulator< count >
{
template <typename T>
Index: trunk/milena/mln/accu/bbox.hh
===================================================================
--- trunk/milena/mln/accu/bbox.hh (revision 1618)
+++ trunk/milena/mln/accu/bbox.hh (revision 1619)
@@ -44,7 +44,7 @@
{
- /*! Generic bbox accumulator class.
+ /*! \brief Generic bbox accumulator class.
*
* The parameter \c P is the type of points.
*/
Index: trunk/milena/mln/accu/min_h.hh
===================================================================
--- trunk/milena/mln/accu/min_h.hh (revision 1618)
+++ trunk/milena/mln/accu/min_h.hh (revision 1619)
@@ -44,8 +44,8 @@
{
- /*! Generic min function based on histogram over a value set with
- * type \c S.
+ /*! \brief Generic min function based on histogram over a value
+ * set with type \c S.
*/
template <typename S>
struct min_h : public mln::accu::internal::base_< mln_value(S) , min_h<S> >
Index: trunk/milena/mln/accu/pair.hh
===================================================================
--- trunk/milena/mln/accu/pair.hh (revision 1618)
+++ trunk/milena/mln/accu/pair.hh (revision 1619)
@@ -49,7 +49,7 @@
{
- /*! Generic pair of accumulators.
+ /*! \brief Generic pair of accumulators.
*
* The parameter \c T is the type of values.
*
@@ -81,9 +81,9 @@
A2 a2_;
};
-
-
- // FIXME: Doc!
+ /*!
+ * \brief Meta accumulator for pair.
+ */
template <typename A1, typename A2>
struct pair : public Meta_Accumulator< pair<A1,A2> >
{
Index: trunk/milena/mln/accu/max_h.hh
===================================================================
--- trunk/milena/mln/accu/max_h.hh (revision 1618)
+++ trunk/milena/mln/accu/max_h.hh (revision 1619)
@@ -44,7 +44,7 @@
{
- /*! Generic max function based on histogram over a value set with
+ /*! \brief Generic max function based on histogram over a value set with
* type \c S.
*/
template <typename S>
Index: trunk/milena/mln/accu/median.hh
===================================================================
--- trunk/milena/mln/accu/median.hh (revision 1618)
+++ trunk/milena/mln/accu/median.hh (revision 1619)
@@ -44,8 +44,8 @@
{
- /*! Generic median function based on histogram over a value set
- * with type \c S.
+ /*! \brief Generic median function based on histogram over a value
+ * set with type \c S.
*/
template <typename S>
struct median : public mln::accu::internal::base_< mln_value(S), median<S> >
Index: trunk/milena/mln/accu/median_alt.hh
===================================================================
--- trunk/milena/mln/accu/median_alt.hh (revision 1618)
+++ trunk/milena/mln/accu/median_alt.hh (revision 1619)
@@ -44,8 +44,8 @@
{
- /*! Generic median_alt function based on histogram over a value set
- * with type \c S.
+ /*! \brief Generic median_alt function based on histogram over a
+ * value set with type \c S.
*/
template <typename S>
struct median_alt : : public mln::accu::internal::base_< mln_value(S), median_alt<S> >
Index: trunk/milena/mln/accu/p.hh
===================================================================
--- trunk/milena/mln/accu/p.hh (revision 1618)
+++ trunk/milena/mln/accu/p.hh (revision 1619)
@@ -46,7 +46,8 @@
{
- /*! Generic p of accumulators.
+ /*!
+ * \brief Generic p of accumulators.
*
* The parameter \c V is the type of values.
*/
@@ -72,8 +73,9 @@
};
-
- // FIXME: Doc!
+ /*!
+ * \brief Meta accumulator for p.
+ */
template <typename mA>
struct p : public Meta_Accumulator< p<mA> >
{
Index: trunk/milena/mln/accu/sum.hh
===================================================================
--- trunk/milena/mln/accu/sum.hh (revision 1618)
+++ trunk/milena/mln/accu/sum.hh (revision 1619)
@@ -48,7 +48,7 @@
{
- /*! Generic sum accumulator class.
+ /*! \brief Generic sum accumulator class.
*
* Parameter \c T is the type of values that we sum. Parameter \c
* S is the type to store the value sum; the default type of
@@ -78,7 +78,9 @@
struct sum_< util::pix<I>, S >;
- // FIXME: Doc!
+ /*!
+ * \brief Meta accumulator for sum.
+ */
struct sum : public Meta_Accumulator< sum >
{
template <typename T, typename S = mln_sum(T)>
Index: trunk/milena/mln/accu/v.hh
===================================================================
--- trunk/milena/mln/accu/v.hh (revision 1618)
+++ trunk/milena/mln/accu/v.hh (revision 1619)
@@ -45,7 +45,8 @@
{
- /*! Generic v of accumulators.
+ /*!
+ * \brief Generic val of accumulators.
*/
template <typename A>
struct val_ : public mln::accu::internal::base_< mln_result(A) , val_<A> >
@@ -80,8 +81,9 @@
};
-
- // FIXME: Doc!
+ /*!
+ * \brief Meta accumulator for val.
+ */
template <typename mA>
struct val : public Meta_Accumulator< val<mA> >
{
Index: trunk/milena/mln/accu/compute.hh
===================================================================
--- trunk/milena/mln/accu/compute.hh (revision 1618)
+++ trunk/milena/mln/accu/compute.hh (revision 1619)
@@ -46,7 +46,7 @@
namespace accu
{
- /*! Make an accumulator compute the pixels of the image \p input.
+ /*! \brief Make an accumulator compute the pixels of the image \p input.
*
* \param[in] input The input image.
*
@@ -61,7 +61,16 @@
compute(const Image<I>& input);
- // FIXME: Doc!
+ /*! \brief Make an accumulator compute the pixels of the image \p input.
+ *
+ * \param[in] input The input image.
+ *
+ * This routine runs: \n
+ * a.take(make::pix(input, p));
+ * on all pixels on the images.
+ *
+ * \warning This routine does not perform a.init().
+ */
template <typename A, typename I>
mln_accu_with(A, util::pix<I>)::result
compute(const Image<I>& input);
Index: trunk/milena/mln/accu/mean.hh
===================================================================
--- trunk/milena/mln/accu/mean.hh (revision 1618)
+++ trunk/milena/mln/accu/mean.hh (revision 1619)
@@ -47,7 +47,7 @@
{
- /*! Generic mean accumulator class.
+ /*! \brief Generic mean accumulator class.
*
* Parameter \c T is the type of values that we sum. Parameter \c
* S is the type to store the sum of values; the default type of
@@ -83,8 +83,9 @@
struct mean_< util::pix<I>, S,M >;
-
- // FIXME: Doc!
+ /*!
+ * \brief Meta accumulator for mean.
+ */
struct mean : public Meta_Accumulator< mean >
{
template < typename T,
Index: trunk/milena/mln/value/lut_vec.hh
===================================================================
--- trunk/milena/mln/value/lut_vec.hh (revision 1618)
+++ trunk/milena/mln/value/lut_vec.hh (revision 1619)
@@ -51,7 +51,7 @@
template <typename S> struct bkd_viter_;
- /*! Class that defines FIXME
+ /*! \brief Class that defines FIXME
*
* \warning This is a multi-set!!!
* FIXME
Index: trunk/milena/mln/value/set.hh
===================================================================
--- trunk/milena/mln/value/set.hh (revision 1618)
+++ trunk/milena/mln/value/set.hh (revision 1619)
@@ -46,10 +46,12 @@
namespace internal
{
+ /// \internal
template <typename T, typename E, bool is_lowq = false>
struct set_selector_ // no inheritance
{};
+ /// \internal
template <typename T, typename E>
struct set_selector_< T, E, true > // lowq so iterable
:
@@ -60,7 +62,7 @@
- /*! Class that defines the set of values of type \c T.
+ /*! \brief Class that defines the set of values of type \c T.
*
* This is the exhaustive set of values obtainable from type \c T.
*/
Index: trunk/milena/mln/fun/v2v/linear.hh
===================================================================
--- trunk/milena/mln/fun/v2v/linear.hh (revision 1618)
+++ trunk/milena/mln/fun/v2v/linear.hh (revision 1619)
@@ -45,10 +45,9 @@
namespace v2v
{
- /*! Linear function.
- *
+ /*!
+ *\brief Linear function.
* f(v) = a * v + b.
- *
* \c V is the type of input values; \c T is the type used to
* compute the result; \c R is the result type.
*
Index: trunk/milena/mln/util/ordpair.hh
===================================================================
--- trunk/milena/mln/util/ordpair.hh (revision 1618)
+++ trunk/milena/mln/util/ordpair.hh (revision 1619)
@@ -42,9 +42,12 @@
namespace util
{
- /// Ordered pair structure s.a. this->first <= this->second;
- /// ordered pairs are partially ordered using lexicographical
- /// ordering.
+ /*!
+ * \brief Ordered pair structure s.a. this->first <= this->second;
+ * ordered pairs are partially ordered using lexicographical
+ * ordering.
+ *
+ */
template <typename T>
struct ordpair_ : public mln::Object< ordpair_<T> >
{
1
0
19 Dec '07
On 2007-12-17, Guillaume Duhamel <guillaume.duhamel(a)lrde.epita.fr> wrote:
> Index: trunk/milena/mln/core/concept/object.hh
>===================================================================
> --- trunk/milena/mln/core/concept/object.hh (revision 1613)
> +++ trunk/milena/mln/core/concept/object.hh (revision 1614)
> @@ -46,6 +46,84 @@
> # include <mln/metal/ret.hh>
>
>
> +/*! \mainpage Documentation of milena
> + *
> + * \section intro_sec Introduction
> + *
> + * This is the documentation of milena.
> + *
> + * \section tools_subsec Tools required.
> + * FIXME.
> + *
> + * \section mln_sec Overview of milena.
> + *
> + * <UL>
> + * <LI> \ref mln
> + * <LI> \ref mln::accu
> + * <LI> \ref mln::arith
> + * <LI> \ref mln::border
> + * <LI> \ref mln::canvas
> + * <LI> \ref mln::convert
> + * <LI> \ref mln::debug
> + * <LI> \ref mln::display
> + * <LI> \ref mln::draw
> + * <LI> \ref mln::estim
> + * <LI> \ref mln::fun
> + * <LI> \ref mln::geom
> + * <LI> \ref mln::histo
> + * <LI> \ref mln::io
> + * <LI> \ref mln::labeling
> + * <LI> \ref mln::level
> + * <LI> \ref mln::linear
> + * <LI> \ref mln::literal
> + * <LI> \ref mln::logical
> + * <LI> \ref mln::make
> + * <LI> \ref mln::math
> + * <LI> \ref mln::metal
> + * <LI> \ref mln::morpho
> + * <LI> \ref mln::norm
> + * <LI> \ref mln::pw
> + * <LI> \ref mln::set
> + * <LI> \ref mln::tag
> + * <LI> \ref mln::test
> + * <LI> \ref mln::trace
> + * <LI> \ref mln::trait
> + * <LI> \ref mln::util
> + * <LI> \ref mln::value
> + * <LI> \ref mln::win
> + *
> + * \section copyright Copyright and License.
> + * Copyright (C) 2007 EPITA Research and Development Laboratory
> + *
> + * 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.
> + *
Il est préférable de garder le copyright header plus haut.
> + * 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.
> + *
> + */
> +
Tiens j'avais jamais remarqué qu'Olena utilisait une exception
dans la licence GPL. Je vois pas l'intérêt de mettre tout le
code en GPL + exception et pas en LGPL.
--
SIGOURE Benoit aka Tsuna (SUSv3 compliant)
_____ "I think Git is definitely in the running
/EPITA\ Promo 2008.CSI/ACU/YAKA to be the dominate version control system."
-- Bob Proulx
2
1