14 #ifndef QmitkMultiLabelTreeModel_h
15 #define QmitkMultiLabelTreeModel_h
21 #include <QAbstractItemModel>
26 class QmitkMultiLabelSegTreeItem;
46 Qt::ItemFlags
flags(
const QModelIndex &index)
const override;
47 QVariant
data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
48 bool setData(
const QModelIndex& index,
const QVariant& value,
int role = Qt::EditRole)
override;
50 QVariant
headerData(
int section, Qt::Orientation orientation,
int role)
const override;
51 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
52 int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
54 QModelIndex
index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const override;
55 QModelIndex
parent(
const QModelIndex &child)
const override;
103 LabelInstanceDataRole = 66,
109 LabelInstanceValueRole = 67,
143 void UpdateInternalTree();
144 void GenerateInternalGroupTree(
unsigned int layerID, QmitkMultiLabelSegTreeItem* layerItem);
145 QmitkMultiLabelSegTreeItem* GenerateInternalTree();
148 const QmitkMultiLabelSegTreeItem* ClosestLabelInstanceIndex(
const QmitkMultiLabelSegTreeItem* currentItem)
const;
150 mitk::MultiLabelSegmentation::Pointer m_Segmentation;
153 std::unique_ptr<QmitkMultiLabelSegTreeItem> m_RootItem;
155 bool m_ShowGroups =
true;
157 bool m_ShowVisibility =
true;
158 bool m_ShowLock =
true;
159 bool m_ShowOther =
false;
161 bool m_AllowVisibilityModification =
true;
162 bool m_AllowLockModification =
true;
163 bool m_ModelUpdateOngoing =
false;
#define MITKSEGMENTATIONUI_EXPORT
Qt::ItemFlags flags(const QModelIndex &index) const override
~QmitkMultiLabelTreeModel() override
QVariant headerData(int section, Qt::Orientation orientation, int role) const override
void OnGroupAdded(GroupIndexType groupIndex)
void ITKEventHandler(const itk::EventObject &e)
LabelValueType GetNearestLabelValueToLastChange() const
mitk::MultiLabelSegmentation::LabelValueType LabelValueType
int columnCount(const QModelIndex &parent=QModelIndex()) const override
void SetSegmentation(mitk::MultiLabelSegmentation *segmentation)
void OnLabelRemoved(LabelValueType labelValue)
mitk::MultiLabelSegmentation::GroupIndexType GroupIndexType
QModelIndex indexOfGroup(mitk::MultiLabelSegmentation::GroupIndexType groupIndex) const
std::vector< LabelValueType > GetLabelsInSubTree(const QModelIndex ¤tIndex) const
** Returns the index to the next node in the tree that behaves like an instance (label node with onl...
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
QModelIndex parent(const QModelIndex &child) const override
QModelIndex indexOfLabel(mitk::Label::PixelType labelValue) const
bool GetAllowLockModification() const
int rowCount(const QModelIndex &parent=QModelIndex()) const override
void OnLabelAdded(LabelValueType labelValue)
QModelIndex FirstLabelInstanceIndex(const QModelIndex ¤tIndex) const
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
std::vector< LabelValueType > GetLabelInstancesOfSameLabelClass(const QModelIndex ¤tIndex) const
void OnLabelModified(LabelValueType labelValue)
void SetAllowVisibilityModification(bool vmod)
bool GetModelUpdateOngoing() const
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
void OnGroupRemoved(GroupIndexType groupIndex)
void SetAllowLockModification(bool lmod)
bool GetAllowVisibilityModification() const
void OnGroupModified(GroupIndexType groupIndex)
const mitk::MultiLabelSegmentation * GetSegmentation() const
QmitkMultiLabelTreeModel(QObject *parent=nullptr)
Convenience class that helps to manage the lifetime of itk event observers.
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
std::size_t GroupIndexType
mitk::Label::PixelType LabelValueType