CTK  0.1.0
The Common Toolkit is a community effort to provide support code for medical image analysis, surgical navigation, and related projects.
ctkVisualizationVTKWidgetsPythonQtDecorators.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Library: CTK
4 
5  Copyright (c) Kitware Inc.
6 
7  Licensed under the Apache License, Version 2.0 (the "License");
8  you may not use this file except in compliance with the License.
9  You may obtain a copy of the License at
10 
11  http://www.apache.org/licenses/LICENSE-2.0.txt
12 
13  Unless required by applicable law or agreed to in writing, software
14  distributed under the License is distributed on an "AS IS" BASIS,
15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  See the License for the specific language governing permissions and
17  limitations under the License.
18 
19 =========================================================================*/
20 
21 #ifndef __ctkVisualizationVTKWidgetsPythonQtDecorators_h
22 #define __ctkVisualizationVTKWidgetsPythonQtDecorators_h
23 
24 // PythonQt includes
25 #include <PythonQt.h>
26 
27 // CTK includes
28 #include <ctkVTKChartView.h>
30 
31 // NOTE:
32 //
33 // For decorators it is assumed that the methods will never be called
34 // with the self argument as NULL. The self argument is the first argument
35 // for non-static methods.
36 //
37 
40 {
41  Q_OBJECT
42 public:
43 
45  {
46  }
47 
48 public Q_SLOTS:
49 
50  // ctkVTKChartView
51 #ifdef CTK_USE_CHARTS
52 
53  QList<double> chartExtent(ctkVTKChartView* view)const
54  {
55  double _bounds[8];
56  view->chartExtent(_bounds);
57  QList<double> bounds;
58  for(int idx = 0; idx < 8; ++idx)
59  {
60  bounds << _bounds[idx];
61  }
62  return bounds;
63  }
64 
65  QList<double> chartBounds(ctkVTKChartView* view)const
66  {
67  double _bounds[8];
68  view->chartBounds(_bounds);
69  QList<double> bounds;
70  for(int idx = 0; idx < 8; ++idx)
71  {
72  bounds << _bounds[idx];
73  }
74  return bounds;
75  }
76 
77  void setChartUserBounds(ctkVTKChartView* view, const QList<double>& bounds)
78  {
79  double _bounds[8];
80  for(int idx = 0; idx < bounds.length() && idx < 8; ++idx)
81  {
82  _bounds[idx] = bounds[idx];
83  }
84  view->setChartUserBounds(_bounds);
85  }
86 
87  QList<double> chartUserBounds(ctkVTKChartView* view)const
88  {
89  double _bounds[8];
90  view->chartUserBounds(_bounds);
91  QList<double> bounds;
92  for(int idx = 0; idx < 8; ++idx)
93  {
94  bounds << _bounds[idx];
95  }
96  return bounds;
97  }
98 
99  // ctkVTKScalarsToColorsView
100 
101  QList<double> validBounds(ctkVTKScalarsToColorsView* view)const
102  {
103  double _bounds[4];
104  view->validBounds(_bounds);
105  QList<double> bounds;
106  for(int idx = 0; idx < 4; ++idx)
107  {
108  bounds << _bounds[idx];
109  }
110  return bounds;
111  }
112 
113  void setValidBounds(ctkVTKScalarsToColorsView* view, const QList<double>& bounds)
114  {
115  double _bounds[4];
116  for(int idx = 0; idx < bounds.length() && idx < 4; ++idx)
117  {
118  _bounds[idx] = bounds[idx];
119  }
120  view->setValidBounds(_bounds);
121  }
122 #endif
123 
124 };
125 
126 //-----------------------------------------------------------------------------
129 {
130  PythonQt::self()->addDecorators(new ctkVisualizationVTKWidgetsPythonQtDecorators);
131 }
132 
133 #endif
void chartBounds(double bounds[8]) const
void setChartUserBounds(double *bounds)
void chartExtent(double bounds[8]) const
void chartUserBounds(double *bounds) const
void setValidBounds(double bounds[4])
void validBounds(double bounds[4]) const
void initCTKVisualizationVTKWidgetsPythonQtDecorators()