|
Medical Imaging Interaction Toolkit
2026.06.00
Medical Imaging Interaction Toolkit
|
#include <mitkBaseApplication.h>


Static Public Attributes | |
Command Line Argument Constants | |
String constants for recognized command line argument names. These are used as keys in the framework property map when the corresponding command line arguments are provided. | |
| static const QString | ARG_APPLICATION |
| Argument key for specifying the application extension id ("BlueBerry.application"). More... | |
| static const QString | ARG_CLEAN |
| Argument key to clean the plugin cache on first init ("BlueBerry.clean"). More... | |
| static const QString | ARG_CONSOLELOG |
| Argument key to enable console logging ("BlueBerry.consoleLog"). More... | |
| static const QString | ARG_DEBUG |
| Argument key to enable debug mode ("BlueBerry.debug"). More... | |
| static const QString | ARG_FORCE_PLUGIN_INSTALL |
| Argument key to force installing plug-ins with the same symbolic name ("BlueBerry.forcePlugins"). More... | |
| static const QString | ARG_HOME |
| Argument key for the BlueBerry home directory ("BlueBerry.home"). More... | |
| static const QString | ARG_NEWINSTANCE |
| Argument key to force a new instance in single mode ("BlueBerry.newInstance"). More... | |
| static const QString | ARG_NO_LAZY_REGISTRY_CACHE_LOADING |
| Argument key to disable lazy registry cache loading ("BlueBerry.noLazyRegistryCacheLoading"). More... | |
| static const QString | ARG_NO_REGISTRY_CACHE |
| Argument key to disable the registry cache ("BlueBerry.noRegistryCache"). More... | |
| static const QString | ARG_PLUGIN_CACHE |
| Argument key for the plugin cache directory ("BlueBerry.plugin_cache_dir"). More... | |
| static const QString | ARG_PLUGIN_DIRS |
| Argument key for additional plugin directories ("BlueBerry.plugin_dirs"). More... | |
| static const QString | ARG_PRELOAD_LIBRARY |
| Argument key for libraries to preload at startup ("BlueBerry.preloadLibrary"). More... | |
| static const QString | ARG_PRODUCT |
| Argument key for the product id to launch ("BlueBerry.product"). More... | |
| static const QString | ARG_PROVISIONING |
| Argument key for the provisioning file path ("BlueBerry.provisioning"). More... | |
| static const QString | ARG_REGISTRY_MULTI_LANGUAGE |
| Argument key to enable multi-language registry support ("BlueBerry.registryMultiLanguage"). More... | |
| static const QString | ARG_SPLASH_IMAGE |
| Argument key for the splash screen image file path ("BlueBerry.splashscreen"). More... | |
| static const QString | ARG_STORAGE_DIR |
| Argument key for the persistent storage directory ("BlueBerry.storageDir"). More... | |
| static const QString | ARG_XARGS |
| Argument key for extended arguments ("xargs"). More... | |
| static const QString | ARG_LOG_QT_MESSAGES |
| Argument key to enable logging of all Qt messages ("Qt.logMessages"). More... | |
| static const QString | ARG_SEGMENTATION_LABELSET_PRESET |
| Argument key for a label set preset file for new segmentations ("Segmentation.labelSetPreset"). More... | |
| static const QString | ARG_FULL_SCREEN_MODE |
| Argument key to start the application in full screen mode ("MITK.fullscreen"). More... | |
| static const QString | ARG_PREFERENCES_OVERRIDE |
| Argument key for temporarily overriding preferences for this session ("MITK.preferences-override"). More... | |
| static const QString | ARG_PREFERENCES_PATCH |
| Argument key for permanently patching preferences before session start ("MITK.preferences-patch"). More... | |
BlueBerry Plugin Framework Property Constants | |
| static const QString | PROP_APPLICATION |
| Framework property key for the application extension id ("blueberry.application"). More... | |
| static const QString | PROP_FORCE_PLUGIN_INSTALL |
| Framework property key for forcing plugin installation. More... | |
| static const QString | PROP_NEWINSTANCE |
| Framework property key for forcing a new instance. More... | |
| static const QString | PROP_NO_LAZY_REGISTRY_CACHE_LOADING |
| Framework property key for disabling lazy registry cache loading. More... | |
| static const QString | PROP_NO_REGISTRY_CACHE |
| Framework property key for disabling the registry cache. More... | |
| static const QString | PROP_PRODUCT |
| Framework property key for the product id ("blueberry.product"). More... | |
| static const QString | PROP_REGISTRY_MULTI_LANGUAGE |
| Framework property key for multi-language registry support. More... | |
| BaseApplication (int argc, char **argv) | |
| Construct a BaseApplication. More... | |
| ~BaseApplication () override | |
| Destructor. Releases internal resources. More... | |
| void | initializeQt () |
| int | run () override |
| Launch the BlueBerry framework and run the default application. More... | |
| void | printHelp (const std::string &name, const std::string &value) |
| Print the command line help text and exit the application. More... | |
| void | setApplicationName (const QString &name) |
| Set the application name. More... | |
| QString | getApplicationName () const |
| Get the application name. More... | |
| void | setOrganizationName (const QString &name) |
| Set the organization name. More... | |
| QString | getOrganizationName () const |
| Get the organization name. More... | |
| void | setOrganizationDomain (const QString &name) |
| Set the organization domain. More... | |
| QString | getOrganizationDomain () const |
| Get the organization domain. More... | |
| void | setSingleMode (bool singleMode) |
| Enable or disable single-instance mode. More... | |
| bool | getSingleMode () const |
| Query whether single-instance mode is enabled. More... | |
| void | setSafeMode (bool safeMode) |
| Enable or disable safe mode for exception-catching in the Qt event loop. More... | |
| bool | getSafeMode () const |
| Query whether safe mode is currently enabled. More... | |
| void | setFullScreenMode (bool fullScreenMode) |
| Enable or disable full screen mode. More... | |
| bool | getFullScreenMode () const |
| Query whether full screen mode is enabled. More... | |
| void | setPreloadLibraries (const QStringList &libraryBaseNames) |
| QStringList | getPreloadLibraries () const |
| void | setProvisioningFilePath (const QString &filePath) |
| QString | getProvisioningFilePath () const |
| void | setProperty (const QString &property, const QVariant &value) |
| Set a CTK plugin framework property. More... | |
| QVariant | getProperty (const QString &property) const |
| Get a CTK plugin framework property. More... | |
| void | installTranslator (QTranslator *translator) |
| Install a QTranslator on the underlying QCoreApplication. More... | |
| bool | isRunning () |
| Check whether another instance of this application is already running. More... | |
| void | sendMessage (const QByteArray msg) |
| Send a message to the already running application instance. More... | |
| void | initialize (Poco::Util::Application &self) override |
| Initialize the application. More... | |
| void | uninitialize () override |
| Uninitialize the application. More... | |
| int | getArgc () const |
| Get the argument count. More... | |
| char ** | getArgv () const |
| Get the argument vector. More... | |
| virtual QString | getCTKFrameworkStorageDir () const |
| virtual void | initializeCppMicroServices () |
| virtual QCoreApplication * | getQApplication () const |
| virtual void | initializeLibraryPaths () |
| int | main (const std::vector< std::string > &args) override |
| Run the BlueBerry application via the CTK plugin framework. More... | |
| void | defineOptions (Poco::Util::OptionSet &options) override |
| Define the recognized command line options. More... | |
| QSharedPointer< ctkPluginFramework > | getFramework () const |
| Get the CTK plugin framework instance. More... | |
| ctkPluginContext * | getFrameworkContext () const |
| Get the CTK plugin context of the framework. More... | |
| QHash< QString, QVariant > | getFrameworkProperties () const |
| void | initializeSplashScreen (QCoreApplication *application) const |
| Initialize and display the splash screen if configured. More... | |
A utility class for starting BlueBerry applications.
In the simplest case, create an instance of this class and call run(). This will launch a CTK plugin framework instance and execute the default application registered by a plug-in via the org.blueberry.osgi.applications extension point.
This class contains many convenience methods to:
The behavior can further be customized by deriving from BaseApplication and overriding specific methods, such as:
A simple but complete example:
Definition at line 75 of file mitkBaseApplication.h.
| mitk::BaseApplication::BaseApplication | ( | int | argc, |
| char ** | argv | ||
| ) |
Construct a BaseApplication.
| [in] | argc | The number of command line arguments. |
| [in] | argv | Array of command line argument strings. |
|
override |
Destructor. Releases internal resources.
|
overrideprotected |
Define the recognized command line options.
Registers all MITK/BlueBerry-specific command line options (such as –help, –BlueBerry.clean, –BlueBerry.application, etc.) as well as Qt-specific options with the Poco option set.
Override this method in subclasses to add custom command line options.
| [in,out] | options | The Poco option set to populate with recognized options. |
| QString mitk::BaseApplication::getApplicationName | ( | ) | const |
Get the application name.
|
protected |
Get the argument count.
|
protected |
Get the argument vector.
|
protectedvirtual |
Get the framework storage directory for the CTK plugin framework. This method is called in the initialize(Poco::Util::Application&) method. It must not be called without a QCoreApplications instance.
|
protected |
Get the CTK plugin framework instance.
|
protected |
Get the CTK plugin context of the framework.
nullptr if the framework is not available.
|
protected |
Get the initial properties for the CTK plugin framework.
The returned map contains the initial framework properties for initializing the CTK plugin framework. The value of specific properties may change at runtime and differ from the initial value.
| bool mitk::BaseApplication::getFullScreenMode | ( | ) | const |
Query whether full screen mode is enabled.
true if full screen mode is enabled; false otherwise. | QString mitk::BaseApplication::getOrganizationDomain | ( | ) | const |
Get the organization domain.
| QString mitk::BaseApplication::getOrganizationName | ( | ) | const |
Get the organization name.
| QStringList mitk::BaseApplication::getPreloadLibraries | ( | ) | const |
Get the list of library base names which should be pre-loaded.
| QVariant mitk::BaseApplication::getProperty | ( | const QString & | property | ) | const |
Get a CTK plugin framework property.
| [in] | property | The property key. |
| QString mitk::BaseApplication::getProvisioningFilePath | ( | ) | const |
Get the file path to the provisioning file.
|
protectedvirtual |
Get the QCoreApplication object.
This method is called in the initialize(Poco::Util::Application&) method and must create a QCoreApplication instance if the global qApp variable is not initialized yet.
| bool mitk::BaseApplication::getSafeMode | ( | ) | const |
Query whether safe mode is currently enabled.
true if safe mode is enabled; false otherwise. | bool mitk::BaseApplication::getSingleMode | ( | ) | const |
Query whether single-instance mode is enabled.
true if single mode is enabled; false otherwise.
|
overrideprotected |
Initialize the application.
Called by the Poco framework. This method performs the complete initialization sequence: initializes Qt, loads configuration, sets up the CTK plugin framework storage, initializes CppMicroServices, parses the provisioning file, and installs library search paths.
| [in,out] | self | Reference to this application instance (required by Poco). |
|
protectedvirtual |
Initialize the CppMicroServices library.
The default implementation set the CppMicroServices storage path to the current ctkPluginConstants::FRAMEWORK_STORAGE property value.
This method is called in the initialize(Poco::Util::Application&) after the CTK Plugin Framework storage directory property was set.
|
protectedvirtual |
Add plugin library search paths to the CTK Plugin Framework.
This method is called in the nitialize(Poco::Util::Application&) method after getQApplication() was called.
| void mitk::BaseApplication::initializeQt | ( | ) |
Initialize the Qt library such that a QCoreApplication instance is available and e.g. Qt widgets can be created.
This is usually not called directly by the user.
|
protected |
Initialize and display the splash screen if configured.
If the ARG_SPLASH_IMAGE property contains a valid path to an image file, a QSplashScreen is created and displayed. The splash screen is automatically closed when the application's main window becomes visible.
| [in] | application | The QCoreApplication instance used to process events while the splash screen is displayed. |
| void mitk::BaseApplication::installTranslator | ( | QTranslator * | translator | ) |
Install a QTranslator on the underlying QCoreApplication.
This is a convenience method that forwards to QCoreApplication::installTranslator().
| [in] | translator | The translator to install. Ownership is not transferred. |
| bool mitk::BaseApplication::isRunning | ( | ) |
Check whether another instance of this application is already running.
This method is only meaningful when the application is in single mode.
true if another instance is already running. | mitk::Exception | If the application is not in single mode. |
|
overrideprotected |
Run the BlueBerry application via the CTK plugin framework.
Called by the Poco framework after initialization is complete. This method starts the CTK plugin framework launcher, which in turn starts all installed plug-ins according to their auto-start setting and then runs the registered application.
| [in] | args | The unconsumed command line arguments passed from Poco. |
| std::exception | If the application encounters an error during execution. |
| void mitk::BaseApplication::printHelp | ( | const std::string & | name, |
| const std::string & | value | ||
| ) |
Print the command line help text and exit the application.
This is used as a Poco option callback for the –help command line argument.
| [in] | name | The name of the option that triggered this callback (unused). |
| [in] | value | The value associated with the option (unused). |
|
override |
Launch the BlueBerry framework and run the default application.
Initializes Poco, parses command line arguments, sets up the CTK plugin framework, and runs the application specified by the PROP_APPLICATION framework property (or the default application registered via the org.blueberry.osgi.applications extension point).
| Poco::Util::OptionException | If an invalid command line option is encountered. |
| mitk::Exception | If a MITK-specific initialization error occurs. |
| void mitk::BaseApplication::sendMessage | ( | const QByteArray | msg | ) |
Send a message to the already running application instance.
This method is only meaningful when the application is in single mode and another instance is already running.
| [in] | msg | The message to send (e.g., serialized command line arguments). |
| mitk::Exception | If the application is not in single mode. |
| void mitk::BaseApplication::setApplicationName | ( | const QString & | name | ) |
Set the application name.
Equivalent to QCoreApplication::setApplicationName(). If a QCoreApplication instance already exists, the name is forwarded to it immediately. The name is also stored internally so it can be set on the QCoreApplication when it is created later.
| [in] | name | The application name. |
| void mitk::BaseApplication::setFullScreenMode | ( | bool | fullScreenMode | ) |
| void mitk::BaseApplication::setOrganizationDomain | ( | const QString & | name | ) |
Set the organization domain.
Equivalent to QCoreApplication::setOrganizationDomain(). If a QCoreApplication instance already exists, the domain is forwarded to it immediately.
| [in] | name | The organization domain. |
| void mitk::BaseApplication::setOrganizationName | ( | const QString & | name | ) |
Set the organization name.
Equivalent to QCoreApplication::setOrganizationName(). If a QCoreApplication instance already exists, the name is forwarded to it immediately.
| [in] | name | The organization name. |
| void mitk::BaseApplication::setPreloadLibraries | ( | const QStringList & | libraryBaseNames | ) |
Set a list of library names or absolute file paths which should be loaded at application start-up. The name and file path may contain a library version appended at the end and separated by a '$' charactger.
For example liborg_mitk_gui_qt_common$1.0. Platform specific suffixes are appended automatically.
| libraryBaseNames | A list of library base names. |
| void mitk::BaseApplication::setProperty | ( | const QString & | property, |
| const QVariant & | value | ||
| ) |
Set a CTK plugin framework property.
Properties set through this method are passed to the CTK plugin framework during initialization. They can also be used to store arbitrary application-level configuration data.
| [in] | property | The property key. |
| [in] | value | The property value. |
| void mitk::BaseApplication::setProvisioningFilePath | ( | const QString & | filePath | ) |
Set the path to the provisioning file.
By default a provisioning file located in the same directory as the executable and named <executable>.provisioning is loaded if it exists. To disable parsing of provisioning files, use an empty string as the argument. Use a null QString (QString::null ) to reset to the default behaviour.
| filePath | An absolute file path to the provisioning file. |
| void mitk::BaseApplication::setSafeMode | ( | bool | safeMode | ) |
Enable or disable safe mode for exception-catching in the Qt event loop.
When safe mode is enabled, unhandled exceptions thrown during Qt event processing are caught and displayed to the user instead of crashing the application.
| [in] | safeMode | If true, exception-safe event dispatching is enabled. |
| void mitk::BaseApplication::setSingleMode | ( | bool | singleMode | ) |
Enable or disable single-instance mode.
In single mode, only one instance of the application is allowed to run. If a second instance is started, the command line arguments are sent to the already running instance instead of creating a new one (unless ARG_NEWINSTANCE is specified).
| [in] | singleMode | If true, only a single application instance is allowed. |
|
overrideprotected |
Uninitialize the application.
Stops the CTK plugin framework (waiting up to 10 seconds) and calls Poco::Util::Application::uninitialize().
|
static |
Argument key for specifying the application extension id ("BlueBerry.application").
Definition at line 84 of file mitkBaseApplication.h.
|
static |
Argument key to clean the plugin cache on first init ("BlueBerry.clean").
Definition at line 85 of file mitkBaseApplication.h.
|
static |
Argument key to enable console logging ("BlueBerry.consoleLog").
Definition at line 86 of file mitkBaseApplication.h.
|
static |
Argument key to enable debug mode ("BlueBerry.debug").
Definition at line 87 of file mitkBaseApplication.h.
|
static |
Argument key to force installing plug-ins with the same symbolic name ("BlueBerry.forcePlugins").
Definition at line 88 of file mitkBaseApplication.h.
|
static |
Argument key to start the application in full screen mode ("MITK.fullscreen").
Definition at line 104 of file mitkBaseApplication.h.
|
static |
Argument key for the BlueBerry home directory ("BlueBerry.home").
Definition at line 89 of file mitkBaseApplication.h.
|
static |
Argument key to enable logging of all Qt messages ("Qt.logMessages").
Definition at line 102 of file mitkBaseApplication.h.
|
static |
Argument key to force a new instance in single mode ("BlueBerry.newInstance").
Definition at line 90 of file mitkBaseApplication.h.
|
static |
Argument key to disable lazy registry cache loading ("BlueBerry.noLazyRegistryCacheLoading").
Definition at line 91 of file mitkBaseApplication.h.
|
static |
Argument key to disable the registry cache ("BlueBerry.noRegistryCache").
Definition at line 92 of file mitkBaseApplication.h.
|
static |
Argument key for the plugin cache directory ("BlueBerry.plugin_cache_dir").
Definition at line 93 of file mitkBaseApplication.h.
|
static |
Argument key for additional plugin directories ("BlueBerry.plugin_dirs").
Definition at line 94 of file mitkBaseApplication.h.
|
static |
Argument key for temporarily overriding preferences for this session ("MITK.preferences-override").
Definition at line 105 of file mitkBaseApplication.h.
|
static |
Argument key for permanently patching preferences before session start ("MITK.preferences-patch").
Definition at line 106 of file mitkBaseApplication.h.
|
static |
Argument key for libraries to preload at startup ("BlueBerry.preloadLibrary").
Definition at line 95 of file mitkBaseApplication.h.
|
static |
Argument key for the product id to launch ("BlueBerry.product").
Definition at line 96 of file mitkBaseApplication.h.
|
static |
Argument key for the provisioning file path ("BlueBerry.provisioning").
Definition at line 97 of file mitkBaseApplication.h.
|
static |
Argument key to enable multi-language registry support ("BlueBerry.registryMultiLanguage").
Definition at line 98 of file mitkBaseApplication.h.
|
static |
Argument key for a label set preset file for new segmentations ("Segmentation.labelSetPreset").
Definition at line 103 of file mitkBaseApplication.h.
|
static |
Argument key for the splash screen image file path ("BlueBerry.splashscreen").
Definition at line 99 of file mitkBaseApplication.h.
|
static |
Argument key for the persistent storage directory ("BlueBerry.storageDir").
Definition at line 100 of file mitkBaseApplication.h.
|
static |
Argument key for extended arguments ("xargs").
Definition at line 101 of file mitkBaseApplication.h.
|
static |
Framework property key for the application extension id ("blueberry.application").
Definition at line 113 of file mitkBaseApplication.h.
|
static |
Framework property key for forcing plugin installation.
Definition at line 114 of file mitkBaseApplication.h.
|
static |
Framework property key for forcing a new instance.
Definition at line 115 of file mitkBaseApplication.h.
|
static |
Framework property key for disabling lazy registry cache loading.
Definition at line 116 of file mitkBaseApplication.h.
|
static |
Framework property key for disabling the registry cache.
Definition at line 117 of file mitkBaseApplication.h.
|
static |
Framework property key for the product id ("blueberry.product").
Definition at line 118 of file mitkBaseApplication.h.
|
static |
Framework property key for multi-language registry support.
Definition at line 119 of file mitkBaseApplication.h.