Medical Imaging Interaction Toolkit  2025.12.02
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 <ui_QmitkNodeSelectionDialog.h>
19 
20 #include <mitkDataStorage.h>
21 #include <mitkWeakPointer.h>
22 #include <mitkNodePredicateBase.h>
24 
26 
27 #include <QDialog>
28 #include <QPushButton>
29 
36 {
37  Q_OBJECT
38 
39 public:
40  explicit QmitkNodeSelectionDialog(QWidget* parent = nullptr, QString caption = "", QString hint = "");
41 
49  void SetDataStorage(mitk::DataStorage* dataStorage);
50 
58  virtual void SetNodePredicate(const mitk::NodePredicateBase* nodePredicate);
59 
61 
62  using NodeList = QList<mitk::DataNode::Pointer>;
64 
70  using SelectionCheckFunctionType = std::function<std::string(const NodeList &)>;
77 
79 
80  using SelectionMode = QAbstractItemView::SelectionMode;
90 
91 Q_SIGNALS:
98 
99  public Q_SLOTS:
107  void SetSelectOnlyVisibleNodes(bool selectOnlyVisibleNodes);
115  void SetCurrentSelection(NodeList selectedNodes);
116 
117 protected Q_SLOTS:
118 
119  void OnSelectionChanged(NodeList selectedNodes);
121  void OnOK();
122  void OnCancel();
123  void OnDoubleClicked(const QModelIndex& index);
124 
125 protected:
126  void SetErrorText(const std::string& checkResponse);
127 
128  void AddPanel(const mitk::IDataStorageInspectorProvider* provider, const mitk::IDataStorageInspectorProvider::InspectorIDType &preferredID, bool &preferredFound, int &preferredIndex);
129 
131  mitk::NodePredicateBase::ConstPointer m_NodePredicate;
134 
136 
138 
139  using PanelVectorType = std::vector<QmitkAbstractDataStorageInspector*>;
141 
142  QPushButton* m_FavoriteNodesButton;
143  Ui_QmitkNodeSelectionDialog m_Controls;
144 };
145 
146 #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 ...
Ui_QmitkNodeSelectionDialog m_Controls
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
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...
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.
Data management class that handles 'was created by' relations.
Interface for evaluation conditions used in the DataStorage class GetSubset() method.
The common interface for all DataStorage inspector providers.