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=========================================================================*/
33#ifndef vtkImageCroppingRegionsWidget_h
34#define vtkImageCroppingRegionsWidget_h
35
36#include "vtk3DWidget.h"
37#include "vtkInteractionWidgetsModule.h" // For export macro
38
39class vtkActor2D;
40class vtkImageData;
41class vtkLineSource;
42class vtkVolumeMapper;
43class vtkPolyData;
44
45class VTKINTERACTIONWIDGETS_EXPORT vtkImageCroppingRegionsWidget : public vtk3DWidget
46{
47public:
49
54 void PrintSelf(ostream& os, vtkIndent indent) override;
56
58
62 void PlaceWidget(double bounds[6]) override;
64
68 void SetEnabled(int enabling) override;
69
71
74 vtkGetVector6Macro(PlanePositions, double);
75 virtual void SetPlanePositions(double pos[6])
76 {
77 this->SetPlanePositions(pos[0], pos[1], pos[2], pos[3], pos[4], pos[5]);
78 }
79 virtual void SetPlanePositions(float pos[6])
80 {
81 this->SetPlanePositions(pos[0], pos[1], pos[2], pos[3], pos[4], pos[5]);
82 }
83 virtual void SetPlanePositions(
84 double xMin, double xMax, double yMin, double yMax, double zMin, double zMax);
86
88
91 virtual void SetCroppingRegionFlags(int flags);
92 vtkGetMacro(CroppingRegionFlags, int);
94
99 enum
100 {
101 SLICE_ORIENTATION_YZ = 0,
102 SLICE_ORIENTATION_XZ = 1,
103 SLICE_ORIENTATION_XY = 2
104 };
105
106 vtkGetMacro(SliceOrientation, int);
107 virtual void SetSliceOrientation(int orientation);
109 {
111 }
113 {
115 }
117 {
119 }
120
122
125 virtual void SetSlice(int num);
126 vtkGetMacro(Slice, int);
128
130
133 virtual void SetLine1Color(double r, double g, double b);
134 virtual void SetLine1Color(double rgb[3]) { this->SetLine1Color(rgb[0], rgb[1], rgb[2]); }
135 virtual double* GetLine1Color();
136 virtual void GetLine1Color(double rgb[3]);
138
140
143 virtual void SetLine2Color(double r, double g, double b);
144 virtual void SetLine2Color(double rgb[3]) { this->SetLine2Color(rgb[0], rgb[1], rgb[2]); }
145 virtual double* GetLine2Color();
146 virtual void GetLine2Color(double rgb[3]);
148
150
153 virtual void SetLine3Color(double r, double g, double b);
154 virtual void SetLine3Color(double rgb[3]) { this->SetLine3Color(rgb[0], rgb[1], rgb[2]); }
155 virtual double* GetLine3Color();
156 virtual void GetLine3Color(double rgb[3]);
158
160
163 virtual void SetLine4Color(double r, double g, double b);
164 virtual void SetLine4Color(double rgb[3]) { this->SetLine4Color(rgb[0], rgb[1], rgb[2]); }
165 virtual double* GetLine4Color();
166 virtual void GetLine4Color(double rgb[3]);
168
170
174 virtual void SetVolumeMapper(vtkVolumeMapper* mapper);
175 vtkGetObjectMacro(VolumeMapper, vtkVolumeMapper);
178
180
191
196 {
197 CroppingPlanesPositionChangedEvent = 10050
198 };
199
200protected:
203
205
206 vtkLineSource* LineSources[4];
207 vtkActor2D* LineActors[4];
208 vtkPolyData* RegionPolyData[9];
209 vtkActor2D* RegionActors[9];
210
211 double PlanePositions[6];
212
214 int Slice;
215
217
219
222
223 // Handles the events
224
225 static void ProcessEvents(
226 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
227
228 void SetMouseCursor(int state);
229
231 {
232 NoLine = 0,
240 MovingH2
241 };
242
243 int ComputeWorldCoordinate(int x, int y, double* coord);
244
247 void ConstrainPlanePositions(double positions[6]);
248
249private:
251 void operator=(const vtkImageCroppingRegionsWidget&) = delete;
252};
253
254#endif
an abstract superclass for 3D widgets
Definition: vtk3DWidget.h:71
virtual void PlaceWidget()
This method is used to initially place the widget.
a actor that draws 2D data
Definition: vtkActor2D.h:149
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.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods.
virtual double * GetLine4Color()
Set/Get line 4 color.
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 double * GetLine2Color()
Set/Get line 2 color.
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.
virtual double * GetLine1Color()
Set/Get line 1 color.
void SetMouseCursor(int state)
int ComputeWorldCoordinate(int x, int y, double *coord)
virtual void SetLine1Color(double r, double g, double b)
Set/Get line 1 color.
void MoveHorizontalLine()
Callbacks for user interaction.
static vtkImageCroppingRegionsWidget * New()
Standard VTK methods.
virtual void SetVolumeMapper(vtkVolumeMapper *mapper)
Set/Get the input volume mapper Update the widget according to its mapper.
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.
virtual double * GetLine3Color()
Set/Get line 3 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:157
a simple class to control print indentation
Definition: vtkIndent.h:113
create a line defined by two end points
abstract base class for most VTK objects
Definition: vtkObject.h:82
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
Abstract class for a volume mapper.