13 #ifndef QmitkMultiLabelInspector_h
14 #define QmitkMultiLabelInspector_h
24 #include <QItemSelectionModel>
28 class QStyledItemDelegate;
259 void OnDataChanged(
const QModelIndex& topLeft,
const QModelIndex& bottomRight,
260 const QList<int>& roles = QList<int>());
283 bool skipNamingPrompt =
false);
305 void OnChangeModelSelection(
const QItemSelection& selected,
const QItemSelection& deselected);
307 void OnContextMenuRequested(
const QPoint&);
310 void OnAddLabelInstance();
311 void OnDeleteGroup();
312 void OnDeleteAffectedLabel();
313 void OnDeleteLabels(
bool);
314 void OnClearLabels(
bool);
315 void OnMergeLabels(
bool);
317 void OnRenameGroup();
318 void OnRenameLabel(
bool);
319 void OnClearLabel(
bool);
321 void OnUnlockAffectedLabels();
322 void OnLockAffectedLabels();
324 void OnSetAffectedLabelsVisible();
325 void OnSetAffectedLabelsInvisible();
326 void OnSetOnlyActiveLabelVisible(
bool);
328 void OnItemDoubleClicked(
const QModelIndex& index);
330 void WaitCursorOn()
const;
331 void WaitCursorOff()
const;
332 void RestoreOverrideCursor()
const;
336 void OnEntered(
const QModelIndex& index);
339 void OnSearchLabel();
340 void RefreshCompleter();
342 QWidgetAction* CreateOpacityAction();
345 bool m_ShowVisibility =
true;
346 bool m_ShowLock =
true;
347 bool m_ShowOther =
false;
353 bool m_AllowVisibilityModification =
true;
357 bool m_AllowLockModification =
true;
361 bool m_AllowLabelModification =
false;
363 bool m_DefaultLabelNaming =
true;
365 bool m_ModelManipulationOngoing =
false;
367 bool m_AboutToShowContextMenu =
false;
369 bool m_CheckSelectionDueToExternalModelChange =
true;
371 mitk::DataNode::Pointer m_SegmentationNode;
372 unsigned long m_SegmentationNodeDataMTime;
375 mitk::LabelSuggestionHelper::ConstPointer m_SuggestionHelper;
378 QCompleter* m_Completer;
#define MITKSEGMENTATIONUI_EXPORT
Inspector widget providing a tree view on labels and groups of a MultiLabelSegmentation instance.
mitk::Label * AddNewLabel(bool skipNamingPrompt=false)
Adds a new label to the segmentation. Depending on the settings the name of the label will be either ...
bool GetAllowLabelModification() const
Returns whether label modification (add/remove/rename) is allowed.
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.
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
Returns whether visibility modification is allowed.
const mitk::LabelSuggestionHelper * GetLabelSuggestionHelper() const
std::unique_ptr< Ui::QmitkMultiLabelInspector > m_Controls
QStyledItemDelegate * m_VisibilityItemDelegate
QmitkMultiLabelInspector(QWidget *parent=nullptr)
Constructs the multi-label inspector widget.
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 ...
mitk::Label * AddNewLabelInternal(const mitk::MultiLabelSegmentation::GroupIndexType &containingGroup, bool skipNamingPrompt=false)
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.
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
Returns whether multi-selection mode is enabled.
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
void SetDefaultLabelNaming(bool defaultLabelNaming)
bool GetAllowLockModification() const
Returns whether lock modification is allowed.
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
Tree model representing the information of an MITK MultiLabel segmentation instance (labels,...
Central node class of the MITK data tree, associating a data object with properties and mappers.
Convenience class that helps to manage the lifetime of itk event observers.
RAII guard for managing label highlighting on data nodes.
Helper class for handling label suggestions with constraint checking.
A data structure describing a label in a multi-label segmentation.
MultiLabelSegmentation class for handling labels and layers in a segmentation session.
std::size_t GroupIndexType
std::vector< LabelValueType > LabelValueVectorType
mitk::Label::PixelType LabelValueType