Medical Imaging Interaction Toolkit  2016.11.0
Medical Imaging Interaction Toolkit
QmitkStdMultiWidget.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,
6 Division of Medical and Biological Informatics.
7 All rights reserved.
8 
9 This software is distributed WITHOUT ANY WARRANTY; without
10 even the implied warranty of MERCHANTABILITY or FITNESS FOR
11 A PARTICULAR PURPOSE.
12 
13 See LICENSE.txt or http://www.mitk.org for details.
14 
15 ===================================================================*/
16 
17 #ifndef QmitkStdMultiWidget_h
18 #define QmitkStdMultiWidget_h
19 
20 #include "MitkQtWidgetsExports.h"
21 
22 #include <mitkDataStorage.h>
23 #include <mitkLogoOverlay.h>
24 
25 #include <mitkMouseModeSwitcher.h>
26 
27 #include <QFrame>
28 #include <qsplitter.h>
29 #include <qwidget.h>
30 
31 #include <QmitkLevelWindowWidget.h>
32 #include <QmitkRenderWindow.h>
33 
34 #include <mitkBaseRenderer.h>
35 
36 class QHBoxLayout;
37 class QVBoxLayout;
38 class QGridLayout;
39 class QSpacerItem;
41 class QmitkRenderWindow;
42 class vtkCornerAnnotation;
44 
45 namespace mitk
46 {
47  class RenderingManager;
48 }
49 
52 {
53  Q_OBJECT
54 
55 public:
57  QWidget *parent = 0,
58  Qt::WindowFlags f = 0,
59  mitk::RenderingManager *renderingManager = 0,
61  const QString &name = "stdmulti");
62  virtual ~QmitkStdMultiWidget();
63 
64  mitk::SliceNavigationController *GetTimeNavigationController();
65 
66  void RequestUpdate();
67 
68  void ForceImmediateUpdate();
69 
70  mitk::MouseModeSwitcher *GetMouseModeSwitcher();
71 
72  QmitkRenderWindow *GetRenderWindow1() const;
73 
74  QmitkRenderWindow *GetRenderWindow2() const;
75 
76  QmitkRenderWindow *GetRenderWindow3() const;
77 
78  QmitkRenderWindow *GetRenderWindow4() const;
79 
80  const mitk::Point3D GetCrossPosition() const;
81 
82  void EnablePositionTracking();
83 
84  void DisablePositionTracking();
85 
86  int GetLayout() const;
87 
88  bool GetGradientBackgroundFlag() const;
89 
94  mitk::DataNode::Pointer GetWidgetPlane1();
99  mitk::DataNode::Pointer GetWidgetPlane2();
104  mitk::DataNode::Pointer GetWidgetPlane3();
110  mitk::DataNode::Pointer GetWidgetPlane(int id);
111 
112  bool IsColoredRectanglesEnabled() const;
113 
114  bool IsDepartmentLogoEnabled() const;
115 
116  void InitializeWidget();
117 
119  void RemovePlanesFromDataStorage();
120 
121  void AddPlanesToDataStorage();
122 
123  void SetDataStorage(mitk::DataStorage *ds);
124 
129  void HandleCrosshairPositionEvent();
130 
132  void ActivateMenuWidget(bool state);
133 
134  bool IsMenuWidgetEnabled() const;
135 
136  void SetCornerAnnotationVisibility(bool visibility);
137 
138  bool IsCornerAnnotationVisible(void) const;
139 
140 protected:
141  void UpdateAllWidgets();
142 
143  void HideAllWidgetToolbars();
144 
146 
147 public slots:
148 
150  void HandleCrosshairPositionEventDelayed();
151 
152  void changeLayoutTo2DImagesUp();
153 
154  void changeLayoutTo2DImagesLeft();
155 
156  void changeLayoutToDefault();
157 
158  void changeLayoutToBig3D();
159 
160  void changeLayoutToWidget1();
161 
162  void changeLayoutToWidget2();
163 
164  void changeLayoutToWidget3();
165 
166  void changeLayoutToRowWidget3And4();
167 
168  void changeLayoutToColumnWidget3And4();
169 
170  void changeLayoutToRowWidgetSmall3andBig4();
171 
172  void changeLayoutToSmallUpperWidget2Big3and4();
173 
174  void changeLayoutTo2x2Dand3DWidget();
175 
176  void changeLayoutToLeft2Dand3DRight2D();
177 
178  void changeLayoutTo2DUpAnd3DDown();
179 
180  void Fit();
181 
182  void InitPositionTracking();
183 
184  void AddDisplayPlaneSubTree();
185 
186  void EnableStandardLevelWindow();
187 
188  void DisableStandardLevelWindow();
189 
190  bool InitializeStandardViews(const mitk::Geometry3D *geometry);
191 
192  void wheelEvent(QWheelEvent *e) override;
193 
194  void mousePressEvent(QMouseEvent *e) override;
195 
196  void moveEvent(QMoveEvent *e) override;
197 
198  void EnsureDisplayContainsPoint(mitk::BaseRenderer *renderer, const mitk::Point3D &p);
199 
200  void MoveCrossToPosition(const mitk::Point3D &newPosition);
201 
202  // void EnableNavigationControllerEventListening();
203 
204  // void DisableNavigationControllerEventListening();
205 
206  void EnableGradientBackground();
207 
208  void DisableGradientBackground();
209 
210  void EnableDepartmentLogo();
211 
212  void DisableDepartmentLogo();
213 
214  void EnableColoredRectangles();
215 
216  void DisableColoredRectangles();
217 
218  void SetWidgetPlaneVisibility(const char *widgetName, bool visible, mitk::BaseRenderer *renderer = NULL);
219 
220  void SetWidgetPlanesVisibility(bool visible, mitk::BaseRenderer *renderer = NULL);
221 
222  void SetWidgetPlanesLocked(bool locked);
223 
224  void SetWidgetPlanesRotationLocked(bool locked);
225 
226  void SetWidgetPlanesRotationLinked(bool link);
227 
228  void SetWidgetPlaneMode(int mode);
229 
230  void SetGradientBackgroundColors(const mitk::Color &upper, const mitk::Color &lower);
231 
232  void SetDepartmentLogoPath(const char *path);
233 
234  void SetWidgetPlaneModeToSlicing(bool activate);
235 
236  void SetWidgetPlaneModeToRotation(bool activate);
237 
238  void SetWidgetPlaneModeToSwivel(bool activate);
239 
240  void OnLayoutDesignChanged(int layoutDesignIndex);
241 
242  void ResetCrosshair();
243 
244 signals:
245 
246  void LeftMouseClicked(mitk::Point3D pointValue);
247  void WheelMoved(QWheelEvent *);
248  void WidgetPlanesRotationLinked(bool);
249  void WidgetPlanesRotationEnabled(bool);
250  void ViewsInitialized();
251  void WidgetPlaneModeSlicing(bool);
252  void WidgetPlaneModeRotation(bool);
253  void WidgetPlaneModeSwivel(bool);
254  void WidgetPlaneModeChange(int);
255  void WidgetNotifyNewCrossHairMode(int);
256  void Moved();
257 
258 public:
265  /********************************/
266 
267  enum
268  {
269  PLANE_MODE_SLICING = 0,
271  PLANE_MODE_SWIVEL
272  };
273  enum
274  {
275  LAYOUT_DEFAULT = 0,
288  LAYOUT_2D_UP_AND_3D_DOWN
289  };
290 
291  enum
292  {
296  THREE_D
297  };
298 
305  void SetDecorationProperties(std::string text, mitk::Color color, int widgetNumber);
311  QmitkRenderWindow *GetRenderWindow(unsigned int number);
312 
322  void SetGradientBackgroundColorForRenderWindow(const mitk::Color &upper,
323  const mitk::Color &lower,
324  unsigned int widgetNumber);
325 
331  mitk::Color GetDecorationColor(unsigned int widgetNumber);
332 
341  void SetDecorationColor(unsigned int widgetNumber, mitk::Color color);
342 
348  std::string GetCornerAnnotationText(unsigned int widgetNumber);
349 
355  std::pair<mitk::Color, mitk::Color> GetGradientColors(unsigned int widgetNumber);
356 
357 protected:
359 
360  int m_Layout;
362 
364 
366 
368 
371 
373 
385 
393 
398  std::pair<mitk::Color, mitk::Color> m_GradientBackgroundColors[4];
399 
400  QSplitter *m_MainSplit;
401  QSplitter *m_LayoutSplit;
402  QSplitter *m_SubSplit1;
403  QSplitter *m_SubSplit2;
404 
409 
410  vtkSmartPointer<vtkCornerAnnotation> m_CornerAnnotations[4];
411  vtkSmartPointer<vtkMitkRectangleProp> m_RectangleProps[4];
412 
421  vtkSmartPointer<vtkCornerAnnotation> CreateCornerAnnotation(std::string text, mitk::Color color);
422 
427  void FillGradientBackgroundWithBlack();
428 };
429 #endif /*QmitkStdMultiWidget_h*/
Data management class that handles 'was created by' relations.
Standard implementation of BaseGeometry.
mitk::DataNode::Pointer m_PlaneNode2
void AddDisplayPlaneSubTree()
mitk::MouseModeSwitcher::Pointer m_MouseModeSwitcher
Organizes the rendering process.
QmitkRenderWindow * mitkWidget4
QmitkRenderWindow * mitkWidget2
DataCollection - Class to facilitate loading/accessing structured data.
#define MITKQTWIDGETS_EXPORT
mitk::DataNode::Pointer m_PlaneNode1
m_PlaneNode1 the 3 helper objects which contain the plane geometry.
QmitkRenderWindow * mitkWidget1
mitk::DataNode::Pointer m_PlaneNode3
Controls the selection of the slice the associated BaseRenderer will display.
mitk::RenderingManager * m_RenderingManager
itk::SmartPointer< const Self > ConstPointer
QmitkLevelWindowWidget * levelWindowWidget
The vtkMitkRectangleProp2 class Renders a rectangle into a renderwindow as a frame.
Manager for coordinating the rendering process.
QmitkRenderWindow * mitkWidget3
MITK implementation of the QVTKWidget.
itk::RGBPixel< float > Color
Color Standard RGB color typedef (float)
mitk::SliceNavigationController * m_TimeNavigationController
void Fit()
mitk::DataNode::Pointer m_ParentNodeForGeometryPlanes
m_ParentNodeForGeometryPlanes This helper object is added to the datastorage and contains the 3 plane...
mitk::LogoOverlay::Pointer m_LogoRendering
mitk::DataStorage::Pointer m_DataStorage
mitk::Color m_DecorationColorWidget4
m_DecorationColorWidget4 color for annotation and rectangle of widget 4.
QHBoxLayout * QmitkStdMultiWidgetLayout