1 #include <cpExtensions/Visualization/ImageActor.h>
2 #include <cpExtensions/Visualization/ImageSliceMapper.h>
4 #include <vtkCommand.h>
5 #include <vtkImageData.h>
7 // -------------------------------------------------------------------------
8 void cpExtensions::Visualization::ImageActor::
11 if( this->m_Mapper->GetNumberOfInputConnections( 0 ) > 0 )
13 this->m_Mapper->Modified( );
14 this->m_Mapper->Update( );
15 this->Superclass::Modified( );
20 // -------------------------------------------------------------------------
21 int cpExtensions::Visualization::ImageActor::
22 GetOrientation( ) const
24 return( this->m_Mapper->GetOrientation( ) );
27 // -------------------------------------------------------------------------
28 void cpExtensions::Visualization::ImageActor::
29 SetOrientation( int orientation )
31 this->m_Mapper->SetOrientation( ( orientation < 3 )? orientation: 2 );
35 // -------------------------------------------------------------------------
36 int cpExtensions::Visualization::ImageActor::
37 GetSliceNumber( ) const
39 return( this->m_Mapper->GetSliceNumber( ) );
42 // -------------------------------------------------------------------------
43 void cpExtensions::Visualization::ImageActor::
44 SetSliceNumber( int slice )
47 auto image = this->m_Mapper->GetInput( );
52 if( s < this->m_Mapper->GetSliceNumberMinValue( ) )
53 s = this->m_Mapper->GetSliceNumberMinValue( );
54 if( s > this->m_Mapper->GetSliceNumberMaxValue( ) )
55 s = this->m_Mapper->GetSliceNumberMaxValue( );
56 this->m_Mapper->SetSliceNumber( s );
57 this->InvokeEvent( vtkCommand::InteractionEvent, &s );
59 // Propagate modifications
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::