VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkInteractorStyleImage.h 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00067 #ifndef __vtkInteractorStyleImage_h 00068 #define __vtkInteractorStyleImage_h 00069 00070 #include "vtkInteractionStyleModule.h" // For export macro 00071 #include "vtkInteractorStyleTrackballCamera.h" 00072 00073 // Motion flags 00074 00075 #define VTKIS_WINDOW_LEVEL 1024 00076 #define VTKIS_PICK 1025 00077 #define VTKIS_SLICE 1026 00078 00079 // Style flags 00080 00081 #define VTKIS_IMAGE2D 2 00082 #define VTKIS_IMAGE3D 3 00083 #define VTKIS_IMAGE_SLICING 4 00084 00085 class vtkImageProperty; 00086 00087 class VTKINTERACTIONSTYLE_EXPORT vtkInteractorStyleImage : public vtkInteractorStyleTrackballCamera 00088 { 00089 public: 00090 static vtkInteractorStyleImage *New(); 00091 vtkTypeMacro(vtkInteractorStyleImage, vtkInteractorStyleTrackballCamera); 00092 void PrintSelf(ostream& os, vtkIndent indent); 00093 00095 00096 vtkGetVector2Macro(WindowLevelStartPosition,int); 00097 vtkGetVector2Macro(WindowLevelCurrentPosition,int); 00099 00101 00103 virtual void OnMouseMove(); 00104 virtual void OnLeftButtonDown(); 00105 virtual void OnLeftButtonUp(); 00106 virtual void OnMiddleButtonDown(); 00107 virtual void OnMiddleButtonUp(); 00108 virtual void OnRightButtonDown(); 00109 virtual void OnRightButtonUp(); 00111 00113 virtual void OnChar(); 00114 00115 // These methods for the different interactions in different modes 00116 // are overridden in subclasses to perform the correct motion. Since 00117 // they might be called from OnTimer, they do not have mouse coord parameters 00118 // (use interactor's GetEventPosition and GetLastEventPosition) 00119 virtual void WindowLevel(); 00120 virtual void Pick(); 00121 virtual void Slice(); 00122 00123 // Interaction mode entry points used internally. 00124 virtual void StartWindowLevel(); 00125 virtual void EndWindowLevel(); 00126 virtual void StartPick(); 00127 virtual void EndPick(); 00128 virtual void StartSlice(); 00129 virtual void EndSlice(); 00130 00132 00136 vtkSetClampMacro(InteractionMode, int, VTKIS_IMAGE2D, VTKIS_IMAGE_SLICING); 00137 vtkGetMacro(InteractionMode, int); 00138 void SetInteractionModeToImage2D() { 00139 this->SetInteractionMode(VTKIS_IMAGE2D); } 00140 void SetInteractionModeToImage3D() { 00141 this->SetInteractionMode(VTKIS_IMAGE3D); } 00142 void SetInteractionModeToImageSlicing() { 00143 this->SetInteractionMode(VTKIS_IMAGE_SLICING); } 00145 00147 00149 vtkSetVector3Macro(XViewRightVector, double); 00150 vtkGetVector3Macro(XViewRightVector, double); 00151 vtkSetVector3Macro(XViewUpVector, double); 00152 vtkGetVector3Macro(XViewUpVector, double); 00153 vtkSetVector3Macro(YViewRightVector, double); 00154 vtkGetVector3Macro(YViewRightVector, double); 00155 vtkSetVector3Macro(YViewUpVector, double); 00156 vtkGetVector3Macro(YViewUpVector, double); 00157 vtkSetVector3Macro(ZViewRightVector, double); 00158 vtkGetVector3Macro(ZViewRightVector, double); 00159 vtkSetVector3Macro(ZViewUpVector, double); 00160 vtkGetVector3Macro(ZViewUpVector, double); 00162 00164 00170 void SetImageOrientation(const double leftToRight[3], 00171 const double bottomToTop[3]); 00173 00175 00179 vtkImageProperty *GetCurrentImageProperty() { 00180 return this->CurrentImageProperty; } 00182 00183 protected: 00184 vtkInteractorStyleImage(); 00185 ~vtkInteractorStyleImage(); 00186 00187 void SetCurrentImageToNthImage(int i); 00188 00189 int WindowLevelStartPosition[2]; 00190 int WindowLevelCurrentPosition[2]; 00191 double WindowLevelInitial[2]; 00192 vtkImageProperty *CurrentImageProperty; 00193 00194 int InteractionMode; 00195 double XViewRightVector[3]; 00196 double XViewUpVector[3]; 00197 double YViewRightVector[3]; 00198 double YViewUpVector[3]; 00199 double ZViewRightVector[3]; 00200 double ZViewUpVector[3]; 00201 00202 private: 00203 vtkInteractorStyleImage(const vtkInteractorStyleImage&); // Not implemented. 00204 void operator=(const vtkInteractorStyleImage&); // Not implemented. 00205 }; 00206 00207 #endif