Medical Imaging Interaction Toolkit  2026.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 // mitk core
19 #include <mitkBaseRenderer.h>
20 
21 // qt widgets module
24 #include <memory>
25 
26 namespace Ui
27 {
29 }
30 
49 {
50  Q_OBJECT
51 
52 public:
53 
56 
58 
63  void SetBaseRenderer(mitk::BaseRenderer* baseRenderer);
64 
67 
72  void SetSelectAll(bool selectAll);
74  bool GetSelectAll() const;
76  void SelectAll();
78  using GroupSyncIndexType = int;
83  void SetSyncGroup(const GroupSyncIndexType index);
86 
87 Q_SIGNALS:
88 
89  void SelectionModeChanged(bool selectAll);
91  void NodeVisibilityChanged(mitk::DataNode::Pointer node, const bool visibility);
101 
102 public Q_SLOTS:
103  void SetSelection(const NodeList& newSelection);
104  void SetNodeVisibility(mitk::DataNode::Pointer node, const bool visibility);
105 
106 private Q_SLOTS:
107 
108  void OnSelectionModeChanged(bool selectAll);
109  void OnEditSelection();
110  void OnTableClicked(const QModelIndex& index);
111 
112 protected:
113 
115  void Initialize();
116 
117  void UpdateInfo() override;
118  void OnDataStorageChanged() override;
119  void OnNodePredicateChanged() override;
120  void ReviseSelectionChanged(const NodeList& oldInternalSelection, NodeList& newInternalSelection) override;
121  void OnInternalSelectionChanged() override;
122  void OnNodeAddedToStorage(const mitk::DataNode* node) override;
123  void OnNodeModified(const itk::Object* caller, const itk::EventObject& event) override;
124 
125 private:
126 
127  void ReinitNode(const mitk::DataNode* dataNode);
128  void RemoveFromInternalSelection(mitk::DataNode* dataNode);
129  bool IsParentNodeSelected(const mitk::DataNode* dataNode) const;
130  void DeselectNode(mitk::DataNode* dataNode);
131 
132  std::unique_ptr<Ui::QmitkSynchronizedNodeSelectionWidget> m_Controls;
134 
135  std::unique_ptr<QmitkRenderWindowDataNodeTableModel> m_StorageModel;
136  GroupSyncIndexType m_SyncGroupIndex; // -1 = unassigned
137 
138 };
139 
140 #endif
#define MITKQTWIDGETS_EXPORT
Abstract base class for the selection of data from a data storage.
QList< mitk::DataNode::Pointer > NodeList
Table model that manages data nodes for a specific render window.
Node selection widget with renderer-specific functionality and synchronization support.
int GroupSyncIndexType
Type alias for the synchronization group index.
void SyncGroupIndexChanged(GroupSyncIndexType index)
Emitted when the synchronization group index actually changes.
void OnNodeModified(const itk::Object *caller, const itk::EventObject &event) override
void SelectAll()
Selects all nodes from the data storage.
bool GetSelectAll() const
Returns whether the "select all" mode is active.
void SelectionModeChanged(bool selectAll)
void SetSelection(const NodeList &newSelection)
void ReviseSelectionChanged(const NodeList &oldInternalSelection, NodeList &newInternalSelection) override
void OnNodeAddedToStorage(const mitk::DataNode *node) override
void NodeVisibilityChanged(mitk::DataNode::Pointer node, const bool visibility)
void SetSelectAll(bool selectAll)
Sets whether all nodes should be selected.
QmitkRenderWindowDataNodeTableModel * GetStorageModel() const
Returns the internal data node table model.
GroupSyncIndexType GetSyncGroup() const
Returns the current synchronization group index.
QmitkSynchronizedNodeSelectionWidget(QWidget *parent)
void SetNodeVisibility(mitk::DataNode::Pointer node, const bool visibility)
void SetSyncGroup(const GroupSyncIndexType index)
Sets the synchronization group for this widget.
void SetBaseRenderer(mitk::BaseRenderer *baseRenderer)
Sets the base renderer that this widget controls.
Organizes the rendering process.
Central node class of the MITK data tree, associating a data object with properties and mappers.
Definition: mitkDataNode.h:72