Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::VectorProperty< DATATYPE > Class Template Reference

Property for storing a std::vector of values. More...

#include <mitkVectorProperty.h>

Inheritance diagram for mitk::VectorProperty< DATATYPE >:
Collaboration diagram for mitk::VectorProperty< DATATYPE >:

Public Types

typedef std::vector< DATATYPE > VectorType
 The type of the std::vector stored by this property. More...
 
typedef VectorProperty< DATATYPE > Self
 
typedef BaseProperty SuperClass
 
typedef itk::SmartPointer< Self > Pointer
 
typedef itk::SmartPointer< const Self > ConstPointer
 

Public Member Functions

std::vector< std::string > GetClassHierarchy () const override
 
const char * GetNameOfClass () const override
 
Pointer Clone () const
 
std::string GetValueAsString () const override
 Return the property value as a human-readable string. More...
 
virtual const VectorType & GetValue () const
 Get a const reference to the contained vector. More...
 
virtual void SetValue (const VectorType &parameter_vector)
 Set the content vector. More...
 
bool ToJSON (nlohmann::json &j) const override
 Serialize the vector to JSON as a JSON array. More...
 
bool FromJSON (const nlohmann::json &j) override
 Deserialize the vector from a JSON array. 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 const char * GetStaticNameOfClass ()
 Return the static class name including the type-dependent prefix. More...
 
static Pointer New ()
 

Protected Member Functions

 VectorProperty ()=default
 
 VectorProperty (const Self &other)
 
 mitkCloneMacro (Self)
 
- Protected Member Functions inherited from mitk::BaseProperty
 BaseProperty ()
 
 BaseProperty (const BaseProperty &other)
 
 ~BaseProperty () override
 

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

template<typename DATATYPE>
class mitk::VectorProperty< DATATYPE >

Property for storing a std::vector of values.

Templated over the data type of the std::vector that is held by this class. Setting and getting of std::vectors is implemented by-value.

The class manually expands most of mitkClassMacro to specifically override GetNameOfClass() and GetStaticNameOfClass() in order to return type-dependent class names (e.g., "DoubleVectorProperty", "IntVectorProperty"). This is essential for serialization.

Template Parameters
DATATYPEThe element type of the stored vector.
See also
BaseProperty
VectorPropertyDataType

Definition at line 61 of file mitkVectorProperty.h.

Member Typedef Documentation

◆ ConstPointer

template<typename DATATYPE >
typedef itk::SmartPointer<const Self> mitk::VectorProperty< DATATYPE >::ConstPointer

Definition at line 74 of file mitkVectorProperty.h.

◆ Pointer

template<typename DATATYPE >
typedef itk::SmartPointer<Self> mitk::VectorProperty< DATATYPE >::Pointer

Definition at line 73 of file mitkVectorProperty.h.

◆ Self

template<typename DATATYPE >
typedef VectorProperty<DATATYPE> mitk::VectorProperty< DATATYPE >::Self

Definition at line 71 of file mitkVectorProperty.h.

◆ SuperClass

template<typename DATATYPE >
typedef BaseProperty mitk::VectorProperty< DATATYPE >::SuperClass

Definition at line 72 of file mitkVectorProperty.h.

◆ VectorType

template<typename DATATYPE >
typedef std::vector<DATATYPE> mitk::VectorProperty< DATATYPE >::VectorType

The type of the std::vector stored by this property.

Definition at line 65 of file mitkVectorProperty.h.

Constructor & Destructor Documentation

◆ VectorProperty() [1/2]

template<typename DATATYPE >
mitk::VectorProperty< DATATYPE >::VectorProperty ( )
protecteddefault

◆ VectorProperty() [2/2]

template<typename DATATYPE >
mitk::VectorProperty< DATATYPE >::VectorProperty ( const Self &  other)
inlineprotected

Definition at line 137 of file mitkVectorProperty.h.

Member Function Documentation

◆ Clone()

template<typename DATATYPE >
Pointer mitk::VectorProperty< DATATYPE >::Clone ( ) const

◆ FromJSON()

template<typename DATATYPE >
bool mitk::VectorProperty< DATATYPE >::FromJSON ( const nlohmann::json &  j)
overridevirtual

Deserialize the vector from a JSON array.

Parameters
[in]jThe JSON array to read from.
Returns
Always true.

Implements mitk::BaseProperty.

◆ GetClassHierarchy()

template<typename DATATYPE >
std::vector<std::string> mitk::VectorProperty< DATATYPE >::GetClassHierarchy ( ) const
inlineoverride

Definition at line 75 of file mitkVectorProperty.h.

◆ GetNameOfClass()

template<typename DATATYPE >
const char* mitk::VectorProperty< DATATYPE >::GetNameOfClass ( ) const
inlineoverride

Definition at line 92 of file mitkVectorProperty.h.

◆ GetStaticNameOfClass()

template<typename DATATYPE >
static const char* mitk::VectorProperty< DATATYPE >::GetStaticNameOfClass ( )
inlinestatic

Return the static class name including the type-dependent prefix.

This function returns different strings depending on the template parameter, which is required for serialization to work correctly.

Returns
The class name string (e.g., "DoubleVectorProperty").

Definition at line 85 of file mitkVectorProperty.h.

◆ GetValue()

template<typename DATATYPE >
virtual const VectorType& mitk::VectorProperty< DATATYPE >::GetValue ( ) const
virtual

Get a const reference to the contained vector.

Returns
A const reference to the stored vector.

◆ GetValueAsString()

template<typename DATATYPE >
std::string mitk::VectorProperty< DATATYPE >::GetValueAsString ( ) const
overridevirtual

Return the property value as a human-readable string.

Since VectorProperty potentially holds many elements, only the first and last few elements appear in the string. Missing central elements are indicated by an ellipsis ("...").

Returns
A string representation showing the first and last elements.

Reimplemented from mitk::BaseProperty.

◆ mitkCloneMacro()

template<typename DATATYPE >
mitk::VectorProperty< DATATYPE >::mitkCloneMacro ( Self  )
protected

◆ New()

template<typename DATATYPE >
static Pointer mitk::VectorProperty< DATATYPE >::New ( )
static

◆ SetValue()

template<typename DATATYPE >
virtual void mitk::VectorProperty< DATATYPE >::SetValue ( const VectorType &  parameter_vector)
virtual

Set the content vector.

Parameters
[in]parameter_vectorThe new vector to store.

◆ ToJSON()

template<typename DATATYPE >
bool mitk::VectorProperty< DATATYPE >::ToJSON ( nlohmann::json &  j) const
overridevirtual

Serialize the vector to JSON as a JSON array.

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

Implements mitk::BaseProperty.


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