Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
QmitkSynchronizedNodeSelectionWidget.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 QmitkSynchronizedNodeSelectionWidget_h
14 #define QmitkSynchronizedNodeSelectionWidget_h
15 
16 #include <MitkQtWidgetsExports.h>
17 
18 #include "ui_QmitkSynchronizedNodeSelectionWidget.h"
19 
20 // mitk core
21 #include <mitkBaseRenderer.h>
22 
23 // qt widgets module
26 
27 /*
28 * @brief The 'QmitkSynchronizedNodeSelectionWidget' implements the 'QmitkAbstractNodeSelectionWidget'
29 * by providing a table view, using a 'QmitkRenderWindowDataNodeTableModel' and extending it
30 * with base renderer-specific functionality.
31 *
32 * Given a base renderer, the selection widget is able to display and access render window specific properties
33 * of the selected nodes, making it possible to switch between a "synchronized" and "desynchronized" selection
34 * state.
35 * The widget can be used to decide if all data nodes of the data storage should be selected or
36 * only an individually selected set of nodes, defined by a 'QmitkNodeSelectionDialog'.
37 * If individual nodes are selected / removed from the selection, the widget can inform other
38 * 'QmitkSynchronizedNodeSelectionWidget' about the current selection, if desired.
39 * Additionally the widget allows to reinitialize the corresponding base renderer with a specific
40 * data node geometry.
41 */
43 {
44  Q_OBJECT
45 
46 public:
47 
48  QmitkSynchronizedNodeSelectionWidget(QWidget* parent);
50 
52 
53  void SetBaseRenderer(mitk::BaseRenderer* baseRenderer);
54 
55  void SetSelectAll(bool selectAll);
56  bool GetSelectAll() const;
57  void SelectAll();
58  void SetSynchronized(bool synchronize);
59  bool IsSynchronized() const;
60 
61 Q_SIGNALS:
62 
63  void SelectionModeChanged(bool selectAll);
64  void DeregisterSynchronization();
65 
66 public Q_SLOTS:
67  void SetSelection(const NodeList& newSelection);
68 
69 private Q_SLOTS:
70 
71  void OnSelectionModeChanged(bool selectAll);
72  void OnEditSelection();
73  void OnTableClicked(const QModelIndex& index);
74 
75 protected:
76 
77  void SetUpConnections();
78  void Initialize();
79 
80  void UpdateInfo() override;
81  void OnDataStorageChanged() override;
82  void OnNodePredicateChanged() override;
83  void ReviseSelectionChanged(const NodeList& oldInternalSelection, NodeList& newInternalSelection) override;
84  void OnInternalSelectionChanged() override;
85  bool AllowEmissionOfSelection(const NodeList& emissionCandidates) const override;
86  void OnNodeAddedToStorage(const mitk::DataNode* node) override;
87  void OnNodeModified(const itk::Object* caller, const itk::EventObject& event) override;
88 
89 private:
90 
91  void ReviseSynchronizedSelectionChanged(const NodeList& oldInternalSelection, NodeList& newInternalSelection);
92  void ReviseDesynchronizedSelectionChanged(const NodeList& oldInternalSelection, NodeList& newInternalSelection);
93  void ReinitNode(const mitk::DataNode* dataNode);
94  void RemoveFromInternalSelection(mitk::DataNode* dataNode);
95  bool IsParentNodeSelected(const mitk::DataNode* dataNode) const;
96  void DeselectNode(mitk::DataNode* dataNode);
97 
98  Ui::QmitkSynchronizedNodeSelectionWidget m_Controls;
100 
101  std::unique_ptr<QmitkRenderWindowDataNodeTableModel> m_StorageModel;
102 
103 };
104 
105 #endif
QmitkAbstractNodeSelectionWidget
Abstract base class for the selection of data from a data storage.
Definition: QmitkAbstractNodeSelectionWidget.h:30
QmitkAbstractNodeSelectionWidget::OnNodeModified
virtual void OnNodeModified(const itk::Object *caller, const itk::EventObject &event)
MITKQTWIDGETS_EXPORT
#define MITKQTWIDGETS_EXPORT
Definition: MitkQtWidgetsExports.h:15
QmitkAbstractNodeSelectionWidget::UpdateInfo
virtual void UpdateInfo()=0
QmitkAbstractNodeSelectionWidget::ReviseSelectionChanged
virtual void ReviseSelectionChanged(const NodeList &oldInternalSelection, NodeList &newInternalSelection)
QmitkAbstractNodeSelectionWidget::OnNodeAddedToStorage
virtual void OnNodeAddedToStorage(const mitk::DataNode *node)
QmitkSynchronizedNodeSelectionWidget
Definition: QmitkSynchronizedNodeSelectionWidget.h:42
MitkQtWidgetsExports.h
QmitkRenderWindowDataNodeTableModel.h
QmitkAbstractNodeSelectionWidget.h
QmitkAbstractNodeSelectionWidget::OnNodePredicateChanged
virtual void OnNodePredicateChanged()
QmitkAbstractNodeSelectionWidget::NodeList
QList< mitk::DataNode::Pointer > NodeList
Definition: QmitkAbstractNodeSelectionWidget.h:64
QmitkAbstractNodeSelectionWidget::AllowEmissionOfSelection
virtual bool AllowEmissionOfSelection(const NodeList &emissionCandidates) const
QmitkAbstractNodeSelectionWidget::OnInternalSelectionChanged
virtual void OnInternalSelectionChanged()
QmitkAbstractNodeSelectionWidget::OnDataStorageChanged
virtual void OnDataStorageChanged()
mitk::BaseRenderer
Definition: mitkBaseRenderer.h:56
mitkBaseRenderer.h
mitk::WeakPointer< mitk::BaseRenderer >
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63