https://svn.lrde.epita.fr/svn/oln/trunk/milena
Index: ChangeLog
from Roland Levillain <roland(a)lrde.epita.fr>
Miscellaneous fixes on morphological tests.
* mln/morpho/dilation.hh
(mln::morpho::dilation(const Image<I>&, Image<O>&))
(mln::morpho::dilation(const Image<I>&, const Window<W>&,
Image<O>&)):
Disable these routines.
(mln::morpho::dilation(const Image<I>&, const Window<W>&)):
Add preconditions.
* mln/win/rectangle2d.hh (mln::win::rectangle2d::psite): New
typedef.
* tests/morpho/Makefile.am (CXXFLAGS_SPEED): Append -DNDEBUG to
speed up lengthy tests.
* tests/morpho/dilation.cc: No longer use the dilation facades
taking the output image as argument; instead, use the facades
returning the output images as return value.
* tests/morpho/lena_line_graph_image_wst1.cc: Use the psite
associated to a point iterator on a line_graph_image, not the
point.
mln/morpho/dilation.hh | 43 ++++++++++++++++-------------
mln/win/rectangle2d.hh | 3 ++
tests/morpho/Makefile.am | 2 -
tests/morpho/dilation.cc | 12 ++------
tests/morpho/lena_line_graph_image_wst1.cc | 2 -
5 files changed, 33 insertions(+), 29 deletions(-)
Index: mln/morpho/dilation.hh
--- mln/morpho/dilation.hh (revision 1776)
+++ mln/morpho/dilation.hh (working copy)
@@ -28,11 +28,8 @@
#ifndef MLN_MORPHO_DILATION_HH
# define MLN_MORPHO_DILATION_HH
-/*! \file mln/morpho/dilation.hh
- *
- * \brief Morphological dilation.
- *
- */
+/// \file mln/morpho/dilation.hh
+/// \brief Morphological dilation.
# include <mln/morpho/includes.hh>
@@ -47,14 +44,19 @@
///
/// \{
- /// Perform a morphological dilation of \a input using its
- /// neighborhood and store the result into \a output.
- ///
- /// \pre \a input must be an image with a neighborhood.
- /* FIXME: Do we want to keep this version? */
- template <typename I, typename O>
- void
- dilation(const Image<I>& input, Image<O>& output);
+ /* FIXME: We'll probably get rid of the neighborhood-based
+ versions for Olena 1.0, and try to re-introduce them for
+ Olena 1.1. */
+
+ /* FIXME: Unless there's a good reason, we should get rid of this
+ version. */
+// /// Perform a morphological dilation of \a input using its
+// /// neighborhood and store the result into \a output.
+// ///
+// /// \pre \a input must be an image with a neighborhood.
+// template <typename I, typename O>
+// void
+// dilation(const Image<I>& input, Image<O>& output);
/// Perform a morphological dilation of \a input using its
/// neighborhood and return the result.
@@ -71,12 +73,13 @@
/// images.
///
/// \{
- /// Perform a morphological dilation of \a input using \a win and
- /// store the result into \a output.
- /* FIXME: Do we want to keep this version? */
- template <typename I, typename W, typename O>
- void
- dilation(const Image<I>& input, const Window<W>& win,
Image<O>& output);
+ /* FIXME: Unless there's a good reason, we should get rid of this
+ version. */
+// /// Perform a morphological dilation of \a input using \a win and
+// /// store the result into \a output.
+// template <typename I, typename W, typename O>
+// void
+// dilation(const Image<I>& input, const Window<W>& win,
Image<O>& output);
/// Perform a morphological dilation of \a input using \a win and
/// return the result.
@@ -334,6 +337,8 @@
dilation(const Image<I>& input, const Window<W>& win)
{
trace::entering("morpho::dilation");
+ mln_precondition(exact(input).has_data());
+ mln_precondition(! exact(win).is_empty());
mln_concrete(I) output;
initialize(output, input);
Index: mln/win/rectangle2d.hh
--- mln/win/rectangle2d.hh (revision 1776)
+++ mln/win/rectangle2d.hh (working copy)
@@ -59,6 +59,9 @@
struct rectangle2d : public Window< rectangle2d >,
public internal::dpoints_base_< dpoint2d, rectangle2d >
{
+ /// Point Site associated type.
+ typedef point2d psite;
+
/// Point associated type.
typedef point2d point;
Index: tests/morpho/Makefile.am
--- tests/morpho/Makefile.am (revision 1776)
+++ tests/morpho/Makefile.am (working copy)
@@ -38,7 +38,7 @@
# FIXME: We should isolate those tests, as they take a long time to
# execute.
-CXXFLAGS_SPEED = -O3 -ggdb
+CXXFLAGS_SPEED = -O3 -ggdb -DNDEBUG
lena_line_graph_image_wst1_SOURCES = lena_line_graph_image_wst1.cc
lena_line_graph_image_wst1_CXXFLAGS = $(CXXFLAGS_SPEED)
lena_line_graph_image_wst2_SOURCES = lena_line_graph_image_wst2.cc
Index: tests/morpho/dilation.cc
--- tests/morpho/dilation.cc (revision 1776)
+++ tests/morpho/dilation.cc (working copy)
@@ -74,27 +74,23 @@
{
win::rectangle2d rec(5, 3);
- image2d<int_u8> out(lena.domain());
- morpho::dilation(lena, rec, out);
+ image2d<int_u8> out = morpho::dilation(lena, rec);
io::pgm::save(out, "out1.pgm");
}
{
win::octagon2d oct(7);
- image2d<int_u8> out(lena.domain());
- morpho::dilation(lena, oct, out);
+ image2d<int_u8> out = morpho::dilation(lena, oct);
io::pgm::save(out, "out2.pgm");
}
{
- image2d<int_u8> out(lena.domain());
- morpho::dilation(lena + c4(), out);
+ image2d<int_u8> out = morpho::dilation(lena + c4());
io::pgm::save(out, "out3.pgm");
}
{
- image2d<int_u8> out(lena.domain());
- morpho::dilation(lena + c8(), out);
+ image2d<int_u8> out = morpho::dilation(lena + c8());
io::pgm::save(out, "out4.pgm");
}
Index: tests/morpho/lena_line_graph_image_wst1.cc
--- tests/morpho/lena_line_graph_image_wst1.cc (revision 1776)
+++ tests/morpho/lena_line_graph_image_wst1.cc (working copy)
@@ -221,7 +221,7 @@
{
if (wshed(pw) == 0)
{
- mln_point_(wst_ima_t) pp(pw);
+ mln_psite_(wst_ima_t) pp(pw);
// Equivalent of the line (edge) PP in OUTPUT.
int row1 = pp.first()[0] * 2;
int col1 = pp.first()[1] * 2;