DGtalTools  1.5.beta
convertVol.cpp
1 
30 #include <iostream>
31 #include "DGtal/base/Common.h"
32 #include "DGtal/helpers/StdDefs.h"
33 
34 #include "DGtal/io/readers/GenericReader.h"
35 #include "DGtal/io/writers/GenericWriter.h"
36 
37 #include "CLI11.hpp"
38 
39 using namespace std;
40 using namespace DGtal;
41 
77 int main( int argc, char** argv )
78 {
80 
81  // parse command line using CLI ----------------------------------------------
82  CLI::App app;
83  std::string inputFileName;
84  std::string outputFileName {"result.vol"};
85 
86  app.description("Convert volumetric file into volumetric file from different formats (pgm3d, vol, longvol)\n ");
87  app.add_option("-i,--input,1", inputFileName, "volumetric file (.pgm3d, .vol, .longvol)." )
88  ->required()
89  ->check(CLI::ExistingFile);
90  app.add_option("-o,--output,2", outputFileName, "volumetric file (.pgm3d, .vol, .longvol)", true);
91 
92  app.get_formatter()->column_width(40);
93  CLI11_PARSE(app, argc, argv);
94  // END parse command line using CLI ----------------------------------------------
95 
96  trace.info() << "Reading input file " << inputFileName ;
97  Image3D inputImage = DGtal::GenericReader<Image3D>::import(inputFileName);
98  trace.info() << " [done] " << std::endl ;
99  trace.info() << "Writing output file " << outputFileName ;
100  DGtal::GenericWriter<Image3D>::exportFile(outputFileName, inputImage);
101  trace.info() << " [done] " << std::endl ;
102 
103  return EXIT_SUCCESS;
104 }
int main(int argc, char **argv)
std::ostream & info()
Trace trace(traceWriterTerm)
static TContainer import(const std::string &filename, std::vector< unsigned int > dimSpace=std::vector< unsigned int >())
static bool exportFile(const std::string &filename, const TContainer &anImage, const TFunctor &aFunctor=TFunctor())