31 #include "DGtal/base/Common.h"
32 #include "DGtal/helpers/StdDefs.h"
34 #include "DGtal/io/readers/GenericReader.h"
35 #include "DGtal/io/writers/GenericWriter.h"
36 #include "DGtal/images/ConstImageAdapter.h"
37 #include "DGtal/kernel/BasicPointFunctors.h"
43 using namespace DGtal;
98 int main(
int argc,
char** argv )
110 std::string inputFileName;
111 std::string outputFileName {
"result.vol"};
112 std::vector<double> aGridSizeReSample;
114 app.description(
"Re sample a 3D volumetric image (.vol, .longvol, .pgm3d) with a given grid size. \n Example:\n to re sample an image with scale x,y,z = 0.98, 0.98, 5.0, you can do:\n volResSample -i image3d.vol -g 1 1 2 -o imageReSampled.vol \n "
115 "Note that if DGtal is compiled with the option WITH_ITK set to ON, you can export the image in format ITK format and integrating image spacing.");
116 app.add_option(
"-i,--input,1", inputFileName,
"input volumetric file (.vol, .longvol, .pgm3d)." )
118 ->check(CLI::ExistingFile);
119 app.add_option(
"-o,--output,2", outputFileName,
"the new volumetric file (.vol, .longvol, .pgm3d).",
true );
120 app.add_option(
"-g,--gridSize", aGridSizeReSample,
"size_x size_y size_z : the grid size of the re sampling ")
122 app.get_formatter()->column_width(40);
123 CLI11_PARSE(app, argc, argv);
127 trace.
info()<<
"Importing volume file : " << inputFileName<<
" ... " ;
134 aGridSizeReSample, shiftVector3D);
136 SamplerImageAdapter sampledImage ( input3dImage, reSampler.getSubSampledDomain(), reSampler, aFunctor );
138 const std::string ext = outputFileName.substr( outputFileName.find_last_of(
".") + 1 );
139 if (std::find(ITK_IO_IMAGE_EXT.begin(),
140 ITK_IO_IMAGE_EXT.end(), ext) != ITK_IO_IMAGE_EXT.end() )
144 aGridSizeReSample[1],
145 aGridSizeReSample[2]));
int main(int argc, char **argv)
const Domain & domain() const
Trace trace(traceWriterTerm)