Creates precomputed tables for determining whether some point is simple within an 3D object.
#include <DGtal/topology/tables/NeighborhoodTablesGenerators.h>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/zlib.hpp>
int main(
int argc,
char** argv )
{
using namespace Z3i;
string error_message(
"Select ForegroundAdjacency for object topology:\n"
"- 26_6 \n"
"- 18_6 \n"
"- 6_18 \n"
"- 6_26 \n");
if (argc != 2 ){
cout << error_message << std::endl;
return 1;
}
std::string input_str = std::string(argv[1]);
trace.
beginBlock (
"Generate 3d table for " + input_str +
" topology" );
if (input_str == "26_6")
functions::generateSimplicityTable< Object26_6, ConfigMap >( dt26_6, *table );
else if (input_str == "18_6")
functions::generateSimplicityTable< Object18_6, ConfigMap >( dt18_6, *table );
else if (input_str == "6_18")
functions::generateSimplicityTable< Object6_18, ConfigMap >( dt6_18, *table );
else if (input_str == "6_26")
functions::generateSimplicityTable< Object6_26, ConfigMap >( dt6_26, *table );
else {
cout << error_message << endl;
return 1;
}
{
string filename = "simplicity_table" + input_str + ".zlib";
ofstream file( filename );
std::stringstream table_stream;
table_stream << *table;
namespace io = boost::iostreams;
io::filtering_streambuf<io::input> filter;
filter.push(io::zlib_compressor());
filter.push(table_stream);
io::copy(filter,file);
file.close();
}
return 0;
}
void beginBlock(const std::string &keyword="")
std::vector< bool > ConfigMap
DGtal is the top-level namespace which contains all DGtal functions and types.