|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
Abstract base class for properties. More...
#include <mitkBaseProperty.h>


Public Member Functions | |
| 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... | |
| virtual std::string | GetValueAsString () const |
| Return the property value as a human-readable string. More... | |
| virtual bool | ToJSON (nlohmann::json &j) const =0 |
| Serialize property value(s) to JSON. More... | |
| virtual bool | FromJSON (const nlohmann::json &j)=0 |
| Deserialize property value(s) from JSON. More... | |
Static Public Attributes | |
| static const std::string | VALUE_CANNOT_BE_CONVERTED_TO_STRING |
| Default return value for properties that cannot be converted to a string. More... | |
Protected Member Functions | |
| BaseProperty () | |
| BaseProperty (const BaseProperty &other) | |
| ~BaseProperty () override | |
Abstract base class for properties.
Base class for all properties in MITK. Properties represent arbitrary additional information that can be added to a PropertyList and associated with data objects. To define a new type of property, create a subclass of BaseProperty.
Concrete subclasses should define Set-/Get-methods to access the property value, which should be stored by value (not by reference). Subclasses must implement the pure virtual methods IsEqual() and Assign() for comparison and assignment support.
Definition at line 39 of file mitkBaseProperty.h.
|
protected |
|
protected |
|
overrideprotected |
| bool mitk::BaseProperty::AssignProperty | ( | const BaseProperty & | property | ) |
Assign a property value to this instance and report success.
This method is identical to the assignment operator, except for the return type. It allows callers to directly check whether the assignment was successful. The assignment fails if the source and target properties have different types. On success, the property is marked as modified.
| [in] | property | The property whose value should be assigned to this instance. |
true if the assignment was successful (same type), false otherwise.| Pointer mitk::BaseProperty::Clone | ( | ) | const |
|
pure virtual |
Deserialize property value(s) from JSON.
Subclasses must implement this method to restore their value from the provided JSON object. Rely on exceptions for error handling when implementing deserialization.
| [in] | j | The JSON object containing the serialized value. |
false if the property is not deserializable by design, true otherwise. Implemented in mitk::IsoDoseLevelVectorProperty, mitk::IsoDoseLevelSetProperty, mitk::WeakPointerProperty, mitk::VectorProperty< DATATYPE >, mitk::TransferFunctionProperty, mitk::TemporoSpatialStringProperty, mitk::StringProperty, mitk::SmartPointerProperty, mitk::LookupTableProperty, mitk::LevelWindowProperty, mitk::GroupTagProperty, mitk::EnumerationProperty, mitk::ColorProperty, mitk::ClippingProperty, mitk::AnnotationProperty, mitk::GenericProperty< T >, mitk::GenericProperty< double >, mitk::GenericProperty< float >, and mitk::GenericProperty< int >.
|
virtual |
Return the property value as a human-readable string.
The default implementation returns VALUE_CANNOT_BE_CONVERTED_TO_STRING. Subclasses should override this method to provide a meaningful string representation of their value.
Reimplemented in mitk::IsoDoseLevelVectorProperty, mitk::IsoDoseLevelSetProperty, mitk::WeakPointerProperty, mitk::VectorProperty< DATATYPE >, mitk::TransferFunctionProperty, mitk::TemporoSpatialStringProperty, mitk::StringProperty, mitk::SmartPointerProperty, mitk::LookupTableProperty, mitk::LevelWindowProperty, mitk::GenericProperty< T >, mitk::GenericProperty< double >, mitk::GenericProperty< float >, mitk::GenericProperty< int >, mitk::EnumerationProperty, mitk::ColorProperty, mitk::ClippingProperty, and mitk::AnnotationProperty.
| mitk::BaseProperty::mitkClassMacroItkParent | ( | BaseProperty | , |
| itk::Object | |||
| ) |
| BaseProperty& mitk::BaseProperty::operator= | ( | const BaseProperty & | property | ) |
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.
| [in] | property | The property whose value should be assigned to this instance. |
| bool mitk::BaseProperty::operator== | ( | const BaseProperty & | property | ) | const |
Compare two properties for equality.
Checks whether this property is equal to the given property. Two properties are considered equal if they have the same type (checked via typeid) and their subclass-specific IsEqual() method returns true.
| [in] | property | The property to compare against. |
true if both properties are of the same type and have equal values, false otherwise.
|
pure virtual |
Serialize property value(s) to JSON.
Subclasses must implement this method to serialize their value into the provided JSON object. Rely on exceptions for error handling when implementing serialization.
| [out] | j | The JSON object to write the serialized value into. |
false if the property is not serializable by design, true otherwise. Implemented in mitk::IsoDoseLevelVectorProperty, mitk::IsoDoseLevelSetProperty, mitk::WeakPointerProperty, mitk::VectorProperty< DATATYPE >, mitk::TransferFunctionProperty, mitk::TemporoSpatialStringProperty, mitk::StringProperty, mitk::SmartPointerProperty, mitk::LookupTableProperty, mitk::LevelWindowProperty, mitk::GroupTagProperty, mitk::EnumerationProperty, mitk::ColorProperty, mitk::ClippingProperty, mitk::AnnotationProperty, mitk::GenericProperty< T >, mitk::GenericProperty< double >, mitk::GenericProperty< float >, and mitk::GenericProperty< int >.
|
static |
Default return value for properties that cannot be converted to a string.
This constant (value "n/a") is returned by GetValueAsString() in the base implementation to indicate that no string conversion is available.
Definition at line 136 of file mitkBaseProperty.h.