Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkAnnotationROIRepresentation2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: $RCSfile: vtkAnnotationROIRepresentation2D.h,v $
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 =========================================================================*/
21 //
24 //
29 
32 
33 
34 #ifndef __vtkAnnotationROIRepresentation2D_h
35 #define __vtkAnnotationROIRepresentation2D_h
36 
37 // Annotations includes
39 
40 class vtkLineSource;
41 class vtkSphereSource;
42 class vtkPropPicker;
43 class vtkProperty2D;
44 class vtkPolyData;
45 class vtkPoints;
46 class vtkPolyDataAlgorithm;
47 class vtkPointHandleRepresentation2D;
48 class vtkTransform;
49 class vtkPlanes;
50 class vtkBox;
51 class vtkDoubleArray;
52 class vtkMatrix4x4;
53 
54 class vtkActor2D;
55 class vtkPolyDataMapper2D;
56 class vtkPlane;
57 class vtkTransform;
58 class vtkTransformPolyDataFilter;
59 
60 
61 class VTK_SLICER_ANNOTATIONS_MODULE_VTKWIDGETS_EXPORT
64 {
65 public:
69 
73  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
74 
77  vtkGetObjectMacro(IntersectionPlane,vtkPlane);
78 
80  vtkGetObjectMacro(IntersectionPlaneTransform,vtkTransform);
81 
82  virtual void GetActors2D(vtkPropCollection *actors) VTK_OVERRIDE;
83 
84  void GetIntersectionActors(vtkPropCollection *actors);
85 
86  virtual int ComputeInteractionState(int X, int Y, int modify=0) VTK_OVERRIDE;
87  virtual void StartWidgetInteraction(double e[2]) VTK_OVERRIDE;
88  virtual void WidgetInteraction(double e[2]) VTK_OVERRIDE;
89  virtual void SetInteractionState(int state) VTK_OVERRIDE;
90 
93  virtual void ReleaseGraphicsResources(vtkWindow*) VTK_OVERRIDE;
94  virtual int RenderOpaqueGeometry(vtkViewport*) VTK_OVERRIDE;
95  virtual int RenderTranslucentPolygonalGeometry(vtkViewport*) VTK_OVERRIDE;
96  virtual int RenderOverlay(vtkViewport *viewport) VTK_OVERRIDE;
97 
98  virtual int HasTranslucentPolygonalGeometry() VTK_OVERRIDE;
99 
100  virtual void SizeHandles() VTK_OVERRIDE;
101 
102  vtkGetMacro(SliceIntersectionVisibility, int);
103  vtkSetMacro(SliceIntersectionVisibility, int);
104 
105  vtkGetMacro(HandlesVisibility, int);
106  vtkSetMacro(HandlesVisibility, int);
107 
108  virtual int HighlightHandle(vtkProp *prop) VTK_OVERRIDE;
109  virtual void HighlightFace(int cellId) VTK_OVERRIDE;
110 
114  vtkSetClampMacro(HandleSize, double, 0.0001, 0.5);
115  vtkGetMacro(HandleSize, double);
116 
117  void PrintIntersections(ostream& os);
118 
119 protected:
122 
123  // Compute intersection line of the inputIntersectionFace and the slice plane
124  // It is 50x faster than computing the intersection using vtkCutter
125  virtual void ComputeIntersectionLine(vtkPolyData* inputIntersectionFace, vtkPlane* inputPlane, vtkPolyData* outputIntersectionFacesIntersection);
126 
128  vtkActor2D **Handle2D;
129  vtkPolyDataMapper2D **HandleMapper2D;
130  vtkTransformPolyDataFilter **HandleToPlaneTransformFilters;
131 
133  vtkPlane *IntersectionPlane;
134  vtkTransform *IntersectionPlaneTransform;
135  vtkPolyData *IntersectionLines[6]; // intersection lines of IntersectionFaces
136  vtkPolyData *IntersectionFaces[6];
137  vtkTransformPolyDataFilter *IntersectionPlaneTransformFilters[6];
138  vtkActor2D *IntersectionActors[6];
139  vtkPolyDataMapper2D *IntersectionMappers[6];
140 
141  vtkProperty2D *HandleProperties2D[NUMBER_HANDLES];
142  vtkProperty2D *SelectedHandleProperty2D;
143  vtkProperty2D *SelectedFaceProperty2D;
144  vtkProperty2D *DefaultFaceProperty2D;
145 
146  vtkPropPicker *HandlePicker2D;
147  vtkPropPicker *LastPicker2D;
148  vtkActor2D *CurrentHandle2D;
149 
150  double LastEventPosition2D[4];
151 
152  void CreateFaceIntersections();
153 
154  double ComputeHandleRadiusInWorldCoordinates(double radInPixels);
155 
156  virtual void CreateDefaultProperties() VTK_OVERRIDE;
157  virtual void PositionHandles() VTK_OVERRIDE;
158 
159  int SliceIntersectionVisibility;
160 
161  double HandleSize;
162  int HandlesVisibility;
163 
164 private:
166  void operator=(const vtkAnnotationROIRepresentation2D&); //Not implemented
167 };
168 
169 #endif
virtual int ComputeInteractionState(int X, int Y, int modify=0) VTK_OVERRIDE
static vtkAnnotationROIRepresentation * New()
Instantiate the class.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE