]> Creatis software - cpPlugins.git/blob - plugins/Extensions/Simple3DCurve.cxx
25aa5a1487269bac67654f1a75b3697651be950b
[cpPlugins.git] / plugins / Extensions / Simple3DCurve.cxx
1 #include <Extensions/Simple3DCurve.h>
2 #include <cpExtensions/DataStructures/Simple3DCurve.h>
3 #include <cpExtensions/Visualization/Simple3DCurveToPolyData.h>
4
5 // -------------------------------------------------------------------------
6 void cpPluginsExtensions::Simple3DCurve::
7 SetITK( itk::LightObject* o )
8 {
9   cpPlugins_Demangle_Simple3DCurve_All_1( o, _ITK_2_VTK )
10   {
11     this->m_VTK = NULL;
12     this->m_ITKvVTK = NULL;
13   }
14 }
15
16 // -------------------------------------------------------------------------
17 void cpPluginsExtensions::Simple3DCurve::
18 SetVTK( vtkObjectBase* o )
19 {
20   // Do nothing
21   this->m_ITK = NULL;
22   this->m_VTK = NULL;
23   this->m_ITKvVTK = NULL;
24 }
25
26 // -------------------------------------------------------------------------
27 cpPluginsExtensions::Simple3DCurve::
28 Simple3DCurve( )
29   : Superclass( )
30 {
31 }
32
33 // -------------------------------------------------------------------------
34 cpPluginsExtensions::Simple3DCurve::
35 ~Simple3DCurve( )
36 {
37 }
38
39 // -------------------------------------------------------------------------
40 template< class _TSimple3DCurve >
41 void cpPluginsExtensions::Simple3DCurve::
42 _ITK_2_VTK( _TSimple3DCurve* curve )
43 {
44   typedef
45     cpExtensions::Visualization::Simple3DCurveToPolyData< _TSimple3DCurve >
46     _TFilter;
47   _TFilter* f = dynamic_cast< _TFilter* >( this->m_ITKvVTK.GetPointer( ) );
48   if( f == NULL )
49   {
50     _TFilter* nf = _TFilter::New( );
51     this->m_ITKvVTK = nf;
52     f = nf;
53
54   } // fi
55   f->SetInput( curve );
56   f->Update( );
57
58   // Keep object track
59   this->m_ITK = curve;
60   this->m_VTK = f->GetOutput( );
61 }
62
63 // eof - $RCSfile$