
* mln/core/image/line_graph_image.hh: Fix identation. * mln/core/site_set/p_line_graph.hh: Fix documentation and indentation. (mln::::p_line_graph<P>::gr): Fix implementations. * mln/core/image/line_graph_psite.hh: Fix documentation. (mln::line_graph_psite<P>::line_graph_psite): Don't invalidate the iterator as the site set is not defined, and invalidation would trigger an error. * mln/core/site_set/p_line_graph_piter.hh: Fix documentation. (mln::p_line_graph_fwd_piter_<P>::p_line_graph_fwd_piter_) (mln::p_line_graph_bkd_piter_<P>::p_line_graph_bkd_piter_): Fix postconditions (mln::p_line_graph_bkd_piter_<P>::invalidate_) (mln::p_line_graph_bkd_piter_<P>::start_): Catch up with the current interface of mln::line_graph_psite. * mln/core/image/line_graph_elt_neighborhood.hh (mln::line_graph_elt_neighborhood<P>::niter): Fix documentation. * mln/core/internal/line_graph_vicinity_piter.hh: Typo in comment. (mln::internal::line_graph_vicinity_piter_<P, S, E>::self_): Remove typedef. * tests/core/image/line_graph_image.cc: Remove superfluous inclusion of mln/morpho/dilation.hh. * tests/morpho/line_graph_image_morpho.cc: Fix Doxygen header. * tests/morpho/Makefile.am (check_PROGRAMS): Disable line_graph_image_morpho. --- milena/ChangeLog | 30 ++++++++++++++++++++ .../mln/core/image/line_graph_elt_neighborhood.hh | 2 +- milena/mln/core/image/line_graph_image.hh | 2 +- milena/mln/core/image/line_graph_psite.hh | 7 ++-- .../mln/core/internal/line_graph_vicinity_piter.hh | 16 +++++----- milena/mln/core/site_set/p_line_graph.hh | 29 ++++++++---------- milena/mln/core/site_set/p_line_graph_piter.hh | 21 ++++++++----- milena/tests/core/image/line_graph_image.cc | 2 - milena/tests/morpho/Makefile.am | 3 +- milena/tests/morpho/line_graph_image_morpho.cc | 4 +- 10 files changed, 73 insertions(+), 43 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index d0e326d..a6c3302 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,5 +1,35 @@ 2008-09-22 Roland Levillain <roland@lrde.epita.fr> + Misc. fixes on line graph images. + + * mln/core/image/line_graph_image.hh: Fix identation. + * mln/core/site_set/p_line_graph.hh: Fix documentation and + indentation. + (mln::::p_line_graph<P>::gr): Fix implementations. + * mln/core/image/line_graph_psite.hh: Fix documentation. + (mln::line_graph_psite<P>::line_graph_psite): Don't invalidate the + iterator as the site set is not defined, and invalidation would + trigger an error. + * mln/core/site_set/p_line_graph_piter.hh: Fix documentation. + (mln::p_line_graph_fwd_piter_<P>::p_line_graph_fwd_piter_) + (mln::p_line_graph_bkd_piter_<P>::p_line_graph_bkd_piter_): + Fix postconditions + (mln::p_line_graph_bkd_piter_<P>::invalidate_) + (mln::p_line_graph_bkd_piter_<P>::start_): + Catch up with the current interface of mln::line_graph_psite. + * mln/core/image/line_graph_elt_neighborhood.hh + (mln::line_graph_elt_neighborhood<P>::niter): Fix documentation. + * mln/core/internal/line_graph_vicinity_piter.hh: Typo in comment. + (mln::internal::line_graph_vicinity_piter_<P, S, E>::self_): + Remove typedef. + * tests/core/image/line_graph_image.cc: Remove superfluous + inclusion of mln/morpho/dilation.hh. + * tests/morpho/line_graph_image_morpho.cc: Fix Doxygen header. + * tests/morpho/Makefile.am (check_PROGRAMS): Disable + line_graph_image_morpho. + +2008-09-22 Roland Levillain <roland@lrde.epita.fr> + Update tests exercising graph image. * tests/core/image/graph_image.cc: Update. diff --git a/milena/mln/core/image/line_graph_elt_neighborhood.hh b/milena/mln/core/image/line_graph_elt_neighborhood.hh index 38b7d8f..ee212fb 100644 --- a/milena/mln/core/image/line_graph_elt_neighborhood.hh +++ b/milena/mln/core/image/line_graph_elt_neighborhood.hh @@ -88,7 +88,7 @@ namespace mln /// neighborhood w.r.t. the reverse ordering of edges. typedef line_graph_neighborhood_bkd_piter<P, self_> bkd_niter; - /// The default qiter type. + /// The default niter type. typedef fwd_niter niter; /// \} diff --git a/milena/mln/core/image/line_graph_image.hh b/milena/mln/core/image/line_graph_image.hh index 6b9b7ba..3ae371b 100644 --- a/milena/mln/core/image/line_graph_image.hh +++ b/milena/mln/core/image/line_graph_image.hh @@ -181,7 +181,7 @@ namespace mln /// Return the point of the second vertex adjacent to the edge with /// id \a e. const P& vertex2(const util::edge_id& e) const; -}; + }; // Fwd decl. template <typename P, typename V, typename W> diff --git a/milena/mln/core/image/line_graph_psite.hh b/milena/mln/core/image/line_graph_psite.hh index 869a5cf..383f1ac 100644 --- a/milena/mln/core/image/line_graph_psite.hh +++ b/milena/mln/core/image/line_graph_psite.hh @@ -29,7 +29,7 @@ # define MLN_CORE_IMAGE_LINE_GRAPH_PSITE_HH /// \file mln/core/image/line_graph_psite.hh -/// \brief Definition of a line graph-based point site. +/// \brief Definition of a line graph-based psite. # include <mln/core/internal/pseudo_site_base.hh> @@ -46,10 +46,11 @@ namespace mln { - // Fwd decl. + // Forward declaration. template <typename P> class p_line_graph; template <typename P> class line_graph_psite; + /// \brief Point site associated to a mln::line_graph_image. /// /// \arg \p P The type of the site. @@ -191,7 +192,6 @@ namespace mln line_graph_psite<P>::line_graph_psite() : plg_(0) { - invalidate(); } template <typename P> @@ -340,7 +340,6 @@ namespace mln return plg_->gr_->edge(id_).v2(); } - template <typename P> inline void diff --git a/milena/mln/core/internal/line_graph_vicinity_piter.hh b/milena/mln/core/internal/line_graph_vicinity_piter.hh index ffb7616..e8d0811 100644 --- a/milena/mln/core/internal/line_graph_vicinity_piter.hh +++ b/milena/mln/core/internal/line_graph_vicinity_piter.hh @@ -32,17 +32,18 @@ /// \brief Factored implementation for point iterators on a line graph windows /// and line graph neighborhoods, called "vicinities". -/* FIXME: Factor those classes: - - - mln::internal::graph_vicinity_piter.hh - - mln::internal::line_graph_vicinity_piter.hh */ - # include <set> # include <mln/core/internal/site_relative_iterator_base.hh> # include <mln/core/site_set/p_line_graph.hh> # include <mln/core/image/line_graph_psite.hh> +/* FIXME: Factor those classes: + + - mln::internal::graph_vicinity_piter.hh + - mln::internal::line_graph_vicinity_piter.hh */ + + namespace mln { // Fwd decls. @@ -52,6 +53,7 @@ namespace mln // FIXME: Consider renaming line_graph_vicinity_piter_ as // line_graph_relative_piter_. + namespace internal { @@ -60,8 +62,6 @@ namespace mln class line_graph_vicinity_piter_ : public internal::site_relative_iterator_base< S, E > { - typedef line_graph_vicinity_piter_<P, S, E> self_; - public: enum { dim = P::dim }; @@ -91,7 +91,7 @@ namespace mln }; - /// Print a mln::line_graph_vicinity_piter_<P, S, E>. + /// Print an mln::line_graph_vicinity_piter_<P, S, E>. template <typename P, typename S, typename E> inline std::ostream& diff --git a/milena/mln/core/site_set/p_line_graph.hh b/milena/mln/core/site_set/p_line_graph.hh index 96b2c93..ec3ce39 100644 --- a/milena/mln/core/site_set/p_line_graph.hh +++ b/milena/mln/core/site_set/p_line_graph.hh @@ -29,22 +29,21 @@ # define MLN_CORE_SITE_SET_P_LINE_GRAPH_HH /// \file mln/core/site_set/p_line_graph.hh -/// \brief Definition of a point set based on line graph. +/// \brief Definition of a point set based on a line graph. -# include <mln/core/concept/point_site.hh> # include <mln/core/internal/site_set_base.hh> # include <mln/util/graph.hh> # include <mln/util/tracked_ptr.hh> # include <mln/util/site_pair.hh> + # include <mln/core/image/line_graph_psite.hh> # include <mln/core/site_set/p_line_graph_piter.hh> /* FIXME: This class shares a lot with p_graph. Factor as much as possible. */ -/* FIXME: We should move the `adjacent_or_equal method' from iterators - into this class. */ - +/* FIXME: We should move the `adjacent'/`adjacent_or_equal' methods + out of this class (into iterators on *graph*). */ namespace mln { @@ -82,7 +81,7 @@ namespace mln /// /// \a gr is \em copied internally, so that the line graph psite /// set is still valid after the initial graph has been removed. - p_line_graph (const graph& gr); + p_line_graph(const graph& gr); /// Associated types. /// \{ @@ -128,11 +127,9 @@ namespace mln /// Accessors. /// \{ - /// Return the graph associated to the p_graph domain (const - /// version) + /// Return the graph associated to this site set (const version) const graph& gr() const; - /// Return the graph associated to the p_graph domain (mutable - /// version). + /// Return the graph associated to this site set (mutable version). graph& gr(); /// \} @@ -176,8 +173,8 @@ namespace mln /// \brief Inclusion of a mln::p_line_graph in another one. /// /// This inclusion relation is very strict for the moment, since our - /// infrastrure for graphs i simple: a mln::p_line_graph is included - /// in another one if their are equal. + /// infrastructure for graphs is simple: a mln::p_line_graph is + /// included in another one if their are equal. /// /// \todo Refine this later, when we are able to express subgraph /// relations. @@ -193,7 +190,7 @@ namespace mln inline p_line_graph<P>::p_line_graph(const util::graph<P>& gr) // Create a deep, managed copy of GR. - : gr_ (new util::graph<P>(gr)) + : gr_(new util::graph<P>(gr)) { } @@ -227,7 +224,7 @@ namespace mln p_line_graph<P>::is_valid() const { // FIXME: Might be too low-level, again. - return (gr_.ptr_); + return gr_.ptr_; } template <typename P> @@ -255,7 +252,7 @@ namespace mln template <typename P> const util::graph<P>& - p_graph<P>::gr() const + p_line_graph<P>::gr() const { mln_precondition(is_valid()); return *gr_.ptr_; @@ -263,7 +260,7 @@ namespace mln template <typename P> util::graph<P>& - p_graph<P>::gr() + p_line_graph<P>::gr() { mln_precondition(is_valid()); return *gr_.ptr_; diff --git a/milena/mln/core/site_set/p_line_graph_piter.hh b/milena/mln/core/site_set/p_line_graph_piter.hh index 90b8e3c..f74660d 100644 --- a/milena/mln/core/site_set/p_line_graph_piter.hh +++ b/milena/mln/core/site_set/p_line_graph_piter.hh @@ -31,10 +31,13 @@ /// \file mln/core/site_set/p_line_graph_piter.hh /// \brief Definition of point iterators on line graph-based site set. -# include <mln/core/internal/site_iterator_base.hh> +# include <mln/core/internal/site_set_iterator_base.hh> # include <mln/core/site_set/p_line_graph.hh> # include <mln/core/image/line_graph_psite.hh> +/* FIXME: Iterators on p_graph and p_line_graph share common code. + Factor as much as possible. */ + namespace mln { @@ -78,11 +81,12 @@ namespace mln /// \} protected: + /// The psite corresponding to this iterator. using super_::p_; }; - /// Print a mln::p_line_graph_fwd_piter_<P>. + /// Print an mln::p_line_graph_fwd_piter_<P>. template <typename P> inline std::ostream& @@ -135,6 +139,7 @@ namespace mln operator<<(std::ostream& ostr, const p_line_graph_bkd_piter_<P>& p); + # ifndef MLN_INCLUDE_ONLY /*-----------------------------. @@ -145,7 +150,7 @@ namespace mln inline p_line_graph_fwd_piter_<P>::p_line_graph_fwd_piter_() { - mln_postcondition(!is_valid()); + mln_postcondition(!this->is_valid()); } template <typename P> @@ -153,7 +158,7 @@ namespace mln p_line_graph_fwd_piter_<P>::p_line_graph_fwd_piter_(const p_line_graph<P>& plg) { this->change_target(plg); - mln_postcondition(!is_valid()); + mln_postcondition(!this->is_valid()); } template <typename P> @@ -206,7 +211,7 @@ namespace mln inline p_line_graph_bkd_piter_<P>::p_line_graph_bkd_piter_() { - mln_postcondition(!is_valid()); + mln_postcondition(!this->is_valid()); } template <typename P> @@ -214,7 +219,7 @@ namespace mln p_line_graph_bkd_piter_<P>::p_line_graph_bkd_piter_(const p_line_graph<P>& plg) { this->change_target(plg); - mln_postcondition(!is_valid()); + mln_postcondition(!this->is_valid()); } template <typename P> @@ -230,7 +235,7 @@ namespace mln void p_line_graph_bkd_piter_<P>::invalidate_() { - p_.set_id(this->site_set().nedges()); + p_.change_edge_id(this->site_set().nedges()); } template <typename P> @@ -238,7 +243,7 @@ namespace mln void p_line_graph_bkd_piter_<P>::start_() { - p_.set_id(this->site_set().nedges() - 1); + p_.change_edge_id(this->site_set().nedges() - 1); } template <typename P> diff --git a/milena/tests/core/image/line_graph_image.cc b/milena/tests/core/image/line_graph_image.cc index 2e7fbe4..74d374b 100644 --- a/milena/tests/core/image/line_graph_image.cc +++ b/milena/tests/core/image/line_graph_image.cc @@ -35,8 +35,6 @@ #include <mln/core/image/line_graph_elt_window.hh> #include <mln/core/image/line_graph_window_piter.hh> -#include <mln/morpho/dilation.hh> - int main() { diff --git a/milena/tests/morpho/Makefile.am b/milena/tests/morpho/Makefile.am index 2bce281..36f11dd 100644 --- a/milena/tests/morpho/Makefile.am +++ b/milena/tests/morpho/Makefile.am @@ -21,7 +21,7 @@ check_PROGRAMS = \ ## lena_line_graph_image_wst1 \ lena_line_graph_image_wst2 \ ## line_graph_image_wst \ - line_graph_image_morpho \ +## line_graph_image_morpho \ meyer_wst \ meyer_wst_long \ opening_area \ @@ -54,6 +54,7 @@ laplacian_SOURCES = laplacian.cc thinning_SOURCES = thinning.cc graph_image_morpho_SOURCES = graph_image_morpho.cc + line_graph_image_morpho_SOURCES = line_graph_image_morpho.cc line_graph_image_wst_SOURCES = line_graph_image_wst.cc meyer_wst_SOURCES = meyer_wst.cc diff --git a/milena/tests/morpho/line_graph_image_morpho.cc b/milena/tests/morpho/line_graph_image_morpho.cc index 2306513..a3c74cf 100644 --- a/milena/tests/morpho/line_graph_image_morpho.cc +++ b/milena/tests/morpho/line_graph_image_morpho.cc @@ -25,8 +25,8 @@ // reasons why the executable file might be covered by the GNU General // Public License. -/// \file tests/core/image/graph_image.cc -/// \brief Tests on mln::graph_image. +/// \file tests/morpho/line_graph_image_morpho.cc +/// \brief Tests on mln::line_graph_image with morphological filters. #include <vector> -- 1.5.6.5