VTK  9.1.0
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 // Private.
52 #define VTK_RESLICE_CURSOR_REPRESENTATION_MAX_TEXTBUFF 128
53 
54 class VTKINTERACTIONWIDGETS_EXPORT vtkResliceCursorRepresentation : public vtkWidgetRepresentation
55 {
56 public:
58 
62  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
66 
71  vtkSetClampMacro(Tolerance, int, 1, 100);
72  vtkGetMacro(Tolerance, int);
74 
76 
79  vtkSetMacro(ShowReslicedImage, vtkTypeBool);
80  vtkGetMacro(ShowReslicedImage, vtkTypeBool);
81  vtkBooleanMacro(ShowReslicedImage, vtkTypeBool);
83 
85 
89  vtkSetMacro(RestrictPlaneToVolume, vtkTypeBool);
90  vtkGetMacro(RestrictPlaneToVolume, vtkTypeBool);
91  vtkBooleanMacro(RestrictPlaneToVolume, vtkTypeBool);
93 
95 
100  vtkSetStringMacro(ThicknessLabelFormat);
101  vtkGetStringMacro(ThicknessLabelFormat);
103 
104  // Used to communicate about the state of the representation
105  enum
106  {
107  Outside = 0,
113  OnAxis2
114  };
115  enum
116  {
117  None = 0,
121  WindowLevelling
122  };
123 
127  virtual char* GetThicknessLabelText();
128 
130 
133  virtual double* GetThicknessLabelPosition();
134  virtual void GetThicknessLabelPosition(double pos[3]);
135  virtual void GetWorldThicknessLabelPosition(double pos[3]);
137 
141  void BuildRepresentation() override;
142 
144 
147  vtkGetObjectMacro(ResliceAxes, vtkMatrix4x4);
148  vtkGetObjectMacro(Reslice, vtkImageAlgorithm);
150 
152 
155  vtkGetObjectMacro(ImageActor, vtkImageActor);
157 
159 
167  vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
169 
171 
177  vtkGetObjectMacro(ColorMap, vtkImageMapToColors);
180 
182 
188  void SetWindowLevel(double window, double level, int copy = 0);
189  void GetWindowLevel(double wl[2]);
190  double GetWindow() { return this->CurrentWindow; }
191  double GetLevel() { return this->CurrentLevel; }
193 
195 
197 
201  vtkSetMacro(DisplayText, vtkTypeBool);
202  vtkGetMacro(DisplayText, vtkTypeBool);
203  vtkBooleanMacro(DisplayText, vtkTypeBool);
205 
207 
213 
215 
219  vtkSetMacro(UseImageActor, vtkTypeBool);
220  vtkGetMacro(UseImageActor, vtkTypeBool);
221  vtkBooleanMacro(UseImageActor, vtkTypeBool);
223 
225 
229  void SetManipulationMode(int m);
230  vtkGetMacro(ManipulationMode, int);
232 
234 
239  void ActivateText(int);
242 
244 
248  virtual void InitializeReslicePlane();
249  virtual void ResetCamera();
251 
256 
258 
262  vtkGetObjectMacro(PlaneSource, vtkPlaneSource);
264 
270  static int BoundPlane(double bounds[6], double origin[3], double p1[3], double p2[3]);
277  static void TransformPlane(vtkPlaneSource* planeToTransform, double targetCenter[3],
278  double targetNormal[3], double targetViewUp[3]);
279 
280 protected:
283 
285 
290  virtual void SetResliceParameters(
291  double outputSpacingX, double outputSpacingY, int extentX, int extentY);
293 
297  virtual void WindowLevel(double x, double y);
298 
302  virtual void UpdateReslicePlane();
303 
308 
309  // for negative window values.
310  void InvertTable();
311 
312  // recompute origin to make the location of the reslice cursor consistent
313  // with its physical location
314  virtual void ComputeOrigin(vtkMatrix4x4*);
315 
317  void GetVector1(double d[3]);
318  void GetVector2(double d[3]);
320 
326 
327  // Keep track if modifier is set
328  int Modifier;
329 
330  // Selection tolerance for the handles
332 
333  // Format for printing the distance
335 
354  double CurrentLevel;
356  double InitialLevel;
357  double LastEventPosition[2];
361 
363  void GenerateText();
364 
365 private:
367  void operator=(const vtkResliceCursorRepresentation&) = delete;
368 };
369 
370 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:40
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:46
draw an image in a rendered 3D scene
Definition: vtkImageActor.h:43
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:48
map the input image through a lookup table
Reslices a volume along a new set of axes.
a simple class to control print indentation
Definition: vtkIndent.h:34
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:36
create an array of quadrilaterals located in a plane
perform various plane computations
Definition: vtkPlane.h:34
generates a 2D reslice cursor polydata
represent the vtkResliceCursorWidget
int ManipulationMode
The widget sets the manipulation mode.
virtual void InitializeReslicePlane()
Initialize the reslice planes and the camera center.
double GetLevel()
Set/Get the current window and level values.
~vtkResliceCursorRepresentation() override
double GetWindow()
Set/Get the current window and level values.
virtual void UpdateReslicePlane()
Update the reslice plane.
void GetVector1(double d[3])
void GetVector2(double d[3])
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods.
virtual void WindowLevel(double x, double y)
Process window level.
vtkTextProperty * GetTextProperty()
Set/Get the text property for the image data and window-level annotation.
void ManageTextDisplay()
INTERNAL - Do not use.
static void TransformPlane(vtkPlaneSource *planeToTransform, double targetCenter[3], double targetNormal[3], double targetViewUp[3])
First rotate planeToTransform to match targetPlane normal.
virtual vtkResliceCursorPolyDataAlgorithm * GetCursorAlgorithm()=0
Get the underlying cursor source.
virtual char * GetThicknessLabelText()
Get the text shown in the widget's label.
static int BoundPlane(double bounds[6], double origin[3], double p1[3], double p2[3])
Fit the plane defined by origin, p1, p2 onto the bounds.
virtual void ComputeOrigin(vtkMatrix4x4 *)
void SetManipulationMode(int m)
INTERNAL - Do not use Set the manipulation mode.
void SetWindowLevel(double window, double level, int copy=0)
Set/Get the current window and level values.
virtual void CreateDefaultResliceAlgorithm()
Create New Reslice plane.
void GetWindowLevel(double wl[2])
Set/Get the current window and level values.
virtual void ResetCamera()
Initialize the reslice planes and the camera center.
virtual void SetColorMap(vtkImageMapToColors *)
Convenience method to get the vtkImageMapToColors filter used by this widget.
virtual void ComputeReslicePlaneOrigin()
Compute the origin of the planes so as to capture the entire image.
virtual vtkResliceCursor * GetResliceCursor()=0
void SetTextProperty(vtkTextProperty *tprop)
Set/Get the text property for the image data and window-level annotation.
void ActivateText(int)
INTERNAL - Do not use.
void BuildRepresentation() override
These are methods that satisfy vtkWidgetRepresentation's API.
virtual void SetLookupTable(vtkScalarsToColors *)
Set/Get the internal lookuptable (lut) to one defined by the user, or, alternatively,...
virtual double * GetThicknessLabelPosition()
Get the position of the widget's label in display coordinates.
virtual void GetThicknessLabelPosition(double pos[3])
Get the position of the widget's label in display coordinates.
vtkScalarsToColors * CreateDefaultLookupTable()
virtual void SetResliceParameters(double outputSpacingX, double outputSpacingY, int extentX, int extentY)
Create New Reslice plane.
virtual void GetWorldThicknessLabelPosition(double pos[3])
Get the position of the widget's label in display coordinates.
Geometry for a reslice cursor.
Superclass for mapping scalar values to colors.
An actor that displays text.
Definition: vtkTextActor.h:51
2D text annotation
Definition: vtkTextMapper.h:48
represent text properties.
handles properties associated with a texture map
Definition: vtkTexture.h:66
abstract class defines interface between the widget and widget representation classes
@ level
Definition: vtkX3D.h:401
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_RESLICE_CURSOR_REPRESENTATION_MAX_TEXTBUFF