Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::ROI::Element Class Reference

Encapsulates a single (possibly time-resolved) ROI. More...

#include <mitkROI.h>

Inheritance diagram for mitk::ROI::Element:
Collaboration diagram for mitk::ROI::Element:

Public Types

using PointsType = std::map< TimeStepType, Point3D >
 Map from time steps to 3D points (used for min/max corners). More...
 
using PropertyListsType = std::map< TimeStepType, PropertyList::Pointer >
 Map from time steps to property lists. More...
 

Public Member Functions

 Element ()
 Default constructor. Initializes the element with ID 0. More...
 
 Element (unsigned int id)
 Construct an element with the given unique ID. More...
 
 Element (const Element &other)
 Copy constructor. Deep-copies all properties. More...
 
Element & operator= (Element other)
 Copy-and-swap assignment operator. More...
 
 ~Element ()=default
 
BaseProperty::ConstPointer GetConstProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const override
 Get a const property by key and optional context. More...
 
BaseProperty::ConstPointer GetConstProperty (const std::string &propertyKey, TimeStepType t, bool fallBackOnDefaultContext=true) const
 Get a const property by key and time step. More...
 
std::vector< std::string > GetPropertyKeys (const std::string &contextName="", bool includeDefaultContext=false) const override
 Get all property keys for a given context. More...
 
std::vector< std::string > GetPropertyKeys (TimeStepType t, bool includeDefaultContext=false) const
 Get all property keys for a given time step. More...
 
std::vector< std::string > GetPropertyContextNames () const override
 Get all property context names (stringified time steps). More...
 
BaseProperty * GetNonConstProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) override
 Get a mutable property by key and optional context. More...
 
BaseProperty * GetNonConstProperty (const std::string &propertyKey, TimeStepType t, bool fallBackOnDefaultContext=true)
 Get a mutable property by key and time step. More...
 
void SetProperty (const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
 Set a property for a given context. More...
 
void SetProperty (const std::string &propertyKey, BaseProperty *property, TimeStepType t, bool fallBackOnDefaultContext=false)
 Set a property at a specific time step. More...
 
void RemoveProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
 Remove a property from a given context. More...
 
void RemoveProperty (const std::string &propertyKey, TimeStepType t, bool fallBackOnDefaultContext=false)
 Remove a property at a specific time step. More...
 
unsigned int GetID () const
 Get the unique ID of this ROI element. More...
 
void SetID (unsigned int id)
 Set the unique ID of this ROI element. More...
 
bool HasTimeStep (TimeStepType t) const
 Check if the ROI is defined for a certain time step. More...
 
bool HasTimeSteps () const
 Check if the ROI can be considered time-resolved. More...
 
std::vector< TimeStepType > GetTimeSteps () const
 Get all valid time steps that have a minimum point and a maximum point. More...
 
Point3D GetMin (TimeStepType t=0) const
 Get the minimum corner point of the axis-aligned bounding box. More...
 
void SetMin (const Point3D &min, TimeStepType t=0)
 Set the minimum corner point of the axis-aligned bounding box. More...
 
Point3D GetMax (TimeStepType t=0) const
 Get the maximum corner point of the axis-aligned bounding box. More...
 
void SetMax (const Point3D &max, TimeStepType t=0)
 Set the maximum corner point of the axis-aligned bounding box. More...
 
PropertyList * GetDefaultProperties () const
 Get the default (time-step-independent) property list. More...
 
void SetDefaultProperties (PropertyList *properties)
 Set the default property list. More...
 
PropertyList * GetProperties (TimeStepType t=0) const
 Get properties for a certain time step or nullptr if absent. More...
 
void SetProperties (PropertyList *properties, TimeStepType t=0)
 Set the property list for a specific time step. 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...
 

Detailed Description

Encapsulates a single (possibly time-resolved) ROI.

See also
ROI

Definition at line 65 of file mitkROI.h.

Member Typedef Documentation

◆ PointsType

Map from time steps to 3D points (used for min/max corners).

Definition at line 69 of file mitkROI.h.

◆ PropertyListsType

using mitk::ROI::Element::PropertyListsType = std::map<TimeStepType, PropertyList::Pointer>

Map from time steps to property lists.

Definition at line 72 of file mitkROI.h.

Constructor & Destructor Documentation

◆ Element() [1/3]

mitk::ROI::Element::Element ( )

Default constructor. Initializes the element with ID 0.

◆ Element() [2/3]

mitk::ROI::Element::Element ( unsigned int  id)
explicit

Construct an element with the given unique ID.

Parameters
[in]idThe unique identifier for this ROI element.

◆ Element() [3/3]

mitk::ROI::Element::Element ( const Element &  other)

Copy constructor. Deep-copies all properties.

Parameters
[in]otherThe element to copy from.

◆ ~Element()

mitk::ROI::Element::~Element ( )
default

Member Function Documentation

◆ GetConstProperty() [1/2]

BaseProperty::ConstPointer mitk::ROI::Element::GetConstProperty ( const std::string &  propertyKey,
const std::string &  contextName = "",
bool  fallBackOnDefaultContext = true 
) const
overridevirtual

Get a const property by key and optional context.

Parameters
[in]propertyKeyThe key of the property to retrieve.
[in]contextNameThe context (stringified time step) to look up. An empty string addresses the default properties.
[in]fallBackOnDefaultContextIf true and the property is not found in the specified context, fall back to the default properties.
Returns
The property, or nullptr if not found.
Note
A time step can be specified as context. Use std::to_string() to convert a time step to a context name.

Implements mitk::IPropertyProvider.

Referenced by mitk::ROIMapperHelper::GetConstProperty().

◆ GetConstProperty() [2/2]

BaseProperty::ConstPointer mitk::ROI::Element::GetConstProperty ( const std::string &  propertyKey,
TimeStepType  t,
bool  fallBackOnDefaultContext = true 
) const

Get a const property by key and time step.

Parameters
[in]propertyKeyThe key of the property to retrieve.
[in]tThe time step to look up.
[in]fallBackOnDefaultContextIf true and the property is not found at time step t, fall back to the default properties.
Returns
The property, or nullptr if not found.

◆ GetDefaultProperties()

PropertyList* mitk::ROI::Element::GetDefaultProperties ( ) const

Get the default (time-step-independent) property list.

Returns
Pointer to the default property list. Never nullptr.

◆ GetID()

unsigned int mitk::ROI::Element::GetID ( ) const

Get the unique ID of this ROI element.

Returns
The unique identifier.

◆ GetMax()

Point3D mitk::ROI::Element::GetMax ( TimeStepType  t = 0) const

Get the maximum corner point of the axis-aligned bounding box.

Parameters
[in]tThe time step to query (default: 0).
Returns
The maximum corner point in index coordinates.
Exceptions
std::out_of_rangeif the time step does not exist.

◆ GetMin()

Point3D mitk::ROI::Element::GetMin ( TimeStepType  t = 0) const

Get the minimum corner point of the axis-aligned bounding box.

Parameters
[in]tThe time step to query (default: 0).
Returns
The minimum corner point in index coordinates.
Exceptions
std::out_of_rangeif the time step does not exist.

◆ GetNonConstProperty() [1/2]

BaseProperty* mitk::ROI::Element::GetNonConstProperty ( const std::string &  propertyKey,
const std::string &  contextName = "",
bool  fallBackOnDefaultContext = true 
)
overridevirtual

Get a mutable property by key and optional context.

Parameters
[in]propertyKeyThe key of the property to retrieve.
[in]contextNameThe context (stringified time step) to look up. An empty string addresses the default properties.
[in]fallBackOnDefaultContextIf true and the property is not found in the specified context, fall back to the default properties.
Returns
Pointer to the property, or nullptr if not found.
Note
A time step can be specified as context. Use std::to_string() to convert a time step to a context name.

Implements mitk::IPropertyOwner.

◆ GetNonConstProperty() [2/2]

BaseProperty* mitk::ROI::Element::GetNonConstProperty ( const std::string &  propertyKey,
TimeStepType  t,
bool  fallBackOnDefaultContext = true 
)

Get a mutable property by key and time step.

Parameters
[in]propertyKeyThe key of the property to retrieve.
[in]tThe time step to look up.
[in]fallBackOnDefaultContextIf true and the property is not found at time step t, fall back to the default properties.
Returns
Pointer to the property, or nullptr if not found.

◆ GetProperties()

PropertyList* mitk::ROI::Element::GetProperties ( TimeStepType  t = 0) const

Get properties for a certain time step or nullptr if absent.

◆ GetPropertyContextNames()

std::vector<std::string> mitk::ROI::Element::GetPropertyContextNames ( ) const
overridevirtual

Get all property context names (stringified time steps).

Implements mitk::IPropertyProvider.

◆ GetPropertyKeys() [1/2]

std::vector<std::string> mitk::ROI::Element::GetPropertyKeys ( const std::string &  contextName = "",
bool  includeDefaultContext = false 
) const
overridevirtual

Get all property keys for a given context.

Parameters
[in]contextNameThe context (stringified time step) to query. An empty string addresses the default properties.
[in]includeDefaultContextIf true, also include keys from the default properties.
Returns
A vector of property key strings.
Note
A time step can be specified as context. Use std::to_string() to convert a time step to a context name.

Implements mitk::IPropertyProvider.

◆ GetPropertyKeys() [2/2]

std::vector<std::string> mitk::ROI::Element::GetPropertyKeys ( TimeStepType  t,
bool  includeDefaultContext = false 
) const

Get all property keys for a given time step.

Parameters
[in]tThe time step to query.
[in]includeDefaultContextIf true, also include keys from the default properties that are not already present at time step t.
Returns
A vector of property key strings.

◆ GetTimeSteps()

std::vector<TimeStepType> mitk::ROI::Element::GetTimeSteps ( ) const

Get all valid time steps that have a minimum point and a maximum point.

◆ HasTimeStep()

bool mitk::ROI::Element::HasTimeStep ( TimeStepType  t) const

Check if the ROI is defined for a certain time step.

◆ HasTimeSteps()

bool mitk::ROI::Element::HasTimeSteps ( ) const

Check if the ROI can be considered time-resolved.

◆ operator=()

Element& mitk::ROI::Element::operator= ( Element  other)

Copy-and-swap assignment operator.

Parameters
[in]otherThe element to assign from (passed by value for copy-and-swap).
Returns
Reference to this element.

◆ RemoveProperty() [1/2]

void mitk::ROI::Element::RemoveProperty ( const std::string &  propertyKey,
const std::string &  contextName = "",
bool  fallBackOnDefaultContext = false 
)
overridevirtual

Remove a property from a given context.

Parameters
[in]propertyKeyThe key of the property to remove.
[in]contextNameThe context (stringified time step) to remove the property from. An empty string addresses the default properties.
[in]fallBackOnDefaultContextIf true and the specified context does not exist, remove the property from the default properties instead.
Note
A time step can be specified as context. Use std::to_string() to convert a time step to a context name.

Implements mitk::IPropertyOwner.

◆ RemoveProperty() [2/2]

void mitk::ROI::Element::RemoveProperty ( const std::string &  propertyKey,
TimeStepType  t,
bool  fallBackOnDefaultContext = false 
)

Remove a property at a specific time step.

Parameters
[in]propertyKeyThe key of the property to remove.
[in]tThe time step from which to remove the property.
[in]fallBackOnDefaultContextIf true and the time step does not exist, remove the property from the default properties. If false and the time step does not exist, an exception is thrown.
Exceptions
mitk::Exceptionif fallBackOnDefaultContext is false and the time step does not exist.

◆ SetDefaultProperties()

void mitk::ROI::Element::SetDefaultProperties ( PropertyList *  properties)

Set the default property list.

Parameters
[in]propertiesThe property list to use as defaults. If nullptr, a new empty property list is created.

◆ SetID()

void mitk::ROI::Element::SetID ( unsigned int  id)

Set the unique ID of this ROI element.

Parameters
[in]idThe unique identifier to assign. Must be unique within the parent ROI collection.

◆ SetMax()

void mitk::ROI::Element::SetMax ( const Point3D &  max,
TimeStepType  t = 0 
)

Set the maximum corner point of the axis-aligned bounding box.

Parameters
[in]maxThe maximum corner point in index coordinates.
[in]tThe time step to set (default: 0).

◆ SetMin()

void mitk::ROI::Element::SetMin ( const Point3D &  min,
TimeStepType  t = 0 
)

Set the minimum corner point of the axis-aligned bounding box.

Parameters
[in]minThe minimum corner point in index coordinates.
[in]tThe time step to set (default: 0).

◆ SetProperties()

void mitk::ROI::Element::SetProperties ( PropertyList *  properties,
TimeStepType  t = 0 
)

Set the property list for a specific time step.

Parameters
[in]propertiesThe property list to assign.
[in]tThe time step to associate the properties with (default: 0).

◆ SetProperty() [1/2]

void mitk::ROI::Element::SetProperty ( const std::string &  propertyKey,
BaseProperty *  property,
const std::string &  contextName = "",
bool  fallBackOnDefaultContext = false 
)
overridevirtual

Set a property for a given context.

Parameters
[in]propertyKeyThe key of the property to set.
[in]propertyThe property value to assign.
[in]contextNameThe context (stringified time step) to set the property in. An empty string addresses the default properties.
[in]fallBackOnDefaultContextIf true and the specified context does not exist, set the property in the default properties instead.
Note
A time step can be specified as context. Use std::to_string() to convert a time step to a context name.

Implements mitk::IPropertyOwner.

◆ SetProperty() [2/2]

void mitk::ROI::Element::SetProperty ( const std::string &  propertyKey,
BaseProperty *  property,
TimeStepType  t,
bool  fallBackOnDefaultContext = false 
)

Set a property at a specific time step.

Parameters
[in]propertyKeyThe key of the property to set.
[in]propertyThe property value to assign.
[in]tThe time step at which to set the property.
[in]fallBackOnDefaultContextIf true and the time step does not exist, set the property in the default properties. If false and the time step does not exist, an exception is thrown.
Exceptions
mitk::Exceptionif fallBackOnDefaultContext is false and the time step does not exist.

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