Slicer  4.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLUtils.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 Jean-Christophe Fillion-Robin, Kitware Inc.
17  and was partially funded by NIH grant 3P41RR013218-12S1
18 
19 ==============================================================================*/
20 
21 #ifndef __qMRMLUtils_h
22 #define __qMRMLUtils_h
23 
25 #include <QString>
26 #include <QVector>
27 #include <QIcon>
28 #include <QPixmap>
29 
30 #include "qMRMLWidgetsExport.h"
31 
32 class QStyle;
33 class vtkMRMLNode;
35 class vtkTransform;
36 class vtkMatrix4x4;
37 class vtkMRMLScene;
38 class vtkImageData;
39 
40 #define compare_double(x, y) (((x-y)<0.000001) && ((x-y)>-0.000001))
41 
42 class QMRML_WIDGETS_EXPORT qMRMLUtils : public QObject
43 {
44  Q_OBJECT;
45 public:
46  typedef qMRMLUtils Self;
47  qMRMLUtils(QObject* parent = 0);
48  virtual ~qMRMLUtils();
49 
52  Q_INVOKABLE static void vtkMatrixToQVector(vtkMatrix4x4* matrix, QVector<double> & vector);
53 
55  Q_INVOKABLE static void getTransformInCoordinateSystem(vtkMRMLNode* transformNode, bool global,
56  vtkTransform* transform);
57  Q_INVOKABLE static void getTransformInCoordinateSystem(vtkMRMLTransformNode* transformNode,
58  bool global, vtkTransform* transform);
59 
61  Q_INVOKABLE static int countVisibleViewNode(vtkMRMLScene* scene);
62 
64  Q_INVOKABLE static QPixmap createColorPixmap(QStyle * style, const QColor& color);
65 
67  Q_INVOKABLE static bool vtkImageDataToQImage(vtkImageData* vtkimage, QImage& img);
68 
70  Q_INVOKABLE static bool qImageToVtkImageData(const QImage& img, vtkImageData* vtkimage);
71 
73  Q_INVOKABLE static void colorToQColor(const double *color, QColor &qcolor);
74 
76  Q_INVOKABLE static void qColorToColor(const QColor &qcolor, double* color);
77 
78 private:
79  Q_DISABLE_COPY(qMRMLUtils);
80 
81 };
82 
83 #endif
MRML node for representing a transformation between this node space and a parent node space...
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
qMRMLUtils Self
Definition: qMRMLUtils.h:44
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135