VTK  9.2.6
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 =========================================================================*/
77 #ifndef vtkInteractorStyleImage_h
78 #define vtkInteractorStyleImage_h
79 
80 #include "vtkInteractionStyleModule.h" // For export macro
82 
83 // Motion flags
84 
85 #define VTKIS_WINDOW_LEVEL 1024
86 #define VTKIS_SLICE 1025
87 
88 // Style flags
89 
90 #define VTKIS_IMAGE2D 2
91 #define VTKIS_IMAGE3D 3
92 #define VTKIS_IMAGE_SLICING 4
93 
94 class vtkImageProperty;
95 
96 class VTKINTERACTIONSTYLE_EXPORT vtkInteractorStyleImage : public vtkInteractorStyleTrackballCamera
97 {
98 public:
101  void PrintSelf(ostream& os, vtkIndent indent) override;
102 
104 
107  vtkGetVector2Macro(WindowLevelStartPosition, int);
108  vtkGetVector2Macro(WindowLevelCurrentPosition, int);
110 
112 
116  void OnMouseMove() override;
117  void OnLeftButtonDown() override;
118  void OnLeftButtonUp() override;
119  void OnMiddleButtonDown() override;
120  void OnMiddleButtonUp() override;
121  void OnRightButtonDown() override;
122  void OnRightButtonUp() override;
124 
128  void OnChar() override;
129 
130  // These methods for the different interactions in different modes
131  // are overridden in subclasses to perform the correct motion. Since
132  // they might be called from OnTimer, they do not have mouse coord parameters
133  // (use interactor's GetEventPosition and GetLastEventPosition)
134  virtual void WindowLevel();
135  virtual void Pick();
136  virtual void Slice();
137 
138  // Interaction mode entry points used internally.
139  virtual void StartWindowLevel();
140  virtual void EndWindowLevel();
141  virtual void StartPick();
142  virtual void EndPick();
143  virtual void StartSlice();
144  virtual void EndSlice();
145 
147 
153  vtkSetClampMacro(InteractionMode, int, VTKIS_IMAGE2D, VTKIS_IMAGE_SLICING);
154  vtkGetMacro(InteractionMode, int);
155  void SetInteractionModeToImage2D() { this->SetInteractionMode(VTKIS_IMAGE2D); }
156  void SetInteractionModeToImage3D() { this->SetInteractionMode(VTKIS_IMAGE3D); }
157  void SetInteractionModeToImageSlicing() { this->SetInteractionMode(VTKIS_IMAGE_SLICING); }
159 
161 
165  vtkSetVector3Macro(XViewRightVector, double);
166  vtkGetVector3Macro(XViewRightVector, double);
167  vtkSetVector3Macro(XViewUpVector, double);
168  vtkGetVector3Macro(XViewUpVector, double);
169  vtkSetVector3Macro(YViewRightVector, double);
170  vtkGetVector3Macro(YViewRightVector, double);
171  vtkSetVector3Macro(YViewUpVector, double);
172  vtkGetVector3Macro(YViewUpVector, double);
173  vtkSetVector3Macro(ZViewRightVector, double);
174  vtkGetVector3Macro(ZViewRightVector, double);
175  vtkSetVector3Macro(ZViewUpVector, double);
176  vtkGetVector3Macro(ZViewUpVector, double);
178 
188  void SetImageOrientation(const double leftToRight[3], const double bottomToTop[3]);
189 
200  virtual void SetCurrentImageNumber(int i);
201  int GetCurrentImageNumber() { return this->CurrentImageNumber; }
202 
209  vtkImageProperty* GetCurrentImageProperty() { return this->CurrentImageProperty; }
210 
211 protected:
214 
215  int WindowLevelStartPosition[2];
216  int WindowLevelCurrentPosition[2];
217  double WindowLevelInitial[2];
220 
222  double XViewRightVector[3];
223  double XViewUpVector[3];
224  double YViewRightVector[3];
225  double YViewUpVector[3];
226  double ZViewRightVector[3];
227  double ZViewUpVector[3];
228 
229 private:
231  void operator=(const vtkInteractorStyleImage&) = delete;
232 };
233 
234 #endif
image display properties
a simple class to control print indentation
Definition: vtkIndent.h:49
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:397
#define VTKIS_IMAGE2D
#define VTKIS_IMAGE3D
#define VTKIS_IMAGE_SLICING