Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
QmitkStatisticsTreeModel.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 QmitkStatisticsTreeModel_h
14 #define QmitkStatisticsTreeModel_h
15 
16 // mitk semantic relations UI
19 #include "QmitkLesionTreeItem.h"
21 
22 /*
23 * @brief The 'QmitkStatisticsTreeModel' is a subclass of 'QmitkAbstractSemanticRelationsStorageModel' and provides
24 * functionality to serve as a tree model.
25 * The tree model creates a new top-level tree item for each lesion that is stored inside the semantic relations storage.
26 * The top-level lesion tree items hold child items for each information type.
27 * Each lesion tree item contains lesion data that can be display inside a tree view. The lesion data
28 * consists of a lesion with with its UID, name and lesion class. The name or UID is used for the top-level tree items.
29 * Additionally the lesion data contains two vectors which define the lesion presence (bool) and the lesion volume (double)
30 * for each control-point - information type pair. The lesion volume will be used inside this model for the child items.
31 * The presence is used inside another tree model.
32 *
33 * The model uses the 'QmitkStatisticsCalculator' to start the lesion volume calculation for each lesion.
34 * This calculator is able to find an existing lesion volume or to trigger the computation of the required statistics.
35 * If the required statistics are newly computed and added as a statistics container to the data storage,
36 * this model will be notified about this event (see 'NodeAdded', 'NodeChanged' and 'NodeRemoved') and will update
37 * its lesion tree items.
38 */
40 {
41  Q_OBJECT
42 
43 public:
44 
48  QmitkStatisticsTreeModel(QObject* parent = nullptr);
49 
51  // overridden virtual functions from QAbstractItemModel
53  QModelIndex index(int row, int column, const QModelIndex& itemIndex = QModelIndex()) const override;
54  QModelIndex parent(const QModelIndex& itemIndex) const override;
55 
56  int rowCount(const QModelIndex& itemIndex = QModelIndex()) const override;
57  int columnCount(const QModelIndex& itemIndex = QModelIndex()) const override;
58 
59  QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override;
60  QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
62  // end override
64 
65 protected:
66 
67  void DataStorageChanged() override;
68  void NodePredicateChanged() override { }
69  void NodeAdded(const mitk::DataNode*) override;
70  void NodeChanged(const mitk::DataNode*) override;
71  void NodeRemoved(const mitk::DataNode*) override;
77  void SetData() override;
78 
79 private:
80 
81  void SetLesionData();
82  void AddLesion(const mitk::SemanticTypes::Lesion& lesion);
83 
84  QmitkLesionTreeItem* GetItemByIndex(const QModelIndex& index) const;
85 
86  std::unique_ptr<QmitkStatisticsCalculator> m_StatisticsCalculator;
87 
88  std::shared_ptr<QmitkLesionTreeItem> m_RootItem;
91  mitk::SemanticTypes::LesionVector m_CurrentLesions;
92 };
93 
94 #endif
QmitkStatisticsCalculator.h
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
QmitkAbstractSemanticRelationsStorageModel::DataStorageChanged
void DataStorageChanged() override
Create a new 'SemanticRelationsDataStorageAccess' instance with the new data storage and update the m...
QmitkLesionTreeItem.h
mitk::SemanticTypes::Lesion
Definition: mitkSemanticTypes.h:108
QmitkAbstractSemanticRelationsStorageModel.h
QmitkAbstractDataStorageModel::NodeRemoved
virtual void NodeRemoved(const mitk::DataNode *node)=0
QmitkAbstractDataStorageModel::NodeChanged
virtual void NodeChanged(const mitk::DataNode *node)=0
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 ...
mitk::SemanticTypes::InformationTypeVector
std::vector< InformationType > InformationTypeVector
Definition: mitkSemanticTypes.h:120
QmitkStatisticsTreeModel::NodePredicateChanged
void NodePredicateChanged() override
Definition: QmitkStatisticsTreeModel.h:68
QmitkAbstractDataStorageModel::NodeAdded
virtual void NodeAdded(const mitk::DataNode *node)=0
QmitkStatisticsTreeModel
Definition: QmitkStatisticsTreeModel.h:39
QmitkAbstractSemanticRelationsStorageModel
Definition: QmitkAbstractSemanticRelationsStorageModel.h:32
mitk::SemanticTypes::LesionVector
std::vector< Lesion > LesionVector
Definition: mitkSemanticTypes.h:116
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63