DGtal  1.4.beta
generateVoxelComplexTables.cpp File Reference
#include <iostream>
#include <vector>
#include "DGtal/helpers/StdDefs.h"
#include "DGtal/topology/VoxelComplexFunctions.h"
#include "DGtal/topology/tables/NeighborhoodTablesGenerators.h"
Include dependency graph for generateVoxelComplexTables.cpp:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Author
Pablo Hernandez-Cerdan (pablo.nosp@m..her.nosp@m.nande.nosp@m.z.ce.nosp@m.rdan@.nosp@m.outl.nosp@m.ook.c.nosp@m.om) Institute of Fundamental Sciences. Massey University. Palmerston North, New Zealand
Date
2018/01/01

Creates precomputed tables for all possible configurations of the neighborhood of a voxel in 3D with a topology of 26 neighbors. The table is a map between all this configurations and the result of applying an input selected predicate function to a center voxel. The options for the functions are the Skel function from

See also
VoxelComplexFunctions.h.

The options are: skelFunction = functions::oneIsthmus<VoxelComplex>; skelFunction = functions::twoIsthmus<VoxelComplex>; skelFunction = functions::skelIsthmus<VoxelComplex>;

where the latest is equivalent to (oneIsthmus OR twoIsthmus)

Isthmuses are implemented to work with 3D cubical(voxel) complexes. Right now the tables are only generated with 26_6 topology, but other 3D topologies can be added.

This file is part of the DGtal library.

Definition in file generateVoxelComplexTables.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 61 of file generateVoxelComplexTables.cpp.

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 }
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
Trace trace
Definition: Common.h:153

References DGtal::Trace::beginBlock(), DGtal::Trace::endBlock(), DGtal::Trace::info(), and DGtal::trace.