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