14 #ifndef QmitkMultiLabelTreeModel_h
15 #define QmitkMultiLabelTreeModel_h
21 #include <QAbstractItemModel>
26 class QmitkMultiLabelSegTreeItem;
48 Qt::ItemFlags
flags(
const QModelIndex &index)
const override;
49 QVariant
data(
const QModelIndex &index,
int role = Qt::DisplayRole)
const override;
50 bool setData(
const QModelIndex& index,
const QVariant& value,
int role = Qt::EditRole)
override;
52 QVariant
headerData(
int section, Qt::Orientation orientation,
int role)
const override;
53 int rowCount(
const QModelIndex &parent = QModelIndex())
const override;
54 int columnCount(
const QModelIndex &parent = QModelIndex())
const override;
56 QModelIndex
index(
int row,
int column,
const QModelIndex &parent = QModelIndex())
const override;
57 QModelIndex
parent(
const QModelIndex &child)
const override;
105 LabelInstanceDataRole = 66,
111 LabelInstanceValueRole = 67,
145 void UpdateInternalTree();
146 void GenerateInternalGroupTree(
unsigned int layerID, QmitkMultiLabelSegTreeItem* layerItem);
147 QmitkMultiLabelSegTreeItem* GenerateInternalTree();
150 const QmitkMultiLabelSegTreeItem* ClosestLabelInstanceIndex(
const QmitkMultiLabelSegTreeItem* currentItem)
const;
152 mitk::MultiLabelSegmentation::Pointer m_Segmentation;
155 std::unique_ptr<QmitkMultiLabelSegTreeItem> m_RootItem;
157 bool m_ShowGroups =
true;
159 bool m_ShowVisibility =
true;
160 bool m_ShowLock =
true;
161 bool m_ShowOther =
false;
163 bool m_AllowVisibilityModification =
true;
164 bool m_AllowLockModification =
true;
165 bool m_ModelUpdateOngoing =
false;
#define MITKSEGMENTATIONUI_EXPORT
Tree model representing the information of an MITK MultiLabel segmentation instance (labels,...
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)
Sets the segmentation whose labels and groups are represented by this model.
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
Returns the segmentation represented by this model.
QmitkMultiLabelTreeModel(QObject *parent=nullptr)
Constructs the tree model.
Convenience class that helps to manage the lifetime of itk event observers.
unsigned short PixelType
Pixel type used for label values (unsigned short).
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
std::size_t GroupIndexType
mitk::Label::PixelType LabelValueType