30#include <DGtal/base/Common.h>
31#include <DGtal/io/readers/RawReader.h>
32#include <DGtal/io/writers/HDF5Writer.h>
33#include <DGtal/helpers/StdDefs.h>
34#include <DGtal/images/Image.h>
35#include <DGtal/images/ImageContainerBySTLVector.h>
85void missingParam ( std::string param )
87 trace.error() <<
" Parameter: "<<param<<
" is required..";
88 trace.info() <<std::endl;
93int main(
int argc,
char**argv)
99 std::string inputFileName;
100 std::string outputFileName {
"result.hdf5"};
101 unsigned int x, y, z;
103 app.description(
"Converts a 3D 8-bit raw file to HDF5.\n Basic usage \n \traw2HDF5 -x 128 -y 128 -z 128 --input <RawFileName> --output <HDF5OutputFileName>");
105 app.add_option(
"-i,--input,1", inputFileName,
"Input raw file." )
107 ->check(CLI::ExistingFile);
108 app.add_option(
"-o,--output,2",outputFileName,
"Output hdf5 filename.");
109 app.add_option(
"--x,-x", x,
"x extent." )
111 app.add_option(
"--y,-y", y,
"y extent." )
113 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;
123 MyImageC imageC = RawReader< MyImageC >::importRaw8 ( inputFileName, Z3i::Vector(x,y,z) );
124 bool res = HDF5Writer< MyImageC>::exportHDF5_3D(outputFileName, imageC,
"/UInt8Array3D");
131 trace.error()<<
"Error while exporting the volume."<<std::endl;