Medical Imaging Interaction Toolkit  2024.06.00
Medical Imaging Interaction Toolkit
QmitkMxNMultiWidget.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 QmitkMxNMultiWidget_h
14 #define QmitkMxNMultiWidget_h
15 
16 #include "MitkQtWidgetsExports.h"
17 
18 // qt widgets module
22 
23 #include <nlohmann/json.hpp>
24 
25 class QSplitter;
26 
34 {
35  Q_OBJECT
36 
37 public:
38 
39  QmitkMxNMultiWidget(QWidget* parent = nullptr,
40  Qt::WindowFlags f = {},
41  const QString& multiWidgetName = "mxn");
42 
44 
45  void InitializeMultiWidget() override;
46 
47  void Synchronize(bool synchronized) override;
48 
49  QmitkRenderWindow* GetRenderWindow(const QString& widgetName) const override;
50  QmitkRenderWindow* GetRenderWindow(const mitk::AnatomicalPlane& orientation) const override;
51 
52  void SetActiveRenderWindowWidget(RenderWindowWidgetPointer activeRenderWindowWidget) override;
53 
63  void InitializeViews(const mitk::TimeGeometry* geometry, bool resetCamera) override;
64 
72  void SetInteractionReferenceGeometry(const mitk::TimeGeometry* referenceGeometry) override;
73 
79  bool HasCoupledRenderWindows() const override;
80 
81  void SetSelectedPosition(const mitk::Point3D& newPosition, const QString& widgetName) override;
82  const mitk::Point3D GetSelectedPosition(const QString& widgetName) const override;
83 
84  void SetCrosshairVisibility(bool visible) override;
85  bool GetCrosshairVisibility() const override;
86  void SetCrosshairGap(unsigned int gapSize) override;
87 
88  void ResetCrosshair() override;
89 
90  void SetWidgetPlaneMode(int userMode) override;
91 
92  mitk::SliceNavigationController* GetTimeNavigationController();
93 
94  void EnableCrosshair();
95  void DisableCrosshair();
96 
97 public Q_SLOTS:
98 
99  // mouse events
100  void wheelEvent(QWheelEvent* e) override;
101  void mousePressEvent(QMouseEvent* e) override;
102  void moveEvent(QMoveEvent* e) override;
103  void LoadLayout(const nlohmann::json* jsonData);
104  void SaveLayout(std::ostream* outStream);
105  void SetDataBasedLayout(const QmitkAbstractNodeSelectionWidget::NodeList& nodes);
106 
107 Q_SIGNALS:
108 
109  void WheelMoved(QWheelEvent *);
110  void Moved();
111  void UpdateUtilityWidgetViewPlanes();
112  void LayoutChanged();
113 
114 private:
115 
116  void SetLayoutImpl() override;
117  void SetInteractionSchemeImpl() override { }
118 
119  QmitkAbstractMultiWidget::RenderWindowWidgetPointer CreateRenderWindowWidget();
120  QmitkAbstractMultiWidget::RenderWindowWidgetPointer GetWindowFromIndex(size_t index);
121  void SetInitialSelection();
122  void ToggleSynchronization(QmitkSynchronizedNodeSelectionWidget* synchronizedWidget);
123 
124  static nlohmann::json BuildJSONFromLayout(const QSplitter* splitter);
125  QSplitter* BuildLayoutFromJSON(const nlohmann::json* jsonData, unsigned int* windowCounter, QSplitter* parentSplitter = nullptr);
126 
127  std::unique_ptr<QmitkSynchronizedWidgetConnector> m_SynchronizedWidgetConnector;
128 
129  bool m_CrosshairVisibility;
130 
131 };
132 
133 #endif
QmitkAbstractMultiWidget::RenderWindowWidgetPointer
std::shared_ptr< QmitkRenderWindowWidget > RenderWindowWidgetPointer
Definition: QmitkAbstractMultiWidget.h:59
mitk::TimeGeometry
Definition: mitkTimeGeometry.h:45
MITKQTWIDGETS_EXPORT
#define MITKQTWIDGETS_EXPORT
Definition: MitkQtWidgetsExports.h:15
QmitkAbstractMultiWidget::InitializeViews
virtual void InitializeViews(const mitk::TimeGeometry *geometry, bool resetCamera)=0
Initialize the render windows of the concrete multi widget to the given geometry.
QmitkAbstractMultiWidget::SetInteractionReferenceGeometry
virtual void SetInteractionReferenceGeometry(const mitk::TimeGeometry *referenceGeometry)=0
Define the reference geometry for interaction withing a render window.
QmitkAbstractMultiWidget::SetSelectedPosition
virtual void SetSelectedPosition(const mitk::Point3D &newPosition, const QString &widgetName)=0
QmitkAbstractMultiWidget::ResetCrosshair
virtual void ResetCrosshair()=0
QmitkAbstractMultiWidget::SetWidgetPlaneMode
virtual void SetWidgetPlaneMode(int mode)=0
QmitkRenderWindow
MITK implementation of the QVTKWidget.
Definition: QmitkRenderWindow.h:38
QmitkAbstractMultiWidget::SetCrosshairVisibility
virtual void SetCrosshairVisibility(bool visible)=0
QmitkAbstractMultiWidget::GetSelectedPosition
virtual const mitk::Point3D GetSelectedPosition(const QString &widgetName) const =0
QmitkSynchronizedNodeSelectionWidget.h
QmitkAbstractMultiWidget::SetActiveRenderWindowWidget
virtual void SetActiveRenderWindowWidget(RenderWindowWidgetPointer activeRenderWindowWidget)
QmitkAbstractMultiWidget::InitializeMultiWidget
virtual void InitializeMultiWidget()=0
mitk::SliceNavigationController
Controls the selection of the slice the associated BaseRenderer will display.
Definition: mitkSliceNavigationController.h:130
QmitkAbstractMultiWidget::GetCrosshairVisibility
virtual bool GetCrosshairVisibility() const =0
QmitkAbstractMultiWidget::GetRenderWindow
QmitkRenderWindow * GetRenderWindow(int row, int column) const
QmitkAbstractMultiWidget.h
json
nlohmann::json json
Definition: mitkModelTestFixture.h:29
mitk::AnatomicalPlane
AnatomicalPlane
Definition: mitkAnatomicalPlanes.h:18
mitk::Point< ScalarType, 3 >
QmitkSynchronizedNodeSelectionWidget
Definition: QmitkSynchronizedNodeSelectionWidget.h:42
MitkQtWidgetsExports.h
QmitkAbstractNodeSelectionWidget::NodeList
QList< mitk::DataNode::Pointer > NodeList
Definition: QmitkAbstractNodeSelectionWidget.h:64
QmitkMxNMultiWidget
The 'QmitkMxNMultiWidget' is a 'QmitkAbstractMultiWidget' that is used to display multiple render win...
Definition: QmitkMxNMultiWidget.h:33
QmitkAbstractMultiWidget::HasCoupledRenderWindows
virtual bool HasCoupledRenderWindows() const =0
Returns true if the render windows are coupled; false if not.
QmitkAbstractMultiWidget
The 'QmitkAbstractMultiWidget' is a 'QWidget' that can be subclassed to display multiple render windo...
Definition: QmitkAbstractMultiWidget.h:53
QmitkAbstractMultiWidget::Synchronize
virtual void Synchronize(bool)
Definition: QmitkAbstractMultiWidget.h:80
QmitkSynchronizedWidgetConnector.h
QmitkAbstractMultiWidget::SetCrosshairGap
virtual void SetCrosshairGap(unsigned int gapSize)=0