29 #include <DGtal/base/Common.h>
30 #include <DGtal/io/readers/RawReader.h>
31 #include <DGtal/io/writers/VolWriter.h>
32 #include <DGtal/io/readers/VolReader.h>
33 #include <DGtal/io/writers/RawWriter.h>
34 #include <DGtal/helpers/StdDefs.h>
35 #include "DGtal/io/colormaps/GrayscaleColorMap.h"
36 #include <DGtal/images/Image.h>
37 #include <DGtal/images/ImageContainerBySTLVector.h>
42 using namespace DGtal;
86 void missingParam ( std::string param )
88 trace.error() <<
" Parameter: "<<param<<
" is required..";
89 trace.info() <<std::endl;
94 int main(
int argc,
char**argv)
100 std::string inputFileName;
101 std::string outputFileName {
"result.vol"};
102 unsigned int x, y, z;
103 app.description(
"Converts a 8-bit raw file to vol.\n Basic example:\n \t raw2vol <RawFileName> <VolOutputFileName> -x 128 -y 128 -z 128");
104 app.add_option(
"-i,--input,1", inputFileName,
"Input raw file." )
106 ->check(CLI::ExistingFile);
107 app.add_option(
"-o,--output,2",outputFileName,
"Output vol filename.",
true);
108 app.add_option(
"--x,-x", x,
"x extent." )
110 app.add_option(
"--y,-y", y,
"y extent." )
112 app.add_option(
"--z,-z", z,
"z extent." )
116 app.get_formatter()->column_width(40);
117 CLI11_PARSE(app, argc, argv);
121 typedef ImageContainerBySTLVector<Z3i::Domain, unsigned char> MyImageC;
122 MyImageC imageC = RawReader< MyImageC >::importRaw8 ( inputFileName, Z3i::Vector(x,y,z));
123 bool res = VolWriter< MyImageC>::exportVol(outputFileName, imageC);
129 trace.error()<<
"Error while exporting the volume."<<std::endl;