Slicer  4.11
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"
37 #include "vtkGlyphSource2D.h"
38 
39 class vtkAppendPolyData;
40 class vtkClipPolyData;
41 class vtkCompositeDataGeometryFilter;
42 class vtkDiscretizableColorTransferFunction;
43 class vtkFeatureEdges;
45 class vtkPlaneCutter;
46 class vtkPlaneSource;
47 class vtkSampleImplicitFunctionFilter;
48 
49 class VTK_SLICER_MARKUPS_MODULE_VTKWIDGETS_EXPORT vtkSlicerPlaneRepresentation2D : public vtkSlicerMarkupsWidgetRepresentation2D
50 {
51 public:
53  static vtkSlicerPlaneRepresentation2D *New();
54 
57  void PrintSelf(ostream& os, vtkIndent indent) override;
58 
62  void UpdateFromMRML(vtkMRMLNode* caller, unsigned long event, void *callData = nullptr) override;
63 
65  void GetActors(vtkPropCollection *) override;
66  void ReleaseGraphicsResources(vtkWindow *) override;
67  int RenderOverlay(vtkViewport *viewport) override;
68  int RenderOpaqueGeometry(vtkViewport *viewport) override;
69  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override;
70  vtkTypeBool HasTranslucentPolygonalGeometry() override;
71 
73  double *GetBounds() override;
74 
75  void CanInteract(vtkMRMLInteractionEventData* interactionEventData,
76  int &foundComponentType, int &foundComponentIndex, double &closestDistance2) override;
77 
78  void CanInteractWithPlane(vtkMRMLInteractionEventData* interactionEventData,
79  int& foundComponentType, int& foundComponentIndex, double& closestDistance2);
80 
81  bool GetTransformationReferencePoint(double referencePointWorld[3]) override;
82 
83  void BuildPlane();
84 
85  // Update visibility of interaction handles for representation
86  void UpdateInteractionPipeline() override;
87 
88 protected:
91 
92  virtual void UpdatePlaneFillColorMap(vtkDiscretizableColorTransferFunction* colormap, double color[3]);
93  virtual void UpdatePlaneOutlineColorMap(vtkDiscretizableColorTransferFunction* colormap, double color[3]);
94 
95  vtkNew<vtkPlaneSource> PlaneFilter;
96  vtkNew<vtkPlaneCutter> PlaneCutter;
97 
98  vtkNew<vtkClipPolyData> PlaneClipperSlicePlane;
99  vtkNew<vtkClipPolyData> PlaneClipperStartFadeNear;
100  vtkNew<vtkClipPolyData> PlaneClipperEndFadeNear;
101  vtkNew<vtkClipPolyData> PlaneClipperStartFadeFar;
102  vtkNew<vtkClipPolyData> PlaneClipperEndFadeFar;
103 
104  vtkNew<vtkCompositeDataGeometryFilter> PlaneCompositeFilter;
105  vtkNew<vtkAppendPolyData> PlaneAppend;
106  vtkNew<vtkTransformPolyDataFilter> PlaneWorldToSliceTransformer;
107  vtkNew<vtkPolyDataMapper2D> PlaneFillMapper;
108  vtkNew<vtkActor2D> PlaneFillActor;
109 
110  vtkNew<vtkFeatureEdges> PlaneOutlineFilter;
111  vtkNew<vtkDiscretizableColorTransferFunction> PlaneOutlineColorMap;
112  vtkNew<vtkTransformPolyDataFilter> PlaneOutlineWorldToSliceTransformer;
113  vtkNew<vtkPolyDataMapper2D> PlaneOutlineMapper;
114  vtkNew<vtkActor2D> PlaneOutlineActor;
115 
116  vtkNew<vtkGlyphSource2D> ArrowFilter;
117  vtkNew<vtkGlyph2D> ArrowGlypher;
118  vtkNew<vtkPolyDataMapper2D> ArrowMapper;
119  vtkNew<vtkActor2D> ArrowActor;
120 
121  vtkNew<vtkDiscretizableColorTransferFunction> PlaneFillColorMap;
122  vtkNew<vtkSampleImplicitFunctionFilter> PlaneSliceDistance;
123  std::string LabelFormat;
124 
125 private:
127  void operator=(const vtkSlicerPlaneRepresentation2D&) = delete;
128 };
129 
130 #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 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< 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.