Medical Imaging Interaction Toolkit  2021.10.99-1c4db16f
Medical Imaging Interaction Toolkit
QmitkAbstractMultiWidget.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 QMITKABSTRACTMULTIWIDGET_H
14 #define QMITKABSTRACTMULTIWIDGET_H
15 
16 // mitk qt widgets module
17 #include "MitkQtWidgetsExports.h"
18 
19 // mitk core
20 #include <mitkBaseRenderer.h>
23 #include <mitkPoint.h>
24 
25 // qt
26 #include <QWidget>
27 
28 // c++
29 #include <map>
30 #include <memory>
31 
33 class QmitkRenderWindow;
35 
36 namespace mitk
37 {
38  class DataStorage;
39  class InteractionEventHandler;
40 }
41 
54 {
55  Q_OBJECT
56 
57 public:
58 
59  using RenderWindowWidgetPointer = std::shared_ptr<QmitkRenderWindowWidget>;
60  using RenderWindowWidgetMap = std::map<QString, std::shared_ptr<QmitkRenderWindowWidget>>;
61  using RenderWindowHash = QHash<QString, QmitkRenderWindow*>;
63 
64  QmitkAbstractMultiWidget(QWidget* parent = 0,
65  Qt::WindowFlags f = 0,
66  const QString& multiWidgetName = "multiwidget");
67 
68  virtual ~QmitkAbstractMultiWidget();
69 
70  virtual void InitializeMultiWidget() = 0;
71  virtual void MultiWidgetOpened() { }
72  virtual void MultiWidgetClosed() { }
73 
74  virtual void SetDataStorage(mitk::DataStorage* dataStorage);
75  mitk::DataStorage* GetDataStorage() const;
76 
77  int GetRowCount() const;
78  int GetColumnCount() const;
79  virtual void SetLayout(int row, int column);
80 
81  virtual void Synchronize(bool) { };
82  virtual void SetInteractionScheme(mitk::InteractionSchemeSwitcher::InteractionScheme scheme);
83 
84  mitk::InteractionEventHandler* GetInteractionEventHandler();
85  void SetDisplayActionEventHandler(std::unique_ptr<mitk::DisplayActionEventHandler> displayActionEventHandler);
86  mitk::DisplayActionEventHandler* GetDisplayActionEventHandler();
87 
88  RenderWindowWidgetMap GetRenderWindowWidgets() const;
89  RenderWindowWidgetMap Get2DRenderWindowWidgets() const;
90  RenderWindowWidgetMap Get3DRenderWindowWidgets() const;
91  RenderWindowWidgetPointer GetRenderWindowWidget(int row, int column) const;
92  RenderWindowWidgetPointer GetRenderWindowWidget(const QString& widgetName) const;
93  RenderWindowWidgetPointer GetRenderWindowWidget(const QmitkRenderWindow* renderWindow) const;
94  RenderWindowHash GetRenderWindows() const;
95  QmitkRenderWindow* GetRenderWindow(int row, int column) const;
96  virtual QmitkRenderWindow* GetRenderWindow(const QString& widgetName) const;
97  virtual QmitkRenderWindow* GetRenderWindow(const ViewDirection& viewDirection) const = 0;
98 
99  virtual void SetActiveRenderWindowWidget(RenderWindowWidgetPointer activeRenderWindowWidget);
100  RenderWindowWidgetPointer GetActiveRenderWindowWidget() const;
101  RenderWindowWidgetPointer GetFirstRenderWindowWidget() const;
102  RenderWindowWidgetPointer GetLastRenderWindowWidget() const;
103 
104  virtual QString GetNameFromIndex(int row, int column) const;
105  virtual QString GetNameFromIndex(size_t index) const;
106 
107  unsigned int GetNumberOfRenderWindowWidgets() const;
108 
109  void RequestUpdate(const QString& widgetName);
110  void RequestUpdateAll();
111  void ForceImmediateUpdate(const QString& widgetName);
112  void ForceImmediateUpdateAll();
113 
114  virtual void SetSelectedPosition(const mitk::Point3D& newPosition, const QString& widgetName) = 0;
115  virtual const mitk::Point3D GetSelectedPosition(const QString& widgetName) const = 0;
116 
117  virtual void SetCrosshairVisibility(bool visible) = 0;
118  virtual bool GetCrosshairVisibility() const = 0;
119 
120  virtual void ResetCrosshair() = 0;
121 
122  virtual void SetWidgetPlaneMode(int mode) = 0;
123 
124  virtual void ActivateMenuWidget(bool state);
125  virtual bool IsMenuWidgetEnabled() const;
126 
127  QmitkMultiWidgetLayoutManager* GetMultiWidgetLayoutManager() const;
128 
129 signals:
130 
131  void ActiveRenderWindowChanged();
132 
133 private slots:
134 
135  void OnFocusChanged(itk::Object*, const itk::EventObject& event);
136 
137 protected:
138 
139  virtual void AddRenderWindowWidget(const QString& widgetName, RenderWindowWidgetPointer renderWindowWidget);
140  virtual void RemoveRenderWindowWidget();
141 
142 private:
143 
148  virtual void SetLayoutImpl() = 0;
153  virtual void SetInteractionSchemeImpl() = 0;
154 
155  struct Impl;
156  std::unique_ptr<Impl> m_Impl;
157 
158 };
159 
160 #endif // QMITKABSTRACTMULTIWIDGET_H
Data management class that handles &#39;was created by&#39; relations.
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKQTWIDGETS_EXPORT
The &#39;QmitkRenderWindowWidget&#39; is a QFrame that holds a render window and some associates properties...
This class simplifies the process of adding an itkEventObject-itkCommand pair as an observer of a Dis...
std::shared_ptr< QmitkRenderWindowWidget > RenderWindowWidgetPointer
MITK implementation of the QVTKWidget.
QHash< QString, QmitkRenderWindow * > RenderWindowHash
std::map< QString, std::shared_ptr< QmitkRenderWindowWidget > > RenderWindowWidgetMap
ViewDirection
Possible view directions for render windows.
The &#39;QmitkAbstractMultiWidget&#39; is a &#39;QWidget&#39; that can be subclassed to display multiple render windo...
The layout manager provides different layout-functions that can modify the layout of an QmitkAbstract...