VTK
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:
81  static vtkInteractorStyleImage *New();
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);
138  this->SetInteractionMode(VTKIS_IMAGE2D); }
140  this->SetInteractionMode(VTKIS_IMAGE3D); }
142  this->SetInteractionMode(VTKIS_IMAGE_SLICING); }
144 
146 
150  vtkSetVector3Macro(XViewRightVector, double);
151  vtkGetVector3Macro(XViewRightVector, double);
152  vtkSetVector3Macro(XViewUpVector, double);
153  vtkGetVector3Macro(XViewUpVector, double);
154  vtkSetVector3Macro(YViewRightVector, double);
155  vtkGetVector3Macro(YViewRightVector, double);
156  vtkSetVector3Macro(YViewUpVector, double);
157  vtkGetVector3Macro(YViewUpVector, double);
158  vtkSetVector3Macro(ZViewRightVector, double);
159  vtkGetVector3Macro(ZViewRightVector, double);
160  vtkSetVector3Macro(ZViewUpVector, double);
161  vtkGetVector3Macro(ZViewUpVector, double);
163 
173  void SetImageOrientation(const double leftToRight[3],
174  const double bottomToTop[3]);
175 
186  virtual void SetCurrentImageNumber(int i);
187  int GetCurrentImageNumber() { return this->CurrentImageNumber; }
188 
196  return this->CurrentImageProperty; }
197 
198 protected:
200  ~vtkInteractorStyleImage() override;
201 
202  int WindowLevelStartPosition[2];
203  int WindowLevelCurrentPosition[2];
204  double WindowLevelInitial[2];
207 
209  double XViewRightVector[3];
210  double XViewUpVector[3];
211  double YViewRightVector[3];
212  double YViewUpVector[3];
213  double ZViewRightVector[3];
214  double ZViewUpVector[3];
215 
216 private:
218  void operator=(const vtkInteractorStyleImage&) = delete;
219 };
220 
221 #endif
VTKIS_IMAGE_SLICING
#define VTKIS_IMAGE_SLICING
Definition: vtkInteractorStyleImage.h:74
VTKIS_IMAGE2D
#define VTKIS_IMAGE2D
Definition: vtkInteractorStyleImage.h:72
vtkInteractorStyleTrackballCamera::New
static vtkInteractorStyleTrackballCamera * New()
vtkInteractorStyleImage::SetInteractionModeToImageSlicing
void SetInteractionModeToImageSlicing()
Definition: vtkInteractorStyleImage.h:141
vtkInteractorStyleImage::CurrentImageNumber
int CurrentImageNumber
Definition: vtkInteractorStyleImage.h:206
vtkInteractorStyleTrackballCamera::OnLeftButtonUp
void OnLeftButtonUp() override
vtkInteractorStyleImage::SetInteractionModeToImage2D
void SetInteractionModeToImage2D()
Definition: vtkInteractorStyleImage.h:137
vtkInteractorStyleImage
interactive manipulation of the camera specialized for images
Definition: vtkInteractorStyleImage.h:78
vtkInteractorStyle::OnChar
void OnChar() override
OnChar is triggered when an ASCII key is pressed.
vtkInteractorStyleImage::InteractionMode
int InteractionMode
Definition: vtkInteractorStyleImage.h:208
VTKIS_IMAGE3D
#define VTKIS_IMAGE3D
Definition: vtkInteractorStyleImage.h:73
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:195
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:41
vtkInteractorStyleTrackballCamera::OnMiddleButtonDown
void OnMiddleButtonDown() override
vtkInteractorStyleImage::CurrentImageProperty
vtkImageProperty * CurrentImageProperty
Definition: vtkInteractorStyleImage.h:205
vtkX3D::leftToRight
Definition: vtkX3D.h:391
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:187
vtkInteractorStyleImage::SetInteractionModeToImage3D
void SetInteractionModeToImage3D()
Definition: vtkInteractorStyleImage.h:139
vtkInteractorStyleTrackballCamera.h