Medical Imaging Interaction Toolkit  2024.06.99-60d9b802
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 
60  const mitk::NodePredicateBase* GetNodePredicate() const;
61 
62  using NodeList = QList<mitk::DataNode::Pointer>;
63  NodeList GetSelectedNodes() const;
64 
70  using SelectionCheckFunctionType = std::function<std::string(const NodeList &)>;
76  void SetSelectionCheckFunction(const SelectionCheckFunctionType &checkFunction);
77 
78  bool GetSelectOnlyVisibleNodes() const;
79 
80  using SelectionMode = QAbstractItemView::SelectionMode;
88  void SetSelectionMode(SelectionMode mode);
89  SelectionMode GetSelectionMode() const;
90 
91 Q_SIGNALS:
97  void CurrentSelectionChanged(NodeList nodes);
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);
120  void OnFavoriteNodesButtonClicked();
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 
134 
136 
138 
139  using PanelVectorType = std::vector<QmitkAbstractDataStorageInspector*>;
141 
142  QPushButton* m_FavoriteNodesButton;
143  Ui_QmitkNodeSelectionDialog m_Controls;
144 };
145 
146 #endif
MITKQTWIDGETS_EXPORT
#define MITKQTWIDGETS_EXPORT
Definition: MitkQtWidgetsExports.h:15
mitkDataStorage.h
QmitkNodeSelectionDialog::SelectionMode
QAbstractItemView::SelectionMode SelectionMode
Definition: QmitkNodeSelectionDialog.h:80
QmitkNodeSelectionDialog::m_SelectOnlyVisibleNodes
bool m_SelectOnlyVisibleNodes
Definition: QmitkNodeSelectionDialog.h:132
QmitkNodeSelectionDialog::m_SelectedNodes
NodeList m_SelectedNodes
Definition: QmitkNodeSelectionDialog.h:133
QmitkNodeSelectionDialog::m_SelectionMode
SelectionMode m_SelectionMode
Definition: QmitkNodeSelectionDialog.h:137
QmitkNodeSelectionDialog::NodeList
QList< mitk::DataNode::Pointer > NodeList
Definition: QmitkNodeSelectionDialog.h:62
itk::SmartPointer< const Self >
mitk::NodePredicateBase
Interface for evaluation conditions used in the DataStorage class GetSubset() method.
Definition: mitkNodePredicateBase.h:35
mitkNodePredicateBase.h
mitkIDataStorageInspectorProvider.h
QmitkNodeSelectionDialog::m_CheckFunction
SelectionCheckFunctionType m_CheckFunction
Definition: QmitkNodeSelectionDialog.h:135
QmitkNodeSelectionDialog::m_FavoriteNodesButton
QPushButton * m_FavoriteNodesButton
Definition: QmitkNodeSelectionDialog.h:142
QmitkNodeSelectionDialog::PanelVectorType
std::vector< QmitkAbstractDataStorageInspector * > PanelVectorType
Definition: QmitkNodeSelectionDialog.h:139
MitkQtWidgetsExports.h
QmitkNodeSelectionDialog::m_Controls
Ui_QmitkNodeSelectionDialog m_Controls
Definition: QmitkNodeSelectionDialog.h:143
QmitkNodeSelectionDialog
A customized QDialog that displays different data storage inspectors and allows to set and get a curr...
Definition: QmitkNodeSelectionDialog.h:35
QmitkNodeSelectionDialog::m_NodePredicate
mitk::NodePredicateBase::ConstPointer m_NodePredicate
Definition: QmitkNodeSelectionDialog.h:131
mitk::DataStorage
Data management class that handles 'was created by' relations.
Definition: mitkDataStorage.h:43
QmitkNodeSelectionDialog::m_DataStorage
mitk::WeakPointer< mitk::DataStorage > m_DataStorage
Definition: QmitkNodeSelectionDialog.h:130
mitkWeakPointer.h
QmitkAbstractDataStorageInspector.h
mitk::IDataStorageInspectorProvider::InspectorIDType
std::string InspectorIDType
Definition: mitkIDataStorageInspectorProvider.h:48
mitk::IDataStorageInspectorProvider
The common interface for all DataStorage inspector providers.
Definition: mitkIDataStorageInspectorProvider.h:39
QmitkNodeSelectionDialog::m_Panels
PanelVectorType m_Panels
Definition: QmitkNodeSelectionDialog.h:140
mitk::WeakPointer< mitk::DataStorage >
QmitkNodeSelectionDialog::SelectionCheckFunctionType
std::function< std::string(const NodeList &)> SelectionCheckFunctionType
Helper function that is used to check the given selection for consistency. Returning an empty string ...
Definition: QmitkNodeSelectionDialog.h:70
AbstractDataNodeAction::GetSelectedNodes
MITK_QT_APP QList< mitk::DataNode::Pointer > GetSelectedNodes(berry::IWorkbenchPartSite::Pointer workbenchPartSite)