00001 /*========================================================================= 00002 00003 Program: Medical Imaging & Interaction Toolkit 00004 Language: C++ 00005 Date: $Date$ 00006 Version: $Revision: 15436 $ 00007 00008 Copyright (c) German Cancer Research Center, Division of Medical and 00009 Biological Informatics. All rights reserved. 00010 See MITKCopyright.txt or https://www.mitk.org/copyright.html for details. 00011 00012 This software is distributed WITHOUT ANY WARRANTY; without even 00013 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00014 PURPOSE. See the above copyright notices for more information. 00015 00016 =========================================================================*/ 00017 00018 #if !defined(QMITK_MOVIEMAKER_H__INCLUDED) 00019 #define QMITK_MOVIEMAKER_H__INCLUDED 00020 00021 #include "QmitkFunctionality.h" 00022 #include "mitkCameraRotationController.h" 00023 #include "mitkStepper.h" 00024 #include "mitkMultiStepper.h" 00025 #include "mitkMovieGenerator.h" 00026 #include "itkCommand.h" 00027 00028 #include "QVTKWidget.h" 00029 #include "vtkEventQtSlotConnect.h" 00030 #include "vtkRenderWindow.h" 00031 #include "mitkVtkPropRenderer.h" 00032 00033 #include "ui_QmitkMovieMakerControls.h" 00034 //#include "../MovieMakerDll.h" 00035 00036 //class QmitkStdMultiWidget; 00037 //class QmitkMovieMakerControls; 00038 class QmitkStepperAdapter; 00039 class vtkCamera; 00040 class QTimer; 00041 class QTime; 00042 00138 class QmitkMovieMaker: public QObject, public QmitkFunctionality 00139 { 00140 Q_OBJECT 00141 00142 public: 00144 QmitkMovieMaker(QObject *parent=0, const char *name=0); 00145 00147 virtual ~QmitkMovieMaker(); 00148 00152 void CreateQtPartControl(QWidget *parent); 00153 // virtual QWidget * CreateControlWidget(QWidget *parent); 00154 00157 virtual void CreateConnections(); 00158 00162 // virtual QAction * CreateAction(QActionGroup *parent); 00163 00164 virtual void Activated(); 00165 00166 virtual void Deactivated(); 00167 00169 void FocusChange(); 00170 00171 virtual void DataStorageChanged(); 00172 00176 virtual void StdMultiWidgetAvailable(QmitkStdMultiWidget& stdMultiWidget); 00180 virtual void StdMultiWidgetNotAvailable(); 00181 00182 signals: 00183 void StartBlockControls(); 00184 void EndBlockControls(); 00185 void EndBlockControlsMovieDeactive(); 00186 00187 public slots: 00188 00190 void StartPlaying(); 00191 00193 void PausePlaying(); 00194 00196 void StopPlaying(); 00197 00199 void SetLooping(bool looping); 00200 00202 void SetDirection(int direction); 00203 00207 void SetAspect(int aspect); 00208 00210 void SetStepperWindow(int window); 00211 00213 void SetRecordingWindow(int window); 00214 00219 void AdvanceAnimation(); 00220 00221 protected slots: 00222 00223 void RenderSlot(); 00224 void GenerateMovie(); 00225 00226 void GenerateScreenshot(); 00227 void GenerateHR3DScreenshot(); 00228 void RBTNForward(); 00229 void RBTNBackward(); 00230 void RBTNPingPong(); 00231 void RBTNSpatial(); 00232 void RBTNTemporal(); 00233 void RBTNCombined(); 00234 void BlockControls(); 00235 void UnBlockControls(); 00236 void UnBlockControlsMovieDeactive(); 00237 void BlockControls(bool blocked); 00238 00239 void DeleteMStepper(); 00240 00241 signals: 00242 00243 void SwitchDirection(int); 00244 void SwitchAspect(int); 00245 void SwitchSelectedStepperWindow(int); 00246 void SwitchSelectedRecordingWindow(int); 00247 00248 protected: 00249 00250 QObject *parentWidget; 00251 QVTKWidget * widget; 00252 QmitkStdMultiWidget* m_MultiWidget; 00253 vtkEventQtSlotConnect * connections; 00254 vtkRenderWindow * renderWindow; 00255 mitk::VtkPropRenderer::Pointer m_PropRenderer; 00256 00257 Ui::QmitkMovieMakerControls* m_Controls; 00258 00259 private: 00260 mitk::BaseController* GetSpatialController(); 00261 00262 mitk::BaseController* GetTemporalController(); 00263 00264 void UpdateLooping(); 00265 00266 void UpdateDirection(); 00267 00268 void UpdateGUI(); 00269 00270 mitk::Stepper* GetAspectStepper(); 00271 00277 void TakeScreenshot(vtkRenderer* renderer, unsigned int magnificationFactor, QString fileName); 00278 00279 QmitkStepperAdapter* m_StepperAdapter; 00280 00281 typedef itk::SimpleMemberCommand<QmitkMovieMaker> MemberCommand; 00282 MemberCommand::Pointer m_FocusManagerCallback; 00283 00284 QTimer* m_Timer; 00285 00286 QTime* m_Time; 00287 00288 bool m_Looping; 00289 int m_Direction; 00290 00291 int m_Aspect; 00292 mitk::MultiStepper::Pointer m_Stepper; 00293 mitk::BaseRenderer * m_RecordingRenderer; 00294 00295 mitk::MovieGenerator::Pointer m_movieGenerator; 00296 00297 unsigned long m_FocusManagerObserverTag; 00298 unsigned long m_StepperObserverTag; 00299 00300 }; 00301 #endif // !defined(QMITK_MOVIEMAKER_H__INCLUDED)