Slicer  5.1
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
qMRMLTransformSliders.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 __qMRMLTransformSliders_h
22 #define __qMRMLTransformSliders_h
23 
24 // Qt includes
25 #include <QPair>
26 
27 // CTK includes
28 #include <ctkVTKObject.h>
29 
30 // MRML includes
31 #include "qMRMLWidget.h"
32 
33 class vtkMRMLNode;
35 class vtkMatrix4x4;
36 class qMRMLTransformSlidersPrivate;
37 
38 class QMRML_WIDGETS_EXPORT qMRMLTransformSliders : public qMRMLWidget
39 {
40  Q_OBJECT
41  QVTK_OBJECT
42  Q_PROPERTY(QString Title READ title WRITE setTitle)
43  Q_PROPERTY(CoordinateReferenceType CoordinateReference READ coordinateReference WRITE setCoordinateReference)
45  Q_PROPERTY(TransformType TypeOfTransform READ typeOfTransform WRITE setTypeOfTransform)
46  Q_ENUMS(TransformType)
47  Q_PROPERTY(QString LRLabel READ lrLabel WRITE setLRLabel)
48  Q_PROPERTY(QString PALabel READ paLabel WRITE setPALabel)
49  Q_PROPERTY(QString ISLabel READ isLabel WRITE setISLabel)
50  Q_PROPERTY(double SingleStep READ singleStep WRITE setSingleStep)
51 
52  Q_PROPERTY(int decimals READ decimals WRITE setDecimals NOTIFY decimalsChanged)
53  Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
54  Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
55  Q_PROPERTY(bool minMaxVisible READ isMinMaxVisible WRITE setMinMaxVisible)
56 
57 public:
60  explicit qMRMLTransformSliders(QWidget* parent);
61  ~qMRMLTransformSliders() override;
62 
66  enum CoordinateReferenceType { GLOBAL, LOCAL };
67  void setCoordinateReference(CoordinateReferenceType coordinateReference);
68  CoordinateReferenceType coordinateReference() const;
69 
73  enum TransformType { ROTATION, TRANSLATION };
74  void setTypeOfTransform(TransformType typeOfTransform);
75  TransformType typeOfTransform() const;
76 
79  void setTitle(const QString& title);
80  QString title()const;
81 
84  int decimals()const;
85 
88  double minimum()const;
89  double maximum()const;
90 
93  void setMinimum(double min);
94  void setMaximum(double max);
97  void setRange(double min, double max);
98 
103  void setMinMaxVisible(bool visible);
104  bool isMinMaxVisible()const;
105 
108  double singleStep()const;
109  void setSingleStep(double step);
110 
113  QString lrLabel()const;
114  QString paLabel()const;
115  QString isLabel()const;
116  void setLRLabel(const QString& label);
117  void setPALabel(const QString& label);
118  void setISLabel(const QString& label);
119 
122  vtkMRMLTransformNode* mrmlTransformNode()const;
123 
124 signals:
127  void valuesChanged();
128 
130  void rangeChanged(double newMinimum, double newMaximum);
131 
134  void decimalsChanged(int newDecimals);
135 
136 public slots:
139  void setMRMLTransformNode(vtkMRMLTransformNode* transformNode);
140  void setMRMLTransformNode(vtkMRMLNode* node);
141 
145  void reset();
146 
151  void resetUnactiveSliders();
152 
155  void setDecimals(int newDecimals);
156 
157 protected slots:
158  void onSliderPositionChanged(double position);
159 
160  void onMinimumChanged(double min);
161  void onMaximumChanged(double max);
162 
165  void onMRMLTransformNodeModified(vtkObject* caller);
166 
167 protected:
168  QScopedPointer<qMRMLTransformSlidersPrivate> d_ptr;
169 
173  void updateRangeFromTransform(vtkMRMLTransformNode* transformNode);
174 
180  static QPair<double, double> extractMinMaxTranslationValue(vtkMatrix4x4 * mat,
181  double pad = 0);
182 
183 private:
184  Q_DECLARE_PRIVATE(qMRMLTransformSliders);
185  Q_DISABLE_COPY(qMRMLTransformSliders);
186 };
187 
188 #endif
MRML node for representing a transformation between this node space and a parent node space...
QScopedPointer< qMRMLTransformSlidersPrivate > d_ptr
Base class for any widget that requires a MRML Scene.
Definition: qMRMLWidget.h:35
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167