Slicer  5.3
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkSlicerROIRepresentation2D.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 vtkSlicerROIRepresentation2D_h
33 #define vtkSlicerROIRepresentation2D_h
34 
35 #include "vtkSlicerMarkupsModuleVTKWidgetsExport.h"
38 
39 class vtkAppendPolyData;
40 class vtkClipPolyData;
41 class vtkContourTriangulator;
42 class vtkCutter;
43 class vtkDiscretizableColorTransferFunction;
45 class vtkOutlineFilter;
46 class vtkSampleImplicitFunctionFilter;
47 
48 class VTK_SLICER_MARKUPS_MODULE_VTKWIDGETS_EXPORT vtkSlicerROIRepresentation2D : public vtkSlicerMarkupsWidgetRepresentation2D
49 {
50 public:
52  static vtkSlicerROIRepresentation2D *New();
53 
56  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
61  void UpdateFromMRML(vtkMRMLNode* caller, unsigned long event, void *callData = nullptr) override;
62 
64  void GetActors(vtkPropCollection *) override;
65  void ReleaseGraphicsResources(vtkWindow *) override;
66  int RenderOverlay(vtkViewport *viewport) override;
67  int RenderOpaqueGeometry(vtkViewport *viewport) override;
68  int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override;
69  vtkTypeBool HasTranslucentPolygonalGeometry() override;
70 
72  double *GetBounds() override;
73 
74  void CanInteract(vtkMRMLInteractionEventData* interactionEventData,
75  int& foundComponentType, int& foundComponentIndex, double& closestDistance2) override;
76 
77  void CanInteractWithROI(vtkMRMLInteractionEventData* interactionEventData,
78  int& foundComponentType, int& foundComponentIndex, double& closestDistance2);
79 
80  // Update visibility of interaction handles for representation
81  void UpdateInteractionPipeline() override;
82 
83 protected:
84 
86  virtual void UpdateCubeSourceFromMRML(vtkMRMLMarkupsROINode* roiNode);
87 
88  // Initialize interaction handle pipeline
89  void SetupInteractionPipeline() override;
90 
91 protected:
93  ~vtkSlicerROIRepresentation2D() override;
94 
95  void SetROISource(vtkPolyDataAlgorithm* roiSource);
96 
97  vtkSmartPointer<vtkPolyDataAlgorithm> ROISource;
98 
99  vtkSmartPointer<vtkPassThrough> ROIPipelineInputFilter;
100  vtkSmartPointer<vtkTransform> ROIToWorldTransform;
101  vtkSmartPointer<vtkTransformPolyDataFilter> ROIToWorldTransformFilter;
102  vtkSmartPointer<vtkCutter> ROIOutlineCutter;
103  vtkSmartPointer<vtkTransformPolyDataFilter> ROIOutlineWorldToSliceTransformFilter;
104  vtkSmartPointer<vtkContourTriangulator> ROIIntersectionTriangulator;
105 
106  vtkSmartPointer<vtkPolyDataMapper2D> ROIMapper;
107  vtkSmartPointer<vtkProperty2D> ROIProperty;
108  vtkSmartPointer<vtkActor2D> ROIActor;
109 
110  vtkSmartPointer<vtkPolyDataMapper2D> ROIOutlineMapper;
111  vtkSmartPointer<vtkProperty2D> ROIOutlineProperty;
112  vtkSmartPointer<vtkActor2D> ROIOutlineActor;
113 
115  {
116  public:
118  ~MarkupsInteractionPipelineROI2D() override = default;
119  void GetViewPlaneNormal(double viewPlaneNormal[3]) override;
120  void UpdateScaleHandles() override;
121  void AddScaleEdgeIntersection(int pointIndex, vtkIdTypeArray* visibilityArray, vtkPoints* scaleHandleArray,
122  double sliceNormal[3], double sliceOrigin[3], double edgePoint[3], double edgeVector[3]);
123  vtkSmartPointer<vtkTransformPolyDataFilter> WorldToSliceTransformFilter;
124  };
125 
126 private:
128  void operator=(const vtkSlicerROIRepresentation2D&) = delete;
129 };
130 
131 #endif
MRML node to represent an ROI markup.
vtkSmartPointer< vtkTransformPolyDataFilter > ROIOutlineWorldToSliceTransformFilter
vtkSmartPointer< vtkContourTriangulator > ROIIntersectionTriangulator
vtkSmartPointer< vtkPolyDataMapper2D > ROIOutlineMapper
vtkTypeBool HasTranslucentPolygonalGeometry() override
vtkSmartPointer< vtkTransform > ROIToWorldTransform
vtkSmartPointer< vtkTransformPolyDataFilter > WorldToSliceTransformFilter
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
vtkSmartPointer< vtkActor2D > ROIActor
int RenderOpaqueGeometry(vtkViewport *viewport) override
void PrintSelf(ostream &os, vtkIndent indent) override
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
vtkSmartPointer< vtkProperty2D > ROIOutlineProperty
vtkSmartPointer< vtkActor2D > ROIOutlineActor
vtkSmartPointer< vtkPassThrough > ROIPipelineInputFilter
int RenderOverlay(vtkViewport *viewport) override
vtkSmartPointer< vtkTransformPolyDataFilter > ROIToWorldTransformFilter
vtkSmartPointer< vtkPolyDataAlgorithm > ROISource
Default representation for the slicer markups widget.
Default representation for the plane widget.
vtkSmartPointer< vtkProperty2D > ROIProperty
vtkSmartPointer< vtkPolyDataMapper2D > ROIMapper
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
void ReleaseGraphicsResources(vtkWindow *) override
vtkSmartPointer< vtkCutter > ROIOutlineCutter
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.