diff --git a/CMake/BuildConfigurations/Default.cmake b/CMake/BuildConfigurations/Default.cmake
index 4faffa7f12..700e7efd48 100644
--- a/CMake/BuildConfigurations/Default.cmake
+++ b/CMake/BuildConfigurations/Default.cmake
@@ -1,23 +1,24 @@
set(MITK_CONFIG_PACKAGES
ACVD
Qt5
BLUEBERRY
)
set(MITK_CONFIG_PLUGINS
org.mitk.gui.qt.mitkworkbench.intro
org.mitk.gui.qt.datamanager
org.mitk.gui.qt.stdmultiwidgeteditor
org.mitk.gui.qt.dicombrowser
org.mitk.gui.qt.imagenavigator
org.mitk.gui.qt.measurementtoolbox
org.mitk.gui.qt.properties
org.mitk.gui.qt.segmentation
org.mitk.gui.qt.volumevisualization
org.mitk.planarfigure
org.mitk.gui.qt.moviemaker
org.mitk.gui.qt.pointsetinteraction
org.mitk.gui.qt.remeshing
org.mitk.gui.qt.viewnavigator
org.mitk.gui.qt.imagecropper
+ org.mitk.gui.qt.pixelvalue
)
diff --git a/CMake/BuildConfigurations/FlowBenchSegmentation.cmake b/CMake/BuildConfigurations/FlowBenchSegmentation.cmake
index 1bfc32cafe..9731309ef7 100644
--- a/CMake/BuildConfigurations/FlowBenchSegmentation.cmake
+++ b/CMake/BuildConfigurations/FlowBenchSegmentation.cmake
@@ -1,14 +1,13 @@
set(MITK_CONFIG_PACKAGES
Qt5
BLUEBERRY
)
set(MITK_BUILD_APP_FlowBench ON CACHE BOOL "Build MITK FlowBench" FORCE)
set(MITK_CONFIG_PLUGINS
org.mitk.gui.qt.stdmultiwidgeteditor
org.mitk.gui.qt.imagenavigator
org.mitk.gui.qt.properties
- org.mitk.gui.qt.multilabelsegmentation
org.mitk.gui.qt.flow.segmentation
)
diff --git a/CMake/BuildConfigurations/WorkbenchRelease.cmake b/CMake/BuildConfigurations/WorkbenchRelease.cmake
index a0742477e2..db7bf09cd6 100644
--- a/CMake/BuildConfigurations/WorkbenchRelease.cmake
+++ b/CMake/BuildConfigurations/WorkbenchRelease.cmake
@@ -1,29 +1,28 @@
include(${CMAKE_CURRENT_LIST_DIR}/Default.cmake)
set(MITK_CONFIG_PACKAGES ${MITK_CONFIG_PACKAGES}
MatchPoint
)
set(MITK_CONFIG_PLUGINS ${MITK_CONFIG_PLUGINS}
- org.mitk.gui.qt.multilabelsegmentation
org.mitk.matchpoint.core.helper
org.mitk.gui.qt.matchpoint.algorithm.browser
org.mitk.gui.qt.matchpoint.algorithm.control
org.mitk.gui.qt.matchpoint.mapper
org.mitk.gui.qt.matchpoint.framereg
org.mitk.gui.qt.matchpoint.visualizer
org.mitk.gui.qt.matchpoint.evaluator
org.mitk.gui.qt.matchpoint.manipulator
)
if(NOT MITK_USE_SUPERBUILD)
set(BUILD_CoreCmdApps ON CACHE BOOL "" FORCE)
set(BUILD_MatchPointCmdApps ON CACHE BOOL "" FORCE)
endif()
set(MITK_VTK_DEBUG_LEAKS OFF CACHE BOOL "Enable VTK Debug Leaks" FORCE)
find_package(Doxygen REQUIRED)
# Ensure that the in-application help can be build
set(BLUEBERRY_QT_HELP_REQUIRED ON CACHE BOOL "Required Qt help documentation in plug-ins" FORCE)
diff --git a/CMake/Whitelists/FlowBenchSegmentation.cmake b/CMake/Whitelists/FlowBenchSegmentation.cmake
index 36bf724a76..60c1587601 100644
--- a/CMake/Whitelists/FlowBenchSegmentation.cmake
+++ b/CMake/Whitelists/FlowBenchSegmentation.cmake
@@ -1,56 +1,55 @@
set(enabled_modules
Core
CppMicroServices
DICOM
DICOMPM
DataTypesExt
AlgorithmsExt
DICOMQI
Multilabel
SceneSerializationBase
DICOMPMIO
DICOMImageIO
ContourModel
DICOMSegIO
LegacyGL
MapperExt
SceneSerialization
LegacyIO
IOExt
MultilabelIO
AppUtil
QtWidgets
QtWidgetsExt
Segmentation
SegmentationUI
PlanarFigure
Annotation
SurfaceInterpolation
GraphAlgorithms
ImageExtraction
ImageStatistics
)
set(enabled_plugins
org.blueberry.core.commands
org.blueberry.core.expressions
org.blueberry.core.runtime
org.blueberry.ui.qt
org.blueberry.ui.qt.help
org.blueberry.ui.qt.log
org.mitk.core.ext
org.mitk.core.services
org.mitk.gui.common
org.mitk.gui.qt.application
org.mitk.gui.qt.common
org.mitk.gui.qt.datamanager
org.mitk.gui.qt.ext
org.mitk.gui.qt.flow.segmentation
org.mitk.gui.qt.flowapplication
org.mitk.gui.qt.imagenavigator
-org.mitk.gui.qt.multilabelsegmentation
org.mitk.gui.qt.properties
org.mitk.gui.qt.segmentation
org.mitk.gui.qt.stdmultiwidgeteditor
org.mitk.planarfigure
)
diff --git a/Documentation/Doxygen/2-UserManual/MITKPluginManualsList.dox b/Documentation/Doxygen/2-UserManual/MITKPluginManualsList.dox
index e86649fb1c..018001bdbb 100644
--- a/Documentation/Doxygen/2-UserManual/MITKPluginManualsList.dox
+++ b/Documentation/Doxygen/2-UserManual/MITKPluginManualsList.dox
@@ -1,64 +1,63 @@
/**
\page PluginListPage MITK Plugin Manuals
The plugins and bundles provide much of the extended functionality of MITK. Each encapsulates a solution to a problem and associated features. This way one can easily assemble the necessary capabilites for a workflow without adding a lot of bloat, by combining plugins as needed.
- \subpage org_mitk_views_basicimageprocessing
- \subpage org_mitk_views_datamanager
- \subpage org_mitk_editors_dicombrowser
- \subpage org_mitk_views_dicominspector
- \subpage org_mitk_views_imagecropper
- \subpage org_mitk_views_imagenavigator
- \subpage org_blueberry_views_logview
- \subpage org_mitk_views_matchpoint_algorithm_browser
- \subpage org_mitk_views_matchpoint_algorithm_control
- \subpage org_mitk_views_matchpoint_evaluator
- \subpage org_mitk_views_matchpoint_framereg
- \subpage org_mitk_views_matchpoint_manipulator
- \subpage org_mitk_views_matchpoint_mapper
- \subpage org_mitk_views_matchpoint_visualizer
- \subpage org_mitk_views_measurement
- \subpage org_mitk_views_imagestatistics
- \subpage org_mitk_views_moviemaker
- - \subpage org_mitk_views_multilabelsegmentation
- \subpage org_mitk_views_pointsetinteraction
- \subpage org_mitk_views_python
- \subpage org_mitk_views_remeshing
- \subpage org_mitk_views_screenshotmaker
- \subpage org_mitk_views_segmentation
- \subpage org_mitk_editors_stdmultiwidget
- \subpage org_mitk_views_deformableclippingplane
- - \subpage org_mitk_views_viewnavigatorview
+ - \subpage org_mitk_views_viewnavigator
- \subpage org_mitk_views_volumevisualization
- \subpage org_mitk_views_properties
- \subpage org_mitk_gui_qt_flowapplication
- \subpage org_mitk_gui_qt_aicpregistration
- \subpage org_mitk_gui_qt_cest
- \subpage org_mitk_gui_qt_classificationsegmentation
- \subpage org_mitk_views_cmdlinemodules
- \subpage org_mitk_views_pharmacokinetics_concentration_mri
- \subpage org_mitk_views_pharmacokinetics_mri
- \subpage org_mitk_views_pharmacokinetics_pet
- \subpage org_mitk_gui_qt_examples
- \subpage org_mitk_gui_qt_geometrytools
- \subpage org_mitk_gui_qt_igtexample
- \subpage org_mitk_gui_qt_igttracking
- \subpage org_mitk_views_igttrackingsemiautomaticmeasurement
- \subpage org_mitk_views_fit_demo
- \subpage org_mitk_views_fit_genericfitting
- \subpage org_mitk_views_fit_inspector
- \subpage org_mitkexamplesopencv
- \subpage org_mitk_gui_qt_overlaymanager
- \subpage org_mitk_gui_qt_mitkphenotyping
- \subpage org_mitk_gui_qt_preprocessing_resampling
- \subpage org_mitk_views_pharmacokinetics_curvedescriptor
- \subpage org_mitk_gui_qt_pharmacokinetics_simulation
- \subpage org_surfacematerialeditor
- \subpage org_toftutorial
- \subpage org_blueberry_ui_qt_objectinspector
- \subpage org_mitk_gui_qt_ultrasound
- \subpage org_mitk_gui_qt_xnat
*/
diff --git a/Examples/Plugins/org.mitk.example.gui.customviewer.views/src/internal/SimpleRenderWindowView.cpp b/Examples/Plugins/org.mitk.example.gui.customviewer.views/src/internal/SimpleRenderWindowView.cpp
index d503701503..e14078520e 100644
--- a/Examples/Plugins/org.mitk.example.gui.customviewer.views/src/internal/SimpleRenderWindowView.cpp
+++ b/Examples/Plugins/org.mitk.example.gui.customviewer.views/src/internal/SimpleRenderWindowView.cpp
@@ -1,202 +1,212 @@
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#include "SimpleRenderWindowView.h"
#include
#include "org_mitk_example_gui_customviewer_views_Activator.h"
#include
#include
#include
#include
#include
#include
#include
/**
* \brief Helper class adapted from QmitkAbstractRenderEditor by defining the correct plugin context.
*
* This helper class adapted from QmitkAbstractRenderEditor provides the rendering manager interface.
*/
// //! [SimpleRenderWindowViewHelper]
class AbstractRenderWindowViewPrivate
{
public:
AbstractRenderWindowViewPrivate()
: m_RenderingManagerInterface(mitk::MakeRenderingManagerInterface(mitk::RenderingManager::GetInstance())),
m_PrefServiceTracker(org_mitk_example_gui_customviewer_views_Activator::GetPluginContext())
// //! [SimpleRenderWindowViewHelper]
{
m_PrefServiceTracker.open();
}
~AbstractRenderWindowViewPrivate() { delete m_RenderingManagerInterface; }
mitk::IRenderingManager *m_RenderingManagerInterface;
ctkServiceTracker m_PrefServiceTracker;
berry::IBerryPreferences::Pointer m_Prefs;
};
const std::string SimpleRenderWindowView::VIEW_ID = "org.mitk.customviewer.views.simplerenderwindowview";
SimpleRenderWindowView::SimpleRenderWindowView() : m_RenderWindow(nullptr), d(new AbstractRenderWindowViewPrivate)
{
}
SimpleRenderWindowView::~SimpleRenderWindowView()
{
}
QmitkRenderWindow *SimpleRenderWindowView::GetActiveQmitkRenderWindow() const
{
return m_RenderWindow;
}
QHash SimpleRenderWindowView::GetRenderWindows() const
{
QHash wnds;
wnds.insert("axial", m_RenderWindow);
return wnds;
}
QHash SimpleRenderWindowView::GetQmitkRenderWindows() const
{
QHash wnds;
wnds.insert("axial", m_RenderWindow);
return wnds;
}
QmitkRenderWindow *SimpleRenderWindowView::GetRenderWindow(const QString &id) const
{
if (id == "axial")
{
return m_RenderWindow;
}
return nullptr;
}
QmitkRenderWindow *SimpleRenderWindowView::GetQmitkRenderWindow(const QString &id) const
{
if (id == "axial")
{
return m_RenderWindow;
}
return nullptr;
}
QmitkRenderWindow *SimpleRenderWindowView::GetQmitkRenderWindow(const mitk::BaseRenderer::ViewDirection &viewDirection) const
{
if (viewDirection == mitk::BaseRenderer::ViewDirection::AXIAL)
{
return m_RenderWindow;
}
return 0;
}
void SimpleRenderWindowView::SetFocus()
{
m_RenderWindow->setFocus();
}
// //! [SimpleRenderWindowViewCreatePartControl]
void SimpleRenderWindowView::CreateQtPartControl(QWidget *parent)
{
QVBoxLayout *layout = new QVBoxLayout(parent);
layout->setContentsMargins(0, 0, 0, 0);
m_RenderWindow = new QmitkRenderWindow(parent);
layout->addWidget(m_RenderWindow);
mitk::DataStorage::Pointer ds = this->GetDataStorage();
m_RenderWindow->GetRenderer()->SetDataStorage(ds);
this->RequestUpdate();
}
// //! [SimpleRenderWindowViewCreatePartControl]
mitk::IRenderingManager *SimpleRenderWindowView::GetRenderingManager() const
{
// we use the global rendering manager here. This should maybe replaced
// by a local one, managing only the render windows specific for the view
return d->m_RenderingManagerInterface;
}
void SimpleRenderWindowView::RequestUpdate(mitk::RenderingManager::RequestType requestType)
{
if (GetRenderingManager())
GetRenderingManager()->RequestUpdateAll(requestType);
}
void SimpleRenderWindowView::ForceImmediateUpdate(mitk::RenderingManager::RequestType requestType)
{
if (GetRenderingManager())
GetRenderingManager()->ForceImmediateUpdateAll(requestType);
}
+void SimpleRenderWindowView::SetReferenceGeometry(const mitk::TimeGeometry* /*referenceGeometry*/, bool /*resetCamera*/)
+{
+ // not implemented
+}
+
+bool SimpleRenderWindowView::HasCoupledRenderWindows() const
+{
+ return false;
+}
+
mitk::SliceNavigationController *SimpleRenderWindowView::GetTimeNavigationController() const
{
if (GetRenderingManager())
return GetRenderingManager()->GetTimeNavigationController();
return nullptr;
}
mitk::Point3D SimpleRenderWindowView::GetSelectedPosition(const QString& /*id*/) const
{
const mitk::PlaneGeometry* pg = m_RenderWindow->GetSliceNavigationController()->GetCurrentPlaneGeometry();
if (pg)
{
return pg->GetCenter();
}
else
{
return mitk::Point3D();
}
}
void SimpleRenderWindowView::SetSelectedPosition(const mitk::Point3D&, const QString&)
{
}
mitk::TimePointType SimpleRenderWindowView::GetSelectedTimePoint(const QString& /*id*/) const
{
auto timeNavigator = this->GetTimeNavigationController();
if (nullptr != timeNavigator)
{
return timeNavigator->GetSelectedTimePoint();
}
return 0;
}
void SimpleRenderWindowView::EnableDecorations(bool enable, const QStringList& decorations)
{
if (decorations.isEmpty() || decorations.contains(DECORATION_MENU))
{
m_RenderWindow->ActivateMenuWidget(enable);
}
}
bool SimpleRenderWindowView::IsDecorationEnabled(const QString& decoration) const
{
if (decoration == DECORATION_MENU)
{
return m_RenderWindow->GetActivateMenuWidgetFlag();
}
return false;
}
QStringList SimpleRenderWindowView::GetDecorations() const
{
QStringList decorations;
decorations << DECORATION_MENU;
return decorations;
}
diff --git a/Examples/Plugins/org.mitk.example.gui.customviewer.views/src/internal/SimpleRenderWindowView.h b/Examples/Plugins/org.mitk.example.gui.customviewer.views/src/internal/SimpleRenderWindowView.h
index 7ef01d3d9a..ac3b152408 100644
--- a/Examples/Plugins/org.mitk.example.gui.customviewer.views/src/internal/SimpleRenderWindowView.h
+++ b/Examples/Plugins/org.mitk.example.gui.customviewer.views/src/internal/SimpleRenderWindowView.h
@@ -1,147 +1,157 @@
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#ifndef SimpleRenderWindowView_H_
#define SimpleRenderWindowView_H_
#include
#include
#include
class QmitkRenderWindow;
class AbstractRenderWindowViewPrivate;
/**
* \brief A view class suited for the ViewerPerspective within the custom viewer plug-in.
*
* This view class contributes data node rendering functionality to the ViewerPerspective.
* Being a subclass of QmitkAbstractView, this class yields access to the data storage and
* thus is interconnected with the mitk::QmitkDataManagerView present in the same perspective.
* As a subclass of mitk::IRenderWindowPart, this class provides an instance of QmitkRenderWindow.
* A SimpleRenderWindowView instance is part of the ViewerPerspective for data visualization.
*/
// //! [SimpleRenderWindowViewDeclaration]
class SimpleRenderWindowView : public QmitkAbstractView, public mitk::IRenderWindowPart
// //! [SimpleRenderWindowViewDeclaration]
{
Q_OBJECT
public:
/**
* Standard constructor.
*/
SimpleRenderWindowView();
~SimpleRenderWindowView() override;
/**
* String based view identifier.
*/
static const std::string VIEW_ID;
berryObjectMacro(SimpleRenderWindowView);
// ------------------- mitk::IRenderWindowPart ----------------------
/**
* \see mitk::IRenderWindowPart::GetActiveQmitkRenderWindow()
*/
QmitkRenderWindow *GetActiveQmitkRenderWindow() const override;
QHash GetRenderWindows() const;
/**
* \see mitk::IRenderWindowPart::GetQmitkRenderWindows()
*/
QHash GetQmitkRenderWindows() const override;
QmitkRenderWindow *GetRenderWindow(const QString &id) const;
/**
* \see mitk::IRenderWindowPart::GetQmitkRenderWindow(QString)
*/
QmitkRenderWindow *GetQmitkRenderWindow(const QString &id) const override;
/**
* \see mitk::IRenderWindowPart::GetQmitkRenderWindow(mitk::BaseRenderer::ViewDirection)
*/
QmitkRenderWindow *GetQmitkRenderWindow(const mitk::BaseRenderer::ViewDirection &viewDirection) const override;
/**
* \see mitk::QmitkAbstractRenderEditor::GetRenderingManager()
*/
mitk::IRenderingManager *GetRenderingManager() const override;
/**
* \see mitk::QmitkAbstractRenderEditor::RequestUpdate()
*/
void RequestUpdate(
mitk::RenderingManager::RequestType requestType = mitk::RenderingManager::REQUEST_UPDATE_ALL) override;
/**
* \see mitk::QmitkAbstractRenderEditor::ForceImmediateUpdate()
*/
void ForceImmediateUpdate(mitk::RenderingManager::RequestType) override;
/**
- * \see mitk::QmitkAbstractRenderEditor::GetTimeNavigationController()
+ * \see mitk::IRenderWindowPart::SetReferenceGeometry()
+ */
+ void SetReferenceGeometry(const mitk::TimeGeometry* referenceGeometry, bool resetCamera) override;
+
+ /**
+ * \see mitk::IRenderWindowPart::HasCoupledRenderWindows
+ */
+ bool HasCoupledRenderWindows() const override;
+
+ /**
+ * \see mitk::IRenderWindowPart::GetTimeNavigationController()
*/
mitk::SliceNavigationController *GetTimeNavigationController() const override;
/**
* \see mitk::IRenderWindowPart::GetSelectionPosition()
*/
mitk::Point3D GetSelectedPosition(const QString& id = QString()) const override;
/**
* \see mitk::IRenderWindowPart::SetSelectedPosition()
*/
void SetSelectedPosition(const mitk::Point3D& pos, const QString& id = QString()) override;
/**
* \see mitk::IRenderWindowPart::GetSelectedTimePoint()
*/
mitk::TimePointType GetSelectedTimePoint(const QString& id = QString()) const override;
/**
* \see mitk::IRenderWindowPart::EnableDecorations()
*/
void EnableDecorations(bool enable, const QStringList& decorations = QStringList()) override;
/**
* \see mitk::IRenderWindowPart::IsDecorationEnabled()
*/
bool IsDecorationEnabled(const QString& decoration) const override;
/**
* \see mitk::IRenderWindowPart::GetDecorations()
*/
QStringList GetDecorations() const override;
protected:
void SetFocus() override;
/**
* Creates the QmitkRenderWindow whose renderer is being connected to the view's data storage.
*/
void CreateQtPartControl(QWidget *parent) override;
private:
/**
* The view's render window.
*/
QmitkRenderWindow *m_RenderWindow;
QScopedPointer d;
};
#endif /*SimpleRenderWindowView_H_*/
diff --git a/Modules/AppUtil/src/mitkBaseApplication.cpp b/Modules/AppUtil/src/mitkBaseApplication.cpp
index 0b8cfb0814..6f7254574e 100644
--- a/Modules/AppUtil/src/mitkBaseApplication.cpp
+++ b/Modules/AppUtil/src/mitkBaseApplication.cpp
@@ -1,885 +1,889 @@
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
namespace
{
void outputQtMessage(QtMsgType type, const QMessageLogContext&, const QString& msg)
{
auto message = msg.toStdString();
switch (type)
{
case QtDebugMsg:
MITK_DEBUG << message;
break;
case QtInfoMsg:
MITK_INFO << message;
break;
case QtWarningMsg:
MITK_WARN << message;
break;
case QtCriticalMsg:
MITK_ERROR << message;
break;
case QtFatalMsg:
MITK_ERROR << message;
abort();
default:
MITK_INFO << message;
break;
}
}
}
namespace mitk
{
const QString BaseApplication::ARG_APPLICATION = "BlueBerry.application";
const QString BaseApplication::ARG_CLEAN = "BlueBerry.clean";
const QString BaseApplication::ARG_CONSOLELOG = "BlueBerry.consoleLog";
const QString BaseApplication::ARG_DEBUG = "BlueBerry.debug";
const QString BaseApplication::ARG_FORCE_PLUGIN_INSTALL = "BlueBerry.forcePlugins";
const QString BaseApplication::ARG_HOME = "BlueBerry.home";
const QString BaseApplication::ARG_NEWINSTANCE = "BlueBerry.newInstance";
const QString BaseApplication::ARG_NO_LAZY_REGISTRY_CACHE_LOADING = "BlueBerry.noLazyRegistryCacheLoading";
const QString BaseApplication::ARG_NO_REGISTRY_CACHE = "BlueBerry.noRegistryCache";
const QString BaseApplication::ARG_PLUGIN_CACHE = "BlueBerry.plugin_cache_dir";
const QString BaseApplication::ARG_PLUGIN_DIRS = "BlueBerry.plugin_dirs";
const QString BaseApplication::ARG_PRELOAD_LIBRARY = "BlueBerry.preloadLibrary";
const QString BaseApplication::ARG_PRODUCT = "BlueBerry.product";
const QString BaseApplication::ARG_PROVISIONING = "BlueBerry.provisioning";
const QString BaseApplication::ARG_REGISTRY_MULTI_LANGUAGE = "BlueBerry.registryMultiLanguage";
const QString BaseApplication::ARG_SPLASH_IMAGE = "BlueBerry.splashscreen";
const QString BaseApplication::ARG_STORAGE_DIR = "BlueBerry.storageDir";
const QString BaseApplication::ARG_XARGS = "xargs";
const QString BaseApplication::ARG_LOG_QT_MESSAGES = "Qt.logMessages";
const QString BaseApplication::ARG_SEGMENTATION_LABELSET_PRESET = "Segmentation.labelSetPreset";
const QString BaseApplication::ARG_SEGMENTATION_LABEL_SUGGESTIONS = "Segmentation.labelSuggestions";
const QString BaseApplication::PROP_APPLICATION = "blueberry.application";
const QString BaseApplication::PROP_FORCE_PLUGIN_INSTALL = BaseApplication::ARG_FORCE_PLUGIN_INSTALL;
const QString BaseApplication::PROP_NEWINSTANCE = BaseApplication::ARG_NEWINSTANCE;
const QString BaseApplication::PROP_NO_LAZY_REGISTRY_CACHE_LOADING = BaseApplication::ARG_NO_LAZY_REGISTRY_CACHE_LOADING;
const QString BaseApplication::PROP_NO_REGISTRY_CACHE = BaseApplication::ARG_NO_REGISTRY_CACHE;
const QString BaseApplication::PROP_PRODUCT = "blueberry.product";
const QString BaseApplication::PROP_REGISTRY_MULTI_LANGUAGE = BaseApplication::ARG_REGISTRY_MULTI_LANGUAGE;
class SplashCloserCallback : public QRunnable
{
public:
SplashCloserCallback(QSplashScreen* splashscreen)
: m_Splashscreen(splashscreen)
{
}
void run() override
{
this->m_Splashscreen->close();
}
private:
QSplashScreen *m_Splashscreen; // Owned by BaseApplication::Impl
};
struct BaseApplication::Impl
{
ctkProperties m_FWProps;
QCoreApplication *m_QApp;
int m_Argc;
char **m_Argv;
#ifdef Q_OS_MAC
std::vector m_Argv_macOS;
#endif
QString m_AppName;
QString m_OrgaName;
QString m_OrgaDomain;
bool m_SingleMode;
bool m_SafeMode;
QSplashScreen *m_Splashscreen;
SplashCloserCallback *m_SplashscreenClosingCallback;
bool m_LogQtMessages;
QStringList m_PreloadLibs;
QString m_ProvFile;
Impl(int argc, char **argv)
: m_Argc(argc),
m_Argv(argv),
#ifdef Q_OS_MAC
m_Argv_macOS(),
#endif
m_SingleMode(false),
m_SafeMode(true),
m_Splashscreen(nullptr),
m_SplashscreenClosingCallback(nullptr),
m_LogQtMessages(false)
{
#ifdef Q_OS_MAC
/* On macOS the process serial number is passed as an command line argument (-psn_)
in certain circumstances. This option causes a Poco exception. We remove it, if present. */
m_Argv_macOS.reserve(argc + 1);
const char psn[] = "-psn";
for (int i = 0; i < argc; ++i)
{
if (0 == strncmp(argv[i], psn, sizeof(psn) - 1))
continue;
m_Argv_macOS.push_back(argv[i]);
}
m_Argv_macOS.push_back(nullptr);
m_Argc = static_cast(m_Argv_macOS.size() - 1);
m_Argv = m_Argv_macOS.data();
#endif
}
~Impl()
{
delete m_SplashscreenClosingCallback;
delete m_Splashscreen;
delete m_QApp;
}
QVariant getProperty(const QString &property) const
{
auto iter = m_FWProps.find(property);
return m_FWProps.end() != iter
? iter.value()
: QVariant();
}
void handleBooleanOption(const std::string &name, const std::string &)
{
if (ARG_LOG_QT_MESSAGES.toStdString() == name)
{
m_LogQtMessages = true;
return;
}
auto fwKey = QString::fromStdString(name);
// Translate some keys to proper framework properties
if (ARG_CONSOLELOG == fwKey)
fwKey = ctkPluginFrameworkLauncher::PROP_CONSOLE_LOG;
// For all other options we use the command line option name as the
// framework property key.
m_FWProps[fwKey] = true;
}
void handlePreloadLibraryOption(const std::string &, const std::string &value)
{
m_PreloadLibs.push_back(QString::fromStdString(value));
}
void handleClean(const std::string &, const std::string &)
{
m_FWProps[ctkPluginConstants::FRAMEWORK_STORAGE_CLEAN] = ctkPluginConstants::FRAMEWORK_STORAGE_CLEAN_ONFIRSTINIT;
}
void initializeCTKPluginFrameworkProperties(Poco::Util::LayeredConfiguration &configuration)
{
// Add all configuration key/value pairs as framework properties
Poco::Util::LayeredConfiguration::Keys keys;
Poco::Util::LayeredConfiguration::Keys keyStack;
configuration.keys(keyStack);
std::vector keyChain;
while (!keyStack.empty())
{
const auto currSubKey = keyStack.back();
if (!keyChain.empty() && keyChain.back() == currSubKey)
{
keyChain.pop_back();
keyStack.pop_back();
continue;
}
Poco::Util::LayeredConfiguration::Keys subKeys;
configuration.keys(currSubKey, subKeys);
if (subKeys.empty())
{
std::string finalKey;
keyStack.pop_back();
for (const auto& key : keyChain)
finalKey += key + '.';
finalKey += currSubKey;
keys.push_back(finalKey);
}
else
{
keyChain.push_back(currSubKey);
for (const auto& key : subKeys)
keyStack.push_back(key);
}
}
for (const auto& key : keys)
{
if (configuration.hasProperty(key))
{
// .ini and command line options overwrite already inserted keys
auto qKey = QString::fromStdString(key);
m_FWProps[qKey] = QString::fromStdString(configuration.getString(key));
}
}
}
void parseProvisioningFile(const QString &filePath)
{
// Skip parsing if the file path is empty
if (filePath.isEmpty())
return;
auto consoleLog = this->getProperty(ctkPluginFrameworkLauncher::PROP_CONSOLE_LOG).toBool();
// Read initial plugins from a provisioning file
QFileInfo provFile(filePath);
QStringList pluginsToStart;
if (provFile.exists())
{
MITK_INFO(consoleLog) << "Using provisioning file: " << qPrintable(provFile.absoluteFilePath());
ProvisioningInfo provInfo(provFile.absoluteFilePath());
// It can still happen that the encoding is not compatible with the fromUtf8 function (i.e. when
// manipulating the LANG variable). The QStringList in provInfo is empty then.
if (provInfo.getPluginDirs().empty())
{
MITK_ERROR << "Cannot search for provisioning file, the retrieved directory list is empty.\n"
<< "This can happen if there are some special non-ASCII characters in the install path.";
}
else
{
for(const auto& pluginPath : provInfo.getPluginDirs())
ctkPluginFrameworkLauncher::addSearchPath(pluginPath);
auto pluginUrlsToStart = provInfo.getPluginsToStart();
for (const auto& url : qAsConst(pluginUrlsToStart))
pluginsToStart.push_back(url.toString());
}
}
else
{
MITK_INFO(consoleLog) << "Provisionig file does not exist.";
}
if (!pluginsToStart.isEmpty())
{
m_FWProps[ctkPluginFrameworkLauncher::PROP_PLUGINS] = pluginsToStart;
// Use transient start with declared activation policy (this helps when the provisioning file
// changes and some plug-ins should not be installed in the application any more).
ctkPlugin::StartOptions startOptions(ctkPlugin::START_TRANSIENT | ctkPlugin::START_ACTIVATION_POLICY);
m_FWProps[ctkPluginFrameworkLauncher::PROP_PLUGINS_START_OPTIONS] = static_cast(startOptions);
}
}
};
BaseApplication::BaseApplication(int argc, char **argv)
: Application(),
d(new Impl(argc, argv))
{
}
BaseApplication::~BaseApplication()
{
delete d;
}
void BaseApplication::printHelp(const std::string &, const std::string &)
{
Poco::Util::HelpFormatter help(this->options());
help.setAutoIndent();
help.setCommand(this->commandName());
help.format(std::cout);
exit(EXIT_OK);
}
void BaseApplication::setApplicationName(const QString &name)
{
if (nullptr != qApp)
qApp->setApplicationName(name);
d->m_AppName = name;
}
QString BaseApplication::getApplicationName() const
{
return nullptr != qApp
? qApp->applicationName()
: d->m_AppName;
}
void BaseApplication::setOrganizationName(const QString &name)
{
if (nullptr != qApp)
qApp->setOrganizationName(name);
d->m_OrgaName = name;
}
QString BaseApplication::getOrganizationName() const
{
return nullptr != qApp
? qApp->organizationName()
: d->m_OrgaName;
}
void BaseApplication::setOrganizationDomain(const QString &domain)
{
if (nullptr != qApp)
qApp->setOrganizationDomain(domain);
d->m_OrgaDomain = domain;
}
QString BaseApplication::getOrganizationDomain() const
{
return nullptr != qApp
? qApp->organizationDomain()
: d->m_OrgaDomain;
}
void BaseApplication::setSingleMode(bool singleMode)
{
if (nullptr != qApp)
return;
d->m_SingleMode = singleMode;
}
bool BaseApplication::getSingleMode() const
{
return d->m_SingleMode;
}
void BaseApplication::setSafeMode(bool safeMode)
{
if (nullptr != qApp && nullptr == d->m_QApp)
return;
d->m_SafeMode = safeMode;
nullptr == d->m_QApp && getSingleMode()
? static_cast(d->m_QApp)->setSafeMode(safeMode)
: static_cast(d->m_QApp)->setSafeMode(safeMode);
}
bool BaseApplication::getSafeMode() const
{
return d->m_SafeMode;
}
void BaseApplication::setPreloadLibraries(const QStringList &libraryBaseNames)
{
d->m_PreloadLibs = libraryBaseNames;
}
QStringList BaseApplication::getPreloadLibraries() const
{
return d->m_PreloadLibs;
}
void BaseApplication::setProvisioningFilePath(const QString &filePath)
{
d->m_ProvFile = filePath;
}
QString BaseApplication::getProvisioningFilePath() const
{
auto provFilePath = d->m_ProvFile;
// A null QString means look up a default provisioning file
if (provFilePath.isNull() && nullptr != qApp)
{
QFileInfo appFilePath(QCoreApplication::applicationFilePath());
QDir basePath(QCoreApplication::applicationDirPath());
auto provFileName = appFilePath.baseName() + ".provisioning";
QFileInfo provFile(basePath.absoluteFilePath(provFileName));
#ifdef Q_OS_MAC
/*
* On macOS, if started from the build directory, the .provisioning file is located at:
*
* The executable path is:
*
* In this case we have to cdUp threetimes.
*
* During packaging the MitkWorkbench.provisioning file is placed at the same
* level like the executable. Nothing has to be done.
*/
if (!provFile.exists())
{
basePath.cdUp();
basePath.cdUp();
basePath.cdUp();
provFile = basePath.absoluteFilePath(provFileName);
}
#endif
if (provFile.exists())
{
provFilePath = provFile.absoluteFilePath();
}
#ifdef CMAKE_INTDIR
else
{
basePath.cdUp();
provFile.setFile(basePath.absoluteFilePath(provFileName));
if (provFile.exists())
provFilePath = provFile.absoluteFilePath();
}
#endif
}
return provFilePath;
}
void BaseApplication::initializeQt()
{
if (nullptr != qApp)
return;
+#ifdef Q_OS_LINUX
+ qputenv("QTWEBENGINE_CHROMIUM_FLAGS", "--single-process"); // See T29332
+#endif
+
// If parameters have been set before, we have to store them to hand them
// through to the application
auto appName = this->getApplicationName();
auto orgName = this->getOrganizationName();
auto orgDomain = this->getOrganizationDomain();
// Create a QCoreApplication instance
this->getQApplication();
// Provide parameters to QCoreApplication
this->setApplicationName(appName);
this->setOrganizationName(orgName);
this->setOrganizationDomain(orgDomain);
if (d->m_LogQtMessages)
qInstallMessageHandler(outputQtMessage);
QWebEngineUrlScheme qtHelpScheme("qthelp");
qtHelpScheme.setFlags(QWebEngineUrlScheme::LocalScheme | QWebEngineUrlScheme::LocalAccessAllowed);
QWebEngineUrlScheme::registerScheme(qtHelpScheme);
}
void BaseApplication::initialize(Poco::Util::Application &self)
{
// 1. Call the super-class method
Poco::Util::Application::initialize(self);
// 2. Initialize the Qt framework (by creating a QCoreApplication)
this->initializeQt();
// 3. Seed the random number generator, once at startup.
QTime time = QTime::currentTime();
qsrand((uint)time.msec());
// 4. Load the "default" configuration, which involves parsing
// an optional .ini file and parsing any
// command line arguments
this->loadConfiguration();
// 5. Add configuration data from the command line and the
// optional .ini file as CTK plugin
// framework properties.
d->initializeCTKPluginFrameworkProperties(this->config());
// 6. Initialize splash screen if an image path is provided
// in the .ini file
this->initializeSplashScreen(qApp);
// 7. Set the custom CTK Plugin Framework storage directory
QString storageDir = this->getCTKFrameworkStorageDir();
if (!storageDir.isEmpty())
d->m_FWProps[ctkPluginConstants::FRAMEWORK_STORAGE] = storageDir;
// 8. Set the library search paths and the pre-load library property
this->initializeLibraryPaths();
auto preloadLibs = this->getPreloadLibraries();
if (!preloadLibs.isEmpty())
d->m_FWProps[ctkPluginConstants::FRAMEWORK_PRELOAD_LIBRARIES] = preloadLibs;
// 9. Initialize the CppMicroServices library.
// The initializeCppMicroServices() method reuses the
// FRAMEWORK_STORAGE property, so we call it after the
// getCTKFrameworkStorageDir method.
this->initializeCppMicroServices();
// 10. Parse the (optional) provisioning file and set the
// correct framework properties.
d->parseProvisioningFile(this->getProvisioningFilePath());
// 11. Set the CTK Plugin Framework properties
ctkPluginFrameworkLauncher::setFrameworkProperties(d->m_FWProps);
}
void BaseApplication::uninitialize()
{
auto pfw = this->getFramework();
if (pfw)
{
pfw->stop();
// Wait for up to 10 seconds for the CTK plugin framework to stop
pfw->waitForStop(10000);
}
Poco::Util::Application::uninitialize();
}
int BaseApplication::getArgc() const
{
return d->m_Argc;
}
char **BaseApplication::getArgv() const
{
return d->m_Argv;
}
QString BaseApplication::getCTKFrameworkStorageDir() const
{
QString storageDir;
if (this->getSingleMode())
{
// This function checks if an instance is already running and either sends a message to
// it containing the command line arguments or checks if a new instance was forced by
// providing the BlueBerry.newInstance command line argument. In the latter case, a path
// to a temporary directory for the new application's storage directory is returned.
storageDir = handleNewAppInstance(static_cast(d->m_QApp),
d->m_Argc, d->m_Argv, ARG_NEWINSTANCE);
}
if (storageDir.isEmpty())
{
// This is a new instance and no other instance is already running. We specify the
// storage directory here (this is the same code as in berryInternalPlatform.cpp)
// so that we can re-use the location for the persistent data location of the
// the CppMicroServices library.
// Append a hash value of the absolute path of the executable to the data location.
// This allows to start the same application from different build or install trees.
storageDir = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) + "/" +
this->getOrganizationName() + "/" + this->getApplicationName() + '_';
storageDir += QString::number(qHash(QCoreApplication::applicationDirPath())) + "/";
}
return storageDir;
}
void BaseApplication::initializeCppMicroServices()
{
auto storageDir = this->getProperty(ctkPluginConstants::FRAMEWORK_STORAGE).toString();
if (!storageDir.isEmpty())
us::ModuleSettings::SetStoragePath((storageDir + "us" + QDir::separator()).toStdString());
}
QCoreApplication *BaseApplication::getQApplication() const
{
if (nullptr == qApp)
{
vtkOpenGLRenderWindow::SetGlobalMaximumNumberOfMultiSamples(0);
auto defaultFormat = QVTKOpenGLNativeWidget::defaultFormat();
defaultFormat.setSamples(0);
QSurfaceFormat::setDefaultFormat(defaultFormat);
#ifdef Q_OS_OSX
QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
#endif
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
d->m_QApp = this->getSingleMode()
? static_cast(new QmitkSingleApplication(d->m_Argc, d->m_Argv, this->getSafeMode()))
: static_cast(new QmitkSafeApplication(d->m_Argc, d->m_Argv, this->getSafeMode()));
}
return qApp;
}
void BaseApplication::initializeLibraryPaths()
{
QStringList suffixes;
suffixes << "plugins";
#ifdef Q_OS_WINDOWS
suffixes << "bin/plugins";
#ifdef CMAKE_INTDIR
suffixes << "bin/" CMAKE_INTDIR "/plugins";
#endif
#else
suffixes << "lib/plugins";
#ifdef CMAKE_INTDIR
suffixes << "lib/" CMAKE_INTDIR "/plugins";
#endif
#endif
#ifdef Q_OS_MAC
suffixes << "../../plugins";
#endif
// We add a couple of standard library search paths for plug-ins
QDir appDir(QCoreApplication::applicationDirPath());
// Walk one directory up and add bin and lib sub-dirs; this might be redundant
appDir.cdUp();
for (const auto& suffix : qAsConst(suffixes))
ctkPluginFrameworkLauncher::addSearchPath(appDir.absoluteFilePath(suffix));
}
int BaseApplication::main(const std::vector &args)
{
// Start the plugin framework and all installed plug-ins according to their auto-start setting
QStringList arguments;
for (auto const &arg : args)
arguments.push_back(QString::fromStdString(arg));
if (nullptr != d->m_Splashscreen)
{
// A splash screen is displayed. Create the closing callback.
d->m_SplashscreenClosingCallback = new SplashCloserCallback(d->m_Splashscreen);
}
return ctkPluginFrameworkLauncher::run(d->m_SplashscreenClosingCallback, QVariant::fromValue(arguments)).toInt();
}
void BaseApplication::defineOptions(Poco::Util::OptionSet &options)
{
Poco::Util::Option helpOption("help", "h", "print this help text");
helpOption.callback(Poco::Util::OptionCallback(this, &BaseApplication::printHelp));
options.addOption(helpOption);
Poco::Util::Option newInstanceOption(ARG_NEWINSTANCE.toStdString(), "", "forces a new instance of this application");
newInstanceOption.callback(Poco::Util::OptionCallback(d, &Impl::handleBooleanOption));
options.addOption(newInstanceOption);
Poco::Util::Option cleanOption(ARG_CLEAN.toStdString(), "", "cleans the plugin cache");
cleanOption.callback(Poco::Util::OptionCallback(d, &Impl::handleClean));
options.addOption(cleanOption);
Poco::Util::Option productOption(ARG_PRODUCT.toStdString(), "", "the id of the product to be launched");
productOption.argument("").binding(PROP_PRODUCT.toStdString());
options.addOption(productOption);
Poco::Util::Option appOption(ARG_APPLICATION.toStdString(), "", "the id of the application extension to be executed");
appOption.argument("").binding(PROP_APPLICATION.toStdString());
options.addOption(appOption);
Poco::Util::Option provOption(ARG_PROVISIONING.toStdString(), "", "the location of a provisioning file");
provOption.argument("").binding(ARG_PROVISIONING.toStdString());
options.addOption(provOption);
Poco::Util::Option storageDirOption(ARG_STORAGE_DIR.toStdString(), "", "the location for storing persistent application data");
storageDirOption.argument("").binding(ctkPluginConstants::FRAMEWORK_STORAGE.toStdString());
options.addOption(storageDirOption);
Poco::Util::Option consoleLogOption(ARG_CONSOLELOG.toStdString(), "", "log messages to the console");
consoleLogOption.callback(Poco::Util::OptionCallback(d, &Impl::handleBooleanOption));
options.addOption(consoleLogOption);
Poco::Util::Option debugOption(ARG_DEBUG.toStdString(), "", "enable debug mode");
debugOption.argument("", false).binding(ctkPluginFrameworkLauncher::PROP_DEBUG.toStdString());
options.addOption(debugOption);
Poco::Util::Option forcePluginOption(ARG_FORCE_PLUGIN_INSTALL.toStdString(), "", "force installing plug-ins with same symbolic name");
forcePluginOption.callback(Poco::Util::OptionCallback(d, &Impl::handleBooleanOption));
options.addOption(forcePluginOption);
Poco::Util::Option preloadLibsOption(ARG_PRELOAD_LIBRARY.toStdString(), "", "preload a library");
preloadLibsOption.argument("")
.repeatable(true)
.callback(Poco::Util::OptionCallback(d, &Impl::handlePreloadLibraryOption));
options.addOption(preloadLibsOption);
Poco::Util::Option noRegistryCacheOption(ARG_NO_REGISTRY_CACHE.toStdString(), "", "do not use a cache for the registry");
noRegistryCacheOption.callback(Poco::Util::OptionCallback(d, &Impl::handleBooleanOption));
options.addOption(noRegistryCacheOption);
Poco::Util::Option noLazyRegistryCacheLoadingOption(ARG_NO_LAZY_REGISTRY_CACHE_LOADING.toStdString(), "", "do not use lazy cache loading for the registry");
noLazyRegistryCacheLoadingOption.callback(Poco::Util::OptionCallback(d, &Impl::handleBooleanOption));
options.addOption(noLazyRegistryCacheLoadingOption);
Poco::Util::Option registryMultiLanguageOption(ARG_REGISTRY_MULTI_LANGUAGE.toStdString(), "", "enable multi-language support for the registry");
registryMultiLanguageOption.callback(Poco::Util::OptionCallback(d, &Impl::handleBooleanOption));
options.addOption(registryMultiLanguageOption);
Poco::Util::Option splashScreenOption(ARG_SPLASH_IMAGE.toStdString(), "", "optional picture to use as a splash screen");
splashScreenOption.argument("").binding(ARG_SPLASH_IMAGE.toStdString());
options.addOption(splashScreenOption);
Poco::Util::Option xargsOption(ARG_XARGS.toStdString(), "", "Extended argument list");
xargsOption.argument("").binding(ARG_XARGS.toStdString());
options.addOption(xargsOption);
Poco::Util::Option logQtMessagesOption(ARG_LOG_QT_MESSAGES.toStdString(), "", "log Qt messages");
logQtMessagesOption.callback(Poco::Util::OptionCallback(d, &Impl::handleBooleanOption));
options.addOption(logQtMessagesOption);
Poco::Util::Option labelSetPresetOption(ARG_SEGMENTATION_LABELSET_PRESET.toStdString(), "", "use this label set preset for new segmentations");
labelSetPresetOption.argument("").binding(ARG_SEGMENTATION_LABELSET_PRESET.toStdString());
options.addOption(labelSetPresetOption);
Poco::Util::Option labelSuggestionsOption(ARG_SEGMENTATION_LABEL_SUGGESTIONS.toStdString(), "", "use this list of predefined suggestions for segmentation labels");
labelSuggestionsOption.argument("").binding(ARG_SEGMENTATION_LABEL_SUGGESTIONS.toStdString());
options.addOption(labelSuggestionsOption);
Poco::Util::Application::defineOptions(options);
}
QSharedPointer BaseApplication::getFramework() const
{
return ctkPluginFrameworkLauncher::getPluginFramework();
}
ctkPluginContext *BaseApplication::getFrameworkContext() const
{
auto framework = getFramework();
return framework
? framework->getPluginContext()
: nullptr;
}
void BaseApplication::initializeSplashScreen(QCoreApplication * application) const
{
auto pixmapFileNameProp = d->getProperty(ARG_SPLASH_IMAGE);
if (!pixmapFileNameProp.isNull())
{
auto pixmapFileName = pixmapFileNameProp.toString();
QFileInfo checkFile(pixmapFileName);
if (checkFile.exists() && checkFile.isFile())
{
QPixmap pixmap(checkFile.absoluteFilePath());
d->m_Splashscreen = new QSplashScreen(pixmap, Qt::WindowStaysOnTopHint);
d->m_Splashscreen->show();
application->processEvents();
}
}
}
QHash BaseApplication::getFrameworkProperties() const
{
return d->m_FWProps;
}
int BaseApplication::run()
{
this->init(d->m_Argc, d->m_Argv);
return Application::run();
}
void BaseApplication::setProperty(const QString &property, const QVariant &value)
{
d->m_FWProps[property] = value;
}
QVariant BaseApplication::getProperty(const QString &property) const
{
return d->getProperty(property);
}
void BaseApplication::installTranslator(QTranslator* translator)
{
this->getQApplication()->installTranslator(translator);
}
bool BaseApplication::isRunning()
{
auto app = dynamic_cast(this->getQApplication());
if (nullptr != app)
app->isRunning();
mitkThrow() << "Method not implemented.";
}
void BaseApplication::sendMessage(const QByteArray msg)
{
auto app = dynamic_cast(this->getQApplication());
if (nullptr != app)
app->sendMessage(msg);
mitkThrow() << "Method not implemented.";
}
}
diff --git a/Modules/ContourModel/Algorithms/mitkContourModelUtils.h b/Modules/ContourModel/Algorithms/mitkContourModelUtils.h
index 50272c7dd5..e97d315291 100644
--- a/Modules/ContourModel/Algorithms/mitkContourModelUtils.h
+++ b/Modules/ContourModel/Algorithms/mitkContourModelUtils.h
@@ -1,152 +1,155 @@
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#ifndef mitkContourModelUtils_h
#define mitkContourModelUtils_h
#include
#include
#include
#include
namespace mitk
{
/**
* \brief Helpful methods for working with contours and images
*
*
*/
class MITKCONTOURMODEL_EXPORT ContourModelUtils : public itk::Object
{
public:
mitkClassMacroItkParent(ContourModelUtils, itk::Object);
/**
\brief Projects a contour onto an image point by point. Converts from world to index coordinates.
\param slice
\param contourIn3D
*/
static ContourModel::Pointer ProjectContourTo2DSlice(const Image *slice,
const ContourModel *contourIn3D);
/**
\brief Projects a slice index coordinates of a contour back into world coordinates.
\param sliceGeometry
\param contourIn2D
*/
static ContourModel::Pointer BackProjectContourFrom2DSlice(const BaseGeometry *sliceGeometry,
const ContourModel *contourIn2D);
/**
\brief Fill a contour in a 2D slice with a specified pixel value.
This version always uses the contour of time step 0 and fills the image.
\deprecated Ths function is deprecated. Use FillContourInSlice2() (in
conjunction e.g. with TransferLabelContent()) instead.
\pre sliceImage points to a valid instance
\pre projectedContour points to a valid instance
*/
[[deprecated]]
static void FillContourInSlice(const ContourModel *projectedContour,
Image *sliceImage,
const Image* workingImage,
int paintingPixelValue = 1);
/**
\brief Fill a contour in a 2D slice with a specified pixel value.
This overloaded version uses the contour at the passed contourTimeStep
to fill the passed image slice.
\deprecated Ths function is deprecated. Use FillContourInSlice2() (in
conjunction e.g. with TransferLabelContent()) instead.
\pre sliceImage points to a valid instance
\pre projectedContour points to a valid instance
*/
[[deprecated]]
static void FillContourInSlice(const ContourModel *projectedContour,
TimeStepType contourTimeStep,
Image *sliceImage,
const Image* workingImage,
int paintingPixelValue = 1);
/**
\brief Fill a contour in a 2D slice with a specified pixel value.
This version always uses the contour of time step 0 and fills the image.
\param projectedContour Pointer to the contour that should be projected.
\param sliceImage Pointer to the image which content should be altered by
adding the contour with the specified paintingPixelValue.
+ \param paintingPixelValue
\pre sliceImage points to a valid instance
\pre projectedContour points to a valid instance
*/
static void FillContourInSlice2(const ContourModel* projectedContour,
Image* sliceImage,
int paintingPixelValue = 1);
/**
\brief Fill a contour in a 2D slice with a specified pixel value.
This overloaded version uses the contour at the passed contourTimeStep
to fill the passed image slice.
\param projectedContour Pointer to the contour that should be projected.
+ \param contourTimeStep
\param sliceImage Pointer to the image which content should be altered by
+ \param paintingPixelValue
adding the contour with the specified paintingPixelValue.
\pre sliceImage points to a valid instance
\pre projectedContour points to a valid instance
*/
static void FillContourInSlice2(const ContourModel* projectedContour,
TimeStepType contourTimeStep,
Image* sliceImage,
int paintingPixelValue = 1);
/**
\brief Fills the paintingPixelValue into every pixel of resultImage as indicated by filledImage.
If a LableSet image is specified it also by incorporating the rules of LabelSet images when filling the content.
\param filledImage Pointer to the image content that should be checked to decied of a pixel in resultImage should
be filled with paintingPixelValue or not.
\param resultImage Pointer to the image content that should be overwritten guided by the content of filledImage.
\param image Pointer to an mitk image that allows to define the LabelSet image which states steer the filling process.
If an LabelSet instance is passed its states (e.g. locked labels etc...) will be used. If nullptr or an normal image
is passed, then simply any pixel position indicated by filledImage will be overwritten.
\param paintingPixelValue the pixelvalue/label that should be used in the result image when filling.
\param fillForegroundThreshold The threshold value that decides if a pixel in the filled image counts
as foreground (>=fillForegroundThreshold) or not.
\deprecated Ths function is deprecated. Use TransferLabelContent() instead.
*/
[[deprecated]]
static void FillSliceInSlice(vtkSmartPointer filledImage,
vtkSmartPointer resultImage,
const Image* image,
int paintingPixelValue,
double fillForegroundThreshold = 1.0);
/**
\brief Move the contour in time step 0 to to a new contour model at the given time step.
*/
static ContourModel::Pointer MoveZerothContourTimeStep(const ContourModel *contour, TimeStepType timeStep);
/**
\brief Retrieves the active pixel value of a (labelset) image.
If the image is basic image, the pixel value 1 (one) will be returned.
If the image is actually a labelset image, the pixel value of the active label of the active layer will be
returned.
\param workingImage The (labelset) image to retrieve the active pixel value of.
*/
static int GetActivePixelValue(const Image* workingImage);
protected:
ContourModelUtils();
~ContourModelUtils() override;
};
}
#endif
diff --git a/Modules/Core/include/Colortables/Turbo.h b/Modules/Core/include/Colortables/Turbo.h
new file mode 100644
index 0000000000..807f5c8045
--- /dev/null
+++ b/Modules/Core/include/Colortables/Turbo.h
@@ -0,0 +1,85 @@
+/*============================================================================
+
+The Medical Imaging Interaction Toolkit (MITK)
+
+Copyright (c) German Cancer Research Center (DKFZ)
+All rights reserved.
+
+Use of this source code is governed by a 3-clause BSD license that can be
+found in the LICENSE file.
+
+============================================================================*/
+
+#ifndef _lut_Turbo_h_
+#define _lut_Turbo_h_
+
+// The Turbo Colormap was developed by Anton Mikhailov at Google in 2019.
+// It has been released unter the Apache 2.0 license.
+
+static const int Turbo[256][3] = {
+ { 48, 18, 59}, { 50, 21, 67}, { 51, 24, 74}, { 52, 27, 81},
+ { 53, 30, 88}, { 54, 33, 95}, { 55, 36, 102}, { 56, 39, 109},
+ { 57, 42, 115}, { 58, 45, 121}, { 59, 47, 128}, { 60, 50, 134},
+ { 61, 53, 139}, { 62, 56, 145}, { 63, 59, 151}, { 63, 62, 156},
+ { 64, 64, 162}, { 65, 67, 167}, { 65, 70, 172}, { 66, 73, 177},
+ { 66, 75, 181}, { 67, 78, 186}, { 68, 81, 191}, { 68, 84, 195},
+ { 68, 86, 199}, { 69, 89, 203}, { 69, 92, 207}, { 69, 94, 211},
+ { 70, 97, 214}, { 70, 100, 218}, { 70, 102, 221}, { 70, 105, 224},
+ { 70, 107, 227}, { 71, 110, 230}, { 71, 113, 233}, { 71, 115, 235},
+ { 71, 118, 238}, { 71, 120, 240}, { 71, 123, 242}, { 70, 125, 244},
+ { 70, 128, 246}, { 70, 130, 248}, { 70, 133, 250}, { 70, 135, 251},
+ { 69, 138, 252}, { 69, 140, 253}, { 68, 143, 254}, { 67, 145, 254},
+ { 66, 148, 255}, { 65, 150, 255}, { 64, 153, 255}, { 62, 155, 254},
+ { 61, 158, 254}, { 59, 160, 253}, { 58, 163, 252}, { 56, 165, 251},
+ { 55, 168, 250}, { 53, 171, 248}, { 51, 173, 247}, { 49, 175, 245},
+ { 47, 178, 244}, { 46, 180, 242}, { 44, 183, 240}, { 42, 185, 238},
+ { 40, 188, 235}, { 39, 190, 233}, { 37, 192, 231}, { 35, 195, 228},
+ { 34, 197, 226}, { 32, 199, 223}, { 31, 201, 221}, { 30, 203, 218},
+ { 28, 205, 216}, { 27, 208, 213}, { 26, 210, 210}, { 26, 212, 208},
+ { 25, 213, 205}, { 24, 215, 202}, { 24, 217, 200}, { 24, 219, 197},
+ { 24, 221, 194}, { 24, 222, 192}, { 24, 224, 189}, { 25, 226, 187},
+ { 25, 227, 185}, { 26, 228, 182}, { 28, 230, 180}, { 29, 231, 178},
+ { 31, 233, 175}, { 32, 234, 172}, { 34, 235, 170}, { 37, 236, 167},
+ { 39, 238, 164}, { 42, 239, 161}, { 44, 240, 158}, { 47, 241, 155},
+ { 50, 242, 152}, { 53, 243, 148}, { 56, 244, 145}, { 60, 245, 142},
+ { 63, 246, 138}, { 67, 247, 135}, { 70, 248, 132}, { 74, 248, 128},
+ { 78, 249, 125}, { 82, 250, 122}, { 85, 250, 118}, { 89, 251, 115},
+ { 93, 252, 111}, { 97, 252, 108}, {101, 253, 105}, {105, 253, 102},
+ {109, 254, 98}, {113, 254, 95}, {117, 254, 92}, {121, 254, 89},
+ {125, 255, 86}, {128, 255, 83}, {132, 255, 81}, {136, 255, 78},
+ {139, 255, 75}, {143, 255, 73}, {146, 255, 71}, {150, 254, 68},
+ {153, 254, 66}, {156, 254, 64}, {159, 253, 63}, {161, 253, 61},
+ {164, 252, 60}, {167, 252, 58}, {169, 251, 57}, {172, 251, 56},
+ {175, 250, 55}, {177, 249, 54}, {180, 248, 54}, {183, 247, 53},
+ {185, 246, 53}, {188, 245, 52}, {190, 244, 52}, {193, 243, 52},
+ {195, 241, 52}, {198, 240, 52}, {200, 239, 52}, {203, 237, 52},
+ {205, 236, 52}, {208, 234, 52}, {210, 233, 53}, {212, 231, 53},
+ {215, 229, 53}, {217, 228, 54}, {219, 226, 54}, {221, 224, 55},
+ {223, 223, 55}, {225, 221, 55}, {227, 219, 56}, {229, 217, 56},
+ {231, 215, 57}, {233, 213, 57}, {235, 211, 57}, {236, 209, 58},
+ {238, 207, 58}, {239, 205, 58}, {241, 203, 58}, {242, 201, 58},
+ {244, 199, 58}, {245, 197, 58}, {246, 195, 58}, {247, 193, 58},
+ {248, 190, 57}, {249, 188, 57}, {250, 186, 57}, {251, 184, 56},
+ {251, 182, 55}, {252, 179, 54}, {252, 177, 54}, {253, 174, 53},
+ {253, 172, 52}, {254, 169, 51}, {254, 167, 50}, {254, 164, 49},
+ {254, 161, 48}, {254, 158, 47}, {254, 155, 45}, {254, 153, 44},
+ {254, 150, 43}, {254, 147, 42}, {254, 144, 41}, {253, 141, 39},
+ {253, 138, 38}, {252, 135, 37}, {252, 132, 35}, {251, 129, 34},
+ {251, 126, 33}, {250, 123, 31}, {249, 120, 30}, {249, 117, 29},
+ {248, 114, 28}, {247, 111, 26}, {246, 108, 25}, {245, 105, 24},
+ {244, 102, 23}, {243, 99, 21}, {242, 96, 20}, {241, 93, 19},
+ {240, 91, 18}, {239, 88, 17}, {237, 85, 16}, {236, 83, 15},
+ {235, 80, 14}, {234, 78, 13}, {232, 75, 12}, {231, 73, 12},
+ {229, 71, 11}, {228, 69, 10}, {226, 67, 10}, {225, 65, 9},
+ {223, 63, 8}, {221, 61, 8}, {220, 59, 7}, {218, 57, 7},
+ {216, 55, 6}, {214, 53, 6}, {212, 51, 5}, {210, 49, 5},
+ {208, 47, 5}, {206, 45, 4}, {204, 43, 4}, {202, 42, 4},
+ {200, 40, 3}, {197, 38, 3}, {195, 37, 3}, {193, 35, 2},
+ {190, 33, 2}, {188, 32, 2}, {185, 30, 2}, {183, 29, 2},
+ {180, 27, 1}, {178, 26, 1}, {175, 24, 1}, {172, 23, 1},
+ {169, 22, 1}, {167, 20, 1}, {164, 19, 1}, {161, 18, 1},
+ {158, 16, 1}, {155, 15, 1}, {152, 14, 1}, {149, 13, 1},
+ {146, 11, 1}, {142, 10, 1}, {139, 9, 2}, {136, 8, 2},
+ {133, 7, 2}, {129, 6, 2}, {126, 5, 2}, {122, 4, 3}};
+
+#endif
diff --git a/Modules/Core/include/mitkBaseRenderer.h b/Modules/Core/include/mitkBaseRenderer.h
index 7ed6b171f7..150e690082 100644
--- a/Modules/Core/include/mitkBaseRenderer.h
+++ b/Modules/Core/include/mitkBaseRenderer.h
@@ -1,467 +1,482 @@
/*============================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Use of this source code is governed by a 3-clause BSD license that can be
found in the LICENSE file.
============================================================================*/
#ifndef MITKBASERENDERER_H
#define MITKBASERENDERER_H
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include