VTK  9.7.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 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkTextProperty;
27 class vtkActor2D;
28 class vtkTextMapper;
29 class vtkImageData;
30 class vtkImageReslice;
31 class vtkPlane;
32 class vtkPlaneSource;
34 class vtkResliceCursor;
35 class vtkMatrix4x4;
36 class vtkScalarsToColors;
38 class vtkActor;
39 class vtkImageActor;
40 class vtkTexture;
41 class vtkTextActor;
42 class vtkImageAlgorithm;
43 
44 // Private.
45 #define VTK_RESLICE_CURSOR_REPRESENTATION_MAX_TEXTBUFF 128
46 
47 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkResliceCursorRepresentation
49 {
50 public:
52 
56  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
60 
65  vtkSetClampMacro(Tolerance, int, 1, 100);
66  vtkGetMacro(Tolerance, int);
68 
70 
73  vtkSetMacro(ShowReslicedImage, vtkTypeBool);
74  vtkGetMacro(ShowReslicedImage, vtkTypeBool);
75  vtkBooleanMacro(ShowReslicedImage, vtkTypeBool);
77 
79 
83  vtkSetMacro(RestrictPlaneToVolume, vtkTypeBool);
84  vtkGetMacro(RestrictPlaneToVolume, vtkTypeBool);
85  vtkBooleanMacro(RestrictPlaneToVolume, vtkTypeBool);
87 
89 
94  void SetThicknessLabelFormat(const char* format);
95  vtkGetStringMacro(ThicknessLabelFormat);
97 
98  // Used to communicate about the state of the representation
99  enum
100  {
101  Outside = 0,
107  OnAxis2
108  };
109  enum
110  {
111  None = 0,
116  TranslateSingleAxis
117  };
118 
122  virtual char* GetThicknessLabelText();
123 
125 
128  virtual double* GetThicknessLabelPosition();
129  virtual void GetThicknessLabelPosition(double pos[3]);
130  virtual void GetWorldThicknessLabelPosition(double pos[3]);
132 
136  void BuildRepresentation() override;
137 
139 
142  vtkGetObjectMacro(ResliceAxes, vtkMatrix4x4);
143  vtkGetObjectMacro(Reslice, vtkImageAlgorithm);
145 
147 
150  vtkGetObjectMacro(ImageActor, vtkImageActor);
152 
154 
161  virtual void SetLookupTable(vtkScalarsToColors*);
162  vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
164 
166 
173  vtkGetObjectMacro(ColorMap, vtkImageMapToColors);
175  virtual void SetColorMap(vtkImageMapToColors*);
177 
179 
185  void SetWindowLevel(double window, double level, int copy = 0);
186  void GetWindowLevel(double wl[2]);
187  double GetWindow() { return this->CurrentWindow; }
188  double GetLevel() { return this->CurrentLevel; }
190 
192  virtual vtkResliceCursor* GetResliceCursor() = 0;
193 
195 
199  vtkSetMacro(DisplayText, vtkTypeBool);
200  vtkGetMacro(DisplayText, vtkTypeBool);
201  vtkBooleanMacro(DisplayText, vtkTypeBool);
203 
205 
208  void SetTextProperty(vtkTextProperty* tprop);
209  vtkTextProperty* GetTextProperty();
211 
213 
217  vtkSetMacro(UseImageActor, vtkTypeBool);
218  vtkGetMacro(UseImageActor, vtkTypeBool);
219  vtkBooleanMacro(UseImageActor, vtkTypeBool);
221 
223 
227  vtkSetMacro(IndependentThickness, bool);
228  vtkGetMacro(IndependentThickness, bool);
229  vtkBooleanMacro(IndependentThickness, bool);
231 
233 
237  void SetManipulationMode(int m);
238  vtkGetMacro(ManipulationMode, int);
240 
242 
247  void ActivateText(int);
248  void ManageTextDisplay();
250 
252 
256  virtual void InitializeReslicePlane();
257  virtual void ResetCamera();
259 
263  virtual vtkResliceCursorPolyDataAlgorithm* GetCursorAlgorithm() = 0;
264 
266 
271  vtkGetObjectMacro(PlaneSource, vtkPlaneSource);
273 
279  static int BoundPlane(double bounds[6], double origin[3], double p1[3], double p2[3]);
286  static void TransformPlane(vtkPlaneSource* planeToTransform, double targetCenter[3],
287  double targetNormal[3], double targetViewUp[3]);
288 
289 protected:
291  ~vtkResliceCursorRepresentation() override;
292 
294 
298  virtual void CreateDefaultResliceAlgorithm();
299  virtual void SetResliceParameters(
300  double outputSpacingX, double outputSpacingY, int extentX, int extentY);
302 
306  virtual void WindowLevel(double x, double y);
307 
311  virtual void UpdateReslicePlane();
312 
316  virtual void ComputeReslicePlaneOrigin();
317 
318  // for negative window values.
319  void InvertTable();
320 
321  // recompute origin to make the location of the reslice cursor consistent
322  // with its physical location
323  virtual void ComputeOrigin(vtkMatrix4x4*);
324 
326  void GetVector1(double d[3]);
327  void GetVector2(double d[3]);
329 
334  int ManipulationMode;
335 
336  // Keep track if modifier is set
337  int Modifier;
338 
339  // Selection tolerance for the handles
340  int Tolerance;
341 
342  // Format for printing the distance
343  char* ThicknessLabelFormat;
344 
346  vtkPlaneSource* PlaneSource;
347  vtkTypeBool RestrictPlaneToVolume;
348  vtkTypeBool ShowReslicedImage;
349  vtkTextProperty* ThicknessTextProperty;
350  vtkTextMapper* ThicknessTextMapper;
351  vtkActor2D* ThicknessTextActor;
352  vtkMatrix4x4* ResliceAxes;
353  vtkMatrix4x4* NewResliceAxes;
355  vtkActor* TexturePlaneActor;
356  vtkTexture* Texture;
357  vtkScalarsToColors* LookupTable;
358  vtkImageActor* ImageActor;
359  vtkTextActor* TextActor;
360  double OriginalWindow;
361  double OriginalLevel;
362  double CurrentWindow;
363  double CurrentLevel;
364  double InitialWindow;
365  double InitialLevel;
366  double LastEventPosition[2];
367  vtkTypeBool UseImageActor;
369  vtkTypeBool DisplayText;
370  bool IndependentThickness = false;
371 
372  vtkScalarsToColors* CreateDefaultLookupTable();
373  void GenerateText();
374 
375 private:
376  vtkResliceCursorRepresentation(const vtkResliceCursorRepresentation&) = delete;
377  void operator=(const vtkResliceCursorRepresentation&) = delete;
378 };
379 
380 VTK_ABI_NAMESPACE_END
381 #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:41
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:31
generates a 2D reslice cursor polydata
a actor that draws 2D data
Definition: vtkActor2D.h:35
#define VTK_MARSHAL_EXCLUDE_REASON_IS_REDUNDANT
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:48
draw an image in a rendered 3D scene
Definition: vtkImageActor.h:38
a simple class to control print indentation
Definition: vtkIndent.h:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
!< For HCURL
perform various plane computations
Definition: vtkPlane.h:31
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:58
represent text properties.
Reslices a volume along a new set of axes.
create an array of quadrilaterals located in a plane
#define VTK_MARSHALEXCLUDE(reason)
Generic algorithm superclass for image algs.
double GetLevel()
Set/Get the current window and level values.
#define VTK_MARSHALAUTO
represent the vtkResliceCursorWidget
#define VTK_MARSHAL_EXCLUDE_REASON_IS_INTERNAL
Geometry for a reslice cursor.