62 #include <DGtal/base/Common.h> 63 #include <DGtal/io/readers/VolReader.h> 64 #include <DGtal/io/writers/VolWriter.h> 65 #include <DGtal/helpers/StdDefs.h> 66 #include <DGtal/images/Image.h> 67 #include <DGtal/images/ImageContainerBySTLVector.h> 72 using namespace DGtal;
80 void missingParam (
const std::string ¶m )
82 trace.
error() <<
" Parameter: "<<param<<
" is required..";
88 int main(
int argc,
char**argv)
92 std::string inputFileName;
93 std::string outputFileName {
"result.vol"};
95 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> ");
97 app.add_option(
"-i,--input,1", inputFileName,
"Input vol file." )
99 ->check(CLI::ExistingFile);
100 app.add_option(
"-o,--output,2",outputFileName,
"Output filename.",
true);
102 app.get_formatter()->column_width(40);
103 CLI11_PARSE(app, argc, argv);
115 for(
auto &p: imageFlag.domain())
121 std::stack<Z3i::Point> pstack;
122 pstack.push(*(image.domain().begin()));
123 FATAL_ERROR_MSG(image(pstack.top())==0,
"Starting point of the domain must be equal to zero.");
126 std::vector<Z3i::Point> pencil6= { {1,0,0}, {0,1,0}, {0,0,1},{-1,0,0}, {0,-1,0}, {0,0,-1} };
129 while (!pstack.empty())
133 imageFlag.setValue(p,
true);
135 for(
auto & delta: pencil6)
136 if ((image.domain().isInside(p + delta)) &&
137 (imageFlag( p + delta) ==
false))
138 pstack.push( p + delta);
143 for(
auto &p : image.domain())
144 if ((image(p) == 0) && (!imageFlag(p)))
145 image.setValue(p,128);
152 if (res)
return 0;
else return 1;
void beginBlock(const std::string &keyword="")
int main(int argc, char **argv)
Trace trace(traceWriterTerm)
void setValue(const Point &aPoint, const Value &aValue)