13 #ifndef mitkStandaloneDataStorage_h
14 #define mitkStandaloneDataStorage_h
16 #include <itkVectorContainer.h>
24 class NodePredicateBase;
45 itkFactorylessNewMacro(Self);
96 bool onlyDirectSources =
true)
const override;
113 bool onlyDirectDerivations =
true)
const override;
121 SetOfObjects::ConstPointer
GetAll()
const override;
129 typedef std::map<mitk::DataNode::ConstPointer, SetOfObjects::ConstPointer>
AdjacencyList;
143 bool onlyDirectlyRelated =
true)
const;
151 void PrintSelf(std::ostream &os, itk::Indent indent)
const override;
Central node class of the MITK data tree, associating a data object with properties and mappers.
Abstract data management class that organizes DataNode objects in a directed acyclic graph.
virtual void Add(DataNode *node, const DataStorage::SetOfObjects *parents=nullptr)=0
Add a DataNode to the storage, optionally with parent (source) nodes.
itk::VectorContainer< unsigned int, DataNode::Pointer > SetOfObjects
Container type used as a result set of query operations such as GetSubset().
Abstract base class for predicates used to filter DataNode objects in DataStorage queries.
Concrete DataStorage implementation that stores nodes in an in-memory adjacency list graph.
~StandaloneDataStorage() override
void PrintSelf(std::ostream &os, itk::Indent indent) const override
Prints the contents of the StandaloneDataStorage to os. Do not call directly, call ->Print() instead.
AdjacencyList m_SourceNodes
Nodes and their relation are stored in m_SourceNodes.
SetOfObjects::ConstPointer GetDerivations(const mitk::DataNode *node, const NodePredicateBase *condition=nullptr, bool onlyDirectDerivations=true) const override
Return the derived (child) nodes of a given node, optionally filtered.
SetOfObjects::ConstPointer GetSources(const mitk::DataNode *node, const NodePredicateBase *condition=nullptr, bool onlyDirectSources=true) const override
Return the source (parent) nodes of a given node, optionally filtered.
void RemoveFromRelation(const mitk::DataNode *node, AdjacencyList &relation)
deletes all references to a node in a given relation (used in Remove() and TreeListener)
void Remove(const mitk::DataNode *node) override
Remove a node from the StandaloneDataStorage.
bool IsInitialized() const
convenience method to check if the object has been initialized (i.e. a data tree has been set)
mitkClassMacro(StandaloneDataStorage, mitk::DataStorage)
AdjacencyList m_DerivedNodes
Nodes are stored in reverse relation for easier traversal in the opposite direction of the relation.
SetOfObjects::ConstPointer GetRelations(const mitk::DataNode *node, const AdjacencyList &relation, const NodePredicateBase *condition=nullptr, bool onlyDirectlyRelated=true) const
Traverses the Relation graph and extracts a list of related elements (e.g. Sources or Derivations)
std::mutex m_Mutex
Mutex protecting the internal adjacency lists for thread-safe access.
bool Exists(const mitk::DataNode *node) const override
Check whether a node exists in this StandaloneDataStorage.
void Add(mitk::DataNode *node, const mitk::DataStorage::SetOfObjects *parents=nullptr) override
Add a DataNode to the storage, optionally with parent (source) nodes.
SetOfObjects::ConstPointer GetAll() const override
Return all nodes managed by this StandaloneDataStorage.
std::map< mitk::DataNode::ConstPointer, SetOfObjects::ConstPointer > AdjacencyList
noncyclical directed graph data structure to store the nodes with their relation
Find image slices visible on a given plane.