From 7de7d70f75d155d609d34ac28fd73481644394d5 Mon Sep 17 00:00:00 2001 From: Kerautret Date: Sun, 4 Mar 2018 17:00:55 +0100 Subject: [PATCH 1/3] add option for marge --- converters/mesh2vol.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/converters/mesh2vol.cpp b/converters/mesh2vol.cpp index 9b46f126..ae9abe39 100644 --- a/converters/mesh2vol.cpp +++ b/converters/mesh2vol.cpp @@ -76,7 +76,8 @@ namespace po = boost::program_options; template< unsigned int SEP > void voxelizeAndExport(const std::string& inputFilename, const std::string& outputFilename, - const unsigned int resolution) + const unsigned int resolution, + const unsigned int margin) { using Domain = Z3i::Domain; using PointR3 = Z3i::RealPoint; @@ -105,7 +106,7 @@ void voxelizeAndExport(const std::string& inputFilename, trace.beginBlock("Voxelization"); trace.info() << "Voxelization " << SEP << "-separated ; " << resolution << "^3 "; - Domain aDomain(PointZ3().diagonal(0), PointZ3().diagonal(resolution)); + Domain aDomain(PointZ3().diagonal(-margin), PointZ3().diagonal(resolution+margin)); //Digitization step Z3i::DigitalSet mySet(aDomain); @@ -132,6 +133,7 @@ int main( int argc, char** argv ) ("help,h", "display this message") ("input,i", po::value(), "mesh file (.off) " ) ("output,o", po::value(), "filename of ouput volumetric file (vol, pgm3d, ...).") + ("margin,m", po::value()->default_value(0), "add margin around bounding box shape.") ("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." ); @@ -168,7 +170,7 @@ int main( int argc, char** argv ) trace.error() << " Separation should be 6 or 26" << endl; return -1; } - + unsigned int margin = vm["margin"].as(); unsigned int separation = vm["separation"].as(); unsigned int resolution; if (vm.count("resolution")) @@ -192,9 +194,9 @@ int main( int argc, char** argv ) if(separation == 6) - voxelizeAndExport<6>(inputFilename, outputFilename, resolution); + voxelizeAndExport<6>(inputFilename, outputFilename, resolution, margin); else if(separation == 26) - voxelizeAndExport<26>(inputFilename, outputFilename, resolution); + voxelizeAndExport<26>(inputFilename, outputFilename, resolution, margin); return 0; } From 48faf2aacff453c936f5abcef637aa825b357e8e Mon Sep 17 00:00:00 2001 From: Kerautret Date: Sun, 4 Mar 2018 17:02:21 +0100 Subject: [PATCH 2/3] doc --- converters/mesh2vol.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/converters/mesh2vol.cpp b/converters/mesh2vol.cpp index ae9abe39..5f17923a 100644 --- a/converters/mesh2vol.cpp +++ b/converters/mesh2vol.cpp @@ -59,6 +59,7 @@ namespace po = boost::program_options; -i [ --input ] arg mesh file (.off) -o [ --output ] arg filename of ouput volumetric file (vol, pgm3d, ...) (auto-generated by argument values if empty) + -m [ --margin ] arg (=0) add volume margin around the mesh bounding box. -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. @@ -133,7 +134,7 @@ int main( int argc, char** argv ) ("help,h", "display this message") ("input,i", po::value(), "mesh file (.off) " ) ("output,o", po::value(), "filename of ouput volumetric file (vol, pgm3d, ...).") - ("margin,m", po::value()->default_value(0), "add margin around bounding box shape.") + ("margin,m", po::value()->default_value(0), "add volume margin around the mesh bounding box.") ("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 fca7e0b2e9a336069267b70c158cb5b20da1dea6 Mon Sep 17 00:00:00 2001 From: Kerautret Date: Sun, 4 Mar 2018 17:12:29 +0100 Subject: [PATCH 3/3] change log --- ChangeLog.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 60a878c3..1453514c 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,11 @@ # DGtalTools 0.9.4 - *converters* + + + - mesh2vol: add option to add margin in the generated volume + (to better extract the surfel boudary near domain limits). + (Bertrand Kerautret, [#322](https://github.com/DGtal-team/pull/322)) - vol2vox/vox2vol: tools to convert vol file to a MagicaVoxel VOX file and conversly. (David Coeurjolly, [#314](https://github.com/DGtal-team/pull/314))