VTK  9.3.0
vtkInteractorStyleImage.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
56#ifndef vtkInteractorStyleImage_h
57#define vtkInteractorStyleImage_h
58
59#include "vtkInteractionStyleModule.h" // For export macro
61
62// Motion flags
63
64#define VTKIS_WINDOW_LEVEL 1024
65#define VTKIS_SLICE 1025
66
67// Style flags
68
69#define VTKIS_IMAGE2D 2
70#define VTKIS_IMAGE3D 3
71#define VTKIS_IMAGE_SLICING 4
72
73VTK_ABI_NAMESPACE_BEGIN
75
76class VTKINTERACTIONSTYLE_EXPORT vtkInteractorStyleImage : public vtkInteractorStyleTrackballCamera
77{
78public:
81 void PrintSelf(ostream& os, vtkIndent indent) override;
82
84
87 vtkGetVector2Macro(WindowLevelStartPosition, int);
88 vtkGetVector2Macro(WindowLevelCurrentPosition, int);
90
92
96 void OnMouseMove() override;
97 void OnLeftButtonDown() override;
98 void OnLeftButtonUp() override;
99 void OnMiddleButtonDown() override;
100 void OnMiddleButtonUp() override;
101 void OnRightButtonDown() override;
102 void OnRightButtonUp() override;
104
108 void OnChar() override;
109
110 // These methods for the different interactions in different modes
111 // are overridden in subclasses to perform the correct motion. Since
112 // they might be called from OnTimer, they do not have mouse coord parameters
113 // (use interactor's GetEventPosition and GetLastEventPosition)
114 virtual void WindowLevel();
115 virtual void Pick();
116 virtual void Slice();
117
118 // Interaction mode entry points used internally.
119 virtual void StartWindowLevel();
120 virtual void EndWindowLevel();
121 virtual void StartPick();
122 virtual void EndPick();
123 virtual void StartSlice();
124 virtual void EndSlice();
125
127
133 vtkSetClampMacro(InteractionMode, int, VTKIS_IMAGE2D, VTKIS_IMAGE_SLICING);
134 vtkGetMacro(InteractionMode, int);
135 void SetInteractionModeToImage2D() { this->SetInteractionMode(VTKIS_IMAGE2D); }
136 void SetInteractionModeToImage3D() { this->SetInteractionMode(VTKIS_IMAGE3D); }
137 void SetInteractionModeToImageSlicing() { this->SetInteractionMode(VTKIS_IMAGE_SLICING); }
139
141
145 vtkSetVector3Macro(XViewRightVector, double);
146 vtkGetVector3Macro(XViewRightVector, double);
147 vtkSetVector3Macro(XViewUpVector, double);
148 vtkGetVector3Macro(XViewUpVector, double);
149 vtkSetVector3Macro(YViewRightVector, double);
150 vtkGetVector3Macro(YViewRightVector, double);
151 vtkSetVector3Macro(YViewUpVector, double);
152 vtkGetVector3Macro(YViewUpVector, double);
153 vtkSetVector3Macro(ZViewRightVector, double);
154 vtkGetVector3Macro(ZViewRightVector, double);
155 vtkSetVector3Macro(ZViewUpVector, double);
156 vtkGetVector3Macro(ZViewUpVector, double);
158
168 void SetImageOrientation(const double leftToRight[3], const double bottomToTop[3]);
169
180 virtual void SetCurrentImageNumber(int i);
181 int GetCurrentImageNumber() { return this->CurrentImageNumber; }
182
189 vtkImageProperty* GetCurrentImageProperty() { return this->CurrentImageProperty; }
190
191protected:
194
195 int WindowLevelStartPosition[2];
196 int WindowLevelCurrentPosition[2];
197 double WindowLevelInitial[2];
200
202 double XViewRightVector[3];
203 double XViewUpVector[3];
204 double YViewRightVector[3];
205 double YViewUpVector[3];
206 double ZViewRightVector[3];
207 double ZViewUpVector[3];
208
209private:
211 void operator=(const vtkInteractorStyleImage&) = delete;
212};
213
214VTK_ABI_NAMESPACE_END
215#endif
image display properties
a simple class to control print indentation
Definition vtkIndent.h:29
interactive manipulation of the camera specialized for images
virtual void StartWindowLevel()
void OnRightButtonUp() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
void SetInteractionModeToImage2D()
Set/Get current mode to 2D or 3D.
void SetInteractionModeToImageSlicing()
Set/Get current mode to 2D or 3D.
virtual void Slice()
void OnMiddleButtonDown() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
~vtkInteractorStyleImage() override
virtual void StartSlice()
void OnLeftButtonUp() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void OnRightButtonDown() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
virtual void StartPick()
virtual void EndSlice()
void OnLeftButtonDown() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
void OnMiddleButtonUp() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
virtual void SetCurrentImageNumber(int i)
Set the image to use for WindowLevel interaction.
vtkImageProperty * CurrentImageProperty
void SetInteractionModeToImage3D()
Set/Get current mode to 2D or 3D.
static vtkInteractorStyleImage * New()
vtkImageProperty * GetCurrentImageProperty()
Get the current image property, which is set when StartWindowLevel is called immediately before Start...
virtual void EndPick()
void OnMouseMove() override
Event bindings controlling the effects of pressing mouse buttons or moving the mouse.
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.
virtual void EndWindowLevel()
void OnChar() override
Override the "fly-to" (f keypress) for images.
virtual void WindowLevel()
interactive manipulation of the camera
#define VTKIS_IMAGE2D
#define VTKIS_IMAGE3D
#define VTKIS_IMAGE_SLICING