13 #ifndef mitkDataStorage_h
14 #define mitkDataStorage_h
16 #include "itkObject.h"
17 #include "itkVectorContainer.h"
27 class NodePredicateBase;
52 typedef itk::VectorContainer<unsigned int, DataNode::Pointer>
SetOfObjects;
108 bool onlyDirectSources =
true)
const = 0;
122 bool onlyDirectDerivations =
true)
const = 0;
127 virtual SetOfObjects::ConstPointer
GetAll()
const = 0;
148 bool onlyDirectDerivations =
true)
const;
153 template <
class DataType>
158 DataNode *n = this->GetNamedNode(name);
162 return dynamic_cast<DataType *
>(n->
GetData());
167 template <
class DataType>
170 return this->GetNamedObject<DataType>(name.c_str());
177 template <
class DataType>
180 bool onlyDirectDerivations =
true)
const
184 DataNode *n = this->GetNamedDerivedNode(name, sourceNode, onlyDirectDerivations);
188 return dynamic_cast<DataType *
>(n->
GetData());
203 std::string
GetUniqueName(
const std::string& name,
const DataNode* sourceNode =
nullptr,
bool onlyDirectDerivations =
true)
const;
292 const char *boolPropertyKey =
nullptr,
294 const char *boolPropertyKey2 =
nullptr)
const;
307 const char *boolPropertyKey2 =
nullptr)
const;
319 const char *boolPropertyKey =
nullptr);
330 const char *boolPropertyKey2 =
nullptr);
342 const char *boolPropertyKey =
nullptr)
344 return ComputeBoundingBox(
"visible", renderer, boolPropertyKey);
359 const char *boolPropertyKey2);
373 return ComputeTimeBounds(
"visible", renderer, boolPropertyKey);
441 void PrintSelf(std::ostream &os, itk::Indent indent)
const override;
Class for nodes of the DataTree.
BaseData * GetData() const
Get the data object (instance of BaseData, e.g., an Image) managed by this DataNode.
std::set< std::string > GroupTagList
Data management class that handles 'was created by' relations.
TimeGeometry::ConstPointer ComputeBoundingGeometry3D(const char *boolPropertyKey=nullptr, const BaseRenderer *renderer=nullptr, const char *boolPropertyKey2=nullptr) const
Compute the axis-parallel bounding geometry of the data tree (bounding box, minimal spacing of the co...
DataStorageEvent RemoveNodeEvent
RemoveEvent is emitted directly before a node is removed from the DataStorage.
TimeBounds ComputeTimeBounds(const BaseRenderer *renderer, const char *boolPropertyKey)
Compute the time-bounds of all visible parts of the data tree structure, for general rendering or ren...
virtual void Add(DataNode *node, const DataStorage::SetOfObjects *parents=nullptr)=0
Adds a DataNode containing a data object to its internal storage.
itk::VectorContainer< unsigned int, DataNode::Pointer > SetOfObjects
A Container of objects that is used as a result set of GetSubset() query operations (Set of.
void Add(DataNode *node, DataNode *parent)
Convenience method to add a node that has one parent.
const DataNode::GroupTagList GetGroupTags() const
Returns a list of used grouptags.
DataType * GetNamedDerivedObject(const char *name, const DataNode *sourceNode, bool onlyDirectDerivations=true) const
Convenience method to get the first data object of a given data type with a given name that is derive...
Message1< const DataNode * > DataStorageEvent
DataNode * GetNode(const NodePredicateBase *condition=nullptr) const
Convenience method to get the first node that matches the predicate condition.
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.
std::string GetUniqueName(const std::string &name, const DataNode *sourceNode=nullptr, bool onlyDirectDerivations=true) const
Get a unique node name by potentially appending an increasing number, starting from 2.
DataNode * GetNamedNode(const char *name) const
Convenience method to get the first node with a given name.
void BlockNodeModifiedEvents(bool block)
Defines whether or not NodeChangedEvent is invoked .
void EmitRemoveNodeEvent(const DataNode *node)
EmitRemoveNodeEvent emits the RemoveNodeEvent.
DataType * GetNamedObject(const std::string &name) const
Convenience method to get the first data object of a given data type with a given name.
BoundingBox::Pointer ComputeBoundingBox(const char *boolPropertyKey=nullptr, const BaseRenderer *renderer=nullptr, const char *boolPropertyKey2=nullptr)
Compute the bounding box of data tree structure it -> an iterator to a data tree structure.
void OnNodeModifiedOrDeleted(const itk::Object *caller, const itk::EventObject &event)
OnNodeModified listens to modified events of DataNodes.
DataStorageEvent ChangedNodeEvent
ChangedEvent is emitted directly after a node was changed.
void AddListeners(const DataNode *_Node)
Adds a Modified-Listener to the given Node.
DataStorageEvent AddNodeEvent
AddEvent is emitted whenever a new node has been added to the DataStorage.
bool m_BlockNodeModifiedEvents
If this class changes nodes itself, set this to TRUE in order to suppress NodeChangedEvent to be emit...
DataStorageEvent DeleteNodeEvent
DeleteNodeEvent is emitted directly before a node is deleted.
DataStorageEvent InteractorChangedNodeEvent
TimeGeometry::ConstPointer ComputeVisibleBoundingGeometry3D(const BaseRenderer *renderer=nullptr, const char *boolPropertyKey=nullptr)
Compute the axis-parallel bounding geometry of all visible parts of the data tree bounding box,...
std::map< const DataNode *, unsigned long > m_NodeModifiedObserverTags
Saves Modified-Observer Tags for each node in order to remove the event listeners again.
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 sourceNode.
virtual SetOfObjects::ConstPointer GetAll() const =0
returns a set of all data objects that are stored in the data storage
void OnNodeInteractorChanged(itk::Object *caller, const itk::EventObject &event)
virtual SetOfObjects::ConstPointer GetSources(const DataNode *node, const NodePredicateBase *condition=nullptr, bool onlyDirectSources=true) const =0
returns a set of source objects for a given node that meet the given condition(s).
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 of the input objects.
void Remove(const DataStorage::SetOfObjects *nodes)
Removes a set of nodes from the DataStorage.
mitkClassMacroItkParent(DataStorage, itk::Object)
std::map< const DataNode *, unsigned long > m_NodeInteractorChangedObserverTags
TimeBounds ComputeTimeBounds(const char *boolPropertyKey, const BaseRenderer *renderer, const char *boolPropertyKey2)
Compute the time-bounds of the contents of a data tree structure.
std::map< const DataNode *, unsigned long > m_NodeDeleteObserverTags
Saves Delete-Observer Tags for each node in order to remove the event listeners again.
SetOfObjects::ConstPointer GetSubset(const NodePredicateBase *condition) const
returns a set of data objects that meet the given condition(s)
virtual void Remove(const DataNode *node)=0
Removes node from the DataStorage.
BoundingBox::Pointer ComputeVisibleBoundingBox(const BaseRenderer *renderer=nullptr, const char *boolPropertyKey=nullptr)
Compute the bounding box of all visible parts of the data tree structure, for general rendering or re...
virtual bool Exists(const DataNode *node) const =0
Checks if a node exists in the DataStorage.
void RemoveListeners(const DataNode *_Node)
Removes a Modified-Listener from the given Node.
virtual SetOfObjects::ConstPointer GetDerivations(const DataNode *node, const NodePredicateBase *condition=nullptr, bool onlyDirectDerivations=true) const =0
returns a set of derived objects for a given node.
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.
DataType * GetNamedObject(const char *name) const
Convenience method to get the first data object of a given data type with a given name.
void EmitAddNodeEvent(const DataNode *node)
EmitAddNodeEvent emits the AddNodeEvent.
DataNode * GetNamedNode(const std::string &name) const
Convenience method to get the first node with a given name.
Interface for evaluation conditions used in the DataStorage class GetSubset() method.
Find image slices visible on a given plane.
itk::FixedArray< ScalarType, 2 > TimeBounds
Standard typedef for time-bounds.
MITKCORE_EXPORT DataNode::Pointer FindTopmostVisibleNode(const DataStorage::SetOfObjects::ConstPointer nodes, const Point3D worldPosition, const TimePointType timePoint, const BaseRenderer *baseRender)
returns the topmost visible node of a given list of nodes. The function returns a node that is visibl...
mitk::ScalarType TimePointType