Slicer 5.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkSlicerMarkupsWidgetRepresentation3D.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Copyright (c) ProxSim ltd., Kwun Tong, Hong Kong. All Rights Reserved.
4
5 See COPYRIGHT.txt
6 or http://www.slicer.org/copyright/copyright.txt for details.
7
8 Unless required by applicable law or agreed to in writing, software
9 distributed under the License is distributed on an "AS IS" BASIS,
10 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 See the License for the specific language governing permissions and
12 limitations under the License.
13
14 This file was originally developed by Davide Punzo, punzodavide@hotmail.it,
15 and development was supported by ProxSim ltd.
16
17=========================================================================*/
18
26
27#ifndef vtkSlicerMarkupsWidgetRepresentation3D_h
28#define vtkSlicerMarkupsWidgetRepresentation3D_h
29
30#include "vtkSlicerMarkupsModuleVTKWidgetsExport.h"
32
33#include <map>
34#include <memory>
35
36class vtkActor;
37class vtkActor2D;
38class vtkCellPicker;
39class vtkConeSource;
40class vtkDoubleArray;
42class vtkGlyph3DMapper;
43class vtkLabelPlacementMapper;
44class vtkPoints;
45class vtkPolyData;
46class vtkPolyDataMapper;
47class vtkProperty;
48
50
51class VTK_SLICER_MARKUPS_MODULE_VTKWIDGETS_EXPORT vtkSlicerMarkupsWidgetRepresentation3D : public vtkSlicerMarkupsWidgetRepresentation
52{
53public:
56 void PrintSelf(ostream& os, vtkIndent indent) override;
57
58 void SetRenderer(vtkRenderer* ren) override;
59
63 void UpdateFromMRMLInternal(vtkMRMLNode* caller, unsigned long event, void* callData = nullptr) override;
64
66 void GetActors(vtkPropCollection*) override;
67 void ReleaseGraphicsResources(vtkWindow*) override;
68 int RenderOverlay(vtkViewport* viewport) override;
69 int RenderOpaqueGeometry(vtkViewport* viewport) override;
70 int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
71 vtkTypeBool HasTranslucentPolygonalGeometry() override;
72
74 double* GetBounds() VTK_SIZEHINT(6) override;
75
76 void CanInteract(vtkMRMLInteractionEventData* interactionEventData, int& foundComponentType, int& foundComponentIndex, double& closestDistance2) override;
77
80 void CanInteractWithLine(vtkMRMLInteractionEventData* interactionEventData, int& foundComponentType, int& foundComponentIndex, double& closestDistance2);
81
82 bool AccuratePick(int x, int y, double pickPoint[3], double pickNormal[3] = nullptr);
83
88
93 vtkSetMacro(OccludedRelativeOffset, double);
94 vtkGetMacro(OccludedRelativeOffset, double);
95
96protected:
99
100 void UpdateViewScaleFactor() override;
101
102 void UpdateControlPointSize() override;
103
105 {
106 public:
109
111 vtkSmartPointer<vtkDoubleArray> GlyphOrientationArray;
112
113 vtkSmartPointer<vtkGlyph3DMapper> GlyphMapper;
114
115 // Properties used to control the appearance of selected objects and
116 // the manipulator in general.
117 vtkSmartPointer<vtkProperty> Property;
118 vtkSmartPointer<vtkProperty> OccludedProperty;
119 vtkSmartPointer<vtkTextProperty> OccludedTextProperty;
120
121 vtkSmartPointer<vtkPolyData> VisiblePointsPolyData;
122
123 vtkSmartPointer<vtkFastSelectVisiblePoints> SelectVisiblePoints;
124
125 vtkSmartPointer<vtkIdTypeArray> ControlPointIndices; // store original ID to determine which control point is actually visible
126 vtkSmartPointer<vtkPointSetToLabelHierarchy> OccludedPointSetToLabelHierarchyFilter;
127
128 vtkSmartPointer<vtkGlyph3DMapper> OccludedGlyphMapper;
129 vtkSmartPointer<vtkLabelPlacementMapper> LabelsMapper;
130 vtkSmartPointer<vtkLabelPlacementMapper> LabelsOccludedMapper;
131
132 vtkSmartPointer<vtkActor> Actor;
133 vtkSmartPointer<vtkActor> OccludedActor;
134 vtkSmartPointer<vtkActor2D> LabelsActor;
135 vtkSmartPointer<vtkActor2D> LabelsOccludedActor;
136 };
137
139
141
143
145
149 {
150 public:
153
154 vtkSmartPointer<vtkPoints> Points;
155 vtkSmartPointer<vtkDoubleArray> Normals;
156 vtkSmartPointer<vtkPolyData> PointsPoly;
157 vtkSmartPointer<vtkGlyph3DMapper> Mapper;
158 vtkSmartPointer<vtkActor> Actor;
159 };
160
162 std::unique_ptr<LineDirectionArrowPipeline3D> LineDirectionArrowPipeline;
163
168
175 void UpdateRelativeCoincidentTopologyOffsets(vtkMapper* mapper, vtkMapper* occludedMapper);
177
178 vtkSmartPointer<vtkCellPicker> AccuratePicker;
179
184
185 static std::map<vtkRenderer*, vtkSmartPointer<vtkFloatArray>> CachedZBuffers;
186
187 vtkSmartPointer<vtkCallbackCommand> RenderCompletedCallback;
188 static void OnRenderCompleted(vtkObject* caller, unsigned long event, void* clientData, void* callData);
189 static vtkFloatArray* GetCachedZBuffer(vtkRenderer* renderer);
190
191private:
193 void operator=(const vtkSlicerMarkupsWidgetRepresentation3D&) = delete;
194};
195
196#endif
extract points that are visible (based on z-buffer calculation)
virtual void UpdateRelativeCoincidentTopologyOffsets(vtkMapper *mapper)
Abstract Superclass for all specific types of MRML nodes.
vtkSmartPointer< vtkDoubleArray > GlyphOrientationArray
Orientation of the glyphs, represented as an array of quaternions.
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
double LineDirectionMarkerLastSpacing
Cached marker spacing/geometry MTime/reversed flag for BuildLineDirectionMarkers guard.
static std::map< vtkRenderer *, vtkSmartPointer< vtkFloatArray > > CachedZBuffers
void CanInteract(vtkMRMLInteractionEventData *interactionEventData, int &foundComponentType, int &foundComponentIndex, double &closestDistance2) override
void UpdateRelativeCoincidentTopologyOffsets(vtkMapper *mapper, vtkMapper *occludedMapper)
bool AccuratePick(int x, int y, double pickPoint[3], double pickNormal[3]=nullptr)
std::unique_ptr< LineDirectionArrowPipeline3D > LineDirectionArrowPipeline
Direction arrow glyph pipeline (3D).
void UpdateFromMRMLInternal(vtkMRMLNode *caller, unsigned long event, void *callData=nullptr) override
void ReleaseGraphicsResources(vtkWindow *) override
virtual void UpdateNthPointAndLabelFromMRML(int n)
int RenderOpaqueGeometry(vtkViewport *viewport) override
vtkSmartPointer< vtkCallbackCommand > RenderCompletedCallback
void GetActors(vtkPropCollection *) override
Methods to make this class behave as a vtkProp.
static void OnRenderCompleted(vtkObject *caller, unsigned long event, void *clientData, void *callData)
static vtkFloatArray * GetCachedZBuffer(vtkRenderer *renderer)
void CanInteractWithLine(vtkMRMLInteractionEventData *interactionEventData, int &foundComponentType, int &foundComponentIndex, double &closestDistance2)
ControlPointsPipeline3D * GetControlPointsPipeline(int controlPointType)
int RenderOverlay(vtkViewport *viewport) override
double * GetBounds() VTK_SIZEHINT(6) override
Return the bounds of the representation.
vtkTypeBool HasTranslucentPolygonalGeometry() override
void SetRenderer(vtkRenderer *ren) override
void PrintSelf(ostream &os, vtkIndent indent) override