diff --git a/Plugins/org.mitk.gui.qt.pointsetinteraction/documentation/UserManual/QmitkPointSetInteraction.dox b/Plugins/org.mitk.gui.qt.pointsetinteraction/documentation/UserManual/QmitkPointSetInteraction.dox index 65f82f63f2..012e67114d 100644 --- a/Plugins/org.mitk.gui.qt.pointsetinteraction/documentation/UserManual/QmitkPointSetInteraction.dox +++ b/Plugins/org.mitk.gui.qt.pointsetinteraction/documentation/UserManual/QmitkPointSetInteraction.dox @@ -1,47 +1,47 @@ /** \page org_mitk_views_pointsetinteraction The Point Set Interaction View \imageMacro{QmitkPointSetInteraction_Icon.png,"Icon of the Point Set Interaction View",2.00} Available sections: - \ref QmitkPointSetInteractionUserManualOverview - \ref QmitkPointSetInteractionUserManualDetails \section QmitkPointSetInteractionUserManualOverview Overview -This functionality allows you to define multiple sets of points, to fill them with points and to save them in so called PointSets. +This view allows you to define multiple sets of points, to fill them with points and to save them in so called PointSets. -\imageMacro{QmitkPointSetInteraction_Screenshot.png,"MITK with the QmitkPointSetInteraction functionality",16.00} +\imageMacro{QmitkPointSetInteraction_Screenshot.png,"MITK with the QmitkPointSetInteraction view",16.00} -This document will tell you how to use this functionality, but it is assumed that you already know how to navigate through the slices of an image using the +This document will tell you how to use this view, but it is assumed that you already know how to navigate through the slices of an image using the four window view. Please read the application manual for more information. \section QmitkPointSetInteractionUserManualDetails Details -First of all you have to select a PointSet to use this functionality. Therefore, you have to select the point set in the data manager. +First of all you have to select a PointSet to use this view. Therefore, you have to select the point set in the data manager. If there are currently no point sets in the data tree, you have to first add a new point set to the data tree. This is done by clicking the "Add pointset..." button. \imageMacro{QmitkPointSetInteraction_AddPointSet.png,"The Add pointset... dialog",8.64} In the pop-up dialog, you have to specify a name for the new point set. This is also the node for the new data tree item. \imageMacro{QmitkPointSetInteraction_CurrentPointSetArea.png,"The Current pointset area",6.52} The "Current pointset" area contains a list of points. Within this area, all points for the current point set node are listed. To set points you have to toggle the "Set Points" button, the leftmost of the four buttons on the bottom of the view. Points can be defined by performing a left mouse button click while holding the "Shift"-key pressed in the four window view. To erase all points from the list press the next button. The user is prompted to confirm the decision. If you want to delete only a single point, left click on it in the list and then press delete on your keyboard. With the third button, a previously saved point set can be loaded and all of its points are shown in the list and the four window view. The user is prompted to select the file to be loaded. The file extension is ".mps". On the right of this button is the save button. With this function the entire point set can be saved to the harddrive. The user is prompted to select a filename. Pointsets are saved in XML fileformat but have to have a ".mps" file extension. You can select points in the render window, if the "Set Points" button is toggled, with a left mouse button click on them. If you keep the mouse button pressed, you can move the points by moving the mouse and then releasing the mouse button. With the delete key you can remove the selected points. */ \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.pointsetinteraction/manifest_headers.cmake b/Plugins/org.mitk.gui.qt.pointsetinteraction/manifest_headers.cmake index 71e38a204d..12c8ebbc7c 100644 --- a/Plugins/org.mitk.gui.qt.pointsetinteraction/manifest_headers.cmake +++ b/Plugins/org.mitk.gui.qt.pointsetinteraction/manifest_headers.cmake @@ -1,5 +1,5 @@ set(Plugin-Name "MITK Pointset Interaction") set(Plugin-Version "0.9") set(Plugin-Vendor "DKFZ, Medical and Biological Informatics") set(Plugin-ContactAddress "http://www.mitk.org") -set(Require-Plugin org.mitk.gui.qt.common.legacy) \ No newline at end of file +set(Require-Plugin org.mitk.gui.qt.common) \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.pointsetinteraction/src/internal/QmitkPointSetInteractionView.cpp b/Plugins/org.mitk.gui.qt.pointsetinteraction/src/internal/QmitkPointSetInteractionView.cpp index e0aab62392..600f17a915 100755 --- a/Plugins/org.mitk.gui.qt.pointsetinteraction/src/internal/QmitkPointSetInteractionView.cpp +++ b/Plugins/org.mitk.gui.qt.pointsetinteraction/src/internal/QmitkPointSetInteractionView.cpp @@ -1,150 +1,169 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ // Qmitk related includes #include "QmitkPointSetInteractionView.h" #include "ui_QmitkPointSetInteractionViewControls.h" #include #include #include #include #include #include #include #include QmitkPointSetInteractionView::QmitkPointSetInteractionView( QObject* /*parent*/ ) : m_Controls(0) { } QmitkPointSetInteractionView::~QmitkPointSetInteractionView() { } void QmitkPointSetInteractionView::CreateQtPartControl( QWidget *parent ) { m_Controls = new Ui::QmitkPointSetInteractionControls; m_Controls->setupUi(parent); m_Controls->m_PbAddPointSet->connect( m_Controls->m_PbAddPointSet, SIGNAL( clicked() ) , this, SLOT( OnAddPointSetClicked() ) ); } +void QmitkPointSetInteractionView::SetFocus() +{ + m_Controls->m_PbAddPointSet->setFocus(); +} + void QmitkPointSetInteractionView::Activated() { // emulate datamanager selection - std::vector selection = this->GetDataManagerSelection(); - this->OnSelectionChanged( selection ); + berry::IWorkbenchPart::Pointer nullPart; + QList selection = this->GetDataManagerSelection(); + this->OnSelectionChanged(nullPart, selection); } void QmitkPointSetInteractionView::Deactivated() { // emulate empty selection - std::vector selection; - this->OnSelectionChanged( selection ); + berry::IWorkbenchPart::Pointer nullPart; + QList selection; + this->OnSelectionChanged(nullPart, selection); m_Controls->m_PointListWidget->DeactivateInteractor(true); } +void QmitkPointSetInteractionView::Visible() +{ +} + +void QmitkPointSetInteractionView::Hidden() +{ +} + void QmitkPointSetInteractionView::OnAddPointSetClicked() { //Ask for the name of the point set bool ok = false; QString name = QInputDialog::getText( QApplication::activeWindow() , tr("Add point set..."), tr("Enter name for the new point set"), QLineEdit::Normal, tr("PointSet"), &ok ); if ( ! ok || name.isEmpty() ) return; // //Create a new empty pointset // mitk::PointSet::Pointer pointSet = mitk::PointSet::New(); // // Create a new data tree node // mitk::DataNode::Pointer pointSetNode = mitk::DataNode::New(); // // fill the data tree node with the appropriate information // pointSetNode->SetData( pointSet ); pointSetNode->SetProperty( "name", mitk::StringProperty::New( name.toStdString() ) ); pointSetNode->SetProperty( "opacity", mitk::FloatProperty::New( 1 ) ); pointSetNode->SetColor( 1.0, 1.0, 0.0 ); // // add the node to the ds // - this->GetDefaultDataStorage()->Add(pointSetNode); + this->GetDataStorage()->Add(pointSetNode); // make new selection and emulate selection for this - std::vector selection; - selection.push_back( pointSetNode ); - this->FireNodesSelected( selection ); - this->OnSelectionChanged( selection ); + berry::IWorkbenchPart::Pointer nullPart; + QList selection; + selection.push_back(pointSetNode); + this->FireNodesSelected(selection); + this->OnSelectionChanged(nullPart, selection); } -void QmitkPointSetInteractionView::OnSelectionChanged(std::vector nodes) +void QmitkPointSetInteractionView::OnSelectionChanged(berry::IWorkbenchPart::Pointer /*part*/, const QList& nodes) { mitk::DataNode* selectedNode = 0; if(nodes.size() > 0) selectedNode = nodes.front(); mitk::PointSet* pointSet = 0; if(selectedNode) pointSet = dynamic_cast ( selectedNode->GetData() ); if (pointSet) { m_SelectedPointSetNode = selectedNode; m_Controls->m_CurrentPointSetLabel->setText(QString::fromStdString(selectedNode->GetName())); m_Controls->m_PointListWidget->SetPointSetNode(selectedNode); } else { m_Controls->m_CurrentPointSetLabel->setText(tr("None")); m_Controls->m_PointListWidget->SetPointSetNode(nullptr); std::vector emptyList; emptyList.push_back(nullptr); this->FireNodesSelected( emptyList ); } } -bool QmitkPointSetInteractionView::IsExclusiveFunctionality() const -{ - return true; -} - void QmitkPointSetInteractionView::NodeChanged( const mitk::DataNode* node ) { if(node == m_SelectedPointSetNode && m_Controls->m_CurrentPointSetLabel->text().toStdString() != node->GetName()) { m_Controls->m_CurrentPointSetLabel->setText(QString::fromStdString(node->GetName())); } } -void QmitkPointSetInteractionView::StdMultiWidgetAvailable( QmitkStdMultiWidget& stdMultiWidget ) +void QmitkPointSetInteractionView::RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart) { - if(m_Controls) - m_Controls->m_PointListWidget->SetMultiWidget( &stdMultiWidget ); + if(m_Controls) + { + m_Controls->m_PointListWidget->AddSliceNavigationController(renderWindowPart->GetQmitkRenderWindow("axial")->GetSliceNavigationController()); + m_Controls->m_PointListWidget->AddSliceNavigationController(renderWindowPart->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController()); + m_Controls->m_PointListWidget->AddSliceNavigationController(renderWindowPart->GetQmitkRenderWindow("coronal")->GetSliceNavigationController()); + } } -void QmitkPointSetInteractionView::StdMultiWidgetClosed( QmitkStdMultiWidget& /*stdMultiWidget*/ ) +void QmitkPointSetInteractionView::RenderWindowPartDeactivated(mitk::IRenderWindowPart* renderWindowPart) { - if(m_Controls) - m_Controls->m_PointListWidget->SetMultiWidget( 0 ); + if(m_Controls) + { + m_Controls->m_PointListWidget->RemoveSliceNavigationController(renderWindowPart->GetQmitkRenderWindow("axial")->GetSliceNavigationController()); + m_Controls->m_PointListWidget->RemoveSliceNavigationController(renderWindowPart->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController()); + m_Controls->m_PointListWidget->RemoveSliceNavigationController(renderWindowPart->GetQmitkRenderWindow("coronal")->GetSliceNavigationController()); + } } diff --git a/Plugins/org.mitk.gui.qt.pointsetinteraction/src/internal/QmitkPointSetInteractionView.h b/Plugins/org.mitk.gui.qt.pointsetinteraction/src/internal/QmitkPointSetInteractionView.h index b98bfba683..c2ab26aa8a 100755 --- a/Plugins/org.mitk.gui.qt.pointsetinteraction/src/internal/QmitkPointSetInteractionView.h +++ b/Plugins/org.mitk.gui.qt.pointsetinteraction/src/internal/QmitkPointSetInteractionView.h @@ -1,56 +1,65 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #if !defined(QmitkPointSetInteraction_H__INCLUDED) #define QmitkPointSetInteraction_H__INCLUDED #include -#include +#include +#include +#include #include #include namespace Ui { class QmitkPointSetInteractionControls; }; /*! \brief QmitkPointSetInteractionView */ -class QmitkPointSetInteractionView : public QmitkFunctionality +class QmitkPointSetInteractionView : public QmitkAbstractView, public mitk::ILifecycleAwarePart, public mitk::IRenderWindowPartListener { Q_OBJECT public: QmitkPointSetInteractionView(QObject *parent=0); virtual ~QmitkPointSetInteractionView(); virtual void CreateQtPartControl(QWidget *parent) override; - void OnSelectionChanged(std::vector nodes) override; + + /// + /// Sets the focus to an internal widget. + /// + virtual void SetFocus() override; + + virtual void OnSelectionChanged(berry::IWorkbenchPart::Pointer part, const QList& nodes) override; void Activated() override; void Deactivated() override; + void Visible() override; + void Hidden() override; void NodeChanged(const mitk::DataNode* node) override; - bool IsExclusiveFunctionality() const override; - virtual void StdMultiWidgetAvailable(QmitkStdMultiWidget& stdMultiWidget) override; - virtual void StdMultiWidgetClosed(QmitkStdMultiWidget& stdMultiWidget) override; + virtual void RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart) override; + virtual void RenderWindowPartDeactivated(mitk::IRenderWindowPart* renderWindowPart) override; protected slots: void OnAddPointSetClicked(); protected: Ui::QmitkPointSetInteractionControls * m_Controls; mitk::WeakPointer m_SelectedPointSetNode; }; #endif // !defined(QmitkPointSetInteraction_H__INCLUDED)