VTK  9.2.20230606
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 VTK_ABI_NAMESPACE_BEGIN
37 class vtkTextProperty;
38 class vtkActor2D;
39 class vtkTextMapper;
40 class vtkImageData;
41 class vtkImageReslice;
42 class vtkPlane;
43 class vtkPlaneSource;
45 class vtkResliceCursor;
46 class vtkMatrix4x4;
47 class vtkScalarsToColors;
49 class vtkActor;
50 class vtkImageActor;
51 class vtkTexture;
52 class vtkTextActor;
53 class vtkImageAlgorithm;
54 
55 // Private.
56 #define VTK_RESLICE_CURSOR_REPRESENTATION_MAX_TEXTBUFF 128
57 
58 class VTKINTERACTIONWIDGETS_EXPORT vtkResliceCursorRepresentation : public vtkWidgetRepresentation
59 {
60 public:
62 
66  void PrintSelf(ostream& os, vtkIndent indent) override;
68 
70 
75  vtkSetClampMacro(Tolerance, int, 1, 100);
76  vtkGetMacro(Tolerance, int);
78 
80 
83  vtkSetMacro(ShowReslicedImage, vtkTypeBool);
84  vtkGetMacro(ShowReslicedImage, vtkTypeBool);
85  vtkBooleanMacro(ShowReslicedImage, vtkTypeBool);
87 
89 
93  vtkSetMacro(RestrictPlaneToVolume, vtkTypeBool);
94  vtkGetMacro(RestrictPlaneToVolume, vtkTypeBool);
95  vtkBooleanMacro(RestrictPlaneToVolume, vtkTypeBool);
97 
99 
104  vtkSetStringMacro(ThicknessLabelFormat);
105  vtkGetStringMacro(ThicknessLabelFormat);
107 
108  // Used to communicate about the state of the representation
109  enum
110  {
111  Outside = 0,
117  OnAxis2
118  };
119  enum
120  {
121  None = 0,
126  TranslateSingleAxis
127  };
128 
132  virtual char* GetThicknessLabelText();
133 
135 
138  virtual double* GetThicknessLabelPosition();
139  virtual void GetThicknessLabelPosition(double pos[3]);
140  virtual void GetWorldThicknessLabelPosition(double pos[3]);
142 
146  void BuildRepresentation() override;
147 
149 
152  vtkGetObjectMacro(ResliceAxes, vtkMatrix4x4);
153  vtkGetObjectMacro(Reslice, vtkImageAlgorithm);
155 
157 
160  vtkGetObjectMacro(ImageActor, vtkImageActor);
162 
164 
172  vtkGetObjectMacro(LookupTable, vtkScalarsToColors);
174 
176 
182  vtkGetObjectMacro(ColorMap, vtkImageMapToColors);
185 
187 
193  void SetWindowLevel(double window, double level, int copy = 0);
194  void GetWindowLevel(double wl[2]);
195  double GetWindow() { return this->CurrentWindow; }
196  double GetLevel() { return this->CurrentLevel; }
198 
200 
202 
206  vtkSetMacro(DisplayText, vtkTypeBool);
207  vtkGetMacro(DisplayText, vtkTypeBool);
208  vtkBooleanMacro(DisplayText, vtkTypeBool);
210 
212 
218 
220 
224  vtkSetMacro(UseImageActor, vtkTypeBool);
225  vtkGetMacro(UseImageActor, vtkTypeBool);
226  vtkBooleanMacro(UseImageActor, vtkTypeBool);
228 
230 
234  void SetManipulationMode(int m);
235  vtkGetMacro(ManipulationMode, int);
237 
239 
244  void ActivateText(int);
247 
249 
253  virtual void InitializeReslicePlane();
254  virtual void ResetCamera();
256 
261 
263 
267  vtkGetObjectMacro(PlaneSource, vtkPlaneSource);
269 
275  static int BoundPlane(double bounds[6], double origin[3], double p1[3], double p2[3]);
282  static void TransformPlane(vtkPlaneSource* planeToTransform, double targetCenter[3],
283  double targetNormal[3], double targetViewUp[3]);
284 
285 protected:
288 
290 
295  virtual void SetResliceParameters(
296  double outputSpacingX, double outputSpacingY, int extentX, int extentY);
298 
302  virtual void WindowLevel(double x, double y);
303 
307  virtual void UpdateReslicePlane();
308 
313 
314  // for negative window values.
315  void InvertTable();
316 
317  // recompute origin to make the location of the reslice cursor consistent
318  // with its physical location
319  virtual void ComputeOrigin(vtkMatrix4x4*);
320 
322  void GetVector1(double d[3]);
323  void GetVector2(double d[3]);
325 
331 
332  // Keep track if modifier is set
333  int Modifier;
334 
335  // Selection tolerance for the handles
337 
338  // Format for printing the distance
340 
359  double CurrentLevel;
361  double InitialLevel;
362  double LastEventPosition[2];
366 
368  void GenerateText();
369 
370 private:
372  void operator=(const vtkResliceCursorRepresentation&) = delete;
373 };
374 
375 VTK_ABI_NAMESPACE_END
376 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:156
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:162
draw an image in a rendered 3D scene
Generic algorithm superclass for image algs.
topologically and geometrically regular array of data
Definition: vtkImageData.h:164
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:120
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:152
create an array of quadrilaterals located in a plane
perform various plane computations
Definition: vtkPlane.h:147
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:167
2D text annotation
represent text properties.
handles properties associated with a texture map
Definition: vtkTexture.h:179
abstract class defines interface between the widget and widget representation classes
@ level
Definition: vtkX3D.h:407
int vtkTypeBool
Definition: vtkABI.h:71
#define VTK_RESLICE_CURSOR_REPRESENTATION_MAX_TEXTBUFF