Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkAbstractDataStorageModel.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 QmitkAbstractDataStorageModel_h
14 #define QmitkAbstractDataStorageModel_h
15 
16 #include <MitkQtWidgetsExports.h>
17 
18 // mitk core
19 #include <mitkDataStorage.h>
20 #include <mitkNodePredicateBase.h>
21 #include <mitkWeakPointer.h>
22 
23 // qt
24 #include <QAbstractItemModel>
25 
46 class MITKQTWIDGETS_EXPORT QmitkAbstractDataStorageModel : public QAbstractItemModel
47 {
48  Q_OBJECT
49 
50 public:
51 
53 
64  void SetDataStorage(mitk::DataStorage* dataStorage);
65 
70  mitk::DataStorage::Pointer GetDataStorage() const;
71 
80  void SetNodePredicate(const mitk::NodePredicateBase* nodePredicate);
81 
86  const mitk::NodePredicateBase* GetNodePredicate() const { return m_NodePredicate; }
87 
88 protected:
89 
90  virtual void DataStorageChanged() = 0;
91  virtual void NodePredicateChanged() = 0;
92 
93  virtual void NodeAdded(const mitk::DataNode* node) = 0;
94  virtual void NodeChanged(const mitk::DataNode* node) = 0;
95  virtual void NodeRemoved(const mitk::DataNode* node) = 0;
96 
97  QmitkAbstractDataStorageModel(QObject* parent = nullptr);
98  QmitkAbstractDataStorageModel(mitk::DataStorage* dataStorage, QObject* parent = nullptr);
99 
101  mitk::NodePredicateBase::ConstPointer m_NodePredicate;
102 
103 private:
104 
106  void SetDataStorageDeleted();
107 
108  unsigned long m_DataStorageDeletedTag;
109 
110 };
111 
112 #endif
#define MITKQTWIDGETS_EXPORT
Abstract base class extending QAbstractItemModel for DataStorage-backed models.
const mitk::NodePredicateBase * GetNodePredicate() const
Returns the currently set node predicate.
virtual void NodeAdded(const mitk::DataNode *node)=0
mitk::WeakPointer< mitk::DataStorage > m_DataStorage
mitk::NodePredicateBase::ConstPointer m_NodePredicate
mitk::DataStorage::Pointer GetDataStorage() const
Returns a locked pointer to the current data storage.
virtual void NodeChanged(const mitk::DataNode *node)=0
virtual void DataStorageChanged()=0
QmitkAbstractDataStorageModel(QObject *parent=nullptr)
void SetDataStorage(mitk::DataStorage *dataStorage)
Sets the data storage and registers node event listeners.
virtual void NodeRemoved(const mitk::DataNode *node)=0
QmitkAbstractDataStorageModel(mitk::DataStorage *dataStorage, QObject *parent=nullptr)
void SetNodePredicate(const mitk::NodePredicateBase *nodePredicate)
Sets the node predicate and triggers a model update.
~QmitkAbstractDataStorageModel() override
virtual void NodePredicateChanged()=0
Central node class of the MITK data tree, associating a data object with properties and mappers.
Definition: mitkDataNode.h:72
Abstract data management class that organizes DataNode objects in a directed acyclic graph.
Abstract base class for predicates used to filter DataNode objects in DataStorage queries.