VTK  9.3.20240327
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
165 #ifndef vtkInteractorStyleImage_h
166 #define vtkInteractorStyleImage_h
167 
168 #include "vtkInteractionStyleModule.h" // For export macro
170 
171 // Motion flags
172 
173 #define VTKIS_WINDOW_LEVEL 1024
174 #define VTKIS_SLICE 1025
175 
176 // Style flags
177 
178 #define VTKIS_IMAGE2D 2
179 #define VTKIS_IMAGE3D 3
180 #define VTKIS_IMAGE_SLICING 4
181 
182 VTK_ABI_NAMESPACE_BEGIN
183 class vtkImageProperty;
184 
185 class VTKINTERACTIONSTYLE_EXPORT vtkInteractorStyleImage : public vtkInteractorStyleTrackballCamera
186 {
187 public:
190  void PrintSelf(ostream& os, vtkIndent indent) override;
191 
193 
196  vtkGetVector2Macro(WindowLevelStartPosition, int);
197  vtkGetVector2Macro(WindowLevelCurrentPosition, int);
199 
201 
205  void OnMouseMove() override;
206  void OnLeftButtonDown() override;
207  void OnLeftButtonUp() override;
208  void OnMiddleButtonDown() override;
209  void OnMiddleButtonUp() override;
210  void OnRightButtonDown() override;
211  void OnRightButtonUp() override;
213 
217  void OnChar() override;
218 
219  // These methods for the different interactions in different modes
220  // are overridden in subclasses to perform the correct motion. Since
221  // they might be called from OnTimer, they do not have mouse coord parameters
222  // (use interactor's GetEventPosition and GetLastEventPosition)
223  virtual void WindowLevel();
224  virtual void Pick();
225  virtual void Slice();
226 
227  // Interaction mode entry points used internally.
228  virtual void StartWindowLevel();
229  virtual void EndWindowLevel();
230  virtual void StartPick();
231  virtual void EndPick();
232  virtual void StartSlice();
233  virtual void EndSlice();
234 
236 
242  vtkSetClampMacro(InteractionMode, int, VTKIS_IMAGE2D, VTKIS_IMAGE_SLICING);
243  vtkGetMacro(InteractionMode, int);
244  void SetInteractionModeToImage2D() { this->SetInteractionMode(VTKIS_IMAGE2D); }
245  void SetInteractionModeToImage3D() { this->SetInteractionMode(VTKIS_IMAGE3D); }
246  void SetInteractionModeToImageSlicing() { this->SetInteractionMode(VTKIS_IMAGE_SLICING); }
248 
250 
254  vtkSetVector3Macro(XViewRightVector, double);
255  vtkGetVector3Macro(XViewRightVector, double);
256  vtkSetVector3Macro(XViewUpVector, double);
257  vtkGetVector3Macro(XViewUpVector, double);
258  vtkSetVector3Macro(YViewRightVector, double);
259  vtkGetVector3Macro(YViewRightVector, double);
260  vtkSetVector3Macro(YViewUpVector, double);
261  vtkGetVector3Macro(YViewUpVector, double);
262  vtkSetVector3Macro(ZViewRightVector, double);
263  vtkGetVector3Macro(ZViewRightVector, double);
264  vtkSetVector3Macro(ZViewUpVector, double);
265  vtkGetVector3Macro(ZViewUpVector, double);
267 
277  void SetImageOrientation(const double leftToRight[3], const double bottomToTop[3]);
278 
289  virtual void SetCurrentImageNumber(int i);
290  int GetCurrentImageNumber() { return this->CurrentImageNumber; }
291 
298  vtkImageProperty* GetCurrentImageProperty() { return this->CurrentImageProperty; }
299 
300 protected:
303 
304  int WindowLevelStartPosition[2];
305  int WindowLevelCurrentPosition[2];
306  double WindowLevelInitial[2];
309 
311  double XViewRightVector[3];
312  double XViewUpVector[3];
313  double YViewRightVector[3];
314  double YViewUpVector[3];
315  double ZViewRightVector[3];
316  double ZViewUpVector[3];
317 
318 private:
320  void operator=(const vtkInteractorStyleImage&) = delete;
321 };
322 
323 VTK_ABI_NAMESPACE_END
324 #endif
image display properties
a simple class to control print indentation
Definition: vtkIndent.h:108
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.
static vtkInteractorStyleImage * New()
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.
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
@ leftToRight
Definition: vtkX3D.h:391
#define VTKIS_IMAGE2D
#define VTKIS_IMAGE3D
#define VTKIS_IMAGE_SLICING