
* doc/tutorial/Makefile.am * doc/Makefile.am: fix wrong variable names. * doc/tutorial/samples/fill-part-2.cc, * doc/tutorial/samples/fill-part-3.cc, * doc/tutorial/samples/ima2d-decl-2-blobs-full.cc, * doc/tutorial/samples/ima2d-decl-2-blobs.cc, * doc/tutorial/samples/labeling-compute-full.cc: Use label8 instead of int_u8. * doc/tutorial/samples/graph-data-full.cc: Add new example. --- milena/ChangeLog | 16 ++++ milena/doc/Makefile.am | 10 +- milena/doc/tutorial/Makefile.am | 10 +- milena/doc/tutorial/samples/fill-part-2.cc | 7 +- milena/doc/tutorial/samples/fill-part-3.cc | 7 +- milena/doc/tutorial/samples/graph-data-full.cc | 82 ++++++++++++++++++++ .../tutorial/samples/ima2d-decl-2-blobs-full.cc | 6 +- milena/doc/tutorial/samples/ima2d-decl-2-blobs.cc | 4 +- .../doc/tutorial/samples/labeling-compute-full.cc | 5 +- 9 files changed, 122 insertions(+), 25 deletions(-) create mode 100644 milena/doc/tutorial/samples/graph-data-full.cc diff --git a/milena/ChangeLog b/milena/ChangeLog index 82e1f97..4e2cfcb 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,19 @@ +2008-11-25 Guillaume Lazzara <z@lrde.epita.fr> + + Fix tutorial generation. + + * doc/tutorial/Makefile.am + * doc/Makefile.am: fix wrong variable names. + + * doc/tutorial/samples/fill-part-2.cc, + * doc/tutorial/samples/fill-part-3.cc, + * doc/tutorial/samples/ima2d-decl-2-blobs-full.cc, + * doc/tutorial/samples/ima2d-decl-2-blobs.cc, + * doc/tutorial/samples/labeling-compute-full.cc: Use label8 instead of + int_u8. + + * doc/tutorial/samples/graph-data-full.cc: Add new example. + 2008-11-25 Thierry Geraud <thierry.geraud@lrde.epita.fr> Add a morpho tree data structure based on parenthood. diff --git a/milena/doc/Makefile.am b/milena/doc/Makefile.am index 039f5dc..bb717f6 100644 --- a/milena/doc/Makefile.am +++ b/milena/doc/Makefile.am @@ -14,24 +14,24 @@ complete-doc: html_complete user-doc: html_user tutorial -html_complete: tuto_html figures Doxyfile +html_complete: figures Doxyfile tuto_html $(DOXYGEN) Doxyfile_complete -html_user: tuto_html figures Doxyfile +html_user: figures Doxyfile tuto_html $(DOXYGEN) Doxyfile_user figures: all @failcom='exit 1'; \ - list='${wildcard $(FIGURES_DIR)/*.p*m}'; for img in $$list; do \ + list='${wildcard $(FIGURES_BUILDDIR)/*.p*m}'; for img in $$list; do \ echo "Converting $$img to png"; \ - convert $$img $(FIGURES_DIR)/`basename $$img .ppm`.png \ + convert $$img $(FIGURES_BUILDDIR)/`basename $$img .ppm`.png \ || eval $$failcom; \ done; tuto_html: $(MAKE) -C tutorial tuto_html -tuto: all +tuto: all figures $(MAKE) -C tutorial tuto edit = sed -e "s|@ID@|$$Id|" \ diff --git a/milena/doc/tutorial/Makefile.am b/milena/doc/tutorial/Makefile.am index 0b70c3e..9bc00e6 100644 --- a/milena/doc/tutorial/Makefile.am +++ b/milena/doc/tutorial/Makefile.am @@ -2,15 +2,15 @@ SUBDIRS = samples .PHONY: tuto -TUTO_DIR = "milena/doc/tutorial" -TEXINPUTS = $(top_srcdir)/$(TUTO_DIR):$(top_builddir)/$(TUTO_DIR): +include $(top_srcdir)/milena/doc/doc.mk +TEXINPUTS = $(TUTORIAL_SRCDIR):$(TUTORIAL_BUILDDIR): tuto: - TEXINPUTS=$(TEXINPUTS) pdflatex $(top_srcdir)/$(TUTO_DIR)/tutorial.tex + TEXINPUTS=$(TEXINPUTS) pdflatex $(TUTORIAL_SRCDIR)/tutorial.tex tuto_html: - chmod u+x $(top_srcdir)/$(TUTO_DIR)/todoxygen.sh - $(top_srcdir)/$(TUTO_DIR)/todoxygen.sh $(top_srcdir)/$(TUTO_DIR)/tutorial.tex $(top_builddir)/$(TUTO_DIR) + chmod u+x $(TUTORIAL_SRCDIR)/todoxygen.sh + $(TUTORIAL_SRCDIR)/todoxygen.sh $(TUTORIAL_SRCDIR)/tutorial.tex $(TUTORIAL_BUILDDIR) clean-local: rm -f *.aux *.toc *.log *.bbl *blg *.lot *.out *~ diff --git a/milena/doc/tutorial/samples/fill-part-2.cc b/milena/doc/tutorial/samples/fill-part-2.cc index 4f69cbc..17335d2 100644 --- a/milena/doc/tutorial/samples/fill-part-2.cc +++ b/milena/doc/tutorial/samples/fill-part-2.cc @@ -1,10 +1,9 @@ using namespace mln; -using value::int_u8; -using value::rgb8; +using value::label8; // Find and label the different components. -int_u8 nlabels; -image2d<int_u8> lab = labeling::blobs(ima, c4(), nlabels); +label8 nlabels; +image2d<label8> lab = labeling::blobs(ima, c4(), nlabels); // Store a boolean image. True if the site is part of // component 2, false otherwise. diff --git a/milena/doc/tutorial/samples/fill-part-3.cc b/milena/doc/tutorial/samples/fill-part-3.cc index 29c112a..9082430 100644 --- a/milena/doc/tutorial/samples/fill-part-3.cc +++ b/milena/doc/tutorial/samples/fill-part-3.cc @@ -1,10 +1,9 @@ using namespace mln; -using value::int_u8; -using value::rgb8; +using value::label8; // Find and label the different components. -int_u8 nlabels; -image2d<int_u8> lab = labeling::blobs(ima, c4(), nlabels); +label8 nlabels; +image2d<label8> lab = labeling::blobs(ima, c4(), nlabels); // Fill the sites of component 2 with red. fill(lab.domain(2).rw(), color::red); diff --git a/milena/doc/tutorial/samples/graph-data-full.cc b/milena/doc/tutorial/samples/graph-data-full.cc new file mode 100644 index 0000000..60792a3 --- /dev/null +++ b/milena/doc/tutorial/samples/graph-data-full.cc @@ -0,0 +1,82 @@ +#include <mln/essential/2d.hh> +#include <mln/util/graph.hh> + +// Part of graph-data.cc +// \{ +template <typename S> +struct viota_t : public mln::Function_p2v< viota_t<S> > +{ + typedef unsigned result; + + viota_t(unsigned size) + { + v_.resize(size); + for(unsigned i = 0; i < size; ++i) + v_[i] = 10 + i; + } + + unsigned + operator()(const mln_psite(S)& p) const + { + return v_[p.v().id()]; + } + + protected: + std::vector<result> v_; +}; +// \} + +int main() +{ + using namespace mln; + + // Part of graph-add-vertec.cc + // \{ + util::graph g; + + for (unsigned i = 0; i < 5; ++i) + g.add_vertex(); // Add vertex 'i'; + // \} + + // Part of graph-add-edges.cc + // \{ + g.add_edge(0, 1); // Associated to edge 0. + g.add_edge(1, 2); // Associated to edge 1. + g.add_edge(1, 3); // Associated to edge 2. + g.add_edge(3, 4); // Associated to edge 3. + g.add_edge(4, 2); // Associated to edge 4. + // \} + + // Part of graph-i2v-vertex.cc + // \{ + typedef fun::i2v::array<point2d> F; + F f(5); // We need to map 5 vertices. + f(0) = point2d(0, 0); + f(1) = point2d(2, 2); + f(2) = point2d(0, 4); + f(3) = point2d(4, 3); + f(4) = point2d(4, 4); + // \} + + // Part of graph-p-vertices.cc + // \{ + typedef p_vertices<util::graph, F> pv_t; + pv_t pv(g, f); + // \} + + // Part of graph-data.cc + // \{ + + // Constructs an image + viota_t<pv_t> viota(pv.nsites()); + mln_VAR(graph_vertices_ima, viota | pv); + + //Prints each vertex and its associated data. + mln_piter_(graph_vertices_ima_t) p(graph_vertices_ima.domain()); + for_all(p) + std::cout << "graph_vertices_ima(" << p << ") = " + << graph_vertices_ima(p) << std::endl; + + // \} +} + diff --git a/milena/doc/tutorial/samples/ima2d-decl-2-blobs-full.cc b/milena/doc/tutorial/samples/ima2d-decl-2-blobs-full.cc index 9728ac7..da6fa2b 100644 --- a/milena/doc/tutorial/samples/ima2d-decl-2-blobs-full.cc +++ b/milena/doc/tutorial/samples/ima2d-decl-2-blobs-full.cc @@ -2,7 +2,7 @@ int main() { using namespace mln; - using value::int_u8; + using value::label8; bool vals[6][5] = { {0, 1, 1, 0, 0}, @@ -14,8 +14,8 @@ int main() }; image2d<bool> ima = make::image(vals); - int_u8 nlabels; - image2d<int_u8> lbl = labeling::blobs(ima, c4(), nlabels); + label8 nlabels; + image2d<label8> lbl = labeling::blobs(ima, c4(), nlabels); debug::println(lbl); } diff --git a/milena/doc/tutorial/samples/ima2d-decl-2-blobs.cc b/milena/doc/tutorial/samples/ima2d-decl-2-blobs.cc index 6699982..f69c8c0 100644 --- a/milena/doc/tutorial/samples/ima2d-decl-2-blobs.cc +++ b/milena/doc/tutorial/samples/ima2d-decl-2-blobs.cc @@ -1,2 +1,2 @@ -int_u8 nlabels; -image2d<int_u8> lbl = labeling::blobs(ima, c4(), nlabels); +label8 nlabels; +image2d<label8> lbl = labeling::blobs(ima, c4(), nlabels); diff --git a/milena/doc/tutorial/samples/labeling-compute-full.cc b/milena/doc/tutorial/samples/labeling-compute-full.cc index fa378ca..4996a99 100644 --- a/milena/doc/tutorial/samples/labeling-compute-full.cc +++ b/milena/doc/tutorial/samples/labeling-compute-full.cc @@ -3,6 +3,7 @@ int main() { using namespace mln; using value::int_u8; + using value::label8; bool vals[6][5] = { {0, 1, 1, 0, 0}, @@ -14,8 +15,8 @@ int main() }; image2d<bool> ima = make::image(vals); - int_u8 nlabels; - image2d<int_u8> lbl = labeling::blobs(ima, c4(), nlabels); + label8 nlabels; + image2d<label8> lbl = labeling::blobs(ima, c4(), nlabels); util::array<box2d> boxes = labeling::compute(accu::meta::bbox(), -- 1.5.6.5