Commit 2212fa81 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Update tutorial - Write "Getting started with Milena".

	* doc/doxyfuns.sty: add new commands.

	* doc/examples/Makefile.am
	* doc/examples/examples.mk
	* doc/examples/fill.cc
	* doc/examples/tuto3/colorize.cc
	* doc/examples/tuto3/fill_non_generic.cc.raw
	* doc/examples/tuto3/first_routine.cc
	* doc/examples/tuto3/println.cc
	* doc/examples/tuto3/trace.cc: add new examples used in the doc.

	* doc/figures/colorize-1.pgm
	* doc/figures/colorize-2.ppm
	* doc/figures/figures.mk
	* doc/figures/fill-1.ppm
	* doc/figures/fill-2.ppm
	* doc/outputs/colorize.txt
	* doc/outputs/first_routine.txt
	* doc/outputs/outputs.mk
	* doc/outputs/println.txt
	* doc/outputs/trace.txt: add new reference files.

	* doc/ref_guide/ref_guide.tex: fix URL and missing spaces.

	* doc/tutorial/tutorial.tex: write chapter "Getting started with
	Milena".

git-svn-id: https://svn.lrde.epita.fr/svn/oln/trunk@3681 4aad255d-cdde-0310-9447-f3009e2ae8c0
parent 823aba00
2009-04-17 Guillaume Lazzara <lazzara@lrde.epita.fr>
Update tutorial - Write "Getting started with Milena".
* doc/doxyfuns.sty: add new commands.
* doc/examples/Makefile.am
* doc/examples/examples.mk
* doc/examples/fill.cc
* doc/examples/tuto3/colorize.cc
* doc/examples/tuto3/fill_non_generic.cc.raw
* doc/examples/tuto3/first_routine.cc
* doc/examples/tuto3/println.cc
* doc/examples/tuto3/trace.cc: add new examples used in the doc.
* doc/figures/colorize-1.pgm
* doc/figures/colorize-2.ppm
* doc/figures/figures.mk
* doc/figures/fill-1.ppm
* doc/figures/fill-2.ppm
* doc/outputs/colorize.txt
* doc/outputs/first_routine.txt
* doc/outputs/outputs.mk
* doc/outputs/println.txt
* doc/outputs/trace.txt: add new reference files.
* doc/ref_guide/ref_guide.tex: fix URL and missing spaces.
* doc/tutorial/tutorial.tex: write chapter "Getting started with
Milena".
2009-04-15 Guillaume Lazzara <lazzara@lrde.epita.fr>
 
Small fixes.
......@@ -225,3 +225,7 @@ $$
\textbf{\textit{#1}}
}
\newcommand{\B}[1]{
\textbf{#1}
}
......@@ -17,6 +17,7 @@ noinst_PROGRAMS = \
fill-subdomain \
fill-subdomain-shorter \
fill-subimage-cfun \
first_routine \
forall-piter \
fun-p2v-1 \
graph-data \
......@@ -50,6 +51,13 @@ tuto2_first_image \
tuto3_rw_image \
tuto4_genericity_and_algorithms
# Tuto3
noinst_PROGRAMS += \
colorize \
println \
trace
accu_right_instanciation_SOURCES = accu-right-instanciation.cc
borderthickness_SOURCES = borderthickness.cc
box2d_bbox_SOURCES = box2d-bbox.cc
......@@ -64,6 +72,7 @@ fill_part_image_SOURCES = fill-part-image.cc
fill_subdomain_SOURCES = fill-subdomain.cc
fill_subdomain_shorter_SOURCES = fill-subdomain-shorter.cc
fill_subimage_cfun_SOURCES = fill-subimage-cfun.cc
first_routine_SOURCES = tuto3/first_routine.cc
forall_piter_SOURCES = forall-piter.cc
fun_p2v_1_SOURCES = fun-p2v-1.cc
graph_data_SOURCES = graph-data.cc
......@@ -95,6 +104,11 @@ tuto2_first_image_SOURCES = tuto2_first_image.cc
tuto3_rw_image_SOURCES = tuto3_rw_image.cc
tuto4_genericity_and_algorithms_SOURCES = tuto4_genericity_and_algorithms.cc
# Tuto 3
colorize_SOURCES = tuto3/colorize.cc
println_SOURCES = tuto3/println.cc
trace_SOURCES = tuto3/trace.cc
all: clean-figures
mkdir -p $(OUTPUTS_BUILDDIR)
mkdir -p $(FIGURES_BUILDDIR)
......@@ -171,7 +185,7 @@ fix-refdata:
split-samples:
mkdir -p $(EXAMPLES_BUILDDIR)
@failcom='exit 1'; \
list='$(EXAMPLES_SRCDIR)/*.cc'; for file in $$list; do \
list=`find $(EXAMPLES_SRCDIR) -type f -name '*.cc'`; for file in $$list; do \
$(DOC_SRCDIR)/tools/split_sample.sh $$file cc $(EXAMPLES_BUILDDIR)\
|| eval $$failcom; \
done
......
......@@ -48,13 +48,21 @@ examples/point-1.cc \
examples/box2d-bbox.cc \
examples/forall-piter.cc \
examples/ima-size.cc \
examples/tuto2 \
examples/examples.mk \
examples/tuto4 \
examples/borderthickness.cc \
examples/Makefile.in \
examples/ima-load.cc \
examples/ima-has.cc \
examples/win-create-1.cc \
examples/samples.mk \
examples/tuto3 \
examples/tuto3/fill_non_generic.cc.raw \
examples/tuto3/colorize.cc \
examples/tuto3/println.cc \
examples/tuto3/trace.cc \
examples/tuto3/first_routine.cc \
examples/accu-wrong-instanciation.cc.raw \
examples/accu-right-instanciation.cc \
examples/ima2d-5.cc \
......
#include <mln/essential/2d.hh>
#include <tests/data.hh>
#include <doc/tools/sample_utils.hh>
// \{
template <typename I>
......@@ -12,4 +14,19 @@ void fill(I& ima, mln_value(I) v)
int main()
{
using namespace mln;
image2d<value::rgb8> ima;
io::ppm::load(ima, MLN_IMG_DIR "/small.ppm");
// \{
box2d b(20,20);
fill((ima | b).rw(), literal::green);
// \}
doc::ppmsave(ima, "fill");
// \{
fill(ima, literal::green);
// \}
doc::ppmsave(ima, "fill");
}
#include <mln/core/image/image2d.hh>
#include <mln/make/image2d.hh>
#include <mln/value/int_u8.hh>
#include <mln/debug/colorize.hh>
#include <doc/tools/sample_utils.hh>
int main()
{
using namespace mln;
using namespace mln::value;
// \{
int_u8 vals[25] = { 100, 100, 200, 200, 230,
100, 100, 200, 230, 230,
140, 140, 140, 0, 0,
65, 186, 65, 127, 127,
65, 65, 65, 127, 127 };
image2d<int_u8> ima = make::image2d(vals);
image2d<rgb8> ima_color = debug::colorize(rgb8(), ima, 230);
// \}
doc::pgmsave(ima, "colorize");
doc::ppmsave(ima_color, "colorize");
}
// Java or C -like code
void fill(image ima, unsigned char v)
{
for (int i = 0; i < ima->nrows; ++i)
for (int j = 0; j < ima->ncols; ++j)
ima->data[i][j] = v;
}
#include <mln/essential/2d.hh>
#include <tests/data.hh>
#include <doc/tools/sample_utils.hh>
// \{
namespace mln
{
template <typename I, typename N>
mln_concrete(I)
my_algorithm(const Image<I>& ima_,
const Neighborhood<N>& nbh_)
{
trace::entering("my_algorithm");
const I& ima = exact(ima_);
const N& nbh = exact(nbh_);
mln_precondition(ima.is_valid());
mln_precondition(nbh.is_valid());
typedef value::label_8 V;
V nlabels;
mln_ch_value(I,V) lbl = labeling::blobs(ima, nbh, nlabels);
util::array<unsigned>
count = labeling::compute(accu::meta::count(), lbl, nlabels);
mln_concrete(I) output;
initialize(output, ima);
data::fill(output, literal::one);
for (unsigned i = 1; i <= nlabels; ++i)
if (count[i] < 10u)
data::fill((output | pw::value(lbl) == pw::cst(i)).rw(), literal::zero);
trace::exiting("my_algorithm");
return output;
}
} // end of namespace mln
// \}
namespace sandbox
{
using namespace mln;
// \{
template <typename I, typename N>
mln_concrete(I)
my_algorithm(const Image<I>& ima_,
const Neighborhood<N>& nbh_)
// \}
{
// \{
trace::entering("my_algorithm");
// \}
// \{
const I& ima = exact(ima_);
const N& nbh = exact(nbh_);
mln_precondition(ima.is_valid());
mln_precondition(nbh.is_valid());
// \}
// \{
typedef value::label_8 V;
V nlabels;
mln_ch_value(I,V) lbl = labeling::blobs(ima, nbh, nlabels);
util::array<unsigned>
count = labeling::compute(accu::meta::count(), lbl, nlabels);
// \}
// \{
mln_concrete(I) output;
initialize(output, ima);
data::fill(output, literal::one);
// \}
// \{
for (unsigned i = 1; i <= nlabels; ++i)
if (count[i] < 10u)
data::fill((output | pw::value(lbl) == pw::cst(i)).rw(), literal::zero);
// \}
// \{
trace::exiting("my_algorithm");
return output;
// \}
}
} // end of namespace mln
int main()
{
mln::image2d<bool> test(2,2);
mln_assertion(sandbox::my_algorithm(test, mln::c4())
== mln::my_algorithm(test, mln::c4()));
}
#include <mln/core/image/image2d.hh>
#include <mln/data/fill.hh>
#include <mln/border/fill.hh>
#include <mln/value/int_u8.hh>
#include <mln/debug/println.hh>
#include <mln/debug/println_with_border.hh>
int main()
{
using namespace mln;
using namespace mln::value;
{
std::cout << "// \\{" << std::endl;
// \{
image2d<int_u8> ima(5,5);
data::fill(ima, 2);
debug::println(ima);
// \}
std::cout << "// \\}" << std::endl;
}
{
std::cout << "// \\{" << std::endl;
// \{
image2d<int_u8> ima(5,5);
data::fill(ima, 2);
border::fill(ima, 7);
debug::println_with_border(ima);
// \}
std::cout << "// \\}" << std::endl;
}
}
#include <mln/core/image/image2d.hh>
#include <mln/value/label_8.hh>
#include <mln/labeling/blobs.hh>
#include <mln/core/alias/neighb2d.hh>
#include <mln/geom/bbox.hh>
int main()
{
using namespace mln;
using namespace mln::value;
image2d<bool> ima(200,300);
label_8 nlabels;
// \{
// ...
trace::quiet = false;
labeling::blobs(ima, c4(), nlabels);
trace::quiet = true;
geom::bbox(ima);
// ...
// \}
}
......@@ -27,6 +27,7 @@ figures/logical-not-3.pbm \
figures/tuto4_genericity_and_algorithms-3.pbm \
figures/tuto4_genericity_and_algorithms-1.ppm \
figures/extend-4.ppm \
figures/fill-2.ppm \
figures/tuto4_genericity_and_algorithms-8.ppm \
figures/labeling-compute-1.pbm \
figures/tuto3_rw_image-3.ppm \
......@@ -35,4 +36,5 @@ figures/tuto4_genericity_and_algorithms-8.pgm \
figures/extend-2.ppm \
figures/tuto4_genericity_and_algorithms-2.ppm \
figures/fill-subdomain-1.pbm \
figures/fill-1.ppm \
figures/tuto3_rw_image-2.ppm
......@@ -7,6 +7,7 @@ outputs/accu-right-instanciation.txt \
outputs/extend.txt \
outputs/ima2d-1.txt \
outputs/borderthickness.txt \
outputs/first_routine.txt \
outputs/ima-save.txt \
outputs/fill-subimage-cfun.txt \
outputs/labeling-compute.txt \
......
// \{
2 2 2 2 2
2 2 2 2 2
2 2 2 2 2
2 2 2 2 2
2 2 2 2 2
// \}
// \{
7 7 7 7 7 7 7 7 7 7 7
7 7 7 7 7 7 7 7 7 7 7
7 7 7 7 7 7 7 7 7 7 7
7 7 7 2 2 2 2 2 7 7 7
7 7 7 2 2 2 2 2 7 7 7
7 7 7 2 2 2 2 2 7 7 7
7 7 7 2 2 2 2 2 7 7 7
7 7 7 2 2 2 2 2 7 7 7
7 7 7 7 7 7 7 7 7 7 7
7 7 7 7 7 7 7 7 7 7 7
7 7 7 7 7 7 7 7 7 7 7
// \}
labeling::blobs {
core::initialize {}
data::fill {
data::fill_with_value {
data::impl::fill_with_value_one_block {
data::memset_ {
data::impl::memset_ {}
} data::memset_
} data::impl::fill_with_value_one_block
} data::fill_with_value
} data::fill
} labeling::blobs - 0.08s
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment