diff --git a/Modules/Bundles/org.mitk.gui.qt.imagenavigator/manifest_headers.cmake b/Modules/Bundles/org.mitk.gui.qt.imagenavigator/manifest_headers.cmake index e6f70e280f..a24cc8713d 100644 --- a/Modules/Bundles/org.mitk.gui.qt.imagenavigator/manifest_headers.cmake +++ b/Modules/Bundles/org.mitk.gui.qt.imagenavigator/manifest_headers.cmake @@ -1,5 +1,5 @@ set(Plugin-Name "MITK Image Navigator") 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) +set(Require-Plugin org.mitk.gui.qt.common) diff --git a/Modules/Bundles/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.cpp b/Modules/Bundles/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.cpp index ad8399c33c..cb04c179c4 100644 --- a/Modules/Bundles/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.cpp +++ b/Modules/Bundles/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.cpp @@ -1,399 +1,393 @@ /*========================================================================= 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 "QmitkImageNavigatorView.h" -#include "mitkNodePredicateDataType.h" +#include +#include -#include "QmitkDataStorageComboBox.h" -#include "QmitkStdMultiWidget.h" - -#include "mitkDataStorageEditorInput.h" - -// berry Includes -#include -#include #include -#include - - const std::string QmitkImageNavigatorView::VIEW_ID = "org.mitk.views.imagenavigator"; -class ImageNavigatorPartListener : public berry::IPartListener -{ -public: - - ImageNavigatorPartListener(QmitkImageNavigatorView* view) - : m_View(view) - {} - - berry::IPartListener::Events::Types GetPartEventTypes() const - { - return berry::IPartListener::Events::OPENED | - berry::IPartListener::Events::CLOSED; - } - - void PartClosed(berry::IWorkbenchPartReference::Pointer partRef) - { - if((partRef->GetId() == QmitkImageNavigatorView::VIEW_ID) || (partRef->GetId() == QmitkStdMultiWidgetEditor::EDITOR_ID)) - { - m_View->SetMultiWidget(0); - } - } - - void PartOpened(berry::IWorkbenchPartReference::Pointer partRef) - { - if (partRef->GetId() == QmitkStdMultiWidgetEditor::EDITOR_ID) - { - if (QmitkStdMultiWidgetEditor::Pointer multiWidgetPart = - partRef->GetPart(false).Cast()) - { - m_View->SetMultiWidget(multiWidgetPart->GetStdMultiWidget()); - } - else - { - m_View->SetMultiWidget(0); - } - } - } - -private: - - QmitkImageNavigatorView* m_View; -}; - - QmitkImageNavigatorView::QmitkImageNavigatorView() - : m_MultiWidget(NULL) + : m_TransversalStepper(0) + , m_SagittalStepper(0) + , m_FrontalStepper(0) + , m_TimeStepper(0) + , m_Parent(0) + , m_IRenderWindowPart(0) { - multiWidgetListener = new ImageNavigatorPartListener(this); } QmitkImageNavigatorView::~QmitkImageNavigatorView() { - this->GetSite()->GetPage()->RemovePartListener(multiWidgetListener); } void QmitkImageNavigatorView::CreateQtPartControl(QWidget *parent) { - // create GUI widgets + m_Parent = parent; m_Controls.setupUi(parent); - m_MultiWidget = this->GetActiveStdMultiWidget(); m_Controls.m_SliceNavigatorTransversal->SetInverseDirection(true); - m_TransversalStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorTransversal, m_MultiWidget->mitkWidget1->GetSliceNavigationController()->GetSlice() , "sliceNavigatorTransversalFromSimpleExample"); - m_SagittalStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorSagittal, m_MultiWidget->mitkWidget2->GetSliceNavigationController()->GetSlice(), "sliceNavigatorSagittalFromSimpleExample"); - m_FrontalStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorFrontal, m_MultiWidget->mitkWidget3->GetSliceNavigationController()->GetSlice(), "sliceNavigatorFrontalFromSimpleExample"); - m_TimeStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorTime, m_MultiWidget->GetTimeNavigationController()->GetTime(), "sliceNavigatorTimeFromSimpleExample"); - - this->GetSite()->GetPage()->AddPartListener(multiWidgetListener); connect(m_Controls.m_XWorldCoordinateSpinBox, SIGNAL(valueChanged(double)), this, SLOT(OnMillimetreCoordinateValueChanged())); connect(m_Controls.m_YWorldCoordinateSpinBox, SIGNAL(valueChanged(double)), this, SLOT(OnMillimetreCoordinateValueChanged())); connect(m_Controls.m_ZWorldCoordinateSpinBox, SIGNAL(valueChanged(double)), this, SLOT(OnMillimetreCoordinateValueChanged())); - connect(m_TransversalStepper, SIGNAL(Refetch()), this, SLOT(OnRefetch())); - connect(m_SagittalStepper, SIGNAL(Refetch()), this, SLOT(OnRefetch())); - connect(m_FrontalStepper, SIGNAL(Refetch()), this, SLOT(OnRefetch())); + m_Parent->setEnabled(false); + + mitk::IRenderWindowPart* renderPart = this->GetRenderWindowPart(); + this->RenderWindowPartActivated(renderPart); } void QmitkImageNavigatorView::SetFocus () { - + m_Controls.m_XWorldCoordinateSpinBox->setFocus(); } -void QmitkImageNavigatorView::SetMultiWidget(QmitkStdMultiWidget* multiWidget) +void QmitkImageNavigatorView::RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart) { - m_MultiWidget = multiWidget; - if (m_MultiWidget) + if (this->m_IRenderWindowPart != renderWindowPart) { - m_TransversalStepper->deleteLater(); - m_SagittalStepper->deleteLater(); - m_FrontalStepper->deleteLater(); - m_TimeStepper->deleteLater(); - - m_TransversalStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorTransversal, m_MultiWidget->mitkWidget1->GetSliceNavigationController()->GetSlice() , "sliceNavigatorTransversalFromSimpleExample"); - m_SagittalStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorSagittal, m_MultiWidget->mitkWidget2->GetSliceNavigationController()->GetSlice(), "sliceNavigatorSagittalFromSimpleExample"); - m_FrontalStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorFrontal, m_MultiWidget->mitkWidget3->GetSliceNavigationController()->GetSlice(), "sliceNavigatorFrontalFromSimpleExample"); - m_TimeStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorTime, m_MultiWidget->GetTimeNavigationController()->GetTime(), "sliceNavigatorTimeFromSimpleExample"); - } - else - { - m_TransversalStepper->SetStepper(0); - m_SagittalStepper->SetStepper(0); - m_FrontalStepper->SetStepper(0); - m_TimeStepper->SetStepper(0); - } -} + this->m_IRenderWindowPart = renderWindowPart; + this->m_Parent->setEnabled(true); -QmitkStdMultiWidget* QmitkImageNavigatorView::GetActiveStdMultiWidget() -{ - QmitkStdMultiWidget* activeStdMultiWidget = 0; - berry::IEditorPart::Pointer editor = - this->GetSite()->GetPage()->GetActiveEditor(); + QmitkRenderWindow* renderWindow = renderWindowPart->GetRenderWindow("transversal"); + if (renderWindow) + { + if (m_TransversalStepper) m_TransversalStepper->deleteLater(); + m_TransversalStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorTransversal, + renderWindow->GetSliceNavigationController()->GetSlice(), + "sliceNavigatorTransversalFromSimpleExample"); + m_Controls.m_SliceNavigatorTransversal->setEnabled(true); + m_Controls.m_TransversalLabel->setEnabled(true); + m_Controls.m_ZWorldCoordinateSpinBox->setEnabled(true); + connect(m_TransversalStepper, SIGNAL(Refetch()), this, SLOT(OnRefetch())); + } + else + { + m_Controls.m_SliceNavigatorTransversal->setEnabled(false); + m_Controls.m_TransversalLabel->setEnabled(false); + m_Controls.m_ZWorldCoordinateSpinBox->setEnabled(false); + } - if (editor.Cast().IsNotNull()) - { - activeStdMultiWidget = editor.Cast()->GetStdMultiWidget(); - } - else - { - mitk::DataStorageEditorInput::Pointer editorInput; - editorInput = new mitk::DataStorageEditorInput(); - berry::IEditorPart::Pointer editor = this->GetSite()->GetPage()->OpenEditor(editorInput, QmitkStdMultiWidgetEditor::EDITOR_ID, false); - activeStdMultiWidget = editor.Cast()->GetStdMultiWidget(); + renderWindow = renderWindowPart->GetRenderWindow("sagittal"); + if (renderWindow) + { + if (m_SagittalStepper) m_SagittalStepper->deleteLater(); + m_SagittalStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorSagittal, + renderWindow->GetSliceNavigationController()->GetSlice(), + "sliceNavigatorSagittalFromSimpleExample"); + m_Controls.m_SliceNavigatorSagittal->setEnabled(true); + m_Controls.m_SagittalLabel->setEnabled(true); + m_Controls.m_YWorldCoordinateSpinBox->setEnabled(true); + connect(m_SagittalStepper, SIGNAL(Refetch()), this, SLOT(OnRefetch())); + } + else + { + m_Controls.m_SliceNavigatorSagittal->setEnabled(false); + m_Controls.m_SagittalLabel->setEnabled(false); + m_Controls.m_YWorldCoordinateSpinBox->setEnabled(false); + } + + renderWindow = renderWindowPart->GetRenderWindow("coronal"); + if (renderWindow) + { + if (m_FrontalStepper) m_FrontalStepper->deleteLater(); + m_FrontalStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorFrontal, + renderWindow->GetSliceNavigationController()->GetSlice(), + "sliceNavigatorFrontalFromSimpleExample"); + m_Controls.m_SliceNavigatorFrontal->setEnabled(true); + m_Controls.m_CoronalLabel->setEnabled(true); + m_Controls.m_XWorldCoordinateSpinBox->setEnabled(true); + connect(m_FrontalStepper, SIGNAL(Refetch()), this, SLOT(OnRefetch())); + } + else + { + m_Controls.m_SliceNavigatorFrontal->setEnabled(false); + m_Controls.m_CoronalLabel->setEnabled(false); + m_Controls.m_XWorldCoordinateSpinBox->setEnabled(false); + } + + mitk::SliceNavigationController* timeController = renderWindowPart->GetTimeNavigationController(); + if (timeController) + { + if (m_TimeStepper) m_TimeStepper->deleteLater(); + m_TimeStepper = new QmitkStepperAdapter(m_Controls.m_SliceNavigatorTime, + timeController->GetSlice(), + "sliceNavigatorTimeFromSimpleExample"); + m_Controls.m_SliceNavigatorTime->setEnabled(true); + m_Controls.m_TimeLabel->setEnabled(true); + } + else + { + m_Controls.m_SliceNavigatorTime->setEnabled(false); + m_Controls.m_TimeLabel->setEnabled(false); + } } +} - return activeStdMultiWidget; +void QmitkImageNavigatorView::RenderWindowPartDeactivated(mitk::IRenderWindowPart* /*renderWindowPart*/) +{ + m_IRenderWindowPart = 0; + m_Parent->setEnabled(false); } int QmitkImageNavigatorView::GetSizeFlags(bool width) { if(!width) { return berry::Constants::MIN | berry::Constants::MAX | berry::Constants::FILL; } else { return 0; } } int QmitkImageNavigatorView::ComputePreferredSize(bool width, int /*availableParallel*/, int /*availablePerpendicular*/, int preferredResult) { if(width==false) { - return 160; + return 200; } else { return preferredResult; } } int QmitkImageNavigatorView::GetClosestAxisIndex(mitk::Vector3D normal) { // cos(theta) = normal . axis // cos(theta) = (a, b, c) . (d, e, f) // cos(theta) = (a, b, c) . (1, 0, 0) = a // cos(theta) = (a, b, c) . (0, 1, 0) = b // cos(theta) = (a, b, c) . (0, 0, 1) = c double absCosThetaWithAxis[3]; for (int i = 0; i < 3; i++) { absCosThetaWithAxis[i] = fabs(normal[i]); } int largestIndex = 0; double largestValue = absCosThetaWithAxis[0]; for (int i = 1; i < 3; i++) { if (absCosThetaWithAxis[i] > largestValue) { largestValue = absCosThetaWithAxis[i]; largestIndex = i; } } return largestIndex; } void QmitkImageNavigatorView::SetBorderColors() { - if (m_MultiWidget) + if (m_IRenderWindowPart) { - mitk::PlaneGeometry::ConstPointer geometry = m_MultiWidget->mitkWidget1->GetSliceNavigationController()->GetCurrentPlaneGeometry(); - - if (geometry.IsNotNull()) + QmitkRenderWindow* renderWindow = m_IRenderWindowPart->GetRenderWindow("transversal"); + if (renderWindow) { - mitk::Vector3D normal = geometry->GetNormal(); - int axis = this->GetClosestAxisIndex(normal); - this->SetBorderColor(axis, QString("red")); + mitk::PlaneGeometry::ConstPointer geometry = renderWindow->GetSliceNavigationController()->GetCurrentPlaneGeometry(); + if (geometry.IsNotNull()) + { + mitk::Vector3D normal = geometry->GetNormal(); + int axis = this->GetClosestAxisIndex(normal); + this->SetBorderColor(axis, QString("red")); + } } - geometry = m_MultiWidget->mitkWidget2->GetSliceNavigationController()->GetCurrentPlaneGeometry(); - - if (geometry.IsNotNull()) + renderWindow = m_IRenderWindowPart->GetRenderWindow("sagittal"); + if (renderWindow) { - mitk::Vector3D normal = geometry->GetNormal(); - int axis = this->GetClosestAxisIndex(normal); - this->SetBorderColor(axis, QString("green")); + mitk::PlaneGeometry::ConstPointer geometry = renderWindow->GetSliceNavigationController()->GetCurrentPlaneGeometry(); + if (geometry.IsNotNull()) + { + mitk::Vector3D normal = geometry->GetNormal(); + int axis = this->GetClosestAxisIndex(normal); + this->SetBorderColor(axis, QString("green")); + } } - geometry = m_MultiWidget->mitkWidget3->GetSliceNavigationController()->GetCurrentPlaneGeometry(); - - if (geometry.IsNotNull()) + renderWindow = m_IRenderWindowPart->GetRenderWindow("coronal"); + if (renderWindow) { - mitk::Vector3D normal = geometry->GetNormal(); - int axis = this->GetClosestAxisIndex(normal); - this->SetBorderColor(axis, QString("blue")); + mitk::PlaneGeometry::ConstPointer geometry = renderWindow->GetSliceNavigationController()->GetCurrentPlaneGeometry(); + if (geometry.IsNotNull()) + { + mitk::Vector3D normal = geometry->GetNormal(); + int axis = this->GetClosestAxisIndex(normal); + this->SetBorderColor(axis, QString("blue")); + } } - } } void QmitkImageNavigatorView::SetBorderColor(int axis, QString colorAsStyleSheetString) { if (axis == 0) { this->SetBorderColor(m_Controls.m_XWorldCoordinateSpinBox, colorAsStyleSheetString); } else if (axis == 1) { this->SetBorderColor(m_Controls.m_YWorldCoordinateSpinBox, colorAsStyleSheetString); } else if (axis == 2) { this->SetBorderColor(m_Controls.m_ZWorldCoordinateSpinBox, colorAsStyleSheetString); } } void QmitkImageNavigatorView::SetBorderColor(QDoubleSpinBox *spinBox, QString colorAsStyleSheetString) { assert(spinBox); spinBox->setStyleSheet(QString("border: 2px solid ") + colorAsStyleSheetString + ";"); } void QmitkImageNavigatorView::SetStepSizes() { this->SetStepSize(0); this->SetStepSize(1); this->SetStepSize(2); } void QmitkImageNavigatorView::SetStepSize(int axis) { - if (m_MultiWidget) + if (m_IRenderWindowPart) { - mitk::Geometry3D::ConstPointer geometry = m_MultiWidget->mitkWidget1->GetSliceNavigationController()->GetInputWorldGeometry(); + mitk::Geometry3D::ConstPointer geometry = m_IRenderWindowPart->GetActiveRenderWindow()->GetSliceNavigationController()->GetInputWorldGeometry(); if (geometry.IsNotNull()) { mitk::Point3D crossPositionInIndexCoordinates; mitk::Point3D crossPositionInIndexCoordinatesPlus1; mitk::Point3D crossPositionInMillimetresPlus1; mitk::Vector3D transformedAxisDirection; - mitk::Point3D crossPositionInMillimetres = m_MultiWidget->GetCrossPosition(); + mitk::Point3D crossPositionInMillimetres = m_IRenderWindowPart->GetSelectedPosition(); geometry->WorldToIndex(crossPositionInMillimetres, crossPositionInIndexCoordinates); crossPositionInIndexCoordinatesPlus1 = crossPositionInIndexCoordinates; crossPositionInIndexCoordinatesPlus1[axis] += 1; geometry->IndexToWorld(crossPositionInIndexCoordinatesPlus1, crossPositionInMillimetresPlus1); transformedAxisDirection = crossPositionInMillimetresPlus1 - crossPositionInMillimetres; int closestAxisInMillimetreSpace = this->GetClosestAxisIndex(transformedAxisDirection); double stepSize = transformedAxisDirection.GetNorm(); this->SetStepSize(closestAxisInMillimetreSpace, stepSize); } } } void QmitkImageNavigatorView::SetStepSize(int axis, double stepSize) { if (axis == 0) { m_Controls.m_XWorldCoordinateSpinBox->setSingleStep(stepSize); } else if (axis == 1) { m_Controls.m_YWorldCoordinateSpinBox->setSingleStep(stepSize); } else if (axis == 2) { m_Controls.m_ZWorldCoordinateSpinBox->setSingleStep(stepSize); } } void QmitkImageNavigatorView::OnMillimetreCoordinateValueChanged() { - if (m_MultiWidget) + if (m_IRenderWindowPart) { - mitk::Geometry3D::ConstPointer geometry = m_MultiWidget->mitkWidget1->GetSliceNavigationController()->GetInputWorldGeometry(); + mitk::Geometry3D::ConstPointer geometry = m_IRenderWindowPart->GetActiveRenderWindow()->GetSliceNavigationController()->GetInputWorldGeometry(); if (geometry.IsNotNull()) { mitk::Point3D positionInWorldCoordinates; positionInWorldCoordinates[0] = m_Controls.m_XWorldCoordinateSpinBox->value(); positionInWorldCoordinates[1] = m_Controls.m_YWorldCoordinateSpinBox->value(); positionInWorldCoordinates[2] = m_Controls.m_ZWorldCoordinateSpinBox->value(); - m_MultiWidget->MoveCrossToPosition(positionInWorldCoordinates); + m_IRenderWindowPart->SetSelectedPosition(positionInWorldCoordinates); } } } void QmitkImageNavigatorView::OnRefetch() { - if (m_MultiWidget) + if (m_IRenderWindowPart) { - mitk::Geometry3D::ConstPointer geometry = m_MultiWidget->mitkWidget1->GetSliceNavigationController()->GetInputWorldGeometry(); + mitk::Geometry3D::ConstPointer geometry = m_IRenderWindowPart->GetActiveRenderWindow()->GetSliceNavigationController()->GetInputWorldGeometry(); if (geometry.IsNotNull()) { mitk::Geometry3D::BoundsArrayType bounds = geometry->GetBounds(); mitk::Point3D cornerPoint1InIndexCoordinates; cornerPoint1InIndexCoordinates[0] = bounds[0]; cornerPoint1InIndexCoordinates[1] = bounds[2]; cornerPoint1InIndexCoordinates[2] = bounds[4]; mitk::Point3D cornerPoint2InIndexCoordinates; cornerPoint2InIndexCoordinates[0] = bounds[1]; cornerPoint2InIndexCoordinates[1] = bounds[3]; cornerPoint2InIndexCoordinates[2] = bounds[5]; if (!geometry->GetImageGeometry()) { cornerPoint1InIndexCoordinates[0] += 0.5; cornerPoint1InIndexCoordinates[1] += 0.5; cornerPoint1InIndexCoordinates[2] += 0.5; cornerPoint2InIndexCoordinates[0] -= 0.5; cornerPoint2InIndexCoordinates[1] -= 0.5; cornerPoint2InIndexCoordinates[2] -= 0.5; } - mitk::Point3D crossPositionInWorldCoordinates = m_MultiWidget->GetCrossPosition(); + mitk::Point3D crossPositionInWorldCoordinates = m_IRenderWindowPart->GetSelectedPosition(); mitk::Point3D cornerPoint1InWorldCoordinates; mitk::Point3D cornerPoint2InWorldCoordinates; geometry->IndexToWorld(cornerPoint1InIndexCoordinates, cornerPoint1InWorldCoordinates); geometry->IndexToWorld(cornerPoint2InIndexCoordinates, cornerPoint2InWorldCoordinates); m_Controls.m_XWorldCoordinateSpinBox->blockSignals(true); m_Controls.m_YWorldCoordinateSpinBox->blockSignals(true); m_Controls.m_ZWorldCoordinateSpinBox->blockSignals(true); m_Controls.m_XWorldCoordinateSpinBox->setMinimum(std::min(cornerPoint1InWorldCoordinates[0], cornerPoint2InWorldCoordinates[0])); m_Controls.m_YWorldCoordinateSpinBox->setMinimum(std::min(cornerPoint1InWorldCoordinates[1], cornerPoint2InWorldCoordinates[1])); m_Controls.m_ZWorldCoordinateSpinBox->setMinimum(std::min(cornerPoint1InWorldCoordinates[2], cornerPoint2InWorldCoordinates[2])); m_Controls.m_XWorldCoordinateSpinBox->setMaximum(std::max(cornerPoint1InWorldCoordinates[0], cornerPoint2InWorldCoordinates[0])); m_Controls.m_YWorldCoordinateSpinBox->setMaximum(std::max(cornerPoint1InWorldCoordinates[1], cornerPoint2InWorldCoordinates[1])); m_Controls.m_ZWorldCoordinateSpinBox->setMaximum(std::max(cornerPoint1InWorldCoordinates[2], cornerPoint2InWorldCoordinates[2])); m_Controls.m_XWorldCoordinateSpinBox->setValue(crossPositionInWorldCoordinates[0]); m_Controls.m_YWorldCoordinateSpinBox->setValue(crossPositionInWorldCoordinates[1]); m_Controls.m_ZWorldCoordinateSpinBox->setValue(crossPositionInWorldCoordinates[2]); m_Controls.m_XWorldCoordinateSpinBox->blockSignals(false); m_Controls.m_YWorldCoordinateSpinBox->blockSignals(false); m_Controls.m_ZWorldCoordinateSpinBox->blockSignals(false); } this->SetBorderColors(); } } diff --git a/Modules/Bundles/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.h b/Modules/Bundles/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.h index b3d72afe83..d6a0fef2b8 100644 --- a/Modules/Bundles/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.h +++ b/Modules/Bundles/org.mitk.gui.qt.imagenavigator/src/internal/QmitkImageNavigatorView.h @@ -1,110 +1,97 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date$ 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 _QMITKIMAGENAVIGATORVIEW_H_INCLUDED #define _QMITKIMAGENAVIGATORVIEW_H_INCLUDED -#include #include -#include -#include -#include -#include -#include "QmitkStepperAdapter.h" - -#include +#include +#include #include "ui_QmitkImageNavigatorViewControls.h" -#include "berryISizeProvider.h" +class QmitkStepperAdapter; + /*! * \ingroup org_mitk_gui_qt_imagenavigator_internal * * \class QmitkImageNavigatorView * * \brief Provides a means to scan quickly through a dataset via Transversal, * Coronal and Sagittal sliders, displaying millimetre location and stepper position. * * For images, the stepper position corresponds to a voxel index. For other datasets * such as a surface, it corresponds to a sub-division of the bounding box. * - * \sa QmitkFunctionality + * \sa QmitkAbstractView */ -class QmitkImageNavigatorView : public berry::QtViewPart, public berry::ISizeProvider +class QmitkImageNavigatorView : + public QmitkAbstractView, public mitk::IRenderWindowPartListener, + public berry::ISizeProvider { // this is needed for all Qt objects that should have a MOC object (everything that derives from QObject) Q_OBJECT - public: +public: static const std::string VIEW_ID; QmitkImageNavigatorView(); - QmitkImageNavigatorView(const QmitkImageNavigatorView& other) - { - Q_UNUSED(other) - throw std::runtime_error("Copy constructor not implemented"); - } virtual ~QmitkImageNavigatorView(); virtual void CreateQtPartControl(QWidget *parent); - QmitkStdMultiWidget* GetActiveStdMultiWidget(); - - void SetFocus(); - virtual int GetSizeFlags(bool width); virtual int ComputePreferredSize(bool width, int /*availableParallel*/, int /*availablePerpendicular*/, int preferredResult); protected slots: void OnMillimetreCoordinateValueChanged(); void OnRefetch(); protected: - friend class ImageNavigatorPartListener; + void SetFocus(); + + void RenderWindowPartActivated(mitk::IRenderWindowPart *renderWindowPart); + void RenderWindowPartDeactivated(mitk::IRenderWindowPart *renderWindowPart); - void SetMultiWidget(QmitkStdMultiWidget* multiWidget); void SetBorderColors(); void SetBorderColor(QDoubleSpinBox *spinBox, QString colorAsStyleSheetString); void SetBorderColor(int axis, QString colorAsStyleSheetString); void SetStepSizes(); void SetStepSize(int axis); void SetStepSize(int axis, double stepSize); int GetClosestAxisIndex(mitk::Vector3D normal); Ui::QmitkImageNavigatorViewControls m_Controls; - QmitkStdMultiWidget* m_MultiWidget; QmitkStepperAdapter* m_TransversalStepper; QmitkStepperAdapter* m_SagittalStepper; QmitkStepperAdapter* m_FrontalStepper; QmitkStepperAdapter* m_TimeStepper; - berry::IPartListener::Pointer multiWidgetListener; -}; - - + QWidget* m_Parent; + mitk::IRenderWindowPart* m_IRenderWindowPart; +}; #endif // _QMITKIMAGENAVIGATORVIEW_H_INCLUDED -