1 #include <cpPlugins/DataObject.h>
3 #include <cpPlugins/ProcessObject.h>
4 #include <itkDataObject.h>
5 #include <vtkImageData.h>
6 #include <vtkPolyData.h>
9 // -------------------------------------------------------------------------
10 cpPlugins::ProcessObject* cpPlugins::DataObject::
13 return( this->m_Source );
16 // -------------------------------------------------------------------------
17 const cpPlugins::ProcessObject* cpPlugins::DataObject::
20 return( this->m_Source );
23 // -------------------------------------------------------------------------
24 void cpPlugins::DataObject::
25 SetSource( cpPlugins::ProcessObject* src )
27 if( this->m_Source != src )
35 // -------------------------------------------------------------------------
36 void cpPlugins::DataObject::
37 DisconnectFromPipeline( )
39 // Disconnect input pipelines (ITK)
40 itk::DataObject* itk_obj = this->GetITK< itk::DataObject >( );
42 itk_obj->DisconnectPipeline( );
44 // Disconnect input pipelines (VTK)
45 vtkImageData* vtk_image = this->GetVTK< vtkImageData >( );
46 vtkPolyData* vtk_pd = this->GetVTK< vtkPolyData >( );
47 if( vtk_image != NULL )
49 vtkSmartPointer< vtkImageData > d =
50 vtkSmartPointer< vtkImageData >::New( );
51 d->ShallowCopy( vtk_image );
52 this->m_VTKObject = d;
54 else if( vtk_pd != NULL )
56 vtkSmartPointer< vtkPolyData > d =
57 vtkSmartPointer< vtkPolyData >::New( );
58 d->ShallowCopy( vtk_pd );
59 this->m_VTKObject = d;
64 this->m_Source = NULL;
68 // -------------------------------------------------------------------------
69 vtkProp* cpPlugins::DataObject::
72 if( this->m_Actor.GetPointer( ) == NULL )
73 this->_CreateVTKActor( );
74 return( this->m_Actor.GetPointer( ) );
77 // -------------------------------------------------------------------------
78 const vtkProp* cpPlugins::DataObject::
81 if( this->m_Actor.GetPointer( ) == NULL )
82 this->_CreateVTKActor( );
83 return( this->m_Actor.GetPointer( ) );
86 // -------------------------------------------------------------------------
87 cpPlugins::DataObject::
98 // -------------------------------------------------------------------------
99 cpPlugins::DataObject::
103 if( this->m_Actor != NULL )
104 this->m_Actor->Delete( );
108 // -------------------------------------------------------------------------
109 void cpPlugins::DataObject::
110 _CreateVTKActor( ) const