1 #include <tclap/CmdLine.h> 6 #include <vtkPolyData.h> 10 typedef itk::Image <unsigned short, 3>::PointType PointType;
11 PointType pointPositionIn, pointPositionOut;
12 double pointPositionVTK[3];
14 for (
unsigned int i = 0;i < dataPoints->GetNumberOfPoints();++i)
16 for (
unsigned int k = 0; k < 3; ++k)
17 pointPositionIn[k] = dataPoints->GetPoint(i)[k];
19 pointPositionOut = transform->TransformPoint(pointPositionIn);
21 for (
unsigned int k = 0; k < 3; ++k)
22 pointPositionVTK[k] = pointPositionOut[k];
24 dataPoints->SetPoint(i,pointPositionVTK);
28 int main(
int ac,
const char** av)
30 TCLAP::CmdLine cmd(
"INRIA / IRISA - VisAGeS/Empenn Team",
' ',ANIMA_VERSION);
32 TCLAP::ValueArg<std::string> inArg(
"i",
"input",
"input tracks file",
true,
"",
"input tracks",cmd);
33 TCLAP::ValueArg<std::string> outArg(
"o",
"output",
"output tracks name",
true,
"",
"output tracks",cmd);
34 TCLAP::ValueArg<std::string> trArg(
"t",
"trsf",
"Transformations XML list",
true,
"",
"transformations list",cmd);
36 TCLAP::ValueArg<unsigned int> expOrderArg(
"e",
"exp-order",
"Order of field exponentiation approximation (in between 0 and 1, default: 0)",
false,0,
"exponentiation order",cmd);
37 TCLAP::SwitchArg invertArg(
"I",
"invert",
"Invert the transformation series",cmd,
false);
38 TCLAP::ValueArg<unsigned int> nbpArg(
"p",
"numberofthreads",
"Number of threads to run on (default: all cores)",
false,itk::MultiThreaderBase::GetGlobalDefaultNumberOfThreads(),
"number of threads",cmd);
44 catch (TCLAP::ArgException& e)
46 std::cerr <<
"Error: " << e.error() <<
"for argument " << e.argId() << std::endl;
51 TransformSeriesReaderType trsfReader;
52 trsfReader.
SetInput(trArg.getValue());
53 trsfReader.SetInvertTransform(!invertArg.isSet());
54 trsfReader.SetExponentiationOrder(expOrderArg.getValue());
55 trsfReader.SetNumberOfWorkUnits(nbpArg.getValue());
62 vtkSmartPointer <vtkPolyData> tracks = trackReader.
GetOutput();
67 writer.SetFileName(outArg.getValue());
68 std::cout <<
"Writing tracks: " << outArg.getValue() << std::endl;
void SetInputData(vtkPolyData *data)
void SetFileName(std::string &name)
vtkPolyData * GetOutput()