VTK
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 "vtkInteractionWidgetsModule.h" // For export macro
37#include "vtk3DWidget.h"
38
39class vtkActor2D;
40class vtkImageData;
41class vtkLineSource;
42class vtkVolumeMapper;
43class vtkPolyData;
44
45class VTKINTERACTIONWIDGETS_EXPORT vtkImageCroppingRegionsWidget : public vtk3DWidget
46{
47public:
48
50
55 void PrintSelf(ostream& os, vtkIndent indent);
57
59
63 virtual void PlaceWidget(double bounds[6]);
65
69 virtual void SetEnabled(int enabling);
70
72
75 vtkGetVector6Macro(PlanePositions, double);
76 virtual void SetPlanePositions(double pos[6])
77 {this->SetPlanePositions(pos[0], pos[1], pos[2], pos[3], pos[4], pos[5]);}
78 virtual void SetPlanePositions(float pos[6])
79 {this->SetPlanePositions(pos[0], pos[1], pos[2], pos[3], pos[4], pos[5]);}
80 virtual void SetPlanePositions(double xMin, double xMax,
81 double yMin, double yMax,
82 double zMin, double zMax);
84
86
89 virtual void SetCroppingRegionFlags(int flags);
90 vtkGetMacro(CroppingRegionFlags, int);
92
97 enum
98 {
99 SLICE_ORIENTATION_YZ = 0,
100 SLICE_ORIENTATION_XZ = 1,
101 SLICE_ORIENTATION_XY = 2
102 };
103
104 vtkGetMacro(SliceOrientation, int);
107 { this->SetSliceOrientation(vtkImageCroppingRegionsWidget::SLICE_ORIENTATION_XY); };
109 { this->SetSliceOrientation(vtkImageCroppingRegionsWidget::SLICE_ORIENTATION_YZ); };
111 { this->SetSliceOrientation(vtkImageCroppingRegionsWidget::SLICE_ORIENTATION_XZ); };
112
114
117 virtual void SetSlice(int num);
118 vtkGetMacro(Slice, int);
120
122
125 virtual void SetLine1Color(double r, double g, double b);
126 virtual void SetLine1Color(double rgb[3])
127 { this->SetLine1Color(rgb[0], rgb[1], rgb[2]); }
128 virtual double *GetLine1Color();
129 virtual void GetLine1Color(double rgb[3]);
131
133
136 virtual void SetLine2Color(double r, double g, double b);
137 virtual void SetLine2Color(double rgb[3])
138 { this->SetLine2Color(rgb[0], rgb[1], rgb[2]); }
139 virtual double *GetLine2Color();
140 virtual void GetLine2Color(double rgb[3]);
142
144
147 virtual void SetLine3Color(double r, double g, double b);
148 virtual void SetLine3Color(double rgb[3])
149 { this->SetLine3Color(rgb[0], rgb[1], rgb[2]); }
150 virtual double *GetLine3Color();
151 virtual void GetLine3Color(double rgb[3]);
153
155
158 virtual void SetLine4Color(double r, double g, double b);
159 virtual void SetLine4Color(double rgb[3])
160 { this->SetLine4Color(rgb[0], rgb[1], rgb[2]); }
161 virtual double *GetLine4Color();
162 virtual void GetLine4Color(double rgb[3]);
164
166
170 virtual void SetVolumeMapper(vtkVolumeMapper *mapper);
171 vtkGetObjectMacro(VolumeMapper, vtkVolumeMapper);
174
176
187
192 {
193 CroppingPlanesPositionChangedEvent = 10050
194 };
195
196protected:
197
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
219
220 // Handles the events
221
222 static void ProcessEvents(vtkObject* object,
223 unsigned long event,
224 void* clientdata,
225 void* calldata);
226
227 void SetMouseCursor(int state);
228
230 {
231 NoLine = 0,
239 MovingH2
240 };
241
242 int ComputeWorldCoordinate(int x, int y, double* coord);
243
246 void ConstrainPlanePositions(double positions[6]);
247
248private:
250 void operator=(const vtkImageCroppingRegionsWidget&) VTK_DELETE_FUNCTION;
251};
252
253#endif
an abstract superclass for 3D widgets
Definition: vtk3DWidget.h:68
virtual void PlaceWidget()
a actor that draws 2D data
Definition: vtkActor2D.h:46
void ConstrainPlanePositions(double positions[6])
virtual void SetSlice(int num)
Set/Get the slice number.
virtual void SetPlanePositions(float pos[6])
virtual void SetCroppingRegionFlags(int flags)
Set/Get the cropping region flags.
virtual void SetPlanePositions(double pos[6])
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
virtual void SetSliceOrientation(int orientation)
virtual void SetEnabled(int enabling)
Enable/disable the widget.
WidgetEventIds
Events invoked by this widget.
virtual double * GetLine4Color()
virtual void GetLine4Color(double rgb[3])
virtual void SetPlanePositions(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax)
virtual double * GetLine2Color()
virtual void UpdateAccordingToInput()
virtual void GetLine2Color(double rgb[3])
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
virtual void SetLine4Color(double rgb[3])
virtual void SetLine4Color(double r, double g, double b)
Set/Get line 4 color.
virtual void SetLine2Color(double rgb[3])
virtual double * GetLine1Color()
void SetMouseCursor(int state)
int ComputeWorldCoordinate(int x, int y, double *coord)
virtual void PlaceWidget(double bounds[6])
This method is used to initially place the widget.
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])
virtual void GetLine3Color(double rgb[3])
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()
virtual void SetLine3Color(double rgb[3])
virtual void GetLine1Color(double rgb[3])
topologically and geometrically regular array of data
Definition: vtkImageData.h:46
a simple class to control print indentation
Definition: vtkIndent.h:40
create a line defined by two end points
Definition: vtkLineSource.h:43
abstract base class for most VTK objects
Definition: vtkObject.h:60
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:86
Abstract class for a volume mapper.
@ orientation
Definition: vtkX3D.h:262