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 #include <vtkPropCollection.h>
44 // -------------------------------------------------------------------------
45 void cpExtensions::Visualization::ImageActor::
46 SetSliceNumber( int slice )
49 auto image = this->m_Mapper->GetInput( );
54 if( s < this->m_Mapper->GetSliceNumberMinValue( ) )
55 s = this->m_Mapper->GetSliceNumberMinValue( );
56 if( s > this->m_Mapper->GetSliceNumberMaxValue( ) )
57 s = this->m_Mapper->GetSliceNumberMaxValue( );
58 this->m_Mapper->SetSliceNumber( s );
60 // Update display extent
63 image->GetExtent( ext );
64 int o = this->m_Mapper->GetOrientation( );
65 ext[ o << 1 ] = ext[ ( o << 1 ) + 1 ] = s;
66 this->SetDisplayExtent( ext );
69 // Propagate modifications
72 this->InvokeEvent( vtkCommand::InteractionEvent, &mySlice );
77 // -------------------------------------------------------------------------
78 vtkPlane* cpExtensions::Visualization::ImageActor::
81 return( this->m_Mapper->GetSlicePlane( ) );
84 // -------------------------------------------------------------------------
85 const vtkPlane* cpExtensions::Visualization::ImageActor::
86 GetSlicePlane( ) const
88 return( this->m_Mapper->GetSlicePlane( ) );
91 // -------------------------------------------------------------------------
92 cpExtensions::Visualization::ImageActor::
96 this->m_Mapper = vtkSmartPointer< ImageSliceMapper >::New( );
97 this->SetMapper( this->m_Mapper );
100 // -------------------------------------------------------------------------
101 cpExtensions::Visualization::ImageActor::