Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
Medical Imaging Interaction Toolkit
QmitkMultiLabelInspector Class Reference

#include <QmitkMultiLabelInspector.h>

Inheritance diagram for QmitkMultiLabelInspector:
Collaboration diagram for QmitkMultiLabelInspector:

Public Types

enum  IndexLevelType { IndexLevelType::Group, IndexLevelType::LabelClass, IndexLevelType::LabelInstance }
 
using LabelValueType = mitk::LabelSetImage::LabelValueType
 
using LabelValueVectorType = mitk::LabelSetImage::LabelValueVectorType
 

Public Slots

void SetSelectedLabels (const LabelValueVectorType &selectedLabels)
 Transform a list of label values into the new selection of the inspector. More...
 
void SetSelectedLabel (mitk::LabelSetImage::LabelValueType selectedLabel)
 The passed label will be used as new selection in the widget. More...
 
void SetMultiLabelSegmentation (mitk::LabelSetImage *segmentation)
 Sets the segmentation that will be used and monitored by the widget. More...
 
mitk::LabelSetImageGetMultiLabelSegmentation () const
 
void SetMultiLabelNode (mitk::DataNode *node)
 Sets the segmentation node that will be used /monitored by the widget. More...
 
mitk::DataNodeGetMultiLabelNode () const
 
void SetMultiSelectionMode (bool multiMode)
 
void SetAllowVisibilityModification (bool visiblityMod)
 
void SetAllowLockModification (bool lockMod)
 
void SetAllowLabelModification (bool labelMod)
 
void SetDefaultLabelNaming (bool defaultLabelNaming)
 
mitk::LabelAddNewLabelInstance ()
 Adds an instance of the same label/class like the first label instance indicated by GetSelectedLabels() to the segmentation. More...
 
mitk::LabelAddNewLabel ()
 Adds a new label to the segmentation. Depending on the settings the name of the label will be either default generated or the rename delegate will be used. The label will be added to the same group as the first currently selected label. More...
 
void DeleteLabelInstance ()
 Removes the first currently selected label instance of the segmentation. If no label is selected nothing will happen. More...
 
void DeleteLabel ()
 Delete the first currently selected label and all its instances of the segmentation. If no label is selected nothing will happen. More...
 
mitk::LabelAddNewGroup ()
 Adds a new group with a new label to segmentation. More...
 
void RemoveGroup ()
 Removes the group of the first currently selected label of the segmentation. If no label is selected nothing will happen. More...
 
void SetVisibilityOfAffectedLabels (bool visible) const
 
void SetLockOfAffectedLabels (bool visible) const
 

Signals

void CurrentSelectionChanged (LabelValueVectorType labels) const
 A signal that will be emitted if the selected labels change. More...
 
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. More...
 
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. More...
 
void ModelUpdated () const
 Signal that is emitted, if the model was updated (e.g. by a delete or add operation). More...
 
void SegmentationChanged () const
 Signal is emitted, if the segmentation is changed that is observed by the inspector. More...
 

Public Member Functions

 QmitkMultiLabelInspector (QWidget *parent=nullptr)
 
 ~QmitkMultiLabelInspector ()
 
bool GetMultiSelectionMode () const
 
bool GetAllowVisibilityModification () const
 
bool GetAllowLockModification () const
 
bool GetAllowLabelModification () const
 
bool GetModelManipulationOngoing () const
 
LabelValueVectorType GetSelectedLabels () const
 Retrieve the currently selected labels (equals the last CurrentSelectionChanged values). More...
 
mitk::LabelGetCurrentLabel () const
 Returns the label that currently has the focus in the tree view. More...
 
IndexLevelType GetCurrentLevelType () const
 Returns the level of the index that currently has the focus in the tree view. More...
 
LabelValueVectorType GetCurrentlyAffactedLabelInstances () const
 Returns all label values that are currently affected. More...
 
LabelValueVectorType GetLabelInstancesOfSelectedFirstLabel () const
 Returns the values of all label instances that are of the same label (class) like the first selected label instance. More...
 

Protected Member Functions

void Initialize ()
 
void OnModelReset ()
 
void OnDataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles=QList< int >())
 
LabelValueVectorType GetSelectedLabelsFromSelectionModel () const
 
void UpdateSelectionModel (const LabelValueVectorType &selectedLabels)
 
mitk::LabelGetFirstSelectedLabelObject () const
 Helper that returns the label object (if multiple labels are selected the first). More...
 
mitk::LabelAddNewLabelInternal (const mitk::LabelSetImage::GroupIndexType &containingGroup)
 
mitk::LabelAddNewLabelInstanceInternal (mitk::Label *templateLabel)
 Adds an instance of the same label/class like the passed label value. More...
 
void RemoveGroupInternal (const mitk::LabelSetImage::GroupIndexType &groupID)
 
void DeleteLabelInternal (const LabelValueVectorType &labelValues)
 
void keyPressEvent (QKeyEvent *event) override
 
void keyReleaseEvent (QKeyEvent *event) override
 

Protected Attributes

QmitkMultiLabelTreeModelm_Model
 
mitk::LabelSetImage::Pointer m_Segmentation
 
LabelValueVectorType m_LastValidSelectedLabels
 
QStyledItemDelegate * m_LockItemDelegate
 
QStyledItemDelegate * m_ColorItemDelegate
 
QStyledItemDelegate * m_VisibilityItemDelegate
 
Ui::QmitkMultiLabelInspector * m_Controls
 

Detailed Description

Definition at line 38 of file QmitkMultiLabelInspector.h.

Member Typedef Documentation

◆ LabelValueType

◆ LabelValueVectorType

Member Enumeration Documentation

◆ IndexLevelType

Enumerator
Group 
LabelClass 
LabelInstance 

Definition at line 72 of file QmitkMultiLabelInspector.h.

Constructor & Destructor Documentation

◆ QmitkMultiLabelInspector()

QmitkMultiLabelInspector::QmitkMultiLabelInspector ( QWidget *  parent = nullptr)

◆ ~QmitkMultiLabelInspector()

QmitkMultiLabelInspector::~QmitkMultiLabelInspector ( )

Member Function Documentation

◆ AddNewGroup

mitk::Label* QmitkMultiLabelInspector::AddNewGroup ( )
slot

Adds a new group with a new label to segmentation.

Precondition
AllowLabeModification must be set to true.

◆ AddNewLabel

mitk::Label* QmitkMultiLabelInspector::AddNewLabel ( )
slot

Adds a new label to the segmentation. Depending on the settings the name of the label will be either default generated or the rename delegate will be used. The label will be added to the same group as the first currently selected label.

Precondition
AllowLabeModification must be set to true.

◆ AddNewLabelInstance

mitk::Label* QmitkMultiLabelInspector::AddNewLabelInstance ( )
slot

Adds an instance of the same label/class like the first label instance indicated by GetSelectedLabels() to the segmentation.

This new label instance is returned by the function. If the inspector has no selected label, no new instance will be generated and nullptr will be returned.

Remarks
The new label instance is a clone of the selected label instance. Therefore all properties but the LabelValue will be the same.
Precondition
AllowLabeModification must be set to true.

◆ AddNewLabelInstanceInternal()

mitk::Label* QmitkMultiLabelInspector::AddNewLabelInstanceInternal ( mitk::Label templateLabel)
protected

Adds an instance of the same label/class like the passed label value.

◆ AddNewLabelInternal()

mitk::Label* QmitkMultiLabelInspector::AddNewLabelInternal ( const mitk::LabelSetImage::GroupIndexType containingGroup)
protected

◆ CurrentSelectionChanged

void QmitkMultiLabelInspector::CurrentSelectionChanged ( LabelValueVectorType  labels) const
signal

A signal that will be emitted if the selected labels change.

Parameters
labelsA list of label values that are now selected.

◆ DeleteLabel

void QmitkMultiLabelInspector::DeleteLabel ( )
slot

Delete the first currently selected label and all its instances of the segmentation. If no label is selected nothing will happen.

Precondition
AllowLabeModification must be set to true.

◆ DeleteLabelInstance

void QmitkMultiLabelInspector::DeleteLabelInstance ( )
slot

Removes the first currently selected label instance of the segmentation. If no label is selected nothing will happen.

Precondition
AllowLabeModification must be set to true.

◆ DeleteLabelInternal()

void QmitkMultiLabelInspector::DeleteLabelInternal ( const LabelValueVectorType labelValues)
protected

◆ GetAllowLabelModification()

bool QmitkMultiLabelInspector::GetAllowLabelModification ( ) const

◆ GetAllowLockModification()

bool QmitkMultiLabelInspector::GetAllowLockModification ( ) const

◆ GetAllowVisibilityModification()

bool QmitkMultiLabelInspector::GetAllowVisibilityModification ( ) const

◆ GetCurrentLabel()

mitk::Label* QmitkMultiLabelInspector::GetCurrentLabel ( ) const

Returns the label that currently has the focus in the tree view.

The focus is indicated by QTreeView::currentIndex, thus the mouse is over it and it has a dashed border line.

The current label must not equal the selected label(s). If the mouse is not hovering above a label (label class or instance item), the method will return nullptr.

◆ GetCurrentLevelType()

IndexLevelType QmitkMultiLabelInspector::GetCurrentLevelType ( ) const

Returns the level of the index that currently has the focus in the tree view.

The focus is indicated by QTreeView::currentIndex, thus the mouse is over it and it has a dashed border line.

◆ GetCurrentlyAffactedLabelInstances()

LabelValueVectorType QmitkMultiLabelInspector::GetCurrentlyAffactedLabelInstances ( ) const

Returns all label values that are currently affected.

Affected means that these labels (including the one returned by GetCurrentLabel) are in the subtree of the tree view element that currently has the focus (indicated by QTreeView::currentIndex, thus the mouse is over it and it has a dashed border line.

◆ GetFirstSelectedLabelObject()

mitk::Label* QmitkMultiLabelInspector::GetFirstSelectedLabelObject ( ) const
protected

Helper that returns the label object (if multiple labels are selected the first).

◆ GetLabelInstancesOfSelectedFirstLabel()

LabelValueVectorType QmitkMultiLabelInspector::GetLabelInstancesOfSelectedFirstLabel ( ) const

Returns the values of all label instances that are of the same label (class) like the first selected label instance.

If no label is selected an empty vector will be returned.

◆ GetModelManipulationOngoing()

bool QmitkMultiLabelInspector::GetModelManipulationOngoing ( ) const

Indicates if the inspector is currently modifying the model/segmentation. Thus as long as the manipulation is ongoing, one should assume the model to be in an invalid state.

◆ GetMultiLabelNode

mitk::DataNode* QmitkMultiLabelInspector::GetMultiLabelNode ( ) const
slot

◆ GetMultiLabelSegmentation

mitk::LabelSetImage* QmitkMultiLabelInspector::GetMultiLabelSegmentation ( ) const
slot

◆ GetMultiSelectionMode()

bool QmitkMultiLabelInspector::GetMultiSelectionMode ( ) const

◆ GetSelectedLabels()

LabelValueVectorType QmitkMultiLabelInspector::GetSelectedLabels ( ) const

Retrieve the currently selected labels (equals the last CurrentSelectionChanged values).

◆ GetSelectedLabelsFromSelectionModel()

LabelValueVectorType QmitkMultiLabelInspector::GetSelectedLabelsFromSelectionModel ( ) const
protected

◆ GoToLabel

void QmitkMultiLabelInspector::GoToLabel ( LabelValueType  label,
const mitk::Point3D point 
) const
signal

A signal that will be emitted if the user has requested to "go to" a certain label.

Going to a label would be e.g. to focus the renderwindows on the centroid of the label.

Parameters
labelThe label that should be focused.
pointin World coordinate that should be focused.

◆ Initialize()

void QmitkMultiLabelInspector::Initialize ( )
protected

◆ keyPressEvent()

void QmitkMultiLabelInspector::keyPressEvent ( QKeyEvent *  event)
overrideprotected

◆ keyReleaseEvent()

void QmitkMultiLabelInspector::keyReleaseEvent ( QKeyEvent *  event)
overrideprotected

◆ LabelRenameRequested

void QmitkMultiLabelInspector::LabelRenameRequested ( mitk::Label label,
bool  rename,
bool &  canceled 
) const
signal

Signal that is emitted, if a label should be (re)named and default label naming is deactivated.

The instance for which a new name is requested is passed with the signal.

Parameters
labelPointer to the instance that needs a (new) name.
renameIndicates if it is a renaming or naming of a new label.
[out]canceledIndicating if the request was canceled by the used.

◆ ModelUpdated

void QmitkMultiLabelInspector::ModelUpdated ( ) const
signal

Signal that is emitted, if the model was updated (e.g. by a delete or add operation).

◆ OnDataChanged()

void QmitkMultiLabelInspector::OnDataChanged ( const QModelIndex &  topLeft,
const QModelIndex &  bottomRight,
const QList< int > &  roles = QList< int >() 
)
protected

◆ OnModelReset()

void QmitkMultiLabelInspector::OnModelReset ( )
protected

◆ RemoveGroup

void QmitkMultiLabelInspector::RemoveGroup ( )
slot

Removes the group of the first currently selected label of the segmentation. If no label is selected nothing will happen.

Precondition
AllowLabeModification must be set to true.

◆ RemoveGroupInternal()

void QmitkMultiLabelInspector::RemoveGroupInternal ( const mitk::LabelSetImage::GroupIndexType groupID)
protected

◆ SegmentationChanged

void QmitkMultiLabelInspector::SegmentationChanged ( ) const
signal

Signal is emitted, if the segmentation is changed that is observed by the inspector.

◆ SetAllowLabelModification

void QmitkMultiLabelInspector::SetAllowLabelModification ( bool  labelMod)
slot

◆ SetAllowLockModification

void QmitkMultiLabelInspector::SetAllowLockModification ( bool  lockMod)
slot

◆ SetAllowVisibilityModification

void QmitkMultiLabelInspector::SetAllowVisibilityModification ( bool  visiblityMod)
slot

◆ SetDefaultLabelNaming

void QmitkMultiLabelInspector::SetDefaultLabelNaming ( bool  defaultLabelNaming)
slot

◆ SetLockOfAffectedLabels

void QmitkMultiLabelInspector::SetLockOfAffectedLabels ( bool  visible) const
slot

◆ SetMultiLabelNode

void QmitkMultiLabelInspector::SetMultiLabelNode ( mitk::DataNode node)
slot

Sets the segmentation node that will be used /monitored by the widget.

Parameters
nodeA pointer to the segmentation node.
Remarks
If not set some features (e.g. highlighting in render windows) of the inspectors are not active.
Currently it is also needed to circumvent the fact that modification of data does not directly trigger modification of the node (see T27307).

◆ SetMultiLabelSegmentation

void QmitkMultiLabelInspector::SetMultiLabelSegmentation ( mitk::LabelSetImage segmentation)
slot

Sets the segmentation that will be used and monitored by the widget.

Parameters
segmentationA pointer to the segmentation to set.
Remarks
You cannot set the segmentation directly if a segmentation node is also set. Reset the node (nullptr) if you want to change to direct segmentation setting.
Precondition
Segmentation node is nullptr.

◆ SetMultiSelectionMode

void QmitkMultiLabelInspector::SetMultiSelectionMode ( bool  multiMode)
slot

◆ SetSelectedLabel

void QmitkMultiLabelInspector::SetSelectedLabel ( mitk::LabelSetImage::LabelValueType  selectedLabel)
slot

The passed label will be used as new selection in the widget.

Parameters
selectedLabelValue of the selected label.
Remarks
Using this method to select labels will not trigger the CurrentSelectionChanged signal. Observers should regard that to avoid signal loops.

◆ SetSelectedLabels

void QmitkMultiLabelInspector::SetSelectedLabels ( const LabelValueVectorType selectedLabels)
slot

Transform a list of label values into the new selection of the inspector.

Parameters
selectedLabelsA list of selected label values.
Remarks
Using this method to select labels will not trigger the CurrentSelectionChanged signal. Observers should regard that to avoid signal loops.

◆ SetVisibilityOfAffectedLabels

void QmitkMultiLabelInspector::SetVisibilityOfAffectedLabels ( bool  visible) const
slot

◆ UpdateSelectionModel()

void QmitkMultiLabelInspector::UpdateSelectionModel ( const LabelValueVectorType selectedLabels)
protected

Member Data Documentation

◆ m_ColorItemDelegate

QStyledItemDelegate* QmitkMultiLabelInspector::m_ColorItemDelegate
protected

Definition at line 240 of file QmitkMultiLabelInspector.h.

◆ m_Controls

Ui::QmitkMultiLabelInspector* QmitkMultiLabelInspector::m_Controls
protected

Definition at line 243 of file QmitkMultiLabelInspector.h.

◆ m_LastValidSelectedLabels

LabelValueVectorType QmitkMultiLabelInspector::m_LastValidSelectedLabels
protected

Definition at line 238 of file QmitkMultiLabelInspector.h.

◆ m_LockItemDelegate

QStyledItemDelegate* QmitkMultiLabelInspector::m_LockItemDelegate
protected

Definition at line 239 of file QmitkMultiLabelInspector.h.

◆ m_Model

QmitkMultiLabelTreeModel* QmitkMultiLabelInspector::m_Model
protected

Definition at line 235 of file QmitkMultiLabelInspector.h.

◆ m_Segmentation

mitk::LabelSetImage::Pointer QmitkMultiLabelInspector::m_Segmentation
protected

Definition at line 236 of file QmitkMultiLabelInspector.h.

◆ m_VisibilityItemDelegate

QStyledItemDelegate* QmitkMultiLabelInspector::m_VisibilityItemDelegate
protected

Definition at line 241 of file QmitkMultiLabelInspector.h.


The documentation for this class was generated from the following file: