VTK  9.3.0
vtkInteractorStyleImage.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
65 #ifndef vtkInteractorStyleImage_h
66 #define vtkInteractorStyleImage_h
67 
68 #include "vtkInteractionStyleModule.h" // For export macro
70 
71 // Motion flags
72 
73 #define VTKIS_WINDOW_LEVEL 1024
74 #define VTKIS_SLICE 1025
75 
76 // Style flags
77 
78 #define VTKIS_IMAGE2D 2
79 #define VTKIS_IMAGE3D 3
80 #define VTKIS_IMAGE_SLICING 4
81 
82 VTK_ABI_NAMESPACE_BEGIN
83 class vtkImageProperty;
84 
85 class VTKINTERACTIONSTYLE_EXPORT vtkInteractorStyleImage : public vtkInteractorStyleTrackballCamera
86 {
87 public:
90  void PrintSelf(ostream& os, vtkIndent indent) override;
91 
93 
96  vtkGetVector2Macro(WindowLevelStartPosition, int);
97  vtkGetVector2Macro(WindowLevelCurrentPosition, int);
99 
101 
105  void OnMouseMove() override;
106  void OnLeftButtonDown() override;
107  void OnLeftButtonUp() override;
108  void OnMiddleButtonDown() override;
109  void OnMiddleButtonUp() override;
110  void OnRightButtonDown() override;
111  void OnRightButtonUp() override;
113 
117  void OnChar() override;
118 
119  // These methods for the different interactions in different modes
120  // are overridden in subclasses to perform the correct motion. Since
121  // they might be called from OnTimer, they do not have mouse coord parameters
122  // (use interactor's GetEventPosition and GetLastEventPosition)
123  virtual void WindowLevel();
124  virtual void Pick();
125  virtual void Slice();
126 
127  // Interaction mode entry points used internally.
128  virtual void StartWindowLevel();
129  virtual void EndWindowLevel();
130  virtual void StartPick();
131  virtual void EndPick();
132  virtual void StartSlice();
133  virtual void EndSlice();
134 
136 
142  vtkSetClampMacro(InteractionMode, int, VTKIS_IMAGE2D, VTKIS_IMAGE_SLICING);
143  vtkGetMacro(InteractionMode, int);
144  void SetInteractionModeToImage2D() { this->SetInteractionMode(VTKIS_IMAGE2D); }
145  void SetInteractionModeToImage3D() { this->SetInteractionMode(VTKIS_IMAGE3D); }
146  void SetInteractionModeToImageSlicing() { this->SetInteractionMode(VTKIS_IMAGE_SLICING); }
148 
150 
154  vtkSetVector3Macro(XViewRightVector, double);
155  vtkGetVector3Macro(XViewRightVector, double);
156  vtkSetVector3Macro(XViewUpVector, double);
157  vtkGetVector3Macro(XViewUpVector, double);
158  vtkSetVector3Macro(YViewRightVector, double);
159  vtkGetVector3Macro(YViewRightVector, double);
160  vtkSetVector3Macro(YViewUpVector, double);
161  vtkGetVector3Macro(YViewUpVector, double);
162  vtkSetVector3Macro(ZViewRightVector, double);
163  vtkGetVector3Macro(ZViewRightVector, double);
164  vtkSetVector3Macro(ZViewUpVector, double);
165  vtkGetVector3Macro(ZViewUpVector, double);
167 
177  void SetImageOrientation(const double leftToRight[3], const double bottomToTop[3]);
178 
189  virtual void SetCurrentImageNumber(int i);
190  int GetCurrentImageNumber() { return this->CurrentImageNumber; }
191 
198  vtkImageProperty* GetCurrentImageProperty() { return this->CurrentImageProperty; }
199 
200 protected:
203 
204  int WindowLevelStartPosition[2];
205  int WindowLevelCurrentPosition[2];
206  double WindowLevelInitial[2];
209 
211  double XViewRightVector[3];
212  double XViewUpVector[3];
213  double YViewRightVector[3];
214  double YViewUpVector[3];
215  double ZViewRightVector[3];
216  double ZViewUpVector[3];
217 
218 private:
220  void operator=(const vtkInteractorStyleImage&) = delete;
221 };
222 
223 VTK_ABI_NAMESPACE_END
224 #endif
image display properties
a simple class to control print indentation
Definition: vtkIndent.h:38
interactive manipulation of the camera specialized for images
virtual void StartWindowLevel()
void OnRightButtonUp() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
void SetInteractionModeToImage2D()
Set/Get current mode to 2D or 3D.
void SetInteractionModeToImageSlicing()
Set/Get current mode to 2D or 3D.
static vtkInteractorStyleImage * New()
virtual void Slice()
void OnMiddleButtonDown() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
~vtkInteractorStyleImage() override
virtual void StartSlice()
void OnLeftButtonUp() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void OnRightButtonDown() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
virtual void StartPick()
virtual void EndSlice()
void OnLeftButtonDown() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
void OnMiddleButtonUp() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
virtual void SetCurrentImageNumber(int i)
Set the image to use for WindowLevel interaction.
vtkImageProperty * CurrentImageProperty
void SetInteractionModeToImage3D()
Set/Get current mode to 2D or 3D.
vtkImageProperty * GetCurrentImageProperty()
Get the current image property, which is set when StartWindowLevel is called immediately before Start...
virtual void EndPick()
void OnMouseMove() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
void SetImageOrientation(const double leftToRight[3], const double bottomToTop[3])
Set the view orientation, in terms of the horizontal and vertical directions of the computer screen.
virtual void EndWindowLevel()
void OnChar() override
Override the "fly-to" (f keypress) for images.
virtual void WindowLevel()
interactive manipulation of the camera
@ leftToRight
Definition: vtkX3D.h:391
#define VTKIS_IMAGE2D
#define VTKIS_IMAGE3D
#define VTKIS_IMAGE_SLICING