$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
resize_full.cc
1 // Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE)
2 //
3 // This file is part of Olena.
4 //
5 // Olena is free software: you can redistribute it and/or modify it under
6 // the terms of the GNU General Public License as published by the Free
7 // Software Foundation, version 2 of the License.
8 //
9 // Olena is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 // General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with Olena. If not, see <http://www.gnu.org/licenses/>.
16 //
17 // As a special exception, you may use this file as part of a free
18 // software project without restriction. Specifically, if other files
19 // instantiate templates or use macros or inline functions from this
20 // file, or you compile this file and link it with other files to produce
21 // an executable, this file does not by itself cause the resulting
22 // executable to be covered by the GNU General Public License. This
23 // exception does not however invalidate any other reasons why the
24 // executable file might be covered by the GNU General Public License.
25 
26 #include <mln/core/image/image1d.hh>
27 #include <mln/core/image/image2d.hh>
28 #include <mln/core/image/image3d.hh>
29 #include <mln/value/int_u8.hh>
30 #include <mln/border/resize.hh>
31 #include <mln/border/get.hh>
32 
33 using namespace mln;
34 
35 int
36 main (void)
37 {
38  unsigned sli = 51;
39  unsigned row = 42;
40  unsigned col = 100;
41 
42 
43 
44  unsigned border1 = 1;
45  unsigned border2 = 3;
46  unsigned border3 = 42;
47  unsigned border4 = 51;
48  unsigned border5 = 36;
49  unsigned border6 = 2;
50  unsigned border7 = 0;
51  unsigned border8 = 8;
52  unsigned border9 = 1;
53 
54 
55  {
56  (std::cerr << "Test border::resize in 1d ... ").flush ();
57  image1d<value::int_u8> ima(col, border1);
58 
59  mln_assertion(border::get(ima) == border1);
60  border::resize (ima, border2);
61  mln_assertion(border::get(ima) == border2);
62  border::resize (ima, border3);
63  mln_assertion(border::get(ima) == border3);
64  border::resize (ima, border4);
65  mln_assertion(border::get(ima) == border4);
66  border::resize (ima, border5);
67  mln_assertion(border::get(ima) == border5);
68  border::resize (ima, border6);
69  mln_assertion(border::get(ima) == border6);
70  border::resize (ima, border7);
71  mln_assertion(border::get(ima) == border7);
72  border::resize (ima, border8);
73  mln_assertion(border::get(ima) == border8);
74  border::resize (ima, border9);
75  mln_assertion(border::get(ima) == border9);
76  std::cerr << "OK" << std::endl;
77  }
78 
79  {
80  (std::cerr << "Test border::resize in 2d ... ").flush ();
81  image2d<value::int_u8> ima(row, col, border1);
82 
83  mln_assertion(border::get(ima) == border1);
84  border::resize (ima, border2);
85  mln_assertion(border::get(ima) == border2);
86  border::resize (ima, border3);
87  mln_assertion(border::get(ima) == border3);
88  border::resize (ima, border4);
89  mln_assertion(border::get(ima) == border4);
90  border::resize (ima, border5);
91  mln_assertion(border::get(ima) == border5);
92  border::resize (ima, border6);
93  mln_assertion(border::get(ima) == border6);
94  border::resize (ima, border7);
95  mln_assertion(border::get(ima) == border7);
96  border::resize (ima, border8);
97  mln_assertion(border::get(ima) == border8);
98  border::resize (ima, border9);
99  mln_assertion(border::get(ima) == border9);
100  std::cerr << "OK" << std::endl;
101  }
102 
103  {
104  (std::cerr << "Test border::resize in 3d ... ").flush ();
105  image3d<value::int_u8> ima(sli, row, col, border1);
106 
107  mln_assertion(border::get(ima) == border1);
108  border::resize (ima, border2);
109  mln_assertion(border::get(ima) == border2);
110  border::resize (ima, border3);
111  mln_assertion(border::get(ima) == border3);
112  border::resize (ima, border4);
113  mln_assertion(border::get(ima) == border4);
114  border::resize (ima, border5);
115  mln_assertion(border::get(ima) == border5);
116  border::resize (ima, border6);
117  mln_assertion(border::get(ima) == border6);
118  border::resize (ima, border7);
119  mln_assertion(border::get(ima) == border7);
120  border::resize (ima, border8);
121  mln_assertion(border::get(ima) == border8);
122  border::resize (ima, border9);
123  mln_assertion(border::get(ima) == border9);
124  std::cerr << "OK" << std::endl;
125  }
126 
127 }