Medical Imaging Interaction Toolkit  2023.12.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 private Q_SLOTS:
67 
68  void OnModelUpdated();
69  void OnSelectionModeChanged(bool selectAll);
70  void OnEditSelection();
71  void OnTableClicked(const QModelIndex& index);
72 
73 protected:
74 
75  void SetUpConnections();
76  void Initialize();
77 
78  void UpdateInfo() override;
79  void OnDataStorageChanged() override;
80  void OnNodePredicateChanged() override;
81  void ReviseSelectionChanged(const NodeList& oldInternalSelection, NodeList& newInternalSelection) override;
82  void OnInternalSelectionChanged() override;
83  bool AllowEmissionOfSelection(const NodeList& emissionCandidates) const override;
84  void OnNodeAddedToStorage(const mitk::DataNode* node) override;
85  void OnNodeModified(const itk::Object* caller, const itk::EventObject& event) override;
86 
87 private:
88 
89  void ReviseSynchronizedSelectionChanged(const NodeList& oldInternalSelection, NodeList& newInternalSelection);
90  void ReviseDesynchronizedSelectionChanged(const NodeList& oldInternalSelection, NodeList& newInternalSelection);
91  void ReinitNode(const mitk::DataNode* dataNode);
92  void RemoveFromInternalSelection(mitk::DataNode* dataNode);
93  bool IsParentNodeSelected(const mitk::DataNode* dataNode) const;
94  void DeselectNode(mitk::DataNode* dataNode);
95 
96  Ui::QmitkSynchronizedNodeSelectionWidget m_Controls;
98 
99  std::unique_ptr<QmitkRenderWindowDataNodeTableModel> m_StorageModel;
100 
101 };
102 
103 #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