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 =========================================================================*/
68 #ifndef vtkInteractorStyleImage_h
69 #define vtkInteractorStyleImage_h
70 
71 #include "vtkInteractionStyleModule.h" // For export macro
73 
74 // Motion flags
75 
76 #define VTKIS_WINDOW_LEVEL 1024
77 #define VTKIS_SLICE 1025
78 
79 // Style flags
80 
81 #define VTKIS_IMAGE2D 2
82 #define VTKIS_IMAGE3D 3
83 #define VTKIS_IMAGE_SLICING 4
84 
85 class vtkImageProperty;
86 
87 class VTKINTERACTIONSTYLE_EXPORT vtkInteractorStyleImage : public vtkInteractorStyleTrackballCamera
88 {
89 public:
90  static vtkInteractorStyleImage* New();
92  void PrintSelf(ostream& os, vtkIndent indent) override;
93 
95 
98  vtkGetVector2Macro(WindowLevelStartPosition, int);
99  vtkGetVector2Macro(WindowLevelCurrentPosition, int);
101 
103 
107  void OnMouseMove() override;
108  void OnLeftButtonDown() override;
109  void OnLeftButtonUp() override;
110  void OnMiddleButtonDown() override;
111  void OnMiddleButtonUp() override;
112  void OnRightButtonDown() override;
113  void OnRightButtonUp() override;
115 
119  void OnChar() override;
120 
121  // These methods for the different interactions in different modes
122  // are overridden in subclasses to perform the correct motion. Since
123  // they might be called from OnTimer, they do not have mouse coord parameters
124  // (use interactor's GetEventPosition and GetLastEventPosition)
125  virtual void WindowLevel();
126  virtual void Pick();
127  virtual void Slice();
128 
129  // Interaction mode entry points used internally.
130  virtual void StartWindowLevel();
131  virtual void EndWindowLevel();
132  virtual void StartPick();
133  virtual void EndPick();
134  virtual void StartSlice();
135  virtual void EndSlice();
136 
138 
144  vtkSetClampMacro(InteractionMode, int, VTKIS_IMAGE2D, VTKIS_IMAGE_SLICING);
145  vtkGetMacro(InteractionMode, int);
146  void SetInteractionModeToImage2D() { this->SetInteractionMode(VTKIS_IMAGE2D); }
147  void SetInteractionModeToImage3D() { this->SetInteractionMode(VTKIS_IMAGE3D); }
148  void SetInteractionModeToImageSlicing() { this->SetInteractionMode(VTKIS_IMAGE_SLICING); }
150 
152 
156  vtkSetVector3Macro(XViewRightVector, double);
157  vtkGetVector3Macro(XViewRightVector, double);
158  vtkSetVector3Macro(XViewUpVector, double);
159  vtkGetVector3Macro(XViewUpVector, double);
160  vtkSetVector3Macro(YViewRightVector, double);
161  vtkGetVector3Macro(YViewRightVector, double);
162  vtkSetVector3Macro(YViewUpVector, double);
163  vtkGetVector3Macro(YViewUpVector, double);
164  vtkSetVector3Macro(ZViewRightVector, double);
165  vtkGetVector3Macro(ZViewRightVector, double);
166  vtkSetVector3Macro(ZViewUpVector, double);
167  vtkGetVector3Macro(ZViewUpVector, double);
169 
179  void SetImageOrientation(const double leftToRight[3], const double bottomToTop[3]);
180 
191  virtual void SetCurrentImageNumber(int i);
192  int GetCurrentImageNumber() { return this->CurrentImageNumber; }
193 
200  vtkImageProperty* GetCurrentImageProperty() { return this->CurrentImageProperty; }
201 
202 protected:
204  ~vtkInteractorStyleImage() override;
205 
206  int WindowLevelStartPosition[2];
207  int WindowLevelCurrentPosition[2];
208  double WindowLevelInitial[2];
211 
213  double XViewRightVector[3];
214  double XViewUpVector[3];
215  double YViewRightVector[3];
216  double YViewUpVector[3];
217  double ZViewRightVector[3];
218  double ZViewUpVector[3];
219 
220 private:
222  void operator=(const vtkInteractorStyleImage&) = delete;
223 };
224 
225 #endif
VTKIS_IMAGE_SLICING
#define VTKIS_IMAGE_SLICING
Definition: vtkInteractorStyleImage.h:83
VTKIS_IMAGE2D
#define VTKIS_IMAGE2D
Definition: vtkInteractorStyleImage.h:81
vtkInteractorStyleTrackballCamera::New
static vtkInteractorStyleTrackballCamera * New()
vtkInteractorStyleImage::SetInteractionModeToImageSlicing
void SetInteractionModeToImageSlicing()
Definition: vtkInteractorStyleImage.h:148
vtkInteractorStyleImage::CurrentImageNumber
int CurrentImageNumber
Definition: vtkInteractorStyleImage.h:210
vtkInteractorStyleTrackballCamera::OnLeftButtonUp
void OnLeftButtonUp() override
vtkInteractorStyleImage::SetInteractionModeToImage2D
void SetInteractionModeToImage2D()
Definition: vtkInteractorStyleImage.h:146
vtkInteractorStyleImage
interactive manipulation of the camera specialized for images
Definition: vtkInteractorStyleImage.h:87
vtkInteractorStyle::OnChar
void OnChar() override
OnChar is triggered when an ASCII key is pressed.
vtkInteractorStyleImage::InteractionMode
int InteractionMode
Definition: vtkInteractorStyleImage.h:212
VTKIS_IMAGE3D
#define VTKIS_IMAGE3D
Definition: vtkInteractorStyleImage.h:82
vtkImageProperty
image display properties
Definition: vtkImageProperty.h:36
vtkInteractorStyleImage::GetCurrentImageProperty
vtkImageProperty * GetCurrentImageProperty()
Get the current image property, which is set when StartWindowLevel is called immediately before Start...
Definition: vtkInteractorStyleImage.h:200
vtkInteractorStyleTrackballCamera::OnRightButtonUp
void OnRightButtonUp() override
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkInteractorStyleTrackballCamera::OnRightButtonDown
void OnRightButtonDown() override
vtkInteractorStyleTrackballCamera::OnMouseMove
void OnMouseMove() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
vtkInteractorStyleTrackballCamera::OnLeftButtonDown
void OnLeftButtonDown() override
vtkInteractorStyleTrackballCamera
interactive manipulation of the camera
Definition: vtkInteractorStyleTrackballCamera.h:50
vtkInteractorStyleTrackballCamera::OnMiddleButtonDown
void OnMiddleButtonDown() override
vtkInteractorStyleImage::CurrentImageProperty
vtkImageProperty * CurrentImageProperty
Definition: vtkInteractorStyleImage.h:209
vtkX3D::leftToRight
@ leftToRight
Definition: vtkX3D.h:397
vtkInteractorStyleTrackballCamera::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkInteractorStyleTrackballCamera::OnMiddleButtonUp
void OnMiddleButtonUp() override
vtkInteractorStyleImage::GetCurrentImageNumber
int GetCurrentImageNumber()
Definition: vtkInteractorStyleImage.h:192
vtkInteractorStyleImage::SetInteractionModeToImage3D
void SetInteractionModeToImage3D()
Definition: vtkInteractorStyleImage.h:147
vtkInteractorStyleTrackballCamera.h