29 #include <DGtal/base/Common.h>
30 #include <DGtal/io/readers/RawReader.h>
31 #include <DGtal/io/writers/HDF5Writer.h>
32 #include <DGtal/helpers/StdDefs.h>
33 #include <DGtal/images/Image.h>
34 #include <DGtal/images/ImageContainerBySTLVector.h>
40 using namespace DGtal;
83 void missingParam ( std::string param )
85 trace.error() <<
" Parameter: "<<param<<
" is required..";
86 trace.info() <<std::endl;
91 int main(
int argc,
char**argv)
97 std::string inputFileName;
98 std::string outputFileName {
"result.hdf5"};
101 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>");
103 app.add_option(
"-i,--input,1", inputFileName,
"Input raw file." )
105 ->check(CLI::ExistingFile);
106 app.add_option(
"-o,--output,2",outputFileName,
"Output hdf5 filename.",
true);
107 app.add_option(
"--x,-x", x,
"x extent." )
109 app.add_option(
"--y,-y", y,
"y extent." )
111 app.add_option(
"--z,-z", z,
"z extent." )
114 app.get_formatter()->column_width(40);
115 CLI11_PARSE(app, argc, argv);
119 typedef ImageContainerBySTLVector<Z3i::Domain, unsigned char> MyImageC;
121 MyImageC imageC = RawReader< MyImageC >::importRaw8 ( inputFileName, Z3i::Vector(x,y,z) );
122 bool res = HDF5Writer< MyImageC>::exportHDF5_3D(outputFileName, imageC,
"/UInt8Array3D");
129 trace.error()<<
"Error while exporting the volume."<<std::endl;