14 #ifndef QmitkMultiLabelTreeModel_h
15 #define QmitkMultiLabelTreeModel_h
20 #include <QAbstractItemModel>
25 class QmitkMultiLabelSegTreeItem;
45 Qt::ItemFlags flags(
const QModelIndex &index)
const override;
46 QVariant data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
47 bool setData(
const QModelIndex& index,
const QVariant& value,
int role = Qt::EditRole)
override;
49 QVariant headerData(
int section, Qt::Orientation orientation,
int role)
const override;
50 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
51 int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
53 QModelIndex index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const override;
54 QModelIndex parent(
const QModelIndex &child)
const override;
62 QModelIndex ClosestLabelInstanceIndex(
const QModelIndex& currentIndex)
const;
66 QModelIndex FirstLabelInstanceIndex(
const QModelIndex& currentIndex)
const;
73 std::vector <LabelValueType> GetLabelsInSubTree(
const QModelIndex& currentIndex)
const;
81 std::vector <LabelValueType> GetLabelInstancesOfSameLabelClass(
const QModelIndex& currentIndex)
const;
105 LabelInstanceDataRole = 66,
111 LabelInstanceValueRole = 67,
116 bool GetAllowVisibilityModification()
const;
117 bool GetAllowLockModification()
const;
120 void SetAllowVisibilityModification(
bool vmod);
121 void SetAllowLockModification(
bool lmod);
124 void dataAvailable();
129 void OnLabelAdded(LabelValueType labelValue);
130 void OnLabelModified(LabelValueType labelValue);
131 void OnLabelRemoved(LabelValueType labelValue);
132 void OnGroupAdded(GroupIndexType groupIndex);
133 void OnGroupModified(GroupIndexType groupIndex);
134 void OnGroupRemoved(GroupIndexType groupIndex);
138 void RemoveObserver();
140 void UpdateInternalTree();
141 void GenerateInternalGroupTree(
unsigned int layerID, QmitkMultiLabelSegTreeItem* layerItem);
142 QmitkMultiLabelSegTreeItem* GenerateInternalTree();
148 void BuildHierarchicalModel();
153 std::unique_ptr<QmitkMultiLabelSegTreeItem> m_RootItem;
156 bool m_ShowGroups =
true;
158 bool m_ShowVisibility =
true;
159 bool m_ShowLock =
true;
160 bool m_ShowOther =
false;
162 bool m_AllowVisibilityModification =
true;
163 bool m_AllowLockModification =
true;