Medical Imaging Interaction Toolkit  2026.06.00
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 
57  {
58  public:
62  enum AxisType
63  {
66  AxisZ
67  };
68 
77  {
88  NoHandle
89  };
90 
100  static std::string HandleTypeToString(HandleType type);
101 
103  itkNewMacro(Gizmo);
104 
106  itkGetConstMacro(Center, Point3D);
108  itkSetMacro(Center, Point3D);
109 
111  itkGetConstMacro(AxisX, Vector3D);
113  itkSetMacro(AxisX, Vector3D);
114 
116  itkGetConstMacro(AxisY, Vector3D);
118  itkSetMacro(AxisY, Vector3D);
119 
121  itkGetConstMacro(AxisZ, Vector3D);
123  itkSetMacro(AxisZ, Vector3D);
124 
126  itkGetConstMacro(Radius, Vector3D);
128  itkSetMacro(Radius, Vector3D);
129 
131  itkGetConstMacro(AllowTranslation, bool);
133  itkSetMacro(AllowTranslation, bool);
135  itkBooleanMacro(AllowTranslation);
136 
138  itkGetConstMacro(AllowRotation, bool);
140  itkSetMacro(AllowRotation, bool);
142  itkBooleanMacro(AllowRotation);
143 
145  itkGetConstMacro(AllowScaling, bool);
147  itkSetMacro(AllowScaling, bool);
149  itkBooleanMacro(AllowScaling);
150 
155  double GetLongestRadius() const;
156 
164 
179 
189 
203 
216 
237  static DataNode::Pointer AddGizmoToNode(DataNode *node, DataStorage *storage);
238 
254  static bool RemoveGizmoFromNode(DataNode *node, DataStorage *storage);
255 
268  static bool HasGizmoAttached(mitk::DataNode *node, DataStorage *storage);
269 
270  protected:
271  Gizmo();
272  ~Gizmo() override;
273 
274  Gizmo(const Gizmo &); // = delete;
275  Gizmo &operator=(const Gizmo &); // = delete;
276 
287 
288  private:
289  Point3D m_Center;
290  Vector3D m_AxisX;
291  Vector3D m_AxisY;
292  Vector3D m_AxisZ;
293  Vector3D m_Radius;
294 
295  bool m_AllowTranslation;
296  bool m_AllowRotation;
297  bool m_AllowScaling;
298 
299  BaseGeometry::Pointer m_FollowedGeometry;
301  unsigned long m_FollowerTag;
302 
305  std::unique_ptr<GizmoRemover> m_GizmoRemover;
306  };
307 }
308 #endif
#define MITKGIZMO_EXPORT
Abstract base class describing the geometry of a data object.
Central node class of the MITK data tree, associating a data object with properties and mappers.
Definition: mitkDataNode.h:72
Abstract data management class that organizes DataNode objects in a directed acyclic graph.
A geometry manipulation "gizmo" for interactive 3D transformations.
Definition: mitkGizmo.h:57
mitkClassMacro(Gizmo, Surface)
AxisType
Enumeration of the three principal axes.
Definition: mitkGizmo.h:63
@ AxisY
The Y axis.
Definition: mitkGizmo.h:65
@ AxisX
The X axis.
Definition: mitkGizmo.h:64
~Gizmo() override
double GetLongestRadius() const
Return the longest of the three axis radii.
void FollowGeometry(BaseGeometry *geom)
Begin observing a geometry for automatic gizmo updates.
Gizmo(const Gizmo &)
HandleType
Enumeration of interactive handle types for the gizmo.
Definition: mitkGizmo.h:77
@ ScaleY
The Y axis arrow tips for scaling.
Definition: mitkGizmo.h:86
@ RotateAroundAxisX
The ring around X for rotation about the X axis.
Definition: mitkGizmo.h:82
@ MoveAlongAxisY
The Y axis shaft for constrained translation along Y.
Definition: mitkGizmo.h:80
@ ScaleX
The X axis arrow tips for scaling.
Definition: mitkGizmo.h:85
@ MoveAlongAxisZ
The Z axis shaft for constrained translation along Z.
Definition: mitkGizmo.h:81
@ ScaleZ
The Z axis arrow tips for scaling.
Definition: mitkGizmo.h:87
@ RotateAroundAxisY
The ring around Y for rotation about the Y axis.
Definition: mitkGizmo.h:83
@ MoveFreely
The central sphere for free translation parallel to the camera plane.
Definition: mitkGizmo.h:78
@ RotateAroundAxisZ
The ring around Z for rotation about the Z axis.
Definition: mitkGizmo.h:84
@ MoveAlongAxisX
The X axis shaft for constrained translation along X.
Definition: mitkGizmo.h:79
vtkSmartPointer< vtkPolyData > BuildGizmo()
Build the vtkPolyData that visually represents the gizmo.
void OnFollowedGeometryModified()
ITK callback invoked when the followed geometry is modified.
static bool HasGizmoAttached(mitk::DataNode *node, DataStorage *storage)
Check whether a gizmo is attached to the given node.
static std::string HandleTypeToString(HandleType type)
Convert a HandleType value to a human-readable string.
Gizmo & operator=(const Gizmo &)
void UpdateRepresentation()
Rebuild the VTK surface representation after property changes.
HandleType GetHandleFromPointID(vtkIdType id)
Identify the gizmo handle that corresponds to a picked VTK point ID.
static DataNode::Pointer AddGizmoToNode(DataNode *node, DataStorage *storage)
Create and attach a gizmo to a data node.
static bool RemoveGizmoFromNode(DataNode *node, DataStorage *storage)
Remove a previously attached gizmo from a data node.
mitk::Gizmo::HandleType GetHandleFromPointDataValue(double value)
Identify the gizmo handle from a point data scalar value.
Data class for storing polygonal surfaces (vtkPolyData).
Definition: mitkSurface.h:37
Find image slices visible on a given plane.