$extrastylesheet
Olena  User documentation 2.1
An Image Processing Platform
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
is_simple_pair.cc
1 // Copyright (C) 2011 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 
28 
29 #include <mln/core/alias/complex_image.hh>
30 #include <mln/core/image/complex_neighborhoods.hh>
31 
32 #include <mln/topo/is_simple_pair.hh>
33 
34 #include <mln/io/vtk/load.hh>
35 
36 #include "tests/data.hh"
37 
38 
39 int
40 main()
41 {
42  // Image type.
43  typedef mln::bin_2complex_image3df ima_t;
44  // Dimension of the image (and thus of the complex).
45  static const unsigned D = ima_t::dim;
46  // Geometry of the image.
47  typedef mln_geom_(ima_t) G;
48 
49  ima_t ima;
50  mln::io::vtk::load(ima, MLN_MESH_DIR "/pseudo-manifold.vtk");
51 
52  // Neighborhood type returning the set of (n-1)-faces adjacent to a
53  // an n-face.
54  typedef mln::complex_lower_neighborhood<D, G> lower_adj_nbh_t;
55  lower_adj_nbh_t lower_adj_nbh;
56  // Neighborhood type returning the set of (n+1)-faces adjacent to a
57  // an n-face.
58  typedef mln::complex_higher_neighborhood<D, G> higher_adj_nbh_t;
59  higher_adj_nbh_t higher_adj_nbh;
60  // Predicate type: does a triangle (2-face) belongs to a simple pair?
61  typedef mln::topo::is_simple_pair< ima_t,
62  lower_adj_nbh_t,
63  higher_adj_nbh_t > is_simple_t;
64 
65  // Check the simplicity of IMA's faces.
66  is_simple_t is_simple(ima, lower_adj_nbh, higher_adj_nbh);
67  mln_piter_(ima_t) p(ima.domain());
68  for_all(p)
69  {
70  if (is_simple(p))
71  std::cout << p << std::endl;
72  }
73 }