Medical Imaging Interaction Toolkit  2018.4.99-b7f3afaa
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 
35  DataNodeEvent NodeChanged;
36  DataNodeEvent NodeAdded;
37  DataNodeEvent NodeRemoved;
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:
50  ~DataStorageSelection() override;
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:
85  DataStorageSelection &operator=(mitk::DataNode *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();
131  void RemoveListener(mitk::DataNode *node);
137  void AddListener(mitk::DataNode *node);
138 
139  protected:
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 // mitkDataStorageSelection_h
Message1< const mitk::DataNode * > DataNodeEvent
Data management class that handles &#39;was created by&#39; relations.
#define MITKDATATYPESEXT_EXPORT
DataCollection - Class to facilitate loading/accessing structured data.
std::map< mitk::BaseProperty *, unsigned long > m_PropertyDeletedObserverTags
Maps a property to a delete observer tag.
Key-value list holding instances of BaseProperty.
#define mitkNewMacro2Param(classname, typea, typeb)
Definition: mitkCommon.h:85
Abstract base class for properties.
#define AddNode(name)
std::map< mitk::BaseProperty *, unsigned long > m_PropertyModifiedObserverTags
Maps a property to a modified observer tag.
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:49
std::map< mitk::PropertyList *, unsigned long > m_PropertyListModifiedObserverTags
Maps a propertylist to a modified observer tag.
std::vector< mitk::DataNode * > Nodes
Message2< const mitk::DataNode *, const mitk::BaseProperty * > PropertyChanged
Interface for evaluation conditions used in the DataStorage class GetSubset() method.
std::vector< mitk::DataNode * > m_Nodes
#define mitkNewMacro3Param(classname, typea, typeb, typec)
Definition: mitkCommon.h:98
mitk::NodePredicateBase::Pointer m_Predicate
std::map< mitk::DataNode *, unsigned long > m_NodeModifiedObserverTags
Maps a node to a modified observer tag.
std::map< mitk::PropertyList *, unsigned long > m_PropertyListDeletedObserverTags
Maps a propertylist to a delete observer tag.
Class for nodes of the DataTree.
Definition: mitkDataNode.h:57