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