Medical Imaging Interaction Toolkit  2025.12.02
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 
114 
118 
121 
126 
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 
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
#define MITKGIZMO_EXPORT
BaseGeometry Describes the geometry of a data object.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:64
Data management class that handles 'was created by' relations.
mitkClassMacro(Gizmo, Surface)
AxisType
Names for the three axes.
Definition: mitkGizmo.h:54
~Gizmo() override
double GetLongestRadius() const
Return the longest of the three axes.
void FollowGeometry(BaseGeometry *geom)
Gizmo(const Gizmo &)
HandleType
Names for the different parts of the gizmo.
Definition: mitkGizmo.h:62
@ RotateAroundAxisX
Definition: mitkGizmo.h:67
@ MoveAlongAxisY
Definition: mitkGizmo.h:65
@ MoveAlongAxisZ
Definition: mitkGizmo.h:66
@ RotateAroundAxisY
Definition: mitkGizmo.h:68
@ RotateAroundAxisZ
Definition: mitkGizmo.h:69
@ MoveAlongAxisX
Definition: mitkGizmo.h:64
vtkSmartPointer< vtkPolyData > BuildGizmo()
Creates a vtkPolyData representing the parameters defining the gizmo.
void OnFollowedGeometryModified()
The ITK callback to receive modified events of the followed geometry.
static bool HasGizmoAttached(mitk::DataNode *node, DataStorage *storage)
static std::string HandleTypeToString(HandleType type)
Conversion for any kind of logging/debug/... purposes.
Gizmo & operator=(const Gizmo &)
void UpdateRepresentation()
Updates the representing surface object after changes to center, axes, or radius.
HandleType GetHandleFromPointID(vtkIdType id)
static DataNode::Pointer AddGizmoToNode(DataNode *node, DataStorage *storage)
static bool RemoveGizmoFromNode(DataNode *node, DataStorage *storage)
mitk::Gizmo::HandleType GetHandleFromPointDataValue(double value)
Class for storing surfaces (vtkPolyData).
Definition: mitkSurface.h:29
Find image slices visible on a given plane.