Slicer  5.0
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 "vtkIdList.h"
31 #include "qMRMLWidgetsExport.h"
32 
33 class QMimeData;
34 class QStyle;
35 class vtkMRMLNode;
37 class vtkTransform;
38 class vtkMatrix4x4;
39 class vtkMRMLScene;
40 class vtkImageData;
41 
42 #define compare_double(x, y) (((x-y)<0.000001) && ((x-y)>-0.000001))
43 
44 class QMRML_WIDGETS_EXPORT qMRMLUtils : public QObject
45 {
46  Q_OBJECT;
47 public:
48  typedef qMRMLUtils Self;
49  qMRMLUtils(QObject* parent = nullptr);
50  ~qMRMLUtils() override;
51 
54  Q_INVOKABLE static void vtkMatrixToQVector(vtkMatrix4x4* matrix, QVector<double> & vector);
55 
57  Q_INVOKABLE static void getTransformInCoordinateSystem(vtkMRMLNode* transformNode, bool global,
58  vtkTransform* transform);
59  Q_INVOKABLE static void getTransformInCoordinateSystem(vtkMRMLTransformNode* transformNode,
60  bool global, vtkTransform* transform);
61 
63  Q_INVOKABLE static int countVisibleViewNode(vtkMRMLScene* scene);
64 
66  Q_INVOKABLE static QPixmap createColorPixmap(QStyle * style, const QColor& color);
67 
69  Q_INVOKABLE static bool vtkImageDataToQImage(vtkImageData* vtkimage, QImage& img);
70 
72  Q_INVOKABLE static bool qImageToVtkImageData(const QImage& img, vtkImageData* vtkimage);
73 
75  Q_INVOKABLE static void colorToQColor(const double *color, QColor &qcolor);
76 
78  Q_INVOKABLE static void qColorToColor(const QColor &qcolor, double* color);
79 
80  Q_INVOKABLE static void mimeDataToSubjectHierarchyItemIDs(const QMimeData* mimeData, vtkIdList* idList);
81 
82 private:
83  Q_DISABLE_COPY(qMRMLUtils);
84 
85 };
86 
87 #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:57
qMRMLUtils Self
Definition: qMRMLUtils.h:46
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167