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
vtkWidgetRepresentation.h
vtkResliceCursorRepresentation::ImageActor
vtkImageActor * ImageActor
Definition: vtkResliceCursorRepresentation.h:318
vtkPlane
perform various plane computations
Definition: vtkPlane.h:37
vtkResliceCursorRepresentation::RotateBothAxes
@ RotateBothAxes
Definition: vtkResliceCursorRepresentation.h:104
vtkResliceCursorRepresentation::Texture
vtkTexture * Texture
Definition: vtkResliceCursorRepresentation.h:316
vtkResliceCursorRepresentation::UseImageActor
int UseImageActor
Definition: vtkResliceCursorRepresentation.h:327
vtkResliceCursorRepresentation::RestrictPlaneToVolume
int RestrictPlaneToVolume
Definition: vtkResliceCursorRepresentation.h:307
vtkResliceCursorRepresentation::LookupTable
vtkScalarsToColors * LookupTable
Definition: vtkResliceCursorRepresentation.h:317
vtkResliceCursorRepresentation::NewResliceAxes
vtkMatrix4x4 * NewResliceAxes
Definition: vtkResliceCursorRepresentation.h:313
vtkPlaneSource
create an array of quadrilaterals located in a plane
Definition: vtkPlaneSource.h:60
vtkResliceCursor
Geometry for a reslice cursor.
Definition: vtkResliceCursor.h:46
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:54
vtkImageMapToColors
map the input image through a lookup table
Definition: vtkImageMapToColors.h:44
vtkImageAlgorithm
Generic algorithm superclass for image algs.
Definition: vtkImageAlgorithm.h:40
vtkWidgetRepresentation::BuildRepresentation
virtual void BuildRepresentation()=0
vtkResliceCursorRepresentation::InitialLevel
double InitialLevel
Definition: vtkResliceCursorRepresentation.h:325
vtkResliceCursorRepresentation::CurrentWindow
double CurrentWindow
Definition: vtkResliceCursorRepresentation.h:322
vtkResliceCursorRepresentation::ColorMap
vtkImageMapToColors * ColorMap
Definition: vtkResliceCursorRepresentation.h:314
vtkResliceCursorRepresentation::PlaneSource
vtkPlaneSource * PlaneSource
Definition: vtkResliceCursorRepresentation.h:306
vtkX3D::level
@ level
Definition: vtkX3D.h:395
vtkTexture
handles properties associated with a texture map
Definition: vtkTexture.h:70
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:53
vtkResliceCursorRepresentation::OriginalWindow
double OriginalWindow
Definition: vtkResliceCursorRepresentation.h:320
vtkResliceCursorRepresentation::ManipulationMode
int ManipulationMode
The widget sets the manipulation mode.
Definition: vtkResliceCursorRepresentation.h:294
vtkResliceCursorRepresentation::ThicknessLabelFormat
char * ThicknessLabelFormat
Definition: vtkResliceCursorRepresentation.h:303
vtkResliceCursorPolyDataAlgorithm
generates a 2D reslice cursor polydata
Definition: vtkResliceCursorPolyDataAlgorithm.h:45
vtkActor
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkTextActor
An actor that displays text. Scaled or unscaled.
Definition: vtkTextActor.h:56
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkMatrix4x4
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:41
vtkResliceCursorRepresentation::DisplayText
int DisplayText
Definition: vtkResliceCursorRepresentation.h:329
vtkImageReslice
Reslices a volume along a new set of axes.
Definition: vtkImageReslice.h:77
vtkScalarsToColors
Superclass for mapping scalar values to colors.
Definition: vtkScalarsToColors.h:66
vtkGetStringMacro
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkResliceCursorRepresentation::GetLevel
double GetLevel()
Definition: vtkResliceCursorRepresentation.h:174
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:39
vtkBooleanMacro
vtkBooleanMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkResliceCursorRepresentation::GetWindow
double GetWindow()
Definition: vtkResliceCursorRepresentation.h:173
vtkResliceCursorRepresentation::InitialWindow
double InitialWindow
Definition: vtkResliceCursorRepresentation.h:324
vtkWidgetRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
vtkSetMacro
vtkSetMacro(IgnoreDriverBugs, bool)
Updates the extensions string.
vtkResliceCursorRepresentation::CurrentLevel
double CurrentLevel
Definition: vtkResliceCursorRepresentation.h:323
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:45
vtkResliceCursorRepresentation::ThicknessTextProperty
vtkTextProperty * ThicknessTextProperty
Definition: vtkResliceCursorRepresentation.h:309
vtkImageActor
draw an image in a rendered 3D scene
Definition: vtkImageActor.h:49
vtkResliceCursorRepresentation::Tolerance
int Tolerance
Definition: vtkResliceCursorRepresentation.h:300
vtkResliceCursorRepresentation::ResliceAxes
vtkMatrix4x4 * ResliceAxes
Definition: vtkResliceCursorRepresentation.h:312
vtkResliceCursorRepresentation::ShowReslicedImage
int ShowReslicedImage
Definition: vtkResliceCursorRepresentation.h:308
vtkResliceCursorRepresentation::TextActor
vtkTextActor * TextActor
Definition: vtkResliceCursorRepresentation.h:319
vtkResliceCursorRepresentation::OnCenter
@ OnCenter
Definition: vtkResliceCursorRepresentation.h:103
vtkResliceCursorRepresentation::OriginalLevel
double OriginalLevel
Definition: vtkResliceCursorRepresentation.h:321
vtkResliceCursorRepresentation::Modifier
int Modifier
Definition: vtkResliceCursorRepresentation.h:297
vtkResliceCursorRepresentation::TexturePlaneActor
vtkActor * TexturePlaneActor
Definition: vtkResliceCursorRepresentation.h:315
vtkResliceCursorRepresentation::Reslice
vtkImageAlgorithm * Reslice
Definition: vtkResliceCursorRepresentation.h:305
vtkResliceCursorRepresentation
represent the vtkResliceCursorWidget
Definition: vtkResliceCursorRepresentation.h:51
vtkResliceCursorRepresentation::ThicknessTextActor
vtkActor2D * ThicknessTextActor
Definition: vtkResliceCursorRepresentation.h:311
vtkResliceCursorRepresentation::ThicknessTextMapper
vtkTextMapper * ThicknessTextMapper
Definition: vtkResliceCursorRepresentation.h:310