Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkSlicerROIRepresentation3D.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 vtkSlicerROIRepresentation3D_h
33 #define vtkSlicerROIRepresentation3D_h
34 
35 #include "vtkSlicerMarkupsModuleVTKWidgetsExport.h"
37 
38 class vtkActor;
39 class vtkArrayCalculator;
40 class vtkAppendPolyData;
41 class vtkArrowSource;
42 class vtkGlyph3DMapper;
43 class vtkLookupTable;
46 class vtkOutlineFilter;
47 class vtkPassThrough;
48 class vtkPlaneSource;
49 class vtkPolyDataAlgorithm;
50 class vtkPolyDataMapper;
51 class vtkPolyData;
52 class vtkTransformPolyDataFilter;
53 class vtkTubeFilter;
54 
55 class VTK_SLICER_MARKUPS_MODULE_VTKWIDGETS_EXPORT vtkSlicerROIRepresentation3D : public vtkSlicerMarkupsWidgetRepresentation3D
56 {
57 public:
59  static vtkSlicerROIRepresentation3D *New();
60 
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
68  void UpdateFromMRML(vtkMRMLNode* caller, unsigned long event, void *callData=nullptr) override;
69 
71  virtual void UpdateCubeSourceFromMRML(vtkMRMLMarkupsROINode* roiNode);
72 
74  void GetActors(vtkPropCollection *) override;
75  void ReleaseGraphicsResources(vtkWindow *) override;
76  int RenderOverlay(vtkViewport *viewport) override;
77  int RenderOpaqueGeometry(vtkViewport *viewport) override;
78  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override;
79  vtkTypeBool HasTranslucentPolygonalGeometry() override;
80 
82  double *GetBounds() override;
83 
84  void CanInteract(vtkMRMLInteractionEventData* interactionEventData,
85  int& foundComponentType, int& foundComponentIndex, double& closestDistance2) override;
86 
87  void CanInteractWithROI(vtkMRMLInteractionEventData* interactionEventData,
88  int& foundComponentType, int& foundComponentIndex, double& closestDistance2);
89 
90 protected:
92  ~vtkSlicerROIRepresentation3D() override;
93 
94  // Initialize interaction handle pipeline
95  void SetupInteractionPipeline() override;
96 
97  // Update visibility of interaction handles for representation
98  void UpdateInteractionPipeline() override;
99 
100  void SetROISource(vtkPolyDataAlgorithm* roiSource);
101 
102  vtkSmartPointer<vtkPolyDataAlgorithm> ROISource;
103 
104  vtkSmartPointer<vtkPassThrough> ROIPipelineInputFilter;
105 
106  vtkSmartPointer<vtkTransformPolyDataFilter> ROITransformFilter;
107  vtkSmartPointer<vtkTransform> ROIToWorldTransform;
108 
109  vtkSmartPointer<vtkPolyDataMapper> ROIMapper;
110  vtkSmartPointer<vtkProperty> ROIProperty;
111  vtkSmartPointer<vtkActor> ROIActor;
112 
113  vtkSmartPointer<vtkPolyDataMapper> ROIOccludedMapper;
114  vtkSmartPointer<vtkProperty> ROIOccludedProperty;
115  vtkSmartPointer<vtkActor> ROIOccludedActor;
116 
117  vtkSmartPointer<vtkOutlineFilter> ROIOutlineFilter;
118 
119  vtkSmartPointer<vtkTransformPolyDataFilter> ROIOutlineTransformFilter;
120 
121  vtkSmartPointer<vtkPolyDataMapper> ROIOutlineMapper;
122  vtkSmartPointer<vtkProperty> ROIOutlineProperty;
123  vtkSmartPointer<vtkActor> ROIOutlineActor;
124 
125  vtkSmartPointer<vtkPolyDataMapper> ROIOutlineOccludedMapper;
126  vtkSmartPointer<vtkProperty> ROIOutlineOccludedProperty;
127  vtkSmartPointer<vtkActor> ROIOutlineOccludedActor;
128 
129  class VTK_SLICER_MARKUPS_MODULE_VTKWIDGETS_EXPORT MarkupsInteractionPipelineROI : public MarkupsInteractionPipeline
130  {
131  public:
133  ~MarkupsInteractionPipelineROI() override = default;
134 
135  // Initialize scale handles
136  void CreateScaleHandles() override;
137 
138  // Update scale handle positions
139  virtual void UpdateScaleHandles();
140 
141  // Update scale handle visibilities
142  void UpdateHandleVisibility() override;
143 
144  // Get handle opacity
145  double GetHandleOpacity(int type, int index) override;
146 
147 
148  void GetHandleColor(int type, int index, double color[4]) override;
149  HandleInfoList GetHandleInfoList() override;
150  void GetInteractionHandleAxisWorld(int type, int index, double axis[3]) override;
151  };
153 
154 private:
156  void operator=(const vtkSlicerROIRepresentation3D&) = delete;
157 };
158 
159 #endif
MRML node to represent an ROI markup.
int RenderOpaqueGeometry(vtkViewport *viewport) override
vtkSmartPointer< vtkTransformPolyDataFilter > ROIOutlineTransformFilter
void PrintSelf(ostream &os, vtkIndent indent) override
vtkSmartPointer< vtkProperty > ROIOccludedProperty
vtkTypeBool HasTranslucentPolygonalGeometry() override
vtkSmartPointer< vtkActor > ROIOutlineOccludedActor
Default representation for the markups widget in 3D views.
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
vtkSmartPointer< vtkProperty > ROIOutlineProperty
vtkSmartPointer< vtkTransform > ROIToWorldTransform
vtkSmartPointer< vtkPolyDataMapper > ROIOutlineMapper
Default representation for the plane widget.
vtkSmartPointer< vtkProperty > ROIProperty
vtkSmartPointer< vtkPolyDataAlgorithm > ROISource
vtkSmartPointer< vtkPolyDataMapper > ROIMapper
void UpdateInteractionPipeline() override
Update the interaction pipeline.
vtkSmartPointer< vtkTransformPolyDataFilter > ROITransformFilter
std::vector< MarkupsInteractionPipeline::HandleInfo > HandleInfoList
void UpdateFromMRML(vtkMRMLNode *caller, unsigned long event, void *callData=nullptr) override
Default representation for the plane widget.
vtkSmartPointer< vtkPolyDataMapper > ROIOutlineOccludedMapper
vtkSmartPointer< vtkActor > ROIOccludedActor
double * GetBounds() override
Return the bounds of the representation.
int RenderOverlay(vtkViewport *viewport) override
vtkSmartPointer< vtkProperty > ROIOutlineOccludedProperty
vtkSmartPointer< vtkPolyDataMapper > ROIOccludedMapper
vtkSmartPointer< vtkPassThrough > ROIPipelineInputFilter
void CanInteract(vtkMRMLInteractionEventData *interactionEventData, int &foundComponentType, int &foundComponentIndex, double &closestDistance2) override
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
vtkSmartPointer< vtkOutlineFilter > ROIOutlineFilter
void ReleaseGraphicsResources(vtkWindow *) override
vtkSmartPointer< vtkActor > ROIOutlineActor
vtkSmartPointer< vtkActor > ROIActor
void GetActors(vtkPropCollection *) override
Methods to make this class behave as a vtkProp.