]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Image.cxx
...
[cpPlugins.git] / lib / cpPlugins / Image.cxx
1 #include <cpPlugins/Image.h>
2
3 #include <vtkImageActor.h>
4 #include <vtkImageProperty.h>
5 #include <vtkImageSliceMapper.h>
6
7 // -------------------------------------------------------------------------
8 void cpPlugins::Image::
9 SetITK( itk::LightObject* o )
10 {
11   this->Superclass::SetITK( o );
12   bool     s = this->_ITK_2_VTK_0< 2 >( o );
13   if( !s ) s = this->_ITK_2_VTK_0< 3 >( o );
14   if( !s )
15   {
16     this->m_VTKObject = NULL;
17     this->m_ITKvVTK = NULL;
18
19   } // fi
20   this->Modified( );
21 }
22
23 // -------------------------------------------------------------------------
24 void cpPlugins::Image::
25 SetVTK( vtkObjectBase* o )
26 {
27   this->Superclass::SetVTK( o );
28   std::cerr << "Image: TODO this!!!!" << std::endl;
29   std::exit( 1 );
30 }
31
32 // -------------------------------------------------------------------------
33 cpPlugins::Image::
34 Image( )
35   : Superclass( )
36 {
37 }
38
39 // -------------------------------------------------------------------------
40 cpPlugins::Image::
41 ~Image( )
42 {
43 }
44
45 // -------------------------------------------------------------------------
46 void cpPlugins::Image::
47 _CreateVTKActor( ) const
48 {
49   vtkImageData* image =
50     const_cast< vtkImageData* >( this->GetVTK< vtkImageData >( ) );
51   if( image != NULL )
52   {
53     vtkImageSliceMapper* mapper = vtkImageSliceMapper::New( );
54     vtkImageActor* actor = vtkImageActor::New( );
55     mapper->SetInputData( image );
56     actor->SetMapper( mapper );
57     actor->GetProperty( )->SetInterpolationTypeToNearest( );
58     this->m_Actor = actor;
59     mapper->Delete( );
60
61   } // fi
62 }
63
64 // eof - $RCSfile$