diff --git a/Modules/Bundles/org.mitk.gui.qt.igtnavigationtoolmanager/src/internal/QmitkMITKIGTNavigationToolManagerView.cpp b/Modules/Bundles/org.mitk.gui.qt.igtnavigationtoolmanager/src/internal/QmitkMITKIGTNavigationToolManagerView.cpp index f2a2347712..19f64c8bd5 100644 --- a/Modules/Bundles/org.mitk.gui.qt.igtnavigationtoolmanager/src/internal/QmitkMITKIGTNavigationToolManagerView.cpp +++ b/Modules/Bundles/org.mitk.gui.qt.igtnavigationtoolmanager/src/internal/QmitkMITKIGTNavigationToolManagerView.cpp @@ -1,69 +1,71 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ 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. =========================================================================*/ // Blueberry #include #include // Qmitk #include "QmitkMITKIGTNavigationToolManagerView.h" #include "QmitkStdMultiWidget.h" // Qt #include const std::string QmitkMITKIGTNavigationToolManagerView::VIEW_ID = "org.mitk.views.mitkigtnavigationtoolmanager"; QmitkMITKIGTNavigationToolManagerView::QmitkMITKIGTNavigationToolManagerView() : QmitkFunctionality() , m_Controls( 0 ) , m_MultiWidget( NULL ) { } QmitkMITKIGTNavigationToolManagerView::~QmitkMITKIGTNavigationToolManagerView() { } void QmitkMITKIGTNavigationToolManagerView::CreateQtPartControl( QWidget *parent ) { // build up qt view, unless already done if ( !m_Controls ) { // create GUI widgets from the Qt Designer's .ui file m_Controls = new Ui::QmitkMITKIGTNavigationToolManagerViewControls; m_Controls->setupUi( parent ); } + m_Controls->m_toolManagerWidget->Initialize(this->GetDataStorage()); + } void QmitkMITKIGTNavigationToolManagerView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget) { m_MultiWidget = &stdMultiWidget; } void QmitkMITKIGTNavigationToolManagerView::StdMultiWidgetNotAvailable() { m_MultiWidget = NULL; } diff --git a/Modules/Bundles/org.mitk.gui.qt.igtnavigationtoolmanager/src/internal/QmitkMITKIGTNavigationToolManagerViewControls.ui b/Modules/Bundles/org.mitk.gui.qt.igtnavigationtoolmanager/src/internal/QmitkMITKIGTNavigationToolManagerViewControls.ui index a88609f3c4..d56ff625ec 100644 --- a/Modules/Bundles/org.mitk.gui.qt.igtnavigationtoolmanager/src/internal/QmitkMITKIGTNavigationToolManagerViewControls.ui +++ b/Modules/Bundles/org.mitk.gui.qt.igtnavigationtoolmanager/src/internal/QmitkMITKIGTNavigationToolManagerViewControls.ui @@ -1,55 +1,55 @@ QmitkMITKIGTNavigationToolManagerViewControls 0 0 - 222 - 161 + 596 + 445 0 0 QmitkTemplate - + Qt::Vertical QSizePolicy::Expanding 20 220 QmitkNavigationToolManagementWidget QWidget
QmitkNavigationToolManagementWidget.h
1
diff --git a/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/CMakeLists.txt b/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/CMakeLists.txt index fba82a3726..617e1dfcab 100644 --- a/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/CMakeLists.txt +++ b/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/CMakeLists.txt @@ -1,2 +1,2 @@ -MACRO_CREATE_MITK_PLUGIN(QmitkExt) +MACRO_CREATE_MITK_PLUGIN(QmitkExt MitkIGT MitkIGTUI) diff --git a/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.cpp b/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.cpp index 42b9252417..b6e41d403a 100644 --- a/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.cpp +++ b/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.cpp @@ -1,132 +1,113 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ 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. =========================================================================*/ // Blueberry #include #include // Qmitk #include "QmitkMITKIGTTrackingToolboxView.h" #include "QmitkStdMultiWidget.h" // Qt #include +#include + +// MITK +#include const std::string QmitkMITKIGTTrackingToolboxView::VIEW_ID = "org.mitk.views.mitkigttrackingtoolbox"; QmitkMITKIGTTrackingToolboxView::QmitkMITKIGTTrackingToolboxView() : QmitkFunctionality() , m_Controls( 0 ) , m_MultiWidget( NULL ) { + } QmitkMITKIGTTrackingToolboxView::~QmitkMITKIGTTrackingToolboxView() { } void QmitkMITKIGTTrackingToolboxView::CreateQtPartControl( QWidget *parent ) { // build up qt view, unless already done if ( !m_Controls ) { // create GUI widgets from the Qt Designer's .ui file m_Controls = new Ui::QmitkMITKIGTTrackingToolboxViewControls; m_Controls->setupUi( parent ); - connect( m_Controls->btnPerformImageProcessing, SIGNAL(clicked()), this, SLOT(DoImageProcessing()) ); + connect( m_Controls->m_LoadTools, SIGNAL(clicked()), this, SLOT(OnLoadTools()) ); } } void QmitkMITKIGTTrackingToolboxView::StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget) { m_MultiWidget = &stdMultiWidget; } void QmitkMITKIGTTrackingToolboxView::StdMultiWidgetNotAvailable() { m_MultiWidget = NULL; } - -void QmitkMITKIGTTrackingToolboxView::OnSelectionChanged( std::vector nodes ) -{ - // iterate all selected objects, adjust warning visibility - for( std::vector::iterator it = nodes.begin(); - it != nodes.end(); - ++it ) - { - mitk::DataNode::Pointer node = *it; +void QmitkMITKIGTTrackingToolboxView::OnLoadTools() +{ + //read in filename + QString filename = QFileDialog::getOpenFileName(NULL,tr("Open Toolfile"), "/", tr("All Files (*.*)")); //later perhaps: tr("Toolfile (*.tfl)" + if (filename.isNull()) return; - if( node.IsNotNull() && dynamic_cast(node->GetData()) ) - { - m_Controls->lblWarning->setVisible( false ); - return; + //initialize tool storage + m_toolStorage = mitk::NavigationToolStorage::New(); + + //read tool storage from disk + mitk::NavigationToolStorageDeserializer::Pointer myDeserializer = mitk::NavigationToolStorageDeserializer::New(GetDataStorage()); + m_toolStorage = myDeserializer->Deserialize(filename.toStdString()); + if (m_toolStorage.IsNull()) + { + MessageBox(myDeserializer->GetErrorMessage()); + m_toolStorage = NULL; + return; } - } - m_Controls->lblWarning->setVisible( true ); + //update label + QString toolLabel = QString("Loaded Tools: ") + QString::number(m_toolStorage->GetToolCount()) + " Tools from " + filename; + m_Controls->m_toolLabel->setText(toolLabel); } +void QmitkMITKIGTTrackingToolboxView::OnStartTracking() +{} -void QmitkMITKIGTTrackingToolboxView::DoImageProcessing() -{ - std::vector nodes = this->GetDataManagerSelection(); - if (nodes.empty()) return; - - mitk::DataNode* node = nodes.front(); +void QmitkMITKIGTTrackingToolboxView::OnStopTracking() +{} - if (!node) +void QmitkMITKIGTTrackingToolboxView::MessageBox(std::string s) { - // Nothing selected. Inform the user and return - QMessageBox::information( NULL, "Template", "Please load and select an image before starting image processing."); - return; + QMessageBox msgBox; + msgBox.setText(s.c_str()); + msgBox.exec(); } - // here we have a valid mitk::DataNode - - // a node itself is not very useful, we need its data item (the image) - mitk::BaseData* data = node->GetData(); - if (data) - { - // test if this data item is an image or not (could also be a surface or something totally different) - mitk::Image* image = dynamic_cast( data ); - if (image) - { - std::stringstream message; - std::string name; - message << "Performing image processing for image "; - if (node->GetName(name)) - { - // a property called "name" was found for this DataNode - message << "'" << name << "'"; - } - message << "."; - MITK_INFO << message.str(); - - // TODO actually do something here... - } - } -} - diff --git a/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.h b/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.h index bdc259666a..e7322abfec 100644 --- a/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.h +++ b/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxView.h @@ -1,73 +1,91 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ Version: $Revision$ 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 QmitkMITKIGTTrackingToolboxView_h #define QmitkMITKIGTTrackingToolboxView_h #include #include #include "ui_QmitkMITKIGTTrackingToolboxViewControls.h" +//mitk headers +#include +#include +#include +#include + /*! \brief QmitkMITKIGTTrackingToolboxView \warning This application module is not yet documented. Use "svn blame/praise/annotate" and ask the author to provide basic documentation. \sa QmitkFunctionality \ingroup Functionalities */ class QmitkMITKIGTTrackingToolboxView : public QObject, public QmitkFunctionality { // this is needed for all Qt objects that should have a Qt meta-object // (everything that derives from QObject and wants to have signal/slots) Q_OBJECT public: static const std::string VIEW_ID; QmitkMITKIGTTrackingToolboxView(); virtual ~QmitkMITKIGTTrackingToolboxView(); virtual void CreateQtPartControl(QWidget *parent); virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget); virtual void StdMultiWidgetNotAvailable(); protected slots: - - /// \brief Called when the user clicks the GUI button - void DoImageProcessing(); - protected: + void OnLoadTools(); - /// \brief called by QmitkFunctionality when DataManager's selection has changed - virtual void OnSelectionChanged( std::vector nodes ); + void OnStartTracking(); + + void OnStopTracking(); + + + protected: Ui::QmitkMITKIGTTrackingToolboxViewControls* m_Controls; QmitkStdMultiWidget* m_MultiWidget; + + void MessageBox(std::string s); + + //stores the loaded tools + mitk::NavigationToolStorage::Pointer m_toolStorage; + + //members for the filter pipeline + mitk::TrackingDeviceSource::Pointer m_TrackingDeviceSource; + mitk::NavigationDataObjectVisualizationFilter::Pointer m_ToolVisualizationFilter; + mitk::NavigationDataRecorder::Pointer m_loggingFilter; + }; #endif // _QMITKMITKIGTTRACKINGTOOLBOXVIEW_H_INCLUDED diff --git a/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxViewControls.ui b/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxViewControls.ui index 34cb4afc5a..c3888bf28a 100644 --- a/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxViewControls.ui +++ b/Modules/Bundles/org.mitk.gui.qt.igttrackingtoolbox/src/internal/QmitkMITKIGTTrackingToolboxViewControls.ui @@ -1,63 +1,211 @@ - + + QmitkMITKIGTTrackingToolboxViewControls - - + + 0 0 - 222 - 161 + 356 + 685 - + 0 0 - + QmitkTemplate - + - - - QLabel { color: rgb(255, 0, 0) } - - - Please select an image! - - - - - - - Do image processing - - - Do something + + + 0 + + + Tracking + + + + + + + + + + + + + + + + + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600;">Tracking Tools</span></p></body></html> + + + + + + + Loaded Tools: <none> + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Load Tools + + + + + + + + + + + + + + + + + + <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> +<html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-size:14pt; font-weight:600;">Tracking Control</span></p></body></html> + + + + + + + Status: <not configured> + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Start Tracking + + + + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Stop Tracking + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + Visualization Options + + + + + Logging Options + + - - - - Qt::Vertical - - - QSizePolicy::Expanding - - - - 20 - 220 - - - - - + + + + QmitkTrackingDeviceConfigurationWidget + QWidget +
QmitkTrackingDeviceConfigurationWidget.h
+ 1 +
+