]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Path.hxx
b6fb093ca68f5acd7633e223ffd0460b03a4fa61
[cpPlugins.git] / lib / cpPlugins / Path.hxx
1 #ifndef __CPPLUGINS__PATH__HXX__
2 #define __CPPLUGINS__PATH__HXX__
3
4 #include <cpPlugins_Instances/Paths.h>
5
6 // -------------------------------------------------------------------------
7 template< unsigned int _NDim >
8 bool cpPlugins::Path::
9 _ITK_2_VTK( itk::LightObject* o )
10 {
11   typedef
12     cpExtensions::DataStructures::PolyLineParametricPath< _NDim >
13     _TPath;
14   typedef
15     cpExtensions::Visualization::PolyLineParametricPathToPolyData< _TPath >
16     _TFilter;
17
18   auto path = dynamic_cast< _TPath* >( o );
19   if( path != NULL )
20   {
21     _TFilter* f = dynamic_cast< _TFilter* >( this->m_ITKvVTK.GetPointer( ) );
22     if( f == NULL )
23     {
24       vtkSmartPointer< _TFilter > nf = _TFilter::New( );
25       this->m_ITKvVTK = nf.GetPointer( );
26       f = nf.GetPointer( );
27
28     } // fi
29     f->SetInput( path );
30     f->SetReferenceImage( path->GetReferenceImage( ) );
31     f->Update( );
32
33     // Keep object track
34     this->m_ITKObject = o;
35     this->m_VTKObject = f->GetOutput( );
36     return( true );
37   }
38   else
39     return( false );
40 }
41
42 #endif // __CPPLUGINS__PATH__HXX__
43
44 // eof - $RCSfile$