• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List

fill-part-image.cc

00001 #include <mln/core/image/image2d.hh>
00002 #include <mln/core/var.hh>
00003 #include <mln/core/site_set/p_array.hh>
00004 
00005 #include <mln/value/int_u8.hh>
00006 #include <mln/value/label_8.hh>
00007 
00008 #include <mln/make/image.hh>
00009 
00010 #include <mln/data/fill.hh>
00011 
00012 #include <mln/debug/println.hh>
00013 
00014 int main()
00015 {
00016   using namespace mln;
00017   using value::int_u8;
00018   using value::label_8;
00019 
00020 
00021   // \{
00022   bool vals[6][5] = {
00023       {0, 1, 1, 0, 0},
00024       {0, 1, 1, 0, 0},
00025       {0, 0, 0, 0, 0},
00026       {1, 1, 0, 1, 0},
00027       {1, 0, 1, 1, 1},
00028       {1, 0, 0, 0, 0}
00029   };
00030   image2d<bool> ima = make::image(vals);
00031   // \}
00032 
00033   // \{
00034   p_array<point2d> arr;
00035 
00036   // We add two points in the array.
00037   arr.append(point2d(0, 1));
00038   arr.append(point2d(4, 0));
00039 
00040   // We restrict the image to the sites
00041   // contained in arr and fill these ones
00042   // with 0.
00043   // We must call "rw()" here.
00044   data::fill((ima | arr).rw(), 0);
00045 
00046   debug::println((ima | arr));
00047 
00048   mln_VAR(ima2, ima | arr);
00049   // We do not need to call "rw()" here.
00050   data::fill(ima2, 0);
00051   // \}
00052 
00053   debug::println(ima2);
00054 }

Generated on Tue Oct 4 2011 15:23:46 for Milena (Olena) by  doxygen 1.7.1