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;
 
   64   QModelIndex FirstLabelInstanceIndex(
const QModelIndex& currentIndex) 
const;
 
   71   std::vector <LabelValueType> GetLabelsInSubTree(
const QModelIndex& currentIndex) 
const;
 
   79   std::vector <LabelValueType> GetLabelInstancesOfSameLabelClass(
const QModelIndex& currentIndex) 
const;
 
  103     LabelInstanceDataRole = 66,
 
  109     LabelInstanceValueRole = 67,
 
  114   bool GetAllowVisibilityModification() 
const;
 
  115   bool GetAllowLockModification() 
const;
 
  116   bool GetModelUpdateOngoing() 
const;
 
  119   LabelValueType GetNearestLabelValueToLastChange() 
const;
 
  122   void SetAllowVisibilityModification(
bool vmod);
 
  123   void SetAllowLockModification(
bool lmod);
 
  126   void dataAvailable();
 
  131   void ITKEventHandler(
const itk::EventObject& e);
 
  133   void OnLabelAdded(LabelValueType labelValue);
 
  134   void OnLabelModified(LabelValueType labelValue);
 
  135   void OnLabelRemoved(LabelValueType labelValue);
 
  136   void OnGroupAdded(GroupIndexType groupIndex);
 
  137   void OnGroupModified(GroupIndexType groupIndex);
 
  138   void OnGroupRemoved(GroupIndexType groupIndex);
 
  143   void UpdateInternalTree();
 
  144   void GenerateInternalGroupTree(
unsigned int layerID, QmitkMultiLabelSegTreeItem* layerItem);
 
  145   QmitkMultiLabelSegTreeItem* GenerateInternalTree();
 
  148   const QmitkMultiLabelSegTreeItem* ClosestLabelInstanceIndex(
const QmitkMultiLabelSegTreeItem* currentItem) 
const;
 
  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;