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 =========================================================================*/
67 #ifndef __vtkInteractorStyleImage_h
68 #define __vtkInteractorStyleImage_h
69 
71 
72 // Motion flags
73 
74 #define VTKIS_WINDOW_LEVEL 1024
75 #define VTKIS_PICK 1025
76 #define VTKIS_SLICE 1026
77 
78 // Style flags
79 
80 #define VTKIS_IMAGE2D 2
81 #define VTKIS_IMAGE3D 3
82 #define VTKIS_IMAGE_SLICING 4
83 
84 class vtkImageProperty;
85 
87 {
88 public:
89  static vtkInteractorStyleImage *New();
91  void PrintSelf(ostream& os, vtkIndent indent);
92 
94 
95  vtkGetVector2Macro(WindowLevelStartPosition,int);
96  vtkGetVector2Macro(WindowLevelCurrentPosition,int);
98 
100 
102  virtual void OnMouseMove();
103  virtual void OnLeftButtonDown();
104  virtual void OnLeftButtonUp();
105  virtual void OnMiddleButtonDown();
106  virtual void OnMiddleButtonUp();
107  virtual void OnRightButtonDown();
108  virtual void OnRightButtonUp();
110 
112  virtual void OnChar();
113 
114  // These methods for the different interactions in different modes
115  // are overridden in subclasses to perform the correct motion. Since
116  // they might be called from OnTimer, they do not have mouse coord parameters
117  // (use interactor's GetEventPosition and GetLastEventPosition)
118  virtual void WindowLevel();
119  virtual void Pick();
120  virtual void Slice();
121 
122  // Interaction mode entry points used internally.
123  virtual void StartWindowLevel();
124  virtual void EndWindowLevel();
125  virtual void StartPick();
126  virtual void EndPick();
127  virtual void StartSlice();
128  virtual void EndSlice();
129 
131 
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 
148  vtkSetVector3Macro(XViewRightVector, double);
149  vtkGetVector3Macro(XViewRightVector, double);
150  vtkSetVector3Macro(XViewUpVector, double);
151  vtkGetVector3Macro(XViewUpVector, double);
152  vtkSetVector3Macro(YViewRightVector, double);
153  vtkGetVector3Macro(YViewRightVector, double);
154  vtkSetVector3Macro(YViewUpVector, double);
155  vtkGetVector3Macro(YViewUpVector, double);
156  vtkSetVector3Macro(ZViewRightVector, double);
157  vtkGetVector3Macro(ZViewRightVector, double);
158  vtkSetVector3Macro(ZViewUpVector, double);
159  vtkGetVector3Macro(ZViewUpVector, double);
161 
163 
169  void SetImageOrientation(const double leftToRight[3],
170  const double bottomToTop[3]);
172 
174 
179  return this->CurrentImageProperty; }
181 
182 protected:
185 
186  void SetCurrentImageToNthImage(int i);
187 
188  int WindowLevelStartPosition[2];
189  int WindowLevelCurrentPosition[2];
190  double WindowLevelInitial[2];
192 
194  double XViewRightVector[3];
195  double XViewUpVector[3];
196  double YViewRightVector[3];
197  double YViewUpVector[3];
198  double ZViewRightVector[3];
199  double ZViewUpVector[3];
200 
201 private:
202  vtkInteractorStyleImage(const vtkInteractorStyleImage&); // Not implemented.
203  void operator=(const vtkInteractorStyleImage&); // Not implemented.
204 };
205 
206 #endif