Slicer  5.0
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 https://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) override;
74 
77  vtkGetObjectMacro(IntersectionPlane,vtkPlane);
78 
80  vtkGetObjectMacro(IntersectionPlaneTransform,vtkTransform);
81 
82  void GetActors2D(vtkPropCollection *actors) override;
83 
84  void GetIntersectionActors(vtkPropCollection *actors);
85 
86  int ComputeInteractionState(int X, int Y, int modify=0) override;
87  void StartWidgetInteraction(double e[2]) override;
88  void WidgetInteraction(double e[2]) override;
89  void SetInteractionState(int state) override;
90 
93  void ReleaseGraphicsResources(vtkWindow*) override;
94  int RenderOpaqueGeometry(vtkViewport*) override;
95  int RenderTranslucentPolygonalGeometry(vtkViewport*) override;
96  int RenderOverlay(vtkViewport *viewport) override;
97 
98  int HasTranslucentPolygonalGeometry() override;
99 
100  void SizeHandles() override;
101 
102  vtkGetMacro(SliceIntersectionVisibility, int);
103  vtkSetMacro(SliceIntersectionVisibility, int);
104 
105  vtkGetMacro(HandlesVisibility, int);
106  vtkSetMacro(HandlesVisibility, int);
107 
108  int HighlightHandle(vtkProp *prop) override;
109  void HighlightFace(int cellId) 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;
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  void CreateDefaultProperties() override;
157  void PositionHandles() override;
158 
160 
161  double HandleSize;
163 
164 private:
166  void operator=(const vtkAnnotationROIRepresentation2D&) = delete;
167 };
168 
169 #endif
virtual void CreateDefaultProperties()
int HasTranslucentPolygonalGeometry() override
vtkActor2D ** Handle2D
glyphs representing hot spots (e.g., handles)
virtual void SetInteractionState(int state)
virtual void HighlightFace(int cellId)
void ReleaseGraphicsResources(vtkWindow *) override
Methods supporting, and required by, the rendering process.
void StartWidgetInteraction(double e[2]) override
void WidgetInteraction(double e[2]) override
virtual int HighlightHandle(vtkProp *prop)
static vtkAnnotationROIRepresentation * New()
Instantiate the class.
vtkTransformPolyDataFilter ** HandleToPlaneTransformFilters
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
void PrintSelf(ostream &os, vtkIndent indent) override
int ComputeInteractionState(int X, int Y, int modify=0) override
vtkPlane * IntersectionPlane
Plane/Face intersection pipelines.
int RenderOpaqueGeometry(vtkViewport *) override