1 #include <cpPlugins/Interface/DataObject.h>
3 #include <cpPlugins/Interface/ProcessObject.h>
4 #include <itkDataObject.h>
5 #include <vtkImageData.h>
6 #include <vtkPolyData.h>
8 // -------------------------------------------------------------------------
9 cpPlugins::Interface::ProcessObject* cpPlugins::Interface::DataObject::
12 auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
13 return( ptr->GetPointer( ) );
16 // -------------------------------------------------------------------------
17 const cpPlugins::Interface::ProcessObject* cpPlugins::Interface::DataObject::
20 auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
21 return( ptr->GetPointer( ) );
24 // -------------------------------------------------------------------------
25 void cpPlugins::Interface::DataObject::
26 SetSource( cpPlugins::Interface::ProcessObject* src )
28 auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
29 if( ptr->GetPointer( ) != src )
37 // -------------------------------------------------------------------------
38 void cpPlugins::Interface::DataObject::
39 DisconnectFromPipeline( )
41 // Disconnect input pipelines (ITK)
42 itk::DataObject* itk_obj = this->GetITK< itk::DataObject >( );
44 itk_obj->DisconnectPipeline( );
46 // Disconnect input pipelines (VTK)
47 vtkImageData* vtk_image = this->GetVTK< vtkImageData >( );
48 vtkPolyData* vtk_pd = this->GetVTK< vtkPolyData >( );
49 if( vtk_image != NULL )
51 vtkSmartPointer< vtkImageData > d =
52 vtkSmartPointer< vtkImageData >::New( );
53 d->ShallowCopy( vtk_image );
54 this->m_VTKObject = d;
56 else if( vtk_pd != NULL )
58 vtkSmartPointer< vtkPolyData > d =
59 vtkSmartPointer< vtkPolyData >::New( );
60 d->ShallowCopy( vtk_pd );
61 this->m_VTKObject = d;
66 auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );
71 // -------------------------------------------------------------------------
72 cpPlugins::Interface::DataObject::
76 this->m_Source = new ProcessObject::Pointer( );
79 // -------------------------------------------------------------------------
80 cpPlugins::Interface::DataObject::
83 auto ptr = reinterpret_cast< ProcessObject::Pointer* >( this->m_Source );