diff --git a/CMake/MITKDashboardSetup.cmake b/CMake/MITKDashboardSetup.cmake
index 652289861b..7460e9ef54 100644
--- a/CMake/MITKDashboardSetup.cmake
+++ b/CMake/MITKDashboardSetup.cmake
@@ -1,161 +1,161 @@
# This file is intended to be included at the end of a custom MITKDashboardScript.TEMPLATE.cmake file
list(APPEND CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")
#
# Automatically determined properties
#
set(MY_OPERATING_SYSTEM )
if(UNIX)
# Download a utility script
# See T24757.
# if(IS_PHABRICATOR_URL)
# set(url "https://phabricator.mitk.org/source/mitk/browse/${GIT_BRANCH}/CMake/mitkDetectOS.sh?view=raw")
# else()
set(url "https://raw.githubusercontent.com/MITK/MITK/master/CMake/mitkDetectOS.sh")
# endif()
set(dest "${CTEST_SCRIPT_DIRECTORY}/mitkDetectOS.sh")
downloadFile("${url}" "${dest}")
execute_process(COMMAND sh "${dest}"
RESULT_VARIABLE _result OUTPUT_VARIABLE _out
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT _result)
set(MY_OPERATING_SYSTEM "${_out}")
endif()
endif()
if(NOT MY_OPERATING_SYSTEM)
set(MY_OPERATING_SYSTEM "${CMAKE_HOST_SYSTEM}") # Windows 7, Linux-2.6.32, Darwin...
endif()
site_name(CTEST_SITE)
if(NOT DEFINED MITK_USE_Qt5)
set(MITK_USE_Qt5 1)
endif()
if(MITK_USE_Qt5)
if(NOT QT_QMAKE_EXECUTABLE)
find_program(QT_QMAKE_EXECUTABLE NAMES qmake qmake-qt5
HINTS ${QT_BINARY_DIR})
endif()
execute_process(COMMAND ${QT_QMAKE_EXECUTABLE} --version
OUTPUT_VARIABLE MY_QT_VERSION
RESULT_VARIABLE qmake_error)
if(qmake_error)
message(FATAL_ERROR "Error when executing ${QT_QMAKE_EXECUTABLE} --version\n${qmake_error}")
endif()
string(REGEX REPLACE ".*Qt version ([0-9.]+) .*" "\\1" MY_QT_VERSION ${MY_QT_VERSION})
endif()
#
# Project specific properties
#
if(NOT CTEST_BUILD_NAME)
if(MITK_USE_Qt5)
set(CTEST_BUILD_NAME "${MY_OPERATING_SYSTEM} ${MY_COMPILER} Qt${MY_QT_VERSION} ${CTEST_BUILD_CONFIGURATION}")
else()
set(CTEST_BUILD_NAME "${MY_OPERATING_SYSTEM} ${MY_COMPILER} ${CTEST_BUILD_CONFIGURATION}")
endif()
set(CTEST_BUILD_NAME "${CTEST_BUILD_NAME}${CTEST_BUILD_NAME_SUFFIX}")
endif()
set(PROJECT_BUILD_DIR "MITK-build")
set(CTEST_PATH "$ENV{PATH}")
if(WIN32)
if("${CTEST_CMAKE_GENERATOR}" MATCHES ".*Win64")
set(CMAKE_LIBRARY_ARCHITECTURE x64)
else()
set(CMAKE_LIBRARY_ARCHITECTURE x86)
endif()
string(SUBSTRING "${MY_COMPILER}" 2 2 vc_version)
set(OPENCV_BIN_DIR "${CTEST_BINARY_DIRECTORY}/ep/${CMAKE_LIBRARY_ARCHITECTURE}/vc${vc_version}/bin")
set(BLUEBERRY_RUNTIME_DIR "${CTEST_BINARY_DIRECTORY}/MITK-build/bin/plugins/${CTEST_BUILD_CONFIGURATION}")
set(PYTHON_BINARY_DIRS "${CTEST_BINARY_DIRECTORY}/ep/src/CTK-build/CMakeExternals/Install/bin")
- get_filename_component(_python_dir ${PYTHON_EXECUTABLE} DIRECTORY)
+ get_filename_component(_python_dir "${PYTHON_EXECUTABLE}" DIRECTORY)
list(APPEND PYTHON_BINARY_DIRS "${_python_dir}")
set(CTEST_PATH "${CTEST_PATH};${CTEST_BINARY_DIRECTORY}/ep/bin;${QT_BINARY_DIR};${BLUEBERRY_RUNTIME_DIR};${OPENCV_BIN_DIR};${PYTHON_BINARY_DIRS}")
endif()
set(ENV{PATH} "${CTEST_PATH}")
# If the dashscript doesn't define a GIT_REPOSITORY variable, let's define it here.
if(NOT DEFINED GIT_REPOSITORY OR GIT_REPOSITORY STREQUAL "")
set(GIT_REPOSITORY "https://phabricator.mitk.org/source/mitk.git")
endif()
#
# Display build info
#
message("Site name: ${CTEST_SITE}")
message("Build name: ${CTEST_BUILD_NAME}")
message("Script Mode: ${SCRIPT_MODE}")
message("Coverage: ${WITH_COVERAGE}, MemCheck: ${WITH_MEMCHECK}")
#
# Set initial cache options
#
if(CTEST_CMAKE_GENERATOR MATCHES ".*Makefiles.*")
set(CTEST_USE_LAUNCHERS 1)
else()
set(CTEST_USE_LAUNCHERS 0)
endif()
set(ENV{CTEST_USE_LAUNCHERS_DEFAULT} ${CTEST_USE_LAUNCHERS})
# Remove this if block after all dartclients work
if(DEFINED ADDITIONNAL_CMAKECACHE_OPTION)
message(WARNING "Rename ADDITIONNAL to ADDITIONAL in your dartlclient script: ${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")
set(ADDITIONAL_CMAKECACHE_OPTION ${ADDITIONNAL_CMAKECACHE_OPTION})
endif()
if(NOT DEFINED MITK_BUILD_CONFIGURATION)
set(MITK_BUILD_CONFIGURATION "All")
endif()
if(NOT DEFINED MITK_VTK_DEBUG_LEAKS)
set(MITK_VTK_DEBUG_LEAKS 1)
endif()
set(INITIAL_CMAKECACHE_OPTIONS "
SUPERBUILD_EXCLUDE_MITKBUILD_TARGET:BOOL=TRUE
MITK_BUILD_CONFIGURATION:STRING=${MITK_BUILD_CONFIGURATION}
MITK_VTK_DEBUG_LEAKS:BOOL=${MITK_VTK_DEBUG_LEAKS}
${ADDITIONAL_CMAKECACHE_OPTION}
")
if(MITK_USE_Qt5)
set(INITIAL_CMAKECACHE_OPTIONS "${INITIAL_CMAKECACHE_OPTIONS}
QT_QMAKE_EXECUTABLE:FILEPATH=${QT_QMAKE_EXECUTABLE}")
endif()
# Write a cache file for populating the MITK initial cache (not the superbuild cache).
# This can be used to provide variables which are not passed through the
# superbuild process to the MITK configure step)
if(MITK_INITIAL_CACHE)
set(mitk_cache_file "${CTEST_SCRIPT_DIRECTORY}/mitk_initial_cache.txt")
file(WRITE "${mitk_cache_file}" "${MITK_INITIAL_CACHE}")
set(INITIAL_CMAKECACHE_OPTIONS "${INITIAL_CMAKECACHE_OPTIONS}
MITK_INITIAL_CACHE_FILE:INTERNAL=${mitk_cache_file}
")
endif()
#
# Download and include dashboard driver script
#
if(IS_PHABRICATOR_URL)
string(REPLACE "/" "%252F" GIT_BRANCH_URL ${GIT_BRANCH})
set(url "https://phabricator.mitk.org/source/mitk/browse/${GIT_BRANCH_URL}/CMake/MITKDashboardDriverScript.cmake?view=raw")
else()
set(url "https://raw.githubusercontent.com/MITK/MITK/master/CMake/MITKDashboardDriverScript.cmake")
endif()
set(dest ${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}.driver)
downloadFile("${url}" "${dest}")
include(${dest})
diff --git a/CMake/mitkFunctionGetMSVCVersion.cmake b/CMake/mitkFunctionGetMSVCVersion.cmake
index 0bd5088116..d8c92e5691 100644
--- a/CMake/mitkFunctionGetMSVCVersion.cmake
+++ b/CMake/mitkFunctionGetMSVCVersion.cmake
@@ -1,57 +1,61 @@
#! \brief Get diverse visual studio ids not directly provided by CMake
#!
#! Sets the following variables in the parent scope
#! VISUAL_STUDIO_VERSION_MAJOR - The Visual Studio Version
#! VISUAL_STUDIO_PRODUCT_NAME - The Visual Studio Product Name
function(mitkFunctionGetMSVCVersion )
if(MSVC)
if(MSVC_VERSION EQUAL 1600)
set(VISUAL_STUDIO_VERSION_MAJOR "10" PARENT_SCOPE)
set(VISUAL_STUDIO_VERSION_MINOR "0" PARENT_SCOPE)
set(VISUAL_STUDIO_PRODUCT_NAME "Visual Studio 2010" PARENT_SCOPE)
elseif(MSVC_VERSION EQUAL 1700)
set(VISUAL_STUDIO_VERSION_MAJOR "11" PARENT_SCOPE)
set(VISUAL_STUDIO_VERSION_MINOR "0" PARENT_SCOPE)
set(VISUAL_STUDIO_PRODUCT_NAME "Visual Studio 2012" PARENT_SCOPE)
elseif(MSVC_VERSION EQUAL 1800)
set(VISUAL_STUDIO_VERSION_MAJOR "12" PARENT_SCOPE)
set(VISUAL_STUDIO_VERSION_MINOR "0" PARENT_SCOPE)
set(VISUAL_STUDIO_PRODUCT_NAME "Visual Studio 2013" PARENT_SCOPE)
elseif(MSVC_VERSION EQUAL 1900)
set(VISUAL_STUDIO_VERSION_MAJOR "14" PARENT_SCOPE)
set(VISUAL_STUDIO_VERSION_MINOR "0" PARENT_SCOPE)
set(VISUAL_STUDIO_PRODUCT_NAME "Visual Studio 2015" PARENT_SCOPE)
elseif(MSVC_VERSION EQUAL 1910)
set(VISUAL_STUDIO_VERSION_MAJOR "14" PARENT_SCOPE)
set(VISUAL_STUDIO_VERSION_MINOR "0" PARENT_SCOPE)
set(VISUAL_STUDIO_PRODUCT_NAME "Visual Studio 2017" PARENT_SCOPE)
elseif(MSVC_VERSION EQUAL 1911)
set(VISUAL_STUDIO_VERSION_MAJOR "14" PARENT_SCOPE)
set(VISUAL_STUDIO_VERSION_MINOR "1" PARENT_SCOPE)
set(VISUAL_STUDIO_PRODUCT_NAME "Visual Studio 2017" PARENT_SCOPE)
elseif(MSVC_VERSION EQUAL 1912)
set(VISUAL_STUDIO_VERSION_MAJOR "14" PARENT_SCOPE)
set(VISUAL_STUDIO_VERSION_MINOR "2" PARENT_SCOPE)
set(VISUAL_STUDIO_PRODUCT_NAME "Visual Studio 2017" PARENT_SCOPE)
elseif(MSVC_VERSION EQUAL 1913)
set(VISUAL_STUDIO_VERSION_MAJOR "14" PARENT_SCOPE)
set(VISUAL_STUDIO_VERSION_MINOR "3" PARENT_SCOPE)
set(VISUAL_STUDIO_PRODUCT_NAME "Visual Studio 2017" PARENT_SCOPE)
elseif(MSVC_VERSION EQUAL 1914)
set(VISUAL_STUDIO_VERSION_MAJOR "14" PARENT_SCOPE)
set(VISUAL_STUDIO_VERSION_MINOR "4" PARENT_SCOPE)
set(VISUAL_STUDIO_PRODUCT_NAME "Visual Studio 2017" PARENT_SCOPE)
+ elseif(MSVC_VERSION EQUAL 1915)
+ set(VISUAL_STUDIO_VERSION_MAJOR "14" PARENT_SCOPE)
+ set(VISUAL_STUDIO_VERSION_MINOR "5" PARENT_SCOPE)
+ set(VISUAL_STUDIO_PRODUCT_NAME "Visual Studio 2017" PARENT_SCOPE)
else()
message(WARNING "Unknown Visual Studio version ${MSVC_VERSION}. Please update CMake/mitkFunctionGetMSVCVersion.cmake.")
endif()
if("${CMAKE_GENERATOR}" MATCHES ".*Win64")
set(CMAKE_LIBRARY_ARCHITECTURE x64 PARENT_SCOPE)
else()
set(CMAKE_LIBRARY_ARCHITECTURE x86 PARENT_SCOPE)
endif()
endif()
endfunction()
diff --git a/CMakeExternals/CTK.cmake b/CMakeExternals/CTK.cmake
index 6614b6efd1..57909def0b 100644
--- a/CMakeExternals/CTK.cmake
+++ b/CMakeExternals/CTK.cmake
@@ -1,103 +1,103 @@
#-----------------------------------------------------------------------------
# CTK
#-----------------------------------------------------------------------------
if(MITK_USE_CTK)
# Sanity checks
if(DEFINED CTK_DIR AND NOT EXISTS ${CTK_DIR})
message(FATAL_ERROR "CTK_DIR variable is defined but corresponds to non-existing directory")
endif()
set(proj CTK)
set(proj_DEPENDENCIES DCMTK)
set(CTK_DEPENDS ${proj})
if(NOT DEFINED CTK_DIR)
set(revision_tag 0c2a619a)
set(ctk_optional_cache_args )
if(MITK_USE_Python)
list(APPEND ctk_optional_cache_args
-DCTK_LIB_Scripting/Python/Widgets:BOOL=ON
- -DCTK_ENABLE_Python_Wrapping:BOOL=ON
+ -DCTK_ENABLE_Python_Wrapping:BOOL=OFF
-DCTK_APP_ctkSimplePythonShell:BOOL=ON
-DPYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE}
-DPYTHON_INCLUDE_DIR:PATH=${PYTHON_INCLUDE_DIR}
-DPYTHON_INCLUDE_DIR2:PATH=${PYTHON_INCLUDE_DIR2}
-DPYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY}
)
else()
list(APPEND ctk_optional_cache_args
-DCTK_LIB_Scripting/Python/Widgets:BOOL=OFF
-DCTK_ENABLE_Python_Wrapping:BOOL=OFF
-DCTK_APP_ctkSimplePythonShell:BOOL=OFF
)
endif()
if(NOT MITK_USE_Python)
list(APPEND ctk_optional_cache_args
-DDCMTK_CMAKE_DEBUG_POSTFIX:STRING=d
)
endif()
if(CTEST_USE_LAUNCHERS)
list(APPEND ctk_optional_cache_args
"-DCMAKE_PROJECT_${proj}_INCLUDE:FILEPATH=${CMAKE_ROOT}/Modules/CTestUseLaunchers.cmake"
)
endif()
FOREACH(type RUNTIME ARCHIVE LIBRARY)
IF(DEFINED CTK_PLUGIN_${type}_OUTPUT_DIRECTORY)
LIST(APPEND mitk_optional_cache_args -DCTK_PLUGIN_${type}_OUTPUT_DIRECTORY:PATH=${CTK_PLUGIN_${type}_OUTPUT_DIRECTORY})
ENDIF()
ENDFOREACH()
ExternalProject_Add(${proj}
LIST_SEPARATOR ${sep}
URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/CTK_${revision_tag}.tar.gz
URL_MD5 e1f94ba0199eccf335ec2c2b48e155da
# PATCH_COMMAND ${PATCH_COMMAND} -N -p1 -i ${CMAKE_CURRENT_LIST_DIR}/CTK.patch
UPDATE_COMMAND ""
INSTALL_COMMAND ""
CMAKE_GENERATOR ${gen}
CMAKE_ARGS
${ep_common_args}
${ctk_optional_cache_args}
# The CTK PluginFramework cannot cope with
# a non-empty CMAKE_DEBUG_POSTFIX for the plugin
# libraries yet.
-DCMAKE_DEBUG_POSTFIX:STRING=
-DCTK_QT_VERSION:STRING=5
-DQt5_DIR=${Qt5_DIR}
-DGit_EXECUTABLE:FILEPATH=${GIT_EXECUTABLE}
-DGIT_EXECUTABLE:FILEPATH=${GIT_EXECUTABLE}
-DCTK_LIB_CommandLineModules/Backend/LocalProcess:BOOL=ON
-DCTK_LIB_CommandLineModules/Frontend/QtGui:BOOL=ON
-DCTK_LIB_PluginFramework:BOOL=ON
-DCTK_LIB_DICOM/Widgets:BOOL=ON
-DCTK_LIB_XNAT/Core:BOOL=ON
-DCTK_PLUGIN_org.commontk.eventadmin:BOOL=ON
-DCTK_PLUGIN_org.commontk.configadmin:BOOL=ON
-DCTK_USE_GIT_PROTOCOL:BOOL=OFF
-DDCMTK_DIR:PATH=${DCMTK_DIR}
-DqRestAPI_URL:STRING=${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/qRestAPI_c5e4c2a7_patched.tar.gz
-DPythonQt_URL:STRING=${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/PythonQt_e39be131.tar.gz # From https://github.com/kislinsk/PythonQt.git
CMAKE_CACHE_ARGS
${ep_common_cache_args}
CMAKE_CACHE_DEFAULT_ARGS
${ep_common_cache_default_args}
DEPENDS ${proj_DEPENDENCIES}
)
ExternalProject_Get_Property(${proj} binary_dir)
set(CTK_DIR ${binary_dir})
else()
mitkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
endif()
endif()
diff --git a/Documentation/Doxygen/3-DeveloperManual/Concepts/Concepts.dox b/Documentation/Doxygen/3-DeveloperManual/Concepts/Concepts.dox
index f7ec5a8bc5..7489ed7af3 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Concepts/Concepts.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Concepts/Concepts.dox
@@ -1,33 +1,30 @@
/**
\page Concepts MITK Concepts
The following items describe some issues about MITK on a more abstract level.
--# \subpage OverviewPage
-# \subpage CodingPage "Coding Concepts"
-# \ref CodingPageGeneral
-# \ref CodingPageStyle
-# \ref CodingPageMITKMacros
-# \subpage MicroServices_Overview
-# Data Concepts
-# \subpage BasicDataTypesPage
-# \subpage DataManagementPage
-# \subpage ReaderWriterPage
-# \subpage MitkImagePage
-# \subpage PropertiesPage
-# \subpage GeometryOverviewPage
-# \subpage PipelineingConceptPage
-# \subpage AnnotationPage
-# \subpage PersistenceConceptPage
-# \subpage QVTKRendering
-# Interaction
-# \subpage DataInteractionPage
-# \subpage InteractionPage
-# \subpage LoggingPage
-# \subpage ExceptionPage
-# \subpage ModularizationPage "Modularization Concept"
-# \ref ModularizationPageOverview
-# \ref ModularizationPageHowTo
-
-If you want to start using MITK, you also want to see the chapter \ref Development.
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Concepts/DataInteraction.dox b/Documentation/Doxygen/3-DeveloperManual/Concepts/DataInteraction.dox
index 2ec95624d6..3bf3794ae1 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Concepts/DataInteraction.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Concepts/DataInteraction.dox
@@ -1,230 +1,230 @@
/**
\page DataInteractionPage Interaction Concepts
\tableofcontents
\section DataInteractionPage_Introduction Introduction to Interaction in MITK
Interaction is a very important task in medical image processing software. Therefore MITK provides a special interaction concept
that provides the developer with an easy way to develop and maintain user interaction separately from the algorithms processing the input.
This allows e.g. for common interaction schemes to be re-used in different contexts.
The core of the interaction concept is based on entities called \b DataInteractors that listen for certain pre-defined events and execute
actions when such an event is triggered.\n
In the following the different components of the interaction concept are explained.
First a a high-level overview about how the different components interact is given, then some parts are explained in more detail.
\subsection FurtherReadingInteraction Topics related to interaction - further information:
See the \ref DataInteractionTechnicalPage page for a more technical explanation. \n
Consult \ref HowToUseDataInteractor for usage information.\n
See \ref SectionImplementationDataInteractor for an example on how to implement a new mitk::DataInteractor \n
for information about how to create new events refer to ImplementNewEventsPage.\n
The documentation of the depricated former concept can be found at \ref InteractionPage.
\n
For a list of changes with respect to the previous interaction concept please refer to the \ref InteractionMigration
\section DataInteractionPage_HandlingSection Event Handling & GUI Toolkit Abstraction
The following sequence diagram gives an exemplary overview of the process from creating an event until executing an action in the mitk::DataInteractor.
This diagram assumes the usage of the Qt framework, but also shows that the interaction concept itself is implemented independent of any specific
graphical user interface toolkit.
\imageMacro{event_handling.png,"",16}
- a user event is triggered and send to MITK
- this layer serves as an adapter from the GUI toolkit (here Qt) events to MITK internal events (later referred to as \link mitk::InteractionEvent InteractionEvents\endlink).
- once the event is adapted it is send to a mitk::Dispatcher, which is linked to a render window, to be handled.
- on the mitk::Dispatcher level all objects are known that can react to incoming events (mitk::DataInteractor and mitk::InteractionEventObserver instances)
- a mitk::DataInteractor is offered an event and checks its mitk::EventConfig object, which returns if a variant of this event has been defined for this DataInteractor.
- if the DataInteractor has a variant for the event, it consults its state machine to check if the input can be handled in the current state
- the actions associated with a state change (transition) are executed and the event is successfully handled.
\section DataInteractionPage_EventPage Events
Events can describe any sort of user input, such as key strokes, mouse clicks or touch gestures.
These events are mapped from an UI framework like Qt to an MITK internal representation
and send to the mitk::Dispatcher which in turn deals with further processing of the event.
These events are not limited to classical input devices but can be extended at will, by introducing new classes which e.g. describe
events from tracking devices, etc. Refer to \subpage ImplementNewEventsPage to see how new events and thereby input devices can be integrated.
For an overview of available Events see mitk::InteractionEvent, for on overview of parameters see the \subpage DataInteractionTechnicalPage.
\section DataInteractionPage_InteractionEventHandlerSection InteractionEventHandler
Is the term describing objects in general that can handle events. These objects can be divided into two groups, namely
\link mitk::DataInteractor DataInteractors\endlink and mitk::InteractionEventObserver. Their difference is that mitk::DataInteractor instances are
linked with a mitk::DataNode which they manipulate, whereas mitk::InteractionEventObserver instances do not have a mitk::DataNode and therefore
are not supposed to manipulate any data.
\dot
digraph linker_deps {
node [shape=record, fontname=Helvetica, fontsize=10];
a [ label="InteractionEventHandler" ];
d [ label="{EventStateMachine|HandleEvent()}" ];
b [ label="{DataInteractor|PerformAction()}" ];
a -> d;
d -> b;
}
\enddot
\subsection DataInteractionPage_DataInteractorsSection DataInteractors
DataInteractors are specialized mitk::InteractionEventHandler which handle events for one spefific DataNode. They are implemented following a concept called state machines
(see e.g. Wikipedia ).
\subsubsection DataInteractionPage_StateMachinesSection StateMachines
A specific events action is usually desired to depend on the content of the data object and the state of the interaction.
For example when adding a line by clicking with the mouse, the first two clicks are supposed to add a point.
But the second click should additionally finish the interaction and a subsequent third click should be ignored.
State machines provide a great way to model such interaction in which the same user interaction can trigger different actions
depending on the current state. Therefore DataInteractors work with so called state machine patterns.
The basic idea here is that each interaction can be described by states
and transitions which in turn trigger actions.
These patterns define a workflow and different patterns can be applied to the same mitk::DataInteractor and cause this mitk::DataInteractor
to perform different user interactions.
This principle is best described by an example.
Imagine a mitk::DataInteractor with the functionality (1) to add Points at a given mouse position and connect them by a line and (2) check if two
points are on the same position. Using this mitk::DataInteractor, different mitk::StateMachine patterns/descriptions
can be given which each cause the mitk::DataInteractor to perform different interaction schemes.
State machine pattern 1:
We want the user to draw a line. A simple state machine could express this by three states like this:
\dot
digraph linker_deps {
node [shape=circle, fontname=Helvetica, fontsize=10];
a [ label="NoPoints" ];
b [ label="OnePoint" ];
c [ label="TwoPoints" ];
a -> b [label="MousePress/AddPoint",fontname=Helvetica, fontsize=10];
b -> c [label="MousePress/AddPoint",fontname=Helvetica, fontsize=10];
{ rank=same; a b c }
}
\enddot
With each MousePress event the AddPoint function is called and adds a point at the mouse position, unless two points already exist.
State machine pattern 2:
The same mitk::DataInteractor can also operate after the following state machine, which models the interaction to input a closed contour.
The mitk::DataInteractor can detect an AddPoint event on an already existing point and will trigger a PointsMatch event.
\dot
digraph {
node [shape=circle, fontname=Helvetica, fontsize=10];
a [ label="StartState" ];
b [ label="ClosedContour"];
a -> a [label="MousePress/AddPoint",fontname=Helvetica, fontsize=10];
a -> b [label="PointsMatch/AddPoint",fontname=Helvetica, fontsize=10];
}
\enddot
In this way state machines provide both, a nice and structured way to represent interaction tasks and description of the interaction which is separated from the code.
One DataInteractor can be re-used for different tasks by simply exchanging the state machine pattern. These patterns are described in XML files.
\subsubsection DataInteractionPage_DefinitionStateMachine Definition of a State Machine
The definition is made up out of four components.
- States - represent the current status of the interaction
- Transitions - describe the events needed to change from one state to another
- Conditions - are executed, before a transition is taken
- Actions - are executed, when a transition is taken and conditions for that transition have passed
Each state machine needs exactly one designated start state into which the state machine is set in the beginning.
An example of a state machine describing the interaction of example 2 looks like this:
\code
\endcode
Example 1: State machine pattern, that describes adding points to a contour until the PointsMatch event is triggered.
For a more detailed description of state machine patterns see here.
\subsection DataInteractionPage_InteractionEventObserverSection InteractionEventObserver
mitk::InteractionEventObserver instances are objects which will receive all user input and are intended for observation only,
they should never modify any DataNodes.
For mitk::InteractionEventObserver it is optional to use the state machine functionality, the default is without. How to use the state machine functionality
is described in the documentation of mitk::InteractionEventObserver::Notify.
\dot
digraph event_observer {
node [shape=record, fontname=Helvetica, fontsize=10];
c [ label="{InteractionEventObserver|Notify()}" ];
a [ label="InteractionEventHandler" ];
b [ label="{EventStateMachine|HandleEvent()}" ];
d [ label="{MyCustomObserver|PerformAction()}" ];
c -> d;
a -> b;
b -> d [style="dashed",label="optional"];
}
\enddot
\subsection DataInteractionPage_ConfigurationSection Configuration
In a lot of cases it is preferable to implement interactions independent of a specific event (e.g. left click with mouse), such that it is possible
-to easily change this. This is achieved through configuration of \link mitk::InteractioinEventHandler InteractionEventHandlers\endlink.
+to easily change this. This is achieved through configuration of \link mitk::InteractionEventHandler InteractionEventHandlers\endlink.
This allows to change the behavior at runtime.
The mitk::InteractionEventHandler class provides an interface to easily modify the user input that triggers an action by loading a different
configuration. This allows to implement
user-specific behavior of the software on an abstract level and to switch it at runtime.
This is achieved through XML files describing a configuration. These files can be loaded by the mitk::InteractionEventHandler and will lead to an internal mapping
from specific user input to an abstract description of the event given in the config file.
In order to do this we distinguish between a specific event and an event variant. A specific event is described by its event class, which determines the
category of an event, e.g. the class mitk::MousePressEvent, and its parameter which make this event unique, e.g. LeftMouseButton pressed and no modifier keys pressed.
The event variant is a name that is assigned to a specific event, and to which an mitk::InteractionEventHandler listens.
To illustrate this, an example is given here for two different configuration files. We assume that a mitk::InteractionEventHandler listens to the
event variant 'AddPoint', two possible config files could then look like this:
\code
\endcode
Example 2: Event description of a left click with the mouse
and
\code
\endcode
Example 3: Event description of a left click with the mouse while pressing the shift-key
If the mitk::InteractionEventHandler is loaded with the first configuration the event variant 'MousePress' is triggered when the user performs a mouse click,
while when the second configuration is loaded 'MousePress' is triggered when the user performs a right click while pressing the shift button.
In this way all objects derived from mitk::InteractionEventHandler can be configured. For a detailed description about how to create the XML file see the
\ref DataInteractionTechnicalPage page.
\section DataInteractionPage_DispatcherSection Dispatcher
Instances of mitk::Dispatcher receive all events and distribute them to their related mitk::DataInteractor instances. This is done by ordering
the DataInteractors according to the layer of their
mitk::DataNode in descending order. Then the event is offered to the first mitk::DataInteractor, which in turn checks if it can handle the event. This is done
for each mitk::DataInteractor until the first processes the event, after this the other DataInteractors are skipped and all InteractionEventObservers are notified.
\section DataInteractionPage_Examples Examples
Examples can be found at \subpage InteractionHowTo
*/
diff --git a/Modules/DiffusionImaging/FiberTracking/Testing/mitkFiberExtractionTest.cpp b/Modules/DiffusionImaging/FiberTracking/Testing/mitkFiberExtractionTest.cpp
index 2f0af162f1..b861a20dac 100644
--- a/Modules/DiffusionImaging/FiberTracking/Testing/mitkFiberExtractionTest.cpp
+++ b/Modules/DiffusionImaging/FiberTracking/Testing/mitkFiberExtractionTest.cpp
@@ -1,139 +1,147 @@
/*===================================================================
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
#include
#include
#include
#include
#include
#include
#include
#include
#include
/**Documentation
* Test if fiber transfortaiom methods work correctly
*/
int mitkFiberExtractionTest(int argc, char* argv[])
{
MITK_TEST_BEGIN("mitkFiberExtractionTest");
/// \todo Fix VTK memory leaks. Bug 18097.
vtkDebugLeaks::SetExitError(0);
MITK_INFO << "argc: " << argc;
MITK_TEST_CONDITION_REQUIRED(argc==13,"check for input data");
omp_set_num_threads(1);
try{
- mitk::FiberBundle::Pointer groundTruthFibs = dynamic_cast( mitk::IOUtil::Load(argv[1]).front().GetPointer() );
- mitk::FiberBundle::Pointer testFibs = dynamic_cast( mitk::IOUtil::Load(argv[2]).front().GetPointer() );
+ mitk::FiberBundle::Pointer groundTruthFibs = mitk::IOUtil::Load(argv[1]);
+ mitk::FiberBundle::Pointer testFibs = mitk::IOUtil::Load(argv[2]);
// test planar figure based extraction
auto data = mitk::IOUtil::Load(argv[3])[0];
auto pf1 = mitk::DataNode::New();
pf1->SetData(data);
data = mitk::IOUtil::Load(argv[4])[0];
auto pf2 = mitk::DataNode::New();
pf2->SetData(data);
data = mitk::IOUtil::Load(argv[5])[0];
auto pf3 = mitk::DataNode::New();
pf3->SetData(data);
mitk::StandaloneDataStorage::Pointer storage = mitk::StandaloneDataStorage::New();
mitk::PlanarFigureComposite::Pointer pfc2 = mitk::PlanarFigureComposite::New();
pfc2->setOperationType(mitk::PlanarFigureComposite::OR);
mitk::DataNode::Pointer pfcNode2 = mitk::DataNode::New();
pfcNode2->SetData(pfc2);
mitk::DataStorage::SetOfObjects::Pointer set2 = mitk::DataStorage::SetOfObjects::New();
set2->push_back(pfcNode2);
mitk::PlanarFigureComposite::Pointer pfc1 = mitk::PlanarFigureComposite::New();
pfc1->setOperationType(mitk::PlanarFigureComposite::AND);
mitk::DataNode::Pointer pfcNode1 = mitk::DataNode::New();
pfcNode1->SetData(pfc1);
mitk::DataStorage::SetOfObjects::Pointer set1 = mitk::DataStorage::SetOfObjects::New();
set1->push_back(pfcNode1);
storage->Add(pfcNode2);
storage->Add(pf1, set2);
storage->Add(pfcNode1, set2);
storage->Add(pf2, set1);
storage->Add(pf3, set1);
MITK_INFO << "TEST1";
mitk::FiberBundle::Pointer extractedFibs = groundTruthFibs->ExtractFiberSubset(pfcNode2, storage);
MITK_INFO << "TEST2";
MITK_TEST_CONDITION_REQUIRED(extractedFibs->Equals(testFibs),"check planar figure extraction");
MITK_INFO << "TEST3";
// test subtraction and addition
mitk::FiberBundle::Pointer notExtractedFibs = groundTruthFibs->SubtractBundle(extractedFibs);
MITK_INFO << argv[11];
testFibs = mitk::IOUtil::Load(argv[11]);
MITK_TEST_CONDITION_REQUIRED(notExtractedFibs->Equals(testFibs),"check bundle subtraction");
mitk::FiberBundle::Pointer joinded = extractedFibs->AddBundle(notExtractedFibs);
testFibs = mitk::IOUtil::Load(argv[12]);
MITK_TEST_CONDITION_REQUIRED(joinded->Equals(testFibs),"check bundle addition");
// test binary image based extraction
mitk::Image::Pointer mitkRoiImage = mitk::IOUtil::Load(argv[6]);
typedef itk::Image< unsigned char, 3 > itkUCharImageType;
itkUCharImageType::Pointer itkRoiImage = itkUCharImageType::New();
mitk::CastToItkImage(mitkRoiImage, itkRoiImage);
{
testFibs = mitk::IOUtil::Load(argv[9]);
itk::FiberExtractionFilter::Pointer extractor = itk::FiberExtractionFilter::New();
mitk::FiberBundle::Pointer test = groundTruthFibs->GetDeepCopy();
test->ResampleLinear(0.2);
extractor->SetInputFiberBundle(test);
extractor->SetRoiImages({itkRoiImage});
extractor->SetOverlapFraction(0.0);
extractor->SetBothEnds(true);
extractor->SetDontResampleFibers(true);
extractor->SetMode(itk::FiberExtractionFilter::MODE::OVERLAP);
extractor->Update();
mitk::FiberBundle::Pointer passing = extractor->GetPositives().at(0);
- MITK_TEST_CONDITION_REQUIRED(passing->Equals(testFibs),"check passing mask extraction");
+ bool ok = passing->Equals(testFibs);
+ if(!ok)
+ mitk::IOUtil::Save(passing, mitk::IOUtil::GetTempPath()+"passing_mask.fib");
+
+ MITK_TEST_CONDITION_REQUIRED(ok,"check passing mask extraction");
}
{
testFibs = mitk::IOUtil::Load(argv[10]);
itk::FiberExtractionFilter::Pointer extractor = itk::FiberExtractionFilter::New();
extractor->SetInputFiberBundle(groundTruthFibs);
extractor->SetRoiImages({itkRoiImage});
extractor->SetOverlapFraction(0.0);
extractor->SetBothEnds(true);
extractor->SetMode(itk::FiberExtractionFilter::MODE::ENDPOINTS);
extractor->Update();
mitk::FiberBundle::Pointer ending = extractor->GetPositives().at(0);
+ bool ok = ending->Equals(testFibs);
+ if(!ok)
+ mitk::IOUtil::Save(ending, mitk::IOUtil::GetTempPath()+"ending_mask.fib");
+
MITK_TEST_CONDITION_REQUIRED(ending->Equals(testFibs),"check ending in mask extraction");
}
}
catch(...) {
return EXIT_FAILURE;
}
// always end with this!
MITK_TEST_END();
}
diff --git a/Plugins/org.blueberry.core.runtime/src/berryExtensionType.h b/Plugins/org.blueberry.core.runtime/src/berryExtensionType.h
index 0604df2768..4632d17bc6 100644
--- a/Plugins/org.blueberry.core.runtime/src/berryExtensionType.h
+++ b/Plugins/org.blueberry.core.runtime/src/berryExtensionType.h
@@ -1,192 +1,190 @@
/*===================================================================
BlueBerry Platform
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 BERRY_EXTENSION_TYPES_H
#define BERRY_EXTENSION_TYPES_H
#include
#include
namespace berry {
/**
* \brief The ExtensionType class manages named types
- * \threadsafe
*
* The class associates a type
* name to a type so that it can be created and destructed
* dynamically at run-time. Call registerExtensionType() to make
* the type known.
*
* Any class or struct that inherits from QObject and has a public
* default constructor, and a public destructor can be registered.
*
*/
class org_blueberry_core_runtime_EXPORT ExtensionType
{
public:
typedef void (*Destructor)(QObject *);
typedef QObject* (*Constructor)();
/**
* \internal
*
* Registers a type with typeName, a destructor, and a constructor.
* Returns the type's handle, or -1 if the type could not be registered.
*/
static int registerType(const char* typeName, Destructor destructor,
Constructor constructor);
/**
* \internal
*
* Registers a type as an alias of another type (typedef)
*/
static int registerTypedef(const char* typeName, int aliasId);
/**
* Unregisters a type with typeName.
*
* \sa type()
* \sa typeName()
*/
static void unregisterType(const char* typeName);
/**
* Returns a handle to the type called typeName, or 0 if there is
* no such type.
*
* \sa isRegistered()
* \sa typeName()
*/
static int type(const char* typeName);
/**
* Returns the type name associated with the given type, or 0 if no
* matching type was found. The returned pointer must not be deleted.
*
* \sa type()
* \sa isRegistered()
*/
static const char* typeName(int type);
/**
* Returns true if the datatype with ID type is registered;
* otherwise returns false.
*
* \sa type()
* \sa typeName()
*/
static bool isRegistered(int type);
/**
* Creates a default type.
*
* \sa destroy()
* \sa isRegistered()
*/
static QObject* construct(int type);
/**
* Destroys the data, assuming it is of the type given.
*
* \sa construct()
* \sa isRegistered()
*/
static void destroy(int type, QObject* data);
};
template
void extensionTypeDeleteHelper(T* t)
{
delete t;
}
template
QObject* extensionTypeConstructHelper(const T* /*t*/)
{
return new T;
}
template
struct ExtensionTypeId
{
enum { Defined = 0 };
};
template
struct ExtensionTypeId2
{
enum { Defined = ExtensionTypeId::Defined };
static inline int extensiontype_id() { return ExtensionTypeId::extensiontype_id(); }
};
namespace internal {
template ::Defined>
struct ExtensionTypeIdHelper
{
static inline int extensiontype_id()
{ return ExtensionTypeId2::extensiontype_id(); }
};
template
struct ExtensionTypeIdHelper
{
static inline int extensiontype_id()
{ return -1; }
};
} // end namespace internal
/**
- * \threadsafe
*
* Registers the type name typeName for the type T. Returns
* the internal ID used by ExtensionType. Any class or struct that has a
* public default constructor, a public destructor, and a QObject base
* class can be registered.
*
* After a type has been registered, you can create and destroy
* objects of that type dynamically at run-time.
*/
template
int registerExtensionType(const char* typeName
#ifndef DOXYGEN_SKIP
, T* dummy = nullptr
#endif
)
{
const int typedefOf = dummy ? -1 : internal::ExtensionTypeIdHelper::extensiontype_id();
if (typedefOf != -1)
return ExtensionType::registerTypedef(typeName, typedefOf);
typedef QObject*(*ConstructPtr)(const T*);
ConstructPtr cptr = extensionTypeConstructHelper;
typedef void(*DeletePtr)(T*);
DeletePtr dptr = extensionTypeDeleteHelper;
return ExtensionType::registerType(typeName, reinterpret_cast(dptr),
reinterpret_cast(cptr));
}
} // end namespace berry
#endif // BERRY_EXTENSION_TYPES_H
diff --git a/SuperBuild.cmake b/SuperBuild.cmake
index fb9dbcfcf0..3d827f2c27 100644
--- a/SuperBuild.cmake
+++ b/SuperBuild.cmake
@@ -1,453 +1,454 @@
include(mitkFunctionInstallExternalCMakeProject)
#-----------------------------------------------------------------------------
# Convenient macro allowing to download a file
#-----------------------------------------------------------------------------
if(NOT MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL)
set(MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL http://mitk.org/download/thirdparty)
endif()
macro(downloadFile url dest)
file(DOWNLOAD ${url} ${dest} STATUS status)
list(GET status 0 error_code)
list(GET status 1 error_msg)
if(error_code)
message(FATAL_ERROR "error: Failed to download ${url} - ${error_msg}")
endif()
endmacro()
#-----------------------------------------------------------------------------
# MITK Prerequisites
#-----------------------------------------------------------------------------
if(UNIX AND NOT APPLE)
include(mitkFunctionCheckPackageHeader)
# Check for libxt-dev
mitkFunctionCheckPackageHeader(StringDefs.h libxt-dev /usr/include/X11/)
# Check for libtiff4-dev
mitkFunctionCheckPackageHeader(tiff.h libtiff4-dev)
endif()
# We need a proper patch program. On Linux and MacOS, we assume
# that "patch" is available. On Windows, we download patch.exe
# if not patch program is found.
find_program(PATCH_COMMAND patch)
if((NOT PATCH_COMMAND OR NOT EXISTS ${PATCH_COMMAND}) AND WIN32)
downloadFile(${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/patch.exe
${CMAKE_CURRENT_BINARY_DIR}/patch.exe)
find_program(PATCH_COMMAND patch ${CMAKE_CURRENT_BINARY_DIR})
endif()
if(NOT PATCH_COMMAND)
message(FATAL_ERROR "No patch program found.")
endif()
#-----------------------------------------------------------------------------
# ExternalProjects
#-----------------------------------------------------------------------------
get_property(external_projects GLOBAL PROPERTY MITK_EXTERNAL_PROJECTS)
+list(REMOVE_ITEM external_projects Python Numpy)
if(MITK_CTEST_SCRIPT_MODE)
# Write a file containing the list of enabled external project targets.
# This file can be read by a ctest script to separately build projects.
set(SUPERBUILD_TARGETS )
foreach(proj ${external_projects})
if(MITK_USE_${proj})
list(APPEND SUPERBUILD_TARGETS ${proj})
endif()
endforeach()
file(WRITE "${CMAKE_BINARY_DIR}/SuperBuildTargets.cmake" "set(SUPERBUILD_TARGETS ${SUPERBUILD_TARGETS})")
endif()
# A list of "nice" external projects, playing well together with CMake
set(nice_external_projects ${external_projects})
-list(REMOVE_ITEM nice_external_projects Boost Python)
+list(REMOVE_ITEM nice_external_projects Boost)
foreach(proj ${nice_external_projects})
if(MITK_USE_${proj})
set(EXTERNAL_${proj}_DIR "${${proj}_DIR}" CACHE PATH "Path to ${proj} build directory")
mark_as_advanced(EXTERNAL_${proj}_DIR)
if(EXTERNAL_${proj}_DIR)
set(${proj}_DIR ${EXTERNAL_${proj}_DIR})
endif()
endif()
endforeach()
set(EXTERNAL_BOOST_ROOT "${BOOST_ROOT}" CACHE PATH "Path to Boost directory")
mark_as_advanced(EXTERNAL_BOOST_ROOT)
if(EXTERNAL_BOOST_ROOT)
set(BOOST_ROOT ${EXTERNAL_BOOST_ROOT})
endif()
# Setup file for setting custom ctest vars
configure_file(
CMake/SuperbuildCTestCustom.cmake.in
${MITK_BINARY_DIR}/CTestCustom.cmake
@ONLY
)
if(BUILD_TESTING)
set(EXTERNAL_MITK_DATA_DIR "${MITK_DATA_DIR}" CACHE PATH "Path to the MITK data directory")
mark_as_advanced(EXTERNAL_MITK_DATA_DIR)
if(EXTERNAL_MITK_DATA_DIR)
set(MITK_DATA_DIR ${EXTERNAL_MITK_DATA_DIR})
endif()
endif()
#-----------------------------------------------------------------------------
# External project settings
#-----------------------------------------------------------------------------
include(ExternalProject)
set(ep_prefix "${CMAKE_BINARY_DIR}/ep")
set_property(DIRECTORY PROPERTY EP_PREFIX ${ep_prefix})
# Compute -G arg for configuring external projects with the same CMake generator:
if(CMAKE_EXTRA_GENERATOR)
set(gen "${CMAKE_EXTRA_GENERATOR} - ${CMAKE_GENERATOR}")
else()
set(gen "${CMAKE_GENERATOR}")
endif()
# Use this value where semi-colons are needed in ep_add args:
set(sep "^^")
##
if(MSVC_VERSION)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj /MP")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj /MP")
endif()
# This is a workaround for passing linker flags
# actually down to the linker invocation
set(_cmake_required_flags_orig ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "-Wl,-rpath")
mitkFunctionCheckCompilerFlags(${CMAKE_REQUIRED_FLAGS} _has_rpath_flag)
set(CMAKE_REQUIRED_FLAGS ${_cmake_required_flags_orig})
set(_install_rpath_linkflag )
if(_has_rpath_flag)
if(APPLE)
set(_install_rpath_linkflag "-Wl,-rpath,@loader_path/../lib")
else()
set(_install_rpath_linkflag "-Wl,-rpath='$ORIGIN/../lib'")
endif()
endif()
set(_install_rpath)
if(APPLE)
set(_install_rpath "@loader_path/../lib")
elseif(UNIX)
# this work for libraries as well as executables
set(_install_rpath "\$ORIGIN/../lib")
endif()
set(ep_common_args
-DCMAKE_CXX_EXTENSIONS:STRING=${CMAKE_CXX_EXTENSIONS}
-DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}
-DCMAKE_CXX_STANDARD_REQUIRED:BOOL=${CMAKE_CXX_STANDARD_REQUIRED}
-DCMAKE_MACOSX_RPATH:BOOL=TRUE
"-DCMAKE_INSTALL_RPATH:STRING=${_install_rpath}"
-DBUILD_TESTING:BOOL=OFF
-DCMAKE_INSTALL_PREFIX:PATH=
-DBUILD_SHARED_LIBS:BOOL=ON
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS}
"-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} ${MITK_CXX14_FLAG}"
#debug flags
-DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG}
-DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG}
#release flags
-DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE}
-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE}
#relwithdebinfo
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}
-DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_C_FLAGS_RELWITHDEBINFO}
#link flags
-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS}
-DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_SHARED_LINKER_FLAGS}
-DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS}
)
set(DCMTK_CMAKE_DEBUG_POSTFIX )
# python libraries wont work with it
if(NOT MITK_USE_Python)
list(APPEND ep_common_args -DCMAKE_DEBUG_POSTFIX:STRING=d)
set(DCMTK_CMAKE_DEBUG_POSTFIX d)
endif()
set(ep_common_cache_args
)
set(ep_common_cache_default_args
"-DCMAKE_PREFIX_PATH:PATH=;${CMAKE_PREFIX_PATH}"
"-DCMAKE_INCLUDE_PATH:PATH=${CMAKE_INCLUDE_PATH}"
"-DCMAKE_LIBRARY_PATH:PATH=${CMAKE_LIBRARY_PATH}"
)
# Pass the CMAKE_OSX variables to external projects
if(APPLE)
set(MAC_OSX_ARCHITECTURE_ARGS
-DCMAKE_OSX_ARCHITECTURES:PATH=${CMAKE_OSX_ARCHITECTURES}
-DCMAKE_OSX_DEPLOYMENT_TARGET:PATH=${CMAKE_OSX_DEPLOYMENT_TARGET}
-DCMAKE_OSX_SYSROOT:PATH=${CMAKE_OSX_SYSROOT}
)
set(ep_common_args
${MAC_OSX_ARCHITECTURE_ARGS}
${ep_common_args}
)
endif()
set(mitk_superbuild_ep_args)
set(mitk_depends )
# Include external projects
include(CMakeExternals/MITKData.cmake)
foreach(p ${external_projects})
if(EXISTS ${CMAKE_SOURCE_DIR}/CMakeExternals/${p}.cmake)
include(CMakeExternals/${p}.cmake)
else()
foreach(MITK_EXTENSION_DIR ${MITK_EXTENSION_DIRS})
get_filename_component(MITK_EXTENSION_DIR ${MITK_EXTENSION_DIR} ABSOLUTE)
set(MITK_CMAKE_EXTERNALS_EXTENSION_DIR ${MITK_EXTENSION_DIR}/CMakeExternals)
if(EXISTS ${MITK_CMAKE_EXTERNALS_EXTENSION_DIR}/${p}.cmake)
include(${MITK_CMAKE_EXTERNALS_EXTENSION_DIR}/${p}.cmake)
break()
endif()
endforeach()
endif()
list(APPEND mitk_superbuild_ep_args
-DMITK_USE_${p}:BOOL=${MITK_USE_${p}}
)
get_property(_package GLOBAL PROPERTY MITK_${p}_PACKAGE)
if(_package)
list(APPEND mitk_superbuild_ep_args -D${p}_DIR:PATH=${${p}_DIR})
endif()
list(APPEND mitk_depends ${${p}_DEPENDS})
endforeach()
if (SWIG_EXECUTABLE)
list(APPEND mitk_superbuild_ep_args -DSWIG_EXECUTABLE=${SWIG_EXECUTABLE})
endif()
#-----------------------------------------------------------------------------
# Set superbuild boolean args
#-----------------------------------------------------------------------------
set(mitk_cmake_boolean_args
BUILD_SHARED_LIBS
WITH_COVERAGE
BUILD_TESTING
MITK_BUILD_ALL_PLUGINS
MITK_BUILD_ALL_APPS
MITK_BUILD_EXAMPLES
MITK_USE_Qt5
MITK_USE_SYSTEM_Boost
MITK_USE_BLUEBERRY
MITK_USE_OpenCL
MITK_ENABLE_PIC_READER
)
#-----------------------------------------------------------------------------
# Create the final variable containing superbuild boolean args
#-----------------------------------------------------------------------------
set(mitk_superbuild_boolean_args)
foreach(mitk_cmake_arg ${mitk_cmake_boolean_args})
list(APPEND mitk_superbuild_boolean_args -D${mitk_cmake_arg}:BOOL=${${mitk_cmake_arg}})
endforeach()
if(MITK_BUILD_ALL_PLUGINS)
list(APPEND mitk_superbuild_boolean_args -DBLUEBERRY_BUILD_ALL_PLUGINS:BOOL=ON)
endif()
#-----------------------------------------------------------------------------
# MITK Utilities
#-----------------------------------------------------------------------------
set(proj MITK-Utilities)
ExternalProject_Add(${proj}
DOWNLOAD_COMMAND ""
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
DEPENDS
${mitk_depends}
)
#-----------------------------------------------------------------------------
# Additional MITK CXX/C Flags
#-----------------------------------------------------------------------------
set(MITK_ADDITIONAL_C_FLAGS "" CACHE STRING "Additional C Flags for MITK")
set(MITK_ADDITIONAL_C_FLAGS_RELEASE "" CACHE STRING "Additional Release C Flags for MITK")
set(MITK_ADDITIONAL_C_FLAGS_DEBUG "" CACHE STRING "Additional Debug C Flags for MITK")
mark_as_advanced(MITK_ADDITIONAL_C_FLAGS MITK_ADDITIONAL_C_FLAGS_DEBUG MITK_ADDITIONAL_C_FLAGS_RELEASE)
set(MITK_ADDITIONAL_CXX_FLAGS "" CACHE STRING "Additional CXX Flags for MITK")
set(MITK_ADDITIONAL_CXX_FLAGS_RELEASE "" CACHE STRING "Additional Release CXX Flags for MITK")
set(MITK_ADDITIONAL_CXX_FLAGS_DEBUG "" CACHE STRING "Additional Debug CXX Flags for MITK")
mark_as_advanced(MITK_ADDITIONAL_CXX_FLAGS MITK_ADDITIONAL_CXX_FLAGS_DEBUG MITK_ADDITIONAL_CXX_FLAGS_RELEASE)
set(MITK_ADDITIONAL_EXE_LINKER_FLAGS "" CACHE STRING "Additional exe linker flags for MITK")
set(MITK_ADDITIONAL_SHARED_LINKER_FLAGS "" CACHE STRING "Additional shared linker flags for MITK")
set(MITK_ADDITIONAL_MODULE_LINKER_FLAGS "" CACHE STRING "Additional module linker flags for MITK")
mark_as_advanced(MITK_ADDITIONAL_EXE_LINKER_FLAGS MITK_ADDITIONAL_SHARED_LINKER_FLAGS MITK_ADDITIONAL_MODULE_LINKER_FLAGS)
#-----------------------------------------------------------------------------
# MITK Configure
#-----------------------------------------------------------------------------
if(MITK_INITIAL_CACHE_FILE)
set(mitk_initial_cache_arg -C "${MITK_INITIAL_CACHE_FILE}")
endif()
set(mitk_optional_cache_args )
foreach(type RUNTIME ARCHIVE LIBRARY)
if(DEFINED CTK_PLUGIN_${type}_OUTPUT_DIRECTORY)
list(APPEND mitk_optional_cache_args -DCTK_PLUGIN_${type}_OUTPUT_DIRECTORY:PATH=${CTK_PLUGIN_${type}_OUTPUT_DIRECTORY})
endif()
endforeach()
# Optional python variables
if(MITK_USE_Python)
list(APPEND mitk_optional_cache_args
-DMITK_USE_Python:BOOL=${MITK_USE_Python}
-DPYTHON_EXECUTABLE:FILEPATH=${PYTHON_EXECUTABLE}
-DPYTHON_INCLUDE_DIR:PATH=${PYTHON_INCLUDE_DIR}
-DPYTHON_LIBRARY:FILEPATH=${PYTHON_LIBRARY}
-DPYTHON_INCLUDE_DIR2:PATH=${PYTHON_INCLUDE_DIR2}
)
endif()
if(Eigen_INCLUDE_DIR)
list(APPEND mitk_optional_cache_args
-DEigen_INCLUDE_DIR:PATH=${Eigen_INCLUDE_DIR}
)
endif()
set(proj MITK-Configure)
ExternalProject_Add(${proj}
LIST_SEPARATOR ${sep}
DOWNLOAD_COMMAND ""
CMAKE_GENERATOR ${gen}
CMAKE_CACHE_ARGS
# --------------- Build options ----------------
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_INSTALL_PREFIX}
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
"-DCMAKE_PREFIX_PATH:PATH=${ep_prefix};${CMAKE_PREFIX_PATH}"
"-DCMAKE_LIBRARY_PATH:PATH=${CMAKE_LIBRARY_PATH}"
"-DCMAKE_INCLUDE_PATH:PATH=${CMAKE_INCLUDE_PATH}"
# --------------- Compile options ----------------
-DCMAKE_CXX_EXTENSIONS:STRING=${CMAKE_CXX_EXTENSIONS}
-DCMAKE_CXX_STANDARD:STRING=${CMAKE_CXX_STANDARD}
-DCMAKE_CXX_STANDARD_REQUIRED:BOOL=${CMAKE_CXX_STANDARD_REQUIRED}
-DCMAKE_C_COMPILER:FILEPATH=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
"-DCMAKE_C_FLAGS:STRING=${CMAKE_C_FLAGS} ${MITK_ADDITIONAL_C_FLAGS}"
"-DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS} ${MITK_ADDITIONAL_CXX_FLAGS}"
# debug flags
"-DCMAKE_CXX_FLAGS_DEBUG:STRING=${CMAKE_CXX_FLAGS_DEBUG} ${MITK_ADDITIONAL_CXX_FLAGS_DEBUG}"
"-DCMAKE_C_FLAGS_DEBUG:STRING=${CMAKE_C_FLAGS_DEBUG} ${MITK_ADDITIONAL_C_FLAGS_DEBUG}"
# release flags
"-DCMAKE_CXX_FLAGS_RELEASE:STRING=${CMAKE_CXX_FLAGS_RELEASE} ${MITK_ADDITIONAL_CXX_FLAGS_RELEASE}"
"-DCMAKE_C_FLAGS_RELEASE:STRING=${CMAKE_C_FLAGS_RELEASE} ${MITK_ADDITIONAL_C_FLAGS_RELEASE}"
# relwithdebinfo
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_CXX_FLAGS_RELWITHDEBINFO}
-DCMAKE_C_FLAGS_RELWITHDEBINFO:STRING=${CMAKE_C_FLAGS_RELWITHDEBINFO}
# link flags
"-DCMAKE_EXE_LINKER_FLAGS:STRING=${CMAKE_EXE_LINKER_FLAGS} ${MITK_ADDITIONAL_EXE_LINKER_FLAGS}"
"-DCMAKE_SHARED_LINKER_FLAGS:STRING=${CMAKE_SHARED_LINKER_FLAGS} ${MITK_ADDITIONAL_SHARED_LINKER_FLAGS}"
"-DCMAKE_MODULE_LINKER_FLAGS:STRING=${CMAKE_MODULE_LINKER_FLAGS} ${MITK_ADDITIONAL_MODULE_LINKER_FLAGS}"
# Output directories
-DMITK_CMAKE_LIBRARY_OUTPUT_DIRECTORY:PATH=${MITK_CMAKE_LIBRARY_OUTPUT_DIRECTORY}
-DMITK_CMAKE_RUNTIME_OUTPUT_DIRECTORY:PATH=${MITK_CMAKE_RUNTIME_OUTPUT_DIRECTORY}
-DMITK_CMAKE_ARCHIVE_OUTPUT_DIRECTORY:PATH=${MITK_CMAKE_ARCHIVE_OUTPUT_DIRECTORY}
# ------------- Boolean build options --------------
${mitk_superbuild_boolean_args}
${mitk_optional_cache_args}
-DMITK_USE_SUPERBUILD:BOOL=OFF
-DMITK_BUILD_CONFIGURATION:STRING=${MITK_BUILD_CONFIGURATION}
-DCTEST_USE_LAUNCHERS:BOOL=${CTEST_USE_LAUNCHERS}
# ----------------- Miscellaneous ---------------
-DCMAKE_LIBRARY_PATH:PATH=${CMAKE_LIBRARY_PATH}
-DCMAKE_INCLUDE_PATH:PATH=${CMAKE_INCLUDE_PATH}
-DMITK_CTEST_SCRIPT_MODE:STRING=${MITK_CTEST_SCRIPT_MODE}
-DMITK_SUPERBUILD_BINARY_DIR:PATH=${MITK_BINARY_DIR}
-DMITK_MODULES_TO_BUILD:INTERNAL=${MITK_MODULES_TO_BUILD}
-DMITK_WHITELIST:STRING=${MITK_WHITELIST}
-DMITK_WHITELISTS_EXTERNAL_PATH:STRING=${MITK_WHITELISTS_EXTERNAL_PATH}
-DMITK_WHITELISTS_INTERNAL_PATH:STRING=${MITK_WHITELISTS_INTERNAL_PATH}
-DMITK_EXTENSION_DIRS:STRING=${MITK_EXTENSION_DIRS}
-DMITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES:STRING=${MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES}
-DMITK_ACCESSBYITK_FLOATING_PIXEL_TYPES:STRING=${MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES}
-DMITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES:STRING=${MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES}
-DMITK_ACCESSBYITK_VECTOR_PIXEL_TYPES:STRING=${MITK_ACCESSBYITK_VECTOR_PIXEL_TYPES}
-DMITK_ACCESSBYITK_DIMENSIONS:STRING=${MITK_ACCESSBYITK_DIMENSIONS}
# --------------- External project options ---------------
-DMITK_DATA_DIR:PATH=${MITK_DATA_DIR}
-DMITK_EXTERNAL_PROJECT_PREFIX:PATH=${ep_prefix}
-DCppMicroServices_DIR:PATH=${CppMicroServices_DIR}
-DDCMTK_CMAKE_DEBUG_POSTFIX:STRING=${DCMTK_CMAKE_DEBUG_POSTFIX}
-DBOOST_ROOT:PATH=${BOOST_ROOT}
-DBOOST_LIBRARYDIR:PATH=${BOOST_LIBRARYDIR}
-DMITK_USE_Boost_LIBRARIES:STRING=${MITK_USE_Boost_LIBRARIES}
-DQt5_DIR:PATH=${Qt5_DIR}
CMAKE_ARGS
${mitk_initial_cache_arg}
${MAC_OSX_ARCHITECTURE_ARGS}
${mitk_superbuild_ep_args}
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}
BINARY_DIR ${CMAKE_BINARY_DIR}/MITK-build
BUILD_COMMAND ""
INSTALL_COMMAND ""
DEPENDS
MITK-Utilities
)
mitkFunctionInstallExternalCMakeProject(${proj})
#-----------------------------------------------------------------------------
# MITK
#-----------------------------------------------------------------------------
if(CMAKE_GENERATOR MATCHES ".*Makefiles.*")
set(mitk_build_cmd "$(MAKE)")
else()
set(mitk_build_cmd ${CMAKE_COMMAND} --build ${CMAKE_CURRENT_BINARY_DIR}/MITK-build --config ${CMAKE_CFG_INTDIR})
endif()
if(NOT DEFINED SUPERBUILD_EXCLUDE_MITKBUILD_TARGET OR NOT SUPERBUILD_EXCLUDE_MITKBUILD_TARGET)
set(MITKBUILD_TARGET_ALL_OPTION "ALL")
else()
set(MITKBUILD_TARGET_ALL_OPTION "")
endif()
add_custom_target(MITK-build ${MITKBUILD_TARGET_ALL_OPTION}
COMMAND ${mitk_build_cmd}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/MITK-build
DEPENDS MITK-Configure
)
#-----------------------------------------------------------------------------
# Custom target allowing to drive the build of the MITK project itself
#-----------------------------------------------------------------------------
add_custom_target(MITK
COMMAND ${mitk_build_cmd}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/MITK-build
)