Medical Imaging Interaction Toolkit  2023.12.00
Medical Imaging Interaction Toolkit
QmitkLesionTreeItem.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 QmitkLesionTreeItem_h
14 #define QmitkLesionTreeItem_h
15 
16 // mitk semantic relations UI
17 #include "mitkLesionData.h"
18 
19 // mitk semantic relations
20 #include <mitkSemanticTypes.h>
21 
22 // qt
23 #include <QVariant>
24 
25 // c++
26 #include <memory>
27 #include <vector>
28 
29 /*
30 * @brief This class is used by custom tree models to create their tree items.
31 * It provides functions to traverse and modify the tree.
32 * Additionally it holds some 'LesionData' that is used to display lesion properties inside a tree view.
33 */
34 class QmitkLesionTreeItem : public std::enable_shared_from_this<QmitkLesionTreeItem>
35 {
36 public:
37 
38  using ChildPointer = std::shared_ptr<QmitkLesionTreeItem>;
39  using ChildConstPointer = std::shared_ptr<const QmitkLesionTreeItem>;
40  using ParentPointer = std::weak_ptr<QmitkLesionTreeItem>;
41 
43 
51  ChildPointer GetChildInRow(int row) const { return m_Children.at(row); };
57  ParentPointer GetParent() const { return m_ParentItem; };
63  void SetParent(ParentPointer parent);
69  mitk::LesionData& GetData() { return m_ItemData; };
75  int GetRow() const;
83  int GetRowOfChild(ChildConstPointer child) const;
89  size_t ChildCount() const { return m_Children.size(); };
95  void AddChild(ChildPointer child);
101  void RemoveChild(ChildPointer child);
107  void SetData(const mitk::LesionData& lesionData);
108 
109 private:
110 
111  ParentPointer m_ParentItem;
112  std::vector<ChildPointer> m_Children;
113  mitk::LesionData m_ItemData;
114 
115 };
116 
119 
120 #endif
QmitkLesionTreeItem::GetData
mitk::LesionData & GetData()
Return the item data, which contains ...
Definition: QmitkLesionTreeItem.h:69
mitkSemanticTypes.h
QmitkLesionTreeItem::ParentPointer
std::weak_ptr< QmitkLesionTreeItem > ParentPointer
Definition: QmitkLesionTreeItem.h:40
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(mitk::ProcessExecutor::Pointer)
QmitkLesionTreeItem::ChildCount
size_t ChildCount() const
Return the number of child items.
Definition: QmitkLesionTreeItem.h:89
QmitkLesionTreeItem::GetRowOfChild
int GetRowOfChild(ChildConstPointer child) const
Get the row of the given child item relative to this item.
QmitkLesionTreeItem::RemoveChild
void RemoveChild(ChildPointer child)
Remove a child from the list of children of this item.
QmitkLesionTreeItem::GetRow
int GetRow() const
Get the row of this item relative to its parent item using 'GetRowOfChild'.
QmitkLesionTreeItem
Definition: QmitkLesionTreeItem.h:34
mitkLesionData.h
QmitkLesionTreeItem::QmitkLesionTreeItem
QmitkLesionTreeItem(mitk::LesionData lesionData=mitk::LesionData())
QmitkLesionTreeItem::GetParent
ParentPointer GetParent() const
Return the parent item.
Definition: QmitkLesionTreeItem.h:57
QmitkLesionTreeItem::SetData
void SetData(const mitk::LesionData &lesionData)
Set the item data of this item.
QmitkLesionTreeItem::AddChild
void AddChild(ChildPointer child)
Add a new child to the list of children of this item if it is not already a child item.
QmitkLesionTreeItem::GetChildInRow
ChildPointer GetChildInRow(int row) const
Return the child of this item at a specific position.
Definition: QmitkLesionTreeItem.h:51
mitk::LesionData
This class holds the data of each lesion in the lesion tree view. The data is the lesion itself with ...
Definition: mitkLesionData.h:36
QmitkLesionTreeItem::ChildConstPointer
std::shared_ptr< const QmitkLesionTreeItem > ChildConstPointer
Definition: QmitkLesionTreeItem.h:39
QmitkLesionTreeItem::SetParent
void SetParent(ParentPointer parent)
Set the parent item of this item.
QmitkLesionTreeItem::ChildPointer
std::shared_ptr< QmitkLesionTreeItem > ChildPointer
Definition: QmitkLesionTreeItem.h:38