]> Creatis software - cpPlugins.git/commitdiff
...
authorLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 31 Oct 2016 04:11:24 +0000 (23:11 -0500)
committerLeonardo Florez-Valencia <florez-l@javeriana.edu.co>
Mon, 31 Oct 2016 04:11:24 +0000 (23:11 -0500)
lib/cpExtensions/Algorithms/PolyLineParametricPathToSimple3DCurve.cxx [new file with mode: 0644]
lib/cpExtensions/Algorithms/PolyLineParametricPathToSimple3DCurve.h [new file with mode: 0644]
lib/cpExtensions/DataStructures/Simple3DCurve.cxx [new file with mode: 0644]
lib/cpExtensions/DataStructures/Simple3DCurve.h [new file with mode: 0644]
lib/cpExtensions/Visualization/Simple3DCurveToPolyData.cxx [new file with mode: 0644]
lib/cpExtensions/Visualization/Simple3DCurveToPolyData.h [new file with mode: 0644]
lib/cpPlugins/DataObjects/Simple3DCurve.cxx [new file with mode: 0644]
lib/cpPlugins/DataObjects/Simple3DCurve.h [new file with mode: 0644]
plugins/GenericFilters/PolyLineParametricPathToSimple3DCurve.cxx [new file with mode: 0644]
plugins/GenericFilters/PolyLineParametricPathToSimple3DCurve.h [new file with mode: 0644]

diff --git a/lib/cpExtensions/Algorithms/PolyLineParametricPathToSimple3DCurve.cxx b/lib/cpExtensions/Algorithms/PolyLineParametricPathToSimple3DCurve.cxx
new file mode 100644 (file)
index 0000000..c3d575d
--- /dev/null
@@ -0,0 +1,94 @@
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#include <cpExtensions/Algorithms/PolyLineParametricPathToSimple3DCurve.h>
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine, class _TCurve >
+_TPolyLine* cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >::
+GetInput( )
+{
+  return( dynamic_cast< _TPolyLine* >( this->Superclass::GetInput( 0 ) ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine, class _TCurve >
+const _TPolyLine* cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >::
+GetInput( ) const
+{
+  return( dynamic_cast< const _TPolyLine* >( this->Superclass::GetInput( 0 ) ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine, class _TCurve >
+void cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >::
+SetInput( _TPolyLine* pl )
+{
+  this->Superclass::SetInput( 0, pl );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine, class _TCurve >
+_TCurve* cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >::
+GetOutput( )
+{
+  return( dynamic_cast< _TCurve* >( this->Superclass::GetOutput( 0 ) ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine, class _TCurve >
+const _TCurve* cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >::
+GetOutput( ) const
+{
+  return( dynamic_cast< const _TCurve* >( this->Superclass::GetOutput( 0 ) ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine, class _TCurve >
+cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >::
+PolyLineParametricPathToSimple3DCurve( )
+  : Superclass( ),
+    m_NumberOfSamples( 0 )
+{
+  this->SetNumberOfRequiredInputs( 1 );
+  this->SetNumberOfRequiredOutputs( 1 );
+  typename _TCurve::Pointer curve = _TCurve::New( );
+  this->Superclass::SetOutput( 0, curve );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine, class _TCurve >
+cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >::
+~PolyLineParametricPathToSimple3DCurve( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine, class _TCurve >
+void cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPolyLine, _TCurve >::
+GenerateData( )
+{
+  const _TPolyLine* line = this->GetInput( );
+  _TCurve* curve = this->GetOutput( );
+  unsigned long N = this->m_NumberOfSamples;
+  if( N == 0 )
+    N = line->GetSize( );
+  curve->Clear( );
+
+  for( unsigned long n = 0; n < N; ++n )
+  {
+    double u = double( n ) / double( N - 1 );
+    curve->AddPoint( line->GetSmoothPoint( u ) );
+
+  } // rof
+}
+
+// -------------------------------------------------------------------------
+#include <cpExtensions/DataStructures/PolyLineParametricPath.h>
+#include <cpExtensions/DataStructures/Simple3DCurve.h>
+
+template class cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< cpExtensions::DataStructures::PolyLineParametricPath< 3 >, cpExtensions::DataStructures::Simple3DCurve< float > >; 
+template class cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< cpExtensions::DataStructures::PolyLineParametricPath< 3 >, cpExtensions::DataStructures::Simple3DCurve< double > >; 
+
+// eof - $RCSfile$
diff --git a/lib/cpExtensions/Algorithms/PolyLineParametricPathToSimple3DCurve.h b/lib/cpExtensions/Algorithms/PolyLineParametricPathToSimple3DCurve.h
new file mode 100644 (file)
index 0000000..5282e88
--- /dev/null
@@ -0,0 +1,65 @@
+// -------------------------------------------------------------------------
+// @author Leonardo Florez-Valencia (florez-l@javeriana.edu.co)
+// -------------------------------------------------------------------------
+
+#ifndef __cpExtensions__Algorithms__PolyLineParametricPathToSimple3DCurve__h__
+#define __cpExtensions__Algorithms__PolyLineParametricPathToSimple3DCurve__h__
+
+#include <cpExtensions/Config.h>
+#include <itkProcessObject.h>
+
+// -------------------------------------------------------------------------
+namespace cpExtensions
+{
+  namespace Algorithms
+  {
+    /**
+     */
+    template< class _TPolyLine, class _TCurve >
+    class cpExtensions_EXPORT PolyLineParametricPathToSimple3DCurve
+      : public itk::ProcessObject
+    {
+    public:
+      // Basic types
+      typedef PolyLineParametricPathToSimple3DCurve Self;
+      typedef itk::ProcessObject                    Superclass;
+      typedef itk::SmartPointer< Self >             Pointer;
+      typedef itk::SmartPointer< const Self >       ConstPointer;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( PolyLineParametricPathToSimple3DCurve, itk::ProcessObject );
+
+      itkGetConstMacro( NumberOfSamples, unsigned long );
+      itkSetMacro( NumberOfSamples, unsigned long );
+
+    public:
+      _TPolyLine* GetInput( );
+      const _TPolyLine* GetInput( ) const;
+      void SetInput( _TPolyLine* pl );
+
+      _TCurve* GetOutput( );
+      const _TCurve* GetOutput( ) const;
+
+    protected:
+      PolyLineParametricPathToSimple3DCurve( );
+      virtual ~PolyLineParametricPathToSimple3DCurve( );
+
+      virtual void GenerateData( ) cpExtensions_OVERRIDE;
+
+    private:
+      // Purposely not implemented
+      PolyLineParametricPathToSimple3DCurve( const Self& );
+      void operator=( const Self& );
+
+    protected:
+      unsigned long m_NumberOfSamples;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __cpExtensions__Algorithms__PolyLineParametricPathToSimple3DCurve__h__
+
+// eof - $RCSfile$
diff --git a/lib/cpExtensions/DataStructures/Simple3DCurve.cxx b/lib/cpExtensions/DataStructures/Simple3DCurve.cxx
new file mode 100644 (file)
index 0000000..cda4399
--- /dev/null
@@ -0,0 +1,130 @@
+#include <cpExtensions/DataStructures/Simple3DCurve.h>
+
+// -------------------------------------------------------------------------
+template< class _TScalar >
+void cpExtensions::DataStructures::Simple3DCurve< _TScalar >::
+Modified( ) const
+{
+  this->Superclass::Modified( );
+  this->m_FramesUpdated = false;
+}
+
+// -------------------------------------------------------------------------
+template< class _TScalar >
+void cpExtensions::DataStructures::Simple3DCurve< _TScalar >::
+Clear( )
+{
+  this->m_Points.clear( );
+  this->m_Frames.clear( );
+  this->Modified( );
+}
+
+// -------------------------------------------------------------------------
+template< class _TScalar >
+unsigned long cpExtensions::DataStructures::Simple3DCurve< _TScalar >::
+GetNumberOfPoints( ) const
+{
+  return( this->m_Points.size( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TScalar >
+const typename cpExtensions::DataStructures::Simple3DCurve< _TScalar >::
+TMatrix& cpExtensions::DataStructures::Simple3DCurve< _TScalar >::
+GetFrame( unsigned int id ) const
+{
+  if( !( this->m_FramesUpdated ) )
+  {
+    unsigned long N = this->m_Points.size( );
+
+    std::vector< TVector > tg( N );
+    tg[ 0 ] = this->m_Points[ 1 ] - this->m_Points[ 0 ];
+    tg[ N - 1 ] = this->m_Points[ N - 1 ] - this->m_Points[ N - 2 ];
+    for( unsigned int i = 1; i < N - 1; ++i )
+      tg[ i ] = this->m_Points[ i + 1 ] - this->m_Points[ i - 1 ];
+
+    std::vector< TVector > no( N );
+    std::vector< TVector > bn( N );
+    TVector prev_tg( _TScalar( 0 ) ), prev_no( _TScalar( 0 ) );
+    prev_tg[ 0 ] = _TScalar( 1 );
+    prev_no[ 1 ] = _TScalar( 1 );
+    for( unsigned int i = 0; i < N; ++i )
+    {
+      _TScalar ct = prev_tg * tg[ i ];
+      TVector a = itk::CrossProduct( prev_tg, tg[ i ] );
+      _TScalar st = a.GetNorm( );
+      if( st > _TScalar( 0 ) )
+        a /= st;
+
+      no[ i ] =
+        ( prev_no * ct ) +
+        ( itk::CrossProduct( a, prev_no ) * st ) +
+        ( a * ( ( a * prev_no ) * ( _TScalar( 1 ) - ct ) ) );
+      bn[ i ] = itk::CrossProduct( tg[ i ], no[ i ] );
+
+      prev_tg = tg[ i ];
+      prev_no = no[ i ];
+
+    } // rof
+
+    this->m_Frames.clear( );
+    for( unsigned int i = 0; i < N; ++i )
+    {
+      TMatrix m;
+      for( unsigned int d = 0; d < 3; ++d )
+      {
+        m[ d ][ 0 ] = tg[ i ][ d ];
+        m[ d ][ 1 ] = no[ i ][ d ];
+        m[ d ][ 2 ] = bn[ i ][ d ];
+
+      } // rof
+      this->m_Frames.push_back( m );
+
+
+    } // rof
+
+    this->m_FramesUpdated = true;
+
+  } // fi
+  return( this->m_Frames[ id ] );
+}
+
+// -------------------------------------------------------------------------
+template< class _TScalar >
+const typename cpExtensions::DataStructures::Simple3DCurve< _TScalar >::
+TPoint& cpExtensions::DataStructures::Simple3DCurve< _TScalar >::
+GetPoint( unsigned int id ) const
+{
+  return( this->m_Points[ id ] );
+}
+
+// -------------------------------------------------------------------------
+template< class _TScalar >
+typename cpExtensions::DataStructures::Simple3DCurve< _TScalar >::
+TVector cpExtensions::DataStructures::Simple3DCurve< _TScalar >::
+GetVector( unsigned int id ) const
+{
+  return( this->m_Points[ id ].GetVectorFromOrigin( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TScalar >
+cpExtensions::DataStructures::Simple3DCurve< _TScalar >::
+Simple3DCurve( )
+  : Superclass( ),
+    m_FramesUpdated( false )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TScalar >
+cpExtensions::DataStructures::Simple3DCurve< _TScalar >::
+~Simple3DCurve( )
+{
+}
+
+// -------------------------------------------------------------------------
+template class cpExtensions::DataStructures::Simple3DCurve< float >;
+template class cpExtensions::DataStructures::Simple3DCurve< double >;
+
+// eof - $RCSfile$
diff --git a/lib/cpExtensions/DataStructures/Simple3DCurve.h b/lib/cpExtensions/DataStructures/Simple3DCurve.h
new file mode 100644 (file)
index 0000000..cbbef54
--- /dev/null
@@ -0,0 +1,74 @@
+#ifndef __cpExtensions__DataStructures__Simple3DCurve__h__
+#define __cpExtensions__DataStructures__Simple3DCurve__h__
+
+#include <cpExtensions/Config.h>
+#include <itkDataObject.h>
+#include <itkObjectFactory.h>
+#include <itkMatrix.h>
+#include <itkPoint.h>
+
+namespace cpExtensions
+{
+  namespace DataStructures
+  {
+    /**
+     */
+    template< class _TScalar >
+    class cpExtensions_EXPORT Simple3DCurve
+      : public itk::DataObject
+    {
+    public:
+      typedef Simple3DCurve                   Self;
+      typedef itk::DataObject                 Superclass;
+      typedef itk::SmartPointer< Self >       Pointer;
+      typedef itk::SmartPointer< const Self > ConstPointer;
+
+      typedef itk::Matrix< _TScalar, 3, 3 > TMatrix;
+      typedef itk::Point< _TScalar, 3 >     TPoint;
+      typedef typename TPoint::VectorType   TVector;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro( Simple3DCurve, itk::DataObject );
+
+    public:
+      template< class _TVector >
+      inline void AddPoint( const _TVector& v )
+        {
+          TPoint p;
+          p[ 0 ] = v[ 0 ];
+          p[ 1 ] = v[ 1 ];
+          p[ 2 ] = v[ 2 ];
+          this->m_Points.push_back( p );
+          this->Modified( );
+        }
+
+      virtual void Modified( ) const cpExtensions_OVERRIDE;
+      void Clear( );
+      unsigned long GetNumberOfPoints( ) const;
+      const TMatrix& GetFrame( unsigned int id ) const;
+      const TPoint& GetPoint( unsigned int id ) const;
+      TVector GetVector( unsigned int id ) const;
+
+    protected:
+      Simple3DCurve( );
+      virtual ~Simple3DCurve( );
+
+    private:
+      // Purposely not implemented
+      Simple3DCurve( const Self& other );
+      Self& operator=( const Self& other );
+
+    protected:
+      std::vector< TPoint > m_Points;
+      mutable std::vector< TMatrix > m_Frames;
+      mutable bool m_FramesUpdated;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __cpExtensions__DataStructures__Simple3DCurve__h__
+
+// eof - $RCSfile$
diff --git a/lib/cpExtensions/Visualization/Simple3DCurveToPolyData.cxx b/lib/cpExtensions/Visualization/Simple3DCurveToPolyData.cxx
new file mode 100644 (file)
index 0000000..697807f
--- /dev/null
@@ -0,0 +1,119 @@
+#include <cpExtensions/Visualization/Simple3DCurveToPolyData.h>
+
+#include <vtkCellArray.h>
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+#include <vtkSmartPointer.h>
+
+// -------------------------------------------------------------------------
+template< class _TCurve >
+typename cpExtensions::Visualization::Simple3DCurveToPolyData< _TCurve >::
+Self* cpExtensions::Visualization::Simple3DCurveToPolyData< _TCurve >::
+New( )
+{
+  return( new Self( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TCurve >
+const typename cpExtensions::Visualization::Simple3DCurveToPolyData< _TCurve >::
+TCurve* cpExtensions::Visualization::Simple3DCurveToPolyData< _TCurve >::
+GetInput( ) const
+{
+  return( this->m_Curve );
+}
+
+// -------------------------------------------------------------------------
+template< class _TCurve >
+void
+cpExtensions::Visualization::Simple3DCurveToPolyData< _TCurve >::
+SetInput( const TCurve* c )
+{
+  if( this->m_Curve != c )
+  {
+    this->m_Curve = c;
+    this->Modified( );
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TCurve >
+cpExtensions::Visualization::Simple3DCurveToPolyData< _TCurve >::
+Simple3DCurveToPolyData( )
+  : vtkPolyDataAlgorithm( ),
+    m_Curve( NULL )
+{
+  this->SetNumberOfInputPorts( 0 );
+}
+
+// -------------------------------------------------------------------------
+template< class _TCurve >
+cpExtensions::Visualization::Simple3DCurveToPolyData< _TCurve >::
+~Simple3DCurveToPolyData( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TCurve >
+int cpExtensions::Visualization::Simple3DCurveToPolyData< _TCurve >::
+RequestData(
+  vtkInformation* information,
+  vtkInformationVector** input,
+  vtkInformationVector* output
+  )
+{
+  if( this->m_Curve == NULL )
+    return( 0 );
+
+  // Get output
+  vtkInformation* info = output->GetInformationObject( 0 );
+  vtkPolyData* out = vtkPolyData::SafeDownCast(
+    info->Get( vtkDataObject::DATA_OBJECT( ) )
+    );
+
+  // Prepare data
+  out->SetPoints( vtkSmartPointer< vtkPoints >::New( ) );
+  out->SetVerts( vtkSmartPointer< vtkCellArray >::New( ) );
+  out->SetLines( vtkSmartPointer< vtkCellArray >::New( ) );
+  out->SetPolys( vtkSmartPointer< vtkCellArray >::New( ) );
+  out->SetStrips( vtkSmartPointer< vtkCellArray >::New( ) );
+  vtkPoints* points = out->GetPoints( );
+  vtkCellArray* lines = out->GetLines( );
+
+  // Get data
+  for( unsigned long i = 0; i < this->m_Curve->GetNumberOfPoints( ); ++i )
+  {
+    typename _TCurve::TPoint pnt = this->m_Curve->GetPoint( i );
+    points->InsertNextPoint( pnt[ 0 ], pnt[ 1 ], pnt[ 2 ] );
+    if( i > 0 )
+    {
+      lines->InsertNextCell( 2 );
+      lines->InsertCellPoint( i - 1 );
+      lines->InsertCellPoint( i );
+
+    } // fi
+
+  } // rof
+  return( 1 );
+}
+
+// -------------------------------------------------------------------------
+template< class _TCurve >
+int cpExtensions::Visualization::Simple3DCurveToPolyData< _TCurve >::
+RequestInformation(
+  vtkInformation* information,
+  vtkInformationVector** input,
+  vtkInformationVector* output
+  )
+{
+  return( 1 );
+}
+
+// -------------------------------------------------------------------------
+#include <cpExtensions/DataStructures/Simple3DCurve.h>
+
+template class cpExtensions::Visualization::Simple3DCurveToPolyData< cpExtensions::DataStructures::Simple3DCurve< float > >;
+template class cpExtensions::Visualization::Simple3DCurveToPolyData< cpExtensions::DataStructures::Simple3DCurve< double > >;
+
+// eof - $RCSfile$
diff --git a/lib/cpExtensions/Visualization/Simple3DCurveToPolyData.h b/lib/cpExtensions/Visualization/Simple3DCurveToPolyData.h
new file mode 100644 (file)
index 0000000..7407cea
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef __cpExtensions__Visualization__Simple3DCurveToPolyData__h__
+#define __cpExtensions__Visualization__Simple3DCurveToPolyData__h__
+
+#include <cpExtensions/Config.h>
+#include <vtkPolyDataAlgorithm.h>
+
+namespace cpExtensions
+{
+  namespace Visualization
+  {
+    /**
+     */
+    template< class _TCurve >
+    class cpExtensions_EXPORT Simple3DCurveToPolyData
+      : public vtkPolyDataAlgorithm
+    {
+    public:
+      typedef Simple3DCurveToPolyData Self;
+      typedef _TCurve TCurve;
+
+    public:
+      vtkTypeMacro( Simple3DCurveToPolyData, vtkPolyDataAlgorithm );
+
+    public:
+      static Self* New( );
+
+      const TCurve* GetInput( ) const;
+      void SetInput( const TCurve* c );
+
+    protected:
+      Simple3DCurveToPolyData( );
+      virtual ~Simple3DCurveToPolyData( );
+
+      int RequestData(
+        vtkInformation* information,
+        vtkInformationVector** input,
+        vtkInformationVector* output
+        );
+      int RequestInformation(
+        vtkInformation* information,
+        vtkInformationVector** input,
+        vtkInformationVector* output
+        );
+
+    private:
+      // Purposely not implemented
+      Simple3DCurveToPolyData( const Self& );
+      void operator=( const Self& );
+
+    protected:
+      const TCurve* m_Curve;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif //  __cpExtensions__Visualization__Simple3DCurveToPolyData__h__
+
+// eof - $RCSfile$
diff --git a/lib/cpPlugins/DataObjects/Simple3DCurve.cxx b/lib/cpPlugins/DataObjects/Simple3DCurve.cxx
new file mode 100644 (file)
index 0000000..27097c9
--- /dev/null
@@ -0,0 +1,72 @@
+#include <cpPlugins/DataObjects/Simple3DCurve.h>
+#include <cpExtensions/DataStructures/Simple3DCurve.h>
+#include <cpExtensions/Visualization/Simple3DCurveToPolyData.h>
+
+// -------------------------------------------------------------------------
+void cpPlugins::DataObjects::Simple3DCurve::
+SetITK( itk::LightObject* o )
+{
+  typedef cpExtensions::DataStructures::Simple3DCurve< float >  _TF;
+  typedef cpExtensions::DataStructures::Simple3DCurve< double > _TD;
+
+  this->Superclass::SetITK( o );
+  auto lf = dynamic_cast< _TF* >( o );
+  auto ld = dynamic_cast< _TD* >( o );
+  if     ( lf != NULL ) this->_ITK_2_VTK( lf );
+  else if( ld != NULL ) this->_ITK_2_VTK( ld );
+  else
+  {
+    this->m_VTK = NULL;
+    this->m_ITKvVTK = NULL;
+
+  } // fi
+}
+
+// -------------------------------------------------------------------------
+void cpPlugins::DataObjects::Simple3DCurve::
+SetVTK( vtkObjectBase* o )
+{
+  // Do nothing
+  this->m_ITK = NULL;
+  this->m_VTK = NULL;
+  this->m_ITKvVTK = NULL;
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::DataObjects::Simple3DCurve::
+Simple3DCurve( )
+  : Superclass( )
+{
+}
+
+// -------------------------------------------------------------------------
+cpPlugins::DataObjects::Simple3DCurve::
+~Simple3DCurve( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TSimple3DCurve >
+void cpPlugins::DataObjects::Simple3DCurve::
+_ITK_2_VTK( _TSimple3DCurve* curve )
+{
+  typedef
+    cpExtensions::Visualization::Simple3DCurveToPolyData< _TSimple3DCurve >
+    _TFilter;
+  _TFilter* f = dynamic_cast< _TFilter* >( this->m_ITKvVTK.GetPointer( ) );
+  if( f == NULL )
+  {
+    _TFilter* nf = _TFilter::New( );
+    this->m_ITKvVTK = nf;
+    f = nf;
+
+  } // fi
+  f->SetInput( curve );
+  f->Update( );
+
+  // Keep object track
+  this->m_ITK = curve;
+  this->m_VTK = f->GetOutput( );
+}
+
+// eof - $RCSfile$
diff --git a/lib/cpPlugins/DataObjects/Simple3DCurve.h b/lib/cpPlugins/DataObjects/Simple3DCurve.h
new file mode 100644 (file)
index 0000000..844146d
--- /dev/null
@@ -0,0 +1,60 @@
+#ifndef __cpPlugins__DataObjects__Simple3DCurve__h__
+#define __cpPlugins__DataObjects__Simple3DCurve__h__
+
+#include <cpPlugins/BaseObjects/DataObject.h>
+#include <vtkSmartPointer.h>
+
+// -------------------------------------------------------------------------
+class vtkPolyDataAlgorithm;
+
+// -------------------------------------------------------------------------
+namespace cpPlugins
+{
+  namespace DataObjects
+  {
+    /**
+     */
+    class cpPlugins_EXPORT Simple3DCurve
+      : public cpPlugins::BaseObjects::DataObject
+    {
+    public:
+      typedef Simple3DCurve                      Self;
+      typedef cpPlugins::BaseObjects::DataObject Superclass;
+      typedef itk::SmartPointer< Self >          Pointer;
+      typedef itk::SmartPointer< const Self >    ConstPointer;
+
+    public:
+      itkNewMacro( Self );
+      itkTypeMacro(
+        Simple3DCurve, cpPlugins::BaseObjects::DataObject
+        );
+      cpPlugins_Id_Macro( Simple3DCurve, Object );
+      cpPlugins_Compatibility_Macro;
+
+    public:
+      virtual void SetITK( itk::LightObject* o ) cpPlugins_OVERRIDE;
+      virtual void SetVTK( vtkObjectBase* o ) cpPlugins_OVERRIDE;
+
+    protected:
+      Simple3DCurve( );
+      virtual ~Simple3DCurve( );
+
+      template< class _TSimple3DCurve >
+      inline void _ITK_2_VTK( _TSimple3DCurve* curve );
+
+    private:
+      // Purposely not implemented
+      Simple3DCurve( const Self& );
+      Self& operator=( const Self& );
+
+    protected:
+      vtkSmartPointer< vtkPolyDataAlgorithm > m_ITKvVTK;
+    };
+
+  } // ecapseman
+
+} // ecapseman
+
+#endif // __cpPlugins__DataObjects__Simple3DCurve__h__
+
+// eof - $RCSfile$
diff --git a/plugins/GenericFilters/PolyLineParametricPathToSimple3DCurve.cxx b/plugins/GenericFilters/PolyLineParametricPathToSimple3DCurve.cxx
new file mode 100644 (file)
index 0000000..24952b0
--- /dev/null
@@ -0,0 +1,48 @@
+#include <GenericFilters/PolyLineParametricPathToSimple3DCurve.h>
+#include <cpPlugins/DataObjects/PolyLineParametricPath.h>
+#include <cpPlugins/DataObjects/Simple3DCurve.h>
+
+#include <cpExtensions/DataStructures/PolyLineParametricPath.h>
+#include <cpExtensions/DataStructures/Simple3DCurve.h>
+#include <cpExtensions/Algorithms/PolyLineParametricPathToSimple3DCurve.h>
+
+// -------------------------------------------------------------------------
+cpPluginsGenericFilters::PolyLineParametricPathToSimple3DCurve::
+PolyLineParametricPathToSimple3DCurve( )
+  : Superclass( )
+{
+  typedef cpPlugins::DataObjects::PolyLineParametricPath _TPath;
+  typedef cpPlugins::DataObjects::Simple3DCurve _TCurve;
+  this->_ConfigureInput< _TPath >( "Input", true, false );
+  this->_ConfigureOutput< _TCurve >( "Output" );
+
+  this->m_Parameters.ConfigureAsUint( "NumberOfSamples" );
+  this->m_Parameters.SetUint( "NumberOfSamples", 0 );
+}
+
+// -------------------------------------------------------------------------
+cpPluginsGenericFilters::PolyLineParametricPathToSimple3DCurve::
+~PolyLineParametricPathToSimple3DCurve( )
+{
+}
+
+// -------------------------------------------------------------------------
+void cpPluginsGenericFilters::PolyLineParametricPathToSimple3DCurve::
+_GenerateData( )
+{
+  typedef cpExtensions::DataStructures::PolyLineParametricPath< 3 > _TPath;
+  typedef cpExtensions::DataStructures::Simple3DCurve< double > _TCurve;
+  typedef cpExtensions::Algorithms::PolyLineParametricPathToSimple3DCurve< _TPath, _TCurve > _TFilter;
+
+  auto in = this->GetInputData< _TPath >( "Input" );
+  if( in == NULL )
+    this->_Error( "Invalid input path." );
+
+  auto filter = this->_CreateITK< _TFilter >( );
+  filter->SetInput( in );
+  filter->SetNumberOfSamples( this->m_Parameters.GetUint( "NumberOfSamples" ) );
+  filter->Update( );
+  this->GetOutput( "Output" )->SetITK( filter->GetOutput( ) );
+}
+
+// eof - $RCSfile$
diff --git a/plugins/GenericFilters/PolyLineParametricPathToSimple3DCurve.h b/plugins/GenericFilters/PolyLineParametricPathToSimple3DCurve.h
new file mode 100644 (file)
index 0000000..7715811
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef __cpPluginsGenericFilters__PolyLineParametricPathToSimple3DCurve__h__
+#define __cpPluginsGenericFilters__PolyLineParametricPathToSimple3DCurve__h__
+
+#include <cpPluginsGenericFilters_Export.h>
+#include <cpPlugins/BaseObjects/ProcessObject.h>
+
+namespace cpPluginsGenericFilters
+{
+  /**
+   */
+  class cpPluginsGenericFilters_EXPORT PolyLineParametricPathToSimple3DCurve
+    : public cpPlugins::BaseObjects::ProcessObject
+  {
+    cpPluginsObject(
+      PolyLineParametricPathToSimple3DCurve,
+      cpPlugins::BaseObjects::ProcessObject,
+      GenericFilters
+      );
+  };
+
+} // ecapseman
+
+#endif // __cpPluginsGenericFilters__PolyLineParametricPathToSimple3DCurve__h__
+
+// eof - $RCSfile$