VTK  9.3.0
vtkImageCroppingRegionsWidget.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 vtkImageCroppingRegionsWidget_h
19#define vtkImageCroppingRegionsWidget_h
20
21#include "vtk3DWidget.h"
22#include "vtkInteractionWidgetsModule.h" // For export macro
23
24VTK_ABI_NAMESPACE_BEGIN
25class vtkActor2D;
26class vtkImageData;
27class vtkLineSource;
28class vtkVolumeMapper;
29class vtkPolyData;
30
31class VTKINTERACTIONWIDGETS_EXPORT vtkImageCroppingRegionsWidget : public vtk3DWidget
32{
33public:
35
40 void PrintSelf(ostream& os, vtkIndent indent) override;
42
44
48 void PlaceWidget(double bounds[6]) override;
50
54 void SetEnabled(int enabling) override;
55
57
60 vtkGetVector6Macro(PlanePositions, double);
61 virtual void SetPlanePositions(double pos[6])
62 {
63 this->SetPlanePositions(pos[0], pos[1], pos[2], pos[3], pos[4], pos[5]);
64 }
65 virtual void SetPlanePositions(float pos[6])
66 {
67 this->SetPlanePositions(pos[0], pos[1], pos[2], pos[3], pos[4], pos[5]);
68 }
69 virtual void SetPlanePositions(
70 double xMin, double xMax, double yMin, double yMax, double zMin, double zMax);
72
74
77 virtual void SetCroppingRegionFlags(int flags);
78 vtkGetMacro(CroppingRegionFlags, int);
80
85 enum
86 {
87 SLICE_ORIENTATION_YZ = 0,
88 SLICE_ORIENTATION_XZ = 1,
89 SLICE_ORIENTATION_XY = 2
90 };
91
92 vtkGetMacro(SliceOrientation, int);
93 virtual void SetSliceOrientation(int orientation);
95 {
97 }
99 {
101 }
103 {
105 }
106
108
111 virtual void SetSlice(int num);
112 vtkGetMacro(Slice, int);
114
116
119 virtual void SetLine1Color(double r, double g, double b);
120 virtual void SetLine1Color(double rgb[3]) { this->SetLine1Color(rgb[0], rgb[1], rgb[2]); }
121 virtual double* GetLine1Color();
122 virtual void GetLine1Color(double rgb[3]);
124
126
129 virtual void SetLine2Color(double r, double g, double b);
130 virtual void SetLine2Color(double rgb[3]) { this->SetLine2Color(rgb[0], rgb[1], rgb[2]); }
131 virtual double* GetLine2Color();
132 virtual void GetLine2Color(double rgb[3]);
134
136
139 virtual void SetLine3Color(double r, double g, double b);
140 virtual void SetLine3Color(double rgb[3]) { this->SetLine3Color(rgb[0], rgb[1], rgb[2]); }
141 virtual double* GetLine3Color();
142 virtual void GetLine3Color(double rgb[3]);
144
146
149 virtual void SetLine4Color(double r, double g, double b);
150 virtual void SetLine4Color(double rgb[3]) { this->SetLine4Color(rgb[0], rgb[1], rgb[2]); }
151 virtual double* GetLine4Color();
152 virtual void GetLine4Color(double rgb[3]);
154
156
160 virtual void SetVolumeMapper(vtkVolumeMapper* mapper);
161 vtkGetObjectMacro(VolumeMapper, vtkVolumeMapper);
164
166
177
182 {
183 CroppingPlanesPositionChangedEvent = 10050
184 };
185
186protected:
189
191
192 vtkLineSource* LineSources[4];
193 vtkActor2D* LineActors[4];
194 vtkPolyData* RegionPolyData[9];
195 vtkActor2D* RegionActors[9];
196
197 double PlanePositions[6];
198
200 int Slice;
201
203
205
208
209 // Handles the events
210
211 static void ProcessEvents(
212 vtkObject* object, unsigned long event, void* clientdata, void* calldata);
213
214 void SetMouseCursor(int state);
215
217 {
218 NoLine = 0,
226 MovingH2
227 };
228
229 int ComputeWorldCoordinate(int x, int y, double* coord);
230
233 void ConstrainPlanePositions(double positions[6]);
234
235private:
237 void operator=(const vtkImageCroppingRegionsWidget&) = delete;
238};
239
240VTK_ABI_NAMESPACE_END
241#endif
an abstract superclass for 3D widgets
Definition vtk3DWidget.h:57
virtual void PlaceWidget()
This method is used to initially place the widget.
a actor that draws 2D data
Definition vtkActor2D.h:35
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
a simple class to control print indentation
Definition vtkIndent.h:29
create a line defined by two end points
abstract base class for most VTK objects
Definition vtkObject.h:49
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:80
Abstract class for a volume mapper.