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 =========================================================================*/
26 #ifndef __vtkResliceCursorRepresentation_h
27 #define __vtkResliceCursorRepresentation_h
28 
30 
31 class vtkTextProperty;
32 class vtkActor2D;
33 class vtkTextMapper;
34 class vtkImageData;
35 class vtkImageReslice;
36 class vtkPlane;
37 class vtkPlaneSource;
39 class vtkResliceCursor;
40 class vtkMatrix4x4;
41 class vtkScalarsToColors;
43 class vtkActor;
44 class vtkImageActor;
45 class vtkTexture;
46 class vtkTextActor;
47 class vtkImageAlgorithm;
48 
50 {
51 public:
53 
55  void PrintSelf(ostream& os, vtkIndent indent);
57 
59 
62  vtkSetClampMacro(Tolerance,int,1,100);
63  vtkGetMacro(Tolerance,int);
65 
67 
68  vtkSetMacro( ShowReslicedImage, int );
69  vtkGetMacro( ShowReslicedImage, int );
70  vtkBooleanMacro( ShowReslicedImage, int );
72 
74 
76  vtkSetMacro(RestrictPlaneToVolume,int);
77  vtkGetMacro(RestrictPlaneToVolume,int);
78  vtkBooleanMacro(RestrictPlaneToVolume,int);
80 
82 
85  vtkSetStringMacro(ThicknessLabelFormat);
86  vtkGetStringMacro(ThicknessLabelFormat);
88 
89 //BTX -- used to communicate about the state of the representation
90  enum { Outside=0, NearCenter, NearAxis1, NearAxis2,
91  OnCenter, OnAxis1, OnAxis2};
92  enum { None=0, PanAndRotate, RotateBothAxes,
93  ResizeThickness, WindowLevelling };
94 //ETX
95 
97  virtual char* GetThicknessLabelText();
98 
100 
101  virtual double* GetThicknessLabelPosition();
102  virtual void GetThicknessLabelPosition(double pos[3]);
103  virtual void GetWorldThicknessLabelPosition(double pos[3]);
105 
107  virtual void BuildRepresentation();
108 
110 
111  vtkGetObjectMacro( ResliceAxes, vtkMatrix4x4 );
112  vtkGetObjectMacro( Reslice, vtkImageAlgorithm );
114 
116 
117  vtkGetObjectMacro( ImageActor, vtkImageActor );
119 
121 
126  virtual void SetLookupTable(vtkScalarsToColors*);
127  vtkGetObjectMacro(LookupTable,vtkScalarsToColors);
129 
131 
135  vtkGetObjectMacro(ColorMap, vtkImageMapToColors);
136  virtual void SetColorMap(vtkImageMapToColors *);
138 
140 
144  void SetWindowLevel(double window, double level, int copy = 0);
145  void GetWindowLevel(double wl[2]);
146  double GetWindow(){return this->CurrentWindow;}
147  double GetLevel(){return this->CurrentLevel;}
149 
150  virtual vtkResliceCursor * GetResliceCursor() = 0;
151 
153 
155  vtkSetMacro(DisplayText,int);
156  vtkGetMacro(DisplayText,int);
157  vtkBooleanMacro(DisplayText,int);
159 
161 
163  void SetTextProperty(vtkTextProperty* tprop);
164  vtkTextProperty* GetTextProperty();
166 
168 
170  vtkSetMacro( UseImageActor, int );
171  vtkGetMacro( UseImageActor, int );
172  vtkBooleanMacro( UseImageActor, int );
174 
176 
178  void SetManipulationMode( int m );
179  vtkGetMacro(ManipulationMode, int);
181 
183 
185  void ActivateText(int);
186  void ManageTextDisplay();
188 
190 
192  virtual void InitializeReslicePlane();
193  virtual void ResetCamera();
195 
197  virtual vtkResliceCursorPolyDataAlgorithm * GetCursorAlgorithm() = 0;
198 
200 
202  vtkGetObjectMacro( PlaneSource, vtkPlaneSource );
204 
205 protected:
208 
210 
212  virtual void CreateDefaultResliceAlgorithm();
213  virtual void SetResliceParameters(
214  double outputSpacingX, double outputSpacingY,
215  int extentX, int extentY );
217 
219  virtual void WindowLevel( double x, double y );
220 
222  virtual void UpdateReslicePlane();
223 
225  virtual void ComputeReslicePlaneOrigin();
226 
227  // for negative window values.
228  void InvertTable();
229 
230  // recompute origin to make the location of the reslice cursor consistent
231  // with its physical location
232  virtual void ComputeOrigin( vtkMatrix4x4 * );
233 
235  void GetVector1( double d[3] );
236  void GetVector2( double d[3] );
238 
242 
243  // Keep track if modifier is set
244  int Modifier;
245 
246  // Selection tolerance for the handles
248 
249  // Format for printing the distance
251 
270  double CurrentLevel;
272  double InitialLevel;
273  double LastEventPosition[2];
275  char TextBuff[128];
277 
278  vtkScalarsToColors * CreateDefaultLookupTable();
279  void GenerateText();
280 
281 private:
283  void operator=(const vtkResliceCursorRepresentation&); //Not implemented
284 };
285 
286 #endif