Medical Imaging Interaction Toolkit  2024.12.00
Medical Imaging Interaction Toolkit
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
QmitkDataStorageComboBox.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 QmitkDataStorageComboBox_h
14 #define QmitkDataStorageComboBox_h
15 
16 #include <MitkQtWidgetsExports.h>
17 
18 // Own Includes
19 #include "mitkDataNode.h"
20 #include "mitkDataStorage.h"
21 #include "mitkNodePredicateBase.h"
22 #include "mitkWeakPointer.h"
23 
24 // Toolkit Includes
25 #include <QComboBox>
26 #include <map>
27 
39 {
40  Q_OBJECT
41 
42 public:
46  QmitkDataStorageComboBox(QWidget *parent = nullptr, bool autoSelectNewNodes = false);
47 
52  const mitk::NodePredicateBase *predicate,
53  QWidget *parent = nullptr,
54  bool autoSelectNewNodes = false);
55 
59  ~QmitkDataStorageComboBox() override;
60 
64  virtual int Find(const mitk::DataNode *dataNode) const;
65 
66 public:
70  mitk::DataStorage::Pointer GetDataStorage() const;
74  const mitk::NodePredicateBase::ConstPointer GetPredicate() const;
78  virtual mitk::DataNode::Pointer GetNode(int index) const;
82  virtual mitk::DataNode::Pointer GetSelectedNode() const;
86  mitk::DataStorage::SetOfObjects::ConstPointer GetNodes() const;
91  virtual bool GetAutoSelectNewItems();
92 
93 public:
98  void SetDataStorage(mitk::DataStorage *dataStorage);
103  void SetPredicate(const mitk::NodePredicateBase *predicate);
107  virtual void AddNode(const mitk::DataNode *dataNode);
112  virtual void RemoveNode(int index);
116  virtual void RemoveNode(const mitk::DataNode *dataNode);
121  virtual void SetNode(int index, const mitk::DataNode *dataNode);
126  virtual void SetNode(const mitk::DataNode *dataNode, const mitk::DataNode *otherDataNode);
130  virtual void SetAutoSelectNewItems(bool autoSelectNewItems);
134  virtual void OnPropertyListChanged(const itk::Object *caller, const itk::EventObject &event);
135 
136 signals:
140  void OnSelectionChanged(const mitk::DataNode *);
141 
142 protected:
146  bool HasIndex(unsigned int index) const;
147 
148 protected slots:
152  void OnCurrentIndexChanged(int);
153 
154 public slots:
158  void SetSelectedNode(const mitk::DataNode::Pointer& node);
159 
160 protected:
171  virtual void InsertNode(int index, const mitk::DataNode *dataNode);
172 
176  void Init();
177 
181  virtual void Reset();
182 
183  void RemoveNodeAndPropertyLists(int index);
184 
185  virtual void UpdateComboBoxText(const mitk::PropertyList*);
186 
187 protected:
193 
199 
203  std::vector<mitk::DataNode *> m_Nodes;
204 
209 
214 
219 
223 };
224 
225 #endif
QmitkDataStorageComboBox::m_BaseDatapropertyListObserverTags
std::vector< long > m_BaseDatapropertyListObserverTags
Holds the tags of the base data property observers.
Definition: QmitkDataStorageComboBox.h:213
MITKQTWIDGETS_EXPORT
#define MITKQTWIDGETS_EXPORT
Definition: MitkQtWidgetsExports.h:15
QmitkDataStorageComboBox::m_Nodes
std::vector< mitk::DataNode * > m_Nodes
Definition: QmitkDataStorageComboBox.h:203
QmitkDataStorageComboBox::m_DataNodePropertyListObserverTags
std::vector< long > m_DataNodePropertyListObserverTags
Holds the tags of the data node property observers.
Definition: QmitkDataStorageComboBox.h:208
mitkDataStorage.h
itk::SmartPointer< Self >
mitk::NodePredicateBase
Interface for evaluation conditions used in the DataStorage class GetSubset() method.
Definition: mitkNodePredicateBase.h:35
QmitkDataStorageComboBox::m_DataStorage
mitk::WeakPointer< mitk::DataStorage > m_DataStorage
Definition: QmitkDataStorageComboBox.h:192
mitkNodePredicateBase.h
QmitkDataStorageComboBox::m_BlockEvents
bool m_BlockEvents
Event function guard. Each function which is called by an event mechanism first checks if this is tru...
Definition: QmitkDataStorageComboBox.h:218
QmitkDataStorageComboBox::m_Predicate
mitk::NodePredicateBase::ConstPointer m_Predicate
Holds the predicate that is responsible for the dataNode selection of this ComboBox....
Definition: QmitkDataStorageComboBox.h:198
MitkQtWidgetsExports.h
mitk::PropertyList
Key-value list holding instances of BaseProperty.
Definition: mitkPropertyList.h:56
mitk::DataStorage
Data management class that handles 'was created by' relations.
Definition: mitkDataStorage.h:43
mitkDataNode.h
mitkWeakPointer.h
QmitkDataStorageComboBox
Displays all or a subset (defined by a predicate) of nodes of the Data Storage.
Definition: QmitkDataStorageComboBox.h:38
mitk::WeakPointer< mitk::DataStorage >
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
QmitkDataStorageComboBox::m_AutoSelectNewNodes
bool m_AutoSelectNewNodes
If set to "true" new Nodes will be automatically selected.
Definition: QmitkDataStorageComboBox.h:222