Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
QmitkNodeSelectionDialog.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef QmitkNodeSelectionDialog_h
14 #define QmitkNodeSelectionDialog_h
15 
16 #include <MitkQtWidgetsExports.h>
17 
18 #include <mitkDataStorage.h>
19 #include <mitkWeakPointer.h>
20 #include <mitkNodePredicateBase.h>
22 
24 
25 #include <QDialog>
26 #include <QPushButton>
27 #include <memory>
28 
29 namespace Ui { class QmitkNodeSelectionDialog; }
30 
37 {
38  Q_OBJECT
39 
40 public:
41  explicit QmitkNodeSelectionDialog(QWidget* parent = nullptr, QString caption = "", QString hint = "");
43 
51  void SetDataStorage(mitk::DataStorage* dataStorage);
52 
60  virtual void SetNodePredicate(const mitk::NodePredicateBase* nodePredicate);
61 
63 
64  using NodeList = QList<mitk::DataNode::Pointer>;
66 
72  using SelectionCheckFunctionType = std::function<std::string(const NodeList &)>;
79 
81 
82  using SelectionMode = QAbstractItemView::SelectionMode;
92 
93 Q_SIGNALS:
100 
101  public Q_SLOTS:
109  void SetSelectOnlyVisibleNodes(bool selectOnlyVisibleNodes);
117  void SetCurrentSelection(NodeList selectedNodes);
118 
119 protected Q_SLOTS:
120 
121  void OnSelectionChanged(NodeList selectedNodes);
123  void OnOK();
124  void OnCancel();
125  void OnDoubleClicked(const QModelIndex& index);
126 
127 protected:
128  void SetErrorText(const std::string& checkResponse);
129 
130  void AddPanel(const mitk::IDataStorageInspectorProvider* provider, const mitk::IDataStorageInspectorProvider::InspectorIDType &preferredID, bool &preferredFound, int &preferredIndex);
131 
133  mitk::NodePredicateBase::ConstPointer m_NodePredicate;
136 
138 
140 
141  using PanelVectorType = std::vector<QmitkAbstractDataStorageInspector*>;
143 
144  QPushButton* m_FavoriteNodesButton;
145  std::unique_ptr<Ui::QmitkNodeSelectionDialog> m_Controls;
146 };
147 
148 #endif
#define MITKQTWIDGETS_EXPORT
A customized QDialog that displays different data storage inspectors and allows to set and get a curr...
void SetCurrentSelection(NodeList selectedNodes)
Set the currently selected nodes given a list of data nodes. The function iterates over the dialog's ...
bool GetSelectOnlyVisibleNodes() const
void SetErrorText(const std::string &checkResponse)
NodeList GetSelectedNodes() const
void SetDataStorage(mitk::DataStorage *dataStorage)
Set the data storage that will be used. The function iterates over the dialog's panels and sets the d...
QList< mitk::DataNode::Pointer > NodeList
void SetSelectionMode(SelectionMode mode)
Set the Qt selection mode (e.g. Single selection, multi selection). The function iterates over the di...
QAbstractItemView::SelectionMode SelectionMode
void OnDoubleClicked(const QModelIndex &index)
SelectionCheckFunctionType m_CheckFunction
std::function< std::string(const NodeList &)> SelectionCheckFunctionType
Helper function that is used to check the given selection for consistency. Returning an empty string ...
void OnSelectionChanged(NodeList selectedNodes)
void AddPanel(const mitk::IDataStorageInspectorProvider *provider, const mitk::IDataStorageInspectorProvider::InspectorIDType &preferredID, bool &preferredFound, int &preferredIndex)
const mitk::NodePredicateBase * GetNodePredicate() const
std::unique_ptr< Ui::QmitkNodeSelectionDialog > m_Controls
QmitkNodeSelectionDialog(QWidget *parent=nullptr, QString caption="", QString hint="")
mitk::NodePredicateBase::ConstPointer m_NodePredicate
std::vector< QmitkAbstractDataStorageInspector * > PanelVectorType
void SetSelectionCheckFunction(const SelectionCheckFunctionType &checkFunction)
A selection check function can be set. If set the dialog uses this function to check the made/set sel...
~QmitkNodeSelectionDialog() override
SelectionMode GetSelectionMode() const
void SetSelectOnlyVisibleNodes(bool selectOnlyVisibleNodes)
Set the selection modus to (not) include invisible nodes in the selection. The function iterates over...
mitk::WeakPointer< mitk::DataStorage > m_DataStorage
virtual void SetNodePredicate(const mitk::NodePredicateBase *nodePredicate)
Set the node predicate that will be used. The function iterates over the dialog's panels and sets the...
void CurrentSelectionChanged(NodeList nodes)
A signal that will be emitted if the selected node has changed.
Abstract data management class that organizes DataNode objects in a directed acyclic graph.
Abstract base class for predicates used to filter DataNode objects in DataStorage queries.
The common interface for all DataStorage inspector providers.