$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
fill-part-image.cc
1 #include <mln/core/image/image2d.hh>
2 #include <mln/core/var.hh>
3 #include <mln/core/site_set/p_array.hh>
4 
5 #include <mln/value/int_u8.hh>
6 #include <mln/value/label_8.hh>
7 
8 #include <mln/make/image.hh>
9 
10 #include <mln/data/fill.hh>
11 
12 #include <mln/debug/println.hh>
13 
14 int main()
15 {
16  using namespace mln;
17  using value::int_u8;
18  using value::label_8;
19 
20 
21  // \{
22  bool vals[6][5] = {
23  {0, 1, 1, 0, 0},
24  {0, 1, 1, 0, 0},
25  {0, 0, 0, 0, 0},
26  {1, 1, 0, 1, 0},
27  {1, 0, 1, 1, 1},
28  {1, 0, 0, 0, 0}
29  };
30  image2d<bool> ima = make::image(vals);
31  // \}
32 
33  // \{
34  p_array<point2d> arr;
35 
36  // We add two points in the array.
37  arr.append(point2d(0, 1));
38  arr.append(point2d(4, 0));
39 
40  // We restrict the image to the sites
41  // contained in arr and fill these ones
42  // with 0.
43  // We must call "rw()" here.
44  data::fill((ima | arr).rw(), 0);
45 
46  debug::println((ima | arr));
47 
48  mln_VAR(ima2, ima | arr);
49  // We do not need to call "rw()" here.
50  data::fill(ima2, 0);
51  // \}
52 
53  debug::println(ima2);
54 }