Slicer 5.8
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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
33class vtkMRMLNode;
35class vtkMatrix4x4;
37class qMRMLTransformSlidersPrivate;
38
39class QMRML_WIDGETS_EXPORT qMRMLTransformSliders : public qMRMLWidget
40{
41 Q_OBJECT
42 QVTK_OBJECT
43 Q_PROPERTY(QString Title READ title WRITE setTitle)
44 Q_PROPERTY(CoordinateReferenceType CoordinateReference READ coordinateReference WRITE setCoordinateReference)
46 Q_PROPERTY(TransformType TypeOfTransform READ typeOfTransform WRITE setTypeOfTransform)
47 Q_ENUMS(TransformType)
48 Q_PROPERTY(QString LRLabel READ lrLabel WRITE setLRLabel)
49 Q_PROPERTY(QString PALabel READ paLabel WRITE setPALabel)
50 Q_PROPERTY(QString ISLabel READ isLabel WRITE setISLabel)
51 Q_PROPERTY(double SingleStep READ singleStep WRITE setSingleStep)
52
53 Q_PROPERTY(int decimals READ decimals WRITE setDecimals NOTIFY decimalsChanged)
54 Q_PROPERTY(double minimum READ minimum WRITE setMinimum)
55 Q_PROPERTY(double maximum READ maximum WRITE setMaximum)
56 Q_PROPERTY(bool minMaxVisible READ isMinMaxVisible WRITE setMinMaxVisible)
57
58public:
61 explicit qMRMLTransformSliders(QWidget* parent);
63
67 enum CoordinateReferenceType { GLOBAL, LOCAL };
70
74 enum TransformType { ROTATION, TRANSLATION };
75 void setTypeOfTransform(TransformType typeOfTransform);
77
80 void setTitle(const QString& title);
81 QString title()const;
82
85 int decimals()const;
86
89 double minimum()const;
90 double maximum()const;
91
94 void setMinimum(double min);
95 void setMaximum(double max);
98 Q_INVOKABLE void setRange(double min, double max);
99
104 void setMinMaxVisible(bool visible);
105 bool isMinMaxVisible()const;
106
109 double singleStep()const;
110 void setSingleStep(double step);
111
114 QString lrLabel()const;
115 QString paLabel()const;
116 QString isLabel()const;
117 void setLRLabel(const QString& label);
118 void setPALabel(const QString& label);
119 void setISLabel(const QString& label);
120
124
125signals:
129
131 void rangeChanged(double newMinimum, double newMaximum);
132
135 void decimalsChanged(int newDecimals);
136
137public slots:
142
146 void reset();
147
153
156 void setDecimals(int newDecimals);
157
158protected slots:
159 void onLRSliderPositionChanged(double position);
160 void onPASliderPositionChanged(double position);
161 void onISSliderPositionChanged(double position);
162
163 void onMinimumChanged(double min);
164 void onMaximumChanged(double max);
165
168 void onMRMLTransformNodeModified(vtkObject* caller);
169
170protected:
171 QScopedPointer<qMRMLTransformSlidersPrivate> d_ptr;
172
174
179
185 static QPair<double, double> extractMinMaxTranslationValue(vtkMatrix4x4 * mat,
186 double pad = 0);
187
188private:
189 Q_DECLARE_PRIVATE(qMRMLTransformSliders);
190 Q_DISABLE_COPY(qMRMLTransformSliders);
191};
192
193#endif
void setMRMLTransformNode(vtkMRMLNode *node)
TransformType typeOfTransform() const
double minimum() const
Get sliders range.
void valuesChanged()
Signal sent if at least one of the slider's value is updated.
void decimalsChanged(int newDecimals)
void rangeChanged(double newMinimum, double newMaximum)
Signal sent if the minimum or maximum slider's value is updated.
void setMinimum(double min)
Set sliders range.
void setTypeOfTransform(TransformType typeOfTransform)
QString lrLabel() const
Get/Set slider's label.
QString isLabel() const
void setISLabel(const QString &label)
void setPALabel(const QString &label)
void onISSliderPositionChanged(double position)
void setMaximum(double max)
void onMinimumChanged(double min)
bool isMinMaxVisible() const
void setMRMLTransformNode(vtkMRMLTransformNode *transformNode)
Set the MRML node of interest.
void onMRMLTransformNodeModified(vtkObject *caller)
Triggered upon MRML node transform modified events.
void onSliderPositionChanged(qMRMLLinearTransformSlider *slider, double position)
void onLRSliderPositionChanged(double position)
void setLRLabel(const QString &label)
void updateRangeFromTransform(vtkMRMLTransformNode *transformNode)
CoordinateReferenceType coordinateReference() const
void onMaximumChanged(double max)
void setSingleStep(double step)
static QPair< double, double > extractMinMaxTranslationValue(vtkMatrix4x4 *mat, double pad=0)
void setTitle(const QString &title)
Set/Get Title of the group box.
QString paLabel() const
QString title() const
void setCoordinateReference(CoordinateReferenceType coordinateReference)
Q_INVOKABLE void setRange(double min, double max)
Utility function that set min/max in once.
void onPASliderPositionChanged(double position)
double maximum() const
double singleStep() const
Set sliders single step.
void setMinMaxVisible(bool visible)
void setDecimals(int newDecimals)
QScopedPointer< qMRMLTransformSlidersPrivate > d_ptr
Q_INVOKABLE vtkMRMLTransformNode * mrmlTransformNode() const
Return the current MRML node of interest.
Base class for any widget that requires a MRML Scene.
Definition qMRMLWidget.h:36
Abstract Superclass for all specific types of MRML nodes.
MRML node for representing a transformation between this node space and a parent node space.