DGtal
2.2.0
Toggle main menu visibility
Loading...
Searching...
No Matches
generateSimplicityTables3D.cpp
Go to the documentation of this file.
1
16
31
33
#include <DGtal/topology/tables/NeighborhoodTablesGenerators.h>
34
35
// For saving compressed tables.
36
#include <boost/iostreams/filtering_streambuf.hpp>
37
#include <boost/iostreams/copy.hpp>
38
#include <boost/iostreams/filter/zlib.hpp>
39
41
42
using namespace
std
;
43
using namespace
DGtal
;
44
45
int
main
(
int
argc,
char
** argv )
46
{
47
using namespace
Z3i
;
48
string
error_message(
49
"Select ForegroundAdjacency for object topology:\n"
50
"- 26_6 \n"
51
"- 18_6 \n"
52
"- 6_18 \n"
53
"- 6_26 \n"
);
54
if
(argc != 2 ){
55
cout << error_message << std::endl;
56
return
1;
57
}
58
std::string input_str = std::string(argv[1]);
59
60
using
ConfigMap
= std::bitset<67108864> ;
// 2^26
61
// Too big for stack. Use heap instead.
62
unique_ptr<ConfigMap> table(
new
ConfigMap
);
63
trace
.
beginBlock
(
"Generate 3d table for "
+ input_str +
" topology"
);
64
65
if
(input_str ==
"26_6"
)
66
functions::generateSimplicityTable< Object26_6, ConfigMap >
( dt26_6, *table );
67
else
if
(input_str ==
"18_6"
)
68
functions::generateSimplicityTable< Object18_6, ConfigMap >
( dt18_6, *table );
69
else
if
(input_str ==
"6_18"
)
70
functions::generateSimplicityTable< Object6_18, ConfigMap >
( dt6_18, *table );
71
else
if
(input_str ==
"6_26"
)
72
functions::generateSimplicityTable< Object6_26, ConfigMap >
( dt6_26, *table );
73
else
{
74
cout << error_message << endl;
75
return
1;
76
}
77
trace
.
endBlock
();
78
79
// string filename = "simplicity_table" + input_str + ".txt";
80
// ofstream file( filename );
81
// file << *table;
82
// file.close();
83
{
84
string
filename =
"simplicity_table"
+ input_str +
".zlib"
;
85
ofstream file( filename );
86
std::stringstream table_stream;
87
table_stream << *table;
88
namespace
io = boost::iostreams;
89
io::filtering_streambuf<io::input> filter;
90
filter.push(io::zlib_compressor());
91
filter.push(table_stream);
92
io::copy(filter,file);
93
file.close();
94
}
95
96
return
0;
97
}
98
// //
DGtal::Trace::beginBlock
void beginBlock(const std::string &keyword="")
DGtal::Trace::endBlock
double endBlock()
ConfigMap
std::vector< bool > ConfigMap
Definition
fullConvexityLUT2D.cpp:76
DGtal::Z3i
Z3i this namespace gathers the standard of types for 3D imagery.
DGtal::functions::generateSimplicityTable
void generateSimplicityTable(const typename TObject::DigitalTopology &dt, TMap &map)
Definition
NeighborhoodTablesGenerators.h:71
DGtal
DGtal is the top-level namespace which contains all DGtal functions and types.
Definition
ClosedIntegerHalfPlane.h:49
DGtal::trace
Trace trace
std
STL namespace.
main
int main(int, char **)
Definition
testIntegerComputer.cpp:331
examples
topology
generateSimplicityTables3D.cpp
Generated on
for DGtal by
1.18.0