Medical Imaging Interaction Toolkit  2024.06.00
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:
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
mitk::DataStorageSelection::m_Predicate
mitk::NodePredicateBase::Pointer m_Predicate
Definition: mitkDataStorageSelection.h:152
mitk::DataStorageSelection::m_AutoAddNodes
bool m_AutoAddNodes
Definition: mitkDataStorageSelection.h:184
mitk::BaseProperty
Abstract base class for properties.
Definition: mitkBaseProperty.h:36
mitk::Message1< const mitk::DataNode * >
mitkNewMacro2Param
#define mitkNewMacro2Param(classname, typea, typeb)
Definition: mitkCommon.h:81
mitk::DataStorageSelection::DataNodeEvent
Message1< const mitk::DataNode * > DataNodeEvent
Definition: mitkDataStorageSelection.h:33
mitkDataStorage.h
MitkDataTypesExtExports.h
mitk::DataStorageSelection::m_SelfCall
bool m_SelfCall
Definition: mitkDataStorageSelection.h:180
mitk::DataStorageSelection::m_PropertyDeletedObserverTags
std::map< mitk::BaseProperty *, unsigned long > m_PropertyDeletedObserverTags
Maps a property to a delete observer tag.
Definition: mitkDataStorageSelection.h:176
MITKDATATYPESEXT_EXPORT
#define MITKDATATYPESEXT_EXPORT
Definition: MitkDataTypesExtExports.h:15
mitk::DataStorageSelection::m_DataStorageDeletedTag
unsigned int m_DataStorageDeletedTag
Definition: mitkDataStorageSelection.h:147
itk::SmartPointer< Self >
mitk::NodePredicateBase
Interface for evaluation conditions used in the DataStorage class GetSubset() method.
Definition: mitkNodePredicateBase.h:35
mitk::DataStorageSelection::NodeChanged
DataNodeEvent NodeChanged
Definition: mitkDataStorageSelection.h:35
mitk::Message2< const mitk::DataNode *, const mitk::BaseProperty * >
mitkNodePredicateBase.h
mitkNewMacro3Param
#define mitkNewMacro3Param(classname, typea, typeb, typec)
Definition: mitkCommon.h:94
mitkClassMacroItkParent
#define mitkClassMacroItkParent(className, SuperClassName)
Definition: mitkCommon.h:45
mitk::DataStorageSelection::NodeAdded
DataNodeEvent NodeAdded
Definition: mitkDataStorageSelection.h:36
mitk
Find image slices visible on a given plane.
Definition: RenderingTests.dox:1
mitk::DataStorageSelection
Definition: mitkDataStorageSelection.h:29
mitk::DataStorageSelection::m_PropertyListModifiedObserverTags
std::map< mitk::PropertyList *, unsigned long > m_PropertyListModifiedObserverTags
Maps a propertylist to a modified observer tag.
Definition: mitkDataStorageSelection.h:164
mitkCommon.h
mitk::PropertyList
Key-value list holding instances of BaseProperty.
Definition: mitkPropertyList.h:56
mitk::DataStorageSelection::m_PropertyModifiedObserverTags
std::map< mitk::BaseProperty *, unsigned long > m_PropertyModifiedObserverTags
Maps a property to a modified observer tag.
Definition: mitkDataStorageSelection.h:172
mitk::DataStorage
Data management class that handles 'was created by' relations.
Definition: mitkDataStorage.h:43
mitk::DataStorageSelection::m_Nodes
std::vector< mitk::DataNode * > m_Nodes
Definition: mitkDataStorageSelection.h:156
mitk::DataStorageSelection::NodeRemoved
DataNodeEvent NodeRemoved
Definition: mitkDataStorageSelection.h:37
mitk::DataStorageSelection::Nodes
std::vector< mitk::DataNode * > Nodes
Definition: mitkDataStorageSelection.h:32
mitk::DataStorageSelection::m_PropertyListDeletedObserverTags
std::map< mitk::PropertyList *, unsigned long > m_PropertyListDeletedObserverTags
Maps a propertylist to a delete observer tag.
Definition: mitkDataStorageSelection.h:168
mitk::DataStorageSelection::m_DataStorage
mitk::DataStorage * m_DataStorage
Definition: mitkDataStorageSelection.h:143
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
mitk::DataStorageSelection::PropertyChanged
Message2< const mitk::DataNode *, const mitk::BaseProperty * > PropertyChanged
Definition: mitkDataStorageSelection.h:38
mitk::DataStorageSelection::m_NodeModifiedObserverTags
std::map< mitk::DataNode *, unsigned long > m_NodeModifiedObserverTags
Maps a node to a modified observer tag.
Definition: mitkDataStorageSelection.h:160