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 =========================================================================*/
177 #ifndef vtkInteractorStyleImage_h
178 #define vtkInteractorStyleImage_h
179 
180 #include "vtkInteractionStyleModule.h" // For export macro
182 
183 // Motion flags
184 
185 #define VTKIS_WINDOW_LEVEL 1024
186 #define VTKIS_SLICE 1025
187 
188 // Style flags
189 
190 #define VTKIS_IMAGE2D 2
191 #define VTKIS_IMAGE3D 3
192 #define VTKIS_IMAGE_SLICING 4
193 
194 class vtkImageProperty;
195 
196 class VTKINTERACTIONSTYLE_EXPORT vtkInteractorStyleImage : public vtkInteractorStyleTrackballCamera
197 {
198 public:
201  void PrintSelf(ostream& os, vtkIndent indent) override;
202 
204 
207  vtkGetVector2Macro(WindowLevelStartPosition, int);
208  vtkGetVector2Macro(WindowLevelCurrentPosition, int);
210 
212 
216  void OnMouseMove() override;
217  void OnLeftButtonDown() override;
218  void OnLeftButtonUp() override;
219  void OnMiddleButtonDown() override;
220  void OnMiddleButtonUp() override;
221  void OnRightButtonDown() override;
222  void OnRightButtonUp() override;
224 
228  void OnChar() override;
229 
230  // These methods for the different interactions in different modes
231  // are overridden in subclasses to perform the correct motion. Since
232  // they might be called from OnTimer, they do not have mouse coord parameters
233  // (use interactor's GetEventPosition and GetLastEventPosition)
234  virtual void WindowLevel();
235  virtual void Pick();
236  virtual void Slice();
237 
238  // Interaction mode entry points used internally.
239  virtual void StartWindowLevel();
240  virtual void EndWindowLevel();
241  virtual void StartPick();
242  virtual void EndPick();
243  virtual void StartSlice();
244  virtual void EndSlice();
245 
247 
253  vtkSetClampMacro(InteractionMode, int, VTKIS_IMAGE2D, VTKIS_IMAGE_SLICING);
254  vtkGetMacro(InteractionMode, int);
255  void SetInteractionModeToImage2D() { this->SetInteractionMode(VTKIS_IMAGE2D); }
256  void SetInteractionModeToImage3D() { this->SetInteractionMode(VTKIS_IMAGE3D); }
257  void SetInteractionModeToImageSlicing() { this->SetInteractionMode(VTKIS_IMAGE_SLICING); }
259 
261 
265  vtkSetVector3Macro(XViewRightVector, double);
266  vtkGetVector3Macro(XViewRightVector, double);
267  vtkSetVector3Macro(XViewUpVector, double);
268  vtkGetVector3Macro(XViewUpVector, double);
269  vtkSetVector3Macro(YViewRightVector, double);
270  vtkGetVector3Macro(YViewRightVector, double);
271  vtkSetVector3Macro(YViewUpVector, double);
272  vtkGetVector3Macro(YViewUpVector, double);
273  vtkSetVector3Macro(ZViewRightVector, double);
274  vtkGetVector3Macro(ZViewRightVector, double);
275  vtkSetVector3Macro(ZViewUpVector, double);
276  vtkGetVector3Macro(ZViewUpVector, double);
278 
288  void SetImageOrientation(const double leftToRight[3], const double bottomToTop[3]);
289 
300  virtual void SetCurrentImageNumber(int i);
301  int GetCurrentImageNumber() { return this->CurrentImageNumber; }
302 
309  vtkImageProperty* GetCurrentImageProperty() { return this->CurrentImageProperty; }
310 
311 protected:
314 
315  int WindowLevelStartPosition[2];
316  int WindowLevelCurrentPosition[2];
317  double WindowLevelInitial[2];
320 
322  double XViewRightVector[3];
323  double XViewUpVector[3];
324  double YViewRightVector[3];
325  double YViewUpVector[3];
326  double ZViewRightVector[3];
327  double ZViewUpVector[3];
328 
329 private:
331  void operator=(const vtkInteractorStyleImage&) = delete;
332 };
333 
334 #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:192
vtkInteractorStyleImage::StartPick
virtual void StartPick()
vtkInteractorStyleImage::OnRightButtonUp
void OnRightButtonUp() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
vtkInteractorStyleImage::Pick
virtual void Pick()
VTKIS_IMAGE2D
#define VTKIS_IMAGE2D
Definition: vtkInteractorStyleImage.h:190
vtkInteractorStyleImage::OnRightButtonDown
void OnRightButtonDown() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
vtkInteractorStyleImage::OnLeftButtonDown
void OnLeftButtonDown() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
vtkInteractorStyleImage::SetCurrentImageNumber
virtual void SetCurrentImageNumber(int i)
Set the image to use for WindowLevel interaction.
vtkInteractorStyleImage::SetInteractionModeToImageSlicing
void SetInteractionModeToImageSlicing()
Set/Get current mode to 2D or 3D.
Definition: vtkInteractorStyleImage.h:257
vtkInteractorStyleImage::CurrentImageNumber
int CurrentImageNumber
Definition: vtkInteractorStyleImage.h:319
vtkInteractorStyleImage::OnMiddleButtonDown
void OnMiddleButtonDown() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
vtkInteractorStyleImage::SetInteractionModeToImage2D
void SetInteractionModeToImage2D()
Set/Get current mode to 2D or 3D.
Definition: vtkInteractorStyleImage.h:255
vtkInteractorStyleImage
interactive manipulation of the camera specialized for images
Definition: vtkInteractorStyleImage.h:197
vtkInteractorStyleImage::New
static vtkInteractorStyleImage * New()
vtkInteractorStyleImage::InteractionMode
int InteractionMode
Definition: vtkInteractorStyleImage.h:321
VTKIS_IMAGE3D
#define VTKIS_IMAGE3D
Definition: vtkInteractorStyleImage.h:191
vtkInteractorStyleImage::WindowLevel
virtual void WindowLevel()
vtkInteractorStyleImage::~vtkInteractorStyleImage
~vtkInteractorStyleImage() override
vtkInteractorStyleImage::Slice
virtual void Slice()
vtkImageProperty
image display properties
Definition: vtkImageProperty.h:146
vtkInteractorStyleImage::GetCurrentImageProperty
vtkImageProperty * GetCurrentImageProperty()
Get the current image property, which is set when StartWindowLevel is called immediately before Start...
Definition: vtkInteractorStyleImage.h:309
vtkInteractorStyleImage::StartWindowLevel
virtual void StartWindowLevel()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkInteractorStyleImage::vtkInteractorStyleImage
vtkInteractorStyleImage()
vtkInteractorStyleImage::EndPick
virtual void EndPick()
vtkInteractorStyleImage::OnLeftButtonUp
void OnLeftButtonUp() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
vtkInteractorStyleImage::EndSlice
virtual void EndSlice()
vtkInteractorStyleTrackballCamera
interactive manipulation of the camera
Definition: vtkInteractorStyleTrackballCamera.h:160
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:318
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
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
vtkInteractorStyleImage::GetCurrentImageNumber
int GetCurrentImageNumber()
Definition: vtkInteractorStyleImage.h:301
vtkInteractorStyleImage::SetInteractionModeToImage3D
void SetInteractionModeToImage3D()
Set/Get current mode to 2D or 3D.
Definition: vtkInteractorStyleImage.h:256
vtkInteractorStyleImage::OnMouseMove
void OnMouseMove() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
vtkInteractorStyleTrackballCamera.h