DGtal  1.5.beta
testDigitalTopology.cpp
Go to the documentation of this file.
1 
31 #include <iostream>
32 #include "DGtal/base/Common.h"
33 #include "DGtal/kernel/SpaceND.h"
34 #include "DGtal/topology/MetricAdjacency.h"
35 #include "DGtal/topology/DigitalTopology.h"
37 
38 using namespace std;
39 using namespace DGtal;
40 
42 // Functions for testing class DigitalTopology.
44 
49 {
50  typedef SpaceND< 2 > Zi2;
51  typedef MetricAdjacency< Zi2, 1 > Adj4;
52  typedef MetricAdjacency< Zi2, 2 > Adj8;
53  Adj4 adj4;
54  Adj8 adj8;
55 
56  trace.beginBlock ( "Testing Digital topology (4,8) in Z2." );
57  typedef DigitalTopology< Adj4, Adj8 > DT48;
58  DT48 dt( adj4, adj8, JORDAN_DT );
59  trace.info() << dt << std::endl;
60  typedef DT48::ReverseTopology DT84;
61  DT84 opp_dt = dt.reverseTopology();
62  trace.info() << opp_dt << std::endl;
63  trace.endBlock();
64 
65  // should not compile
66  // typedef DigitalTopology< Adj4, bool > DTimpossible;
67  // DTimpossible dti( adj4, true );
68 
69  return true;
70 }
71 
73 // Standard services - public :
74 
75 int main( int argc, char** argv )
76 {
77  trace.beginBlock ( "Testing class DigitalTopology" );
78  trace.info() << "Args:";
79  for ( int i = 0; i < argc; ++i )
80  trace.info() << " " << argv[ i ];
81  trace.info() << endl;
82 
83  bool res = testDigitalTopologyZ2(); // && ... other tests
84  trace.emphase() << ( res ? "Passed." : "Error." ) << endl;
85  trace.endBlock();
86  return res ? 0 : 1;
87 }
88 // //
Aim: Represents a digital topology as a couple of adjacency relations.
Aim: Describes digital adjacencies in digital spaces that are defined with the 1-norm and the infinit...
void beginBlock(const std::string &keyword="")
std::ostream & emphase()
std::ostream & info()
double endBlock()
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition: Common.h:153
int main(int argc, char **argv)
bool testDigitalTopologyZ2()