DGtal  0.9.2
generateSimplicityTables3D.cpp
1 
32 #include <DGtal/topology/tables/NeighborhoodTablesGenerators.h>
34 
36 
37 using namespace std;
38 using namespace DGtal;
39 
40 int main( int argc, char** argv )
41 {
42  using namespace Z3i;
43  string error_message(
44  "Select ForegroundAdjacency for object topology:\n"
45  "- 26_6 \n"
46  "- 18_6 \n"
47  "- 6_18 \n"
48  "- 6_26 \n");
49  if (argc != 2 ){
50  cout << error_message << std::endl;
51  return 1;
52  }
53  std::string input_str = std::string(argv[1]);
54 
55  using ConfigMap = std::bitset<67108864> ; // 2^26
56  // Too big for stack. Use heap instead.
57  unique_ptr<ConfigMap> table(new ConfigMap);
58  trace.beginBlock ( "Generate 3d table for " + input_str + " topology" );
59 
60  if (input_str == "26_6")
61  functions::generateSimplicityTable< Object26_6, ConfigMap >( dt26_6, *table );
62  else if (input_str == "18_6")
63  functions::generateSimplicityTable< Object18_6, ConfigMap >( dt18_6, *table );
64  else if (input_str == "6_18")
65  functions::generateSimplicityTable< Object6_18, ConfigMap >( dt6_18, *table );
66  else if (input_str == "6_26")
67  functions::generateSimplicityTable< Object6_26, ConfigMap >( dt6_26, *table );
68  else {
69  cout << error_message << endl;
70  return 1;
71  }
72  trace.endBlock();
73 
74  string filename = "simplicity_table" + input_str + ".txt";
75  ofstream file( filename );
76  file << *table;
77  file.close();
78 
79  return 0;
80 }
81 // //
void beginBlock(const std::string &keyword="")
Trace trace
Definition: Common.h:130
STL namespace.
double endBlock()
DGtal is the top-level namespace which contains all DGtal functions and types.