Medical Imaging Interaction Toolkit  2016.11.0
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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef mitkDataStorageSelection_h
18 #define mitkDataStorageSelection_h
19 
21 
22 #include <mitkCommon.h>
23 #include <mitkDataStorage.h>
24 #include <mitkNodePredicateBase.h>
25 
26 #include <set>
27 
28 namespace mitk
29 {
30  class BaseProperty;
31  class PropertyList;
32 
33  class MITKDATATYPESEXT_EXPORT DataStorageSelection : public itk::Object
34  {
35  public:
36  typedef std::vector<mitk::DataNode *> Nodes;
38 
39  DataNodeEvent NodeChanged;
40  DataNodeEvent NodeAdded;
41  DataNodeEvent NodeRemoved;
43 
45 
48 
49  protected:
50  DataStorageSelection(mitk::DataStorage *_DataStorage, bool _AutoAddNodes);
51  DataStorageSelection(mitk::DataStorage *_DataStorage, mitk::NodePredicateBase *_Predicate, bool _AutoAddNodes);
52 
53  public:
54  virtual ~DataStorageSelection();
55 
63  mitk::NodePredicateBase::Pointer GetPredicate() const;
67  unsigned int GetSize() const;
71  mitk::DataNode::Pointer GetNode(unsigned int index) const;
75  mitk::DataNode::Pointer GetNode() const;
79  std::vector<mitk::DataNode *> GetNodes() const;
83  bool DoesAutoAddNodes() const;
84 
85  public:
89  DataStorageSelection &operator=(mitk::DataNode *node);
97  virtual void SetDataStorage(mitk::DataStorage *_DataStorage);
101  virtual void SetPredicate(mitk::NodePredicateBase *_Predicate);
105  virtual void AddNode(const mitk::DataNode *node);
109  virtual void RemoveNode(const mitk::DataNode *node);
113  virtual void RemoveAllNodes();
117  virtual void ObjectChanged(const itk::Object *caller, const itk::EventObject &event);
118 
119  protected:
123  mitk::DataNode::Pointer FindNode(const mitk::BaseProperty *prop) const;
127  mitk::DataNode::Pointer FindNode(const mitk::PropertyList *propList) const;
131  void Reset();
135  void RemoveListener(mitk::DataNode *node);
141  void AddListener(mitk::DataNode *node);
142 
143  protected:
160  std::vector<mitk::DataNode *> m_Nodes;
164  std::map<mitk::DataNode *, unsigned long> m_NodeModifiedObserverTags;
168  std::map<mitk::PropertyList *, unsigned long> m_PropertyListModifiedObserverTags;
172  std::map<mitk::PropertyList *, unsigned long> m_PropertyListDeletedObserverTags;
176  std::map<mitk::BaseProperty *, unsigned long> m_PropertyModifiedObserverTags;
180  std::map<mitk::BaseProperty *, unsigned long> m_PropertyDeletedObserverTags;
189  };
190 }
191 
192 #endif // mitkDataStorageSelection_h
Message1< const mitk::DataNode * > DataNodeEvent
Data management class that handles 'was created by' 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.
static mitk::DataStorage::Pointer GetDataStorage()
Key-value list holding instances of BaseProperty.
#define mitkNewMacro2Param(classname, typea, typeb)
Definition: mitkCommon.h:89
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:53
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:102
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:66