ANIMA  4.0
animaConvertShape.cxx
Go to the documentation of this file.
1 #include <tclap/CmdLine.h>
2 
3 #include <animaShapesReader.h>
4 #include <animaShapesWriter.h>
5 
6 int main(int ac, const char** av)
7 {
8  TCLAP::CmdLine cmd("animaConverthape can be used to convert a VTK, VTP, CSV or FDS (medInria fiber format) file into another format. It does not check before writing fds "
9  "that the file is actually made only of fibers.\n"
10  "INRIA / IRISA - VisAGeS/Empenn Team",' ',ANIMA_VERSION);
11 
12  TCLAP::ValueArg<std::string> inputArg("i","in","input data filename",true,"","input data",cmd);
13  TCLAP::ValueArg<std::string> outputArg("o","out","output data filename",true,"","output data",cmd);
14 
15  try
16  {
17  cmd.parse(ac,av);
18  }
19  catch (TCLAP::ArgException& e)
20  {
21  std::cerr << "Error: " << e.error() << "for argument " << e.argId() << std::endl;
22  return EXIT_FAILURE;
23  }
24 
25  anima::ShapesReader shapesReader;
26  shapesReader.SetFileName(inputArg.getValue());
27  try
28  {
29  shapesReader.Update();
30  }
31  catch(std::exception &e)
32  {
33  std::cerr << e.what() << std::endl;
34  return EXIT_FAILURE;
35  }
36 
37  anima::ShapesWriter shapesWriter;
38  shapesWriter.SetInputData(shapesReader.GetOutput());
39  shapesWriter.SetFileName(outputArg.getValue());
40 
41  try
42  {
43  shapesWriter.Update();
44  }
45  catch(std::exception &e)
46  {
47  std::cerr << e.what() << std::endl;
48  return EXIT_FAILURE;
49  }
50 
51  return EXIT_SUCCESS;
52 }
void SetInputData(vtkPolyData *data)
int main(int ac, const char **av)
void SetFileName(std::string &name)
vtkPolyData * GetOutput()
void SetFileName(std::string &name)