Medical Imaging Interaction Toolkit  2018.4.99-0d336d68
Medical Imaging Interaction Toolkit
mitkGizmo.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkGizmo_h
14 #define mitkGizmo_h
15 
16 #include <mitkDataNode.h>
17 #include <mitkSurface.h>
18 
19 #include <MitkGizmoExports.h>
20 
21 namespace mitk
22 {
23  class DataStorage;
24  class GizmoRemover;
25 
50  {
51  public:
53  enum AxisType
54  {
57  AxisZ
58  };
59 
62  {
63  MoveFreely, //< the central sphere
73  NoHandle //< to indicate picking failure
74  };
75 
77  static std::string HandleTypeToString(HandleType type);
78 
80  itkNewMacro(Gizmo);
81 
82  itkGetConstMacro(Center, Point3D);
83  itkSetMacro(Center, Point3D);
84 
85  itkGetConstMacro(AxisX, Vector3D);
86  itkSetMacro(AxisX, Vector3D);
87 
88  itkGetConstMacro(AxisY, Vector3D);
89  itkSetMacro(AxisY, Vector3D);
90 
91  itkGetConstMacro(AxisZ, Vector3D);
92  itkSetMacro(AxisZ, Vector3D);
93 
94  itkGetConstMacro(Radius, Vector3D);
95  itkSetMacro(Radius, Vector3D);
96 
97  itkGetConstMacro(AllowTranslation, bool);
98  itkSetMacro(AllowTranslation, bool);
99  itkBooleanMacro(AllowTranslation);
100 
101  itkGetConstMacro(AllowRotation, bool);
102  itkSetMacro(AllowRotation, bool);
103  itkBooleanMacro(AllowRotation);
104 
105  itkGetConstMacro(AllowScaling, bool);
106  itkSetMacro(AllowScaling, bool);
107  itkBooleanMacro(AllowScaling);
108 
110  double GetLongestRadius() const;
111 
113  void UpdateRepresentation();
114 
117  void FollowGeometry(BaseGeometry *geom);
118 
120  void OnFollowedGeometryModified();
121 
125  HandleType GetHandleFromPointID(vtkIdType id);
126 
130  mitk::Gizmo::HandleType GetHandleFromPointDataValue(double value);
131 
138  static DataNode::Pointer AddGizmoToNode(DataNode *node, DataStorage *storage);
139 
150  static bool RemoveGizmoFromNode(DataNode *node, DataStorage *storage);
151 
153  static bool HasGizmoAttached(mitk::DataNode *node, DataStorage *storage);
154 
155  protected:
156  Gizmo();
157  ~Gizmo() override;
158 
159  Gizmo(const Gizmo &); // = delete;
160  Gizmo &operator=(const Gizmo &); // = delete;
161 
163  vtkSmartPointer<vtkPolyData> BuildGizmo();
164 
165  private:
166  Point3D m_Center;
167  Vector3D m_AxisX;
168  Vector3D m_AxisY;
169  Vector3D m_AxisZ;
170  Vector3D m_Radius;
171 
172  bool m_AllowTranslation;
173  bool m_AllowRotation;
174  bool m_AllowScaling;
175 
176  BaseGeometry::Pointer m_FollowedGeometry;
178  unsigned long m_FollowerTag;
179 
182  std::unique_ptr<GizmoRemover> m_GizmoRemover;
183  };
184 }
185 #endif /* BOUNDINGOBJECT_H_HEADER_INCLUDED */
#define MITKGIZMO_EXPORT
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:28
Data management class that handles &#39;was created by&#39; relations.
DataCollection - Class to facilitate loading/accessing structured data.
HandleType
Names for the different parts of the gizmo.
Definition: mitkGizmo.h:61
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:40
AxisType
Names for the three axes.
Definition: mitkGizmo.h:53
BaseGeometry Describes the geometry of a data object.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57