VTK  9.0.1
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_SLICE 1025
69 
70 // Style flags
71 
72 #define VTKIS_IMAGE2D 2
73 #define VTKIS_IMAGE3D 3
74 #define VTKIS_IMAGE_SLICING 4
75 
76 class vtkImageProperty;
77 
78 class VTKINTERACTIONSTYLE_EXPORT vtkInteractorStyleImage : public vtkInteractorStyleTrackballCamera
79 {
80 public:
83  void PrintSelf(ostream& os, vtkIndent indent) override;
84 
86 
89  vtkGetVector2Macro(WindowLevelStartPosition, int);
90  vtkGetVector2Macro(WindowLevelCurrentPosition, int);
92 
94 
98  void OnMouseMove() override;
99  void OnLeftButtonDown() override;
100  void OnLeftButtonUp() override;
101  void OnMiddleButtonDown() override;
102  void OnMiddleButtonUp() override;
103  void OnRightButtonDown() override;
104  void OnRightButtonUp() override;
106 
110  void OnChar() override;
111 
112  // These methods for the different interactions in different modes
113  // are overridden in subclasses to perform the correct motion. Since
114  // they might be called from OnTimer, they do not have mouse coord parameters
115  // (use interactor's GetEventPosition and GetLastEventPosition)
116  virtual void WindowLevel();
117  virtual void Pick();
118  virtual void Slice();
119 
120  // Interaction mode entry points used internally.
121  virtual void StartWindowLevel();
122  virtual void EndWindowLevel();
123  virtual void StartPick();
124  virtual void EndPick();
125  virtual void StartSlice();
126  virtual void EndSlice();
127 
129 
135  vtkSetClampMacro(InteractionMode, int, VTKIS_IMAGE2D, VTKIS_IMAGE_SLICING);
136  vtkGetMacro(InteractionMode, int);
137  void SetInteractionModeToImage2D() { this->SetInteractionMode(VTKIS_IMAGE2D); }
138  void SetInteractionModeToImage3D() { this->SetInteractionMode(VTKIS_IMAGE3D); }
139  void SetInteractionModeToImageSlicing() { this->SetInteractionMode(VTKIS_IMAGE_SLICING); }
141 
143 
147  vtkSetVector3Macro(XViewRightVector, double);
148  vtkGetVector3Macro(XViewRightVector, double);
149  vtkSetVector3Macro(XViewUpVector, double);
150  vtkGetVector3Macro(XViewUpVector, double);
151  vtkSetVector3Macro(YViewRightVector, double);
152  vtkGetVector3Macro(YViewRightVector, double);
153  vtkSetVector3Macro(YViewUpVector, double);
154  vtkGetVector3Macro(YViewUpVector, double);
155  vtkSetVector3Macro(ZViewRightVector, double);
156  vtkGetVector3Macro(ZViewRightVector, double);
157  vtkSetVector3Macro(ZViewUpVector, double);
158  vtkGetVector3Macro(ZViewUpVector, double);
160 
170  void SetImageOrientation(const double leftToRight[3], const double bottomToTop[3]);
171 
182  virtual void SetCurrentImageNumber(int i);
183  int GetCurrentImageNumber() { return this->CurrentImageNumber; }
184 
191  vtkImageProperty* GetCurrentImageProperty() { return this->CurrentImageProperty; }
192 
193 protected:
196 
197  int WindowLevelStartPosition[2];
198  int WindowLevelCurrentPosition[2];
199  double WindowLevelInitial[2];
202 
204  double XViewRightVector[3];
205  double XViewUpVector[3];
206  double YViewRightVector[3];
207  double YViewUpVector[3];
208  double ZViewRightVector[3];
209  double ZViewUpVector[3];
210 
211 private:
213  void operator=(const vtkInteractorStyleImage&) = delete;
214 };
215 
216 #endif
vtkInteractorStyleImage::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
VTKIS_IMAGE_SLICING
#define VTKIS_IMAGE_SLICING
Definition: vtkInteractorStyleImage.h:74
vtkInteractorStyleImage::StartPick
virtual void StartPick()
vtkInteractorStyleImage::OnRightButtonUp
void OnRightButtonUp() override
vtkInteractorStyleImage::Pick
virtual void Pick()
VTKIS_IMAGE2D
#define VTKIS_IMAGE2D
Definition: vtkInteractorStyleImage.h:72
vtkInteractorStyleImage::OnRightButtonDown
void OnRightButtonDown() override
vtkInteractorStyleImage::OnLeftButtonDown
void OnLeftButtonDown() override
vtkInteractorStyleImage::SetCurrentImageNumber
virtual void SetCurrentImageNumber(int i)
Set the image to use for WindowLevel interaction.
vtkInteractorStyleImage::SetInteractionModeToImageSlicing
void SetInteractionModeToImageSlicing()
Definition: vtkInteractorStyleImage.h:139
vtkInteractorStyleImage::CurrentImageNumber
int CurrentImageNumber
Definition: vtkInteractorStyleImage.h:201
vtkInteractorStyleImage::OnMiddleButtonDown
void OnMiddleButtonDown() override
vtkInteractorStyleImage::SetInteractionModeToImage2D
void SetInteractionModeToImage2D()
Definition: vtkInteractorStyleImage.h:137
vtkInteractorStyleImage
interactive manipulation of the camera specialized for images
Definition: vtkInteractorStyleImage.h:79
vtkInteractorStyleImage::New
static vtkInteractorStyleImage * New()
vtkInteractorStyleImage::InteractionMode
int InteractionMode
Definition: vtkInteractorStyleImage.h:203
VTKIS_IMAGE3D
#define VTKIS_IMAGE3D
Definition: vtkInteractorStyleImage.h:73
vtkInteractorStyleImage::WindowLevel
virtual void WindowLevel()
vtkInteractorStyleImage::~vtkInteractorStyleImage
~vtkInteractorStyleImage() override
vtkInteractorStyleImage::Slice
virtual void Slice()
vtkImageProperty
image display properties
Definition: vtkImageProperty.h:37
vtkInteractorStyleImage::GetCurrentImageProperty
vtkImageProperty * GetCurrentImageProperty()
Get the current image property, which is set when StartWindowLevel is called immediately before Start...
Definition: vtkInteractorStyleImage.h:191
vtkInteractorStyleImage::StartWindowLevel
virtual void StartWindowLevel()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkInteractorStyleImage::vtkInteractorStyleImage
vtkInteractorStyleImage()
vtkInteractorStyleImage::EndPick
virtual void EndPick()
vtkInteractorStyleImage::OnLeftButtonUp
void OnLeftButtonUp() override
vtkInteractorStyleImage::EndSlice
virtual void EndSlice()
vtkInteractorStyleTrackballCamera
interactive manipulation of the camera
Definition: vtkInteractorStyleTrackballCamera.h:42
vtkInteractorStyleImage::StartSlice
virtual void StartSlice()
vtkInteractorStyleImage::SetImageOrientation
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.
vtkInteractorStyleImage::EndWindowLevel
virtual void EndWindowLevel()
vtkInteractorStyleImage::CurrentImageProperty
vtkImageProperty * CurrentImageProperty
Definition: vtkInteractorStyleImage.h:200
vtkX3D::leftToRight
@ leftToRight
Definition: vtkX3D.h:397
vtkInteractorStyleImage::OnChar
void OnChar() override
Override the "fly-to" (f keypress) for images.
vtkInteractorStyleImage::OnMiddleButtonUp
void OnMiddleButtonUp() override
vtkInteractorStyleImage::GetCurrentImageNumber
int GetCurrentImageNumber()
Definition: vtkInteractorStyleImage.h:183
vtkInteractorStyleImage::SetInteractionModeToImage3D
void SetInteractionModeToImage3D()
Definition: vtkInteractorStyleImage.h:138
vtkInteractorStyleImage::OnMouseMove
void OnMouseMove() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
vtkInteractorStyleTrackballCamera.h