]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/DataObjects/Image.cxx
d7e26d4bac75084a5267f6fb2bbfd9feed316e90
[cpPlugins.git] / lib / cpPlugins / DataObjects / Image.cxx
1 #include <cpPlugins/DataObjects/Image.h>
2 #include <cpPlugins/DataObjects/Image.hxx>
3
4 // -------------------------------------------------------------------------
5 void cpPlugins::DataObjects::Image::
6 SetITK( itk::LightObject* o )
7 {
8   this->Superclass::SetITK( o );
9   cpPlugins_Demangle_ImageVisualDims( o, _ITK_2_VTK_0 );
10   else cpPlugins_Demangle_ImageDiffusionTensors3D( o, _ITK_2_VTK_1 );
11   else
12   {
13     this->m_VTK = NULL;
14     this->m_ITKvVTK = NULL;
15
16   } // fi
17   this->Modified( );
18 }
19
20 // -------------------------------------------------------------------------
21 void cpPlugins::DataObjects::Image::
22 SetVTK( vtkObjectBase* o )
23 {
24   vtkImageData* img = dynamic_cast< vtkImageData* >( o );
25   this->Superclass::SetVTK( img );
26   if( img == NULL )
27   {
28     this->m_ITK = NULL;
29     this->m_ITKvVTK = NULL;
30     this->Modified( );
31     return;
32
33   } // fi
34
35   // Connect both worlds
36   this->_VTK_2_ITK_0< unsigned char >( img );
37   /* TODO
38      switch( img->GetScalarType( ) )
39      {
40      case VTK_CHAR: this->_VTK_2_ITK_0< char >( img ); break;
41      case VTK_SHORT: this->_VTK_2_ITK_0< short >( img ); break;
42      case VTK_INT: this->_VTK_2_ITK_0< int >( img ); break;
43      case VTK_LONG: this->_VTK_2_ITK_0< long >( img ); break;
44      case VTK_UNSIGNED_CHAR: this->_VTK_2_ITK_0< unsigned char >( img ); break;
45      case VTK_UNSIGNED_SHORT: this->_VTK_2_ITK_0< unsigned short >( img ); break;
46      case VTK_UNSIGNED_INT: this->_VTK_2_ITK_0< unsigned int >( img ); break;
47      case VTK_UNSIGNED_LONG: this->_VTK_2_ITK_0< unsigned long >( img ); break;
48      case VTK_FLOAT: this->_VTK_2_ITK_0< float >( img ); break;
49      case VTK_DOUBLE: this->_VTK_2_ITK_0< double >( img ); break;
50      default:
51      {
52      this->m_ITK = NULL;
53      this->m_ITKvVTK = NULL;
54
55      }
56      } // hctiws
57   */
58   this->Modified( );
59 }
60
61 // -------------------------------------------------------------------------
62 cpPlugins::DataObjects::Image::
63 Image( )
64   : Superclass( )
65 {
66 }
67
68 // -------------------------------------------------------------------------
69 cpPlugins::DataObjects::Image::
70 ~Image( )
71 {
72 }
73
74 // eof - $RCSfile$