Medical Imaging Interaction Toolkit  2022.04.99-3f7a773b
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 // QMITKSTATISTICSTREEMODEL_H
virtual void SetData()=0
This function is called if the model data is updated. It can be used by subclasses to define the way ...
virtual void NodeChanged(const mitk::DataNode *node)=0
std::vector< Lesion > LesionVector
std::vector< ControlPoint > ControlPointVector
#define MITKSEMANTICRELATIONSUI_EXPORT
virtual void NodeRemoved(const mitk::DataNode *node)=0
void DataStorageChanged() override
Create a new &#39;SemanticRelationsDataStorageAccess&#39; instance with the new data storage and update the m...
virtual void NodeAdded(const mitk::DataNode *node)=0
std::vector< InformationType > InformationTypeVector
void AddLesion(const SemanticTypes::CaseID &caseID, const SemanticTypes::Lesion &lesion)
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63