Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include "Options.hpp"
00009
00010 namespace reconstruct{
00011
00012 Options::Options(int argc, char** argv) : m_descr("Supported options")
00013 {
00014
00015
00016
00017 m_descr.add_options()
00018 ("help", "Produce help message")
00019 ("inputFile", value< vector<string> >(), "Input file name. Supported formats are ASCII (.pts, .xyz) and .ply")
00020 ("voxelsize,v", value<float>(&m_voxelsize)->default_value(10), "Voxelsize of grid used for reconstruction.")
00021 ("saveFaceNormals", "Writes all interpolated triangle normals together with triangle centroid to a file called 'face_normals.nor'")
00022 ("cluster,c", "Extract planes and write result to 'planes.ply'")
00023 ("optimizeCluster,o", "Shift all triangle vertices of a cluster onto their shared plane")
00024 ("savePointsAndNormals,s", "Exports original point cloud data together with normals into a single file called 'points_and_normals.ply'")
00025 ("recalcNormals,r", "Always estimate normals, even if given in .ply file.")
00026 ("threads,t", value<int>(&m_numThreads)->default_value(4), "Number of threads")
00027 ("saveNormals", "Writes all points and interpolated normals to a file called 'normals.nor'")
00028 ("kd", value<int>(&m_kd)->default_value(5), "Number of normals used for distance function evaluation")
00029 ("ki", value<int>(&m_ki)->default_value(10), "Number of normals used in the normal interpolation process")
00030 ("kn", value<int>(&m_kn)->default_value(10), "Size of k-neighborhood used for normal estimation")
00031 ("intersections,i", value<int>(&m_intersections)->default_value(-1), "Number of intersections used for reconstruction. If other than -1, voxelsize will calculated automatically.")
00032 ;
00033
00034 m_pdescr.add("inputFile", -1);
00035
00036
00037 store(command_line_parser(argc, argv).options(m_descr).positional(m_pdescr).run(), m_variables);
00038 notify(m_variables);
00039
00040 if(m_variables.count("help")) {
00041 ::std::cout<< m_descr << ::std::endl;
00042 exit(-1);
00043 }
00044
00045
00046 }
00047
00048 float Options::getVoxelsize() const
00049 {
00050 return m_variables["voxelsize"].as<float>();
00051 }
00052
00053 int Options::getNumThreads() const
00054 {
00055 return m_variables["threads"].as<int>();
00056 }
00057
00058 int Options::getKi() const
00059 {
00060 return m_variables["ki"].as<int>();
00061 }
00062
00063 int Options::getKd() const
00064 {
00065 return m_variables["kd"].as<int>();
00066 }
00067
00068 int Options::getKn() const
00069 {
00070 return m_variables["kn"].as<int>();
00071 }
00072
00073 int Options::getIntersections() const
00074 {
00075 return m_variables["intersections"].as<int>();
00076 }
00077
00078 string Options::getInputFileName() const
00079 {
00080 return (m_variables["inputFile"].as< vector<string> >())[0];
00081 }
00082
00083 bool Options::printUsage() const
00084 {
00085 if(!m_variables.count("inputFile"))
00086 {
00087 cout << "Error: You must specify an input file." << endl;
00088 cout << endl;
00089 cout << m_descr << endl;
00090 return true;
00091 }
00092
00093 if(m_variables.count("help"))
00094 {
00095 cout << endl;
00096 cout << m_descr << endl;
00097 return true;
00098 }
00099 return false;
00100 }
00101
00102 bool Options::saveFaceNormals() const
00103 {
00104 return m_variables.count("saveFaceNormals");
00105 }
00106
00107 bool Options::filenameSet() const
00108 {
00109 return (m_variables["inputFile"].as< vector<string> >()).size() > 0;
00110 }
00111
00112 bool Options::createClusters() const
00113 {
00114 return (m_variables.count("cluster"));
00115 }
00116
00117 bool Options::recalcNormals() const
00118 {
00119 return (m_variables.count("recalcNormals"));
00120 }
00121
00122 bool Options::savePointsAndNormals() const
00123 {
00124 return (m_variables.count("savePointsAndNormals"));
00125 }
00126
00127 bool Options::saveNormals() const
00128 {
00129 return (m_variables.count("saveNormals"));
00130 }
00131
00132 bool Options::optimizeClusters() const
00133 {
00134 return createClusters() && m_variables.count("optimizeCluster");
00135 }
00136
00137 Options::~Options() {
00138
00139 }
00140
00141 }