diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexamples/files.cmake b/Modules/Bundles/org.mitk.gui.qt.igtexamples/files.cmake index de84e80614..c164ff8c4c 100644 --- a/Modules/Bundles/org.mitk.gui.qt.igtexamples/files.cmake +++ b/Modules/Bundles/org.mitk.gui.qt.igtexamples/files.cmake @@ -1,45 +1,45 @@ SET(SRC_CPP_FILES ) SET(INTERNAL_CPP_FILES QmitkIGTTrackingLabView.cpp - QmitkImageGuidedTherapyTutorialView.cpp + QmitkIGTTutorialView.cpp mitkPluginActivator.cpp ) SET(UI_FILES src/internal/QmitkIGTTrackingLabViewControls.ui - src/internal/QmitkImageGuidedTherapyTutorialViewControls.ui + src/internal/QmitkIGTTutorialViewControls.ui ) SET(MOC_H_FILES src/internal/QmitkIGTTrackingLabView.h - src/internal/QmitkImageGuidedTherapyTutorialView.h + src/internal/QmitkIGTTutorialView.h src/internal/mitkPluginActivator.h ) SET(QRC_FILES resources/QmitkIGTTrackingLabView.qrc - #resources/QmitkImageGuidedTherapyTutorialView.qrc + #resources/QmitkIGTTutorialView.qrc ) SET(CACHED_RESOURCE_FILES resources/IgtTrackingLab.png resources/start_rec.png resources/stop_rec.png - resources/ImageGuidedTherapyTutorial.png + resources/IGTTutorial.png plugin.xml ) SET(CPP_FILES ) 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.igtexamples/plugin.xml b/Modules/Bundles/org.mitk.gui.qt.igtexamples/plugin.xml index b7115155a1..e6885d30a7 100644 --- a/Modules/Bundles/org.mitk.gui.qt.igtexamples/plugin.xml +++ b/Modules/Bundles/org.mitk.gui.qt.igtexamples/plugin.xml @@ -1,18 +1,18 @@ + name="IGT Tutorial" + class="QmitkIGTTutorialView" + icon="resources/IGTTutorial.png"/> \ No newline at end of file diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexamples/resources/ImageGuidedTherapyTutorial.png b/Modules/Bundles/org.mitk.gui.qt.igtexamples/resources/IGTTutorial.png similarity index 100% rename from Modules/Bundles/org.mitk.gui.qt.igtexamples/resources/ImageGuidedTherapyTutorial.png rename to Modules/Bundles/org.mitk.gui.qt.igtexamples/resources/IGTTutorial.png diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexamples/resources/QmitkImageGuidedTherapyTutorialView.qrc b/Modules/Bundles/org.mitk.gui.qt.igtexamples/resources/QmitkIGTTutorialView.qrc similarity index 100% rename from Modules/Bundles/org.mitk.gui.qt.igtexamples/resources/QmitkImageGuidedTherapyTutorialView.qrc rename to Modules/Bundles/org.mitk.gui.qt.igtexamples/resources/QmitkIGTTutorialView.qrc diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkImageGuidedTherapyTutorialView.cpp b/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkIGTTutorialView.cpp similarity index 90% rename from Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkImageGuidedTherapyTutorialView.cpp rename to Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkIGTTutorialView.cpp index 70cba7d514..76bb3189a1 100644 --- a/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkImageGuidedTherapyTutorialView.cpp +++ b/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkIGTTutorialView.cpp @@ -1,241 +1,241 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-03-21 19:27:37 +0100 (Sa, 21 Mrz 2009) $ Version: $Revision: 16719 $ 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 "QmitkImageGuidedTherapyTutorialView.h" +#include "QmitkIGTTutorialView.h" #include "QmitkStdMultiWidget.h" #include "QmitkStdMultiWidgetEditor.h" #include "mitkNDIPassiveTool.h" #include "mitkNDITrackingDevice.h" #include "mitkVirtualTrackingDevice.h" #include "mitkStandardFileLocations.h" #include "mitkSerialCommunication.h" #include "mitkCone.h" #include #include -const std::string QmitkImageGuidedTherapyTutorialView::VIEW_ID = "org.mitk.views.imageguidedtherapytutorial"; +const std::string QmitkIGTTutorialView::VIEW_ID = "org.mitk.views.igttutorial"; -QmitkImageGuidedTherapyTutorialView::QmitkImageGuidedTherapyTutorialView() +QmitkIGTTutorialView::QmitkIGTTutorialView() : QmitkFunctionality(), m_Controls(NULL), m_MultiWidget(NULL), m_Source(NULL), m_Visualizer(NULL), m_Timer(NULL) { } -QmitkImageGuidedTherapyTutorialView::~QmitkImageGuidedTherapyTutorialView() +QmitkIGTTutorialView::~QmitkIGTTutorialView() { } -void QmitkImageGuidedTherapyTutorialView::CreateQtPartControl(QWidget *parent) +void QmitkIGTTutorialView::CreateQtPartControl(QWidget *parent) { if (!m_Controls) { // create GUI widget - m_Controls = new Ui::QmitkImageGuidedTherapyTutorialViewControls; + m_Controls = new Ui::QmitkIGTTutorialViewControls; m_Controls->setupUi(parent); this->CreateConnections(); } } -void QmitkImageGuidedTherapyTutorialView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget) +void QmitkIGTTutorialView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget) { m_MultiWidget = &stdMultiWidget; } -void QmitkImageGuidedTherapyTutorialView::StdMultiWidgetNotAvailable() +void QmitkIGTTutorialView::StdMultiWidgetNotAvailable() { m_MultiWidget = NULL; } -void QmitkImageGuidedTherapyTutorialView::CreateConnections() +void QmitkIGTTutorialView::CreateConnections() { if ( m_Controls ) { connect( (QObject*)(m_Controls->m_StartButton), SIGNAL(clicked()),(QObject*) this, SLOT(OnStartIGT())); connect( (QObject*)(m_Controls->m_StopButton), SIGNAL(clicked()),(QObject*) this, SLOT(OnStopIGT())); } } -void QmitkImageGuidedTherapyTutorialView::Activated() +void QmitkIGTTutorialView::Activated() { QmitkFunctionality::Activated(); } -void QmitkImageGuidedTherapyTutorialView::Deactivated() +void QmitkIGTTutorialView::Deactivated() { QmitkFunctionality::Deactivated(); } -void QmitkImageGuidedTherapyTutorialView::OnStartIGT() +void QmitkIGTTutorialView::OnStartIGT() { - //This method is called when when the Do IGT button is pressed. Any kind of navigation application will + //This method is called when the Do IGT button is pressed. Any kind of navigation application will //start with the connection to a tracking system and as we do image guided procedures we want to show //something on the screen. In this tutorial we connect to the NDI Polaris tracking system and we will //show the movement of a tool as cone in MITK. //Check if we have a widget for visualization. Makes no sense to start otherwise. //If there is no multiwidget, create one. //if (m_MultiWidget == NULL) //{ //} if (m_MultiWidget == NULL) // if creating the multiwidget failed, stop here. { QMessageBox::warning ( NULL, "Error", "Starting the tutorial is not possible without an initialized " "rendering widget. Please load a dataset first."); return; } try { /**************** Variant 1: Use a NDI Polaris Tracking Device ****************/ ////Here we want to use the NDI Polaris tracking device. Therefore we instantiate a object of the class ////NDITrackingDevice and make some settings which are necessary for a proper connection to the device. //mitk::NDITrackingDevice::Pointer tracker = mitk::NDITrackingDevice::New(); //instantiate //tracker->SetPortNumber(mitk::SerialCommunication::COM4); //set the comport //tracker->SetBaudRate(mitk::SerialCommunication::BaudRate115200); //set the baud rate //tracker->SetType(mitk::NDIPolaris); //set the type there you can choose between Polaris and Aurora ////The tools represent the sensors of the tracking device. In this case we have one pointer tool. ////The TrackingDevice object it self fills the tool with data. So we have to add the tool to the ////TrackingDevice object. //mitk::NDIPassiveTool::Pointer tool = mitk::NDIPassiveTool::New(); //tool->SetToolName("MyInstrument"); //Every tool should have a name. //tool->LoadSROMFile("c:\\myinstrument.rom"); //The Polaris system needs a ".rom" file which describes ////the geometry of the markers related to the tool tip. ////NDI provides an own software (NDI architect) to ////generate those files. ////tool->LoadSROMFile(mitk::StandardFileLocations::GetInstance()->FindFile("myToolDefinitionFile.srom").c_str()); //tracker->Add6DTool(tool); //Add the tool to the TrackingDevice object. /**************** End of Variant 1 ****************/ /**************** Variant 2: Emulate a Tracking Device with mitk::VirtualTrackingDevice ****************/ // For tests, it is useful to simulate a tracking device in software. This is what mitk::VirtualTrackingDevice does. // It will produce random position, orientation and error values for each tool that is added. mitk::VirtualTrackingDevice::Pointer tracker = mitk::VirtualTrackingDevice::New(); // create virtual tracker mitk::ScalarType bounds[] = {0.0, 200.0, 0.0, 200.0, 0.0, 200.0}; tracker->SetBounds(bounds); tracker->AddTool("MyInstrument"); // add a tool to tracker /**************** End of Variant 2 ****************/ //The tracking device object is used for the physical connection to the device. To use the //data inside of our tracking pipeline we need a source. This source encapsulate the tracking device //and provides objects of the type mitk::NavigationData as output. The NavigationData objects stores //position, orientation, if the data is valid or not and special error informations in a covariance //matrix. // //Typically the start of a pipeline is a TrackingDeviceSource. To work correct we have to set a //TrackingDevice object. Attention you have to set the tools before you set the whole TrackingDevice //object to the TrackingDeviceSource because the source need to know how many outputs should be //generated. m_Source = mitk::TrackingDeviceSource::New(); //We need the filter objects to stay alive, //therefore they must be members. m_Source->SetTrackingDevice(tracker); //Here we set the tracking device to the source of the pipeline. m_Source->Connect(); //Now we connect to the tracking system. //Note we do not call this on the TrackingDevice object //As we wish to visualize our tool we need to have a PolyData which shows us the movement of our tool. //Here we take a cone shaped PolyData. In MITK you have to add the PolyData as a node into the DataStorage //to show it inside of the rendering windows. After that you can change the properties of the cone //to manipulate rendering, e.g. the position and orientation as in our case. mitk::Cone::Pointer cone = mitk::Cone::New(); //instantiate a new cone float scale[] = {10.0, 10.0, 10.0}; cone->GetGeometry()->SetSpacing(scale); //scale it a little that so we can see something mitk::DataNode::Pointer node = mitk::DataNode::New(); //generate a new node to store the cone into //the DataStorage. node->SetData(cone); //The data of that node is our cone. node->SetName("My tracked object"); //The node has additional properties like a name node->SetColor(1.0, 0.0, 0.0); //or the color. Here we make it red. this->GetDefaultDataStorage()->Add(node); //After adding the Node with the cone in it to the //DataStorage, MITK will show the cone in the //render windows. //For updating the render windows we use another filter of the MITK-IGT pipeline concept. The //NavigationDataObjectVisualizationFilter needs as input a NavigationData and a //PolyData. In our case the input is the source and the PolyData our cone. //First we create a new filter for the visualization update. m_Visualizer = mitk::NavigationDataObjectVisualizationFilter::New(); m_Visualizer->SetInput(0, m_Source->GetOutput(0)); //Then we connect to the pipeline. m_Visualizer->SetRepresentationObject(0, cone); //After that we have to assign the cone to the input //Now this simple pipeline is ready, so we can start the tracking. Here again: We do not call the //StartTracking method from the tracker object itself. Instead we call this method from our source. m_Source->StartTracking(); //Now every call of m_Visualizer->Update() will show us the cone at the position and orientation //given from the tracking device. //We use a QTimer object to call this Update() method in a fixed interval. if (m_Timer == NULL) { m_Timer = new QTimer(this); //create a new timer } connect(m_Timer, SIGNAL(timeout()), this, SLOT(OnTimer())); //connect the timer to the method OnTimer() m_Timer->start(100); //Every 100ms the method OnTimer() is called. -> 10fps //Now have look at the OnTimer() method. } catch (std::exception& e) { // add cleanup std::cout << "Error in QmitkIGTTutorial::OnDoIGT():" << e.what() << std::endl; } } -void QmitkImageGuidedTherapyTutorialView::OnTimer() +void QmitkIGTTutorialView::OnTimer() { //Here we call the Update() method from the Visualization Filter. Internally the filter checks if //new NavigationData is available. If we have a new NavigationData the cone position and orientation //will be adapted. m_Visualizer->Update(); mitk::RenderingManager::GetInstance()->RequestUpdateAll(); //update the render windows } -void QmitkImageGuidedTherapyTutorialView::OnStopIGT() +void QmitkIGTTutorialView::OnStopIGT() { //This method is called when the Stop button is pressed. Here we disconnect the pipeline. if (m_Timer == NULL) { std::cout << "No Timer was set yet!" << std::endl; return; } //To disconnect the pipeline in a save way we first stop the timer than we disconnect the tracking device. //After that we destroy all filters with changing them to NULL. m_Timer->stop(); disconnect(m_Timer, SIGNAL(timeout()), this, SLOT(OnTimer())); m_Timer = NULL; m_Source->StopTracking(); m_Source->Disconnect(); m_Source = NULL; m_Visualizer = NULL; m_Source = NULL; this->GetDefaultDataStorage()->Remove(this->GetDefaultDataStorage()->GetNamedNode("My tracked object")); } diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkImageGuidedTherapyTutorialView.h b/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkIGTTutorialView.h similarity index 83% rename from Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkImageGuidedTherapyTutorialView.h rename to Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkIGTTutorialView.h index edaf5a00c9..1f254e1c70 100644 --- a/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkImageGuidedTherapyTutorialView.h +++ b/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkIGTTutorialView.h @@ -1,106 +1,106 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-03-21 19:27:37 +0100 (Sa, 21 Mrz 2009) $ Version: $Revision: 16719 $ 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 _QMITKIMAGEGUIDEDTHERAPYTUTORIALVIEW_H_INCLUDED -#define _QMITKIMAGEGUIDEDTHERAPYTUTORIALVIEW_H_INCLUDED +#ifndef _QMITKIGTTUTORIALVIEW_H_INCLUDED +#define _QMITKIGTTUTORIALVIEW_H_INCLUDED #include #include -#include "ui_QmitkImageGuidedTherapyTutorialViewControls.h" +#include "ui_QmitkIGTTutorialViewControls.h" //#include "../IgttutorialDll.h" #include "mitkTrackingDeviceSource.h" #include "mitkNavigationDataObjectVisualizationFilter.h" /** * \brief QmitkIGTTutorial shows a small typically navigation MITK functionality. * * Any kind of navigation application will start with the connection to a tracking system * and as we do image guided procedures we want to show something on the screen. In this * tutorial we connect to the NDI Polaris tracking system (or alternatively use a virtual tracking device) * and we will show the movement of a tool as cone in the StdMultiWidget editor. * * \sa also take a look at the CMakeLists.txt of this functionality to see how to * link to the mitkIGT library. * \sa QmitkFunctionality * \ingroup Functionalities */ -class QmitkImageGuidedTherapyTutorialView : public QmitkFunctionality +class QmitkIGTTutorialView : public QmitkFunctionality { // this is needed for all Qt objects that should have a MOC object (everything that derives from QObject) Q_OBJECT public: static const std::string VIEW_ID; - QmitkImageGuidedTherapyTutorialView(); - QmitkImageGuidedTherapyTutorialView(const QmitkImageGuidedTherapyTutorialView& other) + QmitkIGTTutorialView(); + QmitkIGTTutorialView(const QmitkIGTTutorialView& other) { Q_UNUSED(other) throw std::runtime_error("Copy constructor not implemented"); } - virtual ~QmitkImageGuidedTherapyTutorialView(); + virtual ~QmitkIGTTutorialView(); virtual void CreateQtPartControl(QWidget *parent); /// \brief Creation of the connections of main and control widget virtual void CreateConnections(); /// \brief Called when the functionality is activated virtual void Activated(); virtual void Deactivated(); virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget); virtual void StdMultiWidgetNotAvailable(); protected slots: /** * \brief Execute MITK-IGT Tutorial */ void OnStartIGT(); /** * \brief stop IGT scene and clean up */ void OnStopIGT(); /** * \brief timer based update of IGT scene */ void OnTimer(); protected: - Ui::QmitkImageGuidedTherapyTutorialViewControls* m_Controls; + Ui::QmitkIGTTutorialViewControls* m_Controls; QmitkStdMultiWidget* m_MultiWidget; ///< our display widget mitk::TrackingDeviceSource::Pointer m_Source; ///< source filer that connects to the tracking device mitk::NavigationDataObjectVisualizationFilter::Pointer m_Visualizer; ///< visualization filter uses output from m_Source QTimer* m_Timer; ///< timer for continuous tracking update }; -#endif // _QMITKIMAGEGUIDEDTHERAPYTUTORIALVIEW_H_INCLUDED +#endif // _QMITKIGTTUTORIALVIEW_H_INCLUDED diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkImageGuidedTherapyTutorialViewControls.ui b/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkIGTTutorialViewControls.ui similarity index 91% rename from Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkImageGuidedTherapyTutorialViewControls.ui rename to Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkIGTTutorialViewControls.ui index fc137e81ba..e1b13c5f8a 100644 --- a/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkImageGuidedTherapyTutorialViewControls.ui +++ b/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/QmitkIGTTutorialViewControls.ui @@ -1,64 +1,64 @@ - QmitkImageGuidedTherapyTutorialViewControls - + QmitkIGTTutorialViewControls + 0 0 222 161 0 0 QmitkTemplate start dumb segmentation Start image guided therapy Stop image guided therapy Qt::Vertical QSizePolicy::Expanding 20 220 QmitkDataStorageComboBox.h diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/mitkPluginActivator.cpp b/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/mitkPluginActivator.cpp index 4e62d43ea9..d2d5f40688 100644 --- a/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/mitkPluginActivator.cpp +++ b/Modules/Bundles/org.mitk.gui.qt.igtexamples/src/internal/mitkPluginActivator.cpp @@ -1,22 +1,22 @@ #include "mitkPluginActivator.h" -#include "QmitkImageGuidedTherapyTutorialView.h" +#include "QmitkIGTTutorialView.h" #include "QmitkIGTTrackingLabView.h" #include namespace mitk { void PluginActivator::start(ctkPluginContext* context) { - BERRY_REGISTER_EXTENSION_CLASS(QmitkImageGuidedTherapyTutorialView, context) + BERRY_REGISTER_EXTENSION_CLASS(QmitkIGTTutorialView, context) BERRY_REGISTER_EXTENSION_CLASS(QmitkIGTTrackingLabView, context) } void PluginActivator::stop(ctkPluginContext* context) { Q_UNUSED(context) } } Q_EXPORT_PLUGIN2(org_mitk_gui_qt_igtexamples, mitk::PluginActivator)