diff --git a/ChangeLog.md b/ChangeLog.md index 47bc194e..add30418 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -33,6 +33,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. 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");