Slicer  4.11
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 qMRMLChartWidget;
35 class qMRMLPlotWidget;
36 class qMRMLTableWidget;
37 class qMRMLThreeDWidget;
38 class qMRMLSliceWidget;
39 class qMRMLLayoutManagerPrivate;
41 
42 class vtkMRMLColorLogic;
43 class vtkMRMLLayoutLogic;
44 class vtkMRMLScene;
45 class vtkMRMLChartNode;
46 class vtkMRMLNode;
48 class vtkMRMLTableNode;
50 class vtkMRMLViewNode;
52 
53 class vtkCollection;
54 class vtkRenderer;
55 
75 class QMRML_WIDGETS_EXPORT qMRMLLayoutManager : public ctkLayoutFactory
76 {
77  Q_OBJECT
78 
85  Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled)
86  // The following properties are exposed so that they are available within python
87  Q_PROPERTY(int layout READ layout WRITE setLayout NOTIFY layoutChanged DESIGNABLE false)
88  Q_PROPERTY(int threeDViewCount READ threeDViewCount DESIGNABLE false)
89  Q_PROPERTY(int chartViewCount READ chartViewCount DESIGNABLE false)
90  Q_PROPERTY(int tableViewCount READ tableViewCount DESIGNABLE false)
91  Q_PROPERTY(int plotViewCount READ plotViewCount DESIGNABLE false)
92 
93 public:
95  typedef ctkLayoutFactory Superclass;
96 
98  explicit qMRMLLayoutManager(QObject* parent=nullptr);
99  explicit qMRMLLayoutManager(QWidget* viewport, QObject* parent);
100  ~qMRMLLayoutManager() override;
101 
104  bool isEnabled()const;
105 
110  Q_INVOKABLE virtual void registerViewFactory(ctkLayoutViewFactory* viewFactory);
111 
115  Q_INVOKABLE QList<qMRMLLayoutViewFactory*> mrmlViewFactories()const;
116 
120  Q_INVOKABLE qMRMLLayoutViewFactory* mrmlViewFactory(const QString& viewClassName)const;
121 
125  Q_INVOKABLE vtkMRMLScene* mrmlScene()const;
126 
130  Q_INVOKABLE QWidget* viewWidget(vtkMRMLNode* n) const;
131 
133  Q_INVOKABLE qMRMLSliceWidget* sliceWidget(const QString& name)const;
134 
136  Q_INVOKABLE qMRMLThreeDWidget* threeDWidget(const QString& name)const;
137 
141  Q_INVOKABLE QStringList sliceViewNames() const;
142 
144  int threeDViewCount()const;
145  int chartViewCount()const;
146  int tableViewCount()const;
147  int plotViewCount()const;
148 
153  Q_INVOKABLE qMRMLThreeDWidget* threeDWidget(int id)const;
154  Q_INVOKABLE qMRMLChartWidget* chartWidget(int id)const;
155  Q_INVOKABLE qMRMLTableWidget* tableWidget(int id)const;
156  Q_INVOKABLE qMRMLPlotWidget* plotWidget(int id)const;
157 
160  Q_INVOKABLE vtkCollection* mrmlSliceLogics()const;
161 
164  Q_INVOKABLE vtkCollection* mrmlViewLogics()const;
165 
166  Q_INVOKABLE void setMRMLColorLogic(vtkMRMLColorLogic* colorLogic);
167  Q_INVOKABLE vtkMRMLColorLogic* mrmlColorLogic()const;
168 
172  int layout()const;
173 
176  Q_INVOKABLE vtkMRMLLayoutLogic* layoutLogic()const;
177 
182  Q_INVOKABLE vtkMRMLViewNode* activeMRMLThreeDViewNode()const;
187  Q_INVOKABLE vtkRenderer* activeThreeDRenderer()const;
192  Q_INVOKABLE vtkMRMLChartViewNode* activeMRMLChartViewNode()const;
197  Q_INVOKABLE vtkRenderer* activeChartRenderer()const;
202  Q_INVOKABLE vtkMRMLTableViewNode* activeMRMLTableViewNode()const;
207  Q_INVOKABLE vtkRenderer* activeTableRenderer()const;
212  Q_INVOKABLE vtkMRMLPlotViewNode* activeMRMLPlotViewNode()const;
217  Q_INVOKABLE vtkRenderer* activePlotRenderer()const;
218 
219 
220 public slots:
223  void setEnabled(bool enable);
224 
227  void setMRMLScene(vtkMRMLScene* scene);
228 
231  void setLayout(int newLayout);
232 
235  void setLayoutNumberOfCompareViewRows(int num);
236  void setLayoutNumberOfCompareViewColumns(int num);
237 
240  void resetThreeDViews();
241 
244  void resetSliceViews();
245 
250  void setRenderPaused(bool pause);
251 
254  void pauseRender();
255 
258  void resumeRender();
259 
260 signals:
261  void activeMRMLThreeDViewNodeChanged(vtkMRMLViewNode* newActiveMRMLThreeDViewNode);
262  void activeMRMLChartViewNodeChanged(vtkMRMLChartViewNode* newActiveMRMLChartViewNode);
263  void activeMRMLTableViewNodeChanged(vtkMRMLTableViewNode* newActiveMRMLChartViewNode);
264  void activeMRMLPlotViewNodeChanged(vtkMRMLPlotViewNode* newActiveMRMLPlotViewNode);
265  void activeThreeDRendererChanged(vtkRenderer* newRenderer);
266  void activeChartRendererChanged(vtkRenderer* newRenderer);
267  void activeTableRendererChanged(vtkRenderer* newRenderer);
268  void activePlotRendererChanged(vtkRenderer* newRenderer);
269  void layoutChanged(int);
270 
272  void nodeAboutToBeEdited(vtkMRMLNode* node);
273 
274 protected:
275  QScopedPointer<qMRMLLayoutManagerPrivate> d_ptr;
276  qMRMLLayoutManager(qMRMLLayoutManagerPrivate* obj, QWidget* viewport, QObject* parent);
277 
278  void onViewportChanged() override;
279 
280  using ctkLayoutManager::setLayout;
281 private:
282  Q_DECLARE_PRIVATE(qMRMLLayoutManager);
283  Q_DISABLE_COPY(qMRMLLayoutManager);
284 };
285 
286 #endif
ctkLayoutFactory Superclass
Superclass typedef.
MRML node for referencing a collection of data to plot.
MRML node to represent Plot view parameters.
MRML logic class for layout manipulation.
qMRMLChartWidget is the toplevel charting widget that can be packed in a layout.
MRML logic class for color manipulation.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:61
MRML node to represent chart view parameters.
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