]> Creatis software - FrontAlgorithms.git/blobdiff - tests/image/VTK/PolyLineParametricPathToPolyData.cxx
...
[FrontAlgorithms.git] / tests / image / VTK / PolyLineParametricPathToPolyData.cxx
diff --git a/tests/image/VTK/PolyLineParametricPathToPolyData.cxx b/tests/image/VTK/PolyLineParametricPathToPolyData.cxx
new file mode 100644 (file)
index 0000000..e92af29
--- /dev/null
@@ -0,0 +1,54 @@
+// =========================================================================
+// @author Leonardo Florez Valencia
+// @email florez-l@javeriana.edu.co
+// =========================================================================
+
+#include <vtkPolyDataWriter.h>
+#include <vtkSmartPointer.h>
+#include <fpa/DataStructures/Image/PolyLineParametricPath.h>
+#include <fpa/Common/Image/PolyLineParametricPathReader.h>
+#include <fpa/VTK/Image/PolyLineParametricPathToPolyDataFilter.h>
+
+// -------------------------------------------------------------------------
+const unsigned int Dim = 2;
+typedef fpa::DataStructures::Image::PolyLineParametricPath< Dim > TPath;
+
+// -------------------------------------------------------------------------
+int main( int argc, char* argv[] )
+{
+  // Get arguments
+  if( argc < 3 )
+  {
+    std::cerr
+      << "Usage: " << argv[ 0 ]
+      << " input_path output_vtk"
+      << std::endl;
+    return( 1 );
+
+  } // fi
+  std::string input_path_filename = argv[ 1 ];
+  std::string output_vtk_filename = argv[ 2 ];
+
+  // Read image
+  typedef fpa::Common::Image::PolyLineParametricPathReader< TPath > TReader;
+  TReader::Pointer input_path_reader = TReader::New( );
+  input_path_reader->SetFileName( input_path_filename );
+  input_path_reader->Update( );
+
+  // Execute filter
+  typedef fpa::VTK::Image::PolyLineParametricPathToPolyDataFilter< TPath > TFilter;
+  vtkSmartPointer< TFilter > filter = vtkSmartPointer< TFilter >::New( );
+  filter->SetInput( input_path_reader->GetOutput( ) );
+  filter->Update( );
+
+  // Save results
+  vtkSmartPointer< vtkPolyDataWriter > output_vtk_writer =
+    vtkSmartPointer< vtkPolyDataWriter >::New( );
+  output_vtk_writer->SetFileName( output_vtk_filename.c_str( ) );
+  output_vtk_writer->SetInputConnection( filter->GetOutputPort( ) );
+  output_vtk_writer->Update( );
+
+  return( 0 );
+}
+
+// eof - $RCSfile$