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