Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkAbstractDataStorageInspector Class Referenceabstract

Abstract base class for widgets that inspect the contents of a DataStorage. More...

#include <QmitkAbstractDataStorageInspector.h>

Inheritance diagram for QmitkAbstractDataStorageInspector:
Collaboration diagram for QmitkAbstractDataStorageInspector:

Public Types

using NodeList = QList< mitk::DataNode::Pointer >
 Convenience type alias for a list of data node pointers. More...
 
using SelectionMode = QAbstractItemView::SelectionMode
 Convenience type alias for the Qt selection mode. More...
 

Public Slots

void SetSelectOnlyVisibleNodes (bool selectOnlyVisibleNodes)
 Controls whether selections are restricted to visible nodes only. More...
 
void SetCurrentSelection (NodeList selectedNodes)
 Sets the given list of data nodes as the new selection. More...
 

Signals

void CurrentSelectionChanged (NodeList nodes)
 Emitted when the set of selected nodes has changed. More...
 

Public Member Functions

 ~QmitkAbstractDataStorageInspector () override
 
void SetDataStorage (mitk::DataStorage *dataStorage)
 Sets the data storage that will be used and monitored by this widget. More...
 
virtual void SetNodePredicate (const mitk::NodePredicateBase *nodePredicate)
 Sets the node predicate and re-initializes the widget accordingly. More...
 
const mitk::NodePredicateBase * GetNodePredicate () const
 Returns the currently set node predicate. More...
 
NodeList GetSelectedNodes () const
 Returns the list of currently selected data nodes. More...
 
virtual QAbstractItemView * GetView ()=0
 Returns a pointer to the view used to display the data storage content. More...
 
virtual const QAbstractItemView * GetView () const =0
 Returns a pointer to the view used to display the data storage content. More...
 
bool GetSelectOnlyVisibleNodes () const
 Returns whether only visible nodes can be selected. More...
 
virtual void SetSelectionMode (SelectionMode mode)=0
 Sets the selection mode of the inspector's item view. More...
 
virtual SelectionMode GetSelectionMode () const =0
 Returns the current selection mode of the inspector's item view. More...
 

Protected Slots

void OnSelectionChanged (NodeList selectedNodes)
 

Protected Member Functions

virtual void Initialize ()=0
 
 QmitkAbstractDataStorageInspector (QWidget *parent=nullptr)
 

Protected Attributes

mitk::WeakPointer< mitk::DataStorage > m_DataStorage
 
mitk::NodePredicateBase::ConstPointer m_NodePredicate
 
std::unique_ptr< QmitkModelViewSelectionConnector > m_Connector
 

Detailed Description

Abstract base class for widgets that inspect the contents of a DataStorage.

This class provides a convenient foundation for implementing widgets that present a specific view onto a given mitk::DataStorage instance and allow the user to inspect and select data nodes. Subclasses must implement Initialize(), GetView(), SetSelectionMode(), and GetSelectionMode().

The inspector uses a QmitkModelViewSelectionConnector internally to manage the translation between data node selections and Qt model/view selections.

See also
QmitkModelViewSelectionConnector
QmitkDataStorageListInspector
QmitkDataStorageTreeInspector
mitkIDataStorageInspectorProvider

Definition at line 43 of file QmitkAbstractDataStorageInspector.h.

Member Typedef Documentation

◆ NodeList

using QmitkAbstractDataStorageInspector::NodeList = QList<mitk::DataNode::Pointer>

Convenience type alias for a list of data node pointers.

Definition at line 78 of file QmitkAbstractDataStorageInspector.h.

◆ SelectionMode

using QmitkAbstractDataStorageInspector::SelectionMode = QAbstractItemView::SelectionMode

Convenience type alias for the Qt selection mode.

Definition at line 107 of file QmitkAbstractDataStorageInspector.h.

Constructor & Destructor Documentation

◆ ~QmitkAbstractDataStorageInspector()

QmitkAbstractDataStorageInspector::~QmitkAbstractDataStorageInspector ( )
override

◆ QmitkAbstractDataStorageInspector()

QmitkAbstractDataStorageInspector::QmitkAbstractDataStorageInspector ( QWidget *  parent = nullptr)
protected

Member Function Documentation

◆ CurrentSelectionChanged

void QmitkAbstractDataStorageInspector::CurrentSelectionChanged ( NodeList  nodes)
signal

Emitted when the set of selected nodes has changed.

Parameters
[in]nodesThe newly selected data nodes.

◆ GetNodePredicate()

const mitk::NodePredicateBase* QmitkAbstractDataStorageInspector::GetNodePredicate ( ) const

Returns the currently set node predicate.

Returns
Pointer to the current node predicate, or nullptr if none is set.

◆ GetSelectedNodes()

NodeList QmitkAbstractDataStorageInspector::GetSelectedNodes ( ) const

Returns the list of currently selected data nodes.

Returns
A NodeList containing the currently selected nodes.

◆ GetSelectionMode()

virtual SelectionMode QmitkAbstractDataStorageInspector::GetSelectionMode ( ) const
pure virtual

Returns the current selection mode of the inspector's item view.

Returns
The active QAbstractItemView::SelectionMode.

Implemented in QmitkRenderWindowDataStorageInspector, QmitkRenderWindowContextDataStorageInspector, QmitkDataStorageTreeInspector, QmitkDataStorageSelectionHistoryInspector, and QmitkDataStorageListInspector.

◆ GetSelectOnlyVisibleNodes()

bool QmitkAbstractDataStorageInspector::GetSelectOnlyVisibleNodes ( ) const

Returns whether only visible nodes can be selected.

This reflects the setting of the internal QmitkModelViewSelectionConnector. The value can be changed via SetSelectOnlyVisibleNodes().

Returns
True if only visible nodes are selectable, false otherwise.
See also
SetSelectOnlyVisibleNodes

◆ GetView() [1/2]

virtual const QAbstractItemView* QmitkAbstractDataStorageInspector::GetView ( ) const
pure virtual

Returns a pointer to the view used to display the data storage content.

Returns
Pointer to the internal QAbstractItemView.

Implemented in QmitkRenderWindowDataStorageInspector, QmitkRenderWindowContextDataStorageInspector, QmitkDataStorageTreeInspector, QmitkDataStorageSelectionHistoryInspector, and QmitkDataStorageListInspector.

◆ GetView() [2/2]

virtual QAbstractItemView* QmitkAbstractDataStorageInspector::GetView ( )
pure virtual

Returns a pointer to the view used to display the data storage content.

Returns
Pointer to the internal QAbstractItemView.

Implemented in QmitkRenderWindowDataStorageInspector, QmitkRenderWindowContextDataStorageInspector, QmitkDataStorageTreeInspector, QmitkDataStorageSelectionHistoryInspector, and QmitkDataStorageListInspector.

◆ Initialize()

virtual void QmitkAbstractDataStorageInspector::Initialize ( )
protectedpure virtual

Helper function is called if data storage or predicate is changed to (re) initialize the widget correctly. Implement the function in derived classes.

Implemented in QmitkDataStorageTreeInspector, QmitkDataStorageSelectionHistoryInspector, and QmitkDataStorageListInspector.

◆ OnSelectionChanged

void QmitkAbstractDataStorageInspector::OnSelectionChanged ( NodeList  selectedNodes)
protectedslot

◆ SetCurrentSelection

void QmitkAbstractDataStorageInspector::SetCurrentSelection ( NodeList  selectedNodes)
slot

Sets the given list of data nodes as the new selection.

Transforms the list of data nodes into a model selection and applies it to the internal item view's selection model. The list is filtered according to the current selectOnlyVisibleNodes setting. When that setting is false, non-visible nodes are stored internally and merged into any outgoing selection signal.

Parameters
[in]selectedNodesThe data nodes to select.
See also
SetSelectOnlyVisibleNodes

◆ SetDataStorage()

void QmitkAbstractDataStorageInspector::SetDataStorage ( mitk::DataStorage *  dataStorage)

Sets the data storage that will be used and monitored by this widget.

If the new data storage differs from the current one and is not null, the widget is re-initialized via Initialize().

Parameters
[in]dataStoragePointer to the data storage to set. May be nullptr.

◆ SetNodePredicate()

virtual void QmitkAbstractDataStorageInspector::SetNodePredicate ( const mitk::NodePredicateBase *  nodePredicate)
virtual

Sets the node predicate and re-initializes the widget accordingly.

The predicate is used to filter the nodes shown in the inspector view. If the predicate changes, the widget is re-initialized via Initialize().

Parameters
[in]nodePredicatePointer to the node predicate. May be nullptr to show all nodes.

Reimplemented in QmitkDataStorageFavoriteNodesInspector.

◆ SetSelectionMode()

virtual void QmitkAbstractDataStorageInspector::SetSelectionMode ( SelectionMode  mode)
pure virtual

Sets the selection mode of the inspector's item view.

Parameters
[in]modeThe desired QAbstractItemView::SelectionMode.

Implemented in QmitkRenderWindowDataStorageInspector, QmitkRenderWindowContextDataStorageInspector, QmitkDataStorageTreeInspector, QmitkDataStorageSelectionHistoryInspector, and QmitkDataStorageListInspector.

◆ SetSelectOnlyVisibleNodes

void QmitkAbstractDataStorageInspector::SetSelectOnlyVisibleNodes ( bool  selectOnlyVisibleNodes)
slot

Controls whether selections are restricted to visible nodes only.

If selectOnlyVisibleNodes is true, an incoming selection will be filtered (reduced) to only those nodes that are currently visible in the view. An outgoing selection can then at most contain these visible nodes.

If false, non-visible nodes from an incoming selection are stored internally and included in outgoing selections, preserving the original selection even though those nodes cannot be interactively (de-)selected in the view.

Parameters
[in]selectOnlyVisibleNodesIf true, only visible nodes may be selected.
See also
GetSelectOnlyVisibleNodes

Member Data Documentation

◆ m_Connector

std::unique_ptr<QmitkModelViewSelectionConnector> QmitkAbstractDataStorageInspector::m_Connector
protected

Definition at line 170 of file QmitkAbstractDataStorageInspector.h.

◆ m_DataStorage

mitk::WeakPointer<mitk::DataStorage> QmitkAbstractDataStorageInspector::m_DataStorage
protected

Definition at line 167 of file QmitkAbstractDataStorageInspector.h.

◆ m_NodePredicate

mitk::NodePredicateBase::ConstPointer QmitkAbstractDataStorageInspector::m_NodePredicate
protected

Definition at line 168 of file QmitkAbstractDataStorageInspector.h.


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