Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
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
mitk::Gizmo::ScaleX
@ ScaleX
Definition: mitkGizmo.h:70
mitk::Gizmo::HandleType
HandleType
Names for the different parts of the gizmo.
Definition: mitkGizmo.h:61
mitk::Gizmo::ScaleY
@ ScaleY
Definition: mitkGizmo.h:71
mitk::Gizmo::AxisY
@ AxisY
Definition: mitkGizmo.h:56
mitk::Gizmo::AxisX
@ AxisX
Definition: mitkGizmo.h:55
mitk::Gizmo::MoveAlongAxisX
@ MoveAlongAxisX
Definition: mitkGizmo.h:64
MitkGizmoExports.h
vtkSmartPointer< vtkPolyData >
mitk::Gizmo::ScaleZ
@ ScaleZ
Definition: mitkGizmo.h:72
itk::SmartPointer< Self >
mitk::Gizmo::AxisType
AxisType
Names for the three axes.
Definition: mitkGizmo.h:53
mitk::Gizmo::RotateAroundAxisY
@ RotateAroundAxisY
Definition: mitkGizmo.h:68
mitk::Gizmo::MoveFreely
@ MoveFreely
Definition: mitkGizmo.h:63
mitk::Surface
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:28
mitk::Gizmo::MoveAlongAxisY
@ MoveAlongAxisY
Definition: mitkGizmo.h:65
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitkSurface.h
mitk::Gizmo
Definition: mitkGizmo.h:49
mitk::Gizmo::RotateAroundAxisX
@ RotateAroundAxisX
Definition: mitkGizmo.h:67
mitk::Vector< ScalarType, 3 >
mitk::BaseGeometry
BaseGeometry Describes the geometry of a data object.
Definition: mitkBaseGeometry.h:94
mitk::Point< ScalarType, 3 >
mitk::DataStorage
Data management class that handles 'was created by' relations.
Definition: mitkDataStorage.h:43
mitkDataNode.h
mitk::Gizmo::MoveAlongAxisZ
@ MoveAlongAxisZ
Definition: mitkGizmo.h:66
mitkClassMacro
#define mitkClassMacro(className, SuperClassName)
Definition: mitkCommon.h:36
MITKGIZMO_EXPORT
#define MITKGIZMO_EXPORT
Definition: MitkGizmoExports.h:15
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
mitk::Gizmo::RotateAroundAxisZ
@ RotateAroundAxisZ
Definition: mitkGizmo.h:69