Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkGizmo_h
18 #define mitkGizmo_h
19 
20 #include <mitkDataNode.h>
21 #include <mitkSurface.h>
22 
23 #include <MitkGizmoExports.h>
24 
25 namespace mitk
26 {
27  class DataStorage;
28  class GizmoRemover;
29 
54  {
55  public:
57  enum AxisType
58  {
61  AxisZ
62  };
63 
66  {
67  MoveFreely, //< the central sphere
77  NoHandle //< to indicate picking failure
78  };
79 
81  static std::string HandleTypeToString(HandleType type);
82 
84  itkNewMacro(Gizmo);
85 
86  itkGetConstMacro(Center, Point3D);
87  itkSetMacro(Center, Point3D);
88 
89  itkGetConstMacro(AxisX, Vector3D);
90  itkSetMacro(AxisX, Vector3D);
91 
92  itkGetConstMacro(AxisY, Vector3D);
93  itkSetMacro(AxisY, Vector3D);
94 
95  itkGetConstMacro(AxisZ, Vector3D);
96  itkSetMacro(AxisZ, Vector3D);
97 
98  itkGetConstMacro(Radius, Vector3D);
99  itkSetMacro(Radius, Vector3D);
100 
101  itkGetConstMacro(AllowTranslation, bool);
102  itkSetMacro(AllowTranslation, bool);
103  itkBooleanMacro(AllowTranslation);
104 
105  itkGetConstMacro(AllowRotation, bool);
106  itkSetMacro(AllowRotation, bool);
107  itkBooleanMacro(AllowRotation);
108 
109  itkGetConstMacro(AllowScaling, bool);
110  itkSetMacro(AllowScaling, bool);
111  itkBooleanMacro(AllowScaling);
112 
114  double GetLongestRadius() const;
115 
117  void UpdateRepresentation();
118 
121  void FollowGeometry(BaseGeometry *geom);
122 
124  void OnFollowedGeometryModified();
125 
129  HandleType GetHandleFromPointID(vtkIdType id);
130 
134  mitk::Gizmo::HandleType GetHandleFromPointDataValue(double value);
135 
142  static DataNode::Pointer AddGizmoToNode(DataNode *node, DataStorage *storage);
143 
154  static bool RemoveGizmoFromNode(DataNode *node, DataStorage *storage);
155 
157  static bool HasGizmoAttached(mitk::DataNode *node, DataStorage *storage);
158 
159  protected:
160  Gizmo();
161  virtual ~Gizmo();
162 
163  Gizmo(const Gizmo &); // = delete;
164  Gizmo &operator=(const Gizmo &); // = delete;
165 
167  vtkSmartPointer<vtkPolyData> BuildGizmo();
168 
169  private:
170  Point3D m_Center;
171  Vector3D m_AxisX;
172  Vector3D m_AxisY;
173  Vector3D m_AxisZ;
174  Vector3D m_Radius;
175 
176  bool m_AllowTranslation;
177  bool m_AllowRotation;
178  bool m_AllowScaling;
179 
180  BaseGeometry::Pointer m_FollowedGeometry;
182  unsigned long m_FollowerTag;
183 
186  std::unique_ptr<GizmoRemover> m_GizmoRemover;
187  };
188 }
189 #endif /* BOUNDINGOBJECT_H_HEADER_INCLUDED */
#define MITKGIZMO_EXPORT
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:32
Data management class that handles 'was created by' relations.
DataCollection - Class to facilitate loading/accessing structured data.
HandleType
Names for the different parts of the gizmo.
Definition: mitkGizmo.h:65
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:44
AxisType
Names for the three axes.
Definition: mitkGizmo.h:57
BaseGeometry Describes the geometry of a data object.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:66