DGtal 1.3.0
Loading...
Searching...
No Matches
generateVoxelComplexTables.cpp
Go to the documentation of this file.
1
46#include <iostream>
47#include <vector>
48#include "DGtal/helpers/StdDefs.h"
49#include "DGtal/topology/VoxelComplexFunctions.h"
50#include "DGtal/topology/tables/NeighborhoodTablesGenerators.h"
51
53
54using namespace std;
55using namespace DGtal;
56
58
59
60
61int main( int argc, char** argv )
62{
63 typedef std::bitset<67108864> ConfigMap; // 2^26
64
65 using namespace Z3i;
67
68 std::function< bool(
69 const VoxelComplex & ,
70 const typename VoxelComplex::Cell & )
71 > skelFunction;
72 string error_message(
73 "Provide one of the following arguments for select function:\n"
74 "- skelIsthmus \n"
75 "- oneIsthmus \n"
76 "- twoIsthmus \n");
77 if (argc != 2 ){
78 cout << error_message << std::endl;
79 return 1;
80 }
81 std::string input_str = std::string(argv[1]);
82 if (input_str == "skelIsthmus")
83 skelFunction = functions::skelIsthmus<VoxelComplex>;
84 else if (input_str == "oneIsthmus")
85 skelFunction = functions::oneIsthmus<VoxelComplex>;
86 else if (input_str == "twoIsthmus")
87 skelFunction = functions::twoIsthmus<VoxelComplex>;
88 else{
89 cout << error_message << endl;
90 return 1;
91 }
92
93 trace.beginBlock ( "Generate " + input_str + " table for 26_6 topology" );
94 // Too big for stack. Use heap instead.
95 auto table26_6 = make_shared<ConfigMap>();
96 functions::generateVoxelComplexTable< VoxelComplex >(
97 *table26_6,
98 skelFunction );
99
100 string filename = input_str + "_table26_6.txt";
101 trace.info() << "Save to file... " + filename << std::endl;
102 ofstream file26_6( filename );
103 file26_6 << *table26_6;
104 file26_6.close();
105
106 trace.endBlock();
107
108 return 0;
109}
110// //
void beginBlock(const std::string &keyword="")
std::ostream & info()
double endBlock()
This class represents a voxel complex living in some Khalimsky space. Voxel complexes are derived fro...
Definition: VoxelComplex.h:91
typename KSpace::Cell Cell
Definition: VoxelComplex.h:114
std::vector< bool > ConfigMap
DGtal is the top-level namespace which contains all DGtal functions and types.
Trace trace
Definition: Common.h:154
STL namespace.
int main()
Definition: testBits.cpp:56