VTK  9.2.6
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 =========================================================================*/
30 #ifndef vtkResliceCursorRepresentation_h
31 #define vtkResliceCursorRepresentation_h
32 
33 #include "vtkInteractionWidgetsModule.h" // For export macro
35 
36 class vtkTextProperty;
37 class vtkActor2D;
38 class vtkTextMapper;
39 class vtkImageData;
40 class vtkImageReslice;
41 class vtkPlane;
42 class vtkPlaneSource;
44 class vtkResliceCursor;
45 class vtkMatrix4x4;
46 class vtkScalarsToColors;
48 class vtkActor;
49 class vtkImageActor;
50 class vtkTexture;
51 class vtkTextActor;
52 class vtkImageAlgorithm;
53 
54 // Private.
55 #define VTK_RESLICE_CURSOR_REPRESENTATION_MAX_TEXTBUFF 128
56 
57 class VTKINTERACTIONWIDGETS_EXPORT vtkResliceCursorRepresentation : public vtkWidgetRepresentation
58 {
59 public:
61 
65  void PrintSelf(ostream& os, vtkIndent indent) override;
67 
69 
74  vtkSetClampMacro(Tolerance, int, 1, 100);
75  vtkGetMacro(Tolerance, int);
77 
79 
82  vtkSetMacro(ShowReslicedImage, vtkTypeBool);
83  vtkGetMacro(ShowReslicedImage, vtkTypeBool);
84  vtkBooleanMacro(ShowReslicedImage, vtkTypeBool);
86 
88 
92  vtkSetMacro(RestrictPlaneToVolume, vtkTypeBool);
93  vtkGetMacro(RestrictPlaneToVolume, vtkTypeBool);
94  vtkBooleanMacro(RestrictPlaneToVolume, vtkTypeBool);
96 
98 
103  vtkSetStringMacro(ThicknessLabelFormat);
104  vtkGetStringMacro(ThicknessLabelFormat);
106 
107  // Used to communicate about the state of the representation
108  enum
109  {
110  Outside = 0,
116  OnAxis2
117  };
118  enum
119  {
120  None = 0,
125  TranslateSingleAxis
126  };
127 
131  virtual char* GetThicknessLabelText();
132 
134 
137  virtual double* GetThicknessLabelPosition();
138  virtual void GetThicknessLabelPosition(double pos[3]);
139  virtual void GetWorldThicknessLabelPosition(double pos[3]);
141 
145  void BuildRepresentation() override;
146 
148 
151  vtkGetObjectMacro(ResliceAxes, vtkMatrix4x4);
152  vtkGetObjectMacro(Reslice, vtkImageAlgorithm);
154 
156 
159  vtkGetObjectMacro(ImageActor, vtkImageActor);
161 
163 
170  virtual void SetLookupTable(vtkScalarsToColors*);
171  vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
173 
175 
181  vtkGetObjectMacro(ColorMap, vtkImageMapToColors);
182  virtual void SetColorMap(vtkImageMapToColors*);
184 
186 
192  void SetWindowLevel(double window, double level, int copy = 0);
193  void GetWindowLevel(double wl[2]);
194  double GetWindow() { return this->CurrentWindow; }
195  double GetLevel() { return this->CurrentLevel; }
197 
198  virtual vtkResliceCursor* GetResliceCursor() = 0;
199 
201 
205  vtkSetMacro(DisplayText, vtkTypeBool);
206  vtkGetMacro(DisplayText, vtkTypeBool);
207  vtkBooleanMacro(DisplayText, vtkTypeBool);
209 
211 
214  void SetTextProperty(vtkTextProperty* tprop);
215  vtkTextProperty* GetTextProperty();
217 
219 
223  vtkSetMacro(UseImageActor, vtkTypeBool);
224  vtkGetMacro(UseImageActor, vtkTypeBool);
225  vtkBooleanMacro(UseImageActor, vtkTypeBool);
227 
229 
233  void SetManipulationMode(int m);
234  vtkGetMacro(ManipulationMode, int);
236 
238 
243  void ActivateText(int);
244  void ManageTextDisplay();
246 
248 
252  virtual void InitializeReslicePlane();
253  virtual void ResetCamera();
255 
259  virtual vtkResliceCursorPolyDataAlgorithm* GetCursorAlgorithm() = 0;
260 
262 
266  vtkGetObjectMacro(PlaneSource, vtkPlaneSource);
268 
274  static int BoundPlane(double bounds[6], double origin[3], double p1[3], double p2[3]);
281  static void TransformPlane(vtkPlaneSource* planeToTransform, double targetCenter[3],
282  double targetNormal[3], double targetViewUp[3]);
283 
284 protected:
286  ~vtkResliceCursorRepresentation() override;
287 
289 
293  virtual void CreateDefaultResliceAlgorithm();
294  virtual void SetResliceParameters(
295  double outputSpacingX, double outputSpacingY, int extentX, int extentY);
297 
301  virtual void WindowLevel(double x, double y);
302 
306  virtual void UpdateReslicePlane();
307 
311  virtual void ComputeReslicePlaneOrigin();
312 
313  // for negative window values.
314  void InvertTable();
315 
316  // recompute origin to make the location of the reslice cursor consistent
317  // with its physical location
318  virtual void ComputeOrigin(vtkMatrix4x4*);
319 
321  void GetVector1(double d[3]);
322  void GetVector2(double d[3]);
324 
330 
331  // Keep track if modifier is set
332  int Modifier;
333 
334  // Selection tolerance for the handles
336 
337  // Format for printing the distance
339 
358  double CurrentLevel;
360  double InitialLevel;
361  double LastEventPosition[2];
365 
366  vtkScalarsToColors* CreateDefaultLookupTable();
367  void GenerateText();
368 
369 private:
371  void operator=(const vtkResliceCursorRepresentation&) = delete;
372 };
373 
374 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
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:50
int vtkTypeBool
Definition: vtkABI.h:69
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:48
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
double GetWindow()
Set/Get the current window and level values.
perform various plane computations
Definition: vtkPlane.h:36
map the input image through a lookup table
#define VTK_RESLICE_CURSOR_REPRESENTATION_MAX_TEXTBUFF
handles properties associated with a texture map
Definition: vtkTexture.h:68
represent text properties.
Reslices a volume along a new set of axes.
create an array of quadrilaterals located in a plane
Generic algorithm superclass for image algs.
double GetLevel()
Set/Get the current window and level values.
represent the vtkResliceCursorWidget
Geometry for a reslice cursor.