diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/index.theme b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/index.theme
index 4a3ff343c3..25c2b08bec 100644
--- a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/index.theme
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/index.theme
@@ -1,25 +1,46 @@
[Icon Theme]
Name=tango
Comment=An icon theme following the tango style guide
Directories=scalable/actions scalable/status scalable/places
[scalable/actions]
Size=48
Type=Scalable
MinSize=1
MaxSize=256
Context=Actions
+[scalable/categories]
+Size=48
+Type=Scalable
+MinSize=1
+MaxSize=256
+Context=Categories
+
+[scalable/devices]
+Size=48
+Type=Scalable
+MinSize=1
+MaxSize=256
+Context=Devices
+
+[scalable/mimetypes]
+Size=48
+Type=Scalable
+MinSize=1
+MaxSize=256
+Context=MimeTypes
+
[scalable/status]
Size=48
Type=Scalable
MinSize=1
MaxSize=256
Context=Status
[scalable/places]
Size=48
Type=Scalable
MinSize=1
MaxSize=256
Context=Places
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/list-add.svg b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/list-add.svg
new file mode 100644
index 0000000000..6eaed44811
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/list-add.svg
@@ -0,0 +1,436 @@
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/list-remove.svg b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/list-remove.svg
new file mode 100644
index 0000000000..5f109a05c3
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/list-remove.svg
@@ -0,0 +1,424 @@
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-playback-pause.svg b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-playback-pause.svg
new file mode 100644
index 0000000000..8a434cabb1
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-playback-pause.svg
@@ -0,0 +1,641 @@
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-playback-start.svg b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-playback-start.svg
new file mode 100644
index 0000000000..75616de46f
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-playback-start.svg
@@ -0,0 +1,319 @@
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-playback-stop.svg b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-playback-stop.svg
new file mode 100644
index 0000000000..24bbfb52e5
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-playback-stop.svg
@@ -0,0 +1,651 @@
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-record.svg b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-record.svg
new file mode 100644
index 0000000000..85bbb98f6e
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-record.svg
@@ -0,0 +1,337 @@
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-seek-backward.svg b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-seek-backward.svg
new file mode 100644
index 0000000000..75f49f1a82
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-seek-backward.svg
@@ -0,0 +1,374 @@
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-seek-forward.svg b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-seek-forward.svg
new file mode 100644
index 0000000000..b1b9fe950b
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-seek-forward.svg
@@ -0,0 +1,383 @@
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-skip-backward.svg b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-skip-backward.svg
new file mode 100644
index 0000000000..fccd7762cd
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-skip-backward.svg
@@ -0,0 +1,1025 @@
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-skip-forward.svg b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-skip-forward.svg
new file mode 100644
index 0000000000..7c4d40054b
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/actions/media-skip-forward.svg
@@ -0,0 +1,1013 @@
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/categories/applications-multimedia.svg b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/categories/applications-multimedia.svg
new file mode 100644
index 0000000000..6844e8db1a
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/categories/applications-multimedia.svg
@@ -0,0 +1,498 @@
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/devices/camera-photo.svg b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/devices/camera-photo.svg
new file mode 100644
index 0000000000..4911410136
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/devices/camera-photo.svg
@@ -0,0 +1,681 @@
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/devices/camera-video.svg b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/devices/camera-video.svg
new file mode 100644
index 0000000000..e24713457f
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/devices/camera-video.svg
@@ -0,0 +1,1257 @@
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/mimetypes/image-x-generic.svg b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/mimetypes/image-x-generic.svg
new file mode 100644
index 0000000000..45dd641ae7
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/mimetypes/image-x-generic.svg
@@ -0,0 +1,581 @@
+
+
+
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/mimetypes/video-x-generic.svg b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/mimetypes/video-x-generic.svg
new file mode 100644
index 0000000000..1f3a8b95a8
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.ext/resources/icons/tango/scalable/mimetypes/video-x-generic.svg
@@ -0,0 +1,319 @@
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.ext/resources/org_mitk_icons.qrc b/Plugins/org.mitk.gui.qt.ext/resources/org_mitk_icons.qrc
index 56315b325f..08f6548161 100644
--- a/Plugins/org.mitk.gui.qt.ext/resources/org_mitk_icons.qrc
+++ b/Plugins/org.mitk.gui.qt.ext/resources/org_mitk_icons.qrc
@@ -1,51 +1,67 @@
icons/awesome/index.theme
icons/awesome/scalable/actions/document-open.svg
icons/awesome/scalable/actions/document-print.svg
icons/awesome/scalable/actions/document-save.svg
icons/awesome/scalable/actions/edit-delete.svg
icons/awesome/scalable/actions/edit-redo.svg
icons/awesome/scalable/actions/edit-undo.svg
icons/awesome/scalable/actions/go-down.svg
icons/awesome/scalable/actions/go-home.svg
icons/awesome/scalable/actions/go-next.svg
icons/awesome/scalable/actions/go-previous.svg
icons/awesome/scalable/actions/go-up.svg
icons/awesome/scalable/actions/system-log-out.svg
icons/awesome/scalable/actions/view-list-details.svg
icons/awesome/scalable/actions/view-list-icons.svg
icons/awesome/scalable/actions/view-refresh.svg
icons/awesome/scalable/places/folder.svg
icons/awesome/scalable/status/dialog-error.svg
icons/awesome/scalable/status/dialog-information.svg
icons/awesome/scalable/status/dialog-question.svg
icons/awesome/scalable/status/dialog-warning.svg
icons/tango/index.theme
icons/tango/scalable/actions/document-open.svg
icons/tango/scalable/actions/document-print.svg
icons/tango/scalable/actions/document-save.svg
icons/tango/scalable/actions/edit-delete.svg
icons/tango/scalable/actions/edit-redo.svg
icons/tango/scalable/actions/edit-undo.svg
icons/tango/scalable/actions/go-bottom.svg
icons/tango/scalable/actions/go-down.svg
icons/tango/scalable/actions/go-first.svg
icons/tango/scalable/actions/go-home.svg
icons/tango/scalable/actions/go-last.svg
icons/tango/scalable/actions/go-next.svg
icons/tango/scalable/actions/go-previous.svg
icons/tango/scalable/actions/go-top.svg
icons/tango/scalable/actions/go-up.svg
icons/tango/scalable/actions/system-log-out.svg
icons/tango/scalable/actions/view-list-details.svg
icons/tango/scalable/actions/view-list-icons.svg
icons/tango/scalable/actions/view-refresh.svg
+ icons/tango/scalable/actions/list-add.svg
+ icons/tango/scalable/actions/list-remove.svg
+ icons/tango/scalable/actions/media-playback-pause.svg
+ icons/tango/scalable/actions/media-playback-start.svg
+ icons/tango/scalable/actions/media-playback-stop.svg
+ icons/tango/scalable/actions/media-record.svg
+ icons/tango/scalable/actions/media-seek-backward.svg
+ icons/tango/scalable/actions/media-seek-forward.svg
+ icons/tango/scalable/actions/media-skip-backward.svg
+ icons/tango/scalable/actions/media-skip-forward.svg
+ icons/tango/scalable/actions/system-log-out.svg
+ icons/tango/scalable/categories/applications-multimedia.svg
+ icons/tango/scalable/devices/camera-photo.svg
+ icons/tango/scalable/devices/camera-video.svg
+ icons/tango/scalable/mimetypes/image-x-generic.svg
+ icons/tango/scalable/mimetypes/video-x-generic.svg
icons/tango/scalable/places/folder.svg
icons/tango/scalable/places/folder-remote.svg
icons/tango/scalable/status/dialog-error.svg
icons/tango/scalable/status/dialog-information.svg
icons/tango/scalable/status/dialog-question.svg
icons/tango/scalable/status/dialog-warning.svg
diff --git a/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkExternalProgramsPreferencePage.cpp b/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkExternalProgramsPreferencePage.cpp
index af8e485885..6e1f622a3c 100644
--- a/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkExternalProgramsPreferencePage.cpp
+++ b/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkExternalProgramsPreferencePage.cpp
@@ -1,136 +1,190 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include
#include
#include
#include
#include
#include
#include
#include
#include "QmitkExternalProgramsPreferencePage.h"
static berry::IPreferences::Pointer GetPreferences()
{
berry::IPreferencesService::Pointer preferencesService =
berry::Platform::GetServiceRegistry().GetServiceById(berry::IPreferencesService::ID);
if (preferencesService.IsNotNull())
{
berry::IPreferences::Pointer systemPreferences = preferencesService->GetSystemPreferences();
if (systemPreferences.IsNotNull())
return systemPreferences->Node("/org.mitk.gui.qt.ext.externalprograms");
}
mitkThrow();
}
QmitkExternalProgramsPreferencePage::QmitkExternalProgramsPreferencePage()
: m_Preferences(GetPreferences()),
m_Ui(new Ui::QmitkExternalProgramsPreferencePage),
m_Control(NULL),
+ m_FFmpegProcess(NULL),
m_GnuplotProcess(NULL)
{
}
QmitkExternalProgramsPreferencePage::~QmitkExternalProgramsPreferencePage()
{
}
void QmitkExternalProgramsPreferencePage::CreateQtControl(QWidget* parent)
{
m_Control = new QWidget(parent);
+ m_FFmpegProcess = new QProcess(m_Control);
m_GnuplotProcess = new QProcess(m_Control);
m_Ui->setupUi(m_Control);
+ connect(m_FFmpegProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(OnFFmpegProcessError(QProcess::ProcessError)));
+ connect(m_FFmpegProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(OnFFmpegProcessFinished(int, QProcess::ExitStatus)));
+ connect(m_Ui->ffmpegButton, SIGNAL(clicked()), this, SLOT(OnFFmpegButtonClicked()));
+
connect(m_GnuplotProcess, SIGNAL(error(QProcess::ProcessError)), this, SLOT(OnGnuplotProcessError(QProcess::ProcessError)));
connect(m_GnuplotProcess, SIGNAL(finished(int, QProcess::ExitStatus)), this, SLOT(OnGnuplotProcessFinished(int, QProcess::ExitStatus)));
connect(m_Ui->gnuplotButton, SIGNAL(clicked()), this, SLOT(OnGnuplotButtonClicked()));
this->Update();
}
+void QmitkExternalProgramsPreferencePage::OnFFmpegButtonClicked()
+{
+ QString filter = "ffmpeg/avconv executable ";
+
+#if defined(WIN32)
+ filter += "(ffmpeg.exe avconv.exe)";
+#else
+ filter += "(ffmpeg avconv)";
+#endif
+
+ QString ffmpegPath = QFileDialog::getOpenFileName(m_Control, "FFmpeg/Libav", "", filter);
+
+ if (!ffmpegPath.isEmpty())
+ {
+ m_FFmpegPath = ffmpegPath;
+ m_FFmpegProcess->start(ffmpegPath, QStringList() << "-version", QProcess::ReadOnly);
+ }
+}
+
+void QmitkExternalProgramsPreferencePage::OnFFmpegProcessError(QProcess::ProcessError)
+{
+ m_FFmpegPath.clear();
+ m_Ui->ffmpegLineEdit->clear();
+}
+
+void QmitkExternalProgramsPreferencePage::OnFFmpegProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
+{
+ if (exitStatus == QProcess::NormalExit && exitCode == 0)
+ {
+ QString output = QTextCodec::codecForName("UTF-8")->toUnicode(m_FFmpegProcess->readAllStandardOutput());
+
+ if (output.startsWith("ffmpeg") || output.startsWith("avconv"))
+ {
+ m_Ui->ffmpegLineEdit->setText(m_FFmpegPath);
+ return;
+ }
+ }
+
+ m_FFmpegPath.clear();
+ m_Ui->ffmpegLineEdit->clear();
+}
+
void QmitkExternalProgramsPreferencePage::OnGnuplotButtonClicked()
{
- QString filter = "Gnuplot executable ";
+ QString filter = "gnuplot executable ";
#if defined(WIN32)
filter += "(gnuplot.exe)";
#else
filter += "(gnuplot)";
#endif
QString gnuplotPath = QFileDialog::getOpenFileName(m_Control, "Gnuplot", "", filter);
if (!gnuplotPath.isEmpty())
{
m_GnuplotPath = gnuplotPath;
m_GnuplotProcess->start(gnuplotPath, QStringList() << "--version", QProcess::ReadOnly);
}
}
void QmitkExternalProgramsPreferencePage::OnGnuplotProcessError(QProcess::ProcessError)
{
m_GnuplotPath.clear();
m_Ui->gnuplotLineEdit->clear();
}
void QmitkExternalProgramsPreferencePage::OnGnuplotProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
{
if (exitStatus == QProcess::NormalExit && exitCode == 0)
{
- QString version = QTextCodec::codecForName("UTF-8")->toUnicode(m_GnuplotProcess->readAllStandardOutput()).trimmed();
+ QString output = QTextCodec::codecForName("UTF-8")->toUnicode(m_GnuplotProcess->readAllStandardOutput());
- if (version.startsWith("gnuplot"))
+ if (output.startsWith("gnuplot"))
{
- m_Ui->gnuplotLineEdit->setText(QString("%1 (%2)").arg(m_GnuplotPath).arg(version.trimmed()));
+ m_Ui->gnuplotLineEdit->setText(m_GnuplotPath);
return;
}
}
m_GnuplotPath.clear();
m_Ui->gnuplotLineEdit->clear();
}
QWidget* QmitkExternalProgramsPreferencePage::GetQtControl() const
{
return m_Control;
}
void QmitkExternalProgramsPreferencePage::Init(berry::IWorkbench::Pointer)
{
}
void QmitkExternalProgramsPreferencePage::PerformCancel()
{
}
bool QmitkExternalProgramsPreferencePage::PerformOk()
{
+ m_Preferences->Put("ffmpeg", m_FFmpegPath.toStdString());
m_Preferences->Put("gnuplot", m_GnuplotPath.toStdString());
return true;
}
void QmitkExternalProgramsPreferencePage::Update()
{
+ m_FFmpegPath = QString::fromStdString(m_Preferences->Get("ffmpeg", ""));
+
+ if (!m_FFmpegPath.isEmpty())
+ m_FFmpegProcess->start(m_FFmpegPath, QStringList() << "-version", QProcess::ReadOnly);
+
m_GnuplotPath = QString::fromStdString(m_Preferences->Get("gnuplot", ""));
if (!m_GnuplotPath.isEmpty())
m_GnuplotProcess->start(m_GnuplotPath, QStringList() << "--version", QProcess::ReadOnly);
}
diff --git a/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkExternalProgramsPreferencePage.h b/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkExternalProgramsPreferencePage.h
index e766b3b400..fb4da45609 100644
--- a/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkExternalProgramsPreferencePage.h
+++ b/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkExternalProgramsPreferencePage.h
@@ -1,59 +1,67 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#ifndef QmitkExternalProgramsPreferencePage_h
#define QmitkExternalProgramsPreferencePage_h
#include
#include
#include
#include
namespace Ui
{
class QmitkExternalProgramsPreferencePage;
}
class QmitkExternalProgramsPreferencePage : public QObject, public berry::IQtPreferencePage
{
Q_OBJECT
Q_INTERFACES(berry::IPreferencePage)
public:
QmitkExternalProgramsPreferencePage();
~QmitkExternalProgramsPreferencePage();
void CreateQtControl(QWidget* parent);
QWidget* GetQtControl() const;
void Init(berry::IWorkbench::Pointer);
void PerformCancel();
bool PerformOk();
void Update();
private slots:
+ void OnFFmpegButtonClicked();
+ void OnFFmpegProcessError(QProcess::ProcessError error);
+ void OnFFmpegProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
+
void OnGnuplotButtonClicked();
void OnGnuplotProcessError(QProcess::ProcessError error);
void OnGnuplotProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
private:
berry::IPreferences::Pointer m_Preferences;
QScopedPointer m_Ui;
QWidget* m_Control;
+
+ QProcess* m_FFmpegProcess;
+ QString m_FFmpegPath;
+
QProcess* m_GnuplotProcess;
QString m_GnuplotPath;
};
#endif
diff --git a/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkExternalProgramsPreferencePage.ui b/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkExternalProgramsPreferencePage.ui
index ace9d303c8..428b27c526 100644
--- a/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkExternalProgramsPreferencePage.ui
+++ b/Plugins/org.mitk.gui.qt.ext/src/internal/QmitkExternalProgramsPreferencePage.ui
@@ -1,65 +1,92 @@
QmitkExternalProgramsPreferencePage
0
0
400
300
External Programs
-
-
-
-
+
+
-
+
+
+ FFmpeg/Libav:
+
+
+ Qt::PlainText
+
+
+ gnuplotButton
+
+
+
+ -
+
+
+ true
+
+
+
+ -
+
+
+ ...
+
+
+
+ -
- Gnuplot &executable:
+ gnuplot:
Qt::PlainText
gnuplotButton
- -
+
-
true
- -
+
-
...
-
Qt::Vertical
20
248
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker.dox b/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker.dox
deleted file mode 100644
index 878627bddb..0000000000
--- a/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker.dox
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
-
-\page org_mitk_views_moviemaker The Movie Maker View
-
-\imageMacro{QmitkMovieMaker_Icon.png,"Icon of the Movie Maker View",2.00}
-
-Available sections:
- - \ref QmitkMovieMakerUserManualOverview
- - \ref QmitkMovieMakerUserManualFeatures
- - \ref QmitkMovieMakerUserManualUsage
-
-\section QmitkMovieMakerUserManualOverview Overview
-
-MovieMaker is a functionality for easily creating fancy movies from scenes displayed in MITK widgets.
-It is also possible to slide through your data, automatically rotate 3D scenes and take screenshots of widgets.
-
-\section QmitkMovieMakerUserManualFeatures Features
-
- The Movie Maker allows you to create movies and screenshots from within MITK. It can automatically scroll thorugh timesteps and slices while recording a movie. This way, you can record visualizations like a beating heart or a rotating skull.
-
-\section QmitkMovieMakerUserManualUsage Usage
-
-\imageMacro{QmitkMovieMaker_ControlArea.png,"A view of the command area of QmitkMovieMaker",9.84}
-
-\subsection QmitkMovieMakerUserManualWindowSelection Window selection
-With the first two drop down boxes, you can choose which window you want to step through and which window you want to record in. Left clicking inside a window will set both drop down boxes to that window, but you can choose different windows for stepping and recording.
-
-The first drop down box defines the window along which slices will be stepped through if stepping is set to spatial (see below). The second denotes the window from which the content will be recorded.
-
-\subsection QmitkMovieMakerUserManualRecordingOptions Recording Options
-
-The slider can be used to step through the slices manually while not recording. Start and stop control a preview of what a video would look like.
-
-The buttons in the bottom part of this section can be used to create movies (windows only) or screenshots. Clicking opens a file %dialog where a name can be selected. After confirmation, a screenshot or movie is created according to the playing options.
-
-\subsection QmitkMovieMakerUserManualPlayingOptions Playing Options
-
-The first section controls whether the movie steps through slices (if a 2D view is selected), rotate the shown scene (if a 3D view is selected), or step through time steps (if set to temporal and a time resolved dataset is selected). If set to combined, a combination of both above options is used, with their speed relation set via the S/T Relation Spinbox.
-
-In the second section the direction of stepping can be set. Options are: Forward, backward and Ping-Pong, which is back-and-forth.The stepping speed can be set via the spinbox(total time in seconds).
-
-Although stepping speed is a total time in sec., this can not always be achieved. As a minimal frame rate of 25 fps is assumed to provide smooth movies, a dataset with only 25 slices will always be stepped through in 1 sec or faster.
-
-*/
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker_ControlArea.png b/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker_ControlArea.png
deleted file mode 100644
index ec8c0b8dca..0000000000
Binary files a/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker_ControlArea.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker_Icon.png b/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker_Icon.png
deleted file mode 100644
index 92c8276a2a..0000000000
Binary files a/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker_Icon.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker_ScreenshotMakerInterface.png b/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker_ScreenshotMakerInterface.png
deleted file mode 100644
index 085dcbdea6..0000000000
Binary files a/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker_ScreenshotMakerInterface.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkScreenshotMaker.dox b/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkScreenshotMaker.dox
deleted file mode 100644
index 05b657bdeb..0000000000
--- a/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkScreenshotMaker.dox
+++ /dev/null
@@ -1,19 +0,0 @@
-/**
-\page org_mitk_views_screenshotmaker The Screenshot Maker
-
-This view provides the functionality to create and save screenshots of the data.
-
-Available sections:
- - \ref QmitkScreenshotMakerUserManualUse
-
-\imageMacro{QmitkMovieMaker_ScreenshotMakerInterface.png,"The Screenshot Maker User Interface",7.09}
-
-\section QmitkScreenshotMakerUserManualUse Usage
-
-The first section offers the option of creating a screenshot of the last activated render window (thus the one, which was last clicked into). Upon clicking the button, the Screenshot Maker asks for a filename in which the screenshot is to be stored. The multiplanar Screenshot button asks for a folder, where screenshots of the three 2D views will be stored with default names.
-
-The high resolution screenshot section works the same as the simple screenshot section, aside from the fact, that the user can choose a magnification factor.
-
-In the option section one can rotate the camera in the 3D view by using the buttons. Furthermore one can choose the background colour for the screenshots, default is black.
-
-*/
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.moviemaker/documentation/doxygen/modules.dox
deleted file mode 100644
index 07f1421b2a..0000000000
--- a/Plugins/org.mitk.gui.qt.moviemaker/documentation/doxygen/modules.dox
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- \defgroup org_mitk_gui_qt_moviemaker org.mitk.gui.qt.moviemaker
- \ingroup MITKPlugins
-
- \brief Describe your plugin here.
-
-*/
-
-/**
- \defgroup org_mitk_gui_qt_moviemaker_internal Internal
- \ingroup org_mitk_gui_qt_moviemaker
-
- \brief This subcategory includes the internal classes of the org.mitk.gui.qt.moviemaker plugin. Other
- plugins must not rely on these classes. They contain implementation details and their interface
- may change at any time. We mean it.
-*/
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/files.cmake b/Plugins/org.mitk.gui.qt.moviemaker/files.cmake
index c4e28db992..11d7677e23 100644
--- a/Plugins/org.mitk.gui.qt.moviemaker/files.cmake
+++ b/Plugins/org.mitk.gui.qt.moviemaker/files.cmake
@@ -1,46 +1,53 @@
set(SRC_CPP_FILES
-
)
set(INTERNAL_CPP_FILES
- QmitkMovieMaker.cpp
+ QmitkAnimationItem.cpp
+ QmitkAnimationItemDelegate.cpp
+ QmitkAnimationWidget.cpp
+ QmitkFFmpegWriter.cpp
+ QmitkMovieMakerView.cpp
+ QmitkOrbitAnimationItem.cpp
+ QmitkOrbitAnimationWidget.cpp
+ QmitkSliceAnimationItem.cpp
+ QmitkSliceAnimationWidget.cpp
mitkMovieMakerPluginActivator.cpp
QmitkScreenshotMaker.cpp
-
)
set(UI_FILES
- src/internal/QmitkMovieMakerControls.ui
+ src/internal/QmitkMovieMakerView.ui
+ src/internal/QmitkOrbitAnimationWidget.ui
+ src/internal/QmitkSliceAnimationWidget.ui
src/internal/QmitkScreenshotMakerControls.ui
)
set(MOC_H_FILES
src/internal/mitkMovieMakerPluginActivator.h
- src/internal/QmitkMovieMaker.h
+ src/internal/QmitkAnimationItemDelegate.h
+ src/internal/QmitkAnimationWidget.h
+ src/internal/QmitkFFmpegWriter.h
+ src/internal/QmitkMovieMakerView.h
+ src/internal/QmitkOrbitAnimationWidget.h
+ src/internal/QmitkSliceAnimationWidget.h
src/internal/QmitkScreenshotMaker.h
)
set(CACHED_RESOURCE_FILES
- resources/icon.xpm
- plugin.xml
- resources/play.xpm
- resources/stop.xpm
- resources/pause.xpm
+ resources/camera-video.png
resources/screenshot_maker.png
+ plugin.xml
)
-set(RES_FILES
+set(QRC_FILES
resources/QmitkMovieMaker.qrc
- resources/play.xpm
- resources/stop.xpm
- resources/pause.xpm
)
foreach(file ${SRC_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/${file})
endforeach(file ${SRC_CPP_FILES})
foreach(file ${INTERNAL_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/internal/${file})
endforeach(file ${INTERNAL_CPP_FILES})
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/manifest_headers.cmake b/Plugins/org.mitk.gui.qt.moviemaker/manifest_headers.cmake
index 33c96b326e..0273e2802e 100644
--- a/Plugins/org.mitk.gui.qt.moviemaker/manifest_headers.cmake
+++ b/Plugins/org.mitk.gui.qt.moviemaker/manifest_headers.cmake
@@ -1,5 +1,5 @@
set(Plugin-Name "MITK Movie Maker")
set(Plugin-Version "0.9")
set(Plugin-Vendor "DKFZ, Medical and Biological Informatics")
set(Plugin-ContactAddress "http://www.mitk.org")
-set(Require-Plugin org.mitk.gui.qt.common.legacy)
\ No newline at end of file
+set(Require-Plugin org.mitk.gui.qt.common org.mitk.gui.qt.common.legacy org.mitk.gui.qt.ext)
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/plugin.xml b/Plugins/org.mitk.gui.qt.moviemaker/plugin.xml
index 32c792be7d..d3fe235aa5 100644
--- a/Plugins/org.mitk.gui.qt.moviemaker/plugin.xml
+++ b/Plugins/org.mitk.gui.qt.moviemaker/plugin.xml
@@ -1,35 +1,35 @@
+ class="QmitkMovieMakerView"
+ icon="resources/camera-video.png" >
Take movies of your data
Take screenshots of your data
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/resources/QmitkMovieMaker.qrc b/Plugins/org.mitk.gui.qt.moviemaker/resources/QmitkMovieMaker.qrc
index 8bdb515e34..61ad433b67 100644
--- a/Plugins/org.mitk.gui.qt.moviemaker/resources/QmitkMovieMaker.qrc
+++ b/Plugins/org.mitk.gui.qt.moviemaker/resources/QmitkMovieMaker.qrc
@@ -1,10 +1,6 @@
- QmitkMovieMakerClasses.png
- QmitkMovieMakerGUI.png
- icon.xpm
- pause.xpm
- play.xpm
- stop.xpm
+ delay.svg
+ duration.svg
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/resources/QmitkMovieMakerClasses.png b/Plugins/org.mitk.gui.qt.moviemaker/resources/QmitkMovieMakerClasses.png
deleted file mode 100644
index 9c26381a09..0000000000
Binary files a/Plugins/org.mitk.gui.qt.moviemaker/resources/QmitkMovieMakerClasses.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/resources/QmitkMovieMakerGUI.png b/Plugins/org.mitk.gui.qt.moviemaker/resources/QmitkMovieMakerGUI.png
deleted file mode 100644
index 02af724a9e..0000000000
Binary files a/Plugins/org.mitk.gui.qt.moviemaker/resources/QmitkMovieMakerGUI.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/resources/camera-video.png b/Plugins/org.mitk.gui.qt.moviemaker/resources/camera-video.png
new file mode 100644
index 0000000000..d9d484927f
Binary files /dev/null and b/Plugins/org.mitk.gui.qt.moviemaker/resources/camera-video.png differ
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/resources/delay.svg b/Plugins/org.mitk.gui.qt.moviemaker/resources/delay.svg
new file mode 100644
index 0000000000..75e2310861
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/resources/delay.svg
@@ -0,0 +1,404 @@
+
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/resources/duration.svg b/Plugins/org.mitk.gui.qt.moviemaker/resources/duration.svg
new file mode 100644
index 0000000000..01b1d129bd
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/resources/duration.svg
@@ -0,0 +1,392 @@
+
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/resources/icon.png b/Plugins/org.mitk.gui.qt.moviemaker/resources/icon.png
deleted file mode 100644
index 6ad519ea65..0000000000
Binary files a/Plugins/org.mitk.gui.qt.moviemaker/resources/icon.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/resources/icon.xpm b/Plugins/org.mitk.gui.qt.moviemaker/resources/icon.xpm
deleted file mode 100644
index 103ebf4b01..0000000000
--- a/Plugins/org.mitk.gui.qt.moviemaker/resources/icon.xpm
+++ /dev/null
@@ -1,47 +0,0 @@
-/* XPM */
-static const char * icon_xpm[] = {
-"28 28 16 1",
-" c None",
-". c #000000",
-"+ c #555555",
-"@ c #222222",
-"# c #777777",
-"$ c #444444",
-"% c #BBBBBB",
-"& c #DDDDDD",
-"* c #AAAAAA",
-"= c #FFFFFF",
-"- c #888888",
-"; c #993366",
-"> c #CC6666",
-", c #663300",
-"' c #440000",
-") c #FFFF00",
-" ... ",
-" ..+@@. ",
-" ..++@+@.. ",
-" ..+++##@@.. ",
-" ..+++##@@@@.. ",
-" ..+++##@@@$$.. ",
-" ..#++##@@@$...$ ",
-" ..##++#@@@%&&.$ ",
-" ...*@@+#@@%&&==&. ",
-" ...*++++@@%&&==&&@@. ",
-" ..$$==+#-%&&==&&@@$$@. ",
-" .+##..=-&&==&&@@@$$+@. ",
-" .##---*.=%=&&@@@@$$++@. ",
-" .===%**%%$=*@@@@@$$+++@. ",
-".=-@+=&%&&.&-@@@@$$++++@. ",
-".&.;.+=&%%.%#@@@$$+++++@. ",
-".&.>,.=&**.*+@$$====++@. ",
-".&.,,.&&--.*+=$$&&&&====... ",
-".&+.'.&%##.-=&$+%%%%&&&&===.",
-".&%+.*&*++$=&$======%%%%&&&.",
-" .&&&&&-++&**$&&&+++%===%%%.",
-" .&==&*+++&*--.%%@))++++===.",
-" .&**&*+++&-+@@@*+@@)))@&&&.",
-" .@&&&*+++@@@@..----@@@+%%%.",
-" .+@@$*+@@@@.. .....----***.",
-" .+++$@@@.. ....---.",
-" ..@+$@.. ... ",
-" .... "};
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/resources/pause.xpm b/Plugins/org.mitk.gui.qt.moviemaker/resources/pause.xpm
deleted file mode 100644
index 0ad2e7421c..0000000000
--- a/Plugins/org.mitk.gui.qt.moviemaker/resources/pause.xpm
+++ /dev/null
@@ -1,57 +0,0 @@
-/* XPM */
-static const char * pause_xpm[] = {
-"24 24 30 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-"@ c #737372",
-"# c #848483",
-"$ c #888887",
-"% c #7E7E7D",
-"& c #A8A7A6",
-"* c #A4A4A3",
-"= c #A6A5A4",
-"- c #B5B4B3",
-"; c #858483",
-"> c #AAA9A7",
-", c #C0BFBE",
-"' c #91908E",
-") c #AFAEAC",
-"! c #CACAC8",
-"~ c #A6A5A2",
-"{ c #BBBAB7",
-"] c #D4D3D2",
-"^ c #AEADA9",
-"/ c #BFBDBA",
-"( c #D7D5D3",
-"_ c #B2B0AD",
-": c #C3C1BE",
-"< c #D9D8D6",
-"[ c #B5B3B0",
-"} c #D1CFCC",
-"| c #DEDDDB",
-"1 c #F3F3F3",
-" ",
-" ",
-" ",
-" ",
-" ",
-" .....+.....+ ",
-" .@#$.+.@#$.+ ",
-" .%&*.+.%&*.+ ",
-" .%=-.+.%=-.+ ",
-" .;>,.+.;>,.+ ",
-" .')!.+.')!.+ ",
-" .')!.+.')!.+ ",
-" .')!.+.')!.+ ",
-" .~{].+.~{].+ ",
-" .~{].+.~{].+ ",
-" .^/(.+.^/(.+ ",
-" ._:<.+._:<.+ ",
-" .[}|.+.[}|.+ ",
-" .....+.....+ ",
-" +++++1++++++ ",
-" ",
-" ",
-" ",
-" "};
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/resources/play.xpm b/Plugins/org.mitk.gui.qt.moviemaker/resources/play.xpm
deleted file mode 100644
index 0bcda4f454..0000000000
--- a/Plugins/org.mitk.gui.qt.moviemaker/resources/play.xpm
+++ /dev/null
@@ -1,64 +0,0 @@
-/* XPM */
-static const char * play_xpm[] = {
-"24 24 37 1",
-" c None",
-". c #000000",
-"+ c #727170",
-"@ c #7B7B7A",
-"# c #6C6B6A",
-"$ c #7F7E7D",
-"% c #999996",
-"& c #7D7C7B",
-"* c #828180",
-"= c #9D9C9A",
-"- c #B0AFAC",
-"; c #908F8D",
-"> c #868583",
-", c #A1A09E",
-"' c #B4B3B1",
-") c #B6B4B2",
-"! c #A5A4A1",
-"~ c #898886",
-"{ c #B9B7B4",
-"] c #BAB9B6",
-"^ c #BCBAB7",
-"/ c #C3C2BF",
-"( c #FFFFFF",
-"_ c #8C8B89",
-": c #A9A8A5",
-"< c #BDBCB9",
-"[ c #C5C3C0",
-"} c #D0CECC",
-"| c #8F8E8C",
-"1 c #B5B3B1",
-"2 c #C7C6C3",
-"3 c #D2D1CE",
-"4 c #B9B6B4",
-"5 c #D8D7D5",
-"6 c #A19F9D",
-"7 c #C7C6C4",
-"8 c #A7A6A3",
-" ",
-" ",
-" ",
-" ",
-" . ",
-" .. ",
-" .+. ",
-" .@#. ",
-" .$%&. ",
-" .*=-;. ",
-" .>,')!. ",
-" .~!{]^/.( ",
-" ._:<[}.( ",
-" .|123.( ",
-" .=45.( ",
-" .67.( ",
-" .8.( ",
-" ..( ",
-" .( ",
-" ( ",
-" ",
-" ",
-" ",
-" "};
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/resources/stop.xpm b/Plugins/org.mitk.gui.qt.moviemaker/resources/stop.xpm
deleted file mode 100644
index 3b76b26157..0000000000
--- a/Plugins/org.mitk.gui.qt.moviemaker/resources/stop.xpm
+++ /dev/null
@@ -1,56 +0,0 @@
-/* XPM */
-static const char * stop_xpm[] = {
-"24 24 29 1",
-" c None",
-". c #000000",
-"+ c #FFFFFF",
-"@ c #737372",
-"# c #848483",
-"$ c #888887",
-"% c #7E7E7D",
-"& c #A8A7A6",
-"* c #A4A4A3",
-"= c #A6A5A4",
-"- c #B5B4B3",
-"; c #858483",
-"> c #AAA9A7",
-", c #C0BFBE",
-"' c #91908E",
-") c #AFAEAC",
-"! c #CACAC8",
-"~ c #A6A5A2",
-"{ c #BBBAB7",
-"] c #D4D3D2",
-"^ c #AEADA9",
-"/ c #BFBDBA",
-"( c #D7D5D3",
-"_ c #B2B0AD",
-": c #C3C1BE",
-"< c #D9D8D6",
-"[ c #B5B3B0",
-"} c #D1CFCC",
-"| c #DEDDDB",
-" ",
-" ",
-" ",
-" ",
-" ",
-" .............+ ",
-" .@#$$$$$$$$$.+ ",
-" .%&*********.+ ",
-" .%=---------.+ ",
-" .;>,,,,,,,,,.+ ",
-" .')!!!!!!!!!.+ ",
-" .')!!!!!!!!!.+ ",
-" .~{]]]]]]]]].+ ",
-" .~{]]]]]]]]].+ ",
-" .^/(((((((((.+ ",
-" ._:<<<<<<<<<.+ ",
-" .[}|||||||||.+ ",
-" .............+ ",
-" ++++++++++++++ ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationItem.cpp b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationItem.cpp
new file mode 100644
index 0000000000..c55bb0808a
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationItem.cpp
@@ -0,0 +1,71 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#include "QmitkAnimationItem.h"
+
+QmitkAnimationItem::QmitkAnimationItem(const QString& widgetKey, double duration, double delay, bool startWithPrevious)
+{
+ this->SetWidgetKey(widgetKey);
+ this->SetDuration(duration);
+ this->SetDelay(delay);
+ this->SetStartWithPrevious(startWithPrevious);
+
+ this->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
+}
+
+QmitkAnimationItem::~QmitkAnimationItem()
+{
+}
+
+QString QmitkAnimationItem::GetWidgetKey() const
+{
+ return this->data(WidgetKeyRole).toString();
+}
+
+void QmitkAnimationItem::SetWidgetKey(const QString& widgetKey)
+{
+ this->setData(widgetKey, WidgetKeyRole);
+}
+
+double QmitkAnimationItem::GetDuration() const
+{
+ return this->data(DurationRole).toDouble();
+}
+
+void QmitkAnimationItem::SetDuration(double duration)
+{
+ this->setData(duration, DurationRole);
+}
+
+double QmitkAnimationItem::GetDelay() const
+{
+ return this->data(DelayRole).toDouble();
+}
+
+void QmitkAnimationItem::SetDelay(double delay)
+{
+ this->setData(delay, DelayRole);
+}
+
+bool QmitkAnimationItem::GetStartWithPrevious() const
+{
+ return this->data(StartWithPreviousRole).toBool();
+}
+
+void QmitkAnimationItem::SetStartWithPrevious(bool startWithPrevious)
+{
+ this->setData(startWithPrevious, StartWithPreviousRole);
+}
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationItem.h b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationItem.h
new file mode 100644
index 0000000000..9e7fcec130
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationItem.h
@@ -0,0 +1,57 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#ifndef QmitkAnimationItem_h
+#define QmitkAnimationItem_h
+
+#include
+
+class QmitkAnimationItem : public QStandardItem
+{
+public:
+ enum AnimationItemDataRole
+ {
+ WidgetKeyRole = Qt::UserRole + 2,
+ DurationRole,
+ DelayRole,
+ StartWithPreviousRole,
+ RenderWindowRole,
+ FromRole,
+ ToRole,
+ ReverseRole,
+ StartAngleRole,
+ OrbitRole
+ };
+
+ explicit QmitkAnimationItem(const QString& widgetKey, double duration = 2.0, double delay = 0.0, bool startWithPrevious = false);
+ virtual ~QmitkAnimationItem();
+
+ QString GetWidgetKey() const;
+ void SetWidgetKey(const QString& widgetKey);
+
+ double GetDuration() const;
+ void SetDuration(double duration);
+
+ double GetDelay() const;
+ void SetDelay(double delay);
+
+ bool GetStartWithPrevious() const;
+ void SetStartWithPrevious(bool startWithPrevious);
+
+ virtual void Animate(double s) = 0;
+};
+
+#endif
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationItemDelegate.cpp b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationItemDelegate.cpp
new file mode 100644
index 0000000000..781aeb37af
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationItemDelegate.cpp
@@ -0,0 +1,123 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#include "QmitkAnimationItem.h"
+#include "QmitkAnimationItemDelegate.h"
+#include
+#include
+#include
+#include
+
+QmitkAnimationItemDelegate::QmitkAnimationItemDelegate(QObject* parent)
+ : QStyledItemDelegate(parent)
+{
+}
+
+QmitkAnimationItemDelegate::~QmitkAnimationItemDelegate()
+{
+}
+
+void QmitkAnimationItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
+{
+ painter->save();
+
+ if (option.state & QStyle::State_Selected)
+ painter->fillRect(option.rect, option.palette.highlight());
+
+ if (index.column() == 0)
+ {
+ QStyleOptionViewItem opt = option;
+ this->initStyleOption(&opt, index);
+
+ QRect rect = QRect(opt.rect.x() + 3, opt.rect.y(), opt.rect.width() - 6, opt.rect.height());
+ QString text = option.fontMetrics.elidedText(index.data().toString(), Qt::ElideRight, rect.width());
+ QPalette::ColorRole colorRole = (option.state & QStyle::State_Selected)
+ ? QPalette::HighlightedText
+ : QPalette::Text;
+
+ QApplication::style()->drawItemText(painter, rect, 0, option.palette, true, text, colorRole);
+ }
+ else if (index.column() == 1)
+ {
+ const QStandardItemModel* model = dynamic_cast(index.model());
+ const QmitkAnimationItem* thisItem = dynamic_cast(model->item(index.row(), 1));
+ QList items;
+
+ const int rowCount = model->rowCount();
+
+ for (int i = 0; i < rowCount; ++i)
+ items << dynamic_cast(model->item(i, 1));
+
+ double totalDuration = 0.0;
+ double previousStart = 0.0;
+ double thisStart = 0.0;
+
+ Q_FOREACH(const QmitkAnimationItem* item, items)
+ {
+ if (item->GetStartWithPrevious())
+ {
+ totalDuration = std::max(totalDuration, previousStart + item->GetDelay() + item->GetDuration());
+ }
+ else
+ {
+ previousStart = totalDuration;
+ totalDuration += item->GetDelay() + item->GetDuration();
+ }
+
+ if (item == thisItem)
+ thisStart = previousStart;
+ }
+
+ const QRect& rect = option.rect;
+ const double widthPerSecond = rect.width() / totalDuration;
+
+ QColor color = thisItem->GetStartWithPrevious()
+ ? QColor("DarkGray")
+ : QColor("DimGray");
+
+ painter->setBrush(color);
+ painter->setPen(Qt::NoPen);
+
+ painter->drawRect(
+ rect.x() + static_cast(widthPerSecond * (thisStart + thisItem->GetDelay())),
+ rect.y() + 1,
+ static_cast(widthPerSecond * thisItem->GetDuration()),
+ rect.height() - 2);
+
+ if (thisItem->GetDelay() > std::numeric_limits::min())
+ {
+ QPen pen(color);
+ painter->setPen(pen);
+
+ painter->drawLine(
+ rect.x() + static_cast(widthPerSecond * thisStart),
+ rect.y() + 1,
+ rect.x() + static_cast(widthPerSecond * thisStart),
+ rect.y() + rect.height() - 2);
+
+ pen.setStyle(Qt::DashLine);
+ painter->setPen(pen);
+
+ painter->drawLine(
+ rect.x() + static_cast(widthPerSecond * thisStart),
+ rect.y() + rect.height() / 2,
+ rect.x() + static_cast(widthPerSecond * (thisStart + thisItem->GetDelay())) - 1,
+ rect.y() + rect.height() / 2);
+ }
+ }
+
+ painter->restore();
+}
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationItemDelegate.h b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationItemDelegate.h
new file mode 100644
index 0000000000..b1ad53c99a
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationItemDelegate.h
@@ -0,0 +1,33 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#ifndef QmitkAnimationItemDelegate_h
+#define QmitkAnimationItemDelegate_h
+
+#include
+
+class QmitkAnimationItemDelegate : public QStyledItemDelegate
+{
+ Q_OBJECT
+
+public:
+ explicit QmitkAnimationItemDelegate(QObject* parent = NULL);
+ ~QmitkAnimationItemDelegate();
+
+ void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const;
+};
+
+#endif
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationWidget.cpp b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationWidget.cpp
new file mode 100644
index 0000000000..45c861d9ab
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationWidget.cpp
@@ -0,0 +1,26 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#include "QmitkAnimationWidget.h"
+
+QmitkAnimationWidget::QmitkAnimationWidget(QWidget* parent)
+ : QWidget(parent)
+{
+}
+
+QmitkAnimationWidget::~QmitkAnimationWidget()
+{
+}
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationWidget.h b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationWidget.h
new file mode 100644
index 0000000000..103a7b5f6e
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkAnimationWidget.h
@@ -0,0 +1,35 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#ifndef QmitkAnimationWidget_h
+#define QmitkAnimationWidget_h
+
+#include
+
+class QmitkAnimationItem;
+
+class QmitkAnimationWidget : public QWidget
+{
+ Q_OBJECT
+
+public:
+ explicit QmitkAnimationWidget(QWidget* parent = NULL);
+ virtual ~QmitkAnimationWidget();
+
+ virtual void SetAnimationItem(QmitkAnimationItem* animationItem) = 0;
+};
+
+#endif
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkFFmpegWriter.cpp b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkFFmpegWriter.cpp
new file mode 100644
index 0000000000..ae332ba296
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkFFmpegWriter.cpp
@@ -0,0 +1,176 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#include "QmitkFFmpegWriter.h"
+#include
+#include
+#include
+
+QmitkFFmpegWriter::QmitkFFmpegWriter(QObject* parent)
+ : QObject(parent),
+ m_Process(new QProcess(this)),
+ m_Framerate(0),
+ m_IsRunning(false)
+{
+ this->connect(m_Process, SIGNAL(error(QProcess::ProcessError)),
+ this, SLOT(OnProcessError(QProcess::ProcessError)));
+
+ this->connect(m_Process, SIGNAL(finished(int, QProcess::ExitStatus)),
+ this, SLOT(OnProcessFinished(int, QProcess::ExitStatus)));
+}
+
+QmitkFFmpegWriter::~QmitkFFmpegWriter()
+{
+}
+
+QString QmitkFFmpegWriter::GetFFmpegPath() const
+{
+ return m_FFmpegPath;
+}
+
+void QmitkFFmpegWriter::SetFFmpegPath(const QString& path)
+{
+ m_FFmpegPath = path;
+}
+
+QSize QmitkFFmpegWriter::GetSize() const
+{
+ return m_Size;
+}
+
+void QmitkFFmpegWriter::SetSize(const QSize& size)
+{
+ m_Size = size;
+}
+
+void QmitkFFmpegWriter::SetSize(int width, int height)
+{
+ m_Size = QSize(width, height);
+}
+
+int QmitkFFmpegWriter::GetFramerate() const
+{
+ return m_Framerate;
+}
+
+void QmitkFFmpegWriter::SetFramerate(int framerate)
+{
+ m_Framerate = framerate;
+}
+
+QString QmitkFFmpegWriter::GetOutputPath() const
+{
+ return m_OutputPath;
+}
+
+void QmitkFFmpegWriter::SetOutputPath(const QString& path)
+{
+ m_OutputPath = path;
+}
+
+void QmitkFFmpegWriter::Start()
+{
+ if (m_FFmpegPath.isEmpty())
+ mitkThrow() << "FFmpeg/Libav path is empty!";
+
+ if (m_Size.isNull())
+ mitkThrow() << "Invalid video frame size!";
+
+ if (m_Framerate <= 0)
+ mitkThrow() << "Invalid framerate!";
+
+ if (m_OutputPath.isEmpty())
+ mitkThrow() << "Output path is empty!";
+
+ m_Process->start(m_FFmpegPath, QStringList()
+ << "-y"
+ << "-f" << "rawvideo"
+ << "-pix_fmt" << "rgb24"
+ << "-s" << QString("%1x%2").arg(m_Size.width()).arg(m_Size.height())
+ << "-r" << QString("%1").arg(m_Framerate)
+ << "-i" << "-"
+ << "-vf" << "vflip"
+ << "-pix_fmt" << "yuv420p"
+ << "-crf" << "18"
+ << m_OutputPath);
+
+ m_Process->waitForStarted();
+ m_IsRunning = true;
+}
+
+bool QmitkFFmpegWriter::IsRunning() const
+{
+ return m_IsRunning;
+}
+
+void QmitkFFmpegWriter::WriteFrame(const unsigned char* frame)
+{
+ if (frame == NULL || !m_Process->isOpen())
+ return;
+
+ m_Process->write(reinterpret_cast(frame), m_Size.width() * m_Size.height() * 3);
+ m_Process->waitForBytesWritten();
+}
+
+void QmitkFFmpegWriter::Stop()
+{
+ m_IsRunning = false;
+ m_Process->closeWriteChannel();
+}
+
+void QmitkFFmpegWriter::OnProcessError(QProcess::ProcessError error)
+{
+ m_IsRunning = false;
+
+ MITK_ERROR << QString::fromLatin1(m_Process->readAllStandardError()).toStdString();
+
+ switch (error)
+ {
+ case QProcess::FailedToStart:
+ mitkThrow() << "FFmpeg/Libav failed to start!";
+
+ case QProcess::Crashed:
+ mitkThrow() << "FFmpeg/Libav crashed!";
+
+ case QProcess::Timedout:
+ mitkThrow() << "FFmpeg/Libav timed out!";
+
+ case QProcess::WriteError:
+ mitkThrow() << "Could not write to FFmpeg/Libav!";
+
+ case QProcess::ReadError:
+ mitkThrow() << "Could not read from FFmpeg/Libav!";
+
+ default:
+ mitkThrow() << "An unknown error occurred!";
+ }
+}
+
+void QmitkFFmpegWriter::OnProcessFinished(int exitCode, QProcess::ExitStatus exitStatus)
+{
+ m_IsRunning = false;
+
+ if (exitStatus != QProcess::CrashExit)
+ {
+ if (exitCode != 0)
+ {
+ m_Process->close();
+ mitkThrow() << QString("FFmpeg/Libav exit code: %1").arg(exitCode).toStdString().c_str();
+ }
+ }
+
+ m_Process->close();
+}
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkFFmpegWriter.h b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkFFmpegWriter.h
new file mode 100644
index 0000000000..5527edb538
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkFFmpegWriter.h
@@ -0,0 +1,62 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#ifndef QmitkFFmpegWriter_h
+#define QmitkFFmpegWriter_h
+
+#include
+#include
+
+class QmitkFFmpegWriter : public QObject
+{
+ Q_OBJECT
+
+public:
+ explicit QmitkFFmpegWriter(QObject* parent = NULL);
+ ~QmitkFFmpegWriter();
+
+ QString GetFFmpegPath() const;
+ void SetFFmpegPath(const QString& path);
+
+ QSize GetSize() const;
+ void SetSize(const QSize& size);
+ void SetSize(int width, int height);
+
+ int GetFramerate() const;
+ void SetFramerate(int framerate);
+
+ QString GetOutputPath() const;
+ void SetOutputPath(const QString& path);
+
+ void Start();
+ bool IsRunning() const;
+ void WriteFrame(const unsigned char* frame);
+ void Stop();
+
+private slots:
+ void OnProcessError(QProcess::ProcessError error);
+ void OnProcessFinished(int exitCode, QProcess::ExitStatus exitStatus);
+
+private:
+ QProcess* m_Process;
+ QString m_FFmpegPath;
+ QSize m_Size;
+ int m_Framerate;
+ QString m_OutputPath;
+ bool m_IsRunning;
+};
+
+#endif
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMaker.cpp b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMaker.cpp
deleted file mode 100644
index b11ea9e52c..0000000000
--- a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMaker.cpp
+++ /dev/null
@@ -1,769 +0,0 @@
-/*===================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center,
-Division of Medical and Biological Informatics.
-All rights reserved.
-
-This software is distributed WITHOUT ANY WARRANTY; without
-even the implied warranty of MERCHANTABILITY or FITNESS FOR
-A PARTICULAR PURPOSE.
-
-See LICENSE.txt or http://www.mitk.org for details.
-
-===================================================================*/
-
-
-#include "QmitkMovieMaker.h"
-//#include "QmitkMovieMakerControls.h"
-#include "QmitkStepperAdapter.h"
-#include "QmitkStdMultiWidget.h"
-#include "QmitkMovieMaker.h"
-//#include "QmitkMovieMakerControls.h"
-#include "QmitkStepperAdapter.h"
-#include "QmitkStdMultiWidget.h"
-
-#include "mitkVtkPropRenderer.h"
-#include "mitkGlobalInteraction.h"
-
-#include
-
-#include
-#include
-
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "qapplication.h"
-
-#include "vtkImageWriter.h"
-#include "vtkJPEGWriter.h"
-#include "vtkPNGWriter.h"
-#include "vtkRenderLargeImage.h"
-#include "vtkRenderWindowInteractor.h"
-#include "vtkRenderer.h"
-#include "vtkTestUtilities.h"
-
-#include
-#include "vtkMitkRenderProp.h"
-
-#include
-#include
-#include "vtkRenderWindowInteractor.h"
-#include
-
-QmitkMovieMaker::QmitkMovieMaker(QObject *parent, const char * /*name*/)
-
-:
- QmitkFunctionality(), m_Controls(NULL),
- m_StepperAdapter(NULL),
- m_FocusManagerCallback(0), m_Looping(true), m_Direction(0), m_Aspect(0)
-{
-
- parentWidget = parent;
-
- m_Timer = new QTimer(this);
- m_Time = new QTime();
-
- m_FocusManagerCallback = MemberCommand::New();
- m_FocusManagerCallback->SetCallbackFunction(this, &QmitkMovieMaker::FocusChange);
-
- m_movieGenerator = mitk::MovieGenerator::New();
-
- if (m_movieGenerator.IsNull())
- {
- MITK_ERROR << "Either mitk::MovieGenerator is not implemented for your";
- MITK_ERROR << " platform or an error occurred during";
- MITK_ERROR << " mitk::MovieGenerator::New()" ;
- }
-
-}
-
-QmitkMovieMaker::~QmitkMovieMaker()
-{
- delete m_StepperAdapter;
- delete m_Timer;
- delete m_Time;
- //delete m_RecordingRenderer;
-
-}
-
-mitk::BaseController* QmitkMovieMaker::GetSpatialController()
-{
- mitk::BaseRenderer* focusedRenderer = mitk::GlobalInteraction::GetInstance()->GetFocus();
-
- if (mitk::BaseRenderer::GetInstance(GetActiveStdMultiWidget()->mitkWidget1->GetRenderWindow())
- == focusedRenderer)
- {
- return GetActiveStdMultiWidget()->mitkWidget1->GetController();
- }
- else if (mitk::BaseRenderer::GetInstance(
- GetActiveStdMultiWidget()->mitkWidget2->GetRenderWindow()) == focusedRenderer)
- {
- return GetActiveStdMultiWidget()->mitkWidget2->GetController();
- }
- else if (mitk::BaseRenderer::GetInstance(
- GetActiveStdMultiWidget()->mitkWidget3->GetRenderWindow()) == focusedRenderer)
- {
- return GetActiveStdMultiWidget()->mitkWidget3->GetController();
- }
- else if (mitk::BaseRenderer::GetInstance(
- GetActiveStdMultiWidget()->mitkWidget4->GetRenderWindow()) == focusedRenderer)
- {
- return GetActiveStdMultiWidget()->mitkWidget4->GetController();
- }
-
- return GetActiveStdMultiWidget()->mitkWidget4->GetController();
-}
-
-mitk::BaseController* QmitkMovieMaker::GetTemporalController()
-{
- return GetActiveStdMultiWidget()->GetTimeNavigationController();
-}
-
-void QmitkMovieMaker::CreateConnections()
-{
- if (m_Controls)
- {
- // start / pause / stop playing
- connect((QObject*) m_Controls->btnPlay, SIGNAL(clicked()), (QObject*) this,
- SLOT(StartPlaying()));
- connect((QObject*) m_Controls->btnPause, SIGNAL(clicked()), this, SLOT(PausePlaying()));
- connect((QObject*) m_Controls->btnStop, SIGNAL(clicked()), this, SLOT(StopPlaying()));
-
- connect((QObject*) m_Controls->rbtnForward, SIGNAL(clicked()), this, SLOT(RBTNForward()));
- connect((QObject*) m_Controls->rbtnBackward, SIGNAL(clicked()), this, SLOT(RBTNBackward()));
- connect((QObject*) m_Controls->rbtnPingPong, SIGNAL(clicked()), this, SLOT(RBTNPingPong()));
-
- // radio button group: forward, backward, ping-pong
- connect( this, SIGNAL(SwitchDirection(int)), this, SLOT(SetDirection(int)) );
-
- // radio button group: spatial, temporal
- connect((QObject*) m_Controls->rbtnSpatial, SIGNAL(clicked()), this, SLOT(RBTNSpatial()));
- connect((QObject*) m_Controls->rbtnTemporal, SIGNAL(clicked()), this, SLOT(RBTNTemporal()));
- connect((QObject*) m_Controls->rbtnCombined, SIGNAL(clicked()), this, SLOT(RBTNCombined()));
- connect( this, SIGNAL(SwitchAspect(int)), this, SLOT(SetAspect(int)) );
-
- // stepper window selection
- connect((QObject*) (m_Controls->cmbSelectedStepperWindow), SIGNAL ( activated ( int) ), (QObject*) this, SLOT ( SetStepperWindow (int) ) );
-
- // recording window selection
- connect((QObject*) (m_Controls->cmbSelectedRecordingWindow), SIGNAL ( activated ( int) ), (QObject*) this, SLOT ( SetRecordingWindow (int) ) );
-
- // advance the animation
- // every timer tick
- connect((QObject*) m_Timer, SIGNAL(timeout()), this, SLOT(AdvanceAnimation()));
-
- // movie generation
- // when the movie button is clicked
- connect((QObject*) m_Controls->btnMovie, SIGNAL(clicked()), this, SLOT(GenerateMovie()));
-
- connect((QObject*) m_Controls->btnScreenshot, SIGNAL(clicked()), this, SLOT(
- GenerateScreenshot()));
- connect((QObject*) m_Controls->m_HRScreenshot, SIGNAL(clicked()), this, SLOT(
- GenerateHR3DScreenshot()));
-
- // blocking of ui elements during movie generation
- connect((QObject*) this, SIGNAL(StartBlockControls()), (QObject*) this, SLOT(BlockControls()));
-
- connect((QObject*) this, SIGNAL(EndBlockControls()), (QObject*) this, SLOT(UnBlockControls()));
-
- connect((QObject*) this, SIGNAL(EndBlockControlsMovieDeactive()), (QObject*) this, SLOT(
- UnBlockControlsMovieDeactive()));
-
- // allow for change of spatialtime relation
- connect((QObject*) m_Controls->spatialTimeRelation, SIGNAL(valueChanged ( int ) ), this, SLOT( DeleteMStepper() ) );
-
-
- m_Controls->btnScreenshot->setVisible(false);
- m_Controls->m_HRScreenshot->setVisible(false);
- }
-}
-
-void QmitkMovieMaker::Activated()
-{
- QmitkFunctionality::Activated();
-
- // create a member command that will be executed from the observer
- itk::SimpleMemberCommand::Pointer stepperChangedCommand;
- stepperChangedCommand = itk::SimpleMemberCommand::New();
- // set the callback function of the member command
- stepperChangedCommand->SetCallbackFunction(this, &QmitkMovieMaker::UpdateGUI);
- // add an observer to the data tree node pointer connected to the above member command
- MITK_INFO << "Add observer on insertion point node in NavigationPathController::AddObservers";
- m_StepperObserverTag = this->GetTemporalController()->GetTime()->AddObserver(
- itk::ModifiedEvent(), stepperChangedCommand);
-
- m_FocusManagerObserverTag
- = mitk::GlobalInteraction::GetInstance()->GetFocusManager()->AddObserver(mitk::FocusEvent(),
- m_FocusManagerCallback);
- this->UpdateGUI();
- // Initialize steppers etc.
- this->FocusChange();
-}
-
-void QmitkMovieMaker::Deactivated()
-{
- QmitkFunctionality::Deactivated();
- this->GetTemporalController()->GetTime()->RemoveObserver(m_StepperObserverTag);
- mitk::GlobalInteraction::GetInstance()->GetFocusManager()->RemoveObserver(
- m_FocusManagerObserverTag); // remove (if tag is invalid, nothing is removed)
-}
-
-void QmitkMovieMaker::FocusChange()
-{
- mitk::Stepper *stepper = this->GetAspectStepper();
- m_StepperAdapter->SetStepper(stepper);
-
- // Make the stepper movement non-inverted
- stepper->InverseDirectionOff();
-
- // Set stepping direction and aspect (spatial / temporal) for new stepper
- this->UpdateLooping();
- this->UpdateDirection();
-
- // Set newly focused window as active in "Selected Window" combo box
- const mitk::RenderingManager::RenderWindowVector rwv =
- mitk::RenderingManager::GetInstance()->GetAllRegisteredRenderWindows();
-
- int i;
- mitk::RenderingManager::RenderWindowVector::const_iterator iter;
- for (iter = rwv.begin(), i = 0; iter != rwv.end(); ++iter, ++i)
- {
- mitk::BaseRenderer* focusedRenderer =
- mitk::GlobalInteraction::GetInstance()->GetFocusManager()->GetFocused();
-
- if (focusedRenderer == mitk::BaseRenderer::GetInstance((*iter)))
- {
- m_Controls->cmbSelectedStepperWindow->setCurrentIndex(i);
- // this->cmbSelectedStepperWindow_activated(i);
- this->SetStepperWindow(i);
- m_Controls->cmbSelectedRecordingWindow->setCurrentIndex(i);
- // this->cmbSelectedRecordWindow_activated(i);
- this->SetRecordingWindow(i);
- break;
- }
- }
-}
-
-void QmitkMovieMaker::AdvanceAnimation()
-{
- // This method is called when a timer timeout occurs. It increases the
- // stepper value according to the elapsed time and the stepper interval.
- // Note that a screen refresh is not forced, but merely requested, and may
- // occur only after more calls to AdvanceAnimation().
-
- mitk::Stepper* stepper = this->GetAspectStepper();
-
- m_StepperAdapter->SetStepper(stepper);
-
- int elapsedTime = m_Time->elapsed();
- m_Time->restart();
-
- static double increment = 0.0;
- increment = increment - static_cast (increment);
- increment += elapsedTime * stepper->GetSteps() / (m_Controls->spnDuration->value() * 1000.0);
-
- int i, n = static_cast (increment);
- for (i = 0; i < n; ++i)
- {
- stepper->Next();
- }
-}
-
-void QmitkMovieMaker::RenderSlot()
-{
- int *i = widget->GetRenderWindow()->GetSize();
- m_PropRenderer->Resize(i[0], i[1]);
-
- widget->GetRenderWindow()->Render();
-}
-
-void QmitkMovieMaker::PausePlaying()
-{
-
- m_Controls->slidAngle->setDisabled(false);
- m_Controls->btnMovie->setEnabled(true);
- m_Controls->btnPlay->setEnabled(true);
- m_Controls->btnScreenshot->setEnabled(true);
-
- m_Timer->stop();
-
- m_Controls->btnPlay->setHidden(false);
- m_Controls->btnPause->setHidden(true);
- if (m_movieGenerator.IsNull())
- m_Controls->btnMovie->setEnabled(false);
-}
-
-void QmitkMovieMaker::StopPlaying()
-{
- m_Controls->slidAngle->setDisabled(false);
- m_Controls->btnMovie->setEnabled(true);
- m_Controls->btnPlay->setEnabled(true);
- m_Controls->btnScreenshot->setEnabled(true);
-
- m_Controls->btnPlay->setHidden(false);
- m_Controls->btnPause->setHidden(true);
-
- m_Timer->stop();
- switch (m_Direction)
- {
- case 0:
- case 2:
- this->GetAspectStepper()->First();
- break;
-
- case 1:
- this->GetAspectStepper()->Last();
- break;
- }
-
- // Reposition slider GUI element
- m_StepperAdapter->SetStepper(this->GetAspectStepper());
-
- if (m_movieGenerator.IsNull())
- m_Controls->btnMovie->setEnabled(false);
-
-}
-
-void QmitkMovieMaker::SetLooping(bool looping)
-{
- m_Looping = looping;
- this->UpdateLooping();
-}
-
-void QmitkMovieMaker::SetDirection(int direction)
-{
- m_Direction = direction;
- this->UpdateDirection();
-}
-
-void QmitkMovieMaker::SetAspect(int aspect)
-{
- m_Aspect = aspect;
-
- m_StepperAdapter->SetStepper(this->GetAspectStepper());
- this->UpdateLooping();
- this->UpdateDirection();
-}
-
-void QmitkMovieMaker::SetStepperWindow(int window)
-{
- // Set newly selected window / renderer as focused
- const mitk::RenderingManager::RenderWindowVector rwv =
- mitk::RenderingManager::GetInstance()->GetAllRegisteredRenderWindows();
-
- //Delete MultiStepper
- DeleteMStepper();
-
- int i;
- mitk::RenderingManager::RenderWindowVector::const_iterator iter;
- for (iter = rwv.begin(), i = 0; iter != rwv.end(); ++iter, ++i)
- {
- if (i == window)
- {
- mitk::GlobalInteraction::GetInstance()->GetFocusManager() ->SetFocused(
- mitk::BaseRenderer::GetInstance((*iter)));
- break;
- }
- }
-}
-
-void QmitkMovieMaker::SetRecordingWindow(int window)
-{
- // Set newly selected window for recording
- const mitk::RenderingManager::RenderWindowVector rwv =
- mitk::RenderingManager::GetInstance()->GetAllRegisteredRenderWindows();
-
- //Delete MultiStepper
- DeleteMStepper();
-
- int i;
- mitk::RenderingManager::RenderWindowVector::const_iterator iter;
- for (iter = rwv.begin(), i = 0; iter != rwv.end(); ++iter, ++i)
- {
- if (i == window)
- {
- m_RecordingRenderer = mitk::BaseRenderer::GetInstance((*iter));
- break;
- }
- }
-}
-
-void QmitkMovieMaker::UpdateLooping()
-{
- this->GetAspectStepper()->SetAutoRepeat(m_Looping);
-}
-
-void QmitkMovieMaker::UpdateDirection()
-{
- mitk::Stepper* stepper = this->GetAspectStepper();
-
- switch (m_Direction)
- {
- case 0:
- stepper->InverseDirectionOff();
- stepper->PingPongOff();
- break;
-
- case 1:
- stepper->InverseDirectionOn();
- stepper->PingPongOff();
- break;
-
- case 2:
- stepper->PingPongOn();
- break;
- }
-}
-
-mitk::Stepper* QmitkMovieMaker::GetAspectStepper()
-{
- if (m_Aspect == 0)
- {
- m_Stepper = NULL;
- return this->GetSpatialController()->GetSlice();
- }
- else if (m_Aspect == 1)
- {
- m_Stepper = NULL;
- return this->GetTemporalController()->GetTime();
- }
- else if (m_Aspect == 2)
- {
- if (m_Stepper.IsNull())
- {
- int rel = m_Controls->spatialTimeRelation->value();
- int timeRepeat = 1;
- int sliceRepeat = 1;
- if (rel < 0)
- {
- sliceRepeat = -rel;
- }
- else if (rel > 0)
- {
- timeRepeat = rel;
- }
- m_Stepper = mitk::MultiStepper::New();
- m_Stepper->AddStepper(this->GetSpatialController()->GetSlice(), sliceRepeat);
- m_Stepper->AddStepper(this->GetTemporalController()->GetTime(), timeRepeat);
- }
-
- return m_Stepper.GetPointer();
- }
- else
- {
- // should never get here
- return 0;
- }
-}
-
-void QmitkMovieMaker::GenerateMovie()
-{
- emit StartBlockControls();
-
- // provide the movie generator with the stepper and rotate the camera each step
- if (m_movieGenerator.IsNotNull())
- {
- m_movieGenerator->SetStepper(this->GetAspectStepper());
- m_movieGenerator->SetRenderer(m_RecordingRenderer);
- m_movieGenerator->SetFrameRate(static_cast (360
- / (m_Controls->spnDuration->value())));
-
- // QString movieFileName = QFileDialog::getSaveFileName( QString::null, "Movie (*.avi)", 0, "movie file dialog", "Choose a file name" );
-
- QString movieFileName = QFileDialog::getSaveFileName(0, "Choose a file name", QString::null,
- "Movie (*.avi)", 0, 0);
-
- if (movieFileName.isEmpty() == false)
- {
- mitk::RenderingManager::GetInstance()->RequestUpdateAll();
- m_movieGenerator->SetFileName(movieFileName.toLatin1());
- m_movieGenerator->WriteMovie();
- }
-
- emit EndBlockControls();
- }
- else
- {
- MITK_ERROR << "Either mitk::MovieGenerator is not implemented for your";
- MITK_ERROR << " platform or an error occurred during";
- MITK_ERROR << " mitk::MovieGenerator::New()";
-
- emit EndBlockControlsMovieDeactive();
- }
-}
-
-void QmitkMovieMaker::GenerateScreenshot()
-{
- emit StartBlockControls();
-
- QString fileName = QFileDialog::getSaveFileName(NULL, "Save screenshot to...", QDir::currentPath(), "JPEG file (*.jpg);;PNG file (*.png)");
-
- vtkRenderer* renderer = mitk::GlobalInteraction::GetInstance()->GetFocus()->GetVtkRenderer();
- if (renderer == NULL)
- return;
- this->TakeScreenshot(renderer, 1, fileName);
-
- if (m_movieGenerator.IsNotNull())
- emit EndBlockControls();
- else
- emit EndBlockControlsMovieDeactive();
-}
-
-void QmitkMovieMaker::GenerateHR3DScreenshot()
-{
- emit StartBlockControls();
-
- QString fileName = QFileDialog::getSaveFileName(NULL, "Save screenshot to...", QDir::currentPath(), "JPEG file (*.jpg);;PNG file (*.png)");
-
- // only works correctly for 3D RenderWindow
- vtkRenderer* renderer = m_MultiWidget->mitkWidget4->GetRenderer()->GetVtkRenderer();
- if (renderer == NULL)
- return;
- this->TakeScreenshot(renderer, 4, fileName);
-
- if (m_movieGenerator.IsNotNull())
- emit EndBlockControls();
- else
- emit EndBlockControlsMovieDeactive();
-}
-
-void QmitkMovieMaker::UpdateGUI()
-{
- int bla = this->GetTemporalController()->GetTime()->GetSteps();
- if (bla < 2)
- {
- m_Controls->rbtnTemporal->setEnabled(false);
- m_Controls->rbtnCombined->setEnabled(false);
- m_Controls->spatialTimeRelation->setEnabled(false);
- }
- else
- {
- m_Controls->rbtnTemporal->setEnabled(true);
- m_Controls->rbtnCombined->setEnabled(true);
- m_Controls->spatialTimeRelation->setEnabled(true);
- }
-
-}
-
-void QmitkMovieMaker::DataStorageChanged()
-{
- // UpdateGUI();
-}
-
-void QmitkMovieMaker::CreateQtPartControl(QWidget *parent)
-{
- if (!m_Controls)
- {
- m_Controls = new Ui::QmitkMovieMakerControls;
- m_Controls->setupUi(parent);
-
- m_StepperAdapter = new QmitkStepperAdapter((QObject*) m_Controls->slidAngle,
- this->GetSpatialController()->GetSlice(), "AngleStepperToMovieMakerFunctionality");
-
- // Initialize "Selected Window" combo box
- const mitk::RenderingManager::RenderWindowVector rwv =
- mitk::RenderingManager::GetInstance()->GetAllRegisteredRenderWindows();
-
- mitk::RenderingManager::RenderWindowVector::const_iterator iter;
- unsigned int i = 0;
- for (iter = rwv.begin(); iter != rwv.end(); ++iter)
- {
- QString name(mitk::BaseRenderer::GetInstance((*iter))->GetName());
- if (name=="stdmulti.widget1")
- {
- m_Controls->cmbSelectedStepperWindow->insertItem(i, "Axial");
- m_Controls->cmbSelectedRecordingWindow->insertItem(i++, "Axial");
- }
- else if (name=="stdmulti.widget2")
- {
- m_Controls->cmbSelectedStepperWindow->insertItem(i, "Sagittal");
- m_Controls->cmbSelectedRecordingWindow->insertItem(i++, "Sagittal");
- }
- else if (name=="stdmulti.widget3")
- {
- m_Controls->cmbSelectedStepperWindow->insertItem(i, "Coronal");
- m_Controls->cmbSelectedRecordingWindow->insertItem(i++, "Coronal");
- }
- else if (name=="stdmulti.widget4")
- {
- m_Controls->cmbSelectedStepperWindow->insertItem(i, "3D Window");
- m_Controls->cmbSelectedRecordingWindow->insertItem(i++, "3D Window");
- }
- else
- {
- m_Controls->cmbSelectedStepperWindow->insertItem(i, name);
- m_Controls->cmbSelectedRecordingWindow->insertItem(i++, name);
- }
- }
-
- m_Controls->btnPause->setHidden(true);
- if (m_movieGenerator.IsNull())
- m_Controls->btnMovie->setEnabled(false);
- }
-
- this->CreateConnections();
-
-}
-
-void QmitkMovieMaker::StartPlaying()
-{
- m_Controls->slidAngle->setDisabled(true);
- m_Controls->btnMovie->setEnabled(false);
- m_Controls->btnPlay->setEnabled(false);
- m_Controls->btnScreenshot->setEnabled(false);
-
- // Restart timer with 5 msec interval - this should be fine-grained enough
- // even for high display refresh frequencies
- m_Timer->start(5);
-
- m_Time->restart();
-
- m_Controls->btnPlay->setHidden(true);
- m_Controls->btnPause->setHidden(false);
- if (m_movieGenerator.IsNull())
- m_Controls->btnMovie->setEnabled(false);
-
-}
-
-void QmitkMovieMaker::RBTNForward()
-{
- emit SwitchDirection(0);
-}
-
-void QmitkMovieMaker::RBTNBackward()
-{
- emit SwitchDirection(1);
-}
-
-void QmitkMovieMaker::RBTNPingPong()
-{
- emit SwitchDirection(2);
-}
-
-void QmitkMovieMaker::RBTNSpatial()
-{
- emit SwitchAspect(0);
-}
-
-void QmitkMovieMaker::RBTNTemporal()
-{
- emit SwitchAspect(1);
-}
-
-void QmitkMovieMaker::RBTNCombined()
-{
- emit SwitchAspect(2);
-}
-
-void QmitkMovieMaker::BlockControls()
-{
- BlockControls(true);
-}
-
-void QmitkMovieMaker::UnBlockControls()
-{
- BlockControls(false);
-}
-
-void QmitkMovieMaker::UnBlockControlsMovieDeactive()
-{
- BlockControls(false);
-
- m_Controls->btnMovie->setEnabled(false);
-}
-
-void QmitkMovieMaker::BlockControls(bool blocked)
-{
- m_Controls->slidAngle->setDisabled(blocked);
- m_Controls->spnDuration->setEnabled(!blocked);
- m_Controls->btnPlay->setEnabled(!blocked);
- m_Controls->btnMovie->setEnabled(!blocked);
- m_Controls->btnScreenshot->setEnabled(!blocked);
-}
-
-void QmitkMovieMaker::StdMultiWidgetAvailable(QmitkStdMultiWidget& stdMultiWidget)
-{
- m_MultiWidget = &stdMultiWidget;
- m_Parent->setEnabled(true);
-}
-
-void QmitkMovieMaker::StdMultiWidgetNotAvailable()
-{
- m_MultiWidget = NULL;
- m_Parent->setEnabled(false);
-}
-
-void QmitkMovieMaker::TakeScreenshot(vtkRenderer* renderer, unsigned int magnificationFactor, QString fileName)
-{
- if ((renderer == NULL) ||(magnificationFactor < 1) || fileName.isEmpty())
- return;
-
- bool doubleBuffering( renderer->GetRenderWindow()->GetDoubleBuffer() );
- renderer->GetRenderWindow()->DoubleBufferOff();
-
- vtkImageWriter* fileWriter;
-
- QFileInfo fi(fileName);
- QString suffix = fi.suffix();
- if (suffix.compare("png", Qt::CaseInsensitive) == 0)
- {
- fileWriter = vtkPNGWriter::New();
- }
- else // default is jpeg
- {
- vtkJPEGWriter* w = vtkJPEGWriter::New();
- w->SetQuality(100);
- w->ProgressiveOff();
- fileWriter = w;
- }
- vtkRenderLargeImage* magnifier = vtkRenderLargeImage::New();
- magnifier->SetInput(renderer);
- magnifier->SetMagnification(magnificationFactor);
- //magnifier->Update();
- fileWriter->SetInputConnection(magnifier->GetOutputPort());
- fileWriter->SetFileName(fileName.toLatin1());
-
- // vtkRenderLargeImage has problems with different layers, therefore we have to
- // temporarily deactivate all other layers.
- // we set the background to white, because it is nicer than black...
- double oldBackground[3];
- renderer->GetBackground(oldBackground);
- double white[] = {1.0, 1.0, 1.0};
- renderer->SetBackground(white);
- m_MultiWidget->DisableColoredRectangles();
- m_MultiWidget->DisableDepartmentLogo();
- m_MultiWidget->DisableGradientBackground();
-
- m_MultiWidget->mitkWidget1->ActivateMenuWidget( false );
- m_MultiWidget->mitkWidget2->ActivateMenuWidget( false );
- m_MultiWidget->mitkWidget3->ActivateMenuWidget( false );
- m_MultiWidget->mitkWidget4->ActivateMenuWidget( false );
-
- fileWriter->Write();
- fileWriter->Delete();
-
- m_MultiWidget->mitkWidget1->ActivateMenuWidget( true );
- m_MultiWidget->mitkWidget2->ActivateMenuWidget( true );
- m_MultiWidget->mitkWidget3->ActivateMenuWidget( true );
- m_MultiWidget->mitkWidget4->ActivateMenuWidget( true );
-
- m_MultiWidget->EnableColoredRectangles();
- m_MultiWidget->EnableDepartmentLogo();
- m_MultiWidget->EnableGradientBackground();
- renderer->SetBackground(oldBackground);
-
- renderer->GetRenderWindow()->SetDoubleBuffer(doubleBuffering);
-}
-
-void QmitkMovieMaker::DeleteMStepper()
-{
- m_Stepper = NULL;
- UpdateLooping();
-}
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMaker.h b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMaker.h
deleted file mode 100644
index ea91684197..0000000000
--- a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMaker.h
+++ /dev/null
@@ -1,300 +0,0 @@
-/*===================================================================
-
-The Medical Imaging Interaction Toolkit (MITK)
-
-Copyright (c) German Cancer Research Center,
-Division of Medical and Biological Informatics.
-All rights reserved.
-
-This software is distributed WITHOUT ANY WARRANTY; without
-even the implied warranty of MERCHANTABILITY or FITNESS FOR
-A PARTICULAR PURPOSE.
-
-See LICENSE.txt or http://www.mitk.org for details.
-
-===================================================================*/
-
-#if !defined(QMITK_MOVIEMAKER_H__INCLUDED)
-#define QMITK_MOVIEMAKER_H__INCLUDED
-
-#include "QmitkFunctionality.h"
-#include "mitkCameraRotationController.h"
-#include "mitkStepper.h"
-#include "mitkMultiStepper.h"
-#include "mitkMovieGenerator.h"
-#include "itkCommand.h"
-
-#include "QVTKWidget.h"
-#include "vtkEventQtSlotConnect.h"
-#include "vtkRenderWindow.h"
-#include "mitkVtkPropRenderer.h"
-
-#include "ui_QmitkMovieMakerControls.h"
-//#include "../MovieMakerDll.h"
-
-//class QmitkStdMultiWidget;
-//class QmitkMovieMakerControls;
-class QmitkStepperAdapter;
-class vtkCamera;
-class QTimer;
-class QTime;
-
-/**
- * \brief Functionality for creating movies (AVIs)
- * \ingroup Functionalities
- *
- *
- * - \ref QmitkMovieMakerOverview
- * - \ref QmitkMovieMakerImplementation
- * - \ref QmitkMovieMakerTodo
- *
- * \section QmitkMovieMakerOverview Overview
- *
- * The MovieMaker functionality extends existing modes of data visualization
- * with animation capabilities. The animation aspect determines which
- * aspect of a visualization gets animated. This aspect can be spatial
- * (i.e. the camera position and orientation in a 3D view, or the selected
- * slice in a 2D view), temporal (the time step in a time-based dataset), or
- * something more sophisticated (for example, volume rendering transfer
- * functions might be changed dynamically as part of an animation to produce
- * interesting effects). Currently, the following animation modes are
- * supported:
- *
- * - Rotation of the camera around the dataset (3D views)
- * - Stepping through the dataset slice by slice (2D views)
- * - Stepping through a time-based dataset (2D and 3D views)
- *
- * As can be seen in the screenshot below, the functionality provides cine
- * controls to start, pause and stop the animation. The direction of the
- * animation can be selected (forward, backward or ping-pong). The animation
- * can be set to either the spatial or the temporal aspect, or to both
- * aspects combined. The cycle time determines the duration of one animation
- * loop.
- *
- * In a multi-view scenario, the animation is applied to the currently
- * focussed view. Other views which display the same data may be affected as
- * well.
- *
- * Animations can be written on disk; the corresponding button creates an
- * animation consisting of one single loop and writes every animation frame
- * into an AVI file.
- *
- * \image html QmitkMovieMakerGUI.png
- *
- * \section QmitkMovieMakerImplementation Implementation
- *
- * The following diagram provides an overview over the classes collaborating
- * with QmitkMovieMaker.
- *
- * \image html QmitkMovieMakerClasses.png
- *
- * The respective roles of these classes are:
- * - QmitkMovieMaker
- * - Provides a class interface for configuring and controlling the
- * animation
- * - Is associated with the user interface
- * - As a Functionality, controls initialization and maintainance of the
- * involved components
- * - mitk::BaseController
- * - Controls an animation aspect (slice selection, camera angle, ...)
- * - Subclass mitk::SliceNavigationController: Transfers the animation
- * requests to the associated Renderer for selecting a slice in a 3D
- * dataset
- * - Subclass mitk::CameraRotationController: Modifies the camera angle
- * - mitk::Stepper
- * - Link between MovieMaker and Controller
- * - Holds the current step position of the associated animation aspect
- * (e.g. the camera rotation angle, or the slice number)
- * - mitk::FocusManager
- * - Determines which of the available RenderWindows (and thereby which
- * Renderers) the animation shall be applied to
- * - mitk::BaseRenderer
- * - Controls the rendering of a dataset
- * - Target class of the animation
- * - mitk::MovieGenerator
- * - Writes an AVI file
- *
- *
- * \section QmitkMovieMakerTodo Future plans
- *
- * The basic animation capabilities of this functionality could be extended
- * to allow the creation of more sophisticated animations. Potentially useful
- * features include:
- *
- * - Camera paths: Allow the definition of complex camera paths along
- * which the camera can then be moved during an animation. This might be
- * done by defining camera keyframes between which camera movements are
- * interpolated (as in standard 3D animation applications). Paths derived
- * from anatomical features (e.g. vessel graphs) could also serve as a
- * basis for camera movements.
- * - Color / transfer function animation: Choosing suitable color
- * and transfer functions is critical to the quality and benefit of volume
- * rendering. Dynamically changing transfer functions could visually enrich
- * an animation. One way of achieving this could be to define transfer
- * function keyframes between which an animation interpolates.
- *
- */
-class QmitkMovieMaker: public QmitkFunctionality
-{
- Q_OBJECT
-
-public:
- /** \brief Constructor. */
- QmitkMovieMaker(QObject *parent=0, const char *name=0);
-
- /** \brief Destructor. */
- virtual ~QmitkMovieMaker();
-
- /** \brief Method for creating the widget containing the application
- * controls, like sliders, buttons etc.
- */
- void CreateQtPartControl(QWidget *parent);
- // virtual QWidget * CreateControlWidget(QWidget *parent);
-
- /** \brief Method for creating the connections of main and control widget.
- */
- virtual void CreateConnections();
-
- /** \brief Method for creating an QAction object, i.e. button & menu entry.
- * @param parent the parent QWidget
- */
- // virtual QAction * CreateAction(QActionGroup *parent);
-
- virtual void Activated();
-
- virtual void Deactivated();
-
- /** \brief Called when another window receives the focus. */
- void FocusChange();
-
- virtual void DataStorageChanged();
-
- ///
- /// Called when a StdMultiWidget is available.
- ///
- virtual void StdMultiWidgetAvailable(QmitkStdMultiWidget& stdMultiWidget);
- ///
- /// Called when no StdMultiWidget is available.
- ///
- virtual void StdMultiWidgetNotAvailable();
-
- signals:
- void StartBlockControls();
- void EndBlockControls();
- void EndBlockControlsMovieDeactive();
-
-public slots:
-
- /** \brief Start playing the animation by restarting the timer. */
- void StartPlaying();
-
- /** \brief Pauses playing the animation by stopping the timer. */
- void PausePlaying();
-
- /** \brief Stops playing the animation and resets the stepper. */
- void StopPlaying();
-
- /** \brief Sets animation looping ON/OFF. */
- void SetLooping(bool looping);
-
- /** \brief Sets the direction: 0 = forward, 1 = backward, 2 = pingpong. */
- void SetDirection(int direction);
-
- /** \brief Sets the animation aspect:
- * 0 = spatial, 1 = temporal, 2 = combined.
- */
- void SetAspect(int aspect);
-
- /** \brief Sets a specified stepper window, which is moving. */
- void SetStepperWindow(int window);
-
- /** \brief Sets a specified recording window, from which the movie is generated. */
- void SetRecordingWindow(int window);
-
- /** \brief Advances the animation by one frame.
- * Exactly how much the stepper advances depends on the time elapsed since
- * the last call to this function.
- */
- void AdvanceAnimation();
-
-protected slots:
-
- void RenderSlot();
- void GenerateMovie();
-
- void GenerateScreenshot();
- void GenerateHR3DScreenshot();
- void RBTNForward();
- void RBTNBackward();
- void RBTNPingPong();
- void RBTNSpatial();
- void RBTNTemporal();
- void RBTNCombined();
- void BlockControls();
- void UnBlockControls();
- void UnBlockControlsMovieDeactive();
- void BlockControls(bool blocked);
-
- void DeleteMStepper();
-
- signals:
-
- void SwitchDirection(int);
- void SwitchAspect(int);
- void SwitchSelectedStepperWindow(int);
- void SwitchSelectedRecordingWindow(int);
-
-protected:
-
- QObject *parentWidget;
- QVTKWidget * widget;
- QmitkStdMultiWidget* m_MultiWidget;
- vtkEventQtSlotConnect * connections;
- vtkRenderWindow * renderWindow;
- mitk::VtkPropRenderer::Pointer m_PropRenderer;
-
- Ui::QmitkMovieMakerControls* m_Controls;
-
-private:
- mitk::BaseController* GetSpatialController();
-
- mitk::BaseController* GetTemporalController();
-
- void UpdateLooping();
-
- void UpdateDirection();
-
- void UpdateGUI();
-
- mitk::Stepper* GetAspectStepper();
-
- /*!
- \brief taking a screenshot "from" the specified renderer
- \param magnificationFactor specifying the quality of the screenshot (the magnification of the actual RenderWindow size)
- \param fileName file location and name where the screenshot should be saved
- */
- void TakeScreenshot(vtkRenderer* renderer, unsigned int magnificationFactor, QString fileName);
-
- QmitkStepperAdapter* m_StepperAdapter;
-
- typedef itk::SimpleMemberCommand MemberCommand;
- MemberCommand::Pointer m_FocusManagerCallback;
-
- QTimer* m_Timer;
-
- QTime* m_Time;
-
- bool m_Looping;
- int m_Direction;
-
- int m_Aspect;
- mitk::MultiStepper::Pointer m_Stepper;
- mitk::BaseRenderer * m_RecordingRenderer;
-
- mitk::MovieGenerator::Pointer m_movieGenerator;
-
- unsigned long m_FocusManagerObserverTag;
- unsigned long m_StepperObserverTag;
-
-};
-#endif // !defined(QMITK_MOVIEMAKER_H__INCLUDED)
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMakerControls.ui b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMakerControls.ui
deleted file mode 100644
index 68dd4a6fa2..0000000000
--- a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMakerControls.ui
+++ /dev/null
@@ -1,454 +0,0 @@
-
-
- QmitkMovieMakerControls
-
-
-
- 0
- 0
- 423
- 665
-
-
-
- MovieMaker
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 75
- true
-
-
-
- Window for stepping
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- 75
- true
-
-
-
- Window for recording
-
-
- false
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
- -
-
-
-
- 75
- true
-
-
-
- Recording options
-
-
-
-
-
-
-
-
-
-
- 0
- 0
-
-
-
-
-
-
- Step
-
-
- false
-
-
-
- -
-
-
-
-
- -
-
-
-
-
-
-
- 0
- 0
-
-
-
-
-
-
- Start stepper
-
-
-
-
-
-
- :/org.mitk.gui.qt.moviemaker/resources/play.xpm:/org.mitk.gui.qt.moviemaker/resources/play.xpm
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
- Pause stepper
-
-
-
-
-
-
- :/org.mitk.gui.qt.moviemaker/resources/pause.xpm:/org.mitk.gui.qt.moviemaker/resources/pause.xpm
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
- Stop stepper
-
-
-
-
-
-
- :/org.mitk.gui.qt.moviemaker/resources/stop.xpm:/org.mitk.gui.qt.moviemaker/resources/stop.xpm
-
-
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
- Write Movie (MS Windows only) ...
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
- Writes a screenshot of the selected window.
-
-
- Write Screenshot
-
-
-
- -
-
-
-
- 0
- 0
-
-
-
-
-
-
- Writes a screenshot of the selected window.
-
-
- Write high resolution 3D Screenshot
-
-
-
-
-
-
- -
-
-
-
- 75
- true
-
-
-
- Playing options
-
-
-
-
-
-
-
-
-
-
-
-
-
- Spatial
-
-
- true
-
-
-
- -
-
-
-
-
-
- Temporal
-
-
-
- -
-
-
-
-
-
- Combined
-
-
-
- -
-
-
-
-
-
-
-
-
- S/T Relation
-
-
- false
-
-
-
- -
-
-
-
-
-
- -10
-
-
- 10
-
-
- 0
-
-
-
-
-
-
-
-
- -
-
-
- QFrame::HLine
-
-
- QFrame::Sunken
-
-
-
- -
-
-
-
-
-
-
-
-
-
- Forward
-
-
- true
-
-
-
- -
-
-
-
-
-
- Backward
-
-
-
- -
-
-
-
-
-
- Ping-Pong
-
-
-
- -
-
-
-
-
-
-
-
-
- Cycle (sec)
-
-
- false
-
-
-
- -
-
-
-
-
-
- 1
-
-
- 200
-
-
- 5
-
-
-
-
-
-
-
-
-
-
-
- -
-
-
- Qt::Vertical
-
-
-
- 20
- 31
-
-
-
-
-
-
-
-
-
- QmitkSliderNavigatorWidget
- QWidget
- QmitkSliderNavigatorWidget.h
- 1
-
-
-
- rbtnForward
- rbtnBackward
- rbtnPingPong
- rbtnSpatial
- rbtnTemporal
- cmbSelectedStepperWindow
-
-
-
-
-
-
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMakerView.cpp b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMakerView.cpp
new file mode 100644
index 0000000000..2e6735528a
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMakerView.cpp
@@ -0,0 +1,666 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#include "QmitkAnimationItemDelegate.h"
+#include "QmitkFFmpegWriter.h"
+#include "QmitkMovieMakerView.h"
+#include "QmitkOrbitAnimationItem.h"
+#include "QmitkOrbitAnimationWidget.h"
+#include "QmitkSliceAnimationItem.h"
+#include "QmitkSliceAnimationWidget.h"
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+static QmitkAnimationItem* CreateDefaultAnimation(const QString& widgetKey)
+{
+ if (widgetKey == "Orbit")
+ return new QmitkOrbitAnimationItem;
+
+ if (widgetKey == "Slice")
+ return new QmitkSliceAnimationItem;
+
+ return NULL;
+}
+
+static QString GetFFmpegPath()
+{
+ berry::IPreferencesService::Pointer preferencesService =
+ berry::Platform::GetServiceRegistry().GetServiceById(berry::IPreferencesService::ID);
+
+ berry::IPreferences::Pointer preferences = preferencesService->GetSystemPreferences()->Node("/org.mitk.gui.qt.ext.externalprograms");
+
+ return QString::fromStdString(preferences->Get("ffmpeg", ""));
+}
+
+static unsigned char* ReadPixels(vtkRenderWindow* renderWindow, int x, int y, int width, int height)
+{
+ if (renderWindow == NULL)
+ return NULL;
+
+ unsigned char* frame = new unsigned char[width * height * 3];
+
+ renderWindow->MakeCurrent();
+ glReadPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, frame);
+
+ return frame;
+}
+
+const std::string QmitkMovieMakerView::VIEW_ID = "org.mitk.views.moviemaker";
+
+QmitkMovieMakerView::QmitkMovieMakerView()
+ : m_FFmpegWriter(NULL),
+ m_Ui(new Ui::QmitkMovieMakerView),
+ m_AnimationModel(NULL),
+ m_AddAnimationMenu(NULL),
+ m_RecordMenu(NULL),
+ m_Timer(NULL),
+ m_TotalDuration(0.0),
+ m_NumFrames(0),
+ m_CurrentFrame(0)
+{
+}
+
+QmitkMovieMakerView::~QmitkMovieMakerView()
+{
+}
+
+void QmitkMovieMakerView::CreateQtPartControl(QWidget* parent)
+{
+ m_FFmpegWriter = new QmitkFFmpegWriter(parent);
+
+ m_Ui->setupUi(parent);
+
+ this->InitializeAnimationWidgets();
+ this->InitializeAnimationTreeViewWidgets();
+ this->InitializePlaybackAndRecordWidgets();
+ this->InitializeTimer(parent);
+
+ m_Ui->animationWidgetGroupBox->setVisible(false);
+}
+
+void QmitkMovieMakerView::InitializeAnimationWidgets()
+{
+ m_AnimationWidgets["Orbit"] = new QmitkOrbitAnimationWidget;
+ m_AnimationWidgets["Slice"] = new QmitkSliceAnimationWidget;
+
+ Q_FOREACH(QWidget* widget, m_AnimationWidgets.values())
+ {
+ if (widget != NULL)
+ {
+ widget->setVisible(false);
+ m_Ui->animationWidgetGroupBoxLayout->addWidget(widget);
+ }
+ }
+
+ this->ConnectAnimationWidgets();
+}
+
+void QmitkMovieMakerView::InitializeAnimationTreeViewWidgets()
+{
+ this->InitializeAnimationModel();
+ this->InitializeAddAnimationMenu();
+ this->ConnectAnimationTreeViewWidgets();
+}
+
+void QmitkMovieMakerView::InitializePlaybackAndRecordWidgets()
+{
+ this->InitializeRecordMenu();
+ this->ConnectPlaybackAndRecordWidgets();
+}
+
+void QmitkMovieMakerView::InitializeAnimationModel()
+{
+ m_AnimationModel = new QStandardItemModel(m_Ui->animationTreeView);
+ m_AnimationModel->setHorizontalHeaderLabels(QStringList() << "Animation" << "Timeline");
+ m_Ui->animationTreeView->setModel(m_AnimationModel);
+
+ m_Ui->animationTreeView->setItemDelegate(new QmitkAnimationItemDelegate(m_Ui->animationTreeView));
+}
+
+void QmitkMovieMakerView::InitializeAddAnimationMenu()
+{
+ m_AddAnimationMenu = new QMenu(m_Ui->addAnimationButton);
+
+ Q_FOREACH(const QString& key, m_AnimationWidgets.keys())
+ {
+ m_AddAnimationMenu->addAction(key);
+ }
+}
+
+void QmitkMovieMakerView::InitializeRecordMenu()
+{
+ typedef QPair PairOfStrings;
+
+ m_RecordMenu = new QMenu(m_Ui->recordButton);
+
+ QVector renderWindows;
+ renderWindows.push_back(qMakePair(QString("Axial"), QString("stdmulti.widget1")));
+ renderWindows.push_back(qMakePair(QString("Sagittal"), QString("stdmulti.widget2")));
+ renderWindows.push_back(qMakePair(QString("Coronal"), QString("stdmulti.widget3")));
+ renderWindows.push_back(qMakePair(QString("3D"), QString("stdmulti.widget4")));
+
+ Q_FOREACH(const PairOfStrings& renderWindow, renderWindows)
+ {
+ QAction* action = new QAction(m_RecordMenu);
+ action->setText(renderWindow.first);
+ action->setData(renderWindow.second);
+
+ m_RecordMenu->addAction(action);
+ }
+}
+
+void QmitkMovieMakerView::InitializeTimer(QWidget* parent)
+{
+ m_Timer = new QTimer(parent);
+
+ this->OnFPSSpinBoxValueChanged(m_Ui->fpsSpinBox->value());
+ this->ConnectTimer();
+}
+
+void QmitkMovieMakerView::ConnectAnimationTreeViewWidgets()
+{
+ this->connect(m_AnimationModel, SIGNAL(rowsInserted(const QModelIndex&, int, int)),
+ this, SLOT(OnAnimationTreeViewRowsInserted(const QModelIndex&, int, int)));
+
+ this->connect(m_AnimationModel, SIGNAL(rowsRemoved(const QModelIndex&, int, int)),
+ this, SLOT(OnAnimationTreeViewRowsRemoved(const QModelIndex&, int, int)));
+
+ this->connect(m_Ui->animationTreeView->selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
+ this, SLOT(OnAnimationTreeViewSelectionChanged(const QItemSelection&, const QItemSelection&)));
+
+ this->connect(m_Ui->moveAnimationUpButton, SIGNAL(clicked()),
+ this, SLOT(OnMoveAnimationUpButtonClicked()));
+
+ this->connect(m_Ui->moveAnimationDownButton, SIGNAL(clicked()),
+ this, SLOT(OnMoveAnimationDownButtonClicked()));
+
+ this->connect(m_Ui->addAnimationButton, SIGNAL(clicked()),
+ this, SLOT(OnAddAnimationButtonClicked()));
+
+ this->connect(m_Ui->removeAnimationButton, SIGNAL(clicked()),
+ this, SLOT(OnRemoveAnimationButtonClicked()));
+}
+
+void QmitkMovieMakerView::ConnectAnimationWidgets()
+{
+ this->connect(m_Ui->startComboBox, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(OnStartComboBoxCurrentIndexChanged(int)));
+
+ this->connect(m_Ui->durationSpinBox, SIGNAL(valueChanged(double)),
+ this, SLOT(OnDurationSpinBoxValueChanged(double)));
+
+ this->connect(m_Ui->delaySpinBox, SIGNAL(valueChanged(double)),
+ this, SLOT(OnDelaySpinBoxValueChanged(double)));
+}
+
+void QmitkMovieMakerView::ConnectPlaybackAndRecordWidgets()
+{
+ this->connect(m_Ui->playButton, SIGNAL(toggled(bool)),
+ this, SLOT(OnPlayButtonToggled(bool)));
+
+ this->connect(m_Ui->stopButton, SIGNAL(clicked()),
+ this, SLOT(OnStopButtonClicked()));
+
+ this->connect(m_Ui->recordButton, SIGNAL(clicked()),
+ this, SLOT(OnRecordButtonClicked()));
+
+ this->connect(m_Ui->fpsSpinBox, SIGNAL(valueChanged(int)),
+ this, SLOT(OnFPSSpinBoxValueChanged(int)));
+}
+
+void QmitkMovieMakerView::ConnectTimer()
+{
+ this->connect(m_Timer, SIGNAL(timeout()),
+ this, SLOT(OnTimerTimeout()));
+}
+
+void QmitkMovieMakerView::SetFocus()
+{
+ m_Ui->addAnimationButton->setFocus();
+}
+
+void QmitkMovieMakerView::OnMoveAnimationUpButtonClicked()
+{
+ const QItemSelection selection = m_Ui->animationTreeView->selectionModel()->selection();
+
+ if (!selection.isEmpty())
+ {
+ const int selectedRow = selection[0].top();
+
+ if (selectedRow > 0)
+ m_AnimationModel->insertRow(selectedRow - 1, m_AnimationModel->takeRow(selectedRow));
+ }
+
+ this->CalculateTotalDuration();
+}
+
+void QmitkMovieMakerView::OnMoveAnimationDownButtonClicked()
+{
+ const QItemSelection selection = m_Ui->animationTreeView->selectionModel()->selection();
+
+ if (!selection.isEmpty())
+ {
+ const int rowCount = m_AnimationModel->rowCount();
+ const int selectedRow = selection[0].top();
+
+ if (selectedRow < rowCount - 1)
+ m_AnimationModel->insertRow(selectedRow + 1, m_AnimationModel->takeRow(selectedRow));
+ }
+
+ this->CalculateTotalDuration();
+}
+
+void QmitkMovieMakerView::OnAddAnimationButtonClicked()
+{
+ QAction* action = m_AddAnimationMenu->exec(QCursor::pos());
+
+ if (action != NULL)
+ {
+ const QString widgetKey = action->text();
+
+ m_AnimationModel->appendRow(QList()
+ << new QStandardItem(widgetKey)
+ << CreateDefaultAnimation(widgetKey));
+
+ m_Ui->playbackAndRecordingGroupBox->setEnabled(true);
+ }
+}
+
+void QmitkMovieMakerView::OnPlayButtonToggled(bool checked)
+{
+ if (checked)
+ {
+ m_Ui->playButton->setIcon(QIcon(":/org_mitk_icons/icons/tango/scalable/actions/media-playback-pause.svg"));
+ m_Ui->playButton->repaint();
+
+ m_Timer->start(static_cast(1000.0 / m_Ui->fpsSpinBox->value()));
+ }
+ else
+ {
+ m_Timer->stop();
+
+ m_Ui->playButton->setIcon(QIcon(":/org_mitk_icons/icons/tango/scalable/actions/media-playback-start.svg"));
+ m_Ui->playButton->repaint();
+ }
+}
+
+void QmitkMovieMakerView::OnStopButtonClicked()
+{
+ m_Ui->playButton->setChecked(false);
+ m_Ui->stopButton->setEnabled(false);
+
+ m_CurrentFrame = 0;
+ this->RenderCurrentFrame();
+}
+
+void QmitkMovieMakerView::OnRecordButtonClicked() // TODO: Refactor
+{
+ const QString ffmpegPath = GetFFmpegPath();
+
+ if (ffmpegPath.isEmpty())
+ {
+ QMessageBox::information(NULL, "Movie Maker", "Set path to FFmpeg or Libav (avconv) in preferences (Window -> Preferences... (Ctrl+P) -> External Programs) to be able to record your movies to video files.");
+ return;
+ }
+
+ m_FFmpegWriter->SetFFmpegPath(GetFFmpegPath());
+
+ QAction* action = m_RecordMenu->exec(QCursor::pos());
+
+ if (action == NULL)
+ return;
+
+ vtkRenderWindow* renderWindow = mitk::BaseRenderer::GetRenderWindowByName(action->data().toString().toStdString());
+
+ if (renderWindow == NULL)
+ return;
+
+ const int border = 3;
+ const int x = border;
+ const int y = border;
+ int width = renderWindow->GetSize()[0] - border * 2;
+ int height = renderWindow->GetSize()[1] - border * 2;
+
+ if (width & 1)
+ --width;
+
+ if (height & 1)
+ --height;
+
+ if (width < 16 || height < 16)
+ return;
+
+ m_FFmpegWriter->SetSize(width, height);
+ m_FFmpegWriter->SetFramerate(m_Ui->fpsSpinBox->value());
+
+ QString saveFileName = QFileDialog::getSaveFileName(NULL, "Specify a filename", "", "Movie (*.mp4)");
+
+ if (saveFileName.isEmpty())
+ return;
+
+ if(!saveFileName.endsWith(".mp4"))
+ saveFileName += ".mp4";
+
+ m_FFmpegWriter->SetOutputPath(saveFileName);
+
+ try
+ {
+ m_FFmpegWriter->Start();
+
+ for (m_CurrentFrame = 0; m_CurrentFrame < m_NumFrames; ++m_CurrentFrame)
+ {
+ this->RenderCurrentFrame();
+
+ renderWindow->MakeCurrent();
+ unsigned char* frame = ReadPixels(renderWindow, x, y, width, height);
+ m_FFmpegWriter->WriteFrame(frame);
+ delete[] frame;
+ }
+
+ m_FFmpegWriter->Stop();
+
+ m_CurrentFrame = 0;
+ this->RenderCurrentFrame();
+ }
+ catch (const mitk::Exception& exception)
+ {
+ m_CurrentFrame = 0;
+ this->RenderCurrentFrame();
+
+ QMessageBox::critical(NULL, "Movie Maker", exception.GetDescription());
+ }
+}
+
+void QmitkMovieMakerView::OnRemoveAnimationButtonClicked()
+{
+ const QItemSelection selection = m_Ui->animationTreeView->selectionModel()->selection();
+
+ if (!selection.isEmpty())
+ m_AnimationModel->removeRow(selection[0].top());
+}
+
+void QmitkMovieMakerView::OnAnimationTreeViewRowsInserted(const QModelIndex& parent, int start, int)
+{
+ this->CalculateTotalDuration();
+
+ m_Ui->animationTreeView->selectionModel()->select(
+ m_AnimationModel->index(start, 0, parent),
+ QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Rows);
+}
+
+void QmitkMovieMakerView::OnAnimationTreeViewRowsRemoved(const QModelIndex&, int, int)
+{
+ this->CalculateTotalDuration();
+ this->UpdateWidgets();
+}
+
+void QmitkMovieMakerView::OnAnimationTreeViewSelectionChanged(const QItemSelection&, const QItemSelection&)
+{
+ this->UpdateWidgets();
+}
+
+void QmitkMovieMakerView::OnStartComboBoxCurrentIndexChanged(int index)
+{
+ QmitkAnimationItem* item = this->GetSelectedAnimationItem();
+
+ if (item != NULL)
+ {
+ item->SetStartWithPrevious(index);
+ this->RedrawTimeline();
+ this->CalculateTotalDuration();
+ }
+}
+
+void QmitkMovieMakerView::OnDurationSpinBoxValueChanged(double value)
+{
+ QmitkAnimationItem* item = this->GetSelectedAnimationItem();
+
+ if (item != NULL)
+ {
+ item->SetDuration(value);
+ this->RedrawTimeline();
+ this->CalculateTotalDuration();
+ }
+}
+
+void QmitkMovieMakerView::OnDelaySpinBoxValueChanged(double value)
+{
+ QmitkAnimationItem* item = this->GetSelectedAnimationItem();
+
+ if (item != NULL)
+ {
+ item->SetDelay(value);
+ this->RedrawTimeline();
+ this->CalculateTotalDuration();
+ }
+}
+
+void QmitkMovieMakerView::OnFPSSpinBoxValueChanged(int value)
+{
+ this->CalculateTotalDuration();
+ m_Timer->setInterval(static_cast(1000.0 / value));
+}
+
+void QmitkMovieMakerView::OnTimerTimeout()
+{
+ this->RenderCurrentFrame();
+
+ m_CurrentFrame = std::min(m_NumFrames, m_CurrentFrame + 1);
+
+ if (m_CurrentFrame >= m_NumFrames)
+ {
+ m_Ui->playButton->setChecked(false);
+
+ m_CurrentFrame = 0;
+ this->RenderCurrentFrame();
+ }
+
+ m_Ui->stopButton->setEnabled(m_CurrentFrame != 0);
+}
+
+void QmitkMovieMakerView::RenderCurrentFrame()
+{
+ typedef QPair AnimationIterpolationFactorPair;
+
+ const double deltaT = m_TotalDuration / (m_NumFrames - 1);
+ const QVector activeAnimations = this->GetActiveAnimations(m_CurrentFrame * deltaT);
+
+ Q_FOREACH(const AnimationIterpolationFactorPair& animation, activeAnimations)
+ {
+ animation.first->Animate(animation.second);
+ }
+
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
+}
+
+void QmitkMovieMakerView::UpdateWidgets()
+{
+ const QItemSelection selection = m_Ui->animationTreeView->selectionModel()->selection();
+
+ if (selection.isEmpty())
+ {
+ m_Ui->moveAnimationUpButton->setEnabled(false);
+ m_Ui->moveAnimationDownButton->setEnabled(false);
+ m_Ui->removeAnimationButton->setEnabled(false);
+ m_Ui->playbackAndRecordingGroupBox->setEnabled(false);
+
+ this->HideCurrentAnimationWidget();
+ }
+ else
+ {
+ const int rowCount = m_AnimationModel->rowCount();
+ const int selectedRow = selection[0].top();
+
+ m_Ui->moveAnimationUpButton->setEnabled(rowCount > 1 && selectedRow != 0);
+ m_Ui->moveAnimationDownButton->setEnabled(rowCount > 1 && selectedRow < rowCount - 1);
+ m_Ui->removeAnimationButton->setEnabled(true);
+ m_Ui->playbackAndRecordingGroupBox->setEnabled(true);
+
+ this->ShowAnimationWidget(dynamic_cast(m_AnimationModel->item(selectedRow, 1)));
+ }
+
+ this->UpdateAnimationWidgets();
+}
+
+void QmitkMovieMakerView::UpdateAnimationWidgets()
+{
+ QmitkAnimationItem* item = this->GetSelectedAnimationItem();
+
+ if (item != NULL)
+ {
+ m_Ui->startComboBox->setCurrentIndex(item->GetStartWithPrevious());
+ m_Ui->durationSpinBox->setValue(item->GetDuration());
+ m_Ui->delaySpinBox->setValue(item->GetDelay());
+
+ m_Ui->animationGroupBox->setEnabled(true);
+ }
+ else
+ {
+ m_Ui->animationGroupBox->setEnabled(false);
+ }
+}
+
+void QmitkMovieMakerView::HideCurrentAnimationWidget()
+{
+ if (m_Ui->animationWidgetGroupBox->isVisible())
+ {
+ m_Ui->animationWidgetGroupBox->setVisible(false);
+
+ int numWidgets = m_Ui->animationWidgetGroupBoxLayout->count();
+
+ for (int i = 0; i < numWidgets; ++i)
+ m_Ui->animationWidgetGroupBoxLayout->itemAt(i)->widget()->setVisible(false);
+ }
+}
+
+void QmitkMovieMakerView::ShowAnimationWidget(QmitkAnimationItem* animationItem)
+{
+ this->HideCurrentAnimationWidget();
+
+ if (animationItem == NULL)
+ return;
+
+ const QString widgetKey = animationItem->GetWidgetKey();
+ QmitkAnimationWidget* animationWidget = NULL;
+
+ if (m_AnimationWidgets.contains(widgetKey))
+ {
+ animationWidget = m_AnimationWidgets[widgetKey];
+
+ if (animationWidget != NULL)
+ {
+ m_Ui->animationWidgetGroupBox->setTitle(widgetKey);
+ animationWidget->SetAnimationItem(animationItem);
+ animationWidget->setVisible(true);
+ }
+ }
+
+ m_Ui->animationWidgetGroupBox->setVisible(animationWidget != NULL);
+}
+
+void QmitkMovieMakerView::RedrawTimeline()
+{
+ if (m_AnimationModel->rowCount() > 1)
+ {
+ m_Ui->animationTreeView->dataChanged(
+ m_AnimationModel->index(0, 1),
+ m_AnimationModel->index(m_AnimationModel->rowCount() - 1, 1));
+ }
+}
+
+QmitkAnimationItem* QmitkMovieMakerView::GetSelectedAnimationItem() const
+{
+ const QItemSelection selection = m_Ui->animationTreeView->selectionModel()->selection();
+
+ return !selection.isEmpty()
+ ? dynamic_cast(m_AnimationModel->item(selection[0].top(), 1))
+ : NULL;
+}
+
+void QmitkMovieMakerView::CalculateTotalDuration()
+{
+ const int rowCount = m_AnimationModel->rowCount();
+
+ double totalDuration = 0.0;
+ double previousStart = 0.0;
+
+ for (int i = 0; i < rowCount; ++i)
+ {
+ QmitkAnimationItem* item = dynamic_cast(m_AnimationModel->item(i, 1));
+
+ if (item == NULL)
+ continue;
+
+ if (item->GetStartWithPrevious())
+ {
+ totalDuration = std::max(totalDuration, previousStart + item->GetDelay() + item->GetDuration());
+ }
+ else
+ {
+ previousStart = totalDuration;
+ totalDuration += item->GetDelay() + item->GetDuration();
+ }
+ }
+
+ m_TotalDuration = totalDuration; // TODO totalDuration == 0
+ m_NumFrames = static_cast(totalDuration * m_Ui->fpsSpinBox->value()); // TODO numFrames < 2
+}
+
+QVector > QmitkMovieMakerView::GetActiveAnimations(double t) const
+{
+ const int rowCount = m_AnimationModel->rowCount();
+
+ QVector > activeAnimations;
+
+ double totalDuration = 0.0;
+ double previousStart = 0.0;
+
+ for (int i = 0; i < rowCount; ++i)
+ {
+ QmitkAnimationItem* item = dynamic_cast(m_AnimationModel->item(i, 1));
+
+ if (item == NULL)
+ continue;
+
+ if (item->GetDuration() > 0.0)
+ {
+ double start = item->GetStartWithPrevious()
+ ? previousStart + item->GetDelay()
+ : totalDuration + item->GetDelay();
+
+ if (start <= t && t <= start + item->GetDuration())
+ activeAnimations.push_back(qMakePair(item, (t - start) / item->GetDuration()));
+ }
+
+ if (item->GetStartWithPrevious())
+ {
+ totalDuration = std::max(totalDuration, previousStart + item->GetDelay() + item->GetDuration());
+ }
+ else
+ {
+ previousStart = totalDuration;
+ totalDuration += item->GetDelay() + item->GetDuration();
+ }
+ }
+
+ return activeAnimations;
+}
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMakerView.h b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMakerView.h
new file mode 100644
index 0000000000..f686ba79b9
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMakerView.h
@@ -0,0 +1,98 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#ifndef QmitkMovieMakerView_h
+#define QmitkMovieMakerView_h
+
+#include
+
+class QmitkAnimationItem;
+class QmitkAnimationWidget;
+class QmitkFFmpegWriter;
+class QMenu;
+class QStandardItemModel;
+class QTimer;
+
+namespace Ui
+{
+ class QmitkMovieMakerView;
+}
+
+class QmitkMovieMakerView : public QmitkAbstractView
+{
+ Q_OBJECT
+
+public:
+ static const std::string VIEW_ID;
+
+ QmitkMovieMakerView();
+ ~QmitkMovieMakerView();
+
+ void CreateQtPartControl(QWidget* parent);
+ void SetFocus();
+
+private slots:
+ void OnMoveAnimationUpButtonClicked();
+ void OnMoveAnimationDownButtonClicked();
+ void OnAddAnimationButtonClicked();
+ void OnRemoveAnimationButtonClicked();
+ void OnAnimationTreeViewRowsInserted(const QModelIndex& parent, int start, int end);
+ void OnAnimationTreeViewRowsRemoved(const QModelIndex& parent, int start, int end);
+ void OnAnimationTreeViewSelectionChanged(const QItemSelection& selected, const QItemSelection& deselected);
+ void OnStartComboBoxCurrentIndexChanged(int index);
+ void OnDurationSpinBoxValueChanged(double value);
+ void OnDelaySpinBoxValueChanged(double value);
+ void OnPlayButtonToggled(bool checked);
+ void OnStopButtonClicked();
+ void OnRecordButtonClicked();
+ void OnFPSSpinBoxValueChanged(int value);
+ void OnTimerTimeout();
+
+private:
+ void InitializeAnimationWidgets();
+ void InitializeAnimationTreeViewWidgets();
+ void InitializeAnimationModel();
+ void InitializeAddAnimationMenu();
+ void InitializePlaybackAndRecordWidgets();
+ void InitializeRecordMenu();
+ void InitializeTimer(QWidget* parent);
+ void ConnectAnimationTreeViewWidgets();
+ void ConnectAnimationWidgets();
+ void ConnectPlaybackAndRecordWidgets();
+ void ConnectTimer();
+ void RenderCurrentFrame();
+ void UpdateWidgets();
+ void UpdateAnimationWidgets();
+ void HideCurrentAnimationWidget();
+ void ShowAnimationWidget(QmitkAnimationItem* animationItem);
+ void RedrawTimeline();
+ void CalculateTotalDuration();
+ QmitkAnimationItem* GetSelectedAnimationItem() const;
+ QVector > GetActiveAnimations(double t) const;
+
+ QmitkFFmpegWriter* m_FFmpegWriter;
+ Ui::QmitkMovieMakerView* m_Ui;
+ QStandardItemModel* m_AnimationModel;
+ QMap m_AnimationWidgets;
+ QMenu* m_AddAnimationMenu;
+ QMenu* m_RecordMenu;
+ QTimer* m_Timer;
+ double m_TotalDuration;
+ int m_NumFrames;
+ int m_CurrentFrame;
+};
+
+#endif
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMakerView.ui b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMakerView.ui
new file mode 100644
index 0000000000..ccbd70bb83
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMakerView.ui
@@ -0,0 +1,507 @@
+
+
+ QmitkMovieMakerView
+
+
+ true
+
+
+
+ 0
+ 0
+ 320
+ 640
+
+
+
+ Movie Maker
+
+
+ -
+
+
-
+
+
+ false
+
+
+ Move animation up
+
+
+
+ :/org_mitk_icons/icons/tango/scalable/actions/go-up.svg:/org_mitk_icons/icons/tango/scalable/actions/go-up.svg
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ false
+
+
+ Move animation down
+
+
+
+ :/org_mitk_icons/icons/tango/scalable/actions/go-down.svg:/org_mitk_icons/icons/tango/scalable/actions/go-down.svg
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ Add animation
+
+
+
+ :/org_mitk_icons/icons/tango/scalable/actions/list-add.svg:/org_mitk_icons/icons/tango/scalable/actions/list-add.svg
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ false
+
+
+ Remove animation
+
+
+
+ :/org_mitk_icons/icons/tango/scalable/actions/list-remove.svg:/org_mitk_icons/icons/tango/scalable/actions/list-remove.svg
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 0
+ 100
+
+
+
+
+ 16777215
+ 100
+
+
+
+ false
+
+
+ true
+
+
+ 80
+
+
+
+
+
+ -
+
+
+ false
+
+
+ Animation
+
+
+
-
+
+
+
+ 0
+ 0
+
+
+
+
+ 24
+ 24
+
+
+
+
+ 24
+ 24
+
+
+
+
+
+
+ :/org_mitk_icons/icons/tango/scalable/actions/media-playback-start.svg
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Start:
+
+
+ startComboBox
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
-
+
+ After previous
+
+
+ -
+
+ With previous
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 24
+ 24
+
+
+
+
+ 24
+ 24
+
+
+
+
+
+
+ :/QmitkMovieMakerView/duration.svg
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Duration:
+
+
+ durationSpinBox
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ s
+
+
+ 100.000000000000000
+
+
+ 0.500000000000000
+
+
+ 2.000000000000000
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+
+ 24
+ 24
+
+
+
+
+ 24
+ 24
+
+
+
+
+
+
+ :/QmitkMovieMakerView/delay.svg
+
+
+ true
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Delay:
+
+
+ delaySpinBox
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ s
+
+
+ 100.000000000000000
+
+
+ 0.500000000000000
+
+
+
+
+
+
+ -
+
+
+
+
+ -
+
+
+ false
+
+
+ Playback && Recording
+
+
+
-
+
+
+ Play
+
+
+
+ :/org_mitk_icons/icons/tango/scalable/actions/media-playback-start.svg:/org_mitk_icons/icons/tango/scalable/actions/media-playback-start.svg
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+ true
+
+
+
+ -
+
+
+ false
+
+
+ Stop
+
+
+
+ :/org_mitk_icons/icons/tango/scalable/actions/media-playback-stop.svg:/org_mitk_icons/icons/tango/scalable/actions/media-playback-stop.svg
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+ 40
+ 20
+
+
+
+
+ -
+
+
+ Record
+
+
+
+ :/org_mitk_icons/icons/tango/scalable/actions/media-record.svg:/org_mitk_icons/icons/tango/scalable/actions/media-record.svg
+
+
+
+ 24
+ 24
+
+
+
+ true
+
+
+
+ -
+
+
+ Frames per second
+
+
+ FPS
+
+
+ 1
+
+
+ 120
+
+
+ 30
+
+
+
+
+
+
+ -
+
+
+ Qt::Vertical
+
+
+
+ 20
+ 227
+
+
+
+
+
+
+
+ animationTreeView
+ moveAnimationUpButton
+ moveAnimationDownButton
+ addAnimationButton
+ removeAnimationButton
+ startComboBox
+ durationSpinBox
+ delaySpinBox
+ playButton
+ stopButton
+ recordButton
+ fpsSpinBox
+
+
+
+
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkOrbitAnimationItem.cpp b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkOrbitAnimationItem.cpp
new file mode 100644
index 0000000000..a65c898f31
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkOrbitAnimationItem.cpp
@@ -0,0 +1,85 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#include "QmitkOrbitAnimationItem.h"
+#include
+
+QmitkOrbitAnimationItem::QmitkOrbitAnimationItem(int startAngle, int orbit, bool reverse, double duration, double delay, bool startWithPrevious)
+ : QmitkAnimationItem("Orbit", duration, delay, startWithPrevious)
+{
+ this->SetStartAngle(startAngle);
+ this->SetOrbit(orbit);
+ this->SetReverse(reverse);
+}
+
+QmitkOrbitAnimationItem::~QmitkOrbitAnimationItem()
+{
+}
+
+int QmitkOrbitAnimationItem::GetStartAngle() const
+{
+ return this->data(StartAngleRole).toInt();
+}
+
+void QmitkOrbitAnimationItem::SetStartAngle(int angle)
+{
+ this->setData(angle, StartAngleRole);
+}
+
+int QmitkOrbitAnimationItem::GetOrbit() const
+{
+ return this->data(OrbitRole).toInt();
+}
+
+void QmitkOrbitAnimationItem::SetOrbit(int angle)
+{
+ this->setData(angle, OrbitRole);
+}
+
+bool QmitkOrbitAnimationItem::GetReverse() const
+{
+ return this->data(ReverseRole).toBool();
+}
+
+void QmitkOrbitAnimationItem::SetReverse(bool reverse)
+{
+ this->setData(reverse, ReverseRole);
+}
+
+void QmitkOrbitAnimationItem::Animate(double s)
+{
+ vtkRenderWindow* renderWindow = mitk::BaseRenderer::GetRenderWindowByName("stdmulti.widget4");
+
+ if (renderWindow == NULL)
+ return;
+
+ mitk::Stepper* stepper = mitk::BaseRenderer::GetInstance(renderWindow)->GetCameraRotationController()->GetSlice();
+
+ if (stepper == NULL)
+ return;
+
+ int newPos = this->GetReverse()
+ ? this->GetStartAngle() - this->GetOrbit() * s
+ : this->GetStartAngle() + this->GetOrbit() * s;
+
+ while (newPos < 0)
+ newPos += 360;
+
+ while (newPos > 360)
+ newPos -= 360;
+
+ stepper->SetPos(static_cast(newPos));
+}
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkOrbitAnimationItem.h b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkOrbitAnimationItem.h
new file mode 100644
index 0000000000..4198afba73
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkOrbitAnimationItem.h
@@ -0,0 +1,40 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#ifndef QmitkOrbitAnimationItem_h
+#define QmitkOrbitAnimationItem_h
+
+#include "QmitkAnimationItem.h"
+
+class QmitkOrbitAnimationItem : public QmitkAnimationItem
+{
+public:
+ explicit QmitkOrbitAnimationItem(int startAngle = 180, int orbit = 360, bool reverse = false, double duration = 2.0, double delay = 0.0, bool startWithPrevious = false);
+ virtual ~QmitkOrbitAnimationItem();
+
+ int GetStartAngle() const;
+ void SetStartAngle(int angle);
+
+ int GetOrbit() const;
+ void SetOrbit(int angle);
+
+ bool GetReverse() const;
+ void SetReverse(bool reverse);
+
+ void Animate(double s);
+};
+
+#endif
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkOrbitAnimationWidget.cpp b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkOrbitAnimationWidget.cpp
new file mode 100644
index 0000000000..0daae05426
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkOrbitAnimationWidget.cpp
@@ -0,0 +1,89 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#include "QmitkOrbitAnimationItem.h"
+#include "QmitkOrbitAnimationWidget.h"
+#include
+#include
+
+QmitkOrbitAnimationWidget::QmitkOrbitAnimationWidget(QWidget* parent)
+ : QmitkAnimationWidget(parent),
+ m_Ui(new Ui::QmitkOrbitAnimationWidget)
+{
+ m_Ui->setupUi(this);
+
+ m_Ui->orbitLineEdit->setValidator(new QIntValidator(0, std::numeric_limits::max(), this));
+
+ this->connect(m_Ui->startAngleSlider, SIGNAL(valueChanged(int)),
+ m_Ui->startAngleSpinBox, SLOT(setValue(int)));
+
+ this->connect(m_Ui->startAngleSpinBox, SIGNAL(valueChanged(int)),
+ m_Ui->startAngleSlider, SLOT(setValue(int)));
+
+ this->connect(m_Ui->startAngleSpinBox, SIGNAL(valueChanged(int)),
+ this, SLOT(OnStartAngleChanged(int)));
+
+ this->connect(m_Ui->orbitLineEdit, SIGNAL(editingFinished()),
+ this, SLOT(OnOrbitEditingFinished()));
+
+ this->connect(m_Ui->reverseCheckBox, SIGNAL(clicked(bool)),
+ this, SLOT(OnReverseChanged(bool)));
+}
+
+QmitkOrbitAnimationWidget::~QmitkOrbitAnimationWidget()
+{
+}
+
+void QmitkOrbitAnimationWidget::SetAnimationItem(QmitkAnimationItem* orbitAnimationItem)
+{
+ m_AnimationItem = dynamic_cast(orbitAnimationItem);
+
+ if (m_AnimationItem == NULL)
+ return;
+
+ m_Ui->startAngleSlider->setValue(m_AnimationItem->GetStartAngle());
+ m_Ui->orbitLineEdit->setText(QString("%1").arg(m_AnimationItem->GetOrbit()));
+ m_Ui->reverseCheckBox->setChecked(m_AnimationItem->GetReverse());
+}
+
+void QmitkOrbitAnimationWidget::OnStartAngleChanged(int angle)
+{
+ if (m_AnimationItem == NULL)
+ return;
+
+ if (m_AnimationItem->GetStartAngle() != angle)
+ m_AnimationItem->SetStartAngle(angle);
+}
+
+void QmitkOrbitAnimationWidget::OnOrbitEditingFinished()
+{
+ if (m_AnimationItem == NULL)
+ return;
+
+ int angle = m_Ui->orbitLineEdit->text().toInt();
+
+ if (m_AnimationItem->GetOrbit() != angle)
+ m_AnimationItem->SetOrbit(angle);
+}
+
+void QmitkOrbitAnimationWidget::OnReverseChanged(bool reverse)
+{
+ if (m_AnimationItem == NULL)
+ return;
+
+ if (m_AnimationItem->GetReverse() != reverse)
+ m_AnimationItem->SetReverse(reverse);
+}
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkOrbitAnimationWidget.h b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkOrbitAnimationWidget.h
new file mode 100644
index 0000000000..e343cfd47f
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkOrbitAnimationWidget.h
@@ -0,0 +1,49 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#ifndef QmitkOrbitAnimationWidget_h
+#define QmitkOrbitAnimationWidget_h
+
+#include "QmitkAnimationWidget.h"
+
+class QmitkOrbitAnimationItem;
+
+namespace Ui
+{
+ class QmitkOrbitAnimationWidget;
+}
+
+class QmitkOrbitAnimationWidget : public QmitkAnimationWidget
+{
+ Q_OBJECT
+
+public:
+ explicit QmitkOrbitAnimationWidget(QWidget* parent = NULL);
+ ~QmitkOrbitAnimationWidget();
+
+ void SetAnimationItem(QmitkAnimationItem* orbitAnimationItem);
+
+private slots:
+ void OnStartAngleChanged(int angle);
+ void OnOrbitEditingFinished();
+ void OnReverseChanged(bool reverse);
+
+private:
+ Ui::QmitkOrbitAnimationWidget* m_Ui;
+ QmitkOrbitAnimationItem* m_AnimationItem;
+};
+
+#endif
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkOrbitAnimationWidget.ui b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkOrbitAnimationWidget.ui
new file mode 100644
index 0000000000..d07661f51c
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkOrbitAnimationWidget.ui
@@ -0,0 +1,107 @@
+
+
+ QmitkOrbitAnimationWidget
+
+
+
+ 0
+ 0
+ 192
+ 87
+
+
+
+ QmitkOrbitAnimationWidget
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Start angle:
+
+
+ startAngleSlider
+
+
+
+ -
+
+
+ 360
+
+
+ 180
+
+
+ Qt::Horizontal
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ 360
+
+
+ 180
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Orbit:
+
+
+ startAngleSlider
+
+
+
+ -
+
+
+ 360
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Reverse
+
+
+
+
+
+
+ startAngleSlider
+ startAngleSpinBox
+ reverseCheckBox
+
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkSliceAnimationItem.cpp b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkSliceAnimationItem.cpp
new file mode 100644
index 0000000000..624512a7ec
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkSliceAnimationItem.cpp
@@ -0,0 +1,91 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#include "QmitkSliceAnimationItem.h"
+#include
+
+QmitkSliceAnimationItem::QmitkSliceAnimationItem(int renderWindow, int from, int to, bool reverse, double duration, double delay, bool startWithPrevious)
+ : QmitkAnimationItem("Slice", duration, delay, startWithPrevious)
+{
+ this->SetRenderWindow(renderWindow);
+ this->SetFrom(from);
+ this->SetTo(to);
+ this->SetReverse(reverse);
+}
+
+QmitkSliceAnimationItem::~QmitkSliceAnimationItem()
+{
+}
+
+int QmitkSliceAnimationItem::GetRenderWindow() const
+{
+ return this->data(RenderWindowRole).toInt();
+}
+
+void QmitkSliceAnimationItem::SetRenderWindow(int renderWindow)
+{
+ this->setData(renderWindow, RenderWindowRole);
+}
+
+int QmitkSliceAnimationItem::GetFrom() const
+{
+ return this->data(FromRole).toInt();
+}
+
+void QmitkSliceAnimationItem::SetFrom(int from)
+{
+ this->setData(from, FromRole);
+}
+
+int QmitkSliceAnimationItem::GetTo() const
+{
+ return this->data(ToRole).toInt();
+}
+
+void QmitkSliceAnimationItem::SetTo(int to)
+{
+ this->setData(to, ToRole);
+}
+
+bool QmitkSliceAnimationItem::GetReverse() const
+{
+ return this->data(ReverseRole).toBool();
+}
+
+void QmitkSliceAnimationItem::SetReverse(bool reverse)
+{
+ this->setData(reverse, ReverseRole);
+}
+
+void QmitkSliceAnimationItem::Animate(double s)
+{
+ const QString renderWindowName = QString("stdmulti.widget%1").arg(this->GetRenderWindow() + 1);
+ vtkRenderWindow* renderWindow = mitk::BaseRenderer::GetRenderWindowByName(renderWindowName.toStdString());
+
+ if (renderWindow == NULL)
+ return;
+
+ mitk::Stepper* stepper = mitk::BaseRenderer::GetInstance(renderWindow)->GetSliceNavigationController()->GetSlice();
+
+ if (stepper == NULL)
+ return;
+
+ int newPos = this->GetReverse()
+ ? this->GetTo() - static_cast((this->GetTo() - this->GetFrom()) * s)
+ : this->GetFrom() + static_cast((this->GetTo() - this->GetFrom()) * s);
+
+ stepper->SetPos(static_cast(newPos));
+}
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkSliceAnimationItem.h b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkSliceAnimationItem.h
new file mode 100644
index 0000000000..2626740387
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkSliceAnimationItem.h
@@ -0,0 +1,43 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#ifndef QmitkSliceAnimationItem_h
+#define QmitkSliceAnimationItem_h
+
+#include "QmitkAnimationItem.h"
+
+class QmitkSliceAnimationItem : public QmitkAnimationItem
+{
+public:
+ explicit QmitkSliceAnimationItem(int renderWindow = 0, int from = 0, int to = 0, bool reverse = false, double duration = 2.0, double delay = 0.0, bool startWithPrevious = false);
+ virtual ~QmitkSliceAnimationItem();
+
+ int GetRenderWindow() const;
+ void SetRenderWindow(int renderWindow);
+
+ int GetFrom() const;
+ void SetFrom(int from);
+
+ int GetTo() const;
+ void SetTo(int to);
+
+ bool GetReverse() const;
+ void SetReverse(bool reverse);
+
+ void Animate(double s);
+};
+
+#endif
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkSliceAnimationWidget.cpp b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkSliceAnimationWidget.cpp
new file mode 100644
index 0000000000..525022fd49
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkSliceAnimationWidget.cpp
@@ -0,0 +1,120 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#include "QmitkSliceAnimationItem.h"
+#include "QmitkSliceAnimationWidget.h"
+#include
+#include
+
+static unsigned int GetNumberOfSlices(int renderWindow)
+{
+ const QString renderWindowName = QString("stdmulti.widget%1").arg(renderWindow + 1);
+ vtkRenderWindow* theRenderWindow = mitk::BaseRenderer::GetRenderWindowByName(renderWindowName.toStdString());
+
+ if (theRenderWindow != NULL)
+ {
+ mitk::Stepper* stepper = mitk::BaseRenderer::GetInstance(theRenderWindow)->GetSliceNavigationController()->GetSlice();
+
+ if (stepper != NULL)
+ return std::max(1U, stepper->GetSteps());
+ }
+
+ return 1;
+}
+
+QmitkSliceAnimationWidget::QmitkSliceAnimationWidget(QWidget* parent)
+ : QmitkAnimationWidget(parent),
+ m_Ui(new Ui::QmitkSliceAnimationWidget)
+{
+ m_Ui->setupUi(this);
+
+ this->connect(m_Ui->windowComboBox, SIGNAL(currentIndexChanged(int)),
+ this, SLOT(OnRenderWindowChanged(int)));
+
+ this->connect(m_Ui->sliceRangeWidget, SIGNAL(minimumValueChanged(double)),
+ this, SLOT(OnFromChanged(double)));
+
+ this->connect(m_Ui->sliceRangeWidget, SIGNAL(maximumValueChanged(double)),
+ this, SLOT(OnToChanged(double)));
+
+ this->connect(m_Ui->reverseCheckBox, SIGNAL(clicked(bool)),
+ this, SLOT(OnReverseChanged(bool)));
+}
+
+QmitkSliceAnimationWidget::~QmitkSliceAnimationWidget()
+{
+}
+
+void QmitkSliceAnimationWidget::SetAnimationItem(QmitkAnimationItem* sliceAnimationItem)
+{
+ m_AnimationItem = dynamic_cast(sliceAnimationItem);
+
+ if (m_AnimationItem == NULL)
+ return;
+
+ m_Ui->windowComboBox->setCurrentIndex(m_AnimationItem->GetRenderWindow());
+ m_Ui->sliceRangeWidget->setMaximum(GetNumberOfSlices(m_AnimationItem->GetRenderWindow()) - 1);
+ m_Ui->sliceRangeWidget->setValues(m_AnimationItem->GetFrom(), m_AnimationItem->GetTo());
+ m_Ui->reverseCheckBox->setChecked(m_AnimationItem->GetReverse());
+}
+
+void QmitkSliceAnimationWidget::OnRenderWindowChanged(int renderWindow)
+{
+ if (m_AnimationItem == NULL)
+ return;
+
+ const int lastSlice = static_cast(GetNumberOfSlices(renderWindow) - 1);
+
+ m_AnimationItem->SetFrom(0);
+ m_AnimationItem->SetTo(lastSlice);
+
+ m_Ui->sliceRangeWidget->setMaximum(lastSlice);
+ m_Ui->sliceRangeWidget->setValues(m_AnimationItem->GetFrom(), m_AnimationItem->GetTo());
+
+ if (m_AnimationItem->GetRenderWindow() != renderWindow)
+ m_AnimationItem->SetRenderWindow(renderWindow);
+}
+
+void QmitkSliceAnimationWidget::OnFromChanged(double from)
+{
+ if (m_AnimationItem == NULL)
+ return;
+
+ int intFrom = static_cast(from);
+
+ if (m_AnimationItem->GetFrom() != intFrom)
+ m_AnimationItem->SetFrom(intFrom);
+}
+
+void QmitkSliceAnimationWidget::OnToChanged(double to)
+{
+ if (m_AnimationItem == NULL)
+ return;
+
+ int intTo = static_cast(to);
+
+ if (m_AnimationItem->GetTo() != intTo)
+ m_AnimationItem->SetTo(intTo);
+}
+
+void QmitkSliceAnimationWidget::OnReverseChanged(bool reverse)
+{
+ if (m_AnimationItem == NULL)
+ return;
+
+ if (m_AnimationItem->GetReverse() != reverse)
+ m_AnimationItem->SetReverse(reverse);
+}
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkSliceAnimationWidget.h b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkSliceAnimationWidget.h
new file mode 100644
index 0000000000..a12de9ed58
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkSliceAnimationWidget.h
@@ -0,0 +1,50 @@
+/*===================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center,
+Division of Medical and Biological Informatics.
+All rights reserved.
+
+This software is distributed WITHOUT ANY WARRANTY; without
+even the implied warranty of MERCHANTABILITY or FITNESS FOR
+A PARTICULAR PURPOSE.
+
+See LICENSE.txt or http://www.mitk.org for details.
+
+===================================================================*/
+
+#ifndef QmitkSliceAnimationWidget_h
+#define QmitkSliceAnimationWidget_h
+
+#include "QmitkAnimationWidget.h"
+
+class QmitkSliceAnimationItem;
+
+namespace Ui
+{
+ class QmitkSliceAnimationWidget;
+}
+
+class QmitkSliceAnimationWidget : public QmitkAnimationWidget
+{
+ Q_OBJECT
+
+public:
+ explicit QmitkSliceAnimationWidget(QWidget* parent = NULL);
+ ~QmitkSliceAnimationWidget();
+
+ void SetAnimationItem(QmitkAnimationItem* sliceAnimationItem);
+
+private slots:
+ void OnRenderWindowChanged(int renderWindow);
+ void OnFromChanged(double from);
+ void OnToChanged(double to);
+ void OnReverseChanged(bool reverse);
+
+private:
+ Ui::QmitkSliceAnimationWidget* m_Ui;
+ QmitkSliceAnimationItem* m_AnimationItem;
+};
+
+#endif
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkSliceAnimationWidget.ui b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkSliceAnimationWidget.ui
new file mode 100644
index 0000000000..86f72fc9d9
--- /dev/null
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/QmitkSliceAnimationWidget.ui
@@ -0,0 +1,112 @@
+
+
+ QmitkSliceAnimationWidget
+
+
+
+ 0
+ 0
+ 304
+ 96
+
+
+
+ QmitkSliceAnimationWidget
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Window:
+
+
+ windowComboBox
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
-
+
+ Axial
+
+
+ -
+
+ Sagittal
+
+
+ -
+
+ Coronal
+
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Slice range:
+
+
+
+ -
+
+
+ 0
+
+
+ 999.000000000000000
+
+
+ 999.000000000000000
+
+
+
+ -
+
+
+
+ 0
+ 0
+
+
+
+ Reverse
+
+
+
+
+
+
+
+ ctkRangeWidget
+ QWidget
+
+
+
+
+ windowComboBox
+ reverseCheckBox
+
+
+
+
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/mitkMovieMakerPluginActivator.cpp b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/mitkMovieMakerPluginActivator.cpp
index 78a3d6eee4..81f7742a7b 100644
--- a/Plugins/org.mitk.gui.qt.moviemaker/src/internal/mitkMovieMakerPluginActivator.cpp
+++ b/Plugins/org.mitk.gui.qt.moviemaker/src/internal/mitkMovieMakerPluginActivator.cpp
@@ -1,40 +1,40 @@
/*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
#include "mitkMovieMakerPluginActivator.h"
-#include "QmitkMovieMaker.h"
+#include "QmitkMovieMakerView.h"
#include "QmitkScreenshotMaker.h"
#include
namespace mitk {
void MovieMakerPluginActivator::start(ctkPluginContext* context)
{
- BERRY_REGISTER_EXTENSION_CLASS(QmitkMovieMaker, context)
+ BERRY_REGISTER_EXTENSION_CLASS(QmitkMovieMakerView, context)
BERRY_REGISTER_EXTENSION_CLASS(QmitkScreenshotMaker, context)
}
void MovieMakerPluginActivator::stop(ctkPluginContext* context)
{
Q_UNUSED(context)
}
}
#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
Q_EXPORT_PLUGIN2(org_mitk_gui_qt_moviemaker, mitk::MovieMakerPluginActivator)
#endif