diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.igtexample/CMakeLists.txt deleted file mode 100644 index ef6cf53471..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -IF (NOT APPLE) - MACRO_CREATE_MITK_PLUGIN(QmitkExt MitkIGT MitkIGTUI) -ENDIF() diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/META-INF/MANIFEST.MF b/Modules/Bundles/org.mitk.gui.qt.igtexample/META-INF/MANIFEST.MF deleted file mode 100644 index 7cdcf9465b..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-Name: IGT Example -Bundle-SymbolicName: org.mitk.gui.qt.igtexample -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.igtexample/documentation/UserManual/ImageGuidedTherapy.png b/Modules/Bundles/org.mitk.gui.qt.igtexample/documentation/UserManual/ImageGuidedTherapy.png deleted file mode 100644 index 5d3aa7d072..0000000000 Binary files a/Modules/Bundles/org.mitk.gui.qt.igtexample/documentation/UserManual/ImageGuidedTherapy.png and /dev/null differ diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/documentation/UserManual/QmitkIGTExample.dox b/Modules/Bundles/org.mitk.gui.qt.igtexample/documentation/UserManual/QmitkIGTExample.dox deleted file mode 100644 index 41df68ad81..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/documentation/UserManual/QmitkIGTExample.dox +++ /dev/null @@ -1,76 +0,0 @@ -/** -\bundlemainpage{org.igtexample} The MITK-IGT Showcase Module - -\image html ImageGuidedTherapy.png "Icon of the Module" - -\section QmitkIGTExampleViewUserManualSummary Summary - -This module demonstrates the capabilities of the MITK-IGT component. It allows to track and visualize objects using a tracking device. -It is not a end-user application module, but a showcase for developer that want to use the MITK-IGT component. - - -Please see \ref QmitkIGTExampleViewUserManualDetails for more detailed information on usage and supported filters. -If you encounter problems using the module, please have a look at the \ref IGTExampleTrouble page. - -\section QmitkIGTExampleViewUserManualDetails Detailed description - -Manual sections: - -- \ref IGTExampleOverview -- \ref IGTExampleTrackerSelection -- \ref IGTExampleTrackingTest -- \ref IGTExampleNavigationTest -- \ref IGTExampleTrouble - -\section IGTExampleOverview Overview - -This module allows to select a tracking device, add tracked objects ("Tools") and use different visualisations for the -tracking data. - - -\section IGTExampleTrackerSelection Selecting a tracking device - -Choose one of the following available tracking devices: - - Polaris from Northern Digital Inc. (should work for NDI Vicra too) - - Aurora from NDI - - MicronTracker from Claron Technologies Inc. - - MicroBird from Ascension Technology Corporation - - a virtual (simulated) tracking device - -note that you need to have the tracking devices connected to your computer, the drivers must be installed -and MITK must be properly configured in order to access the tracking devices. Only the VirtualTrackingDevice -does not need a hardware device connected to your computer. -If you select the optical Polaris or MicronTracker devices, you have to load tool definition files for each object that you want to track. -Click on the Load Tool(s) button to load these files. -The Polaris and Aurora tracking devices use a serial port connection to the computer. You have to specify the serial port name -in the Port text field. Standard port names are "COM1", "COM2",... for windows systems and /dev/ttyS0, ... for unix systems. - - - -\section IGTExampleTrackingTest testing the tracking - -Click on "Start MITK-IGT-Tracking Test". If the tracking device is able to track your tools, -the position and orientation values should be printed in the text output area below the button. - - -\section IGTExampleNavigationTest testing the navigation pipeline - -Click on "Start MITK-IGT-Navigation Test". This will instantiate the following MITK-IGT filterpipeline: - - a displacement filter will add a offset to the tracking data. You can specify the offset in x, y and z direction in the "Offset" text fields. - - a visualization filter will render a cone for each tool at the current position and orientation - - if you have checked the "Show trajectories" checkbox, a NavigationDataToPointSetFilter will add the positions of the tools to a pointset - -The pipeline will not be executed automatically. Each time you click on the "Measure!" button, the pipeline will be updated with the current -tracking data. Alternatively, you can click on the "Start measure continuously" button, which will automatically update the pipeline every 100 ms. -If you click on the "Show Error Plot" button, a NavigationDataToMessageFilter will be instantiated that will plot the error value that the tracking device reports over time and additionally visualize the error in a progress bar. - - -\section IGTExampleRecorderTest recording and replaying tracking data -You can save the tracking data to a file by clicking on the "Start Recording Test" button. Clicking "Start Replaying" will stop the recording -and replay the stored tracking data. The replayed data is visualized with the NavigationDataToPointSetFilter. It will draw a movement trajectory. - - -\section IGTExampleTrouble Troubleshooting - - If you don't see anything in the 3D render window, you need to initialize the views properly. The easiest way is to load an image or surface file. You can also try to perform a global reinit in the DataManager component. -*/ diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/documentation/doxygen/modules.dox b/Modules/Bundles/org.mitk.gui.qt.igtexample/documentation/doxygen/modules.dox deleted file mode 100644 index dac89965c9..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/documentation/doxygen/modules.dox +++ /dev/null @@ -1,16 +0,0 @@ -/** - \defgroup org_mitk_gui_qt_igtexample org.mitk.gui.qt.igtexample Plugin - \ingroup MITKPlugins - - \brief Describe your plugin here. - -*/ - -/** - \defgroup org_mitk_gui_qt_igtexample_internal Internal - \ingroup org_mitk_gui_qt_igtexample - - \brief This subcategory includes the internal classes of the org.mitk.gui.qt.igtexample 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/Modules/Bundles/org.mitk.gui.qt.igtexample/files.cmake b/Modules/Bundles/org.mitk.gui.qt.igtexample/files.cmake deleted file mode 100644 index 965eb94cad..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/files.cmake +++ /dev/null @@ -1,43 +0,0 @@ -SET(SRC_CPP_FILES - -) - -SET(INTERNAL_CPP_FILES - QmitkIGTExampleView.cpp - QmitkIGTExampleTesting.cpp - QmitkIGTRecorderView.cpp -) - -SET(UI_FILES - src/internal/QmitkIGTExampleViewControls.ui - src/internal/QmitkIGTRecorderViewControls.ui -) - -SET(MOC_H_FILES - src/internal/QmitkIGTExampleView.h - src/internal/QmitkIGTRecorderView.h -) - -SET(RESOURCE_FILES - resources/ImageGuidedTherapyExample.png -# list of resource files which can be used by the plug-in -# system without loading the plug-ins shared library, -# for example the icon used in the menu and tabs for the -# plug-in views in the workbench -) - -SET(RES_FILES -# uncomment the following line if you want to use Qt resources -# resources/QmitkIGTExampleView.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.igtexample/manifest.cpp b/Modules/Bundles/org.mitk.gui.qt.igtexample/manifest.cpp deleted file mode 100644 index a7bf126d72..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/manifest.cpp +++ /dev/null @@ -1,27 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date: 2009-05-28 17:19:30 +0200 (Do, 28 Mai 2009) $ -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/QmitkIGTExampleView.h" -#include "src/internal/QmitkIGTRecorderView.h" - -POCO_BEGIN_NAMED_MANIFEST(berryIViewPart, berry::IViewPart) - POCO_EXPORT_CLASS(::QmitkIGTExampleView) - POCO_EXPORT_CLASS(::QmitkIGTRecorderView) -POCO_END_MANIFEST diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.igtexample/plugin.xml deleted file mode 100644 index 2065d6c200..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/plugin.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/resources/ImageGuidedTherapyExample.png b/Modules/Bundles/org.mitk.gui.qt.igtexample/resources/ImageGuidedTherapyExample.png deleted file mode 100644 index 3eaaa16d73..0000000000 Binary files a/Modules/Bundles/org.mitk.gui.qt.igtexample/resources/ImageGuidedTherapyExample.png and /dev/null differ diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/resources/QmitkIGTExampleView.qrc b/Modules/Bundles/org.mitk.gui.qt.igtexample/resources/QmitkIGTExampleView.qrc deleted file mode 100644 index 0d21b1560a..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/resources/QmitkIGTExampleView.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/IgtexampleDll.h b/Modules/Bundles/org.mitk.gui.qt.igtexample/src/IgtexampleDll.h deleted file mode 100644 index 95271e141c..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/IgtexampleDll.h +++ /dev/null @@ -1,43 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date: 2009-05-28 17:19:30 +0200 (Do, 28 Mai 2009) $ -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 _IGTEXAMPLE_EXPORT_DLL_H_ -#define _IGTEXAMPLE_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_igtexample_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_igtexample_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_igtexample_EXPORTS) - #define IGTEXAMPLE_EXPORT __declspec(dllexport) - #else - #define IGTEXAMPLE_EXPORT __declspec(dllimport) - #endif -#endif - - -#if !defined(IGTEXAMPLE_EXPORT) - #define IGTEXAMPLE_EXPORT -#endif - -#endif /*_IGTEXAMPLE_EXPORT_DLL_H_*/ diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleTesting.cpp b/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleTesting.cpp deleted file mode 100644 index 1632e581ea..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleTesting.cpp +++ /dev/null @@ -1,53 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date: 2009-01-05 17:52:33 +0100 (Mo, 05 Jan 2009) $ -Version: $Revision: 16006 $ - -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 "QmitkIGTExampleView.h" - -#ifdef BUILD_TESTING // only if we build a test driver - -#include "ui_QmitkIGTExampleViewControls.h" - -#include "mitkTestingMacros.h" -//#include "QmitkUserInputSimulation.h" - - -/** -* \brief Test method for QmitkIGTExample -*/ -int QmitkIGTExampleView::TestYourself() -{ - MITK_TEST_BEGIN("QmitkIGTExampleView::TestYourself"); - - // Write test here. - // click on Buttons with QmitkUserInputSimulation::MouseClick(m_Controls->m_MyButton, Qt::LeftButton); - // simulate key presses with QmitkUserInputSimulation::KeyboardTypeKey(m_Controls->m_MyWidget, Qt::Key_Down); - // check results using MITK_TEST_CONDITION_REQUIRED(myBoolExpression ,"my testcase " << someVariable_that_should_be_mentioned); - // and MITK_TEST_CONDITION(myBoolExpression ,"my testcase " << someVariable_that_should_be_mentioned); - // Write Output to the command line only with MITK_TEST_OUTPUT(<< "Hello"); - // and MITK_TEST_OUTPUT_NO_ENDL(<< "Hello"); - // artificially fail a test with MITK_TEST_FAILED_MSG(<<"failed because!"); - // more information about writing a test can be found here: http://makalu/mbiwiki/TestsErstellen - - #ifndef MITK_FAST_TESTING - // execute time consuming tests only in here (execution of time consuming filter pipeline...) - - #endif - - MITK_TEST_END(); -} - -#endif // BUILD_TESTING diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleView.cpp b/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleView.cpp deleted file mode 100644 index 1314075c60..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleView.cpp +++ /dev/null @@ -1,837 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date: 2009-05-06 16:03:09 +0200 (Mi, 06 Mai 2009) $ -Version: $Revision: 17113 $ - -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 "QmitkIGTExampleView.h" -//#include "QmitkIGTExampleViewControls.h" -//#include "resources/icon.xpm" - -#include "QmitkStdMultiWidget.h" -//#include "QmitkTreeNodeSelector.h" - -#include "mitkClaronTool.h" -#include "mitkClaronTrackingDevice.h" -#include "mitkCone.h" -#include "mitkInternalTrackingTool.h" -#include "mitkNDIPassiveTool.h" -#include "mitkNDITrackingDevice.h" -#include "mitkVirtualTrackingDevice.h" -#include "mitkNavigationDataObjectVisualizationFilter.h" -#ifdef MITK_USE_MICROBIRD_TRACKER -#include "mitkMicroBirdTrackingDevice.h" -#endif // MITK_USE_MICROBIRD_TRACKER - -#include "mitkProgressBar.h" -#include "mitkProperties.h" -#include "mitkPropertyList.h" -#include "mitkSerialCommunication.h" -#include "mitkStatusBar.h" -#include "mitkTrackingTypes.h" -#include "mitkVector.h" -#include "mitkGeometry3D.h" - -#include - -#include -#include - - - -//#include -//#include -#include -#include -#include -#include -#include -#include -//#include - -//#include -#include - - -QmitkIGTExampleView::QmitkIGTExampleView(QObject * /*parent*/, const char * /*name*/) - : QmitkFunctionality() -{ - m_Timer = new QTimer(this); - m_RecordingTimer = new QTimer(this); - m_PlayingTimer = new QTimer(this); - m_XValues.clear(); - m_YValues.clear(); - m_Controls = NULL; -} - - -QmitkIGTExampleView::~QmitkIGTExampleView() -{ - this->OnStop(); // cleanup IGT pipeline, if tracking is in progress - m_Timer->stop(); - m_RecordingTimer->stop(); - m_PlayingTimer->stop(); - m_Recorder = NULL; - m_Player = NULL; - m_RecordingTimer = NULL; - m_PlayingTimer = NULL; -} - -void QmitkIGTExampleView::CreateQtPartControl(QWidget *parent) -{ - if (!m_Controls) - { - m_Controls = new Ui::QmitkIGTExampleControls; - m_Controls->setupUi(parent); - - //m_Controls->m_TextOutput->setTextFormat(Qt::PlainText); - out = m_Controls->m_TextOutput; - - CreateConnections(); - //mitk::Vector3D offset; - - //if (GetFunctionalityOptionsList()->GetPropertyValue("NavigationDataDisplacementFilter_Offset", offset) == true) - //{ - //m_Controls->SetDisplacementFilterParameters(GetFunctionalityOptionsList()); - //out->append("found offset value in persistence storage"); - //} - - m_Controls->m_X->setText("10"); - m_Controls->m_Y->setText("3"); - m_Controls->m_Z->setText("5"); - - m_Controls->m_PlayingButtonToggle->setEnabled(false); - } -} - -void QmitkIGTExampleView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget) -{ - m_MultiWidget = &stdMultiWidget; -} - -void QmitkIGTExampleView::StdMultiWidgetNotAvailable() -{ - m_MultiWidget = NULL; -} -void QmitkIGTExampleView::CreateConnections() -{ - if ( m_Controls ) - { - connect((QObject*)(m_Controls->m_ChangeOffset), SIGNAL(clicked()), (QObject*) this, SLOT(OnParametersChanged())); // update filter parameters with values from the GUI widget - connect((QObject*)(m_Controls->m_TrackingDevice), SIGNAL(textChanged(QString)), (QObject*) this, SLOT(OnTrackingDeviceTextChanged(QString))); - connect((QObject*)(m_Controls->m_TrackingDevice), SIGNAL(activated(QString)),(QObject*) this, SLOT(OnTrackingDeviceTextChanged(QString))); - - connect( (QObject*)(m_Controls->m_StartTrackingButton), SIGNAL(clicked()),(QObject*) this, SLOT(OnTestTracking())); // execute tracking test code - connect( (QObject*)(m_Controls->m_LoadToolBtn), SIGNAL(clicked()),(QObject*) this, SLOT(OnLoadTool())); // load tools for specific tracking devices - connect( (QObject*)(m_Controls->m_StartNavigationButton), SIGNAL(clicked()),(QObject*) this, SLOT(OnTestNavigation())); // build and initialize navigation filter pipeline - connect( (QObject*)(m_Controls->m_MeasureBtn), SIGNAL(clicked()),(QObject*) this, SLOT(OnMeasure())); // execute navigation filter pipeline to read transformed tracking data - connect( (QObject*)(m_Controls->m_MeasureContinuously), SIGNAL(clicked()),(QObject*) this, SLOT(OnMeasureContinuously())); // execute navigation filter pipeline to read transformed tracking data - connect( (QObject*)(m_Controls->m_StopBtn), SIGNAL(clicked()),(QObject*) this, SLOT(OnStop())); // cleanup navigation filter pipeline - //connect( (QObject*)(m_Controls), SIGNAL(ParametersChanged()),(QObject*) this, SLOT(OnParametersChanged())); // update filter parameters with values from the GUI widget - connect( m_Timer, SIGNAL(timeout()), this, SLOT(OnMeasure()) ); - connect( m_RecordingTimer, SIGNAL(timeout()), this, SLOT(OnRecording()) ); - connect( m_PlayingTimer, SIGNAL(timeout()), this, SLOT(OnPlaying()) ); - connect( (QObject*)(m_Controls->m_RecordingButtonToggle), SIGNAL(toggled(bool)),(QObject*) this, SLOT(OnRecordingToggle(bool))); // execute tracking test code - connect( (QObject*)(m_Controls->m_PlayingButtonToggle), SIGNAL(toggled(bool)),(QObject*) this, SLOT(OnPlayingToggle(bool))); // execute tracking test code - connect( (QObject*)(m_Controls->m_ShowErrorPlotBtn), SIGNAL(clicked()),(QObject*) this, SLOT(OnShowErrorPlot())); // execute tracking test code - } -} - -void QmitkIGTExampleView::Activated() -{ - QmitkFunctionality::Activated(); -} -void QmitkIGTExampleView::Deactivated() -{ - QmitkFunctionality::Deactivated(); -} -void QmitkIGTExampleView::OnTestTracking() -{ - WaitCursorOn(); - mitk::StatusBar::GetInstance()->DisplayText("Executing test of the tracking component", 4000); - - /* Create & set up tracking device with a tool */ - mitk::TrackingDevice::Pointer tracker = this->ConfigureTrackingDevice(); - if (tracker.IsNull()) - { - out->append("Error creating tracking device. Did you provide all parameters?"); - return; - } - - /* open the connection, load tools that are connected (active Tools) and initialize them. */ - out->append("opening connection to tracking device"); - if (tracker->OpenConnection() == false) - { - out->append(QString("ERROR during OpenConnection(): ") + QString(tracker->GetErrorMessage())); - tracker->CloseConnection(); - WaitCursorOff(); - return; - } - else - out->append("successfully connected to tracking device."); - - /* Start tracking */ - if (tracker->StartTracking() == false) - { - out->append(QString("ERROR during StartTracking(): ") + QString(tracker->GetErrorMessage())); - tracker->CloseConnection(); - WaitCursorOff(); - return; - } - else - out->append("tracking device is tracking now."); - - /* read tracking data 50 times */ - out->append("Starting to read tracking data for all tools."); - mitk::TrackingTool* t = NULL; - mitk::Point3D pos; - mitk::Quaternion quat; - for(int i=0; i< 50; i++) // 50x - { - for (unsigned int i = 0; i < tracker->GetToolCount(); i++) // each tool - { - std::stringstream output; - t = tracker->GetTool(i); - if (t == NULL) - continue; - output << "Tool " << t->GetToolName() << ":" << std::endl; - if (t->IsDataValid() == true) - { - t->GetPosition(pos); - output << " Position = <" << pos[0] << ", " << pos[1] << ", " << pos[2] << ">" << std::endl; - t->GetOrientation(quat); - output << " Orientation = <" << quat[0] << ", " << quat[1] << ", " << quat[2] << ", " << quat[3] << ">" << std::endl; - output << " TrackingError = " << t->GetTrackingError() << std::endl; - } - else - output << " Data is invalid. Error message: " << t->GetErrorMessage() << std::endl; - output << "--------------------------------------------" << std::endl; - out->append(output.str().c_str()); // append string stream content to gui widget - } - //wait a little to get the next coordinate - itksys::SystemTools::Delay(100); - } - - /* Stop tracking */ - out->append("Enough tracking data. Stopping tracking now."); - if (tracker->StopTracking() == false) - { - out->append(QString("ERROR during StopTracking(): ") + QString(tracker->GetErrorMessage())); - tracker->CloseConnection(); - WaitCursorOff(); - return; - } - else - out->append("Tracking stopped."); - - /* Stop tracking */ - if (tracker->CloseConnection() == false) - { - out->append(QString("ERROR during CloseConnection(): ") + QString(tracker->GetErrorMessage())); - WaitCursorOff(); - return; - } - else - out->append("tracking stopped."); - - mitk::StatusBar::GetInstance()->DisplayText("test of the tracking component finished", 2000); - WaitCursorOff(); // restore normal mouse cursor after you finished -} - - -void QmitkIGTExampleView::OnTestNavigation() -{ - WaitCursorOn(); // always good to show the user that the application is processing and will not react to user input for a while - mitk::StatusBar::GetInstance()->DisplayText("Executing test of the navigation component", 4000); // tell the user what you are doing - - /* Create & set up tracking device with a tool */ - mitk::TrackingDevice::Pointer tracker = this->ConfigureTrackingDevice(); // configure selected tracking device - - /* Now set up pipeline */ - try - { - m_Source = mitk::TrackingDeviceSource::New(); // we need the filter objects to stay alive, therefore they must be members - m_Source->SetTrackingDevice(tracker); - out->append("created and initialized TrackingDeviceSource filter"); - - //connect to tracking device - out->append("connected filter pipeline"); - m_Source->Connect(); - - m_Displacer = mitk::NavigationDataDisplacementFilter::New(); - mitk::Vector3D offset; - /* check if there is a Offset parameter stored in our propertylist. If none is found, use hardcoded value */ - //if (GetFunctionalityOptionsList()->GetPropertyValue("NavigationDataDisplacementFilter_Offset", offset) == false) // search for Offset parameter - //{ - mitk::FillVector3D(offset, 1.0, 1.0, 1800.0); // nothing found, use default value - // GetFunctionalityOptionsList()->SetProperty("NavigationDataDisplacementFilter_Offset", mitk::Vector3DProperty::New(offset)); // add the property to the list - //} - m_Displacer->SetOffset(offset); - /* --> Instead, we could have just called m_Displacer->SetParameters(GetFunctionalityOptionsList()) to set all stored parameters at once. - But then we would have to check, if the PropertyList contains the parameters ( they were stored in the list before by the - persistence mechanism or by the GUI Event ParametersChanged that calls the OnParametersChanged() method) - */ - - out->append(QString("created and initialized NavigationDataDisplacementFilter filter using <%1, %2, %3> as offset").arg(offset[0]).arg(offset[1]).arg(offset[2])); - unsigned int numberOfOutputs = m_Source->GetNumberOfOutputs(); - for (unsigned int i = 0; i < numberOfOutputs; i++) - m_Displacer->SetInput(i , m_Source->GetOutput(i)); // connect filter - - //Now we create a visualization filter object to hang up the tools into the datatree and visualize them in the widgets. - mitk::NavigationDataObjectVisualizationFilter::Pointer visualizer = mitk::NavigationDataObjectVisualizationFilter::New(); - for (unsigned int i = 0; i < m_Displacer->GetNumberOfOutputs(); i++) - visualizer->SetInput(i, m_Displacer->GetOutput(i)); - - //create new BaseData for each tool - for (unsigned int i = 0; i < m_Displacer->GetNumberOfOutputs();i++) - { - mitk::Cone::Pointer mitkToolData = mitk::Cone::New(); - float scale[] = {20.0, 20.0, 20.0}; - mitkToolData->GetGeometry()->SetSpacing(scale); - //create DataNode - mitk::DataNode::Pointer toolNode = mitk::DataNode::New(); - toolNode->SetData(mitkToolData); - toolNode->SetName(QString("MyInstrument %1").arg(i).toLatin1()); - toolNode->SetColor(0.2, 0.3 * i ,0.9 - 0.2 * i); //different colors - toolNode->Modified(); - //add it to the DataStorage - this->GetDefaultDataStorage()->Add(toolNode); - visualizer->SetRepresentationObject(i, mitkToolData); - } - m_EndOfPipeline = visualizer; - - /* set up trajectories */ - if (m_Controls->m_ShowTrajectories->isChecked()) - { - m_PointSetFilter = mitk::NavigationDataToPointSetFilter::New(); - m_PointSetFilter->SetOperationMode(mitk::NavigationDataToPointSetFilter::Mode3D); - for (unsigned int i = 0; i < visualizer->GetNumberOfOutputs(); ++i) - m_PointSetFilter->SetInput(i, visualizer->GetOutput(i)); - for (unsigned int i = 0; i < m_PointSetFilter->GetNumberOfOutputs(); i++) - { - mitk::PointSet* p = m_PointSetFilter->GetOutput(i); - assert(p); - - mitk::DataNode::Pointer pointSetNode = mitk::DataNode::New(); - pointSetNode->SetData(p); - pointSetNode->SetName(QString("Trajectory of Output %1").arg(i).toLatin1()); - mitk::Color color; - color.Set(0.2, 0.3 * i ,0.9 - 0.2 * i); - pointSetNode->SetColor(color); //change color of points - pointSetNode->SetProperty("contourcolor", mitk::ColorProperty::New(color)); // change color of trajectory line - pointSetNode->SetProperty("pointsize", mitk::FloatProperty::New(2.0)); // enlarge visualization of points - pointSetNode->SetProperty("contoursize", mitk::FloatProperty::New(1.0)); // enlarge visualization of trajectory line - pointSetNode->SetBoolProperty("show contour", true); - pointSetNode->SetBoolProperty("updateDataOnRender", false); // do not call Update() on the pointset during render (this would cause a execution of the pipeline that is still connected to the pointset) - - GetDefaultDataStorage()->Add(pointSetNode); //add it to the DataStorage - out->append(QString("Creating Pointset %1 for trajectory visualization").arg(i)); - } - } - - //start the tracking - m_Source->StartTracking(); - out->append("started source filter. tracking is running now."); - } - catch (std::exception& exp) - { - out->append(QString("ERROR during instantiation and initialization of TrackingDeviceSource filter: ") + QString(exp.what())); - m_Displacer = NULL; - m_PointSetFilter = NULL; - m_EndOfPipeline = NULL; - if (m_Source.IsNotNull()) - { - m_Source->StopTracking(); - m_Source->Disconnect(); - m_Source = NULL; - } - tracker = NULL; - WaitCursorOff(); - return; - } - /* set up GUI, so that measurements can be done*/ - m_Controls->m_MeasureBtn->show(); - m_Controls->m_MeasureBtn->setEnabled(true); - m_Controls->m_MeasureContinuously->show(); - m_Controls->m_MeasureContinuously->setEnabled(true); - m_Controls->m_StopBtn->show(); - m_Controls->m_StopBtn->setEnabled(true); - m_Controls->m_StartTrackingButton->setEnabled(false); - m_Controls->m_StartNavigationButton->setEnabled(false); - - //Initialize the views if no data was loaded yet - mitk::RenderingManager::GetInstance()->InitializeViews(); - - out->append("Tracking Pipeline ready. Click on Measure! button to get most current navigation data"); - WaitCursorOff(); // restore normal mouse cursor after you finished -} - - -void QmitkIGTExampleView::OnMeasure() -{ - if (m_EndOfPipeline.IsNull()) - { - out->append("Tracking Pipeline not ready."); - return; - } - /* Get the output of the last filter with output and print it */ - for (unsigned int i = 0; i < m_EndOfPipeline->GetNumberOfOutputs(); ++i) // for all outputs of the filter - { - mitk::NavigationData* nd = m_EndOfPipeline->GetOutput(i); - if (nd == NULL) - { - out->append("WARNING: Navigation Data is NULL"); - continue; - } - nd->Update(); // update the navigation data. this will read current tracking data from tracking device. - // this will also update the visualization filter who causes a repainting of the scene - - std::stringstream output; - output << "Navigation Data of Output " << i << ":" << std::endl; - if (nd->IsDataValid() == true) - { - output << " Position = " << nd->GetPosition() << std::endl; - output << " Orientation = <" << nd->GetOrientation() << std::endl; - output << " Error = " << nd->GetCovErrorMatrix() << std::endl; - } - else - output << " Data is invalid."<< std::endl; - output << "--------------------------------------------" << std::endl; - out->append(output.str().c_str()); // append string stream content to gui widget - } - if (m_PointSetFilter.IsNotNull()) // update tracjectory generation if it is in use - m_PointSetFilter->Update(); - - if (m_MessageFilter.IsNotNull()) // update error visualization if it is in use - m_MessageFilter->Update(); - - mitk::BaseRenderer::GetInstance(m_MultiWidget->mitkWidget4->GetRenderWindow())->RequestUpdate(); // update 3D render window -} - - -void QmitkIGTExampleView::OnMeasureContinuously() -{ - if (m_Controls->m_MeasureContinuously->text()=="Start measure continuously") - { - m_Timer->start(100); - m_Controls->m_MeasureContinuously->setText("Stop measure continuously"); - } - else if (m_Controls->m_MeasureContinuously->text()=="Stop measure continuously") - { - m_Timer->stop(); - m_Controls->m_MeasureContinuously->setText("Start measure continuously"); - } -} - - -void QmitkIGTExampleView::OnStop() -{ - WaitCursorOn(); - m_Controls->m_MeasureBtn->hide(); - m_Controls->m_MeasureBtn->setEnabled(false); - m_Controls->m_MeasureContinuously->hide(); - m_Controls->m_MeasureContinuously->setEnabled(false); - m_Controls->m_StopBtn->hide(); - m_Controls->m_StopBtn->setEnabled(false); - m_Controls->m_StartTrackingButton->setEnabled(true); - m_Controls->m_StartNavigationButton->setEnabled(true); - try - { - if (m_Source.IsNotNull()) - { - m_Source->StopTracking(); - m_Source->Disconnect(); - m_Source = NULL; - } - m_EndOfPipeline = NULL; - m_PointSetFilter = NULL; - m_Displacer = NULL; - m_MessageFilter = NULL; - WaitCursorOff(); - } - catch (std::exception& exp) - { - out->append(QString("ERROR during cleanup of filter pipeline: ") + QString(exp.what())); - m_Source = NULL; - WaitCursorOff(); - return; - } - out->append("Filter pipeline stopped and destroyed. Everything is back to normal."); - WaitCursorOff(); -} - - -void QmitkIGTExampleView::OnParametersChanged() -{ - mitk::Vector3D v; - v[0] = m_Controls->m_X->text().toFloat(); - v[1] = m_Controls->m_Y->text().toFloat(); - v[2] = m_Controls->m_Z->text().toFloat(); - - mitk::PropertyList::Pointer parameters = mitk::PropertyList::New(); - parameters->SetProperty("NavigationDataDisplacementFilter_Offset", mitk::Vector3DProperty::New(v)); - - if(m_Displacer.IsNotNull()) - { - m_Displacer->SetParameters(parameters.GetPointer()); - } - else{ - QMessageBox::warning(NULL, "No navigation test started", "Please start a navigationtest first", QMessageBox::Ok, NULL); - } -} - - -void QmitkIGTExampleView::AddToFunctionalityOptionsList(mitk::PropertyList* /*pl*/) -{ - //Due to porting to Qt4 this feature is not ported yet - - //QmitkFunctionality::AddToFunctionalityOptionsList(pl); // let the super class add the properties - - //// then initialize everything according to the properties - - //if (m_Controls != NULL) - //{ - // m_Controls->SetDisplacementFilterParameters(pl); // update GUI - //} - //// MITK-IGT filters will be initialized with the properties in OnTestNavigation() -} -void QmitkIGTExampleView::OnLoadTool() -{ - QStringList s = QFileDialog::getOpenFileNames(m_Parent, "Select one or more tool definition files",QDir::currentPath(), "NDI Tool Definition Files (*.rom);;All files (*.*)"); - if (s.empty() == false) - { - m_Controls->m_ToolFileName->setText(s.front()); - } - m_ToolList = s; -} - -mitk::TrackingDevice::Pointer QmitkIGTExampleView::ConfigureTrackingDevice() -{ - mitk::TrackingDevice::Pointer tracker; - QString selectedDevice = m_Controls->m_TrackingDevice->currentText().toLatin1(); - if ((selectedDevice == "NDI Polaris") - || (selectedDevice == "NDI Aurora")) - { - mitk::NDITrackingDevice::Pointer trackerNDI = mitk::NDITrackingDevice::New(); - trackerNDI->SetDeviceName(m_Controls->m_Port->text().toStdString()); - trackerNDI->SetBaudRate(mitk::SerialCommunication::BaudRate115200); - out->append(QString("creating NDI Tracker on ") + m_Controls->m_Port->text() + QString(" with 115200 Baud")); - tracker = trackerNDI; - - if (selectedDevice == "NDI Polaris") - { - trackerNDI->SetType(mitk::NDIPolaris); - QStringList::iterator it; - unsigned int index = 0; - for (it = m_ToolList.begin(); it != m_ToolList.end(); ++it ) - { - trackerNDI->AddTool(QString("MyInstrument %1").arg(index++).toLatin1(), (*it).toLatin1()); - out->append(QString("adding tool 'MyInstrument' with rom file '") + (*it) + QString("'")); - } - } - else if (selectedDevice == "NDI Aurora") - { - trackerNDI->SetType(mitk::NDIAurora); - } - } - else if (selectedDevice == "Micron Tracker") - { - mitk::ClaronTrackingDevice::Pointer trackerMT = mitk::ClaronTrackingDevice::New(); - out->append("creating Micron Tracker"); - QStringList::iterator it; - unsigned int index = 0; - for (it = m_ToolList.begin(); it != m_ToolList.end(); ++it ) - { - trackerMT->AddTool(QString("MyInstrument %1").arg(index++).toLatin1(), (*it).toLatin1()); // create tool with name and tool definition file - out->append(QString("adding tool 'MyInstrument' with tool definition file '") + (*it) + QString("'")); - } - tracker = trackerMT; - } - else if (selectedDevice == "MicroBird") - { -#ifdef MITK_USE_MICROBIRD_TRACKER - mitk::MicroBirdTrackingDevice::Pointer trackerMB = mitk::MicroBirdTrackingDevice::New(); - mitk::InternalTrackingTool::Pointer toolMB = mitk::InternalTrackingTool::New(); - trackerMB->AddTool(toolMB); - out->append("creating MicroBird tracking device with one tool"); -#else - out->append("MicroBird support not available in this version. Please select a different tracking device"); -#endif // MITK_USE_MICROBIRD_TRACKER - } - else if (selectedDevice == "VirtualTrackingDevice") - { - mitk::VirtualTrackingDevice::Pointer trackerVirtual = mitk::VirtualTrackingDevice::New(); - trackerVirtual->AddTool("toolRandom1"); - trackerVirtual->AddTool("toolRandom2"); - tracker = trackerVirtual; - out->append("creating virtual tracking device with two tools"); - } - else - { - tracker = NULL; - } - return tracker; -} - - -void QmitkIGTExampleView::OnRecordingToggle(bool toggled) -{ - try - { - - mitk::TrackingDevice::Pointer tracker = this->ConfigureTrackingDevice(); - - if (tracker.IsNull()) - { - out->append("Error creating tracking device. Did you provide all parameters?"); - return; - } - - else if(!toggled) - { - - /* Stop recording */ - m_RecordingTimer->stop(); - m_Recorder->StopRecording(); - out->append(QString("Stopped recording")); - m_Controls->m_RecordingButtonToggle->setText(QString("Start Recording Test")); - m_Controls->m_PlayingButtonToggle->setEnabled(true); - } - - else - { - - m_Controls->m_PlayingButtonToggle->setEnabled(false); - m_Source = mitk::TrackingDeviceSource::New(); - m_Source->SetTrackingDevice(tracker); //here we set the device for the pipeline source - - m_Source->Connect(); //here we connect to the tracking system - - //we need the stringstream for building up our filename - std::stringstream filename; - - //the .xml extension and an counter is added automatically - filename << itksys::SystemTools::GetCurrentWorkingDirectory() << "/Test Output"; - - m_Recorder = mitk::NavigationDataRecorder::New(); - m_Recorder->SetFileName(filename.str()); - - //now every output of the displacer object is connected to the recorder object - for (unsigned int i = 0; i < m_Source->GetNumberOfOutputs(); i++) - { - m_Recorder->AddNavigationData(m_Source->GetOutput(i)); // here we connect to the recorder - } - - m_Source->StartTracking(); //start the tracking - m_Recorder->StartRecording(); //after finishing the settings you can start the recording mechanism - - out->append(QString("Starting Recording from ") + QString(m_Controls->m_TrackingDevice->currentText().toLatin1()) - + QString(" to file ") + QString(m_Recorder->GetFileName()) + QString(" now.")); - - //now every update of the recorder stores one line into the file for - //each added NavigationData - m_RecordingTimer->start(100); - - - m_Controls->m_RecordingButtonToggle->setText(QString("Stop Recording Test")); - //m_Controls->m_StartPlayingButton->setEnabled(true); - - } - - } - catch (std::exception& e) - { - out->append(QString("An error occured: ") + QString(e.what())); - m_Controls->m_PlayingButtonToggle->setEnabled(false); - - - } - - -} - - -void QmitkIGTExampleView::OnRecording() -{ - m_Recorder->Update(); - mitk::StatusBar::GetInstance()->DisplayText("Recording tracking data now", 75); // Display recording message for 75ms in status bar -} - - -void QmitkIGTExampleView::OnPlayingToggle(bool toggled) -{ - if(m_Recorder->GetRecording()) - { - /* Stop recording */ - m_RecordingTimer->stop(); - m_Recorder->StopRecording(); - out->append("Stopped recording"); - } - - - if(!toggled) - { - out->append(QString("stopping replay")); - m_Player->StopPlaying(); - m_PlayingTimer->stop(); - m_Controls->m_RecordingButtonToggle->setEnabled(true); - m_Controls->m_PlayingButtonToggle->setText(QString("Start Replaying Test")); - } - - else - { - - m_Controls->m_RecordingButtonToggle->setEnabled(false); - - std::stringstream filename; - //the .xml extension and an counter is added automatically - filename << itksys::SystemTools::GetCurrentWorkingDirectory() << "/Test Output-0.xml"; - - m_Player = mitk::NavigationDataPlayer::New(); - //this is first part of the file name the .xml extension and an counter is added automatically - m_Player->SetFileName(filename.str()); - m_Player->StartPlaying(); //this starts the player - //this is necessary because we do not know how many outputs the player has - - out->append(QString("Starting replay from ") + QString(m_Player->GetFileName())); - - /* Visualize output of player using a mitk::PointSet */ - m_PointSetFilter = mitk::NavigationDataToPointSetFilter::New(); - m_PointSetFilter->SetOperationMode(mitk::NavigationDataToPointSetFilter::Mode3D); - for (unsigned int i = 0; i < m_Player->GetNumberOfOutputs(); i++) - m_PointSetFilter->SetInput(i, m_Player->GetOutput(i)); // connect the player with the pointset filter - - for (unsigned int i = 0; i < m_PointSetFilter->GetNumberOfOutputs(); i++) - { - mitk::PointSet::Pointer p = m_PointSetFilter->GetOutput(i); - assert(p); - - mitk::DataNode::Pointer pointSetNode = mitk::DataNode::New(); - pointSetNode->SetData(p); - pointSetNode->SetName(QString("Trajectory of Output %1").arg(i).toLatin1()); - mitk::Color color; - color.Set(0.25 * i, 1 - 0.25 * i, 0.5); - pointSetNode->SetColor(color); //change color of points - pointSetNode->SetProperty("contourcolor", mitk::ColorProperty::New(color)); // change color of trajectory line - pointSetNode->SetProperty("pointsize", mitk::FloatProperty::New(10.0)); // enlarge visualization of points - pointSetNode->SetProperty("contoursize", mitk::FloatProperty::New(5.0)); // enlarge visualization of trajectory line - pointSetNode->SetBoolProperty("show contour", true); - - this->GetDefaultDataStorage()->Add(pointSetNode); //add it to the DataStorage - out->append(QString("Creating Pointset %1 for replay visualization").arg(i)); - } - - m_PlayingTimer->start(100); // start the playback timer - out->append("starting replay"); - m_Controls->m_PlayingButtonToggle->setText(QString("Stop Replaying Test")); - - } -} - - -void QmitkIGTExampleView::OnPlaying() -{ - m_PointSetFilter->Update(); - mitk::BaseRenderer::GetInstance(m_MultiWidget->mitkWidget4->GetRenderWindow())->RequestUpdate(); // update only 3D render window - mitk::StatusBar::GetInstance()->DisplayText("Replaying tracking data now", 75); // Display replay message for 75ms in status bar -} - - -void QmitkIGTExampleView::OnShowErrorPlot() -{ - if (m_Displacer.IsNull()) // only possible after tracking pipeline is initalized - { - out->append("You have to click on 'Start MITK-IGT-Navigation Test' first"); - return; - } - /* Set up error display */ - m_Controls->m_ErrorPlot->SetPlotTitle("Error Values of tool 1"); - m_Controls->m_ErrorPlot->SetAxisTitle( QwtPlot::xBottom, "Timestamp" ); - m_Controls->m_ErrorPlot->SetAxisTitle( QwtPlot::yLeft, "Error" ); - int curveId = m_Controls->m_ErrorPlot->InsertCurve( "Error value of tool 1" ); - m_Controls->m_ErrorPlot->SetCurvePen( curveId, QPen( Qt::red ) ); - m_XValues.clear(); - m_YValues.clear(); - m_Controls->m_ErrorPlot->setEnabled(true); - m_Controls->m_ErrorPlot->show(); - - m_Controls->m_ErrorBar->setMinimum(0); // needs to be set to meaningful values depending on tracking device and application requirements - m_Controls->m_ErrorBar->setMaximum(100); - m_Controls->m_ErrorBar->setTextVisible (false); - //m_Controls->m_ErrorBar->setStyle(new QWindowsStyle()); // to be able to use custom colors - m_Controls->m_ErrorBar->reset(); - - /*set up IGT pipeline -> GUI connection */ - m_MessageFilter = mitk::NavigationDataToMessageFilter::New(); - m_MessageFilter->SetInput(m_Displacer->GetOutput()); // connect with first output of Displacer - - //this is just for the first tool - m_MessageFilter->AddErrorChangedListener(mitk::MessageDelegate2(this, &QmitkIGTExampleView::OnErrorValueChanged)); -} - - -void QmitkIGTExampleView::OnErrorValueChanged(mitk::NavigationData::CovarianceMatrixType v, unsigned int /*index*/) -{ - /* calculate overall error (this should be replaced with a more meaningful implementation depending on the application requirements) */ - mitk::ScalarType errorValue = 0.0; - for (unsigned int i = 0; i < v.ColumnDimensions; ++i) - for (unsigned int j = 0; j < v.RowDimensions; ++j) - errorValue += v(i, j); - - if ((m_MessageFilter.IsNotNull()) && (m_MessageFilter->GetOutput() != NULL)) - { - mitk::ScalarType timeValue = m_MessageFilter->GetOutput()->GetTimeStamp(); - m_XValues.push_back(timeValue); - m_YValues.push_back(errorValue); - - m_Controls->m_ErrorPlot->SetCurveData( 0, m_XValues, m_YValues ); // hardcoded for curve id 0! - m_Controls->m_ErrorPlot->Replot(); - } - - mitk::ScalarType progressClampError = (errorValue < 1.0) ? errorValue* 100 : 100;// use primitive mapping of error values to the progress bar range of 0..100. needs to be adjusted to meaningful values - m_Controls->m_ErrorBar->setValue(progressClampError); - -} - - -void QmitkIGTExampleView::OnTrackingDeviceTextChanged( const QString & ) -{ - if (m_Controls->m_TrackingDevice->currentText() == "NDI Polaris") - { - m_Controls->m_LoadToolBtn->setEnabled(true); - m_Controls->m_ToolFileName->setEnabled(true); - m_Controls->m_PortLabel->setEnabled(true); - m_Controls->m_Port->setEnabled(true); - } - else if (m_Controls->m_TrackingDevice->currentText() == "NDI Aurora") - { - m_Controls->m_LoadToolBtn->setEnabled(false); - m_Controls->m_ToolFileName->setEnabled(false); - m_Controls->m_PortLabel->setEnabled(true); - m_Controls->m_Port->setEnabled(true); - } - else if (m_Controls->m_TrackingDevice->currentText() == "Micron Tracker") - { - m_Controls->m_LoadToolBtn->setEnabled(true); - m_Controls->m_ToolFileName->setEnabled(true); - m_Controls->m_PortLabel->setEnabled(false); - m_Controls->m_Port->setEnabled(false); - } - else - { - m_Controls->m_LoadToolBtn->setEnabled(false); - m_Controls->m_ToolFileName->setEnabled(false); - m_Controls->m_PortLabel->setEnabled(false); - m_Controls->m_Port->setEnabled(false); - } -} diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleView.h b/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleView.h deleted file mode 100644 index 3b8d7979f0..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleView.h +++ /dev/null @@ -1,258 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date: 2009-05-06 10:44:43 +0200 (Mi, 06 Mai 2009) $ -Version: $Revision: 17109 $ - -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(QmitkIGTExampleView_H__INCLUDED) -#define QmitkIGTExampleView_H__INCLUDED - -#include "QmitkFunctionality.h" - -#include "mitkTrackingDeviceSource.h" -#include "mitkNavigationDataDisplacementFilter.h" -#include "mitkTrackingDevice.h" -#include "mitkNavigationDataRecorder.h" -#include "mitkNavigationDataPlayer.h" -#include "mitkNavigationDataToPointSetFilter.h" -#include "mitkNavigationDataToMessageFilter.h" -#include "QmitkPlotWidget.h" - -#include "ui_QmitkIGTExampleViewControls.h" -#include "../IgtexampleDll.h" - -class QmitkStdMultiWidget; -class QmitkIGTExampleViewControls; -class QTextEdit; -/*! -\brief QmitkIGTExampleView - -Example functionality that shows the usage of the MITK-IGT component - -\sa QmitkFunctionality -\ingroup Functionalities -*/ -class QmitkIGTExampleView : public QmitkFunctionality -{ - Q_OBJECT - - public: - /*! - \brief default constructor - */ - QmitkIGTExampleView(QObject *parent=0, const char *name=0); - - /*! - \brief default destructor - */ - virtual ~QmitkIGTExampleView(); - - /*! - \brief method for creating the widget containing the application controls, like sliders, buttons etc. - */ - virtual void CreateQtPartControl(QWidget *parent); - - virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget); - virtual void StdMultiWidgetNotAvailable(); - - /*! - \brief method for creating the connections of main and control widget - */ - virtual void CreateConnections(); - - virtual void AddToFunctionalityOptionsList(mitk::PropertyList* p); - - /*! - \brief method for creating an QAction object, i.e. button & menu entry @param parent the parent QWidget - */ - //Port virtual QAction * CreateAction(QActionGroup *parent); - - /*! - \brief method is called when the bundle is started - */ - virtual void Activated(); - - /*! - \brief method is called when the bundle is closed - */ - virtual void Deactivated(); - -#ifdef BUILD_TESTING - /** - * \brief This method performs an automated functionality test. - */ - virtual int TestYourself(); -#endif - -protected slots: - - /**Documentation - * \brief executes MITK-IGT-Tracking code - * - * This method will create and initialize a mitk::NDITrackingDevice with one tool. - * It will start the tracking, read the tracking data from the tool 50 times and - * then clean up everything. - */ - void OnTestTracking(); - - /**Documentation - * \brief executes MITK-IGT-Navigation code - * - * This method will create and initialize a mitk::NDITrackingDevice with one tool. - * Then it builds an example MITK-IGT filter pipeline: - * - TrackingDeviceSource filter initialized with the NDITrackingDevice as source of the pipeline - * - NavigationDataDisplacementFilter - * The Offset parameter of the displacement filter is searched in the functionality's options list. - * It can be written to that list either by the method OnParametersChanged() that gets called after - * the user changes the parameter in the GUI or by the persistence mechanism of MITK (the complete - * options list will be saved to disk on application exit and restored on the next application restart). - * if the Offset parameter is not found in the list, a default value is used. - * After building the filter pipeline, it is initialized and tracking is started, so that following - * calls to OnMeasure() can trigger pipeline updates and retrieve NavigationData objects. - */ - void OnTestNavigation(); - - /**Documentation - * \brief performs one measurement using the navigation pipeline - * - * This method uses the MITK-IGT pipeline that was set up by OnTestNavigation() before. - * it iterates over all outputs of the last filter in the pipeline, updates each and writes - * its transformed tracking data to the GUI. - */ - void OnMeasure(); - - /**Documentation - * \brief performs continuous measurements using the navigation pipeline - * - * This method calls the above OnMeasure() - */ - void OnMeasureContinuously(); - - /** - * \brief stops the navigation pipeline and perform clean up - */ - void OnStop(); - - /**Documentation - * \brief reads the filter parameters from the GUI after they were changed - * - * The Control widget will store all parameters of the displacement filter - * in a mitk::PropertyList. OnParametersChanged() gets called after the user - * changed the parameters. It will add that list to the functionality's own - * m_Options PropertyList, overwriting any properties that might exist with - * the same name (all MITK-IGT filters should use unique property names). - * OnTestNavigation() will use the functionality's m_Options list to initialize - * the DisplacementFilter. - */ - void OnParametersChanged(); - - /**Documentation - * \brief Starts recording of tracking data - * - * This method sets up a IGT pipeline that connects a tracking device - * with a NavigationDataRecorder filter and then starts a timer that - * updates the recorder periodically if parameter toggled is TRUE. If it is FALSE the recorder will be stopped. - */ - void OnRecordingToggle(bool toggled); - - /**Documentation - * \brief Stops the recording of tracking data and starts the replay - * - * This method sets up a new pipeline that connects a NavigationDataPlayer with a - * NavigationDataToPointSetFilter as an example for an alternative visualization - * method and then starts a Replay timer that updates the recorder periodically if parameter toggled is TRUE. If it is FALSE the Replay timer will be stopped. - */ - void OnPlayingToggle(bool toggled); - - /**Documentation - * \brief Timer update method for recording of tracking data - * - * updates the recording filter and displays a message in the status bar - */ - void OnRecording(); - - /**Documentation - * \brief Timer update method for replaying of tracking data - * - * updates the replay filter, rerenders the 3D render window and - * displays a message in the status bar - */ - void OnPlaying(); - - /**Documentation - * \brief Display a graph and progress bar that shows error values from the first navigation data - * - * This method is an example of how to use NavigationDataToMessageFilter to update - * GUI elements from a IGT pipeline. It creates a NavigationDataToMessageFilter, - * sets its input to the first output of the displacement filter - * and registers the OnErrorValueChanged() method as a callback whenever the - * error value of the input navigation data changes. - */ - void OnShowErrorPlot(); - - /**Documentation - * \brief Callback method of the NavigationDataToMessageFilter - * - * This method will be called by NavigationDataToMessageFilter when the - * error value of its input navigation data object changes. - * The method calculates an overall error value and adds it both to an - * error plot widget and to a progress bar. If the error is above a hardcoded - * threshold, a warning is also displayed in the text output widget - */ - void OnErrorValueChanged(mitk::NavigationData::CovarianceMatrixType v, unsigned int index); - - /**Documentation - * \brief Shows a file dialog for choosing tool description files - * - * This method is called when the m_ToolBtn is pressed and a tracking - * device was selected which needs tool description data. - * - */ - void OnLoadTool(); - - /**Documentation - * \brief Chooses the current tracking device - * - * This method is called when the m_TrackingDevice selector changed. - */ - void OnTrackingDeviceTextChanged( const QString & ); - -protected: - - mitk::TrackingDevice::Pointer ConfigureTrackingDevice(); ///< create the selected tracker object and configure it (using values from m_Controls) - - QmitkStdMultiWidget * m_MultiWidget; ///< default render widget - Ui::QmitkIGTExampleControls * m_Controls; ///< GUI widget for this functionality - - mitk::TrackingDeviceSource::Pointer m_Source; ///< first filter in the pipeline - mitk::NavigationDataDisplacementFilter::Pointer m_Displacer; ///< displacement filter that adds an offset to NDs - mitk::NavigationDataToNavigationDataFilter::Pointer m_EndOfPipeline; // Pointer to last filter in the pipeline - mitk::NavigationDataRecorder::Pointer m_Recorder; ///< records NDs to a XML file - mitk::NavigationDataPlayer::Pointer m_Player; ///< plays a XML file - mitk::NavigationDataToPointSetFilter::Pointer m_PointSetFilter; ///< has a NDs as input and a PointSet as output - mitk::NavigationDataToMessageFilter::Pointer m_MessageFilter; ///< calls OnErrorValueChanged when the error value of its input changes - mitk::PointSet::Pointer m_PointSet; ///< stores the output of the pointsetfilter - - QmitkPlotWidget::DataVector m_XValues; ///< X-Values of the error plot (timestamp of navigation data) - QmitkPlotWidget::DataVector m_YValues; ///< Y-Values of the error plot (error value of navigation data - QTextEdit* out; ///< pointer to output widget - - QTimer* m_Timer; ///< timer for continuous tracking update - QTimer* m_RecordingTimer; ///< timer for continuous recording - QTimer* m_PlayingTimer; ///< timer for continuous playing - - QStringList m_ToolList; ///< list to the tool description files - -}; -#endif // !defined(QmitkIGTExampleView_H__INCLUDED) diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleViewControls.ui b/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleViewControls.ui deleted file mode 100644 index 3c40b04342..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleViewControls.ui +++ /dev/null @@ -1,278 +0,0 @@ - - - QmitkIGTExampleControls - - - - 0 - 0 - 510 - 706 - - - - - 0 - 0 - - - - QmitkIGTExample - - - - - - Select Tracking Device - - - - - - - NDI Polaris - - - - - NDI Aurora - - - - - Micron Tracker - - - - - MicroBird - - - - - VirtualTrackingDevice - - - - - - - - - - Load Tool(s) - - - - - - - - - - false - - - - - - - - - - - Port (e.g. COM4, /dev/ttyUSB0): - - - false - - - - - - - - 80 - 0 - - - - - - - - - - - - - Start MITK-IGT-Tracking Test - - - - - - - Start MITK-IGT-Navigation Test - - - - - - - - - - false - - - - 0 - 0 - - - - - 80 - 60 - - - - - - - - - - Show Error Plot - - - - - - - 0 - - - false - - - - - - - - - false - - - Measure! - - - - - - - false - - - Start measure continuously - - - - - - - false - - - End MITK-IGT-Navigation Test - - - - - - - - - Offset(x,y,z) - - - false - - - - - - - 0.0 - - - - - - - 0.0 - - - - - - - 0.0 - - - - - - - Change Offset - - - - - - - - - Show trajectories - - - - - - - Start Recording Test - - - true - - - - - - - Start Replaying - - - true - - - - - - - - - QmitkPlotWidget - QWidget -
QmitkPlotWidget.h
-
-
- - mitkPropertyList.h - QmitkPlotWidget.h - - - -
diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTRecorderView.cpp b/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTRecorderView.cpp deleted file mode 100644 index 465a13e3f8..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTRecorderView.cpp +++ /dev/null @@ -1,369 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date: 2009-05-06 16:03:09 +0200 (Mi, 06 Mai 2009) $ -Version: $Revision: 17113 $ - -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 "QmitkIGTRecorderView.h" - -//#include "resources/icon.xpm" - -#include "QmitkStdMultiWidget.h" - -#include "mitkCone.h" -#include "mitkInternalTrackingTool.h" -#include "mitkNDIPassiveTool.h" -#include "mitkNDITrackingDevice.h" -#include "mitkTrackingVolumeGenerator.h" - -#include "mitkProperties.h" - -#include "QmitkNDIConfigurationWidget.h" - -#include "mitkNodePredicateProperty.h" -#include "mitkNodePredicateDataType.h" -#include "mitkNodePredicateAnd.h" -#include "mitkNodePredicateNot.h" -#include "mitkGroupTagProperty.h" - -#include - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "mitkStatusBar.h" - - -QmitkIGTRecorderView::QmitkIGTRecorderView(QObject * /*parent*/, const char * /*name*/) - : QmitkFunctionality() -{ - m_Timer = new QTimer(this); - m_RecordingTimer = new QTimer(this); - m_PlayingTimer = new QTimer(this); - //m_XValues.clear(); - //m_YValues.clear(); - m_Controls = NULL; -} - - -QmitkIGTRecorderView::~QmitkIGTRecorderView() -{ - this->OnStopRecording(); // cleanup IGT pipeline, if tracking is in progress - m_RecordingTimer->stop(); - m_PlayingTimer->stop(); - m_Recorder = NULL; - //m_Player = NULL; - m_RecordingTimer = NULL; - m_PlayingTimer = NULL; -} - -void QmitkIGTRecorderView::CreateQtPartControl(QWidget *parent) -{ - if (!m_Controls) - { - m_Controls = new Ui::QmitkIGTRecorderControls; - m_Controls->setupUi(parent); - m_ConfigWidget = new QmitkNDIConfigurationWidget(parent); - mitk::NodePredicateAnd::Pointer pred = mitk::NodePredicateAnd::New( - mitk::NodePredicateNot::New(mitk::NodePredicateProperty::New("already Assigned")), - mitk::NodePredicateDataType::New("Surface")); // does not have assigned tag and is surface - m_ConfigWidget->SetDataStorage(this->GetDefaultDataStorage()); - m_ConfigWidget->SetPredicate(pred.GetPointer()); - m_ConfigWidget->SetTagPropertyName("already Assigned"); - m_ConfigWidget->SetTagProperty(mitk::GroupTagProperty::New().GetPointer()); // - m_ConfigWidget->SetToolTypes(QStringList() << "Instrument"); - m_Controls->m_DeviceConfigGroup->layout()->addWidget(m_ConfigWidget); // add ndi config widget - - - this->CreateConnections(); - } -} - - -void QmitkIGTRecorderView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget) -{ - m_MultiWidget = &stdMultiWidget; -} - - -void QmitkIGTRecorderView::StdMultiWidgetNotAvailable() -{ - m_MultiWidget = NULL; -} - - -void QmitkIGTRecorderView::CreateConnections() -{ - if ( m_Controls ) - { - connect((QObject*)(m_Controls->m_StartRecording), SIGNAL(clicked()), (QObject*) this, SLOT(OnStartRecording())); - connect((QObject*)(m_Controls->m_PauseRecording), SIGNAL(toggled (bool)), (QObject*) this, SLOT(OnPauseRecording(bool))); - connect((QObject*)(m_Controls->m_StopRecording), SIGNAL(clicked()), (QObject*) this, SLOT(OnStopRecording())); - connect((QObject*)(m_Controls->m_StartReplay), SIGNAL(clicked()), (QObject*) this, SLOT(OnStartReplaying())); - connect((QObject*)(m_Controls->m_StopReplay), SIGNAL(clicked()), (QObject*) this, SLOT(OnStopReplaying())); - connect((QObject*)(m_RecordingTimer), SIGNAL(timeout()), (QObject*) this, SLOT(RecordFrame())); - connect((QObject*)(m_ConfigWidget), SIGNAL(Connected()), this, SLOT(OnConnect())); - connect((QObject*)(m_ConfigWidget), SIGNAL(Disconnected()), this, SLOT(OnDisconnect())); - } -} - - -void QmitkIGTRecorderView::OnStartRecording() -{ - if (m_Source.IsNotNull()) - if (m_Source->IsTracking()) - return; - - if ((m_ConfigWidget == NULL)) - return; - mitk::TrackingDevice::Pointer tracker = m_ConfigWidget->GetTracker(); - - QString fileName = QFileDialog::getSaveFileName(NULL, tr("Save tracking data to"),"D:/home/jochen/Versuche/2010.01.25 EM Messungen in der Speiseröhre" /*QDir::homePath()*/, tr("MITK Navigation Data XML logfile(*.xml)")); - if (fileName.isEmpty()) - return; -// recorder! - - if (this->GetDefaultDataStorage()->GetNamedNode("Tracking Volume") == NULL) // add tracking volume node - { - mitk::TrackingVolumeGenerator::Pointer tvGenerator = mitk::TrackingVolumeGenerator::New(); - tvGenerator->SetTrackingDeviceType(tracker->GetType()); - tvGenerator->Update(); - mitk::Surface::Pointer tv = tvGenerator->GetOutput(); - - mitk::DataNode::Pointer n = mitk::DataNode::New(); - n->SetData(tv); - n->SetName("Tracking Volume"); - n->SetOpacity(0.1); - n->SetColor(0.4, 0.4, 1.0); - this->GetDefaultDataStorage()->Add(n); - this->GetActiveStdMultiWidget()->SetWidgetPlanesVisibility(false); - mitk::RenderingManager::GetInstance()->InitializeViews(this->GetDefaultDataStorage()->ComputeBoundingGeometry3D(this->GetDefaultDataStorage()->GetAll())); // reset render window geometry to include all objects - } - try - { - this->SetupIGTPipeline(tracker, fileName); - //m_Source->Connect(); - m_Source->StartTracking(); - m_RecordingTimer->start(50); - } - catch (std::exception& e) - { - mitk::StatusBar::GetInstance()->DisplayText(QString("Error during navigation pipeline setup: %1").arg(e.what()).toLatin1(), 4000); - m_RecordingTimer->stop(); - } -} - - -void QmitkIGTRecorderView::OnStopRecording() -{ - if (m_RecordingTimer != NULL) - m_RecordingTimer->stop(); - if (m_Recorder.IsNotNull()) - m_Recorder->StopRecording(); - if (m_Source.IsNotNull()) - { - m_Source->StopTracking(); - //m_Source->Disconnect(); - } - m_MessageFilter = NULL; - m_PointSetFilter = NULL; - m_Recorder = NULL; - m_Visualizer = NULL; - //m_Source = NULL; -} - - -void QmitkIGTRecorderView::OnPauseRecording( bool pause ) -{ - if (pause == true) - m_RecordingTimer->stop(); - else - m_RecordingTimer->start(50); -} - - -void QmitkIGTRecorderView::RecordFrame() -{ - - try - { - bool updated = false; - if ((m_Controls->m_UpdateTrajectory->checkState() == Qt::Checked) && (m_PointSetFilter.IsNotNull())) - m_PointSetFilter->Update(); // update pipeline - else - updated |= false; - if ((m_Controls->m_UpdateRecorder->checkState() == Qt::Checked) && (m_Recorder.IsNotNull())) - m_Recorder->Update(); // record data to file - else - updated |= false; - if ((updated == false) && (m_Recorder.IsNotNull())) - m_Visualizer->Update(); - - mitk::RenderingManager::GetInstance()->RequestUpdate(this->GetActiveStdMultiWidget()->GetRenderWindow4()->GetRenderWindow()); // render 3D scene - } - catch (...) - { - mitk::StatusBar::GetInstance()->DisplayText("Error during navigation pipeline update", 1000); - } -} - - -void QmitkIGTRecorderView::OnStartReplaying() -{ - -} - - -void QmitkIGTRecorderView::OnStopReplaying() -{ - -} - - -void QmitkIGTRecorderView::SetupIGTPipeline(mitk::TrackingDevice::Pointer tracker, QString fileName) -{ - mitk::DataStorage* ds = this->GetDefaultDataStorage(); - if (ds == NULL) - throw std::invalid_argument("DataStorage not available"); - if (tracker.IsNull()) - throw std::invalid_argument("invalid tracking device provided."); - - - if (m_ConfigWidget->GetToolsByToolType("Instrument").isEmpty()) - throw std::invalid_argument("insufficient tool assignments for instrument"); - - /* build pipeline filters */ - if (m_Source.IsNull()) - { - m_Source = mitk::TrackingDeviceSource::New(); - m_Source->SetTrackingDevice(tracker); - } - m_Visualizer = mitk::NavigationDataObjectVisualizationFilter::New(); - m_MessageFilter = mitk::NavigationDataToMessageFilter::New(); - m_PointSetFilter = mitk::NavigationDataToPointSetFilter::New(); - m_PointSetFilter->SetOperationMode(mitk::NavigationDataToPointSetFilter::Mode3D); - m_Recorder = mitk::NavigationDataRecorder::New(); - m_Recorder->SetFileName(fileName.toLatin1()); - - /* connect inputs and outputs of filters */ - for (unsigned int i = 0; i < m_Source->GetNumberOfOutputs(); ++i) // source --> visualizer --> messager --> pointset - { - /* visualization filter */ - m_Visualizer->SetInput(i, m_Source->GetOutput(i)); - /* message filter */ - m_MessageFilter->SetInput(i, m_Visualizer->GetOutput(i)); - /* landmark transform filter */ - m_PointSetFilter->SetInput(i, m_MessageFilter->GetOutput(i)); - m_Recorder->AddNavigationData(m_MessageFilter->GetOutput(i)); - } - m_Recorder->StartRecording(); - /* set filter parameters */ - /* instrument visualization */ - const QList instruments = m_ConfigWidget->GetToolsByToolType("Instrument"); - foreach (const unsigned int& index, instruments) - { - mitk::DataNode::Pointer node = this->CreateInstrumentVisualization(m_Source->GetOutput(index)->GetName()); - ds->Add(node); - m_Visualizer->SetRepresentationObject(index, node->GetData()); - } - for (unsigned int i = 0; i < m_PointSetFilter->GetNumberOfOutputs(); i++) - { - - mitk::PointSet* p = m_PointSetFilter->GetOutput(i); - assert(p); - - mitk::DataNode::Pointer pointSetNode = mitk::DataNode::New(); - pointSetNode->SetData(p); - pointSetNode->SetName(QString("Trajectory of Tool #%1 (%2)").arg(i).arg(QTime::currentTime().toString()).toLatin1()); - mitk::Color color; - color.Set(0.2, 0.3 * i ,0.9 - 0.2 * i); - pointSetNode->SetColor(color); //change color of points - pointSetNode->SetProperty("contourcolor", mitk::ColorProperty::New(color)); // change color of trajectory line - pointSetNode->SetProperty("pointsize", mitk::FloatProperty::New(1.0)); // enlarge visualization of points - pointSetNode->SetProperty("contoursize", mitk::FloatProperty::New(0.5)); // enlarge visualization of trajectory line - pointSetNode->SetBoolProperty("show contour", true); - pointSetNode->SetBoolProperty("updateDataOnRender", false); // do not call Update() on the pointset during render (this would cause a execution of the pipeline that is still connected to the pointset) - this->GetDefaultDataStorage()->Add(pointSetNode); //add it to the DataStorage - } -} - -mitk::DataNode::Pointer QmitkIGTRecorderView::CreateInstrumentVisualization(const char* label) -{ - vtkAxes* axes = vtkAxes::New(); - axes->SymmetricOn(); - axes->SetScaleFactor(10.0); - vtkTubeFilter* tuber = vtkTubeFilter::New(); - tuber->SetRadius(0.02); - tuber->SetNumberOfSides(6); - tuber->SetInputConnection(axes->GetOutputPort()); - vtkTextSource* tss = vtkTextSource::New(); - tss->SetText(label); - tss->BackingOff(); - vtkConeSource* cone = vtkConeSource::New(); - cone->SetDirection(0.0, 0.0, -1.0); // direction: along z-axis, facing towards -z direction - cone->SetCenter(0.0, 0.0, 100.0); - cone->SetHeight(200.0); // center at 100, height 200 should set the tip of the cone to the origin - cone->SetRadius(10.0); - vtkAppendPolyData* ap = vtkAppendPolyData::New(); - //ap->AddInput(tss->GetOutput()); - ap->AddInput(tuber->GetOutput()); - //ap->AddInput(cone->GetOutput()); - ap->GetOutput()->Update(); - mitk::Surface::Pointer dummy = mitk::Surface::New(); - dummy->SetVtkPolyData(ap->GetOutput()); - ap->Delete(); - cone->Delete(); - tss->Delete(); - tuber->Delete(); - axes->Delete(); - - mitk::DataNode::Pointer node = mitk::DataNode::New(); - node->SetData(dummy); - node->SetName(label); - node->SetColor(0.2, 0.9, 0.2); - //node->SetBoolProperty("helperObject", true); - return node; -} - - -void QmitkIGTRecorderView::OnConnect() -{ - m_Controls->m_StartRecording->setEnabled(true); - m_Controls->m_StopRecording->setEnabled(true); - m_Controls->m_PauseRecording->setEnabled(true); - //m_Controls->m_StartReplay->setEnabled(true); - //m_Controls->m_StopReplay->setEnabled(true); - -} - - -void QmitkIGTRecorderView::OnDisconnect() -{ - this->OnStopRecording(); - m_Controls->m_StartRecording->setEnabled(false); - m_Controls->m_StopRecording->setEnabled(false); - m_Controls->m_PauseRecording->setEnabled(false); -} diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTRecorderView.h b/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTRecorderView.h deleted file mode 100644 index 983b80d224..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTRecorderView.h +++ /dev/null @@ -1,108 +0,0 @@ -/*========================================================================= - -Program: Medical Imaging & Interaction Toolkit -Language: C++ -Date: $Date: 2009-05-06 10:44:43 +0200 (Mi, 06 Mai 2009) $ -Version: $Revision: 17109 $ - -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(QmitkIGTRecorderView_H__INCLUDED) -#define QmitkIGTRecorderView_H__INCLUDED - -#include "QmitkFunctionality.h" - -#include "mitkTrackingDeviceSource.h" -#include "mitkTrackingDevice.h" -#include "mitkNavigationDataRecorder.h" -#include "mitkNavigationDataPlayer.h" -#include "mitkNavigationDataToPointSetFilter.h" -#include "mitkNavigationDataToMessageFilter.h" -#include "mitkNavigationDataObjectVisualizationFilter.h" - -#include "ui_QmitkIGTRecorderViewControls.h" -#include "../IgtexampleDll.h" - -class QmitkStdMultiWidget; -class QmitkIGTRecorderViewControls; -class QTextEdit; -class QmitkNDIConfigurationWidget; -/*! -\brief QmitkIGTRecorderView - -Example functionality that shows the usage of the MITK-IGT component - -\sa QmitkFunctionality -\ingroup Functionalities -*/ -class QmitkIGTRecorderView : public QmitkFunctionality -{ - Q_OBJECT - - public: - /*! - \brief default constructor - */ - QmitkIGTRecorderView(QObject *parent=0, const char *name=0); - - /*! - \brief default destructor - */ - virtual ~QmitkIGTRecorderView(); - - /*! - \brief method for creating the widget containing the application controls, like sliders, buttons etc. - */ - virtual void CreateQtPartControl(QWidget *parent); - - virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget); - virtual void StdMultiWidgetNotAvailable(); - - /*! - \brief method for creating the connections of main and control widget - */ - virtual void CreateConnections(); - -protected slots: - - void OnStartRecording(); - void OnStopRecording(); - void OnPauseRecording(bool pause); - void OnStartReplaying(); - void OnStopReplaying(); - void RecordFrame(); - void OnConnect(); - void OnDisconnect(); - -protected: - - mitk::TrackingDevice::Pointer ConfigureTrackingDevice(); ///< create the selected tracker object and configure it (using values from m_Controls) - void SetupIGTPipeline(mitk::TrackingDevice::Pointer tracker, QString fileName); - mitk::DataNode::Pointer CreateInstrumentVisualization(const char* label); - - QmitkStdMultiWidget * m_MultiWidget; ///< default render widget - Ui::QmitkIGTRecorderControls * m_Controls; ///< GUI widget for this functionality - - mitk::TrackingDeviceSource::Pointer m_Source; ///< first filter in the pipeline - mitk::NavigationDataObjectVisualizationFilter::Pointer m_Visualizer; - mitk::NavigationDataRecorder::Pointer m_Recorder; ///< records NDs to a XML file - mitk::NavigationDataToPointSetFilter::Pointer m_PointSetFilter; ///< has a NDs as input and a PointSet as output - mitk::NavigationDataToMessageFilter::Pointer m_MessageFilter; ///< calls OnErrorValueChanged when the error value of its input changes - - //mitk::NavigationDataPlayer::Pointer m_Player; ///< plays a XML file - - QTimer* m_Timer; ///< timer for continuous tracking update - QTimer* m_RecordingTimer; ///< timer for continuous recording - QTimer* m_PlayingTimer; ///< timer for continuous playing - QStringList m_ToolList; ///< list to the tool description files - QmitkNDIConfigurationWidget* m_ConfigWidget; -}; -#endif // !defined(QmitkIGTRecorderView_H__INCLUDED) diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTRecorderViewControls.ui b/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTRecorderViewControls.ui deleted file mode 100644 index f3abc3331d..0000000000 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTRecorderViewControls.ui +++ /dev/null @@ -1,135 +0,0 @@ - - - QmitkIGTRecorderControls - - - - 0 - 0 - 389 - 339 - - - - - 0 - 0 - - - - QmitkIGTExample - - - - - - - 0 - 0 - - - - Select Tracking Device - - - - - - - - Update Trajectory - - - true - - - - - - - Update Recorder - - - true - - - - - - - false - - - Start Recording - - - - - - - false - - - Pause Recording - - - true - - - false - - - - - - - false - - - Stop Recording - - - - - - - false - - - Replay recorded file - - - - - - - false - - - Stop Replaying - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - mitkPropertyList.h - QmitkPlotWidget.h - - - -