VTK
vtkResliceCursorRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkResliceCursorRepresentation.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 =========================================================================*/
27 #ifndef vtkResliceCursorRepresentation_h
28 #define vtkResliceCursorRepresentation_h
29 
30 #include "vtkInteractionWidgetsModule.h" // For export macro
32 
33 class vtkTextProperty;
34 class vtkActor2D;
35 class vtkTextMapper;
36 class vtkImageData;
37 class vtkImageReslice;
38 class vtkPlane;
39 class vtkPlaneSource;
41 class vtkResliceCursor;
42 class vtkMatrix4x4;
43 class vtkScalarsToColors;
45 class vtkActor;
46 class vtkImageActor;
47 class vtkTexture;
48 class vtkTextActor;
49 class vtkImageAlgorithm;
50 
51 class VTKINTERACTIONWIDGETS_EXPORT vtkResliceCursorRepresentation : public vtkWidgetRepresentation
52 {
53 public:
55 
59  void PrintSelf(ostream& os, vtkIndent indent);
61 
63 
68  vtkSetClampMacro(Tolerance,int,1,100);
69  vtkGetMacro(Tolerance,int);
71 
73 
76  vtkSetMacro( ShowReslicedImage, int );
77  vtkGetMacro( ShowReslicedImage, int );
78  vtkBooleanMacro( ShowReslicedImage, int );
80 
82 
86  vtkSetMacro(RestrictPlaneToVolume,int);
87  vtkGetMacro(RestrictPlaneToVolume,int);
88  vtkBooleanMacro(RestrictPlaneToVolume,int);
90 
92 
97  vtkSetStringMacro(ThicknessLabelFormat);
98  vtkGetStringMacro(ThicknessLabelFormat);
100 
101  // Used to communicate about the state of the representation
102  enum { Outside=0, NearCenter, NearAxis1, NearAxis2,
103  OnCenter, OnAxis1, OnAxis2};
104  enum { None=0, PanAndRotate, RotateBothAxes,
105  ResizeThickness, WindowLevelling };
106 
110  virtual char* GetThicknessLabelText();
111 
113 
116  virtual double* GetThicknessLabelPosition();
117  virtual void GetThicknessLabelPosition(double pos[3]);
118  virtual void GetWorldThicknessLabelPosition(double pos[3]);
120 
124  virtual void BuildRepresentation();
125 
127 
130  vtkGetObjectMacro( ResliceAxes, vtkMatrix4x4 );
131  vtkGetObjectMacro( Reslice, vtkImageAlgorithm );
133 
135 
138  vtkGetObjectMacro( ImageActor, vtkImageActor );
140 
142 
149  virtual void SetLookupTable(vtkScalarsToColors*);
150  vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
152 
154 
160  vtkGetObjectMacro(ColorMap, vtkImageMapToColors);
161  virtual void SetColorMap(vtkImageMapToColors *);
163 
165 
171  void SetWindowLevel(double window, double level, int copy = 0);
172  void GetWindowLevel(double wl[2]);
173  double GetWindow(){return this->CurrentWindow;}
174  double GetLevel(){return this->CurrentLevel;}
176 
177  virtual vtkResliceCursor * GetResliceCursor() = 0;
178 
180 
184  vtkSetMacro(DisplayText,int);
185  vtkGetMacro(DisplayText,int);
186  vtkBooleanMacro(DisplayText,int);
188 
190 
193  void SetTextProperty(vtkTextProperty* tprop);
194  vtkTextProperty* GetTextProperty();
196 
198 
202  vtkSetMacro( UseImageActor, int );
203  vtkGetMacro( UseImageActor, int );
204  vtkBooleanMacro( UseImageActor, int );
206 
208 
212  void SetManipulationMode( int m );
213  vtkGetMacro(ManipulationMode, int);
215 
217 
222  void ActivateText(int);
223  void ManageTextDisplay();
225 
227 
231  virtual void InitializeReslicePlane();
232  virtual void ResetCamera();
234 
238  virtual vtkResliceCursorPolyDataAlgorithm * GetCursorAlgorithm() = 0;
239 
241 
245  vtkGetObjectMacro( PlaneSource, vtkPlaneSource );
247 
248 protected:
251 
253 
257  virtual void CreateDefaultResliceAlgorithm();
258  virtual void SetResliceParameters(
259  double outputSpacingX, double outputSpacingY,
260  int extentX, int extentY );
262 
266  virtual void WindowLevel( double x, double y );
267 
271  virtual void UpdateReslicePlane();
272 
276  virtual void ComputeReslicePlaneOrigin();
277 
278  // for negative window values.
279  void InvertTable();
280 
281  // recompute origin to make the location of the reslice cursor consistent
282  // with its physical location
283  virtual void ComputeOrigin( vtkMatrix4x4 * );
284 
286  void GetVector1( double d[3] );
287  void GetVector2( double d[3] );
289 
295 
296  // Keep track if modifier is set
297  int Modifier;
298 
299  // Selection tolerance for the handles
301 
302  // Format for printing the distance
304 
323  double CurrentLevel;
325  double InitialLevel;
326  double LastEventPosition[2];
328  char TextBuff[128];
330 
331  vtkScalarsToColors * CreateDefaultLookupTable();
332  void GenerateText();
333 
334 private:
336  void operator=(const vtkResliceCursorRepresentation&) VTK_DELETE_FUNCTION;
337 };
338 
339 #endif
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
generates a 2D reslice cursor polydata
a actor that draws 2D data
Definition: vtkActor2D.h:45
int ManipulationMode
The widget sets the manipulation mode.
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
2D text annotation
Definition: vtkTextMapper.h:53
Superclass for mapping scalar values to colors.
An actor that displays text.
Definition: vtkTextActor.h:56
draw an image in a rendered 3D scene
Definition: vtkImageActor.h:49
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
double GetWindow()
Set/Get the current window and level values.
perform various plane computations
Definition: vtkPlane.h:37
map the input image through a lookup table
handles properties associated with a texture map
Definition: vtkTexture.h:70
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
represent text properties.
Reslices a volume along a new set of axes.
create an array of quadrilaterals located in a plane
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Generic algorithm superclass for image algs.
double GetLevel()
Set/Get the current window and level values.
void PrintSelf(ostream &os, vtkIndent indent)
Standard methods for instances of this class.
vtkBooleanMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
represent the vtkResliceCursorWidget
Geometry for a reslice cursor.