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 =========================================================================*/
65 #ifndef vtkInteractorStyleImage_h
66 #define vtkInteractorStyleImage_h
67 
68 #include "vtkInteractionStyleModule.h" // For export macro
70 
71 // Motion flags
72 
73 #define VTKIS_WINDOW_LEVEL 1024
74 #define VTKIS_SLICE 1025
75 
76 // Style flags
77 
78 #define VTKIS_IMAGE2D 2
79 #define VTKIS_IMAGE3D 3
80 #define VTKIS_IMAGE_SLICING 4
81 
82 class vtkImageProperty;
83 
84 class VTKINTERACTIONSTYLE_EXPORT vtkInteractorStyleImage : public vtkInteractorStyleTrackballCamera
85 {
86 public:
87  static vtkInteractorStyleImage *New();
89  void PrintSelf(ostream& os, vtkIndent indent) override;
90 
92 
95  vtkGetVector2Macro(WindowLevelStartPosition,int);
96  vtkGetVector2Macro(WindowLevelCurrentPosition,int);
98 
100 
104  void OnMouseMove() override;
105  void OnLeftButtonDown() override;
106  void OnLeftButtonUp() override;
107  void OnMiddleButtonDown() override;
108  void OnMiddleButtonUp() override;
109  void OnRightButtonDown() override;
110  void OnRightButtonUp() override;
112 
116  void OnChar() override;
117 
118  // These methods for the different interactions in different modes
119  // are overridden in subclasses to perform the correct motion. Since
120  // they might be called from OnTimer, they do not have mouse coord parameters
121  // (use interactor's GetEventPosition and GetLastEventPosition)
122  virtual void WindowLevel();
123  virtual void Pick();
124  virtual void Slice();
125 
126  // Interaction mode entry points used internally.
127  virtual void StartWindowLevel();
128  virtual void EndWindowLevel();
129  virtual void StartPick();
130  virtual void EndPick();
131  virtual void StartSlice();
132  virtual void EndSlice();
133 
135 
141  vtkSetClampMacro(InteractionMode, int, VTKIS_IMAGE2D, VTKIS_IMAGE_SLICING);
142  vtkGetMacro(InteractionMode, int);
144  this->SetInteractionMode(VTKIS_IMAGE2D); }
146  this->SetInteractionMode(VTKIS_IMAGE3D); }
148  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],
180  const double bottomToTop[3]);
181 
192  virtual void SetCurrentImageNumber(int i);
193  int GetCurrentImageNumber() { return this->CurrentImageNumber; }
194 
202  return this->CurrentImageProperty; }
203 
204 protected:
206  ~vtkInteractorStyleImage() override;
207 
208  int WindowLevelStartPosition[2];
209  int WindowLevelCurrentPosition[2];
210  double WindowLevelInitial[2];
213 
215  double XViewRightVector[3];
216  double XViewUpVector[3];
217  double YViewRightVector[3];
218  double YViewUpVector[3];
219  double ZViewRightVector[3];
220  double ZViewUpVector[3];
221 
222 private:
224  void operator=(const vtkInteractorStyleImage&) = delete;
225 };
226 
227 #endif
VTKIS_IMAGE_SLICING
#define VTKIS_IMAGE_SLICING
Definition: vtkInteractorStyleImage.h:80
VTKIS_IMAGE2D
#define VTKIS_IMAGE2D
Definition: vtkInteractorStyleImage.h:78
vtkInteractorStyleTrackballCamera::New
static vtkInteractorStyleTrackballCamera * New()
vtkInteractorStyleImage::SetInteractionModeToImageSlicing
void SetInteractionModeToImageSlicing()
Definition: vtkInteractorStyleImage.h:147
vtkInteractorStyleImage::CurrentImageNumber
int CurrentImageNumber
Definition: vtkInteractorStyleImage.h:212
vtkInteractorStyleTrackballCamera::OnLeftButtonUp
void OnLeftButtonUp() override
vtkInteractorStyleImage::SetInteractionModeToImage2D
void SetInteractionModeToImage2D()
Definition: vtkInteractorStyleImage.h:143
vtkInteractorStyleImage
interactive manipulation of the camera specialized for images
Definition: vtkInteractorStyleImage.h:84
vtkInteractorStyle::OnChar
void OnChar() override
OnChar is triggered when an ASCII key is pressed.
vtkInteractorStyleImage::InteractionMode
int InteractionMode
Definition: vtkInteractorStyleImage.h:214
VTKIS_IMAGE3D
#define VTKIS_IMAGE3D
Definition: vtkInteractorStyleImage.h:79
vtkImageProperty
image display properties
Definition: vtkImageProperty.h:42
vtkInteractorStyleImage::GetCurrentImageProperty
vtkImageProperty * GetCurrentImageProperty()
Get the current image property, which is set when StartWindowLevel is called immediately before Start...
Definition: vtkInteractorStyleImage.h:201
vtkInteractorStyleTrackballCamera::OnRightButtonUp
void OnRightButtonUp() override
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
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:47
vtkInteractorStyleTrackballCamera::OnMiddleButtonDown
void OnMiddleButtonDown() override
vtkInteractorStyleImage::CurrentImageProperty
vtkImageProperty * CurrentImageProperty
Definition: vtkInteractorStyleImage.h:211
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:193
vtkInteractorStyleImage::SetInteractionModeToImage3D
void SetInteractionModeToImage3D()
Definition: vtkInteractorStyleImage.h:145
vtkInteractorStyleTrackballCamera.h