Medical Imaging Interaction Toolkit  2025.12.02
Medical Imaging Interaction Toolkit
mitkDataStorageSelection.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkDataStorageSelection_h
14 #define mitkDataStorageSelection_h
15 
17 
18 #include <mitkCommon.h>
19 #include <mitkDataStorage.h>
20 #include <mitkNodePredicateBase.h>
21 
22 #include <set>
23 
24 namespace mitk
25 {
26  class BaseProperty;
27  class PropertyList;
28 
29  class MITKDATATYPESEXT_EXPORT DataStorageSelection : public itk::Object
30  {
31  public:
32  typedef std::vector<mitk::DataNode *> Nodes;
34 
39 
41 
44 
45  protected:
46  DataStorageSelection(mitk::DataStorage *_DataStorage, bool _AutoAddNodes);
47  DataStorageSelection(mitk::DataStorage *_DataStorage, mitk::NodePredicateBase *_Predicate, bool _AutoAddNodes);
48 
49  public:
51 
55  mitk::DataStorage::Pointer GetDataStorage() const;
59  mitk::NodePredicateBase::Pointer GetPredicate() const;
63  unsigned int GetSize() const;
67  mitk::DataNode::Pointer GetNode(unsigned int index) const;
71  mitk::DataNode::Pointer GetNode() const;
75  std::vector<mitk::DataNode *> GetNodes() const;
79  bool DoesAutoAddNodes() const;
80 
81  public:
89  DataStorageSelection &operator=(mitk::DataNode::Pointer node);
93  virtual void SetDataStorage(mitk::DataStorage *_DataStorage);
97  virtual void SetPredicate(mitk::NodePredicateBase *_Predicate);
101  virtual void AddNode(const mitk::DataNode *node);
105  virtual void RemoveNode(const mitk::DataNode *node);
109  virtual void RemoveAllNodes();
113  virtual void ObjectChanged(const itk::Object *caller, const itk::EventObject &event);
114 
115  protected:
119  mitk::DataNode::Pointer FindNode(const mitk::BaseProperty *prop) const;
123  mitk::DataNode::Pointer FindNode(const mitk::PropertyList *propList) const;
127  void Reset();
138 
139  protected:
152  mitk::NodePredicateBase::Pointer m_Predicate;
156  std::vector<mitk::DataNode *> m_Nodes;
160  std::map<mitk::DataNode *, unsigned long> m_NodeModifiedObserverTags;
164  std::map<mitk::PropertyList *, unsigned long> m_PropertyListModifiedObserverTags;
168  std::map<mitk::PropertyList *, unsigned long> m_PropertyListDeletedObserverTags;
172  std::map<mitk::BaseProperty *, unsigned long> m_PropertyModifiedObserverTags;
176  std::map<mitk::BaseProperty *, unsigned long> m_PropertyDeletedObserverTags;
185  };
186 }
187 
188 #endif
#define MITKDATATYPESEXT_EXPORT
Abstract base class for properties.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:64
mitk::DataNode::Pointer GetNode() const
mitk::DataStorage::Pointer GetDataStorage() const
std::map< mitk::PropertyList *, unsigned long > m_PropertyListDeletedObserverTags
Maps a propertylist to a delete observer tag.
virtual void AddNode(const mitk::DataNode *node)
Message2< const mitk::DataNode *, const mitk::BaseProperty * > PropertyChanged
DataStorageSelection(mitk::DataStorage *_DataStorage, bool _AutoAddNodes)
mitk::NodePredicateBase::Pointer GetPredicate() const
virtual void RemoveAllNodes()
std::map< mitk::PropertyList *, unsigned long > m_PropertyListModifiedObserverTags
Maps a propertylist to a modified observer tag.
virtual void SetDataStorage(mitk::DataStorage *_DataStorage)
std::vector< mitk::DataNode * > Nodes
mitk::DataNode::Pointer GetNode(unsigned int index) const
DataStorageSelection & operator=(mitk::DataNode *node)
std::map< mitk::DataNode *, unsigned long > m_NodeModifiedObserverTags
Maps a node to a modified observer tag.
void AddListener(mitk::DataNode *node)
mitk::DataNode::Pointer FindNode(const mitk::PropertyList *propList) const
void RemoveListener(mitk::DataNode *node)
mitkClassMacroItkParent(DataStorageSelection, itk::Object)
virtual void RemoveNode(const mitk::DataNode *node)
mitkNewMacro3Param(DataStorageSelection, DataStorage *, NodePredicateBase *, bool)
std::vector< mitk::DataNode * > GetNodes() const
virtual void SetPredicate(mitk::NodePredicateBase *_Predicate)
std::map< mitk::BaseProperty *, unsigned long > m_PropertyDeletedObserverTags
Maps a property to a delete observer tag.
mitk::DataNode::Pointer FindNode(const mitk::BaseProperty *prop) const
std::vector< mitk::DataNode * > m_Nodes
mitk::NodePredicateBase::Pointer m_Predicate
DataStorageSelection & operator=(mitk::DataNode::Pointer node)
mitkNewMacro2Param(DataStorageSelection, DataStorage *, bool)
std::map< mitk::BaseProperty *, unsigned long > m_PropertyModifiedObserverTags
Maps a property to a modified observer tag.
unsigned int GetSize() const
DataStorageSelection(mitk::DataStorage *_DataStorage, mitk::NodePredicateBase *_Predicate, bool _AutoAddNodes)
Message1< const mitk::DataNode * > DataNodeEvent
virtual void ObjectChanged(const itk::Object *caller, const itk::EventObject &event)
Data management class that handles 'was created by' relations.
Interface for evaluation conditions used in the DataStorage class GetSubset() method.
Key-value list holding instances of BaseProperty.
Find image slices visible on a given plane.