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

resize_full.cc

00001 // Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
00002 //
00003 // This file is part of Olena.
00004 //
00005 // Olena is free software: you can redistribute it and/or modify it under
00006 // the terms of the GNU General Public License as published by the Free
00007 // Software Foundation, version 2 of the License.
00008 //
00009 // Olena is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012 // General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Olena.  If not, see <http://www.gnu.org/licenses/>.
00016 //
00017 // As a special exception, you may use this file as part of a free
00018 // software project without restriction.  Specifically, if other files
00019 // instantiate templates or use macros or inline functions from this
00020 // file, or you compile this file and link it with other files to produce
00021 // an executable, this file does not by itself cause the resulting
00022 // executable to be covered by the GNU General Public License.  This
00023 // exception does not however invalidate any other reasons why the
00024 // executable file might be covered by the GNU General Public License.
00025 
00026 #include <mln/core/image/image1d.hh>
00027 #include <mln/core/image/image2d.hh>
00028 #include <mln/core/image/image3d.hh>
00029 #include <mln/value/int_u8.hh>
00030 #include <mln/border/resize.hh>
00031 #include <mln/border/get.hh>
00032 
00033 using namespace mln;
00034 
00035 int
00036 main (void)
00037 {
00038   unsigned sli = 51;
00039   unsigned row = 42;
00040   unsigned col = 100;
00041 
00042 
00043 
00044   unsigned border1 = 1;
00045   unsigned border2 = 3;
00046   unsigned border3 = 42;
00047   unsigned border4 = 51;
00048   unsigned border5 = 36;
00049   unsigned border6 = 2;
00050   unsigned border7 = 0;
00051   unsigned border8 = 8;
00052   unsigned border9 = 1;
00053 
00054 
00055   {
00056     (std::cerr << "Test border::resize in 1d ... ").flush ();
00057     image1d<value::int_u8> ima(col, border1);
00058 
00059     mln_assertion(border::get(ima) == border1);
00060     border::resize (ima, border2);
00061     mln_assertion(border::get(ima) == border2);
00062     border::resize (ima, border3);
00063     mln_assertion(border::get(ima) == border3);
00064     border::resize (ima, border4);
00065     mln_assertion(border::get(ima) == border4);
00066     border::resize (ima, border5);
00067     mln_assertion(border::get(ima) == border5);
00068     border::resize (ima, border6);
00069     mln_assertion(border::get(ima) == border6);
00070     border::resize (ima, border7);
00071     mln_assertion(border::get(ima) == border7);
00072     border::resize (ima, border8);
00073     mln_assertion(border::get(ima) == border8);
00074     border::resize (ima, border9);
00075     mln_assertion(border::get(ima) == border9);
00076     std::cerr << "OK" << std::endl;
00077   }
00078 
00079   {
00080     (std::cerr << "Test border::resize in 2d ... ").flush ();
00081     image2d<value::int_u8> ima(row, col, border1);
00082 
00083     mln_assertion(border::get(ima) == border1);
00084     border::resize (ima, border2);
00085     mln_assertion(border::get(ima) == border2);
00086     border::resize (ima, border3);
00087     mln_assertion(border::get(ima) == border3);
00088     border::resize (ima, border4);
00089     mln_assertion(border::get(ima) == border4);
00090     border::resize (ima, border5);
00091     mln_assertion(border::get(ima) == border5);
00092     border::resize (ima, border6);
00093     mln_assertion(border::get(ima) == border6);
00094     border::resize (ima, border7);
00095     mln_assertion(border::get(ima) == border7);
00096     border::resize (ima, border8);
00097     mln_assertion(border::get(ima) == border8);
00098     border::resize (ima, border9);
00099     mln_assertion(border::get(ima) == border9);
00100     std::cerr << "OK" << std::endl;
00101   }
00102 
00103   {
00104     (std::cerr << "Test border::resize in 3d ... ").flush ();
00105     image3d<value::int_u8> ima(sli, row, col, border1);
00106 
00107     mln_assertion(border::get(ima) == border1);
00108     border::resize (ima, border2);
00109     mln_assertion(border::get(ima) == border2);
00110     border::resize (ima, border3);
00111     mln_assertion(border::get(ima) == border3);
00112     border::resize (ima, border4);
00113     mln_assertion(border::get(ima) == border4);
00114     border::resize (ima, border5);
00115     mln_assertion(border::get(ima) == border5);
00116     border::resize (ima, border6);
00117     mln_assertion(border::get(ima) == border6);
00118     border::resize (ima, border7);
00119     mln_assertion(border::get(ima) == border7);
00120     border::resize (ima, border8);
00121     mln_assertion(border::get(ima) == border8);
00122     border::resize (ima, border9);
00123     mln_assertion(border::get(ima) == border9);
00124     std::cerr << "OK" << std::endl;
00125   }
00126 
00127 }

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