diff --git a/Plugins/org.mitk.gui.qt.flowbench.segmentation/files.cmake b/Plugins/org.mitk.gui.qt.flowbench.segmentation/files.cmake index 9fb012527f..9d819ea96f 100644 --- a/Plugins/org.mitk.gui.qt.flowbench.segmentation/files.cmake +++ b/Plugins/org.mitk.gui.qt.flowbench.segmentation/files.cmake @@ -1,43 +1,46 @@ set(SRC_CPP_FILES ) set(INTERNAL_CPP_FILES org_mitk_gui_qt_flowbench_segmentation_Activator.cpp QmitkSegmentationFlowControlView.cpp + perspectives/QmitkFlowBenchSegmentationPerspective.cpp ) set(UI_FILES src/internal/QmitkSegmentationFlowControlView.ui ) set(MOC_H_FILES src/internal/org_mitk_gui_qt_flowbench_segmentation_Activator.h src/internal/QmitkSegmentationFlowControlView.h + src/internal/perspectives/QmitkFlowBenchSegmentationPerspective.h ) # list of resource files which can be used by the plug-in # system without loading the plug-ins shared library, # for example the icon used in the menu and tabs for the # plug-in views in the workbench set(CACHED_RESOURCE_FILES resources/icon.svg plugin.xml + resources/perspectives/segmentation_icon.svg ) # list of Qt .qrc files which contain additional resources # specific to this plugin set(QRC_FILES ) set(CPP_FILES ) foreach(file ${SRC_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/${file}) endforeach(file ${SRC_CPP_FILES}) foreach(file ${INTERNAL_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/internal/${file}) endforeach(file ${INTERNAL_CPP_FILES}) diff --git a/Plugins/org.mitk.gui.qt.flowbench.segmentation/plugin.xml b/Plugins/org.mitk.gui.qt.flowbench.segmentation/plugin.xml index 77fef92f69..7a805a606d 100644 --- a/Plugins/org.mitk.gui.qt.flowbench.segmentation/plugin.xml +++ b/Plugins/org.mitk.gui.qt.flowbench.segmentation/plugin.xml @@ -1,12 +1,21 @@ + + + + + diff --git a/Plugins/org.mitk.gui.qt.flowbenchapplication/resources/perspectives/viewer_icon.svg b/Plugins/org.mitk.gui.qt.flowbench.segmentation/resources/perspectives/segmentation_icon.svg similarity index 100% rename from Plugins/org.mitk.gui.qt.flowbenchapplication/resources/perspectives/viewer_icon.svg rename to Plugins/org.mitk.gui.qt.flowbench.segmentation/resources/perspectives/segmentation_icon.svg diff --git a/Plugins/org.mitk.gui.qt.flowbench.segmentation/src/internal/org_mitk_gui_qt_flowbench_segmentation_Activator.cpp b/Plugins/org.mitk.gui.qt.flowbench.segmentation/src/internal/org_mitk_gui_qt_flowbench_segmentation_Activator.cpp index 5278a52c6a..1737c1124a 100644 --- a/Plugins/org.mitk.gui.qt.flowbench.segmentation/src/internal/org_mitk_gui_qt_flowbench_segmentation_Activator.cpp +++ b/Plugins/org.mitk.gui.qt.flowbench.segmentation/src/internal/org_mitk_gui_qt_flowbench_segmentation_Activator.cpp @@ -1,39 +1,42 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "org_mitk_gui_qt_flowbench_segmentation_Activator.h" #include "QmitkSegmentationFlowControlView.h" +#include "perspectives/QmitkFlowBenchSegmentationPerspective.h" ctkPluginContext* org_mitk_gui_qt_flowbench_segmentation_Activator::m_Context = nullptr; void org_mitk_gui_qt_flowbench_segmentation_Activator::start(ctkPluginContext* context) { BERRY_REGISTER_EXTENSION_CLASS(QmitkSegmentationFlowControlView, context) + BERRY_REGISTER_EXTENSION_CLASS(QmitkFlowBenchSegmentationPerspective, context); + m_Context = context; } void org_mitk_gui_qt_flowbench_segmentation_Activator::stop(ctkPluginContext* context) { Q_UNUSED(context) m_Context = nullptr; } ctkPluginContext* org_mitk_gui_qt_flowbench_segmentation_Activator::GetContext() { return m_Context; } diff --git a/Plugins/org.mitk.gui.qt.flowbenchapplication/src/internal/perspectives/QmitkFlowBenchApplicationPerspective.cpp b/Plugins/org.mitk.gui.qt.flowbench.segmentation/src/internal/perspectives/QmitkFlowBenchSegmentationPerspective.cpp similarity index 79% rename from Plugins/org.mitk.gui.qt.flowbenchapplication/src/internal/perspectives/QmitkFlowBenchApplicationPerspective.cpp rename to Plugins/org.mitk.gui.qt.flowbench.segmentation/src/internal/perspectives/QmitkFlowBenchSegmentationPerspective.cpp index b291e6f03b..b52d262490 100644 --- a/Plugins/org.mitk.gui.qt.flowbenchapplication/src/internal/perspectives/QmitkFlowBenchApplicationPerspective.cpp +++ b/Plugins/org.mitk.gui.qt.flowbench.segmentation/src/internal/perspectives/QmitkFlowBenchSegmentationPerspective.cpp @@ -1,48 +1,47 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ -#include "QmitkFlowBenchApplicationPerspective.h" +#include "QmitkFlowBenchSegmentationPerspective.h" #include "berryIViewLayout.h" -QmitkFlowBenchApplicationPerspective::QmitkFlowBenchApplicationPerspective() +QmitkFlowBenchSegmentationPerspective::QmitkFlowBenchSegmentationPerspective() { } -void QmitkFlowBenchApplicationPerspective::CreateInitialLayout(berry::IPageLayout::Pointer layout) +void QmitkFlowBenchSegmentationPerspective::CreateInitialLayout(berry::IPageLayout::Pointer layout) { QString editorArea = layout->GetEditorArea(); layout->AddView("org.mitk.views.multilabelsegmentation", berry::IPageLayout::LEFT, 0.3f, editorArea); berry::IViewLayout::Pointer lo = layout->GetViewLayout("org.mitk.views.multilabelsegmentation"); lo->SetCloseable(false); - layout->AddStandaloneView("org.mitk.views.flowbench.control",false, berry::IPageLayout::RIGHT, 0.7f, editorArea); + layout->AddStandaloneView("org.mitk.views.flowbench.control",false, berry::IPageLayout::RIGHT, 0.6f, editorArea); lo = layout->GetViewLayout("org.mitk.views.flowbench.control"); lo->SetCloseable(false); layout->AddView("org.mitk.views.imagenavigator", - berry::IPageLayout::TOP, 0.1f, "org.mitk.views.imagenavigator"); + berry::IPageLayout::TOP, 0.1f, "org.mitk.views.flowbench.control"); berry::IPlaceholderFolderLayout::Pointer bottomFolder = layout->CreatePlaceholderFolder("bottom", berry::IPageLayout::BOTTOM, 0.7f, editorArea); bottomFolder->AddPlaceholder("org.blueberry.views.logview"); - bottomFolder->AddPlaceholder("org.mitk.views.modules"); berry::IPlaceholderFolderLayout::Pointer rightFolder = layout->CreatePlaceholderFolder("right", berry::IPageLayout::RIGHT, 0.3f, editorArea); rightFolder->AddPlaceholder("org.mitk.views.datamanager"); layout->AddPerspectiveShortcut("org.mitk.qt.flowbenchapplication.defaultperspective"); } diff --git a/Plugins/org.mitk.gui.qt.flowbenchapplication/src/internal/perspectives/QmitkFlowBenchApplicationPerspective.h b/Plugins/org.mitk.gui.qt.flowbench.segmentation/src/internal/perspectives/QmitkFlowBenchSegmentationPerspective.h similarity index 70% rename from Plugins/org.mitk.gui.qt.flowbenchapplication/src/internal/perspectives/QmitkFlowBenchApplicationPerspective.h rename to Plugins/org.mitk.gui.qt.flowbench.segmentation/src/internal/perspectives/QmitkFlowBenchSegmentationPerspective.h index a196da06cb..991fe7ee5d 100644 --- a/Plugins/org.mitk.gui.qt.flowbenchapplication/src/internal/perspectives/QmitkFlowBenchApplicationPerspective.h +++ b/Plugins/org.mitk.gui.qt.flowbench.segmentation/src/internal/perspectives/QmitkFlowBenchSegmentationPerspective.h @@ -1,36 +1,36 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ -#ifndef QMITKFLOWBENCHAPPLICATIONPERSPECTIVE_H_ -#define QMITKFLOWBENCHAPPLICATIONPERSPECTIVE_H_ +#ifndef QMITKFLOWBENCHSEGMENTATIONPERSPECTIVE_H_ +#define QMITKFLOWBENCHSEGMENTATIONPERSPECTIVE_H_ #include -class QmitkFlowBenchApplicationPerspective : public QObject, public berry::IPerspectiveFactory +class QmitkFlowBenchSegmentationPerspective : public QObject, public berry::IPerspectiveFactory { Q_OBJECT Q_INTERFACES(berry::IPerspectiveFactory) public: - QmitkFlowBenchApplicationPerspective(); + QmitkFlowBenchSegmentationPerspective(); void CreateInitialLayout(berry::IPageLayout::Pointer layout) override; }; -#endif /* QMITKFLOWBENCHAPPLICATIONPERSPECTIVE_H_ */ +#endif /* QMITKFLOWBENCHSEGMENTATIONPERSPECTIVE_H_ */ diff --git a/Plugins/org.mitk.gui.qt.flowbenchapplication/files.cmake b/Plugins/org.mitk.gui.qt.flowbenchapplication/files.cmake index 9269788683..6022691dee 100644 --- a/Plugins/org.mitk.gui.qt.flowbenchapplication/files.cmake +++ b/Plugins/org.mitk.gui.qt.flowbenchapplication/files.cmake @@ -1,46 +1,42 @@ set(SRC_CPP_FILES ) set(INTERNAL_CPP_FILES QmitkFlowBenchApplication.cpp QmitkFlowBenchApplicationPlugin.cpp QmitkFlowBenchApplicationWorkbenchAdvisor.cpp QmitkFlowBenchApplicationWorkbenchWindowAdvisor.cpp - perspectives/QmitkFlowBenchApplicationPerspective.cpp QmitkExtFileSaveProjectAction.cpp ) set(MOC_H_FILES src/internal/QmitkFlowBenchApplication.h src/internal/QmitkFlowBenchApplicationPlugin.h - src/internal/perspectives/QmitkFlowBenchApplicationPerspective.h src/internal/QmitkFlowBenchApplicationWorkbenchWindowAdvisor.h src/internal/QmitkFlowBenchApplicationWorkbenchWindowAdvisorHack.h src/internal/QmitkExtFileSaveProjectAction.h ) set(CACHED_RESOURCE_FILES # list of resource files which can be used by the plug-in # system without loading the plug-ins shared library, # for example the icon used in the menu and tabs for the # plug-in views in the workbench plugin.xml resources/icon_research.xpm - resources/perspectives/eye.png - resources/perspectives/viewer_icon.png ) set(QRC_FILES resources/QmitkFlowBenchApplication.qrc ) set(CPP_FILES ) foreach(file ${SRC_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/${file}) endforeach(file ${SRC_CPP_FILES}) foreach(file ${INTERNAL_CPP_FILES}) set(CPP_FILES ${CPP_FILES} src/internal/${file}) endforeach(file ${INTERNAL_CPP_FILES}) diff --git a/Plugins/org.mitk.gui.qt.flowbenchapplication/plugin.xml b/Plugins/org.mitk.gui.qt.flowbenchapplication/plugin.xml index 7cc5061fc6..acd3ffa912 100644 --- a/Plugins/org.mitk.gui.qt.flowbenchapplication/plugin.xml +++ b/Plugins/org.mitk.gui.qt.flowbenchapplication/plugin.xml @@ -1,39 +1,30 @@ - - - - - diff --git a/Plugins/org.mitk.gui.qt.flowbenchapplication/resources/QmitkFlowBenchApplication.qrc b/Plugins/org.mitk.gui.qt.flowbenchapplication/resources/QmitkFlowBenchApplication.qrc index 2426e8d4e0..14b93f0a84 100644 --- a/Plugins/org.mitk.gui.qt.flowbenchapplication/resources/QmitkFlowBenchApplication.qrc +++ b/Plugins/org.mitk.gui.qt.flowbenchapplication/resources/QmitkFlowBenchApplication.qrc @@ -1,7 +1,5 @@ icon.png - perspectives/eye.png - perspectives/viewer_icon.png diff --git a/Plugins/org.mitk.gui.qt.flowbenchapplication/resources/perspectives/eye.png b/Plugins/org.mitk.gui.qt.flowbenchapplication/resources/perspectives/eye.png deleted file mode 100644 index 6e6e216171..0000000000 Binary files a/Plugins/org.mitk.gui.qt.flowbenchapplication/resources/perspectives/eye.png and /dev/null differ diff --git a/Plugins/org.mitk.gui.qt.flowbenchapplication/resources/perspectives/viewer_icon.png b/Plugins/org.mitk.gui.qt.flowbenchapplication/resources/perspectives/viewer_icon.png deleted file mode 100644 index f1e80ebb04..0000000000 Binary files a/Plugins/org.mitk.gui.qt.flowbenchapplication/resources/perspectives/viewer_icon.png and /dev/null differ diff --git a/Plugins/org.mitk.gui.qt.flowbenchapplication/src/internal/QmitkFlowBenchApplicationPlugin.cpp b/Plugins/org.mitk.gui.qt.flowbenchapplication/src/internal/QmitkFlowBenchApplicationPlugin.cpp index 29daa53c43..2666ccb8bf 100644 --- a/Plugins/org.mitk.gui.qt.flowbenchapplication/src/internal/QmitkFlowBenchApplicationPlugin.cpp +++ b/Plugins/org.mitk.gui.qt.flowbenchapplication/src/internal/QmitkFlowBenchApplicationPlugin.cpp @@ -1,215 +1,213 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "QmitkFlowBenchApplicationPlugin.h" -#include "perspectives/QmitkFlowBenchApplicationPerspective.h" #include "QmitkFlowBenchApplication.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include QmitkFlowBenchApplicationPlugin* QmitkFlowBenchApplicationPlugin::inst = nullptr; QmitkFlowBenchApplicationPlugin::QmitkFlowBenchApplicationPlugin() { inst = this; } QmitkFlowBenchApplicationPlugin::~QmitkFlowBenchApplicationPlugin() { } QmitkFlowBenchApplicationPlugin* QmitkFlowBenchApplicationPlugin::GetDefault() { return inst; } void QmitkFlowBenchApplicationPlugin::start(ctkPluginContext* context) { berry::AbstractUICTKPlugin::start(context); this->_context = context; QtWidgetsExtRegisterClasses(); - BERRY_REGISTER_EXTENSION_CLASS(QmitkFlowBenchApplicationPerspective, context); BERRY_REGISTER_EXTENSION_CLASS(QmitkFlowBenchApplication, context); ctkServiceReference cmRef = context->getServiceReference(); ctkConfigurationAdmin* configAdmin = nullptr; if (cmRef) { configAdmin = context->getService(cmRef); } // Use the CTK Configuration Admin service to configure the BlueBerry help system if (configAdmin) { ctkConfigurationPtr conf = configAdmin->getConfiguration("org.blueberry.services.help", QString()); ctkDictionary helpProps; helpProps.insert("homePage", "qthelp://org.mitk.gui.qt.flowbenchapplication/bundle/index.html"); conf->update(helpProps); context->ungetService(cmRef); } else { MITK_WARN << "Configuration Admin service unavailable, cannot set home page url."; } if (qApp->metaObject()->indexOfSignal("messageReceived(QByteArray)") > -1) { connect(qApp, SIGNAL(messageReceived(QByteArray)), this, SLOT(handleIPCMessage(QByteArray))); } // This is a potentially long running operation. loadDataFromDisk(berry::Platform::GetApplicationArgs(), true); } void QmitkFlowBenchApplicationPlugin::stop(ctkPluginContext* context) { Q_UNUSED(context) this->_context = nullptr; } ctkPluginContext* QmitkFlowBenchApplicationPlugin::GetPluginContext() const { return _context; } void QmitkFlowBenchApplicationPlugin::loadDataFromDisk(const QStringList &arguments, bool globalReinit) { if (!arguments.empty()) { ctkServiceReference serviceRef = _context->getServiceReference(); if (serviceRef) { mitk::IDataStorageService* dataStorageService = _context->getService(serviceRef); mitk::DataStorage::Pointer dataStorage = dataStorageService->GetDefaultDataStorage()->GetDataStorage(); int argumentsAdded = 0; for (int i = 0; i < arguments.size(); ++i) { if (arguments[i].startsWith("--flow.")) { //By convention no further files are specified as soon as a flow arguments comes. break; } else if (arguments[i].right(5) == ".mitk") { mitk::SceneIO::Pointer sceneIO = mitk::SceneIO::New(); bool clearDataStorageFirst(false); mitk::ProgressBar::GetInstance()->AddStepsToDo(2); dataStorage = sceneIO->LoadScene(arguments[i].toLocal8Bit().constData(), dataStorage, clearDataStorageFirst); mitk::ProgressBar::GetInstance()->Progress(2); argumentsAdded++; } else if (arguments[i].right(15) == ".mitksceneindex") { mitk::SceneIO::Pointer sceneIO = mitk::SceneIO::New(); bool clearDataStorageFirst(false); mitk::ProgressBar::GetInstance()->AddStepsToDo(2); dataStorage = sceneIO->LoadSceneUnzipped(arguments[i].toLocal8Bit().constData(), dataStorage, clearDataStorageFirst); mitk::ProgressBar::GetInstance()->Progress(2); argumentsAdded++; } else { try { const std::string path(arguments[i].toStdString()); auto addedNodes = mitk::IOUtil::Load(path, *dataStorage); for (auto const node : *addedNodes) { node->SetIntProperty("layer", argumentsAdded); } argumentsAdded++; } catch (...) { MITK_WARN << "Failed to load command line argument: " << arguments[i].toStdString(); } } } // end for each command line argument if (argumentsAdded > 0 && globalReinit) { // calculate bounding geometry mitk::RenderingManager::GetInstance()->InitializeViews(dataStorage->ComputeBoundingGeometry3D()); } } else { MITK_ERROR << "A service reference for mitk::IDataStorageService does not exist"; } } } void QmitkFlowBenchApplicationPlugin::handleIPCMessage(const QByteArray& msg) { QDataStream ds(msg); QString msgType; ds >> msgType; // we only handle messages containing command line arguments if (msgType != "$cmdLineArgs") return; // activate the current workbench window berry::IWorkbenchWindow::Pointer window = berry::PlatformUI::GetWorkbench()->GetActiveWorkbenchWindow(); QMainWindow* mainWindow = static_cast (window->GetShell()->GetControl()); mainWindow->setWindowState(mainWindow->windowState() & ~Qt::WindowMinimized); mainWindow->raise(); mainWindow->activateWindow(); // Get the preferences for the instantiation behavior berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService(); berry::IPreferences::Pointer prefs = prefService->GetSystemPreferences()->Node("/General"); bool newInstanceAlways = prefs->GetBool("newInstance.always", false); bool newInstanceScene = prefs->GetBool("newInstance.scene", true); QStringList args; ds >> args; loadDataFromDisk(args, false); } \ No newline at end of file