Slicer 5.4
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
vtkSlicerPlaneRepresentation2D.h
Go to the documentation of this file.
1/*==============================================================================
2
3 Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
4 Queen's University, Kingston, ON, Canada. All Rights Reserved.
5
6 See COPYRIGHT.txt
7 or http://www.slicer.org/copyright/copyright.txt for details.
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14
15 This file was originally developed by Kyle Sunderland, PerkLab, Queen's University
16 and was supported through CANARIE's Research Software Program, Cancer
17 Care Ontario, OpenAnatomy, and Brigham and Women's Hospital through NIH grant R01MH112748.
18
19==============================================================================*/
20
32#ifndef vtkSlicerPlaneRepresentation2D_h
33#define vtkSlicerPlaneRepresentation2D_h
34
35#include "vtkSlicerMarkupsModuleVTKWidgetsExport.h"
38#include "vtkGlyphSource2D.h"
39
40class vtkAppendPolyData;
41class vtkClipPolyData;
42class vtkDiscretizableColorTransferFunction;
43class vtkFeatureEdges;
44class vtkGeometryFilter;
46class vtkPlaneCutter;
47class vtkPlaneSource;
48class vtkSampleImplicitFunctionFilter;
49
50class VTK_SLICER_MARKUPS_MODULE_VTKWIDGETS_EXPORT vtkSlicerPlaneRepresentation2D : public vtkSlicerMarkupsWidgetRepresentation2D
51{
52public:
55
58 void PrintSelf(ostream& os, vtkIndent indent) 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,
77 int &foundComponentType, int &foundComponentIndex, double &closestDistance2) override;
78
79 void CanInteractWithPlane(vtkMRMLInteractionEventData* interactionEventData,
80 int& foundComponentType, int& foundComponentIndex, double& closestDistance2);
81
82 bool GetTransformationReferencePoint(double referencePointWorld[3]) override;
83
84 void BuildPlane();
85
86 // Initialize interaction handle pipeline
87 void SetupInteractionPipeline() override;
88
89 // Update visibility of interaction handles for representation
90 void UpdateInteractionPipeline() override;
91
92protected:
95
96 virtual void UpdatePlaneFillColorMap(vtkDiscretizableColorTransferFunction* colormap, double color[3]);
97 virtual void UpdatePlaneOutlineColorMap(vtkDiscretizableColorTransferFunction* colormap, double color[3]);
98
99 vtkNew<vtkPlaneSource> PlaneFilter;
100 vtkNew<vtkPlaneCutter> PlaneCutter;
101
102 vtkNew<vtkClipPolyData> PlaneClipperSlicePlane;
103 vtkNew<vtkClipPolyData> PlaneClipperStartFadeNear;
104 vtkNew<vtkClipPolyData> PlaneClipperEndFadeNear;
105 vtkNew<vtkClipPolyData> PlaneClipperStartFadeFar;
106 vtkNew<vtkClipPolyData> PlaneClipperEndFadeFar;
107
108 vtkNew<vtkGeometryFilter> PlaneGeometryFilter;
109 vtkNew<vtkAppendPolyData> PlaneAppend;
110 vtkNew<vtkTransformPolyDataFilter> PlaneWorldToSliceTransformer;
111 vtkNew<vtkPolyDataMapper2D> PlaneFillMapper;
112 vtkNew<vtkActor2D> PlaneFillActor;
113
114 vtkNew<vtkFeatureEdges> PlaneOutlineFilter;
115 vtkNew<vtkDiscretizableColorTransferFunction> PlaneOutlineColorMap;
116 vtkNew<vtkTransformPolyDataFilter> PlaneOutlineWorldToSliceTransformer;
117 vtkNew<vtkPolyDataMapper2D> PlaneOutlineMapper;
118 vtkNew<vtkActor2D> PlaneOutlineActor;
119
120 vtkNew<vtkAppendPolyData> PlanePickingAppend;
121
122 vtkNew<vtkGlyphSource2D> ArrowFilter;
123 vtkNew<vtkGlyph2D> ArrowGlypher;
124 vtkNew<vtkPolyDataMapper2D> ArrowMapper;
125 vtkNew<vtkActor2D> ArrowActor;
126
127 vtkNew<vtkDiscretizableColorTransferFunction> PlaneFillColorMap;
128 vtkNew<vtkSampleImplicitFunctionFilter> PlaneSliceDistance;
129 std::string LabelFormat;
130
131 class MarkupsInteractionPipelinePlane2D : public vtkSlicerPlaneRepresentation3D::MarkupsInteractionPipelinePlane
132 {
133 public:
136
137 void GetViewPlaneNormal(double viewPlaneNormal[3]) override;
138
139 vtkSmartPointer<vtkTransformPolyDataFilter> WorldToSliceTransformFilter;
140 };
141
142
143private:
145 void operator=(const vtkSlicerPlaneRepresentation2D&) = delete;
146};
147
148#endif
Abstract Superclass for all specific types of MRML nodes.
Default representation for the slicer markups widget.
MarkupsInteractionPipelinePlane2D(vtkSlicerMarkupsWidgetRepresentation *representation)
void GetViewPlaneNormal(double viewPlaneNormal[3]) override
Get the view plane normal for the widget in world coordinates.
Default representation for the plane widget.
static vtkSlicerPlaneRepresentation2D * New()
Instantiate this class.
double * GetBounds() VTK_SIZEHINT(6) override
Return the bounds of the representation.
void UpdateFromMRMLInternal(vtkMRMLNode *caller, unsigned long event, void *callData=nullptr) override
void GetActors(vtkPropCollection *) override
Methods to make this class behave as a vtkProp.
void ReleaseGraphicsResources(vtkWindow *) override
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
int RenderOverlay(vtkViewport *viewport) override
int RenderOpaqueGeometry(vtkViewport *viewport) override
void PrintSelf(ostream &os, vtkIndent indent) override
vtkTypeBool HasTranslucentPolygonalGeometry() override
Default representation for the plane widget.