Skip to content

Commit

Permalink
Merge branch 'master' into docvolscope
Browse files Browse the repository at this point in the history
  • Loading branch information
kerautret committed May 26, 2024
2 parents 1a882b5 + 8f6338f commit 3a7ea32
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
18 changes: 13 additions & 5 deletions volumetric/volFillInterior.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -87,25 +91,29 @@ void missingParam ( const std::string &param )

int main(int argc, char**argv)
{
typedef ImageContainerBySTLVector<Z3i::Domain, unsigned char> 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 <volFileName> <volOutputFileName> ");

app.add_option("-i,--input,1", inputFileName, "Input vol file." )
->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<Z3i::Domain, unsigned char> MyImageC;

MyImageC image = VolReader< MyImageC >::importVol ( inputFileName );
trace.info() << image << std::endl;
trace.endBlock();
Expand Down Expand Up @@ -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");
Expand Down

0 comments on commit 3a7ea32

Please sign in to comment.