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

Property for storing string values resolved by time step and slice index. More...

#include <mitkTemporoSpatialStringProperty.h>

Inheritance diagram for mitk::TemporoSpatialStringProperty:
Collaboration diagram for mitk::TemporoSpatialStringProperty:

Public Types

typedef ::itk::IndexValueType IndexValueType
 Index type for slice indices. More...
 
typedef std::string ValueType
 The type of the string value stored per time/slice entry. More...
 

Public Member Functions

 mitkClassMacro (TemporoSpatialStringProperty, BaseProperty)
 
Pointer Clone () const
 
 mitkNewMacro1Param (TemporoSpatialStringProperty, const char *)
 
 mitkNewMacro1Param (TemporoSpatialStringProperty, const std::string &)
 
ValueType GetValue () const
 Get the value at the first time step and first slice. More...
 
ValueType GetValue (const TimeStepType &timeStep, const IndexValueType &zSlice, bool allowCloseTime=false, bool allowCloseSlice=false) const
 Get the value for a specific time step and slice. More...
 
ValueType GetValueBySlice (const IndexValueType &zSlice, bool allowClose=false) const
 Get the value for a given slice (time step defaults to 0). More...
 
ValueType GetValueByTimeStep (const TimeStepType &timeStep, bool allowClose=false) const
 Get the value for a given time step (slice defaults to 0). More...
 
bool HasValue () const
 Check whether any values are stored. More...
 
bool HasValue (const TimeStepType &timeStep, const IndexValueType &zSlice, bool allowCloseTime=false, bool allowCloseSlice=false) const
 Check whether a value exists for the given time step and slice. More...
 
bool HasValueBySlice (const IndexValueType &zSlice, bool allowClose=false) const
 Check whether a value exists for the given slice. More...
 
bool HasValueByTimeStep (const TimeStepType &timeStep, bool allowClose=false) const
 Check whether a value exists for the given time step. More...
 
std::vector< IndexValueType > GetAvailableSlices (const TimeStepType &timeStep) const
 Get all slice indices stored for the specified time step. More...
 
std::vector< TimeStepType > GetAvailableTimeSteps (const IndexValueType &slice) const
 Get all time steps that contain a value for the specified slice. More...
 
std::vector< TimeStepType > GetAvailableTimeSteps () const
 Get all time steps stored in the property. More...
 
std::vector< IndexValueType > GetAvailableSlices () const
 Get all unique slice indices across all time steps. More...
 
void SetValue (const TimeStepType &timeStep, const IndexValueType &zSlice, const ValueType &value)
 Set a value for a specific time step and slice. More...
 
void SetValue (const ValueType &value)
 Set a uniform value (stored at time step 0, slice 0). More...
 
std::string GetValueAsString () const override
 Return the value at the first time step and slice as a string. More...
 
bool IsUniform () const
 Check whether all stored values are identical. More...
 
bool ToJSON (nlohmann::json &j) const override
 Serialize the property to JSON. More...
 
bool FromJSON (const nlohmann::json &j) override
 Deserialize the property from JSON. More...
 
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 Types

typedef std::map< IndexValueType, std::string > SliceMapType
 
typedef std::map< TimeStepType, SliceMapType > TimeMapType
 

Protected Member Functions

 TemporoSpatialStringProperty (const char *string=nullptr)
 
 TemporoSpatialStringProperty (const std::string &s)
 
 TemporoSpatialStringProperty (const TemporoSpatialStringProperty &)
 
std::pair< bool, ValueType > CheckValue (const TimeStepType &timeStep, const IndexValueType &zSlice, bool allowCloseTime=false, bool allowCloseSlice=false) const
 
 mitkCloneMacro (TemporoSpatialStringProperty)
 
- Protected Member Functions inherited from mitk::BaseProperty
 BaseProperty ()
 
 BaseProperty (const BaseProperty &other)
 
 ~BaseProperty () override
 

Protected Attributes

TimeMapType m_Values
 

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 string values resolved by time step and slice index.

This property can hold different string values for each combination of time step and z-slice index, making it suitable for DICOM metadata that varies across slices or time points (e.g., per-slice acquisition parameters). When constructed with a single string, the value is stored at time step 0, slice 0.

See also
BaseProperty
StringProperty

Definition at line 38 of file mitkTemporoSpatialStringProperty.h.

Member Typedef Documentation

◆ IndexValueType

Index type for slice indices.

Definition at line 42 of file mitkTemporoSpatialStringProperty.h.

◆ SliceMapType

typedef std::map<IndexValueType, std::string> mitk::TemporoSpatialStringProperty::SliceMapType
protected

Definition at line 228 of file mitkTemporoSpatialStringProperty.h.

◆ TimeMapType

◆ ValueType

The type of the string value stored per time/slice entry.

Definition at line 45 of file mitkTemporoSpatialStringProperty.h.

Constructor & Destructor Documentation

◆ TemporoSpatialStringProperty() [1/3]

mitk::TemporoSpatialStringProperty::TemporoSpatialStringProperty ( const char *  string = nullptr)
protected

◆ TemporoSpatialStringProperty() [2/3]

mitk::TemporoSpatialStringProperty::TemporoSpatialStringProperty ( const std::string &  s)
protected

◆ TemporoSpatialStringProperty() [3/3]

mitk::TemporoSpatialStringProperty::TemporoSpatialStringProperty ( const TemporoSpatialStringProperty &  )
protected

Member Function Documentation

◆ CheckValue()

std::pair<bool, ValueType> mitk::TemporoSpatialStringProperty::CheckValue ( const TimeStepType &  timeStep,
const IndexValueType &  zSlice,
bool  allowCloseTime = false,
bool  allowCloseSlice = false 
) const
protected

◆ Clone()

Pointer mitk::TemporoSpatialStringProperty::Clone ( ) const

◆ FromJSON()

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

Deserialize the property from JSON.

Reads the condensed JSON representation and expands time step/slice ranges into individual value entries.

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

Implements mitk::BaseProperty.

◆ GetAvailableSlices() [1/2]

std::vector<IndexValueType> mitk::TemporoSpatialStringProperty::GetAvailableSlices ( ) const

Get all unique slice indices across all time steps.

Note
Not all time steps may contain all slices.
Returns
A sorted vector of unique slice indices.

◆ GetAvailableSlices() [2/2]

std::vector<IndexValueType> mitk::TemporoSpatialStringProperty::GetAvailableSlices ( const TimeStepType &  timeStep) const

Get all slice indices stored for the specified time step.

Parameters
[in]timeStepThe time step to query.
Returns
A vector of slice indices. Empty if the time step does not exist.

◆ GetAvailableTimeSteps() [1/2]

std::vector<TimeStepType> mitk::TemporoSpatialStringProperty::GetAvailableTimeSteps ( ) const

Get all time steps stored in the property.

Returns
A vector of all time steps.

◆ GetAvailableTimeSteps() [2/2]

std::vector<TimeStepType> mitk::TemporoSpatialStringProperty::GetAvailableTimeSteps ( const IndexValueType &  slice) const

Get all time steps that contain a value for the specified slice.

Parameters
[in]sliceThe z-slice index to query.
Returns
A vector of time steps.

◆ GetValue() [1/2]

ValueType mitk::TemporoSpatialStringProperty::GetValue ( ) const

Get the value at the first time step and first slice.

Returns
The string value, or an empty string if no values exist.

◆ GetValue() [2/2]

ValueType mitk::TemporoSpatialStringProperty::GetValue ( const TimeStepType &  timeStep,
const IndexValueType &  zSlice,
bool  allowCloseTime = false,
bool  allowCloseSlice = false 
) const

Get the value for a specific time step and slice.

Parameters
[in]timeStepThe time step to query.
[in]zSliceThe z-slice index to query.
[in]allowCloseTimeIf true, the closest earlier time step is used when the exact time step is not found.
[in]allowCloseSliceIf true, the closest earlier slice is used when the exact slice is not found.
Returns
The string value, or an empty string if nothing was found.

◆ GetValueAsString()

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

Return the value at the first time step and slice as a string.

Returns
The string value (same as GetValue()).

Reimplemented from mitk::BaseProperty.

◆ GetValueBySlice()

ValueType mitk::TemporoSpatialStringProperty::GetValueBySlice ( const IndexValueType &  zSlice,
bool  allowClose = false 
) const

Get the value for a given slice (time step defaults to 0).

Parameters
[in]zSliceThe z-slice index to query.
[in]allowCloseIf true, allows finding the closest slice.
Returns
The string value, or an empty string if not found.

◆ GetValueByTimeStep()

ValueType mitk::TemporoSpatialStringProperty::GetValueByTimeStep ( const TimeStepType &  timeStep,
bool  allowClose = false 
) const

Get the value for a given time step (slice defaults to 0).

Parameters
[in]timeStepThe time step to query.
[in]allowCloseIf true, allows finding the closest time step.
Returns
The string value, or an empty string if not found.

◆ HasValue() [1/2]

bool mitk::TemporoSpatialStringProperty::HasValue ( ) const

Check whether any values are stored.

Returns
true if at least one value exists, false otherwise.

◆ HasValue() [2/2]

bool mitk::TemporoSpatialStringProperty::HasValue ( const TimeStepType &  timeStep,
const IndexValueType &  zSlice,
bool  allowCloseTime = false,
bool  allowCloseSlice = false 
) const

Check whether a value exists for the given time step and slice.

Parameters
[in]timeStepThe time step to check.
[in]zSliceThe z-slice index to check.
[in]allowCloseTimeIf true, allows finding the closest time step.
[in]allowCloseSliceIf true, allows finding the closest slice.
Returns
true if a matching value exists, false otherwise.

◆ HasValueBySlice()

bool mitk::TemporoSpatialStringProperty::HasValueBySlice ( const IndexValueType &  zSlice,
bool  allowClose = false 
) const

Check whether a value exists for the given slice.

Parameters
[in]zSliceThe z-slice index to check.
[in]allowCloseIf true, allows finding the closest slice.
Returns
true if a matching value exists, false otherwise.

◆ HasValueByTimeStep()

bool mitk::TemporoSpatialStringProperty::HasValueByTimeStep ( const TimeStepType &  timeStep,
bool  allowClose = false 
) const

Check whether a value exists for the given time step.

Parameters
[in]timeStepThe time step to check.
[in]allowCloseIf true, allows finding the closest time step.
Returns
true if a matching value exists, false otherwise.

◆ IsUniform()

bool mitk::TemporoSpatialStringProperty::IsUniform ( ) const

Check whether all stored values are identical.

If true, GetValueAsString() returns the complete information without loss.

Returns
true if all values across all time steps and slices are equal, false if at least one value differs.

◆ mitkClassMacro()

mitk::TemporoSpatialStringProperty::mitkClassMacro ( TemporoSpatialStringProperty  ,
BaseProperty   
)

◆ mitkCloneMacro()

mitk::TemporoSpatialStringProperty::mitkCloneMacro ( TemporoSpatialStringProperty  )
protected

◆ mitkNewMacro1Param() [1/2]

mitk::TemporoSpatialStringProperty::mitkNewMacro1Param ( TemporoSpatialStringProperty  ,
const char *   
)

◆ mitkNewMacro1Param() [2/2]

mitk::TemporoSpatialStringProperty::mitkNewMacro1Param ( TemporoSpatialStringProperty  ,
const std::string &   
)

◆ New()

static Pointer mitk::TemporoSpatialStringProperty::New ( )
static

◆ operator=()

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

◆ SetValue() [1/2]

void mitk::TemporoSpatialStringProperty::SetValue ( const TimeStepType &  timeStep,
const IndexValueType &  zSlice,
const ValueType &  value 
)

Set a value for a specific time step and slice.

If the time step or slice does not exist yet, it is created.

Parameters
[in]timeStepThe time step to set.
[in]zSliceThe z-slice index to set.
[in]valueThe string value to store.

◆ SetValue() [2/2]

void mitk::TemporoSpatialStringProperty::SetValue ( const ValueType &  value)

Set a uniform value (stored at time step 0, slice 0).

Clears all existing values and stores the given value at time step 0, slice 0.

Parameters
[in]valueThe string value to store.

◆ ToJSON()

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

Serialize the property to JSON.

Serializes the values as a condensed JSON representation, grouping consecutive time steps and slices with identical values.

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

Implements mitk::BaseProperty.

Member Data Documentation

◆ m_Values

TimeMapType mitk::TemporoSpatialStringProperty::m_Values
protected

Definition at line 231 of file mitkTemporoSpatialStringProperty.h.


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