66 #include <DGtal/base/Common.h>
67 #include <DGtal/io/readers/VolReader.h>
68 #include <DGtal/io/writers/VolWriter.h>
69 #include <DGtal/helpers/StdDefs.h>
70 #include <DGtal/images/Image.h>
71 #include <DGtal/images/ImageContainerBySTLVector.h>
76 using namespace DGtal;
84 void missingParam (
const std::string ¶m )
86 trace.
error() <<
" Parameter: "<<param<<
" is required..";
92 int main(
int argc,
char**argv)
98 std::string inputFileName;
99 std::string outputFileName {
"result.vol"};
100 MyImageC::Value fillValue = 128;
102 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> ");
104 app.add_option(
"-i,--input,1", inputFileName,
"Input vol file." )
106 ->check(CLI::ExistingFile);
107 app.add_option(
"-o,--output,2",outputFileName,
"Output filename.",
true);
108 app.add_option(
"-v,--fillValue,3", fillValue,
"Set the filling value other than the default value of 128.",
false);
110 app.get_formatter()->column_width(40);
111 CLI11_PARSE(app, argc, argv);
123 for(
auto &p: imageFlag.domain())
126 imageFlag.setValue(p,
true);
129 std::stack<Z3i::Point> pstack;
130 pstack.push(*(image.domain().begin()));
131 FATAL_ERROR_MSG(image(pstack.top())==0,
"Starting point of the domain must be equal to zero.");
134 std::vector<Z3i::Point> pencil6= { {1,0,0}, {0,1,0}, {0,0,1},{-1,0,0}, {0,-1,0}, {0,0,-1} };
137 while (!pstack.empty())
141 imageFlag.setValue(p,
true);
143 for(
auto & delta: pencil6)
144 if ((image.domain().isInside(p + delta)) &&
145 (imageFlag( p + delta) ==
false))
146 pstack.push( p + delta);
151 for(
auto &p : image.domain())
152 if ((image(p) == 0) && (!imageFlag(p)))
153 image.setValue(p, fillValue);
160 if (res)
return 0;
else return 1;
int main(int argc, char **argv)
void beginBlock(const std::string &keyword="")
Trace trace(traceWriterTerm)