1 #include <cpExtensions/Visualization/ImageActor.h>
2 #include <cpExtensions/Visualization/ImageSliceMapper.h>
4 #include <vtkImageData.h>
6 // -------------------------------------------------------------------------
7 void cpExtensions::Visualization::ImageActor::
10 if( this->m_Mapper->GetNumberOfInputConnections( 0 ) > 0 )
12 this->m_Mapper->Modified( );
13 this->m_Mapper->Update( );
14 this->Superclass::Modified( );
19 // -------------------------------------------------------------------------
20 int cpExtensions::Visualization::ImageActor::
21 GetOrientation( ) const
23 return( this->m_Mapper->GetOrientation( ) );
26 // -------------------------------------------------------------------------
27 void cpExtensions::Visualization::ImageActor::
28 SetOrientation( int orientation )
30 this->m_Mapper->SetOrientation( ( orientation < 3 )? orientation: 2 );
34 // -------------------------------------------------------------------------
35 int cpExtensions::Visualization::ImageActor::
36 GetSliceNumber( ) const
38 return( this->m_Mapper->GetSliceNumber( ) );
41 // -------------------------------------------------------------------------
42 void cpExtensions::Visualization::ImageActor::
43 SetSliceNumber( int slice )
46 auto image = this->m_Mapper->GetInput( );
51 if( s < this->m_Mapper->GetSliceNumberMinValue( ) )
52 s = this->m_Mapper->GetSliceNumberMinValue( );
53 if( s > this->m_Mapper->GetSliceNumberMaxValue( ) )
54 s = this->m_Mapper->GetSliceNumberMaxValue( );
55 this->m_Mapper->SetSliceNumber( s );
56 this->InvokeEvent( vtkCommand::InteractionEvent, &s );
58 // Propagate modifications
64 // -------------------------------------------------------------------------
65 vtkPlane* cpExtensions::Visualization::ImageActor::
68 return( this->m_Mapper->GetSlicePlane( ) );
71 // -------------------------------------------------------------------------
72 const vtkPlane* cpExtensions::Visualization::ImageActor::
73 GetSlicePlane( ) const
75 return( this->m_Mapper->GetSlicePlane( ) );
78 // -------------------------------------------------------------------------
79 cpExtensions::Visualization::ImageActor::
83 this->m_Mapper = vtkSmartPointer< ImageSliceMapper >::New( );
84 this->SetMapper( this->m_Mapper );
87 // -------------------------------------------------------------------------
88 cpExtensions::Visualization::ImageActor::