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

A collection of region of interests (ROIs). More...

#include <mitkROI.h>

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

Classes

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

Public Types

using ElementsType = std::map< unsigned int, Element >
 Map type associating element IDs to their Element objects. More...
 
using Iterator = ElementsType::iterator
 Mutable iterator over ROI elements. More...
 
using ConstIterator = ElementsType::const_iterator
 Const iterator over ROI elements. More...
 
- Public Types inherited from mitk::Identifiable
using UIDType = std::string
 Type alias for unique identifiers. More...
 

Public Member Functions

 mitkClassMacro (ROI, BaseData) static Pointer New()
 
Pointer Clone () const
 
size_t GetNumberOfElements () const
 Get the number of ROI elements in the collection. More...
 
void AddElement (const Element &element)
 Add a ROI::Element to the collection. More...
 
const Element & GetElement (unsigned int id) const
 Get a const reference to an element by its ID. More...
 
Element & GetElement (unsigned int id)
 Get a mutable reference to an element by its ID. More...
 
ConstIterator begin () const
 Get a const iterator to the first element. More...
 
ConstIterator end () const
 Get a const iterator past the last element. More...
 
Iterator begin ()
 Get a mutable iterator to the first element. More...
 
Iterator end ()
 Get a mutable iterator past the last element. More...
 
void SetRequestedRegionToLargestPossibleRegion () override
 Set the requested region to the largest possible region (no-op for ROI). More...
 
bool RequestedRegionIsOutsideOfTheBufferedRegion () override
 Check whether the requested region is outside of the buffered region. More...
 
bool VerifyRequestedRegion () override
 Verify the requested region. More...
 
void SetRequestedRegion (const itk::DataObject *data) override
 Set the requested region from another data object (no-op for ROI). More...
 
- Public Member Functions inherited from mitk::BaseData
 mitkClassMacroItkParent (BaseData, itk::DataObject)
 
BaseProperty::ConstPointer GetConstProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) const override
 Get a const property by its key. More...
 
std::vector< std::string > GetPropertyKeys (const std::string &contextName="", bool includeDefaultContext=false) const override
 Get all property keys stored in the property list. More...
 
std::vector< std::string > GetPropertyContextNames () const override
 Get the names of all property contexts. More...
 
BaseProperty * GetNonConstProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=true) override
 Get a non-const property by its key. More...
 
void SetProperty (const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
 Set a property in the property list. More...
 
void RemoveProperty (const std::string &propertyKey, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
 Remove a property from the property list. More...
 
const mitk::TimeGeometry * GetTimeGeometry () const
 Return the TimeGeometry of the data as const pointer. More...
 
mitk::TimeGeometry * GetTimeGeometry ()
 Return the TimeGeometry of the data as non-const pointer. More...
 
const mitk::TimeGeometry * GetUpdatedTimeGeometry ()
 Return the TimeGeometry of the data after ensuring it is up-to-date. More...
 
virtual void Expand (unsigned int timeSteps)
 Expand the TimeGeometry to a number of time steps. More...
 
const mitk::BaseGeometry * GetUpdatedGeometry (int t=0)
 Return the BaseGeometry of the data at time step t after ensuring it is up-to-date. More...
 
mitk::BaseGeometry * GetGeometry (int t=0) const
 Return the BaseGeometry of the data at time step t as a non-const pointer. More...
 
void UpdateOutputInformation () override
 Update the information for this BaseData so that it can be used as an output of a BaseProcess. More...
 
void CopyInformation (const itk::DataObject *data) override
 Copy information from the specified data set. More...
 
virtual bool IsInitialized () const
 Check whether the data has been initialized. More...
 
virtual void Clear ()
 Reset the data object by calling ClearData() and InitializeEmpty(). More...
 
virtual bool IsEmptyTimeStep (unsigned int t) const
 Check whether the object contains data at the specified time step. More...
 
virtual bool IsEmpty () const
 Check whether the object contains data at any time step. More...
 
void ExecuteOperation (Operation *operation) override
 Execute an operation on this data object. More...
 
virtual void SetGeometry (BaseGeometry *aGeometry3D)
 Set the BaseGeometry of the data, which will be referenced (not copied!). More...
 
virtual void SetTimeGeometry (TimeGeometry *geometry)
 Set the TimeGeometry of the data, which will be referenced (not copied!). More...
 
virtual void SetClonedGeometry (const BaseGeometry *aGeometry3D)
 Set a clone of the provided geometry as the BaseGeometry of the data. More...
 
virtual void SetClonedTimeGeometry (const TimeGeometry *geometry)
 Set a clone of the provided TimeGeometry as the TimeGeometry of the data. More...
 
virtual void SetClonedGeometry (const BaseGeometry *aGeometry3D, unsigned int time)
 Set a clone of the provided geometry as the BaseGeometry of a given time step. More...
 
mitk::PropertyList::Pointer GetPropertyList () const
 Get the data's property list. More...
 
void SetPropertyList (PropertyList *propertyList)
 Set the data's property list, replacing the existing one. More...
 
mitk::BaseProperty::Pointer GetProperty (const char *propertyKey) const
 Get a property by its key from the PropertyList. More...
 
void SetProperty (const char *propertyKey, BaseProperty *property)
 Set a property in the PropertyList. More...
 
virtual void SetOrigin (const Point3D &origin)
 Convenience method for setting the origin of the BaseGeometry instances of all time steps. More...
 
itk::SmartPointer< mitk::BaseDataSource > GetSource () const
 Get the process object that generated this data object. More...
 
unsigned int GetTimeSteps () const
 Get the number of time steps from the TimeGeometry. More...
 
itk::ModifiedTimeType GetMTime () const override
 Get the modification time of this data object or its geometry, whichever was modified most recently. More...
 
void Graft (const DataObject *) override
 Graft data and information from another data object. More...
 
- Public Member Functions inherited from mitk::OperationActor
 itkTypeMacroNoParent (OperationActor) virtual ~OperationActor()
 
- Public Member Functions inherited from mitk::Identifiable
 Identifiable ()
 Default constructor. Generates a new random UID. More...
 
 Identifiable (const UIDType &uid)
 Construct with a pre-existing UID. More...
 
 Identifiable (const Identifiable &)=delete
 Copy construction is deleted to prevent UID duplication. More...
 
 Identifiable (Identifiable &&) noexcept
 Move constructor. Transfers ownership of the UID. More...
 
virtual ~Identifiable ()
 Virtual destructor. More...
 
Identifiable & operator= (const Identifiable &)=delete
 Copy assignment is deleted to prevent UID duplication. More...
 
Identifiable & operator= (Identifiable &&other) noexcept
 Move assignment operator. Transfers ownership of the UID. More...
 
virtual UIDType GetUID () const
 Get the unique identifier of this object. More...
 
UIDType GetRuntimeUID () const noexcept
 Get a runtime-unique ID for this object instance. 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...
 

Protected Member Functions

 mitkCloneMacro (Self) ROI()
 
 ROI (const Self &other)
 
 ~ROI () override
 
- Protected Member Functions inherited from mitk::BaseData
 BaseData ()
 
 BaseData (const BaseData &other)
 
 ~BaseData () override
 
virtual void InitializeTimeGeometry (unsigned int timeSteps=1)
 Initialize the TimeGeometry for a number of time steps. The TimeGeometry is initialized empty and evenly timed. In many cases it will be necessary to overwrite this in sub-classes. More...
 
virtual void ClearData ()
 reset to non-initialized state, release memory More...
 
virtual void InitializeEmpty ()
 Pure virtual; Must be used in subclasses to get a data object to a valid state. Should at least create one empty object and call Superclass::InitializeTimeGeometry() to ensure an existing valid geometry. More...
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 
- Protected Member Functions inherited from mitk::Identifiable
virtual void SetUID (const UIDType &uid)
 

Additional Inherited Members

- Protected Attributes inherited from mitk::BaseData
bool m_LastRequestedRegionWasOutsideOfTheBufferedRegion
 
unsigned int m_SourceOutputIndexDuplicate
 
bool m_Initialized
 

Detailed Description

A collection of region of interests (ROIs).

Note
This class is considered experimental and subject to substational change. We mean it.

ROIs, essentially defined by the minimum and maximum index coordinates of an axis-aligned box, are represented by the nested ROI::Element class. These index coordinates are relative to a common TimeGeometry.

All ROIs are required to have a unique ID by which they can be accessed.

ROIs can optionally have properties (PropertyList), also called default properties. In case of time-resolved ROIs, each time step can optionally have properties, too. These properties have precedence over the default properties. In other words, the default properties may contain fallback properties which are queried when a property is not defined at a certain time step. This allows for an opt-in dynamic appearance of ROIs over time, for example by changing color or opacity.

ROIs are rendered both in 3-d and 2-d views as cubes, resp. cutting slices of these cubes. They support the following ROI::Element properties:

  • color (ColorProperty): Color of the cube
  • opacity (FloatProperty): Opacity of the cube
  • lineWidth (FloatProperty): Line width of the cube edges

ROIs display a customizable caption at their bottom-left corner. It is defined by the base data property caption (StringProperty). By default it is set to "{name} ({ID})". Braces are used to define placeholders which are replaced by their corresponding ROI::Element properties. {ID} is a special placeholder which will be replaced by the ID of the ROI::Element instead. The caption is allowed to include line breaks. Rendering of captions can be customized through the following data node properties:

  • font.size (IntProperty) Font size in points
  • font.bold (BoolProperty) Bold font style
  • font.italic (BoolProperty) Italic font style

See MITK ROI for details on the JSON-based MITK ROI file format.

Definition at line 58 of file mitkROI.h.

Member Typedef Documentation

◆ ConstIterator

using mitk::ROI::ConstIterator = ElementsType::const_iterator

Const iterator over ROI elements.

Definition at line 332 of file mitkROI.h.

◆ ElementsType

using mitk::ROI::ElementsType = std::map<unsigned int, Element>

Map type associating element IDs to their Element objects.

Definition at line 326 of file mitkROI.h.

◆ Iterator

using mitk::ROI::Iterator = ElementsType::iterator

Mutable iterator over ROI elements.

Definition at line 329 of file mitkROI.h.

Constructor & Destructor Documentation

◆ ROI()

mitk::ROI::ROI ( const Self &  other)
protected

◆ ~ROI()

mitk::ROI::~ROI ( )
overrideprotected

Member Function Documentation

◆ AddElement()

void mitk::ROI::AddElement ( const Element &  element)

Add a ROI::Element to the collection.

Parameters
[in]elementThe element to add. Its ID must be unique within this collection.
Precondition
The element's ID must not already exist in this collection.
Exceptions
mitk::Exceptionif an element with the same ID already exists.

◆ begin() [1/2]

Iterator mitk::ROI::begin ( )

Get a mutable iterator to the first element.

◆ begin() [2/2]

ConstIterator mitk::ROI::begin ( ) const

Get a const iterator to the first element.

◆ Clone()

Pointer mitk::ROI::Clone ( ) const

◆ end() [1/2]

Iterator mitk::ROI::end ( )

Get a mutable iterator past the last element.

◆ end() [2/2]

ConstIterator mitk::ROI::end ( ) const

Get a const iterator past the last element.

◆ GetElement() [1/2]

Element& mitk::ROI::GetElement ( unsigned int  id)

Get a mutable reference to an element by its ID.

Parameters
[in]idThe unique identifier of the element.
Returns
Mutable reference to the element.
Exceptions
std::out_of_rangeif no element with the given ID exists.

◆ GetElement() [2/2]

const Element& mitk::ROI::GetElement ( unsigned int  id) const

Get a const reference to an element by its ID.

Parameters
[in]idThe unique identifier of the element.
Returns
Const reference to the element.
Exceptions
std::out_of_rangeif no element with the given ID exists.

◆ GetNumberOfElements()

size_t mitk::ROI::GetNumberOfElements ( ) const

Get the number of ROI elements in the collection.

Returns
The number of elements.

◆ mitkClassMacro()

mitk::ROI::mitkClassMacro ( ROI  ,
BaseData   
)

◆ mitkCloneMacro()

mitk::ROI::mitkCloneMacro ( Self  )
protected

◆ RequestedRegionIsOutsideOfTheBufferedRegion()

bool mitk::ROI::RequestedRegionIsOutsideOfTheBufferedRegion ( )
overridevirtual

Check whether the requested region is outside of the buffered region.

Returns
Always returns false for ROI.

Implements mitk::BaseData.

◆ SetRequestedRegion()

void mitk::ROI::SetRequestedRegion ( const itk::DataObject *  data)
overridevirtual

Set the requested region from another data object (no-op for ROI).

Parameters
[in]dataThe data object to copy the requested region from (ignored).

Implements mitk::BaseData.

◆ SetRequestedRegionToLargestPossibleRegion()

void mitk::ROI::SetRequestedRegionToLargestPossibleRegion ( )
overridevirtual

Set the requested region to the largest possible region (no-op for ROI).

Implements mitk::BaseData.

◆ VerifyRequestedRegion()

bool mitk::ROI::VerifyRequestedRegion ( )
overridevirtual

Verify the requested region.

Returns
Always returns true for ROI.

Implements mitk::BaseData.


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