Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option to change default fill color #456

Merged
merged 4 commits into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ChangeLog.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,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
Loading