Slicer 5.4
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;
36class qMRMLTransformSlidersPrivate;
37
38class 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
57public:
60 explicit qMRMLTransformSliders(QWidget* parent);
62
66 enum CoordinateReferenceType { GLOBAL, LOCAL };
69
73 enum TransformType { ROTATION, TRANSLATION };
74 void setTypeOfTransform(TransformType typeOfTransform);
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 Q_INVOKABLE 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
123
124signals:
128
130 void rangeChanged(double newMinimum, double newMaximum);
131
134 void decimalsChanged(int newDecimals);
135
136public slots:
141
145 void reset();
146
152
155 void setDecimals(int newDecimals);
156
157protected slots:
158 void onSliderPositionChanged(double position);
159
160 void onMinimumChanged(double min);
161 void onMaximumChanged(double max);
162
165 void onMRMLTransformNodeModified(vtkObject* caller);
166
167protected:
168 QScopedPointer<qMRMLTransformSlidersPrivate> d_ptr;
169
174
180 static QPair<double, double> extractMinMaxTranslationValue(vtkMatrix4x4 * mat,
181 double pad = 0);
182
183private:
184 Q_DECLARE_PRIVATE(qMRMLTransformSliders);
185 Q_DISABLE_COPY(qMRMLTransformSliders);
186};
187
188#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 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 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.
double maximum() const
double singleStep() const
Set sliders single step.
void setMinMaxVisible(bool visible)
void onSliderPositionChanged(double position)
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.