VTK  9.3.1
vtkResliceCursorRepresentation.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
18 #ifndef vtkResliceCursorRepresentation_h
19 #define vtkResliceCursorRepresentation_h
20 
21 #include "vtkInteractionWidgetsModule.h" // For export macro
23 
24 VTK_ABI_NAMESPACE_BEGIN
25 class vtkTextProperty;
26 class vtkActor2D;
27 class vtkTextMapper;
28 class vtkImageData;
29 class vtkImageReslice;
30 class vtkPlane;
31 class vtkPlaneSource;
33 class vtkResliceCursor;
34 class vtkMatrix4x4;
35 class vtkScalarsToColors;
37 class vtkActor;
38 class vtkImageActor;
39 class vtkTexture;
40 class vtkTextActor;
41 class vtkImageAlgorithm;
42 
43 // Private.
44 #define VTK_RESLICE_CURSOR_REPRESENTATION_MAX_TEXTBUFF 128
45 
46 class VTKINTERACTIONWIDGETS_EXPORT vtkResliceCursorRepresentation : public vtkWidgetRepresentation
47 {
48 public:
50 
54  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
58 
63  vtkSetClampMacro(Tolerance, int, 1, 100);
64  vtkGetMacro(Tolerance, int);
66 
68 
71  vtkSetMacro(ShowReslicedImage, vtkTypeBool);
72  vtkGetMacro(ShowReslicedImage, vtkTypeBool);
73  vtkBooleanMacro(ShowReslicedImage, vtkTypeBool);
75 
77 
81  vtkSetMacro(RestrictPlaneToVolume, vtkTypeBool);
82  vtkGetMacro(RestrictPlaneToVolume, vtkTypeBool);
83  vtkBooleanMacro(RestrictPlaneToVolume, vtkTypeBool);
85 
87 
92  vtkSetStringMacro(ThicknessLabelFormat);
93  vtkGetStringMacro(ThicknessLabelFormat);
95 
96  // Used to communicate about the state of the representation
97  enum
98  {
99  Outside = 0,
105  OnAxis2
106  };
107  enum
108  {
109  None = 0,
114  TranslateSingleAxis
115  };
116 
120  virtual char* GetThicknessLabelText();
121 
123 
126  virtual double* GetThicknessLabelPosition();
127  virtual void GetThicknessLabelPosition(double pos[3]);
128  virtual void GetWorldThicknessLabelPosition(double pos[3]);
130 
134  void BuildRepresentation() override;
135 
137 
140  vtkGetObjectMacro(ResliceAxes, vtkMatrix4x4);
141  vtkGetObjectMacro(Reslice, vtkImageAlgorithm);
143 
145 
148  vtkGetObjectMacro(ImageActor, vtkImageActor);
150 
152 
159  virtual void SetLookupTable(vtkScalarsToColors*);
160  vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
162 
164 
170  vtkGetObjectMacro(ColorMap, vtkImageMapToColors);
171  virtual void SetColorMap(vtkImageMapToColors*);
173 
175 
181  void SetWindowLevel(double window, double level, int copy = 0);
182  void GetWindowLevel(double wl[2]);
183  double GetWindow() { return this->CurrentWindow; }
184  double GetLevel() { return this->CurrentLevel; }
186 
187  virtual vtkResliceCursor* GetResliceCursor() = 0;
188 
190 
194  vtkSetMacro(DisplayText, vtkTypeBool);
195  vtkGetMacro(DisplayText, vtkTypeBool);
196  vtkBooleanMacro(DisplayText, vtkTypeBool);
198 
200 
203  void SetTextProperty(vtkTextProperty* tprop);
204  vtkTextProperty* GetTextProperty();
206 
208 
212  vtkSetMacro(UseImageActor, vtkTypeBool);
213  vtkGetMacro(UseImageActor, vtkTypeBool);
214  vtkBooleanMacro(UseImageActor, vtkTypeBool);
216 
218 
222  void SetManipulationMode(int m);
223  vtkGetMacro(ManipulationMode, int);
225 
227 
232  void ActivateText(int);
233  void ManageTextDisplay();
235 
237 
241  virtual void InitializeReslicePlane();
242  virtual void ResetCamera();
244 
248  virtual vtkResliceCursorPolyDataAlgorithm* GetCursorAlgorithm() = 0;
249 
251 
255  vtkGetObjectMacro(PlaneSource, vtkPlaneSource);
257 
263  static int BoundPlane(double bounds[6], double origin[3], double p1[3], double p2[3]);
270  static void TransformPlane(vtkPlaneSource* planeToTransform, double targetCenter[3],
271  double targetNormal[3], double targetViewUp[3]);
272 
273 protected:
275  ~vtkResliceCursorRepresentation() override;
276 
278 
282  virtual void CreateDefaultResliceAlgorithm();
283  virtual void SetResliceParameters(
284  double outputSpacingX, double outputSpacingY, int extentX, int extentY);
286 
290  virtual void WindowLevel(double x, double y);
291 
295  virtual void UpdateReslicePlane();
296 
300  virtual void ComputeReslicePlaneOrigin();
301 
302  // for negative window values.
303  void InvertTable();
304 
305  // recompute origin to make the location of the reslice cursor consistent
306  // with its physical location
307  virtual void ComputeOrigin(vtkMatrix4x4*);
308 
310  void GetVector1(double d[3]);
311  void GetVector2(double d[3]);
313 
319 
320  // Keep track if modifier is set
321  int Modifier;
322 
323  // Selection tolerance for the handles
325 
326  // Format for printing the distance
328 
347  double CurrentLevel;
349  double InitialLevel;
350  double LastEventPosition[2];
354 
355  vtkScalarsToColors* CreateDefaultLookupTable();
356  void GenerateText();
357 
358 private:
360  void operator=(const vtkResliceCursorRepresentation&) = delete;
361 };
362 
363 VTK_ABI_NAMESPACE_END
364 #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:40
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:30
generates a 2D reslice cursor polydata
a actor that draws 2D data
Definition: vtkActor2D.h:34
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:39
int vtkTypeBool
Definition: vtkABI.h:64
Superclass for mapping scalar values to colors.
An actor that displays text.
Definition: vtkTextActor.h:45
draw an image in a rendered 3D scene
Definition: vtkImageActor.h:37
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
double GetWindow()
Set/Get the current window and level values.
perform various plane computations
Definition: vtkPlane.h:25
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:57
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.