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"
36 #include "DGtal/kernel/BasicPointFunctors.h"
42 using namespace DGtal;
74 int main(
int argc,
char** argv )
81 std::vector<std::string> vectImage2DNames;
82 std::string outputFileName {
"result.vol"};
83 unsigned int sliceOrientation {2};
85 app.description(
"Converts set of 2D images into volumetric file (pgm3d, vol, longvol).\nExample:\n slice2vol -i slice1.pgm slice2.pgm slice3.pgm -o out.vol see vol2slice");
86 app.add_option(
"-i,--input", vectImage2DNames,
"input 2D files (.pgm)")
88 app.add_option(
"-o,--output", outputFileName,
"volumetric file (.vol, .longvol .pgm3d)");
89 app.add_option(
"--sliceOrientation,-s", sliceOrientation,
"specify the slice orientation for which the slice are defined (by default =2 (Z direction))",
true)
90 -> check(CLI::IsMember({0, 1, 2}));
93 app.get_formatter()->column_width(40);
94 CLI11_PARSE(app, argc, argv);
99 std::vector<Image2D> vectImages2D;
101 for(
unsigned int i=0; i< vectImage2DNames.size(); i++){
104 vectImages2D.push_back(image);
111 projIn3Dlower.initAddOneDim(sliceOrientation);
112 projIn3Dupper.initAddOneDim(sliceOrientation);
113 Image3D::Domain domImage3D (projIn3Dlower(vectImages2D.at(0).domain().lowerBound()),
114 projIn3Dupper(vectImages2D.at(0).domain().upperBound()));
116 Image3D imageResult (domImage3D);
117 for(
unsigned int i=0; i<vectImages2D.size(); i++){
118 Image2D sliceImage = vectImages2D.at(i);
120 projIn3D.initAddOneDim(sliceOrientation);
122 it!= sliceImage.
domain().end(); it++){
124 imageResult.setValue(pt, sliceImage(*it));
127 trace.
info() <<
"Exporting 3d image ... " << std::endl ;
int main(int argc, char **argv)
const Domain & domain() const
std::vector< Value >::const_iterator ConstIterator
Trace trace(traceWriterTerm)