Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 
111  vtkSetMacro(HandleSizeInPixels,int);
112  vtkGetMacro(HandleSizeInPixels,int);
113 
114 
115  void PrintIntersections(ostream& os);
116 
117 protected:
119  ~vtkAnnotationROIRepresentation2D();
120 
121  // Compute intersection line of the inputIntersectionFace and the slice plane
122  // It is 50x faster than computing the intersection using vtkCutter
123  virtual void ComputeIntersectionLine(vtkPolyData* inputIntersectionFace, vtkPlane* inputPlane, vtkPolyData* outputIntersectionFacesIntersection);
124 
126  vtkActor2D **Handle2D;
127  vtkPolyDataMapper2D **HandleMapper2D;
128  vtkTransformPolyDataFilter **HandleToPlaneTransformFilters;
129 
131  vtkPlane *IntersectionPlane;
132  vtkTransform *IntersectionPlaneTransform;
133  vtkPolyData *IntersectionLines[6]; // intersection lines of IntersectionFaces
134  vtkPolyData *IntersectionFaces[6];
135  vtkTransformPolyDataFilter *IntersectionPlaneTransformFilters[6];
136  vtkActor2D *IntersectionActors[6];
137  vtkPolyDataMapper2D *IntersectionMappers[6];
138 
139  vtkProperty2D *HandleProperties2D[NUMBER_HANDLES];
140  vtkProperty2D *SelectedHandleProperty2D;
141  vtkProperty2D *SelectedFaceProperty2D;
142  vtkProperty2D *DefaultFaceProperty2D;
143 
144  vtkPropPicker *HandlePicker2D;
145  vtkPropPicker *LastPicker2D;
146  vtkActor2D *CurrentHandle2D;
147 
148  double LastEventPosition2D[4];
149 
150  void CreateFaceIntersections();
151 
152  double ComputeHandleRadiusInWorldCoordinates(double radInPixels);
153 
154  virtual void CreateDefaultProperties() VTK_OVERRIDE;
155  virtual void PositionHandles() VTK_OVERRIDE;
156 
157  int SliceIntersectionVisibility;
158 
159  double HandleSizeInPixels;
160  int HandlesVisibility;
161 
162 private:
163  vtkAnnotationROIRepresentation2D(const vtkAnnotationROIRepresentation2D&); //Not implemented
164  void operator=(const vtkAnnotationROIRepresentation2D&); //Not implemented
165 };
166 
167 #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