Slicer  5.0
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkSlicerPlaneWidget.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 
29 #ifndef vtkSlicerPlaneWidget_h
30 #define vtkSlicerPlaneWidget_h
31 
32 #include "vtkSlicerMarkupsModuleVTKWidgetsExport.h"
33 #include "vtkSlicerMarkupsWidget.h"
34 
36 class vtkPolyData;
37 class vtkIdList;
38 
39 class VTK_SLICER_MARKUPS_MODULE_VTKWIDGETS_EXPORT vtkSlicerPlaneWidget : public vtkSlicerMarkupsWidget
40 {
41 public:
43  static vtkSlicerPlaneWidget *New();
44 
47 
50 
52  enum
53  {
54  WidgetStateTranslatePlane = WidgetStateMarkups_Last, // translating the plane
55  WidgetStateSymmetricScale, // Scaling the plane without moving the center
56  WidgetStateMarkupsPlane_Last
57  };
58 
60  enum
61  {
62  WidgetEventControlPointPlace = WidgetEventMarkups_Last,
68  WidgetEventMarkupsPlane_Last
69  };
70 
72  void CreateDefaultRepresentation(vtkMRMLMarkupsDisplayNode* markupsDisplayNode, vtkMRMLAbstractViewNode* viewNode, vtkRenderer* renderer) override;
73 
74  bool PlacePoint(vtkMRMLInteractionEventData* eventData) override;
75  virtual bool PlacePlaneNormal(vtkMRMLInteractionEventData* eventData);
76 
77  bool CanProcessInteractionEvent(vtkMRMLInteractionEventData* eventData, double& distance2) override;
78  bool ProcessInteractionEvent(vtkMRMLInteractionEventData* eventData) override;
79  bool ProcessUpdatePlaneFromViewNormal(vtkMRMLInteractionEventData* event);
80  bool ProcessPlaneMoveStart(vtkMRMLInteractionEventData* event);
81  bool ProcessPlaneMoveEnd(vtkMRMLInteractionEventData* event);
82  bool ProcessMouseMove(vtkMRMLInteractionEventData* eventData) override;
83  bool ProcessPlaneTranslate(vtkMRMLInteractionEventData* event);
84  bool ProcessWidgetSymmetricScaleStart(vtkMRMLInteractionEventData* eventData);
85  bool ProcessPlaneSymmetricScale(vtkMRMLInteractionEventData* event);
86  bool ProcessEndMouseDrag(vtkMRMLInteractionEventData* eventData) override;
87  bool ProcessWidgetStopPlace(vtkMRMLInteractionEventData* eventData) override;
88 
89 protected:
91  ~vtkSlicerPlaneWidget() override;
92 
93  void ScaleWidget(double eventPos[2]) override;
94  virtual void ScaleWidget(double eventPos[2], bool symmetricScale);
95  void RotateWidget(double eventPos[2]) override;
96 
100  void FlipPlaneHandles(bool flipLRHandle, bool flipAPHandle);
101 
102 private:
104  void operator=(const vtkSlicerPlaneWidget&) = delete;
105 };
106 
107 #endif
virtual bool ProcessWidgetStopPlace(vtkMRMLInteractionEventData *eventData)
virtual void RotateWidget(double eventPos[2])
#define vtkSlicerMarkupsWidgetCreateInstanceMacro(type)
virtual void ScaleWidget(double eventPos[2])
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D...
bool ProcessInteractionEvent(vtkMRMLInteractionEventData *eventData) override
Process interaction event.
Process interaction events to update state of markup widget nodes.
virtual bool ProcessEndMouseDrag(vtkMRMLInteractionEventData *eventData)
virtual bool PlacePoint(vtkMRMLInteractionEventData *eventData)
create a plane with a set of 3 points
bool CanProcessInteractionEvent(vtkMRMLInteractionEventData *eventData, double &distance2) override
Return true if the widget can process the event.
virtual void CreateDefaultRepresentation(vtkMRMLMarkupsDisplayNode *markupsDisplayNode, vtkMRMLAbstractViewNode *viewNode, vtkRenderer *renderer)=0
Create the default widget representation and initializes the widget and representation.
virtual bool ProcessMouseMove(vtkMRMLInteractionEventData *eventData)