1 #ifndef __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
2 #define __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__
4 #include <cpExtensions/cpExtensions_Export.h>
9 #include <vtkSmartPointer.h>
11 #include <vtkImageActor.h>
12 #include <vtkImageSliceMapper.h>
14 #include <vtkPolyData.h>
15 #include <vtkPolyDataMapper.h>
16 #include <vtkPropCollection.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( vtkRenderWindow* window );
53 void PopActorsFrom( vtkRenderWindow* window );
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 void SetCursor( double pos[ 3 ] );
78 int GetSliceNumber( ) const;
79 int GetSliceNumberMinValue( ) const;
80 int GetSliceNumberMaxValue( ) const;
81 void SetSliceNumber( const int& slice );
83 void UpdateText( double pos[ 3 ] );
84 void UpdateText( const double& w, const double& l );
88 virtual ~ImageSliceActors( );
90 void _ConfigureNewInput( int axis );
93 static void _MouseMoveCommand(
95 const ImageInteractorStyle::ButtonID& btn, double* pos,
96 bool alt, bool ctr, bool sft
98 static void _MouseClickCommand(
100 const ImageInteractorStyle::ButtonID& btn, double* pos,
101 bool alt, bool ctr, bool sft
103 static void _MouseDoubleClickCommand(
105 const ImageInteractorStyle::ButtonID& btn, double* pos,
106 bool alt, bool ctr, bool sft
108 static void _MouseWheelCommand(
110 const int& dir, bool alt, bool ctr, bool sft
112 static void _KeyCommand(
118 // Purposely not implemented
119 ImageSliceActors( const Self& );
120 Self& operator=( const Self& );
123 vtkSmartPointer< ImageInteractorStyle > Style;
126 std::vector< vtkSmartPointer< vtkImageSliceMapper > > SliceMappers;
127 std::vector< vtkSmartPointer< vtkImageActor > > ImageActors;
130 // Other associated actors
131 typedef std::pair< vtkAlgorithm*, vtkActor* > TAssociatedActor;
132 typedef std::vector< TAssociatedActor > TAssociatedActors;
133 TAssociatedActors AssociatedActors;
136 vtkSmartPointer< vtkPolyData > Cursor;
137 vtkSmartPointer< vtkPolyDataMapper > CursorMapper;
138 vtkSmartPointer< vtkActor > CursorActor;
139 vtkSmartPointer< vtkPlane > PlaneFunction;
140 vtkSmartPointer< vtkPolyData > PlaneSource;
141 vtkSmartPointer< vtkPolyDataMapper > PlaneMapper;
142 char TextBuffer[ 1024 ];
143 vtkSmartPointer< vtkTextActor > TextActor;
144 vtkSmartPointer< vtkActor > PlaneActor;
151 #endif // __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__