13 #ifndef QmitkMultiLabelInspector_h
14 #define QmitkMultiLabelInspector_h
24 #include <QItemSelectionModel>
27 class QStyledItemDelegate;
246 void OnDataChanged(
const QModelIndex& topLeft,
const QModelIndex& bottomRight,
247 const QList<int>& roles = QList<int>());
291 void OnChangeModelSelection(
const QItemSelection& selected,
const QItemSelection& deselected);
293 void OnContextMenuRequested(
const QPoint&);
296 void OnAddLabelInstance();
297 void OnDeleteGroup();
298 void OnDeleteAffectedLabel();
299 void OnDeleteLabels(
bool);
300 void OnClearLabels(
bool);
301 void OnMergeLabels(
bool);
303 void OnRenameGroup();
304 void OnRenameLabel(
bool);
305 void OnClearLabel(
bool);
307 void OnUnlockAffectedLabels();
308 void OnLockAffectedLabels();
310 void OnSetAffectedLabelsVisible();
311 void OnSetAffectedLabelsInvisible();
312 void OnSetOnlyActiveLabelVisible(
bool);
314 void OnItemDoubleClicked(
const QModelIndex& index);
316 void WaitCursorOn()
const;
317 void WaitCursorOff()
const;
318 void RestoreOverrideCursor()
const;
322 void OnEntered(
const QModelIndex& index);
325 void OnSearchLabel();
326 void RefreshCompleter();
328 QWidgetAction* CreateOpacityAction();
331 bool m_ShowVisibility =
true;
332 bool m_ShowLock =
true;
333 bool m_ShowOther =
false;
339 bool m_AllowVisibilityModification =
true;
343 bool m_AllowLockModification =
true;
347 bool m_AllowLabelModification =
false;
349 bool m_DefaultLabelNaming =
true;
351 bool m_ModelManipulationOngoing =
false;
353 bool m_AboutToShowContextMenu =
false;
355 bool m_CheckSelectionDueToExternalModelChange =
true;
357 mitk::DataNode::Pointer m_SegmentationNode;
358 unsigned long m_SegmentationNodeDataMTime;
361 mitk::LabelSuggestionHelper::ConstPointer m_SuggestionHelper;
364 QCompleter* m_Completer;
#define MITKSEGMENTATIONUI_EXPORT
bool GetAllowLabelModification() const
void SetLockOfAffectedLabels(bool visible) const
void SetMultiSelectionMode(bool multiMode)
void SetVisibilityOfAffectedLabels(bool visible) const
mitk::Label * AddNewLabelInstanceInternal(mitk::Label *templateLabel)
Adds an instance of the same label/class like the passed label value.
mitk::Label * AddNewLabelInternal(const mitk::MultiLabelSegmentation::GroupIndexType &containingGroup)
void RemoveGroup()
Removes the group of the first currently selected label of the segmentation. If no label is selected ...
void CurrentSelectionChanged(LabelValueVectorType labels) const
A signal that will be emitted if the selected labels change.
void OnCopyToGroup()
Copies a label to another group.
void keyPressEvent(QKeyEvent *event) override
bool GetAllowVisibilityModification() const
const mitk::LabelSuggestionHelper * GetLabelSuggestionHelper() const
QStyledItemDelegate * m_VisibilityItemDelegate
QmitkMultiLabelInspector(QWidget *parent=nullptr)
void DeleteLabel()
Delete the first currently selected label and all its instances of the segmentation....
IndexLevelType GetCurrentLevelType() const
Returns the level of the index that currently has the focus in the tree view.
void SetSelectedLabel(mitk::MultiLabelSegmentation::LabelValueType selectedLabel)
The passed label will be used as new selection in the widget.
QStyledItemDelegate * m_LockItemDelegate
LabelValueVectorType GetSelectedLabelsFromSelectionModel() const
QmitkMultiLabelTreeModel * m_Model
mitk::Label * AddNewGroup()
Adds a new group with a new label to segmentation.
void SegmentationChanged() const
Signal is emitted, if the segmentation is changed that is observed by the inspector.
LabelValueVectorType GetLabelInstancesOfSelectedFirstLabel() const
Returns the values of all label instances that are of the same label (class) like the first selected ...
void RemoveGroupInternal(const mitk::MultiLabelSegmentation::GroupIndexType &groupID)
void SetAllowLabelModification(bool labelMod)
void UpdateSelectionModel(const LabelValueVectorType &selectedLabels)
bool GetModelManipulationOngoing() const
void SetAllowVisibilityModification(bool visiblityMod)
void DeleteLabelInternal(const LabelValueVectorType &labelValues)
void SetLabelSuggestionHelper(const mitk::LabelSuggestionHelper *suggestionHelper)
mitk::Label * GetCurrentLabel() const
Returns the label that currently has the focus in the tree view.
Ui::QmitkMultiLabelInspector * m_Controls
void OnDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles=QList< int >())
LabelValueVectorType m_LastValidSelectedLabels
mitk::MultiLabelSegmentation::LabelValueVectorType LabelValueVectorType
LabelValueVectorType GetCurrentlyAffactedLabelInstances() const
Returns all label values that are currently affected.
mitk::MultiLabelSegmentation * GetMultiLabelSegmentation() const
void keyReleaseEvent(QKeyEvent *event) override
mitk::Label * GetFirstSelectedLabelObject() const
Helper that returns the label object (if multiple labels are selected the first).
LabelValueVectorType GetSelectedLabels() const
Retrieve the currently selected labels (equals the last CurrentSelectionChanged values).
void LabelRenameRequested(mitk::Label *label, bool rename, bool &canceled) const
Signal that is emitted, if a label should be (re)named and default label naming is deactivated.
bool GetMultiSelectionMode() const
mitk::MultiLabelSegmentation::LabelValueType LabelValueType
void SetMultiLabelNode(mitk::DataNode *node)
Sets the segmentation node that will be used /monitored by the widget.
void ModelUpdated() const
Signal that is emitted, if the model was updated (e.g. by a delete or add operation).
void SetSelectedLabels(const LabelValueVectorType &selectedLabels)
Transform a list of label values into the new selection of the inspector.
mitk::Label * AddNewLabelInstance()
Adds an instance of the same label/class like the first label instance indicated by GetSelectedLabels...
void GoToLabel(LabelValueType label, const mitk::Point3D &point) const
A signal that will be emitted if the user has requested to "go to" a certain label.
mitk::MultiLabelSegmentation::Pointer m_Segmentation
mitk::Label * AddNewLabel()
Adds a new label to the segmentation. Depending on the settings the name of the label will be either ...
void SetDefaultLabelNaming(bool defaultLabelNaming)
bool GetAllowLockModification() const
void SetAllowLockModification(bool lockMod)
~QmitkMultiLabelInspector()
void DeleteLabelInstance()
Removes the first currently selected label instance of the segmentation. If no label is selected noth...
void SetMultiLabelSegmentation(mitk::MultiLabelSegmentation *segmentation)
Sets the segmentation that will be used and monitored by the widget.
QStyledItemDelegate * m_ColorItemDelegate
mitk::DataNode * GetMultiLabelNode() const
Class for nodes of the DataTree.
Convenience class that helps to manage the lifetime of itk event observers.
Helper class for handling label suggestions with constraint checking.
A data structure describing a label.
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
std::size_t GroupIndexType
std::vector< LabelValueType > LabelValueVectorType
mitk::Label::PixelType LabelValueType