VTK  9.1.0
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 =========================================================================*/
168 #ifndef vtkInteractorStyleImage_h
169 #define vtkInteractorStyleImage_h
170 
171 #include "vtkInteractionStyleModule.h" // For export macro
173 
174 // Motion flags
175 
176 #define VTKIS_WINDOW_LEVEL 1024
177 #define VTKIS_SLICE 1025
178 
179 // Style flags
180 
181 #define VTKIS_IMAGE2D 2
182 #define VTKIS_IMAGE3D 3
183 #define VTKIS_IMAGE_SLICING 4
184 
185 class vtkImageProperty;
186 
187 class VTKINTERACTIONSTYLE_EXPORT vtkInteractorStyleImage : public vtkInteractorStyleTrackballCamera
188 {
189 public:
192  void PrintSelf(ostream& os, vtkIndent indent) override;
193 
195 
198  vtkGetVector2Macro(WindowLevelStartPosition, int);
199  vtkGetVector2Macro(WindowLevelCurrentPosition, int);
201 
203 
207  void OnMouseMove() override;
208  void OnLeftButtonDown() override;
209  void OnLeftButtonUp() override;
210  void OnMiddleButtonDown() override;
211  void OnMiddleButtonUp() override;
212  void OnRightButtonDown() override;
213  void OnRightButtonUp() override;
215 
219  void OnChar() override;
220 
221  // These methods for the different interactions in different modes
222  // are overridden in subclasses to perform the correct motion. Since
223  // they might be called from OnTimer, they do not have mouse coord parameters
224  // (use interactor's GetEventPosition and GetLastEventPosition)
225  virtual void WindowLevel();
226  virtual void Pick();
227  virtual void Slice();
228 
229  // Interaction mode entry points used internally.
230  virtual void StartWindowLevel();
231  virtual void EndWindowLevel();
232  virtual void StartPick();
233  virtual void EndPick();
234  virtual void StartSlice();
235  virtual void EndSlice();
236 
238 
244  vtkSetClampMacro(InteractionMode, int, VTKIS_IMAGE2D, VTKIS_IMAGE_SLICING);
245  vtkGetMacro(InteractionMode, int);
246  void SetInteractionModeToImage2D() { this->SetInteractionMode(VTKIS_IMAGE2D); }
247  void SetInteractionModeToImage3D() { this->SetInteractionMode(VTKIS_IMAGE3D); }
248  void SetInteractionModeToImageSlicing() { this->SetInteractionMode(VTKIS_IMAGE_SLICING); }
250 
252 
256  vtkSetVector3Macro(XViewRightVector, double);
257  vtkGetVector3Macro(XViewRightVector, double);
258  vtkSetVector3Macro(XViewUpVector, double);
259  vtkGetVector3Macro(XViewUpVector, double);
260  vtkSetVector3Macro(YViewRightVector, double);
261  vtkGetVector3Macro(YViewRightVector, double);
262  vtkSetVector3Macro(YViewUpVector, double);
263  vtkGetVector3Macro(YViewUpVector, double);
264  vtkSetVector3Macro(ZViewRightVector, double);
265  vtkGetVector3Macro(ZViewRightVector, double);
266  vtkSetVector3Macro(ZViewUpVector, double);
267  vtkGetVector3Macro(ZViewUpVector, double);
269 
279  void SetImageOrientation(const double leftToRight[3], const double bottomToTop[3]);
280 
291  virtual void SetCurrentImageNumber(int i);
292  int GetCurrentImageNumber() { return this->CurrentImageNumber; }
293 
300  vtkImageProperty* GetCurrentImageProperty() { return this->CurrentImageProperty; }
301 
302 protected:
305 
306  int WindowLevelStartPosition[2];
307  int WindowLevelCurrentPosition[2];
308  double WindowLevelInitial[2];
311 
313  double XViewRightVector[3];
314  double XViewUpVector[3];
315  double YViewRightVector[3];
316  double YViewUpVector[3];
317  double ZViewRightVector[3];
318  double ZViewUpVector[3];
319 
320 private:
322  void operator=(const vtkInteractorStyleImage&) = delete;
323 };
324 
325 #endif
image display properties
a simple class to control print indentation
Definition: vtkIndent.h:113
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