Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkPointListModel Class Reference

Qt list model providing access to points in a mitk::PointSet. More...

#include <QmitkPointListModel.h>

Inheritance diagram for QmitkPointListModel:
Collaboration diagram for QmitkPointListModel:

Public Slots

void MoveSelectedPointUp ()
 
void MoveSelectedPointDown ()
 
void RemoveSelectedPoint ()
 

Signals

void SignalUpdateSelection ()
 

Public Member Functions

 QmitkPointListModel (mitk::DataNode *pointSetNode=nullptr, int t=0, QObject *parent=nullptr)
 Construct the model. More...
 
 ~QmitkPointListModel () override
 Destructor. Removes observers from the point set. More...
 
Qt::ItemFlags flags (const QModelIndex &index) const override
 Return item flags (selectable and enabled). More...
 
int rowCount (const QModelIndex &parent=QModelIndex()) const override
 Return the number of points in the current time step. More...
 
QVariant data (const QModelIndex &index, int role) const override
 Return the display data for a point (ID and coordinates). More...
 
QVariant headerData (int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 Return header data. More...
 
void SetPointSetNode (mitk::DataNode *pointSetNode)
 Set the data node containing the point set to model. More...
 
mitk::PointSet * GetPointSet () const
 Get the modeled point set. More...
 
mitk::DataNode * GetPointSetNode () const
 Get the data node containing the point set. More...
 
void SetTimeStep (int t)
 Set the time step to display. More...
 
int GetTimeStep () const
 Get the current time step. More...
 
void OnPointSetChanged (const itk::EventObject &e)
 ITK observer callback for point set modification events. More...
 
void OnPointSetDeleted (const itk::EventObject &e)
 ITK observer callback for point set deletion events. More...
 
bool GetPointForModelIndex (const QModelIndex &index, mitk::PointSet::PointType &p, mitk::PointSet::PointIdentifier &id) const
 get point and point ID that correspond to a given QModelIndex More...
 
bool GetModelIndexForPointID (mitk::PointSet::PointIdentifier id, QModelIndex &index) const
 returns a QModelIndex for a given point ID More...
 

Protected Member Functions

void ObserveNewPointSet (mitk::DataNode *pointSetNode)
 internally observe different point set More...
 
mitk::PointSet * CheckForPointSetInNode (mitk::DataNode *node) const
 

Protected Attributes

mitk::DataNode * m_PointSetNode
 
unsigned int m_PointSetModifiedObserverTag
 
unsigned int m_PointSetDeletedObserverTag
 
int m_TimeStep
 

Detailed Description

Qt list model providing access to points in a mitk::PointSet.

Wraps a mitk::PointSet (referenced via a mitk::DataNode) as a QAbstractListModel. Each row represents a point with its ID and coordinates. Observes the point set for modifications and deletions, resetting the model accordingly. Provides methods to move and remove the currently selected point.

Note
The mitk::PointSet uses a map container where point IDs are not necessarily contiguous. This model translates between row indices and point IDs.
See also
QmitkPointListView, QmitkPointListWidget

Definition at line 37 of file QmitkPointListModel.h.

Constructor & Destructor Documentation

◆ QmitkPointListModel()

QmitkPointListModel::QmitkPointListModel ( mitk::DataNode *  pointSetNode = nullptr,
int  t = 0,
QObject *  parent = nullptr 
)

Construct the model.

Parameters
[in]pointSetNodeData node containing the mitk::PointSet. May be nullptr.
[in]tThe time step to use.
[in]parentThe parent QObject.

◆ ~QmitkPointListModel()

QmitkPointListModel::~QmitkPointListModel ( )
override

Destructor. Removes observers from the point set.

Member Function Documentation

◆ CheckForPointSetInNode()

mitk::PointSet* QmitkPointListModel::CheckForPointSetInNode ( mitk::DataNode *  node) const
protected

◆ data()

QVariant QmitkPointListModel::data ( const QModelIndex &  index,
int  role 
) const
override

Return the display data for a point (ID and coordinates).

Parameters
[in]indexThe model index.
[in]roleThe data role (only Qt::DisplayRole is supported).
Returns
The point string in format "ID: (x, y, z)".

◆ flags()

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

Return item flags (selectable and enabled).

Parameters
[in]indexThe model index (unused).
Returns
Qt::ItemIsSelectable | Qt::ItemIsEnabled.

◆ GetModelIndexForPointID()

bool QmitkPointListModel::GetModelIndexForPointID ( mitk::PointSet::PointIdentifier  id,
QModelIndex &  index 
) const

returns a QModelIndex for a given point ID

Documentation

The mitk::PointSet uses a map to store points in an ID<-->Point relation. The IDs are not necessarily continuously numbered, therefore, we can not directly use the point ID as a QModelIndex. This method returns a QModelIndex for a given point ID in the outgoing parameter index.

Parameters
[in]idThe point ID for which the QModelIndex will be created
[out]indexif a point with the ID id was found, index will contain a corresponding QModelIndex for that point
Returns
returns true, if a valid QModelIndex was created, false otherwise

◆ GetPointForModelIndex()

bool QmitkPointListModel::GetPointForModelIndex ( const QModelIndex &  index,
mitk::PointSet::PointType &  p,
mitk::PointSet::PointIdentifier &  id 
) const

get point and point ID that correspond to a given QModelIndex

The mitk::PointSet uses a map to store points in an ID<-->Point relation. The IDs are not necessarily continuously numbered, therefore, we can not directly use the QModelIndex as point ID. This method returns the point and the corresponding point id for a given QModelIndex. The point and the point ID are returned in the outgoing parameters p and id. If a valid point and ID were found, the method returns true, otherwise it returns false

Parameters
[in]indexthe index for which a point is requested. The row() part of the index is used to find a corresponding point
[out]pIf a valid point is found, it will be stored in the p parameter
[out]idIf a valid point is found, the corresponding ID will be stored in id
Returns
Returns true, if a valid point was found, false otherwise

◆ GetPointSet()

mitk::PointSet* QmitkPointListModel::GetPointSet ( ) const

Get the modeled point set.

Returns
Pointer to the mitk::PointSet, or nullptr.

◆ GetPointSetNode()

mitk::DataNode* QmitkPointListModel::GetPointSetNode ( ) const

Get the data node containing the point set.

Returns
Pointer to the mitk::DataNode, or nullptr.

◆ GetTimeStep()

int QmitkPointListModel::GetTimeStep ( ) const

Get the current time step.

Returns
The time step index.

◆ headerData()

QVariant QmitkPointListModel::headerData ( int  section,
Qt::Orientation  orientation,
int  role = Qt::DisplayRole 
) const
override

Return header data.

Parameters
[in]sectionThe section index.
[in]orientationThe header orientation.
[in]roleThe data role.
Returns
The header label.

◆ MoveSelectedPointDown

void QmitkPointListModel::MoveSelectedPointDown ( )
slot

◆ MoveSelectedPointUp

void QmitkPointListModel::MoveSelectedPointUp ( )
slot

◆ ObserveNewPointSet()

void QmitkPointListModel::ObserveNewPointSet ( mitk::DataNode *  pointSetNode)
protected

internally observe different point set

◆ OnPointSetChanged()

void QmitkPointListModel::OnPointSetChanged ( const itk::EventObject &  e)

ITK observer callback for point set modification events.

Parameters
[in]eThe ITK event object.

◆ OnPointSetDeleted()

void QmitkPointListModel::OnPointSetDeleted ( const itk::EventObject &  e)

ITK observer callback for point set deletion events.

Parameters
[in]eThe ITK event object.

◆ RemoveSelectedPoint

void QmitkPointListModel::RemoveSelectedPoint ( )
slot

◆ rowCount()

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

Return the number of points in the current time step.

Parameters
[in]parentThe parent index (unused for list models).
Returns
The number of points.

◆ SetPointSetNode()

void QmitkPointListModel::SetPointSetNode ( mitk::DataNode *  pointSetNode)

Set the data node containing the point set to model.

Parameters
[in]pointSetNodeThe data node. May be nullptr to clear.

◆ SetTimeStep()

void QmitkPointListModel::SetTimeStep ( int  t)

Set the time step to display.

Parameters
[in]tThe time step index.

◆ SignalUpdateSelection

void QmitkPointListModel::SignalUpdateSelection ( )
signal

emitted, when views should update their selection status (because mouse interactions in render windows can change the selection status of points)

Member Data Documentation

◆ m_PointSetDeletedObserverTag

unsigned int QmitkPointListModel::m_PointSetDeletedObserverTag
protected

Definition at line 185 of file QmitkPointListModel.h.

◆ m_PointSetModifiedObserverTag

unsigned int QmitkPointListModel::m_PointSetModifiedObserverTag
protected

Definition at line 184 of file QmitkPointListModel.h.

◆ m_PointSetNode

mitk::DataNode* QmitkPointListModel::m_PointSetNode
protected

Definition at line 183 of file QmitkPointListModel.h.

◆ m_TimeStep

int QmitkPointListModel::m_TimeStep
protected

Definition at line 186 of file QmitkPointListModel.h.


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