From 3828dd2805ac4a42885cc03a59564445a7162307 Mon Sep 17 00:00:00 2001 From: Bertrand Kerautret Date: Sat, 27 Jan 2024 00:14:52 +0100 Subject: [PATCH 1/2] option to change fill color --- volumetric/volFillInterior.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/volumetric/volFillInterior.cpp b/volumetric/volFillInterior.cpp index c85641e2..fcc1ceda 100644 --- a/volumetric/volFillInterior.cpp +++ b/volumetric/volFillInterior.cpp @@ -39,18 +39,22 @@ @b Allowed @b options @b are : @code Positionals: - 1 TEXT:FILE REQUIRED Input vol file. + 1 TEXT:FILE REQUIRED Input vol file. + 2 TEXT=result.vol Output filename. + 3 UINT Set the filling value other than the default value of 128. Options: -h,--help Print this help message and exit -i,--input TEXT:FILE REQUIRED Input vol file. -o,--output TEXT=result.vol Output filename. + -v,--fillValue UINT Set the filling value other than the default value of 128. + @endcode @b Example: @code - $ volFlip -i ${DGtal}/examples/samples/lobster.vol -o filled.vol + $ volFillInterior -i ${DGtal}/examples/samples/lobster.vol -o filled.vol @endcode @see @@ -87,10 +91,13 @@ void missingParam ( const std::string ¶m ) int main(int argc, char**argv) { + typedef ImageContainerBySTLVector MyImageC; + // parse command line using CLI ---------------------------------------------- CLI::App app; std::string inputFileName; std::string outputFileName {"result.vol"}; + MyImageC::Value fillValue = 128; app.description("Fill the interior of a voxel set by filling the exterior using the 6-adjacency.\nThe exterior is the set of voxels with value zero and the interior voxels have value 128\n Basic usage:\n\tvolFillInterior "); @@ -98,14 +105,15 @@ int main(int argc, char**argv) ->required() ->check(CLI::ExistingFile); app.add_option("-o,--output,2",outputFileName, "Output filename.", true); - + app.add_option("-v,--fillValue,3", fillValue, "Set the filling value other than the default value of 128.", false); + app.get_formatter()->column_width(40); CLI11_PARSE(app, argc, argv); // END parse command line using CLI ---------------------------------------------- trace.beginBlock("Loading"); - typedef ImageContainerBySTLVector MyImageC; + MyImageC image = VolReader< MyImageC >::importVol ( inputFileName ); trace.info() << image << std::endl; trace.endBlock(); @@ -142,7 +150,7 @@ int main(int argc, char**argv) trace.beginBlock("Complement"); for(auto &p : image.domain()) if ((image(p) == 0) && (!imageFlag(p))) - image.setValue(p,128); + image.setValue(p, fillValue); trace.endBlock(); trace.beginBlock("Saving"); From fc9dc43b446ae14a685de88825e4be98f5ed11f7 Mon Sep 17 00:00:00 2001 From: Bertrand Kerautret Date: Sat, 27 Jan 2024 01:24:03 +0100 Subject: [PATCH 2/2] changelog --- ChangeLog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ChangeLog.md b/ChangeLog.md index 85536db0..7c7d48b3 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -23,6 +23,8 @@ - *volumetric* - volReSample: fix the impossibility to export to vol when ITK is activated (Bertrand Kerautret [#445](https://github.com/DGtal-team/DGtalTools/pull/445)) + - volFillInterior: add new option to set the filling value. + (Bertrand Kerautret [#456](https://github.com/DGtal-team/DGtalTools/pull/456)) - *converters* - mesh2vol: small fix to read generic mesh.