VTK
vtkInteractorStyleImage.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkInteractorStyleImage.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
59 #ifndef vtkInteractorStyleImage_h
60 #define vtkInteractorStyleImage_h
61 
62 #include "vtkInteractionStyleModule.h" // For export macro
64 
65 // Motion flags
66 
67 #define VTKIS_WINDOW_LEVEL 1024
68 #define VTKIS_PICK 1025
69 #define VTKIS_SLICE 1026
70 
71 // Style flags
72 
73 #define VTKIS_IMAGE2D 2
74 #define VTKIS_IMAGE3D 3
75 #define VTKIS_IMAGE_SLICING 4
76 
77 class vtkImageProperty;
78 
79 class VTKINTERACTIONSTYLE_EXPORT vtkInteractorStyleImage : public vtkInteractorStyleTrackballCamera
80 {
81 public:
82  static vtkInteractorStyleImage *New();
84  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
85 
87 
90  vtkGetVector2Macro(WindowLevelStartPosition,int);
91  vtkGetVector2Macro(WindowLevelCurrentPosition,int);
93 
95 
99  void OnMouseMove() VTK_OVERRIDE;
100  void OnLeftButtonDown() VTK_OVERRIDE;
101  void OnLeftButtonUp() VTK_OVERRIDE;
102  void OnMiddleButtonDown() VTK_OVERRIDE;
103  void OnMiddleButtonUp() VTK_OVERRIDE;
104  void OnRightButtonDown() VTK_OVERRIDE;
105  void OnRightButtonUp() VTK_OVERRIDE;
107 
111  void OnChar() VTK_OVERRIDE;
112 
113  // These methods for the different interactions in different modes
114  // are overridden in subclasses to perform the correct motion. Since
115  // they might be called from OnTimer, they do not have mouse coord parameters
116  // (use interactor's GetEventPosition and GetLastEventPosition)
117  virtual void WindowLevel();
118  virtual void Pick();
119  virtual void Slice();
120 
121  // Interaction mode entry points used internally.
122  virtual void StartWindowLevel();
123  virtual void EndWindowLevel();
124  virtual void StartPick();
125  virtual void EndPick();
126  virtual void StartSlice();
127  virtual void EndSlice();
128 
130 
136  vtkSetClampMacro(InteractionMode, int, VTKIS_IMAGE2D, VTKIS_IMAGE_SLICING);
137  vtkGetMacro(InteractionMode, int);
138  void SetInteractionModeToImage2D() {
139  this->SetInteractionMode(VTKIS_IMAGE2D); }
141  this->SetInteractionMode(VTKIS_IMAGE3D); }
143  this->SetInteractionMode(VTKIS_IMAGE_SLICING); }
145 
147 
151  vtkSetVector3Macro(XViewRightVector, double);
152  vtkGetVector3Macro(XViewRightVector, double);
153  vtkSetVector3Macro(XViewUpVector, double);
154  vtkGetVector3Macro(XViewUpVector, double);
155  vtkSetVector3Macro(YViewRightVector, double);
156  vtkGetVector3Macro(YViewRightVector, double);
157  vtkSetVector3Macro(YViewUpVector, double);
158  vtkGetVector3Macro(YViewUpVector, double);
159  vtkSetVector3Macro(ZViewRightVector, double);
160  vtkGetVector3Macro(ZViewRightVector, double);
161  vtkSetVector3Macro(ZViewUpVector, double);
162  vtkGetVector3Macro(ZViewUpVector, double);
164 
174  void SetImageOrientation(const double leftToRight[3],
175  const double bottomToTop[3]);
176 
187  virtual void SetCurrentImageNumber(int i);
188  int GetCurrentImageNumber() { return this->CurrentImageNumber; }
189 
197  return this->CurrentImageProperty; }
198 
199 protected:
201  ~vtkInteractorStyleImage() VTK_OVERRIDE;
202 
203  int WindowLevelStartPosition[2];
204  int WindowLevelCurrentPosition[2];
205  double WindowLevelInitial[2];
208 
210  double XViewRightVector[3];
211  double XViewUpVector[3];
212  double YViewRightVector[3];
213  double YViewUpVector[3];
214  double ZViewRightVector[3];
215  double ZViewUpVector[3];
216 
217 private:
218  vtkInteractorStyleImage(const vtkInteractorStyleImage&) VTK_DELETE_FUNCTION;
219  void operator=(const vtkInteractorStyleImage&) VTK_DELETE_FUNCTION;
220 };
221 
222 #endif
#define VTKIS_IMAGE2D
vtkImageProperty * GetCurrentImageProperty()
Get the current image property, which is set when StartWindowLevel is called immediately before Start...
void SetInteractionModeToImage3D()
Set/Get current mode to 2D or 3D.
image display properties
static vtkInteractorStyleTrackballCamera * New()
interactive manipulation of the camera specialized for images
#define VTKIS_IMAGE3D
vtkImageProperty * CurrentImageProperty
a simple class to control print indentation
Definition: vtkIndent.h:33
void OnMouseMove() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
#define VTKIS_IMAGE_SLICING
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
interactive manipulation of the camera
void SetInteractionModeToImageSlicing()
Set/Get current mode to 2D or 3D.