diff --git a/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerView.cpp b/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerView.cpp index aeea60213b..be506d0613 100644 --- a/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerView.cpp +++ b/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerView.cpp @@ -1,186 +1,187 @@ /*=================================================================== 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. ===================================================================*/ // Blueberry #include #include // Qmitk #include "QmitkNavigationDataPlayerView.h" #include "QmitkStdMultiWidget.h" // QT #include //mitk #include #include #include #include // VTK -#include +#include const std::string QmitkNavigationDataPlayerView::VIEW_ID = "org.mitk.views.navigationdataplayer"; QmitkNavigationDataPlayerView::QmitkNavigationDataPlayerView() : QmitkFunctionality() , m_Controls( 0 ) , m_MultiWidget( NULL ) { } QmitkNavigationDataPlayerView::~QmitkNavigationDataPlayerView() { } void QmitkNavigationDataPlayerView::CreateQtPartControl( QWidget *parent ) { // build up qt view, unless already done if ( !m_Controls ) { // create GUI widgets from the Qt Designer's .ui file m_Controls = new Ui::QmitkNavigationDataPlayerViewControls; m_Controls->setupUi( parent ); this->CreateBundleWidgets( parent ); this->CreateConnections(); // make deselected Player invisible m_Controls->m_TimedWidget->setVisible(false); } } void QmitkNavigationDataPlayerView::CreateBundleWidgets(QWidget* parent) { //m_PlayerWidget = new QmitkIGTPlayerWidget( parent ); // this bundle's ND player widget } void QmitkNavigationDataPlayerView::CreateConnections() { connect( m_Controls->m_RdbSequential, SIGNAL(released()), this, SLOT(OnSelectPlayer()) ); connect( m_Controls->m_RdbTimeBased, SIGNAL(released()), this, SLOT(OnSelectPlayer()) ); connect( m_Controls->m_BtnOpenFile, SIGNAL(released()), this, SLOT(OnOpenFile()) ); connect( m_Controls->m_ChkDisplay, SIGNAL(released()), this, SLOT(OnSetDisplay()) ); connect( m_Controls->m_chkRepeat, SIGNAL(released()), this, SLOT(OnSetRepeat()) ); connect( m_Controls->m_ChkMicroservice, SIGNAL(released()), this, SLOT(OnSetMicroservice()) ); connect( m_Controls->m_SequentialWidget, SIGNAL(SignalUpdate()), this, SLOT(OnUpdate()) ); connect( m_Controls->m_TimedWidget, SIGNAL(SignalUpdate()), this, SLOT(OnUpdate()) ); } void QmitkNavigationDataPlayerView::OnPlayingStarted() { } void QmitkNavigationDataPlayerView::OnOpenFile(){ - mitk::NavigationDataSet::Pointer data; mitk::NavigationDataReaderXML::Pointer reader = mitk::NavigationDataReaderXML::New(); - // FIXME Filter for correct Files + // FIXME Filter for correct Files and use correct Reader QString fileName = QFileDialog::getOpenFileName(NULL, "Open Navigation Data Set", "", ""); - data = reader->Read(fileName.toStdString()); + m_Data = reader->Read(fileName.toStdString()); // Update Labels m_Controls->m_LblFilePath->setText(fileName); - m_Controls->m_LblFrames->setText(QString::number(data->Size())); - m_Controls->m_LblTools->setText(QString::number(data->GetNumberOfTools())); + m_Controls->m_LblFrames->setText(QString::number(m_Data->Size())); + m_Controls->m_LblTools->setText(QString::number(m_Data->GetNumberOfTools())); - if (m_Controls->m_RdbSequential->isChecked()) - { - mitk::NavigationDataSequentialPlayer::Pointer seqPlayer = mitk::NavigationDataSequentialPlayer::New(); - seqPlayer->SetNavigationDataSet(data); - m_Controls->m_SequentialWidget->SetPlayer(seqPlayer); - m_Player = seqPlayer; - } else { - } - - CreatePipeline(m_Player); + // Initialize Widgets and create Player + OnSelectPlayer(); } void QmitkNavigationDataPlayerView::OnSelectPlayer(){ if (m_Controls->m_RdbSequential->isChecked()) { m_Controls->m_SequentialWidget->setVisible(true); m_Controls->m_TimedWidget->setVisible(false); + mitk::NavigationDataSequentialPlayer::Pointer seqPlayer = mitk::NavigationDataSequentialPlayer::New(); + seqPlayer->SetNavigationDataSet(m_Data); + m_Controls->m_SequentialWidget->SetPlayer(seqPlayer); + m_Player = seqPlayer; } else { m_Controls->m_SequentialWidget->setVisible(false); m_Controls->m_TimedWidget->setVisible(true); + mitk::NavigationDataPlayer::Pointer timedPlayer = mitk::NavigationDataPlayer::New(); + timedPlayer->SetNavigationDataSet(m_Data); + m_Controls->m_TimedWidget->SetPlayer(timedPlayer); + m_Player = timedPlayer; } + + // SetupRenderingPipeline + OnSetDisplay(); } -void ConfigurePlayer(mitk::NavigationDataPlayerBase::Pointer player){ +void ConfigurePlayer(){ // FIXME: Why is repeat not available in the base class? // TODO finish method } void QmitkNavigationDataPlayerView::OnSetRepeat(){ MITK_WARN << "Repeat not yet supported"; } void QmitkNavigationDataPlayerView::OnSetMicroservice(){ MITK_WARN << "Register as Microservice not yet supported"; } void QmitkNavigationDataPlayerView::OnUpdate(){ m_VisFilter->Update(); for (unsigned int i = 0; i < m_RenderingNodes.size(); i++){ m_RenderingNodes[i]->Update(); } mitk::RenderingManager::GetInstance()->RequestUpdateAll(); } void QmitkNavigationDataPlayerView::OnSetDisplay(){ DestroyPipeline(); if ( (m_Controls->m_ChkDisplay->isChecked()) && ( m_Player.IsNotNull() )) { - CreatePipeline(m_Player); + CreatePipeline(); } } -void QmitkNavigationDataPlayerView::CreatePipeline(mitk::NavigationDataPlayerBase::Pointer player){ +void QmitkNavigationDataPlayerView::CreatePipeline(){ m_VisFilter = mitk::NavigationDataObjectVisualizationFilter::New(); - for (unsigned int i = 0 ; i < player->GetNumberOfIndexedOutputs(); i++ ) { + for (unsigned int i = 0 ; i < m_Player->GetNumberOfIndexedOutputs(); i++ ) { mitk::DataNode::Pointer node = mitk::DataNode::New(); // TODO Give Nodes a proper name - m_VisFilter->SetInput(i, player->GetOutput(i)); + m_VisFilter->SetInput(i, m_Player->GetOutput(i)); //create small sphere and use it as surface mitk::Surface::Pointer mySphere = mitk::Surface::New(); - vtkConeSource *vtkData = vtkConeSource::New(); - vtkData->SetAngle(5.0); - vtkData->SetResolution(50); - vtkData->SetHeight(6.0f); - vtkData->SetRadius(2.0f); + vtkSphereSource *vtkData = vtkSphereSource::New(); + vtkData->SetRadius(5.0f); vtkData->SetCenter(0.0, 0.0, 0.0); vtkData->Update(); mySphere->SetVtkPolyData(vtkData->GetOutput()); vtkData->Delete(); node->SetData(mySphere); m_VisFilter->SetRepresentationObject(i, mySphere); + + // Add Node to DataStorageand to local list of Nodes GetDataStorage()->Add(node); m_RenderingNodes.push_back(node); } } void QmitkNavigationDataPlayerView::DestroyPipeline(){ m_VisFilter = NULL; for (unsigned int i = 0; i < m_RenderingNodes.size(); i++){ this->GetDataStorage()->Remove(m_RenderingNodes[i]); } m_RenderingNodes.clear(); } \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerView.h b/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerView.h index 6b37105cf1..ed6597b962 100644 --- a/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerView.h +++ b/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerView.h @@ -1,105 +1,106 @@ /*=================================================================== 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 QmitkNavigationDataPlayerView_h #define QmitkNavigationDataPlayerView_h #include //Qmitk #include #include // ui #include "ui_QmitkNavigationDataPlayerViewControls.h" //mitk #include /*! \brief QmitkNavigationDataPlayerView \warning This application module is not yet documented. Use "svn blame/praise/annotate" and ask the author to provide basic documentation. \sa QmitkFunctionality \ingroup Functionalities */ class QmitkNavigationDataPlayerView : public QmitkFunctionality { // this is needed for all Qt objects that should have a Qt meta-object // (everything that derives from QObject and wants to have signal/slots) Q_OBJECT public: static const std::string VIEW_ID; QmitkNavigationDataPlayerView(); virtual ~QmitkNavigationDataPlayerView(); virtual void CreateQtPartControl(QWidget *parent); /** \brief This method creates this bundle's SIGNAL and SLOT connections */ virtual void CreateConnections(); protected slots: /*! \brief TODO */ void OnPlayingStarted(); void OnOpenFile(); void OnSelectPlayer(); void OnSetRepeat(); void OnSetMicroservice(); void OnSetDisplay(); void OnUpdate(); protected: /** * \brief configures the player according to the checkboxes set in the GUI */ - void ConfigurePlayer(mitk::NavigationDataPlayerBase::Pointer player); + void ConfigurePlayer(); /** * \brief Creates the Rendering Pipeline necessary to Render the images */ - void CreatePipeline(mitk::NavigationDataPlayerBase::Pointer player); + void CreatePipeline(); /** * \brief Destroys the Rendering Pipeline (but not the player) */ void DestroyPipeline(); void CreateBundleWidgets(QWidget* parent); Ui::QmitkNavigationDataPlayerViewControls* m_Controls; mitk::NavigationDataObjectVisualizationFilter::Pointer m_VisFilter; std::vector m_RenderingNodes; mitk::NavigationDataPlayerBase::Pointer m_Player; + mitk::NavigationDataSet::Pointer m_Data; QmitkStdMultiWidget* m_MultiWidget; QmitkIGTPlayerWidget* m_PlayerWidget; ///< this bundle's playback widget private: }; #endif // _QMITKNAVIGATIONDATAPLAYERVIEW_H_INCLUDED \ No newline at end of file