Medical Imaging Interaction Toolkit
2016.11.0
Medical Imaging Interaction Toolkit
Home
Manual
API Reference
Download
Bugzilla
Groups
Namespace List
Class List
File List
Examples
File List
File Members
QmitkPrimitiveMovieNavigatorWidget.cpp
Go to the documentation of this file.
1
/*===================================================================
2
3
The Medical Imaging Interaction Toolkit (MITK)
4
5
Copyright (c) German Cancer Research Center,
6
Division of Medical and Biological Informatics.
7
All rights reserved.
8
9
This software is distributed WITHOUT ANY WARRANTY; without
10
even the implied warranty of MERCHANTABILITY or FITNESS FOR
11
A PARTICULAR PURPOSE.
12
13
See LICENSE.txt or http://www.mitk.org for details.
14
15
===================================================================*/
16
17
#include "
QmitkPrimitiveMovieNavigatorWidget.h
"
18
19
QmitkPrimitiveMovieNavigatorWidget::QmitkPrimitiveMovieNavigatorWidget
(QWidget *parent, Qt::WindowFlags fl)
20
: QWidget(parent, fl)
21
{
22
m_Controls
.setupUi(
this
);
23
24
// signals and slots connections
25
connect(
m_Controls
.m_SpinBox, SIGNAL(valueChanged(
int
)),
this
, SLOT(
spinBoxValueChanged
(
int
)));
26
connect(
m_Controls
.m_StopButton, SIGNAL(clicked()),
this
, SLOT(
stopButton_clicked
()));
27
connect(
m_Controls
.m_GoButton, SIGNAL(clicked()),
this
, SLOT(
goButton_clicked
()));
28
connect(
m_Controls
.m_TimerInterval, SIGNAL(valueChanged(
int
)),
this
, SLOT(
setTimerInterval
(
int
)));
29
30
m_InRefetch
=
true
;
// this avoids trying to use m_Stepper until it is set to something != NULL (additionally to the
31
// avoiding recursions during refetching)
32
m_Timer
=
new
QTimer(
this
);
33
m_TimerIntervalInMS
= 120;
34
connect(
m_Timer
, SIGNAL(timeout()), SLOT(next()));
35
}
36
37
/*
38
* Destroys the object and frees any allocated resources
39
*/
40
QmitkPrimitiveMovieNavigatorWidget::~QmitkPrimitiveMovieNavigatorWidget
()
41
{
42
// no need to delete child widgets, Qt does it all for us
43
}
44
45
void
QmitkPrimitiveMovieNavigatorWidget::Refetch
()
46
{
47
if
(!
m_InRefetch
)
48
{
49
m_InRefetch
=
true
;
50
m_Controls
.m_SpinBox->setMinimum(0);
51
m_Controls
.m_SpinBox->setMaximum(
m_Stepper
->GetSteps() - 1);
52
m_Controls
.m_SpinBox->setValue(
m_Stepper
->GetPos());
53
m_InRefetch
=
false
;
54
}
55
}
56
57
void
QmitkPrimitiveMovieNavigatorWidget::SetStepper
(
mitk::Stepper
*stepper)
58
{
59
m_Stepper
= stepper;
60
m_InRefetch
= (stepper ==
nullptr
);
// this avoids trying to use m_Stepper until it is set to something != NULL
61
// (additionally to the avoiding recursions during refetching)
62
}
63
64
void
QmitkPrimitiveMovieNavigatorWidget::goButton_clicked
()
65
{
66
if
(!
m_InRefetch
&&
67
m_Stepper
->GetSteps() >
68
0)
// this step shall only be used if the dataset is 3D+t. If it is not, nothing happens :-)
69
{
70
if
(
m_Timer
->isActive() ==
false
)
71
{
72
m_Timer
->start(
m_TimerIntervalInMS
);
73
}
74
}
75
}
76
77
void
QmitkPrimitiveMovieNavigatorWidget::stopButton_clicked
()
78
{
79
m_Timer
->stop();
80
}
81
82
void
QmitkPrimitiveMovieNavigatorWidget::next()
83
{
84
if
(!
m_InRefetch
)
85
{
86
if
(
m_Stepper
->GetPos() ==
m_Stepper
->GetSteps() - 1)
87
m_Stepper
->First();
88
else
89
m_Stepper
->Next();
90
}
91
}
92
93
void
QmitkPrimitiveMovieNavigatorWidget::spinBoxValueChanged
(
int
)
94
{
95
if
(!
m_InRefetch
)
96
{
97
m_Stepper
->SetPos(
m_Controls
.m_SpinBox->value());
98
}
99
}
100
101
int
QmitkPrimitiveMovieNavigatorWidget::getTimerInterval
()
102
{
103
return
m_TimerIntervalInMS
;
104
}
105
106
void
QmitkPrimitiveMovieNavigatorWidget::setTimerInterval
(
int
timerIntervalInMS)
107
{
108
if
(timerIntervalInMS !=
m_TimerIntervalInMS
)
109
{
110
m_TimerIntervalInMS
= timerIntervalInMS;
111
if
(
m_Timer
->isActive())
112
{
113
m_Timer
->setInterval(
m_TimerIntervalInMS
);
114
}
115
}
116
}
QmitkPrimitiveMovieNavigatorWidget::m_Stepper
mitk::Stepper::Pointer m_Stepper
Definition:
QmitkPrimitiveMovieNavigatorWidget.h:45
QmitkPrimitiveMovieNavigatorWidget::m_Controls
Ui::QmitkPrimitiveMovieNavigator m_Controls
Definition:
QmitkPrimitiveMovieNavigatorWidget.h:44
QmitkPrimitiveMovieNavigatorWidget::m_TimerIntervalInMS
int m_TimerIntervalInMS
Definition:
QmitkPrimitiveMovieNavigatorWidget.h:48
QmitkPrimitiveMovieNavigatorWidget::setTimerInterval
virtual void setTimerInterval(int timerIntervalInMS)
Definition:
QmitkPrimitiveMovieNavigatorWidget.cpp:106
QmitkPrimitiveMovieNavigatorWidget::spinBoxValueChanged
virtual void spinBoxValueChanged(int value)
Definition:
QmitkPrimitiveMovieNavigatorWidget.cpp:93
QmitkPrimitiveMovieNavigatorWidget::Refetch
virtual void Refetch()
Definition:
QmitkPrimitiveMovieNavigatorWidget.cpp:45
QmitkPrimitiveMovieNavigatorWidget::getTimerInterval
virtual int getTimerInterval()
Definition:
QmitkPrimitiveMovieNavigatorWidget.cpp:101
QmitkPrimitiveMovieNavigatorWidget::QmitkPrimitiveMovieNavigatorWidget
QmitkPrimitiveMovieNavigatorWidget(QWidget *parent=nullptr, Qt::WindowFlags fl=nullptr)
Definition:
QmitkPrimitiveMovieNavigatorWidget.cpp:19
mitk::Stepper
Helper class to step through a list.
Definition:
mitkStepper.h:51
QmitkPrimitiveMovieNavigatorWidget::~QmitkPrimitiveMovieNavigatorWidget
~QmitkPrimitiveMovieNavigatorWidget()
Definition:
QmitkPrimitiveMovieNavigatorWidget.cpp:40
QmitkPrimitiveMovieNavigatorWidget::m_InRefetch
bool m_InRefetch
Definition:
QmitkPrimitiveMovieNavigatorWidget.h:46
QmitkPrimitiveMovieNavigatorWidget::goButton_clicked
virtual void goButton_clicked()
Definition:
QmitkPrimitiveMovieNavigatorWidget.cpp:64
QmitkPrimitiveMovieNavigatorWidget::SetStepper
virtual void SetStepper(mitk::Stepper *stepper)
Definition:
QmitkPrimitiveMovieNavigatorWidget.cpp:57
QmitkPrimitiveMovieNavigatorWidget.h
QmitkPrimitiveMovieNavigatorWidget::m_Timer
QTimer * m_Timer
Definition:
QmitkPrimitiveMovieNavigatorWidget.h:47
QmitkPrimitiveMovieNavigatorWidget::stopButton_clicked
virtual void stopButton_clicked()
Definition:
QmitkPrimitiveMovieNavigatorWidget.cpp:77
git
MITK
Modules
QtWidgetsExt
src
QmitkPrimitiveMovieNavigatorWidget.cpp
Generated on Fri Feb 3 2017 20:52:14 for Medical Imaging Interaction Toolkit by
1.8.9.1