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 <vtkImageMapToColors.h>
13 #include <vtkImageSliceMapper.h>
15 #include <vtkPolyData.h>
16 #include <vtkPolyDataMapper.h>
17 #include <vtkPropCollection.h>
18 #include <vtkTextActor.h>
20 #include <cpExtensions/Visualization/ImageInteractorStyle.h>
22 // -------------------------------------------------------------------------
23 class vtkAlgorithmOutput;
26 // -------------------------------------------------------------------------
27 namespace cpExtensions
29 namespace Visualization
33 class cpExtensions_EXPORT ImageSliceActors
34 : public vtkPropCollection
37 typedef ImageSliceActors Self;
40 vtkTypeMacro( ImageSliceActors, vtkPropCollection );
51 static ImageSliceActors* New( );
53 void AddInputConnection(
54 vtkAlgorithmOutput* aout,
56 LUTType lut = Self::LUTType_None
61 LUTType lut = Self::LUTType_None );
64 vtkInteractorStyle* GetStyle( );
65 const vtkInteractorStyle* GetStyle( ) const;
67 void PushActorsInto( vtkRenderWindow* window, bool force_style = true );
68 void PopActorsFrom( vtkRenderWindow* window );
69 unsigned int GetNumberOfImageActors( ) const;
70 vtkImageActor* GetImageActor( unsigned int id );
71 const vtkImageActor* GetImageActor( unsigned int id ) const;
72 vtkTextActor* GetTextActor( );
73 const vtkTextActor* GetTextActor( ) const;
74 vtkActor* GetPlaneActor( );
75 const vtkActor* GetPlaneActor( ) const;
76 vtkPlane* GetPlaneFunction( );
77 const vtkPlane* GetPlaneFunction( ) const;
79 void AddActor( vtkAlgorithm* algorithm, vtkActor* actor );
80 void AddActor( vtkActor* actor );
82 void SetInterpolate( bool v );
83 void InterpolateOn( );
84 void InterpolateOff( );
86 double* GetDisplayBounds( ) const;
87 void GetDisplayBounds( double bounds[ 6 ] ) const;
90 void SetCursor( double pos[ 3 ] );
92 vtkImageMapToColors* GetImageMap( unsigned int id );
93 const vtkImageMapToColors* GetImageMap( unsigned int id ) const;
95 double GetWindow( unsigned int id ) const;
96 double GetLevel( unsigned int id ) const;
97 void SetWindow( unsigned int id, double w );
98 void SetLevel( unsigned int id, double l );
99 void SetWindowLevel( unsigned int id, double w, double l );
100 void ResetWindowLevel( unsigned int id );
102 int GetAxis( ) const;
103 int GetSliceNumber( ) const;
104 int GetSliceNumberMinValue( ) const;
105 int GetSliceNumberMaxValue( ) const;
106 void SetSliceNumber( const int& slice );
108 void UpdateText( double pos[ 3 ] );
109 void UpdateText( const double& w, const double& l );
113 virtual ~ImageSliceActors( );
115 void _ConfigureNewLUT( vtkImageData* data, LUTType lut_t );
116 void _ConfigureNewInput( int axis );
119 static void _MouseMoveCommand(
121 const ImageInteractorStyle::ButtonID& btn, double* pos,
122 bool alt, bool ctr, bool sft
124 static void _MouseClickCommand(
126 const ImageInteractorStyle::ButtonID& btn, double* pos,
127 bool alt, bool ctr, bool sft
129 static void _MouseDoubleClickCommand(
131 const ImageInteractorStyle::ButtonID& btn, double* pos,
132 bool alt, bool ctr, bool sft
134 static void _MouseWheelCommand(
136 const int& dir, bool alt, bool ctr, bool sft
138 static void _KeyCommand(
144 // Purposely not implemented
145 ImageSliceActors( const Self& );
146 Self& operator=( const Self& );
149 vtkSmartPointer< ImageInteractorStyle > Style;
152 std::vector< vtkSmartPointer< vtkImageMapToColors > > ImageMaps;
153 std::vector< vtkSmartPointer< vtkImageSliceMapper > > SliceMappers;
154 std::vector< vtkSmartPointer< vtkImageActor > > ImageActors;
157 // Other associated actors
158 typedef std::pair< vtkAlgorithm*, vtkActor* > TAssociatedActor;
159 typedef std::vector< TAssociatedActor > TAssociatedActors;
160 TAssociatedActors AssociatedActors;
163 vtkSmartPointer< vtkPolyData > Cursor;
164 vtkSmartPointer< vtkPolyDataMapper > CursorMapper;
165 vtkSmartPointer< vtkActor > CursorActor;
166 vtkSmartPointer< vtkPlane > PlaneFunction;
167 vtkSmartPointer< vtkPolyData > PlaneSource;
168 vtkSmartPointer< vtkPolyDataMapper > PlaneMapper;
169 char TextBuffer[ 1024 ];
170 vtkSmartPointer< vtkTextActor > TextActor;
171 vtkSmartPointer< vtkActor > PlaneActor;
173 double StartWindowLevelPos[ 3 ];
174 double StartWindowLevel[ 2 ];
181 #endif // __CPEXTENSIONS__VISUALIZATION__IMAGESLICEACTORS__H__