Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
QmitkMultiLabelTreeModel Class Reference

#include <QmitkMultiLabelTreeModel.h>

Inheritance diagram for QmitkMultiLabelTreeModel:
Collaboration diagram for QmitkMultiLabelTreeModel:

Public Types

enum  TableColumns { NAME_COL, LOCKED_COL, COLOR_COL, VISIBLE_COL }
 
enum  ItemModelRole {
  LabelDataRole, LabelValueRole, LabelInstanceDataRole, LabelInstanceValueRole,
  GroupIDRole
}
 
using LabelValueType = mitk::LabelSetImage::LabelValueType
 
using GroupIndexType = mitk::LabelSetImage::GroupIndexType
 

Public Slots

void SetAllowVisibilityModification (bool vmod)
 
void SetAllowLockModification (bool lmod)
 

Signals

void dataAvailable ()
 
void modelChanged ()
 

Public Member Functions

 QmitkMultiLabelTreeModel (QObject *parent=nullptr)
 
 ~QmitkMultiLabelTreeModel () override
 
void SetSegmentation (mitk::LabelSetImage *segmentation)
 
const mitk::LabelSetImageGetSegmentation () const
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 
QVariant data (const QModelIndex &index, int role=Qt::DisplayRole) const override
 
bool setData (const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
QVariant headerData (int section, Qt::Orientation orientation, int role) const override
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 
int columnCount (const QModelIndex &parent=QModelIndex()) const override
 
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
 
QModelIndex indexOfGroup (mitk::LabelSetImage::GroupIndexType groupIndex) const
 
QModelIndex ClosestLabelInstanceIndex (const QModelIndex &currentIndex) const
 
QModelIndex FirstLabelInstanceIndex (const QModelIndex &currentIndex) const
 
std::vector< LabelValueTypeGetLabelsInSubTree (const QModelIndex &currentIndex) const
 ‍** Returns the index to the next node in the tree that behaves like an instance (label node with only one instance More...
 
std::vector< LabelValueTypeGetLabelInstancesOfSameLabelClass (const QModelIndex &currentIndex) const
 
bool GetAllowVisibilityModification () const
 
bool GetAllowLockModification () const
 

Protected Member Functions

void ITKEventHandler (const itk::EventObject &e)
 
void OnLabelAdded (LabelValueType labelValue)
 
void OnLabelModified (LabelValueType labelValue)
 
void OnLabelRemoved (LabelValueType labelValue)
 
void OnGroupAdded (GroupIndexType groupIndex)
 
void OnGroupModified (GroupIndexType groupIndex)
 
void OnGroupRemoved (GroupIndexType groupIndex)
 

Detailed Description

The class is used to represent the information of an MITK MultiLabel segmentation instance (labels, spatial groups...).

Definition at line 32 of file QmitkMultiLabelTreeModel.h.

Member Typedef Documentation

◆ GroupIndexType

◆ LabelValueType

Member Enumeration Documentation

◆ ItemModelRole

Enumerator
LabelDataRole 

This role returns the label object that is associated with an index.

  • On group level it always returns an invalid QVariant
  • On label level (with multiple instances) it returns the first label instance).
  • On instance level it returns the label instance object.
LabelValueRole 

This role returns only the label value of the label that would be returned by LabelDataRole.

LabelInstanceDataRole 

Simelar to LabelDataRole, but only returns a valid QVariant if index points only to a specific instance (so either instance level or label level with only one instance). You can use that role if you want to assure that only one specific label instance is referenced by the index.

LabelInstanceValueRole 

Simelar to LabelValueRole, but like LabelInstanceDataRole only returns a valid QVariant if index points only to a specific instance (so either instance level or label level with only one instance). You can use that role if you want to assure that only one specific label instance is referenced by the index.

GroupIDRole 

This role returns the group ID the item/index belongs to.

Definition at line 92 of file QmitkMultiLabelTreeModel.h.

◆ TableColumns

Enumerator
NAME_COL 
LOCKED_COL 
COLOR_COL 
VISIBLE_COL 

Definition at line 84 of file QmitkMultiLabelTreeModel.h.

Constructor & Destructor Documentation

◆ QmitkMultiLabelTreeModel()

QmitkMultiLabelTreeModel::QmitkMultiLabelTreeModel ( QObject *  parent = nullptr)

◆ ~QmitkMultiLabelTreeModel()

QmitkMultiLabelTreeModel::~QmitkMultiLabelTreeModel ( )
override

Member Function Documentation

◆ ClosestLabelInstanceIndex()

QModelIndex QmitkMultiLabelTreeModel::ClosestLabelInstanceIndex ( const QModelIndex &  currentIndex) const

Returns the index to the next node in the tree that behaves like an instance (label node with only one instance or instance node). If current index is at the end, an invalid index is returned.

◆ columnCount()

int QmitkMultiLabelTreeModel::columnCount ( const QModelIndex &  parent = QModelIndex()) const
override

◆ data()

QVariant QmitkMultiLabelTreeModel::data ( const QModelIndex &  index,
int  role = Qt::DisplayRole 
) const
override

◆ dataAvailable

void QmitkMultiLabelTreeModel::dataAvailable ( )
signal

◆ FirstLabelInstanceIndex()

QModelIndex QmitkMultiLabelTreeModel::FirstLabelInstanceIndex ( const QModelIndex &  currentIndex) const

Returns the index to the first child node (or itself) in the tree that behaves like an instance (label node with only one instance or instance node). If current index is at the end, an invalid index is returned. If an invalid index is passed into the methods, the search starts at the root; thus the whole tree is search for the first label instance.

◆ flags()

Qt::ItemFlags QmitkMultiLabelTreeModel::flags ( const QModelIndex &  index) const
override

◆ GetAllowLockModification()

bool QmitkMultiLabelTreeModel::GetAllowLockModification ( ) const

◆ GetAllowVisibilityModification()

bool QmitkMultiLabelTreeModel::GetAllowVisibilityModification ( ) const

◆ GetLabelInstancesOfSameLabelClass()

std::vector<LabelValueType> QmitkMultiLabelTreeModel::GetLabelInstancesOfSameLabelClass ( const QModelIndex &  currentIndex) const

Returns a vector containing all label values of all label instances that belong to the same label class like the passed index.

If index points to a group or invalid, nothing will be returned.

Precondition
currentIndex must be valid and point to a label (class or instance).

◆ GetLabelsInSubTree()

std::vector<LabelValueType> QmitkMultiLabelTreeModel::GetLabelsInSubTree ( const QModelIndex &  currentIndex) const

‍** Returns the index to the next node in the tree that behaves like an instance (label node with only one instance

Returns a vector containing all label values of the passed currentIndex or its child items.

◆ GetSegmentation()

const mitk::LabelSetImage* QmitkMultiLabelTreeModel::GetSegmentation ( ) const

◆ headerData()

QVariant QmitkMultiLabelTreeModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role 
) const
override

◆ index()

QModelIndex QmitkMultiLabelTreeModel::index ( int  row,
int  column,
const QModelIndex &  parent = QModelIndex() 
) const
override

◆ indexOfGroup()

QModelIndex QmitkMultiLabelTreeModel::indexOfGroup ( mitk::LabelSetImage::GroupIndexType  groupIndex) const

◆ indexOfLabel()

QModelIndex QmitkMultiLabelTreeModel::indexOfLabel ( mitk::Label::PixelType  labelValue) const

returns the index of a passed label value (always first column). If label value does not exist in segmentation or segmentation is not set an invalid index will be returned.

◆ ITKEventHandler()

void QmitkMultiLabelTreeModel::ITKEventHandler ( const itk::EventObject &  e)
protected

◆ modelChanged

void QmitkMultiLabelTreeModel::modelChanged ( )
signal

Is emitted whenever the model changes are finished (usually a bit later than dataAvailable()).

◆ OnGroupAdded()

void QmitkMultiLabelTreeModel::OnGroupAdded ( GroupIndexType  groupIndex)
protected

◆ OnGroupModified()

void QmitkMultiLabelTreeModel::OnGroupModified ( GroupIndexType  groupIndex)
protected

◆ OnGroupRemoved()

void QmitkMultiLabelTreeModel::OnGroupRemoved ( GroupIndexType  groupIndex)
protected

◆ OnLabelAdded()

void QmitkMultiLabelTreeModel::OnLabelAdded ( LabelValueType  labelValue)
protected

◆ OnLabelModified()

void QmitkMultiLabelTreeModel::OnLabelModified ( LabelValueType  labelValue)
protected

◆ OnLabelRemoved()

void QmitkMultiLabelTreeModel::OnLabelRemoved ( LabelValueType  labelValue)
protected

◆ parent()

QModelIndex QmitkMultiLabelTreeModel::parent ( const QModelIndex &  child) const
override

◆ rowCount()

int QmitkMultiLabelTreeModel::rowCount ( const QModelIndex &  parent = QModelIndex()) const
override

◆ SetAllowLockModification

void QmitkMultiLabelTreeModel::SetAllowLockModification ( bool  lmod)
slot

◆ SetAllowVisibilityModification

void QmitkMultiLabelTreeModel::SetAllowVisibilityModification ( bool  vmod)
slot

◆ setData()

bool QmitkMultiLabelTreeModel::setData ( const QModelIndex &  index,
const QVariant &  value,
int  role = Qt::EditRole 
)
override

◆ SetSegmentation()

void QmitkMultiLabelTreeModel::SetSegmentation ( mitk::LabelSetImage segmentation)

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