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 =========================================================================*/
35 #ifndef vtkImageCroppingRegionsWidget_h
36 #define vtkImageCroppingRegionsWidget_h
37 
38 #include "vtkInteractionWidgetsModule.h" // For export macro
39 #include "vtk3DWidget.h"
40 
41 class vtkActor2D;
42 class vtkImageData;
43 class vtkLineSource;
44 class vtkVolumeMapper;
45 class vtkPolyData;
46 
48 {
49 public:
50 
52 
55  void PrintSelf(ostream& os, vtkIndent indent);
57 
59 
61  virtual void PlaceWidget(double bounds[6]);
63 
65  virtual void SetEnabled(int enabling);
66 
68 
69  vtkGetVector6Macro(PlanePositions, double);
70  virtual void SetPlanePositions(double pos[6])
71  {this->SetPlanePositions(pos[0], pos[1], pos[2], pos[3], pos[4], pos[5]);}
72  virtual void SetPlanePositions(float pos[6])
73  {this->SetPlanePositions(pos[0], pos[1], pos[2], pos[3], pos[4], pos[5]);}
74  virtual void SetPlanePositions(double xMin, double xMax,
75  double yMin, double yMax,
76  double zMin, double zMax);
78 
80 
81  virtual void SetCroppingRegionFlags(int flags);
82  vtkGetMacro(CroppingRegionFlags, int);
84 
86 
87  enum
88  {
89  SLICE_ORIENTATION_YZ = 0,
90  SLICE_ORIENTATION_XZ = 1,
91  SLICE_ORIENTATION_XY = 2
92  };
93  //ETX
94  vtkGetMacro(SliceOrientation, int);
95  virtual void SetSliceOrientation(int orientation);
96  virtual void SetSliceOrientationToXY()
97  { this->SetSliceOrientation(vtkImageCroppingRegionsWidget::SLICE_ORIENTATION_XY); };
98  virtual void SetSliceOrientationToYZ()
99  { this->SetSliceOrientation(vtkImageCroppingRegionsWidget::SLICE_ORIENTATION_YZ); };
100  virtual void SetSliceOrientationToXZ()
101  { this->SetSliceOrientation(vtkImageCroppingRegionsWidget::SLICE_ORIENTATION_XZ); };
103 
105 
106  virtual void SetSlice(int num);
107  vtkGetMacro(Slice, int);
109 
111 
112  virtual void SetLine1Color(double r, double g, double b);
113  virtual void SetLine1Color(double rgb[3])
114  { this->SetLine1Color(rgb[0], rgb[1], rgb[2]); }
115  virtual double *GetLine1Color();
116  virtual void GetLine1Color(double rgb[3]);
118 
120 
121  virtual void SetLine2Color(double r, double g, double b);
122  virtual void SetLine2Color(double rgb[3])
123  { this->SetLine2Color(rgb[0], rgb[1], rgb[2]); }
124  virtual double *GetLine2Color();
125  virtual void GetLine2Color(double rgb[3]);
127 
129 
130  virtual void SetLine3Color(double r, double g, double b);
131  virtual void SetLine3Color(double rgb[3])
132  { this->SetLine3Color(rgb[0], rgb[1], rgb[2]); }
133  virtual double *GetLine3Color();
134  virtual void GetLine3Color(double rgb[3]);
136 
138 
139  virtual void SetLine4Color(double r, double g, double b);
140  virtual void SetLine4Color(double rgb[3])
141  { this->SetLine4Color(rgb[0], rgb[1], rgb[2]); }
142  virtual double *GetLine4Color();
143  virtual void GetLine4Color(double rgb[3]);
145 
147 
149  virtual void SetVolumeMapper(vtkVolumeMapper *mapper);
150  vtkGetObjectMacro(VolumeMapper, vtkVolumeMapper);
151  virtual void UpdateAccordingToInput();
153 
155 
156  void MoveHorizontalLine();
157  void MoveVerticalLine();
158  void MoveIntersectingLines();
159  void UpdateCursorIcon();
160  void OnButtonPress();
161  void OnButtonRelease();
162  void OnMouseMove();
164 
165  //BTX
167 
169  {
170  CroppingPlanesPositionChangedEvent = 10050
171  };
172  //ETX
174 
175 protected:
176 
179 
181 
182  vtkLineSource *LineSources[4];
183  vtkActor2D *LineActors[4];
184  vtkPolyData* RegionPolyData[9];
185  vtkActor2D* RegionActors[9];
186 
187  double PlanePositions[6];
188 
190  int Slice;
191 
192  double GetSlicePosition();
193 
195 
197  int Moving;
198 
199  // Handles the events
200 
201  static void ProcessEvents(vtkObject* object,
202  unsigned long event,
203  void* clientdata,
204  void* calldata);
205 
206  void SetMouseCursor(int state);
207 
208  //BTX
210  {
211  NoLine = 0,
219  MovingH2
220  };
221  //ETX
222 
223  int ComputeWorldCoordinate(int x, int y, double* coord);
224 
225  void UpdateOpacity();
226  void UpdateGeometry();
227  void ConstrainPlanePositions(double positions[6]);
228 
229 private:
231  void operator=(const vtkImageCroppingRegionsWidget&); //Not implemented
232 };
233 
234 #endif
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)
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:84
#define VTKINTERACTIONWIDGETS_EXPORT
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])
create a line defined by two end points
Definition: vtkLineSource.h:41
static vtkObject * New()
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])