X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2Ffpa%2FImage%2FPolyLineParametricPathToPolyDataFilter.hxx;fp=lib%2Ffpa%2FImage%2FPolyLineParametricPathToPolyDataFilter.hxx;h=0000000000000000000000000000000000000000;hb=3c639e5da479c7216a0a302ffa156ac6762caeed;hp=7dd4cb1793f3fa523a90fc25ca58a16065cd701b;hpb=5bf766068f54d061d3816f4950a076c3cf3a4d8b;p=FrontAlgorithms.git diff --git a/lib/fpa/Image/PolyLineParametricPathToPolyDataFilter.hxx b/lib/fpa/Image/PolyLineParametricPathToPolyDataFilter.hxx deleted file mode 100644 index 7dd4cb1..0000000 --- a/lib/fpa/Image/PolyLineParametricPathToPolyDataFilter.hxx +++ /dev/null @@ -1,145 +0,0 @@ -// ========================================================================= -// @author Leonardo Florez Valencia -// @email florez-l@javeriana.edu.co -// ========================================================================= - -#ifndef __fpa__Image__PolyLineParametricPathToPolyDataFilter__hxx__ -#define __fpa__Image__PolyLineParametricPathToPolyDataFilter__hxx__ - -#ifdef USE_VTK -# include -# include -# include -# include -# include -# include -#endif // USE_VTK - -// ------------------------------------------------------------------------- -template< class _TPolyLineParametricPath > -typename fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >:: -Self* fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >:: -New( ) -{ - return( new Self( ) ); -} - -// ------------------------------------------------------------------------- -template< class _TPolyLineParametricPath > -const typename -fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >:: -TPolyLineParametricPath* fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >:: -GetInput( ) const -{ - return( this->m_PolyLineParametricPath ); -} - -// ------------------------------------------------------------------------- -template< class _TPolyLineParametricPath > -void fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >:: -SetInput( const TPolyLineParametricPath* path ) -{ - if( this->m_PolyLineParametricPath != path ) - { - this->m_PolyLineParametricPath = path; -#ifdef USE_VTK - this->Modified( ); -#endif // USE_VTK - - } // fi -} - -// ------------------------------------------------------------------------- -template< class _TPolyLineParametricPath > -fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >:: -PolyLineParametricPathToPolyDataFilter( ) -#ifdef USE_VTK - : vtkPolyDataAlgorithm( ), - m_PolyLineParametricPath( NULL ) -#endif // USE_VTK -{ -#ifdef USE_VTK - this->SetNumberOfInputPorts( 0 ); -#endif // USE_VTK -} - -// ------------------------------------------------------------------------- -template< class _TPolyLineParametricPath > -fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >:: -~PolyLineParametricPathToPolyDataFilter( ) -{ -} - -#ifdef USE_VTK -// ------------------------------------------------------------------------- -template< class _TPolyLineParametricPath > -int fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >:: -RequestData( - vtkInformation* information, - vtkInformationVector** input, - vtkInformationVector* output - ) -{ - static const unsigned int dim = TPolyLineParametricPath::PathDimension; - if( this->m_PolyLineParametricPath == 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( ) ); - vtkSmartPointer< vtkUnsignedIntArray > darray = - vtkSmartPointer< vtkUnsignedIntArray >::New( ); - darray->SetNumberOfComponents( 1 ); - out->GetPointData( )->SetScalars( darray ); - vtkPoints* points = out->GetPoints( ); - vtkCellArray* lines = out->GetLines( ); - - // Assign all data - const TPolyLineParametricPath* path = this->GetInput( ); - for( unsigned long i = 0; i < path->GetSize( ); ++i ) - { - auto pnt = path->GetPoint( i ); - if( dim == 1 ) - points->InsertNextPoint( pnt[ 0 ], 0, 0 ); - else if( dim == 2 ) - points->InsertNextPoint( pnt[ 0 ], pnt[ 1 ], 0 ); - else - points->InsertNextPoint( pnt[ 0 ], pnt[ 1 ], pnt[ 2 ] ); - darray->InsertNextTuple1( double( i ) ); - if( i > 0 ) - { - lines->InsertNextCell( 2 ); - lines->InsertCellPoint( points->GetNumberOfPoints( ) - 2 ); - lines->InsertCellPoint( points->GetNumberOfPoints( ) - 1 ); - - } // fi - - } // rof - return( 1 ); -} - -// ------------------------------------------------------------------------- -template< class _TPolyLineParametricPath > -int fpa::Image::PolyLineParametricPathToPolyDataFilter< _TPolyLineParametricPath >:: -RequestInformation( - vtkInformation* information, - vtkInformationVector** input, - vtkInformationVector* output - ) -{ - return( 1 ); -} -#endif // USE_VTK - -#endif // __fpa__Image__PolyLineParametricPathToPolyDataFilterFilter__hxx__ - -// eof - $RCSfile$