1 #ifndef __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
2 #define __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
4 #include <cpExtensions/cpExtensions_Export.h>
10 #include <vtkImageActor.h>
11 #include <vtkImageSliceMapper.h>
13 #include <vtkPolyData.h>
14 #include <vtkPolyDataMapper.h>
15 #include <vtkPropCollection.h>
16 #include <vtkSmartPointer.h>
17 #include <vtkTextActor.h>
19 #include <cpExtensions/Visualization/ImageInteractorStyle.h>
21 // -------------------------------------------------------------------------
22 class vtkAlgorithmOutput;
25 // -------------------------------------------------------------------------
26 namespace cpExtensions
28 namespace Visualization
32 class cpExtensions_EXPORT ImageSliceActors
33 : public vtkPropCollection
36 typedef ImageSliceActors Self;
39 vtkTypeMacro( ImageSliceActors, vtkPropCollection );
43 static ImageSliceActors* New( );
45 void AddInputConnection( vtkAlgorithmOutput* aout, int axis = 2 );
46 void AddInputData( vtkImageData* data, int axis = 2 );
49 vtkInteractorStyle* GetStyle( );
50 const vtkInteractorStyle* GetStyle( ) const;
52 void PushActorsInto( vtkRenderer* renderer );
53 void PopActorsFrom( vtkRenderer* renderer );
54 unsigned int GetNumberOfImageActors( ) const;
55 vtkImageActor* GetImageActor( unsigned int id );
56 const vtkImageActor* GetImageActor( unsigned int id ) const;
57 vtkTextActor* GetTextActor( );
58 const vtkTextActor* GetTextActor( ) const;
59 vtkActor* GetPlaneActor( );
60 const vtkActor* GetPlaneActor( ) const;
61 vtkPlane* GetPlaneFunction( );
62 const vtkPlane* GetPlaneFunction( ) const;
64 void AddActor( vtkAlgorithm* algorithm, vtkActor* actor );
65 void AddActor( vtkActor* actor );
67 void SetInterpolate( bool v );
68 void InterpolateOn( );
69 void InterpolateOff( );
71 double* GetDisplayBounds( ) const;
72 void GetDisplayBounds( double bounds[ 6 ] ) const;
75 int GetSliceNumber( ) const;
76 int GetSliceNumberMinValue( ) const;
77 int GetSliceNumberMaxValue( ) const;
78 void SetSliceNumber( const int& slice );
80 void UpdateText( double pos[ 3 ] );
81 void UpdateText( const double& w, const double& l );
85 virtual ~ImageSliceActors( );
87 void _ConfigureNewInput( int axis );
90 static void _MouseMoveCommand(
92 const ImageInteractorStyle::ButtonID& btn, double* pos,
93 bool alt, bool ctr, bool sft
95 static void _MouseClickCommand(
97 const ImageInteractorStyle::ButtonID& btn, double* pos,
98 bool alt, bool ctr, bool sft
100 static void _MouseDoubleClickCommand(
102 const ImageInteractorStyle::ButtonID& btn, double* pos,
103 bool alt, bool ctr, bool sft
105 static void _MouseWheelCommand(
107 const int& dir, bool alt, bool ctr, bool sft
109 static void _KeyCommand(
115 // Purposely not implemented
116 ImageSliceActors( const Self& );
117 Self& operator=( const Self& );
120 vtkSmartPointer< ImageInteractorStyle > Style;
123 std::vector< vtkSmartPointer< vtkImageSliceMapper > > SliceMappers;
124 std::vector< vtkSmartPointer< vtkImageActor > > ImageActors;
127 // Other associated actors
128 typedef std::pair< vtkAlgorithm*, vtkActor* > TAssociatedActor;
129 typedef std::vector< TAssociatedActor > TAssociatedActors;
130 TAssociatedActors AssociatedActors;
133 vtkSmartPointer< vtkPlane > PlaneFunction;
134 vtkSmartPointer< vtkPolyData > PlaneSource;
135 vtkSmartPointer< vtkPolyDataMapper > PlaneMapper;
136 char TextBuffer[ 1024 ];
137 vtkSmartPointer< vtkTextActor > TextActor;
138 vtkSmartPointer< vtkActor > PlaneActor;
145 #endif // __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__