VTK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 =========================================================================*/
32 #ifndef __vtkImageCroppingRegionsWidget_h
33 #define __vtkImageCroppingRegionsWidget_h
34 
35 #include "vtkInteractionWidgetsModule.h" // For export macro
36 #include "vtk3DWidget.h"
37 
38 class vtkActor2D;
39 class vtkImageData;
40 class vtkLineSource;
41 class vtkVolumeMapper;
42 class vtkPolyData;
43 
45 {
46 public:
47 
49 
52  void PrintSelf(ostream& os, vtkIndent indent);
54 
56 
58  virtual void PlaceWidget(double bounds[6]);
60 
62  virtual void SetEnabled(int enabling);
63 
65 
66  vtkGetVector6Macro(PlanePositions, double);
67  virtual void SetPlanePositions(double pos[6])
68  {this->SetPlanePositions(pos[0], pos[1], pos[2], pos[3], pos[4], pos[5]);}
69  virtual void SetPlanePositions(float pos[6])
70  {this->SetPlanePositions(pos[0], pos[1], pos[2], pos[3], pos[4], pos[5]);}
71  virtual void SetPlanePositions(double xMin, double xMax,
72  double yMin, double yMax,
73  double zMin, double zMax);
75 
77 
78  virtual void SetCroppingRegionFlags(int flags);
79  vtkGetMacro(CroppingRegionFlags, int);
81 
83 
84  enum
85  {
86  SLICE_ORIENTATION_YZ = 0,
87  SLICE_ORIENTATION_XZ = 1,
88  SLICE_ORIENTATION_XY = 2
89  };
90  //ETX
91  vtkGetMacro(SliceOrientation, int);
92  virtual void SetSliceOrientation(int orientation);
93  virtual void SetSliceOrientationToXY()
94  { this->SetSliceOrientation(vtkImageCroppingRegionsWidget::SLICE_ORIENTATION_XY); };
95  virtual void SetSliceOrientationToYZ()
96  { this->SetSliceOrientation(vtkImageCroppingRegionsWidget::SLICE_ORIENTATION_YZ); };
97  virtual void SetSliceOrientationToXZ()
98  { this->SetSliceOrientation(vtkImageCroppingRegionsWidget::SLICE_ORIENTATION_XZ); };
100 
102 
103  virtual void SetSlice(int num);
104  vtkGetMacro(Slice, int);
106 
108 
109  virtual void SetLine1Color(double r, double g, double b);
110  virtual void SetLine1Color(double rgb[3])
111  { this->SetLine1Color(rgb[0], rgb[1], rgb[2]); }
112  virtual double *GetLine1Color();
113  virtual void GetLine1Color(double rgb[3]);
115 
117 
118  virtual void SetLine2Color(double r, double g, double b);
119  virtual void SetLine2Color(double rgb[3])
120  { this->SetLine2Color(rgb[0], rgb[1], rgb[2]); }
121  virtual double *GetLine2Color();
122  virtual void GetLine2Color(double rgb[3]);
124 
126 
127  virtual void SetLine3Color(double r, double g, double b);
128  virtual void SetLine3Color(double rgb[3])
129  { this->SetLine3Color(rgb[0], rgb[1], rgb[2]); }
130  virtual double *GetLine3Color();
131  virtual void GetLine3Color(double rgb[3]);
133 
135 
136  virtual void SetLine4Color(double r, double g, double b);
137  virtual void SetLine4Color(double rgb[3])
138  { this->SetLine4Color(rgb[0], rgb[1], rgb[2]); }
139  virtual double *GetLine4Color();
140  virtual void GetLine4Color(double rgb[3]);
142 
144 
146  virtual void SetVolumeMapper(vtkVolumeMapper *mapper);
147  vtkGetObjectMacro(VolumeMapper, vtkVolumeMapper);
148  virtual void UpdateAccordingToInput();
150 
152 
153  void MoveHorizontalLine();
154  void MoveVerticalLine();
155  void MoveIntersectingLines();
156  void UpdateCursorIcon();
157  void OnButtonPress();
158  void OnButtonRelease();
159  void OnMouseMove();
161 
162  //BTX
164 
166  {
167  CroppingPlanesPositionChangedEvent = 10050
168  };
169  //ETX
171 
172 protected:
173 
176 
178 
179  vtkLineSource *LineSources[4];
180  vtkActor2D *LineActors[4];
181  vtkPolyData* RegionPolyData[9];
182  vtkActor2D* RegionActors[9];
183 
184  double PlanePositions[6];
185 
187  int Slice;
188 
189  double GetSlicePosition();
190 
192 
194  int Moving;
195 
196  // Handles the events
197 
198  static void ProcessEvents(vtkObject* object,
199  unsigned long event,
200  void* clientdata,
201  void* calldata);
202 
203  void SetMouseCursor(int state);
204 
205  //BTX
207  {
208  NoLine = 0,
216  MovingH2
217  };
218  //ETX
219 
220  int ComputeWorldCoordinate(int x, int y, double* coord);
221 
222  void UpdateOpacity();
223  void UpdateGeometry();
224  void ConstrainPlanePositions(double positions[6]);
225 
226 private:
228  void operator=(const vtkImageCroppingRegionsWidget&); //Not implemented
229 };
230 
231 #endif
GLboolean GLboolean GLboolean b
Definition: vtkgl.h:12312
Abstract class for a volume mapper.
abstract base class for most VTK objects
Definition: vtkObject.h:61
virtual void SetLine2Color(double rgb[3])
static void ProcessEvents(vtkObject *object, unsigned long event, void *clientdata, void *calldata)
#define vtkGetMacro(name, type)
Definition: vtkSetGet.h:83
a actor that draws 2D data
Definition: vtkActor2D.h:44
virtual void SetEnabled(int)
virtual void SetLine4Color(double rgb[3])
virtual void SetPlanePositions(double pos[6])
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
GLdouble GLdouble GLdouble r
Definition: vtkgl.h:11610
GLint GLint GLint GLint GLint GLint y
Definition: vtkgl.h:11318
#define vtkTypeMacro(thisClass, superclass)
Definition: vtkSetGet.h:619
GLuint GLuint num
Definition: vtkgl.h:16907
GLint GLint GLint GLint GLint x
Definition: vtkgl.h:11318
#define VTKINTERACTIONWIDGETS_EXPORT
GLuint coord
Definition: vtkgl.h:16713
struct _cl_event * event
Definition: vtkgl.h:14387
a simple class to control print indentation
Definition: vtkIndent.h:38
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
virtual void SetLine1Color(double rgb[3])
GLbitfield flags
Definition: vtkgl.h:13750
#define vtkGetObjectMacro(name, type)
Definition: vtkSetGet.h:222
create a line defined by two end points
Definition: vtkLineSource.h:41
GLboolean GLboolean g
Definition: vtkgl.h:12312
static vtkObject * New()
#define vtkGetVector6Macro(name, type)
Definition: vtkSetGet.h:370
void PrintSelf(ostream &os, vtkIndent indent)
an abstract superclass for 3D widgets
Definition: vtk3DWidget.h:69
virtual void PlaceWidget()
virtual void SetLine3Color(double rgb[3])
virtual void SetPlanePositions(float pos[6])