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 );
57 // Propagate modifications
60 this->InvokeEvent( vtkCommand::InteractionEvent, &mySlice );
65 // -------------------------------------------------------------------------
66 vtkPlane* cpExtensions::Visualization::ImageActor::
69 return( this->m_Mapper->GetSlicePlane( ) );
72 // -------------------------------------------------------------------------
73 const vtkPlane* cpExtensions::Visualization::ImageActor::
74 GetSlicePlane( ) const
76 return( this->m_Mapper->GetSlicePlane( ) );
79 // -------------------------------------------------------------------------
80 cpExtensions::Visualization::ImageActor::
84 this->m_Mapper = vtkSmartPointer< ImageSliceMapper >::New( );
85 this->SetMapper( this->m_Mapper );
88 // -------------------------------------------------------------------------
89 cpExtensions::Visualization::ImageActor::