NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkMultiViewerWidget.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef niftkMultiViewerWidget_h
16 #define niftkMultiViewerWidget_h
17 
18 #include <niftkDnDDisplayExports.h>
19 
20 #include <QColor>
21 #include <QEvent>
22 #include <QList>
23 #include <QWidget>
24 
25 #include <mitkBaseProperty.h>
26 #include <mitkRenderingManager.h>
27 
28 #include "niftkDnDDisplayEnums.h"
31 
32 class QSpinBox;
33 class QGridLayout;
34 class QVBoxLayout;
35 class QHBoxLayout;
36 class QPushButton;
37 class QSpacerItem;
38 class QLabel;
39 class QRadioButton;
40 class QCheckBox;
41 class QStackedLayout;
42 class QmitkRenderWindow;
43 class QLine;
44 class QButtonGroup;
45 class QToolButton;
46 class ctkPopupWidget;
47 
48 
49 namespace niftk
50 {
51 
52 class MultiViewerControls;
53 
70 class NIFTKDNDDISPLAY_EXPORT MultiViewerWidget : public QWidget
71 {
72  Q_OBJECT
73 
74 public:
75 
77  {
78  PositionBinding = 1,
79  CursorBinding = 2,
80  MagnificationBinding = 4,
81  WindowLayoutBinding = 8,
82  GeometryBinding = 16
83  };
84 
89  MultiViewerVisibilityManager* visibilityManager,
90  mitk::RenderingManager* renderingManager,
91  QWidget* parent = 0, Qt::WindowFlags f = 0);
92 
95  virtual ~MultiViewerWidget();
96 
99  void RequestUpdateAll();
100 
102  void SetViewerNumber(int viewerRows, int viewerColumns);
103 
106  SingleViewerWidget* GetViewer(int row, int column) const;
107 
109  int GetBindingOptions() const;
110 
112  void SetBindingOptions(int bindingOptions);
113 
115  void SetBackgroundColour(QColor backgroundColour);
116 
118  void SetInterpolationType(DnDDisplayInterpolationType interpolationType);
119 
121  void SetDefaultWindowLayout(WindowLayout windowLayout);
122 
124  void SetDefaultSingleWindowLayout(WindowLayout windowLayout);
125 
127  void SetDefaultMultiWindowLayout(WindowLayout layout);
128 
130  void SetDropType(DnDDisplayDropType dropType);
131 
133  void SetShowDropTypeControls(bool visible);
134 
136  bool AreShowOptionsVisible() const;
137 
139  void SetShowOptionsVisible(bool visible);
140 
142  bool AreWindowLayoutControlsVisible() const;
143 
145  void SetWindowLayoutControlsVisible(bool visible);
146 
148  bool AreViewerNumberControlsVisible() const;
149 
151  void SetViewerNumberControlsVisible(bool visible);
152 
154  void SetShowMagnificationSlider(bool visible);
155 
157  bool IsCursorVisible() const;
158 
160  void SetCursorVisible(bool visibile);
161 
164  bool GetCursorDefaultVisibility() const;
165 
168  void SetCursorDefaultVisibility(bool visibile);
169 
171  bool AreDirectionAnnotationsVisible() const;
172 
174  void SetDirectionAnnotationsVisible(bool visible);
175 
177  bool IsIntensityAnnotationVisible() const;
178 
180  void SetIntensityAnnotationVisible(bool visible);
181 
183  bool GetShow3DWindowIn2x2WindowLayout() const;
184 
186  void SetShow3DWindowIn2x2WindowLayout(bool enabled);
187 
189  void SetRememberSettingsPerWindowLayout(bool rememberSettingsPerWindowLayout);
190 
192  void SetSliceTracking(bool tracking);
193 
195  void SetTimeStepTracking(bool tracking);
196 
198  void SetMagnificationTracking(bool tracking);
199 
201  void SetTimeStep(int timeStep);
202 
204  void SetSelectedWindowTo3D();
205 
207  virtual bool ToggleCursorVisibility();
208 
210  bool GetThumbnailMode() const;
211 
213  void SetThumbnailMode(bool thumbnailMode);
214 
217 
219  SingleViewerWidget* GetSelectedViewer() const;
220 
224  virtual QmitkRenderWindow* GetSelectedRenderWindow() const;
225 
229  virtual QHash<QString,QmitkRenderWindow*> GetRenderWindows() const;
230 
234  virtual QmitkRenderWindow* GetRenderWindow(const QString& id) const;
235 
240  mitk::Point3D GetSelectedPosition(const QString& id = QString()) const;
241 
246  virtual void SetSelectedPosition(const mitk::Point3D& pos, const QString& id = QString());
247 
251  virtual bool IsLinkedNavigationEnabled() const;
252 
256  virtual void EnableLinkedNavigation(bool enabled);
257 
259  bool IsFocused();
260 
262  void SetFocused();
263 
265  virtual bool eventFilter(QObject* object, QEvent* event);
266 
267 signals:
268 
269  void BindingOptionsChanged(int bindingOptions);
270 
271 protected slots:
272 
274  void OnSelectedSliceControlChanged(int selectedSlice);
275 
277  void OnTimeStepControlChanged(int timeStep);
278 
280  void OnMagnificationControlChanged(double magnification);
281 
283  void OnCursorVisibilityControlChanged(bool visible);
284 
286  void OnShowDirectionAnnotationsControlsChanged(bool visible);
287 
289  void OnShowIntensityAnnotationControlsChanged(bool visible);
290 
292  void OnShow3DWindowControlChanged(bool visible);
293 
295  void OnWindowLayoutControlChanged(WindowLayout windowLayout);
296 
298  void OnWindowCursorBindingControlChanged(bool);
299 
301  void OnWindowMagnificationBindingControlChanged(bool);
302 
304  void OnViewerNumberControlChanged(int rows, int columns);
305 
307  void OnViewerPositionBindingControlChanged(bool bound);
308 
310  void OnViewerCursorBindingControlChanged(bool bound);
311 
313  void OnViewerWindowLayoutBindingControlChanged(bool bound);
314 
316  void OnViewerMagnificationBindingControlChanged(bool bound);
317 
319  void OnViewerGeometryBindingControlChanged(bool bound);
320 
322  void OnDropTypeControlChanged(DnDDisplayDropType dropType);
323 
325  void OnDropAccumulateControlChanged(bool checked);
326 
328  void OnFocusChanged();
329 
332  void OnSelectedPositionChanged(const mitk::Point3D& selectedPosition);
333 
336  void OnTimeStepChanged(int timeStep);
337 
339  void OnCursorPositionChanged(WindowOrientation orientation, const mitk::Vector2D& cursorPosition);
340 
342  void OnScaleFactorChanged(WindowOrientation orientation, double scaleFactor);
343 
345  void OnWindowLayoutChanged(WindowLayout windowLayout);
346 
348  void OnTimeGeometryChanged(const mitk::TimeGeometry* timeGeometry);
349 
351  void OnCursorPositionBindingChanged(bool bound);
352 
354  void OnScaleFactorBindingChanged(bool bound);
355 
357  void OnCursorVisibilityChanged(bool visible);
358 
360  void OnDirectionAnnotationsVisibilityChanged(bool visible);
361 
363  void OnIntensityAnnotationVisibilityChanged(bool visible);
364 
366  void OnPopupOpened(bool opened);
367 
369  void OnPinButtonToggled(bool checked);
370 
371 private:
372 
376  SingleViewerWidget* CreateViewer(const QString& name);
377 
379  void Update2DCursorVisibility();
380 
382  void UpdateBoundGeometry(bool isBoundNow);
383 
385  void SetSelectedRenderWindow(int selectedViewerIndex, QmitkRenderWindow* selectedRenderWindow);
386 
387  MultiViewerControls* CreateControlPanel(QWidget* parent);
388 
389  // Layouts
390  QGridLayout* m_TopLevelLayout;
391  QGridLayout* m_LayoutForRenderWindows;
392 
393  // Widgets
394  QToolButton* m_PinButton;
395  ctkPopupWidget* m_PopupWidget;
396 
397  // This determines the maximum number of viewers.
398  static const int m_MaxViewerRows = 5;
399  static const int m_MaxViewerColumns = 5;
400 
401  // All the viewer windows.
402  QList<SingleViewerWidget*> m_Viewers;
403 
404  // Dependencies, injected via constructor.
405  // We don't own them, so don't try to delete them.
406  MultiViewerVisibilityManager* m_VisibilityManager;
407  mitk::RenderingManager* m_RenderingManager;
408 
409  // Member variables for control purposes.
410  int m_SelectedViewerIndex;
411  int m_ViewerRows;
412  int m_ViewerColumns;
413  int m_ViewerRowsInNonThumbnailMode;
414  int m_ViewerColumnsInNonThumbnailMode;
415  bool m_Show3DWindowIn2x2WindowLayout;
416  bool m_CursorDefaultVisibility;
417  QColor m_BackgroundColour;
418  bool m_RememberSettingsPerWindowLayout;
419  bool m_ThumbnailMode;
420  bool m_LinkedNavigationEnabled;
421  double m_Magnification;
422  WindowLayout m_SingleWindowLayout;
423  WindowLayout m_MultiWindowLayout;
424 
425  int m_BindingOptions;
426 
427  MultiViewerControls* m_ControlPanel;
428 
429  unsigned long m_FocusManagerObserverTag;
430 };
431 
432 }
433 
434 #endif
WindowOrientation
Describes the different types of orientation, axial, sagittal, coronal, that can be achieved in the D...
Definition: niftkDnDDisplayEnums.h:29
DnDDisplayDropType
Describes the different modes that can be used when drag and dropping into the DnD Display window...
Definition: niftkDnDDisplayEnums.h:163
GLenum GLsizei const GLuint GLboolean enabled
Definition: glew.h:2537
ViewerBindingOption
Definition: niftkMultiViewerWidget.h:76
Control panel for the DnD display.
Definition: niftkMultiViewerControls.h:35
itk::SpatialOrientation::ValidCoordinateOrientationFlags GetOrientation(ImageType::Pointer image)
Definition: niftkBreastDensityFromMRIsGivenMaskAndImage.cxx:146
Provides up to 5 x 5 image viewing panes, arranged as rows and columns.
Definition: niftkMultiViewerWidget.h:70
WindowLayout
Describes the different render window layouts. So one WindowLayout could have multiple windows of dif...
Definition: niftkDnDDisplayEnums.h:49
A widget to wrap a single MultiWindowWidget, providing methods for switching the render window layout...
Definition: niftkSingleViewerWidget.h:78
GLenum GLenum GLvoid GLvoid * column
Definition: glew.h:4074
DnDDisplayInterpolationType
Describes what the interpolation type should be set to when an image is dropped.
Definition: niftkDnDDisplayEnums.h:174
GLuint const GLchar * name
Definition: glew.h:1798
GLenum GLenum GLvoid * row
Definition: glew.h:4074
cl_event event
Definition: glew.h:3231
Maintains a list of SingleViewerWidgets and coordinates visibility properties by listening to AddNode...
Definition: niftkMultiViewerVisibilityManager.h:61
Definition: niftkExceptionObject.h:21
GLclampf f
Definition: glew.h:3136