diff --git a/Modules/QtWidgets/files.cmake b/Modules/QtWidgets/files.cmake index 7fabcf25c3..ea50e5759d 100644 --- a/Modules/QtWidgets/files.cmake +++ b/Modules/QtWidgets/files.cmake @@ -1,87 +1,87 @@ file(GLOB_RECURSE H_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include/*") set(CPP_FILES QmitkApplicationCursor.cpp QmitkDataStorageComboBox.cpp QmitkDataStorageListModel.cpp QmitkDataStorageTableModel.cpp QmitkDataStorageTreeModel.cpp QmitkFileReaderOptionsDialog.cpp QmitkFileReaderWriterOptionsWidget.cpp QmitkFileWriterOptionsDialog.cpp QmitkIOUtil.cpp QmitkLevelWindowPresetDefinitionDialog.cpp QmitkLevelWindowRangeChangeDialog.cpp QmitkLevelWindowWidgetContextMenu.cpp QmitkLevelWindowWidget.cpp QmitkLineEditLevelWindowWidget.cpp QmitkMemoryUsageIndicatorView.cpp QmitkMimeTypes.cpp QmitkNodeDescriptor.cpp QmitkNodeDescriptorManager.cpp QmitkRenderWindowMenu.cpp QmitkProgressBar.cpp QmitkPropertiesTableEditor.cpp QmitkPropertiesTableModel.cpp QmitkPropertyDelegate.cpp QmitkRegisterClasses.cpp QmitkRenderingManager.cpp QmitkRenderingManagerFactory.cpp QmitkRenderWindow.cpp QmitkRenderWindowWidget.cpp QmitkServiceListWidget.cpp QmitkSliderLevelWindowWidget.cpp QmitkStdMultiWidget.cpp QmitkCustomMultiWidget.cpp QmitkMouseModeSwitcher.cpp QmitkDataStorageFilterProxyModel.cpp QmitkDataStorageComboBoxWithSelectNone.cpp QmitkPropertyItem.cpp QmitkPropertyItemDelegate.cpp QmitkPropertyItemModel.cpp ) set(MOC_H_FILES include/QmitkDataStorageComboBox.h include/QmitkDataStorageTableModel.h include/QmitkFileReaderOptionsDialog.h include/QmitkFileReaderWriterOptionsWidget.h include/QmitkFileWriterOptionsDialog.h include/QmitkLevelWindowPresetDefinitionDialog.h include/QmitkLevelWindowRangeChangeDialog.h include/QmitkLevelWindowWidgetContextMenu.h include/QmitkLevelWindowWidget.h include/QmitkLineEditLevelWindowWidget.h include/QmitkMemoryUsageIndicatorView.h include/QmitkNodeDescriptor.h include/QmitkNodeDescriptorManager.h include/QmitkRenderWindowMenu.h - include/QmitkRenderWindowWidget. + include/QmitkRenderWindowWidget.h include/QmitkProgressBar.h include/QmitkPropertiesTableEditor.h include/QmitkPropertyDelegate.h include/QmitkRenderingManager.h include/QmitkRenderWindow.h include/QmitkServiceListWidget.h include/QmitkSliderLevelWindowWidget.h include/QmitkStdMultiWidget.h include/QmitkCustomMultiWidget.h include/QmitkMouseModeSwitcher.h include/QmitkDataStorageComboBoxWithSelectNone.h include/QmitkPropertyItemDelegate.h include/QmitkPropertyItemModel.h ) set(UI_FILES src/QmitkFileReaderOptionsDialog.ui src/QmitkFileWriterOptionsDialog.ui src/QmitkLevelWindowPresetDefinition.ui src/QmitkLevelWindowWidget.ui src/QmitkLevelWindowRangeChange.ui src/QmitkMemoryUsageIndicator.ui src/QmitkServiceListWidgetControls.ui ) set(QRC_FILES resource/Qmitk.qrc ) diff --git a/Modules/QtWidgets/include/QmitkCustomMultiWidget.h b/Modules/QtWidgets/include/QmitkCustomMultiWidget.h index 964d237e90..a58cce5214 100644 --- a/Modules/QtWidgets/include/QmitkCustomMultiWidget.h +++ b/Modules/QtWidgets/include/QmitkCustomMultiWidget.h @@ -1,249 +1,208 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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. ===================================================================*/ #ifndef QMITKCUSTOMMULTIWIDGET_H #define QMITKCUSTOMMULTIWIDGET_H // qt widgets module #include "MitkQtWidgetsExports.h" #include "QmitkRenderWindowWidget.h" // mitk core #include #include -#include // qt -#include -#include #include class QHBoxLayout; class QVBoxLayout; class QGridLayout; class QSpacerItem; class QmitkLevelWindowWidget; class QmitkRenderWindow; class vtkCornerAnnotation; namespace mitk { class RenderingManager; } -/* +/** * @brief The 'QmitkCustomMultiWidget' is a 'QWidget' that is used to display multiple render windows at once. * * Render windows can dynamically be added and removed to change the layout of the multi widget. */ class MITKQTWIDGETS_EXPORT QmitkCustomMultiWidget : public QWidget { Q_OBJECT public: - QmitkCustomMultiWidget(QWidget *parent = 0, Qt::WindowFlags f = 0, mitk::RenderingManager *renderingManager = 0, mitk::BaseRenderer::RenderingMode::Type renderingMode = mitk::BaseRenderer::RenderingMode::Standard, const QString& name = "custommulti"); - virtual ~QmitkCustomMultiWidget(); + QmitkCustomMultiWidget(QWidget* parent = 0, + Qt::WindowFlags f = 0, + mitk::RenderingManager* renderingManager = nullptr, + mitk::BaseRenderer::RenderingMode::Type renderingMode = mitk::BaseRenderer::RenderingMode::Standard, + const QString& multiWidgetName = "custommulti"); + virtual ~QmitkCustomMultiWidget(); + void SetDataStorage(mitk::DataStorage* dataStorage); - mitk::MouseModeSwitcher* GetMouseModeSwitcher(); - - std::map GetRenderWindowWidgets() const; - QmitkRenderWindowWidget* GetRenderWindowWidget(unsigned int id) const; + std::map GetRenderWindowWidgets() const; + QmitkRenderWindowWidget* GetRenderWindowWidget(unsigned int widgetNumber) const; QmitkRenderWindowWidget* GetActiveRenderWindowWidget() const; QmitkRenderWindowWidget* GetFirstRenderWindowWidget() const; QmitkRenderWindowWidget* GetLastRenderWindowWidget() const; unsigned int GetNumberOfRenderWindowWidgets() const; - const mitk::Point3D GetCrossPosition() const; - - void RequestUpdate(unsigned int id); + void RequestUpdate(unsigned int widgetNumber); void RequestUpdateAll(); - void ForceImmediateUpdate(unsigned int id); + void ForceImmediateUpdate(unsigned int widgetNumber); void ForceImmediateUpdateAll(); - // color and style settings - - /** \brief Listener to the CrosshairPositionEvent - - Ensures the CrosshairPositionEvent is handled only once and at the end of the Qt-Event loop - */ - void HandleCrosshairPositionEvent(); - -protected: - - mitk::DataNode::Pointer GetTopLayerNode(mitk::DataStorage::SetOfObjects::ConstPointer nodes); + const mitk::Point3D GetCrossPosition(unsigned int widgetNumber) const; public slots: void ShowLevelWindowWidget(unsigned int widgetNumber, bool show); void ShowAllLevelWindowWidgets(bool show); - - /* + /** * @brief Set a background color gradient for a specific render window. * * If two different input colors are used, a gradient background is generated. * * @param upper The color of the gradient background. * @param lower The color of the gradient background. * @param widgetNumber The widget identifier. */ void SetBackgroundColorGradient(const mitk::Color& upper, const mitk::Color& lower, unsigned int widgetNumber); - /* + /** * @brief Set a background color gradient for all available render windows. * * If two different input colors are used, a gradient background is generated. * * @param upper The color of the gradient background. * @param lower The color of the gradient background. */ // #TODO: 'backgroundgradientcolor' void SetAllBackgroundColorGradients(const mitk::Color& upper, const mitk::Color& lower); void FillAllBackgroundColorGradientsWithBlack(); void ShowBackgroundColorGradient(unsigned int widgetNumber, bool show); void ShowAllBackgroundColorGradients(bool show); - /* + /** * @rief Return a render window (widget) specific background color gradient * * @param widgetNumber The widget identifier. * * @return A color gradient as a pair of colors. * First entry: upper color value * Second entry: lower color value */ std::pair GetBackgroundColorGradient(unsigned int widgetNumber) const; bool GetBackgroundColorGradientFlag(unsigned int widgetNumber) const; void SetDepartmentLogoPath(const char* path); void ShowDepartmentLogo(unsigned int widgetNumber, bool show); void ShowAllDepartmentLogos(bool show); void SetDecorationColor(unsigned int widgetNumber, const mitk::Color& color); mitk::Color GetDecorationColor(unsigned int widgetNumber) const; void ShowColoredRectangle(unsigned int widgetNumber, bool show); void ShowAllColoredRectangles(bool show); bool IsColoredRectangleVisible(unsigned int widgetNumber) const; void ShowCornerAnnotation(unsigned int widgetNumber, bool show); void ShowAllCornerAnnotations(bool show); bool IsCornerAnnotationVisible(unsigned int widgetNumber) const; void SetCornerAnnotationText(unsigned int widgetNumber, const std::string& cornerAnnotation); std::string GetCornerAnnotationText(unsigned int widgetNumber) const; - void ActivateRenderWindowMenu(unsigned int widgetNumber, bool state); - void ActivateAllRenderWindowMenus(bool state); - bool IsRenderWindowMenuActivated(unsigned int widgetNumber) const; - - void ShowGeometryPlanes(unsigned int widgetNumber, bool state); - void ShowAllGeometryPlanes(bool state); - mitk::DataNode::Pointer GetGeometryPlane(unsigned int widgetNumber, unsigned int planeNumber) const; - - - - - /// Receives the signal from HandleCrosshairPositionEvent, executes the StatusBar update + /** + * @brief Listener to the CrosshairPositionEvent + * + * Ensures the CrosshairPositionEvent is handled only once and at the end of the Qt-Event loop + */ + void HandleCrosshairPositionEvent(); + /** + * @brief Receives the signal from HandleCrosshairPositionEvent, executes the StatusBar update + * + */ void HandleCrosshairPositionEventDelayed(); void Fit(); - void wheelEvent(QWheelEvent *e) override; - - void mousePressEvent(QMouseEvent *e) override; - - void moveEvent(QMoveEvent *e) override; - void EnsureDisplayContainsPoint(mitk::BaseRenderer *renderer, const mitk::Point3D &p); - void MoveCrossToPosition(const mitk::Point3D &newPosition); + void MoveCrossToPosition(unsigned int widgetNumber, const mitk::Point3D& newPosition); - void SetWidgetPlanesLocked(bool locked); - - void SetWidgetPlanesRotationLocked(bool locked); - - void SetWidgetPlanesRotationLinked(bool link); - - void SetWidgetPlaneMode(int mode); - - void SetWidgetPlaneModeToSlicing(bool activate); + void ResetCrosshair(); - void SetWidgetPlaneModeToRotation(bool activate); + // mouse events + void wheelEvent(QWheelEvent *e) override; - void SetWidgetPlaneModeToSwivel(bool activate); + void mousePressEvent(QMouseEvent *e) override; - void ResetCrosshair(); + void moveEvent(QMoveEvent *e) override; signals: - void LeftMouseClicked(mitk::Point3D pointValue); void WheelMoved(QWheelEvent *); - void WidgetPlanesRotationLinked(bool); - void WidgetPlanesRotationEnabled(bool); - void ViewsInitialized(); - void WidgetPlaneModeSlicing(bool); - void WidgetPlaneModeRotation(bool); - void WidgetPlaneModeSwivel(bool); - void WidgetPlaneModeChange(int); - void WidgetNotifyNewCrossHairMode(int); void Moved(); public: - enum - { - PLANE_MODE_SLICING = 0, - PLANE_MODE_ROTATION, - PLANE_MODE_SWIVEL - }; - enum { AXIAL, SAGITTAL, CORONAL, THREE_D }; private: void InitializeGUI(); - void AddRenderWindowWidget(); void InitializeWidget(); + void AddRenderWindowWidget(); + + // #TODO: see T24173 + mitk::DataNode::Pointer GetTopLayerNode(mitk::DataStorage::SetOfObjects::ConstPointer nodes); QGridLayout* m_CustomMultiWidgetLayout; - std::map m_RenderWindowWidgets; + std::map m_RenderWindowWidgets; QmitkRenderWindowWidget* m_ActiveRenderWindowWidget; int m_PlaneMode; mitk::RenderingManager* m_RenderingManager; mitk::BaseRenderer::RenderingMode::Type m_RenderingMode; QString m_MultiWidgetName; - mitk::MouseModeSwitcher::Pointer m_MouseModeSwitcher; + //mitk::MouseModeSwitcher::Pointer m_MouseModeSwitcher; mitk::SliceNavigationController *m_TimeNavigationController; mitk::DataStorage::Pointer m_DataStorage; bool m_PendingCrosshairPositionEvent; bool m_CrosshairNavigationEnabled; }; #endif // QMITKCUSTOMMULTIWIDGET_H diff --git a/Modules/QtWidgets/include/QmitkRenderWindowWidget.h b/Modules/QtWidgets/include/QmitkRenderWindowWidget.h index 7dd2e58a05..18ad95ff2d 100644 --- a/Modules/QtWidgets/include/QmitkRenderWindowWidget.h +++ b/Modules/QtWidgets/include/QmitkRenderWindowWidget.h @@ -1,134 +1,117 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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. ===================================================================*/ #ifndef QMITKRENDERWINDOWWIDGET_H #define QMITKRENDERWINDOWWIDGET_H +// qt widgets module +#include "MitkQtWidgetsExports.h" +#include +#include + // mitk core #include #include //#include #include #include // annotations module #include -// qt widgets module -#include -#include -#include - // qt #include #include -/* +/** * @brief * * */ class MITKQTWIDGETS_EXPORT QmitkRenderWindowWidget : public QWidget { Q_OBJECT public: - QmitkRenderWindowWidget(QWidget* parent = nullptr, const std::string& UID = "", mitk::DataStorage* dataStorage = nullptr); + QmitkRenderWindowWidget(QWidget* parent = nullptr, const QString& UID = "", mitk::DataStorage* dataStorage = nullptr); ~QmitkRenderWindowWidget() override; void SetDataStorage(mitk::DataStorage* dataStorage); QmitkRenderWindow* GetRenderWindow() const { return m_RenderWindow; }; QmitkLevelWindowWidget* GetlevelWindowWidget() const { return m_LevelWindowWidget; }; mitk::SliceNavigationController* GetSliceNavigationController() const; void RequestUpdate(); void ForceImmediateUpdate(); // #TODO: 'backroundgradientcolor' void SetBackgroundColorGradient(const mitk::Color& upper, const mitk::Color& lower); void ShowBackgroundColorGradient(bool enable); std::pair GetRendererBackgroundColorGradient() const { return m_BackgroundColorGradient; }; bool GetBackgroundColorGradientFlag() const { return m_BackgroundColorGradientFlag; }; void ShowLevelWindowWidget(bool enable); void ShowDepartmentLogo(bool show); void SetDecorationColor(const mitk::Color& color); mitk::Color GetDecorationColor() const { return m_DecorationColor; }; void ShowColoredRectangle(bool show); bool IsColoredRectangleVisible() const; + void ShowCornerAnnotation(bool show); bool IsCornerAnnotationVisible() const; void SetCornerAnnotationText(const std::string& cornerAnnotation); std::string GetCornerAnnotationText() const; - /* + /** * @brief Create a corner annotation and a colored rectangle for this widget. * * @par text The text of the corner annotation. * @par color The color of the text and the rectangle. */ void SetDecorationProperties(std::string text, mitk::Color color); - void ActivateMenuWidget(bool state, QmitkCustomMultiWidget* multiWidget); bool IsRenderWindowMenuActivated() const; - void ShowGeometryPlanes(bool show); - mitk::DataNode::Pointer GetGeometryPlane(unsigned int planeNumber) const; - - void AddGeometryPlanesToDataStorage(); - void RemoveGeometryPlanesFromDataStorage(); - private: void InitializeGUI(); - void InitializeGeometryPlanes(); void InitializeDecorations(); - std::string m_UID; + QString m_UID; QHBoxLayout* m_Layout; mitk::DataStorage* m_DataStorage; QmitkRenderWindow* m_RenderWindow; QmitkLevelWindowWidget* m_LevelWindowWidget; mitk::RenderingManager* m_RenderingManager; mitk::BaseRenderer::RenderingMode::Type m_RenderingMode; + mitk::SliceNavigationController *m_TimeNavigationController; std::pair m_BackgroundColorGradient; bool m_BackgroundColorGradientFlag; mitk::LogoAnnotation::Pointer m_LogoAnnotation; mitk::Color m_DecorationColor; vtkSmartPointer m_RectangleProp; vtkSmartPointer m_CornerAnnotation; - - /* - * @brief The 3 helper objects which contain the plane geometry (crosshair and 3D planes). - */ - mitk::DataNode::Pointer m_GeometryPlane1; - mitk::DataNode::Pointer m_GeometryPlane2; - mitk::DataNode::Pointer m_GeometryPlane3; - /* - * @brief This helper object is added to the data storage as a parent node for the 3 geometry plane nodes. - */ - mitk::DataNode::Pointer m_GeometryPlanes; }; #endif // QMITKRENDERWINDOWWIDGET_H diff --git a/Modules/QtWidgets/src/QmitkCustomMultiWidget.cpp b/Modules/QtWidgets/src/QmitkCustomMultiWidget.cpp index c0e1888376..6ac6436a3f 100644 --- a/Modules/QtWidgets/src/QmitkCustomMultiWidget.cpp +++ b/Modules/QtWidgets/src/QmitkCustomMultiWidget.cpp @@ -1,829 +1,688 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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. ===================================================================*/ -#define SMW_INFO MITK_INFO("widget.custommulti") - #include "QmitkCustomMultiWidget.h" #include #include #include #include #include "mitkImagePixelReadAccessor.h" #include "mitkPixelTypeMultiplex.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include // qt #include -QmitkCustomMultiWidget::QmitkCustomMultiWidget(QWidget* parent, Qt::WindowFlags f, mitk::RenderingManager* renderingManager, mitk::BaseRenderer::RenderingMode::Type renderingMode, const QString& multWidgetName) +QmitkCustomMultiWidget::QmitkCustomMultiWidget(QWidget* parent, + Qt::WindowFlags f/* = 0*/, + mitk::RenderingManager* renderingManager/* = nullptr*/, + mitk::BaseRenderer::RenderingMode::Type renderingMode/* = mitk::BaseRenderer::RenderingMode::Standard*/, + const QString& multiWidgetName/* = "custommulti"*/) : QWidget(parent, f) , m_CustomMultiWidgetLayout(nullptr) - , m_PlaneMode(PLANE_MODE_SLICING) , m_RenderingManager(renderingManager) , m_RenderingMode(renderingMode) - , m_MultiWidgetName(multWidgetName) + , m_MultiWidgetName(multiWidgetName) , m_TimeNavigationController(nullptr) , m_PendingCrosshairPositionEvent(false) , m_CrosshairNavigationEnabled(false) { if (nullptr == m_RenderingManager) { m_RenderingManager = mitk::RenderingManager::GetInstance(); } m_TimeNavigationController = m_RenderingManager->GetTimeNavigationController(); // create widget manually // create and set layout InitializeGUI(); // create at least one render window initially AddRenderWindowWidget(); resize(QSize(364, 477).expandedTo(minimumSizeHint())); InitializeWidget(); - ActivateAllRenderWindowMenus(true); } QmitkCustomMultiWidget::~QmitkCustomMultiWidget() { for (const auto& mapEntry : m_RenderWindowWidgets) { m_TimeNavigationController->Disconnect(mapEntry.second->GetRenderWindow()->GetSliceNavigationController()); } } void QmitkCustomMultiWidget::SetDataStorage(mitk::DataStorage* dataStorage) { if (dataStorage == m_DataStorage) { return; } m_DataStorage = dataStorage; for (const auto& renderWindowWidget : m_RenderWindowWidgets) { renderWindowWidget.second->SetDataStorage(m_DataStorage); } } -std::map QmitkCustomMultiWidget::GetRenderWindowWidgets() const +std::map QmitkCustomMultiWidget::GetRenderWindowWidgets() const { return m_RenderWindowWidgets; } -QmitkRenderWindowWidget* QmitkCustomMultiWidget::GetRenderWindowWidget(unsigned int id) const +QmitkRenderWindowWidget* QmitkCustomMultiWidget::GetRenderWindowWidget(unsigned int widgetNumber) const { - return m_RenderWindowWidgets.find(std::to_string(id))->second; + return m_RenderWindowWidgets.find(QString::number(widgetNumber))->second; } QmitkRenderWindowWidget* QmitkCustomMultiWidget::GetActiveRenderWindowWidget() const { return m_ActiveRenderWindowWidget; } QmitkRenderWindowWidget* QmitkCustomMultiWidget::GetFirstRenderWindowWidget() const { return m_RenderWindowWidgets.begin()->second; } QmitkRenderWindowWidget* QmitkCustomMultiWidget::GetLastRenderWindowWidget() const { return m_RenderWindowWidgets.rbegin()->second; } unsigned int QmitkCustomMultiWidget::GetNumberOfRenderWindowWidgets() const { return m_RenderWindowWidgets.size(); } -void QmitkCustomMultiWidget::InitializeWidget() -{ - // #TODO: some things have to be handled globally (hold for all render window (widgets) - // analyse those things and design a controlling mechanism - - // Set plane mode (slicing/rotation behavior) to slicing (default) - m_PlaneMode = PLANE_MODE_SLICING; - - m_MouseModeSwitcher = mitk::MouseModeSwitcher::New(); - - // setup the department logo rendering - /* - m_LogoRendering = mitk::LogoOverlay::New(); - mitk::BaseRenderer::Pointer renderer4 = mitk::BaseRenderer::GetInstance(mitkWidget4->GetRenderWindow()); - m_LogoRendering->SetOpacity(0.5); - mitk::Point2D offset; - offset.Fill(0.03); - m_LogoRendering->SetOffsetVector(offset); - m_LogoRendering->SetRelativeSize(0.15); - m_LogoRendering->SetCornerPosition(1); - m_LogoRendering->SetLogoImagePath("DefaultLogo"); - renderer4->GetOverlayManager()->AddOverlay(m_LogoRendering.GetPointer(), renderer4); - */ -} - -const mitk::Point3D QmitkCustomMultiWidget::GetCrossPosition() const -{ - /* - const mitk::PlaneGeometry *plane1 = mitkWidget1->GetSliceNavigationController()->GetCurrentPlaneGeometry(); - const mitk::PlaneGeometry *plane2 = mitkWidget2->GetSliceNavigationController()->GetCurrentPlaneGeometry(); - const mitk::PlaneGeometry *plane3 = mitkWidget3->GetSliceNavigationController()->GetCurrentPlaneGeometry(); - - mitk::Line3D line; - if ((plane1 != NULL) && (plane2 != NULL) && (plane1->IntersectionLine(plane2, line))) - { - mitk::Point3D point; - if ((plane3 != NULL) && (plane3->IntersectionPoint(line, point))) - { - return point; - } - } - // TODO BUG POSITIONTRACKER; - mitk::Point3D p; - return p; - // return m_LastLeftClickPositionSupplier->GetCurrentPoint(); - */ - return mitk::Point3D(); -} - void QmitkCustomMultiWidget::RequestUpdate(unsigned int widgetNumber) { GetRenderWindowWidget(widgetNumber)->RequestUpdate(); } void QmitkCustomMultiWidget::RequestUpdateAll() { // #TODO: Update only render windows that show the same image? // #TODO: Update only type specific render windows (2D / 3D)? size_t numberOfRenderWindowWidgets = m_RenderWindowWidgets.size(); for (size_t i = 0; i < numberOfRenderWindowWidgets; ++i) { RequestUpdate(i); } } void QmitkCustomMultiWidget::ForceImmediateUpdate(unsigned int widgetNumber) { GetRenderWindowWidget(widgetNumber)->ForceImmediateUpdate(); } void QmitkCustomMultiWidget::ForceImmediateUpdateAll() { // #TODO: Update only render windows that show the same image? // #TODO: Update only type specific render windows (2D / 3D)? size_t numberOfRenderWindowWidgets = m_RenderWindowWidgets.size(); for (size_t i = 0; i < numberOfRenderWindowWidgets; ++i) { ForceImmediateUpdate(i); } } -void QmitkCustomMultiWidget::EnsureDisplayContainsPoint(mitk::BaseRenderer *renderer, const mitk::Point3D &p) +const mitk::Point3D QmitkCustomMultiWidget::GetCrossPosition(unsigned int widgetNumber) const { - mitk::Point2D pointOnDisplay; - renderer->WorldToDisplay(p, pointOnDisplay); - - if (pointOnDisplay[0] < renderer->GetVtkRenderer()->GetOrigin()[0] || - pointOnDisplay[1] < renderer->GetVtkRenderer()->GetOrigin()[1] || - pointOnDisplay[0] > renderer->GetVtkRenderer()->GetOrigin()[0] + renderer->GetViewportSize()[0] || - pointOnDisplay[1] > renderer->GetVtkRenderer()->GetOrigin()[1] + renderer->GetViewportSize()[1]) - { - mitk::Point2D pointOnPlane; - renderer->GetCurrentWorldPlaneGeometry()->Map(p, pointOnPlane); - renderer->GetCameraController()->MoveCameraToPoint(pointOnPlane); - } -} - -void QmitkCustomMultiWidget::MoveCrossToPosition(const mitk::Point3D &newPosition) -{ - GetRenderWindow()->GetSliceNavigationController()->SelectSliceByPoint(newPosition); - - m_RenderingManager->RequestUpdateAll(); -} - -void QmitkCustomMultiWidget::HandleCrosshairPositionEvent() -{ - if (!m_PendingCrosshairPositionEvent) - { - m_PendingCrosshairPositionEvent = true; - QTimer::singleShot(0, this, SLOT(HandleCrosshairPositionEventDelayed())); - } -} - -mitk::DataNode::Pointer QmitkCustomMultiWidget::GetTopLayerNode(mitk::DataStorage::SetOfObjects::ConstPointer nodes) -{ - mitk::Point3D crosshairPos = GetCrossPosition(); - mitk::DataNode::Pointer node; - int maxlayer = -32768; - - if (nodes.IsNotNull()) - { - mitk::BaseRenderer *baseRenderer = GetRenderWindow()->GetSliceNavigationController()->GetRenderer(); - // find node with largest layer, that is the node shown on top in the render window - for (unsigned int x = 0; x < nodes->size(); x++) - { - if ((nodes->at(x)->GetData()->GetGeometry() != NULL) && - nodes->at(x)->GetData()->GetGeometry()->IsInside(crosshairPos)) - { - int layer = 0; - if (!(nodes->at(x)->GetIntProperty("layer", layer))) - { - continue; - } - if (layer > maxlayer) - { - if (static_cast(nodes->at(x))->IsVisible(baseRenderer)) - { - node = nodes->at(x); - maxlayer = layer; - } - } - } - } - } - return node; -} - -void QmitkCustomMultiWidget::HandleCrosshairPositionEventDelayed() -{ - m_PendingCrosshairPositionEvent = false; - - // find image with highest layer - mitk::TNodePredicateDataType::Pointer isImageData = mitk::TNodePredicateDataType::New(); - mitk::DataStorage::SetOfObjects::ConstPointer nodes = this->m_DataStorage->GetSubset(isImageData).GetPointer(); - - mitk::DataNode::Pointer node; - mitk::DataNode::Pointer topSourceNode; - mitk::Image::Pointer image; - bool isBinary = false; - node = this->GetTopLayerNode(nodes); - int component = 0; - if (node.IsNotNull()) - { - node->GetBoolProperty("binary", isBinary); - if (isBinary) - { - mitk::DataStorage::SetOfObjects::ConstPointer sourcenodes = m_DataStorage->GetSources(node, NULL, true); - if (!sourcenodes->empty()) - { - topSourceNode = this->GetTopLayerNode(sourcenodes); - } - if (topSourceNode.IsNotNull()) - { - image = dynamic_cast(topSourceNode->GetData()); - topSourceNode->GetIntProperty("Image.Displayed Component", component); - } - else - { - image = dynamic_cast(node->GetData()); - node->GetIntProperty("Image.Displayed Component", component); - } - } - else - { - image = dynamic_cast(node->GetData()); - node->GetIntProperty("Image.Displayed Component", component); - } - } - - mitk::Point3D crosshairPos = this->GetCrossPosition(); - std::string statusText; - std::stringstream stream; - itk::Index<3> p; - mitk::BaseRenderer *baseRenderer = GetRenderWindow()->GetSliceNavigationController()->GetRenderer(); - unsigned int timestep = baseRenderer->GetTimeStep(); + /* + const mitk::PlaneGeometry *plane1 = mitkWidget1->GetSliceNavigationController()->GetCurrentPlaneGeometry(); + const mitk::PlaneGeometry *plane2 = mitkWidget2->GetSliceNavigationController()->GetCurrentPlaneGeometry(); + const mitk::PlaneGeometry *plane3 = mitkWidget3->GetSliceNavigationController()->GetCurrentPlaneGeometry(); - if (image.IsNotNull() && (image->GetTimeSteps() > timestep)) + mitk::Line3D line; + if ((plane1 != NULL) && (plane2 != NULL) && (plane1->IntersectionLine(plane2, line))) { - image->GetGeometry()->WorldToIndex(crosshairPos, p); - stream.precision(2); - stream << "Position: <" << std::fixed << crosshairPos[0] << ", " << std::fixed << crosshairPos[1] << ", " - << std::fixed << crosshairPos[2] << "> mm"; - stream << "; Index: <" << p[0] << ", " << p[1] << ", " << p[2] << "> "; - - mitk::ScalarType pixelValue; - - mitkPixelTypeMultiplex5(mitk::FastSinglePixelAccess, - image->GetChannelDescriptor().GetPixelType(), - image, - image->GetVolumeData(baseRenderer->GetTimeStep()), - p, - pixelValue, - component); - - if (fabs(pixelValue) > 1000000 || fabs(pixelValue) < 0.01) - { - stream << "; Time: " << baseRenderer->GetTime() << " ms; Pixelvalue: " << std::scientific << pixelValue << " "; - } - else - { - stream << "; Time: " << baseRenderer->GetTime() << " ms; Pixelvalue: " << pixelValue << " "; - } - } - else + mitk::Point3D point; + if ((plane3 != NULL) && (plane3->IntersectionPoint(line, point))) { - stream << "No image information at this position!"; + return point; } - - statusText = stream.str(); - mitk::StatusBar::GetInstance()->DisplayGreyValueText(statusText.c_str()); -} - -void QmitkCustomMultiWidget::Fit() -{ - vtkSmartPointer vtkrenderer; - size_t numberOfRenderWindowWidgets = m_RenderWindowWidgets.size(); - for (size_t i = 0; i < numberOfRenderWindowWidgets; ++i) - { - vtkRenderer* renderer = GetRenderWindow(widgetNumber)->GetRenderer()->GetVtkRenderer(); - mitk::BaseRenderer* baseRenderer = mitk::BaseRenderer::GetInstance(GetRenderWindow(i)->GetRenderWindow()); - vtkrenderer = baseRenderer->GetVtkRenderer(); - if (nullptr != vtkrenderer) - { - vtkrenderer->ResetCamera(); - } - - baseRenderer->GetCameraController()->Fit(); } - - - - int w = vtkObject::GetGlobalWarningDisplay(); - vtkObject::GlobalWarningDisplayOff(); - vtkObject::SetGlobalWarningDisplay(w); + // TODO BUG POSITIONTRACKER; + mitk::Point3D p; + return p; + // return m_LastLeftClickPositionSupplier->GetCurrentPoint(); + */ + return mitk::Point3D(); } ////////////////////////////////////////////////////////////////////////// // PUBLIC SLOTS ////////////////////////////////////////////////////////////////////////// // TODO: Use widget directly instead of number? void QmitkCustomMultiWidget::ShowLevelWindowWidget(unsigned int widgetNumber, bool show) { if (widgetNumber > m_RenderWindowWidgets.size()) { MITK_ERROR << "Level window widget can not be shown for an unknown widget."; return; } GetRenderWindowWidget(widgetNumber)->ShowLevelWindowWidget(show); } // TODO: Use foreach on widgets map instead of iterator i and "widget number"? void QmitkCustomMultiWidget::ShowAllLevelWindowWidgets(bool show) { size_t numberOfRenderWindowWidgets = m_RenderWindowWidgets.size(); for (size_t i = 0; i < numberOfRenderWindowWidgets; ++i) { ShowLevelWindowWidget(i, show); } } void QmitkCustomMultiWidget::SetBackgroundColorGradient(const mitk::Color& upper, const mitk::Color& lower, unsigned int widgetNumber) { if (widgetNumber > m_RenderWindowWidgets.size()) { MITK_ERROR << "Background color gradient can not be set for an unknown widget."; return; } GetRenderWindowWidget(widgetNumber)->SetBackgroundColorGradient(upper, lower); } void QmitkCustomMultiWidget::SetAllBackgroundColorGradients(const mitk::Color& upper, const mitk::Color& lower) { size_t numberOfRenderWindowWidgets = m_RenderWindowWidgets.size(); for (size_t i = 0; i < numberOfRenderWindowWidgets; ++i) { SetBackgroundColorGradient(upper, lower, i); } } void QmitkCustomMultiWidget::FillAllBackgroundColorGradientsWithBlack() { float black[3] = { 0.0f, 0.0f, 0.0f }; SetAllBackgroundColorGradients(black, black); } void QmitkCustomMultiWidget::ShowBackgroundColorGradient(unsigned int widgetNumber, bool show) { if (widgetNumber > m_RenderWindowWidgets.size()) { MITK_ERROR << "Background color gradient can not be shown for an unknown widget."; return; } GetRenderWindowWidget(widgetNumber)->ShowBackgroundColorGradient(show); } void QmitkCustomMultiWidget::ShowAllBackgroundColorGradients(bool show) { size_t numberOfRenderWindowWidgets = m_RenderWindowWidgets.size(); for (size_t i = 0; i < numberOfRenderWindowWidgets; ++i) { ShowBackgroundColorGradient(i, show); } } std::pair QmitkCustomMultiWidget::GetBackgroundColorGradient(unsigned int widgetNumber) const { if (widgetNumber > m_RenderWindowWidgets.size()) { MITK_ERROR << "Background color gradient can not be retrieved for an unknown widget. Returning black color pair."; float black[3] = { 0.0f, 0.0f, 0.0f }; return std::make_pair(mitk::Color(black), mitk::Color(black)); } return GetRenderWindowWidget(widgetNumber)->GetRendererBackgroundColorGradient(); } bool QmitkCustomMultiWidget::GetBackgroundColorGradientFlag(unsigned int widgetNumber) const { if (widgetNumber > m_RenderWindowWidgets.size()) { MITK_ERROR << "Background color gradient flag can not be retrieved for an unknown widget. Returning 'false'."; return false; } return GetRenderWindowWidget(widgetNumber)->GetBackgroundColorGradientFlag(); } void QmitkCustomMultiWidget::SetDepartmentLogoPath(const char* path) { /* old m_LogoRendering->SetLogoImagePath(path); mitk::BaseRenderer *renderer = mitk::BaseRenderer::GetInstance(mitkWidget4->GetRenderWindow()); m_LogoRendering->Update(renderer); RequestUpdate(); */ /* new QImage* qimage = new QImage(path); vtkSmartPointer qImageToVtk; qImageToVtk = vtkSmartPointer::New(); qImageToVtk->SetQImage(qimage); qImageToVtk->Update(); m_LogoRendering->SetLogoImage(qImageToVtk->GetOutput()); mitk::BaseRenderer *renderer = mitk::BaseRenderer::GetInstance(mitkWidget4->GetRenderWindow()); m_LogoRendering->Update(renderer); RequestUpdate(); */ } void QmitkCustomMultiWidget::ShowDepartmentLogo(unsigned int widgetNumber, bool show) { if (widgetNumber > m_RenderWindowWidgets.size()) { MITK_ERROR << "Department logo can not be shown for an unknown widget."; return; } GetRenderWindowWidget(widgetNumber)->ShowDepartmentLogo(show); RequestUpdate(widgetNumber); } void QmitkCustomMultiWidget::ShowAllDepartmentLogos(bool show) { size_t numberOfRenderWindowWidgets = m_RenderWindowWidgets.size(); for (size_t i = 0; i < numberOfRenderWindowWidgets; ++i) { ShowDepartmentLogo(i, show); } } void QmitkCustomMultiWidget::SetDecorationColor(unsigned int widgetNumber, const mitk::Color& color) { // #TODO: change specific plane color of a render window widget (parameter: unsigned int planeNumber)? if (widgetNumber > m_RenderWindowWidgets.size()) { MITK_ERROR << "Decoration color can not be set for an unknown widget."; return; } GetRenderWindowWidget(widgetNumber)->SetDecorationColor(color); } mitk::Color QmitkCustomMultiWidget::GetDecorationColor(unsigned int widgetNumber) const { if (widgetNumber > m_RenderWindowWidgets.size()) { MITK_ERROR << "Decoration color can not be retrieved for an unknown widget. Returning black color!"; float black[3] = { 0.0f, 0.0f, 0.0f }; return mitk::Color(black); } return GetRenderWindowWidget(widgetNumber)->GetDecorationColor(); } void QmitkCustomMultiWidget::ShowColoredRectangle(unsigned int widgetNumber, bool show) { if (widgetNumber > m_RenderWindowWidgets.size()) { MITK_ERROR << "Colored rectangle can not be set for an unknown widget."; return; } GetRenderWindowWidget(widgetNumber)->ShowColoredRectangle(show); } void QmitkCustomMultiWidget::ShowAllColoredRectangles(bool show) { size_t numberOfRenderWindowWidgets = m_RenderWindowWidgets.size(); for (size_t i = 0; i < numberOfRenderWindowWidgets; ++i) { ShowColoredRectangle(i, show); } } bool QmitkCustomMultiWidget::IsColoredRectangleVisible(unsigned int widgetNumber) const { if (widgetNumber > m_RenderWindowWidgets.size()) { MITK_ERROR << "Colored rectangle visibility can not be retrieved for an unknown widget. Returning 'false'."; return false; } return GetRenderWindowWidget(widgetNumber)->IsColoredRectangleVisible(); } void QmitkCustomMultiWidget::SetCornerAnnotationText(unsigned int widgetNumber, const std::string& cornerAnnotation) { if (widgetNumber > m_RenderWindowWidgets.size()) { MITK_ERROR << "Corner annotation text can not be retrieved for an unknown widget."; return; } GetRenderWindowWidget(widgetNumber)->SetCornerAnnotationText(cornerAnnotation); } std::string QmitkCustomMultiWidget::GetCornerAnnotationText(unsigned int widgetNumber) const { if (widgetNumber > m_RenderWindowWidgets.size()) { MITK_ERROR << "Corner annotation text can not be retrieved for an unknown widget."; return ""; } return GetRenderWindowWidget(widgetNumber)->GetCornerAnnotationText(); } void QmitkCustomMultiWidget::ShowCornerAnnotation(unsigned int widgetNumber, bool show) { if (widgetNumber > m_RenderWindowWidgets.size()) { MITK_ERROR << "Corner annotation can not be set for an unknown widget."; return; } GetRenderWindowWidget(widgetNumber)->ShowCornerAnnotation(show); } void QmitkCustomMultiWidget::ShowAllCornerAnnotations(bool show) { size_t numberOfRenderWindowWidgets = m_RenderWindowWidgets.size(); for (size_t i = 0; i < numberOfRenderWindowWidgets; ++i) { ShowCornerAnnotation(i, show); } } bool QmitkCustomMultiWidget::IsCornerAnnotationVisible(unsigned int widgetNumber) const { if (widgetNumber > m_RenderWindowWidgets.size()) { MITK_ERROR << "Corner annotation visibility can not be retrieved for an unknown widget. Returning 'false'."; return false; } return GetRenderWindowWidget(widgetNumber)->IsCornerAnnotationVisible(); } -void QmitkCustomMultiWidget::ActivateRenderWindowMenu(unsigned int widgetNumber, bool state) +void QmitkCustomMultiWidget::HandleCrosshairPositionEvent() { - if (widgetNumber > m_RenderWindowWidgets.size()) + /* + if (!m_PendingCrosshairPositionEvent) { - MITK_ERROR << "Level window widget can not be shown for an unknown widget."; - return; + m_PendingCrosshairPositionEvent = true; + QTimer::singleShot(0, this, SLOT(HandleCrosshairPositionEventDelayed())); } - - GetRenderWindowWidget(widgetNumber)->ActivateMenuWidget(state, this); + */ } -void QmitkCustomMultiWidget::ActivateAllRenderWindowMenus(bool state) +void QmitkCustomMultiWidget::HandleCrosshairPositionEventDelayed() { - size_t numberOfRenderWindowWidgets = m_RenderWindowWidgets.size(); - for (size_t i = 0; i < numberOfRenderWindowWidgets; ++i) + /* + m_PendingCrosshairPositionEvent = false; + + // find image with highest layer + mitk::TNodePredicateDataType::Pointer isImageData = mitk::TNodePredicateDataType::New(); + mitk::DataStorage::SetOfObjects::ConstPointer nodes = this->m_DataStorage->GetSubset(isImageData).GetPointer(); + + mitk::DataNode::Pointer node; + mitk::DataNode::Pointer topSourceNode; + mitk::Image::Pointer image; + bool isBinary = false; + node = this->GetTopLayerNode(nodes); + int component = 0; + if (node.IsNotNull()) { - ActivateRenderWindowMenu(i, state); + node->GetBoolProperty("binary", isBinary); + if (isBinary) + { + mitk::DataStorage::SetOfObjects::ConstPointer sourcenodes = m_DataStorage->GetSources(node, NULL, true); + if (!sourcenodes->empty()) + { + topSourceNode = this->GetTopLayerNode(sourcenodes); + } + if (topSourceNode.IsNotNull()) + { + image = dynamic_cast(topSourceNode->GetData()); + topSourceNode->GetIntProperty("Image.Displayed Component", component); + } + else + { + image = dynamic_cast(node->GetData()); + node->GetIntProperty("Image.Displayed Component", component); + } + } + else + { + image = dynamic_cast(node->GetData()); + node->GetIntProperty("Image.Displayed Component", component); + } } -} -bool QmitkCustomMultiWidget::IsRenderWindowMenuActivated(unsigned int widgetNumber) const -{ - if (widgetNumber > m_RenderWindowWidgets.size()) + mitk::Point3D crosshairPos = this->GetCrossPosition(); + std::string statusText; + std::stringstream stream; + itk::Index<3> p; + mitk::BaseRenderer *baseRenderer = GetRenderWindow()->GetSliceNavigationController()->GetRenderer(); + unsigned int timestep = baseRenderer->GetTimeStep(); + + if (image.IsNotNull() && (image->GetTimeSteps() > timestep)) { - MITK_ERROR << "Render window menu activation status can not be retrieved for an unknown widget. Returning 'false'."; - return false; - } + image->GetGeometry()->WorldToIndex(crosshairPos, p); + stream.precision(2); + stream << "Position: <" << std::fixed << crosshairPos[0] << ", " << std::fixed << crosshairPos[1] << ", " + << std::fixed << crosshairPos[2] << "> mm"; + stream << "; Index: <" << p[0] << ", " << p[1] << ", " << p[2] << "> "; - return GetRenderWindowWidget(widgetNumber)->IsRenderWindowMenuActivated(); -} + mitk::ScalarType pixelValue; -void QmitkCustomMultiWidget::ShowGeometryPlanes(unsigned int widgetNumber, bool state) -{ - if (widgetNumber > m_RenderWindowWidgets.size()) + mitkPixelTypeMultiplex5(mitk::FastSinglePixelAccess, + image->GetChannelDescriptor().GetPixelType(), + image, + image->GetVolumeData(baseRenderer->GetTimeStep()), + p, + pixelValue, + component); + + if (fabs(pixelValue) > 1000000 || fabs(pixelValue) < 0.01) + { + stream << "; Time: " << baseRenderer->GetTime() << " ms; Pixelvalue: " << std::scientific << pixelValue << " "; + } + else + { + stream << "; Time: " << baseRenderer->GetTime() << " ms; Pixelvalue: " << pixelValue << " "; + } + } + else { - MITK_ERROR << "Geometry plane can not be shown for an unknown widget."; - return; + stream << "No image information at this position!"; } - return GetRenderWindowWidget(widgetNumber)->ShowGeometryPlanes(state); + statusText = stream.str(); + mitk::StatusBar::GetInstance()->DisplayGreyValueText(statusText.c_str()); + */ } -void QmitkCustomMultiWidget::ShowAllGeometryPlanes(bool state) +void QmitkCustomMultiWidget::Fit() { + // #TODO: what is this function's purpose? + + /* + vtkSmartPointer vtkrenderer; size_t numberOfRenderWindowWidgets = m_RenderWindowWidgets.size(); for (size_t i = 0; i < numberOfRenderWindowWidgets; ++i) { - ShowGeometryPlanes(i, state); - } -} - -mitk::DataNode::Pointer QmitkCustomMultiWidget::GetGeometryPlane(unsigned int widgetNumber, unsigned int planeNumber) const -{ - if (widgetNumber > m_RenderWindowWidgets.size()) + vtkRenderer* renderer = GetRenderWindow(widgetNumber)->GetRenderer()->GetVtkRenderer(); + mitk::BaseRenderer* baseRenderer = mitk::BaseRenderer::GetInstance(GetRenderWindow(i)->GetRenderWindow()); + vtkrenderer = baseRenderer->GetVtkRenderer(); + if (nullptr != vtkrenderer) { - MITK_ERROR << "Geometry plane can not be received for an unknown widget."; - return nullptr; + vtkrenderer->ResetCamera(); } - return GetRenderWindowWidget(widgetNumber)->GetGeometryPlane(planeNumber); -} - - - -void QmitkCustomMultiWidget::wheelEvent(QWheelEvent *e) -{ - emit WheelMoved(e); -} - -void QmitkCustomMultiWidget::mousePressEvent(QMouseEvent *e) -{ -} - -void QmitkCustomMultiWidget::moveEvent(QMoveEvent *e) -{ - QWidget::moveEvent(e); - - // it is necessary to readjust the position of the overlays as the StdMultiWidget has moved - // unfortunately it's not done by QmitkRenderWindow::moveEvent -> must be done here - emit Moved(); -} - -void QmitkCustomMultiWidget::SetWidgetPlanesLocked(bool locked) -{ - GetRenderWindow()->GetSliceNavigationController()->SetSliceLocked(locked); -} - -void QmitkCustomMultiWidget::SetWidgetPlanesRotationLocked(bool locked) -{ - GetRenderWindow()->GetSliceNavigationController()->SetSliceRotationLocked(locked); -} + baseRenderer->GetCameraController()->Fit(); + } -void QmitkCustomMultiWidget::SetWidgetPlanesRotationLinked(bool link) -{ - emit WidgetPlanesRotationLinked(link); + int w = vtkObject::GetGlobalWarningDisplay(); + vtkObject::GlobalWarningDisplayOff(); + vtkObject::SetGlobalWarningDisplay(w); + */ } -void QmitkCustomMultiWidget::SetWidgetPlaneMode(int userMode) +void QmitkCustomMultiWidget::EnsureDisplayContainsPoint(mitk::BaseRenderer *renderer, const mitk::Point3D &p) { - MITK_DEBUG << "Changing crosshair mode to " << userMode; + // #TODO: what is this function's purpose? - emit WidgetNotifyNewCrossHairMode(userMode); - // Convert user interface mode to actual mode - { - switch (userMode) - { - case 0: - m_MouseModeSwitcher->SetInteractionScheme(mitk::MouseModeSwitcher::InteractionScheme::MITK); - break; - case 1: - m_MouseModeSwitcher->SetInteractionScheme(mitk::MouseModeSwitcher::InteractionScheme::ROTATION); - break; - case 2: - m_MouseModeSwitcher->SetInteractionScheme(mitk::MouseModeSwitcher::InteractionScheme::ROTATIONLINKED); - break; - case 3: - m_MouseModeSwitcher->SetInteractionScheme(mitk::MouseModeSwitcher::InteractionScheme::SWIVEL); - break; - } - } -} + /* + mitk::Point2D pointOnDisplay; + renderer->WorldToDisplay(p, pointOnDisplay); -void QmitkCustomMultiWidget::SetWidgetPlaneModeToSlicing(bool activate) -{ - if (activate) + if (pointOnDisplay[0] < renderer->GetVtkRenderer()->GetOrigin()[0] || + pointOnDisplay[1] < renderer->GetVtkRenderer()->GetOrigin()[1] || + pointOnDisplay[0] > renderer->GetVtkRenderer()->GetOrigin()[0] + renderer->GetViewportSize()[0] || + pointOnDisplay[1] > renderer->GetVtkRenderer()->GetOrigin()[1] + renderer->GetViewportSize()[1]) { - SetWidgetPlaneMode(PLANE_MODE_SLICING); + mitk::Point2D pointOnPlane; + renderer->GetCurrentWorldPlaneGeometry()->Map(p, pointOnPlane); + renderer->GetCameraController()->MoveCameraToPoint(pointOnPlane); } + */ } -void QmitkCustomMultiWidget::SetWidgetPlaneModeToRotation(bool activate) +void QmitkCustomMultiWidget::MoveCrossToPosition(unsigned int widgetNumber, const mitk::Point3D& newPosition) { - if (activate) + if (widgetNumber > m_RenderWindowWidgets.size()) { - SetWidgetPlaneMode(PLANE_MODE_ROTATION); + MITK_ERROR << "Geometry plane can not be shown for an unknown widget."; + return; } -} -void QmitkCustomMultiWidget::SetWidgetPlaneModeToSwivel(bool activate) -{ - if (activate) - { - SetWidgetPlaneMode(PLANE_MODE_SWIVEL); - } + GetRenderWindowWidget(widgetNumber)->GetSliceNavigationController()->SelectSliceByPoint(newPosition); + GetRenderWindowWidget(widgetNumber)->RequestUpdate(); } void QmitkCustomMultiWidget::ResetCrosshair() { + // #TODO: new concept: we do not want to initialize all views; + // we do not want to rely on the geometry planes + /* if (m_DataStorage.IsNotNull()) { m_RenderingManager->InitializeViewsByBoundingObjects(m_DataStorage); // m_RenderingManager->InitializeViews( m_DataStorage->ComputeVisibleBoundingGeometry3D() ); // reset interactor to normal slicing SetWidgetPlaneMode(PLANE_MODE_SLICING); } + */ +} + +////////////////////////////////////////////////////////////////////////// +// MOUSE EVENTS +////////////////////////////////////////////////////////////////////////// +void QmitkCustomMultiWidget::wheelEvent(QWheelEvent *e) +{ + emit WheelMoved(e); +} + +void QmitkCustomMultiWidget::mousePressEvent(QMouseEvent *e) +{ } -mitk::MouseModeSwitcher* QmitkCustomMultiWidget::GetMouseModeSwitcher() +void QmitkCustomMultiWidget::moveEvent(QMoveEvent *e) { - return m_MouseModeSwitcher; + QWidget::moveEvent(e); + + // it is necessary to readjust the position of the overlays as the StdMultiWidget has moved + // unfortunately it's not done by QmitkRenderWindow::moveEvent -> must be done here + emit Moved(); } + +////////////////////////////////////////////////////////////////////////// +// PRIVATE +////////////////////////////////////////////////////////////////////////// void QmitkCustomMultiWidget::InitializeGUI() { m_CustomMultiWidgetLayout = new QGridLayout(this); m_CustomMultiWidgetLayout->setContentsMargins(0, 0, 0, 0); setLayout(m_CustomMultiWidgetLayout); } +void QmitkCustomMultiWidget::InitializeWidget() +{ + // #TODO: some things have to be handled globally (hold for all render window (widgets) + // analyse those things and design a controlling mechanism + + // setup the department logo rendering + /* + m_LogoRendering = mitk::LogoOverlay::New(); + mitk::BaseRenderer::Pointer renderer4 = mitk::BaseRenderer::GetInstance(mitkWidget4->GetRenderWindow()); + m_LogoRendering->SetOpacity(0.5); + mitk::Point2D offset; + offset.Fill(0.03); + m_LogoRendering->SetOffsetVector(offset); + m_LogoRendering->SetRelativeSize(0.15); + m_LogoRendering->SetCornerPosition(1); + m_LogoRendering->SetLogoImagePath("DefaultLogo"); + renderer4->GetOverlayManager()->AddOverlay(m_LogoRendering.GetPointer(), renderer4); + */ +} + void QmitkCustomMultiWidget::AddRenderWindowWidget() { // #TODO: add QSplitter? // #TODO: include technique, to set the image to level-slide on using the render window manager // create the render window widget and connect signals / slots - std::string UID = "UID"; + QString UID = m_MultiWidgetName + "UID"; QmitkRenderWindowWidget* renderWindowWidget = new QmitkRenderWindowWidget(this, UID, m_DataStorage); // create connections connect(renderWindowWidget, SIGNAL(ResetView()), this, SLOT(ResetCrosshair())); connect(renderWindowWidget, SIGNAL(ChangeCrosshairRotationMode(int)), this, SLOT(SetWidgetPlaneMode(int))); - connect(this, SIGNAL(WidgetNotifyNewCrossHairMode(int)), renderWindowWidget, SLOT(OnWidgetPlaneModeChanged(int))); // store the newly created render window widget with the UID - m_RenderWindowWidgets.insert(std::pair(UID, renderWindowWidget)); + m_RenderWindowWidgets.insert(std::pair(UID, renderWindowWidget)); mitk::SliceNavigationController* sliceNavigationController = renderWindowWidget->GetSliceNavigationController(); if (nullptr != sliceNavigationController) { m_TimeNavigationController->ConnectGeometryTimeEvent(sliceNavigationController, false); sliceNavigationController->ConnectGeometryTimeEvent(m_TimeNavigationController, false); } // #TODO: define the grid cell to add the new render window widget // add the newly created render window widget to this multi widget m_CustomMultiWidgetLayout->addWidget(renderWindowWidget); } + +mitk::DataNode::Pointer QmitkCustomMultiWidget::GetTopLayerNode(mitk::DataStorage::SetOfObjects::ConstPointer nodes) +{ + // #TODO: see T24173 + return nodes->front(); +} diff --git a/Modules/QtWidgets/src/QmitkRenderWindowWidget.cpp b/Modules/QtWidgets/src/QmitkRenderWindowWidget.cpp index ee4ae2bef6..be9fa79b73 100644 --- a/Modules/QtWidgets/src/QmitkRenderWindowWidget.cpp +++ b/Modules/QtWidgets/src/QmitkRenderWindowWidget.cpp @@ -1,354 +1,240 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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. ===================================================================*/ #include "QmitkRenderWindowWidget.h" -// mitk core -#include - // vtk #include -QmitkRenderWindowWidget::QmitkRenderWindowWidget(QWidget* parent/* = nullptr*/, const std::string& UID/* = ""*/, mitk::DataStorage* dataStorage/* = nullptr*/) +// qt widgets module +#include + +QmitkRenderWindowWidget::QmitkRenderWindowWidget(QWidget* parent/* = nullptr*/, const QString& UID/* = ""*/, mitk::DataStorage* dataStorage/* = nullptr*/) : QWidget(parent) , m_UID(UID) , m_DataStorage(dataStorage) , m_RenderWindow(nullptr) , m_LevelWindowWidget(nullptr) { InitializeGUI(); // TODO: signals / slots } QmitkRenderWindowWidget::~QmitkRenderWindowWidget() { // nothing here } void QmitkRenderWindowWidget::SetDataStorage(mitk::DataStorage* dataStorage) { if (dataStorage == m_DataStorage) { return; } m_DataStorage = dataStorage; if (nullptr != m_RenderWindow) { - mitk::BaseRenderer::GetInstance(m_RenderWindow->GetRenderWindow())->SetDataStorage(ds); + mitk::BaseRenderer::GetInstance(m_RenderWindow->GetRenderWindow())->SetDataStorage(dataStorage); } } mitk::SliceNavigationController* QmitkRenderWindowWidget::GetSliceNavigationController() const { if (nullptr == m_RenderWindow) { return nullptr; } return m_RenderWindow->GetSliceNavigationController(); } void QmitkRenderWindowWidget::RequestUpdate() { m_RenderingManager->RequestUpdate(m_RenderWindow->GetRenderWindow()); } void QmitkRenderWindowWidget::ForceImmediateUpdate() { m_RenderingManager->ForceImmediateUpdate(m_RenderWindow->GetRenderWindow()); } void QmitkRenderWindowWidget::SetBackgroundColorGradient(const mitk::Color& upper, const mitk::Color& lower) { vtkRenderer* vtkRenderer = m_RenderWindow->GetRenderer()->GetVtkRenderer(); if (nullptr == vtkRenderer) { return; } m_BackgroundColorGradient.first = upper; m_BackgroundColorGradient.second = lower; vtkRenderer->SetBackground(lower[0], lower[1], lower[2]); vtkRenderer->SetBackground2(upper[0], upper[1], upper[2]); ShowBackgroundColorGradient(true); } void QmitkRenderWindowWidget::ShowBackgroundColorGradient(bool show) { if (show) { m_RenderWindow->GetRenderer()->GetVtkRenderer()->GradientBackgroundOn(); } else { m_RenderWindow->GetRenderer()->GetVtkRenderer()->GradientBackgroundOff(); } m_BackgroundColorGradientFlag = show; } void QmitkRenderWindowWidget::ShowLevelWindowWidget(bool show) { m_LevelWindowWidget->disconnect(this); if (show) { m_LevelWindowWidget->SetDataStorage(m_DataStorage); m_LevelWindowWidget->show(); } else { m_LevelWindowWidget->disconnect(this); m_LevelWindowWidget->hide(); } } void QmitkRenderWindowWidget::ShowDepartmentLogo(bool show) { m_LogoAnnotation->SetVisibility(show); } void QmitkRenderWindowWidget::SetDecorationColor(const mitk::Color& color) { m_DecorationColor = color; m_RectangleProp->SetColor(m_DecorationColor[0], m_DecorationColor[1], m_DecorationColor[2]); m_CornerAnnotation->GetTextProperty()->SetColor(color[0], color[1], color[2]); - - // #TODO: change color of geometry planes } void QmitkRenderWindowWidget::ShowColoredRectangle(bool show) { m_RectangleProp->SetVisibility(show); } bool QmitkRenderWindowWidget::IsColoredRectangleVisible() const { return m_RectangleProp->GetVisibility() > 0; } void QmitkRenderWindowWidget::ShowCornerAnnotation(bool show) { m_CornerAnnotation->SetVisibility(show); } bool QmitkRenderWindowWidget::IsCornerAnnotationVisible() const { return m_CornerAnnotation->GetVisibility() > 0; } void QmitkRenderWindowWidget::SetCornerAnnotationText(const std::string& cornerAnnotation) { m_CornerAnnotation->SetText(0, cornerAnnotation.c_str()); } std::string QmitkRenderWindowWidget::GetCornerAnnotationText() const { return std::string(m_CornerAnnotation->GetText(0)); } -void QmitkRenderWindowWidget::ActivateMenuWidget(bool state, QmitkCustomMultiWidget* multiWidget) -{ - // TODO: need to define an interface for multi widgets - //m_RenderWindow->ActivateMenuWidget(state, multiWidget); -} - bool QmitkRenderWindowWidget::IsRenderWindowMenuActivated() const { return m_RenderWindow->GetActivateMenuWidgetFlag(); } -void QmitkRenderWindowWidget::ShowGeometryPlanes(bool show) -{ - if (m_GeometryPlane1.IsNotNull()) - { - m_GeometryPlane1->SetVisibility(show); // TODO: parameter renderer? - } - if (m_GeometryPlane2.IsNotNull()) - { - m_GeometryPlane2->SetVisibility(show); - } - if (m_GeometryPlane3.IsNotNull()) - { - m_GeometryPlane3->SetVisibility(show); - } - m_RenderingManager->RequestUpdate(m_RenderWindow->GetRenderWindow()); -} - -mitk::DataNode::Pointer QmitkRenderWindowWidget::GetGeometryPlane(unsigned int planeNumber) const -{ - switch (planeNumber) - { - case 1: - return m_GeometryPlane1; - case 2: - return m_GeometryPlane2; - case 3: - return m_GeometryPlane3; - default: - return nullptr; - } -} - -void QmitkRenderWindowWidget::AddGeometryPlanesToDataStorage() -{ - if (m_GeometryPlane1.IsNotNull() && m_GeometryPlane2.IsNotNull() && m_GeometryPlane3.IsNotNull() && - m_GeometryPlanes.IsNotNull()) - { - if (nullptr != m_DataStorage) - { - m_DataStorage->Add(m_GeometryPlanes); - m_DataStorage->Add(m_GeometryPlane1, m_GeometryPlanes); - m_DataStorage->Add(m_GeometryPlane2, m_GeometryPlanes); - m_DataStorage->Add(m_GeometryPlane3, m_GeometryPlanes); - } - } -} - -void QmitkRenderWindowWidget::RemoveGeometryPlanesFromDataStorage() -{ - if (m_GeometryPlane1.IsNotNull() && m_GeometryPlane2.IsNotNull() && m_GeometryPlane3.IsNotNull() && - m_GeometryPlanes.IsNotNull()) - { - if (nullptr != m_DataStorage) - { - m_DataStorage->Remove(m_GeometryPlane1); - m_DataStorage->Remove(m_GeometryPlane2); - m_DataStorage->Remove(m_GeometryPlane3); - m_DataStorage->Remove(m_GeometryPlanes); - } - } -} - void QmitkRenderWindowWidget::InitializeGUI() { m_Layout = new QHBoxLayout(this); m_Layout->setMargin(0); setLayout(m_Layout); setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); // create render window for this render window widget m_RenderingManager = mitk::RenderingManager::GetInstance(); // TODO: do not always use the standard global rendering manager m_RenderingMode = mitk::BaseRenderer::RenderingMode::Standard; // TODO: do not always use the standard rendering mode m_RenderWindow = new QmitkRenderWindow(this, "widget - " + m_UID, nullptr, m_RenderingManager, m_RenderingMode); m_RenderWindow->SetLayoutIndex(QmitkCustomMultiWidget::SAGITTAL); // TODO: allow to change layout type later m_RenderWindow->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Sagittal); // create level window widget for this render window widget m_LevelWindowWidget = new QmitkLevelWindowWidget(this); //m_LevelWindowWidget->setObjectName(QString::fromUtf8("levelWindowWidget")); QSizePolicy sizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); sizePolicy.setHorizontalStretch(0); sizePolicy.setVerticalStretch(0); sizePolicy.setHeightForWidth(m_LevelWindowWidget->sizePolicy().hasHeightForWidth()); m_LevelWindowWidget->setSizePolicy(sizePolicy); m_LevelWindowWidget->setMaximumWidth(50); m_Layout->addWidget(m_RenderWindow); m_Layout->addWidget(m_LevelWindowWidget); - // add geometry planes - InitializeGeometryPlanes(); // set colors, add logo etc. InitializeDecorations(); + if (m_RenderingManager == nullptr) + { + m_RenderingManager = mitk::RenderingManager::GetInstance(); + } + m_TimeNavigationController = m_RenderingManager->GetTimeNavigationController(); + // connect to the "time navigation controller": send time via sliceNavigationControllers m_TimeNavigationController->ConnectGeometryTimeEvent(GetRenderWindow()->GetSliceNavigationController(), false); // reverse connection between sliceNavigationControllers and m_TimeNavigationController GetRenderWindow()->GetSliceNavigationController()->ConnectGeometryTimeEvent(m_TimeNavigationController, false); } -void QmitkRenderWindowWidget::InitializeGeometryPlanes() -{ - // #TODO: all have same geometry plane / all have same color - mitk::BaseRenderer* renderer = mitk::BaseRenderer::GetInstance(m_RenderWindow->GetRenderWindow()); - if (nullptr == renderer) - { - return; - } - - mitk::PlaneGeometryDataMapper2D::Pointer mapper; - - m_GeometryPlane1 = renderer->GetCurrentWorldPlaneGeometryNode(); - m_GeometryPlane1->SetColor(m_DecorationColor); - m_GeometryPlane1->SetProperty("layer", mitk::IntProperty::New(1000)); - m_GeometryPlane1->SetProperty("visible", mitk::BoolProperty::New(true)); - m_GeometryPlane1->SetProperty("name", mitk::StringProperty::New(std::string(renderer->GetName()) + ".plane")); - m_GeometryPlane1->SetProperty("includeInBoundingBox", mitk::BoolProperty::New(false)); - m_GeometryPlane1->SetProperty("helper object", mitk::BoolProperty::New(true)); - mapper = mitk::PlaneGeometryDataMapper2D::New(); - m_GeometryPlane1->SetMapper(mitk::BaseRenderer::Standard2D, mapper); - - m_GeometryPlane2 = renderer->GetCurrentWorldPlaneGeometryNode(); - m_GeometryPlane2->SetColor(m_DecorationColor); - m_GeometryPlane2->SetProperty("layer", mitk::IntProperty::New(1000)); - m_GeometryPlane2->SetProperty("visible", mitk::BoolProperty::New(true)); - m_GeometryPlane2->SetProperty("name", mitk::StringProperty::New(std::string(renderer->GetName()) + ".plane")); - m_GeometryPlane2->SetProperty("includeInBoundingBox", mitk::BoolProperty::New(false)); - m_GeometryPlane2->SetProperty("helper object", mitk::BoolProperty::New(true)); - mapper = mitk::PlaneGeometryDataMapper2D::New(); - m_GeometryPlane2->SetMapper(mitk::BaseRenderer::Standard2D, mapper); - - m_GeometryPlane3 = renderer->GetCurrentWorldPlaneGeometryNode(); - m_GeometryPlane3->SetColor(m_DecorationColor); - m_GeometryPlane3->SetProperty("layer", mitk::IntProperty::New(1000)); - m_GeometryPlane3->SetProperty("visible", mitk::BoolProperty::New(true)); - m_GeometryPlane3->SetProperty("name", mitk::StringProperty::New(std::string(renderer->GetName()) + ".plane")); - m_GeometryPlane3->SetProperty("includeInBoundingBox", mitk::BoolProperty::New(false)); - m_GeometryPlane3->SetProperty("helper object", mitk::BoolProperty::New(true)); - mapper = mitk::PlaneGeometryDataMapper2D::New(); - m_GeometryPlane2->SetMapper(mitk::BaseRenderer::Standard2D, mapper); - - // the parent node - m_ParentNodeForGeometryPlanes = mitk::DataNode::New(); - m_ParentNodeForGeometryPlanes->SetProperty("layer", mitk::IntProperty::New(1000)); - m_ParentNodeForGeometryPlanes->SetProperty("name", mitk::StringProperty::New("Widgets")); - m_ParentNodeForGeometryPlanes->SetProperty("helper object", mitk::BoolProperty::New(true)); -} - void QmitkRenderWindowWidget::InitializeDecorations() { vtkRenderer* vtkRenderer = m_RenderWindow->GetRenderer()->GetVtkRenderer(); if (nullptr == vtkRenderer) { return; } // initialize background color gradients float black[3] = { 0.0f, 0.0f, 0.0f }; SetBackgroundColorGradient(black, black); // initialize decoration color, rectangle and annotation text float white[3] = { 1.0f, 1.0f, 1.0f }; m_DecorationColor = white; m_RectangleProp = vtkSmartPointer::New(); m_RectangleProp->SetColor(m_DecorationColor[0], m_DecorationColor[1], m_DecorationColor[2]); if (0 == vtkRenderer->HasViewProp(m_RectangleProp)) { vtkRenderer->AddViewProp(m_RectangleProp); } m_CornerAnnotation = vtkSmartPointer::New(); m_CornerAnnotation->SetText(0, "Sagittal"); m_CornerAnnotation->SetMaximumFontSize(12); m_CornerAnnotation->GetTextProperty()->SetColor(m_DecorationColor[0], m_DecorationColor[1], m_DecorationColor[2]); if (0 == vtkRenderer->HasViewProp(m_CornerAnnotation)) { vtkRenderer->AddViewProp(m_CornerAnnotation); } } \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/plugin.xml b/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/plugin.xml index 60fb64cacd..cd5926da46 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/plugin.xml +++ b/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/plugin.xml @@ -1,26 +1,26 @@ - + diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkCustomMultiWidgetEditor.cpp b/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkCustomMultiWidgetEditor.cpp index abea580144..76358bda93 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkCustomMultiWidgetEditor.cpp +++ b/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkCustomMultiWidgetEditor.cpp @@ -1,504 +1,484 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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. ===================================================================*/ #include "QmitkCustomMultiWidgetEditor.h" #include #include #include #include #include #include #include #include #include #include #include #include //#TODO: create different default views (different layouts of the render window widgets) class QmitkCustomMultiWidgetEditor::Impl final { public: Impl(); ~Impl(); QmitkCustomMultiWidget* m_CustomMultiWidget; QmitkMouseModeSwitcher* m_MouseModeToolbar; /* * @brief Members for the MultiWidget decoration */ QString m_WidgetBackgroundColor1[4]; QString m_WidgetBackgroundColor2[4]; QString m_WidgetDecorationColor[4]; QString m_WidgetAnnotation[4]; bool m_MenuWidgetsEnabled; QHash m_RenderWindows; }; QmitkCustomMultiWidgetEditor::Impl::Impl() : m_CustomMultiWidget(nullptr) , m_MouseModeToolbar(nullptr) , m_MenuWidgetsEnabled(false) { // nothing here } QmitkCustomMultiWidgetEditor::Impl::~Impl() { // nothing here } const QString QmitkCustomMultiWidgetEditor::EDITOR_ID = "org.mitk.editors.custommultiwidget"; QmitkCustomMultiWidgetEditor::QmitkCustomMultiWidgetEditor() : m_Impl(new Impl()) // this? { - m_Impl->m_CustomMultiWidget->AddPlanesToDataStorage(); RequestActivateMenuWidget(true); } QmitkCustomMultiWidgetEditor::~QmitkCustomMultiWidgetEditor() { - m_Impl->m_CustomMultiWidget->RemovePlanesFromDataStorage(); RequestActivateMenuWidget(false); } void QmitkCustomMultiWidgetEditor::Activated() { // nothing here } void QmitkCustomMultiWidgetEditor::Deactivated() { // nothing here } void QmitkCustomMultiWidgetEditor::Visible() { RequestActivateMenuWidget(true); } void QmitkCustomMultiWidgetEditor::Hidden() { RequestActivateMenuWidget(false); } QmitkRenderWindow* QmitkCustomMultiWidgetEditor::GetActiveQmitkRenderWindow() const { + // #TODO: active render window currently not implemented if (m_Impl->m_CustomMultiWidget) { - return m_Impl->m_CustomMultiWidget->GetActiveRenderWindowWidget(); + return m_Impl->m_CustomMultiWidget->GetActiveRenderWindowWidget()->GetRenderWindow(); } return nullptr; } QHash QmitkCustomMultiWidgetEditor::GetQmitkRenderWindows() const { + // #TODO: we do not want to keep a hash-table here!? return m_Impl->m_RenderWindows; } QmitkRenderWindow* QmitkCustomMultiWidgetEditor::GetQmitkRenderWindow(const QString &id) const { + // #TODO: invalid since a specific id (e.g. 'axial') does not uniquely identify a render window anymore + /* if (m_Impl->m_RenderWindows.contains(id)) { return m_Impl->m_RenderWindows[id]; } - + */ return nullptr; } -mitk::Point3D QmitkCustomMultiWidgetEditor::GetSelectedPosition(const QString & /*id*/) const +mitk::Point3D QmitkCustomMultiWidgetEditor::GetSelectedPosition(const QString & id) const { - return m_Impl->m_CustomMultiWidget->GetCrossPosition(); + // #TODO: use id or string for render window widget identification + return m_Impl->m_CustomMultiWidget->GetCrossPosition(0/*id*/); } -void QmitkCustomMultiWidgetEditor::SetSelectedPosition(const mitk::Point3D &pos, const QString &/*id*/) +void QmitkCustomMultiWidgetEditor::SetSelectedPosition(const mitk::Point3D& pos, const QString& id) { - m_Impl->m_CustomMultiWidget->MoveCrossToPosition(pos); + // #TODO: use id or string for render window widget identification + m_Impl->m_CustomMultiWidget->MoveCrossToPosition(0/*id*/, pos); } void QmitkCustomMultiWidgetEditor::EnableDecorations(bool enable, const QStringList &decorations) { + // #TODO: define: - for all render windows + // - for the one, active render window + // MOVE TO DECORATION MANAGER if (decorations.isEmpty() || decorations.contains(DECORATION_BORDER)) { - enable ? m_Impl->m_CustomMultiWidget->EnableColoredRectangles() - : m_Impl->m_CustomMultiWidget->DisableColoredRectangles(); + m_Impl->m_CustomMultiWidget->ShowAllColoredRectangles(enable); } if (decorations.isEmpty() || decorations.contains(DECORATION_LOGO)) { - enable ? m_Impl->m_CustomMultiWidget->EnableDepartmentLogo() - : m_Impl->m_CustomMultiWidget->DisableDepartmentLogo(); + m_Impl->m_CustomMultiWidget->ShowAllDepartmentLogos(enable); } if (decorations.isEmpty() || decorations.contains(DECORATION_MENU)) { - m_Impl->m_CustomMultiWidget->ActivateRenderWindowWidgetMenu(enable); + //m_Impl->m_CustomMultiWidget->ActivateAllRenderWindowMenus(enable); } if (decorations.isEmpty() || decorations.contains(DECORATION_BACKGROUND)) { - enable ? m_Impl->m_CustomMultiWidget->EnableGradientBackground() - : m_Impl->m_CustomMultiWidget->DisableGradientBackground(); + m_Impl->m_CustomMultiWidget->ShowAllBackgroundColorGradients(enable); } if (decorations.isEmpty() || decorations.contains(DECORATION_CORNER_ANNOTATION)) { - enable ? m_Impl->m_CustomMultiWidget->SetCornerAnnotationVisibility(true) - : m_Impl->m_CustomMultiWidget->SetCornerAnnotationVisibility(false); + m_Impl->m_CustomMultiWidget->ShowAllCornerAnnotations(enable); } } bool QmitkCustomMultiWidgetEditor::IsDecorationEnabled(const QString &decoration) const { + // #TODO: define: - for all render windows + // - for the one, active render window + // MOVE TO DECORATION MANAGER + /* if (decoration == DECORATION_BORDER) { return m_Impl->m_CustomMultiWidget->IsColoredRectanglesEnabled(); } else if (decoration == DECORATION_LOGO) { return m_Impl->m_CustomMultiWidget->IsColoredRectanglesEnabled(); } else if (decoration == DECORATION_MENU) { return m_Impl->m_CustomMultiWidget->IsRenderWindowWidgetMenuEnabled(); } else if (decoration == DECORATION_BACKGROUND) { return m_Impl->m_CustomMultiWidget->GetGradientBackgroundFlag(); } else if (decoration == DECORATION_CORNER_ANNOTATION) { return m_Impl->m_CustomMultiWidget->IsCornerAnnotationVisible(); } - + */ return false; } QStringList QmitkCustomMultiWidgetEditor::GetDecorations() const { + // MOVE TO DECORATION MANAGER QStringList decorations; decorations << DECORATION_BORDER << DECORATION_LOGO << DECORATION_MENU << DECORATION_BACKGROUND << DECORATION_CORNER_ANNOTATION; return decorations; } void QmitkCustomMultiWidgetEditor::EnableSlicingPlanes(bool enable) { - m_Impl->m_CustomMultiWidget->SetWidgetPlanesVisibility(enable); + // #TODO: nothing here } bool QmitkCustomMultiWidgetEditor::IsSlicingPlanesEnabled() const { - mitk::DataNode::Pointer node = m_Impl->m_CustomMultiWidget->GetWidgetPlane1(); - if (node.IsNotNull()) - { - bool visible = false; - node->GetVisibility(visible, 0); - return visible; - } - else - { - return false; - } + // #TODO: nothing here + return false; } QmitkCustomMultiWidget* QmitkCustomMultiWidgetEditor::GetCustomMultiWidget() { return m_Impl->m_CustomMultiWidget; } void QmitkCustomMultiWidgetEditor::SetFocus() { if (nullptr != m_Impl->m_CustomMultiWidget) { m_Impl->m_CustomMultiWidget->setFocus(); } } void QmitkCustomMultiWidgetEditor::OnPreferencesChanged(const berry::IBerryPreferences* preferences) { + // MOVE TO DECORATION MANAGER + // Enable change of logo. If no DepartmentLogo was set explicitly, MBILogo is used. // Set new department logo by prefs->Set("DepartmentLogo", "PathToImage"); // If no logo was set for this plug-in specifically, walk the parent preference nodes // and lookup a logo value there. - + /* const berry::IPreferences* currentNode = preferences; while(currentNode) { bool logoFound = false; foreach (const QString& key, currentNode->Keys()) { if( key == "DepartmentLogo") { QString departmentLogoLocation = currentNode->Get("DepartmentLogo", ""); if (departmentLogoLocation.isEmpty()) { - m_Impl->m_CustomMultiWidget->DisableDepartmentLogo(); + m_Impl->m_CustomMultiWidget->ShowDepartmentLogo(false); } else { // we need to disable the logo first, otherwise setting a new logo will have // no effect due to how mitkManufacturerLogo works... m_Impl->m_CustomMultiWidget->DisableDepartmentLogo(); m_Impl->m_CustomMultiWidget->SetDepartmentLogoPath(qPrintable(departmentLogoLocation)); m_Impl->m_CustomMultiWidget->EnableDepartmentLogo(); } logoFound = true; break; } } - if (logoFound) break; + if (logoFound) + { + break; + } currentNode = currentNode->Parent().GetPointer(); } + */ // Update internal members FillMembersWithCurrentDecorations(); GetPreferenceDecorations(preferences); - // Now the members can be used to modify the custom multi widget - mitk::Color upper = HexColorToMitkColor(m_Impl->m_WidgetBackgroundColor1[0]); - mitk::Color lower = HexColorToMitkColor(m_Impl->m_WidgetBackgroundColor2[0]); - m_Impl->m_CustomMultiWidget->SetBackgroundColorGradient(upper, lower, 0); - m_Impl->m_CustomMultiWidget->ShowBackgroundColorGradient(0, true); - upper = HexColorToMitkColor(m_Impl->m_WidgetBackgroundColor1[1]); - lower = HexColorToMitkColor(m_Impl->m_WidgetBackgroundColor2[1]); - m_Impl->m_CustomMultiWidget->SetBackgroundColorGradient(upper, lower, 1); - m_Impl->m_CustomMultiWidget->ShowBackgroundColorGradient(1, true); - upper = HexColorToMitkColor(m_Impl->m_WidgetBackgroundColor1[2]); - lower = HexColorToMitkColor(m_Impl->m_WidgetBackgroundColor2[2]); - m_Impl->m_CustomMultiWidget->SetBackgroundColorGradient(upper, lower, 2); - m_Impl->m_CustomMultiWidget->ShowBackgroundColorGradient(2, true); - upper = HexColorToMitkColor(m_Impl->m_WidgetBackgroundColor1[3]); - lower = HexColorToMitkColor(m_Impl->m_WidgetBackgroundColor2[3]); - m_Impl->m_CustomMultiWidget->SetBackgroundColorGradient(upper, lower, 3); - m_Impl->m_CustomMultiWidget->ShowBackgroundColorGradient(3, true); - // preferences for renderWindows - mitk::Color colorDecorationWidget1 = HexColorToMitkColor(m_Impl->m_WidgetDecorationColor[0]); - mitk::Color colorDecorationWidget2 = HexColorToMitkColor(m_Impl->m_WidgetDecorationColor[1]); - mitk::Color colorDecorationWidget3 = HexColorToMitkColor(m_Impl->m_WidgetDecorationColor[2]); - mitk::Color colorDecorationWidget4 = HexColorToMitkColor(m_Impl->m_WidgetDecorationColor[3]); - m_Impl->m_CustomMultiWidget->SetDecorationColor(0, colorDecorationWidget1); - m_Impl->m_CustomMultiWidget->SetDecorationColor(1, colorDecorationWidget2); - m_Impl->m_CustomMultiWidget->SetDecorationColor(2, colorDecorationWidget3); - m_Impl->m_CustomMultiWidget->SetDecorationColor(3, colorDecorationWidget4); + // preferences for renderWindows for(unsigned int i = 0; i < 4; ++i) { - m_Impl->m_CustomMultiWidget->SetDecorationProperties(m_Impl->m_WidgetAnnotation[i].toStdString(), HexColorToMitkColor(m_Impl->m_WidgetDecorationColor[i]), i); + // set background color gradient + mitk::Color upper = HexColorToMitkColor(m_Impl->m_WidgetBackgroundColor1[i]); + mitk::Color lower = HexColorToMitkColor(m_Impl->m_WidgetBackgroundColor2[i]); + m_Impl->m_CustomMultiWidget->SetBackgroundColorGradient(upper, lower, i); + m_Impl->m_CustomMultiWidget->ShowBackgroundColorGradient(i, true); + + // set decoration color and corner annotation text + mitk::Color colorDecorationWidget = HexColorToMitkColor(m_Impl->m_WidgetDecorationColor[i]); + m_Impl->m_CustomMultiWidget->SetDecorationColor(i, colorDecorationWidget); + m_Impl->m_CustomMultiWidget->SetCornerAnnotationText(i, m_Impl->m_WidgetAnnotation[i].toStdString()); + + // enable colored rectangle + m_Impl->m_CustomMultiWidget->ShowColoredRectangle(i, true); } - // The crosshair gap - int crosshairgapsize = preferences->GetInt("crosshair gap size", 32); - m_Impl->m_CustomMultiWidget->GetWidgetPlane1()->SetIntProperty("Crosshair.Gap Size", crosshairgapsize); - m_Impl->m_CustomMultiWidget->GetWidgetPlane2()->SetIntProperty("Crosshair.Gap Size", crosshairgapsize); - m_Impl->m_CustomMultiWidget->GetWidgetPlane3()->SetIntProperty("Crosshair.Gap Size", crosshairgapsize); - - //refresh colors of rectangles - m_Impl->m_CustomMultiWidget->EnableColoredRectangles(); // Set preferences respecting zooming and panning bool constrainedZooming = preferences->GetBool("Use constrained zooming and panning", true); mitk::RenderingManager::GetInstance()->SetConstrainedPanningZooming(constrainedZooming); mitk::RenderingManager::GetInstance()->InitializeViewsByBoundingObjects(this->GetDataStorage()); mitk::RenderingManager::GetInstance()->RequestUpdateAll(); // level window setting - bool showLevelWindowWidget = preferences->GetBool("Show level/window widget", true); + bool showLevelWindowWidget = preferences->GetBool("Show level-window widget", true); if (showLevelWindowWidget) { m_Impl->m_CustomMultiWidget->ShowAllLevelWindowWidgets(true); } else { m_Impl->m_CustomMultiWidget->ShowAllLevelWindowWidgets(false); } - - // mouse modes toolbar - bool newMode = preferences->GetBool("PACS like mouse interaction", false); - m_Impl->m_MouseModeToolbar->setVisible( newMode ); - m_Impl->m_CustomMultiWidget->GetMouseModeSwitcher()->SetInteractionScheme( newMode ? mitk::MouseModeSwitcher::PACS : mitk::MouseModeSwitcher::MITK ); } void QmitkCustomMultiWidgetEditor::CreateQtPartControl(QWidget* parent) { if (nullptr == m_Impl->m_CustomMultiWidget) { QHBoxLayout* layout = new QHBoxLayout(parent); layout->setContentsMargins(0, 0, 0, 0); if (nullptr == m_Impl->m_MouseModeToolbar) { m_Impl->m_MouseModeToolbar = new QmitkMouseModeSwitcher(parent); layout->addWidget(m_Impl->m_MouseModeToolbar); } berry::IPreferences::Pointer prefs = GetPreferences(); mitk::BaseRenderer::RenderingMode::Type renderingMode = static_cast(prefs->GetInt("Rendering Mode", 0)); m_Impl->m_CustomMultiWidget = new QmitkCustomMultiWidget(parent, 0, 0, renderingMode); - m_Impl->m_RenderWindows.insert("axial", m_Impl->m_CustomMultiWidget->GetRenderWindowWidget()); layout->addWidget(m_Impl->m_CustomMultiWidget); - m_Impl->m_MouseModeToolbar->setMouseModeSwitcher(m_Impl->m_CustomMultiWidget->GetMouseModeSwitcher()); + //m_Impl->m_MouseModeToolbar->setMouseModeSwitcher(m_Impl->m_CustomMultiWidget->GetMouseModeSwitcher()); mitk::DataStorage::Pointer dataStorage = GetDataStorage(); m_Impl->m_CustomMultiWidget->SetDataStorage(dataStorage); mitk::TimeGeometry::Pointer timeGeometry = dataStorage->ComputeBoundingGeometry3D(dataStorage->GetAll()); mitk::RenderingManager::GetInstance()->InitializeViews(timeGeometry); m_Impl->m_CustomMultiWidget->ShowAllLevelWindowWidgets(true); - // Add the displayed views to the tree to see their positions - // in 2D and 3D - m_Impl->m_CustomMultiWidget->AddDisplayPlaneSubTree(); - - //m_Impl->m_StdMultiWidget->EnableNavigationControllerEventListening(); - // Store the initial visibility status of the menu widget. - m_Impl->m_MenuWidgetsEnabled = m_Impl->m_CustomMultiWidget->IsRenderWindowWidgetMenuEnabled(); + //m_Impl->m_MenuWidgetsEnabled = m_Impl->m_CustomMultiWidget->IsRenderWindowMenuActivated(0); berry::IBerryPreferences* berryprefs = dynamic_cast(prefs.GetPointer()); InitializePreferences(berryprefs); OnPreferencesChanged(berryprefs); RequestUpdate(); } } void QmitkCustomMultiWidgetEditor::RequestActivateMenuWidget(bool on) { + /* if (nullptr == m_Impl->m_CustomMultiWidget) { return; } if (on) { m_Impl->m_CustomMultiWidget->ActivateAllRenderWindowMenus(m_Impl->m_MenuWidgetsEnabled); } else { - m_Impl->m_MenuWidgetsEnabled = m_Impl->m_CustomMultiWidget->IsRenderWindowWidgetMenuEnabled(); + m_Impl->m_MenuWidgetsEnabled = m_Impl->m_CustomMultiWidget->IsRenderWindowMenuActivated(0); m_Impl->m_CustomMultiWidget->ActivateAllRenderWindowMenus(false); } + */ } void QmitkCustomMultiWidgetEditor::InitializePreferences(berry::IBerryPreferences* preferences) { FillMembersWithCurrentDecorations(); // fill members GetPreferenceDecorations(preferences); // overwrite if preferences are defined //create new preferences preferences->Put("widget1 corner annotation", m_Impl->m_WidgetAnnotation[0]); preferences->Put("widget2 corner annotation", m_Impl->m_WidgetAnnotation[1]); preferences->Put("widget3 corner annotation", m_Impl->m_WidgetAnnotation[2]); preferences->Put("widget4 corner annotation", m_Impl->m_WidgetAnnotation[3]); preferences->Put("widget1 decoration color", m_Impl->m_WidgetDecorationColor[0]); preferences->Put("widget2 decoration color", m_Impl->m_WidgetDecorationColor[1]); preferences->Put("widget3 decoration color", m_Impl->m_WidgetDecorationColor[2]); preferences->Put("widget4 decoration color", m_Impl->m_WidgetDecorationColor[3]); preferences->Put("widget1 first background color", m_Impl->m_WidgetBackgroundColor1[0]); preferences->Put("widget2 first background color", m_Impl->m_WidgetBackgroundColor1[1]); preferences->Put("widget3 first background color", m_Impl->m_WidgetBackgroundColor1[2]); preferences->Put("widget4 first background color", m_Impl->m_WidgetBackgroundColor1[3]); preferences->Put("widget1 second background color", m_Impl->m_WidgetBackgroundColor2[0]); preferences->Put("widget2 second background color", m_Impl->m_WidgetBackgroundColor2[1]); preferences->Put("widget3 second background color", m_Impl->m_WidgetBackgroundColor2[2]); preferences->Put("widget4 second background color", m_Impl->m_WidgetBackgroundColor2[3]); } void QmitkCustomMultiWidgetEditor::FillMembersWithCurrentDecorations() { //fill members with current values (or default values) from the std multi widget for(unsigned int i = 0; i < 4; ++i) { m_Impl->m_WidgetDecorationColor[i] = MitkColorToHexColor(m_Impl->m_CustomMultiWidget->GetDecorationColor(i)); - m_Impl->m_WidgetBackgroundColor1[i] = MitkColorToHexColor(m_Impl->m_CustomMultiWidget->GetGradientColors(i).first); - m_Impl->m_WidgetBackgroundColor2[i] = MitkColorToHexColor(m_Impl->m_CustomMultiWidget->GetGradientColors(i).second); + m_Impl->m_WidgetBackgroundColor1[i] = MitkColorToHexColor(m_Impl->m_CustomMultiWidget->GetBackgroundColorGradient(i).first); + m_Impl->m_WidgetBackgroundColor2[i] = MitkColorToHexColor(m_Impl->m_CustomMultiWidget->GetBackgroundColorGradient(i).second); m_Impl->m_WidgetAnnotation[i] = QString::fromStdString(m_Impl->m_CustomMultiWidget->GetCornerAnnotationText(i)); } } void QmitkCustomMultiWidgetEditor::GetPreferenceDecorations(const berry::IBerryPreferences * preferences) { + // MOVE TO DECORATION MANAGER + //overwrite members with values from the preferences, if they the preference is defined m_Impl->m_WidgetBackgroundColor1[0] = preferences->Get("widget1 first background color", m_Impl->m_WidgetBackgroundColor1[0]); m_Impl->m_WidgetBackgroundColor2[0] = preferences->Get("widget1 second background color", m_Impl->m_WidgetBackgroundColor2[0]); m_Impl->m_WidgetBackgroundColor1[1] = preferences->Get("widget2 first background color", m_Impl->m_WidgetBackgroundColor1[1]); m_Impl->m_WidgetBackgroundColor2[1] = preferences->Get("widget2 second background color", m_Impl->m_WidgetBackgroundColor2[1]); m_Impl->m_WidgetBackgroundColor1[2] = preferences->Get("widget3 first background color", m_Impl->m_WidgetBackgroundColor1[2]); m_Impl->m_WidgetBackgroundColor2[2] = preferences->Get("widget3 second background color", m_Impl->m_WidgetBackgroundColor2[2]); m_Impl->m_WidgetBackgroundColor1[3] = preferences->Get("widget4 first background color", m_Impl->m_WidgetBackgroundColor1[3]); m_Impl->m_WidgetBackgroundColor2[3] = preferences->Get("widget4 second background color", m_Impl->m_WidgetBackgroundColor2[3]); m_Impl->m_WidgetDecorationColor[0] = preferences->Get("widget1 decoration color", m_Impl->m_WidgetDecorationColor[0]); m_Impl->m_WidgetDecorationColor[1] = preferences->Get("widget2 decoration color", m_Impl->m_WidgetDecorationColor[1]); m_Impl->m_WidgetDecorationColor[2] = preferences->Get("widget3 decoration color", m_Impl->m_WidgetDecorationColor[2]); m_Impl->m_WidgetDecorationColor[3] = preferences->Get("widget4 decoration color", m_Impl->m_WidgetDecorationColor[3]); m_Impl->m_WidgetAnnotation[0] = preferences->Get("widget1 corner annotation", m_Impl->m_WidgetAnnotation[0]); m_Impl->m_WidgetAnnotation[1] = preferences->Get("widget2 corner annotation", m_Impl->m_WidgetAnnotation[1]); m_Impl->m_WidgetAnnotation[2] = preferences->Get("widget3 corner annotation", m_Impl->m_WidgetAnnotation[2]); m_Impl->m_WidgetAnnotation[3] = preferences->Get("widget4 corner annotation", m_Impl->m_WidgetAnnotation[3]); } mitk::Color QmitkCustomMultiWidgetEditor::HexColorToMitkColor(const QString& hexColor) { + // MOVE TO DECORATION MANAGER + QColor qColor(hexColor); mitk::Color returnColor; float colorMax = 255.0f; if (hexColor.isEmpty()) // default value { returnColor[0] = 1.0; returnColor[1] = 1.0; returnColor[2] = 1.0; MITK_ERROR << "Using default color for unknown hex string " << qPrintable(hexColor); } else { returnColor[0] = qColor.red() / colorMax; returnColor[1] = qColor.green() / colorMax; returnColor[2] = qColor.blue() / colorMax; } return returnColor; } QString QmitkCustomMultiWidgetEditor::MitkColorToHexColor(const mitk::Color& mitkColor) { + // MOVE TO DECORATION MANAGER + QColor returnColor; float colorMax = 255.0f; returnColor.setRed(static_cast(mitkColor[0] * colorMax + 0.5)); returnColor.setGreen(static_cast(mitkColor[1] * colorMax + 0.5)); returnColor.setBlue(static_cast(mitkColor[2] * colorMax + 0.5)); return returnColor.name(); } diff --git a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkCustomMultiWidgetEditor.h b/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkCustomMultiWidgetEditor.h index 6e6921b053..4bfe44c856 100644 --- a/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkCustomMultiWidgetEditor.h +++ b/Plugins/org.mitk.gui.qt.custommultiwidgeteditor/src/QmitkCustomMultiWidgetEditor.h @@ -1,164 +1,164 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical Image Computing. 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. ===================================================================*/ #ifndef QMITKCUSTOMMULTIWIDGETEDITOR_H #define QMITKCUSTOMMULTIWIDGETEDITOR_H #include #include #include // custom multi widget editor #include #include class QmitkCustomMultiWidget; class QmitkMouseModeSwitcher; class CUSTOMMULTIWIDGETEDITOR_EXPORT QmitkCustomMultiWidgetEditor final : public QmitkAbstractRenderEditor, public mitk::ILifecycleAwarePart, public mitk::ILinkedRenderWindowPart { Q_OBJECT public: berryObjectMacro(QmitkCustomMultiWidgetEditor) static const QString EDITOR_ID; QmitkCustomMultiWidgetEditor(); ~QmitkCustomMultiWidgetEditor(); - /* + /** * @brief Overridden from mitk::ILifecycleAwarePart */ virtual void Activated() override; - /* + /** * @brief Overridden from mitk::ILifecycleAwarePart */ virtual void Deactivated() override; - /* + /** * @brief Overridden from mitk::ILifecycleAwarePart */ virtual void Visible() override; - /* + /** * @brief Overridden from mitk::ILifecycleAwarePart */ virtual void Hidden() override; - /* + /** * @brief Overridden from mitk::ILinkedRenderWindowPart : IRenderWindowPart */ virtual QmitkRenderWindow* GetActiveQmitkRenderWindow() const override; - /* + /** * @brief Overridden from mitk::ILinkedRenderWindowPart : IRenderWindowPart */ virtual QHash GetQmitkRenderWindows() const override; - /* + /** * @brief Overridden from mitk::ILinkedRenderWindowPart : IRenderWindowPart */ virtual QmitkRenderWindow* GetQmitkRenderWindow(const QString& id) const override; - /* + /** * @brief Overridden from mitk::ILinkedRenderWindowPart : IRenderWindowPart */ virtual mitk::Point3D GetSelectedPosition(const QString& id = QString()) const override; - /* + /** * @brief Overridden from mitk::ILinkedRenderWindowPart : IRenderWindowPart */ virtual void SetSelectedPosition(const mitk::Point3D& pos, const QString& id = QString()) override; - /* + /** * @brief Overridden from mitk::ILinkedRenderWindowPart : IRenderWindowPart */ virtual void EnableDecorations(bool enable, const QStringList& decorations = QStringList()) override; - /* + /** * @brief Overridden from mitk::ILinkedRenderWindowPart : IRenderWindowPart */ virtual bool IsDecorationEnabled(const QString& decoration) const override; - /* + /** * @brief Overridden from mitk::ILinkedRenderWindowPart : IRenderWindowPart */ virtual QStringList GetDecorations() const override; - /* + /** * @brief Overridden from mitk::ILinkedRenderWindowPart */ virtual void EnableSlicingPlanes(bool enable) override; - /* + /** * @brief Overridden from mitk::ILinkedRenderWindowPart */ virtual bool IsSlicingPlanesEnabled() const override; QmitkCustomMultiWidget* GetCustomMultiWidget(); private: - /* + /** * @brief Overridden from QmitkAbstractRenderEditor */ virtual void SetFocus() override; - /* + /** * @brief Overridden from QmitkAbstractRenderEditor */ virtual void OnPreferencesChanged(const berry::IBerryPreferences* preferences) override; - /* + /** * @brief Overridden from QmitkAbstractRenderEditor */ virtual void CreateQtPartControl(QWidget* parent) override; - /* + /** * @brief * * */ void RequestActivateMenuWidget(bool on); - /* + /** * @brief Set the default preferences. This method is used to show the current preferences * in the first call of the preference page (the GUI). * * @param preferences The berry preferences. */ void InitializePreferences(berry::IBerryPreferences* preferences); - /* + /** * @brief FillMembersWithCurrentDecorations Helper method to fill internal members with * current values of the std multi widget. */ void FillMembersWithCurrentDecorations(); - /* + /** * @brief GetPreferenceDecorations Getter to fill internal members with values of preferences. * @param preferences The berry preferences. * * If a preference is set, the value will overwrite the current value. If it does not exist, * the value will not change. */ void GetPreferenceDecorations(const berry::IBerryPreferences* preferences); - /* + /** * @brief Convert a hex color string to mitk::Color. * * @param widgetColorInHex The color in hex format (#RRGGBB) where each digit is in the form (0-F). * @return The color in mitk format. */ mitk::Color HexColorToMitkColor(const QString& hexColor); - /* + /** * @brief Convert an mitk::Color to a hex color string. * * @param color The color in mitk format. * @return The color as string in hex (#RRGGBB). */ QString MitkColorToHexColor(const mitk::Color& mitkColor); class Impl; std::unique_ptr m_Impl; }; #endif // QMITKCUSTOMMULTIWIDGETEDITOR_H