Medical Imaging Interaction Toolkit  2023.04.00
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*>;
62 
63  QmitkAbstractMultiWidget(QWidget* parent = 0,
64  Qt::WindowFlags f = 0,
65  const QString& multiWidgetName = "multiwidget");
66 
67  virtual ~QmitkAbstractMultiWidget();
68 
69  virtual void InitializeMultiWidget() = 0;
70  virtual void MultiWidgetOpened() { }
71  virtual void MultiWidgetClosed() { }
72 
73  virtual void SetDataStorage(mitk::DataStorage* dataStorage);
74  mitk::DataStorage* GetDataStorage() const;
75 
76  int GetRowCount() const;
77  int GetColumnCount() const;
78  virtual void SetLayout(int row, int column);
79 
80  virtual void Synchronize(bool) { };
81  virtual void SetInteractionScheme(mitk::InteractionSchemeSwitcher::InteractionScheme scheme);
82 
83  mitk::InteractionEventHandler* GetInteractionEventHandler();
84  void SetDisplayActionEventHandler(std::unique_ptr<mitk::DisplayActionEventHandler> displayActionEventHandler);
85  mitk::DisplayActionEventHandler* GetDisplayActionEventHandler();
86 
87  RenderWindowWidgetMap GetRenderWindowWidgets() const;
88  RenderWindowWidgetMap Get2DRenderWindowWidgets() const;
89  RenderWindowWidgetMap Get3DRenderWindowWidgets() const;
90  RenderWindowWidgetPointer GetRenderWindowWidget(int row, int column) const;
91  RenderWindowWidgetPointer GetRenderWindowWidget(const QString& widgetName) const;
92  RenderWindowWidgetPointer GetRenderWindowWidget(const QmitkRenderWindow* renderWindow) const;
93  RenderWindowHash GetRenderWindows() const;
94  QmitkRenderWindow* GetRenderWindow(int row, int column) const;
95  virtual QmitkRenderWindow* GetRenderWindow(const QString& widgetName) const;
96  virtual QmitkRenderWindow* GetRenderWindow(const mitk::AnatomicalPlane& orientation) const = 0;
97 
98  virtual void SetActiveRenderWindowWidget(RenderWindowWidgetPointer activeRenderWindowWidget);
99  RenderWindowWidgetPointer GetActiveRenderWindowWidget() const;
100  RenderWindowWidgetPointer GetFirstRenderWindowWidget() const;
101  RenderWindowWidgetPointer GetLastRenderWindowWidget() const;
102 
103  virtual QString GetNameFromIndex(int row, int column) const;
104  virtual QString GetNameFromIndex(size_t index) const;
105 
106  unsigned int GetNumberOfRenderWindowWidgets() const;
107 
108  void RequestUpdate(const QString& widgetName);
109  void RequestUpdateAll();
110  void ForceImmediateUpdate(const QString& widgetName);
111  void ForceImmediateUpdateAll();
112 
124  virtual void InitializeViews(const mitk::TimeGeometry* geometry, bool resetCamera) = 0;
125 
134  virtual void SetInteractionReferenceGeometry(const mitk::TimeGeometry* referenceGeometry) = 0;
135 
142  virtual bool HasCoupledRenderWindows() const = 0;
143 
144  virtual void SetSelectedPosition(const mitk::Point3D& newPosition, const QString& widgetName) = 0;
145  virtual const mitk::Point3D GetSelectedPosition(const QString& widgetName) const = 0;
146 
147  virtual void SetCrosshairVisibility(bool visible) = 0;
148  virtual bool GetCrosshairVisibility() const = 0;
149  virtual void SetCrosshairGap(unsigned int gapSize) = 0;
150 
151  virtual void ResetCrosshair() = 0;
152 
153  virtual void SetWidgetPlaneMode(int mode) = 0;
154 
155  virtual void ActivateMenuWidget(bool state);
156  virtual bool IsMenuWidgetEnabled() const;
157 
158  QmitkMultiWidgetLayoutManager* GetMultiWidgetLayoutManager() const;
159 
160 signals:
161 
162  void ActiveRenderWindowChanged();
163 
164 private slots:
165 
166  void OnFocusChanged(itk::Object*, const itk::EventObject& event);
167 
168 protected:
169 
170  virtual void AddRenderWindowWidget(const QString& widgetName, RenderWindowWidgetPointer renderWindowWidget);
171  virtual void RemoveRenderWindowWidget();
172 
173 private:
174 
179  virtual void SetLayoutImpl() = 0;
184  virtual void SetInteractionSchemeImpl() = 0;
185 
186  struct Impl;
187  std::unique_ptr<Impl> m_Impl;
188 
189 };
190 
191 #endif
QmitkAbstractMultiWidget::RenderWindowWidgetPointer
std::shared_ptr< QmitkRenderWindowWidget > RenderWindowWidgetPointer
Definition: QmitkAbstractMultiWidget.h:59
mitk::InteractionEventHandler
Definition: mitkInteractionEventHandler.h:40
mitk::InteractionSchemeSwitcher::InteractionScheme
InteractionScheme
Definition: mitkInteractionSchemeSwitcher.h:114
mitk::TimeGeometry
Definition: mitkTimeGeometry.h:43
MITKQTWIDGETS_EXPORT
#define MITKQTWIDGETS_EXPORT
Definition: MitkQtWidgetsExports.h:15
QmitkAbstractMultiWidget::RenderWindowHash
QHash< QString, QmitkRenderWindow * > RenderWindowHash
Definition: QmitkAbstractMultiWidget.h:61
mitkDisplayActionEventHandler.h
mitkInteractionSchemeSwitcher.h
mitkPoint.h
QmitkRenderWindow
MITK implementation of the QVTKWidget.
Definition: QmitkRenderWindow.h:38
mitk
DataCollection - Class to facilitate loading/accessing structured data.
Definition: RenderingTests.dox:1
QmitkAbstractMultiWidget::MultiWidgetClosed
virtual void MultiWidgetClosed()
Definition: QmitkAbstractMultiWidget.h:71
QmitkAbstractMultiWidget::RenderWindowWidgetMap
std::map< QString, std::shared_ptr< QmitkRenderWindowWidget > > RenderWindowWidgetMap
Definition: QmitkAbstractMultiWidget.h:60
QmitkAbstractMultiWidget::MultiWidgetOpened
virtual void MultiWidgetOpened()
Definition: QmitkAbstractMultiWidget.h:70
mitk::AnatomicalPlane
AnatomicalPlane
Definition: mitkAnatomicalPlanes.h:18
mitk::Point< ScalarType, 3 >
MitkQtWidgetsExports.h
mitk::DataStorage
Data management class that handles 'was created by' relations.
Definition: mitkDataStorage.h:43
mitk::DisplayActionEventHandler
This class simplifies the process of adding an itkEventObject-itkCommand pair as an observer of a Dis...
Definition: mitkDisplayActionEventHandler.h:33
QmitkRenderWindowWidget
The 'QmitkRenderWindowWidget' is a QFrame that holds a render window and some associates properties,...
Definition: QmitkRenderWindowWidget.h:42
QmitkAbstractMultiWidget
The 'QmitkAbstractMultiWidget' is a 'QWidget' that can be subclassed to display multiple render windo...
Definition: QmitkAbstractMultiWidget.h:53
QmitkMultiWidgetLayoutManager
The layout manager provides different layout-functions that can modify the layout of an QmitkAbstract...
Definition: QmitkMultiWidgetLayoutManager.h:35
QmitkAbstractMultiWidget::Synchronize
virtual void Synchronize(bool)
Definition: QmitkAbstractMultiWidget.h:80
mitkBaseRenderer.h