Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
vtkSliceViewInteractorStyle.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: $RCSfile: vtkSliceViewInteractorStyle.h,v $
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 =========================================================================*/
15 
16 #ifndef __vtkSliceViewInteractorStyle_h
17 #define __vtkSliceViewInteractorStyle_h
18 
19 // VTK includes
20 #include "vtkInteractorStyleUser.h"
21 #include "vtkMatrix4x4.h"
22 
23 // MRML includes
24 #include "vtkMRMLDisplayableManagerExport.h"
25 
27 class vtkMRMLSliceLogic;
28 
38 class VTK_MRML_DISPLAYABLEMANAGER_EXPORT vtkSliceViewInteractorStyle : public vtkInteractorStyleUser
39 {
40 public:
41  static vtkSliceViewInteractorStyle *New();
42  vtkTypeMacro(vtkSliceViewInteractorStyle,vtkInteractorStyleUser);
43  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
44 
52  virtual void OnMouseMove() VTK_OVERRIDE;
53  virtual void OnLeftButtonDown() VTK_OVERRIDE;
54  virtual void OnLeftButtonUp() VTK_OVERRIDE;
55  virtual void OnMiddleButtonDown() VTK_OVERRIDE;
56  virtual void OnMiddleButtonUp() VTK_OVERRIDE;
57  virtual void OnRightButtonDown() VTK_OVERRIDE;
58  virtual void OnRightButtonUp() VTK_OVERRIDE;
60  virtual void OnMouseWheelForward() VTK_OVERRIDE;
61  virtual void OnMouseWheelBackward() VTK_OVERRIDE;
64  virtual void OnChar() VTK_OVERRIDE;
65  virtual void OnKeyPress() VTK_OVERRIDE;
66  virtual void OnKeyRelease() VTK_OVERRIDE;
69  virtual void OnExpose() VTK_OVERRIDE;
70  virtual void OnConfigure() VTK_OVERRIDE;
71  virtual void OnEnter() VTK_OVERRIDE;
72  virtual void OnLeave() VTK_OVERRIDE;
73 
75 
77  enum
78  {
79  None = 0,
80  Translate = 1,
81  Zoom = 2,
82  Rotate = 4, /* Rotate not currently used */
83  Blend = 8, /* fg to bg, labelmap to bg */
84  AdjustWindowLevelBackground = 16,
85  AdjustWindowLevelForeground = 32,
86  BrowseSlice = 64,
87  ShowSlice = 128,
88  AdjustLightbox = 256,
89  SelectVolume = 512,
90  SetCursorPosition = 1024, /* adjust cursor position in crosshair node as mouse is moved */
91  AllActionsMask = Translate | Zoom | Rotate | Blend | AdjustWindowLevelBackground | AdjustWindowLevelForeground
92  | BrowseSlice | ShowSlice | AdjustLightbox | SelectVolume | SetCursorPosition
93  };
94  vtkGetMacro(ActionState, int);
95  vtkSetMacro(ActionState, int);
96 
101  void SetActionEnabled(int actionsMask, bool enable = true);
104  bool GetActionEnabled(int actionsMask);
105 
107 
111  double GetSliceSpacing();
113  void IncrementSlice();
114  void DecrementSlice();
115  void MoveSlice(double delta);
118  void ScaleZoom(double zoomScaleFactor);
119 
122  void StartTranslate();
123  void EndTranslate();
124 
127  void StartBlend();
128  void EndBlend();
129 
132  void StartAdjustWindowLevel();
133  void EndAdjustWindowLevel();
134 
140  void GetEventXYZ(double xyz[4]);
141 
144  void SetSliceLogic(vtkMRMLSliceLogic* SliceLogic);
145  vtkGetObjectMacro(SliceLogic, vtkMRMLSliceLogic);
146 
147  vtkMRMLSegmentationDisplayNode* GetVisibleSegmentationDisplayNode();
148 
154  void CycleVolumeLayer(int layer, int direction);
155 
157  void SetLabelOpacity(double opacity);
158  double GetLabelOpacity();
159 
160 protected:
161 
164 
165  int GetMouseInteractionMode();
166 
169  bool IsMouseInsideVolume(bool background);
170 
173  bool VolumeWindowLevelEditable(const char* volumeNodeID);
174 
177 
181 
182  int StartActionEventPosition[2];
183  double StartActionFOV[3];
184  double VolumeScalarRange[2];
186 
187  int LastEventPosition[2];
190  double LastVolumeWindowLevel[2];
191 
193 
194 private:
196  void operator=(const vtkSliceViewInteractorStyle&);
197 };
198 
199 #endif
vtkMRMLSegmentationDisplayNode * StartActionSegmentationDisplayNode
Provides customizable interaction routines.
MRML node for representing segmentation display attributes.
Slicer logic class for slice manipulation.