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

Property for storing a text annotation with a 3D position. More...

#include <mitkAnnotationProperty.h>

Inheritance diagram for mitk::AnnotationProperty:
Collaboration diagram for mitk::AnnotationProperty:

Public Types

typedef std::string ValueType
 The type of the label value stored by this property. More...
 

Public Member Functions

 mitkClassMacro (AnnotationProperty, BaseProperty)
 
Pointer Clone () const
 
 mitkNewMacro2Param (AnnotationProperty, const char *, const Point3D &)
 
 mitkNewMacro2Param (AnnotationProperty, const std::string &, const Point3D &)
 
 mitkNewMacro4Param (AnnotationProperty, const char *, ScalarType, ScalarType, ScalarType)
 
 mitkNewMacro4Param (AnnotationProperty, const std::string &, ScalarType, ScalarType, ScalarType)
 
virtual const char * GetLabel () const
 Get the annotation label text. More...
 
virtual void SetLabel (const char *_arg)
 Set the annotation label text. More...
 
const Point3D & GetPosition () const
 Get the 3D position of the annotation. More...
 
void SetPosition (const Point3D &position)
 Set the 3D position of the annotation. More...
 
std::string GetValueAsString () const override
 Return the annotation as a human-readable string. More...
 
bool ToJSON (nlohmann::json &j) const override
 Serialize the annotation to JSON. More...
 
bool FromJSON (const nlohmann::json &j) override
 Deserialize the annotation from JSON. More...
 
virtual BaseProperty & operator= (const BaseProperty &other)
 
BaseProperty & operator= (const BaseProperty &property)
 Assign a property value to this instance. More...
 
- Public Member Functions inherited from mitk::BaseProperty
 mitkClassMacroItkParent (BaseProperty, itk::Object)
 
Pointer Clone () const
 
bool operator== (const BaseProperty &property) const
 Compare two properties for equality. More...
 
BaseProperty & operator= (const BaseProperty &property)
 Assign a property value to this instance. More...
 
bool AssignProperty (const BaseProperty &property)
 Assign a property value to this instance and report success. More...
 

Static Public Member Functions

static Pointer New ()
 

Protected Member Functions

 AnnotationProperty ()
 
 AnnotationProperty (const char *label, const Point3D &position)
 
 AnnotationProperty (const std::string &label, const Point3D &position)
 
 AnnotationProperty (const char *label, ScalarType x, ScalarType y, ScalarType z)
 
 AnnotationProperty (const std::string &label, ScalarType x, ScalarType y, ScalarType z)
 
 AnnotationProperty (const AnnotationProperty &other)
 
 mitkCloneMacro (AnnotationProperty)
 
- Protected Member Functions inherited from mitk::BaseProperty
 BaseProperty ()
 
 BaseProperty (const BaseProperty &other)
 
 ~BaseProperty () override
 

Protected Attributes

std::string m_Label
 
Point3D m_Position
 

Additional Inherited Members

- Static Public Attributes inherited from mitk::BaseProperty
static const std::string VALUE_CANNOT_BE_CONVERTED_TO_STRING
 Default return value for properties that cannot be converted to a string. More...
 

Detailed Description

Property for storing a text annotation with a 3D position.

Combines a text label string with a 3D point position, allowing annotations to be placed at specific locations in world coordinates.

See also
BaseProperty

Definition at line 34 of file mitkAnnotationProperty.h.

Member Typedef Documentation

◆ ValueType

The type of the label value stored by this property.

Definition at line 40 of file mitkAnnotationProperty.h.

Constructor & Destructor Documentation

◆ AnnotationProperty() [1/6]

mitk::AnnotationProperty::AnnotationProperty ( )
protected

◆ AnnotationProperty() [2/6]

mitk::AnnotationProperty::AnnotationProperty ( const char *  label,
const Point3D &  position 
)
protected

◆ AnnotationProperty() [3/6]

mitk::AnnotationProperty::AnnotationProperty ( const std::string &  label,
const Point3D &  position 
)
protected

◆ AnnotationProperty() [4/6]

mitk::AnnotationProperty::AnnotationProperty ( const char *  label,
ScalarType  x,
ScalarType  y,
ScalarType  z 
)
protected

◆ AnnotationProperty() [5/6]

mitk::AnnotationProperty::AnnotationProperty ( const std::string &  label,
ScalarType  x,
ScalarType  y,
ScalarType  z 
)
protected

◆ AnnotationProperty() [6/6]

mitk::AnnotationProperty::AnnotationProperty ( const AnnotationProperty &  other)
protected

Member Function Documentation

◆ Clone()

Pointer mitk::AnnotationProperty::Clone ( ) const

◆ FromJSON()

bool mitk::AnnotationProperty::FromJSON ( const nlohmann::json &  j)
overridevirtual

Deserialize the annotation from JSON.

Reads "Label" and "Position" fields from the JSON object.

Parameters
[in]jThe JSON object containing annotation data.
Returns
Always true.

Implements mitk::BaseProperty.

◆ GetLabel()

virtual const char* mitk::AnnotationProperty::GetLabel ( ) const
virtual

Get the annotation label text.

Returns
The label string.

◆ GetPosition()

const Point3D& mitk::AnnotationProperty::GetPosition ( ) const

Get the 3D position of the annotation.

Returns
A const reference to the position point.

◆ GetValueAsString()

std::string mitk::AnnotationProperty::GetValueAsString ( ) const
overridevirtual

Return the annotation as a human-readable string.

Returns the label text followed by the 3D position coordinates.

Returns
A string representation of the annotation.

Reimplemented from mitk::BaseProperty.

◆ mitkClassMacro()

mitk::AnnotationProperty::mitkClassMacro ( AnnotationProperty  ,
BaseProperty   
)

◆ mitkCloneMacro()

mitk::AnnotationProperty::mitkCloneMacro ( AnnotationProperty  )
protected

◆ mitkNewMacro2Param() [1/2]

mitk::AnnotationProperty::mitkNewMacro2Param ( AnnotationProperty  ,
const char *  ,
const Point3D &   
)

◆ mitkNewMacro2Param() [2/2]

mitk::AnnotationProperty::mitkNewMacro2Param ( AnnotationProperty  ,
const std::string &  ,
const Point3D &   
)

◆ mitkNewMacro4Param() [1/2]

mitk::AnnotationProperty::mitkNewMacro4Param ( AnnotationProperty  ,
const char *  ,
ScalarType  ,
ScalarType  ,
ScalarType   
)

◆ mitkNewMacro4Param() [2/2]

mitk::AnnotationProperty::mitkNewMacro4Param ( AnnotationProperty  ,
const std::string &  ,
ScalarType  ,
ScalarType  ,
ScalarType   
)

◆ New()

static Pointer mitk::AnnotationProperty::New ( )
static

◆ operator=() [1/2]

virtual BaseProperty& mitk::AnnotationProperty::operator= ( const BaseProperty &  other)
inlinevirtual

Definition at line 107 of file mitkAnnotationProperty.h.

◆ operator=() [2/2]

BaseProperty& mitk::BaseProperty::operator=

Assign a property value to this instance.

Performs a polymorphic assignment from the given property. The assignment succeeds only if the source and target properties are of the same type. The subclass-specific Assign() method is called to perform the actual value copy.

Subclasses must implement Assign(const BaseProperty&) and call the superclass Assign method for proper handling. The copy assignment operator of the subclass should be disabled and the base class operator should be made visible using "using" statements.

Parameters
[in]propertyThe property whose value should be assigned to this instance.
Returns
A reference to this property.
See also
AssignProperty
Assign

◆ SetLabel()

virtual void mitk::AnnotationProperty::SetLabel ( const char *  _arg)
virtual

Set the annotation label text.

Parameters
[in]_argThe new label string.

◆ SetPosition()

void mitk::AnnotationProperty::SetPosition ( const Point3D &  position)

Set the 3D position of the annotation.

Marks the property as modified if the new position differs from the current one.

Parameters
[in]positionThe new 3D position.

◆ ToJSON()

bool mitk::AnnotationProperty::ToJSON ( nlohmann::json &  j) const
overridevirtual

Serialize the annotation to JSON.

Serializes both the label and position as a JSON object with "Label" and "Position" fields.

Parameters
[out]jThe JSON object to write the value into.
Returns
Always true.

Implements mitk::BaseProperty.

Member Data Documentation

◆ m_Label

std::string mitk::AnnotationProperty::m_Label
protected

Definition at line 111 of file mitkAnnotationProperty.h.

◆ m_Position

Point3D mitk::AnnotationProperty::m_Position
protected

Definition at line 112 of file mitkAnnotationProperty.h.


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