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

mirror.cc

00001 // Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development
00002 // Laboratory (LRDE)
00003 //
00004 // This file is part of Olena.
00005 //
00006 // Olena is free software: you can redistribute it and/or modify it under
00007 // the terms of the GNU General Public License as published by the Free
00008 // Software Foundation, version 2 of the License.
00009 //
00010 // Olena is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013 // General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Olena.  If not, see <http://www.gnu.org/licenses/>.
00017 //
00018 // As a special exception, you may use this file as part of a free
00019 // software project without restriction.  Specifically, if other files
00020 // instantiate templates or use macros or inline functions from this
00021 // file, or you compile this file and link it with other files to produce
00022 // an executable, this file does not by itself cause the resulting
00023 // executable to be covered by the GNU General Public License.  This
00024 // exception does not however invalidate any other reasons why the
00025 // executable file might be covered by the GNU General Public License.
00026 
00028 
00029 #include <mln/core/image/image1d.hh>
00030 #include <mln/core/image/image2d.hh>
00031 #include <mln/core/image/dmorph/extended.hh>
00032 #include <mln/debug/iota.hh>
00033 #include <mln/border/mirror.hh>
00034 #include <mln/opt/element.hh>
00035 #include <mln/data/paste_without_localization.hh>
00036 #include <mln/data/compare.hh>
00037 
00038 using namespace mln;
00039 
00040 int
00041 main (void)
00042 {
00043   {
00044     image1d<int> ima(2, 3);
00045     debug::iota(ima);
00046     border::mirror(ima);
00047     mln_assertion(opt::element(ima, 0) == 2);
00048     mln_assertion(opt::element(ima, 1) == 2);
00049     mln_assertion(opt::element(ima, 2) == 1);
00050     mln_assertion(opt::element(ima, 3) == 1);
00051     mln_assertion(opt::element(ima, 4) == 2);
00052     mln_assertion(opt::element(ima, 5) == 2);
00053     mln_assertion(opt::element(ima, 6) == 1);
00054     mln_assertion(opt::element(ima, 7) == 1);
00055   }
00056 
00057 
00058   // Image2d
00059   {
00060     unsigned ref_data[6][7] = {
00061       { 1, 1, 4, 5, 6, 3, 3 },
00062       { 1, 1, 1, 2, 3, 3, 3 },
00063       { 2, 1, 1, 2, 3, 3, 2 },
00064       { 5, 4, 4, 5, 6, 6, 5 },
00065       { 4, 4, 4, 5, 6, 6, 6 },
00066       { 4, 4, 1, 2, 3, 6, 6 }
00067     };
00068 
00069 
00070     image2d<unsigned> ref = make::image(ref_data);
00071     image2d<unsigned> input(2, 3, 2);
00072     image2d<unsigned> res(6, 7, 0);
00073     debug::iota(input, 0);
00074     border::mirror(input);
00075 
00076     data::paste_without_localization(extended_to(input, input.vbbox()), res);
00077 
00078     mln_assertion(res == ref);
00079   }
00080 }

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