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
53#ifndef vtkInteractorStyleImage_h
54#define vtkInteractorStyleImage_h
55
56#include "vtkInteractionStyleModule.h" // For export macro
58
59// Motion flags
60
61#define VTKIS_WINDOW_LEVEL 1024
62#define VTKIS_SLICE 1025
63
64// Style flags
65
66#define VTKIS_IMAGE2D 2
67#define VTKIS_IMAGE3D 3
68#define VTKIS_IMAGE_SLICING 4
69
70VTK_ABI_NAMESPACE_BEGIN
72
73class VTKINTERACTIONSTYLE_EXPORT vtkInteractorStyleImage : public vtkInteractorStyleTrackballCamera
74{
75public:
78 void PrintSelf(ostream& os, vtkIndent indent) override;
79
81
84 vtkGetVector2Macro(WindowLevelStartPosition, int);
85 vtkGetVector2Macro(WindowLevelCurrentPosition, int);
87
89
93 void OnMouseMove() override;
94 void OnLeftButtonDown() override;
95 void OnLeftButtonUp() override;
96 void OnMiddleButtonDown() override;
97 void OnMiddleButtonUp() override;
98 void OnRightButtonDown() override;
99 void OnRightButtonUp() override;
101
105 void OnChar() override;
106
107 // These methods for the different interactions in different modes
108 // are overridden in subclasses to perform the correct motion. Since
109 // they might be called from OnTimer, they do not have mouse coord parameters
110 // (use interactor's GetEventPosition and GetLastEventPosition)
111 virtual void WindowLevel();
112 virtual void Pick();
113 virtual void Slice();
114
115 // Interaction mode entry points used internally.
116 virtual void StartWindowLevel();
117 virtual void EndWindowLevel();
118 virtual void StartPick();
119 virtual void EndPick();
120 virtual void StartSlice();
121 virtual void EndSlice();
122
124
130 vtkSetClampMacro(InteractionMode, int, VTKIS_IMAGE2D, VTKIS_IMAGE_SLICING);
131 vtkGetMacro(InteractionMode, int);
132 void SetInteractionModeToImage2D() { this->SetInteractionMode(VTKIS_IMAGE2D); }
133 void SetInteractionModeToImage3D() { this->SetInteractionMode(VTKIS_IMAGE3D); }
134 void SetInteractionModeToImageSlicing() { this->SetInteractionMode(VTKIS_IMAGE_SLICING); }
136
138
142 vtkSetVector3Macro(XViewRightVector, double);
143 vtkGetVector3Macro(XViewRightVector, double);
144 vtkSetVector3Macro(XViewUpVector, double);
145 vtkGetVector3Macro(XViewUpVector, double);
146 vtkSetVector3Macro(YViewRightVector, double);
147 vtkGetVector3Macro(YViewRightVector, double);
148 vtkSetVector3Macro(YViewUpVector, double);
149 vtkGetVector3Macro(YViewUpVector, double);
150 vtkSetVector3Macro(ZViewRightVector, double);
151 vtkGetVector3Macro(ZViewRightVector, double);
152 vtkSetVector3Macro(ZViewUpVector, double);
153 vtkGetVector3Macro(ZViewUpVector, double);
155
165 void SetImageOrientation(const double leftToRight[3], const double bottomToTop[3]);
166
177 virtual void SetCurrentImageNumber(int i);
178 int GetCurrentImageNumber() { return this->CurrentImageNumber; }
179
186 vtkImageProperty* GetCurrentImageProperty() { return this->CurrentImageProperty; }
187
188protected:
191
192 int WindowLevelStartPosition[2];
193 int WindowLevelCurrentPosition[2];
194 double WindowLevelInitial[2];
197
199 double XViewRightVector[3];
200 double XViewUpVector[3];
201 double YViewRightVector[3];
202 double YViewUpVector[3];
203 double ZViewRightVector[3];
204 double ZViewUpVector[3];
205
206private:
208 void operator=(const vtkInteractorStyleImage&) = delete;
209};
210
211VTK_ABI_NAMESPACE_END
212#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