olena: olena-2.0-603-gf6801ca Document sub_image morpher.

* doc/examples-outputs.mk, * doc/examples.mk, * doc/figures.mk, * doc/outputs.mk, * doc/programs-examples.mk: Regen. * doc/examples.dox: Revamp layout and add link to the new sub_image example. * doc/examples/sub_image.cc, * doc/outputs/sub_image.txt, * doc/figures/sub_image-1.pbm, * doc/figures/sub_image-2.pbm: New. * mln/core/image/dmorph/sub_image.hh: Write documentation. --- milena/ChangeLog | 20 +++++++++ milena/doc/examples-outputs.mk | 18 ++++++++ milena/doc/examples.dox | 9 ++-- milena/doc/examples.mk | 1 + milena/doc/examples/sub_image.cc | 46 ++++++++++++++++++++ milena/doc/figures.mk | 13 ++++++ .../figures/{logical-not-1.pbm => sub_image-1.pbm} | 2 +- .../figures/{logical-not-1.pbm => sub_image-2.pbm} | Bin 117 -> 115 bytes milena/doc/outputs.mk | 1 + ...{accu-right-instantiation.txt => sub_image.txt} | 0 milena/doc/programs-examples.mk | 2 + milena/mln/core/image/dmorph/sub_image.hh | 37 +++++++++++++--- 12 files changed, 137 insertions(+), 12 deletions(-) create mode 100644 milena/doc/examples/sub_image.cc copy milena/doc/figures/{logical-not-1.pbm => sub_image-1.pbm} (95%) copy milena/doc/figures/{logical-not-1.pbm => sub_image-2.pbm} (92%) copy milena/doc/outputs/{accu-right-instantiation.txt => sub_image.txt} (100%) diff --git a/milena/ChangeLog b/milena/ChangeLog index 039f880..31c5566 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,23 @@ +2013-05-13 Guillaume Lazzara <z@lrde.epita.fr> + + Document sub_image morpher. + + * doc/examples-outputs.mk, + * doc/examples.mk, + * doc/figures.mk, + * doc/outputs.mk, + * doc/programs-examples.mk: Regen. + + * doc/examples.dox: Revamp layout and add link to the new sub_image + example. + + * doc/examples/sub_image.cc, + * doc/outputs/sub_image.txt, + * doc/figures/sub_image-1.pbm, + * doc/figures/sub_image-2.pbm: New. + + * mln/core/image/dmorph/sub_image.hh: Write documentation. + 2013-04-30 Guillaume Lazzara <z@lrde.epita.fr> * mln/core/routine/duplicate.hh: Document this routine. diff --git a/milena/doc/examples-outputs.mk b/milena/doc/examples-outputs.mk index 1136c55..10645fb 100644 --- a/milena/doc/examples-outputs.mk +++ b/milena/doc/examples-outputs.mk @@ -721,6 +721,24 @@ $(srcdir)/outputs/predicate-1.txt: $(srcdir)/examples/predicate-1.stamp fi +$(srcdir)/examples/sub_image.stamp: examples/sub_image.cc + @rm -f $@.tmp + @touch $@.tmp + $(MAKE) $(AM_MAKEFLAGS) sub_image$(EXEEXT) + ./sub_image$(EXEEXT) >$(srcdir)/outputs/sub_image.txt.tmp + mv $(srcdir)/outputs/sub_image.txt.tmp $(srcdir)/outputs/sub_image.txt + @mv -f $@.tmp $@ +EXTRA_DIST += $(srcdir)/examples/sub_image.stamp +MAINTAINERCLEANFILES += $(srcdir)/examples/sub_image.stamp + +$(srcdir)/outputs/sub_image.txt: $(srcdir)/examples/sub_image.stamp +## Recover from the removal of $@ + @if test -f $@; then :; else \ + rm -f $<; \ + $(MAKE) $(AM_MAKEFLAGS) $<; \ + fi + + $(srcdir)/examples/transformed_image.stamp: examples/transformed_image.cc @rm -f $@.tmp @touch $@.tmp diff --git a/milena/doc/examples.dox b/milena/doc/examples.dox index 1acb132..3a10c8a 100644 --- a/milena/doc/examples.dox +++ b/milena/doc/examples.dox @@ -1,19 +1,20 @@ /*! \page examples Examples -\section examplesgenericity Genericity +\section examplesneighb Neighborhoods -\li \link demos/genericity/neighborhood/neighborhood.cc Classical neighborhoods \endlink +\li \link demos/genericity/neighborhood/neighborhood.cc Common neighborhoods \endlink \li \link demos/genericity/neighborhood/duality.cc Dual neighborhoods \endlink \li \link demos/genericity/neighborhood/permissive.cc Custom neighborhoods \endlink -\li \link demos/inter_pixel/inter_pixel.cc Inter-pixel processings \endlink - \section examplesmorpher Image Morphers \li \link doc/examples/transformed_image.cc Image domain translation. \endlink \li \link doc/examples/extended_image.cc Image domain extension/shrinking. \endlink +\li \link doc/examples/sub_image.cc Image domain restriction. \endlink \section examplesgraph Graphs \li \link demos/graph/region_adjacency_graph.cc Region Adjacency Graph \endlink +\section examplesinterpixel Inter-pixel Processings +\li \link demos/inter_pixel/inter_pixel.cc Watershed \endlink */ diff --git a/milena/doc/examples.mk b/milena/doc/examples.mk index 12b9419..180b32c 100644 --- a/milena/doc/examples.mk +++ b/milena/doc/examples.mk @@ -41,6 +41,7 @@ EXAMPLES = \ $(srcdir)/examples/paste.cc \ $(srcdir)/examples/point-1.cc \ $(srcdir)/examples/predicate-1.cc \ + $(srcdir)/examples/sub_image.cc \ $(srcdir)/examples/transformed_image.cc \ $(srcdir)/examples/trash/accu.cc \ $(srcdir)/examples/trash/box.cc \ diff --git a/milena/doc/examples/sub_image.cc b/milena/doc/examples/sub_image.cc new file mode 100644 index 0000000..bcc4795 --- /dev/null +++ b/milena/doc/examples/sub_image.cc @@ -0,0 +1,46 @@ +#include <mln/core/image/image2d.hh> +#include <mln/core/image/dmorph/sub_image.hh> + +// Example specific header. +#include <doc/tools/sample_utils.hh> + +int main() +{ + using namespace mln; + + //! [Input image] + bool vals[5][5] = { { 0, 0, 0, 0, 0 }, + { 0, 1, 1, 1, 0 }, + { 0, 1, 1, 1, 0 }, + { 0, 1, 1, 1, 0 }, + { 0, 0, 0, 0, 0 } }; + typedef image2d<bool> I; + I ima = make::image(vals); + //! [Input image] + + doc::pbmsave(ima, "sub_image"); + + //! [Sub domain] + // Sub domain considered for further processing. + box2d sub_domain = make::box2d(1,1, 3,3); + //! [Sub domain] + + //! [Operator pipe] + // Create a sub image using '|' operator (short way). + mln::sub_image<I,mln::box2d> sub = ima | sub_domain; + //! [Operator pipe] + + //! [Sub_image constructor] + // Create a sub image using sub_image constructor. + mln::sub_image<I,mln::box2d> sub2 = sub_image<I,box2d>(ima, sub_domain); + //! [Sub_image constructor] + + doc::pbmsave(sub, "sub_image"); + + /* sub == sub2 == { + { 2, 2, 2 }, + { 2, 2, 2 }, + { 2, 2, 2 }, + } + */ +} diff --git a/milena/doc/figures.mk b/milena/doc/figures.mk index c3e72f1..e2ec7fd 100644 --- a/milena/doc/figures.mk +++ b/milena/doc/figures.mk @@ -87,6 +87,16 @@ $(LOGICAL_NOT_FIGURES): $(srcdir)/examples/logical-not.stamp $(MAKE) $(AM_MAKEFLAGS) $<; \ fi +SUB_IMAGE_FIGURES = \ + $(srcdir)/figures/sub_image-1.pbm \ + $(srcdir)/figures/sub_image-2.pbm +$(SUB_IMAGE_FIGURES): $(srcdir)/examples/sub_image.stamp +## Recover from the removal of $@ + @if test -f $@; then :; else \ + rm -f $<; \ + $(MAKE) $(AM_MAKEFLAGS) $<; \ + fi + TUTO2_FIRST_IMAGE_FIGURES = \ $(srcdir)/figures/tuto2_first_image-1.pbm $(TUTO2_FIRST_IMAGE_FIGURES): $(srcdir)/examples/tuto2_first_image.stamp @@ -141,6 +151,7 @@ FIGURES = \ $(IMA2D_ROT_FIGURES) \ $(LABELING_COMPUTE_FIGURES) \ $(LOGICAL_NOT_FIGURES) \ + $(SUB_IMAGE_FIGURES) \ $(TUTO2_FIRST_IMAGE_FIGURES) \ $(TUTO3_COLORIZE_FIGURES) \ $(TUTO3_RW_IMAGE_FIGURES) \ @@ -154,6 +165,8 @@ PBM_FIGURES = \ $(srcdir)/figures/logical-not-1.pbm \ $(srcdir)/figures/logical-not-2.pbm \ $(srcdir)/figures/logical-not-3.pbm \ + $(srcdir)/figures/sub_image-1.pbm \ + $(srcdir)/figures/sub_image-2.pbm \ $(srcdir)/figures/tuto2_first_image-1.pbm \ $(srcdir)/figures/tuto4_genericity_and_algorithms-3.pbm diff --git a/milena/doc/figures/logical-not-1.pbm b/milena/doc/figures/sub_image-1.pbm similarity index 95% copy from milena/doc/figures/logical-not-1.pbm copy to milena/doc/figures/sub_image-1.pbm index 2faf6d4..3f76de9 100644 --- a/milena/doc/figures/logical-not-1.pbm +++ b/milena/doc/figures/sub_image-1.pbm @@ -2,4 +2,4 @@ P4 # Generated by Milena 1.0 http://olena.lrde.epita.fr # EPITA Research and Development Laboratory (LRDE) 5 5 -XšXšš \ No newline at end of file +øø \ No newline at end of file diff --git a/milena/doc/figures/logical-not-1.pbm b/milena/doc/figures/sub_image-2.pbm similarity index 92% copy from milena/doc/figures/logical-not-1.pbm copy to milena/doc/figures/sub_image-2.pbm index 2faf6d4..1b9411e 100644 Binary files a/milena/doc/figures/logical-not-1.pbm and b/milena/doc/figures/sub_image-2.pbm differ diff --git a/milena/doc/outputs.mk b/milena/doc/outputs.mk index 40fa6c3..0ff7b94 100644 --- a/milena/doc/outputs.mk +++ b/milena/doc/outputs.mk @@ -41,6 +41,7 @@ OUTPUTS = \ $(srcdir)/outputs/paste.txt \ $(srcdir)/outputs/point-1.txt \ $(srcdir)/outputs/predicate-1.txt \ + $(srcdir)/outputs/sub_image.txt \ $(srcdir)/outputs/transformed_image.txt \ $(srcdir)/outputs/tuto2_first_image.txt \ $(srcdir)/outputs/tuto3_colorize.txt \ diff --git a/milena/doc/outputs/accu-right-instantiation.txt b/milena/doc/outputs/sub_image.txt similarity index 100% copy from milena/doc/outputs/accu-right-instantiation.txt copy to milena/doc/outputs/sub_image.txt diff --git a/milena/doc/programs-examples.mk b/milena/doc/programs-examples.mk index 42610c4..5cc70df 100644 --- a/milena/doc/programs-examples.mk +++ b/milena/doc/programs-examples.mk @@ -66,6 +66,7 @@ PROGRAMS_examples = \ paste-call-1 \ point-1 \ predicate-1 \ + sub_image \ transformed_image \ win-create-1 \ win-create-2 @@ -132,6 +133,7 @@ paste_SOURCES = examples/paste.cc paste_call_1_SOURCES = examples/paste-call-1.cc point_1_SOURCES = examples/point-1.cc predicate_1_SOURCES = examples/predicate-1.cc +sub_image_SOURCES = examples/sub_image.cc transformed_image_SOURCES = examples/transformed_image.cc win_create_1_SOURCES = examples/win-create-1.cc win_create_2_SOURCES = examples/win-create-2.cc diff --git a/milena/mln/core/image/dmorph/sub_image.hh b/milena/mln/core/image/dmorph/sub_image.hh index 15cf254..b48b25a 100644 --- a/milena/mln/core/image/dmorph/sub_image.hh +++ b/milena/mln/core/image/dmorph/sub_image.hh @@ -96,14 +96,32 @@ namespace mln - /// Image having its domain restricted by a site set. - /// - /// \ingroup modimagedomainmorpher - // + /*! Image having its domain restricted by a site set. + + <table border=0> + <tr> + <td> \image html sub_image-1.png "Input"</td> + <td> \f$\rightarrow\f$ </td> + <td> \image html sub_image-2.png "Sub image considered from input." </td> + </tr> + </table> + + Considering the following sub domain in input image: + \snippet sub_image.cc Sub domain + + The output image can be obtained using the two following ways: + \snippet sub_image.cc Operator pipe + \snippet sub_image.cc Sub_image constructor + + A full example is available in \ref examples section or directly + \link doc/examples/sub_image.cc here \endlink. + + \ingroup modimagedomainmorpher + */ template <typename I, typename S> class sub_image : public internal::image_domain_morpher< I, - S, - sub_image<I,S> > + S, + sub_image<I,S> > { public: /// Skeleton. @@ -130,12 +148,17 @@ namespace mln - + /*! \brief Shortcut to create an image restricted by a site set. + \relates mln::sub_image + */ template <typename I, typename S> sub_image<const I, S> operator|(const Image<I>& ima, const Site_Set<S>& pset); + /*! \brief Shortcut to create an image restricted by a site set. + \relates mln::sub_image + */ template <typename I, typename S> sub_image<I, S> operator|(Image<I>& ima, const Site_Set<S>& pset); -- 1.7.2.5
participants (1)
-
Guillaume Lazzara