Medical Imaging Interaction Toolkit  2024.12.99-0da743f6
Medical Imaging Interaction Toolkit
QmitkDataNodeContextMenu.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 QmitkDataNodeContextMenu_h
14 #define QmitkDataNodeContextMenu_h
15 
17 
18 // qt widgets module
33 #include "QmitkNodeDescriptor.h"
34 
35 // mitk core
36 #include <mitkBaseRenderer.h>
37 #include <mitkDataStorage.h>
38 #include <mitkWeakPointer.h>
39 
40 // blueberry ui qt plugin
43 
44 // qt
45 #include <QMenu>
46 
48 {
49  Q_OBJECT
50 
51 public:
52 
53  QmitkDataNodeContextMenu(berry::IWorkbenchPartSite::Pointer workbenchPartSite, QWidget* parent = nullptr);
54 
55  ~QmitkDataNodeContextMenu() override;
56 
57  void SetDataStorage(mitk::DataStorage* dataStorage);
58  void SetBaseRenderer(mitk::BaseRenderer* baseRenderer);
59 
60  void SetSurfaceDecimation(bool surfaceDecimation);
61 
62  void SetSelectedNodes(const QList<mitk::DataNode::Pointer>& selectedNodes);
63 
64 public Q_SLOTS:
65 
66  void OnContextMenuRequested(const QPoint& pos);
67  void OnExtensionPointActionTriggered(QAction* action);
68 
69 private:
70 
71  using DescriptorActionListType = std::vector<std::pair<QmitkNodeDescriptor*, QAction*>>;
72  using ConfigurationElementsType = std::map<QAction*, berry::IConfigurationElement::Pointer>;
73 
74  void InitNodeDescriptors();
75  void InitDefaultActions();
76  void InitExtensionPointActions();
77  void InitServiceActions();
78 
79  void AddColorAction(QWidgetAction* colorAction);
80  void AddDescriptorActionList(DescriptorActionListType& descriptorActionList);
81 
82  QList<QAction*> GetActions(const mitk::DataNode* node);
83  QList<QAction*> GetActions(const QList<mitk::DataNode::Pointer>& nodes);
84 
85  QWidget* m_Parent;
86  berry::IWorkbenchPartSite::WeakPtr m_WorkbenchPartSite;
87 
90  QList<mitk::DataNode::Pointer> m_SelectedNodes;
91 
92  // store a list of all actions to remove them on menu destruction
93  DescriptorActionListType m_DescriptorActionList;
94 
95  // stores the configuration elements for the context menu actions from extension points
96  ConfigurationElementsType m_ConfigElements;
97 
98  QmitkNodeDescriptor* m_UnknownDataNodeDescriptor;
99  QmitkNodeDescriptor* m_ImageDataNodeDescriptor;
100  QmitkNodeDescriptor* m_MultiComponentImageDataNodeDescriptor;
101  QmitkNodeDescriptor* m_DiffusionImageDataNodeDescriptor;
102  QmitkNodeDescriptor* m_FiberBundleDataNodeDescriptor;
103  QmitkNodeDescriptor* m_PeakImageDataNodeDescriptor;
104  QmitkNodeDescriptor* m_SegmentDataNodeDescriptor;
105  QmitkNodeDescriptor* m_SurfaceDataNodeDescriptor;
106  QmitkNodeDescriptor* m_PointSetNodeDescriptor;
107  QmitkNodeDescriptor* m_PlanarLineNodeDescriptor;
108  QmitkNodeDescriptor* m_PlanarCircleNodeDescriptor;
109  QmitkNodeDescriptor* m_PlanarEllipseNodeDescriptor;
110  QmitkNodeDescriptor* m_PlanarAngleNodeDescriptor;
111  QmitkNodeDescriptor* m_PlanarFourPointAngleNodeDescriptor;
112  QmitkNodeDescriptor* m_PlanarRectangleNodeDescriptor;
113  QmitkNodeDescriptor* m_PlanarPolygonNodeDescriptor;
114  QmitkNodeDescriptor* m_PlanarPathNodeDescriptor;
115  QmitkNodeDescriptor* m_PlanarDoubleEllipseNodeDescriptor;
116  QmitkNodeDescriptor* m_PlanarBezierCurveNodeDescriptor;
117  QmitkNodeDescriptor* m_PlanarSubdivisionPolygonNodeDescriptor;
118 
120  // default actions
122  QmitkDataNodeGlobalReinitAction* m_GlobalReinitAction;
123  QmitkDataNodeReinitAction* m_ReinitAction;
124  QmitkDataNodeResetGeometryAction* m_ResetGeometryAction;
125  QmitkDataNodeRemoveAction* m_RemoveAction;
126  QmitkDataNodeRenameAction* m_RenameAction;
127  QmitkDataNodeShowSelectedNodesAction* m_ShowSelectedNodesAction;
128  QmitkDataNodeToggleVisibilityAction* m_ToggleVisibilityAction;
129  QmitkDataNodeShowDetailsAction* m_ShowDetailsAction;
130  QmitkDataNodeOpacityAction* m_OpacityAction;
131  QmitkDataNodeColorAction* m_ColorAction;
132  QmitkDataNodeColorMapAction* m_ColormapAction;
133  QmitkDataNodeComponentAction* m_ComponentAction;
134  QmitkDataNodeTextureInterpolationAction* m_TextureInterpolationAction;
135  QmitkDataNodeSurfaceRepresentationAction* m_SurfaceRepresentationAction;
136 
137  bool m_SurfaceDecimation;
138 };
139 
140 #endif
QmitkDataNodeShowSelectedNodesAction.h
QmitkDataNodeShowSelectedNodesAction
Definition: QmitkDataNodeShowSelectedNodesAction.h:23
QmitkDataNodeShowDetailsAction
Definition: QmitkDataNodeShowDetailsAction.h:29
QmitkDataNodeResetGeometryAction.h
mitkDataStorage.h
QmitkDataNodeColorAction
Definition: QmitkDataNodeColorAction.h:24
berry::SmartPointer
Implements transparent reference counting.
Definition: berryICommandCategoryListener.h:21
QmitkDataNodeReinitAction.h
QmitkDataNodeRenameAction.h
QmitkDataNodeGlobalReinitAction
Definition: QmitkDataNodeGlobalReinitAction.h:28
QmitkDataNodeRemoveAction
Definition: QmitkDataNodeRemoveAction.h:31
QmitkDataNodeSurfaceRepresentationAction.h
QmitkDataNodeTextureInterpolationAction.h
QmitkNodeDescriptor.h
QmitkNodeDescriptor
Decorator class for mitk::DataNode.
Definition: QmitkNodeDescriptor.h:33
QmitkDataNodeToggleVisibilityAction.h
berryIConfigurationElement.h
berryIWorkbenchPartSite.h
QmitkDataNodeColorAction.h
QmitkDataNodeResetGeometryAction
Definition: QmitkDataNodeResetGeometryAction.h:30
QmitkDataNodeToggleVisibilityAction
Definition: QmitkDataNodeToggleVisibilityAction.h:31
QmitkDataNodeRemoveAction.h
QmitkDataNodeTextureInterpolationAction
Definition: QmitkDataNodeTextureInterpolationAction.h:23
mitk::DataStorage
Data management class that handles 'was created by' relations.
Definition: mitkDataStorage.h:43
mitkWeakPointer.h
QmitkDataNodeSurfaceRepresentationAction
Definition: QmitkDataNodeSurfaceRepresentationAction.h:23
QmitkDataNodeShowDetailsAction.h
QmitkDataNodeRenameAction
Definition: QmitkDataNodeRenameAction.h:21
QmitkDataNodeGlobalReinitAction.h
mitk::BaseRenderer
Definition: mitkBaseRenderer.h:56
QmitkDataNodeOpacityAction.h
MITK_QT_APP
#define MITK_QT_APP
Definition: org_mitk_gui_qt_application_Export.h:26
QmitkDataNodeReinitAction
Definition: QmitkDataNodeReinitAction.h:31
QmitkDataNodeComponentAction
Definition: QmitkDataNodeComponentAction.h:26
org_mitk_gui_qt_application_Export.h
QmitkDataNodeColorMapAction.h
QmitkDataNodeContextMenu
Definition: QmitkDataNodeContextMenu.h:47
berry::WeakPointer
implements a WeakPointer class to deal with circular reference problems.
Definition: berrySmartPointer.h:32
mitkBaseRenderer.h
mitk::WeakPointer< mitk::DataStorage >
QmitkDataNodeColorMapAction
Definition: QmitkDataNodeColorMapAction.h:26
mitk::DataNode
Class for nodes of the DataTree.
Definition: mitkDataNode.h:63
QmitkDataNodeOpacityAction
Definition: QmitkDataNodeOpacityAction.h:23
QmitkDataNodeComponentAction.h