Slicer  5.2
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLLayoutManager.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Program: 3D Slicer
4 
5  Copyright (c) Kitware Inc.
6 
7  See COPYRIGHT.txt
8  or http://www.slicer.org/copyright/copyright.txt for details.
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 
16  This file was originally developed by Julien Finet, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qMRMLLayoutManager_h
22 #define __qMRMLLayoutManager_h
23 
24 // Qt includes
25 #include <QStringList>
26 class QWidget;
27 
28 // CTK includes
29 #include <ctkLayoutFactory.h>
30 
31 // qMRML includes
32 #include "qMRMLWidgetsExport.h"
33 
34 class qMRMLPlotWidget;
35 class qMRMLTableWidget;
36 class qMRMLThreeDWidget;
37 class qMRMLSliceWidget;
38 class qMRMLLayoutManagerPrivate;
40 
42 class vtkMRMLColorLogic;
43 class vtkMRMLLayoutLogic;
44 class vtkMRMLScene;
45 class vtkMRMLNode;
46 class vtkMRMLTableNode;
48 class vtkMRMLViewNode;
50 
51 class vtkCollection;
52 class vtkRenderer;
53 
73 class QMRML_WIDGETS_EXPORT qMRMLLayoutManager : public ctkLayoutFactory
74 {
75  Q_OBJECT
76 
83  Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
84  // The following properties are exposed so that they are available within python
85  Q_PROPERTY(int layout READ layout WRITE setLayout NOTIFY layoutChanged DESIGNABLE false)
86  Q_PROPERTY(int threeDViewCount READ threeDViewCount DESIGNABLE false)
87  Q_PROPERTY(int tableViewCount READ tableViewCount DESIGNABLE false)
88  Q_PROPERTY(int plotViewCount READ plotViewCount DESIGNABLE false)
89 
90 public:
92  typedef ctkLayoutFactory Superclass;
93 
95  explicit qMRMLLayoutManager(QObject* parent=nullptr);
96  explicit qMRMLLayoutManager(QWidget* viewport, QObject* parent);
97  ~qMRMLLayoutManager() override;
98 
101  bool isEnabled()const;
102 
107  Q_INVOKABLE virtual void registerViewFactory(ctkLayoutViewFactory* viewFactory);
108 
112  Q_INVOKABLE QList<qMRMLLayoutViewFactory*> mrmlViewFactories()const;
113 
117  Q_INVOKABLE qMRMLLayoutViewFactory* mrmlViewFactory(const QString& viewClassName)const;
118 
122  Q_INVOKABLE vtkMRMLScene* mrmlScene()const;
123 
127  Q_INVOKABLE QWidget* viewWidget(vtkMRMLNode* n) const;
128 
130  Q_INVOKABLE qMRMLSliceWidget* sliceWidget(const QString& name)const;
131 
133  Q_INVOKABLE qMRMLThreeDWidget* threeDWidget(const QString& name)const;
134 
138  Q_INVOKABLE QStringList sliceViewNames() const;
139 
141  int threeDViewCount()const;
142  int tableViewCount()const;
143  int plotViewCount()const;
144 
149  Q_INVOKABLE qMRMLThreeDWidget* threeDWidget(int id)const;
150  Q_INVOKABLE qMRMLTableWidget* tableWidget(int id)const;
151  Q_INVOKABLE qMRMLPlotWidget* plotWidget(int id)const;
152 
155  Q_INVOKABLE vtkCollection* mrmlSliceLogics()const;
156 
159  Q_INVOKABLE vtkCollection* mrmlViewLogics()const;
160 
161  Q_INVOKABLE void setMRMLColorLogic(vtkMRMLColorLogic* colorLogic);
162  Q_INVOKABLE vtkMRMLColorLogic* mrmlColorLogic()const;
163 
167  int layout()const;
168 
170  Q_INVOKABLE vtkMRMLAbstractViewNode* maximizedViewNode();
171 
174  Q_INVOKABLE vtkMRMLLayoutLogic* layoutLogic()const;
175 
180  Q_INVOKABLE vtkMRMLViewNode* activeMRMLThreeDViewNode()const;
185  Q_INVOKABLE vtkRenderer* activeThreeDRenderer()const;
190  Q_INVOKABLE vtkMRMLTableViewNode* activeMRMLTableViewNode()const;
195  Q_INVOKABLE vtkRenderer* activeTableRenderer()const;
200  Q_INVOKABLE vtkMRMLPlotViewNode* activeMRMLPlotViewNode()const;
205  Q_INVOKABLE vtkRenderer* activePlotRenderer()const;
206 
207 
208 public slots:
211  void setEnabled(bool enable);
212 
215  void setMRMLScene(vtkMRMLScene* scene);
216 
219  void setLayout(int newLayout);
220 
223  void setMaximizedViewNode(vtkMRMLAbstractViewNode* viewNode);
224 
227  void setLayoutNumberOfCompareViewRows(int num);
228  void setLayoutNumberOfCompareViewColumns(int num);
229 
232  void resetThreeDViews();
233 
236  void resetSliceViews();
237 
242  void setRenderPaused(bool pause);
243 
246  void pauseRender();
247 
250  void resumeRender();
251 
252 signals:
253  void activeMRMLThreeDViewNodeChanged(vtkMRMLViewNode* newActiveMRMLThreeDViewNode);
254  void activeMRMLTableViewNodeChanged(vtkMRMLTableViewNode* newActiveMRMLTableViewNode);
255  void activeMRMLPlotViewNodeChanged(vtkMRMLPlotViewNode* newActiveMRMLPlotViewNode);
256  void activeThreeDRendererChanged(vtkRenderer* newRenderer);
257  void activeTableRendererChanged(vtkRenderer* newRenderer);
258  void activePlotRendererChanged(vtkRenderer* newRenderer);
259  void layoutChanged(int);
260 
262  void nodeAboutToBeEdited(vtkMRMLNode* node);
263 
264 protected:
265  QScopedPointer<qMRMLLayoutManagerPrivate> d_ptr;
266  qMRMLLayoutManager(qMRMLLayoutManagerPrivate* obj, QWidget* viewport, QObject* parent);
267 
268  void onViewportChanged() override;
269 
270  using ctkLayoutManager::setLayout;
271 private:
272  Q_DECLARE_PRIVATE(qMRMLLayoutManager);
273  Q_DISABLE_COPY(qMRMLLayoutManager);
274 };
275 
276 #endif
ctkLayoutFactory Superclass
Superclass typedef.
MRML node to represent Plot view parameters.
MRML logic class for layout manipulation.
MRML logic class for color manipulation.
Abstract MRML node to represent a view. The class holds the properties common to any view type (3D...
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
qMRMLTableWidget is the toplevel table widget that can be packed in a layout.
MRML node to represent a 3D view.
MRML node to represent table view parameters.
qMRMLPlotWidget is the toplevel Plotting widget that can be packed in a layout.
MRML node to represent a table object.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167