+#ifndef __CPEXTENSIONS__VISUALIZATION__POLYLINEPARAMETRICPATHTOPOLYDATA__HXX__
+#define __CPEXTENSIONS__VISUALIZATION__POLYLINEPARAMETRICPATHTOPOLYDATA__HXX__
+
+#include <vtkInformation.h>
+#include <vtkInformationVector.h>
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine >
+typename
+cpExtensions::Visualization::PolyLineParametricPathToPolyData< _TPolyLine >::
+Self*
+cpExtensions::Visualization::PolyLineParametricPathToPolyData< _TPolyLine >::
+New( )
+{
+ return( new Self( ) );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine >
+const typename
+cpExtensions::Visualization::PolyLineParametricPathToPolyData< _TPolyLine >::
+TPolyLine*
+cpExtensions::Visualization::PolyLineParametricPathToPolyData< _TPolyLine >::
+GetInput( ) const
+{
+ return( this->m_PolyLine );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine >
+const typename
+cpExtensions::Visualization::PolyLineParametricPathToPolyData< _TPolyLine >::
+TImage*
+cpExtensions::Visualization::PolyLineParametricPathToPolyData< _TPolyLine >::
+GetReferenceImage( ) const
+{
+ return( this->m_ReferenceImage );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine >
+void
+cpExtensions::Visualization::PolyLineParametricPathToPolyData< _TPolyLine >::
+SetInput( const TPolyLine* pl )
+{
+ if( this->m_PolyLine != pl )
+ {
+ this->m_PolyLine = pl;
+ this->Modified( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine >
+void
+cpExtensions::Visualization::PolyLineParametricPathToPolyData< _TPolyLine >::
+SetReferenceImage( const TImage* i )
+{
+ if( this->m_ReferenceImage != i )
+ {
+ this->m_ReferenceImage = i;
+ this->Modified( );
+
+ } // fi
+}
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine >
+cpExtensions::Visualization::PolyLineParametricPathToPolyData< _TPolyLine >::
+PolyLineParametricPathToPolyData( )
+ : vtkPolyDataAlgorithm( ),
+ m_PolyLine( NULL ),
+ m_ReferenceImage( NULL )
+{
+ this->SetNumberOfInputPorts( 0 );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine >
+cpExtensions::Visualization::PolyLineParametricPathToPolyData< _TPolyLine >::
+~PolyLineParametricPathToPolyData( )
+{
+}
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine >
+int
+cpExtensions::Visualization::PolyLineParametricPathToPolyData< _TPolyLine >::
+RequestData(
+ vtkInformation* information,
+ vtkInformationVector** input,
+ vtkInformationVector* output
+ )
+{
+ static const unsigned int dim = _TPolyLine::PathDimension;
+
+ if( this->m_PolyLine == NULL )
+ return( 0 );
+
+ // Get output
+ vtkInformation* info = output->GetInformationObject( 0 );
+ vtkPolyData* out = vtkPolyData::SafeDownCast(
+ info->Get( vtkDataObject::DATA_OBJECT( ) )
+ );
+
+ // Get input data
+ auto lst = this->m_PolyLine->GetVertexList( );
+
+ // Prepare points
+ vtkPoints* points = out->GetPoints( );
+ if( points == NULL )
+ {
+ points = vtkPoints::New( );
+ out->SetPoints( points );
+ points->Delete( );
+
+ } // fi
+ points->SetNumberOfPoints( lst->Size( ) );
+
+ // Prepare cells
+ vtkSmartPointer< vtkCellArray > verts =
+ vtkSmartPointer< vtkCellArray >::New( );
+ vtkSmartPointer< vtkCellArray > lines =
+ vtkSmartPointer< vtkCellArray >::New( );
+
+ for( unsigned int i = 0; i < lst->Size( ); ++i )
+ {
+ auto idx = lst->GetElement( i );
+ if( this->m_ReferenceImage != NULL )
+ {
+ typename TImage::PointType pnt;
+ this->m_ReferenceImage->TransformContinuousIndexToPhysicalPoint( idx, pnt );
+ if( dim == 1 )
+ points->SetPoint( i, pnt[ 0 ], 0, 0 );
+ else if( dim == 2 )
+ points->SetPoint( i, pnt[ 0 ], pnt[ 1 ], 0 );
+ else
+ points->SetPoint( i, pnt[ 0 ], pnt[ 1 ], pnt[ 2 ] );
+ }
+ else
+ {
+ if( dim == 1 )
+ points->SetPoint( i, idx[ 0 ], 0, 0 );
+ else if( dim == 2 )
+ points->SetPoint( i, idx[ 0 ], idx[ 1 ], 0 );
+ else
+ points->SetPoint( i, idx[ 0 ], idx[ 1 ], idx[ 2 ] );
+
+ } // fi
+ verts->InsertNextCell( 1 );
+ verts->InsertCellPoint( i );
+ if( i > 0 )
+ {
+ lines->InsertNextCell( 2 );
+ lines->InsertCellPoint( i - 1 );
+ lines->InsertCellPoint( i );
+
+ } // fi
+
+ } // rof
+ out->SetPoints( points );
+ out->SetVerts( verts );
+ out->SetLines( lines );
+ return( 1 );
+}
+
+// -------------------------------------------------------------------------
+template< class _TPolyLine >
+int
+cpExtensions::Visualization::PolyLineParametricPathToPolyData< _TPolyLine >::
+RequestInformation(
+ vtkInformation* information,
+ vtkInformationVector** input,
+ vtkInformationVector* output
+ )
+{
+ vtkInformation* info = output->GetInformationObject( 0 );
+ /* TODO
+ info->Set(
+ vtkStreamingDemandDrivenPipeline::MAXIMUM_NUMBER_OF_PIECES( ), -1
+ );
+ */
+
+ if( this->m_PolyLine != NULL && this->m_ReferenceImage != NULL )
+ {
+ /* TODO
+ typename C::TScalar len = this->m_RGC->GetTotalLength( );
+ typename C::TScalar s0 = this->m_RGC->Gets0( );
+ typename C::TPoint p0 = this->m_RGC->Axis( s0 );
+ typename C::TPoint p1 = this->m_RGC->Axis( s0 + len );
+
+ info->Set(
+ vtkStreamingDemandDrivenPipeline::WHOLE_BOUNDING_BOX( ),
+ double( p0[ 0 ] ), double( p1[ 0 ] ),
+ double( p0[ 1 ] ), double( p1[ 1 ] ),
+ double( p0[ 2 ] ), double( p1[ 2 ] )
+ );
+ */
+
+ } // fi
+ return( 1 );
+}
+
+#endif // __CPEXTENSIONS__VISUALIZATION__POLYLINEPARAMETRICPATHTOPOLYDATA__HXX__
+
+// eof - $RCSfile$