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"
38 #include <boost/program_options/options_description.hpp>
39 #include <boost/program_options/parsers.hpp>
40 #include <boost/program_options/variables_map.hpp>
43 using namespace DGtal;
76 namespace po = boost::program_options;
79 int main(
int argc,
char** argv )
84 po::options_description general_opt(
"Allowed options are: ");
85 general_opt.add_options()
86 (
"help,h",
"display this message")
87 (
"input,i", po::value<std::string>(),
"volumetric file (.pgm3d, .vol, .longvol) " )
88 (
"output,o", po::value<std::string>(),
"volumetric file (.pgm3d, .vol, .longvol) " );
94 po::store(po::parse_command_line(argc, argv, general_opt), vm);
95 }
catch(
const std::exception& ex){
97 trace.
info()<<
"Error checking program options: "<< ex.what()<< endl;
100 if( !parseOK || vm.count(
"help")||argc<=1)
102 std::cout <<
"Usage: " << argv[0] <<
" [input] [output]\n"
103 <<
"Convert volumetric file into volumetric file from different formats (pgm3d, vol, longvol) "
104 << general_opt <<
"\n";
105 std::cout <<
"Example:\n"
106 <<
"convertVol -i ${DGtal}/examples/samples/lobster.vol -o convertedVol.p3d \n";
110 if(! vm.count(
"input")||! vm.count(
"output"))
112 trace.
error() <<
" Input and output filename are needed to be defined" << endl;
117 string inputFilename = vm[
"input"].as<std::string>();
118 string outputFilename = vm[
"output"].as<std::string>();
120 trace.
info() <<
"Reading input file " << inputFilename ;
122 trace.
info() <<
" [done] " << std::endl ;
123 trace.
info() <<
"Writing output file " << outputFilename ;
125 trace.
info() <<
" [done] " << std::endl ;
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())
Trace trace(traceWriterTerm)