Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitk::DataStorage Class Referenceabstract

Abstract data management class that organizes DataNode objects in a directed acyclic graph. More...

#include <mitkDataStorage.h>

Inheritance diagram for mitk::DataStorage:
Collaboration diagram for mitk::DataStorage:

Public Types

typedef itk::VectorContainer< unsigned int, DataNode::Pointer > SetOfObjects
 Container type used as a result set of query operations such as GetSubset(). More...
 
typedef itk::VectorContainer< unsigned int, DataNode::ConstPointer > ConstSetOfObjects
 Container type for const node pointers, used for input parameters where nodes are read-only. More...
 
typedef Message1< const DataNode * > DataStorageEvent
 Event type used for all DataStorage notifications, carrying a const DataNode pointer. More...
 

Public Member Functions

 mitkClassMacroItkParent (DataStorage, itk::Object)
 
virtual void Add (DataNode *node, const DataStorage::SetOfObjects *parents=nullptr)=0
 Add a DataNode to the storage, optionally with parent (source) nodes. More...
 
void Add (DataNode *node, DataNode *parent)
 Convenience method to add a node with a single parent. More...
 
void Add (DataNode *node, const ConstSetOfObjects *parents)
 Convenience overload for callers that hold only const node pointers for the parents. More...
 
virtual void Remove (const DataNode *node)=0
 Remove a single node from the DataStorage. More...
 
virtual bool Exists (const DataNode *node) const =0
 Check whether a node exists in the DataStorage. More...
 
void Remove (const DataStorage::SetOfObjects *nodes)
 Remove a set of nodes from the DataStorage. More...
 
void Remove (const ConstSetOfObjects *nodes)
 Remove a set of const-pointer nodes from the DataStorage. More...
 
SetOfObjects::ConstPointer GetSubset (const NodePredicateBase *condition) const
 Return all nodes that satisfy the given predicate condition. More...
 
virtual SetOfObjects::ConstPointer GetSources (const DataNode *node, const NodePredicateBase *condition=nullptr, bool onlyDirectSources=true) const =0
 Return the source (parent) nodes of a given node. More...
 
virtual SetOfObjects::ConstPointer GetDerivations (const DataNode *node, const NodePredicateBase *condition=nullptr, bool onlyDirectDerivations=true) const =0
 Return the derived (child) nodes of a given node. More...
 
virtual SetOfObjects::ConstPointer GetAll () const =0
 Return all nodes managed by this DataStorage. More...
 
DataNode * GetNode (const NodePredicateBase *condition=nullptr) const
 Convenience method to get the first node that matches the predicate condition. More...
 
DataNode * GetNamedNode (const char *name) const
 Convenience method to get the first node with a given name. More...
 
DataNode * GetNamedNode (const std::string &name) const
 Convenience method to get the first node with a given name (std::string overload). More...
 
DataNode * GetNamedDerivedNode (const char *name, const DataNode *sourceNode, bool onlyDirectDerivations=true) const
 Convenience method to get the first node with a given name that is derived from a source node. More...
 
template<class DataType >
DataType * GetNamedObject (const char *name) const
 Convenience method to get the first data object of a given type with a given name. More...
 
template<class DataType >
DataType * GetNamedObject (const std::string &name) const
 Convenience method to get the first data object of a given type with a given name (std::string overload). More...
 
template<class DataType >
DataType * GetNamedDerivedObject (const char *name, const DataNode *sourceNode, bool onlyDirectDerivations=true) const
 Convenience method to get the first data object of a given type with a given name, derived from a source node. More...
 
std::string GetUniqueName (const std::string &name, const DataNode *sourceNode=nullptr, bool onlyDirectDerivations=true) const
 Generate a unique node name by appending an incrementing number if necessary. More...
 
const DataNode::GroupTagList GetGroupTags () const
 Return all group tags used across all nodes in the DataStorage. More...
 
TimeGeometry::ConstPointer ComputeBoundingGeometry3D (const SetOfObjects *input, const char *boolPropertyKey=nullptr, const BaseRenderer *renderer=nullptr, const char *boolPropertyKey2=nullptr) const
 Compute the axis-parallel bounding geometry encompassing the given set of nodes. More...
 
TimeGeometry::ConstPointer ComputeBoundingGeometry3D (const ConstSetOfObjects *input, const char *boolPropertyKey=nullptr, const BaseRenderer *renderer=nullptr, const char *boolPropertyKey2=nullptr) const
 Compute the axis-parallel bounding geometry for a set of const node pointers. More...
 
TimeGeometry::ConstPointer ComputeBoundingGeometry3D (const char *boolPropertyKey=nullptr, const BaseRenderer *renderer=nullptr, const char *boolPropertyKey2=nullptr) const
 Compute the axis-parallel bounding geometry of all nodes in the DataStorage. More...
 
TimeGeometry::ConstPointer ComputeVisibleBoundingGeometry3D (const BaseRenderer *renderer=nullptr, const char *boolPropertyKey=nullptr)
 Compute the axis-parallel bounding geometry of all visible nodes. More...
 
BoundingBox::Pointer ComputeBoundingBox (const char *boolPropertyKey=nullptr, const BaseRenderer *renderer=nullptr, const char *boolPropertyKey2=nullptr)
 Compute the axis-parallel bounding box of all nodes in the DataStorage. More...
 
BoundingBox::Pointer ComputeVisibleBoundingBox (const BaseRenderer *renderer=nullptr, const char *boolPropertyKey=nullptr)
 Compute the bounding box of all visible nodes. More...
 
TimeBounds ComputeTimeBounds (const char *boolPropertyKey, const BaseRenderer *renderer, const char *boolPropertyKey2)
 Compute the time bounds of all nodes in the DataStorage. More...
 
TimeBounds ComputeTimeBounds (const BaseRenderer *renderer, const char *boolPropertyKey)
 Compute the time bounds of all visible nodes. More...
 
void BlockNodeModifiedEvents (bool block)
 Enable or disable suppression of ChangedNodeEvent emission. More...
 

Public Attributes

std::mutex m_MutexOne
 Mutex for thread-safe operations on the DataStorage. More...
 
DataStorageEvent AddNodeEvent
 Event emitted after a new node has been added to the DataStorage. More...
 
DataStorageEvent RemoveNodeEvent
 Event emitted directly before a node is removed from the DataStorage. More...
 
DataStorageEvent ChangedNodeEvent
 Event emitted after a managed node has been modified. More...
 
DataStorageEvent DeleteNodeEvent
 Event emitted directly before a managed node is deleted. More...
 
DataStorageEvent InteractorChangedNodeEvent
 Event emitted when the DataInteractor of a managed node changes. More...
 

Protected Member Functions

void EmitAddNodeEvent (const DataNode *node)
 EmitAddNodeEvent emits the AddNodeEvent. More...
 
void EmitRemoveNodeEvent (const DataNode *node)
 EmitRemoveNodeEvent emits the RemoveNodeEvent. More...
 
void OnNodeInteractorChanged (itk::Object *caller, const itk::EventObject &event)
 
void OnNodeModifiedOrDeleted (const itk::Object *caller, const itk::EventObject &event)
 OnNodeModified listens to modified events of DataNodes. More...
 
void AddListeners (const DataNode *_Node)
 Adds a Modified-Listener to the given Node. More...
 
void RemoveListeners (const DataNode *_Node)
 Removes a Modified-Listener from the given Node. More...
 
 DataStorage ()
 
 ~DataStorage () override
 
SetOfObjects::ConstPointer FilterSetOfObjects (const SetOfObjects *set, const NodePredicateBase *condition) const
 Filters a SetOfObjects by the condition. If no condition is provided, the original set is returned. More...
 
void PrintSelf (std::ostream &os, itk::Indent indent) const override
 Prints the contents of the DataStorage to os. Do not call directly, call ->Print() instead. More...
 

Protected Attributes

std::map< const DataNode *, unsigned long > m_NodeModifiedObserverTags
 Saves Modified-Observer Tags for each node in order to remove the event listeners again. More...
 
std::map< const DataNode *, unsigned long > m_NodeInteractorChangedObserverTags
 
std::map< const DataNode *, unsigned long > m_NodeDeleteObserverTags
 Saves Delete-Observer Tags for each node in order to remove the event listeners again. More...
 
bool m_BlockNodeModifiedEvents
 If this class changes nodes itself, set this to TRUE in order to suppress NodeChangedEvent to be emitted. More...
 

Detailed Description

Abstract data management class that organizes DataNode objects in a directed acyclic graph.

The DataStorage provides storage and retrieval functionality for DataNode objects. It tracks 'was created by' relationships by associating each node with a set of source (parent) nodes from which it was derived. This forms a non-cyclical directed graph data structure.

The DataStorage emits events when nodes are added (AddNodeEvent), removed (RemoveNodeEvent), modified (ChangedNodeEvent), or deleted (DeleteNodeEvent). It also provides methods for querying nodes by predicates (GetSubset), computing bounding geometries, and traversing source/derivation relationships.

This is an abstract base class. Use StandaloneDataStorage for a concrete implementation.

See also
StandaloneDataStorage, DataNode, NodePredicateBase

Definition at line 49 of file mitkDataStorage.h.

Member Typedef Documentation

◆ ConstSetOfObjects

typedef itk::VectorContainer<unsigned int, DataNode::ConstPointer> mitk::DataStorage::ConstSetOfObjects

Container type for const node pointers, used for input parameters where nodes are read-only.

Callers that hold only DataNode::ConstPointer can use this container to pass nodes to DataStorage operations without needing a const_cast at the call site. Internally, the DataStorage converts to mutable pointers at its ownership boundary, as it owns all nodes as mutable objects.

Definition at line 68 of file mitkDataStorage.h.

◆ DataStorageEvent

Event type used for all DataStorage notifications, carrying a const DataNode pointer.

Definition at line 330 of file mitkDataStorage.h.

◆ SetOfObjects

typedef itk::VectorContainer<unsigned int, DataNode::Pointer> mitk::DataStorage::SetOfObjects

Container type used as a result set of query operations such as GetSubset().

Holds smart pointers to DataNode objects.

Definition at line 59 of file mitkDataStorage.h.

Constructor & Destructor Documentation

◆ DataStorage()

mitk::DataStorage::DataStorage ( )
protected

◆ ~DataStorage()

mitk::DataStorage::~DataStorage ( )
overrideprotected

Member Function Documentation

◆ Add() [1/3]

void mitk::DataStorage::Add ( DataNode *  node,
const ConstSetOfObjects *  parents 
)

Convenience overload for callers that hold only const node pointers for the parents.

Converts the ConstSetOfObjects to a SetOfObjects internally and delegates to the virtual Add() method.

Parameters
[in]nodeThe DataNode to add. Must not be nullptr.
[in]parentsOptional set of const parent node pointers. May be nullptr.
Exceptions
std::invalid_argumentif node is nullptr or already exists in the DataStorage.
See also
Add(DataNode*, const SetOfObjects*)

◆ Add() [2/3]

virtual void mitk::DataStorage::Add ( DataNode *  node,
const DataStorage::SetOfObjects *  parents = nullptr 
)
pure virtual

Add a DataNode to the storage, optionally with parent (source) nodes.

The node is added to the internal graph structure. If parents is provided, 'was created from' relationships are established between the node and its parents. After a successful addition, AddNodeEvent is emitted.

Parameters
[in]nodeThe DataNode to add. Must not be nullptr.
[in]parentsOptional set of parent nodes. May be nullptr.
Exceptions
std::invalid_argumentif node is nullptr or already exists in the DataStorage.
See also
Remove, AddNodeEvent

Implemented in mitk::StandaloneDataStorage.

◆ Add() [3/3]

void mitk::DataStorage::Add ( DataNode *  node,
DataNode *  parent 
)

Convenience method to add a node with a single parent.

Parameters
[in]nodeThe DataNode to add. Must not be nullptr.
[in]parentThe parent node. May be nullptr (equivalent to adding without parents).
Exceptions
std::invalid_argumentif node is nullptr or already exists in the DataStorage.
See also
Add(DataNode*, const SetOfObjects*)

◆ AddListeners()

void mitk::DataStorage::AddListeners ( const DataNode *  _Node)
protected

Adds a Modified-Listener to the given Node.

◆ BlockNodeModifiedEvents()

void mitk::DataStorage::BlockNodeModifiedEvents ( bool  block)

Enable or disable suppression of ChangedNodeEvent emission.

When block is true, the DataStorage will not emit ChangedNodeEvent when a managed DataNode is modified. This is useful when performing batch property updates and you do not want observers to react to each individual change.

Parameters
[in]blockIf true, suppress ChangedNodeEvent; if false, re-enable it.
See also
ChangedNodeEvent

◆ ComputeBoundingBox()

BoundingBox::Pointer mitk::DataStorage::ComputeBoundingBox ( const char *  boolPropertyKey = nullptr,
const BaseRenderer *  renderer = nullptr,
const char *  boolPropertyKey2 = nullptr 
)

Compute the axis-parallel bounding box of all nodes in the DataStorage.

Parameters
[in]boolPropertyKeyOptional BoolProperty key; nodes where this is false are excluded.
[in]rendererRenderer context for property lookup.
[in]boolPropertyKey2A second BoolProperty condition applied in addition to the first.
Returns
The computed BoundingBox.

◆ ComputeBoundingGeometry3D() [1/3]

TimeGeometry::ConstPointer mitk::DataStorage::ComputeBoundingGeometry3D ( const char *  boolPropertyKey = nullptr,
const BaseRenderer *  renderer = nullptr,
const char *  boolPropertyKey2 = nullptr 
) const

Compute the axis-parallel bounding geometry of all nodes in the DataStorage.

Convenience overload that calls ComputeBoundingGeometry3D(GetAll(), ...).

Parameters
[in]boolPropertyKeyOptional BoolProperty key; nodes where this is false are excluded.
[in]rendererRenderer context for property lookup.
[in]boolPropertyKey2A second BoolProperty condition applied in addition to the first.
Returns
The computed bounding TimeGeometry.

◆ ComputeBoundingGeometry3D() [2/3]

TimeGeometry::ConstPointer mitk::DataStorage::ComputeBoundingGeometry3D ( const ConstSetOfObjects *  input,
const char *  boolPropertyKey = nullptr,
const BaseRenderer *  renderer = nullptr,
const char *  boolPropertyKey2 = nullptr 
) const

Compute the axis-parallel bounding geometry for a set of const node pointers.

Overload for callers that hold only DataNode::ConstPointer. Semantically identical to the SetOfObjects overload.

Parameters
[in]inputSet of const node pointers. Must not be nullptr.
[in]boolPropertyKeyOptional BoolProperty key; nodes where this is false are excluded.
[in]rendererRenderer context for property lookup.
[in]boolPropertyKey2A second BoolProperty condition applied in addition to the first.
Returns
The computed bounding TimeGeometry, or nullptr if no valid geometries are found.
Exceptions
std::invalid_argumentif input is nullptr.

◆ ComputeBoundingGeometry3D() [3/3]

TimeGeometry::ConstPointer mitk::DataStorage::ComputeBoundingGeometry3D ( const SetOfObjects *  input,
const char *  boolPropertyKey = nullptr,
const BaseRenderer *  renderer = nullptr,
const char *  boolPropertyKey2 = nullptr 
) const

Compute the axis-parallel bounding geometry encompassing the given set of nodes.

Nodes whose specified BoolProperty is false are excluded from the computation.

Parameters
[in]inputSet of nodes to include. Must not be nullptr.
[in]boolPropertyKeyOptional BoolProperty key; nodes where this is false are excluded.
[in]rendererRenderer context for property lookup.
[in]boolPropertyKey2A second BoolProperty condition applied in addition to the first.
Returns
The computed bounding TimeGeometry, or nullptr if no valid geometries are found.
Exceptions
std::invalid_argumentif input is nullptr.

◆ ComputeTimeBounds() [1/2]

TimeBounds mitk::DataStorage::ComputeTimeBounds ( const BaseRenderer *  renderer,
const char *  boolPropertyKey 
)
inline

Compute the time bounds of all visible nodes.

Convenience method that calls ComputeTimeBounds("visible", renderer, boolPropertyKey).

Parameters
[in]rendererThe renderer whose visibility property is checked.
[in]boolPropertyKeyAn additional BoolProperty condition.
Returns
The computed time bounds of visible nodes.

Definition at line 495 of file mitkDataStorage.h.

◆ ComputeTimeBounds() [2/2]

TimeBounds mitk::DataStorage::ComputeTimeBounds ( const char *  boolPropertyKey,
const BaseRenderer *  renderer,
const char *  boolPropertyKey2 
)

Compute the time bounds of all nodes in the DataStorage.

Returns [-infinity, +infinity] only if all data objects have infinite lifespan. Otherwise, data objects with infinite lifespan are ignored, and the union of all finite time bounds is returned.

Parameters
[in]boolPropertyKeyOptional BoolProperty key; nodes where this is false are excluded.
[in]rendererRenderer context for property lookup.
[in]boolPropertyKey2A second BoolProperty condition.
Returns
The computed time bounds as a TimeBounds (array of two ScalarType values).

◆ ComputeVisibleBoundingBox()

BoundingBox::Pointer mitk::DataStorage::ComputeVisibleBoundingBox ( const BaseRenderer *  renderer = nullptr,
const char *  boolPropertyKey = nullptr 
)
inline

Compute the bounding box of all visible nodes.

Convenience method that calls ComputeBoundingBox("visible", renderer, boolPropertyKey).

Parameters
[in]rendererThe renderer whose visibility property is checked.
[in]boolPropertyKeyAn additional BoolProperty condition.
Returns
The computed BoundingBox of visible nodes.

Definition at line 464 of file mitkDataStorage.h.

◆ ComputeVisibleBoundingGeometry3D()

TimeGeometry::ConstPointer mitk::DataStorage::ComputeVisibleBoundingGeometry3D ( const BaseRenderer *  renderer = nullptr,
const char *  boolPropertyKey = nullptr 
)

Compute the axis-parallel bounding geometry of all visible nodes.

Convenience method that calls ComputeBoundingGeometry3D("visible", renderer, boolPropertyKey).

Parameters
[in]rendererThe renderer whose visibility property is checked.
[in]boolPropertyKeyAn additional BoolProperty condition.
Returns
The computed bounding TimeGeometry of visible nodes.

◆ EmitAddNodeEvent()

void mitk::DataStorage::EmitAddNodeEvent ( const DataNode *  node)
protected

EmitAddNodeEvent emits the AddNodeEvent.

This method should be called by subclasses to emit the AddNodeEvent

◆ EmitRemoveNodeEvent()

void mitk::DataStorage::EmitRemoveNodeEvent ( const DataNode *  node)
protected

EmitRemoveNodeEvent emits the RemoveNodeEvent.

This method should be called by subclasses to emit the RemoveNodeEvent

◆ Exists()

virtual bool mitk::DataStorage::Exists ( const DataNode *  node) const
pure virtual

Check whether a node exists in the DataStorage.

Parameters
[in]nodeThe node to check.
Returns
true if the node is present in the DataStorage.

Implemented in mitk::StandaloneDataStorage.

◆ FilterSetOfObjects()

SetOfObjects::ConstPointer mitk::DataStorage::FilterSetOfObjects ( const SetOfObjects *  set,
const NodePredicateBase *  condition 
) const
protected

Filters a SetOfObjects by the condition. If no condition is provided, the original set is returned.

◆ GetAll()

virtual SetOfObjects::ConstPointer mitk::DataStorage::GetAll ( ) const
pure virtual

Return all nodes managed by this DataStorage.

Returns
A set containing all DataNodes currently in the storage.
See also
GetSubset

Implemented in mitk::StandaloneDataStorage.

◆ GetDerivations()

virtual SetOfObjects::ConstPointer mitk::DataStorage::GetDerivations ( const DataNode *  node,
const NodePredicateBase *  condition = nullptr,
bool  onlyDirectDerivations = true 
) const
pure virtual

Return the derived (child) nodes of a given node.

Returns nodes that were created from (derived from) the given node.

Parameters
[in]nodeThe node whose derivations are queried.
[in]conditionOptional predicate to filter results.
[in]onlyDirectDerivationsIf true (default), only direct children are returned. If false, the entire transitive derivation chain is traversed.
Returns
A set of derived DataNodes, possibly filtered by condition.
Exceptions
std::invalid_argumentif node is nullptr.
See also
GetSources

Implemented in mitk::StandaloneDataStorage.

◆ GetGroupTags()

const DataNode::GroupTagList mitk::DataStorage::GetGroupTags ( ) const

Return all group tags used across all nodes in the DataStorage.

Group tags are identified by the presence of GroupTagProperty entries in the nodes' property lists.

Returns
A set of group tag name strings.

◆ GetNamedDerivedNode()

DataNode* mitk::DataStorage::GetNamedDerivedNode ( const char *  name,
const DataNode *  sourceNode,
bool  onlyDirectDerivations = true 
) const

Convenience method to get the first node with a given name that is derived from a source node.

Parameters
[in]nameThe node name to search for.
[in]sourceNodeThe parent node to search derivations of.
[in]onlyDirectDerivationsIf true, only direct derivations are searched.
Returns
The first matching DataNode, or nullptr if not found or name is nullptr.
See also
GetNamedNode, GetDerivations

◆ GetNamedDerivedObject()

template<class DataType >
DataType* mitk::DataStorage::GetNamedDerivedObject ( const char *  name,
const DataNode *  sourceNode,
bool  onlyDirectDerivations = true 
) const
inline

Convenience method to get the first data object of a given type with a given name, derived from a source node.

Template Parameters
DataTypeThe expected data type (must inherit from BaseData).
Parameters
[in]nameThe node name to search for.
[in]sourceNodeThe parent node to search derivations of.
[in]onlyDirectDerivationsIf true, only direct derivations are searched.
Returns
Pointer to the data object cast to DataType, or nullptr if not found.
See also
GetNamedDerivedNode

Definition at line 288 of file mitkDataStorage.h.

References mitk::DataNode::GetData().

◆ GetNamedNode() [1/2]

DataNode* mitk::DataStorage::GetNamedNode ( const char *  name) const

Convenience method to get the first node with a given name.

Searches for a node whose "name" StringProperty matches name.

Parameters
[in]nameThe node name to search for.
Returns
The first matching DataNode, or nullptr if not found or name is nullptr.
See also
GetNamedDerivedNode

◆ GetNamedNode() [2/2]

DataNode* mitk::DataStorage::GetNamedNode ( const std::string &  name) const
inline

Convenience method to get the first node with a given name (std::string overload).

Parameters
[in]nameThe node name to search for.
Returns
The first matching DataNode, or nullptr if not found.
See also
GetNamedNode(const char*)

Definition at line 226 of file mitkDataStorage.h.

References GetNamedNode().

Referenced by GetNamedNode().

◆ GetNamedObject() [1/2]

template<class DataType >
DataType* mitk::DataStorage::GetNamedObject ( const char *  name) const
inline

Convenience method to get the first data object of a given type with a given name.

Searches for a named node and dynamic_casts its data to the requested type.

Template Parameters
DataTypeThe expected data type (must inherit from BaseData).
Parameters
[in]nameThe node name to search for.
Returns
Pointer to the data object cast to DataType, or nullptr if not found.
See also
GetNamedNode

Definition at line 252 of file mitkDataStorage.h.

References mitk::DataNode::GetData().

◆ GetNamedObject() [2/2]

template<class DataType >
DataType* mitk::DataStorage::GetNamedObject ( const std::string &  name) const
inline

Convenience method to get the first data object of a given type with a given name (std::string overload).

Template Parameters
DataTypeThe expected data type (must inherit from BaseData).
Parameters
[in]nameThe node name to search for.
Returns
Pointer to the data object cast to DataType, or nullptr if not found.
See also
GetNamedObject(const char*)

Definition at line 272 of file mitkDataStorage.h.

◆ GetNode()

DataNode* mitk::DataStorage::GetNode ( const NodePredicateBase *  condition = nullptr) const

Convenience method to get the first node that matches the predicate condition.

Parameters
[in]conditionThe predicate to evaluate. If nullptr, returns nullptr.
Returns
The first matching DataNode, or nullptr if none matches.
See also
GetSubset

◆ GetSources()

virtual SetOfObjects::ConstPointer mitk::DataStorage::GetSources ( const DataNode *  node,
const NodePredicateBase *  condition = nullptr,
bool  onlyDirectSources = true 
) const
pure virtual

Return the source (parent) nodes of a given node.

Parameters
[in]nodeThe node whose sources are queried.
[in]conditionOptional predicate to filter results.
[in]onlyDirectSourcesIf true (default), only direct parents are returned. If false, the entire transitive source chain is traversed.
Returns
A set of source DataNodes, possibly filtered by condition.
Exceptions
std::invalid_argumentif node is nullptr.
See also
GetDerivations

Implemented in mitk::StandaloneDataStorage.

◆ GetSubset()

SetOfObjects::ConstPointer mitk::DataStorage::GetSubset ( const NodePredicateBase *  condition) const

Return all nodes that satisfy the given predicate condition.

Conditions can test for data type, properties, source relationships, or combinations thereof (AND, OR, NOT) using the Composite Design Pattern (see NodePredicateBase).

To retrieve all nodes without filtering, use GetAll().

Parameters
[in]conditionThe predicate to evaluate. If nullptr, all nodes are returned.
Returns
A set of DataNode smart pointers that fulfill the condition.
See also
GetAll, GetNode, NodePredicateBase

◆ GetUniqueName()

std::string mitk::DataStorage::GetUniqueName ( const std::string &  name,
const DataNode *  sourceNode = nullptr,
bool  onlyDirectDerivations = true 
) const

Generate a unique node name by appending an incrementing number if necessary.

If the base name is already unique, it is returned as-is. Otherwise, the method appends " 2", " 3", etc., filling gaps in existing numbering to maintain a compact sequence. If a sourceNode is provided, uniqueness is checked only among its derived nodes; otherwise, all nodes in the DataStorage are considered.

Parameters
[in]nameThe base name to make unique.
[in]sourceNodeOptional parent node restricting the search space.
[in]onlyDirectDerivationsIf true, only direct derivations of sourceNode are considered.
Returns
A unique name derived from the given base name.

◆ mitkClassMacroItkParent()

mitk::DataStorage::mitkClassMacroItkParent ( DataStorage  ,
itk::Object   
)

◆ OnNodeInteractorChanged()

void mitk::DataStorage::OnNodeInteractorChanged ( itk::Object *  caller,
const itk::EventObject &  event 
)
protected

◆ OnNodeModifiedOrDeleted()

void mitk::DataStorage::OnNodeModifiedOrDeleted ( const itk::Object *  caller,
const itk::EventObject &  event 
)
protected

OnNodeModified listens to modified events of DataNodes.

The node is hidden behind the caller parameter, which has to be casted first. If the cast succeeds the ChangedNodeEvent is emitted with this node.

◆ PrintSelf()

void mitk::DataStorage::PrintSelf ( std::ostream &  os,
itk::Indent  indent 
) const
overrideprotected

Prints the contents of the DataStorage to os. Do not call directly, call ->Print() instead.

◆ Remove() [1/3]

void mitk::DataStorage::Remove ( const ConstSetOfObjects *  nodes)

Remove a set of const-pointer nodes from the DataStorage.

If nodes is nullptr, this method does nothing.

Parameters
[in]nodesThe set of const node pointers to remove.
See also
Remove(const DataNode*)

◆ Remove() [2/3]

virtual void mitk::DataStorage::Remove ( const DataNode *  node)
pure virtual

Remove a single node from the DataStorage.

The RemoveNodeEvent is emitted before the node is actually removed.

Parameters
[in]nodeThe node to remove. If nullptr, the call is ignored.
See also
Add, RemoveNodeEvent

Implemented in mitk::StandaloneDataStorage.

◆ Remove() [3/3]

void mitk::DataStorage::Remove ( const DataStorage::SetOfObjects *  nodes)

Remove a set of nodes from the DataStorage.

If nodes is nullptr, this method does nothing.

Parameters
[in]nodesThe set of nodes to remove.
See also
Remove(const DataNode*)

◆ RemoveListeners()

void mitk::DataStorage::RemoveListeners ( const DataNode *  _Node)
protected

Removes a Modified-Listener from the given Node.

Member Data Documentation

◆ AddNodeEvent

DataStorageEvent mitk::DataStorage::AddNodeEvent

Event emitted after a new node has been added to the DataStorage.

Register observers via AddNodeEvent.AddListener(myObject, MyObject::MyMethod). Unregister via AddNodeEvent.RemoveListener(myObject, MyObject::MyMethod). This event is thread-safe.

Definition at line 339 of file mitkDataStorage.h.

◆ ChangedNodeEvent

DataStorageEvent mitk::DataStorage::ChangedNodeEvent

Event emitted after a managed node has been modified.

The DataStorage internally listens to itk::ModifiedEvent on each node and forwards it through this event. Can be suppressed via BlockNodeModifiedEvents().

Register observers via ChangedNodeEvent.AddListener(myObject, MyObject::MyMethod). Unregister via ChangedNodeEvent.RemoveListener(myObject, MyObject::MyMethod). This event is thread-safe.

Definition at line 360 of file mitkDataStorage.h.

◆ DeleteNodeEvent

DataStorageEvent mitk::DataStorage::DeleteNodeEvent

Event emitted directly before a managed node is deleted.

The DataStorage internally listens to itk::DeleteEvent on each node and forwards it through this event.

Register observers via DeleteNodeEvent.AddListener(myObject, MyObject::MyMethod). Unregister via DeleteNodeEvent.RemoveListener(myObject, MyObject::MyMethod). This event is thread-safe.

Definition at line 372 of file mitkDataStorage.h.

◆ InteractorChangedNodeEvent

DataStorageEvent mitk::DataStorage::InteractorChangedNodeEvent

Event emitted when the DataInteractor of a managed node changes.

Forwards InteractorChangedEvent from individual nodes. This event is thread-safe.

Definition at line 380 of file mitkDataStorage.h.

◆ m_BlockNodeModifiedEvents

bool mitk::DataStorage::m_BlockNodeModifiedEvents
protected

If this class changes nodes itself, set this to TRUE in order to suppress NodeChangedEvent to be emitted.

Definition at line 555 of file mitkDataStorage.h.

◆ m_MutexOne

std::mutex mitk::DataStorage::m_MutexOne
mutable

Mutex for thread-safe operations on the DataStorage.

Definition at line 327 of file mitkDataStorage.h.

◆ m_NodeDeleteObserverTags

std::map<const DataNode *, unsigned long> mitk::DataStorage::m_NodeDeleteObserverTags
protected

Saves Delete-Observer Tags for each node in order to remove the event listeners again.

Definition at line 550 of file mitkDataStorage.h.

◆ m_NodeInteractorChangedObserverTags

std::map<const DataNode *, unsigned long> mitk::DataStorage::m_NodeInteractorChangedObserverTags
protected

Definition at line 546 of file mitkDataStorage.h.

◆ m_NodeModifiedObserverTags

std::map<const DataNode *, unsigned long> mitk::DataStorage::m_NodeModifiedObserverTags
protected

Saves Modified-Observer Tags for each node in order to remove the event listeners again.

Definition at line 544 of file mitkDataStorage.h.

◆ RemoveNodeEvent

DataStorageEvent mitk::DataStorage::RemoveNodeEvent

Event emitted directly before a node is removed from the DataStorage.

Register observers via RemoveNodeEvent.AddListener(myObject, MyObject::MyMethod). Unregister via RemoveNodeEvent.RemoveListener(myObject, MyObject::MyMethod). This event is thread-safe.

Definition at line 348 of file mitkDataStorage.h.


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