VTK  9.1.0
vtkImageCroppingRegionsWidget.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkImageCroppingRegionsWidget.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 vtkImageCroppingRegionsWidget_h
31 #define vtkImageCroppingRegionsWidget_h
32 
33 #include "vtk3DWidget.h"
34 #include "vtkInteractionWidgetsModule.h" // For export macro
35 
36 class vtkActor2D;
37 class vtkImageData;
38 class vtkLineSource;
39 class vtkVolumeMapper;
40 class vtkPolyData;
41 
42 class VTKINTERACTIONWIDGETS_EXPORT vtkImageCroppingRegionsWidget : public vtk3DWidget
43 {
44 public:
46 
51  void PrintSelf(ostream& os, vtkIndent indent) override;
53 
55 
59  void PlaceWidget(double bounds[6]) override;
61 
65  void SetEnabled(int enabling) override;
66 
68 
71  vtkGetVector6Macro(PlanePositions, double);
72  virtual void SetPlanePositions(double pos[6])
73  {
74  this->SetPlanePositions(pos[0], pos[1], pos[2], pos[3], pos[4], pos[5]);
75  }
76  virtual void SetPlanePositions(float pos[6])
77  {
78  this->SetPlanePositions(pos[0], pos[1], pos[2], pos[3], pos[4], pos[5]);
79  }
80  virtual void SetPlanePositions(
81  double xMin, double xMax, double yMin, double yMax, double zMin, double zMax);
83 
85 
88  virtual void SetCroppingRegionFlags(int flags);
89  vtkGetMacro(CroppingRegionFlags, int);
91 
96  enum
97  {
98  SLICE_ORIENTATION_YZ = 0,
99  SLICE_ORIENTATION_XZ = 1,
100  SLICE_ORIENTATION_XY = 2
101  };
102 
103  vtkGetMacro(SliceOrientation, int);
104  virtual void SetSliceOrientation(int orientation);
105  virtual void SetSliceOrientationToXY()
106  {
107  this->SetSliceOrientation(vtkImageCroppingRegionsWidget::SLICE_ORIENTATION_XY);
108  }
109  virtual void SetSliceOrientationToYZ()
110  {
111  this->SetSliceOrientation(vtkImageCroppingRegionsWidget::SLICE_ORIENTATION_YZ);
112  }
113  virtual void SetSliceOrientationToXZ()
114  {
115  this->SetSliceOrientation(vtkImageCroppingRegionsWidget::SLICE_ORIENTATION_XZ);
116  }
117 
119 
122  virtual void SetSlice(int num);
123  vtkGetMacro(Slice, int);
125 
127 
130  virtual void SetLine1Color(double r, double g, double b);
131  virtual void SetLine1Color(double rgb[3]) { this->SetLine1Color(rgb[0], rgb[1], rgb[2]); }
132  virtual double* GetLine1Color();
133  virtual void GetLine1Color(double rgb[3]);
135 
137 
140  virtual void SetLine2Color(double r, double g, double b);
141  virtual void SetLine2Color(double rgb[3]) { this->SetLine2Color(rgb[0], rgb[1], rgb[2]); }
142  virtual double* GetLine2Color();
143  virtual void GetLine2Color(double rgb[3]);
145 
147 
150  virtual void SetLine3Color(double r, double g, double b);
151  virtual void SetLine3Color(double rgb[3]) { this->SetLine3Color(rgb[0], rgb[1], rgb[2]); }
152  virtual double* GetLine3Color();
153  virtual void GetLine3Color(double rgb[3]);
155 
157 
160  virtual void SetLine4Color(double r, double g, double b);
161  virtual void SetLine4Color(double rgb[3]) { this->SetLine4Color(rgb[0], rgb[1], rgb[2]); }
162  virtual double* GetLine4Color();
163  virtual void GetLine4Color(double rgb[3]);
165 
167 
171  virtual void SetVolumeMapper(vtkVolumeMapper* mapper);
172  vtkGetObjectMacro(VolumeMapper, vtkVolumeMapper);
173  virtual void UpdateAccordingToInput();
175 
177 
186  void OnMouseMove();
188 
193  {
194  CroppingPlanesPositionChangedEvent = 10050
195  };
196 
197 protected:
200 
202 
203  vtkLineSource* LineSources[4];
204  vtkActor2D* LineActors[4];
205  vtkPolyData* RegionPolyData[9];
206  vtkActor2D* RegionActors[9];
207 
208  double PlanePositions[6];
209 
211  int Slice;
212 
214 
216 
218  int Moving;
219 
220  // Handles the events
221 
222  static void ProcessEvents(
223  vtkObject* object, unsigned long event, void* clientdata, void* calldata);
224 
225  void SetMouseCursor(int state);
226 
228  {
229  NoLine = 0,
237  MovingH2
238  };
239 
240  int ComputeWorldCoordinate(int x, int y, double* coord);
241 
244  void ConstrainPlanePositions(double positions[6]);
245 
246 private:
248  void operator=(const vtkImageCroppingRegionsWidget&) = delete;
249 };
250 
251 #endif
an abstract superclass for 3D widgets
Definition: vtk3DWidget.h:68
virtual void PlaceWidget()
This method is used to initially place the widget.
a actor that draws 2D data
Definition: vtkActor2D.h:40
void OnMouseMove()
Callbacks for user interaction.
void ConstrainPlanePositions(double positions[6])
virtual void SetSlice(int num)
Set/Get the slice number.
virtual void SetPlanePositions(float pos[6])
Set/Get the plane positions that represent the cropped region.
virtual void SetCroppingRegionFlags(int flags)
Set/Get the cropping region flags.
void OnButtonPress()
Callbacks for user interaction.
virtual void SetPlanePositions(double pos[6])
Set/Get the plane positions that represent the cropped region.
virtual void SetSliceOrientation(int orientation)
WidgetEventIds
Events invoked by this widget.
virtual double * GetLine4Color()
Set/Get line 4 color.
virtual double * GetLine1Color()
Set/Get line 1 color.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods.
virtual void GetLine4Color(double rgb[3])
Set/Get line 4 color.
virtual void SetPlanePositions(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
Set/Get the plane positions that represent the cropped region.
void UpdateCursorIcon()
Callbacks for user interaction.
void MoveVerticalLine()
Callbacks for user interaction.
void MoveIntersectingLines()
Callbacks for user interaction.
virtual void UpdateAccordingToInput()
Set/Get the input volume mapper Update the widget according to its mapper.
virtual void GetLine2Color(double rgb[3])
Set/Get line 2 color.
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
virtual void SetLine4Color(double rgb[3])
Set/Get line 4 color.
virtual void SetLine4Color(double r, double g, double b)
Set/Get line 4 color.
virtual void SetLine2Color(double rgb[3])
Set/Get line 2 color.
void SetMouseCursor(int state)
int ComputeWorldCoordinate(int x, int y, double *coord)
virtual double * GetLine2Color()
Set/Get line 2 color.
static vtkImageCroppingRegionsWidget * New()
Standard VTK methods.
virtual void SetLine1Color(double r, double g, double b)
Set/Get line 1 color.
void MoveHorizontalLine()
Callbacks for user interaction.
virtual void SetVolumeMapper(vtkVolumeMapper *mapper)
Set/Get the input volume mapper Update the widget according to its mapper.
virtual double * GetLine3Color()
Set/Get line 3 color.
virtual void SetLine1Color(double rgb[3])
Set/Get line 1 color.
virtual void GetLine3Color(double rgb[3])
Set/Get line 3 color.
~vtkImageCroppingRegionsWidget() override
virtual void SetLine3Color(double r, double g, double b)
Set/Get line 3 color.
virtual void SetLine2Color(double r, double g, double b)
Set/Get line 2 color.
void OnButtonRelease()
Callbacks for user interaction.
void SetEnabled(int enabling) override
Enable/disable the widget.
virtual void SetLine3Color(double rgb[3])
Set/Get line 3 color.
void PlaceWidget(double bounds[6]) override
Place/Adjust widget within bounds.
virtual void GetLine1Color(double rgb[3])
Set/Get line 1 color.
topologically and geometrically regular array of data
Definition: vtkImageData.h:48
a simple class to control print indentation
Definition: vtkIndent.h:34
create a line defined by two end points
Definition: vtkLineSource.h:61
abstract base class for most VTK objects
Definition: vtkObject.h:54
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
Abstract class for a volume mapper.
@ orientation
Definition: vtkX3D.h:268