Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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 
40 class vtkAppendPolyData;
41 class vtkClipPolyData;
42 class vtkCompositeDataGeometryFilter;
43 class vtkDiscretizableColorTransferFunction;
44 class vtkFeatureEdges;
46 class vtkPlaneCutter;
47 class vtkPlaneSource;
48 class vtkSampleImplicitFunctionFilter;
49 
50 class VTK_SLICER_MARKUPS_MODULE_VTKWIDGETS_EXPORT vtkSlicerPlaneRepresentation2D : public vtkSlicerMarkupsWidgetRepresentation2D
51 {
52 public:
54  static vtkSlicerPlaneRepresentation2D *New();
55 
58  void PrintSelf(ostream& os, vtkIndent indent) override;
59 
63  void UpdateFromMRML(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() 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 
92 protected:
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<vtkCompositeDataGeometryFilter> PlaneCompositeFilter;
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 
132  {
133  public:
135  ~MarkupsInteractionPipelinePlane2D() override = default;;
136 
137  void GetViewPlaneNormal(double viewPlaneNormal[3]) override;
138 
139  vtkSmartPointer<vtkTransformPolyDataFilter> WorldToSliceTransformFilter;
140  };
141 
142 
143 private:
145  void operator=(const vtkSlicerPlaneRepresentation2D&) = delete;
146 };
147 
148 #endif
vtkNew< vtkClipPolyData > PlaneClipperStartFadeNear
vtkNew< vtkClipPolyData > PlaneClipperEndFadeNear
vtkNew< vtkPolyDataMapper2D > ArrowMapper
vtkNew< vtkDiscretizableColorTransferFunction > PlaneFillColorMap
vtkTypeBool HasTranslucentPolygonalGeometry() override
vtkNew< vtkSampleImplicitFunctionFilter > PlaneSliceDistance
vtkNew< vtkClipPolyData > PlaneClipperStartFadeFar
vtkNew< vtkPolyDataMapper2D > PlaneOutlineMapper
void UpdateInteractionPipeline() override
Update the interaction pipeline.
void SetupInteractionPipeline() override
Reimplemented for 2D specific mapper/actor settings.
void UpdateFromMRML(vtkMRMLNode *caller, unsigned long event, void *callData=nullptr) override
vtkNew< vtkDiscretizableColorTransferFunction > PlaneOutlineColorMap
int RenderOpaqueGeometry(vtkViewport *viewport) override
void PrintSelf(ostream &os, vtkIndent indent) override
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
Default representation for the plane widget.
vtkNew< vtkTransformPolyDataFilter > PlaneOutlineWorldToSliceTransformer
vtkNew< vtkCompositeDataGeometryFilter > PlaneCompositeFilter
int RenderOverlay(vtkViewport *viewport) override
Default representation for the slicer markups widget.
vtkNew< vtkClipPolyData > PlaneClipperEndFadeFar
vtkNew< vtkAppendPolyData > PlanePickingAppend
vtkNew< vtkTransformPolyDataFilter > PlaneWorldToSliceTransformer
vtkNew< vtkPolyDataMapper2D > PlaneFillMapper
virtual bool GetTransformationReferencePoint(double referencePointWorld[3])
Translation, rotation, scaling will happen around this position.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
void ReleaseGraphicsResources(vtkWindow *) override
vtkNew< vtkClipPolyData > PlaneClipperSlicePlane
void CanInteract(vtkMRMLInteractionEventData *interactionEventData, int &foundComponentType, int &foundComponentIndex, double &closestDistance2) override
Position is displayed (slice) position.
void GetActors(vtkPropCollection *) override
Methods to make this class behave as a vtkProp.