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 d3192c420b..c34e224bbf 100644 --- a/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerView.cpp +++ b/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerView.cpp @@ -1,194 +1,218 @@ /*=================================================================== 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 +#include // VTK #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()) ); SetInteractionComponentsEnabledState(false); } void QmitkNavigationDataPlayerView::OnPlayingStarted() { } void QmitkNavigationDataPlayerView::OnOpenFile(){ mitk::NavigationDataReaderXML::Pointer reader = mitk::NavigationDataReaderXML::New(); // FIXME Filter for correct Files and use correct Reader QString fileName = QFileDialog::getOpenFileName(NULL, "Open Navigation Data Set", "", ""); m_Data = reader->Read(fileName.toStdString()); // Update Labels m_Controls->m_LblFilePath->setText(fileName); m_Controls->m_LblFrames->setText(QString::number(m_Data->Size())); m_Controls->m_LblTools->setText(QString::number(m_Data->GetNumberOfTools())); // Initialize Widgets and create Player OnSelectPlayer(); SetInteractionComponentsEnabledState(true); } 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(){ // 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"; + if(m_Controls->m_ChkMicroservice->isChecked()) + { + m_ToolStorage = mitk::NavigationToolStorage::New(); + for (int i = 0; i < m_Player->GetNumberOfIndexedOutputs(); i++) + { + MITK_INFO << "Output" << i; + mitk::NavigationTool::Pointer currentDummyTool = mitk::NavigationTool::New(); + mitk::VirtualTrackingTool::Pointer dummyTool = mitk::VirtualTrackingTool::New(); + std::stringstream name; + name << "Virtual Tool " << i; + dummyTool->SetToolName(name.str()); + currentDummyTool->SetTrackingTool(dummyTool.GetPointer()); + currentDummyTool->SetDataNode(m_RenderingNodes.at(i)); + currentDummyTool->SetIdentifier(name.str()); + m_ToolStorage->AddTool(currentDummyTool); + } + m_Player->RegisterAsMicroservice(); + m_ToolStorage->SetName("NavigationDataPlayer Tool Storage"); + m_ToolStorage->RegisterAsMicroservice(m_Player->GetMicroserviceID()); + } else { + if (m_ToolStorage.IsNotNull()) m_ToolStorage->UnRegisterMicroservice(); + m_ToolStorage = NULL; + m_Player->UnRegisterMicroservice(); + } } void QmitkNavigationDataPlayerView::OnUpdate(){ m_VisFilter->Update(); mitk::RenderingManager::GetInstance()->RequestUpdateAll(); } void QmitkNavigationDataPlayerView::OnSetDisplay(){ DestroyPipeline(); if ( (m_Controls->m_ChkDisplay->isChecked()) && ( m_Player.IsNotNull() )) { CreatePipeline(); } } void QmitkNavigationDataPlayerView::CreatePipeline(){ m_VisFilter = mitk::NavigationDataObjectVisualizationFilter::New(); m_VisFilter->ConnectTo(m_Player); for (unsigned int i = 0 ; i < m_Player->GetNumberOfIndexedOutputs(); i++ ) { mitk::DataNode::Pointer node = mitk::DataNode::New(); QString name = "Recorded Tool " + QString::number(i); node->SetName(name.toStdString()); //create small sphere and use it as surface mitk::Surface::Pointer mySphere = mitk::Surface::New(); 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); } m_VisFilter->Update(); } 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(); } void QmitkNavigationDataPlayerView::SetInteractionComponentsEnabledState(bool isActive){ m_Controls->m_grpbxSettings->setEnabled(isActive); m_Controls->m_grpbxControls->setEnabled(isActive); } \ 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 bbafa6e5dd..6b24b6f537 100644 --- a/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerView.h +++ b/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerView.h @@ -1,136 +1,138 @@ /*=================================================================== 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 +#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 FIXME not currently used */ void OnPlayingStarted(); /*! \brief loads a file and triggers creation of players and the pipeline */ void OnOpenFile(); /*! \brief Creates the correct player and displays the according widget */ void OnSelectPlayer(); /*! \brief FIXME not currently used */ void OnSetRepeat(); /*! \brief FIXME not currently used */ void OnSetMicroservice(); /*! \brief Triggers the creation and destruction of the rendering pipeline */ void OnSetDisplay(); /*! \brief FIXME not currently used */ void OnUpdate(); protected: /** * \brief configures the player according to the checkboxes set in the GUI */ void ConfigurePlayer(); /** * \brief Creates the Rendering Pipeline necessary to Render the images */ void CreatePipeline(); /** * \brief Destroys the Rendering Pipeline (but not the player) */ void DestroyPipeline(); /** * \brief Makes player component active or inactive. * * Used to activate all components once data is loaded */ void SetInteractionComponentsEnabledState(bool isActive); 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; + mitk::NavigationToolStorage::Pointer m_ToolStorage; QmitkStdMultiWidget* m_MultiWidget; QmitkIGTPlayerWidget* m_PlayerWidget; ///< this bundle's playback widget private: }; #endif // _QMITKNAVIGATIONDATAPLAYERVIEW_H_INCLUDED \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerViewControls.ui b/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerViewControls.ui index 8ebdfef54e..01b0369fbc 100644 --- a/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerViewControls.ui +++ b/Plugins/org.mitk.gui.qt.igttracking/src/internal/QmitkNavigationDataPlayerViewControls.ui @@ -1,188 +1,188 @@ QmitkNavigationDataPlayerViewControls 0 0 415 762 0 0 QmitkTemplate File Management Open File No navigation data set loaded... Frames: Tools: N/A N/A true Settings Sequential Player true Time-based Player Repeat true Register as Microservice - true + false Display true Player Controls Qt::Vertical 20 40 QmitkNavigationDataSequentialPlayerControlWidget QWidget
QmitkNavigationDataSequentialPlayerControlWidget.h
1
QmitkNavigationDataPlayerControlWidget QWidget
QmitkNavigationDataPlayerControlWidget.h
1