Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::Gizmo Class Reference

A geometry manipulation "gizmo" for interactive 3D transformations. More...

#include <mitkGizmo.h>

Inheritance diagram for mitk::Gizmo:
Collaboration diagram for mitk::Gizmo:

Public Types

enum  AxisType { AxisX , AxisY , AxisZ }
 Enumeration of the three principal axes. More...
 
enum  HandleType {
  MoveFreely , MoveAlongAxisX , MoveAlongAxisY , MoveAlongAxisZ ,
  RotateAroundAxisX , RotateAroundAxisY , RotateAroundAxisZ , ScaleX ,
  ScaleY , ScaleZ , NoHandle
}
 Enumeration of interactive handle types for the gizmo. More...
 
- Public Types inherited from mitk::Surface
typedef itk::ImageRegion< 5 > RegionType
 Region type used for pipeline region negotiation (5-dimensional). More...
 
- Public Types inherited from mitk::Identifiable
using UIDType = std::string
 Type alias for unique identifiers. More...
 

Public Member Functions

 mitkClassMacro (Gizmo, Surface)
 
virtual Point3D GetCenter () const
 Get the center point of the gizmo. More...
 
virtual void SetCenter (Point3D _arg)
 Set the center point of the gizmo. More...
 
virtual Vector3D GetAxisX () const
 Get the normalized X axis direction vector. More...
 
virtual void SetAxisX (Vector3D _arg)
 Set the X axis direction vector. More...
 
virtual Vector3D GetAxisY () const
 Get the normalized Y axis direction vector. More...
 
virtual void SetAxisY (Vector3D _arg)
 Set the Y axis direction vector. More...
 
virtual Vector3D GetAxisZ () const
 Get the normalized Z axis direction vector. More...
 
virtual void SetAxisZ (Vector3D _arg)
 Set the Z axis direction vector. More...
 
virtual Vector3D GetRadius () const
 Get the radius vector (half-extent per axis in mm). More...
 
virtual void SetRadius (Vector3D _arg)
 Set the radius vector (half-extent per axis in mm). More...
 
virtual bool GetAllowTranslation () const
 Get whether translation handles are enabled. More...
 
virtual void SetAllowTranslation (bool _arg)
 Set whether translation handles are enabled. More...
 
virtual void AllowTranslationOn ()
 Toggle whether translation handles are enabled. More...
 
virtual void AllowTranslationOff ()
 
virtual bool GetAllowRotation () const
 Get whether rotation handles are enabled. More...
 
virtual void SetAllowRotation (bool _arg)
 Set whether rotation handles are enabled. More...
 
virtual void AllowRotationOn ()
 Toggle whether rotation handles are enabled. More...
 
virtual void AllowRotationOff ()
 
virtual bool GetAllowScaling () const
 Get whether scaling handles are enabled. More...
 
virtual void SetAllowScaling (bool _arg)
 Set whether scaling handles are enabled. More...
 
virtual void AllowScalingOn ()
 Toggle whether scaling handles are enabled. More...
 
virtual void AllowScalingOff ()
 
double GetLongestRadius () const
 Return the longest of the three axis radii. More...
 
void UpdateRepresentation ()
 Rebuild the VTK surface representation after property changes. More...
 
void FollowGeometry (BaseGeometry *geom)
 Begin observing a geometry for automatic gizmo updates. More...
 
void OnFollowedGeometryModified ()
 ITK callback invoked when the followed geometry is modified. More...
 
HandleType GetHandleFromPointID (vtkIdType id)
 Identify the gizmo handle that corresponds to a picked VTK point ID. More...
 
mitk::Gizmo::HandleType GetHandleFromPointDataValue (double value)
 Identify the gizmo handle from a point data scalar value. More...
 
- Public Member Functions inherited from mitk::Surface
 mitkClassMacro (Surface, BaseData)
 
Pointer Clone () const
 
void CalculateBoundingBox ()
 Compute the bounding box from all vtkPolyData objects across time steps. More...
 
void CopyInformation (const itk::DataObject *data) override
 Copy information (geometry, region) from another data object. More...
 
void ExecuteOperation (Operation *operation) override
 Execute an operation on this surface (e.g., OpSURFACECHANGED). More...
 
void Expand (unsigned int timeSteps=1) override
 Expand the data to the given number of time steps. More...
 
const RegionType & GetLargestPossibleRegion () const
 Get the largest possible region. More...
 
virtual const RegionType & GetRequestedRegion () const
 Get the requested region. More...
 
unsigned int GetSizeOfPolyDataSeries () const
 Get the number of vtkPolyData objects in the time series. More...
 
virtual vtkPolyData * GetVtkPolyData (unsigned int t=0) const
 Get the vtkPolyData at time step t. More...
 
void Graft (const DataObject *data) override
 Graft data and information from another data object. More...
 
bool IsEmptyTimeStep (unsigned int t) const override
 Check whether time step t is empty (has no vtkPolyData). More...
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 Print the surface information to the output stream. More...
 
bool RequestedRegionIsOutsideOfTheBufferedRegion () override
 Determine whether the requested region is outside the buffered region. More...
 
void SetRequestedRegion (const itk::DataObject *data) override
 Set the requested region to match another data object's requested region. More...
 
virtual void SetRequestedRegion (Surface::RegionType *region)
 Set the requested region from a RegionType pointer. More...
 
void SetRequestedRegionToLargestPossibleRegion () override
 Set the requested region to the largest possible region. More...
 
virtual void SetVtkPolyData (vtkPolyData *polydata, unsigned int t=0)
 Set the vtkPolyData for time step t. More...
 
virtual void Swap (Surface &other)
 Swap the contents of this surface with another surface. More...
 
void Update () override
 Trigger an update of all vtkPolyData objects in the pipeline. More...
 
void UpdateOutputInformation () override
 Update the output information (bounding box, geometry). More...
 
bool VerifyRequestedRegion () override
 Verify that the requested region is within the largest possible region. More...
 
- Public Member Functions inherited from mitk::BaseData
 mitkClassMacroItkParent (BaseData, itk::DataObject)
 
BaseProperty::ConstPointer GetConstProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const override
 Get a const property by its key. More...
 
std::vector< std::string > GetPropertyKeys (const std::string &contextName="", bool includeDefaultContext=false) const override
 Get all property keys stored in the property list. More...
 
std::vector< std::string > GetPropertyContextNames () const override
 Get the names of all property contexts. More...
 
BaseProperty * GetNonConstProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) override
 Get a non-const property by its key. More...
 
void SetProperty (const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
 Set a property in the property list. More...
 
void RemoveProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
 Remove a property from the property list. More...
 
const mitk::TimeGeometry * GetTimeGeometry () const
 Return the TimeGeometry of the data as const pointer. More...
 
mitk::TimeGeometry * GetTimeGeometry ()
 Return the TimeGeometry of the data as non-const pointer. More...
 
const mitk::TimeGeometry * GetUpdatedTimeGeometry ()
 Return the TimeGeometry of the data after ensuring it is up-to-date. More...
 
const mitk::BaseGeometry * GetUpdatedGeometry (int t=0)
 Return the BaseGeometry of the data at time step t after ensuring it is up-to-date. More...
 
mitk::BaseGeometry * GetGeometry (int t=0) const
 Return the BaseGeometry of the data at time step t as a non-const pointer. More...
 
void UpdateOutputInformation () override
 Update the information for this BaseData so that it can be used as an output of a BaseProcess. More...
 
void CopyInformation (const itk::DataObject *data) override
 Copy information from the specified data set. More...
 
virtual bool IsInitialized () const
 Check whether the data has been initialized. More...
 
virtual void Clear ()
 Reset the data object by calling ClearData() and InitializeEmpty(). More...
 
virtual bool IsEmpty () const
 Check whether the object contains data at any time step. More...
 
virtual void SetGeometry (BaseGeometry *aGeometry3D)
 Set the BaseGeometry of the data, which will be referenced (not copied!). More...
 
virtual void SetTimeGeometry (TimeGeometry *geometry)
 Set the TimeGeometry of the data, which will be referenced (not copied!). More...
 
virtual void SetClonedGeometry (const BaseGeometry *aGeometry3D)
 Set a clone of the provided geometry as the BaseGeometry of the data. More...
 
virtual void SetClonedTimeGeometry (const TimeGeometry *geometry)
 Set a clone of the provided TimeGeometry as the TimeGeometry of the data. More...
 
virtual void SetClonedGeometry (const BaseGeometry *aGeometry3D, unsigned int time)
 Set a clone of the provided geometry as the BaseGeometry of a given time step. More...
 
mitk::PropertyList::Pointer GetPropertyList () const
 Get the data's property list. More...
 
void SetPropertyList (PropertyList *propertyList)
 Set the data's property list, replacing the existing one. More...
 
mitk::BaseProperty::Pointer GetProperty (const char *propertyKey) const
 Get a property by its key from the PropertyList. More...
 
void SetProperty (const char *propertyKey, BaseProperty *property)
 Set a property in the PropertyList. More...
 
virtual void SetOrigin (const Point3D &origin)
 Convenience method for setting the origin of the BaseGeometry instances of all time steps. More...
 
itk::SmartPointer< mitk::BaseDataSource > GetSource () const
 Get the process object that generated this data object. More...
 
unsigned int GetTimeSteps () const
 Get the number of time steps from the TimeGeometry. More...
 
itk::ModifiedTimeType GetMTime () const override
 Get the modification time of this data object or its geometry, whichever was modified most recently. More...
 
void Graft (const DataObject *) override
 Graft data and information from another data object. More...
 
- Public Member Functions inherited from mitk::OperationActor
 itkTypeMacroNoParent (OperationActor) virtual ~OperationActor()
 
- Public Member Functions inherited from mitk::Identifiable
 Identifiable ()
 Default constructor. Generates a new random UID. More...
 
 Identifiable (const UIDType &uid)
 Construct with a pre-existing UID. More...
 
 Identifiable (const Identifiable &)=delete
 Copy construction is deleted to prevent UID duplication. More...
 
 Identifiable (Identifiable &&) noexcept
 Move constructor. Transfers ownership of the UID. More...
 
virtual ~Identifiable ()
 Virtual destructor. More...
 
Identifiable & operator= (const Identifiable &)=delete
 Copy assignment is deleted to prevent UID duplication. More...
 
Identifiable & operator= (Identifiable &&other) noexcept
 Move assignment operator. Transfers ownership of the UID. More...
 
virtual UIDType GetUID () const
 Get the unique identifier of this object. More...
 
UIDType GetRuntimeUID () const noexcept
 Get a runtime-unique ID for this object instance. More...
 
- Public Member Functions inherited from mitk::IPropertyOwner
 ~IPropertyOwner () override
 
virtual bool PropertyIsOwned (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const
 Checks if a certain property exists. More...
 
- Public Member Functions inherited from mitk::IPropertyProvider
virtual ~IPropertyProvider ()
 Virtual destructor. More...
 

Static Public Member Functions

static std::string HandleTypeToString (HandleType type)
 Convert a HandleType value to a human-readable string. More...
 
static Pointer New ()
 
static DataNode::Pointer AddGizmoToNode (DataNode *node, DataStorage *storage)
 Create and attach a gizmo to a data node. More...
 
static bool RemoveGizmoFromNode (DataNode *node, DataStorage *storage)
 Remove a previously attached gizmo from a data node. More...
 
static bool HasGizmoAttached (mitk::DataNode *node, DataStorage *storage)
 Check whether a gizmo is attached to the given node. More...
 
- Static Public Member Functions inherited from mitk::Surface
static Pointer New ()
 

Protected Member Functions

 Gizmo ()
 
 ~Gizmo () override
 
 Gizmo (const Gizmo &)
 
Gizmo & operator= (const Gizmo &)
 
vtkSmartPointer< vtkPolyData > BuildGizmo ()
 Build the vtkPolyData that visually represents the gizmo. More...
 
- Protected Member Functions inherited from mitk::Surface
 mitkCloneMacro (Self)
 
 Surface ()
 
 ~Surface () override
 
 Surface (const Surface &other)
 
Surface & operator= (Surface other)
 
void ClearData () override
 reset to non-initialized state, release memory More...
 
void InitializeEmpty () override
 Pure virtual; Must be used in subclasses to get a data object to a valid state. Should at least create one empty object and call Superclass::InitializeTimeGeometry() to ensure an existing valid geometry. More...
 
- Protected Member Functions inherited from mitk::BaseData
 BaseData ()
 
 BaseData (const BaseData &other)
 
 ~BaseData () override
 
virtual void InitializeTimeGeometry (unsigned int timeSteps=1)
 Initialize the TimeGeometry for a number of time steps. The TimeGeometry is initialized empty and evenly timed. In many cases it will be necessary to overwrite this in sub-classes. More...
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
- Protected Member Functions inherited from mitk::Identifiable
virtual void SetUID (const UIDType &uid)
 

Additional Inherited Members

- Protected Attributes inherited from mitk::BaseData
bool m_LastRequestedRegionWasOutsideOfTheBufferedRegion
 
unsigned int m_SourceOutputIndexDuplicate
 
bool m_Initialized
 

Detailed Description

A geometry manipulation "gizmo" for interactive 3D transformations.

This class represents the principal axes of some arbitrary BaseGeometry as a visual 3D widget (Surface). The visualization shows three axes (x, y, z), orthogonal rings around each axis, and a small sphere at the center.

The Gizmo is intended to be visualized alongside another data object whose BaseGeometry it follows. It automatically updates its representation in response to ModifiedEvents from the followed geometry, enabling interactive visualization of geometry modifications such as translation, rotation, and scaling.

The gizmo is defined by:

  • a center point
  • three normalized axis direction vectors (x, y, z)
  • a radius vector (half-extent per axis in mm)

The radius determines the size of the axes and the rings around them. Vertex scalar data encodes which HandleType each part of the mesh corresponds to, enabling handle-based picking.

A nice overview of similar / alternative representations can be found in "Schmidt R, Singh K, and Balakrishnan R. Sketching and Composing Widgets for 3D Manipulation. EUROGRAPHICS 2008"

See also
GizmoInteractor
Surface
BaseGeometry

Definition at line 56 of file mitkGizmo.h.

Member Enumeration Documentation

◆ AxisType

Enumeration of the three principal axes.

Enumerator
AxisX 

The X axis.

AxisY 

The Y axis.

AxisZ 

The Z axis.

Definition at line 62 of file mitkGizmo.h.

◆ HandleType

Enumeration of interactive handle types for the gizmo.

Each value identifies a distinct interactive part of the gizmo visualization. The values are also used as scalar data in the underlying vtkPolyData to enable picking.

Enumerator
MoveFreely 

The central sphere for free translation parallel to the camera plane.

MoveAlongAxisX 

The X axis shaft for constrained translation along X.

MoveAlongAxisY 

The Y axis shaft for constrained translation along Y.

MoveAlongAxisZ 

The Z axis shaft for constrained translation along Z.

RotateAroundAxisX 

The ring around X for rotation about the X axis.

RotateAroundAxisY 

The ring around Y for rotation about the Y axis.

RotateAroundAxisZ 

The ring around Z for rotation about the Z axis.

ScaleX 

The X axis arrow tips for scaling.

ScaleY 

The Y axis arrow tips for scaling.

ScaleZ 

The Z axis arrow tips for scaling.

NoHandle 

Indicates that no handle was picked.

Definition at line 76 of file mitkGizmo.h.

Constructor & Destructor Documentation

◆ Gizmo() [1/2]

mitk::Gizmo::Gizmo ( )
protected

◆ ~Gizmo()

mitk::Gizmo::~Gizmo ( )
overrideprotected

◆ Gizmo() [2/2]

mitk::Gizmo::Gizmo ( const Gizmo &  )
protected

Member Function Documentation

◆ AddGizmoToNode()

static DataNode::Pointer mitk::Gizmo::AddGizmoToNode ( DataNode *  node,
DataStorage *  storage 
)
static

Create and attach a gizmo to a data node.

Creates a new Gizmo instance that follows the geometry of the given node, wraps it in a DataNode named "Gizmo", attaches a GizmoInteractor, and optionally adds it to the data storage as a child of node. The manipulated object's opacity is lowered to 0.5 for visual clarity.

Parameters
[in]nodeThe node whose geometry the gizmo will visualize and whose geometry the interactor will manipulate. Must not be nullptr and must hold data with a geometry.
[in]storageThe DataStorage to add the gizmo node to. May be nullptr, in which case the gizmo is not added to any storage.
Returns
A DataNode containing the gizmo, or nullptr if the node has no data or geometry.
See also
RemoveGizmoFromNode
HasGizmoAttached

◆ AllowRotationOff()

virtual void mitk::Gizmo::AllowRotationOff ( )
virtual

◆ AllowRotationOn()

virtual void mitk::Gizmo::AllowRotationOn ( )
virtual

Toggle whether rotation handles are enabled.

◆ AllowScalingOff()

virtual void mitk::Gizmo::AllowScalingOff ( )
virtual

◆ AllowScalingOn()

virtual void mitk::Gizmo::AllowScalingOn ( )
virtual

Toggle whether scaling handles are enabled.

◆ AllowTranslationOff()

virtual void mitk::Gizmo::AllowTranslationOff ( )
virtual

◆ AllowTranslationOn()

virtual void mitk::Gizmo::AllowTranslationOn ( )
virtual

Toggle whether translation handles are enabled.

◆ BuildGizmo()

vtkSmartPointer<vtkPolyData> mitk::Gizmo::BuildGizmo ( )
protected

Build the vtkPolyData that visually represents the gizmo.

Constructs axis shafts, arrow cones, rings, and a center sphere based on the current center, axes, radius, and permission flags. Each part is assigned scalar point data encoding its HandleType.

Returns
A new vtkPolyData with the complete gizmo geometry.

◆ FollowGeometry()

void mitk::Gizmo::FollowGeometry ( BaseGeometry *  geom)

Begin observing a geometry for automatic gizmo updates.

Registers an ITK observer on the given geometry's ModifiedEvent. Whenever the geometry changes, the gizmo automatically re-reads center, axes, and radius from the geometry and rebuilds itself.

Parameters
[in]geomThe geometry to follow. Must not be nullptr.
Precondition
geom is a valid, initialized BaseGeometry.
Postcondition
The gizmo reflects the current state of geom.
See also
OnFollowedGeometryModified

◆ GetAllowRotation()

virtual bool mitk::Gizmo::GetAllowRotation ( ) const
virtual

Get whether rotation handles are enabled.

◆ GetAllowScaling()

virtual bool mitk::Gizmo::GetAllowScaling ( ) const
virtual

Get whether scaling handles are enabled.

◆ GetAllowTranslation()

virtual bool mitk::Gizmo::GetAllowTranslation ( ) const
virtual

Get whether translation handles are enabled.

◆ GetAxisX()

virtual Vector3D mitk::Gizmo::GetAxisX ( ) const
virtual

Get the normalized X axis direction vector.

◆ GetAxisY()

virtual Vector3D mitk::Gizmo::GetAxisY ( ) const
virtual

Get the normalized Y axis direction vector.

◆ GetAxisZ()

virtual Vector3D mitk::Gizmo::GetAxisZ ( ) const
virtual

Get the normalized Z axis direction vector.

◆ GetCenter()

virtual Point3D mitk::Gizmo::GetCenter ( ) const
virtual

Get the center point of the gizmo.

◆ GetHandleFromPointDataValue()

mitk::Gizmo::HandleType mitk::Gizmo::GetHandleFromPointDataValue ( double  value)

Identify the gizmo handle from a point data scalar value.

Maps a double scalar value (as stored in the vtkPolyData point data) to the corresponding HandleType enumeration value.

Parameters
[in]valueThe scalar value from the point data array.
Returns
The matching HandleType, or NoHandle if no match is found.
See also
GetHandleFromPointID

◆ GetHandleFromPointID()

HandleType mitk::Gizmo::GetHandleFromPointID ( vtkIdType  id)

Identify the gizmo handle that corresponds to a picked VTK point ID.

Looks up the scalar data value assigned to the given point in the underlying vtkPolyData and maps it to a HandleType.

Parameters
[in]idThe VTK point ID obtained from picking.
Returns
The HandleType for the picked point, or NoHandle if identification fails.
Precondition
The gizmo's vtkPolyData and its point scalars must be valid.
See also
GetHandleFromPointDataValue

◆ GetLongestRadius()

double mitk::Gizmo::GetLongestRadius ( ) const

Return the longest of the three axis radii.

Returns
The maximum value among m_Radius[0], m_Radius[1], and m_Radius[2].

◆ GetRadius()

virtual Vector3D mitk::Gizmo::GetRadius ( ) const
virtual

Get the radius vector (half-extent per axis in mm).

◆ HandleTypeToString()

static std::string mitk::Gizmo::HandleTypeToString ( HandleType  type)
static

Convert a HandleType value to a human-readable string.

Useful for logging, debugging, and diagnostic output.

Parameters
[in]typeThe handle type to convert.
Returns
A string representation of the handle type, or "InvalidHandleType" if the value is unrecognized.

◆ HasGizmoAttached()

static bool mitk::Gizmo::HasGizmoAttached ( mitk::DataNode *  node,
DataStorage *  storage 
)
static

Check whether a gizmo is attached to the given node.

Searches for Gizmo-typed child nodes of node in storage.

Parameters
[in]nodeThe node to check.
[in]storageThe DataStorage to search in.
Returns
true if at least one Gizmo child node exists; false otherwise.
See also
AddGizmoToNode
RemoveGizmoFromNode

◆ mitkClassMacro()

mitk::Gizmo::mitkClassMacro ( Gizmo  ,
Surface   
)

◆ New()

static Pointer mitk::Gizmo::New ( )
static

◆ OnFollowedGeometryModified()

void mitk::Gizmo::OnFollowedGeometryModified ( )

ITK callback invoked when the followed geometry is modified.

Re-reads center, axes, and radius from the followed geometry and calls UpdateRepresentation(). This is registered via FollowGeometry().

See also
FollowGeometry

◆ operator=()

Gizmo& mitk::Gizmo::operator= ( const Gizmo &  )
protected

◆ RemoveGizmoFromNode()

static bool mitk::Gizmo::RemoveGizmoFromNode ( DataNode *  node,
DataStorage *  storage 
)
static

Remove a previously attached gizmo from a data node.

Finds any Gizmo child nodes of node in storage, removes them, and restores the original opacity of the manipulated object.

Parameters
[in]nodeThe node being currently manipulated.
[in]storageThe DataStorage where the gizmo was added.
Returns
true if at least one gizmo was found and removed; false otherwise.
Note
Pass the same parameters that were provided to AddGizmoToNode().
See also
AddGizmoToNode
HasGizmoAttached

◆ SetAllowRotation()

virtual void mitk::Gizmo::SetAllowRotation ( bool  _arg)
virtual

Set whether rotation handles are enabled.

◆ SetAllowScaling()

virtual void mitk::Gizmo::SetAllowScaling ( bool  _arg)
virtual

Set whether scaling handles are enabled.

◆ SetAllowTranslation()

virtual void mitk::Gizmo::SetAllowTranslation ( bool  _arg)
virtual

Set whether translation handles are enabled.

◆ SetAxisX()

virtual void mitk::Gizmo::SetAxisX ( Vector3D  _arg)
virtual

Set the X axis direction vector.

◆ SetAxisY()

virtual void mitk::Gizmo::SetAxisY ( Vector3D  _arg)
virtual

Set the Y axis direction vector.

◆ SetAxisZ()

virtual void mitk::Gizmo::SetAxisZ ( Vector3D  _arg)
virtual

Set the Z axis direction vector.

◆ SetCenter()

virtual void mitk::Gizmo::SetCenter ( Point3D  _arg)
virtual

Set the center point of the gizmo.

◆ SetRadius()

virtual void mitk::Gizmo::SetRadius ( Vector3D  _arg)
virtual

Set the radius vector (half-extent per axis in mm).

◆ UpdateRepresentation()

void mitk::Gizmo::UpdateRepresentation ( )

Rebuild the VTK surface representation after property changes.

Call this after modifying center, axes, radius, or permission flags to regenerate the underlying vtkPolyData and update the bounding box.


The documentation for this class was generated from the following file: