Slicer  4.8
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=0);
99  explicit qMRMLLayoutManager(QWidget* viewport, QObject* parent);
100  virtual ~qMRMLLayoutManager();
101 
104  bool isEnabled()const;
105 
110  virtual void registerViewFactory(ctkLayoutViewFactory* viewFactory);
111 
115  Q_INVOKABLE QList<qMRMLLayoutViewFactory*> mrmlViewFactories()const;
116 
120  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 
138  Q_INVOKABLE QStringList sliceViewNames() const;
139 
141  int threeDViewCount()const;
142  int chartViewCount()const;
143  int tableViewCount()const;
144  int plotViewCount()const;
145 
150  Q_INVOKABLE qMRMLThreeDWidget* threeDWidget(int id)const;
151  Q_INVOKABLE qMRMLChartWidget* chartWidget(int id)const;
152  Q_INVOKABLE qMRMLTableWidget* tableWidget(int id)const;
153  Q_INVOKABLE qMRMLPlotWidget* plotWidget(int id)const;
154 
157  Q_INVOKABLE vtkCollection* mrmlSliceLogics()const;
158 
159  Q_INVOKABLE void setMRMLColorLogic(vtkMRMLColorLogic* colorLogic);
160  Q_INVOKABLE vtkMRMLColorLogic* mrmlColorLogic()const;
161 
165  int layout()const;
166 
169  Q_INVOKABLE vtkMRMLLayoutLogic* layoutLogic()const;
170 
175  Q_INVOKABLE vtkMRMLViewNode* activeMRMLThreeDViewNode()const;
180  Q_INVOKABLE vtkRenderer* activeThreeDRenderer()const;
185  Q_INVOKABLE vtkMRMLChartViewNode* activeMRMLChartViewNode()const;
190  Q_INVOKABLE vtkRenderer* activeChartRenderer()const;
195  Q_INVOKABLE vtkMRMLTableViewNode* activeMRMLTableViewNode()const;
200  Q_INVOKABLE vtkRenderer* activeTableRenderer()const;
205  Q_INVOKABLE vtkMRMLPlotViewNode* activeMRMLPlotViewNode()const;
210  Q_INVOKABLE vtkRenderer* activePlotRenderer()const;
211 
212 
213 public slots:
216  void setEnabled(bool enable);
217 
220  void setMRMLScene(vtkMRMLScene* scene);
221 
224  void setLayout(int newLayout);
225 
228  void setLayoutNumberOfCompareViewRows(int num);
229  void setLayoutNumberOfCompareViewColumns(int num);
230 
233  void resetThreeDViews();
234 
237  void resetSliceViews();
238 
239 signals:
240  void activeMRMLThreeDViewNodeChanged(vtkMRMLViewNode * newActiveMRMLThreeDViewNode);
241  void activeMRMLChartViewNodeChanged(vtkMRMLChartViewNode * newActiveMRMLChartViewNode);
242  void activeMRMLTableViewNodeChanged(vtkMRMLTableViewNode * newActiveMRMLChartViewNode);
243  void activeMRMLPlotViewNodeChanged(vtkMRMLPlotViewNode * newActiveMRMLPlotViewNode);
244  void activeThreeDRendererChanged(vtkRenderer* newRenderer);
245  void activeChartRendererChanged(vtkRenderer* newRenderer);
246  void activeTableRendererChanged(vtkRenderer* newRenderer);
247  void activePlotRendererChanged(vtkRenderer* newRenderer);
248  void layoutChanged(int);
249 
251  void nodeAboutToBeEdited(vtkMRMLNode* node);
252 
253 protected:
254  QScopedPointer<qMRMLLayoutManagerPrivate> d_ptr;
255  qMRMLLayoutManager(qMRMLLayoutManagerPrivate* obj, QWidget* viewport, QObject* parent);
256 
257  virtual void onViewportChanged();
258 
259  using ctkLayoutManager::setLayout;
260 private:
261  Q_DECLARE_PRIVATE(qMRMLLayoutManager);
262  Q_DISABLE_COPY(qMRMLLayoutManager);
263 };
264 
265 #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:54
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:135