From 845e17152327e9a7005e9abf3339b3037fcd7689 Mon Sep 17 00:00:00 2001 From: hadjiszs Date: Thu, 29 Sep 2016 22:01:57 +0200 Subject: [PATCH 01/11] add mesh voxelizer --- converters/CMakeLists.txt | 3 +- converters/mesh2vol.cpp | 176 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 178 insertions(+), 1 deletion(-) create mode 100644 converters/mesh2vol.cpp diff --git a/converters/CMakeLists.txt b/converters/CMakeLists.txt index 61044905..1aac2d32 100644 --- a/converters/CMakeLists.txt +++ b/converters/CMakeLists.txt @@ -19,7 +19,8 @@ SET(DGTAL_TOOLS_SRC vol2heightfield heightfield2vol heightfield2shading - mesh2heightfield) + mesh2heightfield + mesh2vol) if( WITH_HDF5 ) SET(DGTAL_TOOLS_SRC ${DGTAL_TOOLS_SRC} diff --git a/converters/mesh2vol.cpp b/converters/mesh2vol.cpp new file mode 100644 index 00000000..38f0c016 --- /dev/null +++ b/converters/mesh2vol.cpp @@ -0,0 +1,176 @@ +/** + * 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 . + * + **/ +/** + * @file mesh2vol.cpp + * @ingroup converters + * + * @date 2016/09/28 + * + * + * + * This file is part of the DGtalTools. + */ + +/////////////////////////////////////////////////////////////////////////////// +#include +#include +#include + +#include "DGtal/shapes/MeshVoxelizer.h" +#include "DGtal/kernel/sets/CDigitalSet.h" +#include "DGtal/kernel/domains/HyperRectDomain.h" +#include "DGtal/io/readers/MeshReader.h" +#include "DGtal/io/Display3D.h" + +#include +#include +#include + +using namespace std; +using namespace DGtal; + + +/////////////////////////////////////////////////////////////////////////////// +namespace po = boost::program_options; + +/** + @page mesh2vol + @brief Convert a mesh file into a 26-separated or 6-separated voxelization in a given resolution grid. + +@b Usage: mesh2vol [input] + +@b Allowed @b options @b are: + +@code + -h [ --help ] display this message + -i [ --input ] arg mesh file (.off) + -o [ --output ] arg filename of ouput voxelization file (.off) + (auto-generated by argument values if empty) + -s [ --separation ] arg (=6) voxelization 6-separated or 26-separated. + -r [ --resolution ] arg (=64) resolution grid. + +@endcode + +@b Example: +@code + $ mesh2vol -i ${DGtal}/examples/samples/tref.off --separation 26 --resolution 256 +@endcode + +@see mesh2vol.cpp + +*/ + +template< unsigned int SEP > +void voxelizeAndExport(std::string inputFilename, + std::string outputFilename, + unsigned int resolution) { + + using Space3Dint = SpaceND<3>; + using Domain = HyperRectDomain; + using PointR3 = PointVector<3, double>; + using PointZ3 = PointVector<3, int>; + + trace.info() << "Reading input file: " << inputFilename; + + Mesh inputMesh; + + unsigned int base = resolution/2; // move center of digital set to (0;0;0) + Domain aDomain( PointZ3(-base, -base, -base), + PointZ3( base, base, base) ); + + MeshReader::importOFFFile(inputFilename.c_str(), inputMesh); + trace.info() << " [done]" << std::endl; + trace.info() << "Voxelization " << SEP << "-separated ; " << resolution << "^3 "; + + MeshVoxelizer, SEP> aVoxelizer(inputMesh, aDomain, resolution); + auto start = std::chrono::high_resolution_clock::now(); + aVoxelizer.voxelize(); + auto end = std::chrono::high_resolution_clock::now(); + auto diff = end - start; + + trace.info() << " [done] (" << std::chrono::duration (diff).count() << " ms)" << std::endl; + + // Export the digital set to a off file + Display3D<> viewer; + viewer << aVoxelizer.digitalSet(); + viewer >> outputFilename.c_str(); +} + +int main( int argc, char** argv ) +{ + // parse command line ---------------------------------------------- + po::options_description general_opt("\nAllowed options are"); + general_opt.add_options() + ("help,h", "display this message") + ("input,i", po::value(), "mesh file (.off) " ) + ("output,o", po::value(), "filename of ouput voxelization file (.off) (auto-generated by argument values if empty)") + ("separation,s", po::value()->default_value(6), "voxelization 6-separated or 26-separated." ) + ("resolution,r", po::value()->default_value(64), "resolution grid." ); + + bool parseOK=true; + po::variables_map vm; + try { + po::store(po::parse_command_line(argc, argv, general_opt), vm); + } catch(const std::exception& ex) { + parseOK=false; + trace.info() << "Error checking program options: " << ex.what() << endl; + } + + po::notify(vm); + + if(!parseOK || vm.count("help") || argc < 1) + { + std::cout << "Usage: " << argv[0] << " [input]\n" + << "Convert a mesh file into a 26-separated or 6-separated volumetric voxelization in a given resolution grid." + << general_opt << "\n"; + std::cout << "Example:\n" + << "mesh2vol -i ${DGtal}/examples/samples/tref.off --separation 26 --resolution 256 \n"; + return -1; + } + + if( !vm.count("input") ) + { + trace.error() << " Input filename is needed to be defined" << endl; + return -1; + } + + if( vm["separation"].as() != 6 && + vm["separation"].as() != 26 ) + { + trace.error() << " Separation should be 6 or 26" << endl; + return -1; + } + + unsigned int separation = vm["separation"].as(); + unsigned int resolution = vm["resolution"].as(); + string inputFilename = vm["input"].as(); + string outputFilename; + + if( vm.count("ouput") ) + outputFilename = vm["output"].as(); + else + outputFilename = inputFilename.substr(0, inputFilename.size()-4) + "_s" + + std::to_string(separation) + "_r" + + std::to_string(resolution) + ".off"; + + if(separation == 6) + voxelizeAndExport<6>(inputFilename, outputFilename, resolution); + else if(separation == 26) + voxelizeAndExport<26>(inputFilename, outputFilename, resolution); + + return 0; +} + From f0bec97d8adc5a3bf664918162a688846803ff53 Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Sat, 12 Nov 2016 15:25:26 +0100 Subject: [PATCH 02/11] WIP --- converters/mesh2vol.cpp | 39 +++++++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/converters/mesh2vol.cpp b/converters/mesh2vol.cpp index 38f0c016..08a4b1f7 100644 --- a/converters/mesh2vol.cpp +++ b/converters/mesh2vol.cpp @@ -55,12 +55,13 @@ namespace po = boost::program_options; @b Allowed @b options @b are: @code - -h [ --help ] display this message - -i [ --input ] arg mesh file (.off) - -o [ --output ] arg filename of ouput voxelization file (.off) - (auto-generated by argument values if empty) - -s [ --separation ] arg (=6) voxelization 6-separated or 26-separated. - -r [ --resolution ] arg (=64) resolution grid. + -h [ --help ] display this message + -i [ --input ] arg mesh file (.off) + -o [ --output ] arg filename of ouput voxelization file (.off) + (auto-generated by argument values if empty) + -s [ --separation ] arg (=6) voxelization 6-separated or 26-separated. + -d [ --domainSize ] arg (=64) digitization domain size. + -f [ --scaleFactor ] arg (=1.0) scale factor to apply to the mesh @endcode @@ -74,9 +75,11 @@ namespace po = boost::program_options; */ template< unsigned int SEP > -void voxelizeAndExport(std::string inputFilename, - std::string outputFilename, - unsigned int resolution) { +void voxelizeAndExport(const std::string inputFilename, + const std::string outputFilename, + const unsigned int resolution, + const double scaleFactor) +{ using Space3Dint = SpaceND<3>; using Domain = HyperRectDomain; @@ -95,9 +98,11 @@ void voxelizeAndExport(std::string inputFilename, trace.info() << " [done]" << std::endl; trace.info() << "Voxelization " << SEP << "-separated ; " << resolution << "^3 "; - MeshVoxelizer, SEP> aVoxelizer(inputMesh, aDomain, resolution); + //Digitization step + DigitalSetBySTLSet mySet(aDomain); + MeshVoxelizer, SEP> aVoxelizer; auto start = std::chrono::high_resolution_clock::now(); - aVoxelizer.voxelize(); + aVoxelizer.voxelize(mySet,inputMesh,scaleFactor); auto end = std::chrono::high_resolution_clock::now(); auto diff = end - start; @@ -105,7 +110,7 @@ void voxelizeAndExport(std::string inputFilename, // Export the digital set to a off file Display3D<> viewer; - viewer << aVoxelizer.digitalSet(); + viewer << mySet; viewer >> outputFilename.c_str(); } @@ -118,7 +123,8 @@ int main( int argc, char** argv ) ("input,i", po::value(), "mesh file (.off) " ) ("output,o", po::value(), "filename of ouput voxelization file (.off) (auto-generated by argument values if empty)") ("separation,s", po::value()->default_value(6), "voxelization 6-separated or 26-separated." ) - ("resolution,r", po::value()->default_value(64), "resolution grid." ); + ("scaleFactor,f", po::value()->default_value(1.0), "scale factor to apply to the mesh." ) + ("domainSize,d", po::value()->default_value(64), "digitization domain size." ); bool parseOK=true; po::variables_map vm; @@ -158,7 +164,8 @@ int main( int argc, char** argv ) unsigned int resolution = vm["resolution"].as(); string inputFilename = vm["input"].as(); string outputFilename; - + double scaleFactor = vm["scaleFactor"].as(); + if( vm.count("ouput") ) outputFilename = vm["output"].as(); else @@ -167,9 +174,9 @@ int main( int argc, char** argv ) + std::to_string(resolution) + ".off"; if(separation == 6) - voxelizeAndExport<6>(inputFilename, outputFilename, resolution); + voxelizeAndExport<6>(inputFilename, outputFilename, resolution, scaleFactor); else if(separation == 26) - voxelizeAndExport<26>(inputFilename, outputFilename, resolution); + voxelizeAndExport<26>(inputFilename, outputFilename, resolution, scaleFactor); return 0; } From 36d7be087b9b5ceeeadcb0c2cf5cfa78eeb511a7 Mon Sep 17 00:00:00 2001 From: mhadji Date: Mon, 5 Jun 2017 20:36:04 +0200 Subject: [PATCH 03/11] minor change --- converters/mesh2vol.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/converters/mesh2vol.cpp b/converters/mesh2vol.cpp index 08a4b1f7..4902a849 100644 --- a/converters/mesh2vol.cpp +++ b/converters/mesh2vol.cpp @@ -101,8 +101,12 @@ void voxelizeAndExport(const std::string inputFilename, //Digitization step DigitalSetBySTLSet mySet(aDomain); MeshVoxelizer, SEP> aVoxelizer; + double factor = scaleFactor; + if(factor == 1.0) + factor = resolution / inputMesh.getBoundingBox().second[0]; + auto start = std::chrono::high_resolution_clock::now(); - aVoxelizer.voxelize(mySet,inputMesh,scaleFactor); + aVoxelizer.voxelize(mySet, inputMesh, factor); auto end = std::chrono::high_resolution_clock::now(); auto diff = end - start; @@ -119,12 +123,12 @@ int main( int argc, char** argv ) // parse command line ---------------------------------------------- po::options_description general_opt("\nAllowed options are"); general_opt.add_options() - ("help,h", "display this message") - ("input,i", po::value(), "mesh file (.off) " ) - ("output,o", po::value(), "filename of ouput voxelization file (.off) (auto-generated by argument values if empty)") - ("separation,s", po::value()->default_value(6), "voxelization 6-separated or 26-separated." ) - ("scaleFactor,f", po::value()->default_value(1.0), "scale factor to apply to the mesh." ) - ("domainSize,d", po::value()->default_value(64), "digitization domain size." ); + ("help,h", "display this message") + ("input,i", po::value(), "mesh file (.off) " ) + ("output,o", po::value(), "filename of ouput voxelization file (.off) (auto-generated by argument values if empty)") + ("separation,s", po::value()->default_value(6), "voxelization 6-separated or 26-separated." ) + ("scaleFactor,f", po::value()->default_value(1.0), "scale factor to apply to the mesh." ) + ("domainSize,d", po::value()->default_value(64), "digitization domain size." ); bool parseOK=true; po::variables_map vm; @@ -139,7 +143,7 @@ int main( int argc, char** argv ) if(!parseOK || vm.count("help") || argc < 1) { - std::cout << "Usage: " << argv[0] << " [input]\n" + std::cout << "Usage: " << argv[0] << " -i [input]\n" << "Convert a mesh file into a 26-separated or 6-separated volumetric voxelization in a given resolution grid." << general_opt << "\n"; std::cout << "Example:\n" @@ -161,7 +165,7 @@ int main( int argc, char** argv ) } unsigned int separation = vm["separation"].as(); - unsigned int resolution = vm["resolution"].as(); + unsigned int resolution = vm["domainSize"].as(); string inputFilename = vm["input"].as(); string outputFilename; double scaleFactor = vm["scaleFactor"].as(); From 12db9cf990bbb0bae6b91f1e5f3df0d658314fda Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Tue, 31 Oct 2017 15:17:21 +0100 Subject: [PATCH 04/11] Working on the unit test --- converters/mesh2vol.cpp | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/converters/mesh2vol.cpp b/converters/mesh2vol.cpp index 4902a849..fb63b4d6 100644 --- a/converters/mesh2vol.cpp +++ b/converters/mesh2vol.cpp @@ -34,7 +34,8 @@ #include "DGtal/kernel/domains/HyperRectDomain.h" #include "DGtal/io/readers/MeshReader.h" #include "DGtal/io/Display3D.h" - +#include "DGtal/io/writers/GenericWriter.h" +#include "DGtal/images/ImageContainerBySTLVector.h" #include #include #include @@ -112,10 +113,15 @@ void voxelizeAndExport(const std::string inputFilename, trace.info() << " [done] (" << std::chrono::duration (diff).count() << " ms)" << std::endl; - // Export the digital set to a off file - Display3D<> viewer; - viewer << mySet; - viewer >> outputFilename.c_str(); + // Export the digital set to a vol file + trace.info()< image(aDomain); + for(auto p: mySet) + { + trace.info()<<"Adding "<> outputFilename.c_str(); } int main( int argc, char** argv ) @@ -125,7 +131,7 @@ int main( int argc, char** argv ) general_opt.add_options() ("help,h", "display this message") ("input,i", po::value(), "mesh file (.off) " ) - ("output,o", po::value(), "filename of ouput voxelization file (.off) (auto-generated by argument values if empty)") + ("output,o", po::value(), "filename of ouput volumetric file (Vol,PGM3D,..).") ("separation,s", po::value()->default_value(6), "voxelization 6-separated or 26-separated." ) ("scaleFactor,f", po::value()->default_value(1.0), "scale factor to apply to the mesh." ) ("domainSize,d", po::value()->default_value(64), "digitization domain size." ); @@ -170,13 +176,15 @@ int main( int argc, char** argv ) string outputFilename; double scaleFactor = vm["scaleFactor"].as(); - if( vm.count("ouput") ) + if( vm.count("output") ) outputFilename = vm["output"].as(); else - outputFilename = inputFilename.substr(0, inputFilename.size()-4) + "_s" - + std::to_string(separation) + "_r" - + std::to_string(resolution) + ".off"; - + { + trace.error()<<"Missing output parameter '--output'"<(inputFilename, outputFilename, resolution, scaleFactor); else if(separation == 26) From c47db7d7d7bde02f6ccf2b6a0ffce93846698201 Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Tue, 31 Oct 2017 15:55:21 +0100 Subject: [PATCH 05/11] better scaling --- converters/mesh2vol.cpp | 79 ++++++++++++++++++++++++----------------- 1 file changed, 47 insertions(+), 32 deletions(-) diff --git a/converters/mesh2vol.cpp b/converters/mesh2vol.cpp index fb63b4d6..4891e180 100644 --- a/converters/mesh2vol.cpp +++ b/converters/mesh2vol.cpp @@ -28,7 +28,7 @@ #include #include #include - +#include "DGtal/helpers/StdDefs.h" #include "DGtal/shapes/MeshVoxelizer.h" #include "DGtal/kernel/sets/CDigitalSet.h" #include "DGtal/kernel/domains/HyperRectDomain.h" @@ -61,14 +61,13 @@ namespace po = boost::program_options; -o [ --output ] arg filename of ouput voxelization file (.off) (auto-generated by argument values if empty) -s [ --separation ] arg (=6) voxelization 6-separated or 26-separated. - -d [ --domainSize ] arg (=64) digitization domain size. - -f [ --scaleFactor ] arg (=1.0) scale factor to apply to the mesh + -r [ --resolution ] digitization domain size (e.g. 128). The mesh will be scaled such that its bounding box maps to [0,resolution)^3. @endcode @b Example: @code - $ mesh2vol -i ${DGtal}/examples/samples/tref.off --separation 26 --resolution 256 + $ mesh2vol -i ${DGtal}/examples/samples/tref.off --separation 26 --resolution 256 -o output.vol @endcode @see mesh2vol.cpp @@ -78,41 +77,50 @@ namespace po = boost::program_options; template< unsigned int SEP > void voxelizeAndExport(const std::string inputFilename, const std::string outputFilename, - const unsigned int resolution, - const double scaleFactor) + const unsigned int resolution) { + using Domain = Z3i::Domain; + using PointR3 = Z3i::RealPoint; + using PointZ3 = Z3i::Point; - using Space3Dint = SpaceND<3>; - using Domain = HyperRectDomain; - using PointR3 = PointVector<3, double>; - using PointZ3 = PointVector<3, int>; - + trace.beginBlock("Preparing the mesh"); trace.info() << "Reading input file: " << inputFilename; - Mesh inputMesh; - - unsigned int base = resolution/2; // move center of digital set to (0;0;0) - Domain aDomain( PointZ3(-base, -base, -base), - PointZ3( base, base, base) ); - MeshReader::importOFFFile(inputFilename.c_str(), inputMesh); trace.info() << " [done]" << std::endl; + const std::pair bbox = inputMesh.getBoundingBox(); + trace.info()<< "Mesh bounding box: "< mySet(aDomain); - MeshVoxelizer, SEP> aVoxelizer; - double factor = scaleFactor; - if(factor == 1.0) - factor = resolution / inputMesh.getBoundingBox().second[0]; + Z3i::DigitalSet mySet(aDomain); + MeshVoxelizer aVoxelizer; auto start = std::chrono::high_resolution_clock::now(); - aVoxelizer.voxelize(mySet, inputMesh, factor); + aVoxelizer.voxelize(mySet, inputMesh, 1.0); auto end = std::chrono::high_resolution_clock::now(); auto diff = end - start; trace.info() << " [done] (" << std::chrono::duration (diff).count() << " ms)" << std::endl; - + trace.endBlock(); + + trace.beginBlock("Exporting"); // Export the digital set to a vol file trace.info()< image(aDomain); @@ -122,6 +130,7 @@ void voxelizeAndExport(const std::string inputFilename, image.setValue(p, 128); } image >> outputFilename.c_str(); + trace.endBlock(); } int main( int argc, char** argv ) @@ -133,8 +142,7 @@ int main( int argc, char** argv ) ("input,i", po::value(), "mesh file (.off) " ) ("output,o", po::value(), "filename of ouput volumetric file (Vol,PGM3D,..).") ("separation,s", po::value()->default_value(6), "voxelization 6-separated or 26-separated." ) - ("scaleFactor,f", po::value()->default_value(1.0), "scale factor to apply to the mesh." ) - ("domainSize,d", po::value()->default_value(64), "digitization domain size." ); + ("resolution,r", po::value(), "digitization domain size (e.g. 128). The mesh will be scaled such that its bounding box maps to [0,resolution)^3." ); bool parseOK=true; po::variables_map vm; @@ -153,7 +161,7 @@ int main( int argc, char** argv ) << "Convert a mesh file into a 26-separated or 6-separated volumetric voxelization in a given resolution grid." << general_opt << "\n"; std::cout << "Example:\n" - << "mesh2vol -i ${DGtal}/examples/samples/tref.off --separation 26 --resolution 256 \n"; + << "mesh2vol -i ${DGtal}/examples/samples/tref.off -o output.vol --separation 26 --resolution 256 \n"; return -1; } @@ -171,10 +179,17 @@ int main( int argc, char** argv ) } unsigned int separation = vm["separation"].as(); - unsigned int resolution = vm["domainSize"].as(); + unsigned int resolution; + if (vm.count("resolution")) + resolution = vm["resolution"].as(); + else + { + trace.error()<<"Missing output parameter '--resolution'"<(); string outputFilename; - double scaleFactor = vm["scaleFactor"].as(); if( vm.count("output") ) outputFilename = vm["output"].as(); @@ -186,9 +201,9 @@ int main( int argc, char** argv ) if(separation == 6) - voxelizeAndExport<6>(inputFilename, outputFilename, resolution, scaleFactor); + voxelizeAndExport<6>(inputFilename, outputFilename, resolution); else if(separation == 26) - voxelizeAndExport<26>(inputFilename, outputFilename, resolution, scaleFactor); + voxelizeAndExport<26>(inputFilename, outputFilename, resolution); return 0; } From bb02458b9a4dc062105d79611f53e000b1234311 Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Tue, 31 Oct 2017 16:02:42 +0100 Subject: [PATCH 06/11] better scaling --- converters/mesh2vol.cpp | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/converters/mesh2vol.cpp b/converters/mesh2vol.cpp index 4891e180..d5d76335 100644 --- a/converters/mesh2vol.cpp +++ b/converters/mesh2vol.cpp @@ -111,13 +111,8 @@ void voxelizeAndExport(const std::string inputFilename, //Digitization step Z3i::DigitalSet mySet(aDomain); MeshVoxelizer aVoxelizer; - - auto start = std::chrono::high_resolution_clock::now(); aVoxelizer.voxelize(mySet, inputMesh, 1.0); - auto end = std::chrono::high_resolution_clock::now(); - auto diff = end - start; - - trace.info() << " [done] (" << std::chrono::duration (diff).count() << " ms)" << std::endl; + trace.info() << " [done] " << std::endl; trace.endBlock(); trace.beginBlock("Exporting"); @@ -125,10 +120,7 @@ void voxelizeAndExport(const std::string inputFilename, trace.info()< image(aDomain); for(auto p: mySet) - { - trace.info()<<"Adding "<> outputFilename.c_str(); trace.endBlock(); } From 302669006b7bc32cc02f2d379032b9cc0ed77250 Mon Sep 17 00:00:00 2001 From: David Coeurjolly Date: Mon, 4 Dec 2017 14:14:07 +0100 Subject: [PATCH 07/11] minor edit to reload travis --- converters/mesh2vol.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/converters/mesh2vol.cpp b/converters/mesh2vol.cpp index d5d76335..08d7519e 100644 --- a/converters/mesh2vol.cpp +++ b/converters/mesh2vol.cpp @@ -43,7 +43,6 @@ using namespace std; using namespace DGtal; - /////////////////////////////////////////////////////////////////////////////// namespace po = boost::program_options; From 835e2a4df0b4337859a2045a4b697a68049fa762 Mon Sep 17 00:00:00 2001 From: Monir Hadji Date: Wed, 6 Dec 2017 22:48:07 +0100 Subject: [PATCH 08/11] Pass string by reference --- converters/mesh2vol.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/converters/mesh2vol.cpp b/converters/mesh2vol.cpp index 08d7519e..560440dd 100644 --- a/converters/mesh2vol.cpp +++ b/converters/mesh2vol.cpp @@ -74,8 +74,8 @@ namespace po = boost::program_options; */ template< unsigned int SEP > -void voxelizeAndExport(const std::string inputFilename, - const std::string outputFilename, +void voxelizeAndExport(const std::string& inputFilename, + const std::string& outputFilename, const unsigned int resolution) { using Domain = Z3i::Domain; From 2e3b5779f86d97b0136c2ac1646d91e791c874bb Mon Sep 17 00:00:00 2001 From: Kerautret Date: Thu, 11 Jan 2018 02:06:50 +0100 Subject: [PATCH 09/11] adding doc link --- doc/converters.dox | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/converters.dox b/doc/converters.dox index d2c63ac6..f08a92a1 100644 --- a/doc/converters.dox +++ b/doc/converters.dox @@ -36,6 +36,7 @@ Utilities to convert various simple file formats: - @ref itk2vol : converts itk file into a volumetric file (.vol, .pgm3d). - @ref longvol2vol : converts a longvol (long int) to a vol file (unsigned char). - @ref mesh2heightfield : converts a mesh file into a 2D heightmap (from a normal direction N and from a starting point P). + - @ref mesh2vol : converts a mesh file into a 26-separated or 6-separated voxelization in a given resolution grid. - @ref ofs2off : converts OFS file into OFF mesh format. - @ref raw2HDF5 : converts a 3D 8-bit raw file to HDF5. - @ref raw2vol : converts a 8-bit raw file to vol. From 645a3ad0808eb19c562fb467d96247e9de726ca0 Mon Sep 17 00:00:00 2001 From: Monir Hadji Date: Thu, 11 Jan 2018 20:20:17 +0100 Subject: [PATCH 10/11] Fix typos --- converters/mesh2vol.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/converters/mesh2vol.cpp b/converters/mesh2vol.cpp index 560440dd..9b46f126 100644 --- a/converters/mesh2vol.cpp +++ b/converters/mesh2vol.cpp @@ -17,7 +17,7 @@ * @file mesh2vol.cpp * @ingroup converters * - * @date 2016/09/28 + * @date 2018/01/11 * * * @@ -57,7 +57,7 @@ namespace po = boost::program_options; @code -h [ --help ] display this message -i [ --input ] arg mesh file (.off) - -o [ --output ] arg filename of ouput voxelization file (.off) + -o [ --output ] arg filename of ouput volumetric file (vol, pgm3d, ...) (auto-generated by argument values if empty) -s [ --separation ] arg (=6) voxelization 6-separated or 26-separated. -r [ --resolution ] digitization domain size (e.g. 128). The mesh will be scaled such that its bounding box maps to [0,resolution)^3. @@ -131,7 +131,7 @@ int main( int argc, char** argv ) general_opt.add_options() ("help,h", "display this message") ("input,i", po::value(), "mesh file (.off) " ) - ("output,o", po::value(), "filename of ouput volumetric file (Vol,PGM3D,..).") + ("output,o", po::value(), "filename of ouput volumetric file (vol, pgm3d, ...).") ("separation,s", po::value()->default_value(6), "voxelization 6-separated or 26-separated." ) ("resolution,r", po::value(), "digitization domain size (e.g. 128). The mesh will be scaled such that its bounding box maps to [0,resolution)^3." ); From 7411292aaf1a773ef09b96cc326c188c0a56b0f7 Mon Sep 17 00:00:00 2001 From: Monir Hadji Date: Thu, 11 Jan 2018 20:25:39 +0100 Subject: [PATCH 11/11] New entry in the ChangeLog --- ChangeLog.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index dfeb24b3..6cf6329f 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,9 @@ # DGtalTools 0.9.4 - *visualisation*: + - New tool for mesh voxelization from a mesh in input (.off) + to a volumetric output (vol, pgm3d) + [#279](https://github.com/DGtal-team/DGtalTools/pull/279) - Improve visualisation tools (vol2heightfield, vol2obj, vol2raw, vol2sdp, vol2slice, volBoundary2obj, 3dImageViewer, 3dVolViewer, sliceViewer, Viewer3DImage) allowing to read longvol including rescaling. (Bertrand Kerautret, [#296](https://github.com/DGtal-team/DGtalTools/pull/296))