Medical Imaging Interaction Toolkit  2023.04.00
Medical Imaging Interaction Toolkit
QmitkLesionTreeModel.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 QmitkLesionTreeModel_h
14 #define QmitkLesionTreeModel_h
15 
16 // mitk semantic relations UI
19 #include "QmitkLesionTreeItem.h"
20 
21 /*
22 * @brief The 'QmitkLesionTreeModel' is a subclass of 'QmitkAbstractSemanticRelationsStorageModel' and provides
23 * functionality to serve as a tree model.
24 * The tree model creates a new top-level tree item for each lesion that is stored inside the semantic relations storage.
25 * Each lesion tree item contains lesion data that can be display inside a tree view. The lesion data
26 * consists of a lesion with with its UID, name and lesion class. The name or UID is used for the top-level tree items.
27 * Additionally the lesion data contains two vectors which define the lesion presence (bool) and the lesion volume (double)
28 * for each control-point - information type pair. The lesion presence will be used inside this model for the tree items.
29 * The volume is used inside another tree model.
30 *
31 * The model holds the last segmentation that is added to the data storage to support the process of defining a new lesion
32 * (and linking it with the latest segmentation) (see 'NodeAdded').
33 * Furthermore the model is able to accept a 'QList' of currently selected data nodes and to use it to change the background
34 * color of each lesion tree item that is connected to this data node(s). This helps to see which lesion is already found and
35 * defined for a given (set of) data node(s).
36 */
38 {
39  Q_OBJECT
40 
41 public:
42 
46  QmitkLesionTreeModel(QObject* parent = nullptr);
47 
49  // overridden virtual functions from QAbstractItemModel
51  QModelIndex index(int row, int column, const QModelIndex& itemIndex = QModelIndex()) const override;
52  QModelIndex parent(const QModelIndex& itemIndex) const override;
53 
54  int rowCount(const QModelIndex& itemIndex = QModelIndex()) const override;
55  int columnCount(const QModelIndex& itemIndex = QModelIndex()) const override;
56 
57  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
58 
59  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
61  // end override
63 
64  const mitk::DataNode* GetLastSegmentation() const;
65 
66 protected:
67 
68  // the following functions have to be overridden but are not implemented in this model
69  void NodePredicateChanged() override { }
70  void NodeAdded(const mitk::DataNode*) override;
71  void NodeChanged(const mitk::DataNode*) override { }
72  void NodeRemoved(const mitk::DataNode*) override { }
78  void SetData() override;
79 
80 private:
81 
82  void SetLesionData();
83  void AddLesion(const mitk::SemanticTypes::Lesion& lesion);
84  void SetSelectedDataNodesPresence();
94  void SetDataNodePresenceOfLesion(const mitk::SemanticTypes::Lesion* lesion, bool dataNodePresence);
95 
96  QmitkLesionTreeItem* GetItemByIndex(const QModelIndex& index) const;
97 
98  std::map<mitk::SemanticTypes::ID, bool> m_DataNodePresence;
99  const mitk::DataNode* m_LastSegmentation;
100 
101  std::shared_ptr<QmitkLesionTreeItem> m_RootItem;
103  mitk::SemanticTypes::LesionVector m_CurrentLesions;
104 };
105 
106 #endif
MitkSemanticRelationsUIExports.h
mitk::SemanticTypes::ControlPointVector
std::vector< ControlPoint > ControlPointVector
Definition: mitkSemanticTypes.h:118
mitk::RelationStorage::AddLesion
void AddLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion)
MITKSEMANTICRELATIONSUI_EXPORT
#define MITKSEMANTICRELATIONSUI_EXPORT
Definition: MitkSemanticRelationsUIExports.h:15
QmitkLesionTreeModel::NodePredicateChanged
void NodePredicateChanged() override
Definition: QmitkLesionTreeModel.h:69
QmitkLesionTreeItem.h
mitk::SemanticTypes::Lesion
Definition: mitkSemanticTypes.h:108
QmitkAbstractSemanticRelationsStorageModel.h
QmitkLesionTreeItem
Definition: QmitkLesionTreeItem.h:34
QmitkAbstractSemanticRelationsStorageModel::SetData
virtual void SetData()=0
This function is called if the model data is updated. It can be used by subclasses to define the way ...
QmitkLesionTreeModel::NodeRemoved
void NodeRemoved(const mitk::DataNode *) override
Definition: QmitkLesionTreeModel.h:72
QmitkLesionTreeModel
Definition: QmitkLesionTreeModel.h:37
QmitkAbstractDataStorageModel::NodeAdded
virtual void NodeAdded(const mitk::DataNode *node)=0
QmitkAbstractSemanticRelationsStorageModel
Definition: QmitkAbstractSemanticRelationsStorageModel.h:32
mitk::SemanticTypes::LesionVector
std::vector< Lesion > LesionVector
Definition: mitkSemanticTypes.h:116
QmitkLesionTreeModel::NodeChanged
void NodeChanged(const mitk::DataNode *) override
Definition: QmitkLesionTreeModel.h:71
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63