]> Creatis software - cpPlugins.git/blob - lib/cpPlugins/Extensions/Visualization/ImageInteractorStyle.h
MPR widget added. Not yet fully tested.
[cpPlugins.git] / lib / cpPlugins / Extensions / Visualization / ImageInteractorStyle.h
1 #ifndef __CPPLUGINS__EXTENSIONS__VISUALIZATION__IMAGEINTERACTORSTYLE__H__
2 #define __CPPLUGINS__EXTENSIONS__VISUALIZATION__IMAGEINTERACTORSTYLE__H__
3
4 #include <vtkInteractorStyleImage.h>
5 #include <vtkOrientationMarkerWidget.h>
6 #include <vtkPropPicker.h>
7 #include <vtkSmartPointer.h>
8
9 /* TODO
10    #include <vtkInteractorStyleImage.h>
11    #include <vtkLineWidget2.h>
12    #include <vtkLineRepresentation.h>
13    #include <vtkPlane.h>
14    class vtkImageData;
15 */
16
17 namespace cpPlugins
18 {
19   namespace Extensions
20   {
21     namespace Visualization
22     {
23       class ImageSliceActors;
24       class MPRActors;
25
26       /**
27        */
28       class ImageInteractorStyle
29         : public vtkInteractorStyleImage
30       {
31       public:
32         typedef ImageInteractorStyle Self;
33
34         enum InteractionMode
35         {
36           NavigationMode = 0,
37           DeformationMode
38         };
39
40       public:
41         vtkTypeMacro( ImageInteractorStyle, vtkInteractorStyleImage );
42
43       public:
44         static Self* New( );
45
46         void Configure(
47           ImageSliceActors* slice_actors,
48           MPRActors* mpr_actors = NULL
49           );
50
51         void SetModeToNavigation( );
52         void SetModeToDeformation( );
53         virtual void SetInteractor(
54           vtkRenderWindowInteractor* interactor, const int& axis
55           );
56
57         // Description:
58         // Event bindings controlling the effects of pressing mouse buttons
59         // or moving the mouse.
60         virtual void OnMouseMove( );
61         virtual void OnLeftButtonDown( );
62         virtual void OnLeftButtonUp( );
63         virtual void OnMiddleButtonDown( );
64         virtual void OnMiddleButtonUp( );
65         virtual void OnRightButtonDown( );
66         virtual void OnRightButtonUp( );
67         virtual void OnMouseWheelForward( );
68         virtual void OnMouseWheelBackward( );
69
70         // Description:
71         // Override the "fly-to" (f keypress) for images.
72         virtual void OnChar( );
73
74         // These methods for the different interactions in different modes
75         // are overridden in subclasses to perform the correct motion. Since
76         // they might be called from OnTimer, they do not have mouse coord
77         // parameters (use interactor's GetEventPosition and
78         // GetLastEventPosition)
79         virtual void Rotate( );
80         virtual void Pan( );
81         virtual void Spin( );
82         virtual void Zoom( );
83         virtual void WindowLevel( );
84         virtual void Pick( );
85         virtual void Slice( );
86
87         // Interaction mode entry points used internally.
88         virtual void StartWindowLevel( );
89         virtual void EndWindowLevel( );
90         virtual void StartPick( );
91         virtual void EndPick( );
92         virtual void StartSlice( );
93         virtual void EndSlice( );
94
95       protected:
96         ImageInteractorStyle( );
97         virtual ~ImageInteractorStyle( );
98
99         bool _PickPosition( double pos[ 3 ] );
100         void _UpdateCursor( );
101
102       private:
103         // Purposely not implemented
104         ImageInteractorStyle( const Self& );
105         Self& operator=( const Self& );
106
107       protected:
108         Self::InteractionMode Mode;
109
110         ImageSliceActors* m_SliceActors;
111         MPRActors*        m_MPRActors;
112
113         vtkSmartPointer< vtkOrientationMarkerWidget > OrientationWidget;
114         vtkSmartPointer< vtkPropPicker > PropPicker;
115
116       public:
117         static const int SliceEvent;
118       };
119
120     } // ecapseman
121
122   } // ecapseman
123
124 } // ecapseman
125
126 #endif // __CPPLUGINS__EXTENSIONS__VISUALIZATION__IMAGEINTERACTORSTYLE__H__
127
128 // eof - $RCSfile$