Medical Imaging Interaction Toolkit  2022.04.99-3f7a773b
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 QMITK_NODE_SELECTION_DIALOG_H
14 #define QMITK_NODE_SELECTION_DIALOG_H
15 
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 // QMITK_NODE_SELECTION_DIALOG_H
QList< mitk::DataNode::Pointer > NodeList
Data management class that handles &#39;was created by&#39; relations.
mitk::NodePredicateBase::ConstPointer m_NodePredicate
QAbstractItemView::SelectionMode SelectionMode
mitk::WeakPointer< mitk::DataStorage > m_DataStorage
The common interface for all DataStorage inspector providers.
std::vector< QmitkAbstractDataStorageInspector * > PanelVectorType
A customized QDialog that displays different data storage inspectors and allows to set and get a curr...
SelectionCheckFunctionType m_CheckFunction
Ui_QmitkNodeSelectionDialog m_Controls
Interface for evaluation conditions used in the DataStorage class GetSubset() method.
#define MITK_QT_COMMON
MITK_QT_APP QList< mitk::DataNode::Pointer > GetSelectedNodes(berry::IWorkbenchPartSite::Pointer workbenchPartSite)
std::function< std::string(const NodeList &)> SelectionCheckFunctionType
Helper function that is used to check the given selection for consistency. Returning an empty string ...