X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=blobdiff_plain;f=lib%2FcpPlugins%2FInterface%2FPolyLineParametricPath.cxx;h=9f4bdde4d50d8a488123c995114b4152baee4ef8;hb=7e29f3aec097ba1bff1894fed6eb1094276c5b72;hp=37be8af02bd7d8639c6066fa142cbbed7f0cda87;hpb=e561a2fa4dcaee2c544e58385e1ff7d56ba8b051;p=cpPlugins.git diff --git a/lib/cpPlugins/Interface/PolyLineParametricPath.cxx b/lib/cpPlugins/Interface/PolyLineParametricPath.cxx index 37be8af..9f4bdde 100644 --- a/lib/cpPlugins/Interface/PolyLineParametricPath.cxx +++ b/lib/cpPlugins/Interface/PolyLineParametricPath.cxx @@ -1,44 +1,10 @@ #include -#include -#include - -#define ITK_MANUAL_INSTANTIATION -#include -#include - -// ------------------------------------------------------------------------- -std::string cpPlugins::Interface::PolyLineParametricPath:: -GetClassName( ) const -{ - return( "cpPlugins::Interface::PolyLineParametricPath" ); -} - -// ------------------------------------------------------------------------- -void cpPlugins::Interface::PolyLineParametricPath:: -SetRealDataObject( itk::DataObject* dobj, itk::DataObject* ref_image ) -{ - typedef itk::PolyLineParametricPath< 2 > _T2; - typedef itk::PolyLineParametricPath< 3 > _T3; - - this->Superclass::SetRealDataObject( dobj ); - - if( ref_image != NULL ) - { - if( dynamic_cast< _T2* >( dobj ) != NULL ) - this->_VTK< 2 >( ref_image ); - else if( dynamic_cast< _T3* >( dobj ) != NULL ) - this->_VTK< 3 >( ref_image ); - - } // fi -} - // ------------------------------------------------------------------------- cpPlugins::Interface::PolyLineParametricPath:: PolyLineParametricPath( ) : Superclass( ) { - this->m_PolyData = vtkSmartPointer< vtkPolyData >::New( ); } // ------------------------------------------------------------------------- @@ -47,61 +13,4 @@ cpPlugins::Interface::PolyLineParametricPath:: { } -// ------------------------------------------------------------------------- -template< unsigned int D > -void cpPlugins::Interface::PolyLineParametricPath:: -_VTK( itk::DataObject* ref_image ) -{ - typedef itk::PolyLineParametricPath< D > _TPath; - typedef typename _TPath::VertexListType _TVertices; - typedef typename _TPath::ContinuousIndexType _TIndex; - typedef itk::ImageBase< D > _TImage; - typedef typename _TImage::PointType _TPoint; - - _TPath* path = - dynamic_cast< _TPath* >( this->m_RealDataObject.GetPointer( ) ); - if( path == NULL ) - return; - const _TVertices* vertices = path->GetVertexList( ); - if( vertices == NULL ) - return; - const _TImage* image = dynamic_cast< const _TImage* >( ref_image ); - - vtkSmartPointer< vtkPoints > points = - vtkSmartPointer< vtkPoints >::New( ); - vtkSmartPointer< vtkCellArray > lines = - vtkSmartPointer< vtkCellArray >::New( ); - double x, y, z; - for( unsigned int i = 0; i < vertices->Size( ); ++i ) - { - _TIndex idx = vertices->GetElement( i ); - if( image != NULL ) - { - _TPoint pnt; - image->TransformContinuousIndexToPhysicalPoint( idx, pnt ); - x = double( pnt[ 0 ] ); - y = double( pnt[ 1 ] ); - z = ( D >= 3 )? double( pnt[ 2 ] ): double( 0 ); - } - else - { - x = double( idx[ 0 ] ); - y = double( idx[ 1 ] ); - z = ( D >= 3 )? double( idx[ 2 ] ): double( 0 ); - - } // fi - points->InsertNextPoint( x, y, z ); - if( i > 0 ) - { - lines->InsertNextCell( 2 ); - lines->InsertCellPoint( i - 1 ); - lines->InsertCellPoint( i ); - - } // fi - - } // rof - this->m_PolyData->SetPoints( points ); - this->m_PolyData->SetLines( lines ); -} - // eof - $RCSfile$