diff --git a/Modules/Bundles/org.mitk.gui.qt.moviemaker/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.moviemaker/CMakeLists.txt index fba82a3726..22140aeebb 100644 --- a/Modules/Bundles/org.mitk.gui.qt.moviemaker/CMakeLists.txt +++ b/Modules/Bundles/org.mitk.gui.qt.moviemaker/CMakeLists.txt @@ -1,2 +1,9 @@ +# The project name must correspond to the directory name of your plug-in +# and must not contain periods. +PROJECT(org_mitk_gui_qt_moviemaker) -MACRO_CREATE_MITK_PLUGIN(QmitkExt) +MACRO_CREATE_MITK_CTK_PLUGIN( + EXPORT_DIRECTIVE MOVIEMAKER_EXPORT + EXPORTED_INCLUDE_SUFFIXES src + MODULE_DEPENDENCIES QmitkExt +) \ No newline at end of file diff --git a/Modules/Bundles/org.mitk.gui.qt.moviemaker/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.moviemaker/META-INF/MANIFEST.MF deleted file mode 100644 index 7242aa3742..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.moviemaker/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-Name: Movie Maker -Bundle-SymbolicName: org.mitk.gui.qt.moviemaker -Bundle-Version: 0.1 -Bundle-Vendor: DKFZ, Medical and Biological Informatics -Require-Bundle: org.mitk.gui.qt.common -Bundle-Activator: diff --git a/Modules/Bundles/org.mitk.gui.qt.moviemaker/files.cmake b/Modules/Bundles/org.mitk.gui.qt.moviemaker/files.cmake index 11420b8068..82361c7483 100644 --- a/Modules/Bundles/org.mitk.gui.qt.moviemaker/files.cmake +++ b/Modules/Bundles/org.mitk.gui.qt.moviemaker/files.cmake @@ -1,35 +1,36 @@ SET(SRC_CPP_FILES ) SET(INTERNAL_CPP_FILES QmitkMovieMaker.cpp + mitkMovieMakerPluginActivator.cpp ) SET(UI_FILES src/internal/QmitkMovieMakerControls.ui ) SET(MOC_H_FILES + src/internal/mitkMovieMakerPluginActivator.h src/internal/QmitkMovieMaker.h ) -SET(RESOURCE_FILES +SET(CACHED_RESOURCE_FILES resources/icon.xpm + plugin.xml ) SET(RES_FILES resources/QmitkMovieMaker.qrc ) -SET(CPP_FILES manifest.cpp) - 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/Modules/Bundles/org.mitk.gui.qt.moviemaker/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.moviemaker/manifest.cpp deleted file mode 100644 index d362cfeed0..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.moviemaker/manifest.cpp +++ /dev/null @@ -1,26 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision: 17495 $ - -Copyright (c) German Cancer Research Center, Division of Medical and -Biological Informatics. All rights reserved. -See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. - -This software is distributed WITHOUT ANY WARRANTY; without even -the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -#include - -#include -#include "src/internal/QmitkMovieMaker.h" - - -POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart) - POCO_EXPORT_CLASS(::QmitkMovieMaker) -POCO_END_MANIFEST diff --git a/Modules/Bundles/org.mitk.gui.qt.moviemaker/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.moviemaker/manifest_headers.cmake new file mode 100644 index 0000000000..84719cea59 --- /dev/null +++ b/Modules/Bundles/org.mitk.gui.qt.moviemaker/manifest_headers.cmake @@ -0,0 +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) \ No newline at end of file diff --git a/Modules/Bundles/org.mitk.gui.qt.moviemaker/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.moviemaker/plugin.xml index a258eb1c94..ae213a8bca 100644 --- a/Modules/Bundles/org.mitk.gui.qt.moviemaker/plugin.xml +++ b/Modules/Bundles/org.mitk.gui.qt.moviemaker/plugin.xml @@ -1,12 +1,12 @@ diff --git a/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/MoviemakerDll.h b/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/MoviemakerDll.h deleted file mode 100644 index 1aa611ca2d..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/MoviemakerDll.h +++ /dev/null @@ -1,43 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date$ -Version: $Revision: 17495 $ - -Copyright (c) German Cancer Research Center, Division of Medical and -Biological Informatics. All rights reserved. -See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. - -This software is distributed WITHOUT ANY WARRANTY; without even -the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR -PURPOSE. See the above copyright notices for more information. - -=========================================================================*/ - -#ifndef _MOVIEMAKER_EXPORT_DLL_H_ -#define _MOVIEMAKER_EXPORT_DLL_H_ - - -// -// The following block is the standard way of creating macros which make exporting -// from a DLL simpler. All files within this DLL are compiled with the org_mitk_gui_qt_moviemaker_EXPORTS -// symbol defined on the command line. this symbol should not be defined on any project -// that uses this DLL. This way any other project whose source files include this file see -// org_mitk_gui_qt_moviemaker_EXPORTS functions as being imported from a DLL, wheras this DLL sees symbols -// defined with this macro as being exported. -// -#if defined(_WIN32) && !defined(MITK_STATIC) - #if defined(org_mitk_gui_qt_moviemaker_EXPORTS) - #define MOVIEMAKER_EXPORT __declspec(dllexport) - #else - #define MOVIEMAKER_EXPORT __declspec(dllimport) - #endif -#endif - - -#if !defined(MOVIEMAKER_EXPORT) - #define MOVIEMAKER_EXPORT -#endif - -#endif /*_MOVIEMAKER_EXPORT_DLL_H_*/ diff --git a/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMaker.h b/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMaker.h index 0e113ebcf6..b35e065b1d 100644 --- a/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMaker.h +++ b/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/internal/QmitkMovieMaker.h @@ -1,301 +1,307 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision: 15436 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ #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); + QmitkMovieMaker(const QmitkMovieMaker& other) + { + Q_UNUSED(other) + throw std::runtime_error("Copy constructor not implemented"); + } + /** \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/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/internal/mitkMovieMakerPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/internal/mitkMovieMakerPluginActivator.cpp new file mode 100644 index 0000000000..4fda786aae --- /dev/null +++ b/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/internal/mitkMovieMakerPluginActivator.cpp @@ -0,0 +1,21 @@ +#include "mitkMovieMakerPluginActivator.h" + +#include "QmitkMovieMaker.h" + +#include + +namespace mitk { + + void MovieMakerPluginActivator::start(ctkPluginContext* context) + { + BERRY_REGISTER_EXTENSION_CLASS(QmitkMovieMaker, context) + } + + void MovieMakerPluginActivator::stop(ctkPluginContext* context) + { + Q_UNUSED(context) + } + +} + +Q_EXPORT_PLUGIN2(org_mitk_gui_qt_moviemaker, mitk::MovieMakerPluginActivator) \ No newline at end of file diff --git a/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/internal/mitkMovieMakerPluginActivator.h b/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/internal/mitkMovieMakerPluginActivator.h new file mode 100644 index 0000000000..4bfa68d5cd --- /dev/null +++ b/Modules/Bundles/org.mitk.gui.qt.moviemaker/src/internal/mitkMovieMakerPluginActivator.h @@ -0,0 +1,23 @@ +#ifndef MITKMOVIEMAKERPLUGINACTIVATOR_H +#define MITKMOVIEMAKERPLUGINACTIVATOR_H + +#include + +namespace mitk { + + class MovieMakerPluginActivator : + public QObject, public ctkPluginActivator + { + Q_OBJECT + Q_INTERFACES(ctkPluginActivator) + + public: + + void start(ctkPluginContext* context); + void stop(ctkPluginContext* context); + + }; // MovieMakerPluginActivator + +} + +#endif // MITKMOVIEMAKERPLUGINACTIVATOR_H \ No newline at end of file