Page MenuHomePhabricator

No OneTemporary

This file is larger than 256 KB, so syntax highlighting was skipped.
This document is not UTF8. It was detected as ISO-8859-1 (Latin 1) and converted to UTF8 for display.
diff --git a/Applications/PluginGenerator/PluginTemplate/documentation/UserManual/icon.xpm b/Applications/PluginGenerator/PluginTemplate/documentation/UserManual/icon.xpm
deleted file mode 100644
index 9057c20bc6..0000000000
--- a/Applications/PluginGenerator/PluginTemplate/documentation/UserManual/icon.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static const char * icon_xpm[] = {
-"16 16 2 1",
-" c #FF0000",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/Applications/PluginGenerator/ProjectTemplate/CMakeExternals/MITK.cmake b/Applications/PluginGenerator/ProjectTemplate/CMakeExternals/MITK.cmake
index 43155e16cd..60fd693999 100644
--- a/Applications/PluginGenerator/ProjectTemplate/CMakeExternals/MITK.cmake
+++ b/Applications/PluginGenerator/ProjectTemplate/CMakeExternals/MITK.cmake
@@ -1,211 +1,211 @@
#-----------------------------------------------------------------------------
# MITK
#-----------------------------------------------------------------------------
set(MITK_DEPENDS)
set(proj_DEPENDENCIES)
set(proj MITK)
if(NOT MITK_DIR)
#-----------------------------------------------------------------------------
# Create CMake options to customize the MITK build
#-----------------------------------------------------------------------------
option(MITK_USE_SUPERBUILD "Use superbuild for MITK" ON)
option(MITK_USE_BLUEBERRY "Build the BlueBerry platform in MITK" ON)
option(MITK_BUILD_EXAMPLES "Build the MITK examples" OFF)
option(MITK_BUILD_ALL_PLUGINS "Build all MITK plugins" OFF)
option(MITK_BUILD_TESTING "Build the MITK unit tests" OFF)
- option(MITK_USE_ACVD "Use Approximated Centroidal Voronoi Diagrams" OFF)
+ option(MITK_USE_OpenMesh "" OFF)
option(MITK_USE_CTK "Use CTK in MITK" ${MITK_USE_BLUEBERRY})
option(MITK_USE_DCMTK "Use DCMTK in MITK" ON)
option(MITK_USE_Qt5 "Use Qt 5 library in MITK" ON)
option(MITK_USE_DCMQI "Use dcmqi in MITK" OFF)
option(MITK_USE_OpenCV "Use Intel's OpenCV library" OFF)
option(MITK_USE_Python3 "Enable Python wrapping in MITK" OFF)
if(MITK_USE_BLUEBERRY AND NOT MITK_USE_CTK)
message("Forcing MITK_USE_CTK to ON because of MITK_USE_BLUEBERRY")
set(MITK_USE_CTK ON CACHE BOOL "Use CTK in MITK" FORCE)
endif()
if(MITK_USE_CTK AND NOT MITK_USE_Qt5)
message("Forcing MITK_USE_Qt5 to ON because of MITK_USE_CTK")
set(MITK_USE_Qt5 ON CACHE BOOL "Use Qt 5 library in MITK" FORCE)
endif()
set(MITK_USE_CableSwig ${MITK_USE_Python3})
set(MITK_USE_GDCM 1)
set(MITK_USE_ITK 1)
set(MITK_USE_VTK 1)
mark_as_advanced(MITK_USE_SUPERBUILD
MITK_BUILD_ALL_PLUGINS
MITK_BUILD_TESTING
)
set(mitk_cmake_boolean_args
MITK_USE_SUPERBUILD
MITK_USE_BLUEBERRY
MITK_BUILD_EXAMPLES
MITK_BUILD_ALL_PLUGINS
- MITK_USE_ACVD
+ MITK_USE_OpenMesh
MITK_USE_CTK
MITK_USE_DCMTK
MITK_USE_Qt5
MITK_USE_DCMQI
MITK_USE_OpenCV
MITK_USE_Python3
)
if(MITK_USE_Qt5)
# Look for Qt at the superbuild level, to catch missing Qt libs early
find_package(Qt5Widgets REQUIRED)
endif()
set(additional_mitk_cmakevars )
# Configure the set of default pixel types
set(MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES
"int, unsigned int, short, unsigned short, char, unsigned char"
CACHE STRING "List of integral pixel types used in AccessByItk and InstantiateAccessFunction macros")
set(MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES
"double, float"
CACHE STRING "List of floating pixel types used in AccessByItk and InstantiateAccessFunction macros")
set(MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES
""
CACHE STRING "List of composite pixel types used in AccessByItk and InstantiateAccessFunction macros")
set(MITK_ACCESSBYITK_DIMENSIONS
"2,3"
CACHE STRING "List of dimensions used in AccessByItk and InstantiateAccessFunction macros")
foreach(_arg MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES
MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES MITK_ACCESSBYITK_DIMENSIONS)
mark_as_advanced(${_arg})
list(APPEND additional_mitk_cmakevars "-D${_arg}:STRING=${${_arg}}")
endforeach()
#-----------------------------------------------------------------------------
# Create options to inject pre-build dependencies
#-----------------------------------------------------------------------------
- foreach(proj CTK DCMTK DCMQI GDCM VTK ACVD ITK OpenCV CableSwig)
+ foreach(proj CTK DCMTK DCMQI GDCM VTK OpenMesh ITK OpenCV CableSwig)
if(MITK_USE_${proj})
set(MITK_${proj}_DIR "${${proj}_DIR}" CACHE PATH "Path to ${proj} build directory")
mark_as_advanced(MITK_${proj}_DIR)
if(MITK_${proj}_DIR)
list(APPEND additional_mitk_cmakevars "-D${proj}_DIR:PATH=${MITK_${proj}_DIR}")
endif()
endif()
endforeach()
set(MITK_BOOST_ROOT "${BOOST_ROOT}" CACHE PATH "Path to Boost directory")
mark_as_advanced(MITK_BOOST_ROOT)
if(MITK_BOOST_ROOT)
list(APPEND additional_mitk_cmakevars "-DBOOST_ROOT:PATH=${MITK_BOOST_ROOT}")
endif()
set(MITK_SOURCE_DIR "" CACHE PATH "MITK source code location. If empty, MITK will be cloned from MITK_GIT_REPOSITORY")
set(MITK_GIT_REPOSITORY "https://phabricator.mitk.org/source/mitk.git" CACHE STRING "The git repository for cloning MITK")
set(MITK_GIT_TAG "origin/master" CACHE STRING "The git tag/hash to be used when cloning from MITK_GIT_REPOSITORY")
mark_as_advanced(MITK_SOURCE_DIR MITK_GIT_REPOSITORY MITK_GIT_TAG)
#-----------------------------------------------------------------------------
# Create the final variable containing superbuild boolean args
#-----------------------------------------------------------------------------
set(mitk_boolean_args)
foreach(mitk_cmake_arg ${mitk_cmake_boolean_args})
list(APPEND mitk_boolean_args -D${mitk_cmake_arg}:BOOL=${${mitk_cmake_arg}})
endforeach()
#-----------------------------------------------------------------------------
# Additional MITK CMake variables
#-----------------------------------------------------------------------------
if(MITK_USE_Qt5)
list(APPEND additional_mitk_cmakevars "-DCMAKE_PREFIX_PATH:PATH=${CMAKE_PREFIX_PATH}")
endif()
if(MITK_USE_CTK)
list(APPEND additional_mitk_cmakevars "-DGIT_EXECUTABLE:FILEPATH=${GIT_EXECUTABLE}")
endif()
if(MITK_INITIAL_CACHE_FILE)
list(APPEND additional_mitk_cmakevars "-DMITK_INITIAL_CACHE_FILE:INTERNAL=${MITK_INITIAL_CACHE_FILE}")
endif()
if(MITK_USE_SUPERBUILD)
set(MITK_BINARY_DIR ${proj}-superbuild)
else()
set(MITK_BINARY_DIR ${proj}-build)
endif()
set(proj_DEPENDENCIES)
set(MITK_DEPENDS ${proj})
# Configure the MITK souce code location
if(NOT MITK_SOURCE_DIR)
set(mitk_source_location
SOURCE_DIR ${CMAKE_BINARY_DIR}/${proj}
GIT_REPOSITORY ${MITK_GIT_REPOSITORY}
GIT_TAG ${MITK_GIT_TAG}
)
else()
set(mitk_source_location
SOURCE_DIR ${MITK_SOURCE_DIR}
)
endif()
ExternalProject_Add(${proj}
${mitk_source_location}
BINARY_DIR ${MITK_BINARY_DIR}
PREFIX ${proj}${ep_suffix}
INSTALL_COMMAND ""
CMAKE_GENERATOR ${gen}
CMAKE_ARGS
${ep_common_args}
${mitk_boolean_args}
${additional_mitk_cmakevars}
-DBUILD_SHARED_LIBS:BOOL=ON
-DBUILD_TESTING:BOOL=${MITK_BUILD_TESTING}
CMAKE_CACHE_ARGS
${ep_common_cache_args}
CMAKE_CACHE_DEFAULT_ARGS
${ep_common_cache_default_args}
DEPENDS
${proj_DEPENDENCIES}
)
if(MITK_USE_SUPERBUILD)
set(MITK_DIR "${CMAKE_CURRENT_BINARY_DIR}/${MITK_BINARY_DIR}/MITK-build")
else()
set(MITK_DIR "${CMAKE_CURRENT_BINARY_DIR}/${MITK_BINARY_DIR}")
endif()
else()
# The project is provided using MITK_DIR, nevertheless since other
# projects may depend on MITK, let's add an 'empty' one
MacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
# Further, do some sanity checks in the case of a pre-built MITK
set(my_itk_dir ${ITK_DIR})
set(my_vtk_dir ${VTK_DIR})
find_package(MITK REQUIRED)
if(my_itk_dir AND NOT my_itk_dir STREQUAL ${ITK_DIR})
message(FATAL_ERROR "ITK packages do not match:\n ${MY_PROJECT_NAME}: ${my_itk_dir}\n MITK: ${ITK_DIR}")
endif()
if(my_vtk_dir AND NOT my_vtk_dir STREQUAL ${VTK_DIR})
message(FATAL_ERROR "VTK packages do not match:\n ${MY_PROJECT_NAME}: ${my_vtk_dir}\n MITK: ${VTK_DIR}")
endif()
endif()
diff --git a/CMake/BuildConfigurations/Default.cmake b/CMake/BuildConfigurations/Default.cmake
index 4faffa7f12..ab92d73684 100644
--- a/CMake/BuildConfigurations/Default.cmake
+++ b/CMake/BuildConfigurations/Default.cmake
@@ -1,23 +1,23 @@
set(MITK_CONFIG_PACKAGES
- ACVD
+ OpenMesh
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
)
diff --git a/CMake/BuildConfigurations/mitkNavigationModules.cmake b/CMake/BuildConfigurations/mitkNavigationModules.cmake
index d6881034ab..5836dc8d04 100644
--- a/CMake/BuildConfigurations/mitkNavigationModules.cmake
+++ b/CMake/BuildConfigurations/mitkNavigationModules.cmake
@@ -1,35 +1,35 @@
message(STATUS "Configuring MITK Navigation Modules Build")
set(MITK_CONFIG_PACKAGES
- ACVD
+ OpenMesh
Qt5
BLUEBERRY
)
# Enable open cv and open igt link, which is a necessary configuration
set(MITK_USE_OpenCV ON CACHE BOOL "MITK Use OpenCV Library" FORCE)
set(MITK_USE_OpenIGTLink ON CACHE BOOL "MITK Use OpenIGTLink Library" FORCE)
# Enable default plugins and the navigation modules
set(MITK_CONFIG_PLUGINS
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.registration
org.mitk.gui.qt.remeshing
org.mitk.gui.qt.viewnavigator
org.mitk.gui.qt.imagecropper
org.mitk.gui.qt.igttracking
org.mitk.gui.qt.openigtlink
org.mitk.gui.qt.ultrasound
org.mitk.gui.qt.tofutil
)
diff --git a/CMake/FindAnt.cmake b/CMake/FindAnt.cmake
deleted file mode 100644
index b96ef5e74e..0000000000
--- a/CMake/FindAnt.cmake
+++ /dev/null
@@ -1,16 +0,0 @@
-# - Find Ant (a java build tool)
-# This module defines
-# ANT_VERSION version string of ant if found
-# ANT_FOUND, If false, do not try to use ant
-
-exec_program(ant ARGS -version OUTPUT_VARIABLE ANT_VERSION
- RETURN_VALUE ANT_RETURN)
-
-if(ANT_RETURN STREQUAL "0")
- set(ANT_FOUND TRUE)
- if(NOT ANT_FIND_QUIETLY)
- message(STATUS "Found Ant: ${ANT_VERSION}")
- endif(NOT ANT_FIND_QUIETLY)
-else(ANT_RETURN STREQUAL "0")
- set(ANT_FOUND FALSE)
-endif(ANT_RETURN STREQUAL "0")
\ No newline at end of file
diff --git a/CMake/PackageDepends/MITK_ACVD_Config.cmake b/CMake/PackageDepends/MITK_ACVD_Config.cmake
deleted file mode 100644
index 55d36d47bf..0000000000
--- a/CMake/PackageDepends/MITK_ACVD_Config.cmake
+++ /dev/null
@@ -1,4 +0,0 @@
-list(APPEND ALL_LIBRARIES ${ACVD_LIBRARIES})
-if(ACVD_INCLUDE_DIRS)
- list(APPEND ALL_INCLUDE_DIRECTORIES ${ACVD_INCLUDE_DIRS})
-endif()
diff --git a/CMake/PackageDepends/MITK_OpenMesh_Config.cmake b/CMake/PackageDepends/MITK_OpenMesh_Config.cmake
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/CMake/PackageDepends/MITK_VTK_Config.cmake b/CMake/PackageDepends/MITK_VTK_Config.cmake
index e81aee00b9..f13834dd55 100644
--- a/CMake/PackageDepends/MITK_VTK_Config.cmake
+++ b/CMake/PackageDepends/MITK_VTK_Config.cmake
@@ -1,12 +1,8 @@
find_package(VTK COMPONENTS ${VTK_REQUIRED_COMPONENTS_BY_MODULE} REQUIRED)
-if(VTK_FOUND AND NOT VTK_BUILD_SHARED_LIBS)
- message(FATAL_ERROR "MITK only supports a VTK which was built with shared libraries. Turn on BUILD_SHARED_LIBS in your VTK config.")
-endif()
if(MITK_USE_Qt5)
find_package(Qt5Widgets REQUIRED QUIET)
endif()
list(APPEND ALL_INCLUDE_DIRECTORIES ${VTK_INCLUDE_DIRS})
list(APPEND ALL_LIBRARIES ${VTK_LIBRARIES})
-list(APPEND ALL_COMPILE_DEFINITIONS ${VTK_DEFINITIONS})
diff --git a/CMake/mitkFunctionAddCustomModuleTest.cmake b/CMake/mitkFunctionAddCustomModuleTest.cmake
index 4893b55495..de4f9e065a 100644
--- a/CMake/mitkFunctionAddCustomModuleTest.cmake
+++ b/CMake/mitkFunctionAddCustomModuleTest.cmake
@@ -1,27 +1,37 @@
#!
#! \brief Add a custom test for MITK module
#!
#! \param test_name Unique identifier for the test
#! \param test_function Name of the test function (the one with the argc,argv signature)
#!
#! Additional parameters will be passed as command line parameters to the test.
#!
function(mitkAddCustomModuleTest test_name test_function)
if (BUILD_TESTING AND MODULE_IS_ENABLED)
if(MITK_XVFB_TESTING)
set(xvfb_run ${MITK_XVFB_TESTING_COMMAND})
else()
set(xvfb_run )
endif()
add_test(NAME ${test_name} COMMAND ${xvfb_run} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} ${test_function} ${ARGN})
mitkFunctionGetLibrarySearchPaths(MITK_RUNTIME_PATH_RELEASE release RELEASE)
mitkFunctionGetLibrarySearchPaths(MITK_RUNTIME_PATH_DEBUG debug DEBUG)
set(test_env_path ${MITK_RUNTIME_PATH_RELEASE} ${MITK_RUNTIME_PATH_DEBUG} $ENV{PATH})
list(REMOVE_DUPLICATES test_env_path)
string (REGEX REPLACE "\;" "\\\;" test_env_path "${test_env_path}")
set_property(TEST ${test_name} PROPERTY ENVIRONMENT "PATH=${test_env_path}" APPEND)
set_property(TEST ${test_name} PROPERTY SKIP_RETURN_CODE 77)
endif()
endfunction()
+
+function(mitkAddCustomModuleRenderingTest test_name test_function)
+
+ mitkAddCustomModuleTest(${test_name} ${test_function} ${ARGN})
+ if(TEST ${test_name})
+ set_property(TEST ${test_name} APPEND PROPERTY LABELS "Rendering Tests")
+ set_property(TEST ${test_name} PROPERTY RUN_SERIAL TRUE)
+ endif()
+
+endfunction()
diff --git a/CMake/mitkFunctionConvertXPSchema.cmake b/CMake/mitkFunctionConvertXPSchema.cmake
deleted file mode 100644
index 681e31bee5..0000000000
--- a/CMake/mitkFunctionConvertXPSchema.cmake
+++ /dev/null
@@ -1,47 +0,0 @@
-# mitkFunctionConvertXPSchema(INPUT plugin.xml ...
-# OUTPUT_DIR output_dir
-# TARGET_NAME target_name
-# [DEPENDS depends]
-# [WORKING_DIR working_dir]
-# )
-function(mitkFunctionConvertXPSchema)
-
- set(_macro_options
- )
-
- set(_macro_params
- OUTPUT_DIR
- TARGET_NAME
- WORKING_DIR
- )
-
- set(_macro_multiparams
- INPUT
- DEPENDS
- )
-
- cmake_parse_arguments(_SCHEMA "${_macro_options}" "${_macro_params}" "${_macro_multiparams}" ${ARGN})
-
- set(XP_ANT_TASKS)
- foreach(_file ${_SCHEMA_INPUT})
- set(XP_ANT_TASKS "${XP_ANT_TASKS}
- <pde.convertSchemaToHTML manifest=\"${_file}\" destination=\"\${dest}\" />"
- )
- endforeach()
-
- set(XP_DOC_DESTINATION "${_SCHEMA_OUTPUT_DIR}")
-
- if(NOT _SCHEMA_WORKING_DIR)
- set(_SCHEMA_WORKING_DIR ${CMAKE_CURRENT_BINARY_DIR})
- endif()
-
- configure_file("${CMAKE_CURRENT_LIST_DIR}/buildExtPointDoc.xml.in"
- "${_SCHEMA_WORKING_DIR}/buildExtPointDoc.xml" @ONLY)
-
- add_custom_target(${_SCHEMA_TARGET_NAME}
- ant -f ${_SCHEMA_WORKING_DIR}/buildExtPointDoc.xml
- DEPENDS ${_SCHEMA_DEPENDS}
- WORKING_DIRECTORY ${_SCHEMA_WORKING_DIR}
- VERBATIM)
-
-endfunction()
diff --git a/CMake/mitkFunctionCreateBlueBerryApplication.cmake b/CMake/mitkFunctionCreateBlueBerryApplication.cmake
index d960ec77ff..9f4001b778 100644
--- a/CMake/mitkFunctionCreateBlueBerryApplication.cmake
+++ b/CMake/mitkFunctionCreateBlueBerryApplication.cmake
@@ -1,229 +1,229 @@
#!
#! Create a BlueBerry application.
#!
#! \brief This function will create a BlueBerry application together with all
#! necessary provisioning and configuration data and install support.
#!
#! \param NAME (required) The name of the executable.
#! \param DESCRIPTION (optional) A human-readable description of your application.
#! The usage depends on the CPack generator (on Windows, this is a descriptive
#! text for the created shortcuts).
#! \param SOURCES (optional) A list of source files to compile into your executable. Defaults
#! to <name>.cpp.
#! \param PLUGINS (optional) A list of required plug-ins. Defaults to all known plug-ins.
#! \param EXCLUDE_PLUGINS (optional) A list of plug-ins which should not be used. Mainly
#! useful if PLUGINS was not used.
#! \param LINK_LIBRARIES A list of libraries to be linked with the executable.
#! \param LIBRARY_DIRS A list of directories to pass through to MITK_INSTALL_TARGETS
#! \param NO_PROVISIONING (option) Do not create provisioning files.
#! \param NO_INSTALL (option) Do not install this executable
#!
#! Assuming that there exists a file called <code>MyApp.cpp</code>, an example call looks like:
#! \code
#! mitkFunctionCreateBlueBerryApplication(
#! NAME MyApp
#! DESCRIPTION "MyApp - New ways to explore medical data"
#! EXCLUDE_PLUGINS org.mitk.gui.qt.extapplication
#! )
#! \endcode
#!
function(mitkFunctionCreateBlueBerryApplication)
cmake_parse_arguments(_APP "NO_PROVISIONING;NO_INSTALL" "NAME;DESCRIPTION" "SOURCES;PLUGINS;EXCLUDE_PLUGINS;LINK_LIBRARIES;LIBRARY_DIRS" ${ARGN})
if(NOT _APP_NAME)
message(FATAL_ERROR "NAME argument cannot be empty.")
endif()
if(NOT _APP_SOURCES)
set(_APP_SOURCES ${_APP_NAME}.cpp)
endif()
if(NOT _APP_PLUGINS)
ctkFunctionGetAllPluginTargets(_APP_PLUGINS)
else()
set(_plugins ${_APP_PLUGINS})
set(_APP_PLUGINS)
foreach(_plugin ${_plugins})
string(REPLACE "." "_" _plugin_target ${_plugin})
list(APPEND _APP_PLUGINS ${_plugin_target})
endforeach()
# get all plug-in dependencies
ctkFunctionGetPluginDependencies(_plugin_deps PLUGINS ${_APP_PLUGINS} ALL)
# add the dependencies to the list of application plug-ins
list(APPEND _APP_PLUGINS ${_plugin_deps})
endif()
# -----------------------------------------------------------------------
# Set up include and link dirs for the executable
# -----------------------------------------------------------------------
include_directories(
${org_blueberry_core_runtime_INCLUDE_DIRS}
)
# -----------------------------------------------------------------------
# Add executable icon (Windows)
# -----------------------------------------------------------------------
set(WINDOWS_ICON_RESOURCE_FILE "")
if(WIN32)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/icons/${_APP_NAME}.rc")
set(WINDOWS_ICON_RESOURCE_FILE "${CMAKE_CURRENT_SOURCE_DIR}/icons/${_APP_NAME}.rc")
endif()
endif()
# -----------------------------------------------------------------------
# Create the executable and link libraries
# -----------------------------------------------------------------------
set(_app_compile_flags )
if(WIN32)
set(_app_compile_flags "${_app_compile_flags} -DPOCO_NO_UNWINDOWS -DWIN32_LEAN_AND_MEAN")
endif()
if(MITK_SHOW_CONSOLE_WINDOW)
add_executable(${_APP_NAME} MACOSX_BUNDLE ${_APP_SOURCES} ${WINDOWS_ICON_RESOURCE_FILE})
else()
add_executable(${_APP_NAME} MACOSX_BUNDLE WIN32 ${_APP_SOURCES} ${WINDOWS_ICON_RESOURCE_FILE})
endif()
if(NOT CMAKE_CURRENT_SOURCE_DIR MATCHES "^${CMAKE_SOURCE_DIR}.*")
- foreach(MITK_EXTENSION_DIR ${MITK_EXTENSION_DIRS})
+ foreach(MITK_EXTENSION_DIR ${MITK_ABSOLUTE_EXTENSION_DIRS})
if(CMAKE_CURRENT_SOURCE_DIR MATCHES "^${MITK_EXTENSION_DIR}.*")
- get_filename_component(MITK_EXTENSION_ROOT_FOLDER ${MITK_EXTENSION_DIR} NAME)
+ get_filename_component(MITK_EXTENSION_ROOT_FOLDER "${MITK_EXTENSION_DIR}" NAME)
set_property(TARGET ${_APP_NAME} PROPERTY FOLDER "${MITK_EXTENSION_ROOT_FOLDER}/Applications")
break()
endif()
endforeach()
else()
set_property(TARGET ${_APP_NAME} PROPERTY FOLDER "${MITK_ROOT_FOLDER}/Applications")
endif()
mitk_use_modules(TARGET ${_APP_NAME} MODULES MitkAppUtil)
set_target_properties(${_APP_NAME} PROPERTIES
COMPILE_FLAGS "${_app_compile_flags}")
target_link_libraries(${_APP_NAME} PRIVATE org_blueberry_core_runtime ${_APP_LINK_LIBRARIES})
if(WIN32)
target_link_libraries(${_APP_NAME} PRIVATE ${QT_QTMAIN_LIBRARY})
endif()
# -----------------------------------------------------------------------
# Add executable icon and bundle name (Mac)
# -----------------------------------------------------------------------
if(APPLE)
if( _APP_DESCRIPTION)
set_target_properties(${_APP_NAME} PROPERTIES MACOSX_BUNDLE_NAME "${_APP_DESCRIPTION}")
else()
set_target_properties(${_APP_NAME} PROPERTIES MACOSX_BUNDLE_NAME "${_APP_NAME}")
endif()
set(icon_name "icon.icns")
set(icon_full_path "${CMAKE_CURRENT_SOURCE_DIR}/icons/${icon_name}")
if(EXISTS "${icon_full_path}")
set_target_properties(${_APP_NAME} PROPERTIES MACOSX_BUNDLE_ICON_FILE "${icon_name}")
file(COPY ${icon_full_path} DESTINATION "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_APP_NAME}.app/Contents/Resources/")
INSTALL (FILES ${icon_full_path} DESTINATION "${_APP_NAME}.app/Contents/Resources/")
endif()
endif()
# -----------------------------------------------------------------------
# Set build time dependencies
# -----------------------------------------------------------------------
# This ensures that all enabled plug-ins are up-to-date when the
# executable is build.
if(_APP_PLUGINS)
ctkMacroGetAllProjectTargetLibraries("${_APP_PLUGINS}" _project_plugins)
if(_APP_EXCLUDE_PLUGINS AND _project_plugins)
set(_exclude_targets)
foreach(_exclude_plugin ${_APP_EXCLUDE_PLUGINS})
string(REPLACE "." "_" _exclude_target ${_exclude_plugin})
list(APPEND _exclude_targets ${_exclude_target})
endforeach()
list(REMOVE_ITEM _project_plugins ${_exclude_targets})
endif()
if(_project_plugins)
add_dependencies(${_APP_NAME} ${_project_plugins})
endif()
endif()
# -----------------------------------------------------------------------
# Additional files needed for the executable
# -----------------------------------------------------------------------
if(NOT _APP_NO_PROVISIONING)
# Create a provisioning file, listing all plug-ins
set(_prov_file "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_APP_NAME}.provisioning")
mitkFunctionCreateProvisioningFile(FILE ${_prov_file}
PLUGINS ${_APP_PLUGINS}
EXCLUDE_PLUGINS ${_APP_EXCLUDE_PLUGINS}
)
endif()
# Create a .ini file for initial parameters
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_APP_NAME}.ini")
configure_file(${_APP_NAME}.ini
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_APP_NAME}.ini)
endif()
# Create batch and VS user files for Windows platforms
include(mitkFunctionCreateWindowsBatchScript)
if(WIN32)
set(template_name "start${_APP_NAME}.bat.in")
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${template_name}")
foreach(BUILD_TYPE debug release)
mitkFunctionCreateWindowsBatchScript(${template_name}
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/start${_APP_NAME}_${BUILD_TYPE}.bat
${BUILD_TYPE})
endforeach()
endif()
mitkFunctionConfigureVisualStudioUserProjectFile(
NAME ${_APP_NAME}
)
endif(WIN32)
# -----------------------------------------------------------------------
# Install support
# -----------------------------------------------------------------------
if(NOT _APP_NO_INSTALL)
# This installs all third-party CTK plug-ins
mitkFunctionInstallThirdPartyCTKPlugins(${_APP_PLUGINS} EXCLUDE ${_APP_EXCLUDE_PLUGINS})
if(COMMAND BlueBerryApplicationInstallHook)
set(_real_app_plugins ${_APP_PLUGINS})
if(_APP_EXCLUDE_PLUGINS)
list(REMOVE_ITEM _real_app_plugins ${_APP_EXCLUDE_PLUGINS})
endif()
BlueBerryApplicationInstallHook(APP_NAME ${_APP_NAME} PLUGINS ${_real_app_plugins})
endif()
# Install the executable
MITK_INSTALL_TARGETS(EXECUTABLES ${_APP_NAME} LIBRARY_DIRS ${_APP_LIBRARY_DIRS} GLOB_PLUGINS )
if(NOT _APP_NO_PROVISIONING)
# Install the provisioning file
mitkFunctionInstallProvisioningFiles(${_prov_file})
endif()
# On Linux, create a shell script to start a relocatable application
if(UNIX AND NOT APPLE)
install(PROGRAMS "${MITK_SOURCE_DIR}/CMake/RunInstalledApp.sh" DESTINATION "." RENAME ${_APP_NAME}.sh)
endif()
# Tell cpack the executables that you want in the start menu as links
set(MITK_CPACK_PACKAGE_EXECUTABLES ${MITK_CPACK_PACKAGE_EXECUTABLES} "${_APP_NAME};${_APP_DESCRIPTION}" CACHE INTERNAL "Collecting windows shortcuts to executables")
endif()
endfunction()
function(FunctionCreateBlueBerryApplication)
message(SEND_ERROR "The function FunctionCreateBlueBerryApplication was renamed to mitkFunctionCreateBlueBerryApplication in MITK 2015.05")
endfunction()
diff --git a/CMake/mitkFunctionCreateModule.cmake b/CMake/mitkFunctionCreateModule.cmake
index e89c11457f..4fe684de2f 100644
--- a/CMake/mitkFunctionCreateModule.cmake
+++ b/CMake/mitkFunctionCreateModule.cmake
@@ -1,646 +1,651 @@
##################################################################
#
# mitk_create_module
#
#! Creates a module for the automatic module dependency system within MITK.
#!
#! Example:
#!
#! \code
#! mitk_create_module(
#! DEPENDS PUBLIC MitkCore
#! PACKAGE_DEPENDS
#! PRIVATE Qt5|Xml+Networking
#! PUBLIC ITK|Watershed
#! \endcode
#!
#! The <moduleName> parameter specifies the name of the module which is used
#! to create a logical target name. The parameter is optional in case the
#! MITK_MODULE_NAME_DEFAULTS_TO_DIRECTORY_NAME variable evaluates to TRUE. The
#! module name will then be derived from the directory name in which this
#! function is called.
#!
#! If set, the following variables will be used to validate the module name:
#!
#! MITK_MODULE_NAME_REGEX_MATCH The module name must match this regular expression.
#! MITK_MODULE_NAME_REGEX_NOT_MATCH The module name must not match this regular expression.
#!
#! If the MITK_MODULE_NAME_PREFIX variable is set, the module name will be prefixed
#! with its contents.
#!
#! A modules source files are specified in a separate CMake file usually
#! called files.cmake, located in the module root directory. The
#! mitk_create_module() macro evaluates the following CMake variables
#! from the files.cmake file:
#!
#! - CPP_FILES A list of .cpp files
#! - H_FILES A list of .h files without a corresponding .cpp file
#! - TXX_FILES A list of .txx files
#! - RESOURCE_FILES A list of files (resources) which are embedded into the module
#! - MOC_H_FILES A list of Qt header files which should be processed by the MOC
#! - UI_FILES A list of .ui Qt UI files
#! - QRC_FILES A list of .qrc Qt resource files
#! - DOX_FILES A list of .dox Doxygen files
#!
#! List of variables available after the function is called:
#! - MODULE_NAME
#! - MODULE_TARGET
#! - MODULE_IS_ENABLED
#!
#! \sa mitk_create_executable
#!
#! Parameters (all optional):
#!
#! \param <moduleName> The module name (also used as target name)
#! \param FILES_CMAKE File name of a CMake file setting source list variables
#! (defaults to files.cmake)
#! \param VERSION Module version number, e.g. "1.2.0"
#! \param AUTOLOAD_WITH A module target name identifying the module which will
#! trigger the automatic loading of this module
#! \param DEPRECATED_SINCE Marks this modules as deprecated since <arg>
#! \param DESCRIPTION A description for this module
#!
#! Multi-value Parameters (all optional):
#!
#! \param INCLUDE_DIRS Include directories for this module:
#! \verbatim
#! [[PUBLIC|PRIVATE|INTERFACE] <dir1>...]...
#! \endverbatim
#! The default scope for include directories is PUBLIC.
#! \param DEPENDS List of module dependencies:
#! \verbatim
#! [[PUBLIC|PRIVATE|INTERFACE] <module1>...]...
#! \endverbatim
#! The default scope for module dependencies is PUBLIC.
#! \param PACKAGE_DEPENDS List of public packages dependencies (e.g. Qt, VTK, etc.).
#! Package dependencies have the following syntax:
#! \verbatim
#! [PUBLIC|PRIVATE|INTERFACE] PACKAGE[|COMPONENT1[+COMPONENT2]...]
#! \endverbatim
#! The default scope for package dependencies is PRIVATE.
#! \param ADDITIONAL_LIBS List of additional private libraries linked to this module.
#! The folder containing the library will be added to the global list of library search paths.
#! \param CPP_FILES List of source files for this module. If the list is non-empty,
#! the module does not need to provide a files.cmake file or FILES_CMAKE argument.
#! \param H_FILES List of public header files for this module. It is recommended to use
#! a files.cmake file instead.
#!
#! Options (optional)
#!
#! \param FORCE_STATIC Force building this module as a static library
#! \param GCC_DEFAULT_VISIBILITY Do not use gcc visibility flags - all
#! symbols will be exported
#! \param NO_INIT Do not create CppMicroServices initialization code
#! \param NO_FEATURE_INFO Do not create a feature info by calling add_feature_info()
#! \param WARNINGS_NO_ERRORS Do not treat compiler warnings as errors
#
##################################################################
function(mitk_create_module)
set(_macro_params
VERSION # module version number, e.g. "1.2.0"
EXPORT_DEFINE # export macro name for public symbols of this module (DEPRECATED)
AUTOLOAD_WITH # a module target name identifying the module which will trigger the
# automatic loading of this module
FILES_CMAKE # file name of a CMake file setting source list variables
# (defaults to files.cmake)
DEPRECATED_SINCE # marks this modules as deprecated
DESCRIPTION # a description for this module
)
set(_macro_multiparams
SUBPROJECTS # list of CDash labels (deprecated)
INCLUDE_DIRS # include directories: [PUBLIC|PRIVATE|INTERFACE] <list>
INTERNAL_INCLUDE_DIRS # include dirs internal to this module (DEPRECATED)
DEPENDS # list of modules this module depends on: [PUBLIC|PRIVATE|INTERFACE] <list>
DEPENDS_INTERNAL # list of modules this module internally depends on (DEPRECATED)
PACKAGE_DEPENDS # list of "packages this module depends on (e.g. Qt, VTK, etc.): [PUBLIC|PRIVATE|INTERFACE] <package-list>
TARGET_DEPENDS # list of CMake targets this module should depend on
ADDITIONAL_LIBS # list of addidtional private libraries linked to this module.
CPP_FILES # list of cpp files
H_FILES # list of header files: [PUBLIC|PRIVATE] <list>
)
set(_macro_options
FORCE_STATIC # force building this module as a static library
HEADERS_ONLY # this module is a headers-only library
GCC_DEFAULT_VISIBILITY # do not use gcc visibility flags - all symbols will be exported
NO_DEFAULT_INCLUDE_DIRS # do not add default include directories like "include" or "."
NO_INIT # do not create CppMicroServices initialization code
NO_FEATURE_INFO # do not create a feature info by calling add_feature_info()
WARNINGS_NO_ERRORS # do not treat compiler warnings as errors
EXECUTABLE # create an executable; do not use directly, use mitk_create_executable() instead
C_MODULE # compile all source files as C sources
CXX_MODULE # compile all source files as C++ sources
)
cmake_parse_arguments(MODULE "${_macro_options}" "${_macro_params}" "${_macro_multiparams}" ${ARGN})
set(MODULE_NAME ${MODULE_UNPARSED_ARGUMENTS})
# -----------------------------------------------------------------
# Sanity checks
if(NOT MODULE_NAME)
if(MITK_MODULE_NAME_DEFAULTS_TO_DIRECTORY_NAME)
get_filename_component(MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
else()
message(SEND_ERROR "The module name must not be empty")
endif()
endif()
set(_deprecated_args INTERNAL_INCLUDE_DIRS DEPENDS_INTERNAL EXPORT_DEFINE TARGET_DEPENDS HEADERS_ONLY)
foreach(_deprecated_arg ${_deprecated_args})
if(MODULE_${_deprecated_arg})
message(WARNING "The ${_deprecated_arg} argument is deprecated")
endif()
endforeach()
set(_module_type module)
set(_Module_type Module)
if(MODULE_EXECUTABLE)
set(_module_type executable)
set(_Module_type Executable)
endif()
if(MITK_MODULE_NAME_REGEX_MATCH)
if(NOT ${MODULE_NAME} MATCHES ${MITK_MODULE_NAME_REGEX_MATCH})
message(SEND_ERROR "The ${_module_type} name \"${MODULE_NAME}\" does not match the regular expression \"${MITK_MODULE_NAME_REGEX_MATCH}\".")
endif()
endif()
if(MITK_MODULE_NAME_REGEX_NOT_MATCH)
if(${MODULE_NAME} MATCHES ${MITK_MODULE_NAME_REGEX_NOT_MATCH})
message(SEND_ERROR "The ${_module_type} name \"${MODULE_NAME}\" must not match the regular expression \"${MITK_MODULE_NAME_REGEX_NOT_MATCH}\".")
endif()
endif()
if(MITK_MODULE_NAME_PREFIX AND NOT MODULE_NAME MATCHES "^${MITK_MODULE_NAME_PREFIX}.*$")
set(MODULE_NAME "${MITK_MODULE_NAME_PREFIX}${MODULE_NAME}")
endif()
if(NOT MODULE_FILES_CMAKE)
set(MODULE_FILES_CMAKE files.cmake)
endif()
if(NOT IS_ABSOLUTE ${MODULE_FILES_CMAKE})
set(MODULE_FILES_CMAKE ${CMAKE_CURRENT_SOURCE_DIR}/${MODULE_FILES_CMAKE})
endif()
# -----------------------------------------------------------------
# Check if module should be build
set(MODULE_TARGET ${MODULE_NAME})
# assume worst case
set(MODULE_IS_ENABLED 0)
# first we check if we have an explicit module build list
if(MITK_MODULES_TO_BUILD)
list(FIND MITK_MODULES_TO_BUILD ${MODULE_NAME} _MOD_INDEX)
if(_MOD_INDEX EQUAL -1)
set(MODULE_IS_EXCLUDED 1)
endif()
endif()
if(NOT MODULE_IS_EXCLUDED)
# first of all we check for the dependencies
_mitk_parse_package_args(${MODULE_PACKAGE_DEPENDS})
mitk_check_module_dependencies(MODULES ${MODULE_DEPENDS}
PACKAGES ${PACKAGE_NAMES}
MISSING_DEPENDENCIES_VAR _MISSING_DEP
PACKAGE_DEPENDENCIES_VAR PACKAGE_NAMES)
if(_MISSING_DEP)
if(MODULE_NO_FEATURE_INFO)
message("${_Module_type} ${MODULE_NAME} won't be built, missing dependency: ${_MISSING_DEP}")
endif()
set(MODULE_IS_ENABLED 0)
else()
foreach(dep ${MODULE_DEPENDS})
if(TARGET ${dep})
get_target_property(AUTLOAD_DEP ${dep} MITK_AUTOLOAD_DIRECTORY)
if (AUTLOAD_DEP)
message(SEND_ERROR "Module \"${MODULE_NAME}\" has an invalid dependency on autoload module \"${dep}\". Check MITK_CREATE_MODULE usage for \"${MODULE_NAME}\".")
endif()
endif()
endforeach(dep)
set(MODULE_IS_ENABLED 1)
# now check for every package if it is enabled. This overlaps a bit with
# MITK_CHECK_MODULE ...
foreach(_package ${PACKAGE_NAMES})
if((DEFINED MITK_USE_${_package}) AND NOT (MITK_USE_${_package}))
message("${_Module_type} ${MODULE_NAME} won't be built. Turn on MITK_USE_${_package} if you want to use it.")
set(MODULE_IS_ENABLED 0)
break()
endif()
endforeach()
endif()
endif()
# -----------------------------------------------------------------
# Start creating the module
if(MODULE_IS_ENABLED)
# clear variables defined in files.cmake
set(RESOURCE_FILES )
set(CPP_FILES )
set(H_FILES )
set(TXX_FILES )
set(DOX_FILES )
set(UI_FILES )
set(MOC_H_FILES )
set(QRC_FILES )
# clear other variables
set(Q${KITNAME}_GENERATED_CPP )
set(Q${KITNAME}_GENERATED_MOC_CPP )
set(Q${KITNAME}_GENERATED_QRC_CPP )
set(Q${KITNAME}_GENERATED_UI_CPP )
# check and set-up auto-loading
if(MODULE_AUTOLOAD_WITH)
if(NOT TARGET "${MODULE_AUTOLOAD_WITH}")
message(SEND_ERROR "The module target \"${MODULE_AUTOLOAD_WITH}\" specified as the auto-loading module for \"${MODULE_NAME}\" does not exist")
endif()
endif()
set(_module_autoload_meta_target "${CMAKE_PROJECT_NAME}-autoload")
# create a meta-target if it does not already exist
if(NOT TARGET ${_module_autoload_meta_target})
add_custom_target(${_module_autoload_meta_target})
set_property(TARGET ${_module_autoload_meta_target} PROPERTY FOLDER "${MITK_ROOT_FOLDER}/Modules/Autoload")
endif()
if(NOT MODULE_EXPORT_DEFINE)
set(MODULE_EXPORT_DEFINE ${MODULE_NAME}_EXPORT)
endif()
if(MITK_GENERATE_MODULE_DOT)
message("MODULEDOTNAME ${MODULE_NAME}")
foreach(dep ${MODULE_DEPENDS})
message("MODULEDOT \"${MODULE_NAME}\" -> \"${dep}\" ; ")
endforeach(dep)
endif(MITK_GENERATE_MODULE_DOT)
if (EXISTS ${MODULE_FILES_CMAKE})
include(${MODULE_FILES_CMAKE})
endif()
if(MODULE_CPP_FILES)
list(APPEND CPP_FILES ${MODULE_CPP_FILES})
endif()
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/src")
# Preprend the "src" directory to the cpp file list
set(_cpp_files ${CPP_FILES})
set(CPP_FILES )
foreach(_cpp_file ${_cpp_files})
list(APPEND CPP_FILES "src/${_cpp_file}")
endforeach()
endif()
if(CPP_FILES OR RESOURCE_FILES OR UI_FILES OR MOC_H_FILES OR QRC_FILES)
set(MODULE_HEADERS_ONLY 0)
if(MODULE_C_MODULE)
set_source_files_properties(${CPP_FILES} PROPERTIES LANGUAGE C)
elseif(MODULE_CXX_MODULE)
set_source_files_properties(${CPP_FILES} PROPERTIES LANGUAGE CXX)
endif()
else()
set(MODULE_HEADERS_ONLY 1)
if(MODULE_AUTOLOAD_WITH)
message(SEND_ERROR "A headers only module cannot be auto-loaded")
endif()
endif()
set(module_c_flags )
set(module_c_flags_debug )
set(module_c_flags_release )
set(module_cxx_flags )
set(module_cxx_flags_debug )
set(module_cxx_flags_release )
if(MODULE_GCC_DEFAULT_VISIBILITY OR NOT CMAKE_COMPILER_IS_GNUCXX)
# We only support hidden visibility for gcc for now. Clang still has troubles with
# correctly marking template declarations and explicit template instantiations as exported.
# See http://comments.gmane.org/gmane.comp.compilers.clang.scm/50028
# and http://llvm.org/bugs/show_bug.cgi?id=10113
set(CMAKE_CXX_VISIBILITY_PRESET default)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 0)
else()
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
endif()
if(NOT MODULE_WARNINGS_NO_ERRORS)
if(MSVC_VERSION)
mitkFunctionCheckCAndCXXCompilerFlags("/WX" module_c_flags module_cxx_flags)
# this would turn on unused parameter warnings, but unfortunately MSVC cannot
# distinguish yet between internal and external headers so this would be triggered
# a lot by external code. There is support for it on the way so this line could be
# reactivated after https://gitlab.kitware.com/cmake/cmake/issues/17904 has been fixed.
# mitkFunctionCheckCAndCXXCompilerFlags("/w34100" module_c_flags module_cxx_flags)
else()
mitkFunctionCheckCAndCXXCompilerFlags(-Werror module_c_flags module_cxx_flags)
# The flag "c++0x-static-nonintegral-init" has been renamed in newer Clang
# versions to "static-member-init", see
# http://clang-developers.42468.n3.nabble.com/Wc-0x-static-nonintegral-init-gone-td3999651.html
#
# Also, older Clang and seemingly all gcc versions do not warn if unknown
# "-no-*" flags are used, so CMake will happily append any -Wno-* flag to the
# command line. This may get confusing if unrelated compiler errors happen and
# the error output then additionally contains errors about unknown flags (which
# is not the case if there were no compile errors).
#
# So instead of using -Wno-* we use -Wno-error=*, which will be properly rejected by
# the compiler and if applicable, prints the specific warning as a real warning and
# not as an error (although -Werror was given).
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=c++0x-static-nonintegral-init" module_c_flags module_cxx_flags)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=static-member-init" module_c_flags module_cxx_flags)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=unknown-warning" module_c_flags module_cxx_flags)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=gnu" module_c_flags module_cxx_flags)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=class-memaccess" module_c_flags module_cxx_flags)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=inconsistent-missing-override" module_c_flags module_cxx_flags)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=deprecated-copy" module_c_flags module_cxx_flags)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=cast-function-type" module_c_flags module_cxx_flags)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=deprecated-declarations" module_c_flags module_cxx_flags)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=type-limits" module_c_flags module_cxx_flags)
endif()
endif()
if(MODULE_FORCE_STATIC)
set(_STATIC STATIC)
else()
set(_STATIC )
endif(MODULE_FORCE_STATIC)
if(NOT MODULE_HEADERS_ONLY)
if(NOT MODULE_NO_INIT OR RESOURCE_FILES)
find_package(CppMicroServices QUIET NO_MODULE REQUIRED)
endif()
if(NOT MODULE_NO_INIT)
usFunctionGenerateModuleInit(CPP_FILES)
endif()
set(binary_res_files )
set(source_res_files )
if(RESOURCE_FILES)
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/resource")
set(res_dir resource)
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Resources")
set(res_dir Resources)
else()
message(SEND_ERROR "Resources specified but ${CMAKE_CURRENT_SOURCE_DIR}/resource directory not found.")
endif()
foreach(res_file ${RESOURCE_FILES})
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/${res_dir}/${res_file})
list(APPEND binary_res_files "${res_file}")
else()
list(APPEND source_res_files "${res_file}")
endif()
endforeach()
# Add a source level dependencies on resource files
usFunctionGetResourceSource(TARGET ${MODULE_TARGET} OUT CPP_FILES)
endif()
endif()
if(MITK_USE_Qt5)
if(UI_FILES)
qt5_wrap_ui(Q${KITNAME}_GENERATED_UI_CPP ${UI_FILES})
endif()
if(MOC_H_FILES)
qt5_wrap_cpp(Q${KITNAME}_GENERATED_MOC_CPP ${MOC_H_FILES} OPTIONS -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
endif()
if(QRC_FILES)
qt5_add_resources(Q${KITNAME}_GENERATED_QRC_CPP ${QRC_FILES})
endif()
endif()
set(Q${KITNAME}_GENERATED_CPP ${Q${KITNAME}_GENERATED_CPP} ${Q${KITNAME}_GENERATED_UI_CPP} ${Q${KITNAME}_GENERATED_MOC_CPP} ${Q${KITNAME}_GENERATED_QRC_CPP})
mitkFunctionOrganizeSources(
SOURCE ${CPP_FILES}
HEADER ${H_FILES}
TXX ${TXX_FILES}
DOC ${DOX_FILES}
UI ${UI_FILES}
QRC ${QRC_FILES}
MOC ${Q${KITNAME}_GENERATED_MOC_CPP}
GEN_QRC ${Q${KITNAME}_GENERATED_QRC_CPP}
GEN_UI ${Q${KITNAME}_GENERATED_UI_CPP}
)
set(coverage_sources
${CPP_FILES} ${H_FILES} ${GLOBBED__H_FILES} ${CORRESPONDING__H_FILES} ${TXX_FILES}
${TOOL_CPPS} ${TOOL_GUI_CPPS})
# ---------------------------------------------------------------
# Create the actual module target
if(MODULE_HEADERS_ONLY)
add_library(${MODULE_TARGET} INTERFACE)
# INTERFACE_LIBRARY targets may only have whitelisted properties. The property "FOLDER" is not allowed.
# set_property(TARGET ${MODULE_TARGET} PROPERTY FOLDER "${MITK_ROOT_FOLDER}/Modules")
else()
if(MODULE_EXECUTABLE)
- add_executable(${MODULE_TARGET}
+ if(MITK_SHOW_CONSOLE_WINDOW)
+ set(_SHOW_CONSOLE_OPTION "")
+ else()
+ set(_SHOW_CONSOLE_OPTION WIN32)
+ endif()
+ add_executable(${MODULE_TARGET} ${_SHOW_CONSOLE_OPTION}
${MODULE_CPP_FILES} ${coverage_sources} ${CPP_FILES_GENERATED} ${Q${KITNAME}_GENERATED_CPP}
- ${DOX_FILES} ${UI_FILES} ${QRC_FILES})
+ ${DOX_FILES} ${UI_FILES} ${QRC_FILES} ${WINDOWS_ICON_RESOURCE_FILE})
set_property(TARGET ${MODULE_TARGET} PROPERTY FOLDER "${MITK_ROOT_FOLDER}/Modules/Executables")
set(_us_module_name main)
else()
add_library(${MODULE_TARGET} ${_STATIC}
${coverage_sources} ${CPP_FILES_GENERATED} ${Q${KITNAME}_GENERATED_CPP}
${DOX_FILES} ${UI_FILES} ${QRC_FILES})
set_property(TARGET ${MODULE_TARGET} PROPERTY FOLDER "${MITK_ROOT_FOLDER}/Modules")
set(_us_module_name ${MODULE_TARGET})
endif()
# Apply properties to the module target.
target_compile_definitions(${MODULE_TARGET} PRIVATE US_MODULE_NAME=${_us_module_name})
if(MODULE_C_MODULE)
if(module_c_flags)
string(REPLACE " " ";" module_c_flags "${module_c_flags}")
target_compile_options(${MODULE_TARGET} PRIVATE ${module_c_flags})
endif()
if(module_c_flags_debug)
string(REPLACE " " ";" module_c_flags_debug "${module_c_flags_debug}")
target_compile_options(${MODULE_TARGET} PRIVATE $<$<CONFIG:Debug>:${module_c_flags_debug}>)
endif()
if(module_c_flags_release)
string(REPLACE " " ";" module_c_flags_release "${module_c_flags_release}")
target_compile_options(${MODULE_TARGET} PRIVATE $<$<CONFIG:Release>:${module_c_flags_release}>)
endif()
else()
if(module_cxx_flags)
string(REPLACE " " ";" module_cxx_flags "${module_cxx_flags}")
target_compile_options(${MODULE_TARGET} PRIVATE ${module_cxx_flags})
endif()
if(module_cxx_flags_debug)
string(REPLACE " " ";" module_cxx_flags_debug "${module_cxx_flags_debug}")
target_compile_options(${MODULE_TARGET} PRIVATE $<$<CONFIG:Debug>:${module_cxx_flags_debug}>)
endif()
if(module_cxx_flags_release)
string(REPLACE " " ";" module_cxx_flags_release "${module_cxx_flags_release}")
target_compile_options(${MODULE_TARGET} PRIVATE $<$<CONFIG:Release>:${module_cxx_flags_release}>)
endif()
endif()
set_property(TARGET ${MODULE_TARGET} PROPERTY US_MODULE_NAME ${_us_module_name})
# Add additional library search directories to a global property which
# can be evaluated by other CMake macros, e.g. our install scripts.
if(MODULE_ADDITIONAL_LIBS)
target_link_libraries(${MODULE_TARGET} PRIVATE ${MODULE_ADDITIONAL_LIBS})
get_property(_mitk_additional_library_search_paths GLOBAL PROPERTY MITK_ADDITIONAL_LIBRARY_SEARCH_PATHS)
foreach(_lib_filepath ${MODULE_ADDITIONAL_LIBS})
get_filename_component(_search_path "${_lib_filepath}" PATH)
if(_search_path)
list(APPEND _mitk_additional_library_search_paths "${_search_path}")
endif()
endforeach()
if(_mitk_additional_library_search_paths)
list(REMOVE_DUPLICATES _mitk_additional_library_search_paths)
set_property(GLOBAL PROPERTY MITK_ADDITIONAL_LIBRARY_SEARCH_PATHS ${_mitk_additional_library_search_paths})
endif()
endif()
# add the target name to a global property which is used in the top-level
# CMakeLists.txt file to export the target
set_property(GLOBAL APPEND PROPERTY MITK_MODULE_TARGETS ${MODULE_TARGET})
if(MODULE_AUTOLOAD_WITH)
# for auto-loaded modules, adapt the output directory
add_dependencies(${_module_autoload_meta_target} ${MODULE_TARGET})
if(WIN32)
set(_module_output_prop RUNTIME_OUTPUT_DIRECTORY)
else()
set(_module_output_prop LIBRARY_OUTPUT_DIRECTORY)
endif()
set(_module_output_dir ${CMAKE_${_module_output_prop}}/${MODULE_AUTOLOAD_WITH})
get_target_property(_module_is_imported ${MODULE_AUTOLOAD_WITH} IMPORTED)
if(NOT _module_is_imported)
# if the auto-loading module is not imported, get its location
# and put the auto-load module relative to it.
get_target_property(_module_output_dir ${MODULE_AUTOLOAD_WITH} ${_module_output_prop})
set_target_properties(${MODULE_TARGET} PROPERTIES
${_module_output_prop} ${_module_output_dir}/${MODULE_AUTOLOAD_WITH})
else()
set_target_properties(${MODULE_TARGET} PROPERTIES
${_module_output_prop} ${CMAKE_${_module_output_prop}}/${MODULE_AUTOLOAD_WITH})
endif()
set_target_properties(${MODULE_TARGET} PROPERTIES
MITK_AUTOLOAD_DIRECTORY ${MODULE_AUTOLOAD_WITH})
# add the auto-load module name as a property
set_property(TARGET ${MODULE_AUTOLOAD_WITH} APPEND PROPERTY MITK_AUTOLOAD_TARGETS ${MODULE_TARGET})
endif()
if(binary_res_files)
usFunctionAddResources(TARGET ${MODULE_TARGET}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${res_dir}
FILES ${binary_res_files})
endif()
if(source_res_files)
usFunctionAddResources(TARGET ${MODULE_TARGET}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${res_dir}
FILES ${source_res_files})
endif()
if(binary_res_files OR source_res_files)
usFunctionEmbedResources(TARGET ${MODULE_TARGET})
endif()
if(MODULE_DEPRECATED_SINCE)
set_property(TARGET ${MODULE_TARGET} PROPERTY MITK_MODULE_DEPRECATED_SINCE ${MODULE_DEPRECATED_SINCE})
endif()
# create export macros
if (NOT MODULE_EXECUTABLE)
set(_export_macro_name )
if(MITK_LEGACY_EXPORT_MACRO_NAME)
set(_export_macro_names
EXPORT_MACRO_NAME ${MODULE_EXPORT_DEFINE}
NO_EXPORT_MACRO_NAME ${MODULE_NAME}_NO_EXPORT
DEPRECATED_MACRO_NAME ${MODULE_NAME}_DEPRECATED
NO_DEPRECATED_MACRO_NAME ${MODULE_NAME}_NO_DEPRECATED
)
endif()
generate_export_header(${MODULE_NAME}
${_export_macro_names}
EXPORT_FILE_NAME ${MODULE_NAME}Exports.h
)
endif()
target_include_directories(${MODULE_TARGET} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
endif()
# ---------------------------------------------------------------
# Properties for both header-only and compiled modules
if(MODULE_HEADERS_ONLY)
set(_module_property_type INTERFACE)
else()
set(_module_property_type PUBLIC)
endif()
if(MODULE_TARGET_DEPENDS)
add_dependencies(${MODULE_TARGET} ${MODULE_TARGET_DEPENDS})
endif()
set(DEPENDS "${MODULE_DEPENDS}")
if(NOT MODULE_NO_INIT AND NOT MODULE_HEADERS_ONLY)
# Add a CppMicroServices dependency implicitly, since it is
# needed for the generated "module initialization" code.
set(DEPENDS "CppMicroServices;${DEPENDS}")
endif()
if(DEPENDS OR MODULE_PACKAGE_DEPENDS)
mitk_use_modules(TARGET ${MODULE_TARGET}
MODULES ${DEPENDS}
PACKAGES ${MODULE_PACKAGE_DEPENDS}
)
endif()
if(NOT MODULE_C_MODULE)
target_compile_features(${MODULE_TARGET} ${_module_property_type} ${MITK_CXX_FEATURES})
endif()
# add include directories
if(MODULE_INTERNAL_INCLUDE_DIRS)
target_include_directories(${MODULE_TARGET} PRIVATE ${MODULE_INTERNAL_INCLUDE_DIRS})
endif()
if(NOT MODULE_NO_DEFAULT_INCLUDE_DIRS)
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_include_directories(${MODULE_TARGET} ${_module_property_type} include)
else()
target_include_directories(${MODULE_TARGET} ${_module_property_type} .)
endif()
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/src)
target_include_directories(${MODULE_TARGET} PRIVATE src)
endif()
endif()
target_include_directories(${MODULE_TARGET} ${_module_property_type} ${MODULE_INCLUDE_DIRS})
endif()
# -----------------------------------------------------------------
# Record missing dependency information
if(_MISSING_DEP)
if(MODULE_DESCRIPTION)
set(MODULE_DESCRIPTION "${MODULE_DESCRIPTION} (missing dependencies: ${_MISSING_DEP})")
else()
set(MODULE_DESCRIPTION "(missing dependencies: ${_MISSING_DEP})")
endif()
endif()
if(NOT MODULE_NO_FEATURE_INFO)
add_feature_info(${MODULE_NAME} MODULE_IS_ENABLED "${MODULE_DESCRIPTION}")
endif()
set(MODULE_NAME ${MODULE_NAME} PARENT_SCOPE)
set(MODULE_TARGET ${MODULE_TARGET} PARENT_SCOPE)
set(MODULE_IS_ENABLED ${MODULE_IS_ENABLED} PARENT_SCOPE)
endfunction()
diff --git a/CMake/mitkFunctionCreatePlugin.cmake b/CMake/mitkFunctionCreatePlugin.cmake
index 680bc2c38d..d73c102897 100644
--- a/CMake/mitkFunctionCreatePlugin.cmake
+++ b/CMake/mitkFunctionCreatePlugin.cmake
@@ -1,350 +1,350 @@
#! \brief Creates a MITK CTK plugin.
#!
#! This function should be called from the plugins CMakeLists.txt file.
#! The target name is available after the macro call as ${PLUGIN_TARGET}
#! to add additional libraries in your CMakeLists.txt. Include paths and link
#! libraries are set depending on the value of the Required-Plugins header
#! in your manifest_headers.cmake file.
#!
#! This function internally calls ctkMacroBuildPlugin() and adds support
#! for Qt Help files and installers.
#!
#! Options:
#! \param TEST_PLUGIN Mark this plug-in as a testing plug-in.
#! \param NO_INSTALL Don't install this plug-in.
#!
#! Parameters:
#!
#! \param EXPORT_DIRECTIVE (required) The export directive to use in the generated
#! <plugin_target>_Exports.h file.
#!
#! Multi-value parameters (all optional):
#!
#! \param EXPORTED_INCLUDE_SUFFIXES A list of sub-directories which should
#! be added to the current source directory. The resulting directories
#! will be available in the set of include directories of depending plug-ins.
#! \param MODULE_DEPENDS (optional) A list of Modules this plug-in depends on.
#! \param PACKAGE_DEPENDS (optional) A list of external packages this plug-in depends on.
#! \param DOXYGEN_TAGFILES (optional) Which external tag files should be available for the plugin documentation
#! \param MOC_OPTIONS (optional) Additional options to pass to the Qt MOC compiler
#! \param WARNINGS_NO_ERRORS (optional) Do not handle compiler warnings as errors
function(mitk_create_plugin)
# options
set(arg_options
TEST_PLUGIN # Mark this plug-in as a testing plug-in
NO_INSTALL # Don't install this plug-in
NO_QHP_TRANSFORM
WARNINGS_NO_ERRORS
)
# single value arguments
set(arg_single
EXPORT_DIRECTIVE # (required) TODO: could be generated via CMake as it is done for MITK modules already
)
# multiple value arguments
set(arg_multiple
EXPORTED_INCLUDE_SUFFIXES # (optional) additional public include directories
MODULE_DEPENDS # (optional)
PACKAGE_DEPENDS
DOXYGEN_TAGFILES
MOC_OPTIONS
SUBPROJECTS # deprecated
)
cmake_parse_arguments(_PLUGIN "${arg_options}" "${arg_single}" "${arg_multiple}" ${ARGN})
if(_PLUGIN_TEST_PLUGIN)
set(_PLUGIN_NO_INSTALL 1)
set(is_test_plugin "TEST_PLUGIN")
else()
set(is_test_plugin)
endif()
set(_PLUGIN_MOC_OPTIONS "-DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED ${_PLUGIN_MOC_OPTIONS}")
set(PLUGIN_TARGET ${PROJECT_NAME})
mitk_check_module_dependencies(MODULES ${_PLUGIN_MODULE_DEPENDS}
PACKAGES ${_PLUGIN_PACKAGE_DEPENDS}
MISSING_DEPENDENCIES_VAR _missing_deps
MODULE_DEPENDENCIES_VAR _module_deps
PACKAGE_DEPENDENCIES_VAR _package_deps)
if(_missing_deps)
if(NOT MITK_BUILD_ALL_PLUGINS)
message(SEND_ERROR "${PROJECT_NAME} is missing requirements and won't be built. Missing: ${_missing_deps}")
else()
message(STATUS "${PROJECT_NAME} is missing requirements and won't be built. Missing: ${_missing_deps}")
endif()
return()
endif()
foreach(_module_dep ${_PLUGIN_MODULE_DEPENDS})
if(TARGET ${_module_dep})
get_target_property(AUTLOAD_DEP ${_module_dep} MITK_AUTOLOAD_DIRECTORY)
if (AUTLOAD_DEP)
message(SEND_ERROR "Plugin \"${PROJECT_NAME}\" has an invalid dependency on autoload module \"${_module_dep}\". Check MITK_CREATE_PLUGIN usage for \"${PROJECT_NAME}\".")
endif()
endif()
endforeach()
# -------------- All dependencies are resolved ------------------
message(STATUS "Creating CTK plugin ${PROJECT_NAME}")
include(files.cmake)
set(_PLUGIN_CPP_FILES ${CPP_FILES})
set(_PLUGIN_MOC_H_FILES ${MOC_H_FILES})
set(_PLUGIN_UI_FILES ${UI_FILES})
set(_PLUGIN_CACHED_RESOURCE_FILES ${CACHED_RESOURCE_FILES})
set(_PLUGIN_TRANSLATION_FILES ${TRANSLATION_FILES})
set(_PLUGIN_QRC_FILES ${QRC_FILES})
set(_PLUGIN_H_FILES ${H_FILES})
set(_PLUGIN_TXX_FILES ${TXX_FILES})
set(_PLUGIN_DOX_FILES ${DOX_FILES})
set(_PLUGIN_CMAKE_FILES ${CMAKE_FILES} files.cmake)
set(_PLUGIN_FILE_DEPENDENCIES ${FILE_DEPENDENCIES})
if(CTK_PLUGINS_OUTPUT_DIR)
set(_output_dir "${CTK_PLUGINS_OUTPUT_DIR}")
else()
set(_output_dir "")
endif()
# Compute the plugin dependencies
ctkFunctionGetTargetLibraries(_PLUGIN_target_libraries "")
#------------------------------------------------------------#
#------------------ Qt Help support -------------------------#
set(PLUGIN_GENERATED_QCH_FILES )
if(BLUEBERRY_USE_QT_HELP AND
EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/documentation/UserManual")
set(PLUGIN_DOXYGEN_INPUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/documentation/UserManual")
set(PLUGIN_DOXYGEN_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/documentation/UserManual")
# Create a list of Doxygen tag files from the plug-in dependencies
set(PLUGIN_DOXYGEN_TAGFILES)
foreach(_dep_target ${_PLUGIN_target_libraries})
string(REPLACE _ . _dep ${_dep_target})
get_target_property(_is_imported ${_dep_target} IMPORTED)
if(_is_imported)
get_target_property(_import_loc_debug ${_dep_target} IMPORTED_LOCATION_DEBUG)
get_target_property(_import_loc_release ${_dep_target} IMPORTED_LOCATION_RELEASE)
# There is not necessarily a debug and release build
if(_import_loc_release)
set(_import_loc ${_import_loc_release})
else()
set(_import_loc ${_import_loc_debug})
endif()
get_filename_component(_target_filename "${_import_loc}" NAME)
# on windows there might be a Debug or Release subdirectory
string(REGEX REPLACE "/bin/plugins/(Debug/|Release/)?${_target_filename}" "/Plugins/${_dep}/documentation/UserManual" plugin_tag_dir "${_import_loc}" )
else()
set(plugin_tag_dir "${CMAKE_BINARY_DIR}/Plugins/${_dep}/documentation/UserManual")
endif()
set(_tag_file "${plugin_tag_dir}/${_dep_target}.tag")
if(EXISTS ${_tag_file})
set(PLUGIN_DOXYGEN_TAGFILES "${PLUGIN_DOXYGEN_TAGFILES} \"${_tag_file}=qthelp://${_dep}/bundle/\"")
endif()
endforeach()
if(_PLUGIN_DOXYGEN_TAGFILES)
set(PLUGIN_DOXYGEN_TAGFILES "${PLUGIN_DOXYGEN_TAGFILES} ${_PLUGIN_DOXYGEN_TAGFILES}")
endif()
#message("PLUGIN_DOXYGEN_TAGFILES: ${PLUGIN_DOXYGEN_TAGFILES}")
if(_PLUGIN_NO_QHP_TRANSFORM)
set(_use_qhp_xsl 0)
else()
set(_use_qhp_xsl 1)
endif()
_FUNCTION_CREATE_CTK_QT_COMPRESSED_HELP(PLUGIN_GENERATED_QCH_FILES ${_use_qhp_xsl})
list(APPEND _PLUGIN_CACHED_RESOURCE_FILES ${PLUGIN_GENERATED_QCH_FILES})
endif()
#------------------------------------------------------------#
#------------------ Create Plug-in --------------------------#
mitkFunctionOrganizeSources(
SOURCE ${_PLUGIN_CPP_FILES}
HEADER ${_PLUGIN_H_FILES}
TXX ${_PLUGIN_TXX_FILES}
DOC ${_PLUGIN_DOX_FILES}
UI ${_PLUGIN_UI_FILES}
QRC ${_PLUGIN_QRC_FILES} ${_PLUGIN_CACHED_RESOURCE_FILES}
META ${_PLUGIN_META_FILES}
MOC ${MY_MOC_CPP}
GEN_UI ${MY_UI_CPP}
GEN_QRC ${MY_QRC_SRCS}
)
ctkMacroBuildPlugin(
NAME ${PLUGIN_TARGET}
EXPORT_DIRECTIVE ${_PLUGIN_EXPORT_DIRECTIVE}
SRCS ${_PLUGIN_CPP_FILES} ${_PLUGIN_H_FILES} ${CORRESPONDING__H_FILES} ${GLOBBED__H_FILES}
MOC_SRCS ${_PLUGIN_MOC_H_FILES}
MOC_OPTIONS ${_PLUGIN_MOC_OPTIONS}
UI_FORMS ${_PLUGIN_UI_FILES}
EXPORTED_INCLUDE_SUFFIXES ${_PLUGIN_EXPORTED_INCLUDE_SUFFIXES}
RESOURCES ${_PLUGIN_QRC_FILES}
TARGET_LIBRARIES ${_PLUGIN_target_libraries}
CACHED_RESOURCEFILES ${_PLUGIN_CACHED_RESOURCE_FILES}
TRANSLATIONS ${_PLUGIN_TRANSLATION_FILES}
OUTPUT_DIR ${_output_dir}
NO_INSTALL # we install the plug-in ourselves
${is_test_plugin}
)
mitk_use_modules(TARGET ${PLUGIN_TARGET}
MODULES ${_PLUGIN_MODULE_DEPENDS}
PACKAGES ${_PLUGIN_PACKAGE_DEPENDS}
)
set_property(TARGET ${PLUGIN_TARGET} APPEND PROPERTY COMPILE_DEFINITIONS US_MODULE_NAME=${PLUGIN_TARGET})
set_property(TARGET ${PLUGIN_TARGET} PROPERTY US_MODULE_NAME ${PLUGIN_TARGET})
if(NOT CMAKE_CURRENT_SOURCE_DIR MATCHES "^${CMAKE_SOURCE_DIR}.*")
- foreach(MITK_EXTENSION_DIR ${MITK_EXTENSION_DIRS})
+ foreach(MITK_EXTENSION_DIR ${MITK_ABSOLUTE_EXTENSION_DIRS})
if(CMAKE_CURRENT_SOURCE_DIR MATCHES "^${MITK_EXTENSION_DIR}.*")
- get_filename_component(MITK_EXTENSION_ROOT_FOLDER ${MITK_EXTENSION_DIR} NAME)
+ get_filename_component(MITK_EXTENSION_ROOT_FOLDER "${MITK_EXTENSION_DIR}" NAME)
set_property(TARGET ${PLUGIN_TARGET} PROPERTY FOLDER "${MITK_EXTENSION_ROOT_FOLDER}/Plugins")
break()
endif()
endforeach()
else()
set_property(TARGET ${PLUGIN_TARGET} PROPERTY FOLDER "${MITK_ROOT_FOLDER}/Plugins")
endif()
set(plugin_c_flags)
set(plugin_cxx_flags)
if(NOT _PLUGIN_WARNINGS_NO_ERRORS)
if(MSVC_VERSION)
mitkFunctionCheckCAndCXXCompilerFlags("/WX" plugin_c_flags plugin_cxx_flags)
else()
mitkFunctionCheckCAndCXXCompilerFlags(-Werror plugin_c_flags plugin_cxx_flags)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=c++0x-static-nonintegral-init" plugin_c_flags plugin_cxx_flags)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=static-member-init" plugin_c_flags plugin_cxx_flags)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=unknown-warning" plugin_c_flags plugin_cxx_flags)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=gnu" plugin_c_flags plugin_cxx_flags)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=cast-function-type" plugin_c_flags plugin_cxx_flags)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=inconsistent-missing-override" plugin_c_flags plugin_cxx_flags)
endif()
endif()
if(plugin_c_flags)
string(REPLACE " " ";" plugin_c_flags "${plugin_c_flags}")
target_compile_options(${PLUGIN_TARGET} PRIVATE ${plugin_c_flags})
endif()
if(plugin_cxx_flags)
string(REPLACE " " ";" plugin_cxx_flags "${plugin_cxx_flags}")
target_compile_options(${PLUGIN_TARGET} PRIVATE ${plugin_cxx_flags})
endif()
if(_PLUGIN_TEST_PLUGIN)
find_package(CppUnit REQUIRED)
target_include_directories(${PLUGIN_TARGET} PRIVATE ${CppUnit_INCLUDE_DIRS})
target_link_libraries(${PLUGIN_TARGET} PRIVATE ${CppUnit_LIBRARIES})
endif()
if(mbilog_FOUND)
target_link_libraries(${PLUGIN_TARGET} PRIVATE mbilog)
endif()
set(_PLUGIN_META_FILES "${CMAKE_CURRENT_SOURCE_DIR}/manifest_headers.cmake")
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/plugin.xml")
list(APPEND _PLUGIN_META_FILES "${CMAKE_CURRENT_SOURCE_DIR}/plugin.xml")
endif()
set(PLUGIN_TARGET ${PLUGIN_TARGET} PARENT_SCOPE)
#------------------------------------------------------------#
#------------------ Installer support -----------------------#
if(NOT _PLUGIN_NO_INSTALL)
set(install_directories "")
if(NOT MACOSX_BUNDLE_NAMES)
set(install_directories bin/plugins)
else(NOT MACOSX_BUNDLE_NAMES)
foreach(bundle_name ${MACOSX_BUNDLE_NAMES})
list(APPEND install_directories ${bundle_name}.app/Contents/MacOS/plugins)
endforeach(bundle_name)
endif(NOT MACOSX_BUNDLE_NAMES)
foreach(install_subdir ${install_directories})
mitkFunctionInstallCTKPlugin(TARGETS ${PLUGIN_TARGET}
DESTINATION ${install_subdir})
endforeach()
set(_autoload_targets )
foreach(_dependency ${_module_deps})
get_target_property(_dep_autoloads ${_dependency} MITK_AUTOLOAD_TARGETS)
if (_dep_autoloads)
list(APPEND _autoload_targets ${_dep_autoloads})
endif()
endforeach()
# The MITK_AUTOLOAD_TARGETS property is used in the mitkFunctionInstallAutoLoadModules
# macro which expects a list of plug-in targets.
if (_autoload_targets)
list(REMOVE_DUPLICATES _autoload_targets)
set_target_properties(${PLUGIN_TARGET} PROPERTIES MITK_AUTOLOAD_TARGETS "${_autoload_targets}")
endif()
endif()
endfunction()
function(_FUNCTION_CREATE_CTK_QT_COMPRESSED_HELP qch_file use_xsl)
set(_manifest_path "${CMAKE_CURRENT_SOURCE_DIR}/manifest_headers.cmake")
if(NOT EXISTS ${_manifest_path})
message(FATAL_ERROR "${_manifest_path} not found")
endif()
include(${_manifest_path})
string(REPLACE "_" "." Plugin-SymbolicName "${PLUGIN_TARGET}")
configure_file(${MITK_SOURCE_DIR}/Documentation/doxygen_plugin_manual.conf.in
${PLUGIN_DOXYGEN_OUTPUT_DIR}/doxygen.conf
)
set(_qhp_xsl_file "${MITK_SOURCE_DIR}/Documentation/qhp_toc.xsl")
set(_generated_qhp_file "${PLUGIN_DOXYGEN_OUTPUT_DIR}/html/index.qhp")
set(_transformed_qhp_file "${PLUGIN_DOXYGEN_OUTPUT_DIR}/html/${PLUGIN_TARGET}.qhp")
set(${qch_file} "${CMAKE_CURRENT_BINARY_DIR}/resources/${PLUGIN_TARGET}.qch")
set(_xsl_command )
if(use_xsl)
set(_xsl_command COMMAND ${QT_XMLPATTERNS_EXECUTABLE} ${_qhp_xsl_file} ${_generated_qhp_file} -output ${_transformed_qhp_file})
endif()
file(GLOB _file_dependencies "${PLUGIN_DOXYGEN_INPUT_DIR}/*")
add_custom_command(OUTPUT ${${qch_file}}
# Generate a Qt help project (index.qhp) with doxygen
COMMAND ${DOXYGEN_EXECUTABLE} ${PLUGIN_DOXYGEN_OUTPUT_DIR}/doxygen.conf
# Use a XSL transformation to get rid of the top-level entry
${_xsl_command}
# Generate the final Qt compressed help file (.qch)
COMMAND ${QT_HELPGENERATOR_EXECUTABLE} ${_transformed_qhp_file} -o ${${qch_file}}
DEPENDS ${PLUGIN_DOXYGEN_OUTPUT_DIR}/doxygen.conf ${_file_dependencies}
)
#set_source_files_properties(${qch_file} PROPERTIES GENERATED 1)
set(${qch_file} ${${qch_file}} PARENT_SCOPE)
endfunction()
function(MACRO_CREATE_MITK_CTK_PLUGIN)
message(SEND_ERROR "The function MACRO_CREATE_MITK_CTK_PLUGIN was renamed to mitk_create_plugin in MITK 2015.05.")
endfunction()
diff --git a/CMake/mitkFunctionEnableBuildConfiguration.cmake b/CMake/mitkFunctionEnableBuildConfiguration.cmake
index 0926cffde4..4d259770d6 100644
--- a/CMake/mitkFunctionEnableBuildConfiguration.cmake
+++ b/CMake/mitkFunctionEnableBuildConfiguration.cmake
@@ -1,53 +1,52 @@
function(mitkFunctionEnableBuildConfiguration)
if(MITK_BUILD_CONFIGURATION STREQUAL "Custom")
return()
endif()
set(_build_config_file "${MITK_CMAKE_DIR}/BuildConfigurations/${MITK_BUILD_CONFIGURATION}.cmake")
if(NOT EXISTS ${_build_config_file})
set(_found_ext_build_config_file FALSE)
- foreach(MITK_EXTENSION_DIR ${MITK_EXTENSION_DIRS})
+ foreach(MITK_EXTENSION_DIR ${MITK_ABSOLUTE_EXTENSION_DIRS})
set(_build_config_file "${MITK_EXTENSION_DIR}/CMake/BuildConfigurations/${MITK_BUILD_CONFIGURATION}.cmake")
if(EXISTS ${_build_config_file})
set(_found_ext_build_config_file TRUE)
break()
endif()
endforeach()
if(NOT _found_ext_build_config_file)
- message(WARNING "Unknown build configuration \"${MITK_BUILD_CONFIGURATION}\", falling back to \"Custom\" configuration.")
- return()
+ message(FATAL_ERROR "Unknown build configuration \"${MITK_BUILD_CONFIGURATION}\"!")
endif()
endif()
message(STATUS "------- Using build configuration \"${MITK_BUILD_CONFIGURATION}\" -------")
include(${_build_config_file})
if(MITK_CONFIG_PACKAGES)
foreach(_package ${MITK_CONFIG_PACKAGES})
if(DEFINED MITK_USE_${_package})
if(NOT MITK_USE_${_package})
message("> Enabling package ${_package} as requested by the build configuration")
get_property(_is_cache CACHE MITK_USE_${_package} PROPERTY VALUE)
if(DEFINED _is_cache)
set(MITK_USE_${_package} ON CACHE BOOL "Use ${_package} in MITK" FORCE)
else()
set(MITK_USE_${_package} ON)
endif()
endif()
else()
message(SEND_ERROR "Unknown package name \"${_package}\" in build configuration \"${MITK_BUILD_CONFIGURATION}\"")
endif()
endforeach()
endif()
if(NOT MITK_USE_SUPERBUILD AND MITK_CONFIG_PLUGINS AND MITK_USE_BLUEBERRY)
foreach(_plugin ${MITK_CONFIG_PLUGINS})
if(DEFINED MITK_BUILD_${_plugin} AND NOT MITK_BUILD_${_plugin})
message("> Enabling plug-in ${_plugin} as requested by the build configuration")
endif()
set(MITK_BUILD_${_plugin} ON CACHE BOOL "Build the ${_plugin} Plugin." FORCE)
endforeach()
endif()
endfunction()
diff --git a/CMake/mitkFunctionGetLibrarySearchPaths.cmake b/CMake/mitkFunctionGetLibrarySearchPaths.cmake
index 86725d7193..21f2436c0e 100644
--- a/CMake/mitkFunctionGetLibrarySearchPaths.cmake
+++ b/CMake/mitkFunctionGetLibrarySearchPaths.cmake
@@ -1,213 +1,219 @@
#! Helper function that gets all library search paths.
#!
#! Usage:
#!
#! mitkFunctionGetLibrarySearchPaths(search_path intermediate_dir [DEBUG|MINSIZEREL|RELWITHDEBINFO])
#!
#!
#! The function creates the variable ${search_path}. The variable intermediate_dir contains
#! paths that should be added to the search_path but should not be checked for existance,
#! because the are not yet created. The option DEBUG, MINSIZEREL or RELWITHDEBINFO can be used to indicate that
#! not the paths for release configuration are requested but the debug, min size release or "release with debug info"
#! paths.
#!
function(mitkFunctionGetLibrarySearchPaths search_path intermediate_dir)
cmake_parse_arguments(PARSE_ARGV 2 GLS "RELEASE;DEBUG;MINSIZEREL;RELWITHDEBINFO" "" "")
set(_dir_candidates
"${MITK_CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
"${MITK_CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins"
"${MITK_CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
"${MITK_CMAKE_LIBRARY_OUTPUT_DIRECTORY}/plugins"
)
if(MITK_EXTERNAL_PROJECT_PREFIX)
list(APPEND _dir_candidates
"${MITK_EXTERNAL_PROJECT_PREFIX}/bin"
"${MITK_EXTERNAL_PROJECT_PREFIX}/lib"
)
endif()
# Determine the Qt5 library installation prefix
set(_qmake_location )
if(MITK_USE_Qt5 AND TARGET ${Qt5Core_QMAKE_EXECUTABLE})
get_property(_qmake_location TARGET ${Qt5Core_QMAKE_EXECUTABLE}
PROPERTY IMPORT_LOCATION)
endif()
if(_qmake_location)
if(NOT _qt_install_libs)
if(WIN32)
execute_process(COMMAND ${_qmake_location} -query QT_INSTALL_BINS
OUTPUT_VARIABLE _qt_install_libs
OUTPUT_STRIP_TRAILING_WHITESPACE)
else()
execute_process(COMMAND ${_qmake_location} -query QT_INSTALL_LIBS
OUTPUT_VARIABLE _qt_install_libs
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
file(TO_CMAKE_PATH "${_qt_install_libs}" _qt_install_libs)
set(_qt_install_libs ${_qt_install_libs} CACHE INTERNAL "Qt library installation prefix" FORCE)
endif()
if(_qt_install_libs)
list(APPEND _dir_candidates ${_qt_install_libs})
endif()
elseif(MITK_USE_Qt5)
message(WARNING "The qmake executable could not be found.")
endif()
get_property(_additional_paths GLOBAL PROPERTY MITK_ADDITIONAL_LIBRARY_SEARCH_PATHS)
if(TARGET OpenSSL::SSL)
if(GLS_DEBUG)
get_target_property(_openssl_location OpenSSL::SSL IMPORTED_LOCATION_DEBUG)
else()
get_target_property(_openssl_location OpenSSL::SSL IMPORTED_LOCATION_RELEASE)
endif()
if(_openssl_location)
get_filename_component(_openssl_location ${_openssl_location} DIRECTORY)
set(_openssl_location "${_openssl_location}/../../bin")
if(EXISTS ${_openssl_location})
get_filename_component(_openssl_location ${_openssl_location} ABSOLUTE)
list(APPEND _dir_candidates ${_openssl_location})
endif()
endif()
endif()
if(MITK_USE_HDF5)
FIND_PACKAGE(HDF5 COMPONENTS C HL NO_MODULE REQUIRED shared)
get_target_property(_location hdf5-shared LOCATION)
get_filename_component(_location ${_location} PATH)
list(APPEND _additional_paths ${_location})
# This is a work-around. The hdf5-config.cmake file is not robust enough
# to be included several times via find_pakcage calls.
set(HDF5_LIBRARIES ${HDF5_LIBRARIES} PARENT_SCOPE)
endif()
if(MITK_USE_Vigra)
# we cannot use _find_package(Vigra) here because the vigra-config.cmake file
# always includes the target-exports files without using an include guard. This
# would lead to errors when another find_package(Vigra) call is processed. The
# (bad) assumption here is that for the time being, only the Classification module
# is using Vigra.
if(UNIX)
list(APPEND _additional_paths ${Vigra_DIR}/lib)
else()
list(APPEND _additional_paths ${Vigra_DIR}/bin)
endif()
endif()
if(_additional_paths)
list(APPEND _dir_candidates ${_additional_paths})
endif()
# The code below is sub-optimal. It makes assumptions about
# the structure of the build directories, pointed to by
# the *_DIR variables. Instead, we should rely on package
# specific "LIBRARY_DIRS" variables, if they exist.
if(WIN32)
list(APPEND _dir_candidates "${ITK_DIR}/bin")
endif()
if(MITK_USE_MatchPoint)
if(WIN32)
list(APPEND _dir_candidates "${MatchPoint_DIR}/bin")
else()
list(APPEND _dir_candidates "${MatchPoint_DIR}/lib")
endif()
endif()
# If OpenCV is built within the MITK superbuild set the binary directory
# according to the lib path provided by OpenCV.
# In the case where an external OpenCV is provided use the binary directory
# of this OpenCV directory
if(MITK_USE_OpenCV)
if(WIN32)
if (EXISTS ${OpenCV_LIB_PATH})
list(APPEND _dir_candidates "${OpenCV_LIB_PATH}/../bin") # OpenCV is built in superbuild
else()
list(APPEND _dir_candidates "${OpenCV_DIR}/bin") # External OpenCV build is used
endif()
endif()
endif()
+ if(MITK_USE_OpenMesh)
+ if(WIN32)
+ list(APPEND _dir_candidates "${MITK_EXTERNAL_PROJECT_PREFIX}")
+ endif()
+ endif()
+
if(MITK_USE_Python3)
list(APPEND _dir_candidates "${CTK_DIR}/CMakeExternals/Install/bin")
get_filename_component(_python_dir "${Python3_EXECUTABLE}" DIRECTORY)
list(APPEND _dir_candidates "${_python_dir}")
endif()
if(MITK_USE_TOF_PMDO3 OR MITK_USE_TOF_PMDCAMCUBE OR MITK_USE_TOF_PMDCAMBOARD)
list(APPEND _dir_candidates "${MITK_PMD_SDK_DIR}/plugins" "${MITK_PMD_SDK_DIR}/bin")
endif()
if(MITK_USE_CTK)
list(APPEND _dir_candidates "${CTK_LIBRARY_DIRS}")
foreach(_ctk_library ${CTK_LIBRARIES})
if(${_ctk_library}_LIBRARY_DIRS)
list(APPEND _dir_candidates "${${_ctk_library}_LIBRARY_DIRS}")
endif()
endforeach()
endif()
if(MITK_USE_BLUEBERRY)
if(DEFINED CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY)
if(IS_ABSOLUTE "${CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY}")
list(APPEND _dir_candidates "${CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY}")
else()
list(APPEND _dir_candidates "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CTK_PLUGIN_RUNTIME_OUTPUT_DIRECTORY}")
endif()
endif()
endif()
if(MITK_LIBRARY_DIRS)
list(APPEND _dir_candidates ${MITK_LIBRARY_DIRS})
endif()
###################################################################
#get the search paths added by the mitkFunctionAddLibrarySearchPath
file(GLOB _additional_path_info_files "${MITK_SUPERBUILD_BINARY_DIR}/MITK-AdditionalLibPaths/*.cmake")
foreach(_additional_path_info_file ${_additional_path_info_files})
get_filename_component(_additional_info_name ${_additional_path_info_file} NAME_WE)
include(${_additional_path_info_file})
if(GLS_DEBUG)
list(APPEND _dir_candidates ${${_additional_info_name}_ADDITIONAL_DEBUG_LIBRARY_SEARCH_PATHS})
elseif(GLS_MINSIZEREL)
list(APPEND _dir_candidates ${${_additional_info_name}_ADDITIONAL_MINSIZEREL_LIBRARY_SEARCH_PATHS})
elseif(GLS_RELWITHDEBINFO)
list(APPEND _dir_candidates ${${_additional_info_name}_ADDITIONAL_RELWITHDEBINFO_LIBRARY_SEARCH_PATHS})
else() #Release
list(APPEND _dir_candidates ${${_additional_info_name}_ADDITIONAL_RELEASE_LIBRARY_SEARCH_PATHS})
endif()
endforeach(_additional_path_info_file ${_additional_path_info_files})
###############################################
#sanitize all candidates and compile final list
list(REMOVE_DUPLICATES _dir_candidates)
set(_search_dirs )
foreach(_dir ${_dir_candidates})
if(EXISTS "${_dir}/${intermediate_dir}")
list(APPEND _search_dirs "${_dir}/${intermediate_dir}")
else()
list(APPEND _search_dirs "${_dir}")
endif()
endforeach()
# Special handling for "internal" search dirs. The intermediate directory
# might not have been created yet, so we can't check for its existence.
# Hence we just add it for Windows without checking.
set(_internal_search_dirs "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/plugins")
if(WIN32)
foreach(_dir ${_internal_search_dirs})
set(_search_dirs "${_dir}/${intermediate_dir}" ${_search_dirs})
endforeach()
else()
set(_search_dirs ${_internal_search_dirs} ${_search_dirs})
endif()
list(REMOVE_DUPLICATES _search_dirs)
set(${search_path} ${_search_dirs} PARENT_SCOPE)
endfunction()
diff --git a/CMake/mitkFunctionUseModules.cmake b/CMake/mitkFunctionUseModules.cmake
index 173e0a5a95..0654f319be 100644
--- a/CMake/mitkFunctionUseModules.cmake
+++ b/CMake/mitkFunctionUseModules.cmake
@@ -1,163 +1,173 @@
function(_mitk_parse_package_args)
set(package_list ${ARGN})
set(PUBLIC_PACKAGE_NAMES )
set(PRIVATE_PACKAGE_NAMES )
set(INTERFACE_PACKAGE_NAMES )
set(_package_visibility PRIVATE)
foreach(_package ${package_list})
if(_package STREQUAL "PUBLIC" OR _package STREQUAL "PRIVATE" OR _package STREQUAL "INTERFACE")
set(_package_visibility ${_package})
else()
list(APPEND packages ${_package})
set(_package_name )
set(_package_components_list )
string(REPLACE "|" ";" _package_list ${_package})
if("${_package_list}" STREQUAL "${_package}")
set(_package_name ${_package})
else()
list(GET _package_list 0 _package_name)
list(GET _package_list 1 _package_components)
string(REPLACE "+" ";" _package_components_list "${_package_components}")
if(NOT _package_name OR NOT _package_components)
message(SEND_ERROR "PACKAGE argument syntax wrong. ${_package} is not of the form PACKAGE[|COMPONENT1[+COMPONENT2]...]")
endif()
endif()
list(APPEND ${_package_visibility}_PACKAGE_NAMES ${_package_name})
list(APPEND ${_package_visibility}_${_package_name}_REQUIRED_COMPONENTS ${_package_components_list})
endif()
endforeach()
# remove duplicates and set package components in parent scope
foreach(_package_visibility PUBLIC PRIVATE INTERFACE)
foreach(_package_name ${${_package_visibility}_PACKAGE_NAMES})
if(${_package_visibility}_${_package_name}_REQUIRED_COMPONENTS)
list(REMOVE_DUPLICATES ${_package_visibility}_${_package_name}_REQUIRED_COMPONENTS)
endif()
set(${_package_visibility}_${_package_name}_REQUIRED_COMPONENTS ${${_package_visibility}_${_package_name}_REQUIRED_COMPONENTS} PARENT_SCOPE)
endforeach()
endforeach()
set(PUBLIC_PACKAGE_NAMES ${PUBLIC_PACKAGE_NAMES} PARENT_SCOPE)
set(PRIVATE_PACKAGE_NAMES ${PRIVATE_PACKAGE_NAMES} PARENT_SCOPE)
set(INTERFACE_PACKAGE_NAMES ${INTERFACE_PACKAGE_NAMES} PARENT_SCOPE)
set(PACKAGE_NAMES ${PUBLIC_PACKAGE_NAMES} ${PRIVATE_PACKAGE_NAMES} ${INTERFACE_PACKAGE_NAMES} PARENT_SCOPE)
endfunction()
function(_include_package_config pkg_config_file)
# wrap the inclusion of the MITK_<pkg>_Config.cmake file in a
# function to create a scope for its variables; this allows
# multiple inclusions of the file in the parent scope
include(${pkg_config_file})
set(ALL_INCLUDE_DIRECTORIES ${ALL_INCLUDE_DIRECTORIES} PARENT_SCOPE)
set(ALL_LIBRARIES ${ALL_LIBRARIES} PARENT_SCOPE)
set(ALL_COMPILE_DEFINITIONS ${ALL_COMPILE_DEFINITIONS} PARENT_SCOPE)
set(ALL_COMPILE_OPTIONS ${ALL_COMPILE_OPTIONS} PARENT_SCOPE)
endfunction()
#! This CMake function sets up the necessary include directories,
#! linker dependencies, and compile flags for a given target which
#! depends on a set of MITK modules or packages.
#!
#! A package argument is of the form
#!
#! [PUBLIC|PRIVATE|INTERFACE] PACKAGE[|COMPONENT1[+COMPONENT2]...]
#!
#! where PACKAGE is the package name (e.g. VTK) and components are
#! the names of required package components or libraries.
#!
#! If a dependency is not available, an error is thrown.
function(mitk_use_modules)
set(_macro_params
TARGET # The target name (required)
)
set(_macro_multiparams
MODULES # MITK modules which the given TARGET uses
PACKAGES # MITK packages which the given TARGET uses
)
set(_macro_options )
cmake_parse_arguments(USE "${_macro_options}" "${_macro_params}" "${_macro_multiparams}" ${ARGN})
# Sanity checks
if(NOT USE_TARGET)
message(SEND_ERROR "Required TARGET argument missing.")
elseif(NOT TARGET ${USE_TARGET})
message(SEND_ERROR "The given TARGET argument ${USE_TARGET} is not a valid target")
endif()
set(depends ${USE_MODULES})
set(package_depends ${USE_PACKAGES})
if(depends)
# Iterate over all module dependencies
foreach(dependency ${depends})
if(TARGET ${dependency} AND NOT MODULE_IS_DEPRECATED)
get_target_property(_is_interface_lib ${dependency} TYPE)
if(NOT _is_interface_lib)
get_target_property(_dependency_deprecated_since ${dependency} MITK_MODULE_DEPRECATED_SINCE)
if(_dependency_deprecated_since)
message(WARNING "Module ${dependency} is deprecated since ${_dependency_deprecated_since}")
endif()
endif()
endif()
endforeach()
target_link_libraries(${USE_TARGET} PUBLIC ${depends})
endif()
# Parse package dependencies
if(package_depends)
_mitk_parse_package_args(${package_depends})
# Some package config files like MITK_Qt5_Config.cmake rely on a
# properly set "MODULE_NAME" variable for the current target.
set(MODULE_NAME ${USE_TARGET})
# Read all package information
foreach(_package_visibility INTERFACE PUBLIC PRIVATE)
foreach(_package ${${_package_visibility}_PACKAGE_NAMES})
set(ALL_INCLUDE_DIRECTORIES)
set(ALL_LIBRARIES)
set(ALL_COMPILE_DEFINITIONS)
set(ALL_COMPILE_OPTIONS)
set(${_package}_REQUIRED_COMPONENTS_BY_MODULE ${${_package_visibility}_${_package}_REQUIRED_COMPONENTS})
set(_package_found 0)
foreach(dir ${MODULES_PACKAGE_DEPENDS_DIRS})
if((NOT DEFINED MITK_USE_${_package} OR MITK_USE_${_package}) AND EXISTS "${dir}/MITK_${_package}_Config.cmake")
_include_package_config("${dir}/MITK_${_package}_Config.cmake")
set(_package_found 1)
break()
endif()
endforeach()
if(_package_found)
if(ALL_INCLUDE_DIRECTORIES)
list(REMOVE_DUPLICATES ALL_INCLUDE_DIRECTORIES)
target_include_directories(${USE_TARGET} SYSTEM ${_package_visibility} ${ALL_INCLUDE_DIRECTORIES})
endif()
if(ALL_LIBRARIES)
# Don't remove "duplicats" because ALL_LIBRARIES may be of the form:
# "general;bla;debug;blad;general;foo;debug;food"
target_link_libraries(${USE_TARGET} ${_package_visibility} ${ALL_LIBRARIES})
endif()
if(ALL_COMPILE_DEFINITIONS)
list(REMOVE_DUPLICATES ALL_COMPILE_DEFINITIONS)
# Compile definitions are always added "PRIVATE" to avoid multiple definitions
# on the command line due to transitive and direct dependencies adding the
# same definitions.
target_compile_definitions(${USE_TARGET} PRIVATE ${ALL_COMPILE_DEFINITIONS})
endif()
if(ALL_COMPILE_OPTIONS)
list(REMOVE_DUPLICATES ALL_COMPILE_OPTIONS)
target_compile_options(${USE_TARGET} ${_package_visibility} ${ALL_COMPILE_OPTIONS})
endif()
+ if("VTK" STREQUAL _package)
+ # VTK module autoinit
+ unset(_vtk_modules)
+ foreach(_vtk_module ${VTK_REQUIRED_COMPONENTS_BY_MODULE})
+ list(APPEND _vtk_modules "VTK::${_vtk_module}")
+ endforeach()
+ if(_vtk_modules)
+ vtk_module_autoinit(TARGETS ${USE_TARGET} MODULES ${_vtk_modules})
+ endif()
+ endif()
else()
message(SEND_ERROR "Missing package: ${_package}")
endif()
endforeach()
endforeach()
endif()
endfunction()
diff --git a/CMake/mitkMacroCreateModuleTests.cmake b/CMake/mitkMacroCreateModuleTests.cmake
index 1ce68e4558..3dc3e7aa4f 100644
--- a/CMake/mitkMacroCreateModuleTests.cmake
+++ b/CMake/mitkMacroCreateModuleTests.cmake
@@ -1,100 +1,106 @@
#
# Create tests and testdriver for this module
#
# Usage: MITK_CREATE_MODULE_TESTS( [EXTRA_DRIVER_INIT init_code] )
#
# EXTRA_DRIVER_INIT is inserted as c++ code in the testdriver and will be executed before each test
#
macro(MITK_CREATE_MODULE_TESTS)
cmake_parse_arguments(MODULE_TEST
"US_MODULE;NO_INIT" "EXTRA_DRIVER_INIT;EXTRA_DRIVER_INCLUDE" "EXTRA_DEPENDS;DEPENDS;PACKAGE_DEPENDS" ${ARGN})
if(BUILD_TESTING AND MODULE_IS_ENABLED)
include(files.cmake)
include_directories(.)
set(TESTDRIVER ${MODULE_NAME}TestDriver)
set(MODULE_TEST_EXTRA_DRIVER_INIT "${MODULE_TEST_EXTRA_DRIVER_INIT}")
if(MITK_XVFB_TESTING)
set(xvfb_run ${MITK_XVFB_TESTING_COMMAND})
else()
set(xvfb_run )
endif()
if(MODULE_TEST_US_MODULE)
message(WARNING "The US_MODULE argument is deprecated and should be removed")
endif()
if(MODULE_TEST_US_MODULE AND MODULE_TEST_NO_INIT)
message(WARNING "Conflicting arguments US_MODULE and NO_INIT: NO_INIT wins.")
endif()
set(_no_init)
if(MODULE_TEST_NO_INIT)
set(_no_init NO_INIT)
endif()
set(MITK_MODULE_NAME_REGEX_MATCH )
set(MITK_MODULE_NAME_REGEX_NOT_MATCH )
set(_testdriver_file_list ${CMAKE_CURRENT_BINARY_DIR}/testdriver_files.cmake)
configure_file(${MITK_CMAKE_DIR}/mitkTestDriverFiles.cmake.in ${_testdriver_file_list} @ONLY)
mitk_create_executable(${TESTDRIVER}
DEPENDS ${MODULE_NAME} ${MODULE_TEST_DEPENDS} ${MODULE_TEST_EXTRA_DEPENDS} MitkTestingHelper
PACKAGE_DEPENDS ${MODULE_TEST_PACKAGE_DEPENDS}
FILES_CMAKE ${_testdriver_file_list}
NO_FEATURE_INFO
NO_BATCH_FILE
NO_INSTALL
${_no_init})
set_property(TARGET ${EXECUTABLE_TARGET} PROPERTY FOLDER "${MITK_ROOT_FOLDER}/Modules/Tests")
#
# Now tell CMake which tests should be run. This is done automatically
# for all tests in ${KITNAME}_TESTS and ${KITNAME}_IMAGE_TESTS. The IMAGE_TESTS
# are run for each image in the TESTIMAGES list.
#
include(files.cmake)
- foreach( test ${MODULE_TESTS} )
+ foreach(test ${MODULE_TESTS} ${MODULE_RENDERING_TESTS})
get_filename_component(TName ${test} NAME_WE)
add_test(NAME ${TName} COMMAND ${xvfb_run} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} ${TName})
mitkFunctionGetLibrarySearchPaths(MITK_RUNTIME_PATH_RELEASE release RELEASE)
mitkFunctionGetLibrarySearchPaths(MITK_RUNTIME_PATH_DEBUG debug DEBUG)
set(test_env_path ${MITK_RUNTIME_PATH_RELEASE} ${MITK_RUNTIME_PATH_DEBUG} $ENV{PATH})
list(REMOVE_DUPLICATES test_env_path)
string (REGEX REPLACE "\;" "\\\;" test_env_path "${test_env_path}")
set_property(TEST ${TName} PROPERTY ENVIRONMENT "PATH=${test_env_path}" APPEND)
set_property(TEST ${TName} PROPERTY SKIP_RETURN_CODE 77)
endforeach()
+ foreach(test ${MODULE_RENDERING_TESTS})
+ get_filename_component(TName ${test} NAME_WE)
+ set_property(TEST ${TName} APPEND PROPERTY LABELS "Rendering Tests")
+ set_property(TEST ${TName} PROPERTY RUN_SERIAL TRUE)
+ endforeach()
+
set(TEST_TYPES IMAGE SURFACE POINTSET) # add other file types here
foreach(test_type ${TEST_TYPES})
foreach(test_data ${MODULE_TEST${test_type}} ${ADDITIONAL_TEST_${test_type}})
if(EXISTS ${test_data})
set(TEST_DATA_FULL_PATH ${test_data})
else()
# todo: maybe search other paths as well
# yes, please in mitk/Testing/Data, too
set(TEST_DATA_FULL_PATH ${MITK_DATA_DIR}/${test_data})
endif()
if(EXISTS ${TEST_DATA_FULL_PATH})
foreach( test ${MODULE_${test_type}_TESTS})
get_filename_component(TName ${test} NAME_WE)
get_filename_component(DName ${TEST_DATA_FULL_PATH} NAME)
add_test(NAME ${TName}_${DName} COMMAND ${xvfb_run} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} ${TName} ${TEST_DATA_FULL_PATH})
set_property(TEST ${TName}_${DName} PROPERTY ENVIRONMENT "PATH=${test_env_path}" APPEND)
set_property(TEST ${TName}_${DName} PROPERTY SKIP_RETURN_CODE 77)
endforeach()
else()
message("!!!!! No such file: ${TEST_DATA_FULL_PATH} !!!!!")
endif()
endforeach()
endforeach()
endif()
endmacro()
diff --git a/CMake/mitkMacroQueryCustomEPVars.cmake b/CMake/mitkMacroQueryCustomEPVars.cmake
index 3e9d09e0a0..a5ca41d1b6 100644
--- a/CMake/mitkMacroQueryCustomEPVars.cmake
+++ b/CMake/mitkMacroQueryCustomEPVars.cmake
@@ -1,35 +1,34 @@
#[[ Iterate over all MITK extension directories and collect custom external
project variables for a specific external project (${proj}). ]]
macro(mitk_query_custom_ep_vars)
set(${proj}_CUSTOM_CMAKE_ARGS "")
set(${proj}_CUSTOM_CMAKE_CACHE_ARGS "")
set(${proj}_CUSTOM_CMAKE_CACHE_DEFAULT_ARGS "")
- foreach(MITK_EXTENSION_DIR ${MITK_EXTENSION_DIRS})
- set(MITK_CMAKE_EXTERNALS_CUSTOM_DIR ${MITK_EXTENSION_DIR}/CMakeExternals/Customization)
- get_filename_component(MITK_CMAKE_EXTERNALS_CUSTOM_DIR ${MITK_CMAKE_EXTERNALS_CUSTOM_DIR} ABSOLUTE)
+ foreach(MITK_EXTENSION_DIR ${MITK_ABSOLUTE_EXTENSION_DIRS})
+ set(MITK_CMAKE_EXTERNALS_CUSTOM_DIR "${MITK_EXTENSION_DIR}/CMakeExternals/Customization")
if(EXISTS "${MITK_CMAKE_EXTERNALS_CUSTOM_DIR}/${proj}.cmake")
include("${MITK_CMAKE_EXTERNALS_CUSTOM_DIR}/${proj}.cmake")
list(APPEND ${proj}_CUSTOM_CMAKE_ARGS ${CUSTOM_CMAKE_ARGS})
list(APPEND ${proj}_CUSTOM_CMAKE_CACHE_ARGS ${CUSTOM_CMAKE_CACHE_ARGS})
list(APPEND ${proj}_CUSTOM_CMAKE_CACHE_DEFAULT_ARGS ${CUSTOM_CMAKE_CACHE_DEFAULT_ARGS})
endif()
endforeach()
list(REMOVE_DUPLICATES ${proj}_CUSTOM_CMAKE_ARGS)
list(REMOVE_DUPLICATES ${proj}_CUSTOM_CMAKE_CACHE_ARGS)
list(REMOVE_DUPLICATES ${proj}_CUSTOM_CMAKE_CACHE_DEFAULT_ARGS)
if(${proj}_CUSTOM_CMAKE_ARGS)
message(STATUS "Custom ${proj} CMake args: ${${proj}_CUSTOM_CMAKE_ARGS}")
endif()
if(${proj}_CUSTOM_CMAKE_CACHE_ARGS)
message(STATUS "Custom ${proj} CMake cache args: ${${proj}_CUSTOM_CMAKE_CACHE_ARGS}")
endif()
if(${proj}_CUSTOM_CMAKE_CACHE_DEFAULT_ARGS)
message(STATUS "Custom ${proj} CMake cache default args: ${${proj}_CUSTOM_CMAKE_CACHE_DEFAULT_ARGS}")
endif()
endmacro()
diff --git a/CMake/mitkTestDriverFiles.cmake.in b/CMake/mitkTestDriverFiles.cmake.in
index d1154ef6ad..78583f9b24 100644
--- a/CMake/mitkTestDriverFiles.cmake.in
+++ b/CMake/mitkTestDriverFiles.cmake.in
@@ -1,47 +1,47 @@
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/files.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/files.cmake)
endif()
# Write a header file containing include directives and custom code
# for the test driver.
set(TESTDRIVER_EXTRA_INCLUDES )
list(APPEND MODULE_TEST_EXTRA_DRIVER_INCLUDE "mitkLog.h")
list(REMOVE_DUPLICATES MODULE_TEST_EXTRA_DRIVER_INCLUDE)
foreach(_include ${MODULE_TEST_EXTRA_DRIVER_INCLUDE})
set(TESTDRIVER_EXTRA_INCLUDES "${TESTDRIVER_EXTRA_INCLUDES}
#include <${_include}>")
endforeach()
set(TESTDRIVER_EXTRA_INCLUDES "${TESTDRIVER_EXTRA_INCLUDES}
#include <vector>
std::vector<std::string> globalCmdLineArgs;")
set(_extra_include_file ${CMAKE_CURRENT_BINARY_DIR}/${TESTDRIVER}_extras.h)
configure_file(${MITK_CMAKE_DIR}/mitkTestDriverExtraIncludes.h.in ${_extra_include_file})
set(CMAKE_TESTDRIVER_BEFORE_TESTMAIN "
for (int avIndex = 1; avIndex < ac; ++avIndex) globalCmdLineArgs.push_back(av[avIndex]);
mitk::LoggingBackend::Register();
${MODULE_TEST_EXTRA_DRIVER_INIT};"
)
set(CMAKE_TESTDRIVER_AFTER_TESTMAIN "mitk::LoggingBackend::Unregister();")
create_test_sourcelist(_test_cpp_files ${MODULE_NAME}_main.cpp
- ${MODULE_TESTS} ${MODULE_IMAGE_TESTS} ${MODULE_SURFACE_TESTS} ${MODULE_CUSTOM_TESTS}
+ ${MODULE_TESTS} ${MODULE_RENDERING_TESTS} ${MODULE_IMAGE_TESTS} ${MODULE_SURFACE_TESTS} ${MODULE_CUSTOM_TESTS}
EXTRA_INCLUDE ${_extra_include_file}
)
list(APPEND CPP_FILES ${_test_cpp_files})
# Some old CMake scripts use TEST_CPP_FILES in their files.cmake
# file of the test driver to add source fiels to the executable
# (they should just use CPP_FILES like in any other files.cmake
# file instead).
if(TEST_CPP_FILES)
list(APPEND CPP_FILES ${TEST_CPP_FILES})
endif()
if(MODULE_RESOURCE_FILES)
list(APPEND RESOURCE_FILES ${MODULE_RESOURCE_FILES})
-endif()
\ No newline at end of file
+endif()
diff --git a/CMakeExternals/ExternalProjectList.cmake b/CMakeExternals/ExternalProjectList.cmake
index e9cd818848..ab452fc867 100644
--- a/CMakeExternals/ExternalProjectList.cmake
+++ b/CMakeExternals/ExternalProjectList.cmake
@@ -1,26 +1,26 @@
mitkFunctionAddExternalProject(NAME Poco ON COMPONENTS Foundation Net Util XML Zip)
mitkFunctionAddExternalProject(NAME DCMTK ON DOC "EXPERIMENTAL, superbuild only: Use DCMTK in MITK")
mitkFunctionAddExternalProject(NAME OpenIGTLink OFF)
mitkFunctionAddExternalProject(NAME tinyxml ON ADVANCED)
mitkFunctionAddExternalProject(NAME GDCM ON ADVANCED)
mitkFunctionAddExternalProject(NAME Eigen ON ADVANCED DOC "Use the Eigen library")
mitkFunctionAddExternalProject(NAME ANN ON ADVANCED DOC "Use Approximate Nearest Neighbor Library")
mitkFunctionAddExternalProject(NAME CppUnit ON ADVANCED DOC "Use CppUnit for unit tests")
mitkFunctionAddExternalProject(NAME PCRE OFF ADVANCED NO_PACKAGE)
mitkFunctionAddExternalProject(NAME HDF5 ON ADVANCED)
mitkFunctionAddExternalProject(NAME SWIG OFF ADVANCED NO_PACKAGE DEPENDS PCRE)
mitkFunctionAddExternalProject(NAME OpenCV OFF)
mitkFunctionAddExternalProject(NAME Vigra OFF DEPENDS HDF5)
mitkFunctionAddExternalProject(NAME ITK ON NO_CACHE DEPENDS HDF5)
mitkFunctionAddExternalProject(NAME VTK ON NO_CACHE)
mitkFunctionAddExternalProject(NAME Boost ON NO_CACHE)
mitkFunctionAddExternalProject(NAME ZLIB OFF ADVANCED)
mitkFunctionAddExternalProject(NAME cpprestsdk OFF DEPENDS Boost ZLIB ADVANCED)
-mitkFunctionAddExternalProject(NAME ACVD OFF DOC "Use Approximated Centroidal Voronoi Diagrams")
+mitkFunctionAddExternalProject(NAME OpenMesh OFF)
mitkFunctionAddExternalProject(NAME CTK ON DEPENDS Qt5 DCMTK DOC "Use CTK in MITK")
mitkFunctionAddExternalProject(NAME DCMQI ON DEPENDS DCMTK ITK DOC "Use dcmqi in MITK")
mitkFunctionAddExternalProject(NAME MatchPoint OFF ADVANCED DEPENDS ITK DOC "Use the MatchPoint translation image registration library")
if(MITK_USE_Qt5)
mitkFunctionAddExternalProject(NAME Qwt ON ADVANCED DEPENDS Qt5)
endif()
diff --git a/CMakeExternals/ACVD.cmake b/CMakeExternals/OpenMesh.cmake
similarity index 62%
rename from CMakeExternals/ACVD.cmake
rename to CMakeExternals/OpenMesh.cmake
index f011a241ea..4e02342298 100644
--- a/CMakeExternals/ACVD.cmake
+++ b/CMakeExternals/OpenMesh.cmake
@@ -1,49 +1,50 @@
#-----------------------------------------------------------------------------
-# ACVD
+# OpenMesh
#-----------------------------------------------------------------------------
-if(MITK_USE_ACVD)
+if(MITK_USE_OpenMesh)
# Sanity checks
- if(DEFINED ACVD_DIR AND NOT EXISTS ${ACVD_DIR})
- message(FATAL_ERROR "ACVD_DIR variable is defined but corresponds to non-existing directory")
+ if(DEFINED OpenMesh_DIR AND NOT EXISTS "${OpenMesh_DIR}")
+ message(FATAL_ERROR "OpenMesh_DIR variable is defined but corresponds to non-existing directory")
endif()
- set(proj ACVD)
- set(proj_DEPENDENCIES VTK)
- set(ACVD_DEPENDS ${proj})
+ set(proj OpenMesh)
+ set(proj_DEPENDENCIES )
+ set(OpenMesh_DEPENDS ${proj})
- if(NOT DEFINED ACVD_DIR)
+ if(NOT DEFINED OpenMesh_DIR)
set(additional_args )
+
if(CTEST_USE_LAUNCHERS)
list(APPEND additional_args
"-DCMAKE_PROJECT_${proj}_INCLUDE:FILEPATH=${CMAKE_ROOT}/Modules/CTestUseLaunchers.cmake"
)
endif()
ExternalProject_Add(${proj}
LIST_SEPARATOR ${sep}
- URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/ACVD-vtk6_3d5ae388-patched.tar.gz
- URL_MD5 a59e658c8309f6a7004705d86d520d12
+ URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/OpenMesh-8.1.tar.gz
+ URL_MD5 9e1eb6feeca3882ab95f9fc97681a4da
CMAKE_GENERATOR ${gen}
CMAKE_GENERATOR_PLATFORM ${gen_platform}
CMAKE_ARGS
${ep_common_args}
${additional_args}
- -DUSE_MULTITHREADING:BOOL=ON
- -DBUILD_EXAMPLES:BOOL=OFF
- -DVTK_DIR:PATH=${VTK_DIR}
CMAKE_CACHE_ARGS
${ep_common_cache_args}
+ -DBUILD_APPS:BOOL=OFF
+ -DOPENMESH_BUILD_SHARED:BOOL=ON
+ -DOPENMESH_DOCS:BOOL=OFF
CMAKE_CACHE_DEFAULT_ARGS
${ep_common_cache_default_args}
DEPENDS ${proj_DEPENDENCIES}
)
- set(ACVD_DIR ${ep_prefix})
+ set(OpenMesh_DIR "${ep_prefix}")
mitkFunctionInstallExternalCMakeProject(${proj})
else()
mitkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
endif()
endif()
diff --git a/CMakeExternals/VTK-8.1.0.patch b/CMakeExternals/VTK-8.1.0.patch
deleted file mode 100644
index 7dc68def65..0000000000
--- a/CMakeExternals/VTK-8.1.0.patch
+++ /dev/null
@@ -1,93 +0,0 @@
-diff --git a/Rendering/Core/vtkAssembly.cxx b/Rendering/Core/vtkAssembly.cxx
-index 79e4d42b65..b17c74e659 100644
---- a/Rendering/Core/vtkAssembly.cxx
-+++ b/Rendering/Core/vtkAssembly.cxx
-@@ -116,6 +116,7 @@ int vtkAssembly::RenderTranslucentPolygonalGeometry(vtkViewport *ren)
- vtkProp3D* prop3D = static_cast<vtkProp3D *>(path->GetLastNode()->GetViewProp());
- if ( prop3D->GetVisibility() )
- {
-+ prop3D->SetPropertyKeys(this->GetPropertyKeys());
- prop3D->SetAllocatedRenderTime(fraction, ren);
- prop3D->PokeMatrix(path->GetLastNode()->GetMatrix());
- renderedSomething += prop3D->RenderTranslucentPolygonalGeometry(ren);
-@@ -143,6 +144,7 @@ int vtkAssembly::HasTranslucentPolygonalGeometry()
- vtkProp3D* prop3D = static_cast<vtkProp3D *>(path->GetLastNode()->GetViewProp());
- if ( prop3D->GetVisibility() )
- {
-+ prop3D->SetPropertyKeys(this->GetPropertyKeys());
- result = prop3D->HasTranslucentPolygonalGeometry();
- }
- }
-@@ -175,6 +177,7 @@ int vtkAssembly::RenderVolumetricGeometry(vtkViewport *ren)
- vtkProp3D* prop3D = static_cast<vtkProp3D *>(path->GetLastNode()->GetViewProp());
- if (prop3D->GetVisibility())
- {
-+ prop3D->SetPropertyKeys(this->GetPropertyKeys());
- prop3D->SetAllocatedRenderTime(fraction, ren);
- prop3D->PokeMatrix(path->GetLastNode()->GetMatrix());
- renderedSomething += prop3D->RenderVolumetricGeometry(ren);
-@@ -210,6 +213,7 @@ int vtkAssembly::RenderOpaqueGeometry(vtkViewport *ren)
- vtkProp3D* prop3D = static_cast<vtkProp3D *>(path->GetLastNode()->GetViewProp());
- if (prop3D->GetVisibility())
- {
-+ prop3D->SetPropertyKeys(this->GetPropertyKeys());
- prop3D->PokeMatrix(path->GetLastNode()->GetMatrix());
- prop3D->SetAllocatedRenderTime(fraction, ren);
- renderedSomething += prop3D->RenderOpaqueGeometry(ren);
-diff --git a/Rendering/Core/vtkPropAssembly.cxx b/Rendering/Core/vtkPropAssembly.cxx
-index 5033c3b66e..405b1a75ab 100644
---- a/Rendering/Core/vtkPropAssembly.cxx
-+++ b/Rendering/Core/vtkPropAssembly.cxx
-@@ -97,6 +97,7 @@ int vtkPropAssembly::RenderTranslucentPolygonalGeometry(vtkViewport *ren)
- prop = path->GetLastNode()->GetViewProp();
- if ( prop->GetVisibility() )
- {
-+ prop->SetPropertyKeys(this->GetPropertyKeys());
- prop->SetAllocatedRenderTime(fraction, ren);
- prop->PokeMatrix(path->GetLastNode()->GetMatrix());
- renderedSomething += prop->RenderTranslucentPolygonalGeometry(ren);
-@@ -125,6 +126,7 @@ int vtkPropAssembly::HasTranslucentPolygonalGeometry()
- prop = path->GetLastNode()->GetViewProp();
- if ( prop->GetVisibility() )
- {
-+ prop->SetPropertyKeys(this->GetPropertyKeys());
- result=prop->HasTranslucentPolygonalGeometry();
- }
- }
-@@ -154,6 +156,7 @@ int vtkPropAssembly::RenderVolumetricGeometry(vtkViewport *ren)
- prop = path->GetLastNode()->GetViewProp();
- if ( prop->GetVisibility() )
- {
-+ prop->SetPropertyKeys(this->GetPropertyKeys());
- prop->SetAllocatedRenderTime(fraction, ren);
- prop->PokeMatrix(path->GetLastNode()->GetMatrix());
- renderedSomething += prop->RenderVolumetricGeometry(ren);
-@@ -186,6 +189,7 @@ int vtkPropAssembly::RenderOpaqueGeometry(vtkViewport *ren)
- prop = path->GetLastNode()->GetViewProp();
- if ( prop->GetVisibility() )
- {
-+ prop->SetPropertyKeys(this->GetPropertyKeys());
- prop->SetAllocatedRenderTime(fraction, ren);
- prop->PokeMatrix(path->GetLastNode()->GetMatrix());
- renderedSomething += prop->RenderOpaqueGeometry(ren);
-@@ -217,6 +221,7 @@ int vtkPropAssembly::RenderOverlay(vtkViewport *ren)
- prop = path->GetLastNode()->GetViewProp();
- if ( prop->GetVisibility() )
- {
-+ prop->SetPropertyKeys(this->GetPropertyKeys());
- prop->SetAllocatedRenderTime(fraction, ren);
- prop->PokeMatrix(path->GetLastNode()->GetMatrix());
- renderedSomething += prop->RenderOverlay(ren);
-diff --git a/CMake/VTKGenerateExportHeader.cmake b/CMake/VTKGenerateExportHeader.cmake
-index 9a7a76386e..4b5b6855d0 100644
---- a/CMake/VTKGenerateExportHeader.cmake
-+++ b/CMake/VTKGenerateExportHeader.cmake
-@@ -174,7 +174,7 @@ macro(_vtk_test_compiler_hidden_visibility)
- execute_process(COMMAND ${CMAKE_C_COMPILER} --version
- OUTPUT_VARIABLE _gcc_version_info
- ERROR_VARIABLE _gcc_version_info)
-- string(REGEX MATCH "[3-9]\\.[0-9]\\.[0-9]*"
-+ string(REGEX MATCH "([3-9]|10)\\.[0-9]\\.[0-9]*"
- _gcc_version "${_gcc_version_info}")
- # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the
- # patch level, handle this here:
diff --git a/CMakeExternals/VTK.cmake b/CMakeExternals/VTK.cmake
index 5000b167c7..36c53a21b2 100644
--- a/CMakeExternals/VTK.cmake
+++ b/CMakeExternals/VTK.cmake
@@ -1,89 +1,86 @@
#-----------------------------------------------------------------------------
# VTK
#-----------------------------------------------------------------------------
-if(WIN32)
- option(VTK_USE_SYSTEM_FREETYPE OFF)
-else()
- option(VTK_USE_SYSTEM_FREETYPE ON)
-endif()
-
# Sanity checks
if(DEFINED VTK_DIR AND NOT EXISTS ${VTK_DIR})
message(FATAL_ERROR "VTK_DIR variable is defined but corresponds to non-existing directory")
endif()
set(proj VTK)
set(proj_DEPENDENCIES )
set(VTK_DEPENDS ${proj})
if(MITK_USE_HDF5)
list(APPEND proj_DEPENDENCIES HDF5)
endif()
if(NOT DEFINED VTK_DIR)
set(additional_cmake_args )
+ if(WIN32)
+ list(APPEND additional_cmake_args
+ -DCMAKE_CXX_MP_FLAG:BOOL=ON
+ )
+ else()
+ list(APPEND additional_cmake_args
+ -DVTK_MODULE_USE_EXTERNAL_VTK_freetype:BOOL=ON
+ )
+ endif()
+
# Optionally enable memory leak checks for any objects derived from vtkObject. This
# will force unit tests to fail if they have any of these memory leaks.
option(MITK_VTK_DEBUG_LEAKS OFF)
mark_as_advanced(MITK_VTK_DEBUG_LEAKS)
list(APPEND additional_cmake_args
-DVTK_DEBUG_LEAKS:BOOL=${MITK_VTK_DEBUG_LEAKS}
- -DVTK_WRAP_PYTHON:BOOL=OFF
- -DVTK_WINDOWS_PYTHON_DEBUGGABLE:BOOL=OFF
)
if(MITK_USE_Qt5)
list(APPEND additional_cmake_args
- -DVTK_Group_Qt:BOOL=ON
+ -DVTK_GROUP_ENABLE_Qt:STRING=YES
-DQt5_DIR:PATH=${Qt5_DIR}
)
endif()
if(CTEST_USE_LAUNCHERS)
list(APPEND additional_cmake_args
"-DCMAKE_PROJECT_${proj}_INCLUDE:FILEPATH=${CMAKE_ROOT}/Modules/CTestUseLaunchers.cmake"
)
endif()
-
- set (VTK_PATCH_OPTION
- PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_LIST_DIR}/VTK-8.1.0.patch)
mitk_query_custom_ep_vars()
ExternalProject_Add(${proj}
LIST_SEPARATOR ${sep}
- URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/VTK-8.1.0.tar.gz
- URL_MD5 4fa5eadbc8723ba0b8d203f05376d932
- ${VTK_PATCH_OPTION}
+ URL ${MITK_THIRDPARTY_DOWNLOAD_PREFIX_URL}/VTK-9.0.0.tar.gz
+ URL_MD5 fa61cd36491d89a17edab18522bdda49
CMAKE_GENERATOR ${gen}
CMAKE_GENERATOR_PLATFORM ${gen_platform}
CMAKE_ARGS
${ep_common_args}
- -DVTK_WRAP_TCL:BOOL=OFF
- -DVTK_WRAP_PYTHON:BOOL=OFF
- -DVTK_WRAP_JAVA:BOOL=OFF
- -DVTK_USE_SYSTEM_FREETYPE:BOOL=${VTK_USE_SYSTEM_FREETYPE}
+ -DVTK_ENABLE_WRAPPING:BOOL=OFF
-DVTK_LEGACY_REMOVE:BOOL=ON
- -DModule_vtkTestingRendering:BOOL=ON
+ -DVTK_MODULE_ENABLE_VTK_TestingRendering:STRING=YES
+ -DVTK_MODULE_ENABLE_VTK_RenderingContextOpenGL2:STRING=YES
+ -DVTK_MODULE_ENABLE_VTK_RenderingVolumeOpenGL2:STRING=YES
${additional_cmake_args}
${${proj}_CUSTOM_CMAKE_ARGS}
CMAKE_CACHE_ARGS
${ep_common_cache_args}
${${proj}_CUSTOM_CMAKE_CACHE_ARGS}
CMAKE_CACHE_DEFAULT_ARGS
${ep_common_cache_default_args}
${${proj}_CUSTOM_CMAKE_CACHE_DEFAULT_ARGS}
DEPENDS ${proj_DEPENDENCIES}
)
set(VTK_DIR ${ep_prefix})
mitkFunctionInstallExternalCMakeProject(${proj})
else()
mitkMacroEmptyExternalProject(${proj} "${proj_DEPENDENCIES}")
endif()
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 7634f1a83e..1cd4bc6dd5 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,1415 +1,1418 @@
set(MITK_CMAKE_MINIMUM_REQUIRED_VERSION 3.14.5)
cmake_minimum_required(VERSION ${MITK_CMAKE_MINIMUM_REQUIRED_VERSION})
#-----------------------------------------------------------------------------
# See https://cmake.org/cmake/help/v3.14/manual/cmake-policies.7.html for details
#-----------------------------------------------------------------------------
set(project_policies )
foreach(policy ${project_policies})
if(POLICY ${policy})
cmake_policy(SET ${policy} NEW)
endif()
endforeach()
#-----------------------------------------------------------------------------
# Superbuild Option - Enabled by default
#-----------------------------------------------------------------------------
option(MITK_USE_SUPERBUILD "Build MITK and the projects it depends on via SuperBuild.cmake." ON)
if(MITK_USE_SUPERBUILD)
project(MITK-superbuild)
set(MITK_SOURCE_DIR ${PROJECT_SOURCE_DIR})
set(MITK_BINARY_DIR ${PROJECT_BINARY_DIR})
else()
project(MITK VERSION 2018.04.99)
include_directories(SYSTEM ${MITK_SUPERBUILD_BINARY_DIR})
endif()
#-----------------------------------------------------------------------------
# MITK Extension Feature
#-----------------------------------------------------------------------------
set(MITK_EXTENSION_DIRS "" CACHE STRING "")
-set(MITK_DIR_PLUS_EXTENSION_DIRS ${MITK_SOURCE_DIR} ${MITK_EXTENSION_DIRS})
+
+unset(MITK_ABSOLUTE_EXTENSION_DIRS)
+
+foreach(MITK_EXTENSION_DIR ${MITK_EXTENSION_DIRS})
+ get_filename_component(MITK_ABSOLUTE_EXTENSION_DIR "${MITK_EXTENSION_DIR}" ABSOLUTE)
+ list(APPEND MITK_ABSOLUTE_EXTENSION_DIRS "${MITK_ABSOLUTE_EXTENSION_DIR}")
+endforeach()
+
+set(MITK_DIR_PLUS_EXTENSION_DIRS "${MITK_SOURCE_DIR}" ${MITK_ABSOLUTE_EXTENSION_DIRS})
#-----------------------------------------------------------------------------
# Update CMake module path
#-----------------------------------------------------------------------------
set(MITK_CMAKE_DIR ${MITK_SOURCE_DIR}/CMake)
set(CMAKE_MODULE_PATH ${MITK_CMAKE_DIR})
-foreach(MITK_EXTENSION_DIR ${MITK_EXTENSION_DIRS})
- set(MITK_CMAKE_EXTENSION_DIR ${MITK_EXTENSION_DIR}/CMake)
- get_filename_component(MITK_CMAKE_EXTENSION_DIR ${MITK_CMAKE_EXTENSION_DIR} ABSOLUTE)
- if(EXISTS ${MITK_CMAKE_EXTENSION_DIR})
- list(APPEND CMAKE_MODULE_PATH ${MITK_CMAKE_EXTENSION_DIR})
+foreach(MITK_EXTENSION_DIR ${MITK_ABSOLUTE_EXTENSION_DIRS})
+ set(MITK_CMAKE_EXTENSION_DIR "${MITK_EXTENSION_DIR}/CMake")
+ if(EXISTS "${MITK_CMAKE_EXTENSION_DIR}")
+ list(APPEND CMAKE_MODULE_PATH "${MITK_CMAKE_EXTENSION_DIR}")
endif()
endforeach()
#-----------------------------------------------------------------------------
# CMake function(s) and macro(s)
#-----------------------------------------------------------------------------
# Standard CMake macros
include(FeatureSummary)
include(CTest)
include(CMakeParseArguments)
include(FindPackageHandleStandardArgs)
# MITK macros
include(mitkFunctionGetGccVersion)
include(mitkFunctionCheckCompilerFlags)
include(mitkFunctionSuppressWarnings) # includes several functions
include(mitkMacroEmptyExternalProject)
include(mitkFunctionEnableBuildConfiguration)
include(mitkFunctionWhitelists)
include(mitkFunctionAddExternalProject)
include(mitkFunctionAddLibrarySearchPaths)
SUPPRESS_VC_DEPRECATED_WARNINGS()
#-----------------------------------------------------------------------------
# Set a default build type if none was specified
#-----------------------------------------------------------------------------
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
message(STATUS "Setting build type to 'Debug' as none was specified.")
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()
#-----------------------------------------------------------------------------
# Check miminum macOS version
#-----------------------------------------------------------------------------
# The minimum supported macOS version is 10.13. If you use a version less than 10.13, there is no guarantee that the build still works.
if(APPLE)
exec_program(sw_vers ARGS -productVersion OUTPUT_VARIABLE macos_version)
if (macos_version VERSION_LESS "10.13")
message(WARNING "Detected macOS version \"${macos_version}\" is not supported anymore. Minimum required macOS version is at least 10.13.")
endif()
if (CMAKE_OSX_DEPLOYMENT_TARGET AND CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.13)
message(WARNING "Detected macOS deployment target \"${CMAKE_OSX_DEPLOYMENT_TARGET}\" is not supported anymore. Minimum required macOS version is at least 10.13.")
endif()
endif()
#-----------------------------------------------------------------------------
# Check miminum compiler versions
#-----------------------------------------------------------------------------
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# require at least gcc 4.9 as provided by ppa:ubuntu-toolchain-r/test for Ubuntu 14.04
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
message(FATAL_ERROR "GCC version must be at least 4.9
If you are using Ubuntu 14.04, you can easily install gcc and g++ 4.9 (or any later version available) in addition to your version ${CMAKE_CXX_COMPILER_VERSION}:
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.9 g++-4.9
Make sure to explicitly specify these compilers when configuring MITK:
CMAKE_C_COMPILER:FILEPATH=/usr/bin/gcc-4.9
CMAKE_CXX_COMPILER:FILEPATH=/usr/bin/g++-4.9
For more information on the proposed PPA see the Toolchain Updates section of https://wiki.ubuntu.com/ToolChain.")
endif()
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
# require at least clang 3.4
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.4)
message(FATAL_ERROR "Clang version must be at least 3.4")
endif()
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
# require at least clang 5.0
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
message(FATAL_ERROR "Apple Clang version must be at least 5.0")
endif()
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
# require at least Visual Studio 2017
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10)
message(FATAL_ERROR "Microsoft Visual Studio 2017 or newer required")
endif()
else()
message(WARNING "You are using an unsupported compiler! Compilation has only been tested with Clang (Linux or Apple), GCC and MSVC.")
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
mitkFunctionGetGccVersion(${CMAKE_CXX_COMPILER} GCC_VERSION)
else()
set(GCC_VERSION 0)
endif()
set(MITK_CXX_STANDARD 14)
set(CMAKE_CXX_EXTENSIONS 0)
set(CMAKE_CXX_STANDARD ${MITK_CXX_STANDARD})
set(CMAKE_CXX_STANDARD_REQUIRED 1)
# This is necessary to avoid problems with compile feature checks.
# CMAKE_CXX_STANDARD seems to only set the -std=c++14 flag for targets.
# However, compile flag checks also need to be done with -std=c++14.
# The MITK_CXX14_FLAG variable is also used for external projects
# build during the MITK super-build.
mitkFunctionCheckCompilerFlags("-std=c++14" MITK_CXX14_FLAG)
#-----------------------------------------------------------------------------
# Warn if source or build path is too long
#-----------------------------------------------------------------------------
if(WIN32)
set(_src_dir_length_max 50)
set(_bin_dir_length_max 50)
if(MITK_USE_SUPERBUILD)
set(_src_dir_length_max 34) # _src_dir_length_max - strlen(ep/src/ITK-build)
set(_bin_dir_length_max 40) # _bin_dir_length_max - strlen(MITK-build)
endif()
string(LENGTH "${MITK_SOURCE_DIR}" _src_n)
string(LENGTH "${MITK_BINARY_DIR}" _bin_n)
# The warnings should be converted to errors
if(_src_n GREATER _src_dir_length_max)
message(WARNING "MITK source code directory path length is too long (${_src_n} > ${_src_dir_length_max})."
"Please move the MITK source code directory to a directory with a shorter path." )
endif()
if(_bin_n GREATER _bin_dir_length_max)
message(WARNING "MITK build directory path length is too long (${_bin_n} > ${_bin_dir_length_max})."
"Please move the MITK build directory to a directory with a shorter path." )
endif()
endif()
#-----------------------------------------------------------------------------
# Additional MITK Options (also shown during superbuild)
#-----------------------------------------------------------------------------
# -----------------------------------------
# General build options
option(BUILD_SHARED_LIBS "Build MITK with shared libraries" ON)
option(WITH_COVERAGE "Enable/Disable coverage" OFF)
option(BUILD_TESTING "Test the project" ON)
option(MITK_FAST_TESTING "Disable long-running tests like packaging" OFF)
option(MITK_XVFB_TESTING "Execute test drivers through xvfb-run" OFF)
option(MITK_BUILD_ALL_APPS "Build all MITK applications" OFF)
option(MITK_BUILD_EXAMPLES "Build the MITK Examples" OFF)
option(MITK_ENABLE_PIC_READER "Enable support for reading the DKFZ pic file format." ON)
mark_as_advanced(
MITK_XVFB_TESTING
MITK_FAST_TESTING
MITK_BUILD_ALL_APPS
MITK_ENABLE_PIC_READER
)
#-----------------------------------------------------------------------------
# Set UI testing flags
#-----------------------------------------------------------------------------
if(MITK_XVFB_TESTING)
set(MITK_XVFB_TESTING_COMMAND "xvfb-run" "--auto-servernum" CACHE STRING "Command and options to test through Xvfb")
mark_as_advanced(MITK_XVFB_TESTING_COMMAND)
endif(MITK_XVFB_TESTING)
# -----------------------------------------
# Other options
set(MITK_CUSTOM_REVISION_DESC "" CACHE STRING "Override MITK revision description")
mark_as_advanced(MITK_CUSTOM_REVISION_DESC)
set_property(GLOBAL PROPERTY MITK_EXTERNAL_PROJECTS "")
include(CMakeExternals/ExternalProjectList.cmake)
-foreach(MITK_EXTENSION_DIR ${MITK_EXTENSION_DIRS})
- set(MITK_CMAKE_EXTERNALS_EXTENSION_DIR ${MITK_EXTENSION_DIR}/CMakeExternals)
- get_filename_component(MITK_CMAKE_EXTERNALS_EXTENSION_DIR ${MITK_CMAKE_EXTERNALS_EXTENSION_DIR} ABSOLUTE)
- if(EXISTS ${MITK_CMAKE_EXTERNALS_EXTENSION_DIR}/ExternalProjectList.cmake)
- include(${MITK_CMAKE_EXTERNALS_EXTENSION_DIR}/ExternalProjectList.cmake)
+foreach(MITK_EXTENSION_DIR ${MITK_ABSOLUTE_EXTENSION_DIRS})
+ set(MITK_CMAKE_EXTERNALS_EXTENSION_DIR "${MITK_EXTENSION_DIR}/CMakeExternals")
+ if(EXISTS "${MITK_CMAKE_EXTERNALS_EXTENSION_DIR}/ExternalProjectList.cmake")
+ include("${MITK_CMAKE_EXTERNALS_EXTENSION_DIR}/ExternalProjectList.cmake")
endif()
endforeach()
# -----------------------------------------
# Other MITK_USE_* options not related to
# external projects build via the
# MITK superbuild
option(MITK_USE_BLUEBERRY "Build the BlueBerry platform" ON)
option(MITK_USE_OpenCL "Use OpenCL GPU-Computing library" OFF)
option(MITK_USE_OpenMP "Use OpenMP" OFF)
option(MITK_USE_Python3 "Use Python 3" OFF)
#-----------------------------------------------------------------------------
# Build configurations
#-----------------------------------------------------------------------------
set(_buildConfigs "Custom")
file(GLOB _buildConfigFiles CMake/BuildConfigurations/*.cmake)
foreach(_buildConfigFile ${_buildConfigFiles})
get_filename_component(_buildConfigFile ${_buildConfigFile} NAME_WE)
list(APPEND _buildConfigs ${_buildConfigFile})
endforeach()
-foreach(MITK_EXTENSION_DIR ${MITK_EXTENSION_DIRS})
- file(GLOB _extBuildConfigFiles ${MITK_EXTENSION_DIR}/CMake/BuildConfigurations/*.cmake)
+foreach(MITK_EXTENSION_DIR ${MITK_ABSOLUTE_EXTENSION_DIRS})
+ file(GLOB _extBuildConfigFiles "${MITK_EXTENSION_DIR}/CMake/BuildConfigurations/*.cmake")
foreach(_extBuildConfigFile ${_extBuildConfigFiles})
- get_filename_component(_extBuildConfigFile ${_extBuildConfigFile} NAME_WE)
- list(APPEND _buildConfigs ${_extBuildConfigFile})
+ get_filename_component(_extBuildConfigFile "${_extBuildConfigFile}" NAME_WE)
+ list(APPEND _buildConfigs "${_extBuildConfigFile}")
endforeach()
list(REMOVE_DUPLICATES _buildConfigs)
endforeach()
set(MITK_BUILD_CONFIGURATION "Custom" CACHE STRING "Use pre-defined MITK configurations")
set_property(CACHE MITK_BUILD_CONFIGURATION PROPERTY STRINGS ${_buildConfigs})
mitkFunctionEnableBuildConfiguration()
mitkFunctionCreateWhitelistPaths(MITK)
mitkFunctionFindWhitelists(MITK)
# -----------------------------------------
# Qt version related variables
option(MITK_USE_Qt5 "Use Qt 5 library" ON)
if(MITK_USE_Qt5)
- set(MITK_QT5_MINIMUM_VERSION 5.12)
+ if(WIN32)
+ set(MITK_QT5_MINIMUM_VERSION 5.12.9)
+ else()
+ set(MITK_QT5_MINIMUM_VERSION 5.12)
+ endif()
set(MITK_QT5_COMPONENTS Concurrent OpenGL PrintSupport Script Sql Svg Widgets Xml XmlPatterns WebEngineWidgets UiTools Help LinguistTools)
if(APPLE)
list(APPEND MITK_QT5_COMPONENTS DBus)
elseif(UNIX)
list(APPEND MITK_QT5_COMPONENTS X11Extras)
endif()
# Hint at default install locations of Qt
if(NOT Qt5_DIR)
if(MSVC)
set(_dir_candidates "C:/Qt")
if(CMAKE_GENERATOR MATCHES "^Visual Studio [0-9]+ ([0-9]+)")
set(_compilers "msvc${CMAKE_MATCH_1}")
elseif(CMAKE_GENERATOR MATCHES "Ninja")
include(mitkFunctionGetMSVCVersion)
mitkFunctionGetMSVCVersion()
if(VISUAL_STUDIO_PRODUCT_NAME MATCHES "^Visual Studio ([0-9]+)")
set(_compilers "msvc${CMAKE_MATCH_1}")
endif()
endif()
if(_compilers MATCHES "[0-9]+")
if (CMAKE_MATCH_0 EQUAL 2019)
list(APPEND _compilers "msvc2017") # Binary compatible to 2019
endif()
endif()
else()
set(_dir_candidates ~/Qt)
if(APPLE)
set(_compilers clang)
else()
list(APPEND _dir_candidates /opt/Qt)
set(_compilers gcc)
endif()
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
foreach(_compiler ${_compilers})
list(APPEND _compilers64 "${_compiler}_64")
endforeach()
set(_compilers ${_compilers64})
endif()
foreach(_dir_candidate ${_dir_candidates})
get_filename_component(_dir_candidate ${_dir_candidate} REALPATH)
foreach(_compiler ${_compilers})
set(_glob_expression "${_dir_candidate}/5.*/${_compiler}")
file(GLOB _hints ${_glob_expression})
list(SORT _hints)
list(APPEND MITK_QT5_HINTS ${_hints})
endforeach()
endforeach()
endif()
find_package(Qt5 ${MITK_QT5_MINIMUM_VERSION} COMPONENTS ${MITK_QT5_COMPONENTS} REQUIRED HINTS ${MITK_QT5_HINTS})
-
- if(${Qt5_VERSION} VERSION_GREATER_EQUAL 5.13)
- message(WARNING "Qt version ${Qt5_VERSION_MAJOR}.${Qt5_VERSION_MINOR} is not yet supported. We recommend using version 5.12.x.")
- endif()
endif()
# -----------------------------------------
# Custom dependency logic
option(MITK_USE_SYSTEM_Boost "Use the system Boost" OFF)
set(MITK_USE_Boost_LIBRARIES "" CACHE STRING "A semi-colon separated list of required Boost libraries")
if(MITK_USE_cpprestsdk)
+ if(WIN32 AND Qt5_DIR)
+ set(_dir_candidate "${Qt5_DIR}/../../../../../Tools/OpenSSL/Win_x64")
+ get_filename_component(_dir_candidate ${_dir_candidate} ABSOLUTE)
+ if(EXISTS "${_dir_candidate}")
+ set(OPENSSL_ROOT_DIR "${_dir_candidate}")
+ endif()
+ endif()
find_package(OpenSSL QUIET)
if(NOT OpenSSL_FOUND)
set(openssl_message "Could not find OpenSSL (dependency of C++ REST SDK).\n")
if(UNIX)
if(APPLE)
set(openssl_message "${openssl_message}Please install it using your favorite package management "
"system (i.e. Homebrew or MacPorts).\n")
else()
set(openssl_message "${openssl_message}Please install the dev package of OpenSSL (i.e. libssl-dev).\n")
endif()
else()
- set(openssl_message "${openssl_message}Please install Win32 OpenSSL:\n"
- " https://slproweb.com/products/Win32OpenSSL.html\n")
+ set(openssl_message "${openssl_message}Please either install Win32 OpenSSL:\n"
+ " https://slproweb.com/products/Win32OpenSSL.html\n"
+ "Or use the Qt Maintenance tool to install:\n"
+ " Developer and Designer Tools > OpenSSL Toolkit > OpenSSL 64-bit binaries\n")
endif()
set(openssl_message "${openssl_message}If it still cannot be found, you can hint CMake to find OpenSSL by "
"adding/setting the OPENSSL_ROOT_DIR variable to the root directory of an "
"OpenSSL installation. Make sure to clear variables of partly found "
"versions of OpenSSL before, or they will be mixed up.")
message(FATAL_ERROR ${openssl_message})
endif()
list(APPEND MITK_USE_Boost_LIBRARIES date_time regex system)
if(UNIX)
list(APPEND MITK_USE_Boost_LIBRARIES atomic chrono filesystem random thread)
endif()
list(REMOVE_DUPLICATES MITK_USE_Boost_LIBRARIES)
set(MITK_USE_Boost_LIBRARIES ${MITK_USE_Boost_LIBRARIES} CACHE STRING "A semi-colon separated list of required Boost libraries" FORCE)
endif()
if(MITK_USE_Python3)
set(MITK_USE_ZLIB ON CACHE BOOL "" FORCE)
if(APPLE AND CMAKE_FRAMEWORK_PATH AND CMAKE_FRAMEWORK_PATH MATCHES "python3\\.?([0-9]+)")
find_package(Python3 3.${CMAKE_MATCH_1} EXACT REQUIRED COMPONENTS Interpreter Development NumPy)
else()
find_package(Python3 REQUIRED COMPONENTS Interpreter Development NumPy)
endif()
if(WIN32)
string(REPLACE "\\" "/" Python3_STDARCH "${Python3_STDARCH}")
string(REPLACE "\\" "/" Python3_STDLIB "${Python3_STDLIB}")
string(REPLACE "\\" "/" Python3_SITELIB "${Python3_SITELIB}")
endif()
endif()
if(BUILD_TESTING AND NOT MITK_USE_CppUnit)
message("> Forcing MITK_USE_CppUnit to ON because BUILD_TESTING=ON")
set(MITK_USE_CppUnit ON CACHE BOOL "Use CppUnit for unit tests" FORCE)
endif()
if(MITK_USE_BLUEBERRY)
option(MITK_BUILD_ALL_PLUGINS "Build all MITK plugins" OFF)
mark_as_advanced(MITK_BUILD_ALL_PLUGINS)
if(NOT MITK_USE_CTK)
message("> Forcing MITK_USE_CTK to ON because of MITK_USE_BLUEBERRY")
set(MITK_USE_CTK ON CACHE BOOL "Use CTK in MITK" FORCE)
endif()
endif()
#-----------------------------------------------------------------------------
# Pixel type multiplexing
#-----------------------------------------------------------------------------
# Customize the default pixel types for multiplex macros
set(MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES
"int, unsigned int, short, unsigned short, char, unsigned char"
CACHE STRING "List of integral pixel types used in AccessByItk and InstantiateAccessFunction macros")
set(MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES
"double, float"
CACHE STRING "List of floating pixel types used in AccessByItk and InstantiateAccessFunction macros")
set(MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES
"itk::RGBPixel<unsigned char>, itk::RGBAPixel<unsigned char>"
CACHE STRING "List of composite pixel types used in AccessByItk and InstantiateAccessFunction macros")
set(MITK_ACCESSBYITK_DIMENSIONS
"2,3"
CACHE STRING "List of dimensions used in AccessByItk and InstantiateAccessFunction macros")
mark_as_advanced(MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES
MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES
MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES
MITK_ACCESSBYITK_DIMENSIONS
)
# consistency checks
if(NOT MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES)
set(MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES
"int, unsigned int, short, unsigned short, char, unsigned char"
CACHE STRING "List of integral pixel types used in AccessByItk and InstantiateAccessFunction macros" FORCE)
endif()
if(NOT MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES)
set(MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES
"double, float"
CACHE STRING "List of floating pixel types used in AccessByItk and InstantiateAccessFunction macros" FORCE)
endif()
if(NOT MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES)
set(MITK_ACCESSBYITK_COMPOSITE_PIXEL_TYPES
"itk::RGBPixel<unsigned char>, itk::RGBAPixel<unsigned char>"
CACHE STRING "List of composite pixel types used in AccessByItk and InstantiateAccessFunction macros" FORCE)
endif()
if(NOT MITK_ACCESSBYITK_VECTOR_PIXEL_TYPES)
string(REPLACE "," ";" _integral_types ${MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES})
string(REPLACE "," ";" _floating_types ${MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES})
foreach(_scalar_type ${_integral_types} ${_floating_types})
set(MITK_ACCESSBYITK_VECTOR_PIXEL_TYPES
"${MITK_ACCESSBYITK_VECTOR_PIXEL_TYPES}itk::VariableLengthVector<${_scalar_type}>,")
endforeach()
string(LENGTH "${MITK_ACCESSBYITK_VECTOR_PIXEL_TYPES}" _length)
math(EXPR _length "${_length} - 1")
string(SUBSTRING "${MITK_ACCESSBYITK_VECTOR_PIXEL_TYPES}" 0 ${_length} MITK_ACCESSBYITK_VECTOR_PIXEL_TYPES)
set(MITK_ACCESSBYITK_VECTOR_PIXEL_TYPES ${MITK_ACCESSBYITK_VECTOR_PIXEL_TYPES}
CACHE STRING "List of vector pixel types used in AccessByItk and InstantiateAccessFunction macros for itk::VectorImage types" FORCE)
endif()
if(NOT MITK_ACCESSBYITK_DIMENSIONS)
set(MITK_ACCESSBYITK_DIMENSIONS
"2,3"
CACHE STRING "List of dimensions used in AccessByItk and InstantiateAccessFunction macros")
endif()
find_package(Git REQUIRED)
#-----------------------------------------------------------------------------
# Superbuild script
#-----------------------------------------------------------------------------
if(MITK_USE_SUPERBUILD)
include("${CMAKE_CURRENT_SOURCE_DIR}/SuperBuild.cmake")
# Print configuration summary
message("\n\n")
feature_summary(
DESCRIPTION "------- FEATURE SUMMARY FOR ${PROJECT_NAME} -------"
WHAT ALL)
return()
endif()
#*****************************************************************************
#**************************** END OF SUPERBUILD ****************************
#*****************************************************************************
#-----------------------------------------------------------------------------
# Organize MITK targets in folders
#-----------------------------------------------------------------------------
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(MITK_ROOT_FOLDER "MITK" CACHE STRING "")
mark_as_advanced(MITK_ROOT_FOLDER)
#-----------------------------------------------------------------------------
# CMake function(s) and macro(s)
#-----------------------------------------------------------------------------
include(WriteBasicConfigVersionFile)
include(CheckCXXSourceCompiles)
include(GenerateExportHeader)
include(mitkFunctionAddCustomModuleTest)
include(mitkFunctionCheckModuleDependencies)
include(mitkFunctionCompileSnippets)
include(mitkFunctionConfigureVisualStudioUserProjectFile)
-include(mitkFunctionConvertXPSchema)
include(mitkFunctionCreateBlueBerryApplication)
include(mitkFunctionCreateCommandLineApp)
include(mitkFunctionCreateModule)
include(mitkFunctionCreatePlugin)
include(mitkFunctionCreateProvisioningFile)
include(mitkFunctionGetLibrarySearchPaths)
include(mitkFunctionGetVersion)
include(mitkFunctionGetVersionDescription)
include(mitkFunctionInstallAutoLoadModules)
include(mitkFunctionInstallCTKPlugin)
include(mitkFunctionInstallProvisioningFiles)
include(mitkFunctionInstallThirdPartyCTKPlugins)
include(mitkFunctionOrganizeSources)
include(mitkFunctionUseModules)
if( ${MITK_USE_MatchPoint} )
include(mitkFunctionCreateMatchPointDeployedAlgorithm)
endif()
include(mitkMacroConfigureItkPixelTypes)
include(mitkMacroCreateExecutable)
include(mitkMacroCreateModuleTests)
include(mitkMacroGenerateToolsLibrary)
include(mitkMacroGetLinuxDistribution)
include(mitkMacroGetPMDPlatformString)
include(mitkMacroInstall)
include(mitkMacroInstallHelperApp)
include(mitkMacroInstallTargets)
include(mitkMacroMultiplexPicType)
# Deprecated
include(mitkMacroCreateCTKPlugin)
#-----------------------------------------------------------------------------
# Global CMake variables
#-----------------------------------------------------------------------------
# Required and enabled C++14 features for all MITK code.
# These are added as PUBLIC compile features to all MITK modules.
set(MITK_CXX_FEATURES
cxx_auto_type
cxx_decltype
cxx_enum_forward_declarations
cxx_extended_friend_declarations
cxx_extern_templates
cxx_final
cxx_lambdas
cxx_local_type_template_args
cxx_long_long_type
cxx_nullptr
cxx_override
cxx_range_for
cxx_right_angle_brackets
cxx_rvalue_references
cxx_static_assert
cxx_strong_enums
cxx_template_template_parameters
cxx_trailing_return_types
cxx_variadic_macros
)
if(NOT DEFINED CMAKE_DEBUG_POSTFIX)
# We can't do this yet because the CTK Plugin Framework
# cannot cope with a postfix yet.
#set(CMAKE_DEBUG_POSTFIX d)
endif()
#-----------------------------------------------------------------------------
# Output directories.
#-----------------------------------------------------------------------------
set(_default_LIBRARY_output_dir lib)
set(_default_RUNTIME_output_dir bin)
set(_default_ARCHIVE_output_dir lib)
foreach(type LIBRARY RUNTIME ARCHIVE)
# Make sure the directory exists
if(MITK_CMAKE_${type}_OUTPUT_DIRECTORY
AND NOT EXISTS ${MITK_CMAKE_${type}_OUTPUT_DIRECTORY})
message("Creating directory MITK_CMAKE_${type}_OUTPUT_DIRECTORY: ${MITK_CMAKE_${type}_OUTPUT_DIRECTORY}")
file(MAKE_DIRECTORY "${MITK_CMAKE_${type}_OUTPUT_DIRECTORY}")
endif()
if(MITK_CMAKE_${type}_OUTPUT_DIRECTORY)
set(CMAKE_${type}_OUTPUT_DIRECTORY ${MITK_CMAKE_${type}_OUTPUT_DIRECTORY})
else()
set(CMAKE_${type}_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/${_default_${type}_output_dir})
set(MITK_CMAKE_${type}_OUTPUT_DIRECTORY ${CMAKE_${type}_OUTPUT_DIRECTORY})
endif()
set(CMAKE_${type}_OUTPUT_DIRECTORY ${CMAKE_${type}_OUTPUT_DIRECTORY} CACHE INTERNAL "Output directory for ${type} files.")
mark_as_advanced(CMAKE_${type}_OUTPUT_DIRECTORY)
endforeach()
#-----------------------------------------------------------------------------
# Set MITK specific options and variables (NOT available during superbuild)
#-----------------------------------------------------------------------------
# Look for optional Doxygen package
find_package(Doxygen)
option(BLUEBERRY_DEBUG_SMARTPOINTER "Enable code for debugging smart pointers" OFF)
mark_as_advanced(BLUEBERRY_DEBUG_SMARTPOINTER)
# Ask the user to show the console window for applications
option(MITK_SHOW_CONSOLE_WINDOW "Use this to enable or disable the console window when starting MITK GUI Applications" ON)
mark_as_advanced(MITK_SHOW_CONSOLE_WINDOW)
# TODO: check if necessary
option(USE_ITKZLIB "Use the ITK zlib for pic compression." ON)
mark_as_advanced(USE_ITKZLIB)
if(NOT MITK_FAST_TESTING)
if(MITK_CTEST_SCRIPT_MODE STREQUAL "Continuous" OR MITK_CTEST_SCRIPT_MODE STREQUAL "Experimental")
set(MITK_FAST_TESTING ON)
endif()
endif()
if(NOT UNIX)
set(MITK_WIN32_FORCE_STATIC "STATIC" CACHE INTERNAL "Use this variable to always build static libraries on non-unix platforms")
endif()
if(MITK_BUILD_ALL_PLUGINS)
set(MITK_BUILD_ALL_PLUGINS_OPTION "FORCE_BUILD_ALL")
endif()
# Configure pixel types used for ITK image access multiplexing
mitkMacroConfigureItkPixelTypes()
# Configure module naming conventions
set(MITK_MODULE_NAME_REGEX_MATCH "^[A-Z].*$")
set(MITK_MODULE_NAME_REGEX_NOT_MATCH "^[Mm][Ii][Tt][Kk].*$")
set(MITK_DEFAULT_MODULE_NAME_PREFIX "Mitk")
set(MITK_MODULE_NAME_PREFIX ${MITK_DEFAULT_MODULE_NAME_PREFIX})
set(MITK_MODULE_NAME_DEFAULTS_TO_DIRECTORY_NAME 1)
#-----------------------------------------------------------------------------
# Get MITK version info
#-----------------------------------------------------------------------------
mitkFunctionGetVersion(${MITK_SOURCE_DIR} MITK)
mitkFunctionGetVersionDescription(${MITK_SOURCE_DIR} MITK)
# MITK_VERSION
set(MITK_VERSION_STRING "${MITK_VERSION_MAJOR}.${MITK_VERSION_MINOR}.${MITK_VERSION_PATCH}")
if(MITK_VERSION_PATCH STREQUAL "99")
set(MITK_VERSION_STRING "${MITK_VERSION_STRING}-${MITK_REVISION_SHORTID}")
endif()
#-----------------------------------------------------------------------------
# Installation preparation
#
# These should be set before any MITK install macros are used
#-----------------------------------------------------------------------------
# on macOS all BlueBerry plugins get copied into every
# application bundle (.app directory) specified here
if(MITK_USE_BLUEBERRY AND APPLE)
foreach(MITK_EXTENSION_DIR ${MITK_DIR_PLUS_EXTENSION_DIRS})
- set(MITK_APPLICATIONS_EXTENSION_DIR ${MITK_EXTENSION_DIR}/Applications)
- get_filename_component(MITK_APPLICATIONS_EXTENSION_DIR ${MITK_APPLICATIONS_EXTENSION_DIR} ABSOLUTE)
- if(EXISTS ${MITK_APPLICATIONS_EXTENSION_DIR}/AppList.cmake)
+ set(MITK_APPLICATIONS_EXTENSION_DIR "${MITK_EXTENSION_DIR}/Applications")
+ if(EXISTS "${MITK_APPLICATIONS_EXTENSION_DIR}/AppList.cmake")
set(MITK_APPS "")
- include(${MITK_APPLICATIONS_EXTENSION_DIR}/AppList.cmake)
+ include("${MITK_APPLICATIONS_EXTENSION_DIR}/AppList.cmake")
foreach(mitk_app ${MITK_APPS})
# extract option_name
string(REPLACE "^^" "\\;" target_info ${mitk_app})
set(target_info_list ${target_info})
list(GET target_info_list 1 option_name)
list(GET target_info_list 0 app_name)
# check if the application is enabled
if(${option_name} OR MITK_BUILD_ALL_APPS)
set(MACOSX_BUNDLE_NAMES ${MACOSX_BUNDLE_NAMES} Mitk${app_name})
endif()
endforeach()
endif()
endforeach()
endif()
#-----------------------------------------------------------------------------
# Set coverage Flags
#-----------------------------------------------------------------------------
if(WITH_COVERAGE)
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(coverage_flags "-g -fprofile-arcs -ftest-coverage -O0 -DNDEBUG")
set(COVERAGE_CXX_FLAGS ${coverage_flags})
set(COVERAGE_C_FLAGS ${coverage_flags})
endif()
endif()
#-----------------------------------------------------------------------------
# MITK C/CXX Flags
#-----------------------------------------------------------------------------
set(MITK_C_FLAGS "${COVERAGE_C_FLAGS}")
set(MITK_C_FLAGS_DEBUG )
set(MITK_C_FLAGS_RELEASE )
set(MITK_CXX_FLAGS "${COVERAGE_CXX_FLAGS} ${MITK_CXX14_FLAG}")
set(MITK_CXX_FLAGS_DEBUG )
set(MITK_CXX_FLAGS_RELEASE )
set(MITK_EXE_LINKER_FLAGS )
set(MITK_SHARED_LINKER_FLAGS )
if(WIN32)
set(MITK_CXX_FLAGS "${MITK_CXX_FLAGS} -DPOCO_NO_UNWINDOWS -DWIN32_LEAN_AND_MEAN -DNOMINMAX")
mitkFunctionCheckCompilerFlags("/wd4005" MITK_CXX_FLAGS) # warning C4005: macro redefinition
mitkFunctionCheckCompilerFlags("/wd4231" MITK_CXX_FLAGS) # warning C4231: nonstandard extension used : 'extern' before template explicit instantiation
# the following line should be removed after fixing bug 17637
mitkFunctionCheckCompilerFlags("/wd4316" MITK_CXX_FLAGS) # warning C4316: object alignment on heap
mitkFunctionCheckCompilerFlags("/wd4180" MITK_CXX_FLAGS) # warning C4180: qualifier applied to function type has no meaning
mitkFunctionCheckCompilerFlags("/wd4251" MITK_CXX_FLAGS) # warning C4251: 'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2'
endif()
if(APPLE)
set(MITK_CXX_FLAGS "${MITK_CXX_FLAGS} -DGL_SILENCE_DEPRECATION") # Apple deprecated OpenGL in macOS 10.14
endif()
if(NOT MSVC_VERSION)
foreach(_flag
-Wall
-Wextra
-Wpointer-arith
-Winvalid-pch
-Wcast-align
-Wwrite-strings
-Wno-error=gnu
-Wno-error=unknown-pragmas
# The strict-overflow warning is generated by ITK template code
-Wno-error=strict-overflow
-Woverloaded-virtual
-Wstrict-null-sentinel
#-Wold-style-cast
#-Wsign-promo
-Wno-error=deprecated-copy
-Wno-array-bounds
-fdiagnostics-show-option
)
mitkFunctionCheckCAndCXXCompilerFlags(${_flag} MITK_C_FLAGS MITK_CXX_FLAGS)
endforeach()
endif()
if(CMAKE_COMPILER_IS_GNUCXX AND NOT APPLE)
mitkFunctionCheckCompilerFlags("-Wl,--no-undefined" MITK_SHARED_LINKER_FLAGS)
mitkFunctionCheckCompilerFlags("-Wl,--as-needed" MITK_SHARED_LINKER_FLAGS)
endif()
if(CMAKE_COMPILER_IS_GNUCXX)
mitkFunctionCheckCAndCXXCompilerFlags("-fstack-protector-all" MITK_C_FLAGS MITK_CXX_FLAGS)
set(MITK_CXX_FLAGS_RELEASE "-U_FORTIFY_SOURCES -D_FORTIFY_SOURCE=2 ${MITK_CXX_FLAGS_RELEASE}")
endif()
set(MITK_MODULE_LINKER_FLAGS ${MITK_SHARED_LINKER_FLAGS})
set(MITK_EXE_LINKER_FLAGS ${MITK_SHARED_LINKER_FLAGS})
#-----------------------------------------------------------------------------
# MITK Packages
#-----------------------------------------------------------------------------
set(MITK_MODULES_PACKAGE_DEPENDS_DIR ${MITK_SOURCE_DIR}/CMake/PackageDepends)
set(MODULES_PACKAGE_DEPENDS_DIRS ${MITK_MODULES_PACKAGE_DEPENDS_DIR})
-foreach(MITK_EXTENSION_DIR ${MITK_EXTENSION_DIRS})
- set(MITK_PACKAGE_DEPENDS_EXTENSION_DIR ${MITK_EXTENSION_DIR}/CMake/PackageDepends)
- get_filename_component(MITK_PACKAGE_DEPENDS_EXTENSION_DIR ${MITK_PACKAGE_DEPENDS_EXTENSION_DIR} ABSOLUTE)
- if(EXISTS ${MITK_PACKAGE_DEPENDS_EXTENSION_DIR})
- list(APPEND MODULES_PACKAGE_DEPENDS_DIRS ${MITK_PACKAGE_DEPENDS_EXTENSION_DIR})
+foreach(MITK_EXTENSION_DIR ${MITK_ABSOLUTE_EXTENSION_DIRS})
+ set(MITK_PACKAGE_DEPENDS_EXTENSION_DIR "${MITK_EXTENSION_DIR}/CMake/PackageDepends")
+ if(EXISTS "${MITK_PACKAGE_DEPENDS_EXTENSION_DIR}")
+ list(APPEND MODULES_PACKAGE_DEPENDS_DIRS "${MITK_PACKAGE_DEPENDS_EXTENSION_DIR}")
endif()
endforeach()
if(NOT MITK_USE_SYSTEM_Boost)
set(Boost_NO_SYSTEM_PATHS 1)
endif()
set(Boost_USE_MULTITHREADED 1)
set(Boost_USE_STATIC_LIBS 0)
set(Boost_USE_STATIC_RUNTIME 0)
set(Boost_ADDITIONAL_VERSIONS 1.68 1.68.0)
# We need this later for a DCMTK workaround
set(_dcmtk_dir_orig ${DCMTK_DIR})
# This property is populated at the top half of this file
get_property(MITK_EXTERNAL_PROJECTS GLOBAL PROPERTY MITK_EXTERNAL_PROJECTS)
foreach(ep ${MITK_EXTERNAL_PROJECTS})
get_property(_package GLOBAL PROPERTY MITK_${ep}_PACKAGE)
get_property(_components GLOBAL PROPERTY MITK_${ep}_COMPONENTS)
if(MITK_USE_${ep} AND _package)
if(_components)
find_package(${_package} COMPONENTS ${_components} REQUIRED CONFIG)
else()
# Prefer config mode first because it finds external
# <proj>Config.cmake files pointed at by <proj>_DIR variables.
# Otherwise, existing Find<proj>.cmake files could fail.
if(DEFINED ${_package}_DIR)
#we store the information because it will be overwritten by find_package
#and would get lost for all EPs that use on Find<proj>.cmake instead of config
#files.
set(_temp_EP_${_package}_dir ${${_package}_DIR})
endif(DEFINED ${_package}_DIR)
find_package(${_package} QUIET CONFIG)
string(TOUPPER "${_package}" _package_uc)
if(NOT (${_package}_FOUND OR ${_package_uc}_FOUND))
if(DEFINED _temp_EP_${_package}_dir)
set(${_package}_DIR ${_temp_EP_${_package}_dir} CACHE PATH "externaly set dir of the package ${_package}" FORCE)
endif(DEFINED _temp_EP_${_package}_dir)
find_package(${_package} REQUIRED)
endif()
endif()
endif()
endforeach()
# Ensure that the MITK CMake module path comes first
set(CMAKE_MODULE_PATH
${MITK_CMAKE_DIR}
${CMAKE_MODULE_PATH}
)
if(MITK_USE_DCMTK)
# Due to the preferred CONFIG mode in find_package calls above,
# the DCMTKConfig.cmake file is read, which does not provide useful
# package information. We explictly need MODULE mode to find DCMTK.
if(${_dcmtk_dir_orig} MATCHES "${MITK_EXTERNAL_PROJECT_PREFIX}.*")
# Help our FindDCMTK.cmake script find our super-build DCMTK
set(DCMTK_DIR ${MITK_EXTERNAL_PROJECT_PREFIX})
else()
# Use the original value
set(DCMTK_DIR ${_dcmtk_dir_orig})
endif()
find_package(DCMTK REQUIRED MODULE)
endif()
if(MITK_USE_DCMQI)
# Due to the preferred CONFIG mode in find_package calls above,
# the DCMQIConfig.cmake file is read, which does not provide useful
# package information. We explictly need MODULE mode to find DCMQI.
# Help our FindDCMQI.cmake script find our super-build DCMQI
set(DCMQI_DIR ${MITK_EXTERNAL_PROJECT_PREFIX})
find_package(DCMQI REQUIRED)
endif()
link_directories(${Boost_LIBRARY_DIRS})
if(MITK_USE_OpenIGTLink)
link_directories(${OpenIGTLink_LIBRARY_DIRS})
endif()
if(MITK_USE_OpenCL)
find_package(OpenCL REQUIRED)
endif()
if(MITK_USE_OpenMP)
find_package(OpenMP REQUIRED COMPONENTS CXX)
else()
find_package(OpenMP QUIET COMPONENTS CXX)
if(OpenMP_FOUND)
set(MITK_USE_OpenMP ON CACHE BOOL "" FORCE)
elseif(APPLE AND OpenMP_libomp_LIBRARY AND NOT OpenMP_CXX_LIB_NAMES)
set(OpenMP_CXX_LIB_NAMES libomp CACHE STRING "" FORCE)
get_filename_component(openmp_lib_dir "${OpenMP_libomp_LIBRARY}" DIRECTORY)
set(openmp_include_dir "${openmp_lib_dir}/../include")
if(EXISTS "${openmp_include_dir}")
get_filename_component(openmp_include_dir "${openmp_include_dir}" REALPATH)
set(OpenMP_CXX_FLAGS "-Xpreprocessor -fopenmp -I${openmp_include_dir}" CACHE STRING "" FORCE)
find_package(OpenMP QUIET COMPONENTS CXX)
if(OpenMP_FOUND)
set(MITK_USE_OpenMP ON CACHE BOOL "" FORCE)
endif()
endif()
endif()
endif()
# Qt support
if(MITK_USE_Qt5)
find_package(Qt5Core ${MITK_QT5_MINIMUM_VERSION} REQUIRED) # at least Core required
get_target_property(_qmake_exec Qt5::qmake LOCATION)
execute_process(COMMAND ${_qmake_exec} -query QT_INSTALL_BINS
RESULT_VARIABLE _result
OUTPUT_VARIABLE QT_BINARY_DIR
ERROR_VARIABLE _error
)
string(STRIP "${QT_BINARY_DIR}" QT_BINARY_DIR)
if(_result OR NOT EXISTS "${QT_BINARY_DIR}")
message(FATAL_ERROR "Could not determine Qt binary directory: ${_result} ${QT_BINARY_DIR} ${_error}")
endif()
find_program(QT_HELPGENERATOR_EXECUTABLE
NAMES qhelpgenerator qhelpgenerator-qt5 qhelpgenerator5
PATHS ${QT_BINARY_DIR}
NO_DEFAULT_PATH
)
find_program(QT_COLLECTIONGENERATOR_EXECUTABLE
NAMES qcollectiongenerator qcollectiongenerator-qt5 qcollectiongenerator5
PATHS ${QT_BINARY_DIR}
NO_DEFAULT_PATH
)
find_program(QT_ASSISTANT_EXECUTABLE
NAMES assistant assistant-qt5 assistant5
PATHS ${QT_BINARY_DIR}
NO_DEFAULT_PATH
)
find_program(QT_XMLPATTERNS_EXECUTABLE
NAMES xmlpatterns
PATHS ${QT_BINARY_DIR}
NO_DEFAULT_PATH
)
mark_as_advanced(QT_HELPGENERATOR_EXECUTABLE
QT_COLLECTIONGENERATOR_EXECUTABLE
QT_ASSISTANT_EXECUTABLE
QT_XMLPATTERNS_EXECUTABLE
)
if(MITK_USE_BLUEBERRY)
option(BLUEBERRY_USE_QT_HELP "Enable support for integrating plugin documentation into Qt Help" ${DOXYGEN_FOUND})
mark_as_advanced(BLUEBERRY_USE_QT_HELP)
# Sanity checks for in-application BlueBerry plug-in help generation
if(BLUEBERRY_USE_QT_HELP)
set(_force_blueberry_use_qt_help_to_off 0)
if(NOT DOXYGEN_FOUND)
message("> Forcing BLUEBERRY_USE_QT_HELP to OFF because Doxygen was not found.")
set(_force_blueberry_use_qt_help_to_off 1)
endif()
if(DOXYGEN_FOUND AND DOXYGEN_VERSION VERSION_LESS 1.8.7)
message("> Forcing BLUEBERRY_USE_QT_HELP to OFF because Doxygen version 1.8.7 or newer not found.")
set(_force_blueberry_use_qt_help_to_off 1)
endif()
if(NOT QT_HELPGENERATOR_EXECUTABLE)
message("> Forcing BLUEBERRY_USE_QT_HELP to OFF because QT_HELPGENERATOR_EXECUTABLE is empty.")
set(_force_blueberry_use_qt_help_to_off 1)
endif()
if(NOT MITK_USE_Qt5)
message("> Forcing BLUEBERRY_USE_QT_HELP to OFF because MITK_USE_Qt5 is OFF.")
set(_force_blueberry_use_qt_help_to_off 1)
endif()
if(NOT QT_XMLPATTERNS_EXECUTABLE)
message("You have enabled Qt Help support, but QT_XMLPATTERNS_EXECUTABLE is empty")
set(_force_blueberry_use_qt_help_to_off 1)
endif()
if(_force_blueberry_use_qt_help_to_off)
set(BLUEBERRY_USE_QT_HELP OFF CACHE BOOL "Enable support for integrating plugin documentation into Qt Help" FORCE)
endif()
endif()
if(BLUEBERRY_QT_HELP_REQUIRED AND NOT BLUEBERRY_USE_QT_HELP)
message(FATAL_ERROR "BLUEBERRY_USE_QT_HELP is required to be set to ON")
endif()
endif()
endif()
#-----------------------------------------------------------------------------
# Testing
#-----------------------------------------------------------------------------
if(BUILD_TESTING)
#[[ See T27701
# Initial cache for ProjectTemplate and PluginGenerator tests
configure_file(
CMake/mitkTestInitialCache.txt.in
${MITK_BINARY_DIR}/mitkTestInitialCache.txt
@ONLY
)]]
# Configuration for the CMake-generated test driver
set(CMAKE_TESTDRIVER_EXTRA_INCLUDES "#include <stdexcept>")
set(CMAKE_TESTDRIVER_BEFORE_TESTMAIN "
try
{")
set(CMAKE_TESTDRIVER_AFTER_TESTMAIN "
}
catch (const std::exception& e)
{
fprintf(stderr, \"%s\\n\", e.what());
return EXIT_FAILURE;
}
catch (...)
{
printf(\"Exception caught in the test driver\\n\");
return EXIT_FAILURE;
}")
set(MITK_TEST_OUTPUT_DIR "${MITK_BINARY_DIR}/test_output")
if(NOT EXISTS ${MITK_TEST_OUTPUT_DIR})
file(MAKE_DIRECTORY ${MITK_TEST_OUTPUT_DIR})
endif()
# Test the package target
include(mitkPackageTest)
endif()
configure_file(mitkTestingConfig.h.in ${MITK_BINARY_DIR}/mitkTestingConfig.h)
#-----------------------------------------------------------------------------
# MITK_SUPERBUILD_BINARY_DIR
#-----------------------------------------------------------------------------
# If MITK_SUPERBUILD_BINARY_DIR isn't defined, it means MITK is *NOT* build using Superbuild.
# In that specific case, MITK_SUPERBUILD_BINARY_DIR should default to MITK_BINARY_DIR
if(NOT DEFINED MITK_SUPERBUILD_BINARY_DIR)
set(MITK_SUPERBUILD_BINARY_DIR ${MITK_BINARY_DIR})
endif()
#-----------------------------------------------------------------------------
# Set C/CXX and linker flags for MITK code
#-----------------------------------------------------------------------------
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MITK_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${MITK_CXX_FLAGS_DEBUG}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MITK_CXX_FLAGS_RELEASE}")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MITK_C_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${MITK_C_FLAGS_DEBUG}")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${MITK_C_FLAGS_RELEASE}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${MITK_EXE_LINKER_FLAGS}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${MITK_SHARED_LINKER_FLAGS}")
set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${MITK_MODULE_LINKER_FLAGS}")
#-----------------------------------------------------------------------------
# Add subdirectories
#-----------------------------------------------------------------------------
add_subdirectory(Utilities)
add_subdirectory(Modules)
include("${CMAKE_CURRENT_SOURCE_DIR}/Modules/ModuleList.cmake")
mitkFunctionWhitelistModules(MITK MITK_MODULES)
set(MITK_ROOT_FOLDER_BACKUP "${MITK_ROOT_FOLDER}")
-foreach(MITK_EXTENSION_DIR ${MITK_EXTENSION_DIRS})
- get_filename_component(MITK_ROOT_FOLDER ${MITK_EXTENSION_DIR} NAME)
- set(MITK_MODULES_EXTENSION_DIR ${MITK_EXTENSION_DIR}/Modules)
- get_filename_component(MITK_MODULES_EXTENSION_DIR ${MITK_MODULES_EXTENSION_DIR} ABSOLUTE)
- if(EXISTS ${MITK_MODULES_EXTENSION_DIR}/ModuleList.cmake)
+foreach(MITK_EXTENSION_DIR ${MITK_ABSOLUTE_EXTENSION_DIRS})
+ get_filename_component(MITK_ROOT_FOLDER "${MITK_EXTENSION_DIR}" NAME)
+ set(MITK_MODULES_EXTENSION_DIR "${MITK_EXTENSION_DIR}/Modules")
+ if(EXISTS "${MITK_MODULES_EXTENSION_DIR}/ModuleList.cmake")
set(MITK_MODULES "")
- include(${MITK_MODULES_EXTENSION_DIR}/ModuleList.cmake)
+ include("${MITK_MODULES_EXTENSION_DIR}/ModuleList.cmake")
foreach(mitk_module ${MITK_MODULES})
- add_subdirectory(${MITK_MODULES_EXTENSION_DIR}/${mitk_module} Modules/${mitk_module})
+ add_subdirectory("${MITK_MODULES_EXTENSION_DIR}/${mitk_module}" "Modules/${mitk_module}")
endforeach()
endif()
set(MITK_MODULE_NAME_PREFIX ${MITK_DEFAULT_MODULE_NAME_PREFIX})
endforeach()
set(MITK_ROOT_FOLDER "${MITK_ROOT_FOLDER_BACKUP}")
add_subdirectory(Wrapping)
set(MITK_DOXYGEN_OUTPUT_DIR "${PROJECT_BINARY_DIR}/Documentation/Doxygen" CACHE PATH
"Output directory for doxygen generated documentation.")
if(MITK_USE_BLUEBERRY)
-
- set(BLUEBERRY_XPDOC_OUTPUT_DIR "${MITK_DOXYGEN_OUTPUT_DIR}/html/extension-points/html/")
- execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${BLUEBERRY_XPDOC_OUTPUT_DIR})
-
include("${CMAKE_CURRENT_SOURCE_DIR}/Plugins/PluginList.cmake")
mitkFunctionWhitelistPlugins(MITK MITK_PLUGINS)
set(mitk_plugins_fullpath "")
foreach(mitk_plugin ${MITK_PLUGINS})
list(APPEND mitk_plugins_fullpath Plugins/${mitk_plugin})
endforeach()
set(MITK_PLUGIN_REGEX_LIST "")
- foreach(MITK_EXTENSION_DIR ${MITK_EXTENSION_DIRS})
- set(MITK_PLUGINS_EXTENSION_DIR ${MITK_EXTENSION_DIR}/Plugins)
- get_filename_component(MITK_PLUGINS_EXTENSION_DIR ${MITK_PLUGINS_EXTENSION_DIR} ABSOLUTE)
- if(EXISTS ${MITK_PLUGINS_EXTENSION_DIR}/PluginList.cmake)
+ foreach(MITK_EXTENSION_DIR ${MITK_ABSOLUTE_EXTENSION_DIRS})
+ set(MITK_PLUGINS_EXTENSION_DIR "${MITK_EXTENSION_DIR}/Plugins")
+ if(EXISTS "${MITK_PLUGINS_EXTENSION_DIR}/PluginList.cmake")
set(MITK_PLUGINS "")
- include(${MITK_PLUGINS_EXTENSION_DIR}/PluginList.cmake)
+ include("${MITK_PLUGINS_EXTENSION_DIR}/PluginList.cmake")
foreach(mitk_plugin ${MITK_PLUGINS})
- list(APPEND mitk_plugins_fullpath ${MITK_PLUGINS_EXTENSION_DIR}/${mitk_plugin})
+ list(APPEND mitk_plugins_fullpath "${MITK_PLUGINS_EXTENSION_DIR}/${mitk_plugin}")
endforeach()
endif()
endforeach()
if(EXISTS ${MITK_PRIVATE_MODULES}/PluginList.cmake)
include(${MITK_PRIVATE_MODULES}/PluginList.cmake)
foreach(mitk_plugin ${MITK_PRIVATE_PLUGINS})
list(APPEND mitk_plugins_fullpath ${MITK_PRIVATE_MODULES}/${mitk_plugin})
endforeach()
endif()
if(MITK_BUILD_EXAMPLES)
include("${CMAKE_CURRENT_SOURCE_DIR}/Examples/Plugins/PluginList.cmake")
set(mitk_example_plugins_fullpath )
foreach(mitk_example_plugin ${MITK_EXAMPLE_PLUGINS})
list(APPEND mitk_example_plugins_fullpath Examples/Plugins/${mitk_example_plugin})
list(APPEND mitk_plugins_fullpath Examples/Plugins/${mitk_example_plugin})
endforeach()
endif()
# Specify which plug-ins belong to this project
macro(GetMyTargetLibraries all_target_libraries varname)
set(re_ctkplugin_mitk "^org_mitk_[a-zA-Z0-9_]+$")
set(re_ctkplugin_bb "^org_blueberry_[a-zA-Z0-9_]+$")
set(_tmp_list)
list(APPEND _tmp_list ${all_target_libraries})
ctkMacroListFilter(_tmp_list re_ctkplugin_mitk re_ctkplugin_bb MITK_PLUGIN_REGEX_LIST OUTPUT_VARIABLE ${varname})
endmacro()
# Get infos about application directories and build options
set(mitk_apps_fullpath "")
foreach(MITK_EXTENSION_DIR ${MITK_DIR_PLUS_EXTENSION_DIRS})
- set(MITK_APPLICATIONS_EXTENSION_DIR ${MITK_EXTENSION_DIR}/Applications)
- get_filename_component(MITK_APPLICATIONS_EXTENSION_DIR ${MITK_APPLICATIONS_EXTENSION_DIR} ABSOLUTE)
- if(EXISTS ${MITK_APPLICATIONS_EXTENSION_DIR}/AppList.cmake)
+ set(MITK_APPLICATIONS_EXTENSION_DIR "${MITK_EXTENSION_DIR}/Applications")
+ if(EXISTS "${MITK_APPLICATIONS_EXTENSION_DIR}/AppList.cmake")
set(MITK_APPS "")
- include(${MITK_APPLICATIONS_EXTENSION_DIR}/AppList.cmake)
+ include("${MITK_APPLICATIONS_EXTENSION_DIR}/AppList.cmake")
foreach(mitk_app ${MITK_APPS})
# extract option_name
string(REPLACE "^^" "\\;" target_info ${mitk_app})
set(target_info_list ${target_info})
list(GET target_info_list 0 directory_name)
list(GET target_info_list 1 option_name)
if(${option_name})
list(APPEND mitk_apps_fullpath "${MITK_APPLICATIONS_EXTENSION_DIR}/${directory_name}^^${option_name}")
endif()
endforeach()
endif()
endforeach()
if (mitk_plugins_fullpath)
ctkMacroSetupPlugins(${mitk_plugins_fullpath}
BUILD_OPTION_PREFIX MITK_BUILD_
APPS ${mitk_apps_fullpath}
BUILD_ALL ${MITK_BUILD_ALL_PLUGINS}
COMPACT_OPTIONS)
endif()
set(MITK_PLUGIN_USE_FILE "${MITK_BINARY_DIR}/MitkPluginUseFile.cmake")
if(${PROJECT_NAME}_PLUGIN_LIBRARIES)
ctkFunctionGeneratePluginUseFile(${MITK_PLUGIN_USE_FILE})
else()
file(REMOVE ${MITK_PLUGIN_USE_FILE})
set(MITK_PLUGIN_USE_FILE )
endif()
endif()
#-----------------------------------------------------------------------------
# Documentation
#-----------------------------------------------------------------------------
if(DOXYGEN_FOUND)
add_subdirectory(Documentation)
endif()
#-----------------------------------------------------------------------------
# Installation
#-----------------------------------------------------------------------------
# set MITK cpack variables
# These are the default variables, which can be overwritten ( see below )
include(mitkSetupCPack)
set(use_default_config ON)
set(ALL_MITK_APPS "")
set(activated_apps_no 0)
foreach(MITK_EXTENSION_DIR ${MITK_DIR_PLUS_EXTENSION_DIRS})
- set(MITK_APPLICATIONS_EXTENSION_DIR ${MITK_EXTENSION_DIR}/Applications)
- get_filename_component(MITK_APPLICATIONS_EXTENSION_DIR ${MITK_APPLICATIONS_EXTENSION_DIR} ABSOLUTE)
- if(EXISTS ${MITK_APPLICATIONS_EXTENSION_DIR}/AppList.cmake)
+ set(MITK_APPLICATIONS_EXTENSION_DIR "${MITK_EXTENSION_DIR}/Applications")
+ if(EXISTS "${MITK_APPLICATIONS_EXTENSION_DIR}/AppList.cmake")
set(MITK_APPS "")
- include(${MITK_APPLICATIONS_EXTENSION_DIR}/AppList.cmake)
+ include("${MITK_APPLICATIONS_EXTENSION_DIR}/AppList.cmake")
foreach(mitk_app ${MITK_APPS})
string(REPLACE "^^" "\\;" target_info ${mitk_app})
set(target_info_list ${target_info})
list(GET target_info_list 0 directory_name)
list(GET target_info_list 1 option_name)
list(GET target_info_list 2 executable_name)
list(APPEND ALL_MITK_APPS "${MITK_EXTENSION_DIR}/Applications/${directory_name}^^${option_name}^^${executable_name}")
if(${option_name} OR MITK_BUILD_ALL_APPS)
MATH(EXPR activated_apps_no "${activated_apps_no} + 1")
endif()
endforeach()
endif()
endforeach()
list(LENGTH ALL_MITK_APPS app_count)
if(app_count EQUAL 1 AND (activated_apps_no EQUAL 1 OR MITK_BUILD_ALL_APPS))
# Corner case if there is only one app in total
set(use_project_cpack ON)
elseif(activated_apps_no EQUAL 1 AND NOT MITK_BUILD_ALL_APPS)
# Only one app is enabled (no "build all" flag set)
set(use_project_cpack ON)
else()
# Less or more then one app is enabled
set(use_project_cpack OFF)
endif()
foreach(mitk_app ${ALL_MITK_APPS})
# extract target_dir and option_name
string(REPLACE "^^" "\\;" target_info ${mitk_app})
set(target_info_list ${target_info})
list(GET target_info_list 0 target_dir)
list(GET target_info_list 1 option_name)
list(GET target_info_list 2 executable_name)
# check if the application is enabled
if(${option_name} OR MITK_BUILD_ALL_APPS)
# check whether application specific configuration files will be used
if(use_project_cpack)
# use files if they exist
if(EXISTS "${target_dir}/CPackOptions.cmake")
include("${target_dir}/CPackOptions.cmake")
endif()
if(EXISTS "${target_dir}/CPackConfig.cmake.in")
set(CPACK_PROJECT_CONFIG_FILE "${target_dir}/CPackConfig.cmake")
configure_file(${target_dir}/CPackConfig.cmake.in
${CPACK_PROJECT_CONFIG_FILE} @ONLY)
set(use_default_config OFF)
endif()
endif()
# add link to the list
list(APPEND CPACK_CREATE_DESKTOP_LINKS "${executable_name}")
endif()
endforeach()
# if no application specific configuration file was used, use default
if(use_default_config)
configure_file(${MITK_SOURCE_DIR}/MITKCPackOptions.cmake.in
${MITK_BINARY_DIR}/MITKCPackOptions.cmake @ONLY)
set(CPACK_PROJECT_CONFIG_FILE "${MITK_BINARY_DIR}/MITKCPackOptions.cmake")
endif()
# include CPack model once all variables are set
include(CPack)
# Additional installation rules
include(mitkInstallRules)
#-----------------------------------------------------------------------------
# Last configuration steps
#-----------------------------------------------------------------------------
# ---------------- Export targets -----------------
set(MITK_EXPORTS_FILE "${MITK_BINARY_DIR}/MitkExports.cmake")
file(REMOVE ${MITK_EXPORTS_FILE})
set(targets_to_export)
get_property(module_targets GLOBAL PROPERTY MITK_MODULE_TARGETS)
if(module_targets)
list(APPEND targets_to_export ${module_targets})
endif()
if(MITK_USE_BLUEBERRY)
if(MITK_PLUGIN_LIBRARIES)
list(APPEND targets_to_export ${MITK_PLUGIN_LIBRARIES})
endif()
endif()
export(TARGETS ${targets_to_export} APPEND
FILE ${MITK_EXPORTS_FILE})
set(MITK_EXPORTED_TARGET_PROPERTIES )
foreach(target_to_export ${targets_to_export})
get_target_property(autoload_targets ${target_to_export} MITK_AUTOLOAD_TARGETS)
if(autoload_targets)
set(MITK_EXPORTED_TARGET_PROPERTIES "${MITK_EXPORTED_TARGET_PROPERTIES}
set_target_properties(${target_to_export} PROPERTIES MITK_AUTOLOAD_TARGETS \"${autoload_targets}\")")
endif()
get_target_property(autoload_dir ${target_to_export} MITK_AUTOLOAD_DIRECTORY)
if(autoload_dir)
set(MITK_EXPORTED_TARGET_PROPERTIES "${MITK_EXPORTED_TARGET_PROPERTIES}
set_target_properties(${target_to_export} PROPERTIES MITK_AUTOLOAD_DIRECTORY \"${autoload_dir}\")")
endif()
get_target_property(deprecated_module ${target_to_export} MITK_MODULE_DEPRECATED_SINCE)
if(deprecated_module)
set(MITK_EXPORTED_TARGET_PROPERTIES "${MITK_EXPORTED_TARGET_PROPERTIES}
set_target_properties(${target_to_export} PROPERTIES MITK_MODULE_DEPRECATED_SINCE \"${deprecated_module}\")")
endif()
endforeach()
# ---------------- External projects -----------------
get_property(MITK_ADDITIONAL_LIBRARY_SEARCH_PATHS_CONFIG GLOBAL PROPERTY MITK_ADDITIONAL_LIBRARY_SEARCH_PATHS)
set(MITK_CONFIG_EXTERNAL_PROJECTS )
#string(REPLACE "^^" ";" _mitk_external_projects ${MITK_EXTERNAL_PROJECTS})
foreach(ep ${MITK_EXTERNAL_PROJECTS})
get_property(_components GLOBAL PROPERTY MITK_${ep}_COMPONENTS)
set(MITK_CONFIG_EXTERNAL_PROJECTS "${MITK_CONFIG_EXTERNAL_PROJECTS}
set(MITK_USE_${ep} ${MITK_USE_${ep}})
set(MITK_${ep}_DIR \"${${ep}_DIR}\")
set(MITK_${ep}_COMPONENTS ${_components})
")
endforeach()
foreach(ep ${MITK_EXTERNAL_PROJECTS})
get_property(_package GLOBAL PROPERTY MITK_${ep}_PACKAGE)
get_property(_components GLOBAL PROPERTY MITK_${ep}_COMPONENTS)
if(_components)
set(_components_arg COMPONENTS \${_components})
else()
set(_components_arg)
endif()
if(_package)
set(MITK_CONFIG_EXTERNAL_PROJECTS "${MITK_CONFIG_EXTERNAL_PROJECTS}
if(MITK_USE_${ep})
set(${ep}_DIR \${MITK_${ep}_DIR})
if(MITK_${ep}_COMPONENTS)
mitkMacroFindDependency(${_package} COMPONENTS \${MITK_${ep}_COMPONENTS})
else()
mitkMacroFindDependency(${_package})
endif()
endif()")
endif()
endforeach()
# ---------------- Tools -----------------
configure_file(${MITK_SOURCE_DIR}/CMake/ToolExtensionITKFactory.cpp.in
${MITK_BINARY_DIR}/ToolExtensionITKFactory.cpp.in COPYONLY)
configure_file(${MITK_SOURCE_DIR}/CMake/ToolExtensionITKFactoryLoader.cpp.in
${MITK_BINARY_DIR}/ToolExtensionITKFactoryLoader.cpp.in COPYONLY)
configure_file(${MITK_SOURCE_DIR}/CMake/ToolGUIExtensionITKFactory.cpp.in
${MITK_BINARY_DIR}/ToolGUIExtensionITKFactory.cpp.in COPYONLY)
# ---------------- Configure files -----------------
configure_file(mitkVersion.h.in ${MITK_BINARY_DIR}/mitkVersion.h)
configure_file(mitkConfig.h.in ${MITK_BINARY_DIR}/mitkConfig.h)
set(IPFUNC_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ipFunc)
set(UTILITIES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities)
configure_file(mitkConfig.h.in ${MITK_BINARY_DIR}/mitkConfig.h)
configure_file(MITKConfig.cmake.in ${MITK_BINARY_DIR}/MITKConfig.cmake @ONLY)
write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
VERSION ${MITK_VERSION_STRING} COMPATIBILITY AnyNewerVersion)
#-----------------------------------------------------------------------------
# MITK Applications
#-----------------------------------------------------------------------------
# This must come after MITKConfig.h was generated, since applications
# might do a find_package(MITK REQUIRED).
add_subdirectory(Applications)
if(MSVC AND TARGET MitkWorkbench)
set_directory_properties(PROPERTIES VS_STARTUP_PROJECT MitkWorkbench)
endif()
-foreach(MITK_EXTENSION_DIR ${MITK_EXTENSION_DIRS})
- set(MITK_APPLICATIONS_EXTENSION_DIR ${MITK_EXTENSION_DIR}/Applications)
- get_filename_component(MITK_APPLICATIONS_EXTENSION_DIR ${MITK_APPLICATIONS_EXTENSION_DIR} ABSOLUTE)
- if(EXISTS ${MITK_APPLICATIONS_EXTENSION_DIR}/CMakeLists.txt)
- add_subdirectory(${MITK_APPLICATIONS_EXTENSION_DIR} Applications)
+foreach(MITK_EXTENSION_DIR ${MITK_ABSOLUTE_EXTENSION_DIRS})
+ set(MITK_APPLICATIONS_EXTENSION_DIR "${MITK_EXTENSION_DIR}/Applications")
+ if(EXISTS "${MITK_APPLICATIONS_EXTENSION_DIR}/CMakeLists.txt")
+ add_subdirectory("${MITK_APPLICATIONS_EXTENSION_DIR}" "Applications")
endif()
endforeach()
#-----------------------------------------------------------------------------
# MITK Examples
#-----------------------------------------------------------------------------
if(MITK_BUILD_EXAMPLES)
# This must come after MITKConfig.h was generated, since applications
# might do a find_package(MITK REQUIRED).
add_subdirectory(Examples)
endif()
#-----------------------------------------------------------------------------
# Print configuration summary
#-----------------------------------------------------------------------------
message("\n\n")
feature_summary(
DESCRIPTION "------- FEATURE SUMMARY FOR ${PROJECT_NAME} -------"
WHAT ALL
)
diff --git a/Documentation/CMakeLists.txt b/Documentation/CMakeLists.txt
index d68002a508..9a25867947 100644
--- a/Documentation/CMakeLists.txt
+++ b/Documentation/CMakeLists.txt
@@ -1,202 +1,166 @@
# Different doxygen versions produce significantly different behaviour in the MITK documentation
# especially in regards to the MITK Qt assistant help files and markdown files.
# The HTML documentation is supposed to be build with Doxygen 1.8.7 or newer, the
# Qt assistant QCH files are supposed to be generated with Doxygen 1.8.7 or newer.
# So we check for 1.8.7 here and QCH generation support is checked in
# BlueBerry/CMakeLists.txt
set(supported_doxygen_version "1.8.7")
if(DOXYGEN_VERSION VERSION_LESS ${supported_doxygen_version})
MESSAGE(WARNING "Unsupported doxygen version ${DOXYGEN_VERSION}. The MITK HTML documentation has been tested to work with doxygen ${supported_doxygen_version} or newer.")
endif()
option(USE_DOT "Use dot program for generating graphical class diagrams with doxygen, if available" ON)
option(MITK_DOXYGEN_BUILD_ALWAYS "Always build the MITK documentation when building the default target" OFF)
option(MITK_DOXYGEN_GENERATE_QCH_FILES "Use doxygen to generate Qt compressed help files for MITK docs" OFF)
mark_as_advanced(USE_DOT MITK_DOXYGEN_BUILD_ALWAYS MITK_DOXYGEN_GENERATE_QCH_FILES)
if (MITK_DOXYGEN_GENERATE_QCH_FILES AND DOXYGEN_VERSION VERSION_LESS "1.8.7")
message(WARNING "> Forcing MITK_DOXYGEN_GENERATE_QCH_FILES to OFF because Doxygen version 1.8.7 or newer not found.")
set(MITK_DOXYGEN_GENERATE_QCH_FILES OFF CACHE BOOL "Use doxygen to generate Qt compressed help files for MITK docs" FORCE)
endif()
set(HAVE_DOT "NO")
if(DOXYGEN_DOT_EXECUTABLE AND USE_DOT)
set(HAVE_DOT "YES")
endif()
set(MITK_DOXYGEN_TAGFILE_NAME ${MITK_DOXYGEN_OUTPUT_DIR}/MITK.tag CACHE INTERNAL "MITK Doxygen tag file")
# This is relative to the working directory of the doxygen command
set(MITK_DOXYGEN_STYLESHEET mitk_doxygen_extra.css)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/${MITK_DOXYGEN_STYLESHEET}
${CMAKE_CURRENT_BINARY_DIR}/${MITK_DOXYGEN_STYLESHEET} COPYONLY)
# Create QCH files for MITK and external projects
set(MITK_DOXYGEN_GENERATE_QHP "NO")
if(MITK_DOXYGEN_GENERATE_QCH_FILES)
find_program(QT_HELPGENERATOR_EXECUTABLE
NAMES qhelpgenerator qhelpgenerator-qt5 qhelpgenerator5
PATHS ${QT_BINARY_DIR}
DOC "The location of the the Qt help generator executable"
NO_DEFAULT_PATH
)
mark_as_advanced(QT_HELPGENERATOR_EXECUTABLE)
if(NOT QT_HELPGENERATOR_EXECUTABLE)
message(SEND_ERROR "The Qt help generator could not be found. Disabling qch generation")
else()
set(MITK_DOXYGEN_GENERATE_QHP "YES")
endif()
# The name of the generated MITK qch file, relative to the
# Doxygen HTML output folder
set(MITK_DOXYGEN_QCH_FILE "${MITK_BINARY_DIR}/MITK-${MITK_REVISION_ID}.qch")
# Generating ITK and VTK docs it not done yet
#option(MITK_DOXYGEN_GENERATE_VTK_QCH_FILE "Use doxygen to generate a Qt compressed help file for VTK docs" OFF)
#option(MITK_DOXYGEN_GENERATE_ITK_QCH_FILE "Use doxygen to generate a Qt compressed help file for ITK docs" OFF)
#mark_as_advanced(MITK_DOXYGEN_GENERATE_VTK_QCH_FILE MITK_DOXYGEN_GENERATE_ITK_QCH_FILE)
endif()
# Compile a doxygen input filter for processing CMake scripts
include(mitkFunctionCMakeDoxygenFilterCompile)
mitkFunctionCMakeDoxygenFilterCompile(NAMESPACE "CMake")
# Configure some doxygen options
if(NOT MITK_DOXYGEN_INTERNAL_DOCS)
set(MITK_DOXYGEN_INTERNAL_DOCS "NO")
set(MITK_DOXYGEN_HIDE_FRIEND_COMPOUNDS "YES")
set(MITK_DOXYGEN_EXCLUDE_PATTERNS "*_p.* *Private.h */internal/*")
else()
set(MITK_DOXYGEN_HIDE_FRIEND_COMPOUNDS "NO")
set(MITK_DOXYGEN_EXCLUDE_PATTERNS "")
endif()
if(NOT MITK_DOXYGEN_GENERATE_TODOLIST)
set(MITK_DOXYGEN_GENERATE_TODOLIST "NO")
endif()
if(NOT MITK_DOXYGEN_GENERATE_BUGLIST)
set(MITK_DOXYGEN_GENERATE_BUGLIST "NO")
endif()
if(NOT MITK_DOXYGEN_HTML_DYNAMIC_SECTIONS)
set(MITK_DOXYGEN_HTML_DYNAMIC_SECTIONS "NO")
endif()
if(NOT MITK_DOXYGEN_UML_LOOK)
set(MITK_DOXYGEN_UML_LOOK "NO")
endif()
if(NOT MITK_DOXYGEN_GENERATE_DEPRECATEDLIST)
set(MITK_DOXYGEN_GENERATE_DEPRECATEDLIST "YES")
endif()
if(NOT DEFINED MITK_DOXYGEN_DOT_NUM_THREADS)
set(MITK_DOXYGEN_DOT_NUM_THREADS 0)
endif()
if(NOT DEFINED US_PLATFORM)
if(UNIX)
if(APPLE)
set(US_PLATFORM "US_PLATFORM_APPLE=1")
else()
set(US_PLATFORM "US_PLATFORM_LINUX=1")
endif()
set(US_PLATFORM "${US_PLATFORM} \\\nUS_PLATFORM_POSIX=1")
else()
set(US_PLATFORM "US_PLATFORM_WINDOWS=1")
endif()
endif()
# parse which plug-in documentation to activate
set(USERS_GUIDE_INPUT "${MITK_SOURCE_DIR}/Documentation/Doxygen/UserManual/")
if(MITK_USE_BLUEBERRY)
if(MITK_BUILD_ALL_PLUGINS)
set(USERS_GUIDE_INPUT "${USERS_GUIDE_INPUT} \\
${MITK_SOURCE_DIR}/Plugins/")
else()
foreach(mitk_plugin ${${CMAKE_PROJECT_NAME}_PLUGIN_LIBRARIES})
# we want each line to end in " \" and each directory be on a separate line
set(USERS_GUIDE_INPUT "${USERS_GUIDE_INPUT} \\
${${mitk_plugin}_SOURCE_DIR}/")
endforeach()
endif()
if(MITK_BUILD_EXAMPLES)
set(USERS_GUIDE_INPUT "${USERS_GUIDE_INPUT} \\
${MITK_SOURCE_DIR}/Examples/Plugins/")
endif()
endif()
# create output directories for the guides
file(MAKE_DIRECTORY ${MITK_DOXYGEN_OUTPUT_DIR}/Guides/Users_Guide/)
file(MAKE_DIRECTORY ${MITK_DOXYGEN_OUTPUT_DIR}/Guides/Developers_Guide/)
configure_file(doxygen.conf.in
${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf)
configure_file(doxygen_users_guide.conf.in
${CMAKE_CURRENT_BINARY_DIR}/doxygen_users_guide.conf)
configure_file(doxygen_developers_guide.conf.in
${CMAKE_CURRENT_BINARY_DIR}/doxygen_developers_guide.conf)
if(MITK_DOXYGEN_BUILD_ALWAYS)
set(_doc_in_all "ALL")
else()
set(_doc_in_all "")
endif()
add_custom_target(doc ${_doc_in_all}
${DOXYGEN} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.conf
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_target(doc_usersguide
${DOXYGEN} ${CMAKE_CURRENT_BINARY_DIR}/doxygen_users_guide.conf
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
add_custom_target(doc_developersguide
${DOXYGEN} ${CMAKE_CURRENT_BINARY_DIR}/doxygen_developers_guide.conf
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
)
set_property(TARGET doc doc_usersguide doc_developersguide PROPERTY FOLDER "${MITK_ROOT_FOLDER}/Documentation")
-
-if(MITK_USE_BLUEBERRY)
- # convert the extension points schema files into html
- find_package(Ant)
- set(BLUEBERRY_DOC_TOOLS_DIR "" CACHE PATH "Directory containing additional tools needed for generating the documentation")
- if(ANT_FOUND AND BLUEBERRY_DOC_TOOLS_DIR)
-
- list(APPEND MITK_XP_GLOB_EXPRESSIONS
- ${MITK_SOURCE_DIR}/Plugins/plugin.xml)
-
- file(GLOB_RECURSE _plugin_xmls ${MITK_XP_GLOB_EXPRESSIONS})
-
- mitkFunctionConvertXPSchema(INPUT ${_plugin_xmls}
- OUTPUT_DIR "${MITK_DOXYGEN_OUTPUT_DIR}/html/extension-points/html"
- TARGET_NAME mitkXPDoc
- )
-
- add_dependencies(doc mitkXPDoc)
- else()
- message(STATUS "Extension-point schema documentation generation disabled due to missing Ant and / or missing BlueBerry doc tools.")
- endif()
-endif(MITK_USE_BLUEBERRY)
-
-#if(MITK_DOXYGEN_GENERATE_ITK_QCH_FILE)
-# # add the command to generate the ITK documentation
-# add_custom_target(doc-itk
-# COMMAND ${DOXYGEN} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.itk.conf)
-# add_dependencies(doc doc-itk)
-#endif()
-
-#if(MITK_DOXYGEN_GENERATE_VTK_QCH_FILE)
-# # add the command to generate the VTK documentation
-# add_custom_target(doc-vtk
-# COMMAND ${DOXYGEN} ${CMAKE_CURRENT_BINARY_DIR}/doxygen.vtk.conf)
-# add_dependencies(doc doc-vtk)
-#endif()
diff --git a/Documentation/Doxygen/1-Overview/Overview.dox b/Documentation/Doxygen/1-Overview/Overview.dox
index 5f25f2edf4..7001ad9872 100644
--- a/Documentation/Doxygen/1-Overview/Overview.dox
+++ b/Documentation/Doxygen/1-Overview/Overview.dox
@@ -1,88 +1,88 @@
/**
\mainpage
![MITK Logo][logo]
The [Medical Imaging Interaction Toolkit][mitk] (MITK) is a free and versatile open-source software project for the development of medical image processing applications. It can be used as a C++ toolkit or application framework for software development.
Below you can find documentation targeting different
usage scenarios:
<ul>
<li> <b> You may want to use MITK as an application </b>
You may want to use the MITK Workbench as an end user and will find user manuals in \ref UserManualPortal and \ref PluginListPage.
<li> <b> You may want to develop your own software framework, and use some of MITK's data structures and algorithms</b>
You may want to use MITK as a toolkit and probably benefit most from the \ref BuildInstructionsPage and <a
href="modules.html">MITK API Documentation</a>.
<li> <b>You may want to use the MITK and BlueBerry software framework to develop your own software </b>
</ul>
Here you have again two options:
<ul>
<li> <b>You may want to use the MITK Workbench and extend its capabilities</b>
You may want to use MITK as a software framework and writing your own modules and plugins for MITK. You may want to read the \ref BuildInstructionsPage and \ref StartingDevelopment. Also, you might want to take a look at our \ref CMAKE_FAQ.
<li> <b>You may want to create your own application based on MITK</b>
This is probably the most common way to use MITK. You may want to use MITK as a software framework and build your own project and application using MITK. You may want to read \ref HowToNewProject and the general information in \ref StartingDevelopment. Also, you might want to take a look at our \ref CMAKE_FAQ.
</ul>
<h2>About MITK</h2>
MITK is an open-source framework that was originally developed as a common framework for Ph.D. students in the Division of Medical and Biological Informatics (MBI) of the German Cancer Research Center. MITK aims to support the development of leading-edge medical imaging software with a high degree of interaction.
MITK re-uses virtually anything from VTK and ITK. Thus, it is not a competitor to VTK or ITK at all, but an extension, which tries to ease the combination of both, and to add features not supported by VTK or ITK.
Research institutes, medical professionals and companies alike can use MITK as a basic framework for their research and even commercial (thorough code research needed) software due to the BSD-like software license.
Research institutes will profit from the high level of integration of ITK and VTK, enhanced with data management, advanced visualization and interaction functionality in a single framework that is supported by a wide variety of researchers and developers. You don't need to reinvent the wheel over and over and can concentrate on your work.
Medical Professionals will profit from MITK and MITK applications by using its basic functionalities for research projects. Nonetheless, they will be better off, unless they are programmers themselves, to cooperate with a research institute developing with MITK to get the functionality they need. MITK and MITK applications are not certified medical products and may be used in a research setting only. They must not be used in patient care.
<h2>License</h2>
Copyright (c) [German Cancer Research Center][dkfz].
MITK is available as free open-source software under a [BSD-style license][license].
<h2>Useful Links</h2>
- [Homepage][mitk]
- [Download][download]
- [Mailing List][mailinglist]
- [Bug Tracker][bugs]
-[logo]: https://github.com/MITK/MITK/raw/master/mitk.png
-[mitk]: http://mitk.org
-[itk]: https://itk.org
-[vtk]: http://vtk.org
-[mitk-overview]: http://docs.mitk.org/nightly/Overview.html
-[mitk-usermanual]: http://docs.mitk.org/nightly/UserManualPortal.html
-[mitk-devmanual]: http://docs.mitk.org/nightly/DeveloperManualPortal.html
-[mitk-apiref]: http://docs.mitk.org/nightly/usergroup0.html
-[platforms]: http://docs.mitk.org/nightly/SupportedPlatformsPage.html
+[logo]: https://raw.githubusercontent.com/MITK/MITK/master/mitk.png
+[mitk]: https://www.mitk.org/
+[itk]: https://itk.org/
+[vtk]: https://vtk.org/
+[mitk-overview]: https://docs.mitk.org/nightly/Overview.html
+[mitk-usermanual]: https://docs.mitk.org/nightly/UserManualPortal.html
+[mitk-devmanual]: https://docs.mitk.org/nightly/DeveloperManualPortal.html
+[mitk-apiref]: https://docs.mitk.org/nightly/usergroup0.html
+[platforms]: https://docs.mitk.org/nightly/SupportedPlatformsPage.html
[dkfz]: https://www.dkfz.de
-[license]: https://github.com/MITK/MITK/blob/master/LICENSE
-[release-cycle]: http://mitk.org/MitkReleaseCycle
-[download]: http://mitk.org/Download
+[license]: https://raw.githubusercontent.com/MITK/MITK/master/LICENSE
+[release-cycle]: https://www.mitk.org/wiki/MITK_Release_Cycle
+[download]: https://www.mitk.org/wiki/Downloads
[diffusion]: https://phabricator.mitk.org/source/mitk/
-[contribute]: http://mitk.org/How_to_contribute
-[cmake]: https://www.cmake.org
-[build]: http://docs.mitk.org/nightly/BuildInstructionsPage.html
-[mailinglist]: http://mitk.org/Mailinglist
+[contribute]: https://www.mitk.org/wiki/How_to_contribute
+[cmake]: https://cmake.org/
+[build]: https://docs.mitk.org/nightly/BuildInstructionsPage.html
+[mailinglist]: https://www.mitk.org/wiki/MITK_Mailinglist
[bugs]: https://phabricator.mitk.org/maniphest/
*/
diff --git a/Documentation/Doxygen/2-UserManual/MITKPluginGeneralManualsList.dox b/Documentation/Doxygen/2-UserManual/MITKPluginGeneralManualsList.dox
index 3d89a0f0dd..1bab9b4031 100644
--- a/Documentation/Doxygen/2-UserManual/MITKPluginGeneralManualsList.dox
+++ b/Documentation/Doxygen/2-UserManual/MITKPluginGeneralManualsList.dox
@@ -1,33 +1,32 @@
/**
\page PluginListGeneralPage List of General Purpose Plugins
\li \subpage org_mitk_views_basicimageprocessing
\li \subpage org_mitk_views_datamanager
\li \subpage org_mitk_views_properties
\li \subpage org_mitk_editors_dicombrowser
\li \subpage org_mitk_views_dicominspector
\li \subpage org_mitk_views_imagecropper
\li \subpage org_mitk_views_imagenavigator
\li \subpage org_blueberry_views_logview
- \li \subpage org_mitk_gui_qt_matchpoint_algorithm_batch
\li \subpage org_mitk_views_matchpoint_algorithm_browser
\li \subpage org_mitk_views_matchpoint_algorithm_control
\li \subpage org_mitk_views_matchpoint_evaluator
\li \subpage org_mitk_views_matchpoint_framereg
\li \subpage org_mitk_views_matchpoint_manipulator
\li \subpage org_mitk_views_matchpoint_mapper
\li \subpage org_mitk_views_matchpoint_visualizer
\li \subpage org_mitk_gui_qt_measurementtoolbox
\li \subpage org_mitk_views_moviemaker
\li \subpage org_mitk_views_multilabelsegmentation
\li \subpage org_mitk_views_pointsetinteraction
\li \subpage org_mitk_views_python
- \li \subpage org_mitk_views_qt_remeshing
+ \li \subpage org_mitk_views_remeshing
\li \subpage org_mitk_views_screenshotmaker
\li \subpage org_mitk_views_segmentation
\li \subpage org_mitk_views_deformableclippingplane
\li \subpage org_mitk_gui_qt_flow_segmentation
\li \subpage org_mitk_views_viewnavigatorview
\li \subpage org_mitk_views_volumevisualization
*/
diff --git a/Documentation/Doxygen/2-UserManual/MITKPluginManualsList.dox b/Documentation/Doxygen/2-UserManual/MITKPluginManualsList.dox
index be3c4b4319..28d65a2336 100644
--- a/Documentation/Doxygen/2-UserManual/MITKPluginManualsList.dox
+++ b/Documentation/Doxygen/2-UserManual/MITKPluginManualsList.dox
@@ -1,83 +1,73 @@
/**
\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 PluginListGeneralPage
<ul>
<li> \ref org_mitk_views_basicimageprocessing </li>
<li> \ref org_mitk_views_datamanager </li>
<li> \ref org_mitk_editors_dicombrowser </li>
<li> \ref org_mitk_views_dicominspector </li>
<li> \ref org_mitk_views_imagecropper </li>
<li> \ref org_mitk_views_imagenavigator </li>
<li> \ref org_blueberry_views_logview </li>
<li> \ref org_mitk_views_matchpoint_algorithm_browser </li>
<li> \ref org_mitk_views_matchpoint_algorithm_control </li>
<li> \ref org_mitk_views_matchpoint_evaluator </li>
<li> \ref org_mitk_views_matchpoint_framereg </li>
<li> \ref org_mitk_views_matchpoint_manipulator </li>
<li> \ref org_mitk_views_matchpoint_mapper </li>
<li> \ref org_mitk_views_matchpoint_visualizer </li>
<li> \ref org_mitk_views_measurement </li>
<li> \ref org_mitk_views_imagestatistics </li>
<li> \ref org_mitk_views_moviemaker </li>
<li> \ref org_mitk_views_multilabelsegmentation </li>
<li> \ref org_mitk_views_pointsetinteraction </li>
<li> \ref org_mitk_views_python </li>
<li> \ref org_mitk_views_remeshing </li>
<li> \ref org_mitk_views_screenshotmaker </li>
<li> \ref org_mitk_views_segmentation </li>
<li> \ref org_mitk_views_deformableclippingplane </li>
<li> \ref org_mitk_views_viewnavigatorview </li>
<li> \ref org_mitk_views_volumevisualization </li>
<li> \ref org_mitk_views_properties </li>
</ul>
\subpage PluginListSpecificPage
<ul>
<li> \ref org_mitk_gui_qt_flowapplication </li>
- <li> \ref org_mitk_views_flow_control </li>
<li> \ref org_mitk_gui_qt_aicpregistration </li>
<li> \ref org_mitk_gui_qt_cest </li>
<li> \ref org_mitk_gui_qt_classificationsegmentation </li>
<li> \ref org_mitk_views_cmdlinemodules </li>
<li> \ref org_mitk_views_pharmacokinetics_concentration_mri </li>
<li> \ref org_mitk_views_pharmacokinetics_mri </li>
<li> \ref org_mitk_views_pharmacokinetics_pet </li>
- <li> \ref org_mitk_gui_qt_eventrecorder </li>
<li> \ref org_mitk_gui_qt_examples </li>
<li> \ref org_mitk_gui_qt_geometrytools </li>
<li> \ref org_mitk_gui_qt_igtexample </li>
- <li> \ref org_mitk_gui_qt_igtlplugin </li>
<li> \ref org_mitk_gui_qt_igttracking </li>
<li> \ref org_mitk_views_igttrackingsemiautomaticmeasurement </li>
- <li> \ref org_mitk_gui_qt_lasercontrol </li>
<li> \ref org_mitk_views_fit_demo </li>
<li> \ref org_mitk_views_fit_genericfitting </li>
<li> \ref org_mitk_views_fit_inspector </li>
<li> \ref org_mitkexamplesopencv </li>
<li> \ref org_mitk_gui_qt_overlaymanager </li>
<li> \ref org_mitk_gui_qt_mitkphenotyping </li>
- <li> \ref org_mitk_gui_qt_photoacoustics_pausmotioncompensation </li>
- <li> \ref org_mitk_example_gui_pcaexample </li>
<li> \ref org_mitk_gui_qt_preprocessing_resampling </li>
<li> \ref org_mitk_views_pharmacokinetics_curvedescriptor </li>
<li> \ref org_mitk_views_photoacoustics_imageprocessing </li>
<li> \ref org_mitk_gui_qt_pharmacokinetics_simulation </li>
- <li> \ref org_mitk_gui_qt_pointsetinteractionmultispectrum </li>
- <li> \ref org_mitk_gui_qt_renderwindowmanager </li>
<li> \ref org_mitk_gui_qt_photoacoustics_spectralunmixing </li>
- <li> \ref org_mitk_gui_qt_spectrocamrecorder </li>
<li> \ref org_surfacematerialeditor </li>
<li> \ref org_toftutorial </li>
<li> \ref org_blueberry_ui_qt_objectinspector </li>
<li> \ref org_mitk_gui_qt_ultrasound </li>
- <li> \ref org_mitk_gui_qt_igt_app_echotrack </li>
<li> \ref org_mitk_gui_qt_xnat </li>
</ul>
*/
diff --git a/Documentation/Doxygen/2-UserManual/MITKPluginSpecificManualsList.dox b/Documentation/Doxygen/2-UserManual/MITKPluginSpecificManualsList.dox
index c30e4932d9..9f1a98ced2 100644
--- a/Documentation/Doxygen/2-UserManual/MITKPluginSpecificManualsList.dox
+++ b/Documentation/Doxygen/2-UserManual/MITKPluginSpecificManualsList.dox
@@ -1,46 +1,36 @@
/**
\page PluginListSpecificPage List of Application-specific Plugins
\li \subpage org_mitk_gui_qt_aicpregistration
\li \subpage org_mitk_gui_qt_cest
\li \subpage org_mitk_gui_qt_classificationsegmentation
\li \subpage org_mitk_gui_qt_flowapplication
\li \subpage org_mitk_views_cmdlinemodules
\li \subpage org_mitk_views_pharmacokinetics_concentration_mri
\li \subpage org_mitk_views_pharmacokinetics_mri
\li \subpage org_mitk_views_pharmacokinetics_pet
\li \subpage org_mitk_views_pharmacokinetics_simulation
- \li \subpage org_mitk_gui_qt_eventrecorder
\li \subpage org_mitk_gui_qt_examples
\li \subpage org_mitk_gui_qt_geometrytools
\li \subpage org_mitk_gui_qt_igtexample
- \li \subpage org_mitk_gui_qt_igtlplugin
\li \subpage org_mitk_gui_qt_igttracking
\li \subpage org_mitk_views_igttrackingsemiautomaticmeasurement
\li \subpage org_mitk_views_imagestatistics
- \li \subpage org_mitk_gui_qt_lasercontrol
\li \subpage org_mitk_views_fit_demo
\li \subpage org_mitk_views_fit_genericfitting
\li \subpage org_mitk_views_fit_inspector
\li \subpage org_mitkexamplesopencv
\li \subpage org_mitk_gui_qt_overlaymanager
\li \subpage org_mitk_gui_qt_mitkphenotyping
- \li \subpage org_mitk_gui_qt_photoacoustics_pausmotioncompensation
- \li \subpage org_mitk_example_gui_pcaexample
\li \subpage org_mitk_gui_qt_preprocessing_resampling
\li \subpage org_mitk_views_pharmacokinetics_curvedescriptor
\li \subpage org_mitk_views_photoacoustics_imageprocessing
\li \subpage org_mitk_gui_qt_pharmacokinetics_simulation
- \li \subpage org_mitk_gui_qt_pointsetinteractionmultispectrum
- \li \subpage org_mitk_gui_qt_renderwindowmanager
\li \subpage org_mitk_gui_qt_photoacoustics_spectralunmixing
- \li \subpage org_mitk_gui_qt_spectrocamrecorder
\li \subpage org_surfacematerialeditor
\li \subpage org_blueberry_ui_qt_objectinspector
\li \subpage org_toftutorial
\li \subpage org_mitk_gui_qt_ultrasound
- \li \subpage org_mitk_gui_qt_igt_app_echotrack
\li \subpage org_mitk_gui_qt_xnat
-
*/
diff --git a/Documentation/Doxygen/2-UserManual/MiniApps.dox b/Documentation/Doxygen/2-UserManual/MiniApps.dox
index 70515c22c6..e46a512f74 100644
--- a/Documentation/Doxygen/2-UserManual/MiniApps.dox
+++ b/Documentation/Doxygen/2-UserManual/MiniApps.dox
@@ -1,65 +1,65 @@
/**
\page AdvancedTopicsPage Advanced MITK user topics
\section MiniAppExplainPage MITK MiniApps
<div align="center"><h1>What are MiniApps?</h1></div>
MiniApps are small command line tools. Generally the purpose of each of these tools is designed to fulfill one simple task,
e.g. resample an image or extract image statistics of a given region of interest (ROI).
They are intended to provide command line access to a variety of features of MITK, thus facilitating batched processing of data.
<div align="center"><h1>Usage</h1></div>
Each MiniApp should provide information about its usage. If it is called without parameters it will output help information about expected inputs, outputs and parameters.
Below you can see the help output of the MitkGibbsTracking MiniApp:
\code
$./MitkGibbsTracking
-i, --input, input image (tensor, ODF or FSL/MRTrix SH-coefficient image)
-p, --parameters, parameter file (.gtp)
-m, --mask, binary mask image (optional)
-s, --shConvention, sh coefficient convention (FSL, MRtrix) (optional), (default: FSL)
-o, --outFile, output fiber bundle (.fib)
-f, --noFlip, do not flip input image to match MITK coordinate convention (optional)
\endcode
<div align="center"><h1>Integrating a command line tool into MITK Workbench</h1></div>
The executable file has be to be announced in MITK Workbench. This can be done in Preferences window:
Click 'Window' -> 'Preferences', and select 'Command Line Modules'. You can add directories containing executable files or you can select single executable files.
Click 'OK' button.
The configured command line tools are now available via the drop-down box of the Command Line Modules tab.
\warning The build configuration of your MiniApp should match the build configuration of your MITK application. This is especially relevant for developers. Combining a Release application and Debug MiniApp or vice versa might not work.
<div align="center"><h1>Available MiniApps in MITK</h1></div>
<ul>
<li>\ref mitkBasicImageProcessingMiniAppsPortalPage </li>
<li> \ref mitkClassificationMiniAppsPortalPage </li>
</ul>
<div align="center"><h1>Technical Information</h1></div>
-MiniApps follow the <a href="http://www.slicer.org/slicerWiki/index.php/Slicer3:Execution_Model_Documentation">Slicer Execution Model</a> in describing themselves via xml:
+MiniApps follow the <a href="https://www.slicer.org/slicerWiki/index.php/Slicer3:Execution_Model_Documentation">Slicer Execution Model</a> in describing themselves via xml:
\code
$./GibbsTracking --xml
<executable>
<category>Fiber Tracking and Processing Methods</category>
<title>Gibbs Tracking</title>
<description></description>
<contributor>German Cancer Research Center (DKFZ)</contributor>
<parameters>
...
</parameters>
</executable>
\endcode
\note Full conformity is still a work in progress.
*/
diff --git a/Documentation/Doxygen/2-UserManual/UserManualPortal.dox b/Documentation/Doxygen/2-UserManual/UserManualPortal.dox
index 36d07ca892..a9d38ec4a3 100644
--- a/Documentation/Doxygen/2-UserManual/UserManualPortal.dox
+++ b/Documentation/Doxygen/2-UserManual/UserManualPortal.dox
@@ -1,17 +1,17 @@
/**
\usersguidemainpage{UserManualPortal} MITK User Manual
To get an introduction to the usage of any MITK based application please read \ref MITKWorkbenchManualPage. It will give you an overview of most of the common questions, such as how to load or save data or navigate within it. This is a good starting point for first questions.
For more specific information on how a plugin operates you can find the plugin documentation in \ref PluginListPage. The Plugin documentation usually explains the functionality in depth and should solve most problems you might encounter with the plugin. Depending on the application you are using you might have only some or all of the listed plugins available.
Lastly, if your question is not answered here, please use our <a href="https://lists.sourceforge.net/lists/listinfo/mitk-users">Mailinglist</a> to let us know about your problem.
-Alternatively, you can <a href="http://www.mitk.org/Contact">contact us directly</a>.
+Alternatively, you can <a href="https://www.mitk.org/wiki/Contact">contact us directly</a>.
<h2>List of topics</h2>
<ul>
<li> \subpage MITKWorkbenchManualPage </li>
<li> \subpage PluginListPage </li>
<li> \subpage AdvancedTopicsPage </li>
</ul>
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Application/BlueBerry/BlueBerryIntro.dox b/Documentation/Doxygen/3-DeveloperManual/Application/BlueBerry/BlueBerryIntro.dox
index 8730cc4537..5543d831ae 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Application/BlueBerry/BlueBerryIntro.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Application/BlueBerry/BlueBerryIntro.dox
@@ -1,79 +1,79 @@
/**
\page BlueBerryIntro BlueBerry Application Framework
BlueBerry is an application framework used in MITK for creating modular and extensible end-user applications.
More high-level documentation can be found below:
- \subpage BlueBerryWorkbench
- \ref BlueBerryExamples
Please see the \ref BlueBerryExamples for code examples demonstrating different features of the application framework.
The BlueBerry developer reference is available here:
- \ref BlueBerryPlugins
- \subpage BlueBerryExtPointsIndex
\page BlueBerryWorkbench The Workbench: What are Views, Editors, Perspectives?
BlueBerry makes use of the Eclipse UI guidlines which state some concepts on how to build up a GUI. The different objects of the platform UI shall be described here:
\section Workbench Workbench
\li root object of the platform UI
\li collection of \ref WorkbenchWindow "windows"
\imageMacro{workbench.jpg,"The Workbech",11.64}
\section WorkbenchWindow WorkbenchWindow
-\li has one \ref Workbench-Page "page"
+\li has one page
\imageMacro{workbench-window.jpg,"Workbench Windows",8.47}
\section WorkbenchPage Workbench Page
\li denotes to the inner part of the \ref WorkbenchWindow "window", that is: everything except the title bar
\li may have one menu bar, one toolbar, one shortcut bar, and one statusbar
\li has one or more \ref Perspective "perspectives"
\imageMacro{workbench-page.jpg,"Workbench Page",8.47}
\section Perspective Perspective
<UL>
<LI> A visual container for a set of \ref Views "views" and content \ref Editors "editors" </LI>
<LI> Shows \ref Views "views" and \ref Editors "editors" in a certain layout </LI>
<LI> Like a page within a book: </LI>
<UL>
<LI> Only one perspective is visible at any time </LI>
- <LI> There are several perspectives inside a \ref Workbench-Page "page" </LI>
+ <LI> There are several perspectives inside a page </LI>
</UL>
</UL>
\imageMacro{workbench-window-perspective.png,"A Perspective",11.79}
\section Part Part
\li every \ref Views "View" or \ref Editors "Editor" is called \b Part
\subsection Editors Editors
\li the StdMultiWidget is an example for an editor in our MainApp
\li Contains the primary content, such as a document or image data, which users interact with
\li content is the primary focus of attention and a reflection of the primary task
\li primary position in the UI
\li contributes commands to the workbench's main menu bar and toolbar
\li shared in other perspectives
\imageMacro{workbench-window-editor-area.png,"Editor Area",11.79}
\subsection Views Views
<UL>
<LI> support the primary task </LI>
<UL>
<LI> navigate a hierarchy of information </LI>
<LI> open an \ref Editors "editor" </LI>
<LI> view/edit properties </LI>
</UL>
<LI> The views exist wholly within the perspective (not shared, one instance at a time) </LI>
<LI> Every functionality is a view- it supports medical image processing </LI>
</UL>
\imageMacro{workbench-window-views.png,"Views",11.79}
\section ClassDiagram Summary as class diagram
\imageMacro{workbench-class-diagram.jpg,"class diagram",13.74}
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Application/BlueBerryExtensionPointReference.dox b/Documentation/Doxygen/3-DeveloperManual/Application/BlueBerryExtensionPointReference.dox
index 066fc9c444..855dc0e41a 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Application/BlueBerryExtensionPointReference.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Application/BlueBerryExtensionPointReference.dox
@@ -1,94 +1,1354 @@
/**
\page BlueBerryExtPointsIndex BlueBerry Extension-Point Reference
-<center>
- <h1>BlueBerry Platform Extension Points</h1>
-</center>
+- \subpage BlueBerryExtPointsIndex_CoreExpr
+- \subpage BlueBerryExtPointsIndex_PlatformRuntime
+- \subpage BlueBerryExtPointsIndex_Workbench
-The following extension points can be used to extend the capabilities
-of the platform infrastructure:
+\page BlueBerryExtPointsIndex_CoreExpr Platform Core Expressions
-<h3><a name="runtime"></a>Platform Core Expressions</h3>
-<ul>
- <li>\subpage xp_org_blueberry_core_expressions_definitions
- <li>\subpage xp_org_blueberry_core_expressions_commonExpression
- <li>\subpage xp_org_blueberry_core_expressions_propertyTesters
-</ul>
+\tableofcontents
+\section BlueBerryExtPointsIndex_CoreExpr_ExprDef Expression Definitions
-<h3><a name="runtime"></a>Platform Runtime</h3>
-<ul>
- <li>\subpage xp_org_blueberry_osgi_applications
- <li>\subpage xp_org_blueberry_core_runtime_products
-</ul>
+\subsection BlueBerryExtPointsIndex_CoreExpr_ExprDef_Id Identifier
-<h3><a name="workbench"></a>Workbench</h3>
-<ul>
- <li>\subpage xp_org_blueberry_ui_editors
- <li>\subpage xp_org_blueberry_ui_elementFactories
- <li>\subpage xp_org_blueberry_ui_keywords
- <li>\subpage xp_org_blueberry_ui_menus
- <li>\subpage xp_org_blueberry_ui_perspectiveExtensions
- <li>\subpage xp_org_blueberry_ui_perspectives
- <li>\subpage xp_org_blueberry_ui_preferencePages
- <li>\subpage xp_org_blueberry_ui_presentationFactories
- <li>\subpage xp_org_blueberry_ui_services
- <li>\subpage xp_org_blueberry_ui_tweaklets
- <li>\subpage xp_org_blueberry_ui_views
-</ul>
+\c org.blueberry.core.expressions.definitions
-<h3><a name="other"></a>Other</h3>
-<ul>
- <li>\subpage xp_org_blueberry_tests
-</ul>
+\subsection BlueBerryExtPointsIndex_CoreExpr_ExprDef_Desc Description
-\page xp_org_blueberry_core_expressions_definitions org.blueberry.core.expressions.definitions
-\htmlinclude org_blueberry_core_expressions_definitions.html
+This extension point allows you to create reusable extensions.
+They can then be used in other core expression constructs.
+The reference element in a core expression will evaluated the expression definition with the evaluation context that is active for the reference element.
-\page xp_org_blueberry_core_expressions_commonExpression org.blueberry.core.expressions.commonExpression
-\htmlinclude org_blueberry_core_expressions_commonExpression.html
+\subsection BlueBerryExtPointsIndex_CoreExpr_ExprDef_ConfMarkup Configuration Markup
-\page xp_org_blueberry_core_expressions_propertyTesters org.blueberry.core.expressions.propertyTesters
-\htmlinclude org_blueberry_core_expressions_propertyTesters.html
+\code{.unparsed}
+<!ELEMENT extension (definition*)>
+<!ATTLIST extension
+ point CDATA #REQUIRED
+ id CDATA #IMPLIED
+ name CDATA #IMPLIED>
+\endcode
-\page xp_org_blueberry_osgi_applications org.blueberry.osgi.applications
-\htmlinclude org_blueberry_osgi_applications.html
+- <tt>point</tt>: a fully qualified identifier of the target extension point
+- <tt>id</tt>: an optional identifier of the extension instance
+- <tt>name</tt>: an optional name of the extension instance
-\page xp_org_blueberry_core_runtime_products org.blueberry.core.runtime.products
-\htmlinclude org_blueberry_core_runtime_products.html
+\code{.unparsed}
+<!ELEMENT definition (not | and | or | instanceof | test | systemTest | equals | count | with | resolve | adapt | iterate)>
+<!ATTLIST definition
+ id CDATA #REQUIRED>
+\endcode
-\page xp_org_blueberry_ui_elementFactories org.blueberry.ui.elementFactories
-\htmlinclude org_blueberry_ui_elementFactories.html
+Provides a global definition of an expression to be used with the \c \<reference/\> expression element.
+This helps to reuse common expressions.
-\page xp_org_blueberry_ui_menus org.blueberry.ui.menus
-\htmlinclude org_blueberry_ui_menus.html
+- <tt>id</tt>: a globally unique identifier for the expression definition
-\page xp_org_blueberry_ui_perspectiveExtensions org.blueberry.ui.perspectiveExtensions
-\htmlinclude org_blueberry_ui_perspectiveExtensions.html
+\code{.unparsed}
+<!ELEMENT enablement (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate , reference)*>
+\endcode
-\page xp_org_blueberry_ui_editors org.blueberry.ui.editors
-\htmlinclude org_blueberry_ui_editors.html
+A generic root element.
+The element can be used inside an extension point to define its enablement expression.
+The children of an enablement expression are combined using the and operator.
-\page xp_org_blueberry_ui_perspectives org.blueberry.ui.perspectives
-\htmlinclude org_blueberry_ui_perspectives.html
+\code{.unparsed}
+<!ELEMENT not (not | and | or | instanceof | test | systemTest | equals | count | with | resolve | adapt | iterate | reference)>
+\endcode
-\page xp_org_blueberry_ui_presentationFactories org.blueberry.ui.presentationFactories
-\htmlinclude org_blueberry_ui_presentationFactories.html
+This element represent a NOT operation on the result of evaluating it's sub-element expression.
-\page xp_org_blueberry_ui_services org.blueberry.ui.services
-\htmlinclude org_blueberry_ui_services.html
+\code{.unparsed}
+<!ELEMENT and (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate , reference)*>
+\endcode
-\page xp_org_blueberry_ui_keywords org.blueberry.ui.keywords
-\htmlinclude org_blueberry_ui_keywords.html
+This element represent an AND operation on the result of evaluating all it's sub-elements expressions.
-\page xp_org_blueberry_ui_preferencePages org.blueberry.ui.preferencePages
-\htmlinclude org_blueberry_ui_preferencePages.html
+\code{.unparsed}
+<!ELEMENT or (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate , reference)*>
+\endcode
-\page xp_org_blueberry_ui_tweaklets org.blueberry.ui.tweaklets
-\htmlinclude org_blueberry_ui_tweaklets.html
+This element represent an OR operation on the result of evaluating all it's sub-element expressions.
-\page xp_org_blueberry_ui_views org.blueberry.ui.views
-\htmlinclude org_blueberry_ui_views.html
+\code{.unparsed}
+<!ELEMENT instanceof EMPTY>
+<!ATTLIST instanceof
+ value CDATA #REQUIRED>
+\endcode
+
+This element is used to perform an instanceof check of the object in focus.
+The expression returns \c EvaluationResult.TRUE if the object's type is a sub type of the type specified by the attribute value.
+Otherwise \c EvaluationResult.FALSE is returned.
+
+- <tt>value</tt>: a fully qualified name of a class or interface
+
+\code{.unparsed}
+<!ELEMENT test EMPTY>
+<!ATTLIST test
+ property CDATA #REQUIRED
+ args CDATA #IMPLIED
+ value CDATA #IMPLIED
+ forcePluginActivation (true | false)>
+\endcode
+
+This element is used to evaluate the property state of the object in focus.
+The set of testable properties can be extended using the propery tester extension point.
+The test expression returns \c EvaluationResult.NOT_LOADED if the property tester doing the actual testing isn't loaded yet and the attribute \c forcePluginActivation is set to \c false.
+If \c forcePluginActivation is set to \c true and the evaluation context used to evaluate this expression support plug-in activation then evaluating the property will result in activating the plug-in defining the tester.
+
+- <tt>property</tt>: The name of an object's property to test.
+- <tt>args</tt>: Additional arguments passed to the property tester. Multiple arguments are seperated by commas. Each individual argument is converted into a Java base type using the same rules as defined for the value attribute of the test expression.
+- <tt>value</tt>: The expected value of the property. Can be omitted if the property is a boolean property. The test expression is supposed to return \c EvaluationResult.TRUE if the property matches the value and \c EvaluationResult.FALSE otherwise. The value attribute is converted into a Java base type using the following rules:
+ - The string \c "true" is converted into \c Boolean.TRUE .
+ - The string \c "false" is converted into \c Boolean.FALSE .
+ - If the string contains a dot then the interpreter tries to convert the value into a \c Float object. If this fails the string is treated as a \c java.lang.String.
+ - If the string only consists of numbers then the interpreter converts the value in an \c Integer object.
+ - In all other cases the string is treated as a \c java.lang.String .
+ - The conversion of the string into a \c Boolean , \c Float , or \c Integer can be suppressed by surrounding the string with single quotes. For example, the attribute \c value="'true'" is converted into the string "true".
+- <tt>forcePluginActivation</tt>: A flag indicating whether the plug-in contributing the property tester should be loaded if necessary. As such, this flag should be used judiciously, in order to avoid unnecessary plug-in activations. Most clients should avoid setting this flag to \c true. This flag is only honored if the evaluation context used to evaluate this expression allows plug-in activation. Otherwise the flag is ignored and no plug-in loading takes place.
+
+\code{.unparsed}
+<!ELEMENT systemTest EMPTY>
+<!ATTLIST systemTest
+ property CDATA #REQUIRED
+ value CDATA #REQUIRED>
+\endcode
+
+Tests a system property by calling the \c System.getProperty method and compares the result with the value specified through the value attribute.
+
+- <tt>property</tt>: The name of an system property to test.
+- <tt>value</tt>: The expected value of the property. The value is interpreted as a string value.
+
+\code{.unparsed}
+<!ELEMENT equals EMPTY>
+<!ATTLIST equals
+ value CDATA #REQUIRED>
+\endcode
+
+This element is used to perform an equals check of the object in focus.
+The expression returns \c EvaluationResult.TRUE if the object is equal to the value provided by the attribute value.
+Otherwise \c EvaluationResult.FALSE is returned.
+
+- <tt>value</tt>: The expected value. The value provided as a string is converted into a Java base type using the same rules as for the value attribute of the test expression.
+
+\code{.unparsed}
+<!ELEMENT count EMPTY>
+<!ATTLIST count
+ value CDATA #REQUIRED>
+\endcode
+
+This element is used to test the number of elements in a collection.
+
+- <tt>value</tt>: An expression to specify the number of elements in a list. Following wildcard characters can be used:
+ - <tt>*</tt>: any number of elements
+ - <tt>?</tt>: no elements or one element
+ - <tt>+</tt>: one or more elements
+ - <tt>!</tt>: no elements
+ - <tt>integer value</tt>: the list must contain the exact number of elements
+
+\code{.unparsed}
+<!ELEMENT with (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate , reference)*>
+<!ATTLIST with
+ variable CDATA #REQUIRED>
+\endcode
+
+This element changes the object to be inspected for all its child element to the object referenced by the given variable.
+If the variable can not be resolved then the expression will throw an \c ExpressionException when evaluating it.
+The children of a with expression are combined using the and operator.
+
+- <tt>variable</tt>: The name of the variable to be used for further inspection. It is up to the evaluator of an extension point to provide the variable in the variable pool.
+
+\code{.unparsed}
+<!ELEMENT resolve (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate , reference)*>
+<!ATTLIST resolve
+ variable CDATA #REQUIRED
+ args CDATA #IMPLIED>
+\endcode
+
+This element changes the object to be inspected for all its child element to the object referenced by the given variable.
+If the variable can not be resolved then the expression will throw an \c ExpressionException when evaluating it.
+The children of a with expression are combined using the and operator.
+
+- <tt>variable</tt>: The name of the variable to be resolved. This variable is then used as the object in focus for child element evaluation. It is up to the evaluator of an extension point to provide a corresponding variable resolver (see berry::IVariableResolver) through the evaluation context passed to the root expression element when evaluating the expression.
+- <tt>args</tt>: Additional arguments passed to the variable resolver. Multiple arguments are seperated by commas. Each individual argument is converted into a Java base type using the same rules as defined for the value attribute of the test expression.
+
+\code{.unparsed}
+<!ELEMENT adapt (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate , reference)*>
+<!ATTLIST adapt
+ type CDATA #REQUIRED>
+\endcode
+
+This element is used to adapt the object in focus to the type specified by the attribute type.
+The expression returns not loaded if either the adapter or the type referenced isn't loaded yet.
+It throws an \c ExpressionException during evaluation if the type name doesn't exist at all.
+The children of an adapt expression are combined using the and operator.
+
+- <tt>type</tt>: the type to which the object in focus is to be adapted
+
+\code{.unparsed}
+<!ELEMENT iterate (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate , reference)*>
+<!ATTLIST iterate
+ operator (or|and)
+ ifEmpty (true | false) >
+\endcode
+
+This element is used to iterate over a variable that is of type \c java.util.Collection.
+If the object in focus is not of type \c java.util.Collection then an \c ExpressionException will be thrown while evaluating the expression.
+
+- <tt>operator</tt>: Either "and" or "or". The operator defines how the child elements will be combined. If not specified, "and" will be used.
+- <tt>ifEmpty</tt>: The value return from the iterate expression if the collection is empty. If not specified then \c true is returned when the operator equals "and" and \c false is returned if the operator equals "or".
+
+\code{.unparsed}
+<!ELEMENT reference EMPTY>
+<!ATTLIST reference
+ definitionId CDATA #REQUIRED>
+\endcode
+
+This element is used to reference an expression from the \c org.blueberry.core.expressions.definitions extension point.
+The expression definition will be evaluated within the current expression element using the current evaluation context.
+
+- <tt>definitionId</tt>: the unique id of an expression from \c org.blueberry.core.expressions.definitions
+
+\subsection BlueBerryExtPointsIndex_CoreExpr_ExprDef_Examples Examples
+
+\code{.unparsed}
+<extension point="org.blueberry.core.expressions.definitions">
+ <definition id="com.example.parts.activeProblemsView">
+ <with variable="activePartId">
+ <equals value="org.blueberry.ui.views.ProblemsView"/>
+ </with>
+ </definition>
+ <definition id="com.example.markers.markerSelection">
+ <iterate>
+ <instanceof value="org.blueberry.core.resources.IMarker"/>
+ </with>
+ </definition>
+</extension>
+\endcode
+
+Then this expression definition can be used when composing other expressions.
+
+\code{.unparsed}
+<enabledWhen>
+ <reference definitionId="com.example.parts.activeProblemsView">
+</enabledWhen>
+
+<visibleWhen>
+ <and>
+ <reference definitionId="com.example.parts.activeProblemsView"/>
+ <reference definitionId="com.example.markers.markerSelection"/>
+ </and>
+</visibleWhen>
+\endcode
+
+\section BlueBerryExtPointsIndex_CoreExpr_CommExpr Common Expressions
+
+\subsection BlueBerryExtPointsIndex_CoreExpr_CommExpr_Id Identifier
+
+\c org.blueberry.core.expressions.commonExpression
+
+\subsection BlueBerryExtPointsIndex_CoreExpr_CommExpr_ConfMarkup Configuration Markup
+
+\code{.unparsed}
+<!ELEMENT enablement (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate , reference)*>
+\endcode
+
+A generic root element. The element can be used inside an extension point to define its enablement expression.
+The children of an enablement expression are combined using the and operator.
+
+\code{.unparsed}
+<!ELEMENT not (not | and | or | instanceof | test | systemTest | equals | count | with | resolve | adapt | iterate | reference)>
+\endcode
+
+This element represent a NOT operation on the result of evaluating it's sub-element expression.
+
+\code{.unparsed}
+<!ELEMENT and (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate , reference)*>
+\endcode
+
+This element represent an AND operation on the result of evaluating all it's sub-elements expressions.
+
+\code{.unparsed}
+<!ELEMENT or (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate , reference)*>
+\endcode
+
+This element represent an OR operation on the result of evaluating all it's sub-element expressions.
+
+\code{.unparsed}
+<!ELEMENT instanceof EMPTY>
+<!ATTLIST instanceof
+ value CDATA #REQUIRED>
+\endcode
+
+This element is used to perform an instanceof check of the object in focus.
+The expression returns \c EvaluationResult.TRUE if the object's type is a sub type of the type specified by the attribute value.
+Otherwise \c EvaluationResult.FALSE is returned.
+
+- <tt>value</tt>: a fully qualified name of a class or interface
+
+\code{.unparsed}
+<!ELEMENT test EMPTY>
+<!ATTLIST test
+ property CDATA #REQUIRED
+ args CDATA #IMPLIED
+ value CDATA #IMPLIED
+ forcePluginActivation (true | false) >
+\endcode
+
+This element is used to evaluate the property state of the object in focus.
+The set of testable properties can be extended using the propery tester extension point.
+The test expression returns \c EvaluationResult.NOT_LOADED if the property tester doing the actual testing isn't loaded yet and the attribute \c forcePluginActivation is set to false.
+If \c forcePluginActivation is set to \c true and the evaluation context used to evaluate this expression support plug-in activation then evaluating the property will result in activating the plug-in defining the tester.
+
+- <tt>property</tt>: The name of an object's property to test.
+- <tt>args</tt>: Additional arguments passed to the property tester. Multiple arguments are seperated by commas. Each individual argument is converted into a Java base type using the same rules as defined for the value attribute of the test expression.
+- <tt>value</tt>: The expected value of the property. Can be omitted if the property is a boolean property. The test expression is supposed to return EvaluationResult.TRUE if the property matches the value and EvaluationResult.FALSE otherwise. The value attribute is converted into a Java base type using the following rules:
+ - The string "true" is converted into \c Boolean.TRUE
+ - The string "false" is converted into \c Boolean.FALSE
+ - If the string contains a dot then the interpreter tries to convert the value into a \c Float object. If this fails the string is treated as a \c java.lang.String
+ - If the string only consists of numbers then the interpreter converts the value in an \c Integer object.
+ - In all other cases the string is treated as a \c java.lang.String
+ - The conversion of the string into a \c Boolean , \c Float , or \c Integer can be suppressed by surrounding the string with single quotes. For example, the attribute \c value="'true'" is converted into the string "true"
+- <tt>forcePluginActivation</tt>: A flag indicating whether the plug-in contributing the property tester should be loaded if necessary. As such, this flag should be used judiciously, in order to avoid unnecessary plug-in activations. Most clients should avoid setting this flag to true. This flag is only honored if the evaluation context used to evaluate this expression allows plug-in activation. Otherwise the flag is ignored and no plug-in loading takes place.
+
+\code{.unparsed}
+<!ELEMENT systemTest EMPTY>
+<!ATTLIST systemTest
+ property CDATA #REQUIRED
+ value CDATA #REQUIRED>
+\endcode
+
+Tests a system property by calling the \c System.getProperty method and compares the result with the value specified through the value attribute.
+
+- <tt>property</tt>: The name of an system property to test.
+- <tt>value</tt>: The expected value of the property. The value is interpreted as a string value.
+
+\code{.unparsed}
+<!ELEMENT equals EMPTY>
+<!ATTLIST equals
+ value CDATA #REQUIRED>
+\endcode
+
+This element is used to perform an equals check of the object in focus.
+The expression returns \c EvaluationResult.TRUE if the object is equal to the value provided by the attribute value.
+Otherwise \c EvaluationResult.FALSE is returned.
+
+- <tt>value</tt>: The expected value. The value provided as a string is converted into a Java base type using the same rules as for the value attribute of the test expression.
+
+\code{.unparsed}
+<!ELEMENT count EMPTY>
+<!ATTLIST count
+ value CDATA #REQUIRED>
+\endcode
+
+This element is used to test the number of elements in a collection.
+
+- <tt>value</tt>: An expression to specify the number of elements in a list. Following wildcard characters can be used:
+ - <tt>*</tt>: any number of elements
+ - <tt>?</tt>: no elements or one element
+ - <tt>+</tt>: one or more elements
+ - <tt>!</tt>: no elements
+ - <tt>integer value</tt>: the list must contain the exact number of elements
+
+\code{.unparsed}
+<!ELEMENT with (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate , reference)*>
+<!ATTLIST with
+ variable CDATA #REQUIRED>
+\endcode
+
+This element changes the object to be inspected for all its child element to the object referenced by the given variable.
+If the variable can not be resolved then the expression will throw an \c ExpressionException when evaluating it.
+The children of a with expression are combined using the and operator.
+
+- <tt>variable</tt>: The name of the variable to be used for further inspection. It is up to the evaluator of an extension point to provide the variable in the variable pool.
+
+\code{.unparsed}
+<!ELEMENT resolve (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate , reference)*>
+<!ATTLIST resolve
+ variable CDATA #REQUIRED
+ args CDATA #IMPLIED>
+\endcode
+
+This element changes the object to be inspected for all its child element to the object referenced by the given variable.
+If the variable can not be resolved then the expression will throw an \c ExpressionException when evaluating it.
+The children of a with expression are combined using the and operator.
+
+- <tt>variable</tt>: The name of the variable to be resolved. This variable is then used as the object in focus for child element evaluation. It is up to the evaluator of an extension point to provide a corresponding variable resolver (see berry::IVariableResolver) through the evaluation context passed to the root expression element when evaluating the expression.
+- <tt>args</tt>: Additional arguments passed to the variable resolver. Multiple arguments are seperated by commas. Each individual argument is converted into a Java base type using the same rules as defined for the value attribute of the test expression.
+
+\code{.unparsed}
+<!ELEMENT adapt (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate , reference)*>
+<!ATTLIST adapt
+ type CDATA #REQUIRED>
+\endcode
+
+This element is used to adapt the object in focus to the type specified by the attribute type.
+The expression returns not loaded if either the adapter or the type referenced isn't loaded yet. It throws an \c ExpressionException during evaluation if the type name doesn't exist at all.
+The children of an adapt expression are combined using the and operator.
+
+- <tt>type</tt>: the type to which the object in focus is to be adapted
+
+\code{.unparsed}
+<!ELEMENT iterate (not , and , or , instanceof , test , systemTest , equals , count , with , resolve , adapt , iterate , reference)*>
+<!ATTLIST iterate
+ operator (or|and)
+ ifEmpty (true | false) >
+\endcode
+
+This element is used to iterate over a variable that is of type \c java.util.Collection.
+If the object in focus is not of type \c java.util.Collection then an \c ExpressionException will be thrown while evaluating the expression.
+
+- <tt>operator</tt>: Either "and" or "or". The operator defines how the child elements will be combined. If not specified, "and" will be used.
+- <tt>ifEmpty</tt>: The value return from the iterate expression if the collection is empty. If not specified then \c true is returned when the operator equals "and" and \c false is returned if the operator equals "or".
+
+\code{.unparsed}
+<!ELEMENT reference EMPTY>
+<!ATTLIST reference
+ definitionId CDATA #REQUIRED>
+\endcode
+
+This element is used to reference an expression from the \c org.blueberry.core.expressions.definitions extension point.
+The expression definition will be evaluated within the current expression element using the current evaluation context.
+
+- <tt>definitionId</tt>: the unique id of an expression from \c org.blueberry.core.expressions.definitions
+
+\section BlueBerryExtPointsIndex_CoreExpr_PropTest Property Testers
+
+\subsection BlueBerryExtPointsIndex_CoreExpr_PropTest_Id Identifier
+
+\c org.blueberry.core.expressions.propertyTesters
+
+\subsection BlueBerryExtPointsIndex_CoreExpr_PropTest_Desc Description
+
+This extension point allows to add properties to an already existing type.
+Those properties can then be used inside the expression language's test expression element.
+
+\subsection BlueBerryExtPointsIndex_CoreExpr_PropTest_ConfMarkup Configuration Markup
+
+\code{.unparsed}
+<!ELEMENT extension (propertyTester*)>
+<!ATTLIST extension
+ point CDATA #REQUIRED
+ id CDATA #IMPLIED
+ name CDATA #IMPLIED>
+\endcode
+
+- <tt>point</tt>: a fully qualified identifier of the target extension point
+- <tt>id</tt>: an optional identifier of the extension instance
+- <tt>name</tt>: an optional name of the extension instance
+
+\code{.unparsed}
+<!ELEMENT propertyTester EMPTY>
+<!ATTLIST propertyTester
+ id CDATA #REQUIRED
+ type CDATA #REQUIRED
+ namespace CDATA #REQUIRED
+ properties CDATA #REQUIRED
+ class CDATA #REQUIRED>
+\endcode
+
+- <tt>id</tt>: Unique identifier for the property tester.
+- <tt>type</tt>: The type to be extended by this property tester.
+- <tt>namespace</tt>: A unique id determining the name space the properties are added to.
+- <tt>properties</tt>: A comma separated list of properties provided by this property tester.
+- <tt>class</tt>: The name of the class that implements the testing methods. The class must be public and extend \c org.blueberry.core.expressions.PropertyTester with a public 0-argument constructor.
+
+\subsection BlueBerryExtPointsIndex_CoreExpr_PropTest_Examples Examples
+
+\code{.unparsed}
+<extension point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ id="org.eclipse.jdt.ui.IResourceTester"
+ type="org.eclipse.core.resources.IResource"
+ namespace="org.eclipse.jdt.ui"
+ properties="canDelete"
+ class="org.eclipse.jdt.ui.internal.ResourceTester">
+ </propertyTester>
+</extension>
+\endcode
+
+\page BlueBerryExtPointsIndex_PlatformRuntime Platform Runtime
+
+\tableofcontents
+
+\section BlueBerryExtPointsIndex_PlatformRuntime_App Applications
+
+\subsection BlueBerryExtPointsIndex_PlatformRuntime_App_Id Identifier
+
+\c org.blueberry.osgi.applications
+
+\subsection BlueBerryExtPointsIndex_PlatformRuntime_App_Desc Description
+
+The applications extension point allows plugins to contribute applications to the BlueBerry Platform.
+
+\subsection BlueBerryExtPointsIndex_PlatformRuntime_App_ConfMarkup Configuration Markup
+
+\code{.unparsed}
+<!ELEMENT extension (application)+>
+<!ATTLIST extension
+ point CDATA #REQUIRED
+ id CDATA #IMPLIED
+ name CDATA #IMPLIED>
+\endcode
+
+\code{.unparsed}
+<!ELEMENT application (run)>
+<!ATTLIST application
+ id CDATA #REQUIRED
+ name CDATA #IMPLIED>
+\endcode
+
+\code{.unparsed}
+<!ELEMENT run EMPTY>
+<!ATTLIST run
+ class CDATA #REQUIRED>
+\endcode
+
+\subsection BlueBerryExtPointsIndex_PlatformRuntime_App_Examples Examples
+
+\code{.unparsed}
+<extension id="sampleApplication" point="org.blueberry.osgi.applications">
+ <application id="my.domain.application">
+ <run class="xyz::SampleApp"/>
+ </application>
+</extension>
+\endcode
+
+\section BlueBerryExtPointsIndex_PlatformRuntime_Prod Products
+
+\subsection BlueBerryExtPointsIndex_PlatformRuntime_Prod_Id Identifier
+
+\c org.blueberry.core.runtime.products
+
+\subsection BlueBerryExtPointsIndex_PlatformRuntime_Prod_Desc Description
+
+Products are the BlueBerry unit of branding.
+Product extensions are supplied by plug-ins wishing to define one or more products.
+There must be one product per extension as the extension id is used in processing and identifying the product.
+
+There are two possible forms of product extension, static and dynamic.
+Static product extensions directly contain all relevant information about the product.
+Dynamic product extensions identify a class (an \c IProductProvider) which is capable of defining one or more products when queried.
+
+\subsection BlueBerryExtPointsIndex_PlatformRuntime_Prod_ConfMarkup Configuration Markup
+
+\code{.unparsed}
+<!ELEMENT extension ((product | provider))>
+<!ATTLIST extension
+ point CDATA #REQUIRED
+ id CDATA #IMPLIED
+ name CDATA #IMPLIED>
+\endcode
+
+\code{.unparsed}
+<!ELEMENT product (property*)>
+<!ATTLIST product
+ application CDATA #REQUIRED
+ name CDATA #REQUIRED
+ description CDATA #IMPLIED>
+\endcode
+
+- <tt>application</tt>: the default application to run when running this product
+- <tt>name</tt>: the human-readable name of this product
+- <tt>description</tt>: the human-readable description of this product
+
+\code{.unparsed}
+<!ELEMENT property EMPTY>
+<!ATTLIST property
+ name CDATA #REQUIRED
+ value CDATA #REQUIRED>
+\endcode
+
+- <tt>name</tt>: the key under which this property is stored
+- <tt>value</tt>: the value of this property
+
+\code{.unparsed}
+<!ELEMENT provider (run)>
+\endcode
+
+\code{.unparsed}
+<!ELEMENT run EMPTY>
+<!ATTLIST run
+ class CDATA #REQUIRED>
+\endcode
+
+- <tt>class</tt>: the fully-qualified name of a class which implements \c IProductProvider
+
+\subsection BlueBerryExtPointsIndex_PlatformRuntime_Prod_Examples Examples
+
+\code{.unparsed}
+<extension id="coolProduct" point="org.blueberry.core.runtime.products">
+ <product name="%coolName" application="coolApplication" description="%coolDescription">
+ <property name="windowImages" value="window.gif"/>
+ <property name="aboutImage" value="image.gif"/>
+ <property name="aboutText" value="%aboutText"/>
+ <property name="appName" value="CoolApp"/>
+ <property name="welcomePage" value="$nl$/welcome.xml"/>
+ <property name="preferenceCustomization" value="plugin_customization.ini"/>
+ </product>
+</extension>
+\endcode
+
+The following is an example of a dynamic product (product provider) declaration: Following is an example of an application declaration:
+
+\code{.unparsed}
+<extension id="coolProvider" point="org.blueberry.core.runtime.products">
+ <provider>
+ <run class="me::CoolProvider"/>
+ </provider>
+</extension>
+\endcode
+
+\subsection BlueBerryExtPointsIndex_PlatformRuntime_Prod_SupplImpl Supplied Implementation
+
+No implementations of \c IProductProvider are supplied.
+
+\page BlueBerryExtPointsIndex_Workbench Workbench
+
+\tableofcontents
+
+\section BlueBerryExtPointsIndex_Workbench_Edit Internal and External Editors
+
+\subsection BlueBerryExtPointsIndex_Workbench_Edit_Id Identifier
+
+\c org.blueberry.ui.editors
+
+\subsection BlueBerryExtPointsIndex_Workbench_Edit_Desc Description
+
+This extension point is used to add new editors to the workbench.
+A editor is a visual component within a workbench page.
+It is typically used to edit or browse a document or input object.
+To open an editor, the user will typically invoke "Open" on an \c IFile.
+When this action is performed the workbench registry is consulted to determine an appropriate editor for the file type and then a new instance of the editor type is created.
+The actual result depends on the type of the editor.
+The workbench provides support for the creation of internal editors, which are tightly integrated into the workbench, and external editors, which are launched in a separate frame window.
+There are also various levels of integration between these extremes.
+
+In the case of an internal editor tight integration can be achieved between the workbench window and the editor part.
+The workbench menu and toolbar are pre-loaded with a number of common actions, such as cut, copy, and paste.
+The active part, view or editor, is expected to provide the implementation for these actions.
+An internal editor may also define new actions which appear in the workbench window.
+These actions only appear when the editor is active.
+
+The integration between the workbench and external editors is more tenuous.
+In this case the workbench may launch an editor but after has no way of determining the state of the external editor or collaborating with it by any means except through the file system.
+
+\subsection BlueBerryExtPointsIndex_Workbench_Edit_ConfMarkup Configuration Markup
+
+\code{.unparsed}
+<!ELEMENT extension (editor*)>
+<!ATTLIST extension
+ point CDATA #REQUIRED
+ id CDATA #IMPLIED
+ name CDATA #IMPLIED>
+\endcode
+
+- <tt>point</tt>: a fully qualified identifier of the target extension point
+- <tt>id</tt>: an optional identifier of the extension instance
+- <tt>name</tt>: an optional name of the extension instance
+
+\code{.unparsed}
+<!ELEMENT editor (contentTypeBinding*)>
+<!ATTLIST editor
+ id CDATA #REQUIRED
+ name CDATA #REQUIRED
+ icon CDATA #IMPLIED
+ extensions CDATA #IMPLIED
+ class CDATA #IMPLIED
+ command CDATA #IMPLIED
+ launcher CDATA #IMPLIED
+ contributorClass CDATA #IMPLIED
+ default (true | false) "false"
+ filenames CDATA #IMPLIED
+ matchingStrategy CDATA #IMPLIED>
+\endcode
+
+- <tt>id</tt>: a unique name that will be used to identify this editor
+- <tt>name</tt>: a translatable name that will be used in the UI for this editor
+- <tt>icon</tt>: A relative name of the icon that will be used for all resources that match the specified extensions. Editors should provide an icon to make it easy for users to distinguish between different editor types. If you specify a command rather than a class, an icon is not needed. In that case, the workbench will use the icon provided by the operating system.
+- <tt>extensions</tt>: an optional field containing the list of file types understood by the editor. This is a string containing comma separate file extensions. For instance, an editor which understands hypertext documents may register for "htm, html".
+- <tt>class</tt>: the name of a class that implements berry::IEditorPart. The attributes \c class , \c command , and \c launcher are mutually exclusive. If this attribute is defined then \c contributorClass should also be defined.
+- <tt>command</tt>: a command to run in order to launch an external editor. The executable command must be located on the system path or in the plug-in's directory. The attributes class, command, and launcher are mutually exclusive.
+- <tt>launcher</tt>: the name of a class which that implements berry::IEditorLauncher. A launcher will open an external editor. The attributes \c class , \c command , and \c launcher are mutually exclusive.
+- <tt>contributorClass</tt>: the name of a class that implements berry::IEditorActionBarContributor. This attribute should only be defined if the \c class attribute is defined. This class is used to add new actions to the workbench menu and tool bar which reflect the features of the editor type.
+- <tt>default</tt>: if true, this editor will be used as the default editor for the type. This is only relevant in a case where more than one editor is registered for the same type. If an editor is not the default for the type, it can still be launched using "Open with..." submenu for the selected resource.
+Please note that this attribute is only honored for filename and extension associations at this time. It will not be honored for content type bindings. Content type-based resolution will occur on a first come, first serve basis and is not explicitly specified.
+- <tt>filenames</tt>: an optional field containing the list of file names understood by the editor. This is a string containing comma separate file names. For instance, an editor which understands specific hypertext documents may register for "ejb.htm, ejb.html".
+- <tt>matchingStrategy</tt>: the name of a class that implements berry::IEditorMatchingStrategy. This attribute should only be defined if the \c class attribute is defined. This allows the editor extension to provide its own algorithm for matching the input of one of its editors to a given editor input.
+
+\code{.unparsed}
+<!ELEMENT contentTypeBinding EMPTY>
+<!ATTLIST contentTypeBinding
+ contentTypeId CDATA #REQUIRED>
+\endcode
+
+Advertises that the containing editor understands the given content type and is suitable for editing files of that type.
+
+- <tt>contentTypeId</tt>: The content type identifier. This is an ID defined by the \c org.blueberry.core.runtime.contentTypes extension point.
+
+\subsection BlueBerryExtPointsIndex_Workbench_Edit_Examples Examples
+
+The following is an example of an internal editor extension definition:
+
+\code{.unparsed}
+<extension point="org.blueberry.ui.editors">
+ <editor
+ id="com.xyz.XMLEditor"
+ name="Fancy XYZ XML editor"
+ icon="./icons/XMLEditor.gif"
+ extensions="xml"
+ class="xyz::XMLEditor"
+ contributorClass="xyz::XMLEditorContributor"
+ default="false">
+ </editor>
+</extension>
+\endcode
+
+\subsection BlueBerryExtPointsIndex_Workbench_Edit_SupplImpl Supplied Implementation
+
+The workbench provides a "Default Text Editor". The end user product may contain other editors as part of the shipping bundle. In that case, editors will be registered as extensions using the syntax described above.
+
+\section BlueBerryExtPointsIndex_Workbench_Keywords Keywords
+
+\subsection BlueBerryExtPointsIndex_Workbench_Keywords_Id Identifier
+
+\c org.blueberry.ui.keywords
+
+\subsection BlueBerryExtPointsIndex_Workbench_Keywords_Desc Description
+
+The keywords extension point defines keywords and a unique id for reference by other schemas. See \c propertyPages and \c preferencePages .
+
+\subsection BlueBerryExtPointsIndex_Workbench_Keywords_ConfMarkup Configuration Markup
+
+\code{.unparsed}
+<!ELEMENT extension (keyword*)>
+<!ATTLIST extension
+ point CDATA #REQUIRED
+ id CDATA #IMPLIED
+ name CDATA #IMPLIED>
+\endcode
+
+- <tt>point</tt>: a fully qualified identifier of the target extension point
+- <tt>id</tt>: an optional identifier of the extension instance
+- <tt>name</tt>: an optional name of the extension instance
+
+\code{.unparsed}
+<!ELEMENT keyword EMPTY>
+<!ATTLIST keyword
+ id CDATA #REQUIRED
+ label CDATA #REQUIRED>
+\endcode
+
+- <tt>id</tt>: The id is the unique id used to reference the keyword
+- <tt>label</tt>: The human readable label of the keyword
+
+\subsection BlueBerryExtPointsIndex_Workbench_Keywords_Examples Examples
+
+The following is an example of a keyword extension:
+
+\code{.unparsed}
+<extension
+ point="org.blueberry.ui.keywords">
+ <keyword
+ label="presentation tab themes"
+ id="com.xyz.AppearanceKeywords"/>
+</extension>
+\endcode
+
+\subsection BlueBerryExtPointsIndex_Workbench_Keywords_SupplImpl Supplied Implementation
+
+Keywords are used only with preference and property pages. See the \c keywordReference element of the \c org.blueberry.ui.propertyPages and \c org.blueberry.ui.preferencePages extension points.
+
+\section BlueBerryExtPointsIndex_Workbench_PerspExt Perspective Extensions
+
+\subsection BlueBerryExtPointsIndex_Workbench_PerspExt_Id Identifier
+
+\c org.blueberry.ui.perspectiveExtensions
+
+\subsection BlueBerryExtPointsIndex_Workbench_PerspExt_Desc Description
+
+This extension point is used to extend perspectives registered by other plug-ins.
+A perspective defines the initial contents of the window action bars (menu and toolbar) and the initial set of views and their layout within a workbench page.
+Other plug-ins may contribute actions or views to the perspective which appear when the perspective is selected.
+Optional additions by other plug-ins are appended to the initial definition.
+
+\subsection BlueBerryExtPointsIndex_Workbench_PerspExt_ConfMarkup Configuration Markup
+
+\code{.unparsed}
+<!ELEMENT extension (perspectiveExtension*)>
+<!ATTLIST extension
+ point CDATA #REQUIRED
+ id CDATA #IMPLIED
+ name CDATA #IMPLIED>
+\endcode
+
+- <tt>point</tt>: a fully qualified identifier of the target extension point
+- <tt>id</tt>: an optional identifier of the extension instance
+- <tt>name</tt>: an optional name of the extension instance
+
+\code{.unparsed}
+<!ELEMENT perspectiveExtension (actionSet | viewShortcut | perspectiveShortcut | newWizardShortcut | view | showInPart | hiddenMenuItem | hiddenToolBarItem)*>
+<!ATTLIST perspectiveExtension
+ targetID IDREF #REQUIRED>
+\endcode
+
+- <tt>targetID</tt>: the unique identifier of the perspective (as specified in the registry) into which the contribution is made. If the value is set to "*" the extension is applied to all perspectives.
+
+\code{.unparsed}
+<!ELEMENT actionSet EMPTY>
+<!ATTLIST actionSet
+ id IDREF #REQUIRED>
+\endcode
+
+- <tt>id</tt>: the unique identifier of the action set which will be added to the perspective.
+
+\code{.unparsed}
+<!ELEMENT viewShortcut EMPTY>
+<!ATTLIST viewShortcut
+ id IDREF #REQUIRED>
+\endcode
+
+- <tt>id</tt>: the unique identifier of the view which will be added to the perspective's "Show View" submenu of the "Window" menu.
+
+\code{.unparsed}
+<!ELEMENT perspectiveShortcut EMPTY>
+<!ATTLIST perspectiveShortcut
+ id IDREF #REQUIRED>
+\endcode
+
+- <tt>id</tt>: the unique identifier of the perspective which will be added to the perspective's "Open Perspective" submenu of the "Window" menu.
+
+\code{.unparsed}
+<!ELEMENT newWizardShortcut EMPTY>
+<!ATTLIST newWizardShortcut
+ id IDREF #REQUIRED>
+\endcode
+
+- <tt>id</tt>: the unique identifier of the new wizard which will be added to the perspective's "New" submenu of the "File" menu.
+
+\code{.unparsed}
+<!ELEMENT showInPart EMPTY>
+<!ATTLIST showInPart
+ id IDREF #IMPLIED>
+\endcode
+
+- <tt>id</tt>: the unique identifier of the view which will be added to the perspective's "Show In..." prompter in the Navigate menu.
+
+\code{.unparsed}
+<!ELEMENT view EMPTY>
+<!ATTLIST view
+ id IDREF #REQUIRED
+ relative IDREF #IMPLIED
+ relationship (stack|left|right|top|bottom|fast)
+ ratio CDATA #IMPLIED
+ visible (true | false)
+ closeable (true | false)
+ moveable (true | false)
+ standalone (true | false)
+ showTitle (true | false)
+ minimized (true | false) "false">
+\endcode
+
+- <tt>id</tt>: the unique identifier of the view which will be added to the perspective layout.
+- <tt>relative</tt>: the unique identifier of a view which already exists in the perspective. This will be used as a reference point for placement of the view. The relationship between these two views is defined by \c relationship . Ignored if relationship is "fast".
+- <tt>relationship</tt>: specifies the relationship between \c id and \c relative . The following values are supported:
+ - <tt>fast</tt>: the view extension will be created as a fast view.
+ - <tt>stack</tt>: the view extension will be stacked with the relative view in a folder.
+ - <tt>left, right, top, bottom</tt>: the view extension will be placed beside the relative view. In this case a \c ratio must also be defined.
+- <tt>ratio</tt>: the percentage of area within the relative view which will be donated to the view extension. If the view extension is a fast view, the ratio is the percentage of the workbench the fast view will cover when active. This must be defined as a floating point value and lie between 0.05 and 0.95.
+- <tt>visible</tt>: whether the view is initially visible when the perspective is opened. This attribute should have a value of "true" or "false" if used. If this attribute is not used, the view will be initially visible by default.
+- <tt>closeable</tt>: whether the view is closeable in the target perspective. This attribute should have a value of "true" or "false" if used. If this attribute is not used, the view will be closeable, unless the perspective itself is marked as fixed.
+- <tt>moveable</tt>: whether the view is moveable. A non-moveable view cannot be moved either within the same folder, or moved between folders in the perspective. This attribute should have a value of "true" or "false" if used. If this attribute is not used, the view will be moveable, unless the perspective itself is marked as fixed.
+- <tt>standalone</tt>: whether the view is a standalone view. A standalone view cannot be docked together with others in the same folder. This attribute should have a value of "true" or "false" if used. This attribute is ignored if the relationship attribute is "fast" or "stacked". If this attribute is not used, the view will be a regular view, not a standalone view (default is "false").
+- <tt>showTitle</tt>: whether the view's title is shown. This attribute should have a value of "true" or "false" if used. This attribute only applies to standalone views. If this attribute is not used, the view's title will be shown (default is "true").
+- <tt>minimized</tt>: If the perspective extension will result in a new view stack being created (i.e. the 'relationship' attribute is one of left, right, top or bottom) this field determines the new stack's initial display state.
+
+\code{.unparsed}
+<!ELEMENT hiddenMenuItem EMPTY>
+<!ATTLIST hiddenMenuItem
+ id CDATA #REQUIRED>
+\endcode
+
+- <tt>id</tt>: The unique identifier of the Command which is to be removed from the menu. <b>WARNING:</b> This is considered to be a 'Product level' extension and should not be used in consumable plugins without great care.
+
+\code{.unparsed}
+<!ELEMENT hiddenToolBarItem EMPTY>
+<!ATTLIST hiddenToolBarItem
+ id CDATA #REQUIRED>
+\endcode
+
+- <tt>id</tt>: The unique identifier of the Command which is to be removed from thetoolbar. <b>WARNING:</b> This is considered to be a 'Product level' extension and should not be used in consumable plugins without great care.
+
+\subsection BlueBerryExtPointsIndex_Workbench_PerspExt_Examples Examples
+
+The following is an example of a perspective extension (note the subelements and the way attributes are used):
+
+\code{.unparsed}
+<extension point="org.blueberry.ui.perspectiveExtensions">
+ <perspectiveExtension
+ targetID="org.blueberry.ui.resourcePerspective">
+ <actionSet id="org.xyz.MyActionSet"/>
+ <viewShortcut id="org.xyz.views.PackageExplorer"/>
+ <newWizardShortcut id="org.xyz.wizards.NewProjectCreationWizard"/>
+ <perspectiveShortcut id="org.xyz.MyPerspective"/>
+ <view id="org.xyz.views.PackageExplorer"
+ relative="org.blueberry.ui.views.ResourceNavigator"
+ relationship="stack"/>
+ <view id="org.xyz.views.TypeHierarchy"
+ relative="org.blueberry.ui.views.ResourceNavigator"
+ relationship="left"
+ ratio="0.50"/>
+ </perspectiveExtension>
+</extension>
+\endcode
+
+In the example above, an action set, view shortcut, new wizard shortcut, and perspective shortcut are contributed to the initial contents of the Resource Perspective.
+In addition, the Package Explorer view is stacked on the Resource Navigator and the Type Hierarchy View is added beside the Resource Navigator.
+
+\section BlueBerryExtPointsIndex_Workbench_Persp Perspectives
+
+\subsection BlueBerryExtPointsIndex_Workbench_Persp_Id Identifier
+
+\c org.blueberry.ui.perspective
+
+\subsection BlueBerryExtPointsIndex_Workbench_Persp_Desc Description
+
+This extension point is used to add perspective factories to the workbench.
+A perspective factory is used to define the initial layout and visible action sets for a perspective.
+The user can select a perspective by invoking the "Open Perspective" submenu of the "Window" menu.
+
+\subsection BlueBerryExtPointsIndex_Workbench_Persp_ConfMarkup Configuration Markup
+
+\code{.unparsed}
+<!ELEMENT extension (perspective*)>
+<!ATTLIST extension
+ point CDATA #REQUIRED
+ id CDATA #IMPLIED
+ name CDATA #IMPLIED>
+\endcode
+
+- <tt>point</tt>: a fully qualified identifier of the target extension point
+- <tt>id</tt>: an optional identifier of the extension instance
+- <tt>name</tt>: an optional name of the extension instance
+
+\code{.unparsed}
+<!ELEMENT perspective (description? , keywordReference*)>
+<!ATTLIST perspective
+ id CDATA #REQUIRED
+ name CDATA #REQUIRED
+ class CDATA #REQUIRED
+ icon CDATA #IMPLIED
+ fixed (true | false)>
+\endcode
+
+- <tt>id</tt>: a unique name that will be used to identify this perspective.
+- <tt>name</tt>: a translatable name that will be used in the workbench window menu bar to represent this perspective.
+- <tt>class</tt>: a fully qualified name of the class that implements berry::IPerspectiveFactory interface.
+- <tt>icon</tt>: a relative name of the icon that will be associated with this perspective.
+- <tt>fixed</tt>: indicates whether the layout of the perspective is fixed. If true, then views created by the perspective factory are not closeable, and cannot be moved. The default is false.
+
+\code{.unparsed}
+<!ELEMENT description (#PCDATA)>
+\endcode
+
+An optional subelement whose body should contain text providing a short description of the perspective.
+
+\subsection BlueBerryExtPointsIndex_Workbench_Persp_Examples Examples
+
+The following is an example of a perspective extension:
+
+\code{.unparsed}
+<extension
+ point="org.blueberry.ui.perspectives">
+ <perspective
+ id="org.blueberry.ui.resourcePerspective"
+ name="Resource"
+ class="berry::ResourcePerspective"
+ icon="resources/MyIcon.gif">
+ </perspective>
+</extension>
+\endcode
+
+\subsection BlueBerryExtPointsIndex_Workbench_Persp_SupplImpl Supplied Implementation
+
+The workbench provides a "Resource Perspective".
+Additional perspectives may be added by plug-ins.
+They are selected using the "Open Perspective" submenu of the "Window" menu.
+
+\section BlueBerryExtPointsIndex_Workbench_PrefPages Preference Pages
+
+\subsection BlueBerryExtPointsIndex_Workbench_PrefPages_Id Identifier
+
+\c org.blueberry.ui.preferencePages
+
+\subsection BlueBerryExtPointsIndex_Workbench_PrefPages_Desc Description
+
+The workbench provides one common dialog box for preferences.
+The purpose of this extension point is to allow plug-ins to add pages to the preference dialog box.
+When preference dialog box is opened (initiated from the menu bar), pages contributed in this way will be added to the dialog box.
+
+\subsection BlueBerryExtPointsIndex_Workbench_PrefPages_ConfMarkup Configuration Markup
+
+\code{.unparsed}
+<!ELEMENT extension (page*)>
+<!ATTLIST extension
+ point CDATA #REQUIRED
+ id CDATA #IMPLIED
+ name CDATA #IMPLIED>
+\endcode
+
+- <tt>point</tt>: a fully qualified identifier of the target extension point
+- <tt>id</tt>: an optional identifier of the extension instance
+- <tt>name</tt>: an optional name of the extension instance
+
+\code{.unparsed}
+<!ELEMENT page (keywordReference*)>
+<!ATTLIST page
+ id CDATA #REQUIRED
+ name CDATA #REQUIRED
+ class CDATA #REQUIRED
+ category IDREF #IMPLIED>
+\endcode
+
+- <tt>id</tt>: a unique name that will be used to identify this page.
+- <tt>name</tt>: a translatable name that will be used in the UI for this page.
+- <tt>class</tt>: a name of the fully qualified class that implements berry::IWorkbenchPreferencePage.
+- <tt>category</tt>: a path indicating the location of the page in the preference tree. The path may either be a parent node ID or a sequence of IDs separated by '/', representing the full path from the root node.
+
+\code{.unparsed}
+<!ELEMENT keywordReference EMPTY>
+<!ATTLIST keywordReference
+ id IDREF #REQUIRED>
+\endcode
+
+A reference by a preference page to a keyword. See the keywords extension point.
+
+- <tt>id</tt>: The id of the keyword being referred to.
+
+\subsection BlueBerryExtPointsIndex_Workbench_PrefPages_Examples Examples
+
+The following is an example for the preference extension point:
+
+\code{.unparsed}
+<extension
+ point="org.blueberry.ui.preferencePages">
+ <page
+ id="com.xyz.prefpage1"
+ name="XYZ"
+ class="xyz::PrefPage1">
+ <keywordReference id="xyz.Keyword"/>
+ </page>
+ <page
+ id="com.xyz.prefpage2"
+ name="Keyboard Settings"
+ class="xyz::PrefPage2"
+ category="com.xyz.prefpage1">
+ </page>
+</extension>
+\endcode
+
+\subsection BlueBerryExtPointsIndex_Workbench_PrefPages_SupplImpl Supplied Implementation
+
+The workbench adds several pages for setting the preferences of the platform. Pages registered through this extension will be added after them according to their category information.
+
+\section BlueBerryExtPointsIndex_Workbench_PresFact Presentation Factories
+
+\subsection BlueBerryExtPointsIndex_Workbench_PresFact_Id Identifier
+
+\c org.blueberry.ui.presentationFactories
+
+\subsection BlueBerryExtPointsIndex_Workbench_PresFact_Desc Description
+
+This extension point is used to add presentation factories to the workbench. A presentation factory defines the overall look and feel of the workbench, including how views and editors are presented.
+
+\subsection BlueBerryExtPointsIndex_Workbench_PresFact_ConfMarkup Configuration Markup
+
+\code{.unparsed}
+<!ELEMENT extension (factory*)>
+<!ATTLIST extension
+ point CDATA #REQUIRED
+ id CDATA #IMPLIED
+ name CDATA #IMPLIED>
+\endcode
+
+\code{.unparsed}
+<!ELEMENT factory EMPTY>
+<!ATTLIST factory
+ class CDATA #REQUIRED
+ id CDATA #REQUIRED
+ name CDATA #REQUIRED>
+\endcode
+
+- <tt>class</tt>: Specify the fully qualified class to be used for the presentation factory. The specified value must implement the interface berry::IPresentationFactory.
+- <tt>id</tt>: a unique name that will be used to identify this presentation factory
+- <tt>name</tt>: a translatable name that can be used to show this presentation factory in the UI
+
+\subsection BlueBerryExtPointsIndex_Workbench_PresFact_Examples Examples
+
+The following is an example of a presentationFactory extension:
+
+\code{.unparsed}
+<extension point="org.blueberry.ui.presentationFactories">
+ <factory
+ class="berry::ExampleWorkbenchPresentationFactory"/>
+</extension>
+\endcode
+
+\subsection BlueBerryExtPointsIndex_Workbench_PresFact_SupplImpl Supplied Implementation
+
+If a presentation factory is not specified or is missing then the implementation in berry::QtWorkbenchPresentationFactory will be used.
+
+\section BlueBerryExtPointsIndex_Workbench_Services Services
+
+\subsection BlueBerryExtPointsIndex_Workbench_Services_Id Identifier
+
+\c org.blueberry.ui.services
+
+\subsection BlueBerryExtPointsIndex_Workbench_Services_Desc Description
+
+Define service factories so that services can be contributed declaratively and will be available through berry::IServiceLocator::GetService(Class).
+The implementation of \c AbstractServiceFactory must be able to return a global service and multiple child services (if applicable).
+
+\subsection BlueBerryExtPointsIndex_Workbench_Services_ConfMarkup Configuration Markup
+
+\code{.unparsed}
+<!ELEMENT extension (serviceFactory? , sourceProvider?)+>
+<!ATTLIST extension
+ point CDATA #REQUIRED
+ id CDATA #IMPLIED
+ name CDATA #IMPLIED>
+\endcode
+
+Contribute services to the workbench.
+
+\code{.unparsed}
+<!ELEMENT serviceFactory (service+)>
+<!ATTLIST serviceFactory
+ factoryClass CDATA #REQUIRED>
+\endcode
+
+Match a service interface to a factory that can supply a hierachical implementation of that service.
+
+- <tt>factoryClass</tt>: The factory that extends \c AbstractServiceFactory and can create the implementation for the \c serviceClass.
+
+\code{.unparsed}
+<!ELEMENT service EMPTY>
+<!ATTLIST service
+ serviceClass CDATA #IMPLIED>
+\endcode
+
+A service this factory can provide.
+
+- <tt>serviceClass</tt>: The interface that represents a service contract.
+
+\code{.unparsed}
+<!ELEMENT sourceProvider (variable+)>
+<!ATTLIST sourceProvider
+ provider CDATA #REQUIRED>
+\endcode
+
+A Source Provider supplies source variables to the IEvaluationService. It can also notify the IEvaluationService when one or more of the variables change.
+
+- <tt>provider</tt>: This class must provide variables and call the appropriate \c fireSourceChanged(*) method when any of the variables change.
+
+\code{.unparsed}
+<!ELEMENT variable EMPTY>
+<!ATTLIST variable
+ name CDATA #REQUIRED
+ priorityLevel (workbench|activeContexts|activeShell|activeWorkbenchWindow|activeEditorId|activePartId|activeSite) >
+\endcode
+
+A source variable from this provider.
+A source provider must declare all variables that it provides.
+
+- <tt>name</tt>: The name of a contributed source variable. It is a good practice to prepend the plugin id to the variable name to avoid collisions with other source providers.
+- <tt>priorityLevel</tt>: For conflict resolution used by services like the \c IHandlerService , contributed source variables must assign a priority. workbench is the global default priority. See \c ISources for relative priority information.
+
+\subsection BlueBerryExtPointsIndex_Workbench_Services_Examples Examples
+
+Here is a basic definition:
+
+\code{.unparsed}
+<extension point="org.blueberry.ui.services">
+ <serviceFactory factoryClass="my::LevelServiceFactory">
+ <service serviceClass="my::ILevelService">
+ </service>
+ </serviceFactory>
+</extension>
+\endcode
+
+The LevelServiceFactory can return an ILevelService when it is requested from the IServiceLocator:
+
+\code{.unparsed}
+berry::ILevelService::Pointer s = GetSite()->GetService(my::ILevelService::GetStaticClassName());
+std::cout << s->GetLevel();
+\endcode
+
+In this test example, the factory would instantiate three \c ILevelService implementations during the first call to \c GetSite()->GetService(*) . The global one in the workbench, one for the workbench window, and one for the site.
+
+\section BlueBerryExtPointsIndex_Workbench_Tweak Tweaklets
+
+\subsection BlueBerryExtPointsIndex_Workbench_Tweak_Id Identifier
+
+\c org.blueberry.ui.tweaklets
+
+\subsection BlueBerryExtPointsIndex_Workbench_Tweak_Desc Description
+
+Typically, although not required, the value of the \c definition attribute is the fully qualified name without colons of an abstract class defined by the workbench, and the value of the \c implementation attribute is the fully qualified name of a non-abstract class provided by the extending plug-in.
+
+\subsection BlueBerryExtPointsIndex_Workbench_Tweak_ConfMarkup Configuration Markup
+
+\code{.unparsed}
+<!ELEMENT extension (tweaklet)*>
+<!ATTLIST extension
+ point CDATA #REQUIRED
+ id CDATA #IMPLIED
+ name CDATA #IMPLIED>
+\endcode
+
+\code{.unparsed}
+<!ELEMENT tweaklet EMPTY>
+<!ATTLIST tweaklet
+ id CDATA #REQUIRED
+ name CDATA #REQUIRED
+ description CDATA #IMPLIED
+ definition CDATA #IMPLIED
+ implementation CDATA #IMPLIED>
+\endcode
+
+- <tt>id</tt>: a unique name that will be used to identify this tweaklet
+- <tt>name</tt>: a translatable name that will be used in the UI for this tweaklet
+- <tt>description</tt>: a translatable short description of this tweaklet, to be used in the UI
+- <tt>definition</tt>: an identifier of the tweaklet definition in the workbench, typically a fully qualified type name without colons
+- <tt>implementation</tt>: an identifier of the tweaklet implementation provided by the extender, typically a fully qualified class name
+
+\subsection BlueBerryExtPointsIndex_Workbench_Tweak_SupplImpl Supplied Implementation
+
+Tweaklets are usually used to specialize the workbench for a specific GUI toolkit.
+
+\section BlueBerryExtPointsIndex_Workbench_Views Views
+
+\subsection BlueBerryExtPointsIndex_Workbench_Views_Id Identifier
+
+\c org.blueberry.ui.views
+
+\subsection BlueBerryExtPointsIndex_Workbench_Views_Desc Description
+
+This extension point is used to define additional views for the workbench.
+A view is a visual component within a workbench page.
+It is typically used to navigate a hierarchy of information (like the workspace), open an editor, or display properties for the active editor.
+The user can make a view visible from the Window > Show View menu or close it from the view local title bar.
+
+In order to reduce the visual clutter in the Show View Dialog, views should be grouped using categories.
+
+\subsection BlueBerryExtPointsIndex_Workbench_Views_ConfMarkup Configuration Markup
+
+\code{.unparsed}
+<!ELEMENT extension (category | view | stickyView)*>
+<!ATTLIST extension
+ point CDATA #REQUIRED
+ id CDATA #IMPLIED
+ name CDATA #IMPLIED>
+\endcode
+
+- <tt>point</tt>: a fully qualified identifier of the target extension point
+- <tt>id</tt>: an optional identifier of the extension instance
+- <tt>name</tt>: an optional name of the extension instance
+
+\code{.unparsed}
+<!ELEMENT category EMPTY>
+<!ATTLIST category
+ id CDATA #REQUIRED
+ name CDATA #REQUIRED
+ parentCategory IDREF #IMPLIED>
+\endcode
+
+- <tt>id</tt>: a unique name that will be used to identify this category
+- <tt>name</tt>: a translatable name that will be used in the UI for this category
+- <tt>parentCategory</tt>: an optional path composed of category IDs separated by '/'. This allows the creation of a hierarchy of categories.
+
+\code{.unparsed}
+<!ELEMENT view (description? , keywordReference*)>
+<!ATTLIST view
+ id CDATA #REQUIRED
+ name CDATA #REQUIRED
+ category IDREF #IMPLIED
+ class CDATA #REQUIRED
+ icon CDATA #IMPLIED
+ fastViewWidthRatio CDATA #IMPLIED
+ allowMultiple (true | false)
+ restorable (true | false) "true">
+\endcode
+
+- <tt>id</tt>: a unique name that will be used to identify this view
+- <tt>name</tt>: a translatable name that will be used in the UI for this view
+- <tt>category</tt>: an optional attribute that is composed of the category IDs separated by '/'. Each referenced category must be declared in a corresponding category element.
+- <tt>class</tt>: a fully qualified name of the class that implements berry::IViewPart. A common practice is to subclass berry::ViewPart or berry::QtViewPart in order to inherit the default functionality.
+- <tt>icon</tt>: a relative name of the icon that will be associated with the view.
+- <tt>fastViewWidthRatio</tt>: the percentage of the width of the workbench that the view will take up as an active fast view. This must be defined as a floating point value and lie between 0.05 and 0.95. If no value is supplied, a default ratio will be used.
+- <tt>allowMultiple</tt>: flag indicating whether this view allows multiple instances to be created using IWorkbenchPage::ShowView(QString id, QString secondaryId). The default is false.
+- <tt>restorable</tt>: flag indicating whether this view allows to be restored upon workbench restart. If set to false, the view will not be open after a workbench restart. The default is true.
+
+\code{.unparsed}
+<!ELEMENT description (#PCDATA)>
+\endcode
+
+An optional subelement whose body should contain text providing a short description of the view.
+
+\code{.unparsed}
+<!ELEMENT stickyView EMPTY>
+<!ATTLIST stickyView
+ id IDREF #REQUIRED
+ location (RIGHT|LEFT|TOP|BOTTOM)
+ closeable (true | false)
+ moveable (true | false)>
+\endcoe
+
+A sticky view is a view that will appear by default across all perspectives in a window once it is opened.
+Its initial placement is governemed by the location attribute, but nothing prevents it from being moved or closed by the user.
+Use of this element will only cause a placeholder for the view to be created, it will not show the view.
+Please note that usage of this element should be done with great care and should only be applied to views that truely have a need to live across perspectives.
+
+- <tt>id</tt>: the id of the view to be made sticky.
+- <tt>location</tt>: optional attribute that specifies the location of the sticky view relative to the editor area. If absent, the view will be docked to the right of the editor area.
+- <tt>closeable</tt>: optional attribute that specifies wether the view should be closeable. If absent it will be closeable.
+- <tt>moveable</tt>: optional attribute that specifies wether the view should be moveable. If absent it will be moveable.
+
+\subsection BlueBerryExtPointsIndex_Workbench_Views_Examples Examples
+
+The following is an example of the extension point:
+
+\code{.unparsed}
+<extension point="org.blueberry.ui.views">
+ <category
+ id="com.xyz.views.XYZviews"
+ name="XYZ"/>
+ <view
+ id="com.xyz.views.XYZView"
+ name="XYZ View"
+ category="com.xyz.views.XYZviews"
+ class="ns::XYZView"
+ icon="icons/XYZ.gif"/>
+</extension>
+\endcode
+
+The following is an example of a sticky view declaration:
+
+\code{.unparsed}
+<extension point="org.blueberry.ui.views">
+ <stickyView id="com.xyz.views.XYZView" />
+</extension>
+\endcode
+
+\subsection BlueBerryExtPointsIndex_Workbench_Views_SupplImpl Supplied Implementation
+
+The BlueBerry Platform provides a number of standard views.
+From the user point of view, these views are no different from any other view provided by the plug-ins.
+All the views can be shown from the "Show View" submenu of the "Window" menu.
+The position of a view is persistent: it is saved when the view is closed and restored when the view is reopened in a single session.
+The position is also persisted between workbench sessions.
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Application/Deployment.dox b/Documentation/Doxygen/3-DeveloperManual/Application/Deployment.dox
index 08686e7347..c911f7370d 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Application/Deployment.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Application/Deployment.dox
@@ -1,49 +1,49 @@
/**
\page DeploymentPage Deploying MITK
\section DeploymentPageIntroduction Introduction
<ul>
<li> easily create portable or installable versions of your MITK-based applications.
<li> created packages include all MITK and 3rd party libraries necessary for running the application on other systems
<li> distribute your binary application to other people without giving them your source code or putting them in the need for setting up a development environment themselves, eg for evaluation of your tool.
</ul>
\note This does not install the MITK headers (like an SDK). If you want to develop applications based on MITK you still have to compile MITK yourself.
\section DeploymentPagePlatform Platform specific notes
\subsection DeploymentPagePlatformLinux Linux
You can create a tarball (.tar.gz) of your MITK application which includes all necessary non-system libraries by following these steps:
<ul>
<li> Set the %CMake Variable CMAKE_BUILD_TYPE to either "Debug" or "Release". Any other type (or leaving the variable empty) will not work.
<li> If you are using third-pary libraries not shipped with MITK, you might need to add the paths to the third-party libs to your LD_LIBRARY_PATH environment variable (not necessary if you use RPATH in your shared libraries).
<li> Type "make package" in your build-tree. This will create a tarball in your build-tree directory.
</ul>
\note Libraries in system locations (/lib/, /lib32/, /lib64/, /usr/lib/, /usr/lib32/,/usr/lib64/, and /usr/X11R6/) will not be included in the tarball. If you want to distribute Qt (for example), you have to do a custom Qt installation outside of these directories.
\subsection DeploymentPagePlatformWindows Windows
-You can create a Zip file (.zip) or an NSIS 2 installer (needs an installation of <a href="http://nsis.sourceforge.net/Main_Page">NSIS</a>) for Windows platforms. Only "Release" builds are supported during packaging, the results of trying to package "Debug" builds are undefined.
+You can create a Zip file (.zip) or an NSIS 3 installer (needs an installation of <a href="https://nsis.sourceforge.io/">NSIS</a>) for Windows platforms. Only "Release" builds are supported during packaging, the results of trying to package "Debug" builds are undefined.
<ul>
<li> In Visual Studio, build the "PACKAGE" project, this will create a .zip file and a .exe NSIS installer (if NSIS is installed).
</ul>
On some systems, it might still be necessary to install the Microsoft Visual C++ Redistributable Package to start the installed application successfully.
\note It is possible to include the Microsoft Visual C++ Redistributable Package in the application installer.\n
A CMake variable "CMAKE_(Your Visual Studio Version)_REDISTRIBUTABLE" will be created. It has to be set to the appropriate executable (vcredist_x86.exe or vcredist_x64.exe), which will then be part of both the NSIS installer and the ZIP Archive.\n
In the case of the NSIS installer it will be automatically run if no appropriate redistributable is present on the target system.\n
Please note that it is <b>not</b> possible to automatically check the provided redistributable matches the Visual Studio version used to build the installer.
\subsection DeploymentPagePlatformMacOS macOS
You can create a drag'n drop disk image (.dmg) file for macOS. The procedure is pretty much the same as for Linux.
\note On macOS, libraries in system locations as pointed out in the Linux section \b and libraries located in /System/Library will not be copied. If you want to distribute any libraries from these locations, you have to install them somewhere else prior to configuring your MITK build.
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Application/ExtensionPointReference.dox b/Documentation/Doxygen/3-DeveloperManual/Application/ExtensionPointReference.dox
index eb658dd2a1..e324ea7885 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Application/ExtensionPointReference.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Application/ExtensionPointReference.dox
@@ -1,21 +1,64 @@
/**
\page mitkExtPointsIndex MITK Extension-Point Reference
-<center>
- <h1>MITK Extension Points</h1>
-</center>
+- \subpage mitkExtPointsIndex_InputDevices
-The following extension points can be used to extend the capabilities
-of MITK Plugins:
+\page mitkExtPointsIndex_InputDevices Input Devices
+\tableofcontents
-<h3>Input Devices</h3>
-<ul>
-<li>\subpage xp_org_mitk_core_ext_inputdevices
-</ul>
+\section mitkExtPointsIndex_InputDevices_Identifier Identifier
-\page xp_org_mitk_core_ext_inputdevices org.mitk.core.ext.inputdevices
-\htmlinclude org_mitk_core_ext_inputdevices.html
+\c org.mitk.core.ext.inputdevices
+
+\section mitkExtPointsIndex_InputDevices_Description Description
+
+This extension point is used to define additional input devices.
+
+\section mitkExtPointsIndex_InputDevices_ConfigurationMarkup Configuration Markup
+
+\code{.unparsed}
+<!ELEMENT extension (inputdevice*)>
+<!ATTLIST extension
+ point CDATA #REQUIRED
+ id CDATA #IMPLIED
+ name CDATA #IMPLIED>
+\endcode
+
+- <tt>point</tt>: a fully qualified identifier of the target extension point
+- <tt>id</tt>: an optional identifier of the extension instance
+- <tt>name</tt>: an optional name of the extension instance
+
+\code{.unparsed}
+<!ELEMENT inputdevice (description?)>
+<!ATTLIST inputdevice
+ id CDATA #REQUIRED
+ name CDATA #IMPLIED
+ class CDATA #REQUIRED>
+\endcode
+
+- <tt>id</tt>: the identifier of the input device
+- <tt>name</tt>: an optional name of the input device
+- <tt>class</tt>: a fully qualified name of the class that implements mitk::IInputDevice.
+
+\code{.unparsed}
+<!ELEMENT description (#PCDATA)>
+\endcode
+
+An optional subelement whose body should contain text providing a short description of the input device.
+
+\section mitkExtPointsIndex_InputDevices_Examples Examples
+
+\code{.unparsed}
+<extension point="org.mitk.core.ext.inputdevices">
+ <inputdevice
+ id="com.xyz.inputdevice.XYZDevice"
+ name="XYZ Device"
+ class="ns::XYZDevice">
+ <description>My new 20-dimensional input device</description>
+ </inputdevice>
+</extension>
+\endcode
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Concepts/DICOMTesting.dox b/Documentation/Doxygen/3-DeveloperManual/Concepts/DICOMTesting.dox
index b16019d910..c9cacceb51 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Concepts/DICOMTesting.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Concepts/DICOMTesting.dox
@@ -1,154 +1,154 @@
/**
\page DICOMTesting MITK DICOM testing
\section DICOMTesting_introduction Introduction
Reading DICOM data into mitk::Images is a complicated business since DICOM and MITK have very different ideas of images.
DICOMITKSeriesGDCMReader (formerly: DicomSeriesReader) brings DICOM and MITK as close together as possible by offering methods to load DICOM CT and MR images
into mitk::Images, optionally grouping slices to 3D+t images.
Since there are so many possible sources for mistakes with any change to this loading process, testing the many
assumptions implemented in DICOMITKSeriesGDCMReader is worthwhile. This document describes what and how theses kind of tests are implemented.
\section DICOMTesting_problem Problem description
The task of loading DICOM files into mitk::Images is a challenge because of major differences
in the way that DICOM and MITK represent images:
- DICOM images
+ are mostly stored as one slice per file
+ do not describe how they can be arraged into image stacks with orthogonal axis
+ sometimes they cannot be arranged in image stacks as described above (e.g. tilted gantry)
- mitk::Image (at least its mature areas)
+ represents image stacks with orthogonal axis (nothing like a tilted gantry)
+ have a concept of a fourth dimension (time steps)
Because image processing applications based on MITK still need a way to load DICOM images into
mitk::Image objects, MITK needs a way to build image stacks and this needs to be well tested.
For more background information, see David Clunie's most valuable posts on comp.protocols.dicom, e.g.:
- - http://groups.google.com/group/comp.protocols.dicom/browse_thread/thread/6db91972e161f0d4/6e0304ac264a6eb5
- - http://groups.google.com/group/comp.protocols.dicom/browse_thread/thread/e9bd1497bea3e66b/187a7dc8810613d2
- - http://groups.google.com/group/comp.protocols.dicom/browse_thread/thread/5d80bb0b7fafcb81/cf96119e3b024ed8
- - http://groups.google.com/group/comp.protocols.dicom/browse_thread/thread/4568635e083a3fba/e2a8ceec23032601
+ - https://groups.google.com/g/comp.protocols.dicom/c/bbkZcuFh8NQ
+ - https://groups.google.com/g/comp.protocols.dicom/c/6b0Ul76j5ms
+ - https://groups.google.com/g/comp.protocols.dicom/c/XYC7C3-vy4E
+ - https://groups.google.com/g/comp.protocols.dicom/c/RWhjXgg6P7o
\section DICOMTesting_testidea Test principle
The general idea for DICOM loaing tests is to run a set of known DICOM files through DICOMITKSeriesGDCMReader's methods
GetSeries() and LoadDicomSeries() to generate mitk::Images. These images are then compared to expected image properties,
such as the number of individual mitk::Images, positions, orientations, spacings, etc.
Stored expectations look like this (should be self-explanatory):
\verbatim
-- Image 1
Pixeltype: s
BitsPerPixel: 16
Dimension: 4
Dimensions: 64 64 6 1
Geometry:
Matrix: 5.25 0 0 0 5.2468 0.139598 0 -0.183222 3.99757
Offset: -159.672 -309.974 -69.0122
Center: 0 0 0
Translation: -159.672 -309.974 -69.0122
Scale: 1 1 1
Origin: -159.672 -309.974 -69.0122
Spacing: 5.25 5.25 4
TimeBounds: 0 1
-- Image 2
Pixeltype: s
BitsPerPixel: 16
Dimension: 4
Dimensions: 64 64 41 1
Geometry:
Matrix: 5.25 0 0 0 5.25 0 0 0 4
Offset: -160.672 -311.672 -285
Center: 0 0 0
Translation: -160.672 -311.672 -285
Scale: 1 1 1
Origin: -160.672 -311.672 -285
Spacing: 5.25 5.25 4
TimeBounds: 0 1
\endverbatim
\section DICOMTesting_implementation Implementation
\section DICOMTesting_implementation_utils Test helpers (applications and classes)
<b>Application DumpDICOMMitkImage</b>
Takes a list of DICOM images, loads them using TestDICOMLoading, then dumps information
about the resulting mitk::Images to standard output.
This application is helpful when defining reference data for tests.
<b>Application VerifyDICOMMitkImageDump</b>
Takes a list of DICOM images and loads them using TestDICOMLoading.
Takes a dump file as generated by DumpDICOMMitkImage, parses it and
compares it to actually generated mitk::Images.
This application is used to implement the majority of test cases. They all
load images, then verify the expected result structure.
<b>Class TestDICOMLoading</b>
\section PageDICOMLoadingTests_testcaseimplementation Test case implementation
Individual test cases are stored in the MITK-Data repository and constructed by Core/Code/Testing/DICOMTesting/Testing/CMakeLists.txt
The CMake file parses given directories for subdirectories containing specific test cases. Each directory contains two files:
- File "input": lists DICOM files that should be loaded for this test case
- File "expected.dump": contains the image properties in the above mentioned dump format
Each test case is translated into a CTest test which evaluates the return value of a call to VerifyDICOMMitkImageDump.
\section PageDICOMLoadingTests_testcases Implemented test cases
From test set \b TinyCTAbdomen (see description.txt in this directory for details on test images):
- singleslice : just a single slice (should work and contain meaningful spacing)
- two_slices : two slices, spacing should be calculated correctly
- all : load a "normal" series as a single 3D block
- 3D_and_T : load a small set of slices with multiple time-steps
- diff_orientation : load a set of files containing two differently oriented image blocks; at least two images (110,111) have minor errors in small decimal digits
- diff_orientation_gaps : load a set of files containing two differently oriented image blocks, each missing slices, so blocks must be split
- diff_spacing : load a set of files containint two set of slices with different spacings
- gap : load slices that cannot form a single 3D block, because single slices are missing
- gaps : slices missing in differnt locations, so multiple splits needed
- unsorted_gaps : as before, just file names are unsorted
- single_negative_spacing : from reported bug related to single MR images with misleading spacing information
- tilted_gantry : slice origins do not align along first slice normal (happens with tilted gantries)
- interleaved : two volumes of slices with origins along the same line. The volumes' slices interleave in their border region. This test is meant to correctly sort apart the two blocks instead of generating many two-slices groups in the interleaved region.
- CR-MONO1-10-chest-spacing-none : CR image without spacing information - (1.0, 1.0) should be assumed
- CR-MONO1-10-chest-spacing-pixelspacing : CR image with only "Pixel Spacing" tag - this should be used as spacing
- CR-MONO1-10-chest-spacing-imagerpixelspacing : CR image with only "Imager Pixel Spacing" tag - this should be used as spacing
- CR-MONO1-10-chest-spacing-calibrated : CR image with BOTH "Imager Pixel Spacing" and "Pixel Spacing" defined - "Pixel Spacing" should be used
- OT-MONO2-8-colon : Secondary Capture image with gray value pixels - should be loaded
- OT-PAL-8-face : Secondary Capture image with PALETTE pixel values - can be loaded, but display is not correct yet
From test set \b TiltHead (see description.txt in this directory for details on test images):
- head_ct_tilt : load a series with gantry tilt and check its orientation
\section DICOMTesting_othertests Specific other tests
This list is meant to provide an up-to-date list of all implemented DICOM loading tests.
<b>If you ever find this outdated, please update it or make the persons who invalidated the list update it.</b>
<b>mitkDICOMTestingSanityTest_*</b>
These tests implement basic testing of the implemented helper classes. The tests use DICOMITKSeriesGDCMReader to load
a number of DICOM image. They verify:
- DICOMITKSeriesGDCMReader recognizes all input files as DICOM images
- DICOMITKSeriesGDCMReader generates a number of mitk::Images from the DICOM images
- the number of mitk::Images matches a number given on the command line or CTest's add_test()
- helper methods in class TestDICOMLoading make minimal sense (comparison of an image dump to itself must be valid)
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Concepts/DataInteraction.dox b/Documentation/Doxygen/3-DeveloperManual/Concepts/DataInteraction.dox
index 3bf3794ae1..374ae959a6 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}
<ol>
<li>a user event is triggered and send to MITK
<li>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).
<li>once the event is adapted it is send to a mitk::Dispatcher, which is linked to a render window, to be handled.
<li>on the mitk::Dispatcher level all objects are known that can react to incoming events (mitk::DataInteractor and mitk::InteractionEventObserver instances)
<li>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.
<li>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
<li>the actions associated with a state change (transition) are executed and the event is successfully handled.
</ol>
\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. <a href="http://en.wikipedia.org/wiki/Mealy_machine"> Wikipedia </a>).
+(see e.g. <a href="https://en.wikipedia.org/wiki/Mealy_machine"> Wikipedia </a>).
\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.
<b>State machine pattern 1:
We want the user to draw a line. A simple state machine could express this by three states like this:</b>
\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.
<b>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.</b>
\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.
<ul>
<li> States - represent the current status of the interaction
<li> Transitions - describe the events needed to change from one state to another
- <li> Conditions - are executed, before a transition is taken
+ <li> Conditions - are executed, before a transition is taken
<li> Actions - are executed, when a transition is taken and conditions for that transition have passed
</ul>
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
<statemachine>
<state name="StartState" startstate="true" >
<transition event_class="MousePressEvent" event_variant="MousePress" target="StartState">
<condition name="CheckPoint"/>
<action name="AddPoint"/>
</transition>
<transition event_class="InternalEvent" event_variant="PointsMatch" target="ClosedContour">
<action name="AddPoint"/>
</transition>
</state>
<state name="ClosedContour"/>
</statemachine>
\endcode
<b>Example 1: State machine pattern, that describes adding points to a contour until the PointsMatch event is triggered.</b>
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::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
<config name="one">
<event_variant name="MousePress" class="MousePressEvent">
<attribute name="EventButton" value="LeftMouseButton"/>
</event_variant>
</config>
\endcode
<b>Example 2: Event description of a left click with the mouse</b>
and
\code
<config name="two">
<event_variant name="MousePress" class="MousePressEvent">
<attribute name="EventButton" value="RightMouseButton"/>
<attribute name="Modifiers" value="shift"/>
</event_variant>
</config>
\endcode
<b>Example 3: Event description of a left click with the mouse while pressing the shift-key</b>
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/Documentation/Doxygen/3-DeveloperManual/Concepts/GeometryOverview.dox b/Documentation/Doxygen/3-DeveloperManual/Concepts/GeometryOverview.dox
index 9d1afa71e2..f7bbcb984b 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Concepts/GeometryOverview.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Concepts/GeometryOverview.dox
@@ -1,131 +1,160 @@
-namespace mitk{
/**
\page GeometryOverviewPage Geometry Overview
\tableofcontents
\section GeometryOverviewPage_Introduction Introduction to Geometries
-Geometries are used to describe the geometrical properties of data objects in space and time.\n
-To use the geometry classes in the right way you have to understand the three different coordinate types present in MITK:\n\n
+Geometries are used to describe the geometrical properties of data objects in space and time.
+To use the geometry classes in the right way you have to understand the three different coordinate types present in MITK:
+
\imageMacro{CoordinateTypes.png,"",16}
-<center><b>The different coordinate types\n\n</b></center>\n
- -# World coordinates:
- - World coordinates are describing the actual spacial position of all MITK objects regarding a global coordinate system, normally specified by the imaging modality
- - World coordinates are represented by mitk::Point3D objects.
- - The geometry defines the offset, orientation, and scale of the considered data objects in reference to the world coordinate systems.
- - World coordinates are always measured in mm
- - If you are dealing with an image geometry, the origin of an image is pointing to the CENTER of the bottom-left-back voxel.\n
- - If you are NOT dealing with an image geometry (no defined discrete Voxels), the origin is pointing to the bottom-left-back CORNER
- - Index coordinates can be converted to world coordinates by calling BaseGeometry::IndexToWorld()\n\n
+
+\section GeometryOverviewPage_CoordTypes The different coordinate types
+
+\subsection GeometryOverviewPage_WorldCoord
+
+- World coordinates are describing the actual spacial position of all MITK objects regarding a global coordinate system, normally specified by the imaging modality
+- World coordinates are represented by mitk::Point3D objects.
+- The geometry defines the offset, orientation, and scale of the considered data objects in reference to the world coordinate systems.
+- World coordinates are always measured in mm
+- If you are dealing with an image geometry, the origin of an image is pointing to the CENTER of the bottom-left-back voxel.
+- If you are NOT dealing with an image geometry (no defined discrete Voxels), the origin is pointing to the bottom-left-back CORNER
+- Index coordinates can be converted to world coordinates by calling mitk::BaseGeometry::IndexToWorld()
\imageMacro{worldcoordinateSystem.png,"",12}
-<center><b>Corner-based coordinates\n\n</b></center>
+
+\subsection GeometryOverviewPage_CornerCoord Corner-based coordinates
+
\imageMacro{WorldcoordinateSystemCenterBased.png,"",12}
-<center><b>Center-based image-coordinates\n\n</b></center>\n
- -# Continuous index coordinates:
- - Dividing world coordinates through the pixel spacing and simultanously taking the offset into account leads to continuous index coordinates inside your dataobject.\n
- So continuous coordinates can be float values!
- - Continuous index coordinates are represented by mitk::Point3D objects.
- - They can be obtained by calling BaseGeometry::WorldToIndex(), where &pt_mm is a point in worldcoordinates.\n
- -# Index coordinate system:
- - Index coordinates are discrete values that address voxels of a data object explicitly.
- - Index coordinates are represented by itk::Index<3> objects.
- - Basically they are continuous index coordinates which are rounded from half integer up.
- - E.g. (0,0) specifies the very first pixel of a 2D image, (0,1) the pixel of the next column in the same row
- - If you have world coordinates, they can be converted to discrete index coordinates by calling
- BaseGeometry::WorldToIndex()\n\n
+
+\subsection GeometryOverviewPage_CenterCoord Center-based image-coordinates
+
+\subsubsection GeometryOverviewPage_CenterCoord_ContIdx Continuous index coordinates
+
+- Dividing world coordinates through the pixel spacing and simultanously taking the offset into account leads to continuous index coordinates inside your dataobject. So continuous coordinates can be float values!
+- Continuous index coordinates are represented by mitk::Point3D objects.
+- They can be obtained by calling mitk::BaseGeometry::WorldToIndex(), where &pt_mm is a point in worldcoordinates.\n
+
+\subsubsection GeometryOverviewPage_CenterCoord_Idx Index coordinate system
+
+- Index coordinates are discrete values that address voxels of a data object explicitly.
+- Index coordinates are represented by itk::Index<3> objects.
+- Basically they are continuous index coordinates which are rounded from half integer up.
+- E.g. (0,0) specifies the very first pixel of a 2D image, (0,1) the pixel of the next column in the same row
+- If you have world coordinates, they can be converted to discrete index coordinates by calling mitk::BaseGeometry::WorldToIndex()\n\n
\section GeometryOverviewPage_PointsAndVector Difference between Points and Vectors
-Like ITK, MITK differenciate between points and vectors. A point defines a position in a coordinate system while a
-vector is the distance between two points. Therefore points and vectors behave different if a coordinate transformation
-is applied. An offest in a coordinate transformation will affect a transformed point but not a vector.
+Like ITK, MITK differenciate between points and vectors.
+A point defines a position in a coordinate system while a vector is the distance between two points.
+Therefore points and vectors behave different if a coordinate transformation is applied.
+An offest in a coordinate transformation will affect a transformed point but not a vector.
+
+An Example:
-An Example:\n
If two systems are given, which differ by a offset of (1,0,0). The point A(2,2,2) in system one will correspont to point A'(3,2,2) in the second system.
But a vector a(2,2,2) will correspond to the vector a'(2,2,2).
-
\section GeometryOverviewPage_Concept The Geometry Concept
-As the superclass of all MITK geometries BaseGeometry holds:
- - a spacial bounding box which is axes-parallel in index coordinates (often discrete indices of pixels), to be accessed by BaseGeometry::GetBoundingBox()
- - a time related bounding box which holds the temporal validity of the considered data object in milliseconds (start and end time), to be accessed by BaseGeometry::GetTimeBounds().\n
- The default for 3D geometries is minus infinity to plus infinity, meaning the object is always displayed independent of displayed time in MITK.
- - position information in form of a Euclidean transform in respect to world coordinates (i.e. a linear transformation matrix and offset) to convert (discrete or continuous) index coordinates to world coordinates and vice versa,\n
- to be accessed by BaseGeometry::GetIndexToWorldTransform()\n
- See also: \ref GeometryOverviewPage_Introduction "Introduction to Geometries"
- - Many other properties (e.g. origin, extent, ...) which can be found in the \ref BaseGeometry "class documentation"
- - <b> VERY IMPORTANT:</b>\n A flag called <i>isImageGeometry</i>, which indicates whether the coordinates are center-based or not!\n
- See also: \ref GeometryOverviewPage_Introduction "Introduction to Geometries" and \ref GeometryOverviewPage_Putting_Together "IMPORTANT: Putting it together for an Image"\n\n
+As the superclass of all MITK geometries mitk::BaseGeometry holds:
+- a spacial bounding box which is axes-parallel in index coordinates (often discrete indices of pixels), to be accessed by BaseGeometry::GetBoundingBox()
+- a time related bounding box which holds the temporal validity of the considered data object in milliseconds (start and end time), to be accessed by BaseGeometry::GetTimeBounds(). The default for 3D geometries is minus infinity to plus infinity, meaning the object is always displayed independent of displayed time in MITK.
+- position information in form of a Euclidean transform in respect to world coordinates (i.e. a linear transformation matrix and offset) to convert (discrete or continuous) index coordinates to world coordinates and vice versa, to be accessed by mitk::BaseGeometry::GetIndexToWorldTransform(). See also: \ref GeometryOverviewPage_Introduction "Introduction to Geometries"
+- Many other properties (e.g. origin, extent, ...) which can be found in the mitk::BaseGeometry "class documentation"
+- <b>VERY IMPORTANT:</b> A flag called \c isImageGeometry, which indicates whether the coordinates are center-based or not! See also: \ref GeometryOverviewPage_Introduction "Introduction to Geometries" and \ref GeometryOverviewPage_Putting_Together . <b>IMPORTANT:</b> Putting it together for an Image.
-Every data object (sub-)class of BaseData has a TimeGeometry which is accessed by BaseData::GetTimeGeometry(). This TimeGeometry holds one or more BaseGeometry objects which describes the object at specific time points, e.g. provides conversion between world and index coordinates and contains bounding boxes covering the area in which the data are placed. There is the possibility of using different implementations of the abstract TimeGeometry class which may differ in how the time steps are saved and the times are calculated.
+Every data object (sub-)class of BaseData has a mitk::TimeGeometry which is accessed by mitk::BaseData::GetTimeGeometry().
+This mitk::TimeGeometry holds one or more mitk::BaseGeometry objects which describes the object at specific time points, e.g. provides conversion between world and index coordinates and contains bounding boxes covering the area in which the data are placed.
+There is the possibility of using different implementations of the abstract mitk::TimeGeometry class which may differ in how the time steps are saved and the times are calculated.
-There are two ways to represent a time, either by a TimePointType or a TimeStepType. The first is similar to the continous index coordinates and defines a Time Point in milliseconds from timepoint zero. The second type is similar to index coordinates. These are discrete values which specify the number of the current time step going from 0 to GetNumberOfTimeSteps(). The conversion between a time point and a time step is done by calling the method TimeGeometry::TimeStepToTimePoint() or TimeGeometry::TimePointToTimeStep(). Note that the duration of a time step may differ from object to object, so in general it is better to calculate the corresponding time steps by using time points. Also the distance of the time steps does not need to be equidistant over time, it depends on the used TimeGeometry implementation.
+There are two ways to represent a time, either by a mitk::TimePointType or a mitk::TimeStepType.
+The first is similar to the continous index coordinates and defines a Time Point in milliseconds from timepoint zero.
+The second type is similar to index coordinates.
+These are discrete values which specify the number of the current time step going from 0 to GetNumberOfTimeSteps().
+The conversion between a time point and a time step is done by calling the method mitk::TimeGeometry::TimeStepToTimePoint() or mitk::TimeGeometry::TimePointToTimeStep().
+Note that the duration of a time step may differ from object to object, so in general it is better to calculate the corresponding time steps by using time points.
+Also the distance of the time steps does not need to be equidistant over time, it depends on the used mitk::TimeGeometry implementation.
-Each TimeGeometry has a bounding box covering the whole area in which the corresponding object is situated during all time steps. This bounding box may be accessed by calling TimeGeometry::GetBoundingBoxInWorld() and is always in world coordinates. The bounding box is calculated from all time steps, to manually start this calculation process call TimeGeometry::Update(). The bounding box is not updated if the getter is called.
+Each mitk::TimeGeometry has a bounding box covering the whole area in which the corresponding object is situated during all time steps.
+This bounding box may be accessed by calling mitk::TimeGeometry::GetBoundingBoxInWorld() and is always in world coordinates.
+The bounding box is calculated from all time steps, to manually start this calculation process call mitk::TimeGeometry::Update().
+The bounding box is not updated if the getter is called.
-The TimeGeometry does not provide a transformation of world coordinates into image coordinates since each time step may has a different transformation. If a conversion between image and world is needed, the BaseGeometry for a specific time step or time point must be fetched either by TimeGeometry::GetGeometryForTimeStep() or TimeGeometry::GetGeometryForTimePoint() and then the conversion is calculated by using this geometry.
+The mitk::TimeGeometry does not provide a transformation of world coordinates into image coordinates since each time step may has a different transformation.
+If a conversion between image and world is needed, the mitk::BaseGeometry for a specific time step or time point must be fetched either by mitk::TimeGeometry::GetGeometryForTimeStep() or mitk::TimeGeometry::GetGeometryForTimePoint() and then the conversion is calculated by using this geometry.
-The TimeGeometry class is an abstract class therefore it is not possible to instantiate it. Instead a derived class must be used. Currently the only class that can be chosen is ProportionalTimeGeometry() which assumes that the time steps are ordered equidistant. To initialize an object with given geometries call ProportionalTimeGeometry::Initialize() with an existing BaseGeometry and the number of time steps. The given geometries will be copied and not referenced!
+The mitk::TimeGeometry class is an abstract class therefore it is not possible to instantiate it.
+Instead a derived class must be used.
+Currently the only class that can be chosen is mitk::ProportionalTimeGeometry which assumes that the time steps are ordered equidistant.
+To initialize an object with given geometries call mitk::ProportionalTimeGeometry::Initialize() with an existing BaseGeometry and the number of time steps.
+The given geometries will be copied and not referenced!
-Also, the BaseGeometry is an abstract class and derived classes must be used. The most simple implementation, i.e. the one to one implementation of the BaseGeometry class, is the class Geometry3D.
+Also, the mitk::BaseGeometry is an abstract class and derived classes must be used.
+The most simple implementation, i.e. the one to one implementation of the BaseGeometry class, is the class mitk::Geometry3D.
-SlicedGeometry3D is a sub-class of BaseGeometry, which describes data objects consisting of slices, e.g., objects of type Image (or SlicedData, which is the super-class of Image).
-Therefore, Image::GetTimeGeometry() will contain a list of SlicedGeometry3D instances. There is a special method SlicedData::GetSlicedGeometry(t) which directly returns\n
-a SlicedGeometry3D to avoid the need of casting.
+mitk::SlicedGeometry3D is a sub-class of mitk::BaseGeometry, which describes data objects consisting of slices, e.g., objects of type Image (or mitk::SlicedData, which is the super-class of mitk::Image).
+Therefore, mitk::Image::GetTimeGeometry() will contain a list of mitk::SlicedGeometry3D instances. There is a special method mitk::SlicedData::GetSlicedGeometry(t) which directly returns a mitk::SlicedGeometry3D to avoid the need of casting.
-The class SlicedGeometry3D contains a list of PlaneGeometry objects describing the slices in the image.We have here spatial steps from 0 to GetSlices().
-SlicedGeometry3D::InitializeEvenlySpaced (PlaneGeometry *planeGeometry, unsigned int slices) initializes a stack of slices with the same thickness, one starting at the position where the previous one ends.
+The class mitk::SlicedGeometry3D contains a list of mitk::PlaneGeometry objects describing the slices in the image.
+We have here spatial steps from 0 to GetSlices().
+mitk::SlicedGeometry3D::InitializeEvenlySpaced(PlaneGeometry *planeGeometry, unsigned int slices) initializes a stack of slices with the same thickness, one starting at the position where the previous one ends.
-PlaneGeometry provides methods for working with 2D manifolds (i.e., simply spoken, an object that can be described using a 2D coordinate-system) in 3D space.\n
-For example it allows mapping of a 3D point on the 2D manifold using PlaneGeometry::Map(). \n
+mitk::PlaneGeometry provides methods for working with 2D manifolds (i.e., simply spoken, an object that can be described using a 2D coordinate-system) in 3D space.
+For example it allows mapping of a 3D point on the 2D manifold using mitk::PlaneGeometry::Map().
-Finally there is the AbstractTransformGeometry which describes a 2D manifold in 3D space, defined by a vtkAbstractTransform. It is a abstract superclass for arbitrary user defined geometries.\n
-An example is the ThinPlateSplineCurvedGeometry.\n
+Finally there is the mitk::AbstractTransformGeometry which describes a 2D manifold in 3D space, defined by a vtkAbstractTransform. It is a abstract superclass for arbitrary user defined geometries.
+An example is the mitk::ThinPlateSplineCurvedGeometry.
-\subsection GeometryOverviewPage_Putting_Together IMPORTANT: Putting it together for an Image
+\subsection GeometryOverviewPage_Putting_Together Putting it together for an Image
-Please read this section accurately if you are working with Images!
+Please read this section carefully if you are working with Images!
The definition of the position of the corners of an image is different than the one of other data objects:
-As mentioned in the previous section, world coordinates of data objects (e.g. surfaces ) usually specify the bottom left back corner of an object.
+As mentioned in the previous section, world coordinates of data objects (e.g. surfaces) usually specify the bottom left back corner of an object.
-In contrast to that a geometry of an Image is center-based, which means that the world coordinates of a voxel belonging to an image points to the center of that voxel.
+In contrast to that, a geometry of an mitk::Image is center-based, which means that the world coordinates of a voxel belonging to an image points to the center of that voxel.
E.g:
\imageMacro{PixelCenterBased.png,"",6}
-<center><b>Center-based voxel\n\n</b></center>
+
+\subsection GeometryOverviewPage_CenterBasedVoxel Center-based voxel
If the origin of e.g. a surface lies at (15,10,0) in world coordinates, the origin`s world coordinates for an image are internally calculated like the following:
- <center>(15-0.5*X-Spacing\n
- 10-0.5*Y-Spacing\n
- 0-0.5*Z-Spacing)\n</center>
+\code{.unparsed}
+(15-0.5*X-Spacing
+ 10-0.5*Y-Spacing
+ 0-0.5*Z-Spacing)
+\endcode
If the image`s spacing is (x,y,z)=(1,1,3) then the corner coordinates are (14.5,9.5,-1.5).
-<b>If your geometry describes an image, the member variable <i>isImageGeometry</i> must be changed to true. This variable indicates also if your geometry is center-based or not.\n
-The change can be done in two ways:\n
- -# You are sure that your origin is already center-based. Whether because you adjusted it manually or you copied it from another image.\n
- In that case, you can call the function <i>setImageGeometry(true)</i> or <i>imageGeometryOn()</i> to set the bool variable to true.
- -# You created a new geometry, did not manually adjust the origin to be center-based and have the bool value isImageGeometry set to false (default).\n
- In that case, call the function <i>ChangeImageGeometryConsideringOriginOffset(true)</i>. It will adjust your origin automatically and set the bool flag to true.\n
+If your geometry describes an image, the member variable \c isImageGeometry must be changed to true.
+This variable indicates also if your geometry is center-based or not.
+
+The change can be done in two ways:
+- You are sure that your origin is already center-based. Whether because you adjusted it manually or you copied it from another image. In that case, you can call the function \c setImageGeometry(true) or \c imageGeometryOn() to set the bool variable to true.
+- You created a new geometry, did not manually adjust the origin to be center-based and have the bool value \c isImageGeometry set to false (default). In that case, call the function \c ChangeImageGeometryConsideringOriginOffset(true) . It will adjust your origin automatically and set the bool flag to true.
-If you experience displaced contours, figures or other stuff, it is an indicator that you have not considered the origin offset mentioned above.</b>\n\n
+If you experience displaced contours, figures or other stuff, it is an indicator that you have not considered the origin offset mentioned above.
-An image has a TimeGeometry, which contains one or more SlicedGeometry3D instances (one for each time step), all of which contain one or more instances of (sub-classes of) PlaneGeometry.\n
-As a reminder: Geometry instances referring to images need a slightly different definition of corners, see BaseGeometry::SetImageGeometry. This is usualy automatically called by Image.\n\n
+An image has a mitk::TimeGeometry, which contains one or more mitk::SlicedGeometry3D instances (one for each time step), all of which contain one or more instances of (sub-classes of) mitk::PlaneGeometry.
+
+As a reminder: Geometry instances referring to images need a slightly different definition of corners, see mitk::BaseGeometry::SetImageGeometry.
+This is usualy automatically called by Image.
\section GeometryOverviewPage_Connection Connection between MITK, ITK and VTK Geometries
+
\imageMacro{ITK_VTK_MITK_Geometries.png,"",10}
-\n\n
- - VTK transformation for rendering
- - ITK transformation for calculations
- - Both automatically updated when one is changed\n
-Attention:<b>Not</b> automatically updated when changed hardcoded. Example: geometry->GetVtkMatrix()->Rotate(....)
+
+- VTK transformation for rendering
+- ITK transformation for calculations
+- Both automatically updated when one is changed
+
+Attention: <b>Not</b> automatically updated when changed hardcoded. Example: \c geometry->GetVtkMatrix()->Rotate(...)
+
*/
-}
diff --git a/Documentation/Doxygen/3-DeveloperManual/Concepts/Modularization.dox b/Documentation/Doxygen/3-DeveloperManual/Concepts/Modularization.dox
index 58d0f02c4e..32fd931e28 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Concepts/Modularization.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Concepts/Modularization.dox
@@ -1,44 +1,44 @@
/**
\page ModularizationPage Modular MITK
MITK has been designed to be modular and flexible, to facilitate reuse of existing code and functionality if possible. As such there are several levels of modularization which can be chosen when working with MITK, depending on the use case.
\section ModularizationPageOverview Overview
The general hierarchy of modularization runs micro service, module, view, plug-in, perspective and finally application.
\subsection ModularizationPageMicroServices Micro Services
A \ref MicroServices_Overview "micro service" is a reusable component provided by MITK modules. It can be accessed by other MITK modules or MITK plug-ins via its declared interface.
\subsection ModularizationPageModules Modules
Modules can be found in the MITK/Modules directory (with the exception of the core module in MITK/Core). Each module is a shared library that provides algorithms, data structures and similar code. Many modules are gui independent. A module is only build if it is required by other code, e.g. if a plug-ins is activated that requires it.
\subsection ModularizationPageViews Views
-One of the smallest units in the MITK application framework (\ref FurtherReading "Blueberry") is a \e view. A view is always part of a plug-in and provides one specific function, such as grouping all gui elements needed for providing segmentation algorithms or loading dicom images. Views usually contain any code which communicates with the user, performs input checking and similar, but no advanced algorithms.
+One of the smallest units in the MITK application framework is a \e view. A view is always part of a plug-in and provides one specific function, such as grouping all gui elements needed for providing segmentation algorithms or loading dicom images. Views usually contain any code which communicates with the user, performs input checking and similar, but no advanced algorithms.
\subsection ModularizationPagePlugInBundles Plugins
The next smallest unit is a CTK Plug-in (the term \e Bundle is used interchangeably). They can be found in MITK/Plugins or MITK/BlueBerry/Bundles. Plugins can be individually switched on and off during the CMake configuration.
A plugin usually represents a solution to a specific problem, such as segmentation or data management. As such they may provide any number of views and other contributions to the MITK application framework.
If you want to create your own MITK plugin you find further information \ref NewPluginPage "here".
\subsection ModularizationPagePerspectives Perspectives
Perspectives represent a configuration for the MITK application framework (specifically, for the \e Workbench) needed for a specific workflow. They allow the arrangement of different views (contributed by different plug-ins) to reflect the usage scenario, such as a data loading view in the top right, a segmentation view to the right and a visualization view to the bottom right. A perspective is provided by arbitrary plug-ins as an extension (contribution) to the application framework.
\subsection ModularizationPageApplications Applications
A specific selection of plug-ins together with custom configuration data defines the functionality for an application. The application corresponds to an executable and enables very specific program behaviour and configuration.
Example applications can be found in the MITK/Applications directory.
\section ModularizationPageHowTo How to create your own application
It is suggested to use the project generator provided by MITK unless one knows what one is doing. See \ref NewPluginWithProject "here" for more information.
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Concepts/Persistence.dox b/Documentation/Doxygen/3-DeveloperManual/Concepts/Persistence.dox
index 0f9cd9f10d..54aa3ba289 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Concepts/Persistence.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Concepts/Persistence.dox
@@ -1,65 +1,65 @@
/**
\page PersistenceConceptPage Persistence Concept
\tableofcontents
In general, persistence referes to the capability of an application to permanently store data, settings, states, etc. so that they outlive a restart. Normal data objects, such as images, surfaces, etc., which are visible in the data storage of MITK can be saved easily by the save/load functions, see \ref DataManagementPage for more details. This page focus on the persistence of settings, configurations, object states and parameters of the application. Depending on the component, e.g. plugin, module, etc., where you want to store your settings, MITK offers various ways to do so:
-# For code inside UI independent modules with low dependencies to other libraries the mitk::PersistenceService inside the MITK persistence module can be used to store parameters by using the mitk::PropertyList class: \ref PersistenceMITKService
-# UI dependent code where the Qt library is available can use QSettings: \ref PersistenceQTSetting
-# If the UI setting of Plugins should be stored permanently, the persistence features of blueberry can be used: \ref PersistenceBlueberry
-# Extended features, which include persistence, are provided by the configuration service. \ref PersistenceConfigurationService
\section PersistenceMITKService MITK Persistence Service
For persistence of member variables and parameters, the interface mitk::IPersistenceService in the MITK core provides an API to store variables permanently by means of mitk::PropertyList objects. These properties can be stored inside a MITK scene together with the data so that the user loads data and restores the application state at once. The current actual implementation of this interface can be found in the module Persistence. The class mitk::PersistenceService offers a rather simple way to store variables permanently.
To enable MITK persistence inside your class, simply include the persistence interface and use PERSISTENCE_GET_SERVICE_METHOD_MACRO in the private part of your class, as shown in the next code snippet:
\code
#include <mitkIPersistenceService.h>
//[...]
private:
PERSISTENCE_GET_SERVICE_METHOD_MACRO
\endcode
You can then access a persistent property list by using a unique id, e.g. the name of your plugin. Variables can be added to this property list and will be available after restarting the application.
\code
mitk::PropertyList::Pointer propList = this->GetPersistenceService()->GetPropertyList("org.mitk.myUniqueModule");
//set a variable:
propList->Set("deviceNumber", m_Controls->GrabbingDeviceNumber->value());
//get a variable:
int grabbingDeviceNumber = 0;
propList->Get("deviceNumber", deviceNumber);
\endcode
When a MITK scene with stored property list is loaded within MITK the list will change automatically. However a class can be informed by the service object by when the list is changed by adding it as observer to the service object.
\code
this->GetPersistenceService()->AddPropertyListReplacedObserver(this);
\endcode
An example implementation for the use of the mitk::PersistenceService can be found in the module OpenCVVideoSupport (class QmitkOpenCVVideoControls) and in the corresponding unit test mitkPersistenceTest in the Persistence module.
\section PersistenceQTSetting Qt Settings
Within the UI dependent modules inside MITK, the Qt::settings class can also be used to store variables permanently. The following code snippet shows an example:
\code
//in the header:
#include <QSettings>
//[...}
QSettings m_MySettings;
//in the cpp file:
//initialize the settings object (e.g. constructor):
m_MySettings("MyClass","MyDescription")
//store settings:
m_MySettings.setValue("identifier",value);
//load settings:
int intExample = m_MySettings.value("identifier").toInt();
\endcode
However, integration into a MITK scene file is not possible with Qt::settings.
\section PersistenceBlueberry Persistence Features of Blueberry
-In blueberry, the view states can be saved and restored which is described here: <a href="http://mitk.org/Article_Save_and_Restore_your_View_State">MITK.org: Save and Restore your View State</a>. Additionally, there is a possibility to make the preferences of a view persistent, which is documented in the <a href="http://docs.mitk.org/nightly/structberry_1_1IPreferencesService.html">class API documentation of the persistence service</a>.
+In blueberry, the view states can be saved and restored which is described here: <a href="https://www.mitk.org/wiki/Article_Save_and_Restore_your_View_State">MITK.org: Save and Restore your View State</a>. Additionally, there is a possibility to make the preferences of a view persistent, which is documented in the <a href="https://docs.mitk.org/nightly/structberry_1_1IPreferencesService.html">class API documentation of the persistence service</a>.
\section PersistenceConfigurationService Configuration Service
An implementation of a configuration service is planned for MITK in near future but not available yet.
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Concepts/QVTKRendering.dox b/Documentation/Doxygen/3-DeveloperManual/Concepts/QVTKRendering.dox
index 856f7a5267..beac96cfda 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Concepts/QVTKRendering.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Concepts/QVTKRendering.dox
@@ -1,128 +1,128 @@
/**
\page QVTKRendering Rendering Concept
\tableofcontents
The MITK rendering pipeline is derived from the VTK rendering pipeline.
\section QVTKRendering_Pipeline_VTK VTK Rendering Pipeline
\imageMacro{RenderingOverviewVTK.png,"Rendering in VTK",12}
In VTK, the vtkRenderWindow coordinates the rendering process. Several vtkRenderers may be associated to one vtkRenderWindow.
All visible objects, which can exist in a rendered scene (2D and 3D scene), inherit from vtkProp (or any subclass e.g. vtkActor).
A vtkPropAssembly is an assembly of several vtkProps, which appears like one single vtkProp.
MITK uses a new interface class, the "vtkMitkRenderProp", which is inherited from vtkProp. Similar to a vtkPropAssembly, all MITK rendering stuff is performed via this interface class.
Thus, the MITK rendering process is completely integrated into the VTK rendering pipeline. From VTK point of view, MITK renders like a custom vtkProp object.
-More information about the VTK rendering pipeline can be found at http://www.vtk.org and in the several VTK books.
+More information about the VTK rendering pipeline can be found at https://vtk.org/ and in the several VTK books.
\section QVTKRendering_Pipeline_MITK MITK Rendering Pipeline
This process is tightly connected to VTK, which makes it straight forward and simple. We use the above mentioned "vtkMitkRenderProp" in conjunction with the mitk::VtkPropRenderer for integration into the VTK pipeline. The QmitkRenderWindow does not inherit from mitk::RenderWindow, but from the QVTKWidget, which is provided by VTK.
The main classes of the MITK rendering process can be illustrated like this:
\imageMacro{qVtkRenderingClassOverview.png,"Rendering in MITK",16}
A render request to the vtkRenderWindow does not only update the VTK pipeline, but also the MITK pipeline. However, the mitk::RenderingManager still coordinates the rendering update behavior.
Update requests should be sent to the RenderingManager, which then, if needed, will request an update of the overall vtkRenderWindow. The vtkRenderWindow then starts to call the Render() function of all vtkRenderers, which are associated to the vtkRenderWindow. Currently, MITK uses specific vtkRenderers (outside the standard MITK rendering pipeline) for purposes, like displaying a gradient background (mitk::GradientBackground), displaying video sources (QmitkVideoBackround and mitk::VideoSource), or displaying a (department) logo (mitk::ManufacturerLogo), etc..
Despite these specific renderers, a kind of "SceneRenderer" is member of each QmitkRenderWindow. This vtkRenderer is associated with the custom vtkMitkRenderProp and is responsible for the MITK rendering.
The vtkRenderer calls four different functions in vtkMitkRenderProp, namely RenderOpaqueGeometry(), RenderTranslucentPolygonalGeometry(), RenderVolumetricGeometry() and RenderOverlay(). These function calls are forwarded to the mitk::VtkPropRenderer.
Then, depending on the mapper type (OpenGL- or VTK-based), OpenGL is enabled or disabled. In the case of OpenGL rendering, the Paint()-method of each individual mapper is called. If the mapper is VTK-based, the four function calls are forwarded to mitk::VtkMapper and within these methods the corresponding VtkProp is evaluated.
Both strategies are illustrated in the sequence diagrams below:
\imageMacro{qVtkRenderingSequenceVTK.png,"Sequence diagram for MITK VTK rendering",16}
In MITK, VTK-based mapper are more common and we recommend on implementing VTK-based mappers. However, MITK supports OpenGL-based mappers as well.
\imageMacro{qVtkRenderingSequenceGL.png,"Sequence diagram for MITK OpenGL rendering",16}
\section QVTKRendering_Mapper MITK Mapper Architecture
Mappers are used to transform the input data in tangible primitives, such as surfaces, points, lines, etc. The base class of all mappers is mitk::Mapper. The mapper hierarchy reflects the two possible ways to render in MITK: Subclasses of mitk::Mapper control the creation of rendering primitives
that interface to the graphics library (e.g. via OpenGL, vtk). The mapper architecture is illustrated in the following UML diagram:
\imageMacro{qVtkRenderingMapper.jpg,"Mapper architecture",16}
mitk::Mapper::Update() calls the time step of the input data for the specified renderer and checks whether the time step is valid and calls method mitk::Mapper::GenerateDataForRenderer(), which is reimplemented in the individual mappers and should be used to generate primitives.
mitk::Mapper::SetDefaultProperties() should be used to define mapper-specific properties.
\section QVTKRendering_programmerGuide User Guide: Programming hints for rendering related stuff (in plugins)
\li The QmitkRenderWindow can be accessed like this: this->GetRenderWindowPart()->GetRenderWindow("axial");
\li The vtkRenderWindow can be accessed like this: this->GetRenderWindowPart()->GetRenderWindow("axial")->GetVtkRenderWindow();
\li The mitkBaseRenderer can be accessed like this: mitk::BaseRenderer* renderer = mitk::BaseRenderer::GetInstance(this->GetRenderWindowPart()->GetRenderWindow("sagittal")->GetRenderWindow());
\li An update request of the overall QmitkStdMultiWidget can be performed with: mitk::RenderingManager::GetInstance()->RequestUpdateAll() or alternatively with the shorthand this->RequestRenderWindowUpdate();
\li A single QmitkRenderWindow update request can be done like this: mitk::RenderingManager::GetInstance()->RequestUpdate(this->GetRenderWindowPart()->GetRenderWindow("axial")->GetVtkRenderWindow());
\li be aware that GetRenderWindowPart() can return null if the editor is closed. This is a common reason for nullpointer exceptions.
\note The usage of ForceImmediateUpdateAll() is not desired in most common use-cases.
\subsection QVTKRendering_distinctRenderWindow Setting up a distinct Rendering-Pipeline
It is sometimes desired to have one (or more) QmitkRenderWindows that are managed totally independent of the 'usual' renderwindows defined by the QmitkStdMultiWidget.
This may include the data that is rendered as well as possible interactions. In order to achieve this, a set of objects is needed:
\li mitk::RenderingManager -> Manages the rendering
\li mitk::DataStorage -> Manages the data that is rendered
\li mitk::GlobalInteraction -> Manages all interaction
\li QmitkRenderWindow -> Actually visualizes the data
The actual setup, respectively the connection, of these classes is rather simple:
\code
// create a new instance of mitk::RenderingManager
mitk::RenderingManager::Pointer renderingManager = mitk::RenderingManager::New();
// create new instances of DataStorage and GlobalInteraction
mitk::DataStorage::Pointer dataStorage = mitk::DataStorage::New();
mitk::GlobalInteraction::Pointer globalInteraction = mitk::GlobalInteraction::New();
// add both to the RenderingManager
renderingManager->SetDataStorage( dataStorage );
renderingManager->SetGlobalInteraction( globalInteraction );
// now create a new QmitkRenderWindow with this renderingManager as parameter
QmitkRenderWindow* renderWindow = new QmitkRenderWindow( parent, "name", renderer, renderingManager );
\endcode
That is basically all you need to setup your own rendering pipeline.
Obviously you have to add all data you want to render to your new DataStorage. If you want to interact with this renderwindow, you will also have
to add additional Interactors/Listeners.
\note Dynamic casts of a mitk::BaseRenderer class to an OpenGLRenderer (or now, to an VtkPropRenderer) should be avoided. The "MITK Scene" vtkRenderer and the vtkRenderWindow as well, are therefore now included in the mitk::BaseRenderer.
\subsection QVTKRendering_userGuideMapper How to write your own Mapper
If you want to write your own mapper, you first need to decide whether you want to write a VTK-based mapper or a GL-based mapper.
We recommend to write a VTK-based mapper, as VTK is easy to learn and some GL-based mappers can have unexpected site effects.
However, you need to derive from the respective classes.
In the following we provide some programming hints for writing a Vtk-based mapper:
\li include mitkLocalStorageHandler.h and derive from class BaseLocalStorage as a nested class in your own mapper. The LocalStorage instance should
contain all VTK ressources such as actors, textures, mappers, polydata etc.
The LocalStorageHandler is responsible for providing a LocalStorage to a concrete mitk::Mapper subclass. Each RenderWindow / mitk::BaseRenderer is
assigned its own LocalStorage instance so that all contained ressources (actors, shaders, textures, ...) are provided individually per window.
\li GenerateDataForRenderer() should be reimplemented in order to generate the primitives that should be rendered. This method is called in each Mapper::Update() pass, thus,
all primitives that are rendered are recomputed. Employ LocalStorage::IsGenerateDataRequired() to determine whether it is necessary to generate the primitives again. It is not
necessary to generate them again in case the scene has just been translated or rotated.
\li For 2D mappers, it is necessary to determine the 3D primitives close to the current plane that should be drawn. Use
planeGeometry = renderer->GetSliceNavigationController()->GetCurrentPlaneGeometry() to get the current plane. The distance to it can be determined by using planeGeometry->DistanceFromPlane(point).
\li Reimplement GetVtkProp(), that should return the specific VtkProp generated in GenerateDataForRender() (e.g. a single actor or a propassembly, which is a combination of different actors).
The VtkProp is picked up in one of the four render passes and thus integrated into the VTK render pipeline.
\li SetDefaultProperties() should be used to define mapper-specific properties.
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Concepts/TestsGeneral.dox b/Documentation/Doxygen/3-DeveloperManual/Concepts/TestsGeneral.dox
index e1481463fb..10d3d23308 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Concepts/TestsGeneral.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Concepts/TestsGeneral.dox
@@ -1,104 +1,104 @@
/**
\page GeneralTests General: Tests in MITK
\tableofcontents
\section GeneralTestsIntroduction Testing in MITK
The basic idea about unit testing is to write a test for every unit (e.g. function) of your software, which automatically checks if the code still returns the expected result for a defined input. The goal is to isolate units as much as possible, in order to be efficient with fixing errors.
If this is performed on a low level, this is called unit testing. On higher levels, where various circumstances (such as configuration files, internet connection, hardware, or even input/output) may influence the outcome of the test, this is called integration testing.
MITK uses CppUnit, which is a framework for efficient and fast test writing, to support developers in test coding. Furthermore MITK offers currently three types of tests: classic <B>unit tests</B>, <B>rendering tests</B> and <B>interaction tests</B>. Although our unit tests often involve data input (or output), we still consider them to be unit tests.
\warning Most of our units tests have been written before adopting CppUnit and have not yet been updated. Therefore we do not recommend to look at a random test for an example of coding a test.
This pages gives a general introduction to our test framework. Rendering tests are explained in more detail in the section \ref RenderingTests and interaction tests the section \ref InteractionTestingHowTo. The following sections will explain how to write your own tests with MITK and how to run them.
\section GeneralTestsAdding Adding a test to your module
Generally, functional code you want to test using unit tests will be located in a module. For an overview of the directory structure see \ref NewModulePageCreateFolder and how to add the files comprising your test compare \ref NewModulePageCreateTestingEnvironment
\subsection GeneralTestsAddingFramework Test and test class/suite
CppUnit and MITK distinguish between the term test class and test, which is important to understand. A test is simply a call of a single function and a comparison against a reference.
The ideal way to write a test is:
\code
result = myGreatFunction(myParameter);
ASSERT_EQUAL(result, reference);
\endcode
which is just 2 lines of code at the best. Sometimes objects and data may be initialized in a test, but usually this should be done in the setUp() method (see below). If possible, avoid multiple assertions in order to be efficient in error localization and for better readability. For instance, if you instantiate an object and test if its data is not NULL, this is already a complete test and you do not want to repeat this comparison in other tests.
All tests check different things and just one at a time. Remember: The goal is to have isolated unit tests and avoid large, confusing tests which are hard to maintain.
\note The reference should never be computed and ideally be a distinct and well defined (often hard coded) value. You don't care where you reference comes from, you just want to ensure that your test actually results in the reference value.
A test class (also called suite) is a set of tests and often associated to a single functional class in MITK. A test class refers to a TestSuite in CppUnit. These terms are easily confused, so we suggest to use the term <B>test suite</B> for a collection of tests (which is often in a single file), and the term "test" for a single test (usually many per file).
In order to create a test class you need to create a new class deriving from mitk::TestFixture. While a purist approach would be to create a new mitk::TestFixture for each method of your class (resulting in as many test source files as your class has methods), we usually follow a more pragmatic approach within MITK. In most cases we suggest having one test source file per class. If your class source file is called mitkGreatClass.cpp we suggest the name mitkGreatClassTest.cpp for your test source file. For very complex and long classes splitting this into several tests may be advisable. Additionally, rendering tests and interaction tests should always get their own test class/suite to mark them as obvious integration tests, because the goal is to isolate unit tests from integration tests. The dashboard for continuous integration will automatically show the results of a test suite and summarize the output. If you run your test manually (e.g. with ctest -VV), you will see the detailed output of all tests of the suite.
In order to use CppUnit via MITK you will need to include the corresponding files and register your test:
\code
#include <mitkTestingMacros.h>
#include <mitkTestFixture.h>
…
MITK_TEST_SUITE_REGISTRATION(mitkImageEqual)
\endcode
\subsection GeneralTestsAddingHow How to structure your test
-As mentioned before, all test suites derive from mitk::TestFixture. A suggested name for your test suite would be <FUNCTIONALITY_TO_BE_TESTED>TestSuite.
+As mentioned before, all test suites derive from mitk::TestFixture. A suggested name for your test suite would be \c \<FUNCTIONALITY_TO_BE_TESTED\>TestSuite .
-You then create a suite and register your tests. A suggested naming convention for test methods is <METHOD_TO_BE_TESTED>_<INPUT_PARAMETERS/CONDITION>_<EXPECTED_RESULT>. We suggest not to add the word test, because that is most likely the only thing the reader knows anyway about your test, as he is reading a test suite.
+You then create a suite and register your tests. A suggested naming convention for test methods is \c \<METHOD_TO_BE_TESTED\>_\<INPUT_PARAMETERS/CONDITION\>_\<EXPECTED_RESULT\> . We suggest not to add the word test, because that is most likely the only thing the reader knows anyway about your test, as he is reading a test suite.
An example:
\code
class mitkImageEqualTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkImageEqualTestSuite);
MITK_TEST(Equal_CloneAndOriginal_ReturnsTrue);
MITK_TEST(Equal_InputIsNull_ReturnsFalse);
MITK_TEST(Equal_DifferentImageGeometry_ReturnsFalse);
MITK_TEST(Equal_DifferentPixelTypes_ReturnsFalse);
…
CPPUNIT_TEST_SUITE_END();
…
}
\endcode
You also may provide a setUp() and a tearDown() function. These will be called before/after each test and should be used to make sure that each test works independently and on freshly initialized members and memory to maximize isolation. That way you avoid only testing whether a function works after another function has already been called. See <a href="http://cppunit.sourceforge.net/doc/cvs/class_test_fixture.html">CppUnit documentation</a> for more information. For an example test suite including tests see \ref GeneralTestsExample
\section GeneralTestsRunning Running your test suite
-The build system of MITK generates a test driver which includes all test suites that have been added to the project. Alternatively you can run MITK test suites by using the program ctest. This is the way all MITK tests run on the continuous dart clients of MITK. The results of these runs can be found at http://cdash.mitk.org.
+The build system of MITK generates a test driver which includes all test suites that have been added to the project. Alternatively you can run MITK test suites by using the program ctest. This is the way all MITK tests run on the continuous dart clients of MITK. The results of these runs can be found at https://cdash.mitk.org/.
If you use the test driver, you only need to start the executable. If you start it without parameters, it will then give you an overview of all tests which are included in this test driver and you can choose one by typing a number. Alternatively, you can give your test driver the name of your test suite as parameter. If you want to use ctest instead of the test driver you need to start a command line, go to the binary directory of MITK and call ctest. To avoid errors, check if your path variable contains all relevant paths to start MITK.
\section GeneralTestsParameterInput Adding parameters to your test
If possible, the setUp() method of the test suite should provide all necessary inputs for the respective tests. MITK provides several helper classes to generate synthetic test data, such as the mitk::ImageGenerator. If you have to load data from the hard disc for your test, you can use the method GetTestDataFilePath(string fileName). For an example of loading data from the MITK_DATA_DIR check the mitkIOUtilTestSuite.
\section GeneralTestsPredefinedAssertions Predefined assertions
-MITK and CppUnit offer predefined assertions, i.e. helper methods which will help to compare your data against a certain reference. All basic types are covered by CppUnit assertions, such as CPPUNIT_ASSERT. For examples, please check the <a href="http://cppunit.sourceforge.net/doc/cvs/group___assertions.htmll">CppUnit documentation</a>. MITK further offers comparison tools for floating point numbers, vectors, images, surfaces and point sets. A complete list of assertion macros is given in \ref MITKTestingAPI.
+MITK and CppUnit offer predefined assertions, i.e. helper methods which will help to compare your data against a certain reference. All basic types are covered by CppUnit assertions, such as CPPUNIT_ASSERT. For examples, please check the <a href="http://cppunit.sourceforge.net/doc/cvs/group___assertions.html">CppUnit documentation</a>. MITK further offers comparison tools for floating point numbers, vectors, images, surfaces and point sets. A complete list of assertion macros is given in \ref MITKTestingAPI.
An example to compare images:
\code
MITK_ASSERT_EQUAL(image, reference, "Checks if image is equal to a reference");
\endcode
By default, the method uses an mitk::eps for floating point comparison, but this can be adapted. It can be necessary to write your own assertion for your own data meeting your special requirements. Recommended examples are all equal test suites for basic data types (mitkImageEqualTest, mitkSurfaceEqualTest and mitkPointSetEqualTest).
\section GeneralTestsExample An example
\include Examples/FirstSteps/NewModule/test/mitkExampleDataStructureTest.cpp
\section GeneralTestsFurtherInfo Further information
-More examples can be found in the corresponding <a href="http://www.mitk.org/images/5/5d/BugSquashingSeminars%24CppUnitFrameworkSeminar.pdf"> bugsquashing presentation</a>.
+More examples can be found in the corresponding <a href="https://www.mitk.org/w/images/5/5d/BugSquashingSeminars%24CppUnitFrameworkSeminar.pdf"> bugsquashing presentation</a>.
*/
\section GeneralTestsDeprecatedOldTestingStyle Deprecated macros
All tests with MITK_TEST_BEGIN(); and MITK_TEST_END(); use the deprecated old MITK testing style. If possible, they should be replaced with the new CppUnit style as explained before. Most of these test classes contain very unfortunate examples and should not be regarded as reference.
diff --git a/Documentation/Doxygen/3-DeveloperManual/DeveloperManualPortal.dox b/Documentation/Doxygen/3-DeveloperManual/DeveloperManualPortal.dox
index 425b916c4a..678ce379c8 100644
--- a/Documentation/Doxygen/3-DeveloperManual/DeveloperManualPortal.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/DeveloperManualPortal.dox
@@ -1,33 +1,31 @@
/**
\developersguidemainpage{DeveloperManualPortal} Developer Manual
Development with MITK can happen under several conditions. Depending on whether you are using the Toolkit or the entire application, different sections may apply to you.
In case you are unsure about what you need, please refer to \link Architecture The Architecture of MITK text\endlink.
An extensive Introduction to MITK is available under \link StartingDevelopment Starting your MITK Development\endlink.
Once you have made yourself familiar with MITK, you should have a look at the \link Concepts Development Concepts\endlink, as MITK implements a lot of high-level functionality.
Knowing about these concepts will prevent you from reimplementing functionality.
Once you start consuming more specific functionality, the \link MITKModuleManualsListPage Module Manual\endlink will be helpful to understand how a specific plugin works and what functionality it provides.
-Finally, generated API-Documentation can be found \link DevelopmentAPI here\endlink.
-
<ul>
<li> \subpage StartingDevelopment </li>
<ul>
<li> \ref Architecture </li>
<li> \ref SettingUpMITK </li>
<li> \ref GettingToKnowMITK </li>
<li> \ref FirstSteps </li>
<li> \ref AboutTestingPage </li>
</ul>
<li> \subpage Concepts </li>
<li> \subpage MITKModuleManualsListPage </li>
<li> \subpage DevelopmentApplication </li>
<ul>
<li> \ref mitkExtPointsIndex </li>
</ul>
<li> \subpage DeploymentPage </li>
</ul>
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/AboutTesting/AboutTestingPage.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/AboutTesting/AboutTestingPage.dox
index 71f56ac001..bd179e4c49 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/AboutTesting/AboutTestingPage.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/AboutTesting/AboutTestingPage.dox
@@ -1,14 +1,14 @@
/**
\page AboutTestingPage Testing
-Testing is a very important part of ensuring code quality. We use <a href="http://www.cdash.org/">CDash</a> for testing whether MITK builds on a variety of platforms and configurations. You can find our dashboard <a href="http://cdash.mitk.org/index.php?project=MITK&display=project">here</a>.
+Testing is a very important part of ensuring code quality. We use <a href="https://www.cdash.org/">CDash</a> for testing whether MITK builds on a variety of platforms and configurations. You can find our dashboard <a href="https://cdash.mitk.org/index.php?project=MITK&display=project">here</a>.
Additionally we support tests of software function as well. More detailed information on testing in MITK can be found below.
<ul>
<li> \subpage GeneralTests
<li> \subpage RenderingTests
<li> \subpage DICOMTesting
<li> \subpage InteractionTestingHowTo
</ul>
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/Architecture.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/Architecture.dox
index 4387b2c242..920d0adbbf 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/Architecture.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/Architecture.dox
@@ -1,47 +1,47 @@
/**
\page Architecture The Architecture of MITK
MITK is an open source software toolkit for medical image processing, subsequent data analysis and integration of medical hardware.
It is designed with the aim of providing a modular and reusable code base to enable rapid development of new features. Following
this design philosophy, MITK includes many specialized modules.
This document is aimed at giving an overview of the general structure of MITK. It will give you an introduction to the coding
and design concepts behind the toolkit.
\section OverviewPage_DesignOverview Design Overview
MITK is designed to be used either as a <B>pure software library</B> or as a <B>complete application framework</B>. Thus, a user
of MITK can decide if he or she simply wants to add a new plug-in to the existing application framework or to implement an
own application by using MITK as a software library. Depending on the type of use MITK uses different software libraries, which is
shown in the next figure for overview.
\imageMacro{MitkOverview.png,"Overview of MITK",16}
As shown above, MITK uses the following libraries.
<ul>
- <li> The <a href="http://www.itk.org">Insight Toolkit (ITK)</a>, which provides registration and
+ <li> The <a href="https://itk.org/">Insight Toolkit (ITK)</a>, which provides registration and
segmentation algorithms, but is not designed for visualization or interaction.
- <li> The <a href="http://www.vtk.org">Visualization Toolkit (VTK)</a>, which provides powerful visualization capabilities
+ <li> The <a href="https://vtk.org/">Visualization Toolkit (VTK)</a>, which provides powerful visualization capabilities
and low-level support for interaction such as picking methods, rotation, movement and scaling of objects.
- <li> The <a href="http://www.commontk.org">Common Toolkit (CTK)</a>, which focuses on DICOM support and a plug-in framework.
+ <li> The <a href="https://commontk.org/">Common Toolkit (CTK)</a>, which focuses on DICOM support and a plug-in framework.
- <li> The <a href="http://qt.nokia.com/">Qt Cross-platform application and UI framework (Qt)</a> as a framework for UI and application
+ <li> The <a href="https://www.qt.io/">Qt Cross-platform application and UI framework (Qt)</a> as a framework for UI and application
support.
</ul>
These are the main libraries MITK is based on. For more functionality you can optionally include other libraries as well. A list of used libraries can be found \ref thirdpartylibs "here" .
Based on these libraries, MITK includes the following features:
<ul>
<li>High level interactions with data.
<li>Specialized medical imaging algorithms (e.g. segmentation)
<li>Support of 3D + t data.
<li>Complete application framework, expandable by plug-ins
<li>Standard tools for medical imaging as default plug-ins (e.g. measurement, segmentation)
<li>Many specialized modules for different topics on medical imaging (e.g. image guided therapy, live image/ultrasound data processing)
</ul>
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/FirstSteps.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/FirstSteps.dox
index cb3f5cd61f..c85df71692 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/FirstSteps.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/FirstSteps.dox
@@ -1,16 +1,15 @@
/**
\page FirstSteps First steps in Development
This section will show you how to extend MITK for your own project.
<ul>
<li> \subpage NewPluginPage </li>
<li> \subpage NewModulePage </li>
<li> \subpage NewDataTypePage </li>
<li> \subpage NewViewPage</li>
<li> \subpage CMAKE_FAQ </li>
- <li> \subpage StatemachineEditor </li>
<li> \subpage MiniAppCommandLineToolHowToPage </li>
</ul>
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/MiniAppCommandLineTool/MiniAppCommandLineToolHowTo.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/MiniAppCommandLineTool/MiniAppCommandLineToolHowTo.dox
index bce1c618c2..88a8162957 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/MiniAppCommandLineTool/MiniAppCommandLineToolHowTo.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/MiniAppCommandLineTool/MiniAppCommandLineToolHowTo.dox
@@ -1,140 +1,138 @@
/**
\page MiniAppCommandLineToolHowToPage How to create a MiniApp command line tool
\tableofcontents
This page will give you an overview of creating your own command line tool that can be integrated into a MiniApp.
If you don't know about MiniApps, you can read about their purpose and use at \ref MiniAppExplainPage page.
\section MiniAppCommandLineToolHowToPageDescription What's a MiniApp command line tool?
A MiniApp command line tool allows for configuration of command line arguments and eases the access to these argument values.
Additionally, a command line tool provides a XML representation of the configured arguments. This XML representation can be used for automatic user interface generation.
\section MiniAppCommandLineToolHowToPageSetUp Setting up a command line tool
This section describes the most important code parts of a command line tool using the ExampleToUpperCaseMiniApp.cpp as an example. See \ref NewModulePage for a suggested structure of a new module and its MiniApps.
Each MiniApp contains its own main function.
\snippet ExampleToUpperCaseMiniApp.cpp main
Within the main function the first thing should be to configure the accepted arguments. This can be done using the mitkCommandLineParser.
Our example accepts an input filename an output filename and an optional flag for verbose processing.
\snippet ExampleToUpperCaseMiniApp.cpp create parser
\snippet ExampleToUpperCaseMiniApp.cpp add arguments
Following argument types are available for the addArgument method:
\li String
\li Bool
\li StringList
\li Int
\li Float
\li InputDirectory
\li InputFile
\li InputImage
\li OutputDirectory
\li OutputFile
The distinction between InputFile/OutputFile and InputDirectory/OutputDirectory respectively ensures that the appropriate UI widget is chosen.
The label string passed to the addArgument method is the label for the corresponding UI widget.
After specification of allowed arguments the parser's parseArguments method is called.
\snippet ExampleToUpperCaseMiniApp.cpp parse the arguments
After all arguments have been parsed we can do the actual processing. In this case we read the file, convert the contained text to upper case and
write the new data to the specified output location.
\snippet ExampleToUpperCaseMiniApp.cpp do processing
\subsection MiniAppCommandLineToolHowToPageSetUpExampleHelpOutput Example Help Output
Running the ExampleToUpperCaseMiniApp without an argument or with wrong ones:
\code
./ExampleToUpperCaseMiniApp
\endcode
... will emit the following help text:
\verbatim
Command Line Utility *To Upper Case* in Category *MITK-Examples*
An example MiniApp that converts the contents of a test file to upper case.
German Cancer Research Center (DKFZ)
Use --xml to generate an XML description parsable as a CTK Command Line Module Plugin.
Optional parameters
-v, --verbose, Whether to produce verbose output (optional)
Required I/O parameters
-i, --input, input file (.txt/.example)
-o, --output, where to save the output (.txt/.example)
\endverbatim
\section MiniAppCommandLineToolHowToPageXMLRepresentation Retrieving XML argument description
According to the specified command line arguments, a XML representation of the arguments is generated and emitted on the console if the MiniApp command line tool is executed with argument "--xml".
In order to use the XML representation for automatic user interface generation additional information has to be provided for the parser.
-Please provide category, title, description and contributor as shown in code snippet below for the \ref TensorReconstruction command line tool:
+Please provide category, title, description and contributor as shown in code snippet below:
\snippet ExampleToUpperCaseMiniApp.cpp create parser
Note that in the generated UI the parameter widgets are contained in a group box. There is a default label ("Parameters") and a default description ("Groupbox containing parameters.") specified. The label of such a parameter group and the description can be set via the parser's changeParameterGroup method.
The method must be called before adding the arguments.
-See \ref MiniAppExplainPageWorkbenchIntegration for information how to access your MiniApp from within the application instead of calling it directly from the command line.
-
\subsection MiniAppCommandLineToolHowToPageXMLRepresentationExampleXMLOutput Example XML Output
Running the ExampleToUpperCaseMiniApp with argument "--xml" ...
\code
./ExampleToUpperCaseMiniApp --xml
\endcode
... will emit following XML description:
\verbatim
<executable>
<category>MITK-Examples</category>
<title>To Upper Case</title>
<description>An example MiniApp that converts the contents of a test file to upper case.</description>
<contributor>German Cancer Research Center (DKFZ)</contributor>
<parameters>
<label>Parameters</label>
<description>Parameters</description>
<file>
<name>input</name>
<description>input file (.txt/.example)</description>
<label>Input file</label>
<longflag>input</longflag>
<flag>i</flag>
<channel>input</channel>
</file>
<file>
<name>output</name>
<description>where to save the output (.txt/.example)</description>
<label>Output file</label>
<longflag>output</longflag>
<flag>o</flag>
<channel>output</channel>
</file>
<boolean>
<name>verbose</name>
<description>Whether to produce verbose output</description>
<label>Verbose Output</label>
<longflag>verbose</longflag>
<flag>v</flag>
</boolean>
</parameters>
</executable>
\endverbatim
This XML description is used for automatic user interface generation in MITK Workbench. The generated user interface is depicted in the following screenshot:
\imageMacro{generated_ui_example.png, "Generated UI of example command line tool in MITK Workbench", 10}
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/NewDataType.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/NewDataType.dox
index 6bfdac56cf..d54a5a3686 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/NewDataType.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/NewDataType.dox
@@ -1,52 +1,52 @@
/**
\page NewDataTypePage How to create a new custom data type
\tableofcontents
\section NewDataTypePagePrerequisites Prerequisites and further reading
We will use some concepts during this tutorial which we assume you are aware of, as well as taking advantage of infrastructure which needs to be set up. The following is a list of prerequisites which should be present to effectively use this tutorial.
<ul>
<li> An understanding of the general \ref DataManagementPage </li>
<li> An understanding about the \ref ModularizationPage "modularization of MITK" </li>
<li> We also assume you have created your own module "NewModule" ( \ref NewModulePage ) </li>
</ul>
Some concepts will only be briefly touched upon in this tutorial, for a more concise presentation of these concepts please refer to the following further reading.
<ul>
<li> A general understanding of how the \ref ReaderWriterPage concept works </li>
<li> If you want to know more about the mitk rendering see \ref QVTKRendering </li>
</ul>
\section NewDataTypePageCreatingANewDataType Creating a new data type
A new data type needs to derive from mitk::BaseData in order to be handled by the mitk::DataStorage via mitk::DataNode. An example of a very simple data type is provided in the example module. This type encapsulates a string.
\include mitkExampleDataStructure.h
Overloading mitk::Equal to work with your data type will enable you to write simpler, standardized tests.
\section NewDataTypePageAddingReadersAndWriters Adding readers and writers
In order for your data type to be read from and written to disk, you need to implement readers and writers. In order for your readers/writers to be registered and available even if your module has not been loaded (usually after just starting the application), it is advisable to implement them separately in a autoload module. The default location for this is "YourModuleName/autoload/IO".
More information regarding implementing IO and MimeTypes is available at \ref ReaderWriterPage. An example MimeType is implemented for the example data structure.
\include mitkExampleIOMimeTypes.h
\note{ You do not need to create your own class to manage your MimeTypes. Instead they can be defined within the Reader/Writer. }
\section NewDataTypePageAddingMappers Adding a mapper
If your data type needs a special way to render its data for the user, you need to implement a new mapper. More information can be found at \ref QVTKRendering.
<p>
If you meet any difficulties during this How-To, don't hesitate to ask on the MITK mailing list mitk-users@lists.sourceforge.net!
People there are kind and will try to help you.
-If you notice that there is an error, or that the code has changed so the way shown here is no longer correct, please open a bug report a http://bugs.mitk.org .</p>
+If you notice that there is an error, or that the code has changed so the way shown here is no longer correct, please open a bug report at https://phabricator.mitk.org/maniphest/ .</p>
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/NewPlugin.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/NewPlugin.dox
index 8fdb863ee5..8b5ffda3e2 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/NewPlugin.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/FirstSteps/NewPlugin.dox
@@ -1,97 +1,96 @@
/**
\page NewPluginPage How to create a new MITK Plugin
The MITK Plugin Generator is a command line tool to simplify the process of creating your own MITK project
-(optional) and plugins. It can either be downloaded <a href="http://www.mitk.org/wiki/Download">here</a>
-or used from an existing MITK build.
+(optional) and plugins.
The Plugin Generator takes the following command line arguments:
\verbatim
./MitkPluginGenerator -h
A CTK plugin generator for MITK (version 1.2.0)
-h, --help Show this help text
-o, --out-dir Output directory (default: /tmp)
-l, --license Path to a file containing license information (default: :/COPYRIGHT_HEADER)
-v, --vendor The vendor of the generated code (default: German Cancer Research Center (DKFZ))
-q, --quiet Do not print additional information
-y, --confirm-all Answer all questions with 'yes'
-u, --check-update Check for updates and exit
-n, --no-networking Disable all network requests
Plugin View options
-vc, --view-class The View's' class name
-vn, --view-name * The View's human readable name
Plugin options
-ps, --plugin-symbolic-name * The plugin's symbolic name
-pn, --plugin-name The plugin's human readable name
Project options
--project-copyright Path to a file containing copyright information (default: :/LICENSE)
--project-name The project name
--project-app-name The application name
[* - options are required]
\endverbatim
If a project name is provided via the <tt>--project-name</tt> argument, the new plugin will be generated
as part of a new project.
\section NewPluginOnly Creating a new MITK plugin
Here is an example call to the Plugin Generator, creating one plugin with the symbolic name
<tt>com.mycompany.myplugin</tt> and a View named <tt>My View</tt>:
\verbatim
./MitkPluginGenerator --plugin-symbolic-name org.mycompany.myplugin --view-name "My View"
\endverbatim
If you did not already specify the final location of the plugin via the <tt>--out-dir</tt> argument, move the
directory (in our example <tt>/tmp/org.mycompany.myplugin</tt>) to your existing project. Do not forget to add the
plugin in your project's build system (usually in the file <tt>&lt;your-project&gt;/Plugins/Plugins.cmake</tt>).
\section NewPluginWithProject Creating a new MITK project
\subsection NewPluginProjectPrerequisites Prerequisites
MITK-based projects created with the Plugin Generator need the same prerequisites as MITK itself. See the
\ref BuildInstructionsPage for MITK for details.
Here is an example call to the Plugin Generator, creating the same plugin as above but integrated in a new project:
\verbatim
./MitkPluginGenerator --plugin-symbolic-name org.mycompany.myplugin --view-name "My View" --project-name "MyProject" --project-app-name "MyApp"
\endverbatim
The generated project is completely self-contained and can be configured via CMake immediately. When building the
generated project, it will first download all required dependencies (like MITK itself). For an explanation of the
project's build directory layout and how to configure MITK from your project's superbuild CMake configuration,
see \ref HowToNewProject.
\subsection NewPluginLimitations Limitations
The Plugin Generator supports only a very limited set of possible configuration options. For more customizations of your
project or plugin, you must familiarize yourself with CMake and the generated build system.
Further, the generator is not able to modify existing projects, it can only create new ones.
\section NewPluginBuildSystem Build system for plugins
Just put new files in your plugin's \c src or \c src/internal directory and edit the \c files.cmake file there.
If you have any fancy stuff like external libraries and include directories you should have a look at the CMake manual and general MITK build system documentation.
\section NewPluginTroubleshooting Troubleshooting
\par I get "Could not find library" messages and similar stuff when I try to start my project's executable.
This is mostly due to wrong environment settings. On Windows, make sure that you use the supplied batch files to start
Visual Studio or your project's executable. If you still get errors, double check the value of the PATH variable in
your batch files (it must contain MITK's binary directory and paths to the ITK, VTK and Qt libraries.
\par
On Linux, set your LD_LIBRARY_PATH variable accordingly.
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/CMakeFAQ.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/CMakeFAQ.dox
index 7906c0733e..b63ac30697 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/CMakeFAQ.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/CMakeFAQ.dox
@@ -1,41 +1,41 @@
/**
\page CMAKE_FAQ CMake FAQ
\section CMAKE_FAQ_General A general comment
MITK uses %CMake for configuration. If you want to develop either using MITK as a toolkit or by extending the capabilities of the applications provided by us, we recommend using %CMake for your own project too.
While it might be possible to use MITK in conjunction with other options, such as QMake or setting up your own project manually it will invariably involve a lot of work and probably hacks as well.
As we do have no experience with this, we will not be able to help you.
Be prepared to do a lot of tweaking on by yourself.
-This guide does not try to give a general introduction to CMake, instead it tries to answer some basic questions that might arise for those new to %CMake, to help you get started on MITK. For a more comprehensive introduction on %CMake see <a href="http://www.cmake.org/cmake/help/cmake_tutorial.html">here</a>.
+This guide does not try to give a general introduction to CMake, instead it tries to answer some basic questions that might arise for those new to %CMake, to help you get started on MITK. For a more comprehensive introduction on %CMake see <a href="https://cmake.org/cmake/help/latest/guide/tutorial/index.html">here</a>.
We will assume in this guide, that the path to your source is /MITK/.
\section CMAKE_FAQ_Question Basic Questions
\subsection CMAKE_FAQ_Question_WhereGetIt Where do I get CMake and what version do I need?
See \ref BuildInstructions_Prerequisites.
\subsection CMAKE_FAQ_Question_NewPluginNothing I coded a new plugin for the Workbench and nothing happened. Why?
-The correct way to create a new plugin is described in \ref NewPluginOnly. Do note that you need to move the source to the MITK/Plugins directory and you will have to add the plugin to the config file (most likely MITK/Plugins/Plugins.cmake</tt>). After that see \ref CMAKE_FAQ_Question_HowDoIActivatePlugin.
+The correct way to create a new plugin is described in \ref NewPluginOnly. Do note that you need to move the source to the MITK/Plugins directory and you will have to add the plugin to the config file (most likely MITK/Plugins/Plugins.cmake). After that see \ref CMAKE_FAQ_Question_HowDoIActivatePlugin.
\subsection CMAKE_FAQ_Question_HowDoIActivatePlugin I want to use a plugin, how do I activate it?
<ol>
<li> Start %CMake
<li> Configure
<li> Set the variable MITK_BUILD_\<Your-plugin-id-here\> to TRUE
<li> Configure again
<li> Generate
<li> Start a build using your development environment
</ol>
\subsection CMAKE_FAQ_Question_HowDoIActivateModule I want to use a module, how do I activate it?
Modules are build automatically if a plugin that requires them is activated. See \ref CMAKE_FAQ_Question_HowDoIActivatePlugin.
\subsection CMAKE_FAQ_Question_HowOwnToolkits MITK always downloads the toolkits, but I want to use my own.
This is covered in \ref HowToNewProjectCustomizingMITKConfigure.
\subsection CMAKE_FAQ_Question_HowOwnProjectMITK I want to use an MITK plugin in my own project but I can not find it.
See \ref HowToNewProjectAddingMITKFunctionality.
-*/
\ No newline at end of file
+*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Coding.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Coding.dox
index ecf1e27618..21d8b77d3b 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Coding.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Coding.dox
@@ -1,53 +1,53 @@
/**
\page CodingPage Coding
\section CodingPageGeneral General Information
-Conceptually MITK is mainly geared to ITK (<a href="http://www.itk.org">The Insight Toolkit</a>).
+Conceptually MITK is mainly geared to ITK (<a href="https://itk.org/">The Insight Toolkit</a>).
Thus, most of the ITK coding concepts can be transferred to MITK.
-The ITK coding concepts can be found in the free ITK software guide, downloadable at ITKs <a href="http://itk.org/ITK/resources/software.html">homepage</a>.
+The ITK coding concepts can be found in the free <a href="https://itk.org/ItkSoftwareGuide.pdf">ITK software guide</a>.
The main ITK concepts which one should look into before using MITK are:
<ul>
<li> SmartPointers
<li> Pipelining and Filters
</ul>
\section CodingPageStyle Coding Style
MITK provides coding style guidelines. When implementing code which should be added to the project,
these guidelines should be followed in order to keep a unified coding style all over MITK. The style
is geared to a common c++ coding style combined with some extension of used libraries, e.g. the use of
itk smart pointers. The MITK style guide is provided on the page \ref StyleGuideAndNotesPage .
If you are new to coding with MITK please also consider that MITK is using different pre defined macros,
which might look confusing. An overview on these macros is given in section \ref CodingPageMITKMacros.
\section CodingPageMITKMacros Macros in MITK
MITK uses different macros to simplify implementation, but these macros might look confusing at first. Some
of these macros are derived from ITK, others are defined in MITK itself. The most important macros are defined
in the file mitkCommon.h, but there are some other headers which also define macros, e.g. mitkTestingMacros.h
and mitkExceptionMacros.h.
In the following the most important macros are shown for overview, more details are available in the corresponding header files.
\code
//These macros come from ITK:
itkNewMacro(Class);//this macro creates the constructor for smart pointers
//it calls the default c++ constructor of the class
//the default constructor should be declared protected
itkFactorylessNewMacro(Class); //like the itkNewMacro macro but does not use object factories
itkGetMacro(Name,Class); //these macros create getters and setters
itkSetMacro(Name,Class); //automatically, but you need the corresponding
itkGetConstMacro(Name,Class); //member variable m_Name in your class
itkSetConstMacro(Name,Class);
//The following macros are defined in MITK itself:
mitkClassMacro(Class,Superclass); //macro is needed in every header of a MITK class
mitkNewMacro1Param(Class,ParamType); //like the ITK new macro, but with one parameter
//you need a constructor with one parameter as well
//the same macro exists for 2,3 and 4 parameters
mitkExceptionClassMacro(Class,Superclass); //special macro for MITK exception classes
\endcode
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/DirectoryStructure.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/DirectoryStructure.dox
index 4dda6a0e2b..51c9236973 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/DirectoryStructure.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/DirectoryStructure.dox
@@ -1,70 +1,70 @@
/**
\page DirectoryStructurePage Directory Structure
To avoid clutter and ease the administration of the source code the MITK source code is structured into several subdirectories according to their function. This document aims at helping you finding what you want within this structure.
\section DirectoryStructurePageOverview Overview
The top level directories are the following:
\li \ref DirectoryStructurePageApplications
\li \ref DirectoryStructurePageCMake
\li \ref DirectoryStructurePageCMakeExternals
\li \ref DirectoryStructurePageDocumentation
\li \ref DirectoryStructurePageExamples
\li \ref DirectoryStructurePageLicenses
\li \ref DirectoryStructurePageModules
\li \ref DirectoryStructurePagePlugins
\li \ref DirectoryStructurePageTemplates
\li \ref DirectoryStructurePageUtilities
\li \ref DirectoryStructurePageWrapping
see the corresponding section for more information.
\section DirectoryStructurePageTopLevelDirs The Top Level Directories
\subsection DirectoryStructurePageApplications Applications
-This directory contains the different applications. Each application has its own subfolder, including the necessary code, icons and other resources. For more information on applications see \ref ModularizationPageApplications or \ref ApplicationsPageApplications .
+This directory contains the different applications. Each application has its own subfolder, including the necessary code, icons and other resources. For more information on applications see \ref ModularizationPageApplications .
\subsection DirectoryStructurePageCMake CMake
The %CMake directory contains %CMake files, macros and templates for the configuration of MITK as a project.
\subsection DirectoryStructurePageCMakeExternals CMakeExternals
This directory contains %CMake files for the configuration of other projects used by MITK.
\subsection DirectoryStructurePageDocumentation Documentation
The Documentation directory contains doxygen and other documentation as well as tutorials and examples. It includes basic end user manuals for the framework as well as developer documentation which does not depend on any additional modules.
\subsection DirectoryStructurePageExamples Examples
This directory contains example code used by the documentation in the Documentation directory.
\subsection DirectoryStructurePageLicenses Licenses
The Licenses directory contains various licenses used by MITK's dependencies.
\subsection DirectoryStructurePageModules Modules
This directory contains modules, which extend the capabilities of MITK. For the concept behind modules see \ref ModularizationPageModules .
\subsection DirectoryStructurePagePlugins Plugins
This directory contains plugins, which provide specific solutions. For further information see \ref ModularizationPagePlugInBundles .
\subsection DirectoryStructurePageTemplates Templates
This directory contains template files for recurring snippets like the copyright header for all source files.
\subsection DirectoryStructurePageUtilities Utilities
The Utilities directory contains self contained components, which are used by MITK, but not necessarily developed or maintained by the MITK team.
\subsection DirectoryStructurePageWrapping Wrapping
The Wrapping directory contains code necessary for the Python wrapping capabilities of MITK.
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/DocumentationExample.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/DocumentationExample.dox
index 9dcd711aad..0ac05f6a34 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/DocumentationExample.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/DocumentationExample.dox
@@ -1,22 +1,22 @@
/**
\page DocumentationExample Example Class Documentation
This page will try to give an example of some of the most commonly used commands and techniques for documenting
your code using doxygen. The corresponding source file can be found \ref DocumentationExampleTheSourceFile "below".
For the generated documentation page see DocumentationExample .
\section DocumentationExampleAdvanced Advanced Doxygen Usage
For more information on doxygen and its use you can take a look at one of the following resources.
<ul>
- <li> The doxygen <a href="http://www.stack.nl/~dimitri/doxygen/commands.html">Command List</a>
- <li> The doxygen <a href="http://www.stack.nl/~dimitri/doxygen/manual.html">Manual</a>
- <li> The doxygen <a href="http://www.stack.nl/~dimitri/doxygen/faq.html">FAQ</a>
+ <li> The doxygen <a href="https://www.doxygen.nl/manual/commands.html">Command List</a>
+ <li> The doxygen <a href="https://www.doxygen.nl/manual/index.html">Manual</a>
+ <li> The doxygen <a href="https://www.doxygen.nl/manual/faq.html">FAQ</a>
</ul>
\section DocumentationExampleTheSourceFile The Source File
\verbinclude DocumentationExample.h
-*/
\ No newline at end of file
+*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/DocumentationGuide.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/DocumentationGuide.dox
index 6ab7e3e9a8..353ee16c39 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/DocumentationGuide.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/DocumentationGuide.dox
@@ -1,84 +1,84 @@
/**
\page DocumentationGuide Writing Documentation
\section DocumentationGuideCodeGeneral General remarks
-MITK uses <a href="http://www.stack.nl/~dimitri/doxygen/">Doxygen</a> for the generation of our user manual pages as well as for the generation of the on- and offline reference manuals. So on the technical side many questions can be answered by the <a href="http://www.stack.nl/~dimitri/doxygen/manual.html">doxygen documentation</a>, such as the list of commands or a few basic doxygen tutorials.
+MITK uses <a href="https://www.doxygen.nl/">Doxygen</a> for the generation of our user manual pages as well as for the generation of the on- and offline reference manuals. So on the technical side many questions can be answered by the <a href="https://www.doxygen.nl/manual/index.html">doxygen documentation</a>, such as the list of commands or a few basic doxygen tutorials.
Therefore this document is not primarily intended as a guide to using doxygen, the doxygen manual does a much better job of that, but as a guide to use doxygen in MITK and a collection of helpful hints and advise about pittfalls.
Also, of course you need to have doxygen installed to generate documentation.
\section DocumentationGuideCode Documenting the source code
MITK is a substantial project and encompasses many different source files by many different developers over quite a considerable timeframe. Many of them have written excellent code which can do a lot of things and is very helpful to people who might apply it in wholly unlooked for ways to completely different problems. To facilitate this sharing and reusing of ressources one first and foremost has to know what kind of ressources are already available.
Few people write code in the intention for it to be difficult to be used by others, but unfortunately what might seem a very efficient and easily understandable piece of code to the author might be nigh unreadable for someone else. Very often it does not in fact matter whether the code itself is understandable, as long as it one can get the information what a function is supposed to do. While comments in the source file help a lot to gain this knowledge in can get quite tedious go through every file looking for the right tool.
This is where using doxygen pays off by giving a short comment in the header file a reference manual is automatically generated.
While doxygen support several different manners of documentation, the MITK documentation should keep a uniform documentation style:
\warning{
Use <b>only</b> the \verbatim /** ... */ \endverbatim style for documentation.
}
In dire emergencies you may consider commenting via the /// style, others must <b>never</b> be used.
An example:
\verbatim
/** \brief Brief description what the commented part does.
*
* More detailed description. This can be as long as you like,
* whereas the brief description should never be more than one sentence.
*/
\endverbatim
See \subpage DocumentationExample for an exemplary documentation of a class.
\subsection DocumentationGuideCodeHints Helpful hints:
<ul>
<li> Always put comments intended for doxygen in the header files.
</ul>
\section DocumentationGuideManual Writing user manuals
While the usage of your view/perspective/application might seem obvious and accessible to you, to most people it is not. Writing a good manual is key for this. It is very difficult to write a manual which is too comprehensive, most often if something can be done in a wrong way, somebody will see this as the only one.
For MITK purposes you should put your documentation in BUNDLEPATH/documentation/UserManual/QmitkMyViewName.dox .
Give them a unique name and remember to only use alphanumeric characters and underscores. Identifiers like "org.placeA.x" and "org.placeB.y" look identical to doxygen because it only parses the "org". Use "org_placeA_x" instead.
Regarding images: Doxygen looks for images globally. To avoid confusion, include the plugin name into the image. E.g. "Checkboxes.png" is a bad name while "QmitkIGTTracking_Checkboxes.png" is a good name.
Include images only via the image Macro! This way it is automatically included in the pdf export of the documentation.
\verbatim
// The Macro hast he following form (note the braces!):
\imageMacro{imagePath, "Image Description", Image size in cm}
// e.g.:
\imageMacro{QmitkIGTTracking_Checkboxes.png, "Some beautiful Checkboxes!", 5}
// If you must use commas in the description, escape them!
\imageMacro{QmitkIGTTracking_Checkboxes.png, "Some beautiful Checkboxes\, you have never seen better ones! ", 5}
\endverbatim
Image size is only used for the pdf export, but images won't be displayed at all if it is missing. Maximum is 16.
The nightly generated HTML documentation and the Qt Help System documentation can contain different content using the isHTML command.
\subsection DocumentationGuideManualHints Helpful hints:
<ul>
<li> Do not use fullstops (".") in identifiers, it throws doxygen off
<li> Think were your page should go in the MITK help page structure and declare it as a subpage accordingly
<lI> Use the imageMacro instead of the image command
<li> Use structuring elements, such as sections and subsections
<li> Use references to allow for fast navigation
<li> Images, pictures and sketches are great, use them
<li> Use visual help like remark, paragraph and warning
<li> BLUEBERRY_USE_QT_HELP should be set to ON
<li> The plug-in org.blueberry.ui.qt.help should be set to ON
</ul>
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/StyleGuideAndNotes.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/StyleGuideAndNotes.dox
index f06de7fe39..6ad26976e2 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/StyleGuideAndNotes.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/StyleGuideAndNotes.dox
@@ -1,469 +1,466 @@
/**
\page StyleGuideAndNotesPage The MITK Style Guide and Technical Notes
\tableofcontents
The following document is a description of the accepted coding style for the Medical Imaging Interaction Toolkit (MITK). Developers who wish to contribute code to MITK should read and adhere to the standards described here.
\section StyleGuideAndNotesPage_NameConventions Naming Conventions
\li Using case change to indicate separate words
@code
ImageFilter
PixelType
DataStorage
NodePredicateProperty
@endcode
\li Underscores are not used e.g. Image_Filer, _Node
\li Variable names should convey the meaning behind the code
@code
BoundingBox::Pointer boundingBox = BoundingBox::New();
@endcode
\li Names are generally spelled out
@code
mitk::DataNode* node;
@endcode
\li Abbreviation are allowable when in common use e.g. ROI for Region of
Interest
\subsection StyleGuideAndNotesPage_NamingClasses Naming Classes
\li Classes are named beginning with a capital letter
\li Classes are named according to the following general rule:
@code
class name = <algorithm><input><concept>
@endcode
\li Examples of concepts \n
<b>Accessor</b>: Access and convert between types e.g. NullScalarAccessor \n
<b>Container</b>: A container of objects such as points or images e.g. VectorContainer \n
<b>Filter</b>: A class that participates in the data processing pipeline e.g. AddImageFilter \n
<b>Mapper</b>: Transform data from one form into another e.g. ContourMapper2D \n
<b>Reader/Writer</b>: A class that reads/writes a single data object e.g. VtkSurfaceReader \n
\subsection StyleGuideAndNotesPage_NamingFiles Naming Files
\li MITK classes like @a ExampleClass should be in namespace @a mitk and their corresponding files should be named @a mitkExampleClass.h/.cpp.
@code
mitk::DataStorage
@endcode
\li Qt specific MITK classes like @a QmitkListView should have the prefix Qmitk in their class names and their corresponding files should be named @a QmitkListView.h/.cpp.
@code
QmitkDataStorageComboBox
@endcode
\li Header Files ends with an .h and
\li Implementation Files with an .cpp or .txx for a template class
\subsection StyleGuideAndNotesPage_NamingMethodsandFunctions Naming Methods and Functions
\li Functions and methods are named beginning with a capital letter
\li Referring to class methods in code, an explicit this-> pointer should be
used
@code
mitk::DataStorage::SetOfObjects::ConstPointer all = this->GetAll();
@endcode
\subsection StyleGuideAndNotesPage_NamingSignalSlots Naming Signal/Slots Methods and Functions
\li Slots are named according to the following general rule
@code
On[variable name who send the signal][signal]();
@endcode
\li Example
@code
connect( loadImagePushButton, SIGNAL( clicked(bool ) ),
SLOT( OnLoadImagePushButtonClicked( bool ) ) );
void mitk::Image::OnLoadImagePushButtonClicked( bool )
{
... Do something ...
}
@endcode
\li Signals are named according to the following general rule
@code
Signal[MethodName]();
@endcode
\li Example
@code
emit SignalFinishedSegmentation();
@endcode
\subsection StyleGuideAndNotesPage_NamingClassDataMembers Naming Class Data Members
\li Class data members are prefixed with m_
@code
m_Volumes
m_OffsetTable
m_ImageMask
@endcode
\li An exception to this rule, Qt class Data members are not prefixed and begin with a lower-case letter
@code
loadImageButton
closeImageAction
@endcode
\subsection StyleGuideAndNotesPage_NamingLocalVariables Naming Local Variables
\li Local variables first letter is lower-case
@code
offset
data
slicesIt
@endcode
\subsection StyleGuideAndNotesPage_NamingQtVariables Naming Qt Variables
\li GUI variables ends with name of used QT tool.
@code
QPushButton* loadImagePushButton;
QAction* closeImageAction;
QCheckBox* hideImageCheckBox;
QRadioButton* binaryImageRadioButton;
@endcode
\subsection StyleGuideAndNotesPage_NamingTypedefs Naming Typedefs
\li Typedefs must end in the word Type
@code
typedef TPixel PixelType;
typedef itk::Image< TPixel, VImageDimension > ImageType;
typedef std::list<mitk::Image::Pointer> ImageListType;
@endcode
\section StyleGuideAndNotesPage_Pointer Pointer
\subsection StyleGuideAndNotesPage_DeclarationofPointers Declaration of Pointers
\li Position of * pointers are connected with the variable
@code
int *counter;
@endcode
\li Analog to references
@code
int &counter;
@endcode
\subsection StyleGuideAndNotesPage_SmartPointer SmartPointer
\li SmartPointers must be used for classes that have itk::Object as a base
class.
\li Assignment of a just created instance to a normal pointer results in a
crash, since the reference count is decreased immediately to zero and the
object is destroyed.
@code
itk::Object::Pointer object = itk::Object::New();
@endcode
\li Static declarations are also forbidden and result into an exception when
the scope of the variable is left, because the destructor is called while the
reference count is still greater than zero.
\li Note that using smart pointers requires using real (normal) pointers when
setting input. If you want to return a newly created smart pointer that
is not also kept within the class (e.g., if you write a Clone method), you
have to return a smart pointer on output (compare itkMacro.h). If the
smart pointer is kept within the class, returning a real (normal) pointer
is sufficient.
\li Testing a SmartPointer against NULL is done with the IsNull() and Is-
NotNull() methods. A simple ==NULL issues a warning.
\section StyleGuideAndNotesPage_Namespace Namespace
\li MITK classes should be in namespace @a mitk
@code
mitk::Image::Pointer mitk::ImageGenerator::MakeImage()
{
// already in namespace mitk here!
Image::Pointer image = mitk::Image::New();
ImageDecorator::Pointer decorator = mitk::ImageDecorator::New();
d->Decorate( image );
return image;
}
@endcode
\li Constants in MITK for mitk::Operation and mitk::Action are set in
namespace, so don't forget to add prefix mitk::
@code
switch (actionId)
{
case mitk::AcMOVESELECTED:
....Do something ...
break;
default:
break;
}
@endcode
\section StyleGuideAndNotesPage_CodeLayoutandIndentation Code Layout and Indentation
\subsection StyleGuideAndNotesPage_GeneralLayout General Layout
\li Each line of code should take no more than 120 characters.
\li Use lots of whitespace to separate logical blocks of code, intermixed with
comments
\li <b>DO NOT USE TABS.</b> The standard indention is <b>2 spaces</b> (see <a href="https://itk.org/Wiki/images/c/c6/ITKStyle.pdf">ITK Style Guide</a>). Configure your
editor accordingly.
\li DO NOT USE trailing whitespaces
\li Declaration of variables should be one declaration per line
@code
int sliceNumber;
char* stringName;
ImageType::Pointer image;
@endcode
\subsection StyleGuideAndNotesPage_ClassLayout Class Layout
\li Copyright
@code
/*============================================================================
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.
============================================================================*/
@endcode
\li Includes [A .. Z]
@code
#include "... .h"
@endcode
\li Namespace
@code
namespace mitk
{
@endcode
DO NOT litter your header with "using namespace;"!
\li Class (Template)
@code
template <class TType>
class ClassName : public ImageBase<VImageDimension>
{
@endcode
\li Typedefs
@code
public:
....typedefs....
@endcode
\li Methods
@code
public:
....methods....
protected:
....methods....
private:
....methods....
@endcode
\li QT Signals
@code
signals:
Signal...();
@endcode
\li QT Slots
@code
public slots:
On...();
protected slots:
On...();
@endcode
\li Data Member
@code
private/protected:
....class data members....
};
}
#endif
@endcode
\section StyleGuideAndNotesPage_UseofBraces Use of Braces
\li Used to delimit the scope of an if, for, while, switch.
\li Braces are placed on a line by themselves:
@code
for ( unsigned int i = 0; i < 3; ++i )
{
... do something ...
}
@endcode
or
@code
if ( condition )
{
... do something ...
}
else if ( other condition )
{
... do something ...
}
else
{
... do something ...
}
@endcode
\li You can choose to use braces on a line with a code block when the block
consists of a single line:
@code
if ( condition ) { foo = 1; }
else if ( condition2 ) { foo = 3; }
else { return; }
@endcode
or
@code
for ( unsigned int i = 0; i < 3; ++i) { x[i] = 0.0; }
@endcode
\section StyleGuideAndNotesPage_IncludeGuards Include Guards
-\li #inlcude guard is a particular construct used to avoid the problem of
-double inclusion when dealing with the #include directive.
+\li \#include guard is a particular construct used to avoid the problem of
+double inclusion when dealing with the \#include directive.
-\li Naming convention for #inlcude guards is: ClassName_h
+\li Naming convention for \#include guards is: ClassName_h
-\li Following example demonstrates a problem that can arise if #include guards
+\li Following example demonstrates a problem that can arise if \#include guards
are missing: Here, the file child.cpp has indirectly included two copies of the text in the
header file grandfather.h. This causes a compilation error, since the structure
type foo is apparently defined twice.
@code
grandfather.h struct foo
{
int m Member;
};
father.h #include "grandfather.h"
child.h #include "grandfather.h"
#include "father.h"
@endcode
-\subsection StyleGuideAndNotesPage_Useofincludeguards Use of #include guards
+\subsection StyleGuideAndNotesPage_Useofincludeguards Use of \#include guards
\li Here, the first inclusion of grandfather.h causes the macro grandfather h to
be defined. Then, when child.cpp includes grandfather.h the second time,
-the #ifndef test fails, and the preprocessor skips down to the #endif, thus
+the \#ifndef test fails, and the preprocessor skips down to the \#endif, thus
avoiding the second definition of struct foo. The program compiles correctly.
@code
grandfather.h #ifndef grandfather h
#define grandfather h
struct foo
{
int m Member;
};
father.h #include "grandfather.h"
child.h #include "grandfather.h"
#include "father.h"
@endcode
\section StyleGuideAndNotesPage_TechnicalNotes Some Technical Notes
\li Use forward declarations in header files wherever possible. Only include those header files in a header file
that are really necessary. Include the rest in the implementation file.
\li For classes inheriting directly or indirectly from @a itk::LightObject (most of the MITK-classes do so), the
class definition should include the mitkClassMacro. Additionally, if the class can be instantiated (normally the case,
if the class is not abstract) and has @em only a constructor without parameters, the constructor should be declared
protected and the @a itkFactorylessNewMacro should be used to create a @a New() method for instantiation. Here is an example:
@code
class ExampleClass : public SuperClassOfTheExampleClass
{
public:
mitkClassMacro(ExampleClass, SuperClassOfTheExampleClass)
itkFactorylessNewMacro(Self)
[...]
protected:
ExampleClass();
virtual ~ExampleClass();
}
@endcode
\li Set- and Get-methods can be created with the macros @a itkSetObjectMacro(name,type) and
@a itkGetObjectMacro(name,type), respectively, if the @a type is derived from @a itk::LightObject or
-@a itk::Object. There are also macros for other types, e.g., strings, see
-<a href="http://www.itk.org/Doxygen12/html/itkMacro_8h.html">itkMacro.h</a>.
+@a itk::Object.
\li When using inner classes of a parent class which is templated, you have
to use the keyword @a typename for gcc 3.x and standard compliance. For example,
@a TreeChangeListener is an inner class of @a Tree, therefore use:
@code
class LinkedTree : public Tree<T>
{
public:
typedef typename LinkedTree<T>::TreeChangeListener TreeChangeListener;
[...]
}
@endcode
Another example:
@code
typename std::vector<TreeChangeListener*>::iterator pos = treeChangeListenerList.begin();
@endcode
@a iterator is an inner class of @a vector.
\li Constants in MITK for mitk::Operation and mitk::Action are set in namespace, so don't forget to add prefix @a mitk::
@code
switch (actionId)
{
case mitk::AcMOVESELECTED:
@endcode
Prefixes for the constants are to be used like corresponding others. See file @a Interactions\\mitkBaseInteraction\\mitkInteractionConst.h for further details.
\section StyleGuideAndNotesPage_AutomaticCodeFormatting Automatic Code Formatting
We offer a .clang-format file, which can be used to automatically format code acceptably.
-\include .clang-format
-
-For an explanation of the different options check out http://clang.llvm.org/docs/ClangFormatStyleOptions.html
+For an explanation of the different options check out https://clang.llvm.org/docs/ClangFormatStyleOptions.html
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step01.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step01.dox
index b37513c15c..31959c88f0 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step01.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step01.dox
@@ -1,27 +1,27 @@
/**
\page Step01Page MITK Tutorial - Step 1: Displaying an image
\li Path to files used in this step: \n
-http://mitk.org/download/tutorial-data/Pic3D.nrrd
+https://www.mitk.org/download/tutorial-data/Pic3D.nrrd
\imageMacro{step1_result.png,"",6.22}
Open your IDE. All steps can be found among the listed projects.
The first program shows how to display an image in a 2D view. The picture above is a screenshot of the program.
The program has to be executed using the image file Pic3D.nrrd.
If you are using Visual Studio start MITK.sln in your bin\\ subdirectory to start it with all required paths set.
To set the image file path in Visual Studio, right click on "MitkStep1"-project and go to 'Properties -> Configuration Properties -> Debugging'.
Now insert the image file path to Pic3D.nrrd in the "Command Arguments" text field.
Then right click on the "MitkStep1"-project again and select "Set as StartUp Project". Start to run the code. Use this also in the following steps.
\imageMacro{configureVisualStudioProperties.png,"",11.85}
The code is divided into parts I through V. First of all a DataTree has to be created. Then data has to be read from a file which afterwards has to be put into the tree. Part IV creates a window and passes the tree to it. The last part deals with some Qt-specific initialization.
\include Step1.cpp
\ref Step00Page "[Previous step]" \ref Step02Page "[Next step]" \ref TutorialPage "[Main tutorial page]"
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step02.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step02.dox
index 4d64b09c38..56d7eaa879 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step02.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step02.dox
@@ -1,29 +1,27 @@
/**
\page Step02Page MITK Tutorial - Step 2: Load one or more data sets
- \li \ref Step2.cpp "Step2.cpp" \n
- Contains the code for this example.
- \li Path to files used in this step: \n
-http://mitk.org/download/tutorial-data/Pic3D.nrrd (image) \n
-http://mitk.org/download/tutorial-data/lungs.vtk (surface)
+ \li Examples/Tutorial/Step2
+ \li https://www.mitk.org/download/tutorial-data/Pic3D.nrrd (image) \n
+https://www.mitk.org/download/tutorial-data/lungs.vtk (surface)
\image html step2_result.png
\dontinclude Step2.cpp
This program shows how to load multiple data sets.
The picture above shows the result of the program when reading both the image file and the surface file.
In order to obtain the result the program has to be executed using the image file Pic3D.nrrd and the surface file lungs.vtk.
The code for this example equals the code of Step 1 except for part II and part III which are changed as follows:
\skipline Part II
\until mitk::IOUtil::Load(argv[i],*storage);
\line }
\ref Step01Page "[Previous step]" \ref Step03Page "[Next step]" \ref TutorialPage "[Main tutorial page]"
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step03.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step03.dox
index 606a7bf27e..2ca501aa3c 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step03.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step03.dox
@@ -1,49 +1,47 @@
/**
\page Step03Page MITK Tutorial - Step 3: Create 3D view
- \li \ref Step3.cpp "Step3.cpp" \n
-Contains the code that both creates a 3D view and turns volume rendering on.
- \li Path to files used in this step: \n
-http://mitk.org/download/tutorial-data/Pic3D.nrrd (image) \n
-http://mitk.org/download/tutorial-data/lungs.vtk (surface)
+ \li Examples/Tutorial/Step3
+ \li https://www.mitk.org/download/tutorial-data/Pic3D.nrrd (image) \n
+https://www.mitk.org/download/tutorial-data/lungs.vtk (surface)
As in the previous step, one or more data sets (many images, surface and other formats) may be loaded. The difference is that they are displayed in a 3D view.
The QmitkRenderWindow is now used for displaying a 3D view, by setting the used mapper-slot to Standard3D.
Since volume-rendering is a (rather) slow procedure, the default is that images are not displayed in the 3D view.
\li Step 3a works for default condition for surface mesh. To run this tutorial with Step 3a, pass the argument as "lungs.vtk" (without quotes).
\li Step 3b works for surface mesh with volume rendering. To run this tutorial with Step 3b, pass the arguments as "Pic3D.nrrd lungs.vtk" (without quotes).
\section Step3aSection Step 3a - Volume rendering turned off
\imageMacro{step3a_result.png,"",6.22}
\dontinclude Step3.cpp
Tell the renderer to create a 3D view:
\skipline // Use it as a 3D view!
\skipline renderWindow.GetRenderer()->SetMapperID
The rest of the code remains unchanged.
The picture above shows the result of the program when reading both the image and the surface file.
As volume rendering is off the image is not visible.
\section Step3bSection Step 3b - Volume rendering turned on
\imageMacro{step3b_result.png,"",6.22}
Volume Rendering is now turned on as shown in the picture above.
\dontinclude Step3.cpp
The property "volumerendering" has to be enabled on the node containing the image.
\skipline Check
\until node->SetProperty
\ref Step02Page "[Previous step]" \ref Step04Page "[Next step]" \ref TutorialPage "[Main tutorial page]"
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step04.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step04.dox
index 32ec61e7c2..e399106c64 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step04.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step04.dox
@@ -1,69 +1,67 @@
/**
\page Step04Page MITK Tutorial - Step 4: Use several views to explore data
-\li \ref Step4.cpp "Step4.cpp"\n
-Contains the code of step 4a + b.
-\li Path to files used in this step: \n
-http://mitk.org/download/tutorial-data/Pic3D.nrrd (image) \n
-http://mitk.org/download/tutorial-data/lungs.vtk (surface)
+\li Examples/Tutorial/Step4
+\li https://www.mitk.org/download/tutorial-data/Pic3D.nrrd (image) \n
+https://www.mitk.org/download/tutorial-data/lungs.vtk (surface)
As in Step 2 and Step 3 one or more data sets may be loaded.
This now creates three views on the data.
The QmitkRenderWindow is used for displaying a 3D view as in Step 3, but without volume-rendering.
Furthermore two 2D views for slicing through the data are created.
The class QmitkSliceWidget is used, which is based on the class QmitkRenderWindow, but additionally provides sliders to slice through the data. We create two instances of
QmitkSliceWidget, one for axial and one for sagittal slicing.
Step 4b enhances the program in that the two slices are also shown at their correct position in 3D as well as intersection-line, each in the other 2D view.
As in the previous steps, to obtain the result the program has to be executed using the image file Pic3D.nrrd and the surface file lungs.vtk.
\section Step4aSection Step 4a - Create axial and sagittal view
\imageMacro{step4a_result.png,"",11.01}
\dontinclude Step4.cpp
Create a Qt horizontal box for the layout:
\skipline QHBox
Then create a renderwindow:
\skipline QmitkRenderWindow
\until SetMapperID
Create a 2D view for slicing axially:
\skipline view2
\until view2.SetData
Then create a 2D view for slicing sagitally.
\skipline view3
\until view3.SetData
The toplevelWidget is now the new main widget:
\skipline qtapplication
\skipline toplevelWidget.show
\section Step4bSection Step 4b - Display slice positions
\imageMacro{step4b_result.png,"",11.01}
We now want to see the position of the slice in 2D and the slice itself in 3D.
Therefore it has to be added to the tree:
\dontinclude Step4.cpp
\skipline ds->Add(view2.GetRenderer()
\skipline ds->Add(view3.GetRenderer()
Slice positions are now displayed as shown in the picture.
\dontinclude Step4.cpp
\ref Step03Page "[Previous step]" \ref Step05Page "[Next step]" \ref TutorialPage "[Main tutorial page]"
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step05.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step05.dox
index 88b5e6dfad..96ff8fc34f 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step05.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step05.dox
@@ -1,40 +1,38 @@
/**
\page Step05Page MITK Tutorial - Step 5: Interactively add points
- \li \ref Step5.cpp "Step5.cpp"\n
- Contains the code for this step.
- \li Path to files used in this step: \n
-http://mitk.org/download/tutorial-data/Pic3D.nrrd (image) \n
-http://mitk.org/download/tutorial-data/lungs.vtk (surface)
+ \li Examples/Tutorial/Step5
+ \li https://www.mitk.org/download/tutorial-data/Pic3D.nrrd (image) \n
+https://www.mitk.org/download/tutorial-data/lungs.vtk (surface)
In addition to Step 4 where 3 views were created on the data, we now want to interactively add points.
A node containing a PointSet as data is added to the data tree and a PointSetDataInteractor is associated with the node, which handles the interaction.
The @em interaction @em pattern is defined in a state-machine, stored in an external XML file. Thus, we need to load a state-machine.
A state machine describes interaction pattern with different states (states beeing something like "a point is selected") and transitions to these states (e.g. "select a point").
These transitions are associated with actions. In this way it is possible to model complex interaction schemes.
By what these transitions and actions are triggered is described in a configuration file. It maps user events to identifiers that are used in the state machine patterns.
In this way the user interaction can be changed by simply loading a different configuration file for a state machine, and the user may add points now with a right click instead of
left click + SHIFT, as in our case.
Therefore after loading the state machine pattern the PointSetDataInteractor is also given a event configuration file.
More information about interaction in MITK can be found \ref InteractionPage "here".
In order to add a point the shift key has to be pressed while left clicking in a render window.
You can also move points or remove them (left click while pressing ALT).
\image html step5_result.png
\dontinclude Step5.cpp
A PointSet and a node for it have to be created to be able to interactively adding points:
\skipline mitk::PointSet
\until interactor->SetDataNode(pointSetNode)
\ref Step04Page "[Previous step]" \ref Step06Page "[Next step]" \ref TutorialPage "[Main tutorial page]"
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step06.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step06.dox
index 9ca0db2336..291199950c 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step06.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step06.dox
@@ -1,117 +1,110 @@
/**
\page Step06Page MITK Tutorial - Step 6: Use an interactive region-grower
The source is now split among several files:
-\li \ref Step6.cpp "Step6.cpp"
-\li \ref Step6.h "Step6.h"
-\li \ref Step6RegionGrowing.txx "Step6RegionGrowing.txx"
-\li \ref Step6RegionGrowing1.cpp "Step6RegionGrowing1.cpp"
-\li \ref Step6RegionGrowing2.cpp "Step6RegionGrowing2.cpp"
-\li \ref Step6main.cpp "Step6main.cpp"
-\li Path to files used in this step: \n
-http://mitk.org/download/tutorial-data/Pic3D.nrrd (image)
-
+\li Examples/Tutorial/Step6
+\li https://www.mitk.org/download/tutorial-data/Pic3D.nrrd (image)
In this step the program is enhanced by the possibility to start a region-grower at interactively added points.
We will see how MITK images can be accessed as ITK images.
We now load the image file Pic3D.nrrd only since the surface will be the result of the region-growing.
Add points in the image by pressing SHIFT+left mouse key, then adjust the thresholds and press 'Start region growing'.
\imageMacro{step6_result.png,"",13.55}
The class Step6 inherits from QWidget and provides methods for setting up the widgets.
-Step6RegionGrowing.cpp contains a method for performing the region-growing. Step6main.cpp contains main.
+%Step6RegionGrowing.cpp contains a method for performing the region-growing. %Step6main.cpp contains main.
Like in ITK and VTK class member names start with m_ followed by the proper member name starting with a capital letter (e.g. m_Tree).
Function names start with capital letters. To learn more about style conventions in MITK read \ref StyleGuideAndNotesPage "The MITK Style Guide".
\dontinclude Step6.cpp
The widgets are initialized as in the previous steps but with an additional QVBox for a button to start the segmentation:
\skipline Create controlsParent
\until hlayout->addWidget(m_LineEditThresholdMax)
This creates a button to start the segmentation and its clicked() signal is connected to the method StartRegionGrowing():
\dontinclude Step6.cpp
\skipline QPushButton *startButton
\skipline connect(startButton
\section AccessMTIKImagesAsITKImagesSection Access MITK images as ITK images
ITK images are templated whereas mitk::Images are not. To use ITK filters with MITK images, we have to convert from MITK to ITK. To do so, first
define an access method, which is templated as an ITK image is:
\code
template<TPixel, VImageDimension>
MyAccessMethod(itk::Image<TPixel, VImageDimension>* itkImage)
{
...
}
\endcode
If you don't understand this template syntax, you should read any C++ text book. Understanding template syntax is crucial to successfully using ITK.
To call this templated method with an (untemplated) mitk::Image, you can use the AccessByItk macro from mitkImageAccessByItk.h. This macro checks for
the actual image type of the mitk::Image and does any neccessary conversions. Look into "Modules / Adaptor classes" for more information.
\code
AccessByItk(mitkImage, MyAccessMethod)
\endcode
\dontinclude Step6RegionGrowing.txx
-In this step our access method is called RegionGrowing() (defined in \ref Step6RegionGrowing.txx "Step6RegionGrowing.txx"):
+In this step our access method is called RegionGrowing() (defined in %Step6RegionGrowing.txx ):
\skipline template
\until } //RegionGrowing()
Additionally the access function has to be instantiated for all datatypes and two/three dimensions as some compilers have memory problems without this explicit instantiation, some even need instantiations in separate files for 2D/3D: \n
-For 2D in \ref Step6RegionGrowing1.cpp "Step6RegionGrowing1.cpp" :
+For 2D in %Step6RegionGrowing1.cpp :
\dontinclude Step6RegionGrowing1.cpp
\skipline InstantiateAccessFunctionForFixedDimension
-... and for 3D in \ref Step6RegionGrowing2.cpp "Step6RegionGrowing2.cpp":
+... and for 3D in %Step6RegionGrowing2.cpp :
\dontinclude Step6RegionGrowing2.cpp
\skipline InstantiateAccessFunctionForFixedDimension
\dontinclude Step6.cpp
The method StartRegionGrowing() finally calls our access method RegionGrowing():
\skipline Step6::StartRegionGrowing
\until }
\section ConvertingITKMITKSection Converting ITK images to MITK images and vice versa
In some cases it is useful to simply convert between ITK and MITK images. The direction ITK to MITK is easy, since mitk::Image can handle most data types. The direction MITK to ITK is more critical, since ITK images have to be instantiated with a fixed pixel type and fixed dimension at compile time.
\li \code mitk::Image mitk::ImportItkImage(itk::Image<...>) \endcode
\li \code mitk::CastToItkImage(mitkImage, itk::Image<...>) \endcode
\section ConnectingMITKToVTKSection Connecting MITK images to VTK
Images are not converted or copied: The data array is just accessed via an encapsulating VTK object.
\li \code vtkImageData* mitk::Image::GetVtkImageData(int time = 0) \endcode
\section SurfacesMITKToVTKSection MITK Surfaces to VTK and vice versa
Again: not a conversion, just accessing.
\li \code vtkPolyData* mitk::Surface::GetVtkPolyData(int time = 0) \endcode
\li \code mitk::Surface::SetVtkPolyData(vtkPolyData*, int time = 0) \endcode
\ref Step05Page "[Previous step]" \ref Step07Page "[Next step]" \ref TutorialPage "[Main tutorial page]"
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step07.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step07.dox
index 91827ef670..7afcab6109 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step07.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step07.dox
@@ -1,21 +1,18 @@
/**
\page Step07Page MITK Tutorial - Step 7: Convert result of region growing into a surface
- \li \ref Step7.cpp "Step7.cpp"\n
- \li \ref Step7.h "Step7.h"\n
- \li \ref Step7main.cpp "Step7main.cpp"\n
- \li Path to files used in this step: \n
-http://mitk.org/download/tutorial-data/Pic3D.nrrd (image)
+ \li Examples/Tutorial/Step7
+ \li https://www.mitk.org/download/tutorial-data/Pic3D.nrrd (image)
In this step the result of the previous step is converted into a surface by means of a VTK filter.
Step7 inherits from Step6. It enhances the method StartRegionGrowing() by processing the result image.
\dontinclude Step7.cpp
\skipline if (m_ResultImage
\until }
\ref Step06Page "[Previous step]" \ref Step08Page "[Next step]" \ref TutorialPage "[Main tutorial page]"
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step08.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step08.dox
index d4de241f01..c066d688e1 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step08.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step08.dox
@@ -1,25 +1,22 @@
/**
\page Step08Page MITK Tutorial - Step 8: Use QmitkStdMultiWidget as widget
- \li \ref Step8.cpp "Step8.cpp"\n
- \li \ref Step8.h "Step8.h"\n
- \li \ref Step8main.cpp "Step8main.cpp"\n
- \li Path to files used in this step: \n
-http://mitk.org/download/tutorial-data/Pic3D.nrrd (image)
+ \li Examples/Tutorial/Step8
+ \li https://www.mitk.org/download/tutorial-data/Pic3D.nrrd (image)
In this step a QmitkStdMultiWidget is used. It offers four views of the data.
From top left to bottom left the views are initialized as axial, sagittal and coronar. The bottom right view is initialized as 3D view.
\image html step8_result.png
Step8 inherits from Step6. The method SetupWidgets() is changed: A QmitkStdMultiWidget is used instead of one QmitkRenderWindow and two instances of QmitkSliceWidget.
\dontinclude Step8.cpp
\skipline Part Ia
\until levelWindowWidget->SetDataStorage(m_DataStorage);
\ref Step07Page "[Previous step]" \ref Step09Page "[Next step]"
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step09.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step09.dox
index 30574b17d4..e3da27c87c 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step09.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step09.dox
@@ -1,80 +1,80 @@
/**
\page Step09Page MITK Tutorial - Step 9: A plug-in
MITK uses a very modular concept to maximize reusability and portability. A MITK application based on the BlueBerry
application framework (for example the MITK Workbench) consists of several bundles (or plug-ins). A bundle can contain
resources and program logic. It can also contribute so-called Views to the main application, which provide a specific
user interface for controlling the bundles functions.
The creation of a MITK plug-in is considerably facilitated by using the MITK PluginGenerator as described in \ref NewPluginPage if you want to add a new view to an existing plugin see \ref NewViewPage.
The mentioned tool was used to create a plug-in called org.mitk.example.gui.regiongrowing.
Let's first take a look at which files the PluginGenerator has created:
\verbatim
documentation\doxygen\
modules.dox......................... Doxygen file for documenting your plug-in
resources\
icon.png............................ The icon of your plug-in. GIMP or other programs (including your text editor)
can be used to change this
src\internal\
QmitkRegionGrowingView.cpp.......... The most important file, implementing behaviour
QmitkRegionGrowingView.h............ Header file of the functionality
QmitkRegionGrowingViewControls.ui... XML file of the Qt Designer, describes buttons, combo boxes, etc. of your controls
CMakeLists.txt \...................... Build system related files for CMake
files.cmake /
manifest_headers.cmake................ Information about your plug-in
plugin.xml ........................... BlueBerry integration
\endverbatim
If you are not familiar with Qt development, please look into
-<a href="http://doc.qt.io/qt-5/qtdesigner-manual.html">this Qt company page describing .ui files</a> (no, forget about the please, DO it!)
+<a href="https://doc.qt.io/qt-5/qtdesigner-manual.html">this Qt company page describing .ui files</a>
The C++ files implement a subclass of QmitkAbstractView. In this special case of QmitkRegionGrowing, we added the option to set some seed points and run a region grower. If you are interested in the concrete changes necessary to turn a freshly generated QmitkRegionGrowing into an integrated one:
The plug-in will be build as part of MITK Workbench. Do use it start MITK Workbench an select the region growing view in the view menu.
To add a mitk::PointSet for the seed points:
QmitkRegionGrowingView.h
Add includes and forward declarations:
\snippet QmitkRegionGrowingView.h includes
Add the point set and a pointer to a QmitkPointListWidget as a private member:
\snippet QmitkRegionGrowingView.h members
QmitkRegionGrowingView.cpp
CreateQtPartControl():
\snippet QmitkRegionGrowingView.cpp cpp-createqtpartcontrol
To use the ITK region grower:
QmitkRegionGrowingView.h
Add the private method:
\snippet QmitkRegionGrowingView.h itkimageprocessing
QmitkRegionGrowingView.cpp
Add includes:
\snippet QmitkRegionGrowingView.cpp cpp-includes
DoImageProcessing():
\snippet QmitkRegionGrowingView.cpp cpp-doimageprocessing
And add the new method:
\snippet QmitkRegionGrowingView.cpp cpp-itkimageaccess
Have fun using MITK!
If you meet any difficulties during your first steps, don't hesitate to ask on the MITK mailing list mitk-users@lists.sourceforge.net!
People there are kind and will try to help you.
\ref Step08Page "[Previous step]" \ref Step10Page "[Next Step]" \ref TutorialPage "[Main tutorial page]"
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step10.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step10.dox
index e863011a4d..ea9e4d01e8 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step10.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Step10.dox
@@ -1,499 +1,501 @@
/**
\page Step10Page MITK Tutorial - Step 10: Adding new Interaction
\tableofcontents
\section HowToUseDataInteractor Step 01 - How to use an existing DataInteractor in your Module/Plugin/...
MITK provides finished DataInteractors for a variety of tasks, they can be found in Core/Code/Interactions. They can be used with
state machine patterns and config files located under Core/Code/Resources/Interactions.
A mitk::DataInteractor consists of four parts. The class describing the functionality and two XML files; one describes the state machine pattern, that is the workflow of an interaction and
the second describes the user events which trigger an action. Lastly every mitk::DataInteractor works on a mitk::DataNode in which it stores and manipulates data.
To use a mitk::DataInteractor these parts have to be brought together.
** TODO add code of mitk::PointSetDataInteractor Plugin ..
<b>This code demonstrates the use of an existing mitk::DataInteractor exemplary for the mitk::PointSetDataInteractor:</b>
First we need a mitk::DataNode in which the PointSets is stored. It has to be added to the mitk::DataStorage.
\code
mitk::DataNode::Pointer dataNode = mitk::DataNode::New();
GetDataStorage()->Add(dataNode.GetPointer());
\endcode
Then we create an instance of a mitk::PointSetDataInteractor and load a predefined statemachine pattern as well as a configuration
for it:
\code
m_CurrentInteractor = mitk::PointSetDataInteractor::New();
m_CurrentInteractor->LoadStateMachine("PointSet.xml");
m_CurrentInteractor->SetEventConfig("PointSetConfig.xml");
\endcode
Lastly the mitk::DataNode is added to the mitk::DataInteractor
\code
m_CurrentInteractor->SetDataNode(dataNode);
\endcode
now the mitk::DataInteractor is ready for usage.
\section HowToModifyInteraction Step 02 - How to modify the behaviour of a DataInteractor
The behavior of a mitk::DataInteractor is determined by two aspects. One, the state machine pattern which describes the flow/order of actions
that are performed. Secondly the configuration which determines which user interaction triggers the actions.
\subsection ModifyDisplayInteractorBehavior How to modify the display interactor behavior
Sometimes it may be desirable to change the behaviour of the mitk::DisplayInteractor which controls zooming, panning and scrolling, e.g. when a
Tool is activated that reacts to the same events. Changing the behavior of the DisplayInteractor (or possibly any other EventHandler) can be achieved from anywhere
in the code by requesting the InteractionEventObserver and assigning an alternative configuration to it, as demonstrated in this example:
\code
std::ifstream* configStream = new std::ifstream( #path to alternative configuration file# );
mitk::EventConfig newConfig(configStream);
// Requesting all registered EventObservers
std::list<mitk::ServiceReference> listEventObserver = GetModuleContext()->GetServiceReferences<InteractionEventObserver>();
for (std::list<mitk::ServiceReference>::iterator it = listEventObserver.begin(); it != listEventObserver.end(); ++it)
{
DisplayInteractor* displayInteractor = dynamic_cast<DisplayInteractor*>(GetModuleContext()->GetService<InteractionEventObserver>(*it));
// filtering: only adjust the DisplayInteractor
if (displayInteractor != NULL)
{
displayInteractor->SetEventConfig(newConfig);
}
}
\endcode
\section SectionImplementationDataInteractor How to implement a new DataInteractor
This second part of the tutorial step goes beyond the activation of an interactor, that modifies data by user interaction) as shown above. It shows what needs to be implemented to add a new way of interaction within your MITK application.
-Please see \ref DataInteractionPage as an introduction to the MITK interaction mechanism, you may also want to read \ref DataInteractionTechnicalPage.
+Please see \ref DataInteractionPage as an introduction to the MITK interaction mechanism.
This tutorial is structured as follows: The first section deals with config files, describing all the parameters of events and how to use them
in a configuration file. In the second section the basics are described that are needed to write a state machine pattern. The last section
deals with brining configuration, state machine pattern and code together and gives an exemplary implementation of a mitk::DataInteractor.
\section ConfigFileDescriptionSection How to create a Config-File
\subsection EventDescriptionSection Event Description
Events are described by their parameters. Each event type has its own set of parameters that can be set in the configuration file.
If a parameter is omitted it is set to its default value. All possible parameters are listed and described below. Event parameters
are also described in the documentation of the event class itself.
Mandatory for each event description is the event class and the event variant. The parameters of an event are set by attribute tags.
\note Refer to \ref EventClassSection for the meaning of event class.
\b Mouse \b Buttons \n
mitk::InteractionEvent::MouseButtons represent the buttons. They can be used for two attributes. First the EventButton attribute which describes
the button that triggered the event,
this always is a single button. Secondly the ButtonState attribute that describes which buttons were pressed at the moment the event has been generated.
For example assume the right mouse button and the middle mouse button are already pressed, now the left mouse button is pressed too and generates a second event,
this would be described as follows:
\code
<attribute name="EventButton" value="LeftMouseButton"/>
<attribute name="ButtonState" value="RightMouseButton,MiddleMouseButton"/>
\endcode
Note: Technically the LeftMouseButton is also pressed and should be listed in the ButtonState, but this is taken care of by the mitk::EventFactory .
<b> Key Events</b> \n
mitk::InteractionKeyEvent represents a pressed key, which key is pressed is provided with the Key attribute like this
\code
<attribute name="Key" value="A"/>
\endcode
or
\code
<attribute name="Key" value="Escape"/>
\endcode
\note Key Events do not require an explicit configuration, for all key events there exists
a predefined event variant with the name 'Std' + value, that is key a is named 'StdA'.
The names for special keys are listed here:
\dontinclude mitkInteractionEvent.h
\skipline // Special Keys
\until // End special keys
<b> Modifier Keys</b> \n
mitk::InteractionEvent::ModifierKeys represent the combination of pressed modifier keys, several modifier keys pressed at the same time
are denoted by listing them all separated by commas.
\code
<!-- shift and control key are pressed -->
<attribute name="Modifiers" value="shift,ctrl"/>
\endcode
\b ScrollDirection \n
This attribute is unique to the mitk::MouseWheelEvent and describes the direction in which the mouse wheel is rotated. In the event description actual only the direction is provided,
but the event is generated with the actual value, and this value can be retrieved from the object.
\code
<attribute name="ScrollDirection" value="up"/>
<!-- or -->
<attribute name="ScrollDirection" value="down"/>
\endcode
\subsection ExamplesSection Examples
Examples for key events:
\code
<config>
<!-- Event of key 'a' pressed -->
<event_variant class="InteractionKeyEvent" name="StdA">
<attribute name="Key" value="A"/>
</event_variant>
<!-- Event of key 'b' pressed while modifiers ctrl and shift are pressed-->
<event_variant class="InteractionKeyEvent" name="StdB">
<attribute name="Key" value="B"/>
<attribute name="Modifiers" value="shift,ctrl"/>
</event_variant>
</config>
\endcode
Examples for MousePress events:
\code
<!-- Standard left click -->
<config>
<event_variant class="MousePressEvent" name="StdMousePressPrimaryButton">
<attribute name="EventButton" value="LeftMouseButton"/>
</event_variant>
<!-- right click with control key pressed-->
<event_variant class="MousePressEvent" name="RightWithCTRL">
<attribute name="EventButton" value="RightMouseButton"/>
<attribute name="Modifiers" value="ctrl"/>
</event_variant>
</config>
\endcode
There exists a standard configuration file for the most common events called GlobalConfig.xml that can be used to as a default and can be extended
by a specific definition.
\subsection ParameterDescriptionSection Parameter Description
It is also possible to store parameters in the config file. Those are stored using the param-tag, like this:
\code
<config name="example2">
<param name="property1" value="yes"/>
<param name="scrollModus" value="leftright"/>
</config>
\endcode
Within the application these properties can then be access via a mitk::PropertyList like this:
\code
// sm - state machine loaded with config file example2
mitk::PropertyList::Pointer properties = GetAttributes();
std::string prop1;
properties->GetStringProperty("property1",prop1);
\endcode
\section HowToStateMachine HowTo Write a State Machine
A state machine pattern is described in a XML file.
\subsection StateSection States
States are described using the state-tag. Each state has to have a name. Exactly one state has to be a start state in
each state machine to indicate the state in which the state machine is set when it is constructed.
So a valid, but rather useless state machine would like like this:
\code
<statemachine>
<state name="start" startstate="true"/>
</statemachine>
\endcode
Optionally a state can be assigned a special mode that influences the event distribution.
These modes are GRAB_INPUT , PREFER_INPUT and REGULAR (where REGULAR is default and does not need to be indicated).
See \ref DataInteractionTechnicalPage_DispatcherEventDistSection for a description of these modes. Use the special modes only when necessary as they prevent other DataInteractors to
receive events.
\code
<!-- example -->
<state name="someState" startstate="true" state_mode="GRAB_INPUT"/>
\endcode
\subsection TransitionSection Transitions
+
Transitions are part of a state and describe all possible state switches, and are therefore important for modeling an interaction scheme.
Transitions consist a part that describes the event which triggers the transition (event class and event variant) and a target which is state
to which the state machine switches after executing a transition.
An event class describes the event type (see mitk::InteractionEvent for the different classes) and the event variant is a specification thereof
and the exact description is taken from a config file. Together they determine which event can trigger this transition.
For example this state machine will switch from state A to state B when the StdMousePressPrimaryButton event (left mouse button is pressed) occurs.
-\subsubsection EventClassSection Event Class
+\subsection EventClassSection Event Class
+
The event class description supports the polymorphism of the event classes. Therefore state machine patters should be written in the most
general ways possible.
So for a given class hierarchy like this:
\dot
digraph {
node [shape=record, fontname=Helvetica, fontsize=10];
a [ label="{InteractionPositionEvent}"];
b [ label="{MousePressEvent}" ];
c [ label="MouseReleaseEvent" ];
d [ label="TouchEvent", style=dotted ];
a -> b;
a -> c;
a -> d;
}
\enddot
in the state machine pattern the mitk::InteractionPositionEvent can be declared as event class to restrict to the events which hold a position information.
The actual implementation is then given in the configuration file. In this case it allows to define events of the classes mitk::InteractionPositionEvent
itself, or mitk::MousePressEvent, mitk::MouseReleaseEvent, mitk::TouchEvent.
This has the advantage that the patterns remain the same no matter what input devices are used, and the state machine patterns can be configured
for newly added event classes as long as they match the class hierarchy (this ensures they hold the necessary properties).
\code
<statemachine>
<state name="A" startstate="true">
<transition event_class="MousePressEvent" event_variant="StdMousePressPrimaryButton" target="B"/>
<state/>
<state name="B" />
</statemachine>
\endcode
\subsection ActionSection Actions
Actions can be added to transitions and represent functions in the mitk::DataInteractor that are executed on taking a transition.
The following simple state machine will listen for left mouse clicks and execute two actions (and actually never stop).
\code
<statemachine>
<state name="start" startstate="true">
<transition event_class="MousePressEvent" event_variant="StdMousePressPrimaryButton" target="start">
<action name="addPoint"/>
<action name="countClicks"/>
</transition>
</state>
</statemachine>
\endcode
In order to tell the mitk::DataInteractor which function to execute these actions are made known to the mitk::DataInteractor using
the CONNECT_FUNCTION macro. This example assumes that there exists an ExampleInteractor which inherits from mitkDataInteractor.
This class implements the functions AddPoint and CountClicks. The actions are introduced by implementing the virtual method
ConnectActionsAndFunctions():
\code
void mitk::ExampleInteractor::ConnectActionsAndFunctions()
{
CONNECT_FUNCTION("addPoint", AddPoint);
CONNECT_FUNCTION("countClicks", CountClicks);
}
\endcode
\subsection ConditionSection Conditions
Conditions can be added to transitions and represent functions in the mitk::DataInteractor that are executed on taking a transition.
A condition is used to determine if a following action should be executed or not.
\code
<statemachine>
<state name="start" startstate="true">
<transition event_class="MousePressEvent" event_variant="StdMousePressPrimaryButton" target="start">
<condition name="checkPoint"/>
<action name="addPoint"/>
<action name="countClicks"/>
</transition>
</state>
</statemachine>
\endcode
In order to tell the mitk::DataInteractor which function to execute these conditions are made known to the mitk::DataInteractor using
the CONNECT_CONDITION macro. The ConnectActionsAndFunctions() method has to be augmented accordingly:
\code
void mitk::ExampleInteractor::ConnectActionsAndFunctions()
{
CONNECT_CONDITION("checkPoint", CheckPoint);
CONNECT_FUNCTION("addPoint", AddPoint);
CONNECT_FUNCTION("countClicks", CountClicks);
}
\endcode
\section ReferenceToIncludeFiles Integration of the pattern and configuration files
The usage of custom files slightly differs from the existing ones.
Custom pattern and config files have to be stored in the /Resources/Interactions directory of the Module that they were designed for.
When loading files from a module location into an interactor, the module has to be supplied as a parameter:
\code
m_CurrentInteractor = mitk::CustomDataInteractor::New();
m_CurrentInteractor->LoadStateMachine("CustomStateMachinePattern.xml", us::GetModuleContext()->GetModule());
m_CurrentInteractor->SetEventConfig("CustomConfig.xml", us::GetModuleContext()->GetModule());
\endcode
See \ref IncludeFiles for a description.
\section HowToDataInteractor Implementation of a new mitk::DataInteractor
DataInteractors are to inherit from mitk::DataInteractor. Their functionality is implemented in functions that follow this interface:
For Actions:
\code
bool SomeFunctionality(StateMachineAction* , InteractionEvent*);
\endcode
For Conditions:
\code
bool SomeFunctionality(const InteractionEvent*);
\endcode
Your functions are connected with actions and conditions by implementing the function ConnectActionsAndFunctions(), e.g.
\code
void mitk::ExampleInteractor::ConnectActionsAndFunctions()
{
CONNECT_CONDITION("checkPoint", CheckPoint);
CONNECT_FUNCTION("addPoint", AddPoint);
CONNECT_FUNCTION("enoughPoints", EnoughPoints);
}
\endcode
Now all that is left is to write a state machine pattern and a config file as is described in the tutorials.
To provide a useful example the mitk::PointSetDataInteractor is annotated with comments that describe the important parts for an implementation
of a mitk::DataInteractor.
-This step assumes knowledge of the Interaction concept described in \ref DataInteractionPage and some background of the implementation which is described in
-\ref DataInteractionPageTechnical. Please refer to these pages before proceeding.
+This step assumes knowledge of the Interaction concept described in \ref DataInteractionPage and some background of the implementation.
+Please refer to these pages before proceeding.
Now all that is left it to write a state machine pattern and a config file as is described in the tutorials.
\subsection ExampleInternalEvent Example Interactor using InternalEvent
A useful tool in creating DataInteractors is mitk::InternalEvent which allows the mitk::DataInteractor to send signals on its own.
The following will describe how to build a mitk::DataInteractor that allows to add points until a certain number of points is reached.
The number of accepted points is provided in the config file as a parameter.
So we start by writing a state machine pattern that add points until it receives an mitk::InternalEvent telling it, that enough points
have been added.
\code
<statemachine>
<state name="start" startstate="true" >
<transition event_class="MousePressEvent" event_variant="AddPointClick" target="start">
<condition name="checkPoint"/>
<action name="addPoint"/>
</transition>
<transition event_class="InternalEvent" event_variant="enoughPointsAdded" target="final">
<action name="enoughPoints"/>
</transition>
</state>
<state name="final">
<--! dead state, nothing happens any more, once we reached this -->
</state>
</statemachine>
\endcode
<b> </b>
In our config file we set the number of maximal points to 10, and define AddPointClick as a right mouse click with the
ctrl button pressed.
\code
<config>
<param name="NumberOfPoints" value="10">
<event_variant class="MousePressEvent" name="AddPointClick">
<attribute name="EventButton" value="RightMouseButton"/>
<attribute name="Modifiers" value="ctrl"/>
</event_variant>
</config>
\endcode
The implementation is described in the following. \see Step10.h \see Step10.cpp
\dontinclude Step10.h
Implementation of protected functions:
\skipline protected:
\until virtual void ConfigurationChanged();
<b> ConnectActionsAndFunctions </b> - Is inherited from mitk::InteractionStateMachine, here action strings from the xml are connected with
functions in the mitk::DataInteractor (as seen above). In our example this looks like this:
\dontinclude Step10.cpp
\skipline void mitk::ExampleInteractor::ConnectActionsAndFunctions()
\until }
<b> ConfigurationChanged </b> - Is called whenever a new configuration file is loaded (by the mitk::InteractionEventHandler super class),
this function allows to implement initialization code that depends on configuration values. In our example we want to set the limit of
allowed points:
\dontinclude Step10.cpp
\skipline void mitk::ExampleInteractor::ConfigurationChang
\until }
Next the actual functionality of the DataInteractor is implemented, by providing one function per action, following this prototype described before.
\dontinclude Step10.h
\skipline private:
\until bool CheckPoint(cons
\dontinclude Step10.cpp
\skipline bool mitk::ExampleInteractor::AddPoint(StateM
\until //-
If the conditions returns false the calling transition and the included actions will not be executed.
If a condition fails the event is considered as untreated, and will be offered to other Interactors.
\dontinclude Step10.cpp
\skipline bool mitk::ExampleInteractor::CheckPoint(
\until //end
Here we see an internal event used to signal that the point set reached the maximal number of allowed points.
The event is created and added to the Dispatchers event queue.
\dontinclude Step10.cpp
\skipline // create internal
\until positionEvent->GetSender(
\note Internal events do not need any mapping to event variants. Their signal name is equivalent with the event variant.
<b> There are also two documented classes implementing a mitk::DataInteractor and a mitk::InteractionEventObserver which can be looked at for further
understanding: </b>
\see mitk::PointSetDataInteractor
\see mitk::DisplayInteractor
Have fun with creating your own interaction and please think about contributing it to MITK!
<b>
If you meet any difficulties during this step, don't hesitate to ask on the MITK mailing list mitk-users@lists.sourceforge.net!
People there are kind and will try to help you. </b>
\ref Step09Page "[Previous step]" \ref TutorialPage "[Main tutorial page]"
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Tutorial.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Tutorial.dox
index 602e1fb0f5..d0a5a7a5fe 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Tutorial.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/GettingToKnow/Tutorial/Tutorial.dox
@@ -1,49 +1,49 @@
/**
\page TutorialPage The MITK Tutorial
If you have set up and compiled MITK already and want to know more about developing with MITK you might want to read the \ref TutorialSection. If you want help setting up MITK and creating your own project using MITK you should take a look at \ref HowToNewProject.
\section TutorialFirstSteps First steps in MITK
If you are absolutely new to MITK you might want to read up on setting up MITK to use in your development. The following pages will help you in this task.
<ul>
<li> \subpage HowToNewProject "A comprehensive guide to setting up your own MITK project"
<li> \ref BuildInstructionsPage "Building MITK"
<li> \ref CMAKE_FAQ
</ul>
\section TutorialSection Tutorial chapters
This tutorial will give you an introduction to developing with MITK.
We will start with configuring MITK to compile the tutorial, continue to show how to
display and do basic interaction with images, and finally show how to build a plug-in and add new interactions.
The source code of the examples can be found in Examples/Tutorial/ \n
Visit \ref TroubleshootingPage for a guide to miscellaneous issues and their resolution. \n
Two data files are used to execute the example code.
\li Pic3D.nrrd \n
-This file contains an image and can be downloaded from http://mitk.org/download/tutorial-data/Pic3D.nrrd .
+This file contains an image and can be downloaded from https://www.mitk.org/download/tutorial-data/Pic3D.nrrd .
\li lungs.vtk \n
-This file contains a surface and can be downloaded from http://mitk.org/download/tutorial-data/lungs.vtk .
+This file contains a surface and can be downloaded from https://www.mitk.org/download/tutorial-data/lungs.vtk .
\li \subpage Step00Page "Step 0: Getting started"
\li \subpage Step01Page "Step 1: Displaying an image"
\li \subpage Step02Page "Step 2: Load one or more data sets"
\li \subpage Step03Page "Step 3: Create 3D view"
\li \subpage Step04Page "Step 4: Use several views to explore data"
\li \subpage Step05Page "Step 5: Interactively add points"
\li \subpage Step06Page "Step 6: Use an interactive region-grower"
\li \subpage Step07Page "Step 7: Convert result of region growing into a surface"
\li \subpage Step08Page "Step 8: Use QmitkStdMultiWidget as widget"
\li \subpage Step09Page "Step 9: A plug-in"
\li \subpage Step10Page "Step 10: How to use Interactor and how to implement new ones"
More advanced How-Tos can be found at \ref FirstSteps .
Enjoy MITK!
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/SettingUpMITK/BuildInstructions.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/SettingUpMITK/BuildInstructions.dox
index 0c585c0c97..9d0ec93913 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/SettingUpMITK/BuildInstructions.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/SettingUpMITK/BuildInstructions.dox
@@ -1,216 +1,214 @@
/**
\page BuildInstructionsPage Build Instructions
\tableofcontents
\section BuildInstructions_Introduction Introduction
The CMake-based build system of MITK supports a "superbuild" process,
meaning that it will download, configure, and build all required third-party
libraries (except Qt) automatically. These instructions will show you how to use
the MITK superbuild.
\note This page explains explicitly how to build MITK itself. If you want to
create your own project based on MITK, the process described below is completely
automated. Please see \ref HowToNewProject.
For more advanced users, the last sections explains how to inject custom build
libraries into the superbuild process.
\section BuildInstructions_Prerequisites Prerequisites
You need:
- -# Git from http://git-scm.com (there are also numerous third-party graphical
+ -# <a href="https://git-scm.com/">Git</a> (there are also numerous third-party graphical
clients available). We recommend using Git, but see below for a way how to
get the current source code without using it.
- -# <a href="http://www.cmake.org">CMake</a> (version \minimumCMakeVersion or higher)
- -# <a href="http://qt.io">Qt</a> 5.12 if you plan to develop Qt-based
+ -# <a href="https://cmake.org/">CMake</a> (version \minimumCMakeVersion or higher)
+ -# <a href="https://www.qt.io/">Qt</a> 5.12 if you plan to develop Qt-based
applications
-# If you are using <b>macOS</b> you need an XCode installation and the
Command Line Tools as it provides the neccessary compilers and SDKs
\section BuildInstructions_Qt A note about Qt
As we do not provide Qt in the MITK superbuild you need to install Qt manually.
-The Qt Company provides <a href="http://www.qt.io/download/">online installers
+The Qt Company provides <a href="https://www.qt.io/download/">online installers
for all supported platforms</a>.
\section BuildInstructions_Get_Source Get a source tree
Since MITK is under active development we recommend to use Git to check out
the latest stable release from the homepage. If you decide to use the most
current nightly release, make sure to get a stable tree: Check the
-<a href="http://cdash.mitk.org/index.php?project=MITK">MITK dashboard</a>
+<a href="https://cdash.mitk.org/index.php?project=MITK">MITK dashboard</a>
before checking out. If the build tree is not clean, you can specify an
older revision for the checkout or get a stable tar ball from
-<a href="http://www.mitk.org">www.mitk.org</a>.
+<a href="https://www.mitk.org">www.mitk.org</a>.
To clone MITK's current Git repository do:
\code
git clone https://phabricator.mitk.org/source/mitk.git MITK
\endcode
\section BuildInstructions_Build_With_CMake Build MITK with CMake
Create a new directory for the superbuild binary tree, change to it and call CMake:
In the shell (assuming your current directory is the same as the one where you
issued the git clone command):
\code
mkdir MITK-superbuild
cd MITK-superbuild
ccmake ../MITK
\endcode
If you use <b>Windows</b> or prefer to use the CMake GUI, start the CMake GUI and enter the
location of the source tree and binary tree, choose a suitable generator
and configure the project.
CMake will present you a couple of options, these are the most important ones:
- - <tt><b>CMAKE_PREFIX_PATH</b></tt> The path to your Qt installation, e.g., <i>C:/Qt/5.12.6/msvc2017_64</i> or <i>/home/user/Qt/5.12.6/gcc_64</i>
- - <tt><b>MITK_USE_ACVD</b></tt> Build MITK code which depends on ACVD (this
- will download and build ACVD)
+ - <tt><b>CMAKE_PREFIX_PATH</b></tt> The path to your Qt installation, e.g., <i>C:/Qt/5.12.9/msvc2017_64</i> or <i>/home/user/Qt/5.12.9/gcc_64</i>
- <tt><b>MITK_USE_BLUEBERRY</b></tt> Build the BlueBerry application framework
- <tt><b>MITK_USE_Boost_LIBRARIES</b></tt> If you need binary Boost libraries,
specify them here.
- <tt><b>MITK_USE_OpenCV</b></tt> Build MITK code which depends on OpenCV (this
will download and build OpenCV 2.4)
- <tt><b>MITK_USE_Python3</b></tt> Enables Python wrapping in MITK. This will also
configure ITK, VTK, and OpenCV (if enabled) to build Python wrappers.
- <tt><b>MITK_USE_Qt5</b></tt> Build MITK code which depends on Qt 5
If you are satisfied with the configuration of your MITK superbuild, generate
the project files with CMake by pressing "Generate".
<b>Linux</b> and <b>macOS</b> users usually just enter "make" (optionally
supplying the number threads to be used for a parallel build):
\code
make -j6
\endcode
<b>Windows</b> users using Visual Studio can open the generated
<tt>MITK-superbuild.sln</tt> solution file in the <tt>MITK-superbuild</tt>
directory and start the build by building the <tt>BUILD_ALL</tt> project.
\section BuildInstructions_Customize Customize your MITK superbuild
The MITK superbuild configures MITK as well as all external libraries. The
build directories of these libraries, and of MITK itself are located inside
the <tt>MITK-superbuild</tt> directory. For example, the directory layout may
look like:
\code
MITK-superbuild
|- ep "external projects"
|-bin
|-lib
|-include
|-src
|- MITK-build
\endcode
To change the configuration of the MITK build itself, choose the MITK-build directory
as the binary directory in the CMake GUI (not the MITK-superbuild directory).
After generating the project files, build the MITK project by either issuing "make"
in the MITK-build directory (Linux, macOS), or by opening MITK-build/MITK.sln (Windows).
You may also change the configuration of any project configured via the
superbuild process. Make sure to also build the changed project and also the
projects which depend on it.
\section BuildInstructions_Running Running Applications
On Linux, just execute the application you want to run. MITK executables are
located in <tt>MITK-superbuild/MITK-build/bin</tt>
On Windows, the <tt>PATH</tt> environment variable must contain the directories
containing the third-party libraries. This is automatically done from Visual Studio.
For running the applications directly use the generated batch files in the
<tt>MITK-superbuild/MITK-build/bin</tt>.
\section BuildInstructions_Documentation Documentation
-If you have the <a href="http://www.doxygen.org">Doxygen</a> documentation tool
+If you have the <a href="https://www.doxygen.nl/">Doxygen</a> documentation tool
installed, you get a new project (Visual Studio) or "make" target named "doc".
You can build this to generate the HTML documentation of MITK in the
Documentation/Doxygen directory of your MITK-build binary tree or in the
<tt>MITK_DOXYGEN_OUTPUT_DIR</tt> CMake variable (if specified).
\section BuildInstructions_Extending Extend MITK on your own (using the application framework BlueBerry)
Please see \ref NewPluginPage
\section BuildInstructions_As_Toolkit Use MITK in your own project (as a toolkit)
To use MITK in your external project, add the CMake command
<code>find_package(MITK REQUIRED)</code> to your CMakeLists.txt and make use of
the CMake macros <code>mitk_create_module()</code> and
<code>mitk_create_executable()</code> provided by MITK.
Here is a very basic example CMakeLists.txt including MITK as a project:
\code
cmake_minimum_required(VERSION 3.10 FATAL_ERROR)
project(MyProject)
find_package(MITK 2018.04.02 REQUIRED)
add_executable(MyApp main.cpp)
target_link_libraries(MyApp MitkCore)
\endcode
with the main.ccp being
\code
#include <iostream>
#include <mitkLogMacros.h>
int main()
{
MITK_INFO << "Hello world!";
return 0;
}
\endcode
\section BuildInstructions_Advanced_Customization Superbuild customization
You can inject pre-build third-party libraries into the MITK superbuild by
setting certain CMake variables before the first configure step. MITK will
then use these third-party libraries instead of downloading and building them
by itself. Note that you must take care of configuring those libraries with all options
MITK requires.
The variables listed below are provided for injecting third-party libraries.
Their occurrence in the CMake GUI or in ccmake may depend on specific
MITK_USE_* options set to ON. You may also use the variable names below without
the <tt>EXTERNAL_</tt> prefix, for example when providing their values on a
command line call to CMake.
- <tt><b>EXTERNAL_BOOST_ROOT</b></tt> Set this variable to your custom Boost
installation
- <tt><b>EXTERNAL_CTK_DIR</b></tt> Set this variable to your CTK binary tree
(the directory containing the CTKConfig.cmake file)
- <tt><b>EXTERNAL_CableSwig_DIR</b></tt> Set this variable to your CableSwig
binary tree for Python wrapping (the directory containing the
CableSwigConfig.cmake file)
- <tt><b>EXTERNAL_DCMTK_DIR</b></tt> Set this variable to your DCMTK binary
tree (the directory containing the DCMTKConfig.cmake file)
- <tt><b>EXTERNAL_GDCM_DIR</b></tt> Set this variable to your GDCM binary
tree (the directory containing the GDCMConfig.cmake file)
- <tt><b>EXTERNAL_ITK_DIR</b></tt> Set this variable to your ITK binary tree
(the directory containing the ITKConfig.cmake file)
- <tt><b>EXTERNAL_OpenCV_DIR</b></tt> Set this variable to your OpenCV binary
tree (the directory containing the OpenCVConfig.cmake file)
- <tt><b>EXTERNAL_VTK_DIR</b></tt> Set this variable to your VTK binary tree
(the directory containing the VTKConfig.cmake file)
To set CMake options before the first configure step is invoked, supply them
on the command line, i.e.
\code
ccmake -DITK_DIR:PATH=/opt/ITK-release ../MITK
\endcode
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/SettingUpMITK/HowToNewProject.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/SettingUpMITK/HowToNewProject.dox
index f7e9e689b4..7bb8ca2707 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/SettingUpMITK/HowToNewProject.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/SettingUpMITK/HowToNewProject.dox
@@ -1,255 +1,254 @@
/**
\page HowToNewProject Creating a new MITK project
\tableofcontents
This page is intended to give a comprehensive guide to setting up your own MITK based
project. It will use the application framework provided by MITK and is probably the
preferred way for most users.
The first part of this document is a tutorial aimed at newcomers to MITK and possibly
%CMake and tries to give as much help as possible on setting up your own project. If
you are looking for more technical information about customizing MITK, the structure
of the superbuild or packaging you might want to read the
\ref HowToNewProjectAdvancedInformation.
If you have set up your MITK project already and want to start developing you could
take a look at \ref TutorialPage.
\section HowToNewProjectGettingStarted Getting Started
To bootstrap your project MITK offers two convenient options:
<ol>
<li> Use the MITK Plugin Generator, a command line tool used to generate a customized
- MITK project and/or MITK plug-ins (available for download
- <a href="http://www.mitk.org/Download#Plugin_Generator">here</a>).
+ MITK project and/or MITK plug-ins.
<li> Use the <a href="https://github.com/MITK/MITK-ProjectTemplate">MITK project template</a>
as an example project.
</ol>
Both options will provide you with a project which contains a "superbuild" mechanism
to automatically download, configure, and build MITK as a dependency of your own project.
The MITK Plugin Generator generates code using the supplied command line arguments,
whereas the MITK project template needs immediate modifications to customize it to
your naming schemes. However, the project template will potentially contain more
code demonstrating features of MITK.
\note Using the MITK Plugin Generator is recommended for beginners.
\section HowToNewProjectPrerequisites Prerequisites
What ever option you choose, a MITK-based project needs essentially the same
prerequisites as MITK itself. Please see \ref BuildInstructions_Prerequisites for
details.
\note If you use one of the two options above you will \b not \b need to build MITK
yourself. This will be done automatically.
\section HowToNewProjectCreatingSourceDir Preparing your source directory
In order to start developing with MITK, you first have to set up the source directory
for your project.
\subsection HowToNewProjectSourceUsingGenerator Using the MITK Plugin Generator
The usage of the Plugin Generator for creating a new project is described in
\ref NewPluginWithProject, please have a look there.
\subsection HowToNewProjectSourceUsingTemplate Using the MITK Project Template
Download the project as a tarball or zipball and extract it to your desired source
directory.
-\note This is a \b template \b. You must modify it such that it fits the needs of
+\note This is a <b>template</b>. You must modify it such that it fits the needs of
your particular project. Especially you should do a global search and replace for
the string "awesome" to rename the template application and plug-in. You may want
to rename some files too.
\section HowToNewProjectGeneratingCMake Generating your binary with CMake
After you have set up your source directory you can proceed to generate your binary
directory using %CMake. Depending on your operating system and preferences you might
want to use "cmake-gui" or "ccmake" (shell). This document assumes you are using
cmake-gui.
<ol>
<li> Start "cmake-gui" and enter your source (e.g. "D:\AwesomeProject") and binary
directory (e.g. "D:\AwesomeProject-superbuild").
<li> Upon first pressing "Configure" you will be prompted to select your generator.
This determines what project files will be generated by %CMake. Set this to the
development tool you are intending to use (e.g. "Visual Studio 2010 64Bit" or
"linux makefiles".
<li> Press "Configure" until no new variables appear and then "Generate". Now all
project files have been generated into your binary directory.
<li> Double-check that the right Qt version is used.
</ol>
Now you are ready to compile your code. Depending on your choice of tool this will
be done differently, we cover two possibilities here.
\subsection HowToNewProjectCompilingLinuxMakefiles Compiling using linux makefiles
<ol>
<li> In the shell, switch to your binary directory.
<li> type "make" and hit enter
</ol>
\subsection HowToNewProjectCompilingVisualStudio Compiling using visual studio
We assume your application is called "AwesomeApp" and your project "AwesomeProject"
and your binary directory is "D:\AwesomeProject-superbuild\". Replace names and
paths accordingly.
<ol>
<li> Close %CMake and open "D:\AwesomeProject-superbuild\AwesomeProject-superbuild.sln".
Your Visual Studio should appear and by pressing F7 you start the compilation.
This will clone the MITK source code, build it, and then start building your own
project.
<li> After the superbuild compilation has finished, close the superbuild solution file and start
the build solution file "D:\AwesomeProject-superbuild\AwesomeProject-build\AwesomeProject.sln"
<li> Set the "AwesomeApp" project as start-up project (right click > "Set as StartUp
Project") and press "F5" to start your MITK AwesomeApp.
</ol>
\note Just opening AwesomeProject.sln from your explorer by double-cliking won`t
allow you to start or debug your application because the required environment
variables would be missing. Use the supplied batch files or set your PATH variable
accordingly.
\section HowToNewProjectAddingMITKFunctionality I want to use some MITK plugin but
it is not available
Due to the sheer number of MITK plugins not every plugin is activated by default.
To activate a specific plugin (again replace paths as needed):
<ol>
<li> Start "cmake-gui" and set the binary directory to
"D:\AwesomeProject-superbuild\MITK-superbuild\MITK-build\", the source will
adjust automatically and you will see new settings appear.
<li> Navigate to the plugin you want to use (e.g. "MITK_BUILD_org.mitk.gui.qt.segmentation")
and tick the checkbox behind it
<li> Press "Configure" until no new variables appear and then "Generate".
<li> Build MITK using your development tool (as in
\ref HowToNewProjectCompilingLinuxMakefiles or \ref HowToNewProjectCompilingVisualStudio
only in the "D:\AwesomeProject-superbuild\MITK-superbuild\MITK-build\" directory )
<li> Start "cmake-gui" and set the binary directory to
"D:\AwesomeProject-superbuild\AwesomeProject-build\", the source will adjust
automatically and you will see new settings appear.
<li> Press "Configure" until no new variables appear and then "Generate".
<li> Build your project
<li> Start your application
</ol>
\note If you want to use an application provided by MITK (e.g. MITK Workbench) you
have to tick the appropriate checkbox as well (in this case MITK_BUILD_APP_Workbench)
and build MITK. Do note, that this application will be located in the bin directory
of the "D:\AwesomeProject-superbuild\MITK-superbuild\MITK-build\" folder.
\section HowToNewProjectAdvancedInformation Information for advanced users
\subsection HowToNewProjectCustomizingMITK Customizing MITK
The %CMake scripts from the Plugin Generator of the project template provide some
handy options which allow you to customize the MITK build used in your project.
You can either inject an already build MITK to be used by your project or configure
some MITK options directly in your project's superbuild configuration if MITK is
going to be build inside your project.
-\subsubsection HowToNewProjectCustomizingMITKInjectMITK Inject a MITK build
+\subsection HowToNewProjectCustomizingMITKInjectMITK Inject a MITK build
By setting the \b EXTERNAL_MITK_DIR \b variable in your project's superbuild
%CMake configuration to a MITK build directory (containing the MITKConfig.cmake)
you can skip the MITK build process.
If MITK is the only external project in your project, you might want to disable
the superbuild of your project completely (set <your-proj-name>_USE_SUPERBUILD
to OFF or edit your CMakeLists.txt file to set it to OFF by default) and set
the \b MITK_DIR \b %CMake variable to your MITK build directory.
-\subsubsection HowToNewProjectCustomizingMITKConfigure Configure the MITK superbuild
+\subsection HowToNewProjectCustomizingMITKConfigure Configure the MITK superbuild
If MITK is being build inside your project's superbuild process, you can enable
the use of certain third-party libraries inside of MITK. The following variables
control the MITK configuration:
<ul>
<li> \b MITK_USE_BLUEBERRY Enable the use of the BlueBerry application framework
<li> \b MITK_USE_CTK Download, compile, and use CTK in MITK
<li> \b MITK_USE_DCMTK Download, compile, and use DCMTK in MITK
<li> \b MITK_USE_OpenCV Download, compile, and use OpenCV in MITK
<li> \b MITK_USE_Python3 Download and compile 1CableSwig and enable Python
wrapping in ITK, VTK, OpenCV, and MITK
<li> \b MITK_USE_Qt5 Use the Qt 5 framework in MITK
</ul>
You can also inject already build third-party libraries from inside your project's
superbuild in the MITK superbuild by using any of the following %CMake variables:
<ul>
<li> \b MITK_CTK_DIR Reuse a CTK build directory in MITK.
<li> \b MITK_CableSwig_DIR Reuse a 1CableSwig build directory in MITK.
<li> \b MITK_DCMTK_DIR Reuse a DCMKT build directory in MITK.
<li> \b MITK_GDCM_DIR Reuse a GDCM build directory in MITK.
<li> \b MITK_ITK_DIR Reuse a ITK build directory in MITK.
<li> \b MITK_OpenCV_DIR Reuse a OpenCV build directory in MITK.
<li> \b MITK_VTK_DIR Reuse a VTK build directory in MITK.
</ul>
If the corresponding \b MITK_USE_<proj> \b option is set to on, the MITK
superbuild will use the provided build directory instead of building the
project itself.
You can also control the source code location for MITK in your project's
superbuild configuration by using the following %CMake variables:
<ul>
<li> \b MITK_SOURCE_DIR The path to the MITK source directory. If the value
for this variable is non-empty, the variables below are ignored.
<li> \b MITK_GIT_REPOSITORY The Git repository containing the MITK source code.
<li> \b MITK_GIT_TAG The hash id, tag or branch name used for a checkout
from MITK_GIT_REPOSITORY.
</ul>
-\subsubsection HowToNewProjectProjectStructure Project Structure
+\subsection HowToNewProjectProjectStructure Project Structure
If you are using the superbuild feature of the generated project (the default),
you might want to familiarise yourself with the layout of your build tree.
The top-level build directory which you specified in %CMake when configuring
your project will contain all the required dependencies.
Suppose we call our project MyProject and the build directory is
"C:\MyProject-superbuild". Then the layout looks something like this:
MyProjectLayout.png The top-level directory contains the source code and the
build directories from the dependencies of your project. In the current case,
the only dependency of MyProject is MITK, which in turn has downloaded and built
its own dependencies (CTK, DCMTK, ITK, etc.). The "real" build tree for your
project is located in MyProject-superbuild/MyProject-build, so point the
%CMake-GUI to this build directory if you want to change the set of enabled
plug-ins for example.
Further, you should open the MyProject.sln solution file (for Visual Studio)
or execute "make" in the MyProject-superbuild/MyProject-build/ directory.
Only for the very first time or if you want to update and newly build the
project's dependencies should you use the project files in the
MyProject-superbuild directory directly.
The same applies for the MyProject-superbuild/MITK-superbuild directory. This
directory contains the MITK superbuild, nested inside your project's superbuild.
If you want to change %CMake options for MITK, use the
MyProject-superbuild/MITK-superbuild/MITK-build build directory.
\imageMacro{HowToNewProject-MyProjectLayout.png,"Layout of MyProject",4.02}
-\subsubsection HowToNewProjectPackaging Packaging
+\subsection HowToNewProjectPackaging Packaging
The project template and the generated projects by the Plugin Generator come
with full packaging support. You can create deployable packages of your project
for all supported operating systems my building the PACKAGE target. On Linux,
this will create a tarball, on MacOS a .dmg file, and on Windows a zipball and
an NSIS installer (if NSIS is installed and found).
You can read more about deployment \ref DeploymentPage "here".
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/SettingUpMITK/ThirdPartyLibs.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/SettingUpMITK/ThirdPartyLibs.dox
index 315fe01900..5babea66ab 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/SettingUpMITK/ThirdPartyLibs.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/SettingUpMITK/ThirdPartyLibs.dox
@@ -1,111 +1,107 @@
/**
\page thirdpartylibs Third-party libraries
The following third-party libraries can be used with MITK by default and can, in part, be automatically downloaded during superbuild.
-\par ACVD
-
-http://www.creatis.insa-lyon.fr/site/en/acvd
-
\par ANN
-http://www.cs.umd.edu/~mount/ANN/
+https://www.cs.umd.edu/~mount/ANN/
\par Boost
-http://www.boost.org/
+https://www.boost.org/
\par C++ REST SDK
https://github.com/Microsoft/cpprestsdk/
\par CppUnit
-http://sourceforge.net/projects/cppunit/
+https://sourceforge.net/projects/cppunit/
\par CTK
-http://www.commontk.org/
+https://commontk.org/
\par DCMTK
-http://dicom.offis.de/dcmtk.php.en
+https://dicom.offis.de/dcmtk
\par Eigen
http://eigen.tuxfamily.org/index.php?title=Main_Page
\par GDCM
-http://gdcm.sourceforge.net/
+https://gdcm.sourceforge.net/
\par HDF5
https://support.hdfgroup.org/HDF5/
\par ITK
-http://www.itk.org/
+https://itk.org/
\par MatchPoint
-https://www.dkfz.de/en/sidt/projects/matchpoint/info.html
-
-\par NumPy
-
-http://www.numpy.org/
+https://www.dkfz.de/en/sidt/projects/MatchPoint/info.html
\par OpenCL
https://www.khronos.org/opencl/
\par OpenCV
-http://opencv.willowgarage.com/wiki/Welcome
+https://opencv.org/
\par OpenIGTLink
http://openigtlink.org/
+\par OpenMesh
+
+https://www.openmesh.org/
+
\par PCRE
-http://www.pcre.org/
+https://www.pcre.org/
\par POCO
-http://pocoproject.org
+https://pocoproject.org/
\par Python
https://www.python.org/
\par Qt
-http://www.qt.io/
+https://www.qt.io/
\par Qwt
http://qwt.sourceforge.net/
\par SWIG
-http://swig.org/
+http://www.swig.org/
\par tinyxml
-http://sourceforge.net/projects/tinyxml/
+http://www.grinninglizard.com/tinyxml/
\par VIGRA
-http://ukoethe.github.io/vigra/
+https://ukoethe.github.io/vigra/
\par VTK
-http://www.vtk.org/
+https://vtk.org/
\par zlib
-https://github.com/madler/zlib/
+https://zlib.net/
For copyright information on any of the above toolkits see the corresponding home page or the corresponding source folder.
*/
diff --git a/Documentation/Doxygen/3-DeveloperManual/Starting/Starting.dox b/Documentation/Doxygen/3-DeveloperManual/Starting/Starting.dox
index fb427a42ac..509cef90c3 100644
--- a/Documentation/Doxygen/3-DeveloperManual/Starting/Starting.dox
+++ b/Documentation/Doxygen/3-DeveloperManual/Starting/Starting.dox
@@ -1,40 +1,39 @@
/**
\page StartingDevelopment Starting your MITK Development
This introduction will acquaint you with the most important workflows to get you started with your MITK development.
First, \ref Architecture will explain the differences between the application and the toolkit.
\ref SettingUpMITK will get you started with a working environment for MITK development. \ref GettingToKnowMITK will walk you trough the folder structure, the module system, and plugin system. This chapter also contains an extensive tutorial on how to work with MITK.
The \ref FirstSteps section will then show you how to extend MITK for your own project.
<ul>
<li> \subpage Architecture </li>
<li> \subpage SettingUpMITK </li>
<ul>
<li> \ref SupportedPlatformsPage </li>
<li> \ref BuildInstructionsPage </li>
<li> \ref thirdpartylibs </li>
- <li> \ref HowToNewProject </li>
+ <li> \ref HowToNewProject </li>
</ul>
<li> \subpage GettingToKnowMITK </li>
<ul>
<li> \ref DirectoryStructurePage </li>
<li> \ref TutorialPage</li>
<li> \ref CMAKE_FAQ </li>
<li> \ref StyleGuideAndNotesPage </li>
<li> \ref DocumentationGuide </li>
<li> \ref CodingPage </li>
<li> \ref KnownProblemsPage </li>
</ul>
<li> \subpage FirstSteps </li>
<ul>
<li> \ref NewPluginPage </li>
<li> \ref NewViewPage </li>
<li> \ref NewModulePage</li>
- <li> \ref CMAKE_FAQ </li>
- <li> \ref StatemachineEditor </li>
+ <li> \ref CMAKE_FAQ </li>
</ul>
<li> \subpage AboutTestingPage </li>
</ul>
*/
diff --git a/Documentation/buildExtPointDoc.xml.in b/Documentation/buildExtPointDoc.xml.in
deleted file mode 100644
index 5dfd6517db..0000000000
--- a/Documentation/buildExtPointDoc.xml.in
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<project name="BlueBerry Extension-Point Documentation" default="all" basedir="." >
-
- <path id="convertSchema-classpath">
- <fileset dir="@BLUEBERRY_DOC_TOOLS_DIR@/plugins" >
- <include name="*.jar"/>
- <include name="org.eclipse.pde.build*/*.jar"/>
- </fileset>
- <fileset dir="@BLUEBERRY_DOC_TOOLS_DIR@/configuration/org.eclipse.osgi/bundles/207/1/.cp/ant_tasks" >
- <include name="*.jar"/>
- </fileset>
- </path>
-
- <taskdef name="pde.convertSchemaToHTML" classname="org.eclipse.pde.internal.core.ant.ConvertSchemaToHTML" >
- <classpath><path refid="convertSchema-classpath"/></classpath>
- </taskdef>
-
- <target name="all" >
- <antcall target="convertSchemaToHtml" />
- <!--antcall target="examplesDocCopy" /-->
- <!--antcall target="createDocZip" /-->
- </target>
-
- <target name="convertSchemaToHtml">
- <property name="dest" value="@XP_DOC_DESTINATION@" />
- <!--<property name="source" value="/home/zelzer/svn/mbi/MITK_INSRC/trunk/mitk/Utilities/BlueBerry/Bundles" />-->
-
- <record name="${basedir}/schema_convert.txt" action="start"/>
-
- <!-- ============= start extension point reference generation ============ -->
-
- @XP_ANT_TASKS@
-
- <!-- ============= end extension point reference generation ============== -->
-
- <record name="${basedir}/platformconvert.txt" action="stop"/>
-
- </target>
-
-</project>
\ No newline at end of file
diff --git a/Documentation/doxygen.conf.in b/Documentation/doxygen.conf.in
index add0ba4986..8a46babe1b 100644
--- a/Documentation/doxygen.conf.in
+++ b/Documentation/doxygen.conf.in
@@ -1,2433 +1,2433 @@
# Doxyfile 1.8.8
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a double hash (##) is considered a comment and is placed in
# front of the TAG it is preceding.
#
# All text after a single hash (#) is considered a comment and will be ignored.
# The format is:
# TAG = value [value, ...]
# For lists, items can also be appended using:
# TAG += value [value, ...]
# Values that contain spaces should be placed between quotes (\" \").
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
# This tag specifies the encoding used for all characters in the config file
# that follow. The default is UTF-8 which is also the encoding used for all text
# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
# for the list of possible encodings.
# The default value is: UTF-8.
DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
# double-quotes, unless you are using Doxywizard) that should identify the
# project for which the documentation is generated. This name is used in the
# title of most generated pages and in a few other places.
# The default value is: My Project.
PROJECT_NAME = "Medical Imaging Interaction Toolkit"
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER = @MITK_VERSION_STRING@
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
PROJECT_BRIEF = "Medical Imaging Interaction Toolkit"
# With the PROJECT_LOGO tag one can specify an logo or icon that is included in
# the documentation. The maximum height of the logo should not exceed 55 pixels
# and the maximum width should not exceed 200 pixels. Doxygen will copy the logo
# to the output directory.
PROJECT_LOGO =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
OUTPUT_DIRECTORY = "@MITK_DOXYGEN_OUTPUT_DIR@"
# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
# will distribute the generated files over these directories. Enabling this
# option can be useful when feeding doxygen a huge amount of source files, where
# putting all generated files in the same directory would otherwise causes
# performance problems for the file system.
# The default value is: NO.
CREATE_SUBDIRS = NO
# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
# characters to appear in the names of generated files. If set to NO, non-ASCII
# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
# U+3044.
# The default value is: NO.
ALLOW_UNICODE_NAMES = NO
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language.
# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
# Ukrainian and Vietnamese.
# The default value is: English.
OUTPUT_LANGUAGE = English
# If the BRIEF_MEMBER_DESC tag is set to YES doxygen will include brief member
# descriptions after the members that are listed in the file and class
# documentation (similar to Javadoc). Set to NO to disable this.
# The default value is: YES.
BRIEF_MEMBER_DESC = YES
# If the REPEAT_BRIEF tag is set to YES doxygen will prepend the brief
# description of a member or function before the detailed description
#
# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
# brief descriptions will be completely suppressed.
# The default value is: YES.
REPEAT_BRIEF = YES
# This tag implements a quasi-intelligent brief description abbreviator that is
# used to form the text in various listings. Each string in this list, if found
# as the leading text of the brief description, will be stripped from the text
# and the result, after processing the whole list, is used as the annotated
# text. Otherwise, the brief description is used as-is. If left blank, the
# following values are used ($name is automatically replaced with the name of
# the entity):The $name class, The $name widget, The $name file, is, provides,
# specifies, contains, represents, a, an and the.
ABBREVIATE_BRIEF =
# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
# doxygen will generate a detailed section even if there is only a brief
# description.
# The default value is: NO.
ALWAYS_DETAILED_SEC = NO
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
# inherited members of a class in the documentation of that class as if those
# members were ordinary class members. Constructors, destructors and assignment
# operators of the base classes will not be shown.
# The default value is: NO.
INLINE_INHERITED_MEMB = NO
# If the FULL_PATH_NAMES tag is set to YES doxygen will prepend the full path
# before files name in the file list and in the header files. If set to NO the
# shortest path that makes the file name unique will be used
# The default value is: YES.
FULL_PATH_NAMES = NO
# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
# Stripping is only done if one of the specified strings matches the left-hand
# part of the path. The tag can be used to show relative paths in the file list.
# If left blank the directory from which doxygen is run is used as the path to
# strip.
#
# Note that you can specify absolute paths here, but also relative paths, which
# will be relative from the directory where doxygen is started.
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
STRIP_FROM_PATH =
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
# path mentioned in the documentation of a class, which tells the reader which
# header file to include in order to use a class. If left blank only the name of
# the header file containing the class definition is used. Otherwise one should
# specify the list of include paths that are normally passed to the compiler
# using the -I flag.
STRIP_FROM_INC_PATH =
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
# less readable) file names. This can be useful is your file systems doesn't
# support long names like on DOS, Mac, or CD-ROM.
# The default value is: NO.
SHORT_NAMES = NO
# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
# first line (until the first dot) of a Javadoc-style comment as the brief
# description. If set to NO, the Javadoc-style will behave just like regular Qt-
# style comments (thus requiring an explicit @brief command for a brief
# description.)
# The default value is: NO.
JAVADOC_AUTOBRIEF = NO
# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
# line (until the first dot) of a Qt-style comment as the brief description. If
# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
# requiring an explicit \brief command for a brief description.)
# The default value is: NO.
QT_AUTOBRIEF = NO
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
# a brief description. This used to be the default behavior. The new default is
# to treat a multi-line C++ comment block as a detailed description. Set this
# tag to YES if you prefer the old behavior instead.
#
# Note that setting this tag to YES also means that rational rose comments are
# not recognized any more.
# The default value is: NO.
MULTILINE_CPP_IS_BRIEF = NO
# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
# documentation from any documented member that it re-implements.
# The default value is: YES.
INHERIT_DOCS = YES
# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce a
# new page for each member. If set to NO, the documentation of a member will be
# part of the file/class/namespace that contains it.
# The default value is: NO.
SEPARATE_MEMBER_PAGES = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
# uses this value to replace tabs by spaces in code fragments.
# Minimum value: 1, maximum value: 16, default value: 4.
TAB_SIZE = 8
# This tag can be used to specify a number of aliases that act as commands in
# the documentation. An alias has the form:
# name=value
# For example adding
# "sideeffect=@par Side Effects:\n"
# will allow you to put the command \sideeffect (or @sideeffect) in the
# documentation, which will result in a user-defined paragraph with heading
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines.
ALIASES = "FIXME=\par Fix Me's:\n" \
"BlueBerry=\if BLUEBERRY" \
"endBlueBerry=\endif" \
"bundlemainpage{1}=\page \1" \
"embmainpage{1}=\page \1" \
"github{2}=<a href=\"https://github.com/MITK/MITK/blob/master/\1\">\2</a>" \
"deprecatedSince{1}=\xrefitem deprecatedSince\1 \"\" \"Functions deprecated as of \1\" \deprecated (as of \1) " \
"minimumCMakeVersion=@MITK_CMAKE_MINIMUM_REQUIRED_VERSION@" \
"minimumQt5Version=@MITK_QT5_MINIMUM_VERSION@" \
"imageMacro{3}=\image html \1 \2 \n \image latex \1 \2 width=\3cm" \
"developersguidemainpage{1}=\page \1 " \
"usersguidemainpage{1}=\page \1 " \
"nondependentPluginLink{3}= \ref \1 \"\3\" "
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
# instance, some of the names that are used will be different. The list of all
# members will be omitted, etc.
# The default value is: NO.
OPTIMIZE_OUTPUT_FOR_C = NO
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
# Python sources only. Doxygen will then generate output that is more tailored
# for that language. For instance, namespaces will be presented as packages,
# qualified scopes will look different, etc.
# The default value is: NO.
OPTIMIZE_OUTPUT_JAVA = NO
# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
# sources. Doxygen will then generate output that is tailored for Fortran.
# The default value is: NO.
OPTIMIZE_FOR_FORTRAN = NO
# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
# sources. Doxygen will then generate output that is tailored for VHDL.
# The default value is: NO.
OPTIMIZE_OUTPUT_VHDL = NO
# Doxygen selects the parser to use depending on the extension of the files it
# parses. With this tag you can assign which parser to use for a given
# extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension, and
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
# Fortran. In the later case the parser tries to guess whether the code is fixed
# or free formatted code, this is the default for Fortran type files), VHDL. For
# instance to make doxygen treat .inc files as Fortran files (default is PHP),
# and .f files as C (default is Fortran), use: inc=Fortran f=C.
#
# Note For files without extension you can use no_extension as a placeholder.
#
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.
EXTENSION_MAPPING = cmake=c++
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
# documentation. See http://daringfireball.net/projects/markdown/ for details.
# The output of markdown processing is further processed by doxygen, so you can
# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
# case of backward compatibilities issues.
# The default value is: YES.
MARKDOWN_SUPPORT = YES
# When enabled doxygen tries to link words that correspond to documented
# classes, or namespaces to their corresponding documentation. Such a link can
# be prevented in individual cases by by putting a % sign in front of the word
# or globally by setting AUTOLINK_SUPPORT to NO.
# The default value is: YES.
AUTOLINK_SUPPORT = YES
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
# to include (a tag file for) the STL sources as input, then you should set this
# tag to YES in order to let doxygen match functions declarations and
# definitions whose arguments contain STL classes (e.g. func(std::string);
# versus func(std::string) {}). This also make the inheritance and collaboration
# diagrams that involve STL classes more complete and accurate.
# The default value is: NO.
BUILTIN_STL_SUPPORT = YES
# If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support.
# The default value is: NO.
CPP_CLI_SUPPORT = NO
# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
# will parse them like normal C++ but will assume all classes use public instead
# of private inheritance when no explicit protection keyword is present.
# The default value is: NO.
SIP_SUPPORT = NO
# For Microsoft's IDL there are propget and propput attributes to indicate
# getter and setter methods for a property. Setting this option to YES will make
# doxygen to replace the get and set methods by a property in the documentation.
# This will only work if the methods are indeed getting or setting a simple
# type. If this is not the case, or you want to show the methods anyway, you
# should set this option to NO.
# The default value is: YES.
IDL_PROPERTY_SUPPORT = YES
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES, then doxygen will reuse the documentation of the first
# member in the group (if any) for the other members of the group. By default
# all members of a group must be documented explicitly.
# The default value is: NO.
DISTRIBUTE_GROUP_DOC = YES
# Set the SUBGROUPING tag to YES to allow class member groups of the same type
# (for instance a group of public functions) to be put as a subgroup of that
# type (e.g. under the Public Functions section). Set it to NO to prevent
# subgrouping. Alternatively, this can be done per class using the
# \nosubgrouping command.
# The default value is: YES.
SUBGROUPING = YES
# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
# are shown inside the group in which they are included (e.g. using \ingroup)
# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
# and RTF).
#
# Note that this feature does not work in combination with
# SEPARATE_MEMBER_PAGES.
# The default value is: NO.
INLINE_GROUPED_CLASSES = NO
# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
# with only public data fields or simple typedef fields will be shown inline in
# the documentation of the scope in which they are defined (i.e. file,
# namespace, or group documentation), provided this scope is documented. If set
# to NO, structs, classes, and unions are shown on a separate page (for HTML and
# Man pages) or section (for LaTeX and RTF).
# The default value is: NO.
INLINE_SIMPLE_STRUCTS = NO
# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
# enum is documented as struct, union, or enum with the name of the typedef. So
# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
# with name TypeT. When disabled the typedef will appear as a member of a file,
# namespace, or class. And the struct will be named TypeS. This can typically be
# useful for C code in case the coding convention dictates that all compound
# types are typedef'ed and only the typedef is referenced, never the tag name.
# The default value is: NO.
TYPEDEF_HIDES_STRUCT = NO
# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
# cache is used to resolve symbols given their name and scope. Since this can be
# an expensive process and often the same symbol appears multiple times in the
# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
# doxygen will become slower. If the cache is too large, memory is wasted. The
# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
# symbols. At the end of a run doxygen will report the cache usage and suggest
# the optimal cache size from a speed point of view.
# Minimum value: 0, maximum value: 9, default value: 0.
LOOKUP_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
# documentation are documented, even if no documentation was available. Private
# class members and static file members will be hidden unless the
# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
# Note: This will also disable the warnings about undocumented members that are
# normally produced when WARNINGS is set to YES.
# The default value is: NO.
EXTRACT_ALL = YES
# If the EXTRACT_PRIVATE tag is set to YES all private members of a class will
# be included in the documentation.
# The default value is: NO.
EXTRACT_PRIVATE = NO
# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal
# scope will be included in the documentation.
# The default value is: NO.
EXTRACT_PACKAGE = NO
# If the EXTRACT_STATIC tag is set to YES all static members of a file will be
# included in the documentation.
# The default value is: NO.
EXTRACT_STATIC = YES
# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) defined
# locally in source files will be included in the documentation. If set to NO
# only classes defined in header files are included. Does not have any effect
# for Java sources.
# The default value is: YES.
EXTRACT_LOCAL_CLASSES = @MITK_DOXYGEN_INTERNAL_DOCS@
# This flag is only useful for Objective-C code. When set to YES local methods,
# which are defined in the implementation section but not in the interface are
# included in the documentation. If set to NO only methods in the interface are
# included.
# The default value is: NO.
EXTRACT_LOCAL_METHODS = NO
# If this flag is set to YES, the members of anonymous namespaces will be
# extracted and appear in the documentation as a namespace called
# 'anonymous_namespace{file}', where file will be replaced with the base name of
# the file that contains the anonymous namespace. By default anonymous namespace
# are hidden.
# The default value is: NO.
EXTRACT_ANON_NSPACES = NO
# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
# undocumented members inside documented classes or files. If set to NO these
# members will be included in the various overviews, but no documentation
# section is generated. This option has no effect if EXTRACT_ALL is enabled.
# The default value is: NO.
HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy. If set
# to NO these classes will be included in the various overviews. This option has
# no effect if EXTRACT_ALL is enabled.
# The default value is: NO.
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
# (class|struct|union) declarations. If set to NO these declarations will be
# included in the documentation.
# The default value is: NO.
HIDE_FRIEND_COMPOUNDS = @MITK_DOXYGEN_HIDE_FRIEND_COMPOUNDS@
# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
# documentation blocks found inside the body of a function. If set to NO these
# blocks will be appended to the function's detailed documentation block.
# The default value is: NO.
HIDE_IN_BODY_DOCS = NO
# The INTERNAL_DOCS tag determines if documentation that is typed after a
# \internal command is included. If the tag is set to NO then the documentation
# will be excluded. Set it to YES to include the internal documentation.
# The default value is: NO.
INTERNAL_DOCS = @MITK_DOXYGEN_INTERNAL_DOCS@
# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
# names in lower-case letters. If set to YES upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# and Mac users are advised to set this option to NO.
# The default value is: system dependent.
CASE_SENSE_NAMES = YES
# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
# their full class and namespace scopes in the documentation. If set to YES the
# scope will be hidden.
# The default value is: NO.
HIDE_SCOPE_NAMES = NO
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
# the files that are included by a file in the documentation of that file.
# The default value is: YES.
SHOW_INCLUDE_FILES = YES
# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
# grouped member an include statement to the documentation, telling the reader
# which file to include in order to use the member.
# The default value is: NO.
SHOW_GROUPED_MEMB_INC = NO
# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
# files with double quotes in the documentation rather than with sharp brackets.
# The default value is: NO.
FORCE_LOCAL_INCLUDES = NO
# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
# documentation for inline members.
# The default value is: YES.
INLINE_INFO = YES
# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
# (detailed) documentation of file and class members alphabetically by member
# name. If set to NO the members will appear in declaration order.
# The default value is: YES.
SORT_MEMBER_DOCS = YES
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
# descriptions of file, namespace and class members alphabetically by member
# name. If set to NO the members will appear in declaration order. Note that
# this will also influence the order of the classes in the class list.
# The default value is: NO.
SORT_BRIEF_DOCS = NO
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
# (brief and detailed) documentation of class members so that constructors and
# destructors are listed first. If set to NO the constructors will appear in the
# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
# member documentation.
# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
# detailed member documentation.
# The default value is: NO.
SORT_MEMBERS_CTORS_1ST = NO
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
# of group names into alphabetical order. If set to NO the group names will
# appear in their defined order.
# The default value is: NO.
SORT_GROUP_NAMES = NO
# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
# fully-qualified names, including namespaces. If set to NO, the class list will
# be sorted only by class name, not including the namespace part.
# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
# Note: This option applies only to the class list, not to the alphabetical
# list.
# The default value is: NO.
SORT_BY_SCOPE_NAME = YES
# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
# type resolution of all parameters of a function it will reject a match between
# the prototype and the implementation of a member function even if there is
# only one candidate or it is obvious which candidate to choose by doing a
# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
# accept a match between prototype and implementation in such cases.
# The default value is: NO.
STRICT_PROTO_MATCHING = NO
# The GENERATE_TODOLIST tag can be used to enable ( YES) or disable ( NO) the
# todo list. This list is created by putting \todo commands in the
# documentation.
# The default value is: YES.
GENERATE_TODOLIST = @MITK_DOXYGEN_GENERATE_TODOLIST@
# The GENERATE_TESTLIST tag can be used to enable ( YES) or disable ( NO) the
# test list. This list is created by putting \test commands in the
# documentation.
# The default value is: YES.
GENERATE_TESTLIST = YES
# The GENERATE_BUGLIST tag can be used to enable ( YES) or disable ( NO) the bug
# list. This list is created by putting \bug commands in the documentation.
# The default value is: YES.
GENERATE_BUGLIST = @MITK_DOXYGEN_GENERATE_BUGLIST@
# The GENERATE_DEPRECATEDLIST tag can be used to enable ( YES) or disable ( NO)
# the deprecated list. This list is created by putting \deprecated commands in
# the documentation.
# The default value is: YES.
GENERATE_DEPRECATEDLIST= @MITK_DOXYGEN_GENERATE_DEPRECATEDLIST@
# The ENABLED_SECTIONS tag can be used to enable conditional documentation
# sections, marked by \if <section_label> ... \endif and \cond <section_label>
# ... \endcond blocks.
ENABLED_SECTIONS = @MITK_DOXYGEN_ENABLED_SECTIONS@
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
# initial value of a variable or macro / define can have for it to appear in the
# documentation. If the initializer consists of more lines than specified here
# it will be hidden. Use a value of 0 to hide initializers completely. The
# appearance of the value of individual variables and macros / defines can be
# controlled using \showinitializer or \hideinitializer command in the
# documentation regardless of this setting.
# Minimum value: 0, maximum value: 10000, default value: 30.
MAX_INITIALIZER_LINES = 0
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
# the bottom of the documentation of classes and structs. If set to YES the list
# will mention the files that were used to generate the documentation.
# The default value is: YES.
SHOW_USED_FILES = YES
# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
# will remove the Files entry from the Quick Index and from the Folder Tree View
# (if specified).
# The default value is: YES.
SHOW_FILES = YES
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
# page. This will remove the Namespaces entry from the Quick Index and from the
# Folder Tree View (if specified).
# The default value is: YES.
SHOW_NAMESPACES = YES
# The FILE_VERSION_FILTER tag can be used to specify a program or script that
# doxygen should invoke to get the current version for each file (typically from
# the version control system). Doxygen will invoke the program by executing (via
# popen()) the command command input-file, where command is the value of the
# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
# by doxygen. Whatever the program writes to standard output is used as the file
# version. For an example see the documentation.
FILE_VERSION_FILTER =
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
# by doxygen. The layout file controls the global structure of the generated
# output files in an output format independent way. To create the layout file
# that represents doxygen's defaults, run doxygen with the -l option. You can
# optionally specify a file name after the option, if omitted DoxygenLayout.xml
# will be used as the name of the layout file.
#
# Note that if you run doxygen from a directory containing a file called
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
# tag is left empty.
LAYOUT_FILE = "@MITK_SOURCE_DIR@/Documentation/MITKDoxygenLayout.xml"
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
# extension is automatically appended if omitted. This requires the bibtex tool
# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
# For LaTeX the style of the bibliography can be controlled using
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
# search path. See also \cite for info how to create references.
CITE_BIB_FILES =
#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
#---------------------------------------------------------------------------
# The QUIET tag can be used to turn on/off the messages that are generated to
# standard output by doxygen. If QUIET is set to YES this implies that the
# messages are off.
# The default value is: NO.
QUIET = YES
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated to standard error ( stderr) by doxygen. If WARNINGS is set to YES
# this implies that the warnings are on.
#
# Tip: Turn warnings on while writing the documentation.
# The default value is: YES.
WARNINGS = YES
# If the WARN_IF_UNDOCUMENTED tag is set to YES, then doxygen will generate
# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
# will automatically be disabled.
# The default value is: YES.
WARN_IF_UNDOCUMENTED = YES
# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
# potential errors in the documentation, such as not documenting some parameters
# in a documented function, or documenting parameters that don't exist or using
# markup commands wrongly.
# The default value is: YES.
WARN_IF_DOC_ERROR = YES
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
# are documented, but have no documentation for their parameters or return
# value. If set to NO doxygen will only warn about wrong or incomplete parameter
# documentation, but not about the absence of documentation.
# The default value is: NO.
WARN_NO_PARAMDOC = NO
# The WARN_FORMAT tag determines the format of the warning messages that doxygen
# can produce. The string should contain the $file, $line, and $text tags, which
# will be replaced by the file and line number from which the warning originated
# and the warning text. Optionally the format may contain $version, which will
# be replaced by the version of the file (if it could be obtained via
# FILE_VERSION_FILTER)
# The default value is: $file:$line: $text.
WARN_FORMAT = "$file:$line: $text"
# The WARN_LOGFILE tag can be used to specify a file to which warning and error
# messages should be written. If left blank the output is written to standard
# error (stderr).
WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
#---------------------------------------------------------------------------
# The INPUT tag is used to specify the files and/or directories that contain
# documented source files. You may enter file names like myfile.cpp or
# directories like /usr/src/myproject. Separate the files or directories with
# spaces.
# Note: If this tag is empty the current directory is searched.
INPUT = @MITK_SOURCE_DIR@ \
- @MITK_SOURCE_DIR@/README.md \
@MITK_BINARY_DIR@ \
@MITK_DOXYGEN_ADDITIONAL_INPUT_DIRS@
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
# documentation (see: http://www.gnu.org/software/libiconv) for the list of
# possible encodings.
# The default value is: UTF-8.
INPUT_ENCODING = UTF-8
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
# *.h) to filter out the source-files in the directories. If left blank the
# following patterns are tested:*.c, *.cc, *.cxx, *.cpp, *.c++, *.java, *.ii,
# *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, *.hh, *.hxx, *.hpp,
# *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, *.m, *.markdown,
# *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf,
# *.qsf, *.as and *.js.
FILE_PATTERNS = *.h \
*.dox \
*.md
# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
# The default value is: NO.
RECURSIVE = YES
# The EXCLUDE tag can be used to specify files and/or directories that should be
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
#
# Note that relative paths are relative to the directory from which doxygen is
# run.
EXCLUDE = "@MITK_SOURCE_DIR@/Utilities/IpFunc/" \
"@MITK_SOURCE_DIR@/Utilities/IpSegmentation/" \
"@MITK_SOURCE_DIR@/Utilities/qtsingleapplication/" \
"@MITK_SOURCE_DIR@/Applications/PluginGenerator/" \
"@MITK_SOURCE_DIR@/Modules/CppMicroServices/core/doc/snippets/" \
"@MITK_SOURCE_DIR@/Modules/CppMicroServices/core/doc/doxygen/standalone/" \
"@MITK_SOURCE_DIR@/Modules/CppMicroServices/core/test/" \
"@MITK_SOURCE_DIR@/Modules/CppMicroServices/core/examples/" \
"@MITK_SOURCE_DIR@/Modules/CppMicroServices/core/src/util/jsoncpp.cpp" \
+ "@MITK_SOURCE_DIR@/Modules/CppMicroServices/third_party" \
"@MITK_SOURCE_DIR@/CMake/PackageDepends" \
"@MITK_SOURCE_DIR@/CMakeExternals" \
"@MITK_SOURCE_DIR@/Licenses" \
"@MITK_BINARY_DIR@/Documentation/Doxygen" \
"@MITK_BINARY_DIR@/bin/" \
"@MITK_BINARY_DIR@/PT/" \
"@MITK_BINARY_DIR@/GP/" \
"@MITK_BINARY_DIR@/_CPack_Packages/" \
@MITK_DOXYGEN_ADDITIONAL_EXCLUDE_DIRS@
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
# from the input.
# The default value is: NO.
EXCLUDE_SYMLINKS = NO
# If the value of the INPUT tag contains directories, you can use the
# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
# certain files from those directories.
#
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
EXCLUDE_PATTERNS = README* \
moc_* \
ui_* \
qrc_* \
wrap_* \
Register* \
*/files.cmake \
*/.git/* \
*_p.h \
*Private.* \
*/Internal/* \
*/internal/* \
*/Snippets/* \
*/snippets/* \
*/testing/* \
*/Testing/* \
*/test/* \
*/resource/* \
"@MITK_BINARY_DIR@/*.cmake" \
@MITK_DOXYGEN_EXCLUDE_PATTERNS@
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
# output. The symbol name can be a fully qualified name, a word, or if the
# wildcard * is used, a substring. Examples: ANamespace, AClass,
# AClass::ANamespace, ANamespace::*Test
#
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*
EXCLUDE_SYMBOLS =
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
# command).
-EXAMPLE_PATH = "@MITK_SOURCE_DIR@/Documentation/Snippets/" \
- "@MITK_SOURCE_DIR@/Examples/" \
+EXAMPLE_PATH = "@MITK_SOURCE_DIR@/Examples/" \
"@MITK_SOURCE_DIR@/Examples/Tutorial/" \
"@MITK_SOURCE_DIR@/Examples/Plugins/" \
"@MITK_SOURCE_DIR@/Examples/QtFreeRender/" \
"@MITK_SOURCE_DIR@/Modules/Core/" \
"@MITK_SOURCE_DIR@/Modules/CppMicroServices/core/doc/snippets/" \
"@MITK_SOURCE_DIR@/Modules/CppMicroServices/core/examples/" \
- "@MITK_DOXYGEN_OUTPUT_DIR@/html/extension-points/html/" \
+ "@MITK_SOURCE_DIR@/Modules/CppMicroServices/" \
"@MITK_SOURCE_DIR@/Modules/OpenCL/Documentation/doxygen/snippets/" \
"@MITK_SOURCE_DIR@/Modules/IGT/Tutorial/" \
+ "@MITK_SOURCE_DIR@/Plugins/org.mitk.gui.common/src/" \
"@MITK_SOURCE_DIR@/Plugins/org.mitk.gui.qt.igtexamples/" \
"@MITK_SOURCE_DIR@/Plugins/org.mitk.gui.qt.igttracking/"
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
# *.h) to filter out the source-files in the directories. If left blank all
# files are included.
EXAMPLE_PATTERNS =
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude commands
# irrespective of the value of the RECURSIVE tag.
# The default value is: NO.
EXAMPLE_RECURSIVE = YES
# The IMAGE_PATH tag can be used to specify one or more files or directories
# that contain images that are to be included in the documentation (see the
# \image command).
IMAGE_PATH = "@MITK_SOURCE_DIR@/Documentation/Doxygen/" \
"@MITK_SOURCE_DIR@"
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
# by executing (via popen()) the command:
#
# <filter> <input-file>
#
# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
# name of an input file. Doxygen will then use the output that the filter
# program writes to standard output. If FILTER_PATTERNS is specified, this tag
# will be ignored.
#
# Note that the filter must not add or remove lines; it is applied before the
# code is scanned, but not when the output code is generated. If lines are added
# or removed, the anchors will not be placed correctly.
INPUT_FILTER =
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis. Doxygen will compare the file name with each pattern and apply the
# filter if there is a match. The filters are a list of the form: pattern=filter
# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
# patterns match the file name, INPUT_FILTER is applied.
FILTER_PATTERNS = *.cmake=@CMakeDoxygenFilter_EXECUTABLE@
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER ) will also be used to filter the input files that are used for
# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
# The default value is: NO.
FILTER_SOURCE_FILES = NO
# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
# it is also possible to disable source filtering for a specific pattern using
# *.ext= (so without naming a filter).
# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
FILTER_SOURCE_PATTERNS =
# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
# is part of the input, its contents will be placed on the main page
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.
-USE_MDFILE_AS_MAINPAGE = README.md
+USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# Configuration options related to source browsing
#---------------------------------------------------------------------------
# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
# generated. Documented entities will be cross-referenced with these sources.
#
# Note: To get rid of all source code in the generated output, make sure that
# also VERBATIM_HEADERS is set to NO.
# The default value is: NO.
SOURCE_BROWSER = YES
# Setting the INLINE_SOURCES tag to YES will include the body of functions,
# classes and enums directly into the documentation.
# The default value is: NO.
INLINE_SOURCES = NO
# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
# special comment blocks from generated source code fragments. Normal C, C++ and
# Fortran comments will always remain visible.
# The default value is: YES.
STRIP_CODE_COMMENTS = YES
# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
# function all documented functions referencing it will be listed.
# The default value is: NO.
REFERENCED_BY_RELATION = YES
# If the REFERENCES_RELATION tag is set to YES then for each documented function
# all documented entities called/used by that function will be listed.
# The default value is: NO.
REFERENCES_RELATION = YES
# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
# to YES, then the hyperlinks from functions in REFERENCES_RELATION and
# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
# link to the documentation.
# The default value is: YES.
REFERENCES_LINK_SOURCE = YES
# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
# source code will show a tooltip with additional information such as prototype,
# brief description and links to the definition and documentation. Since this
# will make the HTML file larger and loading of large files a bit slower, you
# can opt to disable this feature.
# The default value is: YES.
# This tag requires that the tag SOURCE_BROWSER is set to YES.
SOURCE_TOOLTIPS = YES
# If the USE_HTAGS tag is set to YES then the references to source code will
# point to the HTML generated by the htags(1) tool instead of doxygen built-in
# source browser. The htags tool is part of GNU's global source tagging system
# (see http://www.gnu.org/software/global/global.html). You will need version
# 4.8.6 or higher.
#
# To use it do the following:
# - Install the latest version of global
# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
# - Make sure the INPUT points to the root of the source tree
# - Run doxygen as normal
#
# Doxygen will invoke htags (and that will in turn invoke gtags), so these
# tools must be available from the command line (i.e. in the search path).
#
# The result: instead of the source browser generated by doxygen, the links to
# source code will now point to the output of htags.
# The default value is: NO.
# This tag requires that the tag SOURCE_BROWSER is set to YES.
USE_HTAGS = NO
# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
# verbatim copy of the header file for each class for which an include is
# specified. Set to NO to disable this.
# See also: Section \class.
# The default value is: YES.
VERBATIM_HEADERS = YES
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
# compounds will be generated. Enable this if the project contains a lot of
# classes, structs, unions or interfaces.
# The default value is: YES.
ALPHABETICAL_INDEX = YES
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
# which the alphabetical index list will be split.
# Minimum value: 1, maximum value: 20, default value: 5.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
COLS_IN_ALPHA_INDEX = 3
# In case all classes in a project start with a common prefix, all classes will
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
# can be used to specify a prefix (or a list of prefixes) that should be ignored
# while generating the index headers.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
#---------------------------------------------------------------------------
# If the GENERATE_HTML tag is set to YES doxygen will generate HTML output
# The default value is: YES.
GENERATE_HTML = YES
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
# it.
# The default directory is: html.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_OUTPUT = html
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
# generated HTML page (for example: .htm, .php, .asp).
# The default value is: .html.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FILE_EXTENSION = .html
# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
# each generated HTML page. If the tag is left blank doxygen will generate a
# standard header.
#
# To get valid HTML the header file that includes any scripts and style sheets
# that doxygen needs, which is dependent on the configuration options used (e.g.
# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
# default header using
# doxygen -w html new_header.html new_footer.html new_stylesheet.css
# YourConfigFile
# and then modify the file new_header.html. See also section "Doxygen usage"
# for information on how to generate the default header that doxygen normally
# uses.
# Note: The header is subject to change so you typically have to regenerate the
# default header when upgrading to a newer version of doxygen. For a description
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
# footer. See HTML_HEADER for more information on how to generate a default
# footer and what special commands can be used inside the footer. See also
# section "Doxygen usage" for information on how to generate the default footer
# that doxygen normally uses.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
# sheet that is used by each HTML page. It can be used to fine-tune the look of
# the HTML output. If left blank doxygen will generate a default style sheet.
# See also section "Doxygen usage" for information on how to generate the style
# sheet that doxygen normally uses.
# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
# it is more robust and this tag (HTML_STYLESHEET) will in the future become
# obsolete.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_STYLESHEET =
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# cascading style sheets that are included after the standard style sheets
# created by doxygen. Using this option one can overrule certain style aspects.
# This is preferred over using HTML_STYLESHEET since it does not replace the
# standard style sheet and is therefor more robust against future updates.
# Doxygen will copy the style sheet files to the output directory.
# Note: The order of the extra stylesheet files is of importance (e.g. the last
# stylesheet in the list overrules the setting of the previous ones in the
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_STYLESHEET = @MITK_DOXYGEN_STYLESHEET@
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
# that these files will be copied to the base HTML output directory. Use the
# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
# files will be copied as-is; there are no commands or markers available.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_FILES = "@MITK_SOURCE_DIR@/Documentation/Doxygen/mitkLogo.jpg"
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the stylesheet and background images according to
# this color. Hue is specified as an angle on a colorwheel, see
# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
# purple, and 360 is red again.
# Minimum value: 0, maximum value: 359, default value: 220.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_COLORSTYLE_HUE = 220
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
# in the HTML output. For a value of 0 the output will use grayscales only. A
# value of 255 will produce the most vivid colors.
# Minimum value: 0, maximum value: 255, default value: 100.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_COLORSTYLE_SAT = 100
# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
# luminance component of the colors in the HTML output. Values below 100
# gradually make the output lighter, whereas values above 100 make the output
# darker. The value divided by 100 is the actual gamma applied, so 80 represents
# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
# change the gamma.
# Minimum value: 40, maximum value: 240, default value: 80.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_COLORSTYLE_GAMMA = 80
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting this
# to NO can help when comparing the output of multiple runs.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_TIMESTAMP = YES
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
# page has loaded.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_DYNAMIC_SECTIONS = @MITK_DOXYGEN_HTML_DYNAMIC_SECTIONS@
# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
# shown in the various tree structured indices initially; the user can expand
# and collapse entries dynamically later on. Doxygen will expand the tree to
# such a level that at most the specified number of entries are visible (unless
# a fully collapsed tree already exceeds this amount). So setting the number of
# entries 1 will produce a full collapsed tree by default. 0 is a special value
# representing an infinite number of entries and will result in a full expanded
# tree by default.
# Minimum value: 0, maximum value: 9999, default value: 100.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_INDEX_NUM_ENTRIES = 100
# If the GENERATE_DOCSET tag is set to YES, additional index files will be
# generated that can be used as input for Apple's Xcode 3 integrated development
# environment (see: http://developer.apple.com/tools/xcode/), introduced with
# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
# Makefile in the HTML output directory. Running make will produce the docset in
# that directory and running make install will install the docset in
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
# for more information.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_DOCSET = NO
# This tag determines the name of the docset feed. A documentation feed provides
# an umbrella under which multiple documentation sets from a single provider
# (such as a company or product suite) can be grouped.
# The default value is: Doxygen generated docs.
# This tag requires that the tag GENERATE_DOCSET is set to YES.
DOCSET_FEEDNAME = "Doxygen generated docs"
# This tag specifies a string that should uniquely identify the documentation
# set bundle. This should be a reverse domain-name style string, e.g.
# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_DOCSET is set to YES.
DOCSET_BUNDLE_ID = org.doxygen.Project
# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
# the documentation publisher. This should be a reverse domain-name style
# string, e.g. com.mycompany.MyDocSet.documentation.
# The default value is: org.doxygen.Publisher.
# This tag requires that the tag GENERATE_DOCSET is set to YES.
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
# The default value is: Publisher.
# This tag requires that the tag GENERATE_DOCSET is set to YES.
DOCSET_PUBLISHER_NAME = Publisher
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
# Windows.
#
# The HTML Help Workshop contains a compiler that can convert all HTML output
# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
# files are now used as the Windows 98 help format, and will replace the old
# Windows help format (.hlp) on all Windows platforms in the future. Compressed
# HTML files also contain an index, a table of contents, and you can search for
# words in the documentation. The HTML workshop also contains a viewer for
# compressed HTML files.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_HTMLHELP = NO
# The CHM_FILE tag can be used to specify the file name of the resulting .chm
# file. You can add a path in front of the file if the result should not be
# written to the html output directory.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
CHM_FILE =
# The HHC_LOCATION tag can be used to specify the location (absolute path
# including file name) of the HTML help compiler ( hhc.exe). If non-empty
# doxygen will try to run the HTML help compiler on the generated index.hhp.
# The file has to be specified with full path.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
HHC_LOCATION =
# The GENERATE_CHI flag controls if a separate .chi index file is generated (
# YES) or that it should be included in the master .chm file ( NO).
# The default value is: NO.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
GENERATE_CHI = NO
# The CHM_INDEX_ENCODING is used to encode HtmlHelp index ( hhk), content ( hhc)
# and project file content.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
CHM_INDEX_ENCODING =
# The BINARY_TOC flag controls whether a binary table of contents is generated (
# YES) or a normal table of contents ( NO) in the .chm file. Furthermore it
# enables the Previous and Next buttons.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
BINARY_TOC = NO
# The TOC_EXPAND flag can be set to YES to add extra items for group members to
# the table of contents of the HTML help documentation and to the tree view.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
TOC_EXPAND = NO
# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
# (.qch) of the generated HTML documentation.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_QHP = @MITK_DOXYGEN_GENERATE_QHP@
# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
# the file name of the resulting .qch file. The path specified is relative to
# the HTML output folder.
# This tag requires that the tag GENERATE_QHP is set to YES.
QCH_FILE = @MITK_DOXYGEN_QCH_FILE@
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
# Project output. For more information please see Qt Help Project / Namespace
# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_NAMESPACE = "org.mitk"
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
# Help Project output. For more information please see Qt Help Project / Virtual
# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
# folders).
# The default value is: doc.
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_VIRTUAL_FOLDER = MITK
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
# filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's filter section matches. Qt Help Project / Filter Attributes (see:
# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_SECT_FILTER_ATTRS =
# The QHG_LOCATION tag can be used to specify the location of Qt's
# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
# generated .qhp file.
# This tag requires that the tag GENERATE_QHP is set to YES.
QHG_LOCATION = @QT_HELPGENERATOR_EXECUTABLE@
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
# generated, together with the HTML files, they form an Eclipse help plugin. To
# install this plugin and make it available under the help contents menu in
# Eclipse, the contents of the directory containing the HTML and XML files needs
# to be copied into the plugins directory of eclipse. The name of the directory
# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
# After copying Eclipse needs to be restarted before the help appears.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_ECLIPSEHELP = NO
# A unique identifier for the Eclipse help plugin. When installing the plugin
# the directory name containing the HTML and XML files should also have this
# name. Each documentation set should have its own identifier.
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
ECLIPSE_DOC_ID = org.doxygen.Project
# If you want full control over the layout of the generated HTML pages it might
# be necessary to disable the index and replace it with your own. The
# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
# of each HTML page. A value of NO enables the index and the value YES disables
# it. Since the tabs in the index contain the same information as the navigation
# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
DISABLE_INDEX = NO
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# structure should be generated to display hierarchical information. If the tag
# value is set to YES, a side panel will be generated containing a tree-like
# index structure (just like the one that is generated for HTML Help). For this
# to work a browser that supports JavaScript, DHTML, CSS and frames is required
# (i.e. any modern browser). Windows users are probably better off using the
# HTML help feature. Via custom stylesheets (see HTML_EXTRA_STYLESHEET) one can
# further fine-tune the look of the index. As an example, the default style
# sheet generated by doxygen has an example that shows how to put an image at
# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
# the same information as the tab index, you could consider setting
# DISABLE_INDEX to YES when enabling this option.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_TREEVIEW = YES
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
# doxygen will group on one line in the generated HTML documentation.
#
# Note that a value of 0 will completely suppress the enum values from appearing
# in the overview section.
# Minimum value: 0, maximum value: 20, default value: 4.
# This tag requires that the tag GENERATE_HTML is set to YES.
ENUM_VALUES_PER_LINE = 4
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
# to set the initial width (in pixels) of the frame in which the tree is shown.
# Minimum value: 0, maximum value: 1500, default value: 250.
# This tag requires that the tag GENERATE_HTML is set to YES.
TREEVIEW_WIDTH = 300
# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open links to
# external symbols imported via tag files in a separate window.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
EXT_LINKS_IN_WINDOW = NO
# Use this tag to change the font size of LaTeX formulas included as images in
# the HTML documentation. When you change the font size after a successful
# doxygen run you need to manually remove any form_*.png images from the HTML
# output directory to force them to be regenerated.
# Minimum value: 8, maximum value: 50, default value: 10.
# This tag requires that the tag GENERATE_HTML is set to YES.
FORMULA_FONTSIZE = 10
# Use the FORMULA_TRANPARENT tag to determine whether or not the images
# generated for formulas are transparent PNGs. Transparent PNGs are not
# supported properly for IE 6.0, but are supported on all modern browsers.
#
# Note that when changing this option you need to delete any form_*.png files in
# the HTML output directory before the changes have effect.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
FORMULA_TRANSPARENT = YES
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
# http://www.mathjax.org) which uses client side Javascript for the rendering
# instead of using prerendered bitmaps. Use this if you do not have LaTeX
# installed or if you want to formulas look prettier in the HTML output. When
# enabled you may also need to install MathJax separately and configure the path
# to it using the MATHJAX_RELPATH option.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
USE_MATHJAX = YES
# When MathJax is enabled you can set the default output format to be used for
# the MathJax output. See the MathJax site (see:
# http://docs.mathjax.org/en/latest/output.html) for more details.
# Possible values are: HTML-CSS (which is slower, but has the best
# compatibility), NativeMML (i.e. MathML) and SVG.
# The default value is: HTML-CSS.
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_FORMAT = HTML-CSS
# When MathJax is enabled you need to specify the location relative to the HTML
# output directory using the MATHJAX_RELPATH option. The destination directory
# should contain the MathJax.js script. For instance, if the mathjax directory
# is located at the same level as the HTML output directory, then
# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
# Content Delivery Network so you can quickly see the result without installing
# MathJax. However, it is strongly recommended to install a local copy of
# MathJax from http://www.mathjax.org before deployment.
# The default value is: http://cdn.mathjax.org/mathjax/latest.
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_RELPATH = http://www.mathjax.org/mathjax
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
# extension names that should be enabled during MathJax rendering. For example
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_EXTENSIONS =
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
# of code that will be used on startup of the MathJax code. See the MathJax site
# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
# example see the documentation.
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_CODEFILE =
# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
# the HTML output. The underlying search engine uses javascript and DHTML and
# should work on any modern browser. Note that when using HTML help
# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
# there is already a search function so this one should typically be disabled.
# For large projects the javascript based search engine can be slow, then
# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
# search using the keyboard; to jump to the search box use <access key> + S
# (what the <access key> is depends on the OS and browser, but it is typically
# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
# key> to jump into the search results window, the results can be navigated
# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
# the search. The filter options can be selected when the cursor is inside the
# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
# to select a filter and <Enter> or <escape> to activate or cancel the filter
# option.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
SEARCHENGINE = YES
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web server instead of a web client using Javascript. There
# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
# setting. When disabled, doxygen will generate a PHP script for searching and
# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
# and searching needs to be provided by external tools. See the section
# "External Indexing and Searching" for details.
# The default value is: NO.
# This tag requires that the tag SEARCHENGINE is set to YES.
SERVER_BASED_SEARCH = NO
# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
# script for searching. Instead the search results are written to an XML file
# which needs to be processed by an external indexer. Doxygen will invoke an
# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
# search results.
#
# Doxygen ships with an example indexer ( doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library
# Xapian (see: http://xapian.org/).
#
# See the section "External Indexing and Searching" for details.
# The default value is: NO.
# This tag requires that the tag SEARCHENGINE is set to YES.
EXTERNAL_SEARCH = NO
# The SEARCHENGINE_URL should point to a search engine hosted by a web server
# which will return the search results when EXTERNAL_SEARCH is enabled.
#
# Doxygen ships with an example indexer ( doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library
# Xapian (see: http://xapian.org/). See the section "External Indexing and
# Searching" for details.
# This tag requires that the tag SEARCHENGINE is set to YES.
SEARCHENGINE_URL =
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
# search data is written to a file for indexing by an external tool. With the
# SEARCHDATA_FILE tag the name of this file can be specified.
# The default file is: searchdata.xml.
# This tag requires that the tag SEARCHENGINE is set to YES.
SEARCHDATA_FILE = searchdata.xml
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
# projects and redirect the results back to the right project.
# This tag requires that the tag SEARCHENGINE is set to YES.
EXTERNAL_SEARCH_ID =
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
# projects other than the one defined by this configuration file, but that are
# all added to the same external search index. Each project needs to have a
# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
# to a relative location where the documentation can be found. The format is:
# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
# This tag requires that the tag SEARCHENGINE is set to YES.
EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# Configuration options related to the LaTeX output
#---------------------------------------------------------------------------
# If the GENERATE_LATEX tag is set to YES doxygen will generate LaTeX output.
# The default value is: YES.
GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
# it.
# The default directory is: latex.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_OUTPUT = latex
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
# invoked.
#
# Note that when enabling USE_PDFLATEX this option is only used for generating
# bitmaps for formulas in the HTML output, but not in the Makefile that is
# written to the output directory.
# The default file is: latex.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_CMD_NAME = latex
# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
# index for LaTeX.
# The default file is: makeindex.
# This tag requires that the tag GENERATE_LATEX is set to YES.
MAKEINDEX_CMD_NAME = makeindex
# If the COMPACT_LATEX tag is set to YES doxygen generates more compact LaTeX
# documents. This may be useful for small projects and may help to save some
# trees in general.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
COMPACT_LATEX = NO
# The PAPER_TYPE tag can be used to set the paper type that is used by the
# printer.
# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
# 14 inches) and executive (7.25 x 10.5 inches).
# The default value is: a4.
# This tag requires that the tag GENERATE_LATEX is set to YES.
PAPER_TYPE = a4
# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
# that should be included in the LaTeX output. To get the times font for
# instance you can specify
# EXTRA_PACKAGES=times
# If left blank no extra packages will be included.
# This tag requires that the tag GENERATE_LATEX is set to YES.
EXTRA_PACKAGES = amssymb
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
# generated LaTeX document. The header should contain everything until the first
# chapter. If it is left blank doxygen will generate a standard header. See
# section "Doxygen usage" for information on how to let doxygen write the
# default header to a separate file.
#
# Note: Only use a user-defined header if you know what you are doing! The
# following commands have a special meaning inside the header: $title,
# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
# $projectbrief, $projectlogo. Doxygen will replace $title with the empy string,
# for the replacement values of the other commands the user is refered to
# HTML_HEADER.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_HEADER =
# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
# generated LaTeX document. The footer should contain everything after the last
# chapter. If it is left blank doxygen will generate a standard footer. See
# LATEX_HEADER for more information on how to generate a default footer and what
# special commands can be used inside the footer.
#
# Note: Only use a user-defined footer if you know what you are doing!
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_FOOTER =
# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the LATEX_OUTPUT output
# directory. Note that the files will be copied as-is; there are no commands or
# markers available.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_EXTRA_FILES =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
# contain links (just like the HTML output) instead of page references. This
# makes the output suitable for online browsing using a PDF viewer.
# The default value is: YES.
# This tag requires that the tag GENERATE_LATEX is set to YES.
PDF_HYPERLINKS = NO
# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
# the PDF file directly from the LaTeX files. Set this option to YES to get a
# higher quality PDF documentation.
# The default value is: YES.
# This tag requires that the tag GENERATE_LATEX is set to YES.
USE_PDFLATEX = NO
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
# command to the generated LaTeX files. This will instruct LaTeX to keep running
# if errors occur, instead of asking the user for help. This option is also used
# when generating formulas in HTML.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_BATCHMODE = NO
# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
# index chapters (such as File Index, Compound Index, etc.) in the output.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_HIDE_INDICES = NO
# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
# code with syntax highlighting in the LaTeX output.
#
# Note that which sources are shown also depends on other settings such as
# SOURCE_BROWSER.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_SOURCE_CODE = NO
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. See
# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
# The default value is: plain.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_BIB_STYLE = plain
#---------------------------------------------------------------------------
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
# If the GENERATE_RTF tag is set to YES doxygen will generate RTF output. The
# RTF output is optimized for Word 97 and may not look too pretty with other RTF
# readers/editors.
# The default value is: NO.
GENERATE_RTF = NO
# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
# it.
# The default directory is: rtf.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_OUTPUT = rtf
# If the COMPACT_RTF tag is set to YES doxygen generates more compact RTF
# documents. This may be useful for small projects and may help to save some
# trees in general.
# The default value is: NO.
# This tag requires that the tag GENERATE_RTF is set to YES.
COMPACT_RTF = NO
# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
# contain hyperlink fields. The RTF file will contain links (just like the HTML
# output) instead of page references. This makes the output suitable for online
# browsing using Word or some other Word compatible readers that support those
# fields.
#
# Note: WordPad (write) and others do not support links.
# The default value is: NO.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_HYPERLINKS = NO
# Load stylesheet definitions from file. Syntax is similar to doxygen's config
# file, i.e. a series of assignments. You only have to provide replacements,
# missing definitions are set to their default value.
#
# See also section "Doxygen usage" for information on how to generate the
# default style sheet that doxygen normally uses.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an RTF document. Syntax is
# similar to doxygen's config file. A template extensions file can be generated
# using doxygen -e rtf extensionFile.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_EXTENSIONS_FILE =
#---------------------------------------------------------------------------
# Configuration options related to the man page output
#---------------------------------------------------------------------------
# If the GENERATE_MAN tag is set to YES doxygen will generate man pages for
# classes and files.
# The default value is: NO.
GENERATE_MAN = NO
# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
# it. A directory man3 will be created inside the directory specified by
# MAN_OUTPUT.
# The default directory is: man.
# This tag requires that the tag GENERATE_MAN is set to YES.
MAN_OUTPUT = man
# The MAN_EXTENSION tag determines the extension that is added to the generated
# man pages. In case the manual section does not start with a number, the number
# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
# optional.
# The default value is: .3.
# This tag requires that the tag GENERATE_MAN is set to YES.
MAN_EXTENSION = .3
# The MAN_SUBDIR tag determines the name of the directory created within
# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
# MAN_EXTENSION with the initial . removed.
# This tag requires that the tag GENERATE_MAN is set to YES.
MAN_SUBDIR =
# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
# will generate one additional man file for each entity documented in the real
# man page(s). These additional files only source the real man page, but without
# them the man command would be unable to find the correct page.
# The default value is: NO.
# This tag requires that the tag GENERATE_MAN is set to YES.
MAN_LINKS = NO
#---------------------------------------------------------------------------
# Configuration options related to the XML output
#---------------------------------------------------------------------------
# If the GENERATE_XML tag is set to YES doxygen will generate an XML file that
# captures the structure of the code including all documentation.
# The default value is: NO.
GENERATE_XML = NO
# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
# it.
# The default directory is: xml.
# This tag requires that the tag GENERATE_XML is set to YES.
XML_OUTPUT = xml
# If the XML_PROGRAMLISTING tag is set to YES doxygen will dump the program
# listings (including syntax highlighting and cross-referencing information) to
# the XML output. Note that enabling this will significantly increase the size
# of the XML output.
# The default value is: YES.
# This tag requires that the tag GENERATE_XML is set to YES.
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
# If the GENERATE_DOCBOOK tag is set to YES doxygen will generate Docbook files
# that can be used to generate PDF.
# The default value is: NO.
GENERATE_DOCBOOK = NO
# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
# front of it.
# The default directory is: docbook.
# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
DOCBOOK_OUTPUT = docbook
# If the DOCBOOK_PROGRAMLISTING tag is set to YES doxygen will include the
# program listings (including syntax highlighting and cross-referencing
# information) to the DOCBOOK output. Note that enabling this will significantly
# increase the size of the DOCBOOK output.
# The default value is: NO.
# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
DOCBOOK_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
# If the GENERATE_AUTOGEN_DEF tag is set to YES doxygen will generate an AutoGen
# Definitions (see http://autogen.sf.net) file that captures the structure of
# the code including all documentation. Note that this feature is still
# experimental and incomplete at the moment.
# The default value is: NO.
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# Configuration options related to the Perl module output
#---------------------------------------------------------------------------
# If the GENERATE_PERLMOD tag is set to YES doxygen will generate a Perl module
# file that captures the structure of the code including all documentation.
#
# Note that this feature is still experimental and incomplete at the moment.
# The default value is: NO.
GENERATE_PERLMOD = NO
# If the PERLMOD_LATEX tag is set to YES doxygen will generate the necessary
# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
# output from the Perl module output.
# The default value is: NO.
# This tag requires that the tag GENERATE_PERLMOD is set to YES.
PERLMOD_LATEX = NO
# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be nicely
# formatted so it can be parsed by a human reader. This is useful if you want to
# understand what is going on. On the other hand, if this tag is set to NO the
# size of the Perl module output will be much smaller and Perl will parse it
# just the same.
# The default value is: YES.
# This tag requires that the tag GENERATE_PERLMOD is set to YES.
PERLMOD_PRETTY = YES
# The names of the make variables in the generated doxyrules.make file are
# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
# so different doxyrules.make files included by the same Makefile don't
# overwrite each other's variables.
# This tag requires that the tag GENERATE_PERLMOD is set to YES.
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
# If the ENABLE_PREPROCESSING tag is set to YES doxygen will evaluate all
# C-preprocessor directives found in the sources and include files.
# The default value is: YES.
ENABLE_PREPROCESSING = YES
# If the MACRO_EXPANSION tag is set to YES doxygen will expand all macro names
# in the source code. If set to NO only conditional compilation will be
# performed. Macro expansion can be done in a controlled way by setting
# EXPAND_ONLY_PREDEF to YES.
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
MACRO_EXPANSION = YES
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and
# EXPAND_AS_DEFINED tags.
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
EXPAND_ONLY_PREDEF = NO
# If the SEARCH_INCLUDES tag is set to YES the includes files in the
# INCLUDE_PATH will be searched if a #include is found.
# The default value is: YES.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
SEARCH_INCLUDES = YES
# The INCLUDE_PATH tag can be used to specify one or more directories that
# contain include files that are not input files but should be processed by the
# preprocessor.
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
# directories. If left blank, the patterns specified with FILE_PATTERNS will be
# used.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
INCLUDE_FILE_PATTERNS =
# The PREDEFINED tag can be used to specify one or more macro names that are
# defined before the preprocessor is started (similar to the -D option of e.g.
# gcc). The argument of the tag is a list of macros of the form: name or
# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
# is assumed. To prevent a macro definition from being undefined via #undef or
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED = itkNotUsed(x)= \
"itkSetMacro(name,type)=virtual void Set##name (type _arg);" \
"itkGetMacro(name,type)=virtual type Get##name ();" \
"itkGetConstMacro(name,type)=virtual type Get##name () const;" \
"itkSetStringMacro(name)=virtual void Set##name (const char* _arg);" \
"itkGetStringMacro(name)=virtual const char* Get##name () const;" \
"itkSetClampMacro(name,type,min,max)=virtual void Set##name (type _arg);" \
"itkSetObjectMacro(name,type)=virtual void Set##name (type* _arg);" \
"itkGetObjectMacro(name,type)=virtual type* Get##name ();" \
"itkSetConstObjectMacro(name,type)=virtual void Set##name ( const type* _arg);" \
"itkGetConstObjectMacro(name,type)=virtual const type* Get##name ();" \
"itkGetConstReferenceMacro(name,type)=virtual const type& Get##name ();" \
"itkGetConstReferenceObjectMacro(name,type)=virtual const type::Pointer& Get##name () const;" \
"itkBooleanMacro(name)=virtual void name##On (); virtual void name##Off ();" \
"itkSetVector2Macro(name,type)=virtual void Set##name (type _arg1, type _arg2) virtual void Set##name (type _arg[2]);" \
"itkGetVector2Macro(name,type)=virtual type* Get##name () const; virtual void Get##name (type& _arg1, type& _arg2) const; virtual void Get##name (type _arg[2]) const;" \
"itkSetVector3Macro(name,type)=virtual void Set##name (type _arg1, type _arg2, type _arg3) virtual void Set##name (type _arg[3]);" \
"itkGetVector3Macro(name,type)=virtual type* Get##name () const; virtual void Get##name (type& _arg1, type& _arg2, type& _arg3) const; virtual void Get##name (type _arg[3]) const;" \
"itkSetVector4Macro(name,type)=virtual void Set##name (type _arg1, type _arg2, type _arg3, type _arg4) virtual void Set##name (type _arg[4]);" \
"itkGetVector4Macro(name,type)=virtual type* Get##name () const; virtual void Get##name (type& _arg1, type& _arg2, type& _arg3, type& _arg4) const; virtual void Get##name (type _arg[4]) const;" \
"itkSetVector6Macro(name,type)=virtual void Set##name (type _arg1, type _arg2, type _arg3, type _arg4, type _arg5, type _arg6) virtual void Set##name (type _arg[6]);" \
"itkGetVector6Macro(name,type)=virtual type* Get##name () const; virtual void Get##name (type& _arg1, type& _arg2, type& _arg3, type& _arg4, type& _arg5, type& _arg6) const; virtual void Get##name (type _arg[6]) const;" \
"itkSetVectorMacro(name,type,count)=virtual void Set##name(type data[]);" \
"itkGetVectorMacro(name,type,count)=virtual type* Get##name () const;" \
"itkNewMacro(type)=static Pointer New();" \
"itkFactorylessNewMacro(type)=static Pointer New();" \
"itkCloneMacro(type)=Pointer Clone() const;" \
"itkTypeMacro(thisClass,superclass)=virtual const char *GetClassName() const;" \
"itkConceptMacro(name,concept)=enum { name = 0 };" \
"ITK_NUMERIC_LIMITS=std::numeric_limits" \
"ITK_TYPENAME=typename" \
"FEM_ABSTRACT_CLASS(thisClass,parentClass)=public: /** Standard Self typedef.*/ typedef thisClass Self; /** Standard Superclass typedef. */ typedef parentClass Superclass; /** Pointer or SmartPointer to an object. */ typedef Self* Pointer; /** Const pointer or SmartPointer to an object. */ typedef const Self* ConstPointer; private:" \
"FEM_CLASS(thisClass,parentClass)=FEM_ABSTRACT_CLASS(thisClass,parentClass) public: /** Create a new object from the existing one */ virtual Baseclass::Pointer Clone() const; /** Class ID for FEM object factory */ static const int CLID; /** Virtual function to access the class ID */ virtual int ClassID() const { return CLID; /** Object creation in an itk compatible way */ static Self::Pointer New() { return new Self(); } private:" \
FREEVERSION \
ERROR_CHECKING \
HAS_TIFF \
HAS_JPEG \
HAS_NETLIB \
HAS_PNG \
HAS_ZLIB \
HAS_GLUT \
HAS_QT \
VCL_USE_NATIVE_STL=1 \
VCL_USE_NATIVE_COMPLEX=1 \
VCL_HAS_BOOL=1 \
VXL_BIG_ENDIAN=1 \
VXL_LITTLE_ENDIAN=0 \
VNL_DLL_DATA= \
size_t=vcl_size_t \
"US_PREPEND_NAMESPACE(x)=us::x" \
"US_BEGIN_NAMESPACE= namespace us {" \
"US_END_NAMESPACE=}" \
"US_BASECLASS_NAME=itk::LightObject" \
US_EXPORT= \
"DEPRECATED(func)=func" \
@US_PLATFORM@
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
# macro definition that is found in the sources will be used. Use the PREDEFINED
# tag if you want to use a different macro definition that overrules the
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
# an all uppercase name, and do not end with a semicolon. Such function macros
# are typically used for boiler-plate code, and will confuse the parser if not
# removed.
# The default value is: YES.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration options related to external references
#---------------------------------------------------------------------------
# The TAGFILES tag can be used to specify one or more tag files. For each tag
# file the location of the external documentation should be added. The format of
# a tag file without this location is as follows:
# TAGFILES = file1 file2 ...
# Adding location for the tag files is done as follows:
# TAGFILES = file1=loc1 "file2 = loc2" ...
# where loc1 and loc2 can be relative or absolute paths or URLs. See the
# section "Linking to external documentation" for more information about the use
# of tag files.
# Note: Each tag file must have a unique name (where the name does NOT include
# the path). If a tag file is not located in the directory in which doxygen is
# run, you must also specify the path to the tagfile here.
TAGFILES =
# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
# tag file that is based on the input files it reads. See section "Linking to
# external documentation" for more information about the usage of tag files.
GENERATE_TAGFILE = @MITK_DOXYGEN_TAGFILE_NAME@
# If the ALLEXTERNALS tag is set to YES all external class will be listed in the
# class index. If set to NO only the inherited external classes will be listed.
# The default value is: NO.
ALLEXTERNALS = NO
# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed in
# the modules index. If set to NO, only the current project's groups will be
# listed.
# The default value is: YES.
EXTERNAL_GROUPS = NO
# If the EXTERNAL_PAGES tag is set to YES all external pages will be listed in
# the related pages index. If set to NO, only the current project's pages will
# be listed.
# The default value is: YES.
EXTERNAL_PAGES = YES
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
# If the CLASS_DIAGRAMS tag is set to YES doxygen will generate a class diagram
# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
# NO turns the diagrams off. Note that this option also works with HAVE_DOT
# disabled, but it is recommended to install and use dot, since it yields more
# powerful graphs.
# The default value is: YES.
CLASS_DIAGRAMS = YES
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
# If left empty dia is assumed to be found in the default search path.
DIA_PATH =
# If set to YES, the inheritance and collaboration graphs will hide inheritance
# and usage relations if the target is undocumented or is not a class.
# The default value is: YES.
HIDE_UNDOC_RELATIONS = YES
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
# available from the path. This tool is part of Graphviz (see:
# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
# Bell Labs. The other options in this section have no effect if this option is
# set to NO
# The default value is: NO.
HAVE_DOT = @HAVE_DOT@
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
# to run in parallel. When set to 0 doxygen will base this on the number of
# processors available in the system. You can set it explicitly to a value
# larger than 0 to get control over the balance between CPU load and processing
# speed.
# Minimum value: 0, maximum value: 32, default value: 0.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_NUM_THREADS = @MITK_DOXYGEN_DOT_NUM_THREADS@
# When you want a differently looking font in the dot files that doxygen
# generates you can specify the font name using DOT_FONTNAME. You need to make
# sure dot is able to find the font, which can be done by putting it in a
# standard location or by setting the DOTFONTPATH environment variable or by
# setting DOT_FONTPATH to the directory containing the font.
# The default value is: Helvetica.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_FONTNAME = Helvetica
# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
# dot graphs.
# Minimum value: 4, maximum value: 24, default value: 10.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_FONTSIZE = 10
# By default doxygen will tell dot to use the default font as specified with
# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
# the path where dot can find it using this tag.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_FONTPATH =
# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
# each documented class showing the direct and indirect inheritance relations.
# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
CLASS_GRAPH = YES
# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
# graph for each documented class showing the direct and indirect implementation
# dependencies (inheritance, containment, and class references variables) of the
# class with other documented classes.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
COLLABORATION_GRAPH = YES
# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
# groups, showing the direct groups dependencies.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
GROUP_GRAPHS = YES
# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
# collaboration diagrams in a style similar to the OMG's Unified Modeling
# Language.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
UML_LOOK = @MITK_DOXYGEN_UML_LOOK@
# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
# class node. If there are many fields or methods and many nodes the graph may
# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
# number of items for each type to make the size more manageable. Set this to 0
# for no limit. Note that the threshold may be exceeded by 50% before the limit
# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
# but if the number exceeds 15, the total amount of fields shown is limited to
# 10.
# Minimum value: 0, maximum value: 100, default value: 10.
# This tag requires that the tag HAVE_DOT is set to YES.
UML_LIMIT_NUM_FIELDS = 10
# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
# collaboration graphs will show the relations between templates and their
# instances.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
TEMPLATE_RELATIONS = YES
# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
# YES then doxygen will generate a graph for each documented file showing the
# direct and indirect include dependencies of the file with other documented
# files.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
INCLUDE_GRAPH = NO
# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
# set to YES then doxygen will generate a graph for each documented file showing
# the direct and indirect include dependencies of the file with other documented
# files.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
INCLUDED_BY_GRAPH = NO
# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
# dependency graph for every global function or class method.
#
# Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable call graphs for selected
# functions only using the \callgraph command.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
CALL_GRAPH = NO
# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
# dependency graph for every global function or class method.
#
# Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable caller graphs for selected
# functions only using the \callergraph command.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
CALLER_GRAPH = NO
# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
# hierarchy of all classes instead of a textual one.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
GRAPHICAL_HIERARCHY = NO
# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
# dependencies a directory has on other directories in a graphical way. The
# dependency relations are determined by the #include relations between the
# files in the directories.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
DIRECTORY_GRAPH = YES
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot.
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
# to make the SVG files visible in IE 9+ (other browsers do not have this
# requirement).
# Possible values are: png, jpg, gif and svg.
# The default value is: png.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_IMAGE_FORMAT = png
# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
# enable generation of interactive SVG images that allow zooming and panning.
#
# Note that this requires a modern browser other than Internet Explorer. Tested
# and working are Firefox, Chrome, Safari, and Opera.
# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
# the SVG files visible. Older versions of IE do not have SVG support.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
INTERACTIVE_SVG = NO
# The DOT_PATH tag can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_PATH = "@DOXYGEN_DOT_PATH@"
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the \dotfile
# command).
# This tag requires that the tag HAVE_DOT is set to YES.
DOTFILE_DIRS =
# The MSCFILE_DIRS tag can be used to specify one or more directories that
# contain msc files that are included in the documentation (see the \mscfile
# command).
MSCFILE_DIRS =
# The DIAFILE_DIRS tag can be used to specify one or more directories that
# contain dia files that are included in the documentation (see the \diafile
# command).
DIAFILE_DIRS =
# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
# path where java can find the plantuml.jar file. If left blank, it is assumed
# PlantUML is not used or called during a preprocessing step. Doxygen will
# generate a warning when it encounters a \startuml command in this case and
# will not generate output for the diagram.
# This tag requires that the tag HAVE_DOT is set to YES.
PLANTUML_JAR_PATH =
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
# that will be shown in the graph. If the number of nodes in a graph becomes
# larger than this value, doxygen will truncate the graph, which is visualized
# by representing a node as a red box. Note that doxygen if the number of direct
# children of the root node in a graph is already larger than
# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
# Minimum value: 0, maximum value: 10000, default value: 50.
# This tag requires that the tag HAVE_DOT is set to YES.
-DOT_GRAPH_MAX_NODES = 50
+DOT_GRAPH_MAX_NODES = 120
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
# generated by dot. A depth value of 3 means that only nodes reachable from the
# root by following a path via at most 3 edges will be shown. Nodes that lay
# further from the root node will be omitted. Note that setting this option to 1
# or 2 may greatly reduce the computation time needed for large code bases. Also
# note that the size of a graph can be further restricted by
# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
# Minimum value: 0, maximum value: 1000, default value: 0.
# This tag requires that the tag HAVE_DOT is set to YES.
MAX_DOT_GRAPH_DEPTH = 0
# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
# background. This is disabled by default, because dot on Windows does not seem
# to support this out of the box.
#
# Warning: Depending on the platform used, enabling this option may lead to
# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
# read).
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_TRANSPARENT = NO
# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
# files in one run (i.e. multiple -o and -T options on the command line). This
# makes dot run faster, but since only newer versions of dot (>1.8.10) support
# this, this feature is disabled by default.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_MULTI_TARGETS = NO
# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
# explaining the meaning of the various boxes and arrows in the dot generated
# graphs.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
GENERATE_LEGEND = YES
# If the DOT_CLEANUP tag is set to YES doxygen will remove the intermediate dot
# files that are used to generate the various graphs.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_CLEANUP = YES
diff --git a/Documentation/mitk_doxygen_extra.css b/Documentation/mitk_doxygen_extra.css
index dd1235b00c..2e2cef5271 100644
--- a/Documentation/mitk_doxygen_extra.css
+++ b/Documentation/mitk_doxygen_extra.css
@@ -1,203 +1,140 @@
/* Main Doxygen CSS overrides */
@import url(http://fonts.googleapis.com/css?family=Open+Sans);
body, table, div, p, dl {
font-family: 'Open Sans', Lucida Grande, Verdana, Geneva, Arial, sans-serif;
}
a {
color: #2d5c88;
}
#top {
border-bottom: 1px solid #e1e1e1;
}
.navpath ul {
background-image:none;
color:#dddddd;
}
.navpath li.navelem a {
color: inherit;
font-family: inherit;
text-shadow: none;
}
#projectname {
visibility: hidden;
height: 70px;
margin-left: -520px;
}
#projectbrief {
display: none;
}
#projectnumber {
font: inherit;
visibility: visible;
font-size: 12px;
position: relative;
top: 17px;
left: 80px;
}
#titlearea table tbody>tr:first-child>td:first-child {
background: url(mitkLogo.jpg) 0 0 no-repeat;
padding-right: 15px;
}
/* Doxygen navtree.css overrides */
#nav-tree .label {
font: inherit;
}
#nav-tree {
background-color: inherit;
}
#nav-tree {
background-image:none;
background-color: inherit;
}
/* Doxygen tabs.css overrides */
.tabs, .tabs2, .tabs3 {
background-image: none;
font-family: inherit;
}
.tabs2 {
font-size: 12px;
}
.tablist {
margin: 0 auto;
}
.tablist li {
background-image: none;
}
.tablist a {
background-image:none;
color: #808080;
transition:all .3s ease-out;
border-bottom:2px solid transparent;
}
.tablist a:hover {
background-image:none;
text-shadow: none;
color: #333333;
border-bottom: 2px solid #2d5c88;
}
.tablist li.current a {
background-image:none;
text-shadow: none;
color: #333333;
border-bottom: 2px solid #2d5c88;
}
/* Search field */
#MSearchBox .left {
border-style: solid none solid solid;
border-width: 1px;
background: none;
border-color: #000000;
}
#MSearchField {
margin-top: -1px;
border-style: solid none;
border-width: 1px;
border-color: #000000;
background: none;
padding-top: 0px;
padding-bottom: 0px;
}
#MSearchBox .right {
border-style: solid solid solid none;
border-width: 1px;
background: none;
border-color: #000000;
}
#MSearchResultsWindow {
background-color: #ffffff;
}
#MSearchSelectWindow {
border-color: #000000;
background-color: #ffffff;
}
-
-/* CSS for the generated extension point documentation, copied from schema.css */
-
-H6.SchemaHeader {
- font-size:16px;
- display:inline
-}
-
-P.SchemaCopyright {
- font-size: smaller;
- font-style: normal;
- color: #336699;
- display:inline;
- margin-top: 3.000000pt;
- margin-bottom: 11.000000pt;
- margin-right: 0.000000pt;
- margin-left: 0.000000pt;
-}
-
-P.SchemaDtd {
- color: #800000;
- margin-top: 0.000000pt;
- margin-bottom: 0.000000pt;
- margin-right: 0.000000pt;
- margin-left: 10.000000pt;
-}
-
-P.SchemaDtdAttlist {
- color: #800000;
- margin-top: 0.000000pt;
- margin-bottom: 0.000000pt;
- margin-right: 0.000000pt;
- margin-left: 20.000000pt;
-}
-
-span.SchemaTag {
- color: #000080;
-}
-
-span.SchemaCstring {
- color: #008000;
-}
-
-pre.Example {
- margin-top: 0.000000pt;
-}
-
-.ConfigMarkupElementDesc {
- color: black;
- margin-top: 0.000000pt;
- margin-bottom: 0.000000pt;
- margin-right: 0.000000pt;
- margin-left: 10.000000pt;
-}
-
-.ConfigMarkupAttlistDesc {
- color: black;
- margin-top: 0.000000pt;
- margin-bottom: 0.000000pt;
- margin-right: 0.000000pt;
- margin-left: 32.000000pt;
-}
-
diff --git a/Documentation/schema.css b/Documentation/schema.css
deleted file mode 100644
index fb2028d7b6..0000000000
--- a/Documentation/schema.css
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-H6.SchemaHeader {
- font-size:16px;
- display:inline
-}
-
-P.SchemaCopyright {
- font-size: smaller;
- font-style: normal;
- color: #336699;
- display:inline;
- margin-top: 3.000000pt;
- margin-bottom: 11.000000pt;
- margin-right: 0.000000pt;
- margin-left: 0.000000pt;
-}
-
-P.SchemaDtd {
- color: #800000;
- margin-top: 0.000000pt;
- margin-bottom: 0.000000pt;
- margin-right: 0.000000pt;
- margin-left: 10.000000pt;
-}
-
-P.SchemaDtdAttlist {
- color: #800000;
- margin-top: 0.000000pt;
- margin-bottom: 0.000000pt;
- margin-right: 0.000000pt;
- margin-left: 20.000000pt;
-}
-
-span.SchemaTag {
- color: #000080;
-}
-
-span.SchemaCstring {
- color: #008000;
-}
-
-pre.Example {
- margin-top: 0.000000pt;
-}
-
-.ConfigMarkupElementDesc {
- color: black;
- margin-top: 0.000000pt;
- margin-bottom: 0.000000pt;
- margin-right: 0.000000pt;
- margin-left: 10.000000pt;
-}
-
-.ConfigMarkupAttlistDesc {
- color: black;
- margin-top: 0.000000pt;
- margin-bottom: 0.000000pt;
- margin-right: 0.000000pt;
- margin-left: 32.000000pt;
-}
-
diff --git a/Examples/Plugins/org.mitk.example.gui.customviewer.views/src/internal/DicomView.cpp b/Examples/Plugins/org.mitk.example.gui.customviewer.views/src/internal/DicomView.cpp
index dc1420cf5a..9f644721bb 100644
--- a/Examples/Plugins/org.mitk.example.gui.customviewer.views/src/internal/DicomView.cpp
+++ b/Examples/Plugins/org.mitk.example.gui.customviewer.views/src/internal/DicomView.cpp
@@ -1,103 +1,105 @@
/*============================================================================
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 "DicomView.h"
#include "org_mitk_example_gui_customviewer_views_Activator.h"
#include "mitkIOUtil.h"
#include "mitkIDataStorageService.h"
#include "mitkImage.h"
#include <berryIWorkbench.h>
#include <berryIWorkbenchPage.h>
#include <berryIWorkbenchWindow.h>
#include "QDockWidget"
const std::string DicomView::VIEW_ID = "org.mitk.customviewer.views.dicomview";
DicomView::DicomView() : m_Parent(nullptr)
{
}
DicomView::~DicomView()
{
}
// //! [DicomViewCreatePartControl]
void DicomView::CreateQtPartControl(QWidget *parent)
{
// create GUI widgets
m_Parent = parent;
m_Controls.setupUi(parent);
// remove unused widgets
QPushButton *downloadButton = parent->findChild<QPushButton *>("downloadButton");
downloadButton->setVisible(false);
connect(m_Controls.importButton, SIGNAL(clicked()), m_Controls.widget, SLOT(OnFolderCDImport()));
connect(m_Controls.widget,
SIGNAL(SignalDicomToDataManager(const QHash<QString, QVariant> &)),
this,
SLOT(AddDataNodeFromDICOM(const QHash<QString, QVariant> &)));
m_Parent->setEnabled(true);
}
// //! [DicomViewCreatePartControl]
// //! [DicomViewCreateAddDataNodeInformation]
void DicomView::AddDataNodeFromDICOM(QHash<QString, QVariant> eventProperties)
{
QStringList listOfFilesForSeries;
std::vector<std::string> seriesToLoad;
listOfFilesForSeries = eventProperties["FilesForSeries"].toStringList();
if (!listOfFilesForSeries.isEmpty())
{
QStringListIterator it(listOfFilesForSeries);
while (it.hasNext())
{
seriesToLoad.push_back(it.next().toStdString());
}
auto results = mitk::IOUtil::Load(seriesToLoad, *(this->GetDataStorage().GetPointer()));
if (results->empty())
{
MITK_ERROR << "Error loading Dicom series";
}
// //! [DicomViewCreateAddDataNodeLoadSeries]
else
{
// //! [DicomViewCreateAddDataNode]
mitk::DataStorage::Pointer ds = this->GetDataStorage();
// //! [DicomViewCreateAddDataNode]
mitk::RenderingManager::GetInstance()->SetDataStorage(ds);
auto geometry = ds->ComputeBoundingGeometry3D(ds->GetAll());
mitk::RenderingManager::GetInstance()->InitializeViews(geometry);
// //! [DicomViewCreateAddDataNodeActivatePersp]
berry::IWorkbenchWindow::Pointer window = this->GetSite()->GetWorkbenchWindow();
QString perspectiveId = "org.mitk.example.viewerperspective";
window->GetWorkbench()->ShowPerspective(perspectiveId, berry::IWorkbenchWindow::Pointer(window));
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
// //! [DicomViewCreateAddDataNodeActivatePersp]
}
+ // //! [DicomViewCreateAddDataNodeLoadSeries]
}
}
+// //! [DicomViewCreateAddDataNodeInformation]
void DicomView::SetFocus()
{
}
diff --git a/Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/documentation/doxygen/ExampleExtensionPoint.dox b/Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/documentation/doxygen/ExampleExtensionPoint.dox
index f1f8a1a109..f701c5ba4a 100644
--- a/Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/documentation/doxygen/ExampleExtensionPoint.dox
+++ b/Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/documentation/doxygen/ExampleExtensionPoint.dox
@@ -1,55 +1,55 @@
/**
\page ExtensionPointDefinition Extension Point Definition
This example plugin defines an extension point and collects extensions.
\image html ExtensionPointWithoutExtension.png
In this example the extension point concept is used to define an extension point and extend the plugin functionality with it. The GUI consists of a view with two group boxes. In the right box the user can insert text in an input text field. The left box is the area where extensions for this plugin are displayed.
In the plugin.xml file of this application the extension point is defined as follows:
\image html DefinitionXML.png
The according schema (\github{Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/schema/changetext.exsd,changetext.exsd}) defines attributes for extensions of this extension point like a description.
In the view of this plugin the registry is used to find all available extensions. For each found descriptor a push button is created that holds the functionality extension.
\snippet MinimalView.cpp Collect extensions through registry
These created push buttons are connected to the ChangeText method that alters the input text (in the way the extension defines) and outputs the changed text in another text field.
\snippet MinimalView.cpp Use extended functionality to alter input text
The plugin can now be extened by extensions provided by other plugins.
View complete source files:
\li \github{Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/src/internal/ChangeTextDescriptor.cpp,ChangeTextDescriptor.cpp}
\li \github{Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/src/internal/ChangeTextDescriptor.h,ChangeTextDescriptor.h}
\li \github{Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/src/internal/ChangeTextRegistry.cpp,ChangeTextRegistry.cpp}
\li \github{Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/src/internal/ChangeTextRegistry.h,ChangeTextRegistry.h}
\li \github{Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/src/internal/ExtensionPointDefinition.cpp,ExtensionPointDefinition.cpp}
\li \github{Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/src/internal/ExtensionPointDefinition.h,ExtensionPointDefinition.h}
\li \github{Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/src/internal/ExtensionPointDefinitionConstants.cpp,ExtensionPointDefinitionConstants.cpp}
\li \github{Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/src/internal/ExtensionPointDefinitionConstants.h,ExtensionPointDefinitionConstants.h}
[\ref BlueBerryExampleExtensionPoint] [Next: \ref ExtensionContribution] [\ref BlueBerryExamples]
\page ExtensionContribution Extension Contribution
This example plugin holds no GUI. It just extends the Extension Point Definition plugin.
\image html ExtensionPointWithExtension.png
Through the extension of the Extension Point Definition plugin two functionalities are added by implementing the minimal IChangeText interface of the plugin.
In the plugin.xml file of the plugin the extensions are defined as follows:
\image html ContributionXML.png
- The extension point ID in the plugin.xml matches the ID of the extension point and is therefore found by the registry as a valid extension. A description is given for each extension although the schema for the extension point allows an extension without a description (<element ref="description" minOccurs="0" maxOccurs="1"/>).
+ The extension point ID in the plugin.xml matches the ID of the extension point and is therefore found by the registry as a valid extension. A description is given for each extension although the schema for the extension point allows an extension without a description (\c \<element ref="description" minOccurs="0" maxOccurs="1"/\>).
The GUI now holds two buttons that change the input text of the user to upper or lower case. This is done by two simple methods.
View complete source files:
\li \github{Examples/Plugins/org.mitk.example.gui.extensionpointcontribution/src/internal/ChangeTextToLowerCase.cpp,ChangeTextToLowerCase.cpp}
\li \github{Examples/Plugins/org.mitk.example.gui.extensionpointcontribution/src/internal/ChangeTextToLowerCase.h,ChangeTextToLowerCase.h}
\li \github{Examples/Plugins/org.mitk.example.gui.extensionpointcontribution/src/internal/ChangeTextToUpperCase.cpp,ChangeTextToUpperCase.cpp}
\li \github{Examples/Plugins/org.mitk.example.gui.extensionpointcontribution/src/internal/ChangeTextToUpperCase.h,ChangeTextToUpperCase.h}
[\ref BlueBerryExampleExtensionPoint] [Previous: \ref ExtensionPointDefinition] [\ref BlueBerryExamples]
*/
diff --git a/Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/schema/changetext.exsd b/Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/schema/changetext.exsd
index 5e1acd1a18..341ac2a2e0 100644
--- a/Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/schema/changetext.exsd
+++ b/Examples/Plugins/org.mitk.example.gui.extensionpointdefinition/schema/changetext.exsd
@@ -1,109 +1,85 @@
<?xml version='1.0' encoding='UTF-8'?>
<schema targetNamespace="org.mitk.example.extensionpointdefinition" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.mitk.example.extensionpointdefinition" id="changetext" name="Change Text of Label"/>
</appinfo>
- <documentation>
- This extension point is used as an example for the extension point declaration (BlueBerry examples).
- </documentation>
+
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="changetext" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
+
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="changetext">
<complexType>
<sequence>
<element ref="description" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- the identifier of the text changer
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- the name of the text changer
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified name of the class that implements
-&lt;samp&gt;IChangeText&lt;/samp&gt;.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="description" type="string">
<annotation>
<appinfo>
<meta.element translatable="true"/>
</appinfo>
- <documentation>
- An optional subelement whose body should contain text providing a short description.
- </documentation>
+
</annotation>
</element>
<annotation>
<appinfo>
<meta.section type="apiInfo"/>
</appinfo>
- <documentation>
- The value of the &lt;samp&gt;class&lt;/samp&gt; attribute must be a
-fully qualified name of the class that implements
-&lt;samp&gt;IChangeText&lt;/samp&gt;.
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="copyright"/>
</appinfo>
- <documentation>
- Copyright (c) German Cancer Research Center (DKFZ)&lt;br&gt;
-All rights reserved.
- </documentation>
+
</annotation>
</schema>
diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/CMakeLists.txt b/Examples/Plugins/org.mitk.example.gui.imaging/CMakeLists.txt
index 9c8b4036f3..4618724877 100644
--- a/Examples/Plugins/org.mitk.example.gui.imaging/CMakeLists.txt
+++ b/Examples/Plugins/org.mitk.example.gui.imaging/CMakeLists.txt
@@ -1,7 +1,8 @@
project(org_mitk_example_gui_imaging)
mitk_create_plugin(
EXPORT_DIRECTIVE EXAMPLES_EXPORT
EXPORTED_INCLUDE_SUFFIXES src
MODULE_DEPENDS MitkQtWidgetsExt MitkSegmentation
+ PACKAGE_DEPENDS VTK|IOImage
)
diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/ColorImageProcessing.png b/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/ColorImageProcessing-dox.png
similarity index 100%
rename from Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/ColorImageProcessing.png
rename to Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/ColorImageProcessing-dox.png
diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/QmitkColourImageProcessing.dox b/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/QmitkColourImageProcessing.dox
index 284abac1eb..d8a5195d1b 100644
--- a/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/QmitkColourImageProcessing.dox
+++ b/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/QmitkColourImageProcessing.dox
@@ -1,34 +1,34 @@
/**
\page org_mitk_views_colourimageprocessing The Colour Image Processing Module
-\imageMacro{ColorImageProcessing.png,"Icon of the Colour Image Processing Module",2.00}
+\imageMacro{ColorImageProcessing-dox.png,"Icon of the Colour Image Processing Module",2.00}
\section QmitkColourImageProcessingUserManualSummary Summary
This module allows the user to create coloured images from medical images. Generally, these coloured images would be used in presentations, research papers, or as a teaching aide.
\section QmitkColourImageProcessingUserManualOverview Overview
The purpose of this module is to create coloured images, which can then be later used in presentations, research papers, or anything else the user desires. Furthermore, different body sections can be assigned a different colour.
These images are not particularly useful for further image processing, but provide nice, clear, diagrams. Please note that ultrasound images cannot be coloured.
\section QmitkColourImageProcessingUserManualFilters Creating Coloured Images
Open an image in mitk, then click on the colour wheel button. Make sure the image you loaded is selected.
<H2>\ Image -> RGBAimage</H2>
Clicking on this button creates an RGBA image from your medical image, which should appear in your data manager.
<H2>\ Image + mask -> RGBAimage</H2>
Before clicking on this button, a mask is needed. A mask is generally created using the segmentation tool. Make sure both the mask and image are selected, then click on the image + mask -> RGBA image button. This creates an
RGBA image that is coloured only in section defined by the mask.
<H2>\ Image + mask + color-> RGBAimage</H2>
This functions the same way as the Image + mask -> RGBAimage. The difference is that the user can select the colour of the section represented by the mask. This is done by clicking on the colour next to the Image + mask + color-> RGBAimage button
If multiple RGBA images are created with different colours, they can be combined into one image. Ensure that the desired coloured images are selected, then click on the combine RGBA images button.
*/
diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/QmitkRegionGrowingUserManual.dox b/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/QmitkRegionGrowingUserManual.dox
index ca5f150f72..6facf2b2f3 100644
--- a/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/QmitkRegionGrowingUserManual.dox
+++ b/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/QmitkRegionGrowingUserManual.dox
@@ -1,29 +1,29 @@
/**
\page org_mitk_views_regiongrowing The Region Growing View
\imageMacro{regiongrowing.png,"Icon of the Region Growing View",2.00}
Available documentation sections:
- \ref QmitkRegionGrowingUserManualOverview
- \ref QmitkRegionGrowingUserManualUsage
\section QmitkRegionGrowingUserManualOverview Overview
-The Region growing view provides a programming example, showing developers how to create new views for MITK with a graphical user interface (GUI) that also uses some ITK image filters.
+The Region growing view provides a programming example, showing developers how to create new views for MITK with a graphical user interface (GUI) that also uses some ITK image filters.
-<b>For the programmers:</b> this functionality is the result of <a href="http://docs.mitk.org/nightly/Step9Page.html">tutorial step 9</a>
+<b>For the programmers:</b> this functionality is the result of <a href="https://docs.mitk.org/nightly/Step09Page.html">tutorial step 9</a>
\section QmitkRegionGrowingUserManualUsage Usage
<ul>
<li> you can set a number of seed points by clicking into the render windows while holding down the shift key.
</li>
<li> when clicking "Start region growing", a region growing algorithm starts. This algorithm is gray values based. The gray values are determined from the gray values at all point positions plus/minus a safety margin of 30 (Hounsfield units).
</li>
</ul>
*/
diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/QmitkSimpleExampleUserManual.dox b/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/QmitkSimpleExampleUserManual.dox
index ad170db4e3..e3493b2926 100644
--- a/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/QmitkSimpleExampleUserManual.dox
+++ b/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/QmitkSimpleExampleUserManual.dox
@@ -1,20 +1,20 @@
/**
\page org_mitk_views_simpleexample The Simple Example module
-\imageMacro{SimpleExample.png,"Icon of the Simple Example Module",2.00}
+\imageMacro{SimpleExample-dox.png,"Icon of the Simple Example Module",2.00}
\section QmitkSimpleExampleViewUserManualSummary Summary
This module is namely a simple example for simple image interaction.
It offers:
<ul>
<li>Sliders to navigate through the different slice stacks (Axial, Sagittal, Coronal) and the time steps
<li>A "player" for image time series. It automatically steps through all time series with a speed defined by the slider on the right.
<li>A button "Re-Initialize Navigators" to reinitialize those sliders to their initial position (Slice and time position 0)
<li>A button "Take Screenshot" to take a screenshot of the chosen window (Axial, Sagittal, Coronal, 3D)
<li>A button "Take HighDef 3D Screenshot" to take an high resolution screenshot of the 3D scene
<li>A button "Generate Movie" whichs takes a movie of the chosen window by scrolling either through all slices (Axial, Sagittal, Coronal). Please use the MovieMaker view for recording a movie of a rotating 3D scene.
<li>A selection box where the 3D view can be transformed into either a red-blue stereo or a D4D stereo view
</ul>
*/
diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/SimpleExample.png b/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/SimpleExample-dox.png
similarity index 100%
rename from Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/SimpleExample.png
rename to Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/SimpleExample-dox.png
diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/org_mitk_gui_qt_viewinitialization.dox b/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/org_mitk_gui_qt_viewinitialization.dox
index 73ff748694..43ce41c22d 100644
--- a/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/org_mitk_gui_qt_viewinitialization.dox
+++ b/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/org_mitk_gui_qt_viewinitialization.dox
@@ -1,8 +1,8 @@
/**
\page org_mitk_views_viewinitialitzation The View Initialization Module
-\imageMacro{viewInitializationIcon.png,"Icon of the View Initialization Module",2.00}
+\imageMacro{viewInitializationIcon-dox.png,"Icon of the View Initialization Module",2.00}
This view serves as a sandbox for understanding and experimenting with the geometry initialization parameters. For example, to view the axial slices from above instead of from below. It is not intended for end users, but for developers.
*/
\ No newline at end of file
diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/regiongrowing.xpm b/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/regiongrowing.xpm
deleted file mode 100644
index 45304646ee..0000000000
--- a/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/regiongrowing.xpm
+++ /dev/null
@@ -1,53 +0,0 @@
-/* XPM */
-static const char * icon_xpm[] = {
-"28 26 24 1",
-" c None",
-". c #000000",
-"+ c #639A31",
-"@ c #316500",
-"# c #6B9A31",
-"$ c #94CF63",
-"% c #396500",
-"& c #9CCB6B",
-"* c #94CB63",
-"= c #9CCB63",
-"- c #6B9639",
-"; c #316900",
-"> c #949A94",
-", c #9C969C",
-"' c #6B656B",
-") c #CECBCE",
-"! c #9C9A9C",
-"~ c #393039",
-"{ c #313431",
-"] c #C6CFC6",
-"^ c #636963",
-"/ c #636563",
-"( c #9C6500",
-"_ c #946500",
-" .. ",
-" .+@. ",
-" .#$%. ",
-" .&+. .... ",
-" .+. .+&*@. ",
-" . .=$#+%. ",
-" .$.... ",
-" . ",
-" ............ ",
-" ..+*&=+&++-+++.. ",
-" .=-;%;@%@%;@@%;-+. ... ",
-" .+@@@@%;@;%;%;@@&+. .++-. ",
-" .%@-+=&+-++#++-*#+. .&+@.",
-" .>>@;@;;@;#+%+;@;-. .&%.",
-" .,'))>!'>'=+%;'~{+. .;.",
-" .>!])'!^!{-+;//{{-@. . ",
-" .!'))>!'{~;&@'{/~+@. ",
-" .(>>)]'>{{/'@/{'{{+%. ",
-"._{{{{{{~{,'^'/'/{~@@. ",
-" .(,>))/>/!//^'^{'{.. ",
-" .>/])>,/>'/'/~^{{. ",
-" .!,>>'>'>/^/^'/~{./^ ",
-" .{{!'!!'>''''/~{{.''//'/ ",
-" /..{{~{{~{{{{{{../^^/'^'' ",
-" ^/............'^/''^'// ",
-" /'^'/^'//^//'// "};
diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/viewInitializationIcon.png b/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/viewInitializationIcon-dox.png
similarity index 100%
rename from Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/viewInitializationIcon.png
rename to Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/viewInitializationIcon-dox.png
diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/viewInitializationIcon.xpm b/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/viewInitializationIcon.xpm
deleted file mode 100644
index 819882324c..0000000000
--- a/Examples/Plugins/org.mitk.example.gui.imaging/documentation/UserManual/viewInitializationIcon.xpm
+++ /dev/null
@@ -1,17 +0,0 @@
-/* XPM */
-static const char * icon_xpm[] = {
-"11 11 3 1",
-" c None",
-". c #CBCBCB",
-"+ c #404040",
-"+++++++++++",
-"+..+...+..+",
-"+++++++++++",
-"+..+...+..+",
-"+..+...+..+",
-"+++++++++++",
-"+..+...+..+",
-"+..+...+..+",
-"+++++++++++",
-"+..+...+..+",
-"+++++++++++"};
diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simpleexample/QmitkSimpleExampleView.cpp b/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simpleexample/QmitkSimpleExampleView.cpp
index 28a8de8327..d4e166ce06 100644
--- a/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simpleexample/QmitkSimpleExampleView.cpp
+++ b/Examples/Plugins/org.mitk.example.gui.imaging/src/internal/simpleexample/QmitkSimpleExampleView.cpp
@@ -1,418 +1,418 @@
/*============================================================================
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 "QmitkSimpleExampleView.h"
+#include <vtkImageWriter.h>
+#include <vtkJPEGWriter.h>
+#include <vtkPNGWriter.h>
+#include <vtkRenderLargeImage.h>
+#include <vtkRenderWindow.h>
+#include <vtkOpenGL.h>
+
#include "QmitkRenderWindow.h"
#include "QmitkStepperAdapter.h"
#include "QmitkFFmpegWriter.h"
#include "mitkNodePredicateNot.h"
#include "mitkNodePredicateProperty.h"
#include "mitkProperties.h"
#include <QDir>
#include <QFileDialog>
#include <QFileInfo>
#include <QMessageBox>
#include <berryPlatform.h>
-#include <vtkImageWriter.h>
-#include <vtkJPEGWriter.h>
-#include <vtkPNGWriter.h>
-#include <vtkRenderLargeImage.h>
-#include <vtkRenderWindow.h>
-#include <vtkOpenGL.h>
-
const std::string QmitkSimpleExampleView::VIEW_ID = "org.mitk.views.simpleexample";
QmitkSimpleExampleView::QmitkSimpleExampleView()
: m_Controls(nullptr), m_NavigatorsInitialized(false), m_Parent(nullptr)
{
}
QmitkSimpleExampleView::~QmitkSimpleExampleView()
{
}
void QmitkSimpleExampleView::CreateQtPartControl(QWidget *parent)
{
if (!m_Controls)
{
m_Parent = parent;
// create GUI widgets
m_Controls = new Ui::QmitkSimpleExampleViewControls;
m_Controls->setupUi(parent);
this->CreateConnections();
this->RenderWindowPartActivated(this->GetRenderWindowPart());
}
}
void QmitkSimpleExampleView::SetFocus()
{
m_Controls->renderWindowComboBox->setFocus();
}
void QmitkSimpleExampleView::RenderWindowPartActivated(mitk::IRenderWindowPart *renderWindowPart)
{
if (renderWindowPart == nullptr)
{
m_Parent->setEnabled(false);
return;
}
QHashIterator<QString, QmitkRenderWindow *> renderIter(renderWindowPart->GetQmitkRenderWindows());
while (renderIter.hasNext())
{
renderIter.next();
m_Controls->renderWindowComboBox->addItem(renderIter.key());
}
RenderWindowSelected(m_Controls->renderWindowComboBox->currentText());
m_TimeStepper.reset(new QmitkStepperAdapter(m_Controls->sliceNavigatorTime,
renderWindowPart->GetTimeNavigationController()->GetTime(),
"sliceNavigatorTimeFromSimpleExample"));
m_MovieStepper.reset(new QmitkStepperAdapter(m_Controls->movieNavigatorTime,
renderWindowPart->GetTimeNavigationController()->GetTime(),
"movieNavigatorTimeFromSimpleExample"));
m_Parent->setEnabled(true);
}
void QmitkSimpleExampleView::RenderWindowPartDeactivated(mitk::IRenderWindowPart * /*renderWindowPart*/)
{
m_Parent->setEnabled(false);
m_SliceStepper.reset();
m_TimeStepper.reset();
m_MovieStepper.reset();
m_Controls->renderWindowComboBox->clear();
}
void QmitkSimpleExampleView::CreateConnections()
{
if (m_Controls)
{
connect(m_Controls->renderWindowComboBox,
SIGNAL(currentIndexChanged(QString)),
this,
SLOT(RenderWindowSelected(QString)));
connect(m_Controls->stereoSelect, SIGNAL(activated(int)), this, SLOT(StereoSelectionChanged(int)));
connect(m_Controls->reInitializeNavigatorsButton, SIGNAL(clicked()), this, SLOT(InitNavigators()));
connect(m_Controls->genMovieButton, SIGNAL(clicked()), this, SLOT(GenerateMovie()));
connect(m_Controls->m_TakeScreenshotBtn, SIGNAL(clicked()), this, SLOT(OnTakeScreenshot()));
connect(m_Controls->m_TakeHighResScreenShotBtn, SIGNAL(clicked()), this, SLOT(OnTakeHighResolutionScreenshot()));
}
}
void QmitkSimpleExampleView::InitNavigators()
{
/* get all nodes that have not set "includeInBoundingBox" to false */
mitk::NodePredicateNot::Pointer pred = mitk::NodePredicateNot::New(
mitk::NodePredicateProperty::New("includeInBoundingBox", mitk::BoolProperty::New(false)));
mitk::DataStorage::SetOfObjects::ConstPointer rs = this->GetDataStorage()->GetSubset(pred);
/* calculate bounding geometry of these nodes */
auto bounds = this->GetDataStorage()->ComputeBoundingGeometry3D(rs);
/* initialize the views to the bounding geometry */
m_NavigatorsInitialized = mitk::RenderingManager::GetInstance()->InitializeViews(bounds);
}
/**
* Returns path to the ffmpeg lib if configured in preferences.
*
* This implementation has been reused from MovieMaker view.
*
* @return The path to ffmpeg lib or empty string if not configured.
*/
QString QmitkSimpleExampleView::GetFFmpegPath() const
{
berry::IPreferences::Pointer preferences =
berry::Platform::GetPreferencesService()->GetSystemPreferences()->Node("/org.mitk.gui.qt.ext.externalprograms");
return preferences.IsNotNull() ? preferences->Get("ffmpeg", "") : "";
}
/**
* Reads pixels from specified render window.
*
* This implementation has been reused from MovieMaker view.
*
* @param renderWindow
* @param x
* @param y
* @param width
* @param height
* @return
*/
static unsigned char *ReadPixels(vtkRenderWindow *renderWindow, int x, int y, int width, int height)
{
if (renderWindow == nullptr)
return nullptr;
unsigned char *frame = new unsigned char[width * height * 3];
renderWindow->MakeCurrent();
glReadPixels(x, y, width, height, GL_RGB, GL_UNSIGNED_BYTE, frame);
return frame;
}
/**
* Records a movie from the selected render window with a default frame rate of 30 Hz.
*
* Parts of this implementation have been reused from MovieMaker view.
*/
void QmitkSimpleExampleView::GenerateMovie()
{
QmitkRenderWindow *movieRenderWindow = GetSelectedRenderWindow();
mitk::Stepper::Pointer stepper = movieRenderWindow->GetSliceNavigationController()->GetSlice();
QmitkFFmpegWriter *movieWriter = new QmitkFFmpegWriter(m_Parent);
const QString ffmpegPath = GetFFmpegPath();
if (ffmpegPath.isEmpty())
{
QMessageBox::information(
nullptr,
"Movie Maker",
"<p>Set path to FFmpeg<sup>1</sup> in preferences (Window -> Preferences... "
"(Ctrl+P) -> External Programs) to be able to record your movies to video files.</p>"
"<p>If you are using Linux, chances are good that FFmpeg is included in the official package "
"repositories.</p>"
"<p>[1] <a href=\"https://www.ffmpeg.org/download.html\">Download FFmpeg from ffmpeg.org</a></p>");
return;
}
movieWriter->SetFFmpegPath(GetFFmpegPath());
- vtkRenderWindow *renderWindow = movieRenderWindow->GetRenderWindow();
+ vtkRenderWindow *renderWindow = movieRenderWindow->renderWindow();
if (renderWindow == nullptr)
return;
const int border = 3;
const int x = border;
const int y = border;
int width = renderWindow->GetSize()[0] - border * 2;
int height = renderWindow->GetSize()[1] - border * 2;
if (width & 1)
--width;
if (height & 1)
--height;
if (width < 16 || height < 16)
return;
movieWriter->SetSize(width, height);
movieWriter->SetFramerate(30);
QString saveFileName = QFileDialog::getSaveFileName(nullptr, "Specify a filename", "", "Movie (*.mp4)");
if (saveFileName.isEmpty())
return;
if (!saveFileName.endsWith(".mp4"))
saveFileName += ".mp4";
movieWriter->SetOutputPath(saveFileName);
const unsigned int numberOfFrames = stepper->GetSteps() - stepper->GetPos();
try
{
movieWriter->Start();
for (unsigned int currentFrame = 0; currentFrame < numberOfFrames; ++currentFrame)
{
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
renderWindow->MakeCurrent();
unsigned char *frame = ReadPixels(renderWindow, x, y, width, height);
movieWriter->WriteFrame(frame);
delete[] frame;
stepper->Next();
}
movieWriter->Stop();
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
}
catch (const mitk::Exception &exception)
{
mitk::RenderingManager::GetInstance()->ForceImmediateUpdateAll();
QMessageBox::critical(nullptr, "Generate Movie", exception.GetDescription());
}
}
void QmitkSimpleExampleView::StereoSelectionChanged(int id)
{
/* From vtkRenderWindow.h tells us about stereo rendering:
Set/Get what type of stereo rendering to use. CrystalEyes mode uses frame-sequential capabilities available in OpenGL
to drive LCD shutter glasses and stereo projectors. RedBlue mode is a simple type of stereo for use with red-blue
glasses. Anaglyph mode is a superset of RedBlue mode, but the color output channels can be configured using the
AnaglyphColorMask and the color of the original image can be (somewhat maintained using AnaglyphColorSaturation; the
default colors for Anaglyph mode is red-cyan. Interlaced stereo mode produces a composite image where horizontal
lines alternate between left and right views. StereoLeft and StereoRight modes choose one or the other stereo view.
Dresden mode is yet another stereoscopic interleaving.
*/
mitk::IRenderWindowPart *renderWindowPart = this->GetRenderWindowPart();
vtkRenderWindow *vtkrenderwindow = renderWindowPart->GetQmitkRenderWindow("3d")->GetVtkRenderWindow();
// note: foreground vtkRenderers (at least the department logo renderer) produce errors in stereoscopic visualization.
// Therefore, we disable the logo visualization during stereo rendering.
switch (id)
{
case 0:
vtkrenderwindow->StereoRenderOff();
break;
case 1:
vtkrenderwindow->SetStereoTypeToRedBlue();
vtkrenderwindow->StereoRenderOn();
renderWindowPart->EnableDecorations(false, QStringList(mitk::IRenderWindowPart::DECORATION_LOGO));
break;
case 2:
vtkrenderwindow->SetStereoTypeToDresden();
vtkrenderwindow->StereoRenderOn();
renderWindowPart->EnableDecorations(false, QStringList(mitk::IRenderWindowPart::DECORATION_LOGO));
break;
}
mitk::BaseRenderer::GetInstance(vtkrenderwindow)->SetMapperID(mitk::BaseRenderer::Standard3D);
renderWindowPart->RequestUpdate();
}
QmitkRenderWindow *QmitkSimpleExampleView::GetSelectedRenderWindow() const
{
QString id = m_Controls->renderWindowComboBox->currentText();
if (id.isEmpty())
{
return nullptr;
}
else
{
return this->GetRenderWindowPart()->GetQmitkRenderWindow(id);
}
}
void QmitkSimpleExampleView::OnTakeHighResolutionScreenshot()
{
QString filter;
QString fileName = QFileDialog::getSaveFileName(
nullptr, "Save screenshot to...", QDir::currentPath(), m_PNGExtension + ";;" + m_JPGExtension, &filter);
vtkRenderer *renderer = this->GetSelectedRenderWindow()->GetRenderer()->GetVtkRenderer();
if (renderer == nullptr)
return;
this->TakeScreenshot(renderer, 4, fileName, filter);
}
void QmitkSimpleExampleView::OnTakeScreenshot()
{
QString filter;
QString fileName = QFileDialog::getSaveFileName(
nullptr, "Save screenshot to...", QDir::currentPath(), m_PNGExtension + ";;" + m_JPGExtension, &filter);
QmitkRenderWindow *renWin = this->GetSelectedRenderWindow();
if (renWin == nullptr)
return;
vtkRenderer *renderer = renWin->GetRenderer()->GetVtkRenderer();
if (renderer == nullptr)
return;
this->TakeScreenshot(renderer, 1, fileName, filter);
}
void QmitkSimpleExampleView::TakeScreenshot(vtkRenderer *renderer,
unsigned int magnificationFactor,
QString fileName,
QString filter)
{
if ((renderer == nullptr) || (magnificationFactor < 1) || fileName.isEmpty())
return;
bool doubleBuffering(renderer->GetRenderWindow()->GetDoubleBuffer());
renderer->GetRenderWindow()->DoubleBufferOff();
vtkImageWriter *fileWriter = nullptr;
QFileInfo fi(fileName);
QString suffix = fi.suffix().toLower();
if (suffix.isEmpty() || (suffix != "png" && suffix != "jpg" && suffix != "jpeg"))
{
if (filter == m_PNGExtension)
{
suffix = "png";
}
else if (filter == m_JPGExtension)
{
suffix = "jpg";
}
fileName += "." + suffix;
}
if (suffix.compare("jpg", Qt::CaseInsensitive) == 0 || suffix.compare("jpeg", Qt::CaseInsensitive) == 0)
{
vtkJPEGWriter *w = vtkJPEGWriter::New();
w->SetQuality(100);
w->ProgressiveOff();
fileWriter = w;
}
else // default is png
{
fileWriter = vtkPNGWriter::New();
}
vtkRenderLargeImage *magnifier = vtkRenderLargeImage::New();
magnifier->SetInput(renderer);
magnifier->SetMagnification(magnificationFactor);
fileWriter->SetInputConnection(magnifier->GetOutputPort());
fileWriter->SetFileName(fileName.toLatin1());
// vtkRenderLargeImage has problems with different layers, therefore we have to
// temporarily deactivate all other layers.
// we set the background to white, because it is nicer than black...
double oldBackground[3];
renderer->GetBackground(oldBackground);
double white[] = {1.0, 1.0, 1.0};
renderer->SetBackground(white);
mitk::IRenderWindowPart *renderWindowPart = this->GetRenderWindowPart();
renderWindowPart->EnableDecorations(false);
fileWriter->Write();
fileWriter->Delete();
renderWindowPart->EnableDecorations(true);
renderer->SetBackground(oldBackground);
renderer->GetRenderWindow()->SetDoubleBuffer(doubleBuffering);
}
void QmitkSimpleExampleView::RenderWindowSelected(const QString &id)
{
if (!id.isEmpty())
{
m_SliceStepper.reset(new QmitkStepperAdapter(
m_Controls->sliceNavigator,
this->GetRenderWindowPart()->GetQmitkRenderWindow(id)->GetSliceNavigationController()->GetSlice(),
"sliceNavigatorFromSimpleExample"));
}
}
diff --git a/Examples/Plugins/org.mitk.example.gui.multipleperspectives/documentation/doxygen/MultiplePerspectives.dox b/Examples/Plugins/org.mitk.example.gui.multipleperspectives/documentation/doxygen/MultiplePerspectives.dox
index 61c0eb9440..0fd2354c43 100644
--- a/Examples/Plugins/org.mitk.example.gui.multipleperspectives/documentation/doxygen/MultiplePerspectives.dox
+++ b/Examples/Plugins/org.mitk.example.gui.multipleperspectives/documentation/doxygen/MultiplePerspectives.dox
@@ -1,36 +1,36 @@
/**
\page BlueBerryExampleMultiplePerspectives Multiple perspectives and views
\image html MultiplePerspectives.png
The second example creates two perspectives. The first perspective has a visible editor area and uses a folder to bring the first view to the left side. The second perspective sets the editor area to invisible. The two views are filled with an empty QListWidget. The perspective bar is enabled.
The visibility of the editor area is set in the corresponding perspective cpp file by:
- \snippet MinimalPerspective.cpp Visibility of editor area
+ \snippet MinimumPerspective.cpp Visibility of editor area
The visibility of the perspective bar is set in the applications MultiplePerspectives.cpp:
\snippet MultiplePerspectives.cpp Visibility of perspective bar
Here we can also set/change some other general preferences (e.g. the initial size):
\snippet MultiplePerspectives.cpp initial window size
The perspective bar:
\image html Perspectivebar.png
The icons of the perspectives are definded by the extension declaration in the plugin.xml
of the example and lie in the resources directory of the plug-in:
\include org.mitk.example.gui.multipleperspectives/plugin.xml
View complete source files:
\li \github{Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MultiplePerspectives.cpp,MultiplePerspectives.cpp}
\li \github{Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MultiplePerspectives.h,MultiplePerspectives.h}
- \li \github{Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimalPerspective.cpp,MinimalPerspective.cpp}
- \li \github{Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimalPerspective.h,MinimalPerspective.h}
+ \li \github{Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimumPerspective.cpp,MinimumPerspective.cpp}
+ \li \github{Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimumPerspective.h,MinimumPerspective.h}
\li \github{Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/ExtendedPerspective.cpp,ExtendedPerspective.cpp}
\li \github{Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/ExtendedPerspective.h,ExtendedPerspective.h}
-\ref [\ref BlueBerryIntro] [Previous: \ref BlueBerryExampleMinimalApplication] [Next: \ref BlueBerrySelectionServiceIntro]
+ [\ref BlueBerryIntro] [Previous: \ref BlueBerryExampleMinimalApplication] [Next: \ref BlueBerrySelectionServiceIntro]
*/
diff --git a/Examples/Plugins/org.mitk.example.gui.multipleperspectives/files.cmake b/Examples/Plugins/org.mitk.example.gui.multipleperspectives/files.cmake
index 0b6c74c4c4..bafc5cf0f5 100644
--- a/Examples/Plugins/org.mitk.example.gui.multipleperspectives/files.cmake
+++ b/Examples/Plugins/org.mitk.example.gui.multipleperspectives/files.cmake
@@ -1,43 +1,43 @@
set(SRC_CPP_FILES
)
set(INTERNAL_CPP_FILES
org_mitk_example_gui_multipleperspectives_Activator.cpp
MultiplePerspectives.cpp
- MinimalPerspective.cpp
+ MinimumPerspective.cpp
ExtendedPerspective.cpp
EmptyView1.cpp
EmptyView2.cpp
)
set(UI_FILES
src/internal/EmptyView1Controls.ui
src/internal/EmptyView2Controls.ui
)
set(MOC_H_FILES
src/internal/org_mitk_example_gui_multipleperspectives_Activator.h
src/internal/MultiplePerspectives.h
- src/internal/MinimalPerspective.h
+ src/internal/MinimumPerspective.h
src/internal/ExtendedPerspective.h
src/internal/EmptyView1.h
src/internal/EmptyView2.h
)
set(CACHED_RESOURCE_FILES
plugin.xml
resources/perspectiveIcon1.png
resources/perspectiveIcon2.png
resources/viewIcon1.png
resources/viewIcon2.png
)
set(CPP_FILES )
foreach(file ${SRC_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/${file})
endforeach(file ${SRC_CPP_FILES})
foreach(file ${INTERNAL_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/internal/${file})
endforeach(file ${INTERNAL_CPP_FILES})
diff --git a/Examples/Plugins/org.mitk.example.gui.multipleperspectives/plugin.xml b/Examples/Plugins/org.mitk.example.gui.multipleperspectives/plugin.xml
index fdd885a25b..a9789fc661 100644
--- a/Examples/Plugins/org.mitk.example.gui.multipleperspectives/plugin.xml
+++ b/Examples/Plugins/org.mitk.example.gui.multipleperspectives/plugin.xml
@@ -1,46 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
<extension id="org.mitk.example.multipleperspectives" point="org.blueberry.osgi.applications">
<application>
<run class="MultiplePerspectives"/>
</application>
</extension>
<extension point="org.blueberry.ui.perspectives">
<perspective
id="org.mitk.example.minimalperspective"
name="Minimal Perspective 1"
icon="resources/perspectiveIcon1.png"
- class="MinimalPerspective">
+ class="MinimumPerspective">
</perspective>
</extension>
<extension point="org.blueberry.ui.perspectives">
<perspective
id="org.mitk.example.extendedperspective"
name="Minimal Perspective 2"
icon="resources/perspectiveIcon2.png"
class="ExtendedPerspective">
</perspective>
</extension>
<extension point="org.blueberry.ui.views">
<view
id="org.mitk.views.emptyview1"
name="Empty View 1"
icon="resources/viewIcon1.png"
class="EmptyView1">
</view>
</extension>
<extension point="org.blueberry.ui.views">
<view
id="org.mitk.views.emptyview2"
name="Empty View 2"
icon="resources/viewIcon2.png"
class="EmptyView2">
</view>
</extension>
</plugin>
diff --git a/Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimalPerspective.cpp b/Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimumPerspective.cpp
similarity index 87%
rename from Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimalPerspective.cpp
rename to Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimumPerspective.cpp
index 45f8ea1c47..bac0c58abb 100644
--- a/Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimalPerspective.cpp
+++ b/Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimumPerspective.cpp
@@ -1,39 +1,39 @@
/*============================================================================
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 "MinimalPerspective.h"
+#include "MinimumPerspective.h"
// berry includes
#include "berryIViewLayout.h"
-MinimalPerspective::MinimalPerspective()
+MinimumPerspective::MinimumPerspective()
{
}
-void MinimalPerspective::CreateInitialLayout(berry::IPageLayout::Pointer layout)
+void MinimumPerspective::CreateInitialLayout(berry::IPageLayout::Pointer layout)
{
// Editors are placed for free.
QString editorAreaId = layout->GetEditorArea();
//! [Visibility of editor area]
// set editor area to visible
layout->SetEditorAreaVisible(true);
//! [Visibility of editor area]
// create folder with alignment "left"
berry::IFolderLayout::Pointer left = layout->CreateFolder("left", berry::IPageLayout::LEFT, 0.5f, editorAreaId);
// add emptyview1 to the folder
left->AddView("org.mitk.views.emptyview1");
// add emptyview2 to the folder
left->AddView("org.mitk.views.emptyview2");
}
diff --git a/Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimalPerspective.h b/Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimumPerspective.h
similarity index 77%
rename from Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimalPerspective.h
rename to Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimumPerspective.h
index aea5c70c7e..5689a2386b 100644
--- a/Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimalPerspective.h
+++ b/Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/MinimumPerspective.h
@@ -1,33 +1,33 @@
/*============================================================================
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 MINIMALPERSPECTIVE_H_
-#define MINIMALPERSPECTIVE_H_
+#ifndef MINIMUMPERSPECTIVE_H_
+#define MINIMUMPERSPECTIVE_H_
// berry includes
#include <berryIPerspectiveFactory.h>
// Qt includes
#include <QObject>
-class MinimalPerspective : public QObject, public berry::IPerspectiveFactory
+class MinimumPerspective : public QObject, public berry::IPerspectiveFactory
{
Q_OBJECT
Q_INTERFACES(berry::IPerspectiveFactory)
public:
- MinimalPerspective();
+ MinimumPerspective();
void CreateInitialLayout(berry::IPageLayout::Pointer layout) override;
};
-#endif /* MINIMALPERSPECTIVE_H_ */
+#endif /* MINIMUMPERSPECTIVE_H_ */
diff --git a/Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/org_mitk_example_gui_multipleperspectives_Activator.cpp b/Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/org_mitk_example_gui_multipleperspectives_Activator.cpp
index 0c92def3f6..95a588c67c 100644
--- a/Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/org_mitk_example_gui_multipleperspectives_Activator.cpp
+++ b/Examples/Plugins/org.mitk.example.gui.multipleperspectives/src/internal/org_mitk_example_gui_multipleperspectives_Activator.cpp
@@ -1,33 +1,33 @@
/*============================================================================
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 "org_mitk_example_gui_multipleperspectives_Activator.h"
#include "EmptyView1.h"
#include "EmptyView2.h"
#include "ExtendedPerspective.h"
-#include "MinimalPerspective.h"
+#include "MinimumPerspective.h"
#include "MultiplePerspectives.h"
void org_mitk_example_gui_multipleperspectives_Activator::start(ctkPluginContext *context)
{
BERRY_REGISTER_EXTENSION_CLASS(MultiplePerspectives, context)
- BERRY_REGISTER_EXTENSION_CLASS(MinimalPerspective, context)
+ BERRY_REGISTER_EXTENSION_CLASS(MinimumPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(ExtendedPerspective, context)
BERRY_REGISTER_EXTENSION_CLASS(EmptyView1, context)
BERRY_REGISTER_EXTENSION_CLASS(EmptyView2, context)
}
void org_mitk_example_gui_multipleperspectives_Activator::stop(ctkPluginContext *context)
{
Q_UNUSED(context)
}
diff --git a/Examples/Plugins/org.mitk.example.gui.opencv/documentation/UserManual/VideoPlayerUserManual.dox b/Examples/Plugins/org.mitk.example.gui.opencv/documentation/UserManual/VideoPlayerUserManual.dox
index dfd99dd8f2..9a7cdcfbb5 100644
--- a/Examples/Plugins/org.mitk.example.gui.opencv/documentation/UserManual/VideoPlayerUserManual.dox
+++ b/Examples/Plugins/org.mitk.example.gui.opencv/documentation/UserManual/VideoPlayerUserManual.dox
@@ -1,16 +1,16 @@
/**
\page org_videoplayer The Video Player Module
-\imageMacro{videoplayer.gif,"Icon of the Module",2.00}
+\imageMacro{videoplayer-dox.gif,"Icon of the Module",2.00}
Available sections:
- \ref QmitkVideoPlayerUserManualOverview
<!-- - \ref QmitkVideoPlayerUserManualFeatures -->
<!-- - \ref QmitkVideoPlayerUserManualUsage -->
\section QmitkVideoPlayerUserManualOverview Overview
VideoPlayer is a program module that allows to play video files or grab frames directly from a connected camera with an intuitive user interface. Its main purpose is to demonstrate the usage of the OpenCV toolkit in MITK.
*/
diff --git a/Examples/Plugins/org.mitk.example.gui.opencv/documentation/UserManual/videoplayer.gif b/Examples/Plugins/org.mitk.example.gui.opencv/documentation/UserManual/videoplayer-dox.gif
similarity index 100%
rename from Examples/Plugins/org.mitk.example.gui.opencv/documentation/UserManual/videoplayer.gif
rename to Examples/Plugins/org.mitk.example.gui.opencv/documentation/UserManual/videoplayer-dox.gif
diff --git a/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/UserManual/Manual.dox b/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/UserManual/Manual.dox
deleted file mode 100644
index d7db668df3..0000000000
--- a/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/UserManual/Manual.dox
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
-\page org_mitk_example_gui_pcaexample The PCA example
-
-\imageMacro{icon.png,"Icon of Pcaexample",2.00}
-
-\tableofcontents
-
-\section org_mitk_example_gui_pcaexampleOverview Overview
-Describe the features of your awesome plugin here
-<ul>
-<li>Increases productivity
-<li>Creates beautiful images
-<li>Generates PhD thesis
-<li>Brings world peace
-</ul>
-
-*/
diff --git a/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/UserManual/icon.xpm b/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/UserManual/icon.xpm
deleted file mode 100644
index 9057c20bc6..0000000000
--- a/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/UserManual/icon.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static const char * icon_xpm[] = {
-"16 16 2 1",
-" c #FF0000",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/doxygen/modules.dox b/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/doxygen/modules.dox
deleted file mode 100644
index 244d3df107..0000000000
--- a/Examples/Plugins/org.mitk.example.gui.pcaexample/documentation/doxygen/modules.dox
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- \defgroup org_mitk_example_gui_pcaexample org.mitk.example.gui.pcaexample
- \ingroup MITKPlugins
-
- \brief Describe your plugin here.
-
-*/
-
-/**
- \defgroup org_mitk_example_gui_pcaexample_internal Internal
- \ingroup org_mitk_example_gui_pcaexample
-
- \brief This subcategory includes the internal classes of the org.mitk.example.gui.pcaexample plugin. Other
- plugins must not rely on these classes. They contain implementation details and their interface
- may change at any time. We mean it.
-*/
diff --git a/Examples/Plugins/org.mitk.example.gui.selectionserviceqt/documentation/doxygen/SelectionServiceQt.dox b/Examples/Plugins/org.mitk.example.gui.selectionserviceqt/documentation/doxygen/SelectionServiceQt.dox
index b917f2ccbe..01c0933553 100644
--- a/Examples/Plugins/org.mitk.example.gui.selectionserviceqt/documentation/doxygen/SelectionServiceQt.dox
+++ b/Examples/Plugins/org.mitk.example.gui.selectionserviceqt/documentation/doxygen/SelectionServiceQt.dox
@@ -1,47 +1,47 @@
/**
\page BlueBerryExampleSelectionServiceQt Qt Model/View selections
\brief An example application plug-in with a minimal selection service based on Qt selection models.
\image html SelectionServiceQT.png
In this example the selection service is used to connect the selection of the radio buttons from one
view with the selection of the list of the other view. The SelectionView holds a QListWidget that provides
the user selection (qt selection provider) for the selection listener (ListenerView). The radio buttons of
the listener view are changed according to the selection in the QListWidget. Vice versa the radio buttons
(the selection listener) does not provide any selection events. If the user changes the radio button state
the QListWidget is not altered.
- For additional informations on the selection service concept see http://www.mitk.org/wiki/Article_Using_the_Selection_Service
+ For additional informations on the selection service concept see https://www.mitk.org/wiki/Article_Using_the_Selection_Service
The berry::QtSelectionProvider class implements the interface berry::ISelectionProvider. Due to the model/view concept in Qt, the workbench
provides the berry::QtSelectionProvider class for Qt viewers which must be provided with a QItemSelectionModel.
In the SelectionView.h we declare a pointer that holds the selection provider...
\snippet SelectionView.h Qt Selection Provider
...and in the SelectionView.cpp we set the selection model to the model of the QListWidget (m_SelectionList)
\snippet SelectionView.cpp Qt Selection Provider registration
Now that the QListWidget of the SelectionView sends out selection events we need a listener implementation. In the ListenerView.h
we need to include the ISelectionListener which is a simple class with just one method.
The method that implements the selection listener functionality of ISelectionListener and the pointer that holds the selection listener is declared...
\snippet ListenerView.h Qt Selection Listener method and pointer
...and implemented in the cpp-file:
\snippet ListenerView.cpp Qt Selection Listener method implementation
Now the name of the selected list element is passed to a method that toggles the radio buttons of the ListenerView accordingly.
View complete source files:
\li \github{Examples/Plugins/org.mitk.example.gui.selectionserviceqt/src/internal/SelectionView.cpp,SelectionView.cpp}
\li \github{Examples/Plugins/org.mitk.example.gui.selectionserviceqt/src/internal/SelectionView.h,SelectionView.h}
\li \github{Examples/Plugins/org.mitk.example.gui.selectionserviceqt/src/internal/ListenerView.cpp,ListenerView.cpp}
\li \github{Examples/Plugins/org.mitk.example.gui.selectionserviceqt/src/internal/ListenerView.h,ListenerView.h}
[\ref BlueBerrySelectionServiceIntro] [Next: \ref BlueBerryExampleSelectionServiceMitk] [\ref BlueBerryExamples]
*/
diff --git a/Modules/AlgorithmsExt/CMakeLists.txt b/Modules/AlgorithmsExt/CMakeLists.txt
index 019fbbee2c..4e593dfe19 100644
--- a/Modules/AlgorithmsExt/CMakeLists.txt
+++ b/Modules/AlgorithmsExt/CMakeLists.txt
@@ -1,16 +1,16 @@
mitk_create_module(
DEPENDS MitkDataTypesExt MitkLegacyGL
PACKAGE_DEPENDS
PUBLIC ITK|ITKThresholding
- PRIVATE ANN ITK|ITKIOImageBase
+ PRIVATE ANN ITK|ITKIOImageBase VTK|ImagingGeneral
)
if(TARGET ${MODULE_TARGET})
if(MITK_USE_OpenMP)
target_link_libraries(${MODULE_TARGET} PUBLIC OpenMP::OpenMP_CXX)
endif()
if(BUILD_TESTING)
add_subdirectory(test)
endif()
endif()
diff --git a/Modules/AlgorithmsExt/include/mitkCovarianceMatrixCalculator.h b/Modules/AlgorithmsExt/include/mitkCovarianceMatrixCalculator.h
index f169c576e2..671485285f 100644
--- a/Modules/AlgorithmsExt/include/mitkCovarianceMatrixCalculator.h
+++ b/Modules/AlgorithmsExt/include/mitkCovarianceMatrixCalculator.h
@@ -1,118 +1,118 @@
/*============================================================================
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 __MITK_COVARIANCEMATRIXCALCULATOR_H__
#define __MITK_COVARIANCEMATRIXCALCULATOR_H__
// exports
#include "MitkAlgorithmsExtExports.h"
#include <mitkCommon.h>
#include <itkMatrix.h>
#include <itkObjectFactory.h>
#include <vector>
namespace mitk
{
// forward declarations
class Surface;
struct CovarianceMatrixCalculatorData;
/**
* \ingroup AnisotropicRegistration
*
* @brief Class that computes the covariance matrices for every point in a
* {@link Surface} used in the A-ICP algorithm.
*
* Computes a covariance matrix for every vertex in a given {@link Surface}
* based on it's direct neighbours and saves them into a CovarianceMatrixList.
* The Class implements the CM_PCA method presented by
* L. Maier-Hein et al. in "Convergent Iterative Closest-Point Algorithm
* to Accomodate Anisotropic and Inhomogenous Localization Error.",
* IEEE T Pattern Anal 34 (8), 1520-1532, 2012. The algorithm needs
* a clean Surface with non manifold edges and no duplicated vertices. To
* ensure a clean Surface representation use vtkCleanPolyData.
*/
class MITKALGORITHMSEXT_EXPORT CovarianceMatrixCalculator : public itk::Object
{
private:
/** Pimpl to hold private data.*/
CovarianceMatrixCalculatorData *d;
protected:
// local typedefs
/** Definition of the covariance matrix.*/
typedef itk::Matrix<double, 3, 3> CovarianceMatrix;
/** Definition of a list of covariance matrices */
typedef std::vector<CovarianceMatrix> CovarianceMatrixList;
typedef double Vertex[3];
/** List that stores the computed covariance matrices. */
CovarianceMatrixList m_CovarianceMatrixList;
/** This method projects all surrounding vertices of given vertex in a Surface
* in the normal direction onto a plane and computes a primary component
* analysis on the projected vertices. In the next step a orthonormal
* system is created.
*
- * @param The index of the input Vertex in the Surface.
- * @param The normal of the input Vertex.
- * @param Output CovarianceMatrix of the principal component analysis.
- * @param Output. Variances along the axes of the createt Orthonormal system.
- * @param Output. The current Vertex in the surface
+ * @param index The index of the input Vertex in the Surface.
+ * @param normal The normal of the input Vertex.
+ * @param principalComponents CovarianceMatrix of the principal component analysis.
+ * @param variances Variances along the axes of the createt Orthonormal system.
+ * @param curVertex The current Vertex in the surface
*
*/
void ComputeOrthonormalCoordinateSystem(
const int index, Vertex normal, CovarianceMatrix &principalComponents, Vertex variances, Vertex curVertex);
CovarianceMatrixCalculator();
~CovarianceMatrixCalculator() override;
public:
mitkClassMacroItkParent(CovarianceMatrixCalculator, itk::Object);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/** Sets the scaling factor for the voronoi area.
* @param factor The scaling factor.
*/
void SetVoronoiScalingFator(const double factor);
/** Enables/disables the covariance matrix normalization.
* @param state Enables the covariance matrix normalization.
*/
void EnableNormalization(bool state);
/** Returns the mean of variance of all computed covariance matrices.
* @return The mean variance.
*/
double GetMeanVariance() const;
/** Returns a reference to the CovarianceMatrixList with the computed covariance matrices.
* @return A CovarianceMatrixList.
*/
const CovarianceMatrixList &GetCovarianceMatrices() const;
/** Sets the input {@link Surface} for which the covariance matrices will be calculated.
* @param input A {@link Surface}.
*/
void SetInputSurface(Surface *input);
/** Method that computes the covariance matrices for the input surface.
* @throws std::exception If the input surface is not set.
*/
void ComputeCovarianceMatrices();
};
}
#endif
diff --git a/Modules/AlgorithmsExt/include/mitkPointLocator.h b/Modules/AlgorithmsExt/include/mitkPointLocator.h
index 47f79e7c9c..2dfc9eeaed 100644
--- a/Modules/AlgorithmsExt/include/mitkPointLocator.h
+++ b/Modules/AlgorithmsExt/include/mitkPointLocator.h
@@ -1,218 +1,220 @@
/*============================================================================
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 _MITK_POINT_LOCATOR__H__
#define _MITK_POINT_LOCATOR__H__
#include "MitkAlgorithmsExtExports.h"
#include <itkObject.h>
#include "mitkPointSet.h"
#include <vtkPoints.h>
// forward declarations
class vtkPointSet;
class ANNkd_tree;
namespace mitk
{
/**
* Convenience wrapper around ANN to provide fast nearest neighbour searches.
* Usage: set your points via SetPoints( vtkPointSet* Points ) or SetPoints(mitk::PointSet*).
* Then, you may query the closest point to an arbitrary coordinate by FindClosestPoint().
* There is no further call to update etc. needed.
* Currently only calls for 1 nearest neighbour are supported. Feel free to add functions
* for K nearest neighbours.
* NOTE: At least 1 point must be contained in the point set.
*/
class MITKALGORITHMSEXT_EXPORT PointLocator : public itk::Object
{
public:
mitkClassMacroItkParent(PointLocator, itk::Object);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
typedef int IdType;
typedef ScalarType DistanceType;
typedef float PixelType;
typedef double CoordRepType;
typedef itk::DefaultStaticMeshTraits<PixelType, 3, 2, CoordRepType, CoordRepType, PixelType> MeshTraits;
typedef itk::PointSet<PixelType, 3, MeshTraits> ITKPointSet;
/**
* Sets the point which will be used for nearest-neighbour searches. Note
* there must be at least one point in the point set.
* @param points the point set containing points for nearest neighbours searches.
*/
void SetPoints(vtkPointSet *points);
/**
* Sets the point which will be used for nearest-neighbour searches. Note
* there must be at least one point in the point set.
* @param points the point set containing points for nearest neighbours searches.
*/
void SetPoints(mitk::PointSet *points);
/**
* Sets the point which will be used for nearest-neighbour searches. Note
* there must be at least one point in the point set.
* @param pointSet the point set containing points for nearest neighbours searches.
*/
void SetPoints(ITKPointSet *pointSet);
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The Id of the point is returned. Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the nearest neighbour will be determined
* @returns the id of the nearest neighbour of the given point. The id corresponds to the id
* which is given in the original point set.
*/
IdType FindClosestPoint(const double point[3]);
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The Id of the point is returned. Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param x the x coordinated of the query point, for whom the nearest neighbour will be determined
* @param y the x coordinated of the query point, for whom the nearest neighbour will be determined
* @param z the x coordinated of the query point, for whom the nearest neighbour will be determined
* @returns the id of the nearest neighbour of the given point. The id corresponds to the id
* which is given in the original point set.
*/
IdType FindClosestPoint(double x, double y, double z);
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The Id of the point is returned. Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the nearest neighbour will be determined
* @returns the id of the nearest neighbour of the given point. The id corresponds to the id
* which is given in the original point set.
*/
IdType FindClosestPoint(mitk::PointSet::PointType point);
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The minimal distance between this point and the closest point of the point set is returned.
* Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the minimal distance will be determined
* @returns the distance in world coordinates between the nearest point in point set and the given point
*/
DistanceType GetMinimalDistance(mitk::PointSet::PointType point);
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The Index and minimal distance between this point and the closest point of the point set is returned.
* Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the minimal distance will be determined
+ * @param id
+ * @param dist
* @returns the index of and distance (in world coordinates) between the nearest point in point set and the given
* point
*/
bool FindClosestPointAndDistance(mitk::PointSet::PointType point, IdType *id, DistanceType *dist);
protected:
//
// Definition of a vector of ids
//
typedef std::vector<IdType> IdVectorType;
//
// ANN related typedefs, to prevent ANN from being in the global include path.
// Please note, that these line are prone to failure, if the point type in
// ANN changes. Please note also, that these typedefs are only used in the header
// file. The implementation always refers to the original types
//
typedef double *MyANNpoint;
typedef int MyANNidx;
typedef double MyANNdist;
typedef MyANNpoint *MyANNpointArray;
typedef MyANNidx *MyANNidxArray;
typedef MyANNdist *MyANNdistArray;
/**
* constructor
*/
PointLocator();
/**
* destructor
*/
~PointLocator() override;
/**
* Initializes the ann search tree using previously defined points
*/
void InitANN();
/**
* releases all memory occupied by the ann search tree and internal point set arrays
*/
void DestroyANN();
/**
* Finds the nearest neighbour in the point set previously defined by SetPoints().
* The Id of the point is returned. Please note, that there is no case, in which
* no point is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the nearest neighbour will be determined
* @returns the id of the nearest neighbour of the given point. The id corresponds to the id
* which is given in the original point set.
*/
IdType FindClosestANNPoint(const MyANNpoint &point);
/**
* Finds the minimal distance between the given point and a point in the previously defined point set.
* The distance is returned. Please note, that there is no case, in which
* no distance is found, since as a precondition at least one point has to be contained
* in the point set.
* @param point the query point, for whom the minimal distance to a point in the previously defined point set will
* be determined
* @returns the squared distance in world coordinates between the given point and the nearest neighbour.
*/
DistanceType GetMinimalDistance(const MyANNpoint &point);
bool m_SearchTreeInitialized;
IdVectorType m_IndexToPointIdContainer;
vtkPoints *m_VtkPoints;
mitk::PointSet *m_MitkPoints;
ITKPointSet *m_ItkPoints;
//
// ANN related variables
//
unsigned int m_ANNK;
unsigned int m_ANNDimension;
double m_ANNEpsilon;
MyANNpointArray m_ANNDataPoints;
MyANNpoint m_ANNQueryPoint;
MyANNidxArray m_ANNPointIndexes;
MyANNdistArray m_ANNDistances;
ANNkd_tree *m_ANNTree;
};
}
#endif
diff --git a/Modules/AlgorithmsExt/include/mitkWeightedPointTransform.h b/Modules/AlgorithmsExt/include/mitkWeightedPointTransform.h
index 61f43b27c5..3d8ce63fa1 100644
--- a/Modules/AlgorithmsExt/include/mitkWeightedPointTransform.h
+++ b/Modules/AlgorithmsExt/include/mitkWeightedPointTransform.h
@@ -1,248 +1,247 @@
/*============================================================================
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 __WEIGHTEDPOINTTRANSFORM_H__
#define __WEIGHTEDPOINTTRANSFORM_H__
// EXPORTS
#include "MitkAlgorithmsExtExports.h"
// ITK
#include <itkMatrix.h>
#include <itkVariableSizeMatrix.h>
#include <mitkCommon.h>
#include <mitkPointSet.h>
#include <vector>
#include <vtkSmartPointer.h>
// forward declarations
class vtkPoints;
class vtkLandmarkTransform;
namespace mitk
{
/**
* \ingroup AnisotropicRegistration
*
* @brief This class implements an extension of the
* weighted point based registration algorithm
* from A. Danilchenko, R. Balachandran and J. M. Fitzpatrick.
*
* The class implements an extension of the weighted point based registration
* from A. Danilchenko et al.
* presented by L. Maier-Hein et al. in "Convergent Iterative Closest-Point Algorithm
* to Accomodate Anisotropic and Inhomogenous Localization Error.",
* IEEE T Pattern Anal 34 (8), 1520-1532, 2012. The extension computes, in order
* to ensure the convergence of the algorithm, an isotropic estimation
* by an unweighted point based registration algorithm as an initial estimate.
* The implemantion was originally ported to C/C++ by A. Franz.
*
* \note Some methods are accelerated when OpenMP is enabled.
*
*/
class MITKALGORITHMSEXT_EXPORT WeightedPointTransform : public itk::Object
{
/** Definition of a 3x3 matrix.*/
typedef itk::Matrix<double, 3, 3> Matrix3x3;
/** Definition of a 3x3 Weighting matrix.*/
typedef Matrix3x3 WeightMatrix;
/** Definition of a Rotation matrix.*/
typedef Matrix3x3 Rotation;
/** Definition of a translation vector.*/
typedef itk::Vector<double, 3> Translation;
/** Definition of a weight matrix list.*/
typedef std::vector<WeightMatrix> WeightMatrixList;
/** Definition of a covariance matrix list.*/
typedef std::vector<Matrix3x3> CovarianceMatrixList;
public:
mitkClassMacroItkParent(WeightedPointTransform, itk::Object);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/** @brief Method which registers both point sets. */
void ComputeTransformation();
/** @brief Sets the threshold of the registration. Default value is 0.0001.*/
itkSetMacro(Threshold, double);
/** @brief Sets the maximum number of iterations of the registration.
* Default value is 1000.
*/
itkSetMacro(MaxIterations, double);
/** @return Returns the number of iterations of the last run
* of the registration algorithm. Returns -1 if there was no
* run of the registration yet.
*/
itkGetMacro(Iterations, int);
/** @return Returns the FRE of the last run of the registration algorithm.
* Returns -1 if there was no run of the registration yet.
*/
itkGetMacro(FRE, double);
/** @brief Sets the FRE normalization factor. Default value is 1.0. */
itkSetMacro(FRENormalizationFactor, double);
/** @return Returns the current FRE normalization factor.*/
itkGetMacro(FRENormalizationFactor, double);
/** Sets the moving point set used for the registration.
* @param p The input point set.
*/
void SetMovingPointSet(vtkSmartPointer<vtkPoints> p);
/**
* Set the list of 3x3 covariance matrices belonging to the moving point set.
* @param matrices List of covariance matrices.
*/
void SetCovarianceMatricesMoving(const CovarianceMatrixList &matrices);
/** Sets the fixed point set used for the registration.
* @param p The input point set.
*/
void SetFixedPointSet(vtkSmartPointer<vtkPoints> p);
/**
* Set the list of 3x3 covariance matrices belonging to the fixed point set.
* @param matrices List of covariance matrices.
*/
void SetCovarianceMatricesFixed(const CovarianceMatrixList &matrices);
/**
* The translation vector computed by the algorithm.
* @return 3x1 translation vector.
*/
const Translation &GetTransformT() const { return m_Translation; }
/**
* The rotation matrix computed by the algorithm.
*/
const Rotation &GetTransformR() const { return m_Rotation; }
protected:
WeightedPointTransform();
~WeightedPointTransform() override;
/** Threshold used to terminate the algorithm.*/
double m_Threshold;
/** Max allowed iterations used by the algorithm.*/
int m_MaxIterations;
/** The amount of iterations needed by the algorithm.*/
int m_Iterations;
/** The fiducial registration error (FRE) used in the algorithm.*/
double m_FRE;
/** Normalization factor for the FRE.*/
double m_FRENormalizationFactor;
/** Isotropic point based registration used for initial estimate.*/
vtkSmartPointer<vtkLandmarkTransform> m_LandmarkTransform;
/** The fixed point set (Y).*/
vtkSmartPointer<vtkPoints> m_FixedPointSet;
/** Moving point set (X).*/
vtkSmartPointer<vtkPoints> m_MovingPointSet;
/** Covariance matrices of the moving point set (Sigma_X).*/
CovarianceMatrixList m_CovarianceMatricesMoving;
/** Covariance matrices of the moving point set (Sigma_Y).*/
CovarianceMatrixList m_CovarianceMatricesFixed;
/** 3x1 translation vector.*/
Translation m_Translation;
/** 3x3 rotation matrix.*/
Rotation m_Rotation;
/**
* original matlab-function:
*
* Constructs the C matrix of the linear version of the registration
* problem, Cq = e, where q = [delta_angle(1:3),delta_translation(1:3)] and
* e is produced by e_maker(X,Y,W)
*
* Authors: JM Fitzpatrick and R Balachandran
* Creation: February 2009
*
* --------------------------------------------
*
* converted to C++ by Alfred Franz in March/April 2010
*/
void C_maker(vtkPoints *X, const WeightMatrixList &W, itk::VariableSizeMatrix<double> &returnValue);
/**
* original matlab-function:
*
* Constructs the e vector of the linear version of the registration
* problem, Cq = e, where q = [delta_angle(1:3),delta_translation(1:3)] and
* C is produced by C_maker(X,W)
*
* Authors: JM Fitzpatrick and R Balachandran
* Creation: February 2009
*
* --------------------------------------------
*
* converted to C++ by Alfred Franz in March/April 2010
*/
void E_maker(vtkPoints *X, vtkPoints *Y, const WeightMatrixList &W, vnl_vector<double> &returnValue);
/**
* This method computes the change in a root mean squared
* sense between the previous and the actual iteration.
* The computed value is used as a termination constraint of the algorithm and
* compared against the threshold.
*
* @param X The moving point set in the previous iteration step.
* @param X_new The moving point set in the actual step.
*
* @return The computed change between the two point sets.
*/
double CalculateConfigChange(vtkPoints *X, vtkPoints *X_new);
/**
* @brief This method performs a variant of the weighted point register algorithm presented by
* A. Danilchenko, R. Balachandran and J. M. Fitzpatrick in January 2010. (Modified in January 2011)
* converted to C++ by Alfred Franz in March/April 2010
*
* @param X (input) the moving point set
* @param Y (input) the fixed (static) point set
* @param Sigma_X (input) a 3-by-3-by-N array, each page containing the weighting matrix for the Nth pair
* of points in X
* @param Sigma_Y (input) a 3-by-3-by-N array, each page containing the weighting matrix for the Nth pair
* of points in Y
* @param Threshold (input) the relative size of the change to the moving set above which the iteration
* continues
* @param MaxIterations (input) the maximum number of iterations allowed
- * @param Threshold (input) the threshold used to terminate the algorithm
* @param TransformationR (output) this variable will hold the computed rotation matrix
* @param TransformationT (output) this variable will hold the computed translation vector
* @param FRE (output) this variable will hold the computed rotation FRE of the transformation
* @param n (output) this variable will hold the number of iterations used by the algorithm
*/
void WeightedPointRegister(vtkPoints *X,
vtkPoints *Y,
const CovarianceMatrixList &Sigma_X,
const CovarianceMatrixList &Sigma_Y,
double Threshold,
int MaxIterations,
Rotation &TransformationR,
Translation &TransformationT,
double &FRE,
int &n);
};
}
#endif
diff --git a/Modules/AlgorithmsExt/test/mitkAnisotropicIterativeClosestPointRegistrationTest.cpp b/Modules/AlgorithmsExt/test/mitkAnisotropicIterativeClosestPointRegistrationTest.cpp
index ffa9a00afa..c916881b8e 100644
--- a/Modules/AlgorithmsExt/test/mitkAnisotropicIterativeClosestPointRegistrationTest.cpp
+++ b/Modules/AlgorithmsExt/test/mitkAnisotropicIterativeClosestPointRegistrationTest.cpp
@@ -1,166 +1,168 @@
/*============================================================================
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 <mitkIOUtil.h>
#include <mitkSurface.h>
#include <mitkTestFixture.h>
#include <mitkTestingMacros.h>
#include <vtkCleanPolyData.h>
+#include <vtkTransformPolyDataFilter.h>
+#include <vtkTransform.h>
#include "mitkAnisotropicIterativeClosestPointRegistration.h"
#include "mitkAnisotropicRegistrationCommon.h"
#include "mitkCovarianceMatrixCalculator.h"
/**
* Test to verify the results of the A-ICP registration.
* The test runs the standard A-ICP and the trimmed variant.
*/
class mitkAnisotropicIterativeClosestPointRegistrationTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkAnisotropicIterativeClosestPointRegistrationTestSuite);
MITK_TEST(testAicpRegistration);
MITK_TEST(testTrimmedAicpregistration);
CPPUNIT_TEST_SUITE_END();
private:
typedef itk::Matrix<double, 3, 3> Matrix3x3;
typedef itk::Vector<double, 3> Vector3;
typedef std::vector<Matrix3x3> CovarianceMatrixList;
mitk::Surface::Pointer m_MovingSurface;
mitk::Surface::Pointer m_FixedSurface;
mitk::PointSet::Pointer m_TargetsMovingSurface;
mitk::PointSet::Pointer m_TargetsFixedSurface;
CovarianceMatrixList m_SigmasMovingSurface;
CovarianceMatrixList m_SigmasFixedSurface;
double m_FRENormalizationFactor;
public:
/**
* @brief Setup Always call this method before each Test-case to ensure
* correct and new intialization of the used members for a new test case.
* (If the members are not used in a test, the method does not need to be called).
*/
void setUp() override
{
mitk::CovarianceMatrixCalculator::Pointer matrixCalculator = mitk::CovarianceMatrixCalculator::New();
- m_MovingSurface = mitk::IOUtil::Load<mitk::Surface>(GetTestDataFilePath("AICPRegistration/head_green.stl"));
- m_FixedSurface = mitk::IOUtil::Load<mitk::Surface>(GetTestDataFilePath("AICPRegistration/head_red.stl"));
+ m_MovingSurface = mitk::IOUtil::Load<mitk::Surface>(GetTestDataFilePath("AICPRegistration/head_green.vtp"));
+ m_FixedSurface = mitk::IOUtil::Load<mitk::Surface>(GetTestDataFilePath("AICPRegistration/head_red.vtp"));
m_TargetsMovingSurface = mitk::IOUtil::Load<mitk::PointSet>(GetTestDataFilePath("AICPRegistration/targets_head_green.mps"));
m_TargetsFixedSurface = mitk::IOUtil::Load<mitk::PointSet>(GetTestDataFilePath("AICPRegistration/targets_head_red.mps"));
// compute covariance matrices
matrixCalculator->SetInputSurface(m_MovingSurface);
matrixCalculator->ComputeCovarianceMatrices();
m_SigmasMovingSurface = matrixCalculator->GetCovarianceMatrices();
const double meanVarX = matrixCalculator->GetMeanVariance();
matrixCalculator->SetInputSurface(m_FixedSurface);
matrixCalculator->ComputeCovarianceMatrices();
m_SigmasFixedSurface = matrixCalculator->GetCovarianceMatrices();
const double meanVarY = matrixCalculator->GetMeanVariance();
m_FRENormalizationFactor = sqrt(meanVarX + meanVarY);
}
void tearDown() override
{
m_MovingSurface = nullptr;
m_FixedSurface = nullptr;
m_TargetsMovingSurface = nullptr;
m_TargetsFixedSurface = nullptr;
m_SigmasMovingSurface.clear();
m_SigmasFixedSurface.clear();
}
void testAicpRegistration()
{
- const double expFRE = 27.5799;
- const double expTRE = 1.68835;
+ const double expFRE = 26.3453;
+ const double expTRE = 3.8707;
mitk::AnisotropicIterativeClosestPointRegistration::Pointer aICP =
mitk::AnisotropicIterativeClosestPointRegistration::New();
// set up parameters
aICP->SetMovingSurface(m_MovingSurface);
aICP->SetFixedSurface(m_FixedSurface);
aICP->SetCovarianceMatricesMovingSurface(m_SigmasMovingSurface);
aICP->SetCovarianceMatricesFixedSurface(m_SigmasFixedSurface);
aICP->SetFRENormalizationFactor(m_FRENormalizationFactor);
aICP->SetThreshold(0.000001);
// run the algorithm
aICP->Update();
MITK_INFO << "FRE: Expected: " << expFRE << ", computed: " << aICP->GetFRE();
CPPUNIT_ASSERT_MESSAGE("mitkAnisotropicIterativeClosestPointRegistrationTest:AicpRegistration Test FRE",
mitk::Equal(aICP->GetFRE(), expFRE, 0.0001));
// compute the target registration Error
const double tre =
mitk::AnisotropicRegistrationCommon::ComputeTargetRegistrationError(m_TargetsMovingSurface.GetPointer(),
m_TargetsFixedSurface.GetPointer(),
aICP->GetRotation(),
aICP->GetTranslation());
// MITK_INFO << "R:\n" << aICP->GetRotation() << "T: "<< aICP->GetTranslation();
MITK_INFO << "TRE: Expected: " << expTRE << ", computed: " << tre;
CPPUNIT_ASSERT_MESSAGE("mitkAnisotropicIterativeClosestPointRegistrationTest:AicpRegistration Test TRE",
mitk::Equal(tre, expTRE, 0.00001));
}
void testTrimmedAicpregistration()
{
- const double expFRE = 4.8912;
- const double expTRE = 0.0484215;
+ const double expFRE = 18.5469;
+ const double expTRE = 5.5871;
mitk::AnisotropicIterativeClosestPointRegistration::Pointer aICP =
mitk::AnisotropicIterativeClosestPointRegistration::New();
// Swap X and Y for partial overlapping registration
aICP->SetMovingSurface(m_MovingSurface);
aICP->SetFixedSurface(m_FixedSurface);
aICP->SetCovarianceMatricesMovingSurface(m_SigmasMovingSurface);
aICP->SetCovarianceMatricesFixedSurface(m_SigmasFixedSurface);
aICP->SetFRENormalizationFactor(m_FRENormalizationFactor);
aICP->SetThreshold(0.000001);
- aICP->SetTrimmFactor(0.50);
+ aICP->SetTrimmFactor(0.80);
// run the algorithm
aICP->Update();
MITK_INFO << "FRE: Expected: " << expFRE << ", computed: " << aICP->GetFRE();
CPPUNIT_ASSERT_MESSAGE("mitkAnisotropicIterativeClosestPointRegistrationTest:AicpRegistration Test FRE",
mitk::Equal(aICP->GetFRE(), expFRE, 0.01));
// compute the target registration Error
const double tre =
mitk::AnisotropicRegistrationCommon::ComputeTargetRegistrationError(m_TargetsMovingSurface.GetPointer(),
m_TargetsFixedSurface.GetPointer(),
aICP->GetRotation(),
aICP->GetTranslation());
MITK_INFO << "TRE: Expected: " << expTRE << ", computed: " << tre;
CPPUNIT_ASSERT_MESSAGE("mitkAnisotropicIterativeClosestPointRegistrationTest:AicpRegistration Test TRE",
mitk::Equal(tre, expTRE, 0.01));
}
};
MITK_TEST_SUITE_REGISTRATION(mitkAnisotropicIterativeClosestPointRegistration)
diff --git a/Modules/Annotation/CMakeLists.txt b/Modules/Annotation/CMakeLists.txt
index 2cf47f8160..fd9f2dee9a 100644
--- a/Modules/Annotation/CMakeLists.txt
+++ b/Modules/Annotation/CMakeLists.txt
@@ -1,5 +1,6 @@
MITK_CREATE_MODULE(
DEPENDS MitkCore
+ PACKAGE_DEPENDS PUBLIC VTK|RenderingAnnotation PRIVATE VTK|IOImage
)
add_subdirectory(test)
diff --git a/Modules/Annotation/include/mitkVtkAnnotation.h b/Modules/Annotation/include/mitkVtkAnnotation.h
index 01c0765c3d..51545541b2 100644
--- a/Modules/Annotation/include/mitkVtkAnnotation.h
+++ b/Modules/Annotation/include/mitkVtkAnnotation.h
@@ -1,71 +1,71 @@
/*============================================================================
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 VTKAnnotation_H
#define VTKAnnotation_H
#include "mitkAnnotation.h"
#include <MitkAnnotationExports.h>
#include <vtkSmartPointer.h>
class vtkProp;
namespace mitk
{
/**
* @brief The VtkAnnotation class is the base for all Annotation which are using the VTK framework to render
*the elements.
*/
class MITKANNOTATION_EXPORT VtkAnnotation : public Annotation
{
public:
mitkClassMacro(VtkAnnotation, Annotation);
void Update(BaseRenderer *renderer) override;
void AddToBaseRenderer(BaseRenderer *renderer) override;
void AddToRenderer(BaseRenderer *renderer, vtkRenderer *vtkrenderer) override;
void RemoveFromRenderer(BaseRenderer *renderer, vtkRenderer *vtkrenderer) override;
void RemoveFromBaseRenderer(BaseRenderer *renderer) override;
/**
* \brief Paints the Annotation.
*
* This method forces a paint of the Annotation as it is configured at the moment.
- * \warn Should only be used as alternative to the AnnotationManager mechanism
+ * \warning Should only be used as alternative to the AnnotationManager mechanism
* in GL-Mappers.
*/
void Paint(BaseRenderer *renderer);
protected:
/**
* @brief This method is implemented by the specific VTKAnnotation in order to create the element as a vtkProp
* @param renderer
* @return The element that was created by the subclasses as a vtkProp.
*/
virtual vtkProp *GetVtkProp(BaseRenderer *renderer) const = 0;
virtual void UpdateVtkAnnotation(BaseRenderer *renderer) = 0;
/** \brief explicit constructor which disallows implicit conversions */
explicit VtkAnnotation();
/** \brief virtual destructor in order to derive from this class */
~VtkAnnotation() override;
private:
/** \brief copy constructor */
VtkAnnotation(const VtkAnnotation &);
/** \brief assignment operator */
VtkAnnotation &operator=(const VtkAnnotation &);
};
} // namespace mitk
#endif // Annotation_H
diff --git a/Modules/Annotation/test/files.cmake b/Modules/Annotation/test/files.cmake
index a9960f8d92..d7b26cf273 100644
--- a/Modules/Annotation/test/files.cmake
+++ b/Modules/Annotation/test/files.cmake
@@ -1,11 +1,14 @@
set(MODULE_TESTS
mitkAnnotationTest.cpp
- mitkManualPlacementAnnotationRendererTest.cpp
+)
+
+set(MODULE_RENDERING_TESTS
mitkColorBarAnnotationTest.cpp
mitkLabelAnnotation3DTest.cpp
- mitkLogoAnnotationTest.cpp
mitkLayoutAnnotationRendererTest.cpp
+ mitkLogoAnnotationTest.cpp
+ mitkManualPlacementAnnotationRendererTest.cpp
mitkScaleLegendAnnotationTest.cpp
mitkTextAnnotation2DTest.cpp
mitkTextAnnotation3DTest.cpp
)
diff --git a/Modules/AppUtil/CMakeLists.txt b/Modules/AppUtil/CMakeLists.txt
index 8af1a86ac5..4685d36486 100644
--- a/Modules/AppUtil/CMakeLists.txt
+++ b/Modules/AppUtil/CMakeLists.txt
@@ -1,14 +1,14 @@
set(qt5_depends Qt5|Widgets+WebEngine)
if(UNIX AND NOT APPLE)
set(qt5_depends "${qt5_depends}+X11Extras")
endif()
mitk_create_module(
PACKAGE_DEPENDS
PUBLIC CTK|CTKPluginFramework ${qt5_depends} Poco|Util
- PRIVATE VTK
+ PRIVATE VTK|GUISupportQt
DEPENDS
PUBLIC qtsingleapplication
PRIVATE MitkCore
)
diff --git a/Modules/AppUtil/include/mitkBaseApplication.h b/Modules/AppUtil/include/mitkBaseApplication.h
index 9b263db6d9..78cd66de27 100644
--- a/Modules/AppUtil/include/mitkBaseApplication.h
+++ b/Modules/AppUtil/include/mitkBaseApplication.h
@@ -1,317 +1,317 @@
/*============================================================================
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 mitkBaseApplication_h
#define mitkBaseApplication_h
#include <MitkAppUtilExports.h>
#include <Poco/Util/Application.h>
#include <QString>
#include <QVariant>
class ctkPluginContext;
class ctkPluginFramework;
class QCoreApplication;
class QTranslator;
namespace mitk
{
/**
* 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:
- * - Put the application in \emph{safe mode} which catches unhandled
+ * - Put the application in <em>safe mode</em> which catches unhandled
* exceptions thrown in the Qt event loop and displays an error
* message.
- * - Put the application in \emph{single mode} which by default
+ * - Put the application in <em>single mode</em> which by default
* sends the command line arguments to an already running instance
* of the same application instead of creating a second instance.
* - Add a list of library names which should be pre-loaded at
* application start-up, e.g. to speed up the initial launch during
* the caching process of the plug-in meta-data.
* - Set a custom provisioning file to start a specific set of CTK
* plug-ins during application start-up.
* - Set and get CTK plugin framework properties
*
* The behavior can further be customized by deriving from BaseApplication
* and overriding specific methods, such as:
* - initializeLibraryPaths() to add specific library / plugin search paths
* - defineOptions(Poco::Util::OptionSet&) to define a custom set of
* command line options
* - getQApplication() to provide a custom QCoreApplication instance
*
* A simple but complete example:
- * <code>
+ * \code
* #include <mitkBaseApplication.h>
*
* int main(int argc, char* argv[])
* {
* mitk::BaseApplication app(argc, argv);
* app.setApplicationName("MyApp");
* app.setOrganizationName("MyOrganization");
*
* // Run the workbench
* return app.run();
* }
- * </code>
+ * \endcode
*/
class MITKAPPUTIL_EXPORT BaseApplication : public Poco::Util::Application
{
public:
// Command line arguments
static const QString ARG_APPLICATION;
static const QString ARG_CLEAN;
static const QString ARG_CONSOLELOG;
static const QString ARG_DEBUG;
static const QString ARG_FORCE_PLUGIN_INSTALL;
static const QString ARG_HOME;
static const QString ARG_NEWINSTANCE;
static const QString ARG_NO_LAZY_REGISTRY_CACHE_LOADING;
static const QString ARG_NO_REGISTRY_CACHE;
static const QString ARG_PLUGIN_CACHE;
static const QString ARG_PLUGIN_DIRS;
static const QString ARG_PRELOAD_LIBRARY;
static const QString ARG_PRODUCT;
static const QString ARG_PROVISIONING;
static const QString ARG_REGISTRY_MULTI_LANGUAGE;
static const QString ARG_SPLASH_IMAGE;
static const QString ARG_STORAGE_DIR;
static const QString ARG_XARGS;
// BlueBerry specific plugin framework properties
static const QString PROP_APPLICATION;
static const QString PROP_FORCE_PLUGIN_INSTALL;
static const QString PROP_NEWINSTANCE;
static const QString PROP_NO_LAZY_REGISTRY_CACHE_LOADING;
static const QString PROP_NO_REGISTRY_CACHE;
static const QString PROP_PRODUCT;
static const QString PROP_REGISTRY_MULTI_LANGUAGE;
BaseApplication(int argc, char **argv);
~BaseApplication() override;
/**
* 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.
*/
void initializeQt();
/**
* Launches the BlueBerry framework and runs the default application
* or the one specified in the PROP_APPLICATION framework property.
*
* @return The return code of the application after it was shut down.
*/
int run() override;
void printHelp(const std::string &name, const std::string &value);
/**
* Set the application name. Same as QCoreApplication::setApplicationName.
* @param name The application name.
*/
void setApplicationName(const QString &name);
QString getApplicationName() const;
/**
* Set the organization name. Same as QCoreApplication::setOrganizationName.
* @param name The organization name.
*/
void setOrganizationName(const QString &name);
QString getOrganizationName() const;
/**
* Set the organization domain. Same as QCoreApplication::setOrganizationDomain.
* @param name The organization domain.
*/
void setOrganizationDomain(const QString &name);
QString getOrganizationDomain() const;
/**
* Put the application in single mode, which by default only allows
* a single instance of the application to be created.
*
* Calling this method after run() has been called has no effect.
*
* @param singleMode
*/
void setSingleMode(bool singleMode);
bool getSingleMode() const;
/**
* Put the application in safe mode, catching exceptions from the
* Qt event loop.
*
* @param safeMode
*/
void setSafeMode(bool safeMode);
bool getSafeMode() const;
/**
* Set a list of library names or absoulte 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 <code>liborg_mitk_gui_qt_common$1.0</code>.
* Platform specific suffixes are appended automatically.
*
* @param libraryBaseNames A list of library base names.
*/
void setPreloadLibraries(const QStringList &libraryBaseNames);
/**
* Get the list of library base names which should be pre-loaded.
*
* @return A list of pre-loaded libraries.
*/
QStringList getPreloadLibraries() const;
/**
* Set the path to the provisioning file.
*
* By default a provisioning file located in the same directory
- * as the executable and named <executable>.provisioning
+ * 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 (<code>QString::null</code>) to reset to the
+ * null QString (\c QString::null ) to reset to the
* default behaviour.
*
* @param filePath An absolute file path to the provisioning file.
*/
void setProvisioningFilePath(const QString &filePath);
/**
* Get the file path to the provisioning file.
* @return The provisioning file path.
*/
QString getProvisioningFilePath() const;
void setProperty(const QString &property, const QVariant &value);
QVariant getProperty(const QString &property) const;
void installTranslator(QTranslator*);
bool isRunning();
void sendMessage(const QByteArray);
protected:
void initialize(Poco::Util::Application &self) override;
void uninitialize() override;
int getArgc() const;
char **getArgv() const;
/**
* 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.
*
* @return The CTK Plugin Framework storage directory.
*/
virtual QString getCTKFrameworkStorageDir() const;
/**
* 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.
*/
virtual void initializeCppMicroServices();
/**
* 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.
*
* @return The current QCoreApplication instance. This method
* never returns null.
*/
virtual QCoreApplication *getQApplication() const;
/**
* 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.
*/
virtual void initializeLibraryPaths();
/**
* Runs the application for which the platform was started. The platform
* must be running.
* <p>
* The given argument is passed to the application being run. If it is an invalid QVariant
* then the command line arguments used in starting the platform, and not consumed
* by the platform code, are passed to the application as a <code>QStringList</code>.
* </p>
- * @param argument the argument passed to the application. May be <code>invalid</code>
+ * @param args the argument passed to the application. May be <code>invalid</code>
* @return the result of running the application
* @throws std::exception if anything goes wrong
*/
int main(const std::vector<std::string> &args) override;
/**
* Define command line arguments
* @param options
*/
void defineOptions(Poco::Util::OptionSet &options) override;
QSharedPointer<ctkPluginFramework> getFramework() const;
ctkPluginContext *getFrameworkContext() const;
/**
* 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.
*
* @return The initial CTK Plugin Framework properties.
*/
QHash<QString, QVariant> getFrameworkProperties() const;
/*
* Initialize and display the splash screen if an image filename is given
*
*/
void initializeSplashScreen(QCoreApplication * application) const;
private:
struct Impl;
Impl* d;
};
}
#endif // MITKBASEAPPLICATION_H
diff --git a/Modules/AppUtil/src/mitkBaseApplication.cpp b/Modules/AppUtil/src/mitkBaseApplication.cpp
index 15c923d3b2..b13e425ccb 100644
--- a/Modules/AppUtil/src/mitkBaseApplication.cpp
+++ b/Modules/AppUtil/src/mitkBaseApplication.cpp
@@ -1,858 +1,858 @@
/*============================================================================
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 <mitkBaseApplication.h>
#include <mitkExceptionMacro.h>
#include <mitkLogMacros.h>
#include <mitkProvisioningInfo.h>
#include <QmitkSafeApplication.h>
#include <QmitkSingleApplication.h>
#include <Poco/Util/HelpFormatter.h>
#include <ctkPluginFramework.h>
#include <ctkPluginFramework_global.h>
#include <ctkPluginFrameworkLauncher.h>
#include <usModuleSettings.h>
#include <vtkOpenGLRenderWindow.h>
-#include <QVTKOpenGLWidget.h>
+#include <QVTKOpenGLNativeWidget.h>
#include <QCoreApplication>
#include <QDir>
#include <QFileInfo>
#include <QRunnable>
#include <QSplashScreen>
#include <QStandardPaths>
#include <QTime>
#include <QWebEngineUrlScheme>
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::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<char*> 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;
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)
{
#ifdef Q_OS_MAC
/* On macOS the process serial number is passed as an command line argument (-psn_<NUMBER>)
in certain circumstances. This option causes a Poco exception. We remove it, if present. */
m_Argv_macOS.reserve(argc);
const char psn[] = "-psn";
for (decltype(argc) i = 0; i < argc; ++i)
{
if (0 == strncmp(argv[i], psn, sizeof(psn)))
continue;
m_Argv_macOS.push_back(argv[i]);
}
m_Argc = static_cast<decltype(m_Argc)>(m_Argv_macOS.size());
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 &)
{
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<std::string> 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 : 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<int>(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<QmitkSingleApplication *>(d->m_QApp)->setSafeMode(safeMode)
: static_cast<QmitkSafeApplication *>(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:
* <MITK-build/bin/MitkWorkbench.provisioning>
* The executable path is:
* <MITK-build/bin/MitkWorkbench.app/Contents/MacOS/MitkWorkbench>
* 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;
// 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);
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 <executable-name>.ini file and parsing any
// command line arguments
this->loadConfiguration();
// 5. Add configuration data from the command line and the
// optional <executable-name>.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<QtSingleApplication *>(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 = QVTKOpenGLWidget::defaultFormat();
+ 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<QCoreApplication*>(new QmitkSingleApplication(d->m_Argc, d->m_Argv, this->getSafeMode()))
: static_cast<QCoreApplication*>(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 : suffixes)
ctkPluginFrameworkLauncher::addSearchPath(appDir.absoluteFilePath(suffix));
}
int BaseApplication::main(const std::vector<std::string> &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<BaseApplication>(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<Impl>(d, &Impl::handleBooleanOption));
options.addOption(newInstanceOption);
Poco::Util::Option cleanOption(ARG_CLEAN.toStdString(), "", "cleans the plugin cache");
cleanOption.callback(Poco::Util::OptionCallback<Impl>(d, &Impl::handleClean));
options.addOption(cleanOption);
Poco::Util::Option productOption(ARG_PRODUCT.toStdString(), "", "the id of the product to be launched");
productOption.argument("<id>").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("<id>").binding(PROP_APPLICATION.toStdString());
options.addOption(appOption);
Poco::Util::Option provOption(ARG_PROVISIONING.toStdString(), "", "the location of a provisioning file");
provOption.argument("<prov file>").binding(ARG_PROVISIONING.toStdString());
options.addOption(provOption);
Poco::Util::Option storageDirOption(ARG_STORAGE_DIR.toStdString(), "", "the location for storing persistent application data");
storageDirOption.argument("<dir>").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<Impl>(d, &Impl::handleBooleanOption));
options.addOption(consoleLogOption);
Poco::Util::Option debugOption(ARG_DEBUG.toStdString(), "", "enable debug mode");
debugOption.argument("<options file>", 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<Impl>(d, &Impl::handleBooleanOption));
options.addOption(forcePluginOption);
Poco::Util::Option preloadLibsOption(ARG_PRELOAD_LIBRARY.toStdString(), "", "preload a library");
preloadLibsOption.argument("<library>")
.repeatable(true)
.callback(Poco::Util::OptionCallback<Impl>(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<Impl>(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<Impl>(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<Impl>(d, &Impl::handleBooleanOption));
options.addOption(registryMultiLanguageOption);
Poco::Util::Option splashScreenOption(ARG_SPLASH_IMAGE.toStdString(), "", "optional picture to use as a splash screen");
splashScreenOption.argument("<filename>").binding(ARG_SPLASH_IMAGE.toStdString());
options.addOption(splashScreenOption);
Poco::Util::Option xargsOption(ARG_XARGS.toStdString(), "", "Extended argument list");
xargsOption.argument("<args>").binding(ARG_XARGS.toStdString());
options.addOption(xargsOption);
Poco::Util::Application::defineOptions(options);
}
QSharedPointer<ctkPluginFramework> 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<QString, QVariant> 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<QtSingleApplication*>(this->getQApplication());
if (nullptr != app)
app->isRunning();
mitkThrow() << "Method not implemented.";
}
void BaseApplication::sendMessage(const QByteArray msg)
{
auto app = dynamic_cast<QtSingleApplication*>(this->getQApplication());
if (nullptr != app)
app->sendMessage(msg);
mitkThrow() << "Method not implemented.";
}
}
diff --git a/Modules/BasicImageProcessing/documentation/UserManual/mitkBasicImageProcessingMiniAppsPortalPage.dox b/Modules/BasicImageProcessing/documentation/UserManual/mitkBasicImageProcessingMiniAppsPortalPage.dox
index 93627d40be..c78a2e14d3 100644
--- a/Modules/BasicImageProcessing/documentation/UserManual/mitkBasicImageProcessingMiniAppsPortalPage.dox
+++ b/Modules/BasicImageProcessing/documentation/UserManual/mitkBasicImageProcessingMiniAppsPortalPage.dox
@@ -1,45 +1,45 @@
/**
\page mitkBasicImageProcessingMiniAppsPortalPage MITK Basic Image Processing Mini Apps
\tableofcontents
-The Basic Image Processing Mini Apps bundle the functionality that is commonly neeeded for the processing of medical images. As all other MiniApps, they follow the <a href="http://www.slicer.org/slicerWiki/index.php/Slicer3:Execution_Model_Documentation">Slicer Execution Model</a> in describing themselves via xml. You can simply obtain a description by calling the MiniApp without any parameter. If the MiniApp is calles with the option "--xml" a XML description of all possible parameter is added.
+The Basic Image Processing Mini Apps bundle the functionality that is commonly neeeded for the processing of medical images. As all other MiniApps, they follow the <a href="https://www.slicer.org/slicerWiki/index.php/Slicer3:Execution_Model_Documentation">Slicer Execution Model</a> in describing themselves via xml. You can simply obtain a description by calling the MiniApp without any parameter. If the MiniApp is calles with the option "--xml" a XML description of all possible parameter is added.
\section bipmasec1 Description of Mini Apps
\subsection bipmasub1 mitkFileConverter
-Allows to convert a file from one type to another file type, for example to convert an image, saved in the nifti format to an image saved in the .nrrd format.
+Allows to convert a file from one type to another file type, for example to convert an image, saved in the nifti format to an image saved in the .nrrd format.
\subsection bipmasub2 mitkForwardWavelet
-Calculates the forward wavelet transformation of an image. The output will consist of multiple images, which will be saved in the format <output>%id%<output-extension>, where <output> and <output-extension> are specified by the user and %id% is a consecutive number.
+Calculates the forward wavelet transformation of an image. The output will consist of multiple images, which will be saved in the format \<output\>%id%\<output-extension\>, where \<output\> and \<output-extension\> are specified by the user and %id% is a consecutive number.
\subsection bipmasub3 mitkImageAndValueArithmetic
Mathematical operations with two operants, the individual voxels of the image and a specified floating point value. By default, the floating point value is the right operand.
\subsection bipmasub4 mitkImageTypeCovnerter
-Convert the data fromat that is used to save a voxel of an image.
+Convert the data fromat that is used to save a voxel of an image.
\subsection bipmasub5 mitkLaplacianOfGaussian
Calculate the Laplacian of Gaussian of an image with the specified sigma value.
\subsection bipmasub6 mitkMaskOutlierFiltering
-Can be used to clean an segmentation. The mean and standard deviation of the intensities which are masked is calculated and then all mask voxels are removed that cover image voxels which are not within a 3 sigma range.
+Can be used to clean an segmentation. The mean and standard deviation of the intensities which are masked is calculated and then all mask voxels are removed that cover image voxels which are not within a 3 sigma range.
\subsection bipmasub7 mitkMaskRangeBasedFiltering
-Removing all voxels from a mask that cover image voxels which are outside of a given range. The range can be either specified by a lower limit, a upper limit, or both at the same time.
+Removing all voxels from a mask that cover image voxels which are outside of a given range. The range can be either specified by a lower limit, a upper limit, or both at the same time.
\subsection bipmasub8 mitkMultiResolutionPyramid
-Calculate a Multi-Resolution Pyramid of the given image. The resolution is reduced by factor 2 for each step.
+Calculate a Multi-Resolution Pyramid of the given image. The resolution is reduced by factor 2 for each step.
\subsection bipmasub9 mitkResampleImage
Resample a mask to a new spacing
\subsection bipmasub10 mitkResampleMask
-Similar to mitkResampleImage, but specificly tailored to resampling a mask.
+Similar to mitkResampleImage, but specificly tailored to resampling a mask.
-\subsection bipmasub11 mitkSingleImageArithmetic
+\subsection bipmasub11 mitkSingleImageArithmetic
Applies single operand mathematical operations to each voxel of an image
-\subsection bipmasub12 mitkTwoImageArithmetic
+\subsection bipmasub12 mitkTwoImageArithmetic
Applied two operand mathematical operations to each voxels of two images.
*/
diff --git a/Modules/BasicImageProcessing/include/mitkMaskCleaningOperation.h b/Modules/BasicImageProcessing/include/mitkMaskCleaningOperation.h
index a483146e70..361856b9e1 100644
--- a/Modules/BasicImageProcessing/include/mitkMaskCleaningOperation.h
+++ b/Modules/BasicImageProcessing/include/mitkMaskCleaningOperation.h
@@ -1,58 +1,58 @@
/*============================================================================
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 mitkMaskClearningOperation_h
#define mitkMaskClearningOperation_h
#include <mitkImage.h>
#include <MitkBasicImageProcessingExports.h>
namespace mitk
{
/** \brief Executes operations to clean-up Masks.
*
- * It is assumed that the segmentation is of type <unsigned short>
+ * It is assumed that the segmentation is of type "unsigned short"
*/
class MITKBASICIMAGEPROCESSING_EXPORT MaskCleaningOperation {
public:
/** \brief Limits a Mask to a given Range
*
* Removes all elements of a mask that are not within the given range. If lowerLimitOn is true, all voxels that
* cover voxels with an intensity below lowerLimit will be set to 0 in the resulting mask. Similar, all voxels
* that cover voxels with an intensity above upperLimit will be set to 0 if upperLimitOn is true.
*
* <b>Parameter</b>
* - mitk::Image::Pointer image : Grey-Scale image
* - mitk::Image::Pointer mask : Original mask
* - optional: bool lowerLimitOn : If true, voxels below lowerLimit are not masked, default false
* - optional: double lowerLimit : Lower Threshold limit, default 0
* - optional: bool upperLimitOn : If true, voxels above upperLimit are not masked, default false
* - optional: double upperLimit : Lower Threshold limit, default 1
*/
static Image::Pointer RangeBasedMasking(Image::Pointer & image, Image::Pointer & mask, bool lowerLimitOn=false, double lowerLimit=0, bool upperLimitOn=false, double upperLimit=1);
/** \brief Removes outlier from a mask
*
* Removes all elements of a mask that are not within the range \f$ [\mu - 3 \sigma , \mu + 3 \sigma\] \f$
*
* <b>Parameter</b>
* - mitk::Image::Pointer image : Grey-Scale image
* - mitk::Image::Pointer mask : Original mask
*/
static Image::Pointer MaskOutlierFiltering(Image::Pointer & image, Image::Pointer & mask);
};
}
#endif // mitkMaskClearningOperation_h
diff --git a/Modules/Chart/documentation/mitkChart.dox b/Modules/Chart/documentation/mitkChart.dox
index af69c4dc5e..52c41353eb 100644
--- a/Modules/Chart/documentation/mitkChart.dox
+++ b/Modules/Chart/documentation/mitkChart.dox
@@ -1,256 +1,256 @@
/**
\page ChartModule Chart Module
\tableofcontents
\section ChartModule_brief Description
The MITK chart module is able to show different types of charts in a widget with customizable labels.
\imageMacro{complexExample.png,"Example chart",10}
-\subsection Chart_Technical Technical background
+\subsection Chart_Technical Technical background
-The module uses the java script library <a href="https://plot.ly/javascript/">plotly</a> to display the chart in a <a href="http://doc.qt.io/qt-5/qwebengineview.html">QWebEngineView</a> (that renders html/js content).
+The module uses the java script library <a href="https://plot.ly/javascript/">plotly</a> to display the chart in a <a href="https://doc.qt.io/qt-5/qwebengineview.html">QWebEngineView</a> (that renders html/js content).
For examples, please visit https://plot.ly/javascript/.
\subsection Chart_GUI GUI
\note Be sure that the dependency to the Chart Module is resolved in the CMakeLists.txt of the plugin: <code>MODULE_DEPENDS MitkChart</code>.
-Open the ui file of the plugin. Then add a widget (we always use the name <code>chartWidget</code> in the following) at the desired position. Change the class of the widget to a user-defined widget (right click &rarr; user defined classes, see http://doc.qt.io/qt-5/designer-using-custom-widgets.html). Set "QWidget" as base class. Set "QmitkChartWidget" as class name and "QmitkChartWidget.h" as include file.
+Open the ui file of the plugin. Then add a widget (we always use the name <code>chartWidget</code> in the following) at the desired position. Change the class of the widget to a user-defined widget (right click &rarr; user defined classes, see https://doc.qt.io/qt-5/designer-using-custom-widgets.html). Set "QWidget" as base class. Set "QmitkChartWidget" as class name and "QmitkChartWidget.h" as include file.
\imageMacro{userDefinedWidget.png,"User defined widget",10}
\subsection Chart_data Data
-The most important functionality is to add data to the chartWidget. Either one dimensional or two dimensional data can be used. One-dimensional data has the same interval between values on the x-axis (and no x-axis values) while the two-dimensional data has arbitrary x-axis difference values (and given x-axis values).
+The most important functionality is to add data to the chartWidget. Either one dimensional or two dimensional data can be used. One-dimensional data has the same interval between values on the x-axis (and no x-axis values) while the two-dimensional data has arbitrary x-axis difference values (and given x-axis values).
An example for one-dimensional data is the temperature for each month of a year: <code>std::vector<double> temperatureHD = {1.8, 3.1, 6.3, 10.2, 14.5, 17.4, 19.4, 18.9, 15.5, 11.2, 5.8, 2.6}</code>. The first entry corresponds (implicitly) to the temperature in january, two second to the temperature in february the last entry to the temperature in december. Thus, the x values have same intervals. The given temperature values are defined as y-axis values.
An example for two-dimensional data is the people living in a city in different years: <code>std::map<double,double> peopleHeidelberg={{1975, 129368 }, { 1985, 134724 },{ 1990, 136796 },{ 2010, 147312 }}.</code>
Thus, the x-values are given as their intervals are different (10 years, 5 years, 10 years). Each x value is connected to an y-value that represents the amount of people (1975 &rarr; 129368, 1985 &rarr; 134724, ...).
Data is added by calling <code>chartWidget->AddData1D(temperatureHD, "Heidelberg")</code> or <code>chartWidget->AddData2D(peopleHeidelberg, "Heidelberg")</code>, where the second argument is a label for the data entry.
\imageMacro{2DDataExample.png,"2D data example: Heidelberg has fewer entries and their x-range (years) is smaller than Freiburg",8}
-As the data labels are used as identifier, they have to be unique. This is checked. If non-unique entries are entered, they are made unique by adding numbers. Example:
+As the data labels are used as identifier, they have to be unique. This is checked. If non-unique entries are entered, they are made unique by adding numbers. Example:
\code{.cpp}
chartWidget->AddData1D(temperatureHD, "Heidelberg")
chartWidget->AddData1D(temperatureOslo, "Heidelberg")
\endcode
will result in the labels "Heidelberg" and "Heidelberg0", whereas "Heidelberg0" refers to <code>temperatureOslo</code>.
If you want to add more data, just call <code>chartWidget->AddData1D(data, label, chartType)</code> or <code>chartWidget->AddData2D(data, label, chartType)</code> as often as desired. Then, call <code>chartWidget->Show()</code>. The ranges of x- and y-axis are adjusted automatically.
To delete single data entries, call <code>chartWidget->RemoveData(label)</code> and update the chart area with <code>chartWidget->Show()</code>. All data can be cleared by calling <code>chartWidget->Clear()</code>.
\subsection Chart_type Chart type
The default chart type is <code>bar</code>. To use a different type, you have to change it.
Seven chart types are available:
<ul>
<li> <code>bar</code>
<li> <code>line</code>
<li> <code>spline</code>
<li> <code>pie</code>
<li> <code>are</code>
<li> <code>area_spline</code>
<li> <code>scatter</code>
</ul>
See below examples of all types:
\imageMacro{barChartTemperature.png,"Example bar chart",4}
\imageMacro{lineChartTemperature.png,"Example line chart",4}
\imageMacro{splineChartTemperature.png,"Example spline chart",4}
\imageMacro{pieChartExample.png,"Example pie chart",4}
\imageMacro{areaChartTemperature.png,"Example area chart",4}
\imageMacro{areaSplineChartTemperature.png,"Example spline area chart",4}
\imageMacro{scatterChartTemperature.png,"Example scatter chart",4}
Call e.g. <code>chartWidget->SetChartType(label, QmitkChartWidget::ChartType::line)</code> for changing the chart type. Note that it is not directly displayed. To change the chart type for all data entries and display the result, call <code>chartWidget->SetChartTypeForAllDataAndReload(QmitkChartWidget::ChartType::line)</code>.
All chart types except pie chart can be also used mixed (different chart types in the same chart). Pie charts are handled differently. The input data sum is regarded as 100%. The values of all data entries are summed. Example:
\code{.cpp}
chartWidget->AddData1D({5}, "entry1", QmitkChartWidget::ChartType::pie);
chartWidget->AddData1D({2}, "entry2", QmitkChartWidget::ChartType::pie);
chartWidget->AddData1D({3}, "entry3", QmitkChartWidget::ChartType::pie);
\endcode
The pie chart has then entries of 50%, 20% and 30%. Calling <code>chartWidget->AddData1D({5,2,3}, "entry", QmitkChartWidget::ChartType::pie)</code> leads to a pie chart with one class having 100%. Calling
\code{.cpp}
chartWidget->AddData1D({2,2,1}, "entry1", QmitkChartWidget::ChartType::pie);
chartWidget->AddData1D({1,1}, "entry2", QmitkChartWidget::ChartType::pie);
chartWidget->AddData1D({3}, "entry3", QmitkChartWidget::ChartType::pie);
\endcode
leads to the first result again (50%, 20% and 30%) as entries are summed.
\warning pie charts differ significantly from the other chart types. Be aware of the differences.
\subsection Chart_labels Labels
Four labels can be set to custom strings. These are
<ul>
<li> the data labels,
<li> the x-axis label,
<li> the y-axis label and
<li> the title of the chart
</ul>
-Data labels provide the name for data legend entries ("Heidelberg" for our 1D data \ref{Chart_data} as it is the average temperature in Heidelberg) and are given by the second argument of AddData1D and AddData2D. They are also displayed in the legend. An example x-Axis and y-axis label would be <i>month</i> and <i>temperature</i>, respectively.
+Data labels provide the name for data legend entries ("Heidelberg" for our 1D data \ref Chart_data as it is the average temperature in Heidelberg) and are given by the second argument of AddData1D and AddData2D. They are also displayed in the legend. An example x-Axis and y-axis label would be <i>month</i> and <i>temperature</i>, respectively.
The data label argument is mandatory. All other labels are optional and empty strings by default.
<code>chartWidget->SetXAxisLabel("month")</code> and <code>chartWidget->SetYAxisLabel("temperature")</code> ensures the labeling of x- and y-Axis in the chart. No labels are defined as default.
<code>chartWidget->SetTitle("temperature chart")</code> adds a title to the chart.
\note The legend position (of data labels) can be set by <code>chartWidget->SetLegendPosition(QmitkChartWidget::LegendPosition::bottom)</code>.
\note To hide the legend, call <code>chartWidget->SetShowLegend(false)</code>.
\subsection Chart_show Displaying the chart
Finally, the chart is displayed by calling <code>chartWidget->Show(bool)</code>. If the optional parameter is set to true, a subchart is shown additionally. That's useful for ensuring the overview if the user wants to zoom in.
\subsection Chart_dataAttributes Changing visualization attributes of data
Besides the chart type, the following attributes of a data entry can be changed:
<ul>
<li>color,
<li>linesyle and
<li>data points shown
</ul>
this is done by referencing the data entry by its label (e.g. "Heidelberg" above): <code>chartWidget->SetColor("Heidelberg", "green")</code>, <code>chartWidget->SetColor("Heidelberg", "#FF4500")</code>, <code>chartWidget->SetLineStyle("Heidelberg", LineStyle::dashed)</code> and <code>chartWidget->SetShowDataPoints(false)</code>.
\note SetShowDataPoints is a global attribute and valid for all data entries due to technical reasons.
-Colors are chosen automatically by plotly if not given. However, if some data entries have given colors and some have not, same colors may appear for different data entries. Color can be given as strings (natural names like <i>red</i> or hexadecimal numbers like <i>#FF0000</i>. For color selection, the following reference is helpful: https://www.w3schools.com/cssref/css_colors.asp)
+Colors are chosen automatically by plotly if not given. However, if some data entries have given colors and some have not, same colors may appear for different data entries. Color can be given as strings (natural names like <i>red</i> or hexadecimal numbers like \c \#FF0000 . For color selection, the following reference is helpful: https://www.w3schools.com/cssref/css_colors.asp)
Line style only can be set if ChartType is <code>QmitkChartWidget::ChartType::line</code>. It is ignored otherwise. Also, if a non-existing label is given, the command is ignored. The default linestyle is <code>LineStyle::solid</code>.
\section Chart_example Example
\subsection Chart_exampleBarChart Bar chart
To create and visualize a bar chart with two data sets, x/y-axis labels and data labels, the following code is used:
\code{.cpp}
std::vector<double> temperatureHD = {1.8, 3.1, 6.3, 10.2, 14.5, 17.4, 19.4, 18.9, 15.5, 11.2, 5.8, 2.6};
std::vector<double> temperatureOslo = {-4.3, -4, -0.2, 4.6, 10.8, 15.2, 16.4, 15.2, 10.8, 6.4, 0.7, -2.8};
chartWidget->AddData1D(temperatureHD, "Heidelberg", QmitkChartWidget::ChartType::bar);
chartWidget->AddData1D(temperatureOslo, "Oslo", QmitkChartWidget::ChartType::bar);
chartWidget->SetXAxisLabel("month");
chartWidget->SetYAxisLabel("temperature");
chartWidget->Show();
\endcode
The order when AddData1D() is called influences the colors of the bars and the order of the shown data. The third argument of <code>chartWidget->AddData1D()</code> is superfluous and only for completeness as <code>QmitkChartWidget::ChartType::bar</code> is the default chart type. After <code>Show()</code> is called, the chart is visualized.
The chart type for all data entries can be changed to spline and directly showed:
\code{.cpp}
chartWidget->SetChartTypeForAllDataAndReload(QmitkChartWidget::ChartType::spline);
\endcode
the equivalent code is:
\code{.cpp}
chartWidget->SetChartType("Heidelberg", QmitkChartWidget::ChartType::spline);
chartWidget->SetChartType("Oslo", QmitkChartWidget::ChartType::spline);
chartWidget->Show();
\endcode
The temperature of another city can be added:
\code{.cpp}
std::vector<double> temperatureRome = {8.1, 8.7, 8.7, 11.6, 18.8, 22.8, 25.4, 25.7, 21.4, 17.6, 12.6, 8.9};
chartWidget->AddData1D(temperatureRome, "Rome");
chartWidget->Show(true);
\endcode
As <code>Show(true)</code> is used, a subchart is shown.
\subsection Chart_examplePieChart Pie chart
-A pie chart (the same as in \ref Chart_type) can be generated with the following code:
+A pie chart (the same as in \ref Chart_type ) can be generated with the following code:
\code{.cpp}
chartWidget->AddData1D({5}, "Heidelberg", QmitkChartWidget::ChartType::pie);
chartWidget->AddData1D({3}, "Oslo", QmitkChartWidget::ChartType::pie);
chartWidget->AddData1D({2}, "New York", QmitkChartWidget::ChartType::pie);
chartWidget->Show();
\endcode
\note Only one pie chart at a time can be displayed.
\subsection Chart_exampleMixedChart Mixed chart
-Chart types and attributes like colors and line styles can be mixed as seen in the code example below (example result is the chart in \ref ChartModule_brief):
+Chart types and attributes like colors and line styles can be mixed as seen in the code example below (example result is the chart in \ref ChartModule_brief ):
\code{.cpp}
std::vector<double> temperatureHD = {1.8, 3.1, 6.3, 10.2, 14.5, 17.4, 19.4, 18.9, 15.5, 11.2, 5.8, 2.6};
std::vector<double> temperatureOslo = {-4.3, -4, -0.2, 4.6, 10.8, 15.2, 16.4, 15.2, 10.8, 6.4, 0.7, -2.8};
chartWidget->AddData1D(temperatureHD, "Heidelberg", QmitkChartWidget::ChartType::line);
chartWidget->AddData1D(temperatureOslo, "Oslo", QmitkChartWidget::ChartType::area);
chartWidget->SetColor("Heidelberg", "green");
chartWidget->SetColor("Oslo", "blue");
chartWidget->SetLineStyle("Heidelberg", QmitkChartWidget::LineStyle::dashed);
chartWidget->SetXAxisLabel("month");
chartWidget->SetYAxisLabel("temperature");
chartWidget->Show();
\endcode
\note Pie chart as chart type is an exception. Pie charts can't be displayed with other data entries having other chart types.
\subsection Chart_exampleRemoveData Removing data
Data also can be removed again (using the previous example \ref Chart_exampleMixedChart as base):
\code{.cpp}
chartWidget->RemoveData("Heidelberg");
chartWidget->Show();
\endcode
Only the date entries labeled "Oslo" remain.
Also all data can be removed:
\code{.cpp}
chartWidget->Clear();
chartWidget->Show();
\endcode
The chart is empty now.
\subsection Chart_example2DData Chart with 2D data
-A line chart with two-dimensional data is the following example (the same as in \ref Chart_data):
+A line chart with two-dimensional data is the following example (the same as in \ref Chart_data ):
\code{.cpp}
std::map<double, double> peopleHD = { {1975, 129368 }, { 1985, 134724 },{ 1990, 136796 },{ 2010, 147312 } };
std::map<double, double> peopleFreiburg = { { 1969, 165960 },{ 1973, 174997 },{ 1982, 178545 },{ 2001, 208294 },{ 2015, 222203 } };
chartWidget->AddData2D(peopleHD, "Heidelberg", QmitkChartWidget::ChartType::line);
chartWidget->AddData2D(peopleFreiburg, "Freiburg", QmitkChartWidget::ChartType::line);
chartWidget->SetXAxisLabel("year");
chartWidget->SetYAxisLabel("people");
chartWidget->Show();
\endcode
Hence, 2D data is having the following assignment: year &rarr; people. In the vector peopleHD, four values are defined, in the vector peopleFreiburg, five values are defined. The defined years are different for Heidelberg (1975-2010) than for Freiburg (1969-2015).
\warning mixing AddData2D and AddData1D in a chart is strongly discouraged. It will work, however the visualization may be odd due to implicit and explicit given x values.
\subsection Chart_imageStatistics image statistics plugin
-An example of the use of QmitkChartWidget in MITK can be found in the image statistics plugin (<code>org.mitk.gui.qt.measurementtoolbox\QmitkImageStatisticsView</code>). The <code>chartWidget</code> is named <code>m_Controls->m_JSHistogram</code> there.
+An example of the use of QmitkChartWidget in MITK can be found in the image statistics plugin. The \c chartWidget is named \c m_Controls->m_JSHistogram there.
*/
diff --git a/Modules/Chart/include/QmitkChartWidget.h b/Modules/Chart/include/QmitkChartWidget.h
index c3471ef820..a4276f1d2a 100644
--- a/Modules/Chart/include/QmitkChartWidget.h
+++ b/Modules/Chart/include/QmitkChartWidget.h
@@ -1,356 +1,358 @@
/*============================================================================
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 QmitkC3jsWidget_h
#define QmitkC3jsWidget_h
#include <map>
#include <memory>
#include <QWidget>
#include <MitkChartExports.h>
class QmitkChartxyData;
/*!
\brief QmitkChartWidget is a widget to display various charts based on the javascript chart library plotly.
* \details Data is added via AddData1D() or AddData2D().\n
* There can be multiple charts (of different types with different properties) created by calling AddData1D or AddData2D multiple times.\n\n
* The following chart types are supported:
* * line chart
* * bar chart
* * spline chart
* * pie chart
* * scatter chart
* * area chart
* * area spline chart.
*
* Technical details: The javascript code is embedded in a QWebEngineView. The actual js code is implemented in resource\Chart.js.
* \sa https://plot.ly/javascript/ for further information about the used javaScript library.
* \ingroup Modules/Chart
*/
class MITKCHART_EXPORT QmitkChartWidget : public QWidget
{
Q_OBJECT
public:
/*!
* \brief enum of diagram types.
*/
enum class ChartType {
bar, /*!< bar chart, see https://plot.ly/javascript/bar-charts/ */
line, /*!< line chart, see https://plot.ly/javascript/line-charts/ */
spline, /*!< spline chart (smoothed line chart), see https://plot.ly/~jduelfer/23/spline/#/ */
pie, /*!< pie chart, see https://plot.ly/javascript/pie-charts/ */
area, /*!< area chart, see https://plot.ly/javascript/filled-area-plots/ */
area_spline, /*!< area-spline chart, similar to https://plot.ly/~jduelfer/23/spline/#/ */
scatter /*!< scatter chart, see https://plot.ly/javascript/line-and-scatter/ */
};
/*!
* \brief enum of chart style (modifies background and line color).
*/
enum class ColorTheme {
darkstyle, /*!< background color: dark gray, foreground color: white*/
lightstyle /*!< background color: white, foreground color: black */
};
enum class LineStyle {
solid,
dashed
};
enum class MarkerSymbol {
circle,
diamond,
cross,
square,
pentagon,
star,
x,
diamond_tall,
star_diamond,
star_triangle_up,
star_triangle_down,
asterisk,
cross_thin,
x_thin
};
enum class ChartColor {
red,
orange,
yellow,
green,
blue,
purple,
brown,
magenta,
tan,
cyan,
olive,
maroon,
navy,
aquamarine,
turqouise,
silver,
lime,
teal,
indigo,
violet,
pink,
black,
white,
grey
};
enum class AxisScale {
linear,
log
};
/*!
* \brief enum of legend position.
* See https://plot.ly/javascript/legend/
*/
enum class LegendPosition {
bottomMiddle,
bottomRight,
topRight,
topLeft,
middleRight
};
explicit QmitkChartWidget(QWidget* parent = nullptr);
//for UnitTests
explicit QmitkChartWidget(QWidget *parent, bool unitTest);
~QmitkChartWidget() override;
/*!
* \brief Adds 1D data to the widget
* \details internally, the list is converted to a map with increasing integers keys starting at 0.
+ * \param data1D
* \param label the name of the data that is also used as identifier.
* \param chartType the chart type that should be used for this data entry
* \note the data can be cleared with ClearDiagram()
* \note If the label name already exists, the name is replaced with a unique one by concatenating numbers to it.
* \warning Pie chart is significantly different than the other chart types. Here, the data given by AddData1D is summed. Each entry represents a different category.
*/
void AddData1D(const std::vector<double>& data1D, const std::string& label, ChartType chartType = ChartType::bar);
/*!
* \brief Updates data of an existing label
* \param data1D the 1D data , \sa AddData1D
* \param label the (existing) label
* \note if the label does not exist, nothing happens
*/
void UpdateData1D(const std::vector<double> &data1D, const std::string &label);
/*!
* \sa UpdateData1D
* \sa AddData2D
*/
void UpdateData2D(const std::vector< std::pair<double, double> > &data2D, const std::string &label);
void UpdateChartExampleData(const std::vector< std::pair<double, double> >& data2D,
const std::string& label,
const std::string& type,
const std::string& color,
const std::string& lineStyle,
const std::string& pieLabelsData = 0);
/*!
* \brief Adds 2D data to the widget. Call repeatedly for displaying multiple charts.
* \details each entry represents a data point: key: value --> x-value: y-value.
+ * \param data2D
* \param label the name of the data that is also used as identifier.
* \param chartType the chart type that should be used for this data entry
* \note the data can be cleared with ClearDiagram()
* \note If the label name already exists, the name is replaced with a unique one by concatenating numbers to it.
* \warning Pie chart is significantly different than the other chart types. Here, the data given by AddData1D is summed. Each entry represents a different category.
*/
void AddData2D(const std::vector< std::pair<double, double> > &data2D,
const std::string &label,
ChartType chartType = ChartType::bar);
//Add Function for the ChartExample
void AddChartExampleData(const std::vector< std::pair<double, double> >& data2D,
const std::string& label,
const std::string& type,
const std::string& color,
const std::string& style,
const std::string& pieLabelsData = 0);
/*!
* \brief Removes data from the widget, works for 1D and 2D Data
* \param label the name of the data that is also used as identifier.
* \note All data can be cleared with ClearDiagram()
* \throws Invalid Argument Exception when the label cannot be found
*/
void RemoveData(const std::string& label);
void UpdateLabel(const std::string& existingLabel, const std::string& newLabel);
QmitkChartxyData *GetDataElementByLabel(const std::string& label) const;
/*!
* \brief Sets the color of one data entry (identifier is previously assigned label)
- * \details the color name can be "red" or a hex number (#FF0000).
+ * \details the color name can be "red" or a hex number (\c \#FF0000 ).
* \warning Either define all data entries with a color or no data entry. If a mixed approach is used,
* plotly choses the color of the data entry (that could be the same as a user defined color).
* \note If an unknown label is given, nothing happens.
* \sa https://www.w3schools.com/cssref/css_colors.asp
*/
void SetColor(const std::string& label, const std::string& colorName);
/*!
* \brief Sets the line style of one data entry (identifier is previously assigned label)
* \details two line styles are possible: LineStyle::solid and LineStyle::dashed.
* The default line style is solid.
* \note If an unknown label is given, nothing happens.
* \warning only sets the line style if the current chart type is ChartType::line.
* However, the line style remains also if the chart changes (e.g. new chart type)
*/
void SetLineStyle(const std::string& label, LineStyle style);
/*!
* \brief Sets the marker style of one data entry (identifier is previously assigned label)
* \note If an unknown label is given, nothing happens.
*/
void SetMarkerSymbol(const std::string &label, MarkerSymbol symbol);
/*!
* \brief Sets the axis scale to either linear (default) or logarithmic.
* \sa https://plot.ly/javascript/log-plot/
*/
void SetYAxisScale(AxisScale scale);
void SetXAxisLabel(const std::string& label);
void SetYAxisLabel(const std::string& label);
/*!
* \brief Sets labels for pie chart data.
* \note in AddData1D, the label still has to be given that acts as a unique id. However, the label is omitted then.
*/
void SetPieLabels(const std::vector<std::string> &pieLabels, const std::string &label);
/*!
* \brief Sets a title for the chart.
*/
void SetTitle(const std::string &title);
/*!
* \brief Sets the chart type for a data entry
* \details for available types, see ChartType
* \note If an unknown label is given, nothing happens.
* \warning Pie chart is significantly different than the other chart types. Here, the data given by AddData1D is summed. Each entry represents a different category.
* \sa DiagramType for available types
*/
void SetChartType(const std::string& label, ChartType type);
/*!
* \brief Sets error bars for data in x direction
* \note If only error plus is provided, the error bars are symmetrical
* \param label the name of the data that is also used as identifier.
* \param errorPlus the error in positive direction
* \param errorMinus the error in negative direction. Same as error plus if omitted
*/
void SetXErrorBars(const std::string &label, const std::vector<double> &errorPlus, const std::vector<double>& errorMinus = std::vector<double>());
/*!
* \brief Sets error bars for data in y direction
* \details for parameters, see SetXErrorBars
* \note If only error plus is provided, the error bars are symmetrical
*/
void SetYErrorBars(const std::string &label, const std::vector<double> &errorPlus, const std::vector<double> &errorMinus = std::vector<double>());
/*!
* \brief Sets the legend position.
* \details Default position is bottom.
* \sa LegendPosition for available types
*/
void SetLegendPosition(LegendPosition position);
void SetShowLegend(bool show);
void SetStackedData(bool stacked);
/*!
* \brief Displays the chart in the widget
* \param showSubChart if a subchart is displayed inside the widget or not.
* \note if no data has been provided, (\sa AddData1D AddData2D), an empty chart is displayed.
*/
void Show(bool showSubChart=false);
/*!
* \brief Either displays the dataPoints or not
* \param showDataPoints if dataPoints are displayed inside the widget or not.
* \details: example for not showing points: https://plot.ly/javascript/line-charts/#styling-line-plot
* example for showing the points: https://plot.ly/javascript/pointcloud/
*/
void SetShowDataPoints(bool showDataPoints);
/*!
* \brief Clears all data inside and resets the widget.
*/
void Clear();
/*!
* \brief Sets the theme of the widget.
* \details default is dark theme as in MITK.
* \warning has to be called before Show() or Reload() to work
*/
void SetTheme(ColorTheme themeEnabled);
/*!
* \brief Sets whether the subchart shall be shown.
* \details Changes the state of the current chart object.
* \note Needs to be reloaded with Reload() to display changes.
*/
void SetShowSubchart(bool showSubChart);
/*!
* \brief Sets whether the error bars shall be shown.
* \details Changes the state of the current chart object.
* \note Needs to be reloaded with Reload() to display changes.
* \param showErrorBars if error bars are displayed or not.
*/
void SetShowErrorBars(bool showErrorBars);
/*!
* \brief Sets the min and max x values of the chart
* \details Zooms in to view the values between minValue and maxValue in x direction
*/
void SetMinMaxValueXView(double minValueX,double maxValueX);
/*!
* \brief Sets the min and max y values of the chart
* \details Zooms in to view the values between minValue and maxValue in y direction
*/
void SetMinMaxValueYView(double minValueY, double maxValueY);
/*!
* \brief Reloads the chart in the widget
* \details reloading may be needed to display added data in an existing chart
*/
void Reload();
QSize sizeHint() const override;
void SavePlotAsImage();
public slots:
void OnLoadFinished(bool isLoadSuccessful);
void OnPageSuccessfullyLoaded();
signals:
void PageSuccessfullyLoaded();
private:
/*! source: https://stackoverflow.com/questions/29383/converting-bool-to-text-in-c*/
std::string convertBooleanValue(bool value) const;
class Impl;
std::unique_ptr<Impl> m_Impl;
};
#endif
diff --git a/Modules/Classification/CLCore/include/mitkAbstractClassifier.h b/Modules/Classification/CLCore/include/mitkAbstractClassifier.h
index d35f62d2b9..5e58b2bf8c 100644
--- a/Modules/Classification/CLCore/include/mitkAbstractClassifier.h
+++ b/Modules/Classification/CLCore/include/mitkAbstractClassifier.h
@@ -1,195 +1,195 @@
/*============================================================================
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 mitkAbstractClassifier_h
#define mitkAbstractClassifier_h
#include <MitkCLCoreExports.h>
#include <mitkBaseData.h>
// Eigen
#include <Eigen/Dense>
// STD Includes
// MITK includes
#include <mitkConfigurationHolder.h>
namespace mitk
{
class MITKCLCORE_EXPORT AbstractClassifier : public BaseData
{
public:
mitkClassMacro(AbstractClassifier,BaseData);
///
/// @brief Build a forest of trees from the training set (X, y).
- /// @param X, The training input samples. Matrix of shape = [n_samples, n_features]
- /// @param Y, The target values (class labels in classification, real numbers in regression). Matrix of shape = [n_samples, 1]
+ /// @param X The training input samples. Matrix of shape = [n_samples, n_features]
+ /// @param Y The target values (class labels in classification, real numbers in regression). Matrix of shape = [n_samples, 1]
///
virtual void Train(const Eigen::MatrixXd &X, const Eigen::MatrixXi &Y) = 0;
///
/// @brief Predict class for X.
- /// @param X, The input samples.
+ /// @param X The input samples.
/// @return The predicted classes. Y matrix of shape = [n_samples, 1]
///
virtual Eigen::MatrixXi Predict(const Eigen::MatrixXd &X) = 0;
///
/// @brief GetPointWiseWeightCopy
/// @return return label matrix of shape = [n_samples , 1]
///
Eigen::MatrixXi & GetLabels()
{
return m_OutLabel;
}
protected:
Eigen::MatrixXi m_OutLabel;
public:
// * --------------- *
// PointWiseWeight
// * --------------- *
///
/// @brief SupportsPointWiseWeight
/// @return True if the classifier supports pointwise weighting else false
///
virtual bool SupportsPointWiseWeight() = 0;
///
/// @brief GetPointWiseWeightCopy
/// @return Create and return a copy of W
///
virtual Eigen::MatrixXd & GetPointWiseWeight()
{
return m_PointWiseWeight;
}
///
/// @brief SetPointWiseWeight
- /// @param W, The pointwise weights. W matrix of shape = [n_samples, 1]
+ /// @param W The pointwise weights. W matrix of shape = [n_samples, 1]
///
virtual void SetPointWiseWeight(const Eigen::MatrixXd& W)
{
this->m_PointWiseWeight = W;
}
///
/// @brief UsePointWiseWeight
- /// @param toggle weighting on/off
+ /// @param value weighting on/off
///
virtual void UsePointWiseWeight(bool value)
{
this->m_IsUsingPointWiseWeight = value;
}
///
/// @brief IsUsingPointWiseWeight
/// @return true if pointewise weighting is enabled.
///
virtual bool IsUsingPointWiseWeight()
{
return this->m_IsUsingPointWiseWeight;
}
protected:
Eigen::MatrixXd m_PointWiseWeight;
bool m_IsUsingPointWiseWeight;
// * --------------- *
// PointWiseProbabilities
// * --------------- *
public:
///
/// @brief SupportsPointWiseProbability
/// @return True if the classifier supports pointwise class probability calculation else false
///
virtual bool SupportsPointWiseProbability() = 0;
///
/// @brief GetPointWiseWeightCopy
/// @return return probability matrix
///
virtual Eigen::MatrixXd & GetPointWiseProbabilities()
{
return m_OutProbability;
}
///
/// \brief UsePointWiseProbabilities
/// \param value
///
virtual void UsePointWiseProbability(bool value)
{
m_IsUsingPointWiseProbability = value;
}
///
/// \brief IsUsingPointWiseProbabilities
/// \return
///
virtual bool IsUsingPointWiseProbability()
{
return m_IsUsingPointWiseProbability;
}
protected:
Eigen::MatrixXd m_OutProbability;
bool m_IsUsingPointWiseProbability;
private:
void MethodForBuild();
public:
void SetNthItems(const char *val, unsigned int idx);
std::string GetNthItems(unsigned int idx) const;
void SetItemList(std::vector<std::string>);
std::vector<std::string> GetItemList() const;
#ifndef DOXYGEN_SKIP
void SetRequestedRegionToLargestPossibleRegion() override{}
bool RequestedRegionIsOutsideOfTheBufferedRegion() override{return true;}
bool VerifyRequestedRegion() override{return false;}
void SetRequestedRegion(const itk::DataObject* /*data*/) override{}
// Override
bool IsEmpty() const override
{
if(IsInitialized() == false)
return true;
const TimeGeometry* timeGeometry = const_cast<AbstractClassifier*>(this)->GetUpdatedTimeGeometry();
if(timeGeometry == nullptr)
return true;
return false;
}
#endif // Skip Doxygen
};
}
#endif //mitkAbstractClassifier_h
diff --git a/Modules/Classification/CLCore/include/mitkAbstractGlobalImageFeature.h b/Modules/Classification/CLCore/include/mitkAbstractGlobalImageFeature.h
index b55c3b17d8..b72e15a9f5 100644
--- a/Modules/Classification/CLCore/include/mitkAbstractGlobalImageFeature.h
+++ b/Modules/Classification/CLCore/include/mitkAbstractGlobalImageFeature.h
@@ -1,338 +1,342 @@
/*============================================================================
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 mitkAbstractGlobalImageFeature_h
#define mitkAbstractGlobalImageFeature_h
#include <MitkCLCoreExports.h>
#include <mitkBaseData.h>
#include <mitkImage.h>
#include <mitkCommandLineParser.h>
#include <mitkIntensityQuantifier.h>
// STD Includes
// Eigen
#include <Eigen/Dense>
// MITK includes
#include <mitkConfigurationHolder.h>
namespace mitk
{
/**Used as ID for features calculated by feature classes*/
struct MITKCLCORE_EXPORT FeatureID
{
/**Name of the feature*/
std::string name;
/**Name of the feature class*/
std::string featureClass;
/**ID for the setting that is represented by parameters and is specified by the feature class while calculating the features. It must be as unique as the parameters themself.*/
std::string settingID;
/**Alternative name that containes the legacy naming of the feature that encodes the parametersetting directly in the string.*/
std::string legacyName;
/**Version of the feature definition*/
std::string version = "1";
using ParametersType = std::map<std::string, us::Any>;
ParametersType parameters;
bool operator < (const FeatureID& rh) const;
bool operator ==(const FeatureID& rh) const;
};
/**Helper that takes a pass templateID clones it and populates it with the also passed informations befor returning it.
* @param templateID reference ID that should be cloned.
* @param name Name of the feature.*/
MITKCLCORE_EXPORT FeatureID CreateFeatureID(FeatureID templateID, std::string name);
/**
*
*
* ## Histogram Configuration ##
* Most Feature Generation Classes that use histograms use the same parameters and
* initialization logic. In general, all information can be passed either by the corresponding
* Setter (which does not differenciate between global setting and feature specific setting) and
* a parameter object which can be obtained from the command line arguments, for example.
*
* If the image values are used for the initializiation of the histogram, it can be defined
* whether the whole image is used or only the masked areas to find minima and maxima. This is
* done by the option <b>SetIgnoreMask</b> or the corrsponding options
* <b>-NAME::ignore-mask-for-histogram</b> and <b>-ignore-mask-for-histogram</b>. If these are
* true, the whole image is used for the calculation.
*
* Depending on the passed arguments, different initialization methods are used. The initialization
* is in the following order:
* - If <b>Minimum Intensity</b>, <b>Maximum Intensity</b>, and <b>Binsize</b>: The histogram is
* initialized between the minimum and maximum intensity. the number of bins is determined by the
* binsize. If the distance between minimum and maximum is not a multiple of the binsize, the maximum
* is increase so that it is.
* - <b>Minimum Intensity</b>, <b>Bins</b>, and <b>Binsize</b>: The histogram is initialized with the
* given binsize, and the intensity range from the minimum to \f$maximum = minimum + binsize*bins\f$.
* - <b>Minimum Intensity</b>, <b>Maximum Intensity</b>, and <b>Bins</b>: The histogram is initialized
* between the given minimum and maximum intensity. The binsize is calculated so that the number
* of bins is equal to the given number of bins.
* - <b>Binsize</b>, and <b>Minimum Intensity</b>: The maximum is set to the maximum that
* occur in the given image. Depending if the mask is considered or not, either only masked voxels or
* the whole image is used for the calculation. The initialization is then equal as if the minimum
* and maximum would have been given right from the beginning.
* - <b>Binsize</b>, and <b>Maximum Intensity</b>: The minimum intensity is set to the minimum that
* occur in the given image. Depending if the mask is considered or not, either only masked voxels or
* the whole image is used for the calculation. The initialization is then equal as if the minimum
* and maximum would have been given right from the beginning.
* - <b>Binsize</b>: The maximum and the minimum intensity is set to the minimum and maximum that
* occur in the given image. Depending if the mask is considered or not, either only masked voxels or
* the whole image is used for the calculation. The initialization is then equal as if the minimum
* and maximum would have been given right from the beginning.
* - <b>Bins</b>, and <b>Minimum Intensity</b>: The maximum is calculated from the image. Depending
* if the mask is considered or not, either only masked voxels or the whole image is used for the calculation. The histogram is
* then initialized as if these values would have been given as minimum and maximum intensity.
* - <b>Bins</b>, and <b>Maximum Intensity</b>: The minimum is calculated from the image. Depending
* if the mask is considered or not, either only masked voxels or the whole image is used for the calculation. The histogram is
* then initialized as if these values would have been given as minimum and maximum intensity.
* - <b>Bins</b>: The minimum and the maximum is calculated from the image. Depending
* if the mask is considered or not, either only masked voxels or * the whole image is used for the calculation. The histogram is
* then initialized as if these values would have been given as minimum and maximum intensity.
* - <b>No Parameter given</b>:The minimum and maximum intensity from the whole image or masked image is calculated and
* the histogram then initialized to this with a standard number of bins (Is set by each filter on its own.)
*
* ### Remark about command line parameter####
* There are generally two options to set a parameter via the command line. A global one that works for
* all filters that use histograms and a local one that set this parameter specific for this filter. The
* local parameters start with the filter name (Indiciated by NAME) followed by two colons, for example
* <b>vol::min</b> to set the minimum intensity for the volume filter. The global parameter is overwritten
* by the local parameter, if it is specified. Otherwise, it is still valid. If this prevents the specification
* of an histogram initialization method (for example, because the binsize is globally specified but the histogram
* should be initialized using a fixed numbe of bins), the parameter <b>NAME::ignore-global-histogram</b> can be passed.
* Then, all global histogram parameters are ignored and only local ones are used.
*
* The maximum intensity can be set by different command line parameters: global for all filters that use histograms
* by <b>-minimum-intensity</b> and <b>-minimum</b>. Alternative it can be set only for this filter by
* <b>-NAME::minimum</b> and <b>-NAME::min</b>.
*
* The minimum intensity can be set by different command line parameters: global for all filters that use histograms
* by <b>-maximum-intensity</b> and <b>-maximum</b>. Alternative it can be set only for this filter by
- * <b>\NAME::maximum</b> and <b>NAME::max</b>.
+ * <b>-NAME::maximum</b> and <b>-NAME::max</b>.
*
* The binsize can be set by different command line parameters: global for all filters that use histograms
* by <b>-binsize</b>. Alternative it can be set only for this filter by
- * <b>\NAME::binsize</b>.
+ * <b>-NAME::binsize</b>.
*
* The number of bins can be set by different command line parameters: global for all filters that use histograms
* by <b>-bins</b>. Alternative it can be set only for this filter by
- * <b>\NAME::bins</b>.
+ * <b>-NAME::bins</b>.
* ### Note to the developers ###
* All features are supposed to work the same way if a histogram is used somewhere in
* the code. For this, each derived class that makes use of a histogram should use
* the Quantifier object. In order to use this object correctly, the AddArguments-Function should
* contain the line <b>AddQuantifierArguments(parser);</b>, the CalculateFeaturesUsingParameters function
* should contain the line <b>InitializeQuantifierFromParameters(feature, mask);</b> and the CalculateFeatures function
* sould contain the line <b>InitializeQuantifier(image, mask);</b>. These function
* calls ensure that the necessary options are given to the configuration file, and that the initialization
* of the quantifier is done correctly. This ensures an consistend behavior over all FeatureGeneration Classes.
*
*/
class MITKCLCORE_EXPORT AbstractGlobalImageFeature : public BaseData
{
public:
mitkClassMacro(AbstractGlobalImageFeature, BaseData);
typedef std::vector< std::pair<FeatureID, double> > FeatureListType;
using ParametersType = FeatureID::ParametersType;
/**
* \brief Calculates the feature of this abstact interface. Does not necessarily considers the parameter settings.
*/
FeatureListType CalculateFeatures(const Image* image, const Image* mask);
virtual FeatureListType CalculateFeatures(const Image* image, const Image* mask, const Image* maskNoNAN) = 0;
/**
* \brief Calculates the given feature Slice-wise. Might not be availble for an individual filter!
*/
FeatureListType CalculateFeaturesSlicewise(const Image::Pointer & image, const Image::Pointer &mask, int sliceID);
/**
* \brief Calculates the feature of this abstact interface. Does not necessarily considers the parameter settings.
*/
virtual void CalculateAndAppendFeaturesSliceWise(const Image::Pointer & image, const Image::Pointer &mask, int sliceID, FeatureListType &featureList, bool checkParameterActivation = true);
/**
* \brief Calculates the feature of this abstact interface. Does not necessarily considers the parameter settings.
+ * @param image
+ * @param mask
+ * @param maskNoNaN
+ * @param featureList
* @param checkParameterActivation Indicates if the features should only be calculated and added if the FeatureClass is activated in the parameters.
* True: only append if activated in the parametes. False: always and append it.
*/
- void CalculateAndAppendFeatures(const Image* image, const Image* mask, const Image* maskNoNAN, FeatureListType &featureList, bool checkParameterActivation = true);
+ void CalculateAndAppendFeatures(const Image* image, const Image* mask, const Image* maskNoNaN, FeatureListType &featureList, bool checkParameterActivation = true);
itkSetMacro(Prefix, std::string);
itkSetMacro(ShortName, std::string);
itkSetMacro(LongName, std::string);
itkSetMacro(FeatureClassName, std::string);
itkSetMacro(Direction, int);
void SetParameters(ParametersType param)
{
m_Parameters = param;
this->ConfigureQuantifierSettingsByParameters();
this->ConfigureSettingsByParameters(param);
this->Modified();
};
itkGetConstMacro(Prefix, std::string);
itkGetConstMacro(ShortName, std::string);
itkGetConstMacro(LongName, std::string);
itkGetConstMacro(FeatureClassName, std::string);
itkGetConstMacro(Parameters, ParametersType);
itkGetMacro(Quantifier, IntensityQuantifier::Pointer);
itkGetConstMacro(Direction, int);
itkSetMacro(MinimumIntensity, double);
itkSetMacro(UseMinimumIntensity, bool);
itkSetMacro(MaximumIntensity, double);
itkSetMacro(UseMaximumIntensity, bool);
itkGetConstMacro(MinimumIntensity, double);
itkGetConstMacro(UseMinimumIntensity, bool);
itkGetConstMacro(MaximumIntensity, double);
itkGetConstMacro(UseMaximumIntensity, bool);
itkSetMacro(Binsize, double);
itkSetMacro(UseBinsize, bool);
itkGetConstMacro(Binsize, double);
itkGetConstMacro(UseBinsize, bool);
itkSetMacro(MorphMask, mitk::Image::Pointer);
itkGetConstMacro(MorphMask, mitk::Image::Pointer);
itkSetMacro(Bins, int);
itkSetMacro(UseBins, bool);
itkGetConstMacro(UseBins, bool);
itkGetConstMacro(Bins, int);
itkSetMacro(IgnoreMask, bool);
itkGetConstMacro(IgnoreMask, bool);
itkSetMacro(EncodeParametersInFeaturePrefix, bool);
itkGetConstMacro(EncodeParametersInFeaturePrefix, bool);
itkBooleanMacro(EncodeParametersInFeaturePrefix);
std::string GetOptionPrefix() const
{
if (!m_Prefix.empty())
return m_Prefix + "::" + m_ShortName;
return m_ShortName;
}
/** Can be called to add all relevant argument for configuring the feature instance to the passed parser instance.
Must be implemented be derived classes. For adding the quantifier arguments use AddQuantifierArguments(...) as
helper function.*/
virtual void AddArguments(mitkCommandLineParser &parser) const = 0;
/** Helper function that generates the legacy feature name without encoding of parameters; as it is used e.g.
in the unit tests.*/
static std::string GenerateLegacyFeatureNameWOEncoding(const FeatureID& id);
protected:
std::vector<double> SplitDouble(std::string str, char delimiter);
virtual FeatureListType DoCalculateFeatures(const Image* image, const Image* mask) = 0;
void AddQuantifierArguments(mitkCommandLineParser& parser) const;
/** Ensures that all quantifier relevant variables of the instance are set correctly given the information in m_Parameters.*/
void ConfigureQuantifierSettingsByParameters();
/** Ensures that the instance is configured according to the information given in the passed parameters.
* This method will be called by SetParameters(...) after ConfigureQuantifierSettingsByParameters() was called.*/
virtual void ConfigureSettingsByParameters(const ParametersType& parameters);
/**Initializes the quantifier gigen the quantifier relevant variables and the passed arguments.*/
void InitializeQuantifier(const Image* image, const Image* mask, unsigned int defaultBins = 256);
/** Helper that encodes the quantifier parameters in a string (e.g. used for the legacy feature name)*/
std::string QuantifierParameterString() const;
/* Creates a template feature id.
* it will set the featureClass, the settingID (assuming that it is the featureClass with the passed suffix
* and all parameters that are global or have the option prefix of the instance.*/
FeatureID CreateTemplateFeatureID(std::string settingsSuffix = "", FeatureID::ParametersType additionalParams = {});
/** Helper that generates the legacy feature names for a passed FeatureID.
- * Format of the legacy feature name is: <ClassName>::[<LegacyFeatureEncoding>::]<LegacyFeatureNamePart>
+ * Format of the legacy feature name is: \<ClassName\>::[\<LegacyFeatureEncoding\>::]\<LegacyFeatureNamePart\>
* Overwrite GenerateLegacyFeatureNamePart and GenerateLegacyFeatureEncoding to change behavior in
* derived classes.
*/
virtual std::string GenerateLegacyFeatureName(const FeatureID& id) const;
virtual std::string GenerateLegacyFeatureNamePart(const FeatureID& id) const;
virtual std::string GenerateLegacyFeatureEncoding(const FeatureID& id) const;
public:
//#ifndef DOXYGEN_SKIP
void SetRequestedRegionToLargestPossibleRegion() override {};
bool RequestedRegionIsOutsideOfTheBufferedRegion() override { return true; };
bool VerifyRequestedRegion() override { return false; };
void SetRequestedRegion (const itk::DataObject * /*data*/) override {};
// Override
bool IsEmpty() const override
{
if(IsInitialized() == false)
return true;
const TimeGeometry* timeGeometry = const_cast<AbstractGlobalImageFeature*>(this)->GetUpdatedTimeGeometry();
if(timeGeometry == nullptr)
return true;
return false;
}
private:
std::string m_Prefix; // Prefix before all input parameters
std::string m_ShortName; // Name of all variables
std::string m_LongName; // Long version of the name (For turning on)
std::string m_FeatureClassName;
ParametersType m_Parameters; // Parameter setting
mitk::Image::Pointer m_MorphMask = nullptr;
IntensityQuantifier::Pointer m_Quantifier;
//Quantifier relevant variables
double m_MinimumIntensity = 0;
bool m_UseMinimumIntensity = false;
double m_MaximumIntensity = 100;
bool m_UseMaximumIntensity = false;
bool m_EncodeParametersInFeaturePrefix = false;
double m_Binsize = 1;
bool m_UseBinsize = false;
int m_Bins = 256;
bool m_UseBins = true;
int m_Direction = 0;
bool m_IgnoreMask = false;
//#endif // Skip Doxygen
};
}
#endif //mitkAbstractGlobalImageFeature_h
diff --git a/Modules/Classification/CLImportanceWeighting/include/mitkGeneralizedLinearModel.h b/Modules/Classification/CLImportanceWeighting/include/mitkGeneralizedLinearModel.h
index 10c4b59fc5..629595486a 100644
--- a/Modules/Classification/CLImportanceWeighting/include/mitkGeneralizedLinearModel.h
+++ b/Modules/Classification/CLImportanceWeighting/include/mitkGeneralizedLinearModel.h
@@ -1,99 +1,99 @@
/*============================================================================
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 mitkGeneralizedLinearModel_h
#define mitkGeneralizedLinearModel_h
#include <MitkCLImportanceWeightingExports.h>
#include <vnl/vnl_matrix.h>
#include <vnl/vnl_vector.h>
namespace mitk
{
/**
* \brief Generalized Linear Model that allows linear models for non-gaussian data
*
* Generalized linear models are an extension of standard linear models that allow
* a different apperance of the data. This is for example usefull to calculate
* Logistic regressions.
*/
class MITKCLIMPORTANCEWEIGHTING_EXPORT GeneralizedLinearModel
{
public:
/**
* \brief Initialization of the GLM. The parameters needs to be passed at the beginning.
*
* Constructor for a GLM. During the creation process the glm model parameter
* are guessed.
*
* @param xData The input data matrix.
* @param yData The output data matrix. The values of y must meet the requirements of the link and distribution.
* @param addConstantColumn Default=True. If True an constant value is added to each row allowing a constant factor in the model.
*/
GeneralizedLinearModel (const vnl_matrix<double> &xData, const vnl_vector<double> &yData, bool addConstantColumn=true);
/**
* \brief Predicts the value corresponding to the given vector.
*
* From the learned data a guess is given depending on the provided input vector. The
* value depend on the b-values of the learned model as well as on the chosen link and
* distribution.
*
* No input validation is done. The data and the learned model might not match!
*
- * @paaram c Column for which the data is guessed.
+ * @param c Column for which the data is guessed.
*/
double Predict(const vnl_vector<double> &c);
/**
* \brief Predicts the value corresponding to the given matrix.
*
* From the learned data a guess is given depending on the provided input matrix. The
* value depend on the b-values of the learned model as well as on the chosen link and
* distribution.
*
* No input validation is done. The data and the learned model might not match!
*
- * @paaram x Matrix for which the data is guessed.
+ * @param x Matrix for which the data is guessed.
*/
vnl_vector<double> Predict(const vnl_matrix<double> &x);
/**
* \brief Estimation of the exponential factor for a given function
*
* Gives the exponential part of a link function. Only suitable for log-it models. This
* is especially usefull for calculating the weights for transfer learning since it
* is equal to the weights.
*
*/
vnl_vector<double> ExpMu(const vnl_matrix<double> &x);
/**
* \brief Returns the b-Vector for the estimation
*/
vnl_vector<double> B();
private:
// Estimates the rank of the matrix and creates a permutation vector so
// that the most important columns are first. Depends on a QR-algorithm.
void EstimatePermutation(const vnl_matrix<double> &xData);
vnl_vector<unsigned int> m_Permutation; // Holds a permutation matrix which is used during calculation of B
vnl_vector<double> m_B; // B-Values. Linear componentn of the model.
bool m_AddConstantColumn; // If true, a constant value is added to each row
// int m_Rank; // The estimated input rank of the matrix.
};
}
#endif //mitkGeneralizedLInearModel_h
diff --git a/Modules/Classification/CLMiniApps/CMakeLists.txt b/Modules/Classification/CLMiniApps/CMakeLists.txt
index 3755b73a83..6e45122c9a 100644
--- a/Modules/Classification/CLMiniApps/CMakeLists.txt
+++ b/Modules/Classification/CLMiniApps/CMakeLists.txt
@@ -1,117 +1,117 @@
option(BUILD_ClassificationMiniApps "Build commandline tools for classification" OFF)
if(BUILD_ClassificationMiniApps OR MITK_BUILD_ALL_APPS)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
)
# list of miniapps
# if an app requires additional dependencies
# they are added after a "^^" and separated by "_"
set( classificationminiapps
RandomForestTraining^^MitkCLVigraRandomForest
NativeHeadCTSegmentation^^MitkCLVigraRandomForest
ManualSegmentationEvaluation^^MitkCLVigraRandomForest
CLScreenshot^^MitkCore_MitkQtWidgetsExt_MitkCLUtilities
CLDicom2Nrrd^^MitkCore
CLResampleImageToReference^^MitkCore
CLGlobalImageFeatures^^MitkCLUtilities_MitkQtWidgetsExt
CLMRNormalization^^MitkCLUtilities_MitkCLMRUtilities
CLStaple^^MitkCLUtilities
CLVoxelFeatures^^MitkCLUtilities
CLPolyToNrrd^^
CLPlanarFigureToNrrd^^MitkCore_MitkSegmentation_MitkMultilabel
CLSimpleVoxelClassification^^MitkDataCollection_MitkCLVigraRandomForest
CLVoxelClassification^^MitkDataCollection_MitkCLImportanceWeighting_MitkCLVigraRandomForest
CLBrainMask^^MitkCLUtilities
XRaxSimulationFromCT^^MitkCLUtilities
CLRandomSampling^^MitkCore_MitkCLUtilities
CLRemoveEmptyVoxels^^MitkCore
CLN4^^MitkCore
CLSkullMask^^MitkCore
CLPointSetToSegmentation^^
CLMultiForestPrediction^^MitkDataCollection_MitkCLVigraRandomForest
CLNrrdToPoly^^MitkCore
CL2Dto3DImage^^MitkCore
CLWeighting^^MitkCore_MitkCLImportanceWeighting_MitkCLUtilities
CLOverlayRoiCenterOfMass^^MitkCore_MitkCLUtilities_MitkQtWidgetsExt
CLLungSegmentation^^MitkCore_MitkSegmentation_MitkMultilabel
)
foreach(classificationminiapps ${classificationminiapps})
# extract mini app name and dependencies
string(REPLACE "^^" "\\;" miniapp_info ${classificationminiapps})
set(miniapp_info_list ${miniapp_info})
list(GET miniapp_info_list 0 appname)
list(GET miniapp_info_list 1 raw_dependencies)
string(REPLACE "_" "\\;" dependencies "${raw_dependencies}")
set(dependencies_list ${dependencies})
mitk_create_executable(${appname}
DEPENDS MitkCore MitkCLCore MitkCommandLine ${dependencies_list}
- PACKAGE_DEPENDS ITK Qt5|Core Vigra
+ PACKAGE_DEPENDS ITK Qt5|Core Vigra VTK|IOImage
CPP_FILES ${appname}.cpp
)
if(EXECUTABLE_IS_ENABLED)
# On Linux, create a shell script to start a relocatable application
if(UNIX AND NOT APPLE)
install(PROGRAMS "${MITK_SOURCE_DIR}/CMake/RunInstalledApp.sh" DESTINATION "." RENAME ${EXECUTABLE_TARGET}.sh)
endif()
get_target_property(_is_bundle ${EXECUTABLE_TARGET} MACOSX_BUNDLE)
if(APPLE)
if(_is_bundle)
set(_target_locations ${EXECUTABLE_TARGET}.app)
set(${_target_locations}_qt_plugins_install_dir ${EXECUTABLE_TARGET}.app/Contents/MacOS)
set(_bundle_dest_dir ${EXECUTABLE_TARGET}.app/Contents/MacOS)
set(_qt_plugins_for_current_bundle ${EXECUTABLE_TARGET}.app/Contents/MacOS)
set(_qt_conf_install_dirs ${EXECUTABLE_TARGET}.app/Contents/Resources)
install(TARGETS ${EXECUTABLE_TARGET} BUNDLE DESTINATION . )
else()
if(NOT MACOSX_BUNDLE_NAMES)
set(_qt_conf_install_dirs bin)
set(_target_locations bin/${EXECUTABLE_TARGET})
set(${_target_locations}_qt_plugins_install_dir bin)
install(TARGETS ${EXECUTABLE_TARGET} RUNTIME DESTINATION bin)
else()
foreach(bundle_name ${MACOSX_BUNDLE_NAMES})
list(APPEND _qt_conf_install_dirs ${bundle_name}.app/Contents/Resources)
set(_current_target_location ${bundle_name}.app/Contents/MacOS/${EXECUTABLE_TARGET})
list(APPEND _target_locations ${_current_target_location})
set(${_current_target_location}_qt_plugins_install_dir ${bundle_name}.app/Contents/MacOS)
message( " set(${_current_target_location}_qt_plugins_install_dir ${bundle_name}.app/Contents/MacOS) ")
install(TARGETS ${EXECUTABLE_TARGET} RUNTIME DESTINATION ${bundle_name}.app/Contents/MacOS/)
endforeach()
endif()
endif()
else()
set(_target_locations bin/${EXECUTABLE_TARGET}${CMAKE_EXECUTABLE_SUFFIX})
set(${_target_locations}_qt_plugins_install_dir bin)
set(_qt_conf_install_dirs bin)
install(TARGETS ${EXECUTABLE_TARGET} RUNTIME DESTINATION bin)
endif()
endif()
endforeach()
mitk_create_executable(CLMatchPointReg
DEPENDS MitkCore MitkCLUtilities MitkMatchPointRegistration MitkCommandLine MitkMatchPointRegistrationUI
PACKAGE_DEPENDS ITK Qt5|Core Vigra MatchPoint
CPP_FILES CLMatchPointReg.cpp
)
# On Linux, create a shell script to start a relocatable application
if(UNIX AND NOT APPLE)
install(PROGRAMS "${MITK_SOURCE_DIR}/CMake/RunInstalledApp.sh" DESTINATION "." RENAME ${EXECUTABLE_TARGET}.sh)
endif()
if(EXECUTABLE_IS_ENABLED)
MITK_INSTALL_TARGETS(EXECUTABLES ${EXECUTABLE_TARGET})
endif()
endif()
diff --git a/Modules/Classification/CLUtilities/CMakeLists.txt b/Modules/Classification/CLUtilities/CMakeLists.txt
index ad4d3835f8..3c7f86a35d 100644
--- a/Modules/Classification/CLUtilities/CMakeLists.txt
+++ b/Modules/Classification/CLUtilities/CMakeLists.txt
@@ -1,14 +1,14 @@
mitk_create_module(
DEPENDS MitkCore MitkCLCore MitkCommandLine MitkDICOM
- PACKAGE_DEPENDS PUBLIC Eigen PRIVATE tinyxml
+ PACKAGE_DEPENDS PUBLIC Eigen PRIVATE tinyxml VTK|FiltersStatistics
)
if(TARGET ${MODULE_TARGET})
if(MITK_USE_OpenMP)
target_link_libraries(${MODULE_TARGET} PUBLIC OpenMP::OpenMP_CXX)
endif()
if(BUILD_TESTING)
add_subdirectory(test)
endif()
endif()
diff --git a/Modules/Classification/CLUtilities/include/mitkCLUtil.h b/Modules/Classification/CLUtilities/include/mitkCLUtil.h
index 7db22c89d1..6202e9197b 100644
--- a/Modules/Classification/CLUtilities/include/mitkCLUtil.h
+++ b/Modules/Classification/CLUtilities/include/mitkCLUtil.h
@@ -1,583 +1,581 @@
/*============================================================================
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 mitkCLUtil_h
#define mitkCLUtil_h
#include <Eigen/Dense>
#include <MitkCLUtilitiesExports.h>
#include <itkImageRegionIterator.h>
#include <mitkImage.h>
#include <mitkImageCast.h>
#include <mitkITKImageImport.h>
#include <itkConnectedComponentImageFilter.h>
namespace mitk
{
class MITKCLUTILITIES_EXPORT CLUtil
{
public:
///
/// \brief The MorphologicalDimensions enum
///
enum MorphologicalDimensions
{
Axial,Coronal,Sagital,All
};
///
/// \brief CreateCheckerBoardPredictionMask
/// \param image
/// \param outimage
///
static void CreateCheckerboardMask(mitk::Image::Pointer image, mitk::Image::Pointer & outimage);
///
/// \brief InterpolateCreateCheckerboardPrediction
- /// \param image
+ /// \param checkerboard_prediction
+ /// \param checkerboard_mask
/// \param outimage
///
static void InterpolateCheckerboardPrediction(mitk::Image::Pointer checkerboard_prediction, mitk::Image::Pointer & checkerboard_mask, mitk::Image::Pointer & outimage);
///
/// \brief CountVoxel
/// \param image
/// \param map
///
static void CountVoxel(mitk::Image::Pointer image, std::map<unsigned int, unsigned int> & map);
///
/// \brief CountVoxel
/// \param image
/// \param label
/// \param count
///
static void CountVoxel(mitk::Image::Pointer image, unsigned int label, unsigned int & count);
///
/// \brief CountVoxel
/// \param image
/// \param count
///
static void CountVoxel(mitk::Image::Pointer image, unsigned int & count);
///
/// \brief SumVoxelForLabel
/// \param image
/// \param source
/// \param label
/// \param val
///
static void SumVoxelForLabel(mitk::Image::Pointer image, const mitk::Image::Pointer & source , unsigned int label, double & val );
///
/// \brief SqSumVoxelForLabel
/// \param image
/// \param source
/// \param label
/// \param val
///
static void SqSumVoxelForLabel(mitk::Image::Pointer image, const mitk::Image::Pointer & source, unsigned int label, double & val );
///
/// \brief LogicalAndImages
/// \param image1
/// \param image2
+ /// \param outimage
///
static void LogicalAndImages(const Image::Pointer &image1, const Image::Pointer &image2, Image::Pointer &outimage);
///
/// \brief GaussianFilter
/// \param image
/// \param smoothed
/// \param sigma
///
static void GaussianFilter(mitk::Image::Pointer image, mitk::Image::Pointer & smoothed ,double sigma);
///
/// \brief SubtractGaussianFilter
/// \param image
/// \param smoothed (Result is sigma1-sigma2)
/// \param sigma1
/// \param sigma2
///
static void DifferenceOfGaussianFilter(mitk::Image::Pointer image, mitk::Image::Pointer & smoothed, double sigma1, double sigma2);
///
/// \brief Laplacian of Gaussian
/// \param image
/// \param smoothed (Result is sigma1-sigma2)
/// \param sigma1
- /// \param sigma2
///
static void LaplacianOfGaussianFilter(mitk::Image::Pointer image, mitk::Image::Pointer & smoothed, double sigma1);
///
/// \brief SubtractGaussianFilter
/// \param image
- /// \param smoothed (Result is sigma1-sigma2)
- /// \param sigma1
- /// \param sigma2
+ /// \param out
+ /// \param sigma
///
static void HessianOfGaussianFilter(mitk::Image::Pointer image, std::vector<mitk::Image::Pointer> &out, double sigma);
///
/// \brief Local Histogram
/// \param image
- /// \param smoothed (Result is sigma1-sigma2)
- /// \param sigma1
- /// \param sigma2
+ /// \param out
+ /// \param Bins
+ /// \param NeighbourhoodSize
///
static void LocalHistogram(mitk::Image::Pointer image, std::vector<mitk::Image::Pointer> &out, int Bins, int NeighbourhoodSize);
///
/// \brief transform
/// \param matrix
/// \param mask
- /// \param outimage
///
template<typename TMatrixElementType>
static mitk::Image::Pointer Transform(const Eigen::Matrix<TMatrixElementType, Eigen::Dynamic, Eigen::Dynamic> & matrix, const mitk::Image::Pointer & mask)
{
itk::Image<unsigned int, 3>::Pointer itkMask;
mitk::CastToItkImage(mask,itkMask);
typename itk::Image<TMatrixElementType, 3>::Pointer itk_img = itk::Image<TMatrixElementType, 3>::New();
itk_img->SetRegions(itkMask->GetLargestPossibleRegion());
itk_img->SetOrigin(itkMask->GetOrigin());
itk_img->SetSpacing(itkMask->GetSpacing());
itk_img->SetDirection(itkMask->GetDirection());
itk_img->Allocate();
unsigned int n_numSamples = 0;
mitk::CLUtil::CountVoxel(mask,n_numSamples);
if(n_numSamples != matrix.rows())
MITK_ERROR << "Number of samples in matrix and number of points under the masks is not the same!";
auto mit = itk::ImageRegionConstIterator<itk::Image<unsigned int, 3> >(itkMask, itkMask->GetLargestPossibleRegion());
auto oit = itk::ImageRegionIterator<itk::Image<TMatrixElementType, 3> >(itk_img, itk_img->GetLargestPossibleRegion());
unsigned int current_row = 0;
while(!mit.IsAtEnd())
{
if(mit.Value() > 0)
oit.Set(matrix(current_row++,0));
else
oit.Set(0.0);
++mit;
++oit;
}
mitk::Image::Pointer out_img = mitk::Image::New();
mitk::GrabItkImageMemory(itk_img,out_img);
return out_img;
}
///
/// \brief TransformImageToMatrix
- /// \param in_img
+ /// \param img
/// \param mask
- /// \param out_matrix
///
template<typename TMatrixElementType>
static Eigen::Matrix<TMatrixElementType, Eigen::Dynamic, Eigen::Dynamic> Transform(const mitk::Image::Pointer & img, const mitk::Image::Pointer & mask)
{
itk::Image<unsigned int, 3>::Pointer current_mask;
mitk::CastToItkImage(mask,current_mask);
unsigned int n_numSamples = 0;
mitk::CLUtil::CountVoxel(mask,n_numSamples);
typename itk::Image<TMatrixElementType, 3>::Pointer current_img;
mitk::CastToItkImage(img,current_img);
Eigen::Matrix<TMatrixElementType, Eigen::Dynamic, Eigen::Dynamic> out_matrix(n_numSamples,1);
auto mit = itk::ImageRegionConstIterator<itk::Image<unsigned int, 3> >(current_mask, current_mask->GetLargestPossibleRegion());
auto iit = itk::ImageRegionConstIterator<itk::Image<TMatrixElementType, 3> >(current_img,current_img->GetLargestPossibleRegion());
unsigned int current_row = 0;
while (!mit.IsAtEnd()) {
if(mit.Value() > 0)
out_matrix(current_row++) = iit.Value();
++mit;
++iit;
}
return out_matrix;
}
///
/// \brief DilateBinary
- /// \param BinaryImage
- /// \param BinaryImage
- /// \param Size of the StructuringElement
- /// \param Dimension
+ /// \param sourceImage
+ /// \param resultImage
+ /// \param radius Size of the StructuringElement
+ /// \param d
///
static void DilateBinary(mitk::Image::Pointer & sourceImage, mitk::Image::Pointer& resultImage, int radius , MorphologicalDimensions d);
///
/// \brief ErodeBinary
- /// \param BinaryImage
- /// \param BinaryImage
- /// \param Size of the StructuringElement
- /// \param Dimension
+ /// \param sourceImage
+ /// \param resultImage
+ /// \param radius Size of the StructuringElement
+ /// \param d
///
static void ErodeBinary(mitk::Image::Pointer & sourceImage, mitk::Image::Pointer& resultImage, int radius, MorphologicalDimensions d);
///
/// \brief ClosingBinary
- /// \param BinaryImage
- /// \param BinaryImage
- /// \param Size of the StructuringElement
- /// \param Dimension
+ /// \param sourceImage
+ /// \param resultImage
+ /// \param radius Size of the StructuringElement
+ /// \param d
///
static void ClosingBinary(mitk::Image::Pointer & sourceImage, mitk::Image::Pointer& resultImage, int radius, MorphologicalDimensions d);
///
/// \brief MergeLabels
- /// \param MultilabelImage
- /// \param map merge instruction where each map entry defines a mapping instruction. Key <sourcelabel> - Value <targetlabel>
+ /// \param img
+ /// \param map merge instruction where each map entry defines a mapping instruction. Key \c \<sourcelabel\> - Value \c \<targetlabel\>
///
static void MergeLabels(mitk::Image::Pointer & img, const std::map<unsigned int, unsigned int> & map);
///
/// \brief ConnectedComponentsImage
- /// \param BinaryImage
- /// \param BinaryImage
- /// \param MultilabelImage
- /// \param Number of components found in the image
+ /// \param image
+ /// \param mask
+ /// \param outimage
+ /// \param num_components Number of components found in the image
///
static void ConnectedComponentsImage(mitk::Image::Pointer & image, mitk::Image::Pointer& mask, mitk::Image::Pointer &outimage, unsigned int& num_components);
///
/// \brief GrabLabel
- /// \param MultiLabelImage
+ /// \param image
/// \param outimage
/// \param label
///
static void GrabLabel(mitk::Image::Pointer & image, mitk::Image::Pointer & outimage, unsigned int label);
///
/// \brief itkInsertLabel
/// \param image
/// \param maskImage
/// \param label
///
static void InsertLabel(mitk::Image::Pointer & image, mitk::Image::Pointer & maskImage, unsigned int label);
///
/// \brief ErodeGrayscale
/// \param image
/// \param outimage
/// \param radius
/// \param d
///
static void ErodeGrayscale(mitk::Image::Pointer & image, unsigned int radius, mitk::CLUtil::MorphologicalDimensions d, mitk::Image::Pointer & outimage );
///
/// \brief DilateGrayscale
/// \param image
/// \param outimage
/// \param radius
/// \param d
///
static void DilateGrayscale(mitk::Image::Pointer & image, unsigned int radius, mitk::CLUtil::MorphologicalDimensions d, mitk::Image::Pointer & outimage );
///
/// \brief FillHoleGrayscale
/// \param image
/// \param outimage
///
static void FillHoleGrayscale(mitk::Image::Pointer & image, mitk::Image::Pointer & outimage);
///
/// \brief ProbabilityMap
/// \param sourceImage
/// \param mean
/// \param std_dev
/// \param resultImage
///
static void ProbabilityMap(const mitk::Image::Pointer& sourceImage, double mean, double std_dev, mitk::Image::Pointer& resultImage);
template<class TImageType>
static void itkCountVoxel( TImageType * image, std::map<unsigned int, unsigned int> & map)
{
auto it = itk::ImageRegionIterator< TImageType >(image,image->GetLargestPossibleRegion());
while(!it.IsAtEnd())
{
if(map.find(it.Value()) == map.end())
map[it.Value()] = 0;
map[it.Value()]++;
++it;
}
}
template <class TImageType>
static void itkCountVoxel(TImageType* image, typename TImageType::PixelType label, unsigned int & count )
{
itk::ImageRegionConstIterator<TImageType> inputIter(image, image->GetLargestPossibleRegion());
while(!inputIter.IsAtEnd())
{
if(inputIter.Value() == label) ++count;
++inputIter;
}
}
template<typename TImageType>
static inline void itkCountVoxel(TImageType * mask, unsigned int & n_numSamples)
{
auto mit = itk::ImageRegionConstIterator<TImageType>(mask, mask->GetLargestPossibleRegion());
while (!mit.IsAtEnd())
{
if(mit.Value() > 0)
n_numSamples++;
++mit;
}
}
template <class TImageType1, class TImageType2>
static void itkSampleLabel(TImageType1* image, TImageType2* output, double acceptrate, unsigned int label)
{
std::srand (time(nullptr));
itk::ImageRegionConstIterator< TImageType1 > inputIter(image, image->GetLargestPossibleRegion());
itk::ImageRegionIterator< TImageType2 > outputIter(output, output->GetLargestPossibleRegion());
while (!inputIter.IsAtEnd())
{
double r = (double)(rand()) / RAND_MAX;
if(inputIter.Get() == label && r < acceptrate)
outputIter.Set(label);
++inputIter;
++outputIter;
}
}
template <class TImageType>
static void itkSampleLabel(TImageType* image, mitk::Image::Pointer & output, unsigned int n_samples_drawn)
{
std::srand (time(nullptr));
typename TImageType::Pointer itk_out = TImageType::New();
itk_out->SetRegions(image->GetLargestPossibleRegion());
itk_out->SetDirection(image->GetDirection());
itk_out->SetOrigin(image->GetOrigin());
itk_out->SetSpacing(image->GetSpacing());
itk_out->Allocate();
itk_out->FillBuffer(0);
itk::ImageRegionConstIterator< TImageType > inputIter(image, image->GetLargestPossibleRegion());
itk::ImageRegionIterator< TImageType > outputIter(itk_out, itk_out->GetLargestPossibleRegion());
for(unsigned int i = 0 ; i < n_samples_drawn ;)
{
double r = (double)(rand()) / RAND_MAX;
if(inputIter.Value() != 0 && r < 0.01 && outputIter.Value() == 0)
{
outputIter.Set(inputIter.Value());
i++;
}
++inputIter;
++outputIter;
if(inputIter.IsAtEnd())
{
inputIter.GoToBegin();
outputIter.GoToBegin();
}
}
mitk::CastToMitkImage(itk_out, output);
}
private:
template<class TImageType>
static void itkErodeGrayscale(TImageType * image, mitk::Image::Pointer & outimage , unsigned int radius, mitk::CLUtil::MorphologicalDimensions d);
template<class TImageType>
static void itkDilateGrayscale(TImageType * image, mitk::Image::Pointer & outimage , unsigned int radius, mitk::CLUtil::MorphologicalDimensions d);
template<class TImageType>
static void itkFillHoleGrayscale(TImageType * image, mitk::Image::Pointer & outimage);
template< typename TImageType >
static void itkInsertLabel(TImageType * maskImage, mitk::Image::Pointer & outimage, unsigned int label)
{
typename TImageType::Pointer itk_out;
if(outimage.IsNull()) // create if necessary
{
MITK_INFO << "Initialize new image";
itk_out = TImageType::New();
itk_out->SetSpacing(maskImage->GetSpacing());
itk_out->SetDirection(maskImage->GetDirection());
itk_out->SetOrigin(maskImage->GetOrigin());
itk_out->SetRegions(maskImage->GetLargestPossibleRegion());
itk_out->Allocate();
itk_out->FillBuffer(0);
}else
{
mitk::CastToItkImage(outimage, itk_out);
}
itk::ImageRegionIterator<TImageType> oit(itk_out,itk_out->GetLargestPossibleRegion());
itk::ImageRegionConstIterator<TImageType> mit(maskImage,maskImage->GetLargestPossibleRegion());
while(!mit.IsAtEnd())
{
if(mit.Value() != 0)
{
oit.Set(label);
}
++oit;
++mit;
}
mitk::CastToMitkImage(itk_out,outimage);
}
template< typename TImageType >
static void itkGrabLabel(TImageType * image, mitk::Image::Pointer & outimage, unsigned int label)
{
typedef itk::Image<unsigned short, 3> TOutType;
TOutType::Pointer itk_out = TOutType::New();
itk_out->SetRegions(image->GetLargestPossibleRegion());
itk_out->SetDirection(image->GetDirection());
itk_out->SetOrigin(image->GetOrigin());
itk_out->SetSpacing(image->GetSpacing());
itk_out->Allocate();
itk::ImageRegionConstIterator<TImageType> iit(image, image->GetLargestPossibleRegion());
itk::ImageRegionIterator<TOutType> oit(itk_out,itk_out->GetLargestPossibleRegion());
while(!iit.IsAtEnd())
{
if(iit.Value() == static_cast<typename TImageType::PixelType>(label))
oit.Set(1);
else
oit.Set(0);
++iit;
++oit;
}
mitk::CastToMitkImage(itk_out, outimage);
}
template<class TImagetype>
static void itkMergeLabels(TImagetype * img, const std::map<unsigned int, unsigned int> & map)
{
auto it = itk::ImageRegionIterator<TImagetype>(img,img->GetLargestPossibleRegion());
while(!it.IsAtEnd())
{
if(map.find(it.Value())!=map.end())
it.Set( map.at(it.Value()) );
++it;
}
}
template<typename TImageType>
static void itkConnectedComponentsImage(TImageType * image, mitk::Image::Pointer& mask, mitk::Image::Pointer &outimage, unsigned int& num_components)
{
typedef itk::Image<unsigned short, 3> MaskImageType;
MaskImageType::Pointer itk_mask;
if(mask.IsNull())
{
itk_mask = MaskImageType::New();
itk_mask->SetRegions(image->GetLargestPossibleRegion());
itk_mask->SetDirection(image->GetDirection());
itk_mask->SetOrigin(image->GetOrigin());
itk_mask->SetSpacing(image->GetSpacing());
itk_mask->Allocate();
itk_mask->FillBuffer(1);
}else{
mitk::CastToItkImage(mask,itk_mask);
}
typedef itk::ConnectedComponentImageFilter<TImageType, MaskImageType, MaskImageType > FilterType;
typename FilterType::Pointer cc_filter = FilterType::New();
cc_filter->SetMaskImage(itk_mask.GetPointer());
cc_filter->SetInput(image);
cc_filter->SetBackgroundValue(0);
cc_filter->Update();
num_components = cc_filter->GetObjectCount();
mitk::CastToMitkImage(cc_filter->GetOutput(), outimage);
}
template< typename TImageType >
static void itkCreateCheckerboardMask(TImageType * image, mitk::Image::Pointer & outimage);
template< typename TImageType >
static void itkInterpolateCheckerboardPrediction(TImageType * checkerboard_prediction, mitk::Image::Pointer & checkerboard_mask, mitk::Image::Pointer & outimage);
template <class TImageType>
static void itkSumVoxelForLabel(TImageType* image, const mitk::Image::Pointer & source , typename TImageType::PixelType label, double & val );
template <class TImageType>
static void itkSqSumVoxelForLabel(TImageType* image, const mitk::Image::Pointer & source, typename TImageType::PixelType label, double & val );
template<typename TStructuringElement>
static void itkFitStructuringElement(TStructuringElement & se, MorphologicalDimensions d, int radius);
template<typename TImageType>
static void itkDilateBinary(TImageType * sourceImage, mitk::Image::Pointer& resultImage, int radius , MorphologicalDimensions d);
template<typename TImageType>
static void itkErodeBinary(TImageType * sourceImage, mitk::Image::Pointer& resultImage, int radius, MorphologicalDimensions d);
template<typename TImageType>
static void itkClosingBinary(TImageType * sourceImage, mitk::Image::Pointer& resultImage, int radius, MorphologicalDimensions d);
template<typename TPixel, unsigned int VDimension>
static void itkFillHolesBinary(itk::Image<TPixel, VDimension>* sourceImage, mitk::Image::Pointer& resultImage);
template<typename TImageType>
static void itkLogicalAndImages(const TImageType * image1, const mitk::Image::Pointer & image2, mitk::Image::Pointer & outimage);
template<class TImageType>
static void itkGaussianFilter(TImageType * image, mitk::Image::Pointer & smoothed ,double sigma);
template<class TImageType>
static void itkDifferenceOfGaussianFilter(TImageType * image, mitk::Image::Pointer & smoothed, double sigma1, double sigma2);
template<typename TImageType>
static void itkProbabilityMap(const TImageType * sourceImage, double mean, double std_dev, mitk::Image::Pointer& resultImage);
template<typename TPixel, unsigned int VImageDimension>
static void itkHessianOfGaussianFilter(itk::Image<TPixel, VImageDimension>* itkImage, double variance, std::vector<mitk::Image::Pointer> &out);
template<typename TPixel, unsigned int VImageDimension>
static void itkLaplacianOfGaussianFilter(itk::Image<TPixel, VImageDimension>* itkImage, double variance, mitk::Image::Pointer &output);
template<typename TPixel, unsigned int VImageDimension>
static void itkLocalHistograms(itk::Image<TPixel, VImageDimension>* itkImage, std::vector<mitk::Image::Pointer> &out, int size, int bins);
};
} //namespace MITK
#endif
diff --git a/Modules/Classification/CLUtilities/include/mitkGIFCooccurenceMatrix2.h b/Modules/Classification/CLUtilities/include/mitkGIFCooccurenceMatrix2.h
index cdc333aca5..bb48f36667 100644
--- a/Modules/Classification/CLUtilities/include/mitkGIFCooccurenceMatrix2.h
+++ b/Modules/Classification/CLUtilities/include/mitkGIFCooccurenceMatrix2.h
@@ -1,162 +1,162 @@
/*============================================================================
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 mitkGIFCooccurenceMatrix2_h
#define mitkGIFCooccurenceMatrix2_h
#include <mitkAbstractGlobalImageFeature.h>
#include <mitkBaseData.h>
#include <MitkCLUtilitiesExports.h>
#include <Eigen/src/Core/Array.h>
namespace mitk
{
/**
* \brief Calculates features based on the co-occurence matrix.
*
* The co-occurence matrix describes the relations between voxels in a specific direction. The elements \f$m_{i,k} \f$ of the
* matrix count how often a voxel with the intensity \f$i \f$ has a neighbour in a certain direction with the intensity \f$ k \f$.
* The direction for each matrix is given by a directed vector \f$ \overrightarrow{d} \f$.
*
* It is important to calculate the matrices for all possible directions in order to obtain a rotation invariant feature.
* For the 3D case, this means that there are 26 possible directions. Using the symmetrical properties of the co-occurence
* matrix, it is then possible to calculate the features in all directions looking at 13 different directions.
*
* The standard length of the vector is 1, e.g. looking at direct neighbours. It is possible to look at more
* distance neighbours. This is achieved using the parameter <b>range</b> which defines the distance between
* two neighbouring voxels in number of voxels. The default value for this is 1. It can be changes using the Method
* SetRange() or by passing the option <b>cooc2::range</b>.
*
* There are two possible ways of combining the information obtained from the multiple directions. The first option
* is to calculate a common matrix for all directions and then use this matrix to calculate the describing features.
* The second method is to calculate a matrix for each direction, obtain the features and then report the mean and
* standard value of these features. Both mehtods are calcuated by this filters and reported, distinguisehd by either
* an "Overall" if a single matrix is used, a "Mean" for the mean Value, or an "Std.Dev." for the standard deviation.
*
* The connected areas are based on the binned image, the binning parameters can be set via the default
* parameters as described in AbstractGlobalImageFeature. The intensity used for the calculation is
* always equal to the bin number. It is also possible to determine the
* dimensionality of the neighbourhood using direction-related commands as described in AbstractGlobalImageFeature.
* No other options are possible beside these two options.
*
* This feature calculator is activated by the option <b>-cooccurence2</b> or <b>-cooc2</b>.
*
* The features are calculated based on a mask. It is assumed that the mask is
* of the type of an unsigned short image. All voxels with the value 1 are treated as masked.
*
* The following features are defined. We always give the notation for the overall matrix feature
- * although those for the mean and std.dev. are basically equal. In the name, <Range> is replace
+ * although those for the mean and std.dev. are basically equal. In the name, \<Range\> is replace
* by the distance of the neighbours. For the definitions of the feature, the probability of each
* intensity pair (i,k) \f$ p_{i,k} = \frac{m_{i,k}}{\sum_i \sum_k m_{i,k}} \f$.
*
* In addition, the marginal sum \f$ p_{i,\cdot} = p_{\cdot,k=i} = \sum_k p_{i,k} \f$, which is
* identical for both axis due to the symetrical nature of the matrix. Furthermore, the diagonal and
* cross diagnoal features are used:
* \f[ p_{i-k}(l) = \sum_i \sum_k p_{i,k} \delta(l - \| i -k \| ) \enspace \enspace l = 0, \dots, N_g -1 \f]
* \f[ p_{i+k}(l) = \sum_i \sum_k p_{i,k} \delta(l - ( i + k ) ) \enspace \enspace l = 2, \dots, 2 N_g \f]
* Here, \f$ \delta(x) \f$ is the dirac function, which is one for \f$x=0 \f$ and zero otherwise.
- * - <b>Co-occurenced Based Features (<Range>)::Overall Joint Maximum</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Joint Maximum</b>:
* \f[ \textup{Joint Maximum}= \textup{max}(p_{i,k}) \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Joint Average</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Joint Average</b>:
* \f[ \textup{Joint Average} = \mu_{ja} = \sum_i \sum_k i p_{i,k} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Joint Variance</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Joint Variance</b>:
* \f[ \textup{Joint Variance} = \sum_i \sum_k (i - \mu_{ja})^2 p_{i,k} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Joint Entropy</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Joint Entropy</b>:
* \f[ \textup{Joint Entropy} = e_j = - \sum_i \sum_k p_{i,k} \textup{log}_2 p_{i,k} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Row Maximum</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Row Maximum</b>:
* \f[ \textup{Row Maximum}= \textup{max}(p_{i,\cdot}) \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Row Average</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Row Average</b>:
* \f[ \textup{Row Average} = \mu_{ra} = \sum_i i p_{i,\cdot} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Row Variance</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Row Variance</b>:
* \f[ \textup{Row Variance} = \sigma^2_{i, \cdot} = \sum_i (i - \mu_{ra})^2 p_{i,\cdot} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Row Entropy</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Row Entropy</b>:
* \f[ \textup{Row Entropy} = e_r = - \sum_i p_{i,\cdot} \textup{log}_2 p_{i,\cdot} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall First Row-Column Entropy</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall First Row-Column Entropy</b>:
* \f[ \textup{First Row-Column Entropy} = e_1 = - \sum_i \sum_k p_{i,k} \textup{log}_2 ( p_{i,\cdot} p_{\cdot,k}) \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Second Row-Column Entropy</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Second Row-Column Entropy</b>:
* \f[ \textup{Second Row-Column Entropy} = e_2 = - \sum_i \sum_k p_{i,\cdot} p_{\cdot,k} \textup{log}_2 ( p_{i,\cdot} p_{\cdot,k}) \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Difference Average</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Difference Average</b>:
* \f[ \textup{Difference Average} = \mu_{da} = \sum_l l p_{i-k}(l) \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Difference Variance</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Difference Variance</b>:
* \f[ \textup{Difference Variance} = \sum_l (i - \mu_{da})^2 p_{i-k}(l) \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Difference Entropy</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Difference Entropy</b>:
* \f[ \textup{Difference Entropy} = - \sum_l p_{i-k}(l) \textup{log}_2 p_{i-k}(l) \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Sum Average</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Sum Average</b>:
* \f[ \textup{Sum Average} = \mu_{sa} = \sum_l l p_{i+k}(l) \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Sum Variance</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Sum Variance</b>:
* \f[ \textup{Sum Variance} = \sum_l (i - \mu_{sa})^2 p_{i+k}(l) \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Sum Entropy</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Sum Entropy</b>:
* \f[ \textup{Sum Entropy} = - \sum_l p_{i+k}(l) \textup{log}_2 p_{i+k}(l) \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Angular Second Moment</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Angular Second Moment</b>:
* \f[ \textup{Angular Second Moment} = \sum_i \sum_k p^2_{i,k} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Contrast</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Contrast</b>:
* \f[ \textup{Contrast} = \sum_i \sum_k (i-k)^2 p_{i,k} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Dissimilarity</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Dissimilarity</b>:
* \f[ \textup{Dissimilarity} = \sum_i \sum_k \| i-k\| p^2_{i,k} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Inverse Difference</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Inverse Difference</b>:
* \f[ \textup{Inverse Difference} = \sum_i \sum_k \frac{p_{i,k}}{1+\| i-k\|} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Inverse Difference Normalized</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Inverse Difference Normalized</b>:
* \f[ \textup{Inverse Difference Normalized} = \sum_i \sum_k \frac{p_{i,k}}{1+\frac{\| i-k\|}{N_g}} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Inverse Difference Moment</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Inverse Difference Moment</b>:
* \f[ \textup{Inverse Difference Moment} = \sum_i \sum_k \frac{p_{i,k}}{1+ ( i-k )^2} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Inverse Difference Moment Normalized</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Inverse Difference Moment Normalized</b>:
* \f[ \textup{Inverse Difference Moment Normalized} = \sum_i \sum_k \frac{p_{i,k}}{1+\frac{( i-k ) ^2}{N_g}} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Inverse Variance</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Inverse Variance</b>:
* \f[ \textup{Inverse Difference Moment Normalized} = \sum_i \sum_k \frac{p_{i,k}}{(i-k)^2} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Correlation</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Correlation</b>:
* \f[ \textup{Correlation} = \frac{1}{\sigma^2_{i,\cdot}} \sum_i \sum_k (i - \mu_{ra})(k - \mu_{ra}) p_{i,k} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Autocorrelation</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Autocorrelation</b>:
* \f[ \textup{Autocorrelation} = \sum_i \sum_k i k p_{i,k} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Cluster Tendency</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Cluster Tendency</b>:
* \f[ \textup{Cluster Tendency} = \sum_i \sum_k (i + k - 2\mu_{ra})^2 p_{i,k} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Cluster Shade</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Cluster Shade</b>:
* \f[ \textup{Cluster Shade} = \sum_i \sum_k (i + k - 2\mu_{ra})^3 p_{i,k} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Cluster Prominence</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Cluster Prominence</b>:
* \f[ \textup{Cluster Prominence} = \sum_i \sum_k (i + k - 2\mu_{ra})^4 p_{i,k} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall First Measure of Information Correlation</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall First Measure of Information Correlation</b>:
* \f[ \textup{First Measure of Information Correlation} = \frac{ e_j- e_1}{e_r} \f]
- * - <b>Co-occurenced Based Features (<Range>)::Overall Second Measure of Information Correlation</b>:
+ * - <b>Co-occurenced Based Features (\<Range\>)::%Overall Second Measure of Information Correlation</b>:
* \f[ \textup{Second Measure of Information Correlation} = \sqrt{1- \exp(-2 (e_2 - e_j)} \f]
*/
class MITKCLUTILITIES_EXPORT GIFCooccurenceMatrix2 : public AbstractGlobalImageFeature
{
public:
mitkClassMacro(GIFCooccurenceMatrix2, AbstractGlobalImageFeature);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
GIFCooccurenceMatrix2();
FeatureListType CalculateFeatures(const Image* image, const Image* mask, const Image* maskNoNAN) override;
using Superclass::CalculateFeatures;
itkGetConstMacro(Ranges, std::vector<double>);
void SetRanges(std::vector<double> ranges);
void SetRange(double range);
void AddArguments(mitkCommandLineParser& parser) const override;
protected:
std::string GenerateLegacyFeatureEncoding(const FeatureID& id) const override;
FeatureListType DoCalculateFeatures(const Image* image, const Image* mask) override;
void ConfigureSettingsByParameters(const ParametersType& parameters) override;
private:
std::vector<double> m_Ranges;
};
}
#endif //mitkGIFCooccurenceMatrix2_h
diff --git a/Modules/Classification/CLUtilities/include/mitkGIFCurvatureStatistic.h b/Modules/Classification/CLUtilities/include/mitkGIFCurvatureStatistic.h
index d2e8b022cc..302f452775 100644
--- a/Modules/Classification/CLUtilities/include/mitkGIFCurvatureStatistic.h
+++ b/Modules/Classification/CLUtilities/include/mitkGIFCurvatureStatistic.h
@@ -1,98 +1,98 @@
/*============================================================================
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 mitkGIFCurvatureStatistic_h
#define mitkGIFCurvatureStatistic_h
#include <mitkAbstractGlobalImageFeature.h>
#include <mitkBaseData.h>
#include <MitkCLUtilitiesExports.h>
namespace mitk
{
/**
* \brief Calculates features based on the co-occurence matrix.
*
* The Curvature is a measure for the bending of a surface and is therefore a measure for the description of the
* surface of an segmentation.
*
* THe curvature is calculated for each point of the surface of the given object and then a combined measure is
* produced. It measures the divergence of the orientation of an curve from the
* tangent of the curve. There are multiple ways to calculate the Curvature:
*
* <b> Gaussian Curvature</b>: The discrete gaussian curvature (K) is computed as \f$K(\textup{Corner Point v}) = 2 * \pi - \sum_{\textup{Neighoubring Voxel Surfaces f of v}} (\textup{Angle}_f \textup{at} v) \f$.
* <b> Mean Curvature</b>:The mean curvature (H) is computed as \f$H(\textup{Corner Point v}) = \textup{average over edges e neighbouring v of H(e)} \f$.
* with \f$H(edge e) = length(e)*dihedral_angle(e)\f$
* <b>Maximum</b> (\f$k_max\f$) and <b>Minimum</b> (\f$k_min\f$) Principal Curvatures
* \f$k_max = H + sqrt(H^2 - K)\f$
* \f$k_min = H - sqrt(H^2 - K)\f$
* Excepting spherical and planar surfaces which have equal principal curvatures,
* the curvature at a point on a surface varies with the direction one "sets off"
* from the point. For all directions, the curvature will pass through two extrema:
* a minimum (\f$k_min\f$) and a maximum (\f$k_max\f$) which occur at mutually orthogonal
* directions to each other.
*
* This method does not take any parameters.
*
* This feature calculator is activated by the option <b>-curvature</b> or <b>-cur</b>.
*
* The features are calculated based on a mask, which is converted into a mesh.
*
* The following features are defined. All features are calculated for all four possible
* curvation calculation methods (Gaussian, Mean, Minimum, Maximum). The principal way
- * of calculating these features is the same, the used curvation is indicated by <name> in the
+ * of calculating these features is the same, the used curvation is indicated by \<name\> in the
* feature name:
*
- * - <b>Curvature Feature::Minimum <name> Curvature</b>:
+ * - <b>Curvature Feature::Minimum \<name\> Curvature</b>:
* The minimum curvature for the whole given mask
- * - <b>Curvature Feature::Maximum <name> Curvature</b>:
+ * - <b>Curvature Feature::Maximum \<name\> Curvature</b>:
* The maximum curvature for the whole given mask
- * - <b>Curvature Feature::Mean <name> Curvature</b>:
+ * - <b>Curvature Feature::Mean \<name\> Curvature</b>:
* The mean curvature for the whole given mask
- * - <b>Curvature Feature::Standard Deviation <name> Curvature</b>:
+ * - <b>Curvature Feature::Standard Deviation \<name\> Curvature</b>:
* The standard deviation curvature for the whole given mask
- * - <b>Curvature Feature::Skewness <name> Curvature</b>:
+ * - <b>Curvature Feature::Skewness \<name\> Curvature</b>:
* The skewness curvature for the whole given mask
- * - <b>Curvature Feature::Mean Positive <name> Curvature</b>:
+ * - <b>Curvature Feature::Mean Positive \<name\> Curvature</b>:
* The mean curvature of all positive curvatures from the whole given mask
- * - <b>Curvature Feature::Standard Deviation Positive <name> Curvature</b>:
+ * - <b>Curvature Feature::Standard Deviation Positive \<name\> Curvature</b>:
* The Standard Deviation curvature of all positive curvatures from the whole given mask
- * - <b>Curvature Feature::Skewness Positive <name> Curvature</b>:
+ * - <b>Curvature Feature::Skewness Positive \<name\> Curvature</b>:
* The Skewness curvature of all positive curvatures from the whole given mask
- * - <b>Curvature Feature::Mean Negative <name> Curvature</b>:
+ * - <b>Curvature Feature::Mean Negative \<name\> Curvature</b>:
* The mean curvature of all Negative curvatures from the whole given mask
- * - <b>Curvature Feature::Standard Deviation Negative <name> Curvature</b>:
+ * - <b>Curvature Feature::Standard Deviation Negative \<name\> Curvature</b>:
* The Standard Deviation curvature of all Negative curvatures from the whole given mask
- * - <b>Curvature Feature::Skewness Negative <name> Curvature</b>:
+ * - <b>Curvature Feature::Skewness Negative \<name\> Curvature</b>:
* The Skewness curvature of all Negative curvatures from the whole given mask
*/
class MITKCLUTILITIES_EXPORT GIFCurvatureStatistic : public AbstractGlobalImageFeature
{
public:
mitkClassMacro(GIFCurvatureStatistic,AbstractGlobalImageFeature);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
GIFCurvatureStatistic();
FeatureListType CalculateFeatures(const Image* image, const Image* mask, const Image* maskNoNAN) override;
using Superclass::CalculateFeatures;
void AddArguments(mitkCommandLineParser &parser) const override;
protected:
FeatureListType DoCalculateFeatures(const Image* image, const Image* mask) override;
};
}
#endif //mitkGIFCurvatureStatistic_h
diff --git a/Modules/Classification/DataCollection/DataHolder/mitkDataCollection.h b/Modules/Classification/DataCollection/DataHolder/mitkDataCollection.h
index 19620e97a9..ec35e2b844 100644
--- a/Modules/Classification/DataCollection/DataHolder/mitkDataCollection.h
+++ b/Modules/Classification/DataCollection/DataHolder/mitkDataCollection.h
@@ -1,287 +1,286 @@
/*============================================================================
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.
============================================================================*/
#ifdef _MSC_VER
# pragma warning (disable : 4996)
#endif
#ifndef mitkDataCollection_H_
#define mitkDataCollection_H_
//#include <itkLightObject.h>
//#include <itkDataObject.h>
//#include "itkObjectFactory.h"
//#include "mitkCommon.h"
#include <mitkImage.h>
#include <mitkDataNode.h>
#include<mitkBaseData.h>
#include <MitkDataCollectionExports.h>
/**
* \brief DataCollection - Class to facilitate loading/accessing structured data
*
* Data is grouped into a collection that may contain further (sub) collections or images.
*
* Exemplary structure
*
* Collection (e.g. Patient)
* |
* |-- Sub-Collection1 (e.g. follow-up 1)
* | |
* | |-- DataItem (e.g. T1)
* | |-- DataItem (e.g. T2)
* |
* |-- Sub-Collection2 (e.g. follow-up 2)
* | |
* | |-- DataItem (e.g. T1)
* | |-- DataItem (e.g. T2)
*
*/
namespace mitk
{
class MITKDATACOLLECTION_EXPORT DataCollection : public BaseData
{
public:
mitkClassMacro(DataCollection, BaseData);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
// Needed methods from Basedata
void UpdateOutputInformation() override;
void SetRequestedRegionToLargestPossibleRegion() override;
bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
bool VerifyRequestedRegion() override;
void SetRequestedRegion(const itk::DataObject *) override;
void Init(std::string name);
/**
* @brief AddData Add a data item
* @param data Images/Fibers/DataCollections
* @param name name that allows identifying this data (e.g. a category T2, Segmentation , etc ...)
- * @param description
+ * @param filePath
* @return
*/
-
size_t AddData(DataObject::Pointer data, std::string name, std::string filePath = "");
/**
* @brief SetName - Sets name of DataCollection
* @param name
*/
void SetName(std::string name);
std::string GetName() const;
std::string GetDataFilePath(size_t index) const;
/**
* @brief NameToIndex - Get index from data item name
* @param name
* @return
*/
size_t NameToIndex(std::string name);
/**
* @brief IndexToName - Get name from index
* @param index
* @return
*/
std::string IndexToName(size_t index) const;
/**
* @brief HasElement - check if element with this name exists in collection
* @param name
* @return
*/
bool HasElement(std::string name);
/**
* @brief HasElement - check if element with this index exists in collection
* @param index
* @return
*/
bool HasElement(size_t index);
/**
* @brief Size - number of data items in collection
* @return
*/
size_t Size() const;
/**
* @brief SetData - set/update data item by index
* @param data
* @param index
*/
void SetData(itk::DataObject::Pointer data, size_t index);
/**
* @brief SetData - set/update data item by name
* @param data
* @param name
*/
void SetData(itk::DataObject::Pointer data, std::string name);
/**
* @brief GetData Get original data by index
*
- * To ensure a mitk::Image is returned use \ref mitk::GetMitkImage
+ * To ensure a mitk::Image is returned use GetMitkImage
*
* @param index
* @return
*/
itk::DataObject::Pointer GetData(size_t index);
/**
* @brief GetData Get original data by name
*
- * To ensure a mitk::Image is returned use \ref mitk::GetMitkImage
+ * To ensure a mitk::Image is returned use GetMitkImage
*
* @param name
* @return
*/
itk::DataObject::Pointer GetData(std::string name);
/**
* @brief GetMitkImage - casts data to mitk::Image and returns it
*
* \note returns nullptr is object is no mitk::Image or itk::Image
*
* @param index
* @return
*/
mitk::Image::Pointer GetMitkImage(size_t index);
/**
* @brief GetMitkImage - casts data to mitk::Image and returns it
*
* \note returns nullptr is object is no mitk::Image or itk::Image
*
* @param name
* @return
*/
mitk::Image::Pointer GetMitkImage(std::string name);
/**
* @brief GetMitkImage - casts data to privided itk::Image pointer
*/
template <class ImageType>
ImageType GetItkImage(size_t index, ImageType* itkImage);
/**
* @brief GetMitkImage - casts data to privided itk::Image pointer
*/
template <class ImageType>
ImageType GetItkImage(std::string name, ImageType* itkImage);
itk::DataObject::Pointer& operator[](size_t index);
itk::DataObject::Pointer& operator[](std::string &name);
/**
* @brief SetNameForIndex - sets name for given data item by index
* @param index
* @param name
*/
void SetNameForIndex(size_t index, std::string &name);
/**
* @brief SetXMLFile - sets xml file to which data collection is saved
*/
void SetXMLFile(std::string absoluteXMlFile);
/**
* @brief SetXMLFile - gets xml file to which data collection is supposed to be saved
*/
std::string GetXMLFile();
/**
* @brief SetParent - sets the parent collection
* @param parent
*/
void SetParent(mitk::DataCollection* parent);
/**
* @brief GetParent - returns the parent collection if available else null is returned
* @return
*/
mitk::DataCollection* GetParent();
/**
* @brief RemoveIndex - removes element at index
* @param index
* @return
*/
bool RemoveIndex(size_t index);
/**
* @brief RemoveElement - removes element with name
* @param name
* @return
*/
bool RemoveElement(std::string& name);
/**
* @brief Clear - clears the data collection
*/
void Clear() override;
/**
* @brief GetDataNode - returns data node containing data at index
* @param index
* @return
*/
mitk::DataNode::Pointer GetDataNode(size_t index);
/**
* @brief GetDataNode - returns data node containing data with name
* @param name
* @return
*/
mitk::DataNode::Pointer GetDataNode(std::string name);
/**
* @brief GetProbabilityMap - returns vectorimage generated out of images with names in the probabilityNamesVector
* @param probabilityNamesVector
* @return
*/
mitk::Image::Pointer GetProbabilityMap(std::vector<std::string> probabilityNamesVector);
protected:
DataCollection();
~DataCollection() override;
private:
// DATA
std::string m_Name;
std::vector<itk::DataObject::Pointer> m_DataVector;
std::vector<std::string> m_NameVector;
std::vector<std::string> m_FilePathVector;
std::map<std::string, size_t> m_DataNames;
mitk::DataCollection * m_Parent;
std::string m_XMLFile; // is only filled for the hightest layer when loading a data collection
};
} // end namespace
#endif
diff --git a/Modules/Classification/documentation/UserManual/mitkClassificationMiniAppsPortalPage.dox b/Modules/Classification/documentation/UserManual/mitkClassificationMiniAppsPortalPage.dox
index 2f8f90c12c..32778b37b1 100644
--- a/Modules/Classification/documentation/UserManual/mitkClassificationMiniAppsPortalPage.dox
+++ b/Modules/Classification/documentation/UserManual/mitkClassificationMiniAppsPortalPage.dox
@@ -1,19 +1,19 @@
/**
\page mitkClassificationMiniAppsPortalPage MITK Classification Mini Apps
\tableofcontents
-The Classification Mini Apps bundle the functionality that is commonly neeeded for the processing and learning with medical images. As all other MiniApps, they follow the <a href="http://www.slicer.org/slicerWiki/index.php/Slicer3:Execution_Model_Documentation">Slicer Execution Model</a> in describing themselves via xml. You can simply obtain a description by calling the MiniApp without any parameter. If the MiniApp is calles with the option "--xml" a XML description of all possible parameter is added.
+The Classification Mini Apps bundle the functionality that is commonly neeeded for the processing and learning with medical images. As all other MiniApps, they follow the <a href="https://www.slicer.org/slicerWiki/index.php/Slicer3:Execution_Model_Documentation">Slicer Execution Model</a> in describing themselves via xml. You can simply obtain a description by calling the MiniApp without any parameter. If the MiniApp is calles with the option "--xml" a XML description of all possible parameter is added.
\section mcmasec1 Description of Mini Apps
\subsection mcmasub1 mitkCLGLobalImageFeatures
Allows to calculate features that describe the masked area. Can be used to obtain radiomics features.
\subsection mcmasub2 mitkCLN4
Allows to calculate a bias normalization.
\subsection mcmasub3 mitkCLStaple
Allows to combine multiple segmentations into a single segmentation using the STAPLE algorithm
*/
diff --git a/Modules/CommandLine/include/mitkCommandLineParser.h b/Modules/CommandLine/include/mitkCommandLineParser.h
index f5c1418d5e..ddba149101 100644
--- a/Modules/CommandLine/include/mitkCommandLineParser.h
+++ b/Modules/CommandLine/include/mitkCommandLineParser.h
@@ -1,389 +1,392 @@
/*============================================================================
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.
============================================================================*/
/*=========================================================================
Library: CTK
Copyright (c) Kitware Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.txt
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
=========================================================================*/
#ifndef __mitkCommandLineParser_h
#define __mitkCommandLineParser_h
#include <map>
#include <usAny.h>
#include <MitkCommandLineExports.h>
#include <mitkVersion.h>
/**
*
* The MITK command line parser, based on the CTK command line parser.
*
* Use this class to add information about the command line arguments
* your program understands and to easily parse them from a given list
* of strings.
*
* This parser provides the following features:
*
* <ul>
* <li>Add arguments by supplying a long name and/or a short name.
* Arguments are validated using a regular expression. They can have
* a default value and a help string.</li>
* <li>Deprecated arguments.</li>
* <li>Custom regular expressions for argument validation.</li>
* <li>Set different argument name prefixes for native platform look and feel.</li>
* <li>Create a help text for the command line arguments with support for
* grouping arguments.</li>
* </ul>
*
* The main difference between the MITK command line parser and the CTK command line
* parser is that the former does not depend on Qt. Apart from that an image type was
* added and XML output improved for automatic GUI generation.
*
* std::out is used for output to keep dependencies to a minimum.
*/
class MITKCOMMANDLINE_EXPORT mitkCommandLineParser
{
public:
enum Type
{
String = 0,
Bool = 1,
StringList = 2,
Int = 3,
Float = 4,
Directory = 5,
File = 6,
Image = 7
};
enum Channel
{
None = 0,
Input = 1,
Output = 2
};
typedef std::vector<std::string> StringContainerType;
mitkCommandLineParser();
~mitkCommandLineParser();
/**
* Parse a given list of command line arguments.
*
* This method parses a list of string elements considering the known arguments
* added by calls to <code>addArgument()</code>. If any one of the argument
* values does not match the corresponding regular expression,
* <code>ok</code> is set to false and an empty map object is returned.
*
* The keys in the returned map object correspond to the long argument string,
* if it is not empty. Otherwise, the short argument string is used as key. The
* us::Any values can safely be converted to the type specified in the
* <code>addArgument()</code> method call.
*
* @param arguments A StringContainerType containing command line arguments.
* @param ok A pointer to a boolean variable. Will be set to <code>true</code>
* if all regular expressions matched, <code>false</code> otherwise.
* @return A map object mapping the long argument (if empty, the short one)
* to a us::Any containing the value.
*/
std::map<std::string, us::Any> parseArguments(const StringContainerType &arguments, bool *ok = nullptr);
/**
* Convenient method allowing to parse a given list of command line arguments.
* @see parseArguments(const StringContainerType &, bool*)
*/
std::map<std::string, us::Any> parseArguments(int argc, char **argv, bool *ok = nullptr);
/**
* Returns a detailed error description if a call to <code>parseArguments()</code>
* failed.
*
* @return The error description, empty if no error occured.
* @see parseArguments(const StringContainerType&, bool*)
*/
std::string errorString() const;
/**
* This method returns all unparsed arguments, i.e. all arguments
* for which no long or short name has been registered via a call
* to <code>addArgument()</code>.
*
* @see addArgument()
*
* @return A list containing unparsed arguments.
*/
const StringContainerType &unparsedArguments() const;
/**
* Checks if the given argument has been added via a call
* to <code>addArgument()</code>.
*
* @see addArgument()
*
* @param argument The argument to be checked.
* @return <code>true</code> if the argument was added, <code>false</code>
* otherwise.
*/
bool argumentAdded(const std::string &argument) const;
/**
* Checks if the given argument has been parsed successfully by a previous
* call to <code>parseArguments()</code>.
*
* @param argument The argument to be checked.
* @return <code>true</code> if the argument was parsed, <code>false</code>
* otherwise.
*/
bool argumentParsed(const std::string &argument) const;
/**
* Adds a command line argument. An argument can have a long name
* (like --long-argument-name), a short name (like -l), or both. The type
* of the argument can be specified by using the <code>type</code> parameter.
* The following types are supported:
*
* <table>
* <tr><td><b>Type</b></td><td><b># of parameters</b></td><td><b>Default regular expr</b></td>
* <td><b>Example</b></td></tr>
* <tr><td>us::Any::String</td><td>1</td><td>.*</td><td>--test-string StringParameter</td></tr>
* <tr><td>us::Any::Bool</td><td>0</td><td>does not apply</td><td>--enable-something</td></tr>
* <tr><td>us::Any::StringList</td><td>-1</td><td>.*</td><td>--test-list string1 string2</td></tr>
* <tr><td>us::Any::Int</td><td>1</td><td>-?[0-9]+</td><td>--test-int -5</td></tr>
* </table>
*
* The regular expressions are used to validate the parameters of command line
* arguments. You can restrict the valid set of parameters by calling
* <code>setExactMatchRegularExpression()</code> for your argument.
*
* Optionally, a help string and a default value can be provided for the argument. If
* the us::Any type of the default value does not match <code>type</code>, an
* exception is thrown. Arguments with default values are always returned by
* <code>parseArguments()</code>.
*
* You can also declare an argument deprecated, by setting <code>deprecated</code>
* to <code>true</code>. Alternatively you can add a deprecated argument by calling
* <code>addDeprecatedArgument()</code>.
*
* If the long or short argument has already been added, or if both are empty strings,
* the method call has no effect.
*
* @param longarg The long argument name.
* @param shortarg The short argument name.
* @param type The argument type (see the list above for supported types).
* @param argLabel The label of this argument, when auto generated interface is used.
* @param argHelp A help string describing the argument.
* @param defaultValue A default value for the argument.
+ * @param optional
* @param ignoreRest All arguments after the current one will be ignored.
* @param deprecated Declares the argument deprecated.
+ * @param channel
*
* @see setExactMatchRegularExpression()
* @see addDeprecatedArgument()
* @throws std::logic_error If the us::Any type of <code>defaultValue</code>
* does not match <code>type</code>, a <code>std::logic_error</code> is thrown.
*/
void addArgument(const std::string &longarg,
const std::string &shortarg,
Type type,
const std::string &argLabel,
const std::string &argHelp = std::string(),
const us::Any &defaultValue = us::Any(),
bool optional = true,
bool ignoreRest = false,
bool deprecated = false,
mitkCommandLineParser::Channel channel = mitkCommandLineParser::Channel::None);
/**
* Adds a deprecated command line argument. If a deprecated argument is provided
* on the command line, <code>argHelp</code> is displayed in the console and
* processing continues with the next argument.
*
* Deprecated arguments are grouped separately at the end of the help text
* returned by <code>helpText()</code>.
*
* @param longarg The long argument name.
* @param shortarg The short argument name.
+ * @param argLabel
* @param argHelp A help string describing alternatives to the deprecated argument.
*/
void addDeprecatedArgument(const std::string &longarg,
const std::string &shortarg,
const std::string &argLabel,
const std::string &argHelp);
/**
* Returns the vector of current Command line Parameter
*
*/
std::vector < std::map<std::string, us::Any> > getArgumentList();
/**
* Sets a custom regular expression for validating argument parameters. The method
* <code>errorString()</code> can be used the get the last error description.
*
* @param argument The previously added long or short argument name.
* @param expression A regular expression which the arugment parameters must match.
* @param exactMatchFailedMessage An error message explaining why the parameter did
* not match.
*
* @return <code>true</code> if the argument was found and the regular expression was set,
* <code>false</code> otherwise.
*
* @see errorString()
*/
bool setExactMatchRegularExpression(const std::string &argument,
const std::string &expression,
const std::string &exactMatchFailedMessage);
/**
* The field width for the argument names without the help text.
*
* @return The argument names field width in the help text.
*/
std::string::size_type fieldWidth() const;
/**
* Creates a help text containing properly formatted argument names and help strings
* provided by calls to <code>addArgument()</code>. The arguments can be grouped by
* using <code>beginGroup()</code> and <code>endGroup()</code>.
*
* @param charPad The padding character.
* @return The formatted help text.
*/
std::string helpText() const;
/**
* Sets the argument prefix for long and short argument names. This can be used
* to create native command line arguments without changing the calls to
* <code>addArgument()</code>. For example on Unix-based systems, long argument
* names start with "--" and short names with "-", while on Windows argument names
* always start with "/".
*
* Note that all methods in mitkCommandLineParser which take an argument name
* expect the name as it was supplied to <code>addArgument</code>.
*
* Example usage:
*
* \code
* ctkCommandLineParser parser;
* parser.setArgumentPrefix("--", "-");
* parser.addArgument("long-argument", "l", us::Any::String);
* StringContainerType args;
* args << "program name" << "--long-argument Hi";
* parser.parseArguments(args);
* \endcode
*
* @param longPrefix The prefix for long argument names.
* @param shortPrefix The prefix for short argument names.
*/
void setArgumentPrefix(const std::string &longPrefix, const std::string &shortPrefix);
/**
* Begins a new group for documenting arguments. All newly added arguments via
* <code>addArgument()</code> will be put in the new group. You can close the
* current group by calling <code>endGroup()</code> or be opening a new group.
*
* Note that groups cannot be nested and all arguments which do not belong to
* a group will be listed at the top of the text created by <code>helpText()</code>.
*
* @param description The description of the group
*/
void beginGroup(const std::string &description);
/**
* Ends the current group.
*
* @see beginGroup(const std::string&)
*/
void endGroup();
/**
* Can be used to teach the parser to stop parsing the arguments and return False when
* an unknown argument is encountered. By default <code>StrictMode</code> is disabled.
*
* @see parseArguments(const StringContainerType &, bool*)
*/
void setStrictModeEnabled(bool strictMode);
/**
* Is used to generate an XML output for any commandline program.
*/
void generateXmlOutput();
/**
* Is used to set the title of the auto generated interface.
*
* @param title The title of the app.
*/
void setTitle(std::string title);
/**
* Is used to set the contributor for the help view in the auto generated interface.
*
* @param contributor Contributor of the app.
*/
void setContributor(std::string contributor);
/**
* Is used to categorize the apps in the commandline module.
*
* @param category The category of the app.
*/
void setCategory(std::string category);
/**
* Is used as the help text in the auto generated interface.
*
* @param description A short description for the app.
*/
void setDescription(std::string description);
/**
* Is used to group several Parameters in one groupbox in the auto generated interface.
* Default name is "Parameters", with the tooltip: "Groupbox containing parameters."
*
* To change the group of several arguments, call this method before the arguments are added.
*
* @param name The name of the groupbox.
* @param tooltip The tooltip of the groupbox.
*/
void changeParameterGroup(std::string name, std::string tooltip);
protected:
class ctkInternal;
ctkInternal *Internal;
std::string Title;
std::string Contributor;
std::string Category;
std::string Description;
std::string ParameterGroupName;
std::string ParameterGroupDescription;
};
#endif
diff --git a/Modules/ContourModel/Algorithms/mitkContourModelUtils.h b/Modules/ContourModel/Algorithms/mitkContourModelUtils.h
index 2c06664812..42c91c021e 100644
--- a/Modules/ContourModel/Algorithms/mitkContourModelUtils.h
+++ b/Modules/ContourModel/Algorithms/mitkContourModelUtils.h
@@ -1,91 +1,96 @@
/*============================================================================
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 <mitkContourModel.h>
#include <mitkImage.h>
#include <vtkSmartPointer.h>
#include <MitkContourModelExports.h>
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
\param correctionForIpSegmentation adds 0.5 to x and y index coordinates (difference between ipSegmentation and
MITK contours)
+ \param constrainToInside
*/
static ContourModel::Pointer ProjectContourTo2DSlice(Image *slice,
ContourModel *contourIn3D,
bool correctionForIpSegmentation,
bool constrainToInside);
/**
\brief Projects a slice index coordinates of a contour back into world coordinates.
+ \param sliceGeometry
+ \param contourIn2D
\param correctionForIpSegmentation subtracts 0.5 to x and y index coordinates (difference between ipSegmentation
and MITK contours)
*/
static ContourModel::Pointer BackProjectContourFrom2DSlice(const BaseGeometry *sliceGeometry,
ContourModel *contourIn2D,
bool correctionForIpSegmentation = false);
/**
\brief Fill a contour in a 2D slice with a specified pixel value at time step 0.
*/
static void FillContourInSlice(ContourModel *projectedContour,
Image *sliceImage,
mitk::Image::Pointer workingImage,
int paintingPixelValue = 1);
/**
\brief Fill a contour in a 2D slice with a specified pixel value at a given time step.
*/
static void FillContourInSlice(ContourModel *projectedContour,
unsigned int timeStep,
Image *sliceImage,
mitk::Image::Pointer workingImage,
int paintingPixelValue = 1);
/**
\brief Fills a image (filledImage) into another image (resultImage) by incorporating the rules of LabelSet-Images
*/
static void FillSliceInSlice(vtkSmartPointer<vtkImageData> filledImage,
vtkSmartPointer<vtkImageData> resultImage,
mitk::Image::Pointer image,
int paintingPixelValue);
/**
\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, unsigned int timeStep);
protected:
ContourModelUtils();
~ContourModelUtils() override;
};
}
#endif
diff --git a/Modules/ContourModel/CMakeLists.txt b/Modules/ContourModel/CMakeLists.txt
index b52388f2ec..98b2e63246 100644
--- a/Modules/ContourModel/CMakeLists.txt
+++ b/Modules/ContourModel/CMakeLists.txt
@@ -1,8 +1,8 @@
MITK_CREATE_MODULE(
INCLUDE_DIRS Algorithms DataManagement IO Rendering
DEPENDS MitkCore MitkSceneSerializationBase MitkLegacyGL MitkAnnotation MitkMultilabel
- PACKAGE_DEPENDS ITK|ITKReview
+ PACKAGE_DEPENDS PRIVATE ITK|ITKReview VTK|RenderingContext2D+RenderingContextOpenGL2
# AUTOLOAD_WITH MitkCore TODO: Create IO Submodule and autoload that one instead.
)
add_subdirectory(Testing)
diff --git a/Modules/ContourModel/DataManagement/mitkContourElement.h b/Modules/ContourModel/DataManagement/mitkContourElement.h
index ed4342255b..9191b72409 100644
--- a/Modules/ContourModel/DataManagement/mitkContourElement.h
+++ b/Modules/ContourModel/DataManagement/mitkContourElement.h
@@ -1,237 +1,237 @@
/*============================================================================
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 _mitkContourElement_H_
#define _mitkContourElement_H_
#include "mitkCommon.h"
#include <MitkContourModelExports.h>
#include <mitkNumericTypes.h>
//#include <ANN/ANN.h>
#include <deque>
namespace mitk
{
/** \brief Represents a contour in 3D space.
A ContourElement is consisting of linked vertices implicitely defining the contour.
They are stored in a double ended queue making it possible to add vertices at front and
end of the contour and to iterate in both directions.
To mark a vertex as a special one it can be set as a control point.
- \Note It is highly not recommend to use this class directly as no secure mechanism is used here.
+ \note It is highly not recommend to use this class directly as no secure mechanism is used here.
Use mitk::ContourModel instead providing some additional features.
*/
class MITKCONTOURMODEL_EXPORT ContourElement : public itk::LightObject
{
public:
mitkClassMacroItkParent(ContourElement, itk::LightObject);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
// Data container representing vertices
/** \brief Represents a single vertex of contour.
*/
struct ContourModelVertex
{
ContourModelVertex(mitk::Point3D &point, bool active = false) : IsControlPoint(active), Coordinates(point) {}
ContourModelVertex(const ContourModelVertex &other)
: IsControlPoint(other.IsControlPoint), Coordinates(other.Coordinates)
{
}
/** \brief Treat point special. */
bool IsControlPoint;
/** \brief Coordinates in 3D space. */
mitk::Point3D Coordinates;
};
// END Data container representing vertices
typedef ContourModelVertex VertexType;
typedef std::deque<VertexType *> VertexListType;
typedef VertexListType::iterator VertexIterator;
typedef VertexListType::const_iterator ConstVertexIterator;
// start of inline methods
/** \brief Return a const iterator a the front.
*/
virtual ConstVertexIterator ConstIteratorBegin() { return this->m_Vertices->begin(); }
/** \brief Return a const iterator a the end.
*/
virtual ConstVertexIterator ConstIteratorEnd() { return this->m_Vertices->end(); }
/** \brief Return an iterator a the front.
*/
virtual VertexIterator IteratorBegin() { return this->m_Vertices->begin(); }
/** \brief Return an iterator a the end.
*/
virtual VertexIterator IteratorEnd() { return this->m_Vertices->end(); }
/** \brief Returns the number of contained vertices.
*/
virtual int GetSize() { return this->m_Vertices->size(); }
// end of inline methods
/** \brief Add a vertex at the end of the contour
\param point - coordinates in 3D space.
\param isControlPoint - is the vertex a special control point.
*/
virtual void AddVertex(mitk::Point3D &point, bool isControlPoint);
/** \brief Add a vertex at the end of the contour
\param vertex - a contour element vertex.
*/
virtual void AddVertex(VertexType &vertex);
/** \brief Add a vertex at the front of the contour
\param point - coordinates in 3D space.
\param isControlPoint - is the vertex a control point.
*/
virtual void AddVertexAtFront(mitk::Point3D &point, bool isControlPoint);
/** \brief Add a vertex at the front of the contour
\param vertex - a contour element vertex.
*/
virtual void AddVertexAtFront(VertexType &vertex);
/** \brief Add a vertex at a given index of the contour
\param point - coordinates in 3D space.
\param isControlPoint - is the vertex a special control point.
\param index - the index to be inserted at.
*/
virtual void InsertVertexAtIndex(mitk::Point3D &point, bool isControlPoint, int index);
/** \brief Set coordinates a given index.
\param pointId Index of vertex.
\param point Coordinates.
*/
virtual void SetVertexAt(int pointId, const mitk::Point3D &point);
/** \brief Set vertex a given index.
\param pointId Index of vertex.
\param vertex Vertex.
*/
virtual void SetVertexAt(int pointId, const VertexType *vertex);
/** \brief Returns the vertex a given index
\param index
*/
virtual VertexType *GetVertexAt(int index);
/** \brief Returns the approximate nearest vertex a given posoition in 3D space
\param point - query position in 3D space.
\param eps - the error bound for search algorithm.
*/
virtual VertexType *GetVertexAt(const mitk::Point3D &point, float eps);
/** \brief Returns the index of the given vertex within the contour.
\param vertex - the vertex to be searched.
\return index of vertex. -1 if not found.
*/
virtual int GetIndex(const VertexType *vertex);
/** \brief Returns the container of the vertices.
*/
VertexListType *GetVertexList();
/** \brief Returns whether the contour element is empty.
*/
bool IsEmpty();
/** \brief Returns if the conour is closed or not.
*/
virtual bool IsClosed();
/** \brief Returns whether a given point is near a contour, according to eps.
\param point - query position in 3D space.
\param eps - the error bound for search algorithm.
*/
virtual bool IsNearContour(const mitk::Point3D &point, float eps);
/** \brief Close the contour.
Connect first with last element.
*/
virtual void Close();
/** \brief Open the contour.
Disconnect first and last element.
*/
virtual void Open();
/** \brief Set the contours IsClosed property.
\param isClosed - true = closed; false = open;
*/
virtual void SetClosed(bool isClosed);
/** \brief Concatenate the contuor with a another contour.
All vertices of the other contour will be added after last vertex.
\param other - the other contour
\param check - set it true to avoid intersections
*/
void Concatenate(mitk::ContourElement *other, bool check);
/** \brief Remove the given vertex from the container if exists.
\param vertex - the vertex to be removed.
*/
virtual bool RemoveVertex(const VertexType *vertex);
/** \brief Remove a vertex at given index within the container if exists.
\param index - the index where the vertex should be removed.
*/
virtual bool RemoveVertexAt(int index);
/** \brief Remove the approximate nearest vertex at given position in 3D space if one exists.
\param point - query point in 3D space.
\param eps - error bound for search algorithm.
*/
virtual bool RemoveVertexAt(mitk::Point3D &point, float eps);
/** \brief Clear the storage container.
*/
virtual void Clear();
/** \brief Returns the approximate nearest vertex a given posoition in 3D space
\param point - query position in 3D space.
\param eps - the error bound for search algorithm.
*/
VertexType *BruteForceGetVertexAt(const mitk::Point3D &point, float eps);
/** \brief Returns the approximate nearest vertex a given posoition in 3D space
\param point - query position in 3D space.
\param eps - the error bound for search algorithm.
*/
// VertexType* OptimizedGetVertexAt(const mitk::Point3D &point, float eps);
VertexListType *GetControlVertices();
/** \brief Uniformly redistribute control points with a given period (in number of vertices)
\param vertex - the vertex around which the redistribution is done.
\param period - number of vertices between control points.
*/
void RedistributeControlVertices(const VertexType *vertex, int period);
protected:
mitkCloneMacro(Self);
ContourElement();
ContourElement(const mitk::ContourElement &other);
~ContourElement() override;
VertexListType *m_Vertices; // double ended queue with vertices
bool m_IsClosed;
};
} // namespace mitk
#endif // _mitkContourElement_H_
diff --git a/Modules/ContourModel/DataManagement/mitkContourModel.h b/Modules/ContourModel/DataManagement/mitkContourModel.h
index 3620737c86..45aae9bcda 100644
--- a/Modules/ContourModel/DataManagement/mitkContourModel.h
+++ b/Modules/ContourModel/DataManagement/mitkContourModel.h
@@ -1,452 +1,453 @@
/*============================================================================
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 _MITK_CONTOURMODEL_H_
#define _MITK_CONTOURMODEL_H_
#include "mitkBaseData.h"
#include "mitkCommon.h"
#include <MitkContourModelExports.h>
#include <mitkContourElement.h>
namespace mitk
{
/**
\brief ContourModel is a structure of linked vertices defining a contour in 3D space.
The vertices are stored in a mitk::ContourElement is stored for each timestep.
The contour line segments are implicitly defined by the given linked vertices.
By default two control points are are linked by a straight line.It is possible to add
vertices at front and end of the contour and to iterate in both directions.
Points are specified containing coordinates and additional (data) information,
see mitk::ContourElement.
For accessing a specific vertex either an index or a position in 3D Space can be used.
The vertices are best accessed by using a VertexIterator.
Interaction with the contour is thus available without any mitk interactor class using the
api of ContourModel. It is possible to shift single vertices also as shifting the whole
contour.
A contour can be either open like a single curved line segment or
closed. A closed contour can for example represent a jordan curve.
\section mitkContourModelDisplayOptions Display Options
The default mappers for this data structure are mitk::ContourModelGLMapper2D and
mitk::ContourModelMapper3D. See these classes for display options which can
can be set via properties.
*/
class MITKCONTOURMODEL_EXPORT ContourModel : public BaseData
{
public:
mitkClassMacro(ContourModel, BaseData);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/*+++++++++++++++ typedefs +++++++++++++++++++++++++++++++*/
typedef mitk::ContourElement::VertexType VertexType;
typedef mitk::ContourElement::VertexListType VertexListType;
typedef mitk::ContourElement::VertexIterator VertexIterator;
typedef mitk::ContourElement::ConstVertexIterator ConstVertexIterator;
typedef std::vector<mitk::ContourElement::Pointer> ContourModelSeries;
/*+++++++++++++++ END typedefs ++++++++++++++++++++++++++++*/
/** \brief Possible interpolation of the line segments between control points */
enum LineSegmentInterpolation
{
LINEAR,
B_SPLINE
};
/*++++++++++++++++ inline methods +++++++++++++++++++++++*/
/** \brief Get the current selected vertex.
*/
VertexType *GetSelectedVertex() { return this->m_SelectedVertex; }
/** \brief Deselect vertex.
*/
void Deselect() { this->m_SelectedVertex = nullptr; }
/** \brief Set selected vertex as control point
*/
void SetSelectedVertexAsControlPoint(bool isControlPoint = true)
{
if (this->m_SelectedVertex)
{
m_SelectedVertex->IsControlPoint = isControlPoint;
this->Modified();
}
}
/** \brief Set the interpolation of the line segments between control points.
*/
void SetLineSegmentInterpolation(LineSegmentInterpolation interpolation)
{
this->m_lineInterpolation = interpolation;
this->Modified();
}
/** \brief Get the interpolation of the line segments between control points.
*/
LineSegmentInterpolation GetLineSegmentInterpolation() { return this->m_lineInterpolation; }
/*++++++++++++++++ END inline methods +++++++++++++++++++++++*/
/** \brief Add a vertex to the contour at given timestep.
The vertex is added at the end of contour.
\param vertex - coordinate representation of a control point
\param timestep - the timestep at which the vertex will be add ( default 0)
- @Note Adding a vertex to a timestep which exceeds the timebounds of the contour
+ @note Adding a vertex to a timestep which exceeds the timebounds of the contour
will not be added, the TimeGeometry will not be expanded.
*/
void AddVertex(mitk::Point3D &vertex, int timestep = 0);
/** \brief Add a vertex to the contour at given timestep.
The vertex is added at the end of contour.
\param vertex - coordinate representation of a control point
\param timestep - the timestep at which the vertex will be add ( default 0)
- @Note Adding a vertex to a timestep which exceeds the timebounds of the contour
+ @note Adding a vertex to a timestep which exceeds the timebounds of the contour
will not be added, the TimeGeometry will not be expanded.
*/
void AddVertex(VertexType &vertex, int timestep = 0);
/** \brief Add a vertex to the contour at given timestep.
The vertex is added at the end of contour.
\param vertex - coordinate representation of a control point
\param timestep - the timestep at which the vertex will be add ( default 0)
- @Note Adding a vertex to a timestep which exceeds the timebounds of the contour
+ @note Adding a vertex to a timestep which exceeds the timebounds of the contour
will not be added, the TimeSlicedGeometry will not be expanded.
*/
void AddVertex(const VertexType *vertex, int timestep = 0);
/** \brief Add a vertex to the contour.
\param vertex - coordinate representation of a control point
\param timestep - the timestep at which the vertex will be add ( default 0)
\param isControlPoint - specifies the vertex to be handled in a special way (e.g. control points
will be rendered).
- @Note Adding a vertex to a timestep which exceeds the timebounds of the contour
+ @note Adding a vertex to a timestep which exceeds the timebounds of the contour
will not be added, the TimeGeometry will not be expanded.
*/
void AddVertex(mitk::Point3D &vertex, bool isControlPoint, int timestep = 0);
/** \brief Add a vertex to the contour at given timestep AT THE FRONT of the contour.
The vertex is added at the FRONT of contour.
\param vertex - coordinate representation of a control point
\param timestep - the timestep at which the vertex will be add ( default 0)
- @Note Adding a vertex to a timestep which exceeds the timebounds of the contour
+ @note Adding a vertex to a timestep which exceeds the timebounds of the contour
will not be added, the TimeGeometry will not be expanded.
*/
void AddVertexAtFront(mitk::Point3D &vertex, int timestep = 0);
/** \brief Add a vertex to the contour at given timestep AT THE FRONT of the contour.
The vertex is added at the FRONT of contour.
\param vertex - coordinate representation of a control point
\param timestep - the timestep at which the vertex will be add ( default 0)
- @Note Adding a vertex to a timestep which exceeds the timebounds of the contour
+ @note Adding a vertex to a timestep which exceeds the timebounds of the contour
will not be added, the TimeGeometry will not be expanded.
*/
void AddVertexAtFront(VertexType &vertex, int timestep = 0);
/** \brief Add a vertex to the contour at given timestep AT THE FRONT of the contour.
\param vertex - coordinate representation of a control point
\param timestep - the timestep at which the vertex will be add ( default 0)
\param isControlPoint - specifies the vertex to be handled in a special way (e.g. control points
will be rendered).
- @Note Adding a vertex to a timestep which exceeds the timebounds of the contour
+ @note Adding a vertex to a timestep which exceeds the timebounds of the contour
will not be added, the TimeGeometry will not be expanded.
*/
void AddVertexAtFront(mitk::Point3D &vertex, bool isControlPoint, int timestep = 0);
/** \brief Insert a vertex at given index.
*/
void InsertVertexAtIndex(mitk::Point3D &vertex, int index, bool isControlPoint = false, int timestep = 0);
/** \brief Set a coordinates for point at given index.
*/
bool SetVertexAt(int pointId, const mitk::Point3D &point, unsigned int timestep = 0);
/** \brief Set a coordinates for point at given index.
*/
bool SetVertexAt(int pointId, const VertexType *vertex, unsigned int timestep = 0);
/** \brief Return if the contour is closed or not.
*/
bool IsClosed(int timestep = 0) const;
/** \brief Concatenate two contours.
The starting control point of the other will be added at the end of the contour.
- \pararm timestep - the timestep at which the vertex will be add ( default 0)
- \pararm check - check for intersections ( default false)
+ \param other
+ \param timestep - the timestep at which the vertex will be add ( default 0)
+ \param check - check for intersections ( default false)
*/
void Concatenate(mitk::ContourModel *other, int timestep = 0, bool check = false);
/** \brief Returns a const VertexIterator at the start element of the contour.
@throw mitk::Exception if the timestep is invalid.
*/
VertexIterator Begin(int timestep = 0) const;
/** \brief Returns a const VertexIterator at the start element of the contour.
@throw mitk::Exception if the timestep is invalid.
*/
VertexIterator IteratorBegin(int timestep = 0) const;
/** \brief Returns a const VertexIterator at the end element of the contour.
@throw mitk::Exception if the timestep is invalid.
*/
VertexIterator End(int timestep = 0) const;
/** \brief Returns a const VertexIterator at the end element of the contour.
@throw mitk::Exception if the timestep is invalid.
*/
VertexIterator IteratorEnd(int timestep = 0) const;
/** \brief Close the contour.
The last control point will be linked with the first point.
*/
virtual void Close(int timestep = 0);
/** \brief Set isClosed to false contour.
The link between the last control point the first point will be removed.
*/
virtual void Open(int timestep = 0);
/** \brief Set closed property to given boolean.
false - The link between the last control point the first point will be removed.
true - The last control point will be linked with the first point.
*/
virtual void SetClosed(bool isClosed, int timestep = 0);
/** \brief Returns the number of vertices at a given timestep.
\param timestep - default = 0
*/
int GetNumberOfVertices(int timestep = 0) const;
/** \brief Returns whether the contour model is empty at a given timestep.
- \pararm timestep - default = 0
+ \param timestep - default = 0
*/
virtual bool IsEmpty(int timestep) const;
/** \brief Returns whether the contour model is empty.
*/
bool IsEmpty() const override;
/** \brief Returns the vertex at the index position within the container.
*/
virtual const VertexType *GetVertexAt(int index, int timestep = 0) const;
/** \brief Remove a vertex at given timestep within the container.
\return index of vertex. -1 if not found.
*/
int GetIndex(const VertexType *vertex, int timestep = 0);
/** \brief Check if there isn't something at this timestep.
*/
bool IsEmptyTimeStep(unsigned int t) const override;
/** \brief Check if mouse cursor is near the contour.
*/
virtual bool IsNearContour(mitk::Point3D &point, float eps, int timestep);
/** \brief Mark a vertex at an index in the container as selected.
*/
bool SelectVertexAt(int index, int timestep = 0);
/** \brief Mark a vertex at an index in the container as control point.
*/
bool SetControlVertexAt(int index, int timestep = 0);
/** \brief Mark a vertex at a given position in 3D space.
\param point - query point in 3D space
\param eps - radius for nearest neighbour search (error bound).
\param timestep - search at this timestep
@return true = vertex found; false = no vertex found
*/
bool SelectVertexAt(mitk::Point3D &point, float eps, int timestep = 0);
/*
\pararm point - query point in 3D space
\pararm eps - radius for nearest neighbour search (error bound).
\pararm timestep - search at this timestep
@return true = vertex found; false = no vertex found
*/
bool SetControlVertexAt(mitk::Point3D &point, float eps, int timestep = 0);
/** \brief Remove a vertex at given index within the container.
@return true = the vertex was successfuly removed; false = wrong index.
*/
bool RemoveVertexAt(int index, int timestep = 0);
/** \brief Remove a vertex at given timestep within the container.
@return true = the vertex was successfuly removed.
*/
bool RemoveVertex(const VertexType *vertex, int timestep = 0);
/** \brief Remove a vertex at a query position in 3D space.
The vertex to be removed will be search by nearest neighbour search.
Note that possibly no vertex at this position and eps is stored inside
the contour.
@return true = the vertex was successfuly removed; false = no vertex found.
*/
bool RemoveVertexAt(mitk::Point3D &point, float eps, int timestep = 0);
/** \brief Shift the currently selected vertex by a translation vector.
\param translate - the translation vector.
*/
void ShiftSelectedVertex(mitk::Vector3D &translate);
/** \brief Shift the whole contour by a translation vector at given timestep.
\param translate - the translation vector.
\param timestep - at this timestep the contour will be shifted.
*/
void ShiftContour(mitk::Vector3D &translate, int timestep = 0);
/** \brief Clear the storage container at given timestep.
All control points are removed at
timestep.
*/
virtual void Clear(int timestep);
/** \brief Initialize all data objects
*/
void Initialize() override;
/** \brief Initialize object with specs of other contour.
Note: No data will be copied.
*/
void Initialize(mitk::ContourModel &other);
/*++++++++++++++++++ method inherit from base data +++++++++++++++++++++++++++*/
/**
\brief Inherit from base data - no region support available for contourModel objects.
*/
void SetRequestedRegionToLargestPossibleRegion() override;
/**
\brief Inherit from base data - no region support available for contourModel objects.
*/
bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
/**
\brief Inherit from base data - no region support available for contourModel objects.
*/
bool VerifyRequestedRegion() override;
/**
\brief Get the updated geometry with recomputed bounds.
*/
virtual const mitk::BaseGeometry *GetUpdatedGeometry(int t = 0);
/**
\brief Get the BaseGeometry for timestep t.
*/
virtual mitk::BaseGeometry *GetGeometry(int t = 0) const;
/**
\brief Inherit from base data - no region support available for contourModel objects.
*/
void SetRequestedRegion(const itk::DataObject *data) override;
/**
\brief Expand the timebounds of the TimeGeometry to given number of timesteps.
*/
void Expand(unsigned int timeSteps) override;
/**
\brief Update the OutputInformation of a ContourModel object
The BoundingBox of the contour will be updated, if necessary.
*/
void UpdateOutputInformation() override;
/**
\brief Clear the storage container.
The object is set to initial state. All control points are removed and the number of
timesteps are set to 1.
*/
void Clear() override;
/**
\brief overwrite if the Data can be called by an Interactor (StateMachine).
*/
void ExecuteOperation(Operation *operation) override;
/** \brief Redistributes ontrol vertices with a given period (as number of vertices)
\param period - the number of vertices between control points.
\param timestep - at this timestep all lines will be rebuilt.
*/
virtual void RedistributeControlVertices(int period, int timestep);
protected:
mitkCloneMacro(Self);
ContourModel();
ContourModel(const mitk::ContourModel &other);
~ContourModel() override;
// inherit from BaseData. called by Clear()
void ClearData() override;
// inherit from BaseData. Initial state of a contour with no vertices and a single timestep.
void InitializeEmpty() override;
// Shift a vertex
void ShiftVertex(VertexType *vertex, mitk::Vector3D &vector);
// Storage with time resolved support.
ContourModelSeries m_ContourSeries;
// The currently selected vertex.
VertexType *m_SelectedVertex;
// The interpolation of the line segment between control points.
LineSegmentInterpolation m_lineInterpolation;
// only update the bounding geometry if necessary
bool m_UpdateBoundingBox;
};
itkEventMacro(ContourModelEvent, itk::AnyEvent);
itkEventMacro(ContourModelShiftEvent, ContourModelEvent);
itkEventMacro(ContourModelSizeChangeEvent, ContourModelEvent);
itkEventMacro(ContourModelAddEvent, ContourModelSizeChangeEvent);
itkEventMacro(ContourModelRemoveEvent, ContourModelSizeChangeEvent);
itkEventMacro(ContourModelExpandTimeBoundsEvent, ContourModelEvent);
itkEventMacro(ContourModelClosedEvent, ContourModelEvent);
}
#endif
diff --git a/Modules/ContourModel/DataManagement/mitkContourModelSet.h b/Modules/ContourModel/DataManagement/mitkContourModelSet.h
index d23664374e..e98b8ccdf2 100644
--- a/Modules/ContourModel/DataManagement/mitkContourModelSet.h
+++ b/Modules/ContourModel/DataManagement/mitkContourModelSet.h
@@ -1,120 +1,120 @@
/*============================================================================
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 _mitkContourModelSet_H_
#define _mitkContourModelSet_H_
#include "mitkCommon.h"
#include <MitkContourModelExports.h>
#include "mitkContourModel.h"
#include <deque>
namespace mitk
{
/** \brief
*/
class MITKCONTOURMODEL_EXPORT ContourModelSet : public mitk::BaseData
{
public:
mitkClassMacro(ContourModelSet, mitk::BaseData);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
typedef std::deque<mitk::ContourModel::Pointer> ContourModelListType;
typedef ContourModelListType::iterator ContourModelSetIterator;
// start of inline methods
/** \brief Return an iterator a the front.
*/
virtual ContourModelSetIterator Begin() { return this->m_Contours.begin(); }
/** \brief Return an iterator a the front.
*/
virtual ContourModelSetIterator End() { return this->m_Contours.end(); }
/** \brief Returns the number of contained contours.
*/
virtual int GetSize() const { return this->m_Contours.size(); }
// end of inline methods
/** \brief Add a ContourModel to the container.
*/
virtual void AddContourModel(mitk::ContourModel &contourModel);
/** \brief Add a ContourModel to the container.
*/
virtual void AddContourModel(mitk::ContourModel::Pointer contourModel);
/** \brief Returns the ContourModel a given index
\param index
*/
virtual mitk::ContourModel *GetContourModelAt(int index) const;
/** \brief Returns the container of the contours.
*/
ContourModelListType *GetContourModelList();
/** \brief Returns a bool whether the container is empty or not.
*/
bool IsEmpty() const override;
/** \brief Remove the given ContourModel from the container if exists.
- \param ContourModel - the ContourModel to be removed.
+ \param contourModel - the ContourModel to be removed.
*/
virtual bool RemoveContourModel(mitk::ContourModel *contourModel);
/** \brief Remove a ContourModel at given index within the container if exists.
\param index - the index where the ContourModel should be removed.
*/
virtual bool RemoveContourModelAt(int index);
/** \brief Clear the storage container.
*/
void Clear() override;
//////////////// inherit from mitk::BaseData ////////////////////
/* NO support for regions ! */
void SetRequestedRegionToLargestPossibleRegion() override {}
bool RequestedRegionIsOutsideOfTheBufferedRegion() override { return false; }
bool VerifyRequestedRegion() override { return true; }
void SetRequestedRegion(const itk::DataObject *) override {}
/**
\brief Update the OutputInformation of a ContourModel object
The BoundingBox of the contour will be updated, if necessary.
*/
void UpdateOutputInformation() override;
//////////////// END inherit from mitk::BaseData ////////////////////
protected:
mitkCloneMacro(Self);
ContourModelSet();
ContourModelSet(const mitk::ContourModelSet &other);
~ContourModelSet() override;
// inherit from BaseData. Initial state with no contours and a single timestep.
void InitializeEmpty() override;
ContourModelListType m_Contours;
// only update the bounding geometry if necessary
bool m_UpdateBoundingBox;
};
} // namespace mitk
#endif // _mitkContourModelSet_H_
diff --git a/Modules/ContourModel/IO/mitkContourModelWriter.h b/Modules/ContourModel/IO/mitkContourModelWriter.h
index aa0190b395..e338c4eee8 100644
--- a/Modules/ContourModel/IO/mitkContourModelWriter.h
+++ b/Modules/ContourModel/IO/mitkContourModelWriter.h
@@ -1,169 +1,169 @@
/*============================================================================
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 _MITK_CONTOURMODEL_WRITER__H_
#define _MITK_CONTOURMODEL_WRITER__H_
#include <mitkAbstractFileWriter.h>
#include <mitkContourModel.h>
// DEPRECATED
#include <mitkTimeGeometry.h>
namespace mitk
{
/**
* @brief XML-based writer for mitk::ContourModels
*
* XML-based writer for mitk::ContourModels. Multiple ContourModels can be written in
* a single XML file by simply setting multiple inputs to the filter.
*
* The xml file will look like:
*
* <?xml version="1.0" encoding="utf-8"?>
* <contourModel>
* <head>
* <geometryInfo>
* </geometryInfo>
* </head>
* <data>
* <timestep n="0">
* <controlPoints>
* <point>
* <x></x>
* <y></y>
* <z></z>
* </point>
* </controlPoint>
* </timestep>
* </data>
* </contourModel>
*
* @ingroup MitkContourModelModule
*/
class TimeSlicedGeometry;
class ContourModelWriter : public mitk::AbstractFileWriter
{
public:
ContourModelWriter();
~ContourModelWriter() override;
using AbstractFileWriter::Write;
void Write() override;
protected:
ContourModelWriter(const ContourModelWriter &other);
mitk::ContourModelWriter *Clone() const override;
/**
* Converts an arbitrary type to a string. The type has to
* support the << operator. This works fine at least for integral
* data types as float, int, long etc.
* @param value the value to convert
* @returns the string representation of value
*/
template <typename T>
std::string ConvertToString(T value);
/**
* Writes an XML representation of the given point set to
* an outstream. The XML-Header an root node is not included!
* @param contourModel the point set to be converted to xml
* @param out the stream to write to.
*/
void WriteXML(const mitk::ContourModel *contourModel, std::ostream &out);
/**
* Writes the geometry information of the TimeGeometry to an outstream.
* The root tag is not included.
* @param geometry the TimeGeometry of the contour.
- * @param the stream to write to.
+ * @param out the stream to write to.
*/
void WriteGeometryInformation(const mitk::TimeGeometry *geometry, std::ostream &out);
/**
* Writes the geometry information of the TimeGeometry to an outstream.
* The root tag is not included.
* @param geometry the TimeGeometry of the contour.
- * @param the stream to write to.
+ * @param out the stream to write to.
*
* \deprecatedSince{2013_09} Please use TimeGeometry instead of TimeSlicedGeometry. For more information see
* http://www.mitk.org/Development/Refactoring%20of%20the%20Geometry%20Classes%20-%20Part%201
*/
DEPRECATED(void WriteGeometryInformation(const mitk::TimeSlicedGeometry *geometry, std::ostream &out));
/**
* Writes an standard xml header to the given stream.
* @param file the stream in which the header is written.
*/
void WriteXMLHeader(std::ostream &file);
/** Write a start element tag */
void WriteStartElement(const char *const tag, std::ostream &file);
void WriteStartElementWithAttribut(const char *const tag,
std::vector<std::string> attributes,
std::vector<std::string> values,
std::ostream &file);
/**
* Write an end element tag
* End-Elements following character data should pass indent = false.
*/
void WriteEndElement(const char *const tag, std::ostream &file, const bool &indent = true);
/** Write character data inside a tag. */
void WriteCharacterData(const char *const data, std::ostream &file);
/** Write a start element tag */
void WriteStartElement(std::string &tag, std::ostream &file);
/** Write an end element tag */
void WriteEndElement(std::string &tag, std::ostream &file, const bool &indent = true);
/** Write character data inside a tag. */
void WriteCharacterData(std::string &data, std::ostream &file);
/** Writes empty spaces to the stream according to m_IndentDepth and m_Indent */
void WriteIndent(std::ostream &file);
unsigned int m_IndentDepth;
unsigned int m_Indent;
public:
static const char *XML_CONTOURMODEL;
static const char *XML_HEAD;
static const char *XML_GEOMETRY_INFO;
static const char *XML_DATA;
static const char *XML_TIME_STEP;
static const char *XML_CONTROL_POINTS;
static const char *XML_POINT;
static const char *XML_X;
static const char *XML_Y;
static const char *XML_Z;
};
}
#endif
diff --git a/Modules/Core/CMakeLists.txt b/Modules/Core/CMakeLists.txt
index 9443972b06..40e19fd8b4 100644
--- a/Modules/Core/CMakeLists.txt
+++ b/Modules/Core/CMakeLists.txt
@@ -1,65 +1,65 @@
set(TOOL_CPPS "")
# temporary suppress warnings in the following files until image accessors are fully integrated.
set_source_files_properties( src/DataManagement/mitkImage.cpp COMPILE_FLAGS -DMITK_NO_DEPRECATED_WARNINGS )
set_source_files_properties( src/Controllers/mitkSliceNavigationController.cpp COMPILE_FLAGS -DMITK_NO_DEPRECATED_WARNINGS )
MITK_CREATE_MODULE(
INCLUDE_DIRS
PUBLIC ${MITK_BINARY_DIR}
PRIVATE src/Algorithms src/Controllers src/DataManagement src/Interactions src/IO src/Rendering ${OPENGL_INCLUDE_DIR}
DEPENDS PUBLIC mbilog CppMicroServices
PACKAGE_DEPENDS
PRIVATE tinyxml OpenGL
PUBLIC ITK|ITKTransform+ITKImageGrid+ITKImageFeature+ITKIOImageBase+ITKIOHDF5+ITKIOLSM+ITKIOMRC+ITKIOBioRad+ITKIOGE+ITKIOStimulate+ITKIOBruker+ITKIOMINC
# We privately use/link all ITK modules in order to support all IO, Transform, etc.
# factories from ITK which are registered "automatically" via a factory manager.
PRIVATE ITK
- PUBLIC VTK|vtkFiltersTexture+vtkFiltersParallel+vtkImagingStencil+vtkImagingMath+vtkInteractionStyle+vtkRenderingOpenGL2+vtkRenderingContextOpenGL2+vtkRenderingVolumeOpenGL2+vtkRenderingFreeType+vtkRenderingLabel+vtkInteractionWidgets+vtkIOGeometry+vtkIOXML
+ PUBLIC VTK|FiltersTexture+FiltersParallel+ImagingStencil+ImagingMath+InteractionStyle+RenderingOpenGL2+RenderingVolumeOpenGL2+RenderingFreeType+RenderingLabel+InteractionWidgets+IOGeometry+IOXML
PUBLIC Boost|boost
# Do not automatically create CppMicroServices initialization code.
# Because the VTK 6 "auto-init" functionality injects file-local static
# initialization code in every cpp file which includes a VTK header,
# static initialization order becomes an issue again. For the Mitk
# core library, we need to ensure that the VTK static initialization stuff
# happens before the CppMicroServices initialization, since the latter
# might already use VTK code which needs to access VTK object factories.
# Hence, CppMicroServices initialization code is placed manually within
# the mitkCoreActivator.cpp file.
NO_INIT
)
if(NOT TARGET ${MODULE_TARGET})
message(SEND_ERROR "Core target ${MODULE_TARGET} does not exist")
endif()
function(_itk_create_factory_register_manager)
# In MITK_ITK_Config.cmake, we do *not* include ITK_USE_FILE, which
# prevents multiple registrations/unregistrations of ITK IO factories
# during library loading/unloading (of MITK libraries). However, we need
# "one" place where the IO factories are registered at
# least once. This could be the application executable, but every executable would
# need to take care of that itself. Instead, we allow the auto registration in the
# Mitk Core library.
set(NO_DIRECTORY_SCOPED_ITK_COMPILE_DEFINITION 1)
find_package(ITK)
include(${ITK_USE_FILE})
if(NOT ITK_NO_IO_FACTORY_REGISTER_MANAGER)
# We manually add the define which will be of target scope. MITK
# patches ITK_USE_FILE to remove the directory scoped compile
# definition since it would be propagated to other targets in the
# same directory scope but these targets might want to *not*
# use the ITK factory manager stuff.
target_compile_definitions(${MODULE_TARGET} PRIVATE ITK_IO_FACTORY_REGISTER_MANAGER)
endif()
endfunction()
_itk_create_factory_register_manager()
if(MSVC_IDE OR MSVC_VERSION)
target_link_libraries(${MODULE_TARGET} PRIVATE psapi.lib)
endif()
if(BUILD_TESTING)
add_subdirectory(TestingHelper)
add_subdirectory(test)
endif()
diff --git a/Modules/Core/TestingHelper/CMakeLists.txt b/Modules/Core/TestingHelper/CMakeLists.txt
index a94c4819e3..c1d32c6cfd 100644
--- a/Modules/Core/TestingHelper/CMakeLists.txt
+++ b/Modules/Core/TestingHelper/CMakeLists.txt
@@ -1,7 +1,7 @@
mitk_create_module(
DEPENDS PUBLIC MitkCore
PACKAGE_DEPENDS
PUBLIC CppUnit
- PRIVATE VTK|vtkTestingRendering tinyxml OpenGL
+ PRIVATE VTK|IOImage+TestingRendering tinyxml OpenGL
)
diff --git a/Modules/Core/TestingHelper/include/mitkRenderingTestHelper.h b/Modules/Core/TestingHelper/include/mitkRenderingTestHelper.h
index 070a3d87d9..ff0ccf657b 100644
--- a/Modules/Core/TestingHelper/include/mitkRenderingTestHelper.h
+++ b/Modules/Core/TestingHelper/include/mitkRenderingTestHelper.h
@@ -1,212 +1,215 @@
/*============================================================================
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 mitkRenderingTestHelper_h
#define mitkRenderingTestHelper_h
#include <mitkDataStorage.h>
#include <mitkRenderWindow.h>
#include <vtkSmartPointer.h>
#include <MitkTestingHelperExports.h>
#include <mitkIOUtil.h>
class vtkRenderWindow;
class vtkRenderer;
namespace mitk
{
class MITKTESTINGHELPER_EXPORT RenderingTestHelper
{
public:
/** @brief Generate a rendering test helper object including a render window of the size width * height (in pixel).
+ @param width
+ @param height
@param argc Number of parameters. (here: Images) "Usage: [filename1 filenam2 -V referenceScreenshot
(optional -T /directory/to/save/differenceImage)]
@param argv Given parameters. If no data is inserted via commandline, you can add data
later via AddNodeToDataStorage().
- @param renderingMode The rendering mode.
+ @param antiAliasing The anti-aliasing mode.
**/
RenderingTestHelper(
int width,
int height,
int argc,
char *argv[],
AntiAliasing antiAliasing = AntiAliasing::None);
/** @brief Generate a rendering test helper object including a render window of the size width * height (in
* pixel).*/
RenderingTestHelper(
int width,
int height,
AntiAliasing antiAliasing = AntiAliasing::None);
/** Default destructor */
~RenderingTestHelper();
/** @brief Getter for the vtkRenderer.
**/
vtkRenderer *GetVtkRenderer();
/** @brief Getter for the vtkRenderWindow which should be used to call vtkRegressionTestImage.
**/
vtkRenderWindow *GetVtkRenderWindow();
/** @brief Method can be used to save a screenshot (e.g. reference screenshot as a .png file.
@param fileName The filename of the new screenshot (including path).
**/
void SaveAsPNG(std::string fileName);
/**
* @brief SetStopRenderWindow Convenience method to make the renderwindow hold after rendering. Usefull for
* debugging.
- * @param flag Flag indicating whether the renderwindow should automatically close (false, default) or stay open
+ * @param automaticallyCloseRenderWindow Flag indicating whether the renderwindow should automatically close (false, default) or stay open
* (true). Usefull for debugging.
*/
void SetAutomaticallyCloseRenderWindow(bool automaticallyCloseRenderWindow);
/** @brief This method set the property of the member datastorage
+ @param propertyKey
@param property Set a property for each image in the datastorage m_DataStorage. If you want
to set the property for a single data node, use GetDataStorage() and set the property
yourself for the destinct node.
**/
void SetImageProperty(const char *propertyKey, mitk::BaseProperty *property);
/** @brief Set the view direction of the renderwindow (e.g. sagittal, coronal, axial)
**/
void SetViewDirection(mitk::SliceNavigationController::ViewDirection viewDirection);
/** @brief Reorient the slice (e.g. rotation and translation like the swivel mode).
**/
void ReorientSlices(mitk::Point3D origin, mitk::Vector3D rotation);
/** @brief Render everything into an mitkRenderWindow. Call SetViewDirection() and SetProperty() before this method.
**/
void Render();
/** @brief Returns the datastorage, in order to modify the data inside a rendering test.
**/
mitk::DataStorage::Pointer GetDataStorage();
/**
* @brief SetMapperID Change between Standard2D and 3D mappers.
* @param id Enum mitk::BaseRenderer::StandardMapperSlot which defines the mapper.
*/
void SetMapperID(mitk::BaseRenderer::StandardMapperSlot id);
/**
* @brief AddNodeToStorage Add a node to the datastorage and perform a reinit which is necessary for rendering.
* @param node The data you want to add.
*/
void AddNodeToStorage(mitk::DataNode::Pointer node);
/**
* @brief SetMapperIDToRender3D Convenience method to render in a 3D renderwindow.
* @warning Does not add helper objects like the image planes to render images in 3D.
*/
void SetMapperIDToRender3D();
/**
* @brief SetMapperIDToRender2D Convenience method to render in a 2D renderwindow.
*/
void SetMapperIDToRender2D();
/**
* @brief SaveReferenceScreenShot Convenience method to save a reference screen shot.
* @param fileName Path/to/save/the/png/file.
*/
void SaveReferenceScreenShot(std::string fileName);
/**
* @brief CompareRenderWindowAgainstReference Convenience method to compare the image rendered in the internal
renderwindow against a reference screen shot.
*
Usage of vtkTesting::Test:
vtkTesting::Test( argc, argv, vtkRenderWindow, threshold )
Set a vtkRenderWindow containing the desired scene. This is automatically rendered.
vtkTesting::Test() automatically searches in argc and argv[]
for a path a valid image with -V. If the test failed with the
first image (foo.png) it checks if there are images of the form
foo_N.png (where N=1,2,3...) and compare against them. This allows for multiple
valid images.
* @param argc Number of arguments.
* @param argv Arguments must(!) contain the term "-V Path/To/Valid/Image.png"
* @param threshold Allowed difference between two images. Default = 10.0 and was taken from VTK.
* @return True if the images are equal regarding the threshold. False in all other cases.
*/
bool CompareRenderWindowAgainstReference(int argc, char *argv[], double threshold = 10.0);
/**
* @brief The ArgcHelperClass class is a convinience class to convert a vector
* of strings to the standard c++ argv and argc arguments. This is necessary for
* the vtkTesting::Test, since is requires the reference image (and other
* optional parameters) via command line.
*/
class ArgcHelperClass
{
private:
/**
* Members for conversion.
*/
std::vector<char *> argv;
std::vector<std::vector<char>> argvec;
public:
ArgcHelperClass(const std::vector<std::string> &argstrings)
: argv(argstrings.size() + 1), argvec(argstrings.size() + 1)
{
std::vector<std::string> cmdArgs;
cmdArgs.push_back(mitk::IOUtil::GetProgramPath());
cmdArgs.insert(cmdArgs.end(), argstrings.begin(), argstrings.end());
for (std::size_t i = 0; i < cmdArgs.size(); ++i)
{
argvec[i].assign(cmdArgs[i].begin(), cmdArgs[i].end());
argvec[i].push_back('\0');
argv[i] = &argvec[i][0];
}
}
char **GetArgv() { return &argv[0]; }
int GetArgc() { return argv.size(); }
};
protected:
/**
* @brief Initialize Internal method to initialize the renderwindow and set the datastorage.
* @param width Height of renderwindow.
* @param height Width of renderwindow.
- * @param renderingMode The rendering mode.
+ * @param antiAliasing The anti-aliasing mode.
*/
void Initialize(
int width,
int height,
AntiAliasing antiAliasing = AntiAliasing::None);
/** @brief This method tries to load the given file into a member datastorage, in order to render it.
- @param fileName The filename of the file to be loaded (including path).
+ @param filename The filename of the file to be loaded (including path).
**/
void AddToStorage(const std::string &filename);
/** @brief This method tries to parse the given argv for files (e.g. images) and load them into a member
datastorage,
in order to render it.
@param argc Number of parameters.
@param argv Given parameters.
**/
void SetInputFileNames(int argc, char *argv[]);
mitk::RenderWindow::Pointer m_RenderWindow; //<< Contains the mitkRenderWindow into which the test renders the data
mitk::DataStorage::Pointer m_DataStorage; //<< Contains the mitkDataStorage which contains the data to be rendered
bool
m_AutomaticallyCloseRenderWindow; //<< Flag indicating whether the renderwindow should automatically close (true,
// default) or stay open (false). Usefull for debugging.
};
} // namespace mitk
#endif
diff --git a/Modules/Core/TestingHelper/include/mitkTestingMacros.h b/Modules/Core/TestingHelper/include/mitkTestingMacros.h
index 8607ec8906..f838eeffe0 100644
--- a/Modules/Core/TestingHelper/include/mitkTestingMacros.h
+++ b/Modules/Core/TestingHelper/include/mitkTestingMacros.h
@@ -1,391 +1,392 @@
/*============================================================================
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 mitkTestingMacros_h
#define mitkTestingMacros_h
#include <exception>
#include <iostream>
#include <string>
#include <itkMacro.h>
#include <mitkException.h>
#include <mitkTestNotRunException.h>
#include <mitkTestCaller.h>
#include <mitkTestManager.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/ui/text/TestRunner.h>
namespace mitk
{
/** @brief Indicate a failed test. */
class TestFailedException : public std::exception
{
public:
TestFailedException() {}
};
}
/**
* @brief Output some text without generating a terminating newline. Include
*
* @ingroup MITKTestingAPI
*/
#define MITK_TEST_OUTPUT_NO_ENDL(x) std::cout x;
/**
* @brief Output some text.
*
* @ingroup MITKTestingAPI
*/
#define MITK_TEST_OUTPUT(x) MITK_TEST_OUTPUT_NO_ENDL(x << "\n")
/**
* @brief Do some general test preparations. Must be called first in the
* main test function.
*
* @deprecatedSince{2013_09} Use MITK_TEST_SUITE_REGISTRATION instead.
* @ingroup MITKTestingAPI
*/
#define MITK_TEST_BEGIN(testName) \
std::string mitkTestName(#testName); \
mitk::TestManager::GetInstance()->Initialize(); \
try \
{
/**
* @brief Fail and finish test with message MSG
*
* @deprecatedSince{2013_09} Use CPPUNIT_FAIL instead
* @ingroup MITKTestingAPI
*/
#define MITK_TEST_FAILED_MSG(MSG) \
MITK_TEST_OUTPUT(MSG) \
throw mitk::TestFailedException();
/**
* @brief Must be called last in the main test function.
*
* @deprecatedSince{2013_09} Use MITK_TEST_SUITE_REGISTRATION instead.
* @ingroup MITKTestingAPI
*/
#define MITK_TEST_END() \
} \
catch (const mitk::TestFailedException &) \
{ \
MITK_TEST_OUTPUT(<< "Further test execution skipped.") \
mitk::TestManager::GetInstance()->TestFailed(); \
} \
catch (const std::exception &ex) \
{ \
MITK_TEST_OUTPUT(<< "std::exception occured " << ex.what()) \
mitk::TestManager::GetInstance()->TestFailed(); \
} \
if (mitk::TestManager::GetInstance()->NumberOfFailedTests() > 0) \
{ \
MITK_TEST_OUTPUT(<< mitkTestName << ": [DONE FAILED] , subtests passed: " \
<< mitk::TestManager::GetInstance()->NumberOfPassedTests() \
<< " failed: " \
<< mitk::TestManager::GetInstance()->NumberOfFailedTests()) \
return EXIT_FAILURE; \
} \
else \
{ \
MITK_TEST_OUTPUT(<< mitkTestName << ": " << mitk::TestManager::GetInstance()->NumberOfPassedTests() \
<< " tests [DONE PASSED]") \
return EXIT_SUCCESS; \
}
/**
* @deprecatedSince{2013_09} Use CPPUNIT_ASSERT or CPPUNIT_ASSERT_MESSAGE instead.
*/
#define MITK_TEST_CONDITION(COND, MSG) \
MITK_TEST_OUTPUT_NO_ENDL(<< MSG) \
if (!(COND)) \
{ \
mitk::TestManager::GetInstance()->TestFailed(); \
MITK_TEST_OUTPUT(<< " [FAILED]\n" \
<< "In " \
<< __FILE__ \
<< ", line " \
<< __LINE__ \
<< ": " #COND " : [FAILED]") \
} \
else \
{ \
MITK_TEST_OUTPUT(<< " [PASSED]") \
mitk::TestManager::GetInstance()->TestPassed(); \
}
/**
* @deprecatedSince{2013_09} Use CPPUNIT_ASSERT or CPPUNIT_ASSERT_MESSAGE instead.
*/
#define MITK_TEST_CONDITION_REQUIRED(COND, MSG) \
MITK_TEST_OUTPUT_NO_ENDL(<< MSG) \
if (!(COND)) \
{ \
MITK_TEST_FAILED_MSG(<< " [FAILED]\n" \
<< " +--> in " \
<< __FILE__ \
<< ", line " \
<< __LINE__ \
<< ", expression is false: \"" #COND "\"") \
} \
else \
{ \
MITK_TEST_OUTPUT(<< " [PASSED]") \
mitk::TestManager::GetInstance()->TestPassed(); \
}
/**
* \brief Begin block which should be checked for exceptions
*
* @deprecatedSince{2013_09} Use CPPUNIT_ASSERT_THROW instead.
* @ingroup MITKTestingAPI
*
* This macro, together with MITK_TEST_FOR_EXCEPTION_END, can be used
* to test whether a code block throws an expected exception. The test FAILS if the
* exception is NOT thrown. A simple example:
*
MITK_TEST_FOR_EXCEPTION_BEGIN(itk::ImageFileReaderException)
typedef itk::ImageFileReader< itk::Image<unsigned char,2> > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->SetFileName("/tmp/not-existing");
reader->Update();
MITK_TEST_FOR_EXCEPTION_END(itk::ImageFileReaderException)
*
*/
#define MITK_TEST_FOR_EXCEPTION_BEGIN(EXCEPTIONCLASS) \
try \
{
/**
* @deprecatedSince{2013_09}
*/
#define MITK_TEST_FOR_EXCEPTION_END(EXCEPTIONCLASS) \
mitk::TestManager::GetInstance()->TestFailed(); \
MITK_TEST_OUTPUT(<< "Expected an '" << #EXCEPTIONCLASS << "' exception. [FAILED]") \
} \
catch (const EXCEPTIONCLASS &) \
{ \
MITK_TEST_OUTPUT(<< "Caught an expected '" << #EXCEPTIONCLASS << "' exception. [PASSED]") \
mitk::TestManager::GetInstance()->TestPassed(); \
}
/**
* @brief Simplified version of MITK_TEST_FOR_EXCEPTION_BEGIN / END for
* a single statement
*
* @deprecatedSince{2013_09} Use CPPUNIT_ASSERT_THROW instead.
* @ingroup MITKTestingAPI
*/
#define MITK_TEST_FOR_EXCEPTION(EXCEPTIONCLASS, STATEMENT) \
MITK_TEST_FOR_EXCEPTION_BEGIN(EXCEPTIONCLASS) \
STATEMENT; \
MITK_TEST_FOR_EXCEPTION_END(EXCEPTIONCLASS)
/**
* @brief Testing macro to test if two objects are equal.
*
* @ingroup MITKTestingAPI
*
* This macro uses mitk::eps and the corresponding mitk::Equal methods for all
* comparisons and will give verbose output on the dashboard/console.
* Feel free to implement mitk::Equal for your own datatype or purpose.
*
* @param EXPECTED First object.
* @param ACTUAL Second object.
* @param MSG Message to appear with the test.
* @throw Throws mitkException if a nullptr pointer is given as input.
*/
#define MITK_ASSERT_EQUAL(EXPECTED, ACTUAL, MSG) \
if (((EXPECTED).IsNull()) || ((ACTUAL).IsNull())) \
{ \
mitkThrow() << "mitk::Equal does not work with nullptr pointer input."; \
} \
CPPUNIT_ASSERT_MESSAGE(MSG, mitk::Equal(*(EXPECTED), *(ACTUAL), mitk::eps, true))
/**
* @brief Testing macro to test if two objects are not equal.
*
* @ingroup MITKTestingAPI
*
* This macro uses mitk::eps and the corresponding mitk::Equal methods for all
* comparisons and will give verbose output on the dashboard/console.
*
* @deprecatedSince{2013_09} Use MITK_ASSERT_NOT_EQUAL instead.
*
* @param OBJ1 First object.
* @param OBJ2 Second object.
* @param MSG Message to appear with the test.
*
* \sa MITK_TEST_EQUAL
*/
#define MITK_TEST_NOT_EQUAL(OBJ1, OBJ2, MSG) \
CPPUNIT_ASSERT_MESSAGE(MSG, !mitk::Equal(*(OBJ1), *(OBJ2), mitk::eps, true))
/**
* @brief Testing macro to test if two objects are not equal.
*
* @ingroup MITKTestingAPI
*
* This macro uses mitk::eps and the corresponding mitk::Equal methods for all
* comparisons and will give verbose output on the dashboard/console.
*
* @param OBJ1 First object.
* @param OBJ2 Second object.
* @param MSG Message to appear with the test.
* @throw Throws mitkException if a nullptr pointer is given as input.
*
* \sa MITK_ASSERT_EQUAL
*/
#define MITK_ASSERT_NOT_EQUAL(OBJ1, OBJ2, MSG) \
if (((OBJ1).IsNull()) || ((OBJ2).IsNull())) \
{ \
mitkThrow() << "mitk::Equal does not work with nullptr pointer input."; \
} \
CPPUNIT_ASSERT_MESSAGE(MSG, !mitk::Equal(*(OBJ1), *(OBJ2), mitk::eps, true))
/**
* @brief Registers the given test suite.
*
* @ingroup MITKTestingAPI
*
* @param TESTSUITE_NAME The name of the test suite class, without "TestSuite"
* at the end.
*/
#define MITK_TEST_SUITE_REGISTRATION(TESTSUITE_NAME) \
int TESTSUITE_NAME##Test(int /*argc*/, char * /*argv*/ []) \
{ \
int result = 0; \
try \
{ \
CppUnit::TextUi::TestRunner runner; \
runner.addTest(TESTSUITE_NAME##TestSuite::suite()); \
result = runner.run() ? 0 : 1; \
} \
catch (const mitk::TestNotRunException& e) \
{ \
MITK_WARN << "Test not run: " << e.GetDescription(); \
result = 77; \
} \
return result; \
}
/**
* @brief Adds a test to the current test suite.
*
* @ingroup MITKTestingAPI
*
* Use this macro after the CPPUNIT_TEST_SUITE() macro to add test cases.
* The macro internally just calls the CPPUNIT_TEST macro.
*
* @param TESTMETHOD The name of the member funtion test.
*/
#define MITK_TEST(TESTMETHOD) CPPUNIT_TEST(TESTMETHOD)
/**
* @brief Adds a parameterized test to the current test suite.
*
* @ingroup MITKTestingAPI
*
* Use this macro after the CPPUNIT_TEST_SUITE() macro to add test cases
* which need custom parameters.
*
* @param TESTMETHOD The name of the member function test.
* @param ARGS A std::vector<std::string> object containing test parameter.
*
* @note Use the macro MITK_PARAMETERIZED_TEST only if you know what
* you are doing. If you are not sure, use MITK_TEST instead.
*/
#define MITK_PARAMETERIZED_TEST(TESTMETHOD, ARGS) \
\
{ \
std::string testName = #TESTMETHOD; \
for (std::size_t i = 0; i < ARGS.size(); ++i) \
{ \
testName += "_" + ARGS[i]; \
} \
CPPUNIT_TEST_SUITE_ADD_TEST((new mitk::TestCaller<TestFixtureType>( \
context.getTestNameFor(testName), &TestFixtureType::TESTMETHOD, context.makeFixture(), args))); \
}
/**
* @brief Adds a parameterized test to the current test suite.
*
* @ingroup MITKTestingAPI
*
* Use this macro after the CPPUNIT_TEST_SUITE() macro to add test cases
* which need parameters from the command line.
*
* @warning Use the macro MITK_PARAMETERIZED_CMD_LINE_TEST only
* if you know what you are doing. If you are not sure, use
* MITK_TEST instead. MITK_PARAMETERIZED_CMD_LINE_TEST is meant
* for migrating from ctest to CppUnit. If you implement new
* tests, the MITK_TEST macro will be sufficient.
*
* @param TESTMETHOD The name of the member function test.
*/
#define MITK_PARAMETERIZED_CMD_LINE_TEST(TESTMETHOD) \
CPPUNIT_TEST_SUITE_ADD_TEST((new mitk::TestCaller<TestFixtureType>( \
context.getTestNameFor(#TESTMETHOD), &TestFixtureType::TESTMETHOD, context.makeFixture())));
/**
* @brief Adds a parameterized test to the current test suite.
*
* @ingroup MITKTestingAPI
*
* Use this macro after the CPPUNIT_TEST_SUITE() macro to add test cases
* which need one custom parameter.
*
* @param TESTMETHOD The name of the member function test.
* @param arg1 A custom string parameter being passed to the fixture.
*
* @note Use the macro MITK_PARAMETERIZED_TEST_1 only if you know what
* you are doing. If you are not sure, use MITK_TEST instead.
*
* @see MITK_PARAMETERIZED_TEST
*/
#define MITK_PARAMETERIZED_TEST_1(TESTMETHOD, arg1) \
\
{ \
std::vector<std::string> args; \
args.push_back(arg1); \
MITK_PARAMETERIZED_TEST(TESTMETHOD, args) \
}
/**
* @brief Adds a parameterized test to the current test suite.
*
* @ingroup MITKTestingAPI
*
* Use this macro after the CPPUNIT_TEST_SUITE() macro to add test cases
* which need two custom parameter.
*
* @param TESTMETHOD The name of the member function test.
* @param arg1 A custom string parameter being passed to the fixture.
+ * @param arg2
*
* @note Use the macro MITK_PARAMETERIZED_TEST_2 only if you know what
* you are doing. If you are not sure, use MITK_TEST instead.
*
* @see MITK_PARAMETERIZED_TEST
*/
#define MITK_PARAMETERIZED_TEST_2(TESTMETHOD, arg1, arg2) \
\
{ \
std::vector<std::string> args; \
args.push_back(arg1); \
args.push_back(arg2); \
MITK_PARAMETERIZED_TEST(TESTMETHOD, args) \
}
#endif
diff --git a/Modules/Core/TestingHelper/src/mitkRenderingTestHelper.cpp b/Modules/Core/TestingHelper/src/mitkRenderingTestHelper.cpp
index db6186d3e3..80819797ea 100644
--- a/Modules/Core/TestingHelper/src/mitkRenderingTestHelper.cpp
+++ b/Modules/Core/TestingHelper/src/mitkRenderingTestHelper.cpp
@@ -1,292 +1,239 @@
/*============================================================================
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.
============================================================================*/
// VTK
#include <vtkCamera.h>
#include <vtkOpenGLRenderWindow.h>
#include <vtkPNGWriter.h>
#include <vtkRenderLargeImage.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
// MITK
#include <mitkNodePredicateDataType.h>
#include <mitkRenderWindow.h>
#include <mitkRenderingTestHelper.h>
#include <mitkSliceNavigationController.h>
#include <mitkStandaloneDataStorage.h>
#include <mitkException.h>
#include <mitkTestNotRunException.h>
#include <mitkTestingMacros.h>
-#if defined _MSC_VER
-#if _MSC_VER >= 1700
-#define RESIZE_WORKAROUND
-#endif
-#endif
-
-#ifdef RESIZE_WORKAROUND
-#include "vtkWin32OpenGLRenderWindow.h"
-#endif
-
// VTK Testing to compare the rendered image pixel-wise against a reference screen shot
#include "vtkTesting.h"
mitk::RenderingTestHelper::RenderingTestHelper(int width,
int height,
AntiAliasing antiAliasing)
: m_AutomaticallyCloseRenderWindow(true)
{
this->Initialize(width, height, antiAliasing);
}
mitk::RenderingTestHelper::RenderingTestHelper(
int width, int height, int argc, char *argv[], AntiAliasing antiAliasing)
: m_AutomaticallyCloseRenderWindow(true)
{
this->Initialize(width, height, antiAliasing);
this->SetInputFileNames(argc, argv);
}
void mitk::RenderingTestHelper::Initialize(int width, int height, AntiAliasing antiAliasing)
{
RenderingManager::GetInstance()->SetAntiAliasing(antiAliasing);
mitk::UIDGenerator uidGen = mitk::UIDGenerator("UnnamedRenderer_");
m_RenderWindow = mitk::RenderWindow::New(nullptr, uidGen.GetUID().c_str());
auto renderWindow = m_RenderWindow->GetVtkRenderWindow();
if (0 == renderWindow->SupportsOpenGL())
{
auto openGLRenderWindow = dynamic_cast<vtkOpenGLRenderWindow*>(renderWindow);
auto message = nullptr != openGLRenderWindow
? openGLRenderWindow->GetOpenGLSupportMessage()
: std::string("No details available.");
mitkThrowException(mitk::TestNotRunException) << "OpenGL not supported: " << message;
}
m_DataStorage = mitk::StandaloneDataStorage::New();
m_RenderWindow->GetRenderer()->SetDataStorage(m_DataStorage);
this->SetMapperIDToRender2D();
this->GetVtkRenderWindow()->SetSize(width, height);
-#ifdef RESIZE_WORKAROUND
-
- HWND hWnd = static_cast<vtkWin32OpenGLRenderWindow *>(this->GetVtkRenderWindow())->GetWindowId();
-
- RECT r;
- r.left = 10;
- r.top = 10;
- r.right = r.left + width;
- r.bottom = r.top + height;
-
- LONG style = GetWindowLong(hWnd, GWL_STYLE);
- AdjustWindowRect(&r, style, FALSE);
-
- MITK_INFO << "WANTED:";
- MITK_INFO << r.right - r.left;
- MITK_INFO << r.bottom - r.top;
-
- RECT rect;
- if (GetWindowRect(hWnd, &rect))
- {
- int width = rect.right - rect.left;
- int height = rect.bottom - rect.top;
-
- MITK_INFO << "ACTUAL:";
- MITK_INFO << width;
- MITK_INFO << height;
- }
-
- SetWindowPos(hWnd, HWND_TOP, 0, 0, r.right - r.left, r.bottom - r.top, SWP_NOZORDER);
-
- GetWindowRect(hWnd, &rect);
-
- int width2 = rect.right - rect.left;
- int height2 = rect.bottom - rect.top;
-
- MITK_INFO << "ACTUAL2:";
- MITK_INFO << width2;
- MITK_INFO << height2;
-
- SetWindowPos(hWnd, HWND_TOP, 0, 0, 2 * (r.right - r.left) - width2, 2 * (r.bottom - r.top) - height2, SWP_NOZORDER);
-
-#endif
-
m_RenderWindow->GetRenderer()->Resize(width, height);
}
mitk::RenderingTestHelper::~RenderingTestHelper()
{
}
void mitk::RenderingTestHelper::SetMapperID(mitk::BaseRenderer::StandardMapperSlot id)
{
m_RenderWindow->GetRenderer()->SetMapperID(id);
}
void mitk::RenderingTestHelper::SetMapperIDToRender3D()
{
this->SetMapperID(mitk::BaseRenderer::Standard3D);
mitk::RenderingManager::GetInstance()->InitializeViews(
this->GetDataStorage()->ComputeBoundingGeometry3D(this->GetDataStorage()->GetAll()));
}
void mitk::RenderingTestHelper::SetMapperIDToRender2D()
{
this->SetMapperID(mitk::BaseRenderer::Standard2D);
}
void mitk::RenderingTestHelper::Render()
{
// if the datastorage is initialized and at least 1 image is loaded render it
if (m_DataStorage.IsNotNull() || m_DataStorage->GetAll()->Size() >= 1)
{
// Prepare the VTK camera before rendering.
m_RenderWindow->GetRenderer()->PrepareRender();
this->GetVtkRenderWindow()->Render();
this->GetVtkRenderWindow()->WaitForCompletion();
if (m_AutomaticallyCloseRenderWindow == false)
{
// Use interaction to stop the test
this->GetVtkRenderWindow()->GetInteractor()->Start();
}
}
else
{
MITK_ERROR << "No images loaded in data storage!";
}
}
mitk::DataStorage::Pointer mitk::RenderingTestHelper::GetDataStorage()
{
return m_DataStorage;
}
void mitk::RenderingTestHelper::SetInputFileNames(int argc, char *argv[])
{
// i is set 1, because 0 is the testname as string
// parse parameters
for (int i = 1; i < argc; ++i)
{
// add everything to a list but -T and -V
std::string tmp = argv[i];
if ((tmp.compare("-T")) && (tmp.compare("-V")))
{
this->AddToStorage(tmp);
}
else
{
break;
}
}
}
void mitk::RenderingTestHelper::SetViewDirection(mitk::SliceNavigationController::ViewDirection viewDirection)
{
mitk::BaseRenderer::GetInstance(m_RenderWindow->GetVtkRenderWindow())
->GetSliceNavigationController()
->SetDefaultViewDirection(viewDirection);
mitk::RenderingManager::GetInstance()->InitializeViews(
m_DataStorage->ComputeBoundingGeometry3D(m_DataStorage->GetAll()));
}
void mitk::RenderingTestHelper::ReorientSlices(mitk::Point3D origin, mitk::Vector3D rotation)
{
mitk::SliceNavigationController::Pointer sliceNavigationController =
mitk::BaseRenderer::GetInstance(m_RenderWindow->GetVtkRenderWindow())->GetSliceNavigationController();
sliceNavigationController->ReorientSlices(origin, rotation);
}
vtkRenderer *mitk::RenderingTestHelper::GetVtkRenderer()
{
return m_RenderWindow->GetRenderer()->GetVtkRenderer();
}
void mitk::RenderingTestHelper::SetImageProperty(const char *propertyKey, mitk::BaseProperty *property)
{
this->m_DataStorage->GetNode(mitk::NodePredicateDataType::New("Image"))->SetProperty(propertyKey, property);
}
vtkRenderWindow *mitk::RenderingTestHelper::GetVtkRenderWindow()
{
return m_RenderWindow->GetVtkRenderWindow();
}
bool mitk::RenderingTestHelper::CompareRenderWindowAgainstReference(int argc, char *argv[], double threshold)
{
this->Render();
// retVal meanings: (see VTK/Rendering/vtkTesting.h)
// 0 = test failed
// 1 = test passed
// 2 = test not run
// 3 = something with vtkInteraction
if (vtkTesting::Test(argc, argv, this->GetVtkRenderWindow(), threshold) == 1)
return true;
else
return false;
}
// method to save a screenshot of the renderwindow (e.g. create a reference screenshot)
void mitk::RenderingTestHelper::SaveAsPNG(std::string fileName)
{
vtkSmartPointer<vtkRenderer> renderer = this->GetVtkRenderer();
bool doubleBuffering(renderer->GetRenderWindow()->GetDoubleBuffer());
renderer->GetRenderWindow()->DoubleBufferOff();
vtkSmartPointer<vtkRenderLargeImage> magnifier = vtkSmartPointer<vtkRenderLargeImage>::New();
magnifier->SetInput(renderer);
magnifier->SetMagnification(1);
vtkSmartPointer<vtkImageWriter> fileWriter = vtkSmartPointer<vtkPNGWriter>::New();
fileWriter->SetInputConnection(magnifier->GetOutputPort());
fileWriter->SetFileName(fileName.c_str());
fileWriter->Write();
renderer->GetRenderWindow()->SetDoubleBuffer(doubleBuffering);
}
void mitk::RenderingTestHelper::SetAutomaticallyCloseRenderWindow(bool automaticallyCloseRenderWindow)
{
m_AutomaticallyCloseRenderWindow = automaticallyCloseRenderWindow;
}
void mitk::RenderingTestHelper::SaveReferenceScreenShot(std::string fileName)
{
this->SaveAsPNG(fileName);
}
void mitk::RenderingTestHelper::AddToStorage(const std::string &filename)
{
try
{
mitk::IOUtil::Load(filename, *m_DataStorage.GetPointer());
mitk::RenderingManager::GetInstance()->InitializeViews(
m_DataStorage->ComputeBoundingGeometry3D(m_DataStorage->GetAll()));
}
catch ( const itk::ExceptionObject &e )
{
MITK_ERROR << "Failed loading test data '" << filename << "': " << e.what();
}
}
void mitk::RenderingTestHelper::AddNodeToStorage(mitk::DataNode::Pointer node)
{
this->m_DataStorage->Add(node);
mitk::RenderingManager::GetInstance()->InitializeViews(
m_DataStorage->ComputeBoundingGeometry3D(m_DataStorage->GetAll()));
}
diff --git a/Modules/Core/doc/Doxygen/ModuleAdaptors.dox b/Modules/Core/doc/Doxygen/ModuleAdaptors.dox
index de2854d62b..7b94a57e62 100644
--- a/Modules/Core/doc/Doxygen/ModuleAdaptors.dox
+++ b/Modules/Core/doc/Doxygen/ModuleAdaptors.dox
@@ -1,139 +1,139 @@
/**
\defgroup Adaptor Adaptor Classes
\ingroup ProcessAdaptor
\brief This subcategory includes adaptor classes for the integration of algorithms from
other toolkits, especially ITK.
The task of most of the classes in this category is to deal with the conversion between
the (templated) itk::Image and the (not-templated) mitk::Image.
Methods for conversion are provided for both directions:
\li \ref MitkToItk
\li \ref ItkToMitk
Care has to be taken regarding the involved coordinate systems, see \ref ItkToMitkCoordinateSystems.
For limitations on ITK-type conversion see the section \ref ModuleAdaptorLimitations.
VTK-based access to MITK images is straightforward: simply ask your mitk::Image for a
\a vtkImageData by calling Image:GetVtkImageData. Similarily, to get a \a vtkPolyData
from the MITK class for storing surfaces, mitk::Surface, call Surface::GetVtkPolyData.
\section MitkToItk MITK to ITK adaptors
Pixel type and dimension of MITK images can be specified at run time whereas ITK images
are templated over the pixel type and the dimension, thus in ITK both need to be specified
at compile time.
There two different situations, which are covered in the following sub-sections:
\li Either you know the pixel type/dimension the ITK image should have at compile time for
some reason (e.g., you always create MITK images of a specific pixel type/dimension)
\li or the pixel type/dimension of an MITK image is really unkown and the ITK image should
have the same (unkown) type.
\subsection MitkToFixedItk Converting MITK images to ITK images with known type
If you know the type (pixel type and dimension) of the MITK image you have two options:
\li mitk::ImageToItk<TOutputImage>: is a process class that takes an mitk::Image as input
and produces an itk::Image of the given type \a TOutputImage as output (to be accessed
using \a GetOutput()). In case the MITK image does not have the same type as
\a TOutputImage an exception will be thrown.
\li mitk::CastToItkImage: this function has two parameters, the mitk::Image (input) and a
smartpointer to an itk::Image (output, does not need to be initialized). In case the
MITK image does not have the same type as the ITK image it will be casted
(if possible; done via itk::CastImageFilter).
Thus, mitk::CastToItkImage is the more powerful variant: here it is sufficient that you know
what you want to have (the ITK data type), to which the MITK image will be casted, if needed.
\subsection MitkToUnkownItk Accessing an MITK image as an ITK image (type unkown)
If you do not know the pixel type/dimension of an MITK image in advance and the ITK image should
have the same (unkown) type, e.g., to run a filter on the MITK image data, we cannot really convert
to one ITK image. This is simply, because we cannot instantiate an itk::Image object with unkown
pixel type/dimension.
Nevertheless, MITK provides a way to access an MITK image as if it was an ITK image of unkown type.
To do so, first define an access method, which is templated as an ITK image is:
\code
template<typename TPixel, unsigned int VImageDimension>
MyAccessMethod(itk::Image<TPixel, VImageDimension>* itkImage)
{
...
}
\endcode
If you don't understand this template syntax, we need to refer you to an C++ text book. Understanding
template syntax is crucial to successfully using ITK.
To call this templated method with an (untemplated) mitk::Image, you can use the #AccessByItk macro
(or one of its variants) from mitkImageAccessByItk.h. This macro checks for the actual image type of
the mitk::Image and does any neccessary conversions. This works for all configured pixel types (default
is char, unsigned char, short, unsigned short, int, unsigned int, float, and double) and dimensions
(default is 2 and 3). You can change the considered default pixel types and dimensions by modifying
the CMake variables MITK_ACCESSBYITK_*.
\code
AccessByItk(mitkImage, MyAccessMethod)
\endcode
-An example is given in \ref Step6Page.
+An example is given in \ref Step06Page.
The AccessBy... macros create quite a lot of code: the user defined access method has to be compiled for
all considered pixel types \em times the supported dimensions (default is 2 and 3). Therefore, depending
on the complexity of the access method, some compilers may run into problems with memory.
One workaround is to use explicit instantiation and distribute it on multiple files. The macro
-#InstantiateAccessFunction and its variants are for this purpose. An example is again given in \ref Step6Page.
+#InstantiateAccessFunction and its variants are for this purpose. An example is again given in \ref Step06Page.
Another workaround is to reduce the created code by fixing either the type (#AccessFixedTypeByItk) or
dimension (#AccessFixedDimensionByItk).
There is one variant of AccessByItk... for passing additional parameters
to the access-function, called #AccessFixedTypeByItk_n.
\link mitkImage.h \endlink
\link mitkImageCast.h \endlink
\link mitkImageToItk.h \endlink
\link mitkITKImageImport.h \endlink
\section ItkToMitk ITK to MITK adaptors
Converting ITK images to MITK is easier than the other way round. Basically, you have three options:
\li mitk::ITKImageImport<TInputImage>: is a process class that takes an itk::Image of the given type
\a TOutputImage as input and produces an mitk::Image as output (to be accessed using \a GetOutput()).
The image data contained in the itk::Image is referenced, not copied.
\li mitk::ImportItkImage: this function takes the itk::Image as input and returns an mitk::Image. Internally,
it uses the class just described. So again, the image data contained in the itk::Image is referenced, not
copied.
\li mitk::CastToMitkImage: this function has two parameters, the itk::Image (input) and a smartpointer to an
mitk::Image (output, does not need to be initialized). In contrast to the other described methods,
this function copies the image data!
\section ItkToMitkCoordinateSystems ITK image vs MITK coordinate systems
Converting coordinates from the ITK physical coordinate system (which does not support rotated images) to the
MITK world coordinate system should be performed via the Geometry3D of the Image,
see mitk::Geometry3D::WorldToItkPhysicalPoint.
\section ModuleAdaptorLimitations Limitations
The \ref MitkToItk for unspecified types have to do type multiplexing at compile time. This is done for a
limited number of pixel types and dimensions, defined during the CMake configuration process.
Especially, color image types are not multiplexed. This is because many algorithms do not support color images
(e.g. with data type itk::RGBPixel) because they do not have a scalar data type. If your algorithm do support
color and you want to multiplex over all scalar as well as the color data type, try the following:
\code
try
{
AccessFixedPixelTypeByItk(myMitkImageThatMaybeColor, // The MITK image which may be a color image
myAlgorithmFunction, // The template method being able to handle color
MITK_ACCESSBYITK_PIXEL_TYPES_SEQ // The default pixel type sequence
(itk::RGBPixel<unsigned char>) // The additional type sequence
)
}
catch(const mitk::AccessByItkException& e)
{
// add error handling here
}
\endcode
*/
diff --git a/Modules/Core/doc/Doxygen/ModuleVisualization.dox b/Modules/Core/doc/Doxygen/ModuleVisualization.dox
index 72fb312d85..707a70b266 100644
--- a/Modules/Core/doc/Doxygen/ModuleVisualization.dox
+++ b/Modules/Core/doc/Doxygen/ModuleVisualization.dox
@@ -1,45 +1,45 @@
/**
\defgroup Visualization Visualization and Visualization Organization Classes
\ingroup Core
\brief This category includes renderwindows (currently one for OpenGL), renderers (currently only one,
for OpenGL-based renderwindows), mappers and classes for navigating in the data.
\section overviewVisualization Rationale and overview
Mappers visualize data objects of a specific classes by creating rendering primitives that
interface to the graphics library (e.g., OpenGL, vtk).
Renderers organize the rendering process. A Renderer contains a reference to a (sub-) data tree
and asks the mappers of the data objects to render the data into the renderwindow it is associated to.
-More details can be found in the section on \ref Rendering.
+More details can be found in the section on \ref QVTKRendering.
\subsection inthisgroupVisualization What belongs into this group
\section implementVisualization Practical issues
\section futureVisualization Plans for the future
- Abort mechanism
- level-of-detail rendering mechanism
- allow multiple renderers per renderwindow
- modified detection mechanism:
- allow to detect whether a modification of data/property/dislaygeometry
/camera requires to re-render. E.g., mark whether a property effects
the rendering.
- analyze which type of modification requires which kind of action, e.g.:
if the displaygeometry or the color has changed, we do not need to
resample an image, but we do need to redraw. The first step is to
analyze which types of modifications (e.g., displaygeometry changed,
properties changed; can we group these?) and actions exist.
- improved design of navigation controllers, probably more focused on
steppers (then on BaseController). Have in mind:
- rotatable slices
- dependent views: e.g., sequence of renderers showing series of
consecutive slices (maybe realized as master stepper and
dependent offset steppers)
- consider time vs. slice stepping
- use stepper mechanism for additional purposes, e.g., for animating
transfer functions
*/
diff --git a/Modules/Core/doc/Doxygen/ModuleVisualizationMapper.dox b/Modules/Core/doc/Doxygen/ModuleVisualizationMapper.dox
index 8f6a285c77..f5980f90f2 100644
--- a/Modules/Core/doc/Doxygen/ModuleVisualizationMapper.dox
+++ b/Modules/Core/doc/Doxygen/ModuleVisualizationMapper.dox
@@ -1,25 +1,25 @@
/**
\defgroup Mapper Mapper Classes
\ingroup Visualization
\brief In the MITK rendering concept, Mappers are responsible for actually rendering data onto the screen.
\section overviewVisualizationMapper Overview
Mappers differ in the type of data they are capable of rendering (e.g. volume data, polygonal data) and the mode of how data is rendered (e.g. 2D or 3D). For example, the ImageMapperGL2D renders volume data in a 2D view, i.e. it extracts a slice of the volume (as determined by the Geometry of the associated Renderer) and displays it as a 2D plane. All Mapper classes are arranged in a class hierarchy according to these criterions.
\section integrationVisualizationMapper Integration into the rendering process
-Mapper objects are owned by the DataNode which contains the data they have to render. An overview over this composition is given in the section \ref Renderer. Each DataNode can have (and usually has) multiple Mappers attached, each responsible for different modes of rendering. In most cases this would be one 2D Mapper and one 3D Mapper, but other Mappers are possible, too.
+Mapper objects are owned by the DataNode which contains the data they have to render. An overview over this composition is given in the section \ref QVTKRendering. Each DataNode can have (and usually has) multiple Mappers attached, each responsible for different modes of rendering. In most cases this would be one 2D Mapper and one 3D Mapper, but other Mappers are possible, too.
Which Mapper of a DataNode to use is determined by an ID; the Renderer of a 2D window would for example ask the DataNode to return an appropriate 2D Mapper.
-More details can be found in the section on \ref Rendering.
+More details can be found in the section on \ref QVTKRendering.
\section todoVisualizationMapper Future plans
The need to Update() a Mapper can be justified by property changes in the associated data items. However, property changes are not uniformly taken into account when deciding on whether to execute Update() or not. The changes are data specific and difficult to generalize. As an effect, many Update() calls are not really necessary and might slow down the rendering process significantly. One solution to this problem might be a mechanism which allows Mappers to register themselves to relevant data properties, so as to be notified whenever a change occurs. If no modification did occur since the last Update(), and the data itself has remained unchanged, no re-initialization (of the rendering pipeline for example) needs to be performed.
*/
diff --git a/Modules/Core/doc/Doxygen/ModuleVisualizationRenderer.dox b/Modules/Core/doc/Doxygen/ModuleVisualizationRenderer.dox
index e1e2428197..02329791f5 100644
--- a/Modules/Core/doc/Doxygen/ModuleVisualizationRenderer.dox
+++ b/Modules/Core/doc/Doxygen/ModuleVisualizationRenderer.dox
@@ -1,42 +1,42 @@
/**
\defgroup Renderer Renderer and RenderWindow Classes
\ingroup Visualization
\brief The MITK rendering model resembles the mechisms found in VTK. This section describes the core components for coordinating rendering processes and render windows.
\section overviewVisualizationRenderer Overview
To visualize a dataset it needs to be stored in the DataTree. Depending on the application, the whole DataTree may be displayed, or merely parts of it. The rendering of individual data items (e.g. volumes or polygon models) is conducted by specific Mappers: each kind of visualizable data has its own corresponding Mapper implementation (see \ref Mapper).
MITK is designed to intrinsically provide different views on data. For example, a volume dataset is volume rendered in a 3D view, and displayed slice-wise in a 2D view. A polygon model would be displayed as a contour in 2D (i.e., the intersection of the 3D model and the respective 2D plane). This principle applies to all kinds of data, thereby ensuring a consistent visual representation regardless of the view type. It is realized by providing Mappers for each combination of data type and view type. Every item of the DataTree is associated with a list of Mappers, each capable of rendering the data item in a specific view.
RenderWindows represent the rendering target: an area of the user interface into which data is rendered. The actual rendering process is controlled by Renderers, specifically by mitkVtkPropRenderer, which is a concrete implementation BaseRenderer and iterates over the elements of the DataTree to render each using the associated Mapper. Eeach data item of the DataTree has Geometry objects attached to it which describe the geometry of the data (e.g. its bounding box, location, or spatial conversion hints).
\section vtkVisualizationRenderer Encapsulating VTK Rendering Mechanisms
As a framework, MITK aims at making use of the visualization capabilities of VTK as much as possible. For the application developer building on top of MITK, the way of how to utilize specific VTK features should be straightforward and familiar. Therefore, most of the MITK rendering components closely resemble or integrate corresponding VTK components.
Just like VTK, MITK defines Renderers and Mappers. These classes do not derive from their VTK counterparts, but integrate them and have similar scopes of responsibility. While the VTK rendering mechanism is mainly focused on establishing a pipeline of rendering components (data, filters, mappers, and renderers), MITK has a central DataTree and provides convenient ways of rendering different items of the tree according to their type. Internally, the VTK rendering pipeline is used, though it is more hidden from the application developer who merely makes use of existing rendering capabilities.
-As of MITK 0.8, the class vtkMitkRenderProp (a derivation of vtkProp) represents the single prop object in the VTK rendering pipeline responsible for coordinating the rendering of all objects in MITK's DataTree. The advantage of this approach is that all rendering management is done in the usual VTK rendering pipeline style, while the control of how data is actually rendered is entirely on MITK side. For example, MITK Mapper classes may either use VTK classes for rendering (actors, properties, ...), or do their rendering entirely in OpenGL where appropriate (e.g. in 2D Mapper classes). For further details refer to the page \ref Rendering.
+As of MITK 0.8, the class vtkMitkRenderProp (a derivation of vtkProp) represents the single prop object in the VTK rendering pipeline responsible for coordinating the rendering of all objects in MITK's DataTree. The advantage of this approach is that all rendering management is done in the usual VTK rendering pipeline style, while the control of how data is actually rendered is entirely on MITK side. For example, MITK Mapper classes may either use VTK classes for rendering (actors, properties, ...), or do their rendering entirely in OpenGL where appropriate (e.g. in 2D Mapper classes). For further details refer to the page \ref QVTKRendering.
\section renderingManagerVisualizationRenderer Controlling it All: RenderingManager
On a higher level, all rendering in MITK is managed and supervised by the RenderingManager. Its main task is to provide a central instance where any part of the application can request a repaint of a particular RenderWindow. Thereby, requests can be issued from multiple independent subroutines at one time, and only result in one repainting call, rather than induce many unnecessary rendering passes.
Another task is the supervision of ongoing rendering activities. For large datasets, high quality rendering might become very slow and thus impede smooth user interactions. To alleviate this, level-of-detail rendering and abort-mechanisms are introduced and controlled by the RenderingManager to achieve interactive frame rate and response times. Note that these features are not yet available but currently under development.
The rendering process could be further simplified by making the DataTree automatically detect data changes that require the data to be re-drawn. The fundamentals for such a mechanism already exist but still for many modifications a repainting request has to be issued by the entity causing it.
\section implementationManagerVisualizationRenderer Platform-Specific Implementation
MITK tries to integrate seamlessly into the normal VTK rendering pipeline. The whole MITK data(tree) is capsuled into one customized vtkProp, the so-called vtkMitkRenderProp which is then integrated into VTK pipeline.
The VTK integration into GUI systems, like e.g. QT, is therefore equal to normal VTK usage. As an example, the MITK MainApp requires the QT-VTK widget (provided by VTK) for integration of renderWindows into GUI.
Further information on this can be found in section "Related Pages" "Rendering in MITK by means of the QT-VTK widget".
*/
\ No newline at end of file
diff --git a/Modules/Core/doc/Doxygen/Modules.dox b/Modules/Core/doc/Doxygen/Modules.dox
index 00dabce1db..fb613de407 100644
--- a/Modules/Core/doc/Doxygen/Modules.dox
+++ b/Modules/Core/doc/Doxygen/Modules.dox
@@ -1,105 +1,105 @@
/**
\defgroup Core Core
\ingroup MITKModules
\brief This category includes classes of the MITK Core module.
The MITK Core module contains abstractions for common data types and their
geometries, I/O facilities for loading and saving data in various formats,
infrastructures for handling user interaction and undo/redo operations,
GUI toolkit independent visualization classes, and a generic service registry.
In almost all cases, additional MITK modules will make use of classes contained
in the Core module.
*/
/**
\defgroup Data Data Classes
\ingroup Core
\brief This subcategory includes the data classes, e.g., for images (mitk::Image),
surfaces (mitk::Surface), vessel-trees (mitk::VesselTreeData), etc.
Data access classes are only included, if there is no equivalent in itk (see
- \ref ProcessAndAdaptorClasses "Process and Adaptor Classes" below).
+ \ref ProcessAdaptor "Process and Adaptor Classes" below).
*/
/**
\defgroup IO IO Classes
\ingroup Core
\brief This subcategory includes the IO classes to read or write data objects.
*/
/**
\defgroup DeprecatedIO Deprecated IO Classes
\ingroup Core
\brief This subcategory includes the Deprecated IO classes to read or write data objects.
*/
/**
\defgroup DataStorage Data Storage Classes
\ingroup Core
\brief This subcategory includes the classes to store and retrieve objects from the mitk::DataStorage
*/
/**
\defgroup ProcessAdaptor Process and Adaptor Classes
\ingroup Core
\brief This category includes process (algorithm) classes developed specifically for mitk and
(mainly) adaptor classes for the integration of algorithms from other toolkits
(currently vtk, itk).
The itk adaptor classes are also useful for data access to mitk data objects.
*/
/**
\defgroup Process Process Classes
\ingroup ProcessAdaptor
\brief This subcategory includes process (algorithm) classes developed specifically for mitk.
*/
/**
\defgroup InteractionUndo Interaction and Undo Classes
\ingroup Core
\brief This category includes classes that support the developer to create
software that allows the user to interact with the data.
This includes complex interactions that have multiple states (e.g., moving a handle of an
active contour vs changing its local elasicity) and a concept to realize an undo/redo-mechanism.
A detailed description of the rationale for these classes can be found in
\ref InteractionPage.
*/
/**
\defgroup Interaction Interaction Classes
\ingroup InteractionUndo
\brief This subcategory includes interaction classes (subclasses of mitk::StateMachine) that change
the data according to the input of the user.
For undo-support, the change is done by sending an OperationEvent to the respective
data object, which changes itself accordingly.
A detailed description of the rationale for these classes can be found in
\ref InteractionPage.
*/
/**
\defgroup Undo Undo Classes
\ingroup InteractionUndo
\brief This subcategory includes the undo/redo-specific classes.
For undo-support, the change is done by sending an OperationEvent to the respective data object,
which changes itself accordingly.
A detailed description of the rationale for these classes can be found in
\ref InteractionPage.
*/
diff --git a/Modules/Core/include/mitkAbstractFileIO.h b/Modules/Core/include/mitkAbstractFileIO.h
index b788599622..445d3ec0ba 100644
--- a/Modules/Core/include/mitkAbstractFileIO.h
+++ b/Modules/Core/include/mitkAbstractFileIO.h
@@ -1,158 +1,159 @@
/*============================================================================
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 MITKABSTRACTFILEIO_H
#define MITKABSTRACTFILEIO_H
#include "mitkAbstractFileReader.h"
#include "mitkAbstractFileWriter.h"
namespace mitk
{
#ifndef DOXYGEN_SKIP
// Skip this code during Doxygen processing, because it only
// exists to resolve name clashes when inheriting from both
// AbstractFileReader and AbstractFileWriter.
class AbstractFileIOReader : public AbstractFileReader
{
public:
virtual ConfidenceLevel GetReaderConfidenceLevel() const { return AbstractFileReader::GetConfidenceLevel(); }
ConfidenceLevel GetConfidenceLevel() const override { return this->GetReaderConfidenceLevel(); }
protected:
AbstractFileIOReader() {}
AbstractFileIOReader(const CustomMimeType &mimeType, const std::string &description)
: AbstractFileReader(mimeType, description)
{
}
private:
virtual IFileReader *ReaderClone() const = 0;
IFileReader *Clone() const override { return ReaderClone(); }
};
struct AbstractFileIOWriter : public AbstractFileWriter
{
virtual ConfidenceLevel GetWriterConfidenceLevel() const { return AbstractFileWriter::GetConfidenceLevel(); }
ConfidenceLevel GetConfidenceLevel() const override { return this->GetWriterConfidenceLevel(); }
protected:
AbstractFileIOWriter(const std::string &baseDataType) : AbstractFileWriter(baseDataType) {}
AbstractFileIOWriter(const std::string &baseDataType,
const CustomMimeType &mimeType,
const std::string &description)
: AbstractFileWriter(baseDataType, mimeType, description)
{
}
private:
virtual IFileWriter *WriterClone() const = 0;
IFileWriter *Clone() const override { return WriterClone(); }
};
#endif // DOXYGEN_SKIP
/**
* @ingroup IO
*
* @brief Abstract class for implementing a reader and writer.
*/
class MITKCORE_EXPORT AbstractFileIO : public AbstractFileIOReader, public AbstractFileIOWriter
{
public:
Options GetReaderOptions() const;
us::Any GetReaderOption(const std::string &name) const;
void SetReaderOptions(const Options &options);
void SetReaderOption(const std::string &name, const us::Any &value);
Options GetWriterOptions() const;
us::Any GetWriterOption(const std::string &name) const;
void SetWriterOptions(const Options &options);
void SetWriterOption(const std::string &name, const us::Any &value);
ConfidenceLevel GetReaderConfidenceLevel() const override;
ConfidenceLevel GetWriterConfidenceLevel() const override;
std::pair<us::ServiceRegistration<IFileReader>, us::ServiceRegistration<IFileWriter>> RegisterService(
us::ModuleContext *context = us::GetModuleContext());
protected:
AbstractFileIO(const AbstractFileIO &other);
AbstractFileIO(const std::string &baseDataType);
/**
* Associate this reader instance with the given MIME type.
*
* If the given MIME type has nothing but its name set, the according MIME type
* is looked up in the service registry.
*
+ * @param baseDataType
* @param mimeType The MIME type this reader can read.
* @param description A human readable description of this reader.
*
* @throws std::invalid_argument if \c mimeType is empty.
*
* @see RegisterService
*/
explicit AbstractFileIO(const std::string &baseDataType,
const CustomMimeType &mimeType,
const std::string &description);
void SetMimeType(const CustomMimeType &mimeType);
/**
* @return The mime-type this reader can handle.
*/
const CustomMimeType *GetMimeType() const;
void SetReaderDescription(const std::string &description);
std::string GetReaderDescription() const;
void SetWriterDescription(const std::string &description);
std::string GetWriterDescription() const;
void SetDefaultReaderOptions(const Options &defaultOptions);
Options GetDefaultReaderOptions() const;
void SetDefaultWriterOptions(const Options &defaultOptions);
Options GetDefaultWriterOptions() const;
/**
* \brief Set the service ranking for this file reader.
*
* Default is zero and should only be chosen differently for a reason.
* The ranking is used to determine which reader to use if several
* equivalent readers have been found.
* It may be used to replace a default reader from MITK in your own project.
* E.g. if you want to use your own reader for nrrd files instead of the default,
* implement it and give it a higher ranking than zero.
*/
void SetReaderRanking(int ranking);
int GetReaderRanking() const;
void SetWriterRanking(int ranking);
int GetWriterRanking() const;
private:
AbstractFileIO &operator=(const AbstractFileIO &other);
virtual AbstractFileIO *IOClone() const = 0;
IFileReader *ReaderClone() const override;
IFileWriter *WriterClone() const override;
};
}
#endif // MITKABSTRACTFILEIO_H
diff --git a/Modules/Core/include/mitkAbstractFileReader.h b/Modules/Core/include/mitkAbstractFileReader.h
index 83ab25d7f3..ee51b225f8 100644
--- a/Modules/Core/include/mitkAbstractFileReader.h
+++ b/Modules/Core/include/mitkAbstractFileReader.h
@@ -1,241 +1,239 @@
/*============================================================================
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 AbstractFileReader_H_HEADER_INCLUDED_C1E7E521
#define AbstractFileReader_H_HEADER_INCLUDED_C1E7E521
// Macro
#include <MitkCoreExports.h>
// MITK
#include <mitkBaseData.h>
#include <mitkIFileReader.h>
#include <mitkMimeType.h>
// Microservices
#include <usGetModuleContext.h>
#include <usServiceProperties.h>
#include <usServiceRegistration.h>
namespace us
{
struct PrototypeServiceFactory;
}
namespace mitk
{
class CustomMimeType;
/**
* @brief Base class for creating mitk::BaseData objects from files or streams.
* @ingroup IO
*/
class MITKCORE_EXPORT AbstractFileReader : public mitk::IFileReader
{
public:
void SetInput(const std::string &location) override;
void SetInput(const std::string &location, std::istream *is) override;
std::string GetInputLocation() const override;
std::istream *GetInputStream() const override;
MimeType GetRegisteredMimeType() const;
/**
* @brief Reads a path or stream and creates a list of BaseData objects.
*
* The default implementation of this method (1) calls DoRead()
* (Implement the specific reader operation there) and (2) it addes general
* meta information about the loading process.
*/
std::vector<itk::SmartPointer<BaseData>> Read() override;
DataStorage::SetOfObjects::Pointer Read(mitk::DataStorage &ds) override;
ConfidenceLevel GetConfidenceLevel() const override;
Options GetOptions() const override;
us::Any GetOption(const std::string &name) const override;
void SetOptions(const Options &options) override;
void SetOption(const std::string &name, const us::Any &value) override;
void AddProgressCallback(const ProgressCallback &callback) override;
void RemoveProgressCallback(const ProgressCallback &callback) override;
/**
* Associate this reader with the MIME type returned by the current IMimeTypeProvider
* service for the provided extension if the MIME type exists, otherwise registers
* a new MIME type when RegisterService() is called.
*
* If no MIME type for \c extension is already registered, a call to RegisterService()
* will register a new MIME type and associate this reader instance with it. The MIME
* type id can be set via SetMimeType() or it will be auto-generated using \c extension,
* having the form "application/vnd.mitk.<extension>".
*
- * @param extension The file extension (without a leading period) for which a registered
- * mime-type object is looked up and associated with this reader instance.
- * @param description A human readable description of this reader.
+ * @param context
*/
us::ServiceRegistration<IFileReader> RegisterService(us::ModuleContext *context = us::GetModuleContext());
void UnregisterService();
/**
* @return A list of files that were loaded during the last call of Read. Has to be filled by the actual reader class.
*/
std::vector< std::string > GetReadFiles() override;
protected:
/**
* @brief An input stream wrapper.
*
* If a reader can only work with input streams, use an instance
* of this class to either wrap the specified input stream or
* create a new input stream based on the input location in the
* file system.
*/
class MITKCORE_EXPORT InputStream : public std::istream
{
public:
InputStream(IFileReader *writer, std::ios_base::openmode mode = std::ios_base::in);
~InputStream() override;
private:
std::istream *m_Stream;
};
AbstractFileReader();
~AbstractFileReader() override;
AbstractFileReader(const AbstractFileReader &other);
/**
* Associate this reader instance with the given MIME type.
*
* If \c mimeType does not provide an extension list, an already
* registered mime-type object is used. Otherwise, the first entry in
* the extensions list is used to construct a mime-type name and
* register it as a new CustomMimeType service object in the default
* implementation of RegisterMimeType().
*
* @param mimeType The mime type this reader can read.
* @param description A human readable description of this reader.
*
* @throws std::invalid_argument if \c mimeType is empty.
*
* @see RegisterService
*/
explicit AbstractFileReader(const CustomMimeType &mimeType, const std::string &description);
/** Method that should be implemented by derived classes and does the real loading.
* This method is called by Read().
* This method must be implemented for each specific reader. Call
* GetInputStream() first and check for a non-null stream to read from.
* If the input stream is \c nullptr, use GetInputLocation() to read from a local
* file-system path.
*
* If the reader cannot use streams directly, use GetLocalFileName() instead.
*
* @return The created BaseData objects.
* @throws mitk::Exception
*
* @see GetLocalFileName()
* @see IFileReader::Read()
*/
virtual std::vector<itk::SmartPointer<BaseData>> DoRead() = 0;
virtual us::ServiceProperties GetServiceProperties() const;
/**
* Registers a new CustomMimeType service object.
*
* This method is called from RegisterService and the default implementation
* registers a new mime-type service object if all of the following conditions
* are true:
*
* - TODO
*
* @param context
* @return
* @throws std::invalid_argument if \c context is nullptr.
*/
virtual us::ServiceRegistration<CustomMimeType> RegisterMimeType(us::ModuleContext *context);
void SetMimeType(const CustomMimeType &mimeType);
/**
* @return The mime-type this reader can handle.
*/
const CustomMimeType *GetMimeType() const;
void SetMimeTypePrefix(const std::string &prefix);
std::string GetMimeTypePrefix() const;
void SetDescription(const std::string &description);
std::string GetDescription() const;
void SetDefaultOptions(const Options &defaultOptions);
Options GetDefaultOptions() const;
/**
* \brief Set the service ranking for this file reader.
*
* Default is zero and should only be chosen differently for a reason.
* The ranking is used to determine which reader to use if several
* equivalent readers have been found.
* It may be used to replace a default reader from MITK in your own project.
* E.g. if you want to use your own reader for nrrd files instead of the default,
* implement it and give it a higher ranking than zero.
*/
void SetRanking(int ranking);
int GetRanking() const;
/**
* @brief Get a local file name for reading.
*
* This is a convenience method for readers which cannot work natively
* with input streams. If no input stream has been been set,
* this method just returns the result of GetLocation(). However, if
* SetLocation(std::string, std::istream*) has been called with a non-null
* input stream, this method writes the contents of the stream to a temporary
* file and returns the name of the temporary file.
*
* The temporary file is deleted when either SetLocation(std::string, std::istream*)
* is called again with a different input stream or the destructor of this
* class is called.
*
* This method does not validate file names set via SetInput(std::string).
*
* @return A file path in the local file-system for reading.
*/
std::string GetLocalFileName() const;
virtual void SetDefaultDataNodeProperties(DataNode *node, const std::string &filePath);
std::vector< std::string > m_ReadFiles;
private:
AbstractFileReader &operator=(const AbstractFileReader &other);
virtual mitk::IFileReader *Clone() const = 0;
class Impl;
std::unique_ptr<Impl> d;
};
} // namespace mitk
#endif /* AbstractFileReader_H_HEADER_INCLUDED_C1E7E521 */
diff --git a/Modules/Core/include/mitkAnnotation.h b/Modules/Core/include/mitkAnnotation.h
index 2dffee3c91..91b86cf65f 100644
--- a/Modules/Core/include/mitkAnnotation.h
+++ b/Modules/Core/include/mitkAnnotation.h
@@ -1,458 +1,458 @@
/*============================================================================
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 Annotation_H
#define Annotation_H
#include "mitkServiceInterface.h"
#include "usServiceRegistration.h"
#include <MitkCoreExports.h>
#include <mitkBaseRenderer.h>
#include <mitkCommon.h>
namespace mitk
{
/** \brief Base class for all Annotation
* This class is to be implemented in order to create Annotation which are managed by a AbstractAnnotationRenderer.
* This class contains an internal Propertylist for configuring the appearance of the implemented Overlay. */
class MITKCORE_EXPORT Annotation : public itk::Object
{
public:
/** \brief Container for position and size on the display.*/
struct Bounds
{
itk::Point<double, 2> Position;
itk::Point<double, 2> Size;
};
/** \brief Base class for mapper specific rendering ressources.
*/
class MITKCORE_EXPORT BaseLocalStorage
{
public:
bool IsGenerateDataRequired(mitk::BaseRenderer *renderer, mitk::Annotation *Annotation);
inline void UpdateGenerateDataTime() { m_LastGenerateDataTime.Modified(); }
inline itk::TimeStamp &GetLastGenerateDataTime() { return m_LastGenerateDataTime; }
protected:
/** \brief timestamp of last update of stored data */
itk::TimeStamp m_LastGenerateDataTime;
};
/**
* @brief Set the property (instance of BaseProperty) with key @a propertyKey in the PropertyList
* of the @a renderer (if nullptr, use BaseRenderer-independent PropertyList). This is set-by-value.
*
* @warning Change in semantics since Aug 25th 2006. Check your usage of this method if you do
* more with properties than just call <tt>SetProperty( "key", new SomeProperty("value") )</tt>.
*
* @sa GetProperty
* @sa m_PropertyList
* @sa m_MapOfPropertyLists
*/
void SetProperty(const std::string &propertyKey, const BaseProperty::Pointer &property);
/**
* @brief Replace the property (instance of BaseProperty) with key @a propertyKey in the PropertyList
* of the @a renderer (if nullptr, use BaseRenderer-independent PropertyList). This is set-by-reference.
*
* If @a renderer is @a nullptr the property is set in the BaseRenderer-independent
* PropertyList of this Annotation.
* @sa GetProperty
* @sa m_PropertyList
* @sa m_MapOfPropertyLists
*/
void ReplaceProperty(const std::string &propertyKey, const BaseProperty::Pointer &property);
/**
* @brief Add the property (instance of BaseProperty) if it does
* not exist (or always if \a overwrite is \a true)
* with key @a propertyKey in the PropertyList
* of the @a renderer (if nullptr, use BaseRenderer-independent
* PropertyList). This is set-by-value.
*
* For \a overwrite == \a false the property is \em not changed
* if it already exists. For \a overwrite == \a true the method
* is identical to SetProperty.
*
* @sa SetProperty
* @sa GetProperty
* @sa m_PropertyList
* @sa m_MapOfPropertyLists
*/
void AddProperty(const std::string &propertyKey, const BaseProperty::Pointer &property, bool overwrite = false);
/**
* @brief Add values from another PropertyList.
*
* Overwrites values in m_PropertyList only when possible (i.e. when types are compatible).
* If you want to allow for object type changes (replacing a "visible":BoolProperty with "visible":IntProperty,
- * set the @param replace.
+ * set \c replace.
*
- * @param replace true: if @param pList contains a property "visible" of type ColorProperty and our m_PropertyList
+ * @param pList
+ * @param replace true: if \c pList contains a property "visible" of type ColorProperty and our m_PropertyList
* also has a "visible" property of a different type (e.g. BoolProperty), change the type, i.e. replace the objects
* behind the pointer.
*
* @sa SetProperty
* @sa ReplaceProperty
* @sa m_PropertyList
*/
void ConcatenatePropertyList(PropertyList *pList, bool replace = false);
/**
* @brief Get the property (instance of BaseProperty) with key @a propertyKey from the PropertyList
* of the @a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList.
*
* If @a renderer is @a nullptr or the @a propertyKey cannot be found
* in the PropertyList specific to @a renderer or is disabled there, the BaseRenderer-independent
* PropertyList of this Annotation is queried.
* @sa GetPropertyList
* @sa m_PropertyList
* @sa m_MapOfPropertyLists
*/
mitk::BaseProperty *GetProperty(const std::string &propertyKey) const;
/**
* @brief Get the property of type T with key @a propertyKey from the PropertyList
* of the @a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList.
*
* If @a renderer is @a nullptr or the @a propertyKey cannot be found
* in the PropertyList specific to @a renderer or is disabled there, the BaseRenderer-independent
* PropertyList of this Annotation is queried.
* @sa GetPropertyList
* @sa m_PropertyList
* @sa m_MapOfPropertyLists
*/
template <typename T>
bool GetProperty(itk::SmartPointer<T> &property, const std::string &propertyKey) const
{
property = dynamic_cast<T *>(GetProperty(propertyKey));
return property.IsNotNull();
}
/**
* @brief Get the property of type T with key @a propertyKey from the PropertyList
* of the @a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList.
*
* If @a renderer is @a nullptr or the @a propertyKey cannot be found
* in the PropertyList specific to @a renderer or is disabled there, the BaseRenderer-independent
* PropertyList of this Annotation is queried.
* @sa GetPropertyList
* @sa m_PropertyList
* @sa m_MapOfPropertyLists
*/
template <typename T>
bool GetProperty(T *&property, const std::string &propertyKey) const
{
property = dynamic_cast<T *>(GetProperty(propertyKey));
return property != nullptr;
}
/**
* @brief Convenience access method for GenericProperty<T> properties
* (T being the type of the second parameter)
* @return @a true property was found
*/
template <typename T>
bool GetPropertyValue(const std::string &propertyKey, T &value) const
{
GenericProperty<T> *gp = dynamic_cast<GenericProperty<T> *>(GetProperty(propertyKey));
if (gp != nullptr)
{
value = gp->GetValue();
return true;
}
return false;
}
/**
* @brief Convenience access method for bool properties (instances of
* BoolProperty)
* @return @a true property was found
*/
bool GetBoolProperty(const std::string &propertyKey, bool &boolValue) const;
/**
* @brief Convenience access method for int properties (instances of
* IntProperty)
* @return @a true property was found
*/
bool GetIntProperty(const std::string &propertyKey, int &intValue) const;
/**
* @brief Convenience access method for float properties (instances of
* FloatProperty)
* @return @a true property was found
*/
bool GetFloatProperty(const std::string &propertyKey, float &floatValue) const;
/**
* @brief Convenience access method for double properties (instances of
* DoubleProperty)
* @return @a true property was found
*/
bool GetDoubleProperty(const std::string &propertyKey, double &doubleValue) const;
/**
* @brief Convenience access method for string properties (instances of
* StringProperty)
* @return @a true property was found
*/
bool GetStringProperty(const std::string &propertyKey, std::string &string) const;
/**
* @brief Convenience method for setting int properties (instances of
* IntProperty)
*/
void SetIntProperty(const std::string &propertyKey, int intValue);
/**
* @brief Convenience method for setting int properties (instances of
* IntProperty)
*/
void SetBoolProperty(const std::string &propertyKey, bool boolValue);
/**
* @brief Convenience method for setting int properties (instances of
* IntProperty)
*/
void SetFloatProperty(const std::string &propertyKey, float floatValue);
/**
* @brief Convenience method for setting int properties (instances of
* IntProperty)
*/
void SetDoubleProperty(const std::string &propertyKey, double doubleValue);
/**
* @brief Convenience method for setting int properties (instances of
* IntProperty)
*/
void SetStringProperty(const std::string &propertyKey, const std::string &string);
/**
* @brief Convenience access method for boolean properties (instances
* of BoolProperty). Return value is the value of the property. If the property is
* not found, the value of @a defaultIsOn is returned.
*
* Thus, the return value has a different meaning than in the
* GetBoolProperty method!
* @sa GetBoolProperty
*/
bool IsOn(const std::string &propertyKey, bool defaultIsOn = true) const
{
GetBoolProperty(propertyKey, defaultIsOn);
return defaultIsOn;
}
/**
* @brief Convenience access method for accessing the name of an object (instance of
* StringProperty with property-key "name")
* @return @a true property was found
*/
bool GetName(std::string &nodeName, const std::string &propertyKey = "name") const;
/**
* @brief Extra convenience access method for accessing the name of an object (instance of
* StringProperty with property-key "name").
*
* This method does not take the renderer specific
* propertylists into account, because the name of an object should never be renderer specific.
* @returns a std::string with the name of the object (content of "name" Property).
* If there is no "name" Property, an empty string will be returned.
*/
virtual std::string GetName() const;
/**
* @brief Extra convenience access method to set the name of an object.
*
* The name will be stored in the non-renderer-specific PropertyList in a StringProperty named "name".
*/
virtual void SetName(const std::string &name);
/**
* @brief Convenience access method for color properties (instances of
* ColorProperty)
* @return @a true property was found
*/
bool GetColor(float rgb[], const std::string &propertyKey = "color") const;
/**
* @brief Convenience method for setting color properties (instances of
* ColorProperty)
*/
void SetColor(const mitk::Color &color, const std::string &propertyKey = "color");
/**
* @brief Convenience method for setting color properties (instances of
* ColorProperty)
*/
void SetColor(float red, float green, float blue, const std::string &propertyKey = "color");
/**
* @brief Convenience method for setting color properties (instances of
* ColorProperty)
*/
void SetColor(const float rgb[], const std::string &propertyKey = "color");
/**
* @brief Convenience access method for opacity properties (instances of
* FloatProperty)
* @return @a true property was found
*/
bool GetOpacity(float &opacity, const std::string &propertyKey = "opacity") const;
/**
* @brief Convenience method for setting opacity properties (instances of
* FloatProperty)
*/
void SetOpacity(float opacity, const std::string &propertyKey = "opacity");
void SetText(std::string text);
std::string GetText() const;
void SetFontSize(int fontSize);
int GetFontSize() const;
/**
* @brief Convenience access method for visibility properties (instances
* of BoolProperty with property-key "visible")
* @return @a true property was found
* @sa IsVisible
*/
bool GetVisibility(bool &visible, const std::string &propertyKey = "visible") const;
/**
* @brief Convenience access method for visibility properties (instances
* of BoolProperty). Return value is the visibility. Default is
* visible==true, i.e., true is returned even if the property (@a
* propertyKey) is not found.
*
* Thus, the return value has a different meaning than in the
* GetVisibility method!
* @sa GetVisibility
* @sa IsOn
*/
bool IsVisible(const std::string &propertyKey = "visible", bool defaultIsOn = true) const;
/**
* @brief Convenience method for setting visibility properties (instances
* of BoolProperty)
* @param visible If set to true, the data will be rendered. If false, the render will skip this data.
- * @param renderer Specify a renderer if the visibility shall be specific to a renderer
- * @param propertykey Can be used to specify a user defined name of the visibility propery.
+ * @param propertyKey Can be used to specify a user defined name of the visibility propery.
*/
void SetVisibility(bool visible, const std::string &propertyKey = "visible");
/** \brief Adds the Annotation to the specified renderer. Update Annotation should be called soon in order to apply
* all
* properties*/
virtual void AddToBaseRenderer(BaseRenderer *renderer) = 0;
/** \brief Adds the Annotation to the specified renderer. Update Annotation should be called soon in order to apply
* all
* properties*/
virtual void AddToRenderer(BaseRenderer *renderer, vtkRenderer *vtkrenderer) = 0;
/** \brief Removes the Annotation from the specified renderer. It is not visible anymore then.*/
virtual void RemoveFromBaseRenderer(BaseRenderer *renderer) = 0;
/** \brief Removes the Annotation from the specified renderer. It is not visible anymore then.*/
virtual void RemoveFromRenderer(BaseRenderer *renderer, vtkRenderer *vtkrenderer) = 0;
/** \brief Applies all properties and should be called before the rendering procedure.*/
virtual void Update(BaseRenderer *renderer) = 0;
/** \brief Returns position and size of the Annotation on the display.*/
virtual Bounds GetBoundsOnDisplay(BaseRenderer *renderer) const;
/** \brief Sets position and size of the Annotation on the display.*/
virtual void SetBoundsOnDisplay(BaseRenderer *renderer, const Bounds &);
void SetForceInForeground(bool forceForeground);
bool IsForceInForeground() const;
PropertyList *GetPropertyList() const;
/**
*\brief Returns the id that this device is registered with. The id will only be valid, if the
* Annotation has been registered using RegisterAsMicroservice().
*/
std::string GetMicroserviceID();
/**
*\brief These Constants are used in conjunction with Microservices
*/
static const std::string US_INTERFACE_NAME;
static const std::string US_PROPKEY_AnnotationNAME;
static const std::string US_PROPKEY_ID;
static const std::string US_PROPKEY_MODIFIED;
static const std::string US_PROPKEY_RENDERER_ID;
static const std::string US_PROPKEY_AR_ID;
/**
*\brief Registers this object as a Microservice, making it available to every module and/or plugin.
* To unregister, call UnregisterMicroservice().
*/
virtual void RegisterAsMicroservice(us::ServiceProperties props);
/**
*\brief Registers this object as a Microservice, making it available to every module and/or plugin.
*/
virtual void UnRegisterMicroservice();
void AnnotationModified();
mitkClassMacroItkParent(Annotation, itk::Object);
protected:
/** \brief explicit constructor which disallows implicit conversions */
Annotation();
/** \brief virtual destructor in order to derive from this class */
~Annotation() override;
/**
* @brief BaseRenderer-independent PropertyList
*
* Properties herein can be overwritten specifically for each BaseRenderer
* by the BaseRenderer-specific properties defined in m_MapOfPropertyLists.
*/
PropertyList::Pointer m_PropertyList;
/**
* @brief Timestamp of the last change of m_Data
*/
itk::TimeStamp m_DataReferenceChangedTime;
void SetUSProperty(const std::string &propertyKey, us::Any value);
private:
/** \brief render this Annotation on a foreground renderer */
bool m_ForceInForeground;
/** \brief copy constructor */
Annotation(const Annotation &);
/** \brief assignment operator */
Annotation &operator=(const Annotation &);
private:
us::ServiceRegistration<Self> m_ServiceRegistration;
unsigned long m_PropertyListModifiedObserverTag;
void PropertyListModified(const itk::Object *, const itk::EventObject &);
};
} // namespace mitk
MITK_DECLARE_SERVICE_INTERFACE(mitk::Annotation, "org.mitk.services.Annotation")
#endif // Annotation_H
diff --git a/Modules/Core/include/mitkApplyTransformMatrixOperation.h b/Modules/Core/include/mitkApplyTransformMatrixOperation.h
index 472e147166..649b2dd3f7 100644
--- a/Modules/Core/include/mitkApplyTransformMatrixOperation.h
+++ b/Modules/Core/include/mitkApplyTransformMatrixOperation.h
@@ -1,50 +1,48 @@
/*============================================================================
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 mitkApplyTransformMatrixOperation_h_Included
#define mitkApplyTransformMatrixOperation_h_Included
#include "mitkCommon.h"
#include "mitkPointOperation.h"
#include <vtkMatrix4x4.h>
#include <vtkSmartPointer.h>
namespace mitk
{
class MITKCORE_EXPORT ApplyTransformMatrixOperation : public Operation
{
public:
- //##Documentation
- //##@brief Operation that applies a new vtk transform matrix.
- //##
- //## @param operationType is the type of the operation (see mitkOperation.h; e.g. move or add; Information for
- // StateMachine::ExecuteOperation());
- //## @param matrix is the vtk 4x4 vtk matrix of the transformation
- //## @param refPoint is the reference point for realigning the plane stack
-
+ /** @brief Operation that applies a new vtk transform matrix.
+ *
+ * @param operationType is the type of the operation (see mitkOperation.h; e.g. move or add; Information for StateMachine::ExecuteOperation());
+ * @param matrix is the vtk 4x4 vtk matrix of the transformation
+ * @param refPoint is the reference point for realigning the plane stack
+ */
ApplyTransformMatrixOperation(OperationType operationType,
vtkSmartPointer<vtkMatrix4x4> matrix,
mitk::Point3D refPoint);
~ApplyTransformMatrixOperation() override;
vtkSmartPointer<vtkMatrix4x4> GetMatrix();
mitk::Point3D GetReferencePoint();
private:
vtkSmartPointer<vtkMatrix4x4> m_vtkMatrix;
mitk::Point3D m_referencePoint;
};
} // namespace mitk
#endif
diff --git a/Modules/Core/include/mitkArray.h b/Modules/Core/include/mitkArray.h
index 73d6b34d26..7709718692 100644
--- a/Modules/Core/include/mitkArray.h
+++ b/Modules/Core/include/mitkArray.h
@@ -1,143 +1,143 @@
/*============================================================================
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 MITKARRAY_H_
#define MITKARRAY_H_
#include <itkFixedArray.h>
#include "mitkEqual.h"
#include "mitkNumericConstants.h"
namespace mitk
{
/**
* Methods to copy from itk::FixedArray s (like mitk::Vector and mitk::Point) into ArrayTypes and vice versa.
* ArrayTypes here are all types who implement operator[].
* The two templated methods were made free floating so you may specialize them
* for your concrete type.
*/
/**
* @brief Copies elements of an array to this Vector
* @param[in] array the array whose values will be copied into the Vector. Must be of a type which overrides the []
* operator
* @param[out] toArray the FixedArrray (e.g., mitk::Vector or mitk::Point) which should hold the elements of array.
* @attention array must be of dimension NVectorDimension!
* @attention this method implicitly converts between data types.
*/
template <typename ArrayType, typename TCoordRep, unsigned int NVectorDimension>
void FillArray(itk::FixedArray<TCoordRep, NVectorDimension> &toArray, const ArrayType &array)
{
itk::FixedArray<TCoordRep, NVectorDimension> vectorOrPoint;
for (unsigned short int var = 0; var < NVectorDimension; ++var)
{
toArray[var] = array[var];
}
}
/**
* @brief Copies elements of an array to this Vector
* @param[in] array the array whose values will be copied into the Vector. Must be of a type which overrides the []
* operator
- * @param return the FixedArrray (e.g., mitk::Vector or mitk::Point) which should hold the elements of array.
+ * @return the FixedArray (e.g., mitk::Vector or mitk::Point) which should hold the elements of array.
* @attention array must be of dimension NVectorDimension!
* @attention this method implicitly converts between data types.
*/
template <typename ArrayType, typename TCoordRep, unsigned int NVectorDimension>
itk::FixedArray<TCoordRep, NVectorDimension> FillArray(const ArrayType &array)
{
itk::FixedArray<TCoordRep, NVectorDimension> vectorOrPoint;
mitk::FillArray(vectorOrPoint, array);
return vectorOrPoint;
}
/**
* @brief Copies the elements of this into an array
* @param[in] vectorOrPoint the itk::FixedArray which shall be copied into the array. Can e.g. be of type
* mitk::Vector
* or mitk::Point
* @param[out] array the array which will hold the elements. Must be of a type which overrides the [] operator.
* @attention array must be of dimension NVectorDimension!
* @attention this method implicitly converts between data types.
*/
template <typename ArrayType, typename TCoordRep, unsigned int NVectorDimension>
void ToArray(ArrayType &array, const itk::FixedArray<TCoordRep, NVectorDimension> &vectorOrPoint)
{
for (unsigned short int var = 0; var < NVectorDimension; ++var)
{
array[var] = vectorOrPoint[var];
}
}
/**
* @brief Copies the elements of this into an array
* @param[in] vectorOrPoint the itk::FixedArray which shall be copied into the array. Can e.g. be of type
* mitk::Vector
* or mitk::Point
* @return the array which will hold the elements. Must be of a type which overrides the [] operator.
* @attention array must be of dimension NVectorDimension!
* @attention this method implicitly converts between data types.
*/
template <typename ArrayType, typename TCoordRep, unsigned int NVectorDimension>
ArrayType ToArray(const itk::FixedArray<TCoordRep, NVectorDimension> &vectorOrPoint)
{
ArrayType result;
mitk::ToArray(result, vectorOrPoint);
return result;
}
// The FillVector3D and FillVector4D methods are implemented for all common array types here
template <class Tout>
inline void FillVector3D(Tout &out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z)
{
out[0] = x;
out[1] = y;
out[2] = z;
}
template <class Tout>
inline void FillVector4D(Tout &out, mitk::ScalarType x, mitk::ScalarType y, mitk::ScalarType z, mitk::ScalarType t)
{
out[0] = x;
out[1] = y;
out[2] = z;
out[3] = t;
}
/**
* Compares two ArrayTypes of size size.
* ArrayTypes are all Objects/Types who have a [] operator. Pay attention not to set size higher
* than the actual size of the ArrayType as this will lead to unexpected results.
*/
template <typename TArrayType1, typename TArrayType2>
inline bool EqualArray(
TArrayType1 &arrayType1, TArrayType2 &arrayType2, int size, ScalarType eps = mitk::eps, bool verbose = false)
{
bool isEqual = true;
for (int var = 0; var < size; ++var)
{
isEqual = isEqual && Equal(arrayType1[var], arrayType2[var], eps);
}
ConditionalOutputOfDifference(arrayType1, arrayType2, eps, verbose, isEqual);
return isEqual;
}
}
#endif /* MITKARRAY_H_ */
diff --git a/Modules/Core/include/mitkBaseGeometry.h b/Modules/Core/include/mitkBaseGeometry.h
index 8d2e4feb85..bda3ebf7fc 100644
--- a/Modules/Core/include/mitkBaseGeometry.h
+++ b/Modules/Core/include/mitkBaseGeometry.h
@@ -1,763 +1,755 @@
/*============================================================================
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 BaseGeometry_H_HEADER_INCLUDED
#define BaseGeometry_H_HEADER_INCLUDED
#include "mitkOperationActor.h"
#include <MitkCoreExports.h>
#include <mitkCommon.h>
#include "itkScalableAffineTransform.h"
#include "mitkNumericTypes.h"
#include <itkAffineGeometryFrame.h>
#include <itkBoundingBox.h>
#include <itkIndex.h>
#include <itkQuaternionRigidTransform.h>
#include <mitkAffineTransform3D.h>
#include <mitkGeometryTransformHolder.h>
#include <vtkTransform.h>
class vtkMatrix4x4;
class vtkMatrixToLinearTransform;
class vtkLinearTransform;
namespace mitk
{
//##Documentation
//## @brief Standard 3D-BoundingBox typedef
//##
//## Standard 3D-BoundingBox typedef to get rid of template arguments (3D, type).
typedef itk::BoundingBox<unsigned long, 3, ScalarType> BoundingBox;
//##Documentation
//## @brief Standard typedef for time-bounds
typedef itk::FixedArray<ScalarType, 2> TimeBounds;
typedef itk::FixedArray<ScalarType, 3> FixedArrayType;
typedef itk::AffineGeometryFrame<ScalarType, 3> AffineGeometryFrame3D;
//##Documentation
//## @brief BaseGeometry Describes the geometry of a data object
//##
//## The class holds
//## \li a bounding box which is axes-parallel in intrinsic coordinates
//## (often integer indices of pixels), to be accessed by
//## GetBoundingBox()
//## \li a transform to convert intrinsic coordinates into a
//## world-coordinate system with coordinates in millimeters
//## and milliseconds (all are floating point values), to
//## be accessed by GetIndexToWorldTransform()
//## \li an origin and spacing to define the geometry
//##
//## BaseGeometry and its sub-classes allow converting between
//## intrinsic coordinates (called index or unit coordinates)
//## and world-coordinates (called world or mm coordinates),
//## e.g. WorldToIndex.
//## In case you need integer index coordinates, provide an
//## mitk::Index3D (or itk::Index) as target variable to
//## WorldToIndex, otherwise you will get a continuous index
//## (floating point values).
//##
//## An important sub-class is SlicedGeometry3D, which descibes
//## data objects consisting of slices, e.g., objects of type Image.
//## Conversions between world coordinates (in mm) and unit coordinates
//## (e.g., pixels in the case of an Image) can be performed.
//##
//## For more information on related classes, see \ref Geometry.
//##
//## BaseGeometry instances referring to an Image need a slightly
//## different definition of corners, see SetImageGeometry. This
//## is usualy automatically called by Image.
//##
//## BaseGeometry have to be initialized in the method GenerateOutputInformation()
//## of BaseProcess (or CopyInformation/ UpdateOutputInformation of BaseData,
//## if possible, e.g., by analyzing pic tags in Image) subclasses. See also
//## itk::ProcessObject::GenerateOutputInformation(),
//## itk::DataObject::CopyInformation() and
//## itk::DataObject::UpdateOutputInformation().
//##
//## At least, it can return the bounding box of the data object.
//##
//## The BaseGeometry class is an abstract class. The most simple implementation
//## is the sublass Geometry3D.
//##
//## Rule: everything is in mm (ms) if not stated otherwise.
//## @ingroup Geometry
class MITKCORE_EXPORT BaseGeometry : public itk::Object, public OperationActor
{
public:
mitkClassMacroItkParent(BaseGeometry, itk::Object);
itkCloneMacro(Self);
// ********************************** TypeDef **********************************
typedef GeometryTransformHolder::TransformType TransformType;
typedef itk::BoundingBox<unsigned long, 3, ScalarType> BoundingBoxType;
typedef BoundingBoxType::BoundsArrayType BoundsArrayType;
typedef BoundingBoxType::Pointer BoundingBoxPointer;
// ********************************** Origin, Spacing **********************************
//##Documentation
//## @brief Get the origin, e.g. the upper-left corner of the plane
const Point3D GetOrigin() const;
//##Documentation
//## @brief Set the origin, i.e. the upper-left corner of the plane
//##
void SetOrigin(const Point3D &origin);
//##Documentation
//## @brief Get the spacing (size of a pixel).
//##
const mitk::Vector3D GetSpacing() const;
//##Documentation
//## @brief Set the spacing (m_Spacing).
//##
//##The spacing is also changed in the IndexToWorldTransform.
void SetSpacing(const mitk::Vector3D &aSpacing, bool enforceSetSpacing = false);
//##Documentation
//## @brief Get the origin as VnlVector
//##
//## \sa GetOrigin
VnlVector GetOriginVnl() const;
// ********************************** other functions **********************************
//##Documentation
//## @brief Get the DICOM FrameOfReferenceID referring to the
//## used world coordinate system
itkGetConstMacro(FrameOfReferenceID, unsigned int);
//##Documentation
//## @brief Set the DICOM FrameOfReferenceID referring to the
//## used world coordinate system
itkSetMacro(FrameOfReferenceID, unsigned int);
itkGetConstMacro(IndexToWorldTransformLastModified, unsigned long);
//##Documentation
//## @brief Overload of function Modified() to prohibit several calls of Modified() using the ModifiedLock class.
//##
//## For the use of Modified(), see class ModifiedLock.
void Modified() const override;
friend class ModifiedLock;
//##Documentation
//## @brief Is this BaseGeometry in a state that is valid?
//##
//## This function returns always true in the BaseGeometry class. Other implementations are possible in subclasses.
virtual bool IsValid() const;
// ********************************** Initialize **********************************
//##Documentation
//## @brief Initialize the BaseGeometry
void Initialize();
void InitializeGeometry(Self *newGeometry) const;
// ********************************** Transformations Set/Get **********************************
//##Documentation
//## @brief Get the transformation used to convert from index
//## to world coordinates
mitk::AffineTransform3D *GetIndexToWorldTransform();
//##Documentation
//## @brief Get the transformation used to convert from index
//## to world coordinates
const mitk::AffineTransform3D *GetIndexToWorldTransform() const;
//## @brief Set the transformation used to convert from index
//## to world coordinates. The spacing of the new transform is
//## copied to m_spacing.
void SetIndexToWorldTransform(mitk::AffineTransform3D *transform);
//##Documentation
//## @brief Convenience method for setting the ITK transform
//## (m_IndexToWorldTransform) via an vtkMatrix4x4.The spacing of
//## the new transform is copied to m_spacing.
//## \sa SetIndexToWorldTransform
void SetIndexToWorldTransformByVtkMatrix(vtkMatrix4x4 *vtkmatrix);
//## @brief Set the transformation used to convert from index
//## to world coordinates.This function keeps the original spacing.
void SetIndexToWorldTransformWithoutChangingSpacing(mitk::AffineTransform3D *transform);
//##Documentation
//## @brief Convenience method for setting the ITK transform
//## (m_IndexToWorldTransform) via an vtkMatrix4x4. This function keeps the original spacing.
//## \sa SetIndexToWorldTransform
void SetIndexToWorldTransformByVtkMatrixWithoutChangingSpacing(vtkMatrix4x4 *vtkmatrix);
//## Get the Vtk Matrix which describes the transform.
vtkMatrix4x4 *GetVtkMatrix();
//##Documentation
//## @brief Get the m_IndexToWorldTransform as a vtkLinearTransform
vtkLinearTransform *GetVtkTransform() const;
//##Documentation
//## @brief Set the transform to identity, the spacing to 1 and origin to 0
//##
void SetIdentity();
// ********************************** Transformations **********************************
//##Documentation
//## @brief Compose new IndexToWorldTransform with a given transform.
//##
//## This method composes m_IndexToWorldTransform with another transform,
//## modifying self to be the composition of self and other.
//## If the argument pre is true, then other is precomposed with self;
//## that is, the resulting transformation consists of first applying
//## other to the source, followed by self. If pre is false or omitted,
//## then other is post-composed with self; that is the resulting
//## transformation consists of first applying self to the source,
//## followed by other.
//## This method also changes m_spacing.
void Compose(const TransformType *other, bool pre = false);
//##Documentation
//## @brief Compose new IndexToWorldTransform with a given vtkMatrix4x4.
//##
//## Converts the vtkMatrix4x4 into a itk-transform and calls the previous method.
void Compose(const vtkMatrix4x4 *vtkmatrix, bool pre = false);
//##Documentation
//## @brief Translate the origin by a vector
//##
void Translate(const Vector3D &vector);
//##Documentation
//##@brief executes affine operations (translate, rotate, scale)
void ExecuteOperation(Operation *operation) override;
//##Documentation
//## @brief Convert world coordinates (in mm) of a \em point to (continuous!) index coordinates
//## \warning If you need (discrete) integer index coordinates (e.g., for iterating easily over an image),
//## use WorldToIndex(const mitk::Point3D& pt_mm, itk::Index<VIndexDimension> &index).
//## For further information about coordinates types, please see the Geometry documentation
void WorldToIndex(const mitk::Point3D &pt_mm, mitk::Point3D &pt_units) const;
//##Documentation
//## @brief Convert world coordinates (in mm) of a \em vector
//## \a vec_mm to (continuous!) index coordinates.
//## For further information about coordinates types, please see the Geometry documentation
void WorldToIndex(const mitk::Vector3D &vec_mm, mitk::Vector3D &vec_units) const;
//##Documentation
//## @brief Convert world coordinates (in mm) of a \em point to (discrete!) index coordinates.
//## This method rounds to integer indices!
//## For further information about coordinates types, please see the Geometry documentation
template <unsigned int VIndexDimension>
void WorldToIndex(const mitk::Point3D &pt_mm, itk::Index<VIndexDimension> &index) const
{
typedef itk::Index<VIndexDimension> IndexType;
mitk::Point3D pt_units;
this->WorldToIndex(pt_mm, pt_units);
int i, dim = index.GetIndexDimension();
if (dim > 3)
{
index.Fill(0);
dim = 3;
}
for (i = 0; i < dim; ++i)
{
index[i] = itk::Math::RoundHalfIntegerUp<typename IndexType::IndexValueType>(pt_units[i]);
}
}
//##Documentation
//## @brief Convert (continuous or discrete) index coordinates of a \em vector
//## \a vec_units to world coordinates (in mm)
//## For further information about coordinates types, please see the Geometry documentation
void IndexToWorld(const mitk::Vector3D &vec_units, mitk::Vector3D &vec_mm) const;
//##Documentation
//## @brief Convert (continuous or discrete) index coordinates of a \em point to world coordinates (in mm)
//## For further information about coordinates types, please see the Geometry documentation
void IndexToWorld(const mitk::Point3D &pt_units, mitk::Point3D &pt_mm) const;
//##Documentation
//## @brief Convert (discrete) index coordinates of a \em point to world coordinates (in mm)
//## For further information about coordinates types, please see the Geometry documentation
template <unsigned int VIndexDimension>
void IndexToWorld(const itk::Index<VIndexDimension> &index, mitk::Point3D &pt_mm) const
{
mitk::Point3D pt_units;
pt_units.Fill(0);
int i, dim = index.GetIndexDimension();
if (dim > 3)
{
dim = 3;
}
for (i = 0; i < dim; ++i)
{
pt_units[i] = index[i];
}
IndexToWorld(pt_units, pt_mm);
}
//##Documentation
//## @brief Convert (continuous or discrete) index coordinates of a \em vector
//## \a vec_units to world coordinates (in mm)
//## @deprecated First parameter (Point3D) is not used. If possible, please use void IndexToWorld(const
// mitk::Vector3D& vec_units, mitk::Vector3D& vec_mm) const.
//## For further information about coordinates types, please see the Geometry documentation
void IndexToWorld(const mitk::Point3D &atPt3d_units, const mitk::Vector3D &vec_units, mitk::Vector3D &vec_mm) const;
//##Documentation
//## @brief Convert world coordinates (in mm) of a \em vector
//## \a vec_mm to (continuous!) index coordinates.
//## @deprecated First parameter (Point3D) is not used. If possible, please use void WorldToIndex(const
// mitk::Vector3D& vec_mm, mitk::Vector3D& vec_units) const.
//## For further information about coordinates types, please see the Geometry documentation
void WorldToIndex(const mitk::Point3D &atPt3d_mm, const mitk::Vector3D &vec_mm, mitk::Vector3D &vec_units) const;
//##Documentation
//## @brief Deprecated for use with ITK version 3.10 or newer.
//## Convert ITK physical coordinates of a \em point (in mm,
//## but without a rotation) into MITK world coordinates (in mm)
//##
//## For more information, see WorldToItkPhysicalPoint.
template <class TCoordRep>
void ItkPhysicalPointToWorld(const itk::Point<TCoordRep, 3> &itkPhysicalPoint, mitk::Point3D &pt_mm) const
{
mitk::vtk2itk(itkPhysicalPoint, pt_mm);
}
//##Documentation
//## @brief Deprecated for use with ITK version 3.10 or newer.
//## Convert world coordinates (in mm) of a \em point to
//## ITK physical coordinates (in mm, but without a possible rotation)
//##
//## This method is useful if you have want to access an mitk::Image
//## via an itk::Image. ITK v3.8 and older did not support rotated (tilted)
//## images, i.e., ITK images are always parallel to the coordinate axes.
//## When accessing a (possibly rotated) mitk::Image via an itk::Image
//## the rotational part of the transformation in the BaseGeometry is
//## simply discarded; in other word: only the origin and spacing is
//## used by ITK, not the complete matrix available in MITK.
//## With WorldToItkPhysicalPoint you can convert an MITK world
//## coordinate (including the rotation) into a coordinate that
//## can be used with the ITK image as a ITK physical coordinate
//## (excluding the rotation).
template <class TCoordRep>
void WorldToItkPhysicalPoint(const mitk::Point3D &pt_mm, itk::Point<TCoordRep, 3> &itkPhysicalPoint) const
{
mitk::vtk2itk(pt_mm, itkPhysicalPoint);
}
// ********************************** BoundingBox **********************************
/** Get the bounding box */
itkGetConstObjectMacro(BoundingBox, BoundingBoxType);
// a bit of a misuse, but we want only doxygen to see the following:
#ifdef DOXYGEN_SKIP
//##Documentation
//## @brief Get bounding box (in index/unit coordinates)
itkGetConstObjectMacro(BoundingBox, BoundingBoxType);
//##Documentation
//## @brief Get bounding box (in index/unit coordinates) as a BoundsArrayType
const BoundsArrayType GetBounds() const;
#endif
const BoundsArrayType GetBounds() const;
//##Documentation
//## \brief Set the bounding box (in index/unit coordinates)
//##
//## Only possible via the BoundsArray to make clear that a
//## copy of the bounding-box is stored, not a reference to it.
void SetBounds(const BoundsArrayType &bounds);
//##Documentation
//## @brief Set the bounding box (in index/unit coordinates) via a float array
void SetFloatBounds(const float bounds[6]);
//##Documentation
//## @brief Set the bounding box (in index/unit coordinates) via a double array
void SetFloatBounds(const double bounds[6]);
//##Documentation
//## @brief Get a VnlVector along bounding-box in the specified
//## @a direction, length is spacing
//##
//## \sa GetAxisVector
VnlVector GetMatrixColumn(unsigned int direction) const;
//##Documentation
//## @brief Calculates a bounding-box around the geometry relative
//## to a coordinate system defined by a transform
//##
mitk::BoundingBox::Pointer CalculateBoundingBoxRelativeToTransform(const mitk::AffineTransform3D *transform) const;
//##Documentation
//## @brief Set the time bounds (in ms)
// void SetTimeBounds(const TimeBounds& timebounds);
// ********************************** Geometry **********************************
#ifdef DOXYGEN_SKIP
//##Documentation
//## @brief Get the extent of the bounding box (in index/unit coordinates)
//##
//## To access the extent in mm use GetExtentInMM
ScalarType GetExtent(unsigned int direction) const;
#endif
/** Get the extent of the bounding box */
ScalarType GetExtent(unsigned int direction) const;
//##Documentation
//## @brief Get the extent of the bounding-box in the specified @a direction in mm
//##
//## Equals length of GetAxisVector(direction).
ScalarType GetExtentInMM(int direction) const;
//##Documentation
//## @brief Get vector along bounding-box in the specified @a direction in mm
//##
//## The length of the vector is the size of the bounding-box in the
//## specified @a direction in mm
//## \sa GetMatrixColumn
Vector3D GetAxisVector(unsigned int direction) const;
//##Documentation
//## @brief Checks, if the given geometry can be converted to 2D without information loss
//## e.g. when a 2D image is saved, the matrix is usually cropped to 2x2, and when you load it back to MITK
//## it will be filled with standard values. This function checks, if information would be lost during this
//## procedure
virtual bool Is2DConvertable();
//##Documentation
//## @brief Get the center of the bounding-box in mm
//##
Point3D GetCenter() const;
//##Documentation
//## @brief Get the squared length of the diagonal of the bounding-box in mm
//##
double GetDiagonalLength2() const;
//##Documentation
//## @brief Get the length of the diagonal of the bounding-box in mm
//##
double GetDiagonalLength() const;
//##Documentation
//## @brief Get the position of the corner number \a id (in world coordinates)
//##
//## See SetImageGeometry for how a corner is defined on images.
Point3D GetCornerPoint(int id) const;
//##Documentation
//## @brief Get the position of a corner (in world coordinates)
//##
//## See SetImageGeometry for how a corner is defined on images.
Point3D GetCornerPoint(bool xFront = true, bool yFront = true, bool zFront = true) const;
//##Documentation
//## @brief Set the extent of the bounding-box in the specified @a direction in mm
//##
//## @note This changes the matrix in the transform, @a not the bounds, which are given in units!
void SetExtentInMM(int direction, ScalarType extentInMM);
//##Documentation
//## @brief Test whether the point \a p (world coordinates in mm) is
//## inside the bounding box
bool IsInside(const mitk::Point3D &p) const;
//##Documentation
//## @brief Test whether the point \a p ((continous!)index coordinates in units) is
//## inside the bounding box
bool IsIndexInside(const mitk::Point3D &index) const;
//##Documentation
//## @brief Convenience method for working with ITK indices
template <unsigned int VIndexDimension>
bool IsIndexInside(const itk::Index<VIndexDimension> &index) const
{
int i, dim = index.GetIndexDimension();
Point3D pt_index;
pt_index.Fill(0);
for (i = 0; i < dim; ++i)
{
pt_index[i] = index[i];
}
return IsIndexInside(pt_index);
}
// ********************************* Image Geometry ********************************
//##Documentation
//## @brief When switching from an Image Geometry to a normal Geometry (and the other way around), you have to
//change
// the origin as well (See Geometry Documentation)! This function will change the "isImageGeometry" bool flag and
// changes the origin respectively.
virtual void ChangeImageGeometryConsideringOriginOffset(const bool isAnImageGeometry);
//##Documentation
//## @brief Is this an ImageGeometry?
//##
//## For more information, see SetImageGeometry
itkGetConstMacro(ImageGeometry, bool)
//##Documentation
//## @brief Define that this BaseGeometry is refering to an Image
//##
//## A geometry referring to an Image needs a slightly different
//## definition of the position of the corners (see GetCornerPoint).
//## The position of a voxel is defined by the position of its center.
//## If we would use the origin (position of the (center of) the first
//## voxel) as a corner and display this point, it would seem to be
//## \em not at the corner but a bit within the image. Even worse for
//## the opposite corner of the image: here the corner would appear
//## outside the image (by half of the voxel diameter). Thus, we have
//## to correct for this and to be able to do that, we need to know
//## that the BaseGeometry is referring to an Image.
itkSetMacro(ImageGeometry, bool);
itkBooleanMacro(ImageGeometry);
const GeometryTransformHolder *GetGeometryTransformHolder() const;
protected:
// ********************************** Constructor **********************************
BaseGeometry();
BaseGeometry(const BaseGeometry &other);
~BaseGeometry() override;
- //##Documentation
- //## @brief clones the geometry
- //##
- //## Overwrite in all sub-classes.
- //## Normally looks like:
- //## \code
- //## Self::Pointer newGeometry = new Self(*this);
- //## newGeometry->UnRegister();
- //## return newGeometry.GetPointer();
- //## \endcode
itk::LightObject::Pointer InternalClone() const override = 0;
void PrintSelf(std::ostream &os, itk::Indent indent) const override;
static const std::string GetTransformAsString(TransformType *transformType);
itkGetConstMacro(NDimensions, unsigned int);
bool IsBoundingBoxNull() const;
bool IsIndexToWorldTransformNull() const;
void SetVtkMatrixDeepCopy(vtkTransform *vtktransform);
void _SetSpacing(const mitk::Vector3D &aSpacing, bool enforceSetSpacing = false);
//##Documentation
//## @brief PreSetSpacing
//##
//## These virtual function allows a different beahiour in subclasses.
//## Do implement them in every subclass of BaseGeometry. If not needed, use
//## {Superclass::PreSetSpacing();};
virtual void PreSetSpacing(const mitk::Vector3D & /*aSpacing*/){};
//##Documentation
//## @brief CheckBounds
//##
//## This function is called in SetBounds. Assertions can be implemented in this function (see PlaneGeometry.cpp).
//## If you implement this function in a subclass, make sure, that all classes were your class inherits from
//## have an implementation of CheckBounds
//## (e.g. inheritance BaseGeometry <- A <- B. Implementation of CheckBounds in class B needs implementation in A as
// well!)
virtual void CheckBounds(const BoundsArrayType & /*bounds*/){};
//##Documentation
//## @brief CheckIndexToWorldTransform
//##
//## This function is called in SetIndexToWorldTransform. Assertions can be implemented in this function (see
// PlaneGeometry.cpp).
//## In Subclasses of BaseGeometry, implement own conditions or call Superclass::CheckBounds(bounds);.
virtual void CheckIndexToWorldTransform(mitk::AffineTransform3D * /*transform*/){};
private:
GeometryTransformHolder *m_GeometryTransform;
void InitializeGeometryTransformHolder(const BaseGeometry *otherGeometry);
//##Documentation
//## @brief Bounding Box, which is axes-parallel in intrinsic coordinates
//## (often integer indices of pixels)
BoundingBoxPointer m_BoundingBox;
unsigned int m_FrameOfReferenceID;
// mitk::TimeBounds m_TimeBounds;
static const unsigned int m_NDimensions = 3;
mutable TransformType::Pointer m_InvertedTransform;
mutable unsigned long m_IndexToWorldTransformLastModified;
bool m_ImageGeometry;
//##Documentation
//## @brief ModifiedLockFlag is used to prohibit the call of Modified()
//##
//## For the use of this Flag, see class ModifiedLock. This flag should only be set
//## by the ModifiedLock class!
bool m_ModifiedLockFlag;
//##Documentation
//## @brief ModifiedcalledFlag is used to collect calls of Modified().
//##
//## For the use of this Flag, see class ModifiedLock. This flag should only be set
//## by the Modified() function!
mutable bool m_ModifiedCalledFlag;
};
// ********************************** Equal Functions **********************************
//
// Static compare functions mainly for testing
//
/**
* @brief Equal A function comparing two geometries for beeing identical.
*
* @ingroup MITKTestingAPI
*
* The function compares the spacing, origin, axisvectors, extents, the matrix of the
* IndexToWorldTransform (elementwise), the bounding (elementwise) and the ImageGeometry flag.
*
* The parameter eps is a tolarence value for all methods which are internally used for comparion.
* If you want to use different tolerance values for different parts of the geometry, feel free to use
* the other comparison methods and write your own implementation of Equal.
* @param rightHandSide Compare this against leftHandSide.
* @param leftHandSide Compare this against rightHandSide.
* @param coordinateEps Tolerance for comparison of all spatial aspects (spacing, origin and grid alignment).
* You can use mitk::eps in most cases.
* @param directionEps Tolerance for comparison of all directional aspects (axis). You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return True, if all comparison are true. False in any other case.
*/
MITKCORE_EXPORT bool Equal(const mitk::BaseGeometry& leftHandSide,
const mitk::BaseGeometry& rightHandSide,
ScalarType coordinateEps,
ScalarType directionEps,
bool verbose = false);
/**
* @brief Equal A function comparing two geometries for beeing identical.
*
* @ingroup MITKTestingAPI
*
- * @overload This is an overloaded version that uses a single tolerance for spatial and directional aspects. For more details,
+ * This is an overloaded version that uses a single tolerance for spatial and directional aspects. For more details,
* see the other overloaded version.
+ *
* @param rightHandSide Compare this against leftHandSide.
* @param leftHandSide Compare this against rightHandSide.
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return True, if all comparison are true. False in any other case.
*/
MITKCORE_EXPORT bool Equal(const mitk::BaseGeometry &leftHandSide,
const mitk::BaseGeometry &rightHandSide,
ScalarType eps = mitk::eps,
bool verbose = false);
/**
* @brief Equal A function comparing two transforms (TransformType) for beeing identical.
*
* @ingroup MITKTestingAPI
*
* The function compares the IndexToWorldTransform (elementwise).
*
* The parameter eps is a tolarence value for all methods which are internally used for comparion.
* @param rightHandSide Compare this against leftHandSide.
* @param leftHandSide Compare this against rightHandSide.
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return True, if all comparison are true. False in any other case.
*/
MITKCORE_EXPORT bool Equal(const mitk::BaseGeometry::TransformType &leftHandSide,
const mitk::BaseGeometry::TransformType &rightHandSide,
ScalarType eps,
bool verbose);
/**
* @brief Equal A function comparing two bounding boxes (BoundingBoxType) for beeing identical.
*
* @ingroup MITKTestingAPI
*
* The function compares the bounds (elementwise).
*
* The parameter eps is a tolarence value for all methods which are internally used for comparion.
* @param rightHandSide Compare this against leftHandSide.
* @param leftHandSide Compare this against rightHandSide.
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return True, if all comparison are true. False in any other case.
*/
MITKCORE_EXPORT bool Equal(const mitk::BaseGeometry::BoundingBoxType &leftHandSide,
const mitk::BaseGeometry::BoundingBoxType &rightHandSide,
ScalarType eps,
bool verbose);
/**
* @brief A function checks if a test geometry is a sub geometry of
* a given reference geometry.
*
* Sub geometry means that both geometries have the same voxel grid (same spacing, same axes,
* orgin is on voxel grid), but the bounding box of the checked geometry is contained or equal
* to the bounding box of the reference geometry.\n
* By this definition equal geometries are always sub geometries of each other.
*
* The function checks the spacing, origin, axis vectors, extents, the matrix of the
* IndexToWorldTransform (elementwise), the bounding (elementwise) and the ImageGeometry flag.
*
* The parameter eps is a tolerance value for all methods which are internally used for comparison.
* @param testGeo Geometry that should be checked if it is a sub geometry of referenceGeo.
* @param referenceGeo Geometry that should contain testedGeometry as sub geometry.
* @param coordinateEps Tolerance for comparison of all spatial aspects (spacing, origin and grid alignment).
* You can use mitk::eps in most cases.
* @param directionEps Tolerance for comparison of all directional aspects (axis). You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return True, if all comparisons are true. False otherwise.
*/
MITKCORE_EXPORT bool IsSubGeometry(const mitk::BaseGeometry& testGeo,
const mitk::BaseGeometry& referenceGeo,
ScalarType coordinateEps,
ScalarType directionEps,
bool verbose = false);
/**
* @brief A function checks if a test geometry is a sub geometry of
* a given reference geometry.
*
- * @overload This is a overloaded version that uses a single tolerance for spatial and directional aspects. For more details,
+ * This is a overloaded version that uses a single tolerance for spatial and directional aspects. For more details,
* see the other overloaded version.
+ *
* @param testGeo Geometry that should be checked if it is a sub geometry of referenceGeo.
* @param referenceGeo Geometry that should contain testedGeometry as sub geometry.
* @param eps Tolarence for comparison (both spatial and directional). You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return True, if all comparison are true. False otherwise.
*/
MITKCORE_EXPORT bool IsSubGeometry(const mitk::BaseGeometry& testGeo,
const mitk::BaseGeometry& referenceGeo,
ScalarType eps = mitk::eps,
bool verbose = false);
} // namespace mitk
#endif /* BaseGeometry_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkBaseRenderer.h b/Modules/Core/include/mitkBaseRenderer.h
index 5b14a4ec2d..b50a10e5c1 100644
--- a/Modules/Core/include/mitkBaseRenderer.h
+++ b/Modules/Core/include/mitkBaseRenderer.h
@@ -1,532 +1,532 @@
/*============================================================================
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 BASERENDERER_H_HEADER_INCLUDED_C1CCA0F4
#define BASERENDERER_H_HEADER_INCLUDED_C1CCA0F4
#include "mitkCameraRotationController.h"
#include "mitkDataStorage.h"
#include "mitkPlaneGeometry.h"
#include "mitkPlaneGeometryData.h"
#include "mitkSliceNavigationController.h"
#include "mitkTimeGeometry.h"
#include "mitkBindDispatcherInteractor.h"
#include "mitkDispatcher.h"
#include <vtkRenderWindow.h>
#include <vtkRenderer.h>
#include <map>
#include <set>
// DEPRECATED
#include <mitkTimeSlicedGeometry.h>
namespace mitk
{
class NavigationController;
class SliceNavigationController;
class CameraRotationController;
class CameraController;
class DataStorage;
class Mapper;
class BaseLocalStorageHandler;
class KeyEvent;
//##Documentation
//## @brief Organizes the rendering process
//##
//## Organizes the rendering process. A Renderer contains a reference to a
//## DataStorage and asks the mappers of the data objects to render
//## the data into the renderwindow it is associated to.
//##
//## \#Render() checks if rendering is currently allowed by calling
//## RenderWindow::PrepareRendering(). Initialization of a rendering context
//## can also be performed in this method.
//##
//## The actual rendering code has been moved to \#Repaint()
//## Both \#Repaint() and \#Update() are declared protected now.
//##
//## Note: Separation of the Repaint and Update processes (rendering vs
//## creating a vtk prop tree) still needs to be worked on. The whole
//## rendering process also should be reworked to use VTK based classes for
//## both 2D and 3D rendering.
//## @ingroup Renderer
class MITKCORE_EXPORT BaseRenderer : public itk::Object
{
public:
typedef std::map<vtkRenderWindow *, BaseRenderer *> BaseRendererMapType;
static BaseRendererMapType baseRendererMap;
static BaseRenderer *GetInstance(vtkRenderWindow *renWin);
static void AddInstance(vtkRenderWindow *renWin, BaseRenderer *baseRenderer);
static void RemoveInstance(vtkRenderWindow *renWin);
static BaseRenderer *GetByName(const std::string &name);
static vtkRenderWindow *GetRenderWindowByName(const std::string &name);
#pragma GCC visibility push(default)
itkEventMacro(RendererResetEvent, itk::AnyEvent);
#pragma GCC visibility pop
/** Standard class typedefs. */
mitkClassMacroItkParent(BaseRenderer, itk::Object);
BaseRenderer(const char *name = nullptr, vtkRenderWindow *renWin = nullptr);
//##Documentation
//## @brief MapperSlotId defines which kind of mapper (e.g. 2D or 3D) should be used.
typedef int MapperSlotId;
enum StandardMapperSlot
{
Standard2D = 1,
Standard3D = 2
};
//##Documentation
//## @brief Possible view directions for render windows.
enum class ViewDirection
{
AXIAL = 0,
SAGITTAL,
CORONAL,
THREE_D
};
virtual void SetDataStorage(DataStorage *storage); ///< set the datastorage that will be used for rendering
//##Documentation
//## return the DataStorage that is used for rendering
virtual DataStorage::Pointer GetDataStorage() const { return m_DataStorage.GetPointer(); }
//##Documentation
//## @brief Access the RenderWindow into which this renderer renders.
vtkRenderWindow *GetRenderWindow() const { return m_RenderWindow; }
vtkRenderer *GetVtkRenderer() const { return m_VtkRenderer; }
//##Documentation
//## @brief Returns the Dispatcher which handles Events for this BaseRenderer
Dispatcher::Pointer GetDispatcher() const;
//##Documentation
//## @brief Default mapper id to use.
static const MapperSlotId defaultMapper;
//##Documentation
//## @brief Do the rendering and flush the result.
virtual void Paint();
//##Documentation
//## @brief Initialize the RenderWindow. Should only be called from RenderWindow.
virtual void Initialize();
//##Documentation
//## @brief Called to inform the renderer that the RenderWindow has been resized.
virtual void Resize(int w, int h);
//##Documentation
//## @brief Initialize the renderer with a RenderWindow (@a renderwindow).
virtual void InitRenderer(vtkRenderWindow *renderwindow);
//##Documentation
//## @brief Set the initial size. Called by RenderWindow after it has become
//## visible for the first time.
virtual void InitSize(int w, int h);
//##Documentation
//## @brief Draws a point on the widget.
//## Should be used during conferences to show the position of the remote mouse
virtual void DrawOverlayMouse(Point2D &p2d);
//##Documentation
//## @brief Set/Get the WorldGeometry (m_WorldGeometry) for 3D and 2D rendering, that describing the
//## (maximal) area to be rendered.
//##
//## Depending of the type of the passed BaseGeometry more or less information can be extracted:
//## \li if it is a PlaneGeometry (which is a sub-class of BaseGeometry), m_CurrentWorldPlaneGeometry is
//## also set to point to it. m_WorldTimeGeometry is set to nullptr.
//## \li if it is a TimeGeometry, m_WorldTimeGeometry is also set to point to it.
//## If m_WorldTimeGeometry contains instances of SlicedGeometry3D, m_CurrentWorldPlaneGeometry is set to
//## one of geometries stored in the SlicedGeometry3D according to the value of m_Slice; otherwise
//## a PlaneGeometry describing the top of the bounding-box of the BaseGeometry is set as the
//## m_CurrentWorldPlaneGeometry.
//## \li otherwise a PlaneGeometry describing the top of the bounding-box of the BaseGeometry
//## is set as the m_CurrentWorldPlaneGeometry. m_WorldTimeGeometry is set to nullptr.
//## @todo add calculation of PlaneGeometry describing the top of the bounding-box of the BaseGeometry
//## when the passed BaseGeometry is not sliced.
//## \sa m_WorldGeometry
//## \sa m_WorldTimeGeometry
//## \sa m_CurrentWorldPlaneGeometry
virtual void SetWorldGeometry3D(const BaseGeometry *geometry);
virtual void SetWorldTimeGeometry(const mitk::TimeGeometry *geometry);
/**
* \deprecatedSince{2013_09} Please use TimeGeometry instead of TimeSlicedGeometry. For more information see
* http://www.mitk.org/Development/Refactoring%20of%20the%20Geometry%20Classes%20-%20Part%201
*/
DEPRECATED(void SetWorldGeometry3D(TimeSlicedGeometry *geometry));
itkGetConstObjectMacro(WorldTimeGeometry, TimeGeometry);
//##Documentation
//## @brief Get the current 3D-worldgeometry (m_CurrentWorldGeometry) used for 3D-rendering
itkGetConstObjectMacro(CurrentWorldGeometry, BaseGeometry);
//##Documentation
//## @brief Get the current 2D-worldgeometry (m_CurrentWorldPlaneGeometry) used for 2D-rendering
itkGetConstObjectMacro(CurrentWorldPlaneGeometry, PlaneGeometry)
/**
* \deprecatedSince{2014_10} Please use GetCurrentWorldPlaneGeometry
*/
DEPRECATED(const PlaneGeometry *GetCurrentWorldGeometry2D())
{
return GetCurrentWorldPlaneGeometry();
};
//##Documentation
//## Calculates the bounds of the DataStorage (if it contains any valid data),
//## creates a geometry from these bounds and sets it as world geometry of the renderer.
//##
//## Call this method to re-initialize the renderer to the current DataStorage
//## (e.g. after loading an additional dataset), to ensure that the view is
//## aligned correctly.
- //## \warn This is not implemented yet.
+ //## \warning This is not implemented yet.
virtual bool SetWorldGeometryToDataStorageBounds() { return false; }
//##Documentation
//## @brief Set/Get m_Slice which defines together with m_TimeStep the 2D geometry
//## stored in m_WorldTimeGeometry used as m_CurrentWorldPlaneGeometry
//##
//## \sa m_Slice
virtual void SetSlice(unsigned int slice);
itkGetConstMacro(Slice, unsigned int);
//##Documentation
//## @brief Set/Get m_TimeStep which defines together with m_Slice the 2D geometry
//## stored in m_WorldTimeGeometry used as m_CurrentWorldPlaneGeometry
//##
//## \sa m_TimeStep
virtual void SetTimeStep(unsigned int timeStep);
itkGetConstMacro(TimeStep, unsigned int);
//##Documentation
//## @brief Get the time-step of a BaseData object which
//## exists at the time of the currently displayed content
//##
//## Returns -1 or mitk::BaseData::m_TimeSteps if there
//## is no data at the current time.
//## \sa GetTimeStep, m_TimeStep
int GetTimeStep(const BaseData *data) const;
//##Documentation
//## @brief Get the time in ms of the currently displayed content
//##
//## \sa GetTimeStep, m_TimeStep
ScalarType GetTime() const;
//##Documentation
//## @brief SetWorldGeometry is called according to the geometrySliceEvent,
//## which is supposed to be a SliceNavigationController::GeometrySendEvent
virtual void SetGeometry(const itk::EventObject &geometrySliceEvent);
//##Documentation
//## @brief UpdateWorldGeometry is called to re-read the 2D geometry from the
//## slice navigation controller
virtual void UpdateGeometry(const itk::EventObject &geometrySliceEvent);
//##Documentation
//## @brief SetSlice is called according to the geometrySliceEvent,
//## which is supposed to be a SliceNavigationController::GeometrySliceEvent
virtual void SetGeometrySlice(const itk::EventObject &geometrySliceEvent);
//##Documentation
//## @brief SetTimeStep is called according to the geometrySliceEvent,
//## which is supposed to be a SliceNavigationController::GeometryTimeEvent
virtual void SetGeometryTime(const itk::EventObject &geometryTimeEvent);
//##Documentation
//## @brief Get a DataNode pointing to a data object containing the current 2D-worldgeometry
// m_CurrentWorldPlaneGeometry (for 2D rendering)
itkGetObjectMacro(CurrentWorldPlaneGeometryNode, DataNode)
/**
* \deprecatedSince{2014_10} Please use GetCurrentWorldPlaneGeometryNode
*/
DEPRECATED(DataNode *GetCurrentWorldGeometry2DNode())
{
return GetCurrentWorldPlaneGeometryNode();
};
//##Documentation
//## @brief Sets timestamp of CurrentWorldPlaneGeometry and forces so reslicing in that renderwindow
void SendUpdateSlice();
//##Documentation
//## @brief Get timestamp of last call of SetCurrentWorldPlaneGeometry
unsigned long GetCurrentWorldPlaneGeometryUpdateTime() { return m_CurrentWorldPlaneGeometryUpdateTime; }
/**
* \deprecatedSince{2014_10} Please use GetCurrentWorldPlaneGeometryUpdateTime
*/
DEPRECATED(unsigned long GetCurrentWorldGeometry2DUpdateTime())
{
return GetCurrentWorldPlaneGeometryUpdateTime();
};
//##Documentation
//## @brief Get timestamp of last change of current TimeStep
unsigned long GetTimeStepUpdateTime() { return m_TimeStepUpdateTime; }
//##Documentation
//## @brief Perform a picking: find the x,y,z world coordinate of a
//## display x,y coordinate.
//## @warning Has to be overwritten in subclasses for the 3D-case.
//##
//## Implemented here only for 2D-rendering
virtual void PickWorldPoint(const Point2D &diplayPosition, Point3D &worldPosition) const = 0;
/** \brief Determines the object (mitk::DataNode) closest to the current
* position by means of picking
*
* \warning Implementation currently empty for 2D rendering; intended to be
* implemented for 3D renderers */
virtual DataNode *PickObject(const Point2D & /*displayPosition*/, Point3D & /*worldPosition*/) const
{
return nullptr;
}
//##Documentation
//## @brief Get the MapperSlotId to use.
itkGetMacro(MapperID, MapperSlotId);
itkGetConstMacro(MapperID, MapperSlotId);
//##Documentation
//## @brief Set the MapperSlotId to use.
virtual void SetMapperID(MapperSlotId id);
virtual int *GetSize() const;
virtual int *GetViewportSize() const;
void SetSliceNavigationController(SliceNavigationController *SlicenavigationController);
itkGetObjectMacro(CameraController, CameraController);
itkGetObjectMacro(SliceNavigationController, SliceNavigationController);
itkGetObjectMacro(CameraRotationController, CameraRotationController);
itkGetMacro(EmptyWorldGeometry, bool);
//##Documentation
//## @brief Tells if the displayed region is shifted and rescaled if the render window is resized.
itkGetMacro(KeepDisplayedRegion, bool)
//##Documentation
//## @brief Tells if the displayed region should be shifted and rescaled if the render window is resized.
itkSetMacro(KeepDisplayedRegion, bool);
//##Documentation
//## @brief get the name of the Renderer
//## @note
const char *GetName() const
{
return m_Name.c_str();
}
//##Documentation
//## @brief get the x_size of the RendererWindow
//## @note
int GetSizeX() const { return GetSize()[0]; }
//##Documentation
//## @brief get the y_size of the RendererWindow
//## @note
int GetSizeY() const { return GetSize()[1]; }
const double *GetBounds() const;
void RequestUpdate();
void ForceImmediateUpdate();
/** Returns number of mappers which are visible and have level-of-detail
* rendering enabled */
unsigned int GetNumberOfVisibleLODEnabledMappers() const;
//##Documentation
//## @brief This method converts a display point to the 3D world index
//## using the geometry of the renderWindow.
void DisplayToWorld(const Point2D &displayPoint, Point3D &worldIndex) const;
//##Documentation
//## @brief This method converts a display point to the 2D world index, mapped onto the display plane
//## using the geometry of the renderWindow.
void DisplayToPlane(const Point2D &displayPoint, Point2D &planePointInMM) const;
//##Documentation
//## @brief This method converts a 3D world index to the display point
//## using the geometry of the renderWindow.
void WorldToDisplay(const Point3D &worldIndex, Point2D &displayPoint) const;
//##Documentation
//## @brief This method converts a 3D world index to the point on the viewport
//## using the geometry of the renderWindow.
void WorldToView(const Point3D &worldIndex, Point2D &viewPoint) const;
//##Documentation
//## @brief This method converts a 2D plane coordinate to the display point
//## using the geometry of the renderWindow.
void PlaneToDisplay(const Point2D &planePointInMM, Point2D &displayPoint) const;
//##Documentation
//## @brief This method converts a 2D plane coordinate to the point on the viewport
//## using the geometry of the renderWindow.
void PlaneToView(const Point2D &planePointInMM, Point2D &viewPoint) const;
double GetScaleFactorMMPerDisplayUnit() const;
Point2D GetDisplaySizeInMM() const;
Point2D GetViewportSizeInMM() const;
Point2D GetOriginInMM() const;
itkGetConstMacro(ConstrainZoomingAndPanning, bool) virtual void SetConstrainZoomingAndPanning(bool constrain);
/**
* \brief Provides (1) world coordinates for a given mouse position and (2)
* translates mousePosition to Display coordinates
* \deprecated Map2DRendererPositionTo3DWorldPosition is deprecated. Please use DisplayToWorld instead.
*/
DEPRECATED(virtual Point3D Map2DRendererPositionTo3DWorldPosition(const Point2D &mousePosition) const);
protected:
~BaseRenderer() override;
//##Documentation
//## @brief Call update of all mappers. To be implemented in subclasses.
virtual void Update() = 0;
vtkRenderWindow *m_RenderWindow;
vtkRenderer *m_VtkRenderer;
//##Documentation
//## @brief MapperSlotId to use. Defines which kind of mapper (e.g., 2D or 3D) shoud be used.
MapperSlotId m_MapperID;
//##Documentation
//## @brief The DataStorage that is used for rendering.
DataStorage::Pointer m_DataStorage;
//##Documentation
//## @brief Timestamp of last call of Update().
unsigned long m_LastUpdateTime;
//##Documentation
//## @brief CameraController for 3D rendering
//## @note preliminary.
itk::SmartPointer<CameraController> m_CameraController;
SliceNavigationController::Pointer m_SliceNavigationController;
CameraRotationController::Pointer m_CameraRotationController;
//##Documentation
//## @brief Sets m_CurrentWorldPlaneGeometry
virtual void SetCurrentWorldPlaneGeometry(const PlaneGeometry *geometry2d);
/**
* \deprecatedSince{2014_10} Please use SetCurrentWorldPlaneGeometry
*/
DEPRECATED(void SetCurrentWorldGeometry2D(PlaneGeometry *geometry2d)) { SetCurrentWorldPlaneGeometry(geometry2d); };
//##Documentation
//## @brief Sets m_CurrentWorldGeometry
virtual void SetCurrentWorldGeometry(const BaseGeometry *geometry);
private:
//##Documentation
//## m_WorldTimeGeometry is set by SetWorldGeometry if the passed BaseGeometry is a
//## TimeGeometry (or a sub-class of it). If it contains instances of SlicedGeometry3D,
//## m_Slice and m_TimeStep (set via SetSlice and SetTimeStep, respectively) define
//## which 2D geometry stored in m_WorldTimeGeometry (if available)
//## is used as m_CurrentWorldPlaneGeometry.
//## \sa m_CurrentWorldPlaneGeometry
TimeGeometry::ConstPointer m_WorldTimeGeometry;
//##Documentation
//## Pointer to the current 3D-worldgeometry.
BaseGeometry::ConstPointer m_CurrentWorldGeometry;
//##Documentation
//## Pointer to the current 2D-worldgeometry. The 2D-worldgeometry
//## describes the maximal area (2D manifold) to be rendered in case we
//## are doing 2D-rendering.
//## It is const, since we are not allowed to change it (it may be taken
//## directly from the geometry of an image-slice and thus it would be
//## very strange when suddenly the image-slice changes its geometry).
PlaneGeometry::Pointer m_CurrentWorldPlaneGeometry;
//##Documentation
//## Defines together with m_Slice which 2D geometry stored in m_WorldTimeGeometry
//## is used as m_CurrentWorldPlaneGeometry: m_WorldTimeGeometry->GetPlaneGeometry(m_Slice, m_TimeStep).
//## \sa m_WorldTimeGeometry
unsigned int m_Slice;
//##Documentation
//## Defines together with m_TimeStep which 2D geometry stored in m_WorldTimeGeometry
//## is used as m_CurrentWorldPlaneGeometry: m_WorldTimeGeometry->GetPlaneGeometry(m_Slice, m_TimeStep).
//## \sa m_WorldTimeGeometry
unsigned int m_TimeStep;
//##Documentation
//## @brief timestamp of last call of SetWorldGeometry
itk::TimeStamp m_CurrentWorldPlaneGeometryUpdateTime;
//##Documentation
//## @brief timestamp of last change of the current time step
itk::TimeStamp m_TimeStepUpdateTime;
//##Documentation
//## @brief Helper class which establishes connection between Interactors and Dispatcher via a common DataStorage.
BindDispatcherInteractor *m_BindDispatcherInteractor;
//##Documentation
//## @brief Tells if the displayed region should be shifted or rescaled if the render window is resized.
bool m_KeepDisplayedRegion;
protected:
void PrintSelf(std::ostream &os, itk::Indent indent) const override;
//##Documentation
//## Data object containing the m_CurrentWorldPlaneGeometry defined above.
PlaneGeometryData::Pointer m_CurrentWorldPlaneGeometryData;
//##Documentation
//## DataNode objects containing the m_CurrentWorldPlaneGeometryData defined above.
DataNode::Pointer m_CurrentWorldPlaneGeometryNode;
//##Documentation
//## @brief test only
unsigned long m_CurrentWorldPlaneGeometryTransformTime;
std::string m_Name;
double m_Bounds[6];
bool m_EmptyWorldGeometry;
typedef std::set<Mapper *> LODEnabledMappersType;
/** Number of mappers which are visible and have level-of-detail
* rendering enabled */
unsigned int m_NumberOfVisibleLODEnabledMappers;
// Local Storage Handling for mappers
protected:
std::list<mitk::BaseLocalStorageHandler *> m_RegisteredLocalStorageHandlers;
bool m_ConstrainZoomingAndPanning;
public:
void RemoveAllLocalStorages();
void RegisterLocalStorageHandler(mitk::BaseLocalStorageHandler *lsh);
void UnregisterLocalStorageHandler(mitk::BaseLocalStorageHandler *lsh);
};
} // namespace mitk
#endif /* BASERENDERER_H_HEADER_INCLUDED_C1CCA0F4 */
diff --git a/Modules/Core/include/mitkColorProperty.h b/Modules/Core/include/mitkColorProperty.h
index 2de38d55e9..70de0bc487 100644
--- a/Modules/Core/include/mitkColorProperty.h
+++ b/Modules/Core/include/mitkColorProperty.h
@@ -1,96 +1,96 @@
/*============================================================================
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 MITKCOLORPROPERTY_H_HEADER_INCLUDED_C17953D1
#define MITKCOLORPROPERTY_H_HEADER_INCLUDED_C17953D1
#include "mitkBaseProperty.h"
#include <MitkCoreExports.h>
#include <itkRGBPixel.h>
namespace mitk
{
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4522)
#endif
/**
* @brief Color Standard RGB color typedef (float)
*
* Standard RGB color typedef to get rid of template argument (float).
* Color range is from 0.0f to 1.0f for each component.
*
* @ingroup Property
*/
typedef itk::RGBPixel<float> Color;
/**
* @brief The ColorProperty class RGB color property
* @ingroup DataManagement
*
* @note If you want to apply the mitk::ColorProperty to an mitk::Image
* make sure to set the mitk::RenderingModeProperty to a mode which
* supports color (e.g. LEVELWINDOW_COLOR). For an example how to use
* the mitk::ColorProperty see mitkImageVtkMapper2DColorTest.cpp in
- * Core\Code\Rendering.
+ * Core/Code/Rendering.
*/
class MITKCORE_EXPORT ColorProperty : public BaseProperty
{
protected:
mitk::Color m_Color;
ColorProperty();
ColorProperty(const ColorProperty &other);
ColorProperty(const float red, const float green, const float blue);
ColorProperty(const float color[3]);
ColorProperty(const mitk::Color &color);
public:
mitkClassMacro(ColorProperty, BaseProperty);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self) mitkNewMacro1Param(ColorProperty, const float *);
mitkNewMacro1Param(ColorProperty, const mitk::Color &);
mitkNewMacro3Param(ColorProperty, const float, const float, const float);
typedef mitk::Color ValueType;
const mitk::Color &GetColor() const;
const mitk::Color &GetValue() const;
std::string GetValueAsString() const override;
void SetColor(const mitk::Color &color);
void SetValue(const mitk::Color &color);
void SetColor(float red, float green, float blue);
using BaseProperty::operator=;
private:
// purposely not implemented
ColorProperty &operator=(const ColorProperty &);
itk::LightObject::Pointer InternalClone() const override;
bool IsEqual(const BaseProperty &property) const override;
bool Assign(const BaseProperty &property) override;
};
#ifdef _MSC_VER
#pragma warning(pop)
#endif
} // namespace mitk
#endif /* MITKCOLORPROPERTY_H_HEADER_INCLUDED_C17953D1 */
diff --git a/Modules/Core/include/mitkCoreServices.h b/Modules/Core/include/mitkCoreServices.h
index 1e3f179acd..833cc313c8 100644
--- a/Modules/Core/include/mitkCoreServices.h
+++ b/Modules/Core/include/mitkCoreServices.h
@@ -1,177 +1,178 @@
/*============================================================================
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 MITKCORESERVICES_H
#define MITKCORESERVICES_H
#include "MitkCoreExports.h"
#include <mitkCommon.h>
#include <mitkLogMacros.h>
#include <mitkServiceInterface.h>
#include <usGetModuleContext.h>
#include <usModuleContext.h>
#include <usServiceReference.h>
#include <cassert>
namespace mitk
{
struct IMimeTypeProvider;
class IPropertyAliases;
class IPropertyDescriptions;
class IPropertyExtensions;
class IPropertyFilters;
class IPropertyPersistence;
class IPropertyRelations;
/**
* @brief Access MITK core services.
*
* This class can be used to conveniently access common
* MITK Core service objects. Some getter methods where implementations
* exist in the core library are guaranteed to return a non-nullptr service object.
*
* To ensure that CoreServices::Unget() is called after the caller
* has finished using a service object, you should use the CoreServicePointer
* helper class which calls Unget() when it goes out of scope:
*
* \code
* CoreServicePointer<IShaderRepository> shaderRepo(CoreServices::GetShaderRepository());
* // Do something with shaderRepo
* \endcode
*
* @see CoreServicePointer
*/
class MITKCORE_EXPORT CoreServices
{
public:
/**
* @brief Get an IPropertyAliases instance.
* @param context The module context of the module getting the service.
* @return A non-nullptr IPropertyAliases instance.
*/
static IPropertyAliases *GetPropertyAliases(us::ModuleContext *context = us::GetModuleContext());
/**
* @brief Get an IPropertyDescriptions instance.
* @param context The module context of the module getting the service.
* @return A non-nullptr IPropertyDescriptions instance.
*/
static IPropertyDescriptions *GetPropertyDescriptions(us::ModuleContext *context = us::GetModuleContext());
/**
* @brief Get an IPropertyExtensions instance.
* @param context The module context of the module getting the service.
* @return A non-nullptr IPropertyExtensions instance.
*/
static IPropertyExtensions *GetPropertyExtensions(us::ModuleContext *context = us::GetModuleContext());
/**
* @brief Get an IPropertyFilters instance.
* @param context The module context of the module getting the service.
* @return A non-nullptr IPropertyFilters instance.
*/
static IPropertyFilters *GetPropertyFilters(us::ModuleContext *context = us::GetModuleContext());
/**
* @brief Get an IPropertyPersistence instance.
* @param context The module context of the module getting the service.
* @return A non-nullptr IPropertyPersistence instance.
*/
static IPropertyPersistence *GetPropertyPersistence(us::ModuleContext *context = us::GetModuleContext());
/**
* @brief Get an IPropertyRelations instance.
* @param context The module context of the module getting the service.
* @return A non-nullptr IPropertyRelations instance.
*/
static IPropertyRelations *GetPropertyRelations(us::ModuleContext *context = us::GetModuleContext());
/**
* @brief Get an IMimeTypeProvider instance.
* @param context The module context of the module getting the service.
* @return A non-nullptr IMimeTypeProvider instance.
*/
static IMimeTypeProvider *GetMimeTypeProvider(us::ModuleContext *context = us::GetModuleContext());
/**
* @brief Unget a previously acquired service instance.
* @param service The service instance to be released.
+ * @param context
* @return \c true if ungetting the service was successful, \c false otherwise.
*/
template <class S>
static bool Unget(S *service, us::ModuleContext *context = us::GetModuleContext())
{
return Unget(context, us_service_interface_iid<S>(), service);
}
private:
static bool Unget(us::ModuleContext *context, const std::string &interfaceId, void *service);
// purposely not implemented
CoreServices();
CoreServices(const CoreServices &);
CoreServices &operator=(const CoreServices &);
};
/**
* @brief A RAII helper class for core service objects.
*
* This is class is intended for usage in local scopes; it calls
* CoreServices::Unget(S*) in its destructor. You should not construct
* multiple CoreServicePointer instances using the same service pointer,
* unless it is retrieved by a new call to a CoreServices getter method.
*
* @see CoreServices
*/
template <class S>
class MITK_LOCAL CoreServicePointer
{
public:
explicit CoreServicePointer(S *service, us::ModuleContext* context = us::GetModuleContext())
: m_Service(service),
m_Context(context)
{
assert(service);
}
~CoreServicePointer()
{
try
{
CoreServices::Unget(m_Service, m_Context);
}
catch (const std::exception &e)
{
MITK_ERROR << e.what();
}
catch (...)
{
MITK_ERROR << "Ungetting core service failed.";
}
}
S *operator->() const
{
return m_Service;
}
private:
S *const m_Service;
us::ModuleContext* m_Context;
};
}
#endif // MITKCORESERVICES_H
diff --git a/Modules/Core/include/mitkDataNode.h b/Modules/Core/include/mitkDataNode.h
index 13f64e52b6..24f5890c5b 100644
--- a/Modules/Core/include/mitkDataNode.h
+++ b/Modules/Core/include/mitkDataNode.h
@@ -1,597 +1,597 @@
/*============================================================================
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 DATATREENODE_H_HEADER_INCLUDED_C1E14338
#define DATATREENODE_H_HEADER_INCLUDED_C1E14338
#include "mitkBaseData.h"
//#include "mitkMapper.h"
#include "mitkDataInteractor.h"
#include "mitkIdentifiable.h"
#include "mitkIPropertyOwner.h"
#include <fstream>
#include <iostream>
#include "mitkColorProperty.h"
#include "mitkPropertyList.h"
#include "mitkStringProperty.h"
//#include "mitkMapper.h"
#include "mitkGeometry3D.h"
#include "mitkLevelWindow.h"
#include <map>
#include <set>
class vtkLinearTransform;
namespace mitk
{
class BaseRenderer;
class Mapper;
/**
* \brief Class for nodes of the DataTree
*
* Contains the data (instance of BaseData), a list of mappers, which can
* draw the data, a transform (vtkTransform) and a list of properties
* (PropertyList).
* \ingroup DataManagement
*
* \todo clean up all the GetProperty methods. There are too many different flavours... Can most probably be reduced
* to
* <tt>bool GetProperty<type>(type&)</tt>
*
* \warning Change in semantics of SetProperty() since Aug 25th 2006. Check your usage of this method if you do
* more with properties than just call <tt>SetProperty( "key", new SomeProperty("value") )</tt>.
*/
class MITKCORE_EXPORT DataNode : public itk::DataObject, public IPropertyOwner
{
public:
typedef mitk::Geometry3D::Pointer Geometry3DPointer;
typedef std::vector<itk::SmartPointer<Mapper>> MapperVector;
typedef std::map<std::string, mitk::PropertyList::Pointer> MapOfPropertyLists;
typedef std::vector<MapOfPropertyLists::key_type> PropertyListKeyNames;
typedef std::set<std::string> GroupTagList;
/**
* \brief Definition of an itk::Event that is invoked when
* a DataInteractor is set on this DataNode.
*/
itkEventMacro(InteractorChangedEvent, itk::AnyEvent)
mitkClassMacroItkParent(DataNode, itk::DataObject);
itkFactorylessNewMacro(Self);
// IPropertyProvider
BaseProperty::ConstPointer GetConstProperty(const std::string &propertyKey, const std::string &contextName = "", bool fallBackOnDefaultContext = true) const override;
std::vector<std::string> GetPropertyKeys(const std::string &contextName = "", bool includeDefaultContext = false) const override;
std::vector<std::string> GetPropertyContextNames() const override;
// IPropertyOwner
BaseProperty * GetNonConstProperty(const std::string &propertyKey, const std::string &contextName = "", bool fallBackOnDefaultContext = true) override;
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName = "", bool fallBackOnDefaultContext = false) override;
void RemoveProperty(const std::string &propertyKey, const std::string &contextName = "", bool fallBackOnDefaultContext = false) override;
mitk::Mapper *GetMapper(MapperSlotId id) const;
/**
* \brief Get the data object (instance of BaseData, e.g., an Image)
* managed by this DataNode
*/
BaseData *GetData() const;
/**
* \brief Get the transformation applied prior to displaying the data as
* a vtkTransform
* \deprecated use GetData()->GetGeometry()->GetVtkTransform() instead
*/
vtkLinearTransform *GetVtkTransform(int t = 0) const;
/**
* \brief Set the data object (instance of BaseData, e.g., an Image)
* managed by this DataNode
*
* Prior set properties are kept if previous data of the node already exists and has the same
* type as the new data to be set. Otherwise, the default properties are used.
* In case that previous data already exists, the property list of the data node is cleared
* before setting new default properties.
*
* \warning the actor-mode of the vtkInteractor does not work any more, if the transform of the
* data-tree-node is connected to the transform of the basedata via vtkTransform->SetInput.
*/
virtual void SetData(mitk::BaseData *baseData);
/**
* \brief Set the Interactor.
*/
virtual void SetDataInteractor(const DataInteractor::Pointer interactor);
virtual DataInteractor::Pointer GetDataInteractor() const;
mitk::DataNode &operator=(const DataNode &right);
mitk::DataNode &operator=(BaseData *right);
virtual void SetMapper(MapperSlotId id, mitk::Mapper *mapper);
void UpdateOutputInformation() override;
void SetRequestedRegionToLargestPossibleRegion() override;
bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
bool VerifyRequestedRegion() override;
void SetRequestedRegion(const itk::DataObject *data) override;
void CopyInformation(const itk::DataObject *data) override;
/**
* \brief The "names" used for (renderer-specific) PropertyLists in GetPropertyList(string).
*
* All possible values for the "renderer" parameters of
* the diverse GetProperty/List() methods.
*/
PropertyListKeyNames GetPropertyListNames() const;
/**
* \brief Set the property (instance of BaseProperty) with key \a propertyKey in the PropertyList
* of the \a renderer (if nullptr, use BaseRenderer-independent PropertyList). This is set-by-value.
*
* \warning Change in semantics since Aug 25th 2006. Check your usage of this method if you do
* more with properties than just call <tt>SetProperty( "key", new SomeProperty("value") )</tt>.
*
* \sa GetProperty
* \sa m_PropertyList
* \sa m_MapOfPropertyLists
*/
void SetProperty(const char *propertyKey, BaseProperty *property, const mitk::BaseRenderer *renderer = nullptr);
/**
* \brief Replace the property (instance of BaseProperty) with key \a propertyKey in the PropertyList
* of the \a renderer (if nullptr, use BaseRenderer-independent PropertyList). This is set-by-reference.
*
* If \a renderer is \a nullptr the property is set in the BaseRenderer-independent
* PropertyList of this DataNode.
* \sa GetProperty
* \sa m_PropertyList
* \sa m_MapOfPropertyLists
*/
void ReplaceProperty(const char *propertyKey, BaseProperty *property, const mitk::BaseRenderer *renderer = nullptr);
/**
* \brief Add the property (instance of BaseProperty) if it does
* not exist (or always if\a overwrite is\a true)
* with key \a propertyKey in the PropertyList
* of the \a renderer (if nullptr, use BaseRenderer-independent
* PropertyList). This is set-by-value.
*
* For\a overwrite ==\a false the property is\em not changed
* if it already exists. For\a overwrite ==\a true the method
* is identical to SetProperty.
*
* \sa SetProperty
* \sa GetProperty
* \sa m_PropertyList
* \sa m_MapOfPropertyLists
*/
void AddProperty(const char *propertyKey,
BaseProperty *property,
const mitk::BaseRenderer *renderer = nullptr,
bool overwrite = false);
/**
* \brief Get the PropertyList of the \a renderer. If \a renderer is \a
* nullptr, the BaseRenderer-independent PropertyList of this DataNode
* is returned.
* \sa GetProperty
* \sa m_PropertyList
* \sa m_MapOfPropertyLists
*/
mitk::PropertyList *GetPropertyList(const mitk::BaseRenderer *renderer = nullptr) const;
mitk::PropertyList *GetPropertyList(const std::string &rendererName) const;
/**
* \brief Add values from another PropertyList.
*
* Overwrites values in m_PropertyList only when possible (i.e. when types are compatible).
* If you want to allow for object type changes (replacing a "visible":BoolProperty with "visible":IntProperty,
- * set the \param replace.
+ * set \c replace .
*
* \param replace true: if \param pList contains a property "visible" of type ColorProperty and our m_PropertyList
* also has a "visible" property of a different type (e.g. BoolProperty), change the type, i.e. replace the objects
* behind the pointer.
*
* \sa SetProperty
* \sa ReplaceProperty
* \sa m_PropertyList
*/
void ConcatenatePropertyList(PropertyList *pList, bool replace = false);
/**
* \brief Get the property (instance of BaseProperty) with key \a propertyKey from the PropertyList
* of the \a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList.
*
* If \a renderer is \a nullptr or the \a propertyKey cannot be found
* in the PropertyList specific to \a renderer or is disabled there, the BaseRenderer-independent
* PropertyList of this DataNode is queried.
*
* If \a fallBackOnDataProperties is true, the data property list is queried as a last resort.
*
* \sa GetPropertyList
* \sa m_PropertyList
* \sa m_MapOfPropertyLists
*/
mitk::BaseProperty *GetProperty(const char *propertyKey, const mitk::BaseRenderer *renderer = nullptr, bool fallBackOnDataProperties = true) const;
/**
* \brief Get the property of type T with key \a propertyKey from the PropertyList
* of the \a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList.
*
* If \a renderer is \a nullptr or the \a propertyKey cannot be found
* in the PropertyList specific to \a renderer or is disabled there, the BaseRenderer-independent
* PropertyList of this DataNode is queried.
* \sa GetPropertyList
* \sa m_PropertyList
* \sa m_MapOfPropertyLists
*/
template <typename T>
bool GetProperty(itk::SmartPointer<T> &property,
const char *propertyKey,
const mitk::BaseRenderer *renderer = nullptr) const
{
property = dynamic_cast<T *>(GetProperty(propertyKey, renderer));
return property.IsNotNull();
}
/**
* \brief Get the property of type T with key \a propertyKey from the PropertyList
* of the \a renderer, if available there, otherwise use the BaseRenderer-independent PropertyList.
*
* If \a renderer is \a nullptr or the \a propertyKey cannot be found
* in the PropertyList specific to \a renderer or is disabled there, the BaseRenderer-independent
* PropertyList of this DataNode is queried.
* \sa GetPropertyList
* \sa m_PropertyList
* \sa m_MapOfPropertyLists
*/
template <typename T>
bool GetProperty(T *&property, const char *propertyKey, const mitk::BaseRenderer *renderer = nullptr) const
{
property = dynamic_cast<T *>(GetProperty(propertyKey, renderer));
return property != nullptr;
}
/**
* \brief Convenience access method for GenericProperty<T> properties
* (T being the type of the second parameter)
* \return \a true property was found
*/
template <typename T>
bool GetPropertyValue(const char *propertyKey, T &value, const mitk::BaseRenderer *renderer = nullptr) const
{
GenericProperty<T> *gp = dynamic_cast<GenericProperty<T> *>(GetProperty(propertyKey, renderer));
if (gp != nullptr)
{
value = gp->GetValue();
return true;
}
return false;
}
/// \brief Get a set of all group tags from this node's property list
GroupTagList GetGroupTags() const;
/**
* \brief Convenience access method for bool properties (instances of
* BoolProperty)
* \return \a true property was found
*/
bool GetBoolProperty(const char *propertyKey, bool &boolValue, const mitk::BaseRenderer *renderer = nullptr) const;
/**
* \brief Convenience access method for int properties (instances of
* IntProperty)
* \return \a true property was found
*/
bool GetIntProperty(const char *propertyKey, int &intValue, const mitk::BaseRenderer *renderer = nullptr) const;
/**
* \brief Convenience access method for float properties (instances of
* FloatProperty)
* \return \a true property was found
*/
bool GetFloatProperty(const char *propertyKey,
float &floatValue,
const mitk::BaseRenderer *renderer = nullptr) const;
/**
* \brief Convenience access method for double properties (instances of
* DoubleProperty)
*
* If there is no DoubleProperty for the given\c propertyKey argument, the method
* looks for a corresponding FloatProperty instance.
*
* \return \a true property was found
*/
bool GetDoubleProperty(const char *propertyKey,
double &doubleValue,
const mitk::BaseRenderer *renderer = nullptr) const;
/**
* \brief Convenience access method for string properties (instances of
* StringProperty)
* \return \a true property was found
*/
bool GetStringProperty(const char *propertyKey,
std::string &string,
const mitk::BaseRenderer *renderer = nullptr) const;
/**
* \brief Convenience access method for color properties (instances of
* ColorProperty)
* \return \a true property was found
*/
bool GetColor(float rgb[3], const mitk::BaseRenderer *renderer = nullptr, const char *propertyKey = "color") const;
/**
* \brief Convenience access method for level-window properties (instances of
* LevelWindowProperty)
* \return \a true property was found
*/
bool GetLevelWindow(mitk::LevelWindow &levelWindow,
const mitk::BaseRenderer *renderer = nullptr,
const char *propertyKey = "levelwindow") const;
/**
* \brief set the node as selected
*/
void SetSelected(bool selected, const mitk::BaseRenderer *renderer = nullptr);
/**
* \brief set the node as selected
* \return \a true node is selected
*/
bool IsSelected(const mitk::BaseRenderer *renderer = nullptr);
/**
* \brief Convenience access method for accessing the name of an object (instance of
* StringProperty with property-key "name")
* \return \a true property was found
*/
bool GetName(std::string &nodeName,
const mitk::BaseRenderer *renderer = nullptr,
const char *propertyKey = "name") const
{
return GetStringProperty(propertyKey, nodeName, renderer);
}
/**
* \brief Extra convenience access method for accessing the name of an object (instance of
* StringProperty with property-key "name").
*
* This method does not take the renderer specific
* propertylists into account, because the name of an object should never be renderer specific.
* \returns a std::string with the name of the object (content of "name" Property).
* If there is no "name" Property, an empty string will be returned.
*/
virtual std::string GetName() const
{
mitk::StringProperty *sp = dynamic_cast<mitk::StringProperty *>(this->GetProperty("name"));
if (sp == nullptr)
return "";
return sp->GetValue();
}
/** Value constant that is used indicate that node names are not set so far.*/
static std::string NO_NAME_VALUE()
{
return "No Name!";
}
/**
* \brief Extra convenience access method to set the name of an object.
*
* The name will be stored in the non-renderer-specific PropertyList in a StringProperty named "name".
*/
virtual void SetName(const char *name)
{
if (name == nullptr)
return;
this->SetProperty("name", StringProperty::New(name));
}
/**
* \brief Extra convenience access method to set the name of an object.
*
* The name will be stored in the non-renderer-specific PropertyList in a StringProperty named "name".
*/
virtual void SetName(const std::string name) { this->SetName(name.c_str()); }
/**
* \brief Convenience access method for visibility properties (instances
* of BoolProperty with property-key "visible")
* \return \a true property was found
* \sa IsVisible
*/
bool GetVisibility(bool &visible, const mitk::BaseRenderer *renderer, const char *propertyKey = "visible") const
{
return GetBoolProperty(propertyKey, visible, renderer);
}
/**
* \brief Convenience access method for opacity properties (instances of
* FloatProperty)
* \return \a true property was found
*/
bool GetOpacity(float &opacity, const mitk::BaseRenderer *renderer, const char *propertyKey = "opacity") const;
/**
* \brief Convenience access method for boolean properties (instances
* of BoolProperty). Return value is the value of the property. If the property is
* not found, the value of \a defaultIsOn is returned.
*
* Thus, the return value has a different meaning than in the
* GetBoolProperty method!
* \sa GetBoolProperty
*/
bool IsOn(const char *propertyKey, const mitk::BaseRenderer *renderer, bool defaultIsOn = true) const
{
if (propertyKey == nullptr)
return defaultIsOn;
GetBoolProperty(propertyKey, defaultIsOn, renderer);
return defaultIsOn;
}
/**
* \brief Convenience access method for visibility properties (instances
* of BoolProperty). Return value is the visibility. Default is
* visible==true, i.e., true is returned even if the property (\a
* propertyKey) is not found.
*
* Thus, the return value has a different meaning than in the
* GetVisibility method!
* \sa GetVisibility
* \sa IsOn
*/
bool IsVisible(const mitk::BaseRenderer *renderer,
const char *propertyKey = "visible",
bool defaultIsOn = true) const
{
return IsOn(propertyKey, renderer, defaultIsOn);
}
/**
* \brief Convenience method for setting color properties (instances of
* ColorProperty)
*/
void SetColor(const mitk::Color &color,
const mitk::BaseRenderer *renderer = nullptr,
const char *propertyKey = "color");
/**
* \brief Convenience method for setting color properties (instances of
* ColorProperty)
*/
void SetColor(float red,
float green,
float blue,
const mitk::BaseRenderer *renderer = nullptr,
const char *propertyKey = "color");
/**
* \brief Convenience method for setting color properties (instances of
* ColorProperty)
*/
void SetColor(const float rgb[3], const mitk::BaseRenderer *renderer = nullptr, const char *propertyKey = "color");
/**
* \brief Convenience method for setting visibility properties (instances
* of BoolProperty)
* \param visible If set to true, the data will be rendered. If false, the render will skip this data.
* \param renderer Specify a renderer if the visibility shall be specific to a renderer
- * \param propertykey Can be used to specify a user defined name of the visibility propery.
+ * \param propertyKey Can be used to specify a user defined name of the visibility propery.
*/
void SetVisibility(bool visible, const mitk::BaseRenderer *renderer = nullptr, const char *propertyKey = "visible");
/**
* \brief Convenience method for setting opacity properties (instances of
* FloatProperty)
*/
void SetOpacity(float opacity, const mitk::BaseRenderer *renderer = nullptr, const char *propertyKey = "opacity");
/**
* \brief Convenience method for setting level-window properties
* (instances of LevelWindowProperty)
*/
void SetLevelWindow(mitk::LevelWindow levelWindow,
const mitk::BaseRenderer *renderer = nullptr,
const char *propertyKey = "levelwindow");
/**
* \brief Convenience method for setting int properties (instances of
* IntProperty)
*/
void SetIntProperty(const char *propertyKey, int intValue, const mitk::BaseRenderer *renderer = nullptr);
/**
* \brief Convenience method for setting boolean properties (instances of
* BoolProperty)
*/
void SetBoolProperty(const char *propertyKey, bool boolValue, const mitk::BaseRenderer *renderer = nullptr);
/**
* \brief Convenience method for setting float properties (instances of
* FloatProperty)
*/
void SetFloatProperty(const char *propertyKey, float floatValue, const mitk::BaseRenderer *renderer = nullptr);
/**
* \brief Convenience method for setting double properties (instances of
* DoubleProperty)
*/
void SetDoubleProperty(const char *propertyKey, double doubleValue, const mitk::BaseRenderer *renderer = nullptr);
/**
* \brief Convenience method for setting string properties (instances of
* StringProperty)
*/
void SetStringProperty(const char *propertyKey, const char *string, const mitk::BaseRenderer *renderer = nullptr);
/**
* \brief Get the timestamp of the last change of the contents of this node or
* the referenced BaseData.
*/
unsigned long GetMTime() const override;
/**
* \brief Get the timestamp of the last change of the reference to the
* BaseData.
*/
unsigned long GetDataReferenceChangedTime() const { return m_DataReferenceChangedTime.GetMTime(); }
protected:
DataNode();
~DataNode() override;
/// Invoked when the property list was modified. Calls Modified() of the DataNode
virtual void PropertyListModified(const itk::Object *caller, const itk::EventObject &event);
/// \brief Mapper-slots
mutable MapperVector m_Mappers;
/**
* \brief The data object (instance of BaseData, e.g., an Image) managed
* by this DataNode
*/
BaseData::Pointer m_Data;
/**
* \brief BaseRenderer-independent PropertyList
*
* Properties herein can be overwritten specifically for each BaseRenderer
* by the BaseRenderer-specific properties defined in m_MapOfPropertyLists.
*/
PropertyList::Pointer m_PropertyList;
/// \brief Map associating each BaseRenderer with its own PropertyList
mutable MapOfPropertyLists m_MapOfPropertyLists;
DataInteractor::Pointer m_DataInteractor;
/// \brief Timestamp of the last change of m_Data
itk::TimeStamp m_DataReferenceChangedTime;
unsigned long m_PropertyListModifiedObserverTag;
};
MITKCORE_EXPORT std::istream &operator>>(std::istream &i, DataNode::Pointer &dtn);
MITKCORE_EXPORT std::ostream &operator<<(std::ostream &o, DataNode::Pointer &dtn);
} // namespace mitk
#endif /* DATATREENODE_H_HEADER_INCLUDED_C1E14338 */
diff --git a/Modules/Core/include/mitkDataStorage.h b/Modules/Core/include/mitkDataStorage.h
index b4f451a46c..a860959317 100644
--- a/Modules/Core/include/mitkDataStorage.h
+++ b/Modules/Core/include/mitkDataStorage.h
@@ -1,447 +1,442 @@
/*============================================================================
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 MITKDATASTORAGE_H
#define MITKDATASTORAGE_H
#include "itkObject.h"
#include "itkSimpleFastMutexLock.h"
#include "itkVectorContainer.h"
#include "mitkDataNode.h"
#include "mitkGeometry3D.h"
#include "mitkMessage.h"
#include <MitkCoreExports.h>
#include <map>
namespace mitk
{
class NodePredicateBase;
class DataNode;
class BaseRenderer;
//##Documentation
//## @brief Data management class that handles 'was created by' relations
//##
//## The DataStorage provides data storage and management functionality.
//## It handles a 'was created by' relation by associating each data object with a
//## set of source objects, that this object was created from.
//## Thus, nodes are stored in a noncyclical directed graph data structure.
//## If a new node is added to the DataStorage, AddNodeEvent is emitted.
//## If a node is removed, RemoveNodeEvent is emitted.
//##
//##
//## \ingroup DataStorage
class MITKCORE_EXPORT DataStorage : public itk::Object
{
public:
mitkClassMacroItkParent(DataStorage, itk::Object);
//##Documentation
//## @brief A Container of objects that is used as a result set of GetSubset() query operations (Set of
//SmartPointers
// to DataNodes).
typedef itk::VectorContainer<unsigned int, DataNode::Pointer> SetOfObjects;
//##Documentation
//## @brief Adds a DataNode containing a data object to its internal storage
//##
//## This Method adds a new data object to the DataStorage. The new object is
//## passed in the first parameter. The second parameter is a set
//## of source objects, that were used to create this object. The new object will have
//## a 'was created from' relation to its source objects.
//## the addition of a new object will fire the notification mechanism.
//## If the node parameter is nullptr or if the DataNode has already been added,
//## an exception will be thrown.
virtual void Add(DataNode *node, const DataStorage::SetOfObjects *parents = nullptr) = 0;
//##Documentation
//## @brief Convenience method to add a node that has one parent
//##
void Add(DataNode *node, DataNode *parent);
//##Documentation
//## @brief Removes node from the DataStorage
//##
virtual void Remove(const DataNode *node) = 0;
//##Documentation
//## @brief Checks if a node exists in the DataStorage
//##
virtual bool Exists(const DataNode *node) const = 0;
//##Documentation
//## @brief Removes a set of nodes from the DataStorage
//##
void Remove(const DataStorage::SetOfObjects *nodes);
//##Documentation
//## @brief returns a set of data objects that meet the given condition(s)
//##
//## GetSubset returns a set of objects with a specific data type that meet the condition(s)
//## specified in the condition parameter. Conditions can be
//## - data type of the data object
//## - is source object of specific object (e.g. all source objects of node x)
//## - has property with specific value (e.g. OrganType is Liver)
//## - negation of any condition
//## - conjunction of a set of conditions
//## - disjunction of a set of conditions
//## Conditions are implemented as predicates using the Composite Design Pattern
//## (see definition of NodePredicateBase for details).
//## The method returns a set of SmartPointers to the DataNodes that fulfill the
//## conditions. A set of all objects can be retrieved with the GetAll() method;
SetOfObjects::ConstPointer GetSubset(const NodePredicateBase *condition) const;
//##Documentation
//## @brief returns a set of source objects for a given node that meet the given condition(s).
//##
virtual SetOfObjects::ConstPointer GetSources(const DataNode *node,
const NodePredicateBase *condition = nullptr,
bool onlyDirectSources = true) const = 0;
//##Documentation
//## @brief returns a set of derived objects for a given node.
//##
//## GetDerivations() returns a set of objects that are derived from the DataNode node.
//## This means, that node was used to create the returned objects. If the parameter
//## onlyDirectDerivations is set to true (default value), only objects that directly have
//## node as one of their source objects will be returned. Otherwise, objects that are
//## derived from derivations of node are returned too.
//## The derived objects can be filtered with a predicate object as described in the GetSubset()
//## method by providing a predicate as the condition parameter.
virtual SetOfObjects::ConstPointer GetDerivations(const DataNode *node,
const NodePredicateBase *condition = nullptr,
bool onlyDirectDerivations = true) const = 0;
//##Documentation
//## @brief returns a set of all data objects that are stored in the data storage
//##
virtual SetOfObjects::ConstPointer GetAll() const = 0;
//##Documentation
//## @brief Convenience method to get the first node that matches the predicate condition
//##
DataNode *GetNode(const NodePredicateBase *condition = nullptr) const;
//##Documentation
//## @brief Convenience method to get the first node with a given name
//##
DataNode *GetNamedNode(const char *name) const;
//##Documentation
//## @brief Convenience method to get the first node with a given name
//##
DataNode *GetNamedNode(const std::string name) const { return this->GetNamedNode(name.c_str()); }
//##Documentation
//## @brief Convenience method to get the first node with a given name that is derived from sourceNode
//##
DataNode *GetNamedDerivedNode(const char *name,
const DataNode *sourceNode,
bool onlyDirectDerivations = true) const;
//##Documentation
//## @brief Convenience method to get the first data object of a given data type with a given name
//##
template <class DataType>
DataType *GetNamedObject(const char *name) const
{
if (name == nullptr)
return nullptr;
DataNode *n = this->GetNamedNode(name);
if (n == nullptr)
return nullptr;
else
return dynamic_cast<DataType *>(n->GetData());
}
//##Documentation
//## @brief Convenience method to get the first data object of a given data type with a given name
//##
template <class DataType>
DataType *GetNamedObject(const std::string name) const
{
return this->GetNamedObject<DataType>(name.c_str());
}
//##Documentation
//## @brief Convenience method to get the first data object of a given data type with a given name that is derived
// from a specific node
//##
template <class DataType>
DataType *GetNamedDerivedObject(const char *name,
const DataNode *sourceNode,
bool onlyDirectDerivations = true) const
{
if (name == nullptr)
return nullptr;
DataNode *n = this->GetNamedDerivedNode(name, sourceNode, onlyDirectDerivations);
if (n == nullptr)
return nullptr;
else
return dynamic_cast<DataType *>(n->GetData());
}
//##Documentation
//## @brief Returns a list of used grouptags
//##
const DataNode::GroupTagList GetGroupTags() const;
/*ITK Mutex */
mutable itk::SimpleFastMutexLock m_MutexOne;
/* Public Events */
typedef Message1<const DataNode*> DataStorageEvent;
//##Documentation
//## @brief AddEvent is emitted whenever a new node has been added to the DataStorage.
//##
//## Observers should register to this event by calling myDataStorage->AddNodeEvent.AddListener(myObject,
// MyObject::MyMethod).
//## After registering, myObject->MyMethod() will be called every time a new node has been added to the DataStorage.
//## Observers should unregister by calling myDataStorage->AddNodeEvent.RemoveListener(myObject,
//MyObject::MyMethod).
//## Note: AddEvents are _not_ emitted if a node is added to DataStorage by adding it to the the underlying
//DataTree!
// member variable is not needed to be locked in multi threaded scenarios since the DataStorageEvent is a typedef
// for
// a Message1 object which is thread safe
DataStorageEvent AddNodeEvent;
//##Documentation
//## @brief RemoveEvent is emitted directly before a node is removed from the DataStorage.
//##
//## Observers should register to this event by calling myDataStorage->RemoveNodeEvent.AddListener(myObject,
// MyObject::MyMethod).
//## After registering, myObject->MyMethod() will be called every time a new node has been added to the DataStorage.
//## Observers should unregister by calling myDataStorage->RemoveNodeEvent.RemoveListener(myObject,
// MyObject::MyMethod).
//## Note: RemoveEvents are also emitted if a node was removed from the DataStorage by deleting it from the
//underlying
// DataTree
// member variable is not needed to be locked in multi threaded scenarios since the DataStorageEvent is a typedef
// for
// a Message1 object which is thread safe
DataStorageEvent RemoveNodeEvent;
//##Documentation
//## @brief ChangedEvent is emitted directly after a node was changed.
//##
//## Observers should register to this event by calling myDataStorage->ChangedNodeEvent.AddListener(myObject,
// MyObject::MyMethod).
//## After registering, myObject->MyMethod() will be called every time a new node has been changed.
//## Observers should unregister by calling myDataStorage->ChangedNodeEvent.RemoveListener(myObject,
// MyObject::MyMethod).
//## Internally the DataStorage listens to itk::ModifiedEvents on the nodes and forwards them
//## to the listeners of this event.
// member variable is not needed to be locked in multi threaded scenarios since the DataStorageEvent is a typedef
// for
// a Message1 object which is thread safe
DataStorageEvent ChangedNodeEvent;
//##Documentation
//## @brief DeleteNodeEvent is emitted directly before a node is deleted.
//##
//## Observers should register to this event by calling myDataStorage->DeleteNodeEvent.AddListener(myObject,
// MyObject::MyMethod).
//## After registering, myObject->MyMethod() will be called when a node is deleted.
//## Observers should unregister by calling myDataStorage->DeleteNodeEvent.RemoveListener(myObject,
// MyObject::MyMethod).
//## Internally the DataStorage listens to itk::DeleteEvents on the nodes and forwards them
//## to the listeners of this event.
// member variable is not needed to be locked in multi threaded scenarios since the DataStorageEvent is a typedef
// for
// a Message1 object which is thread safe
DataStorageEvent DeleteNodeEvent;
DataStorageEvent InteractorChangedNodeEvent;
//##Documentation
//## @brief Compute the axis-parallel bounding geometry of the input objects
//##
//## Throws std::invalid_argument exception if input is nullptr
//## @param input set of objects of the DataStorage to be included in the bounding geometry
//## @param boolPropertyKey if a BoolProperty with this boolPropertyKey exists for a node (for @a renderer)
//## and is set to @a false, the node is ignored for the bounding-box calculation.
//## @param renderer see @a boolPropertyKey
//## @param boolPropertyKey2 a second condition that is applied additionally to @a boolPropertyKey
TimeGeometry::ConstPointer ComputeBoundingGeometry3D(const SetOfObjects *input,
const char *boolPropertyKey = nullptr,
const BaseRenderer *renderer = nullptr,
const char *boolPropertyKey2 = nullptr) const;
//##Documentation
//## @brief Compute the axis-parallel bounding geometry of the data tree
//## (bounding box, minimal spacing of the considered nodes, live-span)
//##
//## it -> an iterator to a data tree structure
//## @param boolPropertyKey if a BoolProperty with this boolPropertyKey exists for a node (for @a renderer)
//## and is set to @a false, the node is ignored for the bounding-box calculation.
//## @param renderer see @a boolPropertyKey
//## @param boolPropertyKey2 a second condition that is applied additionally to @a boolPropertyKey
TimeGeometry::ConstPointer ComputeBoundingGeometry3D(const char *boolPropertyKey = nullptr,
const BaseRenderer *renderer = nullptr,
const char *boolPropertyKey2 = nullptr) const;
//##Documentation
//## @brief Compute the axis-parallel bounding geometry of all visible parts of the
//## data tree bounding box, minimal spacing of the considered nodes, live-span)
//##
//## Simply calls ComputeBoundingGeometry3D(it, "visible", renderer, boolPropertyKey).
//## it -> an iterator of a data tree structure
//## @param renderer the reference to the renderer
//## @param boolPropertyKey if a BoolProperty with this boolPropertyKey exists for a node (for @a renderer)
//## and is set to @a false, the node is ignored for the bounding-box calculation.
TimeGeometry::ConstPointer ComputeVisibleBoundingGeometry3D(const BaseRenderer *renderer = nullptr,
const char *boolPropertyKey = nullptr);
//##Documentation
//## @brief Compute the bounding box of data tree structure
//## it -> an iterator to a data tree structure
//## @param boolPropertyKey if a BoolProperty with this boolPropertyKey exists for a node (for @a renderer)
//## and is set to @a false, the node is ignored for the bounding-box calculation.
//## @param renderer see @a boolPropertyKey
//## @param boolPropertyKey2 a second condition that is applied additionally to @a boolPropertyKey
BoundingBox::Pointer ComputeBoundingBox(const char *boolPropertyKey = nullptr,
const BaseRenderer *renderer = nullptr,
const char *boolPropertyKey2 = nullptr);
//##Documentation
//## \brief Compute the bounding box of all visible parts of the data tree structure, for general
//## rendering or renderer specific visibility property checking
//##
//## Simply calls ComputeBoundingBox(it, "visible", renderer, boolPropertyKey).
//## it -> an iterator of a data tree structure
//## @param renderer the reference to the renderer
//## @param boolPropertyKey if a BoolProperty with this boolPropertyKey exists for a node (for @a renderer)
//## and is set to @a false, the node is ignored for the bounding-box calculation.
BoundingBox::Pointer ComputeVisibleBoundingBox(const BaseRenderer *renderer = nullptr,
const char *boolPropertyKey = nullptr)
{
return ComputeBoundingBox("visible", renderer, boolPropertyKey);
}
//##Documentation
//## @brief Compute the time-bounds of the contents of a data tree structure
//##
//## The methods returns only [-infinity, +infinity], if all data-objects have an infinite live-span. Otherwise,
//## all data-objects with infinite live-span are ignored.
//## it -> an iterator to a data tree structure
//## @param boolPropertyKey if a BoolProperty with this boolPropertyKey exists for a node (for @a renderer)
//## and is set to @a false, the node is ignored for the time-bounds calculation.
//## @param renderer see @a boolPropertyKey
//## @param boolPropertyKey2 a second condition that is applied additionally to @a boolPropertyKey
TimeBounds ComputeTimeBounds(const char *boolPropertyKey,
const BaseRenderer *renderer,
const char *boolPropertyKey2);
//##Documentation
//## @brief Compute the time-bounds of all visible parts of the data tree structure, for general
//## rendering or renderer specific visibility property checking
//##
//## The methods returns only [-infinity, +infinity], if all data-objects have an infinite live-span. Otherwise,
//## all data-objects with infinite live-span are ignored.
//## Simply calls ComputeTimeBounds(it, "visible", renderer, boolPropertyKey).
- //## @param it an iterator to a data tree structure
//## @param boolPropertyKey if a BoolProperty with this boolPropertyKey exists for a node (for @a renderer)
//## and is set to @a false, the node is ignored for the time-bounds calculation.
//## @param renderer see @a boolPropertyKey
TimeBounds ComputeTimeBounds(const BaseRenderer *renderer, const char *boolPropertyKey)
{
return ComputeTimeBounds("visible", renderer, boolPropertyKey);
}
//##Documentation
//## @brief Defines whether or not NodeChangedEvent is invoked .
//##
//## This method can be used to set m_BlockNodeModifiedEvents.
//##
//## If this flag is true, NodeChangedEvent is not invoked when a
//## DataNode is modified. This might be undesired when setting
//## many properties on a datanode and you do not want anyone to
//## react.
void BlockNodeModifiedEvents(bool block);
protected:
//##Documentation
//## @brief EmitAddNodeEvent emits the AddNodeEvent
//##
//## This method should be called by subclasses to emit the AddNodeEvent
void EmitAddNodeEvent(const DataNode *node);
//##Documentation
//## @brief EmitRemoveNodeEvent emits the RemoveNodeEvent
//##
//## This method should be called by subclasses to emit the RemoveNodeEvent
void EmitRemoveNodeEvent(const DataNode *node);
void OnNodeInteractorChanged(itk::Object *caller, const itk::EventObject &event);
//##Documentation
//## @brief OnNodeModified listens to modified events of DataNodes.
//##
//## The node is hidden behind the caller parameter, which has to be casted first.
//## If the cast succeeds the ChangedNodeEvent is emitted with this node.
void OnNodeModifiedOrDeleted(const itk::Object *caller, const itk::EventObject &event);
//##Documentation
//## @brief Adds a Modified-Listener to the given Node.
void AddListeners(const DataNode *_Node);
//##Documentation
//## @brief Removes a Modified-Listener from the given Node.
void RemoveListeners(const DataNode *_Node);
//##Documentation
//## @brief Saves Modified-Observer Tags for each node in order to remove the event listeners again.
std::map<const DataNode *, unsigned long> m_NodeModifiedObserverTags;
std::map<const DataNode *, unsigned long> m_NodeInteractorChangedObserverTags;
//##Documentation
//## @brief Saves Delete-Observer Tags for each node in order to remove the event listeners again.
std::map<const DataNode *, unsigned long> m_NodeDeleteObserverTags;
//##Documentation
//## @brief If this class changes nodes itself, set this to TRUE in order
//## to suppress NodeChangedEvent to be emitted.
bool m_BlockNodeModifiedEvents;
- //##Documentation
- //## @brief Standard Constructor for ::New() instantiation
DataStorage();
- //##Documentation
- //## @brief Standard Destructor
~DataStorage() override;
//##Documentation
//## @brief Filters a SetOfObjects by the condition. If no condition is provided, the original set is returned
SetOfObjects::ConstPointer FilterSetOfObjects(const SetOfObjects *set, const NodePredicateBase *condition) const;
//##Documentation
//## @brief Prints the contents of the DataStorage to os. Do not call directly, call ->Print() instead
void PrintSelf(std::ostream &os, itk::Indent indent) const override;
};
//##Documentation
//## @brief returns the topmost visible node of a given list of nodes.
//## The function returns a node that is visible and has the highest layer of a set of given nodes.
//## The property list, which is used to find the visibility- and layer-property is is specified by the
//## given base renderer.
//##
MITKCORE_EXPORT DataNode::Pointer FindTopmostVisibleNode(const DataStorage::SetOfObjects::ConstPointer nodes,
const Point3D worldPosition,
const TimePointType timePoint,
const BaseRenderer* baseRender);
} // namespace mitk
#endif // MITKDATASTORAGE_H
diff --git a/Modules/Core/include/mitkDisplayActionEventFunctions.h b/Modules/Core/include/mitkDisplayActionEventFunctions.h
index a2ca0f0351..22d0f352d9 100644
--- a/Modules/Core/include/mitkDisplayActionEventFunctions.h
+++ b/Modules/Core/include/mitkDisplayActionEventFunctions.h
@@ -1,86 +1,86 @@
/*============================================================================
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 MITKDISPLAYACTIONEVENTFUNCTIONS_H
#define MITKDISPLAYACTIONEVENTFUNCTIONS_H
#include <MitkCoreExports.h>
#include "mitkStdFunctionCommand.h"
namespace mitk
{
namespace DisplayActionEventFunctions
{
/**
* @brief Returns an 'std::function' that can be used to react on the 'DisplayMoveEvent'.
* The function performs a move of the camera controller of the sending renderer by a vector
* that was previously determined by the mouse interaction event.
*/
MITKCORE_EXPORT StdFunctionCommand::ActionFunction MoveSenderCameraAction();
/**
* @brief Returns an 'std::function' that can be used to react on the 'DisplaySetCrosshairEvent'.
* The function performs a slice selection of the slice navigation controller and will set
* the cross hair for all 2D-render windows.
* The new position was previously determined by the mouse interaction event.
*/
MITKCORE_EXPORT StdFunctionCommand::ActionFunction SetCrosshairAction();
/**
* @brief Returns an 'std::function' that can be used to react on the 'DisplayZoomEvent'.
* The function performs a zoom of the camera controller of the sending renderer by a zoom factor
* that was previously determined by the mouse interaction event.
*/
MITKCORE_EXPORT StdFunctionCommand::ActionFunction ZoomSenderCameraAction();
/**
* @brief Returns an 'std::function' that can be used to react on the 'DisplayScrollEvent'.
* The function performs a slice scrolling of the slice navigation controller of the sending renderer.
* The new position was previously determined by the mouse interaction event.
*/
MITKCORE_EXPORT StdFunctionCommand::ActionFunction ScrollSliceStepperAction();
/**
* @brief Returns an 'std::function' that can be used to react on the 'DisplaySetLevelWindowEvent'.
* The function sets the 'levelwindow' property of the topmost visible image that is display by the sending renderer.
* The level and window value for this property were previously determined by the mouse interaction event.
*/
MITKCORE_EXPORT StdFunctionCommand::ActionFunction SetLevelWindowAction();
/**
* @brief Returns an 'std::function' that can be used to react on the 'DisplayMoveEvent'.
* The function performs a move of the camera controller of all renderer (synchronized)
* by a vector that was previously determined by the mouse interaction event.
* The renderer need to be managed by the same rendering manager.
*/
MITKCORE_EXPORT StdFunctionCommand::ActionFunction MoveCameraSynchronizedAction();
/**
* @brief Returns an 'std::function' that can be used to react on the 'DisplaySetCrosshairEvent'.
* The function performs a slice selection of the slice navigation controller and will set
* the cross hair for all 2D-render windows.
* The new position was previously determined by the mouse interaction event.
- * #TODO: currently there is no need to distinguish between this and the non-synchronized version
+ * @todo Currently there is no need to distinguish between this and the non-synchronized version
*/
MITKCORE_EXPORT StdFunctionCommand::ActionFunction SetCrosshairSynchronizedAction();
/**
* @brief Returns an 'std::function' that can be used to react on the 'DisplayZoomEvent'.
* The function performs a zoom of the camera controller of all 2D-renderer (synchronized)
* by a zoom factor that was previously determined by the mouse interaction event.
*/
MITKCORE_EXPORT StdFunctionCommand::ActionFunction ZoomCameraSynchronizedAction();
/**
* @brief Returns an 'std::function' that can be used to react on the 'DisplayScrollEvent'.
* The function performs a slice scrolling of the slice navigation controller of all 2D-renderer (synchronized).
* The new position was previously determined by the mouse interaction event.
*/
MITKCORE_EXPORT StdFunctionCommand::ActionFunction ScrollSliceStepperSynchronizedAction();
} // end namespace DisplayActionEventFunctions
} // end namespace mitk
#endif // MITKDISPLAYACTIONEVENTFUNCTIONS_H
diff --git a/Modules/Core/include/mitkEqual.h b/Modules/Core/include/mitkEqual.h
index 89539d640f..ad6d0b9745 100644
--- a/Modules/Core/include/mitkEqual.h
+++ b/Modules/Core/include/mitkEqual.h
@@ -1,84 +1,84 @@
/*============================================================================
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.
============================================================================*/
/*
* mitkEqual.h
*
* Created on: Apr 14, 2014
* Author: wirkert
*/
#ifndef MITKEQUAL_H_
#define MITKEQUAL_H_
#include <iomanip>
#include "mitkLogMacros.h"
#include "mitkNumericConstants.h"
namespace mitk
{
/**
* Helper method to check if the difference is bigger or equal to a given epsilon
*
* @param diff the difference to be checked against the epsilon
- * @param the epsilon. The absolute difference needs to be smaller than this.
+ * @param epsilon The absolute difference needs to be smaller than this.
* @return true if abs(diff) >= eps
*/
template <typename DifferenceType>
inline bool DifferenceBiggerOrEqualEps(DifferenceType diff, mitk::ScalarType epsilon = mitk::eps)
{
return fabs(diff) >= epsilon;
}
/**
* outputs elem1, elem2 and eps in case verbose and !isEqual.
* Elem can e.g. be a mitk::Vector or an mitk::Point.
*
* @param elem1 first element to be output
* @param elem2 second
* @param eps the epsilon which their difference was bigger than
* @param verbose tells the function if something shall be output
* @param isEqual function will only output something if the two elements are not equal
*/
template <typename ElementToOutput1, typename ElementToOutput2>
inline void ConditionalOutputOfDifference(
ElementToOutput1 elem1, ElementToOutput2 elem2, mitk::ScalarType eps, bool verbose, bool isEqual)
{
if (verbose && !isEqual)
{
MITK_INFO << typeid(ElementToOutput1).name() << " and " << typeid(ElementToOutput2).name()
<< " not equal. Lefthandside " << std::setprecision(12) << elem1 << " - Righthandside " << elem2
<< " - epsilon " << eps;
}
}
/**
* @ingroup MITKTestingAPI
*
* @param scalar1 Scalar value to compare.
* @param scalar2 Scalar value to compare.
* @param eps Tolerance for floating point comparison.
* @param verbose Flag indicating detailed console output.
* @return True if scalars are equal.
*/
inline bool Equal(ScalarType scalar1, ScalarType scalar2, ScalarType eps = mitk::eps, bool verbose = false)
{
bool isEqual(!DifferenceBiggerOrEqualEps(scalar1 - scalar2, eps));
ConditionalOutputOfDifference(scalar1, scalar2, eps, verbose, isEqual);
return isEqual;
}
}
#endif /* MITKEQUAL_H_ */
diff --git a/Modules/Core/include/mitkEventRecorder.h b/Modules/Core/include/mitkEventRecorder.h
index 2af1e6958f..a99f54fb56 100644
--- a/Modules/Core/include/mitkEventRecorder.h
+++ b/Modules/Core/include/mitkEventRecorder.h
@@ -1,83 +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 mitkEventRecorder_h
#define mitkEventRecorder_h
#include "iostream"
#include "mitkInteractionEventObserver.h"
#include <MitkCoreExports.h>
namespace mitk
{
/**
*\class EventRecorder
*@brief Observer that enables recoding of all user interaction with the render windows and storing it in an XML
- *file.
+ *file.
*
* @ingroup Interaction
*
- * XML file will look like
+ * XML file will look like:
*
- * <?xml version="1.0"?>
- * <interactions>
+ * \code{.unparsed}
+ * <?xml version="1.0"?>
+ * <interactions>
* <config>
- * <renderer RendererName="stdmulti.widget0" ViewDirection="0"/>
- * <renderer RendererName="stdmulti.widget1" ViewDirection="1"/>
- * <renderer RendererName="stdmulti.widget2" ViewDirection="2"/>
+ * <renderer RendererName="stdmulti.widget0" ViewDirection="0"/>
+ * <renderer RendererName="stdmulti.widget1" ViewDirection="1"/>
+ * <renderer RendererName="stdmulti.widget2" ViewDirection="2"/>
* </config>
* <events>
- * <event_variant class="MOUSEMOVEEVENT" >
- * <attribute name="PositionOnScreen" value="491,388"/>
- * <attribute name="PositionInWorld" value="128,235.771,124.816"/>
- * <attribute name="RendererName" value="stdmulti.widget1"/>
- * </event_variant>
+ * <event_variant class="MOUSEMOVEEVENT" >
+ * <attribute name="PositionOnScreen" value="491,388"/>
+ * <attribute name="PositionInWorld" value="128,235.771,124.816"/>
+ * <attribute name="RendererName" value="stdmulti.widget1"/>
+ * </event_variant>
* </events>
- * </interactions>
+ * </interactions>
+ * \endcode
**/
class MITKCORE_EXPORT EventRecorder : public InteractionEventObserver
{
public:
EventRecorder();
~EventRecorder() override;
/**
* By this function the Observer gets notified about new events.
*/
void Notify(InteractionEvent *interactionEvent, bool) override;
/**
* @brief SetEventIgnoreList Optional. Provide a list of strings that describe which events are to be ignored
*/
void SetEventIgnoreList(std::vector<std::string> list);
void StartRecording();
void StopRecording();
bool IsActive() { return m_Active; }
void SetOutputFile(std::string filename) { m_FileName = filename; }
private:
/**
* @brief m_IgnoreList lists the names of events that are dropped
*/
std::vector<std::string> m_IgnoreList;
/**
* @brief m_Active determindes if events are caught and written to file
*/
bool m_Active;
std::string m_FileName;
std::ofstream m_FileStream;
};
}
#endif
diff --git a/Modules/Core/include/mitkException.h b/Modules/Core/include/mitkException.h
index 0465afc949..c632970caf 100644
--- a/Modules/Core/include/mitkException.h
+++ b/Modules/Core/include/mitkException.h
@@ -1,115 +1,115 @@
/*============================================================================
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 MITKEXCEPTION_H_INCLUDED
#define MITKEXCEPTION_H_INCLUDED
#include <MitkCoreExports.h>
#include <itkMacro.h>
#include <vector>
namespace mitk
{
/**Documentation
* \brief An object of this class represents an exception of MITK.
* Please don't instantiate exceptions manually, but use the
* exception macros (file mitkExceptionMacro.h) instead.
* Simple use in your code is:
*
* mitkThrow() << "optional exception message";
*
* You can also define specialized exceptions which must inherit
* from this class. Please always use the mitkExceptionClassMacro
* when implementing specialized exceptions. A simple implementation
* can look like:
*
* class MyException : public mitk::Exception
* {
* public:
* mitkExceptionClassMacro(MyException,mitk::Exception);
* };
*
* You can then throw your specialized exceptions by using the macro
*
* mitkThrowException(MyException) << "optional exception message";
*/
class MITKCORE_EXPORT Exception : public itk::ExceptionObject
{
public:
Exception(const char *file, unsigned int lineNumber = 0, const char *desc = "None", const char *loc = "Unknown")
: itk::ExceptionObject(file, lineNumber, desc, loc)
{
}
~Exception() throw() override {}
itkTypeMacro(ClassName, SuperClassName);
/** \brief Adds rethrow data to this exception. */
void AddRethrowData(const char *file, unsigned int lineNumber, const char *message);
/** \return Returns how often the exception was rethrown. */
int GetNumberOfRethrows();
/** @return Returns the rethrow data of the specified rethrow number. Returns empty data, if the rethrowNumber
* doesn't
* exist.
* @param rethrowNumber The internal number of the rethrow.
* @param file (returnvalue) This varaiable will be filled with the file of the specified rethrow.
- * @param file (returnvalue) This varaiable will be filled with the line of the specified rethrow.
- * @param file (returnvalue) This varaiable will be filled with the message of the specified rethrow.
+ * @param line (returnvalue) This varaiable will be filled with the line of the specified rethrow.
+ * @param message (returnvalue) This varaiable will be filled with the message of the specified rethrow.
*/
void GetRethrowData(int rethrowNumber, std::string &file, int &line, std::string &message);
/** \brief Definition of the bit shift operator for this class.*/
template <class T>
inline Exception &operator<<(const T &data)
{
std::stringstream ss;
ss << this->GetDescription() << data;
this->SetDescription(ss.str());
return *this;
}
/** \brief Definition of the bit shift operator for this class (for non const data).*/
template <class T>
inline Exception &operator<<(T &data)
{
std::stringstream ss;
ss << this->GetDescription() << data;
this->SetDescription(ss.str());
return *this;
}
/** \brief Definition of the bit shift operator for this class (for functions).*/
inline Exception &operator<<(std::ostream &(*func)(std::ostream &))
{
std::stringstream ss;
ss << this->GetDescription() << func;
this->SetDescription(ss.str());
return *this;
}
protected:
struct ReThrowData
{
std::string RethrowClassname;
unsigned int RethrowLine;
std::string RethrowMessage;
};
std::vector<ReThrowData> m_RethrowData;
};
MITKCORE_EXPORT std::ostream &operator<<(std::ostream &os, const mitk::Exception &e);
} // namespace mitk
#endif
diff --git a/Modules/Core/include/mitkFileReaderRegistry.h b/Modules/Core/include/mitkFileReaderRegistry.h
index 9e55cc156d..5ee1fc44c0 100644
--- a/Modules/Core/include/mitkFileReaderRegistry.h
+++ b/Modules/Core/include/mitkFileReaderRegistry.h
@@ -1,77 +1,77 @@
/*============================================================================
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 FileReaderRegistry_H_HEADER_INCLUDED_C1E7E521
#define FileReaderRegistry_H_HEADER_INCLUDED_C1E7E521
#include <MitkCoreExports.h>
#include <mitkBaseData.h>
#include <mitkIFileReader.h>
// Microservices
#include <usGetModuleContext.h>
#include <usServiceObjects.h>
#include <usServiceReference.h>
namespace mitk
{
class MimeType;
/**
* @ingroup IO
*
* Provides convenient access to mitk::IFileReader instances and reading
* files into mitk::BaseData types.
*
* \note The life-time of all mitk::IFileReader objects returned by an
* instance of this class ends with the destruction of that instance.
*/
class MITKCORE_EXPORT FileReaderRegistry
{
public:
typedef us::ServiceReference<IFileReader> ReaderReference;
FileReaderRegistry();
~FileReaderRegistry();
/**
* @brief Get the highest ranked mime-type for the given file name.
- * @param extension A file name extension without a leading dot.
+ * @param path
* @param context
* @return The highest ranked mime-type containing \c extension in
* its extension list.
*/
static MimeType GetMimeTypeForFile(const std::string &path, us::ModuleContext *context = us::GetModuleContext());
static std::vector<ReaderReference> GetReferences(const MimeType &mimeType,
us::ModuleContext *context = us::GetModuleContext());
mitk::IFileReader *GetReader(const ReaderReference &ref, us::ModuleContext *context = us::GetModuleContext());
std::vector<mitk::IFileReader *> GetReaders(const MimeType &mimeType,
us::ModuleContext *context = us::GetModuleContext());
void UngetReader(mitk::IFileReader *reader);
void UngetReaders(const std::vector<mitk::IFileReader *> &readers);
private:
// purposely not implemented
FileReaderRegistry(const FileReaderRegistry &);
FileReaderRegistry &operator=(const FileReaderRegistry &);
std::map<mitk::IFileReader *, us::ServiceObjects<mitk::IFileReader>> m_ServiceObjects;
};
} // namespace mitk
#endif /* FileReaderRegistry_H_HEADER_INCLUDED_C1E7E521 */
diff --git a/Modules/Core/include/mitkGeometry3D.h b/Modules/Core/include/mitkGeometry3D.h
index b342f6aa25..8b5645750e 100644
--- a/Modules/Core/include/mitkGeometry3D.h
+++ b/Modules/Core/include/mitkGeometry3D.h
@@ -1,77 +1,75 @@
/*============================================================================
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 GEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD
#define GEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD
#include "mitkNumericTypes.h"
#include <MitkCoreExports.h>
#include <mitkCommon.h>
#include "itkScalableAffineTransform.h"
#include <itkIndex.h>
#include "mitkBaseGeometry.h"
class vtkLinearTransform;
namespace mitk
{
- //##Documentation
- //## @brief Standard implementation of BaseGeometry.
- //##
- //## @ingroup Geometry
+ /** @brief Standard implementation of BaseGeometry.
+ * @ingroup Geometry
+ */
class MITKCORE_EXPORT Geometry3D : public BaseGeometry
{
public:
mitkClassMacro(Geometry3D, mitk::BaseGeometry);
typedef itk::QuaternionRigidTransform<ScalarType> QuaternionTransformType;
typedef QuaternionTransformType::VnlQuaternionType VnlQuaternionType;
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self);
mitkNewMacro1Param(Self, const Self&);
itkCloneMacro(Self);
- // itkGetConstReferenceMacro(TimeBounds, TimeBounds);
-
- // virtual void SetTimeBounds(const TimeBounds& timebounds);
protected : Geometry3D();
Geometry3D(const Geometry3D &);
- //##Documentation
- //## @brief clones the geometry
- //##
- //## Overwrite in all sub-classes.
- //## Normally looks like:
- //## \code
- //## Self::Pointer newGeometry = new Self(*this);
- //## newGeometry->UnRegister();
- //## return newGeometry.GetPointer();
- //## \endcode
+ /**
+ * @brief clones the geometry
+ *
+ * Overwrite in all sub-classes.
+ * Normally looks like:
+ * \code
+ * Self::Pointer newGeometry = new Self(*this);
+ * newGeometry->UnRegister();
+ * return newGeometry.GetPointer();
+ * \endcode
+ */
itk::LightObject::Pointer InternalClone() const override;
~Geometry3D() override;
- //##Documentation
- //## @brief PreSetSpacing
- //##
- //## These virtual function allows a different beahiour in subclasses.
- //## Do implement them in every subclass of BaseGeometry. If not needed, use
- //## {Superclass::PreSetSpacing();};
+ /**
+ * @brief PreSetSpacing
+ *
+ * These virtual function allows a different beahiour in subclasses.
+ * Do implement them in every subclass of BaseGeometry. If not needed, use
+ * \c Superclass::PreSetSpacing().
+ */
void PreSetSpacing(const mitk::Vector3D &aSpacing) override { Superclass::PreSetSpacing(aSpacing); };
};
} // namespace mitk
#endif /* GEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD */
diff --git a/Modules/Core/include/mitkIMimeTypeProvider.h b/Modules/Core/include/mitkIMimeTypeProvider.h
index cbaa27ea5e..a891013803 100644
--- a/Modules/Core/include/mitkIMimeTypeProvider.h
+++ b/Modules/Core/include/mitkIMimeTypeProvider.h
@@ -1,68 +1,68 @@
/*============================================================================
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 MITKIMIMETYPEPROVIDER_H
#define MITKIMIMETYPEPROVIDER_H
#include <MitkCoreExports.h>
#include <mitkMimeType.h>
#include <mitkServiceInterface.h>
#include <usServiceReference.h>
#include <vector>
namespace mitk
{
/**
- * @ingroupg IO
+ * @ingroup IO
* @ingroup MicroServices_Interfaces
*
* @brief The IMimeTypeProvider service interface allows to query all registered
* mime types.
*
* Mime types are added to the system by registering a service object of type
* CustomMimeType and the registered mime types can be queried bei either using direct
* look-ups in the service registry or calling the methods of this service interface.
*
* This service interface also allows to infer the mime type of a file on the file
* system. The heuristics for infering the actual mime type is implementation specific.
*
* @note This is a <em>core service</em>
*
* @sa CustomMimeType
* @sa CoreServices::GetMimeTypeProvider()
*/
struct MITKCORE_EXPORT IMimeTypeProvider
{
virtual ~IMimeTypeProvider();
virtual std::vector<MimeType> GetMimeTypes() const = 0;
virtual std::vector<MimeType> GetMimeTypesForFile(const std::string &filePath) const = 0;
virtual std::vector<MimeType> GetMimeTypesForCategory(const std::string &category) const = 0;
virtual MimeType GetMimeTypeForName(const std::string &name) const = 0;
/**
* @brief Get a sorted and unique list of mime-type categories.
* @return A sorted, unique list of mime-type categories.
*/
virtual std::vector<std::string> GetCategories() const = 0;
};
}
MITK_DECLARE_SERVICE_INTERFACE(mitk::IMimeTypeProvider, "org.mitk.IMimeTypeProvider")
#endif // MITKIMIMETYPEPROVIDER_H
diff --git a/Modules/Core/include/mitkIOUtil.h b/Modules/Core/include/mitkIOUtil.h
index 4732415513..24f878efa2 100644
--- a/Modules/Core/include/mitkIOUtil.h
+++ b/Modules/Core/include/mitkIOUtil.h
@@ -1,429 +1,434 @@
/*============================================================================
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 MITKIOUTIL_H
#define MITKIOUTIL_H
#include <MitkCoreExports.h>
#include <mitkDataStorage.h>
#include <mitkImage.h>
#include <mitkPointSet.h>
#include <mitkSurface.h>
#include <mitkFileReaderSelector.h>
#include <mitkFileWriterSelector.h>
#include <mitkIFileReader.h>
#include <mitkIFileWriter.h>
#include <fstream>
namespace us
{
class ModuleResource;
}
namespace mitk
{
/**
* \ingroup IO
*
* \brief A utility class to load and save data from/to the local file system.
*
* \see QmitkIOUtil
*/
class MITKCORE_EXPORT IOUtil
{
public:
/**Struct that containes information regarding the current loading process. (e.g. Path that should be loaded,
all found readers for the load path,...). It is set be IOUtil and used to pass information via the option callback
in load operations.
*/
struct MITKCORE_EXPORT LoadInfo
{
LoadInfo(const std::string &path);
std::string m_Path;
std::vector<BaseData::Pointer> m_Output;
FileReaderSelector m_ReaderSelector;
bool m_Cancel;
};
/**Struct that is the base class for option callbacks used in load operations. The callback is used by IOUtil, if
more than one suitable reader was found or the a reader containes options that can be set. The callback allows to
change option settings and select the reader that should be used (via loadInfo).
*/
struct MITKCORE_EXPORT ReaderOptionsFunctorBase
{
virtual bool operator()(LoadInfo &loadInfo) const = 0;
};
struct MITKCORE_EXPORT SaveInfo
{
SaveInfo(const BaseData *baseData, const MimeType &mimeType, const std::string &path);
bool operator<(const SaveInfo &other) const;
/// The BaseData object to save.
const BaseData *m_BaseData;
/// Contains a set of IFileWriter objects.
FileWriterSelector m_WriterSelector;
/// The selected mime-type, used to restrict results from FileWriterSelector.
MimeType m_MimeType;
/// The path to write the BaseData object to.
std::string m_Path;
/// Flag indicating if sub-sequent save operations are to be canceled.
bool m_Cancel;
};
/**Struct that is the base class for option callbacks used in save operations. The callback is used by IOUtil, if
more than one suitable writer was found or the a writer containes options that can be set. The callback allows to
change option settings and select the writer that should be used (via saveInfo).
*/
struct MITKCORE_EXPORT WriterOptionsFunctorBase
{
virtual bool operator()(SaveInfo &saveInfo) const = 0;
};
/**
* Get the file system path where the running executable is located.
*
* @return The location of the currently running executable, without the filename.
*/
static std::string GetProgramPath();
/**
* Get the default temporary path.
*
* @return The default path for temporary data.
*/
static std::string GetTempPath();
/**
* Returns the Directory Seperator for the current OS.
*
* @return the Directory Seperator for the current OS, i.e. "\\" for Windows and "/" otherwise.
*/
static char GetDirectorySeparator();
/**
* Create and open a temporary file.
*
* This method generates a unique temporary filename from \c templateName, creates
* and opens the file using the output stream \c tmpStream and returns the name of
* the newly create file.
*
* The \c templateName argument must contain six consective 'X' characters ("XXXXXX")
* and these are replaced with a string that makes the filename unique.
*
* The file is created with read and write permissions for owner only.
*
* @param tmpStream The output stream for writing to the temporary file.
* @param templateName An optional template for the filename.
* @param path An optional path where the temporary file should be created. Defaults
* to the default temp path as returned by GetTempPath().
* @return The filename of the created temporary file.
*
* @throw mitk::Exception if the temporary file could not be created.
*/
static std::string CreateTemporaryFile(std::ofstream &tmpStream,
const std::string &templateName = "XXXXXX",
std::string path = std::string());
/**
* Create and open a temporary file.
*
* This method generates a unique temporary filename from \c templateName, creates
* and opens the file using the output stream \c tmpStream and the specified open
* mode \c mode and returns the name of the newly create file. The open mode is always
- * OR'd with \begin{code}std::ios_base::out | std::ios_base::trunc\end{code}.
+ * OR'd with <code>std::ios_base::out | std::ios_base::trunc</code>.
*
* The \c templateName argument must contain six consective 'X' characters ("XXXXXX")
* and these are replaced with a string that makes the filename unique.
*
* The file is created with read and write permissions for owner only.
*
* @param tmpStream The output stream for writing to the temporary file.
* @param mode The open mode for the temporary file stream.
* @param templateName An optional template for the filename.
* @param path An optional path where the temporary file should be created. Defaults
* to the default temp path as returned by GetTempPath().
* @return The filename of the created temporary file.
*
* @throw mitk::Exception if the temporary file could not be created.
*/
static std::string CreateTemporaryFile(std::ofstream &tmpStream,
std::ios_base::openmode mode,
const std::string &templateName = "XXXXXX",
std::string path = std::string());
/**
* Creates an empty temporary file.
*
* This method generates a unique temporary filename from \c templateName and creates
* this file.
*
* The file is created with read and write permissions for owner only.
*
* ---
* This version is potentially unsafe because the created temporary file is not kept open
* and could be used by another process between calling this method and opening the returned
* file path for reading or writing.
* ---
*
* @return The filename of the created temporary file.
* @param templateName An optional template for the filename.
* @param path An optional path where the temporary file should be created. Defaults
* to the default temp path as returned by GetTempPath().
* @throw mitk::Exception if the temporary file could not be created.
*/
static std::string CreateTemporaryFile(const std::string &templateName = "XXXXXX",
std::string path = std::string());
/**
* Create a temporary directory.
*
* This method generates a uniquely named temporary directory from \c templateName.
* The last set of six consecutive 'X' characters in \c templateName is replaced
* with a string that makes the directory name unique.
*
* The directory is created with read, write and executable permissions for owner only.
*
* @param templateName An optional template for the directory name.
* @param path An optional path where the temporary directory should be created. Defaults
* to the default temp path as returned by GetTempPath().
* @return The filename of the created temporary file.
*
* @throw mitk::Exception if the temporary directory could not be created.
*/
static std::string CreateTemporaryDirectory(const std::string &templateName = "XXXXXX",
std::string path = std::string());
/**
* @brief Load a file into the given DataStorage.
*
* This method calls Load(const std::vector<std::string>&, DataStorage&) with a
* one-element vector.
*
* @param path The absolute file name including the file extension.
* @param storage A DataStorage object to which the loaded data will be added.
* @param optionsCallback Pointer to a callback instance. The callback is used by
* the load operation if more the suitable reader was found or the reader has options
* that can be set.
* @return The set of added DataNode objects.
* @throws mitk::Exception if \c path could not be loaded.
*
* @sa Load(const std::vector<std::string>&, DataStorage&)
*/
static DataStorage::SetOfObjects::Pointer Load(const std::string &path, DataStorage &storage,
const ReaderOptionsFunctorBase *optionsCallback = nullptr);
/**
* @brief Load a file into the given DataStorage given user defined IFileReader::Options.
*
* This method calls Load(const std::vector<std::string>&, DataStorage&) with a
* one-element vector.
*
* @param path The absolute file name including the file extension.
* @param options IFileReader option instance that should be used if selected reader
* has options.
* @param storage A DataStorage object to which the loaded data will be added.
* @return The set of added DataNode objects.
* @throws mitk::Exception if \c path could not be loaded.
*
* @sa Load(const std::vector<std::string>&, DataStorage&)
*/
static DataStorage::SetOfObjects::Pointer Load(const std::string &path,
const IFileReader::Options &options,
DataStorage &storage);
/**
* @brief Load a file and return the loaded data.
*
* This method calls Load(const std::vector<std::string>&) with a
* one-element vector.
*
* @param path The absolute file name including the file extension.
* @param optionsCallback Pointer to a callback instance. The callback is used by
* the load operation if more the suitable reader was found or the reader has options
* that can be set.
* @return The set of added DataNode objects.
* @throws mitk::Exception if \c path could not be loaded.
*
* @sa Load(const std::vector<std::string>&, DataStorage&)
*/
static std::vector<BaseData::Pointer> Load(const std::string &path,
const ReaderOptionsFunctorBase *optionsCallback = nullptr);
template <typename T>
static typename T::Pointer Load(const std::string& path, const ReaderOptionsFunctorBase *optionsCallback = nullptr)
{
return dynamic_cast<T*>(Load(path, optionsCallback).at(0).GetPointer());
}
/**
* @brief Load a file and return the loaded data.
*
* This method calls Load(const std::vector<std::string>&) with a
* one-element vector.
*
* @param path The absolute file name including the file extension.
* @param options IFileReader option instance that should be used if selected reader
* has options.
* @return The set of added DataNode objects.
* @throws mitk::Exception if \c path could not be loaded.
*
* @sa Load(const std::vector<std::string>&, DataStorage&)
*/
static std::vector<BaseData::Pointer> Load(const std::string &path, const IFileReader::Options &options);
template <typename T>
static typename T::Pointer Load(const std::string& path, const IFileReader::Options &options)
{
return dynamic_cast<T*>(Load(path, options).at(0).GetPointer());
}
/**
* @brief Loads a list of file paths into the given DataStorage.
*
* If an entry in \c paths cannot be loaded, this method will continue to load
* the remaining entries into \c storage and throw an exception afterwards.
*
* @param paths A list of absolute file names including the file extension.
* @param storage A DataStorage object to which the loaded data will be added.
* @param optionsCallback Pointer to a callback instance. The callback is used by
* the load operation if more the suitable reader was found or the reader has options
* that can be set.
* @return The set of added DataNode objects.
* @throws mitk::Exception if an entry in \c paths could not be loaded.
*/
static DataStorage::SetOfObjects::Pointer Load(const std::vector<std::string> &paths, DataStorage &storage,
const ReaderOptionsFunctorBase *optionsCallback = nullptr);
static std::vector<BaseData::Pointer> Load(const std::vector<std::string> &paths,
const ReaderOptionsFunctorBase *optionsCallback = nullptr);
/**
* @brief Loads the contents of a us::ModuleResource and returns the corresponding mitk::BaseData
* @param usResource a ModuleResource, representing a BaseData object
* @param mode Optional parameter to set the openmode of the stream
* @return The set of loaded BaseData objects. \c Should contain either one or zero elements, since a resource
* stream
* respresents one object.
* @throws mitk::Exception if no reader was found for the stream.
*/
static std::vector<BaseData::Pointer> Load(const us::ModuleResource &usResource,
std::ios_base::openmode mode = std::ios_base::in);
template <typename T>
static typename T::Pointer Load(const us::ModuleResource &usResource, std::ios_base::openmode mode = std::ios_base::in)
{
return dynamic_cast<T*>(Load(usResource, mode).at(0).GetPointer());
}
/**
* @brief Save a mitk::BaseData instance.
* @param data The data to save.
* @param path The path to the image including file name and and optional file extension.
* If no extension is set, the default extension and mime-type for the
* BaseData type of \c data is used.
+ * @param setPathProperty
* @throws mitk::Exception if no writer for \c data is available or the writer
* is not able to write the image.
*/
static void Save(const mitk::BaseData *data, const std::string &path, bool setPathProperty = false);
/**
* @brief Save a mitk::BaseData instance.
* @param data The data to save.
* @param path The path to the image including file name and an optional file extension.
* If no extension is set, the default extension and mime-type for the
* BaseData type of \c data is used.
* @param options The IFileWriter options to use for the selected writer.
+ * @param setPathProperty
* @throws mitk::Exception if no writer for \c data is available or the writer
* is not able to write the image.
*/
static void Save(const mitk::BaseData *data, const std::string &path, const IFileWriter::Options &options, bool setPathProperty = false);
/**
* @brief Save a mitk::BaseData instance.
* @param data The data to save.
* @param mimeType The mime-type to use for writing \c data.
* @param path The path to the image including file name and an optional file extension.
* @param addExtension If \c true, an extension according to the given \c mimeType
* is added to \c path if it does not contain one. If \c path already contains
* a file name extension, it is not checked for compatibility with \c mimeType.
+ * @param setPathProperty
*
* @throws mitk::Exception if no writer for the combination of \c data and \c mimeType is
* available or the writer is not able to write the image.
*/
static void Save(const mitk::BaseData *data,
const std::string &mimeType,
const std::string &path,
bool addExtension = true,
bool setPathProperty = false);
/**
* @brief Save a mitk::BaseData instance.
* @param data The data to save.
* @param mimeType The mime-type to use for writing \c data.
* @param path The path to the image including file name and an optional file extension.
* @param options Configuration data for the used IFileWriter instance.
* @param addExtension If \c true, an extension according to the given \c mimeType
* is added to \c path if it does not contain one. If \c path already contains
* a file name extension, it is not checked for compatibility with \c mimeType.
+ * @param setPathProperty
*
* @throws mitk::Exception if no writer for the combination of \c data and \c mimeType is
* available or the writer is not able to write the image.
*/
static void Save(const mitk::BaseData *data,
const std::string &mimeType,
const std::string &path,
const mitk::IFileWriter::Options &options,
bool addExtension = true,
bool setPathProperty = false);
/**
* @brief Use SaveInfo objects to save BaseData instances.
*
* This is a low-level method for directly working with SaveInfo objects. Usually,
* the Save() methods taking a BaseData object as an argument are more appropriate.
*
* @param saveInfos A list of SaveInfo objects for saving contained BaseData objects.
+ * @param setPathProperty
*
* @see Save(const mitk::BaseData*, const std::string&)
*/
static void Save(std::vector<SaveInfo> &saveInfos, bool setPathProperty = false);
protected:
static std::string Load(std::vector<LoadInfo> &loadInfos,
DataStorage::SetOfObjects *nodeResult,
DataStorage *ds,
const ReaderOptionsFunctorBase *optionsCallback);
static std::string Save(const BaseData *data,
const std::string &mimeType,
const std::string &path,
WriterOptionsFunctorBase *optionsCallback,
bool addExtension,
bool setPathProperty);
static std::string Save(std::vector<SaveInfo> &saveInfos,
WriterOptionsFunctorBase *optionsCallback,
bool setPathProperty);
private:
struct Impl;
};
}
#endif // MITKIOUTIL_H
diff --git a/Modules/Core/include/mitkIPropertyPersistence.h b/Modules/Core/include/mitkIPropertyPersistence.h
index a778e87602..50b17a941b 100644
--- a/Modules/Core/include/mitkIPropertyPersistence.h
+++ b/Modules/Core/include/mitkIPropertyPersistence.h
@@ -1,117 +1,115 @@
/*============================================================================
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 mitkIPropertyPersistence_h
#define mitkIPropertyPersistence_h
#include <mitkPropertyPersistenceInfo.h>
#include <mitkServiceInterface.h>
namespace mitk
{
/** \ingroup MicroServices_Interfaces
* \brief Interface of property persistence service
*
* This service allows you to manage persistence info for base data properties.
* Persistent properties will be saved if the file format supports custom key value pairs like the .nrrd file
- * format.\n
+ * format.\n
* \remark The service supports the use of regular expressions (regex; ECMAscript syntax)
* for property names and persistance keys to specifiy persistence rules in a generic way. The getter of the
- * interface
+ * interface
* (GetInfo and GetInfoByKey) will always ensure that the return containes no regex, thus name and key in the results
- * can directly be used. For details on how the result names and keys are determined, please @TODO
- *
+ * can directly be used.
*/
class MITKCORE_EXPORT IPropertyPersistence
{
public:
virtual ~IPropertyPersistence();
using InfoResultType = std::list<PropertyPersistenceInfo::ConstPointer>;
using MimeTypeNameType = PropertyPersistenceInfo::MimeTypeNameType;
/** \brief Add persistence info for a specific base data property.
* If there is already a property info instance for the passed
* property name and the same info, it won't be added. Info instances
* are regarded equal, if the mime types are equal.
* You may enforce to overwrite the old equal info for a property name
* by the overwrite parameter.
*
- * \param[in] propertyName Name of the property.
* \param[in] info Persistence info of the property.
* \param[in] overwrite Overwrite already existing persistence info.
* \return True if persistence info was added successfully.
*/
virtual bool AddInfo(const PropertyPersistenceInfo *info, bool overwrite = false) = 0;
/** \brief Get the persistence info for a specific base data property.
* \param[in] propertyName Name of the property.
* \param[in] allowNameRegEx Indicates if also added info instances with regexs are being checked.
* \return Property persistence info or null pointer if no persistence info is available.
*/
virtual InfoResultType GetInfo(const std::string &propertyName, bool allowNameRegEx = true) const = 0;
/** \brief Get the persistence info for a specific base data property and mime type.
*
* \param[in] propertyName Name of the property.
* \param[in] mime Name of the mime type the info is specified for.
* \param[in] allowMimeWildCard Indicates if wildcard is allowed. If it is allowed, the method will first try to find
* the specified info.
* If no info was found but an info exists with the mime type name PropertyPersistenceInfo::ANY_MIMETYPE_NAME(), the
* later info will be
* returned as fall back option.
* \param[in] allowNameRegEx Indicates if also added info instances with regexs are being checked.
* \return Property persistence info or null pointer if no persistence info is available.
*/
virtual InfoResultType GetInfo(const std::string &propertyName,
const MimeTypeNameType &mime,
bool allowMimeWildCard = false,
bool allowNameRegEx = true) const = 0;
/** \brief Get the persistence info that will use the specified key.
*
- * \param[in] propertyName Name of the property.
+ * \param[in] persistenceKey Name of the property.
* \param[in] allowKeyRegEx Indicates if also added info instances with regexs for the key are being checked.
* \return Property persistence info or null pointer if no persistence info is available.
*/
virtual InfoResultType GetInfoByKey(const std::string &persistenceKey, bool allowKeyRegEx = true) const = 0;
/** \brief Check if a specific base data property has persistence info.
*
* \param[in] propertyName Name of the property.
* \param[in] allowNameRegEx Indicates if also added info instances with regexs are being checked.
* \return True if the property has persistence info, false otherwise.
*/
virtual bool HasInfo(const std::string &propertyName, bool allowNameRegEx = true) const = 0;
/** \brief Remove all persistence info.
*/
virtual void RemoveAllInfo() = 0;
/** \brief Remove persistence info instances of a specific property name/regex.
*
* \param[in] propertyName Registered name or regex that should be removed.
*/
virtual void RemoveInfo(const std::string &propertyName) = 0;
/** \brief Remove persistence info instances of a specific property name/regex and mime type.
*
* \param[in] propertyName Registered name or regex that should be removed.
* \param[in] mime Name of the mime type.
*/
virtual void RemoveInfo(const std::string &propertyName, const MimeTypeNameType &mime) = 0;
};
}
MITK_DECLARE_SERVICE_INTERFACE(mitk::IPropertyPersistence, "org.mitk.IPropertyPersistence")
#endif
diff --git a/Modules/Core/include/mitkITKImageImport.h b/Modules/Core/include/mitkITKImageImport.h
index 3d408f9bc5..354905002d 100644
--- a/Modules/Core/include/mitkITKImageImport.h
+++ b/Modules/Core/include/mitkITKImageImport.h
@@ -1,201 +1,217 @@
/*============================================================================
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 MITKITKIMAGEIMPORT_H_HEADER_INCLUDED_C1E4861D
#define MITKITKIMAGEIMPORT_H_HEADER_INCLUDED_C1E4861D
#include "itkImageToImageFilterDetail.h"
#include "mitkImageSource.h"
#include <MitkCoreExports.h>
namespace mitk
{
/**
* @brief Pipelined import of itk::Image
*
* The image data contained in the itk::Image is referenced,
* not copied.
* The easiest way of use is by the function
* mitk::ImportItkImage
* \code
* mitkImage = mitk::ImportItkImage(itkImage);
* \endcode
* \sa ImportItkImage
* @ingroup Adaptor
*/
template <class TInputImage>
class MITK_EXPORT ITKImageImport : public ImageSource
{
public:
mitkClassMacro(ITKImageImport, ImageSource);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/// \brief The type of the input image.
typedef TInputImage InputImageType;
typedef typename InputImageType::Pointer InputImagePointer;
typedef typename InputImageType::ConstPointer InputImageConstPointer;
typedef typename InputImageType::RegionType InputImageRegionType;
typedef typename InputImageType::PixelType InputImagePixelType;
/** ImageDimension constants */
itkStaticConstMacro(InputImageDimension, unsigned int, TInputImage::ImageDimension);
itkStaticConstMacro(RegionDimension, unsigned int, mitk::SlicedData::RegionDimension);
/** \brief Set the input itk::Image of this image importer. */
InputImageType *GetInput(void);
/** \brief Set the input itk::Image of this image importer. */
void SetInput(const InputImageType *);
using itk::ProcessObject::SetInput;
/**
* \brief Set the Geometry of the result image (optional)
*
* The Geometry has to fit the dimension and size of
* the input image. The Geometry will be cloned, not
* referenced!
*
* Providing the Geometry is optional.
* The default behavior is to set the geometry by
* the itk::Image::GetDirection() information.
*/
void SetGeometry(const BaseGeometry *geometry);
protected:
ITKImageImport();
~ITKImageImport() override;
void GenerateOutputInformation() override;
void GenerateInputRequestedRegion() override;
void GenerateData() override;
void SetNthOutput(DataObjectPointerArraySizeType num, itk::DataObject *output) override;
/** Typedef for the region copier function object that converts an
* output region to an input region. */
typedef itk::ImageToImageFilterDetail::ImageRegionCopier<itkGetStaticConstMacro(InputImageDimension),
itkGetStaticConstMacro(RegionDimension)>
OutputToInputRegionCopierType;
BaseGeometry::Pointer m_Geometry;
};
/**
* @brief Imports an itk::Image (with a specific type) as an mitk::Image.
* @ingroup Adaptor
*
* Instantiates instance of ITKImageImport.
* mitk::ITKImageImport does not cast pixel types etc., it just imports
* image data. If you get a compile error, try image.GetPointer().
*
- * \param update: if \a true, fill mitk::Image, which will execute the
+ * \param itkimage
+ * \param geometry
+ *
+ * \param update if \a true, fill mitk::Image, which will execute the
* up-stream pipeline connected to the input itk::Image. Otherwise you
* need to make sure that Update() is called on the mitk::Image before
* its data is being used, e.g., by connecting it to an mitk-pipeline
* and call Update of a downstream filter at some time.
* \sa itk::Image::CastToMitkImage
*/
template <typename ItkOutputImageType>
Image::Pointer ImportItkImage(const itk::SmartPointer<ItkOutputImageType> &itkimage,
const BaseGeometry *geometry = nullptr,
bool update = true);
/**
* @brief Imports an itk::Image (with a specific type) as an mitk::Image.
* @ingroup Adaptor
*
* Instantiates instance of ITKImageImport
* mitk::ITKImageImport does not cast pixel types etc., it just imports
* image data. If you get a compile error, try image.GetPointer().
+ *
+ * \param itkimage
+ * \param geometry
*
- * \param update: if \a true, fill mitk::Image, which will execute the
+ * \param update if \a true, fill mitk::Image, which will execute the
* up-stream pipeline connected to the input itk::Image. Otherwise you
* need to make sure that Update() is called on the mitk::Image before
* its data is being used, e.g., by connecting it to an mitk-pipeline
* and call Update of a downstream filter at some time.
*
*
* \note If the source (itk image) and the target (mitk image) do not share the same scope, the
* mitk::GrabItkImageMemory
* function
* has to be used instead. Otherwise the image memory managed by the itk image is lost at a scope level change. This
* affects especially the
* usage in combination with AccessByItk macros as in following example code
*
- * \snippet Testing/mitkGrabItkImageMemoryTest.cpp OutOfScopeCall
+ * \snippet test/mitkGrabItkImageMemoryTest.cpp OutOfScopeCall
*
* which calls an ITK-like filter
*
- * \snippet Testing/mitkGrabItkImageMemoryTest.cpp ItkThresholdFilter
+ * \snippet test/mitkGrabItkImageMemoryTest.cpp ItkThresholdFilter
*
*
* \sa itk::Image::CastToMitkImage
* \sa GrabItkImageMemory
*/
template <typename ItkOutputImageType>
Image::Pointer ImportItkImage(const ItkOutputImageType *itkimage,
const BaseGeometry *geometry = nullptr,
bool update = true);
/**
* @brief Grabs the memory of an itk::Image (with a specific type)
* and puts it into an mitk::Image.
* @ingroup Adaptor
*
* The memory is managed by the mitk::Image after calling this
* function. The itk::Image remains valid until the mitk::Image
* decides to free the memory.
- * \param update: if \a true, fill mitk::Image, which will execute the
+ *
+ * \param itkimage
+ * \param mitkImage
+ * \param geometry
+ *
+ * \param update if \a true, fill mitk::Image, which will execute the
* up-stream pipeline connected to the input itk::Image. Otherwise you
* need to make sure that Update() is called on the mitk::Image before
* its data is being used, e.g., by connecting it to an mitk-pipeline
* and call Update of a downstream filter at some time.
* \sa ImportItkImage
*/
template <typename ItkOutputImageType>
Image::Pointer GrabItkImageMemory(itk::SmartPointer<ItkOutputImageType> &itkimage,
mitk::Image *mitkImage = nullptr,
const BaseGeometry *geometry = nullptr,
bool update = true);
/**
* @brief Grabs the memory of an itk::Image (with a specific type)
* and puts it into an mitk::Image.
* @ingroup Adaptor
*
* The memory is managed by the mitk::Image after calling this
* function. The itk::Image remains valid until the mitk::Image
* decides to free the memory.
- * \param update: if \a true, fill mitk::Image, which will execute the
+ *
+ * \param itkimage
+ * \param mitkImage
+ * \param geometry
+ *
+ * \param update if \a true, fill mitk::Image, which will execute the
* up-stream pipeline connected to the input itk::Image. Otherwise you
* need to make sure that Update() is called on the mitk::Image before
* its data is being used, e.g., by connecting it to an mitk-pipeline
* and call Update of a downstream filter at some time.
* \sa ImportItkImage
*/
template <typename ItkOutputImageType>
Image::Pointer GrabItkImageMemory(ItkOutputImageType *itkimage,
mitk::Image *mitkImage = nullptr,
const BaseGeometry *geometry = nullptr,
bool update = true);
} // namespace mitk
#ifndef MITK_MANUAL_INSTANTIATION
#include "mitkITKImageImport.txx"
#endif
#endif /* MITKITKIMAGEIMPORT_H_HEADER_INCLUDED_C1E4861D */
diff --git a/Modules/Core/include/mitkImage.h b/Modules/Core/include/mitkImage.h
index cdbbe2b5a7..fe8e646ebc 100644
--- a/Modules/Core/include/mitkImage.h
+++ b/Modules/Core/include/mitkImage.h
@@ -1,792 +1,799 @@
/*============================================================================
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 MITKIMAGE_H_HEADER_INCLUDED_C1C2FCD2
#define MITKIMAGE_H_HEADER_INCLUDED_C1C2FCD2
#include "mitkBaseData.h"
#include "mitkImageAccessorBase.h"
#include "mitkImageDataItem.h"
#include "mitkImageDescriptor.h"
#include "mitkImageVtkAccessor.h"
#include "mitkLevelWindow.h"
#include "mitkPlaneGeometry.h"
#include "mitkSlicedData.h"
#include <MitkCoreExports.h>
#include <mitkProportionalTimeGeometry.h>
// DEPRECATED
#include <mitkTimeSlicedGeometry.h>
#ifndef __itkHistogram_h
#include <itkHistogram.h>
#endif
class vtkImageData;
namespace itk
{
template <class T>
class MutexLockHolder;
}
namespace mitk
{
class SubImageSelector;
class ImageTimeSelector;
class ImageStatisticsHolder;
- //##Documentation
- //## @brief Image class for storing images
- //##
- //## Can be asked for header information, the data vector,
- //## the mitkIpPicDescriptor struct or vtkImageData objects. If not the complete
- //## data is required, the appropriate SubImageSelector class should be used
- //## for access.
- //## Image organizes sets of slices (s x 2D), volumes (t x 3D) and channels (n
- //## x ND). Channels are for different kind of data, e.g., morphology in
- //## channel 0, velocities in channel 1. All channels must have the same Geometry! In
- //## particular, the dimensions of all channels are the same, only the pixel-type
- //## may differ between channels.
- //##
- //## For importing ITK images use of mitk::ITKImageImport is recommended, see
- //## \ref Adaptor.
- //##
- //## For ITK v3.8 and older: Converting coordinates from the ITK physical
- //## coordinate system (which does not support rotated images) to the MITK world
- //## coordinate system should be performed via the BaseGeometry of the Image, see
- //## BaseGeometry::WorldToItkPhysicalPoint.
- //##
- //## For more information, see \ref MitkImagePage .
- //## @ingroup Data
+ /**
+ * @brief Image class for storing images
+ *
+ * Can be asked for header information, the data vector,
+ * the mitkIpPicDescriptor struct or vtkImageData objects. If not the complete
+ * data is required, the appropriate SubImageSelector class should be used
+ * for access.
+ * Image organizes sets of slices (s x 2D), volumes (t x 3D) and channels (n
+ * x ND). Channels are for different kind of data, e.g., morphology in
+ * channel 0, velocities in channel 1. All channels must have the same Geometry! In
+ * particular, the dimensions of all channels are the same, only the pixel-type
+ * may differ between channels.
+ *
+ * For importing ITK images use of mitk::ITKImageImport is recommended, see
+ * \ref Adaptor.
+ *
+ * For ITK v3.8 and older: Converting coordinates from the ITK physical
+ * coordinate system (which does not support rotated images) to the MITK world
+ * coordinate system should be performed via the BaseGeometry of the Image, see
+ * BaseGeometry::WorldToItkPhysicalPoint.
+ *
+ * For more information, see \ref MitkImagePage .
+ * @ingroup Data
+ */
class MITKCORE_EXPORT Image : public SlicedData
{
friend class SubImageSelector;
friend class ImageAccessorBase;
friend class ImageVtkAccessor;
friend class ImageVtkReadAccessor;
friend class ImageVtkWriteAccessor;
friend class ImageReadAccessor;
friend class ImageWriteAccessor;
public:
mitkClassMacro(Image, SlicedData);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
- /** Smart Pointer type to a ImageDataItem. */
- typedef itk::SmartPointer<ImageDataItem> ImageDataItemPointer;
+ /** Smart Pointer type to a ImageDataItem. */
+ typedef itk::SmartPointer<ImageDataItem> ImageDataItemPointer;
typedef itk::Statistics::Histogram<double> HistogramType;
typedef mitk::ImageStatisticsHolder *StatisticsHolderPointer;
- //## @param ImportMemoryManagementType This parameter is evaluated when setting new data to an image.
- //## The different options are:
- //## CopyMemory: Data to be set is copied and assigned to a new memory block. Data memory block will be freed on
- // deletion of mitk::Image.
- //## MamageMemory: Data to be set will be referenced, and Data memory block will be freed on deletion of
- //mitk::Image.
- //## Reference Memory: Data to be set will be referenced, but Data memory block will not be freed on deletion of
- // mitk::Image.
- //## DontManageMemory = ReferenceMemory.
+ /** This enum is evaluated when setting new data to an image.
+ */
enum ImportMemoryManagementType
{
- CopyMemory,
- ManageMemory,
- ReferenceMemory,
+ CopyMemory, /**< Data to be set is copied and assigned to a new memory block. Data memory block will be freed on deletion of mitk::Image. */
+ ManageMemory, /**< Data to be set will be referenced, and Data memory block will be freed on deletion of mitk::Image. */
+ ReferenceMemory, /**< Data to be set will be referenced, but Data memory block will not be freed on deletion of mitk::Image. */
DontManageMemory = ReferenceMemory
};
- //##Documentation
- //## @brief Vector container of SmartPointers to ImageDataItems;
- //## Class is only for internal usage to allow convenient access to all slices over iterators;
- //## See documentation of ImageDataItem for details.
+ /**
+ * @brief Vector container of SmartPointers to ImageDataItems;
+ * Class is only for internal usage to allow convenient access to all slices over iterators;
+ * See documentation of ImageDataItem for details.
+ */
typedef std::vector<ImageDataItemPointer> ImageDataItemPointerArray;
public:
- //##Documentation
- //## @brief Returns the PixelType of channel @a n.
+ /**
+ * @brief Returns the PixelType of channel @a n.
+ */
const mitk::PixelType GetPixelType(int n = 0) const;
- //##Documentation
- //## @brief Get dimension of the image
- //##
+ /**
+ * @brief Get dimension of the image
+ */
unsigned int GetDimension() const;
- //##Documentation
- //## @brief Get the size of dimension @a i (e.g., i=0 results in the number of pixels in x-direction).
- //##
- //## @sa GetDimensions()
+ /**
+ * @brief Get the size of dimension @a i (e.g., i=0 results in the number of pixels in x-direction).
+ *
+ * @sa GetDimensions()
+ */
unsigned int GetDimension(int i) const;
/** @brief Get the data vector of the complete image, i.e., of all channels linked together.
If you only want to access a slice, volume at a specific time or single channel
use one of the SubImageSelector classes.
\deprecatedSince{2012_09} Please use image accessors instead: See Doxygen/Related-Pages/Concepts/Image. This method
can be replaced by ImageWriteAccessor::GetData() or ImageReadAccessor::GetData() */
DEPRECATED(virtual void *GetData());
public:
/** @brief Get the pixel value at one specific index position.
The pixel type is always being converted to double.
\deprecatedSince{2012_09} Please use image accessors instead: See Doxygen/Related-Pages/Concepts/Image. This method
can be replaced by a method from ImagePixelWriteAccessor or ImagePixelReadAccessor */
DEPRECATED(double GetPixelValueByIndex(const itk::Index<3> &position,
unsigned int timestep = 0,
unsigned int component = 0));
/** @brief Get the pixel value at one specific world position.
The pixel type is always being converted to double.
Please consider using image accessors instead: See Doxygen/Related-Pages/Concepts/Image. This method
can be replaced by a templated method from ImagePixelWriteAccessor or ImagePixelReadAccessor */
double GetPixelValueByWorldCoordinate(const mitk::Point3D &position,
unsigned int timestep = 0,
unsigned int component = 0);
- //##Documentation
- //## @brief Get a volume at a specific time @a t of channel @a n as a vtkImageData.
+ /**
+ * @brief Get a volume at a specific time @a t of channel @a n as a vtkImageData.
+ */
virtual vtkImageData *GetVtkImageData(int t = 0, int n = 0);
virtual const vtkImageData *GetVtkImageData(int t = 0, int n = 0) const;
- //##Documentation
- //## @brief Get the complete image, i.e., all channels linked together, as a @a mitkIpPicDescriptor.
- //##
- //## If you only want to access a slice, volume at a specific time or single channel
- //## use one of the SubImageSelector classes.
- // virtual mitkIpPicDescriptor* GetPic();
-
- //##Documentation
- //## @brief Check whether slice @a s at time @a t in channel @a n is set
+ /**
+ * @brief Check whether slice @a s at time @a t in channel @a n is set
+ */
bool IsSliceSet(int s = 0, int t = 0, int n = 0) const override;
- //##Documentation
- //## @brief Check whether volume at time @a t in channel @a n is set
+ /**
+ * @brief Check whether volume at time @a t in channel @a n is set
+ */
bool IsVolumeSet(int t = 0, int n = 0) const override;
- //##Documentation
- //## @brief Check whether the channel @a n is set
+ /**
+ * @brief Check whether the channel @a n is set
+ */
bool IsChannelSet(int n = 0) const override;
- //##Documentation
- //## @brief Set @a data as slice @a s at time @a t in channel @a n. It is in
- //## the responsibility of the caller to ensure that the data vector @a data
- //## is really a slice (at least is not smaller than a slice), since there is
- //## no chance to check this.
- //##
- //## The data is copied to an array managed by the image. If the image shall
- //## reference the data, use SetImportSlice with ImportMemoryManagementType
- //## set to ReferenceMemory. For importing ITK images use of mitk::
- //## ITKImageImport is recommended.
- //## @sa SetPicSlice, SetImportSlice, SetImportVolume
+ /**
+ * @brief Set @a data as slice @a s at time @a t in channel @a n. It is in
+ * the responsibility of the caller to ensure that the data vector @a data
+ * is really a slice (at least is not smaller than a slice), since there is
+ * no chance to check this.
+ *
+ * The data is copied to an array managed by the image. If the image shall
+ * reference the data, use SetImportSlice with ImportMemoryManagementType
+ * set to ReferenceMemory. For importing ITK images use of mitk::
+ * ITKImageImport is recommended.
+ * @sa SetPicSlice, SetImportSlice, SetImportVolume
+ */
virtual bool SetSlice(const void *data, int s = 0, int t = 0, int n = 0);
- //##Documentation
- //## @brief Set @a data as volume at time @a t in channel @a n. It is in
- //## the responsibility of the caller to ensure that the data vector @a data
- //## is really a volume (at least is not smaller than a volume), since there is
- //## no chance to check this.
- //##
- //## The data is copied to an array managed by the image. If the image shall
- //## reference the data, use SetImportVolume with ImportMemoryManagementType
- //## set to ReferenceMemory. For importing ITK images use of mitk::
- //## ITKImageImport is recommended.
- //## @sa SetPicVolume, SetImportVolume
+ /**
+ * @brief Set @a data as volume at time @a t in channel @a n. It is in
+ * the responsibility of the caller to ensure that the data vector @a data
+ * is really a volume (at least is not smaller than a volume), since there is
+ * no chance to check this.
+ *
+ * The data is copied to an array managed by the image. If the image shall
+ * reference the data, use SetImportVolume with ImportMemoryManagementType
+ * set to ReferenceMemory. For importing ITK images use of mitk::
+ * ITKImageImport is recommended.
+ * @sa SetPicVolume, SetImportVolume
+ */
virtual bool SetVolume(const void *data, int t = 0, int n = 0);
- //##Documentation
- //## @brief Set @a data in channel @a n. It is in
- //## the responsibility of the caller to ensure that the data vector @a data
- //## is really a channel (at least is not smaller than a channel), since there is
- //## no chance to check this.
- //##
- //## The data is copied to an array managed by the image. If the image shall
- //## reference the data, use SetImportChannel with ImportMemoryManagementType
- //## set to ReferenceMemory. For importing ITK images use of mitk::
- //## ITKImageImport is recommended.
- //## @sa SetPicChannel, SetImportChannel
+ /**
+ * @brief Set @a data in channel @a n. It is in
+ * the responsibility of the caller to ensure that the data vector @a data
+ * is really a channel (at least is not smaller than a channel), since there is
+ * no chance to check this.
+ *
+ * The data is copied to an array managed by the image. If the image shall
+ * reference the data, use SetImportChannel with ImportMemoryManagementType
+ * set to ReferenceMemory. For importing ITK images use of mitk::
+ * ITKImageImport is recommended.
+ * @sa SetPicChannel, SetImportChannel
+ */
virtual bool SetChannel(const void *data, int n = 0);
- //##Documentation
- //## @brief Set @a data as slice @a s at time @a t in channel @a n. It is in
- //## the responsibility of the caller to ensure that the data vector @a data
- //## is really a slice (at least is not smaller than a slice), since there is
- //## no chance to check this.
- //##
- //## The data is managed according to the parameter \a importMemoryManagement.
- //## @sa SetPicSlice
+ /**
+ * @brief Set @a data as slice @a s at time @a t in channel @a n. It is in
+ * the responsibility of the caller to ensure that the data vector @a data
+ * is really a slice (at least is not smaller than a slice), since there is
+ * no chance to check this.
+ *
+ * The data is managed according to the parameter \a importMemoryManagement.
+ * @sa SetPicSlice
+ */
virtual bool SetImportSlice(
void *data, int s = 0, int t = 0, int n = 0, ImportMemoryManagementType importMemoryManagement = CopyMemory);
- //##Documentation
- //## @brief Set @a data as volume at time @a t in channel @a n. It is in
- //## the responsibility of the caller to ensure that the data vector @a data
- //## is really a volume (at least is not smaller than a volume), since there is
- //## no chance to check this.
- //##
- //## The data is managed according to the parameter \a importMemoryManagement.
- //## @sa SetPicVolume
+ /**
+ * @brief Set @a data as volume at time @a t in channel @a n. It is in
+ * the responsibility of the caller to ensure that the data vector @a data
+ * is really a volume (at least is not smaller than a volume), since there is
+ * no chance to check this.
+ *
+ * The data is managed according to the parameter \a importMemoryManagement.
+ * @sa SetPicVolume
+ */
virtual bool SetImportVolume(void *data,
int t = 0,
int n = 0,
ImportMemoryManagementType importMemoryManagement = CopyMemory);
virtual bool SetImportVolume(const void *const_data, int t = 0, int n = 0);
- //##Documentation
- //## @brief Set @a data in channel @a n. It is in
- //## the responsibility of the caller to ensure that the data vector @a data
- //## is really a channel (at least is not smaller than a channel), since there is
- //## no chance to check this.
- //##
- //## The data is managed according to the parameter \a importMemoryManagement.
- //## @sa SetPicChannel
+ /**
+ * @brief Set @a data in channel @a n. It is in
+ * the responsibility of the caller to ensure that the data vector @a data
+ * is really a channel (at least is not smaller than a channel), since there is
+ * no chance to check this.
+ *
+ * The data is managed according to the parameter \a importMemoryManagement.
+ * @sa SetPicChannel
+ */
virtual bool SetImportChannel(void *data,
int n = 0,
ImportMemoryManagementType importMemoryManagement = CopyMemory);
- //##Documentation
- //## initialize new (or re-initialize) image information
- //## @warning Initialize() by pic assumes a plane, evenly spaced geometry starting at (0,0,0).
+ /**
+ * initialize new (or re-initialize) image information
+ * @warning Initialize() by pic assumes a plane, evenly spaced geometry starting at (0,0,0).
+ */
virtual void Initialize(const mitk::PixelType &type,
unsigned int dimension,
const unsigned int *dimensions,
unsigned int channels = 1);
- //##Documentation
- //## initialize new (or re-initialize) image information by a BaseGeometry
- //##
- //## @param tDim defines the number of time steps for which the Image should be initialized
+ /**
+ * initialize new (or re-initialize) image information by a BaseGeometry
+ *
+ * \param type
+ * \param geometry
+ * \param channels
+ * @param tDim defines the number of time steps for which the Image should be initialized
+ */
virtual void Initialize(const mitk::PixelType &type,
const mitk::BaseGeometry &geometry,
unsigned int channels = 1,
int tDim = 1);
/**
* initialize new (or re-initialize) image information by a TimeGeometry
*
- * @param tDim defines the number of time steps for which the Image should be initialized
* \deprecatedSince{2013_09} Please use TimeGeometry instead of TimeSlicedGeometry. For more information see
* http://www.mitk.org/Development/Refactoring%20of%20the%20Geometry%20Classes%20-%20Part%201
*/
DEPRECATED(virtual void Initialize(const mitk::PixelType & /*type*/,
const mitk::TimeSlicedGeometry * /*geometry*/,
unsigned int /*channels = 1*/,
int /*tDim=1*/))
{
}
/**
* \brief Initialize new (or re-initialize) image information by a TimeGeometry
*
+ * \param type
+ * \param geometry
+ * \param channels
* \param tDim override time dimension if the value is bigger than 0 (Default -1)
*/
virtual void Initialize(const mitk::PixelType &type,
const mitk::TimeGeometry &geometry,
unsigned int channels = 1,
int tDim = -1);
- //##Documentation
- //## initialize new (or re-initialize) image information by a PlaneGeometry and number of slices
- //##
- //## Initializes the bounding box according to the width/height of the
- //## PlaneGeometry and @a sDim via SlicedGeometry3D::InitializeEvenlySpaced.
- //## The spacing is calculated from the PlaneGeometry.
- //## \sa SlicedGeometry3D::InitializeEvenlySpaced
- //## \deprecatedSince{2016_11} Use a left-handed or right-handed PlaneGeometry to define the
- //## direction of the image stack instead of the flipped parameter
+ /**
+ * initialize new (or re-initialize) image information by a PlaneGeometry and number of slices
+ *
+ * Initializes the bounding box according to the width/height of the
+ * PlaneGeometry and @a sDim via SlicedGeometry3D::InitializeEvenlySpaced.
+ * The spacing is calculated from the PlaneGeometry.
+ * \sa SlicedGeometry3D::InitializeEvenlySpaced
+ * \deprecatedSince{2016_11} Use a left-handed or right-handed PlaneGeometry to define the
+ * direction of the image stack instead of the flipped parameter
+ */
DEPRECATED(virtual void Initialize(const mitk::PixelType &type,
int sDim,
const mitk::PlaneGeometry &geometry2d,
bool flipped,
unsigned int channels = 1,
int tDim = 1));
virtual void Initialize(const mitk::PixelType &type,
int sDim,
const mitk::PlaneGeometry &geometry2d,
unsigned int channels = 1,
int tDim = 1);
- //##Documentation
- //## initialize new (or re-initialize) image information by another
- //## mitk-image.
- //## Only the header is used, not the data vector!
- //##
+ /**
+ * initialize new (or re-initialize) image information by another
+ * mitk-image.
+ * Only the header is used, not the data vector!
+ */
virtual void Initialize(const mitk::Image *image);
virtual void Initialize(const mitk::ImageDescriptor::Pointer inDesc);
- //##Documentation
- //## initialize new (or re-initialize) image information by @a pic.
- //## Dimensions and @a Geometry3D /@a PlaneGeometry are set according
- //## to the tags in @a pic.
- //## Only the header is used, not the data vector! Use SetPicVolume(pic)
- //## to set the data vector.
- //##
- //## @param tDim override time dimension (@a n[3]) in @a pic (if >0)
- //## @param sDim override z-space dimension (@a n[2]) in @a pic (if >0)
- //## @warning Initialize() by pic assumes a plane, evenly spaced geometry starting at (0,0,0).
- // virtual void Initialize(const mitkIpPicDescriptor* pic, int channels = 1, int tDim = -1, int sDim = -1);
-
- //##Documentation
- //## initialize new (or re-initialize) image information by @a vtkimagedata,
- //## a vtk-image.
- //## Only the header is used, not the data vector! Use
- //## SetVolume(vtkimage->GetScalarPointer()) to set the data vector.
- //##
- //## @param tDim override time dimension in @a vtkimagedata (if >0 and <)
- //## @param sDim override z-space dimension in @a vtkimagedata (if >0 and <)
- //## @param pDim override y-space dimension in @a vtkimagedata (if >0 and <)
+ /**
+ * initialize new (or re-initialize) image information by @a vtkimagedata,
+ * a vtk-image.
+ * Only the header is used, not the data vector! Use
+ * SetVolume(vtkimage->GetScalarPointer()) to set the data vector.
+ *
+ * @param vtkimagedata
+ * @param channels
+ * @param tDim override time dimension in @a vtkimagedata (if >0 and <)
+ * @param sDim override z-space dimension in @a vtkimagedata (if >0 and <)
+ * @param pDim override y-space dimension in @a vtkimagedata (if >0 and <)
+ */
virtual void Initialize(vtkImageData *vtkimagedata, int channels = 1, int tDim = -1, int sDim = -1, int pDim = -1);
- //##Documentation
- //## initialize new (or re-initialize) image information by @a itkimage,
- //## a templated itk-image.
- //## Only the header is used, not the data vector! Use
- //## SetVolume(itkimage->GetBufferPointer()) to set the data vector.
- //##
- //## @param tDim override time dimension in @a itkimage (if >0 and <)
- //## @param sDim override z-space dimension in @a itkimage (if >0 and <)
+ /**
+ * initialize new (or re-initialize) image information by @a itkimage,
+ * a templated itk-image.
+ * Only the header is used, not the data vector! Use
+ * SetVolume(itkimage->GetBufferPointer()) to set the data vector.
+ *
+ * @param itkimage
+ * @param channels
+ * @param tDim override time dimension in @a itkimage (if >0 and <)
+ * @param sDim override z-space dimension in @a itkimage (if >0 and <)
+ */
template <typename itkImageType>
void InitializeByItk(const itkImageType *itkimage, int channels = 1, int tDim = -1, int sDim = -1)
{
if (itkimage == nullptr)
return;
MITK_DEBUG << "Initializing MITK image from ITK image.";
// build array with dimensions in each direction with at least 4 entries
m_Dimension = itkimage->GetImageDimension();
unsigned int i, *tmpDimensions = new unsigned int[m_Dimension > 4 ? m_Dimension : 4];
for (i = 0; i < m_Dimension; ++i)
tmpDimensions[i] = itkimage->GetLargestPossibleRegion().GetSize().GetSize()[i];
if (m_Dimension < 4)
{
unsigned int *p;
for (i = 0, p = tmpDimensions + m_Dimension; i < 4 - m_Dimension; ++i, ++p)
*p = 1;
}
// overwrite number of slices if sDim is set
if ((m_Dimension > 2) && (sDim >= 0))
tmpDimensions[2] = sDim;
// overwrite number of time points if tDim is set
if ((m_Dimension > 3) && (tDim >= 0))
tmpDimensions[3] = tDim;
// rough initialization of Image
// mitk::PixelType importType = ImportItkPixelType( itkimage::PixelType );
Initialize(
MakePixelType<itkImageType>(itkimage->GetNumberOfComponentsPerPixel()), m_Dimension, tmpDimensions, channels);
const typename itkImageType::SpacingType &itkspacing = itkimage->GetSpacing();
MITK_DEBUG << "ITK spacing " << itkspacing;
// access spacing of itk::Image
Vector3D spacing;
FillVector3D(spacing, itkspacing[0], 1.0, 1.0);
if (m_Dimension >= 2)
spacing[1] = itkspacing[1];
if (m_Dimension >= 3)
spacing[2] = itkspacing[2];
// access origin of itk::Image
Point3D origin;
const typename itkImageType::PointType &itkorigin = itkimage->GetOrigin();
MITK_DEBUG << "ITK origin " << itkorigin;
FillVector3D(origin, itkorigin[0], 0.0, 0.0);
if (m_Dimension >= 2)
origin[1] = itkorigin[1];
if (m_Dimension >= 3)
origin[2] = itkorigin[2];
// access direction of itk::Imagm_PixelType = new mitk::PixelType(type);e and include spacing
const typename itkImageType::DirectionType &itkdirection = itkimage->GetDirection();
MITK_DEBUG << "ITK direction " << itkdirection;
mitk::Matrix3D matrix;
matrix.SetIdentity();
unsigned int j, itkDimMax3 = (m_Dimension >= 3 ? 3 : m_Dimension);
// check if spacing has no zero entry and itkdirection has no zero columns
bool itkdirectionOk = true;
mitk::ScalarType columnSum;
for (j = 0; j < itkDimMax3; ++j)
{
columnSum = 0.0;
for (i = 0; i < itkDimMax3; ++i)
{
columnSum += fabs(itkdirection[i][j]);
}
if (columnSum < mitk::eps)
{
itkdirectionOk = false;
}
if ((spacing[j] < -mitk::eps) // (normally sized) negative value
&&
(j == 2) && (m_Dimensions[2] == 1))
{
// Negative spacings can occur when reading single DICOM slices with ITK via GDCMIO
// In these cases spacing is not determind by ITK correctly (because it distinguishes correctly
// between slice thickness and inter slice distance -- slice distance is meaningless for
// single slices).
// I experienced that ITK produced something meaningful nonetheless because is is
// evaluating the tag "(0018,0088) Spacing between slices" as a fallback. This tag is not
// reliable (http://www.itk.org/pipermail/insight-users/2005-September/014711.html)
// but gives at least a hint.
// In real world cases I experienced that this tag contained the correct inter slice distance
// with a negative sign, so we just invert such negative spacings.
MITK_WARN << "Illegal value of itk::Image::GetSpacing()[" << j << "]=" << spacing[j]
<< ". Using inverted value " << -spacing[j];
spacing[j] = -spacing[j];
}
else if (spacing[j] < mitk::eps) // value near zero
{
MITK_ERROR << "Illegal value of itk::Image::GetSpacing()[" << j << "]=" << spacing[j]
<< ". Using 1.0 instead.";
spacing[j] = 1.0;
}
}
if (itkdirectionOk == false)
{
MITK_ERROR << "Illegal matrix returned by itk::Image::GetDirection():" << itkdirection
<< " Using identity instead.";
for (i = 0; i < itkDimMax3; ++i)
for (j = 0; j < itkDimMax3; ++j)
if (i == j)
matrix[i][j] = spacing[j];
else
matrix[i][j] = 0.0;
}
else
{
for (i = 0; i < itkDimMax3; ++i)
for (j = 0; j < itkDimMax3; ++j)
matrix[i][j] = itkdirection[i][j] * spacing[j];
}
// re-initialize PlaneGeometry with origin and direction
PlaneGeometry *planeGeometry = static_cast<PlaneGeometry *>(GetSlicedGeometry(0)->GetPlaneGeometry(0));
planeGeometry->SetOrigin(origin);
planeGeometry->GetIndexToWorldTransform()->SetMatrix(matrix);
// re-initialize SlicedGeometry3D
SlicedGeometry3D *slicedGeometry = GetSlicedGeometry(0);
slicedGeometry->InitializeEvenlySpaced(planeGeometry, m_Dimensions[2]);
slicedGeometry->SetSpacing(spacing);
// re-initialize TimeGeometry
ProportionalTimeGeometry::Pointer timeGeometry = ProportionalTimeGeometry::New();
timeGeometry->Initialize(slicedGeometry, m_Dimensions[3]);
SetTimeGeometry(timeGeometry);
// clean-up
delete[] tmpDimensions;
this->Initialize();
}
- //##Documentation
- //## @brief Check whether slice @a s at time @a t in channel @a n is valid, i.e.,
- //## is (or can be) inside of the image
+ /**
+ * @brief Check whether slice @a s at time @a t in channel @a n is valid, i.e.,
+ * is (or can be) inside of the image
+ */
virtual bool IsValidSlice(int s = 0, int t = 0, int n = 0) const;
- //##Documentation
- //## @brief Check whether volume at time @a t in channel @a n is valid, i.e.,
- //## is (or can be) inside of the image
+ /**
+ * @brief Check whether volume at time @a t in channel @a n is valid, i.e.,
+ * is (or can be) inside of the image
+ */
virtual bool IsValidVolume(int t = 0, int n = 0) const;
- //##Documentation
- //## @brief Check whether the channel @a n is valid, i.e.,
- //## is (or can be) inside of the image
+ /**
+ * @brief Check whether the channel @a n is valid, i.e.,
+ * is (or can be) inside of the image
+ */
virtual bool IsValidChannel(int n = 0) const;
- //##Documentation
- //## @brief Returns true if an image is rotated, i.e. its geometry's
- //## transformation matrix has nonzero elements besides the diagonal.
- //## Non-diagonal elements are checked if larger then 1/1000 of the matrix' trace.
+ /**
+ * @brief Returns true if an image is rotated, i.e. its geometry's
+ * transformation matrix has nonzero elements besides the diagonal.
+ * Non-diagonal elements are checked if larger then 1/1000 of the matrix' trace.
+ */
bool IsRotated() const;
- //##Documentation
- //## @brief Get the sizes of all dimensions as an integer-array.
- //##
- //## @sa GetDimension(int i);
+ /**
+ * @brief Get the sizes of all dimensions as an integer-array.
+ *
+ * @sa GetDimension(int i);
+ */
unsigned int *GetDimensions() const;
ImageDescriptor::Pointer GetImageDescriptor() const { return m_ImageDescriptor; }
ChannelDescriptor GetChannelDescriptor(int id = 0) const { return m_ImageDescriptor->GetChannelDescriptor(id); }
/** \brief Sets a geometry to an image.
*/
void SetGeometry(BaseGeometry *aGeometry3D) override;
/**
* @warning for internal use only
*/
virtual ImageDataItemPointer GetSliceData(int s = 0,
int t = 0,
int n = 0,
void *data = nullptr,
ImportMemoryManagementType importMemoryManagement = CopyMemory) const;
/**
* @warning for internal use only
*/
virtual ImageDataItemPointer GetVolumeData(int t = 0,
int n = 0,
void *data = nullptr,
ImportMemoryManagementType importMemoryManagement = CopyMemory) const;
/**
* @warning for internal use only
*/
virtual ImageDataItemPointer GetChannelData(int n = 0,
void *data = nullptr,
ImportMemoryManagementType importMemoryManagement = CopyMemory) const;
/**
\brief (DEPRECATED) Get the minimum for scalar images
*/
DEPRECATED(ScalarType GetScalarValueMin(int t = 0) const);
/**
\brief (DEPRECATED) Get the maximum for scalar images
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED(ScalarType GetScalarValueMax(int t = 0) const);
/**
\brief (DEPRECATED) Get the second smallest value for scalar images
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED(ScalarType GetScalarValue2ndMin(int t = 0) const);
/**
\brief (DEPRECATED) Get the smallest value for scalar images, but do not recompute it first
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED(ScalarType GetScalarValueMinNoRecompute(unsigned int t = 0) const);
/**
\brief (DEPRECATED) Get the second smallest value for scalar images, but do not recompute it first
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED(ScalarType GetScalarValue2ndMinNoRecompute(unsigned int t = 0) const);
/**
\brief (DEPRECATED) Get the second largest value for scalar images
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED(ScalarType GetScalarValue2ndMax(int t = 0) const);
/**
\brief (DEPRECATED) Get the largest value for scalar images, but do not recompute it first
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED(ScalarType GetScalarValueMaxNoRecompute(unsigned int t = 0) const);
/**
\brief (DEPRECATED) Get the second largest value for scalar images, but do not recompute it first
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED(ScalarType GetScalarValue2ndMaxNoRecompute(unsigned int t = 0) const);
/**
\brief (DEPRECATED) Get the count of voxels with the smallest scalar value in the dataset
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED(ScalarType GetCountOfMinValuedVoxels(int t = 0) const);
/**
\brief (DEPRECATED) Get the count of voxels with the largest scalar value in the dataset
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED(ScalarType GetCountOfMaxValuedVoxels(int t = 0) const);
/**
\brief (DEPRECATED) Get the count of voxels with the largest scalar value in the dataset
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED(unsigned int GetCountOfMaxValuedVoxelsNoRecompute(unsigned int t = 0) const);
/**
\brief (DEPRECATED) Get the count of voxels with the smallest scalar value in the dataset
\warning This method is deprecated and will not be available in the future. Use the \a GetStatistics instead
*/
DEPRECATED(unsigned int GetCountOfMinValuedVoxelsNoRecompute(unsigned int t = 0) const);
/**
\brief Returns a pointer to the ImageStatisticsHolder object that holds all statistics information for the image.
All Get-methods for statistics properties formerly accessible directly from an Image object are now moved to the
new \a ImageStatisticsHolder object.
*/
StatisticsHolderPointer GetStatistics() const { return m_ImageStatistics; }
protected:
mitkCloneMacro(Self);
typedef itk::MutexLockHolder<itk::SimpleFastMutexLock> MutexHolder;
int GetSliceIndex(int s = 0, int t = 0, int n = 0) const;
int GetVolumeIndex(int t = 0, int n = 0) const;
void ComputeOffsetTable();
virtual bool IsValidTimeStep(int t) const;
void Expand(unsigned int timeSteps) override;
virtual ImageDataItemPointer AllocateSliceData(
int s = 0,
int t = 0,
int n = 0,
void *data = nullptr,
ImportMemoryManagementType importMemoryManagement = CopyMemory) const;
virtual ImageDataItemPointer AllocateVolumeData(
int t = 0, int n = 0, void *data = nullptr, ImportMemoryManagementType importMemoryManagement = CopyMemory) const;
virtual ImageDataItemPointer AllocateChannelData(
int n = 0, void *data = nullptr, ImportMemoryManagementType importMemoryManagement = CopyMemory) const;
Image();
Image(const Image &other);
~Image() override;
void Clear() override;
- //## @warning Has to be called by every Initialize method!
+ /** @warning Has to be called by every Initialize method! */
void Initialize() override;
void PrintSelf(std::ostream &os, itk::Indent indent) const override;
mutable ImageDataItemPointerArray m_Channels;
mutable ImageDataItemPointerArray m_Volumes;
mutable ImageDataItemPointerArray m_Slices;
mutable itk::SimpleFastMutexLock m_ImageDataArraysLock;
unsigned int m_Dimension;
unsigned int *m_Dimensions;
ImageDescriptor::Pointer m_ImageDescriptor;
size_t *m_OffsetTable;
ImageDataItemPointer m_CompleteData;
// Image statistics Holder replaces the former implementation directly inside this class
friend class ImageStatisticsHolder;
StatisticsHolderPointer m_ImageStatistics;
private:
ImageDataItemPointer GetSliceData_unlocked(
int s, int t, int n, void *data, ImportMemoryManagementType importMemoryManagement) const;
ImageDataItemPointer GetVolumeData_unlocked(int t,
int n,
void *data,
ImportMemoryManagementType importMemoryManagement) const;
ImageDataItemPointer GetChannelData_unlocked(int n,
void *data,
ImportMemoryManagementType importMemoryManagement) const;
ImageDataItemPointer AllocateSliceData_unlocked(
int s, int t, int n, void *data, ImportMemoryManagementType importMemoryManagement) const;
ImageDataItemPointer AllocateVolumeData_unlocked(int t,
int n,
void *data,
ImportMemoryManagementType importMemoryManagement) const;
ImageDataItemPointer AllocateChannelData_unlocked(int n,
void *data,
ImportMemoryManagementType importMemoryManagement) const;
bool IsSliceSet_unlocked(int s, int t, int n) const;
bool IsVolumeSet_unlocked(int t, int n) const;
bool IsChannelSet_unlocked(int n) const;
/** Stores all existing ImageReadAccessors */
mutable std::vector<ImageAccessorBase *> m_Readers;
/** Stores all existing ImageWriteAccessors */
mutable std::vector<ImageAccessorBase *> m_Writers;
/** Stores all existing ImageVtkAccessors */
mutable std::vector<ImageAccessorBase *> m_VtkReaders;
/** A mutex, which needs to be locked to manage m_Readers and m_Writers */
itk::SimpleFastMutexLock m_ReadWriteLock;
/** A mutex, which needs to be locked to manage m_VtkReaders */
itk::SimpleFastMutexLock m_VtkReadersLock;
};
/**
* @brief Equal A function comparing two images for beeing equal in meta- and imagedata
* @warning This method is deprecated and will not be available in the future. Use the \a bool mitk::Equal(const
* mitk::Image& i1, const mitk::Image& i2) instead.
*
* @ingroup MITKTestingAPI
*
* Following aspects are tested for equality:
* - dimension of the images
* - size of the images
* - pixel type
* - pixel values : pixel values are expected to be identical at each position ( for other options see
* mitk::CompareImageFilter )
*
* @param rightHandSide An image to be compared
* @param leftHandSide An image to be compared
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return true, if all subsequent comparisons are true, false otherwise
*/
DEPRECATED(MITKCORE_EXPORT bool Equal(
const mitk::Image *leftHandSide, const mitk::Image *rightHandSide, ScalarType eps, bool verbose));
/**
* @brief Equal A function comparing two images for beeing equal in meta- and imagedata
*
* @ingroup MITKTestingAPI
*
* Following aspects are tested for equality:
* - dimension of the images
* - size of the images
* - pixel type
* - pixel values : pixel values are expected to be identical at each position ( for other options see
* mitk::CompareImageFilter )
*
* @param rightHandSide An image to be compared
* @param leftHandSide An image to be compared
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return true, if all subsequent comparisons are true, false otherwise
*/
MITKCORE_EXPORT bool Equal(const mitk::Image &leftHandSide,
const mitk::Image &rightHandSide,
ScalarType eps,
bool verbose);
} // namespace mitk
#endif /* MITKIMAGE_H_HEADER_INCLUDED_C1C2FCD2 */
diff --git a/Modules/Core/include/mitkImageAccessByItk.h b/Modules/Core/include/mitkImageAccessByItk.h
index aae0c058f1..388e92c867 100644
--- a/Modules/Core/include/mitkImageAccessByItk.h
+++ b/Modules/Core/include/mitkImageAccessByItk.h
@@ -1,706 +1,706 @@
/*============================================================================
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 MITKIMAGEACCESSBYITK_H_HEADER_INCLUDED
#define MITKIMAGEACCESSBYITK_H_HEADER_INCLUDED
#include <itkCastImageFilter.h>
#include <mitkImageToItk.h>
#include <mitkPPArgCount.h>
#include <boost/preprocessor/expand.hpp>
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/seq/for_each_product.hpp>
#include <boost/preprocessor/seq/to_tuple.hpp>
#include <boost/preprocessor/stringize.hpp>
#include <boost/preprocessor/tuple/rem.hpp>
#include <sstream>
namespace mitk
{
/**
* \brief Exception class thrown in #AccessByItk macros.
*
* This exception can be thrown by the invocation of the #AccessByItk macros,
* if the MITK image is of non-expected dimension or pixel type.
*
* \ingroup Adaptor
*/
class AccessByItkException : public virtual std::runtime_error
{
public:
AccessByItkException(const std::string &msg) : std::runtime_error(msg) {}
~AccessByItkException() throw() override {}
};
}
#ifndef DOXYGEN_SKIP
#define _accessByItkPixelTypeException(pixelType, pixelTypeSeq) \
{ \
std::string msg("Pixel type "); \
msg.append(pixelType.GetPixelTypeAsString()); \
msg.append(" is not in " BOOST_PP_STRINGIZE(pixelTypeSeq)); \
throw mitk::AccessByItkException(msg); \
}
#define _accessByItkDimensionException(dim, validDims) \
{ \
std::stringstream msg; \
msg << "Dimension " << (dim) << " is not in " << validDims; \
throw mitk::AccessByItkException(msg.str()); \
}
#define _checkSpecificDimensionIter(r, mitkImage, dim) \
if (mitkImage->GetDimension() == dim) \
; \
else
#define _checkSpecificDimension(mitkImage, dimSeq) \
BOOST_PP_SEQ_FOR_EACH(_checkSpecificDimensionIter, mitkImage, dimSeq) \
_accessByItkDimensionException(mitkImage->GetDimension(), BOOST_PP_STRINGIZE(dimSeq))
#define _msvc_expand_bug(macro, arg) BOOST_PP_EXPAND(macro arg)
//-------------------------------- 0-Arg Versions --------------------------------------
#define _accessByItk(itkImageTypeFunctionAndImageSeq, pixeltype, dimension) \
if (pixelType == mitk::MakePixelType<pixeltype, dimension>(pixelType.GetNumberOfComponents()) && \
BOOST_PP_SEQ_TAIL(itkImageTypeFunctionAndImageSeq)->GetDimension() == dimension) \
{ \
BOOST_PP_SEQ_HEAD(itkImageTypeFunctionAndImageSeq) \
(mitk::ImageToItkImage<pixeltype, dimension>(BOOST_PP_SEQ_TAIL(itkImageTypeFunctionAndImageSeq)).GetPointer()); \
} \
else
#define _accessByItkArgs(itkImageTypeFunction, type) (itkImageTypeFunction, BOOST_PP_TUPLE_REM(2) type)
// product will be of the form ((itkImageTypeFunction)(mitkImage))(short)(2) for pixel type short and dimension 2
#ifdef _MSC_VER
#define _accessByItkProductIter(r, product) \
_msvc_expand_bug( \
_accessByItk, \
_msvc_expand_bug(_accessByItkArgs, (BOOST_PP_SEQ_HEAD(product), BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(product)))))
#else
#define _accessByItkProductIter(r, product) \
BOOST_PP_EXPAND( \
_accessByItk _accessByItkArgs(BOOST_PP_SEQ_HEAD(product), BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(product))))
#endif
#define _accessFixedTypeByItk(itkImageTypeFunction, mitkImage, pixelTypeSeq, dimSeq) \
BOOST_PP_SEQ_FOR_EACH_PRODUCT(_accessByItkProductIter, (((itkImageTypeFunction)(mitkImage)))(pixelTypeSeq)(dimSeq))
//-------------------------------- n-Arg Versions --------------------------------------
#define _accessByItk_n(itkImageTypeFunctionAndImageSeq, pixeltype, dimension, args) \
if (pixelType == mitk::MakePixelType<pixeltype, dimension>(pixelType.GetNumberOfComponents()) && \
BOOST_PP_SEQ_TAIL(itkImageTypeFunctionAndImageSeq)->GetDimension() == dimension) \
{ \
BOOST_PP_SEQ_HEAD(itkImageTypeFunctionAndImageSeq) \
(mitk::ImageToItkImage<pixeltype, dimension>(BOOST_PP_SEQ_TAIL(itkImageTypeFunctionAndImageSeq)).GetPointer(), \
BOOST_PP_TUPLE_REM(BOOST_PP_SEQ_HEAD(args)) BOOST_PP_SEQ_TAIL(args)); \
} \
else
#define _accessByItkArgs_n(itkImageTypeFunction, type, args) (itkImageTypeFunction, BOOST_PP_TUPLE_REM(2) type, args)
// product will be of the form (((itkImageTypeFunction)(mitkImage))(3)(a,b,c))(short)(2)
// for the variable argument list a,b,c and for pixel type short and dimension 2
#ifdef _MSC_VER
#define _accessByItkProductIter_n(r, product) \
_msvc_expand_bug(_accessByItk_n, \
_msvc_expand_bug(_accessByItkArgs_n, \
(BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_HEAD(product)), \
BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(product)), \
BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_HEAD(product)))))
#else
#define _accessByItkProductIter_n(r, product) \
BOOST_PP_EXPAND(_accessByItk_n _accessByItkArgs_n(BOOST_PP_SEQ_HEAD(BOOST_PP_SEQ_HEAD(product)), \
BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(product)), \
BOOST_PP_SEQ_TAIL(BOOST_PP_SEQ_HEAD(product))))
#endif
#define _accessFixedTypeByItk_n(itkImageTypeFunction, mitkImage, pixelTypeSeq, dimSeq, va_tuple) \
BOOST_PP_SEQ_FOR_EACH_PRODUCT( \
_accessByItkProductIter_n, \
((((itkImageTypeFunction)(mitkImage))(MITK_PP_ARG_COUNT va_tuple)va_tuple))(pixelTypeSeq)(dimSeq))
#endif // DOXYGEN_SKIP
/**
* \brief Access a MITK image by an ITK image
*
* Define a templated function or method (\a itkImageTypeFunction)
* within which the mitk-image (\a mitkImage) is accessed:
* \code
* template < typename TPixel, unsigned int VImageDimension >
* void ExampleFunction( itk::Image<TPixel, VImageDimension>* itkImage );
* \endcode
*
* The itk::Image passed to the function/method has the same
* data-pointer as the mitk-image. Depending on the const-ness of the
* \c mitkImage, your templated access function needs to take a const or
* non-const itk::Image pointer and you will get read-only or full read/write
* access to the data vector of the mitk-image using the itk-image.
*
* Example code using the access function above:
* \code
* mitk::Image* inputMitkImage = ...
* try
* {
* AccessByItk(inputMitkImage, ExampleFunction);
* }
* catch (const mitk::AccessByItkException& e)
* {
* // mitk::Image is of wrong pixel type or dimension,
* // insert error handling here
* }
* \endcode
*
* \param mitkImage The MITK input image.
* \param itkImageTypeFunction The templated access-function to be called.
*
* \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
*
* \note If your inputMitkImage is an mitk::Image::Pointer, use
* inputMitkImage.GetPointer()
* \note If you need to pass additional parameters to your
* access-function (\a itkImageTypeFunction), use #AccessByItk_n.
* \note If you know the dimension of your input mitk-image,
* it is better to use AccessFixedDimensionByItk (less code
* is generated).
* \sa AccessFixedDimensionByItk
* \sa AccessFixedTypeByItk
* \sa AccessFixedPixelTypeByItk
* \sa AccessByItk_n
*
* \ingroup Adaptor
*/
#define AccessByItk(mitkImage, itkImageTypeFunction) \
AccessFixedTypeByItk( \
mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
/**
* \brief Access a mitk-image with known pixeltype (but unknown dimension) by an itk-image.
*
* For usage, see #AccessByItk.
*
* \param pixelTypeSeq A sequence of pixel types, like (short)(char)(int)
* \param mitkImage The MITK input image.
* \param itkImageTypeFunction The templated access-function to be called.
*
* \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
*
* If the image has a different pixel type, a mitk::AccessByItkException exception is
* thrown. If you do not know the pixel type for sure, use #AccessByItk.
*
* \sa AccessByItk
* \sa AccessFixedDimensionByItk
* \sa AccessFixedTypeByItk
* \sa AccessFixedPixelTypeByItk_n
*
* \ingroup Adaptor
*/
#define AccessFixedPixelTypeByItk(mitkImage, itkImageTypeFunction, pixelTypeSeq) \
AccessFixedTypeByItk(mitkImage, itkImageTypeFunction, pixelTypeSeq, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
/**
* \brief Access a mitk-image with an integral pixel type by an itk-image
*
* See #AccessByItk for details.
*
* \param mitkImage The MITK input image.
* \param itkImageTypeFunction The templated access-function to be called.
*
* \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
*
* \sa AccessFixedPixelTypeByItk
* \sa AccessByItk
* \sa AccessIntegralPixelTypeByItk_n
*/
#define AccessIntegralPixelTypeByItk(mitkImage, itkImageTypeFunction) \
AccessFixedTypeByItk( \
mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
/**
* \brief Access a mitk-image with a floating point pixel type by an ITK image
*
* See #AccessByItk for details.
*
* \param mitkImage The MITK input image.
* \param itkImageTypeFunction The templated access-function to be called.
*
* \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
*
* \sa AccessFixedPixelTypeByItk
* \sa AccessByItk
* \sa AccessFloatingPixelTypeByItk_n
*/
#define AccessFloatingPixelTypeByItk(mitkImage, itkImageTypeFunction) \
AccessFixedTypeByItk( \
mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
#define AccessVectorPixelTypeByItk(mitkImage, itkImageTypeFunction) \
AccessFixedTypeByItk( \
mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_VECTOR_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ)
/**
* \brief Access a mitk-image with known dimension by an itk-image
*
* For usage, see #AccessByItk.
*
* \param dimension Dimension of the mitk-image. If the image has a different dimension,
* a mitk::AccessByItkException exception is thrown.
* \param mitkImage The MITK input image.
* \param itkImageTypeFunction The templated access-function to be called.
*
* \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
*
* \note If you do not know the dimension for sure, use #AccessByItk.
*
* \sa AccessByItk
* \sa AccessFixedDimensionByItk_n
* \sa AccessFixedTypeByItk
* \sa AccessFixedPixelTypeByItk
*
* \ingroup Adaptor
*/
#define AccessFixedDimensionByItk(mitkImage, itkImageTypeFunction, dimension) \
AccessFixedTypeByItk(mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_PIXEL_TYPES_SEQ, (dimension))
#define AccessVectorFixedDimensionByItk(mitkImage, itkImageTypeFunction, dimension) \
AccessFixedTypeByItk(mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_VECTOR_PIXEL_TYPES_SEQ, (dimension))
/**
* \brief Access a mitk-image with known type (pixel type and dimension) by an itk-image.
*
* The provided mitk-image must be in the set of types created by taking the
* cartesian product of the pixel type sequence and the dimension sequence.
* For example, a call to
* \code
* AccessFixedTypeByItk(myMitkImage, MyAccessFunction, (short)(int), (2)(3))
* \endcode
* asserts that the type of myMitkImage (pixeltype,dim) is in the set {(short,2),(short,3),(int,2),(int,3)}.
* For more information, see #AccessByItk.
*
* \param pixelTypeSeq A sequence of pixel types, like (short)(char)(int).
* \param dimSeq A sequence of dimensions, like (2)(3).
* \param mitkImage The MITK input image.
* \param itkImageTypeFunction The templated access-function to be called.
*
* \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
*
* If the image has a different dimension or pixel type,
* a mitk::AccessByItkException exception is thrown.
*
* \note If you do not know the dimension for sure, use #AccessByItk.
*
* \sa AccessByItk
* \sa AccessFixedDimensionByItk
* \sa AccessFixedTypeByItk_n
* \sa AccessFixedPixelTypeByItk
*
* \ingroup Adaptor
*/
#define AccessFixedTypeByItk(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq) \
\
{ \
const mitk::PixelType &pixelType = mitkImage->GetPixelType(); \
_checkSpecificDimension(mitkImage, dimSeq); \
_accessFixedTypeByItk(itkImageTypeFunction, mitkImage, pixelTypeSeq, dimSeq) \
_accessByItkPixelTypeException(mitkImage->GetPixelType(), pixelTypeSeq) \
}
//------------------------------ n-Arg Access Macros -----------------------------------
/**
* \brief Access a MITK image by an ITK image with one or more parameters.
*
* Define a templated function or method (\a itkImageTypeFunction) with one ore more
* additional parameters, within which the mitk-image (\a mitkImage) is accessed:
* \code
* template < typename TPixel, unsigned int VImageDimension >
* void ExampleFunction( itk::Image<TPixel, VImageDimension>* itkImage, SomeType param);
* \endcode
*
* The itk::Image passed to the function/method has the same
* data-pointer as the mitk-image. So you have full read- and write-
* access to the data vector of the mitk-image using the itk-image.
* Call by:
* \code
* SomeType param = ...
* mitk::Image* inputMitkImage = ...
* try
* {
* AccessByItk_n(inputMitkImage, ExampleFunction, (param));
* }
* catch (const mitk::AccessByItkException& e)
* {
* // mitk::Image is of wrong pixel type or dimension,
* // insert error handling here
* }
* \endcode
*
* \param va_tuple A variable length tuple containing the arguments to be passed
* to the access function itkImageTypeFunction, e.g. ("first", 2, THIRD).
* \param mitkImage The MITK input image.
* \param itkImageTypeFunction The templated access-function to be called.
*
* \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
*
* \note If your inputMitkImage is an mitk::Image::Pointer, use
* inputMitkImage.GetPointer()
* \note If you know the dimension of your input mitk-image,
* it is better to use AccessFixedDimensionByItk_n (less code
* is generated).
* \sa AccessFixedDimensionByItk_n
* \sa AccessFixedTypeByItk_n
* \sa AccessFixedPixelTypeByItk_n
* \sa AccessByItk
*
* \ingroup Adaptor
*/
#define AccessByItk_n(mitkImage, itkImageTypeFunction, va_tuple) \
AccessFixedTypeByItk_n( \
mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_PIXEL_TYPES_SEQ, MITK_ACCESSBYITK_DIMENSIONS_SEQ, va_tuple)
/**
* \brief Access a mitk-image with known pixeltype (but unknown dimension) by an itk-image
* with one or more parameters.
*
* For usage, see #AccessByItk_n.
*
* \param va_tuple A variable length tuple containing the arguments to be passed
* to the access function itkImageTypeFunction, e.g. ("first", 2, THIRD).
* \param pixelTypeSeq A sequence of pixel types, like (short)(char)(int).
* \param mitkImage The MITK input image.
* \param itkImageTypeFunction The templated access-function to be called.
*
* \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
*
* If the image has a different pixel type, a mitk::AccessByItkException exception is
* thrown. If you do not know the pixel type for sure, use #AccessByItk_n.
*
* \sa AccessByItk_n
* \sa AccessFixedDimensionByItk_n
* \sa AccessFixedTypeByItk_n
* \sa AccessFixedPixelTypeByItk
*
* \ingroup Adaptor
*/
#define AccessFixedPixelTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, va_tuple) \
AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, MITK_ACCESSBYITK_DIMENSIONS_SEQ, va_tuple)
/**
* \brief Access an mitk::Image with an integral pixel type by an ITK image with
* one or more parameters.
*
* See #AccessByItk_n for details.
*
* \param va_tuple A variable length tuple containing the arguments to be passed
* to the access function itkImageTypeFunction, e.g. ("first", 2, THIRD).
* \param mitkImage The MITK input image.
* \param itkImageTypeFunction The templated access-function to be called.
*
* \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
*
* \sa AccessFixedPixelTypeByItk_n
* \sa AccessByItk_n
* \sa AccessIntegralPixelTypeByItk
*/
#define AccessIntegralPixelTypeByItk_n(mitkImage, itkImageTypeFunction, va_tuple) \
AccessFixedTypeByItk_n(mitkImage, \
itkImageTypeFunction, \
MITK_ACCESSBYITK_INTEGRAL_PIXEL_TYPES_SEQ, \
MITK_ACCESSBYITK_DIMENSIONS_SEQ, \
va_tuple)
/**
* \brief Access an mitk::Image with a floating point pixel type by an ITK image
* with one or more parameters.
*
* See #AccessByItk_n for details.
*
* \param va_tuple A variable length tuple containing the arguments to be passed
* to the access function itkImageTypeFunction, e.g. ("first", 2, THIRD).
* \param mitkImage The MITK input image.
* \param itkImageTypeFunction The templated access-function to be called.
*
* \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
*
* \sa AccessFixedPixelTypeByItk_n
* \sa AccessByItk_n
* \sa AccessFloatingPixelTypeByItk
*/
#define AccessFloatingPixelTypeByItk_n(mitkImage, itkImageTypeFunction, va_tuple) \
AccessFixedTypeByItk_n(mitkImage, \
itkImageTypeFunction, \
MITK_ACCESSBYITK_FLOATING_PIXEL_TYPES_SEQ, \
MITK_ACCESSBYITK_DIMENSIONS_SEQ, \
va_tuple)
/**
* \brief Access a vector mitk::Image by an ITK vector image with one or more parameters.
*
* See #AccessByItk_n for details.
*
* \param va_tuple A variable length tuple containing the arguments to be passed
* to the access function itkImageTypeFunction, e.g. ("first", 2, THIRD).
* \param mitkImage The MITK input image.
* \param itkImageTypeFunction The templated access-function to be called.
*
* \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
*
* \sa AccessFixedPixelTypeByItk_n
* \sa AccessByItk_n
*/
#define AccessVectorPixelTypeByItk_n(mitkImage, itkImageTypeFunction, va_tuple) \
AccessFixedTypeByItk_n(mitkImage, \
itkImageTypeFunction, \
MITK_ACCESSBYITK_VECTOR_PIXEL_TYPES_SEQ, \
MITK_ACCESSBYITK_DIMENSIONS_SEQ, \
va_tuple)
/**
* \brief Access a mitk-image with known dimension by an itk-image with
* one or more parameters.
*
* For usage, see #AccessByItk_n.
*
* \param dimension Dimension of the mitk-image. If the image has a different dimension,
* a mitk::AccessByItkException exception is thrown.
* \param va_tuple A variable length tuple containing the arguments to be passed
* to the access function itkImageTypeFunction, e.g. ("first", 2, THIRD).
* \param mitkImage The MITK input image.
* \param itkImageTypeFunction The templated access-function to be called.
*
* \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
*
* \note If you do not know the dimension for sure, use #AccessByItk_n.
*
* \sa AccessByItk_n
* \sa AccessFixedDimensionByItk
* \sa AccessFixedTypeByItk_n
* \sa AccessFixedPixelTypeByItk_n
*
* \ingroup Adaptor
*/
#define AccessFixedDimensionByItk_n(mitkImage, itkImageTypeFunction, dimension, va_tuple) \
AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_PIXEL_TYPES_SEQ, (dimension), va_tuple)
/**
* \brief Access a vector mitk-image with known dimension by a ITK vector image with
* one or more parameters.
*
* For usage, see #AccessByItk_n.
*
* \param dimension Dimension of the mitk-image. If the image has a different dimension,
* a mitk::AccessByItkException exception is thrown.
* \param va_tuple A variable length tuple containing the arguments to be passed
* to the access function itkImageTypeFunction, e.g. ("first", 2, THIRD).
* \param mitkImage The MITK input image.
* \param itkImageTypeFunction The templated access-function to be called.
*
* \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
*
* \note If you do not know the dimension for sure, use #AccessVectorPixelTypeByItk_n.
*
* \sa AccessByItk_n
* \sa AccessVectorPixelTypeByItk_n
* \sa AccessFixedTypeByItk_n
*
* \ingroup Adaptor
*/
#define AccessVectorFixedDimensionByItk_n(mitkImage, itkImageTypeFunction, dimension, va_tuple) \
AccessFixedTypeByItk_n( \
mitkImage, itkImageTypeFunction, MITK_ACCESSBYITK_VECTOR_PIXEL_TYPES_SEQ, (dimension), va_tuple)
/**
* \brief Access a mitk-image with known type (pixel type and dimension) by an itk-image
* with one or more parameters.
*
* For usage, see AccessFixedTypeByItk.
*
* \param pixelTypeSeq A sequence of pixel types, like (short)(char)(int).
* \param dimSeq A sequence of dimensions, like (2)(3).
* \param va_tuple A variable length tuple containing the arguments to be passed
* to the access function itkImageTypeFunction, e.g. ("first", 2, THIRD).
* \param mitkImage The MITK input image.
* \param itkImageTypeFunction The templated access-function to be called.
*
* \throws mitk::AccessByItkException If mitkImage is of unsupported pixel type or dimension.
*
* If the image has a different dimension or pixel type,
* a mitk::AccessByItkException exception is thrown.
*
* \note If you do not know the dimension for sure, use #AccessByItk_n.
*
* \sa AccessByItk_n
* \sa AccessFixedDimensionByItk_n
* \sa AccessFixedTypeByItk
* \sa AccessFixedPixelTypeByItk_n
*
* \ingroup Adaptor
*/
#define AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq, va_tuple) \
\
{ \
const mitk::PixelType &pixelType = mitkImage->GetPixelType(); \
_checkSpecificDimension(mitkImage, dimSeq); \
_accessFixedTypeByItk_n(itkImageTypeFunction, mitkImage, pixelTypeSeq, dimSeq, va_tuple) \
_accessByItkPixelTypeException(mitkImage->GetPixelType(), pixelTypeSeq) \
}
//------------------------- For back-wards compatibility -------------------------------
#define AccessByItk_1(mitkImage, itkImageTypeFunction, arg1) AccessByItk_n(mitkImage, itkImageTypeFunction, (arg1))
#define AccessFixedPixelTypeByItk_1(mitkImage, itkImageTypeFunction, pixelTypeSeq, arg1) \
AccessFixedPixelTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, (arg1))
#define AccessFixedDimensionByItk_1(mitkImage, itkImageTypeFunction, dimension, arg1) \
AccessFixedDimensionByItk_n(mitkImage, itkImageTypeFunction, dimension, (arg1))
#define AccessFixedTypeByItk_1(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq, arg1) \
AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq, (arg1))
#define AccessByItk_2(mitkImage, itkImageTypeFunction, arg1, arg2) \
AccessByItk_n(mitkImage, itkImageTypeFunction, (arg1, arg2))
#define AccessFixedPixelTypeByItk_2(mitkImage, itkImageTypeFunction, pixelTypeSeq, arg1, arg2) \
AccessFixedPixelTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, (arg1, arg2))
#define AccessFixedDimensionByItk_2(mitkImage, itkImageTypeFunction, dimension, arg1, arg2) \
AccessFixedDimensionByItk_n(mitkImage, itkImageTypeFunction, dimension, (arg1, arg2))
#define AccessFixedTypeByItk_2(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq, arg1, arg2) \
AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq, (arg1, arg2))
#define AccessByItk_3(mitkImage, itkImageTypeFunction, arg1, arg2, arg3) \
AccessByItk_n(mitkImage, itkImageTypeFunction, (arg1, arg2, arg3))
#define AccessFixedPixelTypeByItk_3(mitkImage, itkImageTypeFunction, pixelTypeSeq, arg1, arg2, arg3) \
AccessFixedPixelTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, (arg1, arg2, arg3))
#define AccessFixedDimensionByItk_3(mitkImage, itkImageTypeFunction, dimension, arg1, arg2, arg3) \
AccessFixedDimensionByItk_n(mitkImage, itkImageTypeFunction, dimension, (arg1, arg2, arg3))
#define AccessFixedTypeByItk_3(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq, arg1, arg2, arg3) \
AccessFixedTypeByItk_n(mitkImage, itkImageTypeFunction, pixelTypeSeq, dimSeq, (arg1, arg2, arg3))
//----------------------------- Access two MITK Images ---------------------------------
#ifndef DOXYGEN_SKIP
#define _accessTwoImagesByItk(itkImageTypeFunction, pixeltype1, dim1, pixeltype2, dim2) \
if (pixelType1 == mitk::MakePixelType<itk::Image<pixeltype1, dim1>>() && \
pixelType2 == mitk::MakePixelType<itk::Image<pixeltype2, dim2>>() && constImage1->GetDimension() == dim1 && \
constImage2->GetDimension() == dim2) \
{ \
typedef itk::Image<pixeltype1, dim1> ImageType1; \
typedef itk::Image<pixeltype2, dim2> ImageType2; \
typedef mitk::ImageToItk<ImageType1> ImageToItkType1; \
typedef mitk::ImageToItk<ImageType2> ImageToItkType2; \
itk::SmartPointer<ImageToItkType1> imagetoitk1 = ImageToItkType1::New(); \
imagetoitk1->SetInput(nonConstImage1); \
imagetoitk1->Update(); \
itk::SmartPointer<ImageToItkType2> imagetoitk2 = ImageToItkType2::New(); \
imagetoitk2->SetInput(nonConstImage2); \
imagetoitk2->Update(); \
itkImageTypeFunction(imagetoitk1->GetOutput(), imagetoitk2->GetOutput()); \
} \
else
#define _accessTwoImagesByItkArgs2(itkImageTypeFunction, type1, type2) \
(itkImageTypeFunction, BOOST_PP_TUPLE_REM(2) type1, BOOST_PP_TUPLE_REM(2) type2)
#define _accessTwoImagesByItkArgs(product) \
BOOST_PP_EXPAND(_accessTwoImagesByItkArgs2 BOOST_PP_EXPAND( \
(BOOST_PP_SEQ_HEAD(product), BOOST_PP_TUPLE_REM(2) BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(product)))))
// product is of the form (itkImageTypeFunction)((short,2))((char,2))
#ifdef _MSC_VER
#define _accessTwoImagesByItkIter(r, product) \
BOOST_PP_EXPAND(_accessTwoImagesByItk _msvc_expand_bug( \
_accessTwoImagesByItkArgs2, \
(BOOST_PP_SEQ_HEAD(product), \
_msvc_expand_bug(BOOST_PP_TUPLE_REM(2), BOOST_PP_EXPAND(BOOST_PP_SEQ_TO_TUPLE(BOOST_PP_SEQ_TAIL(product)))))))
#else
#define _accessTwoImagesByItkIter(r, product) BOOST_PP_EXPAND(_accessTwoImagesByItk _accessTwoImagesByItkArgs(product))
#endif
#define _accessTwoImagesByItkForEach(itkImageTypeFunction, tseq1, tseq2) \
BOOST_PP_SEQ_FOR_EACH_PRODUCT(_accessTwoImagesByItkIter, ((itkImageTypeFunction))(tseq1)(tseq2))
#endif // DOXYGEN_SKIP
/**
* \brief Access two mitk-images with known dimension by itk-images
*
* Define a templated function or method (\a itkImageTypeFunction)
* within which the mitk-images (\a mitkImage1 and \a mitkImage2) are accessed:
* \code
* template <typename TPixel1, unsigned int VImageDimension1, typename TPixel2, unsigned int VImageDimension2>
* void ExampleFunctionTwoImages(itk::Image<TPixel1, VImageDimension1>* itkImage1, itk::Image<TPixel2,
* VImageDimension2>* itkImage2);
* \endcode
*
* The itk::Image passed to the function/method has the same
* data-pointer as the mitk-image. So you have full read- and write-
* access to the data vector of the mitk-image using the itk-image.
* Call by:
* \code
* mitk::Image* inputMitkImage1 = ...
* mitk::Image* inputMitkImage2 = ...
* try
* {
* AccessTwoImagesFixedDimensionByItk(inputMitkImage1, inputMitkImage2, ExampleFunctionTwoImages, 3);
* }
* catch (const mitk::AccessByItkException& e)
* {
* // mitk::Image arguments are of wrong pixel type or dimension,
* // insert error handling here
* }
* \endcode
*
* \note If your inputMitkImage1 or inputMitkImage2 is a mitk::Image::Pointer, use
* inputMitkImage1.GetPointer().
*
* \param mitkImage1 The first MITK input image.
- * \param mitkImage1 The second MITK input image.
+ * \param mitkImage2 The second MITK input image.
* \param itkImageTypeFunction The name of the template access-function to be called.
* \param dimension Dimension of the two mitk-images.
*
* \throws mitk::AccessByItkException If mitkImage1 and mitkImage2 have different dimensions or
* one of the images is of unsupported pixel type or dimension.
*
* \sa #AccessByItk
*
* \ingroup Adaptor
*/
#define AccessTwoImagesFixedDimensionByItk(mitkImage1, mitkImage2, itkImageTypeFunction, dimension) \
\
{ \
const mitk::PixelType &pixelType1 = mitkImage1->GetPixelType(); \
const mitk::PixelType &pixelType2 = mitkImage2->GetPixelType(); \
const mitk::Image *constImage1 = mitkImage1; \
const mitk::Image *constImage2 = mitkImage2; \
mitk::Image *nonConstImage1 = const_cast<mitk::Image *>(constImage1); \
mitk::Image *nonConstImage2 = const_cast<mitk::Image *>(constImage2); \
nonConstImage1->Update(); \
nonConstImage2->Update(); \
_checkSpecificDimension(mitkImage1, (dimension)); \
_checkSpecificDimension(mitkImage2, (dimension)); \
_accessTwoImagesByItkForEach( \
itkImageTypeFunction, MITK_ACCESSBYITK_TYPES_DIMN_SEQ(dimension), MITK_ACCESSBYITK_TYPES_DIMN_SEQ(dimension)) \
{ \
std::string msg("Pixel type "); \
msg.append(pixelType1.GetComponentTypeAsString()); \
msg.append(" or pixel type "); \
msg.append(pixelType2.GetComponentTypeAsString()); \
msg.append(" is not in " BOOST_PP_STRINGIZE(MITK_ACCESSBYITK_TYPES_DIMN_SEQ(dimension))); \
throw mitk::AccessByItkException(msg); \
} \
}
#endif // of MITKIMAGEACCESSBYITK_H_HEADER_INCLUDED
diff --git a/Modules/Core/include/mitkImagePixelAccessor.h b/Modules/Core/include/mitkImagePixelAccessor.h
index 37565d4cc1..f15c77037f 100644
--- a/Modules/Core/include/mitkImagePixelAccessor.h
+++ b/Modules/Core/include/mitkImagePixelAccessor.h
@@ -1,138 +1,141 @@
/*============================================================================
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 MITKIMAGEPIXELACCESSOR_H
#define MITKIMAGEPIXELACCESSOR_H
#include "mitkImage.h"
#include "mitkImageDataItem.h"
#include <typeinfo>
namespace mitk
{
/**
* @brief Provides templated image access for all inheriting classes
* @tparam TPixel defines the PixelType
* @tparam VDimension defines the dimension for accessing data
* @ingroup Data
*/
template <class TPixel, unsigned int VDimension = 3>
class ImagePixelAccessor
{
public:
typedef itk::Index<VDimension> IndexType;
typedef ImagePixelAccessor<TPixel, VDimension> ImagePixelAccessorType;
typedef Image::ConstPointer ImageConstPointer;
/** Get Dimensions from ImageDataItem */
int GetDimension(int i) const { return m_ImageDataItem->GetDimension(i); }
private:
friend class Image;
protected:
- /** \param ImageDataItem* specifies the allocated image part */
+ /**
+ * \param iP
+ * \param iDI specifies the allocated image part
+ */
ImagePixelAccessor(ImageConstPointer iP, const mitk::ImageDataItem *iDI) : m_ImageDataItem(iDI)
{
if (iDI == nullptr)
{
m_ImageDataItem = iP->GetChannelData();
}
CheckData(iP.GetPointer());
}
/** Destructor */
virtual ~ImagePixelAccessor() {}
void CheckData( const Image *image )
{
// Check if Dimensions are correct
if ( m_ImageDataItem == nullptr )
{
if ( image->GetDimension() != VDimension )
{
mitkThrow() << "Invalid ImageAccessor: The Dimensions of ImageAccessor and Image are not equal."
<< " They have to be equal if an entire image is requested."
<< " image->GetDimension(): " << image->GetDimension() << " , VDimension: " << VDimension;
}
}
else
{
if ( m_ImageDataItem->GetDimension() != VDimension )
{
mitkThrow() << "Invalid ImageAccessor: The Dimensions of ImageAccessor and ImageDataItem are not equal."
<< " m_ImageDataItem->GetDimension(): " << m_ImageDataItem->GetDimension() << " , VDimension: " << VDimension;
}
}
if (!( image->GetPixelType() == mitk::MakePixelType< itk::Image< TPixel, VDimension > >() ||
image->GetPixelType() == mitk::MakePixelType< itk::VectorImage< TPixel, VDimension > >
( image->GetPixelType().GetNumberOfComponents() )
) )
{
mitkThrow() << "Invalid ImageAccessor: PixelTypes of Image and ImageAccessor are not equal."
<< " image->GetPixelType(): " << typeid(image->GetPixelType()).name()
<< "\n m_ImageDataItem->GetDimension(): " << m_ImageDataItem->GetDimension()
<< " , VDimension: " << VDimension
<< " , TPixel: " << typeid(TPixel).name()
<< " , NumberOfComponents: " << image->GetPixelType().GetNumberOfComponents() << std::endl;
}
}
/** Holds the specified ImageDataItem */
const ImageDataItem *m_ImageDataItem;
/** \brief Pointer to the used Geometry.
* Since Geometry can be different to the Image (if memory was forced to be coherent) it is necessary to store
* Geometry separately.
*/
BaseGeometry::Pointer m_Geometry;
/** \brief A Subregion defines an arbitrary area within the image.
* If no SubRegion is defined, the whole ImageDataItem or Image is regarded.
* A subregion (e.g. subvolume) can lead to non-coherent memory access where every dimension has a start- and
* end-offset.
*/
itk::ImageRegion<VDimension> *m_SubRegion;
/** \brief Stores all extended properties of an ImageAccessor.
* The different flags in mitk::ImageAccessorBase::Options can be unified by bitwise operations.
*/
int m_Options;
/** Get memory offset for a given image index */
unsigned int GetOffset(const IndexType &idx) const
{
const unsigned int *imageDims = m_ImageDataItem->m_Dimensions;
unsigned int offset = 0;
switch (VDimension)
{
case 4:
offset += idx[3] * imageDims[0] * imageDims[1] * imageDims[2];
/* FALLTHRU */
case 3:
offset += idx[2] * imageDims[0] * imageDims[1];
/* FALLTHRU */
case 2:
offset += idx[0] + idx[1] * imageDims[0];
/* FALLTHRU */
default:
break;
}
return offset;
}
};
}
#endif // MITKIMAGEACCESSOR_H
diff --git a/Modules/Core/include/mitkImagePixelReadAccessor.h b/Modules/Core/include/mitkImagePixelReadAccessor.h
index 5eb0a5ec6c..a4e4d1ad67 100644
--- a/Modules/Core/include/mitkImagePixelReadAccessor.h
+++ b/Modules/Core/include/mitkImagePixelReadAccessor.h
@@ -1,192 +1,192 @@
/*============================================================================
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 MITKIMAGEPIXELREADACCESSOR_H
#define MITKIMAGEPIXELREADACCESSOR_H
#include "mitkImagePixelAccessor.h"
#include "mitkImageReadAccessor.h"
namespace mitk
{
class Image;
/**
* @brief Gives locked and index-based read access for a particular image part.
* The class provides several set- and get-methods, which allow an easy pixel access.
* It needs to know about pixel type and dimension of its image at compile time.
* @tparam TPixel defines the PixelType
* @tparam VDimension defines the dimension for accessing data
* @ingroup Data
*/
template <class TPixel, unsigned int VDimension = 3>
class ImagePixelReadAccessor : public ImagePixelAccessor<TPixel, VDimension>
{
friend class Image;
public:
typedef ImagePixelAccessor<TPixel, VDimension> ImagePixelAccessorType;
typedef itk::SmartPointer<mitk::Image> ImagePointer;
typedef itk::SmartPointer<const mitk::Image> ImageConstPointer;
/** \brief Instantiates a mitk::ImageReadAccessor (see its doxygen page for more details)
- * \param Image::Pointer specifies the associated Image
- * \param ImageDataItem* specifies the allocated image part
+ * \param iP specifies the associated Image
+ * \param iDI specifies the allocated image part
* \param OptionFlags properties from mitk::ImageAccessorBase::Options can be chosen and assembled with bitwise
* unification.
* \throws mitk::Exception if the Constructor was created inappropriately
* \throws mitk::MemoryIsLockedException if requested image area is exclusively locked and
* mitk::ImageAccessorBase::ExceptionIfLocked is set in OptionFlags
*
* Includes a check if typeid of PixelType coincides with templated TPixel
* and a check if VDimension equals to the Dimension of the Image.
*/
ImagePixelReadAccessor(ImageConstPointer iP,
const ImageDataItem *iDI = nullptr,
int OptionFlags = ImageAccessorBase::DefaultBehavior)
: ImagePixelAccessor<TPixel, VDimension>(iP, iDI), m_ReadAccessor(iP, iDI, OptionFlags)
{
}
ImagePixelReadAccessor(ImagePointer iP,
const ImageDataItem *iDI = nullptr,
int OptionFlags = ImageAccessorBase::DefaultBehavior)
: ImagePixelAccessor<TPixel, VDimension>(iP.GetPointer(), iDI), m_ReadAccessor(iP, iDI, OptionFlags)
{
}
ImagePixelReadAccessor(Image *iP,
const ImageDataItem *iDI = nullptr,
int OptionFlags = ImageAccessorBase::DefaultBehavior)
: ImagePixelAccessor<TPixel, VDimension>(iP, iDI), m_ReadAccessor(mitk::Image::ConstPointer(iP), iDI, OptionFlags)
{
}
ImagePixelReadAccessor(const Image *iP,
const ImageDataItem *iDI = nullptr,
int OptionFlags = ImageAccessorBase::DefaultBehavior)
: ImagePixelAccessor<TPixel, VDimension>(iP, iDI), m_ReadAccessor(iP, iDI, OptionFlags)
{
}
/** Destructor informs Image to unlock memory. */
~ImagePixelReadAccessor() override {}
/** Returns a const reference to the pixel at given index. */
const TPixel &GetPixelByIndex(const itk::Index<VDimension> &idx) const
{
unsigned int offset = ImagePixelAccessorType::GetOffset(idx);
return *(((TPixel *)m_ReadAccessor.m_AddressBegin) + offset);
}
itk::VariableLengthVector<TPixel> GetConsecutivePixelsAsVector(const itk::Index<VDimension> &idx,
int nrComponents) const
{
return itk::VariableLengthVector<TPixel>(
(TPixel *)m_ReadAccessor.m_AddressBegin +
ImagePixelAccessorType::GetOffset(idx) * m_ReadAccessor.GetImage()->GetPixelType().GetNumberOfComponents(),
nrComponents);
}
/** Extends GetPixel by integrating index validation to prevent overflow.
* \throws mitk::Exception in case of overflow
*/
const TPixel &GetPixelByIndexSafe(const itk::Index<VDimension> &idx) const
{
unsigned int offset = ImagePixelAccessorType::GetOffset(idx);
TPixel *targetAddress = ((TPixel *)m_ReadAccessor.m_AddressBegin) + offset;
if (!(targetAddress >= m_ReadAccessor.m_AddressBegin && targetAddress < m_ReadAccessor.m_AddressEnd))
{
mitkThrow() << "ImageAccessor Overflow: image access exceeds the requested image area at " << idx << ".";
}
return *targetAddress;
}
/** Returns a const reference to the pixel at given world coordinate - works only with three-dimensional
* ImageAccessor
*/
const TPixel &GetPixelByWorldCoordinates(mitk::Point3D position)
{
itk::Index<3> itkIndex;
m_ReadAccessor.GetImage()->GetGeometry()->WorldToIndex(position, itkIndex);
return GetPixelByIndex(itkIndex);
}
/** Returns a const reference to the pixel at given world coordinate - works only with four-dimensional
* ImageAccessor
*/
const TPixel &GetPixelByWorldCoordinates(mitk::Point3D position, unsigned int timestep)
{
itk::Index<3> itkIndex;
m_ReadAccessor.GetImage()->GetGeometry()->WorldToIndex(position, itkIndex);
if (m_ReadAccessor.GetImage()->GetTimeSteps() < timestep)
{
timestep = m_ReadAccessor.GetImage()->GetTimeSteps();
}
itk::Index<4> itk4Index;
for (int i = 0; i < 3; ++i)
itk4Index[i] = itkIndex[i];
itk4Index[3] = timestep;
return GetPixelByIndex(itk4Index);
}
/** \brief Gives const access to the data. */
inline const TPixel *GetData() const { return static_cast<const TPixel *>(m_ReadAccessor.m_AddressBegin); }
protected:
// protected members
private:
ImageReadAccessor m_ReadAccessor;
ImagePixelReadAccessor &operator=(const ImagePixelReadAccessor &); // Not implemented on purpose.
ImagePixelReadAccessor(const ImagePixelReadAccessor &);
};
/** Static method that gets direct access to a single pixel value.
* The value is not guaranteed to be in a well-defined state and is automatically casted to mitk::ScalarType
* The method can be called by the macros in mitkPixelTypeMultiplex.h
*/
template <class TPixel>
mitk::ScalarType FastSinglePixelAccess(mitk::PixelType,
mitk::Image::Pointer im,
ImageDataItem *item,
itk::Index<3> idx,
mitk::ScalarType &val,
int component = 0)
{
ImagePixelReadAccessor<TPixel, 3> imAccess(im, item, mitk::ImageAccessorBase::IgnoreLock);
val = imAccess.GetConsecutivePixelsAsVector(idx, component + 1).GetElement(component);
return val;
}
/** Const overload of FastSinglePixelAccess*/
template <class TPixel>
mitk::ScalarType FastSinglePixelAccess(mitk::PixelType,
mitk::Image::ConstPointer im,
const ImageDataItem* item,
itk::Index<3> idx,
mitk::ScalarType& val,
int component = 0)
{
ImagePixelReadAccessor<TPixel, 3> imAccess(im, item, mitk::ImageAccessorBase::IgnoreLock);
val = imAccess.GetConsecutivePixelsAsVector(idx, component + 1).GetElement(component);
return val;
}
}
#endif // MITKIMAGEPIXELREADACCESSOR_H
diff --git a/Modules/Core/include/mitkImagePixelWriteAccessor.h b/Modules/Core/include/mitkImagePixelWriteAccessor.h
index 40b0e50cd2..25b3b20943 100644
--- a/Modules/Core/include/mitkImagePixelWriteAccessor.h
+++ b/Modules/Core/include/mitkImagePixelWriteAccessor.h
@@ -1,138 +1,138 @@
/*============================================================================
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 MITKIMAGEPIXELWRITEACCESSOR_H
#define MITKIMAGEPIXELWRITEACCESSOR_H
#include "mitkImagePixelAccessor.h"
#include "mitkImageWriteAccessor.h"
namespace mitk
{
/**
* @brief Gives locked and index-based write access for a particular image part.
* The class provides several set- and get-methods, which allow an easy pixel access.
* It needs to know about pixel type and dimension of its image at compile time.
* @tparam TPixel defines the PixelType
* @tparam VDimension defines the dimension for accessing data
* @ingroup Data
*/
template <class TPixel, unsigned int VDimension = 3>
class ImagePixelWriteAccessor : public ImagePixelAccessor<TPixel, VDimension>
{
friend class Image;
public:
typedef ImagePixelAccessor<TPixel, VDimension> ImagePixelAccessorType;
typedef itk::SmartPointer<mitk::Image> ImagePointer;
/** \brief Instantiates a mitk::ImageWriteAccessor (see its doxygen page for more details)
- * \param Image::Pointer specifies the associated Image
- * \param ImageDataItem* specifies the allocated image part
+ * \param iP specifies the associated Image
+ * \param iDI specifies the allocated image part
* \param OptionFlags properties from mitk::ImageAccessorBase::Options can be chosen and assembled with bitwise
* unification.
* \throws mitk::Exception if the Constructor was created inappropriately
* \throws mitk::MemoryIsLockedException if requested image area is exclusively locked and
* mitk::ImageAccessorBase::ExceptionIfLocked is set in OptionFlags
*
* Includes a check if typeid of PixelType coincides with templated TPixel
* and a check if VDimension equals to the Dimension of the Image.
*
* \note
* To avoid intermittent Update() calls to a predecessing filter pipeline, a call to Modifed() method after the
* access is finished is left to the developer.
*/
ImagePixelWriteAccessor(ImagePointer iP,
const ImageDataItem *iDI = nullptr,
int OptionFlags = ImageAccessorBase::DefaultBehavior)
: ImagePixelAccessor<TPixel, VDimension>(iP.GetPointer(), iDI), m_WriteAccessor(iP, iDI, OptionFlags)
{
}
/** \brief Gives full data access. */
virtual inline TPixel *GetData() const { return static_cast<TPixel *>(m_WriteAccessor.m_AddressBegin); }
/// Sets a pixel value at given index.
void SetPixelByIndex(const itk::Index<VDimension> &idx, const TPixel &value)
{
unsigned int offset = ImagePixelAccessor<TPixel, VDimension>::GetOffset(idx);
*(((TPixel *)m_WriteAccessor.m_AddressBegin) + offset) = value;
}
/** Extends SetPixel by integrating index validation to prevent overflow. */
void SetPixelByIndexSafe(const itk::Index<VDimension> &idx, const TPixel &value)
{
unsigned int offset = ImagePixelAccessorType::GetOffset(idx);
TPixel *targetAddress = ((TPixel *)m_WriteAccessor.m_AddressBegin) + offset;
if (targetAddress >= m_WriteAccessor.m_AddressBegin && targetAddress < m_WriteAccessor.m_AddressEnd)
{
*targetAddress = value;
}
else
{
// printf("image dimensions = %d, %d, %d\n", imageDims[0], imageDims[1], imageDims[2]);
// printf("m_AddressBegin: %p, m_AddressEnd: %p, offset: %u\n", m_WriteAccessor.m_AddressBegin,
// m_WriteAccessor.m_AddressEnd, offset);
mitkThrow() << "ImageAccessor Overflow: image access exceeds the requested image area at " << idx << ".";
}
}
/** Returns a const reference to the pixel at given index. */
const TPixel &GetPixelByIndex(const itk::Index<VDimension> &idx) const
{
unsigned int offset = ImagePixelAccessorType::GetOffset(idx);
return *(((TPixel *)m_WriteAccessor.m_AddressBegin) + offset);
}
/** Extends GetPixel by integrating index validation to prevent overflow.
* \throws mitk::Exception in case of overflow
*/
const TPixel &GetPixelByIndexSafe(const itk::Index<VDimension> &idx) const
{
unsigned int offset = ImagePixelAccessorType::GetOffset(idx);
TPixel *targetAddress = ((TPixel *)m_WriteAccessor.m_AddressBegin) + offset;
if (!(targetAddress >= m_WriteAccessor.m_AddressBegin && targetAddress < m_WriteAccessor.m_AddressEnd))
{
mitkThrow() << "ImageAccessor Overflow: image access exceeds the requested image area at " << idx << ".";
}
return *targetAddress;
}
/** Returns a const reference to the pixel at given world coordinate - works only with three-dimensional
* ImageAccessor
*/
const TPixel &GetPixelByWorldCoordinates(mitk::Point3D position)
{
itk::Index<3> itkIndex;
m_WriteAccessor.GetImage()->GetGeometry()->WorldToIndex(position, itkIndex);
return GetPixelByIndex(itkIndex);
}
/** Returns a reference to the pixel at given world coordinate */
void SetPixelByWorldCoordinates(const mitk::Point3D &, const TPixel &value, unsigned int timestep = 0);
~ImagePixelWriteAccessor() override {}
private:
ImageWriteAccessor m_WriteAccessor;
ImagePixelWriteAccessor &operator=(const ImagePixelWriteAccessor &); // Not implemented on purpose.
ImagePixelWriteAccessor(const ImagePixelWriteAccessor &);
};
}
#endif // MITKIMAGEWRITEACCESSOR_H
diff --git a/Modules/Core/include/mitkImageReadAccessor.h b/Modules/Core/include/mitkImageReadAccessor.h
index db2409d416..4cd1f30337 100644
--- a/Modules/Core/include/mitkImageReadAccessor.h
+++ b/Modules/Core/include/mitkImageReadAccessor.h
@@ -1,73 +1,73 @@
/*============================================================================
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 MITKIMAGEREADACCESSOR_H
#define MITKIMAGEREADACCESSOR_H
#include "mitkImageAccessorBase.h"
namespace mitk
{
class Image;
class ImageDataItem;
/**
* @brief ImageReadAccessor class to get locked read access for a particular image part
* @ingroup Data
*/
class MITKCORE_EXPORT ImageReadAccessor : public ImageAccessorBase
{
friend class Image;
template <class TPixel, unsigned int VDimension>
friend class ImagePixelReadAccessor;
public:
typedef itk::SmartPointer<Image> ImagePointer;
/** \brief Orders read access for a slice, volume or 4D-Image
- * \param Image::Pointer specifies the associated Image
- * \param ImageDataItem* specifies the allocated image part
+ * \param image specifies the associated Image
+ * \param iDI specifies the allocated image part
* \param OptionFlags properties from mitk::ImageAccessorBase::Options can be chosen and assembled with bitwise
* unification.
* \throws mitk::Exception if the Constructor was created inappropriately
* \throws mitk::MemoryIsLockedException if requested image area is exclusively locked and
* mitk::ImageAccessorBase::ExceptionIfLocked is set in OptionFlags
*/
ImageReadAccessor(ImageConstPointer image,
const ImageDataItem *iDI = nullptr,
int OptionFlags = ImageAccessorBase::DefaultBehavior);
ImageReadAccessor(ImagePointer image,
const ImageDataItem *iDI = nullptr,
int OptionFlags = ImageAccessorBase::DefaultBehavior);
ImageReadAccessor(const Image *image, const ImageDataItem *iDI = nullptr);
/** Destructor informs Image to unlock memory. */
~ImageReadAccessor() override;
protected:
const Image *GetImage() const override;
private:
/** \brief manages a consistent read access and locks the ordered image part */
void OrganizeReadAccess();
ImageReadAccessor &operator=(const ImageReadAccessor &); // Not implemented on purpose.
ImageReadAccessor(const ImageReadAccessor &);
ImageConstPointer m_Image;
};
}
#endif // MITKIMAGEACCESSOR_H
diff --git a/Modules/Core/include/mitkImageToSurfaceFilter.h b/Modules/Core/include/mitkImageToSurfaceFilter.h
index 3a0b8eeab6..01c0d93c22 100644
--- a/Modules/Core/include/mitkImageToSurfaceFilter.h
+++ b/Modules/Core/include/mitkImageToSurfaceFilter.h
@@ -1,249 +1,247 @@
/*============================================================================
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 _MITKIMAGETOSURFACEFILTER_h__
#define _MITKIMAGETOSURFACEFILTER_h__
#include "MitkCoreExports.h"
#include <mitkCommon.h>
#include <mitkSurface.h>
#include <mitkSurfaceSource.h>
#include <vtkPolyData.h>
#include <mitkImage.h>
#include <vtkImageData.h>
#include <vtkMarchingCubes.h>
#include <vtkSmoothPolyDataFilter.h>
namespace mitk
{
/**
* @brief Converts pixel data to surface data by using a threshold
* The mitkImageToSurfaceFilter is used to create a new surface out of an mitk image. The filter
* uses a threshold to define the surface. It is based on the vtkMarchingCube algorithm. By default
* a vtkPolyData surface based on an input threshold for the input image will be created. Optional
* it is possible to reduce the number of triangles/polygones [SetDecimate(mitk::ImageToSurfaceFilter::DecimatePro) and
* SetTargetReduction (float _arg)]
* or smooth the surface-data [SetSmooth(true), SetSmoothIteration(int smoothIteration) and SetSmoothRelaxation(float
* smoothRelaxation)].
*
* The resulting vtk-surface has the same size as the input image. The surface
* can be generally smoothed by vtkDecimatePro reduce complexity of triangles
* and vtkSmoothPolyDataFilter to relax the mesh. Both are enabled by default
* and connected in the common way of pipelining in ITK. It's also possible
* to create time sliced surfaces.
*
* @ingroup ImageFilters
* @ingroup Process
*/
class MITKCORE_EXPORT ImageToSurfaceFilter : public SurfaceSource
{
public:
/*
* To decide whether a reduction of polygons in the created surface shall be
* done or not by using the vtkDecimatePro Filter. Till vtk 4.x an vtkDecimateFilter existed,
* but was patented. So since vtk 5.x it was replaced by the (worser?) vtkDecimateProFilter
* Maybe another Filter will come soon.
*/
enum DecimationType
{
NoDecimation,
DecimatePro,
QuadricDecimation
};
mitkClassMacro(ImageToSurfaceFilter, SurfaceSource);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**
* For each image time slice a surface will be created. This method is
* called by Update().
*/
void GenerateData() override;
/**
* Initializes the output information ( i.e. the geometry information ) of
* the output of the filter
*/
void GenerateOutputInformation() override;
/**
* Returns a const reference to the input image (e.g. the original input image that ist used to create the surface)
*/
const mitk::Image *GetInput(void);
/**
* Set the source image to create a surface for this filter class. As input every mitk
* 3D or 3D+t image can be used.
*/
using itk::ProcessObject::SetInput;
virtual void SetInput(const mitk::Image *image);
/**
* Set the number of iterations that is used to smooth the surface. Used is the vtkSmoothPolydataFilter that uses
* the
* laplacian filter. The higher the number of iterations that stronger the smooth-result
*
* @param smoothIteration As smoothIteration default in that case 50 was choosen. The VTK documentation recommends
* small relaxation factors and large numbers of iterations.
*/
void SetSmoothIteration(int smoothIteration);
/**
* Set number of relaxation. Specify the relaxation factor for Laplacian
* smoothing. The VTK documentation recommends small relaxation factors
* and large numbers of iterations.
*
* @param smoothRelaxation As smoothRelaxation default in that case 0.1 was choosen. The VTK documentation
* recommends
* small relaxation factors and large numbers of iterations.
*/
void SetSmoothRelaxation(float smoothRelaxation);
/**
* Threshold that is used to create the surface. All pixel in the input image that are higher than that
* value will be considered in the surface. The threshold referees to
* vtkMarchingCube. Default value is 1. See also SetThreshold (ScalarType _arg)
*/
itkSetMacro(Threshold, ScalarType);
/**
* Get Threshold from vtkMarchingCube. Threshold can be manipulated by
* inherited classes.
*/
itkGetConstMacro(Threshold, ScalarType);
/**
* Enables vtkSmoothPolyDataFilter. With Laplacian smoothing this filter
* will relax the surface. You can control the Filter by manipulating the
* number of iterations and the relaxing factor.
* */
itkSetMacro(Smooth, bool);
/*
* Enable/Disable surface smoothing.
*/
itkBooleanMacro(Smooth);
/*
* Returns if surface smoothing is enabled
*/
itkGetConstMacro(Smooth, bool);
/**
* Get the state of decimation mode to reduce triangle in the
* surface represantation. Modes can only be NoDecimation or DecimatePro
* (till vtk 4.x also Decimate)
* */
itkGetConstMacro(Decimate, DecimationType);
/**
* Enable the decimation filter to reduce the number of triangles in the
* mesh and produce a good approximation to the original image. The filter
* has support for vtk-5 and earlier versions. More detailed information
* check the vtkDecimatePro and vtkDecimate.
* */
itkSetMacro(Decimate, DecimationType);
/**
* Set desired TargetReduction of triangles in the range from 0.0 to 1.0.
* The destroyed triangles are in relation with the size of data. For example 0.9
* will reduce the data set to 10%.
- *
- * @param Set a TargetReduction float-value from 0.0 to 1.0
- * */
+ */
itkSetMacro(TargetReduction, float);
/**
* Returns the reduction factor for the VtkDecimatePro Decimation Filter as a float value
*/
itkGetConstMacro(TargetReduction, float);
/**
* Transforms a point by a 4x4 matrix
*/
template <class T1, class T2, class T3>
inline void mitkVtkLinearTransformPoint(T1 matrix[4][4], T2 in[3], T3 out[3])
{
T3 x = matrix[0][0] * in[0] + matrix[0][1] * in[1] + matrix[0][2] * in[2] + matrix[0][3];
T3 y = matrix[1][0] * in[0] + matrix[1][1] * in[1] + matrix[1][2] * in[2] + matrix[1][3];
T3 z = matrix[2][0] * in[0] + matrix[2][1] * in[1] + matrix[2][2] * in[2] + matrix[2][3];
out[0] = x;
out[1] = y;
out[2] = z;
}
protected:
ImageToSurfaceFilter();
/**
* Destructor
* */
~ImageToSurfaceFilter() override;
/**
* With the given threshold vtkMarchingCube creates the surface. By default nothing a
* vtkPolyData surface based on a threshold of the input image will be created. Optional
* it is possible to reduce the number of triangles/polygones [SetDecimate(mitk::ImageToSurfaceFilter::DecimatePro)
* and
* SetTargetReduction (float _arg)]
* or smooth the data [SetSmooth(true), SetSmoothIteration(int smoothIteration) and SetSmoothRelaxation(float
* smoothRelaxation)].
*
* @param time selected slice or "0" for single
* @param *vtkimage input image
* @param *surface output
* @param threshold can be different from SetThreshold()
*/
void CreateSurface(int time, vtkImageData *vtkimage, mitk::Surface *surface, const ScalarType threshold);
/**
* Flag whether the created surface shall be smoothed or not (default is "false"). SetSmooth (bool _arg)
* */
bool m_Smooth;
/**
* Decimation mode, default mode is "NoDecimation". See also SetDecimate (DecimationType _arg)
* */
DecimationType m_Decimate;
/**
* Threshold that is used to create the surface. All pixel in the input image that are higher than that
* value will be considered in the surface. Default value is 1. See also SetThreshold (ScalarType _arg)
* */
ScalarType m_Threshold;
/**
* The Reduction factor of the Decimation Filter for the created surface. See also SetTargetReduction (float _arg)
* */
float m_TargetReduction;
/**
* The Iteration value for the Smooth Filter of the created surface. See also SetSmoothIteration (int
* smoothIteration)
* */
int m_SmoothIteration;
/**
* The Relaxation value for the Smooth Filter of the created surface. See also SetSmoothRelaxation (float
* smoothRelaxation)
* */
float m_SmoothRelaxation;
};
} // namespace mitk
#endif //_MITKIMAGETOSURFACEFILTER_h__
diff --git a/Modules/Core/include/mitkImageVtkMapper2D.h b/Modules/Core/include/mitkImageVtkMapper2D.h
index 537b81c12a..2128a21b7c 100644
--- a/Modules/Core/include/mitkImageVtkMapper2D.h
+++ b/Modules/Core/include/mitkImageVtkMapper2D.h
@@ -1,323 +1,321 @@
/*============================================================================
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 MITKIMAGEVTKMAPPER2D_H_HEADER_INCLUDED_C10E906E
#define MITKIMAGEVTKMAPPER2D_H_HEADER_INCLUDED_C10E906E
// MITK
#include <mitkCommon.h>
// MITK Rendering
#include "mitkBaseRenderer.h"
#include "mitkExtractSliceFilter.h"
#include "mitkVtkMapper.h"
// VTK
#include <vtkPropAssembly.h>
#include <vtkSmartPointer.h>
class vtkActor;
class vtkPolyDataMapper;
class vtkPlaneSource;
class vtkImageData;
class vtkLookupTable;
class vtkImageExtractComponents;
class vtkImageReslice;
class vtkImageChangeInformation;
class vtkPoints;
class vtkMitkThickSlicesFilter;
class vtkPolyData;
class vtkMitkApplyLevelWindowToRGBFilter;
class vtkMitkLevelWindowFilter;
namespace mitk
{
/** \brief Mapper to resample and display 2D slices of a 3D image.
*
* The following image gives a brief overview of the mapping and the involved parts.
*
* \image html imageVtkMapper2Darchitecture.png
*
* First, the image is resliced by means of vtkImageReslice. The volume image
* serves as input to the mapper in addition to spatial placement of the slice and a few other
* properties such as thick slices. This code was already present in the old version
* (mitkImageMapperGL2D).
*
* Next, the obtained slice (m_ReslicedImage) is put into a vtkMitkLevelWindowFilter
* and the scalar levelwindow, opacity levelwindow and optional clipping to
* local image bounds are applied
*
* Next, the output of the vtkMitkLevelWindowFilter is used to create a texture
* (m_Texture) and a plane onto which the texture is rendered (m_Plane). For
* mapping purposes, a vtkPolyDataMapper (m_Mapper) is utilized. Orthographic
* projection is applied to create the effect of a 2D image. The mapper and the
* texture are assigned to the actor (m_Actor) which is passed to the VTK rendering
* pipeline via the method GetVtkProp().
*
* In order to transform the textured plane to the correct position in space, the
* same transformation as used for reslicing is applied to both the camera and the
* vtkActor. All important steps are explained in more detail below. The resulting
* 2D image (by reslicing the underlying 3D input image appropriately) can either
* be directly rendered in a 2D view or just be calculated to be used later by another
* rendering entity, e.g. in texture mapping in a 3D view.
*
* Properties that can be set for images and influence the imageMapper2D are:
*
* - \b "opacity": (FloatProperty) Opacity of the image
* - \b "color": (ColorProperty) Color of the image
* - \b "LookupTable": (mitkLookupTableProperty) If this property is set,
* the default lookuptable will be ignored and the "LookupTable" value
* will be used instead.
* - \b "Image Rendering.Mode": This property decides which mode is used to render images. (E.g. if a lookup table
or
a transferfunction is applied). Detailed documentation about the modes can be found here: \link
mitk::RenderingModeProperty \endlink
* - \b "Image Rendering.Transfer Function": (mitkTransferFunctionProperty) If this
* property is set, a color transferfunction will be used to color the image.
* - \b "binary": (BoolProperty) is the image a binary image or not
* - \b "outline binary": (BoolProperty) show outline of the image or not
* - \b "texture interpolation": (BoolProperty) texture interpolation of the image
* - \b "reslice interpolation": (VtkResliceInterpolationProperty) reslice interpolation of the image
* - \b "in plane resample extent by geometry": (BoolProperty) Do it or not
* - \b "bounding box": (BoolProperty) Is the Bounding Box of the image shown or not
* - \b "layer": (IntProperty) Layer of the image
* - \b "volume annotation color": (ColorProperty) color of the volume annotation, TODO has to be reimplemented
* - \b "volume annotation unit": (StringProperty) annotation unit as string (does not implicit convert the unit!)
unit is ml or cm3, TODO has to be reimplemented
* The default properties are:
* - \b "opacity", mitk::FloatProperty::New(0.3f), renderer, overwrite )
* - \b "color", ColorProperty::New(1.0,0.0,0.0), renderer, overwrite )
* - \b "binary", mitk::BoolProperty::New( true ), renderer, overwrite )
* - \b "outline binary", mitk::BoolProperty::New( false ), renderer, overwrite )
* - \b "texture interpolation", mitk::BoolProperty::New( false ) )
* - \b "reslice interpolation", mitk::VtkResliceInterpolationProperty::New() )
* - \b "in plane resample extent by geometry", mitk::BoolProperty::New( false ) )
* - \b "bounding box", mitk::BoolProperty::New( false ) )
* - \b "layer", mitk::IntProperty::New(10), renderer, overwrite)
* - \b "Image Rendering.Transfer Function": Default color transfer function for CTs
* - \b "LookupTable": Rainbow color.
* If the modality-property is set for an image, the mapper uses modality-specific default properties,
* e.g. color maps, if they are defined.
* \ingroup Mapper
*/
class MITKCORE_EXPORT ImageVtkMapper2D : public VtkMapper
{
public:
/** Standard class typedefs. */
mitkClassMacro(ImageVtkMapper2D, VtkMapper);
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/** \brief Get the Image to map */
const mitk::Image *GetInput(void);
/** \brief Checks whether this mapper needs to update itself and generate
* data. */
void Update(mitk::BaseRenderer *renderer) override;
//### methods of MITK-VTK rendering pipeline
vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
//### end of methods of MITK-VTK rendering pipeline
/** \brief Internal class holding the mapper, actor, etc. for each of the 3 2D render windows */
/**
* To render transveral, coronal, and sagittal, the mapper is called three times.
* For performance reasons, the corresponding data for each view is saved in the
* internal helper class LocalStorage. This allows rendering n views with just
* 1 mitkMapper using n vtkMapper.
* */
class MITKCORE_EXPORT LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
/** \brief Actor of the image in a 2D render window. */
vtkSmartPointer<vtkActor> m_ImageActor;
/** \brief Actor of the shadowimage in a 2D render window. */
vtkSmartPointer<vtkActor> m_ShadowOutlineActor;
/** Prop assembly containting everything for a regular display of the image.*/
vtkSmartPointer<vtkPropAssembly> m_Actors;
/** Prop assembly used if workspace is in an invalid state (e.g. invalid time point or
* invalid world coordinate position is selected) and mapper has to "early out"
* in Update() or GenerateDataForRenderer()*/
vtkSmartPointer<vtkPropAssembly> m_EmptyActors;
/** Prop assembly exposed publicly via ImagVtkMapper2D::GetVTKProp()*/
vtkProp* m_PublicActors = nullptr;
/** \brief Mapper of a 2D render window. */
vtkSmartPointer<vtkPolyDataMapper> m_Mapper;
vtkSmartPointer<vtkImageExtractComponents> m_VectorComponentExtractor;
/** \brief Current slice of a 2D render window.*/
vtkSmartPointer<vtkImageData> m_ReslicedImage;
/** \brief Empty vtkPolyData that is set when rendering geometry does not
* intersect the image geometry.
* \warning This member variable is set to nullptr,
* if no image geometry is inside the plane geometry
* of the respective render window. Any user of this
* slice has to check whether it is set to nullptr!
*/
vtkSmartPointer<vtkPolyData> m_EmptyPolyData;
/** \brief Plane on which the slice is rendered as texture. */
vtkSmartPointer<vtkPlaneSource> m_Plane;
/** \brief The texture which is used to render the current slice. */
vtkSmartPointer<vtkTexture> m_Texture;
/** \brief The lookuptables for colors and level window */
vtkSmartPointer<vtkLookupTable> m_DefaultLookupTable;
vtkSmartPointer<vtkLookupTable> m_BinaryLookupTable;
vtkSmartPointer<vtkLookupTable> m_ColorLookupTable;
/** \brief The actual reslicer (one per renderer) */
mitk::ExtractSliceFilter::Pointer m_Reslicer;
/** \brief Filter for thick slices */
vtkSmartPointer<vtkMitkThickSlicesFilter> m_TSFilter;
/** \brief PolyData object containg all lines/points needed for outlining the contour.
This container is used to save a computed contour for the next rendering execution.
For instance, if you zoom or pann, there is no need to recompute the contour. */
vtkSmartPointer<vtkPolyData> m_OutlinePolyData;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief mmPerPixel relation between pixel and mm. (World spacing).*/
mitk::ScalarType *m_mmPerPixel;
/** \brief This filter is used to apply the level window to Grayvalue and RBG(A) images. */
vtkSmartPointer<vtkMitkLevelWindowFilter> m_LevelWindowFilter;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage() override;
};
/** \brief Get the LocalStorage corresponding to the current renderer. */
const LocalStorage *GetConstLocalStorage(mitk::BaseRenderer *renderer);
/** \brief Set the default properties for general image rendering. */
static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer = nullptr, bool overwrite = false);
/** \brief This method switches between different rendering modes (e.g. use a lookup table or a transfer function).
* Detailed documentation about the modes can be found here: \link mitk::RenderingModeProperty \endlink
*/
void ApplyRenderingMode(mitk::BaseRenderer *renderer);
protected:
/** \brief The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<LocalStorage> m_LSH;
/** \brief Get the LocalStorage corresponding to the current renderer. */
LocalStorage* GetLocalStorage(mitk::BaseRenderer* renderer);
/** \brief Transforms the actor to the actual position in 3D.
* \param renderer The current renderer corresponding to the render window.
*/
void TransformActor(mitk::BaseRenderer *renderer);
/** \brief Generates a plane according to the size of the resliced image in milimeters.
- *
- * \image html texturedPlane.png
*
* In VTK a vtkPlaneSource is defined through three points. The origin and two
* points defining the axes of the plane (see VTK documentation). The origin is
* set to (xMin; yMin; Z), where xMin and yMin are the minimal bounds of the
* resliced image in space. Z is relevant for blending and the layer property.
* The center of the plane (C) is also the center of the view plane (cf. the image above).
*
* \note For the standard MITK view with three 2D render windows showing three
* different slices, three such planes are generated. All these planes are generated
* in the XY-plane (even if they depict a YZ-slice of the volume).
*
*/
void GeneratePlane(mitk::BaseRenderer *renderer, double planeBounds[6]);
/** \brief Generates a vtkPolyData object containing the outline of a given binary slice.
\param renderer: Pointer to the renderer containing the needed information
\note This code is based on code from the iil library.
*/
template <typename TPixel>
vtkSmartPointer<vtkPolyData> CreateOutlinePolyData(mitk::BaseRenderer *renderer);
/** Default constructor */
ImageVtkMapper2D();
/** Default deconstructor */
~ImageVtkMapper2D() override;
/** \brief Does the actual resampling, without rendering the image yet.
* All the data is generated inside this method. The vtkProp (or Actor)
* is filled with content (i.e. the resliced image).
*
* After generation, a 4x4 transformation matrix(t) of the current slice is obtained
* from the vtkResliceImage object via GetReslicesAxis(). This matrix is
* applied to each textured plane (actor->SetUserTransform(t)) to transform everything
* to the actual 3D position (cf. the following image).
*
* \image html cameraPositioning3D.png
*
*/
void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
/** \brief This method uses the vtkCamera clipping range and the layer property
* to calcualte the depth of the object (e.g. image or contour). The depth is used
* to keep the correct order for the final VTK rendering.*/
float CalculateLayerDepth(mitk::BaseRenderer *renderer);
/** \brief This method applies (or modifies) the lookuptable for all types of images.
* \warning To use the lookup table, the property 'Lookup Table' must be set and a 'Image Rendering.Mode'
* which uses the lookup table must be set.
*/
void ApplyLookuptable(mitk::BaseRenderer *renderer);
/** \brief This method applies a color transfer function.
* Internally, a vtkColorTransferFunction is used. This is usefull for coloring continous
* images (e.g. float)
* \warning To use the color transfer function, the property 'Image Rendering.Transfer Function' must be set and a
* 'Image Rendering.Mode' which uses the color transfer function must be set.
*/
void ApplyColorTransferFunction(mitk::BaseRenderer *renderer);
/**
* @brief ApplyLevelWindow Apply the level window for the given renderer.
* \warning To use the level window, the property 'LevelWindow' must be set and a 'Image Rendering.Mode' which uses
* the level window must be set.
* @param renderer Level window for which renderer?
*/
void ApplyLevelWindow(mitk::BaseRenderer *renderer);
/** \brief Set the color of the image/polydata */
void ApplyColor(mitk::BaseRenderer *renderer);
/** \brief Set the opacity of the actor. */
void ApplyOpacity(mitk::BaseRenderer *renderer);
/**
* \brief Calculates whether the given rendering geometry intersects the
* given SlicedGeometry3D.
*
* This method checks if the given PlaneGeometry intersects the given
* SlicedGeometry3D. It calculates the distance of the PlaneGeometry to all
* 8 cornerpoints of the SlicedGeometry3D. If all distances have the same
* sign (all positive or all negative) there is no intersection.
* If the distances have different sign, there is an intersection.
**/
bool RenderingGeometryIntersectsImage(const PlaneGeometry *renderingGeometry, SlicedGeometry3D *imageGeometry);
/** Helper function to reset the local storage in order to indicate an invalid state.*/
void SetToInvalidState(mitk::ImageVtkMapper2D::LocalStorage* localStorage);
};
} // namespace mitk
#endif /* MITKIMAGEVTKMAPPER2D_H_HEADER_INCLUDED_C10E906E */
diff --git a/Modules/Core/include/mitkImageVtkReadAccessor.h b/Modules/Core/include/mitkImageVtkReadAccessor.h
index be0bd201a6..bf3207c890 100644
--- a/Modules/Core/include/mitkImageVtkReadAccessor.h
+++ b/Modules/Core/include/mitkImageVtkReadAccessor.h
@@ -1,53 +1,55 @@
/*============================================================================
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 MITKIMAGEVTKREADACCESSOR_H
#define MITKIMAGEVTKREADACCESSOR_H
#include "mitkImageAccessorBase.h"
class vtkImageData;
namespace mitk
{
class Image;
class ImageDataItem;
/**
* @brief ImageVtkReadAccessor class provides any image read access which is required by Vtk methods
* @ingroup Data
*/
class MITKCORE_EXPORT ImageVtkReadAccessor : public ImageAccessorBase
{
public:
/** \brief Creates an ImageVtkWriteAccessor for a whole Image
- * \param Image::Pointer specifies the associated Image
+ * \param iP specifies the associated Image
+ * \param iDI
+ * \param imageDataVtk
*/
ImageVtkReadAccessor(ImageConstPointer iP, const ImageDataItem *iDI, const vtkImageData *imageDataVtk);
~ImageVtkReadAccessor() override;
const vtkImageData *GetVtkImageData() const;
// vtkTypeMacro(ImageVtkWriteAccessor,vtkDataSet)
protected:
const Image *GetImage() const override;
private:
// due to smart pointer issues, the image is only kept as a weak pointer.
const Image *m_Image;
const vtkImageData *m_ImageDataVtk;
};
}
#endif // MITKIMAGEVTKREADACCESSOR_H
diff --git a/Modules/Core/include/mitkImageVtkWriteAccessor.h b/Modules/Core/include/mitkImageVtkWriteAccessor.h
index 80493b7231..c71cfb220f 100644
--- a/Modules/Core/include/mitkImageVtkWriteAccessor.h
+++ b/Modules/Core/include/mitkImageVtkWriteAccessor.h
@@ -1,53 +1,55 @@
/*============================================================================
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 MITKIMAGEVTKWRITEACCESSOR_H
#define MITKIMAGEVTKWRITEACCESSOR_H
#include "mitkImageAccessorBase.h"
class vtkImageData;
namespace mitk
{
class Image;
class ImageDataItem;
/**
* @brief ImageVtkWriteAccessor class provides any image write access which is required by Vtk methods
* @ingroup Data
*/
class MITKCORE_EXPORT ImageVtkWriteAccessor : public ImageAccessorBase
{
public:
typedef itk::SmartPointer<Image> ImagePointer;
/** \brief Creates an ImageVtkWriteAccessor for a whole Image
- * \param Image::Pointer specifies the associated Image
+ * \param iP specifies the associated Image
+ * \param iDI
+ * \param imageDataVtk
*/
ImageVtkWriteAccessor(ImagePointer iP, const ImageDataItem *iDI, vtkImageData *imageDataVtk);
~ImageVtkWriteAccessor() override;
vtkImageData *GetVtkImageData() const;
protected:
const Image *GetImage() const override;
private:
// due to smart pointer issues, the image is only kept as a weak pointer.
Image *m_Image;
vtkImageData *m_ImageDataVtk;
};
}
#endif // MITKIMAGEVTKWRITEACCESSOR_H
diff --git a/Modules/Core/include/mitkImageWriteAccessor.h b/Modules/Core/include/mitkImageWriteAccessor.h
index b48e3f9d52..14eb2d0a2b 100644
--- a/Modules/Core/include/mitkImageWriteAccessor.h
+++ b/Modules/Core/include/mitkImageWriteAccessor.h
@@ -1,64 +1,64 @@
/*============================================================================
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 MITKIMAGEWRITEACCESSOR_H
#define MITKIMAGEWRITEACCESSOR_H
#include "mitkImage.h"
#include "mitkImageAccessorBase.h"
namespace mitk
{
/**
* @brief ImageWriteAccessor class to get locked write-access for a particular image part.
* @ingroup Data
*/
class MITKCORE_EXPORT ImageWriteAccessor : public ImageAccessorBase
{
template <class TPixel, unsigned int VDimension>
friend class ImagePixelReadAccessor;
public:
typedef Image::Pointer ImagePointer;
/** \brief Orders write access for a slice, volume or 4D-Image
- * \param Image::Pointer specifies the associated Image
- * \param ImageDataItem* specifies the allocated image part
+ * \param image specifies the associated Image
+ * \param iDI specifies the allocated image part
* \param OptionFlags properties from mitk::ImageAccessorBase::Options can be chosen and assembled with bitwise
* unification.
* \throws mitk::Exception if the Constructor was created inappropriately
* \throws mitk::MemoryIsLockedException if requested image area is exclusively locked and
* mitk::ImageAccessorBase::ExceptionIfLocked is set in OptionFlags
*/
ImageWriteAccessor(ImagePointer image,
const ImageDataItem *iDI = nullptr,
int OptionFlags = ImageAccessorBase::DefaultBehavior);
/** \brief Gives full data access. */
inline void *GetData() { return m_AddressBegin; }
/** \brief informs Image to unlock the represented image part */
~ImageWriteAccessor() override;
protected:
const Image *GetImage() const override;
private:
/** \brief manages a consistent write access and locks the ordered image part */
void OrganizeWriteAccess();
ImageWriteAccessor &operator=(const ImageWriteAccessor &); // Not implemented on purpose.
ImageWriteAccessor(const ImageWriteAccessor &);
ImagePointer m_Image;
};
}
#endif // MITKIMAGEWRITEACCESSOR_H
diff --git a/Modules/Core/include/mitkInteractionKeyEvent.h b/Modules/Core/include/mitkInteractionKeyEvent.h
index 9625743a51..edf8437fbb 100644
--- a/Modules/Core/include/mitkInteractionKeyEvent.h
+++ b/Modules/Core/include/mitkInteractionKeyEvent.h
@@ -1,62 +1,59 @@
/*============================================================================
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 MITKINTERACTIONKEYEVENT_H_
#define MITKINTERACTIONKEYEVENT_H_
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "mitkBaseRenderer.h"
#include "mitkCommon.h"
#include "mitkInteractionEvent.h"
#include "mitkInteractionEventConst.h"
#include "mitkInteractionPositionEvent.h"
#include <cstring>
#include <MitkCoreExports.h>
/*
* Note: A Click with the MiddleButton is to be handled with MousePressEvents
*/
namespace mitk
{
- /**
- * \class InteractionKeyEvent
- * \brief Handles key events.
- * Takes a std::string for pressed key or special key description, mitk::ModifierKeys for modifiers
- * \ingroup Interaction.
- */
-
+ /** \brief Handles key events
+ * Takes a std::string for pressed key or special key description, mitk::ModifierKeys for modifiers
+ * \ingroup Interaction
+ */
class MITKCORE_EXPORT InteractionKeyEvent : public InteractionEvent
{
public:
mitkClassMacro(InteractionKeyEvent, InteractionEvent)
mitkNewMacro3Param(Self, BaseRenderer*, const std::string&, ModifierKeys);
bool IsSuperClassOf(const InteractionEvent::Pointer &baseClass) const override;
ModifierKeys GetModifiers() const;
std::string GetKey() const;
protected:
InteractionKeyEvent(BaseRenderer *, const std::string &key, ModifierKeys modifiers);
~InteractionKeyEvent() override;
bool IsEqual(const InteractionEvent &) const override;
private:
std::string m_Key;
ModifierKeys m_Modifiers;
};
} /* namespace mitk */
#endif /* MITKINTERACTIONKEYEVENT_H_ */
diff --git a/Modules/Core/include/mitkLevelWindow.h b/Modules/Core/include/mitkLevelWindow.h
index 9907b6af08..538fe6e56c 100644
--- a/Modules/Core/include/mitkLevelWindow.h
+++ b/Modules/Core/include/mitkLevelWindow.h
@@ -1,263 +1,263 @@
/*============================================================================
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 LEVELWINDOW_H_HEADER_INCLUDED_C1F4F02C
#define LEVELWINDOW_H_HEADER_INCLUDED_C1F4F02C
#include "mitkNumericTypes.h"
#include <MitkCoreExports.h>
namespace mitk
{
class Image;
/**
* @brief The LevelWindow class Class to store level/window values.
*
* Current min and max value are stored in m_LowerWindowBound and m_UpperWindowBound.
* m_DefaultLevel amd m_DefaultWindow store the initial Level/Window values for the image.
* m_DefaultRangeMin and m_DefaultRangeMax store the initial minrange and maxrange for the image.
*
* The finite maximum and minimum of valid value range is stored in m_RangeMin and m_RangeMax.
* If deduced from an image by default the minimum or maximum of it statistics is used. If one
* of these values are infinite the 2nd extrimum (which is guaranteed to be finite), will be used.
*
* See documentation of SetAuto for information on how the level window is initialized from an image.
*
* @ingroup DataManagement
*
* @note If you want to apply the mitk::LevelWindow to an mitk::Image, make sure
* to use the mitk::LevelWindowProperty and set the mitk::RenderingModeProperty
* to a mode which supports level window (e.g. LEVELWINDOW_COLOR).
* Make sure to check the documentation of the mitk::RenderingModeProperty. For a
* code example how to use the mitk::LevelWindowProperty check the
- * mitkImageVtkMapper2DLevelWindowTest.cpp in Core\Code\Testing.
+ * mitkImageVtkMapper2DLevelWindowTest.cpp in Core/Code/Testing.
*/
class MITKCORE_EXPORT LevelWindow
{
public:
LevelWindow(ScalarType level = 127.5, ScalarType window = 255.0);
LevelWindow(const mitk::LevelWindow &levWin);
virtual ~LevelWindow();
/*!
* \brief method that returns the level value, i.e. the center of
* the current grey value interval
*/
ScalarType GetLevel() const;
/*!
* \brief returns the current window size, i.e the range size of the current grey value interval
*/
ScalarType GetWindow() const;
/*!
* \brief method returns the default level value for the image
*/
ScalarType GetDefaultLevel() const;
/*!
* \brief returns the default window size for the image
*/
ScalarType GetDefaultWindow() const;
/*!
* \brief Resets the level and the window value to the default values
*/
void ResetDefaultLevelWindow();
/*!
* Returns the minimum Value of the window
*/
ScalarType GetLowerWindowBound() const;
/*!
* Returns the upper window bound value of the window
*/
ScalarType GetUpperWindowBound() const;
/*!
* To set the level and the window value
*/
void SetLevelWindow(ScalarType level, ScalarType window, bool expandRangesIfNecessary = true);
/*!
* Set the lower and upper bound of the window
*/
void SetWindowBounds(ScalarType lowerBound, ScalarType upperBound, bool expandRangesIfNecessary = true);
/*!
* sets the window to its maximum Size in scaleRange
*/
void SetToMaxWindowSize();
/*!
* Set the range minimum and maximum value
*/
void SetRangeMinMax(ScalarType min, ScalarType max);
/*!
* Get the range minimum value
*/
ScalarType GetRangeMin() const;
/*!
* Get the range maximum value
*/
ScalarType GetRangeMax() const;
/*!
* Get the default range minimum value
*/
ScalarType GetDefaultLowerBound() const;
/*!
* Get the default range maximum value
*/
ScalarType GetDefaultUpperBound() const;
/*!
* \brief the default min and max range for image will be reset
*/
void ResetDefaultRangeMinMax();
/**!
* \brief returns the size of the grey value range
*/
ScalarType GetRange() const;
/*!
* set the default level and window value
*/
void SetDefaultLevelWindow(ScalarType level, ScalarType window);
/*!
* set the default Bounderies
*/
void SetDefaultBoundaries(ScalarType low, ScalarType up);
/**!
* \brief sets level/window to optimize the contrast of the given Image
*/
void SetAuto(const Image *image,
bool tryPicTags = true,
bool guessByCentralSlice = true,
unsigned selectedComponent = 0);
/**!
* \brief sets level/window to the min/max greyvalues of the given Image
*/
void SetToImageRange(const Image *image);
/**
* If a level window is set to fixed, the set and get methods won't accept
* modifications to the level window settings anymore. This behaviour can
* be turned of by setting fixed to false;
*/
void SetFixed(bool fixed);
/**
* Returns whether the level window settings are fixed (@see SetFixed(bool)) or not
*/
bool GetFixed() const;
/**
* Returns whether the level window settings are fixed (@see SetFixed(bool)) or not
*/
bool IsFixed() const;
/*!
* \brief equality operator implementation that allows to compare two level windows
*/
virtual bool operator==(const LevelWindow &levWin) const;
/*!
* \brief non equality operator implementation that allows to compare two level windows
*/
virtual bool operator!=(const LevelWindow &levWin) const;
/*!
* \brief implementation necessary because operator made
* private in itk::Object
*/
virtual LevelWindow &operator=(const LevelWindow &levWin);
/*!
* \brief Shows if floating values are accepted
*/
bool IsFloatingValues() const;
/*!
* \brief Sets the floating image value
*/
void SetFloatingValues(bool value);
protected:
/*!
* lower bound of current window
*/
ScalarType m_LowerWindowBound;
/*!
* upper bound of current window
*/
ScalarType m_UpperWindowBound;
/*!
* minimum gray value of the window
*/
ScalarType m_RangeMin;
/*!
* maximum gray value of the window
*/
ScalarType m_RangeMax;
/*!
* default minimum gray value of the window
*/
ScalarType m_DefaultLowerBound;
/*!
* default maximum gray value of the window
*/
ScalarType m_DefaultUpperBound;
/*!
* Image with floating values
*/
bool m_IsFloatingImage;
/*!
* Defines whether the level window settings may be changed after
* initialization or not.
*/
bool m_Fixed;
/*!
* confidence tests
*
* if m_LowerWindowBound > m_UpperWindowBound, then the values for m_LowerWindowBound and m_UpperWindowBound will be
* exchanged
*
* if m_LowerWindowBound < m_RangeMin, m_LowerWindowBound will be set to m_RangeMin. m_UpperWindowBound will be
* decreased the same as m_LowerWindowBound will be increased, but minimum value for m_UpperWindowBound is also
* m_RangeMin.
*
* if m_UpperWindowBound > m_RangeMax, m_UpperWindowBound will be set to m_RangeMax. m_LowerWindowBound will be
* increased the same as m_UpperWindowBound will be decreased, but maximum value for m_LowerWindowBound is also
* m_RangeMax.
*
*/
inline void EnsureConsistency();
};
} // namespace mitk
#endif /* LEVELWINDOW_H_HEADER_INCLUDED_C1F4F02C */
diff --git a/Modules/Core/include/mitkLevelWindowProperty.h b/Modules/Core/include/mitkLevelWindowProperty.h
index 8fcf60c804..0faaec8b3b 100755
--- a/Modules/Core/include/mitkLevelWindowProperty.h
+++ b/Modules/Core/include/mitkLevelWindowProperty.h
@@ -1,85 +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 MITKLEVELWINDOWPROPERTY_H_HEADER_INCLUDED_C10EEAA8
#define MITKLEVELWINDOWPROPERTY_H_HEADER_INCLUDED_C10EEAA8
#include "mitkBaseProperty.h"
#include "mitkLevelWindow.h"
namespace mitk
{
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4522)
#endif
/**
* @brief The LevelWindowProperty class Property for the mitk::LevelWindow
*
* @ingroup DataManagement
*
* @note If you want to apply the mitk::LevelWindowProperty to an mitk::Image,
* make sure to set the mitk::RenderingModeProperty to a mode which supports
* level window (e.g. LEVELWINDOW_COLOR). Make sure to check the documentation
* of the mitk::RenderingModeProperty. For a code example how to use the
* mitk::LevelWindowProperty check the mitkImageVtkMapper2DLevelWindowTest.cpp
- * in Core\Code\Testing.
+ * in Core/Code/Testing.
*/
class MITKCORE_EXPORT LevelWindowProperty : public BaseProperty
{
protected:
LevelWindow m_LevWin;
LevelWindowProperty();
LevelWindowProperty(const LevelWindowProperty &other);
LevelWindowProperty(const mitk::LevelWindow &levWin);
public:
mitkClassMacro(LevelWindowProperty, BaseProperty);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self) mitkNewMacro1Param(LevelWindowProperty, const mitk::LevelWindow &);
typedef LevelWindow ValueType;
~LevelWindowProperty() override;
const mitk::LevelWindow &GetLevelWindow() const;
const mitk::LevelWindow &GetValue() const;
void SetLevelWindow(const LevelWindow &levWin);
void SetValue(const ValueType &levWin);
std::string GetValueAsString() const override;
using BaseProperty::operator=;
private:
// purposely not implemented
LevelWindowProperty &operator=(const LevelWindowProperty &);
itk::LightObject::Pointer InternalClone() const override;
bool IsEqual(const BaseProperty &property) const override;
bool Assign(const BaseProperty &property) override;
};
#ifdef _MSC_VER
#pragma warning(pop)
#endif
} // namespace mitk
#endif /* MITKLEVELWINDOWPROPERTY_H_HEADER_INCLUDED_C10EEAA8 */
diff --git a/Modules/Core/include/mitkLookupTable.h b/Modules/Core/include/mitkLookupTable.h
index ef88aba897..5ab7de7dba 100644
--- a/Modules/Core/include/mitkLookupTable.h
+++ b/Modules/Core/include/mitkLookupTable.h
@@ -1,274 +1,274 @@
/*============================================================================
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 mitkLookupTable_h
#define mitkLookupTable_h
#include "mitkCommon.h"
#include <MitkCoreExports.h>
#include <itkDataObject.h>
#include <itkObjectFactory.h>
#include <vtkLookupTable.h>
#include <vtkSmartPointer.h>
class vtkColorTransferFunction;
class vtkPiecewiseFunction;
namespace mitk
{
/**
* @brief The LookupTable class mitk wrapper for a vtkLookupTable
* @ingroup DataManagement
*
* This class can be used to color images with a LookupTable, such as the
* vtkLookupTable.
* @note If you want to use this as a property for an mitk::Image, make sure
* to use the mitk::LookupTableProperty and set the mitk::RenderingModeProperty
* to a mode which supports lookup tables (e.g. LOOKUPTABLE_COLOR). Make
* sure to check the documentation of the mitk::RenderingModeProperty. For a
* code example how to use the mitk::LookupTable check the
- * mitkImageVtkMapper2DLookupTableTest.cpp in Core\Code\Testing.
+ * mitkImageVtkMapper2DLookupTableTest.cpp in Core/Code/Testing.
*/
class MITKCORE_EXPORT LookupTable : public itk::DataObject
{
public:
/**
* @brief RawLookupTableType raw lookuptable typedef for convenience.
*/
typedef unsigned char RawLookupTableType;
mitkClassMacroItkParent(LookupTable, itk::DataObject);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**
* @brief GetVtkLookupTable Getter for the internally wrapped vtkLookupTable.
*/
virtual vtkSmartPointer<vtkLookupTable> GetVtkLookupTable() const;
/**
* @brief GetRawLookupTable Getter for the raw lookuptable array.
*/
virtual RawLookupTableType *GetRawLookupTable() const;
/**
* @brief SetVtkLookupTable Setter for the internal lookuptable.
* @param lut The lookuptable.
*/
virtual void SetVtkLookupTable(vtkSmartPointer<vtkLookupTable> lut);
/**
* @brief ChangeOpacityForAll Set the opacity for all table values.
* @param opacity Opacity between 0.0 and 1.0.
*/
virtual void ChangeOpacityForAll(float opacity);
/**
* @brief ChangeOpacity Set the opacity for a specific table index.
* @param index The lookuptable index.
* @param opacity Opacity between 0.0 and 1.0.
*/
virtual void ChangeOpacity(int index, float opacity);
/**
* @brief GetColor convenience method wrapping the vtkLookupTable::GetColor() method.
*
* Map one value through the lookup table and return the color as an RGB array of doubles between 0 and 1.
* @param value The value you want to map.
* @param rgb RGB values between 0 and 1.
*/
virtual void GetColor(double value, double rgb[3]);
/**
* @brief GetTableValue convenience method wrapping the vtkLookupTable::GetTableValue() method.
* @param index The index you want to get.
* @param rgba RGB values between 0 and 1.
*/
virtual void GetTableValue(int index, double rgba[4]);
/**
* @brief SetTableValue convenience method wrapping the vtkLookupTable::SetTableValue() method.
* @param index The index you want to set.
* @param rgba RGB values between 0 and 1.
*/
virtual void SetTableValue(int index, double rgba[4]);
itkSetMacro(Window, float);
itkSetMacro(Level, float);
itkSetMacro(Opacity, float);
/**
* @brief equality operator implementation
*/
virtual bool operator==(const mitk::LookupTable &LookupTable) const;
/**
* @brief non equality operator implementation
*/
virtual bool operator!=(const LookupTable &LookupTable) const;
/**
* @brief implementation necessary because operator made
* private in itk::Object
*/
virtual LookupTable &operator=(const LookupTable &LookupTable);
/**
* @brief Updates the output information of the current object by calling
* updateOutputInformation of the data objects source object.
*/
void UpdateOutputInformation() override;
/**
* @brief Sets the requested Region to the largest possible region.
* This method is not implemented, since this is the default
* behavior of the itk pipeline and we do not support the
* requested-region mechanism for lookup-tables
*/
void SetRequestedRegionToLargestPossibleRegion() override;
/**
* @brief Checks, if the requested region lies outside of the buffered region by
* calling verifyRequestedRegion().
*/
bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
/**
* @brief Checks if the requested region is completely contained in
* the buffered region. Since we always want to process the lookup
* table as a whole, this method always returns true
*/
bool VerifyRequestedRegion() override;
/**
* @brief This method has no effect for lookup tables, since we do
* not support the region-mechanism
*/
void SetRequestedRegion(const itk::DataObject *data) override;
LookupTable();
~LookupTable() override;
/**
* \deprecatedSince{2014_03} Please use CreateColorTransferFunction() instead
*/
DEPRECATED(void CreateColorTransferFunction(vtkColorTransferFunction *&colorFunction));
/**
* \deprecatedSince{2014_03} Please use CreateOpacityTransferFunction() instead
*/
DEPRECATED(void CreateOpacityTransferFunction(vtkPiecewiseFunction *&opacityFunction));
/**
* \deprecatedSince{2014_03} Please use CreateGradientTransferFunction() instead
*/
DEPRECATED(void CreateGradientTransferFunction(vtkPiecewiseFunction *&gradientFunction));
vtkSmartPointer<vtkColorTransferFunction> CreateColorTransferFunction();
vtkSmartPointer<vtkPiecewiseFunction> CreateOpacityTransferFunction();
vtkSmartPointer<vtkPiecewiseFunction> CreateGradientTransferFunction();
/**
* @brief The LookupTableType enum for different predefined lookup tables.
*
* \li GRAYSCALE Our default level-window (sometimes referred to as window-level by other sources) setup for a test
* image looks like this:
* \image html ExampleLevelWindowColor.png
* \li INVERSE_GRAYSCALE Inverse LookupTable of GRAYSCALE.
* \li HOT_IRON A LookupTable for red colors.
* \li JET A LookupTable for JET color rendering.
* \li LEGACY_BINARY A LookupTable for binary images.
* \li LEGACY_RAINBOW_COLOR A rainbow-like LookupTable.
* \li MULTILABEL A LookupTable for multilabel images.
* \li PET_COLOR A LookupTable for PET color rendering.
* \li PET_20 A LookupTable for PET_20 color rendering.
*
* The different LookupTableTypes can be applied in the MitkWorkbench via right-clicking
* on an image and choosing a color map.
*/
enum LookupTableType
{
GRAYSCALE,
INVERSE_GRAYSCALE,
HOT_IRON,
JET,
JET_TRANSPARENT,
PLASMA,
INFERNO,
VIRIDIS,
MAGMA,
LEGACY_BINARY,
LEGACY_RAINBOW_COLOR,
MULTILABEL,
PET_COLOR,
PET_20
};
static std::vector<std::string> typenameList;
/**
* @brief Set the look-up table type by enum (or integer).
* @details Returns if the given type doesn't exist. Only changes the type if it is different
* from the current one.
*/
virtual void SetType(const LookupTableType type);
/**
* @brief Set the look-up table type by string.
* @details Returns if the given type doesn't exist. Only changes the type if it is different
* from the current one.
*/
virtual void SetType(const std::string &typeName);
/**
* @brief Return the current look-up table type.
*/
virtual LookupTableType GetActiveType() const;
/**
* @brief Return the current look-up table type as a string.
*/
virtual std::string GetActiveTypeAsString() const;
protected:
void PrintSelf(std::ostream &os, itk::Indent indent) const override;
LookupTable(const LookupTable &other);
virtual void BuildGrayScaleLookupTable();
virtual void BuildLegacyBinaryLookupTable();
virtual void BuildLegacyRainbowColorLookupTable();
virtual void BuildInverseGrayScaleLookupTable();
virtual void BuildHotIronLookupTable();
virtual void BuildPlasmaLookupTable();
virtual void BuildInfernoLookupTable();
virtual void BuildViridisLookupTable();
virtual void BuildMagmaLookupTable();
virtual void BuildJetLookupTable(bool transparent = false);
virtual void BuildPETColorLookupTable();
virtual void BuildPET20LookupTable();
virtual void BuildMultiLabelLookupTable();
vtkSmartPointer<vtkLookupTable> m_LookupTable;
float m_Window;
float m_Level;
float m_Opacity;
LookupTableType m_Type;
private:
itk::LightObject::Pointer InternalClone() const override;
};
} // namespace mitk
#endif /* mitkLookupTable_h */
diff --git a/Modules/Core/include/mitkLookupTableProperty.h b/Modules/Core/include/mitkLookupTableProperty.h
index 7450b71adc..d9b795c780 100644
--- a/Modules/Core/include/mitkLookupTableProperty.h
+++ b/Modules/Core/include/mitkLookupTableProperty.h
@@ -1,84 +1,84 @@
/*============================================================================
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 MITKLookupTablePROPERTY_H_HEADER_INCLUDED_C10EEAA8
#define MITKLookupTablePROPERTY_H_HEADER_INCLUDED_C10EEAA8
#include "mitkBaseProperty.h"
#include "mitkLookupTable.h"
#include <MitkCoreExports.h>
namespace mitk
{
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4522)
#endif
/**
* @brief The LookupTableProperty class Property to associate mitk::LookupTable
* to an mitk::DataNode.
* @ingroup DataManagement
*
* @note If you want to use this property to colorize an mitk::Image, make sure
* to set the mitk::RenderingModeProperty to a mode which supports lookup tables
* (e.g. LOOKUPTABLE_COLOR). Make sure to check the documentation of the
* mitk::RenderingModeProperty. For a code example how to use the mitk::LookupTable
* and this property check the mitkImageVtkMapper2DLookupTableTest.cpp in
- * Core\Code\Testing.
+ * Core/Code/Testing.
*/
class MITKCORE_EXPORT LookupTableProperty : public BaseProperty
{
protected:
LookupTable::Pointer m_LookupTable;
LookupTableProperty();
LookupTableProperty(const LookupTableProperty &);
LookupTableProperty(const mitk::LookupTable::Pointer lut);
public:
typedef LookupTable::Pointer ValueType;
mitkClassMacro(LookupTableProperty, BaseProperty);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self)
mitkNewMacro1Param(LookupTableProperty, const mitk::LookupTable::Pointer);
itkGetObjectMacro(LookupTable, LookupTable);
ValueType GetValue() const;
void SetLookupTable(const mitk::LookupTable::Pointer aLookupTable);
void SetValue(const ValueType &);
std::string GetValueAsString() const override;
using BaseProperty::operator=;
private:
// purposely not implemented
LookupTableProperty &operator=(const LookupTableProperty &);
itk::LightObject::Pointer InternalClone() const override;
bool IsEqual(const BaseProperty &property) const override;
bool Assign(const BaseProperty &property) override;
};
#ifdef _MSC_VER
#pragma warning(pop)
#endif
} // namespace mitk
#endif /* MITKLookupTablePROPERTY_H_HEADER_INCLUDED_C10EEAA8 */
diff --git a/Modules/Core/include/mitkLookupTables.h b/Modules/Core/include/mitkLookupTables.h
index 5321bf8424..b2fea21567 100644
--- a/Modules/Core/include/mitkLookupTables.h
+++ b/Modules/Core/include/mitkLookupTables.h
@@ -1,35 +1,35 @@
/*============================================================================
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 MITKLOOKUPTABLES_H_HEADER_INCLUDED
#define MITKLOOKUPTABLES_H_HEADER_INCLUDED
#include "mitkGenericLookupTable.h"
namespace mitk
{
/**Documentation
* \brief specializations of GenericLookupTable
*
* This file contains specializations of mitk::GenericLookupTable
* for bool, float, int and std::string lookuptables
- * \WARN: you have to call the mitkSpecializeGenericLookupTableOperator macro
+ * \warning you have to call the mitkSpecializeGenericLookupTableOperator macro
* in mitkLookupTables.cpp with each specialization to add an ostream << operator
* for that lookuptable specialization.
*/
mitkSpecializeGenericLookupTable(BoolLookupTable, bool);
mitkSpecializeGenericLookupTable(FloatLookupTable, float);
mitkSpecializeGenericLookupTable(IntLookupTable, int);
mitkSpecializeGenericLookupTable(StringLookupTable, std::string);
} // namespace mitk
#endif /* MITKLOOKUPTABLES_H_HEADER_INCLUDED*/
diff --git a/Modules/Core/include/mitkMaterial.h b/Modules/Core/include/mitkMaterial.h
index 7bbffc603b..271a6bb2dc 100644
--- a/Modules/Core/include/mitkMaterial.h
+++ b/Modules/Core/include/mitkMaterial.h
@@ -1,483 +1,453 @@
/*============================================================================
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 _MITK_MATERIAL_H_
#define _MITK_MATERIAL_H_
#include <MitkCoreExports.h>
#include <itkObject.h>
#include <itkRGBPixel.h>
#include <itkVectorContainer.h>
#include <mitkCommon.h>
#include <string>
#include <vtkSystemIncludes.h>
namespace mitk
{
/**
* Encapsulates 3D visualization properties which are forwarded to vtk for
* color mapping. This includes color, specular coefficient and power, opacity
* interpolation type (flat, gouraud, phong) and representation (points,
* wireframe or surface).
*
* @see vtkProperty
*/
class MITKCORE_EXPORT Material : public itk::Object
{
public:
mitkClassMacroItkParent(Material, itk::Object);
typedef itk::RGBPixel<double> Color;
enum InterpolationType
{
Flat,
Gouraud,
Phong
};
enum RepresentationType
{
Points,
Wireframe,
Surface
};
/**
* Constructor. Materials are set to the following default values:
* Color (0.5, 0.5, 0.5) color coefficient 1.0, specular color (1.0, 1.0, 1.0),
* specular coefficient 1.0, specular power 10, opacity 1.0, interpolation
* Gouraud, representation Surface.
- * @param node optinally a data tree node may be defined to which the properties
- * are forwarded. Please note, that if this node doesn't have the
- * needed properties associated, they will be added.
*/
static Pointer New()
{
Pointer smartPtr = new Material();
smartPtr->UnRegister();
return smartPtr;
}
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
* @param color the material color in RGB. Each RGB value should be in the
* range [0..1]
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
- * @param node optinally a data tree node may be defined to which the properties
- * are forwarded. Please note, that if this node doesn't have the
- * needed properties associated, they will be added.
*/
static Pointer New(Color color, double opacity = 1.0f)
{
Pointer smartPtr = new Material(color, opacity);
smartPtr->UnRegister();
return smartPtr;
}
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
* @param red the red component of the materials color (range [0..1])
* @param green the green component of the materials color (range [0..1])
* @param blue the blue component of the materials color (range [0..1])
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
- * @param node optionally a data tree node may be defined to which the properties
- * are forwarded. Please note, that if this node doesn't have the
- * needed properties associated, they will be added.
*/
static Pointer New(double red, double green, double blue, double opacity = 1.0f)
{
Pointer smartPtr = new Material(red, green, blue, opacity);
smartPtr->UnRegister();
return smartPtr;
}
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
* @param red the red component of the materials color (range [0..1])
* @param green the green component of the materials color (range [0..1])
* @param blue the blue component of the materials color (range [0..1])
* @param colorCoefficient a scaling factor for the color coefficient which
* will be multiplied with each color component (range [0..1]).
* @param specularCoefficient controls in combination with the specular power
* how shiny the material will appear (range [0..1]).
* @param specularPower controls in combination with the specular coefficient
* how shiny the material will appear (range [0..inf]).
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
- * @param node optionally a data tree node may be defined to which the properties
- * are forwarded. Please note, that if this node doesn't have the
- * needed properties associated, they will be added.
*/
static Pointer New(double red,
double green,
double blue,
double colorCoefficient,
double specularCoefficient,
double specularPower,
double opacity)
{
Pointer smartPtr = new Material(red, green, blue, colorCoefficient, specularCoefficient, specularPower, opacity);
smartPtr->UnRegister();
return smartPtr;
}
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
*
* @param color the material color in RGB. Each RGB value should be in the
* range [0..1]
* @param colorCoefficient a scaling factor for the color coefficient which
* will be multiplied with each color component (range [0..1]).
* @param specularCoefficient controls in combination with the specular power
* how shiny the material will appear (range [0..1]).
* @param specularPower controls in combination with the specular coefficient
* how shiny the material will appear (range [0..inf]).
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
- * @param node optionally a data tree node may be defined to which the properties
- * are forwarded. Please note, that if this node doesn't have the
- * needed properties associated, they will be added.
*/
static Pointer New(
Color color, double colorCoefficient, double specularCoefficient, double specularPower, double opacity)
{
Pointer smartPtr = new Material(color, colorCoefficient, specularCoefficient, specularPower, opacity);
smartPtr->UnRegister();
return smartPtr;
}
/**
* Copy constructor
*/
mitkNewMacro1Param(Material, const Material &);
/**
* Copy constructor, provided for convinience. The values are copied from property
* and afterwards the values provided for red green blue and opacity are written into the object.
*/
static Pointer New(
const Material &property, double red, double green, double blue, double opacity = 1.0, std::string name = "")
{
Pointer smartPtr = new Material(property, red, green, blue, opacity, name);
smartPtr->UnRegister();
return smartPtr;
}
virtual bool Assignable(const Material &other) const;
virtual Material &operator=(const Material &other);
/* Sets the materials color in RGB space. The rgb components have to be
* in the range [0..1]
* @param color the new color of the material
*/
virtual void SetColor(Color color);
/**
* Sets the materials color in RGB space. The rgb components have to be
* in the range [0..1]
* @param red the red component of the materials color (range [0..1])
* @param green the green component of the materials color (range [0..1])
* @param blue the blue component of the materials color (range [0..1])
*/
virtual void SetColor(double red, double green, double blue);
/**
* Sets a attenuation coefficient for the color. A value of 0 results in
* a black object. VAlid range is [0..1]
* @param coefficient the color attenuation coefficient
*/
virtual void SetColorCoefficient(double coefficient);
/**
* Sets the specular color
* @param color the specular color in RGB. Each RGB value should be in the
* range [0..1]
*/
virtual void SetSpecularColor(Color color);
/**
* Sets the specular color
* @param red the red component of the specular color (range [0..1])
* @param green the green component of the specular color (range [0..1])
* @param blue the blue component of the specular color (range [0..1])
*/
virtual void SetSpecularColor(double red, double green, double blue);
/**
* Sets the specular coefficient which controls the shininess of the object
* together with the specular power
* @param specularCoefficient the new specular coefficient. Valid range
* is [0..1]
*/
virtual void SetSpecularCoefficient(double specularCoefficient);
/**
* Sets the specular power which controls the shininess of the object
* together with the specular coefficient
- * @param specularCoefficient the new specular coefficient. Valid range
+ * @param specularPower the new specular coefficient. Valid range
* is [0..inf]
*/
virtual void SetSpecularPower(double specularPower);
/**
* Sets the opacity of the material, which controls how transparent the
* object appears. Valid range is [0..1], where 0 means fully transparent
* and 1 means a solid surface.
* @param opacity the new opacity of the material
*/
virtual void SetOpacity(double opacity);
/**
* Sets the surface interpolation method of the object rendered using the
* given materials. Valid Interopation types are Flat, Gouraud and Phong.
* See any computer graphics book for their meaning
* @param interpolation the interpolation method used for rendering of
* surfaces.
*/
virtual void SetInterpolation(InterpolationType interpolation);
/**
* Sets the surface representation method of the object rendered using the
* given materials. Valid Interopation types are Points, Wireframe and
* Surface.
* @param representation the representation method used for rendering of
* surfaces.
*/
virtual void SetRepresentation(RepresentationType representation);
/**
* Set/Get the width of a Line. The width is expressed in screen units. The default is 1.0.
*/
virtual void SetLineWidth(float lineWidth);
/**
* @returns the color of the material
*/
virtual Color GetColor() const;
/**
* @returns the color coefficient of the material. Range is [0..1]
*/
virtual double GetColorCoefficient() const;
/**
* @returns the specular color of the material in rgb values, which
* range from 0 .. 1
*/
virtual Color GetSpecularColor() const;
/**
* @returns the specular coefficient used for rendering. Range is [0..1]
*/
virtual double GetSpecularCoefficient() const;
/**
* @returns the specular power. Ranges from 0 to infinity
*/
virtual double GetSpecularPower() const;
/**
* @returns the opacity of the material. Ranges from 0 to 1
*/
virtual double GetOpacity() const;
/**
* @returns the interpolation method used for rendering.
*/
virtual InterpolationType GetInterpolation() const;
/**
* @returns the representation type used for rendering.
*/
virtual RepresentationType GetRepresentation() const;
/**
* @returns the interpolation method used for rendering using the predefined
* vtk constants.
*/
virtual int GetVtkInterpolation() const;
/**
* @returns the representation type used for rendering using the predefined
* vtk constants.
*/
virtual int GetVtkRepresentation() const;
/**
* @returns the line width used for wireframe rendering as a fraction of screen units
*/
virtual float GetLineWidth() const;
/**
* Fills the current materials with the properties of the
* given material.
* @param property the materials which should be copied in the
* current materials
*/
virtual void Initialize(const Material &property);
/**
* comparison operator which uses the member variables for
* comparison
*/
virtual bool operator==(const Material &property) const;
/**
* Dumps the properties to the out stream out
*/
void PrintSelf(std::ostream &os, itk::Indent) const override;
/**
* Sets an optional name which may be associated with the material property
* Please note, that this name is NOT forwarded to the data tree node
* as the node name
*/
itkSetMacro(Name, std::string);
/**
* returns the name associated with the material property
*/
itkGetConstMacro(Name, std::string);
protected:
/**
* Constructor. Materials are set to the following default values:
* Color (0.5, 0.5, 0.5) color coefficient 1.0, specular color (1.0, 1.0, 1.0),
* specular coefficient 1.0, specular power 10, opacity 1.0, interpolation
* Gouraud, representation Surface.
- * @param node optinally a data tree node may be defined to which the properties
- * are forwarded. Please note, that if this node doesn't have the
- * needed properties associated, they will be added.
*/
Material();
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
* @param color the material color in RGB. Each RGB value should be in the
* range [0..1]
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
- * @param node optinally a data tree node may be defined to which the properties
- * are forwarded. Please note, that if this node doesn't have the
- * needed properties associated, they will be added.
*/
Material(Color color, double opacity = 1.0f);
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
* @param red the red component of the materials color (range [0..1])
* @param green the green component of the materials color (range [0..1])
* @param blue the blue component of the materials color (range [0..1])
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
- * @param node optionally a data tree node may be defined to which the properties
- * are forwarded. Please note, that if this node doesn't have the
- * needed properties associated, they will be added.
*/
Material(double red, double green, double blue, double opacity = 1.0f);
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
* @param red the red component of the materials color (range [0..1])
* @param green the green component of the materials color (range [0..1])
* @param blue the blue component of the materials color (range [0..1])
* @param colorCoefficient a scaling factor for the color coefficient which
* will be multiplied with each color component (range [0..1]).
* @param specularCoefficient controls in combination with the specular power
* how shiny the material will appear (range [0..1]).
* @param specularPower controls in combination with the specular coefficient
* how shiny the material will appear (range [0..inf]).
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
- * @param node optionally a data tree node may be defined to which the properties
- * are forwarded. Please note, that if this node doesn't have the
- * needed properties associated, they will be added.
*/
Material(double red,
double green,
double blue,
double colorCoefficient,
double specularCoefficient,
double specularPower,
double opacity);
/**
* Constructor. All values besides the given ones are set to defaults as
* described in the default constructor
*
* @param color the material color in RGB. Each RGB value should be in the
* range [0..1]
* @param colorCoefficient a scaling factor for the color coefficient which
* will be multiplied with each color component (range [0..1]).
* @param specularCoefficient controls in combination with the specular power
* how shiny the material will appear (range [0..1]).
* @param specularPower controls in combination with the specular coefficient
* how shiny the material will appear (range [0..inf]).
* @param opacity the opacity of the material. 0.0 means fully transparent
* and 1.0 means solid.
- * @param node optionally a data tree node may be defined to which the properties
- * are forwarded. Please note, that if this node doesn't have the
- * needed properties associated, they will be added.
*/
Material(Color color, double colorCoefficient, double specularCoefficient, double specularPower, double opacity);
/**
* Copy constructor
*/
Material(const Material &property);
/**
* Copy constructor, provided for convinience. The values are copied from property
* and afterwards the values provided for red green blue and opacity are written into the object.
*/
Material(
const Material &property, double red, double green, double blue, double opacity = 1.0, std::string name = "");
virtual void InitializeStandardValues();
virtual void Update();
std::string m_Name;
Color m_Color;
Color m_SpecularColor;
double m_ColorCoefficient;
double m_SpecularCoefficient;
double m_SpecularPower;
double m_Opacity;
float m_LineWidth;
InterpolationType m_Interpolation;
RepresentationType m_Representation;
};
typedef itk::VectorContainer<unsigned int, Material::Pointer> MaterialVectorContainer;
}
#endif
diff --git a/Modules/Core/include/mitkMessage.h b/Modules/Core/include/mitkMessage.h
index f610b2a919..f1c4b48617 100644
--- a/Modules/Core/include/mitkMessage.h
+++ b/Modules/Core/include/mitkMessage.h
@@ -1,708 +1,697 @@
/*============================================================================
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 mitkMessageHIncluded
#define mitkMessageHIncluded
#include <functional>
#include <itkSimpleFastMutexLock.h>
#include <vector>
/**
* Adds a Message<> variable and methods to add/remove message delegates to/from
* this variable.
*/
#define mitkNewMessageMacro(msgHandleObject) \
private: \
::mitk::Message<> m_##msgHandleObject##Message; \
\
public: \
inline void Add##msgHandleObject##Listener(const ::mitk::MessageAbstractDelegate<> &delegate) \
{ \
m_##msgHandleObject##Message += delegate; \
} \
inline void Remove##msgHandleObject##Listener(const ::mitk::MessageAbstractDelegate<> &delegate) \
{ \
m_##msgHandleObject##Message -= delegate; \
}
#define mitkNewMessageWithReturnMacro(msgHandleObject, returnType) \
private: \
::mitk::Message<returnType> m_##msgHandleObject##Message; \
\
public: \
inline void Add##msgHandleObject##Listener(const ::mitk::MessageAbstractDelegate<returnType> &delegate) \
{ \
m_##msgHandleObject##Message += delegate; \
} \
inline void Remove##msgHandleObject##Listener(const ::mitk::MessageAbstractDelegate<returnType> &delegate) \
{ \
m_##msgHandleObject##Message -= delegate; \
}
#define mitkNewMessage1Macro(msgHandleObject, type1) \
private: \
::mitk::Message1<type1> m_##msgHandleObject##Message; \
\
public: \
void Add##msgHandleObject##Listener(const ::mitk::MessageAbstractDelegate1<type1> &delegate) \
{ \
m_##msgHandleObject##Message += delegate; \
} \
void Remove##msgHandleObject##Listener(const ::mitk::MessageAbstractDelegate1<type1> &delegate) \
{ \
m_##msgHandleObject##Message -= delegate; \
}
#define mitkNewMessage2Macro(msgHandleObject, type1, type2) \
private: \
::mitk::Message2<type1, type2> m_##msgHandleObject##Message; \
\
public: \
void Add##msgHandleObject##Listener(const ::mitk::MessageAbstractDelegate2<type1, type2> &delegate) \
{ \
m_##msgHandleObject##Message += delegate; \
} \
void Remove##msgHandleObject##Listener(const ::mitk::MessageAbstractDelegate2<type1, type2> &delegate) \
{ \
m_##msgHandleObject##Message -= delegate; \
}
namespace mitk
{
template <typename A = void>
class MessageAbstractDelegate
{
public:
virtual ~MessageAbstractDelegate() {}
virtual A Execute() const = 0;
virtual bool operator==(const MessageAbstractDelegate *cmd) const = 0;
virtual MessageAbstractDelegate *Clone() const = 0;
};
template <typename T, typename A = void>
class MessageAbstractDelegate1
{
public:
virtual ~MessageAbstractDelegate1() {}
virtual A Execute(T t) const = 0;
virtual bool operator==(const MessageAbstractDelegate1 *cmd) const = 0;
virtual MessageAbstractDelegate1 *Clone() const = 0;
};
template <typename T, typename U, typename A = void>
class MessageAbstractDelegate2
{
public:
virtual ~MessageAbstractDelegate2() {}
virtual A Execute(T t, U u) const = 0;
virtual bool operator==(const MessageAbstractDelegate2 *cmd) const = 0;
virtual MessageAbstractDelegate2 *Clone() const = 0;
};
template <typename T, typename U, typename V, typename A = void>
class MessageAbstractDelegate3
{
public:
virtual ~MessageAbstractDelegate3() {}
virtual A Execute(T t, U u, V v) const = 0;
virtual bool operator==(const MessageAbstractDelegate3 *cmd) const = 0;
virtual MessageAbstractDelegate3 *Clone() const = 0;
};
template <typename T, typename U, typename V, typename W, typename A = void>
class MessageAbstractDelegate4
{
public:
virtual ~MessageAbstractDelegate4() {}
virtual A Execute(T t, U u, V v, W w) const = 0;
virtual bool operator==(const MessageAbstractDelegate4 *cmd) const = 0;
virtual MessageAbstractDelegate4 *Clone() const = 0;
};
/**
* This class essentially wraps a function pointer with signature
* A(R::*function)(). A is the return type of your callback function
* and R the type of the class implementing the function.
*
* Use this class to add a callback function to
* messages without parameters.
*/
template <class R, typename A = void>
class MessageDelegate : public MessageAbstractDelegate<A>
{
public:
// constructor - takes pointer to an object and pointer to a member and stores
// them in two private variables
MessageDelegate(R *object, A (R::*memberFunctionPointer)())
: m_Object(object), m_MemberFunctionPointer(memberFunctionPointer)
{
}
~MessageDelegate() override {}
// override function "Call"
A Execute() const override
{
return (m_Object->*m_MemberFunctionPointer)(); // execute member function
}
bool operator==(const MessageAbstractDelegate<A> *c) const override
{
const MessageDelegate<R, A> *cmd = dynamic_cast<const MessageDelegate<R, A> *>(c);
if (!cmd)
return false;
if ((void *)this->m_Object != (void *)cmd->m_Object)
return false;
if (this->m_MemberFunctionPointer != cmd->m_MemberFunctionPointer)
return false;
return true;
}
MessageAbstractDelegate<A> *Clone() const override { return new MessageDelegate(m_Object, m_MemberFunctionPointer); }
private:
R *m_Object; // pointer to object
A (R::*m_MemberFunctionPointer)(); // pointer to member function
};
/**
* This class essentially wraps a function pointer with signature
* A(R::*function)(T). A is the return type of your callback function,
* R the type of the class implementing the function and T the type
* of the argument.
*
* Use this class to add a callback function to
* messages with one parameter.
*
* If you need more parameters, use MessageDelegate2 etc.
*/
template <class R, typename T, typename A = void>
class MessageDelegate1 : public MessageAbstractDelegate1<T, A>
{
public:
// constructor - takes pointer to an object and pointer to a member and stores
// them in two private variables
MessageDelegate1(R *object, A (R::*memberFunctionPointer)(T))
: m_Object(object), m_MemberFunctionPointer(memberFunctionPointer)
{
}
~MessageDelegate1() override {}
// override function "Call"
A Execute(T t) const override
{
return (m_Object->*m_MemberFunctionPointer)(t); // execute member function
}
bool operator==(const MessageAbstractDelegate1<T, A> *c) const override
{
const MessageDelegate1<R, T, A> *cmd = dynamic_cast<const MessageDelegate1<R, T, A> *>(c);
if (!cmd)
return false;
if ((void *)this->m_Object != (void *)cmd->m_Object)
return false;
if (this->m_MemberFunctionPointer != cmd->m_MemberFunctionPointer)
return false;
return true;
}
MessageAbstractDelegate1<T, A> *Clone() const override { return new MessageDelegate1(m_Object, m_MemberFunctionPointer); }
private:
R *m_Object; // pointer to object
A (R::*m_MemberFunctionPointer)(T); // pointer to member function
};
template <class R, typename T, typename U, typename A = void>
class MessageDelegate2 : public MessageAbstractDelegate2<T, U, A>
{
public:
// constructor - takes pointer to an object and pointer to a member and stores
// them in two private variables
MessageDelegate2(R *object, A (R::*memberFunctionPointer)(T, U))
: m_Object(object), m_MemberFunctionPointer(memberFunctionPointer)
{
}
~MessageDelegate2() override {}
// override function "Call"
A Execute(T t, U u) const override
{
return (m_Object->*m_MemberFunctionPointer)(t, u); // execute member function
}
bool operator==(const MessageAbstractDelegate2<T, U, A> *c) const override
{
const MessageDelegate2<R, T, U, A> *cmd = dynamic_cast<const MessageDelegate2<R, T, U, A> *>(c);
if (!cmd)
return false;
if ((void *)this->m_Object != (void *)cmd->m_Object)
return false;
if (this->m_MemberFunctionPointer != cmd->m_MemberFunctionPointer)
return false;
return true;
}
MessageAbstractDelegate2<T, U, A> *Clone() const override { return new MessageDelegate2(m_Object, m_MemberFunctionPointer); }
private:
R *m_Object; // pointer to object
A (R::*m_MemberFunctionPointer)(T, U); // pointer to member function
};
template <class R, typename T, typename U, typename V, typename A = void>
class MessageDelegate3 : public MessageAbstractDelegate3<T, U, V, A>
{
public:
// constructor - takes pointer to an object and pointer to a member and stores
// them in two private variables
MessageDelegate3(R *object, A (R::*memberFunctionPointer)(T, U, V))
: m_Object(object), m_MemberFunctionPointer(memberFunctionPointer)
{
}
~MessageDelegate3() override {}
// override function "Call"
A Execute(T t, U u, V v) const override
{
return (m_Object->*m_MemberFunctionPointer)(t, u, v); // execute member function
}
bool operator==(const MessageAbstractDelegate3<T, U, V, A> *c) const override
{
const MessageDelegate3<R, T, U, V, A> *cmd = dynamic_cast<const MessageDelegate3<R, T, U, V, A> *>(c);
if (!cmd)
return false;
if ((void *)this->m_Object != (void *)cmd->m_Object)
return false;
if (this->m_MemberFunctionPointer != cmd->m_MemberFunctionPointer)
return false;
return true;
}
MessageAbstractDelegate3<T, U, V, A> *Clone() const override
{
return new MessageDelegate3(m_Object, m_MemberFunctionPointer);
}
private:
R *m_Object; // pointer to object
A (R::*m_MemberFunctionPointer)(T, U, V); // pointer to member function
};
template <class R, typename T, typename U, typename V, typename W, typename A = void>
class MessageDelegate4 : public MessageAbstractDelegate4<T, U, V, W, A>
{
public:
// constructor - takes pointer to an object and pointer to a member and stores
// them in two private variables
MessageDelegate4(R *object, A (R::*memberFunctionPointer)(T, U, V, W))
: m_Object(object), m_MemberFunctionPointer(memberFunctionPointer)
{
}
virtual ~MessageDelegate4() {}
// override function "Call"
virtual A Execute(T t, U u, V v, W w) const
{
return (m_Object->*m_MemberFunctionPointer)(t, u, v, w); // execute member function
}
bool operator==(const MessageAbstractDelegate4<T, U, V, W, A> *c) const
{
const MessageDelegate4<R, T, U, V, W, A> *cmd = dynamic_cast<const MessageDelegate4<R, T, U, V, W, A> *>(c);
if (!cmd)
return false;
if ((void *)this->m_Object != (void *)cmd->m_Object)
return false;
if (this->m_MemberFunctionPointer != cmd->m_MemberFunctionPointer)
return false;
return true;
}
MessageAbstractDelegate4<T, U, V, W, A> *Clone() const
{
return new MessageDelegate4(m_Object, m_MemberFunctionPointer);
}
private:
R *m_Object; // pointer to object
A (R::*m_MemberFunctionPointer)(T, U, V, W); // pointer to member function
};
template <typename AbstractDelegate>
class MessageBase
{
public:
typedef std::vector<AbstractDelegate *> ListenerList;
virtual ~MessageBase()
{
for (auto iter = m_Listeners.begin(); iter != m_Listeners.end(); ++iter)
{
delete *iter;
}
}
MessageBase() {}
MessageBase(const MessageBase &o)
{
for (typename ListenerList::iterator iter = o.m_Listeners.begin(); iter != o.m_Listeners.end(); ++iter)
{
m_Listeners.push_back((*iter)->Clone());
}
}
MessageBase &operator=(const MessageBase &o)
{
MessageBase tmp(o);
std::swap(tmp.m_Listeners, this->m_Listeners);
return *this;
}
void AddListener(const AbstractDelegate &delegate) const
{
AbstractDelegate *msgCmd = delegate.Clone();
m_Mutex.Lock();
for (auto iter = m_Listeners.begin(); iter != m_Listeners.end(); ++iter)
{
if ((*iter)->operator==(msgCmd))
{
delete msgCmd;
m_Mutex.Unlock();
return;
}
}
m_Listeners.push_back(msgCmd);
m_Mutex.Unlock();
}
void operator+=(const AbstractDelegate &delegate) const { this->AddListener(delegate); }
void RemoveListener(const AbstractDelegate &delegate) const
{
m_Mutex.Lock();
for (auto iter = m_Listeners.begin(); iter != m_Listeners.end(); ++iter)
{
if ((*iter)->operator==(&delegate))
{
delete *iter;
m_Listeners.erase(iter);
m_Mutex.Unlock();
return;
}
}
m_Mutex.Unlock();
}
void operator-=(const AbstractDelegate &delegate) const { this->RemoveListener(delegate); }
const ListenerList &GetListeners() const { return m_Listeners; }
bool HasListeners() const { return !m_Listeners.empty(); }
bool IsEmpty() const { return m_Listeners.empty(); }
protected:
/**
* \brief List of listeners.
*
- * This is declared mutable for a reason: Imagine an object that sends out notifications, e.g.
- *
- * \code
- class Database {
- public:
- Message Modified;
- };
- * \endcode
- *
- * Now imaginge someone gets a <tt>const Database</tt> object, because he/she should not write to the
+ * This is declared mutable for a reason: Imagine an object that sends out notifications and
+ * someone gets a <tt>const Database</tt> object, because he/she should not write to the
* database. He/she should anyway be able to register for notifications about changes in the database
* -- this is why AddListener and RemoveListener are declared <tt>const</tt>. m_Listeners must be
* mutable so that AddListener and RemoveListener can modify it regardless of the object's constness.
*/
mutable ListenerList m_Listeners;
mutable itk::SimpleFastMutexLock m_Mutex;
};
/**
* \brief Event/message/notification class.
*
* \sa mitk::BinaryThresholdTool
* \sa QmitkBinaryThresholdToolGUI
*
* This totally ITK, Qt, VTK, whatever toolkit independent class
* allows one class to send out messages and another class to
* receive these message. This class is templated over the
* return type (A) of the callback functions.
* There are variations of this class
* (Message1, Message2, etc.) for sending
* one, two or more parameters along with the messages.
*
* This is an implementation of the Observer pattern.
*
* \li There is no guarantee about the order of which observer is notified first. At the moment the observers which
* register first will be notified first.
* \li Notifications are <b>synchronous</b>, by direct method calls. There is no support for asynchronous messages.
*
* To conveniently add methods for registering/unregistering observers
* to Message variables of your class, you can use the mitkNewMessageMacro
* macros.
- *
- * Here is an example how to use the macros and templates:
- *
- * \code
- *
- * // An object to be send around
- * class Law
- * {
- * private:
- * std::string m_Description;
- *
- * public:
- *
- * Law(const std::string law) : m_Description(law)
- * { }
- *
- * std::string GetDescription() const
- * {
- * return m_Description;
- * }
- * };
- *
- * // The NewtonMachine will issue specific events
- * class NewtonMachine
- * {
- * mitkNewMessageMacro(AnalysisStarted);
- * mitkNewMessage1Macro(AnalysisStopped, bool);
- * mitkNewMessage1Macro(LawDiscovered, const Law&);
- *
- * public:
- *
- * void StartAnalysis()
- * {
- * // send the "started" signal
- * m_AnalysisStartedMessage();
- *
- * // we found a new law of nature by creating one :-)
- * Law massLaw("F=ma");
- * m_LawDiscoveredMessage(massLaw);
- * }
- *
- * void StopAnalysis()
- * {
- * // send the "stop" message with false, indicating
- * // that no error occured
- * m_AnalysisStoppedMessage(false);
- * }
- * };
- *
- * class Observer
- * {
- * private:
- *
- * NewtonMachine* m_Machine;
- *
- * public:
- *
- * Observer(NewtonMachine* machine) : m_Machine(machine)
- * {
- * // Add "observers", i.e. function pointers to the machine
- * m_Machine->AddAnalysisStartedListener(
- * ::mitk::MessageDelegate<Observer>(this, &Observer::MachineStarted));
- * m_Machine->AddAnalysisStoppedListener(
- * ::mitk::MessageDelegate1<Observer, bool>(this, &Observer::MachineStopped));
- * m_Machine->AddLawDiscoveredListener(
- * ::mitk::MessageDelegate1<Observer, const Law&>(this, &Observer::LawDiscovered));
- * }
- *
- * ~Observer()
- * {
- * // Always remove your observers when finished
- * m_Machine->RemoveAnalysisStartedListener(
- * ::mitk::MessagDelegate<Observer>(this, &Observer::MachineStarted));
- * m_Machine->RemoveAnalysisStoppedListener(
- * ::mitk::MessageDelegate1<Observer, bool>(this, &Observer::MachineStopped));
- * m_Machine->RemoveLawDiscoveredListener(
- * ::mitk::MessageDelegate1<Observer, const Law&>(this, &Observer::LawDiscovered));
- * }
- *
- * void MachineStarted()
- * {
- * std::cout << "Observed machine has started" << std::endl;
- * }
- *
- * void MachineStopped(bool error)
- * {
- * std::cout << "Observed machine stopped " << (error ? "with an error" : "") << std::endl;
- * }
- *
- * void LawDiscovered(const Law& law)
- * {
- * std::cout << "New law of nature discovered: " << law.GetDescription() << std::endl;
- * }
- * };
- *
- * NewtonMachine newtonMachine;
- * Observer observer(&newtonMachine);
- *
- * // This will send two events to registered observers
- * newtonMachine.StartAnalysis();
- * // This will send one event to registered observers
- * newtonMachine.StopAnalysis();
- *
- * \endcode
- *
- * Another example of how to use these message classes can be
- * found in the directory Testing, file mitkMessageTest.cpp
- *
*/
template <typename A = void>
class Message : public MessageBase<MessageAbstractDelegate<A>>
{
public:
typedef MessageBase<MessageAbstractDelegate<A>> Super;
typedef typename Super::ListenerList ListenerList;
void Send()
{
ListenerList listeners;
{
this->m_Mutex.Lock();
listeners.assign(this->m_Listeners.begin(), this->m_Listeners.end());
this->m_Mutex.Unlock();
}
for (auto iter = listeners.begin(); iter != listeners.end(); ++iter)
{
// notify each listener
(*iter)->Execute();
}
}
void operator()() { this->Send(); }
};
// message with 1 parameter and return type
template <typename T, typename A = void>
class Message1 : public MessageBase<MessageAbstractDelegate1<T, A>>
{
public:
typedef MessageBase<MessageAbstractDelegate1<T, A>> Super;
typedef typename Super::ListenerList ListenerList;
void Send(T t)
{
ListenerList listeners;
{
this->m_Mutex.Lock();
listeners.assign(this->m_Listeners.begin(), this->m_Listeners.end());
this->m_Mutex.Unlock();
}
for (auto iter = listeners.begin(); iter != listeners.end(); ++iter)
{
// notify each listener
(*iter)->Execute(t);
}
}
void operator()(T t) { this->Send(t); }
};
// message with 2 parameters and return type
template <typename T, typename U, typename A = void>
class Message2 : public MessageBase<MessageAbstractDelegate2<T, U, A>>
{
public:
typedef MessageBase<MessageAbstractDelegate2<T, U, A>> Super;
typedef typename Super::ListenerList ListenerList;
void Send(T t, U u)
{
ListenerList listeners;
{
this->m_Mutex.Lock();
listeners.assign(this->m_Listeners.begin(), this->m_Listeners.end());
this->m_Mutex.Unlock();
}
for (auto iter = listeners.begin(); iter != listeners.end(); ++iter)
{
// notify each listener
(*iter)->Execute(t, u);
}
}
void operator()(T t, U u) { this->Send(t, u); }
};
// message with 3 parameters and return type
template <typename T, typename U, typename V, typename A = void>
class Message3 : public MessageBase<MessageAbstractDelegate3<T, U, V, A>>
{
public:
typedef MessageBase<MessageAbstractDelegate3<T, U, V, A>> Super;
typedef typename Super::ListenerList ListenerList;
void Send(T t, U u, V v)
{
ListenerList listeners;
{
this->m_Mutex.Lock();
listeners.assign(this->m_Listeners.begin(), this->m_Listeners.end());
this->m_Mutex.Unlock();
}
for (typename ListenerList::iterator iter = listeners.begin(); iter != listeners.end(); ++iter)
{
// notify each listener
(*iter)->Execute(t, u, v);
}
}
void operator()(T t, U u, V v) { this->Send(t, u, v); }
};
// message with 4 parameters and return type
template <typename T, typename U, typename V, typename W, typename A = void>
class Message4 : public MessageBase<MessageAbstractDelegate4<T, U, V, W>>
{
public:
typedef MessageBase<MessageAbstractDelegate4<T, U, V, W, A>> Super;
typedef typename Super::ListenerList ListenerList;
void Send(T t, U u, V v, W w)
{
ListenerList listeners;
{
this->m_Mutex.Lock();
listeners.assign(this->m_Listeners.begin(), this->m_Listeners.end());
this->m_Mutex.Unlock();
}
for (typename ListenerList::iterator iter = listeners.begin(); iter != listeners.end(); ++iter)
{
// notify each listener
(*iter)->Execute(t, u, v, w);
}
}
void operator()(T t, U u, V v, W w) { this->Send(t, u, v, w); }
};
+/* Here is an example how to use the macros and templates:
+*
+* // An object to be send around
+* class Law
+* {
+* private:
+* std::string m_Description;
+*
+* public:
+*
+* Law(const std::string law) : m_Description(law)
+* { }
+*
+* std::string GetDescription() const
+* {
+* return m_Description;
+* }
+* };
+*
+* // The NewtonMachine will issue specific events
+* class NewtonMachine
+* {
+* mitkNewMessageMacro(AnalysisStarted);
+* mitkNewMessage1Macro(AnalysisStopped, bool);
+* mitkNewMessage1Macro(LawDiscovered, const Law&);
+*
+* public:
+*
+* void StartAnalysis()
+* {
+* // send the "started" signal
+* m_AnalysisStartedMessage();
+*
+* // we found a new law of nature by creating one :-)
+* Law massLaw("F=ma");
+* m_LawDiscoveredMessage(massLaw);
+* }
+*
+* void StopAnalysis()
+* {
+* // send the "stop" message with false, indicating
+* // that no error occured
+* m_AnalysisStoppedMessage(false);
+* }
+* };
+*
+* class Observer
+* {
+* private:
+*
+* NewtonMachine* m_Machine;
+*
+* public:
+*
+* Observer(NewtonMachine* machine) : m_Machine(machine)
+* {
+* // Add "observers", i.e. function pointers to the machine
+* m_Machine->AddAnalysisStartedListener(
+* ::mitk::MessageDelegate<Observer>(this, &Observer::MachineStarted));
+* m_Machine->AddAnalysisStoppedListener(
+* ::mitk::MessageDelegate1<Observer, bool>(this, &Observer::MachineStopped));
+* m_Machine->AddLawDiscoveredListener(
+* ::mitk::MessageDelegate1<Observer, const Law&>(this, &Observer::LawDiscovered));
+* }
+*
+* ~Observer()
+* {
+* // Always remove your observers when finished
+* m_Machine->RemoveAnalysisStartedListener(
+* ::mitk::MessagDelegate<Observer>(this, &Observer::MachineStarted));
+* m_Machine->RemoveAnalysisStoppedListener(
+* ::mitk::MessageDelegate1<Observer, bool>(this, &Observer::MachineStopped));
+* m_Machine->RemoveLawDiscoveredListener(
+* ::mitk::MessageDelegate1<Observer, const Law&>(this, &Observer::LawDiscovered));
+* }
+*
+* void MachineStarted()
+* {
+* std::cout << "Observed machine has started" << std::endl;
+* }
+*
+* void MachineStopped(bool error)
+* {
+* std::cout << "Observed machine stopped " << (error ? "with an error" : "") << std::endl;
+* }
+*
+* void LawDiscovered(const Law& law)
+* {
+* std::cout << "New law of nature discovered: " << law.GetDescription() << std::endl;
+* }
+* };
+*
+* NewtonMachine newtonMachine;
+* Observer observer(&newtonMachine);
+*
+* // This will send two events to registered observers
+* newtonMachine.StartAnalysis();
+* // This will send one event to registered observers
+* newtonMachine.StopAnalysis();
+*
+* Another example of how to use these message classes can be
+* found in the directory Testing, file mitkMessageTest.cpp
+*
+*/
+
} // namespace
#endif
diff --git a/Modules/Core/include/mitkMimeType.h b/Modules/Core/include/mitkMimeType.h
index 05381e7952..a64e7d9429 100644
--- a/Modules/Core/include/mitkMimeType.h
+++ b/Modules/Core/include/mitkMimeType.h
@@ -1,89 +1,89 @@
/*============================================================================
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 MITKMIMETYPE_H
#define MITKMIMETYPE_H
#include <MitkCoreExports.h>
#include <usSharedData.h>
#include <vector>
namespace mitk
{
class CustomMimeType;
/**
* @ingroup IO
*
* @brief The MimeType class represens a registered mime-type. It is an immutable wrapper for mitk::CustomMimeType
* that makes memory handling easier by providing a stack-object for the user.
*
* If you want to register a new MimeType, use the CustomMimeType class instead. Wrapping will be performed for you
* automatically.
* In all other cases you should use mitk::MimeType when working with mime-types.
*/
class MITKCORE_EXPORT MimeType
{
public:
MimeType();
MimeType(const MimeType &other);
MimeType(const CustomMimeType &x, int rank, long id);
~MimeType();
MimeType &operator=(const MimeType &other);
bool operator==(const MimeType &other) const;
bool operator<(const MimeType &other) const;
- /** @See mitk::CustomMimeType::GetName()*/
+ /** @see mitk::CustomMimeType::GetName()*/
std::string GetName() const;
- /** @See mitk::CustomMimeType::GetCategory()*/
+ /** @see mitk::CustomMimeType::GetCategory()*/
std::string GetCategory() const;
- /** @See mitk::CustomMimeType::GetExtensions()*/
+ /** @see mitk::CustomMimeType::GetExtensions()*/
std::vector<std::string> GetExtensions() const;
- /** @See mitk::CustomMimeType::GetComment()*/
+ /** @see mitk::CustomMimeType::GetComment()*/
std::string GetComment() const;
- /** @See mitk::CustomMimeType::GetFileNameWithoutExtension()*/
+ /** @see mitk::CustomMimeType::GetFileNameWithoutExtension()*/
std::string GetFilenameWithoutExtension(const std::string &path) const;
- /** @See mitk::CustomMimeType::AppliesTo()*/
+ /** @see mitk::CustomMimeType::AppliesTo()*/
bool AppliesTo(const std::string &path) const;
- /** @See mitk::CustomMimeType::MatchesExtension()*/
+ /** @see mitk::CustomMimeType::MatchesExtension()*/
bool MatchesExtension(const std::string &path) const;
- /** @See mitk::CustomMimeType::IsValid()*/
+ /** @see mitk::CustomMimeType::IsValid()*/
bool IsValid() const;
- /** @See mitk::CustomMimeType::Swap()*/
+ /** @see mitk::CustomMimeType::Swap()*/
void Swap(MimeType &m);
private:
struct Impl;
// Use C++11 shared_ptr instead
us::SharedDataPointer<const Impl> m_Data;
};
MITKCORE_EXPORT void swap(MimeType &m1, MimeType &m2);
MITKCORE_EXPORT std::ostream &operator<<(std::ostream &os, const MimeType &mimeType);
}
#endif // MITKMIMETYPE_H
diff --git a/Modules/Core/include/mitkPlaneGeometry.h b/Modules/Core/include/mitkPlaneGeometry.h
index ad7644a739..f06e23e30d 100644
--- a/Modules/Core/include/mitkPlaneGeometry.h
+++ b/Modules/Core/include/mitkPlaneGeometry.h
@@ -1,608 +1,614 @@
/*============================================================================
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.
============================================================================*/
/**
* \brief Describes the geometry of a plane object
*
* Describes a two-dimensional manifold, i.e., to put it simply,
* an object that can be described using a 2D coordinate-system.
*
* PlaneGeometry can map points between 3D world coordinates
* (in mm) and the described 2D coordinate-system (in mm) by first projecting
* the 3D point onto the 2D manifold and then calculating the 2D-coordinates
* (in mm). These 2D-mm-coordinates can be further converted into
* 2D-unit-coordinates (e.g., pixels), giving a parameter representation of
* the object with parameter values inside a rectangle
* (e.g., [0,0]..[width, height]), which is the bounding box (bounding range
* in z-direction always [0]..[1]).
*
* A PlaneGeometry describes the 2D representation within a 3D object (derived from BaseGeometry). For example,
* a single CT-image (slice) is 2D in the sense that you can access the
* pixels using 2D-coordinates, but is also 3D, as the pixels are really
* voxels, thus have an extension (thickness) in the 3rd dimension.
*
*
* Optionally, a reference BaseGeometry can be specified, which usually would
* be the geometry associated with the underlying dataset. This is currently
* used for calculating the intersection of inclined / rotated planes
* (represented as PlaneGeometry) with the bounding box of the associated
* BaseGeometry.
*
* \warning The PlaneGeometry are not necessarily up-to-date and not even
* initialized. As described in the previous paragraph, one of the
* Generate-/Copy-/UpdateOutputInformation methods have to initialize it.
* mitk::BaseData::GetPlaneGeometry() makes sure, that the PlaneGeometry is
* up-to-date before returning it (by setting the update extent appropriately
* and calling UpdateOutputInformation).
*
* Rule: everything is in mm (or ms for temporal information) if not
* stated otherwise.
* \ingroup Geometry
*/
#ifndef PLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#define PLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C
#include "mitkBaseGeometry.h"
#include "mitkRestorePlanePositionOperation.h"
#include <MitkCoreExports.h>
#include <vnl/vnl_cross.h>
namespace mitk
{
template <class TCoordRep, unsigned int NPointDimension>
class Line;
typedef Line<ScalarType, 3> Line3D;
class PlaneGeometry;
/** \deprecatedSince{2014_10} This class is deprecated. Please use PlaneGeometry instead. */
DEPRECATED(typedef PlaneGeometry Geometry2D);
/**
* \brief Describes a two-dimensional, rectangular plane
*
* \ingroup Geometry
*/
class MITKCORE_EXPORT PlaneGeometry : public BaseGeometry
{
public:
mitkClassMacro(PlaneGeometry, BaseGeometry);
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
enum PlaneOrientation {
Axial,
Sagittal,
Frontal, // also known as "Coronal" in mitk.
None // This defines the PlaneGeometry for the 3D renderWindow which
// curiously also needs a PlaneGeometry. This should be reconsidered some time.
};
virtual void IndexToWorld(const Point2D &pt_units, Point2D &pt_mm) const;
virtual void WorldToIndex(const Point2D &pt_mm, Point2D &pt_units) const;
//##Documentation
//## @brief Convert (continuous or discrete) index coordinates of a \em vector
//## \a vec_units to world coordinates (in mm)
//## @deprecated First parameter (Point2D) is not used. If possible, please use void IndexToWorld(const
// mitk::Vector2D& vec_units, mitk::Vector2D& vec_mm) const.
//## For further information about coordinates types, please see the Geometry documentation
virtual void IndexToWorld(const mitk::Point2D &atPt2d_untis,
const mitk::Vector2D &vec_units,
mitk::Vector2D &vec_mm) const;
//##Documentation
//## @brief Convert (continuous or discrete) index coordinates of a \em vector
//## \a vec_units to world coordinates (in mm)
//## For further information about coordinates types, please see the Geometry documentation
virtual void IndexToWorld(const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const;
//##Documentation
//## @brief Convert world coordinates (in mm) of a \em vector
//## \a vec_mm to (continuous!) index coordinates.
//## @deprecated First parameter (Point2D) is not used. If possible, please use void WorldToIndex(const
// mitk::Vector2D& vec_mm, mitk::Vector2D& vec_units) const.
//## For further information about coordinates types, please see the Geometry documentation
virtual void WorldToIndex(const mitk::Point2D &atPt2d_mm,
const mitk::Vector2D &vec_mm,
mitk::Vector2D &vec_units) const;
//##Documentation
//## @brief Convert world coordinates (in mm) of a \em vector
//## \a vec_mm to (continuous!) index coordinates.
//## For further information about coordinates types, please see the Geometry documentation
virtual void WorldToIndex(const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const;
/**
* \brief Initialize a plane with orientation \a planeorientation
* (default: axial) with respect to \a BaseGeometry (default: identity).
* Spacing also taken from \a BaseGeometry.
*
* \warning A former version of this method created a geometry with unit
* spacing. For unit spacing use
*
* \code
* // for in-plane unit spacing:
* thisgeometry->SetSizeInUnits(thisgeometry->GetExtentInMM(0),
* thisgeometry->GetExtentInMM(1));
* // additionally, for unit spacing in normal direction (former version
* // did not do this):
* thisgeometry->SetExtentInMM(2, 1.0);
* \endcode
*/
virtual void InitializeStandardPlane(const BaseGeometry *geometry3D,
PlaneOrientation planeorientation = Axial,
ScalarType zPosition = 0,
bool frontside = true,
bool rotated = false,
bool top = true);
/**
* \brief Initialize a plane with orientation \a planeorientation
* (default: axial) with respect to \a BaseGeometry (default: identity).
* Spacing also taken from \a BaseGeometry.
*
+ * \param geometry3D
* \param top if \a true, create plane at top, otherwise at bottom
* (for PlaneOrientation Axial, for other plane locations respectively)
+ * \param planeorientation
+ * \param frontside
+ * \param rotated
*/
virtual void InitializeStandardPlane(const BaseGeometry *geometry3D,
bool top,
PlaneOrientation planeorientation = Axial,
bool frontside = true,
bool rotated = false);
/**
* \brief Initialize a plane with orientation \a planeorientation
* (default: axial) with respect to \a transform (default: identity)
* given width and height in units.
*
* \a Rotated means rotated by 180 degrees (1/2 rotation) within the plane.
* Rotation by 90 degrees (1/4 rotation) is not implemented as of now.
*
* \a Frontside/Backside:
* Viewed from below = frontside in the axial case;
* (radiologist's view versus neuro-surgeon's view, see:
* http://www.itk.org/Wiki/images/e/ed/DICOM-OrientationDiagram-Radiologist-vs-NeuroSurgeon.png )
* Viewed from front = frontside in the coronal case;
* Viewed from left = frontside in the sagittal case.
*
* \a Cave/Caution: Currently only RPI, LAI, LPS and RAS in the three standard planes are covered,
* i.e. 12 cases of 144: 3 standard planes * 48 coordinate orientations = 144 cases.
*/
virtual void InitializeStandardPlane(ScalarType width,
ScalarType height,
const AffineTransform3D *transform = nullptr,
PlaneOrientation planeorientation = Axial,
ScalarType zPosition = 0,
bool frontside = true,
bool rotated = false,
bool top = true);
/**
* \brief Initialize plane with orientation \a planeorientation
* (default: axial) given width, height and spacing.
*
*/
virtual void InitializeStandardPlane(ScalarType width,
ScalarType height,
const Vector3D &spacing,
PlaneOrientation planeorientation = Axial,
ScalarType zPosition = 0,
bool frontside = true,
bool rotated = false,
bool top = true);
/**
* \brief Initialize plane by width and height in pixels, right-/down-vector
* (itk) to describe orientation in world-space (vectors will be normalized)
* and spacing (default: 1.0 mm in all directions).
*
* The vectors are normalized and multiplied by the respective spacing before
* they are set in the matrix.
*
* This overloaded version of InitializeStandardPlane() creates only righthanded
* coordinate orientations, unless spacing contains 1 or 3 negative entries.
*
*/
virtual void InitializeStandardPlane(ScalarType width,
ScalarType height,
const Vector3D &rightVector,
const Vector3D &downVector,
const Vector3D *spacing = nullptr);
/**
* \brief Initialize plane by width and height in pixels,
* right-/down-vector (vnl) to describe orientation in world-space (vectors
* will be normalized) and spacing (default: 1.0 mm in all directions).
*
* The vectors are normalized and multiplied by the respective spacing
* before they are set in the matrix.
*
* This overloaded version of InitializeStandardPlane() creates only righthanded
* coordinate orientations, unless spacing contains 1 or 3 negative entries.
*
*/
virtual void InitializeStandardPlane(ScalarType width,
ScalarType height,
const VnlVector &rightVector,
const VnlVector &downVector,
const Vector3D *spacing = nullptr);
/**
* \brief Initialize plane by right-/down-vector (itk) and spacing
* (default: 1.0 mm in all directions).
*
* The length of the right-/-down-vector is used as width/height in units,
* respectively. Then, the vectors are normalized and multiplied by the
* respective spacing before they are set in the matrix.
*/
virtual void InitializeStandardPlane(const Vector3D &rightVector,
const Vector3D &downVector,
const Vector3D *spacing = nullptr);
/**
* \brief Initialize plane by right-/down-vector (vnl) and spacing
* (default: 1.0 mm in all directions).
*
* The length of the right-/-down-vector is used as width/height in units,
* respectively. Then, the vectors are normalized and multiplied by the
* respective spacing before they are set in the matrix.
*/
virtual void InitializeStandardPlane(const VnlVector &rightVector,
const VnlVector &downVector,
const Vector3D *spacing = nullptr);
/**
* \brief Initialize plane by origin and normal (size is 1.0 mm in
* all directions, direction of right-/down-vector valid but
* undefined).
* \warning This function can only produce righthanded coordinate orientation, not lefthanded.
*/
virtual void InitializePlane(const Point3D &origin, const Vector3D &normal);
/**
* \brief Initialize plane by right-/down-vector.
*
* \warning The vectors are set into the matrix as they are,
* \em without normalization!
* This function creates a righthanded IndexToWorldTransform,
* only a negative thickness could still make it lefthanded.
*/
void SetMatrixByVectors(const VnlVector &rightVector, const VnlVector &downVector, ScalarType thickness = 1.0);
/**
* \brief Check if matrix is a rotation matrix:
* - determinant is 1?
* - R*R^T is ID?
* Output warning otherwise.
*/
static bool CheckRotationMatrix(AffineTransform3D *transform, double epsilon=mitk::eps);
/**
* \brief Normal of the plane
*
*/
Vector3D GetNormal() const;
/**
* \brief Normal of the plane as VnlVector
*
*/
VnlVector GetNormalVnl() const;
virtual ScalarType SignedDistance(const Point3D &pt3d_mm) const;
/**
* \brief Calculates, whether a point is below or above the plane. There are two different
*calculation methods, with or without consideration of the bounding box.
*/
virtual bool IsAbove(const Point3D &pt3d_mm, bool considerBoundingBox = false) const;
/**
* \brief Distance of the point from the plane
* (bounding-box \em not considered)
*
*/
ScalarType DistanceFromPlane(const Point3D &pt3d_mm) const;
/**
* \brief Signed distance of the point from the plane
* (bounding-box \em not considered)
*
* > 0 : point is in the direction of the direction vector.
*/
inline ScalarType SignedDistanceFromPlane(const Point3D &pt3d_mm) const
{
ScalarType len = GetNormalVnl().two_norm();
if (len == 0)
return 0;
return (pt3d_mm - GetOrigin()) * GetNormal() / len;
}
/**
* \brief Distance of the plane from another plane
* (bounding-box \em not considered)
*
* Result is 0 if planes are not parallel.
*/
ScalarType DistanceFromPlane(const PlaneGeometry *plane) const { return fabs(SignedDistanceFromPlane(plane)); }
/**
* \brief Signed distance of the plane from another plane
* (bounding-box \em not considered)
*
* Result is 0 if planes are not parallel.
*/
inline ScalarType SignedDistanceFromPlane(const PlaneGeometry *plane) const
{
if (IsParallel(plane))
{
return SignedDistance(plane->GetOrigin());
}
return 0;
}
/**
* \brief Calculate the intersecting line of two planes
*
* \return \a true planes are intersecting
* \return \a false planes do not intersect
*/
bool IntersectionLine(const PlaneGeometry *plane, Line3D &crossline) const;
/**
* \brief Calculate two points where another plane intersects the border of this plane
*
* \return number of intersection points (0..2). First interection point (if existing)
* is returned in \a lineFrom, second in \a lineTo.
*/
unsigned int IntersectWithPlane2D(const PlaneGeometry *plane, Point2D &lineFrom, Point2D &lineTo) const;
/**
* \brief Calculate the angle between two planes
*
* \return angle in radiants
*/
double Angle(const PlaneGeometry *plane) const;
/**
* \brief Calculate the angle between the plane and a line
*
* \return angle in radiants
*/
double Angle(const Line3D &line) const;
/**
* \brief Calculate intersection point between the plane and a line
*
+ * \param line
* \param intersectionPoint intersection point
* \return \a true if \em unique intersection exists, i.e., if line
* is \em not on or parallel to the plane
*/
bool IntersectionPoint(const Line3D &line, Point3D &intersectionPoint) const;
/**
* \brief Calculate line parameter of intersection point between the
* plane and a line
*
+ * \param line
* \param t parameter of line: intersection point is
* line.GetPoint()+t*line.GetDirection()
* \return \a true if \em unique intersection exists, i.e., if line
* is \em not on or parallel to the plane
*/
bool IntersectionPointParam(const Line3D &line, double &t) const;
/**
* \brief Returns whether the plane is parallel to another plane
*
* @return true iff the normal vectors both point to the same or exactly oposit direction
*/
bool IsParallel(const PlaneGeometry *plane) const;
/**
* \brief Returns whether the point is on the plane
* (bounding-box \em not considered)
*/
bool IsOnPlane(const Point3D &point) const;
/**
* \brief Returns whether the line is on the plane
* (bounding-box \em not considered)
*/
bool IsOnPlane(const Line3D &line) const;
/**
* \brief Returns whether the plane is on the plane
* (bounding-box \em not considered)
*
* @return true iff the normal vector of the planes point to the same or the exactly oposit direction and
* the distance of the planes is < eps
*
*/
bool IsOnPlane(const PlaneGeometry *plane) const;
/**
* \brief Returns the lot from the point to the plane
*/
Point3D ProjectPointOntoPlane(const Point3D &pt) const;
itk::LightObject::Pointer InternalClone() const override;
/** Implements operation to re-orient the plane */
void ExecuteOperation(Operation *operation) override;
/**
* \brief Project a 3D point given in mm (\a pt3d_mm) onto the 2D
* geometry. The result is a 2D point in mm (\a pt2d_mm).
*
* The result is a 2D point in mm (\a pt2d_mm) relative to the upper-left
* corner of the geometry. To convert this point into units (e.g., pixels
* in case of an image), use WorldToIndex.
* \return true projection was possible
* \sa Project(const mitk::Point3D &pt3d_mm, mitk::Point3D
* &projectedPt3d_mm)
*/
virtual bool Map(const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const;
/**
* \brief Converts a 2D point given in mm (\a pt2d_mm) relative to the
* upper-left corner of the geometry into the corresponding
* world-coordinate (a 3D point in mm, \a pt3d_mm).
*
* To convert a 2D point given in units (e.g., pixels in case of an
* image) into a 2D point given in mm (as required by this method), use
* IndexToWorld.
*/
virtual void Map(const mitk::Point2D &pt2d_mm, mitk::Point3D &pt3d_mm) const;
/**
* \brief Set the width and height of this 2D-geometry in units by calling
* SetBounds. This does \a not change the extent in mm!
*
* For an image, this is the number of pixels in x-/y-direction.
* \note In contrast to calling SetBounds directly, this does \a not change
* the extent in mm!
*/
virtual void SetSizeInUnits(mitk::ScalarType width, mitk::ScalarType height);
/**
* \brief Project a 3D point given in mm (\a pt3d_mm) onto the 2D
* geometry. The result is a 3D point in mm (\a projectedPt3d_mm).
*
* \return true projection was possible
*/
virtual bool Project(const mitk::Point3D &pt3d_mm, mitk::Point3D &projectedPt3d_mm) const;
/**
* \brief Project a 3D vector given in mm (\a vec3d_mm) onto the 2D
* geometry. The result is a 2D vector in mm (\a vec2d_mm).
*
* The result is a 2D vector in mm (\a vec2d_mm) relative to the
* upper-left
* corner of the geometry. To convert this point into units (e.g., pixels
* in case of an image), use WorldToIndex.
* \return true projection was possible
* \sa Project(const mitk::Vector3D &vec3d_mm, mitk::Vector3D
* &projectedVec3d_mm)
*/
virtual bool Map(const mitk::Point3D &atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector2D &vec2d_mm) const;
/**
* \brief Converts a 2D vector given in mm (\a vec2d_mm) relative to the
* upper-left corner of the geometry into the corresponding
* world-coordinate (a 3D vector in mm, \a vec3d_mm).
*
* To convert a 2D vector given in units (e.g., pixels in case of an
* image) into a 2D vector given in mm (as required by this method), use
* IndexToWorld.
*/
virtual void Map(const mitk::Point2D &atPt2d_mm, const mitk::Vector2D &vec2d_mm, mitk::Vector3D &vec3d_mm) const;
/**
* \brief Project a 3D vector given in mm (\a vec3d_mm) onto the 2D
* geometry. The result is a 3D vector in mm (\a projectedVec3d_mm).
*
* DEPRECATED. Use Project(vector,vector) instead
*
* \return true projection was possible
*/
virtual bool Project(const mitk::Point3D &atPt3d_mm,
const mitk::Vector3D &vec3d_mm,
mitk::Vector3D &projectedVec3d_mm) const;
/**
* \brief Project a 3D vector given in mm (\a vec3d_mm) onto the 2D
* geometry. The result is a 3D vector in mm (\a projectedVec3d_mm).
*
* \return true projection was possible
*/
virtual bool Project(const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const;
/**
* \brief Distance of the point from the geometry
* (bounding-box \em not considered)
*
*/
inline ScalarType Distance(const Point3D &pt3d_mm) const { return fabs(SignedDistance(pt3d_mm)); }
/**
* \brief Set the geometrical frame of reference in which this PlaneGeometry
* is placed.
*
* This would usually be the BaseGeometry of the underlying dataset, but
* setting it is optional.
*/
void SetReferenceGeometry(const mitk::BaseGeometry *geometry);
/**
* \brief Get the geometrical frame of reference for this PlaneGeometry.
*/
const BaseGeometry *GetReferenceGeometry() const;
bool HasReferenceGeometry() const;
static std::vector< int > CalculateDominantAxes(mitk::AffineTransform3D::MatrixType::InternalMatrixType& rotation_matrix);
protected:
PlaneGeometry();
PlaneGeometry(const PlaneGeometry &other);
~PlaneGeometry() override;
void PrintSelf(std::ostream &os, itk::Indent indent) const override;
const mitk::BaseGeometry *m_ReferenceGeometry;
//##Documentation
//## @brief PreSetSpacing
//##
//## These virtual function allows a different beahiour in subclasses.
//## Do implement them in every subclass of BaseGeometry. If not needed, use
//## {Superclass::PreSetSpacing();};
void PreSetSpacing(const mitk::Vector3D &aSpacing) override { Superclass::PreSetSpacing(aSpacing); };
//##Documentation
//## @brief CheckBounds
//##
//## This function is called in SetBounds. Assertions can be implemented in this function (see PlaneGeometry.cpp).
//## If you implement this function in a subclass, make sure, that all classes were your class inherits from
//## have an implementation of CheckBounds
//## (e.g. inheritance BaseGeometry <- A <- B. Implementation of CheckBounds in class B needs implementation in A as
// well!)
void CheckBounds(const BoundsArrayType &bounds) override;
//##Documentation
//## @brief CheckIndexToWorldTransform
//##
//## This function is called in SetIndexToWorldTransform. Assertions can be implemented in this function (see
// PlaneGeometry.cpp).
//## In Subclasses of BaseGeometry, implement own conditions or call Superclass::CheckBounds(bounds);.
void CheckIndexToWorldTransform(mitk::AffineTransform3D *transform) override;
private:
/**
* \brief Compares plane with another plane: \a true if IsOnPlane
* (bounding-box \em not considered)
*/
virtual bool operator==(const PlaneGeometry *) const { return false; };
/**
* \brief Compares plane with another plane: \a false if IsOnPlane
* (bounding-box \em not considered)
*/
virtual bool operator!=(const PlaneGeometry *) const { return false; };
};
} // namespace mitk
#endif /* PLANEGEOMETRY_H_HEADER_INCLUDED_C1C68A2C */
diff --git a/Modules/Core/include/mitkPlaneGeometryDataVtkMapper3D.h b/Modules/Core/include/mitkPlaneGeometryDataVtkMapper3D.h
index 1420e06c0a..fa7ee89fcd 100644
--- a/Modules/Core/include/mitkPlaneGeometryDataVtkMapper3D.h
+++ b/Modules/Core/include/mitkPlaneGeometryDataVtkMapper3D.h
@@ -1,221 +1,215 @@
/*============================================================================
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 MITKGEOMETRY2DDATAVTKMAPPER3D_H_HEADER_INCLUDED_C196C71F
#define MITKGEOMETRY2DDATAVTKMAPPER3D_H_HEADER_INCLUDED_C196C71F
#include "mitkDataStorage.h"
#include "mitkPlaneGeometryDataToSurfaceFilter.h"
#include "mitkVtkMapper.h"
#include "mitkWeakPointer.h"
#include <MitkCoreExports.h>
#include <vtkCleanPolyData.h>
#include <vtkSystemIncludes.h>
class vtkActor;
class vtkPolyDataMapper;
class vtkAssembly;
class vtkFeatureEdges;
class vtkTubeFilter;
class vtkTransformPolyDataFilter;
class vtkHedgeHog;
namespace mitk
{
class PlaneGeometryData;
class BaseRenderer;
class ImageVtkMapper2D;
class DataStorage;
class PlaneGeometryDataVtkMapper3D;
/** \deprecatedSince{2014_10} This class is deprecated. Please use PlaneGeometryDataVTKMapper3D instead. */
DEPRECATED(typedef PlaneGeometryDataVtkMapper3D Geometry2DDataVtkMapper3D);
/**
* \brief Vtk-based mapper to display a PlaneGeometry in a 3D window
* \ingroup Mapper
*
* Uses a PlaneGeometryDataToSurfaceFilter object to create a vtkPolyData representation of a given PlaneGeometry
* instance.
* PlaneGeometry may either contain a common flat plane or a curved plane (ThinPlateSplineCurvedGeometry).
*
* The vtkPolyData object is then decorated by a colored tube on the edges and by image textures if possible
* (currently this requires that there is a 2D render window rendering the same geometry as this mapper).
*
* Properties that influence rendering are:
*
* - \b "draw edges": (Bool) Toggle display of the tubed frame
* - \b "color": (ColorProperty) Color of the tubed frame.
* - \b "xresolution": (FloatProperty) Resolution (=number of tiles) in x direction. Only relevant for
* ThinPlateSplineCurvedGeometry
* - \b "yresolution": (FloatProperty) Resolution (=number of tiles) in y direction. Only relevant for
* ThinPlateSplineCurvedGeometry
* - \b "draw normals 3D": (BoolProperty) If true, a vtkHedgeHog is used to display normals for the generated surface
* object. Useful to distinguish front and back of a plane. Hedgehogs are colored according to "front color" and "back
* color"
* - \b "color two sides": (BoolProperty) If true, front and back side of the plane are colored differently ("front
* color" and "back color")
* - \b "invert normals": (BoolProperty) Inverts front/back for display.
* - \b "front color": (ColorProperty) Color for front side of the plane
* - \b "back color": (ColorProperty) Color for back side of the plane
* - \b "material.representation": (BoolProperty) Choose the representation to draw the mesh in (Surface, Wireframe,
* Point Cloud)
* - \b "surfacegeometry": TODO: Add documentation
* - \b "LookupTable": (LookupTableProperty) Set the lookuptable to render with.
*
* Note: The following properties are set for each image individually, and thus, also influence the rendering of this
* mapper:
*
* - \b "texture interpolation": (BoolProperty) Turn on/off the texture interpolation of each image
* - \b "use color": (BoolProperty) Decide whether we want to use the color property or a lookuptable.
* - \b "binary": (BoolProperty) Binary image handling: Color the value=1.0 with the color property and make the
* background (value=0.0) of the image translucent.
* - \b "layer": (IntProperty) Controls what image is considered "on top" of another. In the case that two should
* inhabit the same space, higher layer occludes lower layer.
* - \b "opacity": (FloatProperty) Set the opacity for each rendered image.
* - \b "color": (FloatProperty) Set the color for each rendered image.
- *
- * The internal filter pipeline which combines a (sometimes deformed) 2D surface
- * with a nice frame and image textures is illustrated in the following sketch:
- *
- * \image html mitkPlaneGeometryDataVtkMapper3D.png "Internal filter pipeline"
- *
*/
class MITKCORE_EXPORT PlaneGeometryDataVtkMapper3D : public VtkMapper
{
public:
mitkClassMacro(PlaneGeometryDataVtkMapper3D, VtkMapper);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**
* Overloaded since the displayed color-frame of the image mustn't be
* transformed after generation of poly data, but before (vertex coordinates
* only)
*/
vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
void UpdateVtkTransform(mitk::BaseRenderer *renderer) override;
/**
* \brief Get the PlaneGeometryData to map
*/
virtual const PlaneGeometryData *GetInput();
/**
* \brief All images found when traversing the (sub-) tree starting at
* \a iterator which are resliced by an ImageVtkMapper2D will be mapped.
* This method is used to set the data storage to traverse. This offers
* the possibility to use this mapper for other data storages (not only
* the default data storage).
*/
virtual void SetDataStorageForTexture(mitk::DataStorage *storage);
protected:
typedef std::multimap<int, vtkActor *> LayerSortedActorList;
PlaneGeometryDataVtkMapper3D();
~PlaneGeometryDataVtkMapper3D() override;
void GenerateDataForRenderer(BaseRenderer *renderer) override;
void ProcessNode(DataNode *node, BaseRenderer *renderer, Surface *surface, LayerSortedActorList &layerSortedActors);
void ImageMapperDeletedCallback(itk::Object *caller, const itk::EventObject &event);
/** \brief general PropAssembly to hold the entire scene */
vtkAssembly *m_Prop3DAssembly;
/** \brief PropAssembly to hold the planes */
vtkAssembly *m_ImageAssembly;
PlaneGeometryDataToSurfaceFilter::Pointer m_SurfaceCreator;
BoundingBox::Pointer m_SurfaceCreatorBoundingBox;
BoundingBox::PointsContainer::Pointer m_SurfaceCreatorPointsContainer;
/** \brief Edge extractor for tube-shaped frame */
vtkFeatureEdges *m_Edges;
/** \brief Filter to apply object transform to the extracted edges */
vtkTransformPolyDataFilter *m_EdgeTransformer;
/** \brief Source to create the tube-shaped frame */
vtkTubeFilter *m_EdgeTuber;
/** \brief Mapper for the tube-shaped frame */
vtkPolyDataMapper *m_EdgeMapper;
/** \brief Actor for the tube-shaped frame */
vtkActor *m_EdgeActor;
/** \brief Mapper for black plane background */
vtkPolyDataMapper *m_BackgroundMapper;
/** \brief Actor for black plane background */
vtkActor *m_BackgroundActor;
/** \brief Transforms the suface before applying the glyph filter */
vtkTransformPolyDataFilter *m_NormalsTransformer;
/** \brief Mapper for normals representation (thin lines) */
vtkPolyDataMapper *m_FrontNormalsMapper;
vtkPolyDataMapper *m_BackNormalsMapper;
/** \brief Generates lines for surface normals */
vtkHedgeHog *m_FrontHedgeHog;
vtkHedgeHog *m_BackHedgeHog;
/** \brief Actor to hold the normals arrows */
vtkActor *m_FrontNormalsActor;
vtkActor *m_BackNormalsActor;
/** Cleans the polyline in order to avoid phantom boundaries */
vtkCleanPolyData *m_Cleaner;
/** Internal flag, if actors for normals are already added to m_Prop3DAssembly*/
bool m_NormalsActorAdded;
/** \brief The DataStorage defines which part of the data tree is traversed for renderering. */
mitk::WeakPointer<mitk::DataStorage> m_DataStorage;
class MITKCORE_EXPORT ActorInfo
{
public:
vtkActor *m_Actor;
// we do not need a smart-pointer, because we delete our
// connection, when the referenced mapper is destroyed
itk::Object *m_Sender;
unsigned long m_ObserverID;
void Initialize(vtkActor *actor, itk::Object *sender, itk::Command *command);
ActorInfo();
~ActorInfo();
};
/** \brief List holding the vtkActor to map the image into 3D for each
* ImageMapper
*/
typedef std::map<ImageVtkMapper2D *, ActorInfo> ActorList;
ActorList m_ImageActors;
// responsiblity to remove the observer upon its destruction
typedef itk::MemberCommand<PlaneGeometryDataVtkMapper3D> MemberCommandType;
MemberCommandType::Pointer m_ImageMapperDeletedCommand;
};
} // namespace mitk
#endif /* MITKGEOMETRY2DDATAVTKMAPPER3D_H_HEADER_INCLUDED_C196C71F */
diff --git a/Modules/Core/include/mitkPointOperation.h b/Modules/Core/include/mitkPointOperation.h
index 49461abe01..446141d852 100755
--- a/Modules/Core/include/mitkPointOperation.h
+++ b/Modules/Core/include/mitkPointOperation.h
@@ -1,86 +1,84 @@
/*============================================================================
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 MITKPOINTOPERATION_H
#define MITKPOINTOPERATION_H
#include "mitkNumericTypes.h"
#include "mitkOperation.h"
#include <MitkCoreExports.h>
namespace mitk
{
- //##Documentation
- //## @brief Operation that handles all actions on one Point.
- //##
- //## Stores everything for Adding, Moving and Deleting a Point.
- //## @ingroup Undo
+ /** @brief Operation that handles all actions on one Point.
+ * Stores everything for Adding, Moving and Deleting a Point.
+ * @ingroup Undo
+ */
class MITKCORE_EXPORT PointOperation : public Operation
{
public:
- //##Documentation
- //##@brief Operation that handles all actions on one Point.
- //##
- //## @param operationType is the type of the operation (see mitkOperation.h; e.g. move or add; Information for
- // StateMachine::ExecuteOperation());
- //## @param point is the information of the point to add or is the information to change a point into
- //## @param index is e.g. the position in a list which describes the element to change
+ /** @brief Operation that handles all actions on one Point.
+ * @param operationType is the type of the operation (see mitkOperation.h; e.g. move or add; Information for StateMachine::ExecuteOperation());
+ * @param point is the information of the point to add or is the information to change a point into
+ * @param index is e.g. the position in a list which describes the element to change
+ * @param selected
+ * @param type
+ */
PointOperation(OperationType operationType,
Point3D point,
int index = -1,
bool selected = true,
PointSpecificationType type = PTUNDEFINED);
- //##Documentation
- //##@brief Operation that handles all actions on one Point.
- //##
- //## @param operationType is the type of the operation (see mitkOperation.h; e.g. move or add; Information for
- // StateMachine::ExecuteOperation());
- //## @param point is the information of the point to add or is the information to change a point into
- //## @param index is e.g. the position in a list which describes the element to change
+ /** @brief Operation that handles all actions on one Point.
+ * @param operationType is the type of the operation (see mitkOperation.h; e.g. move or add; Information for StateMachine::ExecuteOperation());
+ * @param timeInMS
+ * @param point is the information of the point to add or is the information to change a point into
+ * @param index is e.g. the position in a list which describes the element to change
+ * @param selected
+ * @param type
+ */
PointOperation(OperationType operationType,
ScalarType timeInMS,
Point3D point,
int index = -1,
bool selected = true,
PointSpecificationType type = PTUNDEFINED);
~PointOperation() override;
Point3D GetPoint();
int GetIndex();
bool GetSelected();
PointSpecificationType GetPointType();
ScalarType GetTimeInMS() const;
private:
Point3D m_Point;
- //##Documentation
- //##@brief to declare an index where to store the point in data
+ /** @brief to declare an index where to store the point in data */
int m_Index;
// to declare weather the point is selected or deselected
bool m_Selected;
- //##Documentation
- //##@brief to describe the type of the point. See enum PointSpecification for different types
+ /** @brief to describe the type of the point. See enum PointSpecification for different types */
PointSpecificationType m_Type;
ScalarType m_TimeInMS;
};
} // namespace mitk
#endif /* MITKPOINTOPERATION_H*/
diff --git a/Modules/Core/include/mitkPointSet.h b/Modules/Core/include/mitkPointSet.h
index 2d35bc88dd..4a55101604 100755
--- a/Modules/Core/include/mitkPointSet.h
+++ b/Modules/Core/include/mitkPointSet.h
@@ -1,351 +1,348 @@
/*============================================================================
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 MITKPointSet_H_HEADER_INCLUDED
#define MITKPointSet_H_HEADER_INCLUDED
#include "mitkBaseData.h"
#include <itkDefaultDynamicMeshTraits.h>
#include <itkMesh.h>
namespace mitk
{
/**
- * \brief Data structure which stores a set of points. Superclass of
- * mitk::Mesh.
+ * \brief Data structure which stores a set of points.
*
* 3D points are grouped within a point set; for time resolved usage, one point
* set is created and maintained per time step. A point entry consists of the
* point coordinates and point data.
*
* The point data includes a point ID (unique identifier to address this point
* within the point set), the selection state of the point and the type of
* the point.
*
* For further information about different point types see
* mitk::PointSpecificationType in mitkVector.h.
*
* Inserting a point is accompanied by an event, containing an index. The new
* point is inserted into the list at the specified position. At the same time
* an internal ID is generated and stored for the point. Points at specific time
* steps are accessed by specifying the time step number (which defaults to 0).
*
* The points of itk::PointSet stores the points in a pointContainer
* (MapContainer). The points are best accessed by using a ConstIterator (as
* defined in MapContainer); avoid access via index.
*
- * The class internally uses an itk::Mesh for each time step, because
- * mitk::Mesh is derived from mitk::PointSet and needs the itk::Mesh structure
- * which is also derived from itk::PointSet. Thus several typedefs which seem
- * to be in wrong place, are declared here (for example SelectedLinesType).
+ * The class internally uses an itk::Mesh for each time step.
*
* \section mitkPointSetDisplayOptions
*
* The default mappers for this data structure are mitk::PointSetGLMapper2D and
* mitk::PointSetVtkMapper3D. See these classes for display options which can
* can be set via properties.
*
* \section Events
*
* PointSet issues the following events, for which observers can register
* (the below events are grouped into a class hierarchy as indicated by
* identation level; e.g. PointSetSizeChangeEvent comprises PointSetAddEvent
* and PointSetRemoveEvent):
*
* <tt>
* PointSetEvent <i>subsumes all PointSet events</i>
* PointSetMoveEvent <i>issued when a point of the PointSet is moved</i>
* PointSetSizeChangeEvent <i>subsumes add and remove events</i>
* PointSetAddEvent <i>issued when a point is added to the PointSet</i>
* PointSetRemoveEvent <i>issued when a point is removed from the PointSet</i>
* </tt>
* \ingroup PSIO
* \ingroup Data
*/
class MITKCORE_EXPORT PointSet : public BaseData
{
public:
mitkClassMacro(PointSet, BaseData);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
typedef mitk::ScalarType CoordinateType;
typedef mitk::ScalarType InterpolationWeightType;
static const unsigned int PointDimension = 3;
static const unsigned int MaxTopologicalDimension = 3;
/**
* \brief struct for data of a point
*/
struct MITKCORE_EXPORT PointDataType
{
unsigned int id; // to give the point a special ID
bool selected; // information about if the point is selected
mitk::PointSpecificationType pointSpec; // specifies the type of the point
bool operator==(const PointDataType &other) const;
};
/**
* \brief cellDataType, that stores all indexes of the lines, that are
* selected e.g.: points A,B and C.Between A and B there is a line with
* index 0. If vector of cellData contains 1 and 2, then the lines between
* B and C and C and A is selected.
*/
typedef std::vector<unsigned int> SelectedLinesType;
typedef SelectedLinesType::iterator SelectedLinesIter;
struct CellDataType
{
// used to set the whole cell on selected
bool selected;
// indexes of selected lines. 0 is between pointId 0 and 1
SelectedLinesType selectedLines;
// is the polygon already finished and closed
bool closed;
};
typedef itk::DefaultDynamicMeshTraits<PointDataType,
PointDimension,
MaxTopologicalDimension,
CoordinateType,
InterpolationWeightType,
CellDataType>
MeshTraits;
typedef itk::Mesh<PointDataType, PointDimension, MeshTraits> MeshType;
typedef MeshType DataType;
typedef Point3D PointType;
typedef DataType::PointIdentifier PointIdentifier;
typedef DataType::PointsContainer PointsContainer;
typedef DataType::PointsContainerIterator PointsIterator;
typedef DataType::PointsContainer::ConstIterator PointsConstIterator;
typedef DataType::PointDataContainer PointDataContainer;
typedef DataType::PointDataContainerIterator PointDataIterator;
typedef DataType::PointDataContainerIterator PointDataConstIterator;
void Expand(unsigned int timeSteps) override;
/** \brief executes the given Operation */
void ExecuteOperation(Operation *operation) override;
/** \brief returns the current size of the point-list */
virtual int GetSize(unsigned int t = 0) const;
virtual unsigned int GetPointSetSeriesSize() const;
/** \brief returns the pointset */
virtual DataType::Pointer GetPointSet(int t = 0) const;
PointsIterator Begin(int t = 0);
PointsConstIterator Begin(int t = 0) const;
PointsIterator End(int t = 0);
PointsConstIterator End(int t = 0) const;
/**
* \brief Get an iterator to the max ID element if existent. Return End() otherwise.
*/
PointsIterator GetMaxId(int t = 0);
/**
* \brief Get the point with ID id in world coordinates
*
* check if the ID exists. If it doesn't exist, then return 0,0,0
*/
PointType GetPoint(PointIdentifier id, int t = 0) const;
/**
* \brief Get the point with ID id in world coordinates
*
* If a point exists for the ID id, the point is returned in the parameter point
* and the method returns true. If the ID does not exist, the method returns false
*/
bool GetPointIfExists(PointIdentifier id, PointType *point, int t = 0) const;
/**
* \brief Set the given point in world coordinate system into the itkPointSet.
*/
void SetPoint(PointIdentifier id, PointType point, int t = 0);
/**
* \brief Set the given point in world coordinate system with the given PointSpecificationType
*/
void SetPoint(PointIdentifier id, PointType point, PointSpecificationType spec, int t = 0);
/**
* \brief Set the given point in world coordinate system into the itkPointSet.
*/
void InsertPoint(PointIdentifier id, PointType point, int t = 0);
/**
* \brief Set the given point in world coordinate system with given PointSpecificationType
*/
void InsertPoint(PointIdentifier id, PointType point, PointSpecificationType spec, int t);
/**
* \brief Insert the given point in world coordinate system with incremented max id at time step t.
*/
PointIdentifier InsertPoint(PointType point, int t = 0);
/**
* \brief Remove point with given id at timestep t, if existent
*/
bool RemovePointIfExists(PointIdentifier id, int t = 0);
/**
* \brief Remove max id point at timestep t and return iterator to precedent point
*/
PointsIterator RemovePointAtEnd(int t = 0);
/**
* \brief Swap a point at the given position (id) with the upper point (moveUpwards=true) or with the lower point
* (moveUpwards=false).
* If upper or lower index does not exist false is returned, if swap was successful true.
*/
bool SwapPointPosition(PointIdentifier id, bool moveUpwards, int t = 0);
/**
* \brief searches a selected point and returns the id of that point.
* If no point is found, then -1 is returned
*/
virtual int SearchSelectedPoint(int t = 0) const;
/** \brief returns true if a point exists at this position */
virtual bool IndexExists(int position, int t = 0) const;
/** \brief to get the state selected/unselected of the point on the
* position
*/
virtual bool GetSelectInfo(int position, int t = 0) const;
virtual void SetSelectInfo(int position, bool selected, int t = 0);
/** \brief to get the type of the point at the position and the moment */
virtual PointSpecificationType GetSpecificationTypeInfo(int position, int t) const;
/** \brief returns the number of selected points */
virtual int GetNumberOfSelected(int t = 0) const;
/**
* \brief searches a point in the list == point +/- distance
*
* \param point is in world coordinates.
* \param distance is in mm.
+ * \param t
* returns -1 if no point is found
* or the position in the list of the first match
*/
int SearchPoint(Point3D point, ScalarType distance, int t = 0) const;
bool IsEmptyTimeStep(unsigned int t) const override;
// virtual methods, that need to be implemented
void UpdateOutputInformation() override;
void SetRequestedRegionToLargestPossibleRegion() override;
bool RequestedRegionIsOutsideOfTheBufferedRegion() override;
bool VerifyRequestedRegion() override;
void SetRequestedRegion(const itk::DataObject *data) override;
// Method for subclasses
virtual void OnPointSetChange(){};
protected:
mitkCloneMacro(Self);
PointSet();
PointSet(const PointSet &other);
~PointSet() override;
void PrintSelf(std::ostream &os, itk::Indent indent) const override; ///< print content of the object to os
void ClearData() override;
void InitializeEmpty() override;
/** \brief swaps point coordinates and point data of the points with identifiers id1 and id2 */
bool SwapPointContents(PointIdentifier id1, PointIdentifier id2, int t = 0);
typedef std::vector<DataType::Pointer> PointSetSeries;
PointSetSeries m_PointSetSeries;
DataType::PointsContainer::Pointer m_EmptyPointsContainer;
/**
* @brief flag to indicate the right time to call SetBounds
**/
bool m_CalculateBoundingBox;
};
/**
* @brief Equal A function comparing two pointsets for beeing identical.
* @warning This method is deprecated and will not be available in the future. Use the \a bool mitk::Equal(const
* mitk::PointSet& p1, const mitk::PointSet& p2) instead.
*
* @ingroup MITKTestingAPI
*
* The function compares the Geometry, the size and all points element-wise.
* The parameter eps is a tolarence value for all methods which are internally used for comparion.
*
* @param rightHandSide Compare this against leftHandSide.
* @param leftHandSide Compare this against rightHandSide.
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @param checkGeometry if comparing point sets loaded from a file, the geometries might be different and must not be
* compared. In all other cases, you should compare the geometries.
* @return True, if all subsequent comparisons are true, false otherwise
*/
DEPRECATED(MITKCORE_EXPORT bool Equal(const mitk::PointSet *leftHandSide,
const mitk::PointSet *rightHandSide,
mitk::ScalarType eps,
bool verbose,
bool checkGeometry = true));
/**
* @brief Equal A function comparing two pointsets for beeing identical.
*
* @ingroup MITKTestingAPI
*
* The function compares the Geometry, the size and all points element-wise.
* The parameter eps is a tolarence value for all methods which are internally used for comparion.
*
* @param rightHandSide Compare this against leftHandSide.
* @param leftHandSide Compare this against rightHandSide.
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @param checkGeometry if comparing point sets loaded from a file, the geometries might be different and must not be
* compared. In all other cases, you should compare the geometries.
* @return True, if all subsequent comparisons are true, false otherwise
*/
MITKCORE_EXPORT bool Equal(const mitk::PointSet &leftHandSide,
const mitk::PointSet &rightHandSide,
mitk::ScalarType eps,
bool verbose,
bool checkGeometry = true);
itkEventMacro(PointSetEvent, itk::AnyEvent);
itkEventMacro(PointSetMoveEvent, PointSetEvent);
itkEventMacro(PointSetSizeChangeEvent, PointSetEvent);
itkEventMacro(PointSetAddEvent, PointSetSizeChangeEvent);
itkEventMacro(PointSetRemoveEvent, PointSetSizeChangeEvent);
itkEventMacro(PointSetExtendTimeRangeEvent, PointSetEvent);
} // namespace mitk
#endif /* MITKPointSet_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkPointSetDataInteractor.h b/Modules/Core/include/mitkPointSetDataInteractor.h
index baaabb77c6..98e156d2b2 100644
--- a/Modules/Core/include/mitkPointSetDataInteractor.h
+++ b/Modules/Core/include/mitkPointSetDataInteractor.h
@@ -1,186 +1,186 @@
/*============================================================================
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 mitkPointSetDataInteractor_h_
#define mitkPointSetDataInteractor_h_
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkSmartPointer.h"
#include "mitkCommon.h"
#include "mitkDataInteractor.h"
#include <MitkCoreExports.h>
#include <mitkPointSet.h>
namespace mitk
{
/**
* Class PointSetDataInteractor
* \brief Implementation of the PointSetInteractor
*
* Interactor operates on a point set and supports to:
* - add points
* - remove points
* - move single points
* - move complete pointset
* - select/unselect a point
*
* in 2d and 3d render windows.
*
- * \warn If this Interactor is assigned (SetDataNode) an empty mitk::DataNode it creates a point set,
+ * \warning If this Interactor is assigned (SetDataNode) an empty mitk::DataNode it creates a point set,
* changing the point set of the assigned mitk::DataNode after this assignment will cause the
mitk::PointSetDataInteractor
* to not work properly. So the usage has follow this general scheme:
*
* \code
// Set up interactor
m_CurrentInteractor = mitk::PointSetDataInteractor::New();
m_CurrentInteractor->LoadStateMachine("PointSet.xml");
m_CurrentInteractor->SetEventConfig("PointSetConfig.xml");
//Create new PointSet which will receive the interaction input
m_TestPointSet = mitk::PointSet::New();
// Add the point set to the mitk::DataNode *before* the DataNode is added to the mitk::PointSetDataInteractor
m_TestPointSetNode->SetData(m_TestPointSet);
// finally add the mitk::DataNode (which already is added to the mitk::DataStorage) to the
mitk::PointSetDataInteractor
m_CurrentInteractor->SetDataNode(m_TestPointSetNode);
\endcode
*
*
*/
// Inherit from DataInteratcor, this provides functionality of a state machine and configurable inputs.
class MITKCORE_EXPORT PointSetDataInteractor : public DataInteractor
{
public:
mitkClassMacro(PointSetDataInteractor, DataInteractor);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**
* Sets the maximum distance that is accepted when looking for a point at a certain position using the
* GetPointIndexByPosition function.
*/
void SetAccuracy(float accuracy);
/**
* @brief SetMaxPoints Sets the maximal number of points for the pointset
* Default ist zero, which result in infinite number of allowed points
* @param maxNumber
*/
void SetMaxPoints(unsigned int maxNumber = 0);
protected:
PointSetDataInteractor();
~PointSetDataInteractor() override;
/**
* Here actions strings from the loaded state machine pattern are mapped to functions of
* the DataInteractor. These functions are called when an action from the state machine pattern is executed.
*/
void ConnectActionsAndFunctions() override;
/**
* This function is called when a DataNode has been set/changed.
* It is used to initialize the DataNode, e.g. if no PointSet exists yet it is created
* and added to the DataNode.
*/
void DataNodeChanged() override;
/**
* \brief Return index in PointSet of the point that is within given accuracy to the provided position.
*
* Assumes that the DataNode contains a PointSet, if so it iterates over all points
* in the DataNode to check if it contains a point near the pointer position.
* If a point is found its index-position is returned, else -1 is returned.
*/
virtual int GetPointIndexByPosition(Point3D position, unsigned int time = 0, float accuracy = -1);
virtual bool CheckSelection(const InteractionEvent *interactionEvent);
/** Adds a point at the given coordinates.
* Every time a point is added it is also checked if the maximal number of points is reached,
* and if so an InternalEvent with the signal name "MaxNumberOfPoints" is triggered.
*/
virtual void AddPoint(StateMachineAction *, InteractionEvent *event);
/** Removes point that is selected */
virtual void RemovePoint(StateMachineAction *, InteractionEvent *interactionEvent);
/**
* Checks if new point is close enough to an old one,
* if so, trigger the ClosedContour signal which can be caught by the state machine.
*/
virtual void IsClosedContour(StateMachineAction *, InteractionEvent *);
/**
* Moves the currently selected point to the new coodinates.
*/
virtual void MovePoint(StateMachineAction *, InteractionEvent *);
/**
* Initializes the movement, stores starting position.
*/
virtual void InitMove(StateMachineAction *, InteractionEvent *interactionEvent);
/**
* Is called when a movement is finished, changes back to regular color.
*/
virtual void FinishMove(StateMachineAction *, InteractionEvent *);
/**
* Selects a point from the PointSet as currently active.
*/
virtual void SelectPoint(StateMachineAction *, InteractionEvent *);
/**
* Unselects a point at the given coordinate.
*/
virtual void UnSelectPointAtPosition(StateMachineAction *, InteractionEvent *);
/**
* Unselects all points out of reach.
*/
virtual void UnSelectAll(StateMachineAction *, InteractionEvent *);
/**
* @brief UpdatePointSet Updates the member variable that holds the point set, evaluating the time step of the
* sender.
*/
virtual void UpdatePointSet(StateMachineAction *stateMachineAction, InteractionEvent *);
/**
* Calls for inactivation of the DataInteractor
*/
virtual void Abort(StateMachineAction *, InteractionEvent *);
/** \brief to calculate a direction vector from last point and actual
* point
*/
Point3D m_LastPoint;
/** \brief summ-vector for Movement */
Vector3D m_SumVec;
// DATA
PointSet::Pointer m_PointSet;
int m_MaxNumberOfPoints; // maximum of allowed number of points
float m_SelectionAccuracy; // accuracy that's needed to select a point
// FUNCTIONS
void UnselectAll(unsigned int timeStep, ScalarType timeInMs);
void SelectPoint(int position, unsigned int timeStep, ScalarType timeInMS);
};
}
#endif
diff --git a/Modules/Core/include/mitkPointSetToPointSetFilter.h b/Modules/Core/include/mitkPointSetToPointSetFilter.h
index 1c847c0962..ece8df396c 100644
--- a/Modules/Core/include/mitkPointSetToPointSetFilter.h
+++ b/Modules/Core/include/mitkPointSetToPointSetFilter.h
@@ -1,84 +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 _mitkpointsettopointsetfilter_h
#define _mitkpointsettopointsetfilter_h
#include "mitkPointSetSource.h"
#include <MitkCoreExports.h>
namespace mitk
{
/**
* @brief Superclass of all classes/algorithms having one or more PointSets
* as input and output
* @ingroup Process
*/
class MITKCORE_EXPORT PointSetToPointSetFilter : public PointSetSource
{
public:
mitkClassMacro(PointSetToPointSetFilter, PointSetSource);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
typedef mitk::PointSet InputType;
typedef mitk::PointSet OutputType;
typedef InputType::Pointer InputTypePointer;
typedef InputType::ConstPointer InputTypeConstPointer;
using itk::ProcessObject::SetInput;
/**
* Sets the input of this process object
* @param input the input
*/
virtual void SetInput(const InputType *input);
/**
* Sets the input n'th of this process object
* @param idx the number associated with the given input
+ * @param input
*/
virtual void SetInput(const unsigned int &idx, const InputType *input);
/**
* @returns the input tree of the process object
*/
const InputType *GetInput(void);
/**
* @param idx the index of the input to return
* @returns the input object with the given index
*/
const InputType *GetInput(const unsigned int &idx);
protected:
/**
* A default constructor
*/
PointSetToPointSetFilter();
/**
* The destructor
*/
~PointSetToPointSetFilter() override;
private:
void operator=(const Self &); // purposely not implemented
};
} // end of namespace mitk
#endif
diff --git a/Modules/Core/include/mitkProgressBar.h b/Modules/Core/include/mitkProgressBar.h
index f635a861b6..fbcd793c85 100644
--- a/Modules/Core/include/mitkProgressBar.h
+++ b/Modules/Core/include/mitkProgressBar.h
@@ -1,79 +1,79 @@
/*============================================================================
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 MITKPROGRESSBAR_H
#define MITKPROGRESSBAR_H
#include <MitkCoreExports.h>
#include <itkObject.h>
namespace mitk
{
class ProgressBarImplementation;
//##Documentation
//## @brief Sending a message to the applications ProgressBar
//##
//## Holds a GUI dependent ProgressBarImplementation and sends the progress further.
//## All mitk-classes use this class to display progress on GUI-ProgressBar.
//## The mainapplication has to set the internal held ProgressBarImplementation with SetImplementationInstance(..).
//## @ingroup Interaction
class MITKCORE_EXPORT ProgressBar : public itk::Object
{
public:
itkTypeMacro(ProgressBar, itk::Object);
//##Documentation
//## @brief static method to get the GUI dependent ProgressBar-instance
//## so the methods for steps to do and progress can be called
//## No reference counting, cause of decentral static use!
static ProgressBar *GetInstance();
//##Documentation
//## @brief Supply a GUI- dependent ProgressBar. Has to be set by the application
//## to connect the application dependent subclass of mitkProgressBar
void RegisterImplementationInstance(ProgressBarImplementation *implementation);
void UnregisterImplementationInstance(ProgressBarImplementation *implementation);
//##Documentation
//## @brief Adds steps to totalSteps.
void AddStepsToDo(unsigned int steps);
//##Documentation
//## @brief Explicitly reset progress bar.
void Reset();
//##Documentation
//## @brief Sets the current amount of progress to current progress + steps.
- //## @param: steps the number of steps done since last Progress(int steps) call.
+ //## @param steps the number of steps done since last Progress(int steps) call.
void Progress(unsigned int steps = 1);
//##Documentation
//## @brief Sets whether the current progress value is displayed.
void SetPercentageVisible(bool visible);
protected:
typedef std::vector<ProgressBarImplementation *> ProgressBarImplementationsList;
typedef ProgressBarImplementationsList::iterator ProgressBarImplementationsListIterator;
ProgressBar();
~ProgressBar() override;
ProgressBarImplementationsList m_Implementations;
static ProgressBar *m_Instance;
};
} // end namespace mitk
#endif /* define MITKPROGRESSBAR_H */
diff --git a/Modules/Core/include/mitkPropertyRelationRuleBase.h b/Modules/Core/include/mitkPropertyRelationRuleBase.h
index 87cd98e69f..2ea5eadefa 100644
--- a/Modules/Core/include/mitkPropertyRelationRuleBase.h
+++ b/Modules/Core/include/mitkPropertyRelationRuleBase.h
@@ -1,392 +1,403 @@
/*============================================================================
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 mitkPropertyRelationRuleBase_h
#define mitkPropertyRelationRuleBase_h
#include "mitkIPropertyOwner.h"
#include "mitkIdentifiable.h"
#include "mitkException.h"
#include "mitkNodePredicateBase.h"
#include "mitkPropertyKeyPath.h"
#include <MitkCoreExports.h>
#include <string>
namespace mitk
{
/**Base class to standardize/abstract/encapsulate rules and business logic to detect and define
(property/data based) relations in MITK.
Following important definitions must be regarded when using/implementing/specifing rule classes:
- Releations represented by rules are directed relations that point from a source IPropertyOwner (Source)
to a destination IPropertyOwner (Destination).
- Rule can be abstract (indicated by IsAbstract()) or concrete. Abstract rules cannot be used to connect relations.
Abstract rules can only be used to detect/indicate or disconnect relations. Therefore, in contrast to concrete rules,
abstract rules can be used to indicate several relations that are established be "derived" rules. See e.g. GenericIDRelationRule:
in its abstract state it cannot connect but be used to detect any type of generic ID relation.
- A concrete rule ID (rule ID of a concrete rule) always "implements" a concrete relation type. E.g. In DICOM the
way to express the source image relation to an input image and to a mask would be nearly the same
and only differs by the encoded purpose. One may implement an interim or joined class that manages the mutual
stuff, but the registered instances must be one concrete rule for "DICOM source input image" and one concrete rule for
"DICOM source mask" and both rules must have distinct rule IDs.
- Source may have several relations of a rule to different Destinations.
Destination may have several relations of a rule from different Sources. But a specific source destination
pair may have only one relation of a specific rule id (concrete rule). A specific source destination
pair may however have multiple relations for an abstract rule.
- The deletion of a Destination in the storage does not remove the relation implicitly. It becomes a "zombie" relation
but it should still be documented, even if the destination is unknown. One has to explicitly
disconnect a zombie relation to get rid of it.
- Each relation has its own UID (relationUID) that can be used to address it.
The basic concept of the rule design is that we have two layers of relation identification: Layer 1 is the ID-layer
which uses the IIdentifiable interface and UIDs if available to encode "hard" relations. Layer 2 is the Data-layer
which uses the properties of Source and Destination to deduce if there is a relation of the rule type.
The ID-layer is completely implemented by this base class. The base class falls back to the Data-layer
(implemented by the concrete rule class) if the ID-layer is not sufficient or it is explicitly stated to (only)
look at the data layer.
Reasons for the introduction of the ID-layer are: 1st, data-defined relations may be weak (several Destinations are
possible; e.g. DICOM source images may point to several loaded mitk images). But if explicitly a relation was
connected it should be deduceable. 2nd, checks on a UID are faster then unnecessary data deduction.
Rules use relation instance identifing (RII) properties in order to manage their relations that are stored in the
Source. The RII-properties follow the following naming schema:
- "MITK.Relations.<InstanceID>.[relationUID|destinationUID|ruleID|<data-layer-specific>]"
- - <InstanceID>: The unique index of the relation for the Source. Used to assign/group the properties to
+ "MITK.Relations.\<InstanceID\>.[relationUID|destinationUID|ruleID|\<data-layer-specific\>]"
+ - \<InstanceID\>: The unique index of the relation for the Source. Used to assign/group the properties to
their relation. In the default implementation of this class the instance id is an positive integer (i>0).
- relationUID: The UID of the relation. Set by the ID-layer (so by this class)
- destinationUID: The UID of the Destination. Set by the ID-layer (so by this class) if Destination implements
IIdentifiable.
- ruleID: The identifier of the concrete rule that sets the property. Is specified by the derived class and set
automaticaly be this base class.
- <data-layer-specific>: Information needed by the Data-layer (so derived classes) to find the relationUID
*/
class MITKCORE_EXPORT PropertyRelationRuleBase : public itk::Object
{
public:
mitkClassMacroItkParent(PropertyRelationRuleBase, itk::Object);
itkCloneMacro(Self);
itkCreateAnotherMacro(Self);
using RuleIDType = std::string;
using RelationUIDType = Identifiable::UIDType;
using RelationUIDVectorType = std::vector<RelationUIDType>;
/** Enum class for different types of relations. */
enum class RelationType
{
None = 0, /**< Two IPropertyOwner have no relation under the rule.*/
Data = 1, /**< Two IPropertyOwner have a relation, but it is "only" deduced from the Data-layer (so a bit
"weaker" as ID). Reasons for the missing ID connection could be that Destintination has not
IIdentifiable implemented.*/
ID = 2, /**< Two IPropertyOwner have a relation and are explictly connected via the ID of IIdentifiable of the Destination.*/
Complete = 3 /**< Two IPropertyOwner have a relation and are fully explictly connected (via data layer and ID layer).*/
};
using RelationVectorType = std::vector<RelationType>;
/** Returns the generic root path for relation rules ("MITK.Relations").*/
static PropertyKeyPath GetRootKeyPath();
using InstanceIDType = std::string;
/** Returns the property key path for a RII property.
- * @param propName If not empty a PropertyPath element will added (with the passed value) after the <InstanceID> element.
+ * @param propName If not empty a PropertyPath element will added (with the passed value) after the \<InstanceID\> element.
* @param instanceID If not empty, the PropertyKeyPath is only for a specific instance. If empty,
* it is wildcarded and will match RIIs property of any instance.*/
static PropertyKeyPath GetRIIPropertyKeyPath(const std::string propName, const InstanceIDType& instanceID);
/** Returns the property key path for RII RelationUID properties.
* @param instanceID If not empty, the PropertyKeyPath is only for a specific instance. If empty,
* it is wildcarded and will match RII RelationUIDs property of any instance.*/
static PropertyKeyPath GetRIIRelationUIDPropertyKeyPath(const InstanceIDType& instanceID = "");
/** Returns the property key path for RII RuleID properties.
* @param instanceID If not empty, the PropertyKeyPath is only for a specific instance. If empty,
* it is wildcarded and will match RII RuleIDs property of any instance.*/
static PropertyKeyPath GetRIIRuleIDPropertyKeyPath(const InstanceIDType& instanceID = "");
/** Returns the property key path for RII DestinationUID properties.
* @param instanceID If not empty, the PropertyKeyPath is only for a specific instance. If empty,
* it is wildcarded and will match RII DestinationUIDs property of any instance.*/
static PropertyKeyPath GetRIIDestinationUIDPropertyKeyPath(const InstanceIDType& instanceID = "");
/** Returns an ID string that identifies the rule class.
@post The returned rule ID must met the preconditions of a PropertyKeyPath element name
(see mitk::PropertyKeyPath*/
virtual RuleIDType GetRuleID() const = 0;
/** Returns a human readable string that can be used to describe the rule. Does not need to be unique.*/
virtual std::string GetDisplayName() const = 0;
/** Returns a human readable string that can be used to describe the role of a source in context of the rule
* instance.*/
virtual std::string GetSourceRoleName() const = 0;
/** Returns a human readable string that can be used to describe the role of a destionation in context of the rule
* instance.*/
virtual std::string GetDestinationRoleName() const = 0;
/** Returns if the instance is a abstract rule (true). Default implementation is true. Overwrite and reimplement
if another behavior is needed.*/
virtual bool IsAbstract() const;
/** This method checks if owner is eligible to be a Source for the rule. The default implementation returns a
True for every valid IPropertyProvider (so only a null_ptr results into false). May be reimplement by derived rules if
they have requirements on potential Sources).*/
virtual bool IsSourceCandidate(const IPropertyProvider *owner) const;
/** This method checks if owner is eligible to be a Destination for the rule. The default implementation returns a
True for every valid IPropertyProvider (so only a null_ptr results into false). May be reimplement by derived rules if
they have requirements on potential Sources).*/
virtual bool IsDestinationCandidate(const IPropertyProvider *owner) const;
/** Returns true if the passed owner is a Source of a relation defined by the rule.
@pre owner must be a pointer to a valid IPropertyProvider instance.*/
bool IsSource(const IPropertyProvider *owner) const;
/** Returns all relation types of the passed IPropertyOwner instances.
@remark Abstract rules may have several relationtypes between the instances (from different supported concrete rules), that cover
both ID and Data relations; thus it returns a vector of RelationTypes.
@result Vector of all relation types that exist between the given instances. Empty vector equals none relation at all.
@pre source must be a pointer to a valid IPropertyProvider instance.
@pre destination must be a pointer to a valid IPropertyProvider instance.
*/
RelationVectorType GetRelationTypes(const IPropertyProvider* source, const IPropertyProvider* destination) const;
/** Indicates if passed IPropertyOwner instances have a relation of a certain type.
@remark Abstract rules may also indicate RelationType::Complete if there
are multiple relations (from different supported concrete rules), that cover
both ID and Data relations.
+ @param source
+ @param destination
@param requiredRelation Defines the type of relation that should be present. None: does not matter which one, as long as at least one is present.
Data: Only data layer exclusive connections, ID: Only ID layer exclusive connections. Complete: Only relations that are connected on both layers.
@pre source must be a pointer to a valid IPropertyProvider instance.
@pre destination must be a pointer to a valid IPropertyProvider instance.
*/
bool HasRelation(const IPropertyProvider *source, const IPropertyProvider *destination, RelationType requiredRelation = RelationType::None) const;
/** Returns a vector of relation UIDs for all relations of this rule instance that are defined for
the passed source.
@pre source must be a pointer to a valid IPropertyOwner instance.
+ @param source
@param layer Defines the layer the relations must be reflected. None: does not matter which one, as long as at least one is present.
Data: Only data layer exclusive connections, ID: Only ID layer exclusive connections. Complete: Only relations that are connected on both layers.*/
RelationUIDVectorType GetExistingRelations(const IPropertyProvider *source, RelationType layer = RelationType::None) const;
/** Returns the relation UID(s) for the passed source and destination of this rule instance.
If the rule is abstract multiple relation UIDs might be returned. In case of concrete rule only
one relation UID.
@pre source must be a pointer to a valid IPropertyOwner instance.
@pre destination must be a pointer to a valid IPropertyOwner instance.*/
RelationUIDVectorType GetRelationUIDs(const IPropertyProvider *source, const IPropertyProvider *destination) const;
/** Returns the relation UID for the passed source and destination of this rule instance.
If the passed instances have no relation, no ID can be deduced and an exception will be thrown.
If more than one relation is found, also an exception will be thrown. Thus only use this convenience method,
if you are sure that one(!) relation UID can exist.
@pre source must be a pointer to a valid IPropertyOwner instance.
@pre destination must be a pointer to a valid IPropertyOwner instance.
@pre Source and destination have one relation; otherwise
if no relation exists a NoPropertyRelationException is thrown; if more than one relation exists
a default MITK expception is thrown.*/
RelationUIDType GetRelationUID(const IPropertyProvider *source, const IPropertyProvider *destination) const;
/**Predicate that can be used to find nodes that qualify as source for that rule (but must not be a source yet).
Thus all nodes where IsSourceCandidate() returns true. */
NodePredicateBase::ConstPointer GetSourceCandidateIndicator() const;
/**Predicate that can be used to find nodes that qualify as destination for that rule (but must not be a destination
yet). Thus all nodes where IsDestinationCandidate() returns true. */
NodePredicateBase::ConstPointer GetDestinationCandidateIndicator() const;
/**Predicate that can be used to find nodes that are Sources of that rule and connected.
Thus all nodes where IsSource() returns true.*/
NodePredicateBase::ConstPointer GetConnectedSourcesDetector() const;
/**Predicate that can be used to find nodes that are as source related to the passed Destination under the rule
@param destination Pointer to the Destination instance that should be used for detection.
@param exclusiveRelation Defines if only special types of relations should detected. None: All relations (default);
Data: must be a data relation (so Data or Complete); ID: must be an ID relation (so ID or Complete); Complete: only complete relations.
@pre Destination must be a valid instance.*/
NodePredicateBase::ConstPointer GetSourcesDetector(
const IPropertyProvider *destination, RelationType exclusiveRelation = RelationType::None) const;
/**Predicate that can be used to find nodes that are as Destination related to the passed Source under the rule
@param source Pointer to the Source instance that should be used for detection.
@param exclusiveRelation Defines if only special types of relations should detected. None: All relations (default);
Data: must be a data relation (so Data or Complete); ID: must be an ID relation (so ID or Complete); Complete: only complete relations.
@pre Source must be a valid instance.*/
NodePredicateBase::ConstPointer GetDestinationsDetector(
const IPropertyProvider *source, RelationType exclusiveRelation = RelationType::None) const;
/**Returns a predicate that can be used to find the Destination of the passed Source for a given relationUID.
@param source Pointer to the Source instance that should be used for detection.
+ @param relationUID
@pre source must be a valid instance.
@pre relationUID must identify a relation of the passed source and rule. (This must be in the return of
this->GetExistingRelations(source). */
NodePredicateBase::ConstPointer GetDestinationDetector(const IPropertyProvider *source,
RelationUIDType relationUID) const;
/**Disconnect the passed instances by modifing source. One can specify which layer should be disconnected
via the argument "layer". Default is the complete disconnection.
All RII-properties or properties that define the connection on the data layer in the source
for the passed destination will be removed.
@pre source must be a valid instance.
@pre destination must be a valid instance.
+ @param source
+ @param destination
@param layer Defines the way of disconnection. Data: Only the remove the connection on the data layer. ID: Only remove the connection
on the ID layer. Complete: Remove the connection on all layers. If a connection does not exist on a selected layer, it is silently ignored.*/
void Disconnect(IPropertyOwner *source, const IPropertyProvider *destination, RelationType layer = RelationType::Complete) const;
/**Disconnect the source from the passed relationUID (usefull for "zombie relations").
One can specify which layer should be disconnected
via the argument "layer". Default is the complete disconnection.
All RII-properties or properties that define the connection on the data layer in the source
for the passed destination will be removed.
If the relationUID is not part of the source. Nothing will be changed.
@pre source must be a valid instance.
+ @param source
+ @param relationUID
@param layer Defines the way of disconnection. Data: Only the remove the connection on the data layer. ID: Only remove the connection
on the ID layer. Complete: Remove the connection on all layers. If a connection does not exist on a selected layer, it is silently ignored.*/
void Disconnect(IPropertyOwner *source, RelationUIDType relationUID, RelationType layer = RelationType::Complete) const;
/**Returns the list of PropertyKeyPaths of all properties that are relevant for a given relation.
@param source Pointer to the Source instance that containes the potential properties.
@param relationUID UID of the relation that is relevant for the requested properties.
@param layer Indicates which layer is requested. ID: returns all RII properties that belong to the relation. Data: returns all properties that are relevant/belong to the data layer of the relation. Complete: returns all properties (ID+Data)
@pre source must be a valid instance.
@pre relationUID must identify a relation of the passed source and rule. (This must be in the return of
this->GetExistingRelations(source). */
std::vector<PropertyKeyPath> GetReleationPropertyPaths(const IPropertyProvider* source,
RelationUIDType relationUID, RelationType layer = RelationType::Data) const;
protected:
PropertyRelationRuleBase() = default;
~PropertyRelationRuleBase() override = default;
using InstanceIDVectorType = std::vector<InstanceIDType>;
static InstanceIDType NULL_INSTANCE_ID();
/** Returns the instance IDs for the passed source and destination for this rule instance.
If the passed source and destination instances has no explicit relation on the ID layer (Connected_ID),
an empty vector will be returned.
@remark Per definition of property relation rules only 0 or 1 instance should be found for one provider
pair and concrete rule. But there might be more then one instanceID because either 1) the rule is abstract and
supports multiple rule IDs or 2) the data layer may be ambiguous and therefore multiple relation instances of the rule instance
could match. The implementation of this function should report all relation instances. The calling function
will take care.
@pre source must be a pointer to a valid IPropertyProvider instance.
@pre destination must be a pointer to a valid IPropertyProvider instance.*/
InstanceIDVectorType GetInstanceID_IDLayer(const IPropertyProvider *source,
const IPropertyProvider *destination) const;
using DataRelationUIDVectorType = std::vector< std::pair<RelationUIDType, RuleIDType> >;
/** Returns the ReleationUIDs of all relations that are defined by the data layer of source for
this rule instance and, if defined, destination.
If the passed source (and destination) instance has no relation on the data layer,
an empty vector will be returned.
@remark Per definition for property relation rules only 0 or 1 instance should be found for one provider
pair and concrete rule. But there might be more then one instance because either 1) the rule is abstract and
supports multiple rule IDs or 2) the data layer may be ambiguous (e.g. because the destination was not specified)
and therefore multiple relation instances of the rule instance could match.
The implementation of this function should report all relation instances. The calling function
will take care.
- @pre source must be a pointer to a valid IPropertyProvider instance.
+ @param source
@param destination Destination the find relations should point to. If destination is NULL any relation
on the data layer for this rule and source are wanted.
@param instances_IDLayer List of releation instances that are already defined by the ID layer. The implementation of this
- function should only cover releations that are not already resembled in the passed relarions_IDLayer.*/
+ function should only cover releations that are not already resembled in the passed relarions_IDLayer.
+ @pre source must be a pointer to a valid IPropertyProvider instance.*/
virtual DataRelationUIDVectorType GetRelationUIDs_DataLayer(const IPropertyProvider * source,
const IPropertyProvider * destination, const InstanceIDVectorType& instances_IDLayer) const = 0;
/**Helper function that deduces the relation UID of the given relation instance.
If it cannot be deduced an NoPropertyRelationException is thrown.*/
RelationUIDType GetRelationUIDByInstanceID(const IPropertyProvider *source, const InstanceIDType &instanceID) const;
/**Helper function that deduces the relation instance ID given the relation UID.
If it cannot be deduced an NoPropertyRelationException is thrown.*/
InstanceIDType GetInstanceIDByRelationUID(const IPropertyProvider *source,
const RelationUIDType &relationUID) const;
/**Explicitly connects the passed instances. Afterwards they have a relation of Data (if data layer is supported), ID (if a
destination implements IIdentifiable) or Complete (if Data and ID could be connected). If the passed instance are already
connected the old connection will be overwritten (and raised to the highest possible connection level).
@remark This method has protected visibility in the base implementation, because it is a design decision of derived rule classes
which interface they want to offer for connecting. It may just be made public (e.g. GenericIDRelationRule) or used by own implementations.
@pre source must be a valid instance.
@pre destination must be a valid instance.
@pre the rule instance must not be abstract.
@return Return the relation uid of the relation connected by this method call*/
RelationUIDType Connect(IPropertyOwner *source, const IPropertyProvider *destination) const;
/**Is called by Connect() to ensure that source has correctly set properties to resemble
the relation on the data layer. This means that the method should set the properties that describe
and encode the relation on the data layer (data-layer-specific relation properties).
If the passed instance are already connected, the old settings should be
overwritten. Connect() will ensure that source and destination are valid pointers.
+ @param source
+ @param destination
@param instanceID is the ID for the relation instance that should be connected. Existance of the relation instance
is ensured.
@pre source must be a valid instance.
@pre destination must be a valid instance.*/
virtual void Connect_datalayer(IPropertyOwner *source,
const IPropertyProvider *destination,
const InstanceIDType &instanceID) const = 0;
/**This method is called by Disconnect() to remove all properties of the relation from the source that
are set by Connect_datalayer().
@remark This method should remove all properties that are set for a specific relation by Connect_datalayer(...).
If the relationUID is not part of the source, nothing will be changed. Disconnect() ensures that source is a valid
pointer if called.
@remark Disconnect() ensures that sourece is valid and only invokes if instance exists.*/
virtual void Disconnect_datalayer(IPropertyOwner *source, const RelationUIDType & relationUID) const = 0;
/** Returns if the passed rule ID is supported/relevant for the rule. Either because it is the very ID of the rule (default implementation) or because
it is an abstract rule which also supports the rule ID.
@return true: If the rule ID can handle the rule ID. false: the rule does not support the rule ID.*/
virtual bool IsSupportedRuleID(const RuleIDType& ruleID) const;
/** Helper function that generates a reg ex that can be used to find a specific RII property for the rule instance.
- * @param propName If not empty a PropertyPath element will be added (with the passed value) after the <InstanceID> element.
+ * @param propName If not empty a PropertyPath element will be added (with the passed value) after the \<InstanceID\> element.
* @param instanceID If not empty only for the reg ex will only valid for the passed instanceID. Otherwise for all.*/
std::string GetRIIPropertyRegEx(const std::string propName = "", const InstanceIDType &instanceID = "") const;
/**Helper function that deduces the instance ID out of a property name.
If it cannot be deduced an MITK exception is thrown.*/
static InstanceIDType GetInstanceIDByPropertyName(const std::string propName);
/**Helper function that retrives the rule ID of a relation instance of a passed source.
@pre source must be valid.
@pre source must have a relation instance with this ID*/
RuleIDType GetRuleIDByInstanceID(const IPropertyProvider *source,
const InstanceIDType &instanceID) const;
/**Helper function that retrives the destination UID of a relation instance of a passed
source. If the relation has no destination UID, an empty string will be returned.
@pre source must be valid.*/
std::string GetDestinationUIDByInstanceID(const IPropertyProvider * source,
const InstanceIDType & instanceID) const;
itk::LightObject::Pointer InternalClone() const override;
/** helper method that serves as a workaround until T24729 is done.
Please remove if T24728 is done then could directly use owner->GetPropertyKeys() again.*/
static std::vector<std::string> GetPropertyKeys(const IPropertyProvider *owner);
/** Helper method that tries to cast the provider to the Identifiable interface.*/
const Identifiable* CastProviderAsIdentifiable(const mitk::IPropertyProvider* provider) const;
private:
/** Creats a relation UID*/
static RelationUIDType CreateRelationUID();
/**Prepares a new relation instance. Therefore an unused and valid instance ID for the passed source will be genarated
and a relationUID property with the relationUID will be set to block the instance ID. The
instance ID will be returned.
@remark The method is guarded by a class wide mutex to avoid racing conditions in a scenario where rules are used
concurrently.*/
InstanceIDType CreateNewRelationInstance(IPropertyOwner *source, const RelationUIDType &relationUID) const;
};
/**Exception that is used by PropertyRelationRuleBase based classes to indicate that two objects have no relation.*/
class NoPropertyRelationException : public Exception
{
public:
mitkExceptionClassMacro(NoPropertyRelationException, Exception)
};
} // namespace mitk
#endif
diff --git a/Modules/Core/include/mitkReferenceCountWatcher.h b/Modules/Core/include/mitkReferenceCountWatcher.h
index 517a6b2e0e..c5e451fe88 100644
--- a/Modules/Core/include/mitkReferenceCountWatcher.h
+++ b/Modules/Core/include/mitkReferenceCountWatcher.h
@@ -1,101 +1,93 @@
/*============================================================================
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 "itkCommand.h"
#include <MitkCoreExports.h>
#include <mitkCommon.h>
namespace mitk
{
//##Documentation
//## @brief Keeps track of the reference count of an object even if
//## it is destroyed.
- //##
- //## Example usage:
- //## \code
- //## SomeFilter* filter = GetSomeFilter();
- //## ReferenceCountWatcher::Pointer filterWatcher;
- //## filterWatcher = new ReferenceCountWatcher(filter, "name of filter");
- //## filterWatcher->GetReferenceCount();
- //## \endcode
//## @ingroup Testing
class ReferenceCountWatcher : public itk::Object
{
public:
typedef itk::SimpleMemberCommand<ReferenceCountWatcher> CommandType;
mitkClassMacroItkParent(ReferenceCountWatcher, itk::Object);
protected:
//##Documentation
//## @brief Object to be watched
itk::Object *m_Object;
//##Documentation
//## @brief Optional comment, e.g. for debugging output
std::string m_Comment;
//##Documentation
//## @brief If \a true, \a m_Object is no longer valid
//## and the returned reference count will be 0.
bool m_Deleted;
//##Documentation
//## @brief itk::Command to get a notification when the object
//## is deleted.
CommandType::Pointer m_DeleteCommand;
public:
//##Documentation
//## @brief Constructor requiring object to be watched and allowing
//## an optional comment.
ReferenceCountWatcher(itk::Object *o, const char *comment = "")
: m_Object(o), m_Comment(comment), m_Deleted(false), m_ObserverTag(0)
{
m_DeleteCommand = CommandType::New();
m_DeleteCommand->SetCallbackFunction(this, &ReferenceCountWatcher::DeleteObserver);
if (m_Object != nullptr)
m_ObserverTag = m_Object->AddObserver(itk::DeleteEvent(), m_DeleteCommand);
m_ReferenceCount = 0;
}
//##Documentation
//## @brief Destructor: remove observer
~ReferenceCountWatcher() override
{
if ((m_Deleted == false) && (m_Object != nullptr))
{
m_Object->RemoveObserver(m_ObserverTag);
}
}
//##Documentation
//## @brief Return the reference count of the watched object or
//## 0 if it has been destroyed
int GetReferenceCount() const override
{
if (m_Object == nullptr)
return -1;
if (m_Deleted)
return 0;
return m_Object->GetReferenceCount();
}
//##Documentation
//## @brief Return the optional string comment
itkGetStringMacro(Comment);
protected:
//##Documentation
//## @brief Callback called on itk::DeleteEvent() of wathched object.
void DeleteObserver() { m_Deleted = true; }
unsigned long m_ObserverTag;
};
}
diff --git a/Modules/Core/include/mitkRenderWindow.h b/Modules/Core/include/mitkRenderWindow.h
index 64911a9143..c146d959e4 100644
--- a/Modules/Core/include/mitkRenderWindow.h
+++ b/Modules/Core/include/mitkRenderWindow.h
@@ -1,93 +1,93 @@
/*============================================================================
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 MITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66ASDF
#define MITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66ASDF
#include <MitkCoreExports.h>
#include "mitkRenderWindowBase.h"
namespace mitk
{
class vtkEventProvider;
/**
* \brief mitkRenderWindow integrates the MITK rendering mechanism into VTK and
* is NOT QT dependent
*
*
* \ingroup Renderer
*/
class MITKCORE_EXPORT RenderWindow : public mitk::RenderWindowBase, public itk::Object
{
public:
mitkClassMacroItkParent(RenderWindow, itk::Object);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
mitkNewMacro1Param(Self, vtkRenderWindow*);
mitkNewMacro2Param(Self, vtkRenderWindow *, const char *);
~RenderWindow() override;
vtkRenderWindow *GetVtkRenderWindow() override;
vtkRenderWindowInteractor *GetVtkRenderWindowInteractor() override;
// Set Layout Index to define the Layout Type
void SetLayoutIndex(unsigned int layoutIndex);
// Get Layout Index to define the Layout Type
unsigned int GetLayoutIndex();
// MenuWidget need to update the Layout Design List when Layout had changed
void LayoutDesignListChanged(int layoutDesignIndex);
void FullScreenMode(bool state);
/**
* \brief Convenience method to set the size of an mitkRenderWindow.
*
* This method sets the size of the vtkRenderWindow and tells the
* rendering that the size has changed -> adapts displayGeometry, etc.
*/
void SetSize(int width, int height);
/**
* \brief Initializes the mitkVtkEventProvider to listen to the
* currently used vtkInteractorStyle.
*
* This method makes sure that the internal mitkVtkEventProvider
* listens to the correct vtkInteractorStyle.
* This makes sure that VTK-Events are correctly translated into
* MITK-Events.
*
- * \warn This method needs to be called MANUALLY as soon as the MapperID
+ * \warning This method needs to be called MANUALLY as soon as the MapperID
* for this RenderWindow is changed or the vtkInteractorStyle is modified
* somehow else!
*/
void ReinitEventProvider();
protected:
RenderWindow(vtkRenderWindow *existingRenderWindow = nullptr,
const char *name = "unnamed renderer");
void ResetView();
vtkRenderWindow *m_vtkRenderWindow;
vtkRenderWindowInteractor *m_vtkRenderWindowInteractor;
vtkEventProvider *m_vtkMitkEventProvider;
private:
};
} // namespace
#endif /* MITKRENDERWINDOW_H_HEADER_INCLUDED_C1C40D66ASDF */
diff --git a/Modules/Core/include/mitkRenderingManager.h b/Modules/Core/include/mitkRenderingManager.h
index 6c69b69c2c..bc47776433 100644
--- a/Modules/Core/include/mitkRenderingManager.h
+++ b/Modules/Core/include/mitkRenderingManager.h
@@ -1,402 +1,402 @@
/*============================================================================
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 MITKRENDERINGMANAGER_H_HEADER_INCLUDED_C135A197
#define MITKRENDERINGMANAGER_H_HEADER_INCLUDED_C135A197
#include <MitkCoreExports.h>
#include <vtkCallbackCommand.h>
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <string>
#include "mitkProperties.h"
#include "mitkPropertyList.h"
#include "mitkTimeGeometry.h"
#include <mitkAntiAliasing.h>
class vtkRenderWindow;
class vtkObject;
namespace mitk
{
class RenderingManager;
class RenderingManagerFactory;
class BaseGeometry;
class SliceNavigationController;
class BaseRenderer;
class DataStorage;
/**
* \brief Manager for coordinating the rendering process.
*
* RenderingManager is a central instance retrieving and executing
* RenderWindow update requests. Its main purpose is to coordinate
* distributed requests which cannot be aware of each other - lacking the
* knowledge of whether they are really necessary or not. For example, two
* objects might determine that a specific RenderWindow needs to be updated.
* This would result in one unnecessary update, if both executed the update
* on their own.
*
* The RenderingManager addresses this by letting each such object
* <em>request</em> an update, and waiting for other objects to possibly
* issue the same request. The actual update will then only be executed at a
* well-defined point in the main event loop (this may be each time after
* event processing is done).
*
* Convinience methods for updating all RenderWindows which have been
* registered with the RenderingManager exist. If theses methods are not
* used, it is not required to register (add) RenderWindows prior to using
* the RenderingManager.
*
* The methods #ForceImmediateUpdate() and #ForceImmediateUpdateAll() can
* be used to force the RenderWindow update execution without any delay,
* bypassing the request functionality.
*
* The interface of RenderingManager is platform independent. Platform
* specific subclasses have to be implemented, though, to supply an
* appropriate event issueing for controlling the update execution process.
* See method documentation for a description of how this can be done.
*
* \sa TestingRenderingManager An "empty" RenderingManager implementation which
* can be used in tests etc.
*
*/
class MITKCORE_EXPORT RenderingManager : public itk::Object
{
public:
mitkClassMacroItkParent(RenderingManager, itk::Object);
typedef std::vector<vtkRenderWindow *> RenderWindowVector;
typedef std::vector<float> FloatVector;
typedef std::vector<bool> BoolVector;
typedef itk::SmartPointer<DataStorage> DataStoragePointer;
enum RequestType
{
REQUEST_UPDATE_ALL = 0,
REQUEST_UPDATE_2DWINDOWS,
REQUEST_UPDATE_3DWINDOWS
};
static Pointer New();
/** Set the object factory which produces the desired platform specific
* RenderingManager singleton instance. */
static void SetFactory(RenderingManagerFactory *factory);
/** Get the object factory which produces the platform specific
* RenderingManager instances. */
static const RenderingManagerFactory *GetFactory();
/** Returns true if a factory has already been set. */
static bool HasFactory();
/** Get the RenderingManager singleton instance. */
static RenderingManager *GetInstance();
/** Returns true if the singleton instance does already exist. */
static bool IsInstantiated();
/** Adds a RenderWindow. This is required if the methods #RequestUpdateAll
* or #ForceImmediateUpdate are to be used. */
void AddRenderWindow(vtkRenderWindow *renderWindow);
/** Removes a RenderWindow. */
void RemoveRenderWindow(vtkRenderWindow *renderWindow);
/** Get a list of all registered RenderWindows */
const RenderWindowVector &GetAllRegisteredRenderWindows();
/** Requests an update for the specified RenderWindow, to be executed as
* soon as the main loop is ready for rendering. */
void RequestUpdate(vtkRenderWindow *renderWindow);
/** Immediately executes an update of the specified RenderWindow. */
void ForceImmediateUpdate(vtkRenderWindow *renderWindow);
/** Requests all currently registered RenderWindows to be updated.
* If only 2D or 3D windows should be updated, this can be specified
* via the parameter requestType. */
void RequestUpdateAll(RequestType type = REQUEST_UPDATE_ALL);
/** Immediately executes an update of all registered RenderWindows.
* If only 2D or 3D windows should be updated, this can be specified
* via the parameter requestType. */
void ForceImmediateUpdateAll(RequestType type = REQUEST_UPDATE_ALL);
/** Initializes the windows specified by requestType to the geometry of the
* given DataStorage. */
// virtual bool InitializeViews( const DataStorage *storage, const DataNode* node = nullptr,
// RequestType type = REQUEST_UPDATE_ALL, bool preserveRoughOrientationInWorldSpace = false );
/** Initializes the windows specified by requestType to the given
* geometry. PLATFORM SPECIFIC. TODO: HOW IS THIS PLATFORM SPECIFIC?
* Throws an exception if bounding box has 0 extent due to exceeding
* double precision range. */
virtual bool InitializeViews(const BaseGeometry *geometry,
RequestType type = REQUEST_UPDATE_ALL,
bool preserveRoughOrientationInWorldSpace = false);
virtual bool InitializeViews(const TimeGeometry *geometry,
RequestType type = REQUEST_UPDATE_ALL,
bool preserveRoughOrientationInWorldSpace = false);
/** Initializes the windows to the default viewing direction
* (geomtry information is NOT changed). PLATFORM SPECIFIC. */
virtual bool InitializeViews(RequestType type = REQUEST_UPDATE_ALL);
/** Initializes the specified window to the geometry of the given
* DataNode. Set "initializeGlobalTimeSNC" to true in order to use this
* geometry as global TimeGeometry. PLATFORM SPECIFIC. */
// virtual bool InitializeView( vtkRenderWindow *renderWindow, const DataStorage* ds, const DataNode* node = nullptr,
// bool initializeGlobalTimeSNC = false );
/** Initializes the specified window to the given geometry. Set
* "initializeGlobalTimeSNC" to true in order to use this geometry as
* global TimeGeometry. PLATFORM SPECIFIC. */
virtual bool InitializeView(vtkRenderWindow *renderWindow,
const BaseGeometry *geometry,
bool initializeGlobalTimeSNC = false);
virtual bool InitializeView(vtkRenderWindow *renderWindow,
const TimeGeometry *geometry,
bool initializeGlobalTimeSNC = false);
/** Initializes the specified window to the default viewing direction
* (geomtry information is NOT changed). PLATFORM SPECIFIC. */
virtual bool InitializeView(vtkRenderWindow *renderWindow);
/**
* @brief Initializes the renderwindows by the aggregated geometry of
* all objects that are held in the data storage.
* This is basically a global reinit
- * @param The data storage from which the bounding object can be retrieved
+ * @param dataStorage The data storage from which the bounding object can be retrieved
*/
- virtual void InitializeViewsByBoundingObjects(const DataStorage *);
+ virtual void InitializeViewsByBoundingObjects(const DataStorage *dataStorage);
/** Gets the (global) SliceNavigationController responsible for
* time-slicing. */
const SliceNavigationController *GetTimeNavigationController() const;
/** Gets the (global) SliceNavigationController responsible for
* time-slicing. */
SliceNavigationController *GetTimeNavigationController();
~RenderingManager() override;
/** Executes all pending requests. This method has to be called by the
* system whenever a RenderingManager induced request event occurs in
* the system pipeline (see concrete RenderingManager implementations). */
virtual void ExecutePendingRequests();
bool IsRendering() const;
void AbortRendering();
/** En-/Disable LOD increase globally. */
itkSetMacro(LODIncreaseBlocked, bool);
/** En-/Disable LOD increase globally. */
itkGetMacro(LODIncreaseBlocked, bool);
/** En-/Disable LOD increase globally. */
itkBooleanMacro(LODIncreaseBlocked);
/** En-/Disable LOD abort mechanism. */
itkSetMacro(LODAbortMechanismEnabled, bool);
/** En-/Disable LOD abort mechanism. */
itkGetMacro(LODAbortMechanismEnabled, bool);
/** En-/Disable LOD abort mechanism. */
itkBooleanMacro(LODAbortMechanismEnabled);
/** Force a sub-class to start a timer for a pending hires-rendering request */
virtual void StartOrResetTimer(){};
/** To be called by a sub-class from a timer callback */
void ExecutePendingHighResRenderingRequest();
virtual void DoStartRendering(){};
virtual void DoMonitorRendering(){};
virtual void DoFinishAbortRendering(){};
int GetNextLOD(BaseRenderer *renderer);
/** Set current LOD (nullptr means all renderers)*/
void SetMaximumLOD(unsigned int max);
void SetShading(bool state, unsigned int lod);
bool GetShading(unsigned int lod);
void SetClippingPlaneStatus(bool status);
bool GetClippingPlaneStatus();
void SetShadingValues(float ambient, float diffuse, float specular, float specpower);
FloatVector &GetShadingValues();
/** Returns a property list */
PropertyList::Pointer GetPropertyList() const;
/** Returns a property from m_PropertyList */
BaseProperty *GetProperty(const char *propertyKey) const;
/** Sets or adds (if not present) a property in m_PropertyList */
void SetProperty(const char *propertyKey, BaseProperty *propertyValue);
/**
* \brief Setter / Getter for internal DataStorage
*
* Sets / returns the mitk::DataStorage that is used internally. This instance holds all mitk::DataNodes that are
* rendered by the registered BaseRenderers.
*
* If this DataStorage is changed at runtime by calling SetDataStorage(),
* all currently registered BaseRenderers are automatically given the correct instance.
* When a new BaseRenderer is added, it is automatically initialized with the currently active DataStorage.
*/
void SetDataStorage(mitk::DataStorage *storage);
/**
* \brief Setter / Getter for internal DataStorage
*
* Sets / returns the mitk::DataStorage that is used internally. This instance holds all mitk::DataNodes that are
* rendered by the registered BaseRenderers.
*
* If this DataStorage is changed at runtime by calling SetDataStorage(),
* all currently registered BaseRenderers are automatically given the correct instance.
* When a new BaseRenderer is added, it is automatically initialized with the currently active DataStorage.
*/
mitk::DataStorage *GetDataStorage();
/**
* @brief Sets a flag to the given renderwindow to indicated that it has the focus e.g. has been clicked recently.
* @param focusWindow
*/
void SetRenderWindowFocus(vtkRenderWindow *focusWindow);
itkGetMacro(FocusedRenderWindow, vtkRenderWindow *);
itkSetMacro(ConstrainedPanningZooming, bool);
itkGetMacro(AntiAliasing, AntiAliasing);
void SetAntiAliasing(AntiAliasing antiAliasing);
protected:
enum
{
RENDERING_INACTIVE = 0,
RENDERING_REQUESTED,
RENDERING_INPROGRESS
};
RenderingManager();
/** Abstract method for generating a system specific event for rendering
* request. This method is called whenever an update is requested */
virtual void GenerateRenderingRequestEvent() = 0;
virtual void InitializePropertyList();
bool m_UpdatePending;
typedef std::map<BaseRenderer *, unsigned int> RendererIntMap;
typedef std::map<BaseRenderer *, bool> RendererBoolMap;
RendererBoolMap m_RenderingAbortedMap;
RendererIntMap m_NextLODMap;
unsigned int m_MaxLOD;
bool m_LODIncreaseBlocked;
bool m_LODAbortMechanismEnabled;
BoolVector m_ShadingEnabled;
bool m_ClippingPlaneEnabled;
FloatVector m_ShadingValues;
static void RenderingStartCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata);
static void RenderingProgressCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata);
static void RenderingEndCallback(vtkObject *caller, unsigned long eid, void *clientdata, void *calldata);
typedef std::map<vtkRenderWindow *, int> RenderWindowList;
RenderWindowList m_RenderWindowList;
RenderWindowVector m_AllRenderWindows;
struct RenderWindowCallbacks
{
vtkCallbackCommand *commands[3u];
};
typedef std::map<vtkRenderWindow *, RenderWindowCallbacks> RenderWindowCallbacksList;
RenderWindowCallbacksList m_RenderWindowCallbacksList;
itk::SmartPointer<SliceNavigationController> m_TimeNavigationController;
static RenderingManager::Pointer s_Instance;
static RenderingManagerFactory *s_RenderingManagerFactory;
PropertyList::Pointer m_PropertyList;
DataStoragePointer m_DataStorage;
bool m_ConstrainedPanningZooming;
private:
void InternalViewInitialization(mitk::BaseRenderer *baseRenderer,
const mitk::TimeGeometry *geometry,
bool boundingBoxInitialized,
int mapperID);
vtkRenderWindow *m_FocusedRenderWindow;
AntiAliasing m_AntiAliasing;
};
#pragma GCC visibility push(default)
itkEventMacro(RenderingManagerEvent, itk::AnyEvent);
itkEventMacro(RenderingManagerViewsInitializedEvent, RenderingManagerEvent);
#pragma GCC visibility pop
itkEventMacroDeclaration(FocusChangedEvent, itk::AnyEvent);
/**
* Generic RenderingManager implementation for "non-rendering-plattform",
* e.g. for tests. Its factory (TestingRenderingManagerFactory) is
* automatically on start-up and is used by default if not other
* RenderingManagerFactory is instantiated explicitly thereafter.
* (see mitkRenderingManager.cpp)
*/
class MITKCORE_EXPORT TestingRenderingManager : public RenderingManager
{
public:
mitkClassMacro(TestingRenderingManager, RenderingManager);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
protected:
void GenerateRenderingRequestEvent() override {};
};
} // namespace mitk
#endif /* MITKRenderingManager_H_HEADER_INCLUDED_C135A197 */
diff --git a/Modules/Core/include/mitkRestorePlanePositionOperation.h b/Modules/Core/include/mitkRestorePlanePositionOperation.h
index 7a2c7f0dd6..094f9b19b1 100644
--- a/Modules/Core/include/mitkRestorePlanePositionOperation.h
+++ b/Modules/Core/include/mitkRestorePlanePositionOperation.h
@@ -1,74 +1,61 @@
/*============================================================================
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 mitkRestorePlanePositionOperation_h_Included
#define mitkRestorePlanePositionOperation_h_Included
#include "mitkCommon.h"
#include "mitkNumericTypes.h"
#include "mitkPointOperation.h"
namespace mitk
{
- //##Documentation
- //## TODO
-
class MITKCORE_EXPORT RestorePlanePositionOperation : public Operation
{
public:
- //##Documentation
- //##@brief Operation that handles all actions on one Point.
- //##
- //## @param operationType is the type of the operation (see mitkOperation.h; e.g. move or add; Information for
- // StateMachine::ExecuteOperation());
- //## @param point is the information of the point to add or is the information to change a point into
- //## @param index is e.g. the position in a list which describes the element to change
- // PointOperation(OperationType operationType, Point3D point, int index = -1, bool selected = true,
- // PointSpecificationType type = PTUNDEFINED);
-
RestorePlanePositionOperation(OperationType operationType,
ScalarType width,
ScalarType height,
Vector3D spacing,
unsigned int pos,
Vector3D direction,
AffineTransform3D::Pointer transform);
~RestorePlanePositionOperation() override;
Vector3D GetDirectionVector();
ScalarType GetWidth();
ScalarType GetHeight();
Vector3D GetSpacing();
unsigned int GetPos();
AffineTransform3D::Pointer GetTransform();
private:
Vector3D m_Spacing;
Vector3D m_DirectionVector;
ScalarType m_Width;
ScalarType m_Height;
unsigned int m_Pos;
AffineTransform3D::Pointer m_Transform;
};
} // namespace mitk
#endif
diff --git a/Modules/Core/include/mitkSinglePointDataInteractor.h b/Modules/Core/include/mitkSinglePointDataInteractor.h
index 95aea60401..bf6b9ab5bb 100644
--- a/Modules/Core/include/mitkSinglePointDataInteractor.h
+++ b/Modules/Core/include/mitkSinglePointDataInteractor.h
@@ -1,61 +1,61 @@
/*============================================================================
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 mitkSinglePointDataInteractor_h_
#define mitkSinglePointDataInteractor_h_
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkSmartPointer.h"
#include "mitkCommon.h"
#include "mitkPointSetDataInteractor.h"
#include <MitkCoreExports.h>
#include <mitkPointSet.h>
namespace mitk
{
/**
* Class SinglePointDataInteractor
* \brief Implementation of the single point interaction
*
* Interactor operates on a single point set, when a data node is set, its containing point set is clear for
* initialization.
*/
// Inherit from DataInteratcor, this provides functionality of a state machine and configurable inputs.
class MITKCORE_EXPORT SinglePointDataInteractor : public PointSetDataInteractor
{
public:
mitkClassMacro(SinglePointDataInteractor, PointSetDataInteractor);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
protected : SinglePointDataInteractor();
~SinglePointDataInteractor() override;
/** Adds a point at the given coordinates.
* This function overwrites the behavior of PointSetDataInteractor such that instead of adding new points
* the first points position is updated. All other interaction (move,delete) is still handled by
* PointSetDataInteractor.
*/
void AddPoint(StateMachineAction *, InteractionEvent *event) override;
/**
* @brief SetMaxPoints Sets the maximal number of points for the pointset
* Overwritten, per design this class will always have a maximal number of one.
* @param maxNumber
*/
- virtual void SetMaxPoints(unsigned int /*maxNumber*/ = 0) {}
+ virtual void SetMaxPoints(unsigned int maxNumber = 0);
void DataNodeChanged() override;
};
}
#endif
diff --git a/Modules/Core/include/mitkSlicedGeometry3D.h b/Modules/Core/include/mitkSlicedGeometry3D.h
index 27f09a6086..573541b549 100644
--- a/Modules/Core/include/mitkSlicedGeometry3D.h
+++ b/Modules/Core/include/mitkSlicedGeometry3D.h
@@ -1,327 +1,328 @@
/*============================================================================
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 MITKSLICEDGEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD
#define MITKSLICEDGEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD
#include "mitkBaseGeometry.h"
#include "mitkPlaneGeometry.h"
namespace mitk
{
class SliceNavigationController;
class NavigationController;
/** \brief Describes the geometry of a data object consisting of slices.
*
* A PlaneGeometry can be requested for each slice. In the case of
* \em evenly-spaced, \em plane geometries (m_EvenlySpaced==true),
* only the 2D-geometry of the first slice has to be set (to an instance of
* PlaneGeometry). The 2D geometries of the other slices are calculated
* by shifting the first slice in the direction m_DirectionVector by
* m_Spacing.z * sliceNumber. The m_Spacing member (which is only
* relevant in the case m_EvenlySpaced==true) descibes the size of a voxel
* (in mm), i.e., m_Spacing.x is the voxel width in the x-direction of the
* plane. It is derived from the reference geometry of this SlicedGeometry3D,
* which usually would be the global geometry describing how datasets are to
* be resliced.
*
* By default, slices are oriented in the direction of one of the main axes
* (x, y, z). However, by means of rotation, it is possible to realign the
* slices in any possible direction. In case of an inclined plane, the spacing
* is derived as a product of the (regular) geometry spacing and the direction
* vector of the plane.
*
* SlicedGeometry3D and the associated PlaneGeometries have to be initialized in
* the method GenerateOutputInformation() of BaseProcess (or CopyInformation /
* UpdateOutputInformation of BaseData, if possible, e.g., by analyzing pic
* tags in Image) subclasses. See also
*
* \sa itk::ProcessObject::GenerateOutputInformation(),
* \sa itk::DataObject::CopyInformation() and
* \a itk::DataObject::UpdateOutputInformation().
*
* Rule: everything is in mm (or ms for temporal information) if not
* stated otherwise.
*
* \warning The hull (i.e., transform, bounding-box and
* time-bounds) is only guaranteed to be up-to-date after calling
* UpdateInformation().
*
* \ingroup Geometry
*/
class MITKCORE_EXPORT SlicedGeometry3D : public mitk::BaseGeometry
{
public:
mitkClassMacro(SlicedGeometry3D, BaseGeometry);
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**
* \brief Returns the PlaneGeometry of the slice (\a s).
*
* If (a) m_EvenlySpaced==true, (b) we don't have a PlaneGeometry stored
* for the requested slice, and (c) the first slice (s=0)
* is a PlaneGeometry instance, then we calculate the geometry of the
* requested as the plane of the first slice shifted by m_Spacing[3]*s
* in the direction of m_DirectionVector.
*
* \warning The PlaneGeometries are not necessarily up-to-date and not even
* initialized.
*
* The PlaneGeometries have to be initialized in the method
* GenerateOutputInformation() of BaseProcess (or CopyInformation /
* UpdateOutputInformation of BaseData, if possible, e.g., by analyzing
* pic tags in Image) subclasses. See also
*
* \sa itk::ProcessObject::GenerateOutputInformation(),
* \sa itk::DataObject::CopyInformation() and
* \sa itk::DataObject::UpdateOutputInformation().
*/
virtual mitk::PlaneGeometry *GetPlaneGeometry(int s) const;
/**
* \deprecatedSince{2014_10} Please use GetPlaneGeometry
*/
DEPRECATED(const PlaneGeometry *GetGeometry2D(int s)) { return GetPlaneGeometry(s); }
/**
* \deprecatedSince{2014_10} Please use SetPlaneGeometry
*/
DEPRECATED(void SetGeometry2D(PlaneGeometry *geo, int s)) { SetPlaneGeometry(geo, s); }
//##Documentation
//## @brief When switching from an Image Geometry to a normal Geometry (and the other way around), you have to
//change
// the origin as well (See Geometry Documentation)! This function will change the "isImageGeometry" bool flag and
// changes the origin respectively.
void ChangeImageGeometryConsideringOriginOffset(const bool isAnImageGeometry) override;
// virtual void SetTimeBounds( const mitk::TimeBounds& timebounds );
const mitk::BoundingBox *GetBoundingBox() const override;
/**
* \brief Get the number of slices
*/
itkGetConstMacro(Slices, unsigned int);
/**
* \brief Set PlaneGeometry of slice \a s.
*/
virtual bool SetPlaneGeometry(mitk::PlaneGeometry *geometry2D, int s);
/**
* \brief Check whether a slice exists
*/
virtual bool IsValidSlice(int s = 0) const;
virtual const BaseGeometry* GetReferenceGeometry() const;
virtual void SetReferenceGeometry(const BaseGeometry *referenceGeometry);
bool HasReferenceGeometry() const;
/**
* \brief Set the SliceNavigationController corresponding to this sliced
* geometry.
*
* The SNC needs to be informed when the number of slices in the geometry
* changes, which can occur whenthe slices are re-oriented by rotation.
*/
virtual void SetSliceNavigationController(mitk::SliceNavigationController *snc);
mitk::SliceNavigationController *GetSliceNavigationController();
/**
* \brief Set/Get whether the SlicedGeometry3D is evenly-spaced
* (m_EvenlySpaced)
*
* If (a) m_EvenlySpaced==true, (b) we don't have a PlaneGeometry stored for
* the requested slice, and (c) the first slice (s=0) is a PlaneGeometry
* instance, then we calculate the geometry of the requested as the plane
* of the first slice shifted by m_Spacing.z * s in the direction of
* m_DirectionVector.
*
* \sa GetPlaneGeometry
*/
itkGetConstMacro(EvenlySpaced, bool);
virtual void SetEvenlySpaced(bool on = true);
/**
* \brief Set/Get the vector between slices for the evenly-spaced case
* (m_EvenlySpaced==true).
*
* If the direction-vector is (0,0,0) (the default) and the first
* 2D geometry is a PlaneGeometry, then the direction-vector will be
* calculated from the plane normal.
*
* \sa m_DirectionVector
*/
virtual void SetDirectionVector(const mitk::Vector3D &directionVector);
itkGetConstMacro(DirectionVector, const mitk::Vector3D &);
itk::LightObject::Pointer InternalClone() const override;
#ifndef SWIG
static const std::string SLICES;
const static std::string DIRECTION_VECTOR;
const static std::string EVENLY_SPACED;
#endif // !SWIG
/**
* \brief Tell this instance how many PlaneGeometries it shall manage. Bounding
* box and the PlaneGeometries must be set additionally by calling the respective
* methods!
*
* \warning Bounding box and the 2D-geometries must be set additionally: use
* SetBounds(), SetGeometry().
*/
virtual void InitializeSlicedGeometry(unsigned int slices);
/**
* \brief Completely initialize this instance as evenly-spaced with slices
* parallel to the provided PlaneGeometry that is used as the first slice and
* for spacing calculation.
*
* Initializes the bounding box according to the width/height of the
* PlaneGeometry and \a slices. The spacing is calculated from the PlaneGeometry.
*/
virtual void InitializeEvenlySpaced(mitk::PlaneGeometry *geometry2D, unsigned int slices);
/**
* \brief Completely initialize this instance as evenly-spaced with slices
* parallel to the provided PlaneGeometry that is used as the first slice and
* for spacing calculation (except z-spacing).
*
* Initializes the bounding box according to the width/height of the
* PlaneGeometry and \a slices. The x-/y-spacing is calculated from the
* PlaneGeometry.
*/
virtual void InitializeEvenlySpaced(mitk::PlaneGeometry *geometry2D,
mitk::ScalarType zSpacing,
unsigned int slices);
/**
* \brief Completely initialize this instance as evenly-spaced plane slices
* parallel to a side of the provided BaseGeometry and using its spacing
* information.
*
* Initializes the bounding box according to the width/height of the
* BaseGeometry and the number of slices according to
* BaseGeometry::GetExtent(2).
*
+ * \param geometry3D
* \param planeorientation side parallel to which the slices will be oriented
* \param top if \a true, create plane at top, otherwise at bottom
* (for PlaneOrientation Axial, for other plane locations respectively)
* \param frontside defines the side of the plane (the definition of
* front/back is somewhat arbitrary)
*
- * \param rotate rotates the plane by 180 degree around its normal (the
+ * \param rotated rotates the plane by 180 degree around its normal (the
* definition of rotated vs not rotated is somewhat arbitrary)
*/
virtual void InitializePlanes(const mitk::BaseGeometry *geometry3D,
mitk::PlaneGeometry::PlaneOrientation planeorientation,
bool top = true,
bool frontside = true,
bool rotated = false);
void SetImageGeometry(const bool isAnImageGeometry) override;
void ExecuteOperation(Operation *operation) override;
static double CalculateSpacing(const mitk::Vector3D &spacing, const mitk::Vector3D &d);
protected:
SlicedGeometry3D();
SlicedGeometry3D(const SlicedGeometry3D &other);
~SlicedGeometry3D() override;
/**
* Reinitialize plane stack after rotation. More precisely, the first plane
* of the stack needs to spatially aligned, in two respects:
*
* 1. Re-alignment with respect to the dataset center; this is necessary
* since the distance from the first plane to the center could otherwise
* continuously decrease or increase.
* 2. Re-alignment with respect to a given reference point; the reference
* point is a location which the user wants to be exactly touched by one
* plane of the plane stack. The first plane is minimally shifted to
* ensure this touching. Usually, the reference point would be the
* point around which the geometry is rotated.
*/
virtual void ReinitializePlanes(const Point3D &center, const Point3D &referencePoint);
ScalarType GetLargestExtent(const BaseGeometry *geometry);
void PrintSelf(std::ostream &os, itk::Indent indent) const override;
/** Calculate "directed spacing", i.e. the spacing in directions
* non-orthogonal to the coordinate axes. This is done via the
* ellipsoid equation.
*/
double CalculateSpacing(const mitk::Vector3D &direction) const;
/** The extent of the slice stack, i.e. the number of slices, depends on the
* plane normal. For rotated geometries, the geometry's transform needs to
* be accounted in this calculation.
*/
mitk::Vector3D AdjustNormal(const mitk::Vector3D &normal) const;
/**
* Container for the 2D-geometries contained within this SliceGeometry3D.
*/
mutable std::vector<PlaneGeometry::Pointer> m_PlaneGeometries;
/**
* If (a) m_EvenlySpaced==true, (b) we don't have a PlaneGeometry stored
* for the requested slice, and (c) the first slice (s=0)
* is a PlaneGeometry instance, then we calculate the geometry of the
* requested as the plane of the first slice shifted by m_Spacing.z*s
* in the direction of m_DirectionVector.
*
* \sa GetPlaneGeometry
*/
bool m_EvenlySpaced;
/**
* Vector between slices for the evenly-spaced case (m_EvenlySpaced==true).
* If the direction-vector is (0,0,0) (the default) and the first
* 2D geometry is a PlaneGeometry, then the direction-vector will be
* calculated from the plane normal.
*/
mutable mitk::Vector3D m_DirectionVector;
/** Number of slices this SliceGeometry3D is descibing. */
unsigned int m_Slices;
/** Underlying BaseGeometry for this SlicedGeometry */
const mitk::BaseGeometry *m_ReferenceGeometry;
/** SNC correcsponding to this geometry; used to reflect changes in the
* number of slices due to rotation. */
// mitk::NavigationController *m_NavigationController;
mitk::SliceNavigationController *m_SliceNavigationController;
//##Documentation
//## @brief PreSetSpacing
//##
//## These virtual function allows a different beahiour in subclasses.
//## Do implement them in every subclass of BaseGeometry. If not needed, use
//## {Superclass::PreSetSpacing();};
void PreSetSpacing(const mitk::Vector3D &aSpacing) override;
};
} // namespace mitk
#endif /* MITKSLICEDGEOMETRY3D_H_HEADER_INCLUDED_C1EBD0AD */
diff --git a/Modules/Core/include/mitkStandaloneDataStorage.h b/Modules/Core/include/mitkStandaloneDataStorage.h
index adf6b52e48..88e17af581 100644
--- a/Modules/Core/include/mitkStandaloneDataStorage.h
+++ b/Modules/Core/include/mitkStandaloneDataStorage.h
@@ -1,133 +1,129 @@
/*============================================================================
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 MITKSTANDALONEDATASTORAGE_H_HEADER_INCLUDED_
#define MITKSTANDALONEDATASTORAGE_H_HEADER_INCLUDED_
#include "itkVectorContainer.h"
#include "mitkDataStorage.h"
#include "mitkMessage.h"
#include <map>
namespace mitk
{
class NodePredicateBase;
class DataNode;
//##Documentation
//## @brief Data management class that handles 'was created by' relations
//##
//## The StandaloneDataStorage provides data storage and management functionality.
//## It handles a 'was created by' relation by associating each data object with a
//## set of source objects that were used to create the new object was created from.
//## Thus, nodes are stored in a noncyclical directed graph data structure.
//## It is derived from mitk::DataStorage and implements its interface,
//## including AddNodeEvent and RemoveNodeEvent.
//## @ingroup StandaloneDataStorage
class MITKCORE_EXPORT StandaloneDataStorage : public mitk::DataStorage
{
public:
mitkClassMacro(StandaloneDataStorage, mitk::DataStorage);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
//##Documentation
//## @brief Adds a DataNode containing a data object to its internal storage
//##
//## This Method adds a new data object to the StandaloneDataStorage. The new object is
//## passed in the first parameter. The second parameter is a set
//## of source objects, that were used to create this object. The new object will have
//## a 'was created from' relation to its source objects.
//## the addition of a new object will fire the notification mechanism.
//## If the node parameter is nullptr or if the DataNode has already been added,
//## an exception will be thrown.
void Add(mitk::DataNode *node, const mitk::DataStorage::SetOfObjects *parents = nullptr) override;
//##Documentation
//## @brief Removes node from the StandaloneDataStorage
//##
void Remove(const mitk::DataNode *node) override;
//##Documentation
//## @brief Checks if a node exists in the StandaloneDataStorage
//##
bool Exists(const mitk::DataNode *node) const override;
//##Documentation
//## @brief returns a set of source objects for a given node that meet the given condition(s).
//##
SetOfObjects::ConstPointer GetSources(const mitk::DataNode *node,
const NodePredicateBase *condition = nullptr,
bool onlyDirectSources = true) const override;
//##Documentation
//## @brief returns a set of derived objects for a given node.
//##
//## GetDerivations() returns a set of objects that are derived from the DataNode node.
//## This means, that node was used to create the returned objects. If the parameter
//## onlyDirectDerivations is set to true (default value), only objects that directly have
//## node as one of their source objects will be returned. Otherwise, objects that are
//## derived from derivations of node are returned too.
//## The derived objects can be filtered with a predicate object as described in the GetSubset()
//## method by providing a predicate as the condition parameter.
SetOfObjects::ConstPointer GetDerivations(const mitk::DataNode *node,
const NodePredicateBase *condition = nullptr,
bool onlyDirectDerivations = true) const override;
//##Documentation
//## @brief returns a set of all data objects that are stored in the data storage
//##
SetOfObjects::ConstPointer GetAll() const override;
/*ITK Mutex */
mutable itk::SimpleFastMutexLock m_Mutex;
protected:
//##Documentation
//## @brief noncyclical directed graph data structure to store the nodes with their relation
typedef std::map<mitk::DataNode::ConstPointer, SetOfObjects::ConstPointer> AdjacencyList;
- //##Documentation
- //## @brief Standard Constructor for ::New() instantiation
StandaloneDataStorage();
- //##Documentation
- //## @brief Standard Destructor
~StandaloneDataStorage() override;
//##Documentation
//## @brief convenience method to check if the object has been initialized (i.e. a data tree has been set)
bool IsInitialized() const;
//##Documentation
//## @brief Traverses the Relation graph and extracts a list of related elements (e.g. Sources or Derivations)
SetOfObjects::ConstPointer GetRelations(const mitk::DataNode *node,
const AdjacencyList &relation,
const NodePredicateBase *condition = nullptr,
bool onlyDirectlyRelated = true) const;
//##Documentation
//## @brief deletes all references to a node in a given relation (used in Remove() and TreeListener)
void RemoveFromRelation(const mitk::DataNode *node, AdjacencyList &relation);
//##Documentation
//## @brief Prints the contents of the StandaloneDataStorage to os. Do not call directly, call ->Print() instead
void PrintSelf(std::ostream &os, itk::Indent indent) const override;
//##Documentation
//## @brief Nodes and their relation are stored in m_SourceNodes
AdjacencyList m_SourceNodes;
//##Documentation
//## @brief Nodes are stored in reverse relation for easier traversal in the opposite direction of the relation
AdjacencyList m_DerivedNodes;
};
} // namespace mitk
#endif /* MITKSTANDALONEDATASTORAGE_H_HEADER_INCLUDED_ */
diff --git a/Modules/Core/include/mitkStateMachineTransition.h b/Modules/Core/include/mitkStateMachineTransition.h
index f1ca8cdc98..4c67ca3020 100755
--- a/Modules/Core/include/mitkStateMachineTransition.h
+++ b/Modules/Core/include/mitkStateMachineTransition.h
@@ -1,105 +1,105 @@
/*============================================================================
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 SMTRANSITION_H_HEADER_INCLUDED
#define SMTRANSITION_H_HEADER_INCLUDED
#include "mitkCommon.h"
#include "mitkInteractionEvent.h"
#include "mitkStateMachineAction.h"
#include "mitkStateMachineCondition.h"
#include <itkLightObject.h>
#include <string>
#include "MitkCoreExports.h"
namespace mitk
{
class StateMachineState;
typedef std::vector<mitk::StateMachineAction::Pointer> ActionVectorType;
typedef std::vector<StateMachineCondition> ConditionVectorType;
typedef itk::SmartPointer<StateMachineState> SpStateMachineState;
/**
* \class StateMachineTransition
* \brief Connects two states, and holds references to corresponding actions and conditions.
*
* This class represents a transition between two states of a statemachine. It holds a
* list of conditions that have to be fulfilled in order to be executed correctly.
* It also holds a list of actions that will be executed if all conditions are fulfilled.
*
* \ingroup Interaction
**/
class MITKCORE_EXPORT StateMachineTransition : public itk::LightObject
{
friend class StateMachineFactory;
friend class StateMachineContainer;
public:
mitkClassMacroItkParent(StateMachineTransition, itk::LightObject);
mitkNewMacro3Param(Self, const std::string &, const std::string &, const std::string &);
SpStateMachineState GetNextState() const;
std::string GetNextStateName() const;
/**
* Check for equality. Equality is given if event variant is the same and
* classes are the same or the first argument is a superclass of the second.
- * \warn Here the order of arguments matters. !
+ * \warning Here the order of arguments matters. !
*/
bool operator==(const StateMachineTransition &transition) const;
/**
* @brief Get an iterator on the first action in list.
**/
ActionVectorType GetActions() const;
const ConditionVectorType &GetConditions() const;
/**
* @brief Set the next state of this object.
**/
void SetNextState(const SpStateMachineState &nextState);
protected:
StateMachineTransition(const std::string &nextStateName,
const std::string &eventClass,
const std::string &eventVariant);
~StateMachineTransition() override;
// Triggering Event
std::string m_EventClass;
std::string m_EventVariant;
private:
void AddAction(const StateMachineAction::Pointer &action);
void AddCondition(const StateMachineCondition &condition);
SpStateMachineState m_NextState;
std::string m_NextStateName;
InteractionEvent::Pointer m_TransitionEvent;
/**
* @brief The list of actions, that are executed if this transition is done.
**/
std::vector<StateMachineAction::Pointer> m_Actions;
ConditionVectorType m_Conditions;
};
} // namespace mitk
#endif /* SMTRANSITION_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkTemporoSpatialStringProperty.h b/Modules/Core/include/mitkTemporoSpatialStringProperty.h
index e261df1331..99a145cc8d 100644
--- a/Modules/Core/include/mitkTemporoSpatialStringProperty.h
+++ b/Modules/Core/include/mitkTemporoSpatialStringProperty.h
@@ -1,136 +1,136 @@
/*============================================================================
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 MITKTEMPOROSPATIALSTRINGPROPERTY_H_HEADER
#define MITKTEMPOROSPATIALSTRINGPROPERTY_H_HEADER
#include <itkConfigure.h>
#include "mitkBaseProperty.h"
#include <MitkCoreExports.h>
#include "mitkTimeGeometry.h"
#include <string>
namespace mitk
{
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4522)
#endif
/**
* @brief Property for time and space resolved string values
* @ingroup DataManagement
*/
class MITKCORE_EXPORT TemporoSpatialStringProperty : public BaseProperty
{
public:
typedef ::itk::IndexValueType IndexValueType;
typedef std::string ValueType;
mitkClassMacro(TemporoSpatialStringProperty, BaseProperty);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
mitkNewMacro1Param(TemporoSpatialStringProperty, const char*);
mitkNewMacro1Param(TemporoSpatialStringProperty, const std::string &);
/**Returns the value of the first time point in the first slice.
* If now value is set it returns an empty string.*/
ValueType GetValue() const;
/**Returns the value of the passed time step and slice. If it does not exist and allowedClosed is true
* it will look for the closest value. If nothing could be found an empty string will be returned.*/
ValueType GetValue(const TimeStepType &timeStep,
const IndexValueType &zSlice,
bool allowCloseTime = false,
bool allowCloseSlice = false) const;
ValueType GetValueBySlice(const IndexValueType &zSlice, bool allowClose = false) const;
ValueType GetValueByTimeStep(const TimeStepType &timeStep, bool allowClose = false) const;
bool HasValue() const;
bool HasValue(const TimeStepType &timeStep,
const IndexValueType &zSlice,
bool allowCloseTime = false,
bool allowCloseSlice = false) const;
bool HasValueBySlice(const IndexValueType &zSlice, bool allowClose = false) const;
bool HasValueByTimeStep(const TimeStepType &timeStep, bool allowClose = false) const;
/** return all slices stored for the specified timestep.*/
std::vector<IndexValueType> GetAvailableSlices(const TimeStepType& timeStep) const;
/** return all time steps stored for the specified slice.*/
std::vector<TimeStepType> GetAvailableTimeSteps(const IndexValueType& slice) const;
/** return all time steps stored in the property.*/
std::vector<TimeStepType> GetAvailableTimeSteps() const;
- /** return all slices stored in the property. @Remark not all time steps may contain all slices.*/
+ /** return all slices stored in the property. @remark not all time steps may contain all slices.*/
std::vector<IndexValueType> GetAvailableSlices() const;
void SetValue(const TimeStepType &timeStep, const IndexValueType &zSlice, const ValueType &value);
void SetValue(const ValueType &value);
std::string GetValueAsString() const override;
/** Inidicates of all values (all time steps, all slices) are the same, or if at least one value stored
in the property is different. If IsUniform==true one can i.a. use GetValueAsString() without the loss of
information to retrieve the stored value.*/
bool IsUniform() const;
using BaseProperty::operator=;
protected:
typedef std::map<IndexValueType, std::string> SliceMapType;
typedef std::map<TimeStepType, SliceMapType> TimeMapType;
TimeMapType m_Values;
TemporoSpatialStringProperty(const char *string = nullptr);
TemporoSpatialStringProperty(const std::string &s);
TemporoSpatialStringProperty(const TemporoSpatialStringProperty &);
std::pair<bool, ValueType> CheckValue(const TimeStepType &timeStep,
const IndexValueType &zSlice,
bool allowCloseTime = false,
bool allowCloseSlice = false) const;
private:
// purposely not implemented
TemporoSpatialStringProperty &operator=(const TemporoSpatialStringProperty &);
itk::LightObject::Pointer InternalClone() const override;
bool IsEqual(const BaseProperty &property) const override;
bool Assign(const BaseProperty &property) override;
};
namespace PropertyPersistenceSerialization
{
/** Serialization of a TemporoSpatialStringProperty into a JSON string.*/
MITKCORE_EXPORT::std::string serializeTemporoSpatialStringPropertyToJSON(const mitk::BaseProperty *prop);
}
namespace PropertyPersistenceDeserialization
{
/**Deserialize a passed JSON string into a TemporoSpatialStringProperty.*/
MITKCORE_EXPORT mitk::BaseProperty::Pointer deserializeJSONToTemporoSpatialStringProperty(const std::string &value);
}
#ifdef _MSC_VER
#pragma warning(pop)
#endif
} // namespace mitk
#endif
diff --git a/Modules/Core/include/mitkTransferFunction.h b/Modules/Core/include/mitkTransferFunction.h
index 4416927203..9bcd312590 100644
--- a/Modules/Core/include/mitkTransferFunction.h
+++ b/Modules/Core/include/mitkTransferFunction.h
@@ -1,195 +1,195 @@
/*============================================================================
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 MITK_TRANSFER_FUNCTION_H_HEADER_INCLUDED
#define MITK_TRANSFER_FUNCTION_H_HEADER_INCLUDED
#include "mitkHistogramGenerator.h"
#include "mitkImage.h"
#include <MitkCoreExports.h>
#include <itkHistogram.h>
#include <itkObject.h>
#include <itkRGBPixel.h>
#include <vtkColorTransferFunction.h>
#include <vtkPiecewiseFunction.h>
#include <vtkSmartPointer.h>
#include <algorithm>
#include <set>
#include <vector>
namespace mitk
{
/**
* @brief The TransferFunction class A wrapper class for VTK scalar opacity,
* gradient opacity, and color transfer functions.
* @ingroup DataManagement
*
* Holds a copy of each of the three standard VTK transfer functions (scalar
* opacity, gradient opacity, color) and provides an interface for manipulating
* their control points. Each original function can be retrieved by a Get()
* method.
*
* @note Currently, transfer function initialization based on histograms or
* computed-tomography-presets is also provided by this class, but will likely
* be separated into a specific initializer class.
*
* @note If you want to use this as a property for an mitk::Image, make sure
* to use the mitk::TransferFunctionProperty and set the mitk::RenderingModeProperty
* to a mode which supports transfer functions (e.g. COLORTRANSFERFUNCTION_COLOR).
* Make sure to check the documentation of the mitk::RenderingModeProperty. For a
* code example how to use the mitk::TransferFunction check the
- * mitkImageVtkMapper2DTransferFunctionTest.cpp in Core\Code\Testing.
+ * mitkImageVtkMapper2DTransferFunctionTest.cpp in Core/Code/Testing.
*/
class MITKCORE_EXPORT TransferFunction : public itk::Object
{
public:
typedef std::vector<std::pair<double, double>> ControlPoints;
typedef std::vector<std::pair<double, itk::RGBPixel<double>>> RGBControlPoints;
mitkClassMacroItkParent(TransferFunction, itk::DataObject);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/** \brief Get/Set min/max of transfer function range for initialization. */
itkSetMacro(Min, int);
/** \brief Get/Set min/max of transfer function range for initialization. */
itkSetMacro(Max, int);
/** \brief Get/Set min/max of transfer function range for initialization. */
itkGetMacro(Min, int);
/** \brief Get/Set min/max of transfer function range for initialization. */
itkGetMacro(Max, int);
/** \brief Get/Set wrapped vtk transfer function. */
itkGetMacro(ScalarOpacityFunction, vtkPiecewiseFunction *);
/** \brief Get/Set wrapped vtk transfer function. */
itkGetMacro(GradientOpacityFunction, vtkPiecewiseFunction *);
/** \brief Get/Set wrapped vtk transfer function. */
itkGetMacro(ColorTransferFunction, vtkColorTransferFunction *);
itkSetMacro(ColorTransferFunction, vtkSmartPointer<vtkColorTransferFunction>);
/** \brief Get histogram used for transfer function initialization. */
itkGetConstObjectMacro(Histogram, HistogramGenerator::HistogramType);
/** \brief Initialize transfer function based on the histogram of an mitk::Image. */
void InitializeByMitkImage(const mitk::Image *image);
/** \brief Initialize transfer function based on the specified histogram. */
void InitializeByItkHistogram(const itk::Statistics::Histogram<double> *histogram);
/** \brief Initialize the internal histogram and min/max range based on the
* specified mitk::Image. */
void InitializeHistogram(const mitk::Image *image);
/** \brief Insert control points and values into the scalar opacity transfer
* function. */
void SetScalarOpacityPoints(TransferFunction::ControlPoints points);
/** \brief Insert control points and values into the gradient opacity transfer
* function. */
void SetGradientOpacityPoints(TransferFunction::ControlPoints points);
/** \brief Insert control points and RGB values into the color transfer
* function. */
void SetRGBPoints(TransferFunction::RGBControlPoints rgbpoints);
/** \brief Add a single control point to the scalar opacity transfer function. */
void AddScalarOpacityPoint(double x, double value);
/** \brief Add a single control point to the gradient opacity transfer function. */
void AddGradientOpacityPoint(double x, double value);
/** \brief Add a single control point to the color opacity transfer function. */
void AddRGBPoint(double x, double r, double g, double b);
/** \brief Get a copy of the scalar opacity transfer function control-points. */
TransferFunction::ControlPoints &GetScalarOpacityPoints();
/** \brief Get a copy of the gradient opacity transfer function control-points. */
TransferFunction::ControlPoints &GetGradientOpacityPoints();
/** \brief Get a copy of the color transfer function control-points. */
TransferFunction::RGBControlPoints &GetRGBPoints();
/** \brief Remove the specified control point from the scalar opacity transfer
* function. */
int RemoveScalarOpacityPoint(double x);
/** \brief Remove the specified control point from the gradient opacity transfer
* function. */
int RemoveGradientOpacityPoint(double x);
/** \brief Remove the specified control point from the color transfer function. */
int RemoveRGBPoint(double x);
/** \brief Removes all control points from the scalar opacity transfer function. */
void ClearScalarOpacityPoints();
/** \brief Removes all control points from the gradient opacity transfer
* function. */
void ClearGradientOpacityPoints();
/** \brief Removes all control points from the color transfer function. */
void ClearRGBPoints();
bool operator==(Self &other);
protected:
TransferFunction();
~TransferFunction() override;
TransferFunction(const TransferFunction &other);
itk::LightObject::Pointer InternalClone() const override;
void PrintSelf(std::ostream &os, itk::Indent indent) const override;
/** Wrapped VTK scalar opacity transfer function */
vtkSmartPointer<vtkPiecewiseFunction> m_ScalarOpacityFunction;
/** Wrapped VTK gradient opacity transfer function */
vtkSmartPointer<vtkPiecewiseFunction> m_GradientOpacityFunction;
/** Wrapped VTK color transfer function */
vtkSmartPointer<vtkColorTransferFunction> m_ColorTransferFunction;
/** Current range of transfer function (used for initialization) */
int m_Min;
/** Current range of transfer function (used for initialization) */
int m_Max;
/** Specified or calculated histogram (used for initialization) */
mitk::HistogramGenerator::HistogramType::ConstPointer m_Histogram;
private:
/** Temporary STL style copy of VTK internal control points */
TransferFunction::ControlPoints m_ScalarOpacityPoints;
/** Temporary STL style copy of VTK internal control points */
TransferFunction::ControlPoints m_GradientOpacityPoints;
/** Temporary STL style copy of VTK internal control points */
TransferFunction::RGBControlPoints m_RGBPoints;
};
}
#endif /* MITK_TRANSFER_FUNCTION_H_HEADER_INCLUDED */
diff --git a/Modules/Core/include/mitkTransferFunctionProperty.h b/Modules/Core/include/mitkTransferFunctionProperty.h
index 2cb10185eb..4366e2ea8a 100644
--- a/Modules/Core/include/mitkTransferFunctionProperty.h
+++ b/Modules/Core/include/mitkTransferFunctionProperty.h
@@ -1,79 +1,79 @@
/*============================================================================
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 MITKTRANFERFUNCTIONPROPERTY_H_HEADER_INCLUDED
#define MITKTRANFERFUNCTIONPROPERTY_H_HEADER_INCLUDED
#include "mitkBaseProperty.h"
#include "mitkTransferFunction.h"
namespace mitk
{
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4522)
#endif
/**
* @brief The TransferFunctionProperty class Property class for the mitk::TransferFunction.
* @ingroup DataManagement
*
* @note If you want to use this property for an mitk::Image, make sure
* to set the mitk::RenderingModeProperty to a mode which supports transfer
* functions (e.g. COLORTRANSFERFUNCTION_COLOR). Make sure to check the
* documentation of the mitk::RenderingModeProperty. For a code example how
* to use the mitk::TransferFunction check the
- * mitkImageVtkMapper2DTransferFunctionTest.cpp in Core\Code\Testing.
+ * mitkImageVtkMapper2DTransferFunctionTest.cpp in Core/Code/Testing.
*/
class MITKCORE_EXPORT TransferFunctionProperty : public BaseProperty
{
public:
typedef mitk::TransferFunction::Pointer ValueType;
mitkClassMacro(TransferFunctionProperty, BaseProperty);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self)
mitkNewMacro1Param(TransferFunctionProperty, mitk::TransferFunction::Pointer);
itkSetMacro(Value, mitk::TransferFunction::Pointer);
itkGetConstMacro(Value, mitk::TransferFunction::Pointer);
std::string GetValueAsString() const override;
using BaseProperty::operator=;
protected:
mitk::TransferFunction::Pointer m_Value;
TransferFunctionProperty();
TransferFunctionProperty(const TransferFunctionProperty &other);
TransferFunctionProperty(mitk::TransferFunction::Pointer value);
private:
// purposely not implemented
TransferFunctionProperty &operator=(const TransferFunctionProperty &);
itk::LightObject::Pointer InternalClone() const override;
bool IsEqual(const BaseProperty &property) const override;
bool Assign(const BaseProperty &property) override;
};
#ifdef _MSC_VER
#pragma warning(pop)
#endif
} // namespace mitk
#endif /* MITKTRANFERFUNCTIONPROPERTY_H_HEADER_INCLUDED */
diff --git a/Modules/Core/src/IO/mitkIOUtil.cpp b/Modules/Core/src/IO/mitkIOUtil.cpp
index b26793be20..13be752926 100644
--- a/Modules/Core/src/IO/mitkIOUtil.cpp
+++ b/Modules/Core/src/IO/mitkIOUtil.cpp
@@ -1,1027 +1,1027 @@
/*============================================================================
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 "mitkIOUtil.h"
#include <mitkCoreObjectFactory.h>
#include <mitkCoreServices.h>
#include <mitkExceptionMacro.h>
#include <mitkFileReaderRegistry.h>
#include <mitkFileWriterRegistry.h>
#include <mitkIMimeTypeProvider.h>
#include <mitkProgressBar.h>
#include <mitkStandaloneDataStorage.h>
#include <usGetModuleContext.h>
#include <usLDAPProp.h>
#include <usModuleContext.h>
#include <usModuleResource.h>
#include <usModuleResourceStream.h>
#include <mitkAbstractFileReader.h>
// ITK
#include <itksys/SystemTools.hxx>
// VTK
#include <vtkPolyData.h>
#include <vtkSmartPointer.h>
#include <vtkTriangleFilter.h>
#include <cerrno>
#include <cstdlib>
static std::string GetLastErrorStr()
{
#ifdef US_PLATFORM_POSIX
return std::string(strerror(errno));
#else
// Retrieve the system error message for the last-error code
LPVOID lpMsgBuf;
DWORD dw = GetLastError();
FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
nullptr,
dw,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&lpMsgBuf,
0,
nullptr);
std::string errMsg((LPCTSTR)lpMsgBuf);
LocalFree(lpMsgBuf);
return errMsg;
#endif
}
#ifdef US_PLATFORM_WINDOWS
#include <direct.h>
#include <io.h>
// make the posix flags point to the obsolte bsd types on windows
#define S_IRUSR S_IREAD
#define S_IWUSR S_IWRITE
#else
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#endif
#include <fcntl.h>
#include <sys/stat.h>
static const char validLetters[] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
// A cross-platform version of the mkstemps function
static int mkstemps_compat(char *tmpl, int suffixlen)
{
static unsigned long long value = 0;
int savedErrno = errno;
// Lower bound on the number of temporary files to attempt to generate.
#define ATTEMPTS_MIN (62 * 62 * 62)
/* The number of times to attempt to generate a temporary file. To
conform to POSIX, this must be no smaller than TMP_MAX. */
#if ATTEMPTS_MIN < TMP_MAX
const unsigned int attempts = TMP_MAX;
#else
const unsigned int attempts = ATTEMPTS_MIN;
#endif
const int len = strlen(tmpl);
if ((len - suffixlen) < 6 || strncmp(&tmpl[len - 6 - suffixlen], "XXXXXX", 6))
{
errno = EINVAL;
return -1;
}
/* This is where the Xs start. */
char *XXXXXX = &tmpl[len - 6 - suffixlen];
/* Get some more or less random data. */
#ifdef US_PLATFORM_WINDOWS
{
SYSTEMTIME stNow;
FILETIME ftNow;
// get system time
GetSystemTime(&stNow);
stNow.wMilliseconds = 500;
if (!SystemTimeToFileTime(&stNow, &ftNow))
{
errno = -1;
return -1;
}
unsigned long long randomTimeBits = ((static_cast<unsigned long long>(ftNow.dwHighDateTime) << 32) |
static_cast<unsigned long long>(ftNow.dwLowDateTime));
value = randomTimeBits ^ static_cast<unsigned long long>(GetCurrentThreadId());
}
#else
{
struct timeval tv;
gettimeofday(&tv, nullptr);
unsigned long long randomTimeBits =
((static_cast<unsigned long long>(tv.tv_usec) << 32) | static_cast<unsigned long long>(tv.tv_sec));
value = randomTimeBits ^ static_cast<unsigned long long>(getpid());
}
#endif
for (unsigned int count = 0; count < attempts; value += 7777, ++count)
{
unsigned long long v = value;
/* Fill in the random bits. */
XXXXXX[0] = validLetters[v % 62];
v /= 62;
XXXXXX[1] = validLetters[v % 62];
v /= 62;
XXXXXX[2] = validLetters[v % 62];
v /= 62;
XXXXXX[3] = validLetters[v % 62];
v /= 62;
XXXXXX[4] = validLetters[v % 62];
v /= 62;
XXXXXX[5] = validLetters[v % 62];
int fd = open(tmpl, O_RDWR | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
if (fd >= 0)
{
errno = savedErrno;
return fd;
}
else if (errno != EEXIST)
{
return -1;
}
}
/* We got out of the loop because we ran out of combinations to try. */
errno = EEXIST;
return -1;
}
// A cross-platform version of the POSIX mkdtemp function
static char *mkdtemps_compat(char *tmpl, int suffixlen)
{
static unsigned long long value = 0;
int savedErrno = errno;
// Lower bound on the number of temporary dirs to attempt to generate.
#define ATTEMPTS_MIN (62 * 62 * 62)
/* The number of times to attempt to generate a temporary dir. To
conform to POSIX, this must be no smaller than TMP_MAX. */
#if ATTEMPTS_MIN < TMP_MAX
const unsigned int attempts = TMP_MAX;
#else
const unsigned int attempts = ATTEMPTS_MIN;
#endif
const int len = strlen(tmpl);
if ((len - suffixlen) < 6 || strncmp(&tmpl[len - 6 - suffixlen], "XXXXXX", 6))
{
errno = EINVAL;
return nullptr;
}
/* This is where the Xs start. */
char *XXXXXX = &tmpl[len - 6 - suffixlen];
/* Get some more or less random data. */
#ifdef US_PLATFORM_WINDOWS
{
SYSTEMTIME stNow;
FILETIME ftNow;
// get system time
GetSystemTime(&stNow);
stNow.wMilliseconds = 500;
if (!SystemTimeToFileTime(&stNow, &ftNow))
{
errno = -1;
return nullptr;
}
unsigned long long randomTimeBits = ((static_cast<unsigned long long>(ftNow.dwHighDateTime) << 32) |
static_cast<unsigned long long>(ftNow.dwLowDateTime));
value = randomTimeBits ^ static_cast<unsigned long long>(GetCurrentThreadId());
}
#else
{
struct timeval tv;
gettimeofday(&tv, nullptr);
unsigned long long randomTimeBits =
((static_cast<unsigned long long>(tv.tv_usec) << 32) | static_cast<unsigned long long>(tv.tv_sec));
value = randomTimeBits ^ static_cast<unsigned long long>(getpid());
}
#endif
unsigned int count = 0;
for (; count < attempts; value += 7777, ++count)
{
unsigned long long v = value;
/* Fill in the random bits. */
XXXXXX[0] = validLetters[v % 62];
v /= 62;
XXXXXX[1] = validLetters[v % 62];
v /= 62;
XXXXXX[2] = validLetters[v % 62];
v /= 62;
XXXXXX[3] = validLetters[v % 62];
v /= 62;
XXXXXX[4] = validLetters[v % 62];
v /= 62;
XXXXXX[5] = validLetters[v % 62];
#ifdef US_PLATFORM_WINDOWS
int fd = _mkdir(tmpl); //, _S_IREAD | _S_IWRITE | _S_IEXEC);
#else
int fd = mkdir(tmpl, S_IRUSR | S_IWUSR | S_IXUSR);
#endif
if (fd >= 0)
{
errno = savedErrno;
return tmpl;
}
else if (errno != EEXIST)
{
return nullptr;
}
}
/* We got out of the loop because we ran out of combinations to try. */
errno = EEXIST;
return nullptr;
}
//#endif
//**************************************************************
// mitk::IOUtil method definitions
namespace mitk
{
struct IOUtil::Impl
{
struct FixedReaderOptionsFunctor : public ReaderOptionsFunctorBase
{
FixedReaderOptionsFunctor(const IFileReader::Options &options) : m_Options(options) {}
bool operator()(LoadInfo &loadInfo) const override
{
IFileReader *reader = loadInfo.m_ReaderSelector.GetSelected().GetReader();
if (reader)
{
reader->SetOptions(m_Options);
}
return false;
}
private:
const IFileReader::Options &m_Options;
};
struct FixedWriterOptionsFunctor : public WriterOptionsFunctorBase
{
FixedWriterOptionsFunctor(const IFileReader::Options &options) : m_Options(options) {}
bool operator()(SaveInfo &saveInfo) const override
{
IFileWriter *writer = saveInfo.m_WriterSelector.GetSelected().GetWriter();
if (writer)
{
writer->SetOptions(m_Options);
}
return false;
}
private:
const IFileWriter::Options &m_Options;
};
static BaseData::Pointer LoadBaseDataFromFile(const std::string &path, const ReaderOptionsFunctorBase* optionsCallback = nullptr);
static void SetDefaultDataNodeProperties(mitk::DataNode *node, const std::string &filePath = std::string());
};
BaseData::Pointer IOUtil::Impl::LoadBaseDataFromFile(const std::string &path,
const ReaderOptionsFunctorBase *optionsCallback)
{
std::vector<BaseData::Pointer> baseDataList = Load(path, optionsCallback);
// The Load(path) call above should throw an exception if nothing could be loaded
assert(!baseDataList.empty());
return baseDataList.front();
}
#ifdef US_PLATFORM_WINDOWS
std::string IOUtil::GetProgramPath()
{
char path[512];
std::size_t index = std::string(path, GetModuleFileName(nullptr, path, 512)).find_last_of('\\');
return std::string(path, index);
}
#elif defined(US_PLATFORM_APPLE)
#include <mach-o/dyld.h>
std::string IOUtil::GetProgramPath()
{
char path[512];
uint32_t size = sizeof(path);
if (_NSGetExecutablePath(path, &size) == 0)
{
std::size_t index = std::string(path).find_last_of('/');
std::string strPath = std::string(path, index);
// const char* execPath = strPath.c_str();
// mitk::StandardFileLocations::GetInstance()->AddDirectoryForSearch(execPath,false);
return strPath;
}
return std::string();
}
#else
#include <sstream>
#include <sys/types.h>
#include <unistd.h>
std::string IOUtil::GetProgramPath()
{
std::stringstream ss;
ss << "/proc/" << getpid() << "/exe";
char proc[512] = {0};
ssize_t ch = readlink(ss.str().c_str(), proc, 512);
if (ch == -1)
return std::string();
std::size_t index = std::string(proc).find_last_of('/');
return std::string(proc, index);
}
#endif
char IOUtil::GetDirectorySeparator()
{
#ifdef US_PLATFORM_WINDOWS
return '\\';
#else
return '/';
#endif
}
std::string IOUtil::GetTempPath()
{
static std::string result;
if (result.empty())
{
#ifdef US_PLATFORM_WINDOWS
char tempPathTestBuffer[1];
DWORD bufferLength = ::GetTempPath(1, tempPathTestBuffer);
if (bufferLength == 0)
{
mitkThrow() << GetLastErrorStr();
}
std::vector<char> tempPath(bufferLength);
bufferLength = ::GetTempPath(bufferLength, &tempPath[0]);
if (bufferLength == 0)
{
mitkThrow() << GetLastErrorStr();
}
result.assign(tempPath.begin(), tempPath.begin() + static_cast<std::size_t>(bufferLength));
#else
result = "/tmp/";
#endif
}
return result;
}
std::string IOUtil::CreateTemporaryFile(const std::string &templateName, std::string path)
{
- ofstream tmpOutputStream;
+ std::ofstream tmpOutputStream;
std::string returnValue = CreateTemporaryFile(tmpOutputStream, templateName, path);
tmpOutputStream.close();
return returnValue;
}
std::string IOUtil::CreateTemporaryFile(std::ofstream &f, const std::string &templateName, std::string path)
{
return CreateTemporaryFile(f, std::ios_base::out | std::ios_base::trunc, templateName, path);
}
std::string IOUtil::CreateTemporaryFile(std::ofstream &f,
std::ios_base::openmode mode,
const std::string &templateName,
std::string path)
{
if (path.empty())
{
path = GetTempPath();
}
path += templateName;
std::vector<char> dst_path(path.begin(), path.end());
dst_path.push_back('\0');
std::size_t lastX = path.find_last_of('X');
std::size_t firstX = path.find_last_not_of('X', lastX);
int firstNonX = firstX == std::string::npos ? -1 : firstX - 1;
while (lastX != std::string::npos && (lastX - firstNonX) < 6)
{
lastX = path.find_last_of('X', firstX);
firstX = path.find_last_not_of('X', lastX);
firstNonX = firstX == std::string::npos ? -1 : firstX - 1;
}
std::size_t suffixlen = lastX == std::string::npos ? path.size() : path.size() - lastX - 1;
int fd = mkstemps_compat(&dst_path[0], suffixlen);
if (fd != -1)
{
path.assign(dst_path.begin(), dst_path.end() - 1);
f.open(path.c_str(), mode | std::ios_base::out | std::ios_base::trunc);
close(fd);
}
else
{
mitkThrow() << "Creating temporary file " << &dst_path[0] << " failed: " << GetLastErrorStr();
}
return path;
}
std::string IOUtil::CreateTemporaryDirectory(const std::string &templateName, std::string path)
{
if (path.empty())
{
path = GetTempPath();
}
path += GetDirectorySeparator() + templateName;
std::vector<char> dst_path(path.begin(), path.end());
dst_path.push_back('\0');
std::size_t lastX = path.find_last_of('X');
std::size_t firstX = path.find_last_not_of('X', lastX);
int firstNonX = firstX == std::string::npos ? -1 : firstX - 1;
while (lastX != std::string::npos && (lastX - firstNonX) < 6)
{
lastX = path.find_last_of('X', firstX);
firstX = path.find_last_not_of('X', lastX);
firstNonX = firstX == std::string::npos ? -1 : firstX - 1;
}
std::size_t suffixlen = lastX == std::string::npos ? path.size() : path.size() - lastX - 1;
if (mkdtemps_compat(&dst_path[0], suffixlen) == nullptr)
{
mitkThrow() << "Creating temporary directory " << &dst_path[0] << " failed: " << GetLastErrorStr();
}
path.assign(dst_path.begin(), dst_path.end() - 1);
return path;
}
DataStorage::SetOfObjects::Pointer IOUtil::Load(const std::string &path, DataStorage &storage, const ReaderOptionsFunctorBase *optionsCallback)
{
std::vector<std::string> paths;
paths.push_back(path);
return Load(paths, storage, optionsCallback);
}
DataStorage::SetOfObjects::Pointer IOUtil::Load(const std::string &path,
const IFileReader::Options &options,
DataStorage &storage)
{
std::vector<LoadInfo> loadInfos;
loadInfos.push_back(LoadInfo(path));
DataStorage::SetOfObjects::Pointer nodeResult = DataStorage::SetOfObjects::New();
Impl::FixedReaderOptionsFunctor optionsCallback(options);
std::string errMsg = Load(loadInfos, nodeResult, &storage, &optionsCallback);
if (!errMsg.empty())
{
mitkThrow() << errMsg;
}
return nodeResult;
}
std::vector<BaseData::Pointer> IOUtil::Load(const std::string &path, const ReaderOptionsFunctorBase *optionsCallback)
{
std::vector<std::string> paths;
paths.push_back(path);
return Load(paths, optionsCallback);
}
std::vector<BaseData::Pointer> IOUtil::Load(const std::string &path, const IFileReader::Options &options)
{
std::vector<LoadInfo> loadInfos;
loadInfos.push_back(LoadInfo(path));
Impl::FixedReaderOptionsFunctor optionsCallback(options);
std::string errMsg = Load(loadInfos, nullptr, nullptr, &optionsCallback);
if (!errMsg.empty())
{
mitkThrow() << errMsg;
}
return loadInfos.front().m_Output;
}
DataStorage::SetOfObjects::Pointer IOUtil::Load(const std::vector<std::string> &paths, DataStorage &storage, const ReaderOptionsFunctorBase *optionsCallback)
{
DataStorage::SetOfObjects::Pointer nodeResult = DataStorage::SetOfObjects::New();
std::vector<LoadInfo> loadInfos;
for (auto loadInfo : paths)
{
loadInfos.push_back(loadInfo);
}
std::string errMsg = Load(loadInfos, nodeResult, &storage, optionsCallback);
if (!errMsg.empty())
{
mitkThrow() << errMsg;
}
return nodeResult;
}
std::vector<BaseData::Pointer> IOUtil::Load(const std::vector<std::string> &paths, const ReaderOptionsFunctorBase *optionsCallback)
{
std::vector<BaseData::Pointer> result;
std::vector<LoadInfo> loadInfos;
for (auto loadInfo : paths)
{
loadInfos.push_back(loadInfo);
}
std::string errMsg = Load(loadInfos, nullptr, nullptr, optionsCallback);
if (!errMsg.empty())
{
mitkThrow() << errMsg;
}
for (std::vector<LoadInfo>::const_iterator iter = loadInfos.begin(), iterEnd = loadInfos.end(); iter != iterEnd;
++iter)
{
result.insert(result.end(), iter->m_Output.begin(), iter->m_Output.end());
}
return result;
}
std::string IOUtil::Load(std::vector<LoadInfo> &loadInfos,
DataStorage::SetOfObjects *nodeResult,
DataStorage *ds,
const ReaderOptionsFunctorBase *optionsCallback)
{
if (loadInfos.empty())
{
return "No input files given";
}
int filesToRead = loadInfos.size();
mitk::ProgressBar::GetInstance()->AddStepsToDo(2 * filesToRead);
std::string errMsg;
std::map<std::string, FileReaderSelector::Item> usedReaderItems;
std::vector< std::string > read_files;
for (auto &loadInfo : loadInfos)
{
if(std::find(read_files.begin(), read_files.end(), loadInfo.m_Path) != read_files.end())
continue;
std::vector<FileReaderSelector::Item> readers = loadInfo.m_ReaderSelector.Get();
if (readers.empty())
{
if (!itksys::SystemTools::FileExists(loadInfo.m_Path.c_str()))
{
errMsg += "File '" + loadInfo.m_Path + "' does not exist\n";
}
else
{
errMsg += "No reader available for '" + loadInfo.m_Path + "'\n";
}
continue;
}
bool callOptionsCallback = readers.size() > 1 || !readers.front().GetReader()->GetOptions().empty();
// check if we already used a reader which should be re-used
std::vector<MimeType> currMimeTypes = loadInfo.m_ReaderSelector.GetMimeTypes();
std::string selectedMimeType;
for (std::vector<MimeType>::const_iterator mimeTypeIter = currMimeTypes.begin(),
mimeTypeIterEnd = currMimeTypes.end();
mimeTypeIter != mimeTypeIterEnd;
++mimeTypeIter)
{
std::map<std::string, FileReaderSelector::Item>::const_iterator oldSelectedItemIter =
usedReaderItems.find(mimeTypeIter->GetName());
if (oldSelectedItemIter != usedReaderItems.end())
{
// we found an already used item for a mime-type which is contained
// in the current reader set, check all current readers if there service
// id equals the old reader
for (std::vector<FileReaderSelector::Item>::const_iterator currReaderItem = readers.begin(),
currReaderItemEnd = readers.end();
currReaderItem != currReaderItemEnd;
++currReaderItem)
{
if (currReaderItem->GetMimeType().GetName() == mimeTypeIter->GetName() &&
currReaderItem->GetServiceId() == oldSelectedItemIter->second.GetServiceId() &&
currReaderItem->GetConfidenceLevel() >= oldSelectedItemIter->second.GetConfidenceLevel())
{
// okay, we used the same reader already, re-use its options
selectedMimeType = mimeTypeIter->GetName();
callOptionsCallback = false;
loadInfo.m_ReaderSelector.Select(oldSelectedItemIter->second.GetServiceId());
loadInfo.m_ReaderSelector.GetSelected().GetReader()->SetOptions(
oldSelectedItemIter->second.GetReader()->GetOptions());
break;
}
}
if (!selectedMimeType.empty())
break;
}
}
if (callOptionsCallback && optionsCallback)
{
callOptionsCallback = (*optionsCallback)(loadInfo);
if (!callOptionsCallback && !loadInfo.m_Cancel)
{
usedReaderItems.erase(selectedMimeType);
FileReaderSelector::Item selectedItem = loadInfo.m_ReaderSelector.GetSelected();
usedReaderItems.insert(std::make_pair(selectedItem.GetMimeType().GetName(), selectedItem));
}
}
if (loadInfo.m_Cancel)
{
errMsg += "Reading operation(s) cancelled.";
break;
}
IFileReader *reader = loadInfo.m_ReaderSelector.GetSelected().GetReader();
if (reader == nullptr)
{
errMsg += "Unexpected nullptr reader.";
break;
}
// Do the actual reading
try
{
DataStorage::SetOfObjects::Pointer nodes;
if (ds != nullptr)
{
nodes = reader->Read(*ds);
std::vector< std::string > new_files = reader->GetReadFiles();
read_files.insert( read_files.end(), new_files.begin(), new_files.end() );
}
else
{
nodes = DataStorage::SetOfObjects::New();
std::vector<mitk::BaseData::Pointer> baseData = reader->Read();
for (auto iter = baseData.begin(); iter != baseData.end(); ++iter)
{
if (iter->IsNotNull())
{
mitk::DataNode::Pointer node = mitk::DataNode::New();
node->SetData(*iter);
nodes->InsertElement(nodes->Size(), node);
}
}
std::vector< std::string > new_files = reader->GetReadFiles();
read_files.insert( read_files.end(), new_files.begin(), new_files.end() );
}
for (DataStorage::SetOfObjects::ConstIterator nodeIter = nodes->Begin(), nodeIterEnd = nodes->End();
nodeIter != nodeIterEnd;
++nodeIter)
{
const mitk::DataNode::Pointer &node = nodeIter->Value();
mitk::BaseData::Pointer data = node->GetData();
if (data.IsNull())
{
continue;
}
mitk::StringProperty::Pointer pathProp = mitk::StringProperty::New(loadInfo.m_Path);
data->SetProperty("path", pathProp);
loadInfo.m_Output.push_back(data);
if (nodeResult)
{
nodeResult->push_back(nodeIter->Value());
}
}
if (loadInfo.m_Output.empty() || (nodeResult && nodeResult->Size() == 0))
{
errMsg += "Unknown read error occurred reading " + loadInfo.m_Path;
}
}
catch (const std::exception &e)
{
errMsg += "Exception occured when reading file " + loadInfo.m_Path + ":\n" + e.what() + "\n\n";
}
mitk::ProgressBar::GetInstance()->Progress(2);
--filesToRead;
}
if (!errMsg.empty())
{
MITK_ERROR << errMsg;
}
mitk::ProgressBar::GetInstance()->Progress(2 * filesToRead);
return errMsg;
}
std::vector<BaseData::Pointer> IOUtil::Load(const us::ModuleResource &usResource, std::ios_base::openmode mode)
{
us::ModuleResourceStream resStream(usResource, mode);
mitk::CoreServicePointer<mitk::IMimeTypeProvider> mimeTypeProvider(mitk::CoreServices::GetMimeTypeProvider());
std::vector<MimeType> mimetypes = mimeTypeProvider->GetMimeTypesForFile(usResource.GetResourcePath());
std::vector<mitk::BaseData::Pointer> data;
if (mimetypes.empty())
{
mitkThrow() << "No mimetype for resource stream: " << usResource.GetResourcePath();
return data;
}
mitk::FileReaderRegistry fileReaderRegistry;
std::vector<us::ServiceReference<IFileReader>> refs = fileReaderRegistry.GetReferences(mimetypes[0]);
if (refs.empty())
{
mitkThrow() << "No reader available for resource stream: " << usResource.GetResourcePath();
return data;
}
mitk::IFileReader *reader = fileReaderRegistry.GetReader(refs[0]);
reader->SetInput(usResource.GetResourcePath(), &resStream);
data = reader->Read();
return data;
}
void IOUtil::Save(const BaseData *data, const std::string &path, bool setPathProperty) { Save(data, path, IFileWriter::Options(), setPathProperty); }
void IOUtil::Save(const BaseData *data, const std::string &path, const IFileWriter::Options &options, bool setPathProperty)
{
Save(data, std::string(), path, options, setPathProperty);
}
void IOUtil::Save(const BaseData *data, const std::string &mimeType, const std::string &path, bool addExtension, bool setPathProperty)
{
Save(data, mimeType, path, IFileWriter::Options(), addExtension, setPathProperty);
}
void IOUtil::Save(const BaseData *data,
const std::string &mimeType,
const std::string &path,
const IFileWriter::Options &options,
bool addExtension,
bool setPathProperty)
{
if ((data == nullptr) || (data->IsEmpty()))
mitkThrow() << "BaseData cannotbe null or empty for save methods in IOUtil.h.";
std::string errMsg;
if (options.empty())
{
errMsg = Save(data, mimeType, path, nullptr, addExtension, setPathProperty);
}
else
{
Impl::FixedWriterOptionsFunctor optionsCallback(options);
errMsg = Save(data, mimeType, path, &optionsCallback, addExtension, setPathProperty);
}
if (!errMsg.empty())
{
mitkThrow() << errMsg;
}
}
void IOUtil::Save(std::vector<IOUtil::SaveInfo> &saveInfos, bool setPathProperty)
{
std::string errMsg = Save(saveInfos, nullptr, setPathProperty);
if (!errMsg.empty())
{
mitkThrow() << errMsg;
}
}
std::string IOUtil::Save(const BaseData *data,
const std::string &mimeTypeName,
const std::string &path,
WriterOptionsFunctorBase *optionsCallback,
bool addExtension,
bool setPathProperty)
{
if (path.empty())
{
return "No output filename given";
}
mitk::CoreServicePointer<mitk::IMimeTypeProvider> mimeTypeProvider(mitk::CoreServices::GetMimeTypeProvider());
MimeType mimeType = mimeTypeProvider->GetMimeTypeForName(mimeTypeName);
SaveInfo saveInfo(data, mimeType, path);
std::string ext = itksys::SystemTools::GetFilenameExtension(path);
if (saveInfo.m_WriterSelector.IsEmpty())
{
return std::string("No suitable writer found for the current data of type ") + data->GetNameOfClass() +
(mimeType.IsValid() ? (std::string(" and mime-type ") + mimeType.GetName()) : std::string()) +
(ext.empty() ? std::string() : (std::string(" with extension ") + ext));
}
// Add an extension if not already specified
if (ext.empty() && addExtension)
{
saveInfo.m_MimeType.GetExtensions().empty() ? std::string() : "." + saveInfo.m_MimeType.GetExtensions().front();
}
std::vector<SaveInfo> infos;
infos.push_back(saveInfo);
return Save(infos, optionsCallback, setPathProperty);
}
std::string IOUtil::Save(std::vector<SaveInfo> &saveInfos, WriterOptionsFunctorBase *optionsCallback, bool setPathProperty)
{
if (saveInfos.empty())
{
return "No data for saving available";
}
int filesToWrite = saveInfos.size();
mitk::ProgressBar::GetInstance()->AddStepsToDo(2 * filesToWrite);
std::string errMsg;
std::set<SaveInfo> usedSaveInfos;
for (auto &saveInfo : saveInfos)
{
const std::string baseDataType = saveInfo.m_BaseData->GetNameOfClass();
std::vector<FileWriterSelector::Item> writers = saveInfo.m_WriterSelector.Get();
// Error out if no compatible Writer was found
if (writers.empty())
{
errMsg += std::string("No writer available for ") + baseDataType + " data.\n";
continue;
}
bool callOptionsCallback = writers.size() > 1 || !writers[0].GetWriter()->GetOptions().empty();
// check if we already used a writer for this base data type
// which should be re-used
auto oldSaveInfoIter = usedSaveInfos.find(saveInfo);
if (oldSaveInfoIter != usedSaveInfos.end())
{
// we previously saved a base data object of the same data with the same mime-type,
// check if the same writer is contained in the current writer set and if the
// confidence level matches
FileWriterSelector::Item oldSelectedItem =
oldSaveInfoIter->m_WriterSelector.Get(oldSaveInfoIter->m_WriterSelector.GetSelectedId());
for (std::vector<FileWriterSelector::Item>::const_iterator currWriterItem = writers.begin(),
currWriterItemEnd = writers.end();
currWriterItem != currWriterItemEnd;
++currWriterItem)
{
if (currWriterItem->GetServiceId() == oldSelectedItem.GetServiceId() &&
currWriterItem->GetConfidenceLevel() >= oldSelectedItem.GetConfidenceLevel())
{
// okay, we used the same writer already, re-use its options
callOptionsCallback = false;
saveInfo.m_WriterSelector.Select(oldSaveInfoIter->m_WriterSelector.GetSelectedId());
saveInfo.m_WriterSelector.GetSelected().GetWriter()->SetOptions(oldSelectedItem.GetWriter()->GetOptions());
break;
}
}
}
if (callOptionsCallback && optionsCallback)
{
callOptionsCallback = (*optionsCallback)(saveInfo);
if (!callOptionsCallback && !saveInfo.m_Cancel)
{
usedSaveInfos.erase(saveInfo);
usedSaveInfos.insert(saveInfo);
}
}
if (saveInfo.m_Cancel)
{
errMsg += "Writing operation(s) cancelled.";
break;
}
IFileWriter *writer = saveInfo.m_WriterSelector.GetSelected().GetWriter();
if (writer == nullptr)
{
errMsg += "Unexpected nullptr writer.";
break;
}
// Do the actual writing
try
{
writer->SetOutputLocation(saveInfo.m_Path);
writer->Write();
}
catch (const std::exception &e)
{
errMsg += std::string("Exception occurred when writing to ") + saveInfo.m_Path + ":\n" + e.what() + "\n";
}
if (setPathProperty)
saveInfo.m_BaseData->GetPropertyList()->SetStringProperty("path", saveInfo.m_Path.c_str());
mitk::ProgressBar::GetInstance()->Progress(2);
--filesToWrite;
}
if (!errMsg.empty())
{
MITK_ERROR << errMsg;
}
mitk::ProgressBar::GetInstance()->Progress(2 * filesToWrite);
return errMsg;
}
// This method can be removed after the deprecated LoadDataNode() method was removed
void IOUtil::Impl::SetDefaultDataNodeProperties(DataNode *node, const std::string &filePath)
{
// path
mitk::StringProperty::Pointer pathProp = mitk::StringProperty::New(itksys::SystemTools::GetFilenamePath(filePath));
node->SetProperty(StringProperty::PATH, pathProp);
// name already defined?
mitk::StringProperty::Pointer nameProp = dynamic_cast<mitk::StringProperty *>(node->GetProperty("name"));
if (nameProp.IsNull() || nameProp->GetValue() == DataNode::NO_NAME_VALUE())
{
// name already defined in BaseData
mitk::StringProperty::Pointer baseDataNameProp =
dynamic_cast<mitk::StringProperty *>(node->GetData()->GetProperty("name").GetPointer());
if (baseDataNameProp.IsNull() || baseDataNameProp->GetValue() == DataNode::NO_NAME_VALUE())
{
// name neither defined in node, nor in BaseData -> name = filename
nameProp = mitk::StringProperty::New(itksys::SystemTools::GetFilenameWithoutExtension(filePath));
node->SetProperty("name", nameProp);
}
else
{
// name defined in BaseData!
nameProp = mitk::StringProperty::New(baseDataNameProp->GetValue());
node->SetProperty("name", nameProp);
}
}
// visibility
if (!node->GetProperty("visible"))
{
node->SetVisibility(true);
}
}
IOUtil::SaveInfo::SaveInfo(const BaseData *baseData, const MimeType &mimeType, const std::string &path)
: m_BaseData(baseData),
m_WriterSelector(baseData, mimeType.GetName(), path),
m_MimeType(mimeType.IsValid() ? mimeType // use the original mime-type
:
(m_WriterSelector.IsEmpty() ?
mimeType // no writer found, use the original invalid mime-type
:
m_WriterSelector.GetDefault().GetMimeType() // use the found default mime-type
)),
m_Path(path),
m_Cancel(false)
{
}
bool IOUtil::SaveInfo::operator<(const IOUtil::SaveInfo &other) const
{
int r = strcmp(m_BaseData->GetNameOfClass(), other.m_BaseData->GetNameOfClass());
if (r == 0)
{
return m_WriterSelector.GetSelected().GetMimeType() < other.m_WriterSelector.GetSelected().GetMimeType();
}
return r < 0;
}
IOUtil::LoadInfo::LoadInfo(const std::string &path) : m_Path(path), m_ReaderSelector(path), m_Cancel(false) {}
}
diff --git a/Modules/Core/src/IO/mitkSurfaceStlIO.cpp b/Modules/Core/src/IO/mitkSurfaceStlIO.cpp
index e64e9a1634..21aeb441e0 100644
--- a/Modules/Core/src/IO/mitkSurfaceStlIO.cpp
+++ b/Modules/Core/src/IO/mitkSurfaceStlIO.cpp
@@ -1,160 +1,160 @@
/*============================================================================
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 "mitkSurfaceStlIO.h"
#include "mitkIOMimeTypes.h"
#include "mitkLocaleSwitch.h"
#include "mitkSurface.h"
#include <vtkCleanPolyData.h>
#include <vtkErrorCode.h>
#include <vtkPolyDataNormals.h>
#include <vtkSTLReader.h>
#include <vtkSTLWriter.h>
#include <vtkSmartPointer.h>
#include <vtkTriangleFilter.h>
namespace mitk
{
- std::string SurfaceStlIO::OPTION_MERGE_POINTS()
- {
- static std::string s = "Merge points";
- return s;
- }
+ // std::string SurfaceStlIO::OPTION_MERGE_POINTS()
+ // {
+ // static std::string s = "Merge points";
+ // return s;
+ // }
std::string SurfaceStlIO::OPTION_TAG_SOLIDS()
{
static std::string s = "Tag solids";
return s;
}
std::string SurfaceStlIO::OPTION_CLEAN()
{
static std::string s = "Clean poly data";
return s;
}
SurfaceStlIO::SurfaceStlIO()
: SurfaceVtkIO(Surface::GetStaticNameOfClass(), IOMimeTypes::STEREOLITHOGRAPHY_MIMETYPE(), "Stereolithography")
{
Options defaultOptions;
- defaultOptions[OPTION_MERGE_POINTS()] = us::Any(true);
+ // defaultOptions[OPTION_MERGE_POINTS()] = us::Any(true);
defaultOptions[OPTION_TAG_SOLIDS()] = us::Any(false);
defaultOptions[OPTION_CLEAN()] = us::Any(true);
this->SetDefaultReaderOptions(defaultOptions);
this->RegisterService();
}
std::vector<itk::SmartPointer<BaseData>> SurfaceStlIO::DoRead()
{
LocaleSwitch localeSwitch("C");
Options options = this->GetReaderOptions();
mitk::Surface::Pointer output = mitk::Surface::New();
vtkSmartPointer<vtkSTLReader> stlReader = vtkSmartPointer<vtkSTLReader>::New();
stlReader->SetFileName(this->GetLocalFileName().c_str());
- bool mergePoints = true;
+ // bool mergePoints = true;
bool tagSolids = false;
bool cleanData = true;
try
{
- mergePoints = us::any_cast<bool>(options[OPTION_MERGE_POINTS()]);
+ // mergePoints = us::any_cast<bool>(options[OPTION_MERGE_POINTS()]);
tagSolids = us::any_cast<bool>(options[OPTION_TAG_SOLIDS()]);
cleanData = us::any_cast<bool>(options[OPTION_CLEAN()]);
}
catch (const us::BadAnyCastException &e)
{
MITK_WARN << "Unexpected error: " << e.what();
}
- stlReader->SetMerging(mergePoints);
+ // stlReader->SetMerging(mergePoints);
stlReader->SetScalarTags(tagSolids);
vtkSmartPointer<vtkPolyDataNormals> normalsGenerator = vtkSmartPointer<vtkPolyDataNormals>::New();
normalsGenerator->SetInputConnection(stlReader->GetOutputPort());
vtkSmartPointer<vtkPolyDataAlgorithm> algo = normalsGenerator;
if (cleanData)
{
vtkSmartPointer<vtkCleanPolyData> cleanPolyDataFilter = vtkSmartPointer<vtkCleanPolyData>::New();
cleanPolyDataFilter->SetInputConnection(normalsGenerator->GetOutputPort());
cleanPolyDataFilter->PieceInvariantOff();
cleanPolyDataFilter->ConvertLinesToPointsOff();
cleanPolyDataFilter->ConvertPolysToLinesOff();
cleanPolyDataFilter->ConvertStripsToPolysOff();
- if (mergePoints)
- {
+ // if (mergePoints)
+ // {
cleanPolyDataFilter->PointMergingOn();
- }
+ // }
algo = cleanPolyDataFilter;
}
algo->Update();
if (algo->GetOutput() != nullptr)
{
vtkSmartPointer<vtkPolyData> surfaceWithNormals = algo->GetOutput();
output->SetVtkPolyData(surfaceWithNormals);
}
std::vector<BaseData::Pointer> result;
result.push_back(output.GetPointer());
return result;
}
void SurfaceStlIO::Write()
{
LocaleSwitch localeSwitch("C");
ValidateOutputLocation();
const auto *input = dynamic_cast<const Surface *>(this->GetInput());
const unsigned int timesteps = input->GetTimeGeometry()->CountTimeSteps();
for (unsigned int t = 0; t < timesteps; ++t)
{
std::string fileName;
vtkSmartPointer<vtkPolyData> polyData = this->GetPolyData(t, fileName);
vtkSmartPointer<vtkTriangleFilter> triangleFilter = vtkSmartPointer<vtkTriangleFilter>::New();
triangleFilter->SetInputData(polyData);
vtkSmartPointer<vtkSTLWriter> writer = vtkSmartPointer<vtkSTLWriter>::New();
writer->SetInputConnection(triangleFilter->GetOutputPort());
// The vtk stl writer cannot write to streams
LocalFile localFile(this);
writer->SetFileName(localFile.GetFileName().c_str());
if (writer->Write() == 0 || writer->GetErrorCode() != 0)
{
mitkThrow() << "Error during surface writing"
<< (writer->GetErrorCode() ?
std::string(": ") + vtkErrorCode::GetStringFromErrorCode(writer->GetErrorCode()) :
std::string());
}
if (this->GetOutputStream() && input->GetTimeGeometry()->CountTimeSteps() > 1)
{
MITK_WARN << "Writing multiple time-steps to output streams is not supported. "
<< "Only the first time-step will be written";
break;
}
}
}
SurfaceStlIO *SurfaceStlIO::IOClone() const { return new SurfaceStlIO(*this); }
}
diff --git a/Modules/Core/src/IO/mitkSurfaceStlIO.h b/Modules/Core/src/IO/mitkSurfaceStlIO.h
index ffe36e1e60..2e95e8ab2e 100644
--- a/Modules/Core/src/IO/mitkSurfaceStlIO.h
+++ b/Modules/Core/src/IO/mitkSurfaceStlIO.h
@@ -1,45 +1,47 @@
/*============================================================================
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 _MITK_SURFACE_STL_IO_H_
#define _MITK_SURFACE_STL_IO_H_
#include "mitkSurfaceVtkIO.h"
namespace mitk
{
class SurfaceStlIO : public mitk::SurfaceVtkIO
{
public:
SurfaceStlIO();
// -------------- AbstractFileReader -------------
using AbstractFileReader::Read;
// -------------- AbstractFileWriter -------------
void Write() override;
protected:
std::vector<itk::SmartPointer<BaseData>> DoRead() override;
private:
SurfaceStlIO *IOClone() const override;
- static std::string OPTION_MERGE_POINTS();
+ // vtkSTLReader crashes with this option
+ // static std::string OPTION_MERGE_POINTS();
+
static std::string OPTION_TAG_SOLIDS();
static std::string OPTION_CLEAN();
};
}
#endif //_MITK_SURFACE_STL_IO_H_
diff --git a/Modules/Core/src/Interactions/mitkSinglePointDataInteractor.cpp b/Modules/Core/src/Interactions/mitkSinglePointDataInteractor.cpp
index de8540d84d..d15c92a1df 100644
--- a/Modules/Core/src/Interactions/mitkSinglePointDataInteractor.cpp
+++ b/Modules/Core/src/Interactions/mitkSinglePointDataInteractor.cpp
@@ -1,102 +1,106 @@
/*============================================================================
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 "mitkSinglePointDataInteractor.h"
#include "mitkMouseMoveEvent.h"
#include "mitkInteractionConst.h" // TODO: refactor file
#include "mitkInternalEvent.h"
#include "mitkOperationEvent.h"
#include "mitkRenderingManager.h"
#include <mitkPointOperation.h>
//
#include "mitkBaseRenderer.h"
#include "mitkDispatcher.h"
#include "mitkUndoController.h"
mitk::SinglePointDataInteractor::SinglePointDataInteractor()
{
this->SetMaxPoints(1);
}
mitk::SinglePointDataInteractor::~SinglePointDataInteractor()
{
}
void mitk::SinglePointDataInteractor::AddPoint(StateMachineAction * /*stateMachineAction*/,
InteractionEvent *interactionEvent)
{
unsigned int timeStep = interactionEvent->GetSender()->GetTimeStep(GetDataNode()->GetData());
ScalarType timeInMs = interactionEvent->GetSender()->GetTime();
// To add a point the minimal information is the position, this method accepts all InteractionsPositionEvents
auto *positionEvent = dynamic_cast<InteractionPositionEvent *>(interactionEvent);
if (positionEvent != nullptr)
{
PointOperation *doOp;
PointOperation *undoOp;
if (m_PointSet->IndexExists(0, timeStep))
{
PointSet::PointType pt = m_PointSet->GetPoint(0, timeStep);
Point3D itkPoint;
itkPoint[0] = pt[0];
itkPoint[1] = pt[1];
itkPoint[2] = pt[2];
doOp = new mitk::PointOperation(OpMOVE, timeInMs, positionEvent->GetPositionInWorld(), 0);
undoOp = new mitk::PointOperation(OpMOVE, timeInMs, itkPoint, 0);
}
else
{
doOp = new mitk::PointOperation(OpINSERT, timeInMs, positionEvent->GetPositionInWorld(), 0);
undoOp = new mitk::PointOperation(OpREMOVE, timeInMs, positionEvent->GetPositionInWorld(), 0);
}
if (m_UndoEnabled)
{
OperationEvent *operationEvent = new OperationEvent(m_PointSet, doOp, undoOp, "Move point");
OperationEvent::IncCurrObjectEventId();
m_UndoController->SetOperationEvent(operationEvent);
}
// execute the Operation
m_PointSet->ExecuteOperation(doOp);
if (!m_UndoEnabled)
delete doOp;
RenderingManager::GetInstance()->RequestUpdateAll();
}
}
/*
* Check whether the DataNode contains a pointset, if not create one and add it.
*/
void mitk::SinglePointDataInteractor::DataNodeChanged()
{
if (GetDataNode() != nullptr)
{
auto *points = dynamic_cast<PointSet *>(GetDataNode()->GetData());
if (points == nullptr)
{
m_PointSet = PointSet::New();
GetDataNode()->SetData(m_PointSet);
}
else
{
points->Clear();
m_PointSet = points;
}
}
}
+
+void mitk::SinglePointDataInteractor::SetMaxPoints(unsigned int)
+{
+}
diff --git a/Modules/Core/src/Rendering/mitkPlaneGeometryDataVtkMapper3D.cpp b/Modules/Core/src/Rendering/mitkPlaneGeometryDataVtkMapper3D.cpp
index 7f8b7029e7..4db486904d 100644
--- a/Modules/Core/src/Rendering/mitkPlaneGeometryDataVtkMapper3D.cpp
+++ b/Modules/Core/src/Rendering/mitkPlaneGeometryDataVtkMapper3D.cpp
@@ -1,580 +1,582 @@
/*============================================================================
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 "mitkPlaneGeometryDataVtkMapper3D.h"
#include "mitkImageVtkMapper2D.h"
#include "mitkNodePredicateDataType.h"
#include "mitkNodePredicateOr.h"
#include "mitkSmartPointerProperty.h"
#include "mitkSurface.h"
#include "mitkVtkRepresentationProperty.h"
#include "mitkWeakPointerProperty.h"
#include "vtkMitkLevelWindowFilter.h"
#include "vtkNeverTranslucentTexture.h"
#include <vtkAssembly.h>
#include <vtkDataSetMapper.h>
#include <vtkFeatureEdges.h>
#include <vtkHedgeHog.h>
#include <vtkImageData.h>
#include <vtkLinearTransform.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkProp3DCollection.h>
#include <vtkProperty.h>
#include <vtkTransformPolyDataFilter.h>
#include <vtkTubeFilter.h>
namespace mitk
{
PlaneGeometryDataVtkMapper3D::PlaneGeometryDataVtkMapper3D() : m_NormalsActorAdded(false), m_DataStorage(nullptr)
{
m_EdgeTuber = vtkTubeFilter::New();
m_EdgeMapper = vtkPolyDataMapper::New();
m_SurfaceCreator = PlaneGeometryDataToSurfaceFilter::New();
m_SurfaceCreatorBoundingBox = BoundingBox::New();
m_SurfaceCreatorPointsContainer = BoundingBox::PointsContainer::New();
m_Edges = vtkFeatureEdges::New();
m_Edges->BoundaryEdgesOn();
m_Edges->FeatureEdgesOff();
m_Edges->NonManifoldEdgesOff();
m_Edges->ManifoldEdgesOff();
m_EdgeTransformer = vtkTransformPolyDataFilter::New();
m_NormalsTransformer = vtkTransformPolyDataFilter::New();
m_EdgeActor = vtkActor::New();
m_BackgroundMapper = vtkPolyDataMapper::New();
m_BackgroundActor = vtkActor::New();
m_Prop3DAssembly = vtkAssembly::New();
m_ImageAssembly = vtkAssembly::New();
m_SurfaceCreatorBoundingBox->SetPoints(m_SurfaceCreatorPointsContainer);
m_Cleaner = vtkCleanPolyData::New();
m_Cleaner->PieceInvariantOn();
m_Cleaner->ConvertLinesToPointsOn();
m_Cleaner->ConvertPolysToLinesOn();
m_Cleaner->ConvertStripsToPolysOn();
m_Cleaner->PointMergingOn();
// Make sure that the FeatureEdge algorithm is initialized with a "valid"
// (though empty) input
vtkPolyData *emptyPolyData = vtkPolyData::New();
m_Cleaner->SetInputData(emptyPolyData);
emptyPolyData->Delete();
m_Edges->SetInputConnection(m_Cleaner->GetOutputPort());
m_EdgeTransformer->SetInputConnection(m_Edges->GetOutputPort());
m_EdgeTuber->SetInputConnection(m_EdgeTransformer->GetOutputPort());
m_EdgeTuber->SetVaryRadiusToVaryRadiusOff();
m_EdgeTuber->SetNumberOfSides(12);
m_EdgeTuber->CappingOn();
m_EdgeMapper->SetInputConnection(m_EdgeTuber->GetOutputPort());
m_EdgeMapper->ScalarVisibilityOff();
m_BackgroundMapper->SetInputData(emptyPolyData);
m_BackgroundMapper->Update();
m_EdgeActor->SetMapper(m_EdgeMapper);
m_BackgroundActor->GetProperty()->SetAmbient(0.5);
m_BackgroundActor->GetProperty()->SetColor(0.0, 0.0, 0.0);
m_BackgroundActor->GetProperty()->SetOpacity(0.0);
m_BackgroundActor->SetMapper(m_BackgroundMapper);
vtkProperty *backfaceProperty = m_BackgroundActor->MakeProperty();
backfaceProperty->SetColor(0.0, 0.0, 0.0);
m_BackgroundActor->SetBackfaceProperty(backfaceProperty);
backfaceProperty->Delete();
m_FrontHedgeHog = vtkHedgeHog::New();
m_BackHedgeHog = vtkHedgeHog::New();
m_FrontNormalsMapper = vtkPolyDataMapper::New();
m_FrontNormalsMapper->SetInputConnection(m_FrontHedgeHog->GetOutputPort());
m_BackNormalsMapper = vtkPolyDataMapper::New();
m_Prop3DAssembly->AddPart(m_EdgeActor);
m_Prop3DAssembly->AddPart(m_ImageAssembly);
m_FrontNormalsActor = vtkActor::New();
m_FrontNormalsActor->SetMapper(m_FrontNormalsMapper);
m_BackNormalsActor = vtkActor::New();
m_BackNormalsActor->SetMapper(m_BackNormalsMapper);
m_ImageMapperDeletedCommand = MemberCommandType::New();
m_ImageMapperDeletedCommand->SetCallbackFunction(this, &PlaneGeometryDataVtkMapper3D::ImageMapperDeletedCallback);
}
PlaneGeometryDataVtkMapper3D::~PlaneGeometryDataVtkMapper3D()
{
m_ImageAssembly->Delete();
m_Prop3DAssembly->Delete();
m_EdgeTuber->Delete();
m_EdgeMapper->Delete();
m_EdgeTransformer->Delete();
m_Cleaner->Delete();
m_Edges->Delete();
m_NormalsTransformer->Delete();
m_EdgeActor->Delete();
m_BackgroundMapper->Delete();
m_BackgroundActor->Delete();
m_FrontNormalsMapper->Delete();
m_FrontNormalsActor->Delete();
m_FrontHedgeHog->Delete();
m_BackNormalsMapper->Delete();
m_BackNormalsActor->Delete();
m_BackHedgeHog->Delete();
for (auto it = m_ImageActors.begin(); it != m_ImageActors.end(); ++it)
it->second.m_Actor->ReleaseGraphicsResources(nullptr);
// Delete entries in m_ImageActors list one by one
m_ImageActors.clear();
m_DataStorage = nullptr;
}
vtkProp *PlaneGeometryDataVtkMapper3D::GetVtkProp(mitk::BaseRenderer * /*renderer*/)
{
if ((this->GetDataNode() != nullptr) && (m_ImageAssembly != nullptr))
{
// Do not transform the entire Prop3D assembly, but only the image part
// here. The colored frame is transformed elsewhere (via m_EdgeTransformer),
// since only vertices should be transformed there, not the poly data
// itself, to avoid distortion for anisotropic datasets.
m_ImageAssembly->SetUserTransform(this->GetDataNode()->GetVtkTransform());
}
return m_Prop3DAssembly;
}
void PlaneGeometryDataVtkMapper3D::UpdateVtkTransform(mitk::BaseRenderer * /*renderer*/)
{
m_ImageAssembly->SetUserTransform(this->GetDataNode()->GetVtkTransform(this->GetTimestep()));
}
const PlaneGeometryData *PlaneGeometryDataVtkMapper3D::GetInput()
{
return static_cast<const PlaneGeometryData *>(GetDataNode()->GetData());
}
void PlaneGeometryDataVtkMapper3D::SetDataStorageForTexture(mitk::DataStorage *storage)
{
if (storage != nullptr && m_DataStorage != storage)
{
m_DataStorage = storage;
this->Modified();
}
}
void PlaneGeometryDataVtkMapper3D::ImageMapperDeletedCallback(itk::Object *caller, const itk::EventObject & /*event*/)
{
auto *imageMapper = dynamic_cast<ImageVtkMapper2D *>(caller);
if ((imageMapper != nullptr))
{
if (m_ImageActors.count(imageMapper) > 0)
{
m_ImageActors[imageMapper].m_Sender = nullptr; // sender is already destroying itself
m_ImageActors.erase(imageMapper);
}
}
}
void PlaneGeometryDataVtkMapper3D::GenerateDataForRenderer(BaseRenderer *renderer)
{
// Remove all actors from the assembly, and re-initialize it with the
// edge actor
m_ImageAssembly->GetParts()->RemoveAllItems();
bool visible = true;
GetDataNode()->GetVisibility(visible, renderer, "visible");
if (!visible)
{
// visibility has explicitly to be set in the single actors
// due to problems when using cell picking:
// even if the assembly is invisible, the renderer contains
// references to the assemblies parts. During picking the
// visibility of each part is checked, and not only for the
// whole assembly.
m_ImageAssembly->VisibilityOff();
m_EdgeActor->VisibilityOff();
return;
}
// visibility has explicitly to be set in the single actors
// due to problems when using cell picking:
// even if the assembly is invisible, the renderer contains
// references to the assemblies parts. During picking the
// visibility of each part is checked, and not only for the
// whole assembly.
m_ImageAssembly->VisibilityOn();
bool drawEdges = true;
this->GetDataNode()->GetBoolProperty("draw edges", drawEdges, renderer);
m_EdgeActor->SetVisibility(drawEdges);
PlaneGeometryData::ConstPointer input = this->GetInput();
if (input.IsNotNull() && (input->GetPlaneGeometry() != nullptr))
{
SmartPointerProperty::Pointer surfacecreatorprop;
surfacecreatorprop =
dynamic_cast<SmartPointerProperty *>(GetDataNode()->GetProperty("surfacegeometry", renderer));
if ((surfacecreatorprop.IsNull()) || (surfacecreatorprop->GetSmartPointer().IsNull()) ||
((m_SurfaceCreator =
dynamic_cast<PlaneGeometryDataToSurfaceFilter *>(surfacecreatorprop->GetSmartPointer().GetPointer()))
.IsNull()))
{
m_SurfaceCreator->PlaceByGeometryOn();
surfacecreatorprop = SmartPointerProperty::New(m_SurfaceCreator);
GetDataNode()->SetProperty("surfacegeometry", surfacecreatorprop);
}
m_SurfaceCreator->SetInput(input);
int res;
if (GetDataNode()->GetIntProperty("xresolution", res, renderer))
{
m_SurfaceCreator->SetXResolution(res);
}
if (GetDataNode()->GetIntProperty("yresolution", res, renderer))
{
m_SurfaceCreator->SetYResolution(res);
}
double tubeRadius = 1.0; // Radius of tubular edge surrounding plane
// Clip the PlaneGeometry with the reference geometry bounds (if available)
if (input->GetPlaneGeometry()->HasReferenceGeometry())
{
const BaseGeometry *referenceGeometry = input->GetPlaneGeometry()->GetReferenceGeometry();
BoundingBox::PointType boundingBoxMin, boundingBoxMax;
boundingBoxMin = referenceGeometry->GetBoundingBox()->GetMinimum();
boundingBoxMax = referenceGeometry->GetBoundingBox()->GetMaximum();
if (referenceGeometry->GetImageGeometry())
{
for (unsigned int i = 0; i < 3; ++i)
{
boundingBoxMin[i] -= 0.5;
boundingBoxMax[i] -= 0.5;
}
}
m_SurfaceCreatorPointsContainer->CreateElementAt(0) = boundingBoxMin;
m_SurfaceCreatorPointsContainer->CreateElementAt(1) = boundingBoxMax;
m_SurfaceCreatorBoundingBox->ComputeBoundingBox();
m_SurfaceCreator->SetBoundingBox(m_SurfaceCreatorBoundingBox);
tubeRadius = referenceGeometry->GetDiagonalLength() / 450.0;
}
// If no reference geometry is available, clip with the current global
// bounds
else if (!m_DataStorage.IsExpired())
{
m_SurfaceCreator->SetBoundingBox(m_DataStorage.Lock()->ComputeVisibleBoundingBox(nullptr, "includeInBoundingBox"));
tubeRadius = sqrt(m_SurfaceCreator->GetBoundingBox()->GetDiagonalLength2()) / 450.0;
}
// Calculate the surface of the PlaneGeometry
m_SurfaceCreator->Update();
Surface *surface = m_SurfaceCreator->GetOutput();
// Check if there's something to display, otherwise return
if ((surface->GetVtkPolyData() == nullptr) || (surface->GetVtkPolyData()->GetNumberOfCells() == 0))
{
m_ImageAssembly->VisibilityOff();
return;
}
// add a graphical representation of the surface normals if requested
DataNode *node = this->GetDataNode();
bool displayNormals = false;
bool colorTwoSides = false;
bool invertNormals = false;
node->GetBoolProperty("draw normals 3D", displayNormals, renderer);
node->GetBoolProperty("color two sides", colorTwoSides, renderer);
node->GetBoolProperty("invert normals", invertNormals, renderer);
// if we want to draw the display normals or render two sides we have to get the colors
if (displayNormals || colorTwoSides)
{
// get colors
float frontColor[3] = {0.0, 0.0, 1.0};
node->GetColor(frontColor, renderer, "front color");
float backColor[3] = {1.0, 0.0, 0.0};
node->GetColor(backColor, renderer, "back color");
if (displayNormals)
{
m_NormalsTransformer->SetInputData(surface->GetVtkPolyData());
m_NormalsTransformer->SetTransform(node->GetVtkTransform(this->GetTimestep()));
m_FrontHedgeHog->SetInputConnection(m_NormalsTransformer->GetOutputPort());
m_FrontHedgeHog->SetVectorModeToUseNormal();
m_FrontHedgeHog->SetScaleFactor(invertNormals ? 1.0 : -1.0);
m_FrontHedgeHog->Update();
m_FrontNormalsActor->GetProperty()->SetColor(frontColor[0], frontColor[1], frontColor[2]);
m_BackHedgeHog->SetInputConnection(m_NormalsTransformer->GetOutputPort());
m_BackHedgeHog->SetVectorModeToUseNormal();
m_BackHedgeHog->SetScaleFactor(invertNormals ? -1.0 : 1.0);
m_BackHedgeHog->Update();
m_BackNormalsActor->GetProperty()->SetColor(backColor[0], backColor[1], backColor[2]);
// if there is no actor added yet, add one
if (!m_NormalsActorAdded)
{
m_Prop3DAssembly->AddPart(m_FrontNormalsActor);
m_Prop3DAssembly->AddPart(m_BackNormalsActor);
m_NormalsActorAdded = true;
}
}
// if we don't want to display normals AND there is an actor added remove the actor
else if (m_NormalsActorAdded)
{
m_Prop3DAssembly->RemovePart(m_FrontNormalsActor);
m_Prop3DAssembly->RemovePart(m_BackNormalsActor);
m_NormalsActorAdded = false;
}
if (colorTwoSides)
{
if (!invertNormals)
{
m_BackgroundActor->GetProperty()->SetColor(backColor[0], backColor[1], backColor[2]);
m_BackgroundActor->GetBackfaceProperty()->SetColor(frontColor[0], frontColor[1], frontColor[2]);
}
else
{
m_BackgroundActor->GetProperty()->SetColor(frontColor[0], frontColor[1], frontColor[2]);
m_BackgroundActor->GetBackfaceProperty()->SetColor(backColor[0], backColor[1], backColor[2]);
}
}
}
// Add black background for all images (which may be transparent)
m_BackgroundMapper->SetInputData(surface->GetVtkPolyData());
// m_ImageAssembly->AddPart(m_BackgroundActor);
LayerSortedActorList layerSortedActors;
// Traverse the data tree to find nodes resliced by ImageMapperGL2D
// use a predicate to get all data nodes which are "images" or inherit from mitk::Image
mitk::TNodePredicateDataType<mitk::Image>::Pointer predicateAllImages =
mitk::TNodePredicateDataType<mitk::Image>::New();
mitk::DataStorage::SetOfObjects::ConstPointer all = m_DataStorage.Lock()->GetSubset(predicateAllImages);
// process all found images
for (mitk::DataStorage::SetOfObjects::ConstIterator it = all->Begin(); it != all->End(); ++it)
{
DataNode *node = it->Value();
if (node != nullptr)
this->ProcessNode(node, renderer, surface, layerSortedActors);
}
// Add all image actors to the assembly, sorted according to
// layer property
LayerSortedActorList::iterator actorIt;
for (actorIt = layerSortedActors.begin(); actorIt != layerSortedActors.end(); ++actorIt)
{
m_ImageAssembly->AddPart(actorIt->second);
}
// Configurate the tube-shaped frame: size according to the surface
// bounds, color as specified in the plane's properties
vtkPolyData *surfacePolyData = surface->GetVtkPolyData();
m_Cleaner->SetInputData(surfacePolyData);
m_EdgeTransformer->SetTransform(this->GetDataNode()->GetVtkTransform(this->GetTimestep()));
// Adjust the radius according to extent
m_EdgeTuber->SetRadius(tubeRadius);
// Get the plane's color and set the tube properties accordingly
ColorProperty::Pointer colorProperty;
colorProperty = dynamic_cast<ColorProperty *>(this->GetDataNode()->GetProperty("color"));
if (colorProperty.IsNotNull())
{
const Color &color = colorProperty->GetColor();
m_EdgeActor->GetProperty()->SetColor(color.GetRed(), color.GetGreen(), color.GetBlue());
}
else
{
m_EdgeActor->GetProperty()->SetColor(1.0, 1.0, 1.0);
}
m_ImageAssembly->SetUserTransform(this->GetDataNode()->GetVtkTransform(this->GetTimestep()));
}
VtkRepresentationProperty *representationProperty;
this->GetDataNode()->GetProperty(representationProperty, "material.representation", renderer);
if (representationProperty != nullptr)
m_BackgroundActor->GetProperty()->SetRepresentation(representationProperty->GetVtkRepresentation());
}
void PlaneGeometryDataVtkMapper3D::ProcessNode(DataNode *node,
BaseRenderer *renderer,
Surface *surface,
LayerSortedActorList &layerSortedActors)
{
if (node != nullptr)
{
// we need to get the information from the 2D mapper to render the texture on the 3D plane
auto *imageMapper =
dynamic_cast<ImageVtkMapper2D *>(node->GetMapper(1)); // GetMapper(1) provides the 2D mapper for the data node
// if there is a 2D mapper, which is not the standard image mapper...
if (!imageMapper && node->GetMapper(1))
{ //... check if it is the composite mapper
std::string cname(node->GetMapper(1)->GetNameOfClass());
if (!cname.compare("CompositeMapper")) // string.compare returns 0 if the two strings are equal.
{
// get the standard image mapper.
// This is a special case in MITK and does only work for the CompositeMapper.
imageMapper = dynamic_cast<ImageVtkMapper2D *>(node->GetMapper(3));
}
}
if ((node->IsVisible(renderer)) && imageMapper)
{
WeakPointerProperty::Pointer rendererProp =
dynamic_cast<WeakPointerProperty *>(GetDataNode()->GetPropertyList()->GetProperty("renderer"));
if (rendererProp.IsNotNull())
{
BaseRenderer::Pointer planeRenderer =
dynamic_cast<BaseRenderer *>(rendererProp->GetWeakPointer().GetPointer());
// Retrieve and update image to be mapped
const ImageVtkMapper2D::LocalStorage *localStorage = imageMapper->GetConstLocalStorage(planeRenderer);
if (planeRenderer.IsNotNull())
{
// perform update of imagemapper if needed (maybe the respective 2D renderwindow is not rendered/update
// before)
imageMapper->Update(planeRenderer);
// If it has not been initialized already in a previous pass,
// generate an actor and a texture object to
// render the image associated with the ImageVtkMapper2D.
vtkActor *imageActor;
vtkDataSetMapper *dataSetMapper = nullptr;
vtkTexture *texture;
if (m_ImageActors.count(imageMapper) == 0)
{
dataSetMapper = vtkDataSetMapper::New();
texture = vtkNeverTranslucentTexture::New();
texture->RepeatOff();
imageActor = vtkActor::New();
imageActor->SetMapper(dataSetMapper);
imageActor->SetTexture(texture);
imageActor->GetProperty()->SetOpacity(
0.999); // HACK! otherwise VTK wouldn't recognize this as translucent
// surface (if LUT values map to alpha < 255
// improvement: apply "opacity" property onle HERE and also in 2D image mapper. DO NOT change LUT to
// achieve
// translucent images (see method ChangeOpacity in image mapper 2D)
// Make imageActor the sole owner of the mapper and texture
// objects
dataSetMapper->UnRegister(nullptr);
texture->UnRegister(nullptr);
// Store the actor so that it may be accessed in following
// passes.
m_ImageActors[imageMapper].Initialize(imageActor, imageMapper, m_ImageMapperDeletedCommand);
}
else
{
// Else, retrieve the actor and associated objects from the
// previous pass.
imageActor = m_ImageActors[imageMapper].m_Actor;
dataSetMapper = (vtkDataSetMapper *)imageActor->GetMapper();
texture = imageActor->GetTexture();
}
// Set poly data new each time its object changes (e.g. when
// switching between planar and curved geometries)
if ((dataSetMapper != nullptr) && (dataSetMapper->GetInput() != surface->GetVtkPolyData()))
{
dataSetMapper->SetInputData(surface->GetVtkPolyData());
}
dataSetMapper->Update();
// Check if the m_ReslicedImage is nullptr.
// This is the case when no image geometry is met by
// the reslicer. In that case, the texture has to be
// empty (black) and we don't have to do anything.
// See fixed bug #13275
if (localStorage->m_ReslicedImage != nullptr)
{
texture->SetInputConnection(localStorage->m_LevelWindowFilter->GetOutputPort());
// do not use a VTK lookup table (we do that ourselves in m_LevelWindowFilter)
texture->SetColorModeToDirectScalars();
// re-use properties from the 2D image mapper
- imageActor->SetProperty(localStorage->m_ImageActor->GetProperty());
- imageActor->GetProperty()->SetAmbient(0.5);
+ auto property = vtkSmartPointer<vtkProperty>::New();
+ localStorage->m_ImageActor->GetProperty()->DeepCopy(property);
+ property->LightingOff();
+ imageActor->SetProperty(property);
// Set texture interpolation on/off
bool textureInterpolation = node->IsOn("texture interpolation", renderer);
texture->SetInterpolate(textureInterpolation);
// Store this actor to be added to the actor assembly, sort
// by layer
int layer = 1;
node->GetIntProperty("layer", layer);
layerSortedActors.insert(std::pair<int, vtkActor *>(layer, imageActor));
}
}
}
}
}
}
void PlaneGeometryDataVtkMapper3D::ActorInfo::Initialize(vtkActor *actor, itk::Object *sender, itk::Command *command)
{
m_Actor = actor;
m_Sender = sender;
// Get informed when ImageMapper object is deleted, so that
// the data structures built here can be deleted as well
m_ObserverID = sender->AddObserver(itk::DeleteEvent(), command);
}
PlaneGeometryDataVtkMapper3D::ActorInfo::ActorInfo() : m_Actor(nullptr), m_Sender(nullptr), m_ObserverID(0) {}
PlaneGeometryDataVtkMapper3D::ActorInfo::~ActorInfo()
{
if (m_Sender != nullptr)
{
m_Sender->RemoveObserver(m_ObserverID);
}
if (m_Actor != nullptr)
{
m_Actor->ReleaseGraphicsResources(nullptr);
m_Actor->Delete();
}
}
} // namespace mitk
diff --git a/Modules/Core/src/Rendering/mitkSurfaceVtkMapper3D.cpp b/Modules/Core/src/Rendering/mitkSurfaceVtkMapper3D.cpp
index 8d45e37923..33016c95e0 100644
--- a/Modules/Core/src/Rendering/mitkSurfaceVtkMapper3D.cpp
+++ b/Modules/Core/src/Rendering/mitkSurfaceVtkMapper3D.cpp
@@ -1,519 +1,520 @@
/*============================================================================
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 "mitkSurfaceVtkMapper3D.h"
#include <mitkClippingProperty.h>
#include <mitkColorProperty.h>
#include <mitkCoreServices.h>
#include <mitkDataNode.h>
#include <mitkExtractSliceFilter.h>
#include <mitkIPropertyAliases.h>
#include <mitkIPropertyDescriptions.h>
#include <mitkImageSliceSelector.h>
#include <mitkLookupTableProperty.h>
#include <mitkProperties.h>
#include <mitkSmartPointerProperty.h>
#include <mitkTransferFunctionProperty.h>
#include <mitkVtkInterpolationProperty.h>
#include <mitkVtkRepresentationProperty.h>
#include <mitkVtkScalarModeProperty.h>
// VTK
#include <vtkActor.h>
#include <vtkPlaneCollection.h>
#include <vtkPointData.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkPolyDataNormals.h>
#include <vtkProperty.h>
#include <vtkSmartPointer.h>
+#include <vtkTexture.h>
const mitk::Surface *mitk::SurfaceVtkMapper3D::GetInput()
{
return static_cast<const mitk::Surface *>(GetDataNode()->GetData());
}
mitk::SurfaceVtkMapper3D::SurfaceVtkMapper3D()
{
m_GenerateNormals = false;
}
mitk::SurfaceVtkMapper3D::~SurfaceVtkMapper3D()
{
}
void mitk::SurfaceVtkMapper3D::GenerateDataForRenderer(mitk::BaseRenderer *renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
bool visible = true;
GetDataNode()->GetVisibility(visible, renderer, "visible");
if (!visible)
{
ls->m_Actor->VisibilityOff();
return;
}
//
// set the input-object at time t for the mapper
//
mitk::Surface::ConstPointer input = this->GetInput();
vtkSmartPointer<vtkPolyData> polydata = input->GetVtkPolyData(this->GetTimestep());
if (polydata == nullptr)
{
ls->m_Actor->VisibilityOff();
return;
}
if (m_GenerateNormals)
{
ls->m_VtkPolyDataNormals->SetInputData(polydata);
ls->m_VtkPolyDataMapper->SetInputConnection(ls->m_VtkPolyDataNormals->GetOutputPort());
}
else
{
bool depthsorting = false;
GetDataNode()->GetBoolProperty("Depth Sorting", depthsorting);
if (depthsorting)
{
ls->m_DepthSort->SetInputData(polydata);
ls->m_DepthSort->SetCamera(renderer->GetVtkRenderer()->GetActiveCamera());
ls->m_DepthSort->SetDirectionToBackToFront();
ls->m_DepthSort->Update();
ls->m_VtkPolyDataMapper->SetInputConnection(ls->m_DepthSort->GetOutputPort());
}
else
{
ls->m_VtkPolyDataMapper->SetInputData(polydata);
}
}
//
// apply properties read from the PropertyList
//
ApplyAllProperties(renderer, ls->m_Actor);
if (visible)
ls->m_Actor->VisibilityOn();
}
void mitk::SurfaceVtkMapper3D::ResetMapper(BaseRenderer *renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
ls->m_Actor->VisibilityOff();
}
void mitk::SurfaceVtkMapper3D::ApplyMitkPropertiesToVtkProperty(mitk::DataNode *node,
vtkProperty *property,
mitk::BaseRenderer *renderer)
{
// Backface culling
{
mitk::BoolProperty::Pointer p;
node->GetProperty(p, "Backface Culling", renderer);
bool useCulling = false;
if (p.IsNotNull())
useCulling = p->GetValue();
property->SetBackfaceCulling(useCulling);
}
// Colors
{
double ambient[3] = {0.5, 0.5, 0.0};
double diffuse[3] = {0.5, 0.5, 0.0};
double specular[3] = {1.0, 1.0, 1.0};
float coeff_ambient = 0.5f;
float coeff_diffuse = 0.5f;
float coeff_specular = 0.5f;
float power_specular = 10.0f;
// Color
{
mitk::ColorProperty::Pointer p;
node->GetProperty(p, "color", renderer);
if (p.IsNotNull())
{
mitk::Color c = p->GetColor();
ambient[0] = c.GetRed();
ambient[1] = c.GetGreen();
ambient[2] = c.GetBlue();
diffuse[0] = c.GetRed();
diffuse[1] = c.GetGreen();
diffuse[2] = c.GetBlue();
// Setting specular color to the same, make physically no real sense, however vtk rendering slows down, if these
// colors are different.
specular[0] = c.GetRed();
specular[1] = c.GetGreen();
specular[2] = c.GetBlue();
}
}
// Ambient
{
mitk::ColorProperty::Pointer p;
node->GetProperty(p, "material.ambientColor", renderer);
if (p.IsNotNull())
{
mitk::Color c = p->GetColor();
ambient[0] = c.GetRed();
ambient[1] = c.GetGreen();
ambient[2] = c.GetBlue();
}
}
// Diffuse
{
mitk::ColorProperty::Pointer p;
node->GetProperty(p, "material.diffuseColor", renderer);
if (p.IsNotNull())
{
mitk::Color c = p->GetColor();
diffuse[0] = c.GetRed();
diffuse[1] = c.GetGreen();
diffuse[2] = c.GetBlue();
}
}
// Specular
{
mitk::ColorProperty::Pointer p;
node->GetProperty(p, "material.specularColor", renderer);
if (p.IsNotNull())
{
mitk::Color c = p->GetColor();
specular[0] = c.GetRed();
specular[1] = c.GetGreen();
specular[2] = c.GetBlue();
}
}
// Ambient coeff
{
node->GetFloatProperty("material.ambientCoefficient", coeff_ambient, renderer);
}
// Diffuse coeff
{
node->GetFloatProperty("material.diffuseCoefficient", coeff_diffuse, renderer);
}
// Specular coeff
{
node->GetFloatProperty("material.specularCoefficient", coeff_specular, renderer);
}
// Specular power
{
node->GetFloatProperty("material.specularPower", power_specular, renderer);
}
property->SetAmbient(coeff_ambient);
property->SetDiffuse(coeff_diffuse);
property->SetSpecular(coeff_specular);
property->SetSpecularPower(power_specular);
property->SetAmbientColor(ambient);
property->SetDiffuseColor(diffuse);
property->SetSpecularColor(specular);
}
// Render mode
{
// Opacity
{
float opacity = 1.0f;
if (node->GetOpacity(opacity, renderer))
property->SetOpacity(opacity);
}
// Wireframe line width
{
float lineWidth = 1;
node->GetFloatProperty("material.wireframeLineWidth", lineWidth, renderer);
property->SetLineWidth(lineWidth);
}
// Point size
{
float pointSize = 1.0f;
node->GetFloatProperty("material.pointSize", pointSize, renderer);
property->SetPointSize(pointSize);
}
// Representation
{
mitk::VtkRepresentationProperty::Pointer p;
node->GetProperty(p, "material.representation", renderer);
if (p.IsNotNull())
property->SetRepresentation(p->GetVtkRepresentation());
}
// Interpolation
{
mitk::VtkInterpolationProperty::Pointer p;
node->GetProperty(p, "material.interpolation", renderer);
if (p.IsNotNull())
property->SetInterpolation(p->GetVtkInterpolation());
}
}
}
void mitk::SurfaceVtkMapper3D::ApplyAllProperties(mitk::BaseRenderer *renderer, vtkActor * /*actor*/)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
Superclass::ApplyColorAndOpacityProperties(renderer, ls->m_Actor);
// VTK Properties
ApplyMitkPropertiesToVtkProperty(this->GetDataNode(), ls->m_Actor->GetProperty(), renderer);
mitk::TransferFunctionProperty::Pointer transferFuncProp;
this->GetDataNode()->GetProperty(transferFuncProp, "Surface.TransferFunction", renderer);
if (transferFuncProp.IsNotNull())
{
ls->m_VtkPolyDataMapper->SetLookupTable(transferFuncProp->GetValue()->GetColorTransferFunction());
}
mitk::LookupTableProperty::Pointer lookupTableProp;
this->GetDataNode()->GetProperty(lookupTableProp, "LookupTable", renderer);
if (lookupTableProp.IsNotNull())
{
ls->m_VtkPolyDataMapper->SetLookupTable(lookupTableProp->GetLookupTable()->GetVtkLookupTable());
}
mitk::LevelWindow levelWindow;
if (this->GetDataNode()->GetLevelWindow(levelWindow, renderer, "levelWindow"))
{
ls->m_VtkPolyDataMapper->SetScalarRange(levelWindow.GetLowerWindowBound(), levelWindow.GetUpperWindowBound());
}
else if (this->GetDataNode()->GetLevelWindow(levelWindow, renderer))
{
ls->m_VtkPolyDataMapper->SetScalarRange(levelWindow.GetLowerWindowBound(), levelWindow.GetUpperWindowBound());
}
bool scalarVisibility = false;
this->GetDataNode()->GetBoolProperty("scalar visibility", scalarVisibility);
ls->m_VtkPolyDataMapper->SetScalarVisibility((scalarVisibility ? 1 : 0));
if (scalarVisibility)
{
mitk::VtkScalarModeProperty *scalarMode;
if (this->GetDataNode()->GetProperty(scalarMode, "scalar mode", renderer))
ls->m_VtkPolyDataMapper->SetScalarMode(scalarMode->GetVtkScalarMode());
else
ls->m_VtkPolyDataMapper->SetScalarModeToDefault();
bool colorMode = false;
this->GetDataNode()->GetBoolProperty("color mode", colorMode);
ls->m_VtkPolyDataMapper->SetColorMode((colorMode ? 1 : 0));
double scalarsMin = 0;
this->GetDataNode()->GetDoubleProperty("ScalarsRangeMinimum", scalarsMin, renderer);
double scalarsMax = 1.0;
this->GetDataNode()->GetDoubleProperty("ScalarsRangeMaximum", scalarsMax, renderer);
ls->m_VtkPolyDataMapper->SetScalarRange(scalarsMin, scalarsMax);
}
mitk::SmartPointerProperty::Pointer imagetextureProp =
dynamic_cast<mitk::SmartPointerProperty *>(GetDataNode()->GetProperty("Surface.Texture", renderer));
if (imagetextureProp.IsNotNull())
{
mitk::Image *miktTexture = dynamic_cast<mitk::Image *>(imagetextureProp->GetSmartPointer().GetPointer());
vtkSmartPointer<vtkTexture> vtkTxture = vtkSmartPointer<vtkTexture>::New();
// Either select the first slice of a volume
if (miktTexture->GetDimension(2) > 1)
{
MITK_WARN << "3D Textures are not supported by VTK and MITK. The first slice of the volume will be used instead!";
mitk::ImageSliceSelector::Pointer sliceselector = mitk::ImageSliceSelector::New();
sliceselector->SetSliceNr(0);
sliceselector->SetChannelNr(0);
sliceselector->SetTimeNr(0);
sliceselector->SetInput(miktTexture);
sliceselector->Update();
vtkTxture->SetInputData(sliceselector->GetOutput()->GetVtkImageData());
}
else // or just use the 2D image
{
vtkTxture->SetInputData(miktTexture->GetVtkImageData());
}
// pass the texture to the actor
ls->m_Actor->SetTexture(vtkTxture);
if (ls->m_VtkPolyDataMapper->GetInput()->GetPointData()->GetTCoords() == nullptr)
{
MITK_ERROR << "Surface.Texture property was set, but there are no texture coordinates. Please provide texture "
"coordinates for the vtkPolyData via vtkPolyData->GetPointData()->SetTCoords().";
}
// if no texture is set, this will also remove a previously used texture
// and reset the actor to it's default behaviour
}
else
{
ls->m_Actor->SetTexture(nullptr);
}
// deprecated settings
bool deprecatedUseCellData = false;
this->GetDataNode()->GetBoolProperty("deprecated useCellDataForColouring", deprecatedUseCellData);
bool deprecatedUsePointData = false;
this->GetDataNode()->GetBoolProperty("deprecated usePointDataForColouring", deprecatedUsePointData);
if (deprecatedUseCellData)
{
ls->m_VtkPolyDataMapper->SetColorModeToDefault();
ls->m_VtkPolyDataMapper->SetScalarRange(0, 255);
ls->m_VtkPolyDataMapper->ScalarVisibilityOn();
ls->m_VtkPolyDataMapper->SetScalarModeToUseCellData();
ls->m_Actor->GetProperty()->SetSpecular(1);
ls->m_Actor->GetProperty()->SetSpecularPower(50);
ls->m_Actor->GetProperty()->SetInterpolationToPhong();
}
else if (deprecatedUsePointData)
{
float scalarsMin = 0;
if (dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("ScalarsRangeMinimum")) != nullptr)
scalarsMin =
dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("ScalarsRangeMinimum"))->GetValue();
float scalarsMax = 0.1;
if (dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("ScalarsRangeMaximum")) != nullptr)
scalarsMax =
dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("ScalarsRangeMaximum"))->GetValue();
ls->m_VtkPolyDataMapper->SetScalarRange(scalarsMin, scalarsMax);
ls->m_VtkPolyDataMapper->SetColorModeToMapScalars();
ls->m_VtkPolyDataMapper->ScalarVisibilityOn();
ls->m_Actor->GetProperty()->SetSpecular(1);
ls->m_Actor->GetProperty()->SetSpecularPower(50);
ls->m_Actor->GetProperty()->SetInterpolationToPhong();
}
int deprecatedScalarMode = VTK_COLOR_MODE_DEFAULT;
if (this->GetDataNode()->GetIntProperty("deprecated scalar mode", deprecatedScalarMode, renderer))
{
ls->m_VtkPolyDataMapper->SetScalarMode(deprecatedScalarMode);
ls->m_VtkPolyDataMapper->ScalarVisibilityOn();
ls->m_Actor->GetProperty()->SetSpecular(1);
ls->m_Actor->GetProperty()->SetSpecularPower(50);
}
// Check whether one or more ClippingProperty objects have been defined for
// this node. Check both renderer specific and global property lists, since
// properties in both should be considered.
const PropertyList::PropertyMap *rendererProperties = this->GetDataNode()->GetPropertyList(renderer)->GetMap();
const PropertyList::PropertyMap *globalProperties = this->GetDataNode()->GetPropertyList(nullptr)->GetMap();
// Add clipping planes (if any)
ls->m_ClippingPlaneCollection->RemoveAllItems();
PropertyList::PropertyMap::const_iterator it;
for (it = rendererProperties->begin(); it != rendererProperties->end(); ++it)
{
this->CheckForClippingProperty(renderer, (*it).second.GetPointer());
}
for (it = globalProperties->begin(); it != globalProperties->end(); ++it)
{
this->CheckForClippingProperty(renderer, (*it).second.GetPointer());
}
if (ls->m_ClippingPlaneCollection->GetNumberOfItems() > 0)
{
ls->m_VtkPolyDataMapper->SetClippingPlanes(ls->m_ClippingPlaneCollection);
}
else
{
ls->m_VtkPolyDataMapper->RemoveAllClippingPlanes();
}
}
vtkProp *mitk::SurfaceVtkMapper3D::GetVtkProp(mitk::BaseRenderer *renderer)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
return ls->m_Actor;
}
void mitk::SurfaceVtkMapper3D::CheckForClippingProperty(mitk::BaseRenderer *renderer, mitk::BaseProperty *property)
{
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
auto *clippingProperty = dynamic_cast<ClippingProperty *>(property);
if ((clippingProperty != nullptr) && (clippingProperty->GetClippingEnabled()))
{
const Point3D &origin = clippingProperty->GetOrigin();
const Vector3D &normal = clippingProperty->GetNormal();
vtkSmartPointer<vtkPlane> clippingPlane = vtkSmartPointer<vtkPlane>::New();
clippingPlane->SetOrigin(origin[0], origin[1], origin[2]);
clippingPlane->SetNormal(normal[0], normal[1], normal[2]);
ls->m_ClippingPlaneCollection->AddItem(clippingPlane);
}
}
void mitk::SurfaceVtkMapper3D::SetDefaultPropertiesForVtkProperty(mitk::DataNode *node,
mitk::BaseRenderer *renderer,
bool overwrite)
{
// Shading
{
node->AddProperty("material.wireframeLineWidth", mitk::FloatProperty::New(1.0f), renderer, overwrite);
node->AddProperty("material.pointSize", mitk::FloatProperty::New(1.0f), renderer, overwrite);
node->AddProperty("material.ambientCoefficient", mitk::FloatProperty::New(0.05f), renderer, overwrite);
node->AddProperty("material.diffuseCoefficient", mitk::FloatProperty::New(0.9f), renderer, overwrite);
node->AddProperty("material.specularCoefficient", mitk::FloatProperty::New(1.0f), renderer, overwrite);
node->AddProperty("material.specularPower", mitk::FloatProperty::New(16.0f), renderer, overwrite);
node->AddProperty("material.representation", mitk::VtkRepresentationProperty::New(), renderer, overwrite);
node->AddProperty("material.interpolation", mitk::VtkInterpolationProperty::New(), renderer, overwrite);
}
}
void mitk::SurfaceVtkMapper3D::SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer, bool overwrite)
{
node->AddProperty("color", mitk::ColorProperty::New(1.0f, 1.0f, 1.0f), renderer, overwrite);
node->AddProperty("opacity", mitk::FloatProperty::New(1.0), renderer, overwrite);
mitk::SurfaceVtkMapper3D::SetDefaultPropertiesForVtkProperty(node, renderer, overwrite); // Shading
node->AddProperty("scalar visibility", mitk::BoolProperty::New(false), renderer, overwrite);
node->AddProperty("color mode", mitk::BoolProperty::New(false), renderer, overwrite);
node->AddProperty("scalar mode", mitk::VtkScalarModeProperty::New(), renderer, overwrite);
mitk::Surface::Pointer surface = dynamic_cast<Surface *>(node->GetData());
if (surface.IsNotNull())
{
if ((surface->GetVtkPolyData() != nullptr) && (surface->GetVtkPolyData()->GetPointData() != nullptr) &&
(surface->GetVtkPolyData()->GetPointData()->GetScalars() != nullptr))
{
node->AddProperty("scalar visibility", mitk::BoolProperty::New(true), renderer, overwrite);
node->AddProperty("color mode", mitk::BoolProperty::New(true), renderer, overwrite);
}
}
// Backface culling
node->AddProperty("Backface Culling", mitk::BoolProperty::New(false), renderer, overwrite);
node->AddProperty("Depth Sorting", mitk::BoolProperty::New(false), renderer, overwrite);
mitk::CoreServicePointer<mitk::IPropertyDescriptions> propDescService(mitk::CoreServices::GetPropertyDescriptions());
propDescService->AddDescription(
"Depth Sorting",
"Enables correct rendering for transparent objects by ordering polygons according to the distance "
"to the camera. It is not recommended to enable this property for large surfaces (rendering might "
"be slow).");
Superclass::SetDefaultProperties(node, renderer, overwrite);
}
diff --git a/Modules/Core/src/Rendering/vtkMitkLevelWindowFilter.cpp b/Modules/Core/src/Rendering/vtkMitkLevelWindowFilter.cpp
index e439ac8968..5bbc93108e 100644
--- a/Modules/Core/src/Rendering/vtkMitkLevelWindowFilter.cpp
+++ b/Modules/Core/src/Rendering/vtkMitkLevelWindowFilter.cpp
@@ -1,585 +1,580 @@
/*============================================================================
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 "vtkMitkLevelWindowFilter.h"
#include "vtkObjectFactory.h"
#include <vtkColorTransferFunction.h>
#include <vtkImageData.h>
#include <vtkImageIterator.h>
#include <vtkInformation.h>
#include <vtkInformationVector.h>
#include <vtkLookupTable.h>
#include <vtkPiecewiseFunction.h>
#include <vtkStreamingDemandDrivenPipeline.h>
// used for acos etc.
#include <cmath>
// used for PI
#include <itkMath.h>
#include <mitkLogMacros.h>
static const double PI = itk::Math::pi;
vtkStandardNewMacro(vtkMitkLevelWindowFilter);
vtkMitkLevelWindowFilter::vtkMitkLevelWindowFilter()
: m_LookupTable(nullptr), m_OpacityFunction(nullptr), m_MinOpacity(0.0), m_MaxOpacity(255.0)
{
// MITK_INFO << "mitk level/window filter uses " << GetNumberOfThreads() << " thread(s)";
}
vtkMitkLevelWindowFilter::~vtkMitkLevelWindowFilter()
{
}
vtkMTimeType vtkMitkLevelWindowFilter::GetMTime()
{
vtkMTimeType mTime = this->vtkObject::GetMTime();
vtkMTimeType time;
if (this->m_LookupTable != nullptr)
{
time = this->m_LookupTable->GetMTime();
mTime = (time > mTime ? time : mTime);
}
return mTime;
}
void vtkMitkLevelWindowFilter::SetLookupTable(vtkScalarsToColors *lookupTable)
{
if (m_LookupTable != lookupTable)
{
m_LookupTable = lookupTable;
this->Modified();
}
}
vtkScalarsToColors *vtkMitkLevelWindowFilter::GetLookupTable()
{
return m_LookupTable;
}
void vtkMitkLevelWindowFilter::SetOpacityPiecewiseFunction(vtkPiecewiseFunction *opacityFunction)
{
if (m_OpacityFunction != opacityFunction)
{
m_OpacityFunction = opacityFunction;
this->Modified();
}
}
// This code was copied from the iil. The template works only for float and double.
// Internal method which should never be used anywhere else and should not be in th header.
// Convert color pixels from (R,G,B) to (H,S,I).
// Reference: "Digital Image Processing, 2nd. edition", R. Gonzalez and R. Woods. Prentice Hall, 2002.
template <class T>
void RGBtoHSI(T *RGB, T *HSI)
{
T R = RGB[0], G = RGB[1], B = RGB[2], nR = (R < 0 ? 0 : (R > 255 ? 255 : R)) / 255,
nG = (G < 0 ? 0 : (G > 255 ? 255 : G)) / 255, nB = (B < 0 ? 0 : (B > 255 ? 255 : B)) / 255,
m = nR < nG ? (nR < nB ? nR : nB) : (nG < nB ? nG : nB),
theta = (T)(std::acos(0.5f * ((nR - nG) + (nR - nB)) / std::sqrt(std::pow(nR - nG, 2) + (nR - nB) * (nG - nB))) *
180 / PI),
sum = nR + nG + nB;
T H = 0, S = 0, I = 0;
if (theta > 0)
H = (nB <= nG) ? theta : 360 - theta;
if (sum > 0)
S = 1 - 3 / sum * m;
I = sum / 3;
HSI[0] = (T)H;
HSI[1] = (T)S;
HSI[2] = (T)I;
}
// This code was copied from the iil. The template works only for float and double.
// Internal method which should never be used anywhere else and should not be in th header.
// Convert color pixels from (H,S,I) to (R,G,B).
template <class T>
void HSItoRGB(T *HSI, T *RGB)
{
T H = (T)HSI[0], S = (T)HSI[1], I = (T)HSI[2], a = I * (1 - S), R = 0, G = 0, B = 0;
if (H < 120)
{
B = a;
R = (T)(I * (1 + S * std::cos(H * PI / 180) / std::cos((60 - H) * PI / 180)));
G = 3 * I - (R + B);
}
else if (H < 240)
{
H -= 120;
R = a;
G = (T)(I * (1 + S * std::cos(H * PI / 180) / std::cos((60 - H) * PI / 180)));
B = 3 * I - (R + G);
}
else
{
H -= 240;
G = a;
B = (T)(I * (1 + S * std::cos(H * PI / 180) / std::cos((60 - H) * PI / 180)));
R = 3 * I - (G + B);
}
R *= 255;
G *= 255;
B *= 255;
RGB[0] = (T)(R < 0 ? 0 : (R > 255 ? 255 : R));
RGB[1] = (T)(G < 0 ? 0 : (G > 255 ? 255 : G));
RGB[2] = (T)(B < 0 ? 0 : (B > 255 ? 255 : B));
}
// Internal method which should never be used anywhere else and should not be in th header.
//----------------------------------------------------------------------------
// This templated function executes the filter for any type of data.
template <class T>
void vtkApplyLookupTableOnRGBA(vtkMitkLevelWindowFilter *self,
vtkImageData *inData,
vtkImageData *outData,
int outExt[6],
double *clippingBounds,
T *)
{
vtkImageIterator<T> inputIt(inData, outExt);
vtkImageIterator<T> outputIt(outData, outExt);
vtkLookupTable *lookupTable;
const int maxC = inData->GetNumberOfScalarComponents();
double tableRange[2];
lookupTable = dynamic_cast<vtkLookupTable *>(self->GetLookupTable());
lookupTable->GetTableRange(tableRange);
// parameters for RGB level window
const double scale = (tableRange[1] - tableRange[0] > 0 ? 255.0 / (tableRange[1] - tableRange[0]) : 0.0);
const double bias = tableRange[0] * scale;
// parameters for opaque level window
const double scaleOpac =
(self->GetMaxOpacity() - self->GetMinOpacity() > 0 ? 255.0 / (self->GetMaxOpacity() - self->GetMinOpacity()) : 0.0);
const double biasOpac = self->GetMinOpacity() * scaleOpac;
int y = outExt[2];
// Loop through ouput pixels
while (!outputIt.IsAtEnd())
{
T *inputSI = inputIt.BeginSpan();
T *outputSI = outputIt.BeginSpan();
T *outputSIEnd = outputIt.EndSpan();
if (y >= clippingBounds[2] && y < clippingBounds[3])
{
int x = outExt[0];
while (outputSI != outputSIEnd)
{
if (x >= clippingBounds[0] && x < clippingBounds[1])
{
double rgb[3], alpha, hsi[3];
// level/window mechanism for intensity in HSI space
rgb[0] = static_cast<double>(*inputSI);
inputSI++;
rgb[1] = static_cast<double>(*inputSI);
inputSI++;
rgb[2] = static_cast<double>(*inputSI);
inputSI++;
RGBtoHSI<double>(rgb, hsi);
hsi[2] = hsi[2] * 255.0 * scale - bias;
hsi[2] = (hsi[2] > 255.0 ? 255 : (hsi[2] < 0.0 ? 0 : hsi[2]));
hsi[2] /= 255.0;
HSItoRGB<double>(hsi, rgb);
*outputSI = static_cast<T>(rgb[0]);
outputSI++;
*outputSI = static_cast<T>(rgb[1]);
outputSI++;
*outputSI = static_cast<T>(rgb[2]);
outputSI++;
unsigned char finalAlpha = 255;
// RGBA case
if (maxC >= 4)
{
// level/window mechanism for opacity
alpha = static_cast<double>(*inputSI);
inputSI++;
alpha = alpha * scaleOpac - biasOpac;
if (alpha > 255.0)
{
alpha = 255.0;
}
else if (alpha < 0.0)
{
alpha = 0.0;
}
finalAlpha = static_cast<unsigned char>(alpha);
for (int c = 4; c < maxC; c++)
inputSI++;
}
*outputSI = static_cast<T>(finalAlpha);
outputSI++;
}
else
{
inputSI += maxC;
*outputSI = 0;
outputSI++;
*outputSI = 0;
outputSI++;
*outputSI = 0;
outputSI++;
*outputSI = 0;
outputSI++;
}
x++;
}
}
else
{
while (outputSI != outputSIEnd)
{
*outputSI = 0;
outputSI++;
*outputSI = 0;
outputSI++;
*outputSI = 0;
outputSI++;
*outputSI = 0;
outputSI++;
}
}
inputIt.NextSpan();
outputIt.NextSpan();
y++;
}
}
// Internal method which should never be used anywhere else and should not be in th header.
//----------------------------------------------------------------------------
// This templated function executes the filter for any type of data.
template <class T>
void vtkApplyLookupTableOnScalarsFast(
vtkMitkLevelWindowFilter *self, vtkImageData *inData, vtkImageData *outData, int outExt[6], T *)
{
vtkImageIterator<T> inputIt(inData, outExt);
vtkImageIterator<unsigned char> outputIt(outData, outExt);
double tableRange[2];
// access vtkLookupTable
auto *lookupTable = dynamic_cast<vtkLookupTable *>(self->GetLookupTable());
lookupTable->GetTableRange(tableRange);
// access elements of the vtkLookupTable
- const int *realLookupTable = reinterpret_cast<int *>(lookupTable->GetTable()->GetPointer(0));
- int maxIndex = lookupTable->GetNumberOfColors() - 1;
+ auto *realLookupTable = lookupTable->GetPointer(0);
+ size_t maxIndex = lookupTable->GetNumberOfColors() - 1;
const float scale = (tableRange[1] - tableRange[0] > 0 ? (maxIndex + 1) / (tableRange[1] - tableRange[0]) : 0.0);
// ensuring that starting point is zero
float bias = -tableRange[0] * scale;
// due to later conversion to int for rounding
bias += 0.5f;
// Loop through ouput pixels
while (!outputIt.IsAtEnd())
{
unsigned char *outputSI = outputIt.BeginSpan();
unsigned char *outputSIEnd = outputIt.EndSpan();
T *inputSI = inputIt.BeginSpan();
while (outputSI != outputSIEnd)
{
// map to an index
- auto idx = static_cast<int>(*inputSI * scale + bias);
+ auto idx = std::min(static_cast<size_t>(std::max(0, static_cast<int>(*inputSI * scale + bias))), maxIndex) * 4;
- if (idx < 0)
- idx = 0;
- else if (idx > maxIndex)
- idx = maxIndex;
-
- *reinterpret_cast<int *>(outputSI) = realLookupTable[idx];
+ memcpy(outputSI, &realLookupTable[idx], 4);
inputSI++;
outputSI += 4;
}
inputIt.NextSpan();
outputIt.NextSpan();
}
}
// Internal method which should never be used anywhere else and should not be in th header.
//----------------------------------------------------------------------------
// This templated function executes the filter for any type of data.
template <class T>
void vtkApplyLookupTableOnScalars(vtkMitkLevelWindowFilter *self,
vtkImageData *inData,
vtkImageData *outData,
int outExt[6],
double *clippingBounds,
T *)
{
vtkImageIterator<T> inputIt(inData, outExt);
vtkImageIterator<unsigned char> outputIt(outData, outExt);
vtkScalarsToColors *lookupTable = self->GetLookupTable();
int y = outExt[2];
// Loop through ouput pixels
while (!outputIt.IsAtEnd())
{
unsigned char *outputSI = outputIt.BeginSpan();
- unsigned char *outputSIEnd = outputIt.EndSpan();
+ const unsigned char * const outputSIEnd = outputIt.EndSpan();
// do we iterate over the inner vertical clipping bounds
if (y >= clippingBounds[2] && y < clippingBounds[3])
{
T *inputSI = inputIt.BeginSpan();
int x = outExt[0];
while (outputSI != outputSIEnd)
{
// is this pixel within horizontal clipping bounds
if (x >= clippingBounds[0] && x < clippingBounds[1])
{
// fetching original value
auto grayValue = static_cast<double>(*inputSI);
- // applying lookuptable - copy the 4 (RGBA) chars as a single int
- *reinterpret_cast<int *>(outputSI) = *reinterpret_cast<int *>(lookupTable->MapValue(grayValue));
+ // applying lookuptable
+ memcpy(outputSI, lookupTable->MapValue(grayValue), 4);
}
else
{
// outer horizontal clipping bounds - write a transparent RGBA pixel as a single int
- *reinterpret_cast<int *>(outputSI) = 0;
+ memset(outputSI, 0, 4);
}
inputSI++;
outputSI += 4;
x++;
}
}
else
{
// outer vertical clipping bounds - write a transparent RGBA line as ints
while (outputSI != outputSIEnd)
{
*reinterpret_cast<int *>(outputSI) = 0;
outputSI += 4;
}
}
inputIt.NextSpan();
outputIt.NextSpan();
y++;
}
}
// Internal method which should never be used anywhere else and should not be in th header.
//----------------------------------------------------------------------------
// This templated function executes the filter for any type of data.
template <class T>
void vtkApplyLookupTableOnScalarsCTF(vtkMitkLevelWindowFilter *self,
vtkImageData *inData,
vtkImageData *outData,
int outExt[6],
double *clippingBounds,
T *)
{
vtkImageIterator<T> inputIt(inData, outExt);
vtkImageIterator<unsigned char> outputIt(outData, outExt);
auto *lookupTable = dynamic_cast<vtkColorTransferFunction *>(self->GetLookupTable());
vtkPiecewiseFunction *opacityFunction = self->GetOpacityPiecewiseFunction();
int y = outExt[2];
// Loop through ouput pixels
while (!outputIt.IsAtEnd())
{
unsigned char *outputSI = outputIt.BeginSpan();
unsigned char *outputSIEnd = outputIt.EndSpan();
// do we iterate over the inner vertical clipping bounds
if (y >= clippingBounds[2] && y < clippingBounds[3])
{
T *inputSI = inputIt.BeginSpan();
int x = outExt[0];
while (outputSI != outputSIEnd)
{
// is this pixel within horizontal clipping bounds
if (x >= clippingBounds[0] && x < clippingBounds[1])
{
// fetching original value
auto grayValue = static_cast<double>(*inputSI);
// applying directly colortransferfunction
// because vtkColorTransferFunction::MapValue is not threadsafe
double rgba[4];
lookupTable->GetColor(grayValue, rgba); // RGB mapping
rgba[3] = 1.0;
if (opacityFunction)
rgba[3] = opacityFunction->GetValue(grayValue); // Alpha mapping
for (int i = 0; i < 4; ++i)
{
outputSI[i] = static_cast<unsigned char>(255.0 * rgba[i] + 0.5);
}
}
else
{
// outer horizontal clipping bounds - write a transparent RGBA pixel as a single int
*reinterpret_cast<int *>(outputSI) = 0;
}
inputSI++;
outputSI += 4;
x++;
}
}
else
{
// outer vertical clipping bounds - write a transparent RGBA line as ints
while (outputSI != outputSIEnd)
{
*reinterpret_cast<int *>(outputSI) = 0;
outputSI += 4;
}
}
inputIt.NextSpan();
outputIt.NextSpan();
y++;
}
}
int vtkMitkLevelWindowFilter::RequestInformation(vtkInformation *request,
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
vtkInformation *outInfo = outputVector->GetInformationObject(0);
// do nothing except copy scalar type info
this->CopyInputArrayAttributesToOutput(request, inputVector, outputVector);
vtkDataObject::SetPointDataActiveScalarInfo(outInfo, VTK_UNSIGNED_CHAR, 4);
return 1;
}
// Method to run the filter in different threads.
void vtkMitkLevelWindowFilter::ThreadedExecute(vtkImageData *inData, vtkImageData *outData, int extent[6], int /*id*/)
{
if (inData->GetNumberOfScalarComponents() > 2)
{
switch (inData->GetScalarType())
{
vtkTemplateMacro(
vtkApplyLookupTableOnRGBA(this, inData, outData, extent, m_ClippingBounds, static_cast<VTK_TT *>(nullptr)));
default:
vtkErrorMacro(<< "Execute: Unknown ScalarType");
return;
}
}
else
{
bool dontClip = extent[2] >= m_ClippingBounds[2] && extent[3] <= m_ClippingBounds[3] &&
extent[0] >= m_ClippingBounds[0] && extent[1] <= m_ClippingBounds[1];
if (this->GetLookupTable())
this->GetLookupTable()->Build();
auto *vlt = dynamic_cast<vtkLookupTable *>(this->GetLookupTable());
auto *ctf = dynamic_cast<vtkColorTransferFunction *>(this->GetLookupTable());
bool linearLookupTable = vlt && vlt->GetScale() == VTK_SCALE_LINEAR;
bool useFast = dontClip && linearLookupTable;
if (ctf)
{
switch (inData->GetScalarType())
{
vtkTemplateMacro(vtkApplyLookupTableOnScalarsCTF(
this, inData, outData, extent, m_ClippingBounds, static_cast<VTK_TT *>(nullptr)));
default:
vtkErrorMacro(<< "Execute: Unknown ScalarType");
return;
}
}
else if (useFast)
{
switch (inData->GetScalarType())
{
vtkTemplateMacro(
vtkApplyLookupTableOnScalarsFast(this, inData, outData, extent, static_cast<VTK_TT *>(nullptr)));
default:
vtkErrorMacro(<< "Execute: Unknown ScalarType");
return;
}
}
else
{
switch (inData->GetScalarType())
{
vtkTemplateMacro(vtkApplyLookupTableOnScalars(
this, inData, outData, extent, m_ClippingBounds, static_cast<VTK_TT *>(nullptr)));
default:
vtkErrorMacro(<< "Execute: Unknown ScalarType");
return;
}
}
}
}
// void vtkMitkLevelWindowFilter::ExecuteInformation(
// vtkImageData *vtkNotUsed(inData), vtkImageData *vtkNotUsed(outData))
//{
//}
void vtkMitkLevelWindowFilter::SetMinOpacity(double minOpacity)
{
m_MinOpacity = minOpacity;
}
inline double vtkMitkLevelWindowFilter::GetMinOpacity() const
{
return m_MinOpacity;
}
void vtkMitkLevelWindowFilter::SetMaxOpacity(double maxOpacity)
{
m_MaxOpacity = maxOpacity;
}
inline double vtkMitkLevelWindowFilter::GetMaxOpacity() const
{
return m_MaxOpacity;
}
void vtkMitkLevelWindowFilter::SetClippingBounds(double *bounds) // TODO does double[4] work??
{
for (unsigned int i = 0; i < 4; ++i)
m_ClippingBounds[i] = bounds[i];
}
diff --git a/Modules/Core/test/CMakeLists.txt b/Modules/Core/test/CMakeLists.txt
index 7b3e5e46e9..d3d3321aed 100644
--- a/Modules/Core/test/CMakeLists.txt
+++ b/Modules/Core/test/CMakeLists.txt
@@ -1,192 +1,181 @@
# The core tests need relaxed compiler flags...
# TODO fix core tests to compile without these additional no-error flags
if(MSVC_VERSION)
# disable deprecated warnings (they would lead to errors)
mitkFunctionCheckCAndCXXCompilerFlags("/wd4996" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
else()
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=deprecated" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=deprecated-declarations" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
endif()
MITK_CREATE_MODULE_TESTS()
if(TARGET ${TESTDRIVER})
- mitk_use_modules(TARGET ${TESTDRIVER} PACKAGES ITK|ITKThresholding+ITKTestKernel VTK|vtkTestingRendering tinyxml)
+ mitk_use_modules(TARGET ${TESTDRIVER} PACKAGES ITK|ITKThresholding+ITKTestKernel VTK|TestingRendering tinyxml)
mitkAddCustomModuleTest(mitkVolumeCalculatorTest_Png2D-bw mitkVolumeCalculatorTest
${MITK_DATA_DIR}/Png2D-bw.png
${MITK_DATA_DIR}/Pic2DplusT.nrrd
)
mitkAddCustomModuleTest(mitkEventConfigTest_CreateObjectInDifferentWays mitkEventConfigTest
${MITK_SOURCE_DIR}/Modules/Core/test/resource/Interactions/StatemachineConfigTest.xml
)
mitkAddCustomModuleTest(mitkDataStorageTest_US4DCyl mitkDataStorageTest
${MITK_DATA_DIR}/US4DCyl.nrrd
)
mitkAddCustomModuleTest(mitkPointSetReaderTest mitkPointSetReaderTest
${MITK_DATA_DIR}/PointSetReaderTestData.mps
)
mitkAddCustomModuleTest(mitkImageTest_4DImageData mitkImageTest
${MITK_DATA_DIR}/US4DCyl.nrrd
)
mitkAddCustomModuleTest(mitkImageTest_2D+tImageData mitkImageTest
${MITK_DATA_DIR}/Pic2DplusT.nrrd
)
mitkAddCustomModuleTest(mitkImageTest_3DImageData mitkImageTest
${MITK_DATA_DIR}/Pic3D.nrrd
)
mitkAddCustomModuleTest(mitkImageEqualTest mitkImageEqualTest)
mitkAddCustomModuleTest(mitkImageTest_brainImage mitkImageTest
${MITK_DATA_DIR}/brain.mhd
)
mitkAddCustomModuleTest(mitkLevelWindowManagerTest mitkLevelWindowManagerTest
${MITK_DATA_DIR}/Pic3D.nrrd
)
mitkAddCustomModuleTest(mitkMultiComponentImageDataComparisonFilterTest mitkMultiComponentImageDataComparisonFilterTest
${MITK_DATA_DIR}/NrrdWritingTestImage.jpg
)
mitkAddCustomModuleTest(mitkImageToItkTest mitkImageToItkTest
${MITK_DATA_DIR}/Pic3D.nrrd
)
mitkAddCustomModuleTest(mitkImageSliceSelectorTest mitkImageSliceSelectorTest
${MITK_DATA_DIR}/Pic2DplusT.nrrd
)
mitkAddCustomModuleTest(mitkRotatedSlice4DTest mitkRotatedSlice4DTest
${MITK_DATA_DIR}/UltrasoundImages/4D_TEE_Data_MV.dcm
)
- mitkAddCustomModuleTest(mitkImageVtkMapper2D_rgbaImage640x480 mitkImageVtkMapper2DTest
+ mitkAddCustomModuleRenderingTest(mitkImageVtkMapper2D_rgbaImage640x480 mitkImageVtkMapper2DTest
${MITK_DATA_DIR}/RenderingTestData/rgbaImage.png #input image to load in data storage
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/rgbaImage640x480REF.png #corresponding reference screenshot
)
- mitkAddCustomModuleTest(mitkImageVtkMapper2D_pic3d640x480 mitkImageVtkMapper2DTest #test for standard Pic3D axial slice
+ mitkAddCustomModuleRenderingTest(mitkImageVtkMapper2D_pic3d640x480 mitkImageVtkMapper2DTest #test for standard Pic3D axial slice
${MITK_DATA_DIR}/Pic3D.nrrd #input image to load in data storage
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/pic3d640x480REF.png #corresponding reference screenshot
)
- mitkAddCustomModuleTest(mitkImageVtkMapper2D_pic3dColorBlue640x480 mitkImageVtkMapper2DColorTest #test for color property (=blue) Pic3D sagittal slice
+ mitkAddCustomModuleRenderingTest(mitkImageVtkMapper2D_pic3dColorBlue640x480 mitkImageVtkMapper2DColorTest #test for color property (=blue) Pic3D sagittal slice
${MITK_DATA_DIR}/Pic3D.nrrd #input image to load in data storage
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/pic3dColorBlue640x480REF.png #corresponding reference screenshot
)
- mitkAddCustomModuleTest(mitkImageVtkMapper2D_pic3dLevelWindow640x480 mitkImageVtkMapper2DLevelWindowTest #test for levelwindow property (=blood) #Pic3D sagittal slice
+ mitkAddCustomModuleRenderingTest(mitkImageVtkMapper2D_pic3dLevelWindow640x480 mitkImageVtkMapper2DLevelWindowTest #test for levelwindow property (=blood) #Pic3D sagittal slice
${MITK_DATA_DIR}/Pic3D.nrrd #input image to load in data storage
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/pic3dLevelWindowBlood640x480REF.png #corresponding reference #screenshot
)
- #mitkAddCustomModuleTest(mitkImageVtkMapper2D_pic3dOpacity640x480 mitkImageVtkMapper2DOpacityTest #test for opacity (=0.5) Pic3D coronal slice
- # ${MITK_DATA_DIR}/Pic3D.nrrd #input image to load in data storage
- # -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/pic3dOpacity640x480REF.png corresponding reference screenshot
- #)
- mitkAddCustomModuleTest(mitkImageVtkMapper2D_pic3dSwivel640x480 mitkImageVtkMapper2DSwivelTest #test for a randomly chosen Pic3D swivelled slice
+ mitkAddCustomModuleRenderingTest(mitkImageVtkMapper2D_pic3dSwivel640x480 mitkImageVtkMapper2DSwivelTest #test for a randomly chosen Pic3D swivelled slice
${MITK_DATA_DIR}/Pic3D.nrrd #input image to load in data storage
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/pic3dSwivel640x480REF.png #corresponding reference screenshot
)
- mitkAddCustomModuleTest(mitkPointSetVtkMapper2D_openMeAlone640x480 mitkPointSetVtkMapper2DTest
+ mitkAddCustomModuleRenderingTest(mitkPointSetVtkMapper2D_openMeAlone640x480 mitkPointSetVtkMapper2DTest
${MITK_DATA_DIR}/RenderingTestData/openMeAlone.mps #input point set to load in data storage
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/openMeAlone640x480REF.png #corresponding reference screenshot
)
- mitkAddCustomModuleTest(mitkPointSetVtkMapper2D_Pic3DPointSetForPic3D640x480 mitkPointSetVtkMapper2DImageTest
+ mitkAddCustomModuleRenderingTest(mitkPointSetVtkMapper2D_Pic3DPointSetForPic3D640x480 mitkPointSetVtkMapper2DImageTest
${MITK_DATA_DIR}/Pic3D.nrrd ${MITK_DATA_DIR}/RenderingTestData/PointSetForPic3D.mps #input point set and image to load in data storage
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/Pic3DPointSetForPic3D640x480REF.png #corresponding reference screenshot
)
- mitkAddCustomModuleTest(mitkPointSetVtkMapper2D_openMeAloneGlyphType640x480 mitkPointSetVtkMapper2DGlyphTypeTest
+ mitkAddCustomModuleRenderingTest(mitkPointSetVtkMapper2D_openMeAloneGlyphType640x480 mitkPointSetVtkMapper2DGlyphTypeTest
${MITK_DATA_DIR}/RenderingTestData/openMeAlone.mps #input point set to load in data storage
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/openMeAloneGlyphType640x480REF.png #corresponding reference screenshot
)
- mitkAddCustomModuleTest(mitkPointSetVtkMapper2D_openMeAloneTransformed640x480 mitkPointSetVtkMapper2DTransformedPointsTest
+ mitkAddCustomModuleRenderingTest(mitkPointSetVtkMapper2D_openMeAloneTransformed640x480 mitkPointSetVtkMapper2DTransformedPointsTest
${MITK_DATA_DIR}/RenderingTestData/openMeAlone.mps #input point set to load in data storage
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/openMeAloneTransformedPoints640x480REF.png #corresponding reference screenshot
)
# Currently not working on windows because of a rendering timing issue
# see bug 18083 for details
if(NOT WIN32)
- mitkAddCustomModuleTest(mitkSurfaceDepthSortingTransparency_StanfordBunnySTL640x480 mitkSurfaceDepthSortingTest
+ mitkAddCustomModuleRenderingTest(mitkSurfaceDepthSortingTransparency_StanfordBunnySTL640x480 mitkSurfaceDepthSortingTest
${MITK_DATA_DIR}/RenderingTestData/Stanford_bunny.stl
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/Stanford_bunnySTLDepthSorting640x480REF.png)
endif()
# BUG 18695 - tests deactivated, because win 32 bit continuous renders images slightly different. TODO!
#Test reslice interpolation
#note: nearest mode is already tested by swivel test
- #mitkAddCustomModuleTest(ResliceInterpolationIsLinear mitkImageVtkMapper2DResliceInterpolationPropertyTest
+ #mitkAddCustomModuleRenderingTest(ResliceInterpolationIsLinear mitkImageVtkMapper2DResliceInterpolationPropertyTest
# 1 #linear
# ${MITK_DATA_DIR}/Pic3D.nrrd
# -V
# ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/pic3dRefLinear.png #corresponding reference screenshot LINEAR
#)
- #mitkAddCustomModuleTest(ResliceInterpolationIsCubic mitkImageVtkMapper2DResliceInterpolationPropertyTest
+ #mitkAddCustomModuleRenderingTest(ResliceInterpolationIsCubic mitkImageVtkMapper2DResliceInterpolationPropertyTest
# 3 #cubic
# ${MITK_DATA_DIR}/Pic3D.nrrd
# -V
# ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/pic3dRefCubic.png #corresponding reference screenshot CUBIC
#)
#End test reslice interpolation
# Testing of the rendering of binary images
- #mitkAddCustomModuleTest(mitkImageVtkMapper2D_binaryTestImage640x480 mitkImageVtkMapper2DTest #test for standard Pic3D axial slice
+ #mitkAddCustomModuleRenderingTest(mitkImageVtkMapper2D_binaryTestImage640x480 mitkImageVtkMapper2DTest #test for standard Pic3D axial slice
# ${MITK_DATA_DIR}/RenderingTestData/binaryImage.nrrd #input image to load in data storage
# -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/binaryImage640x480REF.png #corresponding reference screenshot
#)
- #mitkAddCustomModuleTest(mitkImageVtkMapper2D_binaryTestImageWithRef640x480 mitkImageVtkMapper2DTest #test for standard Pic3D axial slice
+ #mitkAddCustomModuleRenderingTest(mitkImageVtkMapper2D_binaryTestImageWithRef640x480 mitkImageVtkMapper2DTest #test for standard Pic3D axial slice
# ${MITK_DATA_DIR}/Pic3D.nrrd ${MITK_DATA_DIR}/RenderingTestData/binaryImage.nrrd #input image to load in data storage
# -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/binaryImageWithRef640x480REF.png #corresponding reference screenshot
#)
# End of binary image tests
- mitkAddCustomModuleTest(mitkSurfaceVtkMapper3DTest_TextureProperty mitkSurfaceVtkMapper3DTest
+ mitkAddCustomModuleRenderingTest(mitkSurfaceVtkMapper3DTest_TextureProperty mitkSurfaceVtkMapper3DTest
${MITK_DATA_DIR}/RenderingTestData/earth.jpg
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/texturedSphere640x480REF.png #corresponding reference screenshot
)
- mitkAddCustomModuleTest(mitkImageVtkMapper2DTransferFunctionTest_Png2D-bw mitkImageVtkMapper2DTransferFunctionTest
+ mitkAddCustomModuleRenderingTest(mitkImageVtkMapper2DTransferFunctionTest_Png2D-bw mitkImageVtkMapper2DTransferFunctionTest
${MITK_DATA_DIR}/Png2D-bw.png
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/Png2D-bw-TransferFunctionRGBImage640x480REF.png #corresponding reference screenshot
)
- mitkAddCustomModuleTest(mitkImageVtkMapper2DOpacityTransferFunctionTest_Png2D-bw mitkImageVtkMapper2DOpacityTransferFunctionTest
+ mitkAddCustomModuleRenderingTest(mitkImageVtkMapper2DOpacityTransferFunctionTest_Png2D-bw mitkImageVtkMapper2DOpacityTransferFunctionTest
${MITK_DATA_DIR}/Png2D-bw.png
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/Png2D-bw-OpacityTransferFunctionRGBImage640x480REF.png #corresponding reference screenshot
)
############################## DISABLED TESTS
- mitkAddCustomModuleTest(mitkImageVtkMapper2DLookupTableTest_Png2D-bw mitkImageVtkMapper2DLookupTableTest
+ mitkAddCustomModuleRenderingTest(mitkImageVtkMapper2DLookupTableTest_Png2D-bw mitkImageVtkMapper2DLookupTableTest
${MITK_DATA_DIR}/Png2D-bw.png
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/Png2D-bw-LookupTableRGBImage640x480REF.png #corresponding reference screenshot
)
- #mitkAddCustomModuleTest(mitkImageTest_color2DImage mitkImageTest
+ #mitkAddCustomModuleRenderingTest(mitkImageTest_color2DImage mitkImageTest
# ${MITK_DATA_DIR}/NrrdWritingTestImage.jpg
#)
- #mitkAddCustomModuleTest(mitkNodeDependentPointSetInteractorTest mitkNodeDependentPointSetInteractorTest
+ #mitkAddCustomModuleRenderingTest(mitkNodeDependentPointSetInteractorTest mitkNodeDependentPointSetInteractorTest
# ${MITK_DATA_DIR}/Pic3D.pic.gz ${MITK_DATA_DIR}/BallBinary30x30x30.pic.gz
#)
- mitkAddCustomModuleTest(mitkPlaneGeometryDataMapper2DTest mitkPlaneGeometryDataMapper2DTest
+ mitkAddCustomModuleRenderingTest(mitkPlaneGeometryDataMapper2DTest mitkPlaneGeometryDataMapper2DTest
${MITK_DATA_DIR}/Pic3D.nrrd #input image to load in data storage
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/PlaneGeometryMapper640x480REF.png #corresponding reference screenshot
)
-
- SET_PROPERTY(TEST mitkRotatedSlice4DTest mitkImageVtkMapper2D_rgbaImage640x480 mitkImageVtkMapper2D_pic3d640x480 mitkImageVtkMapper2D_pic3dColorBlue640x480 mitkImageVtkMapper2D_pic3dLevelWindow640x480 mitkImageVtkMapper2D_pic3dSwivel640x480 mitkImageVtkMapper2DTransferFunctionTest_Png2D-bw
- # mitkImageVtkMapper2D_pic3dOpacity640x480
- mitkSurfaceVtkMapper2DTest mitkSurfaceVtkMapper3DTest_TextureProperty mitkPointSetVtkMapper2D_Pic3DPointSetForPic3D640x480 mitkPointSetVtkMapper2D_openMeAlone640x480 mitkPointSetVtkMapper2D_openMeAloneGlyphType640x480 mitkPointSetVtkMapper2D_openMeAloneTransformed640x480
- mitkPlaneGeometryDataMapper2DTest
- PROPERTY RUN_SERIAL TRUE)
-
endif() # TARGET ${TESTDRIVER}
diff --git a/Modules/Core/test/files.cmake b/Modules/Core/test/files.cmake
index 63b574f8ed..201b7c43ef 100644
--- a/Modules/Core/test/files.cmake
+++ b/Modules/Core/test/files.cmake
@@ -1,195 +1,198 @@
# tests with no extra command line parameter
set(MODULE_TESTS
# IMPORTANT: If you plan to deactivate / comment out a test please write a bug number to the commented out line of code.
#
# Example: #mitkMyTest #this test is commented out because of bug 12345
#
# It is important that the bug is open and that the test will be activated again before the bug is closed. This assures that
# no test is forgotten after it was commented out. If there is no bug for your current problem, please add a new one and
# mark it as critical.
################## DISABLED TESTS #################################################
#mitkAbstractTransformGeometryTest.cpp #seems as tested class mitkExternAbstractTransformGeometry doesnt exist any more
#mitkStateMachineContainerTest.cpp #rewrite test, indirect since no longer exported Bug 14529
#mitkRegistrationBaseTest.cpp #tested class mitkRegistrationBase doesn't exist any more
#mitkSegmentationInterpolationTest.cpp #file doesn't exist!
#mitkPipelineSmartPointerCorrectnessTest.cpp #file doesn't exist!
#mitkITKThreadingTest.cpp #test outdated because itk::Semaphore was removed from ITK
#mitkAbstractTransformPlaneGeometryTest.cpp #mitkVtkAbstractTransformPlaneGeometry doesn't exist any more
#mitkTestUtilSharedLibrary.cpp #Linker problem with this test...
#mitkTextOverlay2DSymbolsRenderingTest.cpp #Implementation of the tested feature is not finished yet. Ask Christoph or see bug 15104 for details.
################# RUNNING TESTS ###################################################
mitkAccessByItkTest.cpp
mitkCoreObjectFactoryTest.cpp
mitkDataNodeTest.cpp
mitkMaterialTest.cpp
mitkActionTest.cpp
mitkDispatcherTest.cpp
mitkEnumerationPropertyTest.cpp
mitkFileReaderRegistryTest.cpp
#mitkFileWriterRegistryTest.cpp
mitkFloatToStringTest.cpp
mitkGenericPropertyTest.cpp
mitkGeometry3DTest.cpp
mitkGeometry3DEqualTest.cpp
mitkGeometryDataIOTest.cpp
mitkGeometryDataToSurfaceFilterTest.cpp
mitkImageCastTest.cpp
mitkImageDataItemTest.cpp
mitkImageGeneratorTest.cpp
mitkIOUtilTest.cpp
mitkBaseDataTest.cpp
mitkImportItkImageTest.cpp
mitkGrabItkImageMemoryTest.cpp
mitkInstantiateAccessFunctionTest.cpp
mitkLevelWindowTest.cpp
mitkMessageTest.cpp
mitkPixelTypeTest.cpp
mitkPlaneGeometryTest.cpp
mitkPointSetTest.cpp
mitkPointSetEqualTest.cpp
mitkPointSetFileIOTest.cpp
mitkPointSetOnEmptyTest.cpp
mitkPointSetLocaleTest.cpp
mitkPointSetWriterTest.cpp
mitkPointSetPointOperationsTest.cpp
mitkProgressBarTest.cpp
mitkPropertyTest.cpp
mitkPropertyListTest.cpp
mitkPropertyPersistenceTest.cpp
mitkPropertyPersistenceInfoTest.cpp
mitkPropertyRelationRuleBaseTest.cpp
mitkPropertyRelationsTest.cpp
mitkSlicedGeometry3DTest.cpp
mitkSliceNavigationControllerTest.cpp
mitkSurfaceTest.cpp
mitkSurfaceEqualTest.cpp
mitkSurfaceToSurfaceFilterTest.cpp
mitkTimeGeometryTest.cpp
mitkProportionalTimeGeometryTest.cpp
mitkUndoControllerTest.cpp
mitkVtkWidgetRenderingTest.cpp
mitkVerboseLimitedLinearUndoTest.cpp
mitkWeakPointerTest.cpp
mitkTransferFunctionTest.cpp
mitkStepperTest.cpp
mitkRenderingManagerTest.cpp
mitkCompositePixelValueToStringTest.cpp
vtkMitkThickSlicesFilterTest.cpp
mitkNodePredicateSourceTest.cpp
mitkNodePredicateDataPropertyTest.cpp
mitkNodePredicateFunctionTest.cpp
mitkVectorTest.cpp
mitkClippedSurfaceBoundsCalculatorTest.cpp
mitkExceptionTest.cpp
mitkExtractSliceFilterTest.cpp
mitkLogTest.cpp
mitkImageDimensionConverterTest.cpp
mitkLoggingAdapterTest.cpp
mitkUIDGeneratorTest.cpp
mitkPlanePositionManagerTest.cpp
mitkAffineTransformBaseTest.cpp
mitkPropertyAliasesTest.cpp
mitkPropertyDescriptionsTest.cpp
mitkPropertyExtensionsTest.cpp
mitkPropertyFiltersTest.cpp
mitkPropertyKeyPathTest.cpp
mitkTinyXMLTest.cpp
mitkRawImageFileReaderTest.cpp
mitkInteractionEventTest.cpp
mitkLookupTableTest.cpp
mitkSTLFileReaderTest.cpp
mitkPointTypeConversionTest.cpp
mitkVectorTypeConversionTest.cpp
mitkMatrixTypeConversionTest.cpp
mitkArrayTypeConversionTest.cpp
mitkSurfaceToImageFilterTest.cpp
mitkBaseGeometryTest.cpp
mitkImageToSurfaceFilterTest.cpp
mitkEqualTest.cpp
mitkLineTest.cpp
mitkArbitraryTimeGeometryTest.cpp
mitkItkImageIOTest.cpp
mitkLevelWindowManagerCppUnitTest.cpp
mitkVectorPropertyTest.cpp
mitkTemporoSpatialStringPropertyTest.cpp
mitkPropertyNameHelperTest.cpp
mitkNodePredicateGeometryTest.cpp
mitkNodePredicateSubGeometryTest.cpp
mitkPreferenceListReaderOptionsFunctorTest.cpp
mitkGenericIDRelationRuleTest.cpp
mitkSourceImageRelationRuleTest.cpp
- mitkPointSetDataInteractorTest.cpp #since mitkInteractionTestHelper is currently creating a vtkRenderWindow
- mitkSurfaceVtkMapper2DTest.cpp #new rendering test in CppUnit style
- mitkSurfaceVtkMapper2D3DTest.cpp # comparisons/consistency 2D/3D
mitkTemporalJoinImagesFilterTest.cpp
)
+set(MODULE_RENDERING_TESTS
+ mitkPointSetDataInteractorTest.cpp
+ mitkSurfaceVtkMapper2DTest.cpp
+ mitkSurfaceVtkMapper2D3DTest.cpp
+)
+
# test with image filename as an extra command line parameter
set(MODULE_IMAGE_TESTS
mitkImageTimeSelectorTest.cpp #only runs on images
mitkImageAccessorTest.cpp #only runs on images
)
set(MODULE_SURFACE_TESTS
mitkSurfaceVtkWriterTest.cpp #only runs on surfaces
)
# list of images for which the tests are run
set(MODULE_TESTIMAGE
US4DCyl.nrrd
Pic3D.nrrd
Pic2DplusT.nrrd
BallBinary30x30x30.nrrd
Png2D-bw.png
)
set(MODULE_TESTSURFACE
binary.stl
ball.stl
)
set(MODULE_CUSTOM_TESTS
mitkDataStorageTest.cpp
mitkDataNodeTest.cpp
mitkEventConfigTest.cpp
mitkPointSetLocaleTest.cpp
mitkImageTest.cpp
mitkImageVtkMapper2DTest.cpp
mitkImageVtkMapper2DLevelWindowTest.cpp
mitkImageVtkMapper2DOpacityTest.cpp
mitkImageVtkMapper2DResliceInterpolationPropertyTest.cpp
mitkImageVtkMapper2DColorTest.cpp
mitkImageVtkMapper2DSwivelTest.cpp
mitkImageVtkMapper2DTransferFunctionTest.cpp
mitkImageVtkMapper2DOpacityTransferFunctionTest.cpp
mitkImageVtkMapper2DLookupTableTest.cpp
mitkSurfaceVtkMapper3DTest.cpp
mitkVolumeCalculatorTest.cpp
mitkLevelWindowManagerTest.cpp
mitkPointSetVtkMapper2DTest.cpp
mitkPointSetVtkMapper2DImageTest.cpp
mitkPointSetVtkMapper2DGlyphTypeTest.cpp
mitkPointSetVtkMapper2DTransformedPointsTest.cpp
mitkVTKRenderWindowSizeTest.cpp
mitkMultiComponentImageDataComparisonFilterTest.cpp
mitkImageToItkTest.cpp
mitkImageSliceSelectorTest.cpp
mitkPointSetReaderTest.cpp
mitkImageEqualTest.cpp
mitkRotatedSlice4DTest.cpp
mitkPlaneGeometryDataMapper2DTest.cpp
)
# Currently not working on windows because of a rendering timing issue
# see bug 18083 for details
if(NOT WIN32)
set(MODULE_CUSTOM_TESTS ${MODULE_CUSTOM_TESTS} mitkSurfaceDepthSortingTest.cpp)
endif()
set(RESOURCE_FILES
Interactions/AddAndRemovePoints.xml
Interactions/globalConfig.xml
Interactions/StatemachineTest.xml
Interactions/StatemachineConfigTest.xml
)
diff --git a/Modules/Core/test/mitkGeometry3DTest.cpp b/Modules/Core/test/mitkGeometry3DTest.cpp
index 5e93e0064c..ae6f8592be 100644
--- a/Modules/Core/test/mitkGeometry3DTest.cpp
+++ b/Modules/Core/test/mitkGeometry3DTest.cpp
@@ -1,622 +1,622 @@
/*============================================================================
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 "mitkGeometry3D.h"
#include <vnl/vnl_quaternion.h>
#include <vnl/vnl_quaternion.hxx>
#include "mitkInteractionConst.h"
#include "mitkRotationOperation.h"
#include <mitkImageCast.h>
#include <mitkMatrixConvert.h>
#include "mitkTestingMacros.h"
#include <fstream>
#include <mitkNumericTypes.h>
bool testGetAxisVectorVariants(mitk::Geometry3D *geometry)
{
int direction;
for (direction = 0; direction < 3; ++direction)
{
mitk::Vector3D frontToBack(0.);
switch (direction)
{
case 0:
frontToBack = geometry->GetCornerPoint(false, false, false) - geometry->GetCornerPoint(true, false, false);
break; // 7-3
case 1:
frontToBack = geometry->GetCornerPoint(false, false, false) - geometry->GetCornerPoint(false, true, false);
break; // 7-5
case 2:
frontToBack = geometry->GetCornerPoint(false, false, false) - geometry->GetCornerPoint(false, false, true);
break; // 7-2
}
std::cout << "Testing GetAxisVector(int) vs GetAxisVector(bool, bool, bool): ";
if (mitk::Equal(geometry->GetAxisVector(direction), frontToBack) == false)
{
std::cout << "[FAILED]" << std::endl;
return false;
}
std::cout << "[PASSED]" << std::endl;
}
return true;
}
bool testGetAxisVectorExtent(mitk::Geometry3D *geometry)
{
int direction;
for (direction = 0; direction < 3; ++direction)
{
if (mitk::Equal(geometry->GetAxisVector(direction).GetNorm(), geometry->GetExtentInMM(direction)) == false)
{
std::cout << "[FAILED]" << std::endl;
return false;
}
std::cout << "[PASSED]" << std::endl;
}
return true;
}
// a part of the test requires axis-parallel coordinates
int testIndexAndWorldConsistency(mitk::Geometry3D *geometry3d)
{
MITK_TEST_OUTPUT(<< "Testing consistency of index and world coordinate systems: ");
mitk::Point3D origin = geometry3d->GetOrigin();
mitk::Point3D dummy;
MITK_TEST_OUTPUT(<< " Testing index->world->index conversion consistency");
geometry3d->WorldToIndex(origin, dummy);
geometry3d->IndexToWorld(dummy, dummy);
MITK_TEST_CONDITION_REQUIRED(dummy == origin, "");
MITK_TEST_OUTPUT(<< " Testing WorldToIndex(origin, mitk::Point3D)==(0,0,0)");
mitk::Point3D globalOrigin;
mitk::FillVector3D(globalOrigin, 0, 0, 0);
mitk::Point3D originContinuousIndex;
geometry3d->WorldToIndex(origin, originContinuousIndex);
MITK_TEST_CONDITION_REQUIRED(originContinuousIndex == globalOrigin, "");
MITK_TEST_OUTPUT(<< " Testing WorldToIndex(origin, itk::Index)==(0,0,0)");
itk::Index<3> itkindex;
geometry3d->WorldToIndex(origin, itkindex);
itk::Index<3> globalOriginIndex;
mitk::vtk2itk(globalOrigin, globalOriginIndex);
MITK_TEST_CONDITION_REQUIRED(itkindex == globalOriginIndex, "");
MITK_TEST_OUTPUT(<< " Testing WorldToIndex(origin-0.5*spacing, itk::Index)==(0,0,0)");
mitk::Vector3D halfSpacingStep = geometry3d->GetSpacing() * 0.5;
mitk::Matrix3D rotation;
mitk::Point3D originOffCenter = origin - halfSpacingStep;
geometry3d->WorldToIndex(originOffCenter, itkindex);
MITK_TEST_CONDITION_REQUIRED(itkindex == globalOriginIndex, "");
MITK_TEST_OUTPUT(<< " Testing WorldToIndex(origin+0.5*spacing-eps, itk::Index)==(0,0,0)");
originOffCenter = origin + halfSpacingStep;
originOffCenter -= 0.0001;
geometry3d->WorldToIndex(originOffCenter, itkindex);
MITK_TEST_CONDITION_REQUIRED(itkindex == globalOriginIndex, "");
MITK_TEST_OUTPUT(<< " Testing WorldToIndex(origin+0.5*spacing, itk::Index)==(1,1,1)");
originOffCenter = origin + halfSpacingStep;
itk::Index<3> global111;
mitk::FillVector3D(global111, 1, 1, 1);
geometry3d->WorldToIndex(originOffCenter, itkindex);
MITK_TEST_CONDITION_REQUIRED(itkindex == global111, "");
MITK_TEST_OUTPUT(<< " Testing WorldToIndex(GetCenter())==BoundingBox.GetCenter: ");
mitk::Point3D center = geometry3d->GetCenter();
mitk::Point3D centerContIndex;
geometry3d->WorldToIndex(center, centerContIndex);
mitk::BoundingBox::ConstPointer boundingBox = geometry3d->GetBoundingBox();
mitk::BoundingBox::PointType centerBounds = boundingBox->GetCenter();
// itk assumes corner based geometry. If our geometry is center based (imageGoe == true), everything needs to be
// shifted
if (geometry3d->GetImageGeometry())
{
centerBounds[0] -= 0.5;
centerBounds[1] -= 0.5;
centerBounds[2] -= 0.5;
}
MITK_TEST_CONDITION_REQUIRED(mitk::Equal(centerContIndex, centerBounds), "");
MITK_TEST_OUTPUT(<< " Testing GetCenter()==IndexToWorld(BoundingBox.GetCenter): ");
center = geometry3d->GetCenter();
mitk::Point3D centerBoundsInWorldCoords;
geometry3d->IndexToWorld(centerBounds, centerBoundsInWorldCoords);
MITK_TEST_CONDITION_REQUIRED(mitk::Equal(center, centerBoundsInWorldCoords), "");
return EXIT_SUCCESS;
}
int testIndexAndWorldConsistencyForVectors(mitk::Geometry3D *geometry3d)
{
MITK_TEST_OUTPUT(<< "Testing consistency of index and world coordinate systems for vectors: ");
mitk::Vector3D xAxisMM = geometry3d->GetAxisVector(0);
mitk::Vector3D xAxisContinuousIndex;
mitk::Vector3D xAxisContinuousIndexDeprecated;
mitk::Point3D p, pIndex, origin;
origin = geometry3d->GetOrigin();
p[0] = xAxisMM[0];
p[1] = xAxisMM[1];
p[2] = xAxisMM[2];
geometry3d->WorldToIndex(p, pIndex);
geometry3d->WorldToIndex(xAxisMM, xAxisContinuousIndexDeprecated);
geometry3d->WorldToIndex(xAxisMM, xAxisContinuousIndex);
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndex[0] == pIndex[0], "");
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndex[1] == pIndex[1], "");
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndex[2] == pIndex[2], "");
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndex[0] == xAxisContinuousIndexDeprecated[0], "");
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndex[1] == xAxisContinuousIndexDeprecated[1], "");
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndex[2] == xAxisContinuousIndexDeprecated[2], "");
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndexDeprecated[0] == pIndex[0], "");
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndexDeprecated[1] == pIndex[1], "");
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndexDeprecated[2] == pIndex[2], "");
geometry3d->IndexToWorld(xAxisContinuousIndex, xAxisContinuousIndex);
geometry3d->IndexToWorld(xAxisContinuousIndexDeprecated, xAxisContinuousIndexDeprecated);
geometry3d->IndexToWorld(pIndex, p);
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndex == xAxisMM, "");
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndex[0] == p[0], "");
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndex[1] == p[1], "");
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndex[2] == p[2], "");
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndexDeprecated == xAxisMM, "");
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndexDeprecated[0] == p[0], "");
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndexDeprecated[1] == p[1], "");
MITK_TEST_CONDITION_REQUIRED(xAxisContinuousIndexDeprecated[2] == p[2], "");
return EXIT_SUCCESS;
}
int testIndexAndWorldConsistencyForIndex(mitk::Geometry3D *geometry3d)
{
MITK_TEST_OUTPUT(<< "Testing consistency of index and world coordinate systems: ");
// creating testing data
itk::Index<4> itkIndex4, itkIndex4b;
itk::Index<3> itkIndex3, itkIndex3b;
itk::Index<2> itkIndex2, itkIndex2b;
itk::Index<3> mitkIndex, mitkIndexb;
itkIndex4[0] = itkIndex4[1] = itkIndex4[2] = itkIndex4[3] = 4;
itkIndex3[0] = itkIndex3[1] = itkIndex3[2] = 6;
itkIndex2[0] = itkIndex2[1] = 2;
mitkIndex[0] = mitkIndex[1] = mitkIndex[2] = 13;
// check for constistency
mitk::Point3D point;
geometry3d->IndexToWorld(itkIndex2, point);
geometry3d->WorldToIndex(point, itkIndex2b);
MITK_TEST_CONDITION_REQUIRED(((itkIndex2b[0] == itkIndex2[0]) && (itkIndex2b[1] == itkIndex2[1])),
"Testing itk::index<2> for IndexToWorld/WorldToIndex consistency");
geometry3d->IndexToWorld(itkIndex3, point);
geometry3d->WorldToIndex(point, itkIndex3b);
MITK_TEST_CONDITION_REQUIRED(
((itkIndex3b[0] == itkIndex3[0]) && (itkIndex3b[1] == itkIndex3[1]) && (itkIndex3b[2] == itkIndex3[2])),
"Testing itk::index<3> for IndexToWorld/WorldToIndex consistency");
geometry3d->IndexToWorld(itkIndex4, point);
geometry3d->WorldToIndex(point, itkIndex4b);
MITK_TEST_CONDITION_REQUIRED(((itkIndex4b[0] == itkIndex4[0]) && (itkIndex4b[1] == itkIndex4[1]) &&
(itkIndex4b[2] == itkIndex4[2]) && (itkIndex4b[3] == 0)),
"Testing itk::index<3> for IndexToWorld/WorldToIndex consistency");
geometry3d->IndexToWorld(mitkIndex, point);
geometry3d->WorldToIndex(point, mitkIndexb);
MITK_TEST_CONDITION_REQUIRED(
((mitkIndexb[0] == mitkIndex[0]) && (mitkIndexb[1] == mitkIndex[1]) && (mitkIndexb[2] == mitkIndex[2])),
"Testing mitk::Index for IndexToWorld/WorldToIndex consistency");
return EXIT_SUCCESS;
}
#include <itkImage.h>
int testItkImageIsCenterBased()
{
MITK_TEST_OUTPUT(<< "Testing whether itk::Image coordinates are center-based.");
typedef itk::Image<int, 3> ItkIntImage3D;
ItkIntImage3D::Pointer itkintimage = ItkIntImage3D::New();
ItkIntImage3D::SizeType size;
size.Fill(10);
mitk::Point3D origin;
mitk::FillVector3D(origin, 2, 3, 7);
itkintimage->Initialize();
itkintimage->SetRegions(size);
itkintimage->SetOrigin(origin);
std::cout << "[PASSED]" << std::endl;
MITK_TEST_OUTPUT(<< " Testing itk::Image::TransformPhysicalPointToContinuousIndex(origin)==(0,0,0)");
mitk::Point3D globalOrigin;
mitk::FillVector3D(globalOrigin, 0, 0, 0);
itk::ContinuousIndex<mitk::ScalarType, 3> originContinuousIndex;
itkintimage->TransformPhysicalPointToContinuousIndex(origin, originContinuousIndex);
MITK_TEST_CONDITION_REQUIRED(originContinuousIndex == globalOrigin, "");
MITK_TEST_OUTPUT(<< " Testing itk::Image::TransformPhysicalPointToIndex(origin)==(0,0,0)");
itk::Index<3> itkindex;
itkintimage->TransformPhysicalPointToIndex(origin, itkindex);
itk::Index<3> globalOriginIndex;
mitk::vtk2itk(globalOrigin, globalOriginIndex);
MITK_TEST_CONDITION_REQUIRED(itkindex == globalOriginIndex, "");
MITK_TEST_OUTPUT(<< " Testing itk::Image::TransformPhysicalPointToIndex(origin-0.5*spacing)==(0,0,0)");
mitk::Vector3D halfSpacingStep = itkintimage->GetSpacing() * 0.5;
mitk::Matrix3D rotation;
mitk::Point3D originOffCenter = origin - halfSpacingStep;
itkintimage->TransformPhysicalPointToIndex(originOffCenter, itkindex);
MITK_TEST_CONDITION_REQUIRED(itkindex == globalOriginIndex, "");
MITK_TEST_OUTPUT(
<< " Testing itk::Image::TransformPhysicalPointToIndex(origin+0.5*spacing-eps, itk::Index)==(0,0,0)");
originOffCenter = origin + halfSpacingStep;
originOffCenter -= 0.0001;
itkintimage->TransformPhysicalPointToIndex(originOffCenter, itkindex);
MITK_TEST_CONDITION_REQUIRED(itkindex == globalOriginIndex, "");
MITK_TEST_OUTPUT(<< " Testing itk::Image::TransformPhysicalPointToIndex(origin+0.5*spacing, itk::Index)==(1,1,1)");
originOffCenter = origin + halfSpacingStep;
itk::Index<3> global111;
mitk::FillVector3D(global111, 1, 1, 1);
itkintimage->TransformPhysicalPointToIndex(originOffCenter, itkindex);
MITK_TEST_CONDITION_REQUIRED(itkindex == global111, "");
MITK_TEST_OUTPUT(<< "=> Yes, itk::Image coordinates are center-based.");
return EXIT_SUCCESS;
}
int testGeometry3D(bool imageGeometry)
{
// Build up a new image Geometry
mitk::Geometry3D::Pointer geometry3d = mitk::Geometry3D::New();
float bounds[] = {-10.0, 17.0, -12.0, 188.0, 13.0, 211.0};
MITK_TEST_OUTPUT(<< "Initializing");
geometry3d->Initialize();
MITK_TEST_OUTPUT(<< "Setting ImageGeometry to " << imageGeometry);
geometry3d->SetImageGeometry(imageGeometry);
MITK_TEST_OUTPUT(<< "Setting bounds by SetFloatBounds(): " << bounds);
geometry3d->SetFloatBounds(bounds);
MITK_TEST_OUTPUT(<< "Testing AxisVectors");
if (testGetAxisVectorVariants(geometry3d) == false)
return EXIT_FAILURE;
if (testGetAxisVectorExtent(geometry3d) == false)
return EXIT_FAILURE;
MITK_TEST_OUTPUT(<< "Creating an AffineTransform3D transform");
mitk::AffineTransform3D::MatrixType matrix;
matrix.SetIdentity();
matrix(1, 1) = 2;
mitk::AffineTransform3D::Pointer transform;
transform = mitk::AffineTransform3D::New();
transform->SetMatrix(matrix);
MITK_TEST_OUTPUT(<< "Testing a SetIndexToWorldTransform");
geometry3d->SetIndexToWorldTransform(transform);
MITK_TEST_OUTPUT(<< "Testing correctness of value returned by GetSpacing");
const mitk::Vector3D &spacing1 = geometry3d->GetSpacing();
mitk::Vector3D expectedSpacing;
expectedSpacing.Fill(1.0);
expectedSpacing[1] = 2;
if (mitk::Equal(spacing1, expectedSpacing) == false)
{
MITK_TEST_OUTPUT(<< " [FAILED]");
return EXIT_FAILURE;
}
MITK_TEST_OUTPUT(<< "Testing a Compose(transform)");
geometry3d->Compose(transform);
MITK_TEST_OUTPUT(<< "Testing correctness of value returned by GetSpacing");
const mitk::Vector3D &spacing2 = geometry3d->GetSpacing();
expectedSpacing[1] = 4;
if (mitk::Equal(spacing2, expectedSpacing) == false)
{
MITK_TEST_OUTPUT(<< " [FAILED]");
return EXIT_FAILURE;
}
MITK_TEST_OUTPUT(<< "Testing correctness of SetSpacing");
mitk::Vector3D newspacing;
mitk::FillVector3D(newspacing, 1.5, 2.5, 3.5);
geometry3d->SetSpacing(newspacing);
const mitk::Vector3D &spacing3 = geometry3d->GetSpacing();
if (mitk::Equal(spacing3, newspacing) == false)
{
MITK_TEST_OUTPUT(<< " [FAILED]");
return EXIT_FAILURE;
}
// Seperate Test function for Index and World consistency
testIndexAndWorldConsistency(geometry3d);
testIndexAndWorldConsistencyForVectors(geometry3d);
testIndexAndWorldConsistencyForIndex(geometry3d);
MITK_TEST_OUTPUT(<< "Testing a rotation of the geometry");
double angle = 35.0;
mitk::Vector3D rotationVector;
mitk::FillVector3D(rotationVector, 1, 0, 0);
mitk::Point3D center = geometry3d->GetCenter();
auto op = new mitk::RotationOperation(mitk::OpROTATE, center, rotationVector, angle);
geometry3d->ExecuteOperation(op);
MITK_TEST_OUTPUT(<< "Testing mitk::GetRotation() and success of rotation");
mitk::Matrix3D rotation;
mitk::GetRotation(geometry3d, rotation);
mitk::Vector3D voxelStep = rotation * newspacing;
mitk::Vector3D voxelStepIndex;
geometry3d->WorldToIndex(voxelStep, voxelStepIndex);
mitk::Vector3D expectedVoxelStepIndex;
expectedVoxelStepIndex.Fill(1);
MITK_TEST_CONDITION_REQUIRED(mitk::Equal(voxelStepIndex, expectedVoxelStepIndex), "");
delete op;
std::cout << "[PASSED]" << std::endl;
MITK_TEST_OUTPUT(<< "Testing that ImageGeometry is still " << imageGeometry);
MITK_TEST_CONDITION_REQUIRED(geometry3d->GetImageGeometry() == imageGeometry, "");
// Test if the translate function moves the origin correctly.
mitk::Point3D oldOrigin = geometry3d->GetOrigin();
// use some random values for translation
mitk::Vector3D translationVector;
translationVector.SetElement(0, 17.5f);
translationVector.SetElement(1, -32.3f);
translationVector.SetElement(2, 4.0f);
// compute ground truth
mitk::Point3D tmpResult = geometry3d->GetOrigin() + translationVector;
geometry3d->Translate(translationVector);
MITK_TEST_CONDITION(mitk::Equal(geometry3d->GetOrigin(), tmpResult), "Testing if origin was translated.");
translationVector *= -1; // vice versa
geometry3d->Translate(translationVector);
MITK_TEST_CONDITION(mitk::Equal(geometry3d->GetOrigin(), oldOrigin),
"Testing if the translation could be done vice versa.");
return EXIT_SUCCESS;
}
int testGeometryAfterCasting()
{
// Epsilon. Allowed difference for rotationvalue
float eps = 0.0001;
// Cast ITK and MITK images and see if geometry stays
- typedef itk::Image<double, 2> Image2DType;
- typedef itk::Image<double, 3> Image3DType;
+ typedef itk::Image<char, 2> Image2DType;
+ typedef itk::Image<char, 3> Image3DType;
// Create 3D ITK Image from Scratch, cast to 3D MITK image, compare Geometries
Image3DType::Pointer image3DItk = Image3DType::New();
Image3DType::RegionType myRegion;
Image3DType::SizeType mySize;
Image3DType::IndexType myIndex;
Image3DType::SpacingType mySpacing;
Image3DType::DirectionType myDirection, rotMatrixX, rotMatrixY, rotMatrixZ;
mySpacing[0] = 31;
mySpacing[1] = 0.1;
mySpacing[2] = 2.9;
myIndex[0] = -15;
myIndex[1] = 15;
myIndex[2] = 12;
mySize[0] = 10;
mySize[1] = 2;
- mySize[2] = 555;
+ mySize[2] = 5;
myRegion.SetSize(mySize);
myRegion.SetIndex(myIndex);
image3DItk->SetSpacing(mySpacing);
image3DItk->SetRegions(myRegion);
image3DItk->Allocate();
image3DItk->FillBuffer(0);
myDirection.SetIdentity();
rotMatrixX.SetIdentity();
rotMatrixY.SetIdentity();
rotMatrixZ.SetIdentity();
mitk::Image::Pointer mitkImage;
// direction [row] [coloum]
MITK_TEST_OUTPUT(<< "Casting a rotated 3D ITK Image to a MITK Image and check if Geometry is still same");
- for (double rotX = 0; rotX < (itk::Math::pi * 2); rotX += 0.4)
+ for (double rotX = 0; rotX < itk::Math::pi * 2; rotX += itk::Math::pi * 0.4)
{
// Set Rotation X
rotMatrixX[1][1] = cos(rotX);
rotMatrixX[1][2] = -sin(rotX);
rotMatrixX[2][1] = sin(rotX);
rotMatrixX[2][2] = cos(rotX);
- for (double rotY = 0; rotY < (itk::Math::pi * 2); rotY += 0.33)
+ for (double rotY = 0; rotY < itk::Math::pi * 2; rotY += itk::Math::pi * 0.3)
{
// Set Rotation Y
rotMatrixY[0][0] = cos(rotY);
rotMatrixY[0][2] = sin(rotY);
rotMatrixY[2][0] = -sin(rotY);
rotMatrixY[2][2] = cos(rotY);
- for (double rotZ = 0; rotZ < (itk::Math::pi * 2); rotZ += 0.5)
+ for (double rotZ = 0; rotZ < itk::Math::pi * 2; rotZ += itk::Math::pi * 0.2)
{
// Set Rotation Z
rotMatrixZ[0][0] = cos(rotZ);
rotMatrixZ[0][1] = -sin(rotZ);
rotMatrixZ[1][0] = sin(rotZ);
rotMatrixZ[1][1] = cos(rotZ);
// Multiply matrizes
myDirection = myDirection * rotMatrixX * rotMatrixY * rotMatrixZ;
image3DItk->SetDirection(myDirection);
mitk::CastToMitkImage(image3DItk, mitkImage);
const mitk::AffineTransform3D::MatrixType &matrix =
mitkImage->GetGeometry()->GetIndexToWorldTransform()->GetMatrix();
for (int row = 0; row < 3; row++)
{
for (int col = 0; col < 3; col++)
{
double mitkValue = matrix[row][col] / mitkImage->GetGeometry()->GetSpacing()[col];
double itkValue = myDirection[row][col];
double diff = mitkValue - itkValue;
// if you decrease this value, you can see that there might be QUITE high inaccuracy!!!
if (diff > eps) // need to check, how exact it SHOULD be .. since it is NOT EXACT!
{
std::cout << "Had a difference of : " << diff;
std::cout << "Error: Casting altered Geometry!";
std::cout << "ITK Matrix:\n" << myDirection;
std::cout << "Mitk Matrix (With Spacing):\n" << matrix;
std::cout << "Mitk Spacing: " << mitkImage->GetGeometry()->GetSpacing();
MITK_TEST_CONDITION_REQUIRED(false == true, "");
return false;
}
}
}
}
}
}
// Create 2D ITK Image from Scratch, cast to 2D MITK image, compare Geometries
Image2DType::Pointer image2DItk = Image2DType::New();
Image2DType::RegionType myRegion2D;
Image2DType::SizeType mySize2D;
Image2DType::IndexType myIndex2D;
Image2DType::SpacingType mySpacing2D;
Image2DType::DirectionType myDirection2D, rotMatrix;
mySpacing2D[0] = 31;
mySpacing2D[1] = 0.1;
myIndex2D[0] = -15;
myIndex2D[1] = 15;
mySize2D[0] = 10;
mySize2D[1] = 2;
myRegion2D.SetSize(mySize2D);
myRegion2D.SetIndex(myIndex2D);
image2DItk->SetSpacing(mySpacing2D);
image2DItk->SetRegions(myRegion2D);
image2DItk->Allocate();
image2DItk->FillBuffer(0);
myDirection2D.SetIdentity();
rotMatrix.SetIdentity();
// direction [row] [coloum]
MITK_TEST_OUTPUT(<< "Casting a rotated 2D ITK Image to a MITK Image and check if Geometry is still same");
- for (double rotTheta = 0; rotTheta < (itk::Math::pi * 2); rotTheta += 0.1)
+ for (double rotTheta = 0; rotTheta < itk::Math::pi * 2; rotTheta += itk::Math::pi * 0.2)
{
// Set Rotation
rotMatrix[0][0] = cos(rotTheta);
rotMatrix[0][1] = -sin(rotTheta);
rotMatrix[1][0] = sin(rotTheta);
rotMatrix[1][1] = cos(rotTheta);
// Multiply matrizes
myDirection2D = myDirection2D * rotMatrix;
image2DItk->SetDirection(myDirection2D);
mitk::CastToMitkImage(image2DItk, mitkImage);
const mitk::AffineTransform3D::MatrixType &matrix =
mitkImage->GetGeometry()->GetIndexToWorldTransform()->GetMatrix();
// Compare MITK and ITK matrix
for (int row = 0; row < 3; row++)
{
for (int col = 0; col < 3; col++)
{
double mitkValue = matrix[row][col] / mitkImage->GetGeometry()->GetSpacing()[col];
if ((row == 2) && (col == row))
{
if (mitkValue != 1)
{
MITK_TEST_OUTPUT(<< "After casting a 2D ITK to 3D MITK images, MITK matrix values for 0|2, 1|2, 2|0, 2|1 "
"MUST be 0 and value for 2|2 must be 1");
return false;
}
}
else if ((row == 2) || (col == 2))
{
if (mitkValue != 0)
{
MITK_TEST_OUTPUT(<< "After casting a 2D ITK to 3D MITK images, MITK matrix values for 0|2, 1|2, 2|0, 2|1 "
"MUST be 0 and value for 2|2 must be 1");
return false;
}
}
else
{
double itkValue = myDirection2D[row][col];
double diff = mitkValue - itkValue;
// if you decrease this value, you can see that there might be QUITE high inaccuracy!!!
if (diff > eps) // need to check, how exact it SHOULD be .. since it is NOT EXACT!
{
std::cout << "Had a difference of : " << diff;
std::cout << "Error: Casting altered Geometry!";
std::cout << "ITK Matrix:\n" << myDirection2D;
std::cout << "Mitk Matrix (With Spacing):\n" << matrix;
std::cout << "Mitk Spacing: " << mitkImage->GetGeometry()->GetSpacing();
MITK_TEST_CONDITION_REQUIRED(false == true, "");
return false;
}
}
}
}
}
// THIS WAS TESTED:
// 2D ITK -> 2D MITK,
// 3D ITK -> 3D MITK,
// Still need to test: 2D MITK Image with ADDITIONAL INFORMATION IN MATRIX -> 2D ITK
// 1. Possibility: 3x3 MITK matrix can be converted without loss into 2x2 ITK matrix
// 2. Possibility: 3x3 MITK matrix can only be converted with loss into 2x2 ITK matrix
// .. before implementing this, we wait for further development in geometry classes (e.g. Geoemtry3D::SetRotation(..))
return EXIT_SUCCESS;
}
int mitkGeometry3DTest(int /*argc*/, char * /*argv*/ [])
{
MITK_TEST_BEGIN(mitkGeometry3DTest);
int result;
MITK_TEST_CONDITION_REQUIRED((result = testItkImageIsCenterBased()) == EXIT_SUCCESS, "");
MITK_TEST_OUTPUT(<< "Running main part of test with ImageGeometry = false");
MITK_TEST_CONDITION_REQUIRED((result = testGeometry3D(false)) == EXIT_SUCCESS, "");
MITK_TEST_OUTPUT(<< "Running main part of test with ImageGeometry = true");
MITK_TEST_CONDITION_REQUIRED((result = testGeometry3D(true)) == EXIT_SUCCESS, "");
MITK_TEST_OUTPUT(<< "Running test to see if Casting MITK to ITK and the other way around destroys geometry");
MITK_TEST_CONDITION_REQUIRED((result = testGeometryAfterCasting()) == EXIT_SUCCESS, "");
MITK_TEST_END();
return EXIT_SUCCESS;
}
diff --git a/Modules/Core/test/mitkImageGeneratorTest.cpp b/Modules/Core/test/mitkImageGeneratorTest.cpp
index 8dfd22dea4..57dc747de6 100644
--- a/Modules/Core/test/mitkImageGeneratorTest.cpp
+++ b/Modules/Core/test/mitkImageGeneratorTest.cpp
@@ -1,327 +1,327 @@
/*============================================================================
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.
============================================================================*/
// Testing
#include "mitkTestFixture.h"
#include <mitkTestingMacros.h>
// MITK includes
#include <mitkCoreServices.h>
#include "mitkImage.h"
#include "mitkImageGenerator.h"
#include "mitkImageReadAccessor.h"
#include "mitkImageStatisticsHolder.h"
class mitkImageGeneratorTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkImageGeneratorTestSuite);
MITK_TEST(SetSpacingX2D_Success);
MITK_TEST(SetDefaultSpacingX2D_Success);
MITK_TEST(SetSpacingX3D_Success);
MITK_TEST(SetSpacingY2D_Success);
MITK_TEST(SetDefaultSpacingY2D_Success);
MITK_TEST(SetSpacingY3D_Success);
MITK_TEST(SetSpacingZ2D_Success);
MITK_TEST(SetDefaultSpacingZ2D_Success);
MITK_TEST(SetSpacingZ3D_Success);
MITK_TEST(SetDimension2D_Success);
MITK_TEST(SetDimension3D_Success);
MITK_TEST(SetDimension4D_Success);
MITK_TEST(SetDimensionX2D_Success);
MITK_TEST(SetDimensionY2D_Success);
MITK_TEST(SetDimensionZ3D_Success);
MITK_TEST(SetDimensionT4D_Success);
MITK_TEST(SetDimensions3Dc_Success);
MITK_TEST(SetDataTypeFloat2D_Success);
MITK_TEST(SetDataTypeUChar2D_Success);
MITK_TEST(SetDataTypeInt3D_Success);
MITK_TEST(SetDataTypeDouble3D_Success);
MITK_TEST(SetDataTypeFloat4D_Success);
MITK_TEST(SetDataTypeUChar4D_Success);
MITK_TEST(SetDataTypeUInt3D_Success);
MITK_TEST(SetPixelTypeFloat2D_Success);
MITK_TEST(SetPixelTypeUChar2D_Success);
MITK_TEST(SetPixelTypeInt3D_Success);
MITK_TEST(SetPixelTypeDouble3D_Success);
MITK_TEST(SetPixelTypeFloat4D_Success);
MITK_TEST(SetPixelTypeUChar4D_Success);
MITK_TEST(SetPixelTypeUInt3D_Success);
MITK_TEST(MaxValueHolds_Success);
MITK_TEST(MinValueHolds_Success);
MITK_TEST(DefaultMaxValueHolds_Success);
MITK_TEST(DefaultMinValueHolds_Success);
MITK_TEST(SetGradientImageValues_Success);
CPPUNIT_TEST_SUITE_END();
private:
// create some images with arbitrary parameters (corner cases)
mitk::Image::Pointer m_Image2Da;
mitk::Image::Pointer m_Image2Db;
mitk::Image::Pointer m_Image3Da;
mitk::Image::Pointer m_Image3Db;
mitk::Image::Pointer m_Image4Da;
mitk::Image::Pointer m_Image4Db;
mitk::Image::Pointer m_Image3Dc;
public:
void setUp()
{
- m_Image2Da = mitk::ImageGenerator::GenerateRandomImage<float>(120, 205, 0, 0, 0.1, 0.2, 0.3, 577, 23);
+ m_Image2Da = mitk::ImageGenerator::GenerateRandomImage<float>(2, 4, 0, 0, 0.1, 0.2, 0.3, 577, 23);
m_Image2Db = mitk::ImageGenerator::GenerateRandomImage<unsigned char>(1, 1, 0, 0);
- m_Image3Da = mitk::ImageGenerator::GenerateRandomImage<int>(512, 205, 1, 0);
- m_Image3Db = mitk::ImageGenerator::GenerateRandomImage<double>(512, 532, 112, 0);
- m_Image4Da = mitk::ImageGenerator::GenerateRandomImage<float>(120, 205, 78, 1);
- m_Image4Db = mitk::ImageGenerator::GenerateRandomImage<unsigned char>(550, 33, 78, 150);
+ m_Image3Da = mitk::ImageGenerator::GenerateRandomImage<int>(2, 4, 1, 0);
+ m_Image3Db = mitk::ImageGenerator::GenerateRandomImage<double>(2, 4, 8, 0);
+ m_Image4Da = mitk::ImageGenerator::GenerateRandomImage<float>(2, 4, 8, 1);
+ m_Image4Db = mitk::ImageGenerator::GenerateRandomImage<unsigned char>(2, 4, 8, 2);
m_Image3Dc = mitk::ImageGenerator::GenerateGradientImage<unsigned int>(1, 2, 3, 4, 5, 6);
}
void tearDown()
{
m_Image2Da = nullptr;
m_Image2Db = nullptr;
m_Image3Da = nullptr;
m_Image3Db = nullptr;
m_Image4Da = nullptr;
m_Image4Db = nullptr;
m_Image3Dc = nullptr;
}
void SetSpacingX2D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if spacing 2D x is set correctly.",
fabs(m_Image2Da->GetGeometry()->GetSpacing()[0] - 0.1) < 0.0001);
}
void SetDefaultSpacingX2D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if default spacing 2D x is set correctly.",
fabs(m_Image2Db->GetGeometry()->GetSpacing()[0] - 1.0) < 0.0001);
}
void SetSpacingX3D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if spacing 3D x is set correctly.",
fabs(m_Image3Dc->GetGeometry()->GetSpacing()[0] - 4) < 0.0001);
}
void SetSpacingY2D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if spacing 2D y is set correctly.",
fabs(m_Image2Da->GetGeometry()->GetSpacing()[1] - 0.2) < 0.0001);
}
void SetDefaultSpacingY2D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if default spacing 2D y is set correctly.",
fabs(m_Image2Db->GetGeometry()->GetSpacing()[1] - 1.0) < 0.0001);
}
void SetSpacingY3D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if spacing 3D y is set correctly.",
fabs(m_Image3Dc->GetGeometry()->GetSpacing()[1] - 5) < 0.0001);
}
void SetSpacingZ2D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if spacing 2D z is set correctly.",
fabs(m_Image2Da->GetGeometry()->GetSpacing()[2] - 0.3) < 0.0001);
}
void SetDefaultSpacingZ2D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if default spacing 2D z is set correctly.",
fabs(m_Image2Db->GetGeometry()->GetSpacing()[2] - 1.0) < 0.0001);
}
void SetSpacingZ3D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if spacing z is set correctly.",
fabs(m_Image3Dc->GetGeometry()->GetSpacing()[2] - 6) < 0.0001);
}
void SetDimension2D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if the dimension 2D is set correctly.", m_Image2Da->GetDimension() == 2);
CPPUNIT_ASSERT_MESSAGE("Testing if the dimension 2D is set correctly.", m_Image2Db->GetDimension() == 2);
}
void SetDimension3D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if the dimension 3D is set correctly.",m_Image3Da->GetDimension() == 2);
CPPUNIT_ASSERT_MESSAGE("Testing if the dimension 3D is set correctly.", m_Image3Db->GetDimension() == 3);
}
void SetDimension4D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if the dimension 4D is set correctly.", m_Image4Da->GetDimension() == 3);
CPPUNIT_ASSERT_MESSAGE("Testing if the dimension 4D is set correctly.", m_Image4Db->GetDimension() == 4);
}
void SetDimensionX2D_Success()
{
- CPPUNIT_ASSERT_MESSAGE("Testing if the X dimension of the 2D image is set correctly.", m_Image2Da->GetDimension(0) == 120);
+ CPPUNIT_ASSERT_MESSAGE("Testing if the X dimension of the 2D image is set correctly.", m_Image2Da->GetDimension(0) == 2);
}
void SetDimensionY2D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if the Y dimension of the 2D image is set correctly.", m_Image2Db->GetDimension(1) == 1);
}
void SetDimensionZ3D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if the Z dimension of the 3D image is set correctly.", m_Image3Da->GetDimension(2) == 1);
- CPPUNIT_ASSERT_MESSAGE("Testing if the Z dimension of the 3D image is set correctly.", m_Image3Db->GetDimension(2) == 112);
+ CPPUNIT_ASSERT_MESSAGE("Testing if the Z dimension of the 3D image is set correctly.", m_Image3Db->GetDimension(2) == 8);
}
void SetDimensionT4D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if the T dimension of the 4D image is set correctly.", m_Image4Da->GetDimension(3) == 1);
- CPPUNIT_ASSERT_MESSAGE("Testing if the T dimension of the 4D image is set correctly.", m_Image4Db->GetDimension(3) == 150);
+ CPPUNIT_ASSERT_MESSAGE("Testing if the T dimension of the 4D image is set correctly.", m_Image4Db->GetDimension(3) == 2);
}
void SetDimensions3Dc_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if image3Dc dimension x is set correctly.", m_Image3Dc->GetDimension(0) == 1);
CPPUNIT_ASSERT_MESSAGE("Testing if image3Dc dimension y is set correctly.", m_Image3Dc->GetDimension(1) == 2);
CPPUNIT_ASSERT_MESSAGE("Testing if image3Dc dimension z is set correctly.", m_Image3Dc->GetDimension(2) == 3);
}
void SetDataTypeFloat2D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if the data type for a float 3D image is set correctly.",
m_Image2Da->GetPixelType().GetComponentType() == itk::ImageIOBase::FLOAT);
}
void SetDataTypeUChar2D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if the data type for a UChar 2D image is set correctly.",
m_Image2Db->GetPixelType().GetComponentType() == itk::ImageIOBase::UCHAR);
}
void SetDataTypeInt3D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if the data type for a Int 3D image is set correctly.",
m_Image3Da->GetPixelType().GetComponentType() == itk::ImageIOBase::INT);
}
void SetDataTypeDouble3D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if the data type for a Double 3D image is set correctly.",
m_Image3Db->GetPixelType().GetComponentType() == itk::ImageIOBase::DOUBLE);
}
void SetDataTypeFloat4D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if the data type for a Float 4D image is set correctly.",
m_Image4Da->GetPixelType().GetComponentType() == itk::ImageIOBase::FLOAT);
}
void SetDataTypeUChar4D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if the data type for a UChar 4D image is set correctly.",
m_Image4Db->GetPixelType().GetComponentType() == itk::ImageIOBase::UCHAR);
}
void SetDataTypeUInt3D_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if the data type for a UInt 3D image is set correctly.",
m_Image3Dc->GetPixelType().GetComponentType() == itk::ImageIOBase::UINT);
}
void SetPixelTypeFloat2D_Success()
{
itk::ImageIOBase::IOPixelType scalarType = itk::ImageIOBase::SCALAR;
CPPUNIT_ASSERT_MESSAGE("Testing if the pixel type for a Float 2D image is set correctly.",
m_Image2Da->GetPixelType().GetPixelType() == scalarType);
}
void SetPixelTypeUChar2D_Success()
{
itk::ImageIOBase::IOPixelType scalarType = itk::ImageIOBase::SCALAR;
CPPUNIT_ASSERT_MESSAGE("Testing if the pixel type for a UChar 2D image is set correctly.",
m_Image2Db->GetPixelType().GetPixelType() == scalarType);
}
void SetPixelTypeInt3D_Success()
{
itk::ImageIOBase::IOPixelType scalarType = itk::ImageIOBase::SCALAR;
CPPUNIT_ASSERT_MESSAGE("Testing if the pixel type for a Int 3D image is set correctly.",
m_Image3Da->GetPixelType().GetPixelType() == scalarType);
}
void SetPixelTypeDouble3D_Success()
{
itk::ImageIOBase::IOPixelType scalarType = itk::ImageIOBase::SCALAR;
CPPUNIT_ASSERT_MESSAGE("Testing if the pixel type for a Double 3D image is set correctly.",
m_Image3Db->GetPixelType().GetPixelType() == scalarType);
}
void SetPixelTypeFloat4D_Success()
{
itk::ImageIOBase::IOPixelType scalarType = itk::ImageIOBase::SCALAR;
CPPUNIT_ASSERT_MESSAGE("Testing if the pixel type for a Float 4D image is set correctly.",
m_Image4Da->GetPixelType().GetPixelType() == scalarType);
}
void SetPixelTypeUChar4D_Success()
{
itk::ImageIOBase::IOPixelType scalarType = itk::ImageIOBase::SCALAR;
CPPUNIT_ASSERT_MESSAGE("Testing if the pixel type for a UChar 4D image is set correctly.",
m_Image4Db->GetPixelType().GetPixelType() == scalarType);
}
void SetPixelTypeUInt3D_Success()
{
itk::ImageIOBase::IOPixelType scalarType = itk::ImageIOBase::SCALAR;
CPPUNIT_ASSERT_MESSAGE("Testing if the pixel type for a UInt 3D image is set correctly.",
m_Image3Dc->GetPixelType().GetPixelType() == scalarType);
}
void MaxValueHolds_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if max value holds", m_Image2Da->GetStatistics()->GetScalarValueMax() <= 577);
}
void MinValueHolds_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if min value holds", m_Image2Da->GetStatistics()->GetScalarValueMin() >= 23);
}
void DefaultMaxValueHolds_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if default max value holds", m_Image3Da->GetStatistics()->GetScalarValueMax() <= 1000);
}
void DefaultMinValueHolds_Success()
{
CPPUNIT_ASSERT_MESSAGE("Testing if default min value holds", m_Image3Da->GetStatistics()->GetScalarValueMin() >= 0);
}
void SetGradientImageValues_Success()
{
const unsigned int *image3DcBuffer = nullptr;
try
{
mitk::ImageReadAccessor readAccess(m_Image3Dc);
image3DcBuffer = static_cast<const unsigned int *>(readAccess.GetData());
}
catch (...)
{
MITK_ERROR << "Read access not granted on mitk::Image.";
}
for (unsigned int i = 0; i < 2 * 3; i++)
{
CPPUNIT_ASSERT_MESSAGE("Testing if gradient image values are set correctly", image3DcBuffer[i] == i);
}
}
};
MITK_TEST_SUITE_REGISTRATION(mitkImageGenerator)
diff --git a/Modules/Core/test/mitkImageVtkMapper2DColorTest.cpp b/Modules/Core/test/mitkImageVtkMapper2DColorTest.cpp
index e45b0afdcb..dc33b72adf 100644
--- a/Modules/Core/test/mitkImageVtkMapper2DColorTest.cpp
+++ b/Modules/Core/test/mitkImageVtkMapper2DColorTest.cpp
@@ -1,57 +1,57 @@
/*============================================================================
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.
============================================================================*/
// MITK
#include "mitkRenderingTestHelper.h"
#include "mitkTestingMacros.h"
// VTK
#include <vtkRegressionTestImage.h>
int mitkImageVtkMapper2DColorTest(int argc, char *argv[])
{
try
{
mitk::RenderingTestHelper openGlTest(640, 480);
}
catch (const mitk::TestNotRunException &e)
{
MITK_WARN << "Test not run: " << e.GetDescription();
return 77;
}
// load all arguments into a datastorage, take last argument as reference rendering
// setup a renderwindow of fixed size X*Y
// render the datastorage
// compare rendering to reference image
MITK_TEST_BEGIN("mitkImageVtkMapper2DTest")
mitk::RenderingTestHelper renderingHelper(640, 480, argc, argv);
// Set the opacity for all images
- renderingHelper.SetImageProperty("color", mitk::ColorProperty::New(0.0f, 0.0f, 255.0f));
+ renderingHelper.SetImageProperty("color", mitk::ColorProperty::New(0.0f, 0.0f, 1.0f));
// for now this test renders in sagittal view direction
renderingHelper.SetViewDirection(mitk::SliceNavigationController::Sagittal);
//### Usage of CompareRenderWindowAgainstReference: See docu of mitkRrenderingTestHelper
MITK_TEST_CONDITION(renderingHelper.CompareRenderWindowAgainstReference(argc, argv) == true,
"CompareRenderWindowAgainstReference test result positive?");
//####################
// Use this to generate a reference screenshot or save the file.
//(Only in your local version of the test!)
if (false)
{
renderingHelper.SaveReferenceScreenShot("/home/kilgus/Pictures/RenderingTestData/output.png");
}
//####################
MITK_TEST_END();
}
diff --git a/Modules/Core/test/mitkRotatedSlice4DTest.cpp b/Modules/Core/test/mitkRotatedSlice4DTest.cpp
index 0fdd8f5caa..474bf3f5dd 100644
--- a/Modules/Core/test/mitkRotatedSlice4DTest.cpp
+++ b/Modules/Core/test/mitkRotatedSlice4DTest.cpp
@@ -1,83 +1,84 @@
/*============================================================================
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 "mitkExtractSliceFilter.h"
#include "mitkIOUtil.h"
#include "mitkImagePixelReadAccessor.h"
#include "mitkImageTimeSelector.h"
#include "mitkInteractionConst.h"
#include "mitkRotationOperation.h"
#include "mitkTestingMacros.h"
#include <ctime>
/*
* The mitkRotatedSlice4DTest loads a 4D image and extracts a specifically rotated slice in each time step's volume.
*/
int mitkRotatedSlice4DTest(int, char *argv[])
{
MITK_TEST_BEGIN("mitkRotatedSlice4DTest");
std::string filename = argv[1];
// load 4D image
mitk::Image::Pointer image4D = mitk::IOUtil::Load<mitk::Image>(filename);
// check inputs
if (image4D.IsNull())
{
MITK_INFO << "Could not load the file";
return false;
}
- // for each time step...
- for (unsigned int ts = 0; ts < image4D->GetTimeSteps(); ts++)
+ auto numTimeSteps = std::min(2, static_cast<int>(image4D->GetTimeSteps()));
+
+ for (int ts = 0; ts < numTimeSteps; ++ts)
{
mitk::ImageTimeSelector::Pointer timeSelector = mitk::ImageTimeSelector::New();
timeSelector->SetInput(image4D);
timeSelector->SetTimeNr(ts);
timeSelector->Update();
mitk::Image::Pointer image3D = timeSelector->GetOutput();
- int sliceNumber = 5;
+ int sliceNumber = std::min(5, static_cast<int>(image3D->GetSlicedGeometry()->GetSlices()));
mitk::PlaneGeometry::Pointer plane = mitk::PlaneGeometry::New();
plane->InitializeStandardPlane(image3D->GetGeometry(), mitk::PlaneGeometry::Frontal, sliceNumber, true, false);
// rotate about an arbitrary point and axis...
float angle = 30;
mitk::Point3D point;
point.Fill(sliceNumber);
mitk::Vector3D rotationAxis;
rotationAxis[0] = 1;
rotationAxis[1] = 2;
rotationAxis[2] = 3;
rotationAxis.Normalize();
// Create Rotation Operation
auto *op = new mitk::RotationOperation(mitk::OpROTATE, point, rotationAxis, angle);
plane->ExecuteOperation(op);
delete op;
// Now extract
mitk::ExtractSliceFilter::Pointer extractor = mitk::ExtractSliceFilter::New();
extractor->SetInput(image3D);
extractor->SetWorldGeometry(plane);
extractor->Update();
mitk::Image::Pointer extractedPlane;
extractedPlane = extractor->GetOutput();
std::stringstream ss;
ss << " : Valid slice in timestep " << ts;
MITK_TEST_CONDITION_REQUIRED(extractedPlane.IsNotNull(), ss.str().c_str());
}
MITK_TEST_END();
}
diff --git a/Modules/CppMicroServices/core/doc/doxygen/MicroServices_ServiceHooks.md b/Modules/CppMicroServices/core/doc/doxygen/MicroServices_ServiceHooks.md
index 959d235c3d..3c29df35a0 100644
--- a/Modules/CppMicroServices/core/doc/doxygen/MicroServices_ServiceHooks.md
+++ b/Modules/CppMicroServices/core/doc/doxygen/MicroServices_ServiceHooks.md
@@ -1,92 +1,92 @@
Service Hooks {#MicroServices_ServiceHooks}
=============
The CppMicroServices library implements the Service Hook Service Specification Version 1.1 from
OSGi Core Release 5 for C++. Below is a summary of the concept - consult the OSGi specifications
for more details.
Service hooks provide mechanisms for module writers to closely interact with the CppMicroServices
service registry. These mechanisms are not intended for use by application modules but rather
by modules in need of *hooking* into the service registry and modifying the behaviour of
application modules.
Specific use case for service hooks include proxying of existing services by hiding the original
service and registering a *proxy service* with the same properties or providing services
*on demand* based on registered service listeners from external modules.
## Event Listener Hook
A module can intercept events being delivered to other modules by registering a ServiceEventListenerHook
object as a service. The CppMicroServices library will send all service events to all the registered
hooks using the reversed ordering of their ServiceReference objects. Note that event listener hooks
are called *after* the event was created but *before* it is filtered by the optional filter expression
-of the service listeners. Hence an event listener hook receives all \link ServiceEvent::REGISTERED
-REGISTERED\endlink, \link ServiceEvent::MODIFIED MODIFIED\endlink, \link ServiceEvent::UNREGISTERING
-UNREGISTERING\endlink, and \link ServiceEvent::MODIFIED_ENDMATCH MODIFIED_ENDMATCH\endlink events
+of the service listeners. Hence an event listener hook receives all \link us::ServiceEvent::REGISTERED
+REGISTERED \endlink, \link us::ServiceEvent::MODIFIED MODIFIED \endlink, \link us::ServiceEvent::UNREGISTERING
+UNREGISTERING \endlink, and \link us::ServiceEvent::MODIFIED_ENDMATCH MODIFIED_ENDMATCH \endlink events
regardelss of the presence of a service listener filter. It may then remove modules or specific
service listeners from the ServiceEventListenerHook::ShrinkableMapType object passed to the
ServiceEventListenerHook::Event method to hide
service events.
Implementers of the Event Listener Hook must ensure that modules continue to see a consistent set of
service events.
## Find Hook
Find Hook objects registered using the ServiceFindHook interface will be called when modules look up
service references via the ModuleContext::GetServiceReference or ModuleContext::GetServiceReferences
methods. The order in which the CppMicroServices library calls the find hooks is the reverse `operator<`
ordering of their ServiceReference objects. The hooks may remove service references from the
ShrinkableVector object passed to the ServiceFindHook::Find method to hide services from specific modules.
## Listener Hook
The CppMicroServices API provides information about the registration, unregistration, and modification
of services. However, it does not directly allow the introspection of modules to get information about
what services a module is waiting for. Waiting for a service to arrive (via a registered service listener)
before performing its function is a common pattern for modules. Listener Hooks provide a mechanism to
get informed about all existing, newly registerd, and removed service listeners.
A Listener Hook object registered using the ServiceListenerHook interface will be notified about service
listeners by being passed ServiceListenerHook::ListenerInfo objects. Each ListenerInfo object is related to
the registration / unregistration cycle of a specific service listener. That is, registering the same service
listener again, even with a different filter, will automatically unregister the previouse registration and
the newly registered service listener is related to a different ListenerInfo object. ListenerInfo objects
can be stored in unordered containers and compared with each other, e.g. to match ServiceListenerHook::Added
and ServiceListenerHook::Removed calls.
The Listener Hooks are called synchronously in the same order of their registration. However, in rare cases
the removal of a service listener may be reported before its corresponding addition. To handle this case,
the ListenerInfo::IsRemoved() method is provided which can be used in the ServiceListenerHook::Added
method to detect the out of order delivery. A simple strategy is to ignore removed events without
corresponding added events and ignore added events where the ListenerInfo object is already removed:
\snippet uServices-servicelistenerhook/main.cpp 1
## Architectural Notes
### Ordinary Services
All service hooks are treated as ordinary services. If the CppMicroServices library uses them, their
Service References will show that the CppMicroServices modules is using them, and if a hook is a
Service Factory, then the actual instance will be properly created.
The only speciality of the service hooks is that the CppMicroServices library does not use them for
the hooks themselves. That is, the Service Event and Service Find Hooks can not be used to hide the
services from the CppMicroServices library.
### Ordering
The hooks are very sensitive to ordering because they interact directly with the service registry.
In general, implementers of the hooks must be aware that other modules can be loaded before or after
the module which provides the hooks. To ensure early registration of the hooks, they should be registered
within the ModuleActivator::Load method of the program executable or a module being auto-loaded with
the executable.
### Multi Threading
All hooks must be thread-safe because the hooks can be called at any time. All hook methods must be
re-entrant, they can be entered at any time and in rare cases in the wrong order. The CppMicroServices
library calls all hook methods synchronously but the calls might be triggered from any user thread
interacting with the CppMicroServices API. The CppMicroServices API can be called from any of the
hook methods but implementers must be careful to not hold any lock while calling CppMicroServices methods.
diff --git a/Modules/CppMicroServices/core/doc/doxygen/examples/MicroServices_Example1.md b/Modules/CppMicroServices/core/doc/doxygen/examples/MicroServices_Example1.md
index 6e1abbf0ff..8b684bd413 100644
--- a/Modules/CppMicroServices/core/doc/doxygen/examples/MicroServices_Example1.md
+++ b/Modules/CppMicroServices/core/doc/doxygen/examples/MicroServices_Example1.md
@@ -1,97 +1,97 @@
Example 1 - Service Event Listener {#MicroServices_Example1}
==================================
This example creates a simple module that listens for service events.
This example does not do much at first, because it only prints out the details
of registering and unregistering services. In the next example we will create
a module that implements a service, which will cause this module to actually
do something. For now, we will just use this example to help us understand the
basics of creating a module and its activator.
A module gains access to the C++ Micro Services API using a unique instance
of ModuleContext. This unique module context can be used during static
initialization of the module or at any later point during the life-time of the
module. To execute code during static initialization (and de-initialization)
time, the module must provide an implementation of the ModuleActivator interface;
this interface has two methods, Load() and Unload(), that both receive the
module's context and are called when the module is loaded (statically initialized)
and unloaded, respectively.
\note You do not need to remember the ModuleContext instance within the
ModuleActivator::Load() method and provide custom access methods for later
retrieval. Use the GetModuleContext() function to easily retrieve the current
module's context.
In the following source code, our module implements
the ModuleActivator interface and uses the context to add itself as a listener
for service events (in the `eventlistener/Activator.cpp` file):
\snippet eventlistener/Activator.cpp Activator
After implementing the C++ source code for the module activator, we must *export*
the activator such that the C++ Micro Services library can create an instance
of it and call the `Load()` and `Unload()` methods:
\dontinclude eventlistener/Activator.cpp
\skipline US_EXPORT
Now we need to compile the source code. This example uses CMake as the build
system and the top-level CMakeLists.txt file could look like this:
-\dontinclude examples/CMakeLists.txt
+\dontinclude core/examples/CMakeLists.txt
\skip project
\until eventlistener
and the CMakeLists.txt file in the eventlistener subdirectory is:
\include eventlistener/CMakeLists.txt
The call to `#usFunctionGenerateModuleInit` is necessary to integrate the shared
library as a module within the C++ Micro Service library. If you are not using
CMake, you have to place a macro call to `#US_INITIALIZE_MODULE` yourself into the
module's source code, e.g. in `Activator.cpp`. Have a look at the
-\ref MicroServices_GettingStarted documentation for more details about using CMake
+Getting Started documentation for more details about using CMake
or other build systems (e.g. Makefiles) when writing modules.
To run the examples contained in the C++ Micro Services library, we use a small
driver program called `usCoreExamplesDriver`:
\verbatim
CppMicroServices-build> bin/usCoreExamplesDriver
> h
h This help text
l <id | name> Load the module with id <id> or name <name>
u <id> Unload the module with id <id>
s Print status information
q Quit
>
\endverbatim
Typing `s` at the command prompt lists the available, loaded, and unloaded modules.
To load the eventlistener module, type `l eventlistener` at the command prompt:
\verbatim
> s
Id | Name | Status
-----------------------------------
- | dictionaryclient | -
- | dictionaryclient2 | -
- | dictionaryclient3 | -
- | dictionaryservice | -
- | eventlistener | -
- | frenchdictionary | -
- | spellcheckclient | -
- | spellcheckservice | -
1 | CppMicroServices | LOADED
> l eventlistener
Starting to listen for service events.
>
\endverbatim
The above command loaded the eventlistener module (by loading its shared library).
Keep in mind, that this module will not do much at this point since it only
listens for service events and we are not registering any services. In the next
example we will register a service that will generate an event for this module to
receive. To exit the `usCoreExamplesDriver`, use the `q` command.
Next: \ref MicroServices_Example2
diff --git a/Modules/DICOM/doc/images/tilt-correction.jpg b/Modules/DICOM/doc/images/tilt-correction.jpg
deleted file mode 100644
index 46712f6c86..0000000000
Binary files a/Modules/DICOM/doc/images/tilt-correction.jpg and /dev/null differ
diff --git a/Modules/DICOM/include/mitkDICOMITKSeriesGDCMReader.h b/Modules/DICOM/include/mitkDICOMITKSeriesGDCMReader.h
index 3e6c790bc4..743bb72645 100644
--- a/Modules/DICOM/include/mitkDICOMITKSeriesGDCMReader.h
+++ b/Modules/DICOM/include/mitkDICOMITKSeriesGDCMReader.h
@@ -1,377 +1,377 @@
/*============================================================================
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 mitkDICOMITKSeriesGDCMReader_h
#define mitkDICOMITKSeriesGDCMReader_h
#include <stack>
#include "itkMutexLock.h"
#include "mitkDICOMFileReader.h"
#include "mitkDICOMDatasetSorter.h"
#include "mitkDICOMGDCMImageFrameInfo.h"
#include "mitkEquiDistantBlocksSorter.h"
#include "mitkNormalDirectionConsistencySorter.h"
#include "MitkDICOMExports.h"
namespace itk
{
class TimeProbesCollectorBase;
}
namespace mitk
{
/**
\ingroup DICOMModule
\brief Flexible reader based on itk::ImageSeriesReader and GDCM, for single-slice modalities like CT, MR, PET, CR, etc.
Implements the loading processed as structured by DICOMFileReader offers configuration
of its loading strategy.
Documentation sections:
- \ref DICOMITKSeriesGDCMReader_LoadingStrategy
- \ref DICOMITKSeriesGDCMReader_ForcedConfiguration
- \ref DICOMITKSeriesGDCMReader_UserConfiguration
- \ref DICOMITKSeriesGDCMReader_GantryTilt
- \ref DICOMITKSeriesGDCMReader_Testing
- \ref DICOMITKSeriesGDCMReader_Internals
- \ref DICOMITKSeriesGDCMReader_RelatedClasses
- \ref DICOMITKSeriesGDCMReader_TiltInternals
- \ref DICOMITKSeriesGDCMReader_Condensing
\section DICOMITKSeriesGDCMReader_LoadingStrategy Loading strategy
The set of input files is processed by a number of DICOMDatasetSorter objects which may do two sort of things:
1. split a list of input frames into multiple lists, based on DICOM tags such as "Rows", "Columns", which cannot be mixed within a single mitk::Image
2. sort the frames within the input lists, based on the values of DICOM tags such as "Image Position Patient"
When the DICOMITKSeriesGDCMReader is configured with DICOMDatasetSorter%s, the list of input files is processed
as follows:
1. build an initial set of output groups, simply by grouping all input files.
2. for each configured DICOMDatasetSorter, process:
- for each output group:
1. set this group's files as input to the sorter
2. let the sorter sort (and split)
3. integrate the sorter's output groups with our own output groups
\section DICOMITKSeriesGDCMReader_ForcedConfiguration Forced Configuration
In all cases, the reader will add two DICOMDatasetSorter objects that are required to load
mitk::Images properly via itk::ImageSeriesReader:
1. As a \b first step, the input files will be split into groups that are not compatible because they differ in essential aspects:
- (0028,0010) Number of Rows
- (0028,0011) Number of Columns
- (0028,0030) Pixel Spacing
- (0018,1164) Imager Pixel Spacing
- (0020,0037) %Image Orientation (Patient)
- (0018,0050) Slice Thickness
- (0028,0008) Number of Frames
- 2. As are two forced \b last steps:
- 1. There will always be an instance of EquiDistantBlocksSorter,
- which ensures that there is an equal distance between all the frames of an Image.
- This is required to achieve correct geometrical positions in the mitk::Image,
- i.e. it is essential to be able to make measurements in images.
- - whether or not the distance is required to be orthogonal to the image planes is configured by SetFixTiltByShearing().
- - during this check, we need to tolerate some minor errors in documented vs. calculated image origins.
- The amount of tolerance can be adjusted by SetToleratedOriginOffset() and SetToleratedOriginOffsetToAdaptive().
- Please see EquiDistantBlocksSorter for more details. The default should be good for most cases.
- 2. There is always an instance of NormalDirectionConsistencySorter,
- which makes the order of images go along the image normals (see NormalDirectionConsistencySorter)
+ 2. As are two forced \b last steps:
+ 1. There will always be an instance of EquiDistantBlocksSorter,
+ which ensures that there is an equal distance between all the frames of an Image.
+ This is required to achieve correct geometrical positions in the mitk::Image,
+ i.e. it is essential to be able to make measurements in images.
+ - whether or not the distance is required to be orthogonal to the image planes is configured by SetFixTiltByShearing().
+ - during this check, we need to tolerate some minor errors in documented vs. calculated image origins.
+ The amount of tolerance can be adjusted by SetToleratedOriginOffset() and SetToleratedOriginOffsetToAdaptive().
+ Please see EquiDistantBlocksSorter for more details. The default should be good for most cases.
+ 2. There is always an instance of NormalDirectionConsistencySorter,
+ which makes the order of images go along the image normals (see NormalDirectionConsistencySorter)
\section DICOMITKSeriesGDCMReader_UserConfiguration User Configuration
The user of this class can add more sorting steps (similar to the one described in above section) by calling AddSortingElement().
Usually, an application will add sorting by "Image Position Patient", by "Instance Number", and by other relevant tags here.
\section DICOMITKSeriesGDCMReader_GantryTilt Gantry tilt handling
When CT gantry tilt is used, the gantry plane (= X-Ray source and detector ring) and the vertical plane do not align
anymore. This scanner feature is used for example to reduce metal artifacs (e.g. <i>Lee C , Evaluation of Using CT
Gantry Tilt Scan on Head and Neck Cancer Patients with Dental Structure: Scans Show Less Metal Artifacts. Presented
at: Radiological Society of North America 2011 Scientific Assembly and Annual Meeting; November 27- December 2,
2011 Chicago IL.</i>).
The acquired planes of such CT series do not match the expectations of a orthogonal geometry in mitk::Image: if you
stack the slices, they show a small shift along the Y axis:
\verbatim
without tilt with tilt
|||||| //////
|||||| //////
-- |||||| --------- ////// -------- table orientation
|||||| //////
|||||| //////
Stacked slices:
without tilt with tilt
-------------- --------------
-------------- --------------
-------------- --------------
-------------- --------------
-------------- --------------
\endverbatim
As such gemetries do not "work" in conjunction with mitk::Image, DICOMITKSeriesGDCMReader is able to perform a correction for such series.
Whether or not such correction should be attempted is controlled by SetFixTiltByShearing(), the default being correction.
For details, see "Internals" below.
\section DICOMITKSeriesGDCMReader_Testing Testing
A number of tests is implemented in module DICOMTesting, which is documented at \ref DICOMTesting.
\section DICOMITKSeriesGDCMReader_Internals Class internals
Internally, the class is based on GDCM and it depends heavily on the gdcm::Scanner class.
Since the sorting elements (see DICOMDatasetSorter and DICOMSortCriterion) can access tags only via the DICOMDatasetAccess interface,
BUT DICOMITKSeriesGDCMReader holds a list of more specific classes DICOMGDCMImageFrameInfo, we must convert between the two
types sometimes. This explains the methods ToDICOMDatasetList(), FromDICOMDatasetList().
The intermediate result of all the sorting efforts is held in m_SortingResultInProgress,
which is modified through InternalExecuteSortingStep().
\subsection DICOMITKSeriesGDCMReader_RelatedClasses Overview of related classes
The following diagram gives an overview of the related classes:
\image html implementeditkseriesgdcmreader.jpg
\subsection DICOMITKSeriesGDCMReader_TiltInternals Details about the tilt correction
The gantry tilt "correction" algorithm fixes two errors introduced by ITK's ImageSeriesReader:
- the plane shift that is ignored by ITK's reader is recreated by applying a shearing transformation using itk::ResampleFilter.
- the spacing is corrected (it is calculated by ITK's reader from the distance between two origins, which is NOT the slice distance in this special case)
Both errors are introduced in
itkImageSeriesReader.txx (ImageSeriesReader<TOutputImage>::GenerateOutputInformation(void)), lines 176 to 245 (as of ITK 3.20)
For the correction, we examine two consecutive slices of a series, both described as a pair (origin/orientation):
- we calculate if the first origin is on a line along the normal of the second slice
- - if this is not the case, the geometry will not fit a normal mitk::Image/mitk::Geometry3D
+ - if this is not the case, the geometry will not fit a normal mitk::Image/mitk::%Geometry3D
- we then project the second origin into the first slice's coordinate system to quantify the shift
- both is done in class GantryTiltInformation with quite some comments.
The geometry of image stacks with tilted geometries is illustrated below:
- green: the DICOM images as described by their tags: origin as a point with the line indicating the orientation
- red: the output of ITK ImageSeriesReader: wrong, larger spacing, no tilt
- blue: how much a shear must correct
- \image html tilt-correction.jpg
+ \image html Modules/DICOM/doc/Doxygen/tilt-correction.jpg
\subsection DICOMITKSeriesGDCMReader_Condensing Sub-classes can condense multiple blocks into a single larger block
The sorting/splitting process described above is helpful for at least two more DICOM readers, which either try to load 3D+t images or which load diffusion data.
In both cases, a single pixel of the mitk::Image is made up of multiple values, in one case values over time, in the other case multiple measurements of a single point.
The specialized readers for these cases (e.g. ThreeDnTDICOMSeriesReader) can reuse most of the methods in DICOMITKSeriesGDCMReader,
except that they need an extra step after the usual sorting, in which they can merge already grouped 3D blocks. What blocks are merged
depends on the specialized reader's understanding of these images. To allow for such merging, a method Condense3DBlocks() is called
as an absolute last step of AnalyzeInputFiles(). Given this, a sub-class could implement only LoadImages() and Condense3DBlocks() instead
repeating most of AnalyzeInputFiles().
*/
class MITKDICOM_EXPORT DICOMITKSeriesGDCMReader : public DICOMFileReader
{
public:
mitkClassMacro( DICOMITKSeriesGDCMReader, DICOMFileReader );
mitkCloneMacro( DICOMITKSeriesGDCMReader );
itkFactorylessNewMacro( DICOMITKSeriesGDCMReader );
mitkNewMacro1Param( DICOMITKSeriesGDCMReader, unsigned int );
mitkNewMacro2Param( DICOMITKSeriesGDCMReader, unsigned int, bool );
/**
\brief Runs the sorting / splitting process described in \ref DICOMITKSeriesGDCMReader_LoadingStrategy.
Method required by DICOMFileReader.
*/
void AnalyzeInputFiles() override;
// void AllocateOutputImages();
/**
\brief Loads images using itk::ImageSeriesReader, potentially applies shearing to correct gantry tilt.
*/
bool LoadImages() override;
// re-implemented from super-class
bool CanHandleFile(const std::string& filename) override;
/**
\brief Add an element to the sorting procedure described in \ref DICOMITKSeriesGDCMReader_LoadingStrategy.
*/
virtual void AddSortingElement(DICOMDatasetSorter* sorter, bool atFront = false);
typedef const std::list<DICOMDatasetSorter::ConstPointer> ConstSorterList;
ConstSorterList GetFreelyConfiguredSortingElements() const;
/**
\brief Controls whether to "fix" tilted acquisitions by shearing the output (see \ref DICOMITKSeriesGDCMReader_GantryTilt).
*/
void SetFixTiltByShearing(bool on);
bool GetFixTiltByShearing() const;
/**
\brief Controls whether groups of only two images are accepted when ensuring consecutive slices via EquiDistantBlocksSorter.
*/
void SetAcceptTwoSlicesGroups(bool accept) const;
bool GetAcceptTwoSlicesGroups() const;
/**
\brief See \ref DICOMITKSeriesGDCMReader_ForcedConfiguration.
*/
void SetToleratedOriginOffsetToAdaptive(double fractionOfInterSliceDistanct = 0.3) const;
/**
\brief See \ref DICOMITKSeriesGDCMReader_ForcedConfiguration.
*/
void SetToleratedOriginOffset(double millimeters = 0.005) const;
/**
\brief Ignore all dicom tags that are non-essential for simple 3D volume import.
*/
void SetSimpleVolumeReading(bool read)
{
m_SimpleVolumeReading = read;
};
/**
\brief Ignore all dicom tags that are non-essential for simple 3D volume import.
*/
bool GetSimpleVolumeReading()
{
return m_SimpleVolumeReading;
};
double GetToleratedOriginError() const;
bool IsToleratedOriginOffsetAbsolute() const;
double GetDecimalPlacesForOrientation() const;
bool operator==(const DICOMFileReader& other) const override;
DICOMTagPathList GetTagsOfInterest() const override;
static int GetDefaultDecimalPlacesForOrientation()
{
return m_DefaultDecimalPlacesForOrientation;
}
static bool GetDefaultSimpleVolumeImport()
{
return m_DefaultSimpleVolumeImport;
}
static bool GetDefaultFixTiltByShearing()
{
return m_DefaultFixTiltByShearing;
}
protected:
void InternalPrintConfiguration(std::ostream& os) const override;
/// \brief Return active C locale
static std::string GetActiveLocale();
/**
\brief Remember current locale on stack, activate "C" locale.
"C" locale is required for correct parsing of numbers by itk::ImageSeriesReader
*/
void PushLocale() const;
/**
\brief Activate last remembered locale from locale stack
"C" locale is required for correct parsing of numbers by itk::ImageSeriesReader
*/
void PopLocale() const;
const static int m_DefaultDecimalPlacesForOrientation = 5;
const static bool m_DefaultSimpleVolumeImport = false;
const static bool m_DefaultFixTiltByShearing = true;
DICOMITKSeriesGDCMReader(unsigned int decimalPlacesForOrientation = m_DefaultDecimalPlacesForOrientation, bool simpleVolumeImport = m_DefaultSimpleVolumeImport);
~DICOMITKSeriesGDCMReader() override;
DICOMITKSeriesGDCMReader(const DICOMITKSeriesGDCMReader& other);
DICOMITKSeriesGDCMReader& operator=(const DICOMITKSeriesGDCMReader& other);
typedef std::vector<DICOMDatasetAccessingImageFrameList> SortingBlockList;
/**
\brief "Hook" for sub-classes, see \ref DICOMITKSeriesGDCMReader_Condensing
\return REMAINING blocks
*/
virtual SortingBlockList Condense3DBlocks(SortingBlockList& resultOf3DGrouping);
virtual DICOMTagCache::Pointer GetTagCache() const;
void SetTagCache( const DICOMTagCache::Pointer& ) override;
/// \brief Sorting step as described in \ref DICOMITKSeriesGDCMReader_LoadingStrategy
static SortingBlockList InternalExecuteSortingStep(
unsigned int sortingStepIndex,
const DICOMDatasetSorter::Pointer& sorter,
const SortingBlockList& input);
/// \brief Loads the mitk::Image by means of an itk::ImageSeriesReader
virtual bool LoadMitkImageForOutput(unsigned int o);
virtual bool LoadMitkImageForImageBlockDescriptor(DICOMImageBlockDescriptor& block) const;
/// \brief Describe this reader's confidence for given SOP class UID
static ReaderImplementationLevel GetReaderImplementationLevel(const std::string sopClassUID);
private:
/// \brief Creates the required sorting steps described in \ref DICOMITKSeriesGDCMReader_ForcedConfiguration
void EnsureMandatorySortersArePresent(unsigned int decimalPlacesForOrientation, bool simpleVolumeImport = false);
protected:
// NOT nice, made available to ThreeDnTDICOMSeriesReader due to lack of time
bool m_FixTiltByShearing; // could be removed by ITKDICOMSeriesReader NOT flagging tilt unless requested to fix it!
bool m_SimpleVolumeReading;
private:
SortingBlockList m_SortingResultInProgress;
typedef std::list<DICOMDatasetSorter::Pointer> SorterList;
SorterList m_Sorter;
protected:
// NOT nice, made available to ThreeDnTDICOMSeriesReader and ClassicDICOMSeriesReader due to lack of time
mitk::EquiDistantBlocksSorter::Pointer m_EquiDistantBlocksSorter;
mitk::NormalDirectionConsistencySorter::Pointer m_NormalDirectionConsistencySorter;
private:
static itk::MutexLock::Pointer s_LocaleMutex;
mutable std::stack<std::string> m_ReplacedCLocales;
mutable std::stack<std::locale> m_ReplacedCinLocales;
double m_DecimalPlacesForOrientation;
DICOMTagCache::Pointer m_TagCache;
bool m_ExternalCache;
};
}
#endif
diff --git a/Modules/DICOM/include/mitkDICOMReaderConfigurator.h b/Modules/DICOM/include/mitkDICOMReaderConfigurator.h
index f8e161e3a4..e098ee4b85 100644
--- a/Modules/DICOM/include/mitkDICOMReaderConfigurator.h
+++ b/Modules/DICOM/include/mitkDICOMReaderConfigurator.h
@@ -1,142 +1,142 @@
/*============================================================================
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 mitkDICOMReaderConfigurator_h
#define mitkDICOMReaderConfigurator_h
#include "mitkClassicDICOMSeriesReader.h"
#include "mitkDICOMTagBasedSorter.h"
// to put into private implementation
#include "tinyxml.h"
namespace mitk
{
/**
\ingroup DICOMModule
\brief Too-simple factory to create DICOMFileReader%s.
This class is able to instantiate and configure (where possible) DICOMFileReader%s from XML descriptions.
\note This is a bad factory example, because the factory is not extensible and needs to know all the specific readers. A flexible implementation should be provided in a future version.
In its current version, the XML input is meant to be structured like
\verbatim
<?xml version="1.0" standalone=no>
<DICOMFileReader
label="Example Reader"
description="Sort images by example tags"
class="DICOMITKSeriesGDCMReader"
fixTiltByShearing="true">
<Distinguishing>
<Tag name="SeriesInstanceUID" group="0020" element="000e"/>
<Tag name="SeriesNumber" group="0020" element="0011"/>
</Distinguishing>
<Sorting>
<ImagePositionPatient/>
<Tag name="SOPInstanceUID" group="0x0008" element="0x0018"/>
</Sorting>
</DICOMFileReader>
\endverbatim
- The root-tag \i <DICOMFileReader> names the class to be instantiated, currently this can be one of
+ The root-tag \c \<DICOMFileReader\> names the class to be instantiated, currently this can be one of
- DICOMITKSeriesGDCMReader
- ThreeDnTDICOMSeriesReader
Both classes bring simple configuration flags with them and a description of how images are sorted prior to loading.
Flag for DICOMITKSeriesGDCMReader:
<pre>fixTiltByShearing="true|false"</pre>
Determines whether a potential gantry tilt should be "fixed" by shearing the output image.
Flag for ThreeDnTDICOMSeriesReader:
<pre>group3DnT="true|false"</pre>
Determines whether images at the same spatial position should be interpreted as 3D+t images.
- The tags <Distinguishing> and <Sorting> describe the basic loading strategy of both
- reader mentioned above: first images are divided into incompatible groups (<Distinguishing>),
+ The tags \c \<Distinguishing\> and \c \<Sorting\> describe the basic loading strategy of both
+ reader mentioned above: first images are divided into incompatible groups (\c \<Distinguishing\>),
and afterwards the images within each group are sorted by means of DICOMSortCriterion, which
most commonly mentions a tag.
Tag element and group are interpreted as the exadecimal numbers
found all around the DICOM standard. The numbers can be prepended by a "0x" if this is preferred
by the programmer (but they are taken as hexadecimal in all cases).
\section DICOMReaderConfigurator_AboutTheFuture About the future evolution of this class
This first version is hard coded for the current state of the implementation.
If things should evolve in a way that needs us to splitt off readers for "old" versions,
time should be taken to refactor this class.
Basically, a serializer class should accompany each of the configurable classes. Such
serializer classes should be registered and discovered via micro-services (to support extensions).
A serializer should offer both methods to serialize a class and to desirialize it again.
A "version" attribute at the top-level tag should be used to distinguish versions.
Usually it should be enough to keep DE-serializers for all versions. Writers for the most
recent version should be enough.
*/
class MITKDICOM_EXPORT DICOMReaderConfigurator : public itk::LightObject
{
public:
mitkClassMacroItkParent( DICOMReaderConfigurator, itk::LightObject );
itkNewMacro( DICOMReaderConfigurator );
DICOMFileReader::Pointer CreateFromConfigFile(const std::string& filename) const;
DICOMFileReader::Pointer CreateFromUTF8ConfigString(const std::string& xmlContents) const;
std::string CreateConfigStringFromReader(DICOMFileReader::ConstPointer reader) const;
protected:
DICOMReaderConfigurator();
~DICOMReaderConfigurator() override;
private:
DICOMFileReader::Pointer CreateFromTiXmlDocument(TiXmlDocument& doc) const;
DICOMTag tagFromXMLElement(TiXmlElement*) const;
std::string requiredStringAttribute(TiXmlElement* xmlElement, const std::string& key) const;
unsigned int hexStringToUInt(const std::string& s) const;
ThreeDnTDICOMSeriesReader::Pointer ConfigureThreeDnTDICOMSeriesReader(ThreeDnTDICOMSeriesReader::Pointer reader, TiXmlElement*) const;
DICOMITKSeriesGDCMReader::Pointer ConfigureDICOMITKSeriesGDCMReader(DICOMITKSeriesGDCMReader::Pointer reader, TiXmlElement*) const;
void ConfigureCommonPropertiesOfDICOMITKSeriesGDCMReader(DICOMITKSeriesGDCMReader::Pointer reader, TiXmlElement* element) const;
void ConfigureCommonPropertiesOfThreeDnTDICOMSeriesReader(ThreeDnTDICOMSeriesReader::Pointer reader, TiXmlElement* element) const;
DICOMSortCriterion::Pointer CreateDICOMSortByTag(TiXmlElement* xmlElement, DICOMSortCriterion::Pointer secondaryCriterion) const;
DICOMSortCriterion::Pointer CreateSortByImagePositionPatient(TiXmlElement* xmlElement, DICOMSortCriterion::Pointer secondaryCriterion) const;
mitk::DICOMTagBasedSorter::Pointer CreateDICOMTagBasedSorter(TiXmlElement* element) const;
TiXmlElement* CreateConfigStringFromReader(const DICOMITKSeriesGDCMReader* reader) const;
TiXmlElement* CreateConfigStringFromReader(const ThreeDnTDICOMSeriesReader* reader) const;
TiXmlElement* CreateConfigStringFromReader(const ClassicDICOMSeriesReader* reader) const;
TiXmlElement* CreateConfigStringFromDICOMDatasetSorter(const DICOMTagBasedSorter* sorter) const;
TiXmlElement* CreateConfigStringFromDICOMTag(const DICOMTag& tag) const;
TiXmlElement* CreateDICOMFileReaderTag(const DICOMFileReader* reader) const;
const char* toString(bool) const;
std::string toHexString(unsigned int i) const;
/** Helper that queries an boolean xml attribute. If the attribute does not exist, the passed default value is used.*/
bool QueryBooleanAttribute(const TiXmlElement* element, const char* attributeName, bool defaultValue) const;
};
} // namespace
#endif // mitkDICOMReaderConfigurator_h
diff --git a/Modules/DICOM/src/legacy/mitkDicomSeriesReader.h b/Modules/DICOM/src/legacy/mitkDicomSeriesReader.h
index 12e83265e8..3a780617e0 100644
--- a/Modules/DICOM/src/legacy/mitkDicomSeriesReader.h
+++ b/Modules/DICOM/src/legacy/mitkDicomSeriesReader.h
@@ -1,1019 +1,1033 @@
/*============================================================================
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 mitkDicomSeriesReader_h
#define mitkDicomSeriesReader_h
#include "mitkConfig.h"
#include "mitkDataNode.h"
#include <itkGDCMImageIO.h>
#include <itkCommand.h>
#include <itkImageSeriesReader.h>
#ifdef NOMINMAX
#define DEF_NOMINMAX
#undef NOMINMAX
#endif
#include <gdcmConfigure.h>
#ifdef DEF_NOMINMAX
#ifndef NOMINMAX
#define NOMINMAX
#endif
#undef DEF_NOMINMAX
#endif
#include <gdcmDataSet.h>
#include <gdcmScanner.h>
namespace mitk
{
/**
\brief Loading DICOM images as MITK images.
- \ref DicomSeriesReader_purpose
- \ref DicomSeriesReader_limitations
- \ref DicomSeriesReader_usage
- \ref DicomSeriesReader_sorting
- \ref DicomSeriesReader_sorting1
- \ref DicomSeriesReader_sorting2
- \ref DicomSeriesReader_sorting3
- \ref DicomSeriesReader_sorting4
- \ref DicomSeriesReader_gantrytilt
- \ref DicomSeriesReader_pixelspacing
- \ref DicomSeriesReader_nextworkitems
- \ref DicomSeriesReader_whynotinitk
- \ref DicomSeriesReader_tests
\section DicomSeriesReader_purpose Purpose
DicomSeriesReader serves as a central class for loading DICOM images as mitk::Image.
As the term "DICOM image" covers a huge variety of possible modalities and
implementations, and since MITK assumes that 3D images are made up of continuous blocks
of slices without any gaps or changes in orientation, the loading mechanism must
implement a number of decisions and compromises.
<b>The main intention of this implementation is not efficiency but correctness of generated slice positions and pixel
spacings!</b>
\section DicomSeriesReader_limitations Assumptions and limitations
The class is working only with GDCM 2.0.14 (or possibly newer). This version is the
default of an MITK super-build. Support for other versions or ITK's DicomIO was dropped
because of the associated complexity of DicomSeriesReader.
\b Assumptions
- expected to work with certain SOP Classes (mostly CT Image Storage and MR Image Storage)
- see ImageBlockDescriptor.GetReaderImplementationLevel() method for the details
- special treatment for a certain type of Philips 3D ultrasound (recogized by tag 3001,0010 set to "Philips3D")
- loader will always attempt to read multiple single slices as a single 3D image volume (i.e. mitk::Image)
- slices will be grouped by basic properties such as orientation, rows, columns, spacing and grouped into as large
blocks as possible
- images which do NOT report a position or orientation in space (Image Position Patient, Image Orientation) will be
assigned defaults
- image position (0,0,0)
- image orientation (1,0,0), (0,1,0)
- such images will always be grouped separately since spatial grouping / sorting makes no sense for them
\b Options
- images that cover the same piece of space (i.e. position, orientation, and dimensions are equal)
can be interpreted as time-steps of the same image, i.e. a series will be loaded as 3D+t
\b Limitations
- the 3D+t assumption only works if all time-steps have an equal number of slices and if all
have the Acquisition Time attribute set to meaningful values
\section DicomSeriesReader_usage Usage
The starting point for an application is a set of DICOM files that should be loaded.
For convenience, DicomSeriesReader can also parse a whole directory for DICOM files,
but an application should better know exactly what to load.
Loading is then done in two steps:
1. <b>Group the files into spatial blocks</b> by calling GetSeries().
This method will sort all passed files into meaningful blocks that
could fit into an mitk::Image. Sorting for 3D+t loading is optional but default.
The \b return value of this function is a list of descriptors, which
describe a grouped list of files with its most basic properties:
- SOP Class (CT Image Storage, Secondary Capture Image Storage, etc.)
- Modality
- What type of pixel spacing can be read from the provided DICOM tags
- How well DicomSeriesReader is prepared to load this type of data
2. <b>Load a sorted set of files</b> by calling LoadDicomSeries().
This method expects go receive the sorting output of GetSeries().
The method will then invoke ITK methods configured with GDCM-IO
classes to actually load the files into memory and put them into
mitk::Images. Again, loading as 3D+t is optional.
Example:
\code
// only a directory is known at this point: /home/who/dicom
DicomSeriesReader::FileNamesGrouping allImageBlocks = DicomSeriesReader::GetSeries("/home/who/dicom/");
// file now divided into groups of identical image size, orientation, spacing, etc.
// each of these lists should be loadable as an mitk::Image.
DicomSeriesReader::StringContainer seriesToLoad = allImageBlocks[...]; // decide what to load
// final step: load into DataNode (can result in 3D+t image)
DataNode::Pointer node = DicomSeriesReader::LoadDicomSeries( oneBlockSorted );
itk::SmartPointer<Image> image = dynamic_cast<mitk::Image*>( node->GetData() );
\endcode
\section DicomSeriesReader_sorting Logic for sorting 2D slices from DICOM images into 3D+t blocks for mitk::Image
The general sorting mechanism (implemented in GetSeries) groups and sorts a set of DICOM files, each assumed to
contain
a single CT/MR slice.
In the following we refer to those file groups as "blocks", since this is what they are meant to become when loaded
into an mitk::Image.
\subsection DicomSeriesReader_sorting1 Step 1: Avoiding pure non-sense
A first pass separates slices that cannot possibly be loaded together because of restrictions of mitk::Image.
After this steps, each block contains only slices that match in all of the following DICOM tags:
- (0020,000e) Series Instance UID
- (0020,0037) Image Orientation
- (0028,0030) Pixel Spacing
- (0018,1164) Imager Pixel Spacing
- (0018,0050) Slice Thickness
- (0028,0010) Number Of Rows
- (0028,0011) Number Of Columns
- (0028,0008) Number Of Frames
\subsection DicomSeriesReader_sorting2 Step 2: Sort slices spatially
Before slices are further analyzed, they are sorted spatially. As implemented by GdcmSortFunction(),
slices are sorted by
1. distance from origin (calculated using (0020,0032) Image Position Patient and (0020,0037) Image Orientation)
2. when distance is equal, (0020,0012) Aquisition Number, (0008,0032) Acquisition Time and (0018,1060) Trigger Time
are
used as a backup criterions (necessary for meaningful 3D+t sorting)
\subsection DicomSeriesReader_sorting3 Step 3: Ensure equal z spacing
Since inter-slice distance is not recorded in DICOM tags, we must ensure that blocks are made up of
slices that have equal distances between neighboring slices. This is especially necessary because
itk::ImageSeriesReader
is later used for the actual loading, and this class expects (and does nocht verify) equal inter-slice distance (see
\ref DicomSeriesReader_whatweknowaboutitk).
To achieve such grouping, the inter-slice distance is calculated from the first two different slice positions of a
block.
Following slices are added to a block as long as they can be added by adding the calculated inter-slice distance to
the
last slice of the block. Slices that do not fit into the expected distance pattern, are set aside for further
analysis.
This grouping is done until each file has been assigned to a group.
Slices that share a position in space are also sorted into separate blocks during this step.
So the result of this step is a set of blocks that contain only slices with equal z spacing
and uniqe slices at each position.
\subsection DicomSeriesReader_sorting4 Step 4 (optional): group 3D blocks as 3D+t when possible
This last step depends on an option of GetSeries(). When requested, image blocks from the previous step are merged
again
whenever two blocks occupy the same portion of space (i.e. same origin, number of slices and z-spacing).
\section DicomSeriesReader_gantrytilt Handling of gantry tilt
When CT gantry tilt is used, the gantry plane (= X-Ray source and detector ring) and the vertical plane do not align
anymore. This scanner feature is used for example to reduce metal artifacs (e.g. <i>Lee C , Evaluation of Using CT
Gantry Tilt Scan on Head and Neck Cancer Patients with Dental Structure: Scans Show Less Metal Artifacts. Presented
at: Radiological Society of North America 2011 Scientific Assembly and Annual Meeting; November 27- December 2,
2011 Chicago IL.</i>).
The acquired planes of such CT series do not match the expectations of a orthogonal geometry in mitk::Image: if you
stack the slices, they show a small shift along the Y axis:
\verbatim
without tilt with tilt
|||||| //////
|||||| //////
-- |||||| --------- ////// -------- table orientation
|||||| //////
|||||| //////
Stacked slices:
without tilt with tilt
-------------- --------------
-------------- --------------
-------------- --------------
-------------- --------------
-------------- --------------
\endverbatim
As such gemetries do not in conjunction with mitk::Image, DicomSeriesReader performs a correction for such series
if the groupImagesWithGantryTilt or correctGantryTilt flag in GetSeries and LoadDicomSeries is set (default = on).
The correction algorithms undoes two errors introduced by ITK's ImageSeriesReader:
- the plane shift that is ignored by ITK's reader is recreated by applying a shearing transformation using
itk::ResampleFilter.
- the spacing is corrected (it is calculated by ITK's reader from the distance between two origins, which is NOT the
slice distance in this special case)
Both errors are introduced in
itkImageSeriesReader.txx (ImageSeriesReader<TOutputImage>::GenerateOutputInformation(void)), lines 176 to 245 (as of
ITK 3.20)
For the correction, we examine two consecutive slices of a series, both described as a pair (origin/orientation):
- we calculate if the first origin is on a line along the normal of the second slice
- if this is not the case, the geometry will not fit a normal mitk::Image/mitk::Geometry3D
- we then project the second origin into the first slice's coordinate system to quantify the shift
- both is done in class GantryTiltInformation with quite some comments.
The geometry of image stacks with tilted geometries is illustrated below:
- green: the DICOM images as described by their tags: origin as a point with the line indicating the orientation
- red: the output of ITK ImageSeriesReader: wrong, larger spacing, no tilt
- blue: how much a shear must correct
- \image tilt-correction.jpg
+ \image html Modules/DICOM/doc/Doxygen/tilt-correction.jpg
\section DicomSeriesReader_whatweknowaboutitk The actual image loading process
When calling LoadDicomSeries(), this method "mainly" uses an instance of itk::ImageSeriesReader,
configured with an itk::GDCMImageIO object. Because DicomSeriesReader works around some of the
behaviors of these classes, the following is a list of features that we find in the code and need to work with:
- itk::ImageSeriesReader::GenerateOutputInformation() does the z-spacing handling
+ spacing is directly determined by comparing (euclidean distance) the origins of the first two slices of a series
* this is GOOD because there is no reliable z-spacing information in DICOM images
* this is bad because it does not work with gantry tilt, in which case the slice distance is SMALLER than the
distance between two origins (see section on tilt)
- origin and spacing are calculated by GDCMImageIO and re-used in itk::ImageSeriesReader
+ the origins are read from appropriate tags, nothing special about that
+ the spacing is read by gdcm::ImageReader, gdcm::ImageHelper::GetSpacingValue() from a tag determined by
gdcm::ImageHelper::GetSpacingTagFromMediaStorage(), which basically determines ONE appropriate pixel spacing tag for
each media storage type (ct image, mr image, secondary capture image, etc.)
* this is fine for modalities such as CT/MR where the "Pixel Spacing" tag is mandatory, but for other modalities
such as CR or Secondary Capture, the tag "Imager Pixel Spacing" is taken, which is no only optional but also has a
more
complicated relation with the "Pixel Spacing" tag. For this reason we check/modify the pixel spacing reported by
itk::ImageSeriesReader after loading the image (see \ref DicomSeriesReader_pixelspacing)
AFTER loading, DicomSeriesReader marks some of its findings as mitk::Properties to the loaded Image and DataNode:
- <b>dicomseriesreader.SOPClass</b> : DICOM SOP Class as readable string (instead of a UID)
- <b>dicomseriesreader.ReaderImplementationLevelString</b> : Confidence /Support level of the reader for this image
as
readable string
- <b>dicomseriesreader.ReaderImplementationLevel</b> : Confidence /Support level of the reader for this image as
enum
value of type ReaderImplementationLevel
- <b>dicomseriesreader.PixelSpacingInterpretationString</b> : Appropriate interpreteation of pixel spacing for this
Image as readable string
- <b>dicomseriesreader.PixelSpacingInterpretation</b> : Appropriate interpreteation of pixel spacing for this Image
as
enum value of type PixelSpacingInterpretation
- <b>dicomseriesreader.MultiFrameImage</b> : bool flag to mark multi-frame images
- <b>dicomseriesreader.GantyTiltCorrected</b> : bool flag to mark images where a gantry tilt was corrected to fit
slices into an mitk::Image
- <b>dicomseriesreader.3D+t</b> : bool flag to mark images with a time dimension (multiple 3D blocks of the same
size
at the same position in space)
\section DicomSeriesReader_pixelspacing Handling of pixel spacing
The reader implementes what is described in DICOM Part 3, chapter 10.7 (Basic Pixel Spacing Calibration Macro): Both
tags
- (0028,0030) Pixel Spacing and
- (0018,1164) Imager Pixel Spacing
are evaluated and the pixel spacing is set to the spacing within the patient when tags allow that.
The result of pixel spacing interpretation can be read from a property
"dicomseriesreader.PixelSpacingInterpretation",
which refers to one of the enumerated values of type PixelSpacingInterpretation;
\section DicomSeriesReader_supportedmodalities Limitations for specific modalities
- <b>Enhanced Computed Tomography / Magnetic Resonance Images</b> are currently NOT supported at all, because we
lack
general support for multi-frame images.
- <b>Nuclear Medicine Images</b> are not supported fully supported, only the single-frame variants are loaded
properly.
\section DicomSeriesReader_nextworkitems Possible enhancements
This is a short list of ideas for enhancement:
- Class has historically grown and should be reviewed again. There is probably too many duplicated scanning code
- Multi-frame images don't mix well with the curent assumption of "one file - one slice", which is assumed by our
code
- It should be checked how well GDCM and ITK support these files (some load, some don't)
- Specializations such as the Philips 3D code should be handled in a more generic way. The current handling of
Philips 3D images is not nice at all
\section DicomSeriesReader_whynotinitk Why is this not in ITK?
Some of this code would probably be better located in ITK. It is just a matter of resources that this is not the
case yet. Any attempts into this direction are welcome and can be supported. At least the gantry tilt correction
should be a simple addition to itk::ImageSeriesReader.
\section DicomSeriesReader_tests Tests regarding DICOM loading
A number of tests have been implemented to check our assumptions regarding DICOM loading. Please see \ref
DICOMTesting
\todo refactor all the protected helper objects/methods into a separate header so we compile faster
*/
class Image;
class DicomSeriesReader
{
public:
/**
\brief Lists of filenames.
*/
typedef std::vector<std::string> StringContainer;
/**
\brief Interface for the progress callback.
*/
typedef void (*UpdateCallBackMethod)(float);
/**
\brief Describes how well the reader is tested for a certain file type.
Applications should not rely on the outcome for images which are reported
ReaderImplementationLevel_Implemented or ReaderImplementationLevel_Unsupported.
Errors to load images which are reported as ReaderImplementationLevel_Supported
are considered bugs. For ReaderImplementationLevel_PartlySupported please check the appropriate paragraph in \ref
DicomSeriesReader_supportedmodalities
*/
typedef enum {
ReaderImplementationLevel_Supported, /// loader code and tests are established
ReaderImplementationLevel_PartlySupported, /// loader code and tests are establised for specific parts of a SOP
/// Class
ReaderImplementationLevel_Implemented, /// loader code is implemented but not accompanied by tests
ReaderImplementationLevel_Unsupported, /// loader code is not working with this SOP Class
} ReaderImplementationLevel;
/**
\brief How the mitk::Image spacing should be interpreted.
Compare DICOM PS 3.3 10.7 (Basic Pixel Spacing Calibration Macro).
*/
typedef enum {
PixelSpacingInterpretation_SpacingInPatient, /// distances are mm within a patient
PixelSpacingInterpretation_SpacingAtDetector, /// distances are mm at detector surface
PixelSpacingInterpretation_SpacingUnknown /// NO spacing information is present, we use (1,1) as default
} PixelSpacingInterpretation;
/**
\brief Return type of GetSeries, describes a logical group of files.
Files grouped into a single 3D or 3D+t block are described by an instance
of this class. Relevant descriptive properties can be used to provide
the application user with meaningful choices.
*/
class ImageBlockDescriptor
{
public:
/// List of files in this group
StringContainer GetFilenames() const;
/// A unique ID describing this bloc (enhanced Series Instance UID).
std::string GetImageBlockUID() const;
/// The Series Instance UID.
std::string GetSeriesInstanceUID() const;
/// Series Modality (CT, MR, etc.)
std::string GetModality() const;
/// SOP Class UID as readable string (Computed Tomography Image Storage, Secondary Capture Image Storage, etc.)
std::string GetSOPClassUIDAsString() const;
/// SOP Class UID as DICOM UID
std::string GetSOPClassUID() const;
/// Confidence of the reader that this block can be read successfully.
ReaderImplementationLevel GetReaderImplementationLevel() const;
/// Whether or not the block contains a gantry tilt which will be "corrected" during loading
bool HasGantryTiltCorrected() const;
/// Whether or not mitk::Image spacing relates to the patient
bool PixelSpacingRelatesToPatient() const;
/// Whether or not mitk::Image spacing relates to the detector surface
bool PixelSpacingRelatesToDetector() const;
/// Whether or not mitk::Image spacing is of unknown origin
bool PixelSpacingIsUnknown() const;
/// How the mitk::Image spacing can meaningfully be interpreted.
PixelSpacingInterpretation GetPixelSpacingType() const;
/// 3D+t or not
bool HasMultipleTimePoints() const;
/// Multi-frame image(s) or not
bool IsMultiFrameImage() const;
ImageBlockDescriptor();
~ImageBlockDescriptor();
private:
friend class DicomSeriesReader;
ImageBlockDescriptor(const StringContainer &files);
void AddFile(const std::string &file);
void AddFiles(const StringContainer &files);
void SetImageBlockUID(const std::string &uid);
void SetSeriesInstanceUID(const std::string &uid);
void SetModality(const std::string &modality);
void SetNumberOfFrames(const std::string &);
void SetSOPClassUID(const std::string &mediaStorageSOPClassUID);
void SetHasGantryTiltCorrected(bool);
void SetPixelSpacingInformation(const std::string &pixelSpacing, const std::string &imagerPixelSpacing);
void SetHasMultipleTimePoints(bool);
void GetDesiredMITKImagePixelSpacing(ScalarType &spacingX, ScalarType &spacingY) const;
StringContainer m_Filenames;
std::string m_ImageBlockUID;
std::string m_SeriesInstanceUID;
std::string m_Modality;
std::string m_SOPClassUID;
bool m_HasGantryTiltCorrected;
std::string m_PixelSpacing;
std::string m_ImagerPixelSpacing;
bool m_HasMultipleTimePoints;
bool m_IsMultiFrameImage;
};
typedef std::map<std::string, ImageBlockDescriptor> FileNamesGrouping;
/**
\brief Provide combination of preprocessor defines that was active during compilation.
Since this class is a combination of several possible implementations, separated only
by ifdef's, calling instances might want to know which flags were active at compile time.
*/
static std::string GetConfigurationString();
/**
\brief Checks if a specific file contains DICOM data.
*/
static bool IsDicom(const std::string &filename);
/**
\brief see other GetSeries().
Find all series (and sub-series -- see details) in a particular directory.
*/
static FileNamesGrouping GetSeries(const std::string &dir,
bool groupImagesWithGantryTilt,
const StringContainer &restrictions = StringContainer());
/**
\brief see other GetSeries().
\warning Untested, could or could not work.
This differs only by having an additional restriction to a single known DICOM series.
Internally, it uses the other GetSeries() method.
*/
static StringContainer GetSeries(const std::string &dir,
const std::string &series_uid,
bool groupImagesWithGantryTilt,
const StringContainer &restrictions = StringContainer());
/**
\brief PREFERRED version of this method - scan and sort DICOM files.
Parse a list of files for images of DICOM series.
For each series, an enumeration of the files contained in it is created.
\return The resulting maps UID-like keys (based on Series Instance UID and slice properties) to sorted lists of
file
names.
SeriesInstanceUID will be enhanced to be unique for each set of file names
that is later loadable as a single mitk::Image. This implies that
Image orientation, slice thickness, pixel spacing, rows, and columns
must be the same for each file (i.e. the image slice contained in the file).
If this separation logic requires that a SeriesInstanceUID must be made more specialized,
it will follow the same logic as itk::GDCMSeriesFileNames to enhance the UID with
more digits and dots.
Optionally, more tags can be used to separate files into different logical series by setting
the restrictions parameter.
\warning Adding restrictions is not yet implemented!
*/
static FileNamesGrouping GetSeries(const StringContainer &files,
bool sortTo3DPlust,
bool groupImagesWithGantryTilt,
const StringContainer &restrictions = StringContainer());
/**
\brief See other GetSeries().
Use GetSeries(const StringContainer& files, bool sortTo3DPlust, const StringContainer &restrictions) instead.
*/
static FileNamesGrouping GetSeries(const StringContainer &files,
bool groupImagesWithGantryTilt,
const StringContainer &restrictions = StringContainer());
/**
Loads a DICOM series composed by the file names enumerated in the file names container.
If a callback method is supplied, it will be called after every progress update with a progress value in [0,1].
\param filenames The filenames to load.
\param sort Whether files should be sorted spatially (true) or not (false - maybe useful if presorted)
\param load4D Whether to load the files as 3D+t (if possible)
+ \param correctGantryTilt
+ \param callback
+ \param preLoadedImageBlock
*/
static DataNode::Pointer LoadDicomSeries(const StringContainer &filenames,
bool sort = true,
bool load4D = true,
bool correctGantryTilt = true,
UpdateCallBackMethod callback = nullptr,
itk::SmartPointer<Image> preLoadedImageBlock = nullptr);
/**
\brief See LoadDicomSeries! Just a slightly different interface.
- If \p preLoadedImageBlock is provided, the reader will only "fake" loading and create appropriate
- mitk::Properties.
+ If \p preLoadedImageBlock is provided, the reader will only "fake" loading and create appropriate mitk::Properties.
+
+ \param filenames
+ \param node
+ \param sort
+ \param load4D
+ \param correctGantryTilt
+ \param callback
+ \param preLoadedImageBlock
*/
static bool LoadDicomSeries(const StringContainer &filenames,
DataNode &node,
bool sort = true,
bool load4D = true,
bool correctGantryTilt = true,
UpdateCallBackMethod callback = nullptr,
itk::SmartPointer<Image> preLoadedImageBlock = nullptr);
protected:
/**
\brief Return type of DicomSeriesReader::AnalyzeFileForITKImageSeriesReaderSpacingAssumption.
Class contains the grouping result of method
DicomSeriesReader::AnalyzeFileForITKImageSeriesReaderSpacingAssumption,
which takes as input a number of images, which are all equally oriented and spatially sorted along their normal
direction.
The result contains of two blocks: a first one is the grouping result, all of those images can be loaded
into one image block because they have an equal origin-to-origin distance without any gaps in-between.
*/
class SliceGroupingAnalysisResult
{
public:
SliceGroupingAnalysisResult();
/**
\brief Grouping result, all same origin-to-origin distance w/o gaps.
*/
StringContainer GetBlockFilenames();
/**
\brief Remaining files, which could not be grouped.
*/
StringContainer GetUnsortedFilenames();
/**
\brief Wheter or not the grouped result contain a gantry tilt.
*/
bool ContainsGantryTilt();
/**
\brief Meant for internal use by AnalyzeFileForITKImageSeriesReaderSpacingAssumption only.
*/
void AddFileToSortedBlock(const std::string &filename);
/**
\brief Meant for internal use by AnalyzeFileForITKImageSeriesReaderSpacingAssumption only.
*/
void AddFileToUnsortedBlock(const std::string &filename);
void AddFilesToUnsortedBlock(const StringContainer &filenames);
/**
\brief Meant for internal use by AnalyzeFileForITKImageSeriesReaderSpacingAssumption only.
\todo Could make sense to enhance this with an instance of GantryTiltInformation to store the whole result!
*/
void FlagGantryTilt();
/**
\brief Only meaningful for use by AnalyzeFileForITKImageSeriesReaderSpacingAssumption.
*/
void UndoPrematureGrouping();
protected:
StringContainer m_GroupedFiles;
StringContainer m_UnsortedFiles;
bool m_GantryTilt;
};
/**
\brief Gantry tilt analysis result.
Takes geometry information for two slices of a DICOM series and
calculates whether these fit into an orthogonal block or not.
If NOT, they can either be the result of an acquisition with
gantry tilt OR completly broken by some shearing transformation.
Most calculations are done in the constructor, results can then
be read via the remaining methods.
*/
class GantryTiltInformation
{
public:
// two types to avoid any rounding errors
typedef itk::Point<double, 3> Point3Dd;
typedef itk::Vector<double, 3> Vector3Dd;
/**
\brief Just so we can create empty instances for assigning results later.
*/
GantryTiltInformation();
/**
\brief THE constructor, which does all the calculations.
Determining the amount of tilt is done by checking the distances
of origin1 from planes through origin2. Two planes are considered:
- normal vector along normal of slices (right x up): gives the slice distance
- normal vector along orientation vector "up": gives the shift parallel to the plane orientation
The tilt angle can then be calculated from these distances
\param origin1 origin of the first slice
\param origin2 origin of the second slice
\param right right/up describe the orientatation of borth slices
\param up right/up describe the orientatation of borth slices
\param numberOfSlicesApart how many slices are the given origins apart (1 for neighboring slices)
*/
GantryTiltInformation(const Point3D &origin1,
const Point3D &origin2,
const Vector3D &right,
const Vector3D &up,
unsigned int numberOfSlicesApart);
/**
\brief Whether the slices were sheared.
True if any of the shifts along right or up vector are non-zero.
*/
bool IsSheared() const;
/**
\brief Whether the shearing is a gantry tilt or more complicated.
Gantry tilt will only produce shifts in ONE orientation, not in both.
Since the correction code currently only coveres one tilt direction
AND we don't know of medical images with two tilt directions, the
loading code wants to check if our assumptions are true.
*/
bool IsRegularGantryTilt() const;
/**
\brief The offset distance in Y direction for each slice in mm (describes the tilt result).
*/
double GetMatrixCoefficientForCorrectionInWorldCoordinates() const;
/**
\brief The z / inter-slice spacing. Needed to correct ImageSeriesReader's result.
*/
double GetRealZSpacing() const;
/**
\brief The shift between first and last slice in mm.
Needed to resize an orthogonal image volume.
*/
double GetTiltCorrectedAdditionalSize() const;
/**
\brief Calculated tilt angle in degrees.
*/
double GetTiltAngleInDegrees() const;
protected:
/**
\brief Projection of point p onto line through lineOrigin in direction of lineDirection.
*/
Point3D projectPointOnLine(Point3Dd p, Point3Dd lineOrigin, Vector3Dd lineDirection);
double m_ShiftUp;
double m_ShiftRight;
double m_ShiftNormal;
double m_ITKAssumedSliceSpacing;
unsigned int m_NumberOfSlicesApart;
};
/**
\brief for internal sorting.
*/
typedef std::pair<StringContainer, StringContainer> TwoStringContainers;
/**
\brief Maps DICOM tags to MITK properties.
*/
typedef std::map<std::string, std::string> TagToPropertyMapType;
/**
\brief Ensure an equal z-spacing for a group of files.
Takes as input a number of images, which are all equally oriented and spatially sorted along their normal
direction.
Internally used by GetSeries. Returns two lists: the first one contins slices of equal inter-slice spacing.
The second list contains remaining files, which need to be run through
AnalyzeFileForITKImageSeriesReaderSpacingAssumption again.
Relevant code that is matched here is in
itkImageSeriesReader.txx (ImageSeriesReader<TOutputImage>::GenerateOutputInformation(void)), lines 176 to 245 (as
of
ITK 3.20)
*/
static SliceGroupingAnalysisResult AnalyzeFileForITKImageSeriesReaderSpacingAssumption(
const StringContainer &files, bool groupsOfSimilarImages, const gdcm::Scanner::MappingType &tagValueMappings_);
/**
\brief Safely convert const char* to std::string.
*/
static std::string ConstCharStarToString(const char *s);
/**
\brief Safely convert a string into pixel spacing x and y.
*/
static bool DICOMStringToSpacing(const std::string &s, ScalarType &spacingX, ScalarType &spacingY);
/**
\brief Convert DICOM string describing a point to Point3D.
DICOM tags like ImagePositionPatient contain a position as float numbers separated by backslashes:
\verbatim
42.7131\13.77\0.7
\endverbatim
*/
static Point3D DICOMStringToPoint3D(const std::string &s, bool &successful);
/**
\brief Convert DICOM string describing a point two Vector3D.
DICOM tags like ImageOrientationPatient contain two vectors as float numbers separated by backslashes:
\verbatim
42.7131\13.77\0.7\137.76\0.3
\endverbatim
*/
static void DICOMStringToOrientationVectors(const std::string &s, Vector3D &right, Vector3D &up, bool &successful);
template <typename ImageType>
static typename ImageType::Pointer
// TODO this is NOT inplace!
InPlaceFixUpTiltedGeometry(ImageType *input, const GantryTiltInformation &tiltInfo);
/**
\brief Sort a set of file names in an order that is meaningful for loading them into an mitk::Image.
\warning This method assumes that input files are similar in basic properties such as
slice thicknes, image orientation, pixel spacing, rows, columns.
It should always be ok to put the result of a call to GetSeries(..) into this method.
Sorting order is determined by
1. image position along its normal (distance from world origin)
2. acquisition time
If P<n> denotes a position and T<n> denotes a time step, this method will order slices from three timesteps like
this:
\verbatim
P1T1 P1T2 P1T3 P2T1 P2T2 P2T3 P3T1 P3T2 P3T3
\endverbatim
*/
static StringContainer SortSeriesSlices(const StringContainer &unsortedFilenames);
public:
/**
\brief Checks if a specific file is a Philips3D ultrasound DICOM file.
*/
static bool IsPhilips3DDicom(const std::string &filename);
static std::string ReaderImplementationLevelToString(const ReaderImplementationLevel &enumValue);
static std::string PixelSpacingInterpretationToString(const PixelSpacingInterpretation &enumValue);
protected:
/**
\brief Read a Philips3D ultrasound DICOM file and put into an mitk::Image.
*/
static bool ReadPhilips3DDicom(const std::string &filename, itk::SmartPointer<Image> output_image);
/**
\brief Construct a UID that takes into account sorting criteria from GetSeries().
*/
static std::string CreateMoreUniqueSeriesIdentifier(gdcm::Scanner::TagToValue &tagValueMap);
/**
\brief Helper for CreateMoreUniqueSeriesIdentifier
*/
static std::string CreateSeriesIdentifierPart(gdcm::Scanner::TagToValue &tagValueMap, const gdcm::Tag &tag);
/**
\brief Helper for CreateMoreUniqueSeriesIdentifier
*/
static std::string IDifyTagValue(const std::string &value);
typedef itk::GDCMImageIO DcmIoType;
/**
\brief Progress callback for DicomSeriesReader.
*/
class CallbackCommand : public itk::Command
{
public:
CallbackCommand(UpdateCallBackMethod callback) : m_Callback(callback) {}
void Execute(const itk::Object *caller, const itk::EventObject &) override
{
(*this->m_Callback)(static_cast<const itk::ProcessObject *>(caller)->GetProgress());
}
void Execute(itk::Object *caller, const itk::EventObject &) override
{
(*this->m_Callback)(static_cast<itk::ProcessObject *>(caller)->GetProgress());
}
protected:
UpdateCallBackMethod m_Callback;
};
static void FixSpacingInformation(Image *image, const ImageBlockDescriptor &imageBlockDescriptor);
/**
\brief Scan for slice image information
*/
static void ScanForSliceInformation(const StringContainer &filenames, gdcm::Scanner &scanner);
/**
\brief Performs actual loading of a series and creates an image having the specified pixel type.
*/
static void LoadDicom(const StringContainer &filenames,
DataNode &node,
bool sort,
bool check_4d,
bool correctTilt,
UpdateCallBackMethod callback,
itk::SmartPointer<Image> preLoadedImageBlock);
/**
\brief Feed files into itk::ImageSeriesReader and retrieve a 3D MITK image.
+ \param correctTilt
+ \param tiltInfo
+ \param io
\param command can be used for progress reporting
+ \param preLoadedImageBlock
*/
template <typename PixelType>
static itk::SmartPointer<Image> LoadDICOMByITK(const StringContainer &,
bool correctTilt,
const GantryTiltInformation &tiltInfo,
DcmIoType::Pointer &io,
CallbackCommand *command,
itk::SmartPointer<Image> preLoadedImageBlock);
static itk::SmartPointer<Image> MultiplexLoadDICOMByITK(const StringContainer &,
bool correctTilt,
const GantryTiltInformation &tiltInfo,
DcmIoType::Pointer &io,
CallbackCommand *command,
itk::SmartPointer<Image> preLoadedImageBlock);
static itk::SmartPointer<Image> MultiplexLoadDICOMByITKScalar(const StringContainer &,
bool correctTilt,
const GantryTiltInformation &tiltInfo,
DcmIoType::Pointer &io,
CallbackCommand *command,
itk::SmartPointer<Image> preLoadedImageBlock);
static itk::SmartPointer<Image> MultiplexLoadDICOMByITKRGBPixel(const StringContainer &,
bool correctTilt,
const GantryTiltInformation &tiltInfo,
DcmIoType::Pointer &io,
CallbackCommand *command,
itk::SmartPointer<Image> preLoadedImageBlock);
template <typename PixelType>
static itk::SmartPointer<Image> LoadDICOMByITK4D(std::list<StringContainer> &imageBlocks,
ImageBlockDescriptor imageBlockDescriptor,
bool correctTilt,
const GantryTiltInformation &tiltInfo,
DcmIoType::Pointer &io,
CallbackCommand *command,
itk::SmartPointer<Image> preLoadedImageBlock);
static itk::SmartPointer<Image> MultiplexLoadDICOMByITK4D(std::list<StringContainer> &imageBlocks,
ImageBlockDescriptor imageBlockDescriptor,
bool correctTilt,
const GantryTiltInformation &tiltInfo,
DcmIoType::Pointer &io,
CallbackCommand *command,
itk::SmartPointer<Image> preLoadedImageBlock);
static itk::SmartPointer<Image> MultiplexLoadDICOMByITK4DScalar(std::list<StringContainer> &imageBlocks,
ImageBlockDescriptor imageBlockDescriptor,
bool correctTilt,
const GantryTiltInformation &tiltInfo,
DcmIoType::Pointer &io,
CallbackCommand *command,
itk::SmartPointer<Image> preLoadedImageBlock);
static itk::SmartPointer<Image> MultiplexLoadDICOMByITK4DRGBPixel(std::list<StringContainer> &imageBlocks,
ImageBlockDescriptor imageBlockDescriptor,
bool correctTilt,
const GantryTiltInformation &tiltInfo,
DcmIoType::Pointer &io,
CallbackCommand *command,
itk::SmartPointer<Image> preLoadedImageBlock);
/**
\brief Sort files into time step blocks of a 3D+t image.
Called by LoadDicom. Expects to be fed a single list of filenames that have been sorted by
GetSeries previously (one map entry). This method will check how many timestep can be filled
with given files.
Assumption is that the number of time steps is determined by how often the first position in
space repeats. I.e. if the first three files in the input parameter all describe the same
location in space, we'll construct three lists of files. and sort the remaining files into them.
\todo We can probably remove this method if we somehow transfer 3D+t information from GetSeries to
LoadDicomSeries.
*/
static std::list<StringContainer> SortIntoBlocksFor3DplusT(const StringContainer &presortedFilenames,
const gdcm::Scanner::MappingType &tagValueMappings_,
bool sort,
bool &canLoadAs4D);
/**
\brief Defines spatial sorting for sorting by GDCM 2.
Sorts by image position along image normal (distance from world origin).
In cases of conflict, acquisition time is used as a secondary sort criterium.
*/
static bool GdcmSortFunction(const gdcm::DataSet &ds1, const gdcm::DataSet &ds2);
/**
\brief Copy information about files and DICOM tags from ITK's MetaDataDictionary
and from the list of input files to the PropertyList of mitk::Image.
\todo Tag copy must follow; image level will cause some additional files parsing, probably.
*/
static void CopyMetaDataToImageProperties(StringContainer filenames,
const gdcm::Scanner::MappingType &tagValueMappings_,
DcmIoType *io,
const ImageBlockDescriptor &blockInfo,
Image *image);
static void CopyMetaDataToImageProperties(std::list<StringContainer> imageBlock,
const gdcm::Scanner::MappingType &tagValueMappings_,
DcmIoType *io,
const ImageBlockDescriptor &blockInfo,
Image *image);
/**
\brief Map between DICOM tags and MITK properties.
Uses as a positive list for copying specified DICOM tags (from ITK's ImageIO)
to MITK properties. ITK provides MetaDataDictionary entries of form
"gggg|eeee" (g = group, e = element), e.g. "0028,0109" (Largest Pixel in Series),
which we want to sort as dicom.series.largest_pixel_in_series".
*/
static const TagToPropertyMapType &GetDICOMTagsToMITKPropertyMap();
};
}
#endif /* mitkDicomSeriesReader_h */
diff --git a/Modules/DICOMUI/include/QmitkDicomLocalStorageWidget.h b/Modules/DICOMUI/include/QmitkDicomLocalStorageWidget.h
index cd8b541fbc..86d2cedc3e 100644
--- a/Modules/DICOMUI/include/QmitkDicomLocalStorageWidget.h
+++ b/Modules/DICOMUI/include/QmitkDicomLocalStorageWidget.h
@@ -1,117 +1,117 @@
/*============================================================================
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 QmitkDicomLocalStorageWidget_h
#define QmitkDicomLocalStorageWidget_h
// #include <QmitkFunctionality.h>
#include "ui_QmitkDicomLocalStorageWidgetControls.h"
#include <MitkDICOMUIExports.h>
// include ctk
#include <ctkDICOMDatabase.h>
#include <ctkDICOMIndexer.h>
#include <ctkFileDialog.h>
// include QT
#include <QHash>
#include <QString>
#include <QStringList>
#include <QVariant>
#include <QWidget>
class QProgressDialog;
class QLabel;
/**
* \brief QmitkDicomLocalStorageWidget is a QWidget providing functionality for dicom storage and import.
*
* \sa QmitkFunctionality
* \ingroup Functionalities
*/
class MITKDICOMUI_EXPORT QmitkDicomLocalStorageWidget : public QWidget
{
// this is needed for all Qt objects that should have a Qt meta-object
// (everything that derives from QObject and wants to have signal/slots)
Q_OBJECT
public:
static const std::string Widget_ID;
/**
* \brief QmitkDicomLocalStorageWidget(QWidget *parent) constructor.
*
* \param parent is a pointer to the parent widget
*/
QmitkDicomLocalStorageWidget(QWidget *parent);
/**
* \brief QmitkDicomExternalDataWidget destructor.
*/
~QmitkDicomLocalStorageWidget() override;
/**
* \brief CreateQtPartControl(QWidget *parent) sets the view objects from ui_QmitkDicomExternalDataWidgetControls.h.
*
* \param parent is a pointer to the parent widget
*/
virtual void CreateQtPartControl(QWidget *parent);
/**
* \brief SetDatabaseDirectory sets database directory.
*
* \param newDatabaseDirectory contains path to new database directoy.
*/
void SetDatabaseDirectory(QString newDatabaseDirectory);
signals:
/// @brief emitted when import into database is finished.
void SignalFinishedImport();
/**
* @brief emitted when view button is clicked.
- * @param QHash containing dicom UIDs properties.
+ * @param _t1 containing dicom UIDs properties.
*/
- void SignalDicomToDataManager(QHash<QString, QVariant>);
+ void SignalDicomToDataManager(QHash<QString, QVariant> _t1);
/// \brief emitted if cancel button is pressed.
void SignalCancelImport();
public slots:
/// @brief Called when view button was clicked.
void OnViewButtonClicked();
/// @brief Called delete button was clicked.
void OnDeleteButtonClicked();
/// @brief Called when adding a dicom directory. Starts a thread adding the directory.
void OnStartDicomImport(const QString &dicomData);
/// @brief Called when adding a list of dicom files. Starts a thread adding the dicom files.
void OnStartDicomImport(const QStringList &dicomData);
/// @brief Called when the selection in the series table has changed
void OnSeriesSelectionChanged(const QStringList &);
protected:
void SetDatabase(QString databaseFile);
bool DeletePatients();
bool DeleteStudies();
bool DeleteSeries();
ctkDICOMDatabase *m_LocalDatabase;
ctkDICOMIndexer *m_LocalIndexer;
Ui::QmitkDicomLocalStorageWidgetControls *m_Controls;
};
#endif // _QmitkDicomLocalStorageWidget_H_INCLUDED
diff --git a/Modules/DICOMweb/include/mitkDICOMweb.h b/Modules/DICOMweb/include/mitkDICOMweb.h
index ad34d51290..36643d4f6a 100644
--- a/Modules/DICOMweb/include/mitkDICOMweb.h
+++ b/Modules/DICOMweb/include/mitkDICOMweb.h
@@ -1,137 +1,137 @@
/*============================================================================
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 mitkDICOMweb_h
#define mitkDICOMweb_h
#include <MitkDICOMwebExports.h>
#include "cpprest/asyncrt_utils.h"
#include "cpprest/http_client.h"
#include <iostream>
#include <mitkCommon.h>
#include <mitkIRESTManager.h>
#include <mitkRESTUtil.h>
#include <usGetModuleContext.h>
#include <usModuleContext.h>
/**
* @brief This class represents the implementation of the RESTful DICOMweb standard
* (http://dicom.nema.org/medical/dicom/current/output/html/part18.html). It is used to communicate DICOM data over HTTP
* to a DICOMweb enabled PACS server.
*
* @author Tobias Stein
*/
namespace mitk
{
class MITKDICOMWEB_EXPORT DICOMweb
{
public:
typedef web::http::uri_builder MitkUriBuilder;
typedef web::http::http_request MitkRequest;
typedef web::http::http_response MitkResponse;
typedef web::http::methods MitkRESTMethods;
DICOMweb();
/**
* @brief Creates a DICOMweb service instance which allow basic DICOM operations on the given base URI.
*
* @param baseURI the uri for the PACS server: for example a dcm4chee
* <code>http://<ip:port>/dcm4chee-arc/aets/DCM4CHEE/</code>
*/
DICOMweb(utility::string_t baseURI);
/**
* @brief Sends a STOW request with the file in the given path to the study given bei its UID.
*
* @param filePath the path to a valid DICOM file which should be send
* @param studyUID the DICOM study uid
- * @param the task to wait for
+ * @return the task to wait for
*/
pplx::task<void> SendSTOW(utility::string_t filePath, utility::string_t studyUID);
/**
* @brief Sends a WADO request for an DICOM object instance matching the given uid parameters and stores it at the
* given file path.
*
* @param filePath the path at which the retrieved DICOM object instance will be stored
* @param studyUID the DICOM study uid
* @param seriesUID the DICOM series uid
* @param instanceUID the DICOM instance uid
* @return the task to wait for, which unfolds no value when finished
*/
pplx::task<void> SendWADO(utility::string_t filePath,
utility::string_t studyUID,
utility::string_t seriesUID,
utility::string_t instanceUID);
/**
* @brief Sends a WADO request for an DICOM object series matching the given uid parameters and stores all the
* containing instances at the given folder path.
*
* @param folderPath the path at which the retrieved DICOM object instances of the retrieved series will be stored
* @param studyUID the DICOM study uid
* @param seriesUID the DICOM series uid
* @return the task to wait for, which unfolds the name of the first DICOM object file within the folder path
*/
pplx::task<std::string> SendWADO(utility::string_t folderPath,
utility::string_t studyUID,
utility::string_t seriesUID);
/**
* @brief Sends a QIDO request containing the given parameters to filter the query.
*
* Example Map:
* <code>
* mitk::RESTUtil::ParamMap seriesInstancesParams;
* seriesInstancesParams.insert(mitk::RESTUtil::ParamMap::value_type(U("limit"), U("1")));
* </code>
*
* @param map the map of parameters to filter the query
* @return the task to wait for, which unfolds the result JSON response for the request when finished
*/
pplx::task<web::json::value> SendQIDO(mitk::RESTUtil::ParamMap map);
private:
/**
* @brief Creates a QIDO request URI with the given parameter map
*/
utility::string_t CreateQIDOUri(mitk::RESTUtil::ParamMap map);
/**
* @brief Creates a WADO request URI with the given parameter
*/
utility::string_t CreateWADOUri(utility::string_t studyUID,
utility::string_t seriesUID,
utility::string_t instanceUID);
/**
* @brief Creates a STOW request URI with the study uid
*/
utility::string_t CreateSTOWUri(utility::string_t studyUID);
/**
* @brief Initializes the rest manager for this service instance. Should be called in constructor to make sure the
* public API can work properly.
*/
void InitializeRESTManager();
utility::string_t m_BaseURI;
mitk::IRESTManager *m_RESTManager;
};
}
#endif // DICOMweb_h
diff --git a/Modules/DataTypesExt/files.cmake b/Modules/DataTypesExt/files.cmake
index f8569f2e63..0508c5b9f1 100644
--- a/Modules/DataTypesExt/files.cmake
+++ b/Modules/DataTypesExt/files.cmake
@@ -1,46 +1,45 @@
file(GLOB_RECURSE H_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include/*")
set(CPP_FILES
mitkAffineBaseDataInteractor3D.cpp
mitkAffineImageCropperInteractor.cpp
mitkApplyDiffImageOperation.cpp
mitkBoundingObject.cpp
mitkBoundingObjectGroup.cpp
mitkCellOperation.cpp
mitkClippingPlaneInteractor3D.cpp
mitkColorSequence.cpp
mitkColorSequenceCycleH.cpp
mitkColorSequenceRainbow.cpp
mitkCompressedImageContainer.cpp
mitkCone.cpp
mitkCuboid.cpp
mitkCylinder.cpp
mitkDataStorageSelection.cpp
mitkEllipsoid.cpp
mitkGridRepresentationProperty.cpp
mitkGridVolumeMapperProperty.cpp
mitkLabeledImageLookupTable.cpp
mitkLabeledImageVolumeCalculator.cpp
mitkLineOperation.cpp
mitkLookupTableSource.cpp
- mitkMesh.cpp
mitkMultiStepper.cpp
mitkPlane.cpp
mitkSurfaceDeformationDataInteractor3D.cpp
mitkUnstructuredGrid.cpp
mitkUnstructuredGridSource.cpp
mitkVideoSource.cpp
mitkColorConversions.cpp
)
set(RESOURCE_FILES
Interactions/AffineInteraction3D.xml
Interactions/AffineMouseConfig.xml
Interactions/AffineKeyConfig.xml
Interactions/ClippingPlaneInteraction3D.xml
Interactions/ClippingPlaneTranslationConfig.xml
Interactions/ClippingPlaneRotationConfig.xml
Interactions/ClippingPlaneDeformationConfig.xml
Interactions/CropperDeformationConfig.xml
)
diff --git a/Modules/DataTypesExt/include/mitkApplyDiffImageOperation.h b/Modules/DataTypesExt/include/mitkApplyDiffImageOperation.h
index 884dbf7e12..ee25cbea9b 100644
--- a/Modules/DataTypesExt/include/mitkApplyDiffImageOperation.h
+++ b/Modules/DataTypesExt/include/mitkApplyDiffImageOperation.h
@@ -1,84 +1,88 @@
/*============================================================================
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 mitkApplyDiffImageIIncluded
#define mitkApplyDiffImageIIncluded
#include "MitkDataTypesExtExports.h"
#include "mitkCompressedImageContainer.h"
#include "mitkOperation.h"
namespace mitk
{
/**
@brief Operation, that holds information about some image difference
This class stores undo information for DiffImageApplier.
Instances of this class are created e.g. by OverwriteSliceImageFilter.
This works only for images with 1 channel (gray scale images, no color images).
ApplyDiffImageOperation of course refers to an image (a segmentation usually).
The refered image is observed for itk::DeleteEvent, because there is no SmartPointer
used to keep the image alive -- the purpose of this class is undo and the undo
stack should not keep things alive forever.
To save memory, zlib compression is used via CompressedImageContainer.
@ingroup Undo
@ingroup ToolManagerEtAl
*/
class MITKDATATYPESEXT_EXPORT ApplyDiffImageOperation : public Operation
{
protected:
void OnImageDeleted();
Image *m_Image;
unsigned int m_SliceIndex;
unsigned int m_SliceDimension;
unsigned int m_TimeStep;
double m_Factor;
bool m_ImageStillValid;
unsigned long m_DeleteTag;
CompressedImageContainer::Pointer zlibContainer;
public:
/**
Pass only 2D images here.
+ \param operationType
+ \param image
+ \param diffImage
+ \param timeStep
\param sliceIndex brief Which slice to extract (first one has index 0).
\param sliceDimension Number of the dimension which is constant for all pixels of the desired slice (e.g. 0 for
axial)
*/
ApplyDiffImageOperation(OperationType operationType,
Image *image,
Image *diffImage,
unsigned int timeStep = 0,
unsigned int sliceDimension = 2,
unsigned int sliceIndex = 0);
~ApplyDiffImageOperation() override;
// Unfortunately cannot use itkGet/SetMacros here, since Operation does not inherit itk::Object
unsigned int GetSliceIndex() { return m_SliceIndex; }
unsigned int GetSliceDimension() { return m_SliceDimension; }
unsigned int GetTimeStep() { return m_TimeStep; }
void SetFactor(double factor) { m_Factor = factor; }
double GetFactor() { return m_Factor; }
Image *GetImage() { return m_Image; }
Image::Pointer GetDiffImage();
bool IsImageStillValid() { return m_ImageStillValid; }
};
} // namespace mitk
#endif
diff --git a/Modules/DataTypesExt/include/mitkCellOperation.h b/Modules/DataTypesExt/include/mitkCellOperation.h
index 24c08df4b5..87aa1a48c0 100644
--- a/Modules/DataTypesExt/include/mitkCellOperation.h
+++ b/Modules/DataTypesExt/include/mitkCellOperation.h
@@ -1,51 +1,50 @@
/*============================================================================
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 MITKCELLOPERATION_H_INCLUDED
#define MITKCELLOPERATION_H_INCLUDED
#include "MitkDataTypesExtExports.h"
#include "mitkCommon.h"
#include "mitkOperation.h"
#include "mitkVector.h"
namespace mitk
{
//##Documentation
//## @brief Operation, that holds everything necessary for an operation on a cell.
//##
//## @ingroup Undo
class MITKDATATYPESEXT_EXPORT CellOperation : public Operation
{
public:
mitkClassMacro(CellOperation, Operation);
//##Documentation
//##@brief constructor
//##
- //## @param
- //## operationType is the type of that operation (see mitkOperation.h; e.g. move or add; Information for
- //StateMachine::ExecuteOperation());
- //## cellId: Id of the cell and a vector if needed
+ //## @param operationType is the type of that operation (see mitkOperation.h; e.g. move or add; Information for StateMachine::ExecuteOperation());
+ //## @param cellId Id of the cell and a vector if needed
+ //## @param vector
CellOperation(OperationType operationType, int cellId, Vector3D vector);
CellOperation(OperationType operationType, int cellId);
~CellOperation() override{};
int GetCellId() { return m_CellId; };
Vector3D GetVector() { return m_Vector; };
protected:
int m_CellId;
Vector3D m_Vector;
};
} // namespace mitk
#endif /* MITKCELLOPERATION_H_INCLUDED*/
diff --git a/Modules/DataTypesExt/include/mitkLabeledImageLookupTable.h b/Modules/DataTypesExt/include/mitkLabeledImageLookupTable.h
index f30b6f1d5a..fd3f5630a5 100644
--- a/Modules/DataTypesExt/include/mitkLabeledImageLookupTable.h
+++ b/Modules/DataTypesExt/include/mitkLabeledImageLookupTable.h
@@ -1,112 +1,112 @@
/*============================================================================
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 MITKMITKLABELEDIMAGELOOKUPTABLE_H
#define MITKMITKLABELEDIMAGELOOKUPTABLE_H
#include "MitkDataTypesExtExports.h"
#include "mitkLevelWindow.h"
#include "mitkLookupTable.h"
#include <iostream>
#include <string>
namespace mitk
{
/**
* A lookup table for 2D mapping of labeled images. The lookup table supports
* images with up to 256 unsigned labels. Negative labels are not supported.
* Please use the level/window settings as given by the GetLevelWindow() method
* to make sure, that the colors are rendered correctly.
* The colors are initialized with random colors as default. As background
* the label 0 is assumed. The color for the background is set to fully transparent
* as default.
*/
class MITKDATATYPESEXT_EXPORT LabeledImageLookupTable : public LookupTable
{
public:
/**
* Standard mitk typedefs are generated by the mitkClassMacro
*/
mitkClassMacro(LabeledImageLookupTable, LookupTable);
/**
- * Make this object constructable by the ::New() Method.
+ * Make this object constructable by the ::%New() Method.
*/
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**
* The data type for a label. Currently only images with labels
* in the range [0,255] are supported.
*/
typedef unsigned char LabelType;
LabeledImageLookupTable &operator=(const LookupTable &other) override;
/**
* Sets the color for a given label
* @param label The pixel value used as a label in the image
* @param r The red component of the rgba color value. Values sould be given in the range [0,1]
* @param g The green component of the rgba color value. Values sould be given in the range [0,1]
* @param b The blue component of the rgba color value. Values sould be given in the range [0,1]
* @param a The alpha component of the rgba color value. Values sould be given in the range [0,1]. Default is 1.
*/
virtual void SetColorForLabel(
const LabelType &label, const double &r, const double &g, const double &b, const double a = 1.0);
/**
* Determines the color which will be used for coloring a given label.
* @param label the label for which the color should be returned
* @returns an rgba array containing the color information for the given label.
* Color components are expressed as [0,1] double values.
*/
virtual double *GetColorForLabel(const LabelType &label);
/**
* Provides access to level window settings, which should be used
* in combination with the LUTs generated by this filter (at lease for
* 2D visualization. If you use other level/window settings, it is not
* guaranteed, that scalar values are mapped to the correct colors.
*/
mitk::LevelWindow GetLevelWindow() { return m_LevelWindow; }
protected:
/**
* Default constructor. Protected to prevent "normal" creation
*/
LabeledImageLookupTable();
LabeledImageLookupTable(const LabeledImageLookupTable &other);
/**
* Virtual destructor
*/
~LabeledImageLookupTable() override;
/**
* Generates a random rgb color value. Values for rgb are in the range
* [0,1]
*/
virtual void GenerateRandomColor(double &r, double &g, double &b);
/**
* Generates a radnom number drawn from a uniform
* distribution in the range [0,1].
*/
virtual double GenerateRandomNumber();
mitk::LevelWindow m_LevelWindow;
private:
itk::LightObject::Pointer InternalClone() const override;
};
}
#endif
diff --git a/Modules/DataTypesExt/include/mitkLineOperation.h b/Modules/DataTypesExt/include/mitkLineOperation.h
index cee666c7ec..6b486d19d8 100644
--- a/Modules/DataTypesExt/include/mitkLineOperation.h
+++ b/Modules/DataTypesExt/include/mitkLineOperation.h
@@ -1,57 +1,55 @@
/*============================================================================
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 MITKLINEOPERATION_H_INCLUDED
#define MITKLINEOPERATION_H_INCLUDED
#include "MitkDataTypesExtExports.h"
#include "mitkCellOperation.h"
#include "mitkCommon.h"
namespace mitk
{
- //##Documentation
- //## @brief Operation, that holds everything necessary for an operation on a line.
- //##
- //## Stores everything for de-/ selecting, inserting , moving and removing a line.
- //## @ingroup Undo
+ /** @brief Operation, that holds everything necessary for an operation on a line.
+ * Stores everything for de-/ selecting, inserting , moving and removing a line.
+ * @ingroup Undo
+ */
class MITKDATATYPESEXT_EXPORT LineOperation : public mitk::CellOperation
{
public:
mitkClassMacro(LineOperation, CellOperation);
- //##Documentation
- //##@brief constructor.
- //##
- //## @param operationType is the type of that operation (see mitkOperation.h; e.g. move or add; Information for
- //StateMachine::ExecuteOperation());
- //## @param cellId Id of the cell
- //## @param vector is for movement
- //## @param pIdA and pIdB are Id's of two points
- //## @param id is the Id of a line in a cell
+ /** @brief constructor.
+ * @param operationType is the type of that operation (see mitkOperation.h; e.g. move or add; Information for StateMachine::ExecuteOperation());
+ * @param cellId Id of the cell
+ * @param vector is for movement
+ * @param pIdA and pIdB are Id's of two points
+ * @param pIdB
+ * @param id is the Id of a line in a cell
+ */
LineOperation(OperationType operationType, int cellId, Vector3D vector, int pIdA = -1, int pIdB = -1, int id = -1);
LineOperation(OperationType operationType, int cellId = -1, int pIdA = -1, int pIdB = -1, int id = -1);
~LineOperation() override{};
// int GetCellId();
int GetPIdA();
int GetPIdB();
int GetId();
protected:
// int m_CellId;
int m_PIdA;
int m_PIdB;
int m_Id;
};
} // namespace mitk
#endif /* MITKLINEOPERATION_H_INCLUDED*/
diff --git a/Modules/DataTypesExt/include/mitkMesh.h b/Modules/DataTypesExt/include/mitkMesh.h
deleted file mode 100644
index 215e71e648..0000000000
--- a/Modules/DataTypesExt/include/mitkMesh.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/*============================================================================
-
-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 MITKMESH_H_HEADER_INCLUDED
-#define MITKMESH_H_HEADER_INCLUDED
-
-#include "MitkDataTypesExtExports.h"
-#include "mitkPointSet.h"
-
-#include <itkPolygonCell.h>
-#include <vtkCellArray.h>
-#include <vtkFloatArray.h>
-#include <vtkPointData.h>
-#include <vtkPolyData.h>
-
-#include <vtkPoints.h>
-#include <vtkSystemIncludes.h>
-
-namespace mitk
-{
- /**
- * \brief DataStructure which stores a set of points (incl. pointdata) where
- * each point can be associated to an element of a cell.
- *
- * A mesh contains several cells that can be of different celltypes
- * (Line, Triangle, Polygone...). A cell is always closed. If a linestrip is
- * to be created, then declare several cells, each containing one line.
- *
- * The operations take care of the coherence. If a line is added to an
- * existing LineCell, then a TriangleCell is built with the old and the new
- * parameter (and so on). Deletion is done the opposite way.
- *
- * Example for inserting a line into a TriangleCell:
- * existing PIds ind the cell: 1, 2, 4;
- * inserting (2, 3) so that new PIds in Cell: 1, 2, 3, 4
- *
- * The cell is now of type QuadrilateralCell
- *
- * \ingroup Data
- */
- class MITKDATATYPESEXT_EXPORT Mesh : public PointSet
- {
- public:
- mitkClassMacro(Mesh, PointSet);
-
- itkFactorylessNewMacro(Self);
-
- itkCloneMacro(Self);
-
- typedef Superclass::DataType::CellType CellType;
- typedef CellType::CellAutoPointer CellAutoPointer;
- typedef Superclass::MeshTraits::CellTraits CellTraits;
- typedef CellTraits::PointIdConstIterator PointIdConstIterator;
- typedef CellTraits::PointIdIterator PointIdIterator;
- typedef DataType::CellDataContainer CellDataContainer;
- typedef DataType::CellDataContainerIterator CellDataIterator;
- typedef Superclass::DataType::CellsContainer::Iterator CellIterator;
- typedef Superclass::DataType::CellsContainer::ConstIterator ConstCellIterator;
- typedef itk::PolygonCell<CellType> PolygonType;
- typedef MeshType::CellType::MultiVisitor MeshMultiVisitor;
-
- /** \brief returns the current number of cells in the mesh */
- virtual unsigned long GetNumberOfCells(int t = 0);
-
- /** \brief returns the mesh */
- virtual const DataType *GetMesh(int t = 0) const;
-
- /** \brief returns the mesh */
- virtual DataType *GetMesh(int t = 0);
-
- void SetMesh(DataType *mesh, int t = 0);
-
- /** \brief checks if the given point is in a cell and returns that cellId.
- * Basicaly it searches lines and points that are hit.
- */
- virtual bool EvaluatePosition(Point3D point, unsigned long &cellId, float precision, int t = 0);
-
- /** \brief searches for the next new cellId and returns that id */
- unsigned long GetNewCellId(int t = 0);
-
- /** \brief returns the first cell that includes the given pointId */
- virtual int SearchFirstCell(unsigned long pointId, int t = 0);
-
- /** \brief searches for a line, that is hit by the given point.
- * Then returns the lineId and the cellId
- */
- virtual bool SearchLine(Point3D point, float distance, unsigned long &lineId, unsigned long &cellId, int t = 0);
-
- /** \brief searches a line according to the cellId and lineId and returns
- * the PointIds, that assign the line; if successful, then return
- * param = true;
- */
- virtual bool GetPointIds(unsigned long cellId, unsigned long lineId, int &idA, int &idB, int t = 0);
-
- /** \brief searches a selected cell and returns the id of that cell. If no
- * cell is found, then -1 is returned
- */
- virtual int SearchSelectedCell(int t = 0);
-
- /** \brief creates a BoundingBox and computes it with the given points of
- * the cell.
- *
- * Returns the BoundingBox != IsNull() if successful.
- */
- virtual DataType::BoundingBoxPointer GetBoundingBoxFromCell(unsigned long cellId, int t = 0);
-
- /** \brief executes the given Operation */
- void ExecuteOperation(Operation *operation) override;
-
- protected:
- Mesh();
- ~Mesh() override;
- };
-
-} // namespace mitk
-
-#endif /* MITKMESH_H_HEADER_INCLUDED */
diff --git a/Modules/DataTypesExt/include/mitkMeshUtil.h b/Modules/DataTypesExt/include/mitkMeshUtil.h
deleted file mode 100644
index a40c69cb20..0000000000
--- a/Modules/DataTypesExt/include/mitkMeshUtil.h
+++ /dev/null
@@ -1,1677 +0,0 @@
-/*============================================================================
-
-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 MITKMESHUTIL_H_INCLUDED
-#define MITKMESHUTIL_H_INCLUDED
-
-#if (_MSC_VER == 1200)
-#error MeshUtils currently not supported for MS Visual C++ 6.0. Sorry.
-#endif
-
-//#include <itkMesh.h>
-#include <itkCellInterface.h>
-#include <itkLineCell.h>
-#include <itkPolygonCell.h>
-#include <itkQuadrilateralCell.h>
-#include <itkTriangleCell.h>
-//#include <itkDefaultDynamicMeshTraits.h>
-#include <itkSphereMeshSource.h>
-//#include <itkTransformMeshFilter.h>
-//#include <itkTranslationTransform.h>
-//#include <itkMinimumMaximumImageCalculator.h>
-#include <itkAutomaticTopologyMeshSource.h>
-#include <itkRegularSphereMeshSource.h>
-#include <vnl/vnl_cross.h>
-
-#include <vtkActor.h>
-#include <vtkCellArray.h>
-#include <vtkCellData.h>
-#include <vtkFloatArray.h>
-#include <vtkPointData.h>
-#include <vtkPoints.h>
-#include <vtkPolyData.h>
-#include <vtkProperty.h>
-#include <vtkUnstructuredGrid.h>
-
-#include <mitkBaseGeometry.h>
-#include <mitkSurface.h>
-
-template <typename MeshType>
-class NullScalarAccessor
-{
-public:
- static inline double GetPointScalar(typename MeshType::PointDataContainer * /*pointData*/,
- typename MeshType::PointIdentifier /*idx*/,
- MeshType * /*mesh*/ = nullptr,
- unsigned int /*type*/ = 0)
- {
- return (double)0.0;
- };
-
- static inline double GetCellScalar(typename MeshType::CellDataContainer * /*cellData*/,
- typename MeshType::CellIdentifier /*idx*/,
- MeshType * /*mesh*/ = nullptr,
- unsigned int /*type*/ = 0)
- {
- return (double)0.0;
- };
-};
-
-template <typename MeshType>
-class MeshScalarAccessor
-{
-public:
- static inline double GetPointScalar(typename MeshType::PointDataContainer *pointData,
- typename MeshType::PointIdentifier idx,
- MeshType * /*mesh*/ = nullptr,
- unsigned int /*type*/ = 0)
- {
- return (double)pointData->GetElement(idx);
- };
-
- static inline double GetCellScalar(typename MeshType::CellDataContainer *cellData,
- typename MeshType::CellIdentifier idx,
- MeshType * /*mesh*/ = nullptr,
- unsigned int /*type*/ = 0)
- {
- return (double)cellData->GetElement(idx);
- };
-};
-
-template <typename MeshType>
-class MeanCurvatureAccessor : public NullScalarAccessor<MeshType>
-{
-public:
- static inline double GetPointScalar(typename MeshType::PointDataContainer * /*point*/,
- typename MeshType::PointIdentifier idx,
- MeshType *mesh,
- unsigned int /*type*/ = 0)
- {
- typename MeshType::PixelType dis = 0;
- mesh->GetPointData(idx, &dis);
- return (double)dis;
- };
-};
-
-template <typename MeshType>
-class SimplexMeshAccessor : public NullScalarAccessor<MeshType>
-{
-public:
- static inline double GetPointScalar(typename MeshType::PointDataContainer * /*point*/,
- typename MeshType::PointIdentifier idx,
- MeshType *mesh,
- unsigned int type = 0)
- {
- typename MeshType::GeometryMapPointer geometryData = mesh->GetGeometryData();
-
- if (type == 0)
- {
- double val = mesh->GetMeanCurvature(idx);
- mesh->SetPointData(idx, val);
- return val;
- }
- else if (type == 1)
- {
- double val = geometryData->GetElement(idx)->meanTension;
- mesh->SetPointData(idx, val);
- return val;
- }
- else if (type == 2)
- {
- double val = geometryData->GetElement(idx)->externalForce.GetNorm();
- mesh->SetPointData(idx, val);
- return val;
- }
- else if (type == 3)
- return geometryData->GetElement(idx)->internalForce.GetNorm();
- else if (type == 4)
- return geometryData->GetElement(idx)->externalForce.GetNorm() * mesh->GetDistance(idx);
- else if (type == 5)
- {
- typename MeshType::PixelType dis = 0;
- mesh->GetPointData(idx, &dis);
- return (double)dis;
- }
- else if (type == 6)
- {
- return (double)((geometryData->GetElement(idx))->allowSplitting);
- }
- else
- return (double)0;
- };
-};
-
-/*!
-\brief The class provides mehtods for ITK - VTK mesh conversion
-*
-* \todo document the inner class
-* \todo maybe inner class should be moved out
-*/
-
-template <typename MeshType, class ScalarAccessor = NullScalarAccessor<MeshType>>
-class MeshUtil
-{
- /*!
- \brief A visitor to create VTK cells by means of a class
- defining the InsertImplementation interface
-
- The InsertImplementation interface defines the methods
- \code
- void InsertLine(vtkIdType *pts);
- void InsertTriangle(vtkIdType *pts);
- void InsertPolygon(vtkIdType npts, vtkIdType *pts);
- void InsertQuad(vtkIdType *pts);
- void InsertTetra(vtkIdType *pts);
- void InsertHexahedron(vtkIdType *pts);
- \endcode
-
- This class calls the appropriate insert-method of the
- InsertImplementation according to the cell type of
- the visited cell \em and its actual contents: e.g.,
- for a polygon cell with just two points, a line will
- be created by calling InsertLine.
- \sa ExactSwitchByCellType
- \sa SingleCellArrayInsertImplementation
- \sa DistributeInsertImplementation
- */
- template <class InsertImplementation>
- class SwitchByCellType : public InsertImplementation
- {
- // typedef the itk cells we are interested in
- typedef typename itk::CellInterface<typename MeshType::CellPixelType, typename MeshType::CellTraits>
- CellInterfaceType;
- typedef itk::LineCell<CellInterfaceType> floatLineCell;
- typedef itk::TriangleCell<CellInterfaceType> floatTriangleCell;
- typedef itk::PolygonCell<CellInterfaceType> floatPolygonCell;
- typedef itk::QuadrilateralCell<CellInterfaceType> floatQuadrilateralCell;
- typedef itk::TetrahedronCell<CellInterfaceType> floatTetrahedronCell;
- typedef itk::HexahedronCell<CellInterfaceType> floatHexahedronCell;
- typedef typename CellInterfaceType::PointIdConstIterator PointIdIterator;
-
- public:
- /*!
- Visit a line and create the VTK_LINE cell
- */
- void Visit(unsigned long cellId, floatLineCell *t)
- {
- vtkIdType pts[2];
- int i = 0;
- unsigned long num = t->GetNumberOfVertices();
- vtkIdType vtkCellId = -1;
- if (num == 2)
- { // useless because itk::LineCell always returns 2
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- vtkCellId = this->InsertLine((vtkIdType *)pts);
- }
-
- if (this->m_UseCellScalarAccessor && vtkCellId >= 0)
- {
- this->m_CellScalars->InsertTuple1(vtkCellId, ScalarAccessor::GetCellScalar(this->m_CellData, cellId));
- }
- }
-
- /*!
- Visit a polygon and create the VTK_POLYGON cell
- */
- void Visit(unsigned long cellId, floatPolygonCell *t)
- {
- vtkIdType pts[4096];
- int i = 0;
- unsigned long num = t->GetNumberOfVertices();
- vtkIdType vtkCellId = -1;
- if (num > 4096)
- {
- MITK_ERROR << "Problem in mitkMeshUtil: Polygon with more than maximum number of vertices encountered."
- << std::endl;
- }
- else if (num > 3)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- vtkCellId = this->InsertPolygon(num, (vtkIdType *)pts);
- }
- else if (num == 3)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- vtkCellId = this->InsertTriangle((vtkIdType *)pts);
- }
- else if (num == 2)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- vtkCellId = this->InsertLine((vtkIdType *)pts);
- }
-
- if (this->m_UseCellScalarAccessor && vtkCellId >= 0)
- {
- this->m_CellScalars->InsertTuple1(vtkCellId, ScalarAccessor::GetCellScalar(this->m_CellData, cellId));
- }
- }
-
- /*!
- Visit a triangle and create the VTK_TRIANGLE cell
- */
- void Visit(unsigned long cellId, floatTriangleCell *t)
- {
- vtkIdType pts[3];
- int i = 0;
- unsigned long num = t->GetNumberOfVertices();
- vtkIdType vtkCellId = -1;
- if (num == 3)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- vtkCellId = this->InsertTriangle((vtkIdType *)pts);
- }
- else if (num == 2)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- vtkCellId = this->InsertLine((vtkIdType *)pts);
- }
-
- if (this->m_UseCellScalarAccessor && vtkCellId >= 0)
- {
- this->m_CellScalars->InsertTuple1(vtkCellId, ScalarAccessor::GetCellScalar(this->m_CellData, cellId));
- }
- }
-
- /*!
- Visit a quad and create the VTK_QUAD cell
- */
- void Visit(unsigned long cellId, floatQuadrilateralCell *t)
- {
- vtkIdType pts[4];
- int i = 0;
- unsigned long num = t->GetNumberOfVertices();
- vtkIdType vtkCellId = -1;
- if (num == 4)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- {
- if (i == 2)
- pts[3] = *it;
- else if (i == 3)
- pts[2] = *it;
- else
- pts[i] = *it;
- i++;
- // pts[i++] = *it;
- }
- vtkCellId = this->InsertQuad((vtkIdType *)pts);
- }
- else if (num == 3)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- vtkCellId = this->InsertTriangle((vtkIdType *)pts);
- }
- else if (num == 2)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- vtkCellId = this->InsertLine((vtkIdType *)pts);
- }
-
- if (this->m_UseCellScalarAccessor && vtkCellId >= 0)
- {
- this->m_CellScalars->InsertTuple1(vtkCellId, ScalarAccessor::GetCellScalar(this->m_CellData, cellId));
- }
- }
-
- /*!
- Visit a tetrahedra and create the VTK_TETRA cell
- */
- void Visit(unsigned long cellId, floatTetrahedronCell *t)
- {
- vtkIdType pts[4];
- int i = 0;
- unsigned long num = t->GetNumberOfVertices();
- vtkIdType vtkCellId = -1;
- if (num == 4)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- vtkCellId = this->InsertTetra((vtkIdType *)pts);
- }
- else if (num == 3)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- vtkCellId = this->InsertTriangle((vtkIdType *)pts);
- }
- else if (num == 2)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- vtkCellId = this->InsertLine((vtkIdType *)pts);
- }
-
- if (this->m_UseCellScalarAccessor && vtkCellId >= 0)
- {
- this->m_CellScalars->InsertTuple1(vtkCellId, ScalarAccessor::GetCellScalar(this->m_CellData, cellId));
- }
- }
-
- /*!
- Visit a hexahedron and create the VTK_HEXAHEDRON cell
- */
- void Visit(unsigned long cellId, floatHexahedronCell *t)
- {
- vtkIdType pts[8];
- int i = 0;
- unsigned long num = t->GetNumberOfVertices();
- vtkIdType vtkCellId = -1;
- if (num == 8)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- {
- if (i == 2)
- pts[i++] = *(it + 1);
- else if (i == 3)
- pts[i++] = *(it - 1);
- else if (i == 6)
- pts[i++] = *(it + 1);
- else if (i == 7)
- pts[i++] = *(it - 1);
- else
- pts[i++] = *it;
- }
- vtkCellId = this->InsertHexahedron((vtkIdType *)pts);
- }
- else if (num == 4)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- vtkCellId = this->InsertQuad((vtkIdType *)pts);
- }
- else if (num == 3)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- vtkCellId = this->InsertTriangle((vtkIdType *)pts);
- }
- else if (num == 2)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- vtkCellId = this->InsertLine((vtkIdType *)pts);
- }
-
- if (this->m_UseCellScalarAccessor && vtkCellId >= 0)
- {
- this->m_CellScalars->InsertTuple1(vtkCellId, ScalarAccessor::GetCellScalar(this->m_CellData, cellId));
- }
- }
- };
-
- /*!
- \brief A visitor similar to SwitchByCellType, but with
- exact matching of cell types
-
- Works as described in SwitchByCellType, but does exact
- matching of cell types, e.g., for a polygon cell with just
- two points, \em no insert-method will be called, because
- a polygon must have at least three points.
- \sa SwitchByCellType
- \sa SingleCellArrayInsertImplementation
- \sa DistributeInsertImplementation
- */
- template <class InsertImplementation>
- class ExactSwitchByCellType : public InsertImplementation
- {
- // typedef the itk cells we are interested in
- typedef typename itk::CellInterface<typename MeshType::CellPixelType, typename MeshType::CellTraits>
- CellInterfaceType;
- typedef itk::LineCell<CellInterfaceType> floatLineCell;
- typedef itk::TriangleCell<CellInterfaceType> floatTriangleCell;
- typedef itk::PolygonCell<CellInterfaceType> floatPolygonCell;
- typedef itk::QuadrilateralCell<CellInterfaceType> floatQuadrilateralCell;
- typedef itk::TetrahedronCell<CellInterfaceType> floatTetrahedronCell;
- typedef itk::HexahedronCell<CellInterfaceType> floatHexahedronCell;
- typedef typename CellInterfaceType::PointIdConstIterator PointIdIterator;
-
- public:
- /*!
- Visit a line and create the VTK_LINE cell
- */
- void Visit(unsigned long, floatLineCell *t)
- {
- unsigned long num = t->GetNumberOfVertices();
- vtkIdType pts[2];
- int i = 0;
-
- if (num == 2)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- this->InsertLine(pts);
- }
- }
-
- /*!
- Visit a polygon and create the VTK_POLYGON cell
- */
- void Visit(unsigned long, floatPolygonCell *t)
- {
- vtkIdType pts[4096];
- unsigned long num = t->GetNumberOfVertices();
- if (num > 4096)
- {
- MITK_ERROR << "Problem in mitkMeshUtil: Polygon with more than maximum number of vertices encountered."
- << std::endl;
- }
- int i = 0;
-
- if (num > 3)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- this->InsertPolygon(num, pts);
- }
- }
-
- /*!
- Visit a triangle and create the VTK_TRIANGLE cell
- */
- void Visit(unsigned long, floatTriangleCell *t)
- {
- unsigned long num = t->GetNumberOfVertices();
- vtkIdType pts[3];
- int i = 0;
-
- if (num == 3)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- this->InsertTriangle(pts);
- }
- }
-
- /*!
- Visit a quadrilateral and create the VTK_QUAD cell
- */
- void Visit(unsigned long, floatQuadrilateralCell *t)
- {
- unsigned long num = t->GetNumberOfVertices();
- vtkIdType pts[4];
- int i = 0;
-
- if (num == 4)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
-
- vtkIdType tmpId = pts[2];
- pts[2] = pts[3];
- pts[3] = tmpId;
- this->InsertQuad(pts);
- }
- }
-
- /*!
- Visit a tetrahedron and create the VTK_TETRA cell
- */
- void Visit(unsigned long, floatTetrahedronCell *t)
- {
- unsigned long num = t->GetNumberOfVertices();
-
- vtkIdType pts[4];
- int i = 0;
-
- if (num == 4)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
- this->InsertTetra(pts);
- }
- }
-
- /*!
- Visit a hexahedron and create the VTK_HEXAHEDRON cell
- */
- void Visit(unsigned long, floatHexahedronCell *t)
- {
- unsigned long num = t->GetNumberOfVertices();
- vtkIdType pts[8];
- int i = 0;
-
- if (num == 8)
- {
- for (PointIdIterator it = t->PointIdsBegin(); it != t->PointIdsEnd(); it++)
- pts[i++] = *it;
-
- vtkIdType tmp[8];
- for (unsigned int i = 0; i < 8; i++)
- tmp[i] = pts[i];
- pts[2] = tmp[3];
- pts[3] = tmp[2];
- pts[6] = tmp[7];
- pts[7] = tmp[6];
- this->InsertHexahedron(pts);
- }
- }
- };
-
- /*!
- \brief Implementation of the InsertImplementation interface of
- SwitchByCellType to define a visitor that create cells
- according to their types and put them in a single
- vtkCellArray (for vtkUnstructuredGrid construction)
- */
- class SingleCellArrayInsertImplementation
- {
- vtkCellArray *m_Cells;
- int *m_TypeArray;
- // vtkIdType cellId;
-
- protected:
- bool m_UseCellScalarAccessor;
- vtkFloatArray *m_CellScalars;
- typename MeshType::CellDataContainer::Pointer m_CellData;
-
- public:
- SingleCellArrayInsertImplementation() : m_UseCellScalarAccessor(false) {}
- /*! Set the vtkCellArray that will be constructed
- */
- void SetCellArray(vtkCellArray *cells) { m_Cells = cells; }
- /*!
- Set the type array for storing the vtk cell types
- */
- void SetTypeArray(int *i) { m_TypeArray = i; }
- void SetUseCellScalarAccessor(bool flag) { m_UseCellScalarAccessor = flag; }
- void SetCellScalars(vtkFloatArray *scalars) { m_CellScalars = scalars; }
- vtkFloatArray *GetCellScalars() { return m_CellScalars; }
- void SetMeshCellData(typename MeshType::CellDataContainer *data) { m_CellData = data; }
- vtkIdType InsertLine(vtkIdType *pts)
- {
- vtkIdType cellId = m_Cells->InsertNextCell(2, pts);
- m_TypeArray[cellId] = VTK_LINE;
- return cellId;
- }
-
- vtkIdType InsertTriangle(vtkIdType *pts)
- {
- vtkIdType cellId = m_Cells->InsertNextCell(3, pts);
- m_TypeArray[cellId] = VTK_TRIANGLE;
- return cellId;
- }
-
- vtkIdType InsertPolygon(vtkIdType npts, vtkIdType *pts)
- {
- vtkIdType cellId = m_Cells->InsertNextCell(npts, pts);
- m_TypeArray[cellId] = VTK_POLYGON;
- return cellId;
- }
-
- vtkIdType InsertQuad(vtkIdType *pts)
- {
- vtkIdType cellId = m_Cells->InsertNextCell(4, pts);
- m_TypeArray[cellId] = VTK_QUAD;
- return cellId;
- }
-
- vtkIdType InsertTetra(vtkIdType *pts)
- {
- vtkIdType cellId = m_Cells->InsertNextCell(4, pts);
- m_TypeArray[cellId] = VTK_TETRA;
- return cellId;
- }
-
- vtkIdType InsertHexahedron(vtkIdType *pts)
- {
- vtkIdType cellId = m_Cells->InsertNextCell(8, pts);
- m_TypeArray[cellId] = VTK_HEXAHEDRON;
- return cellId;
- }
- };
-
- /*!
- \brief Implementation of the InsertImplementation interface of
- SwitchByCellType to define a visitor that distributes cells
- according to their types (for vtkPolyData construction)
- */
- class DistributeInsertImplementation
- {
- vtkCellArray *m_LineCells;
- vtkCellArray *m_TriangleCells;
- vtkCellArray *m_PolygonCells;
- vtkCellArray *m_QuadCells;
-
- protected:
- bool m_UseCellScalarAccessor;
- vtkFloatArray *m_CellScalars;
- typename MeshType::CellDataContainer::Pointer m_CellData;
-
- public:
- DistributeInsertImplementation() : m_UseCellScalarAccessor(false) {}
- /*! Set the vtkCellArray that will be constructed
- */
- void SetCellArrays(vtkCellArray *lines, vtkCellArray *triangles, vtkCellArray *polygons, vtkCellArray *quads)
- {
- m_LineCells = lines;
- m_TriangleCells = triangles;
- m_PolygonCells = polygons;
- m_QuadCells = quads;
- }
-
- vtkIdType InsertLine(vtkIdType *pts) { return m_LineCells->InsertNextCell(2, pts); }
- vtkIdType InsertTriangle(vtkIdType *pts) { return m_TriangleCells->InsertNextCell(3, pts); }
- vtkIdType InsertPolygon(vtkIdType npts, vtkIdType *pts) { return m_PolygonCells->InsertNextCell(npts, pts); }
- vtkIdType InsertQuad(vtkIdType *pts) { return m_QuadCells->InsertNextCell(4, pts); }
- vtkIdType InsertTetra(vtkIdType * /*pts*/) { return -1; } // ignored
- vtkIdType InsertHexahedron(vtkIdType * /*pts*/) { return -1; } // ignored
- };
-
- // typedef typename MeshType::CellType CellType;
- // typedef typename itk::LineCell< CellType > LineType;
- // typedef typename itk::PolygonCell< CellType > PolygonType;
- // typedef typename itk::TriangleCell< CellType > TriangleType;
-
- typedef SwitchByCellType<SingleCellArrayInsertImplementation> SingleCellArrayUserVisitorType;
- typedef SwitchByCellType<DistributeInsertImplementation> DistributeUserVisitorType;
- typedef ExactSwitchByCellType<DistributeInsertImplementation> ExactUserVisitorType;
-
-public:
- typedef itk::MatrixOffsetTransformBase<typename MeshType::CoordRepType, 3, 3> ITKTransformType;
- typedef itk::MatrixOffsetTransformBase<mitk::ScalarType, 3, 3> MITKTransformType;
-
- /*!
- Convert a MITK transformation to an ITK transformation
- Necessary because ITK uses double and MITK uses float values
- */
- static void ConvertTransformToItk(const MITKTransformType *mitkTransform, ITKTransformType *itkTransform)
- {
- typename MITKTransformType::MatrixType mitkM = mitkTransform->GetMatrix();
- typename ITKTransformType::MatrixType itkM;
-
- typename MITKTransformType::OffsetType mitkO = mitkTransform->GetOffset();
- typename ITKTransformType::OffsetType itkO;
-
- for (short i = 0; i < 3; ++i)
- {
- for (short j = 0; j < 3; ++j)
- {
- itkM[i][j] = (double)mitkM[i][j];
- }
- itkO[i] = (double)mitkO[i];
- }
-
- itkTransform->SetMatrix(itkM);
- itkTransform->SetOffset(itkO);
- }
-
- /*!
- create an itkMesh object from a vtkPolyData
- */
- static typename MeshType::Pointer MeshFromPolyData(vtkPolyData *poly,
- mitk::BaseGeometry *geometryFrame = nullptr,
- mitk::BaseGeometry *polyDataGeometryFrame = nullptr)
- {
- // Create a new mesh
- typename MeshType::Pointer output = MeshType::New();
- output->SetCellsAllocationMethod(MeshType::CellsAllocatedDynamicallyCellByCell);
-
- typedef typename MeshType::CellDataContainer MeshCellDataContainerType;
-
- output->SetCellData(MeshCellDataContainerType::New());
-
- // Get the points from vtk
- vtkPoints *vtkpoints = poly->GetPoints();
- const unsigned int numPoints = poly->GetNumberOfPoints();
-
- // Create a compatible point container for the mesh
- // the mesh is created with a null points container
- // MeshType::PointsContainer::Pointer points =
- // MeshType::PointsContainer::New();
- // // Resize the point container to be able to fit the vtk points
- // points->Reserve(numPoints);
- // // Set the point container on the mesh
- // output->SetPoints(points);
- double vtkpoint[3];
- typename MeshType::PointType itkPhysicalPoint;
- if (geometryFrame == nullptr)
- {
- if (polyDataGeometryFrame == nullptr)
- {
- for (unsigned int i = 0; i < numPoints; ++i)
- {
- vtkpoints->GetPoint(i, vtkpoint);
- // MITK_INFO << "next point: " << test[0]<< "," << test[1] << "," << test[2] << std::endl;
- // typename MeshType::PixelType* apoint = (typename MeshType::PixelType*) vtkpoints->GetPoint(i);
- mitk::vtk2itk(vtkpoint, itkPhysicalPoint);
- output->SetPoint(i, itkPhysicalPoint);
- }
- }
- else
- {
- for (unsigned int i = 0; i < numPoints; ++i)
- {
- vtkpoints->GetPoint(i, vtkpoint);
- // MITK_INFO << "next point: " << test[0]<< "," << test[1] << "," << test[2] << std::endl;
- // typename MeshType::PixelType* apoint = (typename MeshType::PixelType*) vtkpoints->GetPoint(i);
- mitk::Point3D mitkWorldPoint;
- mitk::vtk2itk(vtkpoint, mitkWorldPoint);
- polyDataGeometryFrame->IndexToWorld(mitkWorldPoint, mitkWorldPoint);
- mitk::vtk2itk(mitkWorldPoint, itkPhysicalPoint);
- output->SetPoint(i, itkPhysicalPoint);
- }
- }
- }
- else
- {
- mitk::Point3D mitkWorldPoint;
- if (polyDataGeometryFrame == nullptr)
- {
- for (unsigned int i = 0; i < numPoints; ++i)
- {
- vtkpoints->GetPoint(i, vtkpoint);
- // MITK_INFO << "next point: " << test[0]<< "," << test[1] << "," << test[2] << std::endl;
- // typename MeshType::PixelType* apoint = (typename MeshType::PixelType*) vtkpoints->GetPoint(i);
- mitk::vtk2itk(vtkpoint, mitkWorldPoint);
- geometryFrame->WorldToItkPhysicalPoint(mitkWorldPoint, itkPhysicalPoint);
- output->SetPoint(i, itkPhysicalPoint);
- }
- }
- else
- {
- for (unsigned int i = 0; i < numPoints; ++i)
- {
- vtkpoints->GetPoint(i, vtkpoint);
- // MITK_INFO << "next point: " << test[0]<< "," << test[1] << "," << test[2] << std::endl;
- // typename MeshType::PixelType* apoint = (typename MeshType::PixelType*) vtkpoints->GetPoint(i);
- mitk::vtk2itk(vtkpoint, mitkWorldPoint);
- polyDataGeometryFrame->IndexToWorld(mitkWorldPoint, mitkWorldPoint);
- geometryFrame->WorldToItkPhysicalPoint(mitkWorldPoint, itkPhysicalPoint);
- output->SetPoint(i, itkPhysicalPoint);
- }
- }
- }
-
- vtkCellArray *vtkcells = poly->GetPolys();
- // vtkCellArray* vtkcells = poly->GetStrips();
- // MeshType::CellsContainerPointer cells = MeshType::CellsContainer::New();
- // output->SetCells(cells);
- // extract the cell id's from the vtkUnstructuredGrid
- int numcells = vtkcells->GetNumberOfCells();
- int *vtkCellTypes = new int[numcells];
- int cellId = 0;
- // poly ids start after verts and lines!
- int cellIdOfs = poly->GetNumberOfVerts() + poly->GetNumberOfLines();
- for (; cellId < numcells; cellId++)
- {
- vtkCellTypes[cellId] = poly->GetCellType(cellId + cellIdOfs);
- }
-
- // cells->Reserve(numcells);
- vtkIdType npts;
- vtkIdType *pts;
- cellId = 0;
-
- typedef typename MeshType::MeshTraits OMeshTraits;
- typedef typename OMeshTraits::PixelType OPixelType;
- typedef typename MeshType::CellTraits CellTraits;
- typedef typename itk::CellInterface<OPixelType, CellTraits> CellInterfaceType;
- typedef typename itk::TriangleCell<CellInterfaceType> TriCellType;
- typedef typename TriCellType::CellAutoPointer TriCellPointer;
-
- TriCellPointer newCell;
- output->GetCells()->Reserve(poly->GetNumberOfPolys() + poly->GetNumberOfStrips());
- output->GetCellData()->Reserve(poly->GetNumberOfPolys() + poly->GetNumberOfStrips());
-
- for (vtkcells->InitTraversal(); vtkcells->GetNextCell(npts, pts); cellId++)
- {
- switch (vtkCellTypes[cellId])
- {
- case VTK_TRIANGLE:
- {
- if (npts != 3)
- continue; // skip non-triangles;
- itk::IdentifierType pointIds[3];
- pointIds[0] = (unsigned long)pts[0];
- pointIds[1] = (unsigned long)pts[1];
- pointIds[2] = (unsigned long)pts[2];
-
- newCell.TakeOwnership(new TriCellType);
- newCell->SetPointIds(pointIds); //(unsigned long*)pts);
- output->SetCell(cellId, newCell);
- output->SetCellData(cellId, (typename MeshType::PixelType)3);
- break;
- }
-
- case VTK_QUAD:
- {
- if (npts != 4)
- continue; // skip non-quadrilateral
- itk::IdentifierType pointIds[3];
-
- pointIds[0] = (unsigned long)pts[0];
- pointIds[1] = (unsigned long)pts[1];
- pointIds[2] = (unsigned long)pts[2];
- newCell.TakeOwnership(new TriCellType);
- newCell->SetPointIds(pointIds);
- output->SetCell(cellId, newCell);
- output->SetCellData(cellId, (typename MeshType::PixelType)3);
- cellId++;
-
- pointIds[0] = (unsigned long)pts[2];
- pointIds[1] = (unsigned long)pts[3];
- pointIds[2] = (unsigned long)pts[0];
- newCell.TakeOwnership(new TriCellType);
- newCell->SetPointIds(pointIds);
- output->SetCell(cellId, newCell);
- output->SetCellData(cellId, (typename MeshType::PixelType)3);
- break;
- }
-
- case VTK_EMPTY_CELL:
- {
- if (npts != 3)
- {
- MITK_ERROR << "Only empty triangle cell supported by now..." << std::endl; // skip non-triangle empty cells;
- continue;
- }
- itk::IdentifierType pointIds[3];
- pointIds[0] = (unsigned long)pts[0];
- pointIds[1] = (unsigned long)pts[1];
- pointIds[2] = (unsigned long)pts[2];
-
- newCell.TakeOwnership(new TriCellType);
- newCell->SetPointIds(pointIds);
- output->SetCell(cellId, newCell);
- output->SetCellData(cellId, (typename MeshType::PixelType)3);
- break;
- }
-
- // case VTK_VERTEX: // If need to implement use
- // case VTK_POLY_VERTEX: // the poly->GetVerts() and
- // case VTK_LINE: // poly->GetLines() routines
- // case VTK_POLY_LINE: // outside of the switch..case.
- case VTK_POLYGON:
- case VTK_PIXEL:
- {
- if (npts != 4)
- continue; // skip non-quadrilateral
- itk::IdentifierType pointIds[3];
- for (unsigned int idx = 0; idx <= 1; idx++)
- {
- pointIds[0] = (unsigned long)pts[idx];
- pointIds[1] = (unsigned long)pts[idx + 1];
- pointIds[2] = (unsigned long)pts[idx + 2];
- newCell.TakeOwnership(new TriCellType);
- newCell->SetPointIds(pointIds);
- output->SetCell(cellId + idx, newCell);
- output->SetCellData(cellId + idx, (typename MeshType::PixelType)3);
- }
- cellId++;
- break;
- }
-
- case VTK_TETRA:
- case VTK_VOXEL:
- case VTK_HEXAHEDRON:
- case VTK_WEDGE:
- case VTK_PYRAMID:
- case VTK_PARAMETRIC_CURVE:
- case VTK_PARAMETRIC_SURFACE:
- default:
- MITK_WARN << "Warning, unhandled cell type " << vtkCellTypes[cellId] << std::endl;
- }
- }
-
- if (poly->GetNumberOfStrips() != 0)
- {
- vtkcells = poly->GetStrips();
- numcells = vtkcells->GetNumberOfCells();
- vtkCellTypes = new int[numcells];
- int stripId = 0;
- // strip ids start after verts, lines and polys!
- int stripIdOfs = poly->GetNumberOfVerts() + poly->GetNumberOfLines() + poly->GetNumberOfPolys();
- for (; stripId < numcells; stripId++)
- {
- vtkCellTypes[stripId] = poly->GetCellType(stripId + stripIdOfs);
- }
- stripId = 0;
-
- vtkcells->InitTraversal();
- while (vtkcells->GetNextCell(npts, pts))
- {
- if (vtkCellTypes[stripId] != VTK_TRIANGLE_STRIP)
- {
- MITK_ERROR << "Only triangle strips supported!" << std::endl;
- continue;
- }
- stripId++;
-
- unsigned int numberOfTrianglesInStrip = npts - 2;
- itk::IdentifierType pointIds[3];
- pointIds[0] = (unsigned long)pts[0];
- pointIds[1] = (unsigned long)pts[1];
- pointIds[2] = (unsigned long)pts[2];
-
- for (unsigned int t = 0; t < numberOfTrianglesInStrip; t++)
- {
- newCell.TakeOwnership(new TriCellType);
- newCell->SetPointIds(pointIds);
- output->SetCell(cellId, newCell);
- output->SetCellData(cellId, (typename MeshType::PixelType)3);
- cellId++;
- pointIds[0] = pointIds[1];
- pointIds[1] = pointIds[2];
- pointIds[2] = pts[t + 3];
- }
- }
- }
- // output->Print(std::cout);
- output->BuildCellLinks();
- delete[] vtkCellTypes;
- return output;
- }
-
- /*!
- create an itkMesh object from an mitk::Surface
- */
- static typename MeshType::Pointer MeshFromSurface(mitk::Surface *surface, mitk::BaseGeometry *geometryFrame = nullptr)
- {
- if (surface == nullptr)
- return nullptr;
- return MeshFromPolyData(surface->GetVtkPolyData(), geometryFrame, surface->GetGeometry());
- }
-
- /*!
- create an vtkUnstructuredGrid object from an itkMesh
- */
- static vtkUnstructuredGrid *MeshToUnstructuredGrid(MeshType *mesh,
- bool usePointScalarAccessor = false,
- bool useCellScalarAccessor = false,
- unsigned int pointDataType = 0,
- mitk::BaseGeometry *geometryFrame = nullptr)
- {
- /*!
- default SingleCellArray line cell visitior definition
- */
- typedef typename itk::CellInterfaceVisitorImplementation<typename MeshType::CellPixelType,
- typename MeshType::CellTraits,
- itk::LineCell<typename MeshType::CellType>,
- SingleCellArrayUserVisitorType>
- SingleCellArrayLineVisitor;
-
- /*!
- default SingleCellArray polygon cell visitior definition
- */
- typedef typename itk::CellInterfaceVisitorImplementation<typename MeshType::CellPixelType,
- typename MeshType::CellTraits,
- itk::PolygonCell<typename MeshType::CellType>,
- SingleCellArrayUserVisitorType>
- SingleCellArrayPolygonVisitor;
-
- /*!
- default SingleCellArray triangle cell visitior definition
- */
- typedef typename itk::CellInterfaceVisitorImplementation<
- typename MeshType::CellPixelType,
- typename MeshType::CellTraits,
- itk::TriangleCell<itk::CellInterface<typename MeshType::CellPixelType, typename MeshType::CellTraits>>,
- SingleCellArrayUserVisitorType>
- SingleCellArrayTriangleVisitor;
-
- /*!
- default SingleCellArray quad cell visitior definition
- */
- typedef typename itk::CellInterfaceVisitorImplementation<
- typename MeshType::CellPixelType,
- typename MeshType::CellTraits,
- itk::QuadrilateralCell<itk::CellInterface<typename MeshType::CellPixelType, typename MeshType::CellTraits>>,
- SingleCellArrayUserVisitorType>
- SingleCellArrayQuadrilateralVisitor;
-
- /*!
- default SingleCellArray tetra cell visitior definition
- */
- typedef typename itk::CellInterfaceVisitorImplementation<
- typename MeshType::CellPixelType,
- typename MeshType::CellTraits,
- itk::TetrahedronCell<itk::CellInterface<typename MeshType::CellPixelType, typename MeshType::CellTraits>>,
- SingleCellArrayUserVisitorType>
- SingleCellArrayTetrahedronVisitor;
-
- /*!
- default SingleCellArray hex cell visitior definition
- */
- typedef typename itk::CellInterfaceVisitorImplementation<
- typename MeshType::CellPixelType,
- typename MeshType::CellTraits,
- itk::HexahedronCell<itk::CellInterface<typename MeshType::CellPixelType, typename MeshType::CellTraits>>,
- SingleCellArrayUserVisitorType>
- SingleCellArrayHexahedronVisitor;
-
- // Get the number of points in the mesh
- int numPoints = mesh->GetNumberOfPoints();
- if (numPoints == 0)
- {
- // mesh->Print(std::cerr);
- MITK_FATAL << "no points in Grid " << std::endl;
- exit(-1);
- }
- // Create a vtkUnstructuredGrid
- vtkUnstructuredGrid *vgrid = vtkUnstructuredGrid::New();
- // Create the vtkPoints object and set the number of points
- vtkPoints *vpoints = vtkPoints::New(VTK_DOUBLE);
-
- vtkFloatArray *pointScalars = vtkFloatArray::New();
- vtkFloatArray *cellScalars = vtkFloatArray::New();
- pointScalars->SetNumberOfComponents(1);
- cellScalars->SetNumberOfComponents(1);
-
- typename MeshType::PointsContainer::Pointer points = mesh->GetPoints();
- typename MeshType::PointsContainer::Iterator i;
-
- // iterate over all the points in the itk mesh to find
- // the maximal index
- unsigned int maxIndex = 0;
- for (i = points->Begin(); i != points->End(); ++i)
- {
- if (maxIndex < i->Index())
- maxIndex = i->Index();
- }
-
- // initialize vtk-classes for points and scalars
- vpoints->SetNumberOfPoints(maxIndex + 1);
- pointScalars->SetNumberOfTuples(maxIndex + 1);
- cellScalars->SetNumberOfTuples(mesh->GetNumberOfCells());
-
- double vtkpoint[3];
- typename MeshType::PointType itkPhysicalPoint;
- if (geometryFrame == nullptr)
- {
- for (i = points->Begin(); i != points->End(); ++i)
- {
- // Get the point index from the point container iterator
- int idx = i->Index();
-
- itkPhysicalPoint = i->Value();
- mitk::itk2vtk(itkPhysicalPoint, vtkpoint);
- // Set the vtk point at the index with the the coord array from itk
- vpoints->SetPoint(idx, vtkpoint);
-
- if (usePointScalarAccessor)
- {
- pointScalars->InsertTuple1(
- idx, ScalarAccessor::GetPointScalar(mesh->GetPointData(), i->Index(), mesh, pointDataType));
- }
- }
- }
- else
- {
- mitk::Point3D mitkWorldPoint;
- for (i = points->Begin(); i != points->End(); ++i)
- {
- // Get the point index from the point container iterator
- int idx = i->Index();
-
- itkPhysicalPoint = i->Value();
- geometryFrame->ItkPhysicalPointToWorld(itkPhysicalPoint, mitkWorldPoint);
- mitk::itk2vtk(mitkWorldPoint, vtkpoint);
- // Set the vtk point at the index with the the coord array from itk
- vpoints->SetPoint(idx, vtkpoint);
-
- if (usePointScalarAccessor)
- {
- pointScalars->InsertTuple1(
- idx, ScalarAccessor::GetPointScalar(mesh->GetPointData(), i->Index(), mesh, pointDataType));
- }
- }
- }
- // Set the points on the vtk grid
- vgrid->SetPoints(vpoints);
- if (usePointScalarAccessor)
- vgrid->GetPointData()->SetScalars(pointScalars);
-
- // Now create the cells using the MultiVisitor
- // 1. Create a MultiVisitor
- typename MeshType::CellType::MultiVisitor::Pointer mv = MeshType::CellType::MultiVisitor::New();
- // 2. Create visitors
- typename SingleCellArrayLineVisitor::Pointer lv = SingleCellArrayLineVisitor::New();
- typename SingleCellArrayPolygonVisitor::Pointer pv = SingleCellArrayPolygonVisitor::New();
- typename SingleCellArrayTriangleVisitor::Pointer tv = SingleCellArrayTriangleVisitor::New();
- typename SingleCellArrayQuadrilateralVisitor::Pointer qv = SingleCellArrayQuadrilateralVisitor::New();
- typename SingleCellArrayTetrahedronVisitor::Pointer tetv = SingleCellArrayTetrahedronVisitor::New();
- typename SingleCellArrayHexahedronVisitor::Pointer hv = SingleCellArrayHexahedronVisitor::New();
- // 3. Set up the visitors
- // int vtkCellCount = 0; // running counter for current cell being inserted into vtk
- int numCells = mesh->GetNumberOfCells();
- int *types = new int[numCells]; // type array for vtk
- // create vtk cells and estimate the size
- vtkCellArray *cells = vtkCellArray::New();
- cells->Allocate(numCells);
- // Set the TypeArray CellCount and CellArray for the visitors
- lv->SetTypeArray(types);
- lv->SetCellArray(cells);
- pv->SetTypeArray(types);
- pv->SetCellArray(cells);
- tv->SetTypeArray(types);
- // tv->SetCellCounter(&vtkCellCount);
- tv->SetCellArray(cells);
- qv->SetTypeArray(types);
- // qv->SetCellCounter(&vtkCellCount);
- qv->SetCellArray(cells);
- tetv->SetTypeArray(types);
- tetv->SetCellArray(cells);
- hv->SetTypeArray(types);
- hv->SetCellArray(cells);
-
- if (useCellScalarAccessor)
- {
- lv->SetUseCellScalarAccessor(true);
- lv->SetCellScalars(cellScalars);
- lv->SetMeshCellData(mesh->GetCellData());
-
- pv->SetUseCellScalarAccessor(true);
- pv->SetCellScalars(cellScalars);
- pv->SetMeshCellData(mesh->GetCellData());
-
- tv->SetUseCellScalarAccessor(true);
- tv->SetCellScalars(cellScalars);
- tv->SetMeshCellData(mesh->GetCellData());
-
- qv->SetUseCellScalarAccessor(true);
- qv->SetCellScalars(cellScalars);
- qv->SetMeshCellData(mesh->GetCellData());
-
- tetv->SetUseCellScalarAccessor(true);
- tetv->SetCellScalars(cellScalars);
- tetv->SetMeshCellData(mesh->GetCellData());
-
- hv->SetUseCellScalarAccessor(true);
- hv->SetCellScalars(cellScalars);
- hv->SetMeshCellData(mesh->GetCellData());
- }
-
- // add the visitors to the multivisitor
- mv->AddVisitor(lv);
- mv->AddVisitor(pv);
- mv->AddVisitor(tv);
- mv->AddVisitor(qv);
- mv->AddVisitor(tetv);
- mv->AddVisitor(hv);
- // Now ask the mesh to accept the multivisitor which
- // will Call Visit for each cell in the mesh that matches the
- // cell types of the visitors added to the MultiVisitor
- mesh->Accept(mv);
- // Now set the cells on the vtk grid with the type array and cell array
-
- vgrid->SetCells(types, cells);
- vgrid->GetCellData()->SetScalars(cellScalars);
-
- // Clean up vtk objects (no vtkSmartPointer ... )
- cells->Delete();
- vpoints->Delete();
- delete[] types;
-
- pointScalars->Delete();
- cellScalars->Delete();
- // MITK_INFO << "meshToUnstructuredGrid end" << std::endl;
- return vgrid;
- }
-
- /*!
- create a vtkPolyData object from an itkMesh
- */
- static vtkPolyData *MeshToPolyData(MeshType *mesh,
- bool onlyTriangles = false,
- bool useScalarAccessor = false,
- unsigned int pointDataType = 0,
- mitk::BaseGeometry *geometryFrame = nullptr,
- vtkPolyData *polydata = nullptr)
- {
- /*!
- default Distribute line cell visitior definition
- */
- typedef typename itk::CellInterfaceVisitorImplementation<typename MeshType::CellPixelType,
- typename MeshType::CellTraits,
- itk::LineCell<typename MeshType::CellType>,
- DistributeUserVisitorType>
- DistributeLineVisitor;
-
- /*!
- default Distribute polygon cell visitior definition
- */
- typedef typename itk::CellInterfaceVisitorImplementation<typename MeshType::CellPixelType,
- typename MeshType::CellTraits,
- itk::PolygonCell<typename MeshType::CellType>,
- DistributeUserVisitorType>
- DistributePolygonVisitor;
-
- /*!
- default Distribute triangle cell visitior definition
- */
- typedef typename itk::CellInterfaceVisitorImplementation<
- typename MeshType::CellPixelType,
- typename MeshType::CellTraits,
- itk::TriangleCell<itk::CellInterface<typename MeshType::CellPixelType, typename MeshType::CellTraits>>,
- DistributeUserVisitorType>
- DistributeTriangleVisitor;
-
- /*!
- default Distribute quad cell visitior definition
- */
- typedef typename itk::CellInterfaceVisitorImplementation<
- typename MeshType::CellPixelType,
- typename MeshType::CellTraits,
- itk::QuadrilateralCell<itk::CellInterface<typename MeshType::CellPixelType, typename MeshType::CellTraits>>,
- DistributeUserVisitorType>
- DistributeQuadrilateralVisitor;
-
- /*!
- default Distribute triangle cell visitior definition
- */
- typedef typename itk::CellInterfaceVisitorImplementation<
- typename MeshType::CellPixelType,
- typename MeshType::CellTraits,
- itk::TriangleCell<itk::CellInterface<typename MeshType::CellPixelType, typename MeshType::CellTraits>>,
- ExactUserVisitorType>
- ExactTriangleVisitor;
-
- // Get the number of points in the mesh
- int numPoints = mesh->GetNumberOfPoints();
- if (numPoints == 0)
- {
- // mesh->Print(std::cerr);
- MITK_ERROR << "no points in Grid " << std::endl;
- }
- // Create a vtkPolyData
- if (polydata == nullptr)
- polydata = vtkPolyData::New();
- else
- polydata->Initialize();
-
- // Create the vtkPoints object and set the number of points
- vtkPoints *vpoints = vtkPoints::New(VTK_DOUBLE);
-
- vtkFloatArray *scalars = vtkFloatArray::New();
- scalars->SetNumberOfComponents(1);
-
- typename MeshType::PointsContainer::Pointer points = mesh->GetPoints();
- typename MeshType::PointsContainer::Iterator i;
-
- // iterate over all the points in the itk mesh to find
- // the maximal index
- unsigned int maxIndex = 0;
- for (i = points->Begin(); i != points->End(); ++i)
- {
- if (maxIndex < i->Index())
- maxIndex = i->Index();
- }
-
- // initialize vtk-classes for points and scalars
- vpoints->SetNumberOfPoints(maxIndex + 1);
- scalars->SetNumberOfTuples(maxIndex + 1);
-
- // iterate over all the points in the itk mesh filling in
- // the vtkPoints object as we go
-
- double vtkpoint[3];
- typename MeshType::PointType itkPhysicalPoint;
- if (geometryFrame == nullptr)
- {
- for (i = points->Begin(); i != points->End(); ++i)
- {
- // Get the point index from the point container iterator
- int idx = i->Index();
-
- itkPhysicalPoint = i->Value();
- mitk::itk2vtk(itkPhysicalPoint, vtkpoint);
- // Set the vtk point at the index with the the coord array from itk
- // itk returns a const pointer, but vtk is not const correct, so
- // we have to use a const cast to get rid of the const
- // vpoints->SetPoint(idx, const_cast<DATATYPE*>(i->Value().GetDataPointer()));
- vpoints->SetPoint(idx, vtkpoint);
-
- if (useScalarAccessor)
- {
- scalars->InsertTuple1(idx,
- ScalarAccessor::GetPointScalar(mesh->GetPointData(), i->Index(), mesh, pointDataType));
- }
- }
- }
- else
- {
- mitk::Point3D mitkWorldPoint;
- for (i = points->Begin(); i != points->End(); ++i)
- {
- // Get the point index from the point container iterator
- int idx = i->Index();
-
- itkPhysicalPoint = i->Value();
- geometryFrame->ItkPhysicalPointToWorld(itkPhysicalPoint, mitkWorldPoint);
- mitk::itk2vtk(mitkWorldPoint, vtkpoint);
- // Set the vtk point at the index with the the coord array from itk
- // itk returns a const pointer, but vtk is not const correct, so
- // we have to use a const cast to get rid of the const
- // vpoints->SetPoint(idx, const_cast<DATATYPE*>(i->Value().GetDataPointer()));
- vpoints->SetPoint(idx, vtkpoint);
-
- if (useScalarAccessor)
- {
- scalars->InsertTuple1(idx,
- ScalarAccessor::GetPointScalar(mesh->GetPointData(), i->Index(), mesh, pointDataType));
- }
- }
- }
-
- // Set the points on the vtk grid
- polydata->SetPoints(vpoints);
- if (useScalarAccessor)
- polydata->GetPointData()->SetScalars(scalars);
- polydata->GetPointData()->CopyAllOn();
-
- // Now create the cells using the MulitVisitor
- // 1. Create a MultiVisitor
- typedef typename MeshType::CellType::MultiVisitor MeshMV;
- typename MeshMV::Pointer mv = MeshMV::New();
-
- int numCells = mesh->GetNumberOfCells();
-
- if (onlyTriangles)
- {
- // create vtk cells and allocate
- vtkCellArray *trianglecells = vtkCellArray::New();
- trianglecells->Allocate(numCells);
-
- // 2. Create a triangle visitor and add it to the multivisitor
- typename ExactTriangleVisitor::Pointer tv = ExactTriangleVisitor::New();
- tv->SetCellArrays(nullptr, trianglecells, nullptr, nullptr);
- mv->AddVisitor(tv);
- // 3. Now ask the mesh to accept the multivisitor which
- // will Call Visit for each cell in the mesh that matches the
- // cell types of the visitors added to the MultiVisitor
- mesh->Accept(mv);
-
- // 4. Set the result into our vtkPolyData
- if (trianglecells->GetNumberOfCells() > 0)
- polydata->SetStrips(trianglecells);
-
- // 5. Clean up vtk objects (no vtkSmartPointer ... )
- trianglecells->Delete();
- }
- else
- {
- // create vtk cells and allocate
- vtkCellArray *linecells = vtkCellArray::New();
- vtkCellArray *trianglecells = vtkCellArray::New();
- vtkCellArray *polygoncells = vtkCellArray::New();
- linecells->Allocate(numCells);
- trianglecells->Allocate(numCells);
- polygoncells->Allocate(numCells);
-
- // 2. Create visitors
- typename DistributeLineVisitor::Pointer lv = DistributeLineVisitor::New();
- typename DistributePolygonVisitor::Pointer pv = DistributePolygonVisitor::New();
- typename DistributeTriangleVisitor::Pointer tv = DistributeTriangleVisitor::New();
- typename DistributeQuadrilateralVisitor::Pointer qv = DistributeQuadrilateralVisitor::New();
-
- lv->SetCellArrays(linecells, trianglecells, polygoncells, polygoncells);
- pv->SetCellArrays(linecells, trianglecells, polygoncells, polygoncells);
- tv->SetCellArrays(linecells, trianglecells, polygoncells, polygoncells);
- qv->SetCellArrays(linecells, trianglecells, polygoncells, polygoncells);
-
- // add the visitors to the multivisitor
- mv->AddVisitor(tv);
- mv->AddVisitor(lv);
- mv->AddVisitor(pv);
- mv->AddVisitor(qv);
- // 3. Now ask the mesh to accept the multivisitor which
- // will Call Visit for each cell in the mesh that matches the
- // cell types of the visitors added to the MultiVisitor
- mesh->Accept(mv);
-
- // 4. Set the result into our vtkPolyData
- if (linecells->GetNumberOfCells() > 0)
- polydata->SetLines(linecells);
- if (trianglecells->GetNumberOfCells() > 0)
- polydata->SetStrips(trianglecells);
- if (polygoncells->GetNumberOfCells() > 0)
- polydata->SetPolys(polygoncells);
-
- // 5. Clean up vtk objects (no vtkSmartPointer ... )
- linecells->Delete();
- trianglecells->Delete();
- polygoncells->Delete();
- }
- vpoints->Delete();
- scalars->Delete();
-
- // MITK_INFO << "meshToPolyData end" << std::endl;
- return polydata;
- }
-
- static typename MeshType::Pointer CreateRegularSphereMesh(typename MeshType::PointType center,
- typename MeshType::PointType::VectorType scale,
- int resolution)
- {
- typedef itk::RegularSphereMeshSource<MeshType> SphereSourceType;
- typename SphereSourceType::Pointer mySphereSource = SphereSourceType::New();
-
- mySphereSource->SetCenter(center);
- mySphereSource->SetScale(scale);
- mySphereSource->SetResolution(resolution);
- mySphereSource->Update();
-
- typename MeshType::Pointer resultMesh = mySphereSource->GetOutput();
- resultMesh->Register(); // necessary ????
- return resultMesh;
- }
-
- static typename MeshType::Pointer CreateSphereMesh(typename MeshType::PointType center,
- typename MeshType::PointType scale,
- int *resolution)
- {
- typedef typename itk::SphereMeshSource<MeshType> SphereSource;
-
- typename SphereSource::Pointer mySphereSource = SphereSource::New();
-
- mySphereSource->SetCenter(center);
- mySphereSource->SetScale(scale);
- mySphereSource->SetResolutionX(resolution[0]);
- mySphereSource->SetResolutionY(resolution[1]);
- mySphereSource->SetSquareness1(1);
- mySphereSource->SetSquareness2(1);
- mySphereSource->Update();
- mySphereSource->GetOutput();
-
- typename MeshType::Pointer resultMesh = mySphereSource->GetOutput();
- resultMesh->Register();
-
- return resultMesh;
- }
-
- // static typename MeshType::Pointer TranslateMesh(typename MeshType::PointType vec, MeshType* input)
- // {
- //
- // typename MeshType::Pointer output = MeshType::New();
- // {
- // output->SetPoints(input->GetPoints());
- // output->SetPointData(input->GetPointData());
- // output->SetCells(input->GetCells());
- // output->SetLastCellId( input->GetLastCellId() );
- // typename MeshType::GeometryMapIterator pointDataIterator = input->GetGeometryData()->Begin();
- // typename MeshType::GeometryMapIterator pointDataEnd = input->GetGeometryData()->End();
- //
- // typename MeshType::PointType inputPoint,outputPoint;
- //
- // while (pointDataIterator != pointDataEnd)
- // {
- // unsigned long pointId = pointDataIterator->Index();
- // itk::SimplexMeshGeometry* newGeometry = new itk::SimplexMeshGeometry();
- // itk::SimplexMeshGeometry* refGeometry = pointDataIterator->Value();
- //
- // input->GetPoint(pointId, &inputPoint );
- // outputPoint[0] = inputPoint[0] + vec[0];
- // outputPoint[1] = inputPoint[1] + vec[1];
- // outputPoint[2] = inputPoint[2] + vec[2];
- // output->SetPoint( pointId, outputPoint );
- //
- //
- // newGeometry->pos = outputPoint;
- // newGeometry->neighborIndices = refGeometry->neighborIndices;
- // newGeometry->meanCurvature = refGeometry->meanCurvature;
- // newGeometry->neighbors = refGeometry->neighbors;
- // newGeometry->oldPos = refGeometry->oldPos;
- // newGeometry->eps = refGeometry->eps;
- // newGeometry->referenceMetrics = refGeometry->referenceMetrics;
- // newGeometry->neighborSet = refGeometry->neighborSet;
- // newGeometry->distance = refGeometry->distance;
- // newGeometry->externalForce = refGeometry->externalForce;
- // newGeometry->internalForce = refGeometry->internalForce;
- // output->SetGeometryData(pointId, newGeometry);
- // pointDataIterator++;
- // }
- // }
- //// output->SetGeometryData( inputMesh->GetGeometryData() );
- // return output;
- // }
-
- static typename MeshType::Pointer CreateRegularSphereMesh2(typename MeshType::PointType center,
- typename MeshType::PointType scale,
- int resolution)
- {
- typedef typename itk::AutomaticTopologyMeshSource<MeshType> MeshSourceType;
- typename MeshSourceType::Pointer mySphereSource = MeshSourceType::New();
-
- typename MeshType::PointType pnt0, pnt1, pnt2, pnt3, pnt4, pnt5, pnt6, pnt7, pnt8, pnt9, pnt10, pnt11;
- double c1 = 0.5 * (1.0 + sqrt(5.0));
- double c2 = 1.0;
- double len = sqrt(c1 * c1 + c2 * c2);
- c1 /= len;
- c2 /= len;
-
- pnt0[0] = center[0] - c1 * scale[0];
- pnt0[1] = center[1];
- pnt0[2] = center[2] + c2 * scale[2];
- pnt1[0] = center[0];
- pnt1[1] = center[1] + c2 * scale[1];
- pnt1[2] = center[2] - c1 * scale[2];
- pnt2[0] = center[0];
- pnt2[1] = center[1] + c2 * scale[1];
- pnt2[2] = center[2] + c1 * scale[2];
- pnt3[0] = center[0] + c1 * scale[0];
- pnt3[1] = center[1];
- pnt3[2] = center[2] - c2 * scale[2];
- pnt4[0] = center[0] - c2 * scale[0];
- pnt4[1] = center[1] - c1 * scale[1];
- pnt4[2] = center[2];
- pnt5[0] = center[0] - c2 * scale[0];
- pnt5[1] = center[1] + c1 * scale[1];
- pnt5[2] = center[2];
- pnt6[0] = center[0];
- pnt6[1] = center[1] - c2 * scale[1];
- pnt6[2] = center[2] + c1 * scale[2];
- pnt7[0] = center[0] + c2 * scale[0];
- pnt7[1] = center[1] + c1 * scale[1];
- pnt7[2] = center[2];
- pnt8[0] = center[0];
- pnt8[1] = center[1] - c2 * scale[1];
- pnt8[2] = center[2] - c1 * scale[2];
- pnt9[0] = center[0] + c1 * scale[0];
- pnt9[1] = center[1];
- pnt9[2] = center[2] + c2 * scale[2];
- pnt10[0] = center[0] + c2 * scale[0];
- pnt10[1] = center[1] - c1 * scale[1];
- pnt10[2] = center[2];
- pnt11[0] = center[0] - c1 * scale[0];
- pnt11[1] = center[1];
- pnt11[2] = center[2] - c2 * scale[2];
-
- addTriangle(mySphereSource, scale, pnt9, pnt2, pnt6, resolution);
- addTriangle(mySphereSource, scale, pnt1, pnt11, pnt5, resolution);
- addTriangle(mySphereSource, scale, pnt11, pnt1, pnt8, resolution);
- addTriangle(mySphereSource, scale, pnt0, pnt11, pnt4, resolution);
- addTriangle(mySphereSource, scale, pnt3, pnt1, pnt7, resolution);
- addTriangle(mySphereSource, scale, pnt3, pnt8, pnt1, resolution);
- addTriangle(mySphereSource, scale, pnt9, pnt3, pnt7, resolution);
- addTriangle(mySphereSource, scale, pnt0, pnt6, pnt2, resolution);
- addTriangle(mySphereSource, scale, pnt4, pnt10, pnt6, resolution);
- addTriangle(mySphereSource, scale, pnt1, pnt5, pnt7, resolution);
- addTriangle(mySphereSource, scale, pnt7, pnt5, pnt2, resolution);
- addTriangle(mySphereSource, scale, pnt8, pnt3, pnt10, resolution);
- addTriangle(mySphereSource, scale, pnt4, pnt11, pnt8, resolution);
- addTriangle(mySphereSource, scale, pnt9, pnt7, pnt2, resolution);
- addTriangle(mySphereSource, scale, pnt10, pnt9, pnt6, resolution);
- addTriangle(mySphereSource, scale, pnt0, pnt5, pnt11, resolution);
- addTriangle(mySphereSource, scale, pnt0, pnt2, pnt5, resolution);
- addTriangle(mySphereSource, scale, pnt8, pnt10, pnt4, resolution);
- addTriangle(mySphereSource, scale, pnt3, pnt9, pnt10, resolution);
- addTriangle(mySphereSource, scale, pnt6, pnt0, pnt4, resolution);
-
- return mySphereSource->GetOutput();
- }
-
-private:
- static void addTriangle(typename itk::AutomaticTopologyMeshSource<MeshType>::Pointer meshSource,
- typename MeshType::PointType scale,
- typename MeshType::PointType pnt0,
- typename MeshType::PointType pnt1,
- typename MeshType::PointType pnt2,
- int resolution)
- {
- if (resolution == 0)
- {
- // add triangle
- meshSource->AddTriangle(meshSource->AddPoint(pnt0), meshSource->AddPoint(pnt1), meshSource->AddPoint(pnt2));
- }
- else
- {
- vnl_vector_fixed<typename MeshType::CoordRepType, 3> v1, v2, res, pv;
- v1 = (pnt1 - pnt0).Get_vnl_vector();
- v2 = (pnt2 - pnt0).Get_vnl_vector();
- res = vnl_cross_3d(v1, v2);
- pv = pnt0.GetVectorFromOrigin().Get_vnl_vector();
- // double d = res[0]*pv[0] + res[1]*pv[1] + res[2]*pv[2];
-
- // subdivision
- typename MeshType::PointType pnt01, pnt12, pnt20;
- for (int d = 0; d < 3; d++)
- {
- pnt01[d] = (pnt0[d] + pnt1[d]) / 2.0;
- pnt12[d] = (pnt1[d] + pnt2[d]) / 2.0;
- pnt20[d] = (pnt2[d] + pnt0[d]) / 2.0;
- }
- // map new points to sphere
- double lenPnt01 = 0;
- for (int d = 0; d < 3; d++)
- lenPnt01 += pnt01[d] * pnt01[d];
- lenPnt01 = sqrt(lenPnt01);
- double lenPnt12 = 0;
- for (int d = 0; d < 3; d++)
- lenPnt12 += pnt12[d] * pnt12[d];
- lenPnt12 = sqrt(lenPnt12);
- double lenPnt20 = 0;
- for (int d = 0; d < 3; d++)
- lenPnt20 += pnt20[d] * pnt20[d];
- lenPnt20 = sqrt(lenPnt20);
- for (int d = 0; d < 3; d++)
- {
- pnt01[d] *= scale[d] / lenPnt01;
- pnt12[d] *= scale[d] / lenPnt12;
- pnt20[d] *= scale[d] / lenPnt20;
- }
- addTriangle(meshSource, scale, pnt0, pnt01, pnt20, resolution - 1);
- addTriangle(meshSource, scale, pnt01, pnt1, pnt12, resolution - 1);
- addTriangle(meshSource, scale, pnt20, pnt12, pnt2, resolution - 1);
- addTriangle(meshSource, scale, pnt01, pnt12, pnt20, resolution - 1);
- }
- }
-};
-
-#endif // MITKMESHUTIL_H_INCLUDED
diff --git a/Modules/DataTypesExt/src/mitkMesh.cpp b/Modules/DataTypesExt/src/mitkMesh.cpp
deleted file mode 100644
index b88524fc13..0000000000
--- a/Modules/DataTypesExt/src/mitkMesh.cpp
+++ /dev/null
@@ -1,805 +0,0 @@
-/*============================================================================
-
-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 "mitkMesh.h"
-#include "mitkInteractionConst.h"
-#include "mitkLine.h"
-#include "mitkLineOperation.h"
-#include "mitkLineOperation.h"
-#include "mitkNumericTypes.h"
-#include "mitkOperation.h"
-#include "mitkOperationActor.h"
-#include "mitkPointOperation.h"
-#include "mitkRenderingManager.h"
-#include "mitkStatusBar.h"
-
-mitk::Mesh::Mesh()
-{
-}
-
-mitk::Mesh::~Mesh()
-{
-}
-
-const mitk::Mesh::DataType *mitk::Mesh::GetMesh(int t) const
-{
- return m_PointSetSeries[t];
-}
-
-mitk::Mesh::DataType *mitk::Mesh::GetMesh(int t)
-{
- return m_PointSetSeries[t];
-}
-
-void mitk::Mesh::SetMesh(DataType *mesh, int t)
-{
- this->Expand(t + 1);
- m_PointSetSeries[t] = mesh;
-}
-
-unsigned long mitk::Mesh::GetNumberOfCells(int t)
-{
- return m_PointSetSeries[t]->GetNumberOfCells();
-}
-
-// search a line that is close enough according to the given position
-bool mitk::Mesh::SearchLine(Point3D point, float distance, unsigned long &lineId, unsigned long &cellId, int t)
-{
- // returns true if a line is found
- ScalarType bestDist = distance;
-
- // iterate through all cells.
- ConstCellIterator cellIt = m_PointSetSeries[t]->GetCells()->Begin();
- ConstCellIterator cellEnd = m_PointSetSeries[t]->GetCells()->End();
- while (cellIt != cellEnd)
- {
- if (cellIt.Value()->GetNumberOfPoints() > 1)
- {
- // then iterate through all indexes of points in it->Value()
- PointIdIterator inAIt = cellIt.Value()->PointIdsBegin(); // first point
- PointIdIterator inBIt = cellIt.Value()->PointIdsBegin(); // second point
- PointIdIterator inEnd = cellIt.Value()->PointIdsEnd();
-
- ++inAIt; // so it points to the point before inBIt
-
- int currentLineId = 0;
- while (inAIt != inEnd)
- {
- mitk::PointSet::PointType pointA, pointB;
- if (m_PointSetSeries[t]->GetPoint((*inAIt), &pointA) && m_PointSetSeries[t]->GetPoint((*inBIt), &pointB))
- {
- auto line = new Line<CoordinateType>();
- line->SetPoints(pointA, pointB);
- double thisDistance = line->Distance(point);
- if (thisDistance < bestDist)
- {
- cellId = cellIt->Index();
- lineId = currentLineId;
- bestDist = thisDistance;
- }
- }
- ++inAIt;
- ++inBIt;
- ++currentLineId;
- }
-
- // If the cell is closed, then check the line from the last index to
- // the first index if inAIt points to inEnd, then inBIt points to the
- // last index.
- CellDataType cellData;
- bool dataOk = m_PointSetSeries[t]->GetCellData(cellIt->Index(), &cellData);
- if (dataOk)
- {
- if (cellData.closed)
- {
- // get the points
- PointIdIterator inAIt = cellIt.Value()->PointIdsBegin(); // first point
- // inBIt points to last.
- mitk::PointSet::PointType pointA, pointB;
- if (m_PointSetSeries[t]->GetPoint((*inAIt), &pointA) && m_PointSetSeries[t]->GetPoint((*inBIt), &pointB))
- {
- auto line = new Line<CoordinateType>();
- line->SetPoints(pointA, pointB);
- double thisDistance = line->Distance(point);
- if (thisDistance < bestDist)
- {
- cellId = cellIt->Index();
- lineId = currentLineId;
- bestDist = thisDistance;
- }
- }
- }
- }
- }
- ++cellIt;
- }
- return (bestDist < distance);
-}
-
-int mitk::Mesh::SearchFirstCell(unsigned long pointId, int t)
-{
- // iterate through all cells and find the cell the given pointId is inside
- ConstCellIterator it = m_PointSetSeries[t]->GetCells()->Begin();
- ConstCellIterator end = m_PointSetSeries[t]->GetCells()->End();
- while (it != end)
- {
- PointIdIterator position = std::find(it->Value()->PointIdsBegin(), it->Value()->PointIdsEnd(), pointId);
-
- if (position != it->Value()->PointIdsEnd())
- {
- return it->Index();
- }
- ++it;
- }
- return -1;
-}
-
-// Due to not implemented itk::CellInterface::EvaluatePosition and errors in
-// using vtkCell::EvaluatePosition (changing iterator!) we must implement
-// it in mitk::Mesh
-// make it easy and look for hit points and hit lines: needs to be done anyway!
-bool mitk::Mesh::EvaluatePosition(mitk::Point3D point, unsigned long &cellId, float precision, int t)
-{
- int pointId = this->SearchPoint(point, precision, t);
- if (pointId > -1)
- {
- // search the cell the point lies inside
- cellId = this->SearchFirstCell(pointId, t);
- return true;
- }
- unsigned long lineId = 0;
- if (this->SearchLine(point, precision, lineId, cellId, t))
- {
- return true;
- }
-
- return false;
-}
-
-unsigned long mitk::Mesh::GetNewCellId(int t)
-{
- long nextCellId = -1;
- ConstCellIterator it = m_PointSetSeries[t]->GetCells()->Begin();
- ConstCellIterator end = m_PointSetSeries[t]->GetCells()->End();
-
- while (it != end)
- {
- nextCellId = it.Index();
- ++it;
- }
- ++nextCellId;
- return nextCellId;
-}
-
-int mitk::Mesh::SearchSelectedCell(int t)
-{
- CellDataIterator cellDataIt, cellDataEnd;
- cellDataEnd = m_PointSetSeries[t]->GetCellData()->End();
- for (cellDataIt = m_PointSetSeries[t]->GetCellData()->Begin(); cellDataIt != cellDataEnd; cellDataIt++)
- {
- // then declare an operation which unselects this line; UndoOperation as well!
- if (cellDataIt->Value().selected)
- {
- return cellDataIt->Index();
- }
- }
- return -1;
-}
-
-// get the cell; then iterate through the Ids times lineId. Then IdA ist the
-// one, IdB ist ne next.don't forget the last closing line if the cell is
-// closed
-bool mitk::Mesh::GetPointIds(unsigned long cellId, unsigned long lineId, int &idA, int &idB, int t)
-{
- CellAutoPointer cellAutoPointer;
- bool ok = m_PointSetSeries[t]->GetCell(cellId, cellAutoPointer);
- if (ok)
- {
- CellType *cell = cellAutoPointer.GetPointer();
-
- // Get the cellData to also check the closing line
- CellDataType cellData;
- m_PointSetSeries[t]->GetCellData(cellId, &cellData);
- bool closed = cellData.closed;
-
- PointIdIterator pointIdIt = cell->PointIdsBegin();
- PointIdIterator pointIdEnd = cell->PointIdsEnd();
- unsigned int counter = 0;
- bool found = false;
- while (pointIdIt != pointIdEnd)
- {
- if (counter == lineId)
- {
- idA = (*pointIdIt);
- ++pointIdIt;
- found = true;
- break;
- }
- ++counter;
- ++pointIdIt;
- }
- if (found)
- {
- // if in the middle
- if (pointIdIt != pointIdEnd)
- {
- idB = (*pointIdIt);
- }
- // if found but on the end, then it is the closing connection, so the
- // last and the first point
- else if (closed)
- {
- pointIdIt = cell->PointIdsBegin();
- idB = (*pointIdIt);
- }
- }
- else
- ok = false;
- }
- return ok;
-}
-
-void mitk::Mesh::ExecuteOperation(Operation *operation)
-{
- // adding only the operations, that aren't implemented by the pointset.
- switch (operation->GetOperationType())
- {
- case OpNOTHING:
- break;
-
- case OpNEWCELL:
- {
- auto *lineOp = dynamic_cast<mitk::LineOperation *>(operation);
-
- // if no lineoperation, then call superclass pointSet
- if (lineOp == nullptr)
- {
- Superclass::ExecuteOperation(operation);
- }
-
- bool ok;
- int cellId = lineOp->GetCellId();
- CellAutoPointer cellAutoPointer;
- ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
-
- // if it doesn't already exist
- if (!ok)
- {
- cellAutoPointer.TakeOwnership(new PolygonType);
- m_PointSetSeries[0]->SetCell(cellId, cellAutoPointer);
- CellDataType cellData;
- cellData.selected = true;
- cellData.selectedLines.clear();
- cellData.closed = false;
- m_PointSetSeries[0]->SetCellData(cellId, cellData);
- }
- }
- break;
-
- case OpDELETECELL:
- {
- auto *lineOp = dynamic_cast<mitk::LineOperation *>(operation);
- if (lineOp == nullptr) // if no lineoperation, then call superclass pointSet
- {
- Superclass::ExecuteOperation(operation);
- }
- m_PointSetSeries[0]->GetCells()->DeleteIndex((unsigned)lineOp->GetCellId());
- m_PointSetSeries[0]->GetCellData()->DeleteIndex((unsigned)lineOp->GetCellId());
- }
- break;
-
- case OpCLOSECELL:
- // sets the bolean flag closed from a specified cell to true.
- {
- auto *lineOp = dynamic_cast<mitk::LineOperation *>(operation);
- if (lineOp == nullptr) // if no lineoperation, then call superclass pointSet
- {
- // then search the selected cell!//TODO
- Superclass::ExecuteOperation(operation);
- }
- bool ok;
- int cellId = lineOp->GetCellId();
- if (cellId < 0) // cellId isn't set
- {
- cellId = this->SearchSelectedCell(0);
- if (cellId < 0) // still not found
- return;
- }
- CellAutoPointer cellAutoPointer;
-
- // get directly the celldata!TODO
- ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
- if (ok)
- {
- CellDataType cellData;
- m_PointSetSeries[0]->GetCellData(cellId, &cellData);
- cellData.closed = true;
- m_PointSetSeries[0]->SetCellData(cellId, cellData);
- }
- }
- break;
-
- case OpOPENCELL:
- {
- auto *lineOp = dynamic_cast<mitk::LineOperation *>(operation);
- if (lineOp == nullptr) // if no lineoperation, then call superclass pointSet
- {
- Superclass::ExecuteOperation(operation);
- }
- bool ok;
- int cellId = lineOp->GetCellId();
- CellAutoPointer cellAutoPointer;
- ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
- if (ok)
- {
- CellDataType cellData;
- m_PointSetSeries[0]->GetCellData(cellId, &cellData);
- cellData.closed = false;
- ;
- m_PointSetSeries[0]->SetCellData(cellId, cellData);
- }
- }
- break;
-
- case OpADDLINE:
- // inserts the ID of the selected point into the indexes of lines in the
- // selected cell afterwars the added line is selected
- {
- auto *lineOp = dynamic_cast<mitk::LineOperation *>(operation);
-
- int cellId = -1;
- int pId = -1;
-
- if (lineOp == nullptr)
- {
- cellId = this->SearchSelectedCell(0);
- if (cellId == -1)
- return;
-
- pId = this->SearchSelectedPoint(0);
- if (pId == -1)
- return;
- }
- else
- {
- cellId = lineOp->GetCellId();
- if (cellId == -1)
- return;
- pId = lineOp->GetPIdA();
- if (pId == -1)
- return;
- }
-
- bool ok;
- CellAutoPointer cellAutoPointer;
- ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
- if (ok)
- {
- CellType *cell = cellAutoPointer.GetPointer();
- if (cell->GetType() == CellType::POLYGON_CELL)
- {
- auto *polygon = static_cast<PolygonType *>(cell);
- // add the pointId to the Cell. filling the empty cell with
- // one id doesn't mean to add a line, it means, that the
- // initilal PointId is set. The next addition of a pointId adds
- // a line
- polygon->AddPointId(pId);
-
- // select the line, if we really added a line, so now have more than
- // 1 pointID in the cell
- CellDataType cellData;
- ok = m_PointSetSeries[0]->GetCellData(cellId, &cellData);
- if (ok)
- {
- // A line between point 0 and 1 has the Id 0. A line between
- // 1 and 2 has a Id = 1. So we add getnumberofpoints-2.
- if (polygon->GetNumberOfPoints() > 1)
- cellData.selectedLines.push_back(polygon->GetNumberOfPoints() - 2);
- }
- m_PointSetSeries[0]->SetCellData(cellId, cellData);
- m_PointSetSeries[0]->SetCell(cellId, cellAutoPointer);
- }
- }
- }
- break;
-
- case OpDELETELINE:
- {
- // deleted the last line through removing the index PIdA
- // (if set to -1, use the last point) in the given cellId
- auto *lineOp = dynamic_cast<mitk::LineOperation *>(operation);
- int cellId = -1;
- int pId = -1;
-
- if (lineOp == nullptr)
- {
- cellId = this->SearchSelectedCell(0);
- if (cellId == -1)
- return;
- pId = this->SearchSelectedPoint(0);
- }
- else
- {
- cellId = lineOp->GetCellId();
- if (cellId == -1)
- return;
- pId = lineOp->GetPIdA();
- }
-
- bool ok;
- CellAutoPointer cellAutoPointer;
- ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
- if (ok)
- {
- CellType *cell = cellAutoPointer.GetPointer();
- if (cell->GetType() == CellType::POLYGON_CELL)
- {
- auto *oldPolygon = static_cast<PolygonType *>(cell);
-
- auto newPolygonCell = new PolygonType;
- CellAutoPointer newCell;
- newCell.TakeOwnership(newPolygonCell);
-
- PointIdConstIterator it, oldend;
- oldend = oldPolygon->PointIdsEnd();
- if (pId >= 0)
- {
- for (it = oldPolygon->PointIdsBegin(); it != oldend; ++it)
- {
- if ((*it) != (MeshType::PointIdentifier)pId)
- {
- newPolygonCell->AddPointId(*it);
- }
- }
- }
- else
- {
- --oldend;
- for (it = oldPolygon->PointIdsBegin(); it != oldend; ++it)
- newPolygonCell->AddPointId(*it);
- }
- oldPolygon->SetPointIds(0, newPolygonCell->GetNumberOfPoints(), newPolygonCell->PointIdsBegin());
- }
- }
- }
- break;
-
- case OpREMOVELINE:
- // Remove the given Index in the given cell through copying everything
- // into a new cell accept the one that has to be deleted.
- {
- auto *lineOp = dynamic_cast<mitk::LineOperation *>(operation);
- if (lineOp == nullptr) // if no lineoperation, then call superclass pointSet
- {
- Superclass::ExecuteOperation(operation);
- }
-
- bool ok;
- CellAutoPointer cellAutoPointer;
- int cellId = lineOp->GetCellId();
- ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
- if (!ok)
- return;
-
- CellType *cell = cellAutoPointer.GetPointer();
- CellAutoPointer newCellAutoPointer;
- newCellAutoPointer.TakeOwnership(new PolygonType);
- auto *newPolygon = static_cast<PolygonType *>(cell);
-
- PointIdIterator it = cell->PointIdsBegin();
- PointIdIterator end = cell->PointIdsEnd();
- int pointId = lineOp->GetPIdA();
- if (pointId < 0) // if not initialized!!
- return;
-
- while (it != end)
- {
- if ((*it) == (unsigned int)pointId)
- {
- break;
- }
- else
- {
- newPolygon->AddPointId(*it);
- }
- ++it;
- }
- while (it != end)
- {
- newPolygon->AddPointId(*it);
- it++;
- }
- m_PointSetSeries[0]->SetCell(cellId, newCellAutoPointer);
- }
- break;
-
- case OpINSERTLINE:
- // //insert line between two other points.
- ////before A--B after A--C--B
- // //the points A, B and C have to be in the pointset.
- // //needed: CellId, Id of C , Id A and Id B
- ////the cell has to exist!
- //{
- // mitk::LineOperation *lineOp = dynamic_cast<mitk::LineOperation *>(operation);
- // if (lineOp == nullptr)//if no lineoperation, then call superclass pointSet
- // {
- // Superclass::ExecuteOperation(operation);
- // }
- // int cellId = lineOp->GetCellId();
- // int pIdC = lineOp->GetPIdC();
- // int pIdA = lineOp->GetPIdA();
- // int pIdB = lineOp->GetPIdB();
-
- // //the points of the given PointIds have to exist in the PointSet
- // bool ok;
- // ok = m_PointSetSeries[0]->GetPoints()->IndexExists(pIdA);
- // if (!ok)
- // return;
- // ok = m_PointSetSeries[0]->GetPoints()->IndexExists(pIdB);
- // if (!ok)
- // return;
- // ok = m_PointSetSeries[0]->GetPoints()->IndexExists(pIdC);
- // if (!ok)
- // return;
-
- // // so the points do exist. So now check, if there is already a cell
- // // with the given Id
- // DataType::CellAutoPointer cell;
- // ok = m_PointSetSeries[0]->GetCell(cellId, cell);
- // if (!ok)
- // return;
-
- // //pIdA and pIdB should exist in the cell
- //
- // PointIdIterator pit = cell->PointIdsBegin();
- // PointIdIterator end = cell->PointIdsEnd();
- //
- // //now arrange the new Ids in the cell like desired; pIdC between
- // // pIdA and pIdB
- // unsigned int nuPoints = cell->GetNumberOfPoints();
-
- // std::vector<unsigned int> newPoints;
- // pit = cell->PointIdsBegin();
- // end = cell->PointIdsEnd();
- // int i = 0;
- // while( pit != end )
- // {
- // if ((*pit) = pIdA)
- // {
- // //now we have found the place to add pIdC after
- // newPoints[i] = (*pit);
- // i++;
- // newPoints[i] = pIdC;
- // }
- // else
- // newPoints[i] = (*pit);
- // pit++;
- // }
-
- // //now we have the Ids, that existed before combined with the new ones
- // //so delete the old cell
- // //doesn't seem to be necessary!
- // //cell->ClearPoints();
- // pit = cell->PointIdsBegin();
- // cell->SetPointIds(pit);
- //}
- break;
-
- case OpMOVELINE: //(moves two points)
- {
- auto *lineOp = dynamic_cast<mitk::LineOperation *>(operation);
-
- if (lineOp == nullptr)
- {
- mitk::StatusBar::GetInstance()->DisplayText(
- "Message from mitkMesh: Recieved wrong type of operation! See mitkMeshInteractor.cpp", 10000);
- return;
- }
-
- // create two operations out of the one operation and call superclass
- // through the transmitted pointIds get the koordinates of the points.
- // then add the transmitted vestor to them
- // create two operations and send them to superclass
- Point3D pointA, pointB;
- pointA.Fill(0.0);
- pointB.Fill(0.0);
- m_PointSetSeries[0]->GetPoint(lineOp->GetPIdA(), &pointA);
- m_PointSetSeries[0]->GetPoint(lineOp->GetPIdB(), &pointB);
-
- pointA[0] += lineOp->GetVector()[0];
- pointA[1] += lineOp->GetVector()[1];
- pointA[2] += lineOp->GetVector()[2];
- pointB[0] += lineOp->GetVector()[0];
- pointB[1] += lineOp->GetVector()[1];
- pointB[2] += lineOp->GetVector()[2];
-
- auto operationA = new mitk::PointOperation(OpMOVE, pointA, lineOp->GetPIdA());
- auto operationB = new mitk::PointOperation(OpMOVE, pointB, lineOp->GetPIdB());
-
- Superclass::ExecuteOperation(operationA);
- Superclass::ExecuteOperation(operationB);
- }
- break;
-
- case OpSELECTLINE: //(select the given line)
- {
- auto *lineOp = dynamic_cast<mitk::LineOperation *>(operation);
- if (lineOp == nullptr) // if no lineoperation, then call superclass pointSet
- {
- Superclass::ExecuteOperation(operation);
- }
- int cellId = lineOp->GetCellId();
- CellAutoPointer cellAutoPointer;
- bool ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
- if (ok)
- {
- CellDataType cellData;
- m_PointSetSeries[0]->GetCellData(cellId, &cellData);
- SelectedLinesType *selectedLines = &(cellData.selectedLines);
- auto position = std::find(selectedLines->begin(), selectedLines->end(), (unsigned int)lineOp->GetId());
-
- if (position == selectedLines->end()) // if not alsready selected
- {
- cellData.selectedLines.push_back(lineOp->GetId());
- }
- m_PointSetSeries[0]->SetCellData(lineOp->GetCellId(), cellData);
- }
- }
- break;
-
- case OpDESELECTLINE: //(deselect the given line)
- {
- auto *lineOp = dynamic_cast<mitk::LineOperation *>(operation);
- if (lineOp == nullptr)
- {
- Superclass::ExecuteOperation(operation);
- }
- int cellId = lineOp->GetCellId();
- CellAutoPointer cellAutoPointer;
- bool ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
- if (ok)
- {
- CellDataType cellData;
- m_PointSetSeries[0]->GetCellData(cellId, &cellData);
- SelectedLinesType *selectedLines = &(cellData.selectedLines);
- auto position = std::find(selectedLines->begin(), selectedLines->end(), (unsigned int)lineOp->GetId());
-
- if (position != selectedLines->end()) // if found
- {
- selectedLines->erase(position);
- }
- m_PointSetSeries[0]->SetCellData(cellId, cellData);
- }
- }
- break;
-
- case OpSELECTCELL: //(select the given cell)
- {
- auto *lineOp = dynamic_cast<mitk::LineOperation *>(operation);
- if (lineOp == nullptr) // if no lineoperation, then call superclass pointSet
- {
- Superclass::ExecuteOperation(operation);
- }
-
- int cellId = lineOp->GetCellId();
- CellAutoPointer cellAutoPointer;
-
- // directly get the data!//TODO
- bool ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
- if (ok)
- {
- CellDataType cellData;
- m_PointSetSeries[0]->GetCellData(cellId, &cellData);
- cellData.selected = true;
- m_PointSetSeries[0]->SetCellData(cellId, cellData);
- }
- }
- break;
-
- case OpDESELECTCELL: //(deselect the given cell)
- {
- auto *lineOp = dynamic_cast<mitk::LineOperation *>(operation);
- if (lineOp == nullptr) // if no lineoperation, then call superclass pointSet
- {
- Superclass::ExecuteOperation(operation);
- }
- int cellId = lineOp->GetCellId();
- CellAutoPointer cellAutoPointer;
- bool ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
- if (ok)
- {
- CellDataType cellData;
- m_PointSetSeries[0]->GetCellData(cellId, &cellData);
- cellData.selected = false;
- m_PointSetSeries[0]->SetCellData(cellId, cellData);
- }
- }
- break;
-
- case OpMOVECELL:
- // moves all Points of one cell according to the given vector
- {
- auto *lineOp = dynamic_cast<mitk::CellOperation *>(operation);
- if (lineOp == nullptr) // if no celloperation, then call superclass pointSet
- {
- Superclass::ExecuteOperation(operation);
- }
-
- int cellId = lineOp->GetCellId();
- Vector3D vector = lineOp->GetVector();
-
- // get the cell
- CellAutoPointer cellAutoPointer;
- bool ok = m_PointSetSeries[0]->GetCell(cellId, cellAutoPointer);
- if (!ok)
- return;
-
- CellDataType cellData;
- m_PointSetSeries[0]->GetCellData(cellId, &cellData);
- // iterate through the pointIds of the CellData and move those points in
- // the pointset
- PointIdIterator it = cellAutoPointer->PointIdsBegin();
- PointIdIterator end = cellAutoPointer->PointIdsEnd();
- while (it != end)
- {
- unsigned int position = (*it);
- PointType point;
- point.Fill(0);
- m_PointSetSeries[0]->GetPoint(position, &point);
- point = point + vector;
- m_PointSetSeries[0]->SetPoint(position, point);
- ++it;
- }
- }
- break;
-
- default:
- // if the operation couldn't be handled here, then send it to superclass
- Superclass::ExecuteOperation(operation);
- return;
- }
- // to tell the mappers, that the data is modifierd and has to be updated
- this->Modified();
-
- mitk::OperationEndEvent endevent(operation);
- ((const itk::Object *)this)->InvokeEvent(endevent);
-
- // As discussed lately, don't mess with rendering from inside data structures
- //*todo has to be done here, cause of update-pipeline not working yet
- // mitk::RenderingManager::GetInstance()->RequestUpdateAll();
-}
-
-mitk::Mesh::DataType::BoundingBoxPointer mitk::Mesh::GetBoundingBoxFromCell(unsigned long cellId, int t)
-{
- // itk::CellInterface has also a GetBoundingBox, but it
- // returns CoordRepType [PointDimension *2]
- DataType::BoundingBoxPointer bBoxPointer = nullptr;
- CellAutoPointer cellAutoPointer;
- if (m_PointSetSeries[t]->GetCell(cellId, cellAutoPointer))
- {
- DataType::PointsContainerPointer pointsContainer = DataType::PointsContainer::New();
- PointIdIterator bbIt = cellAutoPointer.GetPointer()->PointIdsBegin();
- PointIdIterator bbEnd = cellAutoPointer.GetPointer()->PointIdsEnd();
- while (bbIt != bbEnd)
- {
- mitk::PointSet::PointType point;
- bool pointOk = m_PointSetSeries[t]->GetPoint((*bbIt), &point);
- if (pointOk)
- pointsContainer->SetElement((*bbIt), point);
- ++bbIt;
- }
- bBoxPointer = DataType::BoundingBoxType::New();
- bBoxPointer->SetPoints(pointsContainer);
- bBoxPointer->ComputeBoundingBox();
- }
- return bBoxPointer;
-}
diff --git a/Modules/DataTypesExt/test/files.cmake b/Modules/DataTypesExt/test/files.cmake
index 048ece655e..356091d282 100644
--- a/Modules/DataTypesExt/test/files.cmake
+++ b/Modules/DataTypesExt/test/files.cmake
@@ -1,18 +1,17 @@
set(MODULE_TESTS
mitkColorSequenceRainbowTest.cpp
- mitkMeshTest.cpp
mitkMultiStepperTest.cpp
mitkUnstructuredGridTest.cpp
)
set(MODULE_IMAGE_TESTS
mitkCompressedImageContainerTest.cpp #only runs on images
)
set(MODULE_TESTIMAGE
US4DCyl.nrrd
Pic3D.nrrd
Pic2DplusT.nrrd
BallBinary30x30x30.nrrd
Png2D-bw.png
)
diff --git a/Modules/DataTypesExt/test/mitkMeshTest.cpp b/Modules/DataTypesExt/test/mitkMeshTest.cpp
deleted file mode 100644
index aa6dd719a9..0000000000
--- a/Modules/DataTypesExt/test/mitkMeshTest.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/*============================================================================
-
-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 <fstream>
-#include <mitkInteractionConst.h>
-#include <mitkMesh.h>
-#include <mitkNumericTypes.h>
-#include <mitkPointOperation.h>
-
-int mitkMeshTest(int /*argc*/, char * /*argv*/ [])
-{
- // Create mesh
- mitk::Mesh::Pointer mesh;
- mesh = mitk::Mesh::New();
-
- // try to get the itkmesh
- std::cout << "Create a mesh and try to get the itkMesh";
- mitk::Mesh::DataType::Pointer itkdata = nullptr;
- itkdata = mesh->GetMesh();
- if (itkdata.IsNull())
- {
- std::cout << "[FAILED]" << std::endl;
- return EXIT_FAILURE;
- }
-
- // fresh mesh has to be empty!
- std::cout << "Is the mesh empty?";
- if (mesh->GetSize() != 0)
- {
- std::cout << "[FAILED]" << std::endl;
- return EXIT_FAILURE;
- }
-
- // create an operation and add a point.
- int position = 0;
- mitk::Point3D point;
- point.Fill(1);
- auto doOp = new mitk::PointOperation(mitk::OpINSERT, point, position);
- mesh->ExecuteOperation(doOp);
-
- // now check new condition!
- if ((mesh->GetSize() != 1) || (!mesh->IndexExists(position)))
- {
- std::cout << "[FAILED]" << std::endl;
- return EXIT_FAILURE;
- }
- delete doOp;
-
- // get the point and check if it is still the same
- std::cout << "Create an operation and add a point. Then try to get that point.";
- mitk::Point3D tempPoint;
- tempPoint.Fill(0);
- tempPoint = mesh->GetPoint(position);
- if (tempPoint != point)
- {
- std::cout << "[FAILED]" << std::endl;
- return EXIT_FAILURE;
- }
-
- // well done!!! Passed!
- std::cout << "[PASSED]" << std::endl;
-
- std::cout << "[TEST DONE]" << std::endl;
- return EXIT_SUCCESS;
-}
diff --git a/Modules/Gizmo/src/mitkGizmoInteractor.cpp b/Modules/Gizmo/src/mitkGizmoInteractor.cpp
index 5f68962cdb..a682f70a24 100644
--- a/Modules/Gizmo/src/mitkGizmoInteractor.cpp
+++ b/Modules/Gizmo/src/mitkGizmoInteractor.cpp
@@ -1,456 +1,465 @@
/*============================================================================
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 "mitkGizmoInteractor.h"
#include "mitkGizmoMapper2D.h"
// MITK includes
#include <mitkInteractionConst.h>
#include <mitkInteractionPositionEvent.h>
#include <mitkInternalEvent.h>
#include <mitkLookupTableProperty.h>
#include <mitkOperationEvent.h>
#include <mitkRotationOperation.h>
#include <mitkScaleOperation.h>
#include <mitkSurface.h>
#include <mitkUndoController.h>
#include <mitkVtkMapper.h>
// VTK includes
#include <vtkCamera.h>
#include <vtkInteractorObserver.h>
#include <vtkInteractorStyle.h>
#include <vtkMath.h>
#include <vtkPointData.h>
#include <vtkPolyData.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkVector.h>
#include <vtkVectorOperators.h>
mitk::GizmoInteractor::GizmoInteractor()
{
m_ColorForHighlight[0] = 1.0;
m_ColorForHighlight[1] = 0.5;
m_ColorForHighlight[2] = 0.0;
m_ColorForHighlight[3] = 1.0;
// TODO if we want to get this configurable, the this is the recipe:
// - make the 2D mapper add corresponding properties to control "enabled" and "color"
// - make the interactor evaluate those properties
// - in an ideal world, modify the state machine on the fly and skip mouse move handling
}
mitk::GizmoInteractor::~GizmoInteractor()
{
}
void mitk::GizmoInteractor::ConnectActionsAndFunctions()
{
CONNECT_CONDITION("PickedHandle", HasPickedHandle);
CONNECT_FUNCTION("DecideInteraction", DecideInteraction);
CONNECT_FUNCTION("MoveAlongAxis", MoveAlongAxis);
CONNECT_FUNCTION("RotateAroundAxis", RotateAroundAxis);
CONNECT_FUNCTION("MoveFreely", MoveFreely);
CONNECT_FUNCTION("ScaleEqually", ScaleEqually);
CONNECT_FUNCTION("FeedUndoStack", FeedUndoStack);
}
void mitk::GizmoInteractor::SetGizmoNode(DataNode *node)
{
DataInteractor::SetDataNode(node);
m_Gizmo = dynamic_cast<Gizmo *>(node->GetData());
// setup picking from just this object
m_Picker.clear();
}
void mitk::GizmoInteractor::SetManipulatedObjectNode(DataNode *node)
{
if (node && node->GetData())
{
m_ManipulatedObjectGeometry = node->GetData()->GetGeometry();
}
}
bool mitk::GizmoInteractor::HasPickedHandle(const InteractionEvent *interactionEvent)
{
auto positionEvent = dynamic_cast<const InteractionPositionEvent *>(interactionEvent);
if (positionEvent == nullptr ||
m_Gizmo.IsNull() ||
m_ManipulatedObjectGeometry.IsNull() ||
interactionEvent->GetSender()->GetRenderWindow()->GetNeverRendered())
{
return false;
}
if (interactionEvent->GetSender()->GetMapperID() == BaseRenderer::Standard2D)
{
m_PickedHandle = PickFrom2D(positionEvent);
}
else
{
m_PickedHandle = PickFrom3D(positionEvent);
}
UpdateHandleHighlight();
return m_PickedHandle != Gizmo::NoHandle;
}
void mitk::GizmoInteractor::DecideInteraction(StateMachineAction *, InteractionEvent *interactionEvent)
{
assert(m_PickedHandle != Gizmo::NoHandle);
auto positionEvent = dynamic_cast<const InteractionPositionEvent *>(interactionEvent);
if (positionEvent == nullptr)
{
return;
}
// if something relevant was picked, we calculate a number of
// important points and axes for the upcoming geometry manipulations
// note initial state
m_InitialClickPosition2D = positionEvent->GetPointerPositionOnScreen();
m_InitialClickPosition3D = positionEvent->GetPositionInWorld();
auto renderer = positionEvent->GetSender()->GetVtkRenderer();
renderer->SetWorldPoint(m_InitialClickPosition3D[0], m_InitialClickPosition3D[1], m_InitialClickPosition3D[2], 0);
renderer->WorldToDisplay();
m_InitialClickPosition2DZ = renderer->GetDisplayPoint()[2];
m_InitialGizmoCenter3D = m_Gizmo->GetCenter();
positionEvent->GetSender()->WorldToDisplay(m_InitialGizmoCenter3D, m_InitialGizmoCenter2D);
m_InitialManipulatedObjectGeometry = m_ManipulatedObjectGeometry->Clone();
switch ( m_PickedHandle ) {
case Gizmo::MoveAlongAxisX:
case Gizmo::RotateAroundAxisX:
case Gizmo::ScaleX:
m_AxisOfMovement = m_InitialManipulatedObjectGeometry->GetAxisVector(0);
break;
case Gizmo::MoveAlongAxisY:
case Gizmo::RotateAroundAxisY:
case Gizmo::ScaleY:
m_AxisOfMovement = m_InitialManipulatedObjectGeometry->GetAxisVector(1);
break;
case Gizmo::MoveAlongAxisZ:
case Gizmo::RotateAroundAxisZ:
case Gizmo::ScaleZ:
m_AxisOfMovement = m_InitialManipulatedObjectGeometry->GetAxisVector(2);
break;
default:
break;
}
m_AxisOfMovement.Normalize();
m_AxisOfRotation = m_AxisOfMovement;
// for translation: test whether the user clicked into the "object's real" axis direction
// or into the other one
Vector3D intendedAxis = m_InitialClickPosition3D - m_InitialGizmoCenter3D;
if ( intendedAxis * m_AxisOfMovement < 0 ) {
m_AxisOfMovement *= -1.0;
}
// for rotation: test whether the axis of rotation is more looking in the direction
// of the camera or in the opposite
vtkCamera *camera = renderer->GetActiveCamera();
vtkVector3d cameraDirection(camera->GetDirectionOfProjection());
double angle_rad = vtkMath::AngleBetweenVectors(cameraDirection.GetData(), m_AxisOfRotation.GetDataPointer());
if ( angle_rad < vtkMath::Pi() / 2.0 ) {
m_AxisOfRotation *= -1.0;
}
InternalEvent::Pointer decision;
switch (m_PickedHandle)
{
case Gizmo::MoveAlongAxisX:
case Gizmo::MoveAlongAxisY:
case Gizmo::MoveAlongAxisZ:
decision = InternalEvent::New(interactionEvent->GetSender(), this, "StartTranslationAlongAxis");
break;
case Gizmo::RotateAroundAxisX:
case Gizmo::RotateAroundAxisY:
case Gizmo::RotateAroundAxisZ:
decision = InternalEvent::New(interactionEvent->GetSender(), this, "StartRotationAroundAxis");
break;
case Gizmo::MoveFreely:
decision = InternalEvent::New(interactionEvent->GetSender(), this, "MoveFreely");
break;
case Gizmo::ScaleX:
case Gizmo::ScaleY:
case Gizmo::ScaleZ:
// Implementation note: Why didn't we implement per-axis scaling yet?
// When this was implemented, the mitk::ScaleOperation was able to only describe
// uniform scaling around a central point. Since we use operations for all modifications
// in order to have undo/redo working, any axis-specific scaling should also
// use operations.
// Consequence: enhance ScaleOperation when there is need to have scaling per axis.
decision = InternalEvent::New(interactionEvent->GetSender(), this, "ScaleEqually");
break;
default:
break;
}
interactionEvent->GetSender()->GetDispatcher()->QueueEvent(decision);
}
void mitk::GizmoInteractor::MoveAlongAxis(StateMachineAction *, InteractionEvent *interactionEvent)
{
auto positionEvent = dynamic_cast<const InteractionPositionEvent *>(interactionEvent);
if (positionEvent == nullptr)
{
return;
}
- Vector3D mouseMovement3D = positionEvent->GetPositionInWorld() - m_InitialClickPosition3D;
- double projectedMouseMovement3D = mouseMovement3D * m_AxisOfMovement;
- Vector3D movement3D = projectedMouseMovement3D * m_AxisOfMovement;
+ Point2D currentPosition2D = positionEvent->GetPointerPositionOnScreen();
+
+ // re-use the initial z value to calculate movements parallel to the camera plane
+ auto renderer = positionEvent->GetSender()->GetVtkRenderer();
+ renderer->SetDisplayPoint(currentPosition2D[0], currentPosition2D[1], m_InitialClickPosition2DZ);
+ renderer->DisplayToWorld();
+ vtkVector3d worldPointVTK(renderer->GetWorldPoint());
+ Point3D worldPointITK(worldPointVTK.GetData());
+ Vector3D freeMouseMovement3D(worldPointITK - m_InitialClickPosition3D);
+
+ double projectedMouseMovement3D = freeMouseMovement3D * m_AxisOfMovement;
+ Vector3D appliedMovement3D = projectedMouseMovement3D * m_AxisOfMovement;
- ApplyTranslationToManipulatedObject(movement3D);
+ ApplyTranslationToManipulatedObject(appliedMovement3D);
RenderingManager::GetInstance()->ForceImmediateUpdateAll();
}
void mitk::GizmoInteractor::RotateAroundAxis(StateMachineAction *, InteractionEvent *interactionEvent)
{
auto positionEvent = dynamic_cast<const InteractionPositionEvent *>(interactionEvent);
if (positionEvent == nullptr)
{
return;
}
Vector2D originalVector = m_InitialClickPosition2D - m_InitialGizmoCenter2D;
Vector2D currentVector = positionEvent->GetPointerPositionOnScreen() - m_InitialGizmoCenter2D;
originalVector.Normalize();
currentVector.Normalize();
double angle_rad = std::atan2(currentVector[1], currentVector[0]) - std::atan2(originalVector[1], originalVector[0]);
ApplyRotationToManipulatedObject(vtkMath::DegreesFromRadians(angle_rad));
RenderingManager::GetInstance()->ForceImmediateUpdateAll();
}
void mitk::GizmoInteractor::MoveFreely(StateMachineAction *, InteractionEvent *interactionEvent)
{
auto positionEvent = dynamic_cast<const InteractionPositionEvent *>(interactionEvent);
if (positionEvent == nullptr)
{
return;
}
Point2D currentPosition2D = positionEvent->GetPointerPositionOnScreen();
// re-use the initial z value to really move parallel to the camera plane
auto renderer = positionEvent->GetSender()->GetVtkRenderer();
renderer->SetDisplayPoint(currentPosition2D[0], currentPosition2D[1], m_InitialClickPosition2DZ);
renderer->DisplayToWorld();
vtkVector3d worldPointVTK(renderer->GetWorldPoint());
Point3D worldPointITK(worldPointVTK.GetData());
Vector3D movementITK(worldPointITK - m_InitialClickPosition3D);
ApplyTranslationToManipulatedObject(movementITK);
RenderingManager::GetInstance()->ForceImmediateUpdateAll();
}
void mitk::GizmoInteractor::ScaleEqually(StateMachineAction *, InteractionEvent *interactionEvent)
{
auto positionEvent = dynamic_cast<const InteractionPositionEvent *>(interactionEvent);
if (positionEvent == nullptr)
{
return;
}
Point2D currentPosition2D = positionEvent->GetPointerPositionOnScreen();
double relativeSize = (currentPosition2D - m_InitialGizmoCenter2D).GetNorm() /
(m_InitialClickPosition2D - m_InitialGizmoCenter2D).GetNorm();
ApplyEqualScalingToManipulatedObject(relativeSize);
RenderingManager::GetInstance()->ForceImmediateUpdateAll();
}
void mitk::GizmoInteractor::ApplyTranslationToManipulatedObject(const Vector3D &translation)
{
assert(m_ManipulatedObjectGeometry.IsNotNull());
auto manipulatedGeometry = m_InitialManipulatedObjectGeometry->Clone();
m_FinalDoOperation.reset(new PointOperation(OpMOVE, translation));
if (m_UndoEnabled)
{
m_FinalUndoOperation.reset(new PointOperation(OpMOVE, -translation));
}
manipulatedGeometry->ExecuteOperation(m_FinalDoOperation.get());
m_ManipulatedObjectGeometry->SetIndexToWorldTransform(manipulatedGeometry->GetIndexToWorldTransform());
}
void mitk::GizmoInteractor::ApplyEqualScalingToManipulatedObject(double scalingFactor)
{
assert(m_ManipulatedObjectGeometry.IsNotNull());
auto manipulatedGeometry = m_InitialManipulatedObjectGeometry->Clone();
m_FinalDoOperation.reset(new ScaleOperation(OpSCALE, scalingFactor - 1.0, m_InitialGizmoCenter3D));
if (m_UndoEnabled)
{
m_FinalUndoOperation.reset(new ScaleOperation(OpSCALE, -(scalingFactor - 1.0), m_InitialGizmoCenter3D));
}
manipulatedGeometry->ExecuteOperation(m_FinalDoOperation.get());
m_ManipulatedObjectGeometry->SetIndexToWorldTransform(manipulatedGeometry->GetIndexToWorldTransform());
}
void mitk::GizmoInteractor::ApplyRotationToManipulatedObject(double angle_deg)
{
assert(m_ManipulatedObjectGeometry.IsNotNull());
auto manipulatedGeometry = m_InitialManipulatedObjectGeometry->Clone();
m_FinalDoOperation.reset(new RotationOperation(OpROTATE, m_InitialGizmoCenter3D, m_AxisOfRotation, angle_deg));
if (m_UndoEnabled)
{
m_FinalUndoOperation.reset(new RotationOperation(OpROTATE, m_InitialGizmoCenter3D, m_AxisOfRotation, -angle_deg));
}
manipulatedGeometry->ExecuteOperation(m_FinalDoOperation.get());
m_ManipulatedObjectGeometry->SetIndexToWorldTransform(manipulatedGeometry->GetIndexToWorldTransform());
}
void mitk::GizmoInteractor::FeedUndoStack(StateMachineAction *, InteractionEvent *)
{
if (m_UndoEnabled)
{
OperationEvent *operationEvent = new OperationEvent(m_ManipulatedObjectGeometry,
// OperationEvent will destroy operations!
// --> release() and not get()
m_FinalDoOperation.release(),
m_FinalUndoOperation.release(),
"Direct geometry manipulation");
mitk::OperationEvent::IncCurrObjectEventId(); // save each modification individually
m_UndoController->SetOperationEvent(operationEvent);
}
}
mitk::Gizmo::HandleType mitk::GizmoInteractor::PickFrom2D(const InteractionPositionEvent *positionEvent)
{
BaseRenderer *renderer = positionEvent->GetSender();
auto mapper = GetDataNode()->GetMapper(BaseRenderer::Standard2D);
auto gizmo_mapper = dynamic_cast<GizmoMapper2D *>(mapper);
auto &picker = m_Picker[renderer];
if (picker == nullptr)
{
picker = vtkSmartPointer<vtkCellPicker>::New();
picker->SetTolerance(0.005);
if (gizmo_mapper)
{ // doing this each time is bizarre
picker->AddPickList(gizmo_mapper->GetVtkProp(renderer));
picker->PickFromListOn();
}
}
auto displayPosition = positionEvent->GetPointerPositionOnScreen();
picker->Pick(displayPosition[0], displayPosition[1], 0, positionEvent->GetSender()->GetVtkRenderer());
vtkIdType pickedPointID = picker->GetPointId();
if (pickedPointID == -1)
{
return Gizmo::NoHandle;
}
vtkPolyData *polydata = gizmo_mapper->GetVtkPolyData(renderer);
if (polydata && polydata->GetPointData() && polydata->GetPointData()->GetScalars())
{
double dataValue = polydata->GetPointData()->GetScalars()->GetTuple1(pickedPointID);
return m_Gizmo->GetHandleFromPointDataValue(dataValue);
}
return Gizmo::NoHandle;
}
mitk::Gizmo::HandleType mitk::GizmoInteractor::PickFrom3D(const InteractionPositionEvent *positionEvent)
{
BaseRenderer *renderer = positionEvent->GetSender();
auto &picker = m_Picker[renderer];
if (picker == nullptr)
{
picker = vtkSmartPointer<vtkCellPicker>::New();
picker->SetTolerance(0.005);
auto mapper = GetDataNode()->GetMapper(BaseRenderer::Standard3D);
auto vtk_mapper = dynamic_cast<VtkMapper *>(mapper);
if (vtk_mapper)
{ // doing this each time is bizarre
picker->AddPickList(vtk_mapper->GetVtkProp(renderer));
picker->PickFromListOn();
}
}
auto displayPosition = positionEvent->GetPointerPositionOnScreen();
picker->Pick(displayPosition[0], displayPosition[1], 0, positionEvent->GetSender()->GetVtkRenderer());
vtkIdType pickedPointID = picker->GetPointId();
if (pickedPointID == -1)
{
return Gizmo::NoHandle;
}
// _something_ picked
return m_Gizmo->GetHandleFromPointID(pickedPointID);
}
void mitk::GizmoInteractor::UpdateHandleHighlight()
{
if (m_HighlightedHandle != m_PickedHandle) {
auto node = GetDataNode();
if (node == nullptr) return;
auto base_prop = node->GetProperty("LookupTable");
if (base_prop == nullptr) return;
auto lut_prop = dynamic_cast<LookupTableProperty*>(base_prop);
if (lut_prop == nullptr) return;
auto lut = lut_prop->GetLookupTable();
if (lut == nullptr) return;
// Table size is expected to constructed as one entry per gizmo-part enum value
assert(lut->GetVtkLookupTable()->GetNumberOfTableValues() > std::max(m_PickedHandle, m_HighlightedHandle));
// Reset previously overwritten color
if (m_HighlightedHandle != Gizmo::NoHandle)
{
lut->SetTableValue(m_HighlightedHandle, m_ColorReplacedByHighlight);
}
// Overwrite currently highlighted color
if (m_PickedHandle != Gizmo::NoHandle)
{
lut->GetTableValue(m_PickedHandle, m_ColorReplacedByHighlight);
lut->SetTableValue(m_PickedHandle, m_ColorForHighlight);
}
// Mark node modified to allow repaint
node->Modified();
RenderingManager::GetInstance()->RequestUpdateAll(RenderingManager::REQUEST_UPDATE_ALL);
m_HighlightedHandle = m_PickedHandle;
}
}
diff --git a/Modules/IGT/Algorithms/mitkNavigationDataLandmarkTransformFilter.h b/Modules/IGT/Algorithms/mitkNavigationDataLandmarkTransformFilter.h
index ef20fd7f6b..6b1da856d8 100644
--- a/Modules/IGT/Algorithms/mitkNavigationDataLandmarkTransformFilter.h
+++ b/Modules/IGT/Algorithms/mitkNavigationDataLandmarkTransformFilter.h
@@ -1,184 +1,183 @@
/*============================================================================
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 MITKNavigationDataLandmarkTransformFilter_H_HEADER_INCLUDED_
#define MITKNavigationDataLandmarkTransformFilter_H_HEADER_INCLUDED_
#include <mitkNavigationDataToNavigationDataFilter.h>
#include <mitkPointSet.h>
#include <itkLandmarkBasedTransformInitializer.h>
#include <itkQuaternionRigidTransform.h>
#include <itkImage.h>
namespace mitk {
/**Documentation
* \brief NavigationDataLandmarkTransformFilter applies a itk-landmark-transformation
* defined by source and target pointsets.
*
* Before executing the filter SetSourceLandmarks and SetTargetLandmarks must be called. Before both source
* and target landmarks are set, the filter performs an identity transform.
* If source or target points are changed after calling SetXXXPoints, the corresponding SetXXXPoints
* method has to be called again to apply the changes.
* If UseICPInitialization is false (standard value, or set with SetUseICPInitialization(false) or UseICPInitializationOff())
* then source landmarks and target landmarks with the same ID must correspond to each other.
* (--> source landmark with ID x will be mapped to target landmark with ID x).
* If you do not know the correspondences, call SetUseICPInitialization(true) or UseICPInitializationOn()
* to let the filter guess the correspondences during initialization with an iterative closest point search.
* This is only possible, if at least 6 source and target landmarks are available.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT NavigationDataLandmarkTransformFilter : public NavigationDataToNavigationDataFilter
{
public:
mitkClassMacro(NavigationDataLandmarkTransformFilter, NavigationDataToNavigationDataFilter);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
typedef std::vector<mitk::ScalarType> ErrorVector;
typedef itk::VersorRigid3DTransform< double > LandmarkTransformType;
/**
*\brief Set points used as source points for landmark transform.
*
*/
virtual void SetSourceLandmarks(mitk::PointSet::Pointer sourcePointSet);
/**
*\brief Set points used as target points for landmark transform
*
*/
virtual void SetTargetLandmarks(mitk::PointSet::Pointer targetPointSet);
virtual bool IsInitialized() const;
/**
*\brief Returns the Fiducial Registration Error
*
*/
mitk::ScalarType GetFRE() const;
/**
*\brief Returns the standard deviation of the Fiducial Registration Error
*
*/
mitk::ScalarType GetFREStdDev() const;
/**
*\brief Returns the Root Mean Square of the registration error
*
*/
mitk::ScalarType GetRMSError() const;
/**
*\brief Returns the minimum registration error / best fitting landmark distance
*
*/
mitk::ScalarType GetMinError() const;
/**
*\brief Returns the maximum registration error / worst fitting landmark distance
*
*/
mitk::ScalarType GetMaxError() const;
/**
*\brief Returns the absolute maximum registration error
*
*/
mitk::ScalarType GetAbsMaxError() const;
/**
*\brief Returns a vector with the euclidean distance of each transformed source point to its respective target point
*
*/
const ErrorVector& GetErrorVector() const;
itkSetMacro(UseICPInitialization, bool); ///< If set to true, source and target point correspondences are established with iterative closest point optimization
itkGetMacro(UseICPInitialization, bool); ///< If set to true, source and target point correspondences are established with iterative closest point optimization
itkBooleanMacro(UseICPInitialization); ///< If set to true, source and target point correspondences are established with iterative closest point optimization
itkGetConstObjectMacro(LandmarkTransform, LandmarkTransformType); ///< returns the current landmark transform
protected:
typedef itk::Image< signed short, 3> ImageType; // only because itk::LandmarkBasedTransformInitializer must be templated over two imagetypes
typedef itk::LandmarkBasedTransformInitializer< LandmarkTransformType, ImageType, ImageType > TransformInitializerType;
typedef TransformInitializerType::LandmarkPointContainer LandmarkPointContainer;
typedef itk::QuaternionRigidTransform<double> QuaternionTransformType;
/**
* \brief Constructor
**/
NavigationDataLandmarkTransformFilter();
~NavigationDataLandmarkTransformFilter() override;
/**
* \brief transforms input NDs according to the calculated LandmarkTransform
*
*/
void GenerateData() override;
/**Documentation
* \brief perform an iterative closest point matching to find corresponding landmarks that will be used for landmark transform calculation
*
* Perform ICP optimization to match source landmarks to target landmarks. Landmark containers must contain
* at least 6 landmarks for the optimization.
* after ICP, landmark correspondences are established and the source landmarks are sorted, so that
* corresponding landmarks have the same indices.
*
- * \param[in] sources Source landmarks that will be mapped to the target landmarks
+ * \param[in,out] sources Source landmarks that will be mapped to the target landmarks. The sources container will be sorted,
+ * so that landmarks have the same index as their corresponding target landmarks.
* \param[in] targets Target landmarks onto which the source landmarks will be mapped
- * \param[out] sources The sources container will be sorted,
- so that landmarks have the same index as their corresponding target landmarks
* \return true if ICP was successful and sources are sorted , false otherwise
*/
bool FindCorrespondentLandmarks(LandmarkPointContainer& sources, const LandmarkPointContainer& targets) const;
/**
* \brief initializes the transform using source and target PointSets
*
* if UseICPInitialization is true, FindCorrespondentLandmarks() will be used to sort the source landmarks in order to
* establish corresponding landmark pairs before the landmark transform is build
*/
void InitializeLandmarkTransform(LandmarkPointContainer& sources, const LandmarkPointContainer& targets);
/**
* \brief calculates the transform using source and target PointSets
*/
void UpdateLandmarkTransform(const LandmarkPointContainer &sources, const LandmarkPointContainer &targets); ///<
void AccumulateStatistics(ErrorVector& vector); ///< calculate error metrics for the transforms.
void PrintSelf( std::ostream& os, itk::Indent indent ) const override; ///< print object info to ostream
mitk::ScalarType m_ErrorMean; ///< Fiducial Registration Error
mitk::ScalarType m_ErrorStdDev; ///< standard deviation of the Fiducial Registration Error
mitk::ScalarType m_ErrorRMS; ///< Root Mean Square of the registration error
mitk::ScalarType m_ErrorMin; ///< minimum registration error / best fitting landmark distance
mitk::ScalarType m_ErrorMax; ///< maximum registration error / worst fitting landmark distance
mitk::ScalarType m_ErrorAbsMax; ///< the absolute maximum registration error
LandmarkPointContainer m_SourcePoints; ///< positions of the source points
LandmarkPointContainer m_TargetPoints; ///< positions of the target points
TransformInitializerType::Pointer m_LandmarkTransformInitializer; ///< landmark based transform initializer
LandmarkTransformType::Pointer m_LandmarkTransform; ///< transform calculated from source and target points
QuaternionTransformType::Pointer m_QuatLandmarkTransform; ///< transform needed to rotate orientation
QuaternionTransformType::Pointer m_QuatTransform; ///< further transform needed to rotate orientation
ErrorVector m_Errors; ///< stores the euclidean distance of each transformed source landmark and its respective target landmark
bool m_UseICPInitialization; ///< find source <--> target point correspondences with iterative closest point optimization
};
} // namespace mitk
#endif /* MITKNavigationDataLandmarkTransformFilter_H_HEADER_INCLUDED_ */
diff --git a/Modules/IGT/Algorithms/mitkNavigationDataToIGTLMessageFilter.h b/Modules/IGT/Algorithms/mitkNavigationDataToIGTLMessageFilter.h
index 2378204f95..b16d9b8e82 100644
--- a/Modules/IGT/Algorithms/mitkNavigationDataToIGTLMessageFilter.h
+++ b/Modules/IGT/Algorithms/mitkNavigationDataToIGTLMessageFilter.h
@@ -1,169 +1,169 @@
/*============================================================================
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 _MITKNAVIGATIONDATATOIGTLMessageFILTER_H__
#define _MITKNAVIGATIONDATATOIGTLMessageFILTER_H__
#include "mitkCommon.h"
#include "mitkPointSet.h"
#include "mitkIGTLMessageSource.h"
#include "mitkNavigationData.h"
#include "mitkNavigationDataSource.h"
namespace mitk {
/**Documentation
*
* \brief This filter creates IGTL messages from mitk::NavigaitionData objects
*
*
* \ingroup IGT
*
*/
class MITKIGT_EXPORT NavigationDataToIGTLMessageFilter : public IGTLMessageSource
{
public:
mitkClassMacro(NavigationDataToIGTLMessageFilter, IGTLMessageSource);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**Documentation
* \brief There are four different operation modes.
*
* - ModeSendQTransMsg: every input NavigationData is processed into one
* output message that contains a position and a orientation (quaternion).
* - ModeSendTransMsg: every input NavigationData is processed into one
* output message that contains a 4x4 transformation.
* - ModeSendQTDataMsg:all input NavigationData is processed into one single
* output message that contains a position and orientation (quaternion) for
* each navigation data.
* - ModeSendTDataMsg:all input NavigationData is processed into one single
* output message that contains a 4x4 transformation for
* each navigation data.
*/
enum OperationMode
{
ModeSendQTransMsg,
ModeSendTransMsg,
ModeSendQTDataMsg,
ModeSendTDataMsg
};
/**
* \brief filter execute method
*/
void GenerateData() override;
using Superclass::SetInput;
/**
* \brief Sets one input NavigationData
*/
virtual void SetInput(const mitk::NavigationData *NavigationData);
/**
* \brief Sets the input NavigationData at a specific index
*/
virtual void SetInput(unsigned int idx, const NavigationData* nd);
/**
* \brief Returns the input of this filter
*/
const mitk::NavigationData* GetInput();
/**
* \brief Returns the input number idx of this filter
*/
const mitk::NavigationData* GetInput(unsigned int idx);
/**
* \brief Sets the mode of this filter.
*
* See OperationMode for the behavior in the different modes
- * \warn A call to this method will change the number of outputs of the filter.
+ * \warning A call to this method will change the number of outputs of the filter.
* After calling this method, all previously acquired pointers to outputs are invalid
* Always set the operation mode first, then get the outputs with GetOutput()
*/
virtual void SetOperationMode(OperationMode mode);
/**
* \brief returns the mode of this filter.
*
* See OperationMode for the behavior in the different modes
*/
itkGetConstMacro(OperationMode, OperationMode);
/**
* empty implementation to prevent calling of the superclass method that
* would try to copy information from the input NavigationData to the output
* PointSet, which makes no sense!
*/
void GenerateOutputInformation() override {};
/**
*\brief Connects the input of this filter to the outputs of the given
* NavigationDataSource
*
* This method does not support smartpointer. use FilterX.GetPointer() to
* retrieve a dumbpointer.
*/
virtual void ConnectTo(mitk::NavigationDataSource * UpstreamFilter);
protected:
NavigationDataToIGTLMessageFilter();
~NavigationDataToIGTLMessageFilter() override;
/**
* \brief Generates the output
*
*/
// virtual void GenerateData();
/**
* \brief Generates the output for ModeSendQTDataMsg
*
*/
virtual void GenerateDataModeSendQTDataMsg();
/**
* \brief Generates the output for ModeSendTDataMsg
*/
virtual void GenerateDataModeSendTDataMsg();
/**
* \brief Generates the output for ModeSendQTransMsg
*
*/
virtual void GenerateDataModeSendQTransMsg();
/**
* \brief Generates the output for ModeSendTransMsg
*/
virtual void GenerateDataModeSendTransMsg();
/**
* \brief create output objects according to OperationMode for all inputs
*/
virtual void CreateOutputsForAllInputs();
OperationMode m_OperationMode; ///< Stores the mode. See enum OperationMode
// unsigned int m_RingBufferSize; ///< Stores the ringbuffer size
unsigned int m_CurrentTimeStep; ///< Indicates the current timestamp
// unsigned int m_NumberForMean; ///< Number of Navigation Data, which should be averaged
/** Converts a mitk::IGTTimestamp (double, milliseconds) to an OpenIGTLink timestamp */
igtl::TimeStamp::Pointer ConvertToIGTLTimeStamp(double IGTTimeStamp);
/** Measurement class to calculate latency and frame count */
};
} // namespace mitk
#endif // _MITKNAVIGATIONDATATOIGTLMessageFILTER_H__
diff --git a/Modules/IGT/Algorithms/mitkNavigationDataToPointSetFilter.h b/Modules/IGT/Algorithms/mitkNavigationDataToPointSetFilter.h
index 3850298b2a..c3284ce805 100644
--- a/Modules/IGT/Algorithms/mitkNavigationDataToPointSetFilter.h
+++ b/Modules/IGT/Algorithms/mitkNavigationDataToPointSetFilter.h
@@ -1,155 +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 _MITKNAVIGATIONDATATOPOINTSETFILTER_H__
#define _MITKNAVIGATIONDATATOPOINTSETFILTER_H__
#include "mitkCommon.h"
#include "mitkPointSet.h"
#include "mitkPointSetSource.h"
#include "mitkNavigationData.h"
#include "MitkIGTExports.h"
namespace mitk {
/**Documentation
*
* \brief This filter creates mitk::PointSet objects from mitk::NavigaitionData objects
*
* This filter has two modes that can be set with SetOperationMode().
* - Mode3D: every input NavigationData is processed into one output pointset. For each call to Update() a point with the ND position will be added to the PointSet
* - Mode4D: one output pointset is generated that contains one point for each input NavigationData. Each call to Update() adds a new timestep to the PointSet that contains new positions for the points.
*
* \ingroup IGT
*
*/
class MITKIGT_EXPORT NavigationDataToPointSetFilter : public PointSetSource
{
public:
mitkClassMacro(NavigationDataToPointSetFilter, PointSetSource);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**Documentation
* \brief There are two different operation modes.
*
* - Mode3D: every input NavigationData is processed into one output pointset that contains a point with the ND position for each Update()
* - Mode3DMean: a defined number of input NavigationData is used to generate a mean position and processed into one output pointset that contains a point with the ND position for each Update()
* - Mode4D: one output pointset is generated that contains one point for each input NavigationData. Each call to Update() adds a new timestep to the PointSet that contains new positions for the points.
* The RingBufferSize limits the number of timesteps in the 4D mode. It currently does _not_ limit the number of points in the 3D mode.
*/
enum OperationMode
{
Mode3D,
Mode3DMean,
Mode4D
};
/**Documentation
* \brief Sets the size for the ring buffer.
*
* The size determines the maximum number of timesteps in 4D mode and the number of points in 3D mode of the output PointSet
*/
itkSetMacro(RingBufferSize, unsigned int);
/**
* \brief Sets the number of Navigation Data, which should be averaged.
*/
itkSetMacro(NumberForMean, unsigned int);
/**
* \brief Gets the number of Navigation Data, which should be averaged.
*/
itkGetMacro(NumberForMean, unsigned int);
/**
* \brief filter execute method
*/
void GenerateData() override;
using Superclass::SetInput;
/**
* \brief Sets one input NavigationData
*/
virtual void SetInput(const mitk::NavigationData *NavigationData);
/**
* \brief Sets the input NavigationData at a specific index
*/
virtual void SetInput(unsigned int idx, const NavigationData* nd);
/**
* \brief Returns the input of this filter
*/
const mitk::NavigationData* GetInput();
/**
* \brief Returns the input number idx of this filter
*/
const mitk::NavigationData* GetInput(unsigned int idx);
/**
* \brief Sets the mode of this filter.
*
* See OperationMode for the behavior in the different modes
- * \warn A call to this method will change the number of outputs of the filter.
+ * \warning A call to this method will change the number of outputs of the filter.
* After calling this method, all previously acquired pointers to outputs are invalid
* Always set the operation mode first, then get the outputs with GetOutput()
*/
virtual void SetOperationMode(OperationMode mode);
/**
* \brief returns the mode of this filter.
*
* See OperationMode for the behavior in the different modes
*/
itkGetConstMacro(OperationMode, OperationMode);
void GenerateOutputInformation() override {}; ///< empty implementation to prevent calling of the superclass method that would try to copy information from the input NavigationData to the output PointSet, which makes no sense!
protected:
NavigationDataToPointSetFilter();
~NavigationDataToPointSetFilter() override;
/**
* \brief Generates the output for Mode3D
*
*/
virtual void GenerateDataMode3D();
/**
* \brief Generates the output for Mode3DMean
*
*/
virtual void GenerateDataMode3DMean();
/**
* \brief Generates the output for Mode4D
*/
virtual void GenerateDataMode4D();
/**
* \brief create output objects according to OperationMode for all inputs
*/
virtual void CreateOutputsForAllInputs();
OperationMode m_OperationMode; ///< Stores the mode. See enum OperationMode
unsigned int m_RingBufferSize; ///< Stores the ringbuffer size
unsigned int m_CurrentTimeStep; ///< Indicates the current timestamp
unsigned int m_NumberForMean; ///< Number of Navigation Data, which should be averaged
};
} // namespace mitk
#endif // _MITKNAVIGATIONDATATOPOINTSETFILTER_H__
diff --git a/Modules/IGT/Common/mitkIGTTimeStamp.h b/Modules/IGT/Common/mitkIGTTimeStamp.h
index 5cc3223c6b..0a030dd564 100644
--- a/Modules/IGT/Common/mitkIGTTimeStamp.h
+++ b/Modules/IGT/Common/mitkIGTTimeStamp.h
@@ -1,186 +1,186 @@
/*============================================================================
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 MITKTIMESTAMP_H_HEADER_INCLUDED_
#define MITKTIMESTAMP_H_HEADER_INCLUDED_
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <MitkIGTExports.h>
#include "mitkRealTimeClock.h"
namespace mitk {
/**
* \brief Time stamp in milliseconds
*
* This class provides a timestamp in milliseconds.
* It is a Singleton class, that internally uses a mitkRealTimeClock() for
* time-acquisition.
*
* First you have to call Start() in order to set the reference-time to the current time.
* If the user has not created and set his own "RealTimeClock", initialize() will be called and a
* default mitkRealTimeClock() is created.
* In addition the TimeStamp() saves a pointer to the device calling and the respective offset-time.
* The first device will have an offset of 0, the following's offset will be the time elapsed since the
* starting of the first device. This offset can be prompted by calling GetOffset();
*
* You can always get the time elapsed since calling Start() with GetElapsed(). It returns the
* time spent in milliseconds as a double.
*
* When the TimeStamp is no longer used, you can call Stop(). This erases the pointer to the device
* and the offset. When all devices have "stopped tracking" the reference-time and the current-time are reset to 0.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT IGTTimeStamp : public itk::Object
{
public:
mitkClassMacroItkParent(IGTTimeStamp, itk::Object);
/**
* \brief creates a new instance of mitkTimeStamp
*
* This method returns a pointer to the currently existing TimeStamp.
* If there is no exisiting instance, a new one is created and returned automatically
*
* DECREPATED: Use GetInstance instead
*/
static IGTTimeStamp* CreateInstance();
/**
* \brief returns a pointer to the current instance of mitkTimeStamp
*
* This method returns a pointer to the currently existing TimeStamp.
* If there is no exisiting instance, a new one is created and returned automatically
*/
static IGTTimeStamp* GetInstance();
/**
* \brief starts the time-acquisition
*
* Each device is to call this method when it starts tracking.
* The current time is saved as a reference-value (m_Time = 0).
* Internally the device (pointer) and its offset are saved in a map, so that
* no device can call this method twice.
* If the user has not set its own RealTimeClock, a default one is created dependant on the OS
* in use.
*
*/
void Start( itk::Object::Pointer device );
/**
* \brief stops the time-acqusition
*
* Each device has to call Stop() when it has finished and its
* pointer will be erased from the map. When the last device has "stopped"
* the reference-time and the current-time will be reset to 0.
*
*/
void Stop( itk::Object::Pointer device );
/**
* \brief returns the time elapsed since calling Start() for the first time in milliseconds
*
* GetElapsed() returns the time elapsed since Start() has been called first, no matter
* which itk::Object did the call.
* This method-call can be used if you want to need to have several processes you want to
* monitor and need timestamps in the same space of time, e.g. when using two tracking-devices
* on the same experiment.
*/
double GetElapsed();
/**
* \brief returns the time elapsed since 'device' called Start() in milliseconds
*
* GetElapsed(itk::Object device) returns the time elapsed since the given itk::Object called
* Start().
* This overloaded method should be used when you only have one independent process to keep
* track of, e.g. when you want to measure how long it takes to execute a piece of code.
*/
double GetElapsed(itk::Object::Pointer device);
/**
* \brief returns the offset of this device's starting-time to the
* reference-time in ms
*
* Device 'A' is the first device to call Start(). Device 'B' calls Start()
* some time later. This time-difference is the offset, that each device has realtive to the
* device that started the time-acquisition.
* Each device's offset is stored in a map with a pointer to the device.
*
* If this device has not been or is no longer saved in the map of devices,
* -1 will be returned.
*
*
* only used internally
*/
double GetOffset(itk::Object::Pointer Device);
/**
* \brief setter for the internally used RealTimeClock()
*
* If you want to use a "third-party" RealTimeClock, e.g PocoRealTimeClock, BoostRealTimeClock
* or ITKRealTimeClock, you can set it using this method:
- * mitk::<bla>RealTimeClock::Pointer RealTimeClock = mitk::<bla>RealTimeClock::New();
+ * auto RealTimeClock = mitk::RealTimeClock::New();
* mitk::TimeStamp::GetInstance()->SetRealTimeClock(RealTimeClock);
*
* Right now, none of these RealTimeClocks have been implemented!!
*
* Notice: The mitk-implementation of an os-dependant RealTimeClock is used
* by default.
*/
void SetRealTimeClock(mitk::RealTimeClock::Pointer Clock);
/**
* \brief creates a new RealTimeClock
*
* Instanciates a new RealTimeClock, that will be specific for the Operating System.
* This will only be called internally when no other RealTimeClock has been set
* by the user.
*
*/
void Initialize();
protected:
IGTTimeStamp();
~IGTTimeStamp() override;
double GetCurrentStamp();
/* the current timestamp when GetCurrentStamp() is called. */
double m_Time;
/* the timestamp in ms acquired when Start() was called. */
double m_ReferenceTime;
/* pointer to the RealTimeClock used internally */
mitk::RealTimeClock::Pointer m_RealTimeClock;
/* pointer to the current instance */
static mitk::IGTTimeStamp::Pointer s_Instance;
/* map, in which pointer to all devices calling Start(), are saved */
std::map<itk::Object::Pointer, double> m_DeviceMap;
std::map<itk::Object::Pointer, double>::iterator m_MapIterator;
};
} // namespace mitk
#endif /* MITKTIMESTAMP_H_HEADER_INCLUDED_ */
diff --git a/Modules/IGT/Documentation/doxygen/IGTModule.dox b/Modules/IGT/Documentation/doxygen/IGTModule.dox
index 166360cc87..db913f7312 100644
--- a/Modules/IGT/Documentation/doxygen/IGTModule.dox
+++ b/Modules/IGT/Documentation/doxygen/IGTModule.dox
@@ -1,78 +1,78 @@
/**
\page NavigationGeneralModulePage IGT Navigation Module
\section IGTGeneralModulePageOverview Overview
Navigation modules consist of IGT (Tracking devices), US (Ultrasound) and TOF (3D range imaging) modules. Each module is separated into UI dependent and independent modules (e.g. IGT and IGTUI module). The navigation modules are based on the OpenCVVideoSupport modules and OpenIGTLink modules. In addition, there is the basic module IGTBase, which holds general functionality for all navigation modules.
-Most navigation modules support hardware devices. A current list of all supported devices can be found here: <a href="http://mitk.org/wiki/Hardware_Support"> Hardware Support</a>.
+Most navigation modules support hardware devices. A current list of all supported devices can be found here: <a href="https://www.mitk.org/wiki/Hardware_Support"> Hardware Support</a>.
\section IGTModules IGT modules
The module IGT integrates image guided therapy (IGT) functionality to MITK. The main features of MITK-IGT are:
<ul>
<li> handling and processing of medical imaging data which is available through MITK itself
<li> support of tracking devices
<li> a concept for processing tracking data
</ul>
MITK-IGT consists of two layers for hardware control (Tracking Layer) and processing of tracking data (Navigation Layer). Additionally it offers components for rapid development of graphicalt user interfaces (GUIs) of navigation applications. To separate UI functionality from the rest of the code UI classes are encapsulated in the separate module IGT-UI.
The IGT documentation contains the following pages:
<ul>
<li> \ref IGTConcepts - A general overview of the concepts used within the IGT module for acquiring and processing tracking data
<li> \ref IGTTutorialOverview - This tutorial will guide you step by step through all plugins, modules and documentation pages. It contains the following steps:
<ul>
<li> \ref org_mitk_gui_qt_igttracking - Step 1: This tutorial step explains the usage of the most important IGT plugins
<li> \ref IGTTutorialStepFilterPipeline - Step 2: This tutorial step on how to implement an IGT filter pipeline
<li> \ref IGTTutorialStepVisualization - Step 3: This tutorial step creates a simple render window to visualize tracking tools.
<li> \ref IGTTutorialStepSimplePlugin - Step 4: This tutorial step shows you how to create a simple plugin for tracking
<li> \ref IGTTutorialStepTrackingLab - Step 5: This tutorial step gives step-by-step explanations on how to use the example tracking lab by registering a book of your choice.
<li> \ref IGTTutorialStepAdvanced - Step 6: This step revises the code of the IGT plugins from the first step in more depth
<li> \ref IGTTutorialStepOpenIGTLink - Step 7: This tutorial step gives an overview about OpenIGTLink in MITK
<li> \ref IGTHowToImplementATrackingDevice - Step 8: This guideline is for an implementation of your own tracking device
</ul>
<li> \ref org_mitk_gui_qt_igttracking - Overview of all tracking views which could be used for your application
<ul>
<li> \ref org_mitk_views_igttrackingtoolbox - Connect your tracking device and start tracking
<li> \ref org_mitk_views_igtnavigationtoolmanager - Edit your tool storage
<li> \ref org_mitk_views_navigationdataplayer - Play your navigation data, e.g. recorded with the tracking toolbox
</ul>
<li> \ref org_mitk_gui_qt_igtexample - Overview of the example plugin
<ul>
<li> \ref org_imageguidedtherapytutorial - The plugin which is created in Step \ref IGTTutorialStepSimplePlugin
<li> \ref org_igttrackinglab - The IGT-TrackingLab view which is described in step \ref IGTTutorialStepTrackingLab
<li> \ref org_openigtlinkexample OpenIGTLink client example
<li> \ref org_openigtlinkproviderexample OpenIGTLink server example
<li> \ref org_openigtlinkplugin An extended OpenIGTLink example
</ul>
</ul>
\section USModules US modules
\li The ultrasound user manual: \ref USModulePage
\section TOFModules TOF modules
\ref org_toftutorial
An explanation on how to create a TOF Module can be found here:
\li \subpage GeneratingDeviceModulesPage
-*/
\ No newline at end of file
+*/
diff --git a/Modules/IGT/Documentation/doxygen/IGTTutorialStep1.dox b/Modules/IGT/Documentation/doxygen/IGTTutorialStep1.dox
index 70e2401526..0cdcbbddd0 100644
--- a/Modules/IGT/Documentation/doxygen/IGTTutorialStep1.dox
+++ b/Modules/IGT/Documentation/doxygen/IGTTutorialStep1.dox
@@ -1,70 +1,70 @@
/**
\page IGTTutorialStepFilterPipeline IGT filter pipeline
The IGT tutorial consists of four main parts for construction of a small navigation pipeline using a virtual tracking device.
The virtual tracking device produces random tool data (position and orientation) so no additional hardware is required.
The full code of this small navigation pipeline included in this tutorial can be found in MITK-Source/Modules/IGT/Tutorial/mitkIGTTutorialStep1.cpp.
At the very end of this page, you can find build instructions on how to run this example on your computer.
\snippet mitkIGTTutorialStep1.cpp What we will do
\section IGT_Tracking_Layer Tracking Layer
Firstly a new object "tracker" of the type mitk::VirtualTrackingDevice is created, then two tools, named "tool1" and "tool2",
are added to this tracker. Since the tracking device "tracker" is treated as a virtual tracking
device, tool1 and tool2 are just added to the object by method AddTool(name) and don't need further specification (e.g. real tools might need a calibration file).
\snippet mitkIGTTutorialStep1.cpp Part I Basic 1
\section IGT_Navigation_Layer Navigation Layer
\imageMacro{IGTTutorialStep1.png,"",15.90}
Secondly, a new source of the type mitk::TrackingDeviceSource has to be created with outputs for each single tool of a tracker.
The source sets the following tracking device by using method SetTrackingDevice as shown below.
So now, the source is initialized with the virtual tracking device. Next, the source is connected and tracking is started.
\snippet mitkIGTTutorialStep1.cpp Part I Basic 2
In part II, a displacemt filter (object "displacer") is constructed to change the positions of the filtered NavigationData objects
with an offset for each direction (X,Y,Z). The given filter has inputs and outputs for each tool, in this example we have two tools. Hence, there exist two inputs and outputs. Every output of the displacement filter object is connected to the recorder object in the next part.
\snippet mitkIGTTutorialStep1.cpp Part II
\section IGT_Record_Navigation_Data Record Navigation Data
In part III, all the NavigationData is recorded with the NavigationDataRecorder. In order to record, we simply create
an object "recorder" of the type mitk::NavigationDataRecorder and set the appropriate file to it. Now the displacer object is connected to the
recorder object, the method StartRecording() is called on the next line. Afterwards,
the recorder has to be updated a couple of times. In this example the recorder is updating 100 times through
a for-loop statement. This can also be seen as a simulation of a timer by using a for-loop.
\snippet mitkIGTTutorialStep1.cpp Part III: Record the data with the NavigationDataRecorder
\section IGT_Play_Navigation_Data Play Navigation Data
Part IV explains how the recoded file can be played for further use. After the object "player" of a type mitk::NavigationDataSequentialPlayer
is created, the required file has to be set to the player and playing has to be started. Here, there exists a new pipeline which functions by reading
the recorded file from the harddisc and plays it by using the player as source. During the play, the for-loop makes the file update as in part III.
\imageMacro{IGTTutorialStep1-2.png,"",9.53}
\snippet mitkIGTTutorialStep1.cpp Part IV: Play the data with the NavigationDataPlayer
\section IGTTutStep1Build IGT Example Build Instructions
This tutorial is an extra target which can be build separately. Make sure, you selected the Navigation option in cmake during your superbuild (set MITK_BUILD_CONFIGURATION to mitkNavigation modules) or select the MITK_BUILD_org.mitk.gui.qt.igtexamples on your MITK-build and make sure that all dependencies are build.
<b> Visual Studio: </b> Right click in your solution explorer on MITKIGTTutorialStep1 --> Set as start up project --> build & Start without debugging. A new window will open.
\imageMacro{IGTTutorialStep1_buildInstrWindows.png,"",5}
<b> Qt creator: </b> Select MITKIGTTutorialStep1 as Project (see screenshot below) and build and run the project. The output can be found in the QT creator console.
\imageMacro{IGTTutorialStep1_buildInstrLinux.png,"",5}
Your output should look similar to this:
\imageMacro{IGTTutorialStep1_output.png,"",9.53}
-\ref Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
+Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
*/
\ No newline at end of file
diff --git a/Modules/IGT/Documentation/doxygen/IGTTutorialStep2.dox b/Modules/IGT/Documentation/doxygen/IGTTutorialStep2.dox
index efc3896159..6b8e65be8b 100644
--- a/Modules/IGT/Documentation/doxygen/IGTTutorialStep2.dox
+++ b/Modules/IGT/Documentation/doxygen/IGTTutorialStep2.dox
@@ -1,55 +1,55 @@
/**
\page IGTTutorialStepVisualization IGT Visualization Filter and MITK Concepts
The following code shows how to insert IGT tracking data into an mitk::DataStorage and render the data with the mitk::NavigationDataObjectVisualizationFilter in an mitk::RenderWindow. The full code is shown below and can be found in MITK-Source/Modules/IGT/Tutorial/mitkIGTTutorialStep2.cpp.
This tutorial is an extra target which can be build separately (see \ref IGTTutStep1Build).
The example we are using here regards a moving tracker and a fixed object, and after tracking a transform to move the fixed object to the tracked one is calculated and applied.
\snippet mitkIGTTutorialStep2.cpp What we will do
The next image describes, what happens in this example. The blue and red object are labeled with "1" at their initial position. Next, the blue object will move (approximately along the yellow arrow) to the second position, while the red one stayes fixed. Now we calculate the transform of the blue cones initial and moved position (1 -> 2) and apply this transform to shift the red object to its final position (3). Now, the relative distance and orientation of the blue and red object is as it was in the beginning.
\imageMacro{IGTTutorialStep2_overview.png,"Overlay of the three steps in this example: 1. Initial position\, 2. Blue object moved along the yellow arc\, 3. Final position\, the red object is moved to get the initial relative position compared to the blue object.",9.53}
\section igtTut2sec1 Set up Render Window and Tracking Device
First of all, we create a new render window. For simplicity, we are not using the MITK workbench yet but run this example as a stand alone application. Hence, we need to create a render window and a data storage.
\snippet mitkIGTTutorialStep2.cpp Render Window
Next, we need to set up the tracking device like we did in the last tutorial step \ref IGTTutorialStepFilterPipeline . We set additionally some boundaries for the tracking.
\snippet mitkIGTTutorialStep2.cpp Setup Tracking Device
\section igtTut2sec2 Create Objects
Now we create a fixed and a moving object. For the moving (tracked) object, we decided for a blue cone. First, we set the name and color and add it to the data storage. Next, we need to create a visualitation filter to display it. Here, we connect in the visualization filter the output of our tracking device source to the cone representation.
\snippet mitkIGTTutorialStep2.cpp Moving Object
The fixed object is created accordingly, with a cylindrical shape and red color. As it is not tracked, we define an initial position and orientation, set it to the cylinder object and also store it as fixedNavigationData for later usage. As the object is not continuously updated, we don't need a visualization filter.
\snippet mitkIGTTutorialStep2.cpp Fixed Object
\section igtTut2sec3 The Tracking loop
Before we start tracking, we need to initialize the rendering manager.
\snippet mitkIGTTutorialStep2.cpp Initialize views
We now move the tracked blue cone object for 75 steps, update the rendering and print the position to the output console.
\snippet mitkIGTTutorialStep2.cpp Tracking
\section igtTut2sec4 Final Transform
Finally, we apply the new position of the tracked object (source->GetOutput) to the stored fixedNavigationData transform and update the rendering one last time.
\snippet mitkIGTTutorialStep2.cpp Calculate Transform
The red cylinder is now moved accodring to the tracked transform.
-\ref Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
+Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
*/
\ No newline at end of file
diff --git a/Modules/IGT/Documentation/doxygen/IGTTutorialStep3.dox b/Modules/IGT/Documentation/doxygen/IGTTutorialStep3.dox
index 5ff38de0f7..2f70a95456 100644
--- a/Modules/IGT/Documentation/doxygen/IGTTutorialStep3.dox
+++ b/Modules/IGT/Documentation/doxygen/IGTTutorialStep3.dox
@@ -1,17 +1,17 @@
/**
\page IGTTutorialStepSimplePlugin IGT QT Tutorial
This tutorial shows how to integrate IGT in your plugin. You can enable this example in cmake with the
option: MITK_BUILD_org.mitk.gui.qt.igtexamples.
\imageMacro{IGTTutorialStep3_cmake.png,"",15.90}
The code of the plugin/view is located in:
MITK-Source/Plugins/org.mitk.gui.qt.igtexamples/src/internal/QmitkIGTTutorialView .
The plugin will automatically be lodaed in the mitkWorkbench.
Please read the manual page on how to use this example: \ref org_imageguidedtherapytutorial
-\ref Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
+Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
*/
\ No newline at end of file
diff --git a/Modules/IGT/Documentation/doxygen/IGTTutorialStep4.dox b/Modules/IGT/Documentation/doxygen/IGTTutorialStep4.dox
index 68b9bfc2a9..6b6e87a2d5 100644
--- a/Modules/IGT/Documentation/doxygen/IGTTutorialStep4.dox
+++ b/Modules/IGT/Documentation/doxygen/IGTTutorialStep4.dox
@@ -1,17 +1,17 @@
/**
\page IGTTutorialStepTrackingLab Tracking Lab
The tracking lab is an IGT plugin containing various functions. You can enable this example in CMake with the
option: MITK_BUILD_org.mitk.gui.qt.igtexamples.
\imageMacro{IGTTutorialStep3_cmake.png,"",15.90}
The code of the plugin/view is located in:
MITK-Source/Plugins/org.mitk.gui.qt.igtexamples/src/internal/QmitkIGTTrackingLabView .
The plugin will automatically be lodaed in the mitkWorkbench.
Please read the manual page on how to use this example: \ref org_igttrackinglab
-\ref Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
+Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
*/
\ No newline at end of file
diff --git a/Modules/IGT/Documentation/doxygen/IGTTutorialStep5.dox b/Modules/IGT/Documentation/doxygen/IGTTutorialStep5.dox
index b3d6eff801..e7f0970e25 100644
--- a/Modules/IGT/Documentation/doxygen/IGTTutorialStep5.dox
+++ b/Modules/IGT/Documentation/doxygen/IGTTutorialStep5.dox
@@ -1,72 +1,67 @@
/**
\page IGTTutorialStepAdvanced A deeper look into the IGT Plugins
We already know the three views of the IGT tracking plugin from the first tutorial step (\ref org_mitk_gui_qt_igttracking): \ref org_mitk_views_igttrackingtoolbox , \ref org_mitk_views_igtnavigationtoolmanager and \ref org_mitk_views_navigationdataplayer . While the first tutorial step only dealt with the usage of these views, we now want to have a deeper look at some parts of the code.
\section Widgets IGT Widgets
A lot of the IGT functionality is available as a widget. So if you need some part of it for your own plugin, you might just want to include the widget. This is for example done for the QmitkNavigationToolCreationWidget, which is used in the \ref org_mitk_views_igttrackingtoolbox view as well as in the \ref org_mitk_views_igtnavigationtoolmanager view.
\imageMacro{IGTTutorialStep5_Widgets.png,"",15.90}
\section DataAccess Data access
The fist important question is, how to get the tools you want to use for your application. The most simple way is using the \ref org_mitk_views_igtnavigationtoolmanager to load, create or edit the tools and access it via the NavigationToolStorage. It's provided by a microservice and you can access it e.g. via the module context (make sure, your module depends on IGT):
us::ModuleContext* context = us::GetModuleContext();
std::vector<us::ServiceReference <mitk::NavigationToolStorage> > refs = context->GetServiceReferences<mitk::NavigationToolStorage>();
m_ToolStorage = context->GetService<mitk::NavigationToolStorage>(refs.front());
Then, simply access the tools by
m_ToolStorage->GetTool();
There are also many different functions available, e.g. providing the number of available tools or the name of the current tracking device. Just have a look at the documentation of the mitk::NavigationToolStorage if you are interested in it.
\section AutoLoad Autoload all parameters from last session
To increase the usability of the application, the tracking toolbox restores all parameters from the last session. Therefore, we will use the following code to save all parameters. It is also used in the specific tracking device widgets, but we will just have a look at one example, restoring some parameters like the Show-Tracking-Volume-Checkbox, the filename of the autosave path of the tool storage or the index of the tracking volume.
To store the settings, the following code is used:
\snippet QmitkMITKIGTTrackingToolboxView.cpp StoreUISettings
We will reload it with
\snippet QmitkMITKIGTTrackingToolboxView.cpp LoadUISettings
\section LoadToolStorage Load Tool Storage
This code will load a previously stored or autosaved tool storage:
\snippet QmitkMITKIGTTrackingToolboxView.cpp LoadToolStorage
\section ThreadedTracking Threaded Tracking
Usually, the tracking is done in a separate thread in order to still allow parallel usage of the workbench. If we track the devices in the same thread, the workbench might freeze.
That's why we use thread workers
\snippet QmitkMITKIGTTrackingToolboxView.cpp Thread 1
...which are connected to functions
\snippet QmitkMITKIGTTrackingToolboxView.cpp Thread 3
The thread will be startet, if we connect a tracking device by pushing the connect button or start tracking etc:
\snippet QmitkMITKIGTTrackingToolboxView.cpp Thread 4
...and finished afterwards:
\snippet QmitkMITKIGTTrackingToolboxView.cpp Thread 5
You can access the data from the worker thread if needed:
\snippet QmitkMITKIGTTrackingToolboxView.cpp Thread 6
Which of the functions is finally executed will be chosen in the ThreadFunc:
-\snippet QmitkMITKIGTTrackingToolboxView.cpp Thread 7
+\snippet QmitkMITKIGTTrackingToolboxViewWorker.cpp Thread 7
To deconstruct the workers, we first terminate the threads and then delete them
\snippet QmitkMITKIGTTrackingToolboxView.cpp Thread 2
-
-
-
-
-
-\ref Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
+Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
*/
\ No newline at end of file
diff --git a/Modules/IGT/Documentation/doxygen/IGTTutorialStep6.dox b/Modules/IGT/Documentation/doxygen/IGTTutorialStep6.dox
index 664f5d7186..357e961b44 100644
--- a/Modules/IGT/Documentation/doxygen/IGTTutorialStep6.dox
+++ b/Modules/IGT/Documentation/doxygen/IGTTutorialStep6.dox
@@ -1,10 +1,10 @@
/**
\page IGTTutorialStepOpenIGTLink OpenIGTLink Tutorial
\li \subpage org_openigtlinkexample
\li \subpage org_openigtlinkproviderexample
\li \subpage org_openigtlinkplugin
-\ref Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
+Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
*/
\ No newline at end of file
diff --git a/Modules/IGT/Rendering/mitkNavigationDataObjectVisualizationFilter.h b/Modules/IGT/Rendering/mitkNavigationDataObjectVisualizationFilter.h
index 42871e0337..d19771f2fc 100644
--- a/Modules/IGT/Rendering/mitkNavigationDataObjectVisualizationFilter.h
+++ b/Modules/IGT/Rendering/mitkNavigationDataObjectVisualizationFilter.h
@@ -1,176 +1,177 @@
/*============================================================================
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 MITKNAVIGATIONDATAOBJECTVISUALIZATIONFILTER_H_HEADER_INCLUDED_
#define MITKNAVIGATIONDATAOBJECTVISUALIZATIONFILTER_H_HEADER_INCLUDED_
#include "mitkNavigationDataToNavigationDataFilter.h"
#include "mitkNavigationData.h"
#include "mitkBaseData.h"
namespace mitk {
/**
* \brief Class that reads NavigationData from input and transfers the information to the geometry of the associated BaseData
*
* Derived from NavigationDataToNavigationDataFilter
*
* \ingroup IGT
*/
class MITKIGT_EXPORT NavigationDataObjectVisualizationFilter : public NavigationDataToNavigationDataFilter
{
public:
mitkClassMacro(NavigationDataObjectVisualizationFilter, NavigationDataToNavigationDataFilter);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/** Defines the rotation modes of this tracking device which results in different representations
* of quaternions.
*
* - Standard: normal representation, rawdata from the device is not changed (DEFAULT)
*
* - Transposed: the rotation is stored transposed, which is (by mistake!) expected by some older MITK classes due
* to an ambigious method naming in VNL.
*
* CAUTION: The rotation mode can only be changed for backward compatibility of old WRONG code.
* PLEASE DO NOT CHANGE THE ROTATION MODE UNLESS YOU ARE KNOWING EXACTLY WHAT YOU ARE DOING!
*
* use SetRotationMode to change the mode.
*/
enum RotationMode {RotationStandard, RotationTransposed};
/**
* \brief Smart Pointer type to a BaseData.
*/
typedef BaseData::Pointer RepresentationPointer;
/**
* \brief STL map of index to BaseData . Using map to be able to set non continuous indices
*/
typedef std::map<unsigned int, RepresentationPointer> RepresentationPointerMap;
/**
* \brief STL vector map of index to BaseData . Using map to be able to set non continuous indices
*/
typedef std::map<unsigned int, std::vector<RepresentationPointer>> RepresentationVectorPointerMap;
/**
* \brief Size type of an std::vector
*/
typedef RepresentationVectorPointerMap::size_type RepresentationPointerMapSizeType;
/**
* \brief Set the representation object of the input
*
* \param data The BaseData to be associated to the index
* \param index the index with which data will be associated
*/
void SetRepresentationObject(unsigned int index, BaseData::Pointer data);
/**
* \brief Set the representation objects vector of the input
*
* \param data The BaseData vector to be associated to the index
* \param index the index with which data will be associated
*/
void SetRepresentationObjects(unsigned int index, const std::vector<BaseData::Pointer> &data);
/**
* \brief Get the representation object associated with the index idx
*
* \param idx the corresponding input number with which the BaseData is associated
* \return Returns the desired BaseData if it exists for the given input; Returns nullptr
* if no BaseData was found.
*/
BaseData::Pointer GetRepresentationObject(unsigned int idx) const;
/**
* \brief Get all the representation objects associated with the index idx
*
* \param idx the corresponding input number with which the BaseData is associated
* \return Returns the desired BaseData if it exists for the given input; Returns nullptr
* if no BaseData was found.
*/
std::vector<RepresentationPointer> GetAllRepresentationObjects(unsigned int idx) const;
virtual void SetTransformPosition(unsigned int index, bool applyTransform); ///< if set to true, the filter will use the position part of the input navigation data at the given index to transform the representation object. If set to false, it will not. If no value is set, it defaults to true.
virtual bool GetTransformPosition(unsigned int index) const; ///< returns whether position part of the input navigation data at the given index is used for the transformation of the representation object.
virtual void TransformPositionOn(unsigned int index); ///< sets the TransformPosition flag to true for the given index
virtual void TransformPositionOff(unsigned int index); ///< sets the TransformPosition flag to false for the given index
virtual void SetTransformOrientation(unsigned int index, bool applyTransform); ///< if set to true, the filter will use the orientation part of the input navigation data at the given index to transform the representation object. If set to false, it will not. If no value is set, it defaults to true.
virtual bool GetTransformOrientation(unsigned int index) const; ///< returns whether orientation part of the input navigation data at the given index is used for the transformation of the representation object.
virtual void TransformOrientationOn(unsigned int index); ///< sets the TransformOrientation flag to true for the given index
virtual void TransformOrientationOff(unsigned int index); ///< sets the TransformOrientation flag to false for the given index
/** @brief Defines an offset for a representation object. This offset is applied before the object is visualized.
* If no offset is given, no offset will be used. To deactivate the offset just set it to nullptr. The offset is deactivated by default.
+ * @param index
* @param offset The new offset which will be set. Set to nullptr to deactivate the offset.
*/
void SetOffset(int index, mitk::AffineTransform3D::Pointer offset);
/** Sets the rotation mode of this class. See documentation of enum RotationMode for details
* on the different modes.
* CAUTION: The rotation mode can only be changed for backward compatibility of old WRONG code.
* PLEASE DO NOT CHANGE THE ROTATION MODE UNLESS YOU ARE KNOWING EXACTLY WHAT YOU ARE DOING!
*/
virtual void SetRotationMode(RotationMode r);
/** @return Returns the offset of a represenation object. Returns nullptr if there is no offset. */
mitk::AffineTransform3D::Pointer GetOffset(int index);
/**
*\brief Get the number of added BaseData associated to NavigationData
* \return Returns the size of the internal map
*/
RepresentationPointerMapSizeType GetNumberOfToolRepresentations() const
{
return m_RepresentationVectorMap.size();
}
/*
* \brief Transfer the information from the input to the associated BaseData
*/
void GenerateData() override;
protected:
typedef std::map<itk::ProcessObject::DataObjectPointerArraySizeType, bool> BooleanInputMap;
typedef std::map<unsigned int, mitk::AffineTransform3D::Pointer> OffsetPointerMap;
/**
* \brief Constructor
**/
NavigationDataObjectVisualizationFilter();
/**
* \brief Destructor
**/
~NavigationDataObjectVisualizationFilter() override;
/**
* \brief An array of the BaseData which represent the tools.
*/
RepresentationVectorPointerMap m_RepresentationVectorMap;
BooleanInputMap m_TransformPosition; ///< if set to true, the filter will use the position part of the input navigation data at the given index for the calculation of the transform. If no entry for the index exists, it defaults to true.
BooleanInputMap m_TransformOrientation; ///< if set to true, the filter will use the orientation part of the input navigation data at the given index for the calculation of the transform. If no entry for the index exists, it defaults to true.
OffsetPointerMap m_OffsetList;
private:
RotationMode m_RotationMode; ///< defines the rotation mode Standard or Transposed, Standard is default
};
} // namespace mitk
#endif /* MITKNAVIGATIONDATAOBJECTVISUALIZATIONFILTER_H_HEADER_INCLUDED_ */
diff --git a/Modules/IGT/Testing/mitkOpenIGTLinkTrackingDeviceTest.cpp b/Modules/IGT/Testing/mitkOpenIGTLinkTrackingDeviceTest.cpp
index 1f115abd99..21b9c1776d 100644
--- a/Modules/IGT/Testing/mitkOpenIGTLinkTrackingDeviceTest.cpp
+++ b/Modules/IGT/Testing/mitkOpenIGTLinkTrackingDeviceTest.cpp
@@ -1,83 +1,84 @@
/*============================================================================
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.
============================================================================*/
//testing headers
#include <mitkTestingMacros.h>
#include <mitkTestFixture.h>
//headers of IGT classes releated to the tested class
#include <mitkOpenIGTLinkTrackingDevice.h>
//sleep headers
#include <chrono>
#include <thread>
class mitkOpenIGTLinkTrackingDeviceTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkOpenIGTLinkTrackingDeviceTestSuite);
MITK_TEST(TestInstantiation);
MITK_TEST(TestSetConnectionParameters);
MITK_TEST(TestDiscoverToolMethod);
CPPUNIT_TEST_SUITE_END();
private:
/** Members used inside the different test methods. All members are initialized via setUp().*/
mitk::OpenIGTLinkTrackingDevice::Pointer m_OpenIGTLinkTrackingDevice;
public:
/**@brief Setup Always call this method before each Test-case to ensure correct and new intialization of the used members for a new test case. (If the members are not used in a test, the method does not need to be called).*/
void setUp() override
{
m_OpenIGTLinkTrackingDevice = mitk::OpenIGTLinkTrackingDevice::New();
}
void tearDown() override
{
}
void TestInstantiation()
{
// let's create objects of our classes
mitk::OpenIGTLinkTrackingDevice::Pointer testDevice = mitk::OpenIGTLinkTrackingDevice::New();
CPPUNIT_ASSERT_MESSAGE("Testing instantiation of OpenIGTLinkTrackingDevice",testDevice.IsNotNull());
}
void TestSetConnectionParameters()
{
m_OpenIGTLinkTrackingDevice->SetHostname("localhost");
m_OpenIGTLinkTrackingDevice->SetPortNumber(10);
CPPUNIT_ASSERT_MESSAGE("Testing method SetHostname() ...", m_OpenIGTLinkTrackingDevice->GetHostname()=="localhost");
CPPUNIT_ASSERT_MESSAGE("Testing method SetPort() ...", m_OpenIGTLinkTrackingDevice->GetPortNumber()==10);
}
void TestDiscoverToolMethod()
{
CPPUNIT_ASSERT_MESSAGE("Testing DiscoverTools() without initialization. (Warnings are expected)", m_OpenIGTLinkTrackingDevice->DiscoverTools()==false);
m_OpenIGTLinkTrackingDevice->SetPortNumber(10);
CPPUNIT_ASSERT_MESSAGE("Testing DiscoverTools() with initialization, but without existing server. (Warnings are expected)", m_OpenIGTLinkTrackingDevice->DiscoverTools()==false);
- m_OpenIGTLinkTrackingDevice->SetHostname("193.174.50.103");
+ // This takes a pretty long time but it is not tested.
+ /*m_OpenIGTLinkTrackingDevice->SetHostname("193.174.50.103");
m_OpenIGTLinkTrackingDevice->SetPortNumber(18944);
m_OpenIGTLinkTrackingDevice->DiscoverTools(20000);
m_OpenIGTLinkTrackingDevice->OpenConnection();
m_OpenIGTLinkTrackingDevice->StartTracking();
std::this_thread::sleep_for(std::chrono::seconds(20));
m_OpenIGTLinkTrackingDevice->StopTracking();
- m_OpenIGTLinkTrackingDevice->CloseConnection();
+ m_OpenIGTLinkTrackingDevice->CloseConnection();*/
}
};
MITK_TEST_SUITE_REGISTRATION(mitkOpenIGTLinkTrackingDevice)
diff --git a/Modules/IGT/TrackingDevices/mitkOptitrackTrackingDevice.h b/Modules/IGT/TrackingDevices/mitkOptitrackTrackingDevice.h
index f64edb5924..a575d23c11 100644
--- a/Modules/IGT/TrackingDevices/mitkOptitrackTrackingDevice.h
+++ b/Modules/IGT/TrackingDevices/mitkOptitrackTrackingDevice.h
@@ -1,320 +1,320 @@
/*============================================================================
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 OptitrackTrackingDevice_H_HEADER_INCLUDED
#define OptitrackTrackingDevice_H_HEADER_INCLUDED
#include <MitkIGTExports.h>
#include <mitkTrackingDevice.h>
#include <itkMultiThreader.h>
#include <mitkTrackingTypes.h>
#include <mitkIGTTimeStamp.h>
#include <itkFastMutexLock.h>
#include <itksys/SystemTools.hxx>
#include <itkMutexLockHolder.h>
#include <string>
#include <cstdlib>
#include <cstdio>
#include <ctime>
/**
* \brief IGT Exceptions
*/
#include "mitkIGTIOException.h"
#include "mitkIGTTimeStamp.h"
#include "mitkIGTException.h"
/**
* \brief OptitrackTrackingTools
*/
#include "mitkOptitrackTrackingTool.h"
/**
* \brief MutexHolder to keep rest of Mutex
*/
typedef itk::MutexLockHolder<itk::FastMutexLock> MutexLockHolder;
namespace mitk
{
/** Documentation:
* \brief An object of this class represents the Optitrack device. You can add tools to this
* device, then open the connection and start tracking. The tracking device will then
* continuously update the tool coordinates. Remember that it will be necessary to
* to have a license for using the Optitrack System.
* See http://www.naturalpoint.com/ for details.
* \author E. Marinetto (emarinetto@hggm.es) Instituto de Investigación Sanitaria Gregorio Marañón, Madrid, Spain. & M. Noll (matthias.noll@igd.fraunhofer.de) Cognitive Computing & Medical Imaging | Fraunhofer IGD
* \ingroup IGT
*/
class MITKIGT_EXPORT OptitrackTrackingDevice : public mitk::TrackingDevice
{
friend class OptitrackTrackingTool;
public:
mitkClassMacro(OptitrackTrackingDevice, mitk::TrackingDevice);
itkNewMacro(Self);
/**
* @returns Returns true if the Optitrack tracker is installed on this build (means activated in CMAKE). False if not.
*/
bool IsDeviceInstalled() override;
// Define the Type of Tracker as DefinitionOfTool (MITK)
typedef mitk::TrackingDeviceType OptiTrackTrackingDeviceType;
/**
* \brief Open the Connection with the Tracker. Calls LoadCalibration function and set the system up with the calibration file.
* Remember that you have to set a calibration file first to open a correct connection to the Optical Tracking System.
* \return Returns true if the connection is well done. Throws an exception if an error occures related to the Optitrack API messages.
* @throw mitk::IGTException Throws an exception if InitializeCameras or LoadCalibration failed.
*/
bool OpenConnection() override;
/**
* \brief Close the Connection with the Tracker. Also CleanUp the Optitrack variables using the API: TT_CleanUp and TT_ShutDown.
* Sometimes API does not work properly and some problems during the Clean Up has been reported.
* \return Returns true if the cleaning up and shutdown worked correctly. Throws an exception if an error occures related to the Optitrack API messages.
* @throw mitk::IGTException Throws an exception if the System cannot ShutDown now or was not initialized.
*/
bool CloseConnection() override;
/**
* \brief Start to Track the tools already defined. If no tools are defined for this tracker, it returns an error.
* Tools can be added using either AddToolByDescriptionFile or AddToolsByConfigurationFiles
* \return Returns true at least one tool was defined and the tracking is correct
* @throw mitk::IGTException Throws an exception if the System is not in State Ready .
*/
bool StartTracking() override;
/**
* \brief Stop the Tracking Thread and tools will not longer be updated.
* \return Returns true if Tracking thread could be stopped.
* @throw mitk::IGTException Throws an exception if System is not in State Tracking.
*/
bool StopTracking() override;
/**
* \brief Return the tool pointer of the tool number toolNumber
* \param toolNumber The number of the tool which should be given back.
* \return Returns the tool which the number "toolNumber". Returns nullptr, if there is
* no tool with this number.
*/
TrackingTool* GetTool(unsigned int toolNumber) const override;
/**
* \brief Return the tool pointer of the tool number toolNumber
* \param toolNumber The number of the tool which should be given back.
* \return Returns the tool which the number "toolNumber". Returns nullptr, if there is
* no tool with this number.
* @throw mitk::IGTException Throws an exception if there is the required tool does not exist.
*/
OptitrackTrackingTool* GetOptitrackTool(unsigned int toolNumber) const;
/**
* \brief Returns the number of defined tools
* \return Returns the number of defined tools in the Optitrack device.
*/
unsigned int GetToolCount() const override;
/** @brief Sets the directory where the calibration file of the MicronTracker can be found. */
itkSetMacro(Exp,int);
/** @brief Gets the current calibration directory. */
itkGetMacro(Exp,int);
/** @brief Sets the directory where the calibration file of the MicronTracker can be found. */
itkSetMacro(Led,int);
/** @brief Gets the current calibration directory. */
itkGetMacro(Led,int);
/** @brief Sets the directory where the calibration file of the MicronTracker can be found. */
itkSetMacro(Thr,int);
/** @brief Gets the current calibration directory. */
itkGetMacro(Thr,int);
/** @brief Sets the file where the calibration of the OptitrackTracker can be found. */
void SetCalibrationPath(std::string calibrationPath);
/** @brief Gets the current calibration file. */
itkGetMacro(calibrationPath,std::string);
/**
* \brief Start the Tracking Thread for the tools
* @throw mitk::IGTException Throws an exception if variable trackingDevice is nullptr
*/
static ITK_THREAD_RETURN_TYPE ThreadStartTracking(void* data);
/**
* \brief Update each tool location in the list m_AllTools
* @throw mitk::IGTException Throws an exception if the getting data operation failed for a defined tool
*/
void TrackTools();
/**
* \brief Load the Calibration file to the Optitrack System and set the cameras in calibrated locations
* \return Returns true if the calibration was uploaded correctly
* @throw mitk::IGTException Throws an exception if Calibration Path is empty, the System cannot load a calibration file or System is not ready for load a calibration file because it has not been initialized yet
*/
bool LoadCalibration();
/**
* \brief Set the Cameras Exposure, Threshold and Intensity of IR LEDs. By Default it set the Video type to 4: Precision Mode for tracking
* //== VideoType:
* //== 0 = Segment Mode
* //== 1 = Grayscale Mode
* //== 2 = Object Mode
* //== 4 = Precision Mode
* //== 6 = MJPEG Mode (V100R2 only)
* \return Returns true if all cameras were set up correctly
* @throw mitk::IGTException Throws an exception if System is not Initialized
*/
bool SetCameraParams(int exposure, int threshold, int intensity, int videoType = 4);
/**
* \brief Initialize the Optitrack System
* \return Returns true if system was initialized correctly
* @throw mitk::IGTException Throws an exception if the Optitrack Tracking System cannot be initialized
*/
bool InitializeCameras();
/**
* \brief Add a new tool using a text file which described the tool.
* The file must to have the next structure
* ToolName
- * #NumberOfMarkers
+ * \#NumberOfMarkers
* X Y Z - for the first marker
* X Y Z - for the second marker
* ...
- * X Y Z - for the last marker, the number #NumberOfMarkers
+ * X Y Z - for the last marker, the number \#NumberOfMarkers
* X Y Z - for the PIVOT point
* \return Returns true if system was initialized correctly
* @throw mitk::IGTException Throws an exception if Tool could not be added or System is not Initialized
*/
bool AddToolByDefinitionFile(std::string fileName); // ^????? We should give an example of defined tool
/**
* \brief This function load a file with Tools definitions provided for the software
* \return Returns true if file is correctly loaded with all the tools
* @throw mitk::IGTException Throws an exception if there is an error during the Initialization
*/
// bool AddToolByConfigurationFil(std::string fileName); // For next release....
protected:
/**
* \brief Constructor & Destructor of the class
*/
OptitrackTrackingDevice();
~OptitrackTrackingDevice() override;
private:
/**
* \brief The calibration file path. This file is produced by TrackingTools/Motive software.
* This variable is used to determine what will be the calibration file absolute path.
*/
std::string m_calibrationPath;
/**
* \brief The Cameras Exposition
*/
int m_Exp;
/**
* \brief The Cameras LED power
*/
int m_Led;
/**
* \brief The Cameras Thr
*/
int m_Thr;
/**
* \brief Described if the system was initialized at least once during execution. This is due
* to some reported problems during the clean up , shutdown and initialization again.
*/
bool m_initialized;
/**
* \brief Vector of pointers pointing to all defined tools
*/
std::vector<mitk::OptitrackTrackingTool::Pointer> m_AllTools;
/**
* \brief Mutex for coordinated access of tool container
*/
itk::FastMutexLock::Pointer m_ToolsMutex;
/**
* \brief MultiThreader that starts continuous tracking update
*/
itk::MultiThreader::Pointer m_MultiThreader;
/**
* \brief ThreadID number identification
*/
int m_ThreadID;
/* TODO:
// For Tracking
-bool AddToolByConfigurationFil(std::string fileName);
TTAPI NPRESULT TT_LoadTrackables (const char *filename); //== Load Trackables ======----
TTAPI NPRESULT TT_SaveTrackables (const char *filename); //== Save Trackables ======----
TTAPI NPRESULT TT_AddTrackables (const char *filename); //== Add Trackables ======----
TTAPI void TT_ClearTrackableList(); //== Clear all trackables =====---
TTAPI NPRESULT TT_RemoveTrackable(int Index); //== Remove single trackable ====---
TTAPI void TT_SetTrackableEnabled(int index, bool enabled); //== Set Tracking ====---
TTAPI bool TT_TrackableEnabled(int index); //== Get Tracking ====---
TTAPI int TT_TrackableMarkerCount(int index); //== Get marker count ====---
TTAPI void TT_TrackableMarker(int RigidIndex, //== Get Trackable mrkr ====---
int MarkerIndex, float *x, float *y, float *z);
//For projects
TTAPI NPRESULT TT_LoadProject(const char *filename); //== Load Project File ==========--
TTAPI NPRESULT TT_SaveProject(const char *filename); //== Save Project File ==========--
// For VRPN connection
TTAPI NPRESULT TT_StreamVRPN(bool enabled, int port);//== Start/stop VRPN Stream ===----
// For frame testing
TTAPI int TT_FrameMarkerCount(); //== Returns Frame Markers Count ---
TTAPI float TT_FrameMarkerX(int index); //== Returns X Coord of Marker -----
TTAPI float TT_FrameMarkerY(int index); //== Returns Y Coord of Marker -----
TTAPI float TT_FrameMarkerZ(int index); //== Returns Z Coord of Marker -----
TTAPI int TT_FrameMarkerLabel(int index); //== Returns Label of Marker -------
TTAPI double TT_FrameTimeStamp(); //== Time Stamp of Frame (seconds) -
// For cameras handling
TTAPI int TT_CameraCount(); //== Returns Camera Count =====-----
TTAPI float TT_CameraXLocation(int index); //== Returns Camera's X Coord =-----
TTAPI float TT_CameraYLocation(int index); //== Returns Camera's Y Coord =-----
TTAPI float TT_CameraZLocation(int index); //== Returns Camera's Z Coord =-----
TTAPI float TT_CameraOrientationMatrix(int camera, int index); //== Orientation -----
*/
};
}
#endif
diff --git a/Modules/IGT/TrackingDevices/mitkOptitrackTrackingTool.h b/Modules/IGT/TrackingDevices/mitkOptitrackTrackingTool.h
index 52cc463cb2..dce6567be1 100644
--- a/Modules/IGT/TrackingDevices/mitkOptitrackTrackingTool.h
+++ b/Modules/IGT/TrackingDevices/mitkOptitrackTrackingTool.h
@@ -1,217 +1,217 @@
/*============================================================================
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 OptiTrackTrackingTool_H_HEADER_INCLUDED_
#define OptiTrackTrackingTool_H_HEADER_INCLUDED_
#include <MitkIGTExports.h>
#include <itkMultiThreader.h>
#include "itkFastMutexLock.h"
#include "mitkTrackingDevice.h"
#include "mitkTrackingTool.h"
#include "mitkIGTTimeStamp.h"
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <itksys/SystemTools.hxx>
#include <itkMutexLockHolder.h>
#include "mitkCommon.h"
#include <mitkTrackingTool.h>
#include <mitkVector.h>
#include <itkFastMutexLock.h>
#include "mitkIGTException.h"
/**
* \brief Function to get the Error messages from API
*/
#include <mitkOptitrackErrorMessages.h>
namespace mitk
{
//class OptitrackTrackingDevice;
/** Documentation:
* \brief An object of this class represents the a Tool tracked by Optitrack System. You can define
* the tool by the a definition file like in the example in ****. Remember that it will be necessary to
* to have a license for using the Optitrack System.
* See http://www.naturalpoint.com/ for details.
* \author E. Marinetto (emarinetto@hggm.es) Instituto de Investigación Sanitaria Gregorio Marañón, Madrid, Spain. & M. Noll (matthias.noll@igd.fraunhofer.de) Cognitive Computing & Medical Imaging | Fraunhofer IGD
* \ingroup IGT
*/
class MITKIGT_EXPORT OptitrackTrackingTool : public TrackingTool
{
public:
friend class OptitrackTrackingDevice;
mitkClassMacro(mitk::OptitrackTrackingTool, mitk::TrackingTool);
itkNewMacro(Self);
/**
* \brief Define the tool by a calibration File.
* The file must to have the next structure. Makers locations must to have "%fe %fe %fe\n" format and in (mm). See http://www.cplusplus.com/reference/cstdio/fscanf/
* ToolName
- * #NumberOfMarkers
+ * \#NumberOfMarkers
* X Y Z - for the first marker
* X Y Z - for the second marker
* ...
- * X Y Z - for the last marker, the number #NumberOfMarkers
+ * X Y Z - for the last marker, the number \#NumberOfMarkers
* X Y Z - for the PIVOT point
* \return Returns true if the tool was set correctly
* @throw mitk::IGTException Throws an exception if there exist any problem during the configuration file reading.
*/
bool SetToolByFileName(std::string nameFile);
/**
* \brief Ask API the next number of defined tool
* \return Returns the next ID (int) for a new tool in the device list for API
* @throw mitk::IGTException Throws an exception if get_IDnext failed
*/
int get_IDnext();
/**
* \brief Delete the tool from the list of tools inside API Optitrack
* \return Returns true if the deletion was correct
* @throw mitk::IGTException Throws an exception if
*/
bool DeleteTrackable();
/**
* \brief Set the position to a given one
* @throw mitk::IGTException Throws an exception if
*/
using Superclass::SetPosition;
void SetPosition(mitk::Point3D position, ScalarType eps=0.0);
/**
* \brief Set the orientation to a given one using a quaternion nomenclature
* @throw mitk::IGTException Throws an exception if
*/
using Superclass::SetOrientation;
void SetOrientation(mitk::Quaternion orientation, ScalarType eps=0.0);
/**
* \brief Get the position of the tool
* @throw mitk::IGTException Throws an exception if
*/
void GetPosition(mitk::Point3D& position) const override;
/**
* \brief Get the orientation of the tool using quaternion nomenclature
* @throw mitk::IGTException Throws an exception if
*/
void GetOrientation(mitk::Quaternion& orientation) const override;
/**
* \brief Set the tool enabled for tracking.
* \return Return true if the enabling was successfull
* @throw mitk::IGTException Throws an exception if
*/
bool Enable() override;
/**
* \brief Set the tool disabled for tracking.
* \return Return true if the disabling was successfull
* @throw mitk::IGTException Throws an exception if
*/
bool Disable() override;
/**
* \brief Check if the tool is enabled (true) or not.
* \return Return true if the tool is enabled for tracking
* @throw mitk::IGTException Throws an exception if
*/
bool IsEnabled() const override;
/**
* \brief Check if the data of the tool is valid.
* \return Return true if location data is valid
* @throw mitk::IGTException Throws an exception if
*/
bool IsDataValid() const override;
/**
* \brief Get the expectated error in the tracked tool
* \return Return the error location
* @throw mitk::IGTException Throws an exception if
*/
float GetTrackingError() const override;
/**
* \brief Set the FLE (Fiducial Localization Error) for the tool
* @throw mitk::IGTException Throws an exception if
*/
void SetTrackingError(float FLEerror) override;
/**
* \brief Set the valid flag for tracking data to true
* @throw mitk::IGTException Throws an exception if
*/
void SetDataValid(bool _arg) override;
/**
* \brief Update location and orientation of the tool
* @throw mitk::IGTException Throws an exception if
*/
void updateTool();
/**
* \brief Constructor of the class
*/
OptitrackTrackingTool();
/**
* \brief Destructor of the class
*/
~OptitrackTrackingTool() override;
/**
* \brief File of the configuration for the tool
*/
std::string m_fileConfiguration;
/**
* \brief ID number from Optitrack API
*/
int m_ID;
/**
* \brief List of Markers locations in calibration position and orientation
*/
float* m_calibrationPoints;
/**
* \brief location of the pivot point during calibration
*/
float* m_pivotPoint;
/**
* \brief Number of Markers that blong to the tool
*/
int m_numMarkers;
/**
* \brief Expected value of the fiducial localization error (rms)
*/
float m_FLE;
private:
OptitrackTrackingTool(const OptitrackTrackingTool&);
const OptitrackTrackingTool& operator=(const OptitrackTrackingTool&);
};
}
#endif /* OptiTrackTrackingTool_H_HEADER_INCLUDED_ */
diff --git a/Modules/IGT/TrackingDevices/mitkTrackingVolumeGenerator.h b/Modules/IGT/TrackingDevices/mitkTrackingVolumeGenerator.h
index 2f0bcb232d..bb0c798f32 100644
--- a/Modules/IGT/TrackingDevices/mitkTrackingVolumeGenerator.h
+++ b/Modules/IGT/TrackingDevices/mitkTrackingVolumeGenerator.h
@@ -1,104 +1,104 @@
/*============================================================================
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 MITKTRACKINGVOLUMEGENERATOR_H
#define MITKTRACKINGVOLUMEGENERATOR_H
#include "MitkIGTExports.h"
#include <mitkSurfaceSource.h>
#include "mitkTrackingTypes.h"
#include "mitkTrackingDevice.h"
namespace mitk
{
/**Documentation
* \brief An instance of this class represents a generator wich generates the tracking volume of a
* given tracking device as a mitk:Surface.
*
* To generate the specific dimensions of the tracking volume of a tracking device
* the methods SetTrackingDeviceType(trackingdevicetype) or SetTrackingDevice (tracker) have to be called first. Otherwise
* the TrackingDeviceType is set to "TrackingSystemNotSpecified".
* After setting the trackingdevice type, the update() method has to be called.
* Now the method GetOutput() delivers the generatet TrackingVolume as mitk:Surface
*
* The coordinate system of die TrackingVolume is the same as the coordination system of the tracking device.
*
* For tracking devices that have a modifiable tracking volume (e.g. VirtualTrackingDevice,
* this class produces a tracking volume with default values.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT TrackingVolumeGenerator : public mitk::SurfaceSource
{
public:
mitkClassMacro(TrackingVolumeGenerator, mitk::SurfaceSource);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**
* \brief Deprecated! Use set DeviceData instead.
* Sets the tracking device type of the volume. Warning: there are different possible volumes for some device types.
* In this case a default volume is chosen automatically. All tracking volumes are defined by TrackingDeviceData
* objects (see file mitkTrackingTypes.h) for a list.
*
* After setting the device type the tracking volume gets generated (by a default volume for this type as mentioned above)
* and set to the correct dimensions in the correct coordinate system. The TV of a VirtualTrackingDevice is always a 400*400 cube.
- * \param type The type of the tracking device (currently supported:NDIAurora, NDIPolaris, ClaronMicron, IntuitiveDaVinci and the VirtualTracker; see file mitkTrackingTypes.h for a always up to date list).
+ * \param deviceType The type of the tracking device (currently supported:NDIAurora, NDIPolaris, ClaronMicron, IntuitiveDaVinci and the VirtualTracker; see file mitkTrackingTypes.h for a always up to date list).
*/
void SetTrackingDeviceType(mitk::TrackingDeviceType deviceType);
/**
* \return Returns the tracking device type of the current device. Warning: there are different possible volumes for some device types.
* Use GetTrackingDeviceData to get a unambiguous assignment to a tracking volume.
*/
mitk::TrackingDeviceType GetTrackingDeviceType() const;
/**
* \brief Sets the tracking device data object which will be used to generate the volume. Each tracking device data object
* has an unambiguous assignment to a tracking volume. See file mitkTrackingTypes.h for a list of all availiable object.
*/
void SetTrackingDeviceData(mitk::TrackingDeviceData deviceData);
/**
* \return Returns the current tracking device data of the generator. See file mitkTrackingTypes.h for the definition of tracking device data objects.
*/
mitk::TrackingDeviceData GetTrackingDeviceData() const;
/**
* \brief Deprecated! Use set DeviceData instead. Sets the tracking device type of the volume. After doing this
* the tracking volume gets generated and is set to the correct dimensions in the correct
* coordinate system. The TV of a VirtualTrackingDevice is always a 400*400 cube.
* \param tracker The tracking device the tracking volume has to be created for (currently supported: NDIAurora, NDIPolaris, ClaronMicron, IntuitiveDaVinci and the VirtualTracker; see file mitkTrackingTypes.h for a always up to date list).
*/
void SetTrackingDevice(mitk::TrackingDevice::Pointer tracker);
protected:
TrackingVolumeGenerator();
/** \brief Holds the current tracking device data object, which is used to generate the volume. */
mitk::TrackingDeviceData m_Data;
void GenerateData() override;
};
}
#endif // MITKTRACKINGVOLUMEGENERATOR_H
diff --git a/Modules/IGT/TrackingDevices/mitkVirtualTrackingDevice.h b/Modules/IGT/TrackingDevices/mitkVirtualTrackingDevice.h
index 4787c43cea..704f0ca810 100644
--- a/Modules/IGT/TrackingDevices/mitkVirtualTrackingDevice.h
+++ b/Modules/IGT/TrackingDevices/mitkVirtualTrackingDevice.h
@@ -1,215 +1,215 @@
/*============================================================================
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 MITKVIRTUALTRACKINGDEVICE_H_HEADER_INCLUDED_
#define MITKVIRTUALTRACKINGDEVICE_H_HEADER_INCLUDED_
#include <MitkIGTExports.h>
#include <mitkTrackingDevice.h>
#include <mitkVirtualTrackingTool.h>
#include <itkMultiThreader.h>
#include "itkFastMutexLock.h"
#include <vector>
namespace mitk
{
/** Documentation
* \brief Class representing a tracking device which generates random positions / orientations.
* No hardware is needed for tracking device.
*
* This TrackingDevice class does not interface with a physical tracking device. It simulates
* a tracking device by moving the tools on a randomly generated spline path.
*
* \ingroup IGT
*/
class MITKIGT_EXPORT VirtualTrackingDevice : public TrackingDevice
{
public:
mitkClassMacro(VirtualTrackingDevice, TrackingDevice);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**
* \brief Sets the refresh rate of the virtual tracking device in ms
* \warning This refresh rate is not guaranteed. A thread is used to refresh the positions
* of the virtual tools. However, this thread may not run at all during this refresh time period.
* \return Sets the refresh rate of the virtual tracking device in ms
*/
itkSetMacro(RefreshRate, unsigned int);
/**
* \brief Returns the refresh rate in ms.
* \return Returns the refresh rate in ms.
*/
itkGetConstMacro(RefreshRate, unsigned int);
/**
* \brief Starts the tracking.
*
* After StartTracking() is called,
* the tools will move on their spline paths with a constant velocity that can be set with
* SetToolSpeed(). The standard velocity is 10 seconds for one complete cycle along the spline path.
* \warning tool speed is not yet used in the current version
* \return Returns true if the tracking is started. Returns false if there was an error.
*/
bool StartTracking() override;
/**
* \brief Stops the tracking.
* \return Returns true if the tracking is stopped. Returns false if there was an error.
*/
bool StopTracking() override;
/**
* \brief Opens the connection to the device. This have to be done before the tracking is started.
* @throw mitk::IGTException Throws an exception if there are two less control points to start the the virtual device.
*/
bool OpenConnection() override;
/**
* \brief Closes the connection and clears all resources.
*/
bool CloseConnection() override;
/**
* \return Returns the number of tools which have been added to the device.
*/
unsigned int GetToolCount() const override;
/**
* \param toolNumber The number of the tool which should be given back.
* \return Returns the tool which the number "toolNumber". Returns nullptr, if there is
* no tool with this number.
*/
TrackingTool* GetTool(unsigned int toolNumber) const override;
/**
* \brief Adds a tool to the tracking device.
*
* The tool will have a random path on which it will move around. The path is created with a
* spline function and random control points inside the tracking volume.
*
* \param toolName The tool which will be added.
* \return Returns true if the tool has been added, false otherwise.
*/
TrackingTool* AddTool(const char* toolName);
/**
* \brief Set the tracking volume bounds
*
* This will set the tracking volume as an axis aligned bounding box
* defined by the six bounds values xMin, xMax, yMin, yMax, zMin, zMax.
* Note that the random path of existing tools will not be updated with the new
* tracking volume. Tools that are created after calling SetBounds() will use the
* new tracking volume
*/
itkSetVectorMacro(Bounds, mitk::ScalarType, 6);
/**
* \brief return the tracking volume bounds
*
* This will return the tracking volume as an axis aligned bounding box
* defined by the six bounds values xMin, xMax, yMin, yMax, zMin, zMax
*/
const mitk::ScalarType* GetBounds() const
{
return m_Bounds;
};
/**
* \brief return the approximate length of the spline for tool with index idx in millimeter
*
* if the index idx is not a
* valid tool index, a std::invalid_argument exception is thrown.
* GetSplineChordLength() returns the distance between all control points of the
* spline in millimeter. This can be used as an approximation for the length of the spline path.
*/
mitk::ScalarType GetSplineChordLength(unsigned int idx);
/**
* \brief sets the speed of the tool idx in rounds per second
*
* The virtual tools will travel along a closed spline path.
* This method sets the speed of a tool as a factor of how many rounds per second
* the tool should move. A setting of 1.0 will indicate one complete round per second.
* Together with GetSplineChordLength(), the speed in millimeter per second can be estimated.
* roundsPerSecond must be positive and larger than 0.0001.
* \warning Tool speed is currently not used.
- * \TODO: use tool speed
+ * \todo use tool speed
*/
void SetToolSpeed(unsigned int idx, mitk::ScalarType roundsPerSecond);
/**
* \brief enable addition of Gaussian Noise to tracking coordinates
*/
void EnableGaussianNoise();
/**
* \brief disable addition of Gaussian Noise to Trackin coordinates
*/
void DisableGaussianNoise();
/**
* \brief sets the mean distribution and the standard deviation for the Gaussian Noise
*
*/
void SetParamsForGaussianNoise(double meanDistribution, double deviationDistribution);
/**
* \brief returns the mean distribution for the Gaussian Noise
*/
double GetMeanDistribution();
/**
* \brief returns the deviation distribution for the Gaussian Noise
*/
double GetDeviationDistribution();
protected:
VirtualTrackingDevice();
~VirtualTrackingDevice() override;
/**
* \brief This method tracks tools as long as the variable m_Mode is set to "Tracking".
* Tracking tools means generating random numbers for the tool position and orientation.
* @throw mitk::IGTException Throws an mitk::IGTException if there is an error during virtual tool tracking.
*/
void TrackTools();
void InitializeSpline(mitk::VirtualTrackingTool* t); ///< initializes the spline path of the tool t with random control points inside the current tracking volume
static ITK_THREAD_RETURN_TYPE ThreadStartTracking(void* data); ///< static start method for tracking thread
typedef mitk::VirtualTrackingTool::SplineType::ControlPointType ControlPointType;
ControlPointType GetRandomPoint(); ///< returns a random position inside the tracking volume (defined by m_Bounds)
mitk::VirtualTrackingTool* GetInternalTool(unsigned int idx);
typedef std::vector<VirtualTrackingTool::Pointer> ToolContainer; ///< container type for tracking tools
ToolContainer m_AllTools; ///< container for all tracking tools
itk::FastMutexLock::Pointer m_ToolsMutex; ///< mutex for coordinated access of tool container
itk::MultiThreader::Pointer m_MultiThreader; ///< MultiThreader that starts continuous tracking update
int m_ThreadID;
unsigned int m_RefreshRate; ///< refresh rate of the internal tracking thread in milliseconds (NOT refreshs per second!)
unsigned int m_NumberOfControlPoints; ///< number of control points for the random path generation
mitk::ScalarType m_Bounds[6]; ///< bounding box of the tracking volume stored as {xMin, xMax, yMin, yMax, zMin, zMax}
bool m_GaussianNoiseEnabled; ///< adding Gaussian Noise to tracking coordinates or not, false by default
double m_MeanDistributionParam; /// mean distribution for Gaussion Noise, 0.0 by default
double m_DeviationDistributionParam; ///< deviation distribution for Gaussian Noise, 1.0 by default
};
}//mitk
#endif /* MITKVIRTUALTRACKINGDEVICE_H_HEADER_INCLUDED_ */
diff --git a/Modules/IGTBase/include/mitkNavigationData.h b/Modules/IGTBase/include/mitkNavigationData.h
index ad041dfd64..ef6571a6ae 100644
--- a/Modules/IGTBase/include/mitkNavigationData.h
+++ b/Modules/IGTBase/include/mitkNavigationData.h
@@ -1,294 +1,295 @@
/*============================================================================
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 MITKNAVIGATIONDATA_H_HEADER_INCLUDED_
#define MITKNAVIGATIONDATA_H_HEADER_INCLUDED_
#include <itkDataObject.h>
#include <MitkIGTBaseExports.h>
#include <mitkCommon.h>
#include <mitkNumericTypes.h>
namespace mitk {
/**Documentation
* \brief Navigation Data
*
* This class represents the data object that is passed through the MITK-IGT navigation filter
* pipeline. It encapsulates position and orientation of a tracked tool/sensor. Additionally,
* it contains a data structure that contains error/plausibility information
*
* It provides methods to work with the affine transformation represented by its orientation and position.
* Additionally, it provides a constructor to construct a NavigationData object from an AffineTransform3D and
* a getter to create an AffineTransform3D from a NavigationData object.
*
* \ingroup IGT
*/
class MITKIGTBASE_EXPORT NavigationData : public itk::DataObject
{
public:
mitkClassMacroItkParent(NavigationData, itk::DataObject);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
mitkNewMacro2Param(Self, mitk::AffineTransform3D::Pointer, const bool);
mitkNewMacro1Param(Self, mitk::AffineTransform3D::Pointer);
/**
* \brief Type that holds the position part of the tracking data
*/
typedef mitk::Point3D PositionType;
/**
* \brief Type that holds the orientation part of the tracking data
*/
typedef mitk::Quaternion OrientationType;
/**
* \brief type that holds the error characterization of the position and orientation measurements
*/
typedef itk::Matrix<mitk::ScalarType,6,6> CovarianceMatrixType;
/**
* \brief type that holds the time at which the data was recorded in milliseconds
*/
typedef double TimeStampType;
/**
* \brief sets the position of the NavigationData object
*/
itkSetMacro(Position, PositionType);
/**
* \brief returns position of the NavigationData object
*/
itkGetConstMacro(Position, PositionType);
/**
* \brief sets the orientation of the NavigationData object
*/
itkSetMacro(Orientation, OrientationType);
/**
* \brief returns the orientation of the NavigationData object
*/
itkGetConstMacro(Orientation, OrientationType);
/**
* \brief returns true if the object contains valid data
*/
virtual bool IsDataValid() const;
/**
* \brief sets the dataValid flag of the NavigationData object indicating if the object contains valid data
*/
itkSetMacro(DataValid, bool);
/**
* \brief sets the IGT timestamp of the NavigationData object in milliseconds
*/
itkSetMacro(IGTTimeStamp, TimeStampType);
/**
* \brief gets the IGT timestamp of the NavigationData object in milliseconds
* Please note, that there is also the GetTimeStamp method provided by the ITK object. Within IGT you should always use GetIGTTimeStamp !
*/
itkGetConstMacro(IGTTimeStamp, TimeStampType);
/**
* \brief sets the HasPosition flag of the NavigationData object
*/
itkSetMacro(HasPosition, bool);
/**
* \brief gets the HasPosition flag of the NavigationData object
*/
itkGetConstMacro(HasPosition, bool);
/**
* \brief sets the HasOrientation flag of the NavigationData object
*/
itkSetMacro(HasOrientation, bool);
/**
* \brief gets the HasOrientation flag of the NavigationData object
*/
itkGetConstMacro(HasOrientation, bool);
/**
* \brief sets the 6x6 Error Covariance Matrix of the NavigationData object
*/
itkSetMacro(CovErrorMatrix, CovarianceMatrixType);
/**
* \brief gets the 6x6 Error Covariance Matrix of the NavigationData object
*/
itkGetConstMacro(CovErrorMatrix, CovarianceMatrixType);
/**
* \brief set the name of the NavigationData object
*/
itkSetStringMacro(Name);
/**
* \brief returns the name of the NavigationData object
*/
itkGetStringMacro(Name);
/**
* \brief Graft the data and information from one NavigationData to another.
*
* Copies the content of data into this object.
* This is a convenience method to setup a second NavigationData object with all the meta
* information of another NavigationData object.
* Note that this method is different than just using two
* SmartPointers to the same NavigationData object since separate DataObjects are
* still maintained.
*/
void Graft(const DataObject *data) override;
/**
* \brief copy meta data of a NavigationData object
*
* copies all meta data from NavigationData data to this object
*/
void CopyInformation(const DataObject* data) override;
/**
* \brief Prints the object information to the given stream os.
* \param os The stream which is used to print the output.
* \param indent Defines the indentation of the output.
*/
void PrintSelf(std::ostream& os, itk::Indent indent) const override;
/**
* Set the position part of m_CovErrorMatrix to I*error^2
* This means that all position variables are assumed to be independent
*/
void SetPositionAccuracy(mitk::ScalarType error);
/**
* Set the orientation part of m_CovErrorMatrix to I*error^2
* This means that all orientation variables are assumed to be independent
*/
void SetOrientationAccuracy(mitk::ScalarType error);
/**
* \brief Calculate AffineTransform3D from the transformation held by this NavigationData.
* TODO: should throw an error if transformation is invalid.
*/
mitk::AffineTransform3D::Pointer GetAffineTransform3D() const;
/**
* \brief Calculate the RotationMatrix of this transformation.
*/
mitk::Matrix3D GetRotationMatrix() const;
/**
* \brief Transform by an affine transformation
*
* This method applies the affine transform given by self to a
* given point, returning the transformed point.
*/
mitk::Point3D TransformPoint(const mitk::Point3D point) const;
/**
* Get inverse of the Transformation represented by this NavigationData.
* @throws mitk::Exception in case the transformation is invalid (only case: quaternion is zero)
*/
mitk::NavigationData::Pointer GetInverse() const;
/** Compose with another NavigationData
*
* This method composes self with another NavigationData of the
* same dimension, modifying self to be the composition of self
* and other. If the argument pre is true, then other is
* precomposed with self; that is, the resulting transformation
* consists of first applying other to the source, followed by
* self. If pre is false or omitted, then other is post-composed
* with self; that is the resulting transformation consists of
* first applying self to the source, followed by other. */
void Compose(const mitk::NavigationData::Pointer n, const bool pre = false);
protected:
mitkCloneMacro(Self);
NavigationData();
/*
* Copy constructor internally used.
*/
NavigationData(const mitk::NavigationData& toCopy);
/**
* Creates a NavigationData object from an affineTransform3D.
* Caution: NavigationData doesn't support spacing, only translation and rotation. If the affine
* transform includes spacing it cannot be converted to a NavigationData and an exception is thrown.
+ * @param affineTransform3D
* @param checkForRotationMatrix if this is true, the rotation matrix coming from the affineTransform is checked
* for being a rotation matrix. If it isn't, an exception is thrown. Disable this check by
* setting checkForRotationMatrix to false.
*
* @throws mitkException if checkForRotationMatrix is true and a non rotation matrix was introduced by
* AffineTransform.
*/
NavigationData(mitk::AffineTransform3D::Pointer affineTransform3D, const bool checkForRotationMatrix = true);
~NavigationData() override;
/**
* \brief holds the position part of the tracking data
*/
PositionType m_Position;
/**
* \brief holds the orientation part of the tracking data
*/
OrientationType m_Orientation;
/**
* \brief A 6x6 covariance matrix parameterizing the Gaussian error
* distribution of the measured position and orientation.
*
* The hasPosition/hasOrientation fields define which entries
* are valid.
*/
CovarianceMatrixType m_CovErrorMatrix; ///< holds the error characterization of the position and orientation
/**
* \brief defines if position part of m_CovErrorMatrix is valid
*/
bool m_HasPosition;
/**
* \brief defines if orientation part of m_CovErrorMatrix is valid
*/
bool m_HasOrientation;
/**
* \brief defines if the object contains valid values
*/
bool m_DataValid;
/**
* \brief contains the time at which the tracking data was recorded
*/
TimeStampType m_IGTTimeStamp;
/**
* \brief name of the navigation data
*/
std::string m_Name;
private:
void ResetCovarianceValidity();
// pre = false
static mitk::NavigationData::Pointer getComposition(const mitk::NavigationData::Pointer nd1, const mitk::NavigationData::Pointer nd2);
};
/**
* @brief Equal A function comparing two navigation data objects for beeing equal in meta- and imagedata
*
* @ingroup MITKTestingAPI
*
* Following aspects are tested for equality:
* - position
* - orientation
* - other members and flags of the class
*
* @param rightHandSide An NavigationData to be compared
* @param leftHandSide An NavigationData to be compared
* @param eps Tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose Flag indicating if the user wants detailed console output or not.
* @return true, if all subsequent comparisons are true, false otherwise
*/
MITKIGTBASE_EXPORT bool Equal( const mitk::NavigationData& leftHandSide, const mitk::NavigationData& rightHandSide, ScalarType eps = mitk::eps, bool verbose = false );
} // namespace mitk
#endif /* MITKNAVIGATIONDATA_H_HEADER_INCLUDED_ */
diff --git a/Modules/IGTBase/include/mitkStaticIGTHelperFunctions.h b/Modules/IGTBase/include/mitkStaticIGTHelperFunctions.h
index 17af38482e..dba34e2ce8 100644
--- a/Modules/IGTBase/include/mitkStaticIGTHelperFunctions.h
+++ b/Modules/IGTBase/include/mitkStaticIGTHelperFunctions.h
@@ -1,49 +1,51 @@
/*============================================================================
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 <mitkCommon.h>
#include <itkMatrix.h>
#include <mitkQuaternion.h>
#include "MitkIGTBaseExports.h"
#include <mitkPointSet.h>
#include <vtkLandmarkTransform.h>
#include <vtkSmartPointer.h>
namespace mitk {
class MITKIGTBASE_EXPORT StaticIGTHelperFunctions
{
public:
/** Computes the angle in the plane perpendicular to the rotation axis of the two quaterions.
* Therefore, a vector is rotated with the difference of both rotations and the angle is computed.
* In some cases you might want to define this vector e.g., if working with 5D tools. For NDI Aurora
* 5D tools you need to defined this vector along the Z-axis.
* @return Returns the angle in degrees.
**/
static double GetAngleBetweenTwoQuaterions(mitk::Quaternion a, mitk::Quaternion b, itk::Vector<double,3> rotationVector);
/** Computes difference between two quaternions in degree, which is the minimum rotation angle between
* these two quaternions.
* The used formula is described here: https://fgiesen.wordpress.com/2013/01/07/small-note-on-quaternion-distance-metrics/
* @return Returns the angle in degrees.
**/
static double GetAngleBetweenTwoQuaterions(mitk::Quaternion a, mitk::Quaternion b);
/** Converts euler angles (in degrees) to a rotation matrix. */
static itk::Matrix<double,3,3> ConvertEulerAnglesToRotationMatrix(double alpha, double beta, double gamma);
/** @brief Computes the fiducial registration error out of two sets of fiducials.
* The two sets must have the same size and the points must correspond to each other.
+ * @param imageFiducials
+ * @param realWorldFiducials
* @param transform This transform is applied to the image fiducials before the FRE calculation if it is given.
* @return Returns the FRE. Returns -1 if there was an error.
*/
static double ComputeFRE(mitk::PointSet::Pointer imageFiducials, mitk::PointSet::Pointer realWorldFiducials, vtkSmartPointer<vtkLandmarkTransform> transform = nullptr);
};
}
diff --git a/Modules/IGTUI/Qmitk/QmitkInteractiveTransformationWidget.h b/Modules/IGTUI/Qmitk/QmitkInteractiveTransformationWidget.h
index 0146b3d8e6..928cfc9fee 100644
--- a/Modules/IGTUI/Qmitk/QmitkInteractiveTransformationWidget.h
+++ b/Modules/IGTUI/Qmitk/QmitkInteractiveTransformationWidget.h
@@ -1,97 +1,97 @@
/*============================================================================
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 QmitkInteractiveTransformationWidget_H
#define QmitkInteractiveTransformationWidget_H
//QT headers
#include <QDialog>
//Mitk headers
#include "MitkIGTUIExports.h"
#include "mitkVector.h"
#include "mitkGeometry3D.h"
#include "mitkNavigationTool.h"
//ui header
#include "ui_QmitkInteractiveTransformationWidgetControls.h"
/** Documentation:
* \brief An object of this class offers an UI to create a widget to access the advanced tool creation options.
*
* \ingroup IGTUI
*/
class MITKIGTUI_EXPORT QmitkInteractiveTransformationWidget : public QDialog
{
Q_OBJECT
public:
static const std::string VIEW_ID;
QmitkInteractiveTransformationWidget(QWidget* parent = nullptr, Qt::WindowFlags f = nullptr);
~QmitkInteractiveTransformationWidget() override;
/** This tool will be copied to m_ToolToEdit. It will not be changed.
To apply any changes made by this widget, you will need to connect to the signal
EditToolTipFinished(mitk::AffineTransform3D::Pointer toolTip) and set this transfrom
as calibrated tool tip.
We do not directly modify the tool to allow to cancel/exit this widget without doing
any harm.
*/
void SetToolToEdit(const mitk::NavigationTool::Pointer _tool);
/** The sliders and spinboxes will be set to these values.
When clicking "Revert Changes", sliders will be reseted to these values.
*/
void SetDefaultOffset(const mitk::Point3D _defaultValues);
void SetDefaultRotation(const mitk::Quaternion _defaultValues);
protected slots:
void OnZTranslationValueChanged(double v);
void OnYTranslationValueChanged(double v);
void OnXTranslationValueChanged(double v);
void OnZRotationValueChanged(double v);
void OnYRotationValueChanged(double v);
void OnXRotationValueChanged(double v);
void OnResetGeometryToIdentity();
void OnRevertChanges();
void OnApplyManipulatedToolTip();
void OnCancel();
signals:
void EditToolTipFinished(mitk::AffineTransform3D::Pointer toolTip);
protected:
void reject() override;
virtual void CreateConnections();
virtual void CreateQtPartControl(QWidget *parent);
/*! \brief Method performs the rotation.
- \params rotateVector New rotation to be combined with geometry. */
+ \param rotateVector New rotation to be combined with geometry. */
void Rotate(mitk::Vector3D rotateVector);
// Member variables
Ui::QmitkInteractiveTransformationWidgetControls* m_Controls;
mitk::NavigationTool::Pointer m_ToolToEdit; ///< \brief this member holds a copy of the tool that should be edited for visualization
mitk::BaseGeometry::Pointer m_Geometry; ///< \brief The geometry that is manipulated
mitk::BaseGeometry::Pointer m_ResetGeometry; ///< \brief Lifeline to reset to the original geometry
private:
void SetValuesToGUI(const mitk::AffineTransform3D::Pointer _defaultValues);
void SetSynchronizedValuesToSliderAndSpinbox(QDoubleSpinBox* _spinbox, QSlider* _slider, double _value);
};
#endif // QmitkInteractiveTransformationWidget_H
diff --git a/Modules/IGTUI/Qmitk/QmitkNDIConfigurationWidget.h b/Modules/IGTUI/Qmitk/QmitkNDIConfigurationWidget.h
index 8036b16dbf..dc13205abb 100644
--- a/Modules/IGTUI/Qmitk/QmitkNDIConfigurationWidget.h
+++ b/Modules/IGTUI/Qmitk/QmitkNDIConfigurationWidget.h
@@ -1,132 +1,131 @@
/*============================================================================
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 _QmitkNDIConfigurationWidget_H_INCLUDED
#define _QmitkNDIConfigurationWidget_H_INCLUDED
#include "ui_QmitkNDIConfigurationWidget.h"
#include "mitkNDITrackingDevice.h"
#include "mitkTrackingDeviceSource.h"
#include "QStringList"
#include "MitkIGTUIExports.h"
#include "mitkNodePredicateBase.h"
#include "mitkNavigationTool.h"
class QmitkNDIToolDelegate;
namespace mitk
{
class DataStorage;
};
/**@deprecated This widget is deprecated. The features (1) connection to NDI tracking devices and
* (2) handling of navigation tools are available in the pluging org.mitk.gui.qt.igttracking
* in a current version. The new concept to access the tracking devices is to use microservices.
* This can be achieved very simple by using the QmitkNavigationDataSourceSelectionWidget. You
* can find an example in the IGT tutorial step 2 / org.mitk.gui.qt.igtexamples (view TrackingLab).
*
*\ingroup IGTUI
*/
class MITKIGTUI_EXPORT QmitkNDIConfigurationWidget : public QWidget
{
Q_OBJECT // this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
public:
QmitkNDIConfigurationWidget(QWidget* parent);
~QmitkNDIConfigurationWidget() override;
DEPRECATED(std::string GetDeviceName() const);
DEPRECATED(mitk::NDITrackingDevice* GetTracker() const);
DEPRECATED(mitk::DataStorage* GetDataStorage() const);
DEPRECATED(mitk::NodePredicateBase* GetPredicate() const);
DEPRECATED(const QStringList& GetToolTypes() const);
DEPRECATED(void SetToolTypes(const QStringList& types)); ///< set types list for type editor combobox
DEPRECATED(void SetDataStorage(mitk::DataStorage* ds)); ///< set datastorage for organ node editor
DEPRECATED(void SetPredicate(mitk::NodePredicateBase::Pointer p)); ///< set predicate for organ node editor
DEPRECATED(void SetTagPropertyName(const std::string& name)); ///< set name of the property that is used to tag selected nodes
DEPRECATED(void SetTagProperty(mitk::BaseProperty::Pointer prop)); ///< set the property that is used to tag selected nodes
DEPRECATED(const QString GetToolType(unsigned int index) const);
DEPRECATED(const QString GetToolName(unsigned int index) const);
QMap<QString, unsigned int> GetToolAndTypes() const;
DEPRECATED(QList<unsigned int> GetToolsByToolType(QString toolType) const);
DEPRECATED(mitk::DataNode* GetNode(unsigned int index) const);
signals:
void ToolsAdded(QStringList tools);
void ToolsChanged();
void Connected();
void Disconnected();
void RepresentationChanged( int row , mitk::Surface::Pointer surface ); // returns the row number of the clicked tableitem for changing tool representation
void SignalToolNameChanged(int id, QString name);
void SignalSavedTool(int id, QString surfaceFilename);
void SignalLoadTool(int id, mitk::DataNode::Pointer dn);
public slots:
void SetDeviceName(const char* dev); ///< set the device name (e.g. "COM1", "/dev/ttyS0") that will be used to connect to the tracking device
void ShowToolRepresentationColumn(); ///< show or hide the tooltable column "Tool Representation". This SLOT should be called after SIGNAL "Connected" is emitted
void EnableAddToolsButton(bool enable); ///< enables or disables the Add Tools button
void EnableDiscoverNewToolsButton(bool enable); ; ///< enables or disables the Discover new Tools button
protected slots:
void OnConnect();
void OnDisconnect();
void OnDiscoverTools();
void OnDiscoverDevices();
void OnAddPassiveTool();
void UpdateTrackerFromToolTable(const QModelIndex & topLeft, const QModelIndex & /*bottomRight*/);
void OnTableItemClicked(const QModelIndex & topLeft); ///< for clicking on tooltable items
void OnDisoverDevicesBtnInfo();
void OnTableCellChanged(int row, int column);
void OnSaveTool();
void OnLoadTool();
protected:
typedef QMap<QString, mitk::TrackingDeviceType> PortDeviceMap; // key is port name (e.g. "COM1", "/dev/ttyS0"), value will be filled with the type of tracking device at this port
/**Documentation
* \brief scans the ports provided as key in the portsAndDevices and fills the respective value of portsAndDevices with the tracking device type at that port
*
*
- * \param[in] portsAndDevices keys are used to query serial ports
- * \param[out] portsAndDevices values of the existing keys will be filled with the tracking device type
+ * \param[in,out] portsAndDevices keys are used to query serial ports, values of the existing keys will be filled with the tracking device type
*/
void ScanPortsForNDITrackingDevices(PortDeviceMap& portsAndDevices);
mitk::TrackingDeviceType ScanPort(QString port);
mitk::NavigationTool::Pointer GenerateNavigationTool(mitk::TrackingTool* tool);
QStringList GetToolNamesList(); ///< returns a string list with the names of all tools of the current tracking device
void CreateTracker(); ///< creates new NDITrackingDevice object
void SetupTracker(); ///< sets the parameters from the gui to the tracking device object
QString GetStatusText(); ///< construct a status text depending on the current state of the tracking device object
void UpdateWidgets();
void UpdateToolTable(); ///< read all tools from the tracking device object and display them in the gui
virtual void CreateQtPartControl(QWidget *parent);
virtual void CreateConnections(); ///< \brief Creation of the connections of main and control widget
void HidePolarisOptionsGroupbox( bool on ); ///< show or hide polaris options in the UI
void HideAuroraOptionsGroupbox( bool on ); ///< show or hide aurora options in the UI
Ui::QmitkNDIConfigurationWidget* m_Controls; ///< gui widgets
mitk::NDITrackingDevice::Pointer m_Tracker; ///< tracking device object
mitk::TrackingDeviceSource::Pointer m_Source;
QmitkNDIToolDelegate* m_Delegate;
QString m_SROMCellDefaultText;
QString m_RepresentatonCellDefaultText;
mitk::Surface::Pointer LoadSurfaceFromSTLFile(QString surfaceFilename);
};
#endif // _QmitkNDIConfigurationWidget_H_INCLUDED
diff --git a/Modules/IGTUI/Qmitk/QmitkNavigationToolCreationWidget.h b/Modules/IGTUI/Qmitk/QmitkNavigationToolCreationWidget.h
index aa32dbcc87..c05f4aecab 100644
--- a/Modules/IGTUI/Qmitk/QmitkNavigationToolCreationWidget.h
+++ b/Modules/IGTUI/Qmitk/QmitkNavigationToolCreationWidget.h
@@ -1,141 +1,142 @@
/*============================================================================
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 QmitkNavigationToolCreationWidget_H
#define QmitkNavigationToolCreationWidget_H
//QT headers
#include <QWidget>
//mitk headers
#include "MitkIGTUIExports.h"
#include <mitkNavigationTool.h>
#include <mitkNavigationToolStorage.h>
#include <mitkNodePredicateDataType.h>
#include "QmitkInteractiveTransformationWidget.h"
#include <QDialog>
//Microservices
#include <usGetModuleContext.h>
#include <usModule.h>
#include <usServiceProperties.h>
#include <usModuleContext.h>
//ui header
#include "ui_QmitkNavigationToolCreationWidget.h"
/** Documentation:
* \brief An object of this class offers an UI to create or modify NavigationTools.
*
* Be sure to call the initialize method before you start the widget
* otherwise some errors might occure.
*
* \ingroup IGTUI
*/
class MITKIGTUI_EXPORT QmitkNavigationToolCreationWidget : public QWidget
{
Q_OBJECT
public:
static const std::string VIEW_ID;
/** @brief Initializes the widget.
* @param dataStorage The data storage is needed to offer the possibility to choose surfaces from the data storage for tool visualization.
* @param supposedIdentifier This Identifier is supposed for the user. It is needed because every identifier in a navigation tool storage must be unique and we don't know the others.
+ * @param supposedName
*/
void Initialize(mitk::DataStorage* dataStorage, const std::string &supposedIdentifier, const std::string &supposedName = "NewTool");
/** @brief This Function will add a new node to the Data Manager with given name to enable a preview of the m_ToolToBeEdited
*/
void ShowToolPreview(std::string _name);
/** @brief Sets the default tracking device type. You may also define if it is changeable or not.*/
void SetTrackingDeviceType(mitk::TrackingDeviceType type, bool changeable = true);
QmitkNavigationToolCreationWidget(QWidget* parent = nullptr, Qt::WindowFlags f = nullptr);
~QmitkNavigationToolCreationWidget() override;
/** @brief Sets the default data of all input fields. The default data is used from the default tool which is given as parameter. */
void SetDefaultData(mitk::NavigationTool::Pointer DefaultTool);
/** @return Returns the created tool. Returns nullptr if no tool was created yet. */
mitk::NavigationTool::Pointer GetCreatedTool();
signals:
/** @brief This signal is emitted if the user finished the creation of the tool. */
void NavigationToolFinished();
/** @brief This signal is emitted if the user canceled the creation of the tool. */
void Canceled();
protected slots:
void OnLoadCalibrationFile();
void OnSurfaceUseToggled();
void OnLoadSurface();
void OnEditToolTip();
void OnEditToolTipFinished(mitk::AffineTransform3D::Pointer toolTip);
void OnCancel();
void OnFinished();
void GetValuesFromGuiElements();
private:
//############## private help methods #######################
/** Shows a message box with the given message s. */
void MessageBox(std::string s);
/** Set the tool landmark lists in the UI.*/
void FillUIToolLandmarkLists(mitk::PointSet::Pointer calLandmarks, mitk::PointSet::Pointer regLandmarks);
/** Returns the tool landmark lists from the UI.
* @param[out] calLandmarks Returns a pointer to the calibration landmarks point set.
* @param[out] regLandmarks Returns a pointer to the registration landmarks point set.
*/
void GetUIToolLandmarksLists(mitk::PointSet::Pointer& calLandmarks, mitk::PointSet::Pointer& regLandmarks);
/** Initializes the tool landmark lists in the UI. */
void InitializeUIToolLandmarkLists();
void RefreshTrackingDeviceCollection();
void SetGuiElements();
protected:
/// \brief Creation of the connections
virtual void CreateConnections();
virtual void CreateQtPartControl(QWidget *parent);
Ui::QmitkNavigationToolCreationWidgetControls* m_Controls;
/** @brief this pointer holds the tool which is edited. If finished is clicked, it will be copied to the final tool, if it is cancled, it is reseted and not used.
This can be regarded as the clipboard for all changes. */
mitk::NavigationTool::Pointer m_ToolToBeEdited;
/** @brief this pointer holds the tool which is created and returned */
mitk::NavigationTool::Pointer m_FinalTool;
QmitkInteractiveTransformationWidget* m_ToolTransformationWidget;
/** @brief holds the DataStorage */
mitk::DataStorage* m_DataStorage;
/** Hold the data nodes which are needed for the landmark widgets. */
mitk::DataNode::Pointer m_calLandmarkNode, m_regLandmarkNode;
};
#endif
diff --git a/Modules/IGTUI/Qmitk/QmitkTrackingDeviceConfigurationWidgetScanPortsWorker.h b/Modules/IGTUI/Qmitk/QmitkTrackingDeviceConfigurationWidgetScanPortsWorker.h
index 81c0427581..3c83e4bfad 100644
--- a/Modules/IGTUI/Qmitk/QmitkTrackingDeviceConfigurationWidgetScanPortsWorker.h
+++ b/Modules/IGTUI/Qmitk/QmitkTrackingDeviceConfigurationWidgetScanPortsWorker.h
@@ -1,50 +1,51 @@
/*============================================================================
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 QmitkTrackingDeviceConfigurationWidgetScanPortsWorker_H
#define QmitkTrackingDeviceConfigurationWidgetScanPortsWorker_H
#include <QWidget>
#include "mitkTrackingDevice.h"
#include "MitkIGTUIExports.h"
/**
* Worker thread class for scan ports.
*/
class MITKIGTUI_EXPORT QmitkTrackingDeviceConfigurationWidgetScanPortsWorker : public QObject
{
Q_OBJECT;
public:
QmitkTrackingDeviceConfigurationWidgetScanPortsWorker(){};
~QmitkTrackingDeviceConfigurationWidgetScanPortsWorker() override{};
public slots:
void ScanPortsThreadFunc();
signals:
/**
* @param Port Returns the port, returns -1 if no device was found.
+ * @param result
* @param PortType Returns the port type (0=usb,1=tty), returns -1 if the port type is not specified, e.g, in case of Windows.
*/
void PortsScanned(int Port, QString result, int PortType);
protected:
/** @brief Scans the given port for a NDI tracking device.
* @return Returns the type of the device if one was found. Returns TrackingSystemInvalid if none was found.
*/
mitk::TrackingDeviceType ScanPort(QString port);
};
#endif
diff --git a/Modules/IOExt/CMakeLists.txt b/Modules/IOExt/CMakeLists.txt
index ccfb990d3c..61b51b291e 100644
--- a/Modules/IOExt/CMakeLists.txt
+++ b/Modules/IOExt/CMakeLists.txt
@@ -1,4 +1,4 @@
MITK_CREATE_MODULE(DEPENDS MitkDataTypesExt MitkMapperExt MitkSceneSerialization MitkLegacyIO
- PACKAGE_DEPENDS PRIVATE ITK|ITKIOImageBase VTK|vtkIOPLY+vtkIOExport+vtkIOParallelXML
+ PACKAGE_DEPENDS PRIVATE ITK|ITKIOImageBase VTK|IOPLY+IOExport+IOParallelXML
AUTOLOAD_WITH MitkCore
)
diff --git a/Modules/IOExt/Internal/mitkIOExtObjectFactory.cpp b/Modules/IOExt/Internal/mitkIOExtObjectFactory.cpp
index d268917ff6..86ca564d52 100644
--- a/Modules/IOExt/Internal/mitkIOExtObjectFactory.cpp
+++ b/Modules/IOExt/Internal/mitkIOExtObjectFactory.cpp
@@ -1,180 +1,167 @@
/*============================================================================
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 "mitkIOExtObjectFactory.h"
#include "mitkCoreObjectFactory.h"
#include "mitkParRecFileIOFactory.h"
//#include "mitkObjFileIOFactory.h"
#include "mitkStlVolumeTimeSeriesIOFactory.h"
#include "mitkVtkVolumeTimeSeriesIOFactory.h"
#include "mitkUnstructuredGridVtkWriter.h"
#include "mitkUnstructuredGridVtkWriterFactory.h"
#include "mitkVolumeMapperVtkSmart3D.h"
-#include "mitkMesh.h"
-#include "mitkMeshMapper2D.h"
-#include "mitkMeshVtkMapper3D.h"
#include "mitkUnstructuredGridMapper2D.h"
#include "mitkUnstructuredGridVtkMapper3D.h"
#include "mitkVtkGLMapperWrapper.h"
#include <vtkUnstructuredGridWriter.h>
#include <vtkXMLPUnstructuredGridWriter.h>
#include <vtkXMLUnstructuredGridWriter.h>
mitk::IOExtObjectFactory::IOExtObjectFactory()
: CoreObjectFactoryBase(),
m_ParRecFileIOFactory(ParRecFileIOFactory::New().GetPointer())
//, m_ObjFileIOFactory(ObjFileIOFactory::New().GetPointer())
,
m_StlVolumeTimeSeriesIOFactory(StlVolumeTimeSeriesIOFactory::New().GetPointer()),
m_VtkVolumeTimeSeriesIOFactory(VtkVolumeTimeSeriesIOFactory::New().GetPointer()),
m_UnstructuredGridVtkWriterFactory(UnstructuredGridVtkWriterFactory::New().GetPointer())
{
static bool alreadyDone = false;
if (!alreadyDone)
{
MITK_DEBUG << "IOExtObjectFactory c'tor" << std::endl;
itk::ObjectFactoryBase::RegisterFactory(m_ParRecFileIOFactory);
itk::ObjectFactoryBase::RegisterFactory(m_StlVolumeTimeSeriesIOFactory);
itk::ObjectFactoryBase::RegisterFactory(m_VtkVolumeTimeSeriesIOFactory);
itk::ObjectFactoryBase::RegisterFactory(m_UnstructuredGridVtkWriterFactory);
m_FileWriters.push_back(mitk::UnstructuredGridVtkWriter<vtkUnstructuredGridWriter>::New().GetPointer());
m_FileWriters.push_back(mitk::UnstructuredGridVtkWriter<vtkXMLUnstructuredGridWriter>::New().GetPointer());
m_FileWriters.push_back(mitk::UnstructuredGridVtkWriter<vtkXMLPUnstructuredGridWriter>::New().GetPointer());
CreateFileExtensionsMap();
alreadyDone = true;
}
}
mitk::IOExtObjectFactory::~IOExtObjectFactory()
{
itk::ObjectFactoryBase::UnRegisterFactory(m_ParRecFileIOFactory);
itk::ObjectFactoryBase::UnRegisterFactory(m_StlVolumeTimeSeriesIOFactory);
itk::ObjectFactoryBase::UnRegisterFactory(m_VtkVolumeTimeSeriesIOFactory);
itk::ObjectFactoryBase::UnRegisterFactory(m_UnstructuredGridVtkWriterFactory);
}
mitk::Mapper::Pointer mitk::IOExtObjectFactory::CreateMapper(mitk::DataNode *node, MapperSlotId id)
{
mitk::Mapper::Pointer newMapper = nullptr;
mitk::BaseData *data = node->GetData();
if (id == mitk::BaseRenderer::Standard2D)
{
- if ((dynamic_cast<Mesh *>(data) != nullptr))
- {
- newMapper = mitk::MeshMapper2D::New();
- newMapper->SetDataNode(node);
- }
- else if ((dynamic_cast<UnstructuredGrid *>(data) != nullptr))
+ if ((dynamic_cast<UnstructuredGrid *>(data) != nullptr))
{
newMapper = mitk::VtkGLMapperWrapper::New(mitk::UnstructuredGridMapper2D::New().GetPointer());
newMapper->SetDataNode(node);
}
}
else if (id == mitk::BaseRenderer::Standard3D)
{
if ((dynamic_cast<Image *>(data) != nullptr) && std::string("Image").compare(node->GetData()->GetNameOfClass())==0)
{
newMapper = mitk::VolumeMapperVtkSmart3D::New();
newMapper->SetDataNode(node);
}
- else if ((dynamic_cast<Mesh *>(data) != nullptr))
- {
- newMapper = mitk::MeshVtkMapper3D::New();
- newMapper->SetDataNode(node);
- }
else if ((dynamic_cast<UnstructuredGrid *>(data) != nullptr))
{
newMapper = mitk::UnstructuredGridVtkMapper3D::New();
newMapper->SetDataNode(node);
}
}
return newMapper;
}
void mitk::IOExtObjectFactory::SetDefaultProperties(mitk::DataNode *node)
{
if (node == nullptr)
return;
mitk::DataNode::Pointer nodePointer = node;
mitk::Image::Pointer image = dynamic_cast<mitk::Image *>(node->GetData());
if (image.IsNotNull() && image->IsInitialized())
{
mitk::VolumeMapperVtkSmart3D::SetDefaultProperties(node);
}
if (dynamic_cast<mitk::UnstructuredGrid *>(node->GetData()))
{
mitk::UnstructuredGridVtkMapper3D::SetDefaultProperties(node);
}
}
std::string mitk::IOExtObjectFactory::GetFileExtensions()
{
std::string fileExtension;
this->CreateFileExtensions(m_FileExtensionsMap, fileExtension);
return fileExtension.c_str();
}
mitk::CoreObjectFactoryBase::MultimapType mitk::IOExtObjectFactory::GetFileExtensionsMap()
{
return m_FileExtensionsMap;
}
mitk::CoreObjectFactoryBase::MultimapType mitk::IOExtObjectFactory::GetSaveFileExtensionsMap()
{
return m_SaveFileExtensionsMap;
}
void mitk::IOExtObjectFactory::CreateFileExtensionsMap()
{
m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.vtu", "VTK Unstructured Grid"));
m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.vtk", "VTK Unstructured Grid"));
m_FileExtensionsMap.insert(std::pair<std::string, std::string>("*.pvtu", "VTK Unstructured Grid"));
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.pvtu", "VTK Parallel XML Unstructured Grid"));
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.vtu", "VTK XML Unstructured Grid"));
m_SaveFileExtensionsMap.insert(std::pair<std::string, std::string>("*.vtk", "VTK Legacy Unstructured Grid"));
}
std::string mitk::IOExtObjectFactory::GetSaveFileExtensions()
{
std::string fileExtension;
this->CreateFileExtensions(m_SaveFileExtensionsMap, fileExtension);
return fileExtension.c_str();
}
struct RegisterIOExtObjectFactory
{
RegisterIOExtObjectFactory() : m_Factory(mitk::IOExtObjectFactory::New())
{
mitk::CoreObjectFactory::GetInstance()->RegisterExtraFactory(m_Factory);
}
~RegisterIOExtObjectFactory() { mitk::CoreObjectFactory::GetInstance()->UnRegisterExtraFactory(m_Factory); }
mitk::IOExtObjectFactory::Pointer m_Factory;
};
static RegisterIOExtObjectFactory registerIOExtObjectFactory;
diff --git a/Modules/ImageStatistics/CMakeLists.txt b/Modules/ImageStatistics/CMakeLists.txt
index 73a49bc11d..532b38bdf4 100644
--- a/Modules/ImageStatistics/CMakeLists.txt
+++ b/Modules/ImageStatistics/CMakeLists.txt
@@ -1,10 +1,10 @@
MITK_CREATE_MODULE(
DEPENDS MitkImageExtraction MitkPlanarFigure MitkMultilabel
PACKAGE_DEPENDS
PUBLIC ITK|ITKIOXML
- PRIVATE ITK|ITKVTK+ITKConvolution
+ PRIVATE ITK|ITKVTK+ITKConvolution VTK|IOImage
)
if(BUILD_TESTING)
add_subdirectory(Testing)
endif()
diff --git a/Modules/ImageStatistics/itkMultiGaussianImageSource.h b/Modules/ImageStatistics/itkMultiGaussianImageSource.h
index 42e428a2ab..794809c8fc 100644
--- a/Modules/ImageStatistics/itkMultiGaussianImageSource.h
+++ b/Modules/ImageStatistics/itkMultiGaussianImageSource.h
@@ -1,374 +1,374 @@
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
/*=========================================================================
*
* Portions of this file are subject to the VTK Toolkit Version 3 copyright.
*
* Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
*
* For complete copyright, license and disclaimer of warranty information
* please refer to the NOTICE file at the top of the ITK source tree.
*
*=========================================================================*/
#ifndef __itkMultiGaussianImageSource_h
#define __itkMultiGaussianImageSource_h
#include "itkImageSource.h"
#include "itkNumericTraits.h"
#include "itkImageRegionIteratorWithIndex.h"
#include "itkImageFileWriter.h"
#include <itkMapContainer.h>
namespace itk
{
/** \class MultiGaussianImageSource
\brief Generate an 3-dimensional multigaussian image.
This class defines an 3-dimensional Image, in which the value at one voxel equals the value of a multigaussian function evaluated at the voxel's coordinates. The multigaussian function is built as a sum of N gaussian function and is defined by the following parameters (\ref Generation-of-a-multigauss-image):
1. CenterX, CenterY, CenterZ - vectors of the size of N determining the expectancy value at the x-, y- and the z-axis. That means: The i-th gaussian bell curve takes its maximal value at the voxel with index [CenterX(i); CenterY(i); Centerz(i)].
2. SigmaX, SigmaY, SigmaZ - vectors of the size of N determining the deviation at the x-, y- and the z-axis. That means: The width of the i-th gaussian bell curve is determined by the deviation in the x-axis, which is SigmaX(i), in the y-axis is SigmaY(i) and in the z-axis is SigmaZ(i).
3. Altitude - vector of the size of N determining the altitude: the i-th gaussian bell curve has a height of Altitude(i).
This class allows by the method CalculateMidpointAndMeanValue() to find a sphere with a specified radius that has a maximal mean value over all sphere with that radius with midpoint inside or on the boundary of the image. Furthermore it can calculate the maximal und minimal pixel intensities and whose indices in the founded sphere.
To serve as a test tool for ImageStatisticsCalculator, esp. the "hotspot search" feature of this class, MultiGaussianImageSource is also able to calculate the position of a sphere that maximizes the mean value of the voxels within the sphere (\ref Algorithm-for-calculating-statistic-in-a-sphere).
\section Generation-of-a-multigauss-image Generation of a multigauss image
-A multigauss function consists of the sum of \f$ N \f$ gauss function. The \f$ i \f$-th \linebreak (\f$0 \leq i \leq N \f$) gaussian is described with the following seven parameters (see above):
+A multigauss function consists of the sum of \f$ N \f$ gauss function. The \f$ i \f$-th \n (\f$0 \leq i \leq N \f$) gaussian is described with the following seven parameters (see above):
- \f$ x_0^{(i)} \f$ is the expectancy value in the \f$ x \f$-Axis
- \f$ y_0^{(i)} \f$ is the expectancy value in the \f$ y \f$-Axis
- \f$ z_0^{(i)} \f$ is the expectancy value in the \f$ z \f$-Axis
- \f$ \sigma_x^{(i)} \f$ is the deviation in the \f$ x \f$-Axis
- \f$ \sigma_y^{(i)} \f$ is the deviation in the \f$ y \f$-Axis
- \f$ \sigma_z^{(i)} \f$ is the deviation in the \f$ z \f$-Axis
- \f$ a^{(i)} \f$ is the altitude of the gaussian.
A gauss function has the following form:
\f{eqnarray}{
\nonumber
f^{(i)}(x,y,z) = a^{(i)}
exp \left[ - \left(
\frac{(x - x_0^{(i)})^2}{2 (\sigma_x^{(i)})^2} +
\frac{(y - y_0^{(i)})^2}{2 (\sigma_y^{(i)})^2} +
\frac{(z - z_0^{(i)})^2}{2 (\sigma_z^{(i)})^2}
\right) \right].
\f}
A multigauss function has then the form:
\f{align*}{
f_N(x,y,z) =& \sum_{i=0}^{N}f^{(i)}(x,y,z)\\
=&\sum_{0}^{N} a^{(i)}
exp \left[ - \left(
\frac{(x - x_0^{(i)})^2}{2 (\sigma_x^{(i)})^2} +
\frac{(y - y_0^{(i)})^2}{2 (\sigma_y^{(i)})^2} +
\frac{(z - z_0^{(i)})^2}{2 (\sigma_z^{(i)})^2}
\right) \right].
\f}
The multigauss function \f$f_N\f$ will be evaluated at each voxel coordinate to become the voxel intensity.
\section Algorithm-for-calculating-statistic-in-a-sphere Algorithm for calculating statistic in a sphere
This section explains how we can find a sphere region which has a maximal mean value over all sphere regions with a fixed radius. Furthermore we want to calculate the maximal and minimal value in the wanted sphere.
To calculate the mean value in a sphere we integrate the gaussians over the whole sphere. The antiderivative is unknown as an explicit function, but we have a value table for the distribution function of the normal distribution \f$ \Phi(x) \f$ for \f$ x \f$ between \f$ -3.99 \f$ and \f$ 3.99 \f$ with step size \f$ 0.01 \f$. The only problem is that we cannot integrate over a spherical region, because we have an 3-dim integral and therefore are the integral limits dependent from each other and we cannot evaluate \f$ \Phi \f$. So we approximate the sphere with cuboids inside the sphere and prisms on the boundary of the sphere. We calculate these cuboids with the octree recursive method: We start by subdividing the wrapping box of the sphere in eight cuboids. Further we subdivide each cuboid in eight cuboids and check for each of them, whether it is inside or outside the sphere or whether it intersects the sphere surface. We save those of them, which are inside the sphere and continue to subdivide the cuboids that intersect the sphere until the recursion breaks. In the last step we take the half of the cuboids on the boundary and this are the prisms. Now we can calculate and sum the integrals over the cuboids and divide through the volume of the body to obtain the mean value.
For each cuboid \f$ Q = [a_1, b_1]\times[a_2, b_2]\times[a_3, b_3] \f$ we apply Fubini's theorem for integrable functions and become for the integral the following:
\f{align*}{
m_k =& \sum_{i=0}^{N} \int_{Q} f^{(i)}(x,y,z)dx\\
=&\sum_{i=0}^{N} a^{(i)} \int_{Q}
exp \left[ - \left(
\frac{(x - x_0^{(i)})^2}{2 (\sigma_x^{(i)})^2} +
\frac{(y - y_0^{(i)})^2}{2 (\sigma_y^{(i)})^2} +
\frac{(z - z_0^{(i)})^2}{2 (\sigma_z^{(i)})^2}
\right) \right] dx \\
=& \sum_{i=0}^{N} a^{(i)} \int_{a_1}^{b_1} exp \left[ - \frac{(x - x_0^{(i)})^2}{2 (\sigma_x^{(i)})^2} \right] dx
\int_{a_2}^{b_2}exp \left[ -\frac{(y - y_0^{(i)})^2}{2 (\sigma_y^{(i)})^2} \right]dx
\int_{a_3}^{b_3}exp \left[ -\frac{(z - z_0^{(i)})^2}{2 (\sigma_z^{(i)})^2} \right]dx.
\f}
So we calculate three one dimensional integrals:
\f{align*}{
\int_{a}^{b} & exp \left[ - \frac{(x - x_0^{(i)})^2}{2 (\sigma_x^{(i)})^2} \right] dx \\
=&\int_{-\infty}^{b} exp \left[ - \frac{(x - x_0^{(i)})^2}{2 (\sigma_x^{(i)})^2} \right] dx - \int_{-\infty}^{a} exp \left[ - \frac{(x - x_0^{(i)})^2}{2 (\sigma_x^{(i)})^2} \right] dx \\
=& \sigma_x^{(i)} \left[\int_{-\infty}^{(a - x_0^{(i)})/ \sigma_x^{(i)}} e^{-\frac{t^2}{2}} dt
- \int_{-\infty}^{(b - x_0^{(i)})/ \sigma_x^{(i)}} e^{-\frac{t^2}{2}}dt \right] \\
=&\sigma_x^{(i)} \sqrt{(\pi)} \left[ \Phi \left( \frac{(a - x_0^{(i)})^2}{\sigma_x^{(i)}} \right) - \Phi \left ( \frac{(b - x_0^{(i)})^2}{\sigma_x^{(i)}} \right) \right].
\f}
and become for the integral over \f$ Q \f$:
\f{align*}{
m_k =& \sum_{i=0}^{N} \sigma_x^{(i)} \sigma_y^{(i)} \sigma_z^{(i)} \pi^{1.5}
\left[ \Phi \left( \frac{(a_1 - x_0^{(i)})^2}{\sigma_x^{(i)}} \right) - \Phi \left ( \frac{(b_1 - x_0^{(i)})^2}{\sigma_x^{(i)}} \right) \right]\times \\
&\left[ \Phi \left( \frac{(a_2 - y_0^{(i)})^2}{\sigma_y^{(i)}} \right) - \Phi \left ( \frac{(b_2 - y_0^{(i)})^2}{\sigma_y^{(i)}} \right) \right]\times
\left[ \Phi \left( \frac{(a_3 - z_0^{(i)})^2}{\sigma_z^{(i)}} \right) - \Phi \left ( \frac{(b_3 - z_0^{(i)})^2}{\sigma_z^{(i)}} \right) \right].
\f}
For the integral over the prism we take the half of the integral over the corresponding cuboid.
Altogether we find the mean value in the sphere as:
\f{align*}{
\left( \sum_{Q_k \text{ Cuboid}} m_k + \sum_{P_l \text{ Prism}} 0.5 m_l \right )/Volume(B),
\f}
where Volume(B) is the volume of the body that approximate the sphere.
Now we know how to calculate the mean value in a sphere for given midpoint and radius. So we assume each voxel in the given image to be the sphere midpoint and we calculate the mean value as described above. If the new mean value is greater than the "maximum-until-now", we take the new value to be the "maximum-until-now". Then we go to the next voxel and make the same calculation and so on. At the same time we save the coordinates of the midpoint voxel.
After we found the midpoint and the maximal mean value, we can calculate the maximum and the minimum in the sphere: we just traverse all the voxels in the region and take the maximum and minimum value and the respective coordinates.
\section Input-and-output Input and output
An example for an input in the command-line is:
\verbatim
mitkMultiGaussianTest C:/temp/outputFile C:/temp/inputFile.xml
\endverbatim
Here is outputFile the name of the gaussian image with extension .nrrd and at the same time the name of the output file with extension .xml, which is the same as the inputFile, only added the calculated mean value, max and min and the corresponding indexes in the statistic tag. Here we see an example for the input and output .xml file:
\verbatim
INPUT:
<testcase>
<testimage image-rows="20" image-columns="20" image-slices="20" numberOfGaussians="2" spacingX="1" spacingY="1" spacingZ="1" entireHotSpotInImage="1">
<gaussian centerIndexX="4" centerIndexY="16" centerIndexZ="10" deviationX="7" deviationY="7" deviationZ="7" altitude="200"/>
<gaussian centerIndexX="18" centerIndexY="2" centerIndexZ="10" deviationX="1" deviationY="1" deviationZ="1" altitude="210"/>
</testimage>
<segmentation numberOfLabels="1" hotspotRadiusInMM="6.2035">
<roi label="1" maximumSizeX="20" minimumSizeX="0" maximumSizeY="20" minimumSizeY="0" maximumSizeZ="20" minimumSizeZ="0"/>
</segmentation>
</testcase>
\endverbatim
\verbatim
OUTPUT:
<testcase>
<testimage image-rows="20" image-columns="20" image-slices="20" numberOfGaussians="2" spacingX="1" spacingY="1" spacingZ="1" entireHotSpotInImage="1">
<gaussian centerIndexX="4" centerIndexY="16" centerIndexZ="10" deviationX="7" deviationY="7" deviationZ="7" altitude="200"/>
<gaussian centerIndexX="18" centerIndexY="2" centerIndexZ="10" deviationX="1" deviationY="1" deviationZ="1" altitude="210"/>
</testimage>
<segmentation numberOfLabels="1" hotspotRadiusInMM="6.2035">
<roi label="1" maximumSizeX="20" minimumSizeX="0" maximumSizeY="20" minimumSizeY="0" maximumSizeZ="20" minimumSizeZ="0"/>
</segmentation>
<statistic hotspotIndexX="6" hotspotIndexY="13" hotspotIndexZ="10" peak="141.544" mean="141.544" maximumIndexX="4" maximumIndexY="16" maximumIndexZ="10" maximum="200" minimumIndexX="9" minimumIndexY="8" minimumIndexZ="8" minimum="77.4272"/>
</testcase>
\endverbatim
\subsection Parameter-for-the-input Parameter for the input
In the tag \a testimage we describe the image that we generate. Image rows/columns/slices gives the number of rows/columns/slices of the image; \a numberOfGaussians is the number of gauss functions (\f$ N \f$); spacing defines the extend of one voxel for each direction. The parameter \a entireHotSpotInImage determines whether the whole sphere is in the image included (\f$ = 1 \f$) or only the midpoint of the sphere is inside the image.
NOTE: When the \a entireHotSpotInImage \f$ = 0 \f$ it is possible that we find the midpoint of the sphere on the border of the image. In this case we cut the approximation of the sphere, so that we become a body, which is completely inside the image, but not a "sphere" anymore. To that effect is the volume of the body decreased and that could lead to unexpected results.
In the subtag \a gaussian we describe each gauss function as mentioned in the second section.
In the tag \a segmentation we define the radius of the wanted sphere in mm (\a hotspotRadiusInMM ). We can also set the number of labels (\a numberOfLabels ) to be an positive number and this determines the number of regions of interest (ROI). In each ROI we find the sphere with the wanted properties and midpoint inside the ROI, but not necessarily the whole sphere. In the subtag \a roi we set label number and the index coordinates for the borders of the roi.
*/
template< typename TOutputImage >
class ITK_EXPORT MultiGaussianImageSource:public ImageSource< TOutputImage >
{
public:
/** Standard class typedefs. */
typedef MultiGaussianImageSource Self;
typedef ImageSource< TOutputImage > Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Typedef for the output image PixelType. */
typedef typename TOutputImage::PixelType OutputImagePixelType;
/** Typedef to describe the output image region type. */
typedef typename TOutputImage::RegionType OutputImageRegionType;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Basic types from the OutputImageType */
typedef typename TOutputImage::SizeType SizeType;
typedef typename TOutputImage::IndexType IndexType;
typedef typename TOutputImage::SpacingType SpacingType;
typedef typename TOutputImage::PointType PointType;
typedef typename SizeType::SizeValueType SizeValueType;
typedef SizeValueType SizeValueArrayType[TOutputImage::ImageDimension];
typedef typename TOutputImage::SpacingValueType SpacingValueType;
typedef SpacingValueType SpacingValueArrayType[TOutputImage::ImageDimension];
typedef typename TOutputImage::PointValueType PointValueType;
typedef PointValueType PointValueArrayType[TOutputImage::ImageDimension];
typedef typename itk::ImageRegion<3> ::SizeValueType SizeRegionType;
/** Typedef to describe the sphere radius type. */
typedef double RadiusType;
/** Typedef to describe the standard vector type. */
typedef std::vector<double> VectorType;
/** Typedef to describe the itk vector type. */
typedef Vector<double, TOutputImage::ImageDimension> ItkVectorType;
/** Typedef to describe the ImageRegionIteratorWithIndex type. */
typedef ImageRegionIteratorWithIndex<TOutputImage> IteratorType;
/** Typedef to describe the Poiner type at the output image. */
typedef typename TOutputImage::Pointer ImageType;
typedef MapContainer<unsigned int, PointType> MapContainerPoints;
typedef MapContainer<unsigned int, double> MapContainerRadius;
/** Set/Get size of the output image. */
itkSetMacro(Size, SizeType);
virtual void SetSize(SizeValueArrayType sizeArray);
virtual const SizeValueType * GetSize() const;
/** Set/Get spacing of the output image. */
itkSetMacro(Spacing, SpacingType);
virtual void SetSpacing(SpacingValueArrayType spacingArray);
virtual const SpacingValueType * GetSpacing() const;
/** Set/Get origin of the output image. This programm works proper only with origin [0.0, 0.0, 0.0] */
itkSetMacro(Origin, PointType);
virtual void SetOrigin(PointValueArrayType originArray);
virtual const PointValueType * GetOrigin() const;
/** Get the number of gaussian functions in the output image. */
virtual unsigned int GetNumberOfGaussians() const;
/** Set the number of gaussian function. */
virtual void SetNumberOfGausssians( unsigned int );
/** Set/Get the radius of the sphere. */
virtual RadiusType GetRadius() const;
virtual void SetRadius( RadiusType radius );
/** Get the maximal mean value in a sphere over all possible spheres with midpoint in the image. */
virtual const OutputImagePixelType GetMaxMeanValue() const;
/** Get the index of the midpoint of a sphere with the maximal mean value.*/
virtual const IndexType GetSphereMidpoint() const;
/** Calculates the value of the multigaussian function at a Point given by its coordinates [x, y, z]. */
virtual double MultiGaussianFunctionValueAtPoint(double , double, double);
/** Adds a multigaussian defined by the parameter: CenterX, CenterY, CenterZ, SigmaX, SigmaY, SigmaZ, Altitude.
All parameters should have the same size, which determinates the number of the gaussian added. */
virtual void AddGaussian( VectorType centerX, VectorType centerY, VectorType centerZ, VectorType sigmaX, VectorType sigmaY, VectorType sigmaZ, VectorType altitude);
/** Calculates and set the index of the midpoint of the sphere with the maximal mean value as well as the mean value. */
virtual void CalculateTheMidpointAndTheMeanValueWithOctree();
/** Calculates and set the index an the value of maximulm and minimum in the wanted sphere. */
virtual void CalculateMaxAndMinInSphere();
/** Get the index in the sphere with maximal value. */
virtual const IndexType GetMaxValueIndexInSphere() const;
/** Get the maximal value in the sphere. */
virtual const OutputImagePixelType GetMaxValueInSphere() const;
/** Get the index in the sphere with minimal value. */
virtual const IndexType GetMinValueIndexInSphere() const;
/** Get the minimal value in the sphere. */
virtual const OutputImagePixelType GetMinValueInSphere() const;
/** Set the region of interest. */
virtual void SetRegionOfInterest(ItkVectorType, ItkVectorType);
/** Write a .mps file to visualise the point in the sphere. */
virtual void WriteXMLToTestTheCuboidInsideTheSphere();
/**This recursive method realise the octree method. It subdivide a cuboid in eight cuboids, when this cuboid crosses the boundary of sphere. If the cuboid is inside the sphere, it calculates the integral. */
virtual void CalculateEdgesInSphere( PointType globalCoordinateMidpointCuboid, PointType globalCoordinateMidpointSphere, double cuboidRadius, int level);
/**Calculate and return value of the integral of the gaussian in a cuboid region with the dimension 3: in the x-axis between xMin and xMax and in the y-axis between yMin and yMax and in the z-axis also between zMin and zMax. */
virtual double MultiGaussianFunctionValueAtCuboid(double xMin, double xMax, double yMin, double yMax, double zMin, double zMax);
/** Inseret the midpoints of cuboid in a vector m_Midpoints, so that we can visualise it. */
virtual void InsertPoints( PointType globalCoordinateMidpointCuboid, double cuboidRadius);
/** Start the octree recursion in eigth directions for the sphere with midpoint globalCoordinateMidpointSphere. */
virtual void GenerateCuboidSegmentationInSphere( PointType globalCoordinateMidpointSphere );
/** Get the the values of the cumulative distribution function of the normal distribution. */
virtual double FunctionPhi(double value);
/** Check if a cuboid with midpoint globalCoordinateMidpointCuboid and side length sideLength intersect the sphere with midpoint globalCoordinateMidpointSphere boundary. */
virtual unsigned int IntersectTheSphere( PointType globalCoordinateMidpointCuboid, PointType globalCoordinateMidpointSphere, double sideLength);
/** Set the tabel values of the distribution function of the normal distribution. */
void SetNormalDistributionValues();
/** Set the minimum possible pixel value. By default, it is
* NumericTraits<TOutputImage::PixelType>::min(). */
itkSetClampMacro( Min, OutputImagePixelType,
NumericTraits< OutputImagePixelType >::NonpositiveMin(),
NumericTraits< OutputImagePixelType >::max() );
/** Check if a index is inside the image*/
bool IsInImage(IndexType index);
/** Get the minimum possible pixel value. */
itkGetConstMacro(Min, OutputImagePixelType);
/** Set the maximum possible pixel value. By default, it is
* NumericTraits<TOutputImage::PixelType>::max(). */
itkSetClampMacro( Max, OutputImagePixelType,
NumericTraits< OutputImagePixelType >::NonpositiveMin(),
NumericTraits< OutputImagePixelType >::max() );
/** Get the maximum possible pixel value. */
itkGetConstMacro(Max, OutputImagePixelType);
protected:
MultiGaussianImageSource();
~MultiGaussianImageSource() override;
void PrintSelf(std::ostream & os, Indent indent) const override;
void GenerateData() override;
void GenerateOutputInformation() override;
private:
MultiGaussianImageSource(const MultiGaussianImageSource &); //purposely not implemented
void operator=(const MultiGaussianImageSource &); //purposely not implemented
SizeType m_Size; //size of the output image
SpacingType m_Spacing; //spacing
PointType m_Origin; //origin
OutputImagePixelType m_MaxValueInSphere; //maximal value in the wanted sphere
IndexType m_MaxValueIndexInSphere; //index of the maximal value in the wanted sphere
OutputImagePixelType m_MinValueInSphere; //minimal value in the wanted sphere
IndexType m_MinValueIndexInSphere; //index of the minimal value in the wanted sphere
unsigned int m_NumberOfGaussians; //number of Gaussians
RadiusType m_Radius; //radius of the sphere
unsigned int m_RadiusStepNumber; //number of steps to traverse the sphere radius
OutputImagePixelType m_MeanValue; //mean value in the wanted sphere
OutputImagePixelType m_ValueAtMidpoint; //value at the midpoint of the wanted sphere
IndexType m_SphereMidpoint; //midpoint of the wanted sphere
VectorType m_SigmaX; //deviation in the x-axis
VectorType m_SigmaY; //deviation in the y-axis
VectorType m_SigmaZ; //deviation in the z-axis
VectorType m_CenterX; //x-coordinate of the mean value of Gaussians
VectorType m_CenterY; //y-coordinate of the mean value of Gaussians
VectorType m_CenterZ; //z-coordinate of the mean value of Gaussians
VectorType m_Altitude; //amplitude
ItkVectorType m_RegionOfInterestMax; //maximal values for the coordinates in the region of interest
ItkVectorType m_RegionOfInterestMin; //minimal values for the coordinates in the region of interest
typename TOutputImage::PixelType m_Min; //minimum possible value
typename TOutputImage::PixelType m_Max; //maximum possible value
PointType m_GlobalCoordinate; //physical coordiante of the sphere midpoint
bool m_WriteMPS; //1 = write a MPS File to visualise the cuboid midpoints of one approximation of the sphere
MapContainerPoints m_Midpoints; //the midpoints of the cuboids
MapContainerRadius m_RadiusCuboid; //the radius ( = 0.5 * side length) of the cuboids (in the same order as the midpoints in m_Midpoints)
double m_Volume; //the volume of the body, that approximize the sphere
double m_NormalDistValues [410];//normal distribution values
double m_meanValueTemp; //= m_Volume * meanValue in each sphere
// The following variables are deprecated, and provided here just for
// backward compatibility. It use is discouraged.
mutable PointValueArrayType m_OriginArray;
mutable SpacingValueArrayType m_SpacingArray;
};
} // end namespace itk
#ifndef ITK_MANUAL_INSTANTIATION
#include "itkMultiGaussianImageSource.hxx"
#endif
#endif
diff --git a/Modules/ImageStatistics/mitkExtendedLabelStatisticsImageFilter.hxx b/Modules/ImageStatistics/mitkExtendedLabelStatisticsImageFilter.hxx
index 794133be0a..05223f2105 100644
--- a/Modules/ImageStatistics/mitkExtendedLabelStatisticsImageFilter.hxx
+++ b/Modules/ImageStatistics/mitkExtendedLabelStatisticsImageFilter.hxx
@@ -1,756 +1,737 @@
/*============================================================================
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 _mitkExtendedLabelStatisticsImageFilter_hxx
#define _mitkExtendedLabelStatisticsImageFilter_hxx
#include "mitkExtendedLabelStatisticsImageFilter.h"
#include "itkImageRegionConstIteratorWithIndex.h"
#include "itkImageRegionConstIterator.h"
#include <mbilog.h>
#include <mitkLogMacros.h>
#include "mitkNumericConstants.h"
#include "mitkLogMacros.h"
#include <mitkHistogramStatisticsCalculator.h>
namespace itk
{
template< class TInputImage, class TLabelImage >
bool
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetMaskingNonEmpty() const
{
return m_MaskNonEmpty;
}
template< typename TInputImage, typename TLabelImage >
void
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::SetHistogramParameters(const int numBins, RealType lowerBound, RealType upperBound)
{
m_NumBins[0] = numBins;
m_LowerBound = lowerBound;
m_UpperBound = upperBound;
m_GlobalHistogramParametersSet = true;
m_PreferGlobalHistogramParameters = true;
this->Modified();
}
template< typename TInputImage, typename TLabelImage >
void
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::SetHistogramParametersForLabels(std::map<LabelPixelType, unsigned int> numBins, std::map<LabelPixelType, PixelType> lowerBound,
std::map<LabelPixelType, PixelType> upperBound)
{
m_LabelMin = lowerBound;
m_LabelMax = upperBound;
m_LabelNBins = numBins;
m_LabelHistogramParametersSet = true;
m_PreferGlobalHistogramParameters = false;
this->Modified();
}
template< class TInputImage, class TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::RealType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetUniformity(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- // label does not exist, return a default value
- return NumericTraits< PixelType >::Zero;
+ mitkThrow() << "Label does not exist";
}
else
{
return ( *mapIt ).second.m_Uniformity;
}
}
template< class TInputImage, class TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::RealType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetMedian(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- // label does not exist, return a default value
- return NumericTraits< PixelType >::Zero;
+ mitkThrow() << "Label does not exist";
}
else
{
return ( *mapIt ).second.m_Median;
}
}
template< class TInputImage, class TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::RealType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetEntropy(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- // label does not exist, return a default value
- return NumericTraits< PixelType >::Zero;
+ mitkThrow() << "Label does not exist";
}
else
{
return ( *mapIt ).second.m_Entropy;
}
}
template< class TInputImage, class TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::RealType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetUPP(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- // label does not exist, return a default value
- return NumericTraits< PixelType >::Zero;
+ mitkThrow() << "Label does not exist";
}
else
{
return ( *mapIt ).second.m_UPP;
}
}
template< class TInputImage, class TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::RealType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetMPP(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- // label does not exist, return a default value
- return NumericTraits< PixelType >::Zero;
+ mitkThrow() << "Label does not exist";
}
else
{
return ( *mapIt ).second.m_MPP;
}
}
template< class TInputImage, class TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::RealType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetKurtosis(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- // label does not exist, return a default value
- return NumericTraits< PixelType >::Zero;
+ mitkThrow() << "Label does not exist";
}
else
{
return ( *mapIt ).second.m_Kurtosis;
}
}
template< class TInputImage, class TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::RealType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetSkewness(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- // label does not exist, return a default value
- return NumericTraits< PixelType >::Zero;
+ mitkThrow() << "Label does not exist";
}
else
{
return ( *mapIt ).second.m_Skewness;
}
}
template< typename TInputImage, typename TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::RealType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetMinimum(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- // label does not exist, return a default value
- return NumericTraits< PixelType >::max();
+ mitkThrow() << "Label does not exist";
}
else
{
return ( *mapIt ).second.m_Minimum;
}
}
template< typename TInputImage, typename TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::RealType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetMaximum(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- // label does not exist, return a default value
- return NumericTraits< PixelType >::NonpositiveMin();
+ mitkThrow() << "Label does not exist";
}
else
{
return ( *mapIt ).second.m_Maximum;
}
}
template< typename TInputImage, typename TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::RealType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetMean(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- // label does not exist, return a default value
- return NumericTraits< PixelType >::ZeroValue();
+ mitkThrow() << "Label does not exist";
}
else
{
return ( *mapIt ).second.m_Mean;
}
}
template< typename TInputImage, typename TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::RealType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetSum(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- // label does not exist, return a default value
- return NumericTraits< PixelType >::ZeroValue();
+ mitkThrow() << "Label does not exist";
}
else
{
return ( *mapIt ).second.m_Sum;
}
}
template< typename TInputImage, typename TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::RealType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetSigma(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- // label does not exist, return a default value
- return NumericTraits< PixelType >::ZeroValue();
+ mitkThrow() << "Label does not exist";
}
else
{
return ( *mapIt ).second.m_Sigma;
}
}
template< typename TInputImage, typename TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::RealType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetVariance(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- // label does not exist, return a default value
- return NumericTraits< PixelType >::ZeroValue();
+ mitkThrow() << "Label does not exist";
}
else
{
return ( *mapIt ).second.m_Variance;
}
}
template< typename TInputImage, typename TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::BoundingBoxType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetBoundingBox(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- typename Superclass::BoundingBoxType emptyBox;
- // label does not exist, return a default value
- return emptyBox;
+ mitkThrow() << "Label does not exist";
}
else
{
return ( *mapIt ).second.m_BoundingBox;
}
}
template< typename TInputImage, typename TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::RegionType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetRegion(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- typename Superclass::RegionType emptyRegion;
- // label does not exist, return a default value
- return emptyRegion;
+ mitkThrow() << "Label does not exist";
}
else
{
typename Superclass::BoundingBoxType bbox = this->GetBoundingBox(label);
typename Superclass::IndexType index;
typename Superclass::SizeType size;
unsigned int dimension = bbox.size() / 2;
for ( unsigned int i = 0; i < dimension; i++ )
{
index[i] = bbox[2 * i];
size[i] = bbox[2 * i + 1] - bbox[2 * i] + 1;
}
typename Superclass::RegionType region;
region.SetSize(size);
region.SetIndex(index);
return region;
}
}
template< typename TInputImage, typename TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::MapSizeType
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetCount(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- // label does not exist, return a default value
- return 0;
+ mitkThrow() << "Label does not exist";
}
else
{
return ( *mapIt ).second.m_Count;
}
}
template< typename TInputImage, typename TLabelImage >
typename ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::HistogramType::Pointer
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetHistogram(LabelPixelType label) const
{
StatisticsMapConstIterator mapIt;
mapIt = m_LabelStatistics.find(label);
if ( mapIt == m_LabelStatistics.end() )
{
- // label does not exist, return a default value
- return ITK_NULLPTR;
+ mitkThrow() << "Label does not exist";
}
else
{
// this will be zero if histograms have not been enabled
return ( *mapIt ).second.m_Histogram;
}
}
template< typename TInputImage, typename TLabelImage >
void
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::BeforeThreadedGenerateData()
{
ThreadIdType numberOfThreads = this->GetNumberOfThreads();
// Resize the thread temporaries
m_LabelStatisticsPerThread.resize(numberOfThreads);
// Initialize the temporaries
for ( ThreadIdType i = 0; i < numberOfThreads; ++i )
{
m_LabelStatisticsPerThread[i].clear();
}
// Initialize the final map
m_LabelStatistics.clear();
}
template< typename TInputImage, typename TLabelImage >
std::list<int>
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::GetRelevantLabels() const
{
std::list< int> relevantLabels;
for (int i = 0; i < 4096; ++i )
{
if ( this->HasLabel( i ) )
{
relevantLabels.push_back( i );
}
}
return relevantLabels;
}
template< typename TInputImage, typename TLabelImage >
void
ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >
::ThreadedGenerateData(const typename TInputImage::RegionType & outputRegionForThread,
ThreadIdType threadId)
{
typename HistogramType::IndexType histogramIndex(1);
typename HistogramType::MeasurementVectorType histogramMeasurement(1);
const SizeValueType size0 = outputRegionForThread.GetSize(0);
if( size0 == 0)
{
return;
}
ImageLinearConstIteratorWithIndex< TInputImage > it (this->GetInput(),
outputRegionForThread);
ImageScanlineConstIterator< TLabelImage > labelIt (this->GetLabelInput(),
outputRegionForThread);
StatisticsMapIterator mapIt;
// support progress methods/callbacks
const size_t numberOfLinesToProcess = outputRegionForThread.GetNumberOfPixels() / size0;
ProgressReporter progress( this, threadId, numberOfLinesToProcess );
typedef typename MapType::value_type MapValueType;
// do the work
while ( !it.IsAtEnd() )
{
while ( !it.IsAtEndOfLine() )
{
const RealType & value = static_cast< RealType >( it.Get() );
const LabelPixelType & label = labelIt.Get();
// is the label already in this thread?
mapIt = m_LabelStatisticsPerThread[threadId].find(label);
if ( mapIt == m_LabelStatisticsPerThread[threadId].end() )
{
// if global histogram parameters are set and preferred then use them
if ( m_PreferGlobalHistogramParameters && m_GlobalHistogramParametersSet )
{
mapIt = m_LabelStatisticsPerThread[threadId].insert( MapValueType( label,
LabelStatistics(m_NumBins[0], m_LowerBound,
m_UpperBound) ) ).first;
}
// if we have label histogram parameters then use them. If we encounter a label that has no parameters then use global settings if available
else if(!m_PreferGlobalHistogramParameters && m_LabelHistogramParametersSet)
{
typename std::map<LabelPixelType, PixelType>::iterator lbIt, ubIt;
typename std::map<LabelPixelType, unsigned int>::iterator nbIt;
lbIt = m_LabelMin.find(label);
ubIt = m_LabelMax.find(label);
nbIt = m_LabelNBins.find(label);
// if any of the parameters is lacking for the current label but global histogram params are available, use the global parameters
if ((lbIt == m_LabelMin.end() || ubIt == m_LabelMax.end() || nbIt == m_LabelNBins.end()) && m_GlobalHistogramParametersSet)
{
mapIt = m_LabelStatisticsPerThread[threadId].insert( MapValueType( label,
LabelStatistics(m_NumBins[0], m_LowerBound,
m_UpperBound) ) ).first;
}
// if any of the parameters is lacking for the current label and global histogram params are not available, dont use histograms for this label
else if ((lbIt == m_LabelMin.end() || ubIt == m_LabelMax.end() || nbIt == m_LabelNBins.end()) && !m_GlobalHistogramParametersSet)
{
mapIt = m_LabelStatisticsPerThread[threadId].insert( MapValueType( label,
LabelStatistics() ) ).first;
}
// label histogram parameters are available, use them!
else
{
PixelType lowerBound, upperBound;
unsigned int nBins;
lowerBound = (*lbIt).second;
upperBound = (*ubIt).second;
nBins = (*nbIt).second;
mapIt = m_LabelStatisticsPerThread[threadId].insert( MapValueType( label,
LabelStatistics(nBins, lowerBound, upperBound) ) ).first;
}
}
// neither global nor label specific histogram parameters are set -> don't use histograms
else
{
mapIt = m_LabelStatisticsPerThread[threadId].insert( MapValueType( label,
LabelStatistics() ) ).first;
}
}
typename MapType::mapped_type &labelStats = ( *mapIt ).second;
// update the values for this label and this thread
if ( value < labelStats.m_Minimum )
{
labelStats.m_Minimum = value;
}
if ( value > labelStats.m_Maximum )
{
labelStats.m_Maximum = value;
}
// bounding box is min,max pairs
for ( unsigned int i = 0; i < ( 2 * TInputImage::ImageDimension ); i += 2 )
{
const typename TInputImage::IndexType & index = it.GetIndex();
if ( labelStats.m_BoundingBox[i] > index[i / 2] )
{
labelStats.m_BoundingBox[i] = index[i / 2];
}
if ( labelStats.m_BoundingBox[i + 1] < index[i / 2] )
{
labelStats.m_BoundingBox[i + 1] = index[i / 2];
}
}
labelStats.m_Sum += value;
labelStats.m_SumOfSquares += ( value * value );
labelStats.m_Count++;
labelStats.m_SumOfCubes += std::pow(value, 3.);
labelStats.m_SumOfQuadruples += std::pow(value, 4.);
if (value > 0)
{
labelStats.m_PositivePixelCount++;
labelStats.m_SumOfPositivePixels += value;
}
// if enabled, update the histogram for this label
if ( labelStats.m_Histogram.IsNotNull() )
{
histogramMeasurement[0] = value;
labelStats.m_Histogram->GetIndex(histogramMeasurement, histogramIndex);
labelStats.m_Histogram->IncreaseFrequencyOfIndex(histogramIndex, 1);
}
++labelIt;
++it;
}
labelIt.NextLine();
it.NextLine();
progress.CompletedPixel();
}
}
template< class TInputImage, class TLabelImage >
void ExtendedLabelStatisticsImageFilter< TInputImage, TLabelImage >::
AfterThreadedGenerateData()
{
StatisticsMapIterator mapIt;
StatisticsMapConstIterator threadIt;
ThreadIdType i;
ThreadIdType numberOfThreads = this->GetNumberOfThreads();
// Run through the map for each thread and accumulate the count,
// sum, and sumofsquares
for ( i = 0; i < numberOfThreads; i++ )
{
// iterate over the map for this thread
for ( threadIt = m_LabelStatisticsPerThread[i].begin();
threadIt != m_LabelStatisticsPerThread[i].end();
++threadIt )
{
// does this label exist in the cumulative structure yet?
mapIt = m_LabelStatistics.find( ( *threadIt ).first );
if ( mapIt == m_LabelStatistics.end() )
{
// create a new entry
typedef typename MapType::value_type MapValueType;
if ( m_GlobalHistogramParametersSet || m_LabelHistogramParametersSet )
{
// mapIt = m_LabelStatistics.insert( MapValueType( ( *threadIt ).first,
// LabelStatistics(m_NumBins[0], m_LowerBound,
// m_UpperBound) ) ).first;
mapIt = m_LabelStatistics.insert( MapValueType( *threadIt ) ).first;
continue;
}
else
{
mapIt = m_LabelStatistics.insert( MapValueType( ( *threadIt ).first,
LabelStatistics() ) ).first;
}
}
typename MapType::mapped_type &labelStats = ( *mapIt ).second;
// accumulate the information from this thread
labelStats.m_Count += ( *threadIt ).second.m_Count;
labelStats.m_Sum += ( *threadIt ).second.m_Sum;
labelStats.m_SumOfSquares += ( *threadIt ).second.m_SumOfSquares;
labelStats.m_SumOfPositivePixels += ( *threadIt ).second.m_SumOfPositivePixels;
labelStats.m_PositivePixelCount += ( *threadIt ).second.m_PositivePixelCount;
labelStats.m_SumOfCubes += ( *threadIt ).second.m_SumOfCubes;
labelStats.m_SumOfQuadruples += ( *threadIt ).second.m_SumOfQuadruples;
if ( labelStats.m_Minimum > ( *threadIt ).second.m_Minimum )
{
labelStats.m_Minimum = ( *threadIt ).second.m_Minimum;
}
if ( labelStats.m_Maximum < ( *threadIt ).second.m_Maximum )
{
labelStats.m_Maximum = ( *threadIt ).second.m_Maximum;
}
//bounding box is min,max pairs
int dimension = labelStats.m_BoundingBox.size() / 2;
for ( int ii = 0; ii < ( dimension * 2 ); ii += 2 )
{
if ( labelStats.m_BoundingBox[ii] > ( *threadIt ).second.m_BoundingBox[ii] )
{
labelStats.m_BoundingBox[ii] = ( *threadIt ).second.m_BoundingBox[ii];
}
if ( labelStats.m_BoundingBox[ii + 1] < ( *threadIt ).second.m_BoundingBox[ii + 1] )
{
labelStats.m_BoundingBox[ii + 1] = ( *threadIt ).second.m_BoundingBox[ii + 1];
}
}
// if enabled, update the histogram for this label
if ( m_GlobalHistogramParametersSet || m_LabelHistogramParametersSet )
{
typename HistogramType::IndexType index;
index.SetSize(1);
for ( unsigned int bin = 0; bin < labelStats.m_Histogram->Size(); bin++ )
{
index[0] = bin;
labelStats.m_Histogram->IncreaseFrequency( bin, ( *threadIt ).second.m_Histogram->GetFrequency(bin) );
}
}
} // end of thread map iterator loop
} // end of thread loop
// compute the remainder of the statistics
for ( mapIt = m_LabelStatistics.begin();
mapIt != m_LabelStatistics.end();
++mapIt )
{
typename MapType::mapped_type &labelStats = ( *mapIt ).second;
// mean
labelStats.m_Mean = labelStats.m_Sum
/ static_cast< RealType >( labelStats.m_Count );
// MPP
labelStats.m_MPP = labelStats.m_SumOfPositivePixels
/ static_cast< RealType >( labelStats.m_PositivePixelCount );
// variance
if ( labelStats.m_Count > 0 )
{
// unbiased estimate of variance
LabelStatistics & ls = mapIt->second;
const RealType sumSquared = ls.m_Sum * ls.m_Sum;
const RealType count = static_cast< RealType >( ls.m_Count );
ls.m_Variance = ( ls.m_SumOfSquares - sumSquared / count ) / ( count );
RealType secondMoment = ls.m_SumOfSquares / count;
RealType thirdMoment = ls.m_SumOfCubes / count;
RealType fourthMoment = ls.m_SumOfQuadruples / count;
ls.m_Skewness = (thirdMoment - 3. * secondMoment * ls.m_Mean + 2. * std::pow(ls.m_Mean, 3.)) / std::pow(secondMoment - std::pow(ls.m_Mean, 2.), 1.5); // see http://www.boost.org/doc/libs/1_51_0/doc/html/boost/accumulators/impl/skewness_impl.html
ls.m_Kurtosis = (fourthMoment - 4. * thirdMoment * ls.m_Mean + 6. * secondMoment * std::pow(ls.m_Mean, 2.) - 3. * std::pow(ls.m_Mean, 4.)) / std::pow(secondMoment - std::pow(ls.m_Mean, 2.), 2.); // see http://www.boost.org/doc/libs/1_51_0/doc/html/boost/accumulators/impl/kurtosis_impl.html, dropped -3
}
else
{
labelStats.m_Variance = NumericTraits< RealType >::ZeroValue();
labelStats.m_Skewness = NumericTraits< RealType >::ZeroValue();
labelStats.m_Kurtosis = NumericTraits< RealType >::ZeroValue();
}
// sigma
labelStats.m_Sigma = std::sqrt( labelStats.m_Variance );
// histogram statistics
if (labelStats.m_Histogram.IsNotNull())
{
mitk::HistogramStatisticsCalculator histStatCalc;
histStatCalc.SetHistogram(labelStats.m_Histogram);
histStatCalc.CalculateStatistics();
labelStats.m_Median = histStatCalc.GetMedian();
labelStats.m_Entropy = histStatCalc.GetEntropy();
labelStats.m_Uniformity = histStatCalc.GetUniformity();
labelStats.m_UPP = histStatCalc.GetUPP();
}
}
{
//Now update the cached vector of valid labels.
m_ValidLabelValues.resize(0);
m_ValidLabelValues.reserve(m_LabelStatistics.size());
for ( mapIt = m_LabelStatistics.begin();
mapIt != m_LabelStatistics.end();
++mapIt )
{
m_ValidLabelValues.push_back(mapIt->first);
}
}
}
} // end namespace itk
#endif
diff --git a/Modules/ImageStatistics/mitkImageStatisticsContainerManager.h b/Modules/ImageStatistics/mitkImageStatisticsContainerManager.h
index cab786019e..88de6ebd04 100644
--- a/Modules/ImageStatistics/mitkImageStatisticsContainerManager.h
+++ b/Modules/ImageStatistics/mitkImageStatisticsContainerManager.h
@@ -1,60 +1,63 @@
/*============================================================================
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 QmitkImageStatisticsContainerManager_H__INCLUDED
#define QmitkImageStatisticsContainerManager_H__INCLUDED
#include "MitkImageStatisticsExports.h"
#include <mitkDataStorage.h>
#include <mitkImageStatisticsContainer.h>
#include <mitkBaseData.h>
#include <mitkNodePredicateBase.h>
#include <mitkGenericIDRelationRule.h>
#include <mitkPropertyRelations.h>
namespace mitk
{
static const std::string STATS_HISTOGRAM_BIN_PROPERTY_NAME = "MITK.statistic.histogram_bins";
static const std::string STATS_IGNORE_ZERO_VOXEL_PROPERTY_NAME = "MITK.statistic.ignore_zero_voxel";
static const std::string STATS_GENERATION_STATUS_PROPERTY_NAME = "MITK.statistic.generation.status";
static const std::string STATS_GENERATION_STATUS_VALUE_WORK_IN_PROGRESS = "workInProgress";
static const std::string STATS_GENERATION_STATUS_VALUE_PENDING = "pending";
static const std::string STATS_GENERATION_STATUS_VALUE_BASE_DATA_FAILED = "failed";
/**
\brief Returns the StatisticsContainer that was computed on given input (image/mask/planar figure) and is added as DataNode in a DataStorage
*/
class MITKIMAGESTATISTICS_EXPORT ImageStatisticsContainerManager
{
public:
/**Documentation
@brief Returns the StatisticsContainer for the given image and mask from the storage-
@return a valid StatisticsContainer or nullptr if no StatisticsContainer is found.
@details if more than one StatisticsContainer is found, only the newest (ModifiedTime) is returned
@pre Datastorage must point to a valid instance.
@pre image must Point to a valid instance.
+ @param dataStorage
+ @param image
+ @param mask
@param onlyIfUpToDate Indicates if results should only be returned if the are up to date, thus not older then image and ROI.
@param noWIP If noWIP is true, the function only returns valid final result and not just its placeholder (WIP).
If noWIP equals false it might also return a WIP, thus the valid result is currently processed/ordered but might not be ready yet.
@param ignoreZeroVoxel indicates the wanted statistics are calculated with or w/o zero voxels.
@param histogramNBins Number of bins the statistics should have that are searched for.
*/
static mitk::ImageStatisticsContainer::Pointer GetImageStatistics(const mitk::DataStorage* dataStorage, const mitk::BaseData* image, const mitk::BaseData* mask=nullptr, bool ignoreZeroVoxel = false, unsigned int histogramNBins = 100, bool onlyIfUpToDate = true, bool noWIP = true);
static mitk::DataNode::Pointer GetImageStatisticsNode(const mitk::DataStorage* dataStorage, const mitk::BaseData* image, const mitk::BaseData* mask = nullptr, bool ignoreZeroVoxel = false, unsigned int histogramNBins = 100, bool onlyIfUpToDate = true, bool noWIP = true);
/** Returns the predicate that can be used to search for statistic containers of
the given image (and mask) in the passed data storage.*/
static mitk::NodePredicateBase::ConstPointer GetStatisticsPredicateForSources(const mitk::BaseData* image, const mitk::BaseData* mask = nullptr);
};
}
#endif
diff --git a/Modules/ImageStatistics/mitkIntensityProfile.h b/Modules/ImageStatistics/mitkIntensityProfile.h
index 4060012726..1ecab74dfc 100644
--- a/Modules/ImageStatistics/mitkIntensityProfile.h
+++ b/Modules/ImageStatistics/mitkIntensityProfile.h
@@ -1,135 +1,137 @@
/*============================================================================
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 mitkIntensityProfile_h
#define mitkIntensityProfile_h
#include <itkListSample.h>
#include <mitkImage.h>
#include <mitkPlanarLine.h>
#include <mitkImageStatisticsCalculator.h>
#include <MitkImageStatisticsExports.h>
namespace mitk
{
typedef itk::Statistics::ListSample<itk::Statistics::MeasurementVectorPixelTraits<ScalarType>::MeasurementVectorType> IntensityProfile;
/** \brief Compute intensity profile of an image for each pixel along the first PolyLine of a given planar figure.
*
* \param[in] image A two or three-dimensional image which consists of single component pixels.
* \param[in] planarFigure A planar figure from which the first PolyLine is used to evaluate the intensity profile.
*
* \return The computed intensity profile.
*/
MITKIMAGESTATISTICS_EXPORT IntensityProfile::Pointer ComputeIntensityProfile(Image::Pointer image, PlanarFigure::Pointer planarFigure);
namespace InterpolateImageFunction
{
enum Enum
{
NearestNeighbor,
Linear,
WindowedSinc_Blackman_3,
WindowedSinc_Blackman_4,
WindowedSinc_Blackman_5,
WindowedSinc_Cosine_3,
WindowedSinc_Cosine_4,
WindowedSinc_Cosine_5,
WindowedSinc_Hamming_3,
WindowedSinc_Hamming_4,
WindowedSinc_Hamming_5,
WindowedSinc_Lanczos_3,
WindowedSinc_Lanczos_4,
WindowedSinc_Lanczos_5,
WindowedSinc_Welch_3,
WindowedSinc_Welch_4,
WindowedSinc_Welch_5
};
}
/** \brief Compute intensity profile of an image for each sample along a planar line.
*
* \param[in] image A three-dimensional image which consists of single component pixels.
* \param[in] planarLine A planar line along which the intensity profile will be evaluated.
* \param[in] numSamples Number of samples along the planar line (must be at least 2).
* \param[in] interpolator Image interpolation function which is used to read each sample.
* \throw if image is 4D
*
* \return The computed intensity profile.
*/
MITKIMAGESTATISTICS_EXPORT IntensityProfile::Pointer ComputeIntensityProfile(Image::Pointer image, PlanarLine::Pointer planarLine, unsigned int numSamples, InterpolateImageFunction::Enum interpolator = InterpolateImageFunction::NearestNeighbor);
/** \brief Compute intensity profile of an image for each sample between two points.
*
* \param[in] image A three-dimensional image which consists of single component pixels.
* \param[in] startPoint A point at which the first sample is to be read.
* \param[in] endPoint A point at which the last sample is to be read.
* \param[in] numSamples Number of samples between startPoint and endPoint (must be at least 2).
* \param[in] interpolator Image interpolation function which is used to read each sample.
* \throw if image is 4D
*
* \return The computed intensity profile.
*/
MITKIMAGESTATISTICS_EXPORT IntensityProfile::Pointer ComputeIntensityProfile(Image::Pointer image, const Point3D& startPoint, const Point3D& endPoint, unsigned int numSamples, InterpolateImageFunction::Enum interpolator = InterpolateImageFunction::NearestNeighbor);
/** \brief Compute global maximum of an intensity profile.
*
* \param[in] intensityProfile An intensity profile.
+ * \param[out] max The global maximum.
*
* \return Index of the global maximum.
*/
MITKIMAGESTATISTICS_EXPORT IntensityProfile::InstanceIdentifier ComputeGlobalMaximum(IntensityProfile::ConstPointer intensityProfile, IntensityProfile::MeasurementType &max);
/** \brief Compute global minimum of an intensity profile.
*
* \param[in] intensityProfile An intensity profile.
+ * \param[out] min The global minimum.
*
* \return Index of the global minimum.
*/
MITKIMAGESTATISTICS_EXPORT IntensityProfile::InstanceIdentifier ComputeGlobalMinimum(IntensityProfile::ConstPointer intensityProfile, IntensityProfile::MeasurementType &min);
/** \brief Compute statistics of an intensity profile.
*
* \param[in] intensityProfile An intensity profile.
*
* \param[in] stats An ImageStatisticsCalculator::Statistics object to hold the calculated statistics.
*
*/
MITKIMAGESTATISTICS_EXPORT void ComputeIntensityProfileStatistics(IntensityProfile::ConstPointer intensityProfile, ImageStatisticsContainer::ImageStatisticsObject& stats);
/** \brief Compute center of maximum area under the curve of an intensity profile.
*
* \param[in] intensityProfile An intensity profile.
* \param[in] radius Radius of the area (width of area equals 1 + 2 * radius).
*
* \return Index of the maximum area center.
*/
MITKIMAGESTATISTICS_EXPORT IntensityProfile::InstanceIdentifier ComputeCenterOfMaximumArea(IntensityProfile::ConstPointer intensityProfile, IntensityProfile::InstanceIdentifier radius);
/** \brief Convert an intensity profile to a standard library vector.
*
* \param[in] intensityProfile An intensity profile.
*
* \return Standard library vector which contains the input intensity profile measurements.
*/
MITKIMAGESTATISTICS_EXPORT std::vector<IntensityProfile::MeasurementType> CreateVectorFromIntensityProfile(IntensityProfile::ConstPointer intensityProfile);
/** \brief Convert a standard library vector to an intensity profile.
*
* \param[in] vector An standard library vector which contains intensity profile measurements.
*
* \return An intensity profile.
*/
MITKIMAGESTATISTICS_EXPORT IntensityProfile::Pointer CreateIntensityProfileFromVector(const std::vector<IntensityProfile::MeasurementType>& vector);
}
#endif
diff --git a/Modules/ImageStatistics/mitkitkMaskImageFilter.h b/Modules/ImageStatistics/mitkitkMaskImageFilter.h
index 88bd86ea9f..68f2004590 100644
--- a/Modules/ImageStatistics/mitkitkMaskImageFilter.h
+++ b/Modules/ImageStatistics/mitkitkMaskImageFilter.h
@@ -1,289 +1,285 @@
/*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef __itkMaskImageFilter2_h
#define __itkMaskImageFilter2_h
#include "itkBinaryFunctorImageFilter.h"
#include "itkNumericTraits.h"
#include "itkVariableLengthVector.h"
#include <MitkImageStatisticsExports.h>
namespace itk
{
namespace Functor
{
/**
* \class MaskInput2
* \brief
* \ingroup ITKImageIntensity
*/
template< typename TInput, typename TMask, typename TOutput = TInput >
class MaskInput2
{
public:
typedef typename NumericTraits< TInput >::AccumulateType AccumulatorType;
MaskInput2()
{
m_MaskingValue = NumericTraits< TMask >::ZeroValue();
InitializeOutsideValue( static_cast<TOutput*>( nullptr ) );
}
~MaskInput2() {}
bool operator!=(const MaskInput2 &) const
{
return false;
}
bool operator==(const MaskInput2 & other) const
{
return !( *this != other );
}
inline TOutput operator()(const TInput & A, const TMask & B) const
{
if ( B == m_MaskingValue )
{
return static_cast< TOutput >( A );
}
else
{
return m_OutsideValue;
}
}
/** Method to explicitly set the outside value of the mask */
void SetOutsideValue(const TOutput & outsideValue)
{
m_OutsideValue = outsideValue;
}
/** Method to get the outside value of the mask */
const TOutput & GetOutsideValue() const
{
return m_OutsideValue;
}
/** Method to explicitly set the masking value */
void SetMaskingValue(const TMask & maskingValue)
{
m_MaskingValue = maskingValue;
}
/** Method to get the masking value */
const TMask & GetMaskingValue() const
{
return m_MaskingValue;
}
private:
template < typename TPixelType >
void InitializeOutsideValue( TPixelType * )
{
this->m_OutsideValue = NumericTraits< TPixelType >::ZeroValue();
}
template < typename TValue >
void InitializeOutsideValue( VariableLengthVector<TValue> * )
{
// set the outside value to be of zero length
this->m_OutsideValue = VariableLengthVector< TValue >(0);
}
TOutput m_OutsideValue;
TMask m_MaskingValue;
};
}
/** \class MaskImageFilter
* \brief Mask an image with a mask.
*
* This class is templated over the types of the
* input image type, the mask image type and the type of the output image.
* Numeric conversions (castings) are done by the C++ defaults.
*
* The pixel type of the input 2 image must have a valid definition of the
* operator != with zero. This condition is required because internally this
* filter will perform the operation
*
- * \code
+ * \code{.unparsed}
* if pixel_from_mask_image == masking_value
* pixel_output_image = pixel_input_image
* else
* pixel_output_image = outside_value
* \endcode
*
* The pixel from the input 1 is cast to the pixel type of the output image.
*
* Note that the input and the mask images must be of the same size.
*
*
* \sa MaskNegatedImageFilter
* \ingroup IntensityImageFilters
* \ingroup MultiThreaded
* \ingroup ITKImageIntensity
- *
- * \wiki
- * \wikiexample{ImageProcessing/MaskImageFilter,Apply a mask to an image}
- * \endwiki
*/
template< typename TInputImage, typename TMaskImage, typename TOutputImage = TInputImage >
class MITKIMAGESTATISTICS_EXPORT MaskImageFilter2:
public
BinaryFunctorImageFilter< TInputImage, TMaskImage, TOutputImage,
Functor::MaskInput2<
typename TInputImage::PixelType,
typename TMaskImage::PixelType,
typename TOutputImage::PixelType > >
{
public:
/** Standard class typedefs. */
typedef MaskImageFilter2 Self;
typedef BinaryFunctorImageFilter< TInputImage, TMaskImage, TOutputImage,
Functor::MaskInput2<
typename TInputImage::PixelType,
typename TMaskImage::PixelType,
typename TOutputImage::PixelType >
> Superclass;
typedef SmartPointer< Self > Pointer;
typedef SmartPointer< const Self > ConstPointer;
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** Runtime information support. */
itkTypeMacro(MaskImageFilter2,
BinaryFunctorImageFilter);
/** Typedefs **/
typedef TMaskImage MaskImageType;
/** Set/Get the mask image. Pixels set in the mask image will retain
* the original value of the input image while pixels not set in
* the mask will be set to the "OutsideValue".
*/
void SetMaskImage(const MaskImageType *maskImage)
{
// Process object is not const-correct so the const casting is required.
this->SetNthInput( 1, const_cast< MaskImageType * >( maskImage ) );
}
const MaskImageType * GetMaskImage()
{
return static_cast<const MaskImageType*>(this->ProcessObject::GetInput(1));
}
/** Method to explicitly set the outside value of the mask. Defaults to 0 */
void SetOutsideValue(const typename TOutputImage::PixelType & outsideValue)
{
if ( this->GetOutsideValue() != outsideValue )
{
this->Modified();
this->GetFunctor().SetOutsideValue(outsideValue);
}
}
const typename TOutputImage::PixelType & GetOutsideValue() const
{
return this->GetFunctor().GetOutsideValue();
}
/** Method to explicitly set the masking value of the mask. Defaults to 0 */
void SetMaskingValue(const typename TMaskImage::PixelType & maskingValue)
{
if ( this->GetMaskingValue() != maskingValue )
{
this->Modified();
this->GetFunctor().SetMaskingValue(maskingValue);
}
}
/** Method to get the masking value of the mask. */
const typename TMaskImage::PixelType & GetMaskingValue() const
{
return this->GetFunctor().GetMaskingValue();
}
void BeforeThreadedGenerateData() override
{
typedef typename TOutputImage::PixelType PixelType;
this->CheckOutsideValue( static_cast<PixelType*>(nullptr) );
}
#ifdef ITK_USE_CONCEPT_CHECKING
// Begin concept checking
itkConceptMacro( MaskEqualityComparableCheck,
( Concept::EqualityComparable< typename TMaskImage::PixelType > ) );
itkConceptMacro( InputConvertibleToOutputCheck,
( Concept::Convertible< typename TInputImage::PixelType,
typename TOutputImage::PixelType > ) );
// End concept checking
#endif
protected:
MaskImageFilter2() {}
~MaskImageFilter2() override {}
void PrintSelf(std::ostream & os, Indent indent) const override
{
Superclass::PrintSelf(os, indent);
os << indent << "OutsideValue: " << this->GetOutsideValue() << std::endl;
}
private:
MaskImageFilter2(const Self &); //purposely not implemented
void operator=(const Self &); //purposely not implemented
template < typename TPixelType >
void CheckOutsideValue( const TPixelType * ) {}
template < typename TValue >
void CheckOutsideValue( const VariableLengthVector< TValue > * )
{
// Check to see if the outside value contains only zeros. If so,
// resize it to have the same number of zeros as the output
// image. Otherwise, check that the number of components in the
// outside value is the same as the number of components in the
// output image. If not, throw an exception.
VariableLengthVector< TValue > currentValue =
this->GetFunctor().GetOutsideValue();
VariableLengthVector< TValue > zeroVector( currentValue.GetSize() );
zeroVector.Fill( NumericTraits< TValue >::ZeroValue() );
if ( currentValue == zeroVector )
{
zeroVector.SetSize( this->GetOutput()->GetVectorLength() );
zeroVector.Fill( NumericTraits< TValue >::ZeroValue() );
this->GetFunctor().SetOutsideValue( zeroVector );
}
else if ( this->GetFunctor().GetOutsideValue().GetSize() !=
this->GetOutput()->GetVectorLength() )
{
itkExceptionMacro(
<< "Number of components in OutsideValue: "
<< this->GetFunctor().GetOutsideValue().GetSize()
<< " is not the same as the "
<< "number of components in the image: "
<< this->GetOutput()->GetVectorLength());
}
}
};
} // end namespace itk
#endif
diff --git a/Modules/ImageStatisticsUI/Qmitk/QmitkDataGenerationJobBase.h b/Modules/ImageStatisticsUI/Qmitk/QmitkDataGenerationJobBase.h
index a9f1f61401..6f3f248b4b 100644
--- a/Modules/ImageStatisticsUI/Qmitk/QmitkDataGenerationJobBase.h
+++ b/Modules/ImageStatisticsUI/Qmitk/QmitkDataGenerationJobBase.h
@@ -1,74 +1,74 @@
/*============================================================================
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 QmitkDataGenerationJobBase_h
#define QmitkDataGenerationJobBase_h
//QT
#include <QRunnable>
#include <QObject>
#include <QMetaType>
//MITK
#include <mitkBaseData.h>
#include <MitkImageStatisticsUIExports.h>
/*!
\brief QmitkDataGenerationJobBase
Base class for generation jobs used by QmitkDataGenerationBase and derived classes.
*/
class MITKIMAGESTATISTICSUI_EXPORT QmitkDataGenerationJobBase : public QObject, public QRunnable
{
Q_OBJECT
public:
/** Result map that indicates all results generated by the job.
The key is a job specific label for the results.*/
using ResultMapType = std::map<std::string, mitk::BaseData::Pointer>;
virtual ResultMapType GetResults() const = 0;
/** Calls RunComputation() and takes care of the error handling and result signalling.*/
void run() final;
/*!
/brief Returns a flag the indicates if the job computation was successfull.*/
bool GetComputationSuccessFlag() const;
std::string GetLastErrorMessage() const;
signals:
void Error(QString err, const QmitkDataGenerationJobBase* job);
/*! @brief Signal is emitted when results are available.
@param results produced by the job and ready to be used.
- @param the job that produced the data
+ @param job the job that produced the data
*/
void ResultsAvailable(ResultMapType results, const QmitkDataGenerationJobBase* job);
protected:
QmitkDataGenerationJobBase() = default;
virtual ~QmitkDataGenerationJobBase() = default;
/**Does the real computation. Returns true if there where results produced.*/
virtual bool RunComputation() = 0;
std::string m_LastErrorMessage;
private:
bool m_ComputationSuccessful = false;
};
#endif
diff --git a/Modules/ImageStatisticsUI/Qmitk/QmitkDataGeneratorBase.h b/Modules/ImageStatisticsUI/Qmitk/QmitkDataGeneratorBase.h
index f3988f0060..e43e33cbc0 100644
--- a/Modules/ImageStatisticsUI/Qmitk/QmitkDataGeneratorBase.h
+++ b/Modules/ImageStatisticsUI/Qmitk/QmitkDataGeneratorBase.h
@@ -1,174 +1,175 @@
/*============================================================================
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 QmitkDataGeneratorBase_h
#define QmitkDataGeneratorBase_h
#include <mutex>
//QT
#include <QObject>
//MITK
#include <mitkDataStorage.h>
#include "QmitkDataGenerationJobBase.h"
#include <MitkImageStatisticsUIExports.h>
/*!
\brief QmitkDataGeneratorBase
BaseClass that implements the organisation of (statistic) data generation for pairs of images and ROIs.
The key idea is that this class ensures that for vector of given image ROI pairs (defined by derived classes)
a result instance (e.g ImageStatisticsContainer) will be calculated, if needed (e.g. because it is missing or
not uptodate anymore), and stored in the data storage passed to a generator instance. While derived classes i.a.
specify how to generate the image ROI pairs, how to detect latest results, what the next generation step is and
how to remove obsolete data from the storage, the base class takes care of the observation of the data storage
and orchestrates the whole checking and generation workflow.
In all the generation/orchestration process the data storage, passed to the generator, 1) serves as place where the final
results are stored and searched and 2) it resembles the state of the genertion process with these final results and WIP
place holder nodes that indicate planed or currently processed generation steps.
*/
class MITKIMAGESTATISTICSUI_EXPORT QmitkDataGeneratorBase : public QObject
{
Q_OBJECT
public:
QmitkDataGeneratorBase(const QmitkDataGeneratorBase& other) = delete;
QmitkDataGeneratorBase& operator=(const QmitkDataGeneratorBase& other) = delete;
virtual ~QmitkDataGeneratorBase();
using JobResultMapType = QmitkDataGenerationJobBase::ResultMapType;
mitk::DataStorage::Pointer GetDataStorage() const;
/** Indicates if the generator may trigger the update automatically (true). Reasons for an update are:
- Input data has been changed or modified
- Generation relevant settings in derived classes have been changed (must be implemented in derived classes)
*/
bool GetAutoUpdate() const;
/** Indicates if there is currently work in progress, thus data generation jobs are running or pending.
It is set to true when GenerationStarted is triggered and becomes false as soon as GenerationFinished is triggered.
*/
bool IsGenerating() const;
/** Checks data validity and triggers generation of data, if needed.
The generation itselfs will be done with a thread pool and is orchestrated by this class. To learn if the threads are finished and
everything is uptodate, listen to the signal GenerationFinished.
@return indicates if everything is already valid (true) or if the generation of new data was triggerd (false).*/
bool Generate() const;
/** Indicates if for a given image and ROI a valid final result is available.*/
virtual bool IsValidResultAvailable(const mitk::DataNode* imageNode, const mitk::DataNode* roiNode) const = 0;
public slots:
/** Sets the data storage the generator should monitor and where WIP placeholder nodes and final result nodes should be stored.*/
void SetDataStorage(mitk::DataStorage* storage);
void SetAutoUpdate(bool autoUpdate);
protected slots:
/** Used by QmitkDataGenerationJobBase to signal the generator that an error occured. */
void OnJobError(QString error, const QmitkDataGenerationJobBase* failedJob) const;
/** Used by QmitkDataGenerationJobBase to signal and communicate the results of there computation. */
void OnFinalResultsAvailable(JobResultMapType results, const QmitkDataGenerationJobBase *job) const;
signals:
/*! @brief Signal that is emitted if a data generation job is started to generat outdated/inexistant data.
*/
void DataGenerationStarted(const mitk::DataNode* imageNode, const mitk::DataNode* roiNode, const QmitkDataGenerationJobBase* job) const;
/*! @brief Signal that is emitted if new final data is produced.
*/
void NewDataAvailable(mitk::DataStorage::SetOfObjects::ConstPointer data) const;
/*! @brief Signal that is emitted if all jobs are finished and everything is up to date.
*/
void GenerationFinished() const;
/*! @brief Signal that is emitted in case of job errors.
*/
void JobError(QString error, const QmitkDataGenerationJobBase* failedJob) const;
protected:
/*! @brief Constructor
@param storage the data storage where all produced data should be stored
+ @param parent
*/
QmitkDataGeneratorBase(mitk::DataStorage::Pointer storage, QObject* parent = nullptr);
QmitkDataGeneratorBase(QObject* parent = nullptr);
using InputPairVectorType = std::vector<std::pair<mitk::DataNode::ConstPointer, mitk::DataNode::ConstPointer>>;
/** This method must be implemented by derived to indicate if a changed node is relevant and therefore if an update must be triggered.*/
virtual bool ChangedNodeIsRelevant(const mitk::DataNode* changedNode) const = 0;
/** This method must be impemented by derived classes to return the pairs of images and ROIs
(ROI may be null if no ROI is needed) for which data are needed.*/
virtual InputPairVectorType GetAllImageROICombinations() const = 0;
/** This method should indicate all missing and outdated (interim) results in the data storage, with new placeholder nodes and WIP dummy data
added to the storage. The placeholder nodes will be replaced by the real results as soon as they are ready.
The strategy how to detact which placeholder node is need and how the dummy data should look like must be implemented by derived classes.*/
virtual void IndicateFutureResults(const mitk::DataNode* imageNode, const mitk::DataNode* roiNode) const = 0;
/*! @brief Is called to generate the next job instance that needs to be done and is associated dummy node
in order to progress the data generation workflow.
@remark The method can assume that the caller takes care of the job instance deletion.
@return std::pair of job pointer and placeholder node associated with the job. Following combinations are possible:
- Both are null: nothing to do;
- Both are set: there is something to do for a pending dumme node -> trigger computation;
- Job null and node set: a job for this node is already work in progress -> pass on till its finished.*/
virtual std::pair<QmitkDataGenerationJobBase*,mitk::DataNode::Pointer> GetNextMissingGenerationJob(const mitk::DataNode* imageNode, const mitk::DataNode* roiNode) const =0;
/** Remove all obsolete data nodes for the given image and ROI node from the data storage.
Obsolete nodes are (interim) result nodes that are not the most recent any more.*/
virtual void RemoveObsoleteDataNodes(const mitk::DataNode* imageNode, const mitk::DataNode* roiNode) const = 0;
/** Prepares result to be added to the storage in an appropriate way and returns the data node for that.*/
virtual mitk::DataNode::Pointer PrepareResultForStorage(const std::string& label, mitk::BaseData* result, const QmitkDataGenerationJobBase* job) const = 0;
/*! Creates a data node for WIP place holder results. It can be used by IndicateFutureResults().*/
static mitk::DataNode::Pointer CreateWIPDataNode(mitk::BaseData* dataDummy, const std::string& nodeName);
/** Filters a passed pair vector. The returned pair vector only contains pair of nodes that exist in the data storage.*/
InputPairVectorType FilterImageROICombinations(InputPairVectorType&& imageROICombinations) const;
/** Return a descriptive label of a passed pair. Used e.g. for some debug log messages.*/
std::string GetPairDescription(const InputPairVectorType::value_type& imageAndSeg) const;
/** Internal part of the generation strategy. Here is where the heavy lifting is done.*/
bool DoGenerate() const;
/** Methods either directly calls generation or if its allready onging flags to restart the generation.*/
void EnsureRecheckingAndGeneration() const;
mitk::WeakPointer<mitk::DataStorage> m_Storage;
bool m_AutoUpdate = false;
mutable std::mutex m_DataMutex;
private:
/** Indicates if we are currently in the Generation() verification and generation of pending jobs triggering loop.
Only needed for the internal logic.*/
mutable bool m_InGenerate = false;
/** Internal flag that is set if a generation was requested, while one generation loop was already ongoing.*/
mutable bool m_RestartGeneration = false;
/** Indicates if there are still jobs pending or computing (true) or if everything is valid (false).*/
mutable bool m_WIP = false;
/** Internal flag that indicates that generator is currently in the process of adding results to the storage*/
mutable bool m_AddingToStorage = false;
/**Member is called when a node is added to the storage.*/
void NodeAddedOrModified(const mitk::DataNode* node);
unsigned long m_DataStorageDeletedTag;
};
#endif
diff --git a/Modules/ImageStatisticsUI/Qmitk/QmitkImageStatisticsDataGenerator.h b/Modules/ImageStatisticsUI/Qmitk/QmitkImageStatisticsDataGenerator.h
index 4d3766e246..2dc85d2f98 100644
--- a/Modules/ImageStatisticsUI/Qmitk/QmitkImageStatisticsDataGenerator.h
+++ b/Modules/ImageStatisticsUI/Qmitk/QmitkImageStatisticsDataGenerator.h
@@ -1,67 +1,69 @@
/*============================================================================
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 QmitkImageStatisticsDataGenerator_h
#define QmitkImageStatisticsDataGenerator_h
#include "QmitkImageAndRoiDataGeneratorBase.h"
#include <MitkImageStatisticsUIExports.h>
/**
Generates ImageStatisticContainers by using QmitkImageStatisticsCalculationRunnables for each pair if image and ROIs and ensures their
validity.
It also encodes the HistogramNBins and IgnoreZeroValueVoxel as properties to the results as these settings are important criteria for
discreminating statistics results.
For more details of how the generation is done see QmitkDataGenerationBase.
*/
class MITKIMAGESTATISTICSUI_EXPORT QmitkImageStatisticsDataGenerator : public QmitkImageAndRoiDataGeneratorBase
{
public:
QmitkImageStatisticsDataGenerator(mitk::DataStorage::Pointer storage, QObject* parent = nullptr) : QmitkImageAndRoiDataGeneratorBase(storage, parent) {};
QmitkImageStatisticsDataGenerator(QObject* parent = nullptr) : QmitkImageAndRoiDataGeneratorBase(parent) {};
bool IsValidResultAvailable(const mitk::DataNode* imageNode, const mitk::DataNode* roiNode) const;
/** Returns the latest result for a given image and ROI and the current settings of the generator.
+ @param imageNode
+ @param roiNode
@param onlyIfUpToDate Indicates if results should only be returned if the are up to date, thus not older then image and ROI.
@param noWIP If noWIP is true, the function only returns valid final result and not just its placeholder (WIP).
If noWIP equals false it might also return a WIP, thus the valid result is currently processed/ordered but might not be ready yet.*/
mitk::DataNode::Pointer GetLatestResult(const mitk::DataNode* imageNode, const mitk::DataNode* roiNode, bool onlyIfUpToDate = false, bool noWIP = true) const;
std::string GenerateStatisticsNodeName(const mitk::Image* image, const mitk::BaseData* roi) const;
/*! /brief Set flag to ignore zero valued voxels */
void SetIgnoreZeroValueVoxel(bool _arg);
/*! /brief Get status of zero value voxel ignoring. */
bool GetIgnoreZeroValueVoxel() const;
/*! /brief Set bin size for histogram resolution.*/
void SetHistogramNBins(unsigned int nbins);
/*! /brief Get bin size for histogram resolution.*/
unsigned int GetHistogramNBins() const;
protected:
bool ChangedNodeIsRelevant(const mitk::DataNode* changedNode) const;
void IndicateFutureResults(const mitk::DataNode* imageNode, const mitk::DataNode* roiNode) const;
std::pair<QmitkDataGenerationJobBase*, mitk::DataNode::Pointer> GetNextMissingGenerationJob(const mitk::DataNode* imageNode, const mitk::DataNode* roiNode) const;
void RemoveObsoleteDataNodes(const mitk::DataNode* imageNode, const mitk::DataNode* roiNode) const;
mitk::DataNode::Pointer PrepareResultForStorage(const std::string& label, mitk::BaseData* result, const QmitkDataGenerationJobBase* job) const;
QmitkImageStatisticsDataGenerator(const QmitkImageStatisticsDataGenerator&) = delete;
QmitkImageStatisticsDataGenerator& operator = (const QmitkImageStatisticsDataGenerator&) = delete;
bool m_IgnoreZeroValueVoxel = false;
unsigned int m_HistogramNBins = 100;
};
#endif
diff --git a/Modules/LegacyIO/mitkImageWriter.h b/Modules/LegacyIO/mitkImageWriter.h
index e9f67d016d..67033cd7c9 100644
--- a/Modules/LegacyIO/mitkImageWriter.h
+++ b/Modules/LegacyIO/mitkImageWriter.h
@@ -1,171 +1,171 @@
/*============================================================================
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 _MITK_IMAGE_WRITER__H_
#define _MITK_IMAGE_WRITER__H_
#include <MitkLegacyIOExports.h>
#include <mitkFileWriterWithInformation.h>
namespace mitk
{
class Image;
/**
* @brief Writer for mitk::Image
*
* Uses the given extension (SetExtension) to decide the format to write
* (.mhd is default, .pic, .tif, .png, .jpg supported yet).
* @ingroup MitkLegacyIOModule
* @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileWriterRegistry instead.
*/
class MITKLEGACYIO_EXPORT ImageWriter : public mitk::FileWriterWithInformation
{
public:
mitkClassMacro(ImageWriter, mitk::FileWriter);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
mitkWriterMacro;
/**
* Sets the filename of the file to write.
- * @param _arg the name of the file to write.
+ * @param fileName the name of the file to write.
*/
void SetFileName(const char *fileName) override;
virtual void SetFileName(const std::string &fileName);
/**
* @returns the name of the file to be written to disk.
*/
itkGetStringMacro(FileName);
/**
* \brief Explicitly set the extension to be added to the filename.
- * @param _arg to be added to the filename, including a "."
+ * @param extension Extension to be added to the filename, including a "."
* (e.g., ".mhd").
*/
virtual void SetExtension(const char *extension);
virtual void SetExtension(const std::string &extension);
/**
* \brief Get the extension to be added to the filename.
* @returns the extension to be added to the filename (e.g.,
* ".mhd").
*/
itkGetStringMacro(Extension);
/**
* \brief Set the extension to be added to the filename to the default
*/
void SetDefaultExtension();
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro(FilePrefix);
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro(FilePrefix);
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro(FilePattern);
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro(FilePattern);
/**
* Sets the 0'th input object for the filter.
* @param input the first input for the filter.
*/
void SetInput(mitk::Image *input);
//##Documentation
//## @brief Return the possible file extensions for the data type associated with the writer
std::vector<std::string> GetPossibleFileExtensions() override;
std::string GetSupportedBaseData() const override;
/**
* @brief Return the extension to be added to the filename.
*/
std::string GetFileExtension() override;
/**
* @brief Check if the Writer can write the Content of the
*/
bool CanWriteDataType(DataNode *) override;
/**
* @brief Return the MimeType of the saved File.
*/
std::string GetWritenMIMEType() override;
using Superclass::SetInput;
/**
* @brief Set the DataTreenode as Input. Important: The Writer always have a SetInput-Function.
*/
virtual void SetInput(DataNode *);
/**
* @returns the 0'th input object of the filter.
*/
const mitk::Image *GetInput();
// FileWriterWithInformation methods
const char *GetDefaultFilename() override;
const char *GetFileDialogPattern() override;
const char *GetDefaultExtension() override;
bool CanWriteBaseDataType(BaseData::Pointer data) override;
void DoWrite(BaseData::Pointer data) override;
void SetUseCompression(bool useCompression);
protected:
/**
* Constructor.
*/
ImageWriter();
/**
* Virtual destructor.
*/
~ImageWriter() override;
void GenerateData() override;
virtual void WriteByITK(mitk::Image *image, const std::string &fileName);
std::string m_FileName;
std::string m_FileNameWithoutExtension;
std::string m_FilePrefix;
std::string m_FilePattern;
std::string m_Extension;
std::string m_MimeType;
bool m_UseCompression;
};
}
#endif //_MITK_IMAGE_WRITER__H_
diff --git a/Modules/LegacyIO/mitkItkPictureWrite.h b/Modules/LegacyIO/mitkItkPictureWrite.h
index 4de49ba9ff..d051855aa6 100644
--- a/Modules/LegacyIO/mitkItkPictureWrite.h
+++ b/Modules/LegacyIO/mitkItkPictureWrite.h
@@ -1,42 +1,44 @@
/*============================================================================
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.
============================================================================*/
/** @file mitkItkPictureWrite.h */
#ifndef MITKITKPICTUREWRITE_H
#define MITKITKPICTUREWRITE_H
#include <itkImage.h>
#include <mitkCommon.h>
/**
* @brief ITK-Like method to be called for writing an single-component image using the AccessByItk Macros
*
* @param itkImage an image with single-component pixel type
+ * @param fileName the filename
*
* @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
*/
template <typename TPixel, unsigned int VImageDimension>
DEPRECATED(void _mitkItkPictureWrite(itk::Image<TPixel, VImageDimension> *itkImage, const std::string &fileName));
/**
* @brief ITK-Like method to be called for writing an image
*
* @param itkImage an Image with single-component or composite pixel type
+ * @param fileName the filename
*
* @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
*/
template <typename TPixel, unsigned int VImageDimension>
DEPRECATED(void _mitkItkPictureWriteComposite(itk::Image<TPixel, VImageDimension> *itkImage,
const std::string &fileName));
#endif /* MITKITKPICTUREWRITE_H */
diff --git a/Modules/LegacyIO/mitkPointSetWriter.h b/Modules/LegacyIO/mitkPointSetWriter.h
index 0789e8c685..f848cbd98c 100644
--- a/Modules/LegacyIO/mitkPointSetWriter.h
+++ b/Modules/LegacyIO/mitkPointSetWriter.h
@@ -1,254 +1,254 @@
/*============================================================================
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 _MITK_POINT_SET_WRITER__H_
#define _MITK_POINT_SET_WRITER__H_
#include <MitkLegacyIOExports.h>
#include <itkProcessObject.h>
#include <mitkFileWriter.h>
#include <mitkPointSet.h>
namespace mitk
{
/**
* @brief XML-based writer for mitk::PointSets
*
* XML-based writer for mitk::PointSets. Multiple PointSets can be written in
* a single XML file by simply setting multiple inputs to the filter.
* Writing of multiple XML files according to a given filename pattern is not
* yet supported.
*
* @ingroup MitkLegacyIOModule
*
* @deprecatedSince{2014_10} Use mitk::IOUtils or mitk::FileReaderRegistry instead.
*/
class MITKLEGACYIO_EXPORT PointSetWriter : public mitk::FileWriter
{
public:
mitkClassMacro(PointSetWriter, mitk::FileWriter);
mitkWriterMacro;
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
typedef mitk::PointSet InputType;
typedef InputType::Pointer InputTypePointer;
/**
* Sets the filename of the file to write.
- * @param FileName the name of the file to write.
*/
itkSetStringMacro(FileName);
/**
* @returns the name of the file to be written to disk.
*/
itkGetStringMacro(FileName);
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro(FilePrefix);
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro(FilePrefix);
/**
* @warning multiple write not (yet) supported
*/
itkSetStringMacro(FilePattern);
/**
* @warning multiple write not (yet) supported
*/
itkGetStringMacro(FilePattern);
/**
* Sets the 0'th input object for the filter.
* @param input the first input for the filter.
*/
void SetInput(InputType *input);
/**
* Sets the n'th input object for the filter. If num is
* larger than GetNumberOfInputs() the number of inputs is
* resized appropriately.
+ * @param num
* @param input the n'th input for the filter.
*/
void SetInput(const unsigned int &num, InputType *input);
/**
* @returns the 0'th input object of the filter.
*/
PointSet *GetInput();
/**
* @param num the index of the desired output object.
* @returns the n'th input object of the filter.
*/
PointSet *GetInput(const unsigned int &num);
/**
* @brief Return the possible file extensions for the data type associated with the writer
*/
std::vector<std::string> GetPossibleFileExtensions() override;
std::string GetSupportedBaseData() const override;
/**
* @brief Return the extension to be added to the filename.
*/
std::string GetFileExtension() override;
/**
* @brief Check if the Writer can write the Content of the
*/
bool CanWriteDataType(DataNode *) override;
/**
* @brief Return the MimeType of the saved File.
*/
std::string GetWritenMIMEType() override;
using mitk::FileWriter::SetInput;
/**
* @brief Set the DataTreenode as Input. Important: The Writer always have a SetInput-Function.
*/
virtual void SetInput(DataNode *);
/**
* @returns whether the last write attempt was successful or not.
*/
bool GetSuccess() const;
protected:
/**
* Constructor.
*/
PointSetWriter();
/**
* Virtual destructor.
*/
~PointSetWriter() override;
/**
* Writes the XML file
*/
void GenerateData() override;
/**
* Resizes the number of inputs of the writer.
* The inputs are initialized by empty PointSets
* @param num the new number of inputs
*/
virtual void ResizeInputs(const unsigned int &num);
/**
* Converts an arbitrary type to a string. The type has to
* support the << operator. This works fine at least for integral
* data types as float, int, long etc.
* @param value the value to convert
* @returns the string representation of value
*/
template <typename T>
std::string ConvertToString(T value);
/**
* Writes an XML representation of the given point set to
* an outstream. The XML-Header an root node is not included!
* @param pointSet the point set to be converted to xml
* @param out the stream to write to.
*/
void WriteXML(mitk::PointSet *pointSet, std::ofstream &out);
/**
* Writes an standard xml header to the given stream.
* @param file the stream in which the header is written.
*/
void WriteXMLHeader(std::ofstream &file);
/** Write a start element tag */
void WriteStartElement(const char *const tag, std::ofstream &file);
/**
* Write an end element tag
* End-Elements following character data should pass indent = false.
*/
void WriteEndElement(const char *const tag, std::ofstream &file, const bool &indent = true);
/** Write character data inside a tag. */
void WriteCharacterData(const char *const data, std::ofstream &file);
/** Write a start element tag */
void WriteStartElement(std::string &tag, std::ofstream &file);
/** Write an end element tag */
void WriteEndElement(std::string &tag, std::ofstream &file, const bool &indent = true);
/** Write character data inside a tag. */
void WriteCharacterData(std::string &data, std::ofstream &file);
/** Writes empty spaces to the stream according to m_IndentDepth and m_Indent */
void WriteIndent(std::ofstream &file);
std::string m_FileName;
std::string m_FilePrefix;
std::string m_FilePattern;
std::string m_Extension;
std::string m_MimeType;
unsigned int m_IndentDepth;
unsigned int m_Indent;
bool m_Success;
public:
static const char *XML_POINT_SET;
static const char *XML_TIME_SERIES;
static const char *XML_TIME_SERIES_ID;
static const char *XML_POINT_SET_FILE;
static const char *XML_FILE_VERSION;
static const char *XML_POINT;
static const char *XML_SPEC;
static const char *XML_ID;
static const char *XML_X;
static const char *XML_Y;
static const char *XML_Z;
static const char *VERSION_STRING;
};
}
#endif
diff --git a/Modules/MapperExt/CMakeLists.txt b/Modules/MapperExt/CMakeLists.txt
index e3b7025b99..ca202f89be 100644
--- a/Modules/MapperExt/CMakeLists.txt
+++ b/Modules/MapperExt/CMakeLists.txt
@@ -1,13 +1,14 @@
mitk_create_module(
DEPENDS MitkDataTypesExt MitkLegacyGL
+ PACKAGE_DEPENDS PRIVATE VTK|CommonComputationalGeometry+CommonSystem+RenderingVolumeOpenGL2
)
if(TARGET ${MODULE_TARGET})
if(MITK_USE_OpenMP)
target_link_libraries(${MODULE_TARGET} PUBLIC OpenMP::OpenMP_CXX)
endif()
if(BUILD_TESTING)
add_subdirectory(test)
endif()
endif()
diff --git a/Modules/MapperExt/doc/Doxygen/Modules.dox b/Modules/MapperExt/doc/Doxygen/Modules.dox
index 0e499ef6ed..c2fe324db0 100644
--- a/Modules/MapperExt/doc/Doxygen/Modules.dox
+++ b/Modules/MapperExt/doc/Doxygen/Modules.dox
@@ -1,10 +1,10 @@
/**
\defgroup MitkMapperExtModule MapperExt
\ingroup MITKModules
\brief MITK mapper classes for data type extensions.
This module provides MITK mapper classes for the data types
- defined in the \ref MitkDataTypesExt module. It is usually
+ defined in the \ref MitkDataTypesExtModule module. It is usually
not used directly.
*/
diff --git a/Modules/MapperExt/files.cmake b/Modules/MapperExt/files.cmake
index 3ec5ef80f6..01778f6a7a 100644
--- a/Modules/MapperExt/files.cmake
+++ b/Modules/MapperExt/files.cmake
@@ -1,20 +1,18 @@
file(GLOB_RECURSE H_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/include/*")
set(CPP_FILES
mitkEnhancedPointSetVtkMapper3D.cpp
mitkGPUVolumeMapper3D.cpp
- mitkMeshMapper2D.cpp
- mitkMeshVtkMapper3D.cpp
mitkSplineVtkMapper3D.cpp
mitkUnstructuredGridMapper2D.cpp
mitkUnstructuredGridVtkMapper3D.cpp
mitkVectorImageMapper2D.cpp
mitkVolumeMapperVtkSmart3D.cpp
vtkMaskedGlyph2D.cpp
vtkMaskedGlyph3D.cpp
vtkMitkGPUVolumeRayCastMapper.cpp
vtkUnstructuredGridMapper.cpp
vtkPointSetSlicer.cxx
)
diff --git a/Modules/MapperExt/include/mitkEnhancedPointSetVtkMapper3D.h b/Modules/MapperExt/include/mitkEnhancedPointSetVtkMapper3D.h
index 20ac8bd42b..dab5d786d0 100644
--- a/Modules/MapperExt/include/mitkEnhancedPointSetVtkMapper3D.h
+++ b/Modules/MapperExt/include/mitkEnhancedPointSetVtkMapper3D.h
@@ -1,119 +1,119 @@
/*============================================================================
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 MITKEnhancedPointSetVtkMapper3D_H_HEADER_INCLUDED_C1907273
#define MITKEnhancedPointSetVtkMapper3D_H_HEADER_INCLUDED_C1907273
#include "MitkMapperExtExports.h"
#include "mitkBaseRenderer.h"
#include "mitkCommon.h"
#include "mitkPointSet.h"
#include "mitkVector.h"
#include "mitkVtkMapper.h"
class vtkActor;
class vtkAssembly;
class vtkSphereSource;
class vtkCubeSource;
class vtkConeSource;
class vtkCylinderSource;
class vtkTubeFilter;
class vtkProp;
namespace mitk
{
/**
* \brief Alternative Vtk-based 3D mapper for mitk::PointSet
*
* This class renders mitk::PointSet objects in 3D views. It resembles the
* standard mitk::PointSetVtkMapper3D, but is designed to enable single
* points to be rendered with individual appearances.
*
* Instead of assembling one vtkPolyData object containing all points,
* a list of VTK source objects (spheres, cubes, cones, ...) is maintained.
* Therefore, the application can change the appearance and/or type of a
* specific point at runtime, without having to rebuild the
*
* You should use this class instead of the standard mapper if you
*
* - change the PointSet very often (by adding or removing points)
* - need different representations for points (+++)
* - want to change the point representation frequently (+++)
*
* Note: the class is still in experimental stage, and the points above
* marked with (+++) are not yet working correctly. Also, drawing lines
* between points (contour mode) is not yet supported. The class will be
* extended so that point representations are stored in a lookup table,
* which is indexed by point data from the rendered PointSet.
*
- * \warn This mapper requires the PointData container to be the same size
+ * \warning This mapper requires the PointData container to be the same size
* as the point container.
*
* \sa PointSetVtkMapper3D
*/
class MITKMAPPEREXT_EXPORT EnhancedPointSetVtkMapper3D : public VtkMapper
{
public:
mitkClassMacro(EnhancedPointSetVtkMapper3D, VtkMapper);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
virtual const mitk::PointSet *GetInput();
vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
void UpdateVtkTransform(mitk::BaseRenderer *renderer) override;
static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer = nullptr, bool overwrite = false);
LocalStorageHandler<BaseLocalStorage> m_LSH;
protected:
EnhancedPointSetVtkMapper3D();
~EnhancedPointSetVtkMapper3D() override;
void RemoveEntryFromSourceMaps(mitk::PointSet::PointIdentifier pointID);
void DeleteVtkObject(vtkObject *o); // functor for stl_each in destructor
// update all vtk sources, mappers, actors with current data and properties
void UpdateVtkObjects();
void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
void ApplyColorAndOpacityProperties(mitk::BaseRenderer *renderer, vtkActor *actor) override;
typedef mitk::PointSet::PointIdentifier PointIdentifier;
typedef std::map<PointIdentifier, vtkSphereSource *> SphereSourceMap;
typedef std::map<PointIdentifier, vtkCubeSource *> CubeSourceMap;
typedef std::map<PointIdentifier, vtkConeSource *> ConeSourceMap;
typedef std::map<PointIdentifier, vtkCylinderSource *> CylinderSourceMap;
typedef std::pair<vtkActor *, mitk::PointSpecificationType> ActorAndPointType;
typedef std::map<PointIdentifier, ActorAndPointType> ActorMap;
SphereSourceMap m_SphereSources; // stores all sphere sources
CubeSourceMap m_CubeSources; // stores all cube sources
ConeSourceMap m_ConeSources; // stores all cone sources
CylinderSourceMap m_CylinderSources; // stores all cylinder sources
ActorMap m_PointActors; // stores an actor for each point(referenced by its ID) and the currently used pointspec =
// which source type is generating the polydata
vtkActor *m_Contour;
vtkTubeFilter *m_ContourSource;
vtkAssembly *m_PropAssembly; // this contains everything, this will be returned by GetVtkProp()
};
} // namespace mitk
#endif /* MITKEnhancedPointSetVtkMapper3D_H_HEADER_INCLUDED_C1907273 */
diff --git a/Modules/MapperExt/include/mitkMeshMapper2D.h b/Modules/MapperExt/include/mitkMeshMapper2D.h
deleted file mode 100644
index 30926d3089..0000000000
--- a/Modules/MapperExt/include/mitkMeshMapper2D.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*============================================================================
-
-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 MITKMESHMAPPER2D_H_HEADER_INCLUDED
-#define MITKMESHMAPPER2D_H_HEADER_INCLUDED
-
-#include "MitkMapperExtExports.h"
-#include "mitkCommon.h"
-#include "mitkGLMapper.h"
-
-namespace mitk
-{
- class BaseRenderer;
- class Mesh;
-
- /**
- * \brief OpenGL-based mapper to display a mesh in a 2D window
- *
- * \todo implement for AbstractTransformGeometry.
- * \ingroup Mapper
- */
- class MITKMAPPEREXT_EXPORT MeshMapper2D : public GLMapper
- {
- public:
- mitkClassMacro(MeshMapper2D, GLMapper);
-
- itkFactorylessNewMacro(Self);
-
- itkCloneMacro(Self);
-
- /** @brief Get the Mesh to map */
- const mitk::Mesh *GetInput(void);
-
- void Paint(mitk::BaseRenderer *renderer) override;
-
- protected:
- MeshMapper2D();
-
- ~MeshMapper2D() override;
- };
-
-} // namespace mitk
-
-#endif /* MITKMESHMapper2D_H_HEADER_INCLUDED */
diff --git a/Modules/MapperExt/include/mitkMeshVtkMapper3D.h b/Modules/MapperExt/include/mitkMeshVtkMapper3D.h
deleted file mode 100644
index 59391e03f4..0000000000
--- a/Modules/MapperExt/include/mitkMeshVtkMapper3D.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/*============================================================================
-
-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 MITKMESHVTKMAPPER3D_H_HEADER_INCLUDED
-#define MITKMESHVTKMAPPER3D_H_HEADER_INCLUDED
-
-#include "MitkMapperExtExports.h"
-#include "mitkBaseRenderer.h"
-#include "mitkCommon.h"
-#include "mitkMesh.h"
-#include "mitkVtkMapper.h"
-
-#include <vtkAppendPolyData.h>
-#include <vtkCellArray.h>
-#include <vtkFloatArray.h>
-#include <vtkLinearTransform.h>
-#include <vtkPointData.h>
-#include <vtkPoints.h>
-#include <vtkPolyData.h>
-#include <vtkSphereSource.h>
-#include <vtkTextSource.h>
-#include <vtkTransformPolyDataFilter.h>
-#include <vtkTubeFilter.h>
-#include <vtkVectorText.h>
-
-class vtkActor;
-class vtkAssembly;
-class vtkFollower;
-class vtkPolyDataMapper;
-class vtkPropAssembly;
-
-namespace mitk
-{
- /**
- * \brief Vtk-based mapper for PointList
- * \ingroup Mapper
- */
- class MITKMAPPEREXT_EXPORT MeshVtkMapper3D : public VtkMapper
- {
- public:
- mitkClassMacro(MeshVtkMapper3D, VtkMapper);
-
- itkFactorylessNewMacro(Self);
-
- itkCloneMacro(Self);
-
- virtual const mitk::Mesh *GetInput();
-
- vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
- void UpdateVtkTransform(mitk::BaseRenderer *renderer) override;
-
- LocalStorageHandler<BaseLocalStorage> m_LSH;
-
- protected:
- MeshVtkMapper3D();
-
- ~MeshVtkMapper3D() override;
-
- void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
-
- void ResetMapper(BaseRenderer *renderer) override;
-
- vtkPropAssembly *m_PropAssembly;
-
- vtkActor *m_SpheresActor;
- vtkActor *m_ContourActor;
- vtkPolyDataMapper *m_ContourMapper;
- vtkPolyDataMapper *m_SpheresMapper;
-
- vtkPolyDataMapper *m_TextVtkPolyDataMapper;
-
- vtkAppendPolyData *m_Spheres;
- vtkPolyData *m_Contour;
- };
-
-} // namespace mitk
-
-#endif /* MITKMESHVTKMAPPER3D_H_HEADER_INCLUDED*/
diff --git a/Modules/MapperExt/include/mitkVolumeMapperVtkSmart3D.h b/Modules/MapperExt/include/mitkVolumeMapperVtkSmart3D.h
index 9745bc07c2..34731725da 100644
--- a/Modules/MapperExt/include/mitkVolumeMapperVtkSmart3D.h
+++ b/Modules/MapperExt/include/mitkVolumeMapperVtkSmart3D.h
@@ -1,81 +1,75 @@
/*============================================================================
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 MITKVTKSMARTVOLUMEMAPPER_H_HEADER_INCLUDED
#define MITKVTKSMARTVOLUMEMAPPER_H_HEADER_INCLUDED
// MITK
#include "MitkMapperExtExports.h"
#include "mitkBaseRenderer.h"
#include "mitkCommon.h"
#include "mitkImage.h"
#include "mitkVtkMapper.h"
// VTK
#include <vtkImageChangeInformation.h>
#include <vtkSmartPointer.h>
#include <vtkVersionMacros.h>
#include <vtkVolumeProperty.h>
#include <vtkSmartVolumeMapper.h>
#include <vtkImageData.h>
#include <vtkImageChangeInformation.h>
-class vtkRenderingOpenGL2ObjectFactory;
-class vtkRenderingVolumeOpenGL2ObjectFactory;
-
namespace mitk
{
//##Documentation
//## @brief Vtk-based mapper for VolumeData
//##
//## @ingroup Mapper
class MITKMAPPEREXT_EXPORT VolumeMapperVtkSmart3D : public VtkMapper
{
public:
mitkClassMacro(VolumeMapperVtkSmart3D, VtkMapper);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
void ApplyProperties(vtkActor *actor, mitk::BaseRenderer *renderer) override;
static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer = nullptr, bool overwrite = false);
protected:
VolumeMapperVtkSmart3D();
~VolumeMapperVtkSmart3D() override;
void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
void createMapper(vtkImageData*);
void createVolume();
void createVolumeProperty();
vtkImageData* GetInputImage();
vtkSmartPointer<vtkVolume> m_Volume;
vtkSmartPointer<vtkImageChangeInformation> m_ImageChangeInformation;
vtkSmartPointer<vtkSmartVolumeMapper> m_SmartVolumeMapper;
vtkSmartPointer<vtkVolumeProperty> m_VolumeProperty;
- vtkSmartPointer<vtkRenderingOpenGL2ObjectFactory> m_RenderingOpenGL2ObjectFactory;
- vtkSmartPointer<vtkRenderingVolumeOpenGL2ObjectFactory> m_RenderingVolumeOpenGL2ObjectFactory;
-
void UpdateTransferFunctions(mitk::BaseRenderer *renderer);
void UpdateRenderMode(mitk::BaseRenderer *renderer);
};
} // namespace mitk
#endif /* MITKVTKSMARTVOLUMEMAPPER_H_HEADER_INCLUDED */
diff --git a/Modules/MapperExt/src/mitkMeshMapper2D.cpp b/Modules/MapperExt/src/mitkMeshMapper2D.cpp
deleted file mode 100644
index c67bb42de6..0000000000
--- a/Modules/MapperExt/src/mitkMeshMapper2D.cpp
+++ /dev/null
@@ -1,472 +0,0 @@
-/*============================================================================
-
-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 "mitkMeshMapper2D.h"
-#include "mitkBaseRenderer.h"
-#include "mitkColorProperty.h"
-#include "mitkGL.h"
-#include "mitkLine.h"
-#include "mitkMesh.h"
-#include "mitkPlaneGeometry.h"
-#include "mitkProperties.h"
-
-#include <vtkLinearTransform.h>
-
-#include <algorithm>
-
-const float selectedColor[] = {1.0f, 0.0f, 0.6f}; // for selected!
-
-mitk::MeshMapper2D::MeshMapper2D()
-{
-}
-
-mitk::MeshMapper2D::~MeshMapper2D()
-{
-}
-
-const mitk::Mesh *mitk::MeshMapper2D::GetInput(void)
-{
- return static_cast<const mitk::Mesh *>(GetDataNode()->GetData());
-}
-
-// Return whether a point is "smaller" than the second
-static bool point3DSmaller(const mitk::Point3D &elem1, const mitk::Point3D &elem2)
-{
- if (elem1[0] != elem2[0])
- return elem1[0] < elem2[0];
- if (elem1[1] != elem2[1])
- return elem1[1] < elem2[1];
- return elem1[2] < elem2[2];
-}
-
-void mitk::MeshMapper2D::Paint(mitk::BaseRenderer *renderer)
-{
- bool visible = true;
-
- GetDataNode()->GetVisibility(visible, renderer, "visible");
-
- if (!visible)
- return;
-
- // @FIXME: Logik fuer update
- bool updateNeccesary = true;
-
- if (updateNeccesary)
- {
- // aus GenerateData
- mitk::Mesh::Pointer input = const_cast<mitk::Mesh *>(this->GetInput());
-
- // Get the TimeGeometry of the input object
- const TimeGeometry *inputTimeGeometry = input->GetTimeGeometry();
- if ((inputTimeGeometry == nullptr) || (inputTimeGeometry->CountTimeSteps() == 0))
- {
- return;
- }
-
- //
- // get the world time
- //
- ScalarType time = renderer->GetTime();
-
- //
- // convert the world time in time steps of the input object
- //
- int timeStep = 0;
- if (time > itk::NumericTraits<mitk::ScalarType>::NonpositiveMin())
- timeStep = inputTimeGeometry->TimePointToTimeStep(time);
- if (inputTimeGeometry->IsValidTimeStep(timeStep) == false)
- {
- return;
- }
-
- mitk::Mesh::MeshType::Pointer itkMesh = input->GetMesh(timeStep);
-
- if (itkMesh.GetPointer() == nullptr)
- {
- return;
- }
-
- const PlaneGeometry *worldplanegeometry = (renderer->GetCurrentWorldPlaneGeometry());
-
- // apply color and opacity read from the PropertyList
- ApplyColorAndOpacityProperties(renderer);
-
- vtkLinearTransform *transform = GetDataNode()->GetVtkTransform();
-
- // List of the Points
- Mesh::DataType::PointsContainerConstIterator it, end;
- it = itkMesh->GetPoints()->Begin();
- end = itkMesh->GetPoints()->End();
-
- // iterator on the additional data of each point
- Mesh::PointDataIterator dataIt; //, dataEnd;
- dataIt = itkMesh->GetPointData()->Begin();
-
- // for switching back to old color after using selected color
- float unselectedColor[4];
- glGetFloatv(GL_CURRENT_COLOR, unselectedColor);
-
- while (it != end)
- {
- mitk::Point3D p, projected_p;
- float vtkp[3];
-
- itk2vtk(it->Value(), vtkp);
- transform->TransformPoint(vtkp, vtkp);
- vtk2itk(vtkp, p);
-
- renderer->GetCurrentWorldPlaneGeometry()->Project(p, projected_p);
- Vector3D diff = p - projected_p;
- if (diff.GetSquaredNorm() < 4.0)
- {
- Point2D pt2d, tmp;
- renderer->WorldToDisplay(p, pt2d);
-
- Vector2D horz, vert;
- horz[0] = 5;
- horz[1] = 0;
- vert[0] = 0;
- vert[1] = 5;
-
- // check if the point is to be marked as selected
- if (dataIt->Value().selected)
- {
- horz[0] = 8;
- vert[1] = 8;
- glColor3f(selectedColor[0], selectedColor[1], selectedColor[2]); // red
-
- switch (dataIt->Value().pointSpec)
- {
- case PTSTART:
- // a quad
- glBegin(GL_LINE_LOOP);
- tmp = pt2d - horz + vert;
- glVertex2dv(&tmp[0]);
- tmp = pt2d + horz + vert;
- glVertex2dv(&tmp[0]);
- tmp = pt2d + horz - vert;
- glVertex2dv(&tmp[0]);
- tmp = pt2d - horz - vert;
- glVertex2dv(&tmp[0]);
- glEnd();
- break;
- case PTUNDEFINED:
- // a diamond around the point
- glBegin(GL_LINE_LOOP);
- tmp = pt2d - horz;
- glVertex2dv(&tmp[0]);
- tmp = pt2d + vert;
- glVertex2dv(&tmp[0]);
- tmp = pt2d + horz;
- glVertex2dv(&tmp[0]);
- tmp = pt2d - vert;
- glVertex2dv(&tmp[0]);
- glEnd();
- break;
- default:
- break;
- } // switch
-
- // the actual point
- glBegin(GL_POINTS);
- tmp = pt2d;
- glVertex2dv(&tmp[0]);
- glEnd();
- }
- else // if not selected
- {
- glColor3f(unselectedColor[0], unselectedColor[1], unselectedColor[2]);
- switch (dataIt->Value().pointSpec)
- {
- case PTSTART:
- // a quad
- glBegin(GL_LINE_LOOP);
- tmp = pt2d - horz + vert;
- glVertex2dv(&tmp[0]);
- tmp = pt2d + horz + vert;
- glVertex2dv(&tmp[0]);
- tmp = pt2d + horz - vert;
- glVertex2dv(&tmp[0]);
- tmp = pt2d - horz - vert;
- glVertex2dv(&tmp[0]);
- glEnd();
- break;
- case PTUNDEFINED:
- // drawing crosses
- glBegin(GL_LINES);
- tmp = pt2d - horz;
- glVertex2dv(&tmp[0]);
- tmp = pt2d + horz;
- glVertex2dv(&tmp[0]);
- tmp = pt2d - vert;
- glVertex2dv(&tmp[0]);
- tmp = pt2d + vert;
- glVertex2dv(&tmp[0]);
- glEnd();
- break;
- default:
- {
- break;
- }
- } // switch
- } // else
- }
- ++it;
- ++dataIt;
- }
-
- // now connect the lines inbetween
- mitk::Mesh::PointType thisPoint;
- thisPoint.Fill(0);
- Point2D *firstOfCell = nullptr;
- Point2D *lastPoint = nullptr;
- unsigned int lastPointId = 0;
- bool lineSelected = false;
-
- Point3D firstOfCell3D;
- Point3D lastPoint3D;
- bool first;
- mitk::Line<mitk::ScalarType> line;
- std::vector<mitk::Point3D> intersectionPoints;
- double t;
-
- // iterate through all cells and then iterate through all indexes of points in that cell
- Mesh::CellIterator cellIt, cellEnd;
- Mesh::CellDataIterator cellDataIt; //, cellDataEnd;
- Mesh::PointIdIterator cellIdIt, cellIdEnd;
-
- cellIt = itkMesh->GetCells()->Begin();
- cellEnd = itkMesh->GetCells()->End();
- cellDataIt = itkMesh->GetCellData()->Begin();
-
- while (cellIt != cellEnd)
- {
- unsigned int numOfPointsInCell = cellIt->Value()->GetNumberOfPoints();
- if (numOfPointsInCell > 1)
- {
- // iterate through all id's in the cell
- cellIdIt = cellIt->Value()->PointIdsBegin();
- cellIdEnd = cellIt->Value()->PointIdsEnd();
-
- firstOfCell3D = input->GetPoint(*cellIdIt, timeStep);
-
- intersectionPoints.clear();
- intersectionPoints.reserve(numOfPointsInCell);
-
- first = true;
-
- while (cellIdIt != cellIdEnd)
- {
- lastPoint3D = thisPoint;
-
- thisPoint = input->GetPoint(*cellIdIt, timeStep);
-
- // search in data (vector<> selectedLines) if the index of the point is set. if so, then the line is selected.
- lineSelected = false;
- Mesh::SelectedLinesType selectedLines = cellDataIt->Value().selectedLines;
-
- // a line between 1(lastPoint) and 2(pt2d) has the Id 1, so look for the Id of lastPoint
- // since we only start, if we have more than one point in the cell, lastPointId is initiated with 0
- auto position = std::find(selectedLines.begin(), selectedLines.end(), lastPointId);
- if (position != selectedLines.end())
- {
- lineSelected = true;
- }
-
- mitk::Point3D p, projected_p;
- float vtkp[3];
- itk2vtk(thisPoint, vtkp);
- transform->TransformPoint(vtkp, vtkp);
- vtk2itk(vtkp, p);
- renderer->GetCurrentWorldPlaneGeometry()->Project(p, projected_p);
- Vector3D diff = p - projected_p;
- if (diff.GetSquaredNorm() < 4.0)
- {
- Point2D pt2d, tmp;
- renderer->WorldToDisplay(p, pt2d);
-
- if (lastPoint == nullptr)
- {
- // set the first point in the cell. This point in needed to close the polygon
- firstOfCell = new Point2D;
- *firstOfCell = pt2d;
- lastPoint = new Point2D;
- *lastPoint = pt2d;
- lastPointId = *cellIdIt;
- }
- else
- {
- if (lineSelected)
- {
- glColor3f(selectedColor[0], selectedColor[1], selectedColor[2]); // red
- // a line from lastPoint to thisPoint
- glBegin(GL_LINES);
- glVertex2dv(&(*lastPoint)[0]);
- glVertex2dv(&pt2d[0]);
- glEnd();
- }
- else // if not selected
- {
- glColor3f(unselectedColor[0], unselectedColor[1], unselectedColor[2]);
- // drawing crosses
- glBegin(GL_LINES);
- glVertex2dv(&(*lastPoint)[0]);
- glVertex2dv(&pt2d[0]);
- glEnd();
- }
- // to draw the line to the next in iteration step
- *lastPoint = pt2d;
- // and to search for the selection state of the line
- lastPointId = *cellIdIt;
- } // if..else
- } // if <4.0
-
- // fill off-plane polygon part 1
- if ((!first) && (worldplanegeometry != nullptr))
- {
- line.SetPoints(lastPoint3D, thisPoint);
- if (worldplanegeometry->IntersectionPointParam(line, t) && ((t >= 0) && (t <= 1)))
- {
- intersectionPoints.push_back(line.GetPoint(t));
- }
- }
- ++cellIdIt;
- first = false;
- } // while cellIdIter
-
- // closed polygon?
- if (cellDataIt->Value().closed)
- {
- // close the polygon if needed
- if (firstOfCell != nullptr)
- {
- lineSelected = false;
- Mesh::SelectedLinesType selectedLines = cellDataIt->Value().selectedLines;
- auto position = std::find(selectedLines.begin(), selectedLines.end(), lastPointId);
- if (position != selectedLines.end()) // found the index
- {
- glColor3f(selectedColor[0], selectedColor[1], selectedColor[2]); // red
- // a line from lastPoint to firstPoint
- glBegin(GL_LINES);
- glVertex2dv(&(*lastPoint)[0]);
- glVertex2dv(&(*firstOfCell)[0]);
- glEnd();
- }
- else
- {
- glColor3f(unselectedColor[0], unselectedColor[1], unselectedColor[2]);
- glBegin(GL_LINES);
- glVertex2dv(&(*lastPoint)[0]);
- glVertex2dv(&(*firstOfCell)[0]);
- glEnd();
- }
- }
- } // if closed
-
- // Axis-aligned bounding box(AABB) around the cell if selected and set in Property
- bool showBoundingBox;
- if (dynamic_cast<mitk::BoolProperty *>(this->GetDataNode()->GetProperty("showBoundingBox")) == nullptr)
- showBoundingBox = false;
- else
- showBoundingBox =
- dynamic_cast<mitk::BoolProperty *>(this->GetDataNode()->GetProperty("showBoundingBox"))->GetValue();
-
- if (showBoundingBox)
- {
- if (cellDataIt->Value().selected)
- {
- mitk::Mesh::DataType::BoundingBoxPointer aABB = input->GetBoundingBoxFromCell(cellIt->Index());
- if (aABB.IsNotNull())
- {
- mitk::Mesh::PointType min, max;
- min = aABB->GetMinimum();
- max = aABB->GetMaximum();
-
- // project to the displayed geometry
- Point2D min2D, max2D;
- Point3D p, projected_p;
- float vtkp[3];
- itk2vtk(min, vtkp);
- transform->TransformPoint(vtkp, vtkp);
- vtk2itk(vtkp, p);
- renderer->WorldToDisplay(p, min2D);
-
- itk2vtk(max, vtkp);
- transform->TransformPoint(vtkp, vtkp);
- vtk2itk(vtkp, p);
- renderer->GetCurrentWorldPlaneGeometry()->Project(p, projected_p);
- Vector3D diff = p - projected_p;
- if (diff.GetSquaredNorm() < 4.0)
- {
- renderer->WorldToDisplay(p, max2D);
-
- // draw the BoundingBox
- glColor3f(selectedColor[0], selectedColor[1], selectedColor[2]); // red
- // a line from lastPoint to firstPoint
- glBegin(GL_LINE_LOOP);
- glVertex2f(min2D[0], min2D[1]);
- glVertex2f(min2D[0], max2D[1]);
- glVertex2f(max2D[0], max2D[1]);
- glVertex2f(max2D[0], min2D[1]);
- glEnd();
- } // draw bounding-box
- } // bounding-box exists
- } // cell selected
- } // show bounding-box
-
- // fill off-plane polygon part 2
- if (worldplanegeometry != nullptr)
- {
- // consider line from last to first
- line.SetPoints(thisPoint, firstOfCell3D);
- if (worldplanegeometry->IntersectionPointParam(line, t) && ((t >= 0) && (t <= 1)))
- {
- intersectionPoints.push_back(line.GetPoint(t));
- }
- std::sort(intersectionPoints.begin(), intersectionPoints.end(), point3DSmaller);
- std::vector<mitk::Point3D>::iterator it, end;
- end = intersectionPoints.end();
- if ((intersectionPoints.size() % 2) != 0)
- {
- --end; // ensure even number of intersection-points
- }
- Point2D pt2d;
- for (it = intersectionPoints.begin(); it != end; ++it)
- {
- glBegin(GL_LINES);
- renderer->WorldToDisplay(*it, pt2d);
- glVertex2dv(pt2d.GetDataPointer());
- ++it;
- renderer->WorldToDisplay(*it, pt2d);
- glVertex2dv(pt2d.GetDataPointer());
- glEnd();
- }
- if (it != intersectionPoints.end())
- {
- glBegin(GL_LINES);
- renderer->WorldToDisplay(*it, pt2d);
- glVertex2dv(pt2d.GetDataPointer());
- glVertex2dv(pt2d.GetDataPointer());
- glEnd();
- }
- } // fill off-plane polygon part 2
- } // if numOfPointsInCell>1
- delete firstOfCell;
- delete lastPoint;
- lastPoint = nullptr;
- firstOfCell = nullptr;
- lastPointId = 0;
- ++cellIt;
- ++cellDataIt;
- }
- }
-}
diff --git a/Modules/MapperExt/src/mitkMeshVtkMapper3D.cpp b/Modules/MapperExt/src/mitkMeshVtkMapper3D.cpp
deleted file mode 100644
index 1fca78d220..0000000000
--- a/Modules/MapperExt/src/mitkMeshVtkMapper3D.cpp
+++ /dev/null
@@ -1,226 +0,0 @@
-/*============================================================================
-
-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 "mitkMeshVtkMapper3D.h"
-#include "mitkDataNode.h"
-#include "mitkProperties.h"
-#include "mitkVtkPropRenderer.h"
-
-#ifndef VCL_VC60
-#include "mitkMeshUtil.h"
-#endif
-
-#include <vtkActor.h>
-#include <vtkAssembly.h>
-#include <vtkFollower.h>
-#include <vtkProp3DCollection.h>
-#include <vtkPropAssembly.h>
-#include <vtkRenderer.h>
-
-#include <cstdlib>
-#include <vtkPolyDataMapper.h>
-#include <vtkProperty.h>
-
-const mitk::Mesh *mitk::MeshVtkMapper3D::GetInput()
-{
- return static_cast<const mitk::Mesh *>(GetDataNode()->GetData());
-}
-
-vtkProp *mitk::MeshVtkMapper3D::GetVtkProp(mitk::BaseRenderer * /*renderer*/)
-{
- return m_PropAssembly;
-}
-
-void mitk::MeshVtkMapper3D::UpdateVtkTransform(mitk::BaseRenderer * /*renderer*/)
-{
- vtkLinearTransform *vtktransform = this->GetDataNode()->GetVtkTransform(this->GetTimestep());
-
- m_SpheresActor->SetUserTransform(vtktransform);
- m_ContourActor->SetUserTransform(vtktransform);
-}
-
-mitk::MeshVtkMapper3D::MeshVtkMapper3D() : m_PropAssembly(nullptr)
-{
- m_Spheres = vtkAppendPolyData::New();
- m_Contour = vtkPolyData::New();
-
- m_SpheresActor = vtkActor::New();
- m_SpheresMapper = vtkPolyDataMapper::New();
- m_SpheresActor->SetMapper(m_SpheresMapper);
-
- m_ContourActor = vtkActor::New();
- m_ContourMapper = vtkPolyDataMapper::New();
- m_ContourActor->SetMapper(m_ContourMapper);
- m_ContourActor->GetProperty()->SetAmbient(1.0);
-
- m_PropAssembly = vtkPropAssembly::New();
-
- // a vtkPropAssembly is not a sub-class of vtkProp3D, so
- // we cannot use m_Prop3D.
-}
-
-mitk::MeshVtkMapper3D::~MeshVtkMapper3D()
-{
- m_ContourActor->Delete();
- m_SpheresActor->Delete();
- m_ContourMapper->Delete();
- m_SpheresMapper->Delete();
- m_PropAssembly->Delete();
- m_Spheres->Delete();
- m_Contour->Delete();
-}
-
-void mitk::MeshVtkMapper3D::GenerateDataForRenderer(mitk::BaseRenderer *renderer)
-{
- BaseLocalStorage *ls = m_LSH.GetLocalStorage(renderer);
- bool needGenerateData = ls->IsGenerateDataRequired(renderer, this, GetDataNode());
-
- if (needGenerateData)
- {
- ls->UpdateGenerateDataTime();
-
- m_PropAssembly->VisibilityOn();
-
- if (m_PropAssembly->GetParts()->IsItemPresent(m_SpheresActor))
- m_PropAssembly->RemovePart(m_SpheresActor);
- if (m_PropAssembly->GetParts()->IsItemPresent(m_ContourActor))
- m_PropAssembly->RemovePart(m_ContourActor);
-
- m_Spheres->RemoveAllInputs();
- m_Contour->Initialize();
-
- mitk::Mesh::Pointer input = const_cast<mitk::Mesh *>(this->GetInput());
- input->Update();
-
- mitk::Mesh::DataType::Pointer itkMesh = input->GetMesh(this->GetTimestep());
-
- if (itkMesh.GetPointer() == nullptr)
- {
- m_PropAssembly->VisibilityOff();
- return;
- }
-
- mitk::Mesh::PointsContainer::Iterator i;
-
- int j;
-
- float floatRgba[4] = {1.0f, 1.0f, 1.0f, 1.0f};
- double doubleRgba[4] = {1.0f, 1.0f, 1.0f, 1.0f};
- mitk::Color tmpColor;
-
- // check for color prop and use it for rendering if it exists
- m_DataNode->GetColor(floatRgba, nullptr);
-
- if (dynamic_cast<mitk::ColorProperty *>(this->GetDataNode()->GetProperty("unselectedcolor")) != nullptr)
- {
- tmpColor = dynamic_cast<mitk::ColorProperty *>(this->GetDataNode()->GetProperty("unselectedcolor"))->GetValue();
- floatRgba[0] = tmpColor[0];
- floatRgba[1] = tmpColor[1];
- floatRgba[2] = tmpColor[2];
- floatRgba[3] = 1.0f; //!!define a new ColorProp to be able to pass alpha value
- doubleRgba[0] = floatRgba[0];
- doubleRgba[1] = floatRgba[1];
- doubleRgba[2] = floatRgba[2];
- doubleRgba[3] = floatRgba[3];
- }
-
- if (itkMesh->GetNumberOfPoints() > 0)
- {
- // build m_Spheres->GetOutput() vtkPolyData
- float pointSize = 2.0;
- mitk::FloatProperty::Pointer pointSizeProp =
- dynamic_cast<mitk::FloatProperty *>(this->GetDataNode()->GetProperty("pointsize"));
- if (pointSizeProp.IsNotNull())
- pointSize = pointSizeProp->GetValue();
-
- for (j = 0, i = itkMesh->GetPoints()->Begin(); i != itkMesh->GetPoints()->End(); i++, j++)
- {
- vtkSmartPointer<vtkSphereSource> sphere = vtkSmartPointer<vtkSphereSource>::New();
-
- sphere->SetRadius(pointSize);
- sphere->SetCenter(i.Value()[0], i.Value()[1], i.Value()[2]);
-
- m_Spheres->AddInputConnection(sphere->GetOutputPort());
- sphere->Delete();
- }
-
- // setup mapper, actor and add to assembly
- m_SpheresMapper->SetInputConnection(m_Spheres->GetOutputPort());
- m_SpheresActor->GetProperty()->SetColor(doubleRgba);
- m_PropAssembly->AddPart(m_SpheresActor);
- }
-
- if (itkMesh->GetNumberOfCells() > 0)
- {
-// build m_Contour vtkPolyData
-#ifdef VCL_VC60
- itkExceptionMacro(<< "MeshVtkMapper3D currently not working for MS Visual C++ 6.0, because MeshUtils are "
- "currently not supported.");
-#else
- m_Contour =
- MeshUtil<mitk::Mesh::MeshType>::MeshToPolyData(itkMesh.GetPointer(), false, false, 0, nullptr, m_Contour);
-#endif
-
- if (m_Contour->GetNumberOfCells() > 0)
- {
- // setup mapper, actor and add to assembly
- m_ContourMapper->SetInputData(m_Contour);
- bool wireframe = true;
- GetDataNode()->GetVisibility(wireframe, nullptr, "wireframe");
- if (wireframe)
- m_ContourActor->GetProperty()->SetRepresentationToWireframe();
- else
- m_ContourActor->GetProperty()->SetRepresentationToSurface();
- m_ContourActor->GetProperty()->SetColor(doubleRgba);
- m_PropAssembly->AddPart(m_ContourActor);
- }
- }
- }
-
- bool visible = true;
- GetDataNode()->GetVisibility(visible, renderer, "visible");
-
- if (!visible)
- {
- m_SpheresActor->VisibilityOff();
- m_ContourActor->VisibilityOff();
- return;
- }
-
- bool makeContour = false;
- this->GetDataNode()->GetBoolProperty("show contour", makeContour);
-
- if (makeContour)
- {
- m_ContourActor->VisibilityOn();
- }
- else
- {
- m_ContourActor->VisibilityOff();
- }
-
- bool showPoints = true;
- this->GetDataNode()->GetBoolProperty("show points", showPoints);
- if (showPoints)
- {
- m_SpheresActor->VisibilityOn();
- }
- else
- {
- m_SpheresActor->VisibilityOff();
- }
-}
-
-void mitk::MeshVtkMapper3D::ResetMapper(BaseRenderer * /*renderer*/)
-{
- m_PropAssembly->VisibilityOff();
-}
diff --git a/Modules/MapperExt/src/mitkUnstructuredGridMapper2D.cpp b/Modules/MapperExt/src/mitkUnstructuredGridMapper2D.cpp
index a4e89fbf06..a4db90ea37 100644
--- a/Modules/MapperExt/src/mitkUnstructuredGridMapper2D.cpp
+++ b/Modules/MapperExt/src/mitkUnstructuredGridMapper2D.cpp
@@ -1,555 +1,555 @@
/*============================================================================
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 "mitkUnstructuredGridMapper2D.h"
#include <mitkGL.h>
#include "mitkAbstractTransformGeometry.h"
#include "mitkBaseRenderer.h"
#include "mitkColorProperty.h"
#include "mitkPlaneGeometry.h"
#include "mitkProperties.h"
#include "mitkTransferFunction.h"
#include "mitkTransferFunctionProperty.h"
#include "mitkUnstructuredGrid.h"
#include "mitkVtkMapper3D.h"
#include "mitkVtkScalarModeProperty.h"
#include <vtkAbstractMapper3D.h>
#include <vtkAbstractVolumeMapper.h>
#include <vtkAssembly.h>
#include <vtkCellArray.h>
#include <vtkCellData.h>
#include <vtkColorTransferFunction.h>
#include <vtkLinearTransform.h>
#include <vtkLookupTable.h>
#include <vtkPiecewiseFunction.h>
#include <vtkPlane.h>
#include <vtkPointData.h>
#include <vtkProp3DCollection.h>
#include <vtkScalarsToColors.h>
#include <vtkUnstructuredGrid.h>
#include <vtkVolume.h>
#include <vtkVolumeProperty.h>
#include "vtkPointSetSlicer.h"
void mitk::UnstructuredGridMapper2D::GenerateDataForRenderer(mitk::BaseRenderer *renderer)
{
BaseLocalStorage *ls = m_LSH.GetLocalStorage(renderer);
bool needGenerateData = ls->IsGenerateDataRequired(renderer, this, GetDataNode());
if (needGenerateData)
{
ls->UpdateGenerateDataTime();
mitk::DataNode::ConstPointer node = this->GetDataNode();
if (node.IsNull())
return;
if (!node->GetProperty(m_ScalarMode, "scalar mode"))
{
m_ScalarMode = mitk::VtkScalarModeProperty::New(0);
}
if (!node->GetProperty(m_ScalarVisibility, "scalar visibility"))
{
m_ScalarVisibility = mitk::BoolProperty::New(true);
}
if (!node->GetProperty(m_Outline, "outline polygons"))
{
m_Outline = mitk::BoolProperty::New(false);
}
if (!node->GetProperty(m_Color, "color"))
{
m_Color = mitk::ColorProperty::New(1.0f, 1.0f, 1.0f);
}
if (!node->GetProperty(m_LineWidth, "line width"))
{
m_LineWidth = mitk::IntProperty::New(1);
}
}
mitk::BaseData::Pointer input = GetDataNode()->GetData();
assert(input);
input->Update();
if (m_VtkPointSet)
m_VtkPointSet->UnRegister(nullptr);
m_VtkPointSet = this->GetVtkPointSet(renderer, this->GetTimestep());
assert(m_VtkPointSet);
m_VtkPointSet->Register(nullptr);
if (m_ScalarVisibility->GetValue())
{
mitk::DataNode::ConstPointer node = this->GetDataNode();
mitk::TransferFunctionProperty::Pointer transferFuncProp;
node->GetProperty(transferFuncProp, "TransferFunction", renderer);
if (transferFuncProp.IsNotNull())
{
mitk::TransferFunction::Pointer tf = transferFuncProp->GetValue();
if (m_ScalarsToColors)
m_ScalarsToColors->UnRegister(nullptr);
m_ScalarsToColors = static_cast<vtkScalarsToColors *>(tf->GetColorTransferFunction());
m_ScalarsToColors->Register(nullptr);
if (m_ScalarsToOpacity)
m_ScalarsToOpacity->UnRegister(nullptr);
m_ScalarsToOpacity = tf->GetScalarOpacityFunction();
m_ScalarsToOpacity->Register(nullptr);
}
else
{
if (m_ScalarsToColors)
m_ScalarsToColors->UnRegister(nullptr);
m_ScalarsToColors = this->GetVtkLUT(renderer);
assert(m_ScalarsToColors);
m_ScalarsToColors->Register(nullptr);
float opacity;
node->GetOpacity(opacity, renderer);
if (m_ScalarsToOpacity)
m_ScalarsToOpacity->UnRegister(nullptr);
m_ScalarsToOpacity = vtkPiecewiseFunction::New();
double range[2];
m_VtkPointSet->GetScalarRange(range);
m_ScalarsToOpacity->AddSegment(range[0], opacity, range[1], opacity);
}
}
}
void mitk::UnstructuredGridMapper2D::Paint(mitk::BaseRenderer *renderer)
{
bool visible = true;
GetDataNode()->GetVisibility(visible, renderer, "visible");
if (!visible)
return;
vtkLinearTransform *vtktransform = GetDataNode()->GetVtkTransform();
vtkLinearTransform *inversetransform = vtktransform->GetLinearInverse();
PlaneGeometry::ConstPointer worldGeometry = renderer->GetCurrentWorldPlaneGeometry();
PlaneGeometry::ConstPointer worldPlaneGeometry = dynamic_cast<const PlaneGeometry *>(worldGeometry.GetPointer());
Point3D point;
Vector3D normal;
if (worldPlaneGeometry.IsNotNull())
{
// set up vtkPlane according to worldGeometry
point = worldPlaneGeometry->GetOrigin();
normal = worldPlaneGeometry->GetNormal();
normal.Normalize();
m_Plane->SetTransform((vtkAbstractTransform *)nullptr);
}
else
{
//@FIXME: does not work correctly. Does m_Plane->SetTransform really transforms a "plane plane" into a "curved
//plane"?
return;
AbstractTransformGeometry::ConstPointer worldAbstractGeometry =
dynamic_cast<const AbstractTransformGeometry *>(renderer->GetCurrentWorldPlaneGeometry());
if (worldAbstractGeometry.IsNotNull())
{
// set up vtkPlane according to worldGeometry
point = worldAbstractGeometry->GetParametricBoundingBox()->GetMinimum();
FillVector3D(normal, 0, 0, 1);
m_Plane->SetTransform(worldAbstractGeometry->GetVtkAbstractTransform()->GetInverse());
}
else
return;
}
double vp[3], vnormal[3];
vnl2vtk(point.GetVnlVector(), vp);
vnl2vtk(normal.GetVnlVector(), vnormal);
// normally, we would need to transform the surface and cut the transformed surface with the cutter.
// This might be quite slow. Thus, the idea is, to perform an inverse transform of the plane instead.
//@todo It probably does not work for scaling operations yet:scaling operations have to be
// dealed with after the cut is performed by scaling the contour.
inversetransform->TransformPoint(vp, vp);
inversetransform->TransformNormalAtPoint(vp, vnormal, vnormal);
m_Plane->SetOrigin(vp);
m_Plane->SetNormal(vnormal);
// set data into cutter
m_Slicer->SetInputData(m_VtkPointSet);
// m_Cutter->GenerateCutScalarsOff();
// m_Cutter->SetSortByToSortByCell();
// calculate the cut
m_Slicer->Update();
// apply color and opacity read from the PropertyList
ApplyColorAndOpacityProperties(renderer);
// traverse the cut contour
vtkPolyData *contour = m_Slicer->GetOutput();
vtkPoints *vpoints = contour->GetPoints();
vtkCellArray *vlines = contour->GetLines();
vtkCellArray *vpolys = contour->GetPolys();
vtkPointData *vpointdata = contour->GetPointData();
vtkDataArray *vscalars = vpointdata->GetScalars();
vtkCellData *vcelldata = contour->GetCellData();
vtkDataArray *vcellscalars = vcelldata->GetScalars();
const int numberOfLines = contour->GetNumberOfLines();
const int numberOfPolys = contour->GetNumberOfPolys();
const bool useCellData = m_ScalarMode->GetVtkScalarMode() == VTK_SCALAR_MODE_DEFAULT ||
m_ScalarMode->GetVtkScalarMode() == VTK_SCALAR_MODE_USE_CELL_DATA;
const bool usePointData = m_ScalarMode->GetVtkScalarMode() == VTK_SCALAR_MODE_USE_POINT_DATA;
Point3D p;
Point2D p2d;
vlines->InitTraversal();
vpolys->InitTraversal();
mitk::Color outlineColor = m_Color->GetColor();
glLineWidth((float)m_LineWidth->GetValue());
for (int i = 0; i < numberOfLines; ++i)
{
- vtkIdType *cell(nullptr);
+ const vtkIdType *cell(nullptr);
vtkIdType cellSize(0);
vlines->GetNextCell(cellSize, cell);
float rgba[4] = {outlineColor[0], outlineColor[1], outlineColor[2], 1.0f};
if (m_ScalarVisibility->GetValue() && vcellscalars)
{
if (useCellData)
{ // color each cell according to cell data
double scalar = vcellscalars->GetComponent(i, 0);
double rgb[3] = {1.0f, 1.0f, 1.0f};
m_ScalarsToColors->GetColor(scalar, rgb);
rgba[0] = (float)rgb[0];
rgba[1] = (float)rgb[1];
rgba[2] = (float)rgb[2];
rgba[3] = (float)m_ScalarsToOpacity->GetValue(scalar);
}
else if (usePointData)
{
double scalar = vscalars->GetComponent(i, 0);
double rgb[3] = {1.0f, 1.0f, 1.0f};
m_ScalarsToColors->GetColor(scalar, rgb);
rgba[0] = (float)rgb[0];
rgba[1] = (float)rgb[1];
rgba[2] = (float)rgb[2];
rgba[3] = (float)m_ScalarsToOpacity->GetValue(scalar);
}
}
glColor4fv(rgba);
glBegin(GL_LINE_LOOP);
for (int j = 0; j < cellSize; ++j)
{
vpoints->GetPoint(cell[j], vp);
// take transformation via vtktransform into account
vtktransform->TransformPoint(vp, vp);
vtk2itk(vp, p);
// convert 3D point (in mm) to display coordinates (units )
renderer->WorldToDisplay(p, p2d);
// convert display coordinates ( (0,0) is top-left ) in GL coordinates ( (0,0) is bottom-left )
// p2d[1]=toGL-p2d[1];
// add the current vertex to the line
glVertex2f(p2d[0], p2d[1]);
}
glEnd();
}
bool polyOutline = m_Outline->GetValue();
bool scalarVisibility = m_ScalarVisibility->GetValue();
// cache the transformed points
// a fixed size array is way faster than 'new'
// slices through 3d cells usually do not generated
// polygons with more than 6 vertices
const int maxPolySize = 10;
auto *cachedPoints = new Point2D[maxPolySize * numberOfPolys];
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// only draw polygons if there are cell scalars
// or the outline property is set to true
if (scalarVisibility && vcellscalars)
{
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
for (int i = 0; i < numberOfPolys; ++i)
{
- vtkIdType *cell(nullptr);
+ const vtkIdType *cell(nullptr);
vtkIdType cellSize(0);
vpolys->GetNextCell(cellSize, cell);
float rgba[4] = {1.0f, 1.0f, 1.0f, 0};
if (scalarVisibility && vcellscalars)
{
if (useCellData)
{ // color each cell according to cell data
double scalar = vcellscalars->GetComponent(i + numberOfLines, 0);
double rgb[3] = {1.0f, 1.0f, 1.0f};
m_ScalarsToColors->GetColor(scalar, rgb);
rgba[0] = (float)rgb[0];
rgba[1] = (float)rgb[1];
rgba[2] = (float)rgb[2];
rgba[3] = (float)m_ScalarsToOpacity->GetValue(scalar);
}
else if (usePointData)
{
double scalar = vscalars->GetComponent(i, 0);
double rgb[3] = {1.0f, 1.0f, 1.0f};
m_ScalarsToColors->GetColor(scalar, rgb);
rgba[0] = (float)rgb[0];
rgba[1] = (float)rgb[1];
rgba[2] = (float)rgb[2];
rgba[3] = (float)m_ScalarsToOpacity->GetValue(scalar);
}
}
glColor4fv(rgba);
glBegin(GL_POLYGON);
for (int j = 0; j < cellSize; ++j)
{
vpoints->GetPoint(cell[j], vp);
// take transformation via vtktransform into account
vtktransform->TransformPoint(vp, vp);
vtk2itk(vp, p);
// convert 3D point (in mm) to display coordinates (units )
renderer->WorldToDisplay(p, p2d);
// convert display coordinates ( (0,0) is top-left ) in GL coordinates ( (0,0) is bottom-left )
// p2d[1]=toGL-p2d[1];
cachedPoints[i * 10 + j][0] = p2d[0];
cachedPoints[i * 10 + j][1] = p2d[1];
// add the current vertex to the line
glVertex2f(p2d[0], p2d[1]);
}
glEnd();
}
if (polyOutline)
{
vpolys->InitTraversal();
glColor4f(outlineColor[0], outlineColor[1], outlineColor[2], 1.0f);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
for (int i = 0; i < numberOfPolys; ++i)
{
- vtkIdType *cell(nullptr);
+ const vtkIdType *cell(nullptr);
vtkIdType cellSize(0);
vpolys->GetNextCell(cellSize, cell);
glBegin(GL_POLYGON);
// glPolygonOffset(1.0, 1.0);
for (int j = 0; j < cellSize; ++j)
{
// add the current vertex to the line
glVertex2f(cachedPoints[i * 10 + j][0], cachedPoints[i * 10 + j][1]);
}
glEnd();
}
}
}
glDisable(GL_BLEND);
delete[] cachedPoints;
}
vtkAbstractMapper3D *mitk::UnstructuredGridMapper2D::GetVtkAbstractMapper3D(mitk::BaseRenderer *renderer)
{
// MITK_INFO << "GETVTKABSTRACTMAPPER3D\n";
mitk::DataNode::ConstPointer node = this->GetDataNode();
if (node.IsNull())
return nullptr;
mitk::VtkMapper::Pointer mitkMapper = dynamic_cast<mitk::VtkMapper *>(node->GetMapper(2));
if (mitkMapper.IsNull())
{
return nullptr;
}
mitkMapper->Update(renderer);
auto *assembly = dynamic_cast<vtkAssembly *>(mitkMapper->GetVtkProp(renderer));
if (assembly)
{
vtkProp3DCollection *collection = assembly->GetParts();
collection->InitTraversal();
vtkProp3D *prop3d = nullptr;
do
{
prop3d = collection->GetNextProp3D();
auto *actor = dynamic_cast<vtkActor *>(prop3d);
if (actor)
{
return dynamic_cast<vtkAbstractMapper3D *>(actor->GetMapper());
}
auto *volume = dynamic_cast<vtkVolume *>(prop3d);
if (volume)
{
return dynamic_cast<vtkAbstractMapper3D *>(volume->GetMapper());
}
} while (prop3d != collection->GetLastProp3D());
}
else
{
auto *actor = dynamic_cast<vtkActor *>(mitkMapper->GetVtkProp(renderer));
if (actor)
{
return dynamic_cast<vtkAbstractMapper3D *>(actor->GetMapper());
}
auto *volume = dynamic_cast<vtkVolume *>(mitkMapper->GetVtkProp(renderer));
if (volume)
{
return dynamic_cast<vtkAbstractMapper3D *>(volume->GetMapper());
}
}
return nullptr;
}
vtkPointSet *mitk::UnstructuredGridMapper2D::GetVtkPointSet(mitk::BaseRenderer *renderer, int time)
{
// MITK_INFO << "GETVTKPOINTSET\n";
vtkAbstractMapper3D *abstractMapper = GetVtkAbstractMapper3D(renderer);
if (abstractMapper == nullptr)
{
// try to get data from the node
mitk::DataNode::ConstPointer node = this->GetDataNode();
if (node.IsNull())
return nullptr;
mitk::BaseData::Pointer data = node->GetData();
mitk::UnstructuredGrid::Pointer grid = dynamic_cast<mitk::UnstructuredGrid *>(data.GetPointer());
if (!grid.IsNull())
return static_cast<vtkPointSet *>(grid->GetVtkUnstructuredGrid(time));
return nullptr;
}
else
{
auto *mapper = dynamic_cast<vtkMapper *>(abstractMapper);
if (mapper)
{
return dynamic_cast<vtkPointSet *>(mapper->GetInput());
}
auto *volMapper = dynamic_cast<vtkAbstractVolumeMapper *>(abstractMapper);
if (volMapper)
{
return dynamic_cast<vtkPointSet *>(volMapper->GetDataSetInput());
}
}
return nullptr;
}
vtkScalarsToColors *mitk::UnstructuredGridMapper2D::GetVtkLUT(mitk::BaseRenderer *renderer)
{
// MITK_INFO << "GETVTKLUT\n";
auto *mapper = dynamic_cast<vtkMapper *>(GetVtkAbstractMapper3D(renderer));
if (mapper)
return mapper->GetLookupTable();
else
{
mitk::DataNode::ConstPointer node = this->GetDataNode();
if (node.IsNull())
return nullptr;
mitk::VtkMapper::Pointer mitkMapper = dynamic_cast<mitk::VtkMapper *>(node->GetMapper(2));
if (mitkMapper.IsNull())
{
// MITK_INFO << "mitkMapper is null\n";
return nullptr;
}
mitkMapper->Update(renderer);
auto *volume = dynamic_cast<vtkVolume *>(mitkMapper->GetVtkProp(renderer));
if (volume)
{
// MITK_INFO << "found volume prop\n";
return static_cast<vtkScalarsToColors *>(volume->GetProperty()->GetRGBTransferFunction());
}
auto *assembly = dynamic_cast<vtkAssembly *>(mitkMapper->GetVtkProp(renderer));
if (assembly)
{
// MITK_INFO << "found assembly prop\n";
mitk::TransferFunctionProperty::Pointer transferFuncProp;
node->GetProperty(transferFuncProp, "TransferFunction", nullptr);
if (transferFuncProp.IsNotNull())
{
MITK_INFO << "return colortransferfunction\n";
return static_cast<vtkScalarsToColors *>(transferFuncProp->GetValue()->GetColorTransferFunction());
}
}
return nullptr;
}
}
bool mitk::UnstructuredGridMapper2D::IsConvertibleToVtkPointSet(mitk::BaseRenderer *renderer)
{
return (GetVtkPointSet(renderer, this->GetTimestep()) != nullptr);
}
mitk::UnstructuredGridMapper2D::UnstructuredGridMapper2D()
{
m_Plane = vtkPlane::New();
m_Slicer = vtkPointSetSlicer::New();
m_Slicer->SetSlicePlane(m_Plane);
m_ScalarsToColors = nullptr;
m_ScalarsToOpacity = nullptr;
m_VtkPointSet = nullptr;
// m_LUT = vtkLookupTable::New();
// m_LUT->SetTableRange( 0, 255 );
// m_LUT->SetNumberOfColors( 255 );
// m_LUT->SetRampToLinear ();
// m_LUT->Build();
}
mitk::UnstructuredGridMapper2D::~UnstructuredGridMapper2D()
{
m_Slicer->Delete();
m_Plane->Delete();
if (m_ScalarsToOpacity != nullptr)
m_ScalarsToOpacity->UnRegister(nullptr);
if (m_ScalarsToColors != nullptr)
m_ScalarsToColors->UnRegister(nullptr);
if (m_VtkPointSet != nullptr)
m_VtkPointSet->UnRegister(nullptr);
}
diff --git a/Modules/MapperExt/src/mitkVolumeMapperVtkSmart3D.cpp b/Modules/MapperExt/src/mitkVolumeMapperVtkSmart3D.cpp
index 502d8a43e4..ee9a32ef57 100644
--- a/Modules/MapperExt/src/mitkVolumeMapperVtkSmart3D.cpp
+++ b/Modules/MapperExt/src/mitkVolumeMapperVtkSmart3D.cpp
@@ -1,244 +1,237 @@
/*============================================================================
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 "mitkVolumeMapperVtkSmart3D.h"
#include "mitkTransferFunctionProperty.h"
#include "mitkTransferFunctionInitializer.h"
#include "mitkLevelWindowProperty.h"
#include <vtkObjectFactory.h>
-#include <vtkRenderingOpenGL2ObjectFactory.h>
-#include <vtkRenderingVolumeOpenGL2ObjectFactory.h>
#include <vtkColorTransferFunction.h>
#include <vtkPiecewiseFunction.h>
+#include <vtkAutoInit.h>
void mitk::VolumeMapperVtkSmart3D::GenerateDataForRenderer(mitk::BaseRenderer *renderer)
{
bool value;
this->GetDataNode()->GetBoolProperty("volumerendering", value, renderer);
if (!value)
{
m_Volume->VisibilityOff();
return;
}
else
{
m_Volume->VisibilityOn();
}
UpdateTransferFunctions(renderer);
UpdateRenderMode(renderer);
this->Modified();
}
vtkProp* mitk::VolumeMapperVtkSmart3D::GetVtkProp(mitk::BaseRenderer *)
{
if (!m_Volume->GetMapper())
{
createMapper(GetInputImage());
createVolume();
createVolumeProperty();
}
return m_Volume;
}
void mitk::VolumeMapperVtkSmart3D::ApplyProperties(vtkActor *, mitk::BaseRenderer *)
{
}
void mitk::VolumeMapperVtkSmart3D::SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer, bool overwrite)
{
// GPU_INFO << "SetDefaultProperties";
node->AddProperty("volumerendering", mitk::BoolProperty::New(false), renderer, overwrite);
node->AddProperty("volumerendering.usemip", mitk::BoolProperty::New(false), renderer, overwrite);
node->AddProperty("volumerendering.cpu.ambient", mitk::FloatProperty::New(0.10f), renderer, overwrite);
node->AddProperty("volumerendering.cpu.diffuse", mitk::FloatProperty::New(0.50f), renderer, overwrite);
node->AddProperty("volumerendering.cpu.specular", mitk::FloatProperty::New(0.40f), renderer, overwrite);
node->AddProperty("volumerendering.cpu.specular.power", mitk::FloatProperty::New(16.0f), renderer, overwrite);
node->AddProperty("volumerendering.usegpu", mitk::BoolProperty::New(false), renderer, overwrite);
node->AddProperty("volumerendering.useray", mitk::BoolProperty::New(false), renderer, overwrite);
node->AddProperty("volumerendering.gpu.ambient", mitk::FloatProperty::New(0.25f), renderer, overwrite);
node->AddProperty("volumerendering.gpu.diffuse", mitk::FloatProperty::New(0.50f), renderer, overwrite);
node->AddProperty("volumerendering.gpu.specular", mitk::FloatProperty::New(0.40f), renderer, overwrite);
node->AddProperty("volumerendering.gpu.specular.power", mitk::FloatProperty::New(16.0f), renderer, overwrite);
node->AddProperty("binary", mitk::BoolProperty::New(false), renderer, overwrite);
mitk::Image::Pointer image = dynamic_cast<mitk::Image *>(node->GetData());
if (image.IsNotNull() && image->IsInitialized())
{
if ((overwrite) || (node->GetProperty("TransferFunction", renderer) == nullptr))
{
// add a default transfer function
mitk::TransferFunction::Pointer tf = mitk::TransferFunction::New();
mitk::TransferFunctionInitializer::Pointer tfInit = mitk::TransferFunctionInitializer::New(tf);
tfInit->SetTransferFunctionMode(0);
node->SetProperty("TransferFunction", mitk::TransferFunctionProperty::New(tf.GetPointer()));
}
}
Superclass::SetDefaultProperties(node, renderer, overwrite);
}
vtkImageData* mitk::VolumeMapperVtkSmart3D::GetInputImage()
{
auto input = dynamic_cast<mitk::Image*>(this->GetDataNode()->GetData());
return input->GetVtkImageData(this->GetTimestep());
}
void mitk::VolumeMapperVtkSmart3D::createMapper(vtkImageData* imageData)
{
Vector3D spacing;
FillVector3D(spacing, 1.0, 1.0, 1.0);
m_ImageChangeInformation->SetInputData(imageData);
m_ImageChangeInformation->SetOutputSpacing(spacing.GetDataPointer());
m_SmartVolumeMapper->SetBlendModeToComposite();
m_SmartVolumeMapper->SetInputConnection(m_ImageChangeInformation->GetOutputPort());
}
void mitk::VolumeMapperVtkSmart3D::createVolume()
{
m_Volume->VisibilityOff();
m_Volume->SetMapper(m_SmartVolumeMapper);
m_Volume->SetProperty(m_VolumeProperty);
}
void mitk::VolumeMapperVtkSmart3D::createVolumeProperty()
{
m_VolumeProperty->ShadeOn();
m_VolumeProperty->SetInterpolationType(VTK_LINEAR_INTERPOLATION);
}
void mitk::VolumeMapperVtkSmart3D::UpdateTransferFunctions(mitk::BaseRenderer *renderer)
{
vtkSmartPointer<vtkPiecewiseFunction> opacityTransferFunction;
vtkSmartPointer<vtkPiecewiseFunction> gradientTransferFunction;
vtkSmartPointer<vtkColorTransferFunction> colorTransferFunction;
bool isBinary = false;
this->GetDataNode()->GetBoolProperty("binary", isBinary, renderer);
if (isBinary)
{
colorTransferFunction = vtkSmartPointer<vtkColorTransferFunction>::New();
float rgb[3];
if (!GetDataNode()->GetColor(rgb, renderer))
rgb[0] = rgb[1] = rgb[2] = 1;
colorTransferFunction->AddRGBPoint(0, rgb[0], rgb[1], rgb[2]);
colorTransferFunction->Modified();
opacityTransferFunction = vtkSmartPointer<vtkPiecewiseFunction>::New();
gradientTransferFunction = vtkSmartPointer<vtkPiecewiseFunction>::New();
}
else
{
auto *transferFunctionProp =
dynamic_cast<mitk::TransferFunctionProperty *>(this->GetDataNode()->GetProperty("TransferFunction", renderer));
if (transferFunctionProp)
{
opacityTransferFunction = transferFunctionProp->GetValue()->GetScalarOpacityFunction();
gradientTransferFunction = transferFunctionProp->GetValue()->GetGradientOpacityFunction();
colorTransferFunction = transferFunctionProp->GetValue()->GetColorTransferFunction();
}
else
{
opacityTransferFunction = vtkSmartPointer<vtkPiecewiseFunction>::New();
gradientTransferFunction = vtkSmartPointer<vtkPiecewiseFunction>::New();
colorTransferFunction = vtkSmartPointer<vtkColorTransferFunction>::New();
}
}
m_VolumeProperty->SetColor(colorTransferFunction);
m_VolumeProperty->SetScalarOpacity(opacityTransferFunction);
m_VolumeProperty->SetGradientOpacity(gradientTransferFunction);
}
void mitk::VolumeMapperVtkSmart3D::UpdateRenderMode(mitk::BaseRenderer *renderer)
{
bool usegpu = false;
bool useray = false;
bool usemip = false;
this->GetDataNode()->GetBoolProperty("volumerendering.usegpu", usegpu);
this->GetDataNode()->GetBoolProperty("volumerendering.useray", useray);
this->GetDataNode()->GetBoolProperty("volumerendering.usemip", usemip);
if (usegpu)
m_SmartVolumeMapper->SetRequestedRenderModeToGPU();
else if (useray)
m_SmartVolumeMapper->SetRequestedRenderModeToRayCast();
else
m_SmartVolumeMapper->SetRequestedRenderModeToDefault();
int blendMode;
if (this->GetDataNode()->GetIntProperty("volumerendering.blendmode", blendMode))
m_SmartVolumeMapper->SetBlendMode(blendMode);
else if (usemip)
m_SmartVolumeMapper->SetBlendMode(vtkSmartVolumeMapper::MAXIMUM_INTENSITY_BLEND);
// shading parameter
if (m_SmartVolumeMapper->GetRequestedRenderMode() == vtkSmartVolumeMapper::GPURenderMode)
{
float value = 0;
if (this->GetDataNode()->GetFloatProperty("volumerendering.gpu.ambient", value, renderer))
m_VolumeProperty->SetAmbient(value);
if (this->GetDataNode()->GetFloatProperty("volumerendering.gpu.diffuse", value, renderer))
m_VolumeProperty->SetDiffuse(value);
if (this->GetDataNode()->GetFloatProperty("volumerendering.gpu.specular", value, renderer))
m_VolumeProperty->SetSpecular(value);
if (this->GetDataNode()->GetFloatProperty("volumerendering.gpu.specular.power", value, renderer))
m_VolumeProperty->SetSpecularPower(value);
}
else
{
float value = 0;
if (this->GetDataNode()->GetFloatProperty("volumerendering.cpu.ambient", value, renderer))
m_VolumeProperty->SetAmbient(value);
if (this->GetDataNode()->GetFloatProperty("volumerendering.cpu.diffuse", value, renderer))
m_VolumeProperty->SetDiffuse(value);
if (this->GetDataNode()->GetFloatProperty("volumerendering.cpu.specular", value, renderer))
m_VolumeProperty->SetSpecular(value);
if (this->GetDataNode()->GetFloatProperty("volumerendering.cpu.specular.power", value, renderer))
m_VolumeProperty->SetSpecularPower(value);
}
}
mitk::VolumeMapperVtkSmart3D::VolumeMapperVtkSmart3D()
{
- m_RenderingOpenGL2ObjectFactory = vtkSmartPointer<vtkRenderingOpenGL2ObjectFactory>::New();
- m_RenderingVolumeOpenGL2ObjectFactory = vtkSmartPointer<vtkRenderingVolumeOpenGL2ObjectFactory>::New();
-
- vtkObjectFactory::RegisterFactory(m_RenderingOpenGL2ObjectFactory);
- vtkObjectFactory::RegisterFactory(m_RenderingVolumeOpenGL2ObjectFactory);
-
m_SmartVolumeMapper = vtkSmartPointer<vtkSmartVolumeMapper>::New();
m_SmartVolumeMapper->SetBlendModeToComposite();
m_ImageChangeInformation = vtkSmartPointer<vtkImageChangeInformation>::New();
m_VolumeProperty = vtkSmartPointer<vtkVolumeProperty>::New();
m_Volume = vtkSmartPointer<vtkVolume>::New();
}
mitk::VolumeMapperVtkSmart3D::~VolumeMapperVtkSmart3D()
{
}
diff --git a/Modules/MapperExt/src/vtkPointSetSlicer.cxx b/Modules/MapperExt/src/vtkPointSetSlicer.cxx
index 19246c9152..f240df59bb 100644
--- a/Modules/MapperExt/src/vtkPointSetSlicer.cxx
+++ b/Modules/MapperExt/src/vtkPointSetSlicer.cxx
@@ -1,634 +1,629 @@
/*============================================================================
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 <algorithm>
#include <vector>
#include "vtkPointSetSlicer.h"
#include "vtkCellArray.h"
+#include "vtkCellArrayIterator.h"
#include "vtkCellData.h"
#include "vtkCutter.h"
#include "vtkDataSet.h"
#include "vtkDoubleArray.h"
#include "vtkFloatArray.h"
#include "vtkGenericCell.h"
#include "vtkMergePoints.h"
#include "vtkObjectFactory.h"
#include "vtkPlane.h"
#include "vtkPointData.h"
#include "vtkPolyData.h"
#include "vtkUnstructuredGrid.h"
#include "vtkInformation.h"
#include "vtkInformationVector.h"
#include "vtkStreamingDemandDrivenPipeline.h"
vtkStandardNewMacro(vtkPointSetSlicer);
// Construct with user-specified implicit function; initial value of 0.0; and
// generating cut scalars turned off.
vtkPointSetSlicer::vtkPointSetSlicer(vtkPlane *cf)
{
this->SlicePlane = cf;
this->GenerateCutScalars = 0;
this->Locator = nullptr;
this->Cutter = vtkCutter::New();
this->Cutter->GenerateValues(1, 0, 1);
}
vtkPointSetSlicer::~vtkPointSetSlicer()
{
this->SetSlicePlane(nullptr);
if (this->Locator)
{
this->Locator->UnRegister(this);
this->Locator = nullptr;
}
this->Cutter->Delete();
}
void vtkPointSetSlicer::SetSlicePlane(vtkPlane *plane)
{
if (this->SlicePlane == plane)
{
return;
}
if (this->SlicePlane)
{
this->SlicePlane->UnRegister(this);
this->SlicePlane = nullptr;
}
if (plane)
{
plane->Register(this);
this->Cutter->SetCutFunction(plane);
}
this->SlicePlane = plane;
this->Modified();
}
// Overload standard modified time function. If cut functions is modified,
// or contour values modified, then this object is modified as well.
vtkMTimeType vtkPointSetSlicer::GetMTime()
{
vtkMTimeType mTime = this->Superclass::GetMTime();
vtkMTimeType time;
if (this->SlicePlane != nullptr)
{
time = this->SlicePlane->GetMTime();
mTime = (time > mTime ? time : mTime);
}
if (this->Locator != nullptr)
{
time = this->Locator->GetMTime();
mTime = (time > mTime ? time : mTime);
}
return mTime;
}
int vtkPointSetSlicer::RequestData(vtkInformation * /*request*/,
vtkInformationVector **inputVector,
vtkInformationVector *outputVector)
{
// get the info objects
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
vtkInformation *outInfo = outputVector->GetInformationObject(0);
// get the input and ouptut
vtkDataSet *input = vtkDataSet::SafeDownCast(inInfo->Get(vtkDataObject::DATA_OBJECT()));
vtkPolyData *output = vtkPolyData::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
vtkDebugMacro(<< "Executing cutter");
if (!this->SlicePlane)
{
vtkErrorMacro("No slice plane specified");
return 0;
}
if (input->GetNumberOfPoints() < 1)
{
return 1;
}
if (input->GetDataObjectType() == VTK_STRUCTURED_POINTS || input->GetDataObjectType() == VTK_IMAGE_DATA)
{
if (input->GetCell(0) && input->GetCell(0)->GetCellDimension() >= 3)
{
// this->StructuredPointsCutter(input, output, request, inputVector, outputVector);
return 1;
}
}
if (input->GetDataObjectType() == VTK_STRUCTURED_GRID)
{
if (input->GetCell(0))
{
int dim = input->GetCell(0)->GetCellDimension();
// only do 3D structured grids (to be extended in the future)
if (dim >= 3)
{
// this->StructuredGridCutter(input, output);
return 1;
}
}
}
if (input->GetDataObjectType() == VTK_RECTILINEAR_GRID)
{
// this->RectilinearGridCutter(input, output);
return 1;
}
if (input->GetDataObjectType() == VTK_UNSTRUCTURED_GRID)
{
vtkDebugMacro(<< "Executing Unstructured Grid Cutter");
this->UnstructuredGridCutter(input, output);
}
else
{
vtkDebugMacro(<< "Executing DataSet Cutter");
// this->DataSetCutter(input, output);
}
return 1;
}
int vtkPointSetSlicer::RequestUpdateExtent(vtkInformation *, vtkInformationVector **inputVector, vtkInformationVector *)
{
vtkInformation *inInfo = inputVector[0]->GetInformationObject(0);
inInfo->Set(vtkStreamingDemandDrivenPipeline::EXACT_EXTENT(), 1);
return 1;
}
int vtkPointSetSlicer::FillInputPortInformation(int, vtkInformation *info)
{
info->Set(vtkAlgorithm::INPUT_REQUIRED_DATA_TYPE(), "vtkDataSet");
return 1;
}
void vtkPointSetSlicer::UnstructuredGridCutter(vtkDataSet *input, vtkPolyData *output)
{
- vtkIdType cellId, i;
+ vtkIdType i;
vtkDoubleArray *cellScalars;
vtkCellArray *newVerts, *newLines, *newPolys;
vtkPoints *newPoints;
vtkDoubleArray *cutScalars;
double s;
vtkIdType estimatedSize, numCells = input->GetNumberOfCells();
vtkIdType numPts = input->GetNumberOfPoints();
- vtkIdType cellArrayIt = 0;
- int numCellPts;
+ vtkIdType numCellPts;
+ const vtkIdType* cellPts = nullptr;
vtkPointData *inPD, *outPD;
vtkCellData *inCD = input->GetCellData(), *outCD = output->GetCellData();
vtkIdList *cellIds;
int abortExecute = 0;
double range[2];
// Create objects to hold output of contour operation
//
estimatedSize = (vtkIdType)pow((double)numCells, .75);
estimatedSize = estimatedSize / 1024 * 1024; // multiple of 1024
if (estimatedSize < 1024)
{
estimatedSize = 1024;
}
newPoints = vtkPoints::New();
newPoints->Allocate(estimatedSize, estimatedSize / 2);
newVerts = vtkCellArray::New();
newVerts->Allocate(estimatedSize, estimatedSize / 2);
newLines = vtkCellArray::New();
newLines->Allocate(estimatedSize, estimatedSize / 2);
newPolys = vtkCellArray::New();
newPolys->Allocate(estimatedSize, estimatedSize / 2);
cutScalars = vtkDoubleArray::New();
cutScalars->SetNumberOfTuples(numPts);
// Interpolate data along edge. If generating cut scalars, do necessary setup
if (this->GenerateCutScalars)
{
inPD = vtkPointData::New();
inPD->ShallowCopy(input->GetPointData()); // copies original attributes
inPD->SetScalars(cutScalars);
}
else
{
inPD = input->GetPointData();
}
outPD = output->GetPointData();
outPD->InterpolateAllocate(inPD, estimatedSize, estimatedSize / 2);
outCD->CopyAllocate(inCD, estimatedSize, estimatedSize / 2);
// locator used to merge potentially duplicate points
if (this->Locator == nullptr)
{
this->CreateDefaultLocator();
}
this->Locator->InitPointInsertion(newPoints, input->GetBounds());
// Loop over all points evaluating scalar function at each point
//
for (i = 0; i < numPts; i++)
{
s = this->SlicePlane->FunctionValue(input->GetPoint(i));
cutScalars->SetComponent(i, 0, s);
}
// Compute some information for progress methods
//
vtkIdType numCuts = numCells;
vtkIdType progressInterval = numCuts / 20 + 1;
int cut = 0;
vtkUnstructuredGrid *grid = (vtkUnstructuredGrid *)input;
- vtkIdType *cellArrayPtr = grid->GetCells()->GetPointer();
+ auto cellArrayIt = vtk::TakeSmartPointer(grid->GetCells()->NewIterator());
double *scalarArrayPtr = cutScalars->GetPointer(0);
double tempScalar;
cellScalars = cutScalars->NewInstance();
cellScalars->SetNumberOfComponents(cutScalars->GetNumberOfComponents());
cellScalars->Allocate(VTK_CELL_SIZE * cutScalars->GetNumberOfComponents());
// Three passes over the cells to process lower dimensional cells first.
// For poly data output cells need to be added in the order:
// verts, lines and then polys, or cell data gets mixed up.
// A better solution is to have an unstructured grid output.
// I create a table that maps cell type to cell dimensionality,
// because I need a fast way to get cell dimensionality.
// This assumes GetCell is slow and GetCellType is fast.
// I do not like hard coding a list of cell types here,
// but I do not want to add GetCellDimension(vtkIdType cellId)
// to the vtkDataSet API. Since I anticipate that the output
// will change to vtkUnstructuredGrid. This temporary solution
// is acceptable.
//
int cellType;
unsigned char cellTypeDimensions[VTK_NUMBER_OF_CELL_TYPES];
vtkCutter::GetCellTypeDimensions(cellTypeDimensions);
int dimensionality;
// We skip 0d cells (points), because they cannot be cut (generate no data).
for (dimensionality = 1; dimensionality <= 3; ++dimensionality)
{
// Loop over all cells; get scalar values for all cell points
// and process each cell.
//
- cellArrayIt = 0;
- for (cellId = 0; cellId < numCells && !abortExecute; cellId++)
+ for(cellArrayIt->GoToFirstCell(); !cellArrayIt->IsDoneWithTraversal() && !abortExecute; cellArrayIt->GoToNextCell())
{
- numCellPts = cellArrayPtr[cellArrayIt];
+ cellArrayIt->GetCurrentCell(numCellPts, cellPts);
// I assume that "GetCellType" is fast.
- cellType = input->GetCellType(cellId);
+ cellType = input->GetCellType(cellArrayIt->GetCurrentCellId());
if (cellType >= VTK_NUMBER_OF_CELL_TYPES)
{ // Protect against new cell types added.
vtkErrorMacro("Unknown cell type " << cellType);
- cellArrayIt += 1 + numCellPts;
continue;
}
if (cellTypeDimensions[cellType] != dimensionality)
{
- cellArrayIt += 1 + numCellPts;
continue;
}
- cellArrayIt++;
// find min and max values in scalar data
- range[0] = scalarArrayPtr[cellArrayPtr[cellArrayIt]];
- range[1] = scalarArrayPtr[cellArrayPtr[cellArrayIt]];
- cellArrayIt++;
+ range[0] = scalarArrayPtr[cellPts[0]];
+ range[1] = scalarArrayPtr[cellPts[0]];
for (i = 1; i < numCellPts; i++)
{
- tempScalar = scalarArrayPtr[cellArrayPtr[cellArrayIt]];
- cellArrayIt++;
+ tempScalar = scalarArrayPtr[cellPts[i]];
if (tempScalar <= range[0])
{
range[0] = tempScalar;
} // if tempScalar <= min range value
if (tempScalar >= range[1])
{
range[1] = tempScalar;
} // if tempScalar >= max range value
} // for all points in this cell
int needCell = 0;
if (0.0 >= range[0] && 0.0 <= range[1])
{
needCell = 1;
}
if (needCell)
{
- vtkCell *cell = input->GetCell(cellId);
+ vtkCell *cell = input->GetCell(cellArrayIt->GetCurrentCellId());
cellIds = cell->GetPointIds();
cutScalars->GetTuples(cellIds, cellScalars);
// Loop over all contour values.
if (dimensionality == 3 && !(++cut % progressInterval))
{
vtkDebugMacro(<< "Cutting #" << cut);
this->UpdateProgress(static_cast<double>(cut) / numCuts);
abortExecute = this->GetAbortExecute();
}
this->ContourUnstructuredGridCell(
- cell, cellScalars, this->Locator, newVerts, newLines, newPolys, inPD, outPD, inCD, cellId, outCD);
+ cell, cellScalars, this->Locator, newVerts, newLines, newPolys, inPD, outPD, inCD, cellArrayIt->GetCurrentCellId(), outCD);
} // if need cell
} // for all cells
} // for all dimensions (1,2,3).
// Update ourselves. Because we don't know upfront how many verts, lines,
// polys we've created, take care to reclaim memory.
//
cellScalars->Delete();
cutScalars->Delete();
if (this->GenerateCutScalars)
{
inPD->Delete();
}
output->SetPoints(newPoints);
newPoints->Delete();
if (newVerts->GetNumberOfCells())
{
output->SetVerts(newVerts);
}
newVerts->Delete();
if (newLines->GetNumberOfCells())
{
output->SetLines(newLines);
}
newLines->Delete();
if (newPolys->GetNumberOfCells())
{
output->SetPolys(newPolys);
}
newPolys->Delete();
this->Locator->Initialize(); // release any extra memory
output->Squeeze();
}
void vtkPointSetSlicer::ContourUnstructuredGridCell(vtkCell *cell,
vtkDataArray *cellScalars,
vtkPointLocator *locator,
vtkCellArray *verts,
vtkCellArray *lines,
vtkCellArray *polys,
vtkPointData *inPd,
vtkPointData *outPd,
vtkCellData *inCd,
vtkIdType cellId,
vtkCellData *outCd)
{
if (cell->GetCellType() == VTK_HEXAHEDRON)
{
static int CASE_MASK[8] = {1, 2, 4, 8, 16, 32, 64, 128};
POLY_CASES *polyCase;
EDGE_LIST *edge;
int i, j, index, *vert;
volatile int pnum;
int v1, v2, newCellId;
double t, x1[3], x2[3], x[3], deltaScalar;
vtkIdType offset = verts->GetNumberOfCells() + lines->GetNumberOfCells();
// Build the case table
for (i = 0, index = 0; i < 8; i++)
{
if (cellScalars->GetComponent(i, 0) >= 0)
{
index |= CASE_MASK[i];
}
}
polyCase = polyCases + index;
edge = polyCase->edges;
// get the point number of the polygon
pnum = 0;
for (i = 0; i < 8; i++)
if (edge[i] > -1)
pnum++;
else
break;
vtkIdType *pts = new vtkIdType[pnum];
for (i = 0; i < pnum; i++) // insert polygon
{
vert = edges[edge[i]];
// calculate a preferred interpolation direction
deltaScalar = (cellScalars->GetComponent(vert[1], 0) - cellScalars->GetComponent(vert[0], 0));
if (deltaScalar > 0)
{
v1 = vert[0];
v2 = vert[1];
}
else
{
v1 = vert[1];
v2 = vert[0];
deltaScalar = -deltaScalar;
}
// linear interpolation
t = (deltaScalar == 0.0 ? 0.0 : (-cellScalars->GetComponent(v1, 0)) / deltaScalar);
cell->GetPoints()->GetPoint(v1, x1);
cell->GetPoints()->GetPoint(v2, x2);
for (j = 0; j < 3; j++)
{
x[j] = x1[j] + t * (x2[j] - x1[j]);
}
if (locator->InsertUniquePoint(x, pts[i]))
{
if (outPd)
{
vtkIdType p1 = cell->GetPointIds()->GetId(v1);
vtkIdType p2 = cell->GetPointIds()->GetId(v2);
outPd->InterpolateEdge(inPd, pts[i], p1, p2, t);
}
}
}
// check for degenerate polygon
std::vector<vtkIdType> pset;
for (i = 0; i < pnum; i++)
{
if (std::find(pset.begin(), pset.end(), pts[i]) == pset.end())
pset.push_back(pts[i]);
}
if (pset.size() > 2)
{
i = 0;
for (std::vector<vtkIdType>::iterator iter = pset.begin(); iter != pset.end(); iter++)
{
pts[i] = *iter;
i++;
}
newCellId = offset + polys->InsertNextCell(pset.size(), pts);
outCd->CopyData(inCd, cellId, newCellId);
}
delete[] pts;
}
else
{
cell->Contour(0, cellScalars, locator, verts, lines, polys, inPd, outPd, inCd, cellId, outCd);
}
}
// Specify a spatial locator for merging points. By default,
// an instance of vtkMergePoints is used.
void vtkPointSetSlicer::SetLocator(vtkPointLocator *locator)
{
if (this->Locator == locator)
{
return;
}
if (this->Locator)
{
this->Locator->UnRegister(this);
this->Locator = nullptr;
}
if (locator)
{
locator->Register(this);
}
this->Locator = locator;
this->Modified();
}
void vtkPointSetSlicer::CreateDefaultLocator()
{
if (this->Locator == nullptr)
{
this->Locator = vtkMergePoints::New();
this->Locator->Register(this);
this->Locator->Delete();
}
}
void vtkPointSetSlicer::PrintSelf(std::ostream &os, vtkIndent indent)
{
this->Superclass::PrintSelf(os, indent);
os << indent << "Slice Plane: " << this->SlicePlane << "\n";
if (this->Locator)
{
os << indent << "Locator: " << this->Locator << "\n";
}
else
{
os << indent << "Locator: (none)\n";
}
os << indent << "Generate Cut Scalars: " << (this->GenerateCutScalars ? "On\n" : "Off\n");
}
int vtkPointSetSlicer::edges[12][2] = {
{0, 1}, {1, 2}, {3, 2}, {0, 3}, {4, 5}, {5, 6}, {7, 6}, {4, 7}, {0, 4}, {1, 5}, {2, 6}, {3, 7}};
vtkPointSetSlicer::POLY_CASES vtkPointSetSlicer::polyCases[256] = {
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{0, 3, 8, -1, -1, -1, -1, -1}}, {{1, 0, 9, -1, -1, -1, -1, -1}},
{{1, 3, 8, 9, -1, -1, -1, -1}}, {{2, 1, 10, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{2, 0, 9, 10, -1, -1, -1, -1}}, {{2, 10, 9, 8, 3, -1, -1, -1}}, {{3, 2, 11, -1, -1, -1, -1, -1}},
{{0, 2, 11, 8, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{1, 9, 8, 11, 2, -1, -1, -1}},
{{3, 1, 10, 11, -1, -1, -1, -1}}, {{0, 8, 11, 10, 1, -1, -1, -1}}, {{3, 11, 10, 9, 0, -1, -1, -1}},
{{8, 9, 10, 11, -1, -1, -1, -1}}, {{4, 7, 8, -1, -1, -1, -1, -1}}, {{3, 7, 4, 0, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{9, 1, 3, 7, 4, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{11, 2, 0, 4, 7, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{1, 2, 11, 7, 4, 9, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{4, 7, 11, 10, 9, -1, -1, -1}}, {{5, 4, 9, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{0, 4, 5, 1, -1, -1, -1, -1}}, {{8, 3, 1, 5, 4, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{10, 2, 0, 4, 5, -1, -1, -1}},
{{2, 3, 8, 4, 5, 10, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{5, 4, 8, 11, 10, -1, -1, -1}},
{{5, 7, 8, 9, -1, -1, -1, -1}}, {{9, 5, 7, 3, 0, -1, -1, -1}}, {{8, 7, 5, 1, 0, -1, -1, -1}},
{{1, 3, 7, 5, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{2, 10, 5, 7, 3, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{2, 11, 7, 5, 1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{5, 7, 11, 10, -1, -1, -1, -1}}, {{6, 5, 10, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{1, 5, 6, 2, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{9, 0, 2, 6, 5, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{11, 3, 1, 5, 6, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{3, 0, 9, 5, 6, 11, -1, -1}}, {{6, 5, 9, 8, 11, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{6, 4, 9, 10, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{10, 6, 4, 0, 1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{9, 4, 6, 2, 1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{2, 0, 4, 6, -1, -1, -1, -1}}, {{3, 8, 4, 6, 2, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{3, 11, 6, 4, 0, -1, -1, -1}},
{{6, 4, 8, 11, -1, -1, -1, -1}}, {{6, 10, 9, 8, 7, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{6, 7, 8, 0, 1, 10, -1, -1}}, {{6, 10, 1, 3, 7, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{7, 8, 0, 2, 6, -1, -1, -1}}, {{2, 6, 7, 3, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{6, 7, 11, -1, -1, -1, -1, -1}}, {{7, 6, 11, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{2, 6, 7, 3, -1, -1, -1, -1}}, {{8, 0, 2, 6, 7, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{10, 1, 3, 7, 6, -1, -1, -1}},
{{0, 1, 10, 6, 7, 8, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{7, 6, 10, 9, 8, -1, -1, -1}},
{{4, 6, 11, 8, -1, -1, -1, -1}}, {{11, 6, 4, 0, 3, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{8, 4, 6, 2, 3, -1, -1, -1}},
{{0, 2, 6, 4, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{1, 9, 4, 6, 2, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{1, 10, 6, 4, 0, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{4, 6, 10, 9, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{5, 9, 8, 11, 6, -1, -1, -1}},
{{5, 6, 11, 3, 0, 9, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{6, 11, 3, 1, 5, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{5, 9, 0, 2, 6, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{1, 5, 6, 2, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{5, 6, 10, -1, -1, -1, -1, -1}},
{{7, 5, 10, 11, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{11, 7, 5, 1, 2, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{10, 5, 7, 3, 2, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{3, 1, 5, 7, -1, -1, -1, -1}}, {{0, 8, 7, 5, 1, -1, -1, -1}}, {{0, 9, 5, 7, 3, -1, -1, -1}},
{{7, 5, 9, 8, -1, -1, -1, -1}}, {{4, 8, 11, 10, 5, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{4, 5, 10, 2, 3, 8, -1, -1}}, {{5, 10, 2, 0, 4, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{4, 8, 3, 1, 5, -1, -1, -1}}, {{0, 4, 5, 1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{4, 5, 9, -1, -1, -1, -1, -1}}, {{7, 11, 10, 9, 4, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{7, 4, 9, 1, 2, 11, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{7, 11, 2, 0, 4, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{4, 9, 1, 3, 7, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}, {{3, 7, 4, 0, -1, -1, -1, -1}}, {{7, 4, 8, -1, -1, -1, -1, -1}},
{{10, 11, 8, 9, -1, -1, -1, -1}}, {{0, 3, 11, 10, 9, -1, -1, -1}}, {{1, 0, 8, 11, 10, -1, -1, -1}},
{{1, 3, 11, 10, -1, -1, -1, -1}}, {{2, 1, 9, 8, 11, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}},
{{2, 0, 8, 11, -1, -1, -1, -1}}, {{2, 3, 11, -1, -1, -1, -1, -1}}, {{3, 2, 10, 9, 8, -1, -1, -1}},
{{0, 2, 10, 9, -1, -1, -1, -1}}, {{-1, -1, -1, -1, -1, -1, -1, -1}}, {{1, 2, 10, -1, -1, -1, -1, -1}},
{{3, 1, 9, 8, -1, -1, -1, -1}}, {{0, 1, 9, -1, -1, -1, -1, -1}}, {{3, 0, 8, -1, -1, -1, -1, -1}},
{{-1, -1, -1, -1, -1, -1, -1, -1}}};
diff --git a/Modules/MapperExt/test/CMakeLists.txt b/Modules/MapperExt/test/CMakeLists.txt
index bcc0538ea2..42638c56cd 100644
--- a/Modules/MapperExt/test/CMakeLists.txt
+++ b/Modules/MapperExt/test/CMakeLists.txt
@@ -1,5 +1 @@
mitk_create_module_tests()
-
-if(TARGET ${TESTDRIVER})
- set_property(TEST mitkSplineVtkMapper3DTest PROPERTY RUN_SERIAL TRUE)
-endif()
diff --git a/Modules/MapperExt/test/files.cmake b/Modules/MapperExt/test/files.cmake
index ace07fe6e0..cc61b6e656 100644
--- a/Modules/MapperExt/test/files.cmake
+++ b/Modules/MapperExt/test/files.cmake
@@ -1,3 +1,3 @@
-set(MODULE_TESTS
+set(MODULE_RENDERING_TESTS
mitkSplineVtkMapper3DTest.cpp
)
diff --git a/Modules/MatchPointRegistration/CMakeLists.txt b/Modules/MatchPointRegistration/CMakeLists.txt
index acbcd26ff3..71204d9f1a 100644
--- a/Modules/MatchPointRegistration/CMakeLists.txt
+++ b/Modules/MatchPointRegistration/CMakeLists.txt
@@ -1,28 +1,29 @@
MITK_CREATE_MODULE(
INCLUDE_DIRS
PUBLIC algorithms
PRIVATE src/Helper src/Rendering
DEPENDS MitkCore MitkSceneSerializationBase
PACKAGE_DEPENDS
PUBLIC MatchPoint
+ PRIVATE VTK|ImagingGeneral+ImagingHybrid
)
if(TARGET ${MODULE_TARGET})
set(ALG_PROFILE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/algorithms)
include(${MatchPoint_SOURCE_DIR}/CMake/mapFunctionCreateAlgorithmProfile.cmake)
file(GLOB ALG_PROFILE_FILES LIST_DIRECTORIES false RELATIVE ${ALG_PROFILE_DIR} "${ALG_PROFILE_DIR}/*.profile")
foreach(profile_file ${ALG_PROFILE_FILES})
get_filename_component(profile_name ${profile_file} NAME_WE)
MESSAGE(STATUS "... generate MDRA profile ${profile_name} (from ${profile_file})...")
CREATE_ALGORITHM_PROFILE(${profile_name} ${ALG_PROFILE_DIR}/${profile_file})
endforeach(profile_file)
ADD_SUBDIRECTORY(autoload/IO)
ADD_SUBDIRECTORY(deployment)
if(BUILD_TESTING)
ADD_SUBDIRECTORY(Testing)
endif(BUILD_TESTING)
ADD_SUBDIRECTORY(cmdapps)
endif()
diff --git a/Modules/MatchPointRegistration/include/mitkRegEvaluationMapper2D.h b/Modules/MatchPointRegistration/include/mitkRegEvaluationMapper2D.h
index 934346fb63..54e35034e9 100644
--- a/Modules/MatchPointRegistration/include/mitkRegEvaluationMapper2D.h
+++ b/Modules/MatchPointRegistration/include/mitkRegEvaluationMapper2D.h
@@ -1,245 +1,248 @@
/*============================================================================
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 MITK_REG_EVALUATION_MAPPER_2D_H
#define MITK_REG_EVALUATION_MAPPER_2D_H
//MatchPoint
#include <mapRegistration.h>
#include "mitkRegEvaluationObject.h"
//MITK
#include <mitkCommon.h>
//MITK Rendering
#include "mitkBaseRenderer.h"
#include "mitkVtkMapper.h"
#include "mitkExtractSliceFilter.h"
//VTK
#include <vtkSmartPointer.h>
#include <vtkPropAssembly.h>
//MITK
#include "MitkMatchPointRegistrationExports.h"
class vtkActor;
class vtkPolyDataMapper;
class vtkPlaneSource;
class vtkImageData;
class vtkLookupTable;
class vtkImageExtractComponents;
class vtkImageReslice;
class vtkImageChangeInformation;
class vtkPoints;
class vtkMitkThickSlicesFilter;
class vtkPolyData;
class vtkMitkApplyLevelWindowToRGBFilter;
class vtkMitkLevelWindowFilter;
namespace mitk {
/** \brief Mapper to resample and display 2D slices of registration evaluation visualization.
* \ingroup Mapper
*/
class MITKMATCHPOINTREGISTRATION_EXPORT RegEvaluationMapper2D : public VtkMapper
{
public:
/** Standard class typedefs. */
mitkClassMacro( RegEvaluationMapper2D,VtkMapper );
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
const mitk::DataNode* GetTargetNode(void);
const mitk::DataNode* GetMovingNode(void);
/** \brief Get the target image to map */
const mitk::Image *GetTargetImage(void);
/** \brief Get the moving image to map */
const mitk::Image *GetMovingImage(void);
/** \brief Get the target image to map */
const mitk::MAPRegistrationWrapper *GetRegistration(void);
/** \brief Checks whether this mapper needs to update itself and generate
* data. */
void Update(mitk::BaseRenderer * renderer) override;
//### methods of MITK-VTK rendering pipeline
vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
//### end of methods of MITK-VTK rendering pipeline
/** \brief Internal class holding the mapper, actor, etc. for each of the 3 2D render windows */
/**
* To render transveral, coronal, and sagittal, the mapper is called three times.
* For performance reasons, the corresponding data for each view is saved in the
* internal helper class LocalStorage. This allows rendering n views with just
* 1 mitkMapper using n vtkMapper.
* */
class MITKMATCHPOINTREGISTRATION_EXPORT LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer<vtkActor> m_Actor;
vtkSmartPointer<vtkPropAssembly> m_Actors;
/** \brief Mapper of a 2D render window. */
vtkSmartPointer<vtkPolyDataMapper> m_Mapper;
/** \brief Current slice of a 2D render window.*/
vtkSmartPointer<vtkImageData> m_EvaluationImage;
/** \brief Empty vtkPolyData that is set when rendering geometry does not
* intersect the image geometry.
* \warning This member variable is set to nullptr,
* if no image geometry is inside the plane geometry
* of the respective render window. Any user of this
* slice has to check whether it is set to nullptr!
*/
vtkSmartPointer<vtkPolyData> m_EmptyPolyData;
/** \brief Plane on which the slice is rendered as texture. */
vtkSmartPointer<vtkPlaneSource> m_Plane;
/** \brief The texture which is used to render the current slice. */
vtkSmartPointer<vtkTexture> m_Texture;
/** \brief The lookuptables for colors and level window */
vtkSmartPointer<vtkLookupTable> m_ColorLookupTable;
vtkSmartPointer<vtkLookupTable> m_DefaultLookupTable;
/** \brief The actual reslicer (one per renderer) */
mitk::ExtractSliceFilter::Pointer m_Reslicer;
/** part of the target image that is relevant for the rendering*/
mitk::Image::Pointer m_slicedTargetImage;
/** part of the moving image mapped into the slicedTargetImage
geometry*/
mitk::Image::Pointer m_slicedMappedImage;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief mmPerPixel relation between pixel and mm. (World spacing).*/
mitk::ScalarType* m_mmPerPixel;
/** \brief This filter is used to apply the level window to target image. */
vtkSmartPointer<vtkMitkLevelWindowFilter> m_TargetLevelWindowFilter;
/** \brief This filter is used to apply the level window to moving image. */
vtkSmartPointer<vtkMitkLevelWindowFilter> m_MappedLevelWindowFilter;
vtkSmartPointer<vtkImageExtractComponents> m_TargetExtractFilter;
vtkSmartPointer<vtkImageExtractComponents> m_MappedExtractFilter;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage() override;
};
/** \brief The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<LocalStorage> m_LSH;
/** \brief Get the LocalStorage corresponding to the current renderer. */
LocalStorage* GetLocalStorage(mitk::BaseRenderer* renderer);
/** \brief Set the default properties for general image rendering. */
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = nullptr, bool overwrite = false);
protected:
/** \brief Transforms the actor to the actual position in 3D.
* \param renderer The current renderer corresponding to the render window.
*/
void TransformActor(mitk::BaseRenderer* renderer);
/** \brief Generates a plane according to the size of the resliced image in milimeters.
- *
- * \image html texturedPlane.png
*
* In VTK a vtkPlaneSource is defined through three points. The origin and two
* points defining the axes of the plane (see VTK documentation). The origin is
* set to (xMin; yMin; Z), where xMin and yMin are the minimal bounds of the
* resliced image in space. Z is relevant for blending and the layer property.
* The center of the plane (C) is also the center of the view plane (cf. the image above).
*
* \note For the standard MITK view with three 2D render windows showing three
* different slices, three such planes are generated. All these planes are generated
* in the XY-plane (even if they depict a YZ-slice of the volume).
*
*/
void GeneratePlane(mitk::BaseRenderer* renderer, double planeBounds[6]);
/** Default constructor */
RegEvaluationMapper2D();
/** Default deconstructor */
~RegEvaluationMapper2D() override;
/** \brief Does the actual resampling, without rendering the image yet.
* All the data is generated inside this method. The vtkProp (or Actor)
* is filled with content (i.e. the resliced image).
*
* After generation, a 4x4 transformation matrix(t) of the current slice is obtained
* from the vtkResliceImage object via GetReslicesAxis(). This matrix is
* applied to each textured plane (actor->SetUserTransform(t)) to transform everything
* to the actual 3D position (cf. the following image).
*
* \image html cameraPositioning3D.png
*
*/
void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
void PrepareContour( mitk::DataNode* datanode, LocalStorage * localStorage );
void PrepareDifference( LocalStorage * localStorage );
void PrepareWipe(mitk::DataNode* datanode, LocalStorage * localStorage, const Point2D& currentIndex2D);
void PrepareCheckerBoard( mitk::DataNode* datanode, LocalStorage * localStorage );
void PrepareColorBlend( LocalStorage * localStorage );
void PrepareBlend( mitk::DataNode* datanode, LocalStorage * localStorage );
/** \brief This method uses the vtkCamera clipping range and the layer property
* to calcualte the depth of the object (e.g. image or contour). The depth is used
* to keep the correct order for the final VTK rendering.*/
float CalculateLayerDepth(mitk::BaseRenderer* renderer);
/** \brief This method applies (or modifies) the lookuptable for all types of images.
* \warning To use the lookup table, the property 'Lookup Table' must be set and a 'Image Rendering.Mode'
* which uses the lookup table must be set.
*/
void ApplyLookuptable(mitk::BaseRenderer* renderer, const mitk::DataNode* dataNode, vtkMitkLevelWindowFilter* levelFilter);
/**
* @brief ApplyLevelWindow Apply the level window for the given renderer.
* \warning To use the level window, the property 'LevelWindow' must be set and a 'Image Rendering.Mode' which uses the level window must be set.
* @param renderer Level window for which renderer?
+ * @param dataNode
+ * @param levelFilter
*/
void ApplyLevelWindow(mitk::BaseRenderer *renderer, const mitk::DataNode* dataNode, vtkMitkLevelWindowFilter* levelFilter);
/** \brief Set the opacity of the actor. */
void ApplyOpacity( mitk::BaseRenderer* renderer );
/**
* \brief Calculates whether the given rendering geometry intersects the
* given SlicedGeometry3D.
*
* This method checks if the given PlaneGeometry intersects the given
* SlicedGeometry3D. It calculates the distance of the PlaneGeometry to all
* 8 cornerpoints of the SlicedGeometry3D. If all distances have the same
* sign (all positive or all negative) there is no intersection.
* If the distances have different sign, there is an intersection.
+ *
+ * \param renderingGeometry
+ * \param imageGeometry
**/
bool RenderingGeometryIntersectsImage( const PlaneGeometry* renderingGeometry, SlicedGeometry3D* imageGeometry );
};
} // namespace mitk
#endif /* MITKRegEvaluationMapper2D_H_HEADER_INCLUDED_C10E906E */
diff --git a/Modules/MatchPointRegistration/include/mitkRegistrationHelper.h b/Modules/MatchPointRegistration/include/mitkRegistrationHelper.h
index ff3f1c4c5d..1eba8b2551 100644
--- a/Modules/MatchPointRegistration/include/mitkRegistrationHelper.h
+++ b/Modules/MatchPointRegistration/include/mitkRegistrationHelper.h
@@ -1,91 +1,91 @@
/*============================================================================
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 _mitkRegistrationHelper_h
#define _mitkRegistrationHelper_h
//ITK
#include "itkScalableAffineTransform.h"
//MatchPoint
#include "mapRegistrationAlgorithmBase.h"
#include "mapRegistration.h"
//MITK
#include <mitkImage.h>
#include <mitkDataNode.h>
#include <mitkNodePredicateBase.h>
//MITK
#include "MitkMatchPointRegistrationExports.h"
#include "mitkMAPRegistrationWrapper.h"
namespace mitk
{
/*!
\brief MITKRegistrationHelper
\warning This class is not yet documented. Use "git blame" and ask the author to provide basic documentation.
*/
class MITKMATCHPOINTREGISTRATION_EXPORT MITKRegistrationHelper
{
public:
typedef ::itk::ScalableAffineTransform< ::mitk::ScalarType,3 > Affine3DTransformType;
typedef ::map::core::Registration<3,3> Registration3DType;
typedef ::map::core::RegistrationBase RegistrationBaseType;
/** Extracts the affine transformation, if possible, of the selected kernel.
@param wrapper Pointer to the registration that is target of the extraction
@param inverseKernel Indicates from which kernel the matrix should be extract. True: inverse kernel, False: direct kernel.
@return Pointer to the extracted transform. If it is not possible to convert the kernel into an affine transform a null pointer is returned.
@pre wrapper must point to a valid instance.
@pre wrapper must be a 3D-3D registration.*/
static Affine3DTransformType::Pointer getAffineMatrix(const mitk::MAPRegistrationWrapper* wrapper, bool inverseKernel);
static Affine3DTransformType::Pointer getAffineMatrix(const RegistrationBaseType* registration, bool inverseKernel);
static bool is3D(const mitk::MAPRegistrationWrapper* wrapper);
static bool is3D(const RegistrationBaseType* regBase);
/** Checks if the passed Node contains a MatchPoint registration
- @param Pointer to the node to be checked.*
+ @param node Pointer to the node to be checked.*
@return true: node contains a MAPRegistrationWrapper. false: "node" does not point to a valid instance or does not contain
a registration wrapper.*/;
static bool IsRegNode(const mitk::DataNode* node);
/** Returns a node predicate that identifies registration nodes.*/
static NodePredicateBase::ConstPointer RegNodePredicate();
/** Returns a node predicate that identifies image nodes.*/
static NodePredicateBase::ConstPointer ImageNodePredicate();
/** Returns a node predicate that identifies segmentation/mask nodes.*/
static NodePredicateBase::ConstPointer MaskNodePredicate();
/** Returns a node predicate that identifies point set nodes.*/
static NodePredicateBase::ConstPointer PointSetNodePredicate();
private:
typedef ::map::core::Registration<3,3>::DirectMappingType RegistrationKernel3DBase;
static Affine3DTransformType::Pointer getAffineMatrix(const RegistrationKernel3DBase& kernel);
MITKRegistrationHelper();
~MITKRegistrationHelper();
MITKRegistrationHelper& operator = (const MITKRegistrationHelper&);
MITKRegistrationHelper(const MITKRegistrationHelper&);
};
}
#endif
diff --git a/Modules/MatchPointRegistrationUI/Qmitk/QmitkAlgorithmProfileViewer.h b/Modules/MatchPointRegistrationUI/Qmitk/QmitkAlgorithmProfileViewer.h
index 52f2d5bd68..d9d8333ea2 100644
--- a/Modules/MatchPointRegistrationUI/Qmitk/QmitkAlgorithmProfileViewer.h
+++ b/Modules/MatchPointRegistrationUI/Qmitk/QmitkAlgorithmProfileViewer.h
@@ -1,50 +1,50 @@
/*============================================================================
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 QMITK_ALGORITHM_PROFILE_VIEWER_H
#define QMITK_ALGORITHM_PROFILE_VIEWER_H
#include <mapDeploymentDLLInfo.h>
#include <MitkMatchPointRegistrationUIExports.h>
#include "ui_QmitkAlgorithmProfileViewer.h"
#include <QWidget>
/**
* \class QmitkAlgorithmProfileViewer
* \brief Widget that views the information and profile of an algorithm stored in an DLLInfo object.
*/
class MITKMATCHPOINTREGISTRATIONUI_EXPORT QmitkAlgorithmProfileViewer : public QWidget,
private Ui::QmitkAlgorithmProfileViewer
{
Q_OBJECT
public:
QmitkAlgorithmProfileViewer(QWidget *parent = nullptr);
/**
* \brief Updates the widget according to the new info.
- * \param pointer to the info instance.
+ * \param newInfo pointer to the info instance.
* \remark The DLLInfo is not stored internally or as reference
* to update the widget you must use the updateInfo() method.
*/
void updateInfo(const map::deployment::DLLInfo *newInfo);
public Q_SLOTS:
/**
* \brief Slot that can be used to trigger updateInfo();
*/
void OnInfoChanged(const map::deployment::DLLInfo *newInfo);
};
#endif // QmitkAlgorithmProfileViewer_H
diff --git a/Modules/MatchPointRegistrationUI/Qmitk/QmitkAlgorithmSettingsConfig.h b/Modules/MatchPointRegistrationUI/Qmitk/QmitkAlgorithmSettingsConfig.h
index c576a87283..afaa49bc1e 100644
--- a/Modules/MatchPointRegistrationUI/Qmitk/QmitkAlgorithmSettingsConfig.h
+++ b/Modules/MatchPointRegistrationUI/Qmitk/QmitkAlgorithmSettingsConfig.h
@@ -1,56 +1,56 @@
/*============================================================================
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 QMITK_ALGORITHM_SETTINGS_CONFIG_H
#define QMITK_ALGORITHM_SETTINGS_CONFIG_H
#include <QSortFilterProxyModel>
#include <QWidget>
#include <mapDeploymentDLLInfo.h>
#include <QmitkMAPAlgorithmModel.h>
#include <MitkMatchPointRegistrationUIExports.h>
#include "ui_QmitkAlgorithmSettingsConfig.h"
/**
* \class QmitkAlgorithmSettingsConfig
* \brief Widget that views the information and profile of an algorithm stored in an DLLInfo object.
*/
class MITKMATCHPOINTREGISTRATIONUI_EXPORT QmitkAlgorithmSettingsConfig : public QWidget,
private Ui::QmitkAlgorithmSettingsConfig
{
Q_OBJECT
public:
QmitkAlgorithmSettingsConfig(QWidget *parent = nullptr);
/**
* \brief Changes the current algorithm and updates widget accordingly.
- * \param pointer to the algorithm instance.
+ * \param alg pointer to the algorithm instance.
*/
void setAlgorithm(map::algorithm::RegistrationAlgorithmBase *alg);
map::algorithm::RegistrationAlgorithmBase *getAlgorithm();
protected:
/** Pointer to the algorithm that should be configured */
map::algorithm::RegistrationAlgorithmBase::Pointer m_currentAlg;
// control the properties of the selected algorithm
QmitkMAPAlgorithmModel *m_AlgorithmModel;
QSortFilterProxyModel *m_ProxyModel;
};
#endif // QmitkAlgorithmSettingsConfig_H
diff --git a/Modules/MatchPointRegistrationUI/Qmitk/QmitkMapperSettingsWidget.h b/Modules/MatchPointRegistrationUI/Qmitk/QmitkMapperSettingsWidget.h
index 0dd3e5f0cf..c2e6da6ee5 100644
--- a/Modules/MatchPointRegistrationUI/Qmitk/QmitkMapperSettingsWidget.h
+++ b/Modules/MatchPointRegistrationUI/Qmitk/QmitkMapperSettingsWidget.h
@@ -1,65 +1,65 @@
/*============================================================================
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 QMITK_MAPPER_SETTINGS_WIDGET_H
#define QMITK_MAPPER_SETTINGS_WIDGET_H
#include <MitkMatchPointRegistrationUIExports.h>
#include "ui_QmitkMapperSettingsWidget.h"
#include <QWidget>
struct QmitkMappingJobSettings;
/**
* \class QmitkMapperSettingsWidget
* \brief Widget that views the information and profile of an algorithm stored in an DLLInfo object.
*/
class MITKMATCHPOINTREGISTRATIONUI_EXPORT QmitkMapperSettingsWidget : public QWidget,
private Ui::QmitkMapperSettingsWidget
{
Q_OBJECT
public:
QmitkMapperSettingsWidget(QWidget *parent = nullptr);
/**
* Configures the passed settings according to the current state of the
* widget.
- * \param pointer to a instance based on QmitkMappingJobSettings.
+ * \param settings to a instance based on QmitkMappingJobSettings.
* \pre settings must point to a valid instance..
*/
void ConfigureJobSettings(QmitkMappingJobSettings *settings);
public Q_SLOTS:
/**
* \brief Slot that can be used to set the mode for the mapping settings.
* Mask mode allows only nearest neighbour interpolation. It is needed for exmample
* when mapping segmentations.*/
void SetMaskMode(bool activeMask);
/**
* \brief Slot that can be used to set the widget to a mode where super/sub sampling
* is allowed (true) or not (false).*/
void AllowSampling(bool allow);
protected Q_SLOTS:
void OnLinkSampleFactorChecked();
void OnXFactorChanged(double d);
protected:
bool m_MaskMode;
bool m_allowSampling;
};
#endif // QmitkMapperSettingsWidget_H
diff --git a/Modules/ModelFit/include/mitkFormulaParser.h b/Modules/ModelFit/include/mitkFormulaParser.h
index fa1c4b9219..6e7eb93d2a 100644
--- a/Modules/ModelFit/include/mitkFormulaParser.h
+++ b/Modules/ModelFit/include/mitkFormulaParser.h
@@ -1,107 +1,107 @@
/*============================================================================
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 __MITKFORMULAPARSER_H__
#define __MITKFORMULAPARSER_H__
#include <string>
#include <map>
#include "mitkExceptionMacro.h"
#include "MitkModelFitExports.h"
namespace mitk
{
/*!
* @brief Exception class for all exceptions that are generated in the FormulaParser module.
*/
class MITKMODELFIT_EXPORT FormulaParserException : public mitk::Exception
{
public:
mitkExceptionClassMacro(FormulaParserException, mitk::Exception);
};
/*!
* @brief This class offers the functionality to evaluate simple mathematical formula
* strings (e.g. <code>"3.5 + 4 * x * sin(x) - 1 / 2"</code>).
- * @details Internally it utilizes the @c boost::spirit framework with the @ref Grammar
+ * @details Internally it utilizes the @c boost::spirit framework with the Grammar
* structure to parse the input string into a valid result number.
* Function strings (e.g. @c "sin", @c "tan" or @c "abs") are translated to
* actual function calls and variables (e.g. @c "x", @c "myVariable", "amount_")
* are replaced by their currently assigned value via a look-up table.
*
* The parser is able to recognize:
* @li sums, differences, products and divisions (<code>a + b</code>,
* <code>4 - 3</code>, <code>2 * x</code>, <code>9 / 3</code>)
* @li algebraic signs (@c +5, @c -5)
* @li exponentiation (<code>2 ^ 4</code>)
* @li parentheses (<code>3 * (4 + 2)</code>)
* @li variables (@c x, @c myVar, @c test2_var_)
* @li the following unary functions: @c abs, @c exp, @c sin, @c cos, @c tan,
* @c sind (sine in degrees), @c cosd (cosine in degrees), @c tand (tangent in
* degrees)
*
* In order to use the FormulaParser you just have to initialize it with a map of
* variables (i.e. a look-up table where @c "x" is assigned to @c 5 for example and
* @c "y" is assigned to @c 13 and so on) and then call the
* @ref FormulaParser::parse function with the string that should be evaluated. Be
* sure to update the look-up table everytime a variable's value changes since that
* is not done automatically.
*
* @author Sascha Diatschuk
*/
class MITKMODELFIT_EXPORT FormulaParser
{
public:
using ValueType = double;
using VariableMapType = std::map<std::string, ValueType>;
/*!
* @brief Construct the FormulaParser and initialized the variables with
* @b variables.
* @param[in] variables A map of variables with values that will be assigned to the
* corresponding member variable. The map is delivered as a
* pointer so you can still change it from outside this class.
*/
FormulaParser(const VariableMapType* variables);
/*!
* @brief Evaluates the @b input string and returns the resulting
* value.
* @param[in] input The string to be evaluated.
* @return The number that results from the evaluated string.
* @throw FormulaParserException If
* @li the parser comes across an unexpected character,
* @li a variable in the input string could not be found in the look-up
* table or
* @li the parser cannot apply the grammar to the string at all.
*/
ValueType parse(const std::string& input);
/*!
* @brief Looks up the associated value of the given string @b var in the
* variables map.
* @param[in] var The name of the variable whose value is to be returned.
* @return The associated value of the given variable name.
* @throw FormulaParserException If the variable map is empty or the given variable name
* cannot be found.
*/
ValueType lookupVariable(const std::string var);
private:
/*! @brief Map that holds the values that will replace the variables during evaluation. */
const VariableMapType* m_Variables;
};
}
#endif
diff --git a/Modules/ModelFit/include/mitkModelFitCmdAppsHelper.h b/Modules/ModelFit/include/mitkModelFitCmdAppsHelper.h
index c1803478a4..4d2cd049f2 100644
--- a/Modules/ModelFit/include/mitkModelFitCmdAppsHelper.h
+++ b/Modules/ModelFit/include/mitkModelFitCmdAppsHelper.h
@@ -1,56 +1,56 @@
/*============================================================================
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 _MITK_MODEL_FIT_CMD_APPS_HELPER_H_
#define _MITK_MODEL_FIT_CMD_APPS_HELPER_H_
// std includes
#include <string>
// itk includes
#include "itksys/SystemTools.hxx"
// MITK includes
#include <mitkParameterFitImageGeneratorBase.h>
#include <mitkModelFitInfo.h>
#include <mitkModelFitResultHelper.h>
#include <mitkIOUtil.h>
#include "MitkModelFitExports.h"
namespace mitk
{
/** Helper function that generates the file path that would be used to store an result image.
The output path will be determined given the outputPathTemplate (which determines the directory,
- the basic file name and the file formate). The output file name is: <basic file name>_<parameterName>.<extension indicated by outputPathTemplate>*/
+ the basic file name and the file formate). The output file name is: \<basic file name\>_\<parameterName\>.\<extension indicated by outputPathTemplate\>*/
MITKMODELFIT_EXPORT std::string generateModelFitResultImagePath(const std::string& outputPathTemplate, const std::string& parameterName);
/** Helper function that takes the given image and stores it based on a template path.
The real output path will be determined given the outputPathTemplate (which determines the directory,
- the basic file name and the file formate). The output file name is: <basic file name>_<parameterName>.<extension indicated by outputPathTemplate>*/
+ the basic file name and the file formate). The output file name is: \<basic file name\>_\<parameterName\>.\<extension indicated by outputPathTemplate\>*/
MITKMODELFIT_EXPORT void storeParameterResultImage(const std::string& outputPathTemplate, const std::string& parameterName, mitk::Image* image, mitk::modelFit::Parameter::Type parameterType = mitk::modelFit::Parameter::ParameterType);
/** Helper function that takes the given image, sets its properties according to the fit session and stores it.
The output path will be determined given the outputPathTemplate (which determines the directory,
- the basic file name and the file formate). The output file name is: <basic file name>_<parameterName>.<extension indicated by outputPathTemplate>*/
+ the basic file name and the file formate). The output file name is: \<basic file name\>_\<parameterName\>.\<extension indicated by outputPathTemplate\>*/
MITKMODELFIT_EXPORT void storeModelFitResultImage(const std::string& outputPathTemplate, const std::string& parameterName, mitk::Image* image, mitk::modelFit::Parameter::Type nodeType, const mitk::modelFit::ModelFitInfo* modelFitInfo);
/** Helper function that stores all results of the passed generator according to the passed outputPathTemplate.
For further information regarding the output file path, please see storeModelFitResultImage().*/
MITKMODELFIT_EXPORT void storeModelFitGeneratorResults(const std::string& outputPathTemplate, mitk::ParameterFitImageGeneratorBase* generator, const mitk::modelFit::ModelFitInfo* fitSession);
/** Helper function that outputs on the std::cout the result images the generator would produces.*/
MITKMODELFIT_EXPORT void previewModelFitGeneratorResults(const std::string& outputPathTemplate, mitk::ParameterFitImageGeneratorBase* generator);
}
#endif
diff --git a/Modules/ModelFit/include/mitkModelFitInfo.h b/Modules/ModelFit/include/mitkModelFitInfo.h
index fd88278c91..b9e849c7b9 100644
--- a/Modules/ModelFit/include/mitkModelFitInfo.h
+++ b/Modules/ModelFit/include/mitkModelFitInfo.h
@@ -1,199 +1,198 @@
/*============================================================================
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 mitkModelFitInfo_h
#define mitkModelFitInfo_h
#include <itkMutexLockHolder.h>
#include <itkSimpleFastMutexLock.h>
#include <mitkDataStorage.h>
#include "mitkModelFitConstants.h"
#include "mitkModelFitParameter.h"
#include "mitkModelFitStaticParameterMap.h"
#include "mitkScalarListLookupTable.h"
#include "mitkModelParameterizerBase.h"
#include "mitkModelTraitsInterface.h"
#include "MitkModelFitExports.h"
namespace mitk
{
namespace modelFit
{
/**
* @brief Data class that stores all information about a modelfit that is relevant to the
* visualization and stored as properties in the result nodes.
*/
class MITKMODELFIT_EXPORT ModelFitInfo : public itk::LightObject
{
public:
typedef std::string UIDType;
typedef std::vector<Parameter::Pointer> ParamListType;
typedef ParamListType::const_iterator ConstIterType;
mitkClassMacroItkParent(ModelFitInfo, itk::LightObject);
itkSimpleNewMacro(ModelFitInfo);
ModelFitInfo() :
x(mitk::ModelFitConstants::MODEL_X_VALUE_DEFAULT()),
xAxisName(mitk::ModelFitConstants::XAXIS_NAME_VALUE_DEFAULT()),
yAxisName(mitk::ModelFitConstants::YAXIS_NAME_VALUE_DEFAULT())
{
}
/**
* @brief Adds the given parameter to this fit's parameter list if it doesn't
* exist already.
* @param p The param that should be added to this fit's parameter list.
*/
void AddParameter(Parameter::Pointer p);
/**
* @brief Searches for the parameter with the given name and type in the fit's
* parameter list and returns it.
* @param name The name of the desired parameter.
* @param type The type of the desired parameter.
* @return The parameter with the given name on success or NULL otherwise.
*/
Parameter::ConstPointer GetParameter(const std::string& name, const Parameter::Type& type)
const;
/**
* @brief Searches for the parameter with the given name and type in the fit's
* parameter list and deletes it if it exists.
* @param name The name of the desired parameter.
* @param type The type of the desired parameter.
*/
void DeleteParameter(const std::string& name, const Parameter::Type& type);
/**Return const reference to the parameter list.*/
const ParamListType& GetParameters() const;
/** ModelFitConstants::MODEL_NAME_PROPERTY_NAME */
std::string modelName;
/** ModelFitConstants::MODEL_TYPE_PROPERTY_NAME */
std::string modelType;
/** ModelFitConstants::MODEL_FUNCTION_PROPERTY_NAME */
std::string function;
/** ModelFitConstants::MODEL_FUNCTION_CLASS_PROPERTY_NAME */
std::string functionClassID;
/** ModelFitConstants::MODEL_X_PROPERTY_NAME */
std::string x;
/** ModelFitConstants::XAXIS_NAME_PROPERTY_NAME */
std::string xAxisName;
/** ModelFitConstants::XAXIS_UNIT_PROPERTY_NAME */
std::string xAxisUnit;
/** ModelFitConstants::YAXIS_NAME_PROPERTY_NAME */
std::string yAxisName;
/** ModelFitConstants::YAXIS_UNIT_PROPERTY_NAME */
std::string yAxisUnit;
/** ModelFitConstants::FIT_UID_PROPERTY_NAME */
UIDType uid;
/** ModelFitConstants::FIT_NAME_PROPERTY_NAME */
std::string fitName;
/** ModelFitConstants::FIT_TYPE_PROPERTY_NAME */
std::string fitType;
/** ModelFitConstants::FIT_STATIC_PARAMETERS_PROPERTY_NAME */
StaticParameterMap staticParamMap;
/** ModelFitConstants::FIT_INPUT_ROIUID_PROPERTY_NAME */
UIDType roiUID;
/** ModelFitConstants::FIT_INPUT_DATA_PROPERTY_NAME */
ScalarListLookupTable inputData;
mitk::Image::ConstPointer inputImage;
private:
typedef ParamListType::iterator IterType;
typedef itk::MutexLockHolder<itk::SimpleFastMutexLock> LockType;
ParamListType parameterList;
itk::SimpleFastMutexLock mutex;
};
/**
* @brief Reads the string property with the given name from the data of the given node
* and returns its value. Throws a ModelFitException if the property doesn't exist.
* @param node The node whose property value should be returned.
* @param prop The name of the property that should be read.
* @return The value of the found property.
* @throw ModelFitException If the property doesn't exist or returns an empty string.
*/
MITKMODELFIT_EXPORT const std::string GetMandatoryProperty(const mitk::DataNode* node,
const std::string& prop);
/**
* @brief Reads the string property with the given name from the given base data and
* returns its value. Throws a ModelFitException if the property doesn't exist.
* @param data The data whose property value should be returned.
* @param prop The name of the property that should be read.
* @return The value of the found property.
* @throw ModelFitException If the property doesn't exist or returns an empty string.
*/
MITKMODELFIT_EXPORT const std::string GetMandatoryProperty(const mitk::BaseData* data,
const std::string& prop);
/**
* @brief Creates a new ModelFitInfo instance from the nodes in the passed storage.
* The fit will be identified by the passed UID. Returns the instance on
* success.
* @param uid The uid of the fit that should get its ModelFitInfo created and which identifies the nodes in the storage.
* @param storage Pointer to the data storage containing any potential relevantThe nodes.
* @return The newly created modelfit on success or NULL otherwise.
*/
MITKMODELFIT_EXPORT ModelFitInfo::Pointer CreateFitInfoFromNode(const ModelFitInfo::UIDType& uid,
const mitk::DataStorage* storage);
/** creates a new ModelFitInfo instance from a passed modal instance and his traits instance*
- * @param usedModel Pointer to a model which was used for a fit, which should get a fit info created.
- * @param modelTraits Pointer to traits interface for the model that was used for the fit.
+ * @param usedParameterizer Pointer to a model which was used for a fit, which should get a fit info created.
* @param inputImage Pointer to the input image. If it has no UID yet, a property will be added to the node.
* @param fitType String identifying the type of the fit (e.g. ROI based or voxel based)
* @param fitName Optional human readable name of the fit.
* @param roiUID UID of the ROI, if one was used.
* @return The newly created modelfit on success or NULL otherwise.*/
MITKMODELFIT_EXPORT ModelFitInfo::Pointer CreateFitInfoFromModelParameterizer(
const ModelParameterizerBase* usedParameterizer, mitk::BaseData* inputImage,
const std::string& fitType, const std::string& fitName = "", const ModelFitInfo::UIDType& roiUID = "");
/** @overload
Overloaded version that allows additional definition of optional input data for the fit.*/
MITKMODELFIT_EXPORT ModelFitInfo::Pointer CreateFitInfoFromModelParameterizer(
const ModelParameterizerBase* usedParameterizer, mitk::BaseData* inputImage,
const std::string& fitType, const ScalarListLookupTable& inputData, const std::string& fitName = "",
const ModelFitInfo::UIDType& roiUID = "");
/** Returns all nodes that belong to the fit indicated by the passed UID.
* @param fitUID The uid of the fit that is relevant for the query.
* @param storage Pointer to the data storage containing any potential relevant nodes.
* @return The set of found nodes or null if storage is not valid.
*/
MITKMODELFIT_EXPORT DataStorage::SetOfObjects::ConstPointer GetNodesOfFit(
const ModelFitInfo::UIDType& fitUID,
const mitk::DataStorage* storage);
typedef std::set<ModelFitInfo::UIDType> NodeUIDSetType;
/** Returns the UIDs of all fits that are derived (directly or indirectly from the passed node).
* @param node The node which defines the parent node. It will be searched in his derived nodes for fits.
* @param storage Pointer to the data storage containing any potential relevant nodes.
* @return The set of found uid will be returned.
*/
MITKMODELFIT_EXPORT NodeUIDSetType GetFitUIDsOfNode(const mitk::DataNode* node,
const mitk::DataStorage* storage);
}
}
#endif // mitkModelFit_h
diff --git a/Modules/ModelFit/include/mitkModelFitParameterValueExtraction.h b/Modules/ModelFit/include/mitkModelFitParameterValueExtraction.h
index 48d2f11773..6212b1a88f 100644
--- a/Modules/ModelFit/include/mitkModelFitParameterValueExtraction.h
+++ b/Modules/ModelFit/include/mitkModelFitParameterValueExtraction.h
@@ -1,59 +1,65 @@
/*============================================================================
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 mitkModelFitParameterValueExtraction_h
#define mitkModelFitParameterValueExtraction_h
#include <mitkPoint.h>
#include "mitkModelFitInfo.h"
#include "mitkModelTraitsInterface.h"
#include "MitkModelFitExports.h"
namespace mitk
{
/** Helper function that gets the voxel value (as double) of an image (given an 3D position and a time step).
Function is used in different contexts of model fit view.
+ @param image
+ @param position
+ @param timestep
@param noThrow If set to false, function will throw exceptions. If set to true, exceptions will be blocked, an MITK_ERROR will be notified and the return is 0.0.*/
MITKMODELFIT_EXPORT ModelTraitsInterface::ParameterValueType ReadVoxel(const mitk::Image* image,
const mitk::Point3D& position, unsigned int timestep = 0, bool noThrow = true);
/** Helper function that gets the voxel value (as double) of an image (given an image index and a time step).
Function is used in different contexts of model fit view.
+ @param image
+ @param index
+ @param timestep
@param noThrow If set to false, function will throw exceptions.If set to true, exceptions will be blocked, an MITK_ERROR will be notified and the return is 0.0. */
MITKMODELFIT_EXPORT ModelTraitsInterface::ParameterValueType ReadVoxel(const mitk::Image* image,
const ::itk::Index<3>& index, unsigned int timestep = 0, bool noThrow = true);
using ParameterValueMapType = std::map<ModelTraitsInterface::ParameterNameType, double>;
/** Helper function that extracts a map (keys are the parameter names, values are the associated parameter values)
of parameter values for the specified 3D point given a model fit info instance.
@pre fit must point to a valid instance.
*/
MITKMODELFIT_EXPORT ParameterValueMapType ExtractParameterValueMapFromModelFit(const mitk::modelFit::ModelFitInfo* fitInfo,
const mitk::Point3D& position);
MITKMODELFIT_EXPORT ParameterValueMapType ExtractParameterValueMapFromModelFit(const mitk::modelFit::ModelFitInfo* fitInfo,
const ::itk::Index<3>& index);
/** Helper function that converts a parameter value map (like returned by ExtractParameterValueMapFromModelFit() into the ParametersType.
the ordering will be deduced with the help of the passed trait interface.
@pre pTraitInterface must point to a valid instance.
@pre valueMap must contain all parameter names of pTraitsInterface*/
MITKMODELFIT_EXPORT ModelTraitsInterface::ParametersType
ConvertParameterMapToParameterVector(const ParameterValueMapType &valueMap, const ModelTraitsInterface * pTraitInterface);
}
#endif
diff --git a/Modules/ModelFit/include/mitkModelFitStaticParameterMap.h b/Modules/ModelFit/include/mitkModelFitStaticParameterMap.h
index ab8bf7e9c9..170f08326e 100644
--- a/Modules/ModelFit/include/mitkModelFitStaticParameterMap.h
+++ b/Modules/ModelFit/include/mitkModelFitStaticParameterMap.h
@@ -1,146 +1,146 @@
/*============================================================================
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 mitkModelFitStaticParameterMap_h
#define mitkModelFitStaticParameterMap_h
#include <vector>
#include <string>
#include <map>
#include "MitkModelFitExports.h"
#include "mitkModelBase.h"
namespace mitk
{
namespace modelFit
{
/** Data structure that is used to store information about the static parameters of a model fit*/
class MITKMODELFIT_EXPORT StaticParameterMap
{
private:
/** @brief Type of the map key */
typedef ModelBase::ParameterNameType KeyType;
public:
/** @brief Type of the map value */
typedef ModelBase::StaticParameterValuesType ValueType;
/** @brief Type of a variable, consisting of name and value list */
typedef std::pair<KeyType, ValueType> StaticParameterType;
private:
/** @brief Type of the map */
typedef ModelBase::StaticParameterMapType MapType;
/* @brief Stores the variables with their value lists */
MapType m_map;
/**
* @brief Stores the number of values that each list (which contains more than one
* value) contains.
*/
unsigned int m_numValues;
public:
/** @brief Needed for 'foreach' support */
typedef MapType::const_iterator const_iterator;
StaticParameterMap() : m_numValues(1) {}
/**
* @brief Adds the given value list under the given variable name if the name
* doesn't exist already. If it does exist, nothing is added.
* @pre The given list must contain either 1 or n values, where n is the
* amount of values that lists contain which are already part of the
* map (and contain more than one value). That means if the map is
* empty or contains only lists that have only one value each, this
* rule doesn't apply. An exception is thrown otherwise.
* @param name The name of the variable to which the values should be added.
* @param newList The value list that should be added.
* @throw ModelFitException If the given list contains an amount of values that is
* greater than 1 and doesn't match the amount of values
* of the lists that are already part of the map (see
* pre-condition).
*/
void Add(const std::string& name, const ValueType& newList);
/**
* @brief Returns the values of the given variable name.
* @param name The name of the variables whose values should be returned.
* @return The values of the given variable name.
* @throw std::range_error If the variable name doesn't exist.
*/
const ValueType& Get(const std::string& name) const;
MapType::size_type Size() const
{
return m_map.size();
}
const_iterator begin() const
{
return m_map.begin();
}
const_iterator end() const
{
return m_map.end();
}
/**
* @brief Sorts the values of the given variable name in ascending order. The
* values of all other variables will also be switched in that specific
* order. If name is empty or the variable could not be found, the map is
* ordered by the first variable that contains more than one value (also in
* ascending order).
* @details Example:
- * <li>Before sorting:
- * "A": [3, 2, 5, 1, 4]
- * "B": [0]
- * "C": [3, 4, 1, 5, 2]
- * <li>Sort():
- * "A": [1, 2, 3, 4, 5]
- * "B": [0]
- * "C": [5, 4, 3, 2, 1]
- * <li>Sort("B"):
- * "A": [5, 4, 3, 2, 1]
- * "B": [0]
- * "C": [1, 2, 3, 4, 5]
- * <li>Sort("X"):
- * "A": [1, 2, 3, 4, 5]
- * "B": [0]
- * "C": [5, 4, 3, 2, 1]
+ * - Before sorting:
+ * - "A": [3, 2, 5, 1, 4]
+ * - "B": [0]
+ * - "C": [3, 4, 1, 5, 2]
+ * - Sort():
+ * - "A": [1, 2, 3, 4, 5]
+ * - "B": [0]
+ * - "C": [5, 4, 3, 2, 1]
+ * - Sort("B"):
+ * - "A": [5, 4, 3, 2, 1]
+ * - "B": [0]
+ * - "C": [1, 2, 3, 4, 5]
+ * - Sort("X"):
+ * - "A": [1, 2, 3, 4, 5]
+ * - "B": [0]
+ * - "C": [5, 4, 3, 2, 1]
* @param name The name of the variable the map should be sorted by.
*/
void Sort(const std::string& name = "");
/**
* @brief Resets the map, so it's empty.
*/
void Clear();
};
/**
* @brief Compares two var lists and returns true if the first list's first item is
* lower than the second one's.
* @param a The first list to compare the other one to.
* @param b The other list to compare the first one to.
* @return True if the first list's first item is smaller than the second one's.
*/
inline bool operator<(const StaticParameterMap::ValueType& a, const StaticParameterMap::ValueType& b)
{
return (a.front() < b.front());
}
}
}
#endif // mitkModelFitStaticParameterMap_h
diff --git a/Modules/ModelFit/include/mitkTimeGridHelper.h b/Modules/ModelFit/include/mitkTimeGridHelper.h
index fba0b23e51..eb9c25150c 100644
--- a/Modules/ModelFit/include/mitkTimeGridHelper.h
+++ b/Modules/ModelFit/include/mitkTimeGridHelper.h
@@ -1,36 +1,37 @@
/*============================================================================
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 __MITK_TIME_GRID_HELPER_H_
#define __MITK_TIME_GRID_HELPER_H_
#include "mitkModelBase.h"
#include "MitkModelFitExports.h"
namespace mitk
{
/* Checks if the time grid is monotone increasing (timeGrid[n] <= timeGrid[n+1]).
* It is a precondition for the helper interpolate time grid.*/
MITKMODELFIT_EXPORT bool TimeGridIsMonotonIncreasing(const ModelBase::TimeGridType timeGrid);
/* Helper function that interpolates a passed signal to a new time grid.
* @pre The time grids must be monotone increasing. Use TimeGridIsMonotonIncreasing() to verify that.*/
MITKMODELFIT_EXPORT ModelBase::ModelResultType InterpolateSignalToNewTimeGrid(const ModelBase::ModelResultType& inputSignal, const ModelBase::TimeGridType& inputGrid, const ModelBase::TimeGridType& outputGrid);
/** Super sample passed time grid by a given supersampling rate and interpolates linear in between original time steps.
+ * @param grid
* @param samplingRate Defines how many samples should be generated between to original time steps (including the preceeding time step). E.g. a sampling rate of 1 will just returns the original grid untouched;
a sampling rate of 3 will generate to aditional steps between to original steps.*/
MITKMODELFIT_EXPORT ModelBase::TimeGridType GenerateSupersampledTimeGrid(const mitk::ModelBase::TimeGridType& grid, const unsigned int samplingRate);
}
#endif
diff --git a/Modules/ModelFitUI/Qmitk/QmitkInitialValuesManagerWidget.h b/Modules/ModelFitUI/Qmitk/QmitkInitialValuesManagerWidget.h
index a0bbb3a33c..1592cad2d6 100644
--- a/Modules/ModelFitUI/Qmitk/QmitkInitialValuesManagerWidget.h
+++ b/Modules/ModelFitUI/Qmitk/QmitkInitialValuesManagerWidget.h
@@ -1,84 +1,84 @@
/*============================================================================
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 QMITK_INITIAL_VALUES_MANAGER_WIDGET_H
#define QMITK_INITIAL_VALUES_MANAGER_WIDGET_H
#include "MitkModelFitUIExports.h"
#include "ui_QmitkInitialValuesManagerWidget.h"
#include <QWidget>
#include "mitkModelTraitsInterface.h"
#include "mitkInitialParameterizationDelegateBase.h"
/*forward declarations*/
class QmitkInitialValuesModel;
class QmitkInitialValuesTypeDelegate;
class QmitkInitialValuesDelegate;
namespace mitk
{
class DataStorage;
class BaseGeometry;
}
/**
* \class QmitkInitialValuesManagerWidget
* \brief Widget that allows to edit the initial values of an model.
*/
class MITKMODELFITUI_EXPORT QmitkInitialValuesManagerWidget : public QWidget
{
Q_OBJECT
public:
QmitkInitialValuesManagerWidget(QWidget* parent = nullptr);
~QmitkInitialValuesManagerWidget() override;
/** Returns the current set initial values of the model.*/
mitk::ModelTraitsInterface::ParametersType getInitialValues() const;
mitk::InitialParameterizationDelegateBase::Pointer getInitialParametrizationDelegate() const;
bool hasValidInitialValues() const;
signals:
void initialValuesChanged();
public Q_SLOTS:
/** Sets the names and the values of the initial parameter set for the model.
@param names List of all possible parameter names. It is assumed that the
index of the list equals the parameter index in the respective fitting model and its parameter values.
- @values Default values to start with.*/
+ @param values Default values to start with.*/
void setInitialValues(const mitk::ModelTraitsInterface::ParameterNamesType& names,
const mitk::ModelTraitsInterface::ParametersType values);
void setInitialValues(const mitk::ModelTraitsInterface::ParameterNamesType& names);
void setDataStorage(mitk::DataStorage* storage);
void setReferenceImageGeometry(mitk::BaseGeometry* refgeo);
protected:
QmitkInitialValuesModel* m_InternalModel;
QmitkInitialValuesTypeDelegate* m_TypeDelegate;
QmitkInitialValuesDelegate* m_ValuesDelegate;
Ui::QmitkInitialValuesManagerWidget m_Controls;
protected Q_SLOTS:
void OnModelReset();
};
#endif // QmitkInitialValuesManagerWidget_H
diff --git a/Modules/ModelFitUI/Qmitk/QmitkInitialValuesModel.h b/Modules/ModelFitUI/Qmitk/QmitkInitialValuesModel.h
index bb4bd15456..b3dc1a17e6 100644
--- a/Modules/ModelFitUI/Qmitk/QmitkInitialValuesModel.h
+++ b/Modules/ModelFitUI/Qmitk/QmitkInitialValuesModel.h
@@ -1,94 +1,94 @@
/*============================================================================
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 QmitkInitialValuesModel_h
#define QmitkInitialValuesModel_h
#include <QAbstractTableModel>
#include "mitkSimpleBarrierConstraintChecker.h"
#include "mitkModelTraitsInterface.h"
#include "mitkDataNode.h"
#include "mitkInitialParameterizationDelegateBase.h"
#include "MitkModelFitUIExports.h"
/*!
\class QmitkInitialValuesModel
Model that handles the definition of inital model values.
*/
class MITKMODELFITUI_EXPORT QmitkInitialValuesModel : public QAbstractTableModel
{
Q_OBJECT
public:
QmitkInitialValuesModel(QObject* parent = nullptr);
~QmitkInitialValuesModel() override {};
/** Sets the names and the values of the initial parameter set for the model.
@param names List of all possible parameter names. It is assumed that the
index of the list equals the parameter index in the respective fitting model and its parameter values.
- @values Default values to start with.*/
+ @param values Default values to start with.*/
void setInitialValues(const mitk::ModelTraitsInterface::ParameterNamesType& names,
const mitk::ModelTraitsInterface::ParametersType values);
/**@overload
Convinience method that sets the default initial values always to zero.*/
void setInitialValues(const mitk::ModelTraitsInterface::ParameterNamesType& names);
/** Adds an image as a source for the initial value of a parameter.
* @param node Pointer to the image that is the value source.
* @param paramIndex Indicates which parameter is defined by the source image.
* It equals the position of the vector defined by setInitialValues().
* @remark setting an image for an index overwrites the value for this index set by
* SetInitialParameterization.
* @pre paramIndex must be in bound of the initial parametrization vector.
* @pre node must be a valid image instance*/
void addInitialParameterImage(const mitk::DataNode* node, mitk::ModelTraitsInterface::ParametersType::size_type paramIndex);
bool hasValidInitialValues() const;
void resetInitialParameterImage();
/** Returns a pointer to a delegate instance that represents the parameterization of the model.*/
mitk::InitialParameterizationDelegateBase::Pointer getInitialParametrizationDelegate() const;
/** Returns the current set initial values of the model.
- * @Remark: this are only the simpel scalar initial values. If an source image was set, this is missed here.
+ * @remark this are only the simpel scalar initial values. If an source image was set, this is missed here.
* Use getInitialParametrizationDelegate() to get everything at once.*/
mitk::ModelTraitsInterface::ParametersType getInitialValues() const;
Qt::ItemFlags flags(const QModelIndex& index) const override;
QVariant data(const QModelIndex& index, int role) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
bool setData(const QModelIndex& index, const QVariant& value, int role = Qt::EditRole) override;
/**Indicates if the content of the model was modified since the data was set via setInitialValues()*/
bool isModified();
private:
int valueType(const QModelIndex& index) const;
mitk::ModelTraitsInterface::ParametersType m_Values;
mitk::ModelTraitsInterface::ParameterNamesType m_ParameterNames;
typedef std::map<mitk::ModelTraitsInterface::ParametersType::size_type, mitk::DataNode::ConstPointer> ImageMapType;
ImageMapType m_ParameterImageMap;
/** Indicates if the data of the model was modified, since the model was set. */
bool m_modified;
};
#endif // QmitkInitialValuesModel_h
diff --git a/Modules/Multilabel/Testing/mitkLabelSetImageTest.cpp b/Modules/Multilabel/Testing/mitkLabelSetImageTest.cpp
index 8adf13414b..8637823ce0 100644
--- a/Modules/Multilabel/Testing/mitkLabelSetImageTest.cpp
+++ b/Modules/Multilabel/Testing/mitkLabelSetImageTest.cpp
@@ -1,444 +1,435 @@
/*============================================================================
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 <mitkIOUtil.h>
#include <mitkImageStatisticsHolder.h>
#include <mitkLabelSetImage.h>
#include <mitkTestFixture.h>
#include <mitkTestingMacros.h>
class mitkLabelSetImageTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkLabelSetImageTestSuite);
MITK_TEST(TestInitialize);
MITK_TEST(TestAddLayer);
MITK_TEST(TestGetActiveLabelSet);
MITK_TEST(TestGetActiveLabel);
MITK_TEST(TestInitializeByLabeledImage);
MITK_TEST(TestGetLabelSet);
MITK_TEST(TestGetLabel);
MITK_TEST(TestSetExteriorLabel);
MITK_TEST(TestGetTotalNumberOfLabels);
MITK_TEST(TestExistsLabel);
MITK_TEST(TestExistsLabelSet);
MITK_TEST(TestSetActiveLayer);
MITK_TEST(TestRemoveLayer);
MITK_TEST(TestRemoveLabels);
MITK_TEST(TestMergeLabel);
- // TODO check it these functionalities can be moved into a process object
- // MITK_TEST(TestMergeLabels);
- // MITK_TEST(TestConcatenate);
- // MITK_TEST(TestClearBuffer);
- // MITK_TEST(TestUpdateCenterOfMass);
- // MITK_TEST(TestGetVectorImage);
- // MITK_TEST(TestSetVectorImage);
- // MITK_TEST(TestGetLayerImage);
CPPUNIT_TEST_SUITE_END();
private:
mitk::LabelSetImage::Pointer m_LabelSetImage;
public:
void setUp() override
{
// Create a new labelset image
m_LabelSetImage = mitk::LabelSetImage::New();
mitk::Image::Pointer regularImage = mitk::Image::New();
- unsigned int dimensions[3] = {256, 256, 312};
- regularImage->Initialize(mitk::MakeScalarPixelType<int>(), 3, dimensions);
+ unsigned int dimensions[3] = { 96, 128, 52 };
+ regularImage->Initialize(mitk::MakeScalarPixelType<char>(), 3, dimensions);
m_LabelSetImage->Initialize(regularImage);
}
void tearDown() override
{
// Delete LabelSetImage
m_LabelSetImage = nullptr;
}
- // Reduce contours with nth point
void TestInitialize()
{
// LabelSet image should always has the pixel type mitk::Label::PixelType
CPPUNIT_ASSERT_MESSAGE("LabelSetImage has wrong pixel type",
m_LabelSetImage->GetPixelType() == mitk::MakeScalarPixelType<mitk::Label::PixelType>());
mitk::Image::Pointer regularImage = mitk::Image::New();
- unsigned int dimensions[3] = {256, 256, 312};
- regularImage->Initialize(mitk::MakeScalarPixelType<int>(), 3, dimensions);
+ unsigned int dimensions[3] = { 96, 128, 52 };
+ regularImage->Initialize(mitk::MakeScalarPixelType<char>(), 3, dimensions);
mitk::BaseGeometry::Pointer regularImageGeo = regularImage->GetGeometry();
mitk::BaseGeometry::Pointer labelImageGeo = m_LabelSetImage->GetGeometry();
MITK_ASSERT_EQUAL(labelImageGeo, regularImageGeo, "LabelSetImage has wrong geometry");
// By default one layer containing the exterior label should be added
CPPUNIT_ASSERT_MESSAGE("Image was not correctly initialized - number of layers is not one",
m_LabelSetImage->GetNumberOfLayers() == 1);
CPPUNIT_ASSERT_MESSAGE("Image was not correctly initialized - active layer has wrong ID",
m_LabelSetImage->GetActiveLayer() == 0);
CPPUNIT_ASSERT_MESSAGE("Image was not correctly initialized - active label is not the exterior label",
m_LabelSetImage->GetActiveLabel()->GetValue() == 0);
}
void TestAddLayer()
{
CPPUNIT_ASSERT_MESSAGE("Number of layers is not zero", m_LabelSetImage->GetNumberOfLayers() == 1);
m_LabelSetImage->AddLayer();
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - number of layers is not one",
m_LabelSetImage->GetNumberOfLayers() == 2);
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - active layer has wrong ID",
m_LabelSetImage->GetActiveLayer() == 1);
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - active label is not the exterior label",
m_LabelSetImage->GetActiveLabel()->GetValue() == 0);
mitk::LabelSet::Pointer newlayer = mitk::LabelSet::New();
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
label1->SetValue(1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
label2->SetValue(200);
newlayer->AddLabel(label1);
newlayer->AddLabel(label2);
newlayer->SetActiveLabel(200);
unsigned int layerID = m_LabelSetImage->AddLayer(newlayer);
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - number of layers is not two",
m_LabelSetImage->GetNumberOfLayers() == 3);
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - active layer has wrong ID",
m_LabelSetImage->GetActiveLayer() == layerID);
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - active label is wrong",
m_LabelSetImage->GetActiveLabel(layerID)->GetValue() == 200);
}
void TestGetActiveLabelSet()
{
mitk::LabelSet::Pointer newlayer = mitk::LabelSet::New();
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
label1->SetValue(1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
label2->SetValue(200);
newlayer->AddLabel(label1);
newlayer->AddLabel(label2);
newlayer->SetActiveLabel(200);
unsigned int layerID = m_LabelSetImage->AddLayer(newlayer);
mitk::LabelSet::Pointer activeLayer = m_LabelSetImage->GetActiveLabelSet();
CPPUNIT_ASSERT_MESSAGE("Wrong layer ID was returned", layerID == 1);
CPPUNIT_ASSERT_MESSAGE("Wrong active labelset returned", mitk::Equal(*newlayer, *activeLayer, 0.00001, true));
}
void TestGetActiveLabel()
{
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
mitk::Label::PixelType value1 = 1;
label1->SetValue(value1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
mitk::Label::PixelType value2 = 200;
label2->SetValue(value2);
m_LabelSetImage->GetActiveLabelSet()->AddLabel(label1);
m_LabelSetImage->GetActiveLabelSet()->AddLabel(label2);
m_LabelSetImage->GetActiveLabelSet()->SetActiveLabel(1);
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - active label is wrong",
m_LabelSetImage->GetActiveLabel()->GetValue() == value1);
m_LabelSetImage->GetActiveLabelSet()->SetActiveLabel(value2);
CPPUNIT_ASSERT_MESSAGE("Layer was not added correctly to image - active label is wrong",
m_LabelSetImage->GetActiveLabel()->GetValue() == value2);
}
void TestInitializeByLabeledImage()
{
mitk::Image::Pointer image =
mitk::IOUtil::Load<mitk::Image>(GetTestDataFilePath("Multilabel/LabelSetTestInitializeImage.nrrd"));
m_LabelSetImage->InitializeByLabeledImage(image);
CPPUNIT_ASSERT_MESSAGE("Image - number of labels is not 6", m_LabelSetImage->GetNumberOfLabels() == 6);
}
void TestGetLabelSet()
{
// Test get non existing lset
mitk::LabelSet::ConstPointer lset = m_LabelSetImage->GetLabelSet(10000);
CPPUNIT_ASSERT_MESSAGE("Non existing labelset is not nullptr", lset.IsNull());
lset = m_LabelSetImage->GetLabelSet(0);
CPPUNIT_ASSERT_MESSAGE("Existing labelset is nullptr", lset.IsNotNull());
}
void TestGetLabel()
{
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
mitk::Label::PixelType value1 = 1;
label1->SetValue(value1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
mitk::Label::PixelType value2 = 200;
label2->SetValue(value2);
m_LabelSetImage->GetActiveLabelSet()->AddLabel(label1);
m_LabelSetImage->AddLayer();
m_LabelSetImage->GetLabelSet(1)->AddLabel(label2);
CPPUNIT_ASSERT_MESSAGE("Wrong label retrieved for active layer",
mitk::Equal(*m_LabelSetImage->GetLabel(1), *label1, 0.0001, true));
CPPUNIT_ASSERT_MESSAGE("Wrong label retrieved for layer 1",
mitk::Equal(*m_LabelSetImage->GetLabel(200, 1), *label2, 0.0001, true));
// Try to get a non existing label
mitk::Label *label3 = m_LabelSetImage->GetLabel(1000);
CPPUNIT_ASSERT_MESSAGE("Non existing label should be nullptr", label3 == nullptr);
// Try to get a label from a non existing layer
label3 = m_LabelSetImage->GetLabel(200, 1000);
CPPUNIT_ASSERT_MESSAGE("Label from non existing layer should be nullptr", label3 == nullptr);
}
void TestSetExteriorLabel()
{
mitk::Label::Pointer exteriorLabel = mitk::Label::New();
exteriorLabel->SetName("MyExteriorSpecialLabel");
mitk::Label::PixelType value1 = 10000;
exteriorLabel->SetValue(value1);
m_LabelSetImage->SetExteriorLabel(exteriorLabel);
CPPUNIT_ASSERT_MESSAGE("Wrong label retrieved for layer 1",
mitk::Equal(*m_LabelSetImage->GetExteriorLabel(), *exteriorLabel, 0.0001, true));
// Exterior label should be set automatically for each new layer
m_LabelSetImage->AddLayer();
CPPUNIT_ASSERT_MESSAGE("Wrong label retrieved for layer 1",
mitk::Equal(*m_LabelSetImage->GetLabel(10000, 1), *exteriorLabel, 0.0001, true));
}
void TestGetTotalNumberOfLabels()
{
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
mitk::Label::PixelType value1 = 1;
label1->SetValue(value1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
mitk::Label::PixelType value2 = 200;
label2->SetValue(value2);
m_LabelSetImage->GetActiveLabelSet()->AddLabel(label1);
m_LabelSetImage->AddLayer();
m_LabelSetImage->GetLabelSet(1)->AddLabel(label2);
CPPUNIT_ASSERT_MESSAGE(
"Wrong total number of labels",
m_LabelSetImage->GetTotalNumberOfLabels() == 4); // added 2 labels + 2 exterior default labels
}
void TestExistsLabel()
{
mitk::Label::Pointer label = mitk::Label::New();
label->SetName("Label2");
mitk::Label::PixelType value = 200;
label->SetValue(value);
m_LabelSetImage->AddLayer();
m_LabelSetImage->GetLabelSet(1)->AddLabel(label);
m_LabelSetImage->SetActiveLayer(0);
CPPUNIT_ASSERT_MESSAGE("Existing label was not found", m_LabelSetImage->ExistLabel(value) == true);
CPPUNIT_ASSERT_MESSAGE("Non existing label was found", m_LabelSetImage->ExistLabel(10000) == false);
}
void TestExistsLabelSet()
{
// Cache active layer
mitk::LabelSet::ConstPointer activeLayer = m_LabelSetImage->GetActiveLabelSet();
// Add new layer
mitk::LabelSet::Pointer newlayer = mitk::LabelSet::New();
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
label1->SetValue(1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
label2->SetValue(200);
newlayer->AddLabel(label1);
newlayer->AddLabel(label2);
newlayer->SetActiveLabel(200);
m_LabelSetImage->AddLayer(newlayer);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed", m_LabelSetImage->ExistLabelSet(0) == true);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed", m_LabelSetImage->ExistLabelSet(1) == true);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed", m_LabelSetImage->ExistLabelSet(20) == false);
}
void TestSetActiveLayer()
{
// Cache active layer
mitk::LabelSet::ConstPointer activeLayer = m_LabelSetImage->GetActiveLabelSet();
// Add new layer
mitk::LabelSet::Pointer newlayer = mitk::LabelSet::New();
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
label1->SetValue(1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
label2->SetValue(200);
newlayer->AddLabel(label1);
newlayer->AddLabel(label2);
newlayer->SetActiveLabel(200);
unsigned int layerID = m_LabelSetImage->AddLayer(newlayer);
// Set initial layer as active layer
m_LabelSetImage->SetActiveLayer(0);
CPPUNIT_ASSERT_MESSAGE("Wrong active labelset returned",
mitk::Equal(*activeLayer, *m_LabelSetImage->GetActiveLabelSet(), 0.00001, true));
// Set previously added layer as active layer
m_LabelSetImage->SetActiveLayer(layerID);
CPPUNIT_ASSERT_MESSAGE("Wrong active labelset returned",
mitk::Equal(*newlayer, *m_LabelSetImage->GetActiveLabelSet(), 0.00001, true));
// Set a non existing layer as active layer - nothing should change
m_LabelSetImage->SetActiveLayer(10000);
CPPUNIT_ASSERT_MESSAGE("Wrong active labelset returned",
mitk::Equal(*newlayer, *m_LabelSetImage->GetActiveLabelSet(), 0.00001, true));
}
void TestRemoveLayer()
{
// Cache active layer
mitk::LabelSet::ConstPointer activeLayer = m_LabelSetImage->GetActiveLabelSet();
// Add new layers
m_LabelSetImage->AddLayer();
mitk::LabelSet::Pointer newlayer = mitk::LabelSet::New();
mitk::Label::Pointer label1 = mitk::Label::New();
label1->SetName("Label1");
label1->SetValue(1);
mitk::Label::Pointer label2 = mitk::Label::New();
label2->SetName("Label2");
label2->SetValue(200);
newlayer->AddLabel(label1);
newlayer->AddLabel(label2);
newlayer->SetActiveLabel(200);
m_LabelSetImage->AddLayer(newlayer);
CPPUNIT_ASSERT_MESSAGE("Wrong active labelset returned",
mitk::Equal(*newlayer, *m_LabelSetImage->GetActiveLabelSet(), 0.00001, true));
m_LabelSetImage->RemoveLayer();
CPPUNIT_ASSERT_MESSAGE("Wrong number of layers, after a layer was removed",
m_LabelSetImage->GetNumberOfLayers() == 2);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed", m_LabelSetImage->ExistLabelSet(2) == false);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed", m_LabelSetImage->ExistLabelSet(1) == true);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed", m_LabelSetImage->ExistLabelSet(0) == true);
m_LabelSetImage->RemoveLayer();
CPPUNIT_ASSERT_MESSAGE("Wrong number of layers, after a layer was removed",
m_LabelSetImage->GetNumberOfLayers() == 1);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed", m_LabelSetImage->ExistLabelSet(1) == false);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed", m_LabelSetImage->ExistLabelSet(0) == true);
CPPUNIT_ASSERT_MESSAGE("Wrong active layer",
mitk::Equal(*activeLayer, *m_LabelSetImage->GetActiveLabelSet(), 0.00001, true));
m_LabelSetImage->RemoveLayer();
CPPUNIT_ASSERT_MESSAGE("Wrong number of layers, after a layer was removed",
m_LabelSetImage->GetNumberOfLayers() == 0);
CPPUNIT_ASSERT_MESSAGE("Check for existing layer failed", m_LabelSetImage->ExistLabelSet(0) == false);
CPPUNIT_ASSERT_MESSAGE("Active layers is not nullptr although all layer have been removed",
m_LabelSetImage->GetActiveLabelSet() == nullptr);
}
void TestRemoveLabels()
{
mitk::Image::Pointer image =
mitk::IOUtil::Load<mitk::Image>(GetTestDataFilePath("Multilabel/LabelSetTestInitializeImage.nrrd"));
m_LabelSetImage->InitializeByLabeledImage(image);
CPPUNIT_ASSERT_MESSAGE("Image - number of labels is not 6", m_LabelSetImage->GetNumberOfLabels() == 6);
// 2ndMin because of the exterior label = 0
CPPUNIT_ASSERT_MESSAGE("Labels with value 1 and 3 was not remove from the image",
m_LabelSetImage->GetStatistics()->GetScalarValue2ndMin() == 1);
CPPUNIT_ASSERT_MESSAGE("Label with value 7 was not remove from the image",
m_LabelSetImage->GetStatistics()->GetScalarValueMax() == 7);
CPPUNIT_ASSERT_MESSAGE("Label with ID 3 does not exists after initialization",
m_LabelSetImage->ExistLabel(3) == true);
CPPUNIT_ASSERT_MESSAGE("Label with ID 7 does not exists after initialization",
m_LabelSetImage->ExistLabel(7) == true);
std::vector<mitk::Label::PixelType> labelsToBeRemoved;
labelsToBeRemoved.push_back(1);
labelsToBeRemoved.push_back(3);
labelsToBeRemoved.push_back(7);
m_LabelSetImage->RemoveLabels(labelsToBeRemoved);
CPPUNIT_ASSERT_MESSAGE("Wrong number of labels after some have been removed",
m_LabelSetImage->GetNumberOfLabels() == 3);
// Values within the image are 0, 1, 3, 5, 6, 7 - New Min/Max value should be 5 / 6
// 2ndMin because of the exterior label = 0
CPPUNIT_ASSERT_MESSAGE("Labels with value 1 and 3 was not remove from the image",
m_LabelSetImage->GetStatistics()->GetScalarValue2ndMin() == 5);
CPPUNIT_ASSERT_MESSAGE("Label with value 7 was not remove from the image",
m_LabelSetImage->GetStatistics()->GetScalarValueMax() == 6);
}
void TestMergeLabel()
{
mitk::Image::Pointer image = mitk::IOUtil::Load<mitk::Image>(GetTestDataFilePath("Multilabel/LabelSetTestInitializeImage.nrrd"));
m_LabelSetImage = nullptr;
m_LabelSetImage = mitk::LabelSetImage::New();
m_LabelSetImage->InitializeByLabeledImage(image);
CPPUNIT_ASSERT_MESSAGE("Image - number of labels is not 6", m_LabelSetImage->GetNumberOfLabels() == 6);
// 2ndMin because of the exterior label = 0
CPPUNIT_ASSERT_MESSAGE("Wrong MIN value", m_LabelSetImage->GetStatistics()->GetScalarValueMin() == 0);
CPPUNIT_ASSERT_MESSAGE("Wrong MAX value", m_LabelSetImage->GetStatistics()->GetScalarValueMax() == 7);
m_LabelSetImage->GetActiveLabelSet()->SetActiveLabel(6);
// Merge label 7 with label 0. Result should be that label 7 is not present any more
m_LabelSetImage->MergeLabel(6, 7);
CPPUNIT_ASSERT_MESSAGE("Label with value 7 was not remove from the image", m_LabelSetImage->GetStatistics()->GetScalarValueMax() == 6);
m_LabelSetImage->GetStatistics()->GetScalarValue2ndMax();
// Count all pixels with value 7 = 823
// Count all pixels with value 6 = 507
// Check if merge label has 507 + 823 = 1330 pixels
CPPUNIT_ASSERT_MESSAGE("Label with value 7 was not remove from the image", m_LabelSetImage->GetStatistics()->GetCountOfMaxValuedVoxels() == 1330);
}
};
MITK_TEST_SUITE_REGISTRATION(mitkLabelSetImage)
diff --git a/Modules/Multilabel/Testing/mitkLabelSetTest.cpp b/Modules/Multilabel/Testing/mitkLabelSetTest.cpp
index e170361698..d4c71fc23e 100644
--- a/Modules/Multilabel/Testing/mitkLabelSetTest.cpp
+++ b/Modules/Multilabel/Testing/mitkLabelSetTest.cpp
@@ -1,177 +1,170 @@
/*============================================================================
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 <mitkLabelSet.h>
#include <mitkLabelSetImage.h>
#include <mitkStringProperty.h>
#include <mitkTestFixture.h>
#include <mitkTestingMacros.h>
class mitkLabelSetTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkLabelSetTestSuite);
MITK_TEST(TestSetLayer);
MITK_TEST(TestSetActiveLabel);
MITK_TEST(TestRemoveLabel);
MITK_TEST(TestAddLabel);
MITK_TEST(TestRenameLabel);
MITK_TEST(TestSetAllLabelsVisible);
MITK_TEST(TestSetAllLabelsLocked);
MITK_TEST(TestRemoveAllLabels);
CPPUNIT_TEST_SUITE_END();
private:
mitk::LabelSet::Pointer m_LabelSet;
mitk::LabelSet::PixelType m_InitialNumberOfLabels;
void AddLabels(mitk::LabelSet::PixelType numOfLabels)
{
+ mitk::Label::Pointer label;
+ const std::string namePrefix = "Label_";
+ const mitk::Color gray(0.5f);
+
for (mitk::Label::PixelType i = 0; i < numOfLabels; ++i)
{
- mitk::Label::Pointer label = mitk::Label::New();
- std::stringstream nameStream;
- nameStream << "Label_";
- nameStream << i;
- label->SetName(nameStream.str());
+ label = mitk::Label::New();
+ label->SetName(namePrefix + std::to_string(i));
label->SetValue(i);
- label->SetVisible((i % 20 == 0));
- label->SetLayer(i % 5);
- mitk::Color color;
- color.Set(0.3f, 0.25f, 1.0f);
- label->SetColor(color);
+ label->SetVisible((i % 2 == 0));
+ label->SetLayer(i % 3);
+ label->SetColor(gray);
m_LabelSet->AddLabel(label);
}
}
public:
void setUp() override
{
- m_InitialNumberOfLabels = 200;
+ m_InitialNumberOfLabels = 6;
m_LabelSet = mitk::LabelSet::New();
this->AddLabels(m_InitialNumberOfLabels);
m_LabelSet->SetLayer(0);
m_LabelSet->SetActiveLabel(0);
}
void tearDown() override
{
- // Reset label set
m_LabelSet = nullptr;
}
void TestSetLayer()
{
CPPUNIT_ASSERT_MESSAGE("Wrong initial layer", m_LabelSet->GetLayer() == 0);
- m_LabelSet->SetLayer(3);
- CPPUNIT_ASSERT_MESSAGE("Wrong layer", m_LabelSet->GetLayer() == 3);
+
+ m_LabelSet->SetLayer(1);
+ CPPUNIT_ASSERT_MESSAGE("Wrong layer", m_LabelSet->GetLayer() == 1);
}
void TestSetActiveLabel()
{
CPPUNIT_ASSERT_MESSAGE("Wrong initial active label", m_LabelSet->GetActiveLabel()->GetValue() == 0);
- m_LabelSet->SetActiveLabel(145);
- CPPUNIT_ASSERT_MESSAGE("Wrong layer", m_LabelSet->GetActiveLabel()->GetValue() == 145);
+
+ m_LabelSet->SetActiveLabel(1);
+ CPPUNIT_ASSERT_MESSAGE("Wrong layer", m_LabelSet->GetActiveLabel()->GetValue() == 1);
}
void TestRemoveLabel()
{
- CPPUNIT_ASSERT_MESSAGE("Wrong initial number of label",
- static_cast<unsigned short>(m_LabelSet->GetNumberOfLabels()) == m_InitialNumberOfLabels);
+ CPPUNIT_ASSERT_MESSAGE("Wrong initial number of label", m_LabelSet->GetNumberOfLabels() == m_InitialNumberOfLabels);
// Remove a label that is not the active label
- m_LabelSet->SetActiveLabel(12);
- m_LabelSet->RemoveLabel(56);
- unsigned int numLabels = m_InitialNumberOfLabels - 1;
- CPPUNIT_ASSERT_MESSAGE("Label was not removed", m_LabelSet->ExistLabel(56) == false);
+ m_LabelSet->SetActiveLabel(2);
+ m_LabelSet->RemoveLabel(1);
+
+ mitk::LabelSet::PixelType numLabels = m_InitialNumberOfLabels - 1;
+
+ CPPUNIT_ASSERT_MESSAGE("Label was not removed", m_LabelSet->ExistLabel(1) == false);
CPPUNIT_ASSERT_MESSAGE("Wrong number of label", m_LabelSet->GetNumberOfLabels() == numLabels);
- CPPUNIT_ASSERT_MESSAGE("Wrong active label", m_LabelSet->GetActiveLabel()->GetValue() == 12);
+ CPPUNIT_ASSERT_MESSAGE("Wrong active label", m_LabelSet->GetActiveLabel()->GetValue() == 2);
// Remove active label - now the succeeding label should be active
- m_LabelSet->RemoveLabel(12);
- CPPUNIT_ASSERT_MESSAGE("Wrong layer", m_LabelSet->GetActiveLabel()->GetValue() == 13);
- CPPUNIT_ASSERT_MESSAGE("Label was not removed", m_LabelSet->ExistLabel(12) == false);
- numLabels = m_InitialNumberOfLabels - 2;
- CPPUNIT_ASSERT_MESSAGE("Wrong initial number of label", m_LabelSet->GetNumberOfLabels() == numLabels);
+ m_LabelSet->RemoveLabel(2);
+ CPPUNIT_ASSERT_MESSAGE("Wrong layer", m_LabelSet->GetActiveLabel()->GetValue() == 3);
+ CPPUNIT_ASSERT_MESSAGE("Label was not removed", m_LabelSet->ExistLabel(2) == false);
+ CPPUNIT_ASSERT_MESSAGE("Wrong initial number of label", m_LabelSet->GetNumberOfLabels() == --numLabels);
}
void TestAddLabel()
{
- CPPUNIT_ASSERT_MESSAGE("Wrong initial number of label", m_LabelSet->GetNumberOfLabels() == m_InitialNumberOfLabels);
- mitk::Label::Pointer newLabel = mitk::Label::New();
- newLabel->SetValue(199);
+ auto newLabel = mitk::Label::New();
+ newLabel->SetValue(1);
m_LabelSet->AddLabel(newLabel);
- // Since label with value 199 already exists the new label will get the value 200
- CPPUNIT_ASSERT_MESSAGE("Wrong label value", m_LabelSet->GetActiveLabel()->GetValue() == 200);
- unsigned int numLabels = m_InitialNumberOfLabels + 1;
- CPPUNIT_ASSERT_MESSAGE("Wrong number of label", m_LabelSet->GetNumberOfLabels() == numLabels);
- // Add new labels until the maximum number of labels is reached.
- // Adding more labels should have no effect.
- this->AddLabels(mitk::Label::MAX_LABEL_VALUE);
- CPPUNIT_ASSERT_MESSAGE("Wrong number of label", m_LabelSet->GetNumberOfLabels() == 65536);
- mitk::Label *activeLabel = m_LabelSet->GetActiveLabel();
- CPPUNIT_ASSERT_MESSAGE("Wrong value of active label", activeLabel->GetValue() == mitk::Label::MAX_LABEL_VALUE);
+ // Since label with value 1 already exists the new label will get the value m_InitialNumberOfValues
+ CPPUNIT_ASSERT_MESSAGE("Wrong label value", m_LabelSet->GetActiveLabel()->GetValue() == m_InitialNumberOfLabels);
+ CPPUNIT_ASSERT_MESSAGE("Wrong number of label", m_LabelSet->GetNumberOfLabels() == static_cast<decltype(m_LabelSet->GetNumberOfLabels())>(m_InitialNumberOfLabels + 1));
}
void TestRenameLabel()
{
- mitk::Color color;
- color.Set(1.0f, 1.0f, 1.0f);
- std::string name("MyAwesomeLabel");
- m_LabelSet->RenameLabel(0, name, color);
- mitk::Label *label = m_LabelSet->GetLabel(0);
- CPPUNIT_ASSERT_MESSAGE("Wrong label name", label->GetName().compare("MyAwesomeLabel") == 0);
- mitk::Color color2 = label->GetColor();
- CPPUNIT_ASSERT_MESSAGE("Wrong color",
- (color2.GetBlue() == 1.0f && color2.GetGreen() == 1.0f && color2.GetRed() == 1.0f));
+ const mitk::Color white(1.0f);
+ const std::string name = "MyAwesomeLabel";
+
+ m_LabelSet->RenameLabel(0, name, white);
+
+ const auto* label = m_LabelSet->GetLabel(0);
+ CPPUNIT_ASSERT_MESSAGE("Wrong label name", label->GetName() == name );
+
+ const auto& color = label->GetColor();
+ CPPUNIT_ASSERT_MESSAGE("Wrong color", color == white);
}
void TestSetAllLabelsVisible()
{
+ const auto numLabels = static_cast<mitk::LabelSet::PixelType>(m_LabelSet->GetNumberOfLabels());
+
m_LabelSet->SetAllLabelsVisible(true);
- for (mitk::LabelSet::PixelType i = 0; i < m_LabelSet->GetNumberOfLabels(); ++i)
- {
+
+ for (mitk::LabelSet::PixelType i = 0; i < numLabels; ++i)
CPPUNIT_ASSERT_MESSAGE("Label not visible", m_LabelSet->GetLabel(i)->GetVisible() == true);
- }
m_LabelSet->SetAllLabelsVisible(false);
- for (mitk::LabelSet::PixelType i = 0; i < m_LabelSet->GetNumberOfLabels(); ++i)
- {
+
+ for (mitk::LabelSet::PixelType i = 0; i < numLabels; ++i)
CPPUNIT_ASSERT_MESSAGE("Label visible", m_LabelSet->GetLabel(i)->GetVisible() == false);
- }
}
void TestSetAllLabelsLocked()
{
+ const auto numLabels = static_cast<mitk::LabelSet::PixelType>(m_LabelSet->GetNumberOfLabels());
+
m_LabelSet->SetAllLabelsLocked(true);
- for (mitk::LabelSet::PixelType i = 0; i < m_LabelSet->GetNumberOfLabels(); ++i)
- {
+
+ for (mitk::LabelSet::PixelType i = 0; i < numLabels; ++i)
CPPUNIT_ASSERT_MESSAGE("Label not locked", m_LabelSet->GetLabel(i)->GetLocked() == true);
- }
m_LabelSet->SetAllLabelsLocked(false);
- for (mitk::LabelSet::PixelType i = 0; i < m_LabelSet->GetNumberOfLabels(); ++i)
- {
+
+ for (mitk::LabelSet::PixelType i = 0; i < numLabels; ++i)
CPPUNIT_ASSERT_MESSAGE("Label locked", m_LabelSet->GetLabel(i)->GetLocked() == false);
- }
}
void TestRemoveAllLabels()
{
m_LabelSet->RemoveAllLabels();
CPPUNIT_ASSERT_MESSAGE("Not all labels were removed", m_LabelSet->GetNumberOfLabels() == 0);
}
};
MITK_TEST_SUITE_REGISTRATION(mitkLabelSet)
diff --git a/Modules/Multilabel/mitkLabelSetImageVtkMapper2D.h b/Modules/Multilabel/mitkLabelSetImageVtkMapper2D.h
index 676305caf2..884388bfa9 100644
--- a/Modules/Multilabel/mitkLabelSetImageVtkMapper2D.h
+++ b/Modules/Multilabel/mitkLabelSetImageVtkMapper2D.h
@@ -1,241 +1,241 @@
/*============================================================================
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 __mitkLabelSetImageVtkMapper2D_H_
#define __mitkLabelSetImageVtkMapper2D_H_
// MITK
#include "MitkMultilabelExports.h"
#include "mitkCommon.h"
// MITK Rendering
#include "mitkBaseRenderer.h"
#include "mitkExtractSliceFilter.h"
#include "mitkLabelSetImage.h"
#include "mitkVtkMapper.h"
// VTK
#include <vtkSmartPointer.h>
class vtkActor;
class vtkPolyDataMapper;
class vtkPlaneSource;
class vtkImageData;
class vtkLookupTable;
class vtkImageReslice;
class vtkPoints;
class vtkMitkThickSlicesFilter;
class vtkPolyData;
class vtkMitkLevelWindowFilter;
class vtkNeverTranslucentTexture;
namespace mitk
{
/** \brief Mapper to resample and display 2D slices of a 3D labelset image.
*
* Properties that can be set for labelset images and influence this mapper are:
*
* - \b "labelset.contour.active": (BoolProperty) whether to show only the active label as a contour or not
* - \b "labelset.contour.width": (FloatProperty) line width of the contour
* The default properties are:
* - \b "labelset.contour.active", mitk::BoolProperty::New( true ), renderer, overwrite )
* - \b "labelset.contour.width", mitk::FloatProperty::New( 2.0 ), renderer, overwrite )
* \ingroup Mapper
*/
class MITKMULTILABEL_EXPORT LabelSetImageVtkMapper2D : public VtkMapper
{
public:
/** Standard class typedefs. */
mitkClassMacro(LabelSetImageVtkMapper2D, VtkMapper);
/** Method for creation through the object factory. */
itkNewMacro(Self);
/** \brief Get the Image to map */
const mitk::Image *GetInput(void);
/** \brief Checks whether this mapper needs to update itself and generate
* data. */
void Update(mitk::BaseRenderer *renderer) override;
//### methods of MITK-VTK rendering pipeline
vtkProp *GetVtkProp(mitk::BaseRenderer *renderer) override;
//### end of methods of MITK-VTK rendering pipeline
/** \brief Internal class holding the mapper, actor, etc. for each of the 3 2D render windows */
/**
* To render transversal, coronal, and sagittal, the mapper is called three times.
* For performance reasons, the corresponding data for each view is saved in the
* internal helper class LocalStorage. This allows rendering n views with just
* 1 mitkMapper using n vtkMapper.
* */
class MITKMULTILABEL_EXPORT LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
vtkSmartPointer<vtkPropAssembly> m_Actors;
std::vector<vtkSmartPointer<vtkActor>> m_LayerActorVector;
std::vector<vtkSmartPointer<vtkPolyDataMapper>> m_LayerMapperVector;
std::vector<vtkSmartPointer<vtkImageData>> m_ReslicedImageVector;
std::vector<vtkSmartPointer<vtkNeverTranslucentTexture>> m_LayerTextureVector;
vtkSmartPointer<vtkPolyData> m_EmptyPolyData;
vtkSmartPointer<vtkPlaneSource> m_Plane;
std::vector<mitk::ExtractSliceFilter::Pointer> m_ReslicerVector;
vtkSmartPointer<vtkPolyData> m_OutlinePolyData;
/** \brief An actor for the outline */
vtkSmartPointer<vtkActor> m_OutlineActor;
/** \brief An actor for the outline shadow*/
vtkSmartPointer<vtkActor> m_OutlineShadowActor;
/** \brief A mapper for the outline */
vtkSmartPointer<vtkPolyDataMapper> m_OutlineMapper;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastDataUpdateTime;
/** \brief Timestamp of last update of a property. */
itk::TimeStamp m_LastPropertyUpdateTime;
/** \brief mmPerPixel relation between pixel and mm. (World spacing).*/
mitk::ScalarType *m_mmPerPixel;
int m_NumberOfLayers;
/** \brief This filter is used to apply the level window to Grayvalue and RBG(A) images. */
// vtkSmartPointer<vtkMitkLevelWindowFilter> m_LevelWindowFilter;
std::vector<vtkSmartPointer<vtkMitkLevelWindowFilter>> m_LevelWindowFilterVector;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage() override;
};
/** \brief The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<LocalStorage> m_LSH;
/** \brief Get the LocalStorage corresponding to the current renderer. */
LocalStorage *GetLocalStorage(mitk::BaseRenderer *renderer);
/** \brief Set the default properties for general image rendering. */
static void SetDefaultProperties(mitk::DataNode *node, mitk::BaseRenderer *renderer = nullptr, bool overwrite = false);
/** \brief This method switches between different rendering modes (e.g. use a lookup table or a transfer function).
* Detailed documentation about the modes can be found here: \link mitk::RenderingModeProperty \endlink
*/
void ApplyRenderingMode(mitk::BaseRenderer *renderer);
protected:
/** \brief Transforms the actor to the actual position in 3D.
* \param renderer The current renderer corresponding to the render window.
*/
void TransformActor(mitk::BaseRenderer *renderer);
/** \brief Generates a plane according to the size of the resliced image in milimeters.
- *
- * \image html texturedPlane.png
*
* In VTK a vtkPlaneSource is defined through three points. The origin and two
* points defining the axes of the plane (see VTK documentation). The origin is
* set to (xMin; yMin; Z), where xMin and yMin are the minimal bounds of the
* resliced image in space. Z is relevant for blending and the layer property.
* The center of the plane (C) is also the center of the view plane (cf. the image above).
*
* \note For the standard MITK view with three 2D render windows showing three
* different slices, three such planes are generated. All these planes are generated
* in the XY-plane (even if they depict a YZ-slice of the volume).
*
*/
void GeneratePlane(mitk::BaseRenderer *renderer, double planeBounds[6]);
/** \brief Generates a vtkPolyData object containing the outline of a given binary slice.
- \param renderer: Pointer to the renderer containing the needed information
+ \param renderer Pointer to the renderer containing the needed information
+ \param image
+ \param pixelValue
\note This code is based on code from the iil library.
*/
vtkSmartPointer<vtkPolyData> CreateOutlinePolyData(mitk::BaseRenderer *renderer,
vtkImageData *image,
int pixelValue = 1);
/** Default constructor */
LabelSetImageVtkMapper2D();
/** Default deconstructor */
~LabelSetImageVtkMapper2D() override;
/** \brief Does the actual resampling, without rendering the image yet.
* All the data is generated inside this method. The vtkProp (or Actor)
* is filled with content (i.e. the resliced image).
*
* After generation, a 4x4 transformation matrix(t) of the current slice is obtained
* from the vtkResliceImage object via GetReslicesAxis(). This matrix is
* applied to each textured plane (actor->SetUserTransform(t)) to transform everything
* to the actual 3D position (cf. the following image).
*
* \image html cameraPositioning3D.png
*
*/
void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
/** \brief This method uses the vtkCamera clipping range and the layer property
* to calcualte the depth of the object (e.g. image or contour). The depth is used
* to keep the correct order for the final VTK rendering.*/
float CalculateLayerDepth(mitk::BaseRenderer *renderer);
/** \brief This method applies (or modifies) the lookuptable for all types of images.
* \warning To use the lookup table, the property 'Lookup Table' must be set and a 'Image Rendering.Mode'
* which uses the lookup table must be set.
*/
void ApplyLookuptable(mitk::BaseRenderer *renderer, int layer);
/** \brief This method applies a color transfer function.
* Internally, a vtkColorTransferFunction is used. This is usefull for coloring continous
* images (e.g. float)
* \warning To use the color transfer function, the property 'Image Rendering.Transfer Function' must be set and a
* 'Image Rendering.Mode' which uses the color transfer function must be set.
*/
void ApplyColorTransferFunction(mitk::BaseRenderer *renderer);
/**
* @brief ApplyLevelWindow Apply the level window for the given renderer.
* \warning To use the level window, the property 'LevelWindow' must be set and a 'Image Rendering.Mode' which uses
* the level window must be set.
* @param renderer Level window for which renderer?
*/
void ApplyLevelWindow(mitk::BaseRenderer *renderer);
/** \brief Set the color of the image/polydata */
void ApplyColor(mitk::BaseRenderer *renderer, const mitk::Color &color);
/** \brief Set the opacity of the actor. */
void ApplyOpacity(mitk::BaseRenderer *renderer, int layer);
/**
* \brief Calculates whether the given rendering geometry intersects the
* given SlicedGeometry3D.
*
* This method checks if the given Geometry2D intersects the given
* SlicedGeometry3D. It calculates the distance of the Geometry2D to all
* 8 cornerpoints of the SlicedGeometry3D. If all distances have the same
* sign (all positive or all negative) there is no intersection.
* If the distances have different sign, there is an intersection.
**/
bool RenderingGeometryIntersectsImage(const PlaneGeometry *renderingGeometry, SlicedGeometry3D *imageGeometry);
};
} // namespace mitk
#endif // __mitkLabelSetImageVtkMapper2D_H_
diff --git a/Modules/OpenCL/Documentation/doxygen/MitkOpenCL.dox b/Modules/OpenCL/Documentation/doxygen/MitkOpenCL.dox
index 5d97240a63..bbe20e21d7 100644
--- a/Modules/OpenCL/Documentation/doxygen/MitkOpenCL.dox
+++ b/Modules/OpenCL/Documentation/doxygen/MitkOpenCL.dox
@@ -1,49 +1,48 @@
/**
\page MitkOpenCL_Example Examples
This is a list of available examples:
- \subpage MitkOpenCL_BinaryThresholdFilter
*/
/**
\page MitkOpenCL_Overview OpenCL Module
The MITK OpenCL Module provides a basic class structure to allow usage of OpenCL-accelerated parallel computing.
<h1> Build Instructions </h1>
-The MITK OpenCL module needs an OpenCL Device ( most likely a graphics card, but works also on some CPUs ) and the corresponding driver. Furthermore the OpenCL library and the headers are needed. A list of supported hardware is provided by <a href="http://www.khronos.org/conformance/adopters/conformant-products#topencl"> Khronos.org </a>. For the driver and the libraries please look at the support pages of the hardware manufacturer. Quick Links to the most likely of them:
+The MITK OpenCL module needs an OpenCL Device ( most likely a graphics card, but works also on some CPUs ) and the corresponding driver. Furthermore the OpenCL library and the headers are needed. A list of supported hardware is provided by <a href="https://www.khronos.org/conformance/adopters/conformant-products/opencl"> Khronos.org </a>. For the driver and the libraries please look at the support pages of the hardware manufacturer. Quick Links to the most likely of them:
- <a href="https://developer.nvidia.com/opencl"> NVIDIA OpenCL Page </a>
-- <a href="http://www.amd.com/de/products/technologies/stream-technology/opencl/pages/opencl.aspx"> AMD/ATI OpenCL Page </a>
-- <a href="http://software.intel.com/en-us/vcsource/tools/opencl-sdk"> Intel OpenCL SDK </a>
+- <a href="https://software.intel.com/content/www/us/en/develop/tools/opencl-sdk.html"> Intel OpenCL SDK </a>
To activate the module, you have to activate the CMake option
\verbatim
MITK_USE_OpenCL
\endverbatim
The build system tries to find the OpenCL library and the include path automatically. If this attempt failes, you will be prompted to manually specify following variables:
\verbatim
OPENCL_INCLUDE_DIRS
OPENCL_LIBRARIES
\endverbatim
<h1> Detailed description </h1>
For own implementations, the OpenCL Module allows for building up a filtering pipeline in MITK Style ( see more in \ref PipelineingConceptPage ). The OpenCL filter can be simply connected also to an existing MITK image filtering pipeline since the mitk::OclImageToImageFilter provide a SetInput and GetOutput methods expecting an mitk::Image and returning it respectively.
<h1> Examples </h1>
Here is a list of \subpage MitkOpenCL_Example "examples":
- \ref MitkOpenCL_BinaryThresholdFilter
*/
diff --git a/Modules/OpenCL/mitkOclBinaryThresholdImageFilter.h b/Modules/OpenCL/mitkOclBinaryThresholdImageFilter.h
index 9070125f86..dada1676d0 100644
--- a/Modules/OpenCL/mitkOclBinaryThresholdImageFilter.h
+++ b/Modules/OpenCL/mitkOclBinaryThresholdImageFilter.h
@@ -1,121 +1,121 @@
/*============================================================================
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 _MITKOCLBINARYTHRESHOLDIMAGEFILTER_H_
#define _MITKOCLBINARYTHRESHOLDIMAGEFILTER_H_
#include "mitkOclImageToImageFilter.h"
#include <itkObject.h>
namespace mitk
{
class OclImageToImageFilter;
/** Documentation
*
* \brief The OclBinaryThresholdImageFilter computes a binary segmentation based on given
threshold values.
*
* The filter requires two threshold values ( the upper and the lower threshold ) and two image values ( inside and outside ). The resulting voxel of the segmentation image is assigned the inside value 1 if the image value is between the given thresholds and the outside value otherwise.
*/
class MITKOPENCL_EXPORT OclBinaryThresholdImageFilter : public OclImageToImageFilter, public itk::Object
{
public:
mitkClassMacroItkParent(OclBinaryThresholdImageFilter, itk::Object);
itkNewMacro(Self);
/**
* @brief SetInput Set the input image. Only 3D images are supported for now.
* @param image a 3D image.
* @throw mitk::Exception if the dimesion is not 3.
*/
void SetInput(Image::Pointer image);
/** Update the filter */
void Update();
/** Set the lower threshold
- @param thr Threshold value
+ @param lowerThreshold Threshold value
*/
void SetLowerThreshold( int lowerThreshold )
{
this->m_LowerThreshold = lowerThreshold;
}
/** Set the upper threshold
- @param thr Threshold value
+ @param upperThreshold Threshold value
*/
void SetUpperThreshold( int upperThreshold )
{
this->m_UpperThreshold = upperThreshold;
}
/** Set the outside value
- @param val The outside value
+ @param outsideValue The outside value
*/
void SetOutsideValue( int outsideValue )
{
this->m_OutsideValue = outsideValue;
}
/** Set the inside value
- @param val The inside value
+ @param insideValue The inside value
*/
void SetInsideValue( int insideValue )
{
this->m_InsideValue = insideValue;
}
protected:
/** Constructor */
OclBinaryThresholdImageFilter();
/** Destructor */
virtual ~OclBinaryThresholdImageFilter();
/** Initialize the filter */
bool Initialize();
void Execute();
mitk::PixelType GetOutputType()
{
return mitk::MakeScalarPixelType<unsigned char>();
}
int GetBytesPerElem()
{
return sizeof(unsigned char);
}
virtual us::Module* GetModule();
private:
/** The OpenCL kernel for the filter */
cl_kernel m_ckBinaryThreshold;
int m_LowerThreshold;
int m_UpperThreshold;
int m_InsideValue;
int m_OutsideValue;
};
}
#endif
diff --git a/Modules/OpenCL/mitkOclDataSetFilter.h b/Modules/OpenCL/mitkOclDataSetFilter.h
index b4e660c4bb..7bda3d545a 100644
--- a/Modules/OpenCL/mitkOclDataSetFilter.h
+++ b/Modules/OpenCL/mitkOclDataSetFilter.h
@@ -1,65 +1,67 @@
/*============================================================================
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 __mitkOclDataSetFilter_h
#define __mitkOclDataSetFilter_h
#include "mitkOclFilter.h"
#include "mitkOclDataSet.h"
#define FILTER_UCHAR 0
#define FILTER_SHORT 1
namespace mitk
{
class OclFilter;
class OclDataSetFilter;
/**
* \brief The OclDataSetFilter is the topmost class for all filter which take DataSets as input.
*
* The input DataSet can be intialized via an oclDataSet or a pointer to the data
* This makes it possible to create a filter pipeline of GPU-based filters
* and to bind this part into the CPU (ITK) filter pipeline.
*/
class MITKOPENCL_EXPORT OclDataSetFilter: public OclFilter
{
public:
/**
* @brief SetInput SetInput Set the input DataSet (as mitk::OclDataSet).
* @param DataSet The DataSet in mitk::OclDataSet.
*/
void SetInput(mitk::OclDataSet::Pointer DataSet);
/**
* @brief SetInput Set the input DataSet (as a pointer to the data).
* @param DataSet The DataSet in mitk::OclDataSet.
+ * @param size
+ * @param BpE
*/
void SetInput(void* DataSet, unsigned int size, unsigned int BpE);
/**
* @brief SetInput Set the input DataSet (as mitk::Image).
- * @param DataSet The DataSet in mitk::OclDataSet.
+ * @param image The DataSet in mitk::OclDataSet.
*/
void SetInput(mitk::Image::Pointer image);
protected:
OclDataSetFilter();
virtual ~OclDataSetFilter();
/** The input DataSet */
mitk::OclDataSet::Pointer m_Input;
unsigned int m_CurrentSize;
};
}
#endif // __mitkOclDataSetFilter_h
diff --git a/Modules/OpenCL/mitkOclDataSetToDataSetFilter.h b/Modules/OpenCL/mitkOclDataSetToDataSetFilter.h
index d1ca3fa76e..842bc0df47 100644
--- a/Modules/OpenCL/mitkOclDataSetToDataSetFilter.h
+++ b/Modules/OpenCL/mitkOclDataSetToDataSetFilter.h
@@ -1,77 +1,80 @@
/*============================================================================
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 __mitkOclDataSetToDataSetFilter_h
#define __mitkOclDataSetToDataSetFilter_h
#include "mitkOclDataSetFilter.h"
namespace mitk
{
class OclDataSetFilter;
class OclDataSetToDataSetFilter;
/** @class OclDataSetToDataSetFilter
* @brief The OclDataSetToDataSetFilter is the base class for all OpenCL DataSet filter generating DataSets.
*/
class MITKOPENCL_EXPORT OclDataSetToDataSetFilter: public OclDataSetFilter
{
public:
/*!
* \brief Returns an pointer to the filtered data.
*/
void* GetOutput();
/*!
* \brief Returns a pointer to the graphics memory.
*
* Use this method when executing two and more filters on the GPU for fast access.
* This method does not copy the data to RAM. It returns only a pointer.
*/
mitk::OclDataSet::Pointer GetGPUOutput();
protected:
/**
* @brief OclDataSetToDataSetFilter Default constructor.
*/
OclDataSetToDataSetFilter();
/** @brief Destructor */
virtual ~OclDataSetToDataSetFilter();
/** Output DataSet */
mitk::OclDataSet::Pointer m_Output;
/** @brief (Virtual) method Update() to be implemented in derived classes. */
virtual void Update() = 0;
/**
* @brief InitExec Initialize the execution
* @param ckKernel The GPU kernel.
+ * @param dimensions
+ * @param outputDataSize
+ * @param outputBpE
* @throws mitk::Exception if something goes wrong.
* @return True for success.
*/
bool InitExec(cl_kernel ckKernel, unsigned int* dimensions, size_t outputDataSize, unsigned int outputBpE);
bool InitExecNoInput(cl_kernel ckKernel, unsigned int* dimensions, size_t outputDataSize, unsigned int outputBpE);
/** @brief Get the memory size needed for each element */
virtual int GetBytesPerElem();
unsigned int m_CurrentSizeOutput;
private:
/** Block dimensions */
unsigned int m_BlockDims[3];
};
}
#endif // __mitkOclDataSetToDataSetFilter_h
diff --git a/Modules/OpenCL/mitkOclFilter.h b/Modules/OpenCL/mitkOclFilter.h
index 30439db225..4de5217d7a 100644
--- a/Modules/OpenCL/mitkOclFilter.h
+++ b/Modules/OpenCL/mitkOclFilter.h
@@ -1,158 +1,159 @@
/*============================================================================
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 __mitkOclFilter_h
#define __mitkOclFilter_h
#include "mitkOclUtils.h"
#include "mitkCommon.h"
#include <vector>
#include <usModule.h>
#include <MitkOpenCLExports.h>
namespace mitk
{
/**
@class OclFilter
@brief Superclass for all OpenCL based filter.
This class takes care of loading and compiling the external GPU program code.
*/
class MITKOPENCL_EXPORT OclFilter
{
public:
/**
* @brief Add a source file from the resource files to the
* OpenCL shader file list. Multiple files can be added to the list.
*
- * @param name of the file in the resource system
+ * @param filename of the file in the resource system
*/
void AddSourceFile(const char* filename);
/**
* @brief Set specific compilerflags to compile the CL source. Default is set to nullptr;
* example: "-cl-fast-relaxed-math -cl-mad-enable -cl-strict-aliasing"
*
* @param flags to the modulefolder that contains the gpuSource
*/
void SetCompilerFlags(const char* flags);
/**
* @brief Returns true if the initialization was successfull
*/
virtual bool IsInitialized();
/**
* @brief Returns the amount of global memory of the used device in bytes
*/
virtual unsigned long GetDeviceMemory();
/** @brief Destructor */
virtual ~OclFilter();
protected:
typedef std::vector<const char*> CStringList;
typedef std::vector<size_t> ClSizeList;
/** @brief Constructor */
OclFilter();
/** @brief Constructor ( overloaded ) */
OclFilter(const char* filename);
/** @brief String that contains the compiler flags */
const char* m_ClCompilerFlags;
/** @brief The compiled OpenCL program */
cl_program m_ClProgram;
/** @brief Command queue for the filter */
cl_command_queue m_CommandQue;
/** @brief Unique ID of the filter, needs to be specified in the constructor of the derived class */
std::string m_FilterID;
- /*! @brief source preambel for e.g. #define commands to be inserted into the OpenCL source */
+ /*! @brief source preambel for e.g. \c \#define commands to be inserted into the OpenCL source */
const char* m_Preambel;
/** @brief List of sourcefiles that will be compiled for this filter.*/
CStringList m_ClFiles;
/** @brief status of the filter */
bool m_Initialized;
/** @brief The local work size fo the filter */
size_t m_LocalWorkSize[3];
/** @brief The global work size of the filter */
size_t m_GlobalWorkSize[3];
/** @brief Set the working size for the following OpenCL kernel call */
void SetWorkingSize(unsigned int locx, unsigned int dimx,
unsigned int locy = 1, unsigned int dimy = 1,
unsigned int locz = 1, unsigned int dimz = 1);
/** @brief Execute the given kernel on the OpenCL Index-Space defined by the local and global work sizes
*/
bool ExecuteKernel( cl_kernel kernel, unsigned int workSizeDim );
/** @brief Execute the given kernel on the OpenCL Index-Space defined by the local and global work sizes, but divide it into chunks of dimension chunksDim
*/
bool ExecuteKernelChunks( cl_kernel kernel, unsigned int workSizeDim, size_t* chunksDim );
/** @brief Execute the given kernel on the OpenCL Index-Space defined by the local and global work sizes, but divide it into chunks of dimension chunksDim and wait between
* batches of batchSize chunks a time of waitTimems milliseconds
*/
bool ExecuteKernelChunksInBatches(cl_kernel kernel, unsigned int workSizeDim, size_t* chunksDim, size_t batchSize, int waitTimems);
/**
* \brief Initialize all necessary parts of the filter
*
* The Initialize() method creates the command queue and the m_clProgram.
* The program is either compiled from the given source or taken from the
* OclResourceManager if the program was compiled already.
*/
bool Initialize();
/**
* @brief Compile the program source
*
* @param preambel e.g. defines for the shader code
*/
void CompileSource();
/**
* @brief Add some source code on the beginning of the loaded source
*
* In this way, some preprocessor flags for the CL compiler can at the beginning of the filter
- * @param preambel Source preambel for e.g. #define commands to be inserted into the OpenCL source
+ * @param preambel Source preambel for e.g. \c \#define commands to be inserted into the OpenCL source
*/
void SetSourcePreambel(const char* preambel);
/**
* @brief Get the Module of the filter. Needs to be implemented by every subclass.
* The filter will load the OpenCL sourcefiles from this module context.
*/
virtual us::Module* GetModule() = 0;
/**
* @brief Helper functions that load sourcefiles from the module context in the Initialize function.
* @param SourceCodeList holds the sourcecode for every file as string, the SourceCodeSizeList holst the
* size of every file in bytes.
+ * @param SourceCodeSizeList
*/
void LoadSourceFiles(CStringList &SourceCodeList, ClSizeList &SourceCodeSizeList);
};
}
#endif // __mitkOclFilter_h
diff --git a/Modules/OpenCL/mitkOclResourceService.h b/Modules/OpenCL/mitkOclResourceService.h
index 47b8cdb0b0..5ce273beaa 100644
--- a/Modules/OpenCL/mitkOclResourceService.h
+++ b/Modules/OpenCL/mitkOclResourceService.h
@@ -1,79 +1,79 @@
/*============================================================================
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 __mitkOclResourceService_h
#define __mitkOclResourceService_h
#include <mitkServiceInterface.h>
#include <mitkOpenCL.h>
/**
* @brief Declaration of the OpenCL Resources micro-service
*
* The OclResourceService defines an service interface for providing access to the
* essential OpenCL-related variables. In addition the service can also store compiled
* OpenCL Programs in order to avoid multiple compiling of a single program source
*/
class OclResourceService
{
public:
/** @brief Returns a valid OpenCL Context (if applicable) or nullptr if none present */
virtual cl_context GetContext() const = 0;
/** @brief Returns a valid cl_command_queue related to the (one) OpenCL context */
virtual cl_command_queue GetCommandQueue() const = 0;
/** @brief Returns the identifier of an OpenCL device related to the current context */
virtual cl_device_id GetCurrentDevice() const = 0;
/** @brief Checks if an OpenCL image format passed in is supported on current device */
virtual bool GetIsFormatSupported( cl_image_format* format ) = 0;
/** @brief Puts the OpenCL Context info in std::cout */
virtual void PrintContextInfo() const = 0;
/** @brief Insert program into the internal program storage
*
* @param program A cl_program object.
* @param string Text identifier of the inserted program. Used for getting the program.
- * @param todo: what is the flag?
+ * @param flag
*/
virtual void InsertProgram(cl_program program, std::string string, bool flag) = 0;
/** @brief Get the cl_program by name
* @param name Text identifier of the program.
* @throws an mitk::Exception in case the program cannot be found
*/
virtual cl_program GetProgram(const std::string& name) = 0;
/** @brief Remove all invalid (=do not compile) programs from the internal storage */
virtual void InvalidateStorage() = 0;
/** @brief Remove given program from storage
* @param name Text identifier of the program.
*/
virtual void RemoveProgram(const std::string& name) = 0;
/** @brief Get the maximum size of an image
*
* @param dimension (unsigned int) identifier of the image diemsion in {0,1,2}
* @param image object type, either CL_MEM_OBJECT_IMAGE2D, CL_MEM_OBJECT_IMAGE3D
*/
- virtual unsigned int GetMaximumImageSize( unsigned int , cl_mem_object_type) = 0;
+ virtual unsigned int GetMaximumImageSize(unsigned int dimension, cl_mem_object_type image) = 0;
virtual ~OclResourceService() = 0;
};
MITK_DECLARE_SERVICE_INTERFACE(OclResourceService, "OpenCLResourceService/1.0")
#endif // __mitkOclResourceService_h
diff --git a/Modules/OpenCVVideoSupport/Commands/mitkGrabCutOpenCVImageFilter.h b/Modules/OpenCVVideoSupport/Commands/mitkGrabCutOpenCVImageFilter.h
index 774101d459..361c0dad68 100644
--- a/Modules/OpenCVVideoSupport/Commands/mitkGrabCutOpenCVImageFilter.h
+++ b/Modules/OpenCVVideoSupport/Commands/mitkGrabCutOpenCVImageFilter.h
@@ -1,287 +1,287 @@
/*============================================================================
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 MITKGRABCUTOPENCVIMAGEFILTER_H
#define MITKGRABCUTOPENCVIMAGEFILTER_H
// mitk headers
#include "mitkAbstractOpenCVImageFilter.h"
#include "mitkVector.h"
// itk headers
#include "itkObjectFactory.h"
#include "itkMutexLock.h"
// opencv headers
#include <opencv2/core.hpp>
namespace itk {
template<unsigned int T> class Index;
template<class T> class SmartPointer;
class MultiThreader;
class ConditionVariable;
class FastMutexLock;
}
namespace mitk {
class PointSet;
/**
* \brief Makes the OpenCV GrabCut filter available as OpenCVImageFilter.
*
* Image filtering is done asynchronly by using a worker thread as GrabCut segmentation
* can take up to some seconds. Calling the mitk::GrabCutOpenCVImageFilter::OnFilterImage()
* method sets just the input image and wakes up the worker thread. It is not guaranteed
* that every image gets segmented. If multiple new images where set before a segmentation
* was finished, only the last new image gets segmented afterwards.
*
* At least foreground model points have to be set by
* mitk::GrabCutOpenCVImageFilter::SetModelPoints() before a segmentation can be performed.
* The worder thread will not be waken up before any model points were set.
*
* When a new segmentation is ready, mitk::GrabCutOpenCVImageFilter::GetCurrentImageId()
* returns a new image id. The segmentation can be got then by calling
* mitk::GrabCutOpenCVImageFilter::GetResultMask(),
* mitk::GrabCutOpenCVImageFilter::GetResultContours() or
* mitk::GrabCutOpenCVImageFilter::GetResultContourWithPixel().
*/
class MITKOPENCVVIDEOSUPPORT_EXPORT GrabCutOpenCVImageFilter : public AbstractOpenCVImageFilter
{
public:
/** \brief List holding image indices of the model points. */
typedef std::vector<itk::Index<2> > ModelPointsList;
mitkClassMacro(GrabCutOpenCVImageFilter, AbstractOpenCVImageFilter);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
GrabCutOpenCVImageFilter();
~GrabCutOpenCVImageFilter() override;
/**
* \brief Implementation of the virtual image filtering method.
* The input image is copied to a member attribute, but the actual filtering is not done
* in this method. Instead a worker thread is waken up every time this method is called,
* if foreground model points were set before.
*
- * \param OpenCV image to be segmentated
+ * \param image OpenCV image to be segmentated
* \return false if an empty image was set, true otherwise
*/
bool OnFilterImage( cv::Mat& image ) override;
/**
* \brief Sets a list of image indices as foreground model points.
* \param foregroundPoints List of image indices which definitely belong to the foreground.
*/
void SetModelPoints(ModelPointsList foregroundPoints);
/**
* \brief Sets a list of image indices as foreground and another list as background model points.
* \param foregroundPoints List of image indices which definitely belong to the foreground.
* \param backgroundPoints List of image indices which definitely belong to the background.
*/
void SetModelPoints(ModelPointsList foregroundPoints, ModelPointsList backgroundPoints);
/**
* \brief Sets a mask where every non-zero pixel is treated as a foreground model pixel.
*/
void SetModelPoints(cv::Mat foregroundMask);
/**
* \brief Sets masks specifying foreground and background points.
* \param foregroundMask every non-zero pixel is treated as a foreground model pixel
* \param backgroundMask every non-zero pixel is treated as a background model pixel
*/
void SetModelPoints(cv::Mat foregroundMask, cv::Mat backgroundMask);
/**
* \brief Set a size of which each model point is dilated before image filtering.
* The more color information of the foreground object the GrabCut filter gets the better
* the result will be. Therefore the foreground pixels can be dilated before filtering. The
* caller is responsible for setting a dilation size so that no foreground model pixels will
* be indeed part of the background after dilation.
*
* Dilation is done to the background model pixles as well, if there are any set for the
* filter.
*
* \param modelPointsDilationSize how many pixels are added in every direction, 0 sets back to no dilation
*/
void SetModelPointsDilationSize(int modelPointsDilationSize);
/**
* \brief Use only the region around the foreground model points for the segmentation.
*
* This is mainly for reasons of segmentation speed and has the drawback that the foreground
* model points (plus the given additional border) have to cover the whole foreground object.
*
* The segmentation filter can be set back to using the whole image by calling
* mitk::GrabCutOpenCVImageFilter::SetUseFullImage().
*
* \param additionalBorder size of the border around the foreground points which will be used for segmentation, too
*/
void SetUseOnlyRegionAroundModelPoints(unsigned int additionalBorder);
/**
* \brief The full image is used as input for the segmentation.
* This method sets the behaviour back to the default behaviour in case
* mitk::GrabCutOpenCVImageFilter::SetUseOnlyRegionAroundModelPoints() was
* called before.
*/
void SetUseFullImage();
/**
* \brief Getter for the rectangle used for the area of segmentation.
* See mitk::GrabCutOpenCVImageFilter::SetUseOnlyRegionAroundModelPoints().
* This method is mainly for debugging purposes and may be removed in
* the future.
*/
cv::Rect GetRegionAroundModelPoints();
/**
* \brief Getter for an ascending id of the current result image.
* The id will be increased for every segmentation that is produced by the worker thread.
* It can be used to determine if a new segmentation was produced since the last time a
* segmentation was got from this filter.
*
* int lastResultImageId = grabCutFilter->GetResultImageId();
* // do something
* if ( lastResultImageId != grabCutFilter->GetResultImageId() )
* // get new segmentation
*/
int GetResultImageId();
/**
* \brief Getter for the result mask of the current segmentation.
* The result of this method is not necessarily consistent with the result of
* mitk::GrabCutOpenCVImageFilter::GetResultContours() if they are called afterwards.
* The segmentation may have changed in the meantime. One should decide if he needs
* a mask or a contour or convert one into the other on his own.
* \return image of the size of the input image where all pixels segmented as foreground are non-zero
*/
cv::Mat GetResultMask();
/**
* \brief Getter for the contours of the current segmentation.
*
* A segmentation can consist of multiple regions therefore a list of contours
* is returned. If one needs only one specific region he can call
* mitk::GrabCutOpenCVImageFilter::GetResultContourWithPixel().
*
* This result of this method is not necessarily consistent with the result of
* mitk::GrabCutOpenCVImageFilter::GetResultContours() if they are called afterwards.
* The segmentation may have changed in the meantime. One should decide if he needs
* a mask or a contour or convert one into the other on his own.
*
* \return List containing lists of pixel indices for every contour.
*/
std::vector<ModelPointsList> GetResultContours();
/**
* \brief Getter for one specific contour of the current segmentation.
*
* Can be used if only one (of possible multiple contours) is needed. A pixel index
* must be given to select from the contours. This could be one of the foreground
* model pixels for example. If other criteria are needed to distinguish the contours
* mitk::GrabCutOpenCVImageFilter::GetResultContours() can be used instead and therefore
* contour selection can be done by hand then.
*
* This result of this method is not necessarily consistent with the result of
* mitk::GrabCutOpenCVImageFilter::GetResultContours() if they are called afterwards.
* The segmentation may have changed in the meantime. One should decide if he needs
* a mask or a contour or convert one into the other on his own.
*
* \param pixelIndex index of a pixel which lies inside the contour
* \return list of pixel indices for the selected contour
*/
ModelPointsList GetResultContourWithPixel(itk::Index<2> pixelIndex);
protected:
/** \brief Creates an image mask for GrabCut algorithm by using the foreground and background point sets.
* Background and foreground points will be dilated by the size set by
* mitk::GrabCutOpenCVImageFilter::SetModelPointsDilationSize().
*/
cv::Mat GetMaskFromPointSets();
/**
* \brief Creates a bounding box around all pixels which aren't propably background.
* The bounding box is widened as specified by
* mitk::GrabCutOpenCVImageFilter::SetUseOnlyRegionAroundModelPoints().
*/
cv::Rect GetBoundingRectFromMask(cv::Mat mask);
/**
* \brief Performs a GrabCut segmentation of the given input image.
* \param input image on which the segmentation will be performed
* \param mask foreground and background pixels used as basis for segmentation
* \return mask with every pixel of the segmented foreground object set non-zero
*/
cv::Mat RunSegmentation(cv::Mat input, cv::Mat mask);
/**
* \brief Creates a list of points from every non-zero pixel of the given mask.
*/
ModelPointsList ConvertMaskToModelPointsList(cv::Mat mask);
int m_ModelPointsDilationSize;
bool m_UseOnlyRegionAroundModelPoints;
unsigned int m_AdditionalWidth;
cv::Rect m_BoundingBox;
ModelPointsList m_ForegroundPoints;
ModelPointsList m_BackgroundPoints;
cv::Mat m_InputImage;
cv::Mat m_GrabCutMask;
cv::Mat m_ResultMask;
unsigned int m_CurrentProcessImageNum;
/** \brief id of the image currently set as m_InputImage */
int m_InputImageId;
/** \brief id of the image which segmentation result is currently present in m_ResultMask */
int m_ResultImageId;
private:
/**
* \brief Worker thread for doing the segmentation.
* It blocks every time a image was segmented and will be waken up again by
* the mitk::GrabCutOpenCVImageFilter::OnFilterImage() method.
*
* \param pInfoStruct pointer to the GrabCutOpenCVImageFilter object
* \return
*/
static ITK_THREAD_RETURN_TYPE SegmentationWorker(void* pInfoStruct);
int m_ThreadId;
/** \brief worker thread will terminate after the next wakeup if set to true */
bool m_StopThread;
itk::SmartPointer<itk::MultiThreader> m_MultiThreader;
itk::SmartPointer<itk::ConditionVariable> m_WorkerBarrier;
/** \brief mutex for guarding m_InputImage and m_InputImageId */
itk::SmartPointer<itk::FastMutexLock> m_ImageMutex;
/** \brief mutex for guarding m_ResultMask and m_ResultImageId */
itk::SmartPointer<itk::FastMutexLock> m_ResultMutex;
/** \brief mutex for guarding m_ForegroundPoints and m_BackgroundPoints */
itk::SmartPointer<itk::FastMutexLock> m_PointSetsMutex;
};
} // namespace mitk
#endif // MITKGRABCUTOPENCVIMAGEFILTER_H
diff --git a/Modules/OpenIGTLink/mitkIGTLMeasurements.h b/Modules/OpenIGTLink/mitkIGTLMeasurements.h
index 598ea28a6f..82b24b6cfd 100644
--- a/Modules/OpenIGTLink/mitkIGTLMeasurements.h
+++ b/Modules/OpenIGTLink/mitkIGTLMeasurements.h
@@ -1,125 +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 IGTLMeasurements_H_HEADER_INCLUDED_
#define IGTLMeasurements_H_HEADER_INCLUDED_
// Microservices
#include <mitkServiceInterface.h>
#include <usServiceRegistration.h>
#include "MitkOpenIGTLinkExports.h"
#include "itkObject.h"
#include "mitkCommon.h"
namespace mitk {
- ///**
- //* \brief Is a helper class to make measurments for latency and fps
- //*
- //* \ingroup OpenIGTLink
- //*/
- //class MITKOPENIGTLINK_EXPORT IGTLMeasurementsImplementation : public itk::Object
- //{
- //public:
- // mitkClassMacroItkParent(IGTLMeasurementsImplementation, itk::Object);
- // itkFactorylessNewMacro(Self)
- // itkCloneMacro(Self)
-
- // typedef std::list<long long> MeasurementList;
- // typedef std::map<unsigned int, MeasurementList> MeasurementPoints;
-
- // /**
- // * \brief AddMeasurementPoint
- // */
- // void AddMeasurement(unsigned int measurementPoint);
- // bool ExportData(std::string filename);
-
- // /**
- // * \brief clears all measurements
- // */
- // void Reset();
-
- // void SetStarted(bool started);
-
- // void RegisterAsMicroservice();
- // void UnRegisterMicroservice();
- //protected:
- // IGTLMeasurementsImplementation();
- // ~IGTLMeasurementsImplementation();
-
- // /** \brief */
- // MeasurementPoints m_MeasurementPoints;
-
- // bool m_IsStarted;
-
- // us::ServiceRegistration<Self> m_ServiceRegistration;
- //};
-
/**
* \brief Is a helper class to make measurments for latency and fps
*
* \ingroup OpenIGTLink
*/
class MITKOPENIGTLINK_EXPORT IGTLMeasurements : public itk::Object
{
public:
mitkClassMacroItkParent(IGTLMeasurements, itk::Object);
static IGTLMeasurements* GetInstance();
/**
* \brief AddMeasurementPoint
+ * \param measurementPoint
+ * \param index
* \param timestamp Sets the timestamp, if it is 0 the current system time is used.
*/
void AddMeasurement(unsigned int measurementPoint, unsigned int index, long long timestamp = 0);
/**
* \brief AddMeasurementPoint
*/
bool ExportData(std::string filename);
/**
* \brief clears all measurements
*/
void Reset();
void SetStarted(bool started);
private:
// Only our module activator class should be able to instantiate
// a SingletonOneService object.
friend class IGTLModuleActivator;
itkFactorylessNewMacro(Self)
//itkCloneMacro(Self)
IGTLMeasurements();
~IGTLMeasurements() override;
// Disable copy constructor and assignment operator.
IGTLMeasurements(const IGTLMeasurements&);
IGTLMeasurements& operator=(const IGTLMeasurements&);
//protected:
//IGTLMeasurementsImplementation::Pointer m_Measurements;
typedef std::pair<long long, unsigned int> TimeStampIndexPair;
typedef std::list<TimeStampIndexPair> MeasurementList;
typedef std::map<unsigned int, MeasurementList> MeasurementPoints;
MeasurementPoints m_MeasurementPoints;
bool m_IsStarted;
};
} // namespace mitk
#endif /* MITKIGTLMeasurements_H_HEADER_INCLUDED_ */
diff --git a/Modules/Pharmacokinetics/include/mitkConvolutionHelper.h b/Modules/Pharmacokinetics/include/mitkConvolutionHelper.h
index 86b1538d1d..2951af672c 100644
--- a/Modules/Pharmacokinetics/include/mitkConvolutionHelper.h
+++ b/Modules/Pharmacokinetics/include/mitkConvolutionHelper.h
@@ -1,153 +1,154 @@
/*============================================================================
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 mitkConvolutionHelper_h
#define mitkConvolutionHelper_h
#include "itkArray.h"
#include "mitkAIFBasedModelBase.h"
#include <iostream>
#include "MitkPharmacokineticsExports.h"
namespace mitk {
/** @namespace convolution
* @brief Helper for itk implementation of vnl fourier transformation
* This namespace provides functions for the preperation of vnl_fft_1d, including a wrapper
* for wrapping the convolution kernel (turning it inside out) and a function for zeropadding
* to avoid convolution artefacts. */
namespace convolution {
/** Some typedefs concerning data structures needed for vnl_fft_1d, which has vnl_vector< vcl_complex< double > >
* as output typ of the forward transformation fwd_transform. Input is of type vnl_vector< vcl_complex< T > >
* but since itk::Array is derived from vnl_vector, this works as well*/
/** @brief Function that wraps the kernel */
inline itk::Array<double> wrap1d(itk::Array<double> kernel)
{
int dim = kernel.GetNumberOfElements();
itk::Array<double> wrappedKernel(dim);
wrappedKernel.fill(0.);
for(int i=0; i< dim; ++i)
{
wrappedKernel.SetElement(i, kernel.GetElement((i+(dim/2))%dim));
}
return wrappedKernel;
}
/** @brief Fuction for zeropadding (adding zeros) of an Array/vnl_vector, so that is has size paddedDimensions
- * @param paddedDimensions Dimensions that the Array should have after padding (convolution dimensions)
+ * @param unpaddedSpectrum
+ * @param paddedDimension Dimensions that the Array should have after padding (convolution dimensions)
* \remark dim = Dimensions of padded image --> PaddedDimension
* \remark m dimensions of larger image
* \remark n dimensions of image to be padded --> InitialDimension*/
inline itk::Array<double> zeropadding1d(itk::Array<double> unpaddedSpectrum, int paddedDimension)
{
int initialDimension = unpaddedSpectrum.GetNumberOfElements();
itk::Array<double> paddedSpectrum(paddedDimension);
paddedSpectrum.fill(0.);
if(paddedDimension > initialDimension)
{
unsigned int padding = paddedDimension - initialDimension;
for(int i=0; i<initialDimension ;++i)
{
paddedSpectrum.SetElement(i+padding/2, unpaddedSpectrum.GetElement(i));
}
}
return paddedSpectrum;
}
/** @brief Follow up function after back transformation from fourier space bwd_transform.
* removes padding and scales (transformed values have to be divided by transformation dimensions) */
inline itk::Array<double> unpadAndScale(itk::Array<double> convolutionResult, int initialDimension)
{
int transformationDimension = convolutionResult.size();
unsigned int padding = transformationDimension - initialDimension;
itk::Array<double> scaledResult(initialDimension);
scaledResult.fill(0.0);
for(int i = 0; i<initialDimension; ++i)
{
double value = convolutionResult(i+padding/2) / transformationDimension;
scaledResult.SetElement(i,value);
}
return scaledResult;
}
/** @brief Convinience function for preparing 2 array for convolution with each other.
* Takes both arrays of type itk::Array, zeropadds them to the sum of their sizes and wraps
* the one specified as kernel. Returns them as vnl_vector<vcl_complex<double> >, ready to
* be entered in fwd_transform*/
inline void prepareConvolution(const itk::Array<double>& kernel, const itk::Array<double>& spectrum, itk::Array<double>& preparedKernel, itk::Array<double>& preparedSpectrum ){
int convolutionDimensions = kernel.GetSize() + spectrum.GetSize();
// itk::Array<double> paddedKernel = zeropadding1d(kernel,convolutionDimensions);
preparedKernel=zeropadding1d(kernel,convolutionDimensions);
preparedSpectrum = zeropadding1d(spectrum,convolutionDimensions);
// preparedKernel = wrap1d(paddedKernel);
}
}
inline itk::Array<double> convoluteAIFWithExponential(mitk::ModelBase::TimeGridType timeGrid, mitk::AIFBasedModelBase::AterialInputFunctionType aif, double lambda)
{
/** @brief Iterative Formula to Convolve aif(t) with an exponential Residuefunction R(t) = exp(lambda*t)
**/
typedef itk::Array<double> ConvolutionResultType;
ConvolutionResultType convolution(timeGrid.GetSize());
convolution.fill(0.0);
convolution(0) = 0;
for(unsigned int i = 0; i< (timeGrid.GetSize()-1); ++i)
{
double dt = timeGrid(i+1) - timeGrid(i);
double m = (aif(i+1) - aif(i))/dt;
double edt = exp(-lambda *dt);
convolution(i+1) =edt * convolution(i)
+ (aif(i) - m*timeGrid(i))/lambda * (1 - edt )
+ m/(lambda * lambda) * ((lambda * timeGrid(i+1) - 1) - edt*(lambda*timeGrid(i) -1));
}
return convolution;
}
inline itk::Array<double> convoluteAIFWithConstant(mitk::ModelBase::TimeGridType timeGrid, mitk::AIFBasedModelBase::AterialInputFunctionType aif, double constant)
{
/** @brief Iterative Formula to Convolve aif(t) with a constant value by linear interpolation of the Aif between sampling points
**/
typedef itk::Array<double> ConvolutionResultType;
ConvolutionResultType convolution(timeGrid.GetSize());
convolution.fill(0.0);
convolution(0) = 0;
for(unsigned int i = 0; i< (timeGrid.GetSize()-1); ++i)
{
double dt = timeGrid(i+1) - timeGrid(i);
double m = (aif(i+1) - aif(i))/dt;
convolution(i+1) = convolution(i) + constant * (aif(i)*dt + m*timeGrid(i)*dt + m/2*(timeGrid(i+1)*timeGrid(i+1) - timeGrid(i)*timeGrid(i)));
}
return convolution;
}
}
#endif // mitkConvolutionHelper_h
diff --git a/Modules/Pharmacokinetics/include/mitkTwoTissueCompartmentModelFactoryBase.h b/Modules/Pharmacokinetics/include/mitkTwoTissueCompartmentModelFactoryBase.h
index fe8a4bf029..9a8b81a4bc 100644
--- a/Modules/Pharmacokinetics/include/mitkTwoTissueCompartmentModelFactoryBase.h
+++ b/Modules/Pharmacokinetics/include/mitkTwoTissueCompartmentModelFactoryBase.h
@@ -1,81 +1,81 @@
/*============================================================================
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 MITKTWOTISSUECOMPARTMENTFACTORYBASE_H
#define MITKTWOTISSUECOMPARTMENTFACTORYBASE_H
#include "mitkConcreteAIFBasedModelFactory.h"
#include "mitkAIFBasedModelParameterizerBase.h"
#include "mitkSimpleBarrierConstraintChecker.h"
namespace mitk
{
template <class TModelParameterizer>
class TwoTissueCompartmentModelFactoryBase : public
mitk::ConcreteAIFBasedModelFactory< TModelParameterizer >
{
public:
mitkClassMacro(TwoTissueCompartmentModelFactoryBase,
ConcreteAIFBasedModelFactory< TModelParameterizer >);
itkFactorylessNewMacro(Self);
typedef typename Superclass::ModelType ModelType;
typedef typename Superclass::ModelParameterizerType ModelParameterizerType;
typedef typename Superclass::ParametersType ParametersType;
ConstraintCheckerBase::Pointer CreateDefaultConstraints() const override
{
SimpleBarrierConstraintChecker::Pointer constraints = SimpleBarrierConstraintChecker::New();
- /**@TODO: Mit Charlie klaren ob es eine sinnvolle default Einstellung gibt.*/
+ /**@todo Mit Charlie klaren ob es eine sinnvolle default Einstellung gibt.*/
constraints->SetLowerBarrier(ModelType::POSITION_PARAMETER_K1, 0, 0);
constraints->SetLowerBarrier(ModelType::POSITION_PARAMETER_k2, 0, 0);
constraints->SetLowerBarrier(ModelType::POSITION_PARAMETER_k3, 0, 0);
constraints->SetLowerBarrier(ModelType::POSITION_PARAMETER_k4, 0, 0);
constraints->SetLowerBarrier(ModelType::POSITION_PARAMETER_VB, 0, 0);
constraints->SetUpperBarrier(ModelType::POSITION_PARAMETER_VB, 1, 0);
constraints->SetUpperBarrier(ModelType::POSITION_PARAMETER_K1, 1.0, 0);
constraints->SetUpperBarrier(ModelType::POSITION_PARAMETER_k2, 1.0, 0);
constraints->SetUpperBarrier(ModelType::POSITION_PARAMETER_k3, 1.0, 0);
constraints->SetUpperBarrier(ModelType::POSITION_PARAMETER_k4, 1.0, 0);
return constraints.GetPointer();
};
ParametersType GetDefaultInitialParameterization() const override
{
typename ModelParameterizerType::Pointer modelParameterizer =
ModelParameterizerType::New();
return modelParameterizer->GetDefaultInitialParameterization();
};
protected:
TwoTissueCompartmentModelFactoryBase()
{
};
~TwoTissueCompartmentModelFactoryBase() override
{
};
private:
//No copy constructor allowed
TwoTissueCompartmentModelFactoryBase(const Self& source);
void operator=(const Self&); //purposely not implemented
};
}
#endif // MITKTWOCOMPARTMENTEXCHANGEMODELFACTORY_H
diff --git a/Modules/Pharmacokinetics/src/Models/mitkTwoStepLinearModel.cpp b/Modules/Pharmacokinetics/src/Models/mitkTwoStepLinearModel.cpp
index 6846ce111c..6a5b96262b 100644
--- a/Modules/Pharmacokinetics/src/Models/mitkTwoStepLinearModel.cpp
+++ b/Modules/Pharmacokinetics/src/Models/mitkTwoStepLinearModel.cpp
@@ -1,184 +1,184 @@
/*============================================================================
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 "mitkTwoStepLinearModel.h"
+#include <mitkIOUtil.h>
const std::string mitk::TwoStepLinearModel::MODELL_NAME = "Two Step Linear Model";
const std::string mitk::TwoStepLinearModel::NAME_PARAMETER_y1 = "BaseValue";
const std::string mitk::TwoStepLinearModel::NAME_PARAMETER_a1 = "Slope_1";
const std::string mitk::TwoStepLinearModel::NAME_PARAMETER_t = "Change_Point";
const std::string mitk::TwoStepLinearModel::NAME_PARAMETER_a2 = "Slope_2";
const unsigned int mitk::TwoStepLinearModel::POSITION_PARAMETER_y1 = 0;
const unsigned int mitk::TwoStepLinearModel::POSITION_PARAMETER_t = 1;
const unsigned int mitk::TwoStepLinearModel::POSITION_PARAMETER_a1 = 2;
const unsigned int mitk::TwoStepLinearModel::POSITION_PARAMETER_a2 = 3;
const unsigned int mitk::TwoStepLinearModel::NUMBER_OF_PARAMETERS = 4;
std::string mitk::TwoStepLinearModel::GetModelDisplayName() const
{
return MODELL_NAME;
};
std::string mitk::TwoStepLinearModel::GetModelType() const
{
return "Generic";
};
mitk::TwoStepLinearModel::FunctionStringType mitk::TwoStepLinearModel::GetFunctionString() const
{
return "Slope_1*t+Y_intercept_1 if t<Change_Point; Slope_2*t+Y_intercept_2 if ChangePoint<=t";
};
std::string mitk::TwoStepLinearModel::GetXName() const
{
return "x";
};
mitk::TwoStepLinearModel::ParameterNamesType
mitk::TwoStepLinearModel::GetParameterNames() const
{
ParameterNamesType result;
result.push_back(NAME_PARAMETER_y1);
result.push_back(NAME_PARAMETER_t);
result.push_back(NAME_PARAMETER_a1);
result.push_back(NAME_PARAMETER_a2);
return result;
};
mitk::TwoStepLinearModel::ParametersSizeType
mitk::TwoStepLinearModel::GetNumberOfParameters() const
{
return NUMBER_OF_PARAMETERS;
};
mitk::TwoStepLinearModel::ParameterNamesType
mitk::TwoStepLinearModel::GetDerivedParameterNames() const
{
ParameterNamesType result;
result.push_back("AUC");
result.push_back("FinalUptake");
result.push_back("Smax");
result.push_back("y-intercept2");
return result;
};
mitk::TwoStepLinearModel::ParametersSizeType
mitk::TwoStepLinearModel::GetNumberOfDerivedParameters() const
{
return 4;
};
mitk::TwoStepLinearModel::ModelResultType
mitk::TwoStepLinearModel::ComputeModelfunction(const ParametersType& parameters) const
{
//Model Parameters
- double t = (double) parameters[POSITION_PARAMETER_t] ;
- double a1 = (double) parameters[POSITION_PARAMETER_a1] ;
- double a2 = (double) parameters[POSITION_PARAMETER_a2] ;
-
-
- double b1 = (double) parameters[POSITION_PARAMETER_y1] ;
- double b2 = (a1 - a2)*t + b1;
+ const auto t = parameters[POSITION_PARAMETER_t] ;
+ const auto a1 = parameters[POSITION_PARAMETER_a1] ;
+ const auto a2 = parameters[POSITION_PARAMETER_a2] ;
+ const auto b1 = parameters[POSITION_PARAMETER_y1] ;
+ const auto b2 = (a1 - a2)*t + b1;
ModelResultType signal(m_TimeGrid.GetSize());
TimeGridType::const_iterator timeGridEnd = m_TimeGrid.end();
ModelResultType::iterator signalPos = signal.begin();
for (TimeGridType::const_iterator gridPos = m_TimeGrid.begin(); gridPos != timeGridEnd; ++gridPos, ++signalPos)
{
if((*gridPos) < t)
{
*signalPos = a1*(*gridPos)+b1;
}
else
{
*signalPos = a2*(*gridPos)+b2;
}
}
return signal;
};
mitk::TwoStepLinearModel::ParameterNamesType mitk::TwoStepLinearModel::GetStaticParameterNames() const
{
ParameterNamesType result;
return result;
}
mitk::TwoStepLinearModel::ParametersSizeType mitk::TwoStepLinearModel::GetNumberOfStaticParameters() const
{
return 0;
}
void mitk::TwoStepLinearModel::SetStaticParameter(const ParameterNameType& /*name*/,
const StaticParameterValuesType& /*values*/)
{
//do nothing
};
mitk::TwoStepLinearModel::StaticParameterValuesType mitk::TwoStepLinearModel::GetStaticParameterValue(
const ParameterNameType& /*name*/) const
{
StaticParameterValuesType result;
//do nothing
return result;
};
mitk::ModelBase::DerivedParameterMapType mitk::TwoStepLinearModel::ComputeDerivedParameters(
const mitk::ModelBase::ParametersType& parameters) const
{
- double tmax = (double) parameters[POSITION_PARAMETER_t] ;
- double s1 = (double) parameters[POSITION_PARAMETER_a1] ;
- double s2 = (double) parameters[POSITION_PARAMETER_a2] ;
- double b1 = (double) parameters[POSITION_PARAMETER_y1] ;
-
+ const auto t = parameters[POSITION_PARAMETER_t] ;
+ const auto a1 = parameters[POSITION_PARAMETER_a1] ;
+ const auto a2 = parameters[POSITION_PARAMETER_a2] ;
+ const auto b1 = parameters[POSITION_PARAMETER_y1] ;
+ const auto b2 = (a1 - a2) * t + b1;
unsigned int timeSteps = m_TimeGrid.GetSize();
- double Taq = 0;
- Taq = m_TimeGrid.GetElement(timeSteps-1);
- double Smax = s1*tmax+b1;
- double b2 = Smax-s2*tmax;
- double AUC = s1/2*(tmax*tmax)+b1*tmax
- +s2/2*(Taq*Taq-tmax*tmax)+b2*(Taq-tmax);
- double Sfin = s2*Taq+b2;
+ const double taq = (m_TimeGrid.empty() == false) ? (m_TimeGrid.GetElement(timeSteps - 1)) : (mitkThrow() << "An exception occured because time grid is empty, method can't continue.");
+
+ const double sfin = a2 * taq + b2;
+
+ const double smax = (a2 <= 0) ? (a1 * t + b1) : (sfin);
+
+ const double auc = a1/2*(t*t)+b1*t
+ +a2/2*(taq*taq-t*t)+b2*(taq-t);
DerivedParameterMapType result;
- result.insert(std::make_pair("AUC", AUC));
- result.insert(std::make_pair("FinalUptake", Sfin));
- result.insert(std::make_pair("Smax", Smax));
+ result.insert(std::make_pair("AUC", auc));
+ result.insert(std::make_pair("FinalUptake", sfin));
+ result.insert(std::make_pair("Smax", smax));
result.insert(std::make_pair("y-intercept2", b2));
return result;
};
itk::LightObject::Pointer mitk::TwoStepLinearModel::InternalClone() const
{
TwoStepLinearModel::Pointer newClone = TwoStepLinearModel::New();
newClone->SetTimeGrid(this->m_TimeGrid);
return newClone.GetPointer();
};
diff --git a/Modules/PhotoacousticsAlgorithms/Documentation/doxygen/PAModule.dox b/Modules/PhotoacousticsAlgorithms/Documentation/doxygen/PAModule.dox
index 2244e8e7c8..9cbcf6d54a 100644
--- a/Modules/PhotoacousticsAlgorithms/Documentation/doxygen/PAModule.dox
+++ b/Modules/PhotoacousticsAlgorithms/Documentation/doxygen/PAModule.dox
@@ -1,45 +1,45 @@
/**
\page PAModulePage Photoacoustic Algorithms Module
\tableofcontents
\section PAModulePageOverview Overview
The Photoacoustic Algorithms Module provides a <strong>set of filters for beamforming and post-processing of photoacoustic and ultrasound data</strong>.
The main features are:
<ul>
<li> Management of all filters through a single class PhotoacousticImage
<li> Beamforming of ultrasound and photoacoustic image data.
<ul>
<li> Beamforming using the DAS and DMAS Algorithms.
<li> Optional real-time beamforming capabilities by the usage of openCL GPU computing
</ul>
<li> Post/Pre-Processing of any kind of images.
<ul>
<li> Crop Filter for removing artefacts in upper and lower edge of the image.
<li> Multiple B-Mode Filter implementations with resampling and logarithmic filter.
<li> Bandpass Filter
</ul>
</ul>
To use the GPU capabilities of this module, openCL needs to be activated in CMAKE. The custom build option "camiPhotoacousticsWorkstation" activates all needed CMAKE options, as well as openCL.
To build the project using openCL, the openCL libraries provided by your graphic card vendor need to be installed. The GPU capabilies of this module have been only tested using nvidia hardware, but, as openCL has been also implemented by AMD, this should work on either one. (Those are included in the CUDA package for nvidia graphic card owners)
The \link org_mitk_gui_qt_photoacoustics_imageprocessing Photoacoustic Imageprocessing plugin \endlink provides a GUI to access all of thePhotoacoustic Algorithms Module's filters.
\section PAModuleClasses The Photoacoustic Algorithms Module's Classes
<ul>
<li> mitk::PhotoacousticImage: The class where all filters are managed.
<li> mitk::BeamformingSettings: The class used by many filters for storing the configuration to be used when applying them.
<li> Five filters are currently implemented in the Photoacoustic Algorithms module:
<ul>
- <li> mitk::PhotoacousticBModeFilter/mitk::PhotoacousticOCLBModeFilter: Two classes for the B-Mode filter on GPU and CPU.
+ <li> mitk::PhotoacousticBModeFilter: A class for the B-Mode filter on GPU and CPU.
<li> Resampling Filter: A resampling filter for post-processing.
<li> mitk::BeamformingFilter: A filter with a switch for GPU/CPU computation, to compute the beamformed image out of raw ultrasound/photoacoustic data.
<li> Crop Filter: A filter for cropping artifacts on the upper and lower edges of the image.
<li> Bandpass Filter: A Filter to filter image data in the fourier domain, using a tukey window to cut off low or high frequency parts of the image.
</ul>
</li>
</ul>
*/
\ No newline at end of file
diff --git a/Modules/PhotoacousticsAlgorithms/include/mitkPhotoacousticFilterService.h b/Modules/PhotoacousticsAlgorithms/include/mitkPhotoacousticFilterService.h
index 5a59fd5746..4bc3447162 100644
--- a/Modules/PhotoacousticsAlgorithms/include/mitkPhotoacousticFilterService.h
+++ b/Modules/PhotoacousticsAlgorithms/include/mitkPhotoacousticFilterService.h
@@ -1,126 +1,129 @@
/*============================================================================
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 mitkPhotoacousticFilterService_H_HEADER_INCLUDED
#define mitkPhotoacousticFilterService_H_HEADER_INCLUDED
#include "itkObject.h"
#include "mitkCommon.h"
#include "mitkImage.h"
#include <functional>
#include "mitkBeamformingSettings.h"
#include "mitkBeamformingFilter.h"
#include "MitkPhotoacousticsAlgorithmsExports.h"
namespace mitk {
/*!
* \brief Class holding methods to apply all Filters within the Photoacoustics Algorithms Module
*
* Implemented are:
* - A B-Mode Filter
* - A Resampling Filter
* - Beamforming on GPU and CPU
* - A Bandpass Filter
*/
class MITKPHOTOACOUSTICSALGORITHMS_EXPORT PhotoacousticFilterService : public itk::Object
{
public:
mitkClassMacroItkParent(mitk::PhotoacousticFilterService, itk::Object);
itkFactorylessNewMacro(Self);
/** \brief Defines the methods for the B-Mode filter
* Currently implemented are an Envelope Detection filter and a simple Absolute filter.
*/
enum BModeMethod { EnvelopeDetection, Abs };
/** \brief Applies a B-Mode Filter
*
* Applies a B-Mode filter using the given parameters.
* @param inputImage The image to be processed.
* @param method The kind of B-Mode Filter to be used.
* @param UseLogFilter Setting this to true will apply a simple logarithm to the image after the B-Mode Filter has been applied.
- * @param resampleSpacing If this is set to 0, nothing will be done; otherwise, the image is resampled to a spacing of resampleSpacing mm per pixel.
* @return The processed image is returned after the filter has finished.
*/
mitk::Image::Pointer ApplyBmodeFilter(mitk::Image::Pointer inputImage,
BModeMethod method = BModeMethod::Abs,
bool UseLogFilter = false);
/** \brief Resamples the given image
*
* Resamples an image using the given parameters.
* @param inputImage The image to be processed.
- * @param outputSize An array of dimensions the image should be resampled to.
+ * @param outputSpacing An array of dimensions the image should be resampled to.
* @return The processed image is returned after the filter has finished.
*/
mitk::Image::Pointer ApplyResampling(mitk::Image::Pointer inputImage, double* outputSpacing);
mitk::Image::Pointer ApplyResamplingToDim(mitk::Image::Pointer inputImage, double* outputDimension);
/** \brief Beamforms the given image
*
* Resamples an image using the given parameters.
* @param inputImage The image to be processed.
* @param config The configuration set to be used for beamforming.
* @param progressHandle An std::function<void(int, std::string)>, through which progress of the currently updating filter is reported.
* The integer argument is a number between 0 an 100 to indicate how far completion has been achieved, the std::string argument indicates what the filter is currently doing.
* @return The processed image is returned after the filter has finished.
*/
mitk::Image::Pointer ApplyBeamforming(mitk::Image::Pointer inputImage, BeamformingSettings::Pointer config, std::function<void(int, std::string)> progressHandle = [](int, std::string) {});
/** \brief Crops the given image
*
* Crops an image in 3 dimension using the given parameters.
* @param inputImage The image to be processed.
* @param above How many voxels will be cut from the top of the image.
* @param below How many voxels will be cut from the bottom of the image.
* @param right How many voxels will be cut from the right side of the image.
* @param left How many voxels will be cut from the left side of the image.
* @param minSlice The first slice to be present in the resulting volume.
* @param maxSlice How many slices are cut off from the end of the volume.
+ * @param errCode
* @return The processed image is returned after the filter has finished. For the purposes of this module, the returned image is always of type float.
*/
mitk::Image::Pointer ApplyCropping(mitk::Image::Pointer inputImage, int above, int below, int right, int left, int minSlice, int maxSlice, int* errCode);
mitk::Image::Pointer ExtendImage(mitk::Image::Pointer inputImage, float pixelColor, unsigned int outputDimensionY);
/** \brief Applies a Bandpass filter to the given image
*
* Applies a bandpass filter to the given image using the given parameters.
* @param data The image to be processed.
* @param BPHighPass The position at which Lower frequencies are completely cut off in Hz.
* @param BPLowPass The position at which Higher frequencies are completely cut off in Hz.
* @param alphaHighPass The high pass tukey window parameter to control the shape of the bandpass filter: 0 will make it a Box function, 1 a Hann function. alpha can be set between those two bounds.
* @param alphaLowPass The low passtukey window parameter to control the shape of the bandpass filter: 0 will make it a Box function, 1 a Hann function. alpha can be set between those two bounds.
+ * @param timeSpacing
+ * @param SpeedOfSound
+ * @param IsBFImage
* @return The processed image is returned after the filter has finished.
*/
mitk::Image::Pointer ApplyBandpassFilter(mitk::Image::Pointer data,
float BPHighPass, float BPLowPass,
float alphaHighPass, float alphaLowPass,
float timeSpacing, float SpeedOfSound, bool IsBFImage);
protected:
PhotoacousticFilterService();
~PhotoacousticFilterService() override;
/** \brief
For performance reasons, an instance of the Beamforming filter is initialized as soon as possible and kept for all further uses.
*/
mitk::BeamformingFilter::Pointer m_BeamformingFilter;
mitk::Image::Pointer ConvertToFloat(mitk::Image::Pointer);
};
} // namespace mitk
#endif /* mitkPhotoacousticFilterService_H_HEADER_INCLUDED */
diff --git a/Modules/PhotoacousticsAlgorithms/include/mitkPhotoacousticMotionCorrectionFilter.h b/Modules/PhotoacousticsAlgorithms/include/mitkPhotoacousticMotionCorrectionFilter.h
index 8e8dcb3bfa..de4d9124dc 100644
--- a/Modules/PhotoacousticsAlgorithms/include/mitkPhotoacousticMotionCorrectionFilter.h
+++ b/Modules/PhotoacousticsAlgorithms/include/mitkPhotoacousticMotionCorrectionFilter.h
@@ -1,307 +1,307 @@
/*============================================================================
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 _MITKPHOTOACOUSTICSMOTIONCORRECTIONFILTER_H_
#define _MITKPHOTOACOUSTICSMOTIONCORRECTIONFILTER_H_
#include "mitkImageToImageFilter.h"
#include <itkObject.h>
#include "opencv2/imgproc.hpp"
// TODO: Find out why build fails with this option or replace with something
// else
/* #include "opencv2/opencv.hpp" */
#include "opencv2/video/tracking.hpp"
#include "itkOpenCVImageBridge.h"
#include <MitkPhotoacousticsAlgorithmsExports.h>
#include "mitkImageCast.h"
#include <mitkImageToOpenCVImageFilter.h>
#include <mitkOpenCVToMitkImageFilter.h>
#include <mitkImageStatisticsHolder.h>
#define IMAGE_DIMENSION 3 /*!< All images need to have dimension 3*/
#define MAX_MATRIX 255.0 /*!< Rescaling constant to maximum character*/
namespace mitk
{
/*!
* \brief Class implementing a mitk::ImageToImageFilter for PAUS motion
* correction.
*
* The filter takes a stack of PA and US images. It then computes the optical
* flow
* within the US image and compensates the PA and US images for the flow.
* Afterwards it
* returns the stack of PA and US images.
*
* @see
* https://docs.opencv.org/3.0-beta/modules/video/doc/motion_analysis_and_object_tracking.html#calcopticalflowfarneback
*/
class MITKPHOTOACOUSTICSALGORITHMS_EXPORT PhotoacousticMotionCorrectionFilter : public ImageToImageFilter
{
public:
mitkClassMacro(PhotoacousticMotionCorrectionFilter, ImageToImageFilter);
itkFactorylessNewMacro(Self);
// Setters and Getters for the class variables
itkSetMacro(BatchSize, unsigned int);
itkSetMacro(PyrScale, double);
itkSetMacro(Levels, unsigned int);
itkSetMacro(WinSize, unsigned int);
itkSetMacro(Iterations, unsigned int);
itkSetMacro(PolyN, unsigned int);
itkSetMacro(PolySigma, double);
itkSetMacro(Flags, unsigned int);
itkGetConstMacro(BatchSize, unsigned int);
itkGetConstMacro(PyrScale, double);
itkGetConstMacro(Levels, unsigned int);
itkGetConstMacro(WinSize, unsigned int);
itkGetConstMacro(Iterations, unsigned int);
itkGetConstMacro(PolyN, unsigned int);
itkGetConstMacro(PolySigma, double);
itkGetConstMacro(Flags, unsigned int);
// Wrapper for SetInput, GetInput and GetOutput
/*!
* \brief Wrapper which sets the photoacoustic image as the correct input
*
* This method is a wrapper around the @c SetInput method. It is implemented
* for convenience such that you do not have to remember which input is for
* which image.
*
* @param input The photoacoustic image
*/
- void SetPaInput(mitk::Image::Pointer);
+ void SetPaInput(mitk::Image::Pointer input);
/*!
* \brief Wrapper which gets the photoacoustic image out of the correct input
*
* This method is a wrapper around the @c GetInput method. It is implemented
* for convenience such that you do not have to remember which input is for
* which image.
*
* @return The photoacoustic image
*/
mitk::Image::Pointer GetPaInput();
/*!
* \brief Wrapper which sets the ultrasonic image as the correct input
*
* This method is a wrapper around the @c SetInput method. It is implemented
* for convenience such that you do not have to remember which input is for
* which image.
*
* @param input The ultrasonic image
*/
- void SetUsInput(mitk::Image::Pointer);
+ void SetUsInput(mitk::Image::Pointer input);
/*!
* \brief Wrapper which gets the ultrasonic image out of the correct input
*
* This method is a wrapper around the @c GetInput method. It is implemented
* for convenience such that you do not have to remember which input is for
* which image.
*
* @return The ultrasonic image
*/
mitk::Image::Pointer GetUsInput();
/*!
* \brief Wrapper which gets the photoacoustic image out of the correct output
*
* This method is a wrapper around the @c GetOutput method. It is implemented
* for convenience such that you do not have to remember which output is for
* which image.
*
* @return The photoacoustic image
*/
mitk::Image::Pointer GetPaOutput();
/*!
* \brief Wrapper which gets the ultrasonic image out of the correct output
*
* This method is a wrapper around the @c GetOutput method. It is implemented
* for convenience such that you do not have to remember which output is for
* which image.
*
* @return The ultrasonic image
*/
mitk::Image::Pointer GetUsOutput();
protected:
PhotoacousticMotionCorrectionFilter();
~PhotoacousticMotionCorrectionFilter() override;
/*!
* \brief Apply OpenCV algorithm to compensate motion in a 2d image time
* series
*
* This method uses two 3d mitk images. Both will be interpreted as time
* series of 2d images. @c GetInput(0) should be a photoacoustic image whereas
* @c GetInput(1) should be an ultrasound image. The input will be validated
* and then converted to OpenCV matrices. In the end the Farneback algorithm
* will be used to compute the optical flow in consecutive images and
* compensate for this flow. The Output will be two 3d mitk images of the same
* dimensions as the input containing the compensated data.
*
* @warning The input images need to be 3-dimensional (with the same size in
* each dimension). Otherwise, an @c invalid_argument exception will be
* thrown.
* @throws invalid_argument
*/
void GenerateData() override;
/*!
* \brief Validate the input images
*
* The input images have to be non-empty, 3d and have to coincide in the
* length in each dimension. If any of these conditions are violated, the
* method will throw an @c invalid_argument exception.
*
* @param paImage A mitk image
* @param usImage A mitk image
* @warning If the two images are not 3d and do not coincide in the length in
* each dimension, this method will throw an @c invalid_argument exception.
* @throws invalid_argument
*/
void CheckInput(mitk::Image::Pointer paImage, mitk::Image::Pointer usImage);
/*!
* \brief Assure that the output images have the same dimensions as the input
* images.
*
* The output images need to have the same dimensions as the input images.
* This will be checked here. If the dimensions do not match, the output will
* be reinitialized and the image data from the input images will be copied to
* the output images (in order to make sure that they have a valid data
* pointer).
*
* @param paInput Pointer to the photoacoustic input image
* @param usInput Pointer to the ultrasonic input image
* @param paOutput Pointer to the photoacoustic output image
* @param usOutput Pointer to the ultrasonic output image
*/
void InitializeOutputIfNecessary(mitk::Image::Pointer paInput,
mitk::Image::Pointer usInput,
mitk::Image::Pointer paOutput,
mitk::Image::Pointer usOutput);
/*!
* \brief Copy the image data from the input image to the output image
*
* This method copys the image data from @p input to @p output. This method
* assumes that the dimensions of the two images match and will not test this.
*
* @param input A mitk image
* @param output A mitk image
*/
void InitializeOutput(mitk::Image::Pointer input, mitk::Image::Pointer output);
/*!
* \brief This method performs the actual motion compensation.
*
* This method uses the ultrasonic input image @p usInput to compute the
* optical flow in the time series of 2d images. Then it compensates both the
* @p usInput and @p paInput for it and saves the result in @p usOutput and @p
* paOutput respectively. In the background the OpenCV Farneback algorithm is
* used for the flow determination.
*
* @param paInput The photoacoustic input image
* @param usInput The ultrasonic input image
* @param paOutput The photoacoustic output image
* @param usOutput The ultrasonic output image
*/
void PerformCorrection(mitk::Image::Pointer paInput,
mitk::Image::Pointer usInput,
mitk::Image::Pointer paOutput,
mitk::Image::Pointer usOutput);
/*!
* \brief Extract a 2d slice as OpenCV matrix.
*
* This method extracts slice @p i from the 3-dimensional image @p input and
* converts it to a OpenCV matrix. Internally, the
* mitkImageToOpenCVImageFilter is used.
*
* @param input A 3d image from which a slice is extracted as a 2d OpenCV
* matrix.
* @param i Determines the slice to be extracted.
* @return returns a OpenCV matrix containing the 2d slice.
*/
cv::Mat GetMatrix(const mitk::Image::Pointer input, unsigned int i);
/*!
* \brief Rescale matrix such that the values lie between 0 and 255
*
* This method rescales the matrix such that its values lie between 0 and 255. In order to do that it uses the maximum and the minimum of the input ultrasonic image.
*
* @warning This is a specialized method which does not perform the operation in general, but only if the matrix stems from the right ultrasonic image. Therefore, the method should only be called internally.
*
* @param mat The OpenCV matrix to be rescaled
* @return The rescaled OpenCV matrix
*/
cv::Mat FitMatrixToChar(cv::Mat mat);
/*!
* \brief Insert a OpenCV matrix as a slice into an image
*
* This method converts the 2d OpenCV matrix @p mat into an mitk image using
* the mitkOpenCVToMitkImageFilter. Afterwards it inserts the image as slice
* @p i into the 3d mitk image @p output.
*
* @param mat The matrix to be inserted as a slice
* @param output The 3d image the matrix is inserted into
* @param i The index of the slice to be replaced.
*/
void InsertMatrixAsSlice(cv::Mat mat, mitk::Image::Pointer output, unsigned int i);
/*!
* \brief Compute the remapping map from an optical flow
*
* The optical flow cannot be used directly to compensate an image. Instead we have to generate an appropriate map.
*
* @param flow The optical flow which is the base for the remapping.
* @return The remapping map.
*/
- cv::Mat ComputeFlowMap(cv::Mat);
+ cv::Mat ComputeFlowMap(cv::Mat flow);
private:
// Parameters
double m_PyrScale; /*!< See @c pyr_scale in @c cv::calcOpticalFlowFarneback
*/
double m_PolySigma; /*!< See @c poly_sigma in @c cv::calcOpticalFlowFarneback
*/
unsigned int m_Levels; /*!< See @c levels in @c cv::calcOpticalFlowFarneback */
unsigned int m_WinSize; /*!< See @c winsize in @c cv::calcOpticalFlowFarneback */
unsigned int m_Iterations; /*!< See @c iterations in @c cv::calcOpticalFlowFarneback */
unsigned int m_PolyN; /*!< See @c poly_n in @c cv::calcOpticalFlowFarneback */
unsigned int m_Flags; /*!< See @c flags in @c cv::calcOpticalFlowFarneback */
unsigned int m_BatchSize; /*!< Determines how many slices belong together and will be
motion compensated with regard to the first image in the
batch. If the variable is set to 0, the whole time series will
be processed as one batch. */
float m_MaxValue; /*!< The maximum of the ultrasonic image*/
float m_MinValue; /*!< The minimum of the ultrasonic image*/
// Stuff that OpenCV needs
cv::Mat m_UsRef; /*!< Contains the reference ultrasonic image to which the
motion compensation is compared to.*/
cv::Mat m_Flow; /*!< Contains the optical flow between @c m_UsRef and @c m_UsMat*/
cv::Mat m_PaRes; /*!< Contains the motion compensated photoacoustic image*/
cv::Mat m_UsRes; /*!< Contains the motion compensated ultrasonic image*/
cv::Mat m_PaMat; /*!< Contains the latest photoacoustic image to be motion compensated*/
cv::Mat m_UsMat; /*!< Contains the latest ultrasonic image on which the
optical flow is to be computed */
cv::Mat m_Map; /*!< Contains the remapping map */
mitk::OpenCVToMitkImageFilter::Pointer m_OpenCVToImageFilter =
mitk::OpenCVToMitkImageFilter::New(); /*!< Filter which converts an OpenCV matrix to a mitk image */
mitk::ImageToOpenCVImageFilter::Pointer m_ImageToOpenCVFilter =
mitk::ImageToOpenCVImageFilter::New(); /*!< Filter which converts a mitk image to an OpenCV matrix */
};
}
#endif
diff --git a/Modules/PhotoacousticsLib/include/mitkPAComposedVolume.h b/Modules/PhotoacousticsLib/include/mitkPAComposedVolume.h
index b41915ef83..da76c63790 100644
--- a/Modules/PhotoacousticsLib/include/mitkPAComposedVolume.h
+++ b/Modules/PhotoacousticsLib/include/mitkPAComposedVolume.h
@@ -1,86 +1,86 @@
/*============================================================================
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 MITKPHOTOACOUSTICCOMPOSEDVOLUME_H
#define MITKPHOTOACOUSTICCOMPOSEDVOLUME_H
#include <MitkPhotoacousticsLibExports.h>
#include <mitkPAInSilicoTissueVolume.h>
#include <mitkPAFluenceYOffsetPair.h>
#include <vector>
//Includes for smart pointer usage
#include "mitkCommon.h"
#include "itkLightObject.h"
namespace mitk {
namespace pa {
/**
* @brief The ComposedVolume class provides the means to systematically collect nrrd files that correspond to
* different simulation slices of the same InSilicoTissueVolume.
*
* An instance of this class is needed for the SlicedVolumeGenerator
*/
class MITKPHOTOACOUSTICSLIB_EXPORT ComposedVolume : public itk::Object
{
public:
mitkClassMacroItkParent(ComposedVolume, itk::Object);
mitkNewMacro1Param(Self, InSilicoTissueVolume::Pointer);
/**
* @brief fluenceYOffsetPair
*
- * @param nrrdFile path to the nrrd file on hard drive
+ * @param fluenceYOffsetPair
*/
void AddSlice(mitk::pa::FluenceYOffsetPair::Pointer fluenceYOffsetPair);
/**
* @brief GetNumberOfFluenceComponents
* @return the number of fluence components encapsuled by this ComposedVolume.
*/
int GetNumberOfFluenceComponents();
/**
* @brief GetFluenceValue
* @param fluenceComponent
* @param x
* @param y
* @param z
* @return the fluence value for a specific fluence component index at the given 3D location.
*/
double GetFluenceValue(int fluenceComponent, int x, int y, int z);
/**
* @brief GetYOffsetForFluenceComponentInPixels
* @param fluenceComponent
* @return the y-offset value for a given fluence component index.
*/
int GetYOffsetForFluenceComponentInPixels(int fluenceComponent);
void Sort();
itkGetMacro(GroundTruthVolume, InSilicoTissueVolume::Pointer);
protected:
ComposedVolume(InSilicoTissueVolume::Pointer groundTruthVolume);
~ComposedVolume() override;
private:
int m_FluenceComponents;
InSilicoTissueVolume::Pointer m_GroundTruthVolume;
std::vector<mitk::pa::FluenceYOffsetPair::Pointer> m_FluenceValues;
};
}
}
#endif // MITKPHOTOACOUSTICCOMPOSEDVOLUME_H
diff --git a/Modules/PhotoacousticsLib/include/mitkPAIOUtil.h b/Modules/PhotoacousticsLib/include/mitkPAIOUtil.h
index 3135e135be..d2a5d01b19 100644
--- a/Modules/PhotoacousticsLib/include/mitkPAIOUtil.h
+++ b/Modules/PhotoacousticsLib/include/mitkPAIOUtil.h
@@ -1,118 +1,120 @@
/*============================================================================
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 MITKPHOTOACOUSTICIO_H
#define MITKPHOTOACOUSTICIO_H
#include "MitkPhotoacousticsLibExports.h"
#include <map>
#include <mutex>
#include <thread>
//Includes for smart pointer usage
#include "mitkCommon.h"
#include "itkLightObject.h"
#include "mitkPAVolume.h"
#include <mitkPAInSilicoTissueVolume.h>
#include <mitkPAFluenceYOffsetPair.h>
namespace mitk {
namespace pa {
class MITKPHOTOACOUSTICSLIB_EXPORT IOUtil final
{
public:
struct Position
{
int x, z;
bool operator <(const Position& rhs) const
{
return (x < rhs.x || ((x == rhs.x) && z < rhs.z));
}
};
/**
* @brief LoadFluenceContributionMaps loads multiple nrrd files from a given folder
* and sorts them into a position map if such meta information is available in
- * the filename. </br>
+ * the filename.
+ *
* As this method was specifically designed to load many fluence files, the
- * naming convention for the position values is: </br>
+ * naming convention for the position values is:
*
* <b>*_pN,N,NFluence*.nrrd</b>
*
* @param foldername
* @param blur
* @param progress
+ * @param log10
*
* @return
*/
static std::map<Position, Volume::Pointer> LoadFluenceContributionMaps(
std::string foldername, double blur, int* progress, bool log10 = false);
/**
* @brief loads a nrrd file from a given filename.
* @param filename
* @param sigma
* @return nullptr if the given filename was invalid.
*/
static Volume::Pointer LoadNrrd(std::string filename, double sigma = 0);
/**
*@brief returns the number of .nrrd files in a given directory
*/
static int GetNumberOfNrrdFilesInDirectory(std::string directory);
/**
*@brief returns a list of all .nrrd files in a given directory
*/
static std::vector<std::string> GetListOfAllNrrdFilesInDirectory(
std::string directory, bool keepFileFormat = false);
/**
*@brief convenience method to check wether a given strings ends on a given substring.
*@return false if the substring is longer than the string or if the strings are empty.
*/
static bool DoesFileHaveEnding(std::string const &fullString, std::string const &ending);
/**
*@brief returns all child folders from a folder if there is no .nrrd file in the folder
* If there IS a .nrrd file in the folder this method will return the given folder path.
*/
static std::vector<std::string> GetAllChildfoldersFromFolder(std::string folderPath);
/**
*@brief loads an in silico tissue volume from a saved nrrd file.
*/
static InSilicoTissueVolume::Pointer LoadInSilicoTissueVolumeFromNrrdFile(std::string filePath);
/**
* @brief LoadFluenceSimulation
* Adds a MC Simulation nrrd file to this composed volume.
* The given file needs to contain the meta information "y-offset".
* This method ensures that all added slices are in the correct order
* corresponding to their y-offset.
*
- * @param nrrdFile path to the nrrd file on hard drive
+ * @param fluenceSimulation path to the nrrd file on hard drive
*/
static FluenceYOffsetPair::Pointer LoadFluenceSimulation(std::string fluenceSimulation);
private:
IOUtil();
~IOUtil();
};
}
}
#endif // MITKPHOTOACOUSTICIO_H
diff --git a/Modules/PhotoacousticsLib/include/mitkPALinearSpectralUnmixingFilter.h b/Modules/PhotoacousticsLib/include/mitkPALinearSpectralUnmixingFilter.h
index fa03b40789..c62b88d87b 100644
--- a/Modules/PhotoacousticsLib/include/mitkPALinearSpectralUnmixingFilter.h
+++ b/Modules/PhotoacousticsLib/include/mitkPALinearSpectralUnmixingFilter.h
@@ -1,100 +1,100 @@
/*============================================================================
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 MITKLINEARPHOTOACOUSTICSPECTRALUNMIXINGFILTER_H
#define MITKLINEARPHOTOACOUSTICSPECTRALUNMIXINGFILTER_H
#include <mitkPASpectralUnmixingFilterBase.h>
#include <MitkPhotoacousticsLibExports.h>
namespace mitk {
namespace pa {
/**
* \brief This filter is subclass of the spectral unmixing filter base. All algorithms in this class are
* based on the Eigen open source c++ library. It takes a multispectral pixel as input and returns a vector
* with the unmixing result.
*
* Input:
* - endmemberMatrix Eigen Matrix with number of chromophores colums and number of wavelengths rows so matrix element (i,j) contains
* the absorbtion of chromophore j @ wavelength i taken from the database by PropertyElement method.
* - inputVector Eigen Vector containing values of one pixel of XY-plane image with number of wavelength rows (z-dimension of a sequenece)
* so the pixelvalue of the first wavelength is stored in inputVector[0] and so on.
*
* Output:
* - Eigen vector with unmixing result of one multispectral pixel. The ith element of the vector corresponds to the ith entry of the
* m_Chromophore vector.
*
* Algorithms (see AlgortihmType enum):
* - HOUSEHOLDERQR computes the solution by QR decomposition
* - COLPIVHOUSEHOLDERQR computes the solution by QR decomposition
* - FULLPIVHOUSEHOLDERQR computes the solution by QR decomposition
* - LDLT computes the solution by Cholesky decomposition
* - LLT computes the solution by Cholesky decomposition
* - JACOBISVD computes the solution by singular value decomposition uses least square solver
*
* Possible exceptions:
* - "algorithm not working": doesn't work now (2018/06/19)
* - "404 VIGRA ALGORITHM NOT FOUND": Algorithm not implemented
*/
class MITKPHOTOACOUSTICSLIB_EXPORT LinearSpectralUnmixingFilter : public SpectralUnmixingFilterBase
{
public:
mitkClassMacro(LinearSpectralUnmixingFilter, SpectralUnmixingFilterBase);
itkFactorylessNewMacro(Self);
/**
* \brief Contains all implemented Eigen algorithms for spectral unmixing. For detailed information of the algorithms look at the
* mitkPALinearSpectralUnmixingFilter.h documentation (section Algorithms).
*/
enum AlgortihmType
{
HOUSEHOLDERQR,
LDLT,
LLT,
COLPIVHOUSEHOLDERQR,
JACOBISVD,
FULLPIVLU,
FULLPIVHOUSEHOLDERQR
};
/**
* \brief Takes a mitk::pa::LinearSpectralUnmixingFilter::AlgortihmType and fix it for usage at the "SpectralUnmixingAlgorithm" method.
- * @param algorithmName has to be a mitk::pa::LinearSpectralUnmixingFilter::AlgortihmType
+ * @param inputAlgorithmName has to be a mitk::pa::LinearSpectralUnmixingFilter::AlgortihmType
*/
void SetAlgorithm(AlgortihmType inputAlgorithmName);
protected:
LinearSpectralUnmixingFilter();
~LinearSpectralUnmixingFilter() override;
/**
* \brief overrides the baseclass method with a mehtod to calculate the spectral unmixing result vector. Herain the class performs the
* algorithm set by the "SetAlgorithm" method and writes the result into a Eigen vector which is the return value.
* @param endmemberMatrix Matrix with number of chromophores colums and number of wavelengths rows so matrix element (i,j) contains
* the absorbtion of chromophore j @ wavelength i taken from the database by PropertyElement method.
* @param inputVector Vector containing values of one pixel of XY-plane image with number of wavelength rows (z-dimension of a sequenece)
* so the pixelvalue of the first wavelength is stored in inputVector[0] and so on.
* @throws if the algorithmName is not a member of the enum VigraAlgortihmType
* @throws if one chooses the ldlt/llt solver which doens't work yet
*/
Eigen::VectorXf SpectralUnmixingAlgorithm(Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic> endmemberMatrix,
Eigen::VectorXf inputVector) override;
private:
AlgortihmType algorithmName;
};
}
}
#endif // MITKLINEARPHOTOACOUSTICSPECTRALUNMIXINGFILTER_H
diff --git a/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingFilterBase.h b/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingFilterBase.h
index 9dc1fcdf0c..dce6a5d2ce 100644
--- a/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingFilterBase.h
+++ b/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingFilterBase.h
@@ -1,194 +1,194 @@
/*============================================================================
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 MITKPHOTOACOUSTICSPECTRALUNMIXINGFILTERBASE_H
#define MITKPHOTOACOUSTICSPECTRALUNMIXINGFILTERBASE_H
#include "mitkImageToImageFilter.h"
#include <MitkPhotoacousticsLibExports.h>
//Includes for smart pointer usage
#include "mitkCommon.h"
#include "itkLightObject.h"
// Includes for AddEnmemberMatrix
#include "mitkPAPropertyCalculator.h"
#include <eigen3/Eigen/Dense>
namespace mitk {
namespace pa {
/**
* \brief The spectral unmixing filter base is designed as superclass for several spectral unmixing filter eg. Eigen- or Vigrabased ones.
* One can add wavelengths and chromophores and get a unmixed output images out of one MITK input image using algorithms from the subclasses.
*
* Input:
* The unmixing input has to be a 3D MITK image where the XY-plane is a image and the Z-direction represents recordings for different
* wavelengths. Herein a XY-plane for a specific Z-direction will be called "image". Every image has to be assigned to a certain wavelength.
* The "AddWavelength" uses "push_back" to write float values into a vector. The first wavelength will correspond to the first image!!!
* If there a more input images 'I' then added wavelengths 'w' the filter base interprets the next x images as repetition sequence of the same
* wavelengths. If I % w !=0 the surplus image(s) will be dropped.
* Addtionaly one has to add chromophores from the property calculator class enum "ChromophoreType" with the "AddChromophore" method.
* This method as well uses "push_back" but the chosen (arbitary) order will be the order of the outputs.
*
* Output:
* The output will be one MITK image per chosen chromophore. Where the XY-plane is a image and the Z-direction represents recordings for different
* sequences. Furthermore it is possible to creat an output image that contains the information about the relative error between unmixing result
* and the input image.
*
* Subclasses:
* - mitkPASpectralUnmixingFilterVigra
* - mitkPALinearSpectralUnmixingFilter (uses Eigen algorithms)
* - mitkPASpectralUnmixingFilterSimplex
*
* Possible exceptions:
* - "PIXELTYPE ERROR! FLOAT 32 REQUIRED": The MITK input image has to consist out of floats.
* - "ERROR! REMOVE WAVELENGTHS!": One needs at least the same amount of images (z-dimension) then added wavelengths.
* - "ADD MORE WAVELENGTHS!": One needs at least the same amount of wavelengths then added chromophores.
* - "WAVELENGTH XXX nm NOT SUPPORTED!": The wavelength is not part of the proptery calculater data base. The data base can be found @
- * [...]\mitk\Modules\PhotoacousticsLib\Resources\spectralLIB.dat
+ * [...]/mitk/Modules/PhotoacousticsLib/Resources/spectralLIB.dat
* - "ADD OUTPUTS HAS TO BE LARGER THEN ZERO!"
* - "NO WAVELENGHTS/CHROMOPHORES SELECZED!
* - "INDEX ERROR! NUMBER OF OUTPUTS DOESN'T FIT TO OTHER SETTIGNS!"
*/
class MITKPHOTOACOUSTICSLIB_EXPORT SpectralUnmixingFilterBase : public mitk::ImageToImageFilter
{
public:
mitkClassMacro(SpectralUnmixingFilterBase, mitk::ImageToImageFilter);
/**
* \brief AddChromophore takes mitk::pa::PropertyCalculator::ChromophoreType and writes them at the end of the m_Chromophore vector.
* The call of the method sets the order of the GetOutput method!
*
* @param chromophore has to be element of porperty calculater enum chromophore type
* @return for wavelength smaller then 300nm and larger then 1000nm the return will be 0, because not at the data base (2018/06/19)
*/
void AddChromophore(mitk::pa::PropertyCalculator::ChromophoreType chromophore);
/**
* \brief AddWavelength takes integers and writes them at the end of the m_Wavelength vector. The first call of the method then
* corresponds to the first input image and so on.
* @param wavelength database supports integers between 300 and 1000 nm
*/
void AddWavelength(int wavelength);
/*
* \brief Verbose gives more information to the console. Default value is false.
* @param verbose is the boolian to activate the MITK_INFO logged to the console
*/
virtual void Verbose(bool verbose);
/**
* \brief AddOutputs takes an integer and sets indexed outputs
* @param outputs integer correponds to the number of output images
* @throws if outputs == 0
*/
virtual void AddOutputs(unsigned int outputs);
/*
* \brief RelativeError returns a image which compare the L2 norm of the input vector with the unmixing result
* @param relativeError is the boolian to activate this tool
*/
virtual void RelativeError(bool relativeError);
/**
* \brief AddRelativeErrorSettings takes integers and writes them at the end of the m_RelativeErrorSettings vector.
* @param value has to be a integer
*/
virtual void AddRelativeErrorSettings(int value);
- ofstream myfile; // just for testing purposes; has to be removeed
+ std::ofstream myfile; // just for testing purposes; has to be removeed
protected:
/**
* \brief Constructor creats proptery calculater smart pointer new()
*/
SpectralUnmixingFilterBase();
~SpectralUnmixingFilterBase() override;
/**
* \brief The subclasses will override the mehtod to calculate the spectral unmixing result vector.
* @param endmemberMatrix Matrix with number of chromophores colums and number of wavelengths rows so matrix element (i,j) contains
* the absorbtion of chromophore j @ wavelength i taken from the database by PropertyElement method.
* @param inputVector Vector containing values of one pixel of XY-plane image with number of wavelength rows (z-dimension of a sequenece)
* so the pixelvalue of the first wavelength is stored in inputVector[0] and so on.
* @throws if algorithm implementiation fails (implemented for the algorithms with critical requirements)
*/
virtual Eigen::VectorXf SpectralUnmixingAlgorithm(Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic> endmemberMatrix,
Eigen::VectorXf inputVector) = 0;
bool m_Verbose = false;
bool m_RelativeError = false;
std::vector<mitk::pa::PropertyCalculator::ChromophoreType> m_Chromophore;
std::vector<int> m_Wavelength;
std::vector<int> m_RelativeErrorSettings;
private:
/*
* \brief Initialized output images with the same XY-plane size like the input image and total size in z-direction equals number of sequences.
* The pixel type is set to float.
* @param totalNumberOfSequences = (unsigned int) (numberOfInputImages / numberOfWavelength) >= 1
*/
virtual void InitializeOutputs(unsigned int totalNumberOfSequences);
/*
* \brief Checks if there are a suitable amount of wavelengths and if the input image consists of floats.
* @param input pointer on the MITK input image
* @throws if there are more wavelength then images
* @throws if there are more chromophores then wavelengths
* @throws if the pixel type is not float 32
* @throws if no chromophores or wavelengths selected as input
* @throws if the number of indexed outputs does'nt fit to the expected number
*/
virtual void CheckPreConditions(mitk::Image::Pointer input);
/*
* \brief Inherit from the "ImageToImageFilter" Superclass. Herain it calls InitializeOutputs, CalculateEndmemberMatrix and
* CheckPreConditions methods and enables pixelwise access to do spectral unmixing with the "SpectralUnmixingAlgorithm"
* method. In the end the method writes the results into the new MITK output images.
*/
void GenerateData() override;
/*
* \brief Creats a Matrix with number of chromophores colums and number of wavelengths rows so matrix element (i,j) contains
* the absorbtion of chromophore j @ wavelength i. The absorbtion values are taken from the "PropertyElement" method.
* @param m_Chromophore is a vector of "PropertyCalculator::ChromophoreType" containing all selected chromophores for the unmixing
* @param m_Wavelength is a vector of integers containing all wavelengths of one sequence
*/
virtual Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic> CalculateEndmemberMatrix(
std::vector<mitk::pa::PropertyCalculator::ChromophoreType> m_Chromophore, std::vector<int> m_Wavelength);
/*
* \brief "PropertyElement" is the tool to access the absorbtion values out of the database using mitk::pa::PropertyCalculator::GetAbsorptionForWavelengt
* and checks if the requested wavelength is part of the database (not zero values). The "ONEENDMEMBER" is a pseudo absorber with static absorbtion 1
* at every wavelength and is therefor not part of the database. If this one is the selected chromophore the return value is 1 for every wavelength.
* @param wavelength has to be integer between 300 and 1000 nm
* @param chromophore has to be a mitk::pa::PropertyCalculator::ChromophoreType
* @throws if mitk::pa::PropertyCalculator::GetAbsorptionForWavelengt returns 0, because this means that the delivered wavelength is not in the database.
*/
virtual float PropertyElement(mitk::pa::PropertyCalculator::ChromophoreType, int wavelength);
/*
* \brief calculates the relative error between the input image and the unmixing result in the L2 norm
* @param endmemberMatrix is a Eigen matrix containing the endmember information
* @param inputVector is a Eigen vector containing the multispectral information of one pixel
* @param resultVector is a Eigen vector containing the spectral unmmixing result
*/
float CalculateRelativeError(Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic> endmemberMatrix,
Eigen::VectorXf inputVector, Eigen::VectorXf resultVector);
PropertyCalculator::Pointer m_PropertyCalculatorEigen;
};
}
}
#endif // MITKPHOTOACOUSTICSPECTRALUNMIXINGFILTERBASE_
diff --git a/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingFilterVigra.h b/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingFilterVigra.h
index 24b8cae547..f6d8f638b3 100644
--- a/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingFilterVigra.h
+++ b/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingFilterVigra.h
@@ -1,104 +1,104 @@
/*============================================================================
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 MITKPHOTOACOUSTICSPECTRALUNMIXINGFILTERVIGRA_H
#define MITKPHOTOACOUSTICSPECTRALUNMIXINGFILTERVIGRA_H
#include <mitkPASpectralUnmixingFilterBase.h>
#include <MitkPhotoacousticsLibExports.h>
#include <mitkPALinearSpectralUnmixingFilter.h>
namespace mitk {
namespace pa {
/**
* \brief This filter is subclass of the spectral unmixing filter base. All algorithms in this class are
* based on the vigra open source c++ library. It takes a multispectral pixel as input and returns a vector
* with the unmixing result.
*
* Input:
* - endmemberMatrix Eigen Matrix with number of chromophores colums and number of wavelengths rows so matrix element (i,j) contains
* the absorbtion of chromophore j @ wavelength i taken from the database by PropertyElement method.
* - inputVector Eigen Vector containing values of one pixel of XY-plane image with number of wavelength rows (z-dimension of a sequenece)
* so the pixelvalue of the first wavelength is stored in inputVector[0] and so on.
*
* Output:
* - Eigen vector with unmixing result of one multispectral pixel. The ith element of the vector corresponds to the ith entry of the
* m_Chromophore vector.
*
* Algorithms (see VigraAlgortihmType enum):
* - LARS algorithm minimizes (A*x-b)^2 s.t. x>=0 using least angle regression
* - GOLDFARB minimizes (A*x-b)^2 s.t. x>=0 using the Goldfarb-Idnani algorithm
* - WEIGHTED minimizes transpose(A*x-b)*diag(weights)*(A*x-b) using QR decomposition
* - LS minimizes (A*x-b)^2 using QR decomposition
*
* Possible exceptions:
* - "404 VIGRA ALGORITHM NOT FOUND": Algorithm not implemented
*/
class MITKPHOTOACOUSTICSLIB_EXPORT SpectralUnmixingFilterVigra : public SpectralUnmixingFilterBase
{
public:
mitkClassMacro(SpectralUnmixingFilterVigra, SpectralUnmixingFilterBase);
itkFactorylessNewMacro(Self);
/**
* \brief Contains all implemented Vigra algorithms for spectral unmixing. For detailed information of the algorithms look at the
* mitkPASpectralUnmixingFilterVigra.h documentation (section Algorithms).
*/
enum VigraAlgortihmType
{
LARS,
GOLDFARB,
WEIGHTED,
LS
};
/**
* \brief AddWeight takes integers and writes them at the end of the weightsvec vector. The first call of the method then
* corresponds to the first input image/wavelength and so on.
* @param weight is a percentage (integer) between 1 and 100
*/
void AddWeight(unsigned int weight);
/**
* \brief Takes a mitk::pa::SpectralUnmixingFilterVigra::VigraAlgortihmType and fix it for usage at the "SpectralUnmixingAlgorithm"
* method.
- * @param algorithmName has to be a mitk::pa::SpectralUnmixingFilterVigra::VigraAlgortihmType
+ * @param inputAlgorithmName has to be a mitk::pa::SpectralUnmixingFilterVigra::VigraAlgortihmType
*/
void SetAlgorithm(VigraAlgortihmType inputAlgorithmName);
protected:
SpectralUnmixingFilterVigra();
~SpectralUnmixingFilterVigra() override;
/**
* \brief overrides the baseclass method with a mehtod to calculate the spectral unmixing result vector. Herain it first converts the
* Eigen inputs to the Vigra class. Afterwards the class performs the algorithm set by the "SetAlgorithm" method and writes the result
* into a Eigen vector which is the return value.
- * @param endmemberMatrix Matrix with number of chromophores colums and number of wavelengths rows so matrix element (i,j) contains
+ * @param EndmemberMatrix Matrix with number of chromophores colums and number of wavelengths rows so matrix element (i,j) contains
* the absorbtion of chromophore j @ wavelength i taken from the database by PropertyElement method.
* @param inputVector Vector containing values of one pixel of XY-plane image with number of wavelength rows (z-dimension of a sequenece)
* so the pixelvalue of the first wavelength is stored in inputVector[0] and so on.
* @throws if the algorithmName is not a member of the enum VigraAlgortihmType
*/
Eigen::VectorXf SpectralUnmixingAlgorithm(Eigen::Matrix<float, Eigen::Dynamic, Eigen::Dynamic> EndmemberMatrix,
Eigen::VectorXf inputVector) override;
private:
std::vector<double> weightsvec;
SpectralUnmixingFilterVigra::VigraAlgortihmType algorithmName;
};
}
}
#endif // MITKPHOTOACOUSTICSPECTRALUNMIXINGFILTERVIGRA_H
diff --git a/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingSO2.h b/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingSO2.h
index 4104269af6..a1b90efcf6 100644
--- a/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingSO2.h
+++ b/Modules/PhotoacousticsLib/include/mitkPASpectralUnmixingSO2.h
@@ -1,112 +1,112 @@
/*============================================================================
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 MITKPHOTOACOUSTICSPECTRALUNMIXINGSO2_H
#define MITKPHOTOACOUSTICSPECTRALUNMIXINGSO2_H
#include "mitkImageToImageFilter.h"
#include <MitkPhotoacousticsLibExports.h>
//Includes for smart pointer usage
#include "mitkCommon.h"
#include "itkLightObject.h"
namespace mitk {
namespace pa {
/**
* \brief derives out of two identical sized MITK images the oxygen saturation and return one MITK image as result. Furthermore
* it is possible to set settings that the result shows just SO2 values above a threshold, or above a input value for Hb, HbO2 to
* get just a oxygen saturation image of interessting structures.
*
* Input:
* The input has to be two 3D MITK images. The order of the inputs matter! The first input has to be the Hb image the second input
* has to be the HbO2 image. The settings are integer values. The SO2 threshold therefore is percentage value.
*
* Output:
* The output will be one MITK image. Where one can see the oxygen saturation of all pixels above the set threholds. If a pixel is
* below a threhold or NAN then the value will be set to zero.
*
* UPDATE: SO2 Filter will get an second output, the total hemoglobin value with ->GetOutput(1).
*/
class MITKPHOTOACOUSTICSLIB_EXPORT SpectralUnmixingSO2 : public mitk::ImageToImageFilter
{
public:
mitkClassMacro(SpectralUnmixingSO2, mitk::ImageToImageFilter);
itkFactorylessNewMacro(Self);
/**
* \brief AddSO2Settings takes integers and writes them at the end of the m_SO2Settings vector.
* @param value of the Setting
*/
virtual void AddSO2Settings(int value);
/**
* \brief Verbose gives more information to the console. Default value is false.
- * @param m_Verbose is the boolian to activate the MITK_INFO logged to the console
+ * @param verbose is the boolian to activate the MITK_INFO logged to the console
*/
virtual void Verbose(bool verbose);
protected:
/**
* \brief Constructor sets number of input images to two and number of output images to one, respectively.
*/
SpectralUnmixingSO2();
~SpectralUnmixingSO2() override;
std::vector<int> m_SO2Settings;
bool m_Verbose = false;
private:
/**
* \brief Inherit from the "ImageToImageFilter" Superclass. Herain it calls InitializeOutputs and the CheckPreConditions
* methods and enables pixelwise access to the inputs to calculate the oxygen saturation via the "calculate SO2" method.
*/
void GenerateData() override;
/**
* \brief Initialized output images with the same size like the input image. The pixel type is set to float.
*/
virtual void InitializeOutputs();
/**
* \brief Checks if the dimensions of the input images are equal and made out of floating poinhts.
* @throws if the inputs don't have the same size
* @throws if input images don't consist of floats
*/
virtual void CheckPreConditions(mitk::Image::Pointer inputHbO2, mitk::Image::Pointer inputHb);
/**
* \brief calculates HbO2 / (Hb + HbO2) and afterwards checks if the result is significant (SO2ValueNotSiginificant method).
* If not the method returns zero otherwise it returns the calculated result.
* @param pixelHb is the pixel value of the Hb input.
* @param pixelHb is the pixel value of the Hb input.
* @warn if the sO2 value is NAN (in patricular if Hb == -HbO2), but result will be set to zero
*/
float CalculateSO2(float pixelHb, float pixelHbO2);
/**
* \brief calculates (Hb + HbO2).
* @param pixelHb is the pixel value of the Hb input.
* @param pixelHb is the pixel value of the Hb input.
* @warn if the tHb value is NAN (in patricular if Hb == -HbO2), but result will be set to zero
*/
float CalculateTHb(float pixelHb, float pixelHbO2);
/**
* \brief return true if SO2 result is not significant by checking if the input values are above the threshold of the settings
*/
bool SO2ValueNotSiginificant(float Hb, float HbO2, float result);
};
}
}
#endif // MITKPHOTOACOUSTICSPECTRALUNMIXINGSO2_
diff --git a/Modules/PhotoacousticsLib/include/mitkPAVector.h b/Modules/PhotoacousticsLib/include/mitkPAVector.h
index 0134624acd..3b25bf6b1c 100644
--- a/Modules/PhotoacousticsLib/include/mitkPAVector.h
+++ b/Modules/PhotoacousticsLib/include/mitkPAVector.h
@@ -1,132 +1,137 @@
/*============================================================================
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 MITKSMARTVECTOR_H
#define MITKSMARTVECTOR_H
#include <mitkVector.h>
#include <random>
#include <MitkPhotoacousticsLibExports.h>
//Includes for smart pointer usage
#include "mitkCommon.h"
#include "itkLightObject.h"
namespace mitk {
namespace pa {
class MITKPHOTOACOUSTICSLIB_EXPORT Vector : public itk::LightObject
{
public:
mitkClassMacroItkParent(Vector, itk::LightObject);
itkFactorylessNewMacro(Self);
/**
* @brief GetNorm calculates the length of this vector.
* @return the euclidean norm
*/
double GetNorm();
double GetElement(unsigned short index);
void SetElement(unsigned short index, double value);
/**
* @brief Normalize normalizes this vector. After calling this GetNorm() will return 1.
*/
void Normalize();
void SetValue(Vector::Pointer value);
/**
* @brief RandomizeByPercentage alters this vector randomly by [-percentage, percentage] of the bendingFactor.
*
* @param percentage
* @param bendingFactor
+ * @param rng
*/
void RandomizeByPercentage(double percentage, double bendingFactor, std::mt19937* rng);
/**
* @brief Randomize randomizes this vector to be [lowerLimit, upperLimit] in each element
*
* @param xLowerLimit
* @param xUpperLimit
* @param yLowerLimit
* @param yUpperLimit
* @param zLowerLimit
* @param zUpperLimit
+ * @param rng
*/
void Randomize(double xLowerLimit, double xUpperLimit, double yLowerLimit, double yUpperLimit, double zLowerLimit, double zUpperLimit, std::mt19937* rng);
/**
* @brief Randomize randomizes this vector to be [0, limit] in each element
*
* @param xLimit
* @param yLimit
* @param zLimit
+ * @param rng
*/
void Randomize(double xLimit, double yLimit, double zLimit, std::mt19937* rng);
/**
* @brief Randomize randomizes this vector to be [-1, 1] in each element
+ *
+ * @param rng
*/
void Randomize(std::mt19937* rng);
/**
* @brief Rotate rotates this Vector around the x, y and z axis with the given angles in radians
*
- * @param thetaChange rotation of the inclination angle in radians
- * @param phiChange rotation of the azimuthal angle in radians
+ * @param xAngle rotation of the inclination angle in radians
+ * @param yAngle rotation of the azimuthal angle in radians
*/
void Rotate(double xAngle, double yAngle);
/**
* @brief Scale scales this Vector with the given factor
*
* @param factor the scaling factor
*
* If a negative number is provided, the direction of the vector will be inverted.
*/
void Scale(double factor);
/**
* @brief Clone create a deep copy of this vector
*
* @return a new vector with the same values.
*/
Vector::Pointer Clone();
void Subtract(Vector::Pointer other);
void Add(Vector::Pointer other);
protected:
Vector();
~Vector() override;
void PrintSelf(std::ostream& os, itk::Indent indent) const override;
private:
mitk::Vector3D m_Vector;
};
/**
* @brief Equal A function comparing two vectors for beeing equal
*
* @param rightHandSide A Vector to be compared
* @param leftHandSide A Vector to be compared
* @param eps tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose flag indicating if the user wants detailed console output or not.
* @return true, if all subsequent comparisons are true, false otherwise
*/
MITKPHOTOACOUSTICSLIB_EXPORT bool Equal(const Vector::Pointer leftHandSide, const Vector::Pointer rightHandSide, double eps, bool verbose);
}
}
#endif // MITKSMARTVECTOR_H
diff --git a/Modules/PhotoacousticsLib/include/mitkPAVessel.h b/Modules/PhotoacousticsLib/include/mitkPAVessel.h
index 18e929d23a..d75d0ed68c 100644
--- a/Modules/PhotoacousticsLib/include/mitkPAVessel.h
+++ b/Modules/PhotoacousticsLib/include/mitkPAVessel.h
@@ -1,113 +1,114 @@
/*============================================================================
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 MITKVESSEL_H
#define MITKVESSEL_H
#include "mitkVector.h"
#include "mitkPAVesselMeanderStrategy.h"
#include "mitkPAInSilicoTissueVolume.h"
#include "mitkPAVector.h"
#include "mitkPAVesselProperties.h"
#include "mitkPAVesselDrawer.h"
#include <MitkPhotoacousticsLibExports.h>
//Includes for smart pointer usage
#include "mitkCommon.h"
#include "itkLightObject.h"
namespace mitk {
namespace pa {
class MITKPHOTOACOUSTICSLIB_EXPORT Vessel : public itk::LightObject
{
public:
mitkClassMacroItkParent(Vessel, itk::LightObject);
mitkNewMacro1Param(Self, VesselProperties::Pointer);
/**
* Callback function definition of a VesselMeanderStrategy
*/
typedef void (VesselMeanderStrategy::*CalculateNewVesselPositionCallback)
(Vector::Pointer, double, std::mt19937*);
/**
* @brief ExpandVessel makes this Vessel expand one step in its current direction.
* After expanding, the vessel will draw itself into the given InSilicoTissueVolume.
*
* @param volume volume for the vessel to draw itself in
* @param calculateNewPosition a callback function of the VesselMeanderStrategy class.
* It is used to calculate the final position after taking the step.
* @param bendingFactor a metric of how much the Vessel should bend. If set to 0 the vessel will go in a straight line.
+ * @param rng
*/
void ExpandVessel(mitk::pa::InSilicoTissueVolume::Pointer volume,
CalculateNewVesselPositionCallback calculateNewPosition, double bendingFactor, std::mt19937* rng);
/**
* @brief CanBifurcate
* @return true if the Vessel is ready to Bifurcate()
*/
bool CanBifurcate();
/**
* @brief Bifurcate bifurcates this vessel into two new ones. Makes sure that the volume of the vessels stays the same.
*
* @return a new vessel split up from the current one.
*/
Vessel::Pointer Bifurcate(std::mt19937* rng);
/**
* @brief IsFinished
* @return true if the vessel cannot expand any further
*/
bool IsFinished();
itkGetConstMacro(VesselProperties, VesselProperties::Pointer);
protected:
Vessel(VesselProperties::Pointer parameters);
~Vessel() override;
private:
const double MINIMUM_VESSEL_RADIUS = 0.1;
const double NEW_RADIUS_MINIMUM_RELATIVE_SIZE = 0.6;
const double NEW_RADIUS_MAXIMUM_RELATIVE_SIZE = 0.8;
VesselMeanderStrategy::Pointer m_VesselMeanderStrategy;
bool m_Finished;
double m_WalkedDistance;
std::uniform_real_distribution<> m_RangeDistribution;
std::uniform_real_distribution<> m_SignDistribution;
std::uniform_real_distribution<> m_RadiusRangeDistribution;
int GetSign(std::mt19937* rng);
VesselProperties::Pointer m_VesselProperties;
VesselDrawer::Pointer m_VesselDrawer;
};
/**
* @brief Equal A function comparing two vessels for beeing equal
*
* @param rightHandSide A vessel to be compared
* @param leftHandSide A vessel to be compared
* @param eps tolarence for comparison. You can use mitk::eps in most cases.
* @param verbose flag indicating if the user wants detailed console output or not.
* @return true, if all subsequent comparisons are true, false otherwise
*/
MITKPHOTOACOUSTICSLIB_EXPORT bool Equal(const Vessel::Pointer leftHandSide, const Vessel::Pointer rightHandSide, double eps, bool verbose);
}
}
#endif // MITKVESSEL_H
diff --git a/Modules/PhotoacousticsLib/include/mitkPAVesselMeanderStrategy.h b/Modules/PhotoacousticsLib/include/mitkPAVesselMeanderStrategy.h
index e6b249c8a5..f8f551ba83 100644
--- a/Modules/PhotoacousticsLib/include/mitkPAVesselMeanderStrategy.h
+++ b/Modules/PhotoacousticsLib/include/mitkPAVesselMeanderStrategy.h
@@ -1,58 +1,60 @@
/*============================================================================
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 MITKVESSELMEANDERSTRATEGY_H
#define MITKVESSELMEANDERSTRATEGY_H
#include "mitkVector.h"
#include "mitkPAVector.h"
#include <MitkPhotoacousticsLibExports.h>
//Includes for smart pointer usage
#include "mitkCommon.h"
#include "itkLightObject.h"
namespace mitk {
namespace pa {
class MITKPHOTOACOUSTICSLIB_EXPORT VesselMeanderStrategy : public itk::LightObject
{
public:
mitkClassMacroItkParent(VesselMeanderStrategy, itk::LightObject);
itkFactorylessNewMacro(Self);
/**
* @brief CalculateNewPositionInStraightLine calculates the new position by just following the direction vector.
* @param direction
* @param bendingFactor
+ * @param rng
*/
void CalculateNewDirectionVectorInStraightLine(Vector::Pointer direction, double bendingFactor, std::mt19937* rng);
/**
* @brief CalculateRandomlyDivergingPosition calculates the new position by modifying the direction vector randomly,
* proportional to the selected bendingFactor. This means, that the vessels will bend in each expansion step,
* if bendingFactor > 0.
*
* @param direction
* @param bendingFactor
+ * @param rng
*/
void CalculateNewRandomlyDivergingDirectionVector(Vector::Pointer direction, double bendingFactor, std::mt19937* rng);
protected:
VesselMeanderStrategy();
~VesselMeanderStrategy() override;
const double RANDOMIZATION_PERCENTAGE = 0.4;
};
}
}
#endif // MITKVESSELMEANDERSTRATEGY_H
diff --git a/Modules/PhotoacousticsLib/include/mitkPAVesselTree.h b/Modules/PhotoacousticsLib/include/mitkPAVesselTree.h
index 5a51cd2823..dbef42e6d9 100644
--- a/Modules/PhotoacousticsLib/include/mitkPAVesselTree.h
+++ b/Modules/PhotoacousticsLib/include/mitkPAVesselTree.h
@@ -1,66 +1,67 @@
/*============================================================================
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 MITKVESSELSTRUCTURE_H
#define MITKVESSELSTRUCTURE_H
//std includes
#include <vector>
//mitk includes
#include "mitkPAVessel.h"
#include "mitkPAInSilicoTissueVolume.h"
#include <MitkPhotoacousticsLibExports.h>
//Includes for smart pointer usage
#include "mitkCommon.h"
#include "itkLightObject.h"
namespace mitk {
namespace pa {
class MITKPHOTOACOUSTICSLIB_EXPORT VesselTree : public itk::LightObject
{
public:
mitkClassMacroItkParent(VesselTree, itk::LightObject);
mitkNewMacro1Param(Self, VesselProperties::Pointer);
/**
* @brief Step Performs a simulation step, in which all subvessels of this VesselTree are expanded.
*
* @param volume
* @param calculateNewPosition
* @param bendingFactor
+ * @param rng
*/
void Step(InSilicoTissueVolume::Pointer volume,
Vessel::CalculateNewVesselPositionCallback calculateNewPosition,
double bendingFactor, std::mt19937* rng);
/**
* @brief IsFinished
* @return true if no subvessel can be expanded.
*/
bool IsFinished();
itkGetConstMacro(CurrentSubvessels, std::vector<Vessel::Pointer>*);
protected:
VesselTree(VesselProperties::Pointer initialProperties);
~VesselTree() override;
private:
std::vector<Vessel::Pointer>* m_CurrentSubvessels;
};
MITKPHOTOACOUSTICSLIB_EXPORT bool Equal(const VesselTree::Pointer leftHandSide, const VesselTree::Pointer rightHandSide, double eps, bool verbose);
}
}
#endif // MITKVESSELSTRUCTURE_H
diff --git a/Modules/PhotoacousticsLib/include/mitkPAVolume.h b/Modules/PhotoacousticsLib/include/mitkPAVolume.h
index 1984519645..059b4df280 100644
--- a/Modules/PhotoacousticsLib/include/mitkPAVolume.h
+++ b/Modules/PhotoacousticsLib/include/mitkPAVolume.h
@@ -1,146 +1,147 @@
/*============================================================================
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 MITKPHOTOACOUSTIC3dVOLUME_H
#define MITKPHOTOACOUSTIC3dVOLUME_H
#include "MitkPhotoacousticsLibExports.h"
//Includes for smart pointer usage
#include <mitkImage.h>
#include <itkLightObject.h>
namespace mitk
{
namespace pa
{
/**
* @brief The Volume class is designed to encapsulate volumetric information and to provide convenience methods
* for data access and image conversions.
*/
class MITKPHOTOACOUSTICSLIB_EXPORT Volume : public itk::LightObject
{
public:
mitkClassMacroItkParent(Volume, itk::LightObject);
/**
*@brief returns smartpointer reference to a new instance of this objects.
* The given data array will be freed upon calling this constructor.
*@param data
*@param xDim
*@param yDim
*@param zDim
*@param spacing
*@return smartpointer reference to a new instance of this object
*/
static Volume::Pointer New(double* data, unsigned int xDim, unsigned int yDim, unsigned int zDim, double spacing);
static Volume::Pointer New(mitk::Image::Pointer image);
/**
* @brief GetData. Returns data at wanted position. For performance reasons, this method will not check,
* if the specified position it within the array. Please use the GetXDim(), GetYDim() and GetZDim() methods
* to check for yourself if necessary.
*
* @param x
* @param y
* @param z
* @return the data contained within the data array held by this Volume at
* positon x|y|z.
*/
double GetData(unsigned int x, unsigned int y, unsigned int z);
/**
* Returns a const reference to the data encapsuled by this class.
*/
double* GetData() const;
/**
* @brief SetData
* @param data
* @param x
* @param y
* @param z
*/
void SetData(double data, unsigned int x, unsigned int y, unsigned int z);
/**
* @brief GetXDim
* @return size of x dimension of this Volume
*/
unsigned int GetXDim();
/**
* @brief GetYDim
* @return size of y dimension of this Volume
*/
unsigned int GetYDim();
/**
* @brief GetZDim
* @return size of z dimension of this Volume
*/
unsigned int GetZDim();
/**
*@brief returns the Volume instance as an mitk image
*/
Image::Pointer AsMitkImage();
/**
* @brief DeepCopy
* @return a deep copy of this Volume. the old volume remains intact and memory is NOT shared
* between the objects.
*/
Volume::Pointer DeepCopy();
/**
*@brief convenience method to enable consistent access to the dat array
*@return a 1d index from 3d pixel coordinates
*/
long long GetIndex(unsigned int x, unsigned int y, unsigned int z);
double GetSpacing();
void SetSpacing(double spacing);
protected:
/**
* @brief Initialize initializes this volume with the given pointer to the data array.
* It is assumed, that the array is of dimension xDim|yDim|zDim.
* The Photoacoustic3DVolume will handle memory management of the array and delete it on
* constructor call.
*
* @param data a pointer to the data array
* @param xDim x dimension of the data
* @param yDim y dimension of the data
* @param zDim z dimension of the data
+ * @param spacing spacing of the data
*/
Volume(double* data, unsigned int xDim, unsigned int yDim, unsigned int zDim, double spacing);
Volume(mitk::Image::Pointer image);
~Volume() override;
const int NUMBER_OF_SPATIAL_DIMENSIONS = 3;
Image::Pointer m_InternalMitkImage;
// this data is kept to enable fast access
unsigned int m_XDim;
unsigned int m_YDim;
unsigned int m_ZDim;
double* m_FastAccessDataPointer;
};
}
}
#endif // MITKPHOTOACOUSTIC3dVOLUME_H
diff --git a/Modules/PlanarFigure/CMakeLists.txt b/Modules/PlanarFigure/CMakeLists.txt
index af4c93bb9c..ca2b93bce7 100644
--- a/Modules/PlanarFigure/CMakeLists.txt
+++ b/Modules/PlanarFigure/CMakeLists.txt
@@ -1,10 +1,11 @@
MITK_CREATE_MODULE(
INCLUDE_DIRS PRIVATE src/Algorithms src/DataManagement src/Interactions src/Rendering
DEPENDS MitkLegacyGL MitkAnnotation
+ PACKAGE_DEPENDS PRIVATE VTK|RenderingContextOpenGL2
)
add_subdirectory(autoload/IO)
if(BUILD_TESTING)
add_subdirectory(test)
endif()
diff --git a/Modules/PlanarFigure/test/CMakeLists.txt b/Modules/PlanarFigure/test/CMakeLists.txt
index d6f5cf2a16..18caae5c5f 100644
--- a/Modules/PlanarFigure/test/CMakeLists.txt
+++ b/Modules/PlanarFigure/test/CMakeLists.txt
@@ -1,153 +1,151 @@
MITK_CREATE_MODULE_TESTS()
if(TARGET ${TESTDRIVER})
- mitk_use_modules(TARGET ${TESTDRIVER} PACKAGES VTK|vtkTestingRendering)
+ mitk_use_modules(TARGET ${TESTDRIVER} PACKAGES VTK|TestingRendering)
set(testcaseBasename mitkViewportRenderingTest)
# set verbose to 1 to get a list of all defined test cases during CMake configuration
set(verbose 0)
# viewportTest():
#
# 1. Sets up a scene with a DICOM image, several planar figures, an STL file
# 2. Modifies the viewport of the VTK renderer to only a part of the render window
# 3. Compares the rendering result against an expected version
#
# Parameters determine the size and position of the viewport and the render window
# The expected result is mitkViewportRenderingTest_${testPostfix}.png
#
function(viewportTest
testPostfix # postfix to uniquely identify the test case
rwWidth rwHeight # "rw" = render window
vpLeft vpBottom vpWidth vpHeight # "vp" = viewport
# list of images/files for visualization
)
set(data ${ARGN}) # use all ADDITIONAL parameters after vpHeight as filenames
# transform the input parameters in required test parameters
math(EXPR vpRight "${vpLeft} + ${vpWidth}")
math(EXPR vpTop "${vpBottom} + ${vpHeight}")
#message(STATUS "Testing viewport of ${vpWidth}x${vpHeight} at ${vpLeft},${vpBottom} in render window of size ${rwWidth}x${rwHeight} ('${testPostfix}')")
# add the actual test
- mitkAddCustomModuleTest(
+ mitkAddCustomModuleRenderingTest(
mitkViewportRenderingTest_${testPostfix}
mitkViewportRenderingTest
${rwWidth} ${rwHeight}
${vpLeft} ${vpBottom}
${vpRight} ${vpTop}
${data}
-V ${MITK_DATA_DIR}/RenderingTestData/viewport/mitkViewportRenderingTest_${testPostfix}.png #corresponding reference screenshot
)
- set_property(TEST mitkViewportRenderingTest_${testPostfix}
- PROPERTY RUN_SERIAL TRUE)
endfunction()
function(getFirstCharacter string charVar)
string(SUBSTRING ${string} 0 1 c)
set(${charVar} ${c} PARENT_SCOPE)
endfunction()
# The following lines loop over several variations of aspect ratios for
# - render window
# - a viewport within this render window
# - an input image (defines the input world geometry)
# ---------------------------------------------------------------------
#
# Render window
# - Square
# - Landscape
# - Portrait
#
# Viewport
# - Square
# - Landscape
# - Portrait
#
# World / Image
# - Square
# - Landscape
# - Portrait
#
foreach(renderWindowAspect Square Landscape Portrait)
foreach(viewportAspect Square Landscape Portrait)
foreach(worldAspect Square Landscape Portrait)
getFirstCharacter(${renderWindowAspect} renderWindowAspectSymbol)
getFirstCharacter(${viewportAspect} viewportAspectSymbol)
getFirstCharacter(${worldAspect} worldAspectSymbol)
# construct test case name from various aspect ratios
set(testCaseShortname "r${renderWindowAspectSymbol}v${viewportAspectSymbol}w${worldAspectSymbol}")
# construct test image name from aspect ratio
set(testImage ${MITK_DATA_DIR}/RenderingTestData/viewport/input_${worldAspect}/SCSFREN.dcm) # nice DICOM name encoding and gray value test image
set(testObjects
${MITK_DATA_DIR}/RenderingTestData/PlanarFigures/Line1.pf
${MITK_DATA_DIR}/RenderingTestData/PlanarFigures/Path1.pf
${MITK_DATA_DIR}/RenderingTestData/PlanarFigures/FourPointAngle1.pf
${MITK_DATA_DIR}/RenderingTestData/PlanarFigures/Rectangle1.pf
${MITK_DATA_DIR}/binary.stl
)
# render window size
if (renderWindowAspect STREQUAL Landscape)
set(renderWindowWidth 600)
else()
set(renderWindowWidth 500)
endif()
if (renderWindowAspect STREQUAL Portrait)
set(renderWindowHeight 600)
else()
set(renderWindowHeight 500)
endif()
# viewport size
if (viewportAspect STREQUAL Landscape)
set(viewportWidth 450)
else()
set(viewportWidth 300)
endif()
if (viewportAspect STREQUAL Portrait)
set(viewportHeight 450)
else()
set(viewportHeight 300)
endif()
# world size
if (worldAspect STREQUAL Portrait)
set(worldWidth 300)
set(worldHeight 420)
elseif (worldAspect STREQUAL Landscape)
set(worldWidth 420)
set(worldHeight 300)
else()
set(worldWidth 512)
set(worldHeight 512)
endif()
# Summary
set(viewportX 30)
set(viewportY 45)
if (verbose)
message(STATUS "(${testCaseShortname}) "
"Render window ${renderWindowAspect} (${renderWindowWidth}x${renderWindowHeight}), "
"Viewport ${viewportAspect} (${viewportWidth}x${viewportHeight}+${viewportX}+${viewportY}), "
"World ${worldAspect} (${worldWidth}x${worldHeight})"
)
endif()
viewPortTest(${testCaseShortname}
${renderWindowWidth} ${renderWindowHeight}
${viewportX} ${viewportY}
${viewportWidth} ${viewportHeight}
${testImage}
${testObjects})
endforeach()
endforeach()
endforeach()
endif() # endif TARGET ${TESTDRIVER}
diff --git a/Modules/PlanarFigure/test/files.cmake b/Modules/PlanarFigure/test/files.cmake
index 7cccdb7726..8596705671 100644
--- a/Modules/PlanarFigure/test/files.cmake
+++ b/Modules/PlanarFigure/test/files.cmake
@@ -1,12 +1,15 @@
set(MODULE_TESTS
mitkPlanarCrossTest.cpp
mitkPlanarPolygonTest.cpp
mitkPlanarSubdivisionPolygonTest.cpp
mitkPlanarFigureIOTest.cpp
mitkPlanarArrowTest.cpp
+)
+
+set(MODULE_RENDERING_TESTS
mitkPlanarFigureInteractionTest.cpp
)
set(MODULE_CUSTOM_TESTS
mitkViewportRenderingTest.cpp
)
diff --git a/Modules/Python/documentation/mitkPython.dox b/Modules/Python/documentation/mitkPython.dox
index b25d78554c..ce19e8112b 100644
--- a/Modules/Python/documentation/mitkPython.dox
+++ b/Modules/Python/documentation/mitkPython.dox
@@ -1,47 +1,47 @@
/**
\page mitkPython_Overview Python Module
\section python_sec1 Brief description
The MITK Python Module provides a service class to interactively run python code (passed as C++ strings) and
evaluate the results. Furthermore the service class offers means to convert an MITK Image to an ITK/OpenCV image in their wrapped python environment.
<strong>Thus, one can process MITK images with Python Code from the OpenCV and ITK wrapping system</strong>.
Furthermore one can convert an mitk::Surface to a vtkPolyData in its Python environment.<br />
Under the hood, the MITK build system takes care that the wrapping build process for SimpleITK/VTK/OpenCV is correctly initiated and all paths are correctly set within MITK code.
To use the features of the different toolkits make sure they are enabled during the superbuild process.
\section python_sec2 Build Instructions
-Have a look at \ref python_ssec3 on how to build MITK-Python with Qt5.
+Have a look at \ref python_sec3 on how to build MITK-Python with Qt5.
The following CMake build options are available:
<ul>
<li> MITK_USE_Python3
</ul>
\subsection python_ssec1 MITK_USE_Python3
MITK_USE_Python3 enables the python wrapping in MITK. When the option is activated
the build of the additional dependency SimpleITK is also enabled. The default behaviour is to use the python runtime from the system is used.
Only Python 3.x is supported.
The user can also specify it's own runtime by modifying the variables added by the
FindPythonLib.cmake script. <strong>Note:</strong> A Python runtime with numpy is needed to use the MITK Python wrapping.
When using this options all additional libraries installed in the python runtime will be available within the MITK-Python console.
\section python_sec3 Suported Data Types
The following data types in MITK are supported in the MITK Python Wrapping:
<ul>
<li> Image
<li> Surface
</ul>
\subsection python_ssec4 Image
Mitk Images can be transferred to python. The images are copied in-memory and
transferred as a numpy array to Python and vice versa. The MITK python wrapping creates a SimpleITK image
using the numpy array with the properties of the MITK Image. Two dimensional images
can also be transferred as an OpenCV image to python.
\subsection python_ssec5 Surface
Surfaces within mitk can be transferred as a vtkPolyData Object to Python.
The surfaces are fully memory mapped. When changing a python wrapped surface
the original object is also modified on the C++ side of MITK.
*/
diff --git a/Modules/QtOverlays/QmitkCustomWidgetOverlay.h b/Modules/QtOverlays/QmitkCustomWidgetOverlay.h
index 684accc0ef..97e002d76d 100644
--- a/Modules/QtOverlays/QmitkCustomWidgetOverlay.h
+++ b/Modules/QtOverlays/QmitkCustomWidgetOverlay.h
@@ -1,55 +1,55 @@
/*============================================================================
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 QmitkCustomWidgetOverlay_H_HEADER_INCLUDED_C10DC4EB
#define QmitkCustomWidgetOverlay_H_HEADER_INCLUDED_C10DC4EB
// MITK
#include "QmitkOverlay.h"
#include <MitkQtOverlaysExports.h>
/** \class QmitkCustomWidgetOverlay
* \brief object representing a custom widget that is handled and positioned
* as an overlay.
*
* A QmitkCustomWidgetOverlay is a generic sub-class of QmitkOverlay. It
* offers the possibility to set the internal m_Widget from the outside.
*
* This offers the possibility to position custom widgets 'on top of' other
* widgets using the positioning mechanism of all overlays.
*
-* \warn The custom widgets need to be configured and connected manually.
+* \warning The custom widgets need to be configured and connected manually.
* Properties cannot be set.
*
* \ingroup Overlays
*/
class MITKQTOVERLAYS_EXPORT QmitkCustomWidgetOverlay : public QmitkOverlay
{
public:
/**
* @brief Default Constructor
**/
QmitkCustomWidgetOverlay(const char *id);
/**
* @brief Default Destructor
**/
~QmitkCustomWidgetOverlay() override;
void SetWidget(QWidget *widget);
QSize GetNeededSize() override;
};
#endif /* QmitkCustomWidgetOverlay_H_HEADER_INCLUDED_C10DC4EB */
diff --git a/Modules/QtOverlays/QmitkScalarBarOverlay.h b/Modules/QtOverlays/QmitkScalarBarOverlay.h
index b5502d6de0..6cdb69df66 100644
--- a/Modules/QtOverlays/QmitkScalarBarOverlay.h
+++ b/Modules/QtOverlays/QmitkScalarBarOverlay.h
@@ -1,81 +1,81 @@
/*============================================================================
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 MITKSCALARBAROVERLAY_H_HEADER_INCLUDED_C10DC4EB
#define MITKSCALARBAROVERLAY_H_HEADER_INCLUDED_C10DC4EB
#include <MitkQtOverlaysExports.h>
// MITK-Stuff
#include "QmitkOverlay.h"
#include "mitkCommon.h"
#include "mitkPropertyList.h"
#include <QmitkScalarBar.h>
/** \class QmitkScalarBarOverlay
* \brief object representing a text that is drawn as an overlay
*
* \ingroup Qmitk
*/
class MITKQTOVERLAYS_EXPORT QmitkScalarBarOverlay : public QmitkOverlay
{
Q_OBJECT
public:
/**
* @brief Default Constructor
**/
QmitkScalarBarOverlay(const char *id);
/**
* @brief Default Destructor
**/
~QmitkScalarBarOverlay() override;
/**
* \brief Setup the QLabel with overlay specific information
*
* First, this method sets text-overlay specific properties as described in the class docu above.
* Secondly, the actual text of the label is set.
*
- * \WARNING No error will be issued if the property containing the text is not found, the TextOverlay
+ * \warning No error will be issued if the property containing the text is not found, the TextOverlay
* will show an empty string!
*/
void GenerateData(mitk::PropertyList::Pointer) override;
QSize GetNeededSize() override;
protected:
/**
* \brief internal helper class to determine text-properties
*
* This method is only used internally to apply the text specific properties that can be set
* using a mitk::PropertyList. If a property cannot be found, a default value is used.
*
* The values of these properties are then attributed to the label using QFont and QPalette.
*/
void GetProperties(mitk::PropertyList::Pointer);
void SetupCallback(mitk::BaseProperty::Pointer prop);
void SetScaleFactor();
/** \brief QWidget internally representing the TextOverlay */
QmitkScalarBar *m_ScalarBar;
mitk::BaseProperty::Pointer m_ObservedProperty;
mitk::PropertyList::Pointer m_PropertyList;
unsigned long m_ObserverTag;
};
#endif /* MITKSCALARBAROVERLAY_H_HEADER_INCLUDED_C10DC4EB */
diff --git a/Modules/QtOverlays/QmitkTextOverlay.h b/Modules/QtOverlays/QmitkTextOverlay.h
index 56d1ce7e55..c11ecb63c6 100644
--- a/Modules/QtOverlays/QmitkTextOverlay.h
+++ b/Modules/QtOverlays/QmitkTextOverlay.h
@@ -1,106 +1,106 @@
/*============================================================================
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 MITKTEXTOVERLAY_H_HEADER_INCLUDED_C10DC4EB
#define MITKTEXTOVERLAY_H_HEADER_INCLUDED_C10DC4EB
// MITK
#include "QmitkOverlay.h"
#include "mitkCommon.h"
#include "mitkPropertyList.h"
// Qt
#include <QLabel>
#include <MitkQtOverlaysExports.h>
/** \class QmitkTextOverlay
* \brief object representing a text that is drawn as an overlay
*
* A QmitkTextOverlay is a text-specific implementation of QmitkOverlay.
* It can be used whenever a simple text is to be rendered as an overlay in
* a QmitkRenderWindow.
*
* Instead of a QWidget (as in QmitkOverlay) a QmitkTextOverlay is internally
* represented by a QLabel. You can access it via GetWidget().
*
* Calling GenerateData( mitk::PropertyList::Pointer ) will setup the textoverlay.
* This includes setting of the actual text (that must be stored in the property
* with the name that is given the overlay as ID).
*
* e.g. mitk::StringProperty::Pointer nameProp = mitk::StringProperty::New( "overlay.text.patientName", "Max" );
* --
* QmitkTextOverlay* nameOverlay = new QmitkTextOverlay( "overlay.text.patientName" );
*
* In order to customize the look of the textoverlays, a number of additional properties can be set
* (default values in square brackets):
*
* overlay.color : defines the text-color (mitk::ColorProperty)
* overlay.fontSize : defines the fontSize of the text (mitk::IntProperty)
* overlay.kerning : defines if kerning is to be used (mitk::BoolProperty)
* overlay.fontFamily : defines the fon family that is to be used (mitk::StringProperty)
*
* \ingroup Qmitk
*/
class MITKQTOVERLAYS_EXPORT QmitkTextOverlay : public QmitkOverlay
{
public:
/**
* @brief Default Constructor
**/
QmitkTextOverlay(const char *id);
/**
* @brief Default Destructor
**/
~QmitkTextOverlay() override;
/**
* \brief Setup the QLabel with overlay specific information
*
* First, this method sets text-overlay specific properties as described in the class docu above.
* Secondly, the actual text of the label is set.
*
- * \WARNING No error will be issued if the property containing the text is not found, the TextOverlay
+ * \warning No error will be issued if the property containing the text is not found, the TextOverlay
* will show an empty string!
*/
void GenerateData(mitk::PropertyList::Pointer) override;
QSize GetNeededSize() override;
protected:
/**
* \brief internal helper class to determine text-properties
*
* This method is only used internally to apply the font specific properties that can be set
* using a mitk::PropertyList. If a property cannot be found, a default value is used.
*
* The values of these properties are then attributed to the QLabel using QFont and QPalette.
*/
void UpdateFontProperties(mitk::PropertyList::Pointer);
void SetupCallback(mitk::BaseProperty::Pointer prop);
void UpdateDisplayedTextFromProperties();
/** \brief QLabel internally representing the TextOverlay */
QLabel *m_Label;
mitk::PropertyList::Pointer m_PropertyList;
mitk::BaseProperty::Pointer m_ObservedProperty;
unsigned long m_ObserverTag;
};
#endif /* MITKTEXTOVERLAY_H_HEADER_INCLUDED_C10DC4EB */
diff --git a/Modules/QtWidgets/CMakeLists.txt b/Modules/QtWidgets/CMakeLists.txt
index 1938494ee8..f383232898 100644
--- a/Modules/QtWidgets/CMakeLists.txt
+++ b/Modules/QtWidgets/CMakeLists.txt
@@ -1,8 +1,8 @@
MITK_CREATE_MODULE(
INCLUDE_DIRS PRIVATE resource # for xpm includes
DEPENDS MitkPlanarFigure MitkAnnotation
PACKAGE_DEPENDS
- PUBLIC ITK|ITKIOImageBase VTK|vtkGUISupportQt+vtkRenderingQt Qt5|Widgets+OpenGL+Core
+ PUBLIC ITK|ITKIOImageBase VTK|GUISupportQt+RenderingQt Qt5|Widgets+OpenGL+Core
)
add_subdirectory(test)
diff --git a/Modules/QtWidgets/include/QmitkAbstractDataStorageInspector.h b/Modules/QtWidgets/include/QmitkAbstractDataStorageInspector.h
index de4ed08294..7b3bc62517 100644
--- a/Modules/QtWidgets/include/QmitkAbstractDataStorageInspector.h
+++ b/Modules/QtWidgets/include/QmitkAbstractDataStorageInspector.h
@@ -1,129 +1,129 @@
/*============================================================================
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 QMITKABSTRACTDATASTORAGEINSPECTOR_H
#define QMITKABSTRACTDATASTORAGEINSPECTOR_H
#include <QmitkModelViewSelectionConnector.h>
#include <MitkQtWidgetsExports.h>
// mitk core
#include <mitkDataStorage.h>
#include <mitkNodePredicateBase.h>
// qt
#include <QWidget>
class QAbstractItemVew;
/**
* @brief This abstract class is a convenient base class for easy implementation of widgets that
* offer a specific view onto a given DataStorage instance to inspect its contents.
* One may also get the selection in this inspector of the data storage.
*/
class MITKQTWIDGETS_EXPORT QmitkAbstractDataStorageInspector : public QWidget
{
Q_OBJECT
public:
~QmitkAbstractDataStorageInspector() override;
/**
* @brief Sets the data storage that will be used /monitored by the widget.
*
* @param dataStorage A pointer to the data storage to set.
*/
void SetDataStorage(mitk::DataStorage* dataStorage);
/**
* @brief Sets the node predicate and updates the widget, according to the node predicate.
*
* @param nodePredicate A pointer to node predicate.
*/
virtual void SetNodePredicate(const mitk::NodePredicateBase* nodePredicate);
const mitk::NodePredicateBase* GetNodePredicate() const;
using NodeList = QList<mitk::DataNode::Pointer>;
/** Returns the list of currently selected nodes.*/
NodeList GetSelectedNodes() const;
/** Returns an pointer to the view that is used in the inspector to show the content.*/
virtual QAbstractItemView* GetView() = 0;
virtual const QAbstractItemView* GetView() const = 0;
/** Returns the setting of the internal connector. It can be changed by SetSelectOnlyVisibleNodes()*/
bool GetSelectOnlyVisibleNodes() const;
using SelectionMode = QAbstractItemView::SelectionMode;
/** Sets the selection mode of the inspector.*/
virtual void SetSelectionMode(SelectionMode mode) = 0;
virtual SelectionMode GetSelectionMode() const = 0;
Q_SIGNALS:
/**
* @brief A signal that will be emitted if the selected node has changed.
*
* @param nodes A list of data nodes that are newly selected.
*/
void CurrentSelectionChanged(NodeList nodes);
public Q_SLOTS:
/**
* @brief Change the selection modus of the item view's selection model.
*
* If true, an incoming selection will be filtered (reduced) to only those nodes that are visible by the current view.
* An outgoing selection can then at most contain the filtered nodes.
* If false, the incoming non-visible selection will be stored and later added to the outgoing selection,
* to include the original selection that could not be modified.
* The part of the original selection, that is non-visible are the nodes that are not
*
* @param selectOnlyVisibleNodes The bool value to define the selection modus.
*/
void SetSelectOnlyVisibleNodes(bool selectOnlyVisibleNodes);
/**
* @brief Transform a list of data nodes into a model selection and set this as a new selection of the
* selection model of the private member item view.
*
* The function filters the given list of nodes according to the 'm_SelectOnlyVisibleNodes' member variable. If
* necessary, the non-visible nodes are stored. This is done if 'm_SelectOnlyVisibleNodes' is false: In this case
* the selection may be filtered and only a subset of the selected nodes may be visible and therefore (de-)selectable
* in the data storage viewer. By storing the non-visible nodes it is possible to send the new, modified selection
* but also include the selected nodes from the original selection that could not be modified (see 'SetSelectOnlyVisibleNodes').
*
- * @param nodes A list of data nodes that should be newly selected.
+ * @param selectedNodes A list of data nodes that should be newly selected.
*/
void SetCurrentSelection(NodeList selectedNodes);
protected Q_SLOTS:
void OnSelectionChanged(NodeList selectedNodes);
protected:
/** Helper function is called if data storage or predicate is changed to (re) initialize the widget correctly.
Implement the function in derived classes.*/
virtual void Initialize() = 0;
mitk::WeakPointer<mitk::DataStorage> m_DataStorage;
mitk::NodePredicateBase::ConstPointer m_NodePredicate;
std::unique_ptr<QmitkModelViewSelectionConnector> m_Connector;
QmitkAbstractDataStorageInspector(QWidget* parent = nullptr);
};
#endif // QMITKABSTRACTDATASTORAGEMODEL_H
diff --git a/Modules/QtWidgets/include/QmitkDataStorageListModel.h b/Modules/QtWidgets/include/QmitkDataStorageListModel.h
index 6ab6c7796b..333e2ea98a 100755
--- a/Modules/QtWidgets/include/QmitkDataStorageListModel.h
+++ b/Modules/QtWidgets/include/QmitkDataStorageListModel.h
@@ -1,156 +1,156 @@
/*============================================================================
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 QmitkDataStorageListModel_h
#define QmitkDataStorageListModel_h
#include <MitkQtWidgetsExports.h>
// MITK
#include "mitkDataStorage.h"
#include "mitkNodePredicateBase.h"
// Qt
#include <QAbstractListModel>
//! \ingroup QmitkModule
//! Qt list model for the (optionally filtered) nodes in a DataStorage.
//!
//! Given a data storage instance, this model will observe the storage
//! for its list of nodes and keep the provided Qt model up to date.
//! When given a NodePredicateBase instance, the Qt model will only
//! contain nodes that satisfy the predicate. This is useful to
//! display lists of a certain data type only, for example.
//!
//! Developer notes:
//! - class should be reviewed by somebody who knows well Qt models
//! - The OnSomethingModifedAddedRemoved() methods are declared virtual. They are required
//! to be executed on event reception, though! They should not be virtual.
//! - Is there any valid use case for sub-classing? Declare class final?
//! - Is GetDataNodes needed? DataStorage or Qt model would yield the same result.
class MITKQTWIDGETS_EXPORT QmitkDataStorageListModel : public QAbstractListModel
{
public:
//! \param dataStorage the data storage to represent
- //! \param predicate the optional predicate to filter filters
+ //! \param pred the optional predicate to filter filters
//! \param parent the Qt parent of this Qt object
QmitkDataStorageListModel(mitk::DataStorage *dataStorage = nullptr,
mitk::NodePredicateBase::Pointer pred = nullptr,
QObject *parent = nullptr);
~QmitkDataStorageListModel() override;
//! Change the data storage to represent
void SetDataStorage(mitk::DataStorage::Pointer dataStorage);
//! Get the represented data storage
mitk::DataStorage *GetDataStorage() const;
//! Change the filter predicate
void SetPredicate(mitk::NodePredicateBase *pred);
//! Get the filter predicate in use
mitk::NodePredicateBase *GetPredicate() const;
//! Get all current data nodes
std::vector<mitk::DataNode *> GetDataNodes() const;
//! Return the node for given model index
mitk::DataNode::Pointer getNode(const QModelIndex &index) const;
//! Return the model index of the given node
QModelIndex getIndex(const mitk::DataNode *node) const;
//! Implements QAbstractListModel
Qt::ItemFlags flags(const QModelIndex &index) const override;
//! Implements QAbstractListModel
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
//! Implements QAbstractListModel
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
//! Implements QAbstractListModel
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
//! Called when a DataStorage Add Event was thrown. May be reimplemented
//! by deriving classes.
//!
//! \warning When sub-classing, call this class' method first! Otherwise the node
//! addition will not be reflected in the Qt model!
virtual void OnDataStorageNodeAdded(const mitk::DataNode *node);
//! Called when a DataStorage Remove Event was thrown. May be reimplemented
//! by deriving classes.
//!
//! \warning When sub-classing, call this class' method first! Otherwise the node
//! removal will not be reflected in the Qt model!
virtual void OnDataStorageNodeRemoved(const mitk::DataNode *node);
//! Callback entry for observed DataNodes' ModifiedEvent().
//!
//! Emits signal dataChanged().
virtual void OnDataNodeModified(const itk::Object *caller, const itk::EventObject &event);
//! Callback entry for observed BaseDatas' ModifiedEvent().
//!
//! Emits signal dataChanged().
virtual void OnDataModified(const itk::Object *caller, const itk::EventObject &event);
//! Callback entry for DataStorage's DeleteEvent().
//!
//! Clears the model.
virtual void OnDataStorageDeleted(const itk::Object *caller, const itk::EventObject &event);
protected:
//! \brief Resets the whole model. Get all nodes matching the predicate from the data storage.
void reset();
//! Internal helper: adds given node to end of list
void AddNodeToInternalList(mitk::DataNode *node);
//! Internal helper: remove given node
void RemoveNodeFromInternalList(mitk::DataNode *node);
//! Internal helper: Clear complete model list
void ClearInternalNodeList();
private:
enum OBSERVER_TUPLE_NAMES
{
NODE = 0,
NODE_OBSERVER = 1,
DATA_OBSERVER = 2,
};
//! Holds the predicate that defines what nodes are part of the model.
mitk::NodePredicateBase::Pointer m_NodePredicate;
//! The DataStorage that is represented in the model.
//! We keep only a weak pointer and observe the storage for deletion.
mitk::DataStorage *m_DataStorage;
//! ITK observer tag for the storage's DeleteEvent()
unsigned long m_DataStorageDeleteObserverTag;
//! List of the current model's DataNodes along with their ModifiedEvent observer tags
//! - element 0 : node
//! - element 1 : node's ModifiedEvent observer.
//! - element 2 : node data's ModifiedEvent observer.
std::vector<std::tuple<mitk::DataNode *, unsigned long, unsigned long>> m_NodesAndObserverTags;
//! Prevents infinite loops.
bool m_BlockEvents;
};
#endif /* QMITKDATASTORAGELISTMODEL_H_ */
diff --git a/Modules/QtWidgets/include/QmitkDataStorageTableModel.h b/Modules/QtWidgets/include/QmitkDataStorageTableModel.h
index e69bf5bece..0abd6382e4 100644
--- a/Modules/QtWidgets/include/QmitkDataStorageTableModel.h
+++ b/Modules/QtWidgets/include/QmitkDataStorageTableModel.h
@@ -1,223 +1,223 @@
/*============================================================================
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 QmitkDataStorageTableModel_h
#define QmitkDataStorageTableModel_h
#include <MitkQtWidgetsExports.h>
/// Own includes.
#include "mitkBaseProperty.h"
#include "mitkDataStorage.h"
#include "mitkNodePredicateBase.h"
#include "mitkWeakPointer.h"
/// Toolkit includes.
#include <QAbstractTableModel>
/// Forward declarations.
///
/// \ingroup QmitkModule
/// \class QmitkDataStorageTableModel
///
/// \brief A table model for a set of DataNodes defined by a predicate.
-/// \TODO make columns interchangeable, select which properties to show as columns
+/// \todo make columns interchangeable, select which properties to show as columns
///
class MITKQTWIDGETS_EXPORT QmitkDataStorageTableModel : public QAbstractTableModel
{
Q_OBJECT
//#Ctors/Dtor
public:
///
/// Constructs a new QmitkDataStorageTableModel and sets a predicate that defines
/// this list.
/// \see setPredicate()
///
QmitkDataStorageTableModel(mitk::DataStorage::Pointer _DataStorage,
mitk::NodePredicateBase *_Predicate = nullptr,
QObject *parent = nullptr);
///
/// Standard dtor. Delete predicate, disconnect from DataStorage.
///
~QmitkDataStorageTableModel() override;
//# Public GETTER
public:
///
/// Get the DataStorage.
///
const mitk::DataStorage::Pointer GetDataStorage() const;
///
/// Get the predicate.
///
mitk::NodePredicateBase::Pointer GetPredicate() const;
///
/// Get node at a specific model index. Another way to implement this, is
/// by introducing a new role like "DateTreeNode" and capture
/// that in the data function.
///
mitk::DataNode::Pointer GetNode(const QModelIndex &index) const;
///
/// Overridden from QAbstractTableModel. Returns the header data at section
/// for given orientation and role.
///
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
///
/// Overridden from QAbstractTableModel. Returns what can be done
/// with an item.
///
Qt::ItemFlags flags(const QModelIndex &index) const override;
///
/// Overridden from QAbstractTableModel. Returns the node count.
///
int rowCount(const QModelIndex &parent) const override;
///
/// Overridden from QAbstractTableModel. Returns the number of features (columns) to display.
///
int columnCount(const QModelIndex &parent) const override;
///
/// Overridden from QAbstractTableModel. Returns the data at index for given role.
///
QVariant data(const QModelIndex &index, int role) const override;
//# Public SETTERS
public:
///
/// Sets the DataStorage.
///
void SetDataStorage(mitk::DataStorage::Pointer _DataStorage);
///
/// Sets the predicate. <b>QmitkDataStorageTableModel is owner of the predicate!</b>
///
void SetPredicate(mitk::NodePredicateBase *_Predicate);
///
/// Adds a node to this model.
/// There are two constraints for nodes in this model:
/// 1. If a predicate is set (not null) the node will be checked against it.
/// 2. The node has to have a data object (no one wants to see empty nodes).
/// Also adds event listeners to the node.
///
virtual void AddNode(const mitk::DataNode *node);
///
/// Removes a node from this model. Also removes any event listener from the node.
///
virtual void RemoveNode(const mitk::DataNode *node);
///
/// Returns a copy of the node-vector that is shown by this model
///
virtual std::vector<mitk::DataNode *> GetNodeSet() const;
///
/// \brief Called when a single property was changed.
/// The function searches through the list of nodes in this model for the changed
/// property. If the property was found a dataChanged signal is emitted forcing
/// all observing views to request the data again.
///
virtual void PropertyModified(const itk::Object *caller, const itk::EventObject &event);
///
/// Overridden from QAbstractTableModel. Sets data at index for given role.
///
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
///
/// \brief Reimplemented sort function from QAbstractTableModel to enable sorting on the table.
///
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder) override;
//#PROTECTED INNER CLASSES
protected:
///
/// \struct DataNodeCompareFunction
/// \brief A struct that inherits from std::binary_function. You can use it in std::sort algorithm for sorting the
/// node list elements.
///
struct DataNodeCompareFunction : public std::binary_function<mitk::DataNode::Pointer, mitk::DataNode::Pointer, bool>
{
///
/// \brief Specifies field of the property with which it will be sorted.
///
enum CompareCriteria
{
CompareByName = 0,
CompareByClassName,
CompareByVisibility
};
///
/// \brief Specifies Ascending/descending ordering.
///
enum CompareOperator
{
Less = 0,
Greater
};
///
/// \brief Creates a PropertyDataSetCompareFunction. A CompareCriteria and a CompareOperator must be given.
///
DataNodeCompareFunction(CompareCriteria _CompareCriteria = CompareByName, CompareOperator _CompareOperator = Less);
///
/// \brief The reimplemented compare function.
///
bool operator()(const mitk::DataNode::Pointer &_Left, const mitk::DataNode::Pointer &_Right) const;
protected:
CompareCriteria m_CompareCriteria;
CompareOperator m_CompareOperator;
};
//#Protected SETTER
protected:
///
/// Called when DataStorage or Predicate changed. Resets whole model and reads all nodes
/// in again.
///
virtual void Reset();
//#Protected MEMBER VARIABLES
protected:
///
/// Pointer to the DataStorage from which the nodes are selected (remember: in BlueBerry there
/// might be more than one DataStorage).
/// Store it in a weak pointer. This is a GUI class which should not hold a strong reference
/// to any non-GUI Object.
///
mitk::WeakPointer<mitk::DataStorage> m_DataStorage;
///
/// Holds the predicate that defines this SubSet of Nodes. If m_Predicate
/// is nullptr all Nodes will be selected.
///
mitk::NodePredicateBase::Pointer m_Predicate;
///
/// Holds all selected Nodes.
///
std::vector<mitk::DataNode *> m_NodeSet;
///
/// \brief Maps a property to an observer tag.
///
std::map<mitk::BaseProperty *, unsigned long> m_NamePropertyModifiedObserverTags;
///
/// \brief Maps a property to an observer tag.
///
std::map<mitk::BaseProperty *, unsigned long> m_VisiblePropertyModifiedObserverTags;
///
/// Saves if this model is currently working on events to prevent endless event loops.
///
bool m_BlockEvents;
///
/// \brief The property is true when the property list is sorted in descending order.
///
bool m_SortDescending;
};
#endif
diff --git a/Modules/QtWidgets/include/QmitkIOUtil.h b/Modules/QtWidgets/include/QmitkIOUtil.h
index 6d2adf3230..ba015926d7 100644
--- a/Modules/QtWidgets/include/QmitkIOUtil.h
+++ b/Modules/QtWidgets/include/QmitkIOUtil.h
@@ -1,237 +1,238 @@
/*============================================================================
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 _QmitkIOUtil__h_
#define _QmitkIOUtil__h_
#include "MitkQtWidgetsExports.h"
// std
#include <string>
// mitk includes
#include <mitkBaseData.h>
#include <mitkCommon.h>
#include <mitkDataNode.h>
#include <mitkFileWriterWithInformation.h>
#include <mitkIOUtil.h>
#include <mitkImage.h>
#include <mitkPointSet.h>
#include <mitkSurface.h>
// Qt
#include <QList>
#include <QPair>
#include <QScopedPointer>
#include <QString>
class QWidget;
class QString;
class QStringList;
namespace mitk
{
class DataStorage;
class MimeType;
struct IFileReader;
}
/**
* @brief QmitkIOUtil Provides static helper methods to open and save files with Qt dialogs.
*/
class MITKQTWIDGETS_EXPORT QmitkIOUtil : public mitk::IOUtil
{
public:
class MITKQTWIDGETS_EXPORT SaveFilter
{
public:
static mitk::MimeType ALL_MIMETYPE();
SaveFilter(const SaveFilter &other);
SaveFilter(const SaveInfo &saveInfo);
SaveFilter &operator=(const SaveFilter &other);
std::vector<mitk::MimeType> GetMimeTypes() const;
QString GetFilterForMimeType(const std::string &mimeType) const;
mitk::MimeType GetMimeTypeForFilter(const QString &filter) const;
QString GetDefaultFilter() const;
QString GetDefaultExtension() const;
mitk::MimeType GetDefaultMimeType() const;
QString ToString() const;
int Size() const;
bool IsEmpty() const;
bool ContainsMimeType(const std::string &mimeType);
private:
struct Impl;
QScopedPointer<Impl> d;
};
/**
* @brief GetFilterString
* @return
*/
static QString GetFileOpenFilterString();
/**
* @brief Loads the specified files
*
* This methods tries to load all specified files and pop-ups dialog boxes if further
* user input is required (e.g. ambiguous mime-types or reader options).
*
* If the provided DataStorage is not nullptr, some files will be added to it automatically,
* dependeing on the IFileReader used.
*
- * @param files A list of files to load.
- * @param ds An optional data storage passed to IFileReader instances
+ * @param paths
+ * @param parent
* @return A list of BaseData instances which have not already been added to the data storage.
*/
static QList<mitk::BaseData::Pointer> Load(const QStringList &paths, QWidget *parent = nullptr);
static mitk::DataStorage::SetOfObjects::Pointer Load(const QStringList &paths,
mitk::DataStorage &storage,
QWidget *parent = nullptr);
static QList<mitk::BaseData::Pointer> Load(const QString &path, QWidget *parent = nullptr);
static mitk::DataStorage::SetOfObjects::Pointer Load(const QString &path,
mitk::DataStorage &storage,
QWidget *parent = nullptr);
using mitk::IOUtil::Load;
static QString Save(const mitk::BaseData *data,
const QString &defaultBaseName,
const QString &defaultPath = QString(),
QWidget *parent = nullptr,
bool setPathProperty = false);
/**
* @brief Save a list of BaseData objects using a "File Save Dialog".
*
* For each element in the \c data vector, the following algorithm is
* used to find a IFileWriter instance for writing the BaseData object.
*
* First, the user is prompted to select file names for each BaseData object. This
* is equivalent to choosing a specific mime-type, either by selecting a filter
* in the save dialog or by explicitly providing a file name extension:
* <ol>
* <li>Get a list of registered IFileWriter objects for the current BaseData object.
* If no writers are found, a message box displays a warning and
* the process starts from the beginning for the next BaseData object.</li>
* <li>A QFileDialog for prompting the user to select a file name is opened.
* The mime-type associated with each IFileWriter object is used to create
* a filter for file name extensions.
* The best IFileWriter (see FileWriterSelector) for the current BaseData object
* defines the default file name suffix via its associated mime-type. If the
* file name is empty (the user cancelled the dialog), the remaining
* BaseData objects are skipped.
* <li>The file name is matched against valid mime-types. The first mime-type
* which accepts the file name is associated with the current BaseData object.
* If no mime-type accepts the supplied file name and the file already
* exists, the process starts from the beginning with the next BaseData object.
* Otherwise, if the selected filter is the special "all" filter and the
* file name does not contain periods (which may or may not mark the start of
* a file extension), the current BaseData object is associated with the
* default mime-type. If the selected filter is not the special "all" filter,
* the mime-type for this filter is associated with the current BaseData object.
* The default extension of the associated mime-type is then appended to the
* supplied file name.
* <li>The selected/derived file name and associated mime-type is stored in a list
* and the process starts from the beginning for the next BaseData object.</li>
* </ol>
*
* In the second phase, each BaseData object is saved to disk using the specified
* file name and mime-type, according to the following procedure:
* <ol>
* <li>If multiple IFileWriter objects are compatible with the current base data
* object or if the single compatible IFileWriter provides configuration
* options, a dialog window containing a list of IFileWriter objects and
* configurable options is displayed. If the dialog is cancelled by the user,
* neither the current nor the remaining base data objects are saved to disk.
* If the user previously in this phase enabled the "remember options" checkbox
* of the dialog, then the dialog is not shown for base data objects with the
* same data type and associated mime-type if the file writer instance reports
* a higher or equal confidence level for the current base data object.</li>
* <li>The selected writer (either the only available one or the user selected one)
* is used to write the base data object to disk. On failure, an error is
* reported and the second phase continues with the next base data object.</li>
* </ol>
*
* @param data
* @param defaultBaseNames
* @param defaultPath
* @param parent
+ * @param setPathProperty
* @return
*/
static QStringList Save(const std::vector<const mitk::BaseData *> &data,
const QStringList &defaultBaseNames,
const QString &defaultPath = QString(),
QWidget *parent = nullptr,
bool setPathProperty = false);
using mitk::IOUtil::Save;
/**
* @brief SaveBaseDataWithDialog Convenience method to save any data with a Qt dialog.
* @param data BaseData holding the data you wish to save.
* @param fileName The file name where to save the data (including path and extension).
* @param parent An optional QWidget as parent. If no parent is supplied, the QFileDialog can occur anywhere on the
* screen.
* @deprecatedSince{2014_10} Use Save() instead.
*/
DEPRECATED(static void SaveBaseDataWithDialog(mitk::BaseData *data, std::string fileName, QWidget *parent = nullptr));
/**
* @brief SaveSurfaceWithDialog Convenience method to save a surface with a Qt dialog.
* @param surface The surface to save.
* @param fileName The file name where to save the data (including path and extension).
* @param parent An optional QWidget as parent. If no parent is supplied, the QFileDialog can occur anywhere on the
* screen.
* @deprecatedSince{2014_10} Use Save() instead.
*/
DEPRECATED(static void SaveSurfaceWithDialog(mitk::Surface::Pointer surface,
std::string fileName = "",
QWidget *parent = nullptr));
/**
* @brief SaveImageWithDialog Convenience method to save an image with a Qt dialog.
* @param image The image to save.
* @param fileName The file name where to save the data (including path and extension).
* @param parent An optional QWidget as parent. If no parent is supplied, the QFileDialog can occur anywhere on the
* screen.
* @deprecatedSince{2014_10} Use Save() instead.
*/
DEPRECATED(static void SaveImageWithDialog(mitk::Image::Pointer image,
std::string fileName = "",
QWidget *parent = nullptr));
/**
* @brief SavePointSetWithDialog Convenience method to save a pointset with a Qt dialog.
* @param pointset The pointset to save.
* @param fileName The file name where to save the data (including path and extension).
* @param parent An optional QWidget as parent. If no parent is supplied, the QFileDialog can occur anywhere on the
* screen.
* @deprecatedSince{2014_10} Use Save() instead.
*/
DEPRECATED(static void SavePointSetWithDialog(mitk::PointSet::Pointer pointset,
std::string fileName = "",
QWidget *parent = nullptr));
private:
struct Impl;
};
#endif // _QmitkIOUtil__h_
diff --git a/Modules/QtWidgets/include/QmitkModelViewSelectionConnector.h b/Modules/QtWidgets/include/QmitkModelViewSelectionConnector.h
index 8a502c8f93..70e54878b7 100644
--- a/Modules/QtWidgets/include/QmitkModelViewSelectionConnector.h
+++ b/Modules/QtWidgets/include/QmitkModelViewSelectionConnector.h
@@ -1,152 +1,152 @@
/*============================================================================
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 QMITKMODELVIEWSELECTIONCONNECTOR_H
#define QMITKMODELVIEWSELECTIONCONNECTOR_H
#include <MitkQtWidgetsExports.h>
// qt widgets module
#include <QmitkAbstractDataStorageModel.h>
// qt
#include <QAbstractItemView>
/**
* @brief The 'QmitkModelViewSelectionConnector' is used to handle the selections of a model-view-pair and to synchornize them with external node selections
* (e.g. communicated by the application).
*
* The class accepts a view and its model, which are used to react to selection changes. This class is able to propagate selection changes
* to and receive from its surrounding class.
*
* The model-view-pair can be added as a selection listener to a selection service. This should be done by using 'AddPostSelectionListener'
* with the existing selection service of the surrounding 'QmitkAbstractView'.
* The model-view-pair can be set as a selection provider. This should be done by using 'SetAsSelectionProvider' with the existing
* selection provider of the surrounding 'QmitkAbstractView'.
*
* The 'QmitkModelViewSelectionConnector' offers a public slot and signal that can be used to set / propagate the selected
* nodes in the current view:
* The 'SetCurrentSelection'-slot finds the indices of the given selected nodes in its internal data storage model and
* changes the selection of the internal data storage model accordingly.
* The 'CurrentSelectionChanged'-signal sends a list of selected nodes to its environment.
* The 'CurrentSelectionChanged'-signal is emitted by the 'ChangeModelSelection'-function, which transforms the internal item view's
* selection into a data node list. The 'ChangeModelSelection'-function is called whenever the selection of the item view's
* selection model changes.
*/
class MITKQTWIDGETS_EXPORT QmitkModelViewSelectionConnector : public QObject
{
Q_OBJECT
public:
QmitkModelViewSelectionConnector();
/**
* @brief Set the view whose selection model is used to propagate or receive selection changes. Use the view's data model
* to transform selected nodes into model indexes and vice versa.
*
* @pre The view's data model needs to be a 'QmitkAbstractDataStorageModel'. If so, the data model is received from
* the view and stored as a private member.
* The data model must return 'mitk::DataNode::Pointer' objects for model indexes if the role is 'QmitkDataNodeRole'.
* @throw mitk::Exception, if the view is invalid or the view's data model is not a valid 'QmitkAbstractDataStorageModel'.
*
* @param view The view to set.
*/
void SetView(QAbstractItemView* view);
/**
* @brief Retrieve the currently selected nodes (equals the last CurrentSelectionChanged values).
*/
QList<mitk::DataNode::Pointer> GetSelectedNodes() const;
bool GetSelectOnlyVisibleNodes() const;
Q_SIGNALS:
/**
* @brief A signal that will be emitted by the 'ChangeModelSelection'-function. This happens if the selection model
* of the private member item view has changed.
*
* @param nodes A list of data nodes that are newly selected.
*/
void CurrentSelectionChanged(QList<mitk::DataNode::Pointer> nodes);
public Q_SLOTS:
/**
* @brief Change the selection mode of the item view's selection model.
*
* If true, an incoming selection will be filtered (reduced) to only those nodes that are visible to the current view.
* An outgoing selection can then at most contain the filtered nodes.
* If false, the incoming non-visible selection will be stored and later added to the outgoing selection,
* to include the part of the original selection that was not visible.
* The part of the original selection, that is non-visible are the nodes that do not met the predicate of the
* associated QmitkAbstractDataStorageModel.
*
* @param selectOnlyVisibleNodes The bool value to define the selection modus.
*/
void SetSelectOnlyVisibleNodes(bool selectOnlyVisibleNodes);
/**
* @brief Transform a list of data nodes into a model selection and set this as a new selection of the
* selection model of the private member item view.
*
* The function filters the given list of nodes according to the 'm_SelectOnlyVisibleNodes' member variable. If
* necessary, the non-visible nodes are stored. This is done if 'm_SelectOnlyVisibleNodes' is false: In this case
* the selection may be filtered and only a subset of the selected nodes may be visible and therefore (de-)selectable
* in the data storage viewer. By storing the non-visible nodes it is possible to send the new, modified selection
* but also include the selected nodes from the original selection that could not be modified (see 'SetSelectOnlyVisibleNodes').
*
- * @param nodes A list of data nodes that should be newly selected.
+ * @param selectedNodes A list of data nodes that should be newly selected.
*/
void SetCurrentSelection(QList<mitk::DataNode::Pointer> selectedNodes);
private Q_SLOTS:
/**
* @brief Transform a model selection into a data node list and emit the 'CurrentSelectionChanged'-signal.
*
* The function adds the selected nodes from the original selection that could not be modified, if
* 'm_SelectOnlyVisibleNodes' is false.
* This slot is internally connected to the 'selectionChanged'-signal of the selection model of the private member item view.
*
* @param selected The newly selected items.
* @param deselected The newly deselected items.
*/
void ChangeModelSelection(const QItemSelection& selected, const QItemSelection& deselected);
private:
QmitkAbstractDataStorageModel* m_Model;
QAbstractItemView* m_View;
bool m_SelectOnlyVisibleNodes;
QList<mitk::DataNode::Pointer> m_NonVisibleSelection;
/*
* @brief Retrieve the currently selected nodes from the selection model of the private member item view by
* transforming the selection indexes into a data node list.
*
* In order to transform the indices into data nodes, the private data storage model must return
* 'mitk::DataNode::Pointer' objects for model indexes if the role is QmitkDataNodeRole.
*/
QList<mitk::DataNode::Pointer> GetInternalSelectedNodes() const;
/*
* @brief Filter the list of given nodes such that only those nodes are used that are valid
* when using the data storage model's node predicate.
* If no node predicate was set or the data storage model is invalid, the input list
* of given nodes is returned.
*/
QList<mitk::DataNode::Pointer> FilterNodeList(const QList<mitk::DataNode::Pointer>& nodes) const;
};
/*
* @brief Return true, if the nodes in the list of two given selections are equal (Sorting is ignored. Any permutation is valid.)*/
bool MITKQTWIDGETS_EXPORT EqualNodeSelections(const QList<mitk::DataNode::Pointer>& selection1, const QList<mitk::DataNode::Pointer>& selection2);
#endif // QMITKMODELVIEWSELECTIONCONNECTOR_H
diff --git a/Modules/QtWidgets/include/QmitkProgressBar.h b/Modules/QtWidgets/include/QmitkProgressBar.h
index cab36ed703..bd188526a3 100644
--- a/Modules/QtWidgets/include/QmitkProgressBar.h
+++ b/Modules/QtWidgets/include/QmitkProgressBar.h
@@ -1,77 +1,77 @@
/*============================================================================
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 QMITKPROGRESSBAR_H
#define QMITKPROGRESSBAR_H
#include <MitkQtWidgetsExports.h>
#include <QProgressBar>
#include <mitkProgressBarImplementation.h>
/**
* \ingroup QmitkModule
* \brief QT-Toolkit/GUI dependent class that provides the QT's ProgressBar
*
* All mitk-classes will call this class for output:
* mitk::ProgressBar::GetInstance();
*/
class MITKQTWIDGETS_EXPORT QmitkProgressBar : public QProgressBar, public mitk::ProgressBarImplementation
{
Q_OBJECT
public:
//##Documentation
//##@brief Constructor;
//## holds param instance internally and connects this to the mitkProgressBar
QmitkProgressBar(QWidget *parent = nullptr, const char *name = nullptr);
//##Documentation
//##@brief Destructor
~QmitkProgressBar() override;
//##Documentation
//## @brief Sets whether the current progress value is displayed.
void SetPercentageVisible(bool visible) override;
//##Documentation
//## @brief Adds steps to totalSteps.
void AddStepsToDo(unsigned int steps) override;
//##Documentation
//## @brief Sets the current amount of progress to current progress + steps.
- //## @param: steps the number of steps done since last Progress(int steps) call.
+ //## @param steps the number of steps done since last Progress(int steps) call.
void Progress(unsigned int steps) override;
signals:
void SignalAddStepsToDo(unsigned int steps);
void SignalProgress(unsigned int steps);
void SignalSetPercentageVisible(bool visible);
protected slots:
virtual void SlotAddStepsToDo(unsigned int steps);
virtual void SlotProgress(unsigned int steps);
virtual void SlotSetPercentageVisible(bool visible);
private:
//##Documentation
//## @brief Reset the progress bar. The progress bar "rewinds" and shows no progress.
void Reset() override;
unsigned int m_TotalSteps;
unsigned int m_Progress;
};
#endif /* define QMITKPROGRESSBAR_H */
diff --git a/Modules/QtWidgets/include/QmitkRenderWindow.h b/Modules/QtWidgets/include/QmitkRenderWindow.h
index 872fd6cdbc..308235e392 100644
--- a/Modules/QtWidgets/include/QmitkRenderWindow.h
+++ b/Modules/QtWidgets/include/QmitkRenderWindow.h
@@ -1,164 +1,154 @@
/*============================================================================
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 QMITKRENDERWINDOW_H
#define QMITKRENDERWINDOW_H
#include "mitkRenderWindowBase.h"
#include "QmitkRenderWindowMenu.h"
#include <MitkQtWidgetsExports.h>
#include <vtkGenericOpenGLRenderWindow.h>
-#include <QVTKOpenGLWidget.h>
+#include <QVTKOpenGLNativeWidget.h>
#include "mitkBaseRenderer.h"
#include "mitkInteractionEventConst.h"
class QDragEnterEvent;
class QDropEvent;
class QInputEvent;
+class QMouseEvent;
/**
* \ingroup QmitkModule
* \brief MITK implementation of the QVTKWidget
*/
-class MITKQTWIDGETS_EXPORT QmitkRenderWindow : public QVTKOpenGLWidget, public mitk::RenderWindowBase
+class MITKQTWIDGETS_EXPORT QmitkRenderWindow : public QVTKOpenGLNativeWidget, public mitk::RenderWindowBase
{
Q_OBJECT
public:
QmitkRenderWindow(
QWidget *parent = nullptr,
const QString &name = "unnamed renderwindow",
mitk::VtkPropRenderer *renderer = nullptr);
~QmitkRenderWindow() override;
/**
* \brief Whether Qt events should be passed to parent (default: true)
*
* With introduction of the QVTKWidget the behaviour regarding Qt events changed.
* QVTKWidget "accepts" Qt events like mouse clicks (i.e. set an "accepted" flag).
* When this flag is set, Qt fininshed handling of this event -- otherwise it is
* reached through to the widget's parent.
*
* This reaching through to the parent was implicitly required by QmitkMaterialWidget / QmitkMaterialShowCase.
*
* The default behaviour of QmitkRenderWindow is now to clear the "accepted" flag
* of Qt events after they were handled by QVTKWidget. This way parents can also
* handle events.
*
* If you don't want this behaviour, call SetResendQtEvents(true) on your render window.
*/
virtual void SetResendQtEvents(bool resend);
// Set Layout Index to define the Layout Type
void SetLayoutIndex(QmitkRenderWindowMenu::LayoutIndex layoutIndex);
// Get Layout Index to define the Layout Type
QmitkRenderWindowMenu::LayoutIndex GetLayoutIndex();
// MenuWidget need to update the Layout Design List when Layout had changed
void LayoutDesignListChanged(QmitkRenderWindowMenu::LayoutDesign layoutDesign);
// Activate or Deactivate MenuWidget.
void ActivateMenuWidget(bool state);
bool GetActivateMenuWidgetFlag() { return m_MenuWidgetActivated; }
// Get it from the QVTKWidget parent
- vtkRenderWindow *GetVtkRenderWindow() override { return GetRenderWindow(); }
+ vtkRenderWindow *GetVtkRenderWindow() override { return this->renderWindow(); }
vtkRenderWindowInteractor *GetVtkRenderWindowInteractor() override { return nullptr; }
protected:
+ // catch-all event handler
+ bool event(QEvent *e) override;
// overloaded move handler
void moveEvent(QMoveEvent *event) override;
// overloaded show handler
void showEvent(QShowEvent *event) override;
- // overloaded mouse press handler
- void mousePressEvent(QMouseEvent *event) override;
- // overloaded mouse double-click handler
- void mouseDoubleClickEvent(QMouseEvent *event) override;
- // overloaded mouse move handler
- void mouseMoveEvent(QMouseEvent *event) override;
- // overloaded mouse release handler
- void mouseReleaseEvent(QMouseEvent *event) override;
- // overloaded key press handler
- void keyPressEvent(QKeyEvent *event) override;
// overloaded enter handler
void enterEvent(QEvent *) override;
// overloaded leave handler
void leaveEvent(QEvent *) override;
// Overloaded resize handler, see decs in QVTKOpenGLWidget.
// Basically, we have to ensure the VTK rendering is updated for each change in window size.
void resizeGL(int w, int h) override;
/// \brief Simply says we accept the event type.
void dragEnterEvent(QDragEnterEvent *event) override;
/// \brief If the dropped type is application/x-mitk-datanodes we process the request by converting to mitk::DataNode
/// pointers and emitting the NodesDropped signal.
void dropEvent(QDropEvent *event) override;
-#ifndef QT_NO_WHEELEVENT
- // overload wheel mouse event
- void wheelEvent(QWheelEvent *) override;
-#endif
-
void AdjustRenderWindowMenuVisibility(const QPoint &pos);
Q_SIGNALS:
void LayoutDesignChanged(QmitkRenderWindowMenu::LayoutDesign);
void ResetView();
void CrosshairRotationModeChanged(int);
void CrosshairVisibilityChanged(bool);
void moved();
/// \brief Emits a signal to say that this window has had the following nodes dropped on it.
void NodesDropped(QmitkRenderWindow *thisWindow, std::vector<mitk::DataNode *> nodes);
+ void mouseEvent(QMouseEvent *);
+
private Q_SLOTS:
void DeferredHideMenu();
private:
// Helper Functions to Convert Qt-Events to Mitk-Events
mitk::Point2D GetMousePosition(QMouseEvent *me) const;
mitk::Point2D GetMousePosition(QWheelEvent *we) const;
mitk::InteractionEvent::MouseButtons GetEventButton(QMouseEvent *me) const;
mitk::InteractionEvent::MouseButtons GetButtonState(QMouseEvent *me) const;
mitk::InteractionEvent::ModifierKeys GetModifiers(QInputEvent *me) const;
mitk::InteractionEvent::MouseButtons GetButtonState(QWheelEvent *we) const;
std::string GetKeyLetter(QKeyEvent *ke) const;
int GetDelta(QWheelEvent *we) const;
bool m_ResendQtEvents;
QmitkRenderWindowMenu *m_MenuWidget;
bool m_MenuWidgetActivated;
QmitkRenderWindowMenu::LayoutIndex m_LayoutIndex;
vtkSmartPointer<vtkGenericOpenGLRenderWindow> m_InternalRenderWindow;
};
#endif // QMITKRENDERWINDOW_H
diff --git a/Modules/QtWidgets/include/QmitkStdMultiWidget.h b/Modules/QtWidgets/include/QmitkStdMultiWidget.h
index 12b41a7b79..fcd57a81b2 100644
--- a/Modules/QtWidgets/include/QmitkStdMultiWidget.h
+++ b/Modules/QtWidgets/include/QmitkStdMultiWidget.h
@@ -1,158 +1,158 @@
/*============================================================================
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 QMITKSTDMULTIWIDGET_H
#define QMITKSTDMULTIWIDGET_H
// qt widgets module
#include "MitkQtWidgetsExports.h"
#include "QmitkAbstractMultiWidget.h"
/**
* @brief The 'QmitkStdMultiWidget' is a 'QmitkAbstractMultiWidget' that is used to display multiple render windows at once.
* Render windows are predefined in a 2x2 design with 3 different 2D view planes and a 3D render window.
*/
class MITKQTWIDGETS_EXPORT QmitkStdMultiWidget : public QmitkAbstractMultiWidget
{
Q_OBJECT
public:
QmitkStdMultiWidget(
QWidget *parent = nullptr,
Qt::WindowFlags f = nullptr,
const QString &name = "stdmulti");
~QmitkStdMultiWidget() override;
virtual void InitializeMultiWidget() override;
virtual QmitkRenderWindow* GetRenderWindow(const QString& widgetName) const override;
virtual QmitkRenderWindow* GetRenderWindow(const mitk::BaseRenderer::ViewDirection& viewDirection) const override;
virtual void SetSelectedPosition(const mitk::Point3D& newPosition, const QString& widgetName) override;
virtual const mitk::Point3D GetSelectedPosition(const QString& widgetName) const override;
virtual void SetCrosshairVisibility(bool) override;
virtual bool GetCrosshairVisibility() const override;
virtual void ResetCrosshair() override;
virtual void SetWidgetPlaneMode(int mode) override;
mitk::SliceNavigationController* GetTimeNavigationController();
void AddPlanesToDataStorage();
void RemovePlanesFromDataStorage();
/** \brief Listener to the CrosshairPositionEvent
Ensures the CrosshairPositionEvent is handled only once and at the end of the Qt-Event loop
*/
void HandleCrosshairPositionEvent();
/**
* @brief Convenience method to get a render window widget.
- * @param Number of the widget (0-3)
+ * @param number of the widget (0-3)
* @return The render window widget
*/
QmitkRenderWindow* GetRenderWindow(unsigned int number) const;
QmitkRenderWindow* GetRenderWindow1() const;
QmitkRenderWindow* GetRenderWindow2() const;
QmitkRenderWindow* GetRenderWindow3() const;
QmitkRenderWindow* GetRenderWindow4() const;
/**
* @brief Convenience method to get a widget plane.
- * @param Number of the widget plane (1-3)
+ * @param number of the widget plane (1-3)
* @return The widget plane as data node
*/
mitk::DataNode::Pointer GetWidgetPlane(unsigned int number) const;
mitk::DataNode::Pointer GetWidgetPlane1() const;
mitk::DataNode::Pointer GetWidgetPlane2() const;
mitk::DataNode::Pointer GetWidgetPlane3() const;
/**
* @brief SetDecorationColor Set the color of the decoration of the 4 widgets.
*
* This is used to color the frame of the renderwindow and the corner annatation.
* For the first 3 widgets, this color is a property of the helper object nodes
* which contain the respective plane geometry. For widget 4, this is a member,
* since there is no data node for this widget.
*/
void SetDecorationColor(unsigned int widgetNumber, mitk::Color color);
/**
* @brief GetDecorationColorForWidget Get the color for annotation, crosshair and rectangle.
* @param widgetNumber Number of the renderwindow (0-3).
* @return Color in mitk format.
*/
mitk::Color GetDecorationColor(unsigned int widgetNumber);
public Q_SLOTS:
// mouse events
virtual void mousePressEvent(QMouseEvent*) override;
virtual void moveEvent(QMoveEvent* e) override;
virtual void wheelEvent(QWheelEvent* e) override;
/// Receives the signal from HandleCrosshairPositionEvent, executes the StatusBar update
void HandleCrosshairPositionEventDelayed();
void Fit();
void AddDisplayPlaneSubTree();
void EnsureDisplayContainsPoint(mitk::BaseRenderer *renderer, const mitk::Point3D &p);
void SetWidgetPlaneVisibility(const char *widgetName, bool visible, mitk::BaseRenderer *renderer = nullptr);
void SetWidgetPlanesVisibility(bool visible, mitk::BaseRenderer *renderer = nullptr);
Q_SIGNALS:
void WheelMoved(QWheelEvent *);
void Moved();
private:
virtual void SetLayoutImpl() override;
virtual void SetInteractionSchemeImpl() override { }
void CreateRenderWindowWidgets();
mitk::SliceNavigationController* m_TimeNavigationController;
/**
* @brief The 3 helper objects which contain the plane geometry.
*/
mitk::DataNode::Pointer m_PlaneNode1;
mitk::DataNode::Pointer m_PlaneNode2;
mitk::DataNode::Pointer m_PlaneNode3;
/**
* @brief m_ParentNodeForGeometryPlanes This helper object is added to the datastorage
* and contains the 3 planes for displaying the image geometry (crosshair and 3D planes).
*/
mitk::DataNode::Pointer m_ParentNodeForGeometryPlanes;
/**
* @brief m_DecorationColorWidget4 color for annotation and rectangle of widget 4.
*
* For other widgets1-3, the color is a property of the respective data node.
* There is no node for widget 4, hence, we need an extra member.
*/
mitk::Color m_DecorationColorWidget4;
bool m_PendingCrosshairPositionEvent;
};
#endif // QMITKSTDMULTIWIDGET_H
diff --git a/Modules/QtWidgets/src/QmitkRenderWindow.cpp b/Modules/QtWidgets/src/QmitkRenderWindow.cpp
index 0ecf112050..6405ef419c 100644
--- a/Modules/QtWidgets/src/QmitkRenderWindow.cpp
+++ b/Modules/QtWidgets/src/QmitkRenderWindow.cpp
@@ -1,502 +1,458 @@
/*============================================================================
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 "QmitkRenderWindow.h"
#include "mitkInteractionKeyEvent.h"
#include "mitkInternalEvent.h"
#include "mitkMouseDoubleClickEvent.h"
#include "mitkMouseMoveEvent.h"
#include "mitkMousePressEvent.h"
#include "mitkMouseReleaseEvent.h"
#include "mitkMouseWheelEvent.h"
#include <QCursor>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QKeyEvent>
#include <QMouseEvent>
#include <QResizeEvent>
#include <QSurfaceFormat>
#include <QTimer>
#include <QWheelEvent>
#include <QWindow>
#include "QmitkMimeTypes.h"
#include "QmitkRenderWindowMenu.h"
QmitkRenderWindow::QmitkRenderWindow(QWidget *parent, const QString &name, mitk::VtkPropRenderer *)
- : QVTKOpenGLWidget(parent)
+ : QVTKOpenGLNativeWidget(parent)
, m_ResendQtEvents(true)
, m_MenuWidget(nullptr)
, m_MenuWidgetActivated(false)
, m_LayoutIndex(QmitkRenderWindowMenu::LayoutIndex::AXIAL)
{
m_InternalRenderWindow = vtkSmartPointer<vtkGenericOpenGLRenderWindow>::New();
m_InternalRenderWindow->SetMultiSamples(0);
m_InternalRenderWindow->SetAlphaBitPlanes(0);
- SetRenderWindow(m_InternalRenderWindow);
+ setRenderWindow(m_InternalRenderWindow);
Initialize(name.toStdString().c_str());
setFocusPolicy(Qt::StrongFocus);
setMouseTracking(true);
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setSizePolicy(sizePolicy);
}
QmitkRenderWindow::~QmitkRenderWindow()
{
Destroy(); // Destroy mitkRenderWindowBase
}
void QmitkRenderWindow::SetResendQtEvents(bool resend)
{
m_ResendQtEvents = resend;
}
void QmitkRenderWindow::SetLayoutIndex(QmitkRenderWindowMenu::LayoutIndex layoutIndex)
{
m_LayoutIndex = layoutIndex;
if (nullptr != m_MenuWidget)
{
m_MenuWidget->SetLayoutIndex(layoutIndex);
}
}
QmitkRenderWindowMenu::LayoutIndex QmitkRenderWindow::GetLayoutIndex()
{
if (nullptr != m_MenuWidget)
{
return m_MenuWidget->GetLayoutIndex();
}
else
{
return QmitkRenderWindowMenu::LayoutIndex::AXIAL;
}
}
void QmitkRenderWindow::LayoutDesignListChanged(QmitkRenderWindowMenu::LayoutDesign layoutDesign)
{
if (nullptr != m_MenuWidget)
{
m_MenuWidget->UpdateLayoutDesignList(layoutDesign);
}
}
void QmitkRenderWindow::ActivateMenuWidget(bool state)
{
if (nullptr == m_MenuWidget)
{
m_MenuWidget = new QmitkRenderWindowMenu(this, nullptr, m_Renderer);
m_MenuWidget->SetLayoutIndex(m_LayoutIndex);
}
m_MenuWidgetActivated = state;
if (m_MenuWidgetActivated)
{
connect(m_MenuWidget, &QmitkRenderWindowMenu::LayoutDesignChanged, this, &QmitkRenderWindow::LayoutDesignChanged);
connect(m_MenuWidget, &QmitkRenderWindowMenu::ResetView, this, &QmitkRenderWindow::ResetView);
connect(m_MenuWidget, &QmitkRenderWindowMenu::CrosshairVisibilityChanged, this, &QmitkRenderWindow::CrosshairVisibilityChanged);
connect(m_MenuWidget, &QmitkRenderWindowMenu::CrosshairRotationModeChanged, this, &QmitkRenderWindow::CrosshairRotationModeChanged);
}
else
{
disconnect(m_MenuWidget, &QmitkRenderWindowMenu::LayoutDesignChanged, this, &QmitkRenderWindow::LayoutDesignChanged);
disconnect(m_MenuWidget, &QmitkRenderWindowMenu::ResetView, this, &QmitkRenderWindow::ResetView);
disconnect(m_MenuWidget, &QmitkRenderWindowMenu::CrosshairVisibilityChanged, this, &QmitkRenderWindow::CrosshairVisibilityChanged);
disconnect(m_MenuWidget, &QmitkRenderWindowMenu::CrosshairRotationModeChanged, this, &QmitkRenderWindow::CrosshairRotationModeChanged);
m_MenuWidget->hide();
}
}
void QmitkRenderWindow::moveEvent(QMoveEvent *event)
{
- QVTKOpenGLWidget::moveEvent(event);
+ QVTKOpenGLNativeWidget::moveEvent(event);
// after a move the overlays need to be positioned
emit moved();
}
void QmitkRenderWindow::showEvent(QShowEvent *event)
{
- QVTKOpenGLWidget::showEvent(event);
+ QVTKOpenGLNativeWidget::showEvent(event);
// this singleshot is necessary to have the overlays positioned correctly after initial show
// simple call of moved() is no use here!!
QTimer::singleShot(0, this, SIGNAL(moved()));
}
-void QmitkRenderWindow::mousePressEvent(QMouseEvent *me)
+bool QmitkRenderWindow::event(QEvent* e)
{
- // Get mouse position in vtk display coordinate system. me contains qt display infos...
- mitk::Point2D displayPos = GetMousePosition(me);
-
- mitk::MousePressEvent::Pointer mPressEvent =
- mitk::MousePressEvent::New(m_Renderer, displayPos, GetButtonState(me), GetModifiers(me), GetEventButton(me));
-
- if (!this->HandleEvent(mPressEvent.GetPointer()))
- {
- QVTKOpenGLWidget::mousePressEvent(me);
- }
-
- if (m_ResendQtEvents)
- {
- me->ignore();
- }
-}
-
-void QmitkRenderWindow::mouseDoubleClickEvent(QMouseEvent *me)
-{
- mitk::Point2D displayPos = GetMousePosition(me);
- mitk::MouseDoubleClickEvent::Pointer mPressEvent =
- mitk::MouseDoubleClickEvent::New(m_Renderer, displayPos, GetButtonState(me), GetModifiers(me), GetEventButton(me));
-
- if (!this->HandleEvent(mPressEvent.GetPointer()))
- {
- QVTKOpenGLWidget::mousePressEvent(me);
- }
-
- if (m_ResendQtEvents)
- {
- me->ignore();
- }
-}
-
-void QmitkRenderWindow::mouseReleaseEvent(QMouseEvent *me)
-{
- mitk::Point2D displayPos = GetMousePosition(me);
- mitk::MouseReleaseEvent::Pointer mReleaseEvent =
- mitk::MouseReleaseEvent::New(m_Renderer, displayPos, GetButtonState(me), GetModifiers(me), GetEventButton(me));
-
- if (!this->HandleEvent(mReleaseEvent.GetPointer()))
+ mitk::InteractionEvent::Pointer mitkEvent = nullptr;
+ switch (e->type())
{
- QVTKOpenGLWidget::mouseReleaseEvent(me);
- }
-
- if (m_ResendQtEvents)
- {
- me->ignore();
- }
-}
-
-void QmitkRenderWindow::mouseMoveEvent(QMouseEvent *me)
-{
- mitk::Point2D displayPos = GetMousePosition(me);
-
- AdjustRenderWindowMenuVisibility(me->pos());
-
- mitk::MouseMoveEvent::Pointer mMoveEvent =
- mitk::MouseMoveEvent::New(m_Renderer, displayPos, GetButtonState(me), GetModifiers(me));
-
- if (!this->HandleEvent(mMoveEvent.GetPointer()))
- {
- QVTKOpenGLWidget::mouseMoveEvent(me);
- }
-}
-
-void QmitkRenderWindow::wheelEvent(QWheelEvent *we)
-{
- mitk::Point2D displayPos = GetMousePosition(we);
- mitk::MouseWheelEvent::Pointer mWheelEvent =
- mitk::MouseWheelEvent::New(m_Renderer, displayPos, GetButtonState(we), GetModifiers(we), GetDelta(we));
-
- if (!this->HandleEvent(mWheelEvent.GetPointer()))
- {
- QVTKOpenGLWidget::wheelEvent(we);
- }
-
- if (m_ResendQtEvents)
- {
- we->ignore();
+ case QEvent::MouseMove:
+ {
+ auto me = static_cast<QMouseEvent *>(e);
+ this->AdjustRenderWindowMenuVisibility(me->pos());
+ mitkEvent = mitk::MouseMoveEvent::New(m_Renderer, GetMousePosition(me), GetButtonState(me), GetModifiers(me));
+ break;
+ }
+ case QEvent::MouseButtonPress:
+ {
+ auto me = static_cast<QMouseEvent *>(e);
+ mitkEvent = mitk::MousePressEvent::New( m_Renderer, GetMousePosition(me), GetButtonState(me), GetModifiers(me), GetEventButton(me));
+ break;
+ }
+ case QEvent::MouseButtonRelease:
+ {
+ auto me = static_cast<QMouseEvent *>(e);
+ mitkEvent = mitk::MouseReleaseEvent::New( m_Renderer, GetMousePosition(me), GetButtonState(me), GetModifiers(me), GetEventButton(me));
+ break;
+ }
+ case QEvent::MouseButtonDblClick:
+ {
+ auto me = static_cast<QMouseEvent *>(e);
+ mitkEvent = mitk::MouseDoubleClickEvent::New( m_Renderer, GetMousePosition(me), GetButtonState(me), GetModifiers(me), GetEventButton(me));
+ break;
+ }
+ case QEvent::Wheel:
+ {
+ auto we = static_cast<QWheelEvent *>(e);
+ mitkEvent = mitk::MouseWheelEvent::New( m_Renderer, GetMousePosition(we), GetButtonState(we), GetModifiers(we), GetDelta(we));
+ break;
+ }
+ case QEvent::KeyPress:
+ {
+ auto ke = static_cast<QKeyEvent*>(e);
+ mitkEvent = mitk::InteractionKeyEvent::New(m_Renderer, GetKeyLetter(ke), GetModifiers(ke));
+ break;
+ }
+ default:
+ {
+ break;
+ }
}
-}
-
-void QmitkRenderWindow::keyPressEvent(QKeyEvent *ke)
-{
- mitk::InteractionEvent::ModifierKeys modifiers = GetModifiers(ke);
- std::string key = GetKeyLetter(ke);
- mitk::InteractionKeyEvent::Pointer keyEvent = mitk::InteractionKeyEvent::New(m_Renderer, key, modifiers);
- if (!this->HandleEvent(keyEvent.GetPointer()))
+ if (mitkEvent != nullptr)
{
- QVTKOpenGLWidget::keyPressEvent(ke);
+ if (this->HandleEvent(mitkEvent.GetPointer())) {
+ return m_ResendQtEvents ? false : true;
+ }
}
- if (m_ResendQtEvents)
- {
- ke->ignore();
- }
+ return QVTKOpenGLNativeWidget::event(e);
}
void QmitkRenderWindow::enterEvent(QEvent *e)
{
// TODO implement new event
- QVTKOpenGLWidget::enterEvent(e);
+ QVTKOpenGLNativeWidget::enterEvent(e);
}
void QmitkRenderWindow::leaveEvent(QEvent *e)
{
mitk::InternalEvent::Pointer internalEvent = mitk::InternalEvent::New(this->m_Renderer, nullptr, "LeaveRenderWindow");
this->HandleEvent(internalEvent.GetPointer());
if (nullptr != m_MenuWidget)
{
m_MenuWidget->smoothHide();
}
- QVTKOpenGLWidget::leaveEvent(e);
+ QVTKOpenGLNativeWidget::leaveEvent(e);
}
void QmitkRenderWindow::resizeGL(int w, int h)
{
- QVTKOpenGLWidget::resizeGL(w, h);
- mitk::RenderingManager::GetInstance()->ForceImmediateUpdate(GetRenderWindow());
+ QVTKOpenGLNativeWidget::resizeGL(w, h);
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdate(renderWindow());
}
void QmitkRenderWindow::dragEnterEvent(QDragEnterEvent *event)
{
if (event->mimeData()->hasFormat("application/x-mitk-datanodes"))
{
event->accept();
}
}
void QmitkRenderWindow::dropEvent(QDropEvent *event)
{
QList<mitk::DataNode *> dataNodeList = QmitkMimeTypes::ToDataNodePtrList(event->mimeData());
if (!dataNodeList.empty())
{
emit NodesDropped(this, dataNodeList.toVector().toStdVector());
}
}
void QmitkRenderWindow::AdjustRenderWindowMenuVisibility(const QPoint & /*pos*/)
{
if (nullptr != m_MenuWidget)
{
m_MenuWidget->ShowMenu();
m_MenuWidget->MoveWidgetToCorrectPos(1.0f);
}
}
void QmitkRenderWindow::DeferredHideMenu()
{
MITK_DEBUG << "QmitkRenderWindow::DeferredHideMenu";
if (nullptr != m_MenuWidget)
{
m_MenuWidget->HideMenu();
}
}
mitk::Point2D QmitkRenderWindow::GetMousePosition(QMouseEvent *me) const
{
mitk::Point2D point;
point[0] = me->x();
// We need to convert the y component, as the display and vtk have other definitions for the y direction
point[1] = m_Renderer->GetSizeY() - me->y();
return point;
}
mitk::Point2D QmitkRenderWindow::GetMousePosition(QWheelEvent *we) const
{
mitk::Point2D point;
point[0] = we->x();
// We need to convert the y component, as the display and vtk have other definitions for the y direction
point[1] = m_Renderer->GetSizeY() - we->y();
return point;
}
mitk::InteractionEvent::MouseButtons QmitkRenderWindow::GetEventButton(QMouseEvent *me) const
{
mitk::InteractionEvent::MouseButtons eventButton;
switch (me->button())
{
case Qt::LeftButton:
eventButton = mitk::InteractionEvent::LeftMouseButton;
break;
case Qt::RightButton:
eventButton = mitk::InteractionEvent::RightMouseButton;
break;
case Qt::MidButton:
eventButton = mitk::InteractionEvent::MiddleMouseButton;
break;
default:
eventButton = mitk::InteractionEvent::NoButton;
break;
}
return eventButton;
}
mitk::InteractionEvent::MouseButtons QmitkRenderWindow::GetButtonState(QMouseEvent *me) const
{
mitk::InteractionEvent::MouseButtons buttonState = mitk::InteractionEvent::NoButton;
if (me->buttons() & Qt::LeftButton)
{
buttonState = buttonState | mitk::InteractionEvent::LeftMouseButton;
}
if (me->buttons() & Qt::RightButton)
{
buttonState = buttonState | mitk::InteractionEvent::RightMouseButton;
}
if (me->buttons() & Qt::MidButton)
{
buttonState = buttonState | mitk::InteractionEvent::MiddleMouseButton;
}
return buttonState;
}
mitk::InteractionEvent::ModifierKeys QmitkRenderWindow::GetModifiers(QInputEvent *me) const
{
mitk::InteractionEvent::ModifierKeys modifiers = mitk::InteractionEvent::NoKey;
if (me->modifiers() & Qt::ALT)
{
modifiers = modifiers | mitk::InteractionEvent::AltKey;
}
if (me->modifiers() & Qt::CTRL)
{
modifiers = modifiers | mitk::InteractionEvent::ControlKey;
}
if (me->modifiers() & Qt::SHIFT)
{
modifiers = modifiers | mitk::InteractionEvent::ShiftKey;
}
return modifiers;
}
mitk::InteractionEvent::MouseButtons QmitkRenderWindow::GetButtonState(QWheelEvent *we) const
{
mitk::InteractionEvent::MouseButtons buttonState = mitk::InteractionEvent::NoButton;
if (we->buttons() & Qt::LeftButton)
{
buttonState = buttonState | mitk::InteractionEvent::LeftMouseButton;
}
if (we->buttons() & Qt::RightButton)
{
buttonState = buttonState | mitk::InteractionEvent::RightMouseButton;
}
if (we->buttons() & Qt::MidButton)
{
buttonState = buttonState | mitk::InteractionEvent::MiddleMouseButton;
}
return buttonState;
}
std::string QmitkRenderWindow::GetKeyLetter(QKeyEvent *ke) const
{
// Converting Qt Key Event to string element.
std::string key = "";
int tkey = ke->key();
if (tkey < 128)
{ // standard ascii letter
key = (char)toupper(tkey);
}
else
{ // special keys
switch (tkey)
{
case Qt::Key_Return:
key = mitk::InteractionEvent::KeyReturn;
break;
case Qt::Key_Enter:
key = mitk::InteractionEvent::KeyEnter;
break;
case Qt::Key_Escape:
key = mitk::InteractionEvent::KeyEsc;
break;
case Qt::Key_Delete:
key = mitk::InteractionEvent::KeyDelete;
break;
case Qt::Key_Up:
key = mitk::InteractionEvent::KeyArrowUp;
break;
case Qt::Key_Down:
key = mitk::InteractionEvent::KeyArrowDown;
break;
case Qt::Key_Left:
key = mitk::InteractionEvent::KeyArrowLeft;
break;
case Qt::Key_Right:
key = mitk::InteractionEvent::KeyArrowRight;
break;
case Qt::Key_F1:
key = mitk::InteractionEvent::KeyF1;
break;
case Qt::Key_F2:
key = mitk::InteractionEvent::KeyF2;
break;
case Qt::Key_F3:
key = mitk::InteractionEvent::KeyF3;
break;
case Qt::Key_F4:
key = mitk::InteractionEvent::KeyF4;
break;
case Qt::Key_F5:
key = mitk::InteractionEvent::KeyF5;
break;
case Qt::Key_F6:
key = mitk::InteractionEvent::KeyF6;
break;
case Qt::Key_F7:
key = mitk::InteractionEvent::KeyF7;
break;
case Qt::Key_F8:
key = mitk::InteractionEvent::KeyF8;
break;
case Qt::Key_F9:
key = mitk::InteractionEvent::KeyF9;
break;
case Qt::Key_F10:
key = mitk::InteractionEvent::KeyF10;
break;
case Qt::Key_F11:
key = mitk::InteractionEvent::KeyF11;
break;
case Qt::Key_F12:
key = mitk::InteractionEvent::KeyF12;
break;
case Qt::Key_End:
key = mitk::InteractionEvent::KeyEnd;
break;
case Qt::Key_Home:
key = mitk::InteractionEvent::KeyPos1;
break;
case Qt::Key_Insert:
key = mitk::InteractionEvent::KeyInsert;
break;
case Qt::Key_PageDown:
key = mitk::InteractionEvent::KeyPageDown;
break;
case Qt::Key_PageUp:
key = mitk::InteractionEvent::KeyPageUp;
break;
case Qt::Key_Space:
key = mitk::InteractionEvent::KeySpace;
break;
}
}
return key;
}
int QmitkRenderWindow::GetDelta(QWheelEvent *we) const
{
return we->delta();
}
diff --git a/Modules/QtWidgets/src/QmitkRenderWindowWidget.cpp b/Modules/QtWidgets/src/QmitkRenderWindowWidget.cpp
index 2f50f4351a..daaaadefa6 100644
--- a/Modules/QtWidgets/src/QmitkRenderWindowWidget.cpp
+++ b/Modules/QtWidgets/src/QmitkRenderWindowWidget.cpp
@@ -1,254 +1,254 @@
/*============================================================================
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 "QmitkRenderWindowWidget.h"
// vtk
#include <vtkCornerAnnotation.h>
#include <vtkTextProperty.h>
QmitkRenderWindowWidget::QmitkRenderWindowWidget(QWidget* parent/* = nullptr*/,
const QString& widgetName/* = ""*/,
mitk::DataStorage* dataStorage/* = nullptr*/)
: QFrame(parent)
, m_WidgetName(widgetName)
, m_DataStorage(dataStorage)
, m_RenderWindow(nullptr)
, m_PointSetNode(nullptr)
, m_PointSet(nullptr)
{
this->InitializeGUI();
}
QmitkRenderWindowWidget::~QmitkRenderWindowWidget()
{
auto sliceNavigationController = m_RenderWindow->GetSliceNavigationController();
if (nullptr != sliceNavigationController)
{
sliceNavigationController->SetCrosshairEvent.RemoveListener(mitk::MessageDelegate1<QmitkRenderWindowWidget, mitk::Point3D>(this, &QmitkRenderWindowWidget::SetCrosshair));
}
if (nullptr != m_DataStorage)
{
m_DataStorage->Remove(m_PointSetNode);
}
}
void QmitkRenderWindowWidget::SetDataStorage(mitk::DataStorage* dataStorage)
{
if (dataStorage == m_DataStorage)
{
return;
}
m_DataStorage = dataStorage;
if (nullptr != m_RenderWindow)
{
- mitk::BaseRenderer::GetInstance(m_RenderWindow->GetRenderWindow())->SetDataStorage(dataStorage);
+ mitk::BaseRenderer::GetInstance(m_RenderWindow->renderWindow())->SetDataStorage(dataStorage);
}
}
mitk::SliceNavigationController* QmitkRenderWindowWidget::GetSliceNavigationController() const
{
return m_RenderWindow->GetSliceNavigationController();
}
void QmitkRenderWindowWidget::RequestUpdate()
{
- mitk::RenderingManager::GetInstance()->RequestUpdate(m_RenderWindow->GetRenderWindow());
+ mitk::RenderingManager::GetInstance()->RequestUpdate(m_RenderWindow->renderWindow());
}
void QmitkRenderWindowWidget::ForceImmediateUpdate()
{
- mitk::RenderingManager::GetInstance()->ForceImmediateUpdate(m_RenderWindow->GetRenderWindow());
+ mitk::RenderingManager::GetInstance()->ForceImmediateUpdate(m_RenderWindow->renderWindow());
}
void QmitkRenderWindowWidget::SetGradientBackgroundColors(const mitk::Color& upper, const mitk::Color& lower)
{
vtkRenderer* vtkRenderer = m_RenderWindow->GetRenderer()->GetVtkRenderer();
if (nullptr == vtkRenderer)
{
return;
}
m_GradientBackgroundColors.first = upper;
m_GradientBackgroundColors.second = lower;
vtkRenderer->SetBackground(lower[0], lower[1], lower[2]);
vtkRenderer->SetBackground2(upper[0], upper[1], upper[2]);
ShowGradientBackground(true);
}
void QmitkRenderWindowWidget::ShowGradientBackground(bool show)
{
m_RenderWindow->GetRenderer()->GetVtkRenderer()->SetGradientBackground(show);
}
bool QmitkRenderWindowWidget::IsGradientBackgroundOn() const
{
return m_RenderWindow->GetRenderer()->GetVtkRenderer()->GetGradientBackground();
}
void QmitkRenderWindowWidget::SetDecorationColor(const mitk::Color& color)
{
m_DecorationColor = color;
m_CornerAnnotation->GetTextProperty()->SetColor(m_DecorationColor[0], m_DecorationColor[1], m_DecorationColor[2]);
QColor hexColor(m_DecorationColor[0] * 255, m_DecorationColor[1] * 255, m_DecorationColor[2] * 255);
setStyleSheet("QmitkRenderWindowWidget { border: 2px solid " + hexColor.name(QColor::HexRgb) + "; }");
}
void QmitkRenderWindowWidget::ShowColoredRectangle(bool show)
{
if (show)
{
setFrameStyle(QFrame::Box | QFrame::Plain);
}
else
{
setFrameStyle(NoFrame);
}
}
bool QmitkRenderWindowWidget::IsColoredRectangleVisible() const
{
return frameStyle() > 0;
}
void QmitkRenderWindowWidget::ShowCornerAnnotation(bool show)
{
m_CornerAnnotation->SetVisibility(show);
}
bool QmitkRenderWindowWidget::IsCornerAnnotationVisible() const
{
return m_CornerAnnotation->GetVisibility() > 0;
}
void QmitkRenderWindowWidget::SetCornerAnnotationText(const std::string& cornerAnnotation)
{
m_CornerAnnotation->SetText(0, cornerAnnotation.c_str());
}
std::string QmitkRenderWindowWidget::GetCornerAnnotationText() const
{
return std::string(m_CornerAnnotation->GetText(0));
}
bool QmitkRenderWindowWidget::IsRenderWindowMenuActivated() const
{
return m_RenderWindow->GetActivateMenuWidgetFlag();
}
void QmitkRenderWindowWidget::ActivateCrosshair(bool activate)
{
if (nullptr == m_DataStorage)
{
return;
}
if (activate)
{
try
{
m_DataStorage->Add(m_PointSetNode);
}
catch(std::invalid_argument& /*e*/)
{
// crosshair already existing
return;
}
}
else
{
m_DataStorage->Remove(m_PointSetNode);
}
}
void QmitkRenderWindowWidget::InitializeGUI()
{
m_Layout = new QHBoxLayout(this);
m_Layout->setMargin(0);
setLayout(m_Layout);
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
setContentsMargins(0, 0, 0, 0);
if (nullptr == m_DataStorage)
{
return;
}
mitk::RenderingManager::GetInstance()->SetDataStorage(m_DataStorage);
// create render window for this render window widget
m_RenderWindow = new QmitkRenderWindow(this, m_WidgetName, nullptr);
m_RenderWindow->SetLayoutIndex(mitk::BaseRenderer::ViewDirection::SAGITTAL);
m_RenderWindow->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Sagittal);
m_RenderWindow->GetSliceNavigationController()->SetCrosshairEvent.AddListener(mitk::MessageDelegate1<QmitkRenderWindowWidget, mitk::Point3D>(this, &QmitkRenderWindowWidget::SetCrosshair));
- connect(m_RenderWindow, &QVTKOpenGLWidget::mouseEvent, this, &QmitkRenderWindowWidget::MouseEvent);
+ connect(m_RenderWindow, &QmitkRenderWindow::mouseEvent, this, &QmitkRenderWindowWidget::MouseEvent);
mitk::TimeGeometry::ConstPointer timeGeometry = m_DataStorage->ComputeBoundingGeometry3D(m_DataStorage->GetAll());
mitk::RenderingManager::GetInstance()->InitializeViews(timeGeometry);
m_Layout->addWidget(m_RenderWindow);
// add point set as a crosshair
m_PointSetNode = mitk::DataNode::New();
m_PointSetNode->SetProperty("name", mitk::StringProperty::New("Crosshair of render window " + m_WidgetName.toStdString()));
m_PointSetNode->SetProperty("helper object", mitk::BoolProperty::New(true)); // crosshair-node should typically be invisible
// set the crosshair only visible for this specific renderer
m_PointSetNode->SetBoolProperty("fixedLayer", true, m_RenderWindow->GetRenderer());
m_PointSetNode->SetVisibility(true, m_RenderWindow->GetRenderer());
m_PointSetNode->SetVisibility(false);
m_PointSet = mitk::PointSet::New();
m_PointSetNode->SetData(m_PointSet);
// set colors and corner annotation
InitializeDecorations();
}
void QmitkRenderWindowWidget::InitializeDecorations()
{
vtkRenderer* vtkRenderer = m_RenderWindow->GetRenderer()->GetVtkRenderer();
if (nullptr == vtkRenderer)
{
return;
}
// initialize background color gradients
float black[3] = { 0.0f, 0.0f, 0.0f };
SetGradientBackgroundColors(black, black);
// initialize decoration color, rectangle and annotation text
float white[3] = { 1.0f, 1.0f, 1.0f };
m_DecorationColor = white;
setFrameStyle(QFrame::Box | QFrame::Plain);
QColor hexColor(m_DecorationColor[0] * 255, m_DecorationColor[1] * 255, m_DecorationColor[2] * 255);
setStyleSheet("border: 2px solid " + hexColor.name(QColor::HexRgb));
m_CornerAnnotation = vtkSmartPointer<vtkCornerAnnotation>::New();
m_CornerAnnotation->SetText(0, "Sagittal");
m_CornerAnnotation->SetMaximumFontSize(12);
m_CornerAnnotation->GetTextProperty()->SetColor(m_DecorationColor[0], m_DecorationColor[1], m_DecorationColor[2]);
if (0 == vtkRenderer->HasViewProp(m_CornerAnnotation))
{
vtkRenderer->AddViewProp(m_CornerAnnotation);
}
}
void QmitkRenderWindowWidget::SetCrosshair(mitk::Point3D selectedPoint)
{
m_PointSet->SetPoint(1, selectedPoint, 0);
- mitk::RenderingManager::GetInstance()->RequestUpdate(m_RenderWindow->GetRenderWindow());
+ mitk::RenderingManager::GetInstance()->RequestUpdate(m_RenderWindow->renderWindow());
}
diff --git a/Modules/QtWidgets/src/QmitkStdMultiWidget.cpp b/Modules/QtWidgets/src/QmitkStdMultiWidget.cpp
index 880f13d30f..a16e26f56d 100644
--- a/Modules/QtWidgets/src/QmitkStdMultiWidget.cpp
+++ b/Modules/QtWidgets/src/QmitkStdMultiWidget.cpp
@@ -1,811 +1,811 @@
/*============================================================================
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.
============================================================================*/
#define SMW_INFO MITK_INFO("widget.stdmulti")
#include "QmitkStdMultiWidget.h"
#include "QmitkRenderWindowWidget.h"
// mitk core
#include <mitkCameraController.h>
#include <mitkImage.h>
#include <mitkImagePixelReadAccessor.h>
#include <mitkInteractionConst.h>
#include <mitkLine.h>
#include <mitkNodePredicateBase.h>
#include <mitkNodePredicateDataType.h>
#include <mitkNodePredicateNot.h>
#include <mitkNodePredicateProperty.h>
#include <mitkPixelTypeMultiplex.h>
#include <mitkPlaneGeometryDataMapper2D.h>
#include <mitkPointSet.h>
#include <mitkProperties.h>
#include <mitkStatusBar.h>
#include <mitkDisplayActionEventHandlerStd.h>
#include <mitkVtkLayerController.h>
// qt
#include <QList>
#include <QMouseEvent>
#include <QTimer>
// vtk
#include <vtkSmartPointer.h>
// c++
#include <iomanip>
QmitkStdMultiWidget::QmitkStdMultiWidget(QWidget *parent,
Qt::WindowFlags f/* = 0*/,
const QString &name/* = "stdmulti"*/)
: QmitkAbstractMultiWidget(parent, f, name)
, m_TimeNavigationController(nullptr)
, m_PendingCrosshairPositionEvent(false)
{
m_TimeNavigationController = mitk::RenderingManager::GetInstance()->GetTimeNavigationController();
}
QmitkStdMultiWidget::~QmitkStdMultiWidget()
{
m_TimeNavigationController->Disconnect(GetRenderWindow1()->GetSliceNavigationController());
m_TimeNavigationController->Disconnect(GetRenderWindow2()->GetSliceNavigationController());
m_TimeNavigationController->Disconnect(GetRenderWindow3()->GetSliceNavigationController());
m_TimeNavigationController->Disconnect(GetRenderWindow4()->GetSliceNavigationController());
}
void QmitkStdMultiWidget::InitializeMultiWidget()
{
// yellow is default color for widget4
m_DecorationColorWidget4[0] = 1.0f;
m_DecorationColorWidget4[1] = 1.0f;
m_DecorationColorWidget4[2] = 0.0f;
SetLayout(2, 2);
// transfer colors in WorldGeometry-Nodes of the associated Renderer
mitk::IntProperty::Pointer layer;
// of widget 1
m_PlaneNode1 =
- mitk::BaseRenderer::GetInstance(GetRenderWindow1()->GetRenderWindow())->GetCurrentWorldPlaneGeometryNode();
+ mitk::BaseRenderer::GetInstance(GetRenderWindow1()->renderWindow())->GetCurrentWorldPlaneGeometryNode();
m_PlaneNode1->SetColor(GetDecorationColor(0));
layer = mitk::IntProperty::New(1000);
m_PlaneNode1->SetProperty("layer", layer);
// of widget 2
m_PlaneNode2 =
- mitk::BaseRenderer::GetInstance(GetRenderWindow2()->GetRenderWindow())->GetCurrentWorldPlaneGeometryNode();
+ mitk::BaseRenderer::GetInstance(GetRenderWindow2()->renderWindow())->GetCurrentWorldPlaneGeometryNode();
m_PlaneNode2->SetColor(GetDecorationColor(1));
layer = mitk::IntProperty::New(1000);
m_PlaneNode2->SetProperty("layer", layer);
// of widget 3
m_PlaneNode3 =
- mitk::BaseRenderer::GetInstance(GetRenderWindow3()->GetRenderWindow())->GetCurrentWorldPlaneGeometryNode();
+ mitk::BaseRenderer::GetInstance(GetRenderWindow3()->renderWindow())->GetCurrentWorldPlaneGeometryNode();
m_PlaneNode3->SetColor(GetDecorationColor(2));
layer = mitk::IntProperty::New(1000);
m_PlaneNode3->SetProperty("layer", layer);
// the parent node
m_ParentNodeForGeometryPlanes =
- mitk::BaseRenderer::GetInstance(GetRenderWindow4()->GetRenderWindow())->GetCurrentWorldPlaneGeometryNode();
+ mitk::BaseRenderer::GetInstance(GetRenderWindow4()->renderWindow())->GetCurrentWorldPlaneGeometryNode();
layer = mitk::IntProperty::New(1000);
m_ParentNodeForGeometryPlanes->SetProperty("layer", layer);
AddDisplayPlaneSubTree();
SetDisplayActionEventHandler(std::make_unique<mitk::DisplayActionEventHandlerStd>());
auto displayActionEventHandler = GetDisplayActionEventHandler();
if (nullptr != displayActionEventHandler)
{
displayActionEventHandler->InitActions();
}
}
QmitkRenderWindow* QmitkStdMultiWidget::GetRenderWindow(const QString& widgetName) const
{
if ("axial" == widgetName)
{
return GetRenderWindow1();
}
if ("sagittal" == widgetName)
{
return GetRenderWindow2();
}
if ("coronal" == widgetName)
{
return GetRenderWindow3();
}
if ("3d" == widgetName)
{
return GetRenderWindow4();
}
return QmitkAbstractMultiWidget::GetRenderWindow(widgetName);
}
QmitkRenderWindow* QmitkStdMultiWidget::GetRenderWindow(const mitk::BaseRenderer::ViewDirection& viewDirection) const
{
return GetRenderWindow(static_cast<unsigned int>(viewDirection));
}
void QmitkStdMultiWidget::SetSelectedPosition(const mitk::Point3D& newPosition, const QString& /*widgetName*/)
{
GetRenderWindow1()->GetSliceNavigationController()->SelectSliceByPoint(newPosition);
GetRenderWindow2()->GetSliceNavigationController()->SelectSliceByPoint(newPosition);
GetRenderWindow3()->GetSliceNavigationController()->SelectSliceByPoint(newPosition);
RequestUpdateAll();
}
const mitk::Point3D QmitkStdMultiWidget::GetSelectedPosition(const QString& /*widgetName*/) const
{
const mitk::PlaneGeometry* plane1 = GetRenderWindow1()->GetSliceNavigationController()->GetCurrentPlaneGeometry();
const mitk::PlaneGeometry* plane2 = GetRenderWindow2()->GetSliceNavigationController()->GetCurrentPlaneGeometry();
const mitk::PlaneGeometry* plane3 = GetRenderWindow3()->GetSliceNavigationController()->GetCurrentPlaneGeometry();
mitk::Line3D line;
if ((plane1 != nullptr) && (plane2 != nullptr)
&& (plane1->IntersectionLine(plane2, line)))
{
mitk::Point3D point;
if ((plane3 != nullptr) && (plane3->IntersectionPoint(line, point)))
{
return point;
}
}
return mitk::Point3D();
}
void QmitkStdMultiWidget::SetCrosshairVisibility(bool visible)
{
if (m_PlaneNode1.IsNotNull())
{
m_PlaneNode1->SetVisibility(visible);
}
if (m_PlaneNode2.IsNotNull())
{
m_PlaneNode2->SetVisibility(visible);
}
if (m_PlaneNode3.IsNotNull())
{
m_PlaneNode3->SetVisibility(visible);
}
RequestUpdateAll();
}
bool QmitkStdMultiWidget::GetCrosshairVisibility() const
{
bool crosshairVisibility = true;
if (m_PlaneNode1.IsNotNull())
{
bool visibilityProperty = false;
m_PlaneNode1->GetVisibility(visibilityProperty, nullptr);
crosshairVisibility &= visibilityProperty;
}
if (m_PlaneNode2.IsNotNull())
{
bool visibilityProperty = false;
crosshairVisibility &= m_PlaneNode2->GetVisibility(visibilityProperty, nullptr);
crosshairVisibility &= visibilityProperty;
}
if (m_PlaneNode3.IsNotNull())
{
bool visibilityProperty = false;
crosshairVisibility &= m_PlaneNode3->GetVisibility(visibilityProperty, nullptr);
crosshairVisibility &= visibilityProperty;
}
return crosshairVisibility;
}
void QmitkStdMultiWidget::ResetCrosshair()
{
auto dataStorage = GetDataStorage();
if (nullptr == dataStorage)
{
return;
}
mitk::RenderingManager::GetInstance()->InitializeViewsByBoundingObjects(dataStorage);
SetWidgetPlaneMode(mitk::InteractionSchemeSwitcher::MITKStandard);
}
void QmitkStdMultiWidget::SetWidgetPlaneMode(int userMode)
{
MITK_DEBUG << "Changing crosshair mode to " << userMode;
switch (userMode)
{
case 0:
SetInteractionScheme(mitk::InteractionSchemeSwitcher::MITKStandard);
break;
case 1:
SetInteractionScheme(mitk::InteractionSchemeSwitcher::MITKRotationUncoupled);
break;
case 2:
SetInteractionScheme(mitk::InteractionSchemeSwitcher::MITKRotationCoupled);
break;
case 3:
SetInteractionScheme(mitk::InteractionSchemeSwitcher::MITKSwivel);
break;
}
}
mitk::SliceNavigationController* QmitkStdMultiWidget::GetTimeNavigationController()
{
return m_TimeNavigationController;
}
void QmitkStdMultiWidget::AddPlanesToDataStorage()
{
auto dataStorage = GetDataStorage();
if (nullptr == dataStorage)
{
return;
}
if (m_PlaneNode1.IsNotNull() && m_PlaneNode2.IsNotNull()
&& m_PlaneNode3.IsNotNull() && m_ParentNodeForGeometryPlanes.IsNotNull())
{
dataStorage->Add(m_ParentNodeForGeometryPlanes);
dataStorage->Add(m_PlaneNode1, m_ParentNodeForGeometryPlanes);
dataStorage->Add(m_PlaneNode2, m_ParentNodeForGeometryPlanes);
dataStorage->Add(m_PlaneNode3, m_ParentNodeForGeometryPlanes);
}
}
void QmitkStdMultiWidget::RemovePlanesFromDataStorage()
{
auto dataStorage = GetDataStorage();
if (nullptr == dataStorage)
{
return;
}
if (m_PlaneNode1.IsNotNull() && m_PlaneNode2.IsNotNull()
&& m_PlaneNode3.IsNotNull() && m_ParentNodeForGeometryPlanes.IsNotNull())
{
dataStorage->Remove(m_PlaneNode1);
dataStorage->Remove(m_PlaneNode2);
dataStorage->Remove(m_PlaneNode3);
dataStorage->Remove(m_ParentNodeForGeometryPlanes);
}
}
void QmitkStdMultiWidget::HandleCrosshairPositionEvent()
{
if (!m_PendingCrosshairPositionEvent)
{
m_PendingCrosshairPositionEvent = true;
QTimer::singleShot(0, this, SLOT(HandleCrosshairPositionEventDelayed()));
}
}
QmitkRenderWindow* QmitkStdMultiWidget::GetRenderWindow(unsigned int number) const
{
switch (number)
{
case 0:
return GetRenderWindow1();
case 1:
return GetRenderWindow2();
case 2:
return GetRenderWindow3();
case 3:
return GetRenderWindow4();
default:
MITK_ERROR << "Requested unknown render window";
break;
}
return nullptr;
}
QmitkRenderWindow* QmitkStdMultiWidget::GetRenderWindow1() const
{
return QmitkAbstractMultiWidget::GetRenderWindow(GetNameFromIndex(0, 0));
}
QmitkRenderWindow* QmitkStdMultiWidget::GetRenderWindow2() const
{
return QmitkAbstractMultiWidget::GetRenderWindow(GetNameFromIndex(0, 1));
}
QmitkRenderWindow* QmitkStdMultiWidget::GetRenderWindow3() const
{
return QmitkAbstractMultiWidget::GetRenderWindow(GetNameFromIndex(1, 0));
}
QmitkRenderWindow* QmitkStdMultiWidget::GetRenderWindow4() const
{
return QmitkAbstractMultiWidget::GetRenderWindow(GetNameFromIndex(1, 1));
}
mitk::DataNode::Pointer QmitkStdMultiWidget::GetWidgetPlane1() const
{
return m_PlaneNode1;
}
mitk::DataNode::Pointer QmitkStdMultiWidget::GetWidgetPlane2() const
{
return m_PlaneNode2;
}
mitk::DataNode::Pointer QmitkStdMultiWidget::GetWidgetPlane3() const
{
return m_PlaneNode3;
}
mitk::DataNode::Pointer QmitkStdMultiWidget::GetWidgetPlane(unsigned number) const
{
switch (number)
{
case 1:
return m_PlaneNode1;
case 2:
return m_PlaneNode2;
case 3:
return m_PlaneNode3;
default:
MITK_ERROR << "Requested unknown render window";
break;
}
return nullptr;
}
void QmitkStdMultiWidget::SetDecorationColor(unsigned int widgetNumber, mitk::Color color)
{
switch (widgetNumber)
{
case 0:
if (m_PlaneNode1.IsNotNull())
{
m_PlaneNode1->SetColor(color);
}
break;
case 1:
if (m_PlaneNode2.IsNotNull())
{
m_PlaneNode2->SetColor(color);
}
break;
case 2:
if (m_PlaneNode3.IsNotNull())
{
m_PlaneNode3->SetColor(color);
}
break;
case 3:
m_DecorationColorWidget4 = color;
break;
default:
MITK_ERROR << "Decoration color for unknown widget!";
break;
}
}
mitk::Color QmitkStdMultiWidget::GetDecorationColor(unsigned int widgetNumber)
{
// The implementation looks a bit messy here, but it avoids
// synchronization of the color of the geometry nodes and an
// internal member here.
// Default colors were chosen for decent visibility.
// Feel free to change your preferences in the workbench.
float tmp[3] = { 0.0f, 0.0f, 0.0f };
switch (widgetNumber)
{
case 0:
{
if (m_PlaneNode1.IsNotNull())
{
if (m_PlaneNode1->GetColor(tmp))
{
return dynamic_cast<mitk::ColorProperty *>(m_PlaneNode1->GetProperty("color"))->GetColor();
}
}
float red[3] = { 0.753f, 0.0f, 0.0f }; // This is #C00000 in hex
return mitk::Color(red);
}
case 1:
{
if (m_PlaneNode2.IsNotNull())
{
if (m_PlaneNode2->GetColor(tmp))
{
return dynamic_cast<mitk::ColorProperty *>(m_PlaneNode2->GetProperty("color"))->GetColor();
}
}
float green[3] = { 0.0f, 0.69f, 0.0f }; // This is #00B000 in hex
return mitk::Color(green);
}
case 2:
{
if (m_PlaneNode3.IsNotNull())
{
if (m_PlaneNode3->GetColor(tmp))
{
return dynamic_cast<mitk::ColorProperty *>(m_PlaneNode3->GetProperty("color"))->GetColor();
}
}
float blue[3] = { 0.0, 0.502f, 1.0f }; // This is #0080FF in hex
return mitk::Color(blue);
}
case 3:
{
return m_DecorationColorWidget4;
}
default:
MITK_ERROR << "Decoration color for unknown widget!";
float black[3] = { 0.0f, 0.0f, 0.0f };
return mitk::Color(black);
}
}
void QmitkStdMultiWidget::mousePressEvent(QMouseEvent* e)
{
if (QEvent::MouseButtonPress != e->type())
{
return;
}
auto renderWindowWidget = dynamic_cast<QmitkRenderWindowWidget*>(this->sender());
if (nullptr == renderWindowWidget)
{
return;
}
auto renderWindowWidgetPointer = GetRenderWindowWidget(renderWindowWidget->GetWidgetName());
SetActiveRenderWindowWidget(renderWindowWidgetPointer);
}
void QmitkStdMultiWidget::moveEvent(QMoveEvent* e)
{
QWidget::moveEvent(e);
// it is necessary to readjust the position of the Annotation as the StdMultiWidget has moved
// unfortunately it's not done by QmitkRenderWindow::moveEvent -> must be done here
emit Moved();
}
void QmitkStdMultiWidget::wheelEvent(QWheelEvent* e)
{
emit WheelMoved(e);
}
void QmitkStdMultiWidget::HandleCrosshairPositionEventDelayed()
{
auto dataStorage = GetDataStorage();
if (nullptr == dataStorage)
{
return;
}
m_PendingCrosshairPositionEvent = false;
// find image with highest layer
mitk::TNodePredicateDataType<mitk::Image>::Pointer isImageData = mitk::TNodePredicateDataType<mitk::Image>::New();
mitk::DataStorage::SetOfObjects::ConstPointer nodes = dataStorage->GetSubset(isImageData).GetPointer();
mitk::Point3D crosshairPos = GetSelectedPosition("");
mitk::BaseRenderer* baseRenderer = GetRenderWindow1()->GetSliceNavigationController()->GetRenderer();
auto globalCurrentTimePoint = baseRenderer->GetTime();
mitk::DataNode::Pointer node = mitk::FindTopmostVisibleNode(nodes, crosshairPos, globalCurrentTimePoint, baseRenderer);
mitk::DataNode::Pointer topSourceNode;
mitk::Image::Pointer image;
bool isBinary = false;
int component = 0;
if (node.IsNotNull())
{
node->GetBoolProperty("binary", isBinary);
if (isBinary)
{
mitk::DataStorage::SetOfObjects::ConstPointer sourcenodes = dataStorage->GetSources(node, nullptr, true);
if (!sourcenodes->empty())
{
topSourceNode = mitk::FindTopmostVisibleNode(sourcenodes, crosshairPos, globalCurrentTimePoint, baseRenderer);
}
if (topSourceNode.IsNotNull())
{
image = dynamic_cast<mitk::Image *>(topSourceNode->GetData());
topSourceNode->GetIntProperty("Image.Displayed Component", component);
}
else
{
image = dynamic_cast<mitk::Image *>(node->GetData());
node->GetIntProperty("Image.Displayed Component", component);
}
}
else
{
image = dynamic_cast<mitk::Image *>(node->GetData());
node->GetIntProperty("Image.Displayed Component", component);
}
}
std::string statusText;
std::stringstream stream;
itk::Index<3> p;
unsigned int timestep = baseRenderer->GetTimeStep();
if (image.IsNotNull() && (image->GetTimeSteps() > timestep))
{
image->GetGeometry()->WorldToIndex(crosshairPos, p);
stream.precision(2);
stream << "Position: <" << std::fixed << crosshairPos[0] << ", " << std::fixed << crosshairPos[1] << ", "
<< std::fixed << crosshairPos[2] << "> mm";
stream << "; Index: <" << p[0] << ", " << p[1] << ", " << p[2] << "> ";
mitk::ScalarType pixelValue;
mitkPixelTypeMultiplex5(mitk::FastSinglePixelAccess,
image->GetChannelDescriptor().GetPixelType(),
image,
image->GetVolumeData(image->GetTimeGeometry()->TimePointToTimeStep(globalCurrentTimePoint)),
p,
pixelValue,
component);
if (fabs(pixelValue) > 1000000 || fabs(pixelValue) < 0.01)
{
stream << "; Time: " << globalCurrentTimePoint << " ms; Pixelvalue: " << std::scientific << pixelValue << " ";
}
else
{
stream << "; Time: " << globalCurrentTimePoint << " ms; Pixelvalue: " << pixelValue << " ";
}
}
else
{
stream << "No image information at this position!";
}
statusText = stream.str();
mitk::StatusBar::GetInstance()->DisplayGreyValueText(statusText.c_str());
}
void QmitkStdMultiWidget::Fit()
{
vtkSmartPointer<vtkRenderer> vtkrenderer;
- vtkrenderer = mitk::BaseRenderer::GetInstance(GetRenderWindow1()->GetRenderWindow())->GetVtkRenderer();
+ vtkrenderer = mitk::BaseRenderer::GetInstance(GetRenderWindow1()->renderWindow())->GetVtkRenderer();
if (nullptr != vtkrenderer)
{
vtkrenderer->ResetCamera();
}
- vtkrenderer = mitk::BaseRenderer::GetInstance(GetRenderWindow2()->GetRenderWindow())->GetVtkRenderer();
+ vtkrenderer = mitk::BaseRenderer::GetInstance(GetRenderWindow2()->renderWindow())->GetVtkRenderer();
if (nullptr != vtkrenderer)
{
vtkrenderer->ResetCamera();
}
- vtkrenderer = mitk::BaseRenderer::GetInstance(GetRenderWindow3()->GetRenderWindow())->GetVtkRenderer();
+ vtkrenderer = mitk::BaseRenderer::GetInstance(GetRenderWindow3()->renderWindow())->GetVtkRenderer();
if (nullptr != vtkrenderer)
{
vtkrenderer->ResetCamera();
}
- vtkrenderer = mitk::BaseRenderer::GetInstance(GetRenderWindow4()->GetRenderWindow())->GetVtkRenderer();
+ vtkrenderer = mitk::BaseRenderer::GetInstance(GetRenderWindow4()->renderWindow())->GetVtkRenderer();
if (nullptr != vtkrenderer)
{
vtkrenderer->ResetCamera();
}
- mitk::BaseRenderer::GetInstance(GetRenderWindow1()->GetRenderWindow())->GetCameraController()->Fit();
- mitk::BaseRenderer::GetInstance(GetRenderWindow2()->GetRenderWindow())->GetCameraController()->Fit();
- mitk::BaseRenderer::GetInstance(GetRenderWindow3()->GetRenderWindow())->GetCameraController()->Fit();
- mitk::BaseRenderer::GetInstance(GetRenderWindow4()->GetRenderWindow())->GetCameraController()->Fit();
+ mitk::BaseRenderer::GetInstance(GetRenderWindow1()->renderWindow())->GetCameraController()->Fit();
+ mitk::BaseRenderer::GetInstance(GetRenderWindow2()->renderWindow())->GetCameraController()->Fit();
+ mitk::BaseRenderer::GetInstance(GetRenderWindow3()->renderWindow())->GetCameraController()->Fit();
+ mitk::BaseRenderer::GetInstance(GetRenderWindow4()->renderWindow())->GetCameraController()->Fit();
int w = vtkObject::GetGlobalWarningDisplay();
vtkObject::GlobalWarningDisplayOff();
vtkObject::SetGlobalWarningDisplay(w);
}
void QmitkStdMultiWidget::AddDisplayPlaneSubTree()
{
// add the displayed planes of the multiwidget to a node to which the subtree
// @a planesSubTree points ...
mitk::PlaneGeometryDataMapper2D::Pointer mapper;
// ... of widget 1
- mitk::BaseRenderer* renderer1 = mitk::BaseRenderer::GetInstance(GetRenderWindow1()->GetRenderWindow());
+ mitk::BaseRenderer* renderer1 = mitk::BaseRenderer::GetInstance(GetRenderWindow1()->renderWindow());
m_PlaneNode1 = renderer1->GetCurrentWorldPlaneGeometryNode();
m_PlaneNode1->SetProperty("visible", mitk::BoolProperty::New(true));
m_PlaneNode1->SetProperty("name", mitk::StringProperty::New(std::string(renderer1->GetName()) + ".plane"));
m_PlaneNode1->SetProperty("includeInBoundingBox", mitk::BoolProperty::New(false));
m_PlaneNode1->SetProperty("helper object", mitk::BoolProperty::New(true));
mapper = mitk::PlaneGeometryDataMapper2D::New();
m_PlaneNode1->SetMapper(mitk::BaseRenderer::Standard2D, mapper);
// ... of widget 2
- mitk::BaseRenderer* renderer2 = mitk::BaseRenderer::GetInstance(GetRenderWindow2()->GetRenderWindow());
+ mitk::BaseRenderer* renderer2 = mitk::BaseRenderer::GetInstance(GetRenderWindow2()->renderWindow());
m_PlaneNode2 = renderer2->GetCurrentWorldPlaneGeometryNode();
m_PlaneNode2->SetProperty("visible", mitk::BoolProperty::New(true));
m_PlaneNode2->SetProperty("name", mitk::StringProperty::New(std::string(renderer2->GetName()) + ".plane"));
m_PlaneNode2->SetProperty("includeInBoundingBox", mitk::BoolProperty::New(false));
m_PlaneNode2->SetProperty("helper object", mitk::BoolProperty::New(true));
mapper = mitk::PlaneGeometryDataMapper2D::New();
m_PlaneNode2->SetMapper(mitk::BaseRenderer::Standard2D, mapper);
// ... of widget 3
- mitk::BaseRenderer *renderer3 = mitk::BaseRenderer::GetInstance(GetRenderWindow3()->GetRenderWindow());
+ mitk::BaseRenderer *renderer3 = mitk::BaseRenderer::GetInstance(GetRenderWindow3()->renderWindow());
m_PlaneNode3 = renderer3->GetCurrentWorldPlaneGeometryNode();
m_PlaneNode3->SetProperty("visible", mitk::BoolProperty::New(true));
m_PlaneNode3->SetProperty("name", mitk::StringProperty::New(std::string(renderer3->GetName()) + ".plane"));
m_PlaneNode3->SetProperty("includeInBoundingBox", mitk::BoolProperty::New(false));
m_PlaneNode3->SetProperty("helper object", mitk::BoolProperty::New(true));
mapper = mitk::PlaneGeometryDataMapper2D::New();
m_PlaneNode3->SetMapper(mitk::BaseRenderer::Standard2D, mapper);
m_ParentNodeForGeometryPlanes = mitk::DataNode::New();
m_ParentNodeForGeometryPlanes->SetProperty("name", mitk::StringProperty::New("Widgets"));
m_ParentNodeForGeometryPlanes->SetProperty("helper object", mitk::BoolProperty::New(true));
}
void QmitkStdMultiWidget::EnsureDisplayContainsPoint(mitk::BaseRenderer *renderer, const mitk::Point3D &p)
{
mitk::Point2D pointOnDisplay;
renderer->WorldToDisplay(p, pointOnDisplay);
if (pointOnDisplay[0] < renderer->GetVtkRenderer()->GetOrigin()[0] ||
pointOnDisplay[1] < renderer->GetVtkRenderer()->GetOrigin()[1] ||
pointOnDisplay[0] > renderer->GetVtkRenderer()->GetOrigin()[0] + renderer->GetViewportSize()[0] ||
pointOnDisplay[1] > renderer->GetVtkRenderer()->GetOrigin()[1] + renderer->GetViewportSize()[1])
{
mitk::Point2D pointOnPlane;
renderer->GetCurrentWorldPlaneGeometry()->Map(p, pointOnPlane);
renderer->GetCameraController()->MoveCameraToPoint(pointOnPlane);
}
}
void QmitkStdMultiWidget::SetWidgetPlaneVisibility(const char *widgetName, bool visible, mitk::BaseRenderer *renderer)
{
auto dataStorage = GetDataStorage();
if (nullptr != dataStorage)
{
mitk::DataNode* dataNode = dataStorage->GetNamedNode(widgetName);
if (dataNode != nullptr)
{
dataNode->SetVisibility(visible, renderer);
}
}
}
void QmitkStdMultiWidget::SetWidgetPlanesVisibility(bool visible, mitk::BaseRenderer *renderer)
{
if (m_PlaneNode1.IsNotNull())
{
m_PlaneNode1->SetVisibility(visible, renderer);
}
if (m_PlaneNode2.IsNotNull())
{
m_PlaneNode2->SetVisibility(visible, renderer);
}
if (m_PlaneNode3.IsNotNull())
{
m_PlaneNode3->SetVisibility(visible, renderer);
}
mitk::RenderingManager::GetInstance()->RequestUpdateAll();
}
//////////////////////////////////////////////////////////////////////////
// PRIVATE
//////////////////////////////////////////////////////////////////////////
void QmitkStdMultiWidget::SetLayoutImpl()
{
CreateRenderWindowWidgets();
GetMultiWidgetLayoutManager()->SetLayoutDesign(QmitkMultiWidgetLayoutManager::LayoutDesign::DEFAULT);
// Initialize views as axial, sagittal, coronal to all data objects in DataStorage
auto geo = GetDataStorage()->ComputeBoundingGeometry3D(GetDataStorage()->GetAll());
mitk::RenderingManager::GetInstance()->InitializeViews(geo);
}
void QmitkStdMultiWidget::CreateRenderWindowWidgets()
{
// create axial render window (widget)
QString renderWindowWidgetName = GetNameFromIndex(0, 0);
RenderWindowWidgetPointer renderWindowWidget1 = std::make_shared<QmitkRenderWindowWidget>(this, renderWindowWidgetName, GetDataStorage());
auto renderWindow1 = renderWindowWidget1->GetRenderWindow();
renderWindow1->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Axial);
renderWindowWidget1->SetDecorationColor(GetDecorationColor(0));
renderWindowWidget1->SetCornerAnnotationText("Axial");
renderWindowWidget1->GetRenderWindow()->SetLayoutIndex(ViewDirection::AXIAL);
AddRenderWindowWidget(renderWindowWidgetName, renderWindowWidget1);
// create sagittal render window (widget)
renderWindowWidgetName = GetNameFromIndex(0, 1);
RenderWindowWidgetPointer renderWindowWidget2 = std::make_shared<QmitkRenderWindowWidget>(this, renderWindowWidgetName, GetDataStorage());
auto renderWindow2 = renderWindowWidget2->GetRenderWindow();
renderWindow2->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Sagittal);
renderWindowWidget2->SetDecorationColor(GetDecorationColor(1));
renderWindowWidget2->setStyleSheet("border: 0px");
renderWindowWidget2->SetCornerAnnotationText("Sagittal");
renderWindowWidget2->GetRenderWindow()->SetLayoutIndex(ViewDirection::SAGITTAL);
AddRenderWindowWidget(renderWindowWidgetName, renderWindowWidget2);
// create coronal render window (widget)
renderWindowWidgetName = GetNameFromIndex(1, 0);
RenderWindowWidgetPointer renderWindowWidget3 = std::make_shared<QmitkRenderWindowWidget>(this, renderWindowWidgetName, GetDataStorage());
auto renderWindow3 = renderWindowWidget3->GetRenderWindow();
renderWindow3->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Frontal);
renderWindowWidget3->SetDecorationColor(GetDecorationColor(2));
renderWindowWidget3->SetCornerAnnotationText("Coronal");
renderWindowWidget3->GetRenderWindow()->SetLayoutIndex(ViewDirection::CORONAL);
AddRenderWindowWidget(renderWindowWidgetName, renderWindowWidget3);
// create 3D render window (widget)
renderWindowWidgetName = GetNameFromIndex(1, 1);
RenderWindowWidgetPointer renderWindowWidget4 = std::make_shared<QmitkRenderWindowWidget>(this, renderWindowWidgetName, GetDataStorage());
auto renderWindow4 = renderWindowWidget4->GetRenderWindow();
renderWindow4->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Original);
renderWindowWidget4->SetDecorationColor(GetDecorationColor(3));
renderWindowWidget4->SetCornerAnnotationText("3D");
renderWindowWidget4->GetRenderWindow()->SetLayoutIndex(ViewDirection::THREE_D);
- mitk::BaseRenderer::GetInstance(renderWindowWidget4->GetRenderWindow()->GetRenderWindow())->SetMapperID(mitk::BaseRenderer::Standard3D);
+ mitk::BaseRenderer::GetInstance(renderWindowWidget4->GetRenderWindow()->renderWindow())->SetMapperID(mitk::BaseRenderer::Standard3D);
AddRenderWindowWidget(renderWindowWidgetName, renderWindowWidget4);
SetActiveRenderWindowWidget(renderWindowWidget1);
// connect to the "time navigation controller": send time via sliceNavigationControllers
m_TimeNavigationController->ConnectGeometryTimeEvent(renderWindow1->GetSliceNavigationController(), false);
m_TimeNavigationController->ConnectGeometryTimeEvent(renderWindow2->GetSliceNavigationController(), false);
m_TimeNavigationController->ConnectGeometryTimeEvent(renderWindow3->GetSliceNavigationController(), false);
m_TimeNavigationController->ConnectGeometryTimeEvent(renderWindow4->GetSliceNavigationController(), false);
renderWindow1->GetSliceNavigationController()->ConnectGeometrySendEvent(
- mitk::BaseRenderer::GetInstance(renderWindow4->GetRenderWindow()));
+ mitk::BaseRenderer::GetInstance(renderWindow4->renderWindow()));
// reverse connection between sliceNavigationControllers and timeNavigationController
renderWindow1->GetSliceNavigationController()->ConnectGeometryTimeEvent(m_TimeNavigationController, false);
renderWindow2->GetSliceNavigationController()->ConnectGeometryTimeEvent(m_TimeNavigationController, false);
renderWindow3->GetSliceNavigationController()->ConnectGeometryTimeEvent(m_TimeNavigationController, false);
//renderWindow4->GetSliceNavigationController()->ConnectGeometryTimeEvent(m_TimeNavigationController, false);
auto layoutManager = GetMultiWidgetLayoutManager();
connect(renderWindowWidget1.get(), &QmitkRenderWindowWidget::MouseEvent, this, &QmitkStdMultiWidget::mousePressEvent);
connect(renderWindow1, &QmitkRenderWindow::ResetView, this, &QmitkStdMultiWidget::ResetCrosshair);
connect(renderWindow1, &QmitkRenderWindow::CrosshairVisibilityChanged, this, &QmitkStdMultiWidget::SetCrosshairVisibility);
connect(renderWindow1, &QmitkRenderWindow::CrosshairRotationModeChanged, this, &QmitkStdMultiWidget::SetWidgetPlaneMode);
connect(renderWindow1, &QmitkRenderWindow::LayoutDesignChanged, layoutManager, &QmitkMultiWidgetLayoutManager::SetLayoutDesign);
connect(renderWindowWidget2.get(), &QmitkRenderWindowWidget::MouseEvent, this, &QmitkStdMultiWidget::mousePressEvent);
connect(renderWindow2, &QmitkRenderWindow::ResetView, this, &QmitkStdMultiWidget::ResetCrosshair);
connect(renderWindow2, &QmitkRenderWindow::CrosshairVisibilityChanged, this, &QmitkStdMultiWidget::SetCrosshairVisibility);
connect(renderWindow2, &QmitkRenderWindow::CrosshairRotationModeChanged, this, &QmitkStdMultiWidget::SetWidgetPlaneMode);
connect(renderWindow2, &QmitkRenderWindow::LayoutDesignChanged, layoutManager, &QmitkMultiWidgetLayoutManager::SetLayoutDesign);
connect(renderWindowWidget3.get(), &QmitkRenderWindowWidget::MouseEvent, this, &QmitkStdMultiWidget::mousePressEvent);
connect(renderWindow3, &QmitkRenderWindow::ResetView, this, &QmitkStdMultiWidget::ResetCrosshair);
connect(renderWindow3, &QmitkRenderWindow::CrosshairVisibilityChanged, this, &QmitkStdMultiWidget::SetCrosshairVisibility);
connect(renderWindow3, &QmitkRenderWindow::CrosshairRotationModeChanged, this, &QmitkStdMultiWidget::SetWidgetPlaneMode);
connect(renderWindow3, &QmitkRenderWindow::LayoutDesignChanged, layoutManager, &QmitkMultiWidgetLayoutManager::SetLayoutDesign);
connect(renderWindowWidget4.get(), &QmitkRenderWindowWidget::MouseEvent, this, &QmitkStdMultiWidget::mousePressEvent);
connect(renderWindow4, &QmitkRenderWindow::ResetView, this, &QmitkStdMultiWidget::ResetCrosshair);
connect(renderWindow4, &QmitkRenderWindow::CrosshairVisibilityChanged, this, &QmitkStdMultiWidget::SetCrosshairVisibility);
connect(renderWindow4, &QmitkRenderWindow::CrosshairRotationModeChanged, this, &QmitkStdMultiWidget::SetWidgetPlaneMode);
connect(renderWindow4, &QmitkRenderWindow::LayoutDesignChanged, layoutManager, &QmitkMultiWidgetLayoutManager::SetLayoutDesign);
}
diff --git a/Modules/QtWidgetsExt/CMakeLists.txt b/Modules/QtWidgetsExt/CMakeLists.txt
index c2e295c41b..85fdc156a1 100644
--- a/Modules/QtWidgetsExt/CMakeLists.txt
+++ b/Modules/QtWidgetsExt/CMakeLists.txt
@@ -1,6 +1,6 @@
MITK_CREATE_MODULE(
DEPENDS MitkAlgorithmsExt MitkQtWidgets PRIVATE MitkSceneSerializationBase
PACKAGE_DEPENDS
PUBLIC Qwt CTK|CTKWidgets
- PRIVATE Qt5|Concurrent+Svg+Xml
+ PRIVATE Qt5|Concurrent+Svg+Xml VTK|IOImage
)
diff --git a/Modules/QtWidgetsExt/include/QmitkPlotWidget.h b/Modules/QtWidgetsExt/include/QmitkPlotWidget.h
index 9fc9f6c9c0..d8849416c1 100644
--- a/Modules/QtWidgetsExt/include/QmitkPlotWidget.h
+++ b/Modules/QtWidgetsExt/include/QmitkPlotWidget.h
@@ -1,299 +1,300 @@
/*============================================================================
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 _QmitkPlotWidget_H_
#define _QmitkPlotWidget_H_
#include "MitkQtWidgetsExtExports.h"
#include "mitkCommon.h"
#include <qwidget.h>
#include <qwt_legend.h>
#include <qwt_plot.h>
#include <qwt_plot_curve.h>
#include <qwt_plot_intervalcurve.h>
#include <qwt_symbol.h>
#include <tuple>
#include <vector>
/**
* Provides a convenient interface for plotting curves using qwt.
* Designed for qwt version 5.2.1.
* Can be used with a QmitkPlotDialog, which provides a "Close" button.
* @see QmitkPlotDialog
*
* To plot data do the following:
* 1. Create two QmitkPlotWidget::DataVector Objects and fill them
* with corresponding x/y values. DataVectors are simple stl-vectors
* of type std::vector<double>. Please note that the xValues
* vector and the yValues vector MUST have the same size.
* 2. Instantiate the widget for example like that:
* QmitkPlotWidget* widget = new QmitkPlotWidget( this, "widget" );
* widget->SetAxisTitle( QwtPlot::xBottom, "My x asis [mm]" );
* widget->SetAxisTitle( QwtPlot::yLeft, "My y axis [mm]" );
* int curveId = widget->InsertCurve( "My sophisticated data" );
* widget->SetCurveData( curveId, xValues, yValues );
* widget->SetCurvePen( curveId, QPen( red ) );
* widget->SetCurveTitle( curveId, "My curve description" );
* widget->Replot();
* 3. You can modify the behavior of the plot by directly referencing
* the QwtPlot instance using the method GetPlot().
* @see QwtPlot
* @deprecatedSince{2018_04} Use QmitkChartWidget instead
*/
class MITKQTWIDGETSEXT_EXPORT QmitkPlotWidget
: public QWidget
{
private:
Q_OBJECT
public:
/**
* represents the data type used for scalar values stored
* in data arrays. This type is provided by qwt and may not
* be changed.
*/
typedef double ScalarType;
/**
* This type may be used to store a set of scalar values
* representing either x or y coordinates of the data
* points that should be rendered.
*/
typedef std::vector<ScalarType> DataVector;
/**
* convenience type used to store pairs representing x/y coordinates
* that should be rendered as a curve by the plot widget
*/
typedef std::vector<std::pair<double, double>> XYDataVector;
/**
* Standard qt constructor
*/
QmitkPlotWidget(QWidget *parent = nullptr,
const char *title = nullptr,
const char *name = nullptr,
Qt::WindowFlags f = nullptr);
/**
* Virtual destructor
*/
~QmitkPlotWidget() override;
/**
* Returns the instance of the plot-widget. This may be used
* to modify any detail of the appearance of the plot.
*/
QwtPlot *GetPlot();
/**
* Set the title using (formatted) QwtText object
*/
void SetPlotTitle(const QwtText &qwt_title);
/**
* Set plain text title, using default formatting
*/
void SetPlotTitle(const char *title);
/**
* Inserts a new curve into the plot-window.
* @param title the name of the curve
+ * @param color
* @returns the id of the curve. Use this id to
* refer to the curve, if you want to modify or add data.
*/
unsigned int InsertCurve(const char *title, QColor color = QColor(Qt::black));
/**
* Sets the title of the given axis. For the set of available axes
* @see QwtPlot::Axis.
* @param axis the axis for which the description should be set.
* @param title the name of the axis.
*/
void SetAxisTitle(int axis, const char *title);
/**
* Sets the data for a previously added curve. Data is provided as two vectors of double.
* The first vector represents the x coordinates, the second vector represents the y coordinates.
* @param curveId the id of the curve for which data should be added.
* @param xValues the x coordinates of the points that define the curve
* @param yValues the y coordinates of the points that define the curve
* @returns whether data was added successfully or not
*/
bool SetCurveData(unsigned int curveId, const DataVector &xValues, const DataVector &yValues);
/**
* @brief Sets the data with errors for a previously added curve.
*
* @param curveId the id of the curve for which data should be added.
* @param xValues the x coordinates of the points that define the curve
* @param yValues the y coordinates of the points that define the curve
* @param yLowerError the magnitude (>0) of the error in the lesser direction of y
* @param yUpperError the magnitude (>0) of the error in the larger direction of y
* @returns whether data was added successfully or not
*/
bool SetCurveData(unsigned int curveId,
const DataVector &xValues,
const DataVector &yValues,
const DataVector &yLowerError,
const DataVector &yUpperError);
/**
* @brief Sets the data with errors for a previously added curve.
*
* @param curveId the id of the curve for which data should be added.
* @param xValues the x coordinates of the points that define the curve
* @param yValues the y coordinates of the points that define the curve
* @param xLowerError the magnitude (>0) of the error in the lesser direction of x
* @param xUpperError the magnitude (>0) of the error in the larger direction of x
* @param yLowerError the magnitude (>0) of the error in the lesser direction of y
* @param yUpperError the magnitude (>0) of the error in the larger direction of y
* @returns whether data was added successfully or not
*/
bool SetCurveData(unsigned int curveId,
const DataVector &xValues,
const DataVector &yValues,
const DataVector &xLowerError,
const DataVector &xUpperError,
const DataVector &yLowerError,
const DataVector &yUpperError);
/**
* Sets the data for a previously added curve. Data is provided as a vectors of pairs.
* The pairs represent x/y coordinates of the points that define the curve.
* @param curveId the id of the curve for which data should be added.
* @param data the coordinates of the points that define the curve
* @returns whether data was added successfully or not
*/
bool SetCurveData(unsigned int curveId, const XYDataVector &data);
/**
* Defines how a curve should be drawn. For drawing a curve, a QPen is used.
* @param curveId the id of the curve for which appearance should be changed
* @param pen a QPen (@see QPen) defining the line style
*/
void SetCurvePen(unsigned int curveId, const QPen &pen);
/**
* Assign a brush, which defines the fill pattern of shapes drawn by a QPainter.
* In case of brush.style() != QBrush::NoBrush and * style() != QwtPlotCurve::Sticks
* the area between the curve and the baseline will be filled.
* In case !brush.color().isValid() the area will be filled by pen.color().
* The fill algorithm simply connects the first and the last curve point to the
* baseline. So the curve data has to be sorted (ascending or descending).
* @param curveId the id of the curve for which appearance should be changed
* @param brush a QBrush (@see QBrush) defining the line style
*/
void SetCurveBrush(unsigned int curveId, const QBrush &brush);
/**
* Sets the style how the line is drawn for the curve; like, plain line,
* or with the data points marked with a symbol;
- * @param: style A QwtPlotCurve::CurveStyle
+ * @param curveId
+ * @param style A QwtPlotCurve::CurveStyle
*/
void SetCurveStyle(unsigned int curveId, const QwtPlotCurve::CurveStyle style);
/**
* Sets the style data points are drawn for the curve; like, a line,
* or dots;
- * @param: symbol A QwtSymbol
+ * @param curveId
+ * @param symbol A QwtSymbol
*/
void SetCurveSymbol(unsigned int curveId, QwtSymbol *symbol);
void SetCurveAntialiasingOn(unsigned int curveId);
void SetCurveAntialiasingOff(unsigned int curveId);
/**
* Sets the title of the given curve. The title will be shown in the legend of
* the QwtPlot.
* @param curveId the id of the curve for which the title should be set
* @param title the description of the curve that will be shown in the legend.
*/
void SetCurveTitle(unsigned int curveId, const char *title);
/**
* Defines how a curves errors should be drawn. For drawing a QPen is used.
* @param curveId the id of the curve for which error appearance should be changed
* @param pen a QPen (@see QPen) defining the line style
*/
void SetErrorPen(unsigned int curveId, const QPen &pen);
/**
* Defines the style of errors, symbols or as a curve.
* @param curveId the id of the curve for which error appearance should be changed
* @param drawSmybols true - draw symbols, false - draw curve
*/
void SetErrorStyleSymbols(unsigned int curveId, bool drawSmybols);
/**
* Sets the legend of the plot
*
*/
void SetLegend(QwtLegend *legend, QwtPlot::LegendPosition pos = QwtPlot::RightLegend, double ratio = -1);
/**
* Set a curve's legend attribute
* @param curveId the id of the curve
* @param attribute the legend attribute to be set
*/
void SetLegendAttribute(unsigned int curveId, const QwtPlotCurve::LegendAttribute &attribute);
/**
* Triggers a replot of the curve. Replot should be called once after
* setting new data.
*/
void Replot();
/**
* Resets the plot into an empty state
*/
void Clear();
protected:
/**
* Converts the given values into a raw double* array.
* A new array is allocated via new and must be deleted[] by the caller.
*/
double *ConvertToRawArray(const DataVector &values);
/**
* Converts the given values into a raw double* array.
* A new array is allocated via new and must be deleted[] by the caller.
* @param values the x/y values to convert to an array
* @param component defines if the x values (0) or the y values(1) should
* be converted. Other values than 0 and 1 will not be accepted.
*/
double *ConvertToRawArray(const XYDataVector &values, unsigned int component);
/**
* Adds an error interval curve.
*
* All errors should be absolutes. The magnitude will be used.
*
* @param curveId Which curve should the error curve be added to
- * @param xValues Vector of x values an error bar belongs to
- * @param values The original data value
* @param lessError Error in the negative direction (value - lessError)
* @param moreError Error in the positive direction (value + lessError)
* @param isXError Should the error bars be drawn horizontally
*/
bool AddErrorIntervalCurve(unsigned int curveId,
const DataVector &lessError,
const DataVector &moreError,
bool isXError);
QwtPlot *m_Plot;
std::vector<std::tuple<QwtPlotCurve *, QwtPlotIntervalCurve *, QwtPlotIntervalCurve *>> m_PlotCurveVector;
};
#endif
diff --git a/Modules/QtWidgetsExt/include/QmitkPointListModel.h b/Modules/QtWidgetsExt/include/QmitkPointListModel.h
index 03b4be5314..7da7c40860 100644
--- a/Modules/QtWidgetsExt/include/QmitkPointListModel.h
+++ b/Modules/QtWidgetsExt/include/QmitkPointListModel.h
@@ -1,125 +1,125 @@
/*============================================================================
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 QMITK_POINTLIST_MODEL_H_INCLUDED
#define QMITK_POINTLIST_MODEL_H_INCLUDED
#include "MitkQtWidgetsExtExports.h"
#include <QAbstractListModel>
#include "mitkDataNode.h"
#include "mitkPointSet.h"
class MITKQTWIDGETSEXT_EXPORT QmitkPointListModel : public QAbstractListModel
{
Q_OBJECT
public:
QmitkPointListModel(mitk::DataNode * = nullptr, int t = 0, QObject *parent = nullptr);
~QmitkPointListModel() override;
Qt::ItemFlags flags(const QModelIndex &) const override;
/// interface of QAbstractListModel
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
/// interface of QAbstractListModel
QVariant data(const QModelIndex &index, int role) const override;
/// interface of QAbstractListModel
QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
/// which point set to work on
void SetPointSetNode(mitk::DataNode *pointSetNode);
/// which point set to work on
mitk::PointSet *GetPointSet() const;
// which point set to work on
mitk::DataNode *GetPointSetNode() const;
/// which time step to display/model
void SetTimeStep(int t);
/// which time step to display/model
int GetTimeStep() const;
/// itk observer for point set "modified" events
void OnPointSetChanged(const itk::EventObject &e);
/// itk observer for point set "delete" events
void OnPointSetDeleted(const itk::EventObject &e);
/**
* \brief get point and point ID that correspond to a given QModelIndex
*
* The mitk::PointSet uses a map to store points in an ID<-->Point relation.
* The IDs are not neccesarily continuously numbered, therefore, we can not
* directly use the QModelIndex as point ID. This method returns the point and
* the corresponding point id for a given QModelIndex. The point and the point ID
* are returned in the outgoing parameters p and id. If a valid point and ID were
* found, the method returns true, otherwise it returns false
- * \param[in] QModelIndex &index the index for which a point is requested.
+ * \param[in] index the index for which a point is requested.
The row() part of the index is used to find a corresponding point
- * \param[out] mitk::Point3D& p If a valid point is found, it will be stored in the p parameter
- * \param[out] mitk::PointSet::PointIdentifier& id If a valid point is found, the corresponding ID will be stored in id
+ * \param[out] p If a valid point is found, it will be stored in the p parameter
+ * \param[out] id If a valid point is found, the corresponding ID will be stored in id
* \return Returns true, if a valid point was found, false otherwise
*/
bool GetPointForModelIndex(const QModelIndex &index,
mitk::PointSet::PointType &p,
mitk::PointSet::PointIdentifier &id) const;
/**Documentation
* \brief returns a QModelIndex for a given point ID
*
* The mitk::PointSet uses a map to store points in an ID<-->Point relation.
* The IDs are not neccesarily continuously numbered, therefore, we can not
* directly use the point ID as a QModelIndex. This method returns a QModelIndex
* for a given point ID in the outgoing parameter index.
- * \param[in] mitk::PointSet::PointIdentifier id The point ID for which the QModelIndex will be created
- * \param[out] QModelIndex& index if a point with the ID id was found, index will contain a corresponding QModelIndex
+ * \param[in] id The point ID for which the QModelIndex will be created
+ * \param[out] index if a point with the ID id was found, index will contain a corresponding QModelIndex
* for that point
* \return returns true, if a valid QModelIndex was created, false otherwise
*/
bool GetModelIndexForPointID(mitk::PointSet::PointIdentifier id, QModelIndex &index) const;
public slots:
void MoveSelectedPointUp();
void MoveSelectedPointDown();
void RemoveSelectedPoint();
signals:
/// emitted, when views should update their selection status
/// (because mouse interactions in render windows can change
/// the selection status of points)
void SignalUpdateSelection();
protected:
/// internally observe different point set
void ObserveNewPointSet(mitk::DataNode *pointSetNode);
// initially checks if there is a PointSet as data in the DataNode.
// returns PointSet if so and nullptr if other data is set to node
mitk::PointSet *CheckForPointSetInNode(mitk::DataNode *node) const;
protected:
mitk::DataNode *m_PointSetNode;
unsigned int m_PointSetModifiedObserverTag;
unsigned int m_PointSetDeletedObserverTag;
int m_TimeStep;
};
#endif
diff --git a/Modules/REST/include/mitkIRESTObserver.h b/Modules/REST/include/mitkIRESTObserver.h
index 099483fc58..db3330d055 100644
--- a/Modules/REST/include/mitkIRESTObserver.h
+++ b/Modules/REST/include/mitkIRESTObserver.h
@@ -1,51 +1,53 @@
/*============================================================================
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 mitkIRESTObserver_h
#define mitkIRESTObserver_h
#include <MitkRESTExports.h>
#include <mitkRESTUtil.h>
#include <cpprest/json.h>
#include <cpprest/uri.h>
#include <cpprest/http_client.h>
namespace mitk
{
class MITKREST_EXPORT IRESTObserver
{
public:
/**
* @brief Deletes an observer and calls HandleDeleteObserver() in RESTManager class
*
* @see HandleDeleteObserver()
*/
virtual ~IRESTObserver();
/**
* @brief Called if there's an incoming request for the observer, observer implements how to handle request
*
+ * @param uri
* @param data the data of the incoming request
- * @param method the http method of the incoming request
+ * @param method the http method of the incoming request
+ * @param headers
* @return the modified data
*/
virtual web::http::http_response Notify(const web::uri &uri,
const web::json::value &data,
const web::http::method &method,
const mitk::RESTUtil::ParamMap &headers) = 0;
private:
};
}
#endif
diff --git a/Modules/REST/include/mitkRESTClient.h b/Modules/REST/include/mitkRESTClient.h
index 5cf46e094a..075e826924 100644
--- a/Modules/REST/include/mitkRESTClient.h
+++ b/Modules/REST/include/mitkRESTClient.h
@@ -1,104 +1,105 @@
/*============================================================================
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 mitkRESTClient_h
#define mitkRESTClient_h
#include <MitkRESTExports.h>
#include <cpprest/http_client.h>
namespace mitk
{
class MITKREST_EXPORT RESTClient
{
public:
using http_request = web::http::http_request;
RESTClient();
~RESTClient();
/**
* @brief Executes a HTTP GET request with the given uri and returns a task waiting for a json object
*
* @throw mitk::Exception if request went wrong
* @param uri the URI resulting the target of the HTTP request
- * @param the additional headers to be set to the HTTP request
+ * @param headers the additional headers to be set to the HTTP request
* @return task to wait for with resulting json object
*/
pplx::task<web::json::value> Get(const web::uri &uri, const std::map<utility::string_t, utility::string_t> headers);
/**
* @brief Executes a HTTP GET request with the given uri and and stores the byte stream in a file given by the
* filePath
*
* @throw mitk::Exception if request went wrong
* @param uri the URI resulting the target of the HTTP request
- * @param the additional headers to be set to the HTTP request
+ * @param filePath
+ * @param headers the additional headers to be set to the HTTP request
* @return task to wait for returning an empty json object
*/
pplx::task<web::json::value> Get(const web::uri &uri,
const utility::string_t &filePath,
const std::map<utility::string_t, utility::string_t> headers);
/**
* @brief Executes a HTTP PUT request with given uri and the content given as json
*
* @throw mitk::Exception if request went wrong
* @param uri defines the URI resulting the target of the HTTP request
* @param content the content as json value which should be the body of the request and thus the content of the
* created resources
* @return task to wait for with resulting json object
*/
pplx::task<web::json::value> Put(const web::uri &uri, const web::json::value *content);
/**
* @brief Executes a HTTP POST request with given uri and the content given as json
*
* @throw mitk::Exception if request went wrong
* @param uri defines the URI resulting the target of the HTTP request
* @param content the content as json value which should be the body of the request and thus the content of the
* created resource
* @param headers the additional headers to be set to the HTTP request
* @return task to wait for with resulting json object
*/
pplx::task<web::json::value> Post(const web::uri &uri,
const web::json::value *content,
const std::map<utility::string_t, utility::string_t> headers);
/**
* @brief Executes a HTTP POST request with given uri and the content given as json
*
* @throw mitk::Exception if request went wrong
* @param uri defines the URI resulting the target of the HTTP request
* @param content the content as json value which should be the body of the request and thus the content of the
* created resource
* @param headers the additional headers to be set to the HTTP request
* @return task to wait for with resulting json object
*/
pplx::task<web::json::value> Post(const web::uri &uri,
const std::vector<unsigned char> *content,
const std::map<utility::string_t, utility::string_t> headers);
private:
/**
* @brief Use this to create and init a new request with the given headers. If needed, set the body on the resulting
* request object to avoid an automatic change of the content type header when setting the body first.
*/
http_request InitRequest(const std::map<utility::string_t, utility::string_t> headers);
void CheckResponseContentType(web::http::http_response &response);
pplx::task<web::json::value> ExecutePost(const web::uri &uri, http_request request);
web::http::client::http_client_config m_ClientConfig;
};
} // namespace mitk
#endif
diff --git a/Modules/RESTService/include/mitkRESTManager.h b/Modules/RESTService/include/mitkRESTManager.h
index f1ad8e00c5..5ea1b5e457 100644
--- a/Modules/RESTService/include/mitkRESTManager.h
+++ b/Modules/RESTService/include/mitkRESTManager.h
@@ -1,153 +1,153 @@
/*============================================================================
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 mitkRESTManager_h
#define mitkRESTManager_h
#include <MitkRESTServiceExports.h>
#include <mitkIRESTManager.h>
#include <mitkRESTUtil.h>
namespace mitk
{
/**
* @class RESTManager
* @brief this is a microservice for managing REST-requests, used for non-qt applications.
*
* RESTManagerQt in the CppRestSdkQt module inherits from this class and is the equivalent microservice
* used for Qt applications.
*/
class MITKRESTSERVICE_EXPORT RESTManager : public IRESTManager
{
public:
RESTManager();
~RESTManager() override;
/**
* @brief Executes a HTTP request in the mitkRESTClient class
*
* @throw mitk::Exception if RequestType is not suported
* @param uri defines the URI the request is send to
* @param type the RequestType of the HTTP request (optional)
* @param headers the headers for the request (optional)
* @return task to wait for
*/
pplx::task<web::json::value> SendRequest(
const web::uri &uri,
const RequestType &type = RequestType::Get,
const std::map<utility::string_t, utility::string_t> headers = {}) override;
/**
* @brief Executes a HTTP request in the mitkRESTClient class
*
* @throw mitk::Exception if RequestType is not suported
* @param uri defines the URI the request is send to
* @param type the RequestType of the HTTP request (optional)
* @param body the body for the request (optional)
* @param headers the headers for the request (optional)
* @param filePath the file path to store the request to (optional)
* @return task to wait for
*/
pplx::task<web::json::value> SendJSONRequest(const web::uri &uri,
const RequestType &type = RequestType::Get,
const web::json::value *body = nullptr,
const std::map<utility::string_t, utility::string_t> headers = {},
const utility::string_t &filePath = {}) override;
/**
* @brief Executes a HTTP request in the mitkRESTClient class
*
* @throw mitk::Exception if RequestType is not suported
* @param uri defines the URI the request is send to
* @param type the RequestType of the HTTP request (optional)
* @param body the body for the request (optional)
* @param headers the headers for the request (optional)
* @return task to wait for
*/
pplx::task<web::json::value> SendBinaryRequest(
const web::uri &uri,
const RequestType &type = RequestType::Get,
- const std::vector<unsigned char> * = {},
+ const std::vector<unsigned char> *body = {},
const std::map<utility::string_t, utility::string_t> headers = {}) override;
/**
* @brief starts listening for requests if there isn't another observer listening and the port is free
*
* @param uri defines the URI for which incoming requests should be send to the observer
* @param observer the observer which handles the incoming requests
*/
void ReceiveRequest(const web::uri &uri, IRESTObserver *observer) override;
/**
* @brief Handles incoming requests by notifying the observer which should receive it
*
* @param uri defines the URI of the request
* @param body the body of the request
* @param method the http method of the request
* @param headers the http headers of the request
* @return the response
*/
web::http::http_response Handle(const web::uri &uri,
const web::json::value &body,
const web::http::method &method,
const mitk::RESTUtil::ParamMap &headers) override;
/**
* @brief Handles the deletion of an observer for all or a specific uri
*
* @param observer the observer which shouldn't receive requests anymore
* @param uri the uri for which the observer doesn't handle requests anymore (optional)
*/
void HandleDeleteObserver(IRESTObserver *observer, const web::uri &uri = {}) override;
/**
* @brief internal use only
*/
const std::map<int, RESTServer *> &GetServerMap() override;
std::map<std::pair<int, utility::string_t>, IRESTObserver *> &GetObservers() override;
private:
/**
* @brief adds an observer if a port is free, called by ReceiveRequest method
*
* @param uri the uri which builds the key for the observer map
* @param observer the observer which is added
*/
void AddObserver(const web::uri &uri, IRESTObserver *observer);
/**
* @brief handles server management if there is already a server under a port, called by ReceiveRequest method
*
* @param uri the uri which which is requested to be added
* @param observer the observer which proceeds the request
*/
void RequestForATakenPort(const web::uri &uri, IRESTObserver *observer);
/**
* @brief deletes an observer, called by HandleDeleteObserver method
*
* @param it the iterator comparing the observers in HandleDeleteObserver method
* @return bool if there is another observer under the port
*/
bool DeleteObserver(std::map<std::pair<int, utility::string_t>, IRESTObserver *>::iterator &it);
void SetServerMap(const int port, RESTServer *server);
void DeleteFromServerMap(const int port);
void SetObservers(const std::pair<int, utility::string_t> key, IRESTObserver *observer);
std::map<int, RESTServer *> m_ServerMap; // Map with port server pairs
std::map<std::pair<int, utility::string_t>, IRESTObserver *> m_Observers; // Map with all observers
};
} // namespace mitk
#endif
diff --git a/Modules/RT/include/mitkDoseImageVtkMapper2D.h b/Modules/RT/include/mitkDoseImageVtkMapper2D.h
index cb0f7bbded..e376d228a1 100644
--- a/Modules/RT/include/mitkDoseImageVtkMapper2D.h
+++ b/Modules/RT/include/mitkDoseImageVtkMapper2D.h
@@ -1,309 +1,303 @@
/*============================================================================
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 MITKDoseImageVtkMapper2D2D_H_HEADER_INCLUDED
#define MITKDoseImageVtkMapper2D2D_H_HEADER_INCLUDED
//MITK
#include <mitkCommon.h>
#include <MitkRTExports.h>
//MITK Rendering
#include "mitkBaseRenderer.h"
#include "mitkVtkMapper.h"
#include "mitkExtractSliceFilter.h"
//VTK
#include <vtkSmartPointer.h>
#include <vtkPropAssembly.h>
#include <vtkCellArray.h>
class vtkActor;
class vtkPolyDataMapper;
class vtkPlaneSource;
class vtkImageData;
class vtkLookupTable;
class vtkImageExtractComponents;
class vtkImageReslice;
class vtkImageChangeInformation;
class vtkPoints;
class vtkMitkThickSlicesFilter;
class vtkPolyData;
class vtkMitkApplyLevelWindowToRGBFilter;
class vtkMitkLevelWindowFilter;
namespace mitk {
/** \brief Mapper to resample and display 2D slices of a 3D image.
*
- * The following image gives a brief overview of the mapping and the involved parts.
- *
- * \image html DoseImageVtkMapper2Darchitecture.png
- *
* First, the image is resliced by means of vtkImageReslice. The volume image
* serves as input to the mapper in addition to spatial placement of the slice and a few other
* properties such as thick slices. This code was already present in the old version
* (mitkImageMapperGL2D).
*
* Next, the obtained slice (m_ReslicedImage) is put into a vtkMitkLevelWindowFilter
* and the scalar levelwindow, opacity levelwindow and optional clipping to
* local image bounds are applied
*
* Next, the output of the vtkMitkLevelWindowFilter is used to create a texture
* (m_Texture) and a plane onto which the texture is rendered (m_Plane). For
* mapping purposes, a vtkPolyDataMapper (m_Mapper) is utilized. Orthographic
* projection is applied to create the effect of a 2D image. The mapper and the
* texture are assigned to the actor (m_Actor) which is passed to the VTK rendering
* pipeline via the method GetVtkProp().
*
* In order to transform the textured plane to the correct position in space, the
* same transformation as used for reslicing is applied to both the camera and the
* vtkActor. All important steps are explained in more detail below. The resulting
* 2D image (by reslicing the underlying 3D input image appropriately) can either
* be directly rendered in a 2D view or just be calculated to be used later by another
* rendering entity, e.g. in texture mapping in a 3D view.
*
* Properties that can be set for images and influence the imageMapper2D are:
*
* - \b "opacity": (FloatProperty) Opacity of the image
* - \b "color": (ColorProperty) Color of the image
* - \b "LookupTable": (mitkLookupTableProperty) If this property is set,
* the default lookuptable will be ignored and the "LookupTable" value
* will be used instead.
* - \b "Image Rendering.Mode": This property decides which mode is used to render images. (E.g. if a lookup table or a transferfunction is applied). Detailed documentation about the modes can be found here: \link mitk::RenderingModeProperty \endlink
* - \b "Image Rendering.Transfer Function": (mitkTransferFunctionProperty) If this
* property is set, a color transferfunction will be used to color the image.
* - \b "binary": (BoolProperty) is the image a binary image or not
* - \b "outline binary": (BoolProperty) show outline of the image or not
* - \b "texture interpolation": (BoolProperty) texture interpolation of the image
* - \b "reslice interpolation": (VtkResliceInterpolationProperty) reslice interpolation of the image
* - \b "in plane resample extent by geometry": (BoolProperty) Do it or not
* - \b "bounding box": (BoolProperty) Is the Bounding Box of the image shown or not
* - \b "layer": (IntProperty) Layer of the image
* - \b "volume annotation color": (ColorProperty) color of the volume annotation, TODO has to be reimplemented
* - \b "volume annotation unit": (StringProperty) annotation unit as string (does not implicit convert the unit!)
unit is ml or cm3, TODO has to be reimplemented
* The default properties are:
* - \b "opacity", mitk::FloatProperty::New(0.3f), renderer, overwrite )
* - \b "color", ColorProperty::New(1.0,0.0,0.0), renderer, overwrite )
* - \b "binary", mitk::BoolProperty::New( true ), renderer, overwrite )
* - \b "outline binary", mitk::BoolProperty::New( false ), renderer, overwrite )
* - \b "texture interpolation", mitk::BoolProperty::New( false ) )
* - \b "reslice interpolation", mitk::VtkResliceInterpolationProperty::New() )
* - \b "in plane resample extent by geometry", mitk::BoolProperty::New( false ) )
* - \b "bounding box", mitk::BoolProperty::New( false ) )
* - \b "layer", mitk::IntProperty::New(10), renderer, overwrite)
* - \b "Image Rendering.Transfer Function": Default color transfer function for CTs
* - \b "LookupTable": Rainbow color.
* If the modality-property is set for an image, the mapper uses modality-specific default properties,
* e.g. color maps, if they are defined.
* \ingroup Mapper
*/
class MITKRT_EXPORT DoseImageVtkMapper2D : public VtkMapper
{
public:
/** Standard class typedefs. */
mitkClassMacro( DoseImageVtkMapper2D,VtkMapper );
/** Method for creation through the object factory. */
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/** \brief Get the Image to map */
const mitk::Image *GetInput(void);
/** \brief Checks whether this mapper needs to update itself and generate
* data. */
void Update(mitk::BaseRenderer * renderer) override;
//### methods of MITK-VTK rendering pipeline
vtkProp* GetVtkProp(mitk::BaseRenderer* renderer) override;
//### end of methods of MITK-VTK rendering pipeline
/** \brief Internal class holding the mapper, actor, etc. for each of the 3 2D render windows */
/**
* To render transveral, coronal, and sagittal, the mapper is called three times.
* For performance reasons, the corresponding data for each view is saved in the
* internal helper class LocalStorage. This allows rendering n views with just
* 1 mitkMapper using n vtkMapper.
* */
class MITKRT_EXPORT LocalStorage : public mitk::Mapper::BaseLocalStorage
{
public:
/** \brief Actor of a 2D render window. */
vtkSmartPointer<vtkActor> m_Actor;
vtkSmartPointer<vtkPropAssembly> m_Actors;
/** \brief Mapper of a 2D render window. */
vtkSmartPointer<vtkPolyDataMapper> m_Mapper;
vtkSmartPointer<vtkImageExtractComponents> m_VectorComponentExtractor;
/** \brief Current slice of a 2D render window.*/
vtkSmartPointer<vtkImageData> m_ReslicedImage;
/** \brief Empty vtkPolyData that is set when rendering geometry does not
* intersect the image geometry.
* \warning This member variable is set to nullptr,
* if no image geometry is inside the plane geometry
* of the respective render window. Any user of this
* slice has to check whether it is set to nullptr!
*/
vtkSmartPointer<vtkPolyData> m_EmptyPolyData;
/** \brief Plane on which the slice is rendered as texture. */
vtkSmartPointer<vtkPlaneSource> m_Plane;
/** \brief The texture which is used to render the current slice. */
vtkSmartPointer<vtkTexture> m_Texture;
/** \brief The lookuptables for colors and level window */
vtkSmartPointer<vtkLookupTable> m_DefaultLookupTable;
vtkSmartPointer<vtkLookupTable> m_BinaryLookupTable;
vtkSmartPointer<vtkLookupTable> m_ColorLookupTable;
/** \brief The actual reslicer (one per renderer) */
mitk::ExtractSliceFilter::Pointer m_Reslicer;
/** \brief Filter for thick slices */
vtkSmartPointer<vtkMitkThickSlicesFilter> m_TSFilter;
/** \brief PolyData object containg all lines/points needed for outlining the contour.
This container is used to save a computed contour for the next rendering execution.
For instance, if you zoom or pann, there is no need to recompute the contour. */
vtkSmartPointer<vtkPolyData> m_OutlinePolyData;
/** \brief Timestamp of last update of stored data. */
itk::TimeStamp m_LastUpdateTime;
/** \brief mmPerPixel relation between pixel and mm. (World spacing).*/
mitk::ScalarType* m_mmPerPixel;
/** \brief This filter is used to apply the level window to Grayvalue and RBG(A) images. */
vtkSmartPointer<vtkMitkLevelWindowFilter> m_LevelWindowFilter;
/** \brief Default constructor of the local storage. */
LocalStorage();
/** \brief Default deconstructor of the local storage. */
~LocalStorage() override;
};
/** \brief The LocalStorageHandler holds all (three) LocalStorages for the three 2D render windows. */
mitk::LocalStorageHandler<LocalStorage> m_LSH;
/** \brief Get the LocalStorage corresponding to the current renderer. */
LocalStorage* GetLocalStorage(mitk::BaseRenderer* renderer);
/** \brief Set the default properties for general image rendering. */
static void SetDefaultProperties(mitk::DataNode* node, mitk::BaseRenderer* renderer = nullptr, bool overwrite = false);
/** \brief This method switches between different rendering modes (e.g. use a lookup table or a transfer function).
* Detailed documentation about the modes can be found here: \link mitk::RenderingModeProperty \endlink
*/
void ApplyRenderingMode(mitk::BaseRenderer *renderer);
protected:
/** \brief Transforms the actor to the actual position in 3D.
* \param renderer The current renderer corresponding to the render window.
*/
void TransformActor(mitk::BaseRenderer* renderer);
/** \brief Generates a plane according to the size of the resliced image in milimeters.
*
- * \image html texturedPlane.png
- *
* In VTK a vtkPlaneSource is defined through three points. The origin and two
* points defining the axes of the plane (see VTK documentation). The origin is
* set to (xMin; yMin; Z), where xMin and yMin are the minimal bounds of the
* resliced image in space. Z is relevant for blending and the layer property.
* The center of the plane (C) is also the center of the view plane (cf. the image above).
*
* \note For the standard MITK view with three 2D render windows showing three
* different slices, three such planes are generated. All these planes are generated
* in the XY-plane (even if they depict a YZ-slice of the volume).
*
*/
void GeneratePlane(mitk::BaseRenderer* renderer, double planeBounds[6]);
/** \brief Generates a vtkPolyData object containing the outline of a given binary slice.
\param renderer: Pointer to the renderer containing the needed information
\note This code is based on code from the iil library.
*/
vtkSmartPointer<vtkPolyData> CreateOutlinePolyData(mitk::BaseRenderer* renderer);
/** Default constructor */
DoseImageVtkMapper2D();
/** Default deconstructor */
~DoseImageVtkMapper2D() override;
/** \brief Does the actual resampling, without rendering the image yet.
* All the data is generated inside this method. The vtkProp (or Actor)
* is filled with content (i.e. the resliced image).
*
* After generation, a 4x4 transformation matrix(t) of the current slice is obtained
* from the vtkResliceImage object via GetReslicesAxis(). This matrix is
* applied to each textured plane (actor->SetUserTransform(t)) to transform everything
* to the actual 3D position (cf. the following image).
*
* \image html cameraPositioning3D.png
*
*/
void GenerateDataForRenderer(mitk::BaseRenderer *renderer) override;
/** \brief This method uses the vtkCamera clipping range and the layer property
* to calcualte the depth of the object (e.g. image or contour). The depth is used
* to keep the correct order for the final VTK rendering.*/
float CalculateLayerDepth(mitk::BaseRenderer* renderer);
/** \brief This method applies (or modifies) the lookuptable for all types of images.
* \warning To use the lookup table, the property 'Lookup Table' must be set and a 'Image Rendering.Mode'
* which uses the lookup table must be set.
*/
void ApplyLookuptable(mitk::BaseRenderer* renderer);
/** \brief This method applies a color transfer function.
* Internally, a vtkColorTransferFunction is used. This is usefull for coloring continous
* images (e.g. float)
* \warning To use the color transfer function, the property 'Image Rendering.Transfer Function' must be set and a 'Image Rendering.Mode' which uses the color transfer function must be set.
*/
void ApplyColorTransferFunction(mitk::BaseRenderer* renderer);
/**
* @brief ApplyLevelWindow Apply the level window for the given renderer.
* \warning To use the level window, the property 'LevelWindow' must be set and a 'Image Rendering.Mode' which uses the level window must be set.
* @param renderer Level window for which renderer?
*/
void ApplyLevelWindow(mitk::BaseRenderer* renderer);
/** \brief Set the color of the image/polydata */
void ApplyColor( mitk::BaseRenderer* renderer );
/** \brief Set the opacity of the actor. */
void ApplyOpacity( mitk::BaseRenderer* renderer );
/**
* \brief Calculates whether the given rendering geometry intersects the
* given SlicedGeometry3D.
*
* This method checks if the given PlaneGeometry intersects the given
* SlicedGeometry3D. It calculates the distance of the PlaneGeometry to all
* 8 cornerpoints of the SlicedGeometry3D. If all distances have the same
* sign (all positive or all negative) there is no intersection.
* If the distances have different sign, there is an intersection.
**/
bool RenderingGeometryIntersectsImage( const PlaneGeometry* renderingGeometry, SlicedGeometry3D* imageGeometry );
private:
void CreateLevelOutline(mitk::BaseRenderer* renderer, const mitk::IsoDoseLevel* level, float pref, vtkSmartPointer<vtkPoints> points, vtkSmartPointer<vtkCellArray> lines, vtkSmartPointer<vtkUnsignedCharArray> colors);
};
} // namespace mitk
#endif /* MITKDoseImageVtkMapper2D_H_HEADER_INCLUDED_C10E906E */
diff --git a/Modules/Remeshing/CMakeLists.txt b/Modules/Remeshing/CMakeLists.txt
index c3da914c8e..2697e18603 100644
--- a/Modules/Remeshing/CMakeLists.txt
+++ b/Modules/Remeshing/CMakeLists.txt
@@ -1,7 +1,9 @@
mitk_create_module(
- DEPENDS MitkCore
- PACKAGE_DEPENDS ACVD VTK|vtkIOPLY+vtkIOMINC
- )
-
-add_subdirectory(Testing)
+ DEPENDS MitkCore
+ PACKAGE_DEPENDS OpenMesh|OpenMeshTools
+)
+if(TARGET ${MODULE_TARGET})
+ target_link_libraries(${MODULE_TARGET} PRIVATE OpenMeshTools)
+ target_compile_definitions(${MODULE_TARGET} PRIVATE -D_USE_MATH_DEFINES)
+endif()
diff --git a/Modules/Remeshing/Testing/CMakeLists.txt b/Modules/Remeshing/Testing/CMakeLists.txt
deleted file mode 100644
index a29ccbc947..0000000000
--- a/Modules/Remeshing/Testing/CMakeLists.txt
+++ /dev/null
@@ -1,5 +0,0 @@
-if(MITK_USE_ACVD)
- MITK_CREATE_MODULE_TESTS()
-
- mitkAddCustomModuleTest(mitkACVDTest mitkACVDTest ${MITK_DATA_DIR}/binary.stl 0 1228 1.0 10 0.0 1 0 0)
-endif()
diff --git a/Modules/Remeshing/Testing/files.cmake b/Modules/Remeshing/Testing/files.cmake
deleted file mode 100644
index 055665bf46..0000000000
--- a/Modules/Remeshing/Testing/files.cmake
+++ /dev/null
@@ -1,6 +0,0 @@
-set(MODULE_TESTS
-)
-
-set(MODULE_CUSTOM_TESTS
- mitkACVDTest.cpp
-)
diff --git a/Modules/Remeshing/Testing/mitkACVDTest.cpp b/Modules/Remeshing/Testing/mitkACVDTest.cpp
deleted file mode 100644
index f5bf8d5364..0000000000
--- a/Modules/Remeshing/Testing/mitkACVDTest.cpp
+++ /dev/null
@@ -1,138 +0,0 @@
-/*============================================================================
-
-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 <mitkACVD.h>
-#include <mitkIOUtil.h>
-#include <mitkTestingMacros.h>
-#include <sstream>
-#include <vtkDebugLeaks.h>
-#include <vtkPolyData.h>
-#include <vtkSmartPointer.h>
-
-#define _MITK_TEST_FOR_EXCEPTION(STATEMENT, EXCEPTION, MESSAGE) \
- MITK_TEST_OUTPUT_NO_ENDL(<< MESSAGE) \
- try \
- { \
- STATEMENT; \
- MITK_TEST_OUTPUT(<< " [FAILED]") \
- mitk::TestManager::GetInstance()->TestFailed(); \
- } \
- catch (const EXCEPTION &e) \
- { \
- MITK_TEST_OUTPUT(<< "\n " << e.GetDescription() << " [PASSED]") \
- mitk::TestManager::GetInstance()->TestPassed(); \
- }
-
-template <typename T>
-static T lexical_cast(const std::string &string)
-{
- std::istringstream sstream(string);
- T value;
-
- sstream >> value;
-
- if (sstream.fail())
- {
- MITK_ERROR << "Lexical cast failed for '" << string << "'!";
- exit(EXIT_FAILURE);
- }
-
- return value;
-}
-
-static void Remesh_SurfaceIsNull_ThrowsException()
-{
- mitk::Surface::ConstPointer surface;
- _MITK_TEST_FOR_EXCEPTION(
- mitk::ACVD::Remesh(surface, 0, 100, 0.0), mitk::Exception, "Remesh_SurfaceIsNull_ThrowsException")
-}
-
-static void Remesh_PolyDataIsNull_ThrowsException()
-{
- mitk::Surface::ConstPointer surface = mitk::Surface::New().GetPointer();
- _MITK_TEST_FOR_EXCEPTION(
- mitk::ACVD::Remesh(surface, 0, 100, 0.0), mitk::Exception, "Remesh_PolyDataIsNull_ThrowsException")
-}
-
-static void Remesh_SurfaceDoesNotHaveDataAtTimeStep_ThrowsException()
-{
- mitk::Surface::ConstPointer surface = mitk::Surface::New().GetPointer();
- _MITK_TEST_FOR_EXCEPTION(mitk::ACVD::Remesh(surface, 1, 100, 0.0),
- mitk::Exception,
- "Remesh_SurfaceDoesNotHaveDataAtTimeStep_ThrowsException")
-}
-
-static void Remesh_SurfaceHasNoPolygons_ThrowsException()
-{
- mitk::Surface::Pointer surface = mitk::Surface::New();
- vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();
- surface->SetVtkPolyData(polyData);
- _MITK_TEST_FOR_EXCEPTION(mitk::ACVD::Remesh(surface.GetPointer(), 0, 100, 0.0),
- mitk::Exception,
- "Remesh_SurfaceHasNoPolygons_ThrowsException")
-}
-
-static void Remesh_SurfaceIsValid_ReturnsRemeshedSurface(const std::string &filename,
- unsigned int t,
- int numVertices,
- double gradation,
- int subsampling,
- double edgeSplitting,
- int optimizationLevel,
- bool forceManifold,
- bool boundaryFixing)
-{
- auto surface = mitk::IOUtil::Load<mitk::Surface>(filename);
- mitk::Surface::Pointer remeshedSurface = mitk::ACVD::Remesh(
- surface.GetPointer(), t, numVertices, gradation, subsampling, edgeSplitting, optimizationLevel, forceManifold, boundaryFixing);
- MITK_TEST_CONDITION(remeshedSurface.IsNotNull() && remeshedSurface->GetVtkPolyData() != nullptr &&
- remeshedSurface->GetVtkPolyData()->GetNumberOfPolys() != 0,
- "Remesh_SurfaceIsValid_ReturnsRemeshedSurface")
-}
-
-int mitkACVDTest(int argc, char *argv[])
-{
- if (argc != 10)
- {
- MITK_ERROR << "Invalid argument count!\n"
- << "Usage: mitkACVDTest <filename> <t> <numVertices> <gradation> <subsampling>\n"
- << " <edgeSplitting> <optimizationLevel> <forceManifiold>\n"
- << " <boundaryFixing>\n"
- << " See MITK API documentation of mitk::ACVD::Remesh() for details.";
-
- return EXIT_FAILURE;
- }
-
- const std::string filename = argv[1];
- const unsigned int t = lexical_cast<unsigned int>(argv[2]);
- const int numVertices = lexical_cast<int>(argv[3]);
- const double gradation = lexical_cast<double>(argv[4]);
- const int subsampling = lexical_cast<int>(argv[5]);
- const double edgeSplitting = lexical_cast<double>(argv[6]);
- const int optimizationLevel = lexical_cast<int>(argv[7]);
- const bool forceManifold = lexical_cast<bool>(argv[8]);
- const bool boundaryFixing = lexical_cast<bool>(argv[9]);
-
- MITK_TEST_BEGIN("mitkACVDTest")
-
- vtkDebugLeaks::SetExitError(0);
-
- Remesh_SurfaceIsNull_ThrowsException();
- Remesh_PolyDataIsNull_ThrowsException();
- Remesh_SurfaceDoesNotHaveDataAtTimeStep_ThrowsException();
- Remesh_SurfaceHasNoPolygons_ThrowsException();
-
- Remesh_SurfaceIsValid_ReturnsRemeshedSurface(
- filename, t, numVertices, gradation, subsampling, edgeSplitting, optimizationLevel, forceManifold, boundaryFixing);
-
- MITK_TEST_END()
-}
diff --git a/Modules/Remeshing/files.cmake b/Modules/Remeshing/files.cmake
index a9a6a7d8eb..303e7498dd 100644
--- a/Modules/Remeshing/files.cmake
+++ b/Modules/Remeshing/files.cmake
@@ -1,3 +1,7 @@
+set(H_FILES
+ include/mitkRemeshing.h
+)
+
set(CPP_FILES
- mitkACVD.cpp
+ mitkRemeshing.cpp
)
diff --git a/Modules/Remeshing/include/mitkRemeshing.h b/Modules/Remeshing/include/mitkRemeshing.h
new file mode 100644
index 0000000000..ef068d6424
--- /dev/null
+++ b/Modules/Remeshing/include/mitkRemeshing.h
@@ -0,0 +1,39 @@
+/*============================================================================
+
+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 mitkRemeshing_h
+#define mitkRemeshing_h
+
+#include <mitkSurface.h>
+#include <MitkRemeshingExports.h>
+
+namespace mitk
+{
+ namespace Remeshing
+ {
+ /** \brief Reduce the number of vertices of an mitk::Surface.
+ *
+ * The decimation is applied separately to all time steps of the input surface.
+ * The meshes of the resulting surface are guaranteed to consist of triangles only.
+ *
+ * \param[in] input Input surface
+ * \param[in] percent Relative number of vertices after decimation [0, 1]
+ * \param[in] calculateNormals Calculate normals after decimation (\c true by default)
+ * \param[in] flipNormals Flip calculated normals (\c false by default)
+ *
+ * \return Decimated surface
+ */
+ MITKREMESHING_EXPORT Surface::Pointer Decimate(const Surface* input, double percent, bool calculateNormals = true, bool flipNormals = false);
+ }
+}
+
+#endif
diff --git a/Modules/Remeshing/mitkACVD.cpp b/Modules/Remeshing/mitkACVD.cpp
deleted file mode 100644
index f805979d52..0000000000
--- a/Modules/Remeshing/mitkACVD.cpp
+++ /dev/null
@@ -1,220 +0,0 @@
-/*============================================================================
-
-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 "mitkACVD.h"
-#include <mitkExceptionMacro.h>
-#include <vtkIdList.h>
-#include <vtkIntArray.h>
-#include <vtkIsotropicDiscreteRemeshing.h>
-#include <vtkMultiThreader.h>
-#include <vtkPolyData.h>
-#include <vtkPolyDataNormals.h>
-#include <vtkSmartPointer.h>
-#include <vtkSurface.h>
-
-struct ClustersQuadrics
-{
- explicit ClustersQuadrics(int size) : Elements(new double *[size]), Size(size)
- {
- for (int i = 0; i < size; ++i)
- {
- Elements[i] = new double[9];
-
- for (int j = 0; j < 9; ++j)
- Elements[i][j] = 0.0;
- }
- }
-
- ~ClustersQuadrics()
- {
- for (int i = 0; i < Size; ++i)
- delete[] Elements[i];
-
- delete Elements;
- }
-
- double **Elements;
- int Size;
-
-private:
- ClustersQuadrics(const ClustersQuadrics &);
- ClustersQuadrics &operator=(const ClustersQuadrics &);
-};
-
-static void ValidateSurface(mitk::Surface::ConstPointer surface, unsigned int t)
-{
- if (surface.IsNull())
- mitkThrow() << "Input surface is nullptr!";
-
- if (t >= surface->GetSizeOfPolyDataSeries())
- mitkThrow() << "Input surface doesn't have data at time step " << t << "!";
-
- vtkPolyData *polyData = const_cast<mitk::Surface *>(surface.GetPointer())->GetVtkPolyData(t);
-
- if (polyData == nullptr)
- mitkThrow() << "PolyData of input surface at time step " << t << " is nullptr!";
-
- if (polyData->GetNumberOfPolys() == 0)
- mitkThrow() << "Input surface has no polygons at time step " << t << "!";
-}
-
-mitk::Surface::Pointer mitk::ACVD::Remesh(mitk::Surface::ConstPointer surface,
- unsigned int t,
- int numVertices,
- double gradation,
- int subsampling,
- double edgeSplitting,
- int optimizationLevel,
- bool forceManifold,
- bool boundaryFixing)
-{
- ValidateSurface(surface, t);
-
- MITK_INFO << "Start remeshing...";
-
- vtkSmartPointer<vtkPolyData> surfacePolyData = vtkSmartPointer<vtkPolyData>::New();
- surfacePolyData->DeepCopy(const_cast<Surface *>(surface.GetPointer())->GetVtkPolyData(t));
-
- vtkSmartPointer<vtkSurface> mesh = vtkSmartPointer<vtkSurface>::New();
-
- mesh->CreateFromPolyData(surfacePolyData);
- mesh->GetCellData()->Initialize();
- mesh->GetPointData()->Initialize();
-
- mesh->DisplayMeshProperties();
-
- if (numVertices == 0)
- numVertices = surfacePolyData->GetNumberOfPoints();
-
- if (edgeSplitting != 0.0)
- mesh->SplitLongEdges(edgeSplitting);
-
- vtkSmartPointer<vtkIsotropicDiscreteRemeshing> remesher = vtkSmartPointer<vtkIsotropicDiscreteRemeshing>::New();
-
- remesher->GetMetric()->SetGradation(gradation);
- remesher->SetBoundaryFixing(boundaryFixing);
- remesher->SetConsoleOutput(1);
- remesher->SetForceManifold(forceManifold);
- remesher->SetInput(mesh);
- remesher->SetNumberOfClusters(numVertices);
- remesher->SetNumberOfThreads(vtkMultiThreader::GetGlobalDefaultNumberOfThreads());
- remesher->SetSubsamplingThreshold(subsampling);
-
- remesher->Remesh();
-
- // Optimization: Minimize distance between input surface and remeshed surface
- if (optimizationLevel != 0)
- {
- ClustersQuadrics clustersQuadrics(numVertices);
-
- vtkSmartPointer<vtkIdList> faceList = vtkSmartPointer<vtkIdList>::New();
- vtkSmartPointer<vtkIntArray> clustering = remesher->GetClustering();
- vtkSmartPointer<vtkSurface> remesherInput = remesher->GetInput();
- int clusteringType = remesher->GetClusteringType();
- int numItems = remesher->GetNumberOfItems();
- int numMisclassifiedItems = 0;
-
- for (int i = 0; i < numItems; ++i)
- {
- int cluster = clustering->GetValue(i);
-
- if (cluster >= 0 && cluster < numVertices)
- {
- if (clusteringType != 0)
- {
- remesherInput->GetVertexNeighbourFaces(i, faceList);
- int numIds = static_cast<int>(faceList->GetNumberOfIds());
-
- for (int j = 0; j < numIds; ++j)
- vtkQuadricTools::AddTriangleQuadric(
- clustersQuadrics.Elements[cluster], remesherInput, faceList->GetId(j), false);
- }
- else
- {
- vtkQuadricTools::AddTriangleQuadric(clustersQuadrics.Elements[cluster], remesherInput, i, false);
- }
- }
- else
- {
- ++numMisclassifiedItems;
- }
- }
-
- if (numMisclassifiedItems != 0)
- std::cout << numMisclassifiedItems << " items with wrong cluster association" << std::endl;
-
- vtkSmartPointer<vtkSurface> remesherOutput = remesher->GetOutput();
- double point[3];
-
- for (int i = 0; i < numVertices; ++i)
- {
- remesherOutput->GetPoint(i, point);
- vtkQuadricTools::ComputeRepresentativePoint(clustersQuadrics.Elements[i], point, optimizationLevel);
- remesherOutput->SetPointCoordinates(i, point);
- }
-
- std::cout << "After quadrics post-processing:" << std::endl;
- remesherOutput->DisplayMeshProperties();
- }
-
- vtkSmartPointer<vtkPolyDataNormals> normals = vtkSmartPointer<vtkPolyDataNormals>::New();
-
- normals->SetInputData(remesher->GetOutput());
- normals->AutoOrientNormalsOn();
- normals->ComputeCellNormalsOff();
- normals->ComputePointNormalsOn();
- normals->ConsistencyOff();
- normals->FlipNormalsOff();
- normals->NonManifoldTraversalOff();
- normals->SplittingOff();
-
- normals->Update();
-
- Surface::Pointer remeshedSurface = Surface::New();
- remeshedSurface->SetVtkPolyData(normals->GetOutput());
-
- MITK_INFO << "Finished remeshing";
-
- return remeshedSurface;
-}
-
-mitk::ACVD::RemeshFilter::RemeshFilter()
- : m_TimeStep(0),
- m_NumVertices(0),
- m_Gradation(1.0),
- m_Subsampling(10),
- m_EdgeSplitting(0.0),
- m_OptimizationLevel(1),
- m_ForceManifold(false),
- m_BoundaryFixing(false)
-{
- Surface::Pointer output = Surface::New();
- this->SetNthOutput(0, output);
-}
-
-mitk::ACVD::RemeshFilter::~RemeshFilter()
-{
-}
-
-void mitk::ACVD::RemeshFilter::GenerateData()
-{
- Surface::Pointer output = Remesh(this->GetInput(),
- m_TimeStep,
- m_NumVertices,
- m_Gradation,
- m_Subsampling,
- m_EdgeSplitting,
- m_OptimizationLevel,
- m_ForceManifold,
- m_BoundaryFixing);
- this->SetNthOutput(0, output);
-}
diff --git a/Modules/Remeshing/mitkACVD.h b/Modules/Remeshing/mitkACVD.h
deleted file mode 100644
index c775d58853..0000000000
--- a/Modules/Remeshing/mitkACVD.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/*============================================================================
-
-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 mitkACVD_h
-#define mitkACVD_h
-
-#include <MitkRemeshingExports.h>
-#include <mitkSurface.h>
-#include <mitkSurfaceToSurfaceFilter.h>
-
-namespace mitk
-{
- namespace ACVD
- {
- /** \brief Remesh a surface and store the result in a new surface.
- *
- * The %ACVD library is used for remeshing which is based on the paper "Approximated Centroidal Voronoi Diagrams for
- * Uniform Polygonal Mesh Coarsening" by S. Valette, and J. M. Chassery.
- * There are a few rules of thumbs regarding the ranges of parameters to gain high quality remeshed surfaces:
- *
- * <ul>
- * <li> numVertices is exact, however, if boundaryFixing is enabled, additional vertices are generated at
- * boundaries
- * <li> %Set gradation to zero in case you want polygons of roughly the same size all over the remeshed surface;
- * start with 1 otherwise
- * <li> subsampling has direct influence on the quality of the remeshed surface (higher values take more time)
- * <li> edgeSplitting is useful for surfaces that contain long and thin triangles but takes a long time
- * <li> Leave optimizationLevel set to 1 as greater values result in degenerated polygons
- * <li> Irregular shrinking of boundaries during remeshing can be avoided by boundaryFixing, however this results
- * in additional, lower quality polygons at boundaries
- * </ul>
- *
- * \param[in] surface Input surface.
- * \param[in] t Time step of a four-dimensional input surface, zero otherwise.
- * \param[in] numVertices Desired number of vertices in the remeshed surface, set to zero to keep original vertex
- * count.
- * \param[in] gradation Influence of surface curvature on polygon size.
- * \param[in] subsampling Subsample input surface until number of vertices exceeds initial count times this
- * parameter.
- * \param[in] edgeSplitting Recursively split edges that are longer than the average edge length times this
- * parameter.
- * \param[in] optimizationLevel Minimize distance between input surface and remeshed surface.
- * \param[in] boundaryFixing Keep original surface boundaries by adding additional polygons.
- * \return Returns the remeshed surface or nullptr if input surface is invalid.
- */
- MITKREMESHING_EXPORT Surface::Pointer Remesh(Surface::ConstPointer surface,
- unsigned int t,
- int numVertices,
- double gradation,
- int subsampling = 10,
- double edgeSplitting = 0.0,
- int optimizationLevel = 1,
- bool forceManifold = false,
- bool boundaryFixing = false);
-
- /** \brief Encapsulates mitk::ACVD::Remesh function as filter.
- */
- class MITKREMESHING_EXPORT RemeshFilter : public mitk::SurfaceToSurfaceFilter
- {
- public:
- mitkClassMacro(RemeshFilter, SurfaceToSurfaceFilter);
- itkFactorylessNewMacro(Self);
- itkCloneMacro(Self);
- itkSetMacro(TimeStep, unsigned int);
- itkSetMacro(NumVertices, int);
- itkSetMacro(Gradation, double);
- itkSetMacro(Subsampling, int);
- itkSetMacro(EdgeSplitting, double);
- itkSetMacro(OptimizationLevel, int);
- itkSetMacro(ForceManifold, bool);
- itkSetMacro(BoundaryFixing, bool);
-
- protected:
- void GenerateData() override;
-
- private:
- RemeshFilter();
- ~RemeshFilter() override;
-
- unsigned int m_TimeStep;
- int m_NumVertices;
- double m_Gradation;
- int m_Subsampling;
- double m_EdgeSplitting;
- int m_OptimizationLevel;
- bool m_ForceManifold;
- bool m_BoundaryFixing;
- };
- }
-}
-
-#endif
diff --git a/Modules/Remeshing/src/mitkRemeshing.cpp b/Modules/Remeshing/src/mitkRemeshing.cpp
new file mode 100644
index 0000000000..dd531cfaaf
--- /dev/null
+++ b/Modules/Remeshing/src/mitkRemeshing.cpp
@@ -0,0 +1,185 @@
+/*============================================================================
+
+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 <mitkRemeshing.h>
+
+#include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
+#include <OpenMesh/Tools/Decimater/DecimaterT.hh>
+#include <OpenMesh/Tools/Decimater/ModQuadricT.hh>
+
+#include <vtkCellArray.h>
+#include <vtkIdList.h>
+#include <vtkPoints.h>
+#include <vtkPolyData.h>
+#include <vtkPolyDataNormals.h>
+#include <vtkSmartPointer.h>
+#include <vtkTriangleFilter.h>
+
+#include <algorithm>
+#include <functional>
+
+using Mesh = OpenMesh::TriMesh_ArrayKernelT<OpenMesh::DefaultTraitsDouble>;
+
+namespace
+{
+ bool IsValidPolyData(vtkPolyData* polyData)
+ {
+ return nullptr != polyData && 0 < polyData->GetNumberOfPoints() &&
+ (0 < polyData->GetNumberOfPolys() || 0 < polyData->GetNumberOfStrips());
+ }
+
+ vtkSmartPointer<vtkPolyData> TriangulatePolyData(vtkPolyData* polyData)
+ {
+ auto triangleFilter = vtkSmartPointer<vtkTriangleFilter>::New();
+ triangleFilter->SetInputData(polyData);
+ triangleFilter->PassVertsOff();
+ triangleFilter->PassLinesOff();
+
+ triangleFilter->Update();
+
+ return triangleFilter->GetOutput();
+ }
+
+ vtkSmartPointer<vtkPolyData> CalculateNormals(vtkPolyData* polyData, bool flipNormals)
+ {
+ auto polyDataNormals = vtkSmartPointer<vtkPolyDataNormals>::New();
+ polyDataNormals->SetInputData(polyData);
+
+ if (flipNormals)
+ polyDataNormals->FlipNormalsOn();
+
+ polyDataNormals->Update();
+
+ return polyDataNormals->GetOutput();
+ }
+
+ Mesh ConvertPolyDataToMesh(vtkPolyData* polyData)
+ {
+ Mesh mesh;
+
+ auto* points = polyData->GetPoints();
+ const auto numPoints = points->GetNumberOfPoints();
+
+ for (std::remove_const_t<decltype(numPoints)> i = 0; i < numPoints; ++i)
+ mesh.add_vertex(Mesh::Point(points->GetPoint(i)));
+
+ auto* polys = polyData->GetPolys();
+ const auto numPolys = polys->GetNumberOfCells();
+
+ auto ids = vtkSmartPointer<vtkIdList>::New();
+ std::array<Mesh::VertexHandle, 3> vertexHandles;
+
+ for (std::remove_const_t<decltype(numPolys)> i = 0; i < numPolys; ++i)
+ {
+ polys->GetCellAtId(i, ids);
+
+ vertexHandles[0] = Mesh::VertexHandle(static_cast<int>(ids->GetId(0)));
+ vertexHandles[1] = Mesh::VertexHandle(static_cast<int>(ids->GetId(1)));
+ vertexHandles[2] = Mesh::VertexHandle(static_cast<int>(ids->GetId(2)));
+
+ mesh.add_face(vertexHandles.data(), 3);
+ }
+
+ return mesh;
+ }
+
+ vtkSmartPointer<vtkPolyData> ConvertMeshToPolyData(const Mesh& mesh)
+ {
+ auto polyData = vtkSmartPointer<vtkPolyData>::New();
+
+ const auto numVertices = mesh.n_vertices();
+ auto points = vtkSmartPointer<vtkPoints>::New();
+ points->SetNumberOfPoints(numVertices);
+
+ for (std::remove_const_t<decltype(numVertices)> i = 0; i < numVertices; ++i)
+ points->SetPoint(i, mesh.point(Mesh::VertexHandle(static_cast<int>(i))).data());
+
+ polyData->SetPoints(points);
+
+ const auto numFaces = mesh.n_faces();
+ auto polys = vtkSmartPointer<vtkCellArray>::New();
+
+ auto ids = vtkSmartPointer<vtkIdList>::New();
+ ids->SetNumberOfIds(3);
+ Mesh::CFVIter iter;
+
+ for (std::remove_const_t<decltype(numFaces)> i = 0; i < numFaces; ++i)
+ {
+ iter = mesh.cfv_iter(Mesh::FaceHandle(static_cast<int>(i)));
+
+ ids->SetId(0, (iter++)->idx());
+ ids->SetId(1, (iter++)->idx());
+ ids->SetId(2, iter->idx());
+
+ polys->InsertNextCell(ids);
+ }
+
+ polyData->SetPolys(polys);
+
+ return polyData;
+ }
+
+ mitk::Surface::Pointer ProcessEachTimeStep(const mitk::Surface* input, bool calculateNormals, bool flipNormals, const std::function<void(Mesh&)>& ProcessMesh)
+ {
+ if (nullptr == input || !input->IsInitialized())
+ return nullptr;
+
+ auto output = mitk::Surface::New();
+ const auto numTimeSteps = input->GetTimeSteps();
+
+ for (std::remove_const_t<decltype(numTimeSteps)> t = 0; t < numTimeSteps; ++t)
+ {
+ vtkSmartPointer<vtkPolyData> polyData = input->GetVtkPolyData(t);
+
+ if (IsValidPolyData(polyData))
+ {
+ polyData = TriangulatePolyData(polyData);
+
+ if (IsValidPolyData(polyData))
+ {
+ auto mesh = ConvertPolyDataToMesh(polyData);
+ ProcessMesh(mesh);
+ polyData = ConvertMeshToPolyData(mesh);
+
+ if (calculateNormals)
+ polyData = CalculateNormals(polyData, flipNormals);
+
+ output->SetVtkPolyData(polyData, t);
+ continue;
+ }
+ }
+
+ output->SetVtkPolyData(nullptr, t);
+ }
+
+ return output;
+ }
+}
+
+mitk::Surface::Pointer mitk::Remeshing::Decimate(const Surface* input, double percent, bool calculateNormals, bool flipNormals)
+{
+ return ProcessEachTimeStep(input, calculateNormals, flipNormals, [percent](Mesh& mesh) {
+ using Decimater = OpenMesh::Decimater::DecimaterT<Mesh>;
+ using HModQuadric = OpenMesh::Decimater::ModQuadricT<Mesh>::Handle;
+
+ Decimater decimater(mesh);
+
+ HModQuadric hModQuadric;
+ decimater.add(hModQuadric);
+ decimater.module(hModQuadric).unset_max_err();
+
+ decimater.initialize();
+ decimater.decimate_to(mesh.n_vertices() * std::max(0.0, std::min(percent, 1.0)));
+
+ mesh.garbage_collection();
+ });
+}
diff --git a/Modules/RenderWindowManager/include/mitkRenderWindowLayerController.h b/Modules/RenderWindowManager/include/mitkRenderWindowLayerController.h
index d4e14f8fa3..d8fffebf2d 100644
--- a/Modules/RenderWindowManager/include/mitkRenderWindowLayerController.h
+++ b/Modules/RenderWindowManager/include/mitkRenderWindowLayerController.h
@@ -1,173 +1,174 @@
/*============================================================================
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 MITKRENDERWINDOWLAYERCONTROLLER_H
#define MITKRENDERWINDOWLAYERCONTROLLER_H
// render window manager module
#include "MitkRenderWindowManagerExports.h"
#include "mitkRenderWindowLayerUtilities.h"
// mitk core
#include <mitkBaseRenderer.h>
#include <mitkDataNode.h>
#include <mitkDataStorage.h>
namespace mitk
{
/**
* The RenderWindowLayerController is used to manipulate the 'layer', 'fixedLayer' and 'visible' property of a given data node.
* The 'layer' property is used to denote the layer level of a data node. Data from nodes on higher layer level are rendered
* on top of data from nodes on lower layer level. It can be changed using the 'MoveNode*'-functions.
*
* To view the data of a data node only in a specific renderer, the "InsertLayerNode'-function should be used. It inserts the
* given node into the specified renderer and sets the corresponding properties.
* To hide the data in the common renderer view (all renderer), the 'HideDataNodeInAllRenderer'-function can be used.
* Inserting and showing a data node in a specific renderer / render window, will overwrite the properties of the common renderer view.
*
* For more information about the data node properties for specific renderer, see mitk::DataNode- and mitk::PropertyList-classes.
*
* Functions with 'mitk::BaseRenderer* renderer' have 'nullptr' as their default argument. Using the nullptr
* these functions operate on all base renderer. Giving a specific base renderer will modify the node only for the given renderer.
*/
class MITKRENDERWINDOWMANAGER_EXPORT RenderWindowLayerController
{
public:
RenderWindowLayerController();
/**
* @brief Set the data storage on which to work.
*/
void SetDataStorage(DataStorage::Pointer dataStorage);
/**
* @brief Set the controlled base renderer.
*/
void SetControlledRenderer(RenderWindowLayerUtilities::RendererVector controlledRenderer);
// wrapper functions to modify the layer order / visibility of render window data
/**
* @brief Set the given node as the base node of the given renderer.
*
* @param dataNode The data node whose layer is to be modified.
* @param renderer Pointer to the renderer instance for which the data node property should be modified.
* If it is a nullptr (default) all controlled renderer will be affected.
*/
void SetBaseDataNode(DataNode* dataNode, const BaseRenderer* renderer = nullptr);
/**
* @brief Insert the given data node at the specified layer for the given renderer.
*
* @param dataNode The data node that should be inserted.
* @param layer The layer value for the "layer" property of the data node (insertion level).
"layer = RenderWindowLayerUtilities::TOP_LAYER_INDEX" (default) inserts the given data node at the top of the node stack (topmost layer).
* @param renderer Pointer to the renderer instance for which the data node should be inserted.
* If it is a nullptr (default) all controlled renderer will be affected.
*
* @post After a successful call, the "fixedLayer" and "visibility" property will be true and the "layer" property will be set correctly.
*/
void InsertLayerNode(DataNode* dataNode, int layer = RenderWindowLayerUtilities::TOP_LAYER_INDEX, const BaseRenderer* renderer = nullptr);
/**
* @brief Remove the given data node for the given renderer.
*
* @param dataNode The data node that should be removed.
* @param renderer Pointer to the renderer instance for which the data node should be removed.
* If it is a nullptr (default) all controlled renderer will be affected.
*
* @post After a successful call, the "fixedLayer" and "visibility" property will be false and the "layer" property will be deleted.
*/
void RemoveLayerNode(DataNode* dataNode, const BaseRenderer* renderer = nullptr);
/**
* @brief Move the data node to the given layer. This will change only the "layer" property.
*
* @param dataNode The data node that should be moved.
+ * @param newLayer
* @param renderer Pointer to the renderer instance for which the data node should be moved.
* If it is a nullptr (default) all controlled renderer will be affected.
*/
bool MoveNodeToPosition(DataNode* dataNode, int newLayer, const BaseRenderer* renderer = nullptr);
/**
* @brief Set the node in the given renderer as the topmost layer. This will change only the "layer" property.
*
* @param dataNode The data node that should be moved.
* @param renderer Pointer to the renderer instance for which the data node should be moved.
* If it is a nullptr (default) all controlled renderer will be affected.
*/
bool MoveNodeToFront(DataNode* dataNode, const BaseRenderer* renderer = nullptr);
/**
* @brief Set the node in the given renderer as the lowermost layer. This will change only the "layer" property.
*
* @param dataNode The data node that should be moved.
* @param renderer Pointer to the renderer instance for which the data node should be moved.
* If it is a nullptr (default) all controlled renderer will be affected.
*/
bool MoveNodeToBack(DataNode* dataNode, const BaseRenderer* renderer = nullptr);
/**
* @brief Move the node in the given renderer one layer down. This will change only the "layer" property.
*
* @param dataNode The data node that should be moved.
* @param renderer Pointer to the renderer instance for which the data node should be moved.
* If it is a nullptr (default) all controlled renderer will be affected.
*/
bool MoveNodeUp(DataNode* dataNode, const BaseRenderer* renderer = nullptr);
/**
* @brief Move the node in the given renderer one layer up. This will change only the "layer" property.
*
* @param dataNode The data node that should be moved.
* @param renderer Pointer to the renderer instance for which the data node should be moved.
* If it is a nullptr (default) all controlled renderer will be affected.
*/
bool MoveNodeDown(DataNode* dataNode, const BaseRenderer* renderer = nullptr);
/**
* @brief Set the visibility of the given data node for the given renderer.
*
* @param visibility Boolean to set the "visible" property of the given data node.
* @param dataNode The data node that should be moved.
* @param renderer Pointer to the renderer instance for which the data node should be modified.
* If it is a nullptr (default) all controlled renderer will be affected.
*
* @post After a successful call , the "visibility" property will be set to the "visibility" value.
*/
- void SetVisibilityOfDataNode(bool visiblity, DataNode* dataNode, const BaseRenderer* renderer = nullptr);
+ void SetVisibilityOfDataNode(bool visibility, DataNode* dataNode, const BaseRenderer* renderer = nullptr);
/**
* @brief Hide the given data node by setting the "visible" property of the data node for
* all controlled renderer to false.
* Later setting the "visible" property of the data node for a certain renderer will overwrite
* the same property of the common renderer.
*
* @param dataNode The data node that should be hid.
*
* @post After a successful call , the "visibility" property will be set to the false.
*/
void HideDataNodeInAllRenderer(const DataNode* dataNode);
/**
* @brief Reset the given render window:
* If "onlyVisibility = true": set all data nodes for the given render window to invisible, except for the base node.
* If "onlyVisibility = false": remove all data nodes from the render window, except for the base node.
*
- * @param visibility Boolean to define the reset mode.
+ * @param onlyVisibility Boolean to define the reset mode.
* @param renderer Pointer to the renderer instance for which the data node should be reset.
* If it is a nullptr (default) all controlled renderer will be affected.
*
* @post After a successful call , the "visibility" property will be set to the "false" value (except for the base node).
* If "onlyVisibility = false": additionally the "fixedLayer" property will be false and the "layer" property will be deleted.
*/
void ResetRenderer(bool onlyVisibility = true, const BaseRenderer* renderer = nullptr);
private:
void InsertLayerNodeInternal(DataNode* dataNode, int layer, const BaseRenderer* renderer = nullptr);
DataStorage::Pointer m_DataStorage;
RenderWindowLayerUtilities::RendererVector m_ControlledRenderer;
};
} // namespace mitk
#endif // MITKRENDERWINDOWLAYERCONTROLLER_H
diff --git a/Modules/SceneSerialization/include/mitkSceneIO.h b/Modules/SceneSerialization/include/mitkSceneIO.h
index 9cdcbe8fbc..66be8b16f1 100644
--- a/Modules/SceneSerialization/include/mitkSceneIO.h
+++ b/Modules/SceneSerialization/include/mitkSceneIO.h
@@ -1,134 +1,134 @@
/*============================================================================
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 mitkSceneIO_h_included
#define mitkSceneIO_h_included
#include <MitkSceneSerializationExports.h>
#include "mitkDataStorage.h"
#include "mitkNodePredicateBase.h"
#include <Poco/Zip/ZipLocalFileHeader.h>
class TiXmlElement;
namespace mitk
{
class BaseData;
class PropertyList;
class MITKSCENESERIALIZATION_EXPORT SceneIO : public itk::Object
{
public:
mitkClassMacroItkParent(SceneIO, itk::Object);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
typedef DataStorage::SetOfObjects FailedBaseDataListType;
/**
* \brief Load a scene of objects from file
* \return DataStorage with all scene objects and their relations. If loading failed, query GetFailedNodes() and
* GetFailedProperties() for more detail.
*
* Attempts to read the provided file and create objects with
* parent/child relations into a DataStorage.
*
* \param filename full filename of the scene file
* \param storage If given, this DataStorage is used instead of a newly created one
* \param clearStorageFirst If set, the provided DataStorage will be cleared before populating it with the loaded
* objects
*/
virtual DataStorage::Pointer LoadScene(const std::string &filename,
DataStorage *storage = nullptr,
bool clearStorageFirst = false);
/**
* \brief Load a scene of objects from directory.
* \return DataStorage with all scene objects and their relations. If loading failed, query GetFailedNodes() and
* GetFailedProperties() for more detail.
*
* Does the same like LoadScene, but assumes that the given filename is the index.xml of the scene and the working directory
* is the directory of the given filename. This function can be used to load an already unpacked scene and create objects with
* parent/child relations into a DataStorage.
*
- * \param filename full filename of the scene index file
+ * \param indexfilename full filename of the scene index file
* \param storage If given, this DataStorage is used instead of a newly created one
* \param clearStorageFirst If set, the provided DataStorage will be cleared before populating it with the loaded
* objects
*/
virtual DataStorage::Pointer LoadSceneUnzipped(const std::string &indexfilename,
DataStorage *storage = nullptr,
bool clearStorageFirst = false);
/**
* \brief Save a scene of objects to file
* \return True if complete success, false if any problem occurred. Note that a scene file might still be written if
false is returned,
it just will not contain every node/property. If writing failed, query GetFailedNodes() and
GetFailedProperties() for more detail.
*
* Attempts to write a scene file, which contains the nodes of the
* provided DataStorage, their parent/child relations, and properties.
*
+ * \param sceneNodes
* \param storage a DataStorage containing all nodes that should be saved
- * \param filename full filename of the scene file
- * \param predicate defining which items of the datastorage to use and which not
+ * \param filename
*/
virtual bool SaveScene(DataStorage::SetOfObjects::ConstPointer sceneNodes,
const DataStorage *storage,
const std::string &filename);
/**
* \brief Get a list of nodes (BaseData containers) that failed to be read/written.
*
* FailedBaseDataListType hold all those nodes that contain BaseData objects
* which could not be read or written during the last call to LoadScene or SaveScene.
*/
const FailedBaseDataListType *GetFailedNodes();
/**
* \brief Get a list of properties that failed to be read/written.
*
* Each entry corresponds to a property which could not
* be (de)serialized. The properties may come from either of
* <ul>
* <li> The BaseData's PropertyList
* <li> The DataNodes's PropertyList
* <li> Any of a DataNodes's render window specific PropertyLists
* </ul>
*/
const PropertyList *GetFailedProperties();
protected:
SceneIO();
~SceneIO() override;
std::string CreateEmptyTempDirectory();
TiXmlElement *SaveBaseData(BaseData *data, const std::string &filenamehint, bool &error);
TiXmlElement *SavePropertyList(PropertyList *propertyList, const std::string &filenamehint);
void OnUnzipError(const void *pSender, std::pair<const Poco::Zip::ZipLocalFileHeader, const std::string> &info);
void OnUnzipOk(const void *pSender, std::pair<const Poco::Zip::ZipLocalFileHeader, const Poco::Path> &info);
FailedBaseDataListType::Pointer m_FailedNodes;
PropertyList::Pointer m_FailedProperties;
std::string m_WorkingDirectory;
unsigned int m_UnzipErrors;
};
}
#endif
diff --git a/Modules/SceneSerialization/src/mitkSceneReaderV1.h b/Modules/SceneSerialization/src/mitkSceneReaderV1.h
index d8a937531b..9ba5964e93 100644
--- a/Modules/SceneSerialization/src/mitkSceneReaderV1.h
+++ b/Modules/SceneSerialization/src/mitkSceneReaderV1.h
@@ -1,74 +1,74 @@
/*============================================================================
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 "mitkSceneReader.h"
namespace mitk
{
class SceneReaderV1 : public SceneReader
{
public:
mitkClassMacro(SceneReaderV1, SceneReader);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
bool LoadScene(TiXmlDocument &document,
const std::string &workingDirectory,
DataStorage *storage) override;
protected:
/**
- \brief tries to create one DataNode from a given XML <node> element
+ \brief tries to create one DataNode from a given XML \<node\> element
*/
DataNode::Pointer LoadBaseDataFromDataTag(TiXmlElement *dataElement,
const std::string &workingDirectory,
bool &error);
/**
\brief reads all the properties from the XML document and recreates them in node
*/
bool DecorateNodeWithProperties(DataNode *node, TiXmlElement *nodeElement, const std::string &workingDirectory);
/**
\brief Clear a default property list and handle some exceptions.
Called after assigning a BaseData object to a fresh DataNode via SetData().
This call to SetData() would create default properties that have not been
there when saving the scene. Since they can produce problems, we clear the
list and use only those properties that we read from the scene file.
This method also handles some exceptions for backwards compatibility.
Those exceptions are documented directly in the code of the method.
*/
void ClearNodePropertyListWithExceptions(DataNode &node, PropertyList &propertyList);
/**
\brief reads all properties assigned to a base data element and assigns the list to the base data object
- The baseDataNodeElem is supposed to be the <properties file="..."> element.
+ The baseDataNodeElem is supposed to be the \c \<properties file="..."\> element.
*/
bool DecorateBaseDataWithProperties(BaseData::Pointer data,
TiXmlElement *baseDataNodeElem,
const std::string &workingDir);
typedef std::pair<DataNode::Pointer, std::list<std::string>> NodesAndParentsPair;
typedef std::list<NodesAndParentsPair> OrderedNodesList;
typedef std::map<std::string, DataNode *> IDToNodeMappingType;
typedef std::map<DataNode *, std::string> NodeToIDMappingType;
OrderedNodesList m_OrderedNodePairs;
IDToNodeMappingType m_NodeForID;
NodeToIDMappingType m_IDForNode;
UIDGenerator m_UIDGen;
};
}
diff --git a/Modules/SceneSerialization/test/CMakeLists.txt b/Modules/SceneSerialization/test/CMakeLists.txt
index 62a7032a54..a6a501bda1 100644
--- a/Modules/SceneSerialization/test/CMakeLists.txt
+++ b/Modules/SceneSerialization/test/CMakeLists.txt
@@ -1,32 +1,32 @@
MITK_CREATE_MODULE_TESTS()
if(TARGET ${TESTDRIVER})
if(BUILD_TESTING AND MODULE_IS_ENABLED)
add_test(mitkSceneIOTest_Pic3D.nrrd_binary.stl
${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER}
mitkSceneIOTest
${MITK_DATA_DIR}/Pic3D.nrrd
${MITK_DATA_DIR}/binary.stl
)
mitkFunctionGetLibrarySearchPaths(MITK_RUNTIME_PATH_RELEASE release RELEASE)
mitkFunctionGetLibrarySearchPaths(MITK_RUNTIME_PATH_DEBUG debug DEBUG)
set(test_env_path ${MITK_RUNTIME_PATH_RELEASE} ${MITK_RUNTIME_PATH_DEBUG} $ENV{PATH})
list(REMOVE_DUPLICATES test_env_path)
string (REGEX REPLACE "\;" "\\\;" test_env_path "${test_env_path}")
set_property(TEST mitkSceneIOTest_Pic3D.nrrd_binary.stl APPEND PROPERTY ENVIRONMENT "PATH=${test_env_path}")
set_property(TEST mitkSceneIOTest_Pic3D.nrrd_binary.stl PROPERTY SKIP_RETURN_CODE 77)
- mitkAddCustomModuleTest(mitkSceneIOCompatibility_NoRainbowCT mitkSceneIOCompatibilityTest
+ mitkAddCustomModuleRenderingTest(mitkSceneIOCompatibility_NoRainbowCT mitkSceneIOCompatibilityTest
${MITK_DATA_DIR}/RenderingTestData/SceneFiles/rainbows-post-17547.mitk # scene to load
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/rainbows-post-17547.png) # reference rendering
if (FALSE) # fix not yet integrated
- mitkAddCustomModuleTest(mitkSceneIOCompatibility_SurfaceIntLineWidth mitkSceneIOCompatibilityTest
+ mitkAddCustomModuleRenderingTest(mitkSceneIOCompatibility_SurfaceIntLineWidth mitkSceneIOCompatibilityTest
${MITK_DATA_DIR}/RenderingTestData/SceneFiles/surface-pre-18528.mitk # scene to load
-V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/surface-pre-18528.png) # reference rendering
endif()
endif()
endif()
diff --git a/Modules/SceneSerializationBase/test/mitkPropertySerializationTest.cpp b/Modules/SceneSerializationBase/test/mitkPropertySerializationTest.cpp
index 9171a6ce5b..c6cfe3b656 100644
--- a/Modules/SceneSerializationBase/test/mitkPropertySerializationTest.cpp
+++ b/Modules/SceneSerializationBase/test/mitkPropertySerializationTest.cpp
@@ -1,273 +1,199 @@
/*============================================================================
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 "mitkTestingMacros.h"
#include "mitkCoreObjectFactory.h"
#include "mitkBaseProperty.h"
#include "mitkProperties.h"
#include <mitkAnnotationProperty.h>
#include <mitkClippingProperty.h>
#include <mitkColorProperty.h>
#include <mitkEnumerationProperty.h>
-/*
-#include <mitkGridRepresentationProperty.h>
-#include <mitkGridVolumeMapperProperty.h>
-*/
#include <mitkModalityProperty.h>
-//#include <mitkOdfNormalizationMethodProperty.h>
-//#include <mitkOdfScaleByProperty.h>
#include <mitkGroupTagProperty.h>
#include <mitkLevelWindowProperty.h>
#include <mitkLookupTableProperty.h>
#include <mitkPlaneOrientationProperty.h>
#include <mitkStringProperty.h>
#include <mitkTransferFunctionProperty.h>
#include <mitkVtkInterpolationProperty.h>
#include <mitkVtkRepresentationProperty.h>
#include <mitkVtkResliceInterpolationProperty.h>
#include <mitkVtkScalarModeProperty.h>
#include <mitkVtkVolumeRenderingProperty.h>
#include "mitkBasePropertySerializer.h"
#include "mitkPropertyList.h"
#include "mitkPropertyListSerializer.h"
#include <mitkImage.h>
#include <mitkPointSet.h>
#include <mitkSurface.h>
#include <mitkVtkWidgetRendering.h>
-/*
-#include <mitkCone.h>
-#include <mitkContour.h>
-#include <mitkContourSet.h>
-#include <mitkCuboid.h>
-#include <mitkCylinder.h>
-#include <mitkEllipsoid.h>
-#include <mitkExtrudedContour.h>
-#include <mitkMesh.h>
-#include <mitkPlane.h>
-#include <mitkUnstructuredGrid.h>
-*/
-
void TestAllProperties(const mitk::PropertyList *propList);
/**Documentation
* \brief Test for all PropertySerializer classes.
*
*/
int mitkPropertySerializationTest(int /* argc */, char * /*argv*/ [])
{
MITK_TEST_BEGIN("PropertySerializationTest");
mitk::PropertyListSerializer::Pointer serializer =
mitk::PropertyListSerializer::New(); // make sure something from the lib is actually used (registration of
// serializers)
/* build list of properties that will be serialized and deserialized */
mitk::PropertyList::Pointer propList = mitk::PropertyList::New();
propList->SetProperty("booltrue", mitk::BoolProperty::New(true));
propList->SetProperty("boolfalse", mitk::BoolProperty::New(false));
propList->SetProperty("int", mitk::IntProperty::New(-32));
propList->SetProperty("float", mitk::FloatProperty::New(-31.337));
propList->SetProperty("double", mitk::DoubleProperty::New(-31.337));
propList->SetProperty("string", mitk::StringProperty::New("Hello MITK"));
mitk::Point3D p3d;
mitk::FillVector3D(p3d, 1.0, 2.2, -3.3);
propList->SetProperty("p3d", mitk::Point3dProperty::New(p3d));
mitk::Point3I p3i;
mitk::FillVector3D(p3i, 1, 2, -3);
propList->SetProperty("p3i", mitk::Point3iProperty::New(p3i));
mitk::Point4D p4d;
mitk::FillVector4D(p4d, 1.5, 2.6, -3.7, 4.44);
propList->SetProperty("p4d", mitk::Point4dProperty::New(p4d));
mitk::Vector3D v3d;
mitk::FillVector3D(v3d, 1.0, 2.2, -3.3);
propList->SetProperty("v3d", mitk::Vector3DProperty::New(v3d));
propList->SetProperty("annotation", mitk::AnnotationProperty::New("My Annotation", p3d));
propList->SetProperty("clipping", mitk::ClippingProperty::New(p3d, v3d));
propList->SetProperty("color", mitk::ColorProperty::New(1.0, 0.2, 0.2));
- // mitk::EnumerationProperty::Pointer en = mitk::EnumerationProperty::New();
- // en->AddEnum("PC", 1); en->AddEnum("Playstation", 2); en->AddEnum("Wii", 111); en->AddEnum("XBox", 7);
- // en->SetValue("XBox");
- // propList->SetProperty("enum", en);
- /*
- propList->SetProperty("gridrep", mitk::GridRepresentationProperty::New(2));
- propList->SetProperty("gridvol", mitk::GridVolumeMapperProperty::New(0));
- */
propList->SetProperty("modality", mitk::ModalityProperty::New("Color Doppler"));
- // propList->SetProperty("OdfNormalizationMethodProperty", mitk::OdfNormalizationMethodProperty::New("Global
- // Maximum"));
- // propList->SetProperty("OdfScaleByProperty", mitk::OdfScaleByProperty::New("Principal Curvature"));
propList->SetProperty("PlaneOrientationProperty",
mitk::PlaneOrientationProperty::New("Arrows in positive direction"));
propList->SetProperty("VtkInterpolationProperty", mitk::VtkInterpolationProperty::New("Gouraud"));
propList->SetProperty("VtkRepresentationProperty", mitk::VtkRepresentationProperty::New("Surface"));
propList->SetProperty("VtkResliceInterpolationProperty", mitk::VtkResliceInterpolationProperty::New("Cubic"));
propList->SetProperty("VtkScalarModeProperty", mitk::VtkScalarModeProperty::New("PointFieldData"));
propList->SetProperty("VtkVolumeRenderingProperty", mitk::VtkVolumeRenderingProperty::New("COMPOSITE"));
mitk::BoolLookupTable blt;
blt.SetTableValue(0, true);
blt.SetTableValue(1, false);
blt.SetTableValue(2, true);
propList->SetProperty("BoolLookupTableProperty", mitk::BoolLookupTableProperty::New(blt));
mitk::FloatLookupTable flt;
flt.SetTableValue(0, 3.1);
flt.SetTableValue(1, 3.3);
flt.SetTableValue(2, 7.0);
propList->SetProperty("FloatLookupTableProperty", mitk::FloatLookupTableProperty::New(flt));
mitk::IntLookupTable ilt;
ilt.SetTableValue(0, 3);
ilt.SetTableValue(1, 2);
ilt.SetTableValue(2, 11);
propList->SetProperty("IntLookupTableProperty", mitk::IntLookupTableProperty::New(ilt));
mitk::StringLookupTable slt;
slt.SetTableValue(0, "Hello");
slt.SetTableValue(1, "MITK");
slt.SetTableValue(2, "world");
propList->SetProperty("StringLookupTableProperty", mitk::StringLookupTableProperty::New(slt));
propList->SetProperty("GroupTagProperty", mitk::GroupTagProperty::New());
propList->SetProperty("LevelWindowProperty", mitk::LevelWindowProperty::New(mitk::LevelWindow(100.0, 50.0)));
mitk::LookupTable::Pointer lt = mitk::LookupTable::New();
lt->ChangeOpacityForAll(0.25);
lt->ChangeOpacity(17, 0.88);
propList->SetProperty("LookupTableProperty", mitk::LookupTableProperty::New(lt));
propList->SetProperty("StringProperty", mitk::StringProperty::New("Oh why, gruel world"));
- // mitk::TransferFunction::Pointer tf = mitk::TransferFunction::New();
- // tf->SetTransferFunctionMode(1);
- // propList->SetProperty("TransferFunctionProperty", mitk::TransferFunctionProperty::New(tf));
MITK_TEST_CONDITION_REQUIRED(propList->GetMap()->size() > 0, "Initialize PropertyList");
TestAllProperties(propList);
/* test default property lists of basedata objects */
// activate the following tests after MaterialProperty is deleted
mitk::DataNode::Pointer node = mitk::DataNode::New();
node->SetData(mitk::PointSet::New());
TestAllProperties(node->GetPropertyList());
node->SetData(mitk::Image::New());
TestAllProperties(node->GetPropertyList());
node->SetData(mitk::Surface::New());
TestAllProperties(node->GetPropertyList());
node->SetData(mitk::VtkWidgetRendering::New());
TestAllProperties(node->GetPropertyList());
- /*
- node->SetData(mitk::Contour::New());
- TestAllProperties(node->GetPropertyList());
- node->SetData(mitk::ContourSet::New());
- TestAllProperties(node->GetPropertyList());
- node->SetData(mitk::Mesh::New());
- TestAllProperties(node->GetPropertyList());
- node->SetData(mitk::Cone::New());
- TestAllProperties(node->GetPropertyList());
- node->SetData(mitk::Cuboid::New());
- TestAllProperties(node->GetPropertyList());
- node->SetData(mitk::Cylinder::New());
- TestAllProperties(node->GetPropertyList());
- node->SetData(mitk::Ellipsoid::New());
- TestAllProperties(node->GetPropertyList());
- node->SetData(mitk::ExtrudedContour::New());
- TestAllProperties(node->GetPropertyList());
- node->SetData(mitk::Plane::New());
- TestAllProperties(node->GetPropertyList());
- //node->SetData(mitk::TrackingVolume::New()); // TrackingVolume is in IGT Module, it does not have special
- properties, therefore we skip it here
- //TestAllProperties(node->GetPropertyList());
- node->SetData(mitk::UnstructuredGrid::New());
- TestAllProperties(node->GetPropertyList());
- */
-
- /* untested base data types:
- BaseDataTestImplementation
- RenderWindowFrame
- GeometryData
- mitk::PlaneGeometryData
- GradientBackground
- ItkBaseDataAdapter
- SlicedData
- OdfImage
- SeedsImage
- TensorImage
- BoundingObject
- BoundingObjectGroup
- */
-
MITK_TEST_END();
}
void TestAllProperties(const mitk::PropertyList *propList)
{
assert(propList);
/* try to serialize each property in the list, then deserialize again and check for equality */
for (auto it = propList->GetMap()->begin();
it != propList->GetMap()->end();
++it)
{
const mitk::BaseProperty *prop = it->second;
// construct name of serializer class
std::string serializername = std::string(prop->GetNameOfClass()) + "Serializer";
std::list<itk::LightObject::Pointer> allSerializers =
itk::ObjectFactoryBase::CreateAllInstance(serializername.c_str());
MITK_TEST_CONDITION(allSerializers.size() > 0, std::string("Creating serializers for ") + serializername);
if (allSerializers.size() == 0)
{
MITK_TEST_OUTPUT(<< "serialization not possible, skipping " << prop->GetNameOfClass());
continue;
}
if (allSerializers.size() > 1)
{
MITK_TEST_OUTPUT(<< "Warning: " << allSerializers.size() << " serializers found for " << prop->GetNameOfClass()
<< "testing only the first one.");
}
auto *serializer =
dynamic_cast<mitk::BasePropertySerializer *>(allSerializers.begin()->GetPointer());
MITK_TEST_CONDITION(serializer != nullptr, serializername + std::string(" is valid"));
if (serializer != nullptr)
{
serializer->SetProperty(prop);
TiXmlElement *valueelement = nullptr;
try
{
valueelement = serializer->Serialize();
}
catch (...)
{
}
MITK_TEST_CONDITION(valueelement != nullptr, std::string("Serialize property with ") + serializername);
if (valueelement == nullptr)
{
MITK_TEST_OUTPUT(<< "serialization failed, skipping deserialization");
continue;
}
mitk::BaseProperty::Pointer deserializedProp = serializer->Deserialize(valueelement);
MITK_TEST_CONDITION(deserializedProp.IsNotNull(), "serializer created valid property");
if (deserializedProp.IsNotNull())
{
MITK_TEST_CONDITION(*(deserializedProp.GetPointer()) == *prop,
"deserialized property equals initial property for type " << prop->GetNameOfClass());
}
}
else
{
MITK_TEST_OUTPUT(<< "created serializer object is of class "
<< allSerializers.begin()->GetPointer()->GetNameOfClass())
}
} // for all properties
}
diff --git a/Modules/Segmentation/Algorithms/mitkContourUtils.h b/Modules/Segmentation/Algorithms/mitkContourUtils.h
index d9add259f2..3040e042fa 100644
--- a/Modules/Segmentation/Algorithms/mitkContourUtils.h
+++ b/Modules/Segmentation/Algorithms/mitkContourUtils.h
@@ -1,68 +1,71 @@
/*============================================================================
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 mitkContourUtilshIncludett
#define mitkContourUtilshIncludett
#include "mitkContour.h"
#include "mitkContourModel.h"
#include "mitkImage.h"
#include <MitkSegmentationExports.h>
namespace mitk
{
/**
* \brief Helpful methods for working with contours and images
*
* Legacy support for mitk::Contour
* TODO remove this class when mitk::Contour is removed
*/
class MITKSEGMENTATION_EXPORT ContourUtils : public itk::Object
{
public:
mitkClassMacroItkParent(ContourUtils, itk::Object);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**
\brief Projects a contour onto an image point by point. Converts from world to index coordinates.
+ \param slice
+ \param contourIn3D
\param correctionForIpSegmentation adds 0.5 to x and y index coordinates (difference between ipSegmentation and
MITK contours)
+ \param constrainToInside
*/
ContourModel::Pointer ProjectContourTo2DSlice(Image *slice,
Contour *contourIn3D,
bool correctionForIpSegmentation,
bool constrainToInside);
/**
\brief Projects a slice index coordinates of a contour back into world coordinates.
\param correctionForIpSegmentation subtracts 0.5 to x and y index coordinates (difference between
ipSegmentation and MITK contours)
*/
ContourModel::Pointer BackProjectContourFrom2DSlice(const BaseGeometry *sliceGeometry,
Contour *contourIn2D,
bool correctionForIpSegmentation = false);
/**
\brief Fill a contour in a 2D slice with a specified pixel value.
*/
void FillContourInSlice(Contour *projectedContour, Image *sliceImage, int paintingPixelValue = 1);
protected:
ContourUtils();
~ContourUtils() override;
};
}
#endif
diff --git a/Modules/Segmentation/Algorithms/mitkImageLiveWireContourModelFilter.h b/Modules/Segmentation/Algorithms/mitkImageLiveWireContourModelFilter.h
index e2fd65b038..1b923b58b2 100644
--- a/Modules/Segmentation/Algorithms/mitkImageLiveWireContourModelFilter.h
+++ b/Modules/Segmentation/Algorithms/mitkImageLiveWireContourModelFilter.h
@@ -1,162 +1,162 @@
/*============================================================================
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 _mitkImageLiveWireContourModelFilter_h__
#define _mitkImageLiveWireContourModelFilter_h__
#include "mitkCommon.h"
#include "mitkContourModel.h"
#include "mitkContourModelSource.h"
#include <MitkSegmentationExports.h>
#include <mitkImage.h>
#include <mitkImageAccessByItk.h>
#include <mitkImageCast.h>
#include <itkShortestPathCostFunctionLiveWire.h>
#include <itkShortestPathImageFilter.h>
namespace mitk
{
/**
\brief Calculates a LiveWire contour between two points in an image.
For defining costs between two pixels specific features are extraced from the image and tranformed into a single cost
value.
\sa ShortestPathCostFunctionLiveWire
The filter is able to create dynamic cost tranfer map and thus use on the fly training.
- \Note On the fly training will only be used for next update.
+ \note On the fly training will only be used for next update.
The computation uses the last calculated segment to map cost according to features in the area of the segment.
For time resolved purposes use ImageLiveWireContourModelFilter::SetTimestep( unsigned int ) to create the LiveWire
contour
at a specific timestep.
\ingroup ContourModelFilters
\ingroup Process
*/
class MITKSEGMENTATION_EXPORT ImageLiveWireContourModelFilter : public ContourModelSource
{
public:
mitkClassMacro(ImageLiveWireContourModelFilter, ContourModelSource);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
typedef ContourModel OutputType;
typedef OutputType::Pointer OutputTypePointer;
typedef mitk::Image InputType;
typedef itk::Image<float, 2> InternalImageType;
typedef itk::ShortestPathImageFilter<InternalImageType, InternalImageType> ShortestPathImageFilterType;
typedef itk::ShortestPathCostFunctionLiveWire<InternalImageType> CostFunctionType;
typedef std::vector<itk::Index<2>> ShortestPathType;
/** \brief start point in world coordinates*/
itkSetMacro(StartPoint, mitk::Point3D);
itkGetMacro(StartPoint, mitk::Point3D);
/** \brief end point in woorld coordinates*/
itkSetMacro(EndPoint, mitk::Point3D);
itkGetMacro(EndPoint, mitk::Point3D);
/** \brief Create dynamic cost tranfer map - use on the fly training.
- \Note On the fly training will be used for next update only.
+ \note On the fly training will be used for next update only.
The computation uses the last calculated segment to map cost according to features in the area of the segment.
*/
itkSetMacro(UseDynamicCostMap, bool);
itkGetMacro(UseDynamicCostMap, bool);
/** \brief Actual time step
*/
itkSetMacro(TimeStep, unsigned int);
itkGetMacro(TimeStep, unsigned int);
/** \brief Clear all repulsive points used in the cost function
*/
void ClearRepulsivePoints();
/** \brief Set a vector with repulsive points to use in the cost function
*/
void SetRepulsivePoints(const ShortestPathType &points);
/** \brief Add a single repulsive point to the cost function
*/
void AddRepulsivePoint(const itk::Index<2> &idx);
/** \brief Remove a single repulsive point from the cost function
*/
void RemoveRepulsivePoint(const itk::Index<2> &idx);
virtual void SetInput(const InputType *input);
using Superclass::SetInput;
virtual void SetInput(unsigned int idx, const InputType *input);
const InputType *GetInput(void);
const InputType *GetInput(unsigned int idx);
virtual OutputType *GetOutput();
virtual void DumpMaskImage();
/** \brief Create dynamic cost tranfer map - on the fly training*/
bool CreateDynamicCostMap(mitk::ContourModel *path = nullptr);
protected:
ImageLiveWireContourModelFilter();
~ImageLiveWireContourModelFilter() override;
void GenerateOutputInformation() override{};
void GenerateData() override;
void UpdateLiveWire();
/** \brief start point in worldcoordinates*/
mitk::Point3D m_StartPoint;
/** \brief end point in woorldcoordinates*/
mitk::Point3D m_EndPoint;
/** \brief Start point in index*/
mitk::Point3D m_StartPointInIndex;
/** \brief End point in index*/
mitk::Point3D m_EndPointInIndex;
/** \brief The cost function to compute costs between two pixels*/
CostFunctionType::Pointer m_CostFunction;
/** \brief Shortest path filter according to cost function m_CostFunction*/
ShortestPathImageFilterType::Pointer m_ShortestPathFilter;
/** \brief Flag to use a dynmic cost map or not*/
bool m_UseDynamicCostMap;
unsigned int m_TimeStep;
template <typename TPixel, unsigned int VImageDimension>
void ItkPreProcessImage(const itk::Image<TPixel, VImageDimension> *inputImage);
template <typename TPixel, unsigned int VImageDimension>
void CreateDynamicCostMapByITK(const itk::Image<TPixel, VImageDimension> *inputImage,
mitk::ContourModel *path = nullptr);
InternalImageType::Pointer m_InternalImage;
};
}
#endif
diff --git a/Modules/Segmentation/CMakeLists.txt b/Modules/Segmentation/CMakeLists.txt
index 1ec269d597..1528dd107f 100644
--- a/Modules/Segmentation/CMakeLists.txt
+++ b/Modules/Segmentation/CMakeLists.txt
@@ -1,8 +1,9 @@
MITK_CREATE_MODULE(
INCLUDE_DIRS Algorithms Controllers DataManagement Interactions Rendering SegmentationUtilities/BooleanOperations SegmentationUtilities/MorphologicalOperations
DEPENDS MitkAlgorithmsExt MitkIpSegmentation MitkIpFunc MitkSurfaceInterpolation MitkGraphAlgorithms MitkContourModel MitkMultilabel
PACKAGE_DEPENDS
PUBLIC ITK|ITKBinaryMathematicalMorphology+ITKLabelVoting+ITKRegionGrowing+ITKFastMarching+ITKAnisotropicSmoothing+ITKWatersheds
+ PRIVATE VTK|ImagingGeneral
)
add_subdirectory(Testing)
diff --git a/Modules/Segmentation/Controllers/mitkSegmentationInterpolationController.h b/Modules/Segmentation/Controllers/mitkSegmentationInterpolationController.h
index 53673f57e1..30a9f8489c 100644
--- a/Modules/Segmentation/Controllers/mitkSegmentationInterpolationController.h
+++ b/Modules/Segmentation/Controllers/mitkSegmentationInterpolationController.h
@@ -1,220 +1,217 @@
/*============================================================================
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 mitkSegmentationInterpolationController_h_Included
#define mitkSegmentationInterpolationController_h_Included
#include "mitkCommon.h"
#include "mitkImage.h"
#include <MitkSegmentationExports.h>
#include <itkImage.h>
#include <itkObjectFactory.h>
#include <map>
#include <vector>
namespace mitk
{
class Image;
/**
\brief Generates interpolations of 2D slices.
\sa QmitkSlicesInterpolator
\sa QmitkInteractiveSegmentation
\ingroup ToolManagerEtAl
This class keeps track of the contents of a 3D segmentation image.
\attention mitk::SegmentationInterpolationController assumes that the image contains pixel values of 0 and 1.
After you set the segmentation image using SetSegmentationVolume(), the whole image is scanned for pixels other than
0.
SegmentationInterpolationController registers as an observer to the segmentation image, and repeats the scan
whenvever the
image is modified.
You can prevent this (time consuming) scan if you do the changes slice-wise and send difference images to
SegmentationInterpolationController.
For this purpose SetChangedSlice() should be used. mitk::OverwriteImageFilter already does this every time it
changes a
slice of an image. There is a static method InterpolatorForImage(), which can be used to find out if there already
is an interpolator
instance for a specified image. OverwriteImageFilter uses this to get to know its interpolator.
SegmentationInterpolationController needs to maintain some information about the image slices (in every dimension).
This information is stored internally in m_SegmentationCountInSlice, which is basically three std::vectors (one for
each dimension).
- Each item describes one image dimension, each vector item holds the count of pixels in "its" slice. This is perhaps
- better to understand
- from the following picture (where red items just mean to symbolize "there is some segmentation" - in reality there
- is an integer count).
-
- \image html slice_based_segmentation_interpolator.png
+ Each item describes one image dimension, each vector item holds the count of pixels in "its" slice.
$Author$
*/
class MITKSEGMENTATION_EXPORT SegmentationInterpolationController : public itk::Object
{
public:
mitkClassMacroItkParent(SegmentationInterpolationController, itk::Object);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**
\brief Find interpolator for a given image.
\return nullptr if there is no interpolator yet.
This method is useful if several "clients" modify the same image and want to access the interpolations.
Then they can share the same object.
*/
static SegmentationInterpolationController *InterpolatorForImage(const Image *);
/**
\brief Block reaction to an images Modified() events.
Blocking the scan of the whole image is especially useful when you are about to change a single slice
of the image. Then you would send a difference image of this single slice to SegmentationInterpolationController
but call image->Modified() anyway. Before calling image->Modified() you should block
SegmentationInterpolationController's reactions to this modified by using this method.
*/
void BlockModified(bool);
/**
\brief Initialize with a whole volume.
Will scan the volume for segmentation pixels (values other than 0) and fill some internal data structures.
You don't have to call this method every time something changes, but only
when several slices at once change.
When you change a single slice, call SetChangedSlice() instead.
*/
void SetSegmentationVolume(const Image *segmentation);
/**
\brief Set a reference image (original patient image) - optional.
If this volume is set (must exactly match the dimensions of the segmentation),
the interpolation algorithm may consider image content to improve the interpolated
(estimated) segmentation.
*/
void SetReferenceVolume(const Image *segmentation);
/**
\brief Update after changing a single slice.
\param sliceDiff is a 2D image with the difference image of the slice determined by sliceDimension and sliceIndex.
The difference is (pixel value in the new slice minus pixel value in the old slice).
\param sliceDimension Number of the dimension which is constant for all pixels of the meant slice.
\param sliceIndex Which slice to take, in the direction specified by sliceDimension. Count starts from 0.
\param timeStep Which time step is changed
*/
void SetChangedSlice(const Image *sliceDiff,
unsigned int sliceDimension,
unsigned int sliceIndex,
unsigned int timeStep);
void SetChangedVolume(const Image *sliceDiff, unsigned int timeStep);
/**
\brief Generates an interpolated image for the given slice.
\param sliceDimension Number of the dimension which is constant for all pixels of the meant slice.
\param sliceIndex Which slice to take, in the direction specified by sliceDimension. Count starts from 0.
+ \param currentPlane
+
\param timeStep Which time step to use
*/
Image::Pointer Interpolate(unsigned int sliceDimension,
unsigned int sliceIndex,
const mitk::PlaneGeometry *currentPlane,
unsigned int timeStep);
void OnImageModified(const itk::EventObject &);
/**
* Activate/Deactivate the 2D interpolation.
*/
void Activate2DInterpolation(bool);
/**
\brief Get existing instance or create a new one
*/
static SegmentationInterpolationController *GetInstance();
protected:
/**
\brief Protected class of mitk::SegmentationInterpolationController. Don't use (you shouldn't be able to do so)!
*/
class MITKSEGMENTATION_EXPORT SetChangedSliceOptions
{
public:
SetChangedSliceOptions(
unsigned int sd, unsigned int si, unsigned int d0, unsigned int d1, unsigned int t, const void *pixels)
: sliceDimension(sd), sliceIndex(si), dim0(d0), dim1(d1), timeStep(t), pixelData(pixels)
{
}
unsigned int sliceDimension;
unsigned int sliceIndex;
unsigned int dim0;
unsigned int dim1;
unsigned int timeStep;
const void *pixelData;
};
typedef std::vector<unsigned int> DirtyVectorType;
// typedef std::vector< DirtyVectorType[3] > TimeResolvedDirtyVectorType; // cannot work with C++, so next line is
// used for implementation
typedef std::vector<std::vector<DirtyVectorType>> TimeResolvedDirtyVectorType;
typedef std::map<const Image *, SegmentationInterpolationController *> InterpolatorMapType;
SegmentationInterpolationController(); // purposely hidden
~SegmentationInterpolationController() override;
/// internal scan of a single slice
template <typename DATATYPE>
void ScanChangedSlice(const itk::Image<DATATYPE, 2> *, const SetChangedSliceOptions &options);
template <typename TPixel, unsigned int VImageDimension>
void ScanChangedVolume(const itk::Image<TPixel, VImageDimension> *, unsigned int timeStep);
template <typename DATATYPE>
void ScanWholeVolume(const itk::Image<DATATYPE, 3> *, const Image *volume, unsigned int timeStep);
void PrintStatus();
/**
An array of flags. One for each dimension of the image. A flag is set, when a slice in a certain dimension
has at least one pixel that is not 0 (which would mean that it has to be considered by the interpolation
algorithm).
E.g. flags for axial slices are stored in m_SegmentationCountInSlice[0][index].
Enhanced with time steps it is now m_SegmentationCountInSlice[timeStep][0][index]
*/
TimeResolvedDirtyVectorType m_SegmentationCountInSlice;
static InterpolatorMapType s_InterpolatorForImage;
Image::ConstPointer m_Segmentation;
Image::ConstPointer m_ReferenceImage;
bool m_BlockModified;
bool m_2DInterpolationActivated;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Controllers/mitkSliceBasedInterpolationController.h b/Modules/Segmentation/Controllers/mitkSliceBasedInterpolationController.h
index 4f8996d593..eee623f932 100644
--- a/Modules/Segmentation/Controllers/mitkSliceBasedInterpolationController.h
+++ b/Modules/Segmentation/Controllers/mitkSliceBasedInterpolationController.h
@@ -1,200 +1,190 @@
/*============================================================================
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 mitkSliceBasedInterpolationController_h_Included
#define mitkSliceBasedInterpolationController_h_Included
#include "mitkLabelSetImage.h"
#include <MitkSegmentationExports.h>
#include <itkImage.h>
#include <itkObjectFactory.h>
#include <map>
#include <vector>
namespace mitk
{
class Image;
/**
\brief Generates interpolations of 2D slices.
\sa QmitkSlicesInterpolator
\sa QmitkInteractiveSegmentation
\ingroup ToolManagerEtAl
This class keeps track of the contents of a 3D segmentation image.
\attention mitk::SliceBasedInterpolationController assumes that the image contains pixel values of 0 and 1.
After you set the segmentation image using SetSegmentationVolume(), the whole image is scanned for pixels other than
0.
SliceBasedInterpolationController registers as an observer to the segmentation image, and repeats the scan whenvever
the
image is modified.
You can prevent this (time consuming) scan if you do the changes slice-wise and send difference images to
SliceBasedInterpolationController.
For this purpose SetChangedSlice() should be used. mitk::OverwriteImageFilter already does this every time it
changes a
slice of an image. There is a static method InterpolatorForImage(), which can be used to find out if there already
is an interpolator
instance for a specified image. OverwriteImageFilter uses this to get to know its interpolator.
SliceBasedInterpolationController needs to maintain some information about the image slices (in every dimension).
This information is stored internally in m_SegmentationCountInSlice, which is basically three std::vectors (one for
each dimension).
Each item describes one image dimension, each vector item holds the count of pixels in "its" slice. This is perhaps
better to understand
from the following picture (where red items just mean to symbolize "there is some segmentation" - in reality there
is an integer count).
- \image html slice_based_segmentation_interpolator.png
-
$Author$
*/
class MITKSEGMENTATION_EXPORT SliceBasedInterpolationController : public itk::Object
{
public:
mitkClassMacroItkParent(SliceBasedInterpolationController, itk::Object);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**
\brief Find interpolator for a given image.
\return nullptr if there is no interpolator yet.
This method is useful if several "clients" modify the same image and want to access the interpolations.
Then they can share the same object.
*/
static SliceBasedInterpolationController *InterpolatorForImage(const Image *);
/**
\brief Initialize with a whole volume.
Will scan the volume for segmentation pixels (values other than 0) and fill some internal data structures.
You don't have to call this method every time something changes, but only
when several slices at once change.
When you change a single slice, call SetChangedSlice() instead.
*/
void SetWorkingImage(LabelSetImage *image);
/**
\brief Set a reference image (original patient image) - optional.
If this image is set (must exactly match the dimensions of the segmentation),
the interpolation algorithm may consider image content to improve the interpolated
(estimated) segmentation.
*/
void SetReferenceImage(Image *image);
/**
\brief Update after changing a single slice in the working image.
\param image is a 2D image with the difference image of the slice determined by sliceDimension and sliceIndex.
The difference is (pixel value in the new slice minus pixel value in the old slice).
\param sliceDimension Number of the dimension which is constant for all pixels of the meant slice.
\param sliceIndex Which slice to take, in the direction specified by sliceDimension. Count starts from 0.
\param timeStep Which time step is changed
*/
void SetChangedSlice(const Image *image,
unsigned int sliceDimension,
unsigned int sliceIndex,
unsigned int timeStep);
- /**
- \brief Update after changing the whole working image.
-
- \param image is a 3D image with the difference image of the slice determined by sliceDimension and sliceIndex.
- The difference is (pixel value in the new slice minus pixel value in the old slice).
-
- \param timeStep Which time step is changed
- */
- // void SetChangedImage( const Image* image, unsigned int timeStep );
-
/**
\brief Generates an interpolated image for the given slice.
\param sliceDimension Number of the dimension which is constant for all pixels of the meant slice.
\param sliceIndex Which slice to take, in the direction specified by sliceDimension. Count starts from 0.
+ \param currentPlane
+
\param timeStep Which time step to use
*/
Image::Pointer Interpolate(unsigned int sliceDimension,
unsigned int sliceIndex,
const mitk::PlaneGeometry *currentPlane,
unsigned int timeStep);
/**
\brief Initializes the internal container with the number of voxels per label.
*/
void ResetLabelCount();
protected:
/**
\brief Protected class of mitk::SliceBasedInterpolationController. Don't use (you shouldn't be able to do so)!
*/
class MITKSEGMENTATION_EXPORT SetChangedSliceOptions
{
public:
SetChangedSliceOptions(unsigned int sd, unsigned int si, unsigned int d0, unsigned int d1, unsigned int t)
: sliceDimension(sd), sliceIndex(si), dim0(d0), dim1(d1), timeStep(t)
{
}
unsigned int sliceDimension;
unsigned int sliceIndex;
unsigned int dim0;
unsigned int dim1;
unsigned int timeStep;
// void* pixelData;
};
typedef std::vector<unsigned int> LabelCounterVectorType;
typedef std::vector<LabelCounterVectorType> LabelCounterSliceVectorType;
typedef std::vector<std::vector<LabelCounterSliceVectorType>> LabelCounterSliceTimeVectorType;
typedef std::map<const Image *, SliceBasedInterpolationController *> InterpolatorMapType;
SliceBasedInterpolationController(); // purposely hidden
~SliceBasedInterpolationController() override;
/// internal scan of a single slice
template <typename PixelType>
void ScanSliceITKProcessing(const itk::Image<PixelType, 2> *, const SetChangedSliceOptions &options);
/// internal scan of the whole image
template <typename TPixel, unsigned int VImageDimension>
void ScanImageITKProcessing(itk::Image<TPixel, VImageDimension> *, unsigned int timeStep);
/**
An array that of flags. One for each dimension of the image. A flag is set, when a slice in a certain dimension
has at least one pixel that is not 0 (which would mean that it has to be considered by the interpolation
algorithm).
E.g. flags for axial slices are stored in m_SegmentationCountInSlice[0][index].
Enhanced with time steps it is now m_SegmentationCountInSlice[timeStep][0][index]
*/
LabelCounterSliceTimeVectorType m_LabelCountInSlice;
static InterpolatorMapType s_InterpolatorForImage;
LabelSetImage::Pointer m_WorkingImage;
Image::Pointer m_ReferenceImage;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkFeedbackContourTool.h b/Modules/Segmentation/Interactions/mitkFeedbackContourTool.h
index f7525aeac6..945c4911fd 100644
--- a/Modules/Segmentation/Interactions/mitkFeedbackContourTool.h
+++ b/Modules/Segmentation/Interactions/mitkFeedbackContourTool.h
@@ -1,113 +1,118 @@
/*============================================================================
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 mitkFeedbackContourTool_h_Included
#define mitkFeedbackContourTool_h_Included
#include "mitkCommon.h"
#include "mitkContourModelUtils.h"
#include "mitkContourUtils.h" //TODO remove legacy support
#include "mitkImage.h"
#include "mitkSegTool2D.h"
#include <MitkSegmentationExports.h>
#include "mitkDataNode.h"
#include "mitkImageCast.h"
namespace mitk
{
/**
\brief Base class for tools that use a contour for feedback
\sa Tool
\sa ContourModel
\ingroup Interaction
\ingroup ToolManagerEtAl
Implements helper methods, that might be of use to all kind of 2D segmentation tools that use a contour for user
feedback.
- Providing a feedback contour that might be added or removed from the visible scene (SetFeedbackContourVisible).
- Filling of a contour into a 2D slice
These helper methods are actually implemented in ContourUtils now. FeedbackContourTool only forwards such requests.
\warning Only to be instantiated by mitk::ToolManager.
$Author: nolden $
*/
class MITKSEGMENTATION_EXPORT FeedbackContourTool : public SegTool2D
{
public:
mitkClassMacro(FeedbackContourTool, SegTool2D);
protected:
FeedbackContourTool(); // purposely hidden
FeedbackContourTool(const char *); // purposely hidden
~FeedbackContourTool() override;
ContourModel *GetFeedbackContour();
void SetFeedbackContour(ContourModel::Pointer);
void SetFeedbackContourVisible(bool);
/// Provide values from 0.0 (black) to 1.0 (full color)
void SetFeedbackContourColor(float r, float g, float b);
void SetFeedbackContourColorDefault();
void Deactivated() override;
void Activated() override;
/**
\brief Projects a contour onto an image point by point. Converts from world to index coordinates.
+ \param slice
+ \param contourIn3D
\param correctionForIpSegmentation adds 0.5 to x and y index coordinates (difference between ipSegmentation and
MITK contours)
+ \param constrainToInside
*/
ContourModel::Pointer ProjectContourTo2DSlice(Image *slice,
ContourModel *contourIn3D,
bool correctionForIpSegmentation = false,
bool constrainToInside = true);
/**
\brief Projects a slice index coordinates of a contour back into world coordinates.
+ \param sliceGeometry
+ \param contourIn2D
\param correctionForIpSegmentation subtracts 0.5 to x and y index coordinates (difference between ipSegmentation
and MITK contours)
*/
ContourModel::Pointer BackProjectContourFrom2DSlice(const BaseGeometry *sliceGeometry,
ContourModel *contourIn2D,
bool correctionForIpSegmentation = false);
/**
\brief Fill a contour in a 2D slice with a specified pixel value.
*/
void FillContourInSlice(ContourModel *projectedContour, Image *sliceImage, int paintingPixelValue = 1);
/**
\brief Fill a contour in a 2D slice with a specified pixel value at a given time step.
*/
void FillContourInSlice(ContourModel *projectedContour,
unsigned int timeStep,
Image *sliceImage,
int paintingPixelValue = 1);
ContourModel::Pointer m_FeedbackContour;
DataNode::Pointer m_FeedbackContourNode;
bool m_FeedbackContourVisible;
};
} // namespace
#endif
diff --git a/Modules/Segmentation/Interactions/mitkSegTool2D.h b/Modules/Segmentation/Interactions/mitkSegTool2D.h
index b4d4c5d2e6..474b90fae7 100644
--- a/Modules/Segmentation/Interactions/mitkSegTool2D.h
+++ b/Modules/Segmentation/Interactions/mitkSegTool2D.h
@@ -1,192 +1,199 @@
/*============================================================================
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 mitkSegTool2D_h_Included
#define mitkSegTool2D_h_Included
#include "mitkCommon.h"
#include "mitkImage.h"
#include "mitkTool.h"
#include <MitkSegmentationExports.h>
#include "mitkInteractionPositionEvent.h"
#include "mitkInteractionConst.h"
#include "mitkPlanePositionManager.h"
#include "mitkRestorePlanePositionOperation.h"
#include <mitkDiffSliceOperation.h>
namespace mitk
{
class BaseRenderer;
/**
\brief Abstract base class for segmentation tools.
\sa Tool
\ingroup Interaction
\ingroup ToolManagerEtAl
Implements 2D segmentation specific helper methods, that might be of use to
all kind of 2D segmentation tools. At the moment these are:
- Determination of the slice where the user paints upon (DetermineAffectedImageSlice)
- Projection of a 3D contour onto a 2D plane/slice
SegTool2D tries to structure the interaction a bit. If you pass "PressMoveRelease" as the interaction type
of your derived tool, you might implement the methods OnMousePressed, OnMouseMoved, and OnMouseReleased.
Yes, your guess about when they are called is correct.
\warning Only to be instantiated by mitk::ToolManager.
$Author$
*/
class MITKSEGMENTATION_EXPORT SegTool2D : public Tool
{
public:
mitkClassMacro(SegTool2D, Tool);
/**
\brief Calculates for a given Image and PlaneGeometry, which slice of the image (in index corrdinates) is meant by
the plane.
\return false, if no slice direction seems right (e.g. rotated planes)
+ \param image
+ \param plane
\param affectedDimension The image dimension, which is constant for all points in the plane, e.g. Axial --> 2
\param affectedSlice The index of the image slice
*/
static bool DetermineAffectedImageSlice(const Image *image,
const PlaneGeometry *plane,
int &affectedDimension,
int &affectedSlice);
/**
* @brief Updates the surface interpolation by extracting the contour form the given slice.
* @param slice the slice from which the contour should be extracted
* @param workingImage the segmentation image
* @param plane the plane in which the slice lies
* @param detectIntersection if true the slice is eroded before contour extraction. If the slice is empty after the
* erosion it is most
* likely an intersecting contour an will not be added to the SurfaceInterpolationController
*/
static void UpdateSurfaceInterpolation(const Image *slice,
const Image *workingImage,
const PlaneGeometry *plane,
bool detectIntersection);
void SetShowMarkerNodes(bool);
/**
* \brief Enables or disables the 3D interpolation after writing back the 2D segmentation result, and defaults to
* true.
*/
void SetEnable3DInterpolation(bool);
protected:
SegTool2D(); // purposely hidden
SegTool2D(const char *, const us::Module *interactorModule = nullptr); // purposely hidden
~SegTool2D() override;
struct SliceInformation
{
mitk::Image::Pointer slice;
mitk::PlaneGeometry *plane;
unsigned int timestep;
SliceInformation() {}
SliceInformation(mitk::Image *slice, mitk::PlaneGeometry *plane, unsigned int timestep)
{
this->slice = slice;
this->plane = plane;
this->timestep = timestep;
}
};
/**
* \brief Filters events that cannot be handle by 2D segmentation tools
*
* Current an event is discarded if it was not sent by a 2D renderwindow and if it is
* not of type InteractionPositionEvent
*/
bool FilterEvents(InteractionEvent *interactionEvent, DataNode *dataNode) override;
/**
* \brief Extract the slice of an image that the user just scribbles on. The given component denotes the vector component of a dwi-image.
*
+ * \param positionEvent
+ * \param image
* \param component The component to be extracted of a given multi-component image. -1 is the default parameter to denote an invalid component.
*
* \return 'nullptr' if SegTool2D is either unable to determine which slice was affected, or if there was some problem
* getting the image data at that position.
*/
Image::Pointer GetAffectedImageSliceAs2DImage(const InteractionPositionEvent *positionEvent, const Image *image, unsigned int component = 0);
/**
* \brief Extract the slice of an image cut by given plane. The given component denotes the vector component of a dwi-image.
*
+ * \param planeGeometry
+ * \param image
+ * \param timeStep
* \param component The component to be extracted of a given multi-component image. -1 is the default parameter to denote an invalid component.
*
* \return 'nullptr' if SegTool2D is either unable to determine which slice was affected, or if there was some problem
* getting the image data at that position.
*/
Image::Pointer GetAffectedImageSliceAs2DImage(const PlaneGeometry *planeGeometry,
const Image *image,
unsigned int timeStep,
unsigned int component = 0);
/**
\brief Extract the slice of the currently selected working image that the user just scribbles on.
\return nullptr if SegTool2D is either unable to determine which slice was affected, or if there was some problem
getting the image data at that position,
or just no working image is selected.
*/
Image::Pointer GetAffectedWorkingSlice(const InteractionPositionEvent *);
/**
\brief Extract the slice of the currently selected reference image that the user just scribbles on.
\return nullptr if SegTool2D is either unable to determine which slice was affected, or if there was some problem
getting the image data at that position,
or just no reference image is selected.
*/
Image::Pointer GetAffectedReferenceSlice(const InteractionPositionEvent *);
void WriteBackSegmentationResult(const InteractionPositionEvent *, Image *);
void WriteBackSegmentationResult(const PlaneGeometry *planeGeometry, Image *, unsigned int timeStep);
void WriteBackSegmentationResult(const std::vector<SliceInformation> &sliceList, bool writeSliceToVolume = true);
void WritePreviewOnWorkingImage(
Image *targetSlice, Image *sourceSlice, Image *workingImage, int paintingPixelValue, int timestep);
void WriteSliceToVolume(const SliceInformation &sliceInfo);
/**
\brief Adds a new node called Contourmarker to the datastorage which holds a mitk::PlanarFigure.
By selecting this node the slicestack will be reoriented according to the PlanarFigure's Geometry
*/
int AddContourmarker();
void InteractiveSegmentationBugMessage(const std::string &message);
BaseRenderer *m_LastEventSender;
unsigned int m_LastEventSlice;
private:
// The prefix of the contourmarkername. Suffix is a consecutive number
const std::string m_Contourmarkername;
bool m_ShowMarkerNodes;
static bool m_SurfaceInterpolationEnabled;
};
} // namespace
#endif
diff --git a/Modules/SegmentationUI/Qmitk/QmitkAdaptiveRegionGrowingToolGUI.h b/Modules/SegmentationUI/Qmitk/QmitkAdaptiveRegionGrowingToolGUI.h
index c0d645772d..79f848ea27 100644
--- a/Modules/SegmentationUI/Qmitk/QmitkAdaptiveRegionGrowingToolGUI.h
+++ b/Modules/SegmentationUI/Qmitk/QmitkAdaptiveRegionGrowingToolGUI.h
@@ -1,228 +1,229 @@
/*============================================================================
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 QMITK_QmitkAdaptiveRegionGrowingToolGUI_H
#define QMITK_QmitkAdaptiveRegionGrowingToolGUI_H
#include "itkImage.h"
#include "mitkDataStorage.h"
#include "mitkGeometry3D.h"
#include "mitkPointSet.h"
#include "qwidget.h"
#include "ui_QmitkAdaptiveRegionGrowingToolGUIControls.h"
#include <MitkSegmentationUIExports.h>
#include "QmitkToolGUI.h"
#include "mitkAdaptiveRegionGrowingTool.h"
class DataNode;
class QmitkAdaptiveRegionGrowingToolGUIControls;
/*!
*
* \brief QmitkAdaptiveRegionGrowingToolGUI
*
* Adaptive Region Growing View class of the segmentation.
*
*/
class MITKSEGMENTATIONUI_EXPORT QmitkAdaptiveRegionGrowingToolGUI : public QmitkToolGUI
{
Q_OBJECT
public:
/**
* @brief mitkClassMacro
*/
mitkClassMacro(QmitkAdaptiveRegionGrowingToolGUI, QmitkToolGUI);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
QmitkAdaptiveRegionGrowingToolGUI(QWidget *parent = nullptr);
/** \brief Method to create the connections for the component. This Method is obligatory even if no connections is
* needed*/
virtual void CreateConnections();
///** \brief Method to set the default data storage.*/
virtual void SetDataStorage(mitk::DataStorage *dataStorage);
/**
* @brief Method to set the name of a data node.
* @param labledSegmentation Name of the labeled segmentation
* @param binaryImage Name of the binary image
* @param surface Name of the surface
+ * @param maskedSegmentation
*/
void SetDataNodeNames(std::string labledSegmentation,
std::string binaryImage,
/*std::string vesselTree,*/ std::string surface,
std::string maskedSegmentation);
/**
* @brief Method to enable/disable controls for region growing
*
* This method checks if a seed point is set and a segmentation exists.
- * @param enable/disable controls
+ * @param enable enable/disable controls
*/
void EnableControls(bool enable);
/**
* @brief Method to set the input image node
- * @param data node
+ * @param node data node
*/
void SetInputImageNode(mitk::DataNode *node);
void Deactivated();
void Activated();
/**
* @brief The created GUI from the .ui-File. This Attribute is obligatory
*/
Ui::QmitkAdaptiveRegionGrowingToolGUIControls m_Controls;
protected slots:
/**
* @brief Method to start the segmentation
*
* This method is called, when the "Start Segmentation" button is clicked.
*/
void RunSegmentation();
/**
* @brief Method to change the level window
*
* This method is called, when the level window slider is changed via the slider in the control widget
- * @param new value
+ * @param newValue new value
*/
void ChangeLevelWindow(double newValue);
/**
* @brief Method to increase the preview slider
*
* This method is called, when the + button is clicked and increases the value by 1
*/
void IncreaseSlider();
/**
* @brief Method to decrease the preview slider
*
* This method is called, when the - button is clicked and decreases the value by 1
*/
void DecreaseSlider();
/**
* @brief Method to confirm the preview segmentation
*
* This method is called, when the "Confirm Segmentation" button is clicked.
*/
void ConfirmSegmentation();
/**
* @brief Method to switch the volume rendering on/off
- * @param on/off
+ * @param on
*/
void UseVolumeRendering(bool on);
/**
* @brief Method to set the lower threshold
*
* This method is called, when the minimum threshold slider has changed
- * @param lower threshold
+ * @param lowerThreshold lower threshold
*/
void SetLowerThresholdValue(double lowerThreshold);
/**
* @brief Method to set upper threshold
*
* This Method is called, when the maximum threshold slider has changed
- * @param upper threshold
+ * @param upperThreshold upper threshold
*/
void SetUpperThresholdValue(double upperThreshold);
/**
* @brief Method to determine which tool to activate
*
* This method listens to the tool manager and activates this tool if requested otherwise disables this view
*/
void OnNewToolAssociated(mitk::Tool *);
protected:
mitk::AdaptiveRegionGrowingTool::Pointer m_RegionGrow3DTool;
/** \brief Destructor. */
~QmitkAdaptiveRegionGrowingToolGUI() override;
mitk::DataStorage *m_DataStorage;
mitk::DataNode::Pointer m_InputImageNode;
/**
* @brief Method to calculate parameter settings, when a seed point is set
*/
void OnPointAdded();
/**
* @brief Method to extract a 3D image based on a given time point that can be taken from the SliceNavigationController
*
* This ensures that the seed point is taken from the current selected 3D image
*/
mitk::Image::ConstPointer GetImageByTimePoint(const mitk::Image *image,
mitk::TimePointType timePoint) const;
private:
std::string m_NAMEFORORGIMAGE;
std::string m_NAMEFORLABLEDSEGMENTATIONIMAGE;
std::string m_NAMEFORBINARYIMAGE;
std::string m_NAMEFORSURFACE;
std::string m_NAMEFORMASKEDSEGMENTATION;
mitk::ScalarType m_LOWERTHRESHOLD; // Hounsfield value
mitk::ScalarType m_UPPERTHRESHOLD; // Hounsfield value
mitk::ScalarType m_SeedPointValueMean;
void RemoveHelperNodes();
int m_DetectedLeakagePoint;
bool m_CurrentRGDirectionIsUpwards; // defines fixed threshold (true = LOWERTHRESHOLD fixed, false = UPPERTHRESHOLD
// fixed)
int m_SeedpointValue;
bool m_SliderInitialized;
bool m_UseVolumeRendering;
bool m_UpdateSuggestedThreshold;
float m_SuggestedThValue;
long m_PointSetAddObserverTag;
long m_PointSetMoveObserverTag;
template <typename TPixel, unsigned int VImageDimension>
void StartRegionGrowing(const itk::Image<TPixel, VImageDimension> *itkImage,
const mitk::BaseGeometry *imageGeometry,
const mitk::PointSet::PointType seedPoint);
template <typename TPixel, unsigned int VImageDimension>
void ITKThresholding(itk::Image<TPixel, VImageDimension> *inputImage);
void InitializeLevelWindow();
void EnableVolumeRendering(bool enable);
void UpdateVolumeRenderingThreshold(int thValue);
};
#endif
diff --git a/Modules/SegmentationUI/Qmitk/QmitkSliceBasedInterpolatorWidget.h b/Modules/SegmentationUI/Qmitk/QmitkSliceBasedInterpolatorWidget.h
index f33ab64114..b447a67e11 100644
--- a/Modules/SegmentationUI/Qmitk/QmitkSliceBasedInterpolatorWidget.h
+++ b/Modules/SegmentationUI/Qmitk/QmitkSliceBasedInterpolatorWidget.h
@@ -1,197 +1,197 @@
/*============================================================================
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 QmitkSliceBasedInterpolatorWidget_h_Included
#define QmitkSliceBasedInterpolatorWidget_h_Included
#include "MitkSegmentationUIExports.h"
#include "mitkDataStorage.h"
#include "mitkSliceBasedInterpolationController.h"
#include <map>
#include <QWidget>
#include "ui_QmitkSliceBasedInterpolatorWidgetGUIControls.h"
namespace mitk
{
class PlaneGeometry;
class SliceNavigationController;
class LabelSetImage;
class ToolManager;
class DiffSliceOperation;
}
/**
\brief GUI for slices interpolation.
\ingroup ToolManagerEtAl
\ingroup Widgets
\sa QmitkInteractiveSegmentation
\sa mitk::SegmentationInterpolation
While mitk::SegmentationInterpolation does the bookkeeping of interpolation
(keeping track of which slices contain how much segmentation) and the algorithmic work,
QmitkSliceBasedInterpolatorWidget is responsible to watch the GUI, to notice, which slice is currently
visible. It triggers generation of interpolation suggestions and also triggers acception of
suggestions.
This class uses the mitk::ToolManagerProvider::MULTILABEL_SEGMENTATION context.
\todo show/hide feedback on demand
Last contributor: $Author: maleike $
*/
class MITKSEGMENTATIONUI_EXPORT QmitkSliceBasedInterpolatorWidget : public QWidget
{
Q_OBJECT
public:
QmitkSliceBasedInterpolatorWidget(QWidget *parent = nullptr, const char *name = nullptr);
~QmitkSliceBasedInterpolatorWidget() override;
void SetDataStorage(mitk::DataStorage &storage);
/**
Sets the slice navigation controllers for getting slice changed events from the views.
*/
void SetSliceNavigationControllers(const QList<mitk::SliceNavigationController *> &controllers);
void OnToolManagerWorkingDataModified();
void OnTimeChanged(itk::Object *sender, const itk::EventObject &);
void OnSliceChanged(itk::Object *sender, const itk::EventObject &);
void OnSliceNavigationControllerDeleted(const itk::Object *sender, const itk::EventObject &);
/**
Just public because it is called by itk::Commands. You should not need to call this.
*/
void OnSliceInterpolationInfoChanged(const itk::EventObject &);
Ui::QmitkSliceBasedInterpolatorWidgetGUIControls m_Controls;
signals:
void signalSliceBasedInterpolationEnabled(bool);
public slots:
/**
\brief Reaction to "Start/Stop" button click
*/
void OnToggleWidgetActivation(bool);
protected slots:
/**
\brief Reaction to "Accept Current Slice" button click.
*/
void OnAcceptInterpolationClicked();
/*
\brief Reaction to "Accept All Slices" button click.
Opens popup to ask about which orientation should be interpolated
*/
void OnAcceptAllInterpolationsClicked();
/*
\brief Called from popup menu of OnAcceptAllInterpolationsClicked()
Will trigger interpolation for all slices in given orientation
*/
void OnAcceptAllPopupActivated(QAction *action);
protected:
typedef std::map<QAction *, mitk::SliceNavigationController *> ActionToSliceDimensionMapType;
const ActionToSliceDimensionMapType CreateActionToSliceDimension();
ActionToSliceDimensionMapType m_ActionToSliceDimensionMap;
void AcceptAllInterpolations(mitk::SliceNavigationController *slicer);
void WaitCursorOn();
void WaitCursorOff();
void RestoreOverrideCursor();
/**
Gets the working slice based on the given plane geometry and last saved interaction
\param planeGeometry a plane geometry
*/
mitk::Image::Pointer GetWorkingSlice(const mitk::PlaneGeometry *planeGeometry);
/**
Retrieves the currently selected PlaneGeometry from a SlicedGeometry3D that is generated by a
SliceNavigationController
and calls Interpolate to further process this PlaneGeometry into an interpolation.
\param e is a actually a mitk::SliceNavigationController::GeometrySliceEvent, sent by a SliceNavigationController
- \param slice the SliceNavigationController
+ \param slicer the SliceNavigationController
*/
void TranslateAndInterpolateChangedSlice(const itk::EventObject &e, mitk::SliceNavigationController *slicer);
/**
Given a PlaneGeometry, this method figures out which slice of the first working image (of the associated
ToolManager)
should be interpolated. The actual work is then done by our SegmentationInterpolation object.
*/
void Interpolate(mitk::PlaneGeometry *plane, mitk::TimePointType timePoint, mitk::SliceNavigationController *slicer);
/**
Called internally to update the interpolation suggestion. Finds out about the focused render window and requests an
interpolation.
*/
void UpdateVisibleSuggestion();
private:
mitk::SliceBasedInterpolationController::Pointer m_SliceInterpolatorController;
mitk::ToolManager *m_ToolManager;
bool m_Activated;
template <typename TPixel, unsigned int VImageDimension>
void WritePreviewOnWorkingImage(itk::Image<TPixel, VImageDimension> *target,
const mitk::Image *source,
int overwritevalue);
QHash<mitk::SliceNavigationController *, int> m_ControllerToTimeObserverTag;
QHash<mitk::SliceNavigationController *, int> m_ControllerToSliceObserverTag;
QHash<mitk::SliceNavigationController *, int> m_ControllerToDeleteObserverTag;
unsigned int m_InterpolationInfoChangedObserverTag;
mitk::DiffSliceOperation *m_doOperation;
mitk::DiffSliceOperation *m_undoOperation;
mitk::DataNode::Pointer m_PreviewNode;
mitk::Image::Pointer m_PreviewImage;
mitk::LabelSetImage::Pointer m_WorkingImage;
QHash<mitk::SliceNavigationController *, mitk::TimePointType> m_TimePoints;
mitk::DataStorage::Pointer m_DataStorage;
mitk::SliceNavigationController *m_LastSNC;
unsigned int m_LastSliceIndex;
};
#endif
diff --git a/Modules/SegmentationUI/Qmitk/QmitkSlicesInterpolator.h b/Modules/SegmentationUI/Qmitk/QmitkSlicesInterpolator.h
index 19d55cea0f..a6499b7354 100644
--- a/Modules/SegmentationUI/Qmitk/QmitkSlicesInterpolator.h
+++ b/Modules/SegmentationUI/Qmitk/QmitkSlicesInterpolator.h
@@ -1,291 +1,291 @@
/*============================================================================
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 QmitkSlicesInterpolator_h_Included
#define QmitkSlicesInterpolator_h_Included
#include "mitkDataNode.h"
#include "mitkDataStorage.h"
#include "mitkSegmentationInterpolationController.h"
#include "mitkSliceNavigationController.h"
#include "mitkSurfaceInterpolationController.h"
#include "mitkToolManager.h"
#include <MitkSegmentationUIExports.h>
#include "mitkFeatureBasedEdgeDetectionFilter.h"
#include "mitkPointCloudScoringFilter.h"
#include <QWidget>
#include <map>
#include <QCheckBox>
#include <QComboBox>
#include <QFrame>
#include <QGroupBox>
#include <QRadioButton>
#include "mitkVtkRepresentationProperty.h"
#include "vtkProperty.h"
// For running 3D interpolation in background
#include <QFuture>
#include <QFutureWatcher>
#include <QTimer>
#include <QtConcurrentRun>
namespace mitk
{
class PlaneGeometry;
class SliceNavigationController;
}
class QPushButton;
/**
\brief GUI for slices interpolation.
\ingroup ToolManagerEtAl
\ingroup Widgets
\sa QmitkInteractiveSegmentation
\sa mitk::SegmentationInterpolation
While mitk::SegmentationInterpolation does the bookkeeping of interpolation
(keeping track of which slices contain how much segmentation) and the algorithmic work,
QmitkSlicesInterpolator is responsible to watch the GUI, to notice, which slice is currently
visible. It triggers generation of interpolation suggestions and also triggers acception of
suggestions.
\todo show/hide feedback on demand
Last contributor: $Author: maleike $
*/
class MITKSEGMENTATIONUI_EXPORT QmitkSlicesInterpolator : public QWidget
{
Q_OBJECT
public:
QmitkSlicesInterpolator(QWidget *parent = nullptr, const char *name = nullptr);
/**
To be called once before real use.
*/
void Initialize(mitk::ToolManager *toolManager, const QList<mitk::SliceNavigationController *> &controllers);
void Uninitialize();
~QmitkSlicesInterpolator() override;
void SetDataStorage(mitk::DataStorage::Pointer storage);
mitk::DataStorage *GetDataStorage();
/**
Just public because it is called by itk::Commands. You should not need to call this.
*/
void OnToolManagerWorkingDataModified();
/**
Just public because it is called by itk::Commands. You should not need to call this.
*/
void OnToolManagerReferenceDataModified();
void OnTimeChanged(itk::Object *sender, const itk::EventObject &);
void OnSliceChanged(itk::Object *sender, const itk::EventObject &);
void OnSliceNavigationControllerDeleted(const itk::Object *sender, const itk::EventObject &);
/**
Just public because it is called by itk::Commands. You should not need to call this.
*/
void OnInterpolationInfoChanged(const itk::EventObject &);
/**
Just public because it is called by itk::Commands. You should not need to call this.
*/
void OnSurfaceInterpolationInfoChanged(const itk::EventObject &);
/**
* @brief Set the visibility of the 3d interpolation
*/
void Show3DInterpolationResult(bool);
signals:
void SignalRememberContourPositions(bool);
void SignalShowMarkerNodes(bool);
public slots:
virtual void setEnabled(bool);
/**
Call this from the outside to enable/disable interpolation
*/
void EnableInterpolation(bool);
void Enable3DInterpolation(bool);
/**
Call this from the outside to accept all interpolations
*/
void FinishInterpolation(mitk::SliceNavigationController *slicer = nullptr);
protected slots:
/**
Reaction to button clicks.
*/
void OnAcceptInterpolationClicked();
/*
Opens popup to ask about which orientation should be interpolated
*/
void OnAcceptAllInterpolationsClicked();
/*
Reaction to button clicks
*/
void OnAccept3DInterpolationClicked();
void OnReinit3DInterpolation();
void OnSuggestPlaneClicked();
/*
* Will trigger interpolation for all slices in given orientation (called from popup menu of
* OnAcceptAllInterpolationsClicked)
*/
void OnAcceptAllPopupActivated(QAction *action);
/**
Called on activation/deactivation
*/
void OnInterpolationActivated(bool);
void On3DInterpolationActivated(bool);
void OnInterpolationMethodChanged(int index);
// Enhancement for 3D interpolation
void On2DInterpolationEnabled(bool);
void On3DInterpolationEnabled(bool);
void OnInterpolationDisabled(bool);
void OnShowMarkers(bool);
void Run3DInterpolation();
void RunPlaneSuggestion();
void OnSurfaceInterpolationFinished();
void StartUpdateInterpolationTimer();
void StopUpdateInterpolationTimer();
void ChangeSurfaceColor();
protected:
const std::map<QAction *, mitk::SliceNavigationController *> createActionToSliceDimension();
std::map<QAction *, mitk::SliceNavigationController *> ACTION_TO_SLICEDIMENSION;
void AcceptAllInterpolations(mitk::SliceNavigationController *slicer);
/**
Retrieves the currently selected PlaneGeometry from a SlicedGeometry3D that is generated by a
SliceNavigationController
and calls Interpolate to further process this PlaneGeometry into an interpolation.
\param e is a actually a mitk::SliceNavigationController::GeometrySliceEvent, sent by a SliceNavigationController
- \param slice the SliceNavigationController
+ \param slicer the SliceNavigationController
*/
bool TranslateAndInterpolateChangedSlice(const itk::EventObject &e, mitk::SliceNavigationController *slicer);
/**
Given a PlaneGeometry, this method figures out which slice of the first working image (of the associated
ToolManager)
should be interpolated. The actual work is then done by our SegmentationInterpolation object.
*/
void Interpolate(mitk::PlaneGeometry *plane, mitk::TimePointType timePoint, mitk::SliceNavigationController *slicer);
// void InterpolateSurface();
/**
Called internally to update the interpolation suggestion. Finds out about the focused render window and requests an
interpolation.
*/
void UpdateVisibleSuggestion();
void SetCurrentContourListID();
private:
void HideAllInterpolationControls();
void Show2DInterpolationControls(bool show);
void Show3DInterpolationControls(bool show);
void CheckSupportedImageDimension();
void WaitForFutures();
void NodeRemoved(const mitk::DataNode* node);
mitk::SegmentationInterpolationController::Pointer m_Interpolator;
mitk::SurfaceInterpolationController::Pointer m_SurfaceInterpolator;
mitk::FeatureBasedEdgeDetectionFilter::Pointer m_EdgeDetector;
mitk::PointCloudScoringFilter::Pointer m_PointScorer;
mitk::ToolManager::Pointer m_ToolManager;
bool m_Initialized;
QHash<mitk::SliceNavigationController *, int> m_ControllerToTimeObserverTag;
QHash<mitk::SliceNavigationController *, int> m_ControllerToSliceObserverTag;
QHash<mitk::SliceNavigationController *, int> m_ControllerToDeleteObserverTag;
unsigned int InterpolationInfoChangedObserverTag;
unsigned int SurfaceInterpolationInfoChangedObserverTag;
QGroupBox *m_GroupBoxEnableExclusiveInterpolationMode;
QComboBox *m_CmbInterpolation;
QPushButton *m_BtnApply2D;
QPushButton *m_BtnApplyForAllSlices2D;
QPushButton *m_BtnApply3D;
QPushButton *m_BtnSuggestPlane;
QCheckBox *m_ChkShowPositionNodes;
QPushButton *m_BtnReinit3DInterpolation;
mitk::DataNode::Pointer m_FeedbackNode;
mitk::DataNode::Pointer m_InterpolatedSurfaceNode;
mitk::DataNode::Pointer m_3DContourNode;
mitk::Image *m_Segmentation;
mitk::SliceNavigationController *m_LastSNC;
unsigned int m_LastSliceIndex;
QHash<mitk::SliceNavigationController *, mitk::TimePointType> m_TimePoints;
bool m_2DInterpolationEnabled;
bool m_3DInterpolationEnabled;
// unsigned int m_CurrentListID;
mitk::DataStorage::Pointer m_DataStorage;
QFuture<void> m_Future;
QFutureWatcher<void> m_Watcher;
QTimer *m_Timer;
QFuture<void> m_PlaneFuture;
QFutureWatcher<void> m_PlaneWatcher;
bool m_FirstRun;
};
#endif
diff --git a/Modules/SegmentationUI/Qmitk/QmitkToolSelectionBox.h b/Modules/SegmentationUI/Qmitk/QmitkToolSelectionBox.h
index 2afc06ce0f..20d15ed015 100755
--- a/Modules/SegmentationUI/Qmitk/QmitkToolSelectionBox.h
+++ b/Modules/SegmentationUI/Qmitk/QmitkToolSelectionBox.h
@@ -1,148 +1,150 @@
/*============================================================================
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 QmitkToolSelectionBox_h_Included
#define QmitkToolSelectionBox_h_Included
#include "QmitkToolGUIArea.h"
#include <MitkSegmentationUIExports.h>
#include "mitkToolManager.h"
#include <QButtonGroup>
#include <QGridLayout>
#include <QWidget>
#include <map>
class QmitkToolGUI;
/**
\brief Display the tool selection state of a mitk::ToolManager
\sa mitk::ToolManager
\ingroup org_mitk_gui_qt_interactivesegmentation
\ingroup ToolManagerEtAl
This widget graphically displays the active tool of a mitk::ToolManager as a set
of toggle buttons. Each button show the identification of a Tool (icon and name).
When a button's toggle state is "down", the tool is activated. When a different button
is clicked, the active tool is switched. When you click an already active button, the
associated tool is deactivated with no replacement, which means that no tool is active
then.
When this widget is enabled/disabled it (normally) also enables/disables the tools. There
could be cases where two QmitkToolSelectionBox widgets are associated to the same ToolManager,
but if this happens, please look deeply into the code.
Last contributor: $Author: maleike $
*/
class MITKSEGMENTATIONUI_EXPORT QmitkToolSelectionBox : public QWidget
//!
{
Q_OBJECT
public:
enum EnabledMode
{
EnabledWithReferenceAndWorkingDataVisible,
EnabledWithReferenceData,
EnabledWithWorkingData,
AlwaysEnabled
};
QmitkToolSelectionBox(QWidget *parent = nullptr, mitk::DataStorage *storage = nullptr);
~QmitkToolSelectionBox() override;
mitk::ToolManager *GetToolManager();
void SetToolManager(mitk::ToolManager &); // no nullptr pointer allowed here, a manager is required
void setTitle(const QString &title);
/**
You may specify a list of tool "groups" that should be displayed in this widget. Every Tool can report its group
- as a string. This method will try to find the tool's group inside the supplied string \param toolGroups. If there is
+ as a string. This method will try to find the tool's group inside the supplied string \c toolGroups . If there is
a match,
the tool is displayed. Effectively, you can provide a human readable list like "default, lymphnodevolumetry,
oldERISstuff".
+
+ @param toolGroups
*/
void SetDisplayedToolGroups(const std::string &toolGroups = nullptr);
void OnToolManagerToolModified();
void OnToolManagerReferenceDataModified();
void OnToolManagerWorkingDataModified();
void OnToolGUIProcessEventsMessage();
void OnToolErrorMessage(std::string s);
void OnGeneralToolMessage(std::string s);
void RecreateButtons();
signals:
/// Whenever a tool is activated. id is the index of the active tool. Counting starts at 0, -1 indicates "no tool
/// selected"
/// This signal is also emitted, when the whole QmitkToolSelectionBox get disabled. Then it will claim
/// ToolSelected(-1)
/// When it is enabled again, there will be another ToolSelected event with the tool that is currently selected
void ToolSelected(int id);
public slots:
virtual void setEnabled(bool);
virtual void SetEnabledMode(EnabledMode mode);
virtual void SetLayoutColumns(int);
virtual void SetShowNames(bool);
virtual void SetGenerateAccelerators(bool);
virtual void SetToolGUIArea(QWidget *parentWidget);
protected slots:
void toolButtonClicked(int id);
void SetGUIEnabledAccordingToToolManagerState();
void UpdateButtonsEnabledState();
protected:
void showEvent(QShowEvent *) override;
void hideEvent(QHideEvent *) override;
void SetOrUnsetButtonForActiveTool();
mitk::ToolManager::Pointer m_ToolManager;
bool m_SelfCall;
std::string m_DisplayedGroups;
/// stores relationship between button IDs of the Qt widget and tool IDs of ToolManager
std::map<int, int> m_ButtonIDForToolID;
/// stores relationship between button IDs of the Qt widget and tool IDs of ToolManager
std::map<int, int> m_ToolIDForButtonID;
int m_LayoutColumns;
bool m_ShowNames;
bool m_GenerateAccelerators;
QWidget *m_ToolGUIWidget;
QmitkToolGUI *m_LastToolGUI;
// store buttons in this group
QButtonGroup *m_ToolButtonGroup;
QGridLayout *m_ButtonLayout;
EnabledMode m_EnabledMode;
};
#endif
diff --git a/Modules/SemanticRelations/include/mitkControlPointManager.h b/Modules/SemanticRelations/include/mitkControlPointManager.h
index 601ca9c945..3e13e89dc9 100644
--- a/Modules/SemanticRelations/include/mitkControlPointManager.h
+++ b/Modules/SemanticRelations/include/mitkControlPointManager.h
@@ -1,119 +1,119 @@
/*============================================================================
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 MITKCONTROLPOINTMANAGER_H
#define MITKCONTROLPOINTMANAGER_H
#include <MitkSemanticRelationsExports.h>
// semantic relations module
#include "mitkSemanticTypes.h"
// mitk core
#include <mitkDataNode.h>
namespace mitk
{
/**
* @brief Provides helper functions that are needed to work with control points.
*
* These functions help to generate new control points, check for overlapping / containing control points or provide functionality
* to find a fitting control point or even extend an already existing control point.
*/
/**
* @brief Generates a control point from a given data node.
* The date is extracted from the data node by using the 'DICOMHelper::GetDICOMDateFromDataNode'-function.
*
* @param datanode A data node pointer, whose date should be included in the newly generated control point.
*/
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPoint GenerateControlPoint(const mitk::DataNode* datanode);
/**
* @brief Find and return a whole control point including its date given a specific control point UID.
*
* @param caseID The current case identifier is defined by the given string.
* @param controlPointUID The control point UID as string.
*
* @return The control point with its UID and the date.
*/
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPoint GetControlPointByUID(const SemanticTypes::CaseID& caseID, const SemanticTypes::ID& controlPointUID);
/**
* @brief Returns an already existing control point from the given vector of control points. This existing control point has the
* the same date (year, month, day) as the given single control point.
* If no existing control point can be found an empty control point is returned.
*
* @param caseID The current case identifier is defined by the given string.
* @param controlPoint The control point to check for existence.
*
* @return The existing control point.
*/
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPoint FindExistingControlPoint(const SemanticTypes::CaseID& caseID, const SemanticTypes::ControlPoint& controlPoint);
/**
* @brief Returns an already existing close control point from the given vector of control points. This closest control point has a
* date that is within a certain distance-in-days to the given control point.
* If no closest control point can be found within the distance threshold an empty control point is returned.
*
* @param caseID The current case identifier is defined by the given string.
* @param controlPoint The control point to check for distance.
*
* @return The closest control point.
*/
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ControlPoint FindClosestControlPoint(const SemanticTypes::CaseID& caseID, const SemanticTypes::ControlPoint& controlPoint);
/**
* @brief Returns the examination period to which the given control point belongs.
* Each examination point holds a vector of control point UIDs so that the UID of the given control point can be compared against the UIDs of the vector.
* An empty examination period is returned if,
* - the given vector of examination periods is empty
* - the examination periods do not contain any control point UIDs
* - the UID of the given control point is not contained in any examination period
*
* @param caseID The current case identifier is defined by the given string.
* @param controlPoint The control point of which the examination period should be found.
*
* @return The examination period that contains the given control point.
*/
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ExaminationPeriod FindContainingExaminationPeriod(const SemanticTypes::CaseID& caseID, const SemanticTypes::ControlPoint& controlPoint);
/**
* @brief Return the examination period to which the given data node belongs.
* The control point is used to find an already existing or the closest control point in the semantic relations storage.
* If such a control point is found, the 'FindClosestControlPoint'-function with this control point as an argument is used
* to actually find the corresponding examination period.
*
* @param caseID The current case identifier is defined by the given string.
* @param controlPoint The control point of which the examination period should be found.
*
* @return The examination period that fits the given data node.
*/
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ExaminationPeriod FindFittingExaminationPeriod(const SemanticTypes::CaseID& caseID, const SemanticTypes::ControlPoint& controlPoint);
/**
* @brief Return the examination period to which the given data node belongs.
* The DICOM date of the data node is used to find an already existing or the closest control point in the semantic relations storage.
* If such a control point is found, the 'FindFittingExaminationPeriod'-function with this control point as an argument is used
* to actually find the corresponding examination period.
*
- * @param datanode A data node pointer, whose date should be included in the newly generated control point.
+ * @param dataNode A data node pointer, whose date should be included in the newly generated control point.
*
* @return The examination period that contains the given data node.
*/
MITKSEMANTICRELATIONS_EXPORT SemanticTypes::ExaminationPeriod FindFittingExaminationPeriod(const DataNode* dataNode);
/**
* @brief Sort the given vector of examination periods.
* Each examination period has a vector of control point UIDs (stored in chronological order).
* The examination periods can be sorted by comparing the first control points of the examination periods.
*
* @param caseID The current case identifier is defined by the given string.
* @param allExaminationPeriods The examination periods to sort.
*/
MITKSEMANTICRELATIONS_EXPORT void SortAllExaminationPeriods(const SemanticTypes::CaseID& caseID, SemanticTypes::ExaminationPeriodVector& allExaminationPeriods);
} // namespace mitk
#endif // MITKCONTROLPOINTMANAGER_H
diff --git a/Modules/SemanticRelations/include/mitkSemanticRelationsDataStorageAccess.h b/Modules/SemanticRelations/include/mitkSemanticRelationsDataStorageAccess.h
index 2e05221e5a..12fdd6be2d 100644
--- a/Modules/SemanticRelations/include/mitkSemanticRelationsDataStorageAccess.h
+++ b/Modules/SemanticRelations/include/mitkSemanticRelationsDataStorageAccess.h
@@ -1,183 +1,184 @@
/*============================================================================
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 MITKSEMANTICRELATIONSDATASTORAGEACCESS_H
#define MITKSEMANTICRELATIONSDATASTORAGEACCESS_H
#include <MitkSemanticRelationsExports.h>
// semantic relations module
#include "mitkSemanticTypes.h"
// mitk core
#include <mitkDataStorage.h>
#include <mitkWeakPointer.h>
namespace mitk
{
/**
* @brief The API provides functions to query and manipulate image relations and instances,
* that are helpful during follow-up examination, like control-points (time period),
* types of the images or lesions that may be visible on multiple images.
*
* The class is able to generate IDs from given data nodes using DICOM information.
* These IDs are used to identify the corresponding instances of a specific case.
* The case can also be directly identified by the given case ID.
*
* In order for most functions to work the case ID has to be used as a parameter.
* If not, these functions do nothing.
*/
class MITKSEMANTICRELATIONS_EXPORT SemanticRelationsDataStorageAccess
{
public:
using DataNodeVector = std::vector<DataNode::Pointer>;
SemanticRelationsDataStorageAccess(DataStorage* dataStorage);
/************************************************************************/
/* functions to get instances / attributes */
/************************************************************************/
/**
* @brief Return a vector of all segmentations that are currently available for the given case.
* The segmentations may be connected / not connected to a lesion of the case.
* If no segmentations are stored for the current case, an empty vector is returned.
*
* @pre The data storage member has to be valid (!nullptr).
* @throw SemanticRelationException, if the data storage member is invalid (==nullptr).
*
* @param caseID The current case identifier is defined by the given string.
*
* @return A vector of data nodes representing segmentations.
*/
DataNodeVector GetAllSegmentationsOfCase(const SemanticTypes::CaseID& caseID) const;
/**
* @brief Return a vector of all segmentations that define the given lesion. These segmentations don't have to be linked to the same image.
* If the lesion is not referred to by any segmentation, an empty vector is returned.
*
* @pre The data storage member has to be valid (!nullptr).
* @throw SemanticRelationException, if the data storage member is invalid (==nullptr).
* @pre The UID of the lesion has to exist for a lesion instance.
* @throw SemanticRelationException, if UID of the lesion does not exist for a lesion instance (this can be checked via 'InstanceExists').
*
* @param caseID The current case identifier is defined by the given string.
* @param lesion A lesion with a UID that identifies the corresponding lesion instance.
*
* @return A vector of data nodes representing segmentations that define the given lesion.
*/
DataNodeVector GetAllSegmentationsOfLesion(const SemanticTypes::CaseID& caseID, const SemanticTypes::Lesion& lesion) const;
/**
* @brief Return a vector of all images that are currently available for the given case.
*
* @pre The data storage member has to be valid (!nullptr).
* @throw SemanticRelationException, if the data storage member is invalid (==nullptr).
*
* @param caseID The current case identifier is defined by the given string.
*
* @return A vector of data nodes representing images.
*/
DataNodeVector GetAllImagesOfCase(const SemanticTypes::CaseID& caseID) const;
/**
* @brief Return a vector of all images that are specified by the given vector of image IDs.
*
* @pre The data storage member has to be valid (!nullptr).
* @throw SemanticRelationException, if the data storage member is invalid (==nullptr).
*
* @param imageIDs A vector of image IDs that represent the images in the data storage.
*
* @return A vector of data nodes representing images.
*/
DataNodeVector GetAllImagesByID(const SemanticTypes::IDVector& imageIDs) const;
/**
* @brief Return a vector of all images that are connected to those segmentations that are linked to the given lesion.
* If the lesion is not referred to by any segmentation, an empty vector is returned.
*
* @pre The UID of the lesion has to exist for a lesion instance.
* @throw SemanticRelationException, if UID of the lesion does not exist for a lesion instance (this can be checked via 'InstanceExists').
*
* @param caseID The current case identifier is defined by the given string.
* @param lesion A lesion with a UID that identifies the corresponding lesion instance.
*
* @return A vector of data nodes representing images on which the lesions are visible.
*/
DataNodeVector GetAllImagesOfLesion(const SemanticTypes::CaseID& caseID, const SemanticTypes::Lesion& lesion) const;
/**
* @brief Return a vector of all image nodes that are defined with the given control point and the given information type.
*
* @pre The UID of the control point has to exist for a control point instance.
* The information type has to exist for the given case (and is therefore used by at least one data node).
* @throw SemanticRelationException, if the UID of the control point does not exist for a control point instance (this can be checked via 'InstanceExists') or
* if the information type is not used by any data node (this can be checked via 'InstanceExists').
*
* @param caseID The current case identifier is defined by the given string.
* @param controlPoint A control point with a UID that identifies the corresponding control point instance.
* @param informationType An information type that identifies the corresponding information type instance.
*
* @return A vector of image nodes that are defined with the given control point and the given information type.
*/
DataNodeVector GetAllSpecificImages(const SemanticTypes::CaseID& caseID, const SemanticTypes::ControlPoint& controlPoint, const SemanticTypes::InformationType& informationType) const;
/**
* @brief Return a vector of all image nodes that are defined with the given information type and the given examination period.
* The function uses the 'SemanticRelationsInference::GetAllImageIDsOfExaminationPeriod'-function to retrieve the imageIDs of the examination period and
* then compares the information type of all these images against the given information type.
*
+ * @param caseID
* @param informationType An information type that identifies the corresponding information type instance.
* @param examinationPeriod An examination period that identifies the corresponding examination period instance.
*
* @return A vector of image nodes that are defined with the given information type with the given control point.
*/
DataNodeVector GetAllSpecificImages(const SemanticTypes::CaseID& caseID, const SemanticTypes::InformationType& informationType, const SemanticTypes::ExaminationPeriod& examinationPeriod) const;
/**
* @brief Return a vector of all segmentation nodes that are defined with the given control point and the given information type.
* The function uses the 'GetAllSpecificImages'-function to retrieve the specific images and then searches for the derived nodes (segmentation child nodes).
*
* @pre The UID of the control point has to exist for a control point instance.
* The information type has to exist for the given case (and is therefore used by at least one data node).
* @throw SemanticRelationException, if the UID of the control point does not exist for a control point instance (this can be checked via 'InstanceExists') or
* if the information type is not used by any data node (this can be checked via 'InstanceExists').
*
* @param caseID The current case identifier is defined by the given string.
* @param controlPoint A control point with a UID that identifies the corresponding control point instance.
* @param informationType An information type that identifies the corresponding information type instance.
*
* @return A vector of segmentation nodes that are defined with the given control point and the given information type.
*/
DataNodeVector GetAllSpecificSegmentations(const SemanticTypes::CaseID& caseID, const SemanticTypes::ControlPoint& controlPoint, const SemanticTypes::InformationType& informationType) const;
/**
* @brief Return the single segmentation node that is defined with the given information type, the given control point and is representing the given lesion.
* The function uses the 'GetAllSpecificSegmentations'-function to retrieve the specific segmentations and then checks for the represented lesion.
*
* @pre The UID of the control point has to exist for a control point instance.
* The information type has to exist for the given case (and is therefore used by at least one data node).
* The lesion has to exist for the given case.
* @throw SemanticRelationException, if the UID of the control point does not exist for a control point instance (this can be checked via 'InstanceExists') or
* if the information type is not used by any data node (this can be checked via 'InstanceExists') or
* if the lesion does not exist for the given case (this can be checked via 'InstanceExists').
*
* @param caseID The current case identifier is defined by the given string.
* @param controlPoint A control point with a UID that identifies the corresponding control point instance.
* @param informationType An information type that identifies the corresponding information type instance.
* @param lesion A lesion with a UID that identifies the corresponding lesion instance.
*
* @return A single segmentation node that is defined with the given information type, the given control point and is representing the given lesion.
*/
DataNode::Pointer GetSpecificSegmentation(const SemanticTypes::CaseID& caseID, const SemanticTypes::ControlPoint& controlPoint,
const SemanticTypes::InformationType& informationType, const SemanticTypes::Lesion& lesion) const;
private:
WeakPointer<DataStorage> m_DataStorage;
};
} // namespace mitk
#endif // MITKSEMANTICRELATIONSDATASTORAGEACCESS_H
diff --git a/Modules/SemanticRelations/include/mitkSemanticRelationsIntegration.h b/Modules/SemanticRelations/include/mitkSemanticRelationsIntegration.h
index 7d798c3d1e..4584c31fb3 100644
--- a/Modules/SemanticRelations/include/mitkSemanticRelationsIntegration.h
+++ b/Modules/SemanticRelations/include/mitkSemanticRelationsIntegration.h
@@ -1,322 +1,322 @@
/*============================================================================
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 MITKSEMANTICRELATIONSINTEGRATION_H
#define MITKSEMANTICRELATIONSINTEGRATION_H
#include <MitkSemanticRelationsExports.h>
// semantic relations module
#include "mitkISemanticRelationsObservable.h"
#include "mitkISemanticRelationsObserver.h"
#include "mitkSemanticTypes.h"
// mitk core
#include <mitkDataNode.h>
namespace mitk
{
/**
* @brief The API provides functions to manipulate image relations and instances
* that are helpful during follow-up examination, like control-points (time period),
* types of the images or lesions that may be visible on multiple images.
*
* The class is able to generate IDs from given data nodes using DICOM information.
* These IDs are used to identify the corresponding instances of a specific case.
* The case can also be directly identified by the given case ID.
*
* In order for most functions to work the case ID has to be used as a parameter.
* If not, these functions do nothing.
*
* The class implements the ISemanticRelationsObservable interface to allow observers to
* be informed about changes in the semantic relation storage.
*/
class MITKSEMANTICRELATIONS_EXPORT SemanticRelationsIntegration : public ISemanticRelationsObservable
{
public:
/************************************************************************/
/* functions to implement the observer pattern */
/************************************************************************/
/**
* @brief Adds the given concrete observer to the vector that holds all currently registered observer.
* If the observer is already registered, it will not be added to the observer vector.
*
* @param observer The concrete observer to register.
*/
void AddObserver(ISemanticRelationsObserver* observer) override;
/**
* @brief Removes the given concrete observer from the vector that holds all currently registered observer.
*
* @param observer The concrete observer to unregister.
*/
void RemoveObserver(ISemanticRelationsObserver* observer) override;
virtual ~SemanticRelationsIntegration() {}
/************************************************************************/
/* functions to add / remove instances / attributes */
/************************************************************************/
/**
* @brief Add the given image to the set of already existing images.
* The date is extracted from the DICOM data of the image node and is compared to already existing control points in the semantic relations model.
* The function tries to find a fitting control point or to extend an already existing control point, if the extracted control point is close to
* any other, already existing control point.
* Finally, the image is linked to the correct control point.
*
* @pre The given image data node has to be valid (!nullptr).
* @throw SemanticRelationException, if the given image data node is invalid (==nullptr).
*
* @param imageNode The current case identifier and node identifier is extracted from the given image data node, which contains DICOM information about the case and the node.
*/
void AddImage(const DataNode* imageNode);
/**
* @brief Remove the given image from the set of already existing images.
*
* @pre The given image data node has to be valid (!nullptr).
* @throw SemanticRelationException, if the given image data node is invalid (==nullptr).
*
* @param imageNode The current case identifier and node identifier is extracted from the given image data node, which contains DICOM information about the case and the node.
*/
void RemoveImage(const DataNode* imageNode);
/**
* @brief Add a newly created lesion to the set of already existing lesions - with no connection to a specific image / segmentation of the case data.
*
* @pre The UID of the lesion must not already exist for a lesion instance.
* @throw SemanticRelationException, it the UID of the lesion already exists for a lesion instance (this can be checked via 'InstanceExists').
*
* @param caseID The current case identifier is defined by the given string.
* @param lesion The lesion instance to add.
*/
void AddLesion(const SemanticTypes::CaseID& caseID, const SemanticTypes::Lesion& lesion);
/**
* @brief Overwrite an already existing lesion instance (this may be useful to overwrite the lesion with a different lesion class).
*
* @pre The UID of the lesion has to exist for a lesion instance.
* @throw SemanticRelationException, if the UID of the lesion does not exist for a lesion instance (this can be checked via 'InstanceExists').
*
* @param caseID The current case identifier is defined by the given string.
* @param lesion The lesion instance that overwrites an existing lesion.
*/
void OverwriteLesion(const SemanticTypes::CaseID& caseID, const SemanticTypes::Lesion& lesion);
/**
* @brief Add a newly created lesion to the set of already existing lesions. The lesion is added and a reference to
* the lesion is added to the segmentation. If the segmentation is already linked to a lesion, the
* old linkage is overwritten (this can be checked via 'IsRepresentingALesion').
*
* @pre The given segmentation data node has to be valid (!nullptr).
* @throw SemanticRelationException, if the given segmentation data node is invalid (==nullptr).
* @pre The UID of the lesion must not already exist for a lesion instance.
* @throw SemanticRelationException, if the UID of the lesion already exists for a lesion instance (this can be checked via 'InstanceExists').
*
* @param segmentationNode The segmentation identifier is extracted from the given segmentation data node. The segmentation node has DICOM information from its parent node.
* @param lesion The lesion instance to add and link.
*/
void AddLesionAndLinkSegmentation(const DataNode* segmentationNode, const SemanticTypes::Lesion& lesion);
/**
* @brief Remove the given lesion from the set of already existing lesions.
*
* @pre The UID of the lesion has to exist for a lesion instance.
* @throw SemanticRelationException, if the UID of the lesion does not exist for a lesion instance (this can be checked via 'InstanceExists').
* @pre The function needs to assure that no segmentation is still representing (linked to) this lesion.
* @throw SemanticRelationException, if the lesion instance to remove is still linked to by any segmentation (this can be checked via 'GetAllSegmentationsOfLesion').
*
* @param caseID The current case identifier is defined by the given string.
* @param lesion The lesion instance to remove.
*/
void RemoveLesion(const SemanticTypes::CaseID& caseID, const SemanticTypes::Lesion& lesion);
/**
* @brief Add a segmentation instance to the set of already existing segmentations - with no connection to a specific lesion.
*
* @param segmentationNode The segmentation identifier is extracted from the given segmentation data node. The segmentation node has DICOM information from its parent node.
* @param parentNode The node identifier of the parent node is extracted from the given parent data node.
*/
void AddSegmentation(const DataNode* segmentationNode, const DataNode* parentNode);
/**
* @brief Link the given segmentation instance to an an already existing lesion instance. If the segmentation is already linked to a lesion instance, the
* old linkage is overwritten (this can be checked via 'IsRepresentingALesion').
*
* @pre The given segmentation data node has to be valid (!nullptr).
* @throw SemanticRelationException, if the given segmentation data node is invalid (==nullptr).
* @pre The UID of the lesion has to exist for a lesion instance.
* @throw SemanticRelationException, if the UID of the lesion does not exist for a lesion instance (this can be checked via 'InstanceExists').
*
* @param segmentationNode The segmentation identifier is extracted from the given segmentation data node. The segmentation node has DICOM information from its parent node.
* @param lesion The lesion instance to link.
*/
void LinkSegmentationToLesion(const DataNode* segmentationNode, const SemanticTypes::Lesion& lesion);
/**
* @brief Unlink the given segmentation instance from the linked lesion instance.
* The lesion may stay unlinked to any segmentation.
*
* @pre The given segmentation data node has to be valid (!nullptr).
* @throw SemanticRelationException, if the given segmentation data node is invalid (==nullptr).
*
* @param segmentationNode The segmentation identifier is extracted from the given segmentation data node. The segmentation node has DICOM information from its parent node.
*/
void UnlinkSegmentationFromLesion(const DataNode* segmentationNode);
/**
* @brief Remove the given segmentation from the set of already existing segmentations.
*
* @pre The given segmentation data node has to be valid (!nullptr).
* @throw SemanticRelationException, if the given segmentation data node is invalid (==nullptr).
*
* @param segmentationNode The segmentation identifier is extracted from the given segmentation data node. The segmentation node has DICOM information from its parent node.
*/
void RemoveSegmentation(const DataNode* segmentationNode);
/**
* @brief Set the control point for the given image.
*
* @pre The given image data node has to be valid (!nullptr).
* @throw SemanticRelationException, if the given image data node is invalid (==nullptr).
*
* @param imageNode The current case identifier and node identifier is extracted from the given image data node, which contains DICOM information about the case and the node.
* @param controlPoint The control point instance which is used for the given image.
*/
void SetControlPointOfImage(const DataNode* imageNode, const SemanticTypes::ControlPoint& controlPoint);
/**
* @brief Add a newly created control point to the set of already existing control points. A reference to the control point is added to the given image.
* This function combines adding a control point and linking it, since a control point with no associated data is not allowed.
*
* @pre The given image data node has to be valid (!nullptr).
* @throw SemanticRelationException, if the given image data node is invalid (==nullptr).
* @pre The UID of the control point must not already exist for a control point instance.
* @throw SemanticRelationException, if the UID of the control point already exists for a control point instance (this can be checked via 'InstanceExists').
* @pre The given control point must not already be contained in an existing control point interval.
* @throw SemanticRelationException, if the given control point is already contained in an existing control point interval (this can be checked via 'CheckContainingControlPoint').
* @pre The given control point must contain the date of the given image data node (if parameter 'checkConsistence = true').
* @throw SemanticRelationException, if the given control point does not contain the date of the given image data node and 'checkConsistence = true' (this can be checked via 'ControlPointManager::InsideControlPoint').
*
* @param imageNode The current case identifier and node identifier is extracted from the given image data node, which contains DICOM information about the case and the node.
* @param controlPoint The control point instance to add. For a newly added control point always has "startDate = endDate".
* @param checkConsistence If true, the function checks, whether the date of the image data node actually lies inside the control point to link.
*/
void AddControlPointAndLinkImage(const DataNode* imageNode, const SemanticTypes::ControlPoint& controlPoint, bool checkConsistence = true);
/**
* @brief Link the given image to an already existing control point.
*
* @pre The given image data node has to be valid (!nullptr).
* @throw SemanticRelationException, if the given image data node is invalid (==nullptr).
* @pre The UID of the control point has to exist for a control point instance.
* @throw SemanticRelationException, if the UID of the control point does not exists for a control point instance (this can be checked via 'InstanceExists').
* @pre The given control point must contain the date of the given image data node (if parameter 'checkConsistence = true').
* @throw SemanticRelationException, if the given control point does not contain the date of the given image data node and 'checkConsistence = true' (this can be checked via 'ControlPointManager::InsideControlPoint').
*
* @param imageNode The current case identifier and node identifier is extracted from the given image data node, which contains DICOM information about the case and the node.
* @param controlPoint The control point instance to link.
* @param checkConsistence If true, the function checks, whether the date of the image data node actually lies inside the control point to link.
*/
void LinkImageToControlPoint(const DataNode* imageNode, const SemanticTypes::ControlPoint& controlPoint, bool checkConsistence = true);
/**
* @brief Unlink the given image from the linked control point.
* If an image is unlinked from a control point, the function needs to check whether the control point is still linked to any other image:
* - if not, the control point instance will be removed (has to be removed since a control point with no associated image is not allowed).
* - if so, the function has to make sure that the control point instance is shortened to its minimum time period (e.g. moving the end point to an earlier date).
*
* @param imageNode The current case identifier and node identifier is extracted from the given image data node, which contains DICOM information about the case and the node.
*/
void UnlinkImageFromControlPoint(const DataNode* imageNode);
/**
* @brief Add an examination period instance to the set of already existing examination periods - with no connection to a specific control point.
*
* @pre The UID of the examination period must not already exist for an examination period instance.
* @throw SemanticRelationException, if the UID of the examination period already exists for a examination period instance (this can be checked via 'InstanceExists').
*
* @param caseID The current case identifier is defined by the given string.
* @param examinationPeriod The examination period to add.
*/
void AddExaminationPeriod(const SemanticTypes::CaseID& caseID, const SemanticTypes::ExaminationPeriod& examinationPeriod);
/**
* @brief Rename an already existing examination period instance.
*
* @pre The UID of the examination period has to exist for an examination period instance.
* @throw SemanticRelationException, if the UID of the examination period does not exist for an examination period instance (this can be checked via 'InstanceExists').
*
- * @param caseID The current case identifier is defined by the given string.
- * @param lesion The examination period instance that renames an existing examination period.
+ * @param caseID The current case identifier is defined by the given string.
+ * @param examinationPeriod The examination period instance that renames an existing examination period.
*/
void RenameExaminationPeriod(const SemanticTypes::CaseID& caseID, const SemanticTypes::ExaminationPeriod& examinationPeriod);
/**
* @brief Add a control point to the vector of control point UIDs of an existing examination period.
*
* @pre The UID of the control point has to exist for a control point instance.
* @throw SemanticRelationException, if the UID of the control point does not exists for a control point instance (this can be checked via 'InstanceExists').
* @pre The UID of the examination period must not already exist for an examination period instance.
* @throw SemanticRelationException, if the UID of the examination period already exists for a examination period instance (this can be checked via 'InstanceExists').
*
* @param caseID The current case identifier is defined by the given string.
* @param controlPoint The control point instance to add to the examination period.
* @param examinationPeriod The examination period to which the control point should be added.
*/
void AddControlPointToExaminationPeriod(const SemanticTypes::CaseID& caseID, const SemanticTypes::ControlPoint& controlPoint, const SemanticTypes::ExaminationPeriod& examinationPeriod);
/**
* @brief Set (and possibly overwrite) the information type of the given image.
* An already associated information type might be removed if is not referenced by any other image:
*
* @pre The given image data node has to be valid (!nullptr).
* @throw SemanticRelationException, if the given image data node is invalid (==nullptr).
* @post If the information type instance did not exist before, it is now added.
*
* @param imageNode The current case identifier is extracted from the given image data node, which contains DICOM information about the case.
* @param informationType An information type that identifies the corresponding information type instance.
*/
void SetInformationType(const DataNode* imageNode, const SemanticTypes::InformationType& informationType);
/**
* @brief Set the information type of the given image.
*
* @pre The given image data node has to be valid (!nullptr).
* @throw SemanticRelationException, if the given image data node is invalid (==nullptr).
* @post If the information type instance did not exist before, it is now added.
*
* @param imageNode The current case identifier is extracted from the given image data node, which contains DICOM information about the case.
* @param informationType An information type that identifies the corresponding information type instance.
*/
void AddInformationTypeToImage(const DataNode* imageNode, const SemanticTypes::InformationType& informationType);
/**
* @brief Remove the information type of the given image.
* If the information type is removed, the function needs to check whether the information type is referenced by any other image:
* - if not, the information type instance can be removed (has to be removed since an information type with no associated image is not allowed).
* - if so, the information type is just removed from the given image.
*
* @pre The given image data node has to be valid (!nullptr).
* @throw SemanticRelationException, if the given image data node is invalid (==nullptr).
*
* @param imageNode The current case identifier is extracted from the given image data node, which contains DICOM information about the case.
*/
void RemoveInformationTypeFromImage(const DataNode* imageNode);
private:
/**
* @brief A vector that stores the currently registered observer of this observable subject.
*/
static std::vector<mitk::ISemanticRelationsObserver*> m_ObserverVector;
/**
* @brief The class notifies (updates) the observer with a given case ID.
* The view's caseID was set before in the GUI. The parts of the view that observe changes in the semantic relations are only updated,
* if the given case ID is equal to the observer's current caseID and thus the observer currently shows the semantic information of the given case.
*
* @param caseID The caseID that identifies the currently active patient / case.
*/
void NotifyObserver(const mitk::SemanticTypes::CaseID& caseID) const override;
/**
* @brief Remove all control points from the storage that are not referenced by any image anymore.
* This might happen if an image has been removed (and unlinked from the corresponding control point)
* or if the user sets a new control point for an image manually in the GUI.
*
* @param caseID The current case identifier is defined by the given string.
*/
void ClearControlPoints(const SemanticTypes::CaseID& caseID);
};
} // namespace mitk
#endif // MITKSEMANTICRELATIONSINTEGRATION_H
diff --git a/Modules/SemanticRelationsUI/include/QmitkLesionTreeItem.h b/Modules/SemanticRelationsUI/include/QmitkLesionTreeItem.h
index efbc11c930..08d5ccc63b 100644
--- a/Modules/SemanticRelationsUI/include/QmitkLesionTreeItem.h
+++ b/Modules/SemanticRelationsUI/include/QmitkLesionTreeItem.h
@@ -1,120 +1,120 @@
/*============================================================================
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 QMITKLESIONTREEITEM_H
#define QMITKLESIONTREEITEM_H
// mitk semantic relations UI
#include "mitkLesionData.h"
// mitk semantic relations
#include <mitkSemanticTypes.h>
// qt
#include <QVariant>
// c++
#include <memory>
#include <vector>
/*
* @brief This class is used by custom tree models to create their tree items.
* It provides functions to traverse and modify the tree.
* Additionally it holds some 'LesionData' that is used to display lesion properties inside a tree view.
*/
class QmitkLesionTreeItem : public std::enable_shared_from_this<QmitkLesionTreeItem>
{
public:
using ChildPointer = std::shared_ptr<QmitkLesionTreeItem>;
using ChildConstPointer = std::shared_ptr<const QmitkLesionTreeItem>;
using ParentPointer = std::weak_ptr<QmitkLesionTreeItem>;
QmitkLesionTreeItem(mitk::LesionData lesionData = mitk::LesionData());
/**
* @brief Return the child of this item at a specific position.
*
* @param row Determines the position of a child item to return.
*
* @return The child of this item at a specific position.
*/
ChildPointer GetChildInRow(int row) const { return m_Children.at(row); };
/**
* @brief Return the parent item.
*
* @return The parent item as std::weak_ptr.
*/
ParentPointer GetParent() const { return m_ParentItem; };
/**
* @brief Set the parent item of this item.
*
* @param parent The new parent item of this item.
*/
void SetParent(ParentPointer parent);
/**
* @brief Return the item data, which contains ...
*
* see <code>mitk::LesionItemData</code>
*/
mitk::LesionData& GetData() { return m_ItemData; };
/**
* @brief Get the row of this item relative to its parent item using 'GetRowOfChild'.
*
* @return The row of this item relative to its parent item.
*/
int GetRow() const;
/**
* @brief Get the row of the given child item relative to this item.
*
* @param child The child item whose row is to be determined.
*
* @return The row of the child item.
*/
int GetRowOfChild(ChildConstPointer child) const;
/**
* @brief Return the number of child items.
*
* @return Number of child items.
*/
size_t ChildCount() const { return m_Children.size(); };
/**
* @brief Add a new child to the list of children of this item if it is not already a child item.
*
* @param child The child item to add to this item.
*/
void AddChild(ChildPointer child);
/**
* @brief Remove a child from the list of children of this item.
*
* @param child The child item to remove from this item.
*/
void RemoveChild(ChildPointer child);
/**
* @brief Set the item data of this item.
*
- * @param value LesionData that provides information about this item.
+ * @param lesionData LesionData that provides information about this item.
*/
void SetData(const mitk::LesionData& lesionData);
private:
ParentPointer m_ParentItem;
std::vector<ChildPointer> m_Children;
mitk::LesionData m_ItemData;
};
Q_DECLARE_METATYPE(QmitkLesionTreeItem)
Q_DECLARE_METATYPE(QmitkLesionTreeItem*)
#endif // QMITKLESIONTREEITEM_H
diff --git a/Modules/SurfaceInterpolation/Testing/mitkCreateDistanceImageFromSurfaceFilterTest.cpp b/Modules/SurfaceInterpolation/Testing/mitkCreateDistanceImageFromSurfaceFilterTest.cpp
index e158c5f96a..7dd841769e 100644
--- a/Modules/SurfaceInterpolation/Testing/mitkCreateDistanceImageFromSurfaceFilterTest.cpp
+++ b/Modules/SurfaceInterpolation/Testing/mitkCreateDistanceImageFromSurfaceFilterTest.cpp
@@ -1,132 +1,133 @@
/*============================================================================
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 <mitkComputeContourSetNormalsFilter.h>
#include <mitkCreateDistanceImageFromSurfaceFilter.h>
#include <mitkIOUtil.h>
#include <mitkImageAccessByItk.h>
#include <mitkTestFixture.h>
#include <mitkTestingMacros.h>
#include <vtkDebugLeaks.h>
class mitkCreateDistanceImageFromSurfaceFilterTestSuite : public mitk::TestFixture
{
CPPUNIT_TEST_SUITE(mitkCreateDistanceImageFromSurfaceFilterTestSuite);
vtkDebugLeaks::SetExitError(0);
- MITK_TEST(TestCreateDistanceImageForLiver);
+ // Basically tests the same as the other test below
+ // MITK_TEST(TestCreateDistanceImageForLiver);
MITK_TEST(TestCreateDistanceImageForTube);
CPPUNIT_TEST_SUITE_END();
private:
std::vector<mitk::Surface::Pointer> contourList;
public:
void setUp() override {}
template <typename TPixel, unsigned int VImageDimension>
void GetImageBase(itk::Image<TPixel, VImageDimension> *input, itk::ImageBase<3>::Pointer &result)
{
result->Graft(input);
}
// Interpolate the shape of a liver
void TestCreateDistanceImageForLiver()
{
// That's the number of available liver contours in MITK-Data
unsigned int NUMBER_OF_LIVER_CONTOURS = 18;
for (unsigned int i = 0; i <= NUMBER_OF_LIVER_CONTOURS; ++i)
{
std::stringstream s;
s << "SurfaceInterpolation/InterpolateLiver/LiverContourWithNormals_";
s << i;
s << ".vtk";
mitk::Surface::Pointer contour = mitk::IOUtil::Load<mitk::Surface>(GetTestDataFilePath(s.str()));
contourList.push_back(contour);
}
mitk::Image::Pointer segmentationImage =
mitk::IOUtil::Load<mitk::Image>(GetTestDataFilePath("SurfaceInterpolation/Reference/LiverSegmentation.nrrd"));
mitk::ComputeContourSetNormalsFilter::Pointer m_NormalsFilter = mitk::ComputeContourSetNormalsFilter::New();
mitk::CreateDistanceImageFromSurfaceFilter::Pointer m_InterpolateSurfaceFilter =
mitk::CreateDistanceImageFromSurfaceFilter::New();
itk::ImageBase<3>::Pointer itkImage = itk::ImageBase<3>::New();
AccessFixedDimensionByItk_1(segmentationImage, GetImageBase, 3, itkImage);
m_InterpolateSurfaceFilter->SetReferenceImage(itkImage.GetPointer());
for (unsigned int j = 0; j < contourList.size(); j++)
{
m_NormalsFilter->SetInput(j, contourList.at(j));
m_InterpolateSurfaceFilter->SetInput(j, m_NormalsFilter->GetOutput(j));
}
m_InterpolateSurfaceFilter->Update();
mitk::Image::Pointer liverDistanceImage = m_InterpolateSurfaceFilter->GetOutput();
CPPUNIT_ASSERT(liverDistanceImage.IsNotNull());
mitk::Image::Pointer liverDistanceImageReference =
mitk::IOUtil::Load<mitk::Image>(GetTestDataFilePath("SurfaceInterpolation/Reference/LiverDistanceImage.nrrd"));
CPPUNIT_ASSERT_MESSAGE("LiverDistanceImages are not equal!",
mitk::Equal(*(liverDistanceImageReference), *(liverDistanceImage), 0.0001, true));
}
void TestCreateDistanceImageForTube()
{
// That's the number of available contours with holes in MITK-Data
unsigned int NUMBER_OF_TUBE_CONTOURS = 5;
for (unsigned int i = 0; i < NUMBER_OF_TUBE_CONTOURS; ++i)
{
std::stringstream s;
s << "SurfaceInterpolation/InterpolateWithHoles/ContourWithHoles_";
s << i;
s << ".vtk";
mitk::Surface::Pointer contour = mitk::IOUtil::Load<mitk::Surface>(GetTestDataFilePath(s.str()));
contourList.push_back(contour);
}
mitk::Image::Pointer segmentationImage =
mitk::IOUtil::Load<mitk::Image>(GetTestDataFilePath("SurfaceInterpolation/Reference/SegmentationWithHoles.nrrd"));
mitk::ComputeContourSetNormalsFilter::Pointer m_NormalsFilter = mitk::ComputeContourSetNormalsFilter::New();
mitk::CreateDistanceImageFromSurfaceFilter::Pointer m_InterpolateSurfaceFilter =
mitk::CreateDistanceImageFromSurfaceFilter::New();
m_NormalsFilter->SetSegmentationBinaryImage(segmentationImage);
itk::ImageBase<3>::Pointer itkImage = itk::ImageBase<3>::New();
AccessFixedDimensionByItk_1(segmentationImage, GetImageBase, 3, itkImage);
m_InterpolateSurfaceFilter->SetReferenceImage(itkImage.GetPointer());
for (unsigned int j = 0; j < contourList.size(); j++)
{
m_NormalsFilter->SetInput(j, contourList.at(j));
m_InterpolateSurfaceFilter->SetInput(j, m_NormalsFilter->GetOutput(j));
}
m_InterpolateSurfaceFilter->Update();
mitk::Image::Pointer holeDistanceImage = m_InterpolateSurfaceFilter->GetOutput();
CPPUNIT_ASSERT(holeDistanceImage.IsNotNull());
mitk::Image::Pointer holesDistanceImageReference =
mitk::IOUtil::Load<mitk::Image>(GetTestDataFilePath("SurfaceInterpolation/Reference/HolesDistanceImage.nrrd"));
CPPUNIT_ASSERT_MESSAGE("HolesDistanceImages are not equal!",
mitk::Equal(*(holesDistanceImageReference), *(holeDistanceImage), 0.0001, true));
}
};
MITK_TEST_SUITE_REGISTRATION(mitkCreateDistanceImageFromSurfaceFilter)
diff --git a/Modules/SurfaceInterpolation/mitkComputeContourSetNormalsFilter.cpp b/Modules/SurfaceInterpolation/mitkComputeContourSetNormalsFilter.cpp
index 5793bd362f..7589742cdf 100644
--- a/Modules/SurfaceInterpolation/mitkComputeContourSetNormalsFilter.cpp
+++ b/Modules/SurfaceInterpolation/mitkComputeContourSetNormalsFilter.cpp
@@ -1,343 +1,343 @@
/*============================================================================
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 "mitkComputeContourSetNormalsFilter.h"
#include "mitkIOUtil.h"
#include "mitkImagePixelReadAccessor.h"
mitk::ComputeContourSetNormalsFilter::ComputeContourSetNormalsFilter()
: m_SegmentationBinaryImage(nullptr),
m_MaxSpacing(5),
m_NegativeNormalCounter(0),
m_PositiveNormalCounter(0),
m_UseProgressBar(false),
m_ProgressStepSize(1)
{
mitk::Surface::Pointer output = mitk::Surface::New();
this->SetNthOutput(0, output.GetPointer());
}
mitk::ComputeContourSetNormalsFilter::~ComputeContourSetNormalsFilter()
{
}
void mitk::ComputeContourSetNormalsFilter::GenerateData()
{
unsigned int numberOfInputs = this->GetNumberOfIndexedInputs();
// Iterating over each input
for (unsigned int i = 0; i < numberOfInputs; i++)
{
// Getting the inputs polydata and polygons
auto *currentSurface = this->GetInput(i);
vtkPolyData *polyData = currentSurface->GetVtkPolyData();
vtkSmartPointer<vtkCellArray> existingPolys = polyData->GetPolys();
vtkSmartPointer<vtkPoints> existingPoints = polyData->GetPoints();
existingPolys->InitTraversal();
- vtkIdType *cell(nullptr);
+ const vtkIdType *cell(nullptr);
vtkIdType cellSize(0);
// The array that contains all the vertex normals of the current polygon
vtkSmartPointer<vtkDoubleArray> normals = vtkSmartPointer<vtkDoubleArray>::New();
normals->SetNumberOfComponents(3);
normals->SetNumberOfTuples(polyData->GetNumberOfPoints());
// If the current contour is an inner contour then the direction is -1
// A contour lies inside another one if the pixel values in the direction of the normal is 1
m_NegativeNormalCounter = 0;
m_PositiveNormalCounter = 0;
vtkIdType offSet(0);
// Iterating over each polygon
for (existingPolys->InitTraversal(); existingPolys->GetNextCell(cellSize, cell);)
{
if (cellSize < 3)
continue;
// First we calculate the current polygon's normal
double polygonNormal[3] = {0.0};
double p1[3];
double p2[3];
double v1[3];
double v2[3];
existingPoints->GetPoint(cell[0], p1);
unsigned int index = cellSize * 0.5;
existingPoints->GetPoint(cell[index], p2);
v1[0] = p2[0] - p1[0];
v1[1] = p2[1] - p1[1];
v1[2] = p2[2] - p1[2];
for (vtkIdType k = 2; k < cellSize; k++)
{
index = cellSize * 0.25;
existingPoints->GetPoint(cell[index], p1);
index = cellSize * 0.75;
existingPoints->GetPoint(cell[index], p2);
v2[0] = p2[0] - p1[0];
v2[1] = p2[1] - p1[1];
v2[2] = p2[2] - p1[2];
vtkMath::Cross(v1, v2, polygonNormal);
if (vtkMath::Norm(polygonNormal) != 0)
break;
}
vtkMath::Normalize(polygonNormal);
// Now we start computing the normal for each vertex
double vertexNormalTemp[3];
existingPoints->GetPoint(cell[0], p1);
existingPoints->GetPoint(cell[1], p2);
v1[0] = p2[0] - p1[0];
v1[1] = p2[1] - p1[1];
v1[2] = p2[2] - p1[2];
vtkMath::Cross(v1, polygonNormal, vertexNormalTemp);
vtkMath::Normalize(vertexNormalTemp);
double vertexNormal[3];
for (vtkIdType j = 0; j < cellSize - 2; j++)
{
existingPoints->GetPoint(cell[j + 1], p1);
existingPoints->GetPoint(cell[j + 2], p2);
v1[0] = p2[0] - p1[0];
v1[1] = p2[1] - p1[1];
v1[2] = p2[2] - p1[2];
vtkMath::Cross(v1, polygonNormal, vertexNormal);
vtkMath::Normalize(vertexNormal);
double finalNormal[3];
finalNormal[0] = (vertexNormal[0] + vertexNormalTemp[0]) * 0.5;
finalNormal[1] = (vertexNormal[1] + vertexNormalTemp[1]) * 0.5;
finalNormal[2] = (vertexNormal[2] + vertexNormalTemp[2]) * 0.5;
vtkMath::Normalize(finalNormal);
// Here we determine the direction of the normal
if (m_SegmentationBinaryImage)
{
Point3D worldCoord;
worldCoord[0] = p1[0] + finalNormal[0] * m_MaxSpacing;
worldCoord[1] = p1[1] + finalNormal[1] * m_MaxSpacing;
worldCoord[2] = p1[2] + finalNormal[2] * m_MaxSpacing;
double val = 0.0;
itk::Index<3> idx;
m_SegmentationBinaryImage->GetGeometry()->WorldToIndex(worldCoord, idx);
try
{
if (m_SegmentationBinaryImage->GetImageDescriptor()
->GetChannelDescriptor()
.GetPixelType()
.GetComponentType() == itk::ImageIOBase::UCHAR)
{
mitk::ImagePixelReadAccessor<unsigned char> readAccess(m_SegmentationBinaryImage);
val = readAccess.GetPixelByIndexSafe(idx);
}
else if (m_SegmentationBinaryImage->GetImageDescriptor()
->GetChannelDescriptor()
.GetPixelType()
.GetComponentType() == itk::ImageIOBase::USHORT)
{
mitk::ImagePixelReadAccessor<unsigned short> readAccess(m_SegmentationBinaryImage);
val = readAccess.GetPixelByIndexSafe(idx);
}
}
catch (const mitk::Exception &e)
{
// If value is outside the image's region ignore it
MITK_WARN << e.what();
}
if (val == 0.0)
{
// MITK_INFO << "val equals zero.";
++m_PositiveNormalCounter;
}
else
{
// MITK_INFO << "val does not equal zero.";
++m_NegativeNormalCounter;
}
}
vertexNormalTemp[0] = vertexNormal[0];
vertexNormalTemp[1] = vertexNormal[1];
vertexNormalTemp[2] = vertexNormal[2];
vtkIdType id = cell[j + 1];
normals->SetTuple(id, finalNormal);
}
existingPoints->GetPoint(cell[0], p1);
existingPoints->GetPoint(cell[1], p2);
v1[0] = p2[0] - p1[0];
v1[1] = p2[1] - p1[1];
v1[2] = p2[2] - p1[2];
vtkMath::Cross(v1, polygonNormal, vertexNormal);
vtkMath::Normalize(vertexNormal);
vertexNormal[0] = (vertexNormal[0] + vertexNormalTemp[0]) * 0.5;
vertexNormal[1] = (vertexNormal[1] + vertexNormalTemp[1]) * 0.5;
vertexNormal[2] = (vertexNormal[2] + vertexNormalTemp[2]) * 0.5;
vtkMath::Normalize(vertexNormal);
vtkIdType id = cell[0];
normals->SetTuple(id, vertexNormal);
id = cell[cellSize - 1];
normals->SetTuple(id, vertexNormal);
if (m_NegativeNormalCounter > m_PositiveNormalCounter)
{
for (vtkIdType n = 0; n < cellSize; n++)
{
double normal[3];
normals->GetTuple(offSet + n, normal);
normal[0] = (-1) * normal[0];
normal[1] = (-1) * normal[1];
normal[2] = (-1) * normal[2];
normals->SetTuple(offSet + n, normal);
}
}
m_NegativeNormalCounter = 0;
m_PositiveNormalCounter = 0;
offSet += cellSize;
} // end for all cells
Surface::Pointer surface = this->GetOutput(i);
surface->GetVtkPolyData()->GetCellData()->SetNormals(normals);
} // end for all inputs
// Setting progressbar
if (this->m_UseProgressBar)
mitk::ProgressBar::GetInstance()->Progress(this->m_ProgressStepSize);
}
mitk::Surface::Pointer mitk::ComputeContourSetNormalsFilter::GetNormalsAsSurface()
{
// Just for debugging:
vtkSmartPointer<vtkPolyData> newPolyData = vtkSmartPointer<vtkPolyData>::New();
vtkSmartPointer<vtkCellArray> newLines = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkPoints> newPoints = vtkSmartPointer<vtkPoints>::New();
unsigned int idCounter(0);
// Debug end
for (unsigned int i = 0; i < this->GetNumberOfIndexedOutputs(); i++)
{
auto *currentSurface = this->GetOutput(i);
vtkPolyData *polyData = currentSurface->GetVtkPolyData();
vtkSmartPointer<vtkDoubleArray> currentCellNormals =
vtkDoubleArray::SafeDownCast(polyData->GetCellData()->GetNormals());
vtkSmartPointer<vtkCellArray> existingPolys = polyData->GetPolys();
vtkSmartPointer<vtkPoints> existingPoints = polyData->GetPoints();
existingPolys->InitTraversal();
- vtkIdType *cell(nullptr);
+ const vtkIdType *cell(nullptr);
vtkIdType cellSize(0);
for (existingPolys->InitTraversal(); existingPolys->GetNextCell(cellSize, cell);)
{
for (vtkIdType j = 0; j < cellSize; j++)
{
double currentNormal[3];
currentCellNormals->GetTuple(cell[j], currentNormal);
vtkSmartPointer<vtkLine> line = vtkSmartPointer<vtkLine>::New();
line->GetPointIds()->SetNumberOfIds(2);
double newPoint[3];
double p0[3];
existingPoints->GetPoint(cell[j], p0);
newPoint[0] = p0[0] + currentNormal[0];
newPoint[1] = p0[1] + currentNormal[1];
newPoint[2] = p0[2] + currentNormal[2];
line->GetPointIds()->SetId(0, idCounter);
newPoints->InsertPoint(idCounter, p0);
idCounter++;
line->GetPointIds()->SetId(1, idCounter);
newPoints->InsertPoint(idCounter, newPoint);
idCounter++;
newLines->InsertNextCell(line);
} // end for all points
} // end for all cells
} // end for all outputs
newPolyData->SetPoints(newPoints);
newPolyData->SetLines(newLines);
newPolyData->BuildCells();
mitk::Surface::Pointer surface = mitk::Surface::New();
surface->SetVtkPolyData(newPolyData);
return surface;
}
void mitk::ComputeContourSetNormalsFilter::SetMaxSpacing(double maxSpacing)
{
m_MaxSpacing = maxSpacing;
}
void mitk::ComputeContourSetNormalsFilter::GenerateOutputInformation()
{
Superclass::GenerateOutputInformation();
}
void mitk::ComputeContourSetNormalsFilter::Reset()
{
for (unsigned int i = 0; i < this->GetNumberOfIndexedInputs(); i++)
{
this->PopBackInput();
}
this->SetNumberOfIndexedInputs(0);
this->SetNumberOfIndexedOutputs(0);
mitk::Surface::Pointer output = mitk::Surface::New();
this->SetNthOutput(0, output.GetPointer());
}
void mitk::ComputeContourSetNormalsFilter::SetUseProgressBar(bool status)
{
this->m_UseProgressBar = status;
}
void mitk::ComputeContourSetNormalsFilter::SetProgressStepSize(unsigned int stepSize)
{
this->m_ProgressStepSize = stepSize;
}
diff --git a/Modules/SurfaceInterpolation/mitkCreateDistanceImageFromSurfaceFilter.cpp b/Modules/SurfaceInterpolation/mitkCreateDistanceImageFromSurfaceFilter.cpp
index 76bd92b724..87de1560a1 100644
--- a/Modules/SurfaceInterpolation/mitkCreateDistanceImageFromSurfaceFilter.cpp
+++ b/Modules/SurfaceInterpolation/mitkCreateDistanceImageFromSurfaceFilter.cpp
@@ -1,617 +1,617 @@
/*============================================================================
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 "mitkCreateDistanceImageFromSurfaceFilter.h"
#include "mitkImageCast.h"
#include "vtkCellArray.h"
#include "vtkCellData.h"
#include "vtkDoubleArray.h"
#include "vtkPolyData.h"
#include "vtkSmartPointer.h"
#include "itkImageRegionIteratorWithIndex.h"
#include "itkNeighborhoodIterator.h"
#include <queue>
void mitk::CreateDistanceImageFromSurfaceFilter::CreateEmptyDistanceImage()
{
// Determine the bounds of the input points in index- and world-coordinates
DistanceImageType::PointType minPointInWorldCoordinates, maxPointInWorldCoordinates;
DistanceImageType::IndexType minPointInIndexCoordinates, maxPointInIndexCoordinates;
DetermineBounds(
minPointInWorldCoordinates, maxPointInWorldCoordinates, minPointInIndexCoordinates, maxPointInIndexCoordinates);
// Calculate the extent of the region that contains all given points in MM.
// To do this, we take the difference between the maximal and minimal
// index-coordinates (must not be less than 1) and multiply it with the
// spacing of the reference-image.
Vector3D extentMM;
for (unsigned int dim = 0; dim < 3; ++dim)
{
extentMM[dim] = (std::abs(maxPointInIndexCoordinates[dim] - minPointInIndexCoordinates[dim])) *
m_ReferenceImage->GetSpacing()[dim];
}
/*
* Now create an empty distance image. The created image will always have the same number of pixels, independent from
* the original image (e.g. always consists of 500000 pixels) and will have an isotropic spacing.
* The spacing is calculated like the following:
* The image's volume = 500000 Pixels = extentX*spacing*extentY*spacing*extentZ*spacing
* So the spacing is: spacing = ( extentX*extentY*extentZ / 500000 )^(1/3)
*/
double basis = (extentMM[0] * extentMM[1] * extentMM[2]) / m_DistanceImageVolume;
double exponent = 1.0 / 3.0;
m_DistanceImageSpacing = pow(basis, exponent);
// calculate the number of pixels of the distance image for each direction
unsigned int numberOfXPixel = extentMM[0] / m_DistanceImageSpacing;
unsigned int numberOfYPixel = extentMM[1] / m_DistanceImageSpacing;
unsigned int numberOfZPixel = extentMM[2] / m_DistanceImageSpacing;
// We increase the sizeOfRegion by 4 as we decrease the origin by 2 later.
// This expansion of the region is necessary to achieve a complete
// interpolation.
DistanceImageType::SizeType sizeOfRegion;
sizeOfRegion[0] = numberOfXPixel + 8;
sizeOfRegion[1] = numberOfYPixel + 8;
sizeOfRegion[2] = numberOfZPixel + 8;
// The region starts at index 0,0,0
DistanceImageType::IndexType initialOriginAsIndex;
initialOriginAsIndex.Fill(0);
DistanceImageType::PointType originAsWorld = minPointInWorldCoordinates;
DistanceImageType::RegionType lpRegion;
lpRegion.SetSize(sizeOfRegion);
lpRegion.SetIndex(initialOriginAsIndex);
// We initialize the itk::Image with
// * origin and direction to have it correctly placed and rotated in the world
// * the largest possible region to set the extent to be calculated
// * the isotropic spacing that we have calculated above
m_DistanceImageITK = DistanceImageType::New();
m_DistanceImageITK->SetOrigin(originAsWorld);
m_DistanceImageITK->SetDirection(m_ReferenceImage->GetDirection());
m_DistanceImageITK->SetRegions(lpRegion);
m_DistanceImageITK->SetSpacing(m_DistanceImageSpacing);
m_DistanceImageITK->Allocate();
// First of all the image is initialized with the value 10*m_DistanceImageSpacing for each pixel
m_DistanceImageDefaultBufferValue = 10 * m_DistanceImageSpacing;
m_DistanceImageITK->FillBuffer(m_DistanceImageDefaultBufferValue);
// Now we move the origin of the distanceImage 2 index-Coordinates
// in all directions
DistanceImageType::IndexType originAsIndex;
m_DistanceImageITK->TransformPhysicalPointToIndex(originAsWorld, originAsIndex);
originAsIndex[0] -= 2;
originAsIndex[1] -= 2;
originAsIndex[2] -= 2;
m_DistanceImageITK->TransformIndexToPhysicalPoint(originAsIndex, originAsWorld);
m_DistanceImageITK->SetOrigin(originAsWorld);
}
mitk::CreateDistanceImageFromSurfaceFilter::CreateDistanceImageFromSurfaceFilter()
: m_DistanceImageSpacing(0.0), m_DistanceImageDefaultBufferValue(0.0)
{
m_DistanceImageVolume = 50000;
this->m_UseProgressBar = false;
this->m_ProgressStepSize = 5;
mitk::Image::Pointer output = mitk::Image::New();
this->SetNthOutput(0, output.GetPointer());
}
mitk::CreateDistanceImageFromSurfaceFilter::~CreateDistanceImageFromSurfaceFilter()
{
}
void mitk::CreateDistanceImageFromSurfaceFilter::GenerateData()
{
this->PreprocessContourPoints();
this->CreateEmptyDistanceImage();
// First of all we have to build the equation-system from the existing contour-edge-points
this->CreateSolutionMatrixAndFunctionValues();
if (this->m_UseProgressBar)
mitk::ProgressBar::GetInstance()->Progress(1);
m_Weights = m_SolutionMatrix.partialPivLu().solve(m_FunctionValues);
if (this->m_UseProgressBar)
mitk::ProgressBar::GetInstance()->Progress(2);
// The last step is to create the distance map with the interpolated distance function
this->FillDistanceImage();
if (this->m_UseProgressBar)
mitk::ProgressBar::GetInstance()->Progress(2);
m_Centers.clear();
m_Normals.clear();
}
void mitk::CreateDistanceImageFromSurfaceFilter::PreprocessContourPoints()
{
unsigned int numberOfInputs = this->GetNumberOfIndexedInputs();
if (numberOfInputs == 0)
{
MITK_ERROR << "mitk::CreateDistanceImageFromSurfaceFilter: No input available. Please set an input!" << std::endl;
itkExceptionMacro("mitk::CreateDistanceImageFromSurfaceFilter: No input available. Please set an input!");
return;
}
// First of all we have to extract the nomals and the surface points.
// Duplicated points can be eliminated
vtkSmartPointer<vtkPolyData> polyData;
vtkSmartPointer<vtkDoubleArray> currentCellNormals;
vtkSmartPointer<vtkCellArray> existingPolys;
vtkSmartPointer<vtkPoints> existingPoints;
double p[3];
PointType currentPoint;
PointType normal;
for (unsigned int i = 0; i < numberOfInputs; i++)
{
auto currentSurface = this->GetInput(i);
polyData = currentSurface->GetVtkPolyData();
if (polyData->GetNumberOfPolys() == 0)
{
MITK_INFO << "mitk::CreateDistanceImageFromSurfaceFilter: No input-polygons available. Please be sure the input "
"surface consists of polygons!"
<< std::endl;
}
currentCellNormals = vtkDoubleArray::SafeDownCast(polyData->GetCellData()->GetNormals());
existingPolys = polyData->GetPolys();
existingPoints = polyData->GetPoints();
existingPolys->InitTraversal();
- vtkIdType *cell(nullptr);
+ const vtkIdType *cell(nullptr);
vtkIdType cellSize(0);
for (existingPolys->InitTraversal(); existingPolys->GetNextCell(cellSize, cell);)
{
for (vtkIdType j = 0; j < cellSize; j++)
{
existingPoints->GetPoint(cell[j], p);
currentPoint.copy_in(p);
int count = std::count(m_Centers.begin(), m_Centers.end(), currentPoint);
if (count == 0)
{
double currentNormal[3];
currentCellNormals->GetTuple(cell[j], currentNormal);
normal.copy_in(currentNormal);
m_Normals.push_back(normal);
m_Centers.push_back(currentPoint);
}
} // end for all points
} // end for all cells
} // end for all outputs
}
void mitk::CreateDistanceImageFromSurfaceFilter::CreateSolutionMatrixAndFunctionValues()
{
// For we can now calculate the exact size of the centers we initialize the data structures
unsigned int numberOfCenters = m_Centers.size();
m_Centers.reserve(numberOfCenters * 3);
m_FunctionValues.resize(numberOfCenters * 3);
m_FunctionValues.fill(0);
PointType currentPoint;
PointType normal;
// Create inner points
for (unsigned int i = 0; i < numberOfCenters; i++)
{
currentPoint = m_Centers.at(i);
normal = m_Normals.at(i);
currentPoint[0] = currentPoint[0] - normal[0] * m_DistanceImageSpacing;
currentPoint[1] = currentPoint[1] - normal[1] * m_DistanceImageSpacing;
currentPoint[2] = currentPoint[2] - normal[2] * m_DistanceImageSpacing;
m_Centers.push_back(currentPoint);
m_FunctionValues[numberOfCenters + i] = -m_DistanceImageSpacing;
}
// Create outer points
for (unsigned int i = 0; i < numberOfCenters; i++)
{
currentPoint = m_Centers.at(i);
normal = m_Normals.at(i);
currentPoint[0] = currentPoint[0] + normal[0] * m_DistanceImageSpacing;
currentPoint[1] = currentPoint[1] + normal[1] * m_DistanceImageSpacing;
currentPoint[2] = currentPoint[2] + normal[2] * m_DistanceImageSpacing;
m_Centers.push_back(currentPoint);
m_FunctionValues[numberOfCenters * 2 + i] = m_DistanceImageSpacing;
}
// Now we have created all centers and all function values. Next step is to create the solution matrix
numberOfCenters = m_Centers.size();
m_SolutionMatrix.resize(numberOfCenters, numberOfCenters);
m_Weights.resize(numberOfCenters);
PointType p1;
PointType p2;
double norm;
for (unsigned int i = 0; i < numberOfCenters; i++)
{
for (unsigned int j = 0; j < numberOfCenters; j++)
{
// Calculate the RBF value. Currently using Phi(r) = r with r is the euclidian distance between two points
p1 = m_Centers.at(i);
p2 = m_Centers.at(j);
p1 = p1 - p2;
norm = p1.two_norm();
m_SolutionMatrix(i, j) = norm;
}
}
}
void mitk::CreateDistanceImageFromSurfaceFilter::FillDistanceImage()
{
/*
* Now we must calculate the distance for each pixel. But instead of calculating the distance value
* for all of the image's pixels we proceed similar to the region growing algorithm:
*
* 1. Take the first pixel from the narrowband_point_list and calculate the distance for each neighbor (6er)
* 2. If the current index's distance value is below a certain threshold push it into the list
* 3. Next iteration take the next index from the list and originAsIndex with 1. again
*
* This is done until the narrowband_point_list is empty.
*/
typedef itk::ImageRegionIteratorWithIndex<DistanceImageType> ImageIterator;
typedef itk::NeighborhoodIterator<DistanceImageType> NeighborhoodImageIterator;
std::queue<DistanceImageType::IndexType> narrowbandPoints;
PointType currentPoint = m_Centers.at(0);
double distance = this->CalculateDistanceValue(currentPoint);
// create itk::Point from vnl_vector
DistanceImageType::PointType currentPointAsPoint;
currentPointAsPoint[0] = currentPoint[0];
currentPointAsPoint[1] = currentPoint[1];
currentPointAsPoint[2] = currentPoint[2];
// Transform the input point in world-coordinates to index-coordinates
DistanceImageType::IndexType currentIndex;
m_DistanceImageITK->TransformPhysicalPointToIndex(currentPointAsPoint, currentIndex);
assert(
m_DistanceImageITK->GetLargestPossibleRegion().IsInside(currentIndex)); // we are quite certain this should hold
narrowbandPoints.push(currentIndex);
m_DistanceImageITK->SetPixel(currentIndex, distance);
NeighborhoodImageIterator::RadiusType radius;
radius.Fill(1);
NeighborhoodImageIterator nIt(radius, m_DistanceImageITK, m_DistanceImageITK->GetLargestPossibleRegion());
unsigned int relativeNbIdx[] = {4, 10, 12, 14, 16, 22};
bool isInBounds = false;
while (!narrowbandPoints.empty())
{
nIt.SetLocation(narrowbandPoints.front());
narrowbandPoints.pop();
unsigned int *relativeNb = &relativeNbIdx[0];
for (int i = 0; i < 6; i++)
{
nIt.GetPixel(*relativeNb, isInBounds);
if (isInBounds && nIt.GetPixel(*relativeNb) == m_DistanceImageDefaultBufferValue)
{
currentIndex = nIt.GetIndex(*relativeNb);
// Transform the currently checked point from index-coordinates to
// world-coordinates
m_DistanceImageITK->TransformIndexToPhysicalPoint(currentIndex, currentPointAsPoint);
// create a vnl_vector
currentPoint[0] = currentPointAsPoint[0];
currentPoint[1] = currentPointAsPoint[1];
currentPoint[2] = currentPointAsPoint[2];
// and check the distance
distance = this->CalculateDistanceValue(currentPoint);
if (std::fabs(distance) <= m_DistanceImageSpacing * 2)
{
nIt.SetPixel(*relativeNb, distance);
narrowbandPoints.push(currentIndex);
}
}
relativeNb++;
}
}
ImageIterator imgRegionIterator(m_DistanceImageITK, m_DistanceImageITK->GetLargestPossibleRegion());
imgRegionIterator.GoToBegin();
double prevPixelVal = 1;
DistanceImageType::IndexType _size;
_size.Fill(-1);
_size += m_DistanceImageITK->GetLargestPossibleRegion().GetSize();
// Set every pixel inside the surface to -m_DistanceImageDefaultBufferValue except the edge point (so that the
// received surface is closed)
while (!imgRegionIterator.IsAtEnd())
{
if (imgRegionIterator.Get() == m_DistanceImageDefaultBufferValue && prevPixelVal < 0)
{
while (imgRegionIterator.Get() == m_DistanceImageDefaultBufferValue)
{
if (imgRegionIterator.GetIndex()[0] == _size[0] || imgRegionIterator.GetIndex()[1] == _size[1] ||
imgRegionIterator.GetIndex()[2] == _size[2] || imgRegionIterator.GetIndex()[0] == 0U ||
imgRegionIterator.GetIndex()[1] == 0U || imgRegionIterator.GetIndex()[2] == 0U)
{
imgRegionIterator.Set(m_DistanceImageDefaultBufferValue);
prevPixelVal = m_DistanceImageDefaultBufferValue;
++imgRegionIterator;
break;
}
else
{
imgRegionIterator.Set((-1) * m_DistanceImageDefaultBufferValue);
++imgRegionIterator;
prevPixelVal = (-1) * m_DistanceImageDefaultBufferValue;
}
}
}
else if (imgRegionIterator.GetIndex()[0] == _size[0] || imgRegionIterator.GetIndex()[1] == _size[1] ||
imgRegionIterator.GetIndex()[2] == _size[2] || imgRegionIterator.GetIndex()[0] == 0U ||
imgRegionIterator.GetIndex()[1] == 0U || imgRegionIterator.GetIndex()[2] == 0U)
{
imgRegionIterator.Set(m_DistanceImageDefaultBufferValue);
prevPixelVal = m_DistanceImageDefaultBufferValue;
++imgRegionIterator;
}
else
{
prevPixelVal = imgRegionIterator.Get();
++imgRegionIterator;
}
}
Image::Pointer resultImage = this->GetOutput();
// Cast the created distance-Image from itk::Image to the mitk::Image
// that is our output.
CastToMitkImage(m_DistanceImageITK, resultImage);
}
double mitk::CreateDistanceImageFromSurfaceFilter::CalculateDistanceValue(PointType p)
{
double distanceValue(0);
PointType p1;
PointType p2;
double norm;
CenterList::iterator centerIter;
unsigned int count(0);
for (centerIter = m_Centers.begin(); centerIter != m_Centers.end(); centerIter++)
{
p1 = *centerIter;
p2 = p - p1;
norm = p2.two_norm();
distanceValue = distanceValue + (norm * m_Weights[count]);
++count;
}
return distanceValue;
}
void mitk::CreateDistanceImageFromSurfaceFilter::GenerateOutputInformation()
{
}
void mitk::CreateDistanceImageFromSurfaceFilter::PrintEquationSystem()
{
std::stringstream out;
out << "Nummber of rows: " << m_SolutionMatrix.rows() << " ****** Number of columns: " << m_SolutionMatrix.cols()
<< endl;
out << "[ ";
for (int i = 0; i < m_SolutionMatrix.rows(); i++)
{
for (int j = 0; j < m_SolutionMatrix.cols(); j++)
{
out << m_SolutionMatrix(i, j) << " ";
}
out << ";" << endl;
}
out << " ]\n\n\n";
for (unsigned int i = 0; i < m_Centers.size(); i++)
{
out << m_Centers.at(i) << ";" << endl;
}
std::cout << "Equation system: \n\n\n" << out.str();
}
void mitk::CreateDistanceImageFromSurfaceFilter::SetInput(const mitk::Surface *surface)
{
this->SetInput(0, surface);
}
void mitk::CreateDistanceImageFromSurfaceFilter::SetInput(unsigned int idx, const mitk::Surface *surface)
{
if (this->GetInput(idx) != surface)
{
this->SetNthInput(idx, const_cast<mitk::Surface *>(surface));
this->Modified();
}
}
const mitk::Surface *mitk::CreateDistanceImageFromSurfaceFilter::GetInput()
{
if (this->GetNumberOfIndexedInputs() < 1)
return nullptr;
return static_cast<const mitk::Surface *>(this->ProcessObject::GetInput(0));
}
const mitk::Surface *mitk::CreateDistanceImageFromSurfaceFilter::GetInput(unsigned int idx)
{
if (this->GetNumberOfIndexedInputs() < 1)
return nullptr;
return static_cast<const mitk::Surface *>(this->ProcessObject::GetInput(idx));
}
void mitk::CreateDistanceImageFromSurfaceFilter::RemoveInputs(mitk::Surface *input)
{
DataObjectPointerArraySizeType nb = this->GetNumberOfIndexedInputs();
for (DataObjectPointerArraySizeType i = 0; i < nb; i++)
{
if (this->GetInput(i) == input)
{
this->RemoveInput(i);
return;
}
}
}
void mitk::CreateDistanceImageFromSurfaceFilter::Reset()
{
for (unsigned int i = 0; i < this->GetNumberOfIndexedInputs(); i++)
{
this->PopBackInput();
}
this->SetNumberOfIndexedInputs(0);
this->SetNumberOfIndexedOutputs(1);
mitk::Image::Pointer output = mitk::Image::New();
this->SetNthOutput(0, output.GetPointer());
}
void mitk::CreateDistanceImageFromSurfaceFilter::SetUseProgressBar(bool status)
{
this->m_UseProgressBar = status;
}
void mitk::CreateDistanceImageFromSurfaceFilter::SetProgressStepSize(unsigned int stepSize)
{
this->m_ProgressStepSize = stepSize;
}
void mitk::CreateDistanceImageFromSurfaceFilter::SetReferenceImage(itk::ImageBase<3>::Pointer referenceImage)
{
m_ReferenceImage = referenceImage;
}
void mitk::CreateDistanceImageFromSurfaceFilter::DetermineBounds(
DistanceImageType::PointType &minPointInWorldCoordinates,
DistanceImageType::PointType &maxPointInWorldCoordinates,
DistanceImageType::IndexType &minPointInIndexCoordinates,
DistanceImageType::IndexType &maxPointInIndexCoordinates)
{
PointType firstCenter = m_Centers.at(0);
DistanceImageType::PointType tmpPoint;
tmpPoint[0] = firstCenter[0];
tmpPoint[1] = firstCenter[1];
tmpPoint[2] = firstCenter[2];
// transform the first point from world-coordinates to index-coordinates
itk::ContinuousIndex<double, 3> tmpIndex;
m_ReferenceImage->TransformPhysicalPointToContinuousIndex(tmpPoint, tmpIndex);
// initialize the variables with this first point
DistanceImageType::IndexValueType xmin = tmpIndex[0];
DistanceImageType::IndexValueType ymin = tmpIndex[1];
DistanceImageType::IndexValueType zmin = tmpIndex[2];
DistanceImageType::IndexValueType xmax = tmpIndex[0];
DistanceImageType::IndexValueType ymax = tmpIndex[1];
DistanceImageType::IndexValueType zmax = tmpIndex[2];
// iterate over the rest of the points
auto centerIter = m_Centers.begin();
for (++centerIter; centerIter != m_Centers.end(); centerIter++)
{
tmpPoint[0] = (*centerIter)[0];
tmpPoint[1] = (*centerIter)[1];
tmpPoint[2] = (*centerIter)[2];
// transform each point from world-coordinates to index-coordinates
m_ReferenceImage->TransformPhysicalPointToContinuousIndex(tmpPoint, tmpIndex);
// and set the variables accordingly to find the minimum
// and maximum in all directions in index-coordinates
if (xmin > tmpIndex[0])
{
xmin = tmpIndex[0];
}
if (ymin > tmpIndex[1])
{
ymin = tmpIndex[1];
}
if (zmin > tmpIndex[2])
{
zmin = tmpIndex[2];
}
if (xmax < tmpIndex[0])
{
xmax = tmpIndex[0];
}
if (ymax < tmpIndex[1])
{
ymax = tmpIndex[1];
}
if (zmax < tmpIndex[2])
{
zmax = tmpIndex[2];
}
}
// put the found coordinates into Index-Points
minPointInIndexCoordinates[0] = xmin;
minPointInIndexCoordinates[1] = ymin;
minPointInIndexCoordinates[2] = zmin;
maxPointInIndexCoordinates[0] = xmax;
maxPointInIndexCoordinates[1] = ymax;
maxPointInIndexCoordinates[2] = zmax;
// and transform them into world-coordinates
m_ReferenceImage->TransformIndexToPhysicalPoint(minPointInIndexCoordinates, minPointInWorldCoordinates);
m_ReferenceImage->TransformIndexToPhysicalPoint(maxPointInIndexCoordinates, maxPointInWorldCoordinates);
}
diff --git a/Modules/SurfaceInterpolation/mitkReduceContourSetFilter.cpp b/Modules/SurfaceInterpolation/mitkReduceContourSetFilter.cpp
index d8b3ccf9f3..23d47270e0 100644
--- a/Modules/SurfaceInterpolation/mitkReduceContourSetFilter.cpp
+++ b/Modules/SurfaceInterpolation/mitkReduceContourSetFilter.cpp
@@ -1,519 +1,519 @@
/*============================================================================
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 "mitkReduceContourSetFilter.h"
mitk::ReduceContourSetFilter::ReduceContourSetFilter()
{
m_MaxSegmentLenght = 0;
m_StepSize = 10;
m_Tolerance = -1;
m_ReductionType = DOUGLAS_PEUCKER;
m_MaxSpacing = -1;
m_MinSpacing = -1;
this->m_UseProgressBar = false;
this->m_ProgressStepSize = 1;
m_NumberOfPointsAfterReduction = 0;
mitk::Surface::Pointer output = mitk::Surface::New();
this->SetNthOutput(0, output.GetPointer());
}
mitk::ReduceContourSetFilter::~ReduceContourSetFilter()
{
}
void mitk::ReduceContourSetFilter::SetInput(unsigned int idx, const mitk::Surface *surface)
{
this->SetNthInput(idx, const_cast<mitk::Surface *>(surface));
this->Modified();
}
void mitk::ReduceContourSetFilter::SetInput(const mitk::Surface *surface)
{
this->SetInput(0, surface);
}
void mitk::ReduceContourSetFilter::GenerateData()
{
unsigned int numberOfInputs = this->GetNumberOfIndexedInputs();
unsigned int numberOfOutputs(0);
vtkSmartPointer<vtkPolyData> newPolyData;
vtkSmartPointer<vtkCellArray> newPolygons;
vtkSmartPointer<vtkPoints> newPoints;
// For the purpose of evaluation
// unsigned int numberOfPointsBefore (0);
m_NumberOfPointsAfterReduction = 0;
for (unsigned int i = 0; i < numberOfInputs; i++)
{
auto *currentSurface = this->GetInput(i);
vtkSmartPointer<vtkPolyData> polyData = currentSurface->GetVtkPolyData();
newPolyData = vtkSmartPointer<vtkPolyData>::New();
newPolygons = vtkSmartPointer<vtkCellArray>::New();
newPoints = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkCellArray> existingPolys = polyData->GetPolys();
vtkSmartPointer<vtkPoints> existingPoints = polyData->GetPoints();
existingPolys->InitTraversal();
- vtkIdType *cell(nullptr);
+ const vtkIdType *cell(nullptr);
vtkIdType cellSize(0);
for (existingPolys->InitTraversal(); existingPolys->GetNextCell(cellSize, cell);)
{
bool incorporatePolygon =
this->CheckForIntersection(cell, cellSize, existingPoints, /*numberOfIntersections, intersectionPoints, */ i);
if (!incorporatePolygon)
continue;
vtkSmartPointer<vtkPolygon> newPolygon = vtkSmartPointer<vtkPolygon>::New();
if (m_ReductionType == NTH_POINT)
{
this->ReduceNumberOfPointsByNthPoint(cellSize, cell, existingPoints, newPolygon, newPoints);
if (newPolygon->GetPointIds()->GetNumberOfIds() != 0)
{
newPolygons->InsertNextCell(newPolygon);
}
}
else if (m_ReductionType == DOUGLAS_PEUCKER)
{
this->ReduceNumberOfPointsByDouglasPeucker(cellSize, cell, existingPoints, newPolygon, newPoints);
if (newPolygon->GetPointIds()->GetNumberOfIds() > 3)
{
newPolygons->InsertNextCell(newPolygon);
}
}
// Again for evaluation
// numberOfPointsBefore += cellSize;
m_NumberOfPointsAfterReduction += newPolygon->GetPointIds()->GetNumberOfIds();
}
if (newPolygons->GetNumberOfCells() != 0)
{
newPolyData->SetPolys(newPolygons);
newPolyData->SetPoints(newPoints);
newPolyData->BuildLinks();
this->SetNumberOfIndexedOutputs(numberOfOutputs + 1);
mitk::Surface::Pointer surface = mitk::Surface::New();
this->SetNthOutput(numberOfOutputs, surface.GetPointer());
surface->SetVtkPolyData(newPolyData);
numberOfOutputs++;
}
}
// MITK_INFO<<"Points before: "<<numberOfPointsBefore<<" ##### Points after: "<<numberOfPointsAfter;
this->SetNumberOfIndexedOutputs(numberOfOutputs);
if (numberOfOutputs == 0)
{
mitk::Surface::Pointer tmp_output = mitk::Surface::New();
tmp_output->SetVtkPolyData(vtkPolyData::New());
this->SetNthOutput(0, tmp_output.GetPointer());
}
// Setting progressbar
if (this->m_UseProgressBar)
mitk::ProgressBar::GetInstance()->Progress(this->m_ProgressStepSize);
}
void mitk::ReduceContourSetFilter::ReduceNumberOfPointsByNthPoint(
- vtkIdType cellSize, vtkIdType *cell, vtkPoints *points, vtkPolygon *reducedPolygon, vtkPoints *reducedPoints)
+ vtkIdType cellSize, const vtkIdType *cell, vtkPoints *points, vtkPolygon *reducedPolygon, vtkPoints *reducedPoints)
{
unsigned int newNumberOfPoints(0);
unsigned int mod = cellSize % m_StepSize;
if (mod == 0)
{
newNumberOfPoints = cellSize / m_StepSize;
}
else
{
newNumberOfPoints = ((cellSize - mod) / m_StepSize) + 1;
}
if (newNumberOfPoints <= 3)
{
return;
}
reducedPolygon->GetPointIds()->SetNumberOfIds(newNumberOfPoints);
reducedPolygon->GetPoints()->SetNumberOfPoints(newNumberOfPoints);
for (vtkIdType i = 0; i < cellSize; i++)
{
if (i % m_StepSize == 0)
{
double point[3];
points->GetPoint(cell[i], point);
vtkIdType id = reducedPoints->InsertNextPoint(point);
reducedPolygon->GetPointIds()->SetId(i / m_StepSize, id);
}
}
vtkIdType id = cell[0];
double point[3];
points->GetPoint(id, point);
id = reducedPoints->InsertNextPoint(point);
reducedPolygon->GetPointIds()->SetId(newNumberOfPoints - 1, id);
}
void mitk::ReduceContourSetFilter::ReduceNumberOfPointsByDouglasPeucker(
- vtkIdType cellSize, vtkIdType *cell, vtkPoints *points, vtkPolygon *reducedPolygon, vtkPoints *reducedPoints)
+ vtkIdType cellSize, const vtkIdType *cell, vtkPoints *points, vtkPolygon *reducedPolygon, vtkPoints *reducedPoints)
{
// If the cell is too small to obtain a reduced polygon with the given stepsize return
if (cellSize <= static_cast<vtkIdType>(m_StepSize * 3))
return;
/*
What we do now is (see the Douglas Peucker Algorithm):
1. Divide the current contour in two line segments (start - middle; middle - end), put them into the stack
2. Fetch first line segment and create the following vectors:
- v1 = (start;end)
- v2 = (start;currentPoint) -> for each point of the current line segment!
3. Calculate the distance from the currentPoint to v1:
a. Determine the length of the orthogonal projection of v2 to v1 by:
l = v2 * (normalized v1)
b. There a three possibilities for the distance then:
d = sqrt(lenght(v2)^2 - l^2) if l > 0 and l < length(v1)
d = lenght(v2-v1) if l > 0 and l > lenght(v1)
d = length(v2) if l < 0 because v2 is then pointing in a different direction than v1
4. Memorize the point with the biggest distance and create two new line segments with it at the end of the iteration
and put it into the stack
5. If the distance value D <= m_Tolerance, then add the start and end index and the corresponding points to the
reduced ones
*/
// First of all set tolerance if none is specified
if (m_Tolerance < 0)
{
if (m_MaxSpacing > 0)
{
m_Tolerance = m_MinSpacing;
}
else
{
m_Tolerance = 1.5;
}
}
std::stack<LineSegment> lineSegments;
// 1. Divide in line segments
LineSegment ls2;
ls2.StartIndex = cell[cellSize / 2];
ls2.EndIndex = cell[cellSize - 1];
lineSegments.push(ls2);
LineSegment ls1;
ls1.StartIndex = cell[0];
ls1.EndIndex = cell[cellSize / 2];
lineSegments.push(ls1);
LineSegment currentSegment;
double v1[3];
double v2[3];
double tempV[3];
double lenghtV1;
double currentMaxDistance(0);
vtkIdType currentMaxDistanceIndex(0);
double l;
double d;
vtkIdType pointId(0);
// Add the start index to the reduced points. From now on just the end indices will be added
pointId = reducedPoints->InsertNextPoint(points->GetPoint(cell[0]));
reducedPolygon->GetPointIds()->InsertNextId(pointId);
while (!lineSegments.empty())
{
currentSegment = lineSegments.top();
lineSegments.pop();
// 2. Create vectors
points->GetPoint(currentSegment.EndIndex, tempV);
points->GetPoint(currentSegment.StartIndex, v1);
v1[0] = tempV[0] - v1[0];
v1[1] = tempV[1] - v1[1];
v1[2] = tempV[2] - v1[2];
lenghtV1 = vtkMath::Norm(v1);
vtkMath::Normalize(v1);
int range = currentSegment.EndIndex - currentSegment.StartIndex;
for (int i = 1; i < abs(range); ++i)
{
points->GetPoint(currentSegment.StartIndex + i, tempV);
points->GetPoint(currentSegment.StartIndex, v2);
v2[0] = tempV[0] - v2[0];
v2[1] = tempV[1] - v2[1];
v2[2] = tempV[2] - v2[2];
// 3. Calculate the distance
l = vtkMath::Dot(v2, v1);
d = vtkMath::Norm(v2);
if (l > 0 && l < lenghtV1)
{
d = sqrt((d * d - l * l));
}
else if (l > 0 && l > lenghtV1)
{
tempV[0] = lenghtV1 * v1[0] - v2[0];
tempV[1] = lenghtV1 * v1[1] - v2[1];
tempV[2] = lenghtV1 * v1[2] - v2[2];
d = vtkMath::Norm(tempV);
}
// 4. Memorize maximum distance
if (d > currentMaxDistance)
{
currentMaxDistance = d;
currentMaxDistanceIndex = currentSegment.StartIndex + i;
}
}
// 4. & 5.
if (currentMaxDistance <= m_Tolerance)
{
// double temp[3];
int segmentLenght = currentSegment.EndIndex - currentSegment.StartIndex;
if (segmentLenght > (int)m_MaxSegmentLenght)
{
m_MaxSegmentLenght = (unsigned int)segmentLenght;
}
// MITK_INFO<<"Lenght: "<<abs(segmentLenght);
if (abs(segmentLenght) > 25)
{
unsigned int newLenght(segmentLenght);
while (newLenght > 25)
{
newLenght = newLenght * 0.5;
}
unsigned int divisions = abs(segmentLenght) / newLenght;
// MITK_INFO<<"Divisions: "<<divisions;
for (unsigned int i = 1; i <= divisions; ++i)
{
// MITK_INFO<<"Inserting MIDDLE: "<<(currentSegment.StartIndex + newLenght*i);
pointId = reducedPoints->InsertNextPoint(points->GetPoint(currentSegment.StartIndex + newLenght * i));
reducedPolygon->GetPointIds()->InsertNextId(pointId);
}
}
// MITK_INFO<<"Inserting END: "<<currentSegment.EndIndex;
pointId = reducedPoints->InsertNextPoint(points->GetPoint(currentSegment.EndIndex));
reducedPolygon->GetPointIds()->InsertNextId(pointId);
}
else
{
ls2.StartIndex = currentMaxDistanceIndex;
ls2.EndIndex = currentSegment.EndIndex;
lineSegments.push(ls2);
ls1.StartIndex = currentSegment.StartIndex;
ls1.EndIndex = currentMaxDistanceIndex;
lineSegments.push(ls1);
}
currentMaxDistance = 0;
}
}
bool mitk::ReduceContourSetFilter::CheckForIntersection(
- vtkIdType *currentCell,
+ const vtkIdType *currentCell,
vtkIdType currentCellSize,
vtkPoints *currentPoints,
/* vtkIdType numberOfIntersections, vtkIdType* intersectionPoints,*/ unsigned int currentInputIndex)
{
/*
If we check the current cell for intersections then we have to consider three possibilies:
1. There is another cell among all the other input surfaces which intersects the current polygon:
- That means we have to save the intersection points because these points should not be eliminated
2. There current polygon exists just because of an intersection of another polygon with the current plane defined by
the current polygon
- That means the current polygon should not be incorporated and all of its points should be eliminated
3. There is no intersection
- That mean we can just reduce the current polygons points without considering any intersections
*/
for (unsigned int i = 0; i < this->GetNumberOfIndexedInputs(); i++)
{
// Don't check for intersection with the polygon itself
if (i == currentInputIndex)
continue;
// Get the next polydata to check for intersection
vtkSmartPointer<vtkPolyData> poly = this->GetInput(i)->GetVtkPolyData();
vtkSmartPointer<vtkCellArray> polygonArray = poly->GetPolys();
polygonArray->InitTraversal();
vtkIdType anotherInputPolygonSize(0);
- vtkIdType *anotherInputPolygonIDs(nullptr);
+ const vtkIdType *anotherInputPolygonIDs(nullptr);
/*
The procedure is:
- Create the equation of the plane, defined by the points of next input
- Calculate the distance of each point of the current polygon to the plane
- If the maximum distance is not bigger than 1.5 of the maximum spacing AND the minimal distance is not bigger
than 0.5 of the minimum spacing then the current contour is an intersection contour
*/
for (polygonArray->InitTraversal(); polygonArray->GetNextCell(anotherInputPolygonSize, anotherInputPolygonIDs);)
{
// Choosing three plane points to calculate the plane vectors
double p1[3];
double p2[3];
double p3[3];
// The plane vectors
double v1[3];
double v2[3] = {0};
// The plane normal
double normal[3];
// Create first Vector
poly->GetPoint(anotherInputPolygonIDs[0], p1);
poly->GetPoint(anotherInputPolygonIDs[1], p2);
v1[0] = p2[0] - p1[0];
v1[1] = p2[1] - p1[1];
v1[2] = p2[2] - p1[2];
// Find 3rd point for 2nd vector (The angle between the two plane vectors should be bigger than 30 degrees)
double maxDistance(0);
double minDistance(10000);
for (vtkIdType j = 2; j < anotherInputPolygonSize; j++)
{
poly->GetPoint(anotherInputPolygonIDs[j], p3);
v2[0] = p3[0] - p1[0];
v2[1] = p3[1] - p1[1];
v2[2] = p3[2] - p1[2];
// Calculate the angle between the two vector for the current point
double dotV1V2 = vtkMath::Dot(v1, v2);
double absV1 = sqrt(vtkMath::Dot(v1, v1));
double absV2 = sqrt(vtkMath::Dot(v2, v2));
double cosV1V2 = dotV1V2 / (absV1 * absV2);
double arccos = acos(cosV1V2);
double degree = vtkMath::DegreesFromRadians(arccos);
// If angle is bigger than 30 degrees break
if (degree > 30)
break;
} // for (to find 3rd point)
// Calculate normal of the plane by taking the cross product of the two vectors
vtkMath::Cross(v1, v2, normal);
vtkMath::Normalize(normal);
// Determine position of the plane
double lambda = vtkMath::Dot(normal, p1);
/*
Calculate the distance to the plane for each point of the current polygon
If the distance is zero then save the currentPoint as intersection point
*/
for (vtkIdType k = 0; k < currentCellSize; k++)
{
double currentPoint[3];
currentPoints->GetPoint(currentCell[k], currentPoint);
double tempPoint[3];
tempPoint[0] = normal[0] * currentPoint[0];
tempPoint[1] = normal[1] * currentPoint[1];
tempPoint[2] = normal[2] * currentPoint[2];
double temp = tempPoint[0] + tempPoint[1] + tempPoint[2] - lambda;
double distance = fabs(temp);
if (distance > maxDistance)
{
maxDistance = distance;
}
if (distance < minDistance)
{
minDistance = distance;
}
} // for (to calculate distance and intersections with currentPolygon)
if (maxDistance < 1.5 * m_MaxSpacing && minDistance < 0.5 * m_MinSpacing)
{
return false;
}
// Because we are considering the plane defined by the acual input polygon only one iteration is sufficient
// We do not need to consider each cell of the plane
break;
} // for (to traverse through all cells of actualInputPolyData)
} // for (to iterate through all inputs)
return true;
}
void mitk::ReduceContourSetFilter::GenerateOutputInformation()
{
Superclass::GenerateOutputInformation();
}
void mitk::ReduceContourSetFilter::Reset()
{
for (unsigned int i = 0; i < this->GetNumberOfIndexedInputs(); i++)
{
this->PopBackInput();
}
this->SetNumberOfIndexedInputs(0);
this->SetNumberOfIndexedOutputs(0);
// BUG XXXXX Fix
mitk::Surface::Pointer output = mitk::Surface::New();
this->SetNthOutput(0, output.GetPointer());
m_NumberOfPointsAfterReduction = 0;
}
void mitk::ReduceContourSetFilter::SetUseProgressBar(bool status)
{
this->m_UseProgressBar = status;
}
void mitk::ReduceContourSetFilter::SetProgressStepSize(unsigned int stepSize)
{
this->m_ProgressStepSize = stepSize;
}
diff --git a/Modules/SurfaceInterpolation/mitkReduceContourSetFilter.h b/Modules/SurfaceInterpolation/mitkReduceContourSetFilter.h
index 1f18b80580..89c447afe4 100644
--- a/Modules/SurfaceInterpolation/mitkReduceContourSetFilter.h
+++ b/Modules/SurfaceInterpolation/mitkReduceContourSetFilter.h
@@ -1,134 +1,134 @@
/*============================================================================
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 mitkReduceContourSetFilter_h_Included
#define mitkReduceContourSetFilter_h_Included
#include "mitkProgressBar.h"
#include "mitkSurface.h"
#include "mitkSurfaceToSurfaceFilter.h"
#include <MitkSurfaceInterpolationExports.h>
#include "vtkCellArray.h"
#include "vtkMath.h"
#include "vtkPoints.h"
#include "vtkPolyData.h"
#include "vtkPolygon.h"
#include "vtkSmartPointer.h"
#include <stack>
namespace mitk
{
/**
\brief A filter that reduces the number of points of contours represented by a mitk::Surface
The type of the reduction can be set via SetReductionType. The two ways provided by this filter is the
\li NTH_POINT Algorithm which reduces the contours according to a certain stepsize
\li DOUGLAS_PEUCKER Algorithm which incorpates an error tolerance into the reduction.
Stepsize and error tolerance can be set via SetStepSize and SetTolerance.
Additional if more than one input contour is provided this filter tries detect contours which occur just because
of an intersection. These intersection contours are eliminated. In oder to ensure a correct elimination the min and
max
spacing of the original image must be provided.
The output is a mitk::Surface.
$Author: fetzer$
*/
class MITKSURFACEINTERPOLATION_EXPORT ReduceContourSetFilter : public SurfaceToSurfaceFilter
{
public:
enum Reduction_Type
{
NTH_POINT,
DOUGLAS_PEUCKER
};
struct LineSegment
{
unsigned int StartIndex;
unsigned int EndIndex;
};
mitkClassMacro(ReduceContourSetFilter, SurfaceToSurfaceFilter);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
itkSetMacro(MinSpacing, double);
itkSetMacro(MaxSpacing, double);
itkSetMacro(ReductionType, Reduction_Type);
itkSetMacro(StepSize, unsigned int);
itkSetMacro(Tolerance, double);
itkGetMacro(NumberOfPointsAfterReduction, unsigned int);
// Resets the filter, i.e. removes all inputs and outputs
void Reset();
/**
\brief Set whether the mitkProgressBar should be used
\a Parameter true for using the progress bar, false otherwise
*/
void SetUseProgressBar(bool);
using itk::ProcessObject::SetInput;
void SetInput(const mitk::Surface *surface) override;
void SetInput(unsigned int idx, const mitk::Surface *surface) override;
/**
\brief Set the stepsize which the progress bar should proceed
\a Parameter The stepsize for progressing
*/
void SetProgressStepSize(unsigned int stepSize);
protected:
ReduceContourSetFilter();
~ReduceContourSetFilter() override;
void GenerateData() override;
void GenerateOutputInformation() override;
private:
void ReduceNumberOfPointsByNthPoint(
- vtkIdType cellSize, vtkIdType *cell, vtkPoints *points, vtkPolygon *reducedPolygon, vtkPoints *reducedPoints);
+ vtkIdType cellSize, const vtkIdType *cell, vtkPoints *points, vtkPolygon *reducedPolygon, vtkPoints *reducedPoints);
void ReduceNumberOfPointsByDouglasPeucker(
- vtkIdType cellSize, vtkIdType *cell, vtkPoints *points, vtkPolygon *reducedPolygon, vtkPoints *reducedPoints);
+ vtkIdType cellSize, const vtkIdType *cell, vtkPoints *points, vtkPolygon *reducedPolygon, vtkPoints *reducedPoints);
bool CheckForIntersection(
- vtkIdType *currentCell,
+ const vtkIdType *currentCell,
vtkIdType currentCellSize,
vtkPoints *currentPoints,
/*vtkIdType numberOfIntersections, vtkIdType* intersectionPoints,*/ unsigned int currentInputIndex);
double m_MinSpacing;
double m_MaxSpacing;
Reduction_Type m_ReductionType;
unsigned int m_StepSize;
double m_Tolerance;
unsigned int m_MaxSegmentLenght;
bool m_UseProgressBar;
unsigned int m_ProgressStepSize;
unsigned int m_NumberOfPointsAfterReduction;
}; // class
} // namespace
#endif
diff --git a/Modules/SurfaceInterpolation/mitkSurfaceInterpolationController.h b/Modules/SurfaceInterpolation/mitkSurfaceInterpolationController.h
index 55d0bce56e..c808672918 100644
--- a/Modules/SurfaceInterpolation/mitkSurfaceInterpolationController.h
+++ b/Modules/SurfaceInterpolation/mitkSurfaceInterpolationController.h
@@ -1,250 +1,250 @@
/*============================================================================
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 mitkSurfaceInterpolationController_h_Included
#define mitkSurfaceInterpolationController_h_Included
#include "mitkColorProperty.h"
#include "mitkCommon.h"
#include "mitkInteractionConst.h"
#include "mitkProperties.h"
#include "mitkRestorePlanePositionOperation.h"
#include "mitkSurface.h"
#include <MitkSurfaceInterpolationExports.h>
#include "mitkComputeContourSetNormalsFilter.h"
#include "mitkCreateDistanceImageFromSurfaceFilter.h"
#include "mitkReduceContourSetFilter.h"
#include "mitkDataNode.h"
#include "mitkDataStorage.h"
#include "vtkAppendPolyData.h"
#include "vtkCellArray.h"
#include "vtkPoints.h"
#include "vtkPolyData.h"
#include "vtkPolygon.h"
#include "vtkSmartPointer.h"
#include "mitkImageTimeSelector.h"
#include "mitkVtkRepresentationProperty.h"
#include "vtkImageData.h"
#include "vtkMarchingCubes.h"
#include "vtkProperty.h"
#include "mitkProgressBar.h"
namespace mitk
{
class MITKSURFACEINTERPOLATION_EXPORT SurfaceInterpolationController : public itk::Object
{
public:
mitkClassMacroItkParent(SurfaceInterpolationController, itk::Object);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
itkGetMacro(DistanceImageSpacing, double);
struct ContourPositionInformation
{
Surface::Pointer contour;
Vector3D contourNormal;
Point3D contourPoint;
};
typedef std::vector<ContourPositionInformation> ContourPositionInformationList;
typedef std::vector<ContourPositionInformationList> ContourPositionInformationVec2D;
typedef std::map<mitk::Image *, ContourPositionInformationVec2D> ContourListMap;
static SurfaceInterpolationController *GetInstance();
void SetCurrentTimePoint(TimePointType tp)
{
if (m_CurrentTimePoint != tp)
{
m_CurrentTimePoint = tp;
if (m_SelectedSegmentation)
{
this->ReinitializeInterpolation();
}
}
};
TimePointType GetCurrentTimePoint() const { return m_CurrentTimePoint; };
/**
* @brief Adds a new extracted contour to the list
* @param newContour the contour to be added. If a contour at that position
* already exists the related contour will be updated
*/
void AddNewContour(Surface::Pointer newContour);
/**
* @brief Removes the contour for a given plane for the current selected segmenation
* @param contourInfo the contour which should be removed
* @return true if a contour was found and removed, false if no contour was found
*/
bool RemoveContour(ContourPositionInformation contourInfo);
/**
* @brief Adds new extracted contours to the list. If one or more contours at a given position
* already exist they will be updated respectively
* @param newContours the list of the contours
*/
void AddNewContours(std::vector<Surface::Pointer> newContours);
/**
* @brief Returns the contour for a given plane for the current selected segmenation
- * @param ontourInfo the contour which should be returned
+ * @param contourInfo the contour which should be returned
* @return the contour as an mitk::Surface. If no contour is available at the give position nullptr is returned
*/
const mitk::Surface *GetContour(ContourPositionInformation contourInfo);
/**
* @brief Returns the number of available contours for the current selected segmentation
* @return the number of contours
*/
unsigned int GetNumberOfContours();
/**
* Interpolates the 3D surface from the given extracted contours
*/
void Interpolate();
mitk::Surface::Pointer GetInterpolationResult();
/**
* Sets the minimum spacing of the current selected segmentation
* This is needed since the contour points we reduced before they are used to interpolate the surface
*/
void SetMinSpacing(double minSpacing);
/**
* Sets the minimum spacing of the current selected segmentation
* This is needed since the contour points we reduced before they are used to interpolate the surface
*/
void SetMaxSpacing(double maxSpacing);
/**
* Sets the volume i.e. the number of pixels that the distance image should have
* By evaluation we found out that 50.000 pixel delivers a good result
*/
void SetDistanceImageVolume(unsigned int distImageVolume);
/**
* @brief Get the current selected segmentation for which the interpolation is performed
* @return the current segmentation image
*/
mitk::Image::Pointer GetCurrentSegmentation();
Surface *GetContoursAsSurface();
void SetDataStorage(DataStorage::Pointer ds);
/**
* Sets the current list of contourpoints which is used for the surface interpolation
* @param segmentation The current selected segmentation
* \deprecatedSince{2014_03}
*/
DEPRECATED(void SetCurrentSegmentationInterpolationList(mitk::Image::Pointer segmentation));
/**
* Sets the current list of contourpoints which is used for the surface interpolation
- * @param segmentation The current selected segmentation
+ * @param currentSegmentationImage The current selected segmentation
*/
void SetCurrentInterpolationSession(mitk::Image::Pointer currentSegmentationImage);
/**
* Removes the segmentation and all its contours from the list
* @param segmentation The segmentation to be removed
* \deprecatedSince{2014_03}
*/
DEPRECATED(void RemoveSegmentationFromContourList(mitk::Image *segmentation));
/**
* @brief Remove interpolation session
* @param segmentationImage the session to be removed
*/
void RemoveInterpolationSession(mitk::Image::Pointer segmentationImage);
/**
* Replaces the current interpolation session with a new one. All contours form the old
* session will be applied to the new session. This only works if the two images have the
* geometry
* @param oldSession the session which should be replaced
* @param newSession the new session which replaces the old one
* @return true it the the replacement was successful, false if not (e.g. the image's geometry differs)
*/
bool ReplaceInterpolationSession(mitk::Image::Pointer oldSession, mitk::Image::Pointer newSession);
/**
* @brief Removes all sessions
*/
void RemoveAllInterpolationSessions();
/**
* @brief Reinitializes the interpolation using the provided contour data
* @param contours a mitk::Surface which contains the contours as polys in the vtkPolyData
*/
void ReinitializeInterpolation(mitk::Surface::Pointer contours);
mitk::Image *GetImage();
/**
* Estimates the memory which is needed to build up the equationsystem for the interpolation.
* \returns The percentage of the real memory which will be used by the interpolation
*/
double EstimatePortionOfNeededMemory();
unsigned int GetNumberOfInterpolationSessions();
protected:
SurfaceInterpolationController();
~SurfaceInterpolationController() override;
template <typename TPixel, unsigned int VImageDimension>
void GetImageBase(itk::Image<TPixel, VImageDimension> *input, itk::ImageBase<3>::Pointer &result);
private:
void ReinitializeInterpolation();
void OnSegmentationDeleted(const itk::Object *caller, const itk::EventObject &event);
void AddToInterpolationPipeline(ContourPositionInformation contourInfo);
ReduceContourSetFilter::Pointer m_ReduceFilter;
ComputeContourSetNormalsFilter::Pointer m_NormalsFilter;
CreateDistanceImageFromSurfaceFilter::Pointer m_InterpolateSurfaceFilter;
Surface::Pointer m_Contours;
double m_DistanceImageSpacing;
vtkSmartPointer<vtkPolyData> m_PolyData;
mitk::DataStorage::Pointer m_DataStorage;
ContourListMap m_ListOfInterpolationSessions;
mitk::Surface::Pointer m_InterpolationResult;
unsigned int m_CurrentNumberOfReducedContours;
mitk::Image *m_SelectedSegmentation;
std::map<mitk::Image *, unsigned long> m_SegmentationObserverTags;
mitk::TimePointType m_CurrentTimePoint;
};
}
#endif
diff --git a/Modules/ToFHardware/Documentation/doxygen/GeneratingDeviceModules.dox b/Modules/ToFHardware/Documentation/doxygen/GeneratingDeviceModules.dox
index 2a588198f6..a68f66ab75 100644
--- a/Modules/ToFHardware/Documentation/doxygen/GeneratingDeviceModules.dox
+++ b/Modules/ToFHardware/Documentation/doxygen/GeneratingDeviceModules.dox
@@ -1,90 +1,90 @@
/**
\page GeneratingDeviceModulesPage How to generate ToF DeviceModules
The <B> ToF-DeviceModule-Tutorial</B> will help you implementing a new ToF-Device easily.
Using MicroServices for this purpose will be one of our main goals, too.
If you do not know much about MicroServices, please take a look at:
\ref MicroServices_Overview
\section GeneratingDeviceModulsPageSec1 Generating a ToF-Device-Module in MITK
In order to implement your own device, you need to code the following objects:
<ul>
<li>device (the device itself)
<li>device factory (a singleton which produces instances of your device)
<li>controller (connection to the Hardware-SDK)
<li>Module Activator (Important for the MicroServices. This class ensures the automatic loading of the device.)
</ul>
The following example shows how to implement a device, here we take the Kinect.
<ol>
<li> <B> Creating a Sub-Folder</B>
\n Following the Kinect-DeviceModule as a prototype, create a <EM>MODULENAME-Sub-Folder</EM> in your source directory. This MODULENAME-Folder is going to hold all the necessary files we will create in the next steps.
<li> <B> Create the <EM>CMake Files</EM> for our new camera-model in the MODULENAME-Folder <</B>
<ul>
<li>CMakeList.txt
In this file, the module is generated via CMake commands. The module name is set, the necessary libraries will be searched here in order to link them with your module. For the Kinect, we chose OpenNI and need the XnCppWrapper.h. Your device must inherit from the mitkToFCameraDevice and consequently your module must depend on mitkToFHardware -> what is the reason for the <EM>DEPENDS mitkToFHardware</EM> -line. For autoloading your Module with mitkToFHardware, insert the following CMake Macro: <EM>AUTOLOAD_WITH mitkToFHardware</EM> . We usually add an option for the user to activate the device module, but this is not essential (refer to <EM> OPTION(MITK_USE_TOF_KINECT "Enable support for Kinect camera" OFF)</EM>).
\n -> refer to CMakeList.text in the Kinect-Folder
- \Warning The dll/so files are not automatically deleted.
+ Warning: The dll/so files are not automatically deleted.
\n<li>files.cmake
The files.cmake contains all the previously mentioned files (device, deviceFactory, controller, and ModuleActivator)
\n -> refer to mitkKinectActivator.cpp
</ul>
<li> <B> Creating the Code Files in the MODULENAME-Folder </B>
<ul>
<li>\a MODULENAMEController
\n -> While referring to mitkKinectcontroller.cpp and the mitkKinectcontroller.h, take a good look at the definition of the MITK_KINECTMODULE_EXPORT-class in the .h file
\n<li>\a MODULENAMEDevice
Your device must inherit from ToFCameraDevice (e.g. class MITK_KINECTMODULE_EXPORT KinectDevice : public ToFCameraDevice) and consequently implement the methods of the ToFCameraDevice MicroService-Interface. (See ToFCameraDevice.h). Make sure to give your device a specific name in the method GetDeviceName(). All instances of your device will automatically be available in the view "ToFUtil", if you generate it via the factory.
\n -> refer to mitkKinectDevice.cpp and the mitkKinectDevice.h.
\n<li>\a MODULENAMEDeviceFactory
Like the mitkToFCameraDevice, the mitkIToFDeviceFactory is a MicroService-Interface. The factory is meant for generation of devices of the same type. This concept allows for having multiple instances of the same camera connected. (Currently our GUI does not really support an actual connection of multiple devices, but the software framework, in principle, does.) Your factory must inherit from the mitkAbstractDeviceFactory, which provides some useful methods for device generation. Your factory instance should be registered as MicroService in order to be available in the view "ToF Device Generation".
\n -> refer to mitkKinectDeviceFactory.cpp and the mitkKinectDeviceFactory.h
\n<li>\a MODULENAMEActivator
The load() method of this class will be called when the module is activated. If you would like to have an instance of your device registered as MicroService, you should call deviceFactory->ConnectToFDevice(); here. In addition, you can generate devices anywhere in your code via this method. The factory will automatically be available in the view "ToF Device Generation" if you register it like we do with the Kinect. TODO: Code example:
\n ->refer to mitkKinectActivator.cpp and the mitkKinectActivator.h or the mitkPMDModuleActivator.cpp and the mitkPMDModuleActivator.h.
</ul>
</ol>
\n
If you did everything correct, your Module should be implemented an executable MODULENAME-Project will be generated and a working device should show up in the ServiceListWidget in the Connection-Part of ToFUtil.
<B>Warning</B> The dll/so files are not automatically deleted. After deactivating a device, please delete the concerning files in <EM>SUPERBUILDDIR/MITK-build/bin/mitkToFHardware/BUILDTYPE</EM>
\section GeneratingDeviceModulsPageSec2 [OPTIONAL] Adding a Testing Sub-Directory
If you have any Tests you want to include, a <EM>Testing-Subdirectory</EM> in the newly created MODULENAME-Folder should be created. In this Folder we are going to put a CMakeLists.txt and a files.cmake the first one will just consist
\code
MITK_CREATE_MODULE_TESTS()
\endcode
while the later one, the files.cmake holds Information about TestFiles you created and put in the Folder.
E.g. for the Kinect:
\code
set(MODULE_TESTS
mitkKinectControllerTest.cpp
mitkKinectDeviceTest.cpp
)
\endcode
As before, feel free to take a look at one of the existing Modules and their Testing-Subfolder as the Kinect´s.
If you managed to implement your Module properly, an executable MODULENAMETestDriver will be generated.
*/
diff --git a/Modules/ToFHardware/Kinect/mitkKinectController.h b/Modules/ToFHardware/Kinect/mitkKinectController.h
index 81b1db888c..75cf216002 100644
--- a/Modules/ToFHardware/Kinect/mitkKinectController.h
+++ b/Modules/ToFHardware/Kinect/mitkKinectController.h
@@ -1,91 +1,92 @@
/*============================================================================
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 __mitkKinectController_h
#define __mitkKinectController_h
#include <MitkKinectExports.h>
#include "mitkCommon.h"
#include "mitkToFConfig.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
namespace mitk
{
/**
* @brief Interface to the Kinect camera
*
*
* @ingroup ToFHardware
*/
class MITKKINECT_EXPORT KinectController : public itk::Object
{
public:
mitkClassMacroItkParent( KinectController , itk::Object );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
unsigned int GetCaptureWidth() const;
unsigned int GetCaptureHeight() const;
bool GetUseIR() const;
void SetUseIR(bool useIR);
/*!
\brief opens a connection to the Kinect camera.
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual bool OpenCameraConnection();
/*!
\brief closes the connection to the camera
*/
virtual bool CloseCameraConnection();
/*!
\brief updates the camera. The update function of the hardware interface is called only when new data is available
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual bool UpdateCamera();
/*!
\brief acquire new distance data from the Kinect camera
\param distances pointer to memory location where distances should be stored
*/
void GetDistances(float* distances);
void GetAmplitudes(float* amplitudes);
void GetIntensities(float* intensities);
/*!
\brief acquire new rgb data from the Kinect camera
\param rgb pointer to memory location where rgb information should be stored
*/
void GetRgb(unsigned char* rgb);
/*!
\brief convenience method for faster access to distance and rgb data
\param distances pointer to memory location where distances should be stored
+ \param amplitudes
\param rgb pointer to memory location where rgb information should be stored
*/
void GetAllData(float* distances, float* amplitudes, unsigned char* rgb);
protected:
KinectController();
~KinectController();
private:
class KinectControllerPrivate;
KinectControllerPrivate *d;
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/Kinect/mitkKinectDevice.h b/Modules/ToFHardware/Kinect/mitkKinectDevice.h
index 1bf4c113ff..29f607047d 100644
--- a/Modules/ToFHardware/Kinect/mitkKinectDevice.h
+++ b/Modules/ToFHardware/Kinect/mitkKinectDevice.h
@@ -1,145 +1,149 @@
/*============================================================================
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 __mitkKinectDevice_h
#define __mitkKinectDevice_h
#include <MitkKinectExports.h>
#include "mitkCommon.h"
#include "mitkToFCameraDevice.h"
#include "mitkKinectController.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkMultiThreader.h"
#include "itkFastMutexLock.h"
namespace mitk
{
/**
* @brief Interface for all representations of Kinect devices.
* KinectDevice internally holds an instance of KinectController and starts a thread
* that continuously grabs images from the controller. A buffer structure buffers the last acquired images
* to provide the image data loss-less.
*
* \throws mitkException In case of no connection, an exception is thrown!
*
* @ingroup ToFHardware
*/
class MITKKINECT_EXPORT KinectDevice : public ToFCameraDevice
{
public:
mitkClassMacro( KinectDevice , ToFCameraDevice );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/*!
\brief opens a connection to the ToF camera
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual bool OnConnectCamera();
/*!
\brief closes the connection to the camera
*/
virtual bool DisconnectCamera();
/*!
\brief starts the continuous updating of the camera.
A separate thread updates the source data, the main thread processes the source data and creates images and coordinates
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual void StartCamera();
/*!
\brief stops the continuous updating of the camera
*/
virtual void StopCamera();
/*!
\brief updates the camera for image acquisition
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual void UpdateCamera();
/*!
\brief returns whether the camera is currently active or not
*/
virtual bool IsCameraActive();
/*!
\brief gets the amplitude data from the ToF camera as the strength of the active illumination of every pixel. Caution! The user is responsible for allocating and deleting the images.
These values can be used to determine the quality of the distance values. The higher the amplitude value, the higher the accuracy of the according distance value
\param imageSequence the actually captured image sequence number
\param amplitudeArray contains the returned amplitude data as an array.
*/
virtual void GetAmplitudes(float* amplitudeArray, int& imageSequence);
/*!
\brief gets the intensity data from the ToF camera as a greyscale image. Caution! The user is responsible for allocating and deleting the images.
\param intensityArray contains the returned intensities data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetIntensities(float* intensityArray, int& imageSequence);
/*!
\brief gets the distance data from the ToF camera measuring the distance between the camera and the different object points in millimeters. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distances data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetDistances(float* distanceArray, int& imageSequence);
/*!
\brief gets the 3 images (distance, amplitude, intensity) from the ToF camera. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distance data as an array.
\param amplitudeArray contains the returned amplitude data as an array.
+ \param intensityArray
+ \param sourceDataArray
+ \param requiredImageSequence
\param capturedImageSequence the actually captured image sequence number.
+ \param rgbDataArray
*/
virtual void GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
int requiredImageSequence, int& capturedImageSequence, unsigned char* rgbDataArray=nullptr);
/*!
\brief returns the corresponding camera controller
*/
KinectController::Pointer GetController();
/*!
\brief set a BaseProperty
*/
virtual void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
/*!
\brief returns the width of the RGB image
*/
int GetRGBCaptureWidth();
/*!
\brief returns the height of the RGB image
*/
int GetRGBCaptureHeight();
protected:
KinectDevice();
~KinectDevice();
/*!
\brief Thread method continuously acquiring images from the ToF hardware
*/
static ITK_THREAD_RETURN_TYPE Acquire(void* pInfoStruct);
/*!
\brief moves the position pointer m_CurrentPos to the next position in the buffer if that's not the next free position to prevent reading from an empty buffer
*/
void GetNextPos();
KinectController::Pointer m_Controller; ///< corresponding CameraController
float** m_DistanceDataBuffer; ///< buffer holding the last distance images
float** m_AmplitudeDataBuffer; ///< buffer holding the last infra-red (IR) images
unsigned char** m_RGBDataBuffer; ///< buffer holding the last RGB image
private:
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/KinectV2/mitkKinectV2Controller.h b/Modules/ToFHardware/KinectV2/mitkKinectV2Controller.h
index c958676176..33ae229d8e 100644
--- a/Modules/ToFHardware/KinectV2/mitkKinectV2Controller.h
+++ b/Modules/ToFHardware/KinectV2/mitkKinectV2Controller.h
@@ -1,104 +1,105 @@
/*============================================================================
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 __mitkKinectV2Controller_h
#define __mitkKinectV2Controller_h
#include <MitkKinectV2Exports.h>
#include <mitkCommon.h>
#include "mitkToFConfig.h"
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
namespace mitk
{
/**
* @brief Interface to the Kinect 2 camera. Currently, the Microsoft SDK is used.
*
* @ingroup ToFHardware
*/
class MITKKINECTV2_EXPORT KinectV2Controller : public itk::Object
{
public:
mitkClassMacroItkParent( KinectV2Controller , itk::Object );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self)
int GetRGBCaptureWidth() const;
int GetRGBCaptureHeight() const;
int GetDepthCaptureWidth() const;
int GetDepthCaptureHeight() const;
/**
\brief Setup MultiFrameReader of Kinect V2.
* This reader can acquire different types of data. Here it is used
* to acquire depth, RGB and infrared images.
*/
bool InitializeMultiFrameReader();
/*!
\brief opens a connection to the Kinect V2 camera.
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual bool OpenCameraConnection();
/*!
\brief closes the connection to the camera
*/
virtual bool CloseCameraConnection();
/*!
\brief updates the camera. The update function of the hardware interface is called only when new data is available
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual bool UpdateCamera();
/*!
\brief acquire new distance data from the Kinect camera
\param distances pointer to memory location where distances should be stored
*/
void GetDistances(float* distances);
void GetAmplitudes(float* amplitudes);
void GetIntensities(float* intensities);
vtkSmartPointer<vtkPolyData> GetVtkPolyData();
void SetGenerateTriangularMesh(bool flag);
void SetTriangulationThreshold(double triangulationThreshold);
/*!
\brief acquire new rgb data from the Kinect camera
\param rgb pointer to memory location where rgb information should be stored
*/
void GetRgb(unsigned char* rgb);
/*!
\brief convenience method for faster access to distance and rgb data
\param distances pointer to memory location where distances should be stored
+ \param amplitudes
\param rgb pointer to memory location where rgb information should be stored
*/
void GetAllData(float* distances, float* amplitudes, unsigned char* rgb);
protected:
KinectV2Controller();
~KinectV2Controller();
private:
class KinectV2ControllerPrivate;
KinectV2ControllerPrivate *d;
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/KinectV2/mitkKinectV2Device.h b/Modules/ToFHardware/KinectV2/mitkKinectV2Device.h
index 5e32555080..b77ab252b2 100644
--- a/Modules/ToFHardware/KinectV2/mitkKinectV2Device.h
+++ b/Modules/ToFHardware/KinectV2/mitkKinectV2Device.h
@@ -1,153 +1,154 @@
/*============================================================================
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 __mitkKinectV2Device_h
#define __mitkKinectV2Device_h
#include <mitkCommon.h>
#include <MitkKinectV2Exports.h>
#include "mitkToFCameraDevice.h"
#include "mitkKinectV2Controller.h"
#include <itkObject.h>
#include <itkObjectFactory.h>
#include <itkMultiThreader.h>
#include <itkFastMutexLock.h>
#include <vtkSmartPointer.h>
#include <vtkPolyData.h>
namespace mitk
{
/**
* @brief Interface for all representations of Microsoft Kinect V2 devices.
* Kinect2Device internally holds an instance of Kinect2Controller and starts a thread
* that continuously grabs images from the controller. A buffer structure buffers the last acquired images
* to provide the image data loss-less.
*
* \throws mitkException In case of no connection, an exception is thrown!
*
* @ingroup ToFHardware
*/
class MITKKINECTV2_EXPORT KinectV2Device : public ToFCameraDevice
{
public:
mitkClassMacro( KinectV2Device , ToFCameraDevice );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self)
/** Prints the framerate to the console every 100 frames.
* Mainly for debugging, deactivated by default.
* Refers to a static variable, means it is acivated/deactivated
* for all instances.
*/
itkSetMacro(PrintFrameRate, bool);
/*!
\brief opens a connection to the ToF camera
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual bool OnConnectCamera();
/*!
\brief closes the connection to the camera
*/
virtual bool DisconnectCamera();
/*!
\brief starts the continuous updating of the camera.
A separate thread updates the source data, the main thread processes the source data and creates images and coordinates
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual void StartCamera();
/*!
\brief stops the continuous updating of the camera
*/
virtual void StopCamera();
/*!
\brief updates the camera for image acquisition
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual void UpdateCamera();
/*!
\brief returns whether the camera is currently active or not
*/
virtual bool IsCameraActive();
/*!
\brief gets the amplitude data from the ToF camera as the strength of the active illumination of every pixel. Caution! The user is responsible for allocating and deleting the images.
These values can be used to determine the quality of the distance values. The higher the amplitude value, the higher the accuracy of the according distance value
\param imageSequence the actually captured image sequence number
\param amplitudeArray contains the returned amplitude data as an array.
*/
virtual void GetAmplitudes(float* amplitudeArray, int& imageSequence);
/*!
\brief Does nothing for Kinect V2 as there is no intensity data provided by the device.
*
* The method is an empty implementation, because the interface (ToFCameraDevice) requires it.
*/
virtual void GetIntensities(float* intensityArray, int& imageSequence);
/*!
\brief gets the distance data from the ToF camera measuring the distance between the camera and the different object points in millimeters. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distances data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetDistances(float* distanceArray, int& imageSequence);
/*!
\brief gets the 3 images (distance, amplitude, intensity) from the ToF camera. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray Contains the distance data as an array.
\param amplitudeArray Contains the infrared image.
\param intensityArray Does nothing for Kinect V2.
\param sourceDataArray Does nothing for Kinect V2.
\param requiredImageSequence The required image sequence number.
\param capturedImageSequence Does nothing for Kinect V2.
+ \param rgbDataArray
*/
virtual void GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
int requiredImageSequence, int& capturedImageSequence, unsigned char* rgbDataArray=nullptr);
/*!
\brief returns the corresponding camera controller
*/
KinectV2Controller::Pointer GetController();
/*!
\brief returns the width of the RGB image
*/
int GetRGBCaptureWidth();
/*!
\brief returns the height of the RGB image
*/
int GetRGBCaptureHeight();
protected:
KinectV2Device();
~KinectV2Device();
/*!
\brief Thread method continuously acquiring images from the ToF hardware
*/
static ITK_THREAD_RETURN_TYPE Acquire(void* pInfoStruct);
static bool m_PrintFrameRate; ///< prints the framerate to the console every 100 frames, deactivated by default
KinectV2Controller::Pointer m_Controller; ///< corresponding CameraController
float** m_DistanceDataBuffer; ///< buffer holding the last distance images
float** m_AmplitudeDataBuffer; ///< buffer holding the last amplitude images
unsigned char** m_RGBDataBuffer; ///< buffer holding the last RGB image
size_t m_DepthBufferSize; ///< Size of depth buffer (i.e. memory size of depth and infrared image)
size_t m_RGBBufferSize; ///< Size of RGB buffer (i.e. memory size of RGB image)
vtkSmartPointer<vtkPolyData> m_PolyData; ///< Surface generated via the Kinect V2 SDK with default/unknown calibration.
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/MesaSR4000/mitkToFCameraMESADevice.h b/Modules/ToFHardware/MesaSR4000/mitkToFCameraMESADevice.h
index 4aacb79086..df4623b1b1 100644
--- a/Modules/ToFHardware/MesaSR4000/mitkToFCameraMESADevice.h
+++ b/Modules/ToFHardware/MesaSR4000/mitkToFCameraMESADevice.h
@@ -1,137 +1,138 @@
/*============================================================================
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 __mitkToFCameraMESADevice_h
#define __mitkToFCameraMESADevice_h
#include <MitkMESASR4000ModuleExports.h>
#include "mitkCommon.h"
#include "mitkToFCameraDevice.h"
#include "mitkToFCameraMESAController.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkMultiThreader.h"
#include "itkFastMutexLock.h"
namespace mitk
{
/**
* @brief Interface for all representations of MESA ToF devices.
* ToFCameraMESADevice internally holds an instance of ToFCameraMESAController and starts a thread
* that continuously grabs images from the controller. A buffer structure buffers the last acquired images
* to provide the image data loss-less.
*
* @ingroup ToFHardware
*/
class MITKMESASR4000_EXPORT ToFCameraMESADevice : public ToFCameraDevice
{
public:
mitkClassMacro( ToFCameraMESADevice , ToFCameraDevice );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/*!
\brief opens a connection to the ToF camera
*/
virtual bool OnConnectCamera();
/*!
\brief closes the connection to the camera
*/
virtual bool DisconnectCamera();
/*!
\brief starts the continuous updating of the camera.
A separate thread updates the source data, the main thread processes the source data and creates images and coordinates
*/
virtual void StartCamera();
/*!
\brief stops the continuous updating of the camera
*/
virtual void StopCamera();
/*!
\brief updates the camera for image acquisition
*/
virtual void UpdateCamera();
/*!
\brief returns whether the camera is currently active or not
*/
virtual bool IsCameraActive();
/*!
\brief gets the amplitude data from the ToF camera as the strength of the active illumination of every pixel. Caution! The user is responsible for allocating and deleting the images.
These values can be used to determine the quality of the distance values. The higher the amplitude value, the higher the accuracy of the according distance value
\param imageSequence the actually captured image sequence number
\param amplitudeArray contains the returned amplitude data as an array.
*/
virtual void GetAmplitudes(float* amplitudeArray, int& imageSequence);
/*!
\brief gets the intensity data from the ToF camera as a greyscale image. Caution! The user is responsible for allocating and deleting the images.
\param intensityArray contains the returned intensities data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetIntensities(float* intensityArray, int& imageSequence);
/*!
\brief gets the distance data from the ToF camera measuring the distance between the camera and the different object points in millimeters. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distances data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetDistances(float* distanceArray, int& imageSequence);
/*!
\brief gets the 3 images (distance, amplitude, intensity) from the ToF camera. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distance data as an array.
\param amplitudeArray contains the returned amplitude data as an array.
\param intensityArray contains the returned intensity data as an array.
\param sourceDataArray contains the complete source data from the camera device.
\param requiredImageSequence the required image sequence number
\param capturedImageSequence the actually captured image sequence number
+ \param rgbDataArray
*/
virtual void GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
int requiredImageSequence, int& capturedImageSequence, unsigned char* rgbDataArray=nullptr);
/*!
\brief returns the corresponding camera controller
*/
ToFCameraMESAController::Pointer GetController();
/*!
\brief set a BaseProperty
*/
virtual void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
protected:
ToFCameraMESADevice();
~ToFCameraMESADevice();
/*!
\brief Thread method continuously acquiring images from the ToF hardware
*/
static ITK_THREAD_RETURN_TYPE Acquire(void* pInfoStruct);
/*!
\brief moves the position pointer m_CurrentPos to the next position in the buffer if that's not the next free position to prevent reading from an empty buffer
*/
void GetNextPos();
ToFCameraMESAController::Pointer m_Controller; ///< corresponding CameraController
float** m_DistanceDataBuffer; ///< buffer holding the last distance images
float** m_AmplitudeDataBuffer; ///< buffer holding the last amplitude images
float** m_IntensityDataBuffer; ///< buffer holding the last intensity images
private:
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/MesaSR4000/mitkToFCameraMESASR4000Device.h b/Modules/ToFHardware/MesaSR4000/mitkToFCameraMESASR4000Device.h
index d3ccbbe152..2a82fccf8d 100644
--- a/Modules/ToFHardware/MesaSR4000/mitkToFCameraMESASR4000Device.h
+++ b/Modules/ToFHardware/MesaSR4000/mitkToFCameraMESASR4000Device.h
@@ -1,68 +1,68 @@
/*============================================================================
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 __mitkToFCameraMESASR4000Device_h
#define __mitkToFCameraMESASR4000Device_h
#include <MitkMESASR4000ModuleExports.h>
#include "mitkCommon.h"
#include "mitkToFCameraDevice.h"
#include "mitkToFCameraMESADevice.h"
#include "mitkToFCameraMESASR4000Controller.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkMultiThreader.h"
#include "itkFastMutexLock.h"
namespace mitk
{
/**
* @brief Device class representing a MESA CamBoard camera
*
* @ingroup ToFHardware
*/
class MITKMESASR4000_EXPORT ToFCameraMESASR4000Device : public ToFCameraMESADevice
{
public:
mitkClassMacro( ToFCameraMESASR4000Device , ToFCameraMESADevice );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/*!
\brief set a BaseProperty
*/
virtual void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
/*!
\brief Setting the region of interest, the camera is configured to only output a certain area of the image.
\param leftUpperCornerX x value of left upper corner of region
- \param leftUpperCornerX y value of left upper corner of region
+ \param leftUpperCornerY y value of left upper corner of region
\param width width of region
\param height height of region
*/
void SetRegionOfInterest( unsigned int leftUpperCornerX, unsigned int leftUpperCornerY, unsigned int width, unsigned int height );
protected:
ToFCameraMESASR4000Device();
~ToFCameraMESASR4000Device();
private:
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/PMD/mitkToFCameraPMDCamBoardController.h b/Modules/ToFHardware/PMD/mitkToFCameraPMDCamBoardController.h
index ae7a77f0c1..99902033e7 100644
--- a/Modules/ToFHardware/PMD/mitkToFCameraPMDCamBoardController.h
+++ b/Modules/ToFHardware/PMD/mitkToFCameraPMDCamBoardController.h
@@ -1,95 +1,95 @@
/*============================================================================
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 __mitkToFCameraPMDCamBoardController_h
#define __mitkToFCameraPMDCamBoardController_h
#include "MitkPMDExports.h"
#include "mitkCommon.h"
#include "mitkToFCameraPMDController.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
namespace mitk
{
/**
* @brief Interface to the Time-of-Flight (ToF) camera PMD CamBoard
*
*
* @ingroup ToFHardware
*/
class MITKPMD_EXPORT ToFCameraPMDCamBoardController : public ToFCameraPMDController
{
public:
mitkClassMacro( ToFCameraPMDCamBoardController , ToFCameraPMDController );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/*!
\brief opens a connection to the ToF camera and initializes the hardware specific members
\return returns whether the connection was successful (true) or not (false)
*/
virtual bool OpenCameraConnection();
/*!
\brief sets an additional distance offset which will be added to all distance values.
\param offset offset in m
*/
bool SetDistanceOffset( float offset );
/*!
\brief returns the currently applied distance offset in m
\param offset offset in m
*/
float GetDistanceOffset();
/*!
\brief Setting the region of interest, the camera is configured to only output a certain area of the image.
\param leftUpperCornerX x value of left upper corner of region
- \param leftUpperCornerX y value of left upper corner of region
+ \param leftUpperCornerY y value of left upper corner of region
\param width width of region
\param height height of region
*/
bool SetRegionOfInterest( unsigned int leftUpperCornerX, unsigned int leftUpperCornerY, unsigned int width, unsigned int height );
/*!
\brief Setting the region of interest, the camera is configured to only output a certain area of the image.
\param roi region of interest. roi[0]: x value of left upper corner, roi[1]: y value of left upper corner, roi[2]: width, roi[3]: height
*/
bool SetRegionOfInterest( unsigned int roi[4] );
/*!
\brief returns the region of interest currently set
\return currently set region of interest.
*/
unsigned int* GetRegionOfInterest();
/*!
\brief Sets the field of view of the camera lens.
\param fov field of view in degrees. The default value is 40 degrees.
*/
bool SetFieldOfView( float fov );
protected:
ToFCameraPMDCamBoardController();
~ToFCameraPMDCamBoardController();
/*
\brief Transform the output of the camera, i.e. cut invalid pixels, and rotate 90 degrees
counterclockwise
\param input data array of original size (207x204)
\param rotated output data array of reduced size (200x200)
*/
virtual void TransformCameraOutput(float* in, float* out, bool isDist);
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/PMD/mitkToFCameraPMDCamBoardDevice.h b/Modules/ToFHardware/PMD/mitkToFCameraPMDCamBoardDevice.h
index 1b2f787d5d..b858688d45 100644
--- a/Modules/ToFHardware/PMD/mitkToFCameraPMDCamBoardDevice.h
+++ b/Modules/ToFHardware/PMD/mitkToFCameraPMDCamBoardDevice.h
@@ -1,69 +1,69 @@
/*============================================================================
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 __mitkToFCameraPMDCamBoardDevice_h
#define __mitkToFCameraPMDCamBoardDevice_h
#include <MitkPMDExports.h>
#include "mitkCommon.h"
#include "mitkToFCameraDevice.h"
#include "mitkToFCameraPMDDevice.h"
#include "mitkToFCameraPMDCamBoardController.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkMultiThreader.h"
#include "itkFastMutexLock.h"
namespace mitk
{
/**
* @brief Device class representing a PMD CamBoard camera
*
* @ingroup ToFHardware
*/
class MITKPMD_EXPORT ToFCameraPMDCamBoardDevice : public ToFCameraPMDDevice
{
public:
mitkClassMacro( ToFCameraPMDCamBoardDevice , ToFCameraPMDDevice );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/*!
\brief set a BaseProperty
*/
virtual void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
/*!
\brief Setting the region of interest, the camera is configured to only output a certain area of the image.
\param leftUpperCornerX x value of left upper corner of region
- \param leftUpperCornerX y value of left upper corner of region
+ \param leftUpperCornerY y value of left upper corner of region
\param width width of region
\param height height of region
*/
void SetRegionOfInterest( unsigned int leftUpperCornerX, unsigned int leftUpperCornerY, unsigned int width, unsigned int height );
//void GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray, int requiredImageSequence, int& capturedImageSequence, unsigned char* rgbDataArray);
protected:
ToFCameraPMDCamBoardDevice();
~ToFCameraPMDCamBoardDevice();
private:
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/PMD/mitkToFCameraPMDCamCubeController.h b/Modules/ToFHardware/PMD/mitkToFCameraPMDCamCubeController.h
index 18e73a8fb7..b0c00d5d6a 100644
--- a/Modules/ToFHardware/PMD/mitkToFCameraPMDCamCubeController.h
+++ b/Modules/ToFHardware/PMD/mitkToFCameraPMDCamCubeController.h
@@ -1,126 +1,126 @@
/*============================================================================
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 __mitkToFCameraPMDCamCubeController_h
#define __mitkToFCameraPMDCamCubeController_h
#include <MitkPMDExports.h>
#include "mitkCommon.h"
#include "mitkToFCameraPMDController.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
namespace mitk
{
/**
* @brief Interface to the Time-of-Flight (ToF) camera PMD CamCube
*
*
* @ingroup ToFHardware
*/
class MITKPMD_EXPORT ToFCameraPMDCamCubeController : public ToFCameraPMDController
{
public:
mitkClassMacro( ToFCameraPMDCamCubeController , ToFCameraPMDController );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/*!
\brief opens a connection to the ToF camera and initializes the hardware specific members
\return returns whether the connection was successful (true) or not (false)
*/
virtual bool OpenCameraConnection();
/*!
\brief sets an additional distance offset which will be added to all distance values.
\param offset offset in m
\return returns whether set operation was successful (true) or not (false)
*/
bool SetDistanceOffset( float offset );
/*!
\brief returns the currently applied distance offset in m
\param offset offset in m
*/
float GetDistanceOffset();
/*!
\brief Setting the region of interest, the camera is configured to only output a certain area of the image.
\param leftUpperCornerX x value of left upper corner of region
- \param leftUpperCornerX y value of left upper corner of region
+ \param leftUpperCornerY y value of left upper corner of region
\param width width of region
\param height height of region
\return returns whether set operation was successful (true) or not (false)
*/
bool SetRegionOfInterest( unsigned int leftUpperCornerX, unsigned int leftUpperCornerY, unsigned int width, unsigned int height );
/*!
\brief Setting the region of interest, the camera is configured to only output a certain area of the image.
\param roi region of interest. roi[0]: x value of left upper corner, roi[1]: y value of left upper corner, roi[2]: width, roi[3]: height
\return returns whether set operation was successful (true) or not (false)
*/
bool SetRegionOfInterest( unsigned int roi[4] );
/*!
\brief returns the region of interest currently set
\return currently set region of interest.
*/
unsigned int* GetRegionOfInterest();
/*!
\brief sets the exposure mode of the CamCube
\param mode exposure mode. 0: normal mode (one exposure), 1: Suppression of motion blur (SMB), minimizes the time needed to capture
a distance image from the camera which results in a reduced amount of motion artifact but may lead to increased noise.
\return returns whether set operation was successful (true) or not (false)
*/
bool SetExposureMode( int mode );
/*!
\brief Sets the field of view of the camera lens.
\param fov field of view in degrees. The default value is 40 degrees.
\return returns whether set operation was successful (true) or not (false)
*/
bool SetFieldOfView( float fov );
/*!
\brief Enable/Disable PMD fixed pattern noise (FPN) calibration
\param on enabled (true), disabled (false)
\return returns whether set operation was successful (true) or not (false)
*/
bool SetFPNCalibration( bool on );
/*!
\brief Enable/Disable PMD fixed pattern phase noise (FPPN) calibration
\param on enabled (true), disabled (false)
\return returns whether set operation was successful (true) or not (false)
*/
bool SetFPPNCalibration( bool on );
/*!
\brief Enable/Disable PMD linearity calibration
\param on enabled (true), disabled (false)
\return returns whether set operation was successful (true) or not (false)
*/
bool SetLinearityCalibration( bool on );
/*!
\brief Enable/Disable PMD lens calibration
\param on enabled (true), disabled (false)
\return returns whether set operation was successful (true) or not (false)
*/
bool SetLensCalibration( bool on );
protected:
virtual void TransformCameraOutput(float* in, float* out, bool isDist);
ToFCameraPMDCamCubeController();
~ToFCameraPMDCamCubeController();
private:
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/PMD/mitkToFCameraPMDDevice.h b/Modules/ToFHardware/PMD/mitkToFCameraPMDDevice.h
index c13238e061..5423a76c54 100644
--- a/Modules/ToFHardware/PMD/mitkToFCameraPMDDevice.h
+++ b/Modules/ToFHardware/PMD/mitkToFCameraPMDDevice.h
@@ -1,140 +1,141 @@
/*============================================================================
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 __mitkToFCameraPMDDevice_h
#define __mitkToFCameraPMDDevice_h
#include <MitkPMDExports.h>
#include "mitkCommon.h"
#include "mitkToFCameraDevice.h"
#include "mitkToFCameraPMDController.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkMultiThreader.h"
#include "itkFastMutexLock.h"
namespace mitk
{
/**
* @brief Interface for all representations of PMD ToF devices.
* ToFCameraPMDDevice internally holds an instance of ToFCameraPMDController and starts a thread
* that continuously grabs images from the controller. A buffer structure buffers the last acquired images
* to provide the image data loss-less.
*
*\throws mitkException In case of no connection, an exception is thrown!
*
* @ingroup ToFHardware
*/
class MITKPMD_EXPORT ToFCameraPMDDevice : public ToFCameraDevice
{
public:
mitkClassMacro( ToFCameraPMDDevice , ToFCameraDevice );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/*!
\brief opens a connection to the ToF camera
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual bool OnConnectCamera();
/*!
\brief closes the connection to the camera
*/
virtual bool DisconnectCamera();
/*!
\brief starts the continuous updating of the camera.
A separate thread updates the source data, the main thread processes the source data and creates images and coordinates
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual void StartCamera();
/*!
\brief updated the controller hold by this device
\throws mitkException In case of no connection, an exception is thrown!
*/
virtual void UpdateCamera();
/*!
\brief gets the amplitude data from the ToF camera as the strength of the active illumination of every pixel. Caution! The user is responsible for allocating and deleting the images.
These values can be used to determine the quality of the distance values. The higher the amplitude value, the higher the accuracy of the according distance value
\param imageSequence the actually captured image sequence number
\param amplitudeArray contains the returned amplitude data as an array.
*/
virtual void GetAmplitudes(float* amplitudeArray, int& imageSequence);
/*!
\brief gets the intensity data from the ToF camera as a greyscale image. Caution! The user is responsible for allocating and deleting the images.
\param intensityArray contains the returned intensities data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetIntensities(float* intensityArray, int& imageSequence);
/*!
\brief gets the distance data from the ToF camera measuring the distance between the camera and the different object points in millimeters. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distances data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetDistances(float* distanceArray, int& imageSequence);
/*!
\brief gets the 3 images (distance, amplitude, intensity) from the ToF camera. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distance data as an array.
\param amplitudeArray contains the returned amplitude data as an array.
\param intensityArray contains the returned intensity data as an array.
\param sourceDataArray contains the complete source data from the camera device.
\param requiredImageSequence the required image sequence number
\param capturedImageSequence the actually captured image sequence number
+ \param rgbDataArray
*/
virtual void GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
int requiredImageSequence, int& capturedImageSequence, unsigned char* rgbDataArray=nullptr);
/*!
\brief returns the corresponding camera controller
*/
ToFCameraPMDController::Pointer GetController();
/*!
\brief set a BaseProperty
*/
virtual void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
protected:
ToFCameraPMDDevice();
~ToFCameraPMDDevice();
/*!
\brief method for allocating m_SourceDataArray and m_SourceDataBuffer
*/
virtual void AllocateSourceData();
/*!
\brief method for cleaning up memory allocated for m_SourceDataArray and m_SourceDataBuffer
*/
virtual void CleanUpSourceData();
/*!
\brief Thread method continuously acquiring images from the ToF hardware
*/
static ITK_THREAD_RETURN_TYPE Acquire(void* pInfoStruct);
/*!
\brief moves the position pointer m_CurrentPos to the next position in the buffer if that's not the next free position to prevent reading from an empty buffer
*/
void GetNextPos();
ToFCameraPMDController::Pointer m_Controller; ///< corresponding CameraController
char** m_SourceDataBuffer; ///< buffer holding the last acquired images
char* m_SourceDataArray; ///< array holding the current PMD source data
private:
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/PMD/mitkToFCameraPMDRawDataDevice.h b/Modules/ToFHardware/PMD/mitkToFCameraPMDRawDataDevice.h
index 23119703e1..1c303eb74e 100644
--- a/Modules/ToFHardware/PMD/mitkToFCameraPMDRawDataDevice.h
+++ b/Modules/ToFHardware/PMD/mitkToFCameraPMDRawDataDevice.h
@@ -1,167 +1,168 @@
/*============================================================================
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 __mitkToFCameraPMDRawDataDevice_h
#define __mitkToFCameraPMDRawDataDevice_h
#include <MitkPMDExports.h>
#include "mitkToFCameraDevice.h"
#include "mitkToFCameraPMDController.h"
#include "mitkThreadedToFRawDataReconstruction.h"
namespace mitk
{
/**
* @brief Interface for all representations of PMD ToF devices.
* ToFCameraPMDDevice internally holds an instance of ToFCameraPMDController and starts a thread
* that continuously grabs images from the controller. A buffer structure buffers the last acquired images
* to provide the image data loss-less.
*
* @ingroup ToFHardware
*/
class MITKPMD_EXPORT ToFCameraPMDRawDataDevice : public ToFCameraDevice
{
public:
mitkClassMacro( ToFCameraPMDRawDataDevice , ToFCameraDevice );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
itkSetMacro(ChannelSize, int);
itkGetMacro(ChannelSize, int);
/*!
\brief opens a connection to the ToF camera
*/
virtual bool OnConnectCamera();
/*!
\brief closes the connection to the camera
*/
virtual bool DisconnectCamera();
/*!
\brief starts the continuous updating of the camera.
A separate thread updates the source data, the main thread processes the source data and creates images and coordinates
*/
virtual void StartCamera();
/*!
\brief stops the continuous updating of the camera
*/
virtual void StopCamera();
/*!
\brief updates the camera for image acquisition
*/
virtual void UpdateCamera();
/*!
\brief returns whether the camera is currently active or not
*/
virtual bool IsCameraActive();
/*!
\brief gets the amplitude data from the ToF camera as the strength of the active illumination of every pixel. Caution! The user is responsible for allocating and deleting the images.
These values can be used to determine the quality of the distance values. The higher the amplitude value, the higher the accuracy of the according distance value
\param imageSequence the actually captured image sequence number
\param amplitudeArray contains the returned amplitude data as an array.
*/
virtual void GetAmplitudes(float* amplitudeArray, int& imageSequence);
/*!
\brief gets the intensity data from the ToF camera as a greyscale image. Caution! The user is responsible for allocating and deleting the images.
\param intensityArray contains the returned intensities data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetIntensities(float* intensityArray, int& imageSequence);
/*!
\brief gets the distance data from the ToF camera measuring the distance between the camera and the different object points in millimeters. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distances data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetDistances(float* distanceArray, int& imageSequence);
/*!
\brief gets the 3 images (distance, amplitude, intensity) from the ToF camera. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distance data as an array.
\param amplitudeArray contains the returned amplitude data as an array.
\param intensityArray contains the returned intensity data as an array.
\param sourceDataArray contains the complete source data from the camera device.
\param requiredImageSequence the required image sequence number
\param capturedImageSequence the actually captured image sequence number
+ \param rgbDataArray
*/
virtual void GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
int requiredImageSequence, int& capturedImageSequence, unsigned char* rgbDataArray=nullptr);
/*!
\brief returns the corresponding camera controller
*/
ToFCameraPMDController::Pointer GetController();
virtual void GetChannelSourceData(short* /*sourceData*/, vtkShortArray* /*vtkChannelArray*/ ){};
/*!
\brief set a BaseProperty
*/
virtual void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
protected:
ToFCameraPMDRawDataDevice();
~ToFCameraPMDRawDataDevice();
/*!
\brief method for allocating m_SourceDataArray and m_SourceDataBuffer
*/
virtual void AllocateSourceData();
/*!
\brief method for cleaning up memory allocated for m_SourceDataArray and m_SourceDataBuffer
*/
virtual void CleanUpSourceData();
/*!
\brief method for allocating memory for pixel arrays m_IntensityArray, m_DistanceArray and m_AmplitudeArray
*/
virtual void AllocatePixelArrays();
/*!
\brief method for cleanup memory allocated for pixel arrays m_IntensityArray, m_DistanceArray and m_AmplitudeArray
*/
virtual void CleanupPixelArrays();
/*!
\brief Thread method continuously acquiring images from the ToF hardware
*/
static ITK_THREAD_RETURN_TYPE Acquire(void* pInfoStruct);
/*!
\brief moves the position pointer m_CurrentPos to the next position in the buffer if that's not the next free position to prevent reading from an empty buffer
*/
void GetNextPos();
/*!
\brief gets the image data and flips it according to user needs Caution! The user is responsible for allocating and deleting the data.
\param imageData contains array to the input data.
\param flippedData contains flipped output array - Caution! The user is responsible for allocating and deleting the data. Size should be equal to imageData!
\param xAxis flag is set to flip around x axis (1 - set, 0 - not set).
\param yAxis flag is set to flip around y axis (1 - set, 0 - not set).
\param dimension contains the extend of the z dimension (preset is 1)
*/
void XYAxisFlipImage( float* imageData, float* &flippedData, int xAxis, int yAxis, int dimension = 1 );
//member variables
ToFCameraPMDController::Pointer m_Controller; ///< corresponding CameraController
ThreadedToFRawDataReconstruction::Pointer m_RawDataSource;
char** m_SourceDataBuffer; ///< buffer holding the last acquired images
char* m_SourceDataArray; ///< array holding the current PMD source data
short* m_ShortSourceData; ///< array holding the current PMD raw data
unsigned int m_OriginControllerWidth; ///< holds the original controller width
unsigned int m_OriginControllerHeight; ///< holds the original controller height
private:
int m_ChannelSize; ///< member holds the size of a single raw data channel
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/Testing/CMakeLists.txt b/Modules/ToFHardware/Testing/CMakeLists.txt
index 99276c61d6..c6b2717acb 100644
--- a/Modules/ToFHardware/Testing/CMakeLists.txt
+++ b/Modules/ToFHardware/Testing/CMakeLists.txt
@@ -1,15 +1,12 @@
MITK_CREATE_MODULE_TESTS()
if(TARGET ${TESTDRIVER})
- mitk_use_modules(TARGET ${TESTDRIVER} PACKAGES VTK|vtkTestingRendering)
+ mitk_use_modules(TARGET ${TESTDRIVER} PACKAGES VTK|TestingRendering)
- mitkAddCustomModuleTest(mitkPlayerLoadAndRenderDepthDataTest_KinectDepthImage #testname
+ mitkAddCustomModuleRenderingTest(mitkPlayerLoadAndRenderDepthDataTest_KinectDepthImage #testname
mitkPlayerLoadAndRenderDepthDataTest #testclassname
Kinect_LiverPhantom_DistanceImage.nrrd #input image
-V ${MITK_DATA_DIR}/ToF-Data/ReferenceScreenshots/Kinect_LiverPhantom_DistanceImage640x480REF.png #reference image
)
- mitkAddCustomModuleTest(mitkPlayerLoadAndRenderRGBDataTest_KinectRGBImage mitkPlayerLoadAndRenderRGBDataTest Kinect_LiverPhantom_RGBImage.nrrd -V ${MITK_DATA_DIR}/ToF-Data/ReferenceScreenshots/Kinect_LiverPhantom_RGBImage640x480REF.png)
-
- #rendering tests cannot run in parallel
- SET_PROPERTY(TEST mitkPlayerLoadAndRenderDepthDataTest_KinectDepthImage mitkPlayerLoadAndRenderRGBDataTest_KinectRGBImage PROPERTY RUN_SERIAL TRUE)
+ mitkAddCustomModuleRenderingTest(mitkPlayerLoadAndRenderRGBDataTest_KinectRGBImage mitkPlayerLoadAndRenderRGBDataTest Kinect_LiverPhantom_RGBImage.nrrd -V ${MITK_DATA_DIR}/ToF-Data/ReferenceScreenshots/Kinect_LiverPhantom_RGBImage640x480REF.png)
endif()
diff --git a/Modules/ToFHardware/mitkToFCameraDevice.h b/Modules/ToFHardware/mitkToFCameraDevice.h
index 80e74ed18e..be4f4537ad 100644
--- a/Modules/ToFHardware/mitkToFCameraDevice.h
+++ b/Modules/ToFHardware/mitkToFCameraDevice.h
@@ -1,230 +1,231 @@
/*============================================================================
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 __mitkToFCameraDevice_h
#define __mitkToFCameraDevice_h
#include <MitkToFHardwareExports.h>
#include "mitkCommon.h"
#include "mitkStringProperty.h"
#include "mitkProperties.h"
#include "mitkPropertyList.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkMultiThreader.h"
#include "itkFastMutexLock.h"
// Microservices
#include <mitkServiceInterface.h>
namespace mitk
{
/**
* @brief Virtual interface and base class for all Time-of-Flight devices.
*
* @ingroup ToFHardware
*/
class MITKTOFHARDWARE_EXPORT ToFCameraDevice : public itk::Object
{
public:
mitkClassMacroItkParent(ToFCameraDevice, itk::Object);
/*!
\brief Opens a connection to the ToF camera. Has to be implemented
in the specialized inherited classes.
\return True for success.
*/
virtual bool OnConnectCamera() = 0;
/**
* @brief ConnectCamera Internally calls OnConnectCamera() of the
* respective device implementation.
* @return True for success.
*/
virtual bool ConnectCamera();
/*!
\brief closes the connection to the camera
*/
virtual bool DisconnectCamera() = 0;
/*!
\brief starts the continuous updating of the camera.
A separate thread updates the source data, the main thread processes the source data and creates images and coordinates
*/
virtual void StartCamera() = 0;
/*!
\brief stops the continuous updating of the camera
*/
virtual void StopCamera();
/*!
\brief returns true if the camera is connected and started
*/
virtual bool IsCameraActive();
/*!
\brief returns true if the camera is connected
*/
virtual bool IsCameraConnected();
/*!
\brief updates the camera for image acquisition
*/
virtual void UpdateCamera() = 0;
/*!
\brief gets the amplitude data from the ToF camera as the strength of the active illumination of every pixel
These values can be used to determine the quality of the distance values. The higher the amplitude value, the higher the accuracy of the according distance value
\param imageSequence the actually captured image sequence number
\param amplitudeArray contains the returned amplitude data as an array.
*/
virtual void GetAmplitudes(float* amplitudeArray, int& imageSequence) = 0;
/*!
\brief gets the intensity data from the ToF camera as a greyscale image
\param intensityArray contains the returned intensities data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetIntensities(float* intensityArray, int& imageSequence) = 0;
/*!
\brief gets the distance data from the ToF camera measuring the distance between the camera and the different object points in millimeters
\param distanceArray contains the returned distances data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetDistances(float* distanceArray, int& imageSequence) = 0;
/*!
\brief gets the 3 images (distance, amplitude, intensity) from the ToF camera. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distance data as an array.
\param amplitudeArray contains the returned amplitude data as an array.
\param intensityArray contains the returned intensity data as an array.
\param sourceDataArray contains the complete source data from the camera device.
\param requiredImageSequence the required image sequence number
\param capturedImageSequence the actually captured image sequence number
+ \param rgbDataArray
*/
virtual void GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
int requiredImageSequence, int& capturedImageSequence, unsigned char* rgbDataArray=nullptr) = 0;
/*!
\brief get the currently set capture width
\return capture width
*/
itkGetMacro(CaptureWidth, int);
/*!
\brief get the currently set capture height
\return capture height
*/
itkGetMacro(CaptureHeight, int);
/*!
\brief get the currently set source data size
\return source data size
*/
itkGetMacro(SourceDataSize, int);
/*!
\brief get the currently set buffer size
\return buffer size
*/
itkGetMacro(BufferSize, int);
/*!
\brief get the currently set max buffer size
\return max buffer size
*/
itkGetMacro(MaxBufferSize, int);
/*!
\brief set a bool property in the property list
*/
void SetBoolProperty( const char* propertyKey, bool boolValue );
/*!
\brief set an int property in the property list
*/
void SetIntProperty( const char* propertyKey, int intValue );
/*!
\brief set a float property in the property list
*/
void SetFloatProperty( const char* propertyKey, float floatValue );
/*!
\brief set a string property in the property list
*/
void SetStringProperty( const char* propertyKey, const char* stringValue );
/*!
\brief set a BaseProperty property in the property list
*/
virtual void SetProperty( const char *propertyKey, BaseProperty* propertyValue );
/*!
\brief get a BaseProperty from the property list
*/
virtual BaseProperty* GetProperty( const char *propertyKey );
/*!
\brief get a bool from the property list
*/
bool GetBoolProperty(const char *propertyKey, bool& boolValue);
/*!
\brief get a string from the property list
*/
bool GetStringProperty(const char *propertyKey, std::string& string);
/*!
\brief get an int from the property list
*/
bool GetIntProperty(const char *propertyKey, int& integer);
virtual int GetRGBCaptureWidth();
virtual int GetRGBCaptureHeight();
protected:
ToFCameraDevice();
~ToFCameraDevice() override;
/*!
\brief method for allocating memory for pixel arrays m_IntensityArray, m_DistanceArray and m_AmplitudeArray
*/
virtual void AllocatePixelArrays();
/*!
\brief method for cleanup memory allocated for pixel arrays m_IntensityArray, m_DistanceArray and m_AmplitudeArray
*/
virtual void CleanupPixelArrays();
float* m_IntensityArray; ///< float array holding the intensity image
float* m_DistanceArray; ///< float array holding the distance image
float* m_AmplitudeArray; ///< float array holding the amplitude image
int m_BufferSize; ///< buffer size of the image buffer needed for loss-less acquisition of range data
int m_MaxBufferSize; ///< maximal buffer size needed for initialization of data arrays. Default value is 100.
int m_CurrentPos; ///< current position in the buffer which will be retrieved by the Get methods
int m_FreePos; ///< current position in the buffer which will be filled with data acquired from the hardware
int m_CaptureWidth; ///< width of the range image (x dimension)
int m_CaptureHeight; ///< height of the range image (y dimension)
int m_PixelNumber; ///< number of pixels in the range image (m_CaptureWidth*m_CaptureHeight)
int m_RGBImageWidth; ///< width of the RGB image (x dimension)
int m_RGBImageHeight; ///< height of the RGB image (y dimension)
int m_RGBPixelNumber; ///< number of pixels in the range image (m_RGBImageWidth*m_RGBImageHeight)
int m_SourceDataSize; ///< size of the PMD source data
itk::MultiThreader::Pointer m_MultiThreader; ///< itk::MultiThreader used for thread handling
itk::FastMutexLock::Pointer m_ImageMutex; ///< mutex for images provided by the range camera
itk::FastMutexLock::Pointer m_CameraActiveMutex; ///< mutex for the cameraActive flag
int m_ThreadID; ///< ID of the started thread
bool m_CameraActive; ///< flag indicating if the camera is currently active or not. Caution: thread safe access only!
bool m_CameraConnected; ///< flag indicating if the camera is successfully connected or not. Caution: thread safe access only!
int m_ImageSequence; ///< counter for acquired images
PropertyList::Pointer m_PropertyList; ///< a list of the corresponding properties
};
} //END mitk namespace
/**
ToFCameraDevice is declared a MicroService interface. See
MicroService documenation for more details.
*/
MITK_DECLARE_SERVICE_INTERFACE(mitk::ToFCameraDevice, "org.mitk.services.ToFCameraDevice")
#endif
diff --git a/Modules/ToFHardware/mitkToFCameraMITKPlayerDevice.h b/Modules/ToFHardware/mitkToFCameraMITKPlayerDevice.h
index 003442b818..52662df0c4 100644
--- a/Modules/ToFHardware/mitkToFCameraMITKPlayerDevice.h
+++ b/Modules/ToFHardware/mitkToFCameraMITKPlayerDevice.h
@@ -1,137 +1,138 @@
/*============================================================================
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 __mitkToFCameraMITKPlayerDevice_h
#define __mitkToFCameraMITKPlayerDevice_h
#include <MitkToFHardwareExports.h>
#include "mitkCommon.h"
#include "mitkToFCameraDevice.h"
#include "mitkToFCameraMITKPlayerController.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
#include "itkMultiThreader.h"
#include "itkFastMutexLock.h"
namespace mitk
{
/**
* @brief Device class representing a player for MITK-ToF images.
*
* @ingroup ToFHardware
*/
class MITKTOFHARDWARE_EXPORT ToFCameraMITKPlayerDevice : public ToFCameraDevice
{
public:
mitkClassMacro( ToFCameraMITKPlayerDevice , ToFCameraDevice );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/*!
\brief opens a connection to the ToF camera
*/
bool OnConnectCamera() override;
/*!
\brief closes the connection to the camera
*/
bool DisconnectCamera() override;
/*!
\brief starts the continuous updating of the camera.
A separate thread updates the source data, the main thread processes the source data and creates images and coordinates
*/
void StartCamera() override;
/*!
\brief gets the amplitude data from the ToF camera as the strength of the active illumination of every pixel. Caution! The user is responsible for allocating and deleting the images.
These values can be used to determine the quality of the distance values. The higher the amplitude value, the higher the accuracy of the according distance value
\param imageSequence the actually captured image sequence number
\param amplitudeArray contains the returned amplitude data as an array.
*/
void GetAmplitudes(float* amplitudeArray, int& imageSequence) override;
/*!
\brief gets the intensity data from the ToF camera as a greyscale image. Caution! The user is responsible for allocating and deleting the images.
\param intensityArray contains the returned intensities data as an array.
\param imageSequence the actually captured image sequence number
*/
void GetIntensities(float* intensityArray, int& imageSequence) override;
/*!
\brief gets the rgb data from the ToF camera. Caution! The user is responsible for allocating and deleting the images.
\param rgbArray contains the returned rgb data as an array.
\param imageSequence the actually captured image sequence number
*/
virtual void GetRgb(unsigned char* rgbArray, int& imageSequence);
/*!
\brief gets the distance data from the ToF camera measuring the distance between the camera and the different object points in millimeters. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distances data as an array.
\param imageSequence the actually captured image sequence number
*/
void GetDistances(float* distanceArray, int& imageSequence) override;
/*!
\brief gets the 3 images (distance, amplitude, intensity) from the ToF camera. Caution! The user is responsible for allocating and deleting the images.
\param distanceArray contains the returned distance data as an array.
\param amplitudeArray contains the returned amplitude data as an array.
\param intensityArray contains the returned intensity data as an array.
\param sourceDataArray contains the complete source data from the camera device.
\param requiredImageSequence the required image sequence number
\param capturedImageSequence the actually captured image sequence number
+ \param rgbDataArray
*/
void GetAllImages(float* distanceArray, float* amplitudeArray, float* intensityArray, char* sourceDataArray,
int requiredImageSequence, int& capturedImageSequence, unsigned char* rgbDataArray=nullptr) override;
/*!
\brief Set file name where the data is recorded
\param inputFileName name of input file which should be played
*/
virtual void SetInputFileName(std::string inputFileName);
/*!
\brief set a BaseProperty
*/
void SetProperty( const char *propertyKey, BaseProperty* propertyValue ) override;
protected:
ToFCameraMITKPlayerDevice();
~ToFCameraMITKPlayerDevice() override;
/*!
\brief updates the camera for image acquisition
*/
void UpdateCamera() override;
/*!
\brief Thread method continuously acquiring images from the specified input file
*/
static ITK_THREAD_RETURN_TYPE Acquire(void* pInfoStruct);
/*!
\brief Clean up memory (pixel buffers)
*/
void CleanUpDataBuffers();
/*!
\brief Allocate pixel buffers
*/
void AllocateDataBuffers();
ToFCameraMITKPlayerController::Pointer m_Controller; ///< member holding the corresponding controller
std::string m_InputFileName; ///< member holding the file name of the current input file
private:
float** m_DistanceDataBuffer; ///< buffer holding the last distance images
float** m_AmplitudeDataBuffer; ///< buffer holding the last amplitude images
float** m_IntensityDataBuffer; ///< buffer holding the last intensity images
unsigned char** m_RGBDataBuffer; ///< buffer holding the last rgb images
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFHardware/mitkToFImageCsvWriter.h b/Modules/ToFHardware/mitkToFImageCsvWriter.h
index 5b9e4e9be8..f429231c97 100644
--- a/Modules/ToFHardware/mitkToFImageCsvWriter.h
+++ b/Modules/ToFHardware/mitkToFImageCsvWriter.h
@@ -1,87 +1,88 @@
/*============================================================================
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 __mitkToFImageCsvWriter_h
#define __mitkToFImageCsvWriter_h
#include "mitkToFImageWriter.h"
#include <MitkToFHardwareExports.h>
namespace mitk
{
/**
* @brief CSV writer class for ToF image data
*
* This writer class allows streaming of ToF data into a CSV file.
* Writer can simultaneously save "distance", "intensity" and "amplitude" image data.
* Output files are written as 1D CSV data stream.
*
* @ingroup ToFHardware
*/
class MITKTOFHARDWARE_EXPORT ToFImageCsvWriter : public ToFImageWriter
{
public:
/*!
\brief standard ctor
*/
ToFImageCsvWriter();
/*!
\brief standard ~ctor
*/
~ToFImageCsvWriter() override;
mitkClassMacro( ToFImageCsvWriter , ToFImageWriter );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self)
/*!
\brief Checks for file extensions and opens the output files
*/
void Open() override;
/*!
\brief Closes the output files
*/
void Close() override;
/*!
\brief Pushes the image data to the output files
\param distanceFloatData from distance image as float value
\param amplitudeFloatData from amplitude image as float value
\param intensityFloatData from intensity image as float value
+ \param rgbData
*/
void Add(float* distanceFloatData, float* amplitudeFloatData, float* intensityFloatData, unsigned char* rgbData=nullptr) override;
protected:
Image::Pointer m_MitkImage; ///< mitk image used for pic header creation
FILE* m_DistanceOutfile; ///< file for distance image
FILE* m_AmplitudeOutfile; ///< file for amplitude image
FILE* m_IntensityOutfile; ///< file for intensity image
private:
/*!
\brief opens CSV output file
\param output file, name of the output file
*/
void OpenCsvFile(FILE** outfile, std::string outfileName);
/*!
\brief closes CSV output file
\param output file
*/
void CloseCsvFile(FILE* outfile);
/*!
\brief writes the data to the CSV output file
\param output file, data array of float values
*/
void WriteCsvFile(FILE* outfile, float* floatData);
};
} //END mitk namespace
#endif // __mitkToFImageCsvWriter_h
diff --git a/Modules/ToFHardware/mitkToFOpenCVImageGrabber.h b/Modules/ToFHardware/mitkToFOpenCVImageGrabber.h
index 390de1eab5..03a64cadd7 100644
--- a/Modules/ToFHardware/mitkToFOpenCVImageGrabber.h
+++ b/Modules/ToFHardware/mitkToFOpenCVImageGrabber.h
@@ -1,101 +1,102 @@
/*============================================================================
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 __mitkToFOpenCVImageGrabber_h
#define __mitkToFOpenCVImageGrabber_h
#include <MitkToFHardwareExports.h>
#include "mitkCommon.h"
#include "mitkOpenCVImageSource.h"
#include "mitkToFImageGrabber.h"
#include "itkObject.h"
#include "itkObjectFactory.h"
namespace mitk
{
/**
* @brief TofImageGrabber class providing OpenCV images
*
*
* @ingroup ToFHardware
*/
class MITKTOFHARDWARE_EXPORT ToFOpenCVImageGrabber : public mitk::OpenCVImageSource
{
public:
ToFOpenCVImageGrabber();
~ToFOpenCVImageGrabber() override;
mitkClassMacro( ToFOpenCVImageGrabber , OpenCVImageSource );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/*!
\brief Get current ToF image. Specify image you want to grab with SetImageType()
*/
cv::Mat GetImage() override;
/*!
\brief set type of image you want to grab.
0: Distance image (Default)
1: Amplitude image
2: Intensity image
*/
void SetImageType(unsigned int imageType);
/*!
\brief set the depth of the image. Some functions of OpenCV do not support IPL_DEPTH_32F.
Warning: changing from default results in a mapping of the pixel value through a lookup table
IPL_DEPTH_1U 1
IPL_DEPTH_8U 8
IPL_DEPTH_16U 16
IPL_DEPTH_32F 32 (Default)
*/
void SetImageDepth(unsigned int imageDepth);
/*!
\brief set the ImageGrabber used for fetching image data from the camera
*/
void SetToFImageGrabber(mitk::ToFImageGrabber::Pointer imageGrabber);
/*!
\brief get the ImageGrabber used for fetching image data from the camera
*/
mitk::ToFImageGrabber::Pointer GetToFImageGrabber();
void StartCapturing();
void StopCapturing();
protected:
/*!
\brief map scalars through lookup table
- \param image current MITK image
+ \param mitkImage current MITK image
+ \param openCVImage
*/
void MapScalars(mitk::Image::Pointer mitkImage, IplImage* openCVImage);
mitk::ToFImageGrabber::Pointer m_ImageGrabber; ///< ImageGrabber used for fetching ToF image data from the camera
unsigned int m_ImageType; ///< type of image currently supplied by this image source
/*!
\brief image depth currently used by this image source.
Warning: Changing from default (IPL_DEPTH_32F) results in a mapping of the pixel value through a lookup table
*/
unsigned int m_ImageDepth;
IplImage* m_CurrentOpenCVIntensityImage; ///< OpenCV image holding the current intensity data
IplImage* m_CurrentOpenCVAmplitudeImage; ///< OpenCV image holding the current amplitude data
IplImage* m_CurrentOpenCVDistanceImage; ///< OpenCV image holding the current distance data
private:
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFProcessing/mitkToFDistanceImageToPointSetFilter.h b/Modules/ToFProcessing/mitkToFDistanceImageToPointSetFilter.h
index eef515cdd0..d7e31f4a04 100644
--- a/Modules/ToFProcessing/mitkToFDistanceImageToPointSetFilter.h
+++ b/Modules/ToFProcessing/mitkToFDistanceImageToPointSetFilter.h
@@ -1,135 +1,135 @@
/*============================================================================
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 __mitkToFDistanceImageToPointSetFilter_h
#define __mitkToFDistanceImageToPointSetFilter_h
#include <mitkCameraIntrinsics.h>
#include "mitkImage.h"
#include "mitkPointSet.h"
#include <mitkPointSetSource.h>
#include "mitkImageSource.h"
#include <mitkToFProcessingCommon.h>
#include <MitkToFProcessingExports.h>
namespace mitk
{
/**
* @brief Converts a Time-of-Flight (ToF) distance image to a PointSet using the pinhole camera model for coordinate computation.
* The intrinsic parameters of the camera (FocalLength, PrincipalPoint, InterPixelDistance) are set via SetIntrinsicParameters(). The
* measured distance for each pixel corresponds to the distance between the object point and the corresponding image point on the
* image plane.
* If a subset of indizes of the image is defined via SetSubset(), the output PointSet will only contain the cartesian coordinates
* of the corresponding 3D points.
*
* The coordinate conversion follows the model of a common pinhole camera where the origin of the camera
* coordinate system (world coordinates) is at the pinhole
- * \image html ../Modules/ToFProcessing/Documentation/PinholeCameraModel.png
+ * \image html Modules/ToFProcessing/Documentation/PinholeCameraModel.png
* The definition of the image plane and its coordinate systems (pixel and mm) is depicted in the following image
- * \image html ../Modules/ToFProcessing/Documentation/ImagePlane.png
+ * \image html Modules/ToFProcessing/Documentation/ImagePlane.png
*
* @ingroup SurfaceFilters
* @ingroup ToFProcessing
*/
class MITKTOFPROCESSING_EXPORT ToFDistanceImageToPointSetFilter : public PointSetSource
{
public:
mitkClassMacro( ToFDistanceImageToPointSetFilter , PointSetSource );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
itkSetMacro(CameraIntrinsics,mitk::CameraIntrinsics::Pointer);
itkGetMacro(CameraIntrinsics,mitk::CameraIntrinsics::Pointer);
itkSetMacro(InterPixelDistance,mitk::ToFProcessingCommon::ToFPoint2D);
itkGetMacro(InterPixelDistance,mitk::ToFProcessingCommon::ToFPoint2D);
using itk::ProcessObject::SetInput;
/*!
\brief Sets the input of this filter
\param distanceImage input is the distance image of e.g. a ToF camera
*/
virtual void SetInput(const Image* distanceImage);
/*!
\brief Sets the input of this filter at idx
\param idx number of the current input
\param distanceImage input is the distance image of e.g. a ToF camera
*/
virtual void SetInput(unsigned int idx, const Image *distanceImage);
/*!
\brief Returns the input of this filter
*/
Image* GetInput();
/*!
\brief Returns the input with id idx of this filter
*/
Image* GetInput(unsigned int idx);
/*!
\brief If this subset is defined, the cartesian coordinates are only computed for the contained indizes. Make sure the indizes are contained in the input image
\param subset index subset specified in index coordinates.
*/
void SetSubset( std::vector<itk::Index<3> > subset);
/*!
\brief Sets the subset of indizes used for caluclation of output PointSet as a PointSet.
Warning: make sure the points in your PointSet are index coordinates.
- \param PointSet specified in index coordinates.
+ \param pointSet specified in index coordinates.
*/
void SetSubset( mitk::PointSet::Pointer pointSet);
/*!
\brief Sets the reconstruction mode, if using no interpixeldistances and focal lenghts in pixel units (=true) or interpixeldistances and focal length in mm (=false)
*/
void SetReconstructionMode(bool withoutInterpixdist = true);
/*!
\brief Returns the reconstruction mode
*/
bool GetReconstructionMode();
protected:
/*!
\brief Standard constructor
*/
ToFDistanceImageToPointSetFilter();
/*!
\brief Standard destructor
*/
~ToFDistanceImageToPointSetFilter() override;
void GenerateOutputInformation() override;
/*!
\brief Method generating the output of this filter. Called in the updated process of the pipeline.
This method generates the output of the ToFSurfaceSource: The generated surface of the 3d points
*/
void GenerateData() override;
/**
* \brief Create an output for each input
*
* This Method sets the number of outputs to the number of inputs
* and creates missing outputs objects.
* \warning any additional outputs that exist before the method is called are deleted
*/
void CreateOutputsForAllInputs();
std::vector<itk::Index<3> > m_Subset; ///< If this subset is specified only the contained indizes are converted to cartesian coordinates
mitk::CameraIntrinsics::Pointer m_CameraIntrinsics; ///< Member holding the intrinsic parameters needed for PointSet calculation
ToFProcessingCommon::ToFPoint2D m_InterPixelDistance; ///< distance in mm between two adjacent pixels on the ToF camera chip
bool m_ReconstructionMode; ///< true = Reconstruction without interpixeldistance and with focal lengths in pixel units. false = Reconstruction with interpixeldistance and with focal length in mm.
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFProcessing/mitkToFDistanceImageToSurfaceFilter.h b/Modules/ToFProcessing/mitkToFDistanceImageToSurfaceFilter.h
index f1cb4f8bb1..1a65814578 100644
--- a/Modules/ToFProcessing/mitkToFDistanceImageToSurfaceFilter.h
+++ b/Modules/ToFProcessing/mitkToFDistanceImageToSurfaceFilter.h
@@ -1,189 +1,190 @@
/*============================================================================
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 __mitkToFDistanceImageToSurfaceFilter_h
#define __mitkToFDistanceImageToSurfaceFilter_h
#include <mitkImage.h>
#include <mitkSurfaceSource.h>
#include <MitkToFProcessingExports.h>
#include <mitkToFProcessingCommon.h>
#include <mitkCameraIntrinsics.h>
#include "mitkCameraIntrinsics.h"
#include <mitkPointSet.h>
#include <vtkSmartPointer.h>
#include <vtkIdList.h>
namespace mitk
{
/**
* @brief Converts a Time-of-Flight (ToF) distance image to a 3D surface using the pinhole camera model for coordinate computation.
* The intrinsic parameters of the camera (FocalLength, PrincipalPoint, InterPixelDistance) are set via SetCameraIntrinsics(). The
* measured distance for each pixel corresponds to the distance between the object point and the corresponding image point on the
* image plane.
*
* The coordinate conversion follows the model of a common pinhole camera where the origin of the camera
* coordinate system (world coordinates) is at the pinhole
- * \image html ../Modules/ToFProcessing/Documentation/PinholeCameraModel.png
+ * \image html Modules/ToFProcessing/Documentation/PinholeCameraModel.png
* The definition of the image plane and its coordinate systems (pixel and mm) is depicted in the following image
- * \image html ../Modules/ToFProcessing/Documentation/ImagePlane.png
+ * \image html Modules/ToFProcessing/Documentation/ImagePlane.png
*
* @ingroup SurfaceFilters
* @ingroup ToFProcessing
*/
class MITKTOFPROCESSING_EXPORT ToFDistanceImageToSurfaceFilter : public SurfaceSource
{
public:
mitkClassMacro( ToFDistanceImageToSurfaceFilter , SurfaceSource );
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
itkSetMacro(CameraIntrinsics, mitk::CameraIntrinsics::Pointer);
itkGetMacro(CameraIntrinsics, mitk::CameraIntrinsics::Pointer);
itkSetMacro(InterPixelDistance,ToFProcessingCommon::ToFPoint2D);
itkGetMacro(InterPixelDistance,ToFProcessingCommon::ToFPoint2D);
itkSetMacro(TextureIndex,int);
/**
* @brief SetTriangulationThreshold Sets a triangulation threshold in order
* to remove unusually huge faces from the surface. If this value is set,
* the filter will check whether the distance between two neighboring vertices
* exceeds the triangulation threshold. If yes, there vertices will not be
* triangulated (connected with lines). The vertices will still be added to
* the surface, but only as single point (if they have no other neighbors).
* @param triangulationThreshold The triangulationThreshold in mm. (not mm*mm!)
* @note vtkMath::Distance2BetweenPoints returns the squared distance
* between two points and hence we square m_TriangulationThreshold in
* order to save run-time.
*/
void SetTriangulationThreshold( double triangulationThreshold );
itkGetMacro(TriangulationThreshold, double);
itkSetMacro(VertexIdList, vtkSmartPointer<vtkIdList>);
itkGetMacro(VertexIdList, vtkSmartPointer<vtkIdList>);
itkSetMacro(GenerateTriangularMesh,bool);
itkGetMacro(GenerateTriangularMesh,bool);
/**
* @brief The ReconstructionModeType enum: Defines the reconstruction mode, if using no interpixeldistances and focal lenghts in pixel units or interpixeldistances and focal length in mm. The Kinect option defines a special reconstruction mode for the kinect.
*/
enum ReconstructionModeType{ WithOutInterPixelDistance = 1, WithInterPixelDistance = 2, Kinect = 3};
itkSetEnumMacro(ReconstructionMode,ReconstructionModeType);
itkGetEnumMacro(ReconstructionMode,ReconstructionModeType);
/*!
\brief Set scalar image used as texture of the surface.
\param iplScalarImage OpenCV image for texturing
*/
void SetScalarImage(IplImage* iplScalarImage);
/*!
\brief Set scalar image used as texture of the surface.
\return OpenCV image for texturing
*/
IplImage* GetScalarImage();
/*!
\brief Set width of the scalar image used for texturing the surface
\param width width (x-dimension) of the texture image
*/
void SetTextureImageWidth(int width);
/*!
\brief Set height of the scalar image used for texturing the surface
\param height height (y-dimension) of the texture image
*/
void SetTextureImageHeight(int height);
using itk::ProcessObject::SetInput;
/*!
\brief Sets the input of this filter
\param distanceImage input is the distance image of e.g. a ToF camera
*/
virtual void SetInput( Image* distanceImage);
/*!
\brief Sets the input of this filter and the intrinsic parameters
\param distanceImage input is the distance image of e.g. a ToF camera
+ \param cameraIntrinsics
*/
virtual void SetInput( Image* distanceImage, mitk::CameraIntrinsics::Pointer cameraIntrinsics );
/*!
\brief Sets the input of this filter at idx
\param idx number of the current input
\param distanceImage input is the distance image of e.g. a ToF camera
*/
virtual void SetInput(unsigned int idx, Image* distanceImage);
/*!
\brief Sets the input of this filter at idx and the intrinsic parameters
\param idx number of the current input
\param distanceImage input is the distance image of e.g. a ToF camera
\param cameraIntrinsics This is the camera model which holds parameters like focal length, pixel size, etc. which are needed for the reconstruction of the surface.
*/
virtual void SetInput( unsigned int idx, Image* distanceImage, mitk::CameraIntrinsics::Pointer cameraIntrinsics );
/*!
\brief Returns the input of this filter
*/
Image* GetInput();
/*!
\brief Returns the input with id idx of this filter
*/
Image* GetInput(unsigned int idx);
protected:
/*!
\brief Standard constructor
*/
ToFDistanceImageToSurfaceFilter();
/*!
\brief Standard destructor
*/
~ToFDistanceImageToSurfaceFilter() override;
void GenerateOutputInformation() override;
/*!
\brief Method generating the output of this filter. Called in the updated process of the pipeline.
This method generates the output of the ToFSurfaceSource: The generated surface of the 3d points
*/
void GenerateData() override;
/**
* \brief Create an output for each input
*
* This Method sets the number of outputs to the number of inputs
* and creates missing outputs objects.
* \warning any additional outputs that exist before the method is called are deleted
*/
void CreateOutputsForAllInputs();
IplImage* m_IplScalarImage; ///< Scalar image used for surface texturing
mitk::CameraIntrinsics::Pointer m_CameraIntrinsics; ///< Specifies the intrinsic parameters
int m_TextureImageWidth; ///< Width (x-dimension) of the texture image
int m_TextureImageHeight; ///< Height (y-dimension) of the texture image
ToFProcessingCommon::ToFPoint2D m_InterPixelDistance; ///< distance in mm between two adjacent pixels on the ToF camera chip
int m_TextureIndex; ///< Index of the input used as texture image when no scalar image was set via SetIplScalarImage(). 0 = Distance, 1 = Amplitude, 2 = Intensity
bool m_GenerateTriangularMesh;
ReconstructionModeType m_ReconstructionMode; ///< The ReconstructionModeType enum: Defines the reconstruction mode, if using no interpixeldistances and focal lenghts in pixel units or interpixeldistances and focal length in mm. The Kinect option defines a special reconstruction mode for the kinect.
vtkSmartPointer<vtkIdList> m_VertexIdList; ///< Make a vtkIdList to save the ID's of the polyData corresponding to the image pixel ID's. This can be accessed after generate data to obtain the mapping.
double m_TriangulationThreshold;
};
} //END mitk namespace
#endif
diff --git a/Modules/ToFProcessing/mitkToFImageDownsamplingFilter.h b/Modules/ToFProcessing/mitkToFImageDownsamplingFilter.h
index 48010ea256..80f1b164bf 100644
--- a/Modules/ToFProcessing/mitkToFImageDownsamplingFilter.h
+++ b/Modules/ToFProcessing/mitkToFImageDownsamplingFilter.h
@@ -1,81 +1,79 @@
/*============================================================================
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 __mitkToFImageDownsamplingFilter_h
#define __mitkToFImageDownsamplingFilter_h
//MITK includes
#include <mitkImage.h>
#include "mitkImageToImageFilter.h"
#include <MitkToFProcessingExports.h>
// ITK includes
#include "itkImage.h"
namespace mitk
{
/**
* @brief Reduces the resolution of a ToF distance image. Although it is meant to be used for ToF distance images, it should work
* for any 2D or 3D images. The dimensions (in pixels) of the desired image are taken as input parameters, and an image with these
* specified dimensions is created.
*
* @ingroup SurfaceFilters
* @ingroup ToFProcessing
*/
class MITKTOFPROCESSING_EXPORT ToFImageDownsamplingFilter : public ImageToImageFilter
{
public:
mitkClassMacro(ToFImageDownsamplingFilter, ImageToImageFilter);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
itkSetMacro(ResampledX,double);
itkGetMacro(ResampledX,double);
itkSetMacro(ResampledY,double);
itkGetMacro(ResampledY,double);
itkSetMacro(ResampledZ,double);
itkGetMacro(ResampledZ,double);
protected:
/*!
\brief Standard constructor
*/
ToFImageDownsamplingFilter();
/*!
\brief Standard destructor
*/
~ToFImageDownsamplingFilter() override;
/*!
\brief Method generating the output of this filter. Called in the updated process of the pipeline.
This method calls the AccessFixedDimensionByItk class with the ItkImageResampling function below
*/
void GenerateData() override;
/*!
\brief Templated method for ITK image type which performs the resampling with an itk filter.
\param itkImage is the input to the filter converted to ITK format
- \param TPixel is a pixel type such as float or char or double
- \param VImageDimension is the image dimension (2D or 3D)
*/
template<typename TPixel, unsigned int VImageDimension>
void ItkImageResampling( const itk::Image<TPixel,VImageDimension>* itkImage );
double m_ResampledX;///< length of x dimension of output image in pixels
double m_ResampledY;///< length of y dimension of output image in pixels
double m_ResampledZ;///< length of z dimension of output image in pixels (if 2D, default is set to 1)
};
}// end namespace mitk
#endif
diff --git a/Modules/ToFProcessing/mitkToFProcessingCommon.h b/Modules/ToFProcessing/mitkToFProcessingCommon.h
index 8944ce73c3..02cecea635 100644
--- a/Modules/ToFProcessing/mitkToFProcessingCommon.h
+++ b/Modules/ToFProcessing/mitkToFProcessingCommon.h
@@ -1,341 +1,338 @@
/*============================================================================
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 MITKTOFPROCESSINGCOMMON_H
#define MITKTOFPROCESSINGCOMMON_H
#include <MitkToFProcessingExports.h>
#include <mitkCameraIntrinsics.h>
#include "mitkNumericTypes.h"
#include <vnl/vnl_math.h>
namespace mitk
{
/**
* @brief Helper class providing functions which are useful for multiple usage
*
* Currently the following methods are provided:
* <ul>
* <li> Conversion from 2D image coordinates to 3D world coordinates (IndexToCartesianCoordinates())
* <li> Conversion from 3D world coordinates to 2D image coordinates (CartesianToIndexCoordinates())
* </ul>
* The coordinate conversion follows the model of a common pinhole camera where the origin of the camera
* coordinate system (world coordinates) is at the pinhole
- * \image html ../Modules/ToFProcessing/Documentation/PinholeCameraModel.png
+ * \image html Modules/ToFProcessing/Documentation/PinholeCameraModel.png
* The definition of the image plane and its coordinate systems (pixel and mm) is depicted in the following image
- * \image html ../Modules/ToFProcessing/Documentation/ImagePlane.png
+ * \image html Modules/ToFProcessing/Documentation/ImagePlane.png
* @ingroup ToFProcessing
*/
class MITKTOFPROCESSING_EXPORT ToFProcessingCommon
{
public:
typedef double ToFScalarType;
typedef itk::Point<ToFScalarType, 2> ToFPoint2D;
typedef itk::Point<ToFScalarType, 3> ToFPoint3D;
typedef itk::Vector<ToFScalarType, 2> ToFVector2D;
typedef itk::Vector<ToFScalarType, 3> ToFVector3D;
/*!
\brief Convert index based distances to cartesian coordinates
\param i index in x direction of image plane
\param j index in y direction of image plane
\param distance distance value at given index in mm
\param focalLengthX focal length of optical system in pixel units in x-direction (mostly obtained from camera calibration)
\param focalLengthY focal length of optical system in pixel units in y-direction (mostly obtained from camera calibration)
\param principalPointX x coordinate of principal point on image plane in pixel
\param principalPointY y coordinate of principal point on image plane in pixel
\return cartesian coordinates for current index will be written here
*/
static ToFPoint3D IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance,
ToFScalarType focalLengthX, ToFScalarType focalLengthY, ToFScalarType principalPointX, ToFScalarType principalPointY);
/*!
\brief Convert index based distances to cartesian coordinates
\param i index in x direction of image plane
\param j index in y direction of image plane
\param distance distance value at given index in mm
\param focalLength focal length of optical system in pixel units (mostly obtained from camera calibration)
\param principalPoint coordinates of principal point on image plane in pixel
\return cartesian coordinates for current index will be written here
*/
static ToFPoint3D IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance,
ToFPoint2D focalLength, ToFPoint2D principalPoint)
{
return IndexToCartesianCoordinates(i,j,distance,focalLength[0],focalLength[1],principalPoint[0],principalPoint[1]);
}
/*!
\brief Convert index based distances to cartesian coordinates
\param index index coordinates
\param distance distance value at given index in mm
\param focalLength focal length of optical system in pixel units (mostly obtained from camera calibration)
\param principalPoint coordinates of principal point on image plane in pixel
\return cartesian coordinates for current index will be written here
*/
static ToFPoint3D IndexToCartesianCoordinates(itk::Index<3> index, ToFScalarType distance,
ToFPoint2D focalLength, ToFPoint2D principalPoint)
{
return IndexToCartesianCoordinates(index[0],index[1],distance,focalLength[0],focalLength[1],principalPoint[0], principalPoint[1]);
}
/*!
\brief Convenience method to convert index based distances to cartesian coordinates using array as input
\param i index in x direction of image plane
\param j index in y direction of image plane
\param distance distance value at given index in mm
\param focalLength focal length of optical system in pixel units (mostly obtained from camera calibration)
\param principalPoint coordinates of principal point on image plane in pixel
\return cartesian coordinates for current index will be written here
*/
static ToFPoint3D IndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance,
ToFScalarType focalLength[2], ToFScalarType principalPoint[2])
{
return IndexToCartesianCoordinates(i,j,distance,focalLength[0],focalLength[1],principalPoint[0],principalPoint[1]);
}
/*!
\brief Convert index based distances to cartesian coordinates
\param i index in x direction of image plane
\param j index in y direction of image plane
\param distance distance value at given index in mm
\param focalLength focal length of optical system in mm (mostly obtained from camera calibration)
\param interPixelDistanceX distance in x direction between adjacent pixels in mm
\param interPixelDistanceY distance in y direction between adjacent pixels in mm
\param principalPointX x coordinate of principal point on image plane in pixel
\param principalPointY y coordinate of principal point on image plane in pixel
\return cartesian coordinates for current index will be written here
*/
static ToFPoint3D IndexToCartesianCoordinatesWithInterpixdist(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength,
ToFScalarType interPixelDistanceX, ToFScalarType interPixelDistanceY, ToFScalarType principalPointX, ToFScalarType principalPointY);
/*!
\brief Convert index based distances to cartesian coordinates
\param i index in x direction of image plane
\param j index in y direction of image plane
\param distance distance value at given index in mm
\param focalLength focal length of optical system in mm (mostly obtained from camera calibration)
\param interPixelDistance distance between adjacent pixels in mm
\param principalPoint coordinates of principal point on image plane in pixel
\return cartesian coordinates for current index will be written here
*/
static ToFPoint3D IndexToCartesianCoordinatesWithInterpixdist(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength,
ToFPoint2D interPixelDistance, ToFPoint2D principalPoint)
{
return IndexToCartesianCoordinatesWithInterpixdist(i,j,distance,focalLength,interPixelDistance[0],interPixelDistance[1],principalPoint[0],principalPoint[1]);
}
/*!
\brief Convert index based distances to cartesian coordinates
\param index index coordinates
\param distance distance value at given index in mm
\param focalLength focal length of optical system (mostly obtained from camera calibration)
\param interPixelDistance distance between adjacent pixels in mm for x and y direction
\param principalPoint coordinates of principal point on image plane in pixel
\return cartesian coordinates for current index will be written here
*/
static ToFPoint3D IndexToCartesianCoordinatesWithInterpixdist(itk::Index<3> index, ToFScalarType distance, ToFScalarType focalLength,
ToFPoint2D interPixelDistance, ToFPoint2D principalPoint)
{
return IndexToCartesianCoordinatesWithInterpixdist(index[0],index[1],distance,focalLength,interPixelDistance[0], interPixelDistance[1],principalPoint[0], principalPoint[1]);
}
/*!
\brief Convenience method to convert index based distances to cartesian coordinates using array as input
\param i index in x direction of image plane
\param j index in y direction of image plane
\param distance distance value at given index in mm
\param focalLength focal length of optical system in mm (mostly obtained from camera calibration)
\param interPixelDistance distance between adjacent pixels in mm
\param principalPoint coordinates of principal point on image plane in pixel
\return cartesian coordinates for current index will be written here
*/
static ToFPoint3D IndexToCartesianCoordinatesWithInterpixdist(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLength,
ToFScalarType interPixelDistance[2], ToFScalarType principalPoint[2])
{
return IndexToCartesianCoordinatesWithInterpixdist(i,j,distance,focalLength,interPixelDistance[0],interPixelDistance[1],principalPoint[0],principalPoint[1]);
}
/*!
\brief Convert cartesian coordinates to index based distances
\param cartesianPointX x coordinate of point (of a surface or point set) to convert in 3D coordinates
\param cartesianPointY y coordinate of point (of a surface or point set) to convert in 3D coordinates
\param cartesianPointZ z coordinate of point (of a surface or point set) to convert in 3D coordinates
\param focalLengthX focal length of optical system in pixel units in x-direction (mostly obtained from camera calibration)
\param focalLengthY focal length of optical system in pixel units in y-direction (mostly obtained from camera calibration)
\param principalPointX x coordinate of principal point on image plane in pixel
\param principalPointY y coordinate of principal point on image plane in pixel
\param calculateDistance if this flag is set, the distance value is stored in the z position of the output otherwise z=0
\return a ToFPoint3D. (int)ToFPoint3D[0]+0.5 and (int)ToFPoint3D[0]+0.5 will return the x and y index coordinates. ToFPoint3D[2] contains the distance value
*/
static ToFPoint3D CartesianToIndexCoordinates(ToFScalarType cartesianPointX, ToFScalarType cartesianPointY,ToFScalarType cartesianPointZ,
ToFScalarType focalLengthX, ToFScalarType focalLengthY,
ToFScalarType principalPointX, ToFScalarType principalPointY, bool calculateDistance=true);
/*!
\brief Convenience method to convert cartesian coordinates to index based distances using arrays
\param cartesianPoint point (of a surface or point set) to convert in 3D coordinates
\param focalLength focal length of optical system in pixel units (mostly obtained from camera calibration)
\param principalPoint coordinates of principal point on image plane in pixel
\param calculateDistance if this flag is set, the distance value is stored in the z position of the output otherwise z=0
\return a ToFPoint3D. (int)ToFPoint3D[0]+0.5 and (int)ToFPoint3D[0]+0.5 will return the x and y index coordinates. ToFPoint3D[2] contains the distance value
*/
static ToFPoint3D CartesianToIndexCoordinates(ToFScalarType cartesianPoint[3], ToFScalarType focalLength[2],
ToFScalarType principalPoint[2], bool calculateDistance=true)
{
return CartesianToIndexCoordinates(cartesianPoint[0],cartesianPoint[1],cartesianPoint[2],focalLength[0], focalLength[1],
principalPoint[0],principalPoint[1],calculateDistance);
}
/*!
\brief Convert cartesian coordinates to index based distances
\param cartesianPoint point (of a surface or point set) to convert in 3D coordinates
\param focalLength focal length of optical system in pixel units (mostly obtained from camera calibration)
\param principalPoint coordinates of principal point on image plane in pixel
\param calculateDistance if this flag is set, the distance value is stored in the z position of the output otherwise z=0
\return a ToFPoint3D. (int)ToFPoint3D[0]+0.5 and (int)ToFPoint3D[0]+0.5 will return the x and y index coordinates. ToFPoint3D[2] contains the distance value
*/
static ToFPoint3D CartesianToIndexCoordinates(ToFPoint3D cartesianPoint, ToFPoint2D focalLength,
ToFPoint2D principalPoint, bool calculateDistance=true)
{
return CartesianToIndexCoordinates(cartesianPoint[0],cartesianPoint[1],cartesianPoint[2],focalLength[0], focalLength[1],
principalPoint[0],principalPoint[1],calculateDistance);
}
/*!
\brief Convert cartesian coordinates to index based distances
\param cartesianPointX x coordinate of point (of a surface or point set) to convert in 3D coordinates
\param cartesianPointY y coordinate of point (of a surface or point set) to convert in 3D coordinates
\param cartesianPointZ z coordinate of point (of a surface or point set) to convert in 3D coordinates
\param focalLength focal length of optical system in mm (mostly obtained from camera calibration)
\param interPixelDistanceX distance in x direction between adjacent pixels in mm
\param interPixelDistanceY distance in y direction between adjacent pixels in mm
\param principalPointX x coordinate of principal point on image plane in pixel
\param principalPointY y coordinate of principal point on image plane in pixel
\param calculateDistance if this flag is set, the distance value is stored in the z position of the output otherwise z=0
\return a ToFPoint3D. (int)ToFPoint3D[0]+0.5 and (int)ToFPoint3D[0]+0.5 will return the x and y index coordinates. ToFPoint3D[2] contains the distance value
*/
static ToFPoint3D CartesianToIndexCoordinatesWithInterpixdist(ToFScalarType cartesianPointX, ToFScalarType cartesianPointY,ToFScalarType cartesianPointZ,
ToFScalarType focalLength, ToFScalarType interPixelDistanceX, ToFScalarType interPixelDistanceY,
ToFScalarType principalPointX, ToFScalarType principalPointY, bool calculateDistance=true);
/*!
\brief Convenience method to convert cartesian coordinates to index based distances using arrays
\param cartesianPoint point (of a surface or point set) to convert in 3D coordinates
\param focalLength focal length of optical system in mm (mostly obtained from camera calibration)
\param interPixelDistance distance between adjacent pixels in mm for x and y direction
\param principalPoint coordinates of principal point on image plane in pixel
\param calculateDistance if this flag is set, the distance value is stored in the z position of the output otherwise z=0
\return a ToFPoint3D. (int)ToFPoint3D[0]+0.5 and (int)ToFPoint3D[0]+0.5 will return the x and y index coordinates. ToFPoint3D[2] contains the distance value
*/
static ToFPoint3D CartesianToIndexCoordinatesWithInterpixdist(ToFScalarType cartesianPoint[3], ToFScalarType focalLength,
ToFScalarType interPixelDistance[2], ToFScalarType principalPoint[2],
bool calculateDistance=true)
{
return CartesianToIndexCoordinatesWithInterpixdist(cartesianPoint[0],cartesianPoint[1],cartesianPoint[2],focalLength,
interPixelDistance[0],interPixelDistance[1],principalPoint[0],principalPoint[1],calculateDistance);
}
/*!
\brief Convert cartesian coordinates to index based distances
\param cartesianPoint point (of a surface or point set) to convert in 3D coordinates
\param focalLength focal length of optical system in mm (mostly obtained from camera calibration)
\param interPixelDistance distance between adjacent pixels in mm for x and y direction
\param principalPoint coordinates of principal point on image plane in pixel
\param calculateDistance if this flag is set, the distance value is stored in the z position of the output otherwise z=0
\return a ToFPoint3D. (int)ToFPoint3D[0]+0.5 and (int)ToFPoint3D[0]+0.5 will return the x and y index coordinates. ToFPoint3D[2] contains the distance value
*/
static ToFPoint3D CartesianToIndexCoordinatesWithInterpixdist(ToFPoint3D cartesianPoint, ToFScalarType focalLength,
ToFPoint2D interPixelDistance, ToFPoint2D principalPoint, bool calculateDistance=true)
{
return CartesianToIndexCoordinatesWithInterpixdist(cartesianPoint[0],cartesianPoint[1],cartesianPoint[2],focalLength,
interPixelDistance[0],interPixelDistance[1],principalPoint[0],principalPoint[1],calculateDistance);
}
/** \ingroup KinectReconstruction
- * @{
- *
* @brief KinectIndexToCartesianCoordinates Convert a pixel (i,j) with value d to a 3D world point. This conversion is meant for Kinect and slightly different then ToF reconstruction. See also "Hacking the Kinect" - Jeff Kramer, Matt Parker, Daniel Herrera C., Nicolas Burrus, Florian Echtler, Chapter 7, Part 1 "Moving from Depth Map to Point Cloud.
* @param i Pixel index i.
* @param j Pixel index j.
* @param distance Distance value d in mm as obtained from OpenNI.
* @param focalLengthX Focallength from calibration.
* @param focalLengthY Focallength from calibration.
* @param principalPointX Principal point from calibration.
* @param principalPointY Principal point from calibration.
* @return a ToFPoint3D. The point in world coordinates (mm).
*/
static ToFProcessingCommon::ToFPoint3D KinectIndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance, ToFScalarType focalLengthX, ToFScalarType focalLengthY, ToFScalarType principalPointX, ToFScalarType principalPointY);
static ToFPoint3D KinectIndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance,
ToFScalarType focalLength[2], ToFScalarType principalPoint[2])
{
return KinectIndexToCartesianCoordinates(i,j,distance,focalLength[0],focalLength[1],principalPoint[0],principalPoint[1]);
}
static ToFPoint3D KinectIndexToCartesianCoordinates(unsigned int i, unsigned int j, ToFScalarType distance,
ToFPoint2D focalLength, ToFPoint2D principalPoint)
{
return KinectIndexToCartesianCoordinates(i,j,distance,focalLength[0],focalLength[1],principalPoint[0],principalPoint[1]);
}
static ToFPoint3D KinectIndexToCartesianCoordinates(itk::Index<3> index, ToFScalarType distance, ToFPoint2D focalLength, ToFPoint2D principalPoint)
{
return KinectIndexToCartesianCoordinates(index[0],index[1],distance,focalLength[0],focalLength[1],principalPoint[0], principalPoint[1]);
}
- /** @}*/
+
/** \ingroup KinectReconstructionInverse
- * @{
* @brief CartesianCoordinatesToKinectIndexCoordinates Transform a 3D world point back to distance image pixel coordinates.
* @param cartesianPointX x value of the cartesian point.
* @param cartesianPointY y value of the cartesian point.
* @param cartesianPointZ z value of the cartesian point.
* @param focalLengthX x value of the focal length (from calibration).
* @param focalLengthY y value of the focal length (from calibration).
* @param principalPointX x value of the principal point (from calibration).
* @param principalPointY y value of the principal point (from calibration).
* @param calculateDistance Do you want to compute also the distance of the distance image? For Kinect, this value is always the same in cartesian and index coordinates.
* @return A ToFPoint3D containing the pixel indices (i,j) in [0] and [1] and (optionally) the distance value in [2] (or just 0.0).
*/
static ToFPoint3D CartesianToKinectIndexCoordinates(ToFScalarType cartesianPointX, ToFScalarType cartesianPointY,
ToFScalarType cartesianPointZ, ToFScalarType focalLengthX,
ToFScalarType focalLengthY, ToFScalarType principalPointX,
ToFScalarType principalPointY, bool calculateDistance=true);
static ToFProcessingCommon::ToFPoint3D CartesianToKinectIndexCoordinates(ToFPoint3D cartesianPoint, ToFPoint2D focalLength, ToFPoint2D principalPoint, bool calculateDistance=true)
{
return CartesianToKinectIndexCoordinates( cartesianPoint[0], cartesianPoint[1], cartesianPoint[2], focalLength[0], focalLength[1], principalPoint[0], principalPoint[1], calculateDistance);
}
- /** @}*/
+
/**
* @brief ContinuousKinectIndexToCartesianCoordinates This method is escpially meant for reconstructing a Kinect point
* with continuous index coordinates (i.e. not exactly a pixel position, but a point interpolated between two pixels).
* The only difference to KinectIndexToCartesianCoordinates() is that ContinuousKinectIndexToCartesianCoordinates does not
* cast to unsigned int for the index.
* @param continuousIndex The continuous coordinates (e.g. 0.5; 0.5).
* @param distance Distance value d in mm as obtained from OpenNI.
* @param focalLengthX x value of the focal length (from calibration).
* @param focalLengthY y value of the focal length (from calibration)
* @param principalPointX x value of the principal point (from calibration).
* @param principalPointY y value of the principal point (from calibration).
* @return a ToFPoint3D. The point in world coordinates (mm).
*/
static ToFProcessingCommon::ToFPoint3D ContinuousKinectIndexToCartesianCoordinates(mitk::Point2D continuousIndex, ToFScalarType distance, ToFScalarType focalLengthX, ToFScalarType focalLengthY, ToFScalarType principalPointX, ToFScalarType principalPointY);
/**
\brief Calculates the horizontal view angle of the camera with the given intrinsics
\param intrinsics intrinsic parameters of the camera
\param dimX dimension of the image in horizontal direction
angle = atan(principalPoint[0]/focalLength[0]) + atan((dimX-principalPoint[0]/focalLength[0]))
**/
static ToFScalarType CalculateViewAngle(mitk::CameraIntrinsics::Pointer intrinsics, unsigned int dimX);
};
}
#endif
diff --git a/Modules/ToFUI/Qmitk/QmitkToFCompositeFilterWidget.h b/Modules/ToFUI/Qmitk/QmitkToFCompositeFilterWidget.h
index 919b7334a0..636b1432e9 100644
--- a/Modules/ToFUI/Qmitk/QmitkToFCompositeFilterWidget.h
+++ b/Modules/ToFUI/Qmitk/QmitkToFCompositeFilterWidget.h
@@ -1,171 +1,171 @@
/*============================================================================
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 _QMITKTOFCOMPOSITEFILTERWIDGET_H_INCLUDED
#define _QMITKTOFCOMPOSITEFILTERWIDGET_H_INCLUDED
#include <MitkToFUIExports.h>
#include "ui_QmitkToFCompositeFilterWidgetControls.h"
//mitk headers
#include <mitkToFCompositeFilter.h>
/**
* @brief Widget for controlling the ToFCompositeFilter (located in module ToFProcessing)
*
* The widget allows to enable/disable the filters internally used in the ToFCompositeFilter
* and to set the individual filter parameters using GUI elements
*
* @ingroup ToFUI
*/
class MITKTOFUI_EXPORT QmitkToFCompositeFilterWidget :public QWidget
{
//this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
Q_OBJECT
public:
static const std::string VIEW_ID;
QmitkToFCompositeFilterWidget(QWidget* p = nullptr, Qt::WindowFlags f1 = nullptr);
~QmitkToFCompositeFilterWidget() override;
/* @brief This method is part of the widget an needs not to be called seperately. */
virtual void CreateQtPartControl(QWidget *parent);
/* @brief This method is part of the widget an needs not to be called seperately. (Creation of the connections of main and control widget.)*/
virtual void CreateConnections();
/*!
\brief Sets the ToFCompositeFilter used by this widget
- \param tofCompositeFilter pointer to the internally used ToFCompositeFilter
+ \param toFCompositeFilter pointer to the internally used ToFCompositeFilter
*/
void SetToFCompositeFilter(mitk::ToFCompositeFilter* toFCompositeFilter);
/*!
\brief Returns the ToFCompositeFilter used by this widget
\return tofCompositeFilter pointer to the internally used ToFCompositeFilter
*/
mitk::ToFCompositeFilter* GetToFCompositeFilter();
/*!
\brief update parameters of ToFCompositeFilter according to current GUI setting
*/
void UpdateFilterParameter();
/*!
\brief set the configuration of the widget specifying which filter is enabled on start
*/
void SetWidgetConfiguration(bool threshold, bool mask, bool tempMedian, bool tempAverage, bool median, bool bilateral );
/*!
\brief sets the standard parameters used for the bilateral filter to the ComboBoxes used in the GUI
\param domainSigma Parameter controlling the smoothing effect of the bilateral filter. Default value: 2
\param rangeSigma Parameter controlling the edge preserving effect of the bilateral filter. Default value: 60
\param kernelRadius radius of the filter mask of the bilateral filter
*/
void SetStandardParametersBilateralFilter(double domainSigma, double rangeSigma, int kernelRadius=0);
/*!
\brief set the standard parameters for the threshold filter to the combo boxes in the GUI
\param min lower threshold of the threshold filter
\param max upper threshold of the threshold filter
*/
void SetStandardParametersThresholdFilter(int min, int max);
/*!
\brief set the standard value for the number of images to be averaged to the combo box in the GUI
*/
void SetStandardParameterTemporalAveraging(int nImages);
void SetDataStorage(mitk::DataStorage::Pointer dataStorage);
signals:
protected slots:
/**
* @brief OnShowAdvancedOptionsCheckboxChecked Show/hide advanced options.
* @param checked show/hide
*/
void OnShowAdvancedOptionsCheckboxChecked(bool checked);
/*!
\brief slot en-/disabling temporal median filter in internal ToFCompositeFilter
*/
void OnTemporalMedianFilterCheckBoxChecked(bool checked);
/*!
\brief slot en-/disabling average filter in internal ToFCompositeFilter
*/
void OnAverageFilterCheckBoxChecked(bool checked);
/*!
\brief slot en-/disabling threshold filter in internal ToFCompositeFilter
*/
void OnThresholdFilterCheckBoxChecked(bool checked);
/*!
\brief slot en-/disabling the mask segmentation in internal ToFCompositeFilter
*/
void OnMaskSegmentationCheckBoxChecked(bool checked);
/*!
\brief slot en-/disabling median filter in internal ToFCompositeFilter
*/
void OnMedianFilterCheckBoxChecked(bool checked);
/*!
\brief slot en-/disabling bilateral filter in internal ToFCompositeFilter
*/
void OnBilateralFilterCheckBoxChecked(bool checked);
/*!
\brief slot updating threshold spin boxes according to slider position
*/
void OnSpanChanged(int lower, int upper);
/*!
\brief slot resetting threshold range slider to default values (min: 1, max: 7000)
*/
void OnResetThresholdFilterRangeSlider();
/*!
\brief slot updating the parameter "number of frames" of the temporal median filter in the ToFCompositeFilter
*/
void OnTemporalMedianFilterNumOfFramesSpinBoxValueChanged(int value);
/*!
\brief slot updating the parameter "domain sigma" of the bilateral filter in the ToFCompositeFilter
*/
void OnBilateralFilterDomainSigmaSpinBoxValueChanged(double value);
/*!
\brief slot updating the paramter "range sigma" of the bilateral filter in the ToFCompositeFilter
*/
void OnBilateralFilterRangeSigmaSpinBoxValueChanged(double value);
/*!
\brief slot updating the paramter "kernel radius" of the bilateral filter in the ToFCompositeFilter
*/
void OnBilateralFilterKernelRadiusSpinBoxValueChanged(int value);
/*!
\brief slot updating the paramter "minimal threshold" of the threshold filter in the ToFCompositeFilter
*/
void OnThresholdFilterMinValueChanged(int value);
/*!
\brief slot updating the paramter "maximal threshold" of the threshold filter in the ToFCompositeFilter
*/
void OnThresholdFilterMaxValueChanged(int value);
protected:
Ui::QmitkToFCompositeFilterWidgetControls* m_Controls; ///< member holding the UI elements of this widget
mitk::ToFCompositeFilter::Pointer m_ToFCompositeFilter; ///< member holding the internally used ToFCompositeFilter
private:
/*!
\brief method updating the parameters of the bilateral filter in the ToFCompositeFilter
*/
void SetBilateralFilterParameter();
/*!
\brief method updating the parameters of the threshold filter in the ToFCompositeFilter
*/
void SetThresholdFilterParameter();
mitk::DataStorage::Pointer m_DataStorage;
};
#endif // _QMITKTOFCOMPOSITEFILTERWIDGET_H_INCLUDED
diff --git a/Modules/ToFUI/Qmitk/QmitkToFPointSetWidget.h b/Modules/ToFUI/Qmitk/QmitkToFPointSetWidget.h
index 13e4203e74..c07f7fc4c3 100644
--- a/Modules/ToFUI/Qmitk/QmitkToFPointSetWidget.h
+++ b/Modules/ToFUI/Qmitk/QmitkToFPointSetWidget.h
@@ -1,144 +1,144 @@
/*============================================================================
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 _QmitkToFPointSetWidget_H_INCLUDED
#define _QmitkToFPointSetWidget_H_INCLUDED
#include <MitkToFUIExports.h>
#include "ui_QmitkToFPointSetWidgetControls.h"
//mitk headers
#include <mitkCameraIntrinsics.h>
#include <mitkDataStorage.h>
#include <mitkPointSet.h>
#include <mitkPointSetDataInteractor.h>
#include <mitkPropertyList.h>
#include <mitkTextAnnotation2D.h>
#include <mitkToFDistanceImageToPointSetFilter.h>
//Qmitk headers
#include <QmitkRenderWindow.h>
// vtk includes
#include <vtkSmartPointer.h>
#include <vtkTextActor.h>
#include <vtkRenderer.h>
/**
* @brief Widget allowing interaction with point sets for measurement and PointSet definition
*
* The widget allows to
* 1. Measure the distance between two points in 3D ToF space by clicking the points in the 2D slices
* 2. Defining a ToF PointSet both in 2D and 3D. CameraIntrinsics are used for calculation between 2D and 3D
*
* NOTE:
* You have to make sure that the widget is initialized at a position in the plugin using it, where the distance
* image is available. CleanUp has to be called to make sure that all observers and renderers are removed correctly.
*
* @ingroup ToFUI
*/
class MITKTOFUI_EXPORT QmitkToFPointSetWidget :public QWidget
{
//this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
Q_OBJECT
public:
static const std::string VIEW_ID;
QmitkToFPointSetWidget(QWidget* p = nullptr, Qt::WindowFlags f1 = nullptr);
~QmitkToFPointSetWidget() override;
/* @brief This method is part of the widget an needs not to be called seperately. */
virtual void CreateQtPartControl(QWidget *parent);
/* @brief This method is part of the widget an needs not to be called seperately. (Creation of the connections of main and control widget.)*/
virtual void CreateConnections();
/*!
\brief initializes the widget. Observers to the change events of the point sets are created, text actors are activated
to be rendered into the foreground of the render window.
- \param stdMultiWidget QmitkStdMultiWidget used for painting overlays for measurement
+ \param renderWindowHashMap
\param dataStorage DataStorage to add PointSets
- \param distanceImage range image used to calculate 3D PointSet from 2D index
+ \param cameraIntrinsics
*/
void InitializeWidget(QHash<QString, QmitkRenderWindow*> renderWindowHashMap, mitk::DataStorage::Pointer dataStorage, mitk::CameraIntrinsics::Pointer cameraIntrinsics=nullptr);
/*!
\brief cleans up the widget when it's functionality is not used anymore.
Removes observers and deletes foreground renderer
*/
void CleanUpWidget();
/*!
\brief set the image holding the distance information used for measuring
*/
void SetDistanceImage(mitk::Image::Pointer distanceImage);
/*!
\brief Set intrinsic parameters of the used device
*/
void SetCameraIntrinsics(mitk::CameraIntrinsics::Pointer cameraIntrinsics);
signals:
protected slots:
/*!
\brief Activates the interactor for the measurement point set
*/
void OnMeasurement();
/*!
\brief Activates the interactor for the point set
*/
void OnPointSet();
protected:
/*!
\brief function called when the 2D measurement PointSet has changed
*/
void MeasurementPointSetChanged();
/*!
\brief function called when the 2D PointSet has changed
*/
void PointSetChanged();
Ui::QmitkToFPointSetWidgetControls* m_Controls; ///< member holding the UI elements of this widget
mitk::DataStorage::Pointer m_DataStorage; ///< member holding the set DataStorage
mitk::Image::Pointer m_DistanceImage; ///< image holding the range data of the ToF camera
mitk::CameraIntrinsics::Pointer m_CameraIntrinsics; ///< intrinsic parameters of the camera
mitk::TextAnnotation2D::Pointer m_TextAnnotationAxial; ///< text annotation used to display measurements in axial window
mitk::TextAnnotation2D::Pointer m_TextAnnotationSagittal; ///< text annotation used to display measurement in axial window
mitk::TextAnnotation2D::Pointer m_TextAnnotationCoronal; ///< text annotation used to display measurement in axial window
mitk::TextAnnotation2D::Pointer m_TextAnnotation3D; ///< text annotation used to display measurement in 3d window
mitk::VtkPropRenderer::Pointer m_RendererAxial; ///< renderer of axial render window
mitk::VtkPropRenderer::Pointer m_RendererSagittal; ///< renderer of sagittal render window
mitk::VtkPropRenderer::Pointer m_RendererCoronal; ///< renderer of coronal render window
mitk::VtkPropRenderer::Pointer m_Renderer3D; ///< renderer of 3D render window
mitk::PointSet::Pointer m_MeasurementPointSet2D; ///< PointSet holding the 2D ToF image point selection used for measuring
mitk::DataNode::Pointer m_MeasurementPointSet3DNode; ///< DataNode holding the 3D ToF coordinates used for measuring
mitk::PointSet::Pointer m_PointSet2D; ///< PointSet holding the 2D ToF image points
mitk::DataNode::Pointer m_PointSet3DNode; ///< DataNode holding the 3D ToF coordinates
mitk::PointSetDataInteractor::Pointer m_PointSetInteractor; ///< PointSetInteractor used for PointSet definition
mitk::PointSetDataInteractor::Pointer m_MeasurementPointSetInteractor; ///< PointSetInteractor used for measurement
long m_MeasurementPointSetChangedObserverTag; ///< observer tag for measurement PointSet observer
long m_PointSetChangedObserverTag; ///< observer tag for PointSet observer
// long m_DistanceImageChangedObserverTag; ///< observer tag for distance image observer
int m_WindowHeight; ///< Height of the renderWindow
private:
};
#endif // _QmitkToFPointSetWidget_H_INCLUDED
diff --git a/Modules/ToFUI/Qmitk/QmitkToFRecorderWidget.h b/Modules/ToFUI/Qmitk/QmitkToFRecorderWidget.h
index d3668edb51..e4739df3da 100644
--- a/Modules/ToFUI/Qmitk/QmitkToFRecorderWidget.h
+++ b/Modules/ToFUI/Qmitk/QmitkToFRecorderWidget.h
@@ -1,185 +1,185 @@
/*============================================================================
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 _QMITKTOFRECORDERWIDGET_H_INCLUDED
#define _QMITKTOFRECORDERWIDGET_H_INCLUDED
#include <MitkToFUIExports.h>
#include <ui_QmitkToFRecorderWidgetControls.h>
//QT headers
#include <QWidget>
#include <QString>
#include <QDialog>
#include <QFileDialog>
//itk headers
#include "itkCommand.h"
//mitk headers
#include <mitkToFImageGrabber.h>
#include <mitkToFImageRecorder.h>
class QmitkStdMultiWidget;
struct QFileDialogArgs;
class QFileIconProvider;
class QFileDialogPrivate;
/**
* @brief Widget allowing to play / record ToF data
*
* @ingroup ToFUI
*/
class MITKTOFUI_EXPORT QmitkToFRecorderWidget :public QWidget
{
//this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
Q_OBJECT
public:
static const std::string VIEW_ID;
QmitkToFRecorderWidget(QWidget* p = nullptr, Qt::WindowFlags f1 = nullptr);
~QmitkToFRecorderWidget() override;
/* @brief This method is part of the widget an needs not to be called seperately. */
virtual void CreateQtPartControl(QWidget *parent);
/* @brief This method is part of the widget an needs not to be called seperately. (Creation of the connections of main and control widget.)*/
virtual void CreateConnections();
/*!
\brief Set the parameters used for this widget
\param ToFImageGrabber image grabber providing images from a ToF device
- \param tofImageRecorder image recorder allowing to record ToF images
+ \param toFImageRecorder image recorder allowing to record ToF images
*/
void SetParameter(mitk::ToFImageGrabber* ToFImageGrabber, mitk::ToFImageRecorder* toFImageRecorder);
/*!
\brief resets the GUI elements to the initial state. Play button: enabled, Stop button: disabled, Recording box: disabled
*/
void ResetGUIToInitial();
signals:
/*!
\brief signal emitted when "Play" button is pressed
*/
void ToFCameraStarted();
/*!
\brief signal emitted when "Stop" button is pressed
*/
void ToFCameraStopped();
/*!
\brief signal emitted when recording is started
*/
void RecordingStarted();
/*!
\brief signal emitted AbortEvent() in ToFImageRecorder is observed
*/
void RecordingStopped();
public slots:
/*!
\brief slot invoking to start the camera.
Calls StartCamera() and emits ToFCameraStarted signal
*/
void OnPlay();
/*!
\brief slot invoking to stop the camera and the recorder.
Calls StopCamera() and StopRecorder and emits ToFCameraStarted signal. Resets GUI to initial state.
*/
void OnStop();
/*!
\brief slot invoking to start the recording
After letting the user chose a file location for the record, m_ImageRecorder->StartRecording() is inoved.
*/
void OnStartRecorder();
/*!
\brief slot resetting the GUI elements of the recording box
*/
void OnRecordingStopped();
/*!
\brief slot activating/deactivating "number of frames" spin box dependent on recording mode (PerFrame / Infinite)
*/
void OnChangeRecordModeComboBox(int index);
protected:
/*!
\brief starts the camera by calling ToFImageGrabber::StartCamera()
*/
void StartCamera();
/*!
\brief stops the camera by calling ToFImageGrabber::StopCamera()
*/
void StopCamera();
/*!
\brief stops the recording by calling ToFImageRecorder::StopRecording()
*/
void StopRecorder();
/*!
\brief emits RecordingStopped signal.
*/
void StopRecordingCallback();
/*!
\brief adapted version of QFileDialog::getSaveFileName()
The user is now asked to choose which images he wants to save
(Distance and/or Intensity and/or Amplitude image) and which type the saved
image should have (3D, 2D+t).
*/
static QString getSaveFileName(mitk::ToFImageWriter::ToFImageType& tofImageType,
bool& distanceImageSelected,
bool& amplitudeImageSelected,
bool& intensityImageSelected,
bool& rgbImageSelected,
bool& rawDataSelected,
QWidget *parent = nullptr,
const QString &caption = QString(),
const QString &dir = QString(),
const QString &filter = QString(),
QString *selectedFilter = nullptr,
QFileDialog::Options options = nullptr
);
/*!
\brief method creating a filename from the given information
\param dir directory to save the file
\param baseFilename base file name entered by the user
\param modulationFreq modulation frequency of the camera
\param integrationTime integration time of the camera
\param numOfFrames number of frames recorded
\param extension file extension
\param imageType type of image (DistanceImage, IntensityImage, AmplitudeImage)
\return dir+"/"+baseFilename+"_MF"+modulationFreq+"_IT"+integrationTime+"_"+numOfFrames+"Images"+imageType+extension
*/
std::string prepareFilename(std::string dir,
std::string baseFilename,
std::string modulationFreq,
std::string integrationTime,
std::string numOfFrames,
std::string extension,
std::string imageType);
Ui::QmitkToFRecorderWidgetControls* m_Controls; ///< member holding the UI elements of this widget
mitk::ToFImageGrabber::Pointer m_ToFImageGrabber; ///< member holding the ToFImageGrabber for acquiring ToF images
mitk::ToFImageRecorder::Pointer m_ToFImageRecorder; ///< member holding the recorder for ToF images
mitk::ToFImageRecorder::RecordMode m_RecordMode; ///< member holding the RecordMode of the recorder (PerFrame / Infinite)
typedef itk::SimpleMemberCommand<QmitkToFRecorderWidget> CommandType;
CommandType::Pointer m_StopRecordingCommand; ///< itkCommand for abort of recording
private:
};
#endif // _QMITKTOFRECORDERWIDGET_H_INCLUDED
diff --git a/Modules/ToFUI/Qmitk/QmitkToFSurfaceGenerationWidget.h b/Modules/ToFUI/Qmitk/QmitkToFSurfaceGenerationWidget.h
index 40b94fe1ad..d5f41cd42b 100644
--- a/Modules/ToFUI/Qmitk/QmitkToFSurfaceGenerationWidget.h
+++ b/Modules/ToFUI/Qmitk/QmitkToFSurfaceGenerationWidget.h
@@ -1,156 +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 _QMITKTOFSURFACEGENERATIONWIDGET_H_INCLUDED
#define _QMITKTOFSURFACEGENERATIONWIDGET_H_INCLUDED
#include <MitkToFUIExports.h>
#include "ui_QmitkToFSurfaceGenerationWidgetControls.h"
// QT headers
#include <QWidget>
// vtk includes
#include <vtkColorTransferFunction.h>
#include <vtkCamera.h>
#include <vtkSmartPointer.h>
//MITK
#include <mitkDataNode.h>
#include <mitkToFDistanceImageToSurfaceFilter.h>
#include <mitkToFImageGrabber.h>
#include <mitkCameraIntrinsics.h>
#include <mitkSurface.h>
class QmitkStdMultiWidget;
/** Documentation:
*
* This widget provides GUI access for all basic surface generation properties and can
* be reused in any other GUI.
* \ingroup ToFUI
*/
class MITKTOFUI_EXPORT QmitkToFSurfaceGenerationWidget :public QWidget
{
//this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
Q_OBJECT
public:
static const std::string VIEW_ID;
QmitkToFSurfaceGenerationWidget (QWidget* p = nullptr, Qt::WindowFlags f1 = nullptr);
~QmitkToFSurfaceGenerationWidget () override;
/* @brief Automatically called method. */
virtual void CreateQtPartControl(QWidget *parent);
/* @brief Automatically called method. Creation of the connections of main and control widget.)*/
virtual void CreateConnections();
/**
* @brief GetToFDistanceImageToSurfaceFilter Get the internally used surface generation filter.
* @return ToFDistanceImageToSurfaceFilter as filter.
*/
mitk::ToFDistanceImageToSurfaceFilter::Pointer GetToFDistanceImageToSurfaceFilter();
/**
* @brief IsActive Check if the widget was initialized correctly.
* @return True for success.
*/
bool IsActive();
/**
* @brief Initialize Initialize the surface generation widget.
* @param filter ToFDistanceImageToSurfaceFilter for surface computation.
* @param grabber ToFImageGrabber to get/set device properties.
* @param intrinsics Intrincs of the device.
* @param surface Generated Surface.
+ * @param camera
* @param generateSurface Check the generate surface combo box.
* @param showAdvancedOptions Show/Hide advanced options.
*/
void Initialize(mitk::ToFDistanceImageToSurfaceFilter::Pointer filter, mitk::ToFImageGrabber::Pointer grabber, mitk::CameraIntrinsics::Pointer intrinsics,
mitk::DataNode::Pointer surface, vtkSmartPointer<vtkCamera> camera, bool generateSurface = false, bool showAdvancedOptions = true);
/**
* @brief UpdateSurface Generate new surface data according to the device properties
* @return True for success.
*/
bool UpdateSurface();
/**
* @brief GetSurface Get the generated surface.
* @return Surface.
*/
mitk::Surface::Pointer GetSurface();
protected slots:
/**
* @brief OnRepresentationChanged Change the representation of the surface. In other words: disable/enable
* triangulation (Point cloud/surface). If triangulation is enabled, this will also allow for editing a
* threshold for triangulating vertices.
*/
void OnRepresentationChanged(int index);
/**
* @brief OnReconstructionChanged Change the reconstruction mode of the ToFDistanceImageToSurfaceFilter.
*/
void OnReconstructionChanged(int index);
/**
* @brief OnCompute3DDataCheckboxChecked Slot beeing called, if the "surface"-checkbox is clicked. This method initializes the surface once, if it is necessary.
* @param checked Is it checked or not?
*/
void OnCompute3DDataCheckboxChecked(bool checked);
/**
* @brief OnShowAdvancedOptionsCheckboxChecked Show/hide advanced options.
* @param checked show/hide
*/
void OnShowAdvancedOptionsCheckboxChecked(bool checked);
/*!
\brief Slot trigged from the triangulation threshold spin box. Changed the threshold for connecting a vertex during triangulation.
*/
void OnTriangulationThresholdSpinBoxChanged();
/**
* @brief OnDistanceColorMapCheckBoxChecked Show the distance color mapping (vtkColorTransferFunction) on the surface.
* @param checked Show/hide.
*/
void OnDistanceColorMapCheckBoxChecked(bool checked);
/**
* @brief OnRGBTextureCheckBoxChecked Put the RGB image as texture on the generated surface/point cloud.
* @param checked Show/hide texture.
*/
void OnRGBTextureCheckBoxChecked(bool checked);
protected:
Ui::QmitkToFSurfaceGenerationWidgetControls* m_Controls;
private:
void FindReconstructionModeProperty();
mitk::ToFDistanceImageToSurfaceFilter::Pointer m_ToFDistanceImageToSurfaceFilter;
mitk::ToFImageGrabber::Pointer m_ToFImageGrabber;
mitk::CameraIntrinsics::Pointer m_CameraIntrinsics;
mitk::DataNode::Pointer m_SurfaceNode;
mitk::Surface::Pointer m_Surface;
bool m_Active;
vtkSmartPointer<vtkCamera> m_Camera3d;
};
#endif // _QMITKTOFVISUALISATIONSETTINGSWIDGET_H_INCLUDED
diff --git a/Modules/ToFUI/Qmitk/QmitkToFVisualisationSettingsWidget.h b/Modules/ToFUI/Qmitk/QmitkToFVisualisationSettingsWidget.h
index 4cadd03e9a..2e86190d4f 100644
--- a/Modules/ToFUI/Qmitk/QmitkToFVisualisationSettingsWidget.h
+++ b/Modules/ToFUI/Qmitk/QmitkToFVisualisationSettingsWidget.h
@@ -1,171 +1,172 @@
/*============================================================================
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 _QMITKTOFVISUALISATIONSETTINGSWIDGET_H_INCLUDED
#define _QMITKTOFVISUALISATIONSETTINGSWIDGET_H_INCLUDED
#include <MitkToFUIExports.h>
#include "ui_QmitkToFVisualisationSettingsWidgetControls.h"
#include "mitkDataNode.h"
// QT headers
#include <QWidget>
// vtk includes
#include <vtkColorTransferFunction.h>
class QmitkStdMultiWidget;
/** Documentation:
* Widget controlling the visualization of Time-of-Flight image data. A color transfer function can be configured for
* a given distance, amplitude and intensity image. The pre-configured vtkColorTransferFunctions can be accessed as
* an output of the widget.
*
* \ingroup ToFUI
*/
class MITKTOFUI_EXPORT QmitkToFVisualisationSettingsWidget :public QWidget
{
//this is needed for all Qt objects that should have a MOC object (everything that derives from QObject)
Q_OBJECT
public:
static const std::string VIEW_ID;
QmitkToFVisualisationSettingsWidget (QWidget* p = nullptr, Qt::WindowFlags f1 = nullptr);
~QmitkToFVisualisationSettingsWidget () override;
/* @brief This method is part of the widget an needs not to be called seperately. */
virtual void CreateQtPartControl(QWidget *parent);
/* @brief This method is part of the widget an needs not to be called seperately. (Creation of the connections of main and control widget.)*/
virtual void CreateConnections();
/*!
\brief initialize the widget with the images to be shown
\param distanceImageNode image holding the range image of a ToF camera
\param amplitudeImageNode image holding the amplitude image of a ToF camera
\param intensityImageNode image holding the intensity image of a ToF camera
+ \param surfaceNode
*/
void Initialize(mitk::DataNode* distanceImageNode=nullptr, mitk::DataNode* amplitudeImageNode=nullptr,
mitk::DataNode* intensityImageNode=nullptr, mitk::DataNode* surfaceNode=nullptr);
/*!
\brief Access the color transfer function of widget 1 (distance image)
\return vtkColorTransferFunction that can be used to define a TransferFunctionProperty
*/
vtkColorTransferFunction* GetWidget1ColorTransferFunction();
/*!
\brief Access the color transfer function of widget 2 (distance image)
\return vtkColorTransferFunction that can be used to define a TransferFunctionProperty
*/
vtkColorTransferFunction* GetWidget2ColorTransferFunction();
/*!
\brief Access the color transfer function of widget 3 (distance image)
\return vtkColorTransferFunction that can be used to define a TransferFunctionProperty
*/
vtkColorTransferFunction* GetWidget3ColorTransferFunction();
/*!
\brief Access the color transfer of the currently selected widget
\return vtkColorTransferFunction that can be used to define a TransferFunctionProperty
*/
vtkColorTransferFunction* GetSelectedColorTransferFunction();
/*!
\brief Return the index of the selected image: 0 = Distance, 1 = Amplitude, 2 = Intensity
*/
int GetSelectedImageIndex();
protected slots:
void OnShowAdvancedOptionsCheckboxChecked(bool checked);
void OnSetXValueColor();
/*!
\brief Slot invoking a reset of the RangeSlider to the minimal and maximal values of the according image
*/
void OnResetSlider();
/*!
\brief Slot called when the range span has changed.
*/
void OnSpanChanged (int lower, int upper);
/*!
\brief Resets the transfer function according to the currently selected widget / image
*/
void OnTransferFunctionReset();
/*!
\brief Updates the GUI according to the widget / image selection
*/
void OnWidgetSelected(int index);
/*!
\brief Slot called when the line edit of the maximal value of the range slider has changed. Leads to an update of the range slider.
*/
void OnRangeSliderMaxChanged();
/*!
\brief Slot called when the line edit of the minimal value of the range slider has changed. Leads to an update of the range slider.
*/
void OnRangeSliderMinChanged();
/*!
\brief Sets the TransferFunctionType members according to the selection of the widget and the transfer type.
*/
void OnTransferFunctionTypeSelected(int index);
protected:
/*!
\brief Invokes an update of the ColorTransferFunctionCanvas. Called when the ColorTransferFunction has changed
*/
void UpdateCanvas();
/*!
\brief Resets the ColorTransferFunctionCanvas according to the lower and upper value of the RangeSlider
*/
void UpdateRanges();
Ui::QmitkToFVisualisationSettingsWidgetControls* m_Controls;
int m_RangeSliderMin; ///< Minimal value of the transfer function range. Initialized to the minimal value of the corresponding image.
int m_RangeSliderMax; ///< Maximal value of the transfer function range. Initialized to the maximal value of the corresponding image.
mitk::DataNode::Pointer m_MitkDistanceImageNode; ///< DataNode holding the range image of the ToF camera as set by Initialize()
mitk::DataNode::Pointer m_MitkAmplitudeImageNode; ///< DataNode holding the amplitude image of the ToF camera as set by Initialize()
mitk::DataNode::Pointer m_MitkIntensityImageNode; ///< DataNode holding the intensity image of the ToF camera as set by Initialize()
mitk::DataNode::Pointer m_MitkSurfaceNode; ///< DataNode holding the surface
vtkColorTransferFunction* m_Widget1ColorTransferFunction; ///< vtkColorTransferFunction of widget 1 (distance) that can be used to define a TransferFunctionProperty
vtkColorTransferFunction* m_Widget2ColorTransferFunction; ///< vtkColorTransferFunction of widget 2 (amplitude) that can be used to define a TransferFunctionProperty
vtkColorTransferFunction* m_Widget3ColorTransferFunction; ///< vtkColorTransferFunction of widget 3 (intensity) that can be used to define a TransferFunctionProperty
int m_Widget1TransferFunctionType; ///< member holding the type of the transfer function applied to the image shown in widget 1 (distance image): 0 = gray scale, 1 = color
int m_Widget2TransferFunctionType; ///< member holding the type of the transfer function applied to the image shown in widget 2 (amplitude image): 0 = gray scale, 1 = color
int m_Widget3TransferFunctionType; ///< member holding the type of the transfer function applied to the image shown in widget 3 (intensity image): 0 = gray scale, 1 = color
private:
/**
* @brief UpdateSurfaceProperty Private helper method to update the surface property color transfer function.
*/
void UpdateSurfaceProperty();
/*!
\brief Reset the color transfer function to the given type and range
\param colorTransferFunction vtkColorTransferfunction to be resetted
\param type type of the transfer function: 0 = gray scale, 1 = color
\param min minimal value to be set to the transfer function
\param max maximal value to be set to the transfer function
*/
void ResetTransferFunction(vtkColorTransferFunction* colorTransferFunction, int type, double min, double max);
/*!
\brief Reset the color transfer function for the given widget
\param widget 0: axial, 1: coronal, 2: sagittal
\param type: type of the transfer function: 0 = gray scale, 1 = color
*/
void ReinitTransferFunction(int widget, int type);
};
#endif // _QMITKTOFVISUALISATIONSETTINGSWIDGET_H_INCLUDED
diff --git a/Modules/TubeGraph/include/mitkTubeGraphProperty.h b/Modules/TubeGraph/include/mitkTubeGraphProperty.h
index 856c251ed0..090b346989 100644
--- a/Modules/TubeGraph/include/mitkTubeGraphProperty.h
+++ b/Modules/TubeGraph/include/mitkTubeGraphProperty.h
@@ -1,146 +1,146 @@
/*============================================================================
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 _mitk_TubeGraphProperty_h
#define _mitk_TubeGraphProperty_h
#include <MitkTubeGraphExports.h>
#include "mitkTubeGraph.h"
#include <mitkBaseProperty.h>
#include <mitkColorProperty.h>
#include <itkObject.h>
#include <map>
#include <vector>
namespace mitk
{
/**
* \brief Property for tube graphs
*/
class MITKTUBEGRAPH_EXPORT TubeGraphProperty : public BaseProperty
{
public:
mitkClassMacro(TubeGraphProperty, BaseProperty);
itkNewMacro(TubeGraphProperty);
struct LabelGroup
{
struct Label
{
std::string labelName;
bool isVisible;
Color labelColor;
};
std::string labelGroupName;
std::vector<Label *> labels;
};
///////////////TYPEDEF///////////////
typedef TubeGraph::TubeDescriptorType TubeDescriptorType;
typedef std::vector<TubeGraphProperty::LabelGroup *> LabelGroupSetType;
typedef std::pair<TubeDescriptorType, std::string> TubeToLabelGroupType;
/////////////////////////////////////
struct Annotation
{
std::string name;
std::string description;
TubeDescriptorType tube;
};
/**
* Checks, if a given tube is visible
* @param tube the tube id of the tube to check
* @returns true, if the tube with id is visible or false otherwise
*/
bool IsTubeVisible(const TubeDescriptorType &tube);
/**
* Sets a tube active.
* @param tube the tube id of the tube, which has to be set active
* @param active true, if the tube should be active or false if not.
*/
void SetTubeActive(const TubeDescriptorType &tube, const bool &active);
/**
* Sets tubes active.
*
*/
void SetTubesActive(std::vector<TubeDescriptorType> &tubes);
/**
* Checks, if a given tube is activated
- * @param id the tube id of the tube to check
+ * @param tube the to check
* @returns true, if the tube with id is active or false otherwise
*/
bool IsTubeActive(const TubeDescriptorType &tube);
std::vector<TubeDescriptorType> GetActiveTubes();
Color GetColorOfTube(const TubeDescriptorType &tube);
void SetTubesToLabels(std::map<TubeToLabelGroupType, std::string> tubeToLabelMap);
std::map<TubeToLabelGroupType, std::string> GetTubesToLabels();
/**
* Deactivates all tubes
*/
void DeactivateAllTubes();
void AddAnnotation(Annotation *annotation);
Annotation *GetAnnotationByName(std::string annotation);
std::vector<Annotation *> GetAnnotations();
void RemoveAnnotation(Annotation *annotation);
void AddLabelGroup(LabelGroup *labelGroup, unsigned int position); // Add LG by name and vec<labelName>??
void RemoveLabelGroup(LabelGroup *labelGroup);
LabelGroupSetType GetLabelGroups();
unsigned int GetNumberOfLabelGroups();
unsigned int GetIndexOfLabelGroup(LabelGroup *labelGroup);
LabelGroup *GetLabelGroupByName(std::string labelGroup);
void SetLabelVisibility(LabelGroup::Label *label, bool isVisible);
void SetLabelColor(LabelGroup::Label *label, Color color);
void RenameLabel(LabelGroup *labelGroup, LabelGroup::Label *label, std::string newName);
void SetLabelForActivatedTubes(LabelGroup *labelGroup, LabelGroup::Label *label);
LabelGroup::Label *GetLabelByName(LabelGroup *labelGroup, std::string labelName);
std::string GetValueAsString() const override;
protected:
TubeGraphProperty();
TubeGraphProperty(const TubeGraphProperty &other);
~TubeGraphProperty() override;
private:
std::vector<TubeDescriptorType> m_ActiveTubes;
LabelGroupSetType m_LabelGroups;
std::map<TubeToLabelGroupType, std::string> m_TubeToLabelsMap;
std::vector<Annotation *> m_Annotations;
bool TubeDescriptorsCompare(const TubeDescriptorType &tube1, const TubeDescriptorType &tube2);
// purposely not implemented
TubeGraphProperty &operator=(const TubeGraphProperty &);
bool IsEqual(const BaseProperty &property) const override;
bool Assign(const BaseProperty &property) override;
itk::LightObject::Pointer InternalClone() const override;
};
} // namespace mitk
#endif /* _mitk_TubeGraphProperty_h */
diff --git a/Modules/TubeGraph/src/Rendering/mitkTubeGraphVtkMapper3D.cpp b/Modules/TubeGraph/src/Rendering/mitkTubeGraphVtkMapper3D.cpp
index a93bfd5371..864d163416 100644
--- a/Modules/TubeGraph/src/Rendering/mitkTubeGraphVtkMapper3D.cpp
+++ b/Modules/TubeGraph/src/Rendering/mitkTubeGraphVtkMapper3D.cpp
@@ -1,753 +1,753 @@
/*============================================================================
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 "mitkTubeGraphVtkMapper3D.h"
#include <mitkColorProperty.h>
#include <vtkCellArray.h>
#include <vtkClipPolyData.h>
#include <vtkContourFilter.h>
#include <vtkCylinder.h>
#include <vtkFloatArray.h>
#include <vtkGeneralTransform.h>
#include <vtkImplicitBoolean.h>
#include <vtkImplicitModeller.h>
#include <vtkPlane.h>
#include <vtkPointData.h>
#include <vtkPoints.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkRenderer.h>
#include <vtkSampleFunction.h>
#include <vtkSphereSource.h>
#include <vtkTubeFilter.h>
-#include <vtkUnsignedIntArray.h>
+#include <vtkUnsignedCharArray.h>
mitk::TubeGraphVtkMapper3D::TubeGraphVtkMapper3D()
{
}
mitk::TubeGraphVtkMapper3D::~TubeGraphVtkMapper3D()
{
}
const mitk::TubeGraph *mitk::TubeGraphVtkMapper3D::GetInput()
{
return dynamic_cast<const TubeGraph *>(GetDataNode()->GetData());
}
vtkProp *mitk::TubeGraphVtkMapper3D::GetVtkProp(mitk::BaseRenderer *renderer)
{
return m_LSH.GetLocalStorage(renderer)->m_vtkTubeGraphAssembly;
}
void mitk::TubeGraphVtkMapper3D::GenerateDataForRenderer(mitk::BaseRenderer *renderer)
{
bool renderTubeGraph(false);
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
TubeGraph::Pointer tubeGraph = const_cast<mitk::TubeGraph *>(this->GetInput());
TubeGraphProperty::Pointer tubeGraphProperty =
dynamic_cast<TubeGraphProperty *>(tubeGraph->GetProperty("Tube Graph.Visualization Information").GetPointer());
if (tubeGraph.IsNull() || tubeGraphProperty.IsNull())
{
itkWarningMacro(<< "Input of tube graph mapper is nullptr!");
return;
}
// Check if the tube graph has changed; if the data has changed, generate the spheres and tubes new;
if (tubeGraph->GetMTime() > ls->m_lastGenerateDataTime)
{
this->GenerateTubeGraphData(renderer);
renderTubeGraph = true;
}
else
{
// Check if the tube graph property has changed; if the property has changed, render the visualization information
// new;
if (tubeGraphProperty->GetMTime() > ls->m_lastRenderDataTime)
{
this->RenderTubeGraphPropertyInformation(renderer);
renderTubeGraph = true;
}
}
if (renderTubeGraph)
{
std::vector<TubeGraph::VertexDescriptorType> alreadyRenderedVertexList;
// don't render the sphere which is the root of the graph; so add it to the list before;
// TODO check both spheres
TubeGraph::VertexDescriptorType root = tubeGraph->GetRootVertex();
alreadyRenderedVertexList.push_back(root);
for (auto itTubes =
ls->m_vtkTubesActorMap.begin();
itTubes != ls->m_vtkTubesActorMap.end();
itTubes++)
{
if (tubeGraphProperty->IsTubeVisible(itTubes->first))
{
// add tube actor to assembly
ls->m_vtkTubeGraphAssembly->AddPart(itTubes->second);
// render the clipped spheres as end-cups of a tube and connections between tubes
if (std::find(alreadyRenderedVertexList.begin(), alreadyRenderedVertexList.end(), itTubes->first.first) ==
alreadyRenderedVertexList.end())
{
auto itSourceSphere =
ls->m_vtkSpheresActorMap.find(itTubes->first.first);
if (itSourceSphere != ls->m_vtkSpheresActorMap.end())
ls->m_vtkTubeGraphAssembly->AddPart(itSourceSphere->second);
alreadyRenderedVertexList.push_back(itSourceSphere->first);
}
if (std::find(alreadyRenderedVertexList.begin(), alreadyRenderedVertexList.end(), itTubes->first.second) ==
alreadyRenderedVertexList.end())
{
auto itTargetSphere =
ls->m_vtkSpheresActorMap.find(itTubes->first.second);
if (itTargetSphere != ls->m_vtkSpheresActorMap.end())
ls->m_vtkTubeGraphAssembly->AddPart(itTargetSphere->second);
alreadyRenderedVertexList.push_back(itTargetSphere->first);
}
}
}
}
//// Opacity TODO
//{
// float opacity = 1.0f;
// if( this->GetDataNode()->GetOpacity(opacity,renderer) )
// ls->m_vtkTubesActor->GetProperty()->SetOpacity( opacity );
//}
}
void mitk::TubeGraphVtkMapper3D::RenderTubeGraphPropertyInformation(mitk::BaseRenderer *renderer)
{
MITK_INFO << "Render tube graph property information!";
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
TubeGraph::ConstPointer tubeGraph = this->GetInput();
TubeGraphProperty::Pointer tubeGraphProperty =
dynamic_cast<TubeGraphProperty *>(tubeGraph->GetProperty("Tube Graph.Visualization Information").GetPointer());
if (tubeGraphProperty.IsNull())
{
MITK_INFO << "No tube graph property!! So no special render information...";
return;
}
std::vector<TubeGraphVertex> allVertices = tubeGraph->GetVectorOfAllVertices();
for (auto vertex = allVertices.begin(); vertex != allVertices.end(); ++vertex)
{
TubeGraph::VertexDescriptorType vertexDesc = tubeGraph->GetVertexDescriptor(*vertex);
double sphereColorR = 0;
double sphereColorG = 0;
double sphereColorB = 0;
int numberOfVisibleEdges = 0;
std::vector<TubeGraphEdge> allEdgesOfVertex = tubeGraph->GetAllEdgesOfAVertex(vertexDesc);
for (auto edge = allEdgesOfVertex.begin(); edge != allEdgesOfVertex.end(); ++edge)
{
// get edge descriptor
EdgeDescriptorType edgeDesc = tubeGraph->GetEdgeDescriptor(*edge);
// get source and target vertex descriptor
std::pair<TubeGraphVertex, TubeGraphVertex> soureTargetPair = tubeGraph->GetVerticesOfAnEdge(edgeDesc);
TubeGraphVertex source = soureTargetPair.first;
TubeGraphVertex target = soureTargetPair.second;
// build tube descriptor [sourceId,targetId]
TubeGraph::TubeDescriptorType tube;
tube.first = tubeGraph->GetVertexDescriptor(source);
tube.second = tubeGraph->GetVertexDescriptor(target);
if (tubeGraphProperty->IsTubeVisible(tube))
{
mitk::Color tubeColor = tubeGraphProperty->GetColorOfTube(tube);
vtkSmartPointer<vtkDataArray> scalars =
ls->m_vtkTubesActorMap[tube]->GetMapper()->GetInput()->GetPointData()->GetScalars();
double color[3];
scalars->GetTuple(0, color);
if (color[0] != tubeColor[0] || color[1] != tubeColor[1] || color[2] != tubeColor[2])
{
int numberOfPoints = scalars->GetSize();
vtkSmartPointer<vtkUnsignedCharArray> colorScalars = vtkSmartPointer<vtkUnsignedCharArray>::New();
colorScalars->SetName("colorScalars");
colorScalars->SetNumberOfComponents(3);
colorScalars->SetNumberOfTuples(numberOfPoints);
for (int i = 0; i < numberOfPoints; i++)
{
scalars->InsertTuple3(i, tubeColor[0], tubeColor[1], tubeColor[2]);
}
ls->m_vtkTubesActorMap[tube]->GetMapper()->GetInput()->GetPointData()->SetActiveScalars("colorScalars");
}
sphereColorR += tubeColor[0];
sphereColorG += tubeColor[1];
sphereColorB += tubeColor[2];
numberOfVisibleEdges++;
}
}
if (numberOfVisibleEdges > 0)
{
sphereColorR /= 255 * numberOfVisibleEdges;
sphereColorG /= 255 * numberOfVisibleEdges;
sphereColorB /= 255 * numberOfVisibleEdges;
}
ls->m_vtkSpheresActorMap[vertexDesc]->GetProperty()->SetColor(sphereColorR, sphereColorG, sphereColorB);
}
ls->m_lastRenderDataTime.Modified();
}
void mitk::TubeGraphVtkMapper3D::GenerateTubeGraphData(mitk::BaseRenderer *renderer)
{
MITK_INFO << "Render tube graph!";
LocalStorage *ls = m_LSH.GetLocalStorage(renderer);
ls->m_vtkTubesActorMap.clear();
ls->m_vtkSpheresActorMap.clear();
TubeGraph::Pointer tubeGraph = const_cast<mitk::TubeGraph *>(this->GetInput());
TubeGraphProperty::Pointer tubeGraphProperty =
dynamic_cast<TubeGraphProperty *>(tubeGraph->GetProperty("Tube Graph.Visualization Information").GetPointer());
if (tubeGraphProperty.IsNull())
MITK_INFO << "No tube graph property!! So no special render information...";
// render all edges as tubular structures using the vtkTubeFilter
std::vector<TubeGraphEdge> allEdges = tubeGraph->GetVectorOfAllEdges();
for (auto edge = allEdges.begin(); edge != allEdges.end(); ++edge)
{
this->GeneratePolyDataForTube(*edge, tubeGraph, tubeGraphProperty, renderer);
}
// Generate all vertices as spheres
std::vector<TubeGraphVertex> allVertices = tubeGraph->GetVectorOfAllVertices();
for (auto vertex = allVertices.begin(); vertex != allVertices.end(); ++vertex)
{
this->GeneratePolyDataForFurcation(*vertex, tubeGraph, renderer);
if (this->ClipStructures())
{
this->ClipPolyData(*vertex, tubeGraph, tubeGraphProperty, renderer);
}
ls->m_lastGenerateDataTime.Modified();
}
}
void mitk::TubeGraphVtkMapper3D::GeneratePolyDataForFurcation(mitk::TubeGraphVertex &vertex,
const mitk::TubeGraph::Pointer &graph,
mitk::BaseRenderer *renderer)
{
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
mitk::Point3D coordinates;
float diameter = 2;
coordinates = (vertex.GetTubeElement())->GetCoordinates();
if (dynamic_cast<const mitk::CircularProfileTubeElement *>(vertex.GetTubeElement()))
{
diameter = (dynamic_cast<const mitk::CircularProfileTubeElement *>(vertex.GetTubeElement()))->GetDiameter();
}
vtkSmartPointer<vtkSphereSource> sphereSource = vtkSmartPointer<vtkSphereSource>::New();
sphereSource->SetCenter(coordinates[0], coordinates[1], coordinates[2]);
sphereSource->SetRadius(diameter / 2.0f);
sphereSource->SetThetaResolution(12);
sphereSource->SetPhiResolution(12);
sphereSource->Update();
// generate a actor with a mapper for the sphere
vtkSmartPointer<vtkPolyDataMapper> sphereMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
vtkSmartPointer<vtkActor> sphereActor = vtkSmartPointer<vtkActor>::New();
sphereMapper->SetInputConnection(sphereSource->GetOutputPort());
sphereActor->SetMapper(sphereMapper);
ls->m_vtkSpheresActorMap.insert(std::make_pair(graph->GetVertexDescriptor(vertex), sphereActor));
}
void mitk::TubeGraphVtkMapper3D::GeneratePolyDataForTube(mitk::TubeGraphEdge &edge,
const mitk::TubeGraph::Pointer &graph,
const mitk::TubeGraphProperty::Pointer &graphProperty,
mitk::BaseRenderer *renderer)
{
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
// get edge descriptor
EdgeDescriptorType edgeDesc = graph->GetEdgeDescriptor(edge);
// get source and target vertex descriptor
std::pair<TubeGraphVertex, TubeGraphVertex> soureTargetPair = graph->GetVerticesOfAnEdge(edgeDesc);
TubeGraphVertex source = soureTargetPair.first;
TubeGraphVertex target = soureTargetPair.second;
// build tube descriptor [sourceId,targetId]
TubeGraph::TubeDescriptorType tube;
tube.first = graph->GetVertexDescriptor(source);
tube.second = graph->GetVertexDescriptor(target);
Color color;
if (graphProperty.IsNotNull())
{
color = graphProperty->GetColorOfTube(tube);
}
else
{
color[0] = 150;
color[1] = 150;
color[2] = 150;
}
// add 2 points for the source and target vertices.
unsigned int numberOfPoints = edge.GetNumberOfElements() + 2;
// Initialize the required data-structures for building
// an appropriate input to the tube filter
vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
points->SetNumberOfPoints(numberOfPoints);
vtkSmartPointer<vtkFloatArray> radii = vtkSmartPointer<vtkFloatArray>::New();
radii->SetName("radii");
radii->SetNumberOfComponents(1);
vtkSmartPointer<vtkCellArray> lines = vtkSmartPointer<vtkCellArray>::New();
vtkSmartPointer<vtkUnsignedCharArray> colorScalars = vtkSmartPointer<vtkUnsignedCharArray>::New();
colorScalars->SetName("colorScalars");
colorScalars->SetNumberOfComponents(3);
// resize the data-arrays
radii->SetNumberOfTuples(numberOfPoints);
colorScalars->SetNumberOfTuples(numberOfPoints);
lines->InsertNextCell(numberOfPoints);
// Add the positions of the source node, the elements along the edge and
// the target node as lines to a cell. This cell is used as input
// for a Tube Filter
mitk::Point3D coordinates;
float diameter = 2;
unsigned int id = 0;
// Source Node
coordinates = (source.GetTubeElement())->GetCoordinates();
if (dynamic_cast<const mitk::CircularProfileTubeElement *>(source.GetTubeElement()))
{
diameter = (dynamic_cast<const mitk::CircularProfileTubeElement *>(source.GetTubeElement()))->GetDiameter();
}
points->InsertPoint(id, coordinates[0], coordinates[1], coordinates[2]);
radii->InsertTuple1(id, diameter / 2.0f);
colorScalars->InsertTuple3(id, color[0], color[1], color[2]);
lines->InsertCellPoint(id);
++id;
// Iterate along the edge
std::vector<mitk::TubeElement *> allElements = edge.GetElementVector();
for (unsigned int index = 0; index < edge.GetNumberOfElements(); index++)
{
coordinates = allElements[index]->GetCoordinates();
if (dynamic_cast<mitk::CircularProfileTubeElement *>(allElements[index]))
{
diameter = (dynamic_cast<mitk::CircularProfileTubeElement *>(allElements[index]))->GetDiameter();
}
points->InsertPoint(id, coordinates[0], coordinates[1], coordinates[2]);
radii->InsertTuple1(id, diameter / 2.0f);
colorScalars->InsertTuple3(id, color[0], color[1], color[2]);
lines->InsertCellPoint(id);
++id;
}
// Target Node
coordinates = (target.GetTubeElement())->GetCoordinates();
if (dynamic_cast<const mitk::CircularProfileTubeElement *>(target.GetTubeElement()))
{
diameter = (dynamic_cast<const mitk::CircularProfileTubeElement *>(target.GetTubeElement()))->GetDiameter();
}
points->InsertPoint(id, coordinates[0], coordinates[1], coordinates[2]);
radii->InsertTuple1(id, diameter / 2.0f);
colorScalars->InsertTuple3(id, color[0], color[1], color[2]);
lines->InsertCellPoint(id);
++id;
// Initialize poly data from the point set and the cell array
// (representing topology)
vtkSmartPointer<vtkPolyData> polyData = vtkSmartPointer<vtkPolyData>::New();
polyData->SetPoints(points);
polyData->SetLines(lines);
polyData->GetPointData()->AddArray(radii);
polyData->GetPointData()->AddArray(colorScalars);
polyData->GetPointData()->SetActiveScalars(radii->GetName());
// Generate a tube for all lines in the polydata object
double *range = radii->GetRange();
assert(range[0] != 0.0f && range[1] != 0.0f);
vtkSmartPointer<vtkTubeFilter> tubeFilter = vtkSmartPointer<vtkTubeFilter>::New();
tubeFilter->SetInputData(polyData);
tubeFilter->SetRadius(range[0]);
tubeFilter->SetRadiusFactor(range[1] / range[0]);
if (range[0] != range[1])
tubeFilter->SetVaryRadiusToVaryRadiusByScalar();
tubeFilter->SetNumberOfSides(9);
tubeFilter->SidesShareVerticesOn();
tubeFilter->CappingOff();
tubeFilter->Update();
tubeFilter->GetOutput()->GetPointData()->SetActiveScalars("colorScalars");
// generate a actor with a mapper for the
vtkSmartPointer<vtkPolyDataMapper> tubeMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
vtkSmartPointer<vtkActor> tubeActor = vtkSmartPointer<vtkActor>::New();
tubeMapper->SetInputConnection(tubeFilter->GetOutputPort());
tubeActor->SetMapper(tubeMapper);
tubeActor->GetProperty()->SetColor(color[0], color[1], color[2]);
ls->m_vtkTubesActorMap.insert(std::pair<TubeGraph::TubeDescriptorType, vtkSmartPointer<vtkActor>>(tube, tubeActor));
}
void mitk::TubeGraphVtkMapper3D::ClipPolyData(mitk::TubeGraphVertex &vertex,
const mitk::TubeGraph::Pointer &graph,
const mitk::TubeGraphProperty::Pointer &graphProperty,
mitk::BaseRenderer *renderer)
{
LocalStorage *ls = this->m_LSH.GetLocalStorage(renderer);
mitk::Point3D centerVertex = vertex.GetTubeElement()->GetCoordinates();
float diameter = 2;
if (dynamic_cast<const mitk::CircularProfileTubeElement *>(vertex.GetTubeElement()))
{
diameter = (dynamic_cast<const mitk::CircularProfileTubeElement *>(vertex.GetTubeElement()))->GetDiameter();
}
TubeGraph::VertexDescriptorType vertexDesc = graph->GetVertexDescriptor(vertex);
std::map<TubeGraph::TubeDescriptorType, vtkSmartPointer<vtkImplicitBoolean>> cylinderForClipping;
// generate for all edges/tubes cylinders. With this structure you can clip the sphere and the other tubes, so that no
// fragments are shown in the tube.
std::vector<TubeGraphEdge> allEdgesOfVertex = graph->GetAllEdgesOfAVertex(vertexDesc);
for (auto edge = allEdgesOfVertex.begin(); edge != allEdgesOfVertex.end(); ++edge)
{
// get edge descriptor
EdgeDescriptorType edgeDesc = graph->GetEdgeDescriptor(*edge);
// get source and target vertex descriptor
auto soureTargetPair = graph->GetVerticesOfAnEdge(edgeDesc);
TubeGraphVertex source = soureTargetPair.first;
TubeGraphVertex target = soureTargetPair.second;
// build tube descriptor [sourceId,targetId]
TubeGraph::TubeDescriptorType tube;
tube.first = graph->GetVertexDescriptor(source);
tube.second = graph->GetVertexDescriptor(target);
// get reference point in the tube for the direction
mitk::Point3D edgeDirectionPoint;
// get reference diameter
double cylinderDiameter = diameter;
float radius = diameter / 2;
// if the vertex is the source vertex of the edge get the first element of elementVector; otherwise get the last
// element.
if (source == vertex)
{
// if the edge has no element get the other vertex
if ((*edge).GetNumberOfElements() != 0)
{
double lastDistance = 0, distance = 0;
unsigned int index = 0;
// Get the first element behind the radius of the sphere
for (; index < (*edge).GetNumberOfElements(); index++)
{
mitk::Vector3D diffVec = (*edge).GetTubeElement(index)->GetCoordinates() - centerVertex;
distance = std::sqrt(pow(diffVec[0], 2) + pow(diffVec[1], 2) + pow(diffVec[2], 2));
if (distance > radius)
break;
lastDistance = distance;
}
// if the last element is not inside the sphere
if (index < (*edge).GetNumberOfElements())
{
double withinSphereDiameter = diameter, outsideSphereDiameter = diameter, interpolationValue = 0.5;
interpolationValue = (radius - lastDistance) / (distance - lastDistance);
// if first element is outside of the sphere use sphere diameter and the element diameter for interpolation
if (index == 0)
{
if (dynamic_cast<mitk::CircularProfileTubeElement *>((*edge).GetTubeElement(0)))
outsideSphereDiameter =
(dynamic_cast<mitk::CircularProfileTubeElement *>((*edge).GetTubeElement(0)))->GetDiameter();
}
else
{
if (dynamic_cast<mitk::CircularProfileTubeElement *>((*edge).GetTubeElement(index - 1)))
withinSphereDiameter =
(dynamic_cast<mitk::CircularProfileTubeElement *>((*edge).GetTubeElement(index - 1)))->GetDiameter();
if (dynamic_cast<mitk::CircularProfileTubeElement *>((*edge).GetTubeElement(index)))
outsideSphereDiameter =
(dynamic_cast<mitk::CircularProfileTubeElement *>((*edge).GetTubeElement(index)))->GetDiameter();
}
// interpolate the diameter for clipping
cylinderDiameter =
(1 - interpolationValue) * withinSphereDiameter + interpolationValue * outsideSphereDiameter;
}
// Get the reference point, so the direction of the tube can be calculated
edgeDirectionPoint = (*edge).GetTubeElement(0)->GetCoordinates();
}
else
{
// Get the reference point, so the direction of the tube can be calculated
edgeDirectionPoint = target.GetTubeElement()->GetCoordinates();
}
}
// if vertex is target of the tube
else
{
// if the edge has no element, get the other vertex
if ((*edge).GetNumberOfElements() != 0)
{
double lastDistance = 0, distance = 0;
// Get the first element behind the radius of the sphere; now backwards through the element list
int index = (*edge).GetNumberOfElements();
for ( ; index >= 0; --index)
{
mitk::Vector3D diffVec = (*edge).GetTubeElement(index)->GetCoordinates() - centerVertex;
distance = std::sqrt(pow(diffVec[0], 2) + pow(diffVec[1], 2) + pow(diffVec[2], 2));
if (distance > radius)
break;
lastDistance = distance;
}
if (index >= 0)
{
double withinSphereDiameter = diameter, outsideSphereDiameter = diameter, interpolationValue = 0.5;
interpolationValue = (radius - lastDistance) / (distance - lastDistance);
if (index == static_cast<int>((*edge).GetNumberOfElements() - 1))
{
if (dynamic_cast<mitk::CircularProfileTubeElement *>(
(*edge).GetTubeElement((*edge).GetNumberOfElements() - 1)))
outsideSphereDiameter = (dynamic_cast<mitk::CircularProfileTubeElement *>(
(*edge).GetTubeElement((*edge).GetNumberOfElements() - 1)))
->GetDiameter();
}
else
{
if (dynamic_cast<mitk::CircularProfileTubeElement *>((*edge).GetTubeElement(index + 1)))
withinSphereDiameter =
(dynamic_cast<mitk::CircularProfileTubeElement *>((*edge).GetTubeElement(index + 1)))->GetDiameter();
if (dynamic_cast<mitk::CircularProfileTubeElement *>((*edge).GetTubeElement(index)))
outsideSphereDiameter =
(dynamic_cast<mitk::CircularProfileTubeElement *>((*edge).GetTubeElement(index)))->GetDiameter();
}
// interpolate the diameter for clipping
cylinderDiameter =
(1 - interpolationValue) * withinSphereDiameter + interpolationValue * outsideSphereDiameter;
}
// Get the reference point, so the direction of the tube can be calculated
edgeDirectionPoint = (*edge).GetTubeElement((*edge).GetNumberOfElements() - 1)->GetCoordinates();
}
else
{
// Get the reference point, so the direction of the tube can be calculated
edgeDirectionPoint = source.GetTubeElement()->GetCoordinates();
}
}
//////Calculate the matrix for rotation and translation////
// get the normalized vector for the orientation (tube element direction)
mitk::Vector3D vecOrientation;
mitk::FillVector3D(vecOrientation,
(edgeDirectionPoint[0] - centerVertex[0]),
(edgeDirectionPoint[1] - centerVertex[1]),
(edgeDirectionPoint[2] - centerVertex[2]));
vecOrientation.Normalize();
// generate a random vector
mitk::Vector3D vecRandom;
mitk::FillVector3D(vecRandom, (rand() % 100 - 50), (rand() % 100 - 50), (rand() % 100 - 50));
// project the random vector on the plane-->orthogonal vector to plane normal; normalize it!
mitk::Vector3D vecOrthoToOrientation;
vecOrthoToOrientation = vecRandom - (vecRandom * vecOrientation) * vecOrientation;
vecOrthoToOrientation.Normalize();
// get the cross product of both orthogonale vectors to get a third one
mitk::Vector3D vecCrossProduct;
vecCrossProduct = itk::CrossProduct(vecOrientation, vecOrthoToOrientation);
vecCrossProduct.Normalize();
// Fill matrix
vtkSmartPointer<vtkMatrix4x4> vtkTransformMatrix = vtkSmartPointer<vtkMatrix4x4>::New();
vtkTransformMatrix->Identity();
// 1. column
vtkTransformMatrix->SetElement(0, 0, vecOrthoToOrientation[0]);
vtkTransformMatrix->SetElement(1, 0, vecOrthoToOrientation[1]);
vtkTransformMatrix->SetElement(2, 0, vecOrthoToOrientation[2]);
// 2. column
vtkTransformMatrix->SetElement(0, 1, vecOrientation[0]);
vtkTransformMatrix->SetElement(1, 1, vecOrientation[1]);
vtkTransformMatrix->SetElement(2, 1, vecOrientation[2]);
// 3. column
vtkTransformMatrix->SetElement(0, 2, vecCrossProduct[0]);
vtkTransformMatrix->SetElement(1, 2, vecCrossProduct[1]);
vtkTransformMatrix->SetElement(2, 2, vecCrossProduct[2]);
// 4. column
vtkTransformMatrix->SetElement(0, 3, centerVertex[0]);
vtkTransformMatrix->SetElement(1, 3, centerVertex[1]);
vtkTransformMatrix->SetElement(2, 3, centerVertex[2]);
vtkSmartPointer<vtkGeneralTransform> transform = vtkSmartPointer<vtkGeneralTransform>::New();
transform->Concatenate(vtkTransformMatrix);
// transform->Translate(centerVertex[0],centerVertex[1],centerVertex[2]);
transform->Inverse();
transform->Update();
// Generate plane in center [0,0,0] with n= (0,1,0) as normal vector
vtkSmartPointer<vtkPlane> plane = vtkSmartPointer<vtkPlane>::New();
plane->SetOrigin(0, 0, 0);
plane->SetNormal(0, 1, 0);
// Generate a cylinder in center [0,0,0] and the axes of rotation is along the y-axis; radius is vertex diameter/2;
vtkSmartPointer<vtkCylinder> cylinder = vtkSmartPointer<vtkCylinder>::New();
cylinder->SetCenter(0, 0, 0);
cylinder->SetRadius(cylinderDiameter / 2);
// cylinder->SetTransform(transform);
// Truncate the infinite cylinder with the plane
vtkSmartPointer<vtkImplicitBoolean> cutCylinder = vtkSmartPointer<vtkImplicitBoolean>::New();
cutCylinder->SetOperationTypeToDifference();
cutCylinder->SetTransform(transform);
cutCylinder->AddFunction(cylinder);
cutCylinder->AddFunction(plane);
cylinderForClipping.insert(
std::pair<TubeGraph::TubeDescriptorType, vtkSmartPointer<vtkImplicitBoolean>>(tube, cutCylinder));
//// Sample the function
// vtkSmartPointer<vtkSampleFunction> sample = vtkSmartPointer<vtkSampleFunction>::New();
// sample->SetSampleDimensions(100,100,100);
// sample->SetImplicitFunction(cutCylinder);
////double value = 200.0;
// double xmin = centerVertex[0]-(2*diameter), xmax = centerVertex[0]+(2*diameter),
// ymin = centerVertex[1]-(2*diameter), ymax = centerVertex[1]+(2*diameter),
// zmin = centerVertex[2]-(2*diameter), zmax = centerVertex[2]+(2*diameter);
// sample->SetModelBounds(xmin, xmax, ymin, ymax, zmin, zmax);
// vtkSmartPointer<vtkContourFilter> contour =vtkSmartPointer<vtkContourFilter>::New();
// contour->SetInputConnection(sample->GetOutputPort());
// contour->SetValue( 0, 0.25);
// vtkSmartPointer<vtkPolyDataMapper> impMapper = vtkSmartPointer<vtkPolyDataMapper>::New();
// impMapper->SetInputConnection (contour->GetOutputPort());
// impMapper->ScalarVisibilityOff();
// vtkSmartPointer<vtkActor> impActor = vtkSmartPointer<vtkActor>::New();
// impActor->SetMapper(impMapper);
// ls->m_vtkTubeGraphAssembly->AddPart(impActor);
}
double sphereColorR = 0;
double sphereColorG = 0;
double sphereColorB = 0;
for (auto itClipStructure =
cylinderForClipping.begin();
itClipStructure != cylinderForClipping.end();
itClipStructure++)
{
vtkSmartPointer<vtkPolyDataMapper> sphereMapper =
dynamic_cast<vtkPolyDataMapper *>(ls->m_vtkSpheresActorMap[vertexDesc]->GetMapper());
if (sphereMapper != nullptr)
{
// first clip the sphere with the cylinder
vtkSmartPointer<vtkClipPolyData> clipperSphere = vtkSmartPointer<vtkClipPolyData>::New();
clipperSphere->SetInputData(sphereMapper->GetInput());
clipperSphere->SetClipFunction(itClipStructure->second);
clipperSphere->GenerateClippedOutputOn();
clipperSphere->Update();
sphereMapper->SetInputConnection(clipperSphere->GetOutputPort());
sphereMapper->Update();
}
mitk::Color tubeColor = graphProperty->GetColorOfTube(itClipStructure->first);
sphereColorR += tubeColor[0];
sphereColorG += tubeColor[1];
sphereColorB += tubeColor[2];
// than clip with all other tubes
for (auto itTobBeClipped =
cylinderForClipping.begin();
itTobBeClipped != cylinderForClipping.end();
itTobBeClipped++)
{
TubeGraph::TubeDescriptorType toBeClippedTube = itTobBeClipped->first;
if (itClipStructure->first != toBeClippedTube)
{
vtkSmartPointer<vtkPolyDataMapper> tubeMapper =
dynamic_cast<vtkPolyDataMapper *>(ls->m_vtkTubesActorMap[toBeClippedTube]->GetMapper());
if (tubeMapper != nullptr)
{
// first clip the sphere with the cylinder
vtkSmartPointer<vtkClipPolyData> clipperTube = vtkSmartPointer<vtkClipPolyData>::New();
tubeMapper->Update();
clipperTube->SetInputData(tubeMapper->GetInput());
clipperTube->SetClipFunction(itClipStructure->second);
clipperTube->GenerateClippedOutputOn();
clipperTube->Update();
tubeMapper->SetInputConnection(clipperTube->GetOutputPort());
tubeMapper->Update();
}
}
}
}
if (cylinderForClipping.size() != 0)
{
sphereColorR /= 255 * cylinderForClipping.size();
sphereColorG /= 255 * cylinderForClipping.size();
sphereColorB /= 255 * cylinderForClipping.size();
}
ls->m_vtkSpheresActorMap[vertexDesc]->GetProperty()->SetColor(sphereColorR, sphereColorG, sphereColorB);
}
bool mitk::TubeGraphVtkMapper3D::ClipStructures()
{
DataNode::Pointer node = this->GetDataNode();
if (node.IsNull())
{
itkWarningMacro(<< "associated node is nullptr!");
return false;
}
bool clipStructures = false;
node->GetBoolProperty("Tube Graph.Clip Structures", clipStructures);
return clipStructures;
}
diff --git a/Modules/US/Documentation/doxygen/USModule.dox b/Modules/US/Documentation/doxygen/USModule.dox
index 072ae386ae..131870ee63 100644
--- a/Modules/US/Documentation/doxygen/USModule.dox
+++ b/Modules/US/Documentation/doxygen/USModule.dox
@@ -1,93 +1,93 @@
/**
\page USModulePage Ultrasound Module
\tableofcontents
\section USModulePageOverview Overview
The Ultrasound Module provides a <strong>microservice based API for ultrasound devices</strong>.
The main features are:
<ul>
<li> Microservice-enabled life cycle management, allowing other modules to easily consume mitk::USDevice-functionality.
<li> Handling and processing of ultrasound image data.
<ul>
<li> Fast image preprocessing capabilities (gray scale conversion, cropping) via OpenCV.
<li> Advanced image processing functions via mitk filters.
</ul>
<li> The mitk::USVideoDevice class allows to connect any ultrasound device with a video-out via a frame grabber.
<li> Connection of API-Enabled devices (specifically the Telemed LogicScan 128 is implemented).
<ul>
<li> The submodule USHardwareTelemed provides classes for handling a Telemed API device (mitk::USTelemedDevice).
<li> Control of API-enabled Devices via MITK (Widgets for basic B mode controls and probe selection are available).
</ul>
<li> Designed to interact with the \link NavigationGeneralModulePage IGT Module \endlink for tracking functionality.
</ul>
This module requires OpenCV to be enabled in the superbuild options via CMake.
Its functionality is made available to the user via the \link org_mitk_gui_qt_ultrasound UltrasoundSupport plugin \endlink
Documentation on how to use Telemed API devices can be found on \subpage USHardwareTelemedPage.
\section USDeviceHierarchy Ultrasound Device Hierarchy
Ultrasound Devices are managed in a simple hierarchy:
\imageMacro{ClassDiagramUSModuleOverview.png,"",14.92}
<ul>
<li> mitk::USDevice: The common superclass for all ultrasound devices. Deriving from this class will make sure that US-specific GUI-Components will be able to interact with your class.
Especially, the microservice life cycle is modeled in this class.
<li> mitk::USImageSource: Abstract class used by the mitk::USDevice for getting the images from the ultrasound device. The images are filtered by one ore more mitk::AbstractOpenCVImageFilter if they were set to the mitk::USImageSource object.
Each concrete subclass of mitk::USDevice has to subclass mitk::USImageSource to handle the actual receiving of images from the ultrasound device.
<li> Two devices are implemented in the ultrasound module:
<ul>
<li> mitk::USVideoDevice: This class can be used for every ultrasound device that is connected to the PC via a frame grabber or a similar video input device.
The \link org_mitk_gui_qt_ultrasound UltrasoundSupport plugin \endlink enables the user to create instances of mitk::USVideoDevice.
There also is a reusable Widget for this Task in the USUI Module. </li>
<li> mitk::USTelemedDevice: This class can be used for API-enabled ultrasound devices of Telemed (e.g. Telemed LogicScan 128). </li>
- <li> One can add another device by subclassing mitk::USDevice and mitk::USImageSource. Additionally the control interfaces may be implemented (see \link USControlInterfaces). </li>
+ <li> One can add another device by subclassing mitk::USDevice and mitk::USImageSource. Additionally the control interfaces may be implemented (see \link USControlInterfaces \endlink ). </li>
</ul>
</li>
</ul>
\section USDeviceLifeCycle Ultrasound Device Life Cycle
Each mitk::USDevice follows a life cycle handling the availabilty as a micro service and the connection to the hardware:
\imageMacro{MicroServiceLifeCycle.png,"",16.00}
-For changing the states corresponding methods are available in mitk::USDevice: mitk::USDevice::Initialize() for initialization, mitk::USDevice::Connect() for connecting, mitk::USDevice::Disconnect() for disconnecting and so on. For example, once an object of mitk::USDevice is constructed it can be made available as a micro service via a call to mitk::USDevice::Initialize(). The state changes to Initialized then and the device is available to other modules or plugins (\link org_mitk_gui_qt_ultrasound UltrasoundSupport\endlink, QmitkUSDeviceManagerWidget) through the micro service framework.
+For changing the states corresponding methods are available in mitk::USDevice: mitk::USDevice::Initialize() for initialization, mitk::USDevice::Connect() for connecting, mitk::USDevice::Disconnect() for disconnecting and so on. For example, once an object of mitk::USDevice is constructed it can be made available as a micro service via a call to mitk::USDevice::Initialize(). The state changes to Initialized then and the device is available to other modules or plugins (\link org_mitk_gui_qt_ultrasound UltrasoundSupport \endlink, QmitkUSDeviceManagerWidget) through the micro service framework.
The methods for changing the states should not be overwritten by sublcasses. Instead mitk::USDevice::OnInitialization(), mitk::USDevice::OnConnection() and so on can be overwritten for handling everything that has to be done on the corresponding state change.
When the mitk::USDevice object was created at first it is available just locally. An initialized device is available as a micro service, but not connected to the real hardware. A connected device is connected to the hardware, but no acquiring images. Finally, an activated device is acquiring images from the ultrasound hardware.
\section USControlInterfaces Control Interfaces for API Devices
Capabilities of API-based ultrasound devices are available through control interfaces which are shown below:
\imageMacro{USControlInterfaces.png,"",16.00}
The control interfaces mitk::USControlInterfaceProbes and mitk::USControlInterfaceBMode are available, while mitk::USControlInterfaceDoppler is empty at the moment. Every sublcass of mitk::USDevice can use an implementation of each of these interfaces, but this is not necessary. The mitk::USVideoDevice for example uses a custom control interface only (mitk::USVideoDeviceCustomControls), which is a subclass of mitk::USAbstractControlInterface. The mitk::USTelemedDevice uses mitk::USTelemedBModeControls for handling the ultrasound b mode and mitk::USTelemedProbesControls for handling the connected ultrasound probe.
Each custom control interface needs its own Widget (subclassed of QmitkUSAbstractCustomWidget), if it should be possible to control its functionality by using the \link org_mitk_gui_qt_ultrasound UltrasoundSupport\endlink plugin. For the standard interfaces mitk::USControlInterfaceProbes, mitk::USControlInterfaceBMode and mitk::USControlInterfaceDoppler there are Widgets available in the USUI module (QmitkUSControlsProbesWidget, QmitkUSControlsBModeWidget, QmitkUSControlsDopplerWidget) which can be used by plugins. For each Widget an object of the corresponding control interface must be set on its constructor call. A class diagram showing how the Widgets are connected to the control interfaces can be seen below:
\imageMacro{USControlWidgets.png,"",16.00}
A plugin can use the Widgets by creating a new object of the Widget and setting the corresponding interface object of the mitk::USDevice which should be controlled. How to use custom widgets is described in the class documentation of QmitkUSAbstractCustomWidget.
\section USDWidgets Available Widgets
There are some Widgets available in the USUI module that can be used for plugin development: a device management Widget, a Widget for creating new mitk::USVideoDevice objects and widgets for the control interfaces of API device.
The usage of the Widgets is described in more detail in the \link org_mitk_gui_qt_ultrasound UltrasoundSupport Plugin Documentation\endlink.
\subsection USQmitkUSDeviceManagerWidget QmitkUSDeviceManagerWidget
The QmitkUSDeviceManagerWidget can view every connected mitk::USDevice and allows the user to activate and deactivate devices. Additionally mitk::USVideoDevice can be created using the QmitkUSNewVideoDeviceWidget and removed by a corresponding button.
\subsection USQmitkNewVideoDeviceWidget QmitkUSNewVideoDeviceWidget
The QmitkUSNewVideoDeviceWidget allows the user to configure a frame grabber or other video input as a mitk::USVideoDevice.
\subsection USControlInterfaceWidgets Control Interface Widgets
There exists several widgets for controling ultrasound devices: QmitkUSControlsBModeWidget, QmitkUSControlsProbesWidget, QmitkUSControlsCustomVideoDeviceWidget. Own custom control widgets can be added by subclassing the available QmitkUSAbstractCustomWidget.
*/
\ No newline at end of file
diff --git a/Modules/US/USControlInterfaces/mitkUSControlInterfaceBMode.h b/Modules/US/USControlInterfaces/mitkUSControlInterfaceBMode.h
index a03068a7f5..4b6408513b 100644
--- a/Modules/US/USControlInterfaces/mitkUSControlInterfaceBMode.h
+++ b/Modules/US/USControlInterfaces/mitkUSControlInterfaceBMode.h
@@ -1,254 +1,254 @@
/*============================================================================
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 MITKUSControlInterfaceBMode_H_HEADER_INCLUDED_
#define MITKUSControlInterfaceBMode_H_HEADER_INCLUDED_
#include "mitkUSAbstractControlInterface.h"
namespace mitk {
/**
* \brief Interface defining methods for scanning mode b of ultrasound devices.
* It consists of methods for scanning depth, scanning gaing and scanning
* rejection.
*
* Scanning Depth: Defines the clipping of the ultrasound image. Small depth
* for looking at structures just below the skin. Great depth for seeing deeper
* structures.
*
* Scanning Gain: Defines amplification of ultrasound echo.
*
* Scanning Rejection: Defines range of the received values from the ultrasound
* signal.
*
* Scanning Dynamic Range: Ability of displaying strong and weak signals at the same
* time. High dynamic range means that strong and weak signals can be distinguished.
* Lower dynamic range can lead to more contrast.
*
* There is a getter and a setter defined for each kind of value. Additionaly
* there are methods for getting the range of the possible values. For
* uniformly distributed values there are three methods Get<VALUE>Min(),
* Get<VALUE>Max() and Get<VALUE>Tick(). For non-uniformly distributed values
* there is one method Get<VALUE>Values() which shoule return a list of all
* possible values.
*
* All getters of this interface must be implemented in a concrete
* subclass. Additionally all OnSet* methods must be implemented. They handle
* the acutal setting of the values at the device api. The Set* methods are
* already implemented in this class and should not be overwritten. There are
* some pure virtual methods in the superclass
* mitk::USAbstractControlInterface which must be implemented, too.
*
*/
class MITKUS_EXPORT USControlInterfaceBMode : public USAbstractControlInterface
{
public:
mitkClassMacro(USControlInterfaceBMode, USAbstractControlInterface);
/**
* \brief Initializes the microservice properties with the current values from the device.
* This method must be called before one would like to get the
* b mode values (e.g. frequency, power, ...) from the microservice
* and after the device is ready to deliver the values by the methods
* of this control interface.
*/
void Initialize();
/**
* \return current frequency value
*/
virtual double GetScanningFrequency( ) = 0;
/**
- * \param depth new frequency value
+ * \param frequency new frequency value
* Do not override this method in a subclass. Implement
* mitk::USControlInterfaceBMode::OnSetScanningFrequency instead.
*/
void SetScanningFrequency( double frequency );
/**
* \brief Virtual method which is called inside mitk::USControlInterfaceBMode::SetScanningFrequency.
*/
virtual void OnSetScanningFrequency( double frequency ) = 0;
/**
* \return vector of all possible frequency values for the utrasound device
*/
virtual std::vector<double> GetScanningFrequencyValues( ) = 0;
/**
* \return current power value
*/
virtual double GetScanningPower( ) = 0;
/**
- * \param depth new power value
+ * \param power new power value
* Do not override this method in a subclass. Implement
* mitk::USControlInterfaceBMode::OnSetScanningPower instead.
*/
void SetScanningPower( double power );
/**
* \brief Virtual method which is called inside mitk::USControlInterfaceBMode::SetScanningPower.
* Implement this method to handle the actual setting of the
* value at the device api.
*/
virtual void OnSetScanningPower( double power ) = 0;
/**
* \return minimum power value for the ultrasound device
*/
virtual double GetScanningPowerMin( ) = 0;
/**
* \return maximum power value for the ultrasound device
*/
virtual double GetScanningPowerMax( ) = 0;
/**
* \return interval between two power values for the ultrasound device
*/
virtual double GetScanningPowerTick( ) = 0;
/**
* \return current depth value
*/
virtual double GetScanningDepth( ) = 0;
/**
* \param depth new depth value
* Do not override this method in a subclass. Implement
* mitk::USControlInterfaceBMode::OnSetScanningDepth instead.
*/
void SetScanningDepth( double depth );
/**
* \brief Virtual method which is called inside mitk::USControlInterfaceBMode::SetScanningDepth.
* Implement this method to handle the actual setting of the
* value at the device api.
*/
virtual void OnSetScanningDepth( double depth ) = 0;
/**
* \return vector of all possible depth values for the utrasound device
*/
virtual std::vector<double> GetScanningDepthValues( ) = 0;
/**
* \return current scanning gain
*/
virtual double GetScanningGain( ) = 0;
/**
* \param gain new gain value
* Do not override this method in a subclass. Implement
* mitk::USControlInterfaceBMode::OnSetScanningGain instead.
*/
void SetScanningGain( double gain );
/**
* \brief Virtual method which is called inside mitk::USControlInterfaceBMode::SetScanningGain.
* Implement this method to handle the actual setting of the
* value at the device api.
*/
virtual void OnSetScanningGain( double gain ) = 0;
/**
* \return minimum gain value for the ultrasound device
*/
virtual double GetScanningGainMin( ) = 0;
/**
* \return maximum gain value for the ultrasound device
*/
virtual double GetScanningGainMax( ) = 0;
/**
* \return interval between two gain values for the ultrasound device
*/
virtual double GetScanningGainTick( ) = 0;
/**
* \return current scanning rejection
*/
virtual double GetScanningRejection( ) = 0;
/**
* \param rejection new rejection value
* Do not override this method in a subclass. Implement
* mitk::USControlInterfaceBMode::OnSetScanningRejection instead.
*/
void SetScanningRejection( double rejection );
/**
* \brief Virtual method which is called inside mitk::USControlInterfaceBMode::SetScanningRejection.
* Implement this method to handle the actual setting of the
* value at the device api.
*/
virtual void OnSetScanningRejection( double rejection ) = 0;
/**
* \return minimum rejection value for the ultrasound device
*/
virtual double GetScanningRejectionMin( ) = 0;
/**
* \return maximum rejection value for the ultrasound device
*/
virtual double GetScanningRejectionMax( ) = 0;
/**
* \return interval between two rejection values for the ultrasound device
*/
virtual double GetScanningRejectionTick( ) = 0;
/**
* \return current scanning dynamic range
*/
virtual double GetScanningDynamicRange( ) = 0;
/**
- * \param rejection new dynamic range value
+ * \param dynamicRange new dynamic range value
* Do not override this method in a subclass. Implement
* mitk::USControlInterfaceBMode::OnSetScanningDynamicRange instead.
*/
virtual void SetScanningDynamicRange( double dynamicRange );
/**
* \brief Virtual method which is called inside mitk::USControlInterfaceBMode::SetScanningDynamicRange.
* Implement this method to handle the actual setting of the
* value at the device api.
*/
virtual void OnSetScanningDynamicRange( double dynamicRange ) = 0;
/**
* \return minimum dynamic range value for the ultrasound device
*/
virtual double GetScanningDynamicRangeMin( ) = 0;
/**
* \return maximum dynamic range value for the ultrasound device
*/
virtual double GetScanningDynamicRangeMax( ) = 0;
/**
* \return interval between two dynamic range values for the ultrasound device
*/
virtual double GetScanningDynamicRangeTick( ) = 0;
protected:
USControlInterfaceBMode( itk::SmartPointer<USDevice> device );
~USControlInterfaceBMode( ) override;
};
} // namespace mitk
#endif // MITKUSControlInterfaceBMode_H_HEADER_INCLUDED_
diff --git a/Modules/US/USFilters/mitkIGTLMessageToUSImageFilter.h b/Modules/US/USFilters/mitkIGTLMessageToUSImageFilter.h
index dfcb9c71ed..d5419912a7 100644
--- a/Modules/US/USFilters/mitkIGTLMessageToUSImageFilter.h
+++ b/Modules/US/USFilters/mitkIGTLMessageToUSImageFilter.h
@@ -1,78 +1,78 @@
/*============================================================================
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 MITKIGTLMessageToUSImageFilter_H_HEADER_INCLUDED_
#define MITKIGTLMessageToUSImageFilter_H_HEADER_INCLUDED_
#include <mitkCommon.h>
#include <MitkUSExports.h>
#include <mitkUSImageSource.h>
#include <mitkIGTLMessageSource.h>
#include <igtlImageMessage.h>
namespace mitk
{
class MITKUS_EXPORT IGTLMessageToUSImageFilter : public USImageSource
{
public:
mitkClassMacro(IGTLMessageToUSImageFilter, USImageSource);
itkFactorylessNewMacro(Self);
itkCloneMacro(Self);
/**
*\brief Sets the number of expected outputs.
*
* Normally, this is done automatically by the filter concept. However, in our
* case we can not know, for example, how many tracking elements are stored
* in the incoming igtl message. Therefore, we have to set the number here to
* the expected value.
*/
void SetNumberOfExpectedOutputs(unsigned int numOutputs);
/**
*\brief Connects the input of this filter to the outputs of the given
* IGTLMessageSource
*
* This method does not support smartpointer. use FilterX.GetPointer() to
* retrieve a dumbpointer.
*/
void ConnectTo(mitk::IGTLMessageSource* UpstreamFilter);
protected:
IGTLMessageToUSImageFilter();
using Superclass::GetNextRawImage;
/**
* \brief Copies the data from the next OIGTL message to an mitk::Image.
*
- * \param img the image to fill with the data from the OIGTL message.
+ * \param imgVector the image to fill with the data from the OIGTL message.
*/
void GetNextRawImage(std::vector<mitk::Image::Pointer>& imgVector) override;
private:
mitk::IGTLMessageSource* m_upstream;
mitk::Image::Pointer m_previousImage;
/**
* \brief Templated method to copy the data of the OIGTL message to the image, depending
* on the pixel type contained in the message.
*
* \param img the image to fill with the data from msg
* \param msg the OIGTL message to copy the data from
* \param big_endian whether the data is in big endian byte order
*/
template <typename TPixel>
void Initiate(mitk::Image::Pointer& img, igtl::ImageMessage* msg, bool big_endian);
};
} // namespace mitk
#endif // MITKIGTLMessageToUSImageFilter_H_HEADER_INCLUDED_
diff --git a/Modules/US/USHardwareDiPhAS/mitkUSDiPhASProbe.h b/Modules/US/USHardwareDiPhAS/mitkUSDiPhASProbe.h
index d20b15e452..dfb307a928 100644
--- a/Modules/US/USHardwareDiPhAS/mitkUSDiPhASProbe.h
+++ b/Modules/US/USHardwareDiPhAS/mitkUSDiPhASProbe.h
@@ -1,46 +1,45 @@
/*============================================================================
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 MITKUSDiPhASProbe_H_HEADER_INCLUDED_
#define MITKUSDiPhASProbe_H_HEADER_INCLUDED_
#include "mitkUSProbe.h"
namespace mitk
{
/**
* \brief Specialized mitk::USProbe for handling DiPhAS API probe objects.
* It encapsulates a probe object from the DiPhAS API.
*
* This class should only be instantiated by mitk::USDiPhASProbesControls.
* Every other object can get instances of mitk::USDiPhASProbe from there.
*/
class USDiPhASProbe : public USProbe
{
public:
mitkClassMacro(USDiPhASProbe, USProbe);
mitkNewMacro1Param(Self, std::string);
protected:
/**
- * Constructs mitk::USDiPhASProbe object with given API objects.
+ * Constructs mitk::USDiPhASProbe object.
*
- * \param probe API probe object which should be represented by the constructed object
- * \param dataView API data view object conected to this probe object
+ * \param ProbeName
*/
USDiPhASProbe(std::string ProbeName);
virtual ~USDiPhASProbe();
};
} // namespace mitk
#endif // MITKUSDiPhASProbe_H_HEADER_INCLUDED_
diff --git a/Plugins/org.blueberry.core.commands/src/berryAbstractHandler.h b/Plugins/org.blueberry.core.commands/src/berryAbstractHandler.h
index daab470ee7..7a2fbdbf4a 100644
--- a/Plugins/org.blueberry.core.commands/src/berryAbstractHandler.h
+++ b/Plugins/org.blueberry.core.commands/src/berryAbstractHandler.h
@@ -1,159 +1,159 @@
/*============================================================================
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 BERRYABSTRACTHANDLER_H_
#define BERRYABSTRACTHANDLER_H_
#include "berryIHandler.h"
#include "berryIHandlerListener.h"
#include <org_blueberry_core_commands_Export.h>
namespace berry {
/**
* <p>
* This class is a partial implementation of <code>IHandler</code>. This
* abstract implementation provides support for handler listeners. You should
* subclass from this class unless you want to implement your own listener
* support. Subclasses should call
- * {@link AbstractHandler#fireHandlerChanged(HandlerEvent)}when the handler
- * changes. Subclasses can also override {@link AbstractHandler#isEnabled()} and
- * {@link AbstractHandler#isHandled()}.
+ * {@link AbstractHandler#FireHandlerChanged} when the handler
+ * changes. Subclasses can also override {@link AbstractHandler#IsEnabled} and
+ * {@link AbstractHandler#IsHandled}.
* </p>
*/
class BERRY_COMMANDS AbstractHandler : public QObject, public IHandler { // ,public EventManager {
Q_OBJECT
Q_INTERFACES(berry::IHandler)
public:
berryObjectMacro(AbstractHandler);
private:
/**
* Track this base class enabled state.
*/
bool baseEnabled;
IHandlerListener::Events handlerListeners;
public:
AbstractHandler();
/**
* @see IHandler#addHandlerListener(IHandlerListener)
*/
void AddHandlerListener(IHandlerListener* handlerListener) override;
/**
* The default implementation does nothing. Subclasses who attach listeners
* to other objects are encouraged to detach them in this method.
*
* @see IHandler#Dispose()
*/
void Dispose() override;
/**
* Whether this handler is capable of executing at this time. Subclasses may
* override this method. If clients override this method they should also
- * consider overriding {@link #setEnabled(Object)} so they can be notified
+ * consider overriding {@link #SetEnabled} so they can be notified
* about framework execution contexts.
*
* @return <code>true</code>
- * @see #setEnabled(Object)
- * @see #setBaseEnabled(boolean)
+ * @see #SetEnabled
+ * @see #SetBaseEnabled
*/
bool IsEnabled() const override;
/**
* Called by the framework to allow the handler to update its enabled state
* by extracting the same information available at execution time. Clients
* may override if they need to extract information from the application
* context.
*
* @param evaluationContext
* the application context. May be <code>null</code>
* @see #SetBaseEnabled(bool)
*/
void SetEnabled(const Object::Pointer& evaluationContext) override;
/**
* Whether this handler is capable of handling delegated responsibilities at
* this time. Subclasses may override this method.
*
* @return <code>true</code>
*/
bool IsHandled() const override;
/**
* @see IHandler#removeHandlerListener(IHandlerListener)
*/
void RemoveHandlerListener(IHandlerListener* handlerListener) override;
protected:
/**
* Fires an event to all registered listeners describing changes to this
* instance.
* <p>
* Subclasses may extend the definition of this method (i.e., if a different
* type of listener can be attached to a subclass). This is used primarily
* for support of <code>AbstractHandler</code> in
* <code>org.blueberry.ui.workbench</code>, and clients should be wary of
* overriding this behaviour. If this method is overridden, then the first
* line of the method should be "<code>super.fireHandlerChanged(handlerEvent);</code>".
* </p>
*
* @param handlerEvent
* the event describing changes to this instance. Must not be
* <code>null</code>.
*/
void FireHandlerChanged(const SmartPointer<HandlerEvent>& handlerEvent);
/**
- * Allow the default {@link #isEnabled()} to answer our enabled state. It
+ * Allow the default {@link #IsEnabled} to answer our enabled state. It
* will fire a HandlerEvent if necessary. If clients use this method they
- * should also consider overriding {@link #setEnabled(Object)} so they can
+ * should also consider overriding {@link #SetEnabled} so they can
* be notified about framework execution contexts.
*
* @param state
* the enabled state
*/
void SetBaseEnabled(bool state);
/**
* <p>
* Returns true iff there is one or more IHandlerListeners attached to this
* AbstractHandler.
* </p>
* <p>
* Subclasses may extend the definition of this method (i.e., if a different
* type of listener can be attached to a subclass). This is used primarily
* for support of <code>AbstractHandler</code> in
* <code>org.blueberry.ui.qt</code>, and clients should be wary of
* overriding this behaviour. If this method is overridden, then the return
* value should include "<code>super.hasListeners() ||</code>".
* </p>
*
* @return true iff there is one or more IHandlerListeners attached to this
* AbstractHandler
*/
virtual bool HasListeners() const;
};
}
#endif /*BERRYABSTRACTHANDLER_H_*/
diff --git a/Plugins/org.blueberry.core.commands/src/berryCommand.h b/Plugins/org.blueberry.core.commands/src/berryCommand.h
index adea1e035f..27836c032d 100644
--- a/Plugins/org.blueberry.core.commands/src/berryCommand.h
+++ b/Plugins/org.blueberry.core.commands/src/berryCommand.h
@@ -1,509 +1,509 @@
/*============================================================================
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 BERRYCOMMAND_H_
#define BERRYCOMMAND_H_
#include "berryNamedHandleObjectWithState.h"
#include <berryICommandListener.h>
#include <berryIHandlerListener.h>
#include <berryIExecutionListenerWithChecks.h>
#include <berryIParameter.h>
#include <berryParameterType.h>
namespace berry
{
class CommandCategory;
class ExecutionEvent;
struct IHandler;
/**
* <p>
* A command is an abstract representation for some semantic behaviour. It is
* not the actual implementation of this behaviour, nor is it the visual
* appearance of this behaviour in the user interface. Instead, it is a bridge
* between the two.
* </p>
* <p>
* The concept of a command is based on the command design pattern. The notable
* difference is how the command delegates responsibility for execution. Rather
* than allowing concrete subclasses, it uses a handler mechanism (see the
* <code>handlers</code> extension point). This provides another level of
* indirection.
* </p>
* <p>
* A command will exist in two states: defined and undefined. A command is
* defined if it is declared in the XML of a resolved plug-in. If the plug-in is
* unloaded or the command is simply not declared, then it is undefined. Trying
* to reference an undefined command will succeed, but trying to access any of
* its functionality will fail with a <code>NotDefinedException</code>. If
* you need to know when a command changes from defined to undefined (or vice
* versa), then attach a command listener.
* </p>
* <p>
* Commands are mutable and will change as their definition changes.
* </p>
*
*/
class BERRY_COMMANDS Command : public NamedHandleObjectWithState, private IHandlerListener
{ // implements Comparable {
public:
berryObjectMacro(Command);
/**
* This flag can be set to <code>true</code> if commands should print
* information to <code>System.out</code> when executing.
*/
static bool DEBUG_COMMAND_EXECUTION;
/**
* This flag can be set to <code>true</code> if commands should print
* information to <code>System.out</code> when changing handlers.
*/
static bool DEBUG_HANDLERS;
/**
* This flag can be set to a particular command identifier if only that
* command should print information to <code>System.out</code> when
* changing handlers.
*/
static QString DEBUG_HANDLERS_COMMAND_ID;
private:
/**
* The category to which this command belongs. This value should not be
* <code>null</code> unless the command is undefined.
*/
SmartPointer<CommandCategory> category;
/**
* A collection of objects listening to the execution of this command.
*/
IExecutionListenerWithChecks::Events executionEvents;
//ListenerList executionListeners;
/**
* A collection of objects listening to changes of this command.
*/
ICommandListener::Events commandEvents;
/**
* The handler currently associated with this command. This value may be
* <code>null</code> if there is no handler currently.
*/
SmartPointer<IHandler> handler;
/**
* The help context identifier for this command. This can be
* <code>null</code> if there is no help currently associated with the
* command.
*/
QString helpContextId;
/**
* The ordered array of parameters understood by this command. This value
* may be <code>null</code> if there are no parameters, or if the command
* is undefined. It may also be empty.
*/
QList<SmartPointer<IParameter> > parameters;
/**
* The type of the return value of this command. This value may be
* <code>null</code> if the command does not declare a return type.
*/
SmartPointer<ParameterType> returnType;
protected:
/**
* Constructs a new instance of <code>Command</code> based on the given
* identifier. When a command is first constructed, it is undefined.
* Commands should only be constructed by the <code>CommandManager</code>
* to ensure that the identifier remains unique.
*
* @param id
* The identifier for the command. This value must not be
* <code>null</code>, and must be unique amongst all commands.
*/
Command(const QString& id);
friend class CommandManager;
public:
/**
* Adds a listener to this command that will be notified when this command's
* state changes.
*
* @param commandListener
* The listener to be added; must not be <code>null</code>.
*/
void AddCommandListener(ICommandListener* commandListener);
/**
* Adds a listener to this command that will be notified when this command
* is about to execute.
*
* @param executionListener
* The listener to be added; must not be <code>null</code>.
*/
void AddExecutionListener(IExecutionListener* executionListener);
/**
* <p>
* Adds a state to this command. This will add this state to the active
* handler, if the active handler is an instance of {@link IObjectWithState}.
* </p>
* <p>
* A single instance of {@link State} cannot be registered with multiple
* commands. Each command requires its own unique instance.
* </p>
*
* @param id
* The identifier of the state to add; must not be
* <code>null</code>.
* @param state
* The state to add; must not be <code>null</code>.
*/
void AddState(const QString& id, const SmartPointer<State>& state) override;
/**
* Compares this command with another command by comparing each of its
* non-transient attributes.
*
* @param object
* The object with which to compare; must be an instance of
* <code>Command</code>.
* @return false if the object is
* equal to or greater than this command.
*/
bool operator<(const Object* object) const override;
/**
* <p>
* Defines this command by giving it a name, and possibly a description as
* well. The defined property automatically becomes <code>true</code>.
* </p>
* <p>
* Notification is sent to all listeners that something has changed.
* </p>
*
* @param name
* The name of this command; must not be <code>null</code>.
* @param description
* The description for this command; may be <code>null</code>.
* @param category
* The category for this command; must not be <code>null</code>.
* @param parameters
* The parameters understood by this command. This value may be
* either <code>null</code> or empty if the command does not
* accept parameters.
* @param returnType
* The type of value returned by this command. This value may be
* <code>null</code> if the command does not declare a return
* type.
* @param helpContextId
* The identifier of the help context to associate with this
* command; may be <code>null</code> if this command does not
* have any help associated with it.
*/
void Define(const QString& name, const QString& description,
const SmartPointer<CommandCategory> category,
const QList<SmartPointer<IParameter> >& parameters = QList<SmartPointer<IParameter> >(),
const SmartPointer<ParameterType>& returnType = SmartPointer<ParameterType>(nullptr),
const QString& helpContextId = "");
/**
* Executes this command by delegating to the current handler, if any. If
* the debugging flag is set, then this method prints information about
* which handler is selected for performing this command. This does checks
* to see if the command is enabled and defined. If it is not both enabled
* and defined, then the execution listeners will be notified and an
* exception thrown.
*
* @param event
* An event containing all the information about the current
* state of the application; must not be <code>null</code>.
* @return The result of the execution; may be <code>null</code>. This
* result will be available to the client executing the command, and
* execution listeners.
* @throws ExecutionException
* If the handler has problems executing this command.
* @throws NotDefinedException
* If the command you are trying to execute is not defined.
* @throws NotEnabledException
* If the command you are trying to execute is not enabled.
* @throws NotHandledException
* If there is no handler.
*/
Object::Pointer ExecuteWithChecks(const SmartPointer<const ExecutionEvent> event);
private:
/**
* Notifies the listeners for this command that it has changed in some way.
*
* @param commandEvent
* The event to send to all of the listener; must not be
* <code>null</code>.
*/
void FireCommandChanged(const SmartPointer<const CommandEvent> commandEvent);
/**
* Notifies the execution listeners for this command that an attempt to
* execute has failed because the command is not defined.
*
* @param e
* The exception that is about to be thrown; never
* <code>null</code>.
* @since 3.2
*/
void FireNotDefined(const NotDefinedException* e);
/**
* Notifies the execution listeners for this command that an attempt to
* execute has failed because there is no handler.
*
* @param e
* The exception that is about to be thrown; never
* <code>null</code>.
*/
void FireNotEnabled(const NotEnabledException* e);
/**
* Notifies the execution listeners for this command that an attempt to
* execute has failed because there is no handler.
*
* @param e
* The exception that is about to be thrown; never
* <code>null</code>.
*/
void FireNotHandled(const NotHandledException* e);
/**
* Notifies the execution listeners for this command that an attempt to
* execute has failed during the execution.
*
* @param e
* The exception that has been thrown; never <code>null</code>.
* After this method completes, the exception will be thrown
* again.
*/
void FirePostExecuteFailure(const ExecutionException* e);
/**
* Notifies the execution listeners for this command that an execution has
* completed successfully.
*
* @param returnValue
* The return value from the command; may be <code>null</code>.
*/
void FirePostExecuteSuccess(const Object::Pointer returnValue);
/**
* Notifies the execution listeners for this command that an attempt to
* execute is about to start.
*
* @param event
* The execution event that will be used; never <code>null</code>.
*/
void FirePreExecute(const SmartPointer<const ExecutionEvent> event);
public:
/**
* Returns the current handler for this command. This is used by the command
* manager for determining the appropriate help context identifiers and by
* the command service to allow handlers to update elements.
* <p>
* This value can change at any time and should never be cached.
* </p>
*
* @return The current handler for this command; may be <code>null</code>.
*/
SmartPointer<IHandler> GetHandler() const;
/**
* Returns the help context identifier associated with this command. This
* method should not be called by clients. Clients should use
- * {@link CommandManager#getHelpContextId(Command)} instead.
+ * {@link CommandManager#GetHelpContextId} instead.
*
* @return The help context identifier for this command; may be
* <code>null</code> if there is none.
*/
QString GetHelpContextId() const;
/**
* Returns the parameter with the provided id or <code>null</code> if this
* command does not have a parameter with the id.
*
* @param parameterId
* The id of the parameter to retrieve.
* @return The parameter with the provided id or <code>null</code> if this
* command does not have a parameter with the id.
* @throws NotDefinedException
* If the handle is not currently defined.
*/
SmartPointer<IParameter> GetParameter(const QString& parameterId) const;
/**
* Returns the parameters for this command. This call triggers provides a
* copy of the array, so excessive calls to this method should be avoided.
*
* @return The parameters for this command. This value might be
* <code>null</code>, if the command has no parameters.
* @throws NotDefinedException
* If the handle is not currently defined.
*/
QList<SmartPointer<IParameter> > GetParameters() const;
/**
* Returns the {@link ParameterType} for the parameter with the provided id
* or <code>null</code> if this command does not have a parameter type
* with the id.
*
* @param parameterId
* The id of the parameter to retrieve the {@link ParameterType}
* of.
* @return The {@link ParameterType} for the parameter with the provided id
* or <code>null</code> if this command does not have a parameter
* type with the provided id.
* @throws NotDefinedException
* If the handle is not currently defined.
*/
SmartPointer<ParameterType> GetParameterType(const QString& parameterId) const;
/**
* Returns the {@link ParameterType} for the return value of this command or
* <code>null</code> if this command does not declare a return value
* parameter type.
*
* @return The {@link ParameterType} for the return value of this command or
* <code>null</code> if this command does not declare a return
* value parameter type.
* @throws NotDefinedException
* If the handle is not currently defined.
*/
SmartPointer<ParameterType> GetReturnType() const;
/**
* Returns whether this command has a handler, and whether this handler is
* also handled and enabled.
*
* @return <code>true</code> if the command is handled; <code>false</code>
* otherwise.
*/
bool IsEnabled() const;
/**
* Called be the framework to allow the handler to update its enabled state.
*
* @param evaluationContext
* the state to evaluate against. May be <code>null</code>
* which indicates that the handler can query whatever model that
* is necessary. This context must not be cached.
*/
void SetEnabled(const Object::Pointer& evaluationContext);
/**
* Returns whether this command has a handler, and whether this handler is
* also handled.
*
* @return <code>true</code> if the command is handled; <code>false</code>
* otherwise.
*/
bool IsHandled() const;
/**
* Removes a listener from this command.
*
* @param commandListener
* The listener to be removed; must not be <code>null</code>.
*
*/
void RemoveCommandListener(ICommandListener* commandListener);
/**
* Removes a listener from this command.
*
* @param executionListener
* The listener to be removed; must not be <code>null</code>.
*
*/
void RemoveExecutionListener(IExecutionListener* executionListener);
/**
* <p>
* Removes a state from this command. This will remove the state from the
* active handler, if the active handler is an instance of
* {@link IObjectWithState}.
* </p>
*
* @param stateId
* The identifier of the state to remove; must not be
* <code>null</code>.
*/
void RemoveState(const QString& stateId) override;
/**
* Changes the handler for this command. This will remove all the state from
* the currently active handler (if any), and add it to <code>handler</code>.
* If debugging is turned on, then this will also print information about
* the change to <code>System.out</code>.
*
* @param handler
* The new handler; may be <code>null</code> if none.
* @return <code>true</code> if the handler changed; <code>false</code>
* otherwise.
*/
bool SetHandler(const SmartPointer<IHandler> handler);
private:
/**
* @return the handler listener
*/
IHandlerListener* GetHandlerListener();
/**
* Our command will listen to the active handler for enablement changes so
* that they can be fired from the command itself.
*/
void HandlerChanged(const SmartPointer<HandlerEvent>& handlerEvent) override;
public:
/**
* The string representation of this command -- for debugging purposes only.
* This string should not be shown to an end user.
*
* @return The string representation; never <code>null</code>.
*/
QString ToString() const override;
/**
* Makes this command become undefined. This has the side effect of changing
* the name and description to <code>null</code>. This also removes all
* state and disposes of it. Notification is sent to all listeners.
*/
void Undefine() override;
};
}
#endif /*BERRYCOMMAND_H_*/
diff --git a/Plugins/org.blueberry.core.commands/src/berryCommandManager.h b/Plugins/org.blueberry.core.commands/src/berryCommandManager.h
index 4cc307186f..e01dae7312 100755
--- a/Plugins/org.blueberry.core.commands/src/berryCommandManager.h
+++ b/Plugins/org.blueberry.core.commands/src/berryCommandManager.h
@@ -1,628 +1,628 @@
/*============================================================================
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 BERRYCOMMANDMANAGER_H_
#define BERRYCOMMANDMANAGER_H_
#include "common/berryHandleObjectManager.h"
#include "berryIExecutionListenerWithChecks.h"
#include "berryICommandListener.h"
#include "berryIParameterTypeListener.h"
#include "berryICommandCategoryListener.h"
#include "berryICommandManagerListener.h"
#include <QScopedPointer>
namespace berry
{
struct IParameter;
struct IHandler;
class ParameterType;
class ParameterizedCommand;
class Parameterization;
class Command;
class CommandCategory;
/**
* <p>
* A central repository for commands -- both in the defined and undefined
* states. Commands can be created and retrieved using this manager. It is
* possible to listen to changes in the collection of commands by attaching a
* listener to the manager.
* </p>
*
* @see CommandManager#getCommand(String)
* @since 3.1
*/
class BERRY_COMMANDS CommandManager: public HandleObjectManager
{
private:
typedef HandleObjectManager::HandleObjectsSet HandleObjectsSet;
typedef HandleObjectManager::HandleObjectsByIdMap HandleObjectsByIdMap;
/**
* A listener that forwards incoming execution events to execution listeners
* on this manager. The execution events will come from any command on this
* manager.
*/
struct ExecutionListener: public IExecutionListenerWithChecks
{
ExecutionListener(CommandManager* commandManager);
void NotDefined(const QString& commandId,
const NotDefinedException* exception) override;
void NotEnabled(const QString& commandId,
const NotEnabledException* exception) override;
void NotHandled(const QString& commandId,
const NotHandledException* exception) override;
void PostExecuteFailure(const QString& commandId,
const ExecutionException* exception) override;
void PostExecuteSuccess(const QString& commandId,
const Object::Pointer& returnValue) override;
void PreExecute(const QString& commandId, const SmartPointer<
const ExecutionEvent>& event) override;
private:
CommandManager* commandManager;
};
struct CommandCategoryListener: public ICommandCategoryListener
{
CommandCategoryListener(CommandManager* commandManager);
void CategoryChanged(
const SmartPointer<const CommandCategoryEvent>& categoryEvent) override;
private:
CommandManager* commandManager;
};
QScopedPointer<ICommandCategoryListener> categoryListener;
struct CommandListener: public ICommandListener
{
CommandListener(CommandManager* commandManager);
void CommandChanged(const SmartPointer<const CommandEvent>& commandEvent) override;
private:
CommandManager* commandManager;
};
QScopedPointer<ICommandListener> commandListener;
struct ParameterTypeListener: public IParameterTypeListener
{
ParameterTypeListener(CommandManager* commandManager);
void ParameterTypeChanged(
const SmartPointer<const ParameterTypeEvent>& parameterTypeEvent) override;
private:
CommandManager* commandManager;
};
QScopedPointer<IParameterTypeListener> parameterTypeListener;
public:
/**
* The identifier of the category in which all auto-generated commands will
* appear. This value must never be <code>null</code>.
*/
static const QString AUTOGENERATED_CATEGORY_ID; // = "org.blueberry.core.commands.categories.autogenerated";
/**
* The default constructor
*/
CommandManager();
/**
* Adds a listener to this command manager. The listener will be notified
* when the set of defined commands changes. This can be used to track the
* global appearance and disappearance of commands.
*
* @param listener
* The listener to attach; must not be <code>null</code>.
*/
void AddCommandManagerListener(ICommandManagerListener* listener);
/**
* Adds an execution listener to this manager. This listener will be
* notified if any of the commands controlled by this manager execute. This
* can be used to support macros and instrumentation of commands.
*
* @param listener
* The listener to attach; must not be <code>null</code>.
*/
void AddExecutionListener(IExecutionListener* listener);
/**
* Sets the name and description of the category for uncategorized commands.
* This is the category that will be returned if
- * {@link #getCategory(String)} is called with <code>null</code>.
+ * {@link #GetCategory} is called with <code>null</code>.
*
* @param name
* The name of the category for uncategorized commands; must not
* be <code>null</code>.
* @param description
* The description of the category for uncategorized commands;
* may be <code>null</code>.
*/
void DefineUncategorizedCategory(const QString& name,
const QString& description);
/**
* <p>
* Returns a {@link ParameterizedCommand} with a command and
* parameterizations as specified in the provided
* <code>serializedParameterizedCommand</code> string. The
* <code>serializedParameterizedCommand</code> must use the format
- * returned by {@link ParameterizedCommand#serialize()} and described in the
+ * returned by {@link ParameterizedCommand#Serialize} and described in the
* Javadoc for that method.
* </p>
* <p>
* If a parameter id encoded in the
* <code>serializedParameterizedCommand</code> does not exist in the
* encoded command, that parameter id and value are ignored. A given
* parameter id should not be used more than once in
* <code>serializedParameterizedCommand</code>. This will not result in
* an exception, but in this case the value of the parameter when the
* command is executed is unspecified.
* </p>
* <p>
* This method will never return <code>null</code>, however it may throw
* an exception if there is a problem processing the serialization string or
* the encoded command is undefined.
* </p>
*
* @param serializedParameterizedCommand
* a string representing a command id and parameter ids and
* values; must not be <code>null</code>
* @return a {@link ParameterizedCommand} with the command and
* parameterizations encoded in the
* <code>serializedParameterizedCommand</code>; never
* <code>null</code>.
* @throws NotDefinedException
* if the command indicated in
* <code>serializedParameterizedCommand</code> is not defined
* @throws SerializationException
* if there is an error deserializing
* <code>serializedParameterizedCommand</code>
* @see ParameterizedCommand#serialize()
*/
SmartPointer<ParameterizedCommand> Deserialize(const QString& serializedParameterizedCommand);
/**
* Returns all of the commands known by this manager -- defined and
* undefined.
*
* @return All of the commands; may be empty, but never <code>null</code>.
*/
QList<SmartPointer<Command> > GetAllCommands() const;
/**
* Gets the category with the given identifier. If no such category
* currently exists, then the category will be created (but be undefined).
*
* @param categoryId
* The identifier to find; must not be <code>null</code>. If
* the category is <code>null</code>, then a category suitable
* for uncategorized items is defined and returned.
* @return The category with the given identifier; this value will never be
* <code>null</code>, but it might be undefined.
* @see Category
*/
SmartPointer<CommandCategory> GetCategory(const QString& categoryId);
/**
* Gets the command with the given identifier. If no such command currently
* exists, then the command will be created (but will be undefined).
*
* @param commandId
* The identifier to find; must not be <code>null</code> and
* must not be zero-length.
* @return The command with the given identifier; this value will never be
* <code>null</code>, but it might be undefined.
* @see Command
*/
SmartPointer<Command> GetCommand(const QString& commandId);
/**
* Returns the categories that are defined.
*
* @return The defined categories; this value may be empty, but it is never
* <code>null</code>.
*/
QList<SmartPointer<CommandCategory> > GetDefinedCategories();
/**
* Returns the set of identifiers for those category that are defined.
*
* @return The set of defined category identifiers; this value may be empty,
* but it is never <code>null</code>.
*/
QSet<QString> GetDefinedCategoryIds() const;
/**
* Returns the set of identifiers for those commands that are defined.
*
* @return The set of defined command identifiers; this value may be empty,
* but it is never <code>null</code>.
*/
QSet<QString> GetDefinedCommandIds() const;
/**
* Returns the commands that are defined.
*
* @return The defined commands; this value may be empty, but it is never
* <code>null</code>.
*/
QList<SmartPointer<Command> > GetDefinedCommands() const;
/**
* Returns the set of identifiers for those parameter types that are
* defined.
*
* @return The set of defined command parameter type identifiers; this value
* may be empty, but it is never <code>null</code>.
*/
QSet<QString> GetDefinedParameterTypeIds() const;
/**
* Returns the command parameter types that are defined.
*
* @return The defined command parameter types; this value may be empty, but
* it is never <code>null</code>.
*/
QList<SmartPointer<ParameterType> > GetDefinedParameterTypes();
/**
* Gets the help context identifier for a particular command. The command's
* handler is first checked for a help context identifier. If the handler
* does not have a help context identifier, then the help context identifier
* for the command is returned. If neither has a help context identifier,
* then <code>null</code> is returned.
*
* @param command
* The command for which the help context should be retrieved;
* must not be <code>null</code>.
* @return The help context identifier to use for the given command; may be
* <code>null</code>.
* @throws NotDefinedException
* If the given command is not defined.
*/
QString GetHelpContextId(const SmartPointer<const Command> command) const;
/**
* Gets the command {@link ParameterType} with the given identifier. If no
* such command parameter type currently exists, then the command parameter
* type will be created (but will be undefined).
*
* @param parameterTypeId
* The identifier to find; must not be <code>null</code> and
* must not be zero-length.
* @return The {@link ParameterType} with the given identifier; this value
* will never be <code>null</code>, but it might be undefined.
*/
SmartPointer<ParameterType> GetParameterType(const QString& parameterTypeId);
/**
* Removes a listener from this command manager.
*
* @param listener
* The listener to be removed; must not be <code>null</code>.
*/
void RemoveCommandManagerListener(ICommandManagerListener* listener);
/**
* Removes an execution listener from this command manager.
*
* @param listener
* The listener to be removed; must not be <code>null</code>.
*/
void RemoveExecutionListener(IExecutionListener* listener);
/**
* Block updates all of the handlers for all of the commands. If the handler
* is <code>null</code> or the command id does not exist in the map, then
* the command becomes unhandled. Otherwise, the handler is set to the
* corresponding value in the map.
*
* @param handlersByCommandId
* A map of command identifiers (<code>String</code>) to
* handlers (<code>IHandler</code>). This map may be
* <code>null</code> if all handlers should be cleared.
* Similarly, if the map is empty, then all commands will become
* unhandled.
*/
void SetHandlersByCommandId(
const QHash<QString, SmartPointer<IHandler> >& handlersByCommandId);
/**
* Sets the help context identifier to associate with a particular handler.
*
* @param handler
* The handler with which to register a help context identifier;
* must not be <code>null</code>.
* @param helpContextId
* The help context identifier to register; may be
* <code>null</code> if the help context identifier should be
* removed.
*/
void SetHelpContextId(const SmartPointer<IHandler> handler,
const QString& helpContextId);
/**
* Fires the <code>notEnabled</code> event for
* <code>executionListeners</code>.
* <p>
* <b>Note:</b> This supports bridging actions to the command framework,
* and should not be used outside the framework.
* </p>
*
* @param commandId
* The command id of the command about to execute, never
* <code>null</code>.
* @param exception
* The exception, never <code>null</code>.
*/
void FireNotEnabled(const QString& commandId,
const NotEnabledException* exception);
/**
* Fires the <code>notDefined</code> event for
* <code>executionListeners</code>.
* <p>
* <b>Note:</b> This supports bridging actions to the command framework,
* and should not be used outside the framework.
* </p>
*
* @param commandId
* The command id of the command about to execute, never
* <code>null</code>.
* @param exception
* The exception, never <code>null</code>.
*/
void FireNotDefined(const QString& commandId,
const NotDefinedException* exception);
/**
* Fires the <code>preExecute</code> event for
* <code>executionListeners</code>.
* <p>
* <b>Note:</b> This supports bridging actions to the command framework,
* and should not be used outside the framework.
* </p>
*
* @param commandId
* The command id of the command about to execute, never
* <code>null</code>.
* @param event
* The event that triggered the command, may be <code>null</code>.
*/
void FirePreExecute(const QString& commandId, const SmartPointer<
const ExecutionEvent> event);
/**
* Fires the <code>postExecuteSuccess</code> event for
* <code>executionListeners</code>.
* <p>
* <b>Note:</b> This supports bridging actions to the command framework,
* and should not be used outside the framework.
* </p>
*
* @param commandId
* The command id of the command executed, never
* <code>null</code>.
* @param returnValue
* The value returned from the command, may be <code>null</code>.
*/
void FirePostExecuteSuccess(const QString& commandId,
Object::Pointer returnValue);
/**
* Fires the <code>postExecuteFailure</code> event for
* <code>executionListeners</code>.
* <p>
* <b>Note:</b> This supports bridging actions to the command framework,
* and should not be used outside the framework.
* </p>
*
* @param commandId
* The command id of the command executed, never
* <code>null</code>.
* @param exception
* The exception, never <code>null</code>.
*/
void FirePostExecuteFailure(const QString& commandId,
const ExecutionException* exception);
protected:
/**
* The escape character to use for serialization and deserialization of
* parameterized commands.
*/
static const char ESCAPE_CHAR; // = '%';
/**
* The character that separates a parameter id from its value.
*/
static const char ID_VALUE_CHAR; // = '=';
/**
* The character that indicates the end of a list of parameters.
*/
static const char PARAMETER_END_CHAR; // = ')';
/**
* The character that separators parameters from each other.
*/
static const char PARAMETER_SEPARATOR_CHAR; // = ',';
/**
* The character that indicates the start of a list of parameters.
*/
static const char PARAMETER_START_CHAR; // = '(';
friend class ParameterizedCommand;
private:
/**
* Unescapes special characters in the command id, parameter ids and
* parameter values for {@link #deserialize(String)}. The special characters
* {@link #PARAMETER_START_CHAR}, {@link #PARAMETER_END_CHAR},
* {@link #ID_VALUE_CHAR}, {@link #PARAMETER_SEPARATOR_CHAR} and
* {@link #ESCAPE_CHAR} are escaped by prepending an {@link #ESCAPE_CHAR}
* character.
* <p>
* See also ParameterizedCommand.escape(String)
* </p>
*
* @param escapedText
* a <code>String</code> that may contain escaped special
* characters for command serialization.
* @return a <code>String</code> representing <code>escapedText</code>
* with any escaped characters replaced by their literal values
* @throws SerializationException
* if <code>escapedText</code> contains an invalid escape
* sequence
*/
static QString Unescape(const QString& escapedText);
/**
* The map of category identifiers (<code>String</code>) to categories (
* <code>Category</code>). This collection may be empty, but it is never
* <code>null</code>.
*/
QHash<QString, SmartPointer<CommandCategory> > categoriesById;
/**
* The set of identifiers for those categories that are defined. This value
* may be empty, but it is never <code>null</code>.
*/
QSet<QString> definedCategoryIds;
/**
* The set of identifiers for those command parameter types that are
* defined. This value may be empty, but it is never <code>null</code>.
*
*/
QSet<QString> definedParameterTypeIds;
/**
* The execution listener for this command manager. This just forwards
* events from commands controlled by this manager to listeners on this
* manager.
*/
QScopedPointer<IExecutionListenerWithChecks> executionListener;
/**
* The collection of execution listeners. This collection is
* <code>null</code> if there are no listeners.
*/
IExecutionListenerWithChecks::Events executionEvents;
/**
*
*/
ICommandManagerListener::Events commandManagerEvents;
/**
* The help context identifiers ({@link String}) for a handler ({@link IHandler}).
* This map may be empty, but it is never <code>null</code>. Entries are
* removed if all strong references to the handler are removed.
*/
QHash<WeakPointer<IHandler>, QString> helpContextIdsByHandler;
/**
* The map of parameter type identifiers (<code>String</code>) to
* parameter types ( <code>ParameterType</code>). This collection may be
* empty, but it is never <code>null</code>.
*/
QHash<QString, SmartPointer<ParameterType> > parameterTypesById;
/**
* Notifies all of the listeners to this manager that the set of defined
* command identifiers has changed.
*
* @param event
* The event to send to all of the listeners; must not be
* <code>null</code>.
*/
void FireCommandManagerChanged(
const SmartPointer<const CommandManagerEvent> event);
/**
* Returns an array of parameterizations for the provided command by
* deriving the parameter ids and values from the provided
* <code>serializedParameters</code> string.
*
* @param serializedParameters
* a String encoding parameter ids and values; must not be
* <code>null</code>.
* @param parameters
* array of parameters of the command being deserialized; may be
* <code>null</code>.
* @return an array of parameterizations; may be <code>null</code>.
* @throws SerializationException
* if there is an error deserializing the parameters
*/
QList<Parameterization> GetParameterizations(
const QString& serializedParameters,
const QList<SmartPointer<IParameter> >& parameters) const;
/**
* Searches for the index of a <code>char</code> in a <code>String</code>
* but disregards characters prefixed with the {@link #ESCAPE_CHAR} escape
* character. This is used by {@link #deserialize(String)} and
* {@link #getParameterizations(String, IParameter[])} to parse the
* serialized parameterized command string.
*
* @param escapedText
* the string to search for the index of <code>ch</code> in
* @param ch
* a character to search for in <code>escapedText</code>
* @return the index of the first unescaped occurrence of the character in
* <code>escapedText</code>, or <code>-1</code> if the
* character does not occur unescaped.
* @see String#indexOf(int)
*/
int UnescapedIndexOf(const QString& escapedText, const char ch) const;
};
}
#endif /* BERRYCOMMANDMANAGER_H_ */
diff --git a/Plugins/org.blueberry.core.commands/src/berryExecutionEvent.h b/Plugins/org.blueberry.core.commands/src/berryExecutionEvent.h
index d6871926b5..5b1a00cf29 100644
--- a/Plugins/org.blueberry.core.commands/src/berryExecutionEvent.h
+++ b/Plugins/org.blueberry.core.commands/src/berryExecutionEvent.h
@@ -1,169 +1,169 @@
/*============================================================================
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 BERRYEXECUTIONEVENT_H_
#define BERRYEXECUTIONEVENT_H_
#include <berryMacros.h>
#include "berryCommand.h"
#include <QHash>
namespace berry {
/**
* <p>
* The data object to pass to the command (and its handler) as it executes. This
* carries information about the current state of the application, and the
* application context in which the command was executed.
* </p>
* <p>
* An execution event carries three blocks of data: the parameters, the trigger,
* and the application context. How these blocks are used is application
* dependent. In the BlueBerry workbench, the trigger is an SWT event, and the
* application context contains information about the selection and active part.
* </p>
*/
class BERRY_COMMANDS ExecutionEvent : public Object {
public:
berryObjectMacro(ExecutionEvent);
typedef QHash<QString, QString> ParameterMap;
private:
/**
* The state of the application at the time the execution was triggered. In
* the BlueBerry workbench, this might contain information about the active
* part of the active selection (for example). This value may be
* <code>null</code>.
*/
const Object::Pointer applicationContext;
/**
* The command being executed. This value may be <code>null</code>.
*/
const Command::ConstPointer command;
/**
* The parameters to qualify the execution. For handlers that normally
* prompt for additional information, these can be used to avoid prompting.
* This value may be empty, but it is never <code>null</code>.
*/
const ParameterMap parameters;
/**
* The object that triggered the execution. In an event-driven architecture,
* this is typically just another event. In the BlueBerry workbench, this is
* typically an SWT event. This value may be <code>null</code>.
*/
const Object::ConstPointer trigger;
public:
/**
* Constructs a new instance of <code>ExecutionEvent</code> with no
* parameters, no trigger and no application context. This is just a
* convenience method.
*/
ExecutionEvent();
/**
* Constructs a new instance of <code>ExecutionEvent</code>.
*
* @param command
* The command being executed; may be <code>null</code>.
* @param parameters
* The parameters to qualify the execution; must not be
* <code>null</code>. This must be a map of parameter ids (<code>String</code>)
* to parameter values (<code>String</code>).
* @param trigger
* The object that triggered the execution; may be
* <code>null</code>.
* @param applicationContext
* The state of the application at the time the execution was
* triggered; may be <code>null</code>.
*/
ExecutionEvent(const Command::ConstPointer& command, const ParameterMap& parameters,
const Object::ConstPointer& trigger, const Object::Pointer& applicationContext);
/**
* Returns the state of the application at the time the execution was
* triggered.
*
* @return The application context; may be <code>null</code>.
*/
const Object::Pointer GetApplicationContext() const;
/**
* Returns the command being executed.
*
* @return The command being executed.
*/
const Command::ConstPointer GetCommand() const;
/**
* Returns the object represented by the string value of the parameter with
* the provided id.
* <p>
* This is intended to be used in the scope of an
- * {@link IHandler#execute(ExecutionEvent)} method, so any problem getting
+ * {@link IHandler#Execute} method, so any problem getting
* the object value causes <code>ExecutionException</code> to be thrown.
* </p>
*
* @param parameterId
* The id of a parameter to retrieve the object value of.
* @return The object value of the parameter with the provided id.
* @throws ExecutionException
* if the parameter object value could not be obtained for any
* reason
*/
const Object::ConstPointer GetObjectParameterForExecution(const QString& parameterId) const;
/**
* Returns the value of the parameter with the given id.
*
* @param parameterId
* The id of the parameter to retrieve; may be <code>null</code>.
* @return The parameter value; <code>null</code> if the parameter cannot
* be found.
*/
QString GetParameter(const QString &parameterId) const;
/**
* Returns all of the parameters.
*
* @return The parameters; never <code>null</code>, but may be empty.
*/
const ParameterMap& GetParameters() const;
/**
* Returns the object that triggered the execution
*
* @return The trigger; <code>null</code> if there was no trigger.
*/
const Object::ConstPointer GetTrigger() const;
/**
* The string representation of this execution event -- for debugging
* purposes only. This string should not be shown to an end user.
*/
QString ToString() const override;
};
}
#endif /*BERRYEXECUTIONEVENT_H_*/
diff --git a/Plugins/org.blueberry.core.commands/src/berryINamedHandleStateIds.h b/Plugins/org.blueberry.core.commands/src/berryINamedHandleStateIds.h
index 34730d9443..c7ab29a8e2 100755
--- a/Plugins/org.blueberry.core.commands/src/berryINamedHandleStateIds.h
+++ b/Plugins/org.blueberry.core.commands/src/berryINamedHandleStateIds.h
@@ -1,48 +1,48 @@
/*============================================================================
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 BERRYINAMEDHANDLESTATEIDS_H_
#define BERRYINAMEDHANDLESTATEIDS_H_
#include <QString>
namespace berry {
/**
* <p>
* State identifiers that are understood by named handle objects that implement
* {@link IObjectWithState}.
* </p>
* <p>
* Clients may implement or extend this class.
* </p>
*
*/
struct INamedHandleStateIds {
/**
* The state id used for overriding the description of a named handle
- * object. This state's value must return a {@link String}.
+ * object. This state's value must return a \c String .
*/
static const QString DESCRIPTION; // = "DESCRIPTION";
/**
* The state id used for overriding the name of a named handle object. This
- * state's value must return a {@link String}.
+ * state's value must return a \c String .
*/
static const QString NAME; // = "NAME";
};
}
#endif /* BERRYINAMEDHANDLESTATEIDS_H_ */
diff --git a/Plugins/org.blueberry.core.commands/src/berryIParameterValueConverter.h b/Plugins/org.blueberry.core.commands/src/berryIParameterValueConverter.h
index d69f77d166..487a0f66ee 100755
--- a/Plugins/org.blueberry.core.commands/src/berryIParameterValueConverter.h
+++ b/Plugins/org.blueberry.core.commands/src/berryIParameterValueConverter.h
@@ -1,104 +1,89 @@
/*============================================================================
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 BERRYABSTRACTPARAMETERVALUECONVERTER_H_
#define BERRYABSTRACTPARAMETERVALUECONVERTER_H_
#include <berryObject.h>
#include <berryMacros.h>
#include <org_blueberry_core_commands_Export.h>
namespace berry {
/**
* <p>
* Supports conversion between objects and strings for command parameter values.
* Extenders must produce strings that identify objects (of a specific command
* parameter type) as well as consume the strings to locate and return the
* objects they identify.
* </p>
* <p>
* This class offers multiple handlers of a command a consistent way of
* converting string parameter values into the objects that the handlers would
* prefer to deal with. This class also gives clients a way to serialize
* object parameters as strings so that entire parameterized commands can be
* serialized, stored and later deserialized and executed.
* </p>
* <p>
* This class will typically be extended so the subclass can be referenced from
* the <code>converter</code> attribute of the
* <code>commandParameterType</code> elemement of the
* <code>org.blueberry.ui.commands</code> extension-point. Objects implementing
* this interface may also be passed directly to
- * {@link ParameterType#Define(IParameterValueConverter::Pointer)} by
- * clients.
+ * {@link ParameterType#Define} by clients.
* </p>
*
* @see ParameterType#Define(IParameterValueConverter::Pointer)
* @see ParameterizedCommand#Serialize()
*/
struct BERRY_COMMANDS IParameterValueConverter {
virtual ~IParameterValueConverter();
- /**
- * Returns whether the provided value is compatible with this parameter
- * value converter. An object is compatible with a converter if the object is an
- * instance of the class defined in the <code>type</code> attribute of
- * the <code>commandParameterType</code> element.
- *
- * @param value
- * an object to check for compatibility with this parameter type;
- * may be <code>null</code>.
- * @return <code>true</code> if the value is compatible with this converter,
- * <code>false</code> otherwise
- */
- //virtual bool IsCompatible(const Object::ConstPointer value) const = 0;
-
/**
* Converts a string encoded command parameter value into the parameter
* value object.
*
* @param parameterValue
* a command parameter value string describing an object; may be
* <code>null</code>
* @return the object described by the command parameter value string; may
* be <code>null</code>
* @throws ParameterValueConversionException
* if an object cannot be produced from the
* <code>parameterValue</code> string
*/
virtual Object::Pointer ConvertToObject(const QString& parameterValue) = 0;
/**
* Converts a command parameter value object into a string that encodes a
* reference to the object or serialization of the object.
*
* @param parameterValue
* an object to convert into an identifying string; may be
* <code>null</code>
* @return a string describing the provided object; may be <code>null</code>
* @throws ParameterValueConversionException
* if a string reference or serialization cannot be provided for
* the <code>parameterValue</code>
*/
virtual QString ConvertToString(const Object::Pointer& parameterValue) = 0;
};
}
Q_DECLARE_INTERFACE(berry::IParameterValueConverter, "org.blueberry.core.commands.IParameterValueConverter")
#endif /* BERRYABSTRACTPARAMETERVALUECONVERTER_H_ */
diff --git a/Plugins/org.blueberry.core.commands/src/berryNamedHandleObjectWithState.h b/Plugins/org.blueberry.core.commands/src/berryNamedHandleObjectWithState.h
index 431a5428bb..2fa0297267 100644
--- a/Plugins/org.blueberry.core.commands/src/berryNamedHandleObjectWithState.h
+++ b/Plugins/org.blueberry.core.commands/src/berryNamedHandleObjectWithState.h
@@ -1,72 +1,72 @@
/*============================================================================
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 BERRYNAMEDHANDLEOBJECTWITHSTATE_H_
#define BERRYNAMEDHANDLEOBJECTWITHSTATE_H_
#include "common/berryNamedHandleObject.h"
#include "berryIObjectWithState.h"
#include <QHash>
namespace berry {
/**
* <p>
* A named handle object that can carry state with it. This state can be used to
* override the name or description.
* </p>
* <p>
* Clients may neither instantiate nor extend this class.
* </p>
*/
class BERRY_COMMANDS NamedHandleObjectWithState : public NamedHandleObject, public IObjectWithState {
public:
berryObjectMacro(berry::NamedHandleObjectWithState);
void AddState(const QString& stateId, const SmartPointer<State>& state) override;
QString GetDescription() const override;
QString GetName() const override;
SmartPointer<State> GetState(const QString& stateId) const override;
QList<QString> GetStateIds() const override;
void RemoveState(const QString& id) override;
private:
/**
* The map of states currently held by this command. If this command has no
* state, then this will be empty.
*/
QHash<QString, SmartPointer<State> > states;
protected:
/**
- * Constructs a new instance of <code>NamedHandleObject<WithState/code>.
+ * Constructs a new instance of <code>NamedHandleObjectWithState</code>.
*
* @param id
* The identifier for this handle; must not be empty.
*/
NamedHandleObjectWithState(const QString& id);
};
}
#endif /*BERRYNAMEDHANDLEOBJECTWITHSTATE_H_*/
diff --git a/Plugins/org.blueberry.core.commands/src/berryParameterType.h b/Plugins/org.blueberry.core.commands/src/berryParameterType.h
index 8bf61603e8..c99c67c6f9 100755
--- a/Plugins/org.blueberry.core.commands/src/berryParameterType.h
+++ b/Plugins/org.blueberry.core.commands/src/berryParameterType.h
@@ -1,203 +1,203 @@
/*============================================================================
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 BERRYPARAMETERTYPE_H_
#define BERRYPARAMETERTYPE_H_
#include "common/berryHandleObject.h"
#include "berryIParameterTypeListener.h"
#include "berryIParameterValueConverter.h"
#include <QSharedPointer>
namespace berry
{
struct IParameterValueConverter;
/**
* <p>
* Provides information about the type of a command parameter. Clients can use a
* parameter type to check if an object matches the type of the parameter with
- * {@link #IsCompatible(Object::Pointer)} and can get an
+ * \c IsCompatible(Object::Pointer) and can get an
* {@link IParameterValueConverter} to convert between objects matching
* the parameter type and strings that encode the object's identity.
* </p>
* <p>
* A command parameter is not required to declare a type. To determine if a
* given parameter has a type, check if an {@link IParameter} implements
* {@link ITypedParameter} and if so, use
* {@link ITypedParameter#GetParameterType()} like this:
* </p>
*
* <pre>
* IParameter::Pointer parameter = // ... get IParameter from Command
* if (ITypedParameter::Pointer typedParameter = parameter.Cast<ITypedParameter>())
* {
* ParameterType::Pointer type = typedParameter->GetParameterType();
* if (type) {
* // this parameter has a ParameterType
* }
* }
* </pre>
*
* @see IParameter
* @see ITypedParameter#GetParameterType()
*/
class BERRY_COMMANDS ParameterType: public HandleObject
{ //implements Comparable {
public:
berryObjectMacro(ParameterType);
/**
* Adds a listener to this parameter type that will be notified when its
* state changes.
*
* @param listener
* The listener to be added; must not be <code>null</code>.
*/
void AddListener(IParameterTypeListener* listener);
/**
* Compares this parameter type with another object by comparing each of the
* non-transient attributes.
*
* @param object
* The object with which to compare; must be an instance of
* {@link ParameterType}.
* @return A negative integer, zero or a positive integer, if the object is
* greater than, equal to or less than this parameter type.
*/
bool operator<(const Object* object) const override;
/**
* <p>
* Defines this parameter type, setting the defined property to
* <code>true</code>.
* </p>
* <p>
* Notification is sent to all listeners that something has changed.
* </p>
*
* @param type
* a string identifying the object type for this parameter
* type; <code>null</code> is interpreted as
* <code>"QObject"</code>
* @param parameterTypeConverter
- * an {@link AbstractParameterValueConverter} to perform
+ * an \c AbstractParameterValueConverter to perform
* string/object conversions for parameter values; may be
* <code>null</code>
*/
void Define(const QString& type,
const QSharedPointer<IParameterValueConverter>& parameterTypeConverter);
/**
* Returns the value converter associated with this parameter, if any.
*
* @return The parameter value converter, or <code>null</code> if there is
* no value converter for this parameter.
* @throws NotDefinedException
* if the parameter type is not currently defined
*/
IParameterValueConverter* GetValueConverter() const;
/**
* Returns whether the provided value is compatible with this parameter
* type. An object is compatible with a parameter type if the object is an
* instance of the class defined as the parameter's type class.
*
* @param value
* an object to check for compatibility with this parameter type;
* may be <code>null</code>.
* @return <code>true</code> if the value is compatible with this type,
* <code>false</code> otherwise
* @throws NotDefinedException
* if the parameter type is not currently defined
*/
bool IsCompatible(const QObject* const value) const;
/**
* Unregisters listener for changes to properties of this parameter type.
*
* @param listener
* the instance to unregister. Must not be <code>null</code>.
* If an attempt is made to unregister an instance which is not
* already registered with this instance, no operation is
* performed.
*/
void RemoveListener(IParameterTypeListener* listener);
/**
* The string representation of this parameter type. For debugging purposes
* only. This string should not be shown to an end user.
*
* @return The string representation; never <code>null</code>.
*/
QString ToString() const override;
/**
* Makes this parameter type become undefined. Notification is sent to all
* listeners.
*/
void Undefine() override;
protected:
friend class CommandManager;
/**
* Constructs a new instance based on the given identifier. When a parameter
* type is first constructed, it is undefined. Parameter types should only
* be constructed by the {@link CommandManager} to ensure that the
* identifier remains unique.
*
* @param id
* The identifier for this type. This value must not be
* <code>null</code>, and must be unique amongst all parameter
* types.
*/
ParameterType(const QString& id);
private:
/**
* Notifies all listeners that this parameter type has changed. This sends
* the given event to all of the listeners, if any.
*
* @param event
* The event to send to the listeners; must not be
* <code>null</code>.
*/
void FireParameterTypeChanged(const SmartPointer<ParameterTypeEvent> event);
/**
* An {@link AbstractParameterValueConverter} for converting parameter
* values between objects and strings. This may be <code>null</code>.
*/
QSharedPointer<IParameterValueConverter> parameterTypeConverter;
/**
* A string specifying the object type of this parameter type. This will be
* <code>null</code> when the parameter type is undefined but never null
* when it is defined.
*/
QString type;
IParameterTypeListener::Events parameterTypeEvents;
};
}
#endif /* BERRYPARAMETERTYPE_H_ */
diff --git a/Plugins/org.blueberry.core.commands/src/berryParameterizedCommand.h b/Plugins/org.blueberry.core.commands/src/berryParameterizedCommand.h
index cface1be45..1b4bc39516 100755
--- a/Plugins/org.blueberry.core.commands/src/berryParameterizedCommand.h
+++ b/Plugins/org.blueberry.core.commands/src/berryParameterizedCommand.h
@@ -1,334 +1,334 @@
/*============================================================================
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 BERRYPARAMETERIZEDCOMMAND_H_
#define BERRYPARAMETERIZEDCOMMAND_H_
#include <berryObject.h>
#include <berryMacros.h>
#include "common/berryCommandExceptions.h"
#include <org_blueberry_core_commands_Export.h>
#include <list>
#include <map>
namespace berry
{
struct IParameter;
class Command;
class Parameterization;
/**
* <p>
* A command that has had one or more of its parameters specified. This class
* serves as a utility class for developers that need to manipulate commands
* with parameters. It handles the behaviour of generating a parameter map and a
* human-readable name.
* </p>
*/
class BERRY_COMMANDS ParameterizedCommand: public Object
{ //implements Comparable {
public:
berryObjectMacro(ParameterizedCommand);
/**
* The index of the parameter id in the parameter values.
*
* @deprecated no longer used
*/
static const int INDEX_PARAMETER_ID; // = 0;
/**
* The index of the human-readable name of the parameter itself, in the
* parameter values.
*
* @deprecated no longer used
*/
static const int INDEX_PARAMETER_NAME; // = 1;
/**
* The index of the human-readable name of the value of the parameter for
* this command.
*
* @deprecated no longer used
*/
static const int INDEX_PARAMETER_VALUE_NAME; // = 2;
/**
* The index of the value of the parameter that the command can understand.
*
* @deprecated no longer used
*/
static const int INDEX_PARAMETER_VALUE_VALUE; // = 3;
/**
* Constructs a new instance of <code>ParameterizedCommand</code> with
* specific values for zero or more of its parameters.
*
* @param command
* The command that is parameterized; must not be
* <code>null</code>.
* @param parameterizations
* An array of parameterizations binding parameters to values for
* the command. This value may be <code>null</code>.
*/
ParameterizedCommand(const SmartPointer<Command>& command,
const QList<Parameterization>& parameterizations);
bool operator<(const Object* object) const override;
bool operator==(const Object* object) const override;
/**
* Executes this command with its parameters. This does extra checking to
* see if the command is enabled and defined. If it is not both enabled and
* defined, then the execution listeners will be notified and an exception
* thrown.
*
* @param trigger
* The object that triggered the execution; may be
* <code>null</code>.
* @param applicationContext
* The state of the application at the time the execution was
* triggered; may be <code>null</code>.
* @return The result of the execution; may be <code>null</code>.
* @throws ExecutionException
* If the handler has problems executing this command.
* @throws NotDefinedException
* If the command you are trying to execute is not defined.
* @throws NotEnabledException
* If the command you are trying to execute is not enabled.
* @throws NotHandledException
* If there is no handler.
*/
Object::Pointer ExecuteWithChecks(const Object::ConstPointer& trigger,
const Object::Pointer& applicationContext);
/**
* Returns the base command. It is possible for more than one parameterized
* command to have the same identifier.
*
* @return The command; never <code>null</code>, but may be undefined.
*/
SmartPointer<Command> GetCommand() const;
/**
* Returns the command's base identifier. It is possible for more than one
* parameterized command to have the same identifier.
*
* @return The command id; never <code>null</code>.
*/
QString GetId() const;
/**
* Returns a human-readable representation of this command with all of its
* parameterizations.
*
* @return The human-readable representation of this parameterized command;
* never <code>null</code>.
* @throws NotDefinedException
* If the underlying command is not defined.
*/
QString GetName() const;
/**
* Returns the parameter map, as can be used to construct an
* <code>ExecutionEvent</code>.
*
* @return The map of parameter ids (<code>String</code>) to parameter
* values (<code>String</code>). This map is never
* <code>null</code>, but may be empty.
*/
QHash<QString, QString> GetParameterMap() const;
uint HashCode() const override;
/**
- * Returns a {@link String} containing the command id, parameter ids and
- * parameter values for this {@link ParameterizedCommand}. The returned
- * {@link String} can be stored by a client and later used to reconstruct an
+ * Returns a \c String containing the command id, parameter ids and
+ * parameter values for this \c ParameterizedCommand . The returned
+ * \c String can be stored by a client and later used to reconstruct an
* equivalent {@link ParameterizedCommand} using the
- * {@link CommandManager#deserialize(String)} method.
+ * \c CommandManager.deserialize(String) method.
* <p>
- * The syntax of the returned {@link String} is as follows:
+ * The syntax of the returned \c String is as follows:
* </p>
*
* <blockquote>
* <code>serialization = <u>commandId</u> [ '(' parameters ')' ]</code><br>
* <code>parameters = parameter [ ',' parameters ]</code><br>
* <code>parameter = <u>parameterId</u> [ '=' <u>parameterValue</u> ]</code>
* </blockquote>
*
* <p>
* In the syntax above, sections inside square-brackets are optional. The
* characters in single quotes (<code>(</code>, <code>)</code>,
* <code>,</code> and <code>=</code>) indicate literal characters.
* </p>
* <p>
* <code><u>commandId</u></code> represents the command id encoded with
* separator characters escaped. <code><u>parameterId</u></code> and
* <code><u>parameterValue</u></code> represent the parameter ids and
* values encoded with separator characters escaped. The separator
* characters <code>(</code>, <code>)</code>, <code>,</code> and
* <code>=</code> are escaped by prepending a <code>%</code>. This
* requires <code>%</code> to be escaped, which is also done by prepending
* a <code>%</code>.
* </p>
* <p>
* The order of the parameters is not defined (and not important). A missing
* <code><u>parameterValue</u></code> indicates that the value of the
* parameter is <code>null</code>.
* </p>
* <p>
* For example, the string shown below represents a serialized parameterized
* command that can be used to show the Resource perspective:
* </p>
* <p>
* <code>org.eclipse.ui.perspectives.showPerspective(org.eclipse.ui.perspectives.showPerspective.perspectiveId=org.eclipse.ui.resourcePerspective)</code>
* </p>
* <p>
* This example shows the more general form with multiple parameters,
* <code>null</code> value parameters, and escaped <code>=</code> in the
* third parameter value.
* </p>
* <p>
* <code>command.id(param1.id=value1,param2.id,param3.id=esc%=val3)</code>
* </p>
*
* @return A string containing the escaped command id, parameter ids and
* parameter values; never <code>null</code>.
* @see CommandManager#deserialize(String)
*/
QString Serialize();
QString ToString() const override;
/**
* <p>
* Generates all the possible combinations of command parameterizations for
* the given command. If the command has no parameters, then this is simply
* a parameterized version of that command. If a parameter is optional, both
* the included and not included cases are considered.
* </p>
* <p>
* If one of the parameters cannot be loaded due to a
* <code>ParameterValuesException</code>, then it is simply ignored.
* </p>
*
* @param command
* The command for which the parameter combinations should be
* generated; must not be <code>null</code>.
* @return A collection of <code>ParameterizedCommand</code> instances
* representing all of the possible combinations. This value is
* never empty and it is never <code>null</code>.
* @throws NotDefinedException
* If the command is not defined.
*/
static QList<ParameterizedCommand::Pointer>
GenerateCombinations(const SmartPointer<Command> command);
/**
* Take a command and a map of parameter IDs to values, and generate the
* appropriate parameterized command.
*
* @param command
* The command object. Must not be <code>null</code>.
* @param parameters
* A map of String parameter ids to objects. May be
* <code>null</code>.
* @return the parameterized command, or <code>null</code> if it could not
* be generated
*/
static ParameterizedCommand::Pointer GenerateCommand(const SmartPointer<Command> command,
const QHash<QString, Object::Pointer>& parameters);
private:
/**
* The constant integer hash code value meaning the hash code has not yet
* been computed.
*/
static const uint HASH_CODE_NOT_COMPUTED; // = 0;
/**
* A factor for computing the hash code for all parameterized commands.
*/
static const uint HASH_FACTOR; // = 89;
/**
* The seed for the hash code for all parameterized commands.
*/
static const uint HASH_INITIAL;
/**
* Escapes special characters in the command id, parameter ids and parameter
* values for {@link #serialize()}. The special characters
* {@link CommandManager#PARAMETER_START_CHAR},
* {@link CommandManager#PARAMETER_END_CHAR},
* {@link CommandManager#ID_VALUE_CHAR},
* {@link CommandManager#PARAMETER_SEPARATOR_CHAR} and
* {@link CommandManager#ESCAPE_CHAR} are escaped by prepending a
* {@link CommandManager#ESCAPE_CHAR} character.
*
* @param rawText
* a <code>String</code> to escape special characters in for
* serialization.
* @return a <code>String</code> representing <code>rawText</code> with
* special serialization characters escaped
*/
static QString Escape(const QString& rawText);
/**
* Generates every possible combination of parameter values for the given
* parameters. Parameters values that cannot be initialized are just
* ignored. Optional parameters are considered.
*
* @param startIndex
* The index in the <code>parameters</code> that we should
* process. This must be a valid index.
* @param parameters
* The parameters in to process; must not be <code>null</code>.
* @return A collection (<code>Collection</code>) of combinations (<code>List</code>
* of <code>Parameterization</code>).
*/
static QList<QList<Parameterization> > ExpandParameters(unsigned int startIndex,
const QList<SmartPointer<IParameter> >& parameters);
/**
* The base command which is being parameterized. This value is never
* <code>null</code>.
*/
const SmartPointer<Command> command;
/**
* The hash code for this object. This value is computed lazily, and marked
* as invalid when one of the values on which it is based changes.
*/
mutable uint hashCode;
/**
* This is an array of parameterization defined for this command. This value
* may be <code>null</code> if the command has no parameters.
*/
QList<Parameterization> parameterizations;
mutable QString name;
};
}
#endif /* BERRYPARAMETERIZEDCOMMAND_H_ */
diff --git a/Plugins/org.blueberry.core.expressions/schema/definitions.exsd b/Plugins/org.blueberry.core.expressions/schema/definitions.exsd
old mode 100755
new mode 100644
index ad07cdb214..8fab9b8e4d
--- a/Plugins/org.blueberry.core.expressions/schema/definitions.exsd
+++ b/Plugins/org.blueberry.core.expressions/schema/definitions.exsd
@@ -1,166 +1,101 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.core.expressions">
<annotation>
<appInfo>
<meta.schema plugin="org.blueberry.core.expressions" id="definitions" name="Expression Definitions"/>
</appInfo>
- <documentation>
- &lt;p&gt;
-This extension point allows you to create reusable extensions. They can then be used in other core expression constructs.
-&lt;/p&gt;
-&lt;p&gt;
-The reference element in a core expression will evaluated the expression definition with the evaluation context that is active for the reference element.
-&lt;/p&gt;
-
- </documentation>
+
</annotation>
<include schemaLocation="expressionLanguage.exsd"/>
<element name="extension">
<complexType>
<sequence>
<element ref="definition" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
+
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="definition">
<annotation>
- <documentation>
- Provides a global definition of an expression to be used with the &amp;lt;reference/&amp;gt; expression element. This helps to reuse common expressions.
- </documentation>
+
</annotation>
<complexType>
<choice>
<element ref="not"/>
<element ref="and"/>
<element ref="or"/>
<element ref="instanceof"/>
<element ref="test"/>
<element ref="systemTest"/>
<element ref="equals"/>
<element ref="count"/>
<element ref="with"/>
<element ref="resolve"/>
<element ref="adapt"/>
<element ref="iterate"/>
</choice>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- A globally unique identifier for the expression definition.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
- <documentation>
- You can define and the use core expressions:
-
-&lt;p&gt;
-&lt;pre&gt;
-&amp;lt;extension point=&quot;org.blueberry.core.expressions.definitions&quot;&amp;gt;
- &amp;lt;definition id=&quot;com.example.parts.activeProblemsView&quot;&amp;gt;
- &amp;lt;with variable=&quot;activePartId&quot;&amp;gt;
- &amp;lt;equals value=&quot;org.blueberry.ui.views.ProblemsView&quot;/&amp;gt;
- &amp;lt;/with&amp;gt;
- &amp;lt;/definition&amp;gt;
- &amp;lt;definition id=&quot;com.example.markers.markerSelection&quot;&amp;gt;
- &amp;lt;iterate&amp;gt;
- &amp;lt;instanceof value=&quot;org.blueberry.core.resources.IMarker&quot;/&amp;gt;
- &amp;lt;/with&amp;gt;
- &amp;lt;/definition&amp;gt;
-&amp;lt;/extension&amp;gt;
-&lt;/pre&gt;
-&lt;/p&gt;
-&lt;p&gt;
-Then this expression definition can be used when composing other expressions.
-&lt;/p&gt;
-&lt;p&gt;
-&lt;pre&gt;
-&amp;lt;enabledWhen&amp;gt;
- &amp;lt;reference definitionId=&quot;com.example.parts.activeProblemsView&quot;&amp;gt;
-&amp;lt;/enabledWhen&amp;gt;
-&lt;/pre&gt;
-&lt;pre&gt;
-&amp;lt;visibleWhen&amp;gt;
- &amp;lt;and&amp;gt;
- &amp;lt;reference definitionId=&quot;com.example.parts.activeProblemsView&quot;/&amp;gt;
- &amp;lt;reference definitionId=&quot;com.example.markers.markerSelection&quot;/&amp;gt;
- &amp;lt;/and&amp;gt;
-&amp;lt;/visibleWhen&amp;gt;
-&lt;/pre&gt;
-&lt;/p&gt;
-
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
- <documentation>
- 3.3
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
- <documentation>
-
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
- <documentation>
-
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
- <documentation>
- Copyright (c) 2007 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.core.expressions/schema/expressionLanguage.exsd b/Plugins/org.blueberry.core.expressions/schema/expressionLanguage.exsd
old mode 100755
new mode 100644
index 400743a1d2..8aced99155
--- a/Plugins/org.blueberry.core.expressions/schema/expressionLanguage.exsd
+++ b/Plugins/org.blueberry.core.expressions/schema/expressionLanguage.exsd
@@ -1,535 +1,396 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.core.expressions">
<annotation>
<appInfo>
<meta.schema plugin="org.blueberry.core.expressions" id="commonExpression" name="Common Expressions"/>
</appInfo>
- <documentation>
-
- </documentation>
+
</annotation>
<element name="enablement">
<annotation>
- <documentation>
- A generic root element. The element can be used inside an extension point to define its enablement expression.
- The children of an enablement expression are combined using the and operator.
- </documentation>
+
</annotation>
<complexType>
<sequence minOccurs="0" maxOccurs="unbounded">
<element ref="not"/>
<element ref="and"/>
<element ref="or"/>
<element ref="instanceof"/>
<element ref="test"/>
<element ref="systemTest"/>
<element ref="equals"/>
<element ref="count"/>
<element ref="with"/>
<element ref="resolve"/>
<element ref="adapt"/>
<element ref="iterate"/>
<element ref="reference"/>
</sequence>
</complexType>
</element>
<element name="not">
<annotation>
- <documentation>
- This element represent a NOT operation on the result of evaluating it&apos;s sub-element expression.
- </documentation>
+
</annotation>
<complexType>
<choice>
<element ref="not"/>
<element ref="and"/>
<element ref="or"/>
<element ref="instanceof"/>
<element ref="test"/>
<element ref="systemTest"/>
<element ref="equals"/>
<element ref="count"/>
<element ref="with"/>
<element ref="resolve"/>
<element ref="adapt"/>
<element ref="iterate"/>
<element ref="reference"/>
</choice>
</complexType>
</element>
<element name="and">
<annotation>
- <documentation>
- This element represent an AND operation on the result of evaluating all it&apos;s sub-elements expressions.
- </documentation>
+
</annotation>
<complexType>
<sequence minOccurs="0" maxOccurs="unbounded">
<element ref="not"/>
<element ref="and"/>
<element ref="or"/>
<element ref="instanceof"/>
<element ref="test"/>
<element ref="systemTest"/>
<element ref="equals"/>
<element ref="count"/>
<element ref="with"/>
<element ref="resolve"/>
<element ref="adapt"/>
<element ref="iterate"/>
<element ref="reference"/>
</sequence>
</complexType>
</element>
<element name="or">
<annotation>
- <documentation>
- This element represent an OR operation on the result of evaluating all it&apos;s sub-element expressions.
- </documentation>
+
</annotation>
<complexType>
<sequence minOccurs="0" maxOccurs="unbounded">
<element ref="not"/>
<element ref="and"/>
<element ref="or"/>
<element ref="instanceof"/>
<element ref="test"/>
<element ref="systemTest"/>
<element ref="equals"/>
<element ref="count"/>
<element ref="with"/>
<element ref="resolve"/>
<element ref="adapt"/>
<element ref="iterate"/>
<element ref="reference"/>
</sequence>
</complexType>
</element>
<element name="instanceof">
<annotation>
<appInfo>
<meta.element labelAttribute="value"/>
</appInfo>
- <documentation>
- This element is used to perform an instanceof check of the object in focus. The expression returns
- EvaluationResult.TRUE if the object&apos;s type is a sub type of the type specified by the attribute value.
- Otherwise EvaluationResult.FALSE is returned.
- </documentation>
+
</annotation>
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified name of a class or interface.
- </documentation>
+
<appInfo>
<meta.attribute kind="java" basedOn="java.lang.Object"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="test">
<annotation>
<appInfo>
<meta.element labelAttribute="property"/>
</appInfo>
- <documentation>
- This element is used to evaluate the property state of the object in focus. The set of
- testable properties can be extended using the propery tester extension point. The test
- expression returns EvaluationResult.NOT_LOADED if the property tester doing the actual
- testing isn&apos;t loaded yet and the attribute forcePluginActivation is set to false.
- If forcePluginActivation is set to true and the evaluation context used to evaluate
- this expression support plug-in activation then evaluating the property will result in
- activating the plug-in defining the tester.
- </documentation>
+
</annotation>
<complexType>
<attribute name="property" type="string" use="required">
<annotation>
- <documentation>
- the name of an object&apos;s property to test.
- </documentation>
+
</annotation>
</attribute>
<attribute name="args" type="string">
<annotation>
- <documentation>
- additional arguments passed to the property tester. Multiple arguments are seperated
- by commas. Each individual argument is converted into a Java base type using the same
- rules as defined for the value attribute of the test expression.
- </documentation>
+
</annotation>
</attribute>
<attribute name="value" type="string">
<annotation>
- <documentation>
- the expected value of the property. Can be omitted if the property
- is a boolean property. The test expression is supposed to return
-EvaluationResult.TRUE if the property matches the value and EvaluationResult.FALSE
-otherwise. The value attribute is converted into a Java base type using the following
-rules:
-&lt;ul&gt;
- &lt;li&gt;the string &amp;quot;true&amp;quot; is converted into Boolean.TRUE&lt;/li&gt;
- &lt;li&gt;the string &amp;quot;false&amp;quot; is converted into Boolean.FALSE&lt;/li&gt;
- &lt;li&gt;if the string contains a dot then the interpreter tries to convert
- the value into a Float object. If this fails the string is treated as a
- java.lang.String&lt;/li&gt;
- &lt;li&gt;if the string only consists of numbers then the interpreter
- converts the value in an Integer object.&lt;/li&gt;
- &lt;li&gt;in all other cases the string is treated as a java.lang.String&lt;/li&gt;
- &lt;li&gt;the conversion of the string into a Boolean, Float, or Integer can
- be suppressed by surrounding the string with single quotes. For
- example, the attribute value=&amp;quot;&apos;true&apos;&amp;quot; is converted into the
- string &amp;quot;true&amp;quot;&lt;/li&gt;
-&lt;/ul&gt;
- </documentation>
+
</annotation>
</attribute>
<attribute name="forcePluginActivation" type="boolean">
<annotation>
- <documentation>
- a flag indicating whether the plug-in contributing the property tester
- should be loaded if necessary. As such, this flag should be used judiciously,
- in order to avoid unnecessary plug-in activations. Most clients should avoid
- setting this flag to true. This flag is only honored if the evaluation context
- used to evaluate this expression allows plug-in activation. Otherwise the flag
- is ignored and no plug-in loading takes place.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="systemTest">
<annotation>
<appInfo>
<meta.element labelAttribute="value"/>
</appInfo>
- <documentation>
- Tests a system property by calling the System.getProperty method and compares the result
- with the value specified through the value attribute.
- </documentation>
+
</annotation>
<complexType>
<attribute name="property" type="string" use="required">
<annotation>
- <documentation>
- the name of an system property to test.
- </documentation>
+
</annotation>
</attribute>
<attribute name="value" type="string" use="required">
<annotation>
- <documentation>
- the expected value of the property. The value is interpreted as a string value.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="equals">
<annotation>
<appInfo>
<meta.element labelAttribute="value"/>
</appInfo>
- <documentation>
- This element is used to perform an equals check of the object in focus. The expression returns
- EvaluationResult.TRUE if the object is equal to the value provided by the attribute value. Otherwise
- EvaluationResult.FALSE is returned.
- </documentation>
+
</annotation>
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
- <documentation>
- the expected value. The value provided as a string is converted into
- a Java base type using the same rules as for the value attribute of the test expression.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="count">
<annotation>
- <documentation>
- This element is used to test the number of elements in a collection.
- </documentation>
+
</annotation>
<complexType>
<attribute name="value" type="string" use="required">
<annotation>
- <documentation>
- an expression to specify the number of elements in a list. Following wildcard
- characters can be used:
- &lt;dl&gt;
- &lt;dt&gt;*&lt;/dt&gt; &lt;dd&gt;any number of elements&lt;/dd&gt;
- &lt;dt&gt;?&lt;/dt&gt; &lt;dd&gt;no elements or one element&lt;/dd&gt;
- &lt;dt&gt;+&lt;/dt&gt; &lt;dd&gt;one or more elements&lt;/dd&gt;
- &lt;dt&gt;!&lt;/dt&gt; &lt;dd&gt;no elements&lt;/dd&gt;
- &lt;dt&gt;integer value&lt;/dt&gt; &lt;dd&gt;the list must contain the exact number of elements&lt;/dd&gt;
- &lt;/dl&gt;
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="with">
<annotation>
<appInfo>
<meta.element labelAttribute="variable"/>
</appInfo>
- <documentation>
- This element changes the object to be inspected for all its child element to the object
- referenced by the given variable. If the variable can not be resolved then the expression
- will throw a ExpressionException when evaluating it. The children of a with expression
- are combined using the and operator.
- </documentation>
+
</annotation>
<complexType>
<sequence minOccurs="0" maxOccurs="unbounded">
<element ref="not"/>
<element ref="and"/>
<element ref="or"/>
<element ref="instanceof"/>
<element ref="test"/>
<element ref="systemTest"/>
<element ref="equals"/>
<element ref="count"/>
<element ref="with"/>
<element ref="resolve"/>
<element ref="adapt"/>
<element ref="iterate"/>
<element ref="reference"/>
</sequence>
<attribute name="variable" type="string" use="required">
<annotation>
- <documentation>
- the name of the variable to be used for further inspection. It is up to the evaluator
- of an extension point to provide the variable in the variable pool.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="resolve">
<annotation>
<appInfo>
<meta.element labelAttribute="variable"/>
</appInfo>
- <documentation>
- This element changes the object to be inspected for all its child element to the object
- referenced by the given variable. If the variable can not be resolved then the expression
- will throw a ExpressionException when evaluating it. The children of a with expression
- are combined using the and operator.
- </documentation>
+
</annotation>
<complexType>
<sequence minOccurs="0" maxOccurs="unbounded">
<element ref="not"/>
<element ref="and"/>
<element ref="or"/>
<element ref="instanceof"/>
<element ref="test"/>
<element ref="systemTest"/>
<element ref="equals"/>
<element ref="count"/>
<element ref="with"/>
<element ref="resolve"/>
<element ref="adapt"/>
<element ref="iterate"/>
<element ref="reference"/>
</sequence>
<attribute name="variable" type="string" use="required">
<annotation>
- <documentation>
- the name of the variable to be resolved. This variable is then used as the object in focus
- for child element evaluation. It is up to the evaluator of an extension point to provide a
- corresponding variable resolver (see IVariableResolver) through the evaluation context passed
- to the root expression element when evaluating the expression.
- </documentation>
+
</annotation>
</attribute>
<attribute name="args" type="string">
<annotation>
- <documentation>
- additional arguments passed to the variable resolver. Multiple arguments are seperated
- by commas. Each individual argument is converted into a Java base type using the same
- rules as defined for the value attribute of the test expression.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="adapt">
<annotation>
<appInfo>
<meta.element labelAttribute="type"/>
</appInfo>
- <documentation>
- This element is used to adapt the object in focus to the type specified by the attribute
- type. The expression returns not loaded if either the adapter or the type referenced isn&apos;t
- loaded yet. It throws a ExpressionException during evaluation if the type name doesn&apos;t exist
- at all. The children of an adapt expression are combined using the and operator.
- </documentation>
+
</annotation>
<complexType>
<sequence minOccurs="0" maxOccurs="unbounded">
<element ref="not"/>
<element ref="and"/>
<element ref="or"/>
<element ref="instanceof"/>
<element ref="test"/>
<element ref="systemTest"/>
<element ref="equals"/>
<element ref="count"/>
<element ref="with"/>
<element ref="resolve"/>
<element ref="adapt"/>
<element ref="iterate"/>
<element ref="reference"/>
</sequence>
<attribute name="type" type="string" use="required">
<annotation>
- <documentation>
- the type to which the object in focus is to be adapted.
- </documentation>
+
<appInfo>
<meta.attribute kind="java" basedOn="java.lang.Object"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="iterate">
<annotation>
- <documentation>
- This element is used to iterate over a variable that is of type java.util.Collection. If
- the object in focus is not of type java.util.Collection then an ExpressionException will
- be thrown while evaluating the expression.
- </documentation>
+
</annotation>
<complexType>
<sequence minOccurs="0" maxOccurs="unbounded">
<element ref="not"/>
<element ref="and"/>
<element ref="or"/>
<element ref="instanceof"/>
<element ref="test"/>
<element ref="systemTest"/>
<element ref="equals"/>
<element ref="count"/>
<element ref="with"/>
<element ref="resolve"/>
<element ref="adapt"/>
<element ref="iterate"/>
<element ref="reference"/>
</sequence>
<attribute name="operator">
<annotation>
- <documentation>
- either &quot;and&quot; or &quot;or&quot;. The operator defines how the child
- elements will be combined. If not specified, &quot;and&quot; will be used.
- </documentation>
+
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="or">
</enumeration>
<enumeration value="and">
</enumeration>
</restriction>
</simpleType>
</attribute>
<attribute name="ifEmpty" type="boolean">
<annotation>
- <documentation>
- the value return from the iterate expression if the collection is empty. If
- not specified then true is returned when the operator equals &quot;and&quot;
- and false is return if the operator equals &quot;or&quot;.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="reference">
<annotation>
<appInfo>
<meta.element labelAttribute="definitionId"/>
</appInfo>
- <documentation>
- This element is used to reference an expression from the &lt;b&gt;org.blueberry.core.expressions.definitions&lt;/b&gt; extension point. The expression definition will be evaluated within the current expression element using the current evaluation context.
- </documentation>
+
</annotation>
<complexType>
<attribute name="definitionId" type="string" use="required">
<annotation>
- <documentation>
- The unique id of an expression from &lt;b&gt;org.blueberry.core.expressions.definitions&lt;/b&gt;.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
- <documentation>
- Release 3.0
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
- <documentation>
-
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
- <documentation>
-
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
- <documentation>
-
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
- <documentation>
- Copyright (c) 2001, 2004 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.core.expressions/schema/propertyTesters.exsd b/Plugins/org.blueberry.core.expressions/schema/propertyTesters.exsd
old mode 100755
new mode 100644
index 30f9b60ca4..94e9448d5b
--- a/Plugins/org.blueberry.core.expressions/schema/propertyTesters.exsd
+++ b/Plugins/org.blueberry.core.expressions/schema/propertyTesters.exsd
@@ -1,146 +1,102 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.core.expressions">
<annotation>
<appInfo>
<meta.schema plugin="org.blueberry.core.expressions" id="propertyTesters" name="Property Testers"/>
</appInfo>
- <documentation>
- This extension point allows to add properties to an already existing type. Those
- properties can then be used inside the expression language&apos;s test expression
- element.
- </documentation>
+
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="propertyTester" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
+
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="propertyTester">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- unique identifier for the property tester
- </documentation>
+
</annotation>
</attribute>
<attribute name="type" type="string" use="required">
<annotation>
- <documentation>
- the type to be extended by this property tester
- </documentation>
+
<appInfo>
<meta.attribute kind="java"/>
</appInfo>
</annotation>
</attribute>
<attribute name="namespace" type="string" use="required">
<annotation>
- <documentation>
- a unique id determining the name space the properties are added to
- </documentation>
+
</annotation>
</attribute>
<attribute name="properties" type="string" use="required">
<annotation>
- <documentation>
- a comma separated list of properties provided by this property tester
- </documentation>
+
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- the name of the class that implements the testing methods. The class must be public and extend
-&lt;samp&gt;org.blueberry.core.expressions.PropertyTester&lt;/samp&gt; with a public 0-argument constructor.
- </documentation>
+
<appInfo>
<meta.attribute kind="java" basedOn="org.blueberry.core.expressions.PropertyTester"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
- <documentation>
- 3.0
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
- <documentation>
- The following is an example of a property tester contribution:
-
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.core.expressions.propertyTesters&quot;&gt;
- &lt;propertyTester
- id=&quot;org.eclipse.jdt.ui.IResourceTester&quot;
- type=&quot;org.eclipse.core.resources.IResource&quot;
- namespace=&quot;org.eclipse.jdt.ui&quot;
- properties=&quot;canDelete&quot;
- class=&quot;org.eclipse.jdt.ui.internal.ResourceTester&quot;&gt;
- &lt;/propertyTester&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
- <documentation>
- The contributed class must extend &lt;code&gt;berry::PropertyTester&lt;/code&gt;
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
- <documentation>
- Copyright (c) 2001, 2004 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at &lt;a href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.core.expressions/src/berryEvaluationContext.h b/Plugins/org.blueberry.core.expressions/src/berryEvaluationContext.h
index de5874b8b1..6a37bbfbcd 100644
--- a/Plugins/org.blueberry.core.expressions/src/berryEvaluationContext.h
+++ b/Plugins/org.blueberry.core.expressions/src/berryEvaluationContext.h
@@ -1,121 +1,121 @@
/*============================================================================
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 BERRYEVALUATIONCONTEXT_H_
#define BERRYEVALUATIONCONTEXT_H_
#include "berryIEvaluationContext.h"
#include "berryIVariableResolver.h"
#include <org_blueberry_core_expressions_Export.h>
#include "Poco/Any.h"
#include <vector>
#include <QHash>
namespace berry {
/**
* A default implementation of an evaluation context.
* <p>
* Clients may instantiate this default context. The class is
* not intended to be subclassed by clients.
* </p>
*
* @since 3.0
*/
class BERRY_EXPRESSIONS EvaluationContext : public IEvaluationContext
{
private:
IEvaluationContext* const fParent;
Object::ConstPointer fDefaultVariable;
QHash<QString, Object::ConstPointer> fVariables;
std::vector<IVariableResolver*> fVariableResolvers;
int fAllowPluginActivation;
public:
/**
* Create a new evaluation context with the given parent and default
* variable.
*
* @param parent the parent context. Can be <code>null</code>.
* @param defaultVariable the default variable
*/
EvaluationContext(IEvaluationContext* parent, const Object::ConstPointer& defaultVariable);
/**
* Create a new evaluation context with the given parent and default
* variable.
*
* @param parent the parent context. Can be <code>null</code>.
* @param defaultVariable the default variable
* @param resolvers an array of <code>IVariableResolvers</code> to
* resolve additional variables.
*
- * @see #resolveVariable(String, Object[])
+ * @see #ResolveVariable
*/
EvaluationContext(IEvaluationContext* parent, const Object::ConstPointer& defaultVariable,
const std::vector<IVariableResolver*>& resolvers);
/**
* {@inheritDoc}
*/
IEvaluationContext* GetParent() const override;
/**
* {@inheritDoc}
*/
IEvaluationContext* GetRoot() const override;
/**
* {@inheritDoc}
*/
Object::ConstPointer GetDefaultVariable() const override;
/**
* {@inheritDoc}
*/
void SetAllowPluginActivation(bool value) override;
/**
* {@inheritDoc}
*/
bool GetAllowPluginActivation() const override;
/**
* {@inheritDoc}
*/
void AddVariable(const QString& name, const Object::ConstPointer& value) override;
/**
* {@inheritDoc}
*/
Object::ConstPointer RemoveVariable(const QString& name) override;
/**
* {@inheritDoc}
*/
Object::ConstPointer GetVariable(const QString &name) const override;
/**
* {@inheritDoc}
*/
Object::ConstPointer ResolveVariable(const QString& name, const QList<Object::Pointer>& args) const override;
};
} // namespace berry
#endif /*BERRYEVALUATIONCONTEXT_H_*/
diff --git a/Plugins/org.blueberry.core.expressions/src/berryEvaluationResult.h b/Plugins/org.blueberry.core.expressions/src/berryEvaluationResult.h
index 1ca4427706..ff39bd7fdb 100644
--- a/Plugins/org.blueberry.core.expressions/src/berryEvaluationResult.h
+++ b/Plugins/org.blueberry.core.expressions/src/berryEvaluationResult.h
@@ -1,231 +1,207 @@
/*============================================================================
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 BERRYEVALUATIONRESULT_
#define BERRYEVALUATIONRESULT_
#include <string>
#include <org_blueberry_core_expressions_Export.h>
#include <berryObject.h>
namespace berry {
/**
* An evaluation result represents the result of an expression
* evaluation. There are exact three instances of evaluation
* result. They are: <code>FALSE_EVAL</code>, <code>TRUE_EVAL</code> and
* <code>NOT_LOADED</code>. <code>NOT_LOADED</code> represents
* the fact that an expression couldn't be evaluated since a
* plug-in providing certain test expressions isn't loaded yet.
* <p>
* In addition the class implements the three operation <code>and
* </code>, <code>or</code> and <code>not</code>. The operation are
* defined as follows:
* </p>
* <p>
* The and operation:
* </p>
* <table border="1" cellpadding="5">
- * <colgroup>
- * <col width="120">
- * <col width="120">
- * <col width="120">
- * <col width="120">
- * </colgroup>
- * <tbody>
* <tr>
* <td><em>AND</em></td>
* <td>FALSE_EVAL</td>
* <td>TRUE_EVAL</td>
* <td>NOT_LOADED</td>
* </tr>
* <tr>
* <td>FALSE_EVAL</td>
* <td>FALSE_EVAL</td>
* <td>FALSE_EVAL</td>
* <td>FALSE_EVAL</td>
* </tr>
* <tr>
* <td>TRUE_EVAL</td>
* <td>FALSE_EVAL</td>
* <td>TRUE_EVAL</td>
* <td>NOT_LOADED</td>
* </tr>
* <tr>
* <td>NOT_LOADED</td>
* <td>FALSE_EVAL</td>
* <td>NOT_LOADED</td>
* <td>NOT_LOADED</td>
* </tr>
- * </tbody>
* </table>
* <p>
* The or operation:
* </p>
* <table border="1" cellpadding="5">
- * <colgroup>
- * <col width="120">
- * <col width="120">
- * <col width="120">
- * <col width="120">
- * </colgroup>
- * <tbody>
* <tr>
* <td><em>OR</em></td>
* <td>FALSE_EVAL</td>
* <td>TRUE_EVAL</td>
* <td>NOT_LOADED</td>
* </tr>
* <tr>
* <td>FALSE_EVAL</td>
* <td>FALSE_EVAL</td>
* <td>TRUE_EVAL</td>
* <td>NOT_LOADED</td>
* </tr>
* <tr>
* <td>TRUE_EVAL</td>
* <td>TRUE_EVAL</td>
* <td>TRUE_EVAL</td>
* <td>TRUE_EVAL</td>
* </tr>
* <tr>
* <td>NOT_LOADED</td>
* <td>NOT_LOADED</td>
* <td>TRUE_EVAL</td>
* <td>NOT_LOADED</td>
* </tr>
- * </tbody>
* </table>
* <p>
* The not operation:
* </p>
* <table border="1" cellpadding="5">
- * <colgroup>
- * <col width="120">
- * <col width="120">
- * <col width="120">
- * <col width="120">
- * </colgroup>
- * <tbody>
* <tr>
- * <td><em>NOT<em></td>
+ * <td><em>NOT</em></td>
* <td>FALSE_EVAL</td>
* <td>TRUE_EVAL</td>
* <td>NOT_LOADED</td>
* </tr>
* <tr>
* <td></td>
* <td>TRUE_EVAL</td>
* <td>FALSE_EVAL</td>
* <td>NOT_LOADED</td>
* </tr>
- * </tbody>
* </table>
*
* <p>
* The class is not intended to be subclassed by clients.
* </p>
* @since 3.0
*/
class BERRY_EXPRESSIONS EvaluationResult : public Object
{
private:
int fValue;
static const int FALSE_VALUE;
static const int TRUE_VALUE;
static const int NOT_LOADED_VALUE;
public:
/** The evaluation result representing the value FALSE */
static const SmartPointer<const EvaluationResult> FALSE_EVAL;
/** The evaluation result representing the value TRUE */
static const SmartPointer<const EvaluationResult> TRUE_EVAL;
/** The evaluation result representing the value NOT_LOADED */
static const SmartPointer<const EvaluationResult> NOT_LOADED;
private:
static const SmartPointer<const EvaluationResult> AND[3][3];
static const SmartPointer<const EvaluationResult> OR[3][3];
static const SmartPointer<const EvaluationResult> NOT[3];
/*
* No instances outside of <code>EvaluationResult</code>
*/
EvaluationResult(int value);
EvaluationResult(const EvaluationResult& o);
public:
berryObjectMacro(berry::EvaluationResult);
bool operator==(const Object*) const override;
bool operator!=(const Object*) const;
/**
* Returns an <code>EvaluationResult</code> whose value is <code>this &amp;&amp; other)</code>.
*
* @param other the right hand side of the and operation.
*
* @return <code>this &amp;&amp; other</code> as defined by the evaluation result
*/
EvaluationResult::ConstPointer And(const EvaluationResult::ConstPointer& other) const;
/**
* Returns an <code>EvaluationResult</code> whose value is <code>this || other)</code>.
*
* @param other the right hand side of the or operation.
*
* @return <code>this || other</code> as defined by the evaluation result
*/
EvaluationResult::ConstPointer Or(const EvaluationResult::ConstPointer& other) const;
/**
* Returns the inverted value of this evaluation result
*
* @return the inverted value of this evaluation result
*/
EvaluationResult::ConstPointer Not() const;
/**
* Returns an evaluation result instance representing the
* given boolean value. If the given boolean value is
* <code>TRUE_EVAL</code> then <code>ExpressionResult.TRUE_EVAL</code>
* is returned. If the value is <code>FALSE_EVAL</code> then <code>
* ExpressionResult.FALSE_EVAL</code> is returned.
*
* @param b a boolean value
*
* @return the expression result representing the boolean
* value
*/
static EvaluationResult::ConstPointer ValueOf(bool b);
/**
* For debugging purpose only
*
* @return a string representing this object. The result is not
* human readable
*/
QString ToString() const override;
};
} // namespace berry
#endif /*BERRYEVALUATIONRESULT_*/
diff --git a/Plugins/org.blueberry.core.expressions/src/berryExpression.h b/Plugins/org.blueberry.core.expressions/src/berryExpression.h
index 24922ea25a..620027e477 100644
--- a/Plugins/org.blueberry.core.expressions/src/berryExpression.h
+++ b/Plugins/org.blueberry.core.expressions/src/berryExpression.h
@@ -1,220 +1,207 @@
/*============================================================================
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 BERRYEXPRESSION_H_
#define BERRYEXPRESSION_H_
#include "berryExpressionInfo.h"
#include "berryIEvaluationContext.h"
#include "berryEvaluationResult.h"
#include <org_blueberry_core_expressions_Export.h>
#include <berryMacros.h>
#include <berryObject.h>
namespace berry {
/**
* Abstract base class for all expressions provided by the common
* expression language.
* <p>
- * An expression is evaluated by calling {@link #evaluate(IEvaluationContext)}.
+ * An expression is evaluated by calling {@link #Evaluate}.
* </p>
* <p>
* This class may be subclassed to provide specific expressions.
* </p>
*/
class BERRY_EXPRESSIONS Expression : public Object {
public:
berryObjectMacro(Expression);
/**
* The constant integer hash code value meaning the hash code has not yet
* been computed.
*/
static const uint HASH_CODE_NOT_COMPUTED;
/**
* A factor for computing the hash code for all expressions.
*/
static const uint HASH_FACTOR;
/**
* Name of the value attribute of an expression (value is <code>value</code>).
*/
static const QString ATT_VALUE;
private:
/**
* The hash code for this object. This value is computed lazily. If it is
* not yet computed, it is equal to {@link #HASH_CODE_NOT_COMPUTED}.
*/
mutable uint fHashCode;
protected:
- /**
- * Checks whether two objects are equal using the
- * <code>equals(Object)</code> method of the <code>left</code> object.
- * This method handles <code>null</code> for either the <code>left</code>
- * or <code>right</code> object.
- *
- * @param left the first object to compare; may be <code>null</code>.
- * @param right the second object to compare; may be <code>null</code>.
- * @return <code>TRUE_EVAL</code> if the two objects are equivalent;
- * <code>FALSE_EVAL</code> otherwise.
- */
- // static bool Equals(final Object left, final Object right);
-
/**
* Tests whether two arrays of objects are equal to each other. The arrays
* must not be <code>null</code>, but their elements may be
* <code>null</code>.
*
* @param leftArray the left array to compare; may be <code>null</code>, and
* may be empty and may contain <code>null</code> elements.
* @param rightArray the right array to compare; may be <code>null</code>,
* and may be empty and may contain <code>null</code> elements.
*
* @return <code>TRUE_EVAL</code> if the arrays are equal length and the elements
* at the same position are equal; <code>FALSE_EVAL</code> otherwise.
*/
static bool Equals(const QList<Expression::Pointer>& leftArray,
const QList<Expression::Pointer>& rightArray);
static bool Equals(const QList<Object::Pointer>& leftArray,
const QList<Object::Pointer>& rightArray);
/**
* Returns the hash code for the given <code>object</code>. This method
* handles <code>null</code>.
*
* @param object the object for which the hash code is desired; may be
* <code>null</code>.
*
* @return The hash code of the object; zero if the object is
* <code>null</code>.
*/
static uint HashCode(Expression::Pointer object);
/**
* Returns the hash code for the given array. This method handles
* <code>null</code>.
*
* @param array the array for which the hash code is desired; may be
* <code>null</code>.
* @return the hash code of the array; zero if the object is
* <code>null</code>.
*/
static uint HashCode(const QList<Expression::Pointer>& array);
static uint HashCode(const QList<Object::Pointer>& array);
/**
* Method to compute the hash code for this object. The result
* returned from this method is cached in the <code>fHashCode</code>
* field. If the value returned from the method equals {@link #HASH_CODE_NOT_COMPUTED}
* (e.g. <code>-1</code>) then the value is incremented by one.
* <p>
* This default implementation calls <code>super.hashCode()</code>
* </p>
* @return a hash code for this object.
*/
virtual uint ComputeHashCode() const;
public:
/**
* The expression corresponding to {@link EvaluationResult#TRUE_EVAL}.
*/
static const Expression::Pointer TRUE_EVAL;
/**
* The expression corresponding to {@link EvaluationResult#FALSE_EVAL}.
*/
static const Expression::Pointer FALSE_EVAL;
Expression();
~Expression() override;
uint HashCode() const override;
/**
* Evaluates this expression.
*
* @param context an evaluation context providing information like variable,
* name spaces, etc. necessary to evaluate this expression
*
* @return the result of the expression evaluation
*
* @throws CoreException if the evaluation failed. The concrete reason is
* defined by the subclass implementing this method
*/
virtual SmartPointer<const EvaluationResult> Evaluate(IEvaluationContext* context) const = 0;
/**
* Computes the expression information for the given expression tree.
* <p>
* This is a convenience method for collecting the expression information
- * using {@link Expression#collectExpressionInfo(ExpressionInfo)}.
+ * using {@link Expression#CollectExpressionInfo}.
* </p>
*
* @return the expression information
*/
virtual const ExpressionInfo* ComputeExpressionInfo() const;
/**
* Collects information about this expression tree. This default
* implementation add the expression's type to the set of misbehaving
* expression types.
*
* @param info the expression information object used
* to collect the information
*/
virtual void CollectExpressionInfo(ExpressionInfo* info) const;
QString ToString() const override;
bool operator==(const Object* object) const override;
};
class TRUE_EVALExpression : public Expression
{
public:
SmartPointer<const EvaluationResult> Evaluate(IEvaluationContext* /*context*/) const override
{
return EvaluationResult::TRUE_EVAL;
}
void CollectExpressionInfo(ExpressionInfo* /*info*/) const override {}
};
class FALSE_EVALExpression : public Expression
{
public:
SmartPointer<const EvaluationResult> Evaluate(IEvaluationContext* /*context*/) const override
{
return EvaluationResult::FALSE_EVAL;
}
void CollectExpressionInfo(ExpressionInfo* /*info*/) const override {}
};
} // namespace berry
#endif /*BERRYEXPRESSION_H_*/
diff --git a/Plugins/org.blueberry.core.expressions/src/berryExpressionConverter.h b/Plugins/org.blueberry.core.expressions/src/berryExpressionConverter.h
index f7a6d88c58..8d973f23e8 100644
--- a/Plugins/org.blueberry.core.expressions/src/berryExpressionConverter.h
+++ b/Plugins/org.blueberry.core.expressions/src/berryExpressionConverter.h
@@ -1,123 +1,123 @@
/*============================================================================
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 BERRYEXPRESSIONCONVERTER_H_
#define BERRYEXPRESSIONCONVERTER_H_
#include <org_blueberry_core_expressions_Export.h>
#include <berrySmartPointer.h>
#include <QList>
namespace Poco {
namespace XML {
class Element;
}
}
namespace berry {
struct IConfigurationElement;
class CompositeExpression;
class ElementHandler;
class Expression;
/**
* An expression converter converts an XML expression represented by an
- * {@link IConfigurationElement} or {@link Element} (DOM) subtree into a
+ * {@link IConfigurationElement} (DOM) subtree into a
* corresponding expression tree.
*
* <p>
* An expression converter manages a list of {@link ElementHandler}s. Element
* handlers are responsible to do the actual conversion. The element handlers
* build a chain of responsibility.
* </p>
*
* @since 3.0
*/
class BERRY_EXPRESSIONS ExpressionConverter {
private:
QList<SmartPointer<ElementHandler> > fHandlers;
static ExpressionConverter* INSTANCE;
public:
/**
* Returns the default expression converter. The default expression converter
* can cope with all expression elements defined by the common expression
* language.
*
* @return the default expression converter
*/
static ExpressionConverter* GetDefault();
/**
* Creates a new expression converter with the given list of element
* handlers. The element handlers build a chain of responsibility
* meaning that the first handler in the list is first used to
* convert the configuration element. If this handler isn't able
* to convert the configuration element the next handler in the
* array is used.
*
* @param handlers the array of element handlers
*/
ExpressionConverter(const QList<SmartPointer<ElementHandler> >& handlers);
/**
* Converts the tree of configuration elements represented by the given
* root element and returns a corresponding expression tree.
*
* @param root the configuration element to be converted
*
* @return the corresponding expression tree or <code>null</code>
* if the configuration element cannot be converted
*
* @throws CoreException if the configuration element can't be
* converted. Reasons include: (a) no handler is available to
* cope with a certain configuration element or (b) the XML
* expression tree is malformed.
*/
SmartPointer<Expression> Perform(const SmartPointer<IConfigurationElement>& root);
/**
* Converts the tree of DOM elements represented by the given
* root element and returns a corresponding expression tree.
*
* @param root the element to be converted
*
* @return the corresponding expression tree or <code>null</code>
* if the element cannot be converted
*
* @throws CoreException if the element can't be converted.
* Reasons include: (a) no handler is available to cope with
* a certain element or (b) the XML expression tree is malformed.
*/
SmartPointer<Expression> Perform(Poco::XML::Element* root);
void ProcessChildren(const SmartPointer<IConfigurationElement>& element,
const SmartPointer<CompositeExpression>& result);
QString GetDebugPath(const SmartPointer<IConfigurationElement>& configurationElement);
void ProcessChildren(Poco::XML::Element* element,
const SmartPointer<CompositeExpression>& result);
};
} // namespace berry
#endif /*BERRYEXPRESSIONCONVERTER_H_*/
diff --git a/Plugins/org.blueberry.core.expressions/src/berryExpressionInfo.h b/Plugins/org.blueberry.core.expressions/src/berryExpressionInfo.h
index c13df875e4..2e95c0c066 100644
--- a/Plugins/org.blueberry.core.expressions/src/berryExpressionInfo.h
+++ b/Plugins/org.blueberry.core.expressions/src/berryExpressionInfo.h
@@ -1,185 +1,183 @@
/*============================================================================
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 BERRYEXPRESSIONINFO_H_
#define BERRYEXPRESSIONINFO_H_
#include <QSet>
#include <typeinfo>
#include <org_blueberry_core_expressions_Export.h>
namespace berry {
/**
* A status object describing information about an expression tree.
* This information can for example be used to decide whether a
* expression tree as to be reevaluated if the value of some
* variables changes.
* <p>
* This class is not intended to be extended by clients.
* </p>
*
* @since 3.2
*/
class BERRY_EXPRESSIONS ExpressionInfo {
private:
bool fHasDefaultVariableAccess;
bool fHasSystemPropertyAccess;
// Although we are using this as sets we use lists since
// they are faster for smaller numbers of elements
QSet<QString> fAccessedVariableNames;
QSet<QString> fMisbehavingExpressionTypes;
QSet<QString> fAccessedPropertyNames;
public:
ExpressionInfo();
/**
* Returns <code>true</code> if the default variable is accessed
* by the expression tree.
*
* @return whether the default variable is accessed or not
*/
bool HasDefaultVariableAccess() const;
/**
* Marks the default variable as accessed.
*/
void MarkDefaultVariableAccessed();
/**
* Returns <code>true</code> if the system property is accessed
* by the expression tree.
*
* @return whether the system property is accessed or not
*/
bool HasSystemPropertyAccess() const;
/**
* Marks the system property as accessed.
*/
void MarkSystemPropertyAccessed();
/**
* Returns the set off accessed variables.
*
* @return the set off accessed variables
*/
QSet<QString> GetAccessedVariableNames() const;
/**
* Marks the given variable as accessed.
*
* @param name the accessed variable
*/
void AddVariableNameAccess(const QString& name);
/**
* Returns the set of accessed properties.
*
* @return the set of accessed properties, or an empty array
*/
QSet<QString> GetAccessedPropertyNames() const;
/**
* Marks that this expression access this property. It should be the fully
* qualified property name.
*
* @param name
* the fully qualified property name
*/
void AddAccessedPropertyName(const QString& name);
/**
- * Returns the set of expression types which don't implement the
- * new (@link Expression#computeReevaluationInfo(IEvaluationContext)}
- * method. If one expression didn't implement the method the expression
+ * If one expression didn't implement the method the expression
* tree no optimizations can be done. Returns <code>null</code> if
* all expressions implement the method.
*
* @return the set of expression types which don't implement the
* <code>computeReevaluationInfo</code> method.
*/
QSet<QString> GetMisbehavingExpressionTypes() const;
/**
* Adds the given class to the list of misbehaving classes.
*
* @param clazz the class to add.
*/
void AddMisBehavingExpressionType(const std::type_info& clazz);
/**
* Merges this reevaluation information with the given info.
*
* @param other the information to merge with
*/
void Merge(ExpressionInfo* other);
/**
* Merges this reevaluation information with the given info
* ignoring the default variable access.
*
* @param other the information to merge with
*/
void MergeExceptDefaultVariable(ExpressionInfo* other);
private:
/**
* Merges only the default variable access.
*
* @param other the information to merge with
*/
void MergeDefaultVariableAccess(ExpressionInfo* other);
/**
* Merges only the system property access.
*
* @param other the information to merge with
*/
void MergeSystemPropertyAccess(ExpressionInfo* other);
/**
* Merges only the accessed variable names.
*
* @param other the information to merge with
*/
void MergeAccessedVariableNames(ExpressionInfo* other);
/**
* Merges only the accessed property names.
*
* @param other the information to merge with
* @since 3.4
*/
void MergeAccessedPropertyNames(ExpressionInfo* other);
/**
* Merges only the misbehaving expression types.
*
* @param other the information to merge with
*/
void MergeMisbehavingExpressionTypes(ExpressionInfo* other);
};
} // namespace berry
#endif /*BERRYEXPRESSIONINFO_H_*/
diff --git a/Plugins/org.blueberry.core.expressions/src/berryIEvaluationContext.h b/Plugins/org.blueberry.core.expressions/src/berryIEvaluationContext.h
index f592178f94..96404415d1 100644
--- a/Plugins/org.blueberry.core.expressions/src/berryIEvaluationContext.h
+++ b/Plugins/org.blueberry.core.expressions/src/berryIEvaluationContext.h
@@ -1,145 +1,145 @@
/*============================================================================
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 BERRYIEVALUATIONCONTEXT_H_
#define BERRYIEVALUATIONCONTEXT_H_
#include <berryMacros.h>
#include <berryObject.h>
#include <org_blueberry_core_expressions_Export.h>
namespace berry {
/**
* An evaluation context is used to manage a set of objects needed during
* XML expression evaluation. A context has a parent context, can manage
* a set of named variables and has a default variable. The default variable
* is used during XML expression evaluation if no explicit variable is
* referenced.
* <p>
* This interface is not intended to be implemented by clients. Clients
* are allowed to instantiate <code>EvaluationContext</code>.
* </p>
*
* @since 3.0
*/
struct BERRY_EXPRESSIONS IEvaluationContext : public Object
{
berryObjectMacro(berry::IEvaluationContext);
/**
* Represents the value used by variables that exist but are not defined
* in a evaluation context. When tested by the 'with' expression, <code>false</code>
* will be returned.
*/
static Object::ConstPointer UNDEFINED_VARIABLE;
~IEvaluationContext() override;
/**
* Returns the parent context or <code>null</code> if
* this is the root of the evaluation context hierarchy.
*
* @return the parent evaluation context or <code>null</code>
*/
virtual IEvaluationContext* GetParent() const = 0;
/**
* Returns the root evaluation context.
*
* @return the root evaluation context
*/
virtual IEvaluationContext* GetRoot() const = 0;
/**
* Specifies whether this evaluation context allows activation
* of plug-ins for testers used in the expression tree. To actual
* trigger the plug-in loading this flag has to be set to <code>
* true</code> and the actual test expression must have the
* attribute <code>forcePluginActivation</code> set to <code>
* true</code> as well.
*
* @param value whether this evaluation context allows plug-in activation
* @since 3.2
*/
virtual void SetAllowPluginActivation(bool value) = 0;
/**
* Returns whether this evaluation context supports plug-in
- * activation. If not set via {@link #setAllowPluginActivation(boolean)}
+ * activation. If not set via {@link #SetAllowPluginActivation}
* the parent value is returned. If no parent is set <code>false</code>
* is returned.
*
* @return whether plug-in activation is supported or not
* @since 3.2
*/
virtual bool GetAllowPluginActivation() const = 0;
/**
* Returns the default variable.
*
* @return the default variable or <code>null</code> if
* no default variable is managed.
*/
virtual Object::ConstPointer GetDefaultVariable() const = 0;
/**
* Adds a new named variable to this context. If a variable
* with the name already exists the new one overrides the
* existing one.
*
* @param name the variable's name
* @param value the variable's value
*/
virtual void AddVariable(const QString& name, const Object::ConstPointer& value) = 0;
/**
* Removes the variable managed under the given name
* from this evaluation context.
*
* @param name the variable's name
* @return the currently stored value or <code>null</code> if
* the variable doesn't exist
*/
virtual Object::ConstPointer RemoveVariable(const QString& name) = 0;
/**
* Returns the variable managed under the given name.
*
* @param name the variable's name
* @return the variable's value or <code>null</code> if the content
* doesn't manage a variable with the given name
*/
virtual Object::ConstPointer GetVariable(const QString& name) const = 0;
/**
* Resolves a variable for the given name and arguments. This
* method can be used to dynamically resolve variable such as
* plug-in descriptors, resources, etc. The method is used
* by the <code>resolve</code> expression.
*
* @param name the variable to resolve
* @param args an object array of arguments used to resolve the
* variable
* @return the variable's value or <code>null</code> if no variable
* can be resolved for the given name and arguments
* @exception CoreException if an errors occurs while resolving
* the variable
*/
virtual Object::ConstPointer ResolveVariable(const QString& name, const QList<Object::Pointer>& args) const = 0;
};
} // namespace berry
#endif /*BERRYIEVALUATIONCONTEXT_H_*/
diff --git a/Plugins/org.blueberry.core.expressions/src/berryIPropertyTester.h b/Plugins/org.blueberry.core.expressions/src/berryIPropertyTester.h
index 43565e7ef7..9fef880fd8 100644
--- a/Plugins/org.blueberry.core.expressions/src/berryIPropertyTester.h
+++ b/Plugins/org.blueberry.core.expressions/src/berryIPropertyTester.h
@@ -1,108 +1,108 @@
/*============================================================================
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 BERRYIPROPERTYTESTER_H_
#define BERRYIPROPERTYTESTER_H_
#include <berryMacros.h>
#include <berryObject.h>
#include <org_blueberry_core_expressions_Export.h>
#include <Poco/Any.h>
#include <string>
#include <vector>
#include <QObject>
namespace berry {
/**
* A property tester can be used to add additional properties to test to an
* existing type.
* <p>
* This interface is not intended to be implemented by clients. Clients
* should subclass type <code>PropertyTester</code>.
* </p>
*/
struct BERRY_EXPRESSIONS IPropertyTester : public Object
{
berryObjectMacro(berry::IPropertyTester);
~IPropertyTester() override;
/**
* Returns whether the property tester can handle the given
* property or not.
*
- * @param namespace the name space to be considered
+ * @param namespaze the name space to be considered
* @param property the property to test
* @return <code>true</code> if the tester provides an implementation
* for the given property; otherwise <code>false</code> is returned
*/
virtual bool Handles(const QString& namespaze, const QString& property) = 0;
/**
* Returns whether the implementation class for this property tester is
* loaded or not.
*
* @return <code>true</code>if the implementation class is loaded;
* <code>false</code> otherwise
*/
virtual bool IsInstantiated() = 0;
/**
* Returns <code>true</code> if the implementation class of this property
* tester can be loaded. This is the case if the plug-in providing
* the implementation class is active. Returns <code>false</code> otherwise.
*
* @return whether the implementation class can be loaded or not
*/
virtual bool IsDeclaringPluginActive() = 0;
/**
* Loads the implementation class for this property tester and returns an
* instance of this class.
*
* @return an instance of the implementation class for this property tester
*
* @throws CoreException if the implementation class cannot be loaded
*/
virtual IPropertyTester* Instantiate() = 0;
/**
* Executes the property test determined by the parameter <code>property</code>.
*
* @param receiver the receiver of the property test
* @param property the property to test
* @param args additional arguments to evaluate the property. If no arguments
* are specified in the <code>test</code> expression an array of length 0
* is passed
* @param expectedValue the expected value of the property. The value is either
* of type <code>java.lang.String</code> or a boxed base type. If no value was
* specified in the <code>test</code> expressions then <code>null</code> is passed
*
- * @return returns <code>true<code> if the property is equal to the expected value;
+ * @return returns <code>true</code> if the property is equal to the expected value;
* otherwise <code>false</code> is returned
*/
virtual bool Test(Object::ConstPointer receiver, const QString& property,
const QList<Object::Pointer>& args, Object::Pointer expectedValue) = 0;
};
} // namespace berry
Q_DECLARE_INTERFACE(berry::IPropertyTester, "org.blueberry.IPropertyTester")
#endif /*BERRYIPROPERTYTESTER_H_*/
diff --git a/Plugins/org.blueberry.core.expressions/src/berryPropertyTester.h b/Plugins/org.blueberry.core.expressions/src/berryPropertyTester.h
index 95eafb6652..ca5b531d59 100644
--- a/Plugins/org.blueberry.core.expressions/src/berryPropertyTester.h
+++ b/Plugins/org.blueberry.core.expressions/src/berryPropertyTester.h
@@ -1,121 +1,121 @@
/*============================================================================
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 BERRYPROPERTYTESTER_H_
#define BERRYPROPERTYTESTER_H_
#include <berryIConfigurationElement.h>
#include "internal/berryPropertyTesterDescriptor.h"
#include <org_blueberry_core_expressions_Export.h>
namespace berry {
/**
* Abstract superclass of all property testers. Implementation classes of
* the extension point <code>org.blueberry.core.expresssions.propertyTesters
* </code> must extend <code>PropertyTester</code>.
* <p>
* A property tester implements the property tests enumerated in the property
* tester extension point. For the following property test extension
- * <pre>
- * &lt;propertyTester
- * namespace="org.blueberry.jdt.core"
- * id="org.blueberry.jdt.core.IPackageFragmentTester"
- * properties="isDefaultPackage"
- * type="org.blueberry.jdt.core.IPackageFragment"
- * class="org.blueberry.demo.MyPackageFragmentTester"&gt;
- * &lt;/propertyTester&gt;
- * </pre>
+ * \code{.unparsed}
+ * <propertyTester
+ * namespace="org.blueberry.jdt.core"
+ * id="org.blueberry.jdt.core.IPackageFragmentTester"
+ * properties="isDefaultPackage"
+ * type="org.blueberry.jdt.core.IPackageFragment"
+ * class="org.blueberry.demo.MyPackageFragmentTester">
+ * </propertyTester>
+ * \endcode
* the corresponding implementation class looks like:
- * <pre>
+ * \code
* public class MyPackageFragmentTester {
* public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
* IPackageFragment fragement= (IPackageFragment)receiver;
* if ("isDefaultPackage".equals(property)) {
* return expectedValue == null
* ? fragement.isDefaultPackage()
* : fragement.isDefaultPackage() == ((Boolean)expectedValue).booleanValue();
* }
* Assert.isTrue(false);
* return false;
* }
* }
- * </pre>
+ * \endcode
* The property can then be used in a test expression as follows:
* <pre>
* &lt;instanceof value="org.blueberry.core.IPackageFragment"/&gt;
* &lt;test property="org.blueberry.jdt.core.isDefaultPackage"/&gt;
* </pre>
* </p>
* <p>
* There is no guarantee that the same instance of a property tester is used
* to handle &lt;test property="..."/&gt; requests. So property testers
* should always be implemented in a stateless fashion.
* </p>
*/
class BERRY_EXPRESSIONS PropertyTester : public QObject, public IPropertyTester
{
Q_OBJECT
Q_INTERFACES(berry::IPropertyTester)
private:
IConfigurationElement::Pointer fConfigElement;
QString fNamespace;
QString fProperties;
public:
/**
* Initialize the property tester with the given name space and property.
* <p>
* Note: this method is for internal use only. Clients must not call
* this method.
* </p>
* @param descriptor the descriptor object for this tester
*/
void InternalInitialize(PropertyTesterDescriptor::Pointer descriptor);
/**
* Note: this method is for internal use only. Clients must not call
* this method.
*
* @return the property tester descriptor
*/
PropertyTesterDescriptor::Pointer InternalCreateDescriptor();
/**
* {@inheritDoc}
*/
bool Handles(const QString& namespaze, const QString& property) override;
/**
* {@inheritDoc}
*/
bool IsInstantiated() override;
/**
* {@inheritDoc}
*/
bool IsDeclaringPluginActive() override;
/**
* {@inheritDoc}
*/
IPropertyTester* Instantiate() override;
};
} // namespace berry
#endif /*BERRYPROPERTYTESTER_H_*/
diff --git a/Plugins/org.blueberry.core.jobs/src/berryIJobChangeEvent.h b/Plugins/org.blueberry.core.jobs/src/berryIJobChangeEvent.h
index 3ce868c321..888c382e75 100644
--- a/Plugins/org.blueberry.core.jobs/src/berryIJobChangeEvent.h
+++ b/Plugins/org.blueberry.core.jobs/src/berryIJobChangeEvent.h
@@ -1,70 +1,70 @@
/*============================================================================
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 BERRYIJOBCHANGEEVENT_H_
#define BERRYIJOBCHANGEEVENT_H_
#include <berryObject.h>
#include <berryMacros.h>
#include <berryIStatus.h>
#include <Poco/Timestamp.h>
#include <org_blueberry_core_jobs_Export.h>
namespace berry
{
class Job;
/**
* An event describing a change to the state of a job.
*
* @see IJobChangeListener
- * @noimplement This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be implemented by clients.
*/
struct BERRY_JOBS IJobChangeEvent : public Object
{
berryObjectMacro(berry::IJobChangeEvent);
/**
* The amount of time in milliseconds to wait after scheduling the job before it
* should be run, or <code>-1</code> if not applicable for this type of event.
* This value is only applicable for the <code>scheduled</code> event.
*
* @return the delay time for this event
*/
virtual Poco::Timestamp::TimeDiff GetDelay() const = 0;
/**
* The job on which this event occurred.
*
* @return the job for this event
*/
virtual SmartPointer<Job> GetJob() const = 0;
/**
* The result returned by the job's run method, or <code>null</code> if
* not applicable. This value is only applicable for the <code>done</code> event.
*
* @return the status for this event
*/
virtual IStatus::Pointer GetResult() const = 0;
};
}
#endif /* BERRYIJOBCHANGEEVENT_H_ */
diff --git a/Plugins/org.blueberry.core.jobs/src/berryIJobChangeListener.h b/Plugins/org.blueberry.core.jobs/src/berryIJobChangeListener.h
index 14ab9d6c19..1d8e41422f 100644
--- a/Plugins/org.blueberry.core.jobs/src/berryIJobChangeListener.h
+++ b/Plugins/org.blueberry.core.jobs/src/berryIJobChangeListener.h
@@ -1,153 +1,140 @@
/*============================================================================
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 BERRYIJOBCHANGELISTENER_H_
#define BERRYIJOBCHANGELISTENER_H_
#include "berryIJobChangeEvent.h"
namespace berry
{
/**
* Callback interface for clients interested in being notified when jobs change state.
* <p>
* A single job listener instance can be added either to the job manager, for notification
* of all scheduled jobs, or to any set of individual jobs. A single listener instance should
* not be added to both the job manager, and to individual jobs (such a listener may
* receive duplicate notifications).
* </p><p>
* Clients should not rely on the result of the <code>Job#GetState()</code>
* method on jobs for which notification is occurring. Listeners are notified of
* all job state changes, but whether the state change occurs before, during, or
* after listeners are notified is unspecified.
* </p><p>
* Clients may implement this interface.
* </p>
* @see IJobManager#AddJobChangeListener(IJobChangeListener::Pointer)
* @see IJobManager#RemoveJobChangeListener(IJobChangeListener::Pointer)
* @see Job#AddJobChangeListener(IJobChangeListener::Pointer)
* @see Job#GetState()
* @see Job#RemoveJobChangeListener(IJobChangeListener::Pointer)
*/
struct BERRY_JOBS IJobChangeListener
{
struct BERRY_JOBS Events
{
typedef Message1<const IJobChangeEvent::ConstPointer&> JobChangeEventType;
enum Type
{
NONE = 0x00000000,
ABOUT_TO_RUN = 0x00000001,
AWAKE = 0x00000002,
DONE = 0x00000004,
RUNNING = 0x00000008,
SCHEDULED = 0x00000010,
SLEEPING = 0x00000020,
ALL = 0xffffffff
};
Q_DECLARE_FLAGS(Types, Type)
JobChangeEventType jobAboutToRun;
JobChangeEventType jobAwake;
JobChangeEventType jobDone;
JobChangeEventType jobRunning;
JobChangeEventType jobScheduled;
JobChangeEventType jobSleeping;
void AddListener(IJobChangeListener* listener);
void RemoveListener(IJobChangeListener* listener);
void SetExceptionHandler(const AbstractExceptionHandler& handler);
typedef MessageDelegate1<IJobChangeListener, const IJobChangeEvent::ConstPointer&>
Delegate;
};
virtual Events::Types GetEventTypes() = 0;
/**
* Notification that a job is about to be run. Listeners are allowed to sleep, cancel,
* or change the priority of the job before it is started (and as a result may prevent
* the run from actually occurring).
- *
- * @param event the event details
*/
virtual void AboutToRun(const IJobChangeEvent::ConstPointer& /*event*/)
{
}
/**
* Notification that a job was previously sleeping and has now been rescheduled
* to run.
- *
- * @param event the event details
*/
virtual void Awake(const IJobChangeEvent::ConstPointer& /*event*/)
{
}
/**
* Notification that a job has completed execution, either due to cancelation, successful
* completion, or failure. The event status object indicates how the job finished,
* and the reason for failure, if applicable.
- *
- * @param event the event details
*/
virtual void Done(const IJobChangeEvent::ConstPointer& /*event*/)
{
}
/**
* Notification that a job has started running.
- *
- * @param event the event details
*/
virtual void Running(const IJobChangeEvent::ConstPointer& /*event*/)
{
}
/**
* Notification that a job is being added to the queue of scheduled jobs.
* The event details includes the scheduling delay before the job should start
* running.
- *
- * @param event the event details, including the job instance and the scheduling
- * delay
*/
virtual void Scheduled(const IJobChangeEvent::ConstPointer& /*event*/)
{
}
/**
* Notification that a job was waiting to run and has now been put in the
* sleeping state.
- *
- * @param event the event details
*/
virtual void Sleeping(const IJobChangeEvent::ConstPointer& /*event*/)
{
}
};
}
Q_DECLARE_OPERATORS_FOR_FLAGS(berry::IJobChangeListener::Events::Types)
#endif /* BERRYIJOBCHANGELISTENER_H_ */
diff --git a/Plugins/org.blueberry.core.jobs/src/berryIJobManager.h b/Plugins/org.blueberry.core.jobs/src/berryIJobManager.h
index e7c98c6d8d..88ccd41d7a 100644
--- a/Plugins/org.blueberry.core.jobs/src/berryIJobManager.h
+++ b/Plugins/org.blueberry.core.jobs/src/berryIJobManager.h
@@ -1,436 +1,156 @@
/*============================================================================
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 _BERRY_IJOBMANAGER_H
#define _BERRY_IJOBMANAGER_H
#include<string>
#include <org_blueberry_core_jobs_Export.h>
#include "berryJob.h"
#include "berryProgressProvider.h"
#include "berryIProgressMonitor.h"
#include "berryIJobChangeListener.h"
#include<Poco/Thread.h>
namespace berry
{
/**
* The job manager provides facilities for scheduling, querying, and maintaining jobs
* and locks. In particular, the job manager provides the following services:
* <ul>
* <li>Maintains a queue of jobs that are waiting to be run. Items can be added to
* the queue using the <code>schedule</code> method.</li>
* <li> @todo Allows manipulation of groups of jobs called job families. } Job families can
* be canceled, put to sleep, or woken up atomically. There is also a mechanism
* for querying the set of known jobs in a given family.> </li>
*
* <li>Allows listeners to find out about progress on running jobs, and to find out
* when jobs have changed states.</li>
* <li> @todo Provides a factory for creating lock objects. Lock objects are smart monitors
* that have strategies for avoiding deadlock. ></li>
*
* <li>Provide feedback to a client that is waiting for a given job or family of jobs
* to complete.</li>
* </ul>
*
* @see Job
* @see ILock
*
- * @noimplement This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be implemented by clients.
*/
struct BERRY_JOBS IJobManager: public Object
{
berryObjectMacro(berry::IJobManager);
/**
* A system property key indicating whether the job manager should create
* job threads as daemon threads. Set to <code>true</code> to force all worker
* threads to be created as daemon threads. Set to <code>false</code> to force
* all worker threads to be created as non-daemon threads.
*
* not used yet
*/
static const std::string PROP_USE_DAEMON_THREADS ;
/**
* Registers a job listener with the job manager.
* Has no effect if an identical listener is already registered.
*
* @param listener the listener to be added
- * @see #removeJobChangeListener(IJobChangeListener)
+ * @see #RemoveJobChangeListener
* @see IJobChangeListener
*/
virtual void AddJobChangeListener(IJobChangeListener* listener) = 0;
- ///**
- // * Begins applying this rule in the calling thread. If the rule conflicts with another
- // * rule currently running in another thread, this method blocks until there are
- // * no conflicting rules. Calls to <tt>beginRule</tt> must eventually be followed
- // * by a matching call to <tt>endRule</tt> in the same thread and with the identical
- // * rule instance.
- // * <p>
- // * Rules can be nested only if the rule for the inner <tt>beginRule</tt>
- // * is contained within the rule for the outer <tt>beginRule</tt>. Rule containment
- // * is tested with the API method <tt>ISchedulingRule.contains</tt>. Also, begin/end
- // * pairs must be strictly nested. Only the rule that has most recently begun
- // * can be ended at any given time.
- // * <p>
- // * A rule of <code>null</code> can be used, but will be ignored for scheduling
- // * purposes. The outermost non-null rule in the thread will be used for scheduling. A
- // * <code>null</code> rule that is begun must still be ended.
- // * <p>
- // * If this method is called from within a job that has a scheduling rule, the
- // * given rule must also be contained within the rule for the running job.
- // * <p>
- // * Note that <tt>endRule</tt> must be called even if <tt>beginRule</tt> fails.
- // * The recommended usage is:
- // * <pre>
- // * final ISchedulingRule rule = ...;
- // * try {
- // * manager.beginRule(rule, monitor);
- // * } finally {
- // * manager.endRule(rule);
- // * }
- // * </pre>
- // *
- // * @param rule the rule to begin applying in this thread, or <code>null</code>
- // * @param monitor a progress monitor, or <code>null</code> if progress
- // * reporting and cancellation are not desired
- // * @throws IllegalArgumentException if the rule is not strictly nested within
- // * all other rules currently active for this thread
- // * @throws OperationCanceledException if the supplied monitor reports cancelation
- // * before the rule becomes available
- // * @see ISchedulingRule#contains(ISchedulingRule)
- // */
-
- /// virtual void BeginRule(const ISchedulingRule& rule, const IProgressMonitor& monitor) = 0;
-
- ///**
- // * Cancels all jobs in the given job family. Jobs in the family that are currently waiting
- // * will be removed from the queue. Sleeping jobs will be discarded without having
- // * a chance to wake up. Currently executing jobs will be asked to cancel but there
- // * is no guarantee that they will do so.
- // *
- // * @param family the job family to cancel, or <code>null</code> to cancel all jobs
- // * @see Job#belongsTo(Object)
- // */
- /// virtual void Cancel(const Object& family);
-
/**
* Returns a progress monitor that can be used to provide
* aggregated progress feedback on a set of running jobs. A user
* interface will typically group all jobs in a progress group together,
* providing progress feedback for individual jobs as well as aggregated
* progress for the entire group. Jobs in the group may be run sequentially,
* in parallel, or some combination of the two.
* <p>
* Recommended usage (this snippet runs two jobs in sequence in a
* single progress group):
- * <pre>
- * Job parseJob, compileJob;
- * IProgressMonitor pm = Platform.getJobManager().createProgressGroup();
- * try {
- * pm.beginTask("Building", 10);
- * parseJob.setProgressGroup(pm, 5);
- * parseJob.schedule();
- * compileJob.setProgressGroup(pm, 5);
- * compileJob.schedule();
- * parseJob.join();
- * compileJob.join();
- * } finally {
- * pm.done();
- * }
- * </pre>
+ * \code
+ * Job parseJob, compileJob;
+ * IProgressMonitor pm = Platform.getJobManager().createProgressGroup();
+ * try {
+ * pm.beginTask("Building", 10);
+ * parseJob.setProgressGroup(pm, 5);
+ * parseJob.schedule();
+ * compileJob.setProgressGroup(pm, 5);
+ * compileJob.schedule();
+ * parseJob.join();
+ * compileJob.join();
+ * } finally {
+ * pm.done();
+ * }
+ * \endcode
*
- * @see Job#setProgressGroup(IProgressMonitor, int)
+ * @see Job#SetProgressGroup
* @see IProgressMonitor
* @return a progress monitor
*/
virtual IProgressMonitor::Pointer CreateProgressGroup() = 0;
- ///**
- // * Returns the job that is currently running in this thread, or <code>null</code> if there
- // * is no currently running job.
- // *
- // * @return the job or <code>null</code>
- // */
- //// virtual Job CurrentJob() = 0;
-
- ///**
- // * Ends the application of a rule to the calling thread. Calls to <tt>endRule</tt>
- // * must be preceded by a matching call to <tt>beginRule</tt> in the same thread
- // * with an identical rule instance.
- // * <p>
- // * Rules can be nested only if the rule for the inner <tt>beginRule</tt>
- // * is contained within the rule for the outer <tt>beginRule</tt>. Also, begin/end
- // * pairs must be strictly nested. Only the rule that has most recently begun
- // * can be ended at any given time.
- // *
- // * @param rule the rule to end applying in this thread
- // * @throws IllegalArgumentException if this method is called on a rule for which
- // * there is no matching begin, or that does not match the most recent begin.
- // * @see ISchedulingRule#contains(ISchedulingRule)
- // */
- /// virtual void EndRule(const ISchedulingRule& rule) = 0;
-
- ///**
- // * Returns all waiting, executing and sleeping jobs belonging
- // * to the given family. If no jobs are found, an empty array is returned.
- // *
- // * @param family the job family to find, or <code>null</code> to find all jobs
- // * @return the job array
- // * @see Job#belongsTo(Object)
- // */
- /// virtual Job[] Find(const Object& family) = 0;
-
/**
* Returns whether the job manager is currently idle. The job manager is
* idle if no jobs are currently running or waiting to run.
*
* @return <code>true</code> if the job manager is idle, and
* <code>false</code> otherwise
* @since 3.1
*/
virtual bool IsIdle()= 0;
/**
* Returns whether the job manager is currently suspended.
*
* @return <code>true</code> if the job manager is suspended, and
* <code>false</code> otherwise
* @since 3.4
- * @see #suspend()
- * @see #resume()
*/
virtual bool IsSuspended() = 0;
- ///**
- // * Waits until all jobs of the given family are finished. This method will block the
- // * calling thread until all such jobs have finished executing, or until this thread is
- // * interrupted. If there are no jobs in
- // * the family that are currently waiting, running, or sleeping, this method returns
- // * immediately. Feedback on how the join is progressing is provided to a progress
- // * monitor.
- // * <p>
- // * If this method is called while the job manager is suspended, only jobs
- // * that are currently running will be joined; Once there are no jobs
- // * in the family in the {@link Job#RUNNING} state, this method returns.
- // * </p>
- // * <p>
- // * Note that there is a deadlock risk when using join. If the calling thread owns
- // * a lock or object monitor that the joined thread is waiting for, deadlock
- // * will occur. This method can also result in starvation of the current thread if
- // * another thread continues to add jobs of the given family, or if a
- // * job in the given family reschedules itself in an infinite loop.
- // * </p>
- // *
- // * @param family the job family to join, or <code>null</code> to join all jobs.
- // * @param monitor Progress monitor for reporting progress on how the
- // * wait is progressing, or <code>null</code> if no progress monitoring is required.
- // * @exception InterruptedException if this thread is interrupted while waiting
- // * @exception OperationCanceledException if the progress monitor is canceled while waiting
- // * @see Job#belongsTo(Object)
- // * @see #suspend()
- // */
- /// virtual void Join(const Object& family, const IProgressMonitor& monitor)
- /// throw(InterruptedException, OperationCanceledException) = 0;
- ///**
- // * Creates a new lock object. All lock objects supplied by the job manager
- // * know about each other and will always avoid circular deadlock amongst
- // * themselves.
- // *
- // * @return the new lock object
- // */
- /// virtual ILock newLock() = 0;
-
/**
* Removes a job listener from the job manager.
* Has no effect if an identical listener is not already registered.
*
* @param listener the listener to be removed
- * @see #addJobChangeListener(IJobChangeListener)
+ * @see #AddJobChangeListener
* @see IJobChangeListener
*/
virtual void RemoveJobChangeListener(IJobChangeListener* listener) = 0;
- ///**
- // * Resumes execution of jobs after a previous <code>suspend</code>. All
- // * jobs that were sleeping or waiting prior to the suspension, or that were
- // * scheduled while the job manager was suspended, will now be eligible
- // * for execution.
- // * <p>
- // * Calling this method on a rule that is not suspended has no effect. If another
- // * thread also owns the rule at the time this method is called, then the rule will
- // * not be resumed until all threads have released the rule.
- // *
- // * @deprecated This method is not safe and should not be used.
- // * Suspending a scheduling rule violates the thread safety
- // * of clients that use scheduling rules as a mutual exclusion mechanism,
- // * and can result in concurrency problems in all clients that use the suspended rule.
- // * @see #suspend(ISchedulingRule, IProgressMonitor)
- // */
- /// virtual void Resume(const ISchedulingRule& rule) = 0;
-
- ///**
- // * Resumes execution of jobs after a previous <code>suspend</code>. All
- // * jobs that were sleeping or waiting prior to the suspension, or that were
- // * scheduled while the job manager was suspended, will now be eligible
- // * for execution.
- // * <p>
- // * Calling <code>resume</code> when the job manager is not suspended
- // * has no effect.
- // *
- // * @see #suspend()
- // * @see #isSuspended()
- // */
- ////virtual void Resume() = 0;
-
- ///**
- // * Provides a hook that is notified whenever a thread is about to wait on a lock,
- // * or when a thread is about to release a lock. This hook must only be set once.
- // * <p>
- // * This method is for internal use by the platform-related plug-ins.
- // * Clients should not call this method.
- // * </p>
- // * @see LockListener
- // */
- // TODO LockListener .. SetLockListener
- /// virtual void SetLockListener(const LockListener& listener) = 0;
-
/**
* Registers a progress provider with the job manager. If there was a
* provider already registered, it is replaced.
* <p>
* This method is intended for use by the currently executing Eclipse application.
* Plug-ins outside the currently running application should not call this method.
* </p>
*
* @param provider the new provider, or <code>null</code> if no progress
* is needed
*/
- virtual void SetProgressProvider(ProgressProvider::Pointer) = 0;
-
- /**
- * Suspends execution of all jobs. Jobs that are already running
- * when this method is invoked will complete as usual, but all sleeping and
- * waiting jobs will not be executed until the job manager is resumed.
- * <p>
- * The job manager will remain suspended until a subsequent call to
- * <code>resume</code>. Further calls to <code>suspend</code>
- * when the job manager is already suspended are ignored.
- * <p>
- * All attempts to join sleeping and waiting jobs while the job manager is
- * suspended will return immediately.
- * <p>
- * Note that this very powerful function should be used with extreme caution.
- * Suspending the job manager will prevent all jobs in the system from executing,
- * which may have adverse affects on components that are relying on
- * execution of jobs. The job manager should never be suspended without intent
- * to resume execution soon afterwards.
- *
- * @see #resume()
- * @see #join(Object, IProgressMonitor)
- * @see #isSuspended()
- */
- // virtual void Suspend() = 0;
-
- ///**
- // * Defers execution of all jobs with scheduling rules that conflict with the
- // * given rule. The caller will be blocked until all currently executing jobs with
- // * conflicting rules are completed. Conflicting jobs that are sleeping or waiting at
- // * the time this method is called will not be executed until the rule is resumed.
- // * <p>
- // * While a rule is suspended, all calls to <code>beginRule</code> and
- // * <code>endRule</code> on a suspended rule will not block the caller.
- // * The rule remains suspended until a subsequent call to
- // * <code>resume(ISchedulingRule)</code> with the identical rule instance.
- // * Further calls to <code>suspend</code> with an identical rule prior to calling
- // * <code>resume</code> are ignored.
- // * </p>
- // * <p>
- // * This method is long-running; progress and cancelation are provided by
- // * the given progress monitor. In the case of cancelation, the rule will
- // * not be suspended.
- // * </p>
- // * Note: this very powerful function should be used with extreme caution.
- // * Suspending rules will prevent jobs in the system from executing, which may
- // * have adverse effects on components that are relying on execution of jobs.
- // * The job manager should never be suspended without intent to resume
- // * execution soon afterwards. Deadlock will result if the thread responsible
- // * for resuming the rule attempts to join a suspended job.
- // *
- // * @deprecated This method is not safe and should not be used.
- // * Suspending a scheduling rule violates the thread safety
- // * of clients that use scheduling rules as a mutual exclusion mechanism,
- // * and can result in concurrency problems in all clients that use the suspended rule.
- // * @param rule The scheduling rule to suspend. Must not be <code>null</code>.
- // * @param monitor a progress monitor, or <code>null</code> if progress
- // * reporting is not desired
- // * @exception OperationCanceledException if the operation is canceled.
- // * Cancelation can occur even if no progress monitor is provided.
- // * @see #resume(ISchedulingRule)
- // */
- /// virtual void Suspend(const ISchedulingRule& rule, const IProgressMonitor& monitor) = 0;
-
- ///**
- // * Requests that all jobs in the given job family be suspended. Jobs currently
- // * waiting to be run will be removed from the queue and moved into the
- // * <code>SLEEPING</code> state. Jobs that have been put to sleep
- // * will remain in that state until either resumed or canceled. This method has
- // * no effect on jobs that are not currently waiting to be run.
- // * <p>
- // * Sleeping jobs can be resumed using <code>wakeUp</code>.
- // *
- // * @param family the job family to sleep, or <code>null</code> to sleep all jobs.
- // * @see Job#belongsTo(Object)
- // */
- /// virtual void Sleep(const Object& family) = 0;
-
- ///**
- // * Transfers ownership of a scheduling rule to another thread. The identical
- // * scheduling rule must currently be owned by the calling thread as a result of
- // * a previous call to <code>beginRule</code>. The destination thread must
- // * not already own a scheduling rule.
- // * <p>
- // * Calling this method is equivalent to atomically calling <code>endRule</code>
- // * in the calling thread followed by an immediate <code>beginRule</code> in
- // * the destination thread. The destination thread is responsible for subsequently
- // * calling <code>endRule</code> when it is finished using the rule.
- // * <p>
- // * This method has no effect when the destination thread is the same as the
- // * calling thread.
- // *
- // * @param rule The scheduling rule to transfer
- // * @param destinationThread The new owner for the transferred rule.
- // * @since 3.1
- // */
- /// virtual void TransferRule(const ISchedulingRule& rule, Poco::Thread* destinationThread) = 0;
-
- ///**
- // * Resumes scheduling of all sleeping jobs in the given family. This method
- // * has no effect on jobs in the family that are not currently sleeping.
- // *
- // * @param family the job family to wake up, or <code>null</code> to wake up all jobs
- // * @see Job#belongsTo(Object)
- // */
- /// virtual void WakeUp(const Object& family) = 0;
-
+ virtual void SetProgressProvider(ProgressProvider::Pointer provider) = 0;
};
}
#endif /* IJOBMANAGER */
diff --git a/Plugins/org.blueberry.core.jobs/src/berryIJobStatus.h b/Plugins/org.blueberry.core.jobs/src/berryIJobStatus.h
index a065d074eb..34fe2a001e 100644
--- a/Plugins/org.blueberry.core.jobs/src/berryIJobStatus.h
+++ b/Plugins/org.blueberry.core.jobs/src/berryIJobStatus.h
@@ -1,42 +1,42 @@
/*============================================================================
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 _BERRYIJOBSTATUS_H
#define _BERRYIJOBSTATUS_H
#include "berryIStatus.h"
#include "berryObject.h"
#include "berryJob.h"
namespace berry {
/**
* Represents status relating to the execution of jobs.
* @see IStatus
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
+ * @note This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be extended by clients.
*/
struct IJobStatus : public virtual IStatus
{
berryObjectMacro(IJobStatus);
/**
* Returns the job associated with this status.
* @return the job associated with this status
*/
virtual Job::Pointer GetJob() = 0;
};
}
#endif /*_BERRYIJOBSTATUS_H */
diff --git a/Plugins/org.blueberry.core.jobs/src/berryILock.h b/Plugins/org.blueberry.core.jobs/src/berryILock.h
index 64e3613029..bdd2d295c6 100644
--- a/Plugins/org.blueberry.core.jobs/src/berryILock.h
+++ b/Plugins/org.blueberry.core.jobs/src/berryILock.h
@@ -1,121 +1,121 @@
/*============================================================================
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 _BERRY_ILOCK_H_
#define _BERRY_ILOCK_H_
#include <berryObject.h>
#include <berryMacros.h>
#include "berryJobExceptions.h"
namespace berry
{
/**
* A lock is used to control access to an exclusive resource.
* <p>
* Locks are reentrant. That is, they can be acquired multiple times by the same thread
* without releasing. Locks are only released when the number of successful acquires
* equals the number of successful releases.
* </p><p>
* Locks are capable of detecting and recovering from programming errors that cause
* circular waiting deadlocks. When a deadlock between two or more <tt>ILock</tt>
* instances is detected, detailed debugging information is printed to the log file. The
* locks will then automatically recover from the deadlock by employing a release
* and wait strategy. One thread will lose control of the locks it owns, thus breaking
* the deadlock and allowing other threads to proceed. Once that thread's locks are
* all available, it will be given exclusive access to all its locks and allowed to proceed.
* A thread can only lose locks while it is waiting on an <tt>acquire()</tt> call.
*
* </p><p>
* Successive acquire attempts by different threads are queued and serviced on
* a first come, first served basis.
* </p><p>
* It is very important that acquired locks eventually get released. Calls to release
* should be done in a finally block to ensure they execute. For example:
* <pre>
* try {
* lock.acquire();
* // ... do work here ...
* } finally {
* lock.release();
* }
* </pre>
* Note: although <tt>lock.acquire</tt> should never fail, it is good practice to place
* it inside the try block anyway. Releasing without acquiring is far less catastrophic
* than acquiring without releasing.
* </p>
*
* @see IJobManager#NewLock()
- * @noimplement This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be implemented by clients.
*/
struct BERRY_JOBS ILock: public Object
{
berryObjectMacro(berry::ILock);
/**
* Attempts to acquire this lock. If the lock is in use and the specified delay is
* greater than zero, the calling thread will block until one of the following happens:
* <ul>
* <li>This lock is available</li>
* <li>The thread is interrupted</li>
* <li>The specified delay has elapsed</li>
* </ul>
* <p>
* While a thread is waiting, locks it already owns may be granted to other threads
* if necessary to break a deadlock. In this situation, the calling thread may be blocked
* for longer than the specified delay. On returning from this call, the calling thread
* will once again have exclusive access to any other locks it owned upon entering
* the acquire method.
*
* @param delay the number of milliseconds to delay
* @return <code>true</code> if the lock was successfully acquired, and
* <code>false</code> otherwise.
* @exception InterruptedException if the thread was interrupted
*/
virtual bool Acquire(long delay) throw (InterruptedException) = 0;
/**
* Acquires this lock. If the lock is in use, the calling thread will block until the lock
* becomes available. If the calling thread owns several locks, it will be blocked
* until all threads it requires become available, or until the thread is interrupted.
* While a thread is waiting, its locks may be granted to other threads if necessary
* to break a deadlock. On returning from this call, the calling thread will
* have exclusive access to this lock, and any other locks it owned upon
* entering the acquire method.
* <p>
* This implementation ignores attempts to interrupt the thread. If response to
* interruption is needed, use the method <code>acquire(long)</code>
*/
virtual void Acquire();
/**
* Returns the number of nested acquires on this lock that have not been released.
* This is the number of times that release() must be called before the lock is
* freed.
*
* @return the number of nested acquires that have not been released
*/
virtual int GetDepth() = 0;
/**
* Releases this lock. Locks must only be released by the thread that currently
* owns the lock.
*/
virtual void Release() = 0;
};
}
#endif // BERRY_ILOCK_H
diff --git a/Plugins/org.blueberry.core.jobs/src/berryIProgressMonitor.h b/Plugins/org.blueberry.core.jobs/src/berryIProgressMonitor.h
index 33761768c4..337835b44b 100644
--- a/Plugins/org.blueberry.core.jobs/src/berryIProgressMonitor.h
+++ b/Plugins/org.blueberry.core.jobs/src/berryIProgressMonitor.h
@@ -1,113 +1,113 @@
/*============================================================================
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 BERRY_IPROGRESS_MONITOR_H
#define BERRY_IPROGRESS_MONITOR_H
#include <org_blueberry_core_jobs_Export.h>
#include "berryObject.h"
#include <string>
namespace berry
{
struct IProgressMonitor: public Object
{
berryObjectMacro(berry::IProgressMonitor);
/** Constant indicating an unknown amount of work. */
static const int UNKNOWN = -1;
/**
* Notifies that the main task is beginning. This must only be called once
* on a given progress monitor instance.
*
* @param name the name (or description) of the main task
* @param totalWork the total number of work units into which
* the main task is been subdivided. If the value is <code>UNKNOWN</code>
* the implementation is free to indicate progress in a way which
* doesn't require the total number of work units in advance.
*/
virtual void BeginTask(const std::string& name, int totalWork) = 0;
/**
* Notifies that the work is done; that is, either the main task is completed
* or the user canceled it. This method may be called more than once
* (implementations should be prepared to handle this case).
*/
virtual void Done() = 0;
/**
* Internal method to handle scaling correctly. This method
* must not be called by a client. Clients should
* always use the method <code>worked(int)</code>.
*
* @param work the amount of work done
*/
virtual void InternalWorked(double work) = 0;
/**
* Returns whether cancellation of current operation has been requested.
* Long-running operations should poll to see if cancellation
* has been requested.
*
* @return <code>true</code> if cancellation has been requested,
* and <code>false</code> otherwise
- * @see #setCanceled(bool)
+ * @see #SetCanceled
*/
virtual bool IsCanceled() = 0;
/**
* Sets the cancel state to the given value.
*
* @param value <code>true</code> indicates that cancellation has
* been requested (but not necessarily acknowledged);
* <code>false</code> clears this flag
- * @see #isCanceled()
+ * @see #IsCanceled
*/
virtual void SetCanceled(bool value) = 0;
/**
* Sets the task name to the given value. This method is used to
* restore the task label after a nested operation was executed.
* Normally there is no need for clients to call this method.
*
* @param name the name (or description) of the main task
- * @see #beginTask
+ * @see #BeginTask
*/
virtual void SetTaskName(const std::string& name) = 0;
/**
* Notifies that a subtask of the main task is beginning.
* Subtasks are optional; the main task might not have subtasks.
*
* @param name the name (or description) of the subtask
*/
virtual void SubTask(const std::string& name) = 0;
/**
* Notifies that a given number of work unit of the main task
* has been completed. Note that this amount represents an
* installment, as opposed to a cumulative amount of work done
* to date.
*
* @param work a non-negative number of work units just completed
*/
virtual void Worked(int work) = 0;
};
}
#endif /* _BERRY_IPROGRESS_MONITOR_H */
diff --git a/Plugins/org.blueberry.core.jobs/src/berryIProgressMonitorWithBlocking.h b/Plugins/org.blueberry.core.jobs/src/berryIProgressMonitorWithBlocking.h
index 44d4a4174c..691af5e1ce 100644
--- a/Plugins/org.blueberry.core.jobs/src/berryIProgressMonitorWithBlocking.h
+++ b/Plugins/org.blueberry.core.jobs/src/berryIProgressMonitorWithBlocking.h
@@ -1,80 +1,80 @@
/*============================================================================
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 _BERRY_IPROGRESSMONITORWITHBLOCKING_H
#define _BERRY_IPROGRESSMONITORWITHBLOCKING_H
#include "berryObject.h"
#include <org_blueberry_core_jobs_Export.h>
#include "berryIStatus.h"
#include "berryIProgressMonitor.h"
namespace berry
{
/**
* An extension to the IProgressMonitor interface for monitors that want to
* support feedback when an activity is blocked due to concurrent activity in
* another thread.
* <p>
* When a monitor that supports this extension is passed to an operation, the
* operation should call <code>setBlocked</code> whenever it knows that it
* must wait for a lock that is currently held by another thread. The operation
* should continue to check for and respond to cancellation requests while
* blocked. When the operation is no longer blocked, it must call <code>clearBlocked</code>
* to clear the blocked state.
* <p>
* This interface can be used without OSGi running.
* </p><p>
* Clients may implement this interface.
* </p>
* @see IProgressMonitor
*/
struct BERRY_JOBS IProgressMonitorWithBlocking: public IProgressMonitor
{
berryObjectMacro(berry::IProgressMonitorWithBlocking);
/**
* Indicates that this operation is blocked by some background activity. If
* a running operation ever calls <code>setBlocked</code>, it must
* eventually call <code>clearBlocked</code> before the operation
* completes.
* <p>
* If the caller is blocked by a currently executing job, this method will return
* an <code>IJobStatus</code> indicating the job that is currently blocking
* the caller. If this blocking job is not known, this method will return a plain
* informational <code>IStatus</code> object.
* </p>
*
* @param reason an optional status object whose message describes the
* reason why this operation is blocked, or <code>null</code> if this
* information is not available.
- * @see #clearBlocked()
+ * @see #ClearBlocked
*/
virtual void SetBlocked(IStatus::Pointer reason)= 0;
/**
* Clears the blocked state of the running operation. If a running
* operation ever calls <code>setBlocked</code>, it must eventually call
* <code>clearBlocked</code> before the operation completes.
*
- * @see #setBlocked(IStatus)
+ * @see #SetBlocked
*/
virtual void ClearBlocked() = 0;
};
}
#endif /* _BERRY_IPROGRESSMONITORWITHBLOCKING_H */
diff --git a/Plugins/org.blueberry.core.jobs/src/berryISchedulingRule.h b/Plugins/org.blueberry.core.jobs/src/berryISchedulingRule.h
index 97cd93d78e..f3c41cd46a 100644
--- a/Plugins/org.blueberry.core.jobs/src/berryISchedulingRule.h
+++ b/Plugins/org.blueberry.core.jobs/src/berryISchedulingRule.h
@@ -1,89 +1,89 @@
/*============================================================================
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 _BERRY_ISCHEDULING_RULE_H_
#define _BERRY_ISCHEDULING_RULE_H_
#include <org_blueberry_core_jobs_Export.h>
#include <berryObject.h>
namespace berry
{
/**
* Scheduling rules are used by jobs to indicate when they need exclusive access
* to a resource.
* @todo
* Scheduling rules can also be applied synchronously to a thread
* using <tt>IJobManager.beginRule(ISchedulingRule)</tt> and
* <tt>IJobManager.endRule(ISchedulingRule)</tt>.
*
* The job manager guarantees that
* no two jobs with conflicting scheduling rules will run concurrently.
* @todo
* Multiple rules can be applied to a given thread only if the outer rule explicitly
* allows the nesting as specified by the <code>contains</code> method.
*
* <p>
* Clients may implement this interface.
*
* @see Job#GetRule()
* @see Job#SetRule(ISchedulingRule)
* @see Job#Schedule(long)
* @see IJobManager#BeginRule(ISchedulingRule, org.eclipse.core.runtime.IProgressMonitor)
* @see IJobManager#EndRule(ISchedulingRule)
*/
struct BERRY_JOBS ISchedulingRule: public Object
{
berryObjectMacro(berry::ISchedulingRule);
/**
* Returns whether this scheduling rule completely contains another scheduling
* rule. Rules can only be nested within a thread if the inner rule is completely
* contained within the outer rule.
* <p>
* Implementations of this method must obey the rules of a partial order relation
* on the set of all scheduling rules. In particular, implementations must be reflexive
* (a.contains(a) is always true), antisymmetric (a.contains(b) and b.contains(a) iff
* equals(b),
* and transitive (if a.contains(b) and b.contains(c), then a.contains(c)). Implementations
* of this method must return <code>false</code> when compared to a rule they
* know nothing about.
*
* @param rule the rule to check for containment
* @return <code>true</code> if this rule contains the given rule, and
* <code>false</code> otherwise.
*/
virtual bool Contains(ISchedulingRule::Pointer rule) const = 0;
/**
* Returns whether this scheduling rule is compatible with another scheduling rule.
* If <code>true</code> is returned, then no job with this rule will be run at the
* same time as a job with the conflicting rule. If <code>false</code> is returned,
* then the job manager is free to run jobs with these rules at the same time.
* <p>
* Implementations of this method must be reflexive, symmetric, and consistent,
* and must return <code>false</code> when compared to a rule they know
* nothing about.
*
- * @param rule the rule to check for conflicts
+ * @param myRule the rule to check for conflicts
* @return <code>true</code> if the rule is conflicting, and <code>false</code>
* otherwise.
*/
virtual bool IsConflicting(ISchedulingRule::Pointer myRule) const = 0;
};
}
#endif // _BERRY_ISCHEDULING_RULE_H_
diff --git a/Plugins/org.blueberry.core.jobs/src/berryJob.h b/Plugins/org.blueberry.core.jobs/src/berryJob.h
index 62e2305e0a..b1944e391f 100644
--- a/Plugins/org.blueberry.core.jobs/src/berryJob.h
+++ b/Plugins/org.blueberry.core.jobs/src/berryJob.h
@@ -1,635 +1,565 @@
/*============================================================================
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 _BERRY_JOB_H
#define _BERRY_JOB_H
#include <Poco/Thread.h>
#include <org_blueberry_core_jobs_Export.h>
-// #include "berryISchedulingRule.h"
#include "berryJobExceptions.h"
#include "internal/berryInternalJob.h"
#include <berryObject.h>
#include <string>
namespace berry
{
struct IJobManager;
/**
* Jobs are units of runnable work that can be scheduled to be run with the job
* manager. Once a job has completed, it can be scheduled to run again (jobs are
* reusable).
* <p>
* Jobs have a state that indicates what they are currently doing. When constructed,
* jobs start with a state value of <code>NONE</code>. When a job is scheduled
* to be run, it moves into the <code>WAITING</code> state. When a job starts
* running, it moves into the <code>RUNNING</code> state. When execution finishes
* (either normally or through cancellation), the state changes back to
* <code>NONE</code>.
* </p><p>
* A job can also be in the <code>SLEEPING</code> state. This happens if a user
* calls Job.sleep() on a waiting job, or if a job is scheduled to run after a specified
* delay. Only jobs in the <code>WAITING</code> state can be put to sleep.
* Sleeping jobs can be woken at any time using Job.wakeUp(), which will put the
* job back into the <code>WAITING</code> state.
* </p><p>
* Jobs can be assigned a priority that is used as a hint about how the job should
* be scheduled. There is no guarantee that jobs of one priority will be run before
* all jobs of lower priority. The documentation of the various priority constants provide
* more detail about what each priority means. By default, jobs start in the
* <code>LONG</code> priority class.
*
* @see IJobManager
*
*/
-//TODO struct Job: public InternalJob, public IAdaptable
class BERRY_JOBS Job: public InternalJob
{
public:
berryObjectMacro(Job);
/**
* Job status return value that is used to indicate asynchronous job completion.
* @see Job#Run(IProgressMonitor::Pointer)
* @see Job#Done(IStatus::Pointer)
*/
static const IStatus::Pointer ASYNC_FINISH ;
/* Job priorities */
/**
* Job priority constant (value 10) for interactive jobs.
* Interactive jobs generally have priority over all other jobs.
* Interactive jobs should be either fast running or very low on CPU
* usage to avoid blocking other interactive jobs from running.
*
* @see #GetPriority()
* @see #SetPriority(int)
* @see #Run(IProgressMonitor::Pointer)
*/
static const int INTERACTIVE = 10;
/**
* Job priority constant (value 20) for short background jobs.
* Short background jobs are jobs that typically complete within a second,
* but may take longer in some cases. Short jobs are given priority
* over all other jobs except interactive jobs.
*
* @see #GetPriority()
* @see #SetPriority(int)
* @see #Run(IProgressMonitor::Pointer)
*/
static const int SHORT = 20;
/**
* Job priority constant (value 30) for long-running background jobs.
*
* @see #GetPriority()
* @see #SetPriority(int)
* @see #Run(IProgressMonitor::Pointer)
*/
static const int LONG = 30;
/**
* Job priority constant (value 40) for build jobs. Build jobs are
* generally run after all other background jobs complete.
*
* @see #GetPriority()
* @see #SetPriority(int)
- * @see #Run(IProgressMonitor)
*/
static const int BUILD = 40;
/**
* Job priority constant (value 50) for decoration jobs.
* Decoration jobs have lowest priority. Decoration jobs generally
* compute extra information that the user may be interested in seeing
* but is generally not waiting for.
*
* @see #GetPriority()
* @see #SetPriority(int)
- * @see #Run(IProgressMonitor)
*/
static const int DECORATE = 50;
/**
* Job state code (value 0) indicating that a job is not
* currently sleeping, waiting, or running (i.e., the job manager doesn't know
* anything about the job).
*
* @see #GetState()
*/
static const int NONE = 0;
/**
* Job state code (value 1) indicating that a job is sleeping.
*
- * @see #Run(IProgressMonitor)
* @see #GetState()
*/
static const int SLEEPING = 0x01;
/**
* Job state code (value 2) indicating that a job is waiting to be run.
*
* @see #GetState()
*/
static const int WAITING = 0x02;
/**
* Job state code (value 4) indicating that a job is currently running
*
* @see #GetState()
*/
static const int RUNNING = 0x04;
/**
* Returns the job manager.
*
* @return the job manager
*/
static const IJobManager* GetJobManager();
/**
* Creates a new job with the specified name. The job name is a human-readable
* value that is displayed to users. The name does not need to be unique, but it
* must not be <code>null</code>.
*
* @param name the name of the job.
*/
Job(const QString& name);
/**
* Registers a job listener with this job
* Has no effect if an identical listener is already registered.
*
* @param listener the listener to be added.
*/
void AddJobChangeListener(IJobChangeListener* listener);
/**
* Returns whether this job belongs to the given family. Job families are
* represented as objects that are not interpreted or specified in any way
* by the job manager. Thus, a job can choose to belong to any number of
* families.
* <p>
* Clients may override this method. This default implementation always returns
* <code>false</code>. Overriding implementations must return <code>false</code>
* for families they do not recognize.
* </p>
*
* @param family the job family identifier
* @return <code>true</code> if this job belongs to the given family, and
* <code>false</code> otherwise.
*/
bool BelongsTo(Object::Pointer family) override;
/**
* Stops the job. If the job is currently waiting,
* it will be removed from the queue. If the job is sleeping,
* it will be discarded without having a chance to resume and its sleeping state
* will be cleared. If the job is currently executing, it will be asked to
* stop but there is no guarantee that it will do so.
*
* @return <code>false</code> if the job is currently running (and thus may not
* respond to cancellation), and <code>true</code> in all other cases.
*/
bool Cancel();
/**
* Jobs that complete their execution asynchronously must indicate when they
* are finished by calling this method. This method must not be called by
* a job that has not indicated that it is executing asynchronously.
* <p>
* This method must not be called from within the scope of a job's <code>run</code>
* method. Jobs should normally indicate completion by returning an appropriate
* status from the <code>run</code> method. Jobs that return a status of
* <code>ASYNC_FINISH</code> from their run method must later call
* <code>done</code> to indicate completion.
*
* @param result a status object indicating the result of the job's execution.
* @see #ASYNC_FINISH
* @see #Run(IProgressMonitor::Pointer)
*/
void Done(IStatus::Pointer result);
/**
* Returns the human readable name of this job. The name is never
* <code>null</code>.
*
* @return the name of this job
*/
QString GetName() const;
/**
* Returns the priority of this job. The priority is used as a hint when the job
* is scheduled to be run.
*
* @return the priority of the job. One of INTERACTIVE, SHORT, LONG, BUILD,
* or DECORATE.
*/
int GetPriority() const;
- /**
- * Returns the value of the property of this job identified by the given key,
- * or <code>null</code> if this job has no such property.
- *
- * @param key the name of the property
- * @return the value of the property,
- * or <code>null</code> if this job has no such property
- * @see #SetProperty(QualifiedName, Object)
- */
- //TODO QualifiedName GetPropertys
- ///Object GetProperty(QualifiedName key) const ;
-
/**
* Returns the result of this job's last run.
*
* @return the result of this job's last run, or <code>null</code> if this
* job has never finished running.
*/
IStatus::Pointer GetResult() const ;
/**
* Returns the scheduling rule for this job. Returns <code>null</code> if this job has no
* scheduling rule.
*
* @return the scheduling rule for this job, or <code>null</code>.
* @see ISchedulingRule
* @see #SetRule(ISchedulingRule::Pointer)
*/
ISchedulingRule::Pointer GetRule() const;
/**
* Returns the state of the job. Result will be one of:
* <ul>
* <li><code>Job.RUNNING</code> - if the job is currently running.</li>
* <li><code>Job.WAITING</code> - if the job is waiting to be run.</li>
* <li><code>Job.SLEEPING</code> - if the job is sleeping.</li>
* <li><code>Job.NONE</code> - in all other cases.</li>
* </ul>
* <p>
* Note that job state is inherently volatile, and in most cases clients
* cannot rely on the result of this method being valid by the time the
* result is obtained. For example, if <tt>getState</tt> returns
* <tt>RUNNING</tt>, the job may have actually completed by the
* time the <tt>getState</tt> method returns. All clients can infer from
* invoking this method is that the job was recently in the returned state.
*
* @return the job state
*/
int GetState() const;
/**
* Returns the thread that this job is currently running in.
*
* @return the thread this job is running in, or <code>null</code>
* if this job is not running or the thread is unknown.
*/
Poco::Thread* GetThread() const;
/**
* Returns whether this job is blocking a higher priority non-system job from
* starting due to a conflicting scheduling rule. Returns <code>false</code>
* if this job is not running, or is not blocking a higher priority non-system job.
*
* @return <code>true</code> if this job is blocking a higher priority non-system
* job, and <code>false</code> otherwise.
* @see #GetRule()
* @see #IsSystem()
*/
bool IsBlocking();
/**
* Returns whether this job is a system job. System jobs are typically not
* revealed to users in any UI presentation of jobs. Other than their UI presentation,
* system jobs act exactly like other jobs. If this value is not explicitly set, jobs
* are treated as non-system jobs. The default value is <code>false</code>.
*
* @return <code>true</code> if this job is a system job, and
* <code>false</code> otherwise.
* @see #SetSystem(bool)
*/
bool IsSystem() const;
/**
* Returns whether this job has been directly initiated by a UI end user.
* These jobs may be presented differently in the UI. The default value
* is <code>false</code>.
*
* @return <code>true</code> if this job is a user-initiated job, and
* <code>false</code> otherwise.
* @see #SetUser(bool)
*/
bool IsUser() const;
- /**
- * Waits until this job is finished. This method will block the calling thread until the
- * job has finished executing, or until this thread has been interrupted. If the job
- * has not been scheduled, this method returns immediately. A job must not
- * be joined from within the scope of its run method.
- * <p>
- * If this method is called on a job that reschedules itself from within the
- * <tt>run</tt> method, the join will return at the end of the first execution.
- * In other words, join will return the first time this job exits the
- * {@link #RUNNING} state, or as soon as this job enters the {@link #NONE} state.
- * </p>
- * <p>
- * If this method is called while the job manager is suspended, this job
- * will only be joined if it is already running; if this job is waiting or sleeping,
- * this method returns immediately.
- * </p>
- * <p>
- * Note that there is a deadlock risk when using join. If the calling thread owns
- * a lock or object monitor that the joined thread is waiting for, deadlock
- * will occur.
- * </p>
- *
- * @exception InterruptedException if this thread is interrupted while waiting
- * @see ILock
- * @see IJobManager#Suspend()
- */
- //TODO Error Join Problem InterruptedException
- /// void Join() ;
-
/**
* Removes a job listener from this job.
* Has no effect if an identical listener is not already registered.
*
* @param listener the listener to be removed
*/
void RemoveJobChangeListener(IJobChangeListener* listener);
/**
* Schedules this job to be run. The job is added to a queue of waiting
* jobs, and will be run when it arrives at the beginning of the queue.
* <p>
* This is a convenience method, fully equivalent to
* <code>Schedule(0L)</code>.
* </p>
- * @see #Schedule(long)
*/
void Schedule();
/**
* Schedules this job to be run after a specified delay. The job is put in the
* {@link #SLEEPING} state until the specified delay has elapsed, after which
* the job is added to a queue of {@link #WAITING} jobs. Once the job arrives
* at the beginning of the queue, it will be run at the first available opportunity.
* </p><p>
* Jobs of equal priority and <code>delay</code> with conflicting scheduling
* rules are guaranteed to run in the order they are scheduled. No guarantees
* are made about the relative execution order of jobs with unrelated or
* <code>null</code> scheduling rules, or different priorities.
* <p>
* If this job is currently running, it will be rescheduled with the specified
* delay as soon as it finishes. If this method is called multiple times
* while the job is running, the job will still only be rescheduled once,
* with the most recent delay value that was provided.
* </p><p>
* Scheduling a job that is waiting or sleeping has no effect.
* </p>
*
* @param delay a time delay in milliseconds before the job should run
* @see ISchedulingRule
*/
void Schedule(Poco::Timestamp::TimeDiff delay);
/**
* Changes the name of this job. If the job is currently running, waiting,
* or sleeping, the new job name may not take effect until the next time the
* job is scheduled.
* <p>
* The job name is a human-readable value that is displayed to users. The name
* does not need to be unique, but it must not be <code>null</code>.
*
* @param name the name of the job.
*/
void SetName(const QString& name);
/**
* Sets the priority of the job. This will not affect the execution of
* a running job, but it will affect how the job is scheduled while
* it is waiting to be run.
*
* @param priority the new job priority. One of
* INTERACTIVE, SHORT, LONG, BUILD, or DECORATE.
*/
void SetPriority(int priority);
/**
* Associates this job with a progress group. Progress feedback
* on this job's next execution will be displayed together with other
* jobs in that group. The provided monitor must be a monitor
* created by the method <tt>IJobManager.createProgressGroup</tt>
* and must have at least <code>ticks</code> units of available work.
* <p>
* The progress group must be set before the job is scheduled.
* The group will be used only for a single invocation of the job's
* <tt>run</tt> method, after which any association of this job to the
* group will be lost.
*
* @see IJobManager#createProgressGroup()
* @param group The progress group to use for this job
* @param ticks the number of work ticks allocated from the
* parent monitor, or {@link IProgressMonitor#UNKNOWN}
*/
void SetProgressGroup(IProgressMonitor::Pointer group, int ticks);
- /**
- * Sets the value of the property of this job identified
- * by the given key. If the supplied value is <code>null</code>,
- * the property is removed from this resource.
- * <p>
- * Properties are intended to be used as a caching mechanism
- * by ISV plug-ins. They allow key-object associations to be stored with
- * a job instance. These key-value associations are maintained in
- * memory (at all times), and the information is never discarded automatically.
- * </p><p>
- * The qualifier part of the property name must be the unique identifier
- * of the declaring plug-in (e.g. <code>"com.example.plugin"</code>).
- * </p>
- *
- * @param key the qualified name of the property
- * @param value the value of the property,
- * or <code>null</code> if the property is to be removed
- * @see #GetProperty(QualifiedName)
- */
- //TODO QualifiedName SetProperty
- /// void SetProperty(QualifiedName key, Object value);
-
/**
* Sets the scheduling rule to be used when scheduling this job. This method
* must be called before the job is scheduled.
*
* @param rule the new scheduling rule, or <code>null</code> if the job
* should have no scheduling rule
* @see #GetRule()
*/
void SetRule(ISchedulingRule::Pointer rule);
/**
* Sets whether or not this job is a system job. System jobs are typically not
* revealed to users in any UI presentation of jobs. Other than their UI presentation,
* system jobs act exactly like other jobs. If this value is not explicitly set, jobs
* are treated as non-system jobs. This method must be called before the job
* is scheduled.
*
* @param value <code>true</code> if this job should be a system job, and
* <code>false</code> otherwise.
* @see #IsSystem()
*/
void SetSystem(bool value);
/**
* Sets whether or not this job has been directly initiated by a UI end user.
* These jobs may be presented differently in the UI. This method must be
* called before the job is scheduled.
*
* @param value <code>true</code> if this job is a user-initiated job, and
* <code>false</code> otherwise.
* @see #IsUser()
*/
void SetUser(bool value);
/**
* Sets the thread that this job is currently running in, or <code>null</code>
* if this job is not running or the thread is unknown.
* <p>
* Jobs that use the {@link #ASYNC_FINISH} return code should tell
* the job what thread it is running in. This is used to prevent deadlocks.
*
* @param thread the thread that this job is running in.
*
* @see #ASYNC_FINISH
* @see #Run(IProgressMonitor::Pointer)
*/
void SetThread(Poco::Thread* thread);
/**
* Returns whether this job should be run.
* If <code>false</code> is returned, this job will be discarded by the job manager
* without running.
* <p>
* This method is called immediately prior to calling the job's
* run method, so it can be used for last minute pre-condition checking before
* a job is run. This method must not attempt to schedule or change the
* state of any other job.
* </p><p>
* Clients may override this method. This default implementation always returns
* <code>true</code>.
* </p>
*
* @return <code>true</code> if this job should be run
* and <code>false</code> otherwise
*/
virtual bool ShouldRun();
/**
* Returns whether this job should be scheduled.
* If <code>false</code> is returned, this job will be discarded by the job manager
* without being added to the queue.
* <p>
* This method is called immediately prior to adding the job to the waiting job
* queue.,so it can be used for last minute pre-condition checking before
* a job is scheduled.
* </p><p>
* Clients may override this method. This default implementation always returns
* <code>true</code>.
* </p>
*
* @return <code>true</code> if the job manager should schedule this job
* and <code>false</code> otherwise
*/
bool ShouldSchedule() override;
/**
* Requests that this job be suspended. If the job is currently waiting to be run, it
* will be removed from the queue move into the {@link #SLEEPING} state.
* The job will remain asleep until either resumed or canceled. If this job is not
* currently waiting to be run, this method has no effect.
* <p>
* Sleeping jobs can be resumed using <code>wakeUp</code>.
*
* @return <code>false</code> if the job is currently running (and thus cannot
* be put to sleep), and <code>true</code> in all other cases
* @see #WakeUp()
*/
bool Sleep();
/**
* Puts this job immediately into the {@link #WAITING} state so that it is
* eligible for immediate execution. If this job is not currently sleeping,
* the request is ignored.
* <p>
* This is a convenience method, fully equivalent to
* <code>wakeUp(0L)</code>.
* </p>
* @see #Sleep()
*/
void WakeUp();
/**
* Puts this job back into the {@link #WAITING} state after
* the specified delay. This is equivalent to canceling the sleeping job and
* rescheduling with the given delay. If this job is not currently sleeping,
* the request is ignored.
*
* @param delay the number of milliseconds to delay
* @see #Sleep()
*/
void WakeUp(long delay);
protected:
/**
- * A hook method indicating that this job is running and {@link #cancel()}
+ * A hook method indicating that this job is running and {@link #Cancel()}
* is being called for the first time.
* <p>
* Subclasses may override this method to perform additional work when
* a cancellation request is made. This default implementation does nothing.
*/
void Canceling() override;
/**
* Executes this job. Returns the result of the execution.
* <p>
* The provided monitor can be used to report progress and respond to
* cancellation. If the progress monitor has been canceled, the job
* should finish its execution at the earliest convenience and return a result
- * status of severity {@link IStatus#CANCEL}. The singleton
+ * status of severity \c IStatus.CANCEL . The singleton
* cancel status {@link Status#CANCEL_STATUS} can be used for
* this purpose. The monitor is only valid for the duration of the invocation
* of this method.
* <p>
* This method must not be called directly by clients. Clients should call
* <code>schedule</code>, which will in turn cause this method to be called.
* <p>
* Jobs can optionally finish their execution asynchronously (in another thread) by
* returning a result status of {@link #ASYNC_FINISH}. Jobs that finish
* asynchronously <b>must</b> specify the execution thread by calling
* <code>setThread</code>, and must indicate when they are finished by calling
* the method <code>done</code>.
*
- * @param monitor the monitor to be used for reporting progress and
+ * @param myProgressMonitor the monitor to be used for reporting progress and
* responding to cancellation. The monitor is never <code>null</code>
* @return resulting status of the run. The result must not be <code>null</code>
* @see #ASYNC_FINISH
- * @see #Done(IStatus)
*/
IStatus::Pointer Run(IProgressMonitor::Pointer myProgressMonitor) override = 0;
};
}
#endif /* BERRY_JOB_H */
diff --git a/Plugins/org.blueberry.core.jobs/src/berryJobStatus.h b/Plugins/org.blueberry.core.jobs/src/berryJobStatus.h
index 3453952d7c..dd1ee6a9d1 100644
--- a/Plugins/org.blueberry.core.jobs/src/berryJobStatus.h
+++ b/Plugins/org.blueberry.core.jobs/src/berryJobStatus.h
@@ -1,52 +1,53 @@
/*============================================================================
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 _BERRYJOBSTATUS_H
#define _BERRYJOBSTATUS_H
#include "berryIJobStatus.h"
#include "berryStatus.h"
#include "berryJob.h"
namespace berry {
class BERRY_JOBS JobStatus : public Status, public IJobStatus
{
public:
berryObjectMacro(JobStatus);
/**
* Creates a new job status with no interesting error code or exception.
* @param severity
- * @param job
+ * @param sptr_job
* @param message
+ * @param sl
*/
JobStatus(const Severity& severity, Job::Pointer sptr_job, const QString& message,
const Status::SourceLocation& sl);
/**
* @see IJobStatus#GetJob()
*/
Job::Pointer GetJob() override;
private:
Job::Pointer m_myJob;
};
}
#endif /* _BERRYJOBSTATUS_H */
diff --git a/Plugins/org.blueberry.core.jobs/src/berryProgressProvider.h b/Plugins/org.blueberry.core.jobs/src/berryProgressProvider.h
index fd98493645..47a74ff532 100644
--- a/Plugins/org.blueberry.core.jobs/src/berryProgressProvider.h
+++ b/Plugins/org.blueberry.core.jobs/src/berryProgressProvider.h
@@ -1,109 +1,109 @@
/*============================================================================
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 _BERRY_PROGRESSPROVIDER_H
#define _BERRY_PROGRESSPROVIDER_H
#include "berryIProgressMonitor.h"
#include "berryObject.h"
#include "berryJob.h"
namespace berry
{
/**
* The progress provider supplies the job manager with progress monitors for
* running jobs. There can only be one progress provider at any given time.
* <p>
* This class is intended for use by the currently executing Eclipse application.
* Plug-ins outside the currently running application should not reference or
* subclass this class.
* </p>
*
* @see IJobManager#SetProgressProvider(ProgressProvider::Pointer)
*/
struct ProgressProvider: public Object
{
public:
berryObjectMacro(ProgressProvider);
/**
* Provides a new progress monitor instance to be used by the given job.
* This method is called prior to running any job that does not belong to a
* progress group. The returned monitor will be supplied to the job's
* <code>Run</code> method.
*
* @see #CreateProgressGroup()
* @see Job#SetProgressGroup(IProgressMonitor::Pointer, int)
* @param job the job to create a progress monitor for
* @return a progress monitor, or <code>null</code> if no progress monitoring
* is needed.
*/
virtual IProgressMonitor::Pointer CreateMonitor(Job::Pointer job) = 0;
/**
* Returns a progress monitor that can be used to provide
* aggregated progress feedback on a set of running jobs.
* This method implements <code>IJobManager.createProgressGroup</code>,
* and must obey all rules specified in that contract.
* <p>
* This default implementation returns a new
* <code>NullProgressMonitor</code> Subclasses may override.
*
* @see IJobManager#CreateProgressGroup()
* @return a progress monitor
*/
virtual IProgressMonitor::Pointer CreateProgressGroup();
/**
* Returns a progress monitor that can be used by a running job
* to report progress in the context of a progress group. This method
* implements <code>Job.setProgressGroup</code>. One of the
* two <code>createMonitor</code> methods will be invoked
* prior to each execution of a job, depending on whether a progress
* group was specified for the job.
* <p>
* The provided monitor must be a monitor returned by the method
* <code>createProgressGroup</code>. This method is responsible
* for asserting this and throwing an appropriate runtime exception
* if an invalid monitor is provided.
* <p>
* This default implementation returns a new
* <code>SubProgressMonitor</code>. Subclasses may override.
*
* @see IJobManager#CreateProgressGroup()
* @see Job#setProgressGroup(IProgressMonitor, int)
- * @param job the job to create a progress monitor for
- * @param group the progress monitor group that this job belongs to
+ * @param sptr_job the job to create a progress monitor for
+ * @param sptr_group the progress monitor group that this job belongs to
* @param ticks the number of ticks of work for the progress monitor
* @return a progress monitor, or <code>null</code> if no progress monitoring
* is needed.
*/
virtual IProgressMonitor::Pointer CreateMonitor(Job::Pointer sptr_job,
IProgressMonitor::Pointer sptr_group, int ticks);
/**
* Returns a progress monitor to use when none has been provided
* by the client running the job.
* <p>
* This default implementation returns a new
* <code>NullProgressMonitor</code> Subclasses may override.
*
* @return a progress monitor
*/
virtual IProgressMonitor::Pointer GetDefaultMonitor();
};
}
#endif /* BERRY_PROGRESSPROVIDER_H */
diff --git a/Plugins/org.blueberry.core.jobs/src/berryQualifiedName.h b/Plugins/org.blueberry.core.jobs/src/berryQualifiedName.h
index b37029f333..ddf7339d0c 100644
--- a/Plugins/org.blueberry.core.jobs/src/berryQualifiedName.h
+++ b/Plugins/org.blueberry.core.jobs/src/berryQualifiedName.h
@@ -1,108 +1,107 @@
/*============================================================================
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 _BERRY_QUALIFIED_NAME_
#define _BERRY_QUALIFIED_NAME_
#include <string>
#include "berryObject.h"
#include <org_blueberry_core_jobs_Export.h>
namespace berry
{
/**
* Qualified names are two-part names: qualifier and local name.
* The qualifier must be in URI form (see RFC2396).
* Note however that the qualifier may be <code>null</code> if
* the default name space is being used. The empty string is not
* a valid local name.
* <p>
* This class can be used without OSGi running.
* </p><p>
* This class is not intended to be subclassed by clients.
* </p>
- * @noextend This class is not intended to be subclassed by clients.ds
*/
struct BERRY_JOBS QualifiedName
{
/** Qualifier part (potentially <code>null</code>). */
/*package*/
std::string qualifier;
/** Local name part. */
/*package*/
std::string localName;
/**
* Creates and returns a new qualified name with the given qualifier
* and local name. The local name must not be the empty string.
* The qualifier may be <code>null</code>.
* <p>
* Clients may instantiate.
* </p>
* @param qualifier the qualifier string, or <code>null</code>
* @param localName the local name string
*/
QualifiedName(std::string qualifier, std::string localName);
/**
* Returns whether this qualified name is equivalent to the given object.
* <p>
* Qualified names are equal if and only if they have the same
* qualified parts and local parts.
* Qualified names are not equal to objects other than qualified names.
* </p>
*
- * @param obj the object to compare to
+ * @param qName the object to compare to
* @return <code>true</code> if these are equivalent qualified
* names, and <code>false</code> otherwise
*/
bool operator==(const QualifiedName& qName) const;
bool operator<(const QualifiedName& qName) const;
/**
* Returns the local part of this name.
*
* @return the local name string
*/
std::string GetLocalName() const;
/**
* Returns the qualifier part for this qualified name, or <code>null</code>
* if none.
*
* @return the qualifier string, or <code>null</code>
*/
std::string GetQualifier() const;
/*
* Implements the method <code>Object.hashCode</code>.
*
* Returns the hash code for this qualified name.
*/
std::size_t HashCode() const;
/**
* Converts this qualified name into a string, suitable for
* debug purposes only.
*/
std::string ToString();
};
}
#endif // _BERRY_QUALIFIED_NAME_
diff --git a/Plugins/org.blueberry.core.runtime/schema/applications.exsd b/Plugins/org.blueberry.core.runtime/schema/applications.exsd
index 48350bda0e..391416228d 100644
--- a/Plugins/org.blueberry.core.runtime/schema/applications.exsd
+++ b/Plugins/org.blueberry.core.runtime/schema/applications.exsd
@@ -1,113 +1,74 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.osgi" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
+ <annotation>
<appinfo>
<meta.schema plugin="org.blueberry.osgi" id="applications" name="Applications"/>
</appinfo>
- <documentation>
- The applications extension point allows plugins to contribute applications to the BlueBerry Platform.
- </documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence minOccurs="1" maxOccurs="unbounded">
<element ref="application"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
-
- </documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
-
- </documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
-
- </documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="application">
<complexType>
<sequence>
<element ref="run"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
-
- </documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
-
- </documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="run">
<complexType>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
-
- </documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
- <documentation>
- Following is an example of an application declaration.
-&lt;p&gt;
- &lt;pre&gt;
- &lt;extension id=&quot;sampleApplication&quot; point=&quot;org.blueberry.osgi.applications&quot;&gt;
- &lt;application id=&quot;my.domain.application&quot;&gt;
- &lt;run class=&quot;xyz::SampleApp&quot;/&gt;
- &lt;/application&gt;
- &lt;/extension&gt;
- &lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiInfo"/>
</appinfo>
- <documentation>
- Application classes must subclass &lt;code&gt;berry::IApplication&lt;/code&gt;.
- </documentation>
</annotation>
-
-
-
</schema>
diff --git a/Plugins/org.blueberry.core.runtime/schema/products.exsd b/Plugins/org.blueberry.core.runtime/schema/products.exsd
index 39956abccc..cb173e229f 100644
--- a/Plugins/org.blueberry.core.runtime/schema/products.exsd
+++ b/Plugins/org.blueberry.core.runtime/schema/products.exsd
@@ -1,213 +1,128 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.core.runtime">
-<annotation>
+ <annotation>
<appInfo>
<meta.schema plugin="org.blueberry.core.runtime" id="products" name="Products"/>
</appInfo>
- <documentation>
- Products are the BlueBerry unit of branding. Product extensions are supplied by plug-ins wishing to define one or more products. There must be one product per extension as the extension id is used in processing and identifying the product.
-&lt;p&gt;
-There are two possible forms of product extension, static and dynamic. Static product extensions directly contain all relevant information about the product. Dynamic product extensions identify a class (an &lt;code&gt;IProductProvider&lt;/code&gt;) which is capable of defining one or more products when queried.
- </documentation>
</annotation>
<element name="extension">
<complexType>
<sequence>
<choice>
<element ref="product"/>
<element ref="provider"/>
</choice>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
-
- </documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
-
- </documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
-
- </documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="product">
<complexType>
<sequence>
<element ref="property" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="application" type="string" use="required">
<annotation>
- <documentation>
- the default application to run when running this product
- </documentation>
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- the human-readable name of this product
- </documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
<attribute name="description" type="string">
<annotation>
- <documentation>
- the human-readable description of this product
- </documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="property">
<annotation>
<appInfo>
<meta.element labelAttribute="name"/>
</appInfo>
</annotation>
<complexType>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- the key under which this property is stored
- </documentation>
</annotation>
</attribute>
<attribute name="value" type="string" use="required">
<annotation>
- <documentation>
- the value of this property
- </documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="provider">
<annotation>
- <documentation>
- details of a product provider
- </documentation>
</annotation>
<complexType>
<sequence>
<element ref="run"/>
</sequence>
</complexType>
</element>
<element name="run">
<complexType>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- the fully-qualified name of a class which implements
-&lt;samp&gt;berry::IProductProvider&lt;/samp&gt;.
- </documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
- <documentation>
- next_release
- </documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
- <documentation>
- Following is an example of static product declaration:
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension id=&quot;coolProduct&quot; point=&quot;org.blueberry.core.runtime.products&quot;&gt;
- &lt;product name=&quot;%coolName&quot; application=&quot;coolApplication&quot; description=&quot;%coolDescription&quot;&gt;
- &lt;property name=&quot;windowImages&quot; value=&quot;window.gif&quot;/&gt;
- &lt;property name=&quot;aboutImage&quot; value=&quot;image.gif&quot;/&gt;
- &lt;property name=&quot;aboutText&quot; value=&quot;%aboutText&quot;/&gt;
- &lt;property name=&quot;appName&quot; value=&quot;CoolApp&quot;/&gt;
- &lt;property name=&quot;welcomePage&quot; value=&quot;$nl$/welcome.xml&quot;/&gt;
- &lt;property name=&quot;preferenceCustomization&quot; value=&quot;plugin_customization.ini&quot;/&gt;
- &lt;/product&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
-
-The following is an example of a dynamic product (product provider) declaration:
-Following is an example of an application declaration:
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension id=&quot;coolProvider&quot; point=&quot;org.blueberry.core.runtime.products&quot;&gt;
- &lt;provider&gt;
- &lt;run class=&quot;me::CoolProvider&quot;/&gt;
- &lt;/provider&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
- <documentation>
- Static product extensions provided here are represented at runtime by instances of &lt;code&gt;IProduct&lt;/code&gt;. Dynamic product extensions must identify an implementor of &lt;code&gt;IProductProvider&lt;/code&gt;. See &lt;code&gt;IProductConstants&lt;/code&gt;
-for details of the branding related product properties defined by the Eclipse UI.
- </documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
- <documentation>
- No implementations of &lt;code&gt;IProductProvider&lt;/code&gt; are supplied.
- </documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
- <documentation>
- Copyright (c) 2004, 2005 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which
-accompanies
-this distribution, and is available at
-&lt;a
-href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
</annotation>
-
</schema>
diff --git a/Plugins/org.blueberry.core.runtime/src/application/berryIApplication.h b/Plugins/org.blueberry.core.runtime/src/application/berryIApplication.h
index 35918795aa..ef409c007e 100644
--- a/Plugins/org.blueberry.core.runtime/src/application/berryIApplication.h
+++ b/Plugins/org.blueberry.core.runtime/src/application/berryIApplication.h
@@ -1,96 +1,96 @@
/*============================================================================
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 BERRYIAPPLICATION_H_
#define BERRYIAPPLICATION_H_
#include <org_blueberry_core_runtime_Export.h>
#include <QObject>
namespace berry {
struct IApplicationContext;
/**
* Bootstrap type for an application. An IApplication represent executable
* entry points into an application. An IApplication can be configured into
* the Platform's <code>org.blueberry.osgi.applications</code> extension-point.
*
* <p>
* Clients may implement this interface.
* </p>
*/
struct org_blueberry_core_runtime_EXPORT IApplication
{
/**
* Exit object indicating normal termination
*/
static const int EXIT_OK;
/**
* Exit object requesting platform restart
*/
static const int EXIT_RESTART;
/**
* Exit object requesting that the command passed back be executed. Typically
* this is used to relaunch BlueBerry with different command line arguments. When the executable is
* relaunched the command line will be retrieved from the <code>BlueBerry.exitdata</code> system property.
*/
static const int EXIT_RELAUNCH;
virtual ~IApplication();
/**
* Starts this application with the given context and returns a result. This
* method must not exit until the application is finished and is ready to exit.
* The content of the context is unchecked and should conform to the expectations of
* the application being invoked.<p>
*
* Applications can return any object they like. If an <code>Integer</code> is returned
* it is treated as the program exit code if BlueBerry is exiting.
* <p>
* Note: This method is called by the platform; it is not intended
* to be called directly by clients.
* </p>
* @return the return value of the application
* @see #EXIT_OK
* @see #EXIT_RESTART
* @see #EXIT_RELAUNCH
* @param context the application context to pass to the application
* @exception std::exception if there is a problem running this application.
*/
virtual QVariant Start(IApplicationContext* context) = 0;
/**
* Forces this running application to exit. This method should wait until the
- * running application is ready to exit. The {@link #start()}
+ * running application is ready to exit. The {@link #Start}
* should already have exited or should exit very soon after this method exits<p>
*
* This method is only called to force an application to exit.
* This method will not be called if an application exits normally from
- * the {@link #start()} method.
+ * the {@link #Start} method.
* <p>
* Note: This method is called by the platform; it is not intended
* to be called directly by clients.
* </p>
*/
virtual void Stop() = 0;
};
}
Q_DECLARE_INTERFACE(berry::IApplication, "org.blueberry.IApplication")
#endif /*BERRYIAPPLICATION_H_*/
diff --git a/Plugins/org.blueberry.core.runtime/src/application/berryIApplicationContext.h b/Plugins/org.blueberry.core.runtime/src/application/berryIApplicationContext.h
index e5772e630b..d3db56cf50 100644
--- a/Plugins/org.blueberry.core.runtime/src/application/berryIApplicationContext.h
+++ b/Plugins/org.blueberry.core.runtime/src/application/berryIApplicationContext.h
@@ -1,83 +1,82 @@
/*============================================================================
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 BERRYIAPPLICATIONCONTEXT_H
#define BERRYIAPPLICATIONCONTEXT_H
#include <org_blueberry_core_runtime_Export.h>
#include <QHash>
#include <QVariant>
#include <QString>
namespace berry {
/**
* The context used to start an application.
* <p>
* This interface is not intended to be implemented by clients.
* </p>
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be extended by clients.
*/
struct org_blueberry_core_runtime_EXPORT IApplicationContext
{
virtual ~IApplicationContext();
/**
* A key used to store arguments for the application. The content of this argument
* is unchecked and should conform to the expectations of the application being invoked.
* Typically this is a <code>QStringList</code>.
* <p>
*
* If the properties used to launch an application do
* not contain a value for this key then command line arguments used to launch
* the platform are set in the arguments of the application context.
*/
static const QString APPLICATION_ARGS; // = "application.args";
/**
* A key used to store unprocessed arguments for the application.
* This is a <code>QStringList</code>.
* <p>
*
* If the properties used to launch an application do
* not contain a value for this key then command line arguments used to launch
* the platform are set in the unprocessed arguments of the application context.
*/
static const QString APPLICATION_ARGS_UNPROCESSED; // = "application.args.unprocessed";
/**
* The arguments used for the application. The arguments from
* QObject::dynamicPropertyNames() of a QObject service object registered under
* the interface "org.blueberry.core.runtime.AppDescriptor" are used as the arguments
* for this context when an application is launched.
*
* @return a map of application arguments.
*/
virtual QHash<QString, QVariant> GetArguments() const = 0;
/**
* This method should be called once the application is completely initialized and running.
* This method will perform certain operations that are needed once an application is running.
* One example is bringing down a splash screen if it exists.
*/
virtual void ApplicationRunning() = 0;
};
}
Q_DECLARE_INTERFACE(berry::IApplicationContext, "org.blueberry.IApplicationContext")
#endif // BERRYIAPPLICATIONCONTEXT_H
diff --git a/Plugins/org.blueberry.core.runtime/src/berryContributorFactory.h b/Plugins/org.blueberry.core.runtime/src/berryContributorFactory.h
index e1695d3fec..c2bb6eb4fa 100644
--- a/Plugins/org.blueberry.core.runtime/src/berryContributorFactory.h
+++ b/Plugins/org.blueberry.core.runtime/src/berryContributorFactory.h
@@ -1,71 +1,69 @@
/*============================================================================
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 BERRYCONTRIBUTORFACTORY_H
#define BERRYCONTRIBUTORFACTORY_H
#include <org_blueberry_core_runtime_Export.h>
#include <QSharedPointer>
class ctkPlugin;
namespace berry {
template<typename A> class SmartPointer;
struct IContributor;
/**
* The contributor factory creates new registry contributors for use in the registry.
* <p>
* This class can not be extended or instantiated by clients.
* </p>
- * @noinstantiate This class is not intended to be instantiated by clients.
- * @noextend This class is not intended to be subclassed by clients.
*/
class org_blueberry_core_runtime_EXPORT ContributorFactory
{
public:
/**
* Creates registry contributor object based on a Plugin. The plugin must not
* be <code>null</code>.
*
* @param contributor plugin associated with the contribution
* @return new registry contributor based on the Plugin
*/
static SmartPointer<IContributor> CreateContributor(const QSharedPointer<ctkPlugin>& contributor);
/**
* Returns the CTK plugin used to define this contributor.
*
* <p>The method may return null if the contributor is not based on a plugin,
* if the plugin can't be found, or if the plugin is presently unresolved or
* uninstalled.</p>
*
* @param contributor plugin-based registry contributor
* @return the actual CTK plugin associated with this contributor
*/
static QSharedPointer<ctkPlugin> Resolve(const SmartPointer<IContributor>& contributor);
private:
// not implemented
ContributorFactory();
~ContributorFactory();
};
}
#endif // BERRYCONTRIBUTORFACTORY_H
diff --git a/Plugins/org.blueberry.core.runtime/src/berryIAdapterFactory.h b/Plugins/org.blueberry.core.runtime/src/berryIAdapterFactory.h
index 0e0d7487bf..013c9f32bf 100644
--- a/Plugins/org.blueberry.core.runtime/src/berryIAdapterFactory.h
+++ b/Plugins/org.blueberry.core.runtime/src/berryIAdapterFactory.h
@@ -1,87 +1,86 @@
/*============================================================================
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 BERRYIADAPTERFACTORY_H_
#define BERRYIADAPTERFACTORY_H_
#include <org_blueberry_core_runtime_Export.h>
#include <vector>
#include <typeinfo>
namespace berry {
/**
* An adapter factory defines behavioral extensions for
* one or more classes that implements the <code>IAdaptable</code>
* interface. Adapter factories are registered with an
* adapter manager.
* <p>
* This interface can be used without OSGi running.
* </p><p>
* Clients may implement this interface.
* </p>
* @see IAdapterManager
* @see IAdaptable
*/
struct org_blueberry_core_runtime_EXPORT IAdapterFactory {
virtual ~IAdapterFactory() {};
/**
* Returns an object which can be cast to the given adapter type and which is
* associated with the given adaptable object. Returns <code>0</code> if
* no such object can be found.
*
* A typical implementation would look like this:
*
* <code>
* void* GetAdapter(void* adaptableObject, const std::type_info& adaptableType, const std::string& adapterType)
* {
* if (Image* img = CastHelper<Image>(adaptableObject, adaptableType))
* {
* if (adapterType == "berry::IResource")
* {
* return new IResource(img->GetPath());
* }
* }
* return 0;
* }
* </code>
*
* @param adaptableObject the adaptable object being queried
* (usually an instance of <code>IAdaptable</code>)
- * @param adaptableType the type information for the adaptable object
* @param adapterType the type of adapter to look up
* @return a object castable to the given adapter type,
* or <code>0</code> if this adapter factory
* does not have an adapter of the given type for the
* given object
*/
virtual Object* GetAdapter(IAdaptable* adaptableObject, const std::string& adapterType) = 0;
/**
* Returns the collection of adapter types handled by this
* factory.
* <p>
* This method is generally used by an adapter manager
* to discover which adapter types are supported, in advance
* of dispatching any actual <code>getAdapter</code> requests.
* </p>
*
* @return the collection of adapter types
*/
virtual void GetAdapterList(std::vector<const std::type_info&>& adapters) = 0;
};
}
#endif /*BERRYIADAPTERFACTORY_H_*/
diff --git a/Plugins/org.blueberry.core.runtime/src/berryIAdapterManager.h b/Plugins/org.blueberry.core.runtime/src/berryIAdapterManager.h
index eb4b638a76..96fa476b20 100644
--- a/Plugins/org.blueberry.core.runtime/src/berryIAdapterManager.h
+++ b/Plugins/org.blueberry.core.runtime/src/berryIAdapterManager.h
@@ -1,283 +1,280 @@
/*============================================================================
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 BERRYIADAPTERMANAGER_H_
#define BERRYIADAPTERMANAGER_H_
#include <berryMacros.h>
#include <org_blueberry_core_runtime_Export.h>
#include "berryPlatformObject.h"
#include "berryIAdapterFactory.h"
#include <QtPlugin>
#include <typeinfo>
namespace berry
{
/**
* An adapter manager maintains a registry of adapter factories. Clients
* directly invoke methods on an adapter manager to register and unregister
* adapters. All adaptable objects (that is, objects that implement the <code>IAdaptable</code>
* interface) tunnel <code>IAdaptable.getAdapter</code> invocations to their
* adapter manager's <code>IAdapterManger.getAdapter</code> method. The
* adapter manager then forwards this request unmodified to the <code>IAdapterFactory.getAdapter</code>
* method on one of the registered adapter factories.
* <p>
* Adapter factories can be registered programmatically using the <code>registerAdapters</code>
* method. Alternatively, they can be registered declaratively using the
* <code>org.blueberry.core.runtime.adapters</code> extension point. Factories registered
* with this extension point will not be able to provide adapters until their
* corresponding plugin has been activated.
* <p>
* The following code snippet shows how one might register an adapter of type
* <code>com.example.acme.Sticky</code> on resources in the workspace.
* <p>
*
- * <pre>
+ * \code
* IAdapterFactory pr = new IAdapterFactory() {
* public Class[] getAdapterList() {
* return new Class[] { com.example.acme.Sticky.class };
* }
* public Object getAdapter(Object adaptableObject, Class adapterType) {
* IResource res = (IResource) adaptableObject;
* QualifiedName key = new QualifiedName(&quot;com.example.acme&quot;, &quot;sticky-note&quot;);
* try {
* com.example.acme.Sticky v = (com.example.acme.Sticky) res.getSessionProperty(key);
* if (v == null) {
* v = new com.example.acme.Sticky();
* res.setSessionProperty(key, v);
* }
* } catch (CoreException e) {
* // unable to access session property - ignore
* }
* return v;
* }
* }
* Platform.getAdapterManager().registerAdapters(pr, IResource.class);
- * </pre>
+ * \endcode
*
* </p><p>
* This interface can be used without OSGi running.
* </p><p>
* This interface is not intended to be implemented by clients.
* </p>
* @see IAdaptable
* @see IAdapterFactory
*/
struct org_blueberry_core_runtime_EXPORT IAdapterManager: public Object
{
berryObjectMacro(berry::IAdapterManager);
/**
* This value can be returned to indicate that no applicable adapter factory
* was found.
* @since org.blueberry.equinox.common 3.3
*/
static const int NONE;
/**
* This value can be returned to indicate that an adapter factory was found,
* but has not been loaded.
* @since org.blueberry.equinox.common 3.3
*/
static const int NOT_LOADED;
/**
* This value can be returned to indicate that an adapter factory is loaded.
* @since org.blueberry.equinox.common 3.3
*/
static const int LOADED;
/**
* Returns a Poco::Any object which contains an instance of the given name associated
* with the given adaptable. Returns an empty Poco::Any if no such object can
* be found.
* <p>
* Note that this method will never cause plug-ins to be loaded. If the
* only suitable factory is not yet loaded, this method will return an empty Poco::Any.
* If activation of the plug-in providing the factory is required, use the
* <code>LoadAdapter</code> method instead.
*
* @param adaptable the adaptable object being queried (usually an instance
* of <code>IAdaptable</code>)
- * @param adapterTypeName the fully qualified name of the type of adapter to look up
* @return a Poco::Any castable to the given adapter type, or empty
* if the given adaptable object does not have an available adapter of the
* given type
*/
template<typename A>
A* GetAdapter(const Object* adaptable)
{
const char* typeName = qobject_interface_iid<A*>();
if (typeName == nullptr)
{
BERRY_WARN << "Error getting adapter for '" << Reflection::GetClassName(adaptable) << "': "
<< "Cannot get the interface id for type '" << Reflection::GetClassName<A>()
<< "'. It is probably missing a Q_DECLARE_INTERFACE macro in its header.";
return nullptr;
}
return dynamic_cast<A*>(this->GetAdapter(adaptable, typeName, false));
}
/**
* Returns an object which is an instance of the given class name associated
* with the given object. Returns <code>null</code> if no such object can
* be found.
* <p>
* Note that this method will never cause plug-ins to be loaded. If the
* only suitable factory is not yet loaded, this method will return <code>null</code>.
* If activation of the plug-in providing the factory is required, use the
* <code>loadAdapter</code> method instead.
*
* @param adaptable the adaptable object being queried (usually an instance
* of <code>IAdaptable</code>)
* @param adapterTypeName the fully qualified name of the type of adapter to look up
* @return an object castable to the given adapter type, or <code>null</code>
* if the given adaptable object does not have an available adapter of the
* given type
*/
virtual Object* GetAdapter(const Object* adaptable, const QString& adapterTypeName) = 0;
/**
* Returns whether there is an adapter factory registered that may be able
* to convert <code>adaptable</code> to an object of type <code>adapterTypeName</code>.
* <p>
* Note that a return value of <code>true</code> does not guarantee that
* a subsequent call to <code>GetAdapter</code> with the same arguments
* will return a non-empty result. If the factory's plug-in has not yet been
* loaded, or if the factory itself returns nothing, then
* <code>GetAdapter</code> will still return an empty Poco::Any.
*
- * @param adaptable the adaptable object being queried (usually an instance
+ * @param adaptableType the adaptable object being queried (usually an instance
* of <code>IAdaptable</code>)
- * @param adapterTypeName the fully qualified class name of an adapter to
+ * @param adapterType the fully qualified class name of an adapter to
* look up
* @return <code>true</code> if there is an adapter factory that claims
* it can convert <code>adaptable</code> to an object of type <code>adapterType</code>,
* and <code>false</code> otherwise.
*/
virtual bool HasAdapter(const Object* adaptableType, const QString& adapterType) = 0;
template<typename A>
int QueryAdapter(const Object* adaptable)
{
const char* typeName = qobject_interface_iid<A*>();
if (typeName == nullptr)
{
BERRY_WARN << "Error querying adapter manager for '" << Reflection::GetClassName(adaptable) << "': "
<< "Cannot get the interface id for type '" << Reflection::GetClassName<A>()
<< "'. It is probably missing a Q_DECLARE_INTERFACE macro in its header.";
return NONE;
}
return this->QueryAdapter(adaptable, typeName);
}
/**
* Returns a status of an adapter factory registered that may be able
* to convert <code>adaptable</code> to an object of type <code>adapterTypeName</code>.
* <p>
* One of the following values can be returned:<ul>
* <li>{@link berry::IAdapterManager::NONE} if no applicable adapter factory was found;</li>
* <li>{@link berry::IAdapterManager::NOT_LOADED} if an adapter factory was found, but has not been loaded;</li>
* <li>{@link berry::IAdapterManager::LOADED} if an adapter factory was found, and it is loaded.</li>
* </ul></p>
- * @param adaptable the adaptable object being queried (usually an instance
+ * @param adaptableType the adaptable object being queried (usually an instance
* of <code>IAdaptable</code>)
- * @param adapterTypeName the fully qualified class name of an adapter to
+ * @param adapterType the fully qualified class name of an adapter to
* look up
* @return a status of the adapter
*/
virtual int QueryAdapter(const Object* adaptableType, const QString& adapterType) = 0;
/**
* Returns an object that is an instance of the given class name associated
* with the given object. Returns an empty Poco::Any if no such object can
* be found.
* <p>
* Note that unlike the <code>GetAdapter</code> methods, this method
* will cause the plug-in that contributes the adapter factory to be loaded
* if necessary. As such, this method should be used judiciously, in order
* to avoid unnecessary plug-in activations. Most clients should avoid
* activation by using <code>GetAdapter</code> instead.
*
* @param adaptable the adaptable object being queried (usually an instance
* of <code>IAdaptable</code>)
- * @param adapterTypeName the fully qualified name of the type of adapter to look up
* @return a Poco::Any castable to the given adapter type, or empty
* if the given adaptable object does not have an available adapter of the
* given type
*/
template<typename A>
A* LoadAdapter(const Object* adaptable)
{
const char* typeName = qobject_interface_iid<A*>();
if (typeName == nullptr)
{
BERRY_WARN << "Error getting adapter for '" << Reflection::GetClassName(adaptable) << "': "
<< "Cannot get the interface id for type '" << Reflection::GetClassName<A>()
<< "'. It is probably missing a Q_DECLARE_INTERFACE macro in its header.";
return nullptr;
}
return dynamic_cast<A*>(this->GetAdapter(adaptable, typeName, true));
}
/**
* Registers the given adapter factory as extending objects of the given
* type.
*
* @param factory the adapter factory
* @param adaptableTypeName the fully qualified typename being extended
- * @see #UnregisterAdapters(IAdapterFactory*)
- * @see #UnregisterAdapters(IAdapterFactory*, const std::adaptableTypeName&)
+ * @see #UnregisterAdapters
*/
virtual void RegisterAdapters(IAdapterFactory* factory,
const QString& adaptableTypeName) = 0;
/**
* Removes the given adapter factory completely from the list of registered
* factories. Equivalent to calling <code>UnregisterAdapters(IAdapterFactory*, const std::string&)</code>
* on all classes against which it had been explicitly registered. Does
* nothing if the given factory is not currently registered.
*
* @param factory the adapter factory to remove
- * @see #RegisterAdapters(IAdapterFactory*, const std::string&)
+ * @see #RegisterAdapters
*/
virtual void UnregisterAdapters(IAdapterFactory* factory) = 0;
/**
* Removes the given adapter factory from the list of factories registered
* as extending the given class. Does nothing if the given factory and type
* combination is not registered.
*
* @param factory the adapter factory to remove
* @param adaptableTypeName one of the type names against which the given factory is
* registered
- * @see #RegisterAdapters(IAdapterFactory*, const std::string&)
+ * @see #RegisterAdapters
*/
virtual void UnregisterAdapters(IAdapterFactory* factory,
const QString& adaptableTypeName) = 0;
private:
virtual Object* GetAdapter(const Object* adaptable, const QString& adapterType, bool force) = 0;
};
} // namespace berry
Q_DECLARE_INTERFACE(berry::IAdapterManager, "org.blueberry.service.IAdapterManager")
#endif /*BERRYIADAPTERMANAGER_H_*/
diff --git a/Plugins/org.blueberry.core.runtime/src/berryILog.h b/Plugins/org.blueberry.core.runtime/src/berryILog.h
index f740d33ff4..656f1b5efe 100644
--- a/Plugins/org.blueberry.core.runtime/src/berryILog.h
+++ b/Plugins/org.blueberry.core.runtime/src/berryILog.h
@@ -1,78 +1,78 @@
/*============================================================================
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 BERRYILOG_H
#define BERRYILOG_H
template<class T> class QSharedPointer;
class ctkPlugin;
namespace berry {
template<class T> class SmartPointer;
struct ILogListener;
struct IStatus;
/**
* A log to which status events can be written. Logs appear on individual
* plug-ins and on the platform itself. Clients can register log listeners which
* will receive notification of all log events as they come in.
* <p>
* XXX Need to create a new log interface on common plugin. That interface should be a super interface of this ILog.
* getBundle() would stay here. In the super interface we would have getName()
* </p>
*
- * @noimplement This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be implemented by clients.
*/
struct ILog
{
virtual ~ILog();
/**
* Adds the given log listener to this log. Subsequently the log listener will
* receive notification of all log events passing through this log.
* This method has no effect if the identical listener is already registered on this log.
*
* @param listener the listener to add to this log
* @see Platform#addLogListener(ILogListener)
*/
virtual void AddLogListener(ILogListener* listener) = 0;
/**
* Returns the plug-in with which this log is associated.
*
* @return the plug-in with which this log is associated
*/
virtual QSharedPointer<ctkPlugin> GetBundle() const = 0;
/**
* Logs the given status. The status is distributed to the log listeners
* installed on this log and then to the log listeners installed on the platform.
*
* @param status the status to log
*/
virtual void Log(const SmartPointer<IStatus>& status) = 0;
/**
* Removes the given log listener to this log. Subsequently the log listener will
* no longer receive notification of log events passing through this log.
* This method has no effect if the identical listener is not registered on this log.
*
* @param listener the listener to remove
* @see Platform#removeLogListener(ILogListener)
*/
virtual void RemoveLogListener(ILogListener* listener) = 0;
};
}
#endif // BERRYILOG_H
diff --git a/Plugins/org.blueberry.core.runtime/src/berryIPreferences.h b/Plugins/org.blueberry.core.runtime/src/berryIPreferences.h
index c0d4d91086..a9badb3a9b 100644
--- a/Plugins/org.blueberry.core.runtime/src/berryIPreferences.h
+++ b/Plugins/org.blueberry.core.runtime/src/berryIPreferences.h
@@ -1,709 +1,709 @@
/*============================================================================
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 BERRYIPREFERENCES_H_
#define BERRYIPREFERENCES_H_
#include <org_blueberry_core_runtime_Export.h>
#include "berryObject.h"
#include "berryBackingStoreException.h"
namespace berry
{
/**
* A node in a hierarchical collection of preference data.
*
* <p>
* This interface allows applications to store and retrieve user and system
* preference data. This data is stored persistently in an
* implementation-dependent backing store. Typical implementations include flat
* files, OS-specific registries, directory servers and SQL databases.
*
* <p>
* For each bundle, there is a separate tree of nodes for each user, and one for
* system preferences. The precise description of "user" and "system" will vary
* from one bundle to another. Typical information stored in the user preference
* tree might include font choice, and color choice for a bundle which interacts
* with the user via a servlet. Typical information stored in the system
* preference tree might include installation data, or things like high score
* information for a game program.
*
* <p>
* Nodes in a preference tree are named in a similar fashion to directories in a
* hierarchical file system. Every node in a preference tree has a <i>node name
* </i> (which is not necessarily unique), a unique <i>absolute path name </i>,
* and a path name <i>relative </i> to each ancestor including itself.
*
* <p>
* The root node has a node name of the empty <code>QString</code> object ("").
* Every other node has an arbitrary node name, specified at the time it is
* created. The only restrictions on this name are that it cannot be the empty
* string, and it cannot contain the slash character ('/').
*
* <p>
* The root node has an absolute path name of <code>"/"</code>. Children of the
* root node have absolute path names of <code>"/" + </code> <i>&lt;node name&gt;
* </i>. All other nodes have absolute path names of <i>&lt;parent's absolute
* path name&gt; </i> <code> + "/" + </code> <i>&lt;node name&gt; </i>. Note that
* all absolute path names begin with the slash character.
*
* <p>
* A node <i>n </i>'s path name relative to its ancestor <i>a </i> is simply the
* string that must be appended to <i>a </i>'s absolute path name in order to
* form <i>n </i>'s absolute path name, with the initial slash character (if
* present) removed. Note that:
* <ul>
* <li>No relative path names begin with the slash character.
* <li>Every node's path name relative to itself is the empty string.
* <li>Every node's path name relative to its parent is its node name (except
* for the root node, which does not have a parent).
* <li>Every node's path name relative to the root is its absolute path name
* with the initial slash character removed.
* </ul>
*
* <p>
* Note finally that:
* <ul>
* <li>No path name contains multiple consecutive slash characters.
* <li>No path name with the exception of the root's absolute path name end in
* the slash character.
* <li>Any string that conforms to these two rules is a valid path name.
* </ul>
*
* <p>
* Each <code>Preference</code> node has zero or more properties associated with
* it, where a property consists of a name and a value. The bundle writer is
* free to choose any appropriate names for properties. Their values can be of
* type <code>QString</code>,<code>long</code>,<code>int</code>,<code>bool</code>,
* <code>std::vector<char></code>,<code>float</code>, or <code>double</code> but they can
* always be accessed as if they were <code>QString</code> objects.
*
* <p>
* All node name and property name comparisons are case-sensitive.
*
* <p>
* All of the methods that modify preference data are permitted to operate
* asynchronously; they may return immediately, and changes will eventually
* propagate to the persistent backing store, with an implementation-dependent
* delay. The <code>flush</code> method may be used to synchronously force updates
* to the backing store.
*
* <p>
* Implementations must automatically attempt to flush to the backing store any
* pending updates for a bundle's preferences when the bundle is stopped or
* otherwise ungets the IPreferences Service.
*
* <p>
* The methods in this class may be invoked concurrently by multiple threads in
* a single Java Virtual Machine (JVM) without the need for external
* synchronization, and the results will be equivalent to some serial execution.
* If this class is used concurrently <i>by multiple JVMs </i> that store their
* preference data in the same backing store, the data store will not be
* corrupted, but no other guarantees are made concerning the consistency of the
* preference data.
*
*
* @version $Revision$
*/
struct org_blueberry_core_runtime_EXPORT IPreferences : virtual public Object
{
berryObjectMacro(berry::IPreferences);
~IPreferences() override;
/**
* Associates the specified value with the specified key in this node.
*
* @param key key with which the specified value is to be associated.
* @param value value to be associated with the specified key.
* @throws NullPointerException if <code>key</code> or <code>value</code> is
* <code>null</code>.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
+ * removed with the {@link #Remove()}method.
*/
virtual void Put(const QString& key, const QString& value) = 0;
/**
* Returns the value associated with the specified <code>key</code> in this
* node. Returns the specified default if there is no value associated with
* the <code>key</code>, or the backing store is inaccessible.
*
* @param key key whose associated value is to be returned.
* @param def the value to be returned in the event that this node has no
* value associated with <code>key</code> or the backing store is
* inaccessible.
* @return the value associated with <code>key</code>, or <code>def</code> if
* no value is associated with <code>key</code>.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
+ * removed with the {@link #Remove()}method.
* @throws NullPointerException if <code>key</code> is <code>null</code>. (A
* <code>null</code> default <i>is </i> permitted.)
*/
virtual QString Get(const QString& key, const QString& def) const = 0;
/**
* Removes the value associated with the specified <code>key</code> in this
* node, if any.
*
* @param key key whose mapping is to be removed from this node.
- * @see #get(const QString&,const QString&)
+ * @see #Get
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
+ * removed with the {@link #Remove()}method.
*/
virtual void Remove(const QString& key) = 0;
/**
* Removes all of the properties (key-value associations) in this node. This
* call has no effect on any descendants of this node.
*
* @throws BackingStoreException if this operation cannot be completed due
* to a failure in the backing store, or inability to communicate
* with it.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #remove(const QString&)
+ * removed with the {@link #Remove()}method.
+ * @see #Remove(const QString&)
*/
virtual void Clear() = 0;
/**
* Associates a <code>QString</code> object representing the specified
* <code>int</code> value with the specified <code>key</code> in this node. The
* associated string is the one that would be returned if the <code>int</code>
* value were passed to <code>Integer.toString(int)</code>. This method is
- * intended for use in conjunction with {@link #getInt}method.
+ * intended for use in conjunction with {@link #GetInt}method.
*
* <p>
* Implementor's note: it is <i>not </i> necessary that the property value
* be represented by a <code>QString</code> object in the backing store. If the
* backing store supports integer values, it is not unreasonable to use
* them. This implementation detail is not visible through the
* <code>IPreferences</code> API, which allows the value to be read as an
* <code>int</code> (with <code>getInt</code> or a <code>QString</code> (with
* <code>get</code>) type.
*
* @param key key with which the string form of value is to be associated.
* @param value <code>value</code> whose string form is to be associated with
* <code>key</code>.
* @throws NullPointerException if <code>key</code> is <code>null</code>.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #getInt(const QString&,int)
+ * removed with the {@link #Remove()}method.
+ * @see #GetInt
*/
virtual void PutInt(const QString& key, int value) = 0;
/**
* Returns the <code>int</code> value represented by the <code>QString</code>
* object associated with the specified <code>key</code> in this node. The
* <code>QString</code> object is converted to an <code>int</code> as by
* <code>Integer.parseInt(QString)</code>. Returns the specified default if
* there is no value associated with the <code>key</code>, the backing store
* is inaccessible, or if <code>Integer.parseInt(QString)</code> would throw a
* <code>NumberFormatException</code> if the associated <code>value</code> were
* passed. This method is intended for use in conjunction with the
- * {@link #putInt}method.
+ * {@link #PutInt}method.
*
* @param key key whose associated value is to be returned as an
* <code>int</code>.
* @param def the value to be returned in the event that this node has no
* value associated with <code>key</code> or the associated value
* cannot be interpreted as an <code>int</code> or the backing store is
* inaccessible.
* @return the <code>int</code> value represented by the <code>QString</code>
* object associated with <code>key</code> in this node, or
* <code>def</code> if the associated value does not exist or cannot
* be interpreted as an <code>int</code> type.
* @throws NullPointerException if <code>key</code> is <code>null</code>.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #putInt(const QString&,int)
- * @see #get(const QString&,const QString&)
+ * removed with the {@link #Remove()}method.
+ * @see #PutInt(const QString&,int)
+ * @see #Get
*/
virtual int GetInt(const QString& key, int def) const = 0;
/**
* Associates a <code>QString</code> object representing the specified
* <code>long</code> value with the specified <code>key</code> in this node. The
* associated <code>QString</code> object is the one that would be returned if
* the <code>long</code> value were passed to <code>Long.toString(long)</code>.
- * This method is intended for use in conjunction with the {@link #getLong}
+ * This method is intended for use in conjunction with the {@link #GetLong}
* method.
*
* <p>
* Implementor's note: it is <i>not </i> necessary that the <code>value</code>
* be represented by a <code>QString</code> type in the backing store. If the
* backing store supports <code>long</code> values, it is not unreasonable to
* use them. This implementation detail is not visible through the <code>
* IPreferences</code> API, which allows the value to be read as a
* <code>long</code> (with <code>getLong</code> or a <code>QString</code> (with
* <code>get</code>) type.
*
* @param key <code>key</code> with which the string form of <code>value</code>
* is to be associated.
* @param value <code>value</code> whose string form is to be associated with
* <code>key</code>.
* @throws NullPointerException if <code>key</code> is <code>null</code>.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #getLong(const QString&,long)
+ * removed with the {@link #Remove()}method.
+ * @see #GetLong
*/
virtual void PutLong(const QString& key, long value) = 0;
/**
* Returns the <code>long</code> value represented by the <code>QString</code>
* object associated with the specified <code>key</code> in this node. The
* <code>QString</code> object is converted to a <code>long</code> as by
* <code>Long.parseLong(QString)</code>. Returns the specified default if
* there is no value associated with the <code>key</code>, the backing store
* is inaccessible, or if <code>Long.parseLong(QString)</code> would throw a
* <code>NumberFormatException</code> if the associated <code>value</code> were
* passed. This method is intended for use in conjunction with the
- * {@link #putLong}method.
+ * {@link #PutLong}method.
*
* @param key <code>key</code> whose associated value is to be returned as a
* <code>long</code> value.
* @param def the value to be returned in the event that this node has no
* value associated with <code>key</code> or the associated value
* cannot be interpreted as a <code>long</code> type or the backing
* store is inaccessible.
* @return the <code>long</code> value represented by the <code>QString</code>
* object associated with <code>key</code> in this node, or
* <code>def</code> if the associated value does not exist or cannot
* be interpreted as a <code>long</code> type.
* @throws NullPointerException if <code>key</code> is <code>null</code>.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #putLong(const QString&,long)
- * @see #get(const QString&,const QString&)
+ * removed with the {@link #Remove()}method.
+ * @see #PutLong(const QString&,long)
+ * @see #Get
*/
virtual long GetLong(const QString& key, long def) const = 0;
/**
* Associates a <code>QString</code> object representing the specified
* <code>bool</code> value with the specified key in this node. The
* associated string is "true" if the value is <code>true</code>, and "false"
* if it is <code>false</code>. This method is intended for use in
- * conjunction with the {@link #getBool}method.
+ * conjunction with the {@link #GetBool}method.
*
* <p>
* Implementor's note: it is <i>not </i> necessary that the value be
* represented by a string in the backing store. If the backing store
* supports <code>bool</code> values, it is not unreasonable to use them.
* This implementation detail is not visible through the <code>IPreferences
* </code> API, which allows the value to be read as a <code>bool</code>
* (with <code>getBool</code>) or a <code>QString</code> (with <code>get</code>)
* type.
*
* @param key <code>key</code> with which the string form of value is to be
* associated.
* @param value value whose string form is to be associated with
* <code>key</code>.
* @throws NullPointerException if <code>key</code> is <code>null</code>.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #getBool(const QString&,bool)
- * @see #get(const QString&,const QString&)
+ * removed with the {@link #Remove()}method.
+ * @see #GetBool
+ * @see #Get
*/
virtual void PutBool(const QString& key, bool value) = 0;
/**
* Returns the <code>bool</code> value represented by the <code>QString</code>
* object associated with the specified <code>key</code> in this node. Valid
* strings are "true", which represents <code>true</code>, and "false", which
* represents <code>false</code>. Case is ignored, so, for example, "TRUE"
* and "False" are also valid. This method is intended for use in
- * conjunction with the {@link #putBool}method.
+ * conjunction with the {@link #PutBool}method.
*
* <p>
* Returns the specified default if there is no value associated with the
* <code>key</code>, the backing store is inaccessible, or if the associated
* value is something other than "true" or "false", ignoring case.
*
* @param key <code>key</code> whose associated value is to be returned as a
* <code>bool</code>.
* @param def the value to be returned in the event that this node has no
* value associated with <code>key</code> or the associated value
* cannot be interpreted as a <code>bool</code> or the backing store
* is inaccessible.
* @return the <code>bool</code> value represented by the <code>std::string</code>
* object associated with <code>key</code> in this node, or
* <code>null</code> if the associated value does not exist or cannot
* be interpreted as a <code>bool</code>.
* @throws NullPointerException if <code>key</code> is <code>null</code>.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #get(const QString&,const QString&)
- * @see #putBool(const QString&,bool)
+ * removed with the {@link #Remove()}method.
+ * @see #Get
+ * @see #PutBool
*/
virtual bool GetBool(const QString& key, bool def) const = 0;
/**
* Associates a <code>QString</code> object representing the specified
* <code>float</code> value with the specified <code>key</code> in this node.
* The associated <code>QString</code> object is the one that would be returned
* if the <code>float</code> value were passed to
* <code>Float.toString(float)</code>. This method is intended for use in
- * conjunction with the {@link #getFloat}method.
+ * conjunction with the {@link #GetFloat}method.
*
* <p>
* Implementor's note: it is <i>not </i> necessary that the value be
* represented by a string in the backing store. If the backing store
* supports <code>float</code> values, it is not unreasonable to use them.
* This implementation detail is not visible through the <code>IPreferences
* </code> API, which allows the value to be read as a <code>float</code> (with
* <code>getFloat</code>) or a <code>QString</code> (with <code>get</code>) type.
*
* @param key <code>key</code> with which the string form of value is to be
* associated.
* @param value value whose string form is to be associated with
* <code>key</code>.
* @throws NullPointerException if <code>key</code> is <code>null</code>.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #getFloat(const QString&,float)
+ * removed with the {@link #Remove()}method.
+ * @see #GetFloat
*/
virtual void PutFloat(const QString& key, float value) = 0;
/**
* Returns the float <code>value</code> represented by the <code>QString</code>
* object associated with the specified <code>key</code> in this node. The
* <code>QString</code> object is converted to a <code>float</code> value as by
* <code>Float.parseFloat(QString)</code>. Returns the specified default if
* there is no value associated with the <code>key</code>, the backing store
* is inaccessible, or if <code>Float.parseFloat(QString)</code> would throw a
* <code>NumberFormatException</code> if the associated value were passed.
- * This method is intended for use in conjunction with the {@link #putFloat}
+ * This method is intended for use in conjunction with the {@link #PutFloat}
* method.
*
* @param key <code>key</code> whose associated value is to be returned as a
* <code>float</code> value.
* @param def the value to be returned in the event that this node has no
* value associated with <code>key</code> or the associated value
* cannot be interpreted as a <code>float</code> type or the backing
* store is inaccessible.
* @return the <code>float</code> value represented by the string associated
* with <code>key</code> in this node, or <code>def</code> if the
* associated value does not exist or cannot be interpreted as a
* <code>float</code> type.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
+ * removed with the {@link #Remove()}method.
* @throws NullPointerException if <code>key</code> is <code>null</code>.
- * @see #putFloat(const QString&,float)
- * @see #get(const QString&,const QString&)
+ * @see #PutFloat
+ * @see #Get
*/
virtual float GetFloat(const QString& key, float def) const = 0;
/**
* Associates a <code>QString</code> object representing the specified
* <code>double</code> value with the specified <code>key</code> in this node.
* The associated <code>QString</code> object is the one that would be returned
* if the <code>double</code> value were passed to
* <code>Double.toString(double)</code>. This method is intended for use in
- * conjunction with the {@link #getDouble}method
+ * conjunction with the {@link #GetDouble}method
*
* <p>
* Implementor's note: it is <i>not </i> necessary that the value be
* represented by a string in the backing store. If the backing store
* supports <code>double</code> values, it is not unreasonable to use them.
* This implementation detail is not visible through the <code>IPreferences
* </code> API, which allows the value to be read as a <code>double</code> (with
* <code>getDouble</code>) or a <code>QString</code> (with <code>get</code>)
* type.
*
* @param key <code>key</code> with which the string form of value is to be
* associated.
* @param value value whose string form is to be associated with
* <code>key</code>.
* @throws NullPointerException if <code>key</code> is <code>null</code>.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #getDouble(const QString&,double)
+ * removed with the {@link #Remove()}method.
+ * @see #GetDouble
*/
virtual void PutDouble(const QString& key, double value) = 0;
/**
* Returns the <code>double</code> value represented by the <code>QString</code>
* object associated with the specified <code>key</code> in this node. The
* <code>QString</code> object is converted to a <code>double</code> value as by
* <code>Double.parseDouble(QString)</code>. Returns the specified default if
* there is no value associated with the <code>key</code>, the backing store
* is inaccessible, or if <code>Double.parseDouble(QString)</code> would throw
* a <code>NumberFormatException</code> if the associated value were passed.
* This method is intended for use in conjunction with the
- * {@link #putDouble}method.
+ * {@link #PutDouble}method.
*
* @param key <code>key</code> whose associated value is to be returned as a
* <code>double</code> value.
* @param def the value to be returned in the event that this node has no
* value associated with <code>key</code> or the associated value
* cannot be interpreted as a <code>double</code> type or the backing
* store is inaccessible.
* @return the <code>double</code> value represented by the <code>QString</code>
* object associated with <code>key</code> in this node, or
* <code>def</code> if the associated value does not exist or cannot
* be interpreted as a <code>double</code> type.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the the {@link #removeNode()}method.
+ * removed with the the {@link #Remove()}method.
* @throws NullPointerException if <code>key</code> is <code>null</code>.
- * @see #putDouble(const QString&,double)
- * @see #get(const QString&,const QString&)
+ * @see #PutDouble
+ * @see #Get
*/
virtual double GetDouble(const QString& key, double def) const = 0;
/**
* Associates a <code>QByteArray</code> object representing the specified
* <code>QByteArray</code> with the specified <code>key</code> in this node. The
* associated <code>QByteArray</code> object is stored in <i>Base64</i> encoding.
* This method is intended for use in conjunction with the
- * {@link #getByteArray}method.
+ * {@link #GetByteArray}method.
*
* @param key <code>key</code> with which the string form of <code>value</code>
* is to be associated.
* @param value <code>value</code> whose string form is to be associated with
* <code>key</code>.
* @throws NullPointerException if <code>key</code> or <code>value</code> is
* <code>null</code>.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #GetByteArray(const QString&,const QByteArray&)
- * @see #Get(const QString&,const QString&)
+ * removed with the {@link #Remove()}method.
+ * @see #GetByteArray
+ * @see #Get
*/
virtual void PutByteArray(const QString& key, const QByteArray& value) = 0;
/**
* Returns the <code>QByteArray</code> value represented by the <code>QString</code>
* object associated with the specified <code>key</code> in this node. Valid
* <code>QString</code> objects are <i>Base64 </i> encoded binary data, as
* defined in <a href="http://www.ietf.org/rfc/rfc2045.txt">RFC 2045 </a>,
* Section 6.8, with one minor change: the string must consist solely of
* characters from the <i>Base64 Alphabet </i>; no newline characters or
* extraneous characters are permitted. This method is intended for use in
- * conjunction with the {@link #putByteArray}method.
+ * conjunction with the {@link #PutByteArray}method.
*
* <p>
* Returns the specified default if there is no value associated with the
* <code>key</code>, the backing store is inaccessible, or if the associated
* value is not a valid Base64 encoded byte array (as defined above).
*
* @param key <code>key</code> whose associated value is to be returned as a
* <code>std::vector<char></code> object.
* @param def the value to be returned in the event that this node has no
* value associated with <code>key</code> or the associated value
* cannot be interpreted as a <code>std::vector<char></code> type, or the backing
* store is inaccessible.
* @return the <code>std::vector<char></code> value represented by the <code>QString</code>
* object associated with <code>key</code> in this node, or
* <code>def</code> if the associated value does not exist or cannot
* be interpreted as a <code>std::vector<char></code>.
* @throws NullPointerException if <code>key</code> is <code>null</code>. (A
* <code>null</code> value for <code>def</code> <i>is </i> permitted.)
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #get(const QString&,const QString&)
- * @see #putByteArray(const QString&,std::vector<char>)
+ * removed with the {@link #Remove()}method.
+ * @see #Get
+ * @see #PutByteArray
*/
virtual QByteArray GetByteArray(const QString& key, const QByteArray& def) const = 0;
/**
* Returns all of the keys that have an associated value in this node. (The
* returned array will be of size zero if this node has no preferences and
* not <code>null</code>!)
*
* @return an array of the keys that have an associated value in this node.
* @throws BackingStoreException if this operation cannot be completed due
* to a failure in the backing store, or inability to communicate
* with it.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
+ * removed with the {@link #Remove()}method.
*/
virtual QStringList Keys() const = 0;
/**
* Returns the names of the children of this node. (The returned array will
* be of size zero if this node has no children and not <code>null</code>!)
*
* @return the names of the children of this node.
* @throws BackingStoreException if this operation cannot be completed due
* to a failure in the backing store, or inability to communicate
* with it.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
+ * removed with the {@link #Remove()}method.
*/
virtual QStringList ChildrenNames() const = 0;
/**
* Returns the parent of this node, or <code>null</code> if this is the root.
*
* @return the parent of this node.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
+ * removed with the {@link #Remove()}method.
*/
virtual IPreferences::Pointer Parent() const = 0;
/**
* Returns a named <code>IPreferences</code> object (node), creating it and any
* of its ancestors if they do not already exist. Accepts a relative or
* absolute pathname. Absolute pathnames (which begin with <code>'/'</code>)
* are interpreted relative to the root of this node. Relative pathnames
* (which begin with any character other than <code>'/'</code>) are
* interpreted relative to this node itself. The empty string (<code>""</code>)
* is a valid relative pathname, referring to this node itself.
*
* <p>
* If the returned node did not exist prior to this call, this node and any
* ancestors that were created by this call are not guaranteed to become
* persistent until the <code>flush</code> method is called on the returned
* node (or one of its descendants).
*
* @param pathName the path name of the <code>IPreferences</code> object to
* return.
* @return the specified <code>IPreferences</code> object.
* @throws IllegalArgumentException if the path name is invalid.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
+ * removed with the {@link #Remove()}method.
* @throws NullPointerException if path name is <code>null</code>.
- * @see #flush()
+ * @see #Flush()
*/
virtual IPreferences::Pointer Node(const QString& pathName) = 0;
/**
* Returns true if the named node exists. Accepts a relative or absolute
* pathname. Absolute pathnames (which begin with <code>'/'</code>) are
* interpreted relative to the root of this node. Relative pathnames (which
* begin with any character other than <code>'/'</code>) are interpreted
* relative to this node itself. The pathname <code>""</code> is valid, and
* refers to this node itself.
*
* <p>
* If this node (or an ancestor) has already been removed with the
- * {@link #removeNode()}method, it <i>is </i> legal to invoke this method,
+ * {@link #Remove()}method, it <i>is </i> legal to invoke this method,
* but only with the pathname <code>""</code>; the invocation will return
* <code>false</code>. Thus, the idiom <code>p.nodeExists("")</code> may be
* used to test whether <code>p</code> has been removed.
*
* @param pathName the path name of the node whose existence is to be
* checked.
* @return true if the specified node exists.
* @throws BackingStoreException if this operation cannot be completed due
* to a failure in the backing store, or inability to communicate
* with it.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method and
+ * removed with the {@link #Remove()}method and
* <code>pathname</code> is not the empty string (<code>""</code>).
* @throws IllegalArgumentException if the path name is invalid (i.e., it
* contains multiple consecutive slash characters, or ends with a
* slash character and is more than one character long).
*/
virtual bool NodeExists(const QString& pathName) const = 0;
/**
* Removes this node and all of its descendants, invalidating any properties
* contained in the removed nodes. Once a node has been removed, attempting
* any method other than <code>name()</code>,<code>absolutePath()</code> or
* <code>nodeExists("")</code> on the corresponding <code>IPreferences</code>
* instance will fail with an <code>IllegalStateException</code>. (The
* methods defined on <code>Object</code> can still be invoked on a node after
* it has been removed; they will not throw <code>IllegalStateException</code>.)
*
* <p>
* The removal is not guaranteed to be persistent until the <code>flush</code>
* method is called on the parent of this node.
*
* @throws IllegalStateException if this node (or an ancestor) has already
- * been removed with the {@link #removeNode()}method.
+ * been removed with the {@link #Remove()}method.
* @throws BackingStoreException if this operation cannot be completed due
* to a failure in the backing store, or inability to communicate
* with it.
- * @see #flush()
+ * @see #Flush()
*/
virtual void RemoveNode() = 0;
/**
* Returns this node's name, relative to its parent.
*
* @return this node's name, relative to its parent.
*/
virtual QString Name() const = 0;
/**
* Returns this node's absolute path name. Note that:
* <ul>
* <li>Root node - The path name of the root node is <code>"/"</code>.
* <li>Slash at end - Path names other than that of the root node may not
* end in slash (<code>'/'</code>).
* <li>Unusual names -<code>"."</code> and <code>".."</code> have <i>no </i>
* special significance in path names.
* <li>Illegal names - The only illegal path names are those that contain
* multiple consecutive slashes, or that end in slash and are not the root.
* </ul>
*
* @return this node's absolute path name.
*/
virtual QString AbsolutePath() const = 0;
/**
* Forces any changes in the contents of this node and its descendants to
* the persistent store.
*
* <p>
* Once this method returns successfully, it is safe to assume that all
* changes made in the subtree rooted at this node prior to the method
* invocation have become permanent.
*
* <p>
* Implementations are free to flush changes into the persistent store at
* any time. They do not need to wait for this method to be called.
*
* <p>
* When a flush occurs on a newly created node, it is made persistent, as
* are any ancestors (and descendants) that have yet to be made persistent.
* Note however that any properties value changes in ancestors are <i>not
* </i> guaranteed to be made persistent.
*
* @throws BackingStoreException if this operation cannot be completed due
* to a failure in the backing store, or inability to communicate
* with it.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #sync()
+ * removed with the {@link #Remove()}method.
+ * @see #Sync()
*/
virtual void Flush() = 0;
/**
* Ensures that future reads from this node and its descendants reflect any
* changes that were committed to the persistent store (from any VM) prior
* to the <code>sync</code> invocation. As a side-effect, forces any changes
* in the contents of this node and its descendants to the persistent store,
* as if the <code>flush</code> method had been invoked on this node.
*
* @throws BackingStoreException if this operation cannot be completed due
* to a failure in the backing store, or inability to communicate
* with it.
* @throws IllegalStateException if this node (or an ancestor) has been
- * removed with the {@link #removeNode()}method.
- * @see #flush()
+ * removed with the {@link #Remove()}method.
+ * @see #Flush()
*/
virtual void Sync() = 0;
/**
* Sets a flag to the parameter <code>block</code> which can be used to
* block berry messages in order to prevent callback functions to be called.
*
* @param block boolean to set the flag
*/
virtual void BlockSignals(bool block) = 0;
};
} // namespace berry
#endif /*BERRYIPREFERENCES_H_*/
diff --git a/Plugins/org.blueberry.core.runtime/src/berryIStatus.h b/Plugins/org.blueberry.core.runtime/src/berryIStatus.h
index 60adb0b0d3..cad224941c 100644
--- a/Plugins/org.blueberry.core.runtime/src/berryIStatus.h
+++ b/Plugins/org.blueberry.core.runtime/src/berryIStatus.h
@@ -1,200 +1,199 @@
/*============================================================================
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 BERRYISTATUS_H_
#define BERRYISTATUS_H_
#include <berryObject.h>
#include <berryMacros.h>
#include <org_blueberry_core_runtime_Export.h>
namespace berry
{
/**
* A status object represents the outcome of an operation.
* All <code>CoreException</code>s carry a status object to indicate
* what went wrong. Status objects are also returned by methods needing
* to provide details of failures (e.g., validation methods).
* <p>
* A status carries the following information:
* <ul>
* <li> plug-in identifier (required)</li>
* <li> severity (required)</li>
* <li> status code (required)</li>
* <li> message (required) - localized to current locale</li>
* <li> exception (optional) - for problems stemming from a failure at
* a lower level</li>
* </ul>
* Some status objects, known as multi-statuses, have other status objects
* as children.
* </p>
* <p>
* The class <code>Status</code> is the standard public implementation
* of status objects; the subclass <code>MultiStatus</code> is the
* implements multi-status objects.
* </p><p>
* This interface can be used without OSGi running.
* </p>
* @see MultiStatus
* @see Status
*/
struct org_blueberry_core_runtime_EXPORT IStatus: public Object
{
berryObjectMacro(berry::IStatus);
enum Severity
{
/** Status severity constant (value 0) indicating this status represents the nominal case.
* This constant is also used as the status code representing the nominal case.
*/
OK_TYPE = 0x00,
/** Status type severity (bit mask, value 1) indicating this status is informational only. */
INFO_TYPE = 0x01,
/** Status type severity (bit mask, value 2) indicating this status represents a warning. */
WARNING_TYPE = 0x02,
/** Status type severity (bit mask, value 4) indicating this status represents an error. */
ERROR_TYPE = 0x04,
/** Status type severity (bit mask, value 8) indicating this status represents a cancelation. */
CANCEL_TYPE = 0x08
};
Q_DECLARE_FLAGS(Severities, Severity)
/**
* Returns a list of status object immediately contained in this
* multi-status, or an empty list if this is not a multi-status.
*
* @return an array of status objects
- * @see #isMultiStatus()
+ * @see #IsMultiStatus()
*/
virtual QList<IStatus::Pointer> GetChildren() const = 0;
/**
* Returns the plug-in-specific status code describing the outcome.
*
* @return plug-in-specific status code
*/
virtual int GetCode() const = 0;
/**
* Returns the relevant low-level exception, or <code>null</code> if none.
* For example, when an operation fails because of a network communications
* failure, this might return the <code>java.io.IOException</code>
* describing the exact nature of that failure.
*
* @return the relevant low-level exception, or <code>null</code> if none
*/
virtual const ctkException* GetException() const = 0;
/**
* Returns the message describing the outcome.
* The message is localized to the current locale.
*
* @return a localized message
*/
virtual QString GetMessage() const = 0;
/**
* Returns the unique identifier of the plug-in associated with this status
* (this is the plug-in that defines the meaning of the status code).
*
* @return the unique identifier of the relevant plug-in
*/
virtual QString GetPlugin() const = 0;
/**
* Returns the severity. The severities are as follows (in
* descending order):
* <ul>
* <li><code>CANCEL_TYPE</code> - cancelation occurred</li>
* <li><code>ERROR_TYPE</code> - a serious error (most severe)</li>
* <li><code>WARNING_TYPE</code> - a warning (less severe)</li>
* <li><code>INFO_TYPE</code> - an informational ("fyi") message (least severe)</li>
* <li><code>OK_TYPE</code> - everything is just fine</li>
* </ul>
* <p>
* The severity of a multi-status is defined to be the maximum
* severity of any of its children, or <code>OK</code> if it has
* no children.
* </p>
*
* @return the severity: one of <code>OK_TYPE</code>, <code>ERROR_TYPE</code>,
* <code>INFO_TYPE</code>, <code>WARNING_TYPE</code>, or <code>CANCEL_TYPE</code>
- * @see #matches(int)
*/
virtual Severity GetSeverity() const = 0;
/**
* Returns whether this status is a multi-status.
* A multi-status describes the outcome of an operation
* involving multiple operands.
* <p>
* The severity of a multi-status is derived from the severities
* of its children; a multi-status with no children is
* <code>OK_TYPE</code> by definition.
* A multi-status carries a plug-in identifier, a status code,
* a message, and an optional exception. Clients may treat
* multi-status objects in a multi-status unaware way.
* </p>
*
* @return <code>true</code> for a multi-status,
* <code>false</code> otherwise
- * @see #getChildren()
+ * @see #GetChildren()
*/
virtual bool IsMultiStatus() const = 0;
/**
* Returns whether this status indicates everything is okay
* (neither info, warning, nor error).
*
* @return <code>true</code> if this status has severity
* <code>OK</code>, and <code>false</code> otherwise
*/
virtual bool IsOK() const = 0;
/**
* Returns whether the severity of this status matches the given
* severity mask. Note that a status with severity <code>OK_TYPE</code>
* will never match; use <code>isOK</code> instead to detect
* a status with a severity of <code>OK</code>.
*
* @param severityMask a mask formed by bitwise or'ing severity mask
* constants (<code>ERROR_TYPE</code>, <code>WARNING_TYPE</code>,
* <code>INFO_TYPE</code>, <code>CANCEL_TYPE</code>)
* @return <code>true</code> if there is at least one match,
* <code>false</code> if there are no matches
- * @see #getSeverity()
+ * @see #GetSeverity()
* @see #CANCEL_TYPE
* @see #ERROR_TYPE
* @see #WARNING_TYPE
* @see #INFO_TYPE
*/
virtual bool Matches(const Severities& severityMask) const = 0;
virtual QString GetFileName() const = 0;
virtual QString GetMethodName() const = 0;
virtual int GetLineNumber() const = 0;
};
}
Q_DECLARE_OPERATORS_FOR_FLAGS(berry::IStatus::Severities)
#endif /* BERRYISTATUS_H_ */
diff --git a/Plugins/org.blueberry.core.runtime/src/berryMultiStatus.h b/Plugins/org.blueberry.core.runtime/src/berryMultiStatus.h
index 317d1c09be..d37281db7c 100644
--- a/Plugins/org.blueberry.core.runtime/src/berryMultiStatus.h
+++ b/Plugins/org.blueberry.core.runtime/src/berryMultiStatus.h
@@ -1,143 +1,145 @@
/*============================================================================
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 BERRYMULTISTATUS_H_
#define BERRYMULTISTATUS_H_
#include "berryStatus.h"
#include <org_blueberry_core_runtime_Export.h>
namespace berry {
/**
* A concrete multi-status implementation,
* suitable either for instantiating or subclassing.
* <p>
* This class can be used without OSGi running.
* </p>
*/
class org_blueberry_core_runtime_EXPORT MultiStatus : public Status {
private:
/** List of child statuses.
*/
QList<IStatus::Pointer> children;
Severity GetMaxSeverity(const QList<Pointer> &children) const;
public:
berryObjectMacro(berry::MultiStatus);
/**
* Creates and returns a new multi-status object with the given children.
*
* @param pluginId the unique identifier of the relevant plug-in
* @param code the plug-in-specific status code
* @param newChildren the list of children status objects
* @param message a human-readable message, localized to the
* current locale
+ * @param sl
*/
MultiStatus(const QString& pluginId, int code, const QList<IStatus::Pointer>& newChildren,
const QString& message, const SourceLocation& sl);
/**
* Creates and returns a new multi-status object with the given children.
*
* @param pluginId the unique identifier of the relevant plug-in
* @param code the plug-in-specific status code
* @param newChildren the list of children status objects
* @param message a human-readable message, localized to the
* current locale
* @param exception a low-level exception.
+ * @param sl
*/
MultiStatus(const QString& pluginId, int code, const QList<IStatus::Pointer>& newChildren,
const QString& message, const ctkException& exception, const SourceLocation& sl);
/**
* Creates and returns a new multi-status object with no children.
*
* @param pluginId the unique identifier of the relevant plug-in
* @param code the plug-in-specific status code
* @param message a human-readable message, localized to the
* current locale
+ * @param sl
*/
MultiStatus(const QString& pluginId, int code, const QString& message,
const SourceLocation& sl);
/**
* Creates and returns a new multi-status object with no children.
*
* @param pluginId the unique identifier of the relevant plug-in
* @param code the plug-in-specific status code
* @param message a human-readable message, localized to the
* current locale
* @param exception a low-level exception, or <code>null</code> if not
* applicable
+ * @param sl
*/
MultiStatus(const QString& pluginId, int code, const QString& message,
const ctkException& exception, const SourceLocation& sl);
/**
* Adds the given status to this multi-status.
*
* @param status the new child status
*/
void Add(IStatus::Pointer status);
/**
* Adds all of the children of the given status to this multi-status.
* Does nothing if the given status has no children (which includes
* the case where it is not a multi-status).
*
* @param status the status whose children are to be added to this one
*/
void AddAll(IStatus::Pointer status);
/* (Intentionally not javadoc'd)
* Implements the corresponding method on <code>IStatus</code>.
*/
QList<IStatus::Pointer> GetChildren() const override;
/* (Intentionally not javadoc'd)
* Implements the corresponding method on <code>IStatus</code>.
*/
bool IsMultiStatus() const override;
/**
* Merges the given status into this multi-status.
- * Equivalent to <code>add(status)</code> if the
+ * Equivalent to <code>Add(status)</code> if the
* given status is not a multi-status.
- * Equivalent to <code>addAll(status)</code> if the
+ * Equivalent to <code>AddAll(status)</code> if the
* given status is a multi-status.
*
* @param status the status to merge into this one
- * @see #add(IStatus)
- * @see #addAll(IStatus)
*/
void Merge(const IStatus::Pointer& status);
/**
* Returns a string representation of the status, suitable
* for debugging purposes only.
*/
QString ToString() const override;
};
}
#endif /* BERRYMULTISTATUS_H_ */
diff --git a/Plugins/org.blueberry.core.runtime/src/berryObjectGeneric.h b/Plugins/org.blueberry.core.runtime/src/berryObjectGeneric.h
index 626a57bdfa..13aae27040 100755
--- a/Plugins/org.blueberry.core.runtime/src/berryObjectGeneric.h
+++ b/Plugins/org.blueberry.core.runtime/src/berryObjectGeneric.h
@@ -1,109 +1,110 @@
/*============================================================================
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 BERRYOBJECTGENERIC_H_
#define BERRYOBJECTGENERIC_H_
#include <sstream>
#include <org_blueberry_core_runtime_Export.h>
#include "berryMacros.h"
#include "berryObject.h"
namespace berry {
template <typename T>
class org_blueberry_core_runtime_EXPORT ObjectGeneric : public Object
{
public:
berryObjectMacro(ObjectGeneric);
typedef T ValueType;
ObjectGeneric() : m_Value(0) {}
ObjectGeneric(T x) : m_Value(x) {}
//ObjectGeneric(const Self& o) { m_Value = o.m_Value; }
~ObjectGeneric() override
{
}
void SetValue(T val) {
m_Value = val;
}
T GetValue() const {
return m_Value;
}
bool operator==(const Object* o) const override
{
if(const Self* other = dynamic_cast<const Self*>(o))
return (this->m_Value == other->m_Value);
return false;
}
virtual std::string GetValueAsString() const
{
std::stringstream myStr;
std::locale originalLocale = myStr.getloc();
std::locale C("C");
myStr.imbue(C);
myStr << GetValue() ;
myStr.imbue(originalLocale);
return myStr.str();
}
virtual bool Assignable(Object::ConstPointer other) const
{
return other.Cast<const Self>() != 0;
}
virtual void Assign(Object::ConstPointer other)
{
ConstPointer specOther = other.Cast<const Self>();
if (specOther && this->m_Value != specOther->m_Value)
{
this->m_Value = specOther->m_Value;
}
}
protected:
T m_Value;
};
} // namespace berry
/**
* Generates a specialized subclass of berry::ObjectGeneric.
* This way, GetClassName() returns the value provided by ObjectName.
* Please see berryObjects.h for examples
* @param ObjectName the name of the instantiation of ObjectGeneric
* @param Type the value type
+ * @param DefaultValue the default value
*/
#define berrySpecializeGenericObject(ObjectName,Type,DefaultValue) \
class org_blueberry_core_runtime_EXPORT ObjectName: public ::berry::ObjectGeneric< Type > \
{ \
public: \
berryObjectMacro(ObjectName); \
ObjectName() : ::berry::ObjectGeneric< Type >(DefaultValue) { } \
ObjectName(Type x) : ::berry::ObjectGeneric<Type>(x) {} \
QString ToString() const { QString txt; QTextStream ts(&txt); ts << m_Value; return txt; } \
};
#endif /* BERRYOBJECTGENERIC_H_ */
diff --git a/Plugins/org.blueberry.core.runtime/src/berryPlatform.h b/Plugins/org.blueberry.core.runtime/src/berryPlatform.h
index 548002f7e4..bc387e20f2 100644
--- a/Plugins/org.blueberry.core.runtime/src/berryPlatform.h
+++ b/Plugins/org.blueberry.core.runtime/src/berryPlatform.h
@@ -1,492 +1,494 @@
/*============================================================================
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 BERRY_Platform_INCLUDED
#define BERRY_Platform_INCLUDED
//
// Platform Identification
//
#define BERRY_OS_FREE_BSD 0x0001
#define BERRY_OS_AIX 0x0002
#define BERRY_OS_HPUX 0x0003
#define BERRY_OS_TRU64 0x0004
#define BERRY_OS_LINUX 0x0005
#define BERRY_OS_MAC_OS_X 0x0006
#define BERRY_OS_NET_BSD 0x0007
#define BERRY_OS_OPEN_BSD 0x0008
#define BERRY_OS_IRIX 0x0009
#define BERRY_OS_SOLARIS 0x000a
#define BERRY_OS_QNX 0x000b
#define BERRY_OS_VXWORKS 0x000c
#define BERRY_OS_CYGWIN 0x000d
#define BERRY_OS_UNKNOWN_UNIX 0x00ff
#define BERRY_OS_WINDOWS_NT 0x1001
#define BERRY_OS_WINDOWS_CE 0x1011
#define BERRY_OS_VMS 0x2001
#if defined(__FreeBSD__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS_FAMILY_BSD 1
#define BERRY_OS BERRY_OS_FREE_BSD
#elif defined(_AIX) || defined(__TOS_AIX__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_AIX
#elif defined(hpux) || defined(_hpux)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_HPUX
#elif defined(__digital__) || defined(__osf__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_TRU64
#elif defined(linux) || defined(__linux) || defined(__linux__) || defined(__TOS_LINUX__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_LINUX
#elif defined(__APPLE__) || defined(__TOS_MACOS__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS_FAMILY_BSD 1
#define BERRY_OS BERRY_OS_MAC_OS_X
#elif defined(__NetBSD__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS_FAMILY_BSD 1
#define BERRY_OS BERRY_OS_NET_BSD
#elif defined(__OpenBSD__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS_FAMILY_BSD 1
#define BERRY_OS BERRY_OS_OPEN_BSD
#elif defined(sgi) || defined(__sgi)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_IRIX
#elif defined(sun) || defined(__sun)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_SOLARIS
#elif defined(__QNX__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_QNX
#elif defined(unix) || defined(__unix) || defined(__unix__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_UNKNOWN_UNIX
#elif defined(_WIN32_WCE)
#define BERRY_OS_FAMILY_WINDOWS 1
#define BERRY_OS BERRY_OS_WINDOWS_CE
#elif defined(_WIN32) || defined(_WIN64)
#define BERRY_OS_FAMILY_WINDOWS 1
#define BERRY_OS BERRY_OS_WINDOWS_NT
#elif defined(__CYGWIN__)
#define BERRY_OS_FAMILY_UNIX 1
#define BERRY_OS BERRY_OS_CYGWIN
#elif defined(__VMS)
#define BERRY_OS_FAMILY_VMS 1
#define BERRY_OS BERRY_OS_VMS
#endif
//
// Hardware Architecture and Byte Order
//
#define BERRY_ARCH_ALPHA 0x01
#define BERRY_ARCH_IA32 0x02
#define BERRY_ARCH_IA64 0x03
#define BERRY_ARCH_MIPS 0x04
#define BERRY_ARCH_HPPA 0x05
#define BERRY_ARCH_PPC 0x06
#define BERRY_ARCH_POWER 0x07
#define BERRY_ARCH_SPARC 0x08
#define BERRY_ARCH_AMD64 0x09
#define BERRY_ARCH_ARM 0x0a
#if defined(__ALPHA) || defined(__alpha) || defined(__alpha__) || defined(_M_ALPHA)
#define BERRY_ARCH BERRY_ARCH_ALPHA
#define BERRY_ARCH_LITTLE_ENDIAN 1
#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(_M_IX86)
#define BERRY_ARCH BERRY_ARCH_IA32
#define BERRY_ARCH_LITTLE_ENDIAN 1
#elif defined(_IA64) || defined(__IA64__) || defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
#define BERRY_ARCH BERRY_ARCH_IA64
#if defined(hpux) || defined(_hpux)
#define BERRY_ARCH_BIG_ENDIAN 1
#else
#define BERRY_ARCH_LITTLE_ENDIAN 1
#endif
#elif defined(__x86_64__)
#define BERRY_ARCH BERRY_ARCH_AMD64
#define BERRY_ARCH_LITTLE_ENDIAN 1
#elif defined(_M_X64)
#define BERRY_ARCH BERRY_ARCH_AMD64
#define BERRY_ARCH_LITTLE_ENDIAN 1
#elif defined(__mips__) || defined(__mips) || defined(__MIPS__) || defined(_M_MRX000)
#define BERRY_ARCH BERRY_ARCH_MIPS
#define BERRY_ARCH_BIG_ENDIAN 1
#elif defined(__hppa) || defined(__hppa__)
#define BERRY_ARCH BERRY_ARCH_HPPA
#define BERRY_ARCH_BIG_ENDIAN 1
#elif defined(__PPC) || defined(__POWERPC__) || defined(__powerpc) || defined(__PPC__) || \
defined(__powerpc__) || defined(__ppc__) || defined(_ARCH_PPC) || defined(_M_PPC)
#define BERRY_ARCH BERRY_ARCH_PPC
#define BERRY_ARCH_BIG_ENDIAN 1
#elif defined(_POWER) || defined(_ARCH_PWR) || defined(_ARCH_PWR2) || defined(_ARCH_PWR3) || \
defined(_ARCH_PWR4) || defined(__THW_RS6000)
#define BERRY_ARCH BERRY_ARCH_POWER
#define BERRY_ARCH_BIG_ENDIAN 1
#elif defined(__sparc__) || defined(__sparc) || defined(sparc)
#define BERRY_ARCH BERRY_ARCH_SPARC
#define BERRY_ARCH_BIG_ENDIAN 1
#elif defined(__arm__) || defined(__arm) || defined(ARM) || defined(_ARM_) || defined(__ARM__) || defined(_M_ARM)
#define BERRY_ARCH BERRY_ARCH_ARM
#if defined(__ARMEB__)
#define BERRY_ARCH_BIG_ENDIAN 1
#else
#define BERRY_ARCH_LITTLE_ENDIAN 1
#endif
#endif
#include <org_blueberry_core_runtime_Export.h>
#include <berrySmartPointer.h>
#include <QDir>
#include <QSharedPointer>
struct ctkLocation;
class ctkPlugin;
namespace Poco {
class Path;
}
namespace berry {
struct IAdapterManager;
struct IBundle;
struct IExtensionPointService;
struct IExtensionRegistry;
struct IPreferencesService;
struct IProduct;
/**
* The central class of the BlueBerry Platform Runtime. This class cannot
* be instantiated or subclassed by clients; all functionality is provided
* by static methods. Features include:
* <ul>
* <li>the platform registry of installed plug-ins</li>
* <li>the platform adapter manager</li>
* <li>the platform log</li>
* </ul>
* <p>
* Most users don't have to worry about Platform's lifecycle. However, if your
* code can call methods of this class when Platform is not running, it becomes
* necessary to check {@link #IsRunning()} before making the call. A runtime
* exception might be thrown or incorrect result might be returned if a method
* from this class is called while Platform is not running.
* </p>
*/
class org_blueberry_core_runtime_EXPORT Platform
{
public:
static const QString PI_RUNTIME;
static const int OS_FREE_BSD;
static const int OS_AIX;
static const int OS_HPUX;
static const int OS_TRU64;
static const int OS_LINUX;
static const int OS_MAC_OS_X;
static const int OS_NET_BSD;
static const int OS_OPEN_BSD;
static const int OS_IRIX;
static const int OS_SOLARIS;
static const int OS_QNX;
static const int OS_VXWORKS;
static const int OS_CYGWIN;
static const int OS_UNKNOWN_UNIX;
static const int OS_WINDOWS_NT;
static const int OS_WINDOWS_CE;
static const int OS_VMS;
static const int ARCH_ALPHA;
static const int ARCH_IA32;
static const int ARCH_IA64;
static const int ARCH_MIPS;
static const int ARCH_HPPA;
static const int ARCH_PPC;
static const int ARCH_POWER;
static const int ARCH_SPARC;
static const int ARCH_AMD64;
static const int ARCH_ARM;
static const QString PROP_QTPLUGIN_PATH;
static const QString PROP_NEWINSTANCE;
static const QString PROP_PLUGIN_DIRS;
static const QString PROP_FORCE_PLUGIN_INSTALL;
static const QString PROP_APPLICATION;
static const QString PROP_IGNOREAPP;
static const QString PROP_XARGS;
/**
* Returns the adapter manager used for extending
* <code>IAdaptable</code> objects.
*
* @return the adapter manager for this platform
* @see IAdapterManager
*/
static IAdapterManager* GetAdapterManager();
/**
* Returns the extension registry for this platform.
* May return <code>null</code> if the registry has not been created yet.
*
* @return existing extension registry or <code>null</code>
* @see IExtensionRegistry
*/
static IExtensionRegistry* GetExtensionRegistry();
/**
* Return the interface into the preference mechanism. The returned
* object can be used for such operations as searching for preference
* values across multiple scopes and preference import/export.
* <p>
* Clients are also able to acquire the IPreferencesService service via
* CTK mechanisms and use it for preference functions.
* </p>
*
* @return an object to interface into the preference mechanism
*/
static IPreferencesService* GetPreferencesService();
/**
* Returns the product which was selected when running this BlueBerry instance
* or <code>null</code> if none
* @return the current product or <code>null</code> if none
*/
static SmartPointer<IProduct> GetProduct();
/**
* Returns the identified option. A null QString
* is returned if no such option is found. Options are specified
* in the general form <i>&lt;plug-in id&gt;/&lt;option-path&gt;</i>.
* For example, <code>org.blueberry.core.runtime/debug</code>
* <p>
- * Clients are also able to acquire the {@link DebugOptions} service
+ * Clients are also able to acquire the \c DebugOptions service
* and query it for debug options.
* </p>
* @param option the name of the option to lookup
* @return the value of the requested debug option or <code>QString::null</code>
*/
static QVariant GetDebugOption(const QString& option);
/**
* Returns the path of the configuration information
* used to run this instance of the BlueBerry platform.
* The configuration area typically
* contains the list of plug-ins available for use, various settings
* (those shared across different instances of the same configuration)
* and any other such data needed by plug-ins.
* An empty path is returned if the platform is running without a configuration location.
*
* @return the location of the platform's configuration data area
* @deprecatedSince{2015_05} Use GetConfigurationLocation() instead.
*/
QT_DEPRECATED static QDir GetConfigurationPath();
/**
* Returns the location of the configuration information
* used to run this instance of BlueBerry. The configuration area typically
* contains the list of plug-ins available for use, various settings
* (those shared across different instances of the same configuration)
* and any other such data needed by plug-ins.
* <code>null</code> is returned if the platform is running without a configuration location.
* <p>
* This method is equivalent to acquiring the <code>org.commontk.service.datalocation.Location</code>
* service with the property "type" equal to ctkLocation::CONFIGURATION_FILTER.
*</p>
* @return the location of the platform's configuration data area or <code>null</code> if none
* @see ctkLocation::CONFIGURATION_FILTER
*/
static ctkLocation* GetConfigurationLocation();
/**
* Returns the path of the base installation for the running platform
*
* @return the location of the platform's installation area or <code>null</code> if none
* @deprecatedSince{2015_05} Use GetInstallLocation() instead.
*/
QT_DEPRECATED static QDir GetInstallPath();
/**
* Returns the location of the base installation for the running platform
* <code>null</code> is returned if the platform is running without a configuration location.
* <p>
* This method is equivalent to acquiring the <code>org.commontk.service.datalocation.Location</code>
* service with the property "type" equal to ctkLocation::INSTALL_FILTER.
*</p>
* @return the location of the platform's installation area or <code>null</code> if none
* @see ctkLocation::INSTALL_FILTER
*/
static ctkLocation* GetInstallLocation();
/**
* Returns the path of the platform's working directory (also known as the instance data area).
* An empty path is returned if the platform is running without an instance location.
*
* @return the location of the platform's instance data area or <code>null</code> if none
* @deprecatedSince{2015_05} Use GetInstanceLocation() instead.
*/
QT_DEPRECATED static QDir GetInstancePath();
/**
* Returns the location of the platform's working directory (also known as the instance data area).
* <code>null</code> is returned if the platform is running without an instance location.
* <p>
* This method is equivalent to acquiring the <code>org.commontk.service.datalocation.Location</code>
* service with the property "type" equal to ctkLocation::INSTANCE_FILTER.
*</p>
* @return the location of the platform's instance data area or <code>null</code> if none
* @see ctkLocation::INSTANCE_FILTER
*/
static ctkLocation* GetInstanceLocation();
/**
* Returns the path in the local file system of the
* plug-in state area for the given plug-in.
* If the plug-in state area did not exist prior to this call,
* it is created.
* <p>
* The plug-in state area is a file directory within the
* platform's metadata area where a plug-in is free to create files.
* The content and structure of this area is defined by the plug-in,
* and the particular plug-in is solely responsible for any files
* it puts there. It is recommended for plug-in preference settings and
* other configuration parameters.
* </p>
*
+ * @param statePath
* @param plugin the plug-in whose state location is returned
+ * @param create
* @return a local file system path
* TODO Investigate the usage of a service factory
* @deprecatedSince{2015_05} Use GetStateLocation instead.
*/
QT_DEPRECATED static bool GetStatePath(QDir& statePath, const QSharedPointer<ctkPlugin>& plugin, bool create = true);
/**
* Returns the location in the local file system of the
* plug-in state area for the given plug-in.
* If the plug-in state area did not exist prior to this call,
* it is created.
* <p>
* The plug-in state area is a file directory within the
* platform's metadata area where a plug-in is free to create files.
* The content and structure of this area is defined by the plug-in,
* and the particular plug-in is solely responsible for any files
* it puts there. It is recommended for plug-in preference settings and
* other configuration parameters.
* </p>
*
* @param plugin the plugin whose state location if returned
* @return a local file system path
* @throws ctkIllegalStateException if no instance location was specified
* @throws RuntimeException if the plug-in state area could not be created.
*/
static QDir GetStateLocation(const QSharedPointer<ctkPlugin>& plugin);
/**
* Returns the path of the platform's user data area. The user data area is a location on the system
* which is specific to the system's current user. By default it is located relative to the
* location given by the System property "user.home".
* An empty path is returned if the platform is running without an user location.
*
* @return the location of the platform's user data area or <code>null</code> if none
* @deprecatedSince{2015_05} Use GetUserLocation() instead.
*/
QT_DEPRECATED static QDir GetUserPath();
/**
* Returns the location of the platform's user data area. The user data area is a location on the system
* which is specific to the system's current user. By default it is located relative to the
* location given by the system property "user.home".
* <code>null</code> is returned if the platform is running without an user location.
* <p>
* This method is equivalent to acquiring the <code>org.commontk.service.datalocation.Location</code>
* service with the property "type" equal to ctkLocation::USER_FILTER.
*</p>
* @return the location of the platform's user data area or <code>null</code> if none
* @see ctkLocation::USER_FILTER
*/
static ctkLocation* GetUserLocation();
static int GetOS();
static int GetOSArch();
static bool IsUnix();
static bool IsWindows();
static bool IsBSD();
static bool IsLinux();
static bool IsVMS();
static bool IsRunning();
/**
* Returns the applications command line arguments which
* have not been consumed by the platform.
*/
static QStringList GetApplicationArgs();
/**
* Returns the resolved plug-in with the specified symbolic name that has the
* highest version. If no resolved plug-ins are installed that have the
* specified symbolic name then null is returned.
* <p>
* Note that clients may want to filter
* the results based on the state of the plug-ins.
* </p>
* @param symbolicName the symbolic name of the plug-in to be returned.
* @return the plug-in that has the specified symbolic name with the
* highest version, or <tt>null</tt> if no plug-in is found.
*/
static QSharedPointer<ctkPlugin> GetPlugin(const QString& symbolicName);
/**
* Returns all plug-ins with the specified symbolic name. If no resolved plug-ins
* with the specified symbolic name can be found, an empty list is returned.
* If the version argument is not null then only the plug-ins that have
* the specified symbolic name and a version greater than or equal to the
* specified version are returned. The returned plug-ins are ordered in
* descending plug-in version order.
* <p>
* Note that clients may want to filter
* the results based on the state of the plug-ins.
* </p>
* @param symbolicName the symbolic name of the plug-ins that are to be returned.
* @param version the version that the returned plug-in versions must match,
* or <tt>QString()</tt> if no version matching is to be done.
* @return the list of plug-ins with the specified name that match the
* specified version and match rule, or <tt>null</tt> if no plug-ins are found.
*/
static QList<QSharedPointer<ctkPlugin> > GetPlugins(const QString& symbolicName,
const QString& version = QString());
private:
Platform();
};
} // namespace
#endif // BERRY_Platform_INCLUDED
diff --git a/Plugins/org.blueberry.core.runtime/src/berryPlugin.h b/Plugins/org.blueberry.core.runtime/src/berryPlugin.h
index 5ff821f514..e576e08f98 100644
--- a/Plugins/org.blueberry.core.runtime/src/berryPlugin.h
+++ b/Plugins/org.blueberry.core.runtime/src/berryPlugin.h
@@ -1,73 +1,73 @@
/*============================================================================
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 BERRYPLUGIN_H_
#define BERRYPLUGIN_H_
#include <org_blueberry_core_runtime_Export.h>
#include <ctkPluginActivator.h>
namespace berry {
struct ILog;
class org_blueberry_core_runtime_EXPORT Plugin : public QObject, public ctkPluginActivator
{
Q_OBJECT
Q_INTERFACES(ctkPluginActivator)
public:
Plugin();
void start(ctkPluginContext* context) override;
void stop(ctkPluginContext* context) override;
QSharedPointer<ctkPlugin> GetPlugin() const;
/**
* Returns the log for this plug-in. If no such log exists, one is created.
*
* @return the log for this plug-in
* XXX change this into a LogMgr service that would keep track of the map. See if it can be a service factory.
*/
ILog* GetLog() const;
/**
* Returns the location in the local file system of the
* plug-in state area for this plug-in.
* If the plug-in state area did not exist prior to this call,
* it is created.
* <p>
* The plug-in state area is a file directory within the
* platform's metadata area where a plug-in is free to create files.
* The content and structure of this area is defined by the plug-in,
* and the particular plug-in is solely responsible for any files
* it puts there. It is recommended for plug-in preference settings and
* other configuration parameters.
* </p>
- * @throws ctkIllegalStateException, when the system is running with no data area (-data @none),
+ * @throws ctkIllegalStateException, when the system is running with no data area (-data \@none),
* or when a data area has not been set yet.
* @return a local file system path
*/
QString GetStateLocation() const;
protected:
ctkPluginContext* m_Context;
};
}
#endif /*BERRYPLUGIN_H_*/
diff --git a/Plugins/org.blueberry.core.runtime/src/berryStatus.h b/Plugins/org.blueberry.core.runtime/src/berryStatus.h
index a015fc1465..0a2946e52e 100644
--- a/Plugins/org.blueberry.core.runtime/src/berryStatus.h
+++ b/Plugins/org.blueberry.core.runtime/src/berryStatus.h
@@ -1,255 +1,259 @@
/*============================================================================
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 BERRYSTATUS_H_
#define BERRYSTATUS_H_
#include "berryIStatus.h"
#include <org_blueberry_core_runtime_Export.h>
namespace berry {
/**
* A concrete status implementation, suitable either for
* instantiating or subclassing.
* <p>
* This class can be used without OSGi running.
* </p>
*/
class org_blueberry_core_runtime_EXPORT Status : public virtual IStatus
{
public:
struct SourceLocation {
SourceLocation(const QString& fileName = QString(), const QString& methodName = QString(), int lineNumber = 0)
: fileName(fileName), methodName(methodName), lineNumber(lineNumber)
{}
const QString fileName;
const QString methodName;
const int lineNumber;
};
private:
/**
* The severity. One of
* <ul>
* <li><code>CANCEL</code></li>
* <li><code>ERROR</code></li>
* <li><code>WARNING</code></li>
* <li><code>INFO</code></li>
* <li>or <code>OK</code> (0)</li>
* </ul>
*/
Severity severity;
/** Unique identifier of plug-in.
*/
QString pluginId;
/** Plug-in-specific status code.
*/
int code;
/** Message, localized to the current locale.
*/
QString message;
/** Wrapped exception, or <code>null</code> if none.
*/
ctkException* exception;
/** Constant to avoid generating garbage.
*/
static const QList<IStatus::Pointer> theEmptyStatusArray;
SourceLocation sourceLocation;
public:
/**
* A standard OK status with an "ok" message.
*/
static const IStatus::Pointer OK_STATUS(const SourceLocation& sl);
/**
* A standard CANCEL status with no message.
*/
static const IStatus::Pointer CANCEL_STATUS(const SourceLocation& sl);
/**
* Creates a new status object. The created status has no children.
*
* @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
* <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
* @param pluginId the unique identifier of the relevant plug-in
* @param code the plug-in-specific status code, or <code>OK</code>
* @param message a human-readable message, localized to the
* current locale
+ * @param sl
*/
Status(const Severity& severity, const QString& pluginId, int code, const QString& message,
const SourceLocation& sl);
/**
* Creates a new status object. The created status has no children.
*
* @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
* <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
* @param pluginId the unique identifier of the relevant plug-in
* @param code the plug-in-specific status code, or <code>OK</code>
* @param message a human-readable message, localized to the
* current locale
- * @param exception a low-level exception.
+ * @param exc a low-level exception.
+ * @param sl
*/
Status(const Severity& severity, const QString& pluginId, int code, const QString& message,
const ctkException& exc, const SourceLocation& sl);
/**
* Simplified constructor of a new status object; assumes that code is <code>OK</code>.
* The created status has no children.
*
* @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
* <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
* @param pluginId the unique identifier of the relevant plug-in
* @param message a human-readable message, localized to the
* current locale
+ * @param sl
*/
Status(const Severity& severity, const QString& pluginId, const QString& message,
const SourceLocation& sl);
/**
* Simplified constructor of a new status object; assumes that code is <code>OK</code>.
* The created status has no children.
*
* @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
* <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
* @param pluginId the unique identifier of the relevant plug-in
* @param message a human-readable message, localized to the
* current locale
- * @param exception a low-level exception.
+ * @param exc a low-level exception.
+ * @param sl
*/
Status(const Severity& severity, const QString& pluginId, const QString& message,
const ctkException& exc, const SourceLocation& sl);
/*
* Implements the corresponding method on <code>IStatus</code>.
*/
QList<IStatus::Pointer> GetChildren() const override;
/*
* Implements the corresponding method on <code>IStatus</code>.
*/
int GetCode() const override;
/*
* Implements the corresponding method on <code>IStatus</code>.
*/
const ctkException* GetException() const override;
/*
* Implements the corresponding method on <code>IStatus</code>.
*/
QString GetMessage() const override;
/*
* Implements the corresponding method on <code>IStatus</code>.
*/
QString GetPlugin() const override;
/*
* Implements the corresponding method on <code>IStatus</code>.
*/
Severity GetSeverity() const override;
/*
* Implements the corresponding method on <code>IStatus</code>.
*/
bool IsMultiStatus() const override;
/*
* Implements the corresponding method on <code>IStatus</code>.
*/
bool IsOK() const override;
/*
* Implements the corresponding method on <code>IStatus</code>.
*/
bool Matches(const Severities& severityMask) const override;
QString GetFileName() const override;
QString GetMethodName() const override;
int GetLineNumber() const override;
protected:
/**
* Sets the status code.
*
* @param code the plug-in-specific status code, or <code>OK</code>
*/
virtual void SetCode(int code);
/**
* Sets the exception.
*
* @param exception a low-level exception, or <code>null</code> if not
* applicable
*/
virtual void SetException(const ctkException& exception);
/**
* Sets the message. If null is passed, message is set to an empty
* string.
*
* @param message a human-readable message, localized to the
* current locale
*/
virtual void SetMessage(const QString& message);
/**
* Sets the plug-in id.
*
* @param pluginId the unique identifier of the relevant plug-in
*/
virtual void SetPlugin(const QString& pluginId);
/**
* Sets the severity.
*
* @param severity the severity; one of <code>OK</code>, <code>ERROR</code>,
* <code>INFO</code>, <code>WARNING</code>, or <code>CANCEL</code>
*/
virtual void SetSeverity(const Severity& severity);
public:
/**
* Returns a string representation of the status, suitable
* for debugging purposes only.
*/
QString ToString() const override;
};
}
#define BERRY_STATUS_LOC berry::Status::SourceLocation(__FILE__, __FUNCTION__, __LINE__)
#endif /* BERRYSTATUS_H_ */
diff --git a/Plugins/org.blueberry.core.runtime/src/dynamichelpers/berryIExtensionTracker.h b/Plugins/org.blueberry.core.runtime/src/dynamichelpers/berryIExtensionTracker.h
index f9cb0820f2..70438d483d 100644
--- a/Plugins/org.blueberry.core.runtime/src/dynamichelpers/berryIExtensionTracker.h
+++ b/Plugins/org.blueberry.core.runtime/src/dynamichelpers/berryIExtensionTracker.h
@@ -1,140 +1,139 @@
/*============================================================================
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.
============================================================================*//*============================================================================
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 BERRYIEXTENSIONTRACKER_H
#define BERRYIEXTENSIONTRACKER_H
#include <org_blueberry_core_runtime_Export.h>
#include "berrySmartPointer.h"
#include <QList>
namespace berry {
struct IExtension;
struct IExtensionChangeHandler;
struct IExtensionPointFilter;
class Object;
/**
* An extension tracker keeps associations between extensions and their derived
* objects on an extension basis. All extensions being added in a tracker will
* automatically be removed when the extension is uninstalled from the registry.
* Users interested in extension removal can register a handler that will let
* them know when an object is being removed.
* <p>
* This interface is not intended to be implemented by clients.
* </p>
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct org_blueberry_core_runtime_EXPORT IExtensionTracker
{
enum ReferenceType {
/**
* Constant for strong (normal) reference holding.
*/
REF_STRONG,
/**
* Constant for weak reference holding.
*/
REF_WEAK
};
virtual ~IExtensionTracker();
/**
* Register an extension change handler with this tracker using the given filter.
*
* @param handler the handler to be registered
* @param filter the filter to use to choose interesting changes
*/
virtual void RegisterHandler(IExtensionChangeHandler* handler, const IExtensionPointFilter& filter) = 0;
/**
* Register an extension change handler with this tracker for the given extension point id.
*
* @param handler the handler to be registered
* @param extensionPointId the extension point id to track
*/
virtual void RegisterHandler(IExtensionChangeHandler *handler, const QString& extensionPointId = QString()) = 0;
/**
* Unregister the given extension change handler previously registered with this tracker.
*
* @param handler the handler to be unregistered
*/
virtual void UnregisterHandler(IExtensionChangeHandler* handler) = 0;
/**
* Create an association between the given extension and the given object.
* The referenceType indicates how strongly the object is being kept in memory.
* There are 2 possible values: REF_STRONG and REF_WEAK.
*
* @param extension the extension
* @param object the object to associate with the extension
* @param referenceType one of REF_STRONG, REF_WEAK
*/
virtual void RegisterObject(const SmartPointer<IExtension>& extension,
const SmartPointer<Object>& object, ReferenceType referenceType) = 0;
/**
* Remove an association between the given extension and the given object.
*
* @param extension the extension under which the object has been registered
* @param object the object to unregister
*/
virtual void UnregisterObject(const SmartPointer<IExtension>& extension,
const SmartPointer<Object>& object) = 0;
/**
* Remove all the objects associated with the given extension. Return
* the removed objects.
*
* @param extension the extension for which the objects are removed
* @return the objects that were associated with the extension
*/
virtual QList<SmartPointer<Object> > UnregisterObject(const SmartPointer<IExtension>& extension) = 0;
/**
* Return all the objects that have been associated with the given extension.
* All objects registered strongly will be return unless they have been unregistered.
* The objects registered softly or weakly may not be returned if they have been garbage collected.
* Return an empty array if no associations exist.
*
* @param extension the extension for which the object must be returned
* @return the array of associated objects
*/
virtual QList<SmartPointer<Object> > GetObjects(const SmartPointer<IExtension>& extension) const = 0;
/**
* Close the tracker. All registered objects are freed and all handlers are being automatically removed.
*/
virtual void Close() = 0;
};
}
#endif // BERRYIEXTENSIONTRACKER_H
diff --git a/Plugins/org.blueberry.core.runtime/src/registry/berryIConfigurationElement.h b/Plugins/org.blueberry.core.runtime/src/registry/berryIConfigurationElement.h
index 5170bb8bdc..003043e482 100644
--- a/Plugins/org.blueberry.core.runtime/src/registry/berryIConfigurationElement.h
+++ b/Plugins/org.blueberry.core.runtime/src/registry/berryIConfigurationElement.h
@@ -1,300 +1,296 @@
/*============================================================================
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 BERRYIEXTENSIONELEMENT_H_
#define BERRYIEXTENSIONELEMENT_H_
#include <berryObject.h>
#include <berryLog.h>
namespace berry {
struct IContributor;
struct IExtension;
class Handle;
/**
* A configuration element, with its attributes and children,
* directly reflects the content and structure of the extension section
* within the declaring plug-in's manifest (<code>plugin.xml</code>) file.
* <p>
* This interface also provides a way to create executable extension
* objects.
* </p>
* <p>
* These registry objects are intended for relatively short-term use. Clients that
* deal with these objects must be aware that they may become invalid if the
* declaring plug-in is updated or uninstalled. If this happens, all methods except
* {@link #IsValid()} will throw {@link InvalidRegistryObjectException}.
* For configuration element objects, the most common case is code in a plug-in dealing
* with extensions contributed to one of the extension points it declares.
* Code in a plug-in that has declared that it is not dynamic aware (or not
* declared anything) can safely ignore this issue, since the registry
* would not be modified while it is active. However, code in a plug-in that
* declares that it is dynamic aware must be careful when accessing the extension
* and configuration element objects because they become invalid if the contributing
* plug-in is removed. Similarly, tools that analyze or display the extension registry
* are vulnerable. Client code can pre-test for invalid objects by calling {@link #IsValid()},
* which never throws this exception. However, pre-tests are usually not sufficient
* because of the possibility of the extension or configuration element object becoming
* invalid as a result of a concurrent activity. At-risk clients must treat
* <code>InvalidRegistryObjectException</code> as if it were a checked exception.
* Also, such clients should probably register a listener with the extension registry
* so that they receive notification of any changes to the registry.
* </p><p>
* This interface is not intended to be implemented by clients.
* </p>
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct org_blueberry_core_runtime_EXPORT IConfigurationElement : public virtual Object
{
berryObjectMacro(berry::IConfigurationElement);
~IConfigurationElement() override;
/**
* Creates and returns a new instance of the executable extension
* identified by the named attribute of this configuration element.
* The named attribute value must contain a fully qualified name
* of a class. The class can either refer to a class implementing
* the executable extension or to a factory capable of returning the
* executable extension.
* <p>
* The specified class is instantiated using its 0-argument public constructor.
* <p>
* Then the following checks are done:<br>
* If the specified class implements the {@link IExecutableExtension}
- * interface, the method {@link IExecutableExtension#SetInitializationData(IConfigurationElement, QString, Object*)}
+ * interface, the method {@link IExecutableExtension#SetInitializationData}
* is called, passing to the object the configuration information that was used to create it.
* <p>
* If the specified class implements {@link IExecutableExtensionFactory}
* interface, the method {@link IExecutableExtensionFactory#Create()}
* is invoked.
* </p>
* <p>
* Unlike other methods on this object, invoking this method may activate
* the plug-in.
* </p>
*
* @param propertyName the name of the property
* @return the executable instance
* @exception CoreException if an instance of the executable extension
* could not be created for any reason
* @see IExecutableExtension#SetInitializationData(IConfigurationElement, QString, Object*)
* @see IExecutableExtensionFactory
* @throws InvalidRegistryObjectException if this configuration element is no longer valid
*/
virtual QObject* CreateExecutableExtension(const QString& propertyName) const = 0;
template<class C>
C* CreateExecutableExtension(const QString &propertyName) const
{
C* interface = qobject_cast<C*>(this->CreateExecutableExtension(propertyName));
if (interface == nullptr)
{
BERRY_WARN << "The QObject subclass " << this->GetAttribute(propertyName).toStdString()
<< " does not seem to implement the required interface \""
<< qobject_interface_iid<C*>() << "\", or you forgot the Q_INTERFACES macro.";
}
return interface;
}
/**
* Returns the named attribute of this configuration element, or
* <code>null</code> if none.
* <p>
* The names of configuration element attributes
* are the same as the attribute names of the corresponding XML element.
* For example, the configuration markup
* <pre>
* &lt;bg pattern="stripes"/&gt;
* </pre>
* corresponds to a configuration element named <code>"bg"</code>
* with an attribute named <code>"pattern"</code>
* with attribute value <code>"stripes"</code>.
* </p>
* <p> Note that any translation specified in the plug-in manifest
* file is automatically applied.
* </p>
*
* @param name the name of the attribute
* @return attribute value, or <code>null</code> if none
* @throws InvalidRegistryObjectException if this configuration element is no longer valid
*/
virtual QString GetAttribute(const QString& name) const = 0;
/**
* Returns the names of the attributes of this configuration element.
* Returns an empty list if this configuration element has no attributes.
* <p>
* The names of configuration element attributes
* are the same as the attribute names of the corresponding XML element.
* For example, the configuration markup
* <pre>
* &lt;bg color="blue" pattern="stripes"/&gt;
* </pre>
* corresponds to a configuration element named <code>"bg"</code>
* with attributes named <code>"color"</code>
* and <code>"pattern"</code>.
* </p>
*
* @return the names of the attributes
* @throws InvalidRegistryObjectException if this configuration element is no longer valid
*/
virtual QList<QString> GetAttributeNames() const = 0;
/**
* Returns all configuration elements that are children of this
* configuration element.
* Returns an empty list if this configuration element has no children.
* <p>
* Each child corresponds to a nested
* XML element in the configuration markup.
* For example, the configuration markup
- * <pre>
- * &lt;view&gt;
- * &nbsp&nbsp&nbsp&nbsp&lt;verticalHint&gt;top&lt;/verticalHint&gt;
- * &nbsp&nbsp&nbsp&nbsp&lt;horizontalHint&gt;left&lt;/horizontalHint&gt;
- * &lt;/view&gt;
- * </pre>
+ * \code{.unparsed}
+ * <view>
+ * <verticalHint>top</verticalHint>
+ * <horizontalHint>left</horizontalHint>
+ * </view>
+ * \endcode
* corresponds to a configuration element, named <code>"view"</code>,
* with two children.
* </p>
*
* @return the child configuration elements
* @throws InvalidRegistryObjectException if this configuration element is no longer valid
- * @see #getChildren(String)
*/
virtual QList<IConfigurationElement::Pointer> GetChildren() const = 0;
/**
* Returns all child configuration elements with the given name.
* Returns an empty list if this configuration element has no children
* with the given name.
*
* @param name the name of the child configuration element
* @return the child configuration elements with that name
* @throws InvalidRegistryObjectException if this configuration element is no longer valid
- * @see #getChildren()
*/
virtual QList<IConfigurationElement::Pointer> GetChildren(const QString& name) const = 0;
/**
* Returns the extension that declares this configuration element.
*
* @return the extension
* @throws InvalidRegistryObjectException if this configuration element is no longer valid
*/
virtual SmartPointer<IExtension> GetDeclaringExtension() const = 0;
/**
* Returns the name of this configuration element.
* The name of a configuration element is the same as
* the XML tag of the corresponding XML element.
* For example, the configuration markup
* <pre>
* &lt;wizard name="Create Project"/&gt;
* </pre>
* corresponds to a configuration element named <code>"wizard"</code>.
*
* @return the name of this configuration element
* @throws InvalidRegistryObjectException if this configuration element is no longer valid
*/
virtual QString GetName() const = 0;
/**
* Returns the element which contains this element. If this element
* is an immediate child of an extension, the
* returned value can be downcast to <code>IExtension</code>.
* Otherwise the returned value can be downcast to
* <code>IConfigurationElement</code>.
*
* @return the parent of this configuration element
* or <code>null</code>
* @throws InvalidRegistryObjectException if this configuration element is no longer valid
*/
virtual SmartPointer<Object> GetParent() const = 0;
/**
* Returns the text value of this configuration element.
* For example, the configuration markup
- * <pre>
- * &lt;script lang="javascript"&gt;.\scripts\cp.js&lt;/script&gt;
- * </pre>
- * corresponds to a configuration element <code>"script"</code>
+ * \code{.unparsed}
+ * <script lang="javascript">./scripts/cp.js</script>
+ * \endcode
+ * corresponds to a configuration element <code>"script"</code>
* with value <code>".\scripts\cp.js"</code>.
* <p> Values may span multiple lines (i.e., contain carriage returns
* and/or line feeds).
* <p> Note that any translation specified in the plug-in manifest
* file is automatically applied.
* </p>
*
* @return the text value of this configuration element or <code>null</code>
* @throws InvalidRegistryObjectException if this configuration element is no longer valid
*/
virtual QString GetValue() const = 0;
/**
* When multi-language support is enabled, this method returns the text value of this
* configuration element in the specified locale, or <code>null</code> if none.
* <p>
* The locale matching tries to find the best match between available translations and
* the requested locale, falling back to a more generic locale ("en") when the specific
* locale ("en_US") is not available.
* </p><p>
* If multi-language support is not enabled, this method is equivalent to the method
- * {@link #getValue()}.
+ * {@link #GetValue()}.
* </p>
* @param locale the requested locale
* @return the text value of this configuration element in the specified locale,
* or <code>null</code>
* @throws InvalidRegistryObjectException if this configuration element is no longer valid
- * @see #GetValue(String)
* @see IExtensionRegistry#IsMultiLanguage()
*/
virtual QString GetValue(const QLocale& locale) const = 0;
/**
* Returns the namespace name for this configuration element.
*
* @return the namespace name for this configuration element
* @throws InvalidRegistryObjectException if this configuration element is no longer valid
*/
virtual QString GetNamespaceIdentifier() const = 0;
/**
* Returns the contributor of this configuration element.
*
* @return the contributor for this configuration element
* @throws InvalidRegistryObjectException if this configuration element is no longer valid
*/
virtual SmartPointer<IContributor> GetContributor() const = 0;
/**
* Returns whether this configuration element object is valid.
*
* @return <code>true</code> if the object is valid, and <code>false</code>
* if it is no longer valid
*/
virtual bool IsValid() const = 0;
};
} // namespace berry
Q_DECLARE_INTERFACE(berry::IConfigurationElement, "org.blueberry.core.IConfigurationElement")
#endif /*BERRYIEXTENSIONELEMENT_H_*/
diff --git a/Plugins/org.blueberry.core.runtime/src/registry/berryIContributor.h b/Plugins/org.blueberry.core.runtime/src/registry/berryIContributor.h
index 2b353ffc4f..a3c73d630b 100644
--- a/Plugins/org.blueberry.core.runtime/src/registry/berryIContributor.h
+++ b/Plugins/org.blueberry.core.runtime/src/registry/berryIContributor.h
@@ -1,55 +1,55 @@
/*============================================================================
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 BERRYICONTRIBUTOR_H
#define BERRYICONTRIBUTOR_H
#include "berryObject.h"
#include <org_blueberry_core_runtime_Export.h>
namespace berry {
/**
* This interface describes a registry contributor - an entity that supplies information
* to the extension registry.
* <p>
* Registry contributor objects can be obtained by calling {@link IExtensionPoint#GetContributor()},
* {@link IExtension#GetContributor()}, and {@link IConfigurationElement#GetContributor()}.
* Alternatively, a contributor factory appropriate for the registry in use can be called to directly
* obtain an IContributor object.
* </p><p>
* This interface is not intended to be implemented or extended by clients.
* </p>
* @see ContributorFactoryOSGi
* @see ContributorFactorySimple
*
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
+ * @note This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be extended by clients.
*/
struct org_blueberry_core_runtime_EXPORT IContributor : public Object
{
berryObjectMacro(berry::IContributor);
~IContributor() override;
/**
* Provides name of the contributor (e.g., "org.eclipse.core.runtime").
*
* @return name of the registry contributor
*/
virtual QString GetName() const = 0;
};
}
#endif // BERRYICONTRIBUTOR_H
diff --git a/Plugins/org.blueberry.core.runtime/src/registry/berryIExecutableExtension.h b/Plugins/org.blueberry.core.runtime/src/registry/berryIExecutableExtension.h
index 8714128073..d1e12a0edc 100644
--- a/Plugins/org.blueberry.core.runtime/src/registry/berryIExecutableExtension.h
+++ b/Plugins/org.blueberry.core.runtime/src/registry/berryIExecutableExtension.h
@@ -1,140 +1,140 @@
/*============================================================================
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 BERRYIEXECUTABLEEXTENSION_H_
#define BERRYIEXECUTABLEEXTENSION_H_
#include "berryObject.h"
#include "berrySmartPointer.h"
#include <QObject>
namespace berry {
struct IConfigurationElement;
/**
* Interface for executable extension classes that require access to
* their configuration element, or implement an extension adapter.
* <p>
* Extension adapters are typically required in cases where the extension
* implementation does not follow the interface rules specified
* by the provider of the extension point. In these
* cases, the role of the adapter is to map between the extension point
* interface, and the actual extension implementation. In general, adapters
* are used when attempting to plug-in existing Java implementations, or
* non-Java implementations (e.g., external executables).
* </p>
* <p>
* Clients may implement this interface.
* </p>
*
* @see IConfigurationElement#createExecutableExtension
*/
struct org_blueberry_core_runtime_EXPORT IExecutableExtension
{
virtual ~IExecutableExtension();
/**
* This method is called by the implementation of the method
* <code>IConfigurationElement.createExecutableExtension</code>
* on a newly constructed extension, passing it its relevant configuration
* information. Most executable extensions only make use of the first
* two call arguments.
* <p>
* Regular executable extensions specify their Java implementation
* class name as an attribute of the configuration element for the
* extension. For example
* <pre>
* &lt;action run="com.example.BaseAction"/&gt;
* </pre>
* In the above example, this method would be called with a reference
* to the <code>&lt;action&gt;</code> element (first argument), and
* <code>"run"</code> as the name of the attribute that defined
* this executable extension (second argument).
* </p>
* <p>
* The last parameter is for the specific use of extension adapters
* and is typically not used by regular executable extensions.
* </p>
* <p>
* There are two supported ways of associating additional
* adapter-specific data with the configuration in a way that
* is transparent to the extension point implementor:
* </p>
* <p>
* (1) by specifying adapter data as part of the implementation
* class attribute value. The Java class name can be followed
* by a ":" separator, followed by any adapter data in string
* form. For example, if the extension point specifies an attribute
* <code>"run"</code> to contain the name of the extension implementation,
* an adapter can be configured as
- * <pre>
- * &lt;action run="com.example.ExternalAdapter:./cmds/util.exe -opt 3"/&gt;
- * </pre>
+ * \code{.unparsed}
+ * <action run="com.example.ExternalAdapter:./cmds/util.exe -opt 3"/>
+ * \endcode
* </p>
* <p>
* (2) by converting the attribute used to specify the executable
* extension to a child element of the original configuration element,
* and specifying the adapter data in the form of xml markup.
* Using this form, the example above would become
- * <pre>
- * &lt;action&gt;
- * &lt;<it>run</it> class="com.xyz.ExternalAdapter"&gt;
- * &lt;parameter name="exec" value="./cmds/util.exe"/&gt;
- * &lt;parameter name="opt" value="3"/&gt;
- * &lt;/<it>run</it>&gt;
- * &lt;/action&gt;
- * </pre>
+ * \code{.unparsed}
+ * <action>
+ * <run class="com.xyz.ExternalAdapter">
+ * <parameter name="exec" value="./cmds/util.exe"/>
+ * <parameter name="opt" value="3"/>
+ * </run>
+ * </action>
+ * \endcode
* </p>
* <p>
* Form (2) will typically only be
* used for extension points that anticipate the majority of
* extensions configured into it will in fact be in the form
* of adapters.
* </p>
* <p>
* In either case, the specified adapter class is instantiated using its
* 0-argument public constructor. The adapter data is passed as the
* last argument of this method. The data argument is defined as Object.
* It can have the following values:
* <ul>
* <li><code>null</code>, if no adapter data was supplied</li>
* <li>in case (1), the initialization data
* string is passed as a <code>String</code></li>
* <li>in case (2), the initialization data is passed
* as a <code>Hashtable</code> containing the actual
* parameter names and values (both <code>String</code>s)</li>
* </ul>
* </p>
*
* @param config the configuration element used to trigger this execution.
* It can be queried by the executable extension for specific
* configuration properties
* @param propertyName the name of an attribute of the configuration element
* used on the <code>createExecutableExtension(String)</code> call. This
* argument can be used in the cases where a single configuration element
* is used to define multiple executable extensions.
* @param data adapter data in the form of a <code>String</code>,
* a <code>Hashtable</code>, or <code>null</code>.
* @exception CoreException if error(s) detected during initialization processing
* @see IConfigurationElement#createExecutableExtension
*/
virtual void SetInitializationData(const SmartPointer<IConfigurationElement>& config,
const QString& propertyName, const Object::Pointer& data) = 0;
};
}
Q_DECLARE_INTERFACE(berry::IExecutableExtension, "org.blueberry.ui.IExecutableExtension")
#endif /*BERRYIEXECUTABLEEXTENSION_H_*/
diff --git a/Plugins/org.blueberry.core.runtime/src/registry/berryIExtension.h b/Plugins/org.blueberry.core.runtime/src/registry/berryIExtension.h
index f43c389cf6..7b3f01df2f 100644
--- a/Plugins/org.blueberry.core.runtime/src/registry/berryIExtension.h
+++ b/Plugins/org.blueberry.core.runtime/src/registry/berryIExtension.h
@@ -1,151 +1,150 @@
/*============================================================================
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 BERRYIEXTENSION_H_
#define BERRYIEXTENSION_H_
#include <berryObject.h>
#include <QList>
namespace berry {
struct IConfigurationElement;
struct IContributor;
/**
* An extension declared in a plug-in.
* All information is obtained from the declaring plug-in's
* manifest (<code>plugin.xml</code>) file.
* <p>
* These registry objects are intended for relatively short-term use. Clients that
* deal with these objects must be aware that they may become invalid if the
* declaring plug-in is updated or uninstalled. If this happens, all methods except
* {@link #IsValid()} will throw {@link InvalidRegistryObjectException}.
* For extension objects, the most common case is code in a plug-in dealing
* with extensions contributed to one of the extension points it declares.
* Code in a plug-in that has declared that it is not dynamic aware (or not
* declared anything) can safely ignore this issue, since the registry
* would not be modified while it is active. However, code in a plug-in that
* declares that it is dynamic aware must be careful when accessing the extension
* objects because they become invalid if the contributing plug-in is removed.
* Similarly, tools that analyze or display the extension registry are vulnerable.
* Client code can pre-test for invalid objects by calling {@link #IsValid()},
* which never throws this exception. However, pre-tests are usually not sufficient
* because of the possibility of the extension object becoming invalid as a
* result of a concurrent activity. At-risk clients must treat
* <code>InvalidRegistryObjectException</code> as if it were a checked exception.
* Also, such clients should probably register a listener with the extension registry
* so that they receive notification of any changes to the registry.
* </p><p>
* This interface is not intended to be implemented by clients.
* </p>
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct org_blueberry_core_runtime_EXPORT IExtension : public virtual Object
{
berryObjectMacro(berry::IExtension);
~IExtension() override;
/**
* Returns all configuration elements declared by this extension.
* These elements are a direct reflection of the configuration
* markup supplied in the manifest (<code>plugin.xml</code>)
* file for the plug-in that declares this extension.
* Returns an empty array if this extension does not declare any
* configuration elements.
*
* @return the configuration elements declared by this extension
* @throws InvalidRegistryObjectException if this extension is no longer valid
*/
virtual QList<SmartPointer<IConfigurationElement> > GetConfigurationElements() const = 0;
/**
* Returns the namespace name for this extension.
*
* @return the namespace name for this extension
* @throws InvalidRegistryObjectException if this extension is no longer valid
*/
virtual QString GetNamespaceIdentifier() const = 0;
/**
* Returns the contributor of this extension.
*
* @return the contributor for this extension
* @throws InvalidRegistryObjectException if this extension is no longer valid
*/
virtual SmartPointer<IContributor> GetContributor() const = 0;
/**
* Returns the unique identifier of the extension point
* to which this extension should be contributed.
*
* @return the unique identifier of the relevant extension point
* @throws InvalidRegistryObjectException if this extension is no longer valid
*/
virtual QString GetExtensionPointUniqueIdentifier() const = 0;
/**
* Returns a displayable label for this extension.
* Returns the empty string if no label for this extension
* is specified in the extension manifest file.
* <p> Note that any translation specified in the extension manifest
* file is automatically applied.
* <p>
*
* @return a displayable string label for this extension,
* possibly the empty string
* @throws InvalidRegistryObjectException if this extension is no longer valid
*/
virtual QString GetLabel() const = 0;
/**
* Returns the simple identifier of this extension, or <code>null</code>
* if this extension does not have an identifier.
* This identifier is specified in the extensions manifest
* file as a non-empty string containing no period characters
* (<code>'.'</code>) and must be unique within the defining host.
*
* @return the simple identifier of the extension (e.g. <code>"main"</code>)
* or <code>null</code>
* @throws InvalidRegistryObjectException if this extension is no longer valid
*/
virtual QString GetSimpleIdentifier() const = 0;
/**
* Returns the unique identifier of this extension, or <code>null</code>
* if this extension does not have an identifier.
* If available, this identifier is unique within the extension registry, and
* is composed of the identifier of the host that declared
* this extension and this extension's simple identifier.
*
* @return the unique identifier of the extension
* (e.g. <code>"com.example.acme.main"</code>), or <code>null</code>
* @throws InvalidRegistryObjectException if this extension is no longer valid
*/
virtual QString GetUniqueIdentifier() const = 0;
/**
* Returns whether this extension object is valid.
*
* @return <code>true</code> if the object is valid, and <code>false</code>
* if it is no longer valid
*/
virtual bool IsValid() const = 0;
};
}
#endif /*BERRYIEXTENSION_H_*/
diff --git a/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionPoint.h b/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionPoint.h
index faa799e5df..6e7e814c39 100644
--- a/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionPoint.h
+++ b/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionPoint.h
@@ -1,163 +1,162 @@
/*============================================================================
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 BERRYIEXTENSIONPOINT_H_
#define BERRYIEXTENSIONPOINT_H_
#include <berryObject.h>
namespace berry {
struct IConfigurationElement;
struct IContributor;
struct IExtension;
/**
* An extension point declared in a plug-in.
* Except for the list of extensions plugged in to it, the information
* available for an extension point is obtained from the declaring plug-in's
* manifest (<code>plugin.xml</code>) file.
* <p>
* These registry objects are intended for relatively short-term use. Clients that
* deal with these objects must be aware that they may become invalid if the
* declaring plug-in is updated or uninstalled. If this happens, all methods except
- * {@link #isValid()} will throw {@link InvalidRegistryObjectException}.
+ * {@link #IsValid()} will throw {@link InvalidRegistryObjectException}.
* For extension point objects, the most common case is code in a plug-in dealing
* with one of the extension points it declares. These extension point objects are
* guaranteed to be valid while the plug-in is active. Code in a plug-in that has
* declared that it is not dynamic aware (or not declared anything) can also safely
* ignore this issue, since the registry would not be modified while it is
* active. However, code in a plug-in that declares that it is dynamic aware
* must be careful if it access the extension point object of a different plug-in,
* because it's at risk if that other plug-in is removed. Similarly,
* tools that analyze or display the extension registry are vulnerable.
- * Client code can pre-test for invalid objects by calling {@link #isValid()},
+ * Client code can pre-test for invalid objects by calling {@link #IsValid()},
* which never throws this exception. However, pre-tests are usually not sufficient
* because of the possibility of the extension point object becoming invalid as a
* result of a concurrent activity. At-risk clients must treat
* <code>InvalidRegistryObjectException</code> as if it were a checked exception.
* Also, such clients should probably register a listener with the extension registry
* so that they receive notification of any changes to the registry.
* </p>
* <p>
* This interface is not intended to be implemented by clients.
* </p>
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct IExtensionPoint : public virtual Object
{
berryObjectMacro(berry::IExtensionPoint);
~IExtensionPoint() override;
/**
* Returns all configuration elements from all extensions configured
* into this extension point. Returns an empty array if this extension
* point has no extensions configured, or none of the extensions
* contain configuration elements.
*
* @return the configuration elements for all extension configured
* into this extension point
* @throws InvalidRegistryObjectException if this extension point is no longer valid
*/
virtual QList<SmartPointer<IConfigurationElement> > GetConfigurationElements() const = 0;
/**
* Returns the namespace name for this extension point.
*
* @return the namespace name for this extension point
* @throws InvalidRegistryObjectException if this extension point is no longer valid
*/
virtual QString GetNamespaceIdentifier() const = 0;
/**
* Returns the contributor of this extension point.
*
* @return the contributor for this extension point
* @throws InvalidRegistryObjectException if this extension point is no longer valid
*/
virtual SmartPointer<IContributor> GetContributor() const = 0;
/**
* Returns the extension with the given unique identifier configured into
* this extension point, or <code>null</code> if there is no such extension.
* Since an extension might not have an identifier, some extensions
* can only be found via the <code>getExtensions</code> method.
*
* @param extensionId the unique identifier of an extension
* (e.g. <code>"com.example.acme.main"</code>).
* @return an extension, or <code>null</code>
* @throws InvalidRegistryObjectException if this extension point is no longer valid
*/
virtual SmartPointer<IExtension> GetExtension(const QString& extensionId) const = 0;
/**
* Returns all extensions configured into this extension point.
* Returns an empty array if this extension point has no extensions.
*
* @return the extensions configured into this extension point
* @throws InvalidRegistryObjectException if this extension point is no longer valid
*/
virtual QList<SmartPointer<IExtension> > GetExtensions() const = 0;
/**
* Returns a displayable label for this extension point.
* Returns the empty string if no label for this extension point
* is specified in the plug-in manifest file.
* <p> Note that any translation specified in the plug-in manifest
* file is automatically applied.
* </p>
*
* @return a displayable string label for this extension point,
* possibly the empty string
* @throws InvalidRegistryObjectException if this extension point is no longer valid
*/
virtual QString GetLabel() const = 0;
/**
* Returns the simple identifier of this extension point.
* This identifier is a non-empty string containing no
* period characters (<code>'.'</code>) and is guaranteed
* to be unique within the defining plug-in.
*
* @return the simple identifier of the extension point (e.g. <code>"builders"</code>)
* @throws InvalidRegistryObjectException if this extension point is no longer valid
*/
virtual QString GetSimpleIdentifier() const = 0;
/**
* Returns the unique identifier of this extension point.
* This identifier is unique within the plug-in registry, and
* is composed of the namespace for this extension point
* and this extension point's simple identifier.
*
*
* @return the unique identifier of the extension point
* (e.g. <code>"org.blueberry.core.resources.builders"</code>)
* @throws InvalidRegistryObjectException if this extension point is no longer valid
*/
virtual QString GetUniqueIdentifier() const = 0;
/**
* Returns whether this extension point object is valid.
*
* @return <code>true</code> if the object is valid, and <code>false</code>
* if it is no longer valid
*/
virtual bool IsValid() const = 0;
};
}
#endif /*BERRYIEXTENSIONPOINT_H_*/
diff --git a/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionRegistry.h b/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionRegistry.h
index b87c4d70c7..a42b906847 100644
--- a/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionRegistry.h
+++ b/Plugins/org.blueberry.core.runtime/src/registry/berryIExtensionRegistry.h
@@ -1,401 +1,396 @@
/*============================================================================
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 BERRYIEXTENSIONREGISTRY_H
#define BERRYIEXTENSIONREGISTRY_H
#include "org_blueberry_core_runtime_Export.h"
#include <berrySmartPointer.h>
#include <QList>
class QTranslator;
namespace berry {
struct IConfigurationElement;
struct IContributor;
struct IExtension;
struct IExtensionPoint;
struct IExtensionPointFilter;
struct IRegistryEventListener;
/**
* The extension registry holds the master list of all
* discovered namespaces, extension points and extensions.
* <p>
* The extension registry can be queried, by name, for
* extension points and extensions.
* </p>
* <p>
* The various objects that describe the contents of the extension registry
* ({@link IExtensionPoint}, {@link IExtension}, and {@link IConfigurationElement})
* are intended for relatively short-term use. Clients that deal with these objects
* must be aware that they may become invalid if the declaring plug-in is updated
* or uninstalled. If this happens, all methods on these object except
- * <code>isValid()</code> will throw {@link org.eclipse.core.runtime.InvalidRegistryObjectException}.
+ * <code>isValid()</code> will throw {@link InvalidRegistryObjectException}.
* Code in a plug-in that has declared that it is not dynamic aware (or not declared
* anything) can safely ignore this issue, since the registry would not be
* modified while it is active. However, code in a plug-in that declares that it
* is dynamic aware must be careful if it accesses extension registry objects,
* because it's at risk if plug-in are removed. Similarly, tools that analyze
* or display the extension registry are vulnerable. Client code can pre-test for
* invalid objects by calling <code>isValid()</code>, which never throws this exception.
* However, pre-tests are usually not sufficient because of the possibility of the
* extension registry object becoming invalid as a result of a concurrent activity.
* At-risk clients must treat <code>InvalidRegistryObjectException</code> as if it
* were a checked exception. Also, such clients should probably register a listener
* with the extension registry so that they receive notification of any changes to
* the registry.
* </p>
* <p>
* Extensions and extension points are declared by generic entities called
- * <cite>namespaces</cite>. The only fact known about namespaces is that they
+ * \c namespaces . The only fact known about namespaces is that they
* have unique string-based identifiers. One example of a namespace
* is a plug-in, for which the namespace id is the plug-in id.
* </p><p>
* This interface is not intended to be implemented by clients.
* </p>
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct org_blueberry_core_runtime_EXPORT IExtensionRegistry
{
virtual ~IExtensionRegistry();
/**
* Returns all configuration elements from all extensions configured
* into the identified extension point. Returns an empty list if the extension
* point does not exist, has no extensions configured, or none of the extensions
* contain configuration elements.
*
* @param extensionPointId the unique identifier of the extension point
* (e.g. <code>"org.blueberry.core.applications"</code>)
* @return the configuration elements
*/
virtual QList<SmartPointer<IConfigurationElement> > GetConfigurationElementsFor(
const QString& extensionPointId) const = 0;
/**
* Returns all configuration elements from all extensions configured
* into the identified extension point. Returns an empty list if the extension
* point does not exist, has no extensions configured, or none of the extensions
* contain configuration elements.
*
- * @param namespace the namespace for the extension point
+ * @param namespaze the namespace for the extension point
* (e.g. <code>"org.eclipse.core.resources"</code>)
* @param extensionPointName the simple identifier of the
* extension point (e.g. <code>"builders"</code>)
* @return the configuration elements
*/
virtual QList<SmartPointer<IConfigurationElement> > GetConfigurationElementsFor(
const QString& namespaze, const QString& extensionPointName) const = 0;
/**
* Returns all configuration elements from the identified extension.
* Returns an empty array if the extension does not exist or
* contains no configuration elements.
*
- * @param namespace the namespace for the extension point
+ * @param namespaze the namespace for the extension point
* (e.g. <code>"org.eclipse.core.resources"</code>)
* @param extensionPointName the simple identifier of the
* extension point (e.g. <code>"builders"</code>)
* @param extensionId the unique identifier of the extension
* (e.g. <code>"com.example.acme.coolbuilder"</code>)
* @return the configuration elements
*/
virtual QList<SmartPointer<IConfigurationElement> > GetConfigurationElementsFor(
const QString& namespaze, const QString& extensionPointName, const QString& extensionId) const = 0;
/**
* Returns the specified extension in this extension registry,
* or <code>null</code> if there is no such extension.
*
* @param extensionId the unique identifier of the extension
* (e.g. <code>"com.example.acme.coolbuilder"</code>)
* @return the extension, or <code>null</code>
*/
virtual SmartPointer<IExtension> GetExtension(const QString& extensionId) const = 0;
/**
* Returns the specified extension in this extension registry,
* or <code>null</code> if there is no such extension.
* The first parameter identifies the extension point, and the second
* parameter identifies an extension plugged in to that extension point.
*
* @param extensionPointId the unique identifier of the extension point
* (e.g. <code>"org.eclipse.core.resources.builders"</code>)
* @param extensionId the unique identifier of the extension
* (e.g. <code>"com.example.acme.coolbuilder"</code>)
* @return the extension, or <code>null</code>
*/
virtual SmartPointer<IExtension> GetExtension(const QString& extensionPointId,
const QString& extensionId) const = 0;
/**
* Returns the specified extension in this extension registry,
* or <code>null</code> if there is no such extension.
* The first two parameters identify the extension point, and the third
* parameter identifies an extension plugged in to that extension point.
*
- * @param namespace the namespace for the extension point
+ * @param namespaze the namespace for the extension point
* (e.g. <code>"org.eclipse.core.resources"</code>)
* @param extensionPointName the simple identifier of the
* extension point (e.g. <code>"builders"</code>)
* @param extensionId the unique identifier of the extension
* (e.g. <code>"com.example.acme.coolbuilder"</code>)
* @return the extension, or <code>null</code>
*/
virtual SmartPointer<IExtension> GetExtension(const QString& namespaze,
const QString& extensionPointName,
const QString& extensionId) const = 0;
/**
* Returns the extension point with the given extension point identifier
* in this extension registry, or <code>null</code> if there is no such
* extension point.
*
* @param extensionPointId the unique identifier of the extension point
* (e.g., <code>"org.blueberry.core.applications"</code>)
* @return the extension point, or <code>null</code>
*/
virtual SmartPointer<IExtensionPoint> GetExtensionPoint(const QString& extensionPointId) const = 0;
/**
* Returns the extension point in this extension registry
* with the given namespace and extension point simple identifier,
* or <code>null</code> if there is no such extension point.
*
- * @param namespace the namespace for the given extension point
+ * @param namespaze the namespace for the given extension point
* (e.g. <code>"org.eclipse.core.resources"</code>)
* @param extensionPointName the simple identifier of the
* extension point (e.g. <code>"builders"</code>)
* @return the extension point, or <code>null</code>
*/
virtual SmartPointer<IExtensionPoint> GetExtensionPoint(const QString& namespaze,
const QString& extensionPointName) const = 0;
/**
* Returns all extension points known to this extension registry.
* Returns an empty array if there are no extension points.
*
* @return the extension points known to this extension registry
*/
virtual QList<SmartPointer<IExtensionPoint> > GetExtensionPoints() const = 0;
/**
* Returns all extension points declared in the given namespace. Returns an empty array if
* there are no extension points declared in the namespace.
*
- * @param namespace the namespace for the extension points
+ * @param namespaze the namespace for the extension points
* (e.g. <code>"org.eclipse.core.resources"</code>)
* @return the extension points in this registry declared in the given namespace
*/
virtual QList<SmartPointer<IExtensionPoint> > GetExtensionPoints(const QString& namespaze) const = 0;
/**
* Returns all extension points supplied by the contributor, or <code>null</code>
* if there are no such extension points.
*
* @param contributor the contributor for the extensions (for OSGi registry, bundles and
* fragments are different contributors)
* @return the extension points, or <code>null</code>
* @since 3.4
*/
virtual QList<SmartPointer<IExtensionPoint> > GetExtensionPoints(
const SmartPointer<IContributor>& contributor) const = 0;
/**
* Returns all extensions declared in the given namespace. Returns an empty array if
* no extensions are declared in the namespace.
*
- * @param namespace the namespace for the extensions
+ * @param namespaze the namespace for the extensions
* (e.g. <code>"org.eclipse.core.resources"</code>)
* @return the extensions in this registry declared in the given namespace
*/
virtual QList<SmartPointer<IExtension> > GetExtensions(const QString& namespaze) const = 0;
/**
* Returns all extensions supplied by the contributor, or <code>null</code> if there
* are no such extensions.
* @param contributor the contributor for the extensions (for OSGi registry, bundles and
* fragments are different contributors)
* @return the extensions, or <code>null</code>
*/
virtual QList<SmartPointer<IExtension> > GetExtensions(const SmartPointer<IContributor>& contributor) const = 0;
/**
* Returns all namespaces currently used by extensions and extension points in this
* registry. Returns an empty array if there are no known extensions/extension points
* in this registry.
* <p>
* The fully-qualified name of an extension point or an extension consist of
* a namespace and a simple name (much like a qualified Java class name consist
* of a package name and a class name). The simple names are presumed to be unique
* in the namespace.
* </p>
* @return all namespaces known to this registry
*/
virtual QList<QString> GetNamespaces() const = 0;
/**
* Adds to this extension registry an extension point(s), extension(s), or
* a combination of those described by the XML file. The information in
* the XML file should be supplied in the same format as the plugin.xml; in fact,
* Plug-in Manifest editor can be used to prepare the XML file. The top token
* of the contribution (normally, "plugin" or "fragment" in the Plug-in Manifest
* editor) is ignored by this method.
* <p>
* This method is an access controlled method. Proper token (master token or user token) should
- * be passed as an argument. Two registry keys are set in the registry constructor
- * {@link RegistryFactory#CreateRegistry(RegistryStrategy*, QObject*, QObject*)}:
+ * be passed as an argument. Two registry keys are set in the registry constructor:
* master token and a user token. Master token allows all operations; user token allows
* non-persisted registry elements to be modified.
* </p>
*
* @param is stream open on the XML file. The XML file can contain an extension
* point(s) or/and extension(s) described in the format similar to plugin.xml. The method
* closes the device before returning.
* @param contributor the contributor making this contribution.
* @param persist indicates if the contribution(s) should be stored in the registry cache. If <code>false</code>,
* contribution is not persisted in the registry cache and is lost on BlueBerry restart
* @param name optional name of the contribution. Used for error reporting; might be <code>QString()</code>
* @param translationBundle optional translator used for translations; might be <code>nullptr</code>
* @param token the key used to check permissions
* @return <code>true</code> if the contribution was successfully processed and <code>false</code> otherwise
* @throws ctkInvalidArgumentException if an incorrect token is passed
*
* @see IContributor
*/
virtual bool AddContribution(QIODevice* is, const SmartPointer<IContributor>& contributor,
bool persist, const QString& name, QTranslator* translationBundle, QObject* token) = 0;
/**
* Removes the given extension from this registry.
* <p>
* This method is an access controlled method. Proper token (master token or user token) should
- * be passed as an argument. Two registry keys are set in the registry constructor
- * {@link RegistryFactory#CreateRegistry(RegistryStrategy*, QObject*, QObject*)}:
+ * be passed as an argument. Two registry keys are set in the registry constructor:
* master token and a user token. Master token allows all operations; user token only
* allows non-persisted registry elements to be modified.
* </p>
*
* @param extension extension to be removed
* @param token the key used to check permissions
* @return <code>true</code> if the extension was successfully removed, and <code>false</code> otherwise
* @throws ctkInvalidArgumentException if an incorrect token is passed
*/
virtual bool RemoveExtension(const SmartPointer<IExtension>& extension, QObject* token) = 0;
/**
* Removes the specified extension point from this registry.
* <p>
* This method is an access controlled method. Proper token (master token or user token) should
- * be passed as an argument. Two registry keys are set in the registry constructor
- * {@link RegistryFactory#CreateRegistry(RegistryStrategy*, QObject*, QObject*)}:
+ * be passed as an argument. Two registry keys are set in the registry constructor:
* master token and a user token. Master token allows all operations; user token only
* allows non-persisted registry elements to be modified.
* </p>
*
* @param extensionPoint extension point to be removed
* @param token the key used to check permissions
* @return <code>true</code> if the extension point was successfully removed, and
* <code>false</code> otherwise
* @throws ctkInvalidArgumentException if incorrect token is passed
*/
virtual bool RemoveExtensionPoint(const SmartPointer<IExtensionPoint>& extensionPoint, QObject* token) = 0;
/**
* Call this method to properly stop the registry. The method stops registry event processing
* and writes out cache information to be used in the next run. This is an access controlled
* method; master token is required.
* <p>
* This method is an access controlled method. Master token should be passed as an argument.
* </p>
- * @see RegistryFactory#CreateRegistry(RegistryStrategy*, QObject*, QObject*)
* @param token master token for the registry
* @throws IllegalArgumentException if incorrect token is passed
*/
virtual void Stop(QObject* token) = 0;
/**
* Adds the given listener for registry change events related to the specified
* extension point or for changes to all extension points and underlying
* extensions if the \c extensionPointId argument is empty.
* <p>
* Depending on activity, listeners of this type might receive a large number
* of modifications and negatively impact overall system performance. Whenever
* possible, consider registering listener specific to an extension point rather
* than a "global" listener.
* </p><p>
* Once registered, a listener starts receiving notification of changes to
* the registry. Registry change notifications are sent asynchronously.
* The listener continues to receive notifications until it is removed.
* </p><p>
* This method has no effect if the listener is already registered.
* </p>
* @param listener the listener
* @param extensionPointId the unique identifier of extension point
* @see IExtensionPoint#GetUniqueIdentifier()
*/
virtual void AddListener(IRegistryEventListener* listener, const QString& extensionPointId = QString()) = 0;
/**
* Adds the given listener for registry change events for extension points
* matching the provided filter.
* <p>
* Depending on activity, listeners of this type might receive a large number
* of modifications and negatively impact overall system performance. Whenever
* possible, consider registering listener specific to an extension point rather
* than a "global" listener.
* </p><p>
* Once registered, a listener starts receiving notification of changes to
* the registry. Registry change notifications are sent asynchronously.
* The listener continues to receive notifications until it is removed.
* </p><p>
* This method has no effect if the listener is already registered.
* </p>
* @param listener the listener
* @param filter An extension point filter
* @see ExtensionTracker
*/
virtual void AddListener(IRegistryEventListener *listener, const IExtensionPointFilter& filter) = 0;
/**
* Removes the given registry change listener from this registry.
* <p>
* This method has no effect if the listener is not registered.
* </p>
* @param listener the listener
* @see #AddListener(IRegistryEventListener*, const QString&)
*/
virtual void RemoveListener(IRegistryEventListener* listener) = 0;
/**
* Call this method to determine if this extension registry supports multiple languages.
* <p>
* See the runtime option "-registryMultiLanguage" for enabling multi-language
* support.
* </p>
* @return <code>true</code> if multiple languages are supported by this
* instance of the extension registry; <code>false</code> otherwise.
*/
virtual bool IsMultiLanguage() const = 0;
};
}
Q_DECLARE_INTERFACE(berry::IExtensionRegistry, "org.blueberry.service.IExtensionRegistry")
#endif // BERRYIEXTENSIONREGISTRY_H
diff --git a/Plugins/org.blueberry.core.runtime/src/registry/berryInvalidRegistryObjectException.h b/Plugins/org.blueberry.core.runtime/src/registry/berryInvalidRegistryObjectException.h
index b3b7403a23..06aff813a9 100644
--- a/Plugins/org.blueberry.core.runtime/src/registry/berryInvalidRegistryObjectException.h
+++ b/Plugins/org.blueberry.core.runtime/src/registry/berryInvalidRegistryObjectException.h
@@ -1,47 +1,45 @@
/*============================================================================
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 BERRYINVALIDREGISTRYOBJECTEXCEPTION_H
#define BERRYINVALIDREGISTRYOBJECTEXCEPTION_H
#include <ctkException.h>
#include <org_blueberry_core_runtime_Export.h>
namespace berry {
/**
* An exception indicating an attempt to access
* an extension registry object that is no longer valid.
* <p>
* This exception is thrown by methods on extension registry
* objects. It is not intended to be instantiated or
* subclassed by clients.
* </p>
- * @noinstantiate This class is not intended to be instantiated by clients.
- * @noextend This class is not intended to be subclassed by clients.
*/
class org_blueberry_core_runtime_EXPORT InvalidRegistryObjectException : public ctkRuntimeException
{
public:
InvalidRegistryObjectException();
~InvalidRegistryObjectException() throw() override;
const char* name() const throw() override;
InvalidRegistryObjectException* clone() const override;
void rethrow() const override;
};
}
#endif // BERRYINVALIDREGISTRYOBJECTEXCEPTION_H
diff --git a/Plugins/org.blueberry.ui.qt.help/documentation/doxygen/modules.dox b/Plugins/org.blueberry.ui.qt.help/documentation/doxygen/modules.dox
index b2561ea7f5..443086c9a7 100644
--- a/Plugins/org.blueberry.ui.qt.help/documentation/doxygen/modules.dox
+++ b/Plugins/org.blueberry.ui.qt.help/documentation/doxygen/modules.dox
@@ -1,46 +1,36 @@
/**
\defgroup org_blueberry_ui_qt_help org.blueberry.ui.qt.help
\ingroup BlueBerryPlugins
\brief Provides access to Qt Help information from inside the Workbench.
This plug-in collects all Qt QCH files (*.qch) from plug-ins in the RESOLVED
state and registers them internally. The plug-in can be configured using the
CTK Config Admin service and it listens to certain event topics on the CTK
Event Admin.
The following configuration properties for the service PID "org.blueberry.services.help"
are supported:
- \b homePage A <code>QString</code> property containing the a qthelp url pointing
to the applications home page.
The plug-in subscribes to the following event topics:
- \b org/blueberry/help/CONTEXTHELP_REQUESTED signals a request for showing context
sensitive help. If no properties are attached to the event, a qthelp url is constructed
using the currently active part ID from the workbench. If the url is invalid, the
home page is shown instead.
<br><br>
Supported event properties are:
- \e url Show the given url
-
- The example below demonstrates how to provide configuration data for the
- org.blueberry.ui.qt.help plug-in.
-
- \snippet org.blueberry.ui.qt.help-config/main.cpp 0
-
- Requesting context help may look like this:
-
- \snippet org.blueberry.ui.qt.help-config/main.cpp 1
-
*/
/**
\defgroup org_blueberry_ui_qt_help_internal Internal
\ingroup org_blueberry_ui_qt_help
\brief This subcategory includes the internal classes of the org.blueberry.ui.qt.help plugin. Other
plugins must not rely on these classes. They contain implementation details and their interface
may change at any time. We mean it.
*/
diff --git a/Plugins/org.blueberry.ui.qt.log/documentation/UserManual/Logging.png b/Plugins/org.blueberry.ui.qt.log/documentation/UserManual/Logging.png
deleted file mode 100644
index 33cd6a983c..0000000000
Binary files a/Plugins/org.blueberry.ui.qt.log/documentation/UserManual/Logging.png and /dev/null differ
diff --git a/Plugins/org.blueberry.ui.qt.log/documentation/UserManual/blueberrylogview.dox b/Plugins/org.blueberry.ui.qt.log/documentation/UserManual/blueberrylogview.dox
index 4f4fa8fde2..f4a0815bae 100644
--- a/Plugins/org.blueberry.ui.qt.log/documentation/UserManual/blueberrylogview.dox
+++ b/Plugins/org.blueberry.ui.qt.log/documentation/UserManual/blueberrylogview.dox
@@ -1,16 +1,16 @@
/**
\page org_blueberry_views_logview The Logging Plugin
-\imageMacro{logging.svg,"Icon of the Logging Plugin",2.00}
+\imageMacro{logview-dox.svg,"Icon of the Logging Plugin",2.00}
This plug-in records all logging output of events and progress as specified in the source code with time of occurrence, level of importance (Info, Warning, Error, Fatal, Debug), the message given and the origin of the message (source code section).
\imageMacro{LogView.png,"Screenshot of the Logging Plugin",16.00}
There are different features available in the view. The 'Filter' text field provides the possibility to search for all log events containing a certain substring. The 'Copy to clipboard' button allows you to copy the current content of the logging view to your clipboard. This enables you to insert the logging information to any text processing application.
In the simple logging view, you'll see logging messages and logging levels. A brief description of the logging levels can be found in the \ref LoggingPage "logging concept documentation". With two checkboxes more information on every logging message can be activated. The checkbox 'categories' adds a column for the category. The checkbox 'advanced fields' additionally displays the time from application start to the log message entry and the function, filename and line number of the logging message origin.
\imageMacro{LogViewExplain.png,"Details on the Vizualized Logging Information",16.00}
*/
diff --git a/Plugins/org.blueberry.ui.qt.log/documentation/UserManual/logging.svg b/Plugins/org.blueberry.ui.qt.log/documentation/UserManual/logview-dox.svg
similarity index 100%
rename from Plugins/org.blueberry.ui.qt.log/documentation/UserManual/logging.svg
rename to Plugins/org.blueberry.ui.qt.log/documentation/UserManual/logview-dox.svg
diff --git a/Plugins/org.blueberry.ui.qt.objectinspector/documentation/UserManual/ObjectBrowser.png b/Plugins/org.blueberry.ui.qt.objectinspector/documentation/UserManual/ObjectBrowser.png
deleted file mode 100644
index b10161cf1b..0000000000
Binary files a/Plugins/org.blueberry.ui.qt.objectinspector/documentation/UserManual/ObjectBrowser.png and /dev/null differ
diff --git a/Plugins/org.blueberry.ui.qt/schema/commands.exsd b/Plugins/org.blueberry.ui.qt/schema/commands.exsd
old mode 100755
new mode 100644
index 84ddaf81da..997a01d5ce
--- a/Plugins/org.blueberry.ui.qt/schema/commands.exsd
+++ b/Plugins/org.blueberry.ui.qt/schema/commands.exsd
@@ -1,466 +1,341 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.ui" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.blueberry.ui" id="commands" name="Commands"/>
</appinfo>
- <documentation>
- &lt;p&gt;
-The &lt;code&gt;org.blueberry.ui.commands&lt;/code&gt; extension point is used to declare commands and command categories, using the &lt;code&gt;command&lt;/code&gt; and &lt;code&gt;category&lt;/code&gt; elements. A command is an abstract representation of some semantic behaviour, but not it&apos;s actual implementation. This allows different developers to contribute specific behaviour for their individual parts. For example, there might be a &quot;paste&quot; command with one implementation in an editor and a different implementation in an explorer widget. These implementations are called handlers. Commands can also be viewed as declarative function pointers, or signal handlers.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence>
<element ref="category" minOccurs="0" maxOccurs="unbounded"/>
<element ref="command" minOccurs="0" maxOccurs="unbounded"/>
<element ref="commandParameterType" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="id" type="string">
<annotation>
- <documentation>
- An optional identifier of the extension instance.
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- An optional name of the extension instance.
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- A fully qualified identifier of the target extension point.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="command">
<annotation>
- <documentation>
- &lt;p&gt;
-This element is used to define commands. A command represents an request from the user that can be handled by an action, and should be semantically unique among other commands. Do not define a command if there is already one defined with the same meaning. If more than one of these elements exist with the same &lt;code&gt;id&lt;/code&gt; attribute, only the last declared element (in order of reading the plugin registry) is considered valid. See the extension points &lt;a href=&quot;org_blueberry_ui_actionSets.html&quot;&gt;org.blueberry.ui.actionSets&lt;/a&gt; and &lt;a href=&quot;org_blueberry_ui_editorActions.html&quot;&gt;org.blueberry.ui.editorActions&lt;/a&gt; to understand how actions are connected to commands.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<sequence>
<element ref="defaultHandler" minOccurs="0" maxOccurs="1"/>
<element ref="state" minOccurs="0" maxOccurs="unbounded"/>
<element ref="commandParameter" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="description" type="string">
<annotation>
- <documentation>
- A translatable short description of this command for display in the UI.
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- The unique identifier of this command.
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- The translatable name of this command for display in the UI. Commands are typically named in the form of an imperative verb.
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="categoryId" type="string">
<annotation>
- <documentation>
- The unique id of the category for this command. If this command does not specify a category it will be placed in an global &quot;Uncategorized&quot; category.
- </documentation>
+
</annotation>
</attribute>
<attribute name="defaultHandler" type="string">
<annotation>
- <documentation>
- The default handler for this command (see the &lt;a href=&quot;org_blueberry_ui_handlers.html&quot;&gt;org.blueberry.ui.handlers&lt;/a&gt; extension point). If no other handler is active, this handler will be active. This handler will conflict with other handler definitions that specify no &lt;code&gt;activeWhen&lt;/code&gt; conditions. If you are creating an &lt;code&gt;IExecutableExtension&lt;/code&gt;, you can use the &lt;code&gt;defaultHandler&lt;/code&gt; element instead.
- </documentation>
+
<appinfo>
<meta.attribute kind="java" basedOn="org.eclipse.core.commands.IHandler"/>
</appinfo>
</annotation>
</attribute>
<attribute name="returnTypeId" type="string">
<annotation>
- <documentation>
- The id of a &lt;code&gt;commandParameterType&lt;/code&gt; indicating the type of value returned by this command. Specifying a &lt;code&gt;returnTypeId&lt;/code&gt; allows clients executing the command to associate the value returned with a type and to convert the value to a QString form that may be stored and/or passed to another command that accepts parameters of the same type.
- </documentation>
+
</annotation>
</attribute>
<attribute name="helpContextId" type="string">
<annotation>
- <documentation>
- The identifier of the help context that relates to this command in general. Handlers can override this context identifier to provide help that is more specific to their particular behaviours.
-&lt;p&gt;&lt;em&gt;Not used yet&lt;/em&gt;&lt;/p&gt;
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="category">
<annotation>
- <documentation>
- &lt;p&gt;
-In the UI, commands are often organized by category to make them more manageable. This element is used to define these categories. Commands can add themselves to at most one category. If more than one of these elements exist with the same &lt;code&gt;id&lt;/code&gt; attribute, only the last declared element (in order of reading the plugin registry) is considered valid.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<attribute name="description" type="string">
<annotation>
- <documentation>
- A translatable short description of this category for display in the UI.
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- The unique identifier of this category.
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- The translatable name of this category for display in the UI.
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="commandParameter">
<annotation>
<appinfo>
<meta.element labelAttribute="id"/>
</appinfo>
- <documentation>
- &lt;p&gt;
-Defines a parameter that a command should understand. A parameter is a way to provide more information to a handler at execution time. For example, a &quot;show view&quot; command might take a view as a parameter. Handlers should be able to understand these parameters, so they should be treated like API.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<sequence>
<element ref="values" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- The unique identifier for this parameter.
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- The name for the parameter. This is the name as it will be displayed to an end-user. As such, it should be translatable. The name should be short -- preferrably one word.
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="values" type="string">
<annotation>
- <documentation>
- The class providing a list of parameter values for the user to select. This class should implement &lt;code&gt;org.blueberry.core.commands.IParameterValues&lt;/code&gt;. If this class is not specified, you must specify the more verbose &lt;code&gt;values&lt;/code&gt; element. Please see &lt;code&gt;org.blueberry.osgi.IExecutableExtension&lt;/code&gt;.
- </documentation>
+
<appinfo>
<meta.attribute kind="java" basedOn=":org.blueberry.core.commands.IParameterValues"/>
</appinfo>
</annotation>
</attribute>
<attribute name="typeId" type="string">
<annotation>
- <documentation>
- The id of a commandParameterType for this commandParameter. Specifying a typeId allows handlers of a command to convert string parameter values to objects in a consistent way and it allows potential callers of a command to look for commands that take objects of various types for their parameters.
- </documentation>
+
</annotation>
</attribute>
<attribute name="optional" type="boolean" use="default" value="true">
<annotation>
- <documentation>
- Whether this parameter is optional. If a parameter is optional, the handler should be able to handle the absence of the parameter. By default, all parameters are optional.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="commandParameterType">
<annotation>
- <documentation>
- &lt;p&gt;
-Defines the object type of a commandParameter and may specify an &lt;code&gt;org.blueberry.core.commands.AbstractParameterValueConverter&lt;/code&gt; subclass to convert between string parameter values and objects.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- The unique identifier for this commandParameterType.
- </documentation>
+
</annotation>
</attribute>
<attribute name="type" type="string">
<annotation>
- <documentation>
- The fully qualified name of a class to use as the type of this command parameter. This attribute is optional, however if omitted, &lt;code&gt;org.blueberry.osgi.Object&lt;/code&gt; will be used as the parameter type.
- </documentation>
+
<appinfo>
<meta.attribute kind="java"/>
</appinfo>
</annotation>
</attribute>
<attribute name="converter" type="string">
<annotation>
- <documentation>
- The class for converting between objects and string representations of objects for command parameter values. This class should extend &lt;code&gt;org.blueberry.core.commands.AbstractParameterValueConverter&lt;/code&gt;. The converter should produce and consume objects of the type indicated in the &lt;code&gt;type&lt;/code&gt; attribute. If this class is not specified, this facility to convert between string and object values for this parameter type will not be available (the &lt;code&gt;GetValueConverter()&lt;/code&gt; on class &lt;code&gt;ParameterType&lt;/code&gt; will return &lt;code&gt;null&lt;/code&gt;).
- </documentation>
+
<appinfo>
<meta.attribute kind="java" basedOn="org.eclipse.core.commands.AbstractParameterValueConverter"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="values">
<annotation>
<appinfo>
<meta.element labelAttribute="class"/>
</appinfo>
- <documentation>
- &lt;p&gt;
-The more verbose version of the &lt;code&gt;values&lt;/code&gt; attribute on the &lt;code&gt;commandParameter&lt;/code&gt;.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<choice>
<element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
</choice>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- The class providing a list of parameter values for the user to select. This class should implement &lt;code&gt;org.blueberry.core.commands.IParameterValues&lt;/code&gt;. If this class is not specified, you must specify the more verbose &lt;code&gt;values&lt;/code&gt; element. Please see &lt;code&gt;org.blueberry.osgi.IExecutableExtension&lt;/code&gt;.
- </documentation>
+
<appinfo>
<meta.attribute kind="java" basedOn="org.eclipse.core.commands.IParameterValues"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="parameter">
<annotation>
<appinfo>
<meta.element labelAttribute="name"/>
</appinfo>
- <documentation>
- &lt;p&gt;
-A possible value for a parameter.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- The name of the parameter to pass to the &lt;code&gt;IExecutableExtension&lt;/code&gt;.
- </documentation>
+
</annotation>
</attribute>
<attribute name="value" type="string" use="required">
<annotation>
- <documentation>
- The value of the parameter to pass to the &lt;code&gt;IExecutableExtension&lt;/code&gt;.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="defaultHandler">
<annotation>
<appinfo>
<meta.element labelAttribute="class"/>
</appinfo>
- <documentation>
- &lt;p&gt;
-The default handler for this command. If no other handler is active, this handler will be active. This handler will conflict with other handler definitions that specify no &lt;code&gt;activeWhen&lt;/code&gt; conditions. If you are not creating an &lt;code&gt;IExecutableExtension&lt;/code&gt;, you can use the &lt;code&gt;defaultHandler&lt;/code&gt; attribute instead.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<sequence>
<element ref="parameter"/>
</sequence>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- The class which implements &lt;code&gt;org.blueberry.core.commands.IHandler&lt;/code&gt;.
- </documentation>
+
<appinfo>
<meta.attribute kind="java" basedOn="org.eclipse.core.commands.IHandler"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="state">
<annotation>
<appinfo>
<meta.element labelAttribute="class"/>
</appinfo>
- <documentation>
- &lt;p&gt;
-State information shared between all handlers, and potentially persisted between sessions.The state is simply a class that is loaded to look after the state. See the API Information for more details. This is not used for UI attributes like a menu contribution check box state or label.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<sequence>
<element ref="class" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="class" type="string">
<annotation>
- <documentation>
- The class that can be loaded to store the state of this command. State is shared amongst handlers, and can be persisted between sessions. This class must implement &lt;code&gt;org.blueberry.core.commands.State&lt;/code&gt;. Please see API Information.
- </documentation>
+
<appinfo>
<meta.attribute kind="java"/>
</appinfo>
</annotation>
</attribute>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- A unique identifier for this state. This is used for persisting the state between sessions (if the state is an instance of &lt;code&gt;org.blueberry.core.commands.PersistentState&lt;/code&gt;). Certain common identifiers (see &lt;code&gt;org.blueberry.ui.menus.IMenuStateIds&lt;/code&gt;) are understood when the command is being rendered in the menus or tool bars. The identifier only needs to be unique within the command defining the state.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="class">
<annotation>
<appinfo>
<meta.element labelAttribute="class"/>
</appinfo>
- <documentation>
- &lt;p&gt;
-The class that can be loaded to store the state of this command. This element is used if you wish to pass multiple parameters to an &lt;code&gt;org.blueberry.osgi.IExecutableExtension&lt;/code&gt;.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<sequence>
<element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- The class that can be loaded to store the state of this command. State is shared amongst handlers, and can be persisted between sessions. This class must implement &lt;code&gt;org.blueberry.core.commands.State&lt;/code&gt;. Please see API Information.
- </documentation>
+
<appinfo>
<meta.attribute kind="java"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
- <documentation>
- &lt;p&gt;
-1.0
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
- <documentation>
- &lt;p&gt;
-The &lt;code&gt;plugin.xml&lt;/code&gt; file in the &lt;code&gt;org.blueberry.ui&lt;/code&gt; plugin makes extensive use of the &lt;code&gt;org.blueberry.ui.commands&lt;/code&gt; extension point.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="apiInfo"/>
</appinfo>
- <documentation>
- &lt;p&gt;
-Handlers can be registered with commands using the &lt;code&gt;org.blueberry.ui.handlers.IHandlerService&lt;/code&gt;. This can be retrieved from various workbench components (e.g., workbench, workbench window, part site, etc.) by calling &lt;code&gt;GetService(IHandlerService::ID)&lt;/code&gt;.
-&lt;/p&gt;
-&lt;p&gt;
-In general, it is preferrably to declare all commands statically (in &lt;code&gt;plugin.xml&lt;/code&gt;). This is so that users can attach key bindings to the commands. However, it is possible to declare commands at run-time. To do this, retrieve the &lt;code&gt;org.blueberry.ui.commands.ICommandService&lt;/code&gt; from a workbench component, call &lt;code&gt;GetCommand(yourCommandID)&lt;/code&gt; and then call &lt;code&gt;Command::Define(...)&lt;/code&gt;.
-Commands defined programmatically must be cleaned up by the plugin if it is unloaded.
-&lt;/p&gt;
-&lt;p&gt;
-There are a few default implementations of handler states that may be useful to users of this extension point:
-&lt;/p&gt;
-&lt;ul&gt;
-&lt;!--
-&lt;li&gt;org.eclipse.jface.commands.TextState&lt;/li&gt;
-&lt;li&gt;org.eclipse.jface.commands.RadioState&lt;/li&gt;
-&lt;li&gt;org.eclipse.jface.commands.ToggleState&lt;/li&gt;
-&lt;li&gt;org.eclipse.ui.handlers.RegistryRadioState&lt;/li&gt;
-&lt;li&gt;org.eclipse.ui.handlers.RegistryToggleState&lt;/li&gt;
---&gt;
-&lt;/ul&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.ui.qt/schema/editors.exsd b/Plugins/org.blueberry.ui.qt/schema/editors.exsd
old mode 100755
new mode 100644
index 93f1db4a0f..424fbb2e00
--- a/Plugins/org.blueberry.ui.qt/schema/editors.exsd
+++ b/Plugins/org.blueberry.ui.qt/schema/editors.exsd
@@ -1,328 +1,168 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.ui">
<annotation>
<appInfo>
<meta.schema plugin="org.blueberry.ui" id="editors" name="Internal and External Editors"/>
</appInfo>
- <documentation>
- This extension point is used to add new editors to the
-workbench. A editor is a visual component within a
-workbench page. It is typically used to edit or browse
-a document or input object. To open an editor, the user
-will typically invoke &quot;Open&quot; on an &lt;samp&gt;IFile&lt;/samp&gt;.
-When this action is performed the workbench registry
-is consulted to determine an appropriate editor for
-the file type and then a new instance of the editor
-type is created. The actual result depends on the
-type of the editor. The workbench provides support
-for the creation of internal editors, which are tightly
-integrated into the workbench, and external editors,
-which are launched in a separate frame window.
-There are also various level of integration between
-these extremes.
-&lt;p&gt;
-In the case of an internal editor tight integration can
-be achieved between the workbench window and the editor
-part. The workbench menu and toolbar are pre-loaded
-with a number of common actions, such as cut, copy, and
-paste. The active part, view or editor, is expected to
-provide the implementation for these actions. An internal
-editor may also define new actions which appear in the
-workbench window. These actions only appear when the
-editor is active.
-&lt;p&gt;
-The integration between the workbench and external
-editors is more tenuous. In this case the workbench
-may launch an editor but after has no way of determining
-the state of the external editor or collaborating
-with it by any means except through the file system.
- </documentation>
+
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="editor" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
+
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="editor">
<annotation>
<appInfo>
<meta.element labelAttribute="name" icon="icon"/>
</appInfo>
</annotation>
<complexType>
<sequence>
<element ref="contentTypeBinding" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- a unique name that will be used to identify this editor
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- a translatable name that will be used in the UI for this editor
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
<attribute name="icon" type="string">
<annotation>
- <documentation>
- A relative name of the icon that will be used for all resources that match the specified extensions. Editors should provide an icon to make it easy for users to distinguish between different editor types. If you specify a command rather than a class, an icon is not needed. In that case, the workbench
-will use the icon provided by the operating system.
- </documentation>
+
<appInfo>
<meta.attribute kind="resource"/>
</appInfo>
</annotation>
</attribute>
<attribute name="extensions" type="string">
<annotation>
- <documentation>
- an optional field containing the list of file types understood by the editor. This is a string containing comma separate file extensions. For instance, an editor which understands hypertext documents may register for &quot;htm, html&quot;.
- </documentation>
+
</annotation>
</attribute>
<attribute name="class" type="string">
<annotation>
- <documentation>
- the name of a class that implements &lt;samp&gt;berry::IEditorPart&lt;/samp&gt;. The attributes &lt;samp&gt;class&lt;/samp&gt;, &lt;samp&gt;command&lt;/samp&gt;, and &lt;samp&gt;launcher&lt;/samp&gt; are mutually exclusive. If this attribute is defined then &lt;samp&gt;contributorClass&lt;/samp&gt; should also be defined.
- </documentation>
+
<appInfo>
<meta.attribute kind="java" basedOn="berry::EditorPart"/>
</appInfo>
</annotation>
</attribute>
<attribute name="command" type="string">
<annotation>
- <documentation>
- a command to run in order to launch an external editor. The executable command must be located on the system path or in the plug-in&apos;s directory. The attributes &lt;samp&gt;class&lt;/samp&gt;, &lt;samp&gt;command&lt;/samp&gt;, and &lt;samp&gt;launcher&lt;/samp&gt; are mutually exclusive.
- </documentation>
+
</annotation>
</attribute>
<attribute name="launcher" type="string">
<annotation>
- <documentation>
- the name of a class which that implements &lt;samp&gt;berry::IEditorLauncher&lt;/samp&gt;.
-A launcher will open an external editor. The attributes &lt;samp&gt;class&lt;/samp&gt;, &lt;samp&gt;command&lt;/samp&gt;, and &lt;samp&gt;launcher&lt;/samp&gt; are mutually exclusive.
- </documentation>
+
<appInfo>
<meta.attribute kind="java" basedOn="berry::IEditorLauncher"/>
</appInfo>
</annotation>
</attribute>
<attribute name="contributorClass" type="string">
<annotation>
- <documentation>
- the name of a class that implements &lt;samp&gt;berry::IEditorActionBarContributor&lt;/samp&gt;. This attribute should only be defined if the &lt;samp&gt;class&lt;/samp&gt; attribute is defined. This class is used to add new actions to the workbench menu and tool bar which reflect the features of the editor type.
- </documentation>
+
<appInfo>
<meta.attribute kind="java" basedOn="berry::EditorActionBarContributor"/>
</appInfo>
</annotation>
</attribute>
<attribute name="default" type="boolean" use="default" value="false">
<annotation>
- <documentation>
- if true, this editor will be used as the default editor for the
-type. This is only relevant in a case where more than one editor
-is registered for the same type. If an editor is not the default
-for the type, it can still be launched using &quot;Open with...&quot;
-submenu for the selected resource.
-&lt;p&gt;
-Please note that this attribute is only honored for filename and extension associations at this time. It will not be honored for content type bindings. Content type-based resolution will occur on a first come, first serve basis and is not explicitly specified.&lt;/p&gt;
- </documentation>
+
</annotation>
</attribute>
<attribute name="filenames" type="string">
<annotation>
- <documentation>
- an optional field containing the list of file names
-understood by the editor. This is a string
-containing comma separate file names. For instance,
-an editor which understands specific hypertext
-documents may register for &quot;ejb.htm, ejb.html&quot;.
- </documentation>
+
</annotation>
</attribute>
<attribute name="matchingStrategy" type="string">
<annotation>
- <documentation>
- the name of a class that implements &lt;samp&gt;berry::IEditorMatchingStrategy&lt;/samp&gt;. This attribute should only be defined if the &lt;samp&gt;class&lt;/samp&gt; attribute is defined. This allows the editor extension to provide its own algorithm for matching the input of one of its editors to a given editor input.
- </documentation>
+
<appInfo>
<meta.attribute kind="java" basedOn="berry::IEditorMatchingStrategy"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="contentTypeBinding">
<annotation>
<appInfo>
<meta.element labelAttribute="contentTypeId"/>
</appInfo>
- <documentation>
- Advertises that the containing editor understands the given content type and is suitable for editing files of that type.
- </documentation>
+
</annotation>
<complexType>
<attribute name="contentTypeId" type="string" use="required">
<annotation>
- <documentation>
- The content type identifier. This is an ID defined by the &apos;org.blueberry.core.runtime.contentTypes&apos; extension point.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
- <documentation>
- The following is an example
-of an internal editor extension definition:
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.blueberry.ui.editors&quot;&gt;
- &lt;editor
- id=&quot;com.xyz.XMLEditor&quot;
- name=&quot;Fancy XYZ XML editor&quot;
- icon=&quot;./icons/XMLEditor.gif&quot;
- extensions=&quot;xml&quot;
- class=&quot;xyz::XMLEditor&quot;
- contributorClass=&quot;xyz::XMLEditorContributor&quot;
- default=&quot;false&quot;&gt;
- &lt;/editor&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
- <documentation>
- If the command attribute is used, it will be treated
-as an external program command line that will be executed
- in a platform-dependent manner.
-&lt;p&gt;
-If the launcher attribute is used the editor will also
-be treated as an external program. In this case the
-specified class must implement
-&lt;samp&gt;org.eclipse.ui.IEditorLauncher&lt;/samp&gt;.
-The launcher will be instantiated and then
-&lt;samp&gt;open(IPath path)&lt;/samp&gt; will be invoked to
-launch the editor on the provided local file system path.
-&lt;p&gt;
-If the class attribute is used, the workbench will
-assume that it is an internal editor and the specified
-class must implement &lt;samp&gt;org.eclipse.ui.IEditorPart&lt;/samp&gt;.
-It is common practice to
-&lt;samp&gt;subclass org.eclipse.ui.EditorPart&lt;/samp&gt; when
-defining a new editor type. It is also necessary to
-define a &lt;samp&gt;contributorClass&lt;/samp&gt; attribute.
-The specified class must implement
-&lt;samp&gt;org.eclipse.ui.IEditorActionBarContributor&lt;/samp&gt;,
-and is used to add new actions to the workbench
-menu and tool bar which reflect the features of the
-editor type.
-&lt;p&gt;
-Within the workbench there may be more than one open
-editor of a particular type. For instance, there may
-be one or more open Java Editors. To avoid the creation
-of duplicate actions and action images the editor
-concept has been split into two. An
-&lt;samp&gt;IEditorActionBarContributor&lt;/samp&gt; is responsible
-for the creation of actions. The editor is responsible
-for action implementation. Furthermore, the contributor
-is shared by each open editor. As a result of this
-design there is only one set of actions for one or
-more open editors.
-&lt;p&gt;
-The contributor will add new actions to the workbench
-menu and toolbar which reflect the editor type. These
-actions are shared and, when invoked, act upon the
-active editor. The active editor is passed to the
-contributor by invoking
-&lt;samp&gt;IEditorActionBarContributor.setActiveEditor&lt;/samp&gt;.
-The identifiers for actions and major groups within
-the workbench window are defined in
-&lt;samp&gt;org.eclipse.ui.IWorkbenchActionConstants&lt;/samp&gt;.
-These should be used as a reference point for the
-addition of new actions. Top level menus are created
-by using the following values for the path attribute:
-&lt;ul&gt;
-&lt;li&gt;
-additions - represents a group to the left of the Window menu.
-&lt;/li&gt;
-&lt;/ul&gt;
-Actions and menus added into these paths will only be
-shown while the associated editor is active. When the
-editor is closed, menus and actions will be removed.
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
- <documentation>
- The workbench provides a &quot;Default Text Editor&quot;. The end user product may contain other editors as part of the shipping bundle. In that case, editors will be registered as extensions using the syntax described above.
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
- <documentation>
- Copyright (c) 2002, 2007 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at &lt;a
-href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.ui.qt/schema/elementFactories.exsd b/Plugins/org.blueberry.ui.qt/schema/elementFactories.exsd
index ac2acf1c37..44c8041d9d 100644
--- a/Plugins/org.blueberry.ui.qt/schema/elementFactories.exsd
+++ b/Plugins/org.blueberry.ui.qt/schema/elementFactories.exsd
@@ -1,167 +1,83 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.ui">
<annotation>
<appInfo>
<meta.schema plugin="org.blueberry.ui" id="elementFactories" name="Element Factories"/>
</appInfo>
- <documentation>
- This extension point is used to add element factories
-to the workbench. An element factory is used to
-recreate &lt;samp&gt;IAdaptable&lt;/samp&gt; objects which are
-persisted during workbench shutdown.
-&lt;p&gt;
-As an example, the element factory is used to
-persist editor input. The input for an
-editor must implement
-&lt;samp&gt;berry::EditorInput&lt;/samp&gt;.
-The life cycle of an &lt;samp&gt;berry::IEditorInput&lt;/samp&gt; within
-an editor has a number of phases.
-&lt;ol&gt;
-&lt;li&gt;
-The initial input for an editor is passed in during
-editor creation.
-&lt;/li&gt;
-&lt;li&gt;
-On shutdown the workbench state is captured.
-In this process the workbench will create a memento
-for each open editor and its input. The input is
-saved as a two part memento containing a factory ID
-and any primitive data required to recreate the
-element on startup. For more information see
-the documentation on
-&lt;samp&gt;berry::IPersistableElement&lt;/samp&gt;.
-&lt;/li&gt;
-&lt;li&gt;
-On startup the workbench state is read and the
-editors from the previous session are recreated.
-In this process the workbench will recreate the input
-element for each open editor. To do this it will
-map the original factory ID for the input element
-to a concrete factory class defined in the registry.
-If a mapping exists, and the factory class is valid,
-an instance of the factory class is created. Then
-the workbench asks the factory to recreate the original
-element from the remaining primitive data within the
-memento. The resulting &lt;samp&gt;berry::IAdaptable&lt;/samp&gt; is cast
-to an &lt;samp&gt;berry::IEditorInput&lt;/samp&gt; and passed to the
-new editor.
-&lt;/li&gt;
-&lt;/ol&gt;
- </documentation>
+
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="factory" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
+
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="factory">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- a unique name that will be used to identify this factory.
- </documentation>
+
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified name of a class that implements
-&lt;samp&gt;berry::IElementFactory&lt;/samp&gt;
- </documentation>
+
<appInfo>
<meta.attribute kind="c++" basedOn="berry::IElementFactory"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
- <documentation>
- The following is an example of an element factory extension:
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension
- point = &quot;org.blueberry.ui.elementFactories&quot;&gt;
- &lt;factory
- id =&quot;com.xyz.ElementFactory&quot;
- class=&quot;xyz::ElementFactory&quot;&gt;
- &lt;/factory&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
- <documentation>
- The value of the &lt;samp&gt;class&lt;/samp&gt; attribute must
-be a fully qualified name of a class that implements
-&lt;samp&gt;berry::IElementFactory&lt;/samp&gt;. An instance
-of this class must create an &lt;samp&gt;berry::IAdaptable&lt;/samp&gt;
-object from a workbench memento.
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
- <documentation>
- The workbench provides an &lt;samp&gt;IResource&lt;/samp&gt; factory.
-Additional factories should be added to recreate other
-&lt;samp&gt;berry::IAdaptable&lt;/samp&gt; types commonly found in other
-object models.
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
- <documentation>
- Copyright (c) 2002, 2005 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at &lt;a
-href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.ui.qt/schema/handlers.exsd b/Plugins/org.blueberry.ui.qt/schema/handlers.exsd
old mode 100755
new mode 100644
index 1ce19c0c10..e67e0bbaef
--- a/Plugins/org.blueberry.ui.qt/schema/handlers.exsd
+++ b/Plugins/org.blueberry.ui.qt/schema/handlers.exsd
@@ -1,309 +1,185 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.eclipse.ui">
<annotation>
<appInfo>
<meta.schema plugin="org.eclipse.ui" id="handlers" name="Handlers"/>
</appInfo>
- <documentation>
- &lt;p&gt;
-The handlers extension point is an elaboration of the experimental &lt;code&gt;handlerSubmission&lt;/code&gt; element defined in Eclipse 3.0. A handler is the behaviour of a command at a particular point in time. A command can have zero or more handlers associated with it. At any one point in time, however, a command will either have no active handler or one active handler. The active handler is the one which is currently responsible for carrying out the behaviour of the command. This is very similar to the concept of an action handler and a retargettable action.
-&lt;/p&gt;
-&lt;p&gt;
-The handlers extension point allows a plug-in developer to specify a handler that should become active and/or enabled under certain conditions. If a handler is inactive, then no command will delegate its behaviour to the handler. If a handler is disabled, then the handler will not be asked to execute; execution of the handler is blocked. The conditions are defined using the expression language facility added during 3.0. They are expressed using &lt;code&gt;activeWhen&lt;/code&gt; and &lt;code&gt;enabledWhen&lt;/code&gt; clauses.
-&lt;/p&gt;
-&lt;p&gt;
-The workbench provides some variables that these expressions can rely on. Variables that are valid in activeWhen and enabledWhen expressions can be found in &lt;code&gt;org.eclipse.ui.ISources&lt;/code&gt;. The types of the variables are determined by the &lt;code&gt;org.eclipse.ui.ISourceProvider&lt;/code&gt; that provides them.
-&lt;/p&gt;
-&lt;p&gt;
-A handler that specifies no conditions is a default handler. A default handler is only active if no other handler has all of its conditions satisfied. If two handlers still have conditions that are satisfied, then the conditions are compared. The idea is to select a handler whose condition is more specific or more local. To do this, the variables referred to by the condition are looked at. The condition that refers to the most specific variable &quot;wins&quot;. The order of specificity (from least specific to most specific) is suggested in &lt;code&gt;org.eclipse.ui.ISources&lt;/code&gt;.
-&lt;/p&gt;
-&lt;p&gt;
-If this still doesn&apos;t resolve the conflict, then no handler is active. If a particular tracing option is turned on, then this leads to a message in the log. A conflict can also occur if there are two default handlers. It is the responsibility of the plug-in developers and integration testers to ensure that this does not happen.
-&lt;/p&gt;
-&lt;p&gt;
-These conditions are used to avoid unnecessary plug-in loading. These handler definitions are wrapped in a proxy. For a proxy to load its underlying handler, two things must happen: the conditions for the proxy must be met so that it becomes active, and the command must be asked to do something which it must delegate (e.g., execute(), isEnabled()).
-&lt;/p&gt;
- </documentation>
+
</annotation>
<include schemaLocation="schema://org.eclipse.core.expressions/schema/expressionLanguage.exsd"/>
<element name="extension">
<complexType>
<sequence>
<element ref="handler" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- </documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- </documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- </documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="handler">
<annotation>
- <documentation>
- &lt;p&gt;Associated a command with a handler implementation.&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<sequence>
<element ref="activeWhen" minOccurs="0" maxOccurs="1"/>
<element ref="class" minOccurs="0" maxOccurs="1"/>
<element ref="enabledWhen" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="commandId" type="string" use="required">
<annotation>
- <documentation>
- &lt;p&gt;The id of the command to associate with this handler implementation.&lt;/p&gt;
- </documentation>
+
</annotation>
</attribute>
<attribute name="class" type="string">
<annotation>
- <documentation>
- &lt;p&gt;The handler class that imlements &lt;code&gt;org.eclipse.core.commands.IHandler&lt;/code&gt; or extends &lt;code&gt;org.eclipse.core.commands.AbstractHandler&lt;/code&gt;.&lt;/p&gt;
- </documentation>
+
<appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.core.commands.IHandler"/>
</appInfo>
</annotation>
</attribute>
<attribute name="helpContextId" type="string">
<annotation>
- <documentation>
- &lt;p&gt;
-The identifier of the help context that relates to this specific handler. While a command can provide a general description of a command&apos;s behaviour, it is sometimes appropriate for a handler to provide help more specific to their implementation.
-&lt;/p&gt;
-&lt;p&gt;&lt;em&gt;Since: 3.2&lt;/em&gt;&lt;/p&gt;
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="activeWhen">
<annotation>
- <documentation>
- &lt;p&gt;Contains a core expression used by the &lt;code&gt;IHandlerService&lt;/code&gt; to determine when this handler is active.&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<choice>
<element ref="not"/>
<element ref="and"/>
<element ref="or"/>
<element ref="instanceof"/>
<element ref="test"/>
<element ref="systemTest"/>
<element ref="equals"/>
<element ref="count"/>
<element ref="with"/>
<element ref="resolve"/>
<element ref="adapt"/>
<element ref="iterate"/>
<element ref="reference"/>
</choice>
</complexType>
</element>
<element name="enabledWhen">
<annotation>
- <documentation>
- &lt;p&gt;Contains a core expression used by the workbench handler proxy to determine when this handler is enabled without loading it.&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<choice>
<element ref="not"/>
<element ref="and"/>
<element ref="or"/>
<element ref="instanceof"/>
<element ref="test"/>
<element ref="systemTest"/>
<element ref="equals"/>
<element ref="count"/>
<element ref="with"/>
<element ref="resolve"/>
<element ref="adapt"/>
<element ref="iterate"/>
<element ref="reference"/>
</choice>
</complexType>
</element>
<element name="class">
<annotation>
- <documentation>
- &lt;p&gt;Used when creating an &lt;code&gt;IExecutableExtension&lt;/code&gt; with a named parameter, or more than one.&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<sequence>
<element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="class" type="string">
<annotation>
- <documentation>
- &lt;p&gt;The handler class that imlements &lt;code&gt;org.eclipse.core.commands.IHandler&lt;/code&gt; or extends &lt;code&gt;org.eclipse.core.commands.AbstractHandler&lt;/code&gt;.&lt;/p&gt;
- </documentation>
+
<appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.core.commands.IHandler"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="parameter">
<annotation>
- <documentation>
- &lt;p&gt;A parameter for an &lt;code&gt;IExecutableExtension&lt;/code&gt;.&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- &lt;p&gt;The parameter name.&lt;/p&gt;
- </documentation>
+
</annotation>
</attribute>
<attribute name="value" type="string" use="required">
<annotation>
- <documentation>
- &lt;p&gt;The parameter value.&lt;/p&gt;
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
- <documentation>
- 3.1
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
- <documentation>
- &lt;p&gt;
-Variables that are valid in activeWhen and enabledWhen expressions can be found in &lt;code&gt;org.eclipse.ui.ISources&lt;/code&gt;. The types of the variables are determined by the &lt;code&gt;org.eclipse.ui.ISourceProvider&lt;/code&gt; that provides them.
-&lt;/p&gt;
-&lt;pre&gt;
-&lt;extension
- point=&quot;org.eclipse.ui.handlers&quot;&gt;
- &lt;handler
- commandId=&quot;commandId&quot;
- class=&quot;org.eclipse.compare.Command&quot;&gt;
- &lt;activeWhen&gt;
- &lt;with variable=&quot;selection&quot;&gt;
- &lt;count value=&quot;1&quot; /&gt;
- &lt;iterate operator=&quot;and&quot;&gt;
- &lt;adapt type=&quot;org.eclipse.core.resources.IResource&quot; /&gt;
- &lt;/iterate&gt;
- &lt;/with&gt;
- &lt;/activeWhen&gt;
- &lt;/handler&gt;
- &lt;handler
- commandId=&quot;other.commandId&quot;
- class=&quot;org.eclipse.ui.TalkToMe&quot;&gt;
- &lt;activeWhen&gt;
- &lt;with variable=&quot;activePartId&quot;&gt;
- &lt;equals value=&quot;org.eclipse.ui.views.SampleView&quot;/&gt;
- &lt;/with&gt;
- &lt;/activeWhen&gt;
- &lt;/handler&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
-&lt;p&gt;
-To further avoid plug-in loading, it is possible to specify when the handler is enabled. If the proxy has not yet loaded the handler, then only the expressions syntax is used to decide if the handler is enabled. If the proxy has loaded the handler, then the expressions syntax is consulted first. If the expressions syntax evaluates to true, then the handler is asked if it is enabled. (This is a short-circuit Boolean &quot;and&quot; operation between the expressions syntax and the handler&apos;s enabled state.)
-&lt;/p&gt;
-&lt;pre&gt;
-&lt;extension
- point=&quot;org.eclipse.ui.handlers&quot;&gt;
- &lt;handler
- commandId=&quot;commandId&quot;
- class=&quot;org.eclipse.Handler&quot;&gt;
- &lt;enabledWhen&gt;
- &lt;with variable=&quot;activeContexts&quot;&gt;
- &lt;iterator operator=&quot;or&quot;&gt;
- &lt;equals value=&quot;org.eclipse.ui.contexts.window&quot;/&gt;
- &lt;/iterator&gt;
- &lt;/with&gt;
- &lt;/enabledWhen&gt;
- &lt;/handler&gt;
-&lt;/extension&gt;
-&lt;/pre&gt;
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
- <documentation>
- &lt;p&gt;
-All handlers implement &lt;code&gt;org.eclipse.core.commands.IHandler&lt;/code&gt;, and can use &lt;code&gt;org.eclipse.core.commands.AbstractHandler&lt;/code&gt; as a base class. Within the workbench, it is possible to activate and deactivate handlers using the &lt;code&gt;org.eclipse.ui.handlers.IHandlerService&lt;/code&gt; interface. This interface can be retrieved from supporting workbench objects, such as &lt;code&gt;IWorkbench&lt;/code&gt; itself, a workbench window, or a part site. To retrieve the service, you would make a call like &lt;code&gt;IWorkbench.getService(IHandlerService.class)&lt;/code&gt;.
-&lt;/p&gt;
-&lt;p&gt;
-It is also possible to activate and deactive handlers using legacy code in the workbench. This can be done through the legacy mechanism shown below. This mechanism is useful to clients who are using actions to contribute to menus or toolbars. This is deprecated and not recommended.
-&lt;/p&gt;
-&lt;pre&gt;
- IWorkbenchPartSite mySite;
- IAction myAction;
-
- myAction.setActionDefinitionId(commandId);
- IKeyBindingService service = mySite.getKeyBindingService();
- service.registerAction(myAction);
-&lt;/pre&gt;
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
- <documentation>
- </documentation>
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
- <documentation>
- Copyright (c) 2005, 2007 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at &lt;a
-href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.ui.qt/schema/intro.exsd b/Plugins/org.blueberry.ui.qt/schema/intro.exsd
old mode 100755
new mode 100644
index b1badeb3bd..251b000a1e
--- a/Plugins/org.blueberry.ui.qt/schema/intro.exsd
+++ b/Plugins/org.blueberry.ui.qt/schema/intro.exsd
@@ -1,208 +1,141 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.ui" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.blueberry.ui" id="intro" name="Intro Part"/>
</appinfo>
- <documentation>
- &lt;p&gt;This extension point is used to register implementations of special workbench parts, called intro parts, that are responsible for introducing a product to new users. An intro part is typically shown the first time a product is started up. Rules for associating an intro part implementation with particular products are also contributed via this extension point.
-&lt;/p&gt;
-The life cycle is as follows:
-&lt;ul&gt;
-&lt;li&gt;The intro area is created on workbench start up. As with editor and view areas, this area is managed by an intro site (implementing &lt;code&gt;IIntroSite&lt;/code&gt;).&lt;/li&gt;
-&lt;li&gt;The id of the current product (Platform::GetProduct()) is used to choose the relevant intro part implementation.
-&lt;/li&gt;
-&lt;li&gt;The intro part class (implementing &lt;code&gt;IIntroPart&lt;/code&gt;) is created and initialized with the intro site.
-&lt;/li&gt;
-&lt;li&gt;While the intro part is showing to the user, it can transition back and forth between full and standby mode (either programmatically or explicitly by the user).
-&lt;/li&gt;
-&lt;li&gt;Eventually the intro part is closed (either programmatically or explicitly by the user). The current perspective takes over the entire workbench window area.
-&lt;/li&gt;
-&lt;/ul&gt;
- </documentation>
+
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence>
<element ref="intro" minOccurs="0" maxOccurs="unbounded"/>
<element ref="introProductBinding" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
+
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="intro">
<annotation>
<appinfo>
<meta.element labelAttribute="id" icon="icon"/>
</appinfo>
- <documentation>
- Specifies an introduction. An introduction is a product-specific presentation shown to first-time users on product start up.
- </documentation>
+
</annotation>
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- a unique identifier for this introduction
- </documentation>
+
</annotation>
</attribute>
<attribute name="icon" type="string">
<annotation>
- <documentation>
- a plug-in-relative file name of the icon that will be associated with this introduction
- </documentation>
+
<appinfo>
<meta.attribute kind="resource"/>
</appinfo>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified name of the class implementing the &lt;code&gt;berry::IIntroPart&lt;/code&gt; interface. A common practice
-is to subclass &lt;samp&gt;berry::IntroPart&lt;/samp&gt;
-in order to inherit the default functionality. This class implements the introduction.
- </documentation>
+
<appinfo>
<meta.attribute kind="java" basedOn=":berryIIntroPart"/>
</appinfo>
</annotation>
</attribute>
<attribute name="contentDetector" type="string">
<annotation>
- <documentation>
- a fully qualified name of a class extending &lt;code&gt;berry::IntroContentDetector&lt;/code&gt;. This optional class is used to detect newly added introduction content. If new content is available, the view showing the introduction will be opened again.
- </documentation>
+
<appinfo>
<meta.attribute kind="java" basedOn=":berryIntroContentDetector"/>
</appinfo>
</annotation>
</attribute>
<attribute name="label" type="string">
<annotation>
- <documentation>
- an string label for this introduction that will be used in the construction of the open action as well as the part label.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="introProductBinding">
<annotation>
- <documentation>
- Specifies a binding between a product and an introduction. These bindings determine which introduction is appropriate for the current product (as defined by &lt;code&gt;Platform::GetProduct()&lt;/code&gt;).
- </documentation>
+
</annotation>
<complexType>
<attribute name="productId" type="string" use="required">
<annotation>
- <documentation>
- unique id of a product
- </documentation>
+
</annotation>
</attribute>
<attribute name="introId" type="string" use="required">
<annotation>
- <documentation>
- unique id of an introduction
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
- <documentation>
- 3.0
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
- <documentation>
- The following is an example of an intro part extension that contributes an particular introduction and associates it with a particular product:
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.eclipse.ui.intro&quot;&gt;
- &lt;intro
- id=&quot;com.example.xyz.intro.custom&quot;
- class=&quot;com.example.xyz.intro.IntroPart&quot;/&gt;
- &lt;introProductBinding
- productId=&quot;com.example.xyz.Product&quot;
- introId=&quot;com.example.xyz.intro.custom&quot;/&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="apiInfo"/>
</appinfo>
- <documentation>
- The value of the &lt;code&gt;class&lt;/code&gt; attribute must be the fully qualified name of a class that implements the&lt;code&gt;org.eclipse.ui.intro.IIntroPart&lt;/code&gt; interface by subclassing &lt;code&gt;org.eclipse.ui.part.intro.IntroPart&lt;/code&gt;.
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
- <documentation>
- There are no default implementations of the initial user experience. Each Eclipse-based product is responsible for providing one that is closely matched to its branding and function.
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="copyright"/>
</appinfo>
- <documentation>
- Copyright (c) 2004, 2007 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at &lt;a
-href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.ui.qt/schema/keywords.exsd b/Plugins/org.blueberry.ui.qt/schema/keywords.exsd
index ac8a532caf..ec4dc4cf50 100644
--- a/Plugins/org.blueberry.ui.qt/schema/keywords.exsd
+++ b/Plugins/org.blueberry.ui.qt/schema/keywords.exsd
@@ -1,127 +1,89 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.ui">
<annotation>
<appInfo>
<meta.schema plugin="org.blueberry.ui" id="keywords" name="Keywords"/>
</appInfo>
- <documentation>
- The keywords extension point defines keywords and a unique id for reference by other schemas.
-See propertyPages and preferencePages.
- </documentation>
</annotation>
<element name="extension">
<annotation>
- <documentation>
- </documentation>
+
</annotation>
<complexType>
<choice>
<element ref="keyword" minOccurs="0" maxOccurs="unbounded"/>
</choice>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
+
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="keyword">
<annotation>
- <documentation>
- </documentation>
+
</annotation>
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- The id is the unique id used to reference the keyword.
- </documentation>
+
</annotation>
</attribute>
<attribute name="label" type="string" use="required">
<annotation>
- <documentation>
- The human readable label of the keyword
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
- <documentation>
- The following is an example of a keyword extension:
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension
- point=&quot;org.blueberry.ui.keywords&quot;&gt;
- &lt;keyword
- label=&quot;presentation tab themes&quot;
- id=&quot;com.xyz.AppearanceKeywords&quot;/&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
- <documentation>
- There currently is no public API for retrieving or creating keywords other than this extension point.
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
- <documentation>
- Keywords are used only with preference and property pages. See the &lt;samp&gt;keywordReference&lt;/samp&gt; element of the org.blueberry.ui.propertyPages and org.blueberry.ui.preferencePages extension points.
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
- <documentation>
- Copyright (c) 2005,2006 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at &lt;a
-href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.ui.qt/schema/menus.exsd b/Plugins/org.blueberry.ui.qt/schema/menus.exsd
index ecae8da9b0..ff38e6bcf1 100644
--- a/Plugins/org.blueberry.ui.qt/schema/menus.exsd
+++ b/Plugins/org.blueberry.ui.qt/schema/menus.exsd
@@ -1,646 +1,442 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.ui" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appInfo>
<meta.schema plugin="org.blueberry.ui" id="menus" name="Menus"/>
</appInfo>
- <documentation>
-&lt;p&gt;
-This extension point allows the plug-in developer to add (contribute) a variety of custom additions to the BlueBerry framework:
-&lt;ul&gt;
- &lt;li&gt;Main Menu&lt;/li&gt;
- &lt;li&gt;Main Toolbars&lt;/li&gt;
- &lt;li&gt;View Menus/Toolbars:
- &lt;ul&gt;
- &lt;li&gt;View Dropdown Menu&lt;/li&gt;
- &lt;li&gt;View Toolbar&lt;/li&gt;
- &lt;li&gt;Context Menu(s)&lt;/li&gt;
- &lt;/ul&gt;
- &lt;/li&gt;
- &lt;li&gt;Trim&lt;/li&gt;
-&lt;/ul&gt;
-&lt;/p&gt;
-&lt;p&gt;
-The general strategy for this mechanism is to separate the &apos;location&apos; where the contributions should be inserted from the visibility and enablement state of the element. Each contribution first defines its insertion location through a Menu &apos;URI&apos;, a string (loosely) formatted according to the jave.net.URI format:
-&lt;/p&gt;&lt;p&gt;
-&lt;b&gt;&quot;[Scheme]:[ID]?[ArgList]&quot;&lt;/b&gt;
-&lt;ul&gt;
-&lt;li&gt;&lt;b&gt;Scheme&lt;/b&gt; - The &apos;type&apos; of the UI component into which the contributions will be added. It may be either &quot;menu&quot;, &quot;popup&quot; or &quot;toolbar&quot;. While &apos;popup&apos; is indeed a form of menu it is provided to allow a distinction between a view&apos;s &apos;chevron&apos; menu (for which we use the &quot;menu&quot; scheme) and its default context menu which, by convention, should be registered using the &quot;popup&quot; scheme.&lt;/li&gt;
-&lt;li&gt;&lt;b&gt;ID&lt;/b&gt; - This is the id of menu or toolbar into which the contributions should be added. By convention views should use their view id as the id of the root of their chevron and default popup menu. Note that there is no explicit distinction between contributions supporting editors and &apos;normal&apos; contributions into the Menu Menu or Toolbar; both global contributions and editor contributions would use the &quot;org.blueberry.ui.main.menu&quot; id or &quot;org.blueberry.ui.main.toolbar&quot;. A special id used with popup:, &quot;org.blueberry.ui.popup.any&quot;, is reserved to handle contributions which are candidates to appear on any (top level) context menu. Note that these contributions are expected to implement a &apos;visibleWhen&apos; expression sufficient to limit their visibility to appropriate menus&lt;/li&gt;
-&lt;li&gt;&lt;b&gt;Query&lt;/b&gt; - This field allows fine-grained definition of the specific location &lt;i&gt;within&lt;/i&gt; a given menu. It has the form &quot;[placement]=[id]&quot; where placement is one of &quot;before&quot;, &quot;after&quot;, or &quot;endof&quot; and the id is expected to be the id of some IContributionItem in the menu.&lt;/li&gt;
-&lt;/ul&gt;
-&lt;p&gt;
-This will define the location at which the contributions will appear in the BlueBerry UI. Once the insertion point has been defined the rest of the contributions describe the UI elements that will be added at that location. Each element supports a &apos;visibleWhen&apos; expression that determines at run time whether a particular item should appear in the menu based on the system&apos;s current state (selection, active view/editor, context...). See &lt;code&gt;berry::ISources&lt;/code&gt; for a list of currently
-supported variables.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<include schemaLocation="schema://org.blueberry.core.expressions/schema/expressionLanguage.exsd"/>
<element name="extension">
<annotation>
<appInfo>
<meta.element />
</appInfo>
</annotation>
<complexType>
<sequence>
<element ref="group" minOccurs="0" maxOccurs="unbounded"/>
<element ref="widget" minOccurs="0" maxOccurs="unbounded"/>
<element ref="menuContribution" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- org.blueberry.ui.menus
- </documentation>
+
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- An optional identifier of the extension instance.
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- An optional name of the extension instance.
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="class">
<annotation>
- <documentation>
- A class element supporting the executable extension parsing syntax for both &lt;code&gt;widget&lt;/code&gt; and &lt;code&gt;dynamic&lt;/code&gt; elements.
- </documentation>
+
</annotation>
<complexType>
<sequence>
<element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- The class to load as an &lt;code&gt;IExecutableExtension&lt;/code&gt;.
- </documentation>
+
<appInfo>
<meta.attribute kind="java"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="visibleWhen">
<annotation>
- <documentation>
- A core Expression that controls the visibility of the given element.
- </documentation>
+
</annotation>
<complexType>
<choice minOccurs="0" maxOccurs="1">
<element ref="not"/>
<element ref="or"/>
<element ref="and"/>
<element ref="instanceof"/>
<element ref="test"/>
<element ref="systemTest"/>
<element ref="equals"/>
<element ref="count"/>
<element ref="with"/>
<element ref="resolve"/>
<element ref="adapt"/>
<element ref="iterate"/>
<element ref="reference"/>
</choice>
<attribute name="checkEnabled" type="boolean" use="default" value="false">
<annotation>
- <documentation>
- If this attribute is set to &lt;code&gt;true&lt;/code&gt;, then there should be no sub-elements. This just checks the enabled state of the command, and makes the corresponding element visible if the command is enabled.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="parameter">
<annotation>
- <documentation>
- A parameter to either an executable extension or a command -- depending on where it appears in the extension.
- </documentation>
+
</annotation>
<complexType>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- The name is either the name of the parameter to pass to the executable extension, or the identifier of the parameter for the command.
- </documentation>
+
<appInfo>
<meta.attribute kind="identifier" basedOn="org.blueberry.ui.commands/command/commandParameter/@id"/>
</appInfo>
</annotation>
</attribute>
<attribute name="value" type="string" use="required">
<annotation>
- <documentation>
- The value to pass for this parameter.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="menuContribution">
<annotation>
- <documentation>
- &lt;p&gt;Defines an ordered set of additions to the command UI structure. The defined elements will be added into the command UI structure at the location specified by the &lt;code&gt;locationURI&lt;/code&gt; element.
-&lt;/p&gt;&lt;p&gt;
-This should be the starting point for &lt;i&gt;all&lt;/i&gt; contributions into menus, toolbars or trim, wherever they occur in the UI.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<sequence>
<element ref="menu" minOccurs="0" maxOccurs="unbounded"/>
<element ref="command" minOccurs="0" maxOccurs="unbounded"/>
<element ref="separator" minOccurs="0" maxOccurs="unbounded"/>
<element ref="dynamic" minOccurs="0" maxOccurs="unbounded"/>
<element ref="toolbar" minOccurs="0" maxOccurs="unbounded"/>
<element ref="control" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="locationURI" type="string" use="required">
<annotation>
- <documentation>
- A &lt;code&gt;URI&lt;/code&gt; specification that defines the insertion point at which the contained additions will be added.
-
-The format for the URI is comprised of three basic parts:
-Scheme: One of &quot;menu&quot;, &quot;popup&quot; or &quot;toolbar. Indicates the type of the manager used to handle the contributions
-Id: This is either the id of an existing menu, a view id or the id of the editor &apos;type&apos;
-Query: The query format is &amp;lt;placement&amp;gt;=&amp;lt;id&amp;gt; where:
- &amp;lt;placement&amp;gt; is either &quot;before&quot;, &quot;after&quot;, or &quot;endof&quot; and
- &amp;lt;id&amp;gt; is the id of an existing menu item. The placement modifier is executed when this contribution is processed. Following contributions may change the final shape of the menu when they are processed.
- </documentation>
</annotation>
</attribute>
<attribute name="class" type="string">
<annotation>
- <documentation>
- If this optional attribute is specified the provided class will be instantiated and used to provide menu contributions at this location. If provided, all child elements will be ignored.
- </documentation>
+
<appInfo>
<meta.attribute kind="java" basedOn="org.blueberry.ui.menus.ExtensionContributionFactory:"/>
</appInfo>
</annotation>
</attribute>
<attribute name="allPopups" type="boolean" use="default" value="false">
<annotation>
- <documentation>
- By default popup contributions are not contributed to context menus that do not include an &lt;b&gt;additions&lt;/b&gt; marker.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="menu">
<annotation>
- <documentation>
- Defines a new menu contribution at the given insertion point.
- </documentation>
+
</annotation>
<complexType>
<sequence minOccurs="0" maxOccurs="1">
<element ref="visibleWhen" minOccurs="0" maxOccurs="1"/>
<choice minOccurs="0" maxOccurs="unbounded">
<element ref="menu" minOccurs="0" maxOccurs="1"/>
<element ref="command" minOccurs="0" maxOccurs="1"/>
<element ref="separator" minOccurs="0" maxOccurs="1"/>
<element ref="dynamic" minOccurs="0" maxOccurs="1"/>
</choice>
</sequence>
<attribute name="label" type="string" use="required">
<annotation>
- <documentation>
- The label to be displayed for this element when it is placed in either a menu or a toolbar. This value should be translatable.
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- The &apos;id&apos; of this menu contribution. If defined then it can be extended through other &apos;menuAddition&apos; elements or the id can be used as a reference in the Query part of the location defining whether the additions are to go before or after this element.
- </documentation>
+
</annotation>
</attribute>
<attribute name="mnemonic" type="string">
<annotation>
- <documentation>
- The character of the Label that should be given the mnemonic affordance. This is to allow the menu system to re-define the value during translation without having to understand the various platforms&apos; conventions for menu label definition (i.e. using the &apos;&amp;amp;&apos; character...).
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
<attribute name="icon" type="string">
<annotation>
- <documentation>
- A plugin relative path to the image to be used as the icon for this menu in either a menu or a toolbar.
- </documentation>
+
<appInfo>
<meta.attribute kind="resource"/>
</appInfo>
</annotation>
</attribute>
<attribute name="tooltip" type="string">
<annotation>
- <documentation>
- The tooltip to be displayed for this element when it is placed in a toolbar. This value should be translatable.
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
<attribute name="commandId" type="string">
<annotation>
- <documentation>
- Th commandId is used to update the submenu text with a keyboard shortcut. The command should have a handler that can launch a quickmenu version of this menu.
- </documentation>
+
<appInfo>
<meta.attribute kind="identifier" basedOn="org.blueberry.ui.commands/command/@id"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="command">
<annotation>
- <documentation>
- Defines a new Command Contribution at the defined insertion point.
- </documentation>
+
</annotation>
<complexType>
<sequence>
<element ref="visibleWhen" minOccurs="0" maxOccurs="1"/>
<element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="label" type="string">
<annotation>
- <documentation>
- The label to be displayed for this element when it is placed in either a menu. This value should be translatable.
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
<attribute name="commandId" type="string" use="required">
<annotation>
- <documentation>
- This is the id of the Command that is to be bound to this element. This is the hook into the Commands/Handlers/Key binding services that actually do the work should this item be selected. In many cases this command will have been defined in a previous extension declaration.
- </documentation>
+
<appInfo>
<meta.attribute kind="identifier" basedOn="org.blueberry.ui.commands/command/@id"/>
</appInfo>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- The &apos;id&apos; of this contribution. If defined then it can be used as a reference in the Query part of the location defining whether the additions are to go before or after this element.
- </documentation>
+
</annotation>
</attribute>
<attribute name="mnemonic" type="string">
<annotation>
- <documentation>
- The character of the Label that should be given the mnemonic affordance. This is to allow the menu system to re-define the value during translation without having to understand the various platforms&apos; conventions for menu label definition (i.e. using the &apos;&amp;amp;&apos; character...).
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
<attribute name="icon" type="string">
<annotation>
- <documentation>
- a relative path of an icon used to visually represent the action in its context.
-If omitted and the action appears in the toolbar, the Workbench will use a placeholder icon. The path is relative to the location of the plugin.xml file of the contributing plug-in, or the &lt;code&gt;ISharedImages&lt;/code&gt; constant.
- </documentation>
+
<appInfo>
<meta.attribute kind="resource"/>
</appInfo>
</annotation>
</attribute>
<attribute name="disabledIcon" type="string">
<annotation>
- <documentation>
- a relative path of an icon used to visually represent the action in its context when the action is disabled. If omitted, the normal icon will simply appear greyed out. The path is relative to the location of the plugin.xml file of the contributing plug-in. The disabled icon will appear in toolbars but not in menus. Icons for disabled actions in menus will be supplied by the OS.
- </documentation>
+
<appInfo>
<meta.attribute kind="resource"/>
</appInfo>
</annotation>
</attribute>
<attribute name="hoverIcon" type="string">
<annotation>
- <documentation>
- a relative path of an icon used to visually represent the action in its context when the mouse pointer is over the action. If omitted, the normal icon will be used. The path is relative to the location of the plugin.xml file of the contributing plug-in.
- </documentation>
+
<appInfo>
<meta.attribute kind="resource"/>
</appInfo>
</annotation>
</attribute>
<attribute name="tooltip" type="string">
<annotation>
- <documentation>
- The tooltip to be displayed for this element when it is placed in a toolbar. This value should be translatable.
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
<attribute name="helpContextId" type="string">
<annotation>
- <documentation>
- a unique identifier indicating the help context for this action. If the action appears as a menu item, then pressing F1 while the menu item is highlighted will display help. This overrides the help context id provided by the active handler or command.
- </documentation>
+
</annotation>
</attribute>
<attribute name="style" use="default" value="push">
<annotation>
- <documentation>
- an attribute to define the user interface style type for the action. If omitted, then it is &lt;samp&gt;push&lt;/samp&gt; by default. The attribute value will be one of the following:
- &lt;table border=&quot;0&quot; width=&quot;80%&quot;&gt;
- &lt;tr&gt;
- &lt;td valign=&quot;top&quot; width=&quot;25&quot;&gt;&lt;/td&gt;
- &lt;td valign=&quot;top&quot; nowrap&gt;&lt;b&gt;push&lt;/b&gt;&lt;/td&gt;
- &lt;td valign=&quot;top&quot;&gt;- as a regular menu item or tool item.&lt;/td&gt;
- &lt;/tr&gt;
- &lt;tr&gt;
- &lt;td valign=&quot;top&quot; width=&quot;25&quot;&gt;&lt;/td&gt;
- &lt;td valign=&quot;top&quot; nowrap&gt;&lt;b&gt;radio&lt;/b&gt;&lt;/td&gt;
- &lt;td valign=&quot;top&quot;&gt;- as a radio style menu item or tool item. Actions with the radio style within the same menu or toolbar group behave as a radio set. The initial value is specified by the &lt;samp&gt;state&lt;/samp&gt; attribute.&lt;/td&gt;
- &lt;/tr&gt;
- &lt;tr&gt;
- &lt;td valign=&quot;top&quot; width=&quot;25&quot;&gt;&lt;/td&gt;
- &lt;td valign=&quot;top&quot; nowrap&gt;&lt;b&gt;toggle&lt;/b&gt;&lt;/td&gt;
- &lt;td valign=&quot;top&quot;&gt;- as a checked style menu item or as a toggle tool item. The initial value is specified by the &lt;samp&gt;state&lt;/samp&gt; attribute.&lt;/td&gt;
- &lt;/tr&gt;
- &lt;tr&gt;
- &lt;td valign=&quot;top&quot; width=&quot;25&quot;&gt;&lt;/td&gt;
- &lt;td valign=&quot;top&quot; nowrap&gt;&lt;b&gt;pulldown&lt;/b&gt;&lt;/td&gt;
- &lt;td valign=&quot;top&quot;&gt;- (ToolBar only) Creates a ToolItem with the &lt;code&gt;SWT.DROP_DOWN&lt;/code&gt; affordance. The URI of the menu is &quot;menu:&quot; + this item&apos;s ID.&lt;/td&gt;
- &lt;/tr&gt;
- &lt;/table&gt;
- </documentation>
+
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="push">
</enumeration>
<enumeration value="radio">
</enumeration>
<enumeration value="toggle">
</enumeration>
<enumeration value="pulldown">
</enumeration>
</restriction>
</simpleType>
</attribute>
<attribute name="mode">
<annotation>
- <documentation>
- For commands appearing in a toolbar, &lt;code&gt;FORCE_TEXT&lt;/code&gt; will show text even if there is an icon. See CommandContributionItem.
- </documentation>
+
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="FORCE_TEXT">
</enumeration>
</restriction>
</simpleType>
</attribute>
</complexType>
</element>
<element name="separator">
<annotation>
- <documentation>
- Inserts a separator at the current insertion point.
- </documentation>
+
</annotation>
<complexType>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- The &apos;id&apos; of this contribution. If defined then it can be used as a reference in the Query part of the location defining whether the additions are to go before or after this element (or at the end of the logical group containing this element using the &apos;endof&apos; value).
-&lt;p&gt;
-Separator contributions that have an id define the start of a logical group so the result of using the &apos;endof&apos; value for placement is to search forward in the current menu to locate the next separator and to place the inserted elements before that element. If no trailing separator is found then the items are placed at the end of the menu.
-&lt;/p&gt;
- </documentation>
+
</annotation>
</attribute>
<attribute name="visible" type="boolean">
<annotation>
- <documentation>
- Indicates whether or not the separator should be visible in the UI. &lt;code&gt;false&lt;/code&gt; by default.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="toolbar">
<annotation>
- <documentation>
- Contributes a new ToolBar at the current insertion point. This element is only currently valid for CoolBarManagers, which can contain toolbars. For example, the trim location URIs specified in &lt;code&gt;org.blueberry.ui.menus.MenuUtil&lt;/code&gt;.
- </documentation>
+
</annotation>
<complexType>
<sequence minOccurs="0" maxOccurs="1">
<element ref="visibleWhen" minOccurs="0" maxOccurs="1"/>
<choice minOccurs="0" maxOccurs="unbounded">
<element ref="command" minOccurs="0" maxOccurs="1"/>
<element ref="separator" minOccurs="0" maxOccurs="1"/>
<element ref="dynamic" minOccurs="0" maxOccurs="1"/>
<element ref="control" minOccurs="0" maxOccurs="1"/>
</choice>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- The &apos;id&apos; of this toolbar contribution. If defined then it can be extended through other &apos;menuAddition&apos; elements or the id can be used as a reference in the Query part of the location defining whether the additions are to go before or after this element.
- </documentation>
+
</annotation>
</attribute>
<attribute name="label" type="string">
<annotation>
- <documentation>
- The label to be displayed for this element when it is displayed in the customize perspective dialog. This value should be translatable.
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="control">
<annotation>
- <documentation>
- Used to contribute controls to ToolBars in the workbench. The &apos;class&apos; attribute must be a derivative of the
-WorkbenchWindowControlContribution base class.
-&lt;p&gt;
-&lt;b&gt;NOTE:&lt;/b&gt; Due to platform restrictions control contributions are only supported for toolbars; Attempts to contribute controls into a menu or popup will be treated as a NO-OP.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<complexType>
<sequence>
<element ref="visibleWhen" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="id" type="string">
<annotation>
- <documentation>
- The &apos;id&apos; of this menu contribution. If defined then it can be used as a reference in the Query part of the location defining whether the additions are to go before or after this element.
- </documentation>
+
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- The class which will be used to create the control that is to be hosted in a ToolBar. This must be a subclass of
-WorkbenchWindowControlContribution which provides information as to the control&apos;s location (i.e. which workbench window it&apos;s being hosted in and the side of the window that it is currently being displayed on.
- </documentation>
+
<appInfo>
<meta.attribute kind="java" basedOn="org.blueberry.ui.menus.WorkbenchWindowControlContribution"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="dynamic">
<annotation>
- <documentation>
- The element provides a mechanism that will call back into the defined class to provide an IContributionItem to be shown when the menu or toolbar is built. The defined class must be a derivative of the org.blueberry.jface.action.ContributionItem base class. It can also use org.blueberry.ui.action.CompoundContributionItem and provide an implementation for the abstract &lt;code&gt;getContributionItems&lt;/code&gt; method to provide a dynamic menu item.
- </documentation>
+
</annotation>
<complexType>
<sequence>
<element ref="class" minOccurs="0" maxOccurs="1"/>
<element ref="visibleWhen" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- A unique identifier for this contribution. It is recommended that the identifier be prefixed by the plug-in name, to guarantee uniqueness. For example, a widget contributed by &lt;code&gt;org.blueberry.ui&lt;/code&gt; might be called &lt;code&gt;org.blueberry.ui.widget1&lt;/code&gt;.
-&lt;p&gt;
-If defined then it can be used as a reference in the Query part of the location defining whether the additions are to go before or after this element (or at the end of the logical group containing this element using the &apos;endof&apos; value).
-&lt;/p&gt;
- </documentation>
+
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- This class is expected to be a subclass of ContributionItem. The item may implement IWorkbenchContribution to be provided an IServiceLocator.
- </documentation>
+
<appInfo>
<meta.attribute kind="java" basedOn="org.blueberry.jface.action.ContributionItem"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
- <documentation>
- &lt;p&gt;
-It is preferred that menu contributions be added in the &lt;code&gt;plugin.xml&lt;/code&gt;. Plugins can
-programmatically add their own menu contributions using &lt;code&gt;org.blueberry.ui.menus.IMenuService&lt;/code&gt; and &lt;code&gt;org.blueberry.ui.menus.AbstractContributionFactory&lt;/code&gt;, but should be sure to remove them if the plugin is unloaded. The &lt;code&gt;IMenuService&lt;/code&gt; can be retrieved through any of the &lt;code&gt;IServiceLocators&lt;/code&gt;, the workbench, the workbench window, or the part site.
-&lt;/p&gt;
-&lt;p&gt;
-See &lt;a href=&quot;org_blueberry_ui_commands.html&quot;&gt;org.blueberry.ui.commands&lt;/a&gt; to define a command and &lt;a href=&quot;org_blueberry_ui_handlers.html&quot;&gt;org.blueberry.ui.handlers&lt;/a&gt; to define an implementation for the command.
-&lt;/p&gt;
-&lt;p&gt;To register a context menu, use the &lt;code&gt;IWorkbenchPartSite.registerContextMenu&lt;/code&gt; methods.&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="since"/>
</appInfo>
- <documentation>
- 3.3
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
- <documentation>
- &lt;p&gt;
-A basic extension looks like this.
-&lt;/p&gt;
-&lt;pre&gt;
- &lt;extension
- id=&quot;add.item&quot;
- point=&quot;org.blueberry.ui.menus&quot;&gt;
- &lt;menuContribution
- locationURI=&quot;menu:someorg.somemenu.id?after=additions&quot;&gt;
- &lt;command
- commandId=&quot;someorg.someid.someCommand&quot;
- icon=&quot;icons/anything.gif&quot;
- id=&quot;someorg.someid.BasicCmdItem&quot;
- label=&quot;Simple Item&quot;
- mnemonic=&quot;S&quot;&gt;
- &lt;/command&gt;
- &lt;/menuContribution&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;p&gt;
-This is the simplest example; adding a command contribution after an existing menu&apos;s additions group.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
- <documentation>
- Copyright (c) 2005,2007 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at &lt;a
-href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.ui.qt/schema/perspectiveExtensions.exsd b/Plugins/org.blueberry.ui.qt/schema/perspectiveExtensions.exsd
index d908729c13..7abf492647 100644
--- a/Plugins/org.blueberry.ui.qt/schema/perspectiveExtensions.exsd
+++ b/Plugins/org.blueberry.ui.qt/schema/perspectiveExtensions.exsd
@@ -1,373 +1,267 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.ui" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appInfo>
<meta.schema plugin="org.blueberry.ui" id="perspectiveExtensions" name="Perspective Extensions"/>
</appInfo>
- <documentation>
- This extension point is used to extend perspectives
-registered by other plug-ins. A perspective defines
-the initial contents of the window action bars
-(menu and toolbar) and the initial set of views
-and their layout within a workbench page.
-Other plug-ins may contribute actions or views to
-the perspective which appear when the perspective
-is selected. Optional additions by other plug-ins
-are appended to the initial definition.
- </documentation>
+
</annotation>
<element name="extension">
<annotation>
<appInfo>
<meta.element />
</appInfo>
</annotation>
<complexType>
<sequence>
<element ref="perspectiveExtension" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
+
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="perspectiveExtension">
<annotation>
<appInfo>
<meta.element labelAttribute="targetID"/>
</appInfo>
</annotation>
<complexType>
<choice minOccurs="0" maxOccurs="unbounded">
<element ref="actionSet"/>
<element ref="viewShortcut"/>
<element ref="perspectiveShortcut"/>
<element ref="newWizardShortcut"/>
<element ref="view"/>
<element ref="showInPart"/>
<element ref="hiddenMenuItem"/>
<element ref="hiddenToolBarItem"/>
</choice>
<attribute name="targetID" use="required">
<annotation>
- <documentation>
- the unique identifier of the perspective (as specified in the registry) into which the contribution is made. If the value is set to &quot;*&quot; the extension is applied to all perspectives.
- </documentation>
+
<appInfo>
<meta.attribute kind="identifier" basedOn="org.blueberry.ui.perspectives/perspective/@id"/>
</appInfo>
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="*">
</enumeration>
</restriction>
</simpleType>
</attribute>
</complexType>
</element>
<element name="actionSet">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- the unique identifier of the action set which will be added to the perspective.
- </documentation>
+
<appInfo>
<meta.attribute kind="identifier" basedOn="org.blueberry.ui.actionSets/actionSet/@id"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="viewShortcut">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- the unique identifier of the view which will be added to the perspective&apos;s &quot;Show View&quot; submenu of the &quot;Window&quot; menu.
- </documentation>
+
<appInfo>
<meta.attribute kind="identifier" basedOn="org.blueberry.ui.views/view/@id"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="perspectiveShortcut">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- the unique identifier of the perspective which will be added to the perspective&apos;s &quot;Open Perspective&quot; submenu of the &quot;Window&quot; menu.
- </documentation>
+
<appInfo>
<meta.attribute kind="identifier" basedOn="org.blueberry.ui.perspectives/perspective/@id"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="newWizardShortcut">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- the unique identifier of the new wizard which will be added to the perspective&apos;s &quot;New&quot; submenu of the &quot;File&quot; menu.
- </documentation>
+
<appInfo>
<meta.attribute kind="identifier" basedOn="org.blueberry.ui.newWizards/wizard/@id"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="showInPart">
<complexType>
<attribute name="id" type="string">
<annotation>
- <documentation>
- the unique identifier of the view which will be added to the perspective&apos;s &quot;Show In...&quot; prompter in the Navigate menu.
- </documentation>
+
<appInfo>
<meta.attribute kind="identifier" basedOn="org.blueberry.ui.views/view/@id"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="view">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- the unique identifier of the view which will be added to the perspective layout.
- </documentation>
+
<appInfo>
<meta.attribute kind="identifier" basedOn="org.blueberry.ui.views/view/@id"/>
</appInfo>
</annotation>
</attribute>
<attribute name="relative">
<annotation>
- <documentation>
- the unique identifier of a view which already exists in the perspective. This will be used as a reference point for placement of the view. The relationship between these two views is defined by &lt;samp&gt;relationship&lt;/samp&gt;. Ignored if relationship is &quot;fast&quot;.
- </documentation>
+
<appInfo>
<meta.attribute kind="identifier" basedOn="org.blueberry.ui.views/view/@id"/>
</appInfo>
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="org.blueberry.ui.editorss">
</enumeration>
</restriction>
</simpleType>
</attribute>
<attribute name="relationship" use="required">
<annotation>
- <documentation>
- specifies the relationship between &lt;samp&gt;id&lt;/samp&gt; and
-&lt;samp&gt;relative&lt;/samp&gt;.
-The following values are supported:
-&lt;ul&gt;
-&lt;b&gt;fast&lt;/b&gt; - the view extension will be created as a fast view.
-&lt;br&gt;&lt;b&gt;stack&lt;/b&gt; - the view extension will be stacked with the relative
-view in a folder.
-&lt;br&gt;&lt;b&gt;left, right, top, bottom&lt;/b&gt; - the view extension will be placed
-beside the relative view. In this case a &lt;samp&gt;ratio&lt;/samp&gt; must also
-be defined.&lt;/ul&gt;
- </documentation>
+
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="stack">
</enumeration>
<enumeration value="left">
</enumeration>
<enumeration value="right">
</enumeration>
<enumeration value="top">
</enumeration>
<enumeration value="bottom">
</enumeration>
<enumeration value="fast">
</enumeration>
</restriction>
</simpleType>
</attribute>
<attribute name="ratio" type="string">
<annotation>
- <documentation>
- the percentage of area within the relative view which will be donated to the view extension. If the view extension is a fast view, the ratio is the percentage of the workbench the fast view will cover when active. This must be defined as a floating point value and lie between 0.05 and 0.95.
- </documentation>
+
</annotation>
</attribute>
<attribute name="visible" type="boolean">
<annotation>
- <documentation>
- whether the view is initially visible when the perspective is opened. This attribute should have a value of &quot;true&quot; or &quot;false&quot; if used.
-If this attribute is not used, the view will be initially visible by default.
- </documentation>
+
</annotation>
</attribute>
<attribute name="closeable" type="boolean">
<annotation>
- <documentation>
- whether the view is closeable in the target perspective. This attribute should have a value of &quot;true&quot; or &quot;false&quot; if used. If this attribute is not used, the view will be closeable, unless the perspective itself is marked as fixed.
- </documentation>
+
</annotation>
</attribute>
<attribute name="moveable" type="boolean">
<annotation>
- <documentation>
- whether the view is moveable. A non-moveable view cannot be moved either within the same folder, or moved between folders in the perspective. This attribute should have a value of &quot;true&quot; or &quot;false&quot; if used.
-If this attribute is not used, the view will be moveable, unless the perspective itself is marked as fixed.
- </documentation>
+
</annotation>
</attribute>
<attribute name="standalone" type="boolean">
<annotation>
- <documentation>
- whether the view is a standalone view. A standalone view cannot be docked together with others in the same folder. This attribute should have a value of &quot;true&quot; or &quot;false&quot; if used. This attribute is ignored if the relationship attribute is &quot;fast&quot; or &quot;stacked&quot;. If this attribute is not used, the view will be a regular view, not a standalone view (default is &quot;false&quot;).
- </documentation>
+
</annotation>
</attribute>
<attribute name="showTitle" type="boolean">
<annotation>
- <documentation>
- whether the view&apos;s title is shown. This attribute should have a value of &quot;true&quot; or &quot;false&quot; if used. This attribute only applies to standalone views. If this attribute is not used, the view&apos;s title will be shown (default is &quot;true&quot;).
- </documentation>
+
</annotation>
</attribute>
<attribute name="minimized" type="boolean" use="default" value="false">
<annotation>
- <documentation>
- If the perspective extension will result in a new view stack being created (i.e. the &apos;relationship&apos; attribute is one of left, right, top or bottom) this field determines the new stack&apos;s initial display state.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="hiddenMenuItem">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- The unique identifier of the Command which is to be removed from the menu.
-&lt;strong&gt;WARNING:&lt;/strong&gt; This is considered to be a &apos;Product level&apos; extension and should not be used in consumable plugins without great care.
- </documentation>
</annotation>
</attribute>
</complexType>
</element>
<element name="hiddenToolBarItem">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- The unique identifier of the Command which is to be removed from thetoolbar.
-&lt;strong&gt;WARNING:&lt;/strong&gt; This is considered to be a &apos;Product level&apos; extension and should not be used in consumable plugins without great care.
- </documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
- <documentation>
- The following is an example of a perspective extension (note the subelements and the way attributes are used):
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.blueberry.ui.perspectiveExtensions&quot;&gt;
- &lt;perspectiveExtension
- targetID=&quot;org.blueberry.ui.resourcePerspective&quot;&gt;
- &lt;actionSet id=&quot;org.xyz.MyActionSet&quot;/&gt;
- &lt;viewShortcut id=&quot;org.xyz.views.PackageExplorer&quot;/&gt;
- &lt;newWizardShortcut id=&quot;org.xyz.wizards.NewProjectCreationWizard&quot;/&gt;
- &lt;perspectiveShortcut id=&quot;org.xyz.MyPerspective&quot;/&gt;
- &lt;view id=&quot;org.xyz.views.PackageExplorer&quot;
- relative=&quot;org.blueberry.ui.views.ResourceNavigator&quot;
- relationship=&quot;stack&quot;/&gt;
- &lt;view id=&quot;org.xyz.views.TypeHierarchy&quot;
- relative=&quot;org.blueberry.ui.views.ResourceNavigator&quot;
- relationship=&quot;left&quot;
- ratio=&quot;0.50&quot;/&gt;
- &lt;/perspectiveExtension&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
-&lt;p&gt;
-In the example above, an action set, view shortcut,
-new wizard shortcut, and perspective shortcut are
-contributed to the initial contents of the
-Resource Perspective. In addition, the
-Package Explorer view is stacked on the
-Resource Navigator and the Type Hierarchy View is
-added beside the Resource Navigator.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
- <documentation>
- The items defined within the perspective extension are contributed to the initial contents of the target perspective. Following this, the user may remove any contribution or add others to a perspective from within the workbench user interface.
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
- <documentation>
- Copyright (c) 2002, 2007 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at &lt;a
-href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.ui.qt/schema/perspectives.exsd b/Plugins/org.blueberry.ui.qt/schema/perspectives.exsd
old mode 100755
new mode 100644
index 8e355d8ed3..5b3c237ba7
--- a/Plugins/org.blueberry.ui.qt/schema/perspectives.exsd
+++ b/Plugins/org.blueberry.ui.qt/schema/perspectives.exsd
@@ -1,181 +1,122 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.ui">
<annotation>
<appInfo>
<meta.schema plugin="org.blueberry.ui" id="perspective" name="Perspectives"/>
</appInfo>
- <documentation>
- This extension point is used to add perspective factories to the workbench. A perspective factory is used to define the initial layout and visible action sets for a perspective. The user can select a perspective by invoking the &quot;Open Perspective&quot; submenu of the &quot;Window&quot; menu.
- </documentation>
+
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="perspective" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
+
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="perspective">
<annotation>
<appInfo>
<meta.element labelAttribute="name" icon="icon"/>
</appInfo>
</annotation>
<complexType>
<sequence>
<element ref="description" minOccurs="0" maxOccurs="1"/>
<element ref="keywordReference" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- a unique name that will be used to identify this perspective.
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- a translatable name that will be used in the workbench window menu bar to represent this perspective.
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified name of the class that implements
-&lt;samp&gt;berry::IPerspectiveFactory&lt;/samp&gt; interface.
- </documentation>
+
<appInfo>
<meta.attribute kind="java" basedOn="berry::IPerspectiveFactory"/>
</appInfo>
</annotation>
</attribute>
<attribute name="icon" type="string">
<annotation>
- <documentation>
- a relative name of the icon that will be associated
-with this perspective.
- </documentation>
+
<appInfo>
<meta.attribute kind="resource"/>
</appInfo>
</annotation>
</attribute>
<attribute name="fixed" type="boolean">
<annotation>
- <documentation>
- indicates whether the layout of the perspective is fixed. If true, then views created by the perspective factory are not closeable, and cannot be moved. The default is false.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="description" type="string">
<annotation>
<appInfo>
<meta.element translatable="true"/>
</appInfo>
- <documentation>
- an optional subelement whose body should contain text providing a short description of the perspective.
- </documentation>
+
</annotation>
</element>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
- <documentation>
- The following is an example of a perspective extension:
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension
- point=&quot;org.blueberry.ui.perspectives&quot;&gt;
- &lt;perspective
- id=&quot;org.blueberry.ui.resourcePerspective&quot;
- name=&quot;Resource&quot;
- class=&quot;berry::ResourcePerspective&quot;
- icon=&quot;resources/MyIcon.gif&quot;&gt;
- &lt;/perspective&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
- <documentation>
- The value of the &lt;samp&gt;class&lt;/samp&gt; attribute must be the
-fully qualified name of a class that implements
-&lt;samp&gt;berry::IPerspectiveFactory&lt;/samp&gt;.
-The class must supply the initial layout for a
-perspective when asked by the workbench.
-&lt;p&gt;
-The &lt;samp&gt;plugin_customization.ini&lt;/samp&gt; file is used to define the default perspective. The &lt;i&gt;default perspective&lt;/i&gt; is the first perspective which appears when the product is launched after install. It is also used when the user opens a page or window with no specified perspective. The default perspective is defined as a property within the plugin_customization.ini, as shown below. The user may also override this perspective from the workbench perspectives preference page.
-&lt;pre&gt;
- defaultPerspectiveId = org.blueberry.ui.resourcePerspective
-&lt;/pre&gt;
-The perspectives which appear in the &quot;Open Perspective&quot; menu are shortcuts for perspective selection. This set is defined by the active perspective itself, and extensions made through the perspectiveExtensions extension point.
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
- <documentation>
- The workbench provides a &quot;Resource Perspective&quot;.
-Additional perspectives may be added by plug-ins.
-They are selected using the &quot;Open Perspective&quot; submenu of the &quot;Window&quot; menu.
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
- <documentation>
- Copyright (c) 2002, 2005 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at &lt;a
-href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.ui.qt/schema/preferencePages.exsd b/Plugins/org.blueberry.ui.qt/schema/preferencePages.exsd
index 0869da9db8..8ff375baf5 100644
--- a/Plugins/org.blueberry.ui.qt/schema/preferencePages.exsd
+++ b/Plugins/org.blueberry.ui.qt/schema/preferencePages.exsd
@@ -1,195 +1,125 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.ui" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.blueberry.ui" id="preferencePages" name="Preference Pages"/>
</appinfo>
- <documentation>
- The workbench provides one common dialog box for preferences.
-The purpose of this extension point is to allow plug-ins to add
-pages to the preference dialog box. When preference dialog box
-is opened (initiated from the menu bar), pages contributed in
-this way will be added to the dialog box.
-
-&lt;p&gt;
-The preference dialog
-box provides for hierarchical grouping of the pages. For this
-reason, a page can optionally specify a &lt;samp&gt;category&lt;/samp&gt; attribute.
-This
-attribute represents a path composed of parent page IDs separated
-by &apos;/&apos;. If this attribute is omitted or if any of the parent
-nodes in the path cannot be found, the page will be added at
-the root level.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="page" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
+
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="page">
<annotation>
<appinfo>
<meta.element labelAttribute="name"/>
</appinfo>
</annotation>
<complexType>
<sequence>
<element ref="keywordReference" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- a unique name that will be used to identify this page.
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- a translatable name that will be used in the UI for this page.
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- a name of the fully qualified class that implements
-&lt;samp&gt;berry::IWorkbenchPreferencePage&lt;/samp&gt;.
- </documentation>
+
<appinfo>
<meta.attribute kind="java" basedOn="org.eclipse.jface.preference.PreferencePage:org.eclipse.ui.IWorkbenchPreferencePage"/>
</appinfo>
</annotation>
</attribute>
<attribute name="category" type="string">
<annotation>
- <documentation>
- a path indicating the location of the page in the preference tree. The path may either be a parent node ID or a sequence
- of IDs separated by &apos;/&apos;, representing the full path from the root node.
- </documentation>
+
<appinfo>
<meta.attribute kind="identifier" basedOn="org.eclipse.ui.preferencePages/page/@id"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="keywordReference">
<annotation>
- <documentation>
- A reference by a preference page to a keyword. See the keywords extension point.
- </documentation>
+
</annotation>
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- The id of the keyword being referred to.
- </documentation>
+
<appinfo>
<meta.attribute kind="identifier" basedOn="org.eclipse.ui.keywords/keyword/@id"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
- <documentation>
- The following is an example for the preference extension point:
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension
- point=&quot;org.blueberry.ui.preferencePages&quot;&gt;
- &lt;page
- id=&quot;com.xyz.prefpage1&quot;
- name=&quot;XYZ&quot;
- class=&quot;xyz::PrefPage1&quot;&gt;
- &lt;keywordReference id=&quot;xyz.Keyword&quot;/&gt;
- &lt;/page&gt;
- &lt;page
- id=&quot;com.xyz.prefpage2&quot;
- name=&quot;Keyboard Settings&quot;
- class=&quot;xyz::PrefPage2&quot;
- category=&quot;com.xyz.prefpage1&quot;&gt;
- &lt;/page&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="apiInfo"/>
</appinfo>
- <documentation>
- The value of the attribute class must represent a fully qualified name of the class that implements
-&lt;samp&gt;berry::IWorkbenchPreferencePage&lt;/samp&gt;.
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
- <documentation>
- The workbench adds several pages for setting the preferences of the platform. Pages registered
-through this extension will be added after them according to their category information.
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="copyright"/>
</appinfo>
- <documentation>
- Copyright (c) 2002, 2005 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at &lt;a
-href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.ui.qt/schema/presentationFactories.exsd b/Plugins/org.blueberry.ui.qt/schema/presentationFactories.exsd
old mode 100755
new mode 100644
index e7dcb6d72f..615fe36d99
--- a/Plugins/org.blueberry.ui.qt/schema/presentationFactories.exsd
+++ b/Plugins/org.blueberry.ui.qt/schema/presentationFactories.exsd
@@ -1,125 +1,91 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.ui">
<annotation>
<appInfo>
<meta.schema plugin="org.blueberry.ui" id="presentationFactories" name="Presentation Factories"/>
</appInfo>
- <documentation>
- This extension point is used to add presentation factories to the workbench.
- A presentation factory defines the overall look and feel of the workbench,
- including how views and editors are presented.
- </documentation>
+
</annotation>
<element name="extension">
<complexType>
<sequence>
<element ref="factory" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- </documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- </documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- </documentation>
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="factory">
<complexType>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- Specify the fully qualified class to be used for the presentation factory. The specified value must implement the interface &lt;code&gt;berry::IPresentationFactory&lt;/code&gt;.
- </documentation>
+
<appInfo>
<meta.attribute kind="java" basedOn="org.eclipse.ui.presentations.AbstractPresentationFactory"/>
</appInfo>
</annotation>
</attribute>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- a unique name that will be used to identify this presentation factory
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- a translatable name that can be used to show this presentation factory in the UI
- </documentation>
+
<appInfo>
<meta.attribute translatable="true"/>
</appInfo>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appInfo>
<meta.section type="examples"/>
</appInfo>
- <documentation>
- The following is an example of a presentationFactory extension:
-&lt;pre&gt;
- &lt;extension point=&quot;org.blueberry.ui.presentationFactories&quot;&gt;
- &lt;factory
- class=&quot;berry::ExampleWorkbenchPresentationFactory&quot;/&gt;
- &lt;/extension&gt;
- &lt;/pre&gt;
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="apiInfo"/>
</appInfo>
- <documentation>
- The class specified in the factory element must be a concrete subclass of &lt;code&gt;org.eclipse.ui.presentations.AbstractPresentationFactory&lt;/code&gt;.
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="implementation"/>
</appInfo>
- <documentation>
- If a presentation factory is not specified or is missing then the implementation in &lt;code&gt;berry::QtWorkbenchPresentationFactory&lt;/code&gt; will be used.
- </documentation>
+
</annotation>
<annotation>
<appInfo>
<meta.section type="copyright"/>
</appInfo>
- <documentation>
- Copyright (c) 2004, 2005 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at &lt;a
-href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.ui.qt/schema/services.exsd b/Plugins/org.blueberry.ui.qt/schema/services.exsd
old mode 100755
new mode 100644
index b07d5c4c07..e940e68b2c
--- a/Plugins/org.blueberry.ui.qt/schema/services.exsd
+++ b/Plugins/org.blueberry.ui.qt/schema/services.exsd
@@ -1,226 +1,154 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.ui" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.blueberry.ui" id="services" name="Services"/>
</appinfo>
- <documentation>
- Define service factories so that services can be contributed declaratively and will be available through &lt;code&gt;berry::IServiceLocator::GetService(Class)&lt;/code&gt;. The implementation of &lt;code&gt;AbstractServiceFactory&lt;/code&gt; must be able to return a global service and multiple child services (if applicable).
-&lt;p&gt;
-Services must follow a general contract:
-&lt;ul&gt;
-&lt;li&gt;The top level service has no parent.&lt;/li&gt;
-&lt;li&gt;The child service may use the supplied parent, which can be cast to the service interface.&lt;/li&gt;
-&lt;li&gt;Any other services needed for initialization should be retrieved from the &lt;code&gt;berry::IServiceLocator&lt;/code&gt;.&lt;/li&gt;
-&lt;li&gt;If the service needs to clean up any state (like listeners) it should implement &lt;code&gt;berry::IDisposable&lt;/code&gt;.&lt;/li&gt;
-&lt;li&gt;Services should clearly specify when they perform cleanup for clients, such as removing listeners automatically on disposal.&lt;/li&gt;
-&lt;/ul&gt;
-&lt;/p&gt;
- </documentation>
+
</annotation>
<element name="extension">
<annotation>
- <documentation>
- Contribute services to the workbench.
- </documentation>
+
</annotation>
<complexType>
<sequence minOccurs="1" maxOccurs="unbounded">
<element ref="serviceFactory" minOccurs="0" maxOccurs="1"/>
<element ref="sourceProvider" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- </documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- </documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- </documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="serviceFactory">
<annotation>
- <documentation>
- Match a service interface to a factory that can supply a hierachical implementation of that service.
- </documentation>
+
</annotation>
<complexType>
<sequence>
<element ref="service" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
<attribute name="factoryClass" type="string" use="required">
<annotation>
- <documentation>
- The factory that extends &lt;code&gt;AbstractServiceFactory&lt;/code&gt; and can create the implementation for the serviceClass.
- </documentation>
+
<appinfo>
<meta.attribute kind="java" basedOn="org.eclipse.ui.services.AbstractServiceFactory:"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="service">
<annotation>
- <documentation>
- A service this factory can provide.
- </documentation>
+
</annotation>
<complexType>
<attribute name="serviceClass" type="string">
<annotation>
- <documentation>
- The interface that represents a service contract.
- </documentation>
+
<appinfo>
<meta.attribute kind="java"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="sourceProvider">
<annotation>
- <documentation>
- A Source Provider supplies source variables to the IEvaluationService. It can also notify the IEvaluationService when one or more of the variables change.
- </documentation>
+
</annotation>
<complexType>
<sequence>
<element ref="variable" minOccurs="1" maxOccurs="unbounded"/>
</sequence>
<attribute name="provider" type="string" use="required">
<annotation>
- <documentation>
- This class must provide variables and call the appropriate fireSourceChanged(*) method when any of the variables change.
- </documentation>
+
<appinfo>
<meta.attribute kind="java" basedOn="org.eclipse.ui.AbstractSourceProvider:"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="variable">
<annotation>
- <documentation>
- A source variable from this provider. A source provider must declare all variables that it provides.
- </documentation>
+
</annotation>
<complexType>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- The name of a contributed source variable. It is a good practice to prepend the plugin id to the variable name to avoid collisions with other source providers.
- </documentation>
+
</annotation>
</attribute>
<attribute name="priorityLevel" use="required">
<annotation>
- <documentation>
- For conflict resolution used by services like the IHandlerService, contributed source variables must assign a priority. &lt;b&gt;workbench&lt;/b&gt; is the global default priority. See &lt;code&gt;ISources&lt;/code&gt; for relative priority information.
- </documentation>
+
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="workbench">
</enumeration>
<enumeration value="activeContexts">
</enumeration>
<enumeration value="activeShell">
</enumeration>
<enumeration value="activeWorkbenchWindow">
</enumeration>
<enumeration value="activeEditorId">
</enumeration>
<enumeration value="activePartId">
</enumeration>
<enumeration value="activeSite">
</enumeration>
</restriction>
</simpleType>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
- <documentation>
- &lt;p&gt;
-Here is a basic definition:
-&lt;pre&gt;
- &lt;extension
- point=&quot;org.blueberry.ui.services&quot;&gt;
- &lt;serviceFactory
- factoryClass=&quot;my::LevelServiceFactory&quot;&gt;
- &lt;service
- serviceClass=&quot;my::ILevelService&quot;&gt;
- &lt;/service&gt;
- &lt;/serviceFactory&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;&lt;/p&gt;
-&lt;p&gt;
-The &lt;code&gt;LevelServiceFactory&lt;/code&gt; can return an &lt;code&gt;ILevelService&lt;/code&gt; when it is requested from the &lt;code&gt;IServiceLocator&lt;/code&gt;:
-&lt;pre&gt;
- berry::ILevelService::Pointer s = GetSite()-&gt;GetService(my::ILevelService::GetStaticClassName());
- std::cout &lt;&lt; s-&gt;GetLevel();
-&lt;/pre&gt;
-&lt;/p&gt;
-&lt;p&gt;
-In this test example, the factory would instantiate three &lt;code&gt;ILevelService&lt;/code&gt; implementations during the first call to &lt;code&gt;GetSite()-&gt;GetService(*)&lt;/code&gt;. The global one in the workbench, one for the workbench window, and one for the site.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="apiInfo"/>
</appinfo>
- <documentation>
- &lt;p&gt;
-Please see &lt;code&gt;org.eclipse.ui.services.AbstractServiceFactory&lt;/code&gt;, &lt;code&gt;org.eclipse.ui.services.IDisposable&lt;/code&gt;, and &lt;code&gt;org.eclipse.ui.services.IServiceWithSources&lt;/code&gt; for more information.
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="copyright"/>
</appinfo>
- <documentation>
- Copyright (c) 2007 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at &lt;a
-href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.ui.qt/schema/tweaklets.exsd b/Plugins/org.blueberry.ui.qt/schema/tweaklets.exsd
old mode 100755
new mode 100644
index 6d4f0a67d4..445d756415
--- a/Plugins/org.blueberry.ui.qt/schema/tweaklets.exsd
+++ b/Plugins/org.blueberry.ui.qt/schema/tweaklets.exsd
@@ -1,145 +1,106 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.ui" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.blueberry.ui" id="tweaklets" name="Tweaklets"/>
</appinfo>
- <documentation>
- This extension point is used to define tweaklets. A tweaklet is anything that can be used to tweak the look and feel of the Workbench.
- </documentation>
+
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<choice minOccurs="0" maxOccurs="unbounded">
<element ref="tweaklet"/>
</choice>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- </documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- </documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- </documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="tweaklet">
<annotation>
<appinfo>
<meta.element labelAttribute="name" icon="icon"/>
</appinfo>
</annotation>
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- a unique name that will be used to identify this tweaklet
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- a translatable name that will be used in the UI for this tweaklet
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="description" type="string">
<annotation>
- <documentation>
- a translatable short description of this tweaklet, to be used in the UI
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="definition" type="string">
<annotation>
- <documentation>
- an identifier of the tweaklet definition in the workbench, typically a fully qualified type name without colons
- </documentation>
+
</annotation>
</attribute>
<attribute name="implementation" type="string">
<annotation>
- <documentation>
- an identifier of the tweaklet implementation provided by the extender, typically a fully qualified class name
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="apiInfo"/>
</appinfo>
- <documentation>
- The following is an example tweaklet:
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.blueberry.ui.tweaklets&quot;&gt;
- &lt;tweaklet
- id=&quot;org.blueberry.ui.tweaklets.ConcreteXYZTweaklet&quot;
- name=&quot;XYZ Tweaklet&quot;
- description=&quot;Short description of the tweak&quot;
- definition=&quot;berryAbstractXYZTweaklet&quot;
- implementation=&quot;berry::ConcreteXYZTweaklet&quot;/&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
- <documentation>
- Typically, although not required, the value of the &lt;samp&gt;definition&lt;/samp&gt; attribute is the
-fully qualified name without colons of an abstract class defined by the
-workbench, and the value of the &lt;samp&gt;implementation&lt;/samp&gt; attribute is the
-fully qualified name of a non-abstract class provided by the extending plug-in.
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
- <documentation>
- Tweaklets are usually used to specialize the workbench for a specific GUI toolkit.
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.ui.qt/schema/views.exsd b/Plugins/org.blueberry.ui.qt/schema/views.exsd
old mode 100755
new mode 100644
index 3ebdced734..93aa1b52df
--- a/Plugins/org.blueberry.ui.qt/schema/views.exsd
+++ b/Plugins/org.blueberry.ui.qt/schema/views.exsd
@@ -1,311 +1,212 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.blueberry.ui" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.blueberry.ui" id="views" name="Views"/>
</appinfo>
- <documentation>
- This extension point is used to define additional views
-for the workbench. A view is a visual component
-within a workbench page. It is typically used to
-navigate a hierarchy of information (like the workspace),
-open an editor, or display properties for
-the active editor. The user can make a view
-visible from the Window &gt; Show View menu or close it from the
-view local title bar.
-&lt;p&gt;
-In order to reduce the visual clutter in the Show View Dialog, views should be grouped using categories.
- </documentation>
+
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<choice minOccurs="0" maxOccurs="unbounded">
<element ref="category"/>
<element ref="view"/>
<element ref="stickyView"/>
</choice>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
+
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="category">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- a unique name that will be used to identify this category
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- a translatable name that will be used in the UI for this category
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="parentCategory" type="string">
<annotation>
- <documentation>
- an optional path composed of category IDs separated by &apos;/&apos;. This
-allows the creation of a hierarchy of categories.
- </documentation>
+
<appinfo>
<meta.attribute kind="identifier" basedOn="org.blueberry.ui.views/category/@id"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="view">
<complexType>
<sequence>
<element ref="description" minOccurs="0" maxOccurs="1"/>
<element ref="keywordReference" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- a unique name that will be used to identify this view
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string" use="required">
<annotation>
- <documentation>
- a translatable name that will be used in the UI for this view
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="category" type="string">
<annotation>
- <documentation>
- an optional attribute that is composed of the category IDs separated
-by &apos;/&apos;. Each referenced category must be declared in a corresponding category element.
- </documentation>
+
<appinfo>
<meta.attribute kind="identifier" basedOn="org.blueberry.ui.views/category/@id"/>
</appinfo>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified name of the class that implements
-&lt;samp&gt;berry::IViewPart&lt;/samp&gt;. A common practice
-is to subclass &lt;samp&gt;berry::ViewPart&lt;/samp&gt; or &lt;samp&gt;berry::QtViewPart&lt;/samp&gt;
-in order to inherit the default functionality.
- </documentation>
+
<appinfo>
<meta.attribute kind="java" basedOn="berryViewPart:"/>
</appinfo>
</annotation>
</attribute>
<attribute name="icon" type="string">
<annotation>
- <documentation>
- a relative name of the icon that will
-be associated with the view.
- </documentation>
+
<appinfo>
<meta.attribute kind="resource"/>
</appinfo>
</annotation>
</attribute>
<attribute name="fastViewWidthRatio" type="string">
<annotation>
- <documentation>
- the percentage of the width of the workbench that the view will take up as an active fast view.
-This must be defined as a floating point value and lie between 0.05 and 0.95.
-If no value is supplied, a default ratio will be used.
- </documentation>
+
</annotation>
</attribute>
<attribute name="allowMultiple" type="boolean">
<annotation>
- <documentation>
- flag indicating whether this view allows multiple instances to be created using IWorkbenchPage::ShowView(QString id, QString secondaryId). The default is false.
- </documentation>
+
</annotation>
</attribute>
<attribute name="restorable" type="boolean" use="default" value="true">
<annotation>
- <documentation>
- flag indicating whether this view allows to be restored upon workbench restart. If set to false, the view will not be open after a workbench restart. The default is true.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<element name="description" type="string">
<annotation>
<appinfo>
<meta.element translatable="true"/>
</appinfo>
- <documentation>
- an optional subelement whose body should contain text providing a short description of the view.
- </documentation>
+
</annotation>
</element>
<element name="stickyView">
<annotation>
- <documentation>
- A sticky view is a view that will appear by default across all perspectives in a window once it is opened. Its initial placement is governemed by the location attribute, but nothing prevents it from being moved or closed by the user. Use of this element will only cause a placeholder for the view to be created, it will not show the view. Please note that usage of this element should be done with great care and should only be applied to views that truely have a need to live across perspectives.
- </documentation>
+
</annotation>
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- the id of the view to be made sticky.
- </documentation>
+
<appinfo>
<meta.attribute kind="identifier" basedOn="org.blueberry.ui.views/view/@id"/>
</appinfo>
</annotation>
</attribute>
<attribute name="location">
<annotation>
- <documentation>
- optional attribute that specifies the location of the sticky view relative to the editor area. If absent, the view will be docked to the right of the editor area.
- </documentation>
+
</annotation>
<simpleType>
<restriction base="string">
<enumeration value="RIGHT">
</enumeration>
<enumeration value="LEFT">
</enumeration>
<enumeration value="TOP">
</enumeration>
<enumeration value="BOTTOM">
</enumeration>
</restriction>
</simpleType>
</attribute>
<attribute name="closeable" type="boolean">
<annotation>
- <documentation>
- optional attribute that specifies wether the view should be closeable. If absent it will be closeable.
- </documentation>
+
</annotation>
</attribute>
<attribute name="moveable" type="boolean">
<annotation>
- <documentation>
- optional attribute that specifies wether the view should be moveable. If absent it will be moveable.
- </documentation>
+
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
- <documentation>
- The following is an example of the extension point:
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.blueberry.ui.views&quot;&gt;
- &lt;category
- id=&quot;com.xyz.views.XYZviews&quot;
- name=&quot;XYZ&quot;/&gt;
- &lt;view
- id=&quot;com.xyz.views.XYZView&quot;
- name=&quot;XYZ View&quot;
- category=&quot;com.xyz.views.XYZviews&quot;
- class=&quot;ns::XYZView&quot;
- icon=&quot;icons/XYZ.gif&quot;/&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
-The following is an example of a sticky view declaration:
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.blueberry.ui.views&quot;&gt;
- &lt;stickyView
- id=&quot;com.xyz.views.XYZView&quot; /&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="apiInfo"/>
</appinfo>
- <documentation>
- The value of the &lt;samp&gt;class&lt;/samp&gt; attribute must be a
-fully qualified name of the class that implements
-&lt;samp&gt;berry::IViewPart&lt;/samp&gt;. It is common
-practice to subclass &lt;samp&gt;berry::ViewPart&lt;/samp&gt;
-or &lt;samp&gt;berry::QtViewPart&lt;samp&gt; when developing a new view.
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
- <documentation>
- The BlueBerry Platform provides a number of standard views. From the user point of view, these views are no different from any other view provided by the plug-ins. All the views can be shown from the &quot;Show View&quot; submenu of the &quot;Window&quot; menu. The position of a view is persistent: it is saved when the view is closed and restored when the view is reopened in a single session. The position is also persisted between workbench sessions.
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="copyright"/>
</appinfo>
- <documentation>
- Copyright (c) 2002, 2005 IBM Corporation and others.&lt;br&gt;
-All rights reserved. This program and the accompanying materials are made
-available under the terms of the Eclipse Public License v1.0 which accompanies
-this distribution, and is available at &lt;a
-href=&quot;http://www.eclipse.org/legal/epl-v10.html&quot;&gt;http://www.eclipse.org/legal/epl-v10.html&lt;/a&gt;
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryAbstractContributionFactory.h b/Plugins/org.blueberry.ui.qt/src/actions/berryAbstractContributionFactory.h
index c22feb26b7..38c741102a 100644
--- a/Plugins/org.blueberry.ui.qt/src/actions/berryAbstractContributionFactory.h
+++ b/Plugins/org.blueberry.ui.qt/src/actions/berryAbstractContributionFactory.h
@@ -1,135 +1,135 @@
/*============================================================================
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 BERRYABSTRACTCONTRIBUTIONFACTORY_H_
#define BERRYABSTRACTCONTRIBUTIONFACTORY_H_
#include <berryObject.h>
#include <org_blueberry_ui_qt_Export.h>
namespace berry {
struct IServiceLocator;
struct IContributionRoot;
/**
* ContributionFactories are used by the IMenuService to populate
* ContributionManagers. In CreateContributionItems()
* you fill in the additions List with {@link IContributionItem} to be inserted at this
* factory's location. For example:
* <p>
*
* <pre>
* AbstractContributionFactory contributions = new AbstractContributionFactory(
* &quot;menu:org.eclipse.ui.tests.api.MenuTestHarness?after=additions&quot;) {
* public void CreateContributionItems(IMenuService menuService, List additions) {
* CommandContributionItem item = new CommandContributionItem(
* &quot;org.eclipse.ui.tests.menus.helloWorld&quot;,
* &quot;org.eclipse.ui.tests.commands.enabledHelloWorld&quot;, null, null,
* &quot;Say Hello&quot;, null);
* additions.add(item);
* item = new CommandContributionItem(
* &quot;org.eclipse.ui.tests.menus.refresh&quot;,
* &quot;org.eclipse.ui.tests.commands.refreshView&quot;, null, null,
* &quot;Refresh&quot;, null);
* menuService.registerVisibleWhen(item, new MyActiveContextExpression(
* &quot;org.eclipse.ui.tests.myview.context&quot;));
* additions.add(item);
* }
*
* public void releaseContributionItems(IMenuService menuService, List items) {
* // we have nothing to do
* }
* };
* IMenuService service = (IMenuService) PlatformUI.getWorkbench().getService(
* IMenuService.class);
* service.addContributionFactory(contributions);
* </pre>
*
* </p>
* <p>
* Only the abstract methods may be implemented.
* </p>
*
* @see IMenuService
* @see MenuManager
* @see ToolBarManager
*/
class BERRY_UI_QT AbstractContributionFactory: public Object
{
private:
QString location;
QString namespaze;
public:
berryObjectMacro(berry::AbstractContributionFactory);
/**
* The contribution factories must be instantiated with their location,
* which which specifies the contributions insertion location.
*
* @param location
* the addition location in Menu API URI format. It must not be
* <code>null</code>.
- * @param namespace
+ * @param namespaze
* the namespace for this contribution. May be <code>null</code>.
- * @see #getNamespace()
+ * @see #GetNamespace
*/
AbstractContributionFactory(const QString& location,
const QString& namespaze);
/**
* Return the location as a String.
*
* @return the location - never <code>null</code>.
*/
QString GetLocation() const;
/**
* This factory should create the IContributionItems that it wants to
* contribute, and add them to the additions list. The menu service will
* call this method at the appropriate time. It should always return new
* instances of its contributions in the additions list.
* <p>
* This method is not meant to be called by clients. It will be called by
* the menu service at the appropriate time.
* </p>
*
* @param serviceLocator
* a service locator that may be used in the construction of
* items created by this factory
* @param additions
* A {@link IContributionRoot} supplied by the framework. It will
* never be <code>null</code>.
* @see org.eclipse.ui.menus.CommandContributionItem
* @see org.eclipse.jface.action.MenuManager
*/
virtual void CreateContributionItems(IServiceLocator* serviceLocator,
const SmartPointer<IContributionRoot>& additions) = 0;
/**
* Return the namespace for this cache. This corresponds to the plug-in that
* is contributing this factory.
*
* @return the namespace the namespace of this factory
*/
QString GetNamespace() const;
};
}
#endif /* BERRYABSTRACTCONTRIBUTIONFACTORY_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryCommandContributionItemParameter.h b/Plugins/org.blueberry.ui.qt/src/actions/berryCommandContributionItemParameter.h
index 5001a63f8a..52cb8ea7ff 100644
--- a/Plugins/org.blueberry.ui.qt/src/actions/berryCommandContributionItemParameter.h
+++ b/Plugins/org.blueberry.ui.qt/src/actions/berryCommandContributionItemParameter.h
@@ -1,197 +1,193 @@
/*============================================================================
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 BERRYCOMMANDCONTRIBUTIONITEMPARAMETER_H
#define BERRYCOMMANDCONTRIBUTIONITEMPARAMETER_H
#include <QHash>
#include <QIcon>
#include <QKeySequence>
#include "berryCommandContributionItem.h"
namespace berry {
struct IServiceLocator;
/**
* A help class for the various parameters that can be used with command
* contributions. Mandatory parameters are in the constructor, and public fields
* can be set to fill in other parameters.
*/
class BERRY_UI_QT CommandContributionItemParameter : public virtual Object
{
public:
berryObjectMacro(CommandContributionItemParameter);
/**
* a service locator that is most appropriate for this contribution.
* Typically the local {@link IWorkbenchWindow} or
* {@link IWorkbenchPartSite} will be sufficient. Must not be
* <code>null</code>.
*/
IServiceLocator* serviceLocator;
/**
* The id for this item. May be <code>null</code>. Items without an id
* cannot be referenced later.
*/
QString id;
/**
* A command id for a defined command. Must not be <code>null</code>.
*/
QString commandId;
/**
* A map of strings to strings which represent parameter names to values.
* The parameter names must match those in the command definition. May be
* <code>null</code>
*/
QHash<QString, Object::Pointer> parameters;
/**
* An icon for this item. May be <code>null</code>.
*/
QIcon icon;
/**
* A label for this item. May be <code>null</code>.
*/
QString label;
/**
* A mnemonic for this item to be applied to the label. May be
* <code>null</code>.
*/
QChar mnemonic;
/**
* A shortcut key sequence. This is a workaround and will be
* removed when key binding support is fully implemented
*/
QKeySequence shortcut;
/**
* A tooltip for this item. May be <code>null</code>. Tooltips are
* currently only valid for toolbar contributions.
*/
QString tooltip;
/**
* The style of this menu contribution. See the CommandContributionItem
* STYLE_* contants.
*/
CommandContributionItem::Style style;
/**
* The help context id to be applied to this contribution. May be
* <code>null</code>
*/
QString helpContextId;
/**
* The icon style to use.
*/
QString iconStyle;
/**
* The visibility tracking for a menu contribution.
*/
bool visibleEnabled;
/**
* Any number of mode bits, like
* {@link CommandContributionItem#MODE_FORCE_TEXT}.
*/
CommandContributionItem::Modes mode;
/**
* Create the parameter object. Nullable attributes can be set directly.
*
* @param serviceLocator
* a service locator that is most appropriate for this
* contribution. Typically the local {@link IWorkbenchWindow} or
* {@link IWorkbenchPartSite} will be sufficient. Must not be
* <code>null</code>.
* @param id
* The id for this item. May be <code>null</code>. Items
* without an id cannot be referenced later.
* @param commandId
* A command id for a defined command. Must not be
* <code>null</code>.
* @param style
* The style of this menu contribution. See the STYLE_* contants.
*/
CommandContributionItemParameter(IServiceLocator* serviceLocator,
const QString& id, const QString& commandId,
CommandContributionItem::Style style);
/**
* Build the parameter object.
* <p>
* <b>Note:</b> This constructor should not be called outside the framework.
* </p>
*
* @param serviceLocator
* a service locator that is most appropriate for this
* contribution. Typically the local {@link IWorkbenchWindow} or
* {@link IWorkbenchPartSite} will be sufficient. Must not be
* <code>null</code>.
* @param id
* The id for this item. May be <code>null</code>. Items
* without an id cannot be referenced later.
* @param commandId
* A command id for a defined command. Must not be
* <code>null</code>.
* @param parameters
* A map of strings to strings which represent parameter names to
* values. The parameter names must match those in the command
* definition. May be <code>null</code>
* @param icon
* An icon for this item. May be <code>null</code>.
- * @param disabledIcon
- * A disabled icon for this item. May be <code>null</code>.
- * @param hoverIcon
- * A hover icon for this item. May be <code>null</code>.
* @param label
* A label for this item. May be <code>null</code>.
* @param mnemonic
* A mnemonic for this item to be applied to the label. May be
* <code>null</code>.
* @param tooltip
* A tooltip for this item. May be <code>null</code>. Tooltips
* are currently only valid for toolbar contributions.
* @param style
* The style of this menu contribution. See the STYLE_* contants.
* @param helpContextId
* the help context id to be applied to this contribution. May be
* <code>null</code>
* @param visibleEnabled
* Visibility tracking for the menu contribution.
- * @noreference This constructor is not intended to be referenced by clients.
+ * @note This constructor is not intended to be referenced by clients.
*/
CommandContributionItemParameter(IServiceLocator* serviceLocator,
const QString& id, const QString& commandId,
const QHash<QString, Object::Pointer> &parameters,
const QIcon& icon, const QString label,
const QChar &mnemonic, const QString& tooltip,
CommandContributionItem::Style style, const QString& helpContextId,
bool visibleEnabled);
};
}
#endif // BERRYCOMMANDCONTRIBUTIONITEM_H
diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryContributionItem.h b/Plugins/org.blueberry.ui.qt/src/actions/berryContributionItem.h
index c2d28f944b..7411c02ab4 100644
--- a/Plugins/org.blueberry.ui.qt/src/actions/berryContributionItem.h
+++ b/Plugins/org.blueberry.ui.qt/src/actions/berryContributionItem.h
@@ -1,227 +1,227 @@
/*============================================================================
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 BERRYCONTRIBUTIONITEM_H
#define BERRYCONTRIBUTIONITEM_H
#include "berryIContributionItem.h"
#include <org_blueberry_ui_qt_Export.h>
namespace berry {
/**
* An abstract base implementation for contribution items.
*/
class BERRY_UI_QT ContributionItem : public IContributionItem
{
public:
berryObjectMacro(ContributionItem);
enum Mode {
DEFAULT = 0x00,
/**
* Mode bit: Show text on tool items or buttons, even if an image is
* present. If this mode bit is not set, text is only shown on tool items if
* there is no image present.
*/
MODE_FORCE_TEXT = 0x01
};
Q_DECLARE_FLAGS(Modes, Mode)
enum Style {
/**
* A push button tool item or menu item.
*/
STYLE_PUSH = 0x01,
/**
* A checked tool item or menu item.
*/
STYLE_CHECK = 0x02,
/**
* A radio-button style menu item.
*/
STYLE_RADIO = 0x04,
/**
* A ToolBar pulldown item.
*/
STYLE_PULLDOWN = 0x08
};
/**
* The default implementation of this <code>IContributionItem</code>
* method does nothing. Subclasses may override.
*/
void Fill(QStatusBar* parent) override;
/**
* The default implementation of this <code>IContributionItem</code>
* method does nothing. Subclasses may override.
*/
void Fill(QMenu* menu, QAction* before) override;
/**
* The default implementation of this <code>IContributionItem</code>
* method does nothing. Subclasses may override.
*/
void Fill(QMenuBar* menu, QAction* before) override;
/**
* The default implementation of this <code>IContributionItem</code>
* method does nothing. Subclasses may override.
*/
void Fill(QToolBar* parent, QAction* before) override;
/**
* The default implementation of this <code>IContributionItem</code>
* method does nothing. Subclasses may override.
*/
void SaveWidgetState() override;
/*
* Method declared on IContributionItem.
*/
QString GetId() const override;
/**
* Returns the parent contribution manager, or <code>null</code> if this
* contribution item is not currently added to a contribution manager.
*
* @return the parent contribution manager, or <code>null</code>
*/
IContributionManager *GetParent() const;
/**
* The default implementation of this <code>IContributionItem</code>
* method returns <code>false</code>. Subclasses may override.
*/
bool IsDirty() const override;
/**
* The default implementation of this <code>IContributionItem</code>
* method returns <code>true</code>. Subclasses may override.
*/
bool IsEnabled() const override;
/**
* The default implementation of this <code>IContributionItem</code>
* method returns <code>false</code>. Subclasses may override.
*/
bool IsDynamic() const override;
/**
* The default implementation of this <code>IContributionItem</code>
* method returns <code>false</code>. Subclasses may override.
*/
bool IsGroupMarker() const override;
/**
* The default implementation of this <code>IContributionItem</code>
* method returns <code>false</code>. Subclasses may override.
*/
bool IsSeparator() const override;
/**
* The default implementation of this <code>IContributionItem</code>
* method returns the value recorded in an internal state variable,
* which is <code>true</code> by default. <code>setVisible</code>
* should be used to change this setting.
*/
bool IsVisible() const override;
/**
* The default implementation of this <code>IContributionItem</code>
* method stores the value in an internal state variable,
* which is <code>true</code> by default.
*/
void SetVisible(bool visible) override;
/**
* Returns a string representation of this contribution item
* suitable only for debugging.
*/
QString ToString() const override;
/**
* The default implementation of this <code>IContributionItem</code>
* method does nothing. Subclasses may override.
*/
void Update() override;
/*
* Method declared on IContributionItem.
*/
void SetParent(IContributionManager* parent) override;
/**
* The <code>ContributionItem</code> implementation of this
* method declared on <code>IContributionItem</code> does nothing.
* Subclasses should override to update their state.
*/
void Update(const QString& id) override;
/**
* The ID for this contribution item. It should be set once either in the
* constructor or using this method.
*
* @param itemId
- * @see #getId()
+ * @see #GetId
*/
void SetId(const QString& itemId);
protected:
/**
* Creates a contribution item with a <code>null</code> id.
* Calls <code>this(String)</code> with <code>null</code>.
*/
ContributionItem();
/**
* Creates a contribution item with the given (optional) id.
* The given id is used to find items in a contribution manager,
* and for positioning items relative to other items.
*
* @param id the contribution item identifier, or <code>null</code>
*/
ContributionItem(const QString& id);
private:
/**
* The identifier for this contribution item, of <code>null</code> if none.
*/
QString id;
/**
* Indicates this item is visible in its manager; <code>true</code>
* by default.
*/
bool visible;
/**
* The parent contribution manager for this item
*/
IContributionManager* parent;
};
}
#endif // BERRYCONTRIBUTIONITEM_H
diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryContributionManager.h b/Plugins/org.blueberry.ui.qt/src/actions/berryContributionManager.h
index d62e7af4ce..cc6031961b 100644
--- a/Plugins/org.blueberry.ui.qt/src/actions/berryContributionManager.h
+++ b/Plugins/org.blueberry.ui.qt/src/actions/berryContributionManager.h
@@ -1,339 +1,339 @@
/*============================================================================
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 BERRYCONTRIBUTIONMANAGER_H
#define BERRYCONTRIBUTIONMANAGER_H
#include "berryIContributionManager.h"
namespace berry {
struct IContributionManagerOverrides;
/**
* Abstract base class for all contribution managers, and standard
* implementation of <code>IContributionManager</code>. This class provides
* functionality common across the specific managers defined by this framework.
* <p>
* This class maintains a list of contribution items and a dirty flag, both as
* internal state. In addition to providing implementations of most
* <code>IContributionManager</code> methods, this class automatically
* coalesces adjacent separators, hides beginning and ending separators, and
* deals with dynamically changing sets of contributions. When the set of
* contributions does change dynamically, the changes are propagated to the
* control via the <code>update</code> method, which subclasses must
* implement.
* </p>
* <p>
* Note: A <code>ContributionItem</code> cannot be shared between different
* <code>ContributionManager</code>s.
* </p>
*/
class ContributionManager : public virtual IContributionManager
{
protected:
// Internal debug flag.
// static final boolean DEBUG = false;
public:
berryObjectMacro(berry::ContributionManager);
~ContributionManager() override;
/*
* Method declared on IContributionManager.
*/
void Add(QAction* action, const QString& id) override;
/*
* Method declared on IContributionManager.
*/
void Add(const SmartPointer<IContributionItem>& item) override;
/*
* Method declared on IContributionManager.
*/
void AppendToGroup(const QString& groupName, QAction* action, const QString& id) override;
/*
* Method declared on IContributionManager.
*/
void AppendToGroup(const QString& groupName, const SmartPointer<IContributionItem>& item) override;
/*
* Method declared on IContributionManager.
*/
SmartPointer<IContributionItem> Find(const QString& id) const override;
/*
* Method declared on IContributionManager.
*/
QList<SmartPointer<IContributionItem> > GetItems() const override;
/**
* Return the number of contributions in this manager.
*
* @return the number of contributions in this manager
*/
int GetSize();
/**
* The <code>ContributionManager</code> implementation of this method
* declared on <code>IContributionManager</code> returns the current
* overrides. If there is no overrides it lazily creates one which overrides
* no item state.
*/
SmartPointer<IContributionManagerOverrides> GetOverrides() override;
/**
* Returns the index of the item with the given id.
*
* @param id
* The id of the item whose index is requested.
*
* @return <code>int</code> the index or -1 if the item is not found
*/
int IndexOf(const QString& id);
/**
* Insert the item at the given index.
*
* @param index
* The index to be used for insertion
* @param item
* The item to be inserted
*/
void Insert(int index, const SmartPointer<IContributionItem>& item);
/*
* (non-Javadoc) Method declared on IContributionManager.
*/
//void InsertAfter(const QString& ID, Action* action);
/*
* (non-Javadoc) Method declared on IContributionManager.
*/
void InsertAfter(const QString& ID, const SmartPointer<IContributionItem>& item) override;
/*
* (non-Javadoc) Method declared on IContributionManager.
*/
//void InsertBefore(const QString& ID, Action* action);
/*
* Method declared on IContributionManager.
*/
void InsertBefore(const QString& ID, const SmartPointer<IContributionItem>& item) override;
/*
* Method declared on IContributionManager.
*/
bool IsDirty() const override;
/*
* Method declared on IContributionManager.
*/
bool IsEmpty() const override;
/*
* Method declared on IContributionManager.
*/
void MarkDirty() override;
/*
* Method declared on IContributionManager.
*/
//void PrependToGroup(const QString& groupName, Action* action);
/*
* Method declared on IContributionManager.
*/
void PrependToGroup(const QString& groupName, const SmartPointer<IContributionItem>& item) override;
/*
* Method declared on IContributionManager.
*/
SmartPointer<IContributionItem> Remove(const QString& ID) override;
/*
* Method declared on IContributionManager.
*/
SmartPointer<IContributionItem> Remove(const SmartPointer<IContributionItem> &item) override;
/*
* (non-Javadoc) Method declared on IContributionManager.
*/
void RemoveAll() override;
/**
* Replaces the item of the given identifier with another contribution item.
* This can be used, for example, to replace large contribution items with
* placeholders to avoid memory leaks. If the identifier cannot be found in
* the current list of items, then this does nothing. If multiple
* occurrences are found, then the replacement items is put in the first
* position and the other positions are removed.
*
* @param identifier
* The identifier to look for in the list of contributions;
* should not be <code>null</code>.
* @param replacementItem
* The contribution item to replace the old item; must not be
* <code>null</code>. Use
- * {@link org.eclipse.jface.action.ContributionManager#remove(java.lang.String) remove}
+ * {@link ContributionManager#Remove}
* if that is what you want to do.
- * @return <code>true</code> if the given identifier can be; <code>
+ * @return <code>true</code> if the given identifier can be
*/
bool ReplaceItem(const QString &identifier,
const SmartPointer<IContributionItem>& replacementItem);
/**
* Sets the overrides for this contribution manager
*
* @param newOverrides
* the overrides for the items of this manager
*/
void SetOverrides(const SmartPointer<IContributionManagerOverrides>& newOverrides);
protected:
/**
* Creates a new contribution manager.
*/
ContributionManager();
/**
* This method allows subclasses of <code>ContributionManager</code> to
* prevent certain items in the contributions list.
* <code>ContributionManager</code> will either block or allow an addition
* based on the result of this method call. This can be used to prevent
* duplication, for example.
*
* @param itemToAdd
* The contribution item to be added; may be <code>null</code>.
* @return <code>true</code> if the addition should be allowed;
* <code>false</code> otherwise. The default implementation allows
* all items.
*/
virtual bool AllowItem(IContributionItem* itemToAdd);
/**
* Internal debug method for printing statistics about this manager to
* <code>cout</code>.
*/
void DumpStatistics();
/**
* Returns whether this contribution manager contains dynamic items. A
* dynamic contribution item contributes items conditionally, dependent on
* some internal state.
*
* @return <code>true</code> if this manager contains dynamic items, and
* <code>false</code> otherwise
*/
bool HasDynamicItems() const;
/**
* Returns the index of the object in the internal structure. This is
* different from <code>indexOf(String id)</code> since some contribution
* items may not have an id.
*
* @param item
* The contribution item
* @return the index, or -1 if the item is not found
*/
int IndexOf(const SmartPointer<IContributionItem>& item) const;
/**
* The given item was added to the list of contributions. Marks the manager
* as dirty and updates the number of dynamic items, and the memento.
*
* @param item
* the item to be added
*
*/
void ItemAdded(const SmartPointer<IContributionItem>& item);
/**
* The given item was removed from the list of contributions. Marks the
* manager as dirty and updates the number of dynamic items.
*
* @param item
* remove given parent from list of contributions
*/
void ItemRemoved(const SmartPointer<IContributionItem>& item);
/**
* Sets whether this manager is dirty. When dirty, the list of contributions
* is not accurately reflected in the corresponding widgets.
*
* @param dirty
* <code>true</code> if this manager is dirty, and
* <code>false</code> if it is up-to-date
*/
void SetDirty(bool dirty);
/**
* An internal method for setting the order of the contribution items.
*
* @param items
* the contribution items in the specified order
*/
void InternalSetItems(const QList<SmartPointer<IContributionItem> >& items);
private:
/**
* The list of contribution items.
*/
QList<SmartPointer<IContributionItem> > contributions;
/**
* Indicates whether the widgets are in sync with the contributions.
*/
bool isDirty;
/**
* Number of dynamic contribution items.
*/
int dynamicItems;
/**
* The overrides for items of this manager
*/
SmartPointer<IContributionManagerOverrides> overrides;
/**
* Adds a contribution item to the start or end of the group with the given
* name.
*
* @param groupName
* the name of the group
* @param item
* the contribution item
* @param append
* <code>true</code> to add to the end of the group, and
* <code>false</code> to add the beginning of the group
* @exception IllegalArgumentException
* if there is no group with the given name
*/
void AddToGroup(const QString& groupName, const SmartPointer<IContributionItem>& item,
bool append);
};
}
#endif // BERRYCONTRIBUTIONMANAGER_H
diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryGroupMarker.h b/Plugins/org.blueberry.ui.qt/src/actions/berryGroupMarker.h
index c049d2f490..fef2190730 100644
--- a/Plugins/org.blueberry.ui.qt/src/actions/berryGroupMarker.h
+++ b/Plugins/org.blueberry.ui.qt/src/actions/berryGroupMarker.h
@@ -1,54 +1,53 @@
/*============================================================================
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 BERRYGROUPMARKER_H
#define BERRYGROUPMARKER_H
#include <internal/berryAbstractGroupMarker.h>
namespace berry {
/**
* A group marker is a special kind of contribution item denoting
* the beginning of a group. These groups are used to structure
* the list of items. Unlike regular contribution items and
* separators, group markers have no visual representation.
* The name of the group is synonymous with the contribution item id.
* <p>
* This class may be instantiated; it is not intended to be
* subclassed outside the framework.
* </p>
- * @noextend This class is not intended to be subclassed by clients.
*/
class BERRY_UI_QT GroupMarker : public AbstractGroupMarker
{
public:
/**
* Create a new group marker with the given name.
* The group name must not be <code>null</code> or the empty string.
* The group name is also used as the item id.
*
* @param groupName the name of the group
*/
GroupMarker(const QString& groupName);
/**
* The <code>GroupMarker</code> implementation of this method
* returns <code>false</code> since group markers are always invisible.
*/
bool IsVisible() const override;
};
}
#endif // BERRYGROUPMARKER_H
diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionItem.h b/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionItem.h
index 652b5f96c4..7c2600b8bf 100644
--- a/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionItem.h
+++ b/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionItem.h
@@ -1,198 +1,194 @@
/*============================================================================
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 BERRYICONTRIBUTIONITEM_H
#define BERRYICONTRIBUTIONITEM_H
#include <berryMacros.h>
#include <berryObject.h>
class QStatusBar;
class QMenu;
class QMenuBar;
class QToolBar;
class QAction;
namespace berry {
struct IContributionManager;
/**
* A contribution item represents a contribution to a shared UI resource such as a
* menu or tool bar. More generally, contribution items are managed by a contribution
* manager.
* For instance, in a tool bar a contribution item is a tool bar button or a separator.
* In a menu bar a contribution item is a menu, and in a menu a contribution item
* is a menu item or separator.
* <p>
* A contribution item can realize itself in different Qt widgets, using the different
* <code>fill</code> methods. The same type of contribution item can be used with a
* <code>MenuBarManager</code>, <code>ToolBarManager</code>,
- * </code>or a <code>StatusLineManager</code>.
+ * or a <code>StatusLineManager</code>.
* </p>
* <p>
* This interface is internal to the framework; it should not be implemented outside
* the framework.
* </p>
*
* @see IContributionManager
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct IContributionItem : public virtual Object
{
berryObjectMacro(berry::IContributionItem);
/**
* Fills the given status bar control with controls representing this
* contribution item. Used by <code>StatusLineManager</code>.
*
* @param parent the parent control
*/
virtual void Fill(QStatusBar* parent) = 0;
/**
* Fills the given menu bar with controls representing this contribution item.
* Used by <code>MenuBarManager</code>.
*
* @param parent the parent menu
- * @param index the index where the controls are inserted,
- * or <code>-1</code> to insert at the end
+ * @param before
*/
virtual void Fill(QMenuBar* parent, QAction* before) = 0;
/**
* Fills the given menu with controls representing this contribution item.
* Used by <code>MenuManager</code>.
*
* @param parent the parent menu
- * @param index the index where the controls are inserted,
- * or <code>-1</code> to insert at the end
+ * @param before
*/
virtual void Fill(QMenu* parent, QAction* before) = 0;
/**
* Fills the given tool bar with controls representing this contribution item.
* Used by <code>ToolBarManager</code>.
*
* @param parent the parent tool bar
- * @param index the index where the controls are inserted,
- * or <code>-1</code> to insert at the end
+ * @param before
*/
virtual void Fill(QToolBar* parent, QAction* before) = 0;
/**
* Returns the identifier of this contribution item.
* The id is used for retrieving an item from its manager.
*
* @return the contribution item identifier, or <code>null</code>
* if none
*/
virtual QString GetId() const = 0;
/**
* Returns whether this contribution item is enabled.
*
* @return <code>true</code> if this item is enabled
*/
virtual bool IsEnabled() const = 0;
/**
* Returns whether this contribution item is dirty. A dirty item will be
* recreated when the action bar is updated.
*
* @return <code>true</code> if this item is dirty
*/
virtual bool IsDirty() const = 0;
/**
* Returns whether this contribution item is dynamic. A dynamic contribution
* item contributes items conditionally, dependent on some internal state.
*
* @return <code>true</code> if this item is dynamic, and
* <code>false</code> for normal items
*/
virtual bool IsDynamic() const = 0;
/**
* Returns whether this contribution item is a group marker.
* This information is used when adding items to a group.
*
* @return <code>true</code> if this item is a group marker, and
* <code>false</code> for normal items
*
* @see GroupMarker
* @see IContributionManager#appendToGroup(String, IContributionItem)
* @see IContributionManager#prependToGroup(String, IContributionItem)
*/
virtual bool IsGroupMarker() const = 0;
/**
* Returns whether this contribution item is a separator.
* This information is used to enable hiding of unnecessary separators.
*
* @return <code>true</code> if this item is a separator, and
* <code>false</code> for normal items
* @see Separator
*/
virtual bool IsSeparator() const = 0;
/**
* Returns whether this contribution item is visibile within its manager.
*
* @return <code>true</code> if this item is visible, and
* <code>false</code> otherwise
*/
virtual bool IsVisible() const = 0;
/**
* Saves any state information of the control(s) owned by this contribution item.
* The contribution manager calls this method before disposing of the controls.
*/
virtual void SaveWidgetState() = 0;
/**
* Sets the parent manager of this item
*
* @param parent the parent contribution manager
*/
virtual void SetParent(IContributionManager* parent) = 0;
/**
* Sets whether this contribution item is visibile within its manager.
*
* @param visible <code>true</code> if this item should be visible, and
* <code>false</code> otherwise
*/
virtual void SetVisible(bool visible) = 0;
/**
* Updates any controls cached by this contribution item with any
* changes which have been made to this contribution item since the last update.
* Called by contribution manager update methods.
*/
virtual void Update() = 0;
/**
* Updates any controls cached by this contribution item with changes
* for the the given property.
*
* @param id the id of the changed property
*/
virtual void Update(const QString& id) = 0;
};
}
#endif // BERRYICONTRIBUTIONITEM_H
diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManager.h b/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManager.h
index 03ba9702a3..161f67233f 100644
--- a/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManager.h
+++ b/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManager.h
@@ -1,212 +1,206 @@
/*============================================================================
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 BERRYICONTRIBUTIONMANAGER_H
#define BERRYICONTRIBUTIONMANAGER_H
#include <berryMacros.h>
#include <berryObject.h>
class QAction;
namespace berry {
struct IContributionItem;
struct IContributionManagerOverrides;
/**
* A contribution manager organizes contributions to such UI components
* as menus, toolbars and status lines.
* <p>
* A contribution manager keeps track of a list of contribution
* items. Each contribution item may has an optional identifier, which can be used
* to retrieve items from a manager, and for positioning items relative to
* each other. The list of contribution items can be subdivided into named groups
* using special contribution items that serve as group markers.
* </p>
* <p>
* The <code>IContributionManager</code> interface provides general
* protocol for adding, removing, and retrieving contribution items.
* It also provides convenience methods that make it convenient
* to contribute actions. This interface should be implemented
* by all objects that wish to manage contributions.
* </p>
- * <p>
- * There are several implementions of this interface in this package,
- * including ones for menus ({@link MenuManager <code>MenuManager</code>}),
- * tool bars ({@link ToolBarManager <code>ToolBarManager</code>}),
- * and status lines ({@link StatusLineManager <code>StatusLineManager</code>}).
- * </p>
*/
struct IContributionManager : public virtual Object
{
berryObjectMacro(berry::IContributionManager);
/**
* Adds an action as a contribution item to this manager.
* Equivalent to <code>Add(IContributionItem::Pointer(new QActionContributionItem(action, id)))</code>.
*
* @param action the action, this cannot be <code>null</code>
* @param id the unique action id
*/
virtual void Add(QAction* action, const QString& id) = 0;
/**
* Adds a contribution item to this manager.
*
* @param item the contribution item, this cannot be <code>null</code>
*/
virtual void Add(const SmartPointer<IContributionItem>& item) = 0;
/**
* Adds a contribution item for the given action at the end of the group
* with the given name.
* Equivalent to
* <code>AppendToGroup(groupName,IContributionItem::Pointer(new QActionContributionItem(action, id)))</code>.
*
* @param groupName the name of the group
* @param action the action
* @param id the unique action id
* @exception ctkInvalidArgumentException if there is no group with
* the given name
*/
virtual void AppendToGroup(const QString& groupName, QAction* action, const QString& id) = 0;
/**
* Adds a contribution item to this manager at the end of the group
* with the given name.
*
* @param groupName the name of the group
* @param item the contribution item
* @exception ctkInvalidArgumentException if there is no group with
* the given name
*/
virtual void AppendToGroup(const QString& groupName, const SmartPointer<IContributionItem>& item) = 0;
/**
* Finds the contribution item with the given id.
*
* @param id the contribution item id
* @return the contribution item, or <code>null</code> if
* no item with the given id can be found
*/
virtual SmartPointer<IContributionItem> Find(const QString& id) const = 0;
/**
* Returns all contribution items known to this manager.
*
* @return a list of contribution items
*/
virtual QList<SmartPointer<IContributionItem> > GetItems() const = 0;
/**
* Returns the overrides for the items of this manager.
*
* @return the overrides for the items of this manager
*/
virtual SmartPointer<IContributionManagerOverrides> GetOverrides() = 0;
/**
* Inserts a contribution item after the item with the given id.
*
* @param id the contribution item id
* @param item the contribution item to insert
* @exception IllegalArgumentException if there is no item with
* the given id
*/
virtual void InsertAfter(const QString& id, const SmartPointer<IContributionItem>& item) = 0;
/**
* Inserts a contribution item before the item with the given id.
*
* @param id the contribution item id
* @param item the contribution item to insert
* @exception IllegalArgumentException if there is no item with
* the given id
*/
virtual void InsertBefore(const QString& id, const SmartPointer<IContributionItem>& item) = 0;
/**
* Returns whether the list of contributions has recently changed and
* has yet to be reflected in the corresponding widgets.
*
* @return <code>true</code> if this manager is dirty, and <code>false</code>
* if it is up-to-date
*/
virtual bool IsDirty() const = 0;
/**
* Returns whether this manager has any contribution items.
*
* @return <code>true</code> if there are no items, and
* <code>false</code> otherwise
*/
virtual bool IsEmpty() const = 0;
/**
* Marks this contribution manager as dirty.
*/
virtual void MarkDirty() = 0;
/**
* Adds a contribution item to this manager at the beginning of the
* group with the given name.
*
* @param groupName the name of the group
* @param item the contribution item
* @exception IllegalArgumentException if there is no group with
* the given name
*/
virtual void PrependToGroup(const QString& groupName, const SmartPointer<IContributionItem>& item) = 0;
/**
* Removes and returns the contribution item with the given id from this manager.
* Returns <code>null</code> if this manager has no contribution items
* with the given id.
*
* @param id the contribution item id
* @return the item that was found and removed, or <code>null</code> if none
*/
virtual SmartPointer<IContributionItem> Remove(const QString& id) = 0;
/**
* Removes the given contribution item from the contribution items
* known to this manager.
*
* @param item the contribution item
* @return the <code>item</code> parameter if the item was removed,
* and <code>null</code> if it was not found
*/
virtual SmartPointer<IContributionItem> Remove(const SmartPointer<IContributionItem>& item) = 0;
/**
* Removes all contribution items from this manager.
*/
virtual void RemoveAll() = 0;
/**
* Updates this manager's underlying widget(s) with any changes which
* have been made to it or its items. Normally changes to a contribution
* manager merely mark it as dirty, without updating the underlying widgets.
* This brings the underlying widgets up to date with any changes.
*
* @param force <code>true</code> means update even if not dirty,
* and <code>false</code> for normal incremental updating
*/
virtual void Update(bool force) = 0;
};
}
#endif // BERRYICONTRIBUTIONMANAGER_H
diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManagerOverrides.h b/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManagerOverrides.h
index d0d32c8408..8fdb67e9a7 100644
--- a/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManagerOverrides.h
+++ b/Plugins/org.blueberry.ui.qt/src/actions/berryIContributionManagerOverrides.h
@@ -1,75 +1,72 @@
/*============================================================================
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 BERRYICONTRIBUTIONMANAGEROVERRIDES_H
#define BERRYICONTRIBUTIONMANAGEROVERRIDES_H
#include <berryMacros.h>
#include <berryObject.h>
#include <org_blueberry_ui_qt_Export.h>
namespace berry {
struct IContributionItem;
/**
* This interface is used by instances of <code>IContributionItem</code>
* to determine if the values for certain properties have been overriden
* by their manager.
* <p>
* This interface is internal to the framework; it should not be implemented outside
* the framework.
* </p>
- *
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IContributionManagerOverrides : virtual Object
{
berryObjectMacro(berry::IContributionManagerOverrides);
/**
* Id for the enabled property. Value is <code>"enabled"</code>.
*/
static const QString P_ENABLED;
/**
* Find out the enablement of the item
* @param item the contribution item for which the enable override value is
* determined
- * @param defaultValue the default value
* @return <ul>
* <li><code>1</code> if the given contribution item should be enabled</li>
* <li><code>0</code> if the item should not be enabled</li>
* <li><code>-1</code> if the item may determine its own enablement</li>
* </ul>
*/
virtual int GetEnabled(const IContributionItem* item) const = 0;
/**
* Visiblity override.
*
* @param item the contribution item in question
* @return <ul>
* <li><code>1</code> if the given contribution item should be visible</li>
* <li><code>0</code> if the item should not be visible</li>
* <li><code>-1</code> if the item may determine its own visibility</li>
* </ul>
*/
virtual int GetVisible(const IContributionItem* item) const = 0;
};
}
#endif // BERRYICONTRIBUTIONMANAGEROVERRIDES_H
diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryIMenuManager.h b/Plugins/org.blueberry.ui.qt/src/actions/berryIMenuManager.h
index 5cd2e47d04..ff5a0c7727 100644
--- a/Plugins/org.blueberry.ui.qt/src/actions/berryIMenuManager.h
+++ b/Plugins/org.blueberry.ui.qt/src/actions/berryIMenuManager.h
@@ -1,126 +1,125 @@
/*============================================================================
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 BERRYIMENUMANAGER_H
#define BERRYIMENUMANAGER_H
#include <berryIContributionManager.h>
#include <berryIContributionItem.h>
namespace berry {
/**
* The <code>IMenuManager</code> interface provides protocol for managing
* contributions to a menu bar and its sub menus.
* An <code>IMenuManager</code> is also an <code>IContributionItem</code>,
* allowing sub-menus to be nested in parent menus.
* <p>
* This interface is internal to the framework; it should not be implemented outside
* the framework.
* </p>
* <p>
* This package provides a concrete menu manager implementation,
* {@link MenuManager <code>MenuManager</code>}.
* </p>
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct IMenuManager : public virtual IContributionManager, public IContributionItem
{
berryObjectMacro(berry::IMenuManager);
/**
* Adds a menu listener to this menu.
* Has no effect if an identical listener is already registered.
*
* @param listener a menu listener
*/
virtual void AddMenuListener(QObject* listener) = 0;
/**
* Finds the manager for the menu at the given path. A path
* consists of contribution item ids separated by the separator
* character. The path separator character is <code>'/'</code>.
* <p>
* Convenience for <code>findUsingPath(path)</code> which
* extracts an <code>IMenuManager</code> if possible.
* </p>
*
* @param path the path string
* @return the menu contribution item, or <code>null</code>
* if there is no such contribution item or if the item does
* not have an associated menu manager
*/
virtual IMenuManager::Pointer FindMenuUsingPath(const QString& path) const = 0;
/**
* Finds the contribution item at the given path. A path
* consists of contribution item ids separated by the separator
* character. The path separator character is <code>'/'</code>.
*
* @param path the path string
* @return the contribution item, or <code>null</code> if there is no
* such contribution item
*/
virtual IContributionItem::Pointer FindUsingPath(const QString& path) const = 0;
/**
* Returns whether all items should be removed when the menu is about to
* show, but before notifying menu listeners. The default is
* <code>false</code>.
*
* @return <code>true</code> if all items should be removed when shown,
* <code>false</code> if not
*/
virtual bool GetRemoveAllWhenShown() const = 0;
/**
* Returns whether this menu should be enabled or not.
*
* @return <code>true</code> if enabled, and
* <code>false</code> if disabled
*/
bool IsEnabled() const override = 0;
/**
* Removes the given menu listener from this menu.
* Has no effect if an identical listener is not registered.
*
* @param listener the menu listener
*/
virtual void RemoveMenuListener(QObject* listener) = 0;
/**
* Sets whether all items should be removed when the menu is about to show,
* but before notifying menu listeners.
*
* @param removeAll
* <code>true</code> if all items should be removed when shown,
* <code>false</code> if not
*/
virtual void SetRemoveAllWhenShown(bool removeAll) = 0;
/**
* Incrementally builds the menu from the contribution items, and
* does so recursively for all submenus.
*
* @param force <code>true</code> means update even if not dirty,
* and <code>false</code> for normal incremental updating
*/
virtual void UpdateAll(bool force) = 0;
};
}
#endif // BERRYIMENUMANAGER_H
diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryMenuManager.h b/Plugins/org.blueberry.ui.qt/src/actions/berryMenuManager.h
index 40dd184909..21b4b66e54 100644
--- a/Plugins/org.blueberry.ui.qt/src/actions/berryMenuManager.h
+++ b/Plugins/org.blueberry.ui.qt/src/actions/berryMenuManager.h
@@ -1,403 +1,403 @@
/*============================================================================
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 BERRYMENUMANAGER_H_
#define BERRYMENUMANAGER_H_
#include "berryIMenuManager.h"
#include "berryContributionManager.h"
#include <org_blueberry_ui_qt_Export.h>
#include <QIcon>
class QMenu;
class QMenuProxy;
class QAction;
namespace berry
{
/**
* A menu manager is a contribution manager which realizes itself and its items
* in a menu control; either as a menu bar, a sub-menu, or a context menu.
* <p>
* This class may be instantiated; it may also be subclassed.
* </p>
*/
class BERRY_UI_QT MenuManager: public QObject, public ContributionManager, public IMenuManager
{
Q_OBJECT
public:
berryObjectMacro(MenuManager);
private:
/**
* The menu id.
*/
QString id;
/**
* The menu control; <code>null</code> before
* creation and after disposal.
*/
QMenuProxy* menu;
QAction* menuItem;
/**
* The menu item widget; <code>null</code> before
* creation and after disposal. This field is used
* when this menu manager is a sub-menu.
*/
//SmartPointer<IMenuItem> menuItem;
/**
* The text for a sub-menu.
*/
QString menuText;
/**
* The image for a sub-menu.
*/
QIcon image;
/**
* The overrides for items of this manager
*/
SmartPointer<IContributionManagerOverrides> overrides;
/**
* The parent contribution manager.
*/
IContributionManager* parent;
/**
* Indicates whether <code>removeAll</code> should be
* called just before the menu is displayed.
*/
bool removeAllWhenShown;
/**
* allows a submenu to display a shortcut key. This is often used with the
* QuickMenu command or action which can pop up a menu using the shortcut.
*/
QString definitionId;
private:
Q_SLOT void HandleAboutToShow();
Q_SLOT void HandleAboutToHide();
protected:
/**
* Indicates this item is visible in its manager; <code>true</code>
* by default.
*/
bool visible;
public:
Q_SIGNAL void AboutToShow(IMenuManager* mm);
Q_SIGNAL void AboutToHide(IMenuManager* mm);
/**
* Creates a menu manager with the given text and id.
* Typically no text is given when creating a context menu.
* Supply a text and id for creating a sub-menu, where it needs to be referred to by the id.
*
* @param text the text for the menu, or <code>""</code> if none
* @param id the menu id, or <code>""</code> if it is to have no id
*/
MenuManager(const QString& text = QString(), const QString& id = QString());
~MenuManager() override;
/**
* Creates a menu manager with the given text, image, and id.
* Typically used for creating a sub-menu, where it needs to be referred to by id.
*
* @param text the text for the menu, or <code>""</code> if none
* @param image the image for the menu, or <code>ImageDescriptor::Pointer(0)</code> if none
* @param id the menu id, or <code>""</code> if it is to have no id
*/
MenuManager(const QString& text, const QIcon& image,
const QString& id);
bool IsDirty() const override;
/**
* Creates and returns a Qt menu control for this menu,
* and installs all registered contributions.
* Does not create a new control if one already exists.
* <p>
* Note that the menu is not expected to be dynamic.
* </p>
*
* @param parent the parent control
* @return the menu control
*/
QMenu* CreateContextMenu(QWidget* parent);
/**
* Creates and returns a Qt menu bar control for this menu,
* for use in the given <code>QWidget</code>, and installs all registered
* contributions. Does not create a new control if one already exists.
*
* @param parent the parent decorations
* @return the menu control
* @since 2.1
*/
QMenuBar* CreateMenuBar(QWidget* parent);
void AddMenuListener(QObject* listener) override;
void RemoveMenuListener(QObject *listener) override;
/*
* @see IContributionItem#Fill(QStatusBar*)
*/
void Fill(QStatusBar* parent) override;
/*
* @see IContributionItem#Fill(QToolBar*, int)
*/
void Fill(QToolBar* parent, QAction *index) override;
/*
* @see IContributionItem#Fill(QMenu*, int)
*/
void Fill(QMenu* parent, QAction *before) override;
/*
* @see IContributionItem#Fill(QMenuBar*, int)
*/
void Fill(QMenuBar* parent, QAction *before) override;
/*
* @see IMenuManager#FindMenuUsingPath(const QString&)
*/
IMenuManager::Pointer FindMenuUsingPath(const QString& path) const override;
/*
* @see IMenuManager#FindUsingPath(const QString&)
*/
IContributionItem::Pointer FindUsingPath(const QString& path) const override;
/**
* Returns the menu id. The menu id is used when creating a contribution
* item for adding this menu as a sub menu of another.
*
* @return the menu id
*/
QString GetId() const override;
/**
* Returns the SWT menu control for this menu manager.
*
* @return the menu control
*/
QMenu* GetMenu() const;
/**
* Returns the text shown in the menu, potentially with a shortcut
* appended.
*
* @return the menu text
*/
QString GetMenuText() const;
/**
* Returns the image for this menu as an image descriptor.
*
* @return the image, or <code>null</code> if this menu has no image
*/
QIcon GetImage() const;
/*
* @see IContributionManager#GetOverrides()
*/
SmartPointer<IContributionManagerOverrides> GetOverrides() override;
/**
* Returns the parent contribution manager of this manger.
*
* @return the parent contribution manager
*/
IContributionManager* GetParent() const;
/*
* @see IMenuManager#GetRemoveAllWhenShown()
*/
bool GetRemoveAllWhenShown() const override;
/*
* @see IContributionItem#IsDynamic()
*/
bool IsDynamic() const override;
/**
* Returns whether this menu should be enabled or not.
* Used to enable the menu item containing this menu when it is realized as a sub-menu.
* <p>
* The default implementation of this framework method
* returns <code>true</code>. Subclasses may reimplement.
* </p>
*
* @return <code>true</code> if enabled, and
* <code>false</code> if disabled
*/
bool IsEnabled() const override;
/*
* @see IContributionItem#IsGroupMarker()
*/
bool IsGroupMarker() const override;
/*
* @see IContributionItem#IsSeparator()
*/
bool IsSeparator() const override;
/*
* @see IContributionItem#IsVisible()
*/
bool IsVisible() const override;
/**
* The <code>MenuManager</code> implementation of this <code>ContributionManager</code> method
* also propagates the dirty flag up the parent chain.
*/
void MarkDirty() override;
/*
* @see IMenuManager#removeMenuListener(IMenuListener)
*/
//void RemoveMenuListener(SmartPointer<IMenuListener> listener);
/*
* @IContributionItem#SaveWidgetState()
*/
void SaveWidgetState() override;
/**
* Sets the overrides for this contribution manager
*
* @param newOverrides the overrides for the items of this manager
*/
void SetOverrides(SmartPointer<IContributionManagerOverrides> newOverrides);
/*
* @see IContributionItem#SetParent(IContributionManager)
*/
void SetParent(IContributionManager* manager) override;
/*
* @see IMenuManager#SetRemoveAllWhenShown(boolean)
*/
void SetRemoveAllWhenShown(bool removeAll) override;
/*
* @see IContributionItem#SetVisible(bool)
*/
void SetVisible(bool visible) override;
/**
* Sets the command id of this action. This simply allows the menu
* item text to include a short cut if available. It can be used to
* notify a user of a key combination that will open a quick menu.
*
* @param definitionId
* the command definition id
*/
void SetCommandId(const QString& definitionId);
/*
* @see IContributionItem#Update()
*/
void Update() override;
void Update(const QString& property) override;
/**
* The <code>MenuManager</code> implementation of this <code>IContributionManager</code>
* updates this menu, but not any of its submenus.
*
- * @see #updateAll
+ * @see #UpdateAll
*/
void Update(bool force) override;
/*
* @see IMenuManager#UpdateAll(bool)
*/
void UpdateAll(bool force) override;
private:
/**
* Initializes the menu control.
*/
void InitializeMenu();
/**
* Dispose any images allocated for this menu
*/
// void DisposeOldImages();
/**
* Updates the menu item for this sub menu.
* The menu item is disabled if this sub menu is empty.
* Does nothing if this menu is not a submenu.
*/
void UpdateMenuItem();
void FillMenu(QWidget* parent, QAction* before);
void DumpActionInfo(QMenuProxy* menu);
void DumpActionInfo(QWidget* widget, int level);
protected:
/**
* Call an <code>IContributionItem</code>'s fill method with the
* implementation's widget. The default is to use the <code>Menu</code>
* widget.<br>
* <code>fill(Menu menu, int index)</code>
*
* @param ci
* An <code>IContributionItem</code> whose <code>fill()</code>
* method should be called.
- * @param index
+ * @param before
* The position the <code>fill()</code> method should start
* inserting at.
*/
void DoItemFill(IContributionItem::Pointer ci, QAction *before);
/**
* Incrementally builds the menu from the contribution items.
* This method leaves out double separators and separators in the first
* or last position.
*
* @param force <code>true</code> means update even if not dirty,
* and <code>false</code> for normal incremental updating
* @param recursive <code>true</code> means recursively update
* all submenus, and <code>false</code> means just this menu
*/
void Update(bool force, bool recursive);
};
}
#endif /* BERRYMENUMANAGER_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berryQActionContributionItem.h b/Plugins/org.blueberry.ui.qt/src/actions/berryQActionContributionItem.h
index 1e05e2ca34..a56af78654 100644
--- a/Plugins/org.blueberry.ui.qt/src/actions/berryQActionContributionItem.h
+++ b/Plugins/org.blueberry.ui.qt/src/actions/berryQActionContributionItem.h
@@ -1,282 +1,281 @@
/*============================================================================
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 BERRYQACTIONCONTRIBUTIONITEM_H
#define BERRYQACTIONCONTRIBUTIONITEM_H
#include "berryContributionItem.h"
namespace berry {
/**
* A contribution item which delegates to a QAction.
* <p>
* This class may be instantiated; it is not intended to be subclassed.
* </p>
- * @noextend This class is not intended to be subclassed by clients.
*/
class BERRY_UI_QT QActionContributionItem : public ContributionItem
{
public:
/**
* Creates a new contribution item from the given action and id.
*
- * @param action
- * the action
+ * @param action the action
+ * @param id
*/
QActionContributionItem(QAction* action, const QString& id);
~QActionContributionItem() override;
/**
* Compares this action contribution item with another object. Two action
* contribution items are equal if they refer to the identical QAction.
*/
bool operator==(const Object* o) const override;
uint HashCode() const override;
/**
* The <code>QActionContributionItem</code> implementation of this
* <code>IContributionItem</code> method creates an SWT
* <code>Button</code> for the action using the action's style. If the
* action's checked property has been set, the button is created and primed
* to the value of the checked property.
*/
void Fill(QStatusBar* parent) override;
/**
* The <code>ActionContributionItem</code> implementation of this
* <code>IContributionItem</code> method creates an SWT
* <code>MenuItem</code> for the action using the action's style. If the
* action's checked property has been set, a button is created and primed to
* the value of the checked property. If the action's menu creator property
* has been set, a cascading submenu is created.
*/
void Fill(QMenu* parent, QAction *before) override;
/**
* The <code>ActionContributionItem</code> implementation of this ,
* <code>IContributionItem</code> method creates an SWT
* <code>ToolItem</code> for the action using the action's style. If the
* action's checked property has been set, a button is created and primed to
* the value of the checked property. If the action's menu creator property
* has been set, a drop-down tool item is created.
*/
void Fill(QToolBar* parent, QAction* before) override;
using ContributionItem::Fill;
/**
* Returns the action associated with this contribution item.
*
* @return the action
*/
QAction* GetAction() const;
/**
* Returns the presentation mode, which is the bitwise-or of the
* <code>MODE_*</code> constants. The default mode setting is 0, meaning
* that for menu items, both text and image are shown (if present), but for
* tool items, the text is shown only if there is no image.
*
* @return the presentation mode settings
*/
Modes GetMode() const;
/**
* The action item implementation of this <code>IContributionItem</code>
* method returns <code>true</code> for menu items and <code>false</code>
* for everything else.
*/
bool IsDynamic() const override;
/*
* Method declared on IContributionItem.
*/
bool IsEnabled() const override;
/**
* The <code>ActionContributionItem</code> implementation of this
* <code>ContributionItem</code> method extends the super implementation
* by also checking whether the command corresponding to this action is
* active.
*/
bool IsVisible() const override;
/**
* Sets the presentation mode, which is the bitwise-or of the
* <code>MODE_*</code> constants.
*
* @param mode
* the presentation mode settings
*/
void SetMode(Modes mode);
/**
* The action item implementation of this <code>IContributionItem</code>
* method calls <code>update(null)</code>.
*/
void Update() override;
/**
* Synchronizes the UI with the given property.
*
* @param propertyName
* the name of the property, or <code>null</code> meaning all
* applicable properties
*/
void Update(const QString& propertyName) override;
protected:
/**
* Returns <code>true</code> if this item is allowed to enable,
* <code>false</code> otherwise.
*
* @return if this item is allowed to be enabled
*/
bool IsEnabledAllowed() const;
/**
* Shorten the given text <code>t</code> so that its length doesn't exceed
* the width of the given ToolItem.The default implementation replaces
* characters in the center of the original string with an ellipsis ("...").
* Override if you need a different strategy.
*
* @param textValue
* the text to shorten
* @param item
* the tool item the text belongs to
* @return the shortened string
*
*/
//QString ShortenText(const QString& textValue, QToolButton* item);
private:
/**
* Returns the listener for SWT tool item widget events.
*
* @return a listener for tool item events
*/
//Listener GetToolItemListener();
/**
* Handles a widget dispose event for the widget corresponding to this item.
*/
//void HandleWidgetDispose(Event e);
/**
* Handles a widget selection event.
*/
//void HandleWidgetSelection(Event e, bool selection);
/**
* Returns whether the given action has any images.
*
* @param actionToCheck
* the action
* @return <code>true</code> if the action has any images,
* <code>false</code> if not
*/
//bool HasImages(Action* actionToCheck) const;
/**
* Returns whether the command corresponding to this action is active.
*/
bool IsCommandActive() const;
/**
* Updates the images for this action.
*
* @param forceImage
* <code>true</code> if some form of image is compulsory, and
* <code>false</code> if it is acceptable for this item to have
* no image
* @return <code>true</code> if there are images for this action,
* <code>false</code> if not
*/
//bool UpdateImages(bool forceImage);
/**
* Dispose any images allocated for this contribution item
*/
//void DisposeOldImages();
/**
* Handle show and hide on the proxy menu for IAction.AS_DROP_DOWN_MENU
* actions.
*
* @return the appropriate listener
*/
//Listener getMenuCreatorListener();
/**
* The proxy menu is being shown, we better get the real menu.
*
* @param proxy
* the proxy menu
*/
//void HandleShowProxy(QMenu* proxy);
/**
* Create MenuItems in the proxy menu that can execute the real menu items
* if selected. Create proxy menus for any real item submenus.
*
* @param realMenu
* the real menu to copy from
* @param proxy
* the proxy menu to populate
*/
//void CopyMenu(QMenu* realMenu, QMenu* proxy);
/**
* The proxy menu is being hidden, so we need to make it go away.
*
* @param proxy
* the proxy menu
*/
//void HandleHideProxy(QMenu* proxy);
private:
/**
* This is the easiest way to hold the menu until we can swap it in to the
* proxy.
*/
//QMenu* holdMenu = null;
//bool menuCreatorCalled = false;
/** a string inserted in the middle of text that has been shortened */
//static const QString ellipsis = "...";
/**
* The presentation mode.
*/
Modes mode; // = 0;
/**
* The action.
*/
QAction* action;
};
}
#endif // BERRYQACTIONCONTRIBUTIONITEM_H
diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berrySeparator.h b/Plugins/org.blueberry.ui.qt/src/actions/berrySeparator.h
index bb1897858e..1bf49f5826 100644
--- a/Plugins/org.blueberry.ui.qt/src/actions/berrySeparator.h
+++ b/Plugins/org.blueberry.ui.qt/src/actions/berrySeparator.h
@@ -1,66 +1,65 @@
/*============================================================================
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 BERRYSEPARATOR_H
#define BERRYSEPARATOR_H
#include "internal/berryAbstractGroupMarker.h"
namespace berry {
/**
* A separator is a special kind of contribution item which acts
* as a visual separator and, optionally, acts as a group marker.
* Unlike group markers, separators do have a visual representation for
* menus and toolbars.
* <p>
* This class may be instantiated; it is not intended to be
* subclassed outside the framework.
* </p>
- * @noextend This class is not intended to be subclassed by clients.
*/
class BERRY_UI_QT Separator : public AbstractGroupMarker
{
public:
/**
* Creates a separator which does not start a new group.
*/
Separator();
/**
* Creates a new separator which also defines a new group having the given group name.
* The group name must not be <code>null</code> or the empty string.
* The group name is also used as the item id.
*
* @param groupName the group name of the separator
*/
Separator(const QString& groupName);
using AbstractGroupMarker::Fill;
void Fill(QMenu* menu, QAction* before) override;
void Fill(QToolBar* toolbar, QAction* before) override;
/**
* The <code>Separator</code> implementation of this <code>IContributionItem</code>
* method returns <code>true</code>
*/
bool IsSeparator() const override;
};
}
#endif // BERRYSEPARATOR_H
diff --git a/Plugins/org.blueberry.ui.qt/src/actions/berrySubContributionItem.h b/Plugins/org.blueberry.ui.qt/src/actions/berrySubContributionItem.h
index d3b4293b21..77efacfeea 100644
--- a/Plugins/org.blueberry.ui.qt/src/actions/berrySubContributionItem.h
+++ b/Plugins/org.blueberry.ui.qt/src/actions/berrySubContributionItem.h
@@ -1,147 +1,151 @@
/*============================================================================
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 BERRYSUBCONTRIBUTIONITEM_H_
#define BERRYSUBCONTRIBUTIONITEM_H_
#include "berryIContributionItem.h"
#include <org_blueberry_ui_qt_Export.h>
namespace berry {
/**
* A <code>SubContributionItem</code> is a wrapper for an <code>IContributionItem</code>.
* It is used within a <code>SubContributionManager</code> to control the visibility
* of items.
* <p>
* This class is not intended to be subclassed.
* </p>
- * @noextend This class is not intended to be subclassed by clients.
*/
class BERRY_UI_QT SubContributionItem : public IContributionItem
{
public:
berryObjectMacro(SubContributionItem);
private:
/**
* The visibility of the item.
*/
bool visible;
/**
* The inner item for this contribution.
*/
IContributionItem::Pointer innerItem;
public:
/**
* Creates a new <code>SubContributionItem</code>.
* @param item the contribution item to be wrapped
*/
SubContributionItem(IContributionItem::Pointer item);
using IContributionItem::Fill;
/*
* Method declared on IContributionItem.
+ * \param parent
*/
void Fill(QStatusBar* parent) override;
/*
* Method declared on IContributionItem.
+ * \param parent
+ * \param before
*/
void Fill(QMenu* parent, QAction* before) override;
/*
* Method declared on IContributionItem.
+ * \param parent
+ * \param before
*/
void Fill(QToolBar* parent, QAction* before) override;
/*
* Method declared on IContributionItem.
*/
QString GetId() const override;
/**
* Returns the inner contribution item.
*
* @return the inner contribution item
*/
IContributionItem::Pointer GetInnerItem() const;
/*
* Method declared on IContributionItem.
*/
bool IsEnabled() const override;
/*
* Method declared on IContributionItem.
*/
bool IsDirty() const override;
/*
* Method declared on IContributionItem.
*/
bool IsDynamic() const override;
/*
* Method declared on IContributionItem.
*/
bool IsGroupMarker() const override;
/*
* Method declared on IContributionItem.
*/
bool IsSeparator() const override;
/*
* Method declared on IContributionItem.
*/
bool IsVisible() const override;
/*
* Method declared on IContributionItem.
*/
void SetParent(IContributionManager* parent) override;
/*
* Method declared on IContributionItem.
*/
void SetVisible(bool visible) override;
/*
* Method declared on IContributionItem.
*/
void Update() override;
/*
* Method declared on IContributionItem.
*/
void Update(const QString& id) override;
/*
* @see IContributionItem#SaveWidgetState()
*/
void SaveWidgetState() override;
};
}
#endif /* BERRYSUBCONTRIBUTIONITEM_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/application/berryIActionBarConfigurer.h b/Plugins/org.blueberry.ui.qt/src/application/berryIActionBarConfigurer.h
index 0a234640ce..ff05d24915 100644
--- a/Plugins/org.blueberry.ui.qt/src/application/berryIActionBarConfigurer.h
+++ b/Plugins/org.blueberry.ui.qt/src/application/berryIActionBarConfigurer.h
@@ -1,102 +1,101 @@
/*============================================================================
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 BERRYIACTIONBARCONFIGURER_H_
#define BERRYIACTIONBARCONFIGURER_H_
#include <berryObject.h>
#include <org_blueberry_ui_qt_Export.h>
namespace berry
{
struct IWorkbenchWindowConfigurer;
struct IMenuManager;
struct IToolBarManager;
/**
* Interface providing special access for configuring the action bars
* of a workbench window.
* <p>
* Note that these objects are only available to the main application
* (the plug-in that creates and owns the workbench).
* </p>
* <p>
* This interface is not intended to be implemented by clients.
* </p>
*
* @see org.blueberry.ui.application.WorkbenchAdvisor#fillActionBars
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IActionBarConfigurer : public Object
{
berryObjectMacro(berry::IActionBarConfigurer);
~IActionBarConfigurer() override;
/**
* Returns the workbench window configurer for the window
* containing this configurer's action bars.
*
* @return the workbench window configurer
*/
virtual SmartPointer<IWorkbenchWindowConfigurer> GetWindowConfigurer() = 0;
/**
* Creates a menu manager for the main menu bar of a workbench window. The
* action bar advisor should use this factory method rather than creating a
* <code>MenuManager</code> directly.
*
* @return the menu manager
*/
virtual IMenuManager* GetMenuManager() = 0;
/**
* Creates a tool bar manager for the workbench window's tool bar. The
* action bar advisor should use this factory method rather than creating a
* <code>ToolBarManager</code> directly.
*
* @return the tool bar manager
*/
virtual IToolBarManager* GetToolBarManager() = 0;
/*
* Returns the status line manager of a workbench window.
*
* @return the status line manager
*/
//virtual IStatusLineManager GetStatusLineManager() = 0;
/*
* Register the action as a global action with a workbench
* window.
* <p>
* For a workbench retarget action
* ({@link org.blueberry.ui.actions.RetargetAction RetargetAction})
* to work, it must be registered.
* You should also register actions that will participate
* in custom key bindings.
* </p>
*
* @param action the global action
* @see org.blueberry.ui.actions.RetargetAction
*/
//virtual void RegisterGlobalAction(IAction action) = 0;
};
}
#endif /*BERRYIACTIONBARCONFIGURER_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/application/berryIWorkbenchWindowConfigurer.h b/Plugins/org.blueberry.ui.qt/src/application/berryIWorkbenchWindowConfigurer.h
index 6a0b8c6cc8..d4ce1df67e 100644
--- a/Plugins/org.blueberry.ui.qt/src/application/berryIWorkbenchWindowConfigurer.h
+++ b/Plugins/org.blueberry.ui.qt/src/application/berryIWorkbenchWindowConfigurer.h
@@ -1,372 +1,371 @@
/*============================================================================
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 BERRYIWORKBENCHWINDOWCONFIGURER_H_
#define BERRYIWORKBENCHWINDOWCONFIGURER_H_
#include <berryObject.h>
#include <org_blueberry_ui_qt_Export.h>
class QMenuBar;
namespace berry
{
struct IActionBarConfigurer;
struct IDropTargetListener;
struct IMemento;
struct IWorkbenchConfigurer;
struct IWorkbenchWindow;
/**
* Interface providing special access for configuring workbench windows.
* <p>
* %Window configurer objects are in 1-1 correspondence with the workbench
* windows they configure. Clients may use <code>Get/SetData</code> to
* associate arbitrary state with the window configurer object.
* </p>
* <p>
* Note that these objects are only available to the main application
* (the plug-in that creates and owns the workbench).
* </p>
* <p>
* This interface is not intended to be implemented by clients.
* </p>
*
* @see IWorkbenchConfigurer#GetWindowConfigurer()
* @see WorkbenchAdvisor#PreWindowOpen()
* @note This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IWorkbenchWindowConfigurer : public Object
{
berryObjectMacro(berry::IWorkbenchWindowConfigurer);
~IWorkbenchWindowConfigurer() override;
/**
* Returns the underlying workbench window.
*
* @return the workbench window
*/
virtual SmartPointer<IWorkbenchWindow> GetWindow() = 0;
/**
* Returns the workbench configurer.
*
* @return the workbench configurer
*/
virtual SmartPointer<IWorkbenchConfigurer> GetWorkbenchConfigurer() = 0;
/**
* Returns the action bar configurer for this workbench
* window.
*
* @return the action bar configurer
*/
virtual SmartPointer<IActionBarConfigurer> GetActionBarConfigurer() = 0;
/**
* Returns the title of the underlying workbench window.
*
* @return the window title
*/
virtual QString GetTitle() = 0;
/**
* Sets the title of the underlying workbench window.
*
* @param title the window title
*/
virtual void SetTitle(const QString& title) = 0;
/**
* Returns whether the underlying workbench window has a menu bar.
* <p>
* The initial value is <code>true</code>.
* </p>
*
* @return <code>true</code> for a menu bar, and <code>false</code>
* for no menu bar
*/
virtual bool GetShowMenuBar() const = 0;
/**
* Sets whether the underlying workbench window has a menu bar.
*
* @param show <code>true</code> for a menu bar, and <code>false</code>
* for no menu bar
*/
virtual void SetShowMenuBar(bool show) = 0;
/**
* Returns whether the underlying workbench window has a tool bar.
* <p>
* The initial value is <code>true</code>.
* </p>
*
* @return <code>true</code> for a tool bar, and <code>false</code>
* for no tool bar
*/
virtual bool GetShowToolBar() const = 0;
/**
* Sets whether the underlying workbench window has a tool bar.
*
* @param show <code>true</code> for a tool bar, and <code>false</code>
* for no tool bar
*/
virtual void SetShowToolBar(bool show) = 0;
/**
* Returns whether the underlying workbench window has a status line.
* <p>
* The initial value is <code>true</code>.
* </p>
*
* @return <code>true</code> for a status line, and <code>false</code>
* for no status line
*/
virtual bool GetShowStatusLine() const = 0;
/**
* Sets whether the underlying workbench window has a status line.
*
* @param show <code>true</code> for a status line, and <code>false</code>
* for no status line
*/
virtual void SetShowStatusLine(bool show) = 0;
/**
* Returns whether the underlying workbench window has a perspective bar (the
* perspective bar provides buttons to quickly switch between perspectives).
* <p>
* The initial value is <code>false</code>.
* </p>
*
* @return <code>true</code> for a perspective bar, and <code>false</code>
* for no perspective bar
*/
virtual bool GetShowPerspectiveBar() const = 0;
/**
* Sets whether the underlying workbench window has a perspective bar (the
* perspective bar provides buttons to quickly switch between perspectives).
*
* @param show <code>true</code> for a perspective bar, and
* <code>false</code> for no perspective bar
*/
virtual void SetShowPerspectiveBar(bool show) = 0;
/**
* Returns whether the underlying workbench window has a progress indicator.
* <p>
* The initial value is <code>false</code>.
* </p>
*
* @return <code>true</code> for a progress indicator, and <code>false</code>
* for no progress indicator
*/
virtual bool GetShowProgressIndicator() const = 0;
/**
* Sets whether the underlying workbench window has a progress indicator.
*
* @param show <code>true</code> for a progress indicator, and <code>false</code>
* for no progress indicator
*/
virtual void SetShowProgressIndicator(bool show) = 0;
/**
* Returns the style bits to use for the window's main widget when it is created.
* The default is <code>0</code>.
*
* @return the style bits
*/
virtual Qt::WindowFlags GetWindowFlags() const = 0;
/**
* Sets the style bits to use for the window's main widget when it is created.
* This method has no effect after the widget is created.
* That is, it must be called within the <code>WorkbenchAdvisor#PreWindowOpen()</code>
* callback.
* <p>
* For more details on the applicable style bits, see the
* documentation for Qt::WindowFlags.
* </p>
*
* @param windowFlags the style bits
*/
virtual void SetWindowFlags(Qt::WindowFlags windowFlags) = 0;
/**
* Returns the size to use for the window's shell when it is created.
*
* @return the initial size to use for the shell
*/
virtual QPoint GetInitialSize() const = 0;
/**
* Sets the size to use for the window's shell when it is created.
* This method has no effect after the shell is created.
* That is, it must be called within the <code>WorkbenchAdvisor#PreWindowOpen()</code>
* callback.
*
* @param initialSize the initial size to use for the shell
*/
virtual void SetInitialSize(QPoint initialSize) = 0;
/*
* Returns the data associated with this workbench window at the given key.
*
* @param key the key
* @return the data, or <code>null</code> if there is no data at the given
* key
*/
//virtual Object getData(String key);
/*
* Sets the data associated with this workbench window at the given key.
*
* @param key the key
* @param data the data, or <code>null</code> to delete existing data
*/
//virtual void setData(String key, Object data);
/**
* Adds the given drag and drop Mime types to the ones
* supported for drag and drop on the editor area of this workbench window.
* <p>
* The workbench advisor would ordinarily call this method from the
* <code>PreWindowOpen</code> callback.
* A newly-created workbench window supports no drag and drop transfer
* types.
* </p>
* <p>
* Note that drag and drop to the editor area requires adding one or more
* transfer types (using <code>AddEditorAreaTransfer</code>) and
* configuring a drop target listener
* (with <code>ConfigureEditorAreaDropListener</code>)
* capable of handling any of those transfer types.
* </p>
*
- * @param transfer a drag and drop transfer object
- * @see #configureEditorAreaDropListener
+ * @param transferTypes drag and drop transfer objects
* @see org.blueberry.ui.part.EditorInputTransfer
*/
virtual void AddEditorAreaTransfer(const QStringList& transferTypes) = 0;
/**
* Configures the drop target listener for the editor area of this workbench window.
* <p>
* The workbench advisor ordinarily calls this method from the
* <code>PreWindowOpen</code> callback.
* A newly-created workbench window has no configured drop target listener for its
* editor area.
* </p>
* <p>
* Note that drag and drop to the editor area requires adding one or more
* transfer types (using <code>AddEditorAreaTransfer</code>) and
* configuring a drop target listener
* (with <code>ConfigureEditorAreaDropListener</code>)
* capable of handling any of those transfer types.
* </p>
*
* @param dropTargetListener the drop target listener that will handle
* requests to drop an object on to the editor area of this window
*
* @see #AddEditorAreaTransfer
*/
virtual void ConfigureEditorAreaDropListener(IDropTargetListener* dropTargetListener) = 0;
/**
* Creates the menu bar for the window's shell.
* <p>
* This should only be called if the advisor is defining custom window contents
* in <code>CreateWindowContents</code>, and may only be called once.
* The caller must set it in the shell using <code>Shell.setMenuBar(Menu)</code>
* but must not make add, remove or change items in the result.
* The menu bar is populated by the window's menu manager.
* The application can add to the menu manager in the advisor's
* <code>FillActionBars</code> method instead.
* </p>
*
* @return the menu bar, suitable for setting in the shell
*/
virtual QMenuBar* CreateMenuBar() = 0;
/**
* Creates the tool bar control.
* <p>
* This should only be called if the advisor is defining custom window contents
* in <code>CreateWindowContents</code>, and may only be called once.
* The caller must lay out the tool bar appropriately within the parent,
* but must not add, remove or change items in the result (hence the
* return type of <code>QWidget</code>).
* The tool bar is populated by the window's tool bar manager.
* The application can add to the tool bar manager in the advisor's
* <code>FillActionBars</code> method instead.
* </p>
*
* @param parent the parent widget
* @return the tool bar control, suitable for laying out in the parent
*/
virtual QWidget* CreateToolBar(QWidget* parent) = 0;
/*
* Creates the status line control.
* <p>
* This should only be called if the advisor is defining custom window contents
* in <code>createWindowContents</code>, and may only be called once.
* The caller must lay out the status line appropriately within the parent,
* but must not add, remove or change items in the result (hence the
* return type of <code>Control</code>).
* The status line is populated by the window's status line manager.
* The application can add to the status line manager in the advisor's
* <code>fillActionBars</code> method instead.
* </p>
*
* @param parent the parent composite
* @return the status line control, suitable for laying out in the parent
*/
//virtual Control createStatusLineControl(Composite parent);
/**
* Creates the page composite, in which the window's pages, and their
* views and editors, appear.
* <p>
* This should only be called if the advisor is defining custom window contents
* in <code>WorkbenchWindowAdvisor#CreateWindowContents()</code>, and may only be called once.
* The caller must lay out the page composite appropriately within the parent,
* but must not add, remove or change items in the result.
* The page composite is populated by the workbench.
* </p>
*
* @param parent the parent composite
* @return the page composite, suitable for laying out in the parent
*/
virtual QWidget* CreatePageComposite(QWidget* parent) = 0;
/**
* Saves the current state of the window using the specified memento.
*
* @param memento the memento in which to save the window's state
* @return a status object indicating whether the save was successful
* @see IWorkbenchConfigurer#RestoreWorkbenchWindow(IMemento::Pointer)
*/
virtual bool SaveState(SmartPointer<IMemento> memento) = 0;
};
}
#endif /*BERRYIWORKBENCHWINDOWCONFIGURER_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryAbstractUICTKPlugin.h b/Plugins/org.blueberry.ui.qt/src/berryAbstractUICTKPlugin.h
index e619d2af76..1c2582ff86 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryAbstractUICTKPlugin.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryAbstractUICTKPlugin.h
@@ -1,290 +1,194 @@
/*============================================================================
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 BERRYABSTRACTUICTKPLUGIN_H_
#define BERRYABSTRACTUICTKPLUGIN_H_
#include <org_blueberry_ui_qt_Export.h>
#include <berryPlugin.h>
namespace berry {
template<class T> class SmartPointer;
struct IPreferences;
struct IPreferencesService;
struct IWorkbench;
/**
* \ingroup org_blueberry_ui_qt
*
* Abstract base class for plug-ins that integrate with the BlueBerry platform UI.
* <p>
* Subclasses obtain the following capabilities:
* </p>
* <p>
* Preferences
* <ul>
* <li> The platform core runtime contains general support for plug-in
* preferences (<code>org.blueberry.core.runtime.Preferences</code>).
* This class provides appropriate conversion to the older JFace preference
* API (<code>org.blueberry.jface.preference.IPreferenceStore</code>).</li>
* <li> The method <code>getPreferenceStore</code> returns the JFace preference
* store (cf. <code>Plugin.getPluginPreferences</code> which returns
* a core runtime preferences object.</li>
* <li> Subclasses may reimplement <code>initializeDefaultPreferences</code>
* to set up any default values for preferences using JFace API. In this
* case, <code>initializeDefaultPluginPreferences</code> should not be
* overridden.</li>
* <li> Subclasses may reimplement
* <code>initializeDefaultPluginPreferences</code> to set up any default
* values for preferences using core runtime API. In this
* case, <code>initializeDefaultPreferences</code> should not be
* overridden.</li>
* <li> Preferences are also saved automatically on plug-in shutdown.
* However, saving preferences immediately after changing them is
* strongly recommended, since that ensures that preference settings
* are not lost even in the event of a platform crash.</li>
* </ul>
* Dialogs
* <ul>
* <li> The dialog store is read the first time <code>getDialogSettings</code>
* is called.</li>
* <li> The dialog store allows the plug-in to "record" important choices made
* by the user in a wizard or dialog, so that the next time the
* wizard/dialog is used the widgets can be defaulted to better values. A
* wizard could also use it to record the last 5 values a user entered into
* an editable combo - to show "recent values". </li>
* <li> The dialog store is found in the file whose name is given by the
* constant <code>FN_DIALOG_STORE</code>. A dialog store file is first
* looked for in the plug-in's read/write state area; if not found there,
* the plug-in's install directory is checked.
* This allows a plug-in to ship with a read-only copy of a dialog store
* file containing initial values for certain settings.</li>
* <li> Plug-in code can call <code>saveDialogSettings</code> to cause settings to
* be saved in the plug-in's read/write state area. A plug-in may opt to do
* this each time a wizard or dialog is closed to ensure the latest
* information is always safe on disk. </li>
* <li> Dialog settings are also saved automatically on plug-in shutdown.</li>
* </ul>
* <p>
* For easy access to your plug-in object, use the singleton pattern. Declare a
* static variable in your plug-in class for the singleton. Store the first
* (and only) instance of the plug-in class in the singleton when it is created.
* Then access the singleton when needed through a static <code>getDefault</code>
* method.
* </p>
* <p>
* See the description on {@link Plugin}.
* </p>
*/
class BERRY_UI_QT AbstractUICTKPlugin : public Plugin
{
Q_OBJECT
private:
/**
* The name of the dialog settings file (value
* <code>"dialog_settings.xml"</code>).
*/
static const QString FN_DIALOG_SETTINGS;
- /**
- * Storage for dialog and wizard data; <code>null</code> if not yet
- * initialized.
- */
- //DialogSettings dialogSettings = null;
-
/**
* Storage for preferences.
*/
mutable IPreferencesService* preferencesService;
- /**
- * The bundle listener used for kicking off refreshPluginActions().
- */
- //BundleListener bundleListener;
-
public:
/**
* Creates an abstract UI plug-in runtime object.
* <p>
* Plug-in runtime classes are <code>ctkPluginActivator</code>s and so must
* have an default constructor. This method is called by the runtime when
* the associated bundle is being activated.
*/
AbstractUICTKPlugin();
- /**
- * Returns the dialog settings for this UI plug-in.
- * The dialog settings is used to hold persistent state data for the various
- * wizards and dialogs of this plug-in in the context of a workbench.
- * <p>
- * If an error occurs reading the dialog store, an empty one is quietly created
- * and returned.
- * </p>
- * <p>
- * Subclasses may override this method but are not expected to.
- * </p>
- *
- * @return the dialog settings
- */
-// IDialogSettings getDialogSettings();
-
/**
* Returns the preferences service for this UI plug-in.
* This preferences service is used to hold persistent settings for this plug-in in
* the context of a workbench. Some of these settings will be user controlled,
* whereas others may be internal setting that are never exposed to the user.
* <p>
* If an error occurs reading the preferences service, an empty preference service is
* quietly created, initialized with defaults, and returned.
* </p>
*
* @return the preferences service
*/
IPreferencesService* GetPreferencesService() const;
SmartPointer<IPreferences> GetPreferences() const;
/**
* Returns the Platform UI workbench.
* <p>
* This method exists as a convenience for plugin implementors. The
* workbench can also be accessed by invoking <code>PlatformUI.getWorkbench()</code>.
* </p>
* @return IWorkbench the workbench for this plug-in
*/
IWorkbench* GetWorkbench();
-
-protected:
-
- /**
- * Returns a new image registry for this plugin-in. The registry will be
- * used to manage images which are frequently used by the plugin-in.
- * <p>
- * The default implementation of this method creates an empty registry.
- * Subclasses may override this method if needed.
- * </p>
- *
- * @return ImageRegistry the resulting registry.
- * @see #getImageRegistry
- */
-// ImageRegistry createImageRegistry();
-
- /**
- * Initializes an image registry with images which are frequently used by the
- * plugin.
- * <p>
- * The image registry contains the images used by this plug-in that are very
- * frequently used and so need to be globally shared within the plug-in. Since
- * many OSs have a severe limit on the number of images that can be in memory
- * at any given time, each plug-in should only keep a small number of images in
- * its registry.
- * </p><p>
- * Implementors should create a JFace image descriptor for each frequently used
- * image. The descriptors describe how to create/find the image should it be needed.
- * The image described by the descriptor is not actually allocated until someone
- * retrieves it.
- * </p><p>
- * Subclasses may override this method to fill the image registry.
- * </p>
- * @param reg the registry to initalize
- *
- * @see #getImageRegistry
- */
-// void initializeImageRegistry(ImageRegistry reg);
-
- /**
- * Loads the dialog settings for this plug-in.
- * The default implementation first looks for a standard named file in the
- * plug-in's read/write state area; if no such file exists, the plug-in's
- * install directory is checked to see if one was installed with some default
- * settings; if no file is found in either place, a new empty dialog settings
- * is created. If a problem occurs, an empty settings is silently used.
- * <p>
- * This framework method may be overridden, although this is typically
- * unnecessary.
- * </p>
- */
-// void loadDialogSettings();
-
-
- /**
- * Refreshes the actions for the plugin.
- * This method is called from <code>startup</code>.
- * <p>
- * This framework method may be overridden, although this is typically
- * unnecessary.
- * </p>
- */
-// void refreshPluginActions();
-
- /**
- * Saves this plug-in's dialog settings.
- * Any problems which arise are silently ignored.
- */
-// void saveDialogSettings();
-
-
public:
/**
* The <code>AbstractUIPlugin</code> implementation of this <code>Plugin</code>
* method refreshes the plug-in actions. Subclasses may extend this method,
* but must send super <b>first</b>.
+ *
+ * \param context
*/
void start(ctkPluginContext* context) override;
/**
* The <code>AbstractUIPlugin</code> implementation of this <code>Plugin</code>
* method saves this plug-in's preference and dialog stores and shuts down
* its image registry (if they are in use). Subclasses may extend this
* method, but must send super <b>last</b>. A try-finally statement should
* be used where necessary to ensure that <code>super.shutdown()</code> is
* always done.
*/
void stop(ctkPluginContext* context) override;
/**
* Creates and returns a new image descriptor for an image file located
* within the specified plug-in.
* <p>
* This is a convenience method that simply locates the image file in
* within the plug-in (no image registries are involved). The path is
* relative to the root of the plug-in, and takes into account files
* coming from plug-in fragments. The path may include $arg$ elements.
* However, the path must not have a leading "." or path separator.
* Clients should use a path like "icons/mysample.gif" rather than
* "./icons/mysample.gif" or "/icons/mysample.gif".
* </p>
*
* @param pluginId the id of the plug-in containing the image file;
* <code>null</code> is returned if the plug-in does not exist
* @param imageFilePath the relative path of the image file, relative to the
* root of the plug-in; the path must be legal
* @return an image descriptor, or <code>null</code> if no image
* could be found
*/
static QIcon ImageDescriptorFromPlugin(
const QString& pluginId, const QString& imageFilePath);
static QIcon GetMissingIcon();
};
} // namespace berry
#endif /*BERRYABSTRACTUICTKPLUGIN_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryEditorPart.h b/Plugins/org.blueberry.ui.qt/src/berryEditorPart.h
index b2a72fb275..1d25e52058 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryEditorPart.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryEditorPart.h
@@ -1,246 +1,245 @@
/*============================================================================
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 BERRYEDITORPART_H_
#define BERRYEDITORPART_H_
#include <org_blueberry_ui_qt_Export.h>
#include "berryIEditorPart.h"
#include "berryIEditorInput.h"
#include "berryIEditorSite.h"
#include "berryWorkbenchPart.h"
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* Abstract base implementation of all workbench editors.
* <p>
* This class should be subclassed by clients wishing to define new editors.
* The name of the subclass should be given as the <code>"class"</code>
* attribute in a <code>editor</code> extension contributed to the workbench's
* editor extension point (named <code>"org.mitk.ui.editors"</code>).
* For example, the plug-in's XML markup might contain:
- * <pre>
- * &LT;extension point="org.blueberry.ui.editors"&GT;
- * &LT;editor id="com.example.myplugin.ed"
- * name="My Editor"
- * icon="./images/cedit.gif"
- * extensions="foo"
- * class="com.example.myplugin.MyFooEditor"
- * contributorClass="com.example.myplugin.MyFooEditorContributor"
- * /&GT;
- * &LT;/extension&GT;
- * </pre>
+ * \code{.unparsed}
+ * <extension point="org.blueberry.ui.editors">
+ * <editor id="com.example.myplugin.ed"
+ * name="My Editor"
+ * icon="./images/cedit.gif"
+ * extensions="foo"
+ * class="com.example.myplugin.MyFooEditor"
+ * contributorClass="com.example.myplugin.MyFooEditorContributor" />
+ * </extension>
+ * \endcode
* where <code>com.example.myplugin.MyEditor</code> is the name of the
* <code>EditorPart</code> subclass.
* </p>
* <p>
* Subclasses must implement the following methods:
* <ul>
* <li><code>IEditorPart.init</code> - to initialize editor when assigned its site</li>
* <li><code>IWorkbenchPart.createPartControl</code> - to create the editor's controls </li>
* <li><code>IWorkbenchPart.setFocus</code> - to accept focus</li>
* <li><code>IEditorPart.isDirty</code> - to decide whether a significant change has
* occurred</li>
* <li><code>IEditorPart.doSave</code> - to save contents of editor</li>
* <li><code>IEditorPart.doSaveAs</code> - to save contents of editor</li>
* <li><code>IEditorPart.isSaveAsAllowed</code> - to control Save As</li>
* </ul>
* </p>
* <p>
* Subclasses may extend or reimplement the following methods as required:
* <ul>
* <li><code>IExecutableExtension.setInitializationData</code> - extend to provide additional
* initialization when editor extension is instantiated</li>
* <li><code>IWorkbenchPart.dispose</code> - extend to provide additional cleanup</li>
* <li><code>IAdaptable.getAdapter</code> - reimplement to make the editor
* adaptable</li>
* </ul>
* </p>
*/
class BERRY_UI_QT EditorPart : public WorkbenchPart , public virtual IEditorPart {
Q_OBJECT
Q_INTERFACES(berry::IEditorPart)
public:
berryObjectMacro(EditorPart, WorkbenchPart, IEditorPart);
private:
/**
* Editor input, or <code>null</code> if none.
*/
IEditorInput::Pointer editorInput;
protected:
/**
* Creates a new workbench editor.
*/
EditorPart();
/**
* Sets the input to this editor. This method simply updates the internal
* member variable.
*
* <p>Unlike most of the other set methods on this class, this method does
* not fire a property change. Clients that call this method from a subclass
* must ensure that they fire an IWorkbenchPartConstants.PROP_INPUT property
* change after calling this method but before leaving whatever public method
* they are in. Clients that expose this method as public API must fire
* the property change within their implementation of setInput.</p>
*
* <p>Note that firing a property change may cause listeners to immediately
* reach back and call methods on this editor. Care should be taken not to
* fire the property change until the editor has fully updated its internal
* state to reflect the new input.</p>
*
* @param input the editor input
*
- * @see #setInputWithNotify(IEditorInput)
+ * @see #SetInputWithNotify
*/
virtual void SetInput(IEditorInput::Pointer input) ;
/**
* Sets the input to this editor and fires a PROP_INPUT property change if
* the input has changed. This is the convenience method implementation.
*
* <p>Note that firing a property change may cause other objects to reach back
* and invoke methods on the editor. Care should be taken not to call this method
* until the editor has fully updated its internal state to reflect the
* new input.</p>
*
* @since 3.2
*
* @param input the editor input
*/
virtual void SetInputWithNotify(IEditorInput::Pointer input);
/* (non-Javadoc)
* @see org.blueberry.ui.part.WorkbenchPart#setContentDescription(java.lang.String)
*/
void SetContentDescription(const QString& description) override;
/* (non-Javadoc)
* @see org.blueberry.ui.part.WorkbenchPart#setPartName(java.lang.String)
*/
void SetPartName(const QString& partName) override;
/**
* Checks that the given site is valid for this type of part.
* The site for an editor must be an <code>IEditorSite</code>.
*
* @param site the site to check
* @since 3.1
*/
void CheckSite(IWorkbenchPartSite::Pointer site) override;
public:
/* (non-Javadoc)
* Saves the contents of this editor.
* <p>
* Subclasses must override this method to implement the open-save-close lifecycle
* for an editor. For greater details, see <code>IEditorPart</code>
* </p>
*
* @see IEditorPart
*/
void DoSave(/*IProgressMonitor monitor*/) override = 0;
/* (non-Javadoc)
* Saves the contents of this editor to another object.
* <p>
* Subclasses must override this method to implement the open-save-close lifecycle
* for an editor. For greater details, see <code>IEditorPart</code>
* </p>
*
* @see IEditorPart
*/
void DoSaveAs() override = 0;
/* (non-Javadoc)
* Method declared on IEditorPart.
*/
IEditorInput::Pointer GetEditorInput() const override;
/* (non-Javadoc)
* Method declared on IEditorPart.
*/
IEditorSite::Pointer GetEditorSite() const override;
/* (non-Javadoc)
* Gets the title tool tip text of this part.
*
* @return the tool tip text
*/
QString GetTitleToolTip() const override;
/* (non-Javadoc)
* Initializes the editor part with a site and input.
* <p>
* Subclasses of <code>EditorPart</code> must implement this method. Within
* the implementation subclasses should verify that the input type is acceptable
* and then save the site and input. Here is sample code:
* </p>
* <pre>
* if (!(input instanceof IFileEditorInput))
* throw new PartInitException("Invalid Input: Must be IFileEditorInput");
* setSite(site);
* setInput(input);
* </pre>
*/
void Init(IEditorSite::Pointer site, IEditorInput::Pointer input) override = 0;
/* (non-Javadoc)
* Returns whether the contents of this editor have changed since the last save
* operation.
* <p>
* Subclasses must override this method to implement the open-save-close lifecycle
* for an editor. For greater details, see <code>IEditorPart</code>
* </p>
*
* @see IEditorPart
*/
bool IsDirty() const override = 0;
/* (non-Javadoc)
* Returns whether the "save as" operation is supported by this editor.
* <p>
* Subclasses must override this method to implement the open-save-close lifecycle
* for an editor. For greater details, see <code>IEditorPart</code>
* </p>
*
* @see IEditorPart
*/
bool IsSaveAsAllowed() const override = 0;
/* (non-Javadoc)
* Returns whether the contents of this editor should be saved when the editor
* is closed.
* <p>
* This method returns <code>true</code> if and only if the editor is dirty
* (<code>isDirty</code>).
* </p>
*/
bool IsSaveOnCloseNeeded() const override;
};
}
#endif /*BERRYEDITORPART_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryGeometry.h b/Plugins/org.blueberry.ui.qt/src/berryGeometry.h
index 7be28d65d2..d80c46d8a8 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryGeometry.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryGeometry.h
@@ -1,162 +1,162 @@
/*============================================================================
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 BERRYGEOMETRY_H_
#define BERRYGEOMETRY_H_
#include <org_blueberry_ui_qt_Export.h>
class QRect;
class QPoint;
class QWidget;
namespace berry {
struct BERRY_UI_QT Geometry
{
/**
* Returns the height or width of the given rectangle.
*
* @param toMeasure rectangle to measure
* @param width returns the width if true, and the height if false
* @return the width or height of the given rectangle
* @since 3.0
*/
static int GetDimension(const QRect& toMeasure, bool width);
/**
* Returns true iff the given side constant corresponds to a horizontal side
* of a rectangle. That is, returns true for the top and bottom but false for the
* left and right.
*
- * @param swtSideConstant one of Constants::TOP, Constants::BOTTOM, Constants::LEFT, or Constants::RIGHT
+ * @param berrySideConstant one of Constants::TOP, Constants::BOTTOM, Constants::LEFT, or Constants::RIGHT
* @return true iff the given side is horizontal.
* @since 3.0
*/
static bool IsHorizontal(int berrySideConstant);
/**
* Extrudes the given edge inward by the given distance. That is, if one side of the rectangle
* was sliced off with a given thickness, this returns the rectangle that forms the slice. Note
* that the returned rectangle will be inside the given rectangle if size > 0.
*
* @param toExtrude the rectangle to extrude. The resulting rectangle will share three sides
* with this rectangle.
* @param size distance to extrude. A negative size will extrude outwards (that is, the resulting
* rectangle will overlap the original iff this is positive).
* @param orientation the side to extrude. One of Constants::LEFT, Constants::RIGHT, Constants::TOP, or Constants::BOTTOM. The
* resulting rectangle will always share this side with the original rectangle.
* @return a rectangle formed by extruding the given side of the rectangle by the given distance.
*/
static QRect GetExtrudedEdge(const QRect& toExtrude, int size,
int orientation);
/**
* Normalizes the given rectangle. That is, any rectangle with
* negative width or height becomes a rectangle with positive
* width or height that extends to the upper-left of the original
* rectangle.
*
* @param rect rectangle to modify
*/
static void Normalize(QRect& rect);
/**
* Returns the edge of the given rectangle is closest to the given
* point.
*
* @param boundary rectangle to test
* @param toTest point to compare
* @return one of SWT.LEFT, SWT.RIGHT, SWT.TOP, or SWT.BOTTOM
*
* @since 3.0
*/
static int GetClosestSide(const QRect& boundary, const QPoint& toTest);
/**
* Returns the distance of the given point from a particular side of the given rectangle.
* Returns negative values for points outside the rectangle.
*
* @param rectangle a bounding rectangle
* @param testPoint a point to test
* @param edgeOfInterest side of the rectangle to test against
* @return the distance of the given point from the given edge of the rectangle
* @since 3.0
*/
static int GetDistanceFromEdge(const QRect& rectangle, const QPoint& testPoint,
int edgeOfInterest);
/**
* Returns the opposite of the given direction. That is, returns SWT.LEFT if
* given SWT.RIGHT and visa-versa.
*
- * @param swtDirectionConstant one of SWT.LEFT, SWT.RIGHT, SWT.TOP, or SWT.BOTTOM
+ * @param directionConstant one of SWT.LEFT, SWT.RIGHT, SWT.TOP, or SWT.BOTTOM
* @return one of SWT.LEFT, SWT.RIGHT, SWT.TOP, or SWT.BOTTOM
* @since 3.0
*/
static int GetOppositeSide(int directionConstant);
/**
* Converts the given rectangle from display coordinates to the local coordinate system
* of the given object
*
* @param coordinateSystem local coordinate system (widget) being converted to
* @param toConvert rectangle to convert
* @return a rectangle in control coordinates
* @since 3.0
*/
static QRect ToControl(QWidget* coordinateSystem,
const QRect& toConvert);
/**
* Converts the given point from display coordinates to the local coordinate system
* of the given object
*
* @param coordinateSystem local coordinate system (widget) being converted to
* @param toConvert point to convert
* @return a point in control coordinates
* @since 3.0
*/
static QPoint ToControl(QWidget* coordinateSystem,
const QPoint& toConvert);
/**
* Converts the given rectangle from the local coordinate system of the given object
* into display coordinates.
*
* @param coordinateSystem local coordinate system (widget) being converted from
* @param toConvert rectangle to convert
* @return a rectangle in display coordinates
* @since 3.0
*/
static QRect ToDisplay(QWidget* coordinateSystem,
const QRect& toConvert);
/**
* Converts the given point from the local coordinate system of the given object
* into display coordinates.
*
* @param coordinateSystem local coordinate system (widget) being converted from
* @param toConvert point to convert
* @return a point in display coordinates
* @since 3.0
*/
static QPoint ToDisplay(QWidget* coordinateSystem,
const QPoint& toConvert);
};
}
#endif /* BERRYGEOMETRY_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIActionBars.h b/Plugins/org.blueberry.ui.qt/src/berryIActionBars.h
index 0e1dc6c8e4..4c79df5e4a 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIActionBars.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIActionBars.h
@@ -1,108 +1,107 @@
/*============================================================================
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 BERRYIACTIONBARS_H
#define BERRYIACTIONBARS_H
#include <berryObject.h>
namespace berry {
struct IServiceLocator;
struct IMenuManager;
struct IStatusLineManager;
struct IToolBarManager;
class Action;
/**
* Used by a part to access its menu, toolbar, and status line managers.
* <p>
* Within the workbench each part, editor or view, has a private set of action
* bars. This set, which contains a menu, toolbar, and status line, appears
* in the local toolbar for a view and in the window for an editor. The view
* may provide an implementation for pre-existing actions or add new actions to
* the action bars.
* </p><p>
* A part may also contribute new actions to the action bars as required. To do
* this, call <code>GetMenuManager</code>, <code>GetToolBarManager</code>, or
* <code>GetStatusLineManager</code> as appropriate to get the action target.
* Add the action(s) to the target and call <code>update</code> to commit
* any changes to the underlying widgets.
* </p><p>
* This interface is not intended to be implemented by clients.
* </p>
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct IActionBars : public Object
{
berryObjectMacro(berry::IActionBars);
/**
* Returns the menu manager.
* <p>
* Note: Clients who add or remove items from the returned menu manager are
* responsible for calling <code>updateActionBars</code> so that the changes
* can be propagated throughout the workbench.
* </p>
*
* @return the menu manager
*/
virtual IMenuManager* GetMenuManager() = 0;
/**
* Returns the service locator for these action bars. The locator is found
* by looking locally, and then ascending the action bar hierarchy.
*
* @return The service locator; never <code>null</code>.
*/
virtual IServiceLocator* GetServiceLocator() = 0;
/**
* Returns the status line manager.
* <p>
* Note: Clients who add or remove items from the returned status line
* manager are responsible for calling <code>updateActionBars</code> so
* that the changes can be propagated throughout the workbench.
* </p>
*
* @return the status line manager
*/
virtual IStatusLineManager* GetStatusLineManager() = 0;
/**
* Returns the tool bar manager.
* <p>
* Note: Clients who add or remove items from the returned tool bar manager are
* responsible for calling <code>updateActionBars</code> so that the changes
* can be propagated throughout the workbench.
* </p>
*
* @return the tool bar manager
*/
virtual IToolBarManager* GetToolBarManager() = 0;
/**
* Updates the action bars.
* <p>
* Clients who add or remove items from the menu, tool bar, or status line
* managers, or that update global action handlers, should call this method
* to propagated the changes throughout the workbench.
* </p>
*/
virtual void UpdateActionBars() = 0;
};
}
#endif // BERRYIACTIONBARS_H
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIContextService.h b/Plugins/org.blueberry.ui.qt/src/berryIContextService.h
index eefd65c018..febb4813e4 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIContextService.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIContextService.h
@@ -1,378 +1,378 @@
/*============================================================================
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 BERRYICONTEXTSERVICE_H
#define BERRYICONTEXTSERVICE_H
#include "berryIServiceWithSources.h"
namespace berry {
struct IContextActivation;
struct IContextManagerListener;
class Context;
class Expression;
class Shell;
/**
* <p>
* Provides services related to contexts in the blueberry workbench. This provides
* access to contexts.
* </p>
* <p>
* This service can be acquired from your service locator:
* <pre>
* IContextService service = (IContextService) getSite().getService(IContextService.class);
* </pre>
* <ul>
* <li>This service is available globally.</li>
* </ul>
* </p>
*
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be extended by clients.
+ * @note This interface is not intended to be implemented by clients.
*/
struct IContextService : public IServiceWithSources
{
/**
* The identifier for the context that is active when a workbench is active.
*/
static const QString CONTEXT_ID_WORKBENCH_MENU; // = "org.blueberry.ui.contexts.workbenchMenu";
/**
* The identifier for the context that is active when a shell registered as
* a dialog.
*/
static const QString CONTEXT_ID_DIALOG; // = "org.blueberry.ui.contexts.dialog";
/**
* The identifier for the context that is active when a shell is registered
* as either a window or a dialog.
*/
static const QString CONTEXT_ID_DIALOG_AND_WINDOW; // = "org.blueberry.ui.contexts.dialogAndWindow";
/**
* The identifier for the context that is active when a shell is registered
* as a window.
*/
static const QString CONTEXT_ID_WINDOW; // = "org.blueberry.ui.contexts.window";
enum ShellType {
/**
* The type used for registration indicating that the shell should be
* treated as a dialog. When the given shell is active, the "In Dialogs"
* context should also be active.
*/
TYPE_DIALOG = 0,
/**
* The type used for registration indicating that the shell should not
* receive any key bindings be default. When the given shell is active, we
* should not provide any <code>EnabledSubmission</code> instances for the
* "In Dialogs" or "In Windows" contexts.
*
*/
TYPE_NONE = 1,
/**
* The type used for registration indicating that the shell should be
* treated as a window. When the given shell is active, the "In Windows"
* context should also be active.
*/
TYPE_WINDOW = 2
};
/**
* <p>
* Activates the given context within the context of this service. If this
* service was retrieved from the workbench, then this context will be
* active globally. If the service was retrieved from a nested component,
* then the context will only be active within that component.
* </p>
* <p>
* Also, it is guaranteed that the contexts submitted through a particular
* service will be cleaned up when that services is destroyed. So, for
* example, a service retrieved from a <code>IWorkbenchPartSite</code>
* would deactivate all of its contexts when the site is destroyed.
* </p>
*
* @param contextId
* The identifier for the context which should be activated; must
* not be <code>null</code>.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
* activation will automatically be cancelled if the context from
* which this service was retrieved is destroyed.
*/
virtual SmartPointer<IContextActivation> ActivateContext(const QString& contextId) = 0;
/**
* <p>
* Activates the given context within the context of this service. The
* context becomes active when <code>expression</code> evaluates to
* <code>true</code>. This is the same as calling
- * {@link #activateContext(String, Expression, boolean)} with global==<code>false</code>.
+ * {@link #ActivateContext} with <code>global==false</code>.
* </p>
* <p>
* Also, it is guaranteed that the context submitted through a particular
* service will be cleaned up when that services is destroyed. So, for
* example, a service retrieved from a <code>IWorkbenchPartSite</code>
* would deactivate all of its handlers when the site is destroyed.
* </p>
*
* @param contextId
* The identifier for the context which should be activated; must
* not be <code>null</code>.
* @param expression
* This expression must evaluate to <code>true</code> before
* this context will really become active. The expression may be
* <code>null</code> if the context should always be active.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
* activation will automatically be cancelled if the context from
* which this service was retrieved is destroyed.
*
* @see ISources
*/
virtual SmartPointer<IContextActivation> ActivateContext(const QString& contextId,
const SmartPointer<Expression>& expression) = 0;
/**
* <p>
* Activates the given context within the context of this service. The
* context becomes active when <code>expression</code> evaluates to
* <code>true</code>. If global==<code>false</code> then this service
* must also be the active service to activate the context.
* </p>
* <p>
* Also, it is guaranteed that the context submitted through a particular
* service will be cleaned up when that services is destroyed. So, for
* example, a service retrieved from a <code>IWorkbenchPartSite</code>
* would deactivate all of its handlers when the site is destroyed.
* </p>
*
* @param contextId
* The identifier for the context which should be activated; must
* not be <code>null</code>.
* @param expression
* This expression must evaluate to <code>true</code> before
* this context will really become active. The expression may be
* <code>null</code> if the context should always be active.
* @param global
* Indicates that the handler should be activated irrespectively
* of whether the corresponding workbench component (e.g.,
* window, part, etc.) is active.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
* activation will automatically be cancelled if the context from
* which this service was retrieved is destroyed.
*
* @see ISources
*/
virtual SmartPointer<IContextActivation> ActivateContext(const QString& contextId,
const SmartPointer<Expression>& expression,
bool global) = 0;
/**
* Adds a listener to this context service. The listener will be notified
* when the set of defined contexts changes. This can be used to track the
* global appearance and disappearance of contexts.
* <p>
* <b>Note:</b> listeners should be removed when no longer necessary. If
* not, they will be removed when the IServiceLocator used to acquire this
* service is disposed.
* </p>
*
* @param listener
* The listener to attach; must not be <code>null</code>.
* @see RemoveContextManagerListener(IContextManagerListener*)
*/
virtual void AddContextManagerListener(IContextManagerListener* listener) = 0;
/**
* Deactivates the given context within the context of this service. If the
* handler was context with a different service, then it must be deactivated
* from that service instead. It is only possible to retract a context
* activation with this method. That is, you must have the same
* <code>IContextActivation</code> used to activate the context.
*
* @param activation
* The token that was returned from a call to
* <code>activateContext</code>; must not be <code>null</code>.
*/
virtual void DeactivateContext(const SmartPointer<IContextActivation>& activation) = 0;
/**
* Deactivates the given contexts within the context of this service. If the
* contexts were activated with a different service, then they must be
* deactivated from that service instead. It is only possible to retract
* context activations with this method. That is, you must have the same
* <code>IContextActivation</code> instances used to activate the
* contexts.
*
* @param activations
* The tokens that were returned from a call to
* <code>activateContext</code>. This collection must only
* contain instances of <code>IContextActivation</code>. The
* collection must not be <code>null</code>.
*/
virtual void DeactivateContexts(const QList<SmartPointer<IContextActivation> >& activations) = 0;
/**
* Returns the set of active context identifiers.
*
* @return The set of active context identifiers; this value may be
* <code>null</code> if no active contexts have been set yet. If
* the set is not <code>null</code>, then it contains only
* instances of <code>String</code>.
*/
virtual QList<QString> GetActiveContextIds() const = 0;
/**
* Retrieves the context with the given identifier. If no such context
* exists, then an undefined context with the given id is created.
*
* @param contextId
* The identifier to find; must not be <code>null</code>.
* @return A context with the given identifier, either defined or undefined.
*/
virtual SmartPointer<Context> GetContext(const QString& contextId) const = 0;
/**
* Returns the collection of all of the defined contexts in the workbench.
*
* @return The collection of contexts (<code>Context</code>) that are
* defined; never <code>null</code>, but may be empty.
*/
virtual QList<SmartPointer<Context> > GetDefinedContexts() const = 0;
/**
* Returns the collection of the identifiers for all of the defined contexts
* in the workbench.
*
* @return The collection of context identifiers (<code>String</code>)
* that are defined; never <code>null</code>, but may be empty.
*/
virtual QList<QString> GetDefinedContextIds() const = 0;
/**
* Returns the shell type for the given shell.
*
* @param shell
* The shell for which the type should be determined. If this
* value is <code>null</code>, then
* <code>IContextService.TYPE_NONE</code> is returned.
* @return <code>IContextService.TYPE_WINDOW</code>,
* <code>IContextService.TYPE_DIALOG</code>, or
* <code>IContextService.TYPE_NONE</code>.
*/
virtual ShellType GetShellType(const SmartPointer<Shell>& shell) const = 0;
virtual ShellType GetShellType(QWidget* widget) const = 0;
/**
* <p>
* Reads the context information from the registry and the preferences. This
* will overwrite any of the existing information in the context service.
* This method is intended to be called during start-up. When this method
* completes, this context service will reflect the current state of the
* registry and preference store.
* </p>
*/
virtual void ReadRegistry() = 0;
/**
* <p>
* Registers a shell to automatically promote or demote some basic types of
* contexts. The "In Dialogs" and "In Windows" contexts are provided by the
* system. This a convenience method to ensure that these contexts are
* promoted when the given is shell is active.
* </p>
* <p>
* If a shell is registered as a window, then the "In Windows" context is
* enabled when that shell is active. If a shell is registered as a dialog --
* or is not registered, but has a parent shell -- then the "In Dialogs"
* context is enabled when that shell is active. If the shell is registered
* as none -- or is not registered, but has no parent shell -- then the
* neither of the contexts will be enabled (by us -- someone else can always
* enabled them).
* </p>
* <p>
* If the provided shell has already been registered, then this method will
* change the registration.
* </p>
*
* @param shell
* The shell to register for key bindings; must not be
* <code>null</code>.
* @param type
* The type of shell being registered. This value must be one of
* the constants given in this interface.
*
* @return <code>true</code> if the shell had already been registered
* (i.e., the registration has changed); <code>false</code>
* otherwise.
*/
virtual bool RegisterShell(const SmartPointer<Shell>& shell, ShellType type) = 0;
/**
* Removes a listener from this context service.
*
* @param listener
* The listener to be removed; must not be <code>null</code>.
*/
virtual void RemoveContextManagerListener(IContextManagerListener* listener) = 0;
/**
* <p>
* Unregisters a shell that was previously registered. After this method
* completes, the shell will be treated as if it had never been registered
* at all. If you have registered a shell, you should ensure that this
* method is called when the shell is disposed. Otherwise, a potential
* memory leak will exist.
* </p>
* <p>
* If the shell was never registered, or if the shell is <code>null</code>,
* then this method returns <code>false</code> and does nothing.
*
* @param shell
* The shell to be unregistered; does nothing if this value is
* <code>null</code>.
*
* @return <code>true</code> if the shell had been registered;
* <code>false</code> otherwise.
*/
virtual bool UnregisterShell(const SmartPointer<Shell>& shell) = 0;
/**
* Informs the service that a batch operation has started.
* <p>
* <b>Note:</b> You must insure that if you call
* <code>deferUpdates(true)</code> that nothing in your batched operation
* will prevent the matching call to <code>deferUpdates(false)</code>.
* </p>
*
* @param defer
* true when starting a batch operation false when ending the
* operation
*/
virtual void DeferUpdates(bool defer) = 0;
};
}
Q_DECLARE_INTERFACE(berry::IContextService, "org.blueberry.ui.IContextService")
#endif // BERRYICONTEXTSERVICE_H
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIEditorDescriptor.h b/Plugins/org.blueberry.ui.qt/src/berryIEditorDescriptor.h
index 30636db656..80f027d2b1 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIEditorDescriptor.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIEditorDescriptor.h
@@ -1,119 +1,118 @@
/*============================================================================
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 BERRYIEDITORDESCRIPTOR_H_
#define BERRYIEDITORDESCRIPTOR_H_
#include <org_blueberry_ui_qt_Export.h>
#include "berryIWorkbenchPartDescriptor.h"
#include "berryIEditorMatchingStrategy.h"
namespace berry
{
/**
* \ingroup org_blueberry_ui_qt
*
* Description of an editor in the workbench editor registry. The
* editor descriptor contains the information needed to create editor instances.
* <p>
* An editor descriptor typically represents one of three types of editors:
* <ul>
* <li>a file editor extension for a specific file extension.</li>
* <li>a file editor added by the user (via the workbench preference page)</li>
* <li>a general editor extension which works on objects other than files.</li>
* </ul>
* </p>
* <p>
* This interface is not intended to be implemented or extended by clients.
* </p>
*
* @see IEditorRegistry
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IEditorDescriptor : public IWorkbenchPartDescriptor
{
berryObjectMacro(berry::IEditorDescriptor);
~IEditorDescriptor() override;
/**
* Returns the editor id.
* <p>
* For internal editors, this is the extension id as defined in the workbench
* registry; for external editors, it is path and file name of the external
* program.
* </p>
*
* @return the id of the editor
*/
QString GetId() const override = 0;
/**
* Returns the descriptor of the image for this editor.
*
* @return the descriptor of the image to display next to this editor
*/
//ImageDescriptor getImageDescriptor() = 0;
/**
* Returns the label to show for this editor.
*
* @return the editor label
*/
QString GetLabel() const override = 0;
/**
* Returns whether this editor descriptor will open a regular editor
* part inside the editor area.
*
* @return <code>true</code> if editor is inside editor area, and
* <code>false</code> otherwise
* @since 3.0
*/
virtual bool IsInternal() const = 0;
/**
* Returns whether this editor descriptor will open an external
* editor in-place inside the editor area.
*
* @return <code>true</code> if editor is in-place, and <code>false</code>
* otherwise
* @since 3.0
*/
virtual bool IsOpenInPlace() const = 0;
/**
* Returns whether this editor descriptor will open an external editor
* in a new window outside the workbench.
*
* @return <code>true</code> if editor is external, and <code>false</code>
* otherwise
* @since 3.0
*/
virtual bool IsOpenExternal() const = 0;
/**
* Returns the editor matching strategy object for editors
* represented by this editor descriptor, or <code>null</code>
* if there is no explicit matching strategy specified.
*
* @return the editor matching strategy, or <code>null</code> if none
* @since 3.1
*/
virtual IEditorMatchingStrategy::Pointer GetEditorMatchingStrategy() = 0;
};
}
#endif /*BERRYIEDITORDESCRIPTOR_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIEditorMatchingStrategy.h b/Plugins/org.blueberry.ui.qt/src/berryIEditorMatchingStrategy.h
index 3e763cf436..01403f4075 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIEditorMatchingStrategy.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIEditorMatchingStrategy.h
@@ -1,61 +1,61 @@
/*============================================================================
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 BERRYIEDITORMATCHINGSTRATEGY_H_
#define BERRYIEDITORMATCHINGSTRATEGY_H_
#include <berryMacros.h>
#include "berryIEditorReference.h"
#include "berryIEditorInput.h"
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* An editor matching strategy allows editor extensions to provide their own
* algorithm for matching the input of an open editor of that type to a
* given editor input. This is used to find a matching editor during
- * {@link org.blueberry.ui.IWorkbenchPage#openEditor(IEditorInput, String, boolean)} and
- * {@link org.blueberry.ui.IWorkbenchPage#findEditor(IEditorInput)}.
+ * {@link IWorkbenchPage#OpenEditor} and
+ * {@link IWorkbenchPage#FindEditor}.
*/
struct BERRY_UI_QT IEditorMatchingStrategy : public Object
{
berryObjectMacro(berry::IEditorMatchingStrategy);
~IEditorMatchingStrategy() override;
/**
* Returns whether the editor represented by the given editor reference
* matches the given editor input.
* <p>
* Implementations should inspect the given editor input first,
* and try to reject it early before calling <code>IEditorReference.getEditorInput()</code>,
* since that method may be expensive.
* </p>
*
* @param editorRef the editor reference to match against
* @param input the editor input to match
* @return <code>true</code> if the editor matches the given editor input,
* <code>false</code> if it does not match
*/
virtual bool Matches(IEditorReference::Pointer editorRef, IEditorInput::Pointer input) = 0;
};
}
Q_DECLARE_INTERFACE(berry::IEditorMatchingStrategy, "org.blueberry.ui.IEditorMatchingStrategy")
#endif /*BERRYIEDITORMATCHINGSTRATEGY_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIEditorPart.h b/Plugins/org.blueberry.ui.qt/src/berryIEditorPart.h
index 1a99febfc8..5b5fa78333 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIEditorPart.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIEditorPart.h
@@ -1,127 +1,125 @@
/*============================================================================
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 BERRYIEDITORPART_H_
#define BERRYIEDITORPART_H_
#include "berryIWorkbenchPart.h"
#include "berryISaveablePart.h"
#include <QObject>
namespace berry
{
struct IEditorInput;
struct IEditorSite;
/**
* \ingroup org_blueberry_ui_qt
*
* An editor is a visual component within a workbench page. It is
* typically used to edit or browse a document or input object. The input
* is identified using an <code>IEditorInput</code>. Modifications made
* in an editor part follow an open-save-close lifecycle model (in contrast
* to a view part, where modifications are saved to the workbench
* immediately).
* <p>
* An editor is document or input-centric. Each editor has an input, and only
* one editor can exist for each editor input within a page. This policy has
* been designed to simplify part management.
* </p><p>
* An editor should be used in place of a view whenever more than one instance
* of a document type can exist.
* </p><p>
* This interface may be implemented directly. For convenience, a base
* implementation is defined in <code>EditorPart</code>.
* </p>
* <p>
* An editor part is added to the workbench in two stages:
* <ol>
* <li>An editor extension is contributed to the workbench registry. This
* extension defines the extension id, extension class, and the file
* extensions which are supported by the editor.</li>
* <li>An editor part based upon the extension is created and added to the
* workbench when the user opens a file with one of the supported file
* extensions (or some other suitable form of editor input).</li>
* </ol>
* </p>
* <p>
* All editor parts implement the <code>IAdaptable</code> interface; extensions
* are managed by the platform's adapter manager.
* </p>
*
* @see org.blueberry.ui.IWorkbenchPage#openEditor(IEditorInput, String)
* @see org.blueberry.ui.part.EditorPart
*/
struct BERRY_UI_QT IEditorPart : public virtual IWorkbenchPart,
public ISaveablePart
{
berryObjectMacro(berry::IEditorPart, IWorkbenchPart, ISaveablePart);
~IEditorPart() override;
/**
* The property id for <code>getEditorInput</code>.
*/
//static const int PROP_INPUT = IWorkbenchPartConstants.PROP_INPUT;
/**
* Returns the input for this editor. If this value changes the part must
* fire a property listener event with <code>PROP_INPUT</code>.
*
* @return the editor input
*/
virtual SmartPointer<IEditorInput> GetEditorInput() const = 0;
/**
* Returns the site for this editor.
* This method is equivalent to <code>(IEditorSite) getSite()</code>.
* <p>
* The site can be <code>null</code> while the editor is being initialized.
* After the initialization is complete, this value must be non-<code>null</code>
* for the remainder of the editor's life cycle.
* </p>
*
* @return the editor site; this value may be <code>null</code> if the editor
* has not yet been initialized
*/
virtual SmartPointer<IEditorSite> GetEditorSite() const = 0;
/**
* Initializes this editor with the given editor site and input.
* <p>
* This method is automatically called shortly after the part is instantiated.
- * It marks the start of the part's lifecycle. The
- * {@link IWorkbenchPart#dispose IWorkbenchPart.dispose} method will be called
- * automically at the end of the lifecycle. Clients must not call this method.
+ * It marks the start of the part's lifecycle. Clients must not call this method.
* </p><p>
* Implementors of this method must examine the editor input object type to
* determine if it is understood. If not, the implementor must throw
* a <code>PartInitException</code>
* </p>
* @param site the editor site
* @param input the editor input
* @exception PartInitException if this editor was not initialized successfully
*/
virtual void Init(SmartPointer<IEditorSite> site,
SmartPointer<IEditorInput> input) = 0;
};
}
Q_DECLARE_INTERFACE(berry::IEditorPart, "org.blueberry.ui.IEditorPart")
#endif /*BERRYIEDITORPART_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIEditorRegistry.h b/Plugins/org.blueberry.ui.qt/src/berryIEditorRegistry.h
index 76497a0b74..ac26a03df3 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIEditorRegistry.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIEditorRegistry.h
@@ -1,281 +1,275 @@
/*============================================================================
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 MITKIEDITORREGISTRY_H_
#define MITKIEDITORREGISTRY_H_
#include "berryIEditorDescriptor.h"
#include "berryIFileEditorMapping.h"
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* Registry of editors known to the workbench.
* <p>
* An editor can be created in one of two ways:
* <ul>
* <li>An editor can be defined by an extension to the workbench.</li>
* <li>The user manually associates an editor with a given resource extension
* type. This will override any default workbench or platform association.
* </li>
* </ul>
* </p>
* <p>
* The registry does not keep track of editors that are "implicitly" determined.
* For example a bitmap (<code>.bmp</code>) file will typically not have a
* registered editor. Instead, when no registered editor is found, the
* underlying OS is consulted.
* </p>
* <p>
* This interface is not intended to be implemented by clients.
* </p>
*
* @see org.blueberry.ui.IWorkbench#getEditorRegistry()
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IEditorRegistry {
/**
* The property identifier for the contents of this registry.
*/
static const int PROP_CONTENTS; // = 0x01;
/**
* The identifier for the system external editor descriptor. This descriptor
* is always present in the registry on all platforms.
- * This editor requires an input which implements
- * {@link org.blueberry.ui.IPathEditorInput IPathEditorInput}.
- * Use {@link #findEditor findEditor} to access the editor descriptor for
- * this identifier.
+ * Use {@link #FindEditor} to access the editor descriptor for this identifier.
*
* @since 3.0
*/
static const QString SYSTEM_EXTERNAL_EDITOR_ID; // = "org.blueberry.ui.systemExternalEditor";
/**
* The identifier for the system in-place editor descriptor. This descriptor
* is only present in the registry on platforms that support in-place editing
- * (for example Win32). This editor requires an input which implements
- * {@link org.blueberry.ui.IInPlaceEditorInput IInPlaceEditorInput}. Use
- * {@link #findEditor findEditor} to access the editor descriptor for this
- * identifier.
+ * (for example Win32). Use {@link #FindEditor} to access the editor
+ * descriptor for this identifier.
*
* @since 3.0
*/
static const QString SYSTEM_INPLACE_EDITOR_ID; // = "org.blueberry.ui.systemInPlaceEditor";
/*
* Adds a listener for changes to properties of this registry.
* Has no effect if an identical listener is already registered.
* <p>
* The properties ids are as follows:
* <ul>
* <li><code>PROP_CONTENTS</code>: Triggered when the file editor mappings in
* the editor registry change.</li>
* </ul>
* </p>
*
* @param listener a property listener
*/
// virtual void AddPropertyListener(IPropertyListener listener) = 0;
virtual ~IEditorRegistry();
/**
* Finds and returns the descriptor of the editor with the given editor id.
*
* @param editorId the editor id
* @return the editor descriptor with the given id, or <code>null</code> if not
* found
*/
virtual IEditorDescriptor::Pointer FindEditor(const QString& editorId) = 0;
/**
* Returns the default editor. The default editor always exist.
*
* @return the descriptor of the default editor
* @deprecated The system external editor is the default editor.
* Use <code>findEditor(IEditorRegistry.SYSTEM_EXTERNAL_EDITOR_ID)</code>
* instead.
*/
virtual IEditorDescriptor::Pointer GetDefaultEditor() = 0;
/**
* Returns the default editor for a given file name. This method assumes an
* unknown content type for the given file.
* <p>
* The default editor is determined by taking the file extension for the
* file and obtaining the default editor for that extension.
* </p>
*
* @param fileName
* the file name in the system
* @return the descriptor of the default editor, or <code>null</code> if
* not found
*/
virtual IEditorDescriptor::Pointer GetDefaultEditor(const QString& fileName) = 0;
/*
* Returns the default editor for a given file name and with the given content type.
* <p>
* The default editor is determined by taking the file extension for the
* file and obtaining the default editor for that extension.
* </p>
*
* @param fileName the file name in the system
* @param contentType the content type or <code>null</code> for the unknown content type
* @return the descriptor of the default editor, or <code>null</code> if not
* found
* @since 3.1
*/
//virtual IEditorDescriptor::Pointer GetDefaultEditor(const QString& fileName, IContentType contentType) = 0;
/**
* Returns the list of file editors registered to work against the file with
* the given file name. This method assumes an unknown content type for the
* given file.
* <p>
* Note: Use <code>getDefaultEditor(String)</code> if you only the need
* the default editor rather than all candidate editors.
* </p>
*
* @param fileName
* the file name in the system
* @return a list of editor descriptors
*/
virtual QList<IEditorDescriptor::Pointer> GetEditors(const QString& fileName) = 0;
/*
* Returns the list of file editors registered to work against the file with
* the given file name and with the given content type.
* <p>
* Note: Use <code>getDefaultEditor(String)</code> if you only the need
* the default editor rather than all candidate editors.
* </p>
*
* @param fileName
* the file name in the system
* @param contentType
* the content type or <code>null</code> for the unknown
* content type
* @return a list of editor descriptors
* @since 3.1
*/
//virtual QList<IEditorDescriptor::Pointer> GetEditors(const QString& fileName, IContentType contentType) = 0;
/**
* Returns a list of mappings from file type to editor. The resulting list
* is sorted in ascending order by file extension.
* <p>
* Each mapping defines an extension and the set of editors that are
* available for that type. The set of editors includes those registered
* via plug-ins and those explicitly associated with a type by the user
* in the workbench preference pages.
* </p>
*
* @return a list of mappings sorted alphabetically by extension
*/
virtual QList<IFileEditorMapping::Pointer> GetFileEditorMappings() = 0;
/*
* Returns the image descriptor associated with a given file. This image is
* usually displayed next to the given file. This method assumes an unknown
* content type for the given file.
* <p>
* The image is determined by taking the file extension of the file and
* obtaining the image for the default editor associated with that
* extension. A default image is returned if no default editor is available.
* </p>
*
* @param filename
* the file name in the system
* @return the descriptor of the image to display next to the file
*/
// virtual ImageDescriptor* GetImageDescriptor(const QString& filename) = 0;
/*
* Returns the image descriptor associated with a given file. This image is
* usually displayed next to the given file.
* <p>
* The image is determined by taking the file extension of the file and
* obtaining the image for the default editor associated with that
* extension. A default image is returned if no default editor is available.
* </p>
*
* @param filename
* the file name in the system
* @param contentType
* the content type of the file or <code>null</code> for the
* unknown content type
* @return the descriptor of the image to display next to the file
* @since 3.1
*/
// virtual ImageDescriptor* GetImageDescriptor(const std::tring& filename, IContentType contentType) = 0;
/*
* Removes the given property listener from this registry.
* Has no affect if an identical listener is not registered.
*
* @param listener a property listener
*/
// virtual void RemovePropertyListener(IPropertyListener listener) = 0;
/**
* Sets the default editor id for the files that match that
* specified file name or extension. The specified editor must be
* defined as an editor for that file name or extension.
*
* @param fileNameOrExtension the file name or extension pattern (e.g. "*.xml");
* @param editorId the editor id or <code>null</code> for no default
*/
virtual void SetDefaultEditor(const QString& fileNameOrExtension, const QString& editorId) = 0;
/**
* Returns whether there is an in-place editor that could handle a file
* with the given name.
*
* @param filename the file name
* @return <code>true</code> if an in-place editor is available, and
* <code>false</code> otherwise
* @since 3.0
*/
virtual bool IsSystemInPlaceEditorAvailable(const QString& filename) = 0;
/**
* Returns whether the system has an editor that could handle a file
* with the given name.
*
* @param filename the file name
* @return <code>true</code> if an external editor available, and
* <code>false</code> otherwise
* @since 3.0
*/
virtual bool IsSystemExternalEditorAvailable(const QString& filename) = 0;
/*
* Returns the image descriptor associated with the system editor that
* would be used to edit this file externally.
*
* @param filename the file name
* @return the descriptor of the external editor image, or <code>null</code>
* if none
* @since 3.0
*/
// virtual ImageDescriptor GetSystemExternalEditorImageDescriptor(const QString& filename) = 0;
};
}
#endif /*MITKIEDITORREGISTRY_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIEditorSite.h b/Plugins/org.blueberry.ui.qt/src/berryIEditorSite.h
index e9a8d79052..f04095c4df 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIEditorSite.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIEditorSite.h
@@ -1,129 +1,128 @@
/*============================================================================
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 BERRYIEDITORSITE_H_
#define BERRYIEDITORSITE_H_
#include "berryIWorkbenchPartSite.h"
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* The primary interface between an editor part and the workbench.
* <p>
* The workbench exposes its implemention of editor part sites via this
* interface, which is not intended to be implemented or extended by clients.
* </p>
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IEditorSite : public virtual IWorkbenchPartSite {
berryObjectMacro(berry::IEditorSite);
~IEditorSite() override;
/**
* Returns the action bar contributor for this editor.
* <p>
* An action contributor is responsable for the creation of actions.
* By design, this contributor is used for one or more editors of the same type.
* Thus, the contributor returned by this method is not owned completely
* by the editor - it is shared.
* </p>
*
* @return the editor action bar contributor, or <code>null</code> if none exists
*/
//virtual IEditorActionBarContributor getActionBarContributor();
/**
* Returns the action bars for this part site. Editors of the same type (and
* in the same window) share the same action bars. Contributions to the
* action bars are done by the <code>IEditorActionBarContributor</code>.
*
* @return the action bars
* @since 2.1
*/
//virtual IActionBars getActionBars();
/**
* <p>
* Registers a pop-up menu with the default id for extension. The default id
* is defined as the part id.
* </p>
* <p>
* By default, context menus include object contributions based on the
* editor input for the current editor. It is possible to override this
* behaviour by calling this method with <code>includeEditorInput</code>
* as <code>false</code>. This might be desirable for editors that
* present a localized view of an editor input (e.g., a node in a model
* editor).
* </p>
* <p>
* For a detailed description of context menu registration see
* {@link IWorkbenchPartSite#registerContextMenu(MenuManager, ISelectionProvider)}
* </p>
*
* @param menuManager
* the menu manager; must not be <code>null</code>.
* @param selectionProvider
* the selection provider; must not be <code>null</code>.
* @param includeEditorInput
* Whether the editor input should be included when adding object
* contributions to this context menu.
* @see IWorkbenchPartSite#registerContextMenu(MenuManager,
* ISelectionProvider)
* @since 3.1
*/
// virtual void registerContextMenu(MenuManager menuManager,
// ISelectionProvider selectionProvider, boolean includeEditorInput);
/**
* <p>
* Registers a pop-up menu with a particular id for extension. This method
* should only be called if the target part has more than one context menu
* to register.
* </p>
* <p>
* By default, context menus include object contributions based on the
* editor input for the current editor. It is possible to override this
* behaviour by calling this method with <code>includeEditorInput</code>
* as <code>false</code>. This might be desirable for editors that
* present a localized view of an editor input (e.g., a node in a model
* editor).
* </p>
* <p>
* For a detailed description of context menu registration see
* {@link IWorkbenchPartSite#registerContextMenu(MenuManager, ISelectionProvider)}
* </p>
*
* @param menuId
* the menu id; must not be <code>null</code>.
* @param menuManager
* the menu manager; must not be <code>null</code>.
* @param selectionProvider
* the selection provider; must not be <code>null</code>.
* @param includeEditorInput
* Whether the editor input should be included when adding object
* contributions to this context menu.
* @see IWorkbenchPartSite#registerContextMenu(MenuManager,
* ISelectionProvider)
* @since 3.1
*/
// virtual void registerContextMenu(String menuId, MenuManager menuManager,
// ISelectionProvider selectionProvider, boolean includeEditorInput);
};
}
#endif /*BERRYIEDITORSITE_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIElementFactory.h b/Plugins/org.blueberry.ui.qt/src/berryIElementFactory.h
index e71211cf2b..4105bba7fd 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIElementFactory.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIElementFactory.h
@@ -1,71 +1,71 @@
/*============================================================================
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 BERRYIELEMENTFACTORY_H
#define BERRYIELEMENTFACTORY_H
#include <org_blueberry_ui_qt_Export.h>
#include <berrySmartPointer.h>
namespace berry {
struct IAdaptable;
struct IMemento;
/**
* A factory for re-creating objects from a previously saved memento.
* <p>
* Clients should implement this interface and include the name of their class
* in an extension to the platform extension point named
* <code>"org.blueberry.ui.elementFactories"</code>.
* For example, the plug-in's XML markup might contain:
- * <pre>
- * &LT;extension point="org.blueberry.ui.elementFactories"&GT;
- * &LT;factory id="com.example.myplugin.MyFactory" class="MyFactory" /&GT;
- * &LT;/extension&GT;
- * </pre>
+ * \code{.unparsed}
+ * <extension point="org.blueberry.ui.elementFactories">
+ * <factory id="com.example.myplugin.MyFactory" class="MyFactory" />
+ * </extension>
+ * \endcode
* </p>
*
* @see IPersistableElement
* @see IMemento
* @see IWorkbench#GetElementFactory
*/
struct BERRY_UI_QT IElementFactory
{
virtual ~IElementFactory();
/**
* Re-creates and returns an object from the state captured within the given
* memento.
* <p>
* If the result is not null, it should be persistable; that is,
* <pre>
* result.getAdapter(org.eclipse.ui.IPersistableElement.class)
* </pre>
* should not return <code>null</code>. The caller takes ownership of the
* result and must delete it when it is not needed any more.
* </p>
*
* @param memento
* a memento containing the state for the object
* @return an object, or <code>nullptr</code> if the element could not be
* created
*/
virtual IAdaptable* CreateElement(const SmartPointer<IMemento>& memento) = 0;
};
}
Q_DECLARE_INTERFACE(berry::IElementFactory, "org.blueberry.ui.IElementFactory")
#endif // BERRYIELEMENTFACTORY_H
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIFileEditorMapping.h b/Plugins/org.blueberry.ui.qt/src/berryIFileEditorMapping.h
index f82ac8814d..610eebd843 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIFileEditorMapping.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIFileEditorMapping.h
@@ -1,107 +1,106 @@
/*============================================================================
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 BERRYIFILEEDITORMAPPING_H_
#define BERRYIFILEEDITORMAPPING_H_
#include <berryMacros.h>
#include "berryIEditorDescriptor.h"
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* An association between a file name/extension and a list of known editors for
* files of that type.
* <p>
* The name and extension can never empty or null. The name may contain
* the single wild card character (*) to indicate the editor applies to
* all files with the same extension (e.g. *.doc). The name can never
* embed the wild card character within itself (i.e. rep*)
* </p>
* <p>
* This interface is not intended to be implemented by clients.
* </p>
*
- * @see IEditorRegistry#getFileEditorMappings
- * @noimplement This interface is not intended to be implemented by clients.
+ * @see IEditorRegistry#GetFileEditorMappings
*/
struct BERRY_UI_QT IFileEditorMapping : public Object
{
berryObjectMacro(berry::IFileEditorMapping);
~IFileEditorMapping() override;
/**
* Returns the default editor registered for this type mapping.
*
* @return the descriptor of the default editor, or <code>null</code> if there
* is no default editor registered. Will also return <code>null</code> if
* the default editor exists but fails the Expressions check.
*/
virtual IEditorDescriptor::Pointer GetDefaultEditor() = 0;
/**
* Returns the list of editors registered for this type mapping.
*
* @return a possibly empty list of editors.
*/
virtual QList<IEditorDescriptor::Pointer> GetEditors() const = 0;
/**
* Returns the list of editors formerly registered for this type mapping
* which have since been deleted.
*
* @return a possibly empty list of editors
*/
virtual QList<IEditorDescriptor::Pointer> GetDeletedEditors() const = 0;
/**
* Returns the file's extension for this type mapping.
*
* @return the extension for this mapping
*/
virtual QString GetExtension() const = 0;
/**
* Returns the descriptor of the image to use for a file of this type.
* <p>
* The image is obtained from the default editor. A default file image is
* returned if no default editor is available.
* </p>
*
* @return the descriptor of the image to use for a resource of this type
*/
//virtual ImageDescriptor GetImageDescriptor() = 0;
/**
* Returns the label to use for this mapping.
* Labels have the form "<it>name</it>.<it>extension</it>".
*
* @return the label to use for this mapping
*/
virtual QString GetLabel() const = 0;
/**
* Returns the file's name for this type mapping.
*
* @return the name for this mapping
*/
virtual QString GetName() const = 0;
};
}
#endif /*BERRYIFILEEDITORMAPPING_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIFolderLayout.h b/Plugins/org.blueberry.ui.qt/src/berryIFolderLayout.h
index a121c0b551..79155c97be 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIFolderLayout.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIFolderLayout.h
@@ -1,53 +1,52 @@
/*============================================================================
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 BERRYIFOLDERLAYOUT_H_
#define BERRYIFOLDERLAYOUT_H_
#include "berryIPlaceholderFolderLayout.h"
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* An <code>IFolderLayout</code> is used to define the initial views within a folder.
* The folder itself is contained within an <code>IPageLayout</code>.
* <p>
* This interface is not intended to be implemented by clients.
* </p>
*
* @see IPageLayout#createFolder
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IFolderLayout : public IPlaceholderFolderLayout
{
berryObjectMacro(berry::IFolderLayout);
~IFolderLayout() override;
/**
* Adds a view with the given compound id to this folder.
* See the {@link IPageLayout} type documentation for more details about compound ids.
* The primary id must name a view contributed to the workbench's view extension point
* (named <code>"org.blueberry.ui.views"</code>).
*
* @param viewId the view id
*/
virtual void AddView(const QString& viewId) = 0;
};
}
#endif /*BERRYIFOLDERLAYOUT_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIMemento.h b/Plugins/org.blueberry.ui.qt/src/berryIMemento.h
index 7300bdc992..de230980bc 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIMemento.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIMemento.h
@@ -1,246 +1,244 @@
/*============================================================================
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 BERRYIMEMENTO_H_
#define BERRYIMEMENTO_H_
#include <berryMacros.h>
#include <berryObject.h>
#include <org_blueberry_ui_qt_Export.h>
#include <QString>
namespace berry
{
/**
* \ingroup org_blueberry_ui_qt
*
* Interface to a memento used for saving the important state of an object
* in a form that can be persisted in the file system.
* <p>
* Mementos were designed with the following requirements in mind:
* <ol>
* <li>Certain objects need to be saved and restored across platform sessions.
* </li>
* <li>When an object is restored, an appropriate class for an object might not
* be available. It must be possible to skip an object in this case.</li>
* <li>When an object is restored, the appropriate class for the object may be
* different from the one when the object was originally saved. If so, the
* new class should still be able to read the old form of the data.</li>
* </ol>
* </p>
* <p>
* Mementos meet these requirements by providing support for storing a
* mapping of arbitrary string keys to primitive values, and by allowing
* mementos to have other mementos as children (arranged into a tree).
* A robust external storage format based on XML is used.
* </p><p>
* The key for an attribute may be any alpha numeric value. However, the
* value of <code>TAG_ID</code> is reserved for internal use.
* </p><p>
* This interface is not intended to be implemented or extended by clients.
* </p>
*
* @see IPersistableElement
* @see IElementFactory
- * @noimplement This interface is not intended to be implemented by clients.
- *
**/
struct BERRY_UI_QT IMemento: public Object
{
berryObjectMacro(berry::IMemento);
/**
* Special reserved key used to store the memento id
* (value <code>"IMemento.internal.id"</code>).
*
- * @see #getID()
+ * @see #GetID
*/
static const QString TAG_ID; // = "IMemento.internal.id";
/**
* Creates a new child of this memento with the given type.
* <p>
* The <code>GetChild</code> and <code>GetChildren</code> methods
* are used to retrieve children of a given type.
* </p>
*
* @param type the type
* @return a new child memento
* @see #GetChild
* @see #GetChildren
*/
virtual IMemento::Pointer CreateChild(const QString& type) = 0;
/**
* Creates a new child of this memento with the given type and id.
* The id is stored in the child memento (using a special reserved
* key, <code>TAG_ID</code>) and can be retrieved using <code>GetID</code>.
* <p>
* The <code>GetChild</code> and <code>GetChildren</code> methods
* are used to retrieve children of a given type.
* </p>
*
* @param type the type
* @param id the child id
* @return a new child memento with the given type and id
* @see #GetID
*/
virtual IMemento::Pointer CreateChild(const QString& type,
const QString& id) = 0;
/**
* Returns the first child with the given type id.
*
* @param type the type id
* @return the first child with the given type
*/
virtual IMemento::Pointer GetChild(const QString& type) const = 0;
/**
* Returns all children with the given type id.
*
* @param type the type id
* @return an array of children with the given type
*/
virtual QList<IMemento::Pointer>
GetChildren(const QString& type) const = 0;
/**
* Gets the floating point value of the given key.
*
* @param key the key
* @param value the value of the given key
* @return false if the key was not found or was found
* but was not a floating point number, else true
*/
virtual bool GetFloat(const QString& key, double& value) const = 0;
/**
* Gets the integer value of the given key.
*
* @param key the key
* @param value the value of the given key
* @return false if the key was not found or was found
* but was not an integer, else true
*/
virtual bool GetInteger(const QString& key, int& value) const = 0;
/**
* Gets the string value of the given key.
*
* @param key the key
* @param value the value of the given key
* @return false if the key was not found, else true
*/
virtual bool GetString(const QString& key, QString& value) const = 0;
/**
* Gets the boolean value of the given key.
*
* @param key the key
* @param value the value of the given key
* @return false if the key was not found, else true
*/
virtual bool GetBoolean(const QString& key, bool& value) const = 0;
/**
* Returns the data of the Text node of the memento. Each memento is allowed
* only one Text node.
*
* @return the data of the Text node of the memento, or <code>null</code>
* if the memento has no Text node.
*/
virtual QString GetTextData() const = 0;
/**
* Returns an array of all the attribute keys of the memento. This will not
* be <code>null</code>. If there are no keys, an array of length zero will
* be returned.
* @return an array with all the attribute keys of the memento
*/
virtual QList<QString> GetAttributeKeys() const = 0;
/**
* Returns the type for this memento.
*
* @return the memento type
* @see #CreateChild(const QString&)
* @see #CreateChild(const QString&, const QString&)
*/
virtual QString GetType() const = 0;
/**
* Returns the id for this memento.
*
* @return the memento id, or <code>""</code> if none
* @see #CreateChild(const QString&, const QString&)
*/
virtual QString GetID() const = 0;
/**
* Sets the value of the given key to the given floating point number.
*
* @param key the key
* @param value the value
*/
virtual void PutFloat(const QString& key, double value) = 0;
/**
* Sets the value of the given key to the given integer.
*
* @param key the key
* @param value the value
*/
virtual void PutInteger(const QString& key, int value) = 0;
/**
* Copy the attributes and children from <code>memento</code>
* to the receiver.
*
* @param memento the IMemento to be copied.
*/
virtual void PutMemento(IMemento::Pointer memento) = 0;
/**
* Sets the value of the given key to the given const QString&.
*
* @param key the key
* @param value the value
*/
virtual void PutString(const QString& key, const QString& value) = 0;
/**
* Sets the value of the given key to the given boolean value.
*
* @param key the key
* @param value the value
*/
virtual void PutBoolean(const QString& key, bool value) = 0;
/**
* Sets the memento's Text node to contain the given data. Creates the Text node if
* none exists. If a Text node does exist, it's current contents are replaced.
* Each memento is allowed only one text node.
*
* @param data the data to be placed on the Text node
*/
virtual void PutTextData(const QString& data) = 0;
~IMemento() override;
};
} // namespace berry
#endif /*BERRYIMEMENTO_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIPageLayout.h b/Plugins/org.blueberry.ui.qt/src/berryIPageLayout.h
index 8f9fdb1fc6..ed838d403f 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIPageLayout.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIPageLayout.h
@@ -1,498 +1,488 @@
/*============================================================================
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 BERRYIPAGELAYOUT_H_
#define BERRYIPAGELAYOUT_H_
#include "berryIFolderLayout.h"
#include "berryIPlaceholderFolderLayout.h"
#include "berryIViewLayout.h"
#include "berryIPerspectiveDescriptor.h"
#include <string>
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* A page layout defines the initial layout for a perspective within a page
* in a workbench window.
* <p>
* This interface is not intended to be implemented by clients.
* </p>
* <p>
* When a perspective is opened, it creates a new page layout with a single editor area.
* This layout is then passed to the perspective factory (implementation of
- * {@link org.blueberry.ui.IPerspectiveFactory#createInitialLayout(IPageLayout)}) where
+ * {@link IPerspectiveFactory#CreateInitialLayout}) where
* additional views and other content can be added, using the existing editor area as
* the initial point of reference.
* </p>
* <p>
* In some cases, multiple instances of a particular view may need to be added
* to the same layout. These are disambiguated using a secondary id.
* In layout methods taking a view id, the id can have the compound form:
* <strong>primaryId [':' secondaryId]</strong>.
* If a secondary id is given, the view must allow multiple instances by
* having specified <code>allowMultiple="true"</code> in its extension.
* View placeholders may also have a secondary id.
* </p>
* <p>
* Wildcards are permitted in placeholder ids (but not regular view ids).
* '*' matches any substring, '?' matches any single character.
* Wildcards can be specified for the primary id, the secondary id, or both.
* For example, the placeholder "someView:*" will match any occurrence of the view
* that has primary id "someView" and that also has some non-null secondary id.
* Note that this placeholder will not match the view if it has no secondary id,
* since the compound id in this case is simply "someView".
* </p>
* <p>
* Example of populating a layout with standard workbench views:
* <pre>
* IPageLayout layout = ...
* // Get the editor area.
* String editorArea = layout.getEditorArea();
*
* // Top left: Resource Navigator view and Bookmarks view placeholder
* IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, 0.25f,
* editorArea);
* topLeft.addView(IPageLayout.ID_RES_NAV);
* topLeft.addPlaceholder(IPageLayout.ID_BOOKMARKS);
*
* // Bottom left: Outline view and Property Sheet view
* IFolderLayout bottomLeft = layout.createFolder("bottomLeft", IPageLayout.BOTTOM, 0.50f,
* "topLeft");
* bottomLeft.addView(IPageLayout.ID_OUTLINE);
* bottomLeft.addView(IPageLayout.ID_PROP_SHEET);
*
* // Bottom right: Task List view
* layout.addView(IPageLayout.ID_TASK_LIST, IPageLayout.BOTTOM, 0.66f, editorArea);
* </pre>
* </p>
- * @noimplement This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IPageLayout : public Object
{
berryObjectMacro(berry::IPageLayout);
/**
* The part id for the workbench's editor area. This may only be used
* as a reference part for view addition.
*/
static const QString ID_EDITOR_AREA; // = "org.blueberry.ui.editors";
/**
* The view id for the workbench's Resource Navigator standard component.
*/
static const QString ID_RES_NAV; // = "org.blueberry.ui.views.ResourceNavigator";
/**
* The view id for the workbench's Property Sheet standard component.
*/
static const QString ID_PROP_SHEET; // = "org.blueberry.ui.views.PropertySheet";
/**
* The view id for the workbench's Content Outline standard component.
*/
static const QString ID_OUTLINE; // = "org.blueberry.ui.views.ContentOutline";
/**
* The view id for the workbench's Bookmark Navigator standard component.
*/
static const QString ID_BOOKMARKS; // = "org.blueberry.ui.views.BookmarkView";
/**
* The view id for the workbench's Problems View standard component.
* @since 3.0
*/
static const QString ID_PROBLEM_VIEW; // = "org.blueberry.ui.views.ProblemView";
/**
* The view id for the workbench's Progress View standard component.
* @since 3.2
*/
static const QString ID_PROGRESS_VIEW; // = "org.blueberry.ui.views.ProgressView";
/**
* The view id for the workbench's Task List standard component.
*/
static const QString ID_TASK_LIST; // = "org.blueberry.ui.views.TaskList";
/**
* Id of the navigate action set.
* (value <code>"org.blueberry.ui.NavigateActionSet"</code>)
* @since 2.1
*/
static const QString ID_NAVIGATE_ACTION_SET; // = "org.blueberry.ui.NavigateActionSet";
/**
* Relationship constant indicating a part should be placed to the left of
* its relative.
*/
static const int LEFT; // = 1;
/**
* Relationship constant indicating a part should be placed to the right of
* its relative.
*/
static const int RIGHT; // = 2;
/**
* Relationship constant indicating a part should be placed above its
* relative.
*/
static const int TOP; // = 3;
/**
* Relationship constant indicating a part should be placed below its
* relative.
*/
static const int BOTTOM; // = 4;
/**
* Minimum acceptable ratio value when adding a view
* @since 2.0
*/
static const float RATIO_MIN; // = 0.05f;
/**
* Maximum acceptable ratio value when adding a view
* @since 2.0
*/
static const float RATIO_MAX; // = 0.95f;
/**
* The default view ratio width for regular (non-fast) views.
* @since 2.0
*/
static const float DEFAULT_VIEW_RATIO; // = 0.5f;
/**
* A variable used to represent invalid ratios.
* @since 2.0
*/
static const float INVALID_RATIO; // = -1f;
/**
* A variable used to represent a ratio which has not been specified.
* @since 2.0
*/
static const float nullptr_RATIO; // = -2f;
- /**
- * Adds an action set with the given id to this page layout.
- * The id must name an action set contributed to the workbench's extension
- * point (named <code>"org.blueberry.ui.actionSet"</code>).
- *
- * @param actionSetId the action set id
- */
- //virtual void AddActionSet(const QString& actionSetId) = 0;
-
-
/**
* Adds a perspective shortcut to the page layout.
* These are typically shown in the UI to allow rapid navigation to appropriate new wizards.
* For example, in the Eclipse IDE, these appear as items under the Window > Open Perspective menu.
* The id must name a perspective extension contributed to the
* workbench's perspectives extension point (named <code>"org.blueberry.ui.perspectives"</code>).
*
* @param id the perspective id
*/
virtual void AddPerspectiveShortcut(const QString& id) = 0;
/**
* Adds a view placeholder to this page layout.
* A view placeholder is used to define the position of a view before the view
* appears. Initially, it is invisible; however, if the user ever opens a view
* whose compound id matches the placeholder, the view will appear at the same
* location as the placeholder.
* See the {@link IPageLayout} type documentation for more details about compound ids.
* If the placeholder contains wildcards, it remains in the layout, otherwise
* it is replaced by the view.
* If the primary id of the placeholder has no wildcards, it must refer to a view
* contributed to the workbench's view extension point
* (named <code>"org.blueberry.ui.views"</code>).
*
* @param viewId the compound view id (wildcards allowed)
* @param relationship the position relative to the reference part;
* one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
* or <code>RIGHT</code>
* @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
* in the range <code>0.05f</code> to <code>0.95f</code>.
* Values outside this range will be clipped to facilitate direct manipulation.
* For a vertical split, the part on top gets the specified ratio of the current space
* and the part on bottom gets the rest.
* Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
* and the part at right gets the rest.
* @param refId the id of the reference part; either a view id, a folder id,
* or the special editor area id returned by <code>getEditorArea</code>
*/
virtual void AddPlaceholder(const QString& viewId, int relationship, float ratio,
const QString& refId) = 0;
/**
* Adds an item to the Show In prompter.
* The id must name a view contributed to the workbench's view extension point
* (named <code>"org.blueberry.ui.views"</code>).
*
* @param id the view id
*
* @since 2.1
*/
virtual void AddShowInPart(const QString& id) = 0;
/**
* Adds a show view shortcut to the page layout.
* These are typically shown in the UI to allow rapid navigation to appropriate views.
* For example, in the Eclipse IDE, these appear as items under the Window > Show View menu.
* The id must name a view contributed to the workbench's views extension point
* (named <code>"org.blueberry.ui.views"</code>).
*
* @param id the view id
*/
virtual void AddShowViewShortcut(const QString& id) = 0;
/**
* Adds a view with the given compound id to this page layout.
* See the {@link IPageLayout} type documentation for more details about compound ids.
* The primary id must name a view contributed to the workbench's view extension point
* (named <code>"org.blueberry.ui.views"</code>).
*
* @param viewId the compound view id
* @param relationship the position relative to the reference part;
* one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
* or <code>RIGHT</code>
* @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
* in the range <code>0.05f</code> to <code>0.95f</code>.
* Values outside this range will be clipped to facilitate direct manipulation.
* For a vertical split, the part on top gets the specified ratio of the current space
* and the part on bottom gets the rest.
* Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
* and the part at right gets the rest.
* @param refId the id of the reference part; either a view id, a folder id,
* or the special editor area id returned by <code>getEditorArea</code>
*/
virtual void AddView(const QString& viewId, int relationship, float ratio,
const QString& refId) = 0;
/**
* Creates and adds a new folder with the given id to this page layout.
* The position and relative size of the folder is expressed relative to
* a reference part.
*
* @param folderId the id for the new folder. This must be unique within
* the layout to avoid collision with other parts.
* @param relationship the position relative to the reference part;
* one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
* or <code>RIGHT</code>
* @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
* in the range <code>0.05f</code> to <code>0.95f</code>.
* Values outside this range will be clipped to facilitate direct manipulation.
* For a vertical split, the part on top gets the specified ratio of the current space
* and the part on bottom gets the rest.
* Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
* and the part at right gets the rest.
* @param refId the id of the reference part; either a view id, a folder id,
* or the special editor area id returned by <code>getEditorArea</code>
* @return the new folder
*/
virtual IFolderLayout::Pointer CreateFolder(const QString& folderId, int relationship,
float ratio, const QString& refId) = 0;
/**
* Creates and adds a placeholder for a new folder with the given id to this page layout.
* The position and relative size of the folder is expressed relative to
* a reference part.
*
* @param folderId the id for the new folder. This must be unique within
* the layout to avoid collision with other parts.
* @param relationship the position relative to the reference part;
* one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
* or <code>RIGHT</code>
* @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
* in the range <code>0.05f</code> to <code>0.95f</code>.
* Values outside this range will be clipped to facilitate direct manipulation.
* For a vertical split, the part on top gets the specified ratio of the current space
* and the part on bottom gets the rest.
* Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
* and the part at right gets the rest.
* @param refId the id of the reference part; either a view id, a folder id,
* or the special editor area id returned by <code>getEditorArea</code>
* @return a placeholder for the new folder
* @since 2.0
*/
virtual IPlaceholderFolderLayout::Pointer CreatePlaceholderFolder(const QString& folderId,
int relationship, float ratio, const QString& refId) = 0;
/**
* Returns the special identifier for the editor area in this page
* layout. The identifier for the editor area is also stored in
* <code>ID_EDITOR_AREA</code>.
* <p>
* The editor area is automatically added to each layout before anything else.
* It should be used as the point of reference when adding views to a layout.
* </p>
*
* @return the special id of the editor area
*/
virtual QString GetEditorArea() = 0;
/**
* Returns whether the page's layout will show
* the editor area.
*
* @return <code>true</code> when editor area visible, <code>false</code> otherwise
*/
virtual bool IsEditorAreaVisible() = 0;
/**
* Show or hide the editor area for the page's layout.
*
* @param showEditorArea <code>true</code> to show the editor area, <code>false</code> to hide the editor area
*/
virtual void SetEditorAreaVisible(bool showEditorArea) = 0;
/**
* Sets whether this layout is fixed.
* In a fixed layout, layout parts cannot be moved or zoomed, and the initial
* set of views cannot be closed.
*
* @param isFixed <code>true</code> if this layout is fixed, <code>false</code> if not
* @since 3.0
*/
virtual void SetFixed(bool isFixed) = 0;
/**
* Returns <code>true</code> if this layout is fixed, <code>false</code> if not.
* In a fixed layout, layout parts cannot be moved or zoomed, and the initial
* set of views cannot be closed.
* The default is <code>false</code>.
*
* @return <code>true</code> if this layout is fixed, <code>false</code> if not.
* @since 3.0
*/
virtual bool IsFixed() = 0;
/**
* Returns the layout for the view or placeholder with the given compound id in
* this page layout.
* See the {@link IPageLayout} type documentation for more details about compound ids.
* Returns <code>null</code> if the specified view or placeholder is unknown to the layout.
*
* @param id the compound view id or placeholder
* @return the view layout, or <code>null</code>
* @since 3.0
*/
virtual IViewLayout::Pointer GetViewLayout(const QString& id) = 0;
/**
* Adds a standalone view with the given compound id to this page layout.
* See the {@link IPageLayout} type documentation for more details about compound ids.
* A standalone view cannot be docked together with other views.
* A standalone view's title can optionally be hidden. If hidden,
* then any controls typically shown with the title (such as the close button)
* are also hidden. Any contributions or other content from the view itself
* are always shown (e.g. toolbar or view menu contributions, content description).
* <p>
* The id must name a view contributed to the workbench's view extension point
* (named <code>"org.blueberry.ui.views"</code>).
* </p>
*
* @param viewId the compound view id
* @param showTitle <code>true</code> to show the title and related controls,
* <code>false</code> to hide them
* @param relationship the position relative to the reference part;
* one of <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
* or <code>RIGHT</code>
* @param ratio a ratio specifying how to divide the space currently occupied by the reference part,
* in the range <code>0.05f</code> to <code>0.95f</code>.
* Values outside this range will be clipped to facilitate direct manipulation.
* For a vertical split, the part on top gets the specified ratio of the current space
* and the part on bottom gets the rest.
* Likewise, for a horizontal split, the part at left gets the specified ratio of the current space
* and the part at right gets the rest.
* @param refId the id of the reference part; either a view id, a folder id,
* or the special editor area id returned by <code>getEditorArea</code>
*
* @since 3.0
*/
virtual void AddStandaloneView(const QString& viewId, bool showTitle,
int relationship, float ratio, const QString& refId) = 0;
/**
* Adds a standalone view placeholder to this page layout. A view
* placeholder is used to define the position of a view before the view
* appears. Initially, it is invisible; however, if the user ever opens a
* view whose compound id matches the placeholder, the view will appear at
* the same location as the placeholder. See the {@link IPageLayout} type
* documentation for more details about compound ids. If the placeholder
* contains wildcards, it remains in the layout, otherwise it is replaced by
* the view. If the primary id of the placeholder has no wildcards, it must
* refer to a view contributed to the workbench's view extension point
* (named <code>"org.blueberry.ui.views"</code>).
*
* @param viewId
* the compound view id (wildcards allowed)
* @param relationship
* the position relative to the reference part; one of
* <code>TOP</code>, <code>BOTTOM</code>, <code>LEFT</code>,
* or <code>RIGHT</code>
* @param ratio
* a ratio specifying how to divide the space currently occupied
* by the reference part, in the range <code>0.05f</code> to
* <code>0.95f</code>. Values outside this range will be
* clipped to facilitate direct manipulation. For a vertical
* split, the part on top gets the specified ratio of the current
* space and the part on bottom gets the rest. Likewise, for a
* horizontal split, the part at left gets the specified ratio of
* the current space and the part at right gets the rest.
* @param refId
* the id of the reference part; either a view id, a folder id,
* or the special editor area id returned by
* <code>getEditorArea</code>
* @param showTitle
* true to show the view's title, false if not
*
* @since 3.2
*/
virtual void AddStandaloneViewPlaceholder(const QString& viewId, int relationship,
float ratio, const QString& refId, bool showTitle) = 0;
/**
* Returns the perspective descriptor for the perspective being layed out.
*
* @return the perspective descriptor for the perspective being layed out
* @since 3.2
*/
virtual IPerspectiveDescriptor::Pointer GetDescriptor() = 0;
/**
* Returns the folder layout for the view or placeholder with the given
* compound id in this page layout. See the {@link IPageLayout} type
* documentation for more details about compound ids. Returns
* <code>null</code> if the specified view or placeholder is unknown to
* the layout, or the placeholder was not in a folder.
*
* @param id
* the compound view id or placeholder. Must not be
* <code>null</code>.
* @return the folder layout, or <code>null</code>
* @since 3.3
*/
virtual IPlaceholderFolderLayout::Pointer GetFolderForView(const QString& id) = 0;
};
}
#endif /*BERRYIPAGELAYOUT_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIPageService.h b/Plugins/org.blueberry.ui.qt/src/berryIPageService.h
index 468eff4f63..1eb90fcd5b 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIPageService.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIPageService.h
@@ -1,106 +1,84 @@
/*============================================================================
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 BERRYIPAGESERVICE_H_
#define BERRYIPAGESERVICE_H_
#include <org_blueberry_ui_qt_Export.h>
#include "berryIPerspectiveListener.h"
namespace berry {
struct IWorkbenchPage;
/**
* A page service tracks the page and perspective lifecycle events
* within a workbench window.
* <p>
* This service can be acquired from your service locator:
* <pre>
* IPageService service = (IPageService) getSite().getService(IPageService.class);
* </pre>
* <ul>
* <li>This service is not available globally, only from the workbench window level down.</li>
* </ul>
* </p>
*
* @see IWorkbenchWindow
* @see IPageListener
* @see IPerspectiveListener
- * @see org.blueberry.ui.services.IServiceLocator#getService(Class)
- * @noimplement This interface is not intended to be implemented by clients.
+ * @see IServiceLocator#GetService
+ * @note This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IPageService {
virtual ~IPageService();
- /**
- * Adds the given listener for page lifecycle events.
- * Has no effect if an identical listener is already registered.
- * <p>
- * <b>Note:</b> listeners should be removed when no longer necessary. If
- * not, they will be removed when the IServiceLocator used to acquire this
- * service is disposed.
- * </p>
- *
- * @param listener a page listener
- * @see #removePageListener(IPageListener)
- */
- //virtual void AddPageListener(IPageListener listener);
-
/**
* Adds the given listener for a page's perspective lifecycle events.
* Has no effect if an identical listener is already registered.
* <p>
* <b>Note:</b> listeners should be removed when no longer necessary. If
* not, they will be removed when the IServiceLocator used to acquire this
* service is disposed.
* </p>
*
* @param listener a perspective listener
- * @see #removePerspectiveListener(IPerspectiveListener)
+ * @see #RemovePerspectiveListener
*/
virtual void AddPerspectiveListener(IPerspectiveListener* listener) = 0;
/**
* Returns the active page.
*
* @return the active page, or <code>null</code> if no page is currently active
*/
virtual SmartPointer<IWorkbenchPage> GetActivePage() const = 0;
- /**
- * Removes the given page listener.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a page listener
- */
- //virtual void RemovePageListener(IPageListener listener);
-
/**
* Removes the given page's perspective listener.
* Has no affect if an identical listener is not registered.
*
* @param listener a perspective listener
*/
virtual void RemovePerspectiveListener(IPerspectiveListener* listener) = 0;
virtual IPerspectiveListener::Events& GetPerspectiveEvents() = 0;
};
}
Q_DECLARE_INTERFACE(berry::IPageService, "org.blueberry.ui.IPageService")
#endif /* BERRYIPAGESERVICE_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIPartListener.h b/Plugins/org.blueberry.ui.qt/src/berryIPartListener.h
index 1ac1f865f6..463e382829 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIPartListener.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIPartListener.h
@@ -1,160 +1,144 @@
/*============================================================================
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 BERRYIPARTLISTENER_H_
#define BERRYIPARTLISTENER_H_
#include <berryMacros.h>
#include <berryMessage.h>
#include <org_blueberry_ui_qt_Export.h>
#include "berryIWorkbenchPartReference.h"
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* Interface for listening to part lifecycle events.
* <p>
* This interface may be implemented by clients.
* </p>
*
* @see IPartService#AddPartListener(IPartListener)
*/
struct BERRY_UI_QT IPartListener
{
struct Events {
enum Type {
NONE = 0x00000000,
ACTIVATED = 0x00000001,
BROUGHT_TO_TOP = 0x00000002,
CLOSED = 0x00000004,
DEACTIVATED = 0x00000008,
OPENED = 0x00000010,
HIDDEN = 0x00000020,
VISIBLE = 0x00000040,
INPUT_CHANGED = 0x00000080,
ALL = 0xffffffff
};
Q_DECLARE_FLAGS(Types, Type)
typedef Message1<const IWorkbenchPartReference::Pointer&> PartEvent;
PartEvent partActivated;
PartEvent partBroughtToTop;
PartEvent partClosed;
PartEvent partDeactivated;
PartEvent partOpened;
PartEvent partHidden;
PartEvent partVisible;
PartEvent partInputChanged;
void AddListener(IPartListener* listener);
void RemoveListener(IPartListener* listener);
private:
typedef MessageDelegate1<IPartListener, const IWorkbenchPartReference::Pointer&> Delegate;
};
virtual ~IPartListener();
virtual Events::Types GetPartEventTypes() const = 0;
/**
* Notifies this listener that the given part has been activated.
- *
- * @param partRef the part that was activated
* @see IWorkbenchPage#activate
*/
virtual void PartActivated(const IWorkbenchPartReference::Pointer& /*partRef*/) {}
/**
* Notifies this listener that the given part has been brought to the top.
* <p>
* These events occur when an editor is brought to the top in the editor area,
* or when a view is brought to the top in a page book with multiple views.
* They are normally only sent when a part is brought to the top
* programmatically (via <code>IPerspective.bringToTop</code>). When a part is
* activated by the user clicking on it, only <code>partActivated</code> is sent.
* </p>
- *
- * @param partRef the part that was surfaced
* @see IWorkbenchPage#bringToTop
*/
virtual void PartBroughtToTop(const IWorkbenchPartReference::Pointer& /*partRef*/) {}
/**
* Notifies this listener that the given part has been closed.
* <p>
* Note that if other perspectives in the same page share the view,
* this notification is not sent. It is only sent when the view
* is being removed from the page entirely (it is being disposed).
* </p>
- *
- * @param partRef the part that was closed
* @see IWorkbenchPage#hideView
*/
virtual void PartClosed(const IWorkbenchPartReference::Pointer& /*partRef*/) {}
/**
* Notifies this listener that the given part has been deactivated.
- *
- * @param partRef the part that was deactivated
* @see IWorkbenchPage#activate
*/
virtual void PartDeactivated(const IWorkbenchPartReference::Pointer& /*partRef*/) {}
/**
* Notifies this listener that the given part has been opened.
* <p>
* Note that if other perspectives in the same page share the view,
* this notification is not sent. It is only sent when the view
* is being newly opened in the page (it is being created).
* </p>
- *
- * @param partRef the part that was opened
* @see IWorkbenchPage#showView
*/
virtual void PartOpened(const IWorkbenchPartReference::Pointer& /*partRef*/) {}
/**
* Notifies this listener that the given part is hidden or obscured by another part.
- *
- * @param partRef the part that is hidden or obscured by another part
*/
virtual void PartHidden(const IWorkbenchPartReference::Pointer& /*partRef*/) {}
/**
* Notifies this listener that the given part is visible.
- *
- * @param partRef the part that is visible
*/
virtual void PartVisible(const IWorkbenchPartReference::Pointer& /*partRef*/) {}
/**
* Notifies this listener that the given part's input was changed.
- *
- * @param partRef the part whose input was changed
*/
virtual void PartInputChanged(const IWorkbenchPartReference::Pointer& /*partRef*/) {}
};
} // namespace berry
Q_DECLARE_OPERATORS_FOR_FLAGS(berry::IPartListener::Events::Types)
#endif /*BERRYIPARTLISTENER_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIPartService.h b/Plugins/org.blueberry.ui.qt/src/berryIPartService.h
index c44d38e508..73f1fd4c1e 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIPartService.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIPartService.h
@@ -1,82 +1,82 @@
/*============================================================================
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 BERRYIPARTSERVICE_H_
#define BERRYIPARTSERVICE_H_
#include <org_blueberry_ui_qt_Export.h>
#include "berryIWorkbenchPart.h"
#include "berryIWorkbenchPartReference.h"
#include "berryIPartListener.h"
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* A part service tracks the creation and activation of parts within a
* workbench page.
* <p>
* This interface is not intended to be implemented by clients.
* </p>
*
* @see IWorkbenchPage
*/
struct BERRY_UI_QT IPartService {
virtual ~IPartService();
/**
* Adds the given observer for part lifecycle events.
* Has no effect if an identical listener is already registered.
* <p>
* <b>Note:</b> listeners should be removed when no longer necessary. If
* not, they will be removed when the IServiceLocator used to acquire this
* service is disposed.
* </p>
*
* @param listener a part listener
- * @see #removePartListener(IPartListener)
+ * @see #RemovePartListener
*/
virtual void AddPartListener(IPartListener* listener) = 0;
/**
* Returns the active part.
*
* @return the active part, or <code>null</code> if no part is currently active
*/
virtual IWorkbenchPart::Pointer GetActivePart() = 0;
/**
* Returns the active part reference.
*
* @return the active part reference, or <code>null</code> if no part
* is currently active
*/
virtual IWorkbenchPartReference::Pointer GetActivePartReference() = 0;
/**
* Removes the given part listener.
* Has no affect if an identical listener is not registered.
*
* @param listener a part listener
*/
virtual void RemovePartListener(IPartListener* listener) = 0;
};
} // namespace berry
Q_DECLARE_INTERFACE(berry::IPartService, "org.blueberry.ui.IPartService")
#endif /*BERRYIPARTSERVICE_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIPerspectiveDescriptor.h b/Plugins/org.blueberry.ui.qt/src/berryIPerspectiveDescriptor.h
index ff42689e9b..1f973b381a 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIPerspectiveDescriptor.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIPerspectiveDescriptor.h
@@ -1,126 +1,125 @@
/*============================================================================
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 BERRYIPERSPECTIVEDESCRIPTOR_H_
#define BERRYIPERSPECTIVEDESCRIPTOR_H_
#include <berryMacros.h>
#include <berryObject.h>
#include <org_blueberry_ui_qt_Export.h>
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* A perspective descriptor describes a perspective in an
* <code>IPerspectiveRegistry</code>.
* <p>
* A perspective is a template for view visibility, layout, and action visibility
* within a workbench page. There are two types of perspective: a predefined
* perspective and a custom perspective.
* <ul>
* <li>A predefined perspective is defined by an extension to the workbench's
* perspective extension point (<code>"org.blueberry.ui.perspectives"</code>).
* The extension defines a id, label, and <code>IPerspectiveFactory</code>.
* A perspective factory is used to define the initial layout for a page.
* </li>
* <li>A custom perspective is defined by the user. In this case a predefined
* perspective is modified to suit a particular task and saved as a new
* perspective. The attributes for the perspective are stored in a separate file
* in the workbench's metadata directory.
* </li>
* </ul>
* </p>
* <p>
* Within a page the user can open any of the perspectives known
* to the workbench's perspective registry, typically by selecting one from the
* workbench's <code>Open Perspective</code> menu. When selected, the views
* and actions within the active page rearrange to reflect the perspective.
* </p>
* <p>
* This interface is not intended to be implemented by clients.
* </p>
* @see IPerspectiveRegistry
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IPerspectiveDescriptor : public virtual Object
{
berryObjectMacro(berry::IPerspectiveDescriptor);
~IPerspectiveDescriptor() override;
/**
* Returns the description of this perspective.
* This is the value of its <code>"description"</code> attribute.
*
* @return the description
* @since 3.0
*/
virtual QString GetDescription() const = 0;
/**
* Returns this perspective's id. For perspectives declared via an extension,
* this is the value of its <code>"id"</code> attribute.
*
* @return the perspective id
*/
virtual QString GetId() const = 0;
/**
* Returns the descriptor of the image to show for this perspective.
* If the extension for this perspective specifies an image, the descriptor
* for it is returned. Otherwise a default image is returned.
*
* @return the descriptor of the image to show for this perspective
*/
virtual QIcon GetImageDescriptor() const = 0;
/**
* Returns this perspective's label. For perspectives declared via an extension,
* this is the value of its <code>"label"</code> attribute.
*
* @return the label
*/
virtual QString GetLabel() const = 0;
/**
* Returns <code>true</code> if this perspective is predefined by an
* extension.
*
* @return boolean whether this perspective is predefined by an extension
*/
//virtual bool IsPredefined() const = 0;
/**
* Return the category path of this descriptor
*
* @return the category path of this descriptor
*/
virtual QStringList GetCategoryPath() const = 0;
/**
* Returns a list of ids belonging to keyword reference extensions.
*
* The keywords listed in each referenced id can be used to filter
* this perspective.
*
* @return A list of ids for keyword reference extensions.
*/
virtual QStringList GetKeywordReferences() const = 0;
};
}
#endif /*BERRYIPERSPECTIVEDESCRIPTOR_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIPerspectiveRegistry.h b/Plugins/org.blueberry.ui.qt/src/berryIPerspectiveRegistry.h
index 6af8b038f7..35e15584e1 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIPerspectiveRegistry.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIPerspectiveRegistry.h
@@ -1,134 +1,120 @@
/*============================================================================
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 BERRYIPERSPECTIVEREGISTRY_H_
#define BERRYIPERSPECTIVEREGISTRY_H_
#include "berryIPerspectiveDescriptor.h"
#include <vector>
namespace berry {
/**
* \ingroup org_blueberry_ui
*
* The workbench's global registry of perspectives.
* <p>
* This registry contains a descriptor for each perspectives in the workbench.
* It is initially populated with stock perspectives from the workbench's
* perspective extension point (<code>"org.blueberry.ui.perspectives"</code>) and
* with custom perspectives defined by the user.
* </p><p>
* This interface is not intended to be implemented by clients.
* </p>
* @see IWorkbench#getPerspectiveRegistry
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IPerspectiveRegistry {
virtual ~IPerspectiveRegistry();
- /**
- * Create a new perspective.
- *
- * @param label
- * the name of the new descriptor
- * @param originalDescriptor
- * the descriptor on which to base the new descriptor
- * @return a new perspective descriptor or <code>null</code> if the
- * creation failed.
- */
- //virtual IPerspectiveDescriptor::Pointer CreatePerspective(const QString& label,
- // IPerspectiveDescriptor::Pointer originalDescriptor) = 0;
-
/**
* Clones an existing perspective.
*
* @param id the id for the cloned perspective, which must not already be used by
* any registered perspective
* @param label the label assigned to the cloned perspective
* @param desc the perspective to clone
* @return the cloned perspective descriptor
* @throws IllegalArgumentException if there is already a perspective with the given id
*/
virtual IPerspectiveDescriptor::Pointer ClonePerspective(const QString& id, const QString& label,
IPerspectiveDescriptor::Pointer desc) = 0;
/**
* Deletes a perspective. Has no effect if the perspective is defined in an
* extension.
*
* @param persp the perspective to delete
*/
virtual void DeletePerspective(IPerspectiveDescriptor::Pointer persp) = 0;
/**
* Finds and returns the registered perspective with the given perspective id.
*
* @param perspectiveId the perspective id
* @return the perspective, or <code>null</code> if none
* @see IPerspectiveDescriptor#getId
*/
virtual IPerspectiveDescriptor::Pointer FindPerspectiveWithId(const QString& perspectiveId) = 0;
/**
* Finds and returns the registered perspective with the given label.
*
* @param label the label
* @return the perspective, or <code>null</code> if none
* @see IPerspectiveDescriptor#getLabel
*/
virtual IPerspectiveDescriptor::Pointer FindPerspectiveWithLabel(const QString& label) = 0;
/**
* Returns the id of the default perspective for the workbench. This identifies one
* perspective extension within the workbench's perspective registry.
* <p>
* Returns <code>null</code> if there is no default perspective.
* </p>
*
* @return the default perspective id, or <code>null</code>
*/
virtual QString GetDefaultPerspective() = 0;
/**
* Returns a list of the perspectives known to the workbench.
*
* @return a list of perspectives
*/
virtual QList<IPerspectiveDescriptor::Pointer> GetPerspectives() = 0;
/**
* Sets the default perspective for the workbench to the given perspective id.
* If non-<code>null</code>, the id must correspond to a perspective extension
* within the workbench's perspective registry.
* <p>
* A <code>null</code> id indicates no default perspective.
* </p>
*
* @param id a perspective id, or <code>null</code>
*/
virtual void SetDefaultPerspective(const QString& id) = 0;
/**
* Reverts a perspective back to its original definition
* as specified in the plug-in manifest.
*
* @param perspToRevert the perspective to revert
*/
virtual void RevertPerspective(IPerspectiveDescriptor::Pointer perspToRevert) = 0;
};
}
#endif /*BERRYIPERSPECTIVEREGISTRY_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIPlaceholderFolderLayout.h b/Plugins/org.blueberry.ui.qt/src/berryIPlaceholderFolderLayout.h
index f931136110..1ad1dd9c07 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIPlaceholderFolderLayout.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIPlaceholderFolderLayout.h
@@ -1,97 +1,96 @@
/*============================================================================
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 BERRYIPLACEHOLDERFOLDERLAYOUT_H_
#define BERRYIPLACEHOLDERFOLDERLAYOUT_H_
#include <berryMacros.h>
#include <berryObject.h>
#include <org_blueberry_ui_qt_Export.h>
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* An <code>IPlaceholderFolderLayout</code> is used to define the initial
* view placeholders within a folder.
* The folder itself is contained within an <code>IPageLayout</code>.
* <p>
* This interface is not intended to be implemented by clients.
* </p>
*
- * @see IPageLayout#createPlaceholderFolder
- * @noimplement This interface is not intended to be implemented by clients.
+ * @see IPageLayout#CreatePlaceholderFolder
*/
struct BERRY_UI_QT IPlaceholderFolderLayout : public Object
{
berryObjectMacro(berry::IPlaceholderFolderLayout);
~IPlaceholderFolderLayout() override;
/**
* Adds a view placeholder to this folder.
* A view placeholder is used to define the position of a view before the view
* appears. Initially, it is invisible; however, if the user ever opens a view
* whose compound id matches the placeholder, the view will appear at the same
* location as the placeholder.
* See the {@link IPageLayout} type documentation for more details about compound ids.
* If the placeholder contains wildcards, it remains in the layout, otherwise
* it is replaced by the view.
* If the primary id of the placeholder has no wildcards, it must refer to a view
* contributed to the workbench's view extension point
* (named <code>"org.blueberry.ui.views"</code>).
*
* @param viewId the compound view id (wildcards allowed)
*/
virtual void AddPlaceholder(const QString& viewId) = 0;
/**
* Returns the property with the given id or <code>null</code>. Folder
* properties are an extensible mechanism for perspective authors to
* customize the appearance of view stacks. The list of customizable
* properties is determined by the presentation factory.
*
* @param id
* Must not be <code>null</code>.
* @return property value, or <code>null</code> if the property is not
* set.
* @since 3.3
*/
virtual QString GetProperty(const QString& id) = 0;
/**
* Sets the given property to the given value. Folder properties are an
* extensible mechanism for perspective authors to customize the appearance
* of view stacks. The list of customizable properties is determined by the
* presentation factory.
* <p>
* These folder properties are intended to be set during
* <code>IPerspectiveFactory#createInitialLayout</code>. Any subsequent
* changes to property values after this method completes will not fire
* change notifications and will not be reflected in the presentation.
* </p>
*
* @param id
* property id. Must not be <code>null</code>.
* @param value
* property value. <code>null</code> will clear the property.
* @since 3.3
*/
virtual void SetProperty(const QString& id, const QString& value) = 0;
};
}
#endif /*BERRYIPLACEHOLDERFOLDERLAYOUT_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIPreferencePage.h b/Plugins/org.blueberry.ui.qt/src/berryIPreferencePage.h
index 126da437dc..50457de92a 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIPreferencePage.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIPreferencePage.h
@@ -1,105 +1,105 @@
/*============================================================================
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 BERRYIPREFERENCEPAGE_H_
#define BERRYIPREFERENCEPAGE_H_
#include "berryObject.h"
#include "berryIPreferences.h"
#include "berryIWorkbench.h"
#include <QObject>
namespace berry
{
/**
* \ingroup org_blueberry_ui_qt
*
* Interface for workbench preference pages.
* <p>
* Clients should implement this interface and include the name of their class
* in an extension contributed to the workbench's preference extension point
* (named <code>"org.blueberry.ui.preferencePages"</code>).
* For example, the plug-in's XML markup might contain:
- * <pre>
- * &LT;extension point="org.blueberry.ui.preferencePages"&GT;
- * &LT;page id="com.example.myplugin.prefs"
+ * \code{.unparsed}
+ * <extension point="org.blueberry.ui.preferencePages>
+ * <page id="com.example.myplugin.prefs"
* name="Knobs"
- * class="ns::MyPreferencePage" /&GT;
- * &LT;/extension&GT;
- * </pre>
+ * class="ns::MyPreferencePage" />
+ * </extension>
+ * \endcode
* </p>
*/
struct BERRY_UI_QT IPreferencePage: virtual public Object
{
berryObjectMacro(berry::IPreferencePage);
~IPreferencePage() override;
/**
* Initializes this preference page for the given workbench.
* <p>
* This method is called automatically as the preference page is being created
* and initialized. Clients must not call this method.
* </p>
*
* @param workbench the workbench
*/
virtual void Init(IWorkbench::Pointer workbench) = 0;
/**
* Creates the top level control for this preference
* page under the given parent widget.
* <p>
* Implementors are responsible for ensuring that
* the created control can be accessed via <code>GetControl</code>
* </p>
*
* @param parent the parent widget
*/
virtual void CreateControl(void* parent) = 0;
/**
* Returns the top level control for this dialog page.
* <p>
* May return <code>null</code> if the control
* has not been created yet.
* </p>
*
* @return the top level control or <code>null</code>
*/
virtual void* GetControl() const = 0;
///
/// Invoked when the OK button was clicked in the preferences dialog
///
virtual bool PerformOk() = 0;
///
/// Invoked when the Cancel button was clicked in the preferences dialog
///
virtual void PerformCancel() = 0;
///
/// Invoked when the user performed an import. As the values of the preferences may have changed
/// you should read all values again from the preferences service.
///
virtual void Update() = 0;
};
}
Q_DECLARE_INTERFACE(berry::IPreferencePage, "org.blueberry.ui.IPreferencePage")
#endif /*BERRYIPREFERENCEPAGE_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryISaveablesSource.h b/Plugins/org.blueberry.ui.qt/src/berryISaveablesSource.h
index 8398ebbad0..9cf5931787 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryISaveablesSource.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryISaveablesSource.h
@@ -1,121 +1,120 @@
/*============================================================================
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 BERRYISAVEABLESSOURCE_H_
#define BERRYISAVEABLESSOURCE_H_
#include <berryMacros.h>
#include <org_blueberry_ui_qt_Export.h>
#include "berrySaveable.h"
namespace berry {
/**
* Represents a source of Saveable objects (units of saveability). Workbench
* parts that show more than one unit of saveability, or whose units of
* saveability change over time, should implement this interface in order to
* provide better integration with workbench facilities like the Save command,
* prompts to save on part close or shutdown, etc.
* <p>
* IMPORTANT: As of 3.2, implementers of <code>ISaveablesSource</code> must
* satisfy the following conditions:
* <ul>
* <li>If ISaveablesSource is implemented by an IWorkbenchPart:
* <ul>
* <li>the part must implement <code>ISaveablePart</code></li>
* <li>if any of its Saveable objects are dirty, the part must return
- * <code>true</code> from {@link ISaveablePart#isDirty()}</li>
+ * <code>true</code> from {@link ISaveablePart#IsDirty()}</li>
* <li>the part must return <code>true</code> from
- * {@link ISaveablePart#isSaveOnCloseNeeded()} if it is dirty (the default
+ * {@link ISaveablePart#IsSaveOnCloseNeeded()} if it is dirty (the default
* behaviour implemented by {@link EditorPart})</li>
- * <li>the part must not implement {@link ISaveablePart2}</li>
* </ul>
* </li>
* <li>If ISaveablesSource is implemented by a non-part (possible as of 3.2.1 and 3.3):
* <ul>
* <li>the Workbench's {@link ISaveablesLifecycleListener} (obtained from the
* Workbench by calling
* <code>workbench.getService(ISaveablesLifecycleListener.class)</code>) must
- * be notified of any change to the result of {@link #getSaveables()} </li>
+ * be notified of any change to the result of {@link #GetSaveables()} </li>
* <li>getActiveSaveables() should be implemented to return an empty array
* </li>
* </ul>
* </ul>
* If any of these conditions are not met, it is undefined whether the Workbench
* will prompt to save dirty Saveables when closing parts or the Workbench.
* </p>
* <p>
* These conditions may be relaxed in future releases.
* </p>
*
* @since 3.2
*/
struct BERRY_UI_QT ISaveablesSource : public virtual Object
{
berryObjectMacro(berry::ISaveablesSource);
~ISaveablesSource() override;
/**
* Returns the saveables presented by the workbench part. If the return
* value of this method changes during the lifetime of
* this part (i.e. after initialization and control creation but before disposal)
* the part must notify an implicit listener using
- * {@link ISaveablesLifecycleListener#handleLifecycleEvent(SaveablesLifecycleEvent)}.
+ * {@link ISaveablesLifecycleListener#HandleLifecycleEvent}.
* <p>
* Additions of saveables to the list of saveables of this part are
* announced using an event of type
* {@link SaveablesLifecycleEvent#POST_OPEN}. Removals are announced in a
* two-stage process, first using an event of type
* {@link SaveablesLifecycleEvent#PRE_CLOSE} followed by an event of type
* {@link SaveablesLifecycleEvent#POST_CLOSE}. Since firing the
* <code>PRE_CLOSE</code> event may trigger prompts to save dirty
* saveables, the cancellation status of the event must be checked by the
* part after the notification. When removing only non-dirty saveables,
* <code>POST_CLOSE</code> notification is sufficient.
* </p>
* <p>
* The listener is obtained from the part site by calling
* <code>partSite.getService(ISaveablesLifecycleListener.class)</code>.
* </p>
* <p>
* The part must not notify from its initialization methods (e.g. <code>init</code>
* or <code>createPartControl</code>), or from its dispose method. Parts that
* implement {@link IReusableEditor} must notify when their input is changed
- * through {@link IReusableEditor#setInput(IEditorInput)}.
+ * through {@link IReusableEditor#SetInput}.
* </p>
*
* @return the saveables presented by the workbench part
*
* @see ISaveablesLifecycleListener
*/
virtual QList<Saveable::Pointer> GetSaveables() = 0;
/**
* Returns the saveables currently active in the workbench part.
* <p>
* Certain workbench actions, such as Save, target only the active saveables
* in the active part. For example, the active saveables could be determined
* based on the current selection in the part.
* </p>
*
* @return the saveables currently active in the workbench part
*/
virtual QList<Saveable::Pointer> GetActiveSaveables() = 0;
};
}
#endif /* BERRYISAVEABLESSOURCE_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/berryISizeProvider.h b/Plugins/org.blueberry.ui.qt/src/berryISizeProvider.h
index 561dde7789..a20937b065 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryISizeProvider.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryISizeProvider.h
@@ -1,154 +1,154 @@
/*============================================================================
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 BERRYISIZEPROVIDER_H_
#define BERRYISIZEPROVIDER_H_
#include <org_blueberry_ui_qt_Export.h>
namespace berry {
/**
* Interface implemented by objects that are capable of computing
* a preferred size
*
* @since 3.1
- * @noimplement This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT ISizeProvider {
/**
* Constant used to indicate infinite size. This is equal to Integer.MAX_VALUE, ensuring
* that it is greater than any other integer.
*/
static const int INF;
virtual ~ISizeProvider();
/**
* Returns a bitwise combination of flags indicating how and when computePreferredSize should
* be used. When called with horizontal=true, this indicates the usage of computePreferredSize(true,...)
* for computing widths. When called with horizontal=false, this indicates the usage of computeSize(false,...)
* for computing heights. These flags are used for optimization. Each flag gives the part more control
* over its preferred size but slows down the layout algorithm. Parts should return the minimum set
* of flags necessary to specify their constraints.
* <p>
* If the return value of this function ever changes, the part must call <code>flushLayout</code> before
* the changes will take effect.
* </p>
*
* <ul>
* <li>SWT.MAX: The part has a maximum size that will be returned by computePreferredSize(horizontal,
* INF, someWidth, INF)</li>
* <li>SWT.MIN: The part has a minimum size that will be returned by computePreferredSize(horizontal,
* INF, someWidth, 0)</li>
* <li>SWT.WRAP: Indicates that computePreferredSize makes use of the availablePerpendicular argument. If this
* flag is not specified, then the third argument to computePreferredSize will always be set to
* INF. The perpendicular size is expensive to compute, and it is usually only used
* for wrapping parts.
* <li>SWT.FILL: The part may not return the preferred size verbatim when computePreferredSize is
* is given a value between the minimum and maximum sizes. This is commonly used if the part
* wants to use a set of predetermined sizes instead of using the workbench-provided size.
* For example, computePreferredSize(horizontal, availableSpace, someWidth,
* preferredSize) may return the nearest predetermined size. Note that this flag should
* be used sparingly. It can prevent layout caching and cause the workbench layout algorithm
* to degrade to exponential worst-case runtime. If this flag is omitted, then
* computePreferredSize may be used to compute the minimum and maximum sizes, but not for
* anything in between.</li>
* </ul>
*
* @param width a value of true or false determines whether the return value applies when computing
* widths or heights respectively. That is, getSizeFlags(true) will be used when calling
* computePreferredSize(true,...)
* @return any bitwise combination of SWT.MAX, SWT.MIN, SWT.WRAP, and SWT.FILL
*/
virtual int GetSizeFlags(bool width) = 0;
/**
* <p>
* Returns the best size for this part, given the available width and height and the workbench's
* preferred size for the part. Parts can overload this to enforce a minimum size, maximum size,
* or a quantized set of preferred sizes. If width == true, this method computes a width in pixels.
* If width == false, this method computes a height. availableParallel and availablePerpendicular
* contain the space available, and preferredParallel contains the preferred result.
* </p>
*
* <p>
* This method returns an answer that is less than or equal to availableParallel and as
* close to preferredParallel as possible. Return values larger than availableParallel will
* be truncated.
* </p>
*
* <p>
* Most presentations will define a minimum size at all times, and a maximum size that only applies
* when maximized.
* </p>
*
* <p>
* The getSizeFlags method controls how frequently this method will be called and what information
* will be available when it is. Any subclass that specializes this method should also specialize
* getSizeFlags. computePreferredSize(width, INF, someSize, 0) returns
* the minimum size of the control (if any). computePreferredSize(width, INF, someSize,
* INF) returns the maximum size of the control.
* </p>
*
* <p>
* Examples:
* <ul>
* <li>To maintain a constant size of 100x300 pixels: {return width ? 100 : 300}, getSizeFlags(boolean) must
* return SWT.MIN | SWT.MAX</li>
* <li>To grow without constraints: {return preferredResult;}, getSizeFlags(boolean) must return 0.</li>
* <li>To enforce a width that is always a multiple of 100 pixels, to a minimum of 100 pixels:
* <code>
* {
* if (width && preferredResult != INF) {
* int result = preferredResult - ((preferredResult + 50) % 100) + 50;
* result = Math.max(100, Math.min(result, availableParallel - (availableParallel % 100)));
*
* return result;
* }
* return preferredResult;
* }
* </code>
* In this case, getSizeFlags(boolean width) must return (width ? SWT.FILL | SWT.MIN: 0)
* <li>To maintain a minimum area of 100000 pixels:
* <code>
* {return availablePerpendicular < 100 ? 1000 : 100000 / availablePerpendicular;}
* </code>
* getSizeFlags(boolean width) must return SWT.WRAP | SWT.MIN;
* </ul>
* </p>
*
* @param width indicates whether a width (=true) or a height (=false) is being computed
* @param availableParallel available space. This is a width (pixels) if width == true, and a height (pixels)
* if width == false. A return value larger than this will be ignored.
* @param availablePerpendicular available space perpendicular to the direction being measured
* or INF if unbounded (pixels). This
* is a height if width == true, or a height if width == false. Implementations will generally ignore this
* argument unless they contain wrapping widgets. Note this argument will only contain meaningful information
* if the part returns the SWT.WRAP flag from getSizeFlags(width)
* @param preferredResult preferred size of the control (pixels, <= availableParallel). Set to
* INF if unknown or unbounded.
* @return returns the preferred size of the control (pixels). This is a width if width == true or a height
* if width == false. Callers are responsible for rounding down the return value if it is larger than
* availableParallel. If availableParallel is INF, then a return value of INF
* is permitted, indicating that the preferred size of the control is unbounded.
*
* @see ISizeProvider#getSizeFlags(boolean)
*/
virtual int ComputePreferredSize(bool width, int availableParallel, int availablePerpendicular, int preferredResult) = 0;
};
}
#endif /* BERRYISIZEPROVIDER_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/berryISources.h b/Plugins/org.blueberry.ui.qt/src/berryISources.h
index aa6c055a7f..23fdfaa030 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryISources.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryISources.h
@@ -1,292 +1,292 @@
/*============================================================================
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 BERRYISOURCES_H_
#define BERRYISOURCES_H_
#include <string>
#include <org_blueberry_ui_qt_Export.h>
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* <p>
* A source is type of event change that can occur within the workbench. For
* example, the active workbench window can change, so it is considered a
* source. Workbench services can track changes to these sources, and thereby
* try to resolve conflicts between a variety of possible options. This is most
* commonly used for things like handlers and contexts.
* </p>
* <p>
* This interface defines the source that are known to the workbench at
* compile-time. These sources can be combined in a bit-wise fashion. So, for
* example, a <code>ACTIVE_PART | ACTIVE_CONTEXT</code> source includes change
* to both the active context and the active part.
* </p>
* <p>
* The values assigned to each source indicates its relative priority. The
* higher the value, the more priority the source is given in resolving
* conflicts. Another way to look at this is that the higher the value, the more
* "local" the source is to what the user is currently doing. This is similar
* to, but distinct from the concept of components. The nesting support provided
* by components represent only one source (<code>ACTIVE_SITE</code>) that
* the workbench understands.
* </p>
* <p>
* Note that for backward compatibility, we must reserve the lowest three bits
* for <code>Priority</code> instances using the old
* <code>HandlerSubmission</code> mechanism. This mechanism was used in
* Eclipse 3.0.
* </p>
* <p>
* <b>Note in 3.3:</b>
* </p>
* <p>
* Currently, source variables are not extensible by user plugins, and
* the number of bits available for resolving conflicts is limited. When
* the variable sources become user extensible a new conflict resolution
* mechanism will be implemented.
* </p>
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
+ * @note This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be extended by clients.
*
* @see org.blueberry.ui.ISourceProvider
*/
struct BERRY_UI_QT ISources
{
/**
* The priority given to default handlers and handlers that are active
* across the entire workbench.
*/
static int WORKBENCH(); // = 0;
/**
* The priority given when the source includes a particular context.
*/
static int ACTIVE_CONTEXT(); // = 1 << 3;
/**
* The variable name for the active contexts. This is for use with the
* <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
*/
static const QString ACTIVE_CONTEXT_NAME();
/**
* The priority given when the source includes a particular action set.
*/
static int ACTIVE_ACTION_SETS(); // = 1 << 5;
/**
* The variable name for the active action sets. This is for use with the
* {@link ISourceProvider} and {@link IEvaluationContext}.
*/
static const QString ACTIVE_ACTION_SETS_NAME();
/**
* The priority given when the source includes the currently active shell.
*/
static int ACTIVE_SHELL(); // = 1 << 7();
/**
* The variable name for the active shell. This is for use with the
* <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
*/
static const QString ACTIVE_SHELL_NAME();
/**
* The priority given when the source includes the currently active
* workbench window shell.
*/
static int ACTIVE_WORKBENCH_WINDOW_SHELL(); // = 1 << 9();
/**
* The variable name for the active workbench window shell. This is for use
* with the <code>ISourceProvider</code> and
* <code>IEvaluationContext</code>.
*/
static const QString ACTIVE_WORKBENCH_WINDOW_SHELL_NAME();
/**
* The priority given when the source includes the currently active
* workbench window.
*/
static int ACTIVE_WORKBENCH_WINDOW(); // = 1 << 11();
/**
* The variable name for the active workbench window. This is for use with
* the <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
*/
static const QString ACTIVE_WORKBENCH_WINDOW_NAME();
/**
* The priority given when the source includes subordinate properties of the currently active
* workbench window.
*/
static int ACTIVE_WORKBENCH_WINDOW_SUBORDINATE(); // = 1 << 12();
/**
* The variable name for the coolbar visibility state of the active
* workbench window. This is for use with the <code>ISourceProvider</code>
* and <code>IEvaluationContext</code>.
*/
static const QString ACTIVE_WORKBENCH_WINDOW_IS_TOOLBAR_VISIBLE_NAME();
/**
* The variable name for the perspective bar visibility state of the active
* workbench window. This is for use with the <code>ISourceProvider</code>
* and <code>IEvaluationContext</code>.
*/
static const QString ACTIVE_WORKBENCH_WINDOW_IS_PERSPECTIVEBAR_VISIBLE_NAME();
/**
* The variable name for the status line visibility state of the active
* workbench window. This is for use with the <code>ISourceProvider</code>
* and <code>IEvaluationContext</code>.
*/
static const QString ACTIVE_WORKBENCH_WINDOW_IS_STATUS_LINE_VISIBLE_NAME();
/**
* The variable name for the current perspective of the active workbench
* window. This is for use with the <code>ISourceProvider</code> and
* <code>IEvaluationContext</code>.
*/
static const QString ACTIVE_WORKBENCH_WINDOW_ACTIVE_PERSPECTIVE_NAME();
/**
* The priority given when the source includes the active editor part.
*/
static int ACTIVE_EDITOR(); // = 1 << 13();
/**
* The variable name for the active editor part. This is for use with the
* <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
*/
static const QString ACTIVE_EDITOR_NAME();
/**
* The editor input of the currently active editor.
*/
static const QString ACTIVE_EDITOR_INPUT_NAME();
/**
* The priority given when the source includes the active editor identifier.
*/
static int ACTIVE_EDITOR_ID(); // = 1 << 15();
/**
* The variable name for the active editor identifier. This is for use with
* the <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
*/
static const QString ACTIVE_EDITOR_ID_NAME();
/**
* The priority given when the source includes the active part.
*/
static int ACTIVE_PART(); // = 1 << 17();
/**
* The variable name for the active part. This is for use with the
* <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
*/
static const QString ACTIVE_PART_NAME();
/**
* The priority given when the source includes the active part id.
*/
static int ACTIVE_PART_ID(); // = 1 << 19();
/**
* The variable name for the active part id. This is for use with the
* <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
*/
static const QString ACTIVE_PART_ID_NAME();
/**
* The priority given when the source includes the active workbench site. In
* the case of nesting components, one should be careful to only activate
* the most nested component.
*/
static int ACTIVE_SITE(); // = 1 << 23();
/**
* The variable name for the active workbench site. This is for use with the
* <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
*/
static const QString ACTIVE_SITE_NAME();
/**
* The variable for the showIn selection. This is for use with the
* <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
* @see IShowInSource
*/
static const QString SHOW_IN_SELECTION();
/**
* The variable for the showIn input. This is for use with the
* <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
* @see IShowInSource
*/
static const QString SHOW_IN_INPUT();
/**
* The priority given when the source includes the current selection.
*/
static int ACTIVE_CURRENT_SELECTION(); // = 1 << 27();
/**
* The variable name for the active selection. This is for use with the
* <code>ISourceProvider</code> and <code>IEvaluationContext</code>.
*/
static const QString ACTIVE_CURRENT_SELECTION_NAME();
/**
* The priority given when the source includes the current menu.
*/
static int ACTIVE_MENU(); // = 1 << 30();
/**
* The variable name for the active menu. This is for use with the
* {@link ISourceProvider} and {@link IEvaluationContext}.
*/
static const QString ACTIVE_MENU_NAME();
/**
* The variable name for the <b>local</b> selection, available while a
* context menu is visible.
*/
static const QString ACTIVE_MENU_SELECTION_NAME();
/**
* The variable name for the <b>local</b> editor input which is sometimes
* available while a context menu is visible.
*/
static const QString ACTIVE_MENU_EDITOR_INPUT_NAME();
/**
* The variable name for the active focus Control, when provided by the
* IFocusService.
*/
static const QString ACTIVE_FOCUS_CONTROL_NAME();
/**
* The variable name for the active focus Control id, when provided by the
* IFocusService.
*/
static const QString ACTIVE_FOCUS_CONTROL_ID_NAME();
};
}
#endif /*BERRYISOURCES_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIStickyViewDescriptor.h b/Plugins/org.blueberry.ui.qt/src/berryIStickyViewDescriptor.h
index 143adb01b8..6696e1ad7d 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIStickyViewDescriptor.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIStickyViewDescriptor.h
@@ -1,75 +1,74 @@
/*============================================================================
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 BERRYISTICKYVIEWDESCRIPTOR_H_
#define BERRYISTICKYVIEWDESCRIPTOR_H_
#include <berryObject.h>
#include <berryMacros.h>
#include <org_blueberry_ui_qt_Export.h>
namespace berry {
/**
* Supplemental view interface that describes various sticky characteristics
* that a view may possess.
* <p>
* This interface is not intended to be implemented by clients.
* </p>
*
* @see org.eclipse.ui.views.IViewRegistry
* @see org.eclipse.ui.views.IViewDescriptor
* @since 3.1
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IStickyViewDescriptor : public Object {
berryObjectMacro(IStickyViewDescriptor);
~IStickyViewDescriptor() override;
/**
* Return the id of the view to be made sticky.
*
* @return the id of the view to be made sticky
*/
virtual QString GetId() const = 0;
/**
* Return the location of this sticky view. Must be one of
* <code>IPageLayout.LEFT</code>, <code>IPageLayout.RIGHT</code>,
* <code>IPageLayout.TOP</code>, or <code>IPageLayout.BOTTOM</code>.
*
* @return the location constant
*/
virtual int GetLocation() const = 0;
/**
* Return whether this view should be closeable.
*
* @return whether this view should be closeeable
*/
virtual bool IsCloseable() const = 0;
/**
* Return whether this view should be moveable.
*
* @return whether this view should be moveable
*/
virtual bool IsMoveable() const = 0;
};
}
#endif /* BERRYISTICKYVIEWDESCRIPTOR_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIViewLayout.h b/Plugins/org.blueberry.ui.qt/src/berryIViewLayout.h
index 6804297e17..66dc791307 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIViewLayout.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIViewLayout.h
@@ -1,88 +1,86 @@
/*============================================================================
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 BERRYIVIEWLAYOUT_H_
#define BERRYIVIEWLAYOUT_H_
#include <org_blueberry_ui_qt_Export.h>
#include <berryMacros.h>
#include <berryObject.h>
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* Represents the layout info for a view or placeholder in an {@link IPageLayout}.
* <p>
* This interface is not intended to be implemented by clients.
* </p>
- *
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IViewLayout : public Object
{
berryObjectMacro(berry::IViewLayout);
~IViewLayout() override;
/**
* Returns whether the view is closeable.
* The default is <code>true</code>.
*
* @return <code>true</code> if the view is closeable, <code>false</code> if not
*/
virtual bool IsCloseable() = 0;
/**
* Sets whether the view is closeable.
*
* @param closeable <code>true</code> if the view is closeable, <code>false</code> if not
*/
virtual void SetCloseable(bool closeable) = 0;
/**
* Returns whether the view is moveable.
* The default is <code>true</code>.
*
* @return <code>true</code> if the view is moveable, <code>false</code> if not
*/
virtual bool IsMoveable() = 0;
/**
* Sets whether the view is moveable.
*
* @param moveable <code>true</code> if the view is moveable, <code>false</code> if not
*/
virtual void SetMoveable(bool moveable) = 0;
/**
* Returns whether the view is a standalone view.
*
* @see IPageLayout#addStandaloneView
*/
virtual bool IsStandalone() = 0;
/**
* Returns whether the view shows its title.
* This is only applicable to standalone views.
*
* @see IPageLayout#addStandaloneView
*/
virtual bool GetShowTitle() = 0;
};
}
#endif /*BERRYIVIEWLAYOUT_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIViewRegistry.h b/Plugins/org.blueberry.ui.qt/src/berryIViewRegistry.h
index bddcaaed38..0ee69890b1 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIViewRegistry.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIViewRegistry.h
@@ -1,80 +1,79 @@
/*============================================================================
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 BERRYIVIEWREGISTRY_H_
#define BERRYIVIEWREGISTRY_H_
#include <org_blueberry_ui_qt_Export.h>
#include "berryIViewDescriptor.h"
#include "berryIViewCategory.h"
#include "berryIStickyViewDescriptor.h"
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* The view registry maintains a list of views explicitly registered
* against the view extension point.
* <p>
* The description of a given view is kept in a <code>IViewDescriptor</code>.
* </p>
* <p>
* This interface is not intended to be implemented by clients.
* </p>
*
* @see IViewDescriptor
* @see IStickyViewDescriptor
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IViewRegistry
{
/**
* Return a view descriptor with the given extension id. If no view exists
* with the id return <code>null</code>.
* Will also return <code>null</code> if the view descriptor exists, but
* is filtered by an expression-based activity.
*
* @param id the id to search for
* @return the descriptor or <code>null</code>
*/
virtual IViewDescriptor::Pointer Find(const QString& id) const = 0;
/**
* Returns an array of view categories.
*
* @return the categories.
*/
virtual QList<IViewCategory::Pointer> GetCategories() = 0;
/**
* Return a list of views defined in the registry.
*
* @return the views.
*/
virtual QList<IViewDescriptor::Pointer> GetViews() const = 0;
/**
* Return a list of sticky views defined in the registry.
*
* @return the sticky views. Never <code>null</code>.
*/
virtual QList<IStickyViewDescriptor::Pointer> GetStickyViews() const = 0;
virtual ~IViewRegistry();
};
}
#endif /*BERRYIVIEWREGISTRY_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIViewSite.h b/Plugins/org.blueberry.ui.qt/src/berryIViewSite.h
index cf77f4dd4b..70f052e120 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIViewSite.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIViewSite.h
@@ -1,58 +1,57 @@
/*============================================================================
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 BERRYIVIEWSITE_H_
#define BERRYIVIEWSITE_H_
#include "berryIWorkbenchPartSite.h"
#include <string>
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* The primary interface between a view part and the workbench.
* <p>
* The workbench exposes its implemention of view part sites via this interface,
* which is not intended to be implemented or extended by clients.
* </p>
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IViewSite : public virtual IWorkbenchPartSite
{
berryObjectMacro(berry::IViewSite);
~IViewSite() override;
/**
* Returns the action bars for this part site.
* Views have exclusive use of their site's action bars.
*
* @return the action bars
*/
//IActionBars getActionBars();
/**
* Returns the secondary id for this part site's part,
* or <code>null</code> if it has none.
*
* @see IWorkbenchPage#showView(String, String, int)
*/
virtual QString GetSecondaryId() = 0;
};
}
#endif /*BERRYIVIEWSITE_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIWindowListener.h b/Plugins/org.blueberry.ui.qt/src/berryIWindowListener.h
index 6de47bc5de..94eb3d2f09 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIWindowListener.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIWindowListener.h
@@ -1,95 +1,89 @@
/*============================================================================
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 BERRYIWINDOWLISTENER_H_
#define BERRYIWINDOWLISTENER_H_
#include <org_blueberry_ui_qt_Export.h>
#include <berryMessage.h>
#include "berryIWorkbenchWindow.h"
namespace berry
{
/**
* Interface for listening to window lifecycle events.
* <p>
* This interface may be implemented by clients.
* </p>
*/
struct BERRY_UI_QT IWindowListener
{
struct Events {
typedef Message1<const IWorkbenchWindow::Pointer&> WindowEvent;
WindowEvent windowActivated;
WindowEvent windowDeactivated;
WindowEvent windowClosed;
WindowEvent windowOpened;
void AddListener(IWindowListener* listener);
void RemoveListener(IWindowListener* listener);
private:
typedef MessageDelegate1<IWindowListener, const IWorkbenchWindow::Pointer&> Delegate;
};
virtual ~IWindowListener();
/**
* Notifies this listener that the given window has been activated.
* <p>
* <b>Note:</b> This event is not fired if no perspective is
* open (the window is empty).
* </p>
- *
- * @param window the window that was activated
*/
virtual void WindowActivated(const IWorkbenchWindow::Pointer& /*window*/) {}
/**
* Notifies this listener that the given window has been deactivated.
* <p>
* <b>Note:</b> This event is not fired if no perspective is
* open (the window is empty).
* </p>
- *
- * @param window the window that was activated
*/
virtual void WindowDeactivated(const IWorkbenchWindow::Pointer& /*window*/) {}
/**
* Notifies this listener that the given window has been closed.
*
- * @param window the window that was closed
* @see IWorkbenchWindow#close
*/
virtual void WindowClosed(const IWorkbenchWindow::Pointer& /*window*/) {}
/**
* Notifies this listener that the given window has been opened.
*
- * @param window the window that was opened
* @see IWorkbench#openWorkbenchWindow
*/
virtual void WindowOpened(const IWorkbenchWindow::Pointer& /*window*/) {}
};
}
#endif /* BERRYIWINDOWLISTENER_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIWorkbench.h b/Plugins/org.blueberry.ui.qt/src/berryIWorkbench.h
index 49c5894bc9..905f58a87f 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIWorkbench.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIWorkbench.h
@@ -1,423 +1,421 @@
/*============================================================================
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 BERRYIWORKBENCH_H_
#define BERRYIWORKBENCH_H_
#include <berryMacros.h>
#include "services/berryIServiceLocator.h"
#include "berryIViewRegistry.h"
#include "berryIEditorRegistry.h"
#include "intro/berryIIntroManager.h"
#include "berryIPerspectiveRegistry.h"
#include "berryIWorkbenchWindow.h"
#include "berryIWorkbenchListener.h"
#include "berryIWindowListener.h"
#include "berryDisplay.h"
namespace berry {
struct IElementFactory;
struct IExtensionTracker;
struct IWorkbenchPage;
/**
* \ingroup org_blueberry_ui_qt
*
* A workbench is the root object for the BlueBerry Platform user interface.
* <p>
* A <b>workbench</b> has one or more main windows which present to the end
* user information based on some underlying model, typically on resources in an
* underlying workspace. A workbench usually starts with a single open window,
* and automatically closes when its last window closes.
* </p>
* <p>
* Each <b>workbench window</b> has a collection of <b>pages</b>; the active
* page is the one that is being presented to the end user; at most one page is
* active in a window at a time.
* </p>
* <p>
* Each workbench page has a collection of <b>workbench parts</b>, of which
* there are two kinds: views and editors. A page's parts are arranged (tiled or
* stacked) for presentation on the screen. The arrangement is not fixed; the
* user can arrange the parts as they see fit. A <b>perspective</b> is a
* template for a page, capturing a collection of parts and their arrangement.
* </p>
* <p>
* The platform creates a workbench when the workbench plug-in is activated;
* since this happens at most once during the life of the running platform,
* there is only one workbench instance. Due to its singular nature, it is
- * commonly referred to as <it>the</it> workbench.
+ * commonly referred to as <em>the</em> workbench.
* </p>
* <p>
* The workbench supports a few {@link IServiceLocator services} by default. If
* these services are used to allocate resources, it is important to remember to
* clean up those resources after you are done with them. Otherwise, the
* resources will exist until the workbench shuts down. The supported services
* are:
* </p>
* <ul>
- * <li>{@link IBindingService}</li>
* <li>{@link ICommandService}</li>
* <li>{@link IContextService}</li>
* <li>{@link IHandlerService}</li>
* </ul>
* <p>
* This interface is not intended to be implemented by clients.
* </p>
*
- * @see PlatformUI#getWorkbench
- * @noimplement This interface is not intended to be implemented by clients.
+ * @see PlatformUI#GetWorkbench
*/
struct BERRY_UI_QT IWorkbench : public IServiceLocator {
berryObjectMacro(berry::IWorkbench);
~IWorkbench() override;
/**
* Returns the display for this workbench.
* <p>
* Code should always ask the workbench for the display rather than rely on
- * {@link Display#getDefault Display.getDefault()}.
+ * {@link Display#GetDefault Display.getDefault()}.
* </p>
*
* @return the display to be used for all UI interactions with this
* workbench
*/
virtual Display* GetDisplay() const = 0;
/**
* Adds a workbench listener.
*
* @param listener
* the workbench listener to add
* @since 3.2
*/
virtual void AddWorkbenchListener(IWorkbenchListener* listener) = 0;
/**
* Removes a workbench listener.
*
* @param listener
* the workbench listener to remove
* @since 3.2
*/
virtual void RemoveWorkbenchListener(IWorkbenchListener* listener) = 0;
/**
* Returns the workbench events object
*/
virtual IWorkbenchListener::Events& GetWorkbenchEvents() = 0;
/**
* Adds a window listener.
*
* @param listener
* the window listener to add
* @since 2.0
*/
virtual void AddWindowListener(IWindowListener* listener) = 0;
/**
* Removes a window listener.
*
* @param listener
* the window listener to remove
* @since 2.0
*/
virtual void RemoveWindowListener(IWindowListener* listener) = 0;
/**
* Returns the window events object
*
*/
virtual IWindowListener::Events& GetWindowEvents() = 0;
/**
* Closes this workbench and all its open windows.
* <p>
* If the workbench has an open editor with unsaved content, the user will
* be given the opportunity to save it.
* </p>
*
* @return <code>true</code> if the workbench was successfully closed, and
* <code>false</code> if it is still open
*/
virtual bool Close() = 0;
/**
* Returns the currently active window for this workbench (if any). Returns
* <code>null</code> if there is no active workbench window. Returns
* <code>null</code> if called from a non-UI thread.
*
* @return the active workbench window, or <code>null</code> if there is
* no active workbench window or if called from a non-UI thread
*/
virtual IWorkbenchWindow::Pointer GetActiveWorkbenchWindow() const = 0;
/**
* Return the extension tracker for the workbench. This tracker may be used
* by plug-ins to ensure responsiveness to changes to the plug-in registry.
* <p>
* The tracker at this level of the workbench is typically used to track
* elements that persist for the life of the workbench. For example,
* <code>IEditorDescriptor</code> objects fall into this category.
* </p>
*
* @return the extension tracker
* @see IWorkbenchWindow#GetExtensionTracker()
* @see IWorkbenchPage#GetExtensionTracker()
*/
virtual IExtensionTracker* GetExtensionTracker() const = 0;
/**
* Returns the perspective registry for the workbench.
*
* @return the workbench perspective registry
*/
virtual IPerspectiveRegistry* GetPerspectiveRegistry() const = 0;
/**
* Returns the view registry for the workbench.
*
* @return the workbench view registry
* @since 3.1
*/
virtual IViewRegistry* GetViewRegistry() const = 0;
/**
* Returns the editor registry for the workbench.
*
* @return the workbench editor registry
*/
virtual IEditorRegistry* GetEditorRegistry() const = 0;
/**
* Returns the number of open main windows associated with this workbench.
* Note that wizards and dialogs are not included in this list since they
* are not considered main windows.
*
* @return the number of open windows
* @since 3.0
*/
virtual std::size_t GetWorkbenchWindowCount() const = 0;
/**
* Returns a list of the open main windows associated with this workbench.
* Note that wizards and dialogs are not included in this list since they
* are not considered main windows.
*
* @return a list of open windows
*/
virtual QList<IWorkbenchWindow::Pointer> GetWorkbenchWindows() const = 0;
/**
* Creates and opens a new workbench window with one page. The perspective
* of the new page is defined by the specified perspective ID. The new
* window and new page become active.
* <p>
* <b>Note:</b> The caller is responsible to ensure the action using this
* method will explicitly inform the user a new window will be opened.
* Otherwise, callers are strongly recommended to use the
* <code>openPerspective</code> APIs to programmatically show a
* perspective to avoid confusing the user.
* </p>
* <p>
* In most cases where this method is used the caller is tightly coupled to
* a particular perspective. They define it in the registry and contribute
* some user interface action to open or activate it. In situations like
* this a static variable is often used to identify the perspective ID.
* </p>
*
* @param perspectiveId
* the perspective id for the window's initial page, or
* <code>null</code> for no initial page
* @param input
* the page input, or <code>null</code> if there is no current
* input. This is used to seed the input for the new page's
* views.
* @return the new workbench window
* @exception WorkbenchException
* if a new window and page could not be opened
*
* @see IWorkbench#showPerspective(String, IWorkbenchWindow, IAdaptable)
*/
virtual IWorkbenchWindow::Pointer OpenWorkbenchWindow(const QString& perspectiveId,
IAdaptable* input) = 0;
/**
* Creates and opens a new workbench window with one page. The perspective
* of the new page is defined by the default perspective ID. The new window
* and new page become active.
* <p>
* <b>Note:</b> The caller is responsible to ensure the action using this
* method will explicitly inform the user a new window will be opened.
* Otherwise, callers are strongly recommended to use the
* <code>openPerspective</code> APIs to programmatically show a
* perspective to avoid confusing the user.
* </p>
*
* @param input
* the page input, or <code>null</code> if there is no current
* input. This is used to seed the input for the new page's
* views.
* @return the new workbench window
* @exception WorkbenchException
* if a new window and page could not be opened
*
* @see IWorkbench#showPerspective(String, IWorkbenchWindow, IAdaptable)
*/
virtual IWorkbenchWindow::Pointer OpenWorkbenchWindow(IAdaptable* input) = 0;
/**
* Shows the specified perspective to the user. The caller should use this
* method when the perspective to be shown is not dependent on the page's
* input. That is, the perspective can open in any page depending on user
* preferences.
* <p>
* The perspective may be shown in the specified window, in another existing
* window, or in a new window depending on user preferences. The exact
* policy is controlled by the workbench to ensure consistency to the user.
* The policy is subject to change. The current policy is as follows:
* <ul>
* <li>If the specified window has the requested perspective open, then the
* window is given focus and the perspective is shown. The page's input is
* ignored.</li>
* <li>If another window that has the workspace root as input and the
* requested perspective open and active, then the window is given focus.
* </li>
* <li>Otherwise the requested perspective is opened and shown in the
* specified window or in a new window depending on the current user
* preference for opening perspectives, and that window is given focus.
* </li>
* </ul>
* </p>
* <p>
* The workbench also defines a number of menu items to activate or open
* each registered perspective. A complete list of these perspectives is
* available from the perspective registry found on <code>IWorkbench</code>.
* </p>
*
* @param perspectiveId
* the perspective ID to show
* @param window
* the workbench window of the action calling this method.
* @return the workbench page that the perspective was shown
* @exception WorkbenchException
* if the perspective could not be shown
*
* @since 2.0
*/
virtual SmartPointer<IWorkbenchPage> ShowPerspective(const QString& perspectiveId,
IWorkbenchWindow::Pointer window) = 0;
/**
* Shows the specified perspective to the user. The caller should use this
* method when the perspective to be shown is dependent on the page's input.
* That is, the perspective can only open in any page with the specified
* input.
* <p>
* The perspective may be shown in the specified window, in another existing
* window, or in a new window depending on user preferences. The exact
* policy is controlled by the workbench to ensure consistency to the user.
* The policy is subject to change. The current policy is as follows:
* <ul>
* <li>If the specified window has the requested perspective open and the
* same requested input, then the window is given focus and the perspective
* is shown.</li>
* <li>If another window has the requested input and the requested
* perspective open and active, then that window is given focus.</li>
* <li>If the specified window has the same requested input but not the
* requested perspective, then the window is given focus and the perspective
* is opened and shown on condition that the user preference is not to open
* perspectives in a new window.</li>
* <li>Otherwise the requested perspective is opened and shown in a new
* window, and the window is given focus.</li>
* </ul>
* </p>
* <p>
* The workbench also defines a number of menu items to activate or open
* each registered perspective. A complete list of these perspectives is
* available from the perspective registry found on <code>IWorkbench</code>.
* </p>
*
* @param perspectiveId
* the perspective ID to show
* @param window
* the workbench window of the action calling this method.
* @param input
* the page input, or <code>null</code> if there is no current
* input. This is used to seed the input for the page's views
* @return the workbench page that the perspective was shown
* @exception WorkbenchException
* if the perspective could not be shown
*
* @since 2.0
*/
virtual SmartPointer<IWorkbenchPage> ShowPerspective(const QString& perspectiveId,
IWorkbenchWindow::Pointer window, IAdaptable* input) = 0;
/**
* Save all dirty editors in the workbench. Opens a dialog to prompt the
* user if <code>confirm</code> is true. Return true if successful. Return
* false if the user has canceled the command.
*
* @param confirm <code>true</code> to ask the user before saving unsaved
* changes (recommended), and <code>false</code> to save
* unsaved changes without asking
* @return <code>true</code> if the command succeeded, and
* <code>false</code> if the operation was canceled by the user or
* an error occurred while saving
*/
virtual bool SaveAllEditors(bool confirm) = 0;
/**
* Returns the element factory with the given id. The calles takes
* ownership of the returned pointer.
*
* @param factoryId
* the id of the element factory
* @return the element factory, or <code>null</code> if none
* @see IElementFactory
*/
virtual IElementFactory* GetElementFactory(const QString& factoryId) const = 0;
/**
* Return the intro manager for this workbench.
*
* @return the intro manager for this workbench. Guaranteed not to be
* <code>null</code>.
*/
virtual IIntroManager* GetIntroManager() const = 0;
/**
* Returns a boolean indicating whether the workbench is in the process of
* closing.
*
* @return <code>true</code> if the workbench is in the process of
* closing, <code>false</code> otherwise
* @since 3.1
*/
virtual bool IsClosing() const = 0;
/**
* Applies changes of the current theme to the user interface.
*/
virtual void UpdateTheme() = 0;
};
}
#endif /*BERRYIWORKBENCH_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchCommandConstants.h b/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchCommandConstants.h
index 299f22a327..3feef4cbe4 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchCommandConstants.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchCommandConstants.h
@@ -1,324 +1,324 @@
/*============================================================================
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 BERRYIWORKBENCHCOMMANDCONSTANTS_H
#define BERRYIWORKBENCHCOMMANDCONSTANTS_H
#include <org_blueberry_ui_qt_Export.h>
#include <QString>
namespace berry {
/**
* Constants for all commands defined by the BlueBerry workbench.
*
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be extended by clients.
+ * @note This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IWorkbenchCommandConstants {
// File Category
/**
* Id for command "New" in category "File"
* (value is <code>"org.blueberry.ui.newWizard"</code>).
*/
static const QString FILE_NEW; // = "org.blueberry.ui.newWizard";
/**
* Id for command "Open File" in category "File"
* (value is <code>"org.blueberry.ui.file.openLocal"</code>).
*/
static const QString FILE_OPEN; // = "org.blueberry.ui.file.openLocal";
/**
* Id for command "Save" in category "File"
* (value is <code>"org.blueberry.ui.file.save"</code>).
*/
static const QString FILE_SAVE; // = "org.blueberry.ui.file.save";
/**
* Id for command "Exit" in category "File"
* (value is <code>"org.blueberry.ui.file.exit"</code>).
*/
static const QString FILE_EXIT; // = "org.blueberry.ui.file.exit";
// Edit Category:
/**
* Id for command "Undo" in category "Edit"
* (value is <code>"org.blueberry.ui.edit.undo"</code>).
*/
static const QString EDIT_UNDO; // = "org.blueberry.ui.edit.undo";
/**
* Id for command "Redo" in category "Edit"
* (value is <code>"org.blueberry.ui.edit.redo"</code>).
*/
static const QString EDIT_REDO; // = "org.blueberry.ui.edit.redo";
/**
* Id for command "Cut" in category "Edit"
* (value is <code>"org.blueberry.ui.edit.cut"</code>).
*/
static const QString EDIT_CUT; // = "org.blueberry.ui.edit.cut";
/**
* Id for command "Copy" in category "Edit"
* (value is <code>"org.blueberry.ui.edit.copy"</code>).
*/
static const QString EDIT_COPY; // = "org.blueberry.ui.edit.copy";
/**
* Id for command "Paste" in category "Edit"
* (value is <code>"org.blueberry.ui.edit.paste"</code>).
*/
static const QString EDIT_PASTE; // = "org.blueberry.ui.edit.paste";
/**
* Id for command "Delete" in category "Edit"
* (value is <code>"org.blueberry.ui.edit.delete"</code>).
*/
static const QString EDIT_DELETE; // = "org.blueberry.ui.edit.delete";
// Window Category:
/**
* Id for command "New Window" in category "Window"
* (value is <code>"org.eclipse.ui.window.newWindow"</code>).
*/
static const QString WINDOW_NEW_WINDOW; // = "org.blueberry.ui.window.newWindow";
/**
* Id for command "New Editor" in category "Window"
* (value is <code>"org.eclipse.ui.window.newEditor"</code>).
*/
static const QString WINDOW_NEW_EDITOR; // = "org.blueberry.ui.window.newEditor";
/**
* Id for command "Show View Menu" in category "Window"
* (value is <code>"org.eclipse.ui.window.showViewMenu"</code>).
*/
static const QString WINDOW_SHOW_VIEW_MENU; // = "org.blueberry.ui.window.showViewMenu";
/**
* Id for command "Activate Editor" in category "Window"
* (value is <code>"org.eclipse.ui.window.activateEditor"</code>).
*/
static const QString WINDOW_ACTIVATE_EDITOR; // = "org.blueberry.ui.window.activateEditor";
/**
* Id for command "Maximize Active View or Editor" in category "Window"
* (value is <code>"org.eclipse.ui.window.maximizePart"</code>).
*/
static const QString WINDOW_MAXIMIZE_ACTIVE_VIEW_OR_EDITOR; // = "org.blueberry.ui.window.maximizePart";
/**
* Id for command "Minimize Active View or Editor" in category "Window"
* (value is <code>"org.eclipse.ui.window.minimizePart"</code>).
*/
static const QString WINDOW_MINIMIZE_ACTIVE_VIEW_OR_EDITOR; // = "org.blueberry.ui.window.minimizePart";
/**
* Id for command "Next Editor" in category "Window"
* (value is <code>"org.eclipse.ui.window.nextEditor"</code>).
*/
static const QString WINDOW_NEXT_EDITOR; // = "org.blueberry.ui.window.nextEditor";
/**
* Id for command "Previous Editor" in category "Window"
* (value is <code>"org.eclipse.ui.window.previousEditor"</code>).
*/
static const QString WINDOW_PREVIOUS_EDITOR; // = "org.blueberry.ui.window.previousEditor";
/**
* Id for command "Next View" in category "Window"
* (value is <code>"org.eclipse.ui.window.nextView"</code>).
*/
static const QString WINDOW_NEXT_VIEW; // = "org.blueberry.ui.window.nextView";
/**
* Id for command "Previous View" in category "Window"
* (value is <code>"org.eclipse.ui.window.previousView"</code>).
*/
static const QString WINDOW_PREVIOUS_VIEW; // = "org.blueberry.ui.window.previousView";
/**
* Id for command "Next Perspective" in category "Window"
* (value is <code>"org.eclipse.ui.window.nextPerspective"</code>).
*/
static const QString WINDOW_NEXT_PERSPECTIVE; // = "org.blueberry.ui.window.nextPerspective";
/**
* Id for command "Previous Perspective" in category "Window"
* (value is <code>"org.eclipse.ui.window.previousPerspective"</code>).
*/
static const QString WINDOW_PREVIOUS_PERSPECTIVE; // = "org.blueberry.ui.window.previousPerspective";
/**
* Id for command "Close All Perspectives" in category "Window"
* (value is <code>"org.eclipse.ui.window.closeAllPerspectives"</code>).
*/
static const QString WINDOW_CLOSE_ALL_PERSPECTIVES; // = "org.blueberry.ui.window.closeAllPerspectives";
/**
* Id for command "Close Perspective" in category "Window"
* (value is <code>"org.eclipse.ui.window.closePerspective"</code>).
*/
static const QString WINDOW_CLOSE_PERSPECTIVE; // = "org.blueberry.ui.window.closePerspective";
/**
* Id for parameter "Perspective Id" in command "Close Perspective" in
* category "Window" (value is
* <code>"org.eclipse.ui.window.closePerspective.perspectiveId"</code>).
* Optional.
*/
static const QString WINDOW_CLOSE_PERSPECTIVE_PARM_ID; // = "org.blueberry.ui.window.closePerspective.perspectiveId";
/**
* Id for command "Close Part" in category "Window" (value is
* <code>"org.eclipse.ui.file.closePart"</code>).
*/
static const QString WINDOW_CLOSE_PART; // = "org.blueberry.ui.file.closePart";
/**
* Id for command "Customize Perspective" in category "Window"
* (value is <code>"org.eclipse.ui.window.customizePerspective"</code>).
*/
static const QString WINDOW_CUSTOMIZE_PERSPECTIVE; // = "org.blueberry.ui.window.customizePerspective";
/**
* Id for command "Pin Editor" in category "Window"
* (value is <code>"org.eclipse.ui.window.pinEditor"</code>).
*/
static const QString WINDOW_PIN_EDITOR; // = "org.blueberry.ui.window.pinEditor";
/**
* Id for command "Preferences" in category "Window"
* (value is <code>"org.eclipse.ui.window.preferences"</code>).
*/
static const QString WINDOW_PREFERENCES; // = "org.blueberry.ui.window.preferences";
/**
* Id for parameter "Preference Page Id" in command "Preferences" in
* category "Window" (value is <code>"preferencePageId"</code>). Optional.
*/
static const QString WINDOW_PREFERENCES_PARM_PAGEID; // = "preferencePageId";
/**
* Id for command "Reset Perspective" in category "Window" (value is
* <code>"org.eclipse.ui.window.resetPerspective"</code>).
*/
static const QString WINDOW_RESET_PERSPECTIVE; // = "org.blueberry.ui.window.resetPerspective";
/**
* Id for command "Save Perspective As" in category "Window"
* (value is <code>"org.eclipse.ui.window.savePerspective"</code>).
*/
static const QString WINDOW_SAVE_PERSPECTIVE_AS; // = "org.blueberry.ui.window.savePerspective";
/**
* Id for command "Show Key Assist" in category "Window"
* (value is <code>"org.eclipse.ui.window.showKeyAssist"</code>).
*/
static const QString WINDOW_SHOW_KEY_ASSIST; // = "org.blueberry.ui.window.showKeyAssist";
// Help Category:
/**
* Id for command "Help Contents" in category "Help"
* (value is <code>"org.blueberry.ui.help.helpContents"</code>).
*/
static const QString HELP_HELP_CONTENTS; // = "org.blueberry.ui.help.helpContents";
/**
* Id for command "Help Search" in category "Help"
* (value is <code>"org.blueberry.ui.help.helpSearch"</code>).
*/
static const QString HELP_HELP_SEARCH; // = "org.blueberry.ui.help.helpSearch";
/**
* Id for command "Dynamic Help" in category "Help"
* (value is <code>"org.blueberry.ui.help.dynamicHelp"</code>).
*/
static const QString HELP_DYNAMIC_HELP; // = "org.blueberry.ui.help.dynamicHelp";
/**
* Id for command "Welcome" in category "Help"
* (value is <code>"org.blueberry.ui.help.quickStartAction"</code>).
*/
static const QString HELP_WELCOME; // = "org.blueberry.ui.help.intro";
/**
* Id for command "About" in category "Help"
* (value is <code>"org.blueberry.ui.help.aboutAction"</code>).
*/
static const QString HELP_ABOUT; // = "org.blueberry.ui.help.aboutAction";
// Views Category:
/**
* Id for command "Show View" in category "Views"
* (value is <code>"org.blueberry.ui.views.showView"</code>).
*/
static const QString VIEWS_SHOW_VIEW; // = "org.blueberry.ui.views.showView";
/**
* Id for parameter "View Id" in command "Show View" in category "Views"
* (value is <code>"org.blueberry.ui.views.showView.viewId"</code>).
*/
static const QString VIEWS_SHOW_VIEW_PARM_ID; // = "org.blueberry.ui.views.showView.viewId";
/**
* Id for parameter "Secondary Id" in command "Show View" in category "Views"
* (value is <code>"org.blueberry.ui.views.showView.secondaryId"</code>).
*/
static const QString VIEWS_SHOW_VIEW_SECONDARY_ID; // = "org.blueberry.ui.views.showView.secondaryId";
/**
* Id for parameter "As Fastview" in command "Show View" in category "Views"
* (value is <code>"org.blueberry.ui.views.showView.makeFast"</code>).
* Optional.
*/
static const QString VIEWS_SHOW_VIEW_PARM_FASTVIEW; // = "org.blueberry.ui.views.showView.makeFast";
// Perspectives Category:
/**
* Id for command "Show Perspective" in category "Perspectives"
* (value is <code>"org.blueberry.ui.perspectives.showPerspective"</code>).
*/
static const QString PERSPECTIVES_SHOW_PERSPECTIVE; // = "org.blueberry.ui.perspectives.showPerspective";
/**
* Id for parameter "Perspective Id" in command "Show Perspective" in
* category "Perspectives" (value is
* <code>"org.blueberry.ui.perspectives.showPerspective.perspectiveId"</code>
* ).
*/
static const QString PERSPECTIVES_SHOW_PERSPECTIVE_PARM_ID; // = "org.blueberry.ui.perspectives.showPerspective.perspectiveId";
/**
* Id for parameter "In New Window" in command "Show Perspective" in
* category "Perspectives" (value is
* <code>"org.blueberry.ui.perspectives.showPerspective.newWindow"</code>).
* Optional.
*/
static const QString PERSPECTIVES_SHOW_PERSPECTIVE_PARM_NEWWINDOW; // = "org.blueberry.ui.perspectives.showPerspective.newWindow";
};
}
#endif // BERRYIWORKBENCHCOMMANDCONSTANTS_H
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchListener.h b/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchListener.h
index 38e53d6db1..8a4102f094 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchListener.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchListener.h
@@ -1,95 +1,90 @@
/*============================================================================
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 BERRYIWORKBENCHLISTENER_H_
#define BERRYIWORKBENCHLISTENER_H_
#include <org_blueberry_ui_qt_Export.h>
#include "berryMessage.h"
namespace berry
{
struct IWorkbench;
/**
* Interface for listening to workbench lifecycle events.
* <p>
* This interface may be implemented by clients.
* </p>
*
* @see IWorkbench#addWorkbenchListener
* @see IWorkbench#removeWorkbenchListener
*/
struct BERRY_UI_QT IWorkbenchListener
{
struct Events {
typedef Message2<IWorkbench*, bool, bool> PreShutdownEvent;
typedef Message1<IWorkbench*> PostShutdownEvent;
PreShutdownEvent preShutdown;
PostShutdownEvent postShutdown;
void AddListener(IWorkbenchListener* listener);
void RemoveListener(IWorkbenchListener* listener);
private:
typedef MessageDelegate2<IWorkbenchListener, IWorkbench*, bool, bool> Delegate2;
typedef MessageDelegate1<IWorkbenchListener, IWorkbench*> Delegate1;
};
virtual ~IWorkbenchListener();
/**
* Notifies that the workbench is about to shut down.
* <p>
* This method is called immediately prior to workbench shutdown before any
* windows have been closed.
* </p>
* <p>
* The listener may veto a regular shutdown by returning <code>false</code>,
* although this will be ignored if the workbench is being forced to shut down.
* </p>
* <p>
* Since other workbench listeners may veto the shutdown, the listener should
* not dispose resources or do any other work during this notification that would
* leave the workbench in an inconsistent state.
* </p>
*
- * @param workbench the workbench
- * @param forced <code>true</code> if the workbench is being forced to shutdown,
- * <code>false</code> for a regular close
* @return <code>true</code> to allow the workbench to proceed with shutdown,
* <code>false</code> to veto a non-forced shutdown
*/
virtual bool PreShutdown(IWorkbench* /*workbench*/, bool /*forced*/) { return true; }
/**
* Performs arbitrary finalization after the workbench stops running.
* <p>
* This method is called during workbench shutdown after all windows
* have been closed.
* </p>
- *
- * @param workbench the workbench
*/
virtual void PostShutdown(IWorkbench* /*workbench*/) {}
};
}
#endif /* BERRYIWORKBENCHLISTENER_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchPage.h b/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchPage.h
index 41c963df35..66b78cead5 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchPage.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchPage.h
@@ -1,867 +1,831 @@
/*============================================================================
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 BERRYIWORKBENCHPAGE_H_
#define BERRYIWORKBENCHPAGE_H_
#include <berryMacros.h>
#include "berryIEditorReference.h"
#include "berryIViewReference.h"
#include "berryIPerspectiveDescriptor.h"
#include "berryIEditorPart.h"
#include "berryIViewPart.h"
#include "berryIEditorInput.h"
#include "berryIPartService.h"
#include "berryISelectionService.h"
#include "berryIReusableEditor.h"
#include "berryIWorkbenchWindow.h"
/**
* \ingroup org_blueberry_ui_qt
*
*/
namespace berry {
struct IExtensionTracker;
/**
* A workbench page consists of an arrangement of views and editors intended to
* be presented together to the user in a single workbench window.
* <p>
* A page can contain 0 or more views and 0 or more editors. These views and
* editors are contained wholly within the page and are not shared with other
* pages. The layout and visible action set for the page is defined by a
* perspective.
* <p>
* The number of views and editors within a page is restricted to simplify part
* management for the user. In particular:
* <ul>
* <li>Unless a view explicitly allows for multiple instances in its plugin
* declaration there will be only one instance in a given workbench page.</li>
* <li>Only one editor can exist for each editor input within a page.
* <li>
* </ul>
* </p>
* <p>
* This interface is not intended to be implemented by clients.
* </p>
*
* @see IPerspectiveDescriptor
* @see IEditorPart
* @see IViewPart
*/
struct BERRY_UI_QT IWorkbenchPage : public IPartService, public ISelectionService, public Object
{
berryObjectMacro(berry::IWorkbenchPage);
~IWorkbenchPage() override;
/**
* An optional attribute within a workspace marker (<code>IMarker</code>)
* which identifies the preferred editor type to be opened when
* <code>openEditor</code> is called.
*
- * @see #openEditor(IEditorInput, String)
- * @see #openEditor(IEditorInput, String, boolean)
+ * @see #OpenEditor
* @deprecated in 3.0 since the notion of markers this is not generally
* applicable. Use the IDE-specific constant
* <code>IDE.EDITOR_ID_ATTR</code>.
*/
static const QString EDITOR_ID_ATTR; // = "org.blueberry.ui.editorID";
/**
* Change event id when the perspective is reset to its original state.
*
* @see IPerspectiveListener
*/
static const QString CHANGE_RESET; // = "reset";
/**
* Change event id when the perspective has completed a reset to its
* original state.
*
* @since 3.0
* @see IPerspectiveListener
*/
static const QString CHANGE_RESET_COMPLETE; // = "resetComplete";
/**
* Change event id when one or more views are shown in a perspective.
*
* @see IPerspectiveListener
*/
static const QString CHANGE_VIEW_SHOW; // = "viewShow";
/**
* Change event id when one or more views are hidden in a perspective.
*
* @see IPerspectiveListener
*/
static const QString CHANGE_VIEW_HIDE; // = "viewHide";
/**
* Change event id when one or more editors are opened in a perspective.
*
* @see IPerspectiveListener
*/
static const QString CHANGE_EDITOR_OPEN; // = "editorOpen";
/**
* Change event id when one or more editors are closed in a perspective.
*
* @see IPerspectiveListener
*/
static const QString CHANGE_EDITOR_CLOSE; // = "editorClose";
/**
* Change event id when the editor area is shown in a perspective.
*
* @see IPerspectiveListener
*/
static const QString CHANGE_EDITOR_AREA_SHOW; // = "editorAreaShow";
/**
* Change event id when the editor area is hidden in a perspective.
*
* @see IPerspectiveListener
*/
static const QString CHANGE_EDITOR_AREA_HIDE; // = "editorAreaHide";
/**
* Change event id when an action set is shown in a perspective.
*
* @see IPerspectiveListener
*/
static const QString CHANGE_ACTION_SET_SHOW; // = "actionSetShow";
/**
* Change event id when an action set is hidden in a perspective.
*
* @see IPerspectiveListener
*/
static const QString CHANGE_ACTION_SET_HIDE; // = "actionSetHide";
/**
* Show view mode that indicates the view should be made visible and
* activated. Use of this mode has the same effect as calling
- * {@link #showView(String)}.
+ * #ShowView .
*/
static const int VIEW_ACTIVATE; // = 1;
/**
* Show view mode that indicates the view should be made visible. If the
* view is opened in the container that contains the active view then this
* has the same effect as <code>VIEW_CREATE</code>.
*/
static const int VIEW_VISIBLE; // = 2;
/**
* Show view mode that indicates the view should be made created but not
* necessarily be made visible. It will only be made visible in the event
* that it is opened in its own container. In other words, only if it is not
* stacked with another view.
*/
static const int VIEW_CREATE; // = 3;
/**
* Editor opening match mode specifying that no matching against existing
* editors should be done.
*/
static const int MATCH_NONE; // = 0;
/**
* Editor opening match mode specifying that the editor input should be
* considered when matching against existing editors.
*/
static const int MATCH_INPUT; // = 1;
/**
* Editor opening match mode specifying that the editor id should be
* considered when matching against existing editors.
*/
static const int MATCH_ID; // = 2;
/**
* Activates the given part. The part will be brought to the front and given
* focus. The part must belong to this page.
*
* @param part
* the part to activate
*/
virtual void Activate(IWorkbenchPart::Pointer part) = 0;
- /**
- * Adds a property change listener.
- *
- * @param listener
- * the property change listener to add
- */
- //virtual void addPropertyChangeListener(IPropertyChangeListener listener);
-
/**
* Moves the given part forward in the Z order of this page so as to make it
* visible, without changing which part has focus. The part must belong to
* this page.
*
* @param part
* the part to bring forward
*/
virtual void BringToTop(IWorkbenchPart::Pointer part) = 0;
/**
* Closes this workbench page. If this page is the active one, this honor is
* passed along to one of the window's other pages if possible.
* <p>
* If the page has an open editor with unsaved content, the user will be
* given the opportunity to save it.
* </p>
*
* @return <code>true</code> if the page was successfully closed, and
* <code>false</code> if it is still open
*/
virtual bool Close() = 0;
/**
* Closes all of the editors belonging to this workbench page.
* <p>
* If the page has open editors with unsaved content and <code>save</code>
* is <code>true</code>, the user will be given the opportunity to save
* them.
* </p>
*
* @param save
*
* @return <code>true</code> if all editors were successfully closed, and
* <code>false</code> if at least one is still open
*/
virtual bool CloseAllEditors(bool save) = 0;
/**
* Closes the given <code>Array</code> of editor references. The editors
* must belong to this workbench page.
* <p>
* If any of the editors have unsaved content and <code>save</code> is
* <code>true</code>, the user will be given the opportunity to save
* them.
* </p>
*
* @param editorRefs
* the editors to close
* @param save
* <code>true</code> to save the editor contents if required
* (recommended), and <code>false</code> to discard any unsaved
* changes
* @return <code>true</code> if the editors were successfully closed, and
* <code>false</code> if the editors are still open
*/
virtual bool CloseEditors(const QList<IEditorReference::Pointer>& editorRefs, bool save) = 0;
/**
* Closes the given editor. The editor must belong to this workbench page.
* <p>
* If the editor has unsaved content and <code>save</code> is
* <code>true</code>, the user will be given the opportunity to save it.
* </p>
*
* @param editor
* the editor to close
* @param save
* <code>true</code> to save the editor contents if required
* (recommended), and <code>false</code> to discard any unsaved
* changes
* @return <code>true</code> if the editor was successfully closed, and
* <code>false</code> if the editor is still open
*/
virtual bool CloseEditor(IEditorPart::Pointer editor, bool save) = 0;
/**
* Returns the view in this page with the specified id. There is at most one
* view in the page with the specified id.
*
* @param viewId
* the id of the view extension to use
* @return the view, or <code>null</code> if none is found
*/
virtual IViewPart::Pointer FindView(const QString& viewId) = 0;
/**
* Returns the view reference with the specified id.
*
* @param viewId
* the id of the view extension to use
* @return the view reference, or <code>null</code> if none is found
*/
virtual IViewReference::Pointer FindViewReference(const QString& viewId) = 0;
/**
* Returns the view reference with the specified id and secondary id.
*
* @param viewId
* the id of the view extension to use
* @param secondaryId
* the secondary id to use, or <code>null</code> for no
* secondary id
* @return the view reference, or <code>null</code> if none is found
*/
virtual IViewReference::Pointer FindViewReference(const QString& viewId, const QString& secondaryId) = 0;
/**
* Returns the active editor open in this page.
* <p>
* This is the visible editor on the page, or, if there is more than one
* visible editor, this is the one most recently brought to top.
* </p>
*
* @return the active editor, or <code>null</code> if no editor is active
*/
virtual IEditorPart::Pointer GetActiveEditor() = 0;
/**
* Returns the editor with the specified input. Returns null if there is no
* opened editor with that input.
*
* @param input
* the editor input
* @return an editor with input equals to <code>input</code>
*/
virtual IEditorPart::Pointer FindEditor(IEditorInput::Pointer input) = 0;
/**
* Returns an array of editor references that match the given input and/or
* editor id, as specified by the given match flags. Returns an empty array
* if there are no matching editors, or if matchFlags is MATCH_NONE.
*
* @param input
* the editor input, or <code>null</code> if MATCH_INPUT is not
* specified in matchFlags
* @param editorId
* the editor id, or <code>null</code> if MATCH_ID is not
* specified in matchFlags
* @param matchFlags
* a bit mask consisting of zero or more of the MATCH_* constants
* OR-ed together
* @return the references for the matching editors
*
* @see #MATCH_NONE
* @see #MATCH_INPUT
* @see #MATCH_ID
*/
virtual QList<IEditorReference::Pointer> FindEditors(IEditorInput::Pointer input, const QString& editorId,
int matchFlags) = 0;
/**
* Returns a list of the editors open in this page.
* <p>
* Note that each page has its own editors; editors are never shared between
* pages.
* </p>
*
* @return a list of open editors
*
- * @deprecated use #getEditorReferences() instead
+ * @deprecated use #GetEditorReferences instead
*/
virtual QList<IEditorPart::Pointer> GetEditors() = 0;
/**
* Returns an array of references to open editors in this page.
* <p>
* Note that each page has its own editors; editors are never shared between
* pages.
* </p>
*
* @return a list of open editors
*/
virtual QList<IEditorReference::Pointer> GetEditorReferences() = 0;
/**
* Returns a list of dirty editors in this page.
*
* @return a list of dirty editors
*/
virtual QList<IEditorPart::Pointer> GetDirtyEditors() = 0;
/**
* Returns the input for this page.
*
* @return the input for this page, or <code>null</code> if none
*/
virtual IAdaptable* GetInput() = 0;
/**
* Returns the page label. This will be a unique identifier within the
* containing workbench window.
*
* @return the page label
*/
virtual QString GetLabel() = 0;
/**
* Returns the current perspective descriptor for this page, or
* <code>null</code> if there is no current perspective.
*
* @return the current perspective descriptor or <code>null</code>
- * @see #setPerspective
- * @see #savePerspective
+ * @see #SetPerspective
+ * @see #SavePerspective
*/
virtual IPerspectiveDescriptor::Pointer GetPerspective() = 0;
/**
* Returns a list of the reference to views visible on this page.
* <p>
* Note that each page has its own views; views are never shared between
* pages.
* </p>
*
* @return a list of references to visible views
*/
virtual QList<IViewReference::Pointer> GetViewReferences() = 0;
/**
* Returns a list of the views visible on this page.
* <p>
* Note that each page has its own views; views are never shared between
* pages.
* </p>
*
* @return a list of visible views
*
- * @deprecated use #getViewReferences() instead.
+ * @deprecated use #GetViewReferences() instead.
*/
virtual QList<IViewPart::Pointer> GetViews() = 0;
/**
* Returns the workbench window of this page.
*
* @return the workbench window
*/
virtual IWorkbenchWindow::Pointer GetWorkbenchWindow() const = 0;
/**
* Hides the given view. The view must belong to this page.
*
* @param view
* the view to hide
*/
virtual void HideView(IViewPart::Pointer view) = 0;
/**
* Hides the given view that belongs to the reference, if any.
*
* @param view
* the references whos view is to be hidden
*/
virtual void HideView(IViewReference::Pointer view) = 0;
/**
* Returns true if perspective with given id contains view with given id
*/
//virtual bool HasView(const QString& perspectiveId, const QString& viewId) = 0;
/**
* Returns whether the specified part is visible.
*
* @param part
* the part to test
* @return boolean <code>true</code> if part is visible
*/
virtual bool IsPartVisible(IWorkbenchPart::Pointer part) = 0;
- /**
- * Removes the perspective specified by desc.
- *
- * @param desc
- * the perspective that will be removed
- */
- //virtual void RemovePerspective(IPerspectiveDescriptor::Pointer desc) = 0;
-
/**
* Reuses the specified editor by setting its new input.
*
* @param editor
* the editor to be reused
* @param input
* the new input for the reusable editor
*/
virtual void ReuseEditor(IReusableEditor::Pointer editor, IEditorInput::Pointer input) = 0;
/**
* Opens an editor on the given input.
* <p>
* If this page already has an editor open on the target input that editor
* is activated; otherwise, a new editor is opened. Two editor inputs,
* input1 and input2, are considered the same if
*
* <pre>
* input1.equals(input2) == true
* </pre>.
* </p>
* <p>
* The editor type is determined by mapping <code>editorId</code> to an
* editor extension registered with the workbench. An editor id is passed
* rather than an editor object to prevent the accidental creation of more
* than one editor for the same input. It also guarantees a consistent
* lifecycle for editors, regardless of whether they are created by the user
* or restored from saved data.
* </p>
*
* @param input
* the editor input
* @param editorId
* the id of the editor extension to use
* @return an open and active editor, or <code>null</code> if an external
* editor was opened
* @exception PartInitException
* if the editor could not be created or initialized
*/
virtual IEditorPart::Pointer OpenEditor(IEditorInput::Pointer input, const QString& editorId) = 0;
/**
* Opens an editor on the given input.
* <p>
* If this page already has an editor open on the target input that editor
* is brought to the front; otherwise, a new editor is opened. Two editor
* inputs are considered the same if they equal. See
- * <code>Object.equals(Object)<code>
+ * <code>Object.equals(Object)</code>
* and <code>IEditorInput</code>. If <code>activate == true</code> the editor
* will be activated.
* </p><p>
* The editor type is determined by mapping <code>editorId</code> to an editor
* extension registered with the workbench. An editor id is passed rather than
* an editor object to prevent the accidental creation of more than one editor
* for the same input. It also guarantees a consistent lifecycle for editors,
* regardless of whether they are created by the user or restored from saved
* data.
* </p>
*
* @param input the editor input
* @param editorId the id of the editor extension to use
* @param activate if <code>true</code> the editor will be activated
* @return an open editor, or <code>null</code> if an external editor was opened
* @exception PartInitException if the editor could not be created or initialized
*/
virtual IEditorPart::Pointer OpenEditor(IEditorInput::Pointer input, const QString& editorId,
bool activate) = 0;
/**
* Opens an editor on the given input.
* <p>
* If this page already has an editor open that matches the given input
* and/or editor id (as specified by the matchFlags argument), that editor
* is brought to the front; otherwise, a new editor is opened. Two editor
* inputs are considered the same if they equal. See
- * <code>Object.equals(Object)<code>
+ * <code>Object.equals(Object)</code>
* and <code>IEditorInput</code>. If <code>activate == true</code> the editor
* will be activated.
* </p><p>
* The editor type is determined by mapping <code>editorId</code> to an editor
* extension registered with the workbench. An editor id is passed rather than
* an editor object to prevent the accidental creation of more than one editor
* for the same input. It also guarantees a consistent lifecycle for editors,
* regardless of whether they are created by the user or restored from saved
* data.
* </p>
*
* @param input the editor input
* @param editorId the id of the editor extension to use
* @param activate if <code>true</code> the editor will be activated
* @param matchFlags a bit mask consisting of zero or more of the MATCH_* constants OR-ed together
* @return an open editor, or <code>null</code> if an external editor was opened
* @exception PartInitException if the editor could not be created or initialized
*
* @see #MATCH_NONE
* @see #MATCH_INPUT
* @see #MATCH_ID
*/
virtual IEditorPart::Pointer OpenEditor(IEditorInput::Pointer input,
const QString& editorId, bool activate, int matchFlags) = 0;
- /**
- * Removes the property change listener.
- *
- * @param listener
- * the property change listener to remove
- */
- //virtual void removePropertyChangeListener(IPropertyChangeListener listener);
-
/**
* Changes the visible views, their layout, and the visible action sets
* within the page to match the current perspective descriptor. This is a
* rearrangement of components and not a replacement. The contents of the
* current perspective descriptor are unaffected.
* <p>
* For more information on perspective change see
* <code>setPerspective()</code>.
* </p>
*/
virtual void ResetPerspective() = 0;
/**
* Saves the contents of all dirty editors belonging to this workbench page.
* If there are no dirty editors this method returns without effect.
* <p>
* If <code>confirm</code> is <code>true</code> the user is prompted to
* confirm the command.
* </p>
* <p>
* Note that as of 3.2, this method also saves views that implement
* ISaveablePart and are dirty.
* </p>
*
* @param confirm <code>true</code> to ask the user before saving unsaved
* changes (recommended), and <code>false</code> to save
* unsaved changes without asking
* @return <code>true</code> if the command succeeded, and
* <code>false</code> if the operation was canceled by the user or
* an error occurred while saving
*/
virtual bool SaveAllEditors(bool confirm) = 0;
/**
* Saves the contents of the given editor if dirty. If not, this method
* returns without effect.
* <p>
* If <code>confirm</code> is <code>true</code> the user is prompted to
* confirm the command. Otherwise, the save happens without prompt.
* </p>
* <p>
* The editor must belong to this workbench page.
* </p>
*
* @param editor
* the editor to close
* @param confirm
* <code>true</code> to ask the user before saving unsaved
* changes (recommended), and <code>false</code> to save
* unsaved changes without asking
* @return <code>true</code> if the command succeeded, and
* <code>false</code> if the editor was not saved
*/
virtual bool SaveEditor(IEditorPart::Pointer editor, bool confirm) = 0;
/**
* Saves the visible views, their layout, and the visible action sets for
* this page to the current perspective descriptor. The contents of the
* current perspective descriptor are overwritten.
*/
virtual void SavePerspective() = 0;
/**
* Saves the visible views, their layout, and the visible action sets for
* this page to the given perspective descriptor. The contents of the given
* perspective descriptor are overwritten and it is made the current one for
* this page.
*
* @param perspective
* the perspective descriptor to save to
*/
virtual void SavePerspectiveAs(IPerspectiveDescriptor::Pointer perspective) = 0;
/**
* Changes the visible views, their layout, and the visible action sets
* within the page to match the given perspective descriptor. This is a
* rearrangement of components and not a replacement. The contents of the
* old perspective descriptor are unaffected.
* <p>
* When a perspective change occurs the old perspective is deactivated
* (hidden) and cached for future reference. Then the new perspective is
* activated (shown). The views within the page are shared by all existing
* perspectives to make it easy for the user to switch between one
* perspective and another quickly without loss of context.
* </p>
* <p>
* During activation the action sets are modified. If an action set is
* specified in the new perspective which is not visible in the old one it
* will be created. If an old action set is not specified in the new
* perspective it will be disposed.
* </p>
* <p>
* The visible views and their layout within the page also change. If a view
* is specified in the new perspective which is not visible in the old one a
* new instance of the view will be created. If an old view is not specified
* in the new perspective it will be hidden. This view may reappear if the
* user selects it from the View menu or if they switch to a perspective
* (which may be the old one) where the view is visible.
* </p>
* <p>
* The open editors are not modified by this method.
* </p>
*
* @param perspective
* the perspective descriptor
*/
virtual void SetPerspective(IPerspectiveDescriptor::Pointer perspective) = 0;
/**
* Shows the view identified by the given view id in this page and gives it
* focus. If there is a view identified by the given view id (and with no
* secondary id) already open in this page, it is given focus.
*
* @param viewId
* the id of the view extension to use
* @return the shown view
* @exception PartInitException
* if the view could not be initialized
*/
virtual IViewPart::Pointer ShowView(const QString& viewId) = 0;
/**
* Shows a view in this page with the given id and secondary id. The
* behaviour of this method varies based on the supplied mode. If
* <code>VIEW_ACTIVATE</code> is supplied, the view is focus. If
* <code>VIEW_VISIBLE</code> is supplied, then it is made visible but not
* given focus. Finally, if <code>VIEW_CREATE</code> is supplied the view
* is created and will only be made visible if it is not created in a folder
* that already contains visible views.
* <p>
* This allows multiple instances of a particular view to be created. They
* are disambiguated using the secondary id. If a secondary id is given, the
* view must allow multiple instances by having specified
* allowMultiple="true" in its extension.
* </p>
*
* @param viewId
* the id of the view extension to use
* @param secondaryId
* the secondary id to use, or <code>null</code> for no
* secondary id
* @param mode
* the activation mode. Must be {@link #VIEW_ACTIVATE},
* {@link #VIEW_VISIBLE} or {@link #VIEW_CREATE}
* @return a view
* @exception PartInitException
* if the view could not be initialized
* @exception IllegalArgumentException
* if the supplied mode is not valid
*/
virtual IViewPart::Pointer ShowView(const QString& viewId, const QString& secondaryId, int mode) = 0;
/**
* Returns <code>true</code> if the editor is pinned and should not be
* reused.
*
* @param editor
* the editor to test
* @return boolean whether the editor is pinned
*/
virtual bool IsEditorPinned(IEditorPart::Pointer editor) = 0;
/**
* Returns the perspective shortcuts associated with the current
* perspective. Returns an empty array if there is no current perspective.
*
* @see IPageLayout#addPerspectiveShortcut(String)
* @return an array of perspective identifiers
*/
virtual QList<QString> GetPerspectiveShortcuts() = 0;
/**
* Returns the show view shortcuts associated with the current perspective.
* Returns an empty array if there is no current perspective.
*
* @see IPageLayout#addShowViewShortcut(String)
* @return an array of view identifiers
*/
virtual QList<QString> GetShowViewShortcuts() = 0;
/**
* Returns the descriptors for the perspectives that are open in this page,
* in the order in which they were opened.
*
* @return the open perspective descriptors, in order of opening
*/
virtual QList<IPerspectiveDescriptor::Pointer> GetOpenPerspectives() = 0;
/**
* Returns the descriptors for the perspectives that are open in this page,
* in the order in which they were activated (oldest first).
*
* @return the open perspective descriptors, in order of activation
*/
virtual QList<IPerspectiveDescriptor::Pointer> GetSortedPerspectives() = 0;
- /**
- * Closes current perspective. If last perspective, then entire page
- * is closed.
- *
- * @param saveParts
- * whether the page's parts should be saved if closed
- * @param closePage
- * whether the page itself should be closed if last perspective
- */
- //virtual void CloseCurrentPerspective(bool saveParts, bool closePage) = 0;
-
/**
* Closes the specified perspective in this page. If the last perspective in
* this page is closed, then all editors are closed. Views that are not
* shown in other perspectives are closed as well. If <code>saveParts</code>
* is <code>true</code>, the user will be prompted to save any unsaved
* changes for parts that are being closed. The page itself is closed if
* <code>closePage</code> is <code>true</code>.
*
* @param desc
* the descriptor of the perspective to be closed
* @param saveParts
* whether the page's parts should be saved if closed
* @param closePage
* whether the page itself should be closed if last perspective
*/
virtual void ClosePerspective(IPerspectiveDescriptor::Pointer desc,
bool saveParts, bool closePage) = 0;
/**
* Closes all perspectives in this page. All editors are closed, prompting
* to save any unsaved changes if <code>saveEditors</code> is
* <code>true</code>. The page itself is closed if <code>closePage</code>
* is <code>true</code>.
*
* @param saveEditors
* whether the page's editors should be saved
* @param closePage
* whether the page itself should be closed
*/
virtual void CloseAllPerspectives(bool saveEditors, bool closePage) = 0;
/**
* Return the extension tracker for the workbench. This tracker may be used
* by plug-ins to ensure responsiveness to changes to the plug-in registry.
* <p>
* The tracker at this level of the workbench is typically used to track
* elements that only exist over the lifespan of a page. For example,
* <code>ViewPart</code> objects fall into this category.
* </p>
*
* @return the extension tracker
* @see IWorkbench#GetExtensionTracker()
* @see IWorkbenchWindow#GetExtensionTracker()
*/
virtual IExtensionTracker* GetExtensionTracker() const = 0;
/**
* Find the part reference for the given part. A convenience method to
* quickly go from part to part reference.
*
* @param part
* The part to search for. It can be <code>null</code>.
* @return The reference for the given part, or <code>null</code> if no
* reference can be found.
*/
virtual IWorkbenchPartReference::Pointer GetReference(IWorkbenchPart::Pointer part) = 0;
};
} // namespace berry
#endif /*BERRYIWORKBENCHPAGE_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchPartConstants.h b/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchPartConstants.h
index b868930a52..410b5c891c 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchPartConstants.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchPartConstants.h
@@ -1,112 +1,111 @@
/*============================================================================
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 BERRYIWORKBENCHPARTCONSTANTS_H_
#define BERRYIWORKBENCHPARTCONSTANTS_H_
#include <string>
#include <org_blueberry_ui_qt_Export.h>
namespace berry
{
/**
- * This interface describes the constants used for <link>IWorkbenchPart</link> properties.
+ * This interface describes the constants used for IWorkbenchPart properties.
* <p>
* <b>Note:</b>This interface should not be implemented or extended.
* </p>
*
* @since 3.0
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IWorkbenchPartConstants {
/**
* Used in a PropertyChangeEvent as the property string to signal
* that integer flags are used.
*/
static const QString INTEGER_PROPERTY;
/**
* The property id for <code>getTitle</code>, <code>getTitleImage</code>
* and <code>getTitleToolTip</code>.
*/
static const int PROP_TITLE;
/**
* The property id for <code>ISaveablePart.isDirty()</code>.
*/
static const int PROP_DIRTY;
/**
* The property id for <code>IEditorPart.getEditorInput()</code>.
*/
static const int PROP_INPUT;
/**
* The property id for <code>IWorkbenchPart2.getPartName</code>
*/
static const int PROP_PART_NAME;
/**
* The property id for <code>IWorkbenchPart2.getContentDescription()</code>
*/
static const int PROP_CONTENT_DESCRIPTION;
/**
* The property id for any method on the optional <code>ISizeProvider</code> interface
* @since 3.4
*/
static const int PROP_PREFERRED_SIZE;
/**
* Indicates that the underlying part was created
*/
static const int PROP_OPENED; // = 0x211;
/**
* Internal property ID: Indicates that the underlying part was destroyed
*/
static const int PROP_CLOSED; // = 0x212;
/**
* Internal property ID: Indicates that the result of IEditorReference.isPinned()
*/
static const int PROP_PINNED; // = 0x213;
/**
* Internal property ID: Indicates that the result of getVisible() has changed
*/
static const int PROP_VISIBLE; // = 0x214;
/**
* Internal property ID: Indicates that the result of isZoomed() has changed
*/
//static const int PROP_ZOOMED = 0x215;
/**
* Internal property ID: Indicates that the part has an active child and the
* active child has changed. (fired by PartStack)
*/
static const int PROP_ACTIVE_CHILD_CHANGED; // = 0x216;
/**
* Internal property ID: Indicates that changed in the min / max
* state has changed
*/
//static final int PROP_MAXIMIZED = 0x217;
};
}
#endif /*BERRYIWORKBENCHPARTCONSTANTS_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchPartSite.h b/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchPartSite.h
index df80570418..7d12598c5d 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchPartSite.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchPartSite.h
@@ -1,81 +1,80 @@
/*============================================================================
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 IWORKBENCHPARTSITE_H_
#define IWORKBENCHPARTSITE_H_
#include "berryIWorkbenchSite.h"
namespace berry {
struct IWorkbenchPart;
/**
* \ingroup org_blueberry_ui_qt
*
* The primary interface between a workbench part and the workbench.
* <p>
* This interface is not intended to be implemented or extended by clients.
* </p>
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IWorkbenchPartSite : public IWorkbenchSite
{
berryObjectMacro(berry::IWorkbenchPartSite, IWorkbenchSite);
~IWorkbenchPartSite() override;
/**
* Returns the part registry extension id for this workbench site's part.
* <p>
* The name comes from the <code>id</code> attribute in the configuration
* element.
* </p>
*
* @return the registry extension id
*/
virtual QString GetId() const = 0;
/**
* Returns the part associated with this site
*
* @return the part associated with this site
*/
virtual SmartPointer<IWorkbenchPart> GetPart() = 0;
/**
* Returns the unique identifier of the plug-in that defines this workbench
* site's part.
*
* @return the unique identifier of the declaring plug-in
*/
virtual QString GetPluginId() const = 0;
/**
* Returns the registered name for this workbench site's part.
* <p>
* The name comes from the <code>name</code> attribute in the configuration
* element.
* </p>
*
* @return the part name
*/
virtual QString GetRegisteredName() const = 0;
};
} // namespace berry
#endif /*IWORKBENCHPARTSITE_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchSite.h b/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchSite.h
index 352a53790f..25e6190047 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchSite.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchSite.h
@@ -1,105 +1,102 @@
/*============================================================================
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 BERRYIWORKBENCHSITE_H_
#define BERRYIWORKBENCHSITE_H_
#include <berryMacros.h>
#include <org_blueberry_ui_qt_Export.h>
#include "services/berryIServiceLocator.h"
namespace berry {
struct IWorkbenchPage;
struct ISelectionProvider;
struct IWorkbenchWindow;
class Shell;
/**
* \ingroup org_blueberry_ui_qt
*
* The common interface between the workbench and its parts, including pages
* within parts.
* <p>
- * The workbench site supports a few {@link IServiceLocator services} by
- * default. If these services are used to allocate resources, it is important to
+ * The workbench site supports a few services by default.
+ * If these services are used to allocate resources, it is important to
* remember to clean up those resources after you are done with them. Otherwise,
* the resources will exist until the workbench site is disposed. The supported
* services are:
* </p>
* <ul>
* <li>{@link ICommandService}</li>
* <li>{@link IContextService}</li>
* <li>{@link IHandlerService}</li>
- * <li>{@link IBindingService}. Resources allocated through this service will
- * not be cleaned up until the workbench shuts down.</li>
* </ul>
* <p>
* This interface is not intended to be implemented or extended by clients.
* </p>
*
* @see org.blueberry.ui.IWorkbenchPartSite
* @see org.blueberry.ui.part.IPageSite
* @since 2.0
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IWorkbenchSite : public IServiceLocator { // IAdaptable, IShellProvider {
berryObjectMacro(berry::IWorkbenchSite, IServiceLocator);
~IWorkbenchSite() override;
/**
* Returns the page containing this workbench site.
*
* @return the page containing this workbench site
*/
virtual SmartPointer<IWorkbenchPage> GetPage() = 0;
/**
* Returns the selection provider for this workbench site.
*
* @return the selection provider, or <code>null</code> if none
*/
virtual SmartPointer<ISelectionProvider> GetSelectionProvider() = 0;
/**
* Returns the shell for this workbench site. Not intended to be called from
* outside the UI thread. Clients should call IWorkbench.getDisplay() to
* gain access to the display rather than calling getShell().getDisplay().
*
* @return the shell for this workbench site
*/
virtual SmartPointer<Shell> GetShell() = 0;
/**
* Returns the workbench window containing this workbench site.
*
* @return the workbench window containing this workbench site
*/
virtual SmartPointer<IWorkbenchWindow> GetWorkbenchWindow() = 0;
/**
* Sets the selection provider for this workbench site.
*
* @param provider
* the selection provider, or <code>null</code> to clear it
*/
virtual void SetSelectionProvider(SmartPointer<ISelectionProvider> provider) = 0;
};
}
#endif /*BERRYIWORKBENCHSITE_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchWindow.h b/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchWindow.h
index 71e0e1c5f0..c14935f48c 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchWindow.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryIWorkbenchWindow.h
@@ -1,218 +1,196 @@
/*============================================================================
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 BERRYIWORKBENCHWINDOW_H_
#define BERRYIWORKBENCHWINDOW_H_
#include <berryMacros.h>
#include <berryIAdaptable.h>
#include <org_blueberry_ui_qt_Export.h>
#include "berryIPageService.h"
#include "berryShell.h"
#include "services/berryIServiceLocator.h"
namespace berry {
struct IPartService;
struct ISelectionService;
struct IWorkbenchPage;
struct IWorkbench;
/**
* \ingroup org_blueberry_ui_qt
*
* A workbench window is a top level window in a workbench. Visually, a
* workbench window has a menubar, a toolbar, a status bar, and a main area for
* displaying a single page consisting of a collection of views and editors.
* <p>
* Each workbench window has a collection of 0 or more pages; the active page is
* the one that is being presented to the end user; at most one page is active
* in a window at a time.
* </p>
* <p>
- * The workbench window supports a few {@link IServiceLocator services} by
- * default. If these services are used to allocate resources, it is important to
+ * The workbench window supports a few services by default.
+ * If these services are used to allocate resources, it is important to
* remember to clean up those resources after you are done with them. Otherwise,
* the resources will exist until the workbench window is closed. The supported
* services are:
* </p>
* <ul>
* <li>{@link ICommandService}</li>
* <li>{@link IContextService}</li>
- * <li>{@link IHandlerService}</li>
- * <li>{@link IBindingService}. Resources allocated through this service will
- * not be cleaned up until the workbench shuts down.</li>
* </ul>
* <p>
* This interface is not intended to be implemented by clients.
* </p>
*
* @see IWorkbenchPage
- * @noimplement This interface is not intended to be implemented by clients.
*
*/
struct BERRY_UI_QT IWorkbenchWindow : public IPageService, public IServiceLocator, public virtual Object
{
berryObjectMacro(berry::IWorkbenchWindow, IPageService, IServiceLocator, Object);
/**
* Closes this workbench window.
* <p>
* If the window has an open editor with unsaved content, the user will be
* given the opportunity to save it.
* </p>
*
* @return <code>true</code> if the window was successfully closed, and
* <code>false</code> if it is still open
*/
virtual bool Close() = 0;
/**
* Returns a list of the pages in this workbench window.
* <p>
* Note that each window has its own pages; pages are never shared between
* different windows.
* </p>
*
* @return a list of pages
*/
virtual QList<SmartPointer<IWorkbenchPage> > GetPages() const = 0;
/**
* Returns the currently active page for this workbench window.
*
* @return the active page, or <code>null</code> if none
*/
SmartPointer<IWorkbenchPage> GetActivePage() const override = 0;
/**
* Sets or clears the currently active page for this workbench window.
*
* @param page
* the new active page
*/
virtual void SetActivePage(SmartPointer<IWorkbenchPage> page) = 0;
/**
* Returns the part service which tracks part activation within this
* workbench window.
*
* @return the part service
*/
virtual IPartService* GetPartService() = 0;
/**
* Returns the selection service which tracks selection within this
* workbench window.
*
* @return the selection service
*/
virtual ISelectionService* GetSelectionService() const = 0;
/**
* Returns this workbench window's shell.
*
* @return the shell containing this window's controls or <code>null</code>
* if the shell has not been created yet or if the window has been closed
*/
virtual Shell::Pointer GetShell() const = 0;
/**
* Returns the workbench for this window.
*
* @return the workbench
*/
virtual IWorkbench* GetWorkbench() const = 0;
- /**
- * Returns whether the specified menu is an application menu as opposed to
- * a part menu. Application menus contain items which affect the workbench
- * or window. Part menus contain items which affect the active part (view
- * or editor).
- * <p>
- * This is typically used during "in place" editing. Application menus
- * should be preserved during menu merging. All other menus may be removed
- * from the window.
- * </p>
- *
- * @param menuId
- * the menu id
- * @return <code>true</code> if the specified menu is an application
- * menu, and <code>false</code> if it is not
- */
- //virtual bool IsApplicationMenu(const QString& menuId) = 0;
-
/**
* Creates and opens a new workbench page. The perspective of the new page
* is defined by the specified perspective ID. The new page become active.
* <p>
* <b>Note:</b> Since release 2.0, a window is limited to contain at most
* one page. If a page exist in the window when this method is used, then
* another window is created for the new page. Callers are strongly
* recommended to use the <code>IWorkbench.showPerspective</code> APIs to
* programmatically show a perspective.
* </p>
*
* @param perspectiveId
* the perspective id for the window's initial page
* @param input
* the page input, or <code>null</code> if there is no current
* input. This is used to seed the input for the new page's
* views.
* @return the new workbench page
* @exception WorkbenchException
* if a page could not be opened
*
* @see IWorkbench#showPerspective(String, IWorkbenchWindow, IAdaptable)
*/
virtual SmartPointer<IWorkbenchPage> OpenPage(const QString& perspectiveId, IAdaptable* input) = 0;
/**
* Creates and opens a new workbench page. The default perspective is used
* as a template for creating the page. The page becomes active.
* <p>
* <b>Note:</b> Since release 2.0, a window is limited to contain at most
* one page. If a page exist in the window when this method is used, then
* another window is created for the new page. Callers are strongly
* recommended to use the <code>IWorkbench.showPerspective</code> APIs to
* programmatically show a perspective.
* </p>
*
* @param input
* the page input, or <code>null</code> if there is no current
* input. This is used to seed the input for the new page's
* views.
* @return the new workbench window
* @exception WorkbenchException
* if a page could not be opened
*
* @see IWorkbench#showPerspective(String, IWorkbenchWindow, IAdaptable)
*/
virtual SmartPointer<IWorkbenchPage> OpenPage(IAdaptable* input) = 0;
//virtual void SetPerspectiveExcludeList(const QStringList& v) = 0;
//virtual QStringList GetPerspectiveExcludeList() const = 0;
//virtual void SetViewExcludeList(const QStringList& v) = 0;
//virtual QStringList GetViewExcludeList() const = 0;
~IWorkbenchWindow() override;
};
}
#endif /*BERRYIWORKBENCHWINDOW_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryMenuUtil.h b/Plugins/org.blueberry.ui.qt/src/berryMenuUtil.h
index cbd9dee819..12332c5974 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryMenuUtil.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryMenuUtil.h
@@ -1,134 +1,134 @@
/*============================================================================
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 BERRYMENUUTIL_H
#define BERRYMENUUTIL_H
#include <org_blueberry_ui_qt_Export.h>
namespace berry {
/**
* Provides utilities and constants for use with the new menus API.
*
- * @noextend This class is not intended to be subclassed by clients.
- * @noinstantiate This class is not intended to be instantiated by clients.
+ * @note This class is not intended to be subclassed by clients.
+ * @note This class is not intended to be instantiated by clients.
*/
class BERRY_UI_QT MenuUtil
{
public:
/**
*
* Workbench Menu. On supported platforms, this menu is shown when no
* workbench windows are active
*/
static QString WORKBENCH_MENU; // = "menu:org.blueberry.ui.workbench.menu";
/** Main Menu */
static QString MAIN_MENU; // = "menu:org.blueberry.ui.main.menu";
/** Main ToolBar */
static QString MAIN_TOOLBAR; // = "toolbar:org.blueberry.ui.main.toolbar";
/** -Any- Popup Menu */
static QString ANY_POPUP; // = "popup:org.blueberry.ui.popup.any";
/**
* Valid query attribute. Usage <b>menu:menu.id?before=contribution.id</b>.
*/
static QString QUERY_BEFORE; // = "before";
/**
* Valid query attribute. Usage <b>menu:menu.id?after=contribution.id</b>.
*/
static QString QUERY_AFTER; // = "after";
/**
* Valid query attribute. Usage <b>menu:menu.id?endof=contribution.id</b>.
* <p>
* This menu contribution will be placed at the end of the group defined by
* <b>contribution.id</b> (usually right in front of the next group marker
* or separator). Further contribution processing can still place other
* contributions after this one.
* </p>
*/
static QString QUERY_ENDOF; // = "endof";
/**
* Contributions of targets to this location will be included with the show
* in menu.
*/
static QString SHOW_IN_MENU_ID; // = "popup:org.blueberry.ui.menus.showInMenu";
/**
* @param id
* The menu's id
* @return The locator URI for a menu with the given id
*/
static QString MenuUri(const QString& id);
/**
* @param id
* The id of the menu
* @param location
* The relative location specifier
* @param refId
* The id of the menu element to be relative to
* @return A location URI formatted with the given parameters
*/
static QString MenuAddition(const QString& id, const QString& location,
const QString& refId);
/**
* Convenience method to create a standard menu addition The resulting
* string has the format: "menu:[id]?after=additions"
*
* @param id
* The id of the root element to contribute to
* @return The formatted string
*/
static QString MenuAddition(const QString& id);
/**
* @param id
* The toolbar's id
* @return The lcoation URI for a toolbar with the given id
*/
static QString ToolbarUri(const QString& id);
/**
* @param id
* The id of the toolbar
* @param location
* The relative location specifier
* @param refId
* The id of the toolbar element to be relative to
* @return A location URI formatted with the given parameters
*/
static QString ToolbarAddition(const QString& id, const QString& location,
const QString& refId);
/**
* Convenience method to create a standard toolbar addition The resulting
* string has the format: "toolbar:[id]?after=additions"
*
* @param id
* The id of the root element to contribute to
* @return The formatted string
*/
static QString ToolbarAddition(const QString& id);
};
}
#endif // BERRYMENUUTIL_H
diff --git a/Plugins/org.blueberry.ui.qt/src/berryPlatformUI.h b/Plugins/org.blueberry.ui.qt/src/berryPlatformUI.h
index ab60ec62dd..96ccfca9cd 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryPlatformUI.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryPlatformUI.h
@@ -1,170 +1,170 @@
/*============================================================================
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 BERRYPLATFORMUI_H_
#define BERRYPLATFORMUI_H_
#include <org_blueberry_ui_qt_Export.h>
#include "berryDisplay.h"
#include "application/berryWorkbenchAdvisor.h"
#include "testing/berryTestableObject.h"
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* The central class for access to the BlueBerry Platform User Interface.
* This class cannot be instantiated; all functionality is provided by
* static methods.
*
* Features provided:
* <ul>
* <li>creation of the workbench.</li>
* <li>access to the workbench.</li>
* </ul>
* <p>
*
* @see IWorkbench
*/
class BERRY_UI_QT PlatformUI
{
public:
static QString PLUGIN_ID();
static const QString XP_WORKBENCH;
static const QString XP_VIEWS;
/**
* Return code (value 0) indicating that the workbench terminated normally.
*
* @see CreateAndRunWorkbench()
* @since 3.0
*/
static const int RETURN_OK;
/**
* Return code (value 1) indicating that the workbench was terminated with
* a call to <code>IWorkbench.restart</code>.
*
* @see CreateAndRunWorkbench()
* @see IWorkbench#Restart
* @since 3.0
*/
static const int RETURN_RESTART;
/**
* Return code (value 2) indicating that the workbench failed to start.
*
* @see CreateAndRunWorkbench()
* @see IWorkbench#Restart
* @since 3.0
*/
static const int RETURN_UNSTARTABLE;
/**
* Return code (value 3) indicating that the workbench was terminated with
* a call to IWorkbenchConfigurer#emergencyClose.
*
* @see CreateAndRunWorkbench()
* @since 3.0
*/
static const int RETURN_EMERGENCY_CLOSE;
/**
* Creates the workbench and associates it with the given display and workbench
* advisor, and runs the workbench UI. This entails processing and dispatching
* events until the workbench is closed or restarted.
* <p>
* This method is intended to be called by the main class (the "application").
* Fails if the workbench UI has already been created.
* </p>
* <p>
- * Use {@link #createDisplay createDisplay} to create the display to pass in.
+ * Use \c createDisplay to create the display to pass in.
* </p>
* <p>
* Note that this method is intended to be called by the application
* (<code>org.blueberry.core.boot.IPlatformRunnable</code>). It must be
* called exactly once, and early on before anyone else asks
* <code>getWorkbench()</code> for the workbench.
* </p>
*
* @param display the display to be used for all UI interactions with the workbench
* @param advisor the application-specific advisor that configures and
* specializes the workbench
* @return return code {@link #RETURN_OK RETURN_OK} for normal exit;
* {@link #RETURN_RESTART RETURN_RESTART} if the workbench was terminated
- * with a call to {@link IWorkbench#restart IWorkbench.restart};
+ * with a call to \c IWorkbench.restart ;
* {@link #RETURN_UNSTARTABLE RETURN_UNSTARTABLE} if the workbench could
* not be started;
* {@link #RETURN_EMERGENCY_CLOSE RETURN_EMERGENCY_CLOSE} if the UI quit
* because of an emergency; other values reserved for future use
*/
static int CreateAndRunWorkbench(Display* display, WorkbenchAdvisor* advisor);
/**
* Creates the <code>Display</code> to be used by the workbench.
* It is the caller's responsibility to dispose the resulting <code>Display</code>,
* not the workbench's.
*
* @return the display
*/
static Display* CreateDisplay();
/**
* Returns the workbench. Fails if the workbench has not been created yet.
*
* @return the workbench. A raw pointer is returned because you normally
* should not hold a smart pointer to it (and possibly create reference
* cycles)
*/
static IWorkbench* GetWorkbench();
/**
* Returns whether CreateAndRunWorkbench() has
* been called to create the workbench, and the workbench has yet to
* terminate.
* <p>
* Note that this method may return <code>true</code> while the workbench
* is still being initialized, so it may not be safe to call workbench API
* methods even if this method returns true. See bug 49316 for details.
* </p>
*
* @return <code>true</code> if the workbench has been created and is
* still running, and <code>false</code> if the workbench has not
* yet been created or has completed
* @since 3.0
*/
static bool IsWorkbenchRunning();
/**
* Returns the testable object facade, for use by the test harness.
* <p>
* IMPORTANT: This method is only for use by the test harness.
* Applications and regular plug-ins should not call this method.
* </p>
*
* @return the testable object facade
* @since 3.0
*/
static TestableObject::Pointer GetTestableObject();
private:
PlatformUI();
};
}
#endif /*BERRYPLATFORMUI_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berrySaveable.h b/Plugins/org.blueberry.ui.qt/src/berrySaveable.h
index 3164437a5b..1657c74af5 100644
--- a/Plugins/org.blueberry.ui.qt/src/berrySaveable.h
+++ b/Plugins/org.blueberry.ui.qt/src/berrySaveable.h
@@ -1,282 +1,225 @@
/*============================================================================
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 BERRYSAVEABLE_H_
#define BERRYSAVEABLE_H_
#include <berryMacros.h>
#include <berryObject.h>
#include <berryIAdaptable.h>
#include <org_blueberry_ui_qt_Export.h>
namespace berry {
struct IWorkbenchPage;
struct IWorkbenchPart;
/**
* A <code>Saveable</code> represents a unit of saveability, e.g. an editable
* subset of the underlying domain model that may contain unsaved changes.
* Different workbench parts (editors and views) may present the same saveables
* in different ways. This interface allows the workbench to provide more
* appropriate handling of operations such as saving and closing workbench
* parts. For example, if two editors sharing the same saveable with unsaved
* changes are closed simultaneously, the user is only prompted to save the
* changes once for the shared saveable, rather than once for each editor.
* <p>
* Workbench parts that work in terms of saveables should implement
* {@link ISaveablesSource}.
* </p>
*
* @see ISaveablesSource
*/
class BERRY_UI_QT Saveable : /*public InternalSaveable*/ public virtual Object, public IAdaptable
{
public:
berryObjectMacro(Saveable);
-private:
- //Cursor waitCursor;
- //Cursor originalCursor;
-
-public:
-
typedef QSet<Saveable::Pointer> Set;
/**
* Attempts to show this saveable in the given page and returns
* <code>true</code> on success. The default implementation does nothing
* and returns <code>false</code>.
*
* @param page
* the workbench page in which to show this saveable
* @return <code>true</code> if this saveable is now visible to the user
* @since 3.3
*/
virtual bool Show(SmartPointer<IWorkbenchPage> page);
/**
* Returns the name of this saveable for display purposes.
*
* @return the model's name; never <code>null</code>.
*/
virtual QString GetName() const = 0;
/**
* Returns the tool tip text for this saveable. This text is used to
* differentiate between two inputs with the same name. For instance,
* MyClass.java in folder X and MyClass.java in folder Y. The format of the
* text varies between input types.
*
* @return the tool tip text; never <code>null</code>
*/
virtual QString GetToolTipText() const = 0;
/**
* Returns the image descriptor for this saveable.
*
* @return the image descriptor for this model; may be <code>null</code>
* if there is no image
*/
virtual QIcon GetImageDescriptor() const = 0;
/**
* Saves the contents of this saveable.
* <p>
* If the save is cancelled through user action, or for any other reason,
* the part should invoke <code>setCancelled</code> on the
* <code>IProgressMonitor</code> to inform the caller.
* </p>
* <p>
* This method is long-running; progress and cancellation are provided by
* the given progress monitor.
* </p>
*
* @param monitor
* the progress monitor
* @throws CoreException
* if the save fails; it is the caller's responsibility to
* report the failure to the user
*/
virtual void DoSave(/*IProgressMonitor monitor*/) = 0;
/**
* Returns whether the contents of this saveable have changed since the last
* save operation.
* <p>
* <b>Note:</b> this method is called frequently, for example by actions to
* determine their enabled status.
* </p>
*
* @return <code>true</code> if the contents have been modified and need
* saving, and <code>false</code> if they have not changed since
* the last save
*/
virtual bool IsDirty() const = 0;
/**
* Clients must implement equals and hashCode as defined in
- * {@link Object#equals(Object)} and {@link Object#hashCode()}. Two
+ * \c Object.equals(Object) and \c Object.hashCode() . Two
* saveables should be equal if their dirty state is shared, and saving one
* will save the other. If two saveables are equal, their names, tooltips,
* and images should be the same because only one of them will be shown when
* prompting the user to save.
*
* @param object
* @return true if this Saveable is equal to the given object
*/
bool operator<(const Object* object) const override = 0;
/**
* Clients must implement equals and hashCode as defined in
- * {@link Object#equals(Object)} and {@link Object#hashCode()}. Two
+ * \c Object.equals(Object) and \c Object.hashCode() . Two
* saveables should be equal if their dirty state is shared, and saving one
* will save the other. If two saveables are equal, their hash codes MUST be
* the same, and their names, tooltips, and images should be the same
* because only one of them will be shown when prompting the user to save.
* <p>
* IMPORTANT: Implementers should ensure that the hashCode returned is
* sufficiently unique so as not to collide with hashCodes returned by other
* implementations. It is suggested that the defining plug-in's ID be used
* as part of the returned hashCode, as in the following example:
* </p>
*
* <pre>
* int PRIME = 31;
* int hash = ...; // compute the &quot;normal&quot; hash code, e.g. based on some identifier unique within the defining plug-in
* return hash * PRIME + MY_PLUGIN_ID.hashCode();
* </pre>
*
* @return a hash code
*/
uint HashCode() const override = 0;
- /**
- * Saves this saveable, or prepares this saveable for a background save
- * operation. Returns null if this saveable has been successfully saved, or
- * a job runnable that needs to be run to complete the save in the
- * background. This method is called in the UI thread. If this saveable
- * supports saving in the background, it should do only minimal work.
- * However, since the job runnable returned by this method (if any) will not
- * run on the UI thread, this method should copy any state that can only be
- * accessed from the UI thread so that the job runnable will be able to
- * access it.
- * <p>
- * The supplied shell provider can be used from within this method and from
- * within the job runnable for the purpose of parenting dialogs. Care should
- * be taken not to open dialogs gratuitously and only if user input is
- * required for cases where the save cannot otherwise proceed - note that in
- * any given save operation, many saveable objects may be saved at the same
- * time. In particular, errors should be signaled by throwing an exception,
- * or if an error occurs while running the job runnable, an error status
- * should be returned.
- * </p>
- * <p>
- * If the foreground part of the save is cancelled through user action, or
- * for any other reason, the part should invoke <code>setCancelled</code>
- * on the <code>IProgressMonitor</code> to inform the caller. If the
- * background part of the save is cancelled, the job should return a
- * {@link IStatus#CANCEL} status.
- * </p>
- * <p>
- * This method is long-running; progress and cancellation are provided by
- * the given progress monitor.
- * </p>
- * <p>
- * The default implementation of this method calls
- * {@link #doSave(IProgressMonitor)} and returns <code>null</code>.
- * </p>
- *
- * @param monitor
- * a progress monitor used for reporting progress and
- * cancellation
- * @param shellProvider
- * an object that can provide a shell for parenting dialogs
- * @return <code>null</code> if this saveable has been saved successfully,
- * or a job runnable that needs to be run to complete the save in
- * the background.
- *
- * @since 3.3
- */
- //TODO Saveable IJobRunnable, IProgressMonitor, and IShellProvider
-// virtual /*IJobRunnable*/void DoSave(/*IProgressMonitor monitor,
-// IShellProvider shellProvider*/);
-
/**
* Disables the UI of the given parts containing this saveable if necessary.
* This method is not intended to be called by clients. A corresponding call
* to
* <p>
* Saveables that can be saved in the background should ensure that the user
* cannot make changes to their data from the UI, for example by disabling
* controls, unless they are prepared to handle this case. This method is
* called on the UI thread after a job runnable has been returned from
- * {@link #doSave(IProgressMonitor, IShellProvider)} and before
+ * <code>doSave(IProgressMonitor, IShellProvider)</code> and before
* spinning the event loop. The <code>closing</code> flag indicates that
* this saveable is currently being saved in response to closing a workbench
* part, in which case further changes to this saveable through the UI must
* be prevented.
* </p>
* <p>
* The default implementation calls setEnabled(false) on the given parts'
* composites.
* </p>
*
* @param parts
* the workbench parts containing this saveable
* @param closing
* a boolean flag indicating whether the save was triggered by a
* request to close a workbench part, and all of the given parts
* will be closed after the save operation finishes successfully.
*
* @since 3.3
*/
virtual void DisableUI(const QList<SmartPointer<IWorkbenchPart> >& parts, bool closing);
/**
* Enables the UI of the given parts containing this saveable after a
* background save operation has finished. This method is not intended to be
* called by clients.
* <p>
* The default implementation calls setEnabled(true) on the given parts'
* composites.
* </p>
*
* @param parts
* the workbench parts containing this saveable
*
* @since 3.3
*/
virtual void EnableUI(QList<SmartPointer<IWorkbenchPart> >& parts);
protected:
/**
- * This implementation of {@link IAdaptable#GetAdapterImpl(const std::type_info&)} returns
+ * This implementation of <code>IAdaptable.GetAdapterImpl(const std::type_info&)</code> returns
* <code>null</code>. Subclasses may override. This allows two unrelated
- * subclasses of Saveable to implement {@link #equals(Object)} and
- * {@link #hashCode()} based on an underlying implementation class that is
+ * subclasses of Saveable to implement \c equals(Object) and
+ * \c hashCode() based on an underlying implementation class that is
* shared by both Saveable subclasses.
*
* @since 3.3
*/
Object* GetAdapter(const QString& adapter) const override;
};
}
#endif /* BERRYSAVEABLE_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/berrySaveablesLifecycleEvent.h b/Plugins/org.blueberry.ui.qt/src/berrySaveablesLifecycleEvent.h
index 3522c11a52..a510d97a67 100644
--- a/Plugins/org.blueberry.ui.qt/src/berrySaveablesLifecycleEvent.h
+++ b/Plugins/org.blueberry.ui.qt/src/berrySaveablesLifecycleEvent.h
@@ -1,138 +1,138 @@
/*============================================================================
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 BERRYSAVEABLESLIFECYCLEEVENT_H_
#define BERRYSAVEABLESLIFECYCLEEVENT_H_
#include <berryMacros.h>
#include <org_blueberry_ui_qt_Export.h>
#include "berrySaveable.h"
#include <vector>
namespace berry {
/**
* Event object describing a change to a set of Saveable objects.
*/
class BERRY_UI_QT SaveablesLifecycleEvent : public Object
{
public:
berryObjectMacro(SaveablesLifecycleEvent);
/**
* Event type constant specifying that the given saveables have been opened.
*/
static const int POST_OPEN; // = 1;
/**
* Event type constant specifying that the given saveables are about to be
* closed. Listeners may veto the closing if isForce() is false.
*/
static const int PRE_CLOSE; // = 2;
/**
* Event type constant specifying that the given saveables have been closed.
*/
static const int POST_CLOSE; // = 3;
/**
* Event type constant specifying that the dirty state of the given saveables
* has changed.
*/
static const int DIRTY_CHANGED; // = 4;
private:
int eventType;
QList<Saveable::Pointer> saveables;
bool force;
bool veto;
Object::Pointer source;
public:
/**
* Creates a new SaveablesLifecycleEvent.
*
* @param source
* The source of the event. If an ISaveablesSource notifies
* about changes to the saveables returned by
- * {@link ISaveablesSource#getSaveables()}, the source must be
+ * \c ISaveablesSource#getSaveables() , the source must be
* the ISaveablesSource object.
* @param eventType
* the event type, currently one of POST_OPEN, PRE_CLOSE,
* POST_CLOSE, DIRTY_CHANGED
* @param saveables
* The affected saveables
* @param force
* true if the event type is PRE_CLOSE and this is a closed force
* that cannot be canceled.
*/
- SaveablesLifecycleEvent(Object::Pointer source_, int eventType_,
- const QList<Saveable::Pointer>& saveables_, bool force_);
+ SaveablesLifecycleEvent(Object::Pointer source, int eventType,
+ const QList<Saveable::Pointer>& saveables, bool force);
/**
* Returns the eventType, currently one of POST_OPEN, PRE_CLOSE, POST_CLOSE,
* DIRTY_CHANGED. Listeners should silently ignore unknown event types since
* new event types might be added in the future.
*
* @return the eventType
*/
int GetEventType();
Object::Pointer GetSource();
/**
* Returns the affected saveables.
*
* @return the saveables
*/
QList<Saveable::Pointer> GetSaveables();
/**
* Returns the veto. This value is ignored for POST_OPEN,POST_CLOSE, and
* DIRTY_CHANGED.
*
* @return Returns the veto.
*/
bool IsVeto();
/**
* @param veto
* The veto to set.
*/
void SetVeto(bool veto);
/**
* Sets the force flag. This value is ignored for POST_OPEN, POST_CLOSE, and
* DIRTY_CHANGED.
*
* @return Returns the force.
*/
bool IsForce();
};
}
#endif /* BERRYSAVEABLESLIFECYCLEEVENT_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/berryShell.h b/Plugins/org.blueberry.ui.qt/src/berryShell.h
index 4e2f8f64c6..949331a0ca 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryShell.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryShell.h
@@ -1,324 +1,324 @@
/*============================================================================
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 BERRYSHELL_H_
#define BERRYSHELL_H_
#include <berryMacros.h>
#include <org_blueberry_ui_qt_Export.h>
#include "berryIShellListener.h"
#include "guitk/berryGuiTkIControlListener.h"
namespace berry {
/**
* Instances of this class represent the "windows"
* which the desktop or "window manager" is managing.
* Instances that do not have a parent (that is, they
* are built using the constructor, which takes a
* <code>Display</code> as the argument) are described
* as <em>top level</em> shells. Instances that do have
* a parent are described as <em>secondary</em> or
* <em>dialog</em> shells.
* <p>
* Instances are always displayed in one of the maximized,
* minimized or normal states:
* <ul>
* <li>
* When an instance is marked as <em>maximized</em>, the
* window manager will typically resize it to fill the
* entire visible area of the display, and the instance
* is usually put in a state where it can not be resized
* (even if it has style <code>RESIZE</code>) until it is
* no longer maximized.
* </li><li>
* When an instance is in the <em>normal</em> state (neither
* maximized or minimized), its appearance is controlled by
* the style constants which were specified when it was created
* and the restrictions of the window manager (see below).
* </li><li>
* When an instance has been marked as <em>minimized</em>,
* its contents (client area) will usually not be visible,
* and depending on the window manager, it may be
* "iconified" (that is, replaced on the desktop by a small
* simplified representation of itself), relocated to a
* distinguished area of the screen, or hidden. Combinations
* of these changes are also possible.
* </li>
* </ul>
* </p><p>
* The <em>modality</em> of an instance may be specified using
* style bits. The modality style bits are used to determine
* whether input is blocked for other shells on the display.
* The <code>PRIMARY_MODAL</code> style allows an instance to block
* input to its parent. The <code>APPLICATION_MODAL</code> style
* allows an instance to block input to every other shell in the
* display. The <code>SYSTEM_MODAL</code> style allows an instance
* to block input to all shells, including shells belonging to
* different applications.
* </p><p>
* Note: The styles supported by this class are treated
* as <em>HINT</em>s, since the window manager for the
* desktop on which the instance is visible has ultimate
* control over the appearance and behavior of decorations
* and modality. For example, some window managers only
* support resizable windows and will always assume the
* RESIZE style, even if it is not set. In addition, if a
* modality style is not supported, it is "upgraded" to a
* more restrictive modality style that is supported. For
* example, if <code>PRIMARY_MODAL</code> is not supported,
* it would be upgraded to <code>APPLICATION_MODAL</code>.
* A modality style may also be "downgraded" to a less
* restrictive style. For example, most operating systems
* no longer support <code>SYSTEM_MODAL</code> because
* it can freeze up the desktop, so this is typically
* downgraded to <code>APPLICATION_MODAL</code>.
* <dl>
* <dt><b>Styles:</b></dt>
- * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE, ON_TOP, TOOL</dd>
- * <dd>APPLICATION_MODAL, MODELESS, PRIMARY_MODAL, SYSTEM_MODAL</dd>
+ * <dd>BORDER, CLOSE, MIN, MAX, NO_TRIM, RESIZE, TITLE, ON_TOP, TOOL,
+ * APPLICATION_MODAL, MODELESS, PRIMARY_MODAL, SYSTEM_MODAL</dd>
* <dt><b>Events:</b></dt>
* <dd>Activate, Close, Deactivate, Deiconify, Iconify</dd>
* </dl>
* Class <code>SWT</code> provides two "convenience constants"
* for the most commonly required style combinations:
* <dl>
* <dt><code>SHELL_TRIM</code></dt>
* <dd>
* the result of combining the constants which are required
* to produce a typical application top level shell: (that
* is, <code>CLOSE | TITLE | MIN | MAX | RESIZE</code>)
* </dd>
* <dt><code>DIALOG_TRIM</code></dt>
* <dd>
* the result of combining the constants which are required
* to produce a typical application dialog shell: (that
* is, <code>TITLE | CLOSE | BORDER</code>)
* </dd>
* </dl>
* </p>
* <p>
* Note: Only one of the styles APPLICATION_MODAL, MODELESS,
* PRIMARY_MODAL and SYSTEM_MODAL may be specified.
* </p><p>
* IMPORTANT: This class is not intended to be subclassed.
* </p>
*/
class BERRY_UI_QT Shell : public virtual Object
{
public:
berryObjectMacro(Shell);
Shell();
Object::Pointer GetData(const QString& id = "") const;
void SetData(const Object::Pointer& data, const QString& id = "");
IShellListener* GetExtraShellListener() const;
void SetExtraShellListener(IShellListener* l);
void SetBounds(int x, int y, int width, int height);
virtual void SetBounds(const QRect& bounds) = 0;
virtual QRect GetBounds() const = 0;
virtual void SetLocation(int x, int y) = 0;
virtual QPoint ComputeSize(int wHint, int hHint, bool changed) = 0;
/**
* Returns the receiver's text, which is the string that the
* window manager will typically display as the receiver's title.
* If the text has not previously been set, returns an empty string.
*
* @return the text
*/
virtual QString GetText() const = 0;
/**
* Sets the receiver's text, which is the string that the window manager
* will typically display as the receiver's title, to the argument.
*/
virtual void SetText(const QString& text) = 0;
virtual bool IsVisible() const = 0;
virtual void SetVisible(bool visible) = 0;
virtual QWidget* GetControl() const = 0;
virtual void SetImages(const QList<QIcon>& images) = 0;
/**
* Returns <code>true</code> if the receiver is currently
* maximized, and false otherwise.
* <p>
*
* @return the maximized state
*
* @see #SetMaximized
*/
virtual bool GetMaximized() const = 0;
/**
* Returns <code>true</code> if the receiver is currently
* minimized, and false otherwise.
* <p>
*
* @return the minimized state
*
* @see #SetMinimized
*/
virtual bool GetMinimized() const = 0;
/**
* Sets the minimized stated of the receiver.
* If the argument is <code>true</code> causes the receiver
* to switch to the minimized state, and if the argument is
* <code>false</code> and the receiver was previously minimized,
* causes the receiver to switch back to either the maximized
* or normal states.
* <p>
* Note: The result of intermixing calls to <code>setMaximized(true)</code>
* and <code>setMinimized(true)</code> will vary by platform. Typically,
* the behavior will match the platform user's expectations, but not
* always. This should be avoided if possible.
* </p>
*
* @param minimized the new maximized state
*
* @see #SetMaximized
*/
virtual void SetMinimized(bool minimized) = 0;
/**
* Sets the maximized state of the receiver.
* If the argument is <code>true</code> causes the receiver
* to switch to the maximized state, and if the argument is
* <code>false</code> and the receiver was previously maximized,
* causes the receiver to switch back to either the minimized
* or normal states.
* <p>
* Note: The result of intermixing calls to <code>setMaximized(true)</code>
* and <code>setMinimized(true)</code> will vary by platform. Typically,
* the behavior will match the platform user's expectations, but not
* always. This should be avoided if possible.
* </p>
*
* @param maximized the new maximized state
*
* @see #SetMinimized
*/
virtual void SetMaximized(bool maximized) = 0;
/**
* Adds the listener to the collection of listeners who will
* be notified when operations are performed on the receiver,
* by sending the listener one of the messages defined in the
* <code>IShellListener</code> interface.
*
* @param listener the listener which should be notified
*
* @see IShellListener
* @see #RemoveShellListener
*/
virtual void AddShellListener(IShellListener* listener) = 0;
/**
* Removes the listener from the collection of listeners who will
* be notified when operations are performed on the receiver.
*
* @param listener the listener which should no longer be notified
*
* @see IShellListener
* @see #AddShellListener
*/
virtual void RemoveShellListener(IShellListener* listener) = 0;
/**
* Moves the receiver to the top of the drawing order for
* the display on which it was created (so that all other
* shells on that display, which are not the receiver's
* children will be drawn behind it), marks it visible,
* sets the focus and asks the window manager to make the
* shell active.
*/
virtual void Open(bool block = false) = 0;
/**
* Requests that the window manager close the receiver in
* the same way it would be closed when the user clicks on
* the "close box" or performs some other platform specific
* key or mouse combination that indicates the window
* should be removed.
*/
virtual void Close() = 0;
/**
* If the receiver is visible, moves it to the top of the
* drawing order for the display on which it was created
* (so that all other shells on that display, which are not
* the receiver's children will be drawn behind it) and
* asks the window manager to make the shell active.
*/
virtual void SetActive() = 0;
/**
* Returns an array containing all shells which are
* descendants of the receiver.
* <p>
* @return the dialog shells
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
virtual QList<Shell::Pointer> GetShells() = 0;
/**
* Returns the receiver's style information.
* <p>
* Note that the value which is returned by this method <em>may
* not match</em> the value which was provided to the constructor
* when the receiver was created. This can occur when the underlying
* operating system does not support a particular combination of
* requested styles. For example, if the platform widget used to
* implement a particular SWT widget always has scroll bars, the
* result of calling this method would always have the
* <code>SWT.H_SCROLL</code> and <code>SWT.V_SCROLL</code> bits set.
* </p>
*
* @return the style bits
*
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
* <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
* </ul>
*/
virtual Qt::WindowFlags GetStyle () const = 0;
private:
QHash<QString, Object::Pointer> data;
IShellListener* extraShellListener;
};
}
Q_DECLARE_METATYPE(berry::Shell*)
#endif /* BERRYSHELL_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/berryShellEvent.h b/Plugins/org.blueberry.ui.qt/src/berryShellEvent.h
index c80f1a13a6..8be2079d34 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryShellEvent.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryShellEvent.h
@@ -1,64 +1,64 @@
/*============================================================================
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 BERRYSHELLEVENT_H_
#define BERRYSHELLEVENT_H_
#include <org_blueberry_ui_qt_Export.h>
#include <berryMacros.h>
#include <berryObject.h>
namespace berry {
class Shell;
/**
* Instances of this class are sent as a result of
* operations being performed on shells.
*
* @see ShellListener
* @see <a href="http://www.blueberry.org/swt/">Sample code and further information</a>
*/
class BERRY_UI_QT ShellEvent : public Object {
public:
berryObjectMacro(ShellEvent);
/**
* A flag indicating whether the operation should be allowed.
* Setting this field to <code>false</code> will cancel the operation.
*/
bool doit;
/**
* Constructs a new instance of this class based on the
* information in the given untyped event.
*
- * @param e the untyped event containing the information
+ * @param source the untyped event containing the information
*/
ShellEvent(SmartPointer<Shell> source) ;
SmartPointer<Shell> GetSource();
private:
SmartPointer<Shell> source;
};
}
#endif /* BERRYSHELLEVENT_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/berryViewPart.h b/Plugins/org.blueberry.ui.qt/src/berryViewPart.h
index 314f412614..659bccced9 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryViewPart.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryViewPart.h
@@ -1,100 +1,99 @@
/*============================================================================
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 BERRYVIEWPART_H_
#define BERRYVIEWPART_H_
#include "berryIViewPart.h"
#include "berryIViewSite.h"
#include "berryWorkbenchPart.h"
#include "berryIMemento.h"
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* Abstract base implementation of all workbench views.
* <p>
* This class should be subclassed by clients wishing to define new views.
* The name of the subclass should be given as the <code>"class"</code>
* attribute in a <code>view</code> extension contributed to the workbench's
* view extension point (named <code>"org.blueberry.ui.views"</code>).
* For example, the plug-in's XML markup might contain:
- * <pre>
- * &LT;extension point="org.blueberry.ui.views"&GT;
- * &LT;view id="com.example.myplugin.view"
+ * \code{.unparsed}
+ * <extension point="org.blueberry.ui.views">
+ * <view id="com.example.myplugin.view"
* name="My View"
* class="com.example.myplugin.MyView"
- * icon="images/eview.gif"
- * /&GT;
- * &LT;/extension&GT;
- * </pre>
+ * icon="images/eview.gif"/>
+ * </extension>
+ * \endcode
* where <code>com.example.myplugin.MyView</code> is the name of the
* <code>ViewPart</code> subclass.
* </p>
* <p>
* Subclasses must implement the following methods:
* <ul>
* <li><code>createPartControl</code> - to create the view's controls </li>
* <li><code>setFocus</code> - to accept focus</li>
* </ul>
* </p>
* <p>
* Subclasses may extend or reimplement the following methods as required:
* <ul>
* <li><code>setInitializationData</code> - extend to provide additional
* initialization when view extension is instantiated</li>
* <li><code>init(IWorkbenchPartSite)</code> - extend to provide additional
* initialization when view is assigned its site</li>
* <li><code>dispose</code> - extend to provide additional cleanup</li>
* <li><code>getAdapter</code> - reimplement to make their view adaptable</li>
* </ul>
* </p>
*/
class BERRY_UI_QT ViewPart : public WorkbenchPart, public IViewPart
{
Q_OBJECT
Q_INTERFACES(berry::IViewPart)
protected:
ViewPart();
/**
* Checks that the given site is valid for this type of part.
* The site for a view must be an <code>IViewSite</code>.
*
* @param site the site to check
* @since 3.1
*/
void CheckSite(IWorkbenchPartSite::Pointer site) override;
public:
berryObjectMacro(ViewPart, WorkbenchPart, IViewPart);
void Init(IViewSite::Pointer site, IMemento::Pointer memento = IMemento::Pointer(nullptr)) override;
void SaveState(IMemento::Pointer memento) override;
/*
* Method declared on IViewPart.
*/
IViewSite::Pointer GetViewSite() override;
};
} // namespace berry
#endif /*BERRYVIEWPART_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryWindow.h b/Plugins/org.blueberry.ui.qt/src/berryWindow.h
index 14e0f74636..beab88ed1a 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryWindow.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryWindow.h
@@ -1,727 +1,675 @@
/*============================================================================
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 BERRYWINDOW_H_
#define BERRYWINDOW_H_
#include <org_blueberry_ui_qt_Export.h>
#include "berryIShellProvider.h"
#include "berryIShellListener.h"
#include "internal/berryWindowManager.h"
#include "tweaklets/berryGuiWidgetsTweaklet.h"
#include <berryMacros.h>
#include <vector>
namespace berry
{
//struct IToolBarManager;
class MenuManager;
//class StatusLineManager;
/**
* A JFace window is an object that has no visual representation (no widgets)
* until it is told to open.
* <p>
* Creating a window involves the following steps:
* <ul>
* <li>creating an instance of a concrete subclass of <code>Window</code>
* </li>
* <li>creating the window's shell and widget tree by calling
* <code>create</code> (optional)</li>
* <li>assigning the window to a window manager using
* <code>WindowManager.add</code> (optional)</li>
* <li>opening the window by calling <code>open</code></li>
* </ul>
* Opening the window will create its shell and widget tree if they have not
* already been created. When the window is closed, the shell and widget tree
* are disposed of and are no longer referenced, and the window is automatically
* removed from its window manager. A window may be reopened.
* </p>
* <p>
* The JFace window framework (this package) consists of this class,
* <code>Window</code>, the abstract base of all windows, and one concrete
* window classes (<code>ApplicationWindow</code>) which may also be
* subclassed. Clients may define additional window subclasses as required.
* </p>
* <p>
* The <code>Window</code> class provides methods that subclasses may
* override to configure the window, including:
* <ul>
* <li><code>close</code>- extend to free other SWT resources</li>
* <li><code>configureShell</code>- extend or reimplement to set shell
* properties before window opens</li>
* <li><code>createContents</code>- extend or reimplement to create controls
* before window opens</li>
* <li><code>getInitialSize</code>- reimplement to give the initial size for
* the shell</li>
* <li><code>getInitialLocation</code>- reimplement to give the initial
* location for the shell</li>
* <li><code>getShellListener</code>- extend or reimplement to receive shell
* events</li>
* <li><code>handleFontChange</code>- reimplement to respond to font changes
* </li>
* <li><code>handleShellCloseEvent</code>- extend or reimplement to handle
* shell closings</li>
* </ul>
* </p>
*/
class BERRY_UI_QT Window: public IShellProvider
{
public:
berryObjectMacro(Window, IShellProvider);
/**
* Standard return code constant (value 0) indicating that the window was
* opened.
*
- * @see #open
+ * @see #Open
*/
static const int OK; // = 0;
/**
* Standard return code constant (value 1) indicating that the window was
* canceled.
*
- * @see #open
+ * @see #Open
*/
static const int CANCEL; // = 1;
/**
* An array of images to be used for the window. It is expected that the
* array will contain the same icon rendered at different resolutions.
*/
static QList<QIcon> defaultImages;
/**
* This interface defines a Exception Handler which can be set as a global
* handler and will be called if an exception happens in the event loop.
*/
struct IExceptionHandler: public Object
{
berryObjectMacro(IExceptionHandler);
/**
* Handle the exception.
*
* @param t
* The exception that occured.
*/
virtual void HandleException(const std::exception& t) = 0;
};
private:
struct WindowShellListener : public IShellListener
{
WindowShellListener(Window* wnd);
void ShellClosed(const ShellEvent::Pointer& event) override;
private:
Window* window;
};
QScopedPointer<IShellListener> windowShellListener;
/**
* Defines a default exception handler.
*/
struct DefaultExceptionHandler: public IExceptionHandler
{
/*
* (non-Javadoc)
*
* @see org.blueberry.jface.window.Window.IExceptionHandler#handleException(java.lang.Throwable)
*/
void HandleException(const std::exception& t) override;
};
/**
* Menu bar manager, or <code>null</code> if none (default).
*
- * @see #addMenuBar
+ * @see #AddMenuBar
*/
SmartPointer<MenuManager> menuBarManager;
- /**
- * Tool bar manager, or <code>null</code> if none (default).
- *
- * @see #addToolBar
- */
- //SmartPointer<IToolBarManager> toolBarManager;
-
- /**
- * Status line manager, or <code>null</code> if none (default).
- *
- * @see #addStatusLine
- */
- //SmartPointer<StatusLineManager> statusLineManager;
-
/**
* The exception handler for this application.
*/
static IExceptionHandler::Pointer exceptionHandler;
/**
* Object used to locate the default parent for modal shells
*/
struct DefaultModalParent: public IShellProvider
{
Shell::Pointer GetShell() const override;
};
friend struct DefaultModalParent;
static IShellProvider::Pointer defaultModalParent;
/**
* Object that returns the parent shell.
*/
IShellProvider::Pointer parentShell;
/**
* Shell style bits.
*
* @see #setShellStyle
*/
int shellStyle; // = Constants::SHELL_TRIM;
/**
* Window manager, or <code>null</code> if none.
*
* @see #setWindowManager
*/
WindowManager* windowManager;
/**
* Window shell, or <code>null</code> if none.
*/
Shell::Pointer shell;
/**
* Top level SWT control, or <code>null</code> if none
*/
QWidget* contents;
/**
* Window return code; initially <code>OK</code>.
*
* @see #setReturnCode
*/
int returnCode; // = OK;
/**
* <code>true</code> if the <code>open</code> method should not return
* until the window closes, and <code>false</code> if the
* <code>open</code> method should return immediately; initially
* <code>false</code> (non-blocking).
*
* @see #setBlockOnOpen
*/
bool block; // = false;
- // /**
- // * Internal class for informing this window when fonts change.
- // */
- // class FontChangeListener implements IPropertyChangeListener {
- // public void propertyChange(PropertyChangeEvent event) {
- // handleFontChange(event);
- // }
- // }
-
- // /**
- // * Internal font change listener.
- // */
- // private FontChangeListener fontChangeListener;
-
- /**
- * Internal fields to detect if shell size has been set
- */
- //bool resizeHasOccurred = false;
-
- //Listener resizeListener;
-
-
/**
* Returns the most specific modal child from the given list of Shells.
*
* @param toSearch shells to search for modal children
* @return the most specific modal child, or null if none
*
* @since 3.1
*/
static Shell::Pointer GetModalChild(
const QList<Shell::Pointer>& toSearch);
- /**
- * Runs the event loop for the given shell.
- *
- * @param loopShell
- * the shell
- */
- //void RunEventLoop();
-
protected:
/**
* Creates a window instance, whose shell will be created under the given
* parent shell. Note that the window will have no visual representation
* until it is told to open. By default, <code>open</code> does not block.
*
* @param parentShell
* the parent shell, or <code>null</code> to create a top-level
* shell. Try passing "(Shell)null" to this method instead of "null"
* if your compiler complains about an ambiguity error.
- * @see #setBlockOnOpen
- * @see #getDefaultOrientation()
+ * @see #SetBlockOnOpen
*/
Window(Shell::Pointer parentShell);
/**
* Creates a new window which will create its shell as a child of whatever
* the given shellProvider returns.
*
* @param shellProvider object that will return the current parent shell. Not null.
*
*/
Window(IShellProvider::Pointer shellProvider);
~Window() override;
/**
* Given the desired position of the window, this method returns an adjusted
* position such that the window is no larger than its monitor, and does not
* extend beyond the edge of the monitor. This is used for computing the
* initial window position, and subclasses can use this as a utility method
* if they want to limit the region in which the window may be moved.
*
* @param preferredSize
* the preferred position of the window
* @return a rectangle as close as possible to preferredSize that does not
* extend outside the monitor
*
*/
QRect GetConstrainedShellBounds(const QRect& preferredSize);
/**
* Initializes this windows variables
*/
virtual void Init();
/**
* Determines if the window should handle the close event or do nothing.
* <p>
* The default implementation of this framework method returns
* <code>true</code>, which will allow the
* <code>handleShellCloseEvent</code> method to be called. Subclasses may
* extend or reimplement.
* </p>
*
* @return whether the window should handle the close event.
*/
virtual bool CanHandleShellCloseEvent();
/**
* Configures the given shell in preparation for opening this window in it.
* <p>
* The default implementation of this framework method sets the shell's
* image and gives it a grid layout. Subclasses may extend or reimplement.
* </p>
*
* @param newShell
* the shell
*/
virtual void ConfigureShell(Shell::Pointer newShell);
- /**
- * Constrain the shell size to be no larger than the display bounds.
- *
- * @since 2.0
- */
- //void ConstrainShellSize();
-
/**
* Creates and returns this window's contents. Subclasses may attach any
* number of children to the parent. As a convenience, the return value of
* this method will be remembered and returned by subsequent calls to
* getContents(). Subclasses may modify the parent's layout if they overload
* getLayout() to return null.
*
* <p>
* It is common practise to create and return a single composite that
* contains the entire window contents.
* </p>
*
* <p>
* The default implementation of this framework method creates an instance
* of <code>Composite</code>. Subclasses may override.
* </p>
*
* @param parent
* the parent composite for the controls in this window. The type
* of layout used is determined by getLayout()
*
* @return the control that will be returned by subsequent calls to
* getContents()
*/
virtual QWidget* CreateContents(Shell::Pointer parent);
/**
* Creates and returns this window's shell.
* <p>
* The default implementation of this framework method creates a new shell
* and configures it using <code>configureShell</code>. Rather than
* override this method, subclasses should instead override
* <code>configureShell</code>.
* </p>
*
* @return the shell
*/
virtual Shell::Pointer CreateShell();
/**
* Returns the top level control for this window. The parent of this control
* is the shell.
*
* @return the top level control, or <code>null</code> if this window's
* control has not been created yet
*/
virtual QWidget* GetContents();
/**
* Returns the initial location to use for the shell. The default
* implementation centers the shell horizontally (1/2 of the difference to
* the left and 1/2 to the right) and vertically (1/3 above and 2/3 below)
* relative to the parent shell, or display bounds if there is no parent
* shell.
*
* @param initialSize
* the initial size of the shell, as returned by
* <code>getInitialSize</code>.
* @return the initial location of the shell
*/
virtual QPoint GetInitialLocation(const QPoint& initialSize);
/**
* Returns the initial size to use for the shell. The default implementation
* returns the preferred size of the shell, using
* <code>Shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true)</code>.
*
* @return the initial size of the shell
*/
virtual QPoint GetInitialSize();
/**
* Returns parent shell, under which this window's shell is created.
*
* @return the parent shell, or <code>null</code> if there is no parent
* shell
*/
Shell::Pointer GetParentShell();
/**
* Returns a shell listener. This shell listener gets registered with this
* window's shell.
* <p>
* The default implementation of this framework method returns a new
* listener that makes this window the active window for its window manager
* (if it has one) when the shell is activated, and calls the framework
* method <code>handleShellCloseEvent</code> when the shell is closed.
* Subclasses may extend or reimplement.
* </p>
*
* @return a shell listener
*/
virtual IShellListener* GetShellListener();
/**
* Returns the shell style bits.
* <p>
* The default value is <code>SWT.CLOSE|SWT.MIN|SWT.MAX|SWT.RESIZE</code>.
* Subclassers should call <code>setShellStyle</code> to change this
* value, rather than overriding this method.
* </p>
*
* @return the shell style bits
*/
int GetShellStyle();
/**
* Notifies that the window's close button was pressed, the close menu was
* selected, or the ESCAPE key pressed.
* <p>
* The default implementation of this framework method sets the window's
* return code to <code>CANCEL</code> and closes the window using
* <code>close</code>. Subclasses may extend or reimplement.
* </p>
*/
virtual void HandleShellCloseEvent();
/**
* Initializes the location and size of this window's SWT shell after it has
* been created.
* <p>
* This framework method is called by the <code>create</code> framework
* method. The default implementation calls <code>getInitialSize</code>
* and <code>getInitialLocation</code> and passes the results to
* <code>Shell.setBounds</code>. This is only done if the bounds of the
* shell have not already been modified. Subclasses may extend or
* reimplement.
* </p>
*/
virtual void InitializeBounds();
/**
* Changes the parent shell. This is only safe to use when the shell is not
* yet realized (i.e., created). Once the shell is created, it must be
* disposed (i.e., closed) before this method can be called.
*
* @param newParentShell
* The new parent shell; this value may be <code>null</code> if
* there is to be no parent.
* @since 3.1
*/
void SetParentShell(Shell::Pointer newParentShell);
/**
* Sets this window's return code. The return code is automatically returned
* by <code>open</code> if block on open is enabled. For non-blocking
* opens, the return code needs to be retrieved manually using
* <code>getReturnCode</code>.
*
* @param code
* the return code
*/
void SetReturnCode(int code);
/**
* Sets the shell style bits. This method has no effect after the shell is
* created.
* <p>
* The shell style bits are used by the framework method
* <code>createShell</code> when creating this window's shell.
* </p>
*
* @param newShellStyle
* the new shell style bits
*/
void SetShellStyle(int newShellStyle);
/**
* Configures this window to have a menu bar.
* Does nothing if it already has one.
* This method must be called before this window's shell is created.
*/
void AddMenuBar();
/**
* Returns a new menu manager for the window.
* <p>
* Subclasses may override this method to customize the menu manager.
* </p>
* @return a menu manager
*/
virtual SmartPointer<MenuManager> CreateMenuManager();
/**
* Creates the trim widgets around the content area.
*
* @param shell the shell
*/
virtual void CreateTrimWidgets(SmartPointer<Shell> shell);
public:
/**
* Closes this window, disposes its shell, and removes this window from its
* window manager (if it has one).
* <p>
* This framework method may be extended (<code>super.close</code> must
* be called).
* </p>
* <p>
* Note that in order to prevent recursive calls to this method
* it does not call <code>Shell#close()</code>. As a result <code>ShellListener</code>s
* will not receive a <code>shellClosed</code> event.
* </p>
*
* @return <code>true</code> if the window is (or was already) closed, and
* <code>false</code> if it is still open
*/
virtual bool Close();
/**
* Creates this window's widgetry in a new top-level shell.
* <p>
* The default implementation of this framework method creates this window's
* shell (by calling <code>createShell</code>), and its controls (by
* calling <code>createContents</code>), then initializes this window's
* shell bounds (by calling <code>initializeBounds</code>).
* </p>
*/
virtual void Create();
/**
* Returns the default image. This is the image that will be used for
* windows that have no shell image at the time they are opened. There is no
* default image unless one is installed via <code>setDefaultImage</code>.
*
* @return the default image, or <code>null</code> if none
- * @see #setDefaultImage
+ * @see #SetDefaultImage
*/
static QIcon GetDefaultImage();
/**
* Returns the array of default images to use for newly opened windows. It
* is expected that the array will contain the same icon rendered at
* different resolutions.
*
* @see org.blueberry.swt.widgets.Decorations#setImages(org.blueberry.swt.graphics.Image[])
*
* @return the array of images to be used when a new window is opened
- * @see #setDefaultImages
+ * @see #SetDefaultImages
* @since 3.0
*/
static QList<QIcon> GetDefaultImages();
/**
* Returns this window's return code. A window's return codes are
* window-specific, although two standard return codes are predefined:
* <code>OK</code> and <code>CANCEL</code>.
*
* @return the return code
*/
int GetReturnCode();
/**
* Returns this window's shell.
*
* @return this window's shell, or <code>null</code> if this window's
* shell has not been created yet
*/
Shell::Pointer GetShell() const override;
/**
* Returns the window manager of this window.
*
* @return the WindowManager, or <code>null</code> if none
*/
WindowManager* GetWindowManager();
/**
* Returns the menu bar manager for this window (if it has one).
*
* @return the menu bar manager, or <code>null</code> if
* this window does not have a menu bar
- * @see #addMenuBar()
+ * @see #AddMenuBar()
*/
MenuManager* GetMenuBarManager() const;
/**
* Opens this window, creating it first if it has not yet been created.
* <p>
* If this window has been configured to block on open (
* <code>setBlockOnOpen</code>), this method waits until the window is
* closed by the end user, and then it returns the window's return code;
* otherwise, this method returns immediately. A window's return codes are
* window-specific, although two standard return codes are predefined:
* <code>OK</code> and <code>CANCEL</code>.
* </p>
*
* @return the return code
*
- * @see #create()
+ * @see #Create()
*/
int Open();
/**
* Sets whether the <code>open</code> method should block until the window
* closes.
*
* @param shouldBlock
* <code>true</code> if the <code>open</code> method should
* not return until the window closes, and <code>false</code>
* if the <code>open</code> method should return immediately
*/
void SetBlockOnOpen(bool shouldBlock);
/**
* Sets the default image. This is the image that will be used for windows
* that have no shell image at the time they are opened. There is no default
* image unless one is installed via this method.
*
* @param image
* the default image, or <code>null</code> if none
*/
static void SetDefaultImage(const QIcon& image);
/**
* Sets the array of default images to use for newly opened windows. It is
* expected that the array will contain the same icon rendered at different
* resolutions.
*
* @see org.blueberry.swt.widgets.Decorations#setImages(org.blueberry.swt.graphics.Image[])
*
* @param images
* the array of images to be used when this window is opened
* @since 3.0
*/
static void SetDefaultImages(const QList<QIcon>& images);
/**
* Sets the window manager of this window.
* <p>
* Note that this method is used by <code>WindowManager</code> to maintain
* a backpointer. Clients must not call the method directly.
* </p>
*
* @param manager
* the window manager, or <code>null</code> if none
*/
void SetWindowManager(WindowManager* manager);
/**
* Sets the exception handler for this application.
* <p>
* Note that the handler may only be set once. Subsequent calls to this method will be
* ignored.
* <p>
*
* @param handler
* the exception handler for the application.
*/
static void SetExceptionHandler(IExceptionHandler::Pointer handler);
/**
* Sets the default parent for modal Windows. This will be used to locate
* the parent for any modal Window constructed with a null parent.
*
* @param provider shell provider that will be used to locate the parent shell
* whenever a Window is created with a null parent
* @since 3.1
*/
static void SetDefaultModalParent(IShellProvider::Pointer provider);
};
}
#endif /* BERRYWINDOW_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/berryWorkbenchPart.h b/Plugins/org.blueberry.ui.qt/src/berryWorkbenchPart.h
index 5941478e43..170ebf39d9 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryWorkbenchPart.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryWorkbenchPart.h
@@ -1,252 +1,251 @@
/*============================================================================
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 __BERRY_WORKBENCH_PART_H__
#define __BERRY_WORKBENCH_PART_H__
#include "berryIWorkbenchPart.h"
#include "berryIWorkbenchPartSite.h"
#include <berryIConfigurationElement.h>
#include <berryIExecutableExtension.h>
#include <QIcon>
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* Abstract base implementation of all workbench parts.
* <p>
* This class is not intended to be subclassed by clients outside this
* package; clients should instead subclass <code>ViewPart</code> or
* <code>EditorPart</code>.
* </p>
*
* @see org.blueberry.ui.part.ViewPart
* @see org.blueberry.ui.part.EditorPart
- * @noextend This class is not intended to be subclassed by clients.
*/
class BERRY_UI_QT WorkbenchPart : public QObject,
public virtual IWorkbenchPart, public IExecutableExtension
{
Q_OBJECT
Q_INTERFACES(berry::IExecutableExtension);
public:
berryObjectMacro(WorkbenchPart, QObject, IWorkbenchPart, IExecutableExtension);
~WorkbenchPart() override;
private:
QString m_Title;
QIcon m_TitleImage;
QString m_ToolTip;
IConfigurationElement::Pointer m_ConfigElement;
IWorkbenchPartSite::Pointer m_PartSite;
QString m_PartName;
QString m_ContentDescription;
QHash<QString, QString> partProperties;
IPropertyChangeListener::Events partChangeEvents;
void InternalSetContentDescription(const QString& description);
void InternalSetPartName(const QString& partName);
protected:
WorkbenchPart();
/**
* Returns the configuration element for this part. The configuration element
* comes from the plug-in registry entry for the extension defining this part.
*
* @return the configuration element for this part
*/
IConfigurationElement::Pointer GetConfigurationElement() const
{
return m_ConfigElement;
}
/**
* Returns the default title image.
*
* @return the default image
*/
// protected Image getDefaultImage() {
// return PlatformUI.getWorkbench().getSharedImages().getImage(
// ISharedImages.IMG_DEF_VIEW);
// }
/**
* Sets the part site.
* <p>
* Subclasses must invoke this method from <code>IEditorPart.init</code>
* and <code>IViewPart.init</code>.
*
* @param site the workbench part site
*/
void SetSite(IWorkbenchPartSite::Pointer site);
/**
* Checks that the given site is valid for this type of part.
* The default implementation does nothing.
*
* @param site the site to check
*/
virtual void CheckSite(IWorkbenchPartSite::Pointer site);
/**
* Sets or clears the title image of this part.
*
* @param titleImage the title image, or <code>null</code> to clear
*/
virtual void SetTitleImage(const QIcon& titleImage);
/**
* Sets or clears the title tool tip text of this part. Clients should
* call this method instead of overriding <code>getTitleToolTip</code>
*
* @param toolTip the new tool tip text, or <code>null</code> to clear
*/
virtual void SetTitleToolTip(const QString& toolTip);
/**
* Sets the name of this part. The name will be shown in the tab area for
* the part. Clients should call this method instead of overriding getPartName.
* Setting this to the empty string will cause a default part name to be used.
*
* @param partName the part name, as it should be displayed in tabs.
*/
virtual void SetPartName(const QString& partName);
/**
* Sets the content description for this part. The content description is typically
* a short string describing the current contents of the part. Setting this to the
* empty string will cause a default content description to be used. Clients should
* call this method instead of overriding getContentDescription(). For views, the
* content description is shown (by default) in a line near the top of the view. For
* editors, the content description is shown beside the part name when showing a
* list of editors. If the editor is open on a file, this typically contains the path
* to the input file, without the filename or trailing slash.
*
* @param description the content description
*/
virtual void SetContentDescription(const QString& description);
void FirePropertyChanged(const QString& key,
const QString& oldValue, const QString& newValue);
void FirePropertyChange(int propertyId);
public:
/* (non-Javadoc)
* Method declared on IWorkbenchPart.
*/
void AddPropertyListener(IPropertyChangeListener* l) override;
void RemovePropertyListener(IPropertyChangeListener* l) override;
void SetPartProperty(const QString& key, const QString& value) override;
/* (non-Javadoc)
* @see org.blueberry.ui.IWorkbenchPart3#getPartProperty(java.lang.String)
*/
QString GetPartProperty(const QString& key) const override;
/* (non-Javadoc)
* @see org.blueberry.ui.IWorkbenchPart3#getPartProperties()
*/
const QHash<QString, QString>& GetPartProperties() const override;
/**
* {@inheritDoc}
* The <code>WorkbenchPart</code> implementation of this
* <code>IExecutableExtension</code> records the configuration element in
* and internal state variable (accessible via <code>getConfigElement</code>).
* It also loads the title image, if one is specified in the configuration element.
* Subclasses may extend.
*
* Should not be called by clients. It is called by the core plugin when creating
* this executable extension.
*/
void SetInitializationData(const IConfigurationElement::Pointer& cfig,
const QString& propertyName, const Object::Pointer& data) override;
/*
* Creates the controls for this workbench part.
* <p>
* Subclasses must implement this method. For a detailed description of the
* requirements see <code>IWorkbenchPart</code>
* </p>
*
* @param parent the parent control
* @see IWorkbenchPart
*/
void CreatePartControl(QWidget* parent) override = 0;
/* (non-Javadoc)
* Asks this part to take focus within the workbench.
* <p>
* Subclasses must implement this method. For a detailed description of the
* requirements see <code>IWorkbenchPart</code>
* </p>
*
* @see IWorkbenchPart
*/
void SetFocus() override = 0;
/*
* Method declared on IWorkbenchPart.
*/
IWorkbenchPartSite::Pointer GetSite() const override;
/**
* {@inheritDoc}
* <p>
* It is considered bad practise to overload or extend this method.
* Parts should call setPartName to change their part name.
* </p>
*/
QString GetPartName() const override;
/**
* {@inheritDoc}
* <p>
* It is considered bad practise to overload or extend this method.
* Parts should call setContentDescription to change their content description.
* </p>
*/
QString GetContentDescription() const override;
/* (non-Javadoc)
* Method declared on IWorkbenchPart.
*/
QIcon GetTitleImage() const override;
/* (non-Javadoc)
* Gets the title tool tip text of this part.
*
* @return the tool tip text
*/
QString GetTitleToolTip() const override;
};
} // namespace berry
#endif // __BERRY_WORKBENCH_PART_H__
diff --git a/Plugins/org.blueberry.ui.qt/src/berryWorkbenchPlugin.h b/Plugins/org.blueberry.ui.qt/src/berryWorkbenchPlugin.h
index 5d7fa0ef3b..978e3ff5be 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryWorkbenchPlugin.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryWorkbenchPlugin.h
@@ -1,470 +1,470 @@
/*============================================================================
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 BERRYWORKBENCHPLUGIN_H_
#define BERRYWORKBENCHPLUGIN_H_
#include <Poco/Path.h>
#include <berryIExtensionPoint.h>
#include <berryIExtensionRegistry.h>
#include <berryPlatform.h>
#include <berryCoreException.h>
#include "berryAbstractUICTKPlugin.h"
#include "berryPlatformUI.h"
#include "presentations/berryIPresentationFactory.h"
#include "internal/berryViewRegistry.h"
#include "internal/berryEditorRegistry.h"
#include "internal/berryPerspectiveRegistry.h"
#include "internal/intro/berryIntroRegistry.h"
namespace berry {
class QtStyleManager;
/**
* \ingroup org_blueberry_ui_internal
*
* This class represents the TOP of the workbench UI world
* A plugin class is effectively an application wrapper
* for a plugin & its classes. This class should be thought
* of as the workbench UI's application class.
*
* This class is responsible for tracking various registries
* font, preference, graphics, dialog store.
*
* This class is explicitly referenced by the
* workbench plugin's "plugin.xml" and places it
* into the UI start extension point of the main
* overall application harness
*
* When is this class started?
* When the Application
* calls createExecutableExtension to create an executable
* instance of our workbench class.
*/
class BERRY_UI_QT WorkbenchPlugin : public AbstractUICTKPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org_blueberry_ui_qt")
Q_INTERFACES(ctkPluginActivator)
private:
//static const QString UI_BUNDLE_ACTIVATOR = "org.blueberry.ui.internal.UIPlugin"; //$NON-NLS-1$
// Default instance of the receiver
static WorkbenchPlugin* inst;
// The presentation factory
IPresentationFactory* presentationFactory;
// Manager that maps resources to descriptors of editors to use
EditorRegistry* editorRegistry;
// The context within which this plugin was started.
ctkPluginContext* bundleContext;
// Other data.
//WorkbenchPreferenceManager preferenceManager;
ViewRegistry* viewRegistry;
PerspectiveRegistry* perspRegistry;
IntroRegistry* introRegistry;
//SharedImages sharedImages;
QScopedPointer<QtStyleManager> styleManager;
public:
/**
* Global workbench ui plugin flag. Only workbench implementation is allowed to use this flag
* All other plugins, examples, or test cases must *not* use this flag.
*/
static bool DEBUG;
/**
* The character used to separate preference page category ids
*/
static char PREFERENCE_PAGE_CATEGORY_SEPARATOR;
/**
* Create an instance of the WorkbenchPlugin. The workbench plugin is
* effectively the "application" for the workbench UI. The entire UI
* operates as a good plugin citizen.
*/
WorkbenchPlugin();
~WorkbenchPlugin() override;
/*
* Creates an extension. If the extension plugin has not
* been loaded a busy cursor will be activated during the duration of
* the load.
*
* @param element the config element defining the extension
* @param classAttribute the name of the attribute carrying the class
* @return the extension object
* @throws CoreException if the extension cannot be created
*/
// template<class E>
// static E* CreateExtension(IConfigurationElement::ConstPointer element,
// const QString& classAttribute) {
// try {
// // If plugin has been loaded create extension.
// // Otherwise, show busy cursor then create extension.
// if (BundleUtility.isActivated(element.getDeclaringExtension()
// .getNamespace())) {
// return element.createExecutableExtension(classAttribute);
// }
// final Object[] ret = new Object[1];
// final CoreException[] exc = new CoreException[1];
// BusyIndicator.showWhile(null, new Runnable() {
// public void run() {
// try {
// ret[0] = element
// .createExecutableExtension(classAttribute);
// } catch (CoreException e) {
// exc[0] = e;
// }
// }
// });
// if (exc[0] != null) {
// throw exc[0];
// }
// return ret[0];
//
// } catch (CoreException core) {
// throw core;
// } catch (Exception e) {
// throw new CoreException(new Status(IStatus.ERR, PI_WORKBENCH,
// IStatus.ERR, WorkbenchMessages.WorkbenchPlugin_extension,e));
// }
// }
/**
* Answers whether the provided element either has an attribute with the
* given name or a child element with the given name with an attribute
* called class.
*
* @param element
* the element to test
* @param extensionName
* the name of the extension to test for
* @return whether or not the extension is declared
*/
static bool HasExecutableExtension(const IConfigurationElement::Pointer& element,
const QString& extensionName);
/**
* Checks to see if the provided element has the syntax for an executable
* extension with a given name that resides in a bundle that is already
* active. Determining the bundle happens in one of two ways:<br/>
* <ul>
* <li>The element has an attribute with the specified name or element text
* in the form <code>bundle.id/class.name[:optional attributes]</code></li>
* <li>The element has a child element with the specified name that has a
* <code>plugin</code> attribute</li>
* </ul>
*
* @param element
* the element to test
* @param extensionName
* the name of the extension to test for
* @return whether or not the bundle expressed by the above criteria is
* active. If the bundle cannot be determined then the state of the
* bundle that declared the element is returned.
*/
static bool IsBundleLoadedForExecutableExtension(
const IConfigurationElement::Pointer& element, const QString& extensionName);
/**
* Returns the bundle that contains the class referenced by an executable
* extension. Determining the bundle happens in one of two ways:<br/>
* <ul>
* <li>The element has an attribute with the specified name or element text
* in the form <code>bundle.id/class.name[:optional attributes]</code></li>
* <li>The element has a child element with the specified name that has a
* <code>plugin</code> attribute</li>
* </ul>
*
* @param element
* the element to test
* @param extensionName
* the name of the extension to test for
* @return the bundle referenced by the extension. If that bundle cannot be
* determined the bundle that declared the element is returned. Note
* that this may be <code>null</code>.
*/
static QSharedPointer<ctkPlugin> GetBundleForExecutableExtension(
const IConfigurationElement::Pointer& element, const QString& extensionName);
/**
* Return the default instance of the receiver. This represents the runtime plugin.
* @return WorkbenchPlugin
* @see AbstractUICTKPlugin for the typical implementation pattern for plugin classes.
*/
static WorkbenchPlugin* GetDefault();
std::size_t GetBundleCount();
/**
* Answer the manager that maps resource types to a the
* description of the editor to use
* @return IEditorRegistry the editor registry used
* by this plug-in.
*/
IEditorRegistry* GetEditorRegistry();
/**
- * Answer the element factory for an id, or <code>null</code. if not found.
+ * Answer the element factory for an id, or <code>null</code>. if not found.
* @param targetID
* @return IElementFactory
*/
IElementFactory* GetElementFactory(const QString& targetID) const;
/**
* Returns the presentation factory with the given id, or <code>null</code> if not found.
* @param targetID The id of the presentation factory to use.
* @return IPresentationFactory or <code>null</code>
* if not factory matches that id.
*/
IPresentationFactory* GetPresentationFactory();
private:
/**
* Looks up the configuration element with the given id on the given extension point
* and instantiates the class specified by the class attributes.
*
* @param extensionPointId the extension point id (simple id)
* @param elementName the name of the configuration element, or <code>null</code>
* to match any element
* @param targetID the target id
* @return the instantiated extension object, or <code>null</code> if not found
*/
template<class C>
C* CreateExtension(const QString& extensionPointId, const QString& elementName,
const QString& targetID)
{
IExtensionPoint::Pointer extensionPoint = Platform::GetExtensionRegistry()
->GetExtensionPoint(PlatformUI::PLUGIN_ID() + "." + extensionPointId);
if (extensionPoint == 0)
{
WorkbenchPlugin::Log("Unable to find extension. Extension point: " +
extensionPointId + " not found");
return nullptr;
}
// Loop through the config elements.
IConfigurationElement::Pointer targetElement(nullptr);
QList<IConfigurationElement::Pointer> elements(
Platform::GetExtensionRegistry()->GetConfigurationElementsFor(PlatformUI::PLUGIN_ID() + "." + extensionPointId));
for (int j = 0; j < elements.size(); j++)
{
if (elementName == "" || elementName == elements[j]->GetName())
{
QString strID = elements[j]->GetAttribute("id");
if (targetID == strID)
{
targetElement = elements[j];
break;
}
}
}
if (targetElement.IsNull())
{
// log it since we cannot safely display a dialog.
WorkbenchPlugin::Log("Unable to find extension: " + targetID
+ " in extension point: " + extensionPointId);
return nullptr;
}
// Create the extension.
try
{
return targetElement->CreateExecutableExtension<C>("class");
}
catch (const CoreException& /*e*/)
{
// log it since we cannot safely display a dialog.
WorkbenchPlugin::Log("Unable to create extension: " + targetID
+ " in extension point: " + extensionPointId);
}
return nullptr;
}
public:
/**
* Return the perspective registry.
* @return IPerspectiveRegistry. The registry for the receiver.
*/
IPerspectiveRegistry* GetPerspectiveRegistry();
/**
* Returns the introduction registry.
*
* @return the introduction registry.
*/
IIntroRegistry* GetIntroRegistry();
/*
* Get the preference manager.
* @return PreferenceManager the preference manager for
* the receiver.
*/
//PreferenceManager getPreferenceManager();
/**
* Answer the view registry.
* @return IViewRegistry the view registry for the
* receiver.
*/
IViewRegistry* GetViewRegistry();
/**
* Logs the given message to the platform log.
*
* If you have an exception in hand, call log(String, Throwable) instead.
*
* If you have a status object in hand call log(String, IStatus) instead.
*
* This convenience method is for internal use by the Workbench only and
* must not be called outside the Workbench.
*
* @param message
* A high level UI message describing when the problem happened.
*/
static void Log(const QString &message);
/**
* Log the throwable.
- * @param t
+ * @param exc
*/
static void Log(const ctkException& exc);
/**
* Logs the given message and throwable to the platform log.
*
* If you have a status object in hand call log(String, IStatus) instead.
*
* This convenience method is for internal use by the Workbench only and
* must not be called outside the Workbench.
*
* @param message
* A high level UI message describing when the problem happened.
* @param t
* The throwable from where the problem actually occurred.
*/
static void Log(const QString &message, const ctkException& t);
/**
* Logs the given throwable to the platform log, indicating the class and
* method from where it is being logged (this is not necessarily where it
* occurred).
*
* This convenience method is for internal use by the Workbench only and
* must not be called outside the Workbench.
*
* @param clazz
* The calling class.
* @param methodName
* The calling method name.
* @param t
* The throwable from where the problem actually occurred.
*/
static void Log(const QString &clazz, const QString &methodName, const ctkException& t);
/**
* Logs the given message and status to the platform log.
*
* This convenience method is for internal use by the Workbench only and
* must not be called outside the Workbench.
*
* @param message
* A high level UI message describing when the problem happened.
* May be <code>null</code>.
* @param status
* The status describing the problem. Must not be null.
*/
static void Log(const QString& message, const SmartPointer<IStatus>& status);
/**
* Log the status to the default log.
* @param status
*/
static void Log(const SmartPointer<IStatus>& status);
/*
* (non-Javadoc)
* @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
*/
void start(ctkPluginContext* context) override;
/*
* Return an array of all bundles contained in this workbench.
*
* @return an array of bundles in the workbench or an empty array if none
*/
//const QList<IBundle::Pointer> GetBundles();
/**
* Returns the bundle context associated with the workbench plug-in.
*
* @return the bundle context
*/
ctkPluginContext* GetPluginContext();
/* (non-Javadoc)
* @see org.blueberry.ui.plugin.AbstractUICTKPlugin#stop(org.osgi.framework.BundleContext)
*/
void stop(ctkPluginContext* context) override;
/**
* FOR INTERNAL WORKBENCH USE ONLY.
*
* Returns the path to a location in the file system that can be used
* to persist/restore state between workbench invocations.
* If the location did not exist prior to this call it will be created.
* Returns <code>null</code> if no such location is available.
*
* @return path to a location in the file system where this plug-in can
* persist data between sessions, or <code>null</code> if no such
* location is available.
*/
QString GetDataLocation() const;
};
}
#endif /*BERRYWORKBENCHPLUGIN_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/berryWorkbenchPreferenceConstants.h b/Plugins/org.blueberry.ui.qt/src/berryWorkbenchPreferenceConstants.h
index 83cd62c843..6c2df07203 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryWorkbenchPreferenceConstants.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryWorkbenchPreferenceConstants.h
@@ -1,565 +1,554 @@
/*============================================================================
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 BERRYWORKBENCHPREFERENCECONSTANTS_H_
#define BERRYWORKBENCHPREFERENCECONSTANTS_H_
#include <org_blueberry_ui_qt_Export.h>
namespace berry
{
/**
* Preference ids exposed by the BlueBerry Platform User Interface. These
* preference settings can be obtained from the UI plug-in's preference store.
- * <p>
- * <b>Note:</b>This interface should not be implemented or extended.
- * </p>
*
* @see PlatformUI#PLUGIN_ID
- * @noextend This class is not intended to be extended by clients.
+ * @note This class is not intended to be extended by clients.
*/
struct BERRY_UI_QT WorkbenchPreferenceConstants
{
/**
* A named preference for whether to show an editor when its input file is
* selected in the Navigator (and vice versa).
* <p>
* Value is of type <code>boolean</code>.
* </p>
*/
static const QString LINK_NAVIGATOR_TO_EDITOR; // "LINK_NAVIGATOR_TO_EDITOR";
/**
* A named preference for how a new perspective is opened.
* <p>
* Value is of type <code>QString</code>. The possible values are defined
* by <code>OPEN_PERSPECTIVE_WINDOW, OPEN_PERSPECTIVE_PAGE and
* OPEN_PERSPECTIVE_REPLACE</code>.
* </p>
*
* @see #OPEN_PERSPECTIVE_WINDOW
* @see #OPEN_PERSPECTIVE_PAGE
* @see #OPEN_PERSPECTIVE_REPLACE
* @see #NO_NEW_PERSPECTIVE
*/
static const QString OPEN_NEW_PERSPECTIVE; // "OPEN_NEW_PERSPECTIVE";
/**
* A preference value indicating that an action should open a new
* perspective in a new window.
- *
- * @see #PROJECT_OPEN_NEW_PERSPECTIVE
*/
static const QString OPEN_PERSPECTIVE_WINDOW; // "OPEN_PERSPECTIVE_WINDOW";
/**
* A preference value indicating that an action should open a new
* perspective in a new page.
- *
- * @see #PROJECT_OPEN_NEW_PERSPECTIVE
* @deprecated Opening a Perspective in a new page is no longer supported
* functionality as of 2.0.
*/
static const QString OPEN_PERSPECTIVE_PAGE; // "OPEN_PERSPECTIVE_PAGE";
/**
* A preference value indicating that an action should open a new
* perspective by replacing the current perspective.
- *
- * @see #PROJECT_OPEN_NEW_PERSPECTIVE
*/
static const QString OPEN_PERSPECTIVE_REPLACE; // "OPEN_PERSPECTIVE_REPLACE";
/**
* A preference value indicating that an action should not open a new
* perspective.
- *
- * @see #PROJECT_OPEN_NEW_PERSPECTIVE
*/
static const QString NO_NEW_PERSPECTIVE; // "NO_NEW_PERSPECTIVE";
/**
* A named preference indicating the default workbench perspective.
*/
static const QString DEFAULT_PERSPECTIVE_ID; // "defaultPerspectiveId";
/**
* A named preference indicating the presentation factory to use for the
* workbench look and feel.
*
* @since 3.0
*/
static const QString PRESENTATION_FACTORY_ID; // "presentationFactoryId";
/**
* A named preference indicating where the perspective bar should be docked.
* The default value (when this preference is not set) is
* <code>TOP_RIGHT</code>.
* <p>
* This preference may be one of the following values: {@link #TOP_RIGHT},
* {@link #TOP_LEFT}, or {@link #LEFT}.
* </p>
*
* @since 3.0
*/
static const QString DOCK_PERSPECTIVE_BAR; // "DOCK_PERSPECTIVE_BAR";
/**
* A preference indication the initial size of the perspective bar. The default value is 160.
* This preference only works when <code>configurer.setShowPerspectiveBar(true)</code> is set in
* WorkbenchWindowAdvisor#preWindowOpen()
*
* This preference only uses integer values
* bug 84603: [RCP] [PerspectiveBar] New API or pref to set default perspective bar size
*
* @since 3.5
*/
static const QString PERSPECTIVE_BAR_SIZE; // "PERSPECTIVE_BAR_SIZE";
/**
* A named preference indicating where the fast view bar should be docked in
* a fresh workspace. This preference is meaningless after a workspace has
* been setup, since the fast view bar state is then persisted in the
* workbench. This preference is intended for applications that want the
* initial docking location to be somewhere specific. The default value
* (when this preference is not set) is the bottom.
*
* @see #LEFT
* @see #BOTTOM
* @see #RIGHT
* @since 3.0
*/
static const QString INITIAL_FAST_VIEW_BAR_LOCATION; // "initialFastViewBarLocation";
/**
* A named preference indicating the preferred layout direction of parts
* inside a sash container. The default value (when this preference is not set)
* is <code>LEFT</code>.
* <p>
* This preference may be one of the following values: {@link #LEFT} or {@link #RIGHT}.
* </p>
*/
static const QString PREFERRED_SASH_LAYOUT; // "preferredSashLayout";
/**
* Constant to be used when referring to the top right of the workbench
* window.
*
* @see #DOCK_PERSPECTIVE_BAR
* @since 3.0
*/
static const QString TOP_RIGHT; // "topRight";
/**
* Constant to be used when referring to the top left of the workbench
* window.
*
* @see #DOCK_PERSPECTIVE_BAR
* @since 3.0
*/
static const QString TOP_LEFT; // "topLeft";
/**
* Constant to be used when referring to the left side of the workbench
* window.
*
* @see #DOCK_PERSPECTIVE_BAR
* @see #INITIAL_FAST_VIEW_BAR_LOCATION
* @since 3.0
*/
static const QString LEFT; // "left";
/**
* Constant to be used when referring to the bottom of the workbench window.
*
* @see #INITIAL_FAST_VIEW_BAR_LOCATION
* @since 3.0
*/
static const QString BOTTOM; // "bottom";
/**
* Constant to be used when referring to the right side of the workbench
* window.
*
* @see #INITIAL_FAST_VIEW_BAR_LOCATION
* @since 3.0
*/
static const QString RIGHT; // "right";
/**
* A named preference indicating whether the workbench should show the
* introduction component (if available) on startup.
*
* <p>
* The default value for this preference is: <code>true</code> (show
* intro)
* </p>
*
* @see org.eclipse.ui.application.WorkbenchWindowAdvisor#openIntro()
* @since 3.0
*/
static const QString SHOW_INTRO; // "showIntro";
/**
* A named preference for whether the workbench should show traditional
* style tabs in editors and views.
*
* Boolean-valued: <code>true</code> if editors and views should use a
* traditional style of tab and <code>false</code> if editors should show
* new style tab (3.0 style)
* <p>
* The default value for this preference is: <code>true</code>
* </p>
*
* @since 3.0
*/
static const QString SHOW_TRADITIONAL_STYLE_TABS; // "SHOW_TRADITIONAL_STYLE_TABS";
/**
* A named preference for whether the workbench should show text on the
* perspective bar.
*
* Boolean-valued: <code>true</code>, if editors should show text on the
* perspective bar, <code>false</code> otherwise.
* <p>
* The default value for this preference is: <code>true</code> (show text
* on the perspective bar)
* </p>
*
* @since 3.0
*/
static const QString SHOW_TEXT_ON_PERSPECTIVE_BAR; // "SHOW_TEXT_ON_PERSPECTIVE_BAR";
/**
* A named preference for whether the workbench should show the "open
* perspective" button on the perspective bar.
*
* Boolean-valued: <code>true</code>, if editors should show "open
* perspective" button on the perspective bar, <code>false</code>
* otherwise.
* <p>
* The default value for this preference is: <code>true</code> (show "open
* perspective" button on the perspective bar)
* </p>
*
* @since 3.4
*/
static const QString SHOW_OPEN_ON_PERSPECTIVE_BAR; // "SHOW_OPEN_ON_PERSPECTIVE_BAR";
/**
* A named preference for whether the workbench should show the "Other..."
* menu item in the perspective menu.
*
* Boolean-valued: <code>true</code>, if editors should show text on the
* "Other..." menu item, <code>false</code> otherwise.
* <p>
* The default value for this preference is: <code>true</code> (show the
* "Other..." menu item in the perspective menu)
* </p>
*
* @since 3.4
*/
static const QString SHOW_OTHER_IN_PERSPECTIVE_MENU; // "SHOW_OTHER_IN_PERSPECTIVE_MENU";
/**
* A named preference for the text of the Help Contents action.
*
* String-valued. If not specified, <code>"&Help Contents"</code> is used.
* <p>
* The default value for this preference is: <code>null</code>
* </p>
*
* @since 3.0
*/
static const QString HELP_CONTENTS_ACTION_TEXT; // "helpContentsActionText";
/**
* A named preference for the text of the Help Search action.
*
* String-valued. If not specified, <code>"S&earch"</code> is used.
* <p>
* The default value for this preference is: <code>null</code>
* </p>
*
* @since 3.1
*/
static const QString HELP_SEARCH_ACTION_TEXT; // "helpSearchActionText";
/**
* A named preference for the text of the Dynamic Help action.
*
* String-valued. If not specified, <code>"&Dynamic Help"</code> is used.
* <p>
* The default value for this preference is: <code>null</code>
* </p>
*
* @since 3.1
*/
static const QString DYNAMIC_HELP_ACTION_TEXT; // "dynamicHelpActionText";
/**
* A named preference for enabling animations when a layout transition
* occurs
* <p>
* The default value for this preference is: <code>true</code> (show
* animations when a transition occurs)
* </p>
*
* @since 3.1
*/
static const QString ENABLE_ANIMATIONS; // "ENABLE_ANIMATIONS";
/**
* A named preference that view implementors can used to determine whether
* or not they should utilize colored labels.
*
* <p>
* The default value for this preference is: <code>true</code> (show
* colored labels)
* </p>
*
* @since 3.4
*/
static const QString USE_COLORED_LABELS; // "USE_COLORED_LABELS";
/**
* <p>
* Workbench preference id for the key configuration identifier to be
* treated as the default.
* </p>
* <p>
* The default value for this preference is
* <code>"org.eclipse.ui.defaultAcceleratorConfiguration"</code>.
* <p>
*
* @since 3.1
*/
static const QString KEY_CONFIGURATION_ID; // "KEY_CONFIGURATION_ID";
/**
* <p>
* Workbench preference identifier for the minimum width of editor tabs. By
* default, Eclipse does not define this value and allows SWT to determine
* this constant. We use <code>-1</code> internally to signify "use
* default".
* </p>
* <p>
* The default value for this preference is <code>-1</code>.
* </p>
*
* @since 3.1
*/
static const QString EDITOR_MINIMUM_CHARACTERS; // "EDITOR_MINIMUM_CHARACTERS";
/**
* <p>
* Workbench preference identifier for the minimum width of view tabs.
* </p>
* <p>
* The default value for this preference is <code>1</code>.
* </p>
*
* @since 3.2
*/
static const QString VIEW_MINIMUM_CHARACTERS; // "VIEW_MINIMUM_CHARACTERS";
/**
* Stores whether or not system jobs are being shown.
*
* @since 3.1
*/
static const QString SHOW_SYSTEM_JOBS; // "SHOW_SYSTEM_JOBS";
/**
* Workbench preference for the current theme.
*
* @since 3.1
*/
static const QString CURRENT_THEME_ID; // "CURRENT_THEME_ID";
/**
* A preference value indicating whether editors should be closed before
* saving the workbench state when exiting. The default is
* <code>false</code>.
*
* @since 3.1
*/
static const QString CLOSE_EDITORS_ON_EXIT; // "CLOSE_EDITORS_ON_EXIT";
/**
* Stores whether or not to show progress while starting the workbench. The
* default is <code>false</code>.
*
* @since 3.1
*/
static const QString SHOW_PROGRESS_ON_STARTUP; // "SHOW_PROGRESS_ON_STARTUP";
/**
* Stores whether or not to show the memory monitor in the workbench window.
*
* @since 3.1
*/
static const QString SHOW_MEMORY_MONITOR; // "SHOW_MEMORY_MONITOR";
/**
* Stores whether or not to use the window working set as the default
* working set for newly created views (without previously stored state).
* This is a hint that view implementors should honor.
*
* @since 3.2
*/
static const QString USE_WINDOW_WORKING_SET_BY_DEFAULT; // "USE_WINDOW_WORKING_SET_BY_DEFAULT";
/**
* Stores whether or not to show the text widget that allows type-ahead
* search in the case where a FilteredTree is used to display and filter
* tree items.
*
* @since 3.2
*/
static const QString SHOW_FILTERED_TEXTS; // "SHOW_FILTERED_TEXTS";
/**
* Stores whether or not views may be detached. The default is
* <code>true</code>.
*
* @since 3.2
*/
static const QString ENABLE_DETACHED_VIEWS; // "ENABLE_DETACHED_VIEWS";
/**
* Stores whether or not the workbench prompts for saving when a dirty
* editor or view is closed, but the Saveable objects are still open in
* other parts. If
- * <code>true<code> (default), the user will be prompted. If <code>false</code>, there will be
+ * <code>true</code> (default), the user will be prompted. If <code>false</code>, there will be
* no prompt.
*
* @see Saveable
* @since 3.2
*/
static const QString PROMPT_WHEN_SAVEABLE_STILL_OPEN; // "PROMPT_WHEN_SAVEABLE_STILL_OPEN";
/**
* Lists the extra perspectives to show in the perspective bar. The value is
* a comma-separated list of perspective ids. The default is the empty
* string.
*
* @since 3.2
*/
static const QString PERSPECTIVE_BAR_EXTRAS; // "PERSPECTIVE_BAR_EXTRAS";
/**
* Allows locking the trim to prevent user dragging on startup. The default
* is <code>false</code>.
*
* @since 3.2
*/
static const QString LOCK_TRIM; // "LOCK_TRIM";
/**
* A named preference for providing the 3.3 presentation's min/max behaviour
* <p>
* The default value for this preference is: <code>false</code>; use the
* 3.2 behaviour.
* </p>
*
* @since 3.3
*/
static const QString ENABLE_NEW_MIN_MAX; // "ENABLE_MIN_MAX";
/**
* A named preference for disabling opening a new fast view from the fast
* view bar controls ("Show View as a fast view" button or "New Fast View"
* submenu).
* <p>
* Value is of type <code>boolean</code>.
* </p>
* <p>
* The default is <code>false</code>.
* </p>
*
* @since 3.3
*/
static const QString DISABLE_NEW_FAST_VIEW; // "disableNewFastView";
/**
* A named preference for enabling the 3.2 behavior for closing sticky
* views. When not enabled a sticky view is closed in all perspectives when
* the view is closed.
* <p>
* The default value for this preference is: <code>false</code>; use the
* 3.2 behaviour.
* </p>
*
* @since 3.3
*/
static const QString ENABLE_32_STICKY_CLOSE_BEHAVIOR; // "ENABLE_32_STICKY_CLOSE_BEHAVIOR";
/**
* An named preference for whether or not tabs are on the top or bottom
- * for views. Values are either {@link SWT#TOP} or {@link SWT#BOTTOM}.
+ * for views. Values are either \c SWT.TOP or \c SWT.BOTTOM .
* <p>
* The default value for this preference is: <code>SWT.TOP</code>.
* </p>
*
* @since 3.4
*/
static const QString VIEW_TAB_POSITION; // "VIEW_TAB_POSITION";
/**
* An named preference for whether or not tabs are on the top or bottom
- * for editors. Values are either {@link SWT#TOP} or {@link SWT#BOTTOM}.
+ * for editors. Values are either \c SWT.TOP or \c SWT.BOTTOM .
* <p>
* The default value for this preference is: <code>SWT.TOP</code>.
* </p>
*
* @since 3.4
*/
static const QString EDITOR_TAB_POSITION; // "EDITOR_TAB_POSITION";
/**
* Workbench preference id for whether the workbench should show multiple
* editor tabs.
*
* Boolean-valued: <code>true</code> if editors should show multiple
* editor tabs, and <code>false</code> if editors should show a single
* editor tab.
* <p>
* The default value for this preference is: <code>true</code>
* </p>
*
* @since 3.4
*/
static const QString SHOW_MULTIPLE_EDITOR_TABS; // "SHOW_MULTIPLE_EDITOR_TABS";
/**
* Workbench preference id for whether the workbench may open editors
* in-place. Note that editors will only be opened in-place if this
* preference is <code>false</code> and if the current platform supports
* in-place editing.
*
* Boolean-valued: <code>false</code> if editors may be opened in-place,
* and <code>true</code> if editors should never be opened in-place.
* <p>
* The default value for this preference is: <code>false</code>
* </p>
*
* @since 3.4
*/
static const QString DISABLE_OPEN_EDITOR_IN_PLACE; // "DISABLE_OPEN_EDITOR_IN_PLACE";
};
}
#endif /* BERRYWORKBENCHPREFERENCECONSTANTS_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/berryXMLMemento.h b/Plugins/org.blueberry.ui.qt/src/berryXMLMemento.h
index 4ccdc565f2..7cf872bef6 100644
--- a/Plugins/org.blueberry.ui.qt/src/berryXMLMemento.h
+++ b/Plugins/org.blueberry.ui.qt/src/berryXMLMemento.h
@@ -1,283 +1,282 @@
/*============================================================================
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 BERRYXMLMEMENTO_H_
#define BERRYXMLMEMENTO_H_
#include <berryMacros.h>
#include "berryIMemento.h"
#include "berryUIException.h"
#include "Poco/DOM/Document.h"
#include "Poco/DOM/Element.h"
#include "Poco/SAX/XMLReader.h"
namespace berry {
/**
* This class represents the default implementation of the
* <code>IMemento</code> interface.
* <p>
* This class is not intended to be extended by clients.
* </p>
*
* @see IMemento
*/
class BERRY_UI_QT XMLMemento : public IMemento
{
public:
berryObjectMacro(XMLMemento);
/**
* Defines a std::ostream as XML output stream
*/
typedef std::ostream XMLByteOutputStream;
/**
* Defines a std::istream as XML input stream
*/
typedef std::istream XMLByteInputStream;
/**
* Creates a memento for the specified document and element.
* <p>
* Clients should use <code>CreateReadRoot</code> and
* <code>CreateWriteRoot</code> to create the initial
* memento on a document.
* </p>
*
* @param document the document for the memento
- * @param element the element node for the memento
+ * @param elem the element node for the memento
*/
XMLMemento(Poco::XML::Document* document, Poco::XML::Element* elem);
~XMLMemento() override;
/**
* Creates a <code>Document</code> from the <code>Reader</code>
* and returns a memento on the first <code>Element</code> for reading
* the document.
*
* @param reader the <code>Reader</code> used to create the memento's document
* @return a memento on the first <code>Element</code> for reading the document
* @throws WorkbenchException if IO problems, invalid format, or no element.
*/
static XMLMemento::Pointer CreateReadRoot(berry::XMLMemento::XMLByteInputStream& reader);
/**
* Creates a <code>Document</code> from the <code>Reader</code>
* and returns a memento on the first <code>Element</code> for reading
* the document.
*
* @param reader the <code>Reader</code> used to create the memento's document
* @param baseDir the directory used to resolve relative file names
* in the XML document. This directory must exist and include the
* trailing separator. The directory format, including the separators,
* must be valid for the platform. Can be <code>null</code> if not
* needed.
* @return a memento on the first <code>Element</code> for reading the document
* @throws WorkbenchException if IO problems, invalid format, or no element.
*/
static XMLMemento::Pointer CreateReadRoot(berry::XMLMemento::XMLByteInputStream& reader, const QString& baseDir);
/**
* Returns a root memento for writing a document.
*
* @param type the element node type to create on the document
* @return the root memento for writing a document
*/
static XMLMemento::Pointer CreateWriteRoot(const QString& type);
/**
* Copies another Memento into this memento
*
* @param child the new child memento
* @return the new child memento
*/
IMemento::Pointer CopyChild(IMemento::Pointer child);
/**
* Creates a new child of this memento with the given type
*
* @param type the type
* @return a new child memento with the given type
*/
IMemento::Pointer CreateChild(const QString& type) override;
/**
* Creates a new child of this memento with the given type and id.
* The id is stored in the child memento (using a special reserved
* key, <code>TAG_ID</code>) and can be retrieved using <code>getId</code>.
* <p>
* The <code>getChild</code> and <code>getChildren</code> methods
* are used to retrieve children of a given type.
* </p>
*
* @param type the type
* @param id the child id
* @return a new child memento with the given type and id
- * @see #getID
+ * @see #GetID
*/
IMemento::Pointer CreateChild(const QString& type, const QString& id) override;
/**
* Returns the first child with the given type id.
*
* @param type the type id
* @return the first child with the given type
*/
IMemento::Pointer GetChild(const QString& type) const override;
/**
* Returns all children with the given type id.
*
* @param type the type id
* @return an array of children with the given type
*/
QList< IMemento::Pointer > GetChildren(const QString& type) const override;
/**
* Returns the Type of this memento
*/
QString GetType() const override;
/**
* Returns the ID of this memento
*/
QString GetID() const override;
/**
* @see IMemento#GetInteger
*/
bool GetInteger(const QString& key, int& value) const override;
/**
* @see IMemento#GetFloat
*/
bool GetFloat(const QString& key, double& value) const override;
/**
* @see IMemento#GetString
*/
bool GetString(const QString& key, QString& value) const override;
/**
* @see IMemento#GetString
*/
bool GetBoolean(const QString& key, bool& value) const override;
/**
* Returns the data of the Text node of the memento. Each memento is allowed
* only one Text node.
*
* @return the data of the Text node of the memento, or <code>null</code>
* if the memento has no Text node.
*/
QString GetTextData() const override;
/**
* Returns an array of all the attribute keys of the memento. This will not
* be <code>null</code>. If there are no keys, an array of length zero will
* be returned.
* @return an vector with all the attribute keys of the memento
*/
QList< QString > GetAttributeKeys() const override;
/**
* Puts a float in this memento
*
* @param key the key
* @param value the value
*/
void PutFloat(const QString& key, double value) override;
/**
* Puts a integer in this memento
*
* @param key the key
* @param value the value
*/
void PutInteger(const QString& key, int value) override;
/**
* Puts another memento in this memento as a child
*
- * @param key the key
- * @param value the value
+ * @param memento
*/
void PutMemento(IMemento::Pointer memento) override;
/**
* Puts a string in this memento
*
* @param key the key
* @param value the value
*/
void PutString(const QString& key, const QString& value) override;
/**
* Puts a boolean in this memento
*
* @param key the key
* @param value the value
*/
void PutBoolean(const QString& key, bool value) override;
/**
* Puts a text in this memento
*
* @param data the text
*/
void PutTextData(const QString& data) override;
/**
* Saves this memento's document current values to the
* specified writer.
*
* @param writer the writer used to save the memento's document
* @throws IOException if there is a problem serializing the document to the stream.
*/
void Save(XMLByteOutputStream& writer); //TODO: throw(IOException)
/**
* Returns the element of the memento
*
* @return the xml element
*/
virtual Poco::XML::Element* GetElement() const;
private:
/**
* Returns the Text node of the memento. Each memento is allowed only
* one Text node.
*
* @return the Text node of the memento, or <code>null</code> if
* the memento has no Text node.
*/
Poco::XML::Text* GetTextNode() const;
/**
* Places the element's attributes into the document.
* @param copyText true if the first text node should be copied
*/
void PutElement(Poco::XML::Element* element, bool copyText);
Poco::XML::Document* factory;
Poco::XML::Element* element;
};
}//namespace berry
#endif /* BERRYXMLMEMENTO_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/commands/berryICommandImageService.h b/Plugins/org.blueberry.ui.qt/src/commands/berryICommandImageService.h
index 0d18b6cd79..37b3ebc6b5 100644
--- a/Plugins/org.blueberry.ui.qt/src/commands/berryICommandImageService.h
+++ b/Plugins/org.blueberry.ui.qt/src/commands/berryICommandImageService.h
@@ -1,99 +1,99 @@
/*============================================================================
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 BERRYICOMMANDIMAGESERVICE_H_
#define BERRYICOMMANDIMAGESERVICE_H_
#include "../services/berryIDisposable.h"
#include <QIcon>
namespace berry {
/**
* <p>
* Provides a look-up facility for images associated with commands.
* </p>
* <p>
* The <em>type</em> of an image indicates the state of the associated command
* within the user interface. The supported types are: <code>TYPE_DEFAULT</code>
* (to be used for an enabled command), <code>TYPE_DISABLED</code> (to be used
* for a disabled command) and <code>TYPE_HOVER</code> (to be used for an
* enabled command over which the mouse is hovering).
* </p>
* <p>
* The <em>style</em> of an image is an arbitrary string used to distinguish
* between sets of images associated with a command. For example, a command may
* appear in the menus as the default style. However, in the toolbar, the
* command is simply the default action for a toolbar drop down item. As such,
* perhaps a different image style is appropriate. The classic case is the "Run
* Last Launched" command, which appears in the menu and the toolbar, but with
* different icons in each location.
* </p>
* <p>
* We currently support a default image style (none) and an image style of
* IMAGE_STYLE_TOOLBAR.
* </p>
*
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
+ * @note This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be extended by clients.
*
*/
struct BERRY_UI_QT ICommandImageService : public IDisposable
{
berryObjectMacro(berry::ICommandImageService);
/**
* The default image style. This is provided when no style is requested or
* when the requested style is unavailable. (Value is <b>null</b>)
*/
static const QString IMAGE_STYLE_DEFAULT;
/**
* The image style used for commands in a toolbar. This is useful if you
* want the icon for the command in the toolbar to be different than the one
* that is displayed with menu items. (Value is <b>toolbar</b>)
*/
static const QString IMAGE_STYLE_TOOLBAR; // = "toolbar";
/**
* Retrieves the image associated with the given command in the
* default style.
*
* @param commandId
* The identifier to find; must not be <code>null</code>.
* @return An image appropriate for the given command; may be
* <code>null</code>.
*/
virtual QIcon GetImage(const QString& commandId) = 0;
/**
* Retrieves the image associated with the given command in the
* given style.
*
* @param commandId
* The identifier to find; must not be <code>null</code>.
* @param style
* The style of the image to retrieve; may be <code>null</code>.
* @return An image appropriate for the given command; A null QIcon
* if the given image style cannot be found.
*/
virtual QIcon GetImage(const QString& commandId, const QString& style) = 0;
};
}
Q_DECLARE_INTERFACE(berry::ICommandImageService, "org.blueberry.ui.ICommandImageService")
#endif /* BERRYICOMMANDIMAGESERVICE_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/commands/berryICommandService.h b/Plugins/org.blueberry.ui.qt/src/commands/berryICommandService.h
index 45ed978431..da1c9041b6 100644
--- a/Plugins/org.blueberry.ui.qt/src/commands/berryICommandService.h
+++ b/Plugins/org.blueberry.ui.qt/src/commands/berryICommandService.h
@@ -1,372 +1,372 @@
/*============================================================================
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 BERRYICOMMANDSERVICE_H_
#define BERRYICOMMANDSERVICE_H_
#include "../services/berryIDisposable.h"
#include <QHash>
namespace berry {
struct IExecutionListener;
struct IHandler;
struct IElementReference;
class UIElement;
class Command;
class CommandCategory;
class ParameterizedCommand;
class ParameterType;
/**
* <p>
* Provides services related to the command architecture within the workbench.
* This service can be used to access the set of commands and command
* categories.
* </p>
* <p>
* This service can be acquired from your service locator:
* <pre>
* ICommandService service = (ICommandService) getSite().getService(ICommandService.class);
* </pre>
* <ul>
* <li>This service is available globally.</li>
* </ul>
* </p>
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
+ * @note This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be extended by clients.
*/
struct BERRY_UI_QT ICommandService : public IDisposable
{
berryObjectMacro(berry::ICommandService);
/**
* The identifier of the category in which all auto-generated commands will
* appear. This value must never be <code>null</code>.
*/
static const QString AUTOGENERATED_CATEGORY_ID();
/**
* Adds an execution listener to the command service. This listener will be
* notified as commands are executed.
* <p>
* <b>Note:</b> listeners should be removed when no longer necessary. If
* not, they will be removed when the IServiceLocator used to acquire this
* service is disposed.
* </p>
*
* @param listener
* The listener to add; must not be <code>null</code>.
- * @see #removeExecutionListener(IExecutionListener)
+ * @see #RemoveExecutionListener
*/
virtual void AddExecutionListener(IExecutionListener* listener) = 0;
/**
* Sets the name and description of the category for uncategorized commands.
* This is the category that will be returned if
- * {@link #getCategory(String)} is called with <code>null</code>.
+ * {@link #GetCategory} is called with <code>null</code>.
*
* @param name
* The name of the category for uncategorized commands; must not
* be <code>null</code>.
* @param description
* The description of the category for uncategorized commands;
* may be <code>null</code>.
*/
virtual void DefineUncategorizedCategory(const QString& name, const QString& description) = 0;
/**
* <p>
* Returns a {@link ParameterizedCommand} with a command and
* parameterizations as specified in the provided
* <code>serializedParameterizedCommand</code> string. The
* <code>serializedParameterizedCommand</code> must use the format
- * returned by {@link ParameterizedCommand#serialize()} and described in the
+ * returned by {@link ParameterizedCommand#Serialize} and described in the
* Javadoc for that method.
* </p>
* <p>
* If a parameter id encoded in the
* <code>serializedParameterizedCommand</code> does not exist in the
* encoded command, that parameter id and value are ignored. A given
* parameter id should not be used more than once in
* <code>serializedParameterizedCommand</code>. This will not result in
* an exception, but the value of the parameter when the command is executed
* cannot be specified here.
* </p>
* <p>
* This method will never return <code>null</code>, however it may throw
* an exception if there is a problem processing the serialization string or
* the encoded command is undefined.
* </p>
*
* @param serializedParameterizedCommand
* a <code>String</code> representing a command id and
* parameter ids and values
* @return a <code>ParameterizedCommand</code> with the command and
* parameterizations encoded in the
* <code>serializedParameterizedCommand</code>
* @throws NotDefinedException
* if the command indicated in
* <code>serializedParameterizedCommand</code> is not defined
* @throws SerializationException
* if there is an error deserializing
* <code>serializedParameterizedCommand</code>
* @see ParameterizedCommand#serialize()
* @see CommandManager#deserialize(String)
*/
virtual SmartPointer<ParameterizedCommand> Deserialize(const QString& serializedParameterizedCommand) const = 0;
/**
* Retrieves the category with the given identifier. If no such category
* exists, then an undefined category with the given id is created.
*
* @param categoryId
* The identifier to find. If the category is <code>null</code>,
* then a category suitable for uncategorized items is defined
* and returned.
* @return A category with the given identifier, either defined or
* undefined.
*/
virtual SmartPointer<CommandCategory> GetCategory(const QString& categoryId) const = 0;
/**
* Retrieves the command with the given identifier. If no such command
* exists, then an undefined command with the given id is created.
*
* @param commandId
* The identifier to find; must not be <code>null</code>.
* @return A command with the given identifier, either defined or undefined.
*/
virtual SmartPointer<Command> GetCommand(const QString& commandId) const = 0;
/**
* Returns the collection of all of the defined categories in the workbench.
*
* @return The collection of categories (<code>Category</code>) that are
* defined; never <code>null</code>, but may be empty.
*/
virtual QList<SmartPointer<CommandCategory> > GetDefinedCategories() const = 0;
/**
* Returns the collection of the identifiers for all of the defined
* categories in the workbench.
*
* @return The collection of category identifiers (<code>String</code>)
* that are defined; never <code>null</code>, but may be empty.
*/
virtual QStringList GetDefinedCategoryIds() const = 0;
/**
* Returns the collection of the identifiers for all of the defined commands
* in the workbench.
*
* @return The collection of command identifiers (<code>String</code>)
* that are defined; never <code>null</code>, but may be empty.
*/
virtual QStringList GetDefinedCommandIds() const = 0;
/**
* Returns the collection of all of the defined commands in the workbench.
*
* @return The collection of commands (<code>Command</code>) that are
* defined; never <code>null</code>, but may be empty.
*/
virtual QList<SmartPointer<Command> > GetDefinedCommands() const = 0;
/**
* Returns the collection of the identifiers for all of the defined command
* parameter types in the workbench.
*
* @return The collection of command parameter type identifiers (<code>String</code>)
* that are defined; never <code>null</code>, but may be empty.
*/
virtual QStringList GetDefinedParameterTypeIds() const = 0;
/**
* Returns the collection of all of the defined command parameter types in
* the workbench.
*
* @return The collection of command parameter types (<code>ParameterType</code>)
* that are defined; never <code>null</code>, but may be empty.
*/
virtual QList<SmartPointer<ParameterType> > GetDefinedParameterTypes() const = 0;
/**
* Gets the help context identifier for a particular command. The command's
* handler is first checked for a help context identifier. If the handler
* does not have a help context identifier, then the help context identifier
* for the command is returned. If neither has a help context identifier,
* then <code>null</code> is returned.
*
* @param command
* The command for which the help context should be retrieved;
* must not be <code>null</code>.
* @return The help context identifier to use for the given command; may be
* <code>null</code>.
* @throws NotDefinedException
* If the given command is not defined.
*/
virtual QString GetHelpContextId(const SmartPointer<const Command>& command) const = 0;
/**
* Gets the help context identifier for a particular command. The command's
* handler is first checked for a help context identifier. If the handler
* does not have a help context identifier, then the help context identifier
* for the command is returned. If neither has a help context identifier,
* then <code>null</code> is returned.
*
* @param commandId
* The identifier of the command for which the help context
* should be retrieved; must not be <code>null</code>.
* @return The help context identifier to use for the given command; may be
* <code>null</code>.
* @throws NotDefinedException
* If the command with the given identifier is not defined.
*/
virtual QString GetHelpContextId(const QString& commandId) const = 0;
/**
* Retrieves the command parameter type with the given identifier. If no
* such parameter type exists, then an undefined parameter type with the
* given id is created.
*
* @param parameterTypeId
* The identifier to find; must not be <code>null</code>.
* @return A command parameter type with the given identifier, either
* defined or undefined.
*/
virtual SmartPointer<ParameterType> GetParameterType(const QString& parameterTypeId) const = 0;
/**
* <p>
* Reads the command information from the registry and the preferences. This
* will overwrite any of the existing information in the command service.
* This method is intended to be called during start-up. When this method
* completes, this command service will reflect the current state of the
* registry and preference store.
* </p>
*/
virtual void ReadRegistry() = 0;
/**
* Removes an execution listener from the command service.
*
* @param listener
* The listener to remove; must not be <code>null</code>.
*/
virtual void RemoveExecutionListener(IExecutionListener* listener) = 0;
/**
* Sets the help context identifier to associate with a particular handler.
*
* @param handler
* The handler with which to register a help context identifier;
* must not be <code>null</code>.
* @param helpContextId
* The help context identifier to register; may be
* <code>null</code> if the help context identifier should be
* removed.
*/
virtual void SetHelpContextId(const SmartPointer<IHandler>& handler, const QString& helpContextId) = 0;
/**
* Register that this element accepts callbacks for this parameterized
* command.
* <p>
* <b>Note:</b> elements should be removed when no longer necessary. If
* not, they will be removed when the IServiceLocator used to acquire this
* service is disposed.
* </p>
*
* @param command
* The parameterized command that is already specialized. Must
* not be <code>null</code>.
* @param element
* The callback to register for this specialized command
* instance. Must not be <code>null</code>.
* @return A reference for the registered element that can be used to
* unregister it.
* @throws NotDefinedException
* If the command included in the ParameterizedCommand is not
* defined, or the element is <code>null</code>.
- * @see #unregisterElement(IElementReference)
+ * @see #UnregisterElement
*/
virtual SmartPointer<IElementReference> RegisterElementForCommand(
const SmartPointer<ParameterizedCommand>& command,
const SmartPointer<UIElement>& element) = 0;
/**
* Re-register a callback element provided by the ICommandService. This
* element reference must not currently be held by the ICommandService. i.e.
* it must have been removed using
- * {@link #unregisterElement(IElementReference)}.
+ * {@link #UnregisterElement}.
* <p>
* <b>Note:</b> elements should be removed when no longer necessary. If
* not, they will be removed when the IServiceLocator used to acquire this
* service is disposed.
* </p>
*
* @param elementReference
* The reference to re-register. Must not be <code>null</code>.
- * @see #unregisterElement(IElementReference)
+ * @see #UnregisterElement
*/
virtual void RegisterElement(const SmartPointer<IElementReference>& elementReference) = 0;
/**
* Unregister an element callback. It will be removed from the
* ICommandService. The same service that is used to register an element for
* a command <b>must</b> be used to unregister the element.
*
* @param elementReference
* The callback reference that was provided by the command
* service on registration. Must not be <code>null</code>.
*/
virtual void UnregisterElement(const SmartPointer<IElementReference>& elementReference) = 0;
/**
* Refresh any elements registered against the command with the given id.
* It allows the active handler the opportunity to provide user feedback. If
* the command is parameterized, some of the parameters can be specified to
* help narrow down which elements to refresh.
* <p>
* The service locator used in registering the element can also be used to
* scope the search. For example: if you wanted all elements for your
* command but only within the part's workbench window, you could use:
*
* <pre>
* Map filter = new HashMap();
* filter.put(IServiceScopes.WINDOW_SCOPE, getSite().getPage()
* .getWorkbenchWindow());
* commandService.refreshElements(commandId, filter);
* </pre>
*
* </p>
*
* @param commandId
* The command id to refresh if it has registered eleemnts.
* @param filter
* key-value pairs that can narrow down the callbacks to return.
* The parameters are <b>AND</b>ed together. This may be
* <code>null</code>.
*/
virtual void RefreshElements(const QString& commandId, const QHash<QString, Object::Pointer>& filter) = 0;
};
}
Q_DECLARE_INTERFACE(berry::ICommandService, "org.blueberry.ui.ICommandService")
#endif /* BERRYICOMMANDSERVICE_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/commands/berryIMenuService.h b/Plugins/org.blueberry.ui.qt/src/commands/berryIMenuService.h
index 2bcaf474d7..6c1291acc3 100644
--- a/Plugins/org.blueberry.ui.qt/src/commands/berryIMenuService.h
+++ b/Plugins/org.blueberry.ui.qt/src/commands/berryIMenuService.h
@@ -1,118 +1,118 @@
/*============================================================================
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 BERRYIMENUSERVICE_H_
#define BERRYIMENUSERVICE_H_
#include <berryIServiceWithSources.h>
namespace berry {
class AbstractContributionFactory;
class ContributionManager;
struct IEvaluationContext;
/**
* <p>
* Provides services related to the menu architecture within the workbench. It
* can be used to contribute additional items to the menu, tool bar and status
* line.
* </p>
* <p>
* This service can be acquired from your service locator:
* <pre>
* IMenuService service = (IMenuService) getSite().getService(IMenuService.class);
* </pre>
* <ul>
* <li>This service is available globally.</li>
* </ul>
* </p>
*
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
+ * @note This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be extended by clients.
*/
struct IMenuService : public IServiceWithSources
{
berryObjectMacro(berry::IMenuService);
/**
* Contribute and initialize the contribution factory. This should only be
* called once per factory. After the call, the factory should be treated as
* an unmodifiable object.
* <p>
* <b>Note:</b> factories should be removed when no longer necessary. If
* not, they will be removed when the IServiceLocator used to acquire this
* service is disposed.
* </p>
*
* @param factory
* the contribution factory. Must not be <code>null</code>
- * @see #removeContributionFactory(AbstractContributionFactory)
+ * @see #RemoveContributionFactory
*/
virtual void AddContributionFactory(const SmartPointer<AbstractContributionFactory>& factory) = 0;
/**
* Remove the contributed factory from the menu service. If the factory is
* not contained by this service, this call does nothing.
*
* @param factory
* the contribution factory to remove. Must not be
* <code>null</code>.
*/
virtual void RemoveContributionFactory(const SmartPointer<AbstractContributionFactory>& factory) = 0;
/**
* Populate a <code>ContributionManager</code> at the specified starting
* location with a set of <code>IContributionItems</code>s. It applies
* <code>AbstractContributionFactory</code>s that are stored against the
* provided location.
*
* @param mgr
* The ContributionManager to populate
* @param location
* The starting location to begin populating this contribution
* manager. The format is the Menu API URI format.
- * @see #releaseContributions(ContributionManager)
+ * @see #ReleaseContributions
*/
virtual void PopulateContributionManager(ContributionManager* mgr,
const QString& location) = 0;
/**
* Before calling dispose() on a ContributionManager populated by the menu
* service, you must inform the menu service to release its contributions.
* This takes care of unregistering any IContributionItems that have their
* visibleWhen clause managed by this menu service.
*
* @param mgr
* The manager that was populated by a call to
- * {@link #populateContributionManager(ContributionManager, String)}
+ * {@link #PopulateContributionManager}
*/
virtual void ReleaseContributions(ContributionManager* mgr) = 0;
/**
* Get the current state of eclipse as seen by the menu service.
*
* @return an IEvaluationContext containing state variables.
*
* @see org.eclipse.ui.ISources
* @see org.eclipse.ui.services.IEvaluationService
*/
virtual SmartPointer<IEvaluationContext> GetCurrentState() const = 0;
};
}
Q_DECLARE_INTERFACE(berry::IMenuService, "org.blueberry.ui.IMenuService")
#endif /* BERRYIMENUSERVICE_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/guitk/berryGuiTkEvent.h b/Plugins/org.blueberry.ui.qt/src/guitk/berryGuiTkEvent.h
index ab8768b7bd..9bb836492e 100755
--- a/Plugins/org.blueberry.ui.qt/src/guitk/berryGuiTkEvent.h
+++ b/Plugins/org.blueberry.ui.qt/src/guitk/berryGuiTkEvent.h
@@ -1,142 +1,142 @@
/*============================================================================
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 BERRYGUITKEVENT_H_
#define BERRYGUITKEVENT_H_
#include <berryObject.h>
#include <berryMacros.h>
#include <org_blueberry_ui_qt_Export.h>
namespace berry
{
namespace GuiTk
{
/**
* Instances of this class are sent as a result of
* GUI events.
* <p>
* Note: The fields that are filled in depend on the widget.
* </p>
*
*/
class BERRY_UI_QT Event: public Object
{
public:
berryObjectMacro(Event);
Event();
/**
* the widget that issued the event
*/
QWidget* item;
/**
* the event specific detail field, as defined by the detail constants
* in class <code>Constants</code>
*/
int detail;
/**
* depending on the event type, the x offset of the bounding
* rectangle of the region that requires painting or the
* widget-relative, x coordinate of the pointer at the
* time the mouse button was pressed or released
*/
int x;
/**
* depending on the event type, the y offset of the bounding
* rectangle of the region that requires painting or the
* widget-relative, y coordinate of the pointer at the
* time the mouse button was pressed or released
*/
int y;
/**
* the width of the bounding rectangle of the
* region that requires painting
*/
int width;
/**
* the height of the bounding rectangle of the
* region that requires painting
*/
int height;
/**
* the button that was pressed or released; 1 for the
* first button, 2 for the second button, and 3 for the
* third button, etc.
*/
int button;
/**
* depending on the event, the character represented by the key
* that was typed. This is the final character that results
* after all modifiers have been applied. For example, when the
* user types Ctrl+A, the character value is 0x01 (ASCII SOH).
* It is important that applications do not attempt to modify the
* character value based on a stateMask (such as SWT.CTRL) or the
* resulting character will not be correct.
*/
char character;
/**
* depending on the event, the key code of the key that was typed,
* as defined by the key code constants in class <code>SWT</code>.
* When the character field of the event is ambiguous, this field
* contains the unaffected value of the original character. For
- * example, typing Ctrl+M or Enter both result in the character '\r'
- * but the keyCode field will also contain '\r' when Enter was typed
+ * example, typing Ctrl+M or Enter both result in the character '\\r'
+ * but the keyCode field will also contain '\\r' when Enter was typed
* and 'm' when Ctrl+M was typed.
*/
int keyCode;
/**
* depending on the event, the state of the keyboard modifier
* keys and mouse masks at the time the event was generated.
*/
int stateMask;
/**
* depending on the event, the new text that will be inserted.
* Setting this field will change the text that is about to
* be inserted or deleted.
*/
QString text;
/**
* depending on the event, a flag indicating whether the operation
* should be allowed. Setting this field to false will cancel the
* operation.
*/
bool doit;
QString ToString() const override;
};
}
}
#endif /* BERRYGUITKEVENT_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/guitk/berryGuiTkIControlListener.h b/Plugins/org.blueberry.ui.qt/src/guitk/berryGuiTkIControlListener.h
index addd0fadf0..b43a2c3639 100755
--- a/Plugins/org.blueberry.ui.qt/src/guitk/berryGuiTkIControlListener.h
+++ b/Plugins/org.blueberry.ui.qt/src/guitk/berryGuiTkIControlListener.h
@@ -1,236 +1,232 @@
/*============================================================================
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 BERRYGUITKICONTROLLISTENER_H_
#define BERRYGUITKICONTROLLISTENER_H_
#include <berryMacros.h>
#include <berryMessage.h>
#include <org_blueberry_ui_qt_Export.h>
#include "berryGuiTkControlEvent.h"
namespace berry
{
namespace GuiTk
{
/**
* Classes which implement this interface provide methods
* that deal with the events that are generated by moving
* and resizing controls.
* <p>
* After creating an instance of a class that implements
* this interface it can be added to a control using the
* <code>addControlListener</code> method and removed using
* the <code>removeControlListener</code> method. When a
* control is moved or resized, the appropriate method will
* be invoked.
* </p>
*
* @see ControlAdapter
* @see ControlEvent
*/
struct BERRY_UI_QT IControlListener: public virtual Object
{
berryObjectMacro(berry::GuiTk::IControlListener);
struct BERRY_UI_QT Events {
enum Type {
NONE = 0x00000000,
MOVED = 0x00000001,
RESIZED = 0x00000002,
ACTIVATED = 0x00000004,
DESTROYED = 0x00000008,
ALL = 0xffffffff
};
Q_DECLARE_FLAGS(Types, Type)
typedef Message1<ControlEvent::Pointer> EventType;
EventType movedEvent;
EventType resizedEvent;
EventType activatedEvent;
EventType destroyedEvent;
void AddListener(IControlListener::Pointer listener);
void RemoveListener(IControlListener::Pointer listener);
private:
typedef MessageDelegate1<IControlListener, ControlEvent::Pointer> Delegate;
};
~IControlListener() override;
virtual Events::Types GetEventTypes() const = 0;
/**
* Sent when the location (x, y) of a control changes relative
* to its parent (or relative to the display, for <code>Shell</code>s).
- *
- * @param e an event containing information about the move
*/
- virtual void ControlMoved(ControlEvent::Pointer /*e*/)
+ virtual void ControlMoved(ControlEvent::Pointer)
{
}
/**
* Sent when the size (width, height) of a control changes.
- *
- * @param e an event containing information about the resize
*/
- virtual void ControlResized(ControlEvent::Pointer /*e*/)
+ virtual void ControlResized(ControlEvent::Pointer)
{
}
- virtual void ControlActivated(ControlEvent::Pointer /*e*/)
+ virtual void ControlActivated(ControlEvent::Pointer)
{
}
- virtual void ControlDestroyed(ControlEvent::Pointer /*e*/)
+ virtual void ControlDestroyed(ControlEvent::Pointer)
{
}
};
template<typename R>
struct ControlMovedAdapter: public IControlListener
{
typedef R Listener;
typedef void
(R::*Callback)(ControlEvent::Pointer);
ControlMovedAdapter(R* l, Callback c) :
listener(l), callback(c)
{
poco_assert(listener);
poco_assert(callback);
}
Events::Types GetEventTypes() const override
{
return Events::MOVED;
}
void ControlMoved(ControlEvent::Pointer e) override
{
(listener->*callback)(e);
}
private:
Listener* listener;
Callback callback;
};
template<typename R>
struct ControlResizedAdapter: public IControlListener
{
typedef R Listener;
typedef void
(R::*Callback)(ControlEvent::Pointer);
ControlResizedAdapter(R* l, Callback c) :
listener(l), callback(c)
{
poco_assert(listener);
poco_assert(callback);
}
Events::Types GetEventTypes() const override
{
return Events::RESIZED;
}
void ControlResized(ControlEvent::Pointer e) override
{
(listener->*callback)(e);
}
private:
Listener* listener;
Callback callback;
};
template<typename R>
struct ControlActivatedAdapter: public IControlListener
{
typedef R Listener;
typedef void
(R::*Callback)(ControlEvent::Pointer);
ControlActivatedAdapter(R* l, Callback c) :
listener(l), callback(c)
{
poco_assert(listener);
poco_assert(callback);
}
Events::Types GetEventTypes() const override
{
return Events::ACTIVATED;
}
void ControlActivated(ControlEvent::Pointer e) override
{
(listener->*callback)(e);
}
private:
Listener* listener;
Callback callback;
};
template<typename R>
struct ControlDestroyedAdapter: public IControlListener
{
typedef R Listener;
typedef void
(R::*Callback)(ControlEvent::Pointer);
ControlDestroyedAdapter(R* l, Callback c) :
listener(l), callback(c)
{
poco_assert(listener);
poco_assert(callback);
}
Events::Types GetEventTypes() const override
{
return Events::DESTROYED;
}
void ControlDestroyed(ControlEvent::Pointer e) override
{
(listener->*callback)(e);
}
private:
Listener* listener;
Callback callback;
};
}
}
Q_DECLARE_OPERATORS_FOR_FLAGS(berry::GuiTk::IControlListener::Events::Types)
#endif /* BERRYGUITKICONTROLLISTENER_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/guitk/berryGuiTkISelectionListener.h b/Plugins/org.blueberry.ui.qt/src/guitk/berryGuiTkISelectionListener.h
index a3779ef78e..b9360f424c 100755
--- a/Plugins/org.blueberry.ui.qt/src/guitk/berryGuiTkISelectionListener.h
+++ b/Plugins/org.blueberry.ui.qt/src/guitk/berryGuiTkISelectionListener.h
@@ -1,98 +1,94 @@
/*============================================================================
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 BERRYGUITKISELECTIONLISTENER_H_
#define BERRYGUITKISELECTIONLISTENER_H_
#include <berryMacros.h>
#include <berryMessage.h>
#include "berryGuiTkSelectionEvent.h"
namespace berry
{
namespace GuiTk
{
/**
* Classes which implement this interface provide methods
* that deal with the events that are generated when selection
* occurs in a control.
* <p>
* After creating an instance of a class that implements
* this interface it can be added to a control using the
* <code>addSelectionListener</code> method and removed using
* the <code>removeSelectionListener</code> method. When
* selection occurs in a control the appropriate method
* will be invoked.
* </p>
*
* @see SelectionAdapter
* @see SelectionEvent
*/
struct BERRY_UI_QT ISelectionListener: public virtual Object
{
berryObjectMacro(berry::GuiTk::ISelectionListener);
struct BERRY_UI_QT Events {
typedef Message1<SelectionEvent::Pointer> EventType;
EventType selected;
EventType defaultSelected;
void AddListener(ISelectionListener::Pointer listener);
void RemoveListener(ISelectionListener::Pointer listener);
private:
typedef MessageDelegate1<ISelectionListener, SelectionEvent::Pointer> Delegate;
};
~ISelectionListener() override;
/**
* Sent when selection occurs in the control.
* <p>
* For example, selection occurs in a List when the user selects
* an item or items with the keyboard or mouse. On some platforms,
* the event occurs when a mouse button or key is pressed. On others,
* it happens when the mouse or key is released. The exact key or
* mouse gesture that causes this event is platform specific.
* </p>
- *
- * @param e an event containing information about the selection
*/
- virtual void WidgetSelected(SelectionEvent::Pointer /*e*/) {}
+ virtual void WidgetSelected(SelectionEvent::Pointer) {}
/**
* Sent when default selection occurs in the control.
* <p>
* For example, on some platforms default selection occurs in a List
* when the user double-clicks an item or types return in a Text.
* On some platforms, the event occurs when a mouse button or key is
* pressed. On others, it happens when the mouse or key is released.
* The exact key or mouse gesture that causes this event is platform
* specific.
* </p>
- *
- * @param e an event containing information about the default selection
*/
- virtual void WidgetDefaultSelected(SelectionEvent::Pointer /*e*/) {}
+ virtual void WidgetDefaultSelected(SelectionEvent::Pointer) {}
};
}
}
#endif /* BERRYGUITKISELECTIONLISTENER_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/handlers/berryHandlerUtil.h b/Plugins/org.blueberry.ui.qt/src/handlers/berryHandlerUtil.h
index 8c1aab12ea..d526f0ac1f 100644
--- a/Plugins/org.blueberry.ui.qt/src/handlers/berryHandlerUtil.h
+++ b/Plugins/org.blueberry.ui.qt/src/handlers/berryHandlerUtil.h
@@ -1,440 +1,382 @@
/*============================================================================
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 BERRYHANDLERUTIL_H_
#define BERRYHANDLERUTIL_H_
#include <berryExecutionEvent.h>
#include <berryObjectList.h>
#include <berryObjectString.h>
#include <org_blueberry_ui_qt_Export.h>
#include "berryIWorkbenchPart.h"
#include "berryIWorkbenchPartSite.h"
#include "berryISelection.h"
#include "berryIWorkbenchWindow.h"
#include "berryISources.h"
namespace berry {
/**
* \ingroup org_blueberry_ui_qt
*
* Some common utilities for working with handlers in Platform UI.
* <p>
* <b>Note</b>: this class should not be instantiated or extended by clients.
* </p>
*
* @since 3.3
*/
class BERRY_UI_QT HandlerUtil {
private:
static void NoVariableFound(const ExecutionEvent::ConstPointer& event, const QString& name);
static void IncorrectTypeFound(const ExecutionEvent::ConstPointer& event, const QString& name,
const QString& expectedType, const QString& wrongType);
public:
typedef ObjectList<ObjectString::Pointer> StringVectorType;
/**
* Extract the variable.
*
* @param event
* The execution event that contains the application context
* @param name
* The variable name to extract.
* @return The object from the application context, or <code>null</code>
* if it could not be found.
*/
static Object::ConstPointer GetVariable(const ExecutionEvent::ConstPointer& event, const QString& name);
/**
* Extract the variable.
*
* @param event
* The execution event that contains the application context
* @param name
* The variable name to extract.
* @return The object from the application context. Will not return
* <code>null</code>.
* @throws ExecutionException
* if the variable is not found.
*/
static Object::ConstPointer GetVariableChecked(const ExecutionEvent::ConstPointer& event, const QString& name);
/**
* Extract the variable.
*
* @param context
* The IEvaluationContext or <code>null</code>
* @param name
* The variable name to extract.
* @return The object from the application context, or <code>null</code>
* if it could not be found.
*/
static Object::ConstPointer GetVariable(Object::Pointer context, const QString& name);
/**
* Return the active contexts.
*
* @param event
* The execution event that contains the application context
* @return a collection of String contextIds, or <code>null</code>.
*/
static StringVectorType::ConstPointer GetActiveContexts(const ExecutionEvent::ConstPointer& event);
/**
* Return the active contexts.
*
* @param event
* The execution event that contains the application context
* @return a collection of String contextIds. Will not return
* <code>null</code>.
* @throws ExecutionException
* If the context variable is not found.
*/
static StringVectorType::ConstPointer GetActiveContextsChecked(const ExecutionEvent::ConstPointer& event);
- /**
- * Return the active shell. Is not necessarily the active workbench window
- * shell.
- *
- * @param event
- * The execution event that contains the application context
- * @return the active shell, or <code>null</code>.
- */
-// static Shell GetActiveShell(const ExecutionEvent::ConstPointer& event) {
-// Object::Pointer o = getVariable(event, ISources.ACTIVE_SHELL_NAME);
-// if (o instanceof Shell) {
-// return (Shell) o;
-// }
-// return null;
-// }
-
- /**
- * Return the active shell. Is not necessarily the active workbench window
- * shell.
- *
- * @param event
- * The execution event that contains the application context
- * @return the active shell. Will not return <code>null</code>.
- * @throws ExecutionException
- * If the active shell variable is not found.
- */
-// static Shell GetActiveShellChecked(const ExecutionEvent::ConstPointer& event)
-// {
-// Object::Pointer o = getVariableChecked(event, ISources.ACTIVE_SHELL_NAME);
-// if (!(o instanceof Shell)) {
-// incorrectTypeFound(event, ISources.ACTIVE_SHELL_NAME, Shell.class,
-// o.getClass());
-// }
-// return (Shell) o;
-// }
-
/**
* Return the active workbench window.
*
* @param event
* The execution event that contains the application context
* @return the active workbench window, or <code>null</code>.
*/
static IWorkbenchWindow::Pointer GetActiveWorkbenchWindow(const ExecutionEvent::ConstPointer& event);
/**
* Return the active workbench window.
*
* @param event
* The execution event that contains the application context
* @return the active workbench window. Will not return <code>null</code>.
* @throws ExecutionException
* If the active workbench window variable is not found.
*/
static IWorkbenchWindow::Pointer GetActiveWorkbenchWindowChecked(
const ExecutionEvent::ConstPointer& event);
- /**
- * Return the active editor.
- *
- * @param event
- * The execution event that contains the application context
- * @return the active editor, or <code>null</code>.
- */
- //static IEditorPart::Pointer GetActiveEditor(const ExecutionEvent::ConstPointer& event);
-
- /**
- * Return the active editor.
- *
- * @param event
- * The execution event that contains the application context
- * @return the active editor. Will not return <code>null</code>.
- * @throws ExecutionException
- * If the active editor variable is not found.
- */
- //static IEditorPart::Pointer GetActiveEditorChecked(const ExecutionEvent::ConstPointer& event);
-
/**
* Return the part id of the active editor.
*
* @param event
* The execution event that contains the application context
* @return the part id of the active editor, or <code>null</code>.
*/
static ObjectString::ConstPointer GetActiveEditorId(const ExecutionEvent::ConstPointer& event);
/**
* Return the part id of the active editor.
*
* @param event
* The execution event that contains the application context
* @return the part id of the active editor. Will not return
* <code>null</code>.
* @throws ExecutionException
* If the active editor id variable is not found.
*/
static ObjectString::ConstPointer GetActiveEditorIdChecked(const ExecutionEvent::ConstPointer& event);
/**
* Return the active part.
*
* @param event
* The execution event that contains the application context
* @return the active part, or <code>null</code>.
*/
static IWorkbenchPart::Pointer GetActivePart(const ExecutionEvent::ConstPointer& event);
/**
* Return the active part.
*
* @param event
* The execution event that contains the application context
* @return the active part. Will not return <code>null</code>.
* @throws ExecutionException
* If the active part variable is not found.
*/
static IWorkbenchPart::Pointer GetActivePartChecked(const ExecutionEvent::ConstPointer& event);
/**
* Return the part id of the active part.
*
* @param event
* The execution event that contains the application context
* @return the part id of the active part, or <code>null</code>.
*/
static ObjectString::ConstPointer GetActivePartId(const ExecutionEvent::ConstPointer& event);
/**
* Return the part id of the active part.
*
* @param event
* The execution event that contains the application context
* @return the part id of the active part. Will not return <code>null</code>.
* @throws ExecutionException
* If the active part id variable is not found.
*/
static ObjectString::ConstPointer GetActivePartIdChecked(const ExecutionEvent::ConstPointer& event);
/**
* Return the active part site.
*
* @param event
* The execution event that contains the application context
* @return the active part site, or <code>null</code>.
*/
static IWorkbenchPartSite::Pointer GetActiveSite(const ExecutionEvent::ConstPointer& event);
/**
* Return the active part site.
*
* @param event
* The execution event that contains the application context
* @return the active part site. Will not return <code>null</code>.
* @throws ExecutionException
* If the active part site variable is not found.
*/
static IWorkbenchPartSite::Pointer GetActiveSiteChecked(const ExecutionEvent::ConstPointer& event);
/**
* Return the current selection.
*
* @param event
* The execution event that contains the application context
* @return the current selection, or <code>null</code>.
*/
static ISelection::ConstPointer GetCurrentSelection(const ExecutionEvent::ConstPointer& event);
/**
* Return the current selection.
*
* @param event
* The execution event that contains the application context
* @return the current selection. Will not return <code>null</code>.
* @throws ExecutionException
* If the current selection variable is not found.
*/
static ISelection::ConstPointer GetCurrentSelectionChecked(const ExecutionEvent::ConstPointer& event);
/**
- * Return the menu IDs that were applied to the registered context menu. For
- * example, #CompilationUnitEditorContext.
+ * Return the menu IDs that were applied to the registered context menu.
*
* @param event
* The execution event that contains the application context
* @return the menu IDs, or <code>null</code>.
*/
static StringVectorType::ConstPointer GetActiveMenus(const ExecutionEvent::ConstPointer& event);
/**
- * Return the menu IDs that were applied to the registered context menu. For
- * example, #CompilationUnitEditorContext.
+ * Return the menu IDs that were applied to the registered context menu.
*
* @param event
* The execution event that contains the application context
* @return the menu IDs. Will not return <code>null</code>.
* @throws ExecutionException
* If the active menus variable is not found.
*/
static StringVectorType::ConstPointer GetActiveMenusChecked(const ExecutionEvent::ConstPointer& event);
/**
* Return the active menu selection. The active menu is a registered context
* menu.
*
* @param event
* The execution event that contains the application context
* @return the active menu selection, or <code>null</code>.
*/
static ISelection::ConstPointer GetActiveMenuSelection(const ExecutionEvent::ConstPointer& event);
/**
* Return the active menu selection. The active menu is a registered context
* menu.
*
* @param event
* The execution event that contains the application context
* @return the active menu selection. Will not return <code>null</code>.
* @throws ExecutionException
* If the active menu selection variable is not found.
*/
static ISelection::ConstPointer GetActiveMenuSelectionChecked(const ExecutionEvent::ConstPointer& event);
/**
* Return the active menu editor input, if available. The active menu is a
* registered context menu.
*
* @param event
* The execution event that contains the application context
* @return the active menu editor, or <code>null</code>.
*/
static ISelection::ConstPointer GetActiveMenuEditorInput(const ExecutionEvent::ConstPointer& event);
/**
* Return the active menu editor input. The active menu is a registered
* context menu. Some context menus do not include the editor input which
* will throw an exception.
*
* @param event
* The execution event that contains the application context
* @return the active menu editor input. Will not return <code>null</code>.
* @throws ExecutionException
* If the active menu editor input variable is not found.
*/
static ISelection::ConstPointer GetActiveMenuEditorInputChecked(
const ExecutionEvent::ConstPointer& event);
/**
* Return the ShowInContext selection.
*
* @param event
* The execution event that contains the application context
* @return the show in selection, or <code>null</code>.
*/
static ISelection::ConstPointer GetShowInSelection(const ExecutionEvent::ConstPointer& event);
/**
* Return the ShowInContext selection. Will not return <code>null</code>.
*
* @param event
* The execution event that contains the application context
* @return the show in selection, or <code>null</code>.
* @throws ExecutionException
* If the show in selection variable is not found.
*/
static ISelection::ConstPointer GetShowInSelectionChecked(const ExecutionEvent::ConstPointer& event);
/**
* Return the ShowInContext input.
*
* @param event
* The execution event that contains the application context
* @return the show in input, or <code>null</code>.
*/
static Object::ConstPointer GetShowInInput(const ExecutionEvent::ConstPointer& event);
/**
* Return the ShowInContext input. Will not return <code>null</code>.
*
* @param event
* The execution event that contains the application context
* @return the show in input, or <code>null</code>.
* @throws ExecutionException
* If the show in input variable is not found.
*/
static Object::ConstPointer GetShowInInputChecked(const ExecutionEvent::ConstPointer& event);
/**
* Toggles the command's state.
*
* @param command The command whose state needs to be toggled
* @return the original value before toggling
*
* @throws ExecutionException
* When the command doesn't contain the toggle state or when the state doesn't contain a boolean value
*/
static bool ToggleCommandState(const SmartPointer<Command>& command);
/**
* Checks whether the radio state of the command is same as the radio state
* parameter's value
*
* @param event
* The execution event that contains the application context
* @return <code>true</code> whe the values are same, <code>false</code>
* otherwise
*
* @throws ExecutionException
* When the command doesn't have the radio state or the event
* doesn't have the radio state parameter
*/
static bool MatchesRadioState(const SmartPointer<ExecutionEvent>& event);
/**
* Updates the radio state of the command to the given value
*
* @param command
* the command whose state should be updated
* @param newState
* the new state
*
* @throws ExecutionException
* When the command doesn't have a radio state
*/
static void UpdateRadioState(const SmartPointer<Command>& command, const QString& newState);
};
}
#endif /*BERRYHANDLERUTIL_H_*/
diff --git a/Plugins/org.blueberry.ui.qt/src/handlers/berryIHandlerService.h b/Plugins/org.blueberry.ui.qt/src/handlers/berryIHandlerService.h
index aa732682a7..b4343a97c3 100755
--- a/Plugins/org.blueberry.ui.qt/src/handlers/berryIHandlerService.h
+++ b/Plugins/org.blueberry.ui.qt/src/handlers/berryIHandlerService.h
@@ -1,391 +1,379 @@
/*============================================================================
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 BERRYIHANDLERSERVICE_H_
#define BERRYIHANDLERSERVICE_H_
#include "services/berryIServiceWithSources.h"
#include "common/berryCommandExceptions.h"
namespace berry {
class Command;
class ExecutionEvent;
class ParameterizedCommand;
class Expression;
class UIElement;
struct IEvaluationContext;
struct IHandler;
struct IHandlerActivation;
/**
* <p>
* Provides services related to activating and deactivating handlers within the
* workbench.
* </p>
* <p>
* This service can be acquired from your service locator:
* <pre>
* IHandlerService service = (IHandlerService) getSite().getService(IHandlerService.class);
* </pre>
* <ul>
* <li>This service is available globally.</li>
* </ul>
* </p>
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
+ * @note This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be extended by clients.
*
* @since 3.1
*/
struct BERRY_UI_QT IHandlerService : public IServiceWithSources
{
berryObjectMacro(berry::IHandlerService);
~IHandlerService() override;
/**
* <p>
* Activates the given handler from a child service. This is used by slave
* and nested services to promote handler activations up to the root. By
* using this method, it is possible for handlers coming from a more nested
* component to override the nested component.
* </p>
*
* @param activation
* The activation that is local to the child service; must not be
* <code>null</code>.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
* activation will automatically be cancelled if the service locator
* context from which this service was retrieved is destroyed. This
* activation is local to this service (i.e., it is not the
* activation that is passed as a parameter).
* @since 3.2
*/
virtual SmartPointer<IHandlerActivation> ActivateHandler(const SmartPointer<IHandlerActivation>& activation) = 0;
/**
* <p>
* Activates the given handler within the context of this service. If this
* service was retrieved from the workbench, then this handler will be
* active globally. If the service was retrieved from a nested component,
* then the handler will only be active within that component.
* </p>
* <p>
* Also, it is guaranteed that the handlers submitted through a particular
* service will be cleaned up when that services is destroyed. So, for
* example, a service retrieved from a <code>IWorkbenchPartSite</code>
* would deactivate all of its handlers when the site is destroyed.
* </p>
*
* @param commandId
* The identifier for the command which this handler handles;
* must not be <code>null</code>.
* @param handler
* The handler to activate; must not be <code>null</code>.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
* activation will automatically be cancelled if the context from
* which this service was retrieved is destroyed.
*/
virtual SmartPointer<IHandlerActivation> ActivateHandler(
const QString& commandId, const SmartPointer<IHandler>& handler) = 0;
/**
* <p>
* Activates the given handler within the context of this service. The
* handler becomes active when <code>expression</code> evaluates to
* <code>true</code>. This is the same as calling
- * {@link #activateHandler(String, IHandler, Expression, boolean)} with
- * global==false.
+ * {@link #ActivateHandler} with \c global==false .
* </p>
* <p>
* Also, it is guaranteed that the handlers submitted through a particular
* service will be cleaned up when that service is destroyed. So, for
* example, a service retrieved from a <code>IWorkbenchPartSite</code>
* would deactivate all of its handlers when the site is destroyed.
* </p>
*
* @param commandId
* The identifier for the command which this handler handles;
* must not be <code>null</code>.
* @param handler
* The handler to activate; must not be <code>null</code>.
* @param expression
* This expression must evaluate to <code>true</code> before
* this handler will really become active. The expression may be
* <code>null</code> if the handler should always be active.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
* activation will automatically be cancelled if the context from
* which this service was retrieved is destroyed.
*
* @see org.eclipse.ui.ISources
* @since 3.2
*/
virtual SmartPointer<IHandlerActivation> ActivateHandler(
const QString& commandId,
const SmartPointer<IHandler>& handler,
const SmartPointer<Expression>& expression) = 0;
/**
* <p>
* Activates the given handler within the context of this service. The
* handler becomes active when <code>expression</code> evaluates to
* <code>true</code>. if global==<code>false</code>, then this
* handler service must also be the active service to active the handler.
* For example, the handler service on a part is active when that part is
* active.
* </p>
* <p>
* Also, it is guaranteed that the handlers submitted through a particular
* service will be cleaned up when that services is destroyed. So, for
* example, a service retrieved from a <code>IWorkbenchPartSite</code>
* would deactivate all of its handlers when the site is destroyed.
* </p>
*
* @param commandId
* The identifier for the command which this handler handles;
* must not be <code>null</code>.
* @param handler
* The handler to activate; must not be <code>null</code>.
* @param expression
* This expression must evaluate to <code>true</code> before
* this handler will really become active. The expression may be
* <code>null</code> if the handler should always be active.
* @param global
* Indicates that the handler should be activated irrespectively
* of whether the corresponding workbench component (e.g.,
* window, part, etc.) is active.
* @return A token which can be used to later cancel the activation. Only
* someone with access to this token can cancel the activation. The
* activation will automatically be cancelled if the context from
* which this service was retrieved is destroyed.
*
* @see org.eclipse.ui.ISources
* @since 3.2
*/
virtual SmartPointer<IHandlerActivation> ActivateHandler(
const QString& commandId,
const SmartPointer<IHandler>& handler,
const SmartPointer<Expression>& expression, bool global) = 0;
/**
* Creates an execution event based on an SWT event. This execution event
* can then be passed to a command for execution.
*
* @param command
* The command for which an execution event should be created;
* must not be <code>null</code>.
- * @param event
- * The SWT event triggering the command execution; may be
- * <code>null</code>.
+ * @param uielement
* @return An execution event suitable for calling
- * {@link Command#executeWithChecks(ExecutionEvent)}.
+ * {@link Command#ExecuteWithChecks}.
* @since 3.2
- * @see Command#executeWithChecks(ExecutionEvent)
+ * @see Command#ExecuteWithChecks
*/
virtual SmartPointer<const ExecutionEvent> CreateExecutionEvent(
const SmartPointer<const Command>& command,
const SmartPointer<const UIElement>& uielement) = 0;
/**
* Creates a parameterized execution event based on an SWT event and a
* parameterized command. This execution event can then be passed to a
* command for execution.
*
* @param command
* The parameterized command for which an execution event should
* be created; must not be <code>null</code>.
- * @param event
- * The SWT event triggering the command execution; may be
- * <code>null</code>.
+ * @param uielement
* @return An execution event suitable for calling
- * {@link Command#executeWithChecks(ExecutionEvent)}.
+ * {@link Command#ExecuteWithChecks}.
* @since 3.2
- * @see ParameterizedCommand#getCommand()
- * @see Command#executeWithChecks(ExecutionEvent)
+ * @see ParameterizedCommand#GetCommand
+ * @see Command#ExecuteWithChecks
*/
virtual SmartPointer<const ExecutionEvent> CreateExecutionEvent(
const SmartPointer<const ParameterizedCommand>& command,
const SmartPointer<const UIElement>& uielement) = 0;
/**
* Deactivates the given handler within the context of this service. If the
* handler was activated with a different service, then it must be
* deactivated from that service instead. It is only possible to retract a
* handler activation with this method. That is, you must have the same
* <code>IHandlerActivation</code> used to activate the handler.
*
* @param activation
* The token that was returned from a call to
* <code>activateHandler</code>; must not be <code>null</code>.
*/
virtual void DeactivateHandler(const SmartPointer<IHandlerActivation>& activation) = 0;
/**
* Deactivates the given handlers within the context of this service. If the
* handler was activated with a different service, then it must be
* deactivated from that service instead. It is only possible to retract a
* handler activation with this method. That is, you must have the same
* <code>IHandlerActivation</code> used to activate the handler.
*
* @param activations
* The tokens that were returned from a call to
* <code>activateHandler</code>. This collection must only
* contain instances of <code>IHandlerActivation</code>. The
* collection must not be <code>null</code>.
*/
virtual void DeactivateHandlers(
const QList<SmartPointer<IHandlerActivation> >& activations) = 0;
/**
* Executes the command with the given identifier and no parameters.
*
* @param commandId
* The identifier of the command to execute; must not be
* <code>null</code>.
- * @param event
- * The SWT event triggering the command execution; may be
- * <code>null</code>.
+ * @param uielement
* @return The return value from the execution; may be <code>null</code>.
* @throws ExecutionException
* If the handler has problems executing this command.
* @throws NotDefinedException
* If the command you are trying to execute is not defined.
* @throws NotEnabledException
* If the command you are trying to execute is not enabled.
* @throws NotHandledException
* If there is no handler.
* @since 3.2
- * @see Command#executeWithChecks(ExecutionEvent)
+ * @see Command#ExecuteWithChecks
*/
virtual Object::Pointer ExecuteCommand(const QString& commandId,
const SmartPointer<const UIElement>& uielement) = 0;
/**
* Executes the given parameterized command.
*
* @param command
* The parameterized command to be executed; must not be
* <code>null</code>.
- * @param event
- * The SWT event triggering the command execution; may be
- * <code>null</code>.
+ * @param uielement
* @return The return value from the execution; may be <code>null</code>.
* @throws ExecutionException
* If the handler has problems executing this command.
* @throws NotDefinedException
* If the command you are trying to execute is not defined.
* @throws NotEnabledException
* If the command you are trying to execute is not enabled.
* @throws NotHandledException
* If there is no handler.
* @since 3.2
- * @see Command#executeWithChecks(ExecutionEvent)
+ * @see Command#ExecuteWithChecks
*/
virtual Object::Pointer ExecuteCommand(const SmartPointer<ParameterizedCommand>& command,
const SmartPointer<const UIElement>& uielement) = 0;
/**
* Executes the given parameterized command in the provided context. It
* takes care of finding the correct active handler given the context, calls
- * {@link IHandler2#setEnabled(Object)} to update the enabled state if
+ * \c IHandler2.setEnabled(Object) to update the enabled state if
* supported, and executes with that handler.
*
* @param command
* The parameterized command to be executed; must not be
* <code>null</code>.
- * @param event
- * The SWT event triggering the command execution; may be
- * <code>null</code>.
+ * @param uielement
* @param context
* the evaluation context to run against. Must not be
* <code>null</code>
* @return The return value from the execution; may be <code>null</code>.
* @throws ExecutionException
* If the handler has problems executing this command.
* @throws NotDefinedException
* If the command you are trying to execute is not defined.
* @throws NotEnabledException
* If the command you are trying to execute is not enabled.
* @throws NotHandledException
* If there is no handler.
* @since 3.4
- * @see Command#executeWithChecks(ExecutionEvent)
- * @see #createContextSnapshot(boolean)
+ * @see Command#ExecuteWithChecks
+ * @see #CreateContextSnapshot
*/
virtual Object::Pointer ExecuteCommandInContext(
const SmartPointer<ParameterizedCommand>& command,
const SmartPointer<const UIElement>& uielement,
const SmartPointer<IEvaluationContext>& context) = 0;
/**
* This method creates a copy of the application context returned by
- * {@link #getCurrentState()}.
+ * {@link #GetCurrentState}.
*
* @param includeSelection
* if <code>true</code>, include the default variable and
* selection variables
* @return an context filled with the current set of variables. If selection
* is not included, the default variable is an empty collection
*/
virtual SmartPointer<IEvaluationContext> CreateContextSnapshot(bool includeSelection) = 0;
/**
* Returns an evaluation context representing the current state of the
* world. This is equivalent to the application context required by
* {@link ExecutionEvent}.
*
* @return the current state of the application; never <code>null</code>.
- * @see ParameterizedCommand#executeWithChecks(Object, Object)
- * @see ExecutionEvent#ExecutionEvent(Command, java.util.Map, Object,
- * Object)
- * @see org.eclipse.ui.services.IEvaluationService
+ * @see ParameterizedCommand#ExecuteWithChecks
+ * @see ExecutionEvent#ExecutionEvent
+ * @see IEvaluationService
*/
virtual SmartPointer<IEvaluationContext> GetCurrentState() const = 0;
/**
* <p>
* Reads the handler information from the registry. This will overwrite any
* of the existing information in the handler service. This method is
* intended to be called during start-up. When this method completes, this
* handler service will reflect the current state of the registry.
* </p>
*/
virtual void ReadRegistry() = 0;
/**
* Sets the help context identifier to associate with a particular handler.
*
* @param handler
* The handler with which to register a help context identifier;
* must not be <code>null</code>.
* @param helpContextId
* The help context identifier to register; may be
* <code>null</code> if the help context identifier should be
* removed.
* @since 3.2
*/
virtual void SetHelpContextId(const SmartPointer<IHandler>& handler, const QString& helpContextId) = 0;
};
}
Q_DECLARE_INTERFACE(berry::IHandlerService, "org.blueberry.ui.IHandlerService")
#endif /* BERRYIHANDLERSERVICE_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/handlers/berryToggleState.h b/Plugins/org.blueberry.ui.qt/src/handlers/berryToggleState.h
index ef5b138256..6282bb53c5 100644
--- a/Plugins/org.blueberry.ui.qt/src/handlers/berryToggleState.h
+++ b/Plugins/org.blueberry.ui.qt/src/handlers/berryToggleState.h
@@ -1,55 +1,55 @@
/*============================================================================
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 BERRYTOGGLESTATE_H
#define BERRYTOGGLESTATE_H
#include "internal/berryPersistentState.h"
namespace berry {
/**
* <p>
* A piece of state storing a \c bool.
* </p>
* <p>
- * If this state is registered using {@link IMenuStateIds#STYLE}, then it will
+ * If this state is registered using \c IMenuStateIds.STYLE , then it will
* control the presentation of the command if displayed in the menus, tool bars
* or status line.
* </p>
* <p>
* Clients may instantiate this class, but must not extend.
* </p>
*/
class ToggleState : public PersistentState
{
public:
/**
* Constructs a new <code>ToggleState</code>. By default, the toggle is
* off (e.g., <code>false</code>).
*/
ToggleState();
void Load(const SmartPointer<IPreferences>& store,
const QString& preferenceKey) override;
void Save(const SmartPointer<IPreferences>& store,
const QString& preferenceKey) override;
void SetValue(const Object::Pointer& value) override;
};
}
#endif // BERRYTOGGLESTATE_H
diff --git a/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroManager.h b/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroManager.h
index 697703c32e..bd238a103a 100644
--- a/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroManager.h
+++ b/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroManager.h
@@ -1,137 +1,136 @@
/*============================================================================
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 BERRYIINTROMANAGER_H_
#define BERRYIINTROMANAGER_H_
#include "berryIIntroPart.h"
#include <berryIWorkbenchWindow.h>
namespace berry
{
/**
* Manages the intro part that introduces the product to new users.
* The intro part is typically shown the first time a product is started up.
* <p>
* The initial behavior of the intro part is controlled by the application
- * from via the {@link org.eclipse.ui.application.WorkbenchWindowAdvisor#openIntro()}
+ * from via the {@link WorkbenchWindowAdvisor#OpenIntro()}
* method.
* </p>
* <p>
- * See {@link org.eclipse.ui.intro.IIntroPart} for details on where intro parts
+ * See {@link IIntroPart} for details on where intro parts
* come from.
* </p>
* <p>
* This interface is not intended to be extended or implemented by clients.
* </p>
*
* @see org.eclipse.ui.IWorkbench#getIntroManager()
* @since 3.0
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IIntroManager
{
virtual ~IIntroManager();
/**
* Closes the given intro part.
*
* @param part the intro part
* @return <code>true</code> if the intro part was closed, and
* <code>false</code> otherwise. <code>false</code> is returned
* if part is <code>null</code> or it is not the intro part returned
- * by {@link #getIntro()}.
+ * by {@link #GetIntro()}.
*/
virtual bool CloseIntro(IIntroPart::Pointer part) = 0;
/**
* Returns the intro part. Returns <code>null</code> if there is no intro
- * part, if it has been previously closed via {@link #closeIntro(IIntroPart)}
- * or if there is an intro part but {@link #showIntro(IWorkbenchWindow, boolean)}
+ * part, if it has been previously closed via {@link #CloseIntro}
+ * or if there is an intro part but {@link #ShowIntro}
* has not yet been called to create it.
*
* @return the intro part, or <code>null</code> if none is available
*/
virtual IIntroPart::Pointer GetIntro() const = 0;
/**
* Return whether an intro is available. Note that this checks whether
* there is an applicable intro part that could be instantiated and shown
* to the user.
- * Use {@link #getIntro()} to discover whether an intro part has already
+ * Use {@link #GetIntro} to discover whether an intro part has already
* been created.
*
* @return <code>true</code> if there is an intro that could be shown, and
* <code>false</code> if there is no intro
*/
virtual bool HasIntro() const = 0;
/**
* Return the standby state of the given intro part.
*
* @param part the intro part
* @return <code>true</code> if the part in its partially
* visible standy mode, and <code>false</code> if in its fully visible state.
* <code>false</code> is returned if part is <code>null</code> or it is not
- * the intro part returned by {@link #getIntro()}.
+ * the intro part returned by {@link #GetIntro}.
*/
virtual bool IsIntroStandby(IIntroPart::Pointer part) const = 0;
/**
* Sets the standby state of the given intro part. Intro part usually should
* render themselves differently in the full and standby modes. In standby
* mode, the part should be partially visible to the user but otherwise
* allow them to work. In full mode, the part should be fully visible and
* be the center of the user's attention.
* <p>
* This method does nothing if the part is <code>null</code> or is not
- * the intro part returned by {@link #getIntro()}.
+ * the intro part returned by {@link #GetIntro}.
* </p>
*
* @param part the intro part, or <code>null</code>
* @param standby <code>true</code> to put the part in its partially
* visible standy mode, and <code>false</code> to make it fully visible.
*/
virtual void SetIntroStandby(IIntroPart::Pointer part, bool standby) = 0;
/**
* Shows the intro part in the given workbench window. If the intro part has
* not been created yet, one will be created. If the intro part is currently
* being shown in some workbench window, that other window is made active.
*
* @param preferredWindow the preferred workbench window, or
* <code>null</code> to indicate the currently active workbench window
* @param standby <code>true</code> to put the intro part in its partially
* visible standy mode, and <code>false</code> to make it fully visible
* @return the newly-created or existing intro part, or <code>null</code>
* if no intro part is available or if <code>preferredWindow</code> is
* <code>null</code> and there is no currently active workbench window
*/
virtual IIntroPart::Pointer ShowIntro(
IWorkbenchWindow::Pointer preferredWindow, bool standby) = 0;
/**
* Returns <code>true</code> if there is an intro content detector and it
* reports that new intro content is available.
*
* @return <code>true</code> if new intro content is available
*
* @since 3.3
*/
virtual bool IsNewContentAvailable() = 0;
};
}
#endif /* BERRYIINTROMANAGER_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroPart.h b/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroPart.h
index d3378c7f9d..512f075bdb 100644
--- a/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroPart.h
+++ b/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroPart.h
@@ -1,209 +1,189 @@
/*============================================================================
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 BERRYIINTROPART_H_
#define BERRYIINTROPART_H_
#include <berryObject.h>
#include <berryMacros.h>
#include <berryIMemento.h>
#include <berryIPropertyChangeListener.h>
#include <berryUIException.h>
#include "berryIIntroSite.h"
#include <QObject>
namespace berry {
/**
* The intro part is a visual component within the workbench responsible for
* introducing the product to new users. The intro part is typically shown the
* first time a product is started up.
* <p>
* The intro part implementation is contributed to the workbench via the
* <code>org.blueberry.ui.intro</code> extension point. There can be several
* intro part implementations, and associations between intro part
* implementations and products. The workbench will only make use of the intro
* part implementation for the current product (as given by
* {@link berry::Platform#GetProduct()}. There is at most one
* intro part instance in the entire workbench, and it resides in exactly one
* workbench window at a time.
* </p>
* <p>
* This interface in not intended to be directly implemented. Rather, clients
* providing a intro part implementation should subclass
* {@link berry::IntroPart}.
* </p>
*
- * @see IIntroManager#ShowIntro(IWorkbenchWindow::Pointer, bool)
- * @noimplement This interface is not intended to be implemented by clients.
+ * @see IIntroManager#ShowIntro
*/
struct BERRY_UI_QT IIntroPart : public virtual Object
{ // IAdaptable {
berryObjectMacro(berry::IIntroPart);
~IIntroPart() override;
- /**
- * The property id for <code>getTitleImage</code> and
- * <code>getTitle</code>.
- *
- * @since 3.2 this property now covers changes to <code>getTitle</code> in
- * addition to <code>getTitleImage</code>
- */
- //static const int PROP_TITLE = IWorkbenchPart::PROP_TITLE;
-
/**
* Returns the site for this intro part.
*
* @return the intro site
*/
virtual IIntroSite::Pointer GetIntroSite() const = 0;
/**
* Initializes this intro part with the given intro site. A memento is
* passed to the part which contains a snapshot of the part state from a
* previous session. Where possible, the part should try to recreate that
* state.
* <p>
* This method is automatically called by the workbench shortly after
* part construction. It marks the start of the intro's lifecycle. Clients
* must not call this method.
* </p>
*
* @param site the intro site
* @param memento the intro part state or <code>null</code> if there is no previous
* saved state
* @exception PartInitException if this part was not initialized
* successfully
*/
virtual void Init(IIntroSite::Pointer site, IMemento::Pointer memento) = 0;
/**
* Sets the standby state of this intro part. An intro part should render
* itself differently in the full and standby modes. In standby mode, the
* part should be partially visible to the user but otherwise allow them
* to work. In full mode, the part should be fully visible and be the center
* of the user's attention.
* <p>
* This method is automatically called by the workbench at appropriate
* times. Clients must not call this method directly (call
- * {@link IIntroManager#setIntroStandby(IIntroPart, boolean)} instead.
+ * {@link IIntroManager#SetIntroStandby} instead.
* </p>
*
* @param standby <code>true</code> to put this part in its partially
* visible standy mode, and <code>false</code> to make it fully visible
*/
virtual void StandbyStateChanged(bool standby) = 0;
/**
* Saves the object state within a memento.
* <p>
* This method is automatically called by the workbench at appropriate
* times. Clients must not call this method directly.
* </p>
*
* @param memento a memento to receive the object state
*/
virtual void SaveState(IMemento::Pointer memento) = 0;
/**
* Adds a listener for changes to properties of this intro part.
* Has no effect if an identical listener is already registered.
- * <p>
- * The properties ids are as follows:
- * <ul>
- * <li><code>IIntroPart.PROP_TITLE</code> </li>
- * </ul>
- * </p>
*
* @param listener a property listener
*/
virtual void AddPropertyListener(IPropertyChangeListener* listener) = 0;
/**
* Creates the SWT controls for this intro part.
* <p>
* Clients should not call this method (the workbench calls this method when
* it needs to, which may be never).
* </p>
* <p>
* For implementors this is a multi-step process:
* <ol>
* <li>Create one or more controls within the parent.</li>
* <li>Set the parent layout as needed.</li>
* <li>Register any global actions with the <code>IActionService</code>.</li>
* <li>Register any popup menus with the <code>IActionService</code>.</li>
* <li>Register a selection provider with the <code>ISelectionService</code>
* (optional). </li>
* </ol>
* </p>
*
* @param parent the parent control
*/
virtual void CreatePartControl(void* parent) = 0;
/**
- * Returns the title image of this intro part. If this value changes
- * the part must fire a property listener event with
- * {@link IIntroPart#PROP_TITLE}.
+ * Returns the title image of this intro part.
* <p>
* The title image is usually used to populate the title bar of this part's
* visual container. Since this image is managed by the part itself, callers
* must <b>not</b> dispose the returned image.
* </p>
*
* @return the title image
*/
virtual QIcon GetTitleImage() const = 0;
/**
- * Returns the title of this intro part. If this value changes
- * the part must fire a property listener event with
- * {@link IIntroPart#PROP_TITLE}.
+ * Returns the title of this intro part.
* <p>
* The title is used to populate the title bar of this part's visual
* container.
* </p>
*
* @return the intro part title (not <code>null</code>)
*/
virtual QString GetPartName() const = 0;
/**
* Removes the given property listener from this intro part.
* Has no affect if an identical listener is not registered.
*
* @param listener a property listener
*/
virtual void RemovePropertyListener(IPropertyChangeListener* listener) = 0;
/**
* Asks this part to take focus within the workbench.
* <p>
* Clients should not call this method (the workbench calls this method at
* appropriate times). To have the workbench activate a part, use
- * {@link IIntroManager#showIntro(IWorkbenchWindow, boolean)}.
+ * {@link IIntroManager#ShowIntro}.
* </p>
*/
virtual void SetFocus() = 0;
};
}
Q_DECLARE_INTERFACE(berry::IIntroPart, "org.blueberry.ui.IIntroPart")
#endif /* BERRYIINTROPART_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroSite.h b/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroSite.h
index 4d3db03698..92fde8c48b 100644
--- a/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroSite.h
+++ b/Plugins/org.blueberry.ui.qt/src/intro/berryIIntroSite.h
@@ -1,68 +1,66 @@
/*============================================================================
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 BERRYIINTROSITE_H_
#define BERRYIINTROSITE_H_
#include <berryIWorkbenchSite.h>
namespace berry {
/**
* The primary interface between an intro part and the workbench.
* <p>
* The workbench exposes its implemention of intro part sites via this
* interface, which is not intended to be implemented or extended by clients.
* </p>
- *
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IIntroSite : public IWorkbenchSite
{
berryObjectMacro(berry::IIntroSite);
~IIntroSite() override;
/**
* Returns the part registry extension id for this intro site's part.
* <p>
* The name comes from the <code>id</code> attribute in the configuration
* element.
* </p>
*
* @return the registry extension id
*/
virtual QString GetId() const = 0;
/**
* Returns the unique identifier of the plug-in that defines this intro
* site's part.
*
* @return the unique identifier of the declaring plug-in
* @see org.eclipse.core.runtime.IPluginDescriptor#getUniqueIdentifier()
*/
virtual QString GetPluginId() const = 0;
/**
* Returns the action bars for this part site.
* The intro part has exclusive use of its site's action bars.
*
* @return the action bars
*/
//virtual IActionBars GetActionBars() const = 0;
};
}
#endif /* BERRYIINTROSITE_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/intro/berryIntroPart.h b/Plugins/org.blueberry.ui.qt/src/intro/berryIntroPart.h
index 3f1dc73399..fb46befce4 100644
--- a/Plugins/org.blueberry.ui.qt/src/intro/berryIntroPart.h
+++ b/Plugins/org.blueberry.ui.qt/src/intro/berryIntroPart.h
@@ -1,219 +1,206 @@
/*============================================================================
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 BERRYINTROPART_H_
#define BERRYINTROPART_H_
#include "berryIIntroPart.h"
#include "berryIIntroSite.h"
#include <berryIConfigurationElement.h>
#include <berryIExecutableExtension.h>
#include <berryIPropertyChangeListener.h>
#include <QIcon>
namespace berry
{
/**
* Abstract base implementation of an intro part.
* <p>
* Subclasses must implement the following methods:
* <ul>
* <li><code>CreatePartControl</code>- to create the intro part's controls
* </li>
* <li><code>SetFocus</code>- to accept focus</li>
* <li><code>StandbyStateChanged</code>- to change the standby mode</li>
* </ul>
* </p>
* <p>
* Subclasses may extend or reimplement the following methods as required:
* <ul>
* <li><code>SetInitializationData</code>- extend to provide additional
* initialization when the intro extension is instantiated</li>
* <li><code>Init(IIntroSite::Pointer, IMemento::Pointer)</code>- extend to provide additional
* initialization when intro is assigned its site</li>
* <li><code>GetAdapter</code>- reimplement to make their intro adaptable
* </li>
* </ul>
* </p>
*/
class BERRY_UI_QT IntroPart: public QObject, public IIntroPart, public IExecutableExtension
{
Q_OBJECT
Q_INTERFACES(berry::IIntroPart berry::IExecutableExtension)
private:
IConfigurationElement::Pointer configElement;
QIcon imageDescriptor;
IIntroSite::Pointer partSite;
QString titleLabel;
IPropertyChangeListener::Events propChangeEvents;
/**
* Return the default title string.
*
* @return the default title string
*/
QString GetDefaultTitle() const;
protected:
/**
* Fires a property changed event.
*
* @param propertyId
* the id of the property that changed
*/
void FirePropertyChange(int propertyId);
/**
* Returns the configuration element for this part. The configuration
* element comes from the plug-in registry entry for the extension defining
* this part.
*
* @return the configuration element for this part
*/
IConfigurationElement::Pointer GetConfigurationElement();
/**
* Returns the default title image.
*
* @return the default image
*/
QIcon GetDefaultImage() const;
/**
* Sets the part site.
* <p>
- * Subclasses must invoke this method from {@link org.eclipse.ui.intro.IIntroPart#init(IIntroSite, IMemento)}.
+ * Subclasses must invoke this method from {@link IIntroPart#Init}.
* </p>
*
* @param site the intro part site
*/
void SetSite(IIntroSite::Pointer site);
/**
* Sets or clears the title image of this part.
*
* @param titleImage
* the title image, or <code>null</code> to clear
*/
void SetTitleImage(const QIcon& titleImage);
/**
* Set the title string for this part.
*
* @param titleLabel the title string. Must not be <code>null</code>.
* @since 3.2
*/
void SetTitle(const QString& titleLabel);
public:
/* (non-Javadoc)
* @see org.eclipse.ui.intro.IIntroPart#addPropertyListener(org.eclipse.ui.IPropertyListener)
*/
void AddPropertyListener(IPropertyChangeListener* l) override;
/**
* The <code>IntroPart</code> implementation of this
* <code>IIntroPart</code> method disposes the title image loaded by
* <code>setInitializationData</code>. Subclasses may extend.
*/
~IntroPart() override;
- /**
- * This implementation of the method declared by <code>IAdaptable</code>
- * passes the request along to the platform's adapter manager; roughly
- * <code>Platform.getAdapterManager().getAdapter(this, adapter)</code>.
- * Subclasses may override this method (however, if they do so, they should
- * invoke the method on their superclass to ensure that the Platform's
- * adapter manager is consulted).
- */
- // Object getAdapter(Class adapter) {
- // return Platform.getAdapterManager().getAdapter(this, adapter);
- // }
-
-
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.intro.IIntroPart#getIntroSite()
*/
IIntroSite::Pointer GetIntroSite() const override;
/* (non-Javadoc)
* @see org.eclipse.ui.intro.IIntroPart#getTitleImage()
*/
QIcon GetTitleImage() const override;
/* (non-Javadoc)
* @see org.eclipse.ui.intro.IIntroPart#getTitle()
*/
QString GetPartName() const override;
/**
- * The base implementation of this {@link org.eclipse.ui.intro.IIntroPart}method ignores the
+ * The base implementation of this {@link IIntroPart} method ignores the
* memento and initializes the part in a fresh state. Subclasses may extend
* to perform any state restoration, but must call the super method.
*
* @param site
* the intro site
* @param memento
* the intro part state or <code>null</code> if there is no
* previous saved state
* @exception PartInitException
* if this part was not initialized successfully
*/
void Init(IIntroSite::Pointer site, IMemento::Pointer memento) override;
/* (non-Javadoc)
- * @see org.eclipse.ui.intro.IIntroPart#removePropertyListener(org.eclipse.ui.IPropertyListener)
+ * @see IIntroPart#RemovePropertyListener
*/
void RemovePropertyListener(IPropertyChangeListener* l) override;
/**
- * The base implementation of this {@link org.eclipse.ui.intro.IIntroPart} method does nothing.
+ * The base implementation of this {@link IIntroPart} method does nothing.
* Subclasses may override.
*
* @param memento
* a memento to receive the object state
*/
void SaveState(IMemento::Pointer memento) override;
/**
* The <code>IntroPart</code> implementation of this
* <code>IExecutableExtension</code> records the configuration element in
* and internal state variable (accessible via <code>getConfigElement</code>).
* It also loads the title image, if one is specified in the configuration
* element. Subclasses may extend.
*
* Should not be called by clients. It is called by the core plugin when
* creating this executable extension.
*/
void SetInitializationData(const IConfigurationElement::Pointer& cfig,
const QString& propertyName, const Object::Pointer& data) override;
};
}
#endif /* BERRYINTROPART_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/presentations/berryIPresentablePart.h b/Plugins/org.blueberry.ui.qt/src/presentations/berryIPresentablePart.h
index 36f5615a04..0743ec1ecb 100755
--- a/Plugins/org.blueberry.ui.qt/src/presentations/berryIPresentablePart.h
+++ b/Plugins/org.blueberry.ui.qt/src/presentations/berryIPresentablePart.h
@@ -1,266 +1,265 @@
/*============================================================================
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 BERRYIPRESENTABLEPART_H_
#define BERRYIPRESENTABLEPART_H_
#include <berryMacros.h>
#include "berryISizeProvider.h"
#include "berryIPropertyChangeListener.h"
class QToolBar;
namespace berry {
/**
* This is a skin's interface to the contents of a view or editor. Note that this
* is essentially the same as IWorkbenchPart, except it does not provide access
* to lifecycle events and allows repositioning of the part.
*
* Not intended to be implemented by clients.
*
* @since 3.0
- * @since 3.4 now extends {@link org.blueberry.ui.ISizeProvider}
- * @noimplement This interface is not intended to be implemented by clients.
+ * @since 3.4 now extends {@link ISizeProvider}
*/
struct BERRY_UI_QT IPresentablePart : public Object, public ISizeProvider {
berryObjectMacro(berry::IPresentablePart);
~IPresentablePart() override;
/**
* The property id for <code>isDirty</code>.
*/
static const int PROP_DIRTY; // = IWorkbenchPartConstants.PROP_DIRTY;
/**
* The property id for <code>getEditorInput</code>.
*/
static const int PROP_INPUT; // = IWorkbenchPartConstants.PROP_INPUT;
/**
* The property id for <code>getTitle</code>, <code>getTitleImage</code>
* and <code>getTitleToolTip</code>.
*/
static const int PROP_TITLE; // = IWorkbenchPartConstants.PROP_TITLE;
/**
* The property id for <code>IWorkbenchPart2.getContentDescription()</code>
*/
static const int PROP_CONTENT_DESCRIPTION; // = IWorkbenchPartConstants.PROP_CONTENT_DESCRIPTION;
/**
* The property id for <code>IWorkbenchPart2.getContentDescription()</code>
*/
static const int PROP_PART_NAME; // = IWorkbenchPartConstants.PROP_PART_NAME;
/**
* The property id for <code>isBusy</code>.
*/
static const int PROP_BUSY; // = 0x92;
/**
* The property id for toolbar changes
*/
static const int PROP_TOOLBAR; // = 0x93;
/**
* The property id for highlighting the
* part if it is not in front.
*/
static const int PROP_HIGHLIGHT_IF_BACK; // = 0x94;
/**
* The property id for pane menu changes
*/
static const int PROP_PANE_MENU; // = 0x302;
/**
* The property id for preferred size changes
* @since 3.4
*/
static const int PROP_PREFERRED_SIZE; // = IWorkbenchPartConstants.PROP_PREFERRED_SIZE;
/**
* Sets the bounds of this part.
*
* @param bounds bounding rectangle (not null)
*/
virtual void SetBounds(const QRect& bounds) = 0;
/**
* Notifies the part whether or not it is visible in the current
* perspective. A part is visible iff any part of its widgetry can
* be seen.
*
* @param isVisible true if the part has just become visible, false
* if the part has just become hidden
*/
virtual void SetVisible(bool isVisible) = 0;
/**
* Forces this part to have focus.
*/
virtual void SetFocus() = 0;
/**
* Adds a listener for changes to properties of this workbench part.
* Has no effect if an identical listener is already registered.
* <p>
* The properties ids are defined by the PROP_* constants, above.
* </p>
*
* @param listener a property listener (not null)
*/
virtual void AddPropertyListener(IPropertyChangeListener* listener) = 0;
/**
* Remove a listener that was previously added using addPropertyListener.
*
* @param listener a property listener (not null)
*/
virtual void RemovePropertyListener(IPropertyChangeListener* listener) = 0;
/**
* Returns the short name of the part. This is used as the text on
* the tab when this part is stacked on top of other parts.
*
* @return the short name of the part (not null)
*/
virtual QString GetName() const = 0;
/**
* Returns the title of this workbench part. If this value changes
* the part must fire a property listener event with
* <code>PROP_TITLE</code>.
* <p>
* The title is used to populate the title bar of this part's visual
* container.
* </p>
*
* @return the workbench part title (not null)
*/
virtual QString GetTitle() const = 0;
/**
* Returns the status message from the part's title, or the empty string if none.
* This is a substring of the part's title. A typical title will consist of
* the part name, a separator, and a status message describing the current contents.
* <p>
* Presentations can query getName() and getTitleStatus() if they want to display
* the status message and name separately, or they can use getTitle() if they want
* to display the entire title.
* </p>
*
* @return the status message or the empty string if none (not null)
*/
virtual QString GetTitleStatus() const = 0;
/**
* Returns the title image of this workbench part. If this value changes
* the part must fire a property listener event with
* <code>PROP_TITLE</code>.
* <p>
* The title image is usually used to populate the title bar of this part's
* visual container. Since this image is managed by the part itself, callers
* must <b>not</b> dispose the returned image.
* </p>
*
* @return the title image
*/
virtual QIcon GetTitleImage() = 0;
/**
* Returns the title tool tip text of this workbench part. If this value
* changes the part must fire a property listener event with
* <code>PROP_TITLE</code>.
* <p>
* The tool tip text is used to populate the title bar of this part's
* visual container.
* </p>
*
* @return the workbench part title tool tip (not null)
*/
virtual QString GetTitleToolTip() const = 0;
/**
* Returns true iff the contents of this part have changed recently. For
* editors, this indicates that the part has changed since the last save.
* For views, this indicates that the view contains interesting changes
* that it wants to draw the user's attention to.
*
* @return true iff the part is dirty
*/
virtual bool IsDirty() const = 0;
/**
* Return true if the the receiver is currently in a busy state.
* @return boolean true if busy
*/
virtual bool IsBusy() const = 0;
/**
* Returns true iff this part can be closed
*
* @return true iff this part can be closed
* @since 3.1
*/
virtual bool IsCloseable() const = 0;
/**
* Returns the local toolbar for this part, or null if this part does not
* have a local toolbar. Callers must not dispose or downcast the return value.
*
* @return the local toolbar for the part, or null if none
*/
virtual QToolBar* GetToolBar() = 0;
/**
* Returns the menu for this part or null if none
*
* @return the menu for this part or null if none
*/
//virtual IPartMenu getMenu();
/**
* Returns an SWT control that can be used to indicate the tab order for
* this part. This can be returned as part of the result to
- * {@link StackPresentation#getTabList(IPresentablePart)}. Any other use of this control is
+ * {@link StackPresentation#GetTabList}. Any other use of this control is
* unsupported. This may return a placeholder control that is only
* meaningful in the context of <code>getTabList</code>.
*
* @return the part's control (not null)
*/
virtual QWidget* GetControl() = 0;
/**
* Get a property from the part's arbitrary property set.
* <p>
* <b>Note:</b> this is a different set of properties than the ones covered
* by the PROP_* constants.
* </p>
*
* @param key
* The property key to retrieve. Must not be <code>null</code>.
* @return the property, or <code>null</code> if that property is not set.
* @since 3.3
*/
virtual QString GetPartProperty(const QString& key) const = 0;
};
}
#endif /* BERRYIPRESENTABLEPART_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/presentations/berryIPresentationSerializer.h b/Plugins/org.blueberry.ui.qt/src/presentations/berryIPresentationSerializer.h
index 973ba9de2a..ed7ffc4cba 100755
--- a/Plugins/org.blueberry.ui.qt/src/presentations/berryIPresentationSerializer.h
+++ b/Plugins/org.blueberry.ui.qt/src/presentations/berryIPresentationSerializer.h
@@ -1,62 +1,62 @@
/*============================================================================
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 BERRYIPRESENTATIONSERIALIZER_H_
#define BERRYIPRESENTATIONSERIALIZER_H_
#include "berryIPresentablePart.h"
#include <QString>
namespace berry {
/**
* This interface is given to a StackPresentation when it is loading or saving
* its state.
*
* Not intended to be implemented by clients
*
* @since 3.0
- * @noimplement This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IPresentationSerializer {
/**
* Returns a unique identifier for the given part. The identifier can later
* be used to restore the original part by calling getPart(...). This identifier
* is guaranteed to be unique within a particular StackPresentation. However,
* the same part may be assigned a different ID each time the presentation is saved.
*
* @param part a part to be identified (not null)
* @return a unique identifier for the part (not null)
*/
virtual QString GetId(IPresentablePart::Pointer part) = 0;
/**
* Returns a presentable part, given an id that was generated when the presentation
* was saved.
*
* @param id an ID that was generated by getId(IPresentablePart) when the presentation
* was saved
* @return the presentable part associated with the given id, or null if none. Note
* that even if the ID was valid when the presentation was saved, it may not
* be valid when the presentation is restored. Callers must be prepared
* to handle a null result.
*/
virtual IPresentablePart::Pointer GetPart(const QString& id) = 0;
virtual ~IPresentationSerializer();
};
}
#endif /* BERRYIPRESENTATIONSERIALIZER_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/presentations/berryIStackPresentationSite.h b/Plugins/org.blueberry.ui.qt/src/presentations/berryIStackPresentationSite.h
index 0b460acee5..089152e7c4 100755
--- a/Plugins/org.blueberry.ui.qt/src/presentations/berryIStackPresentationSite.h
+++ b/Plugins/org.blueberry.ui.qt/src/presentations/berryIStackPresentationSite.h
@@ -1,188 +1,187 @@
/*============================================================================
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 BERRYISTACKPRESENTATIONSITE_H_
#define BERRYISTACKPRESENTATIONSITE_H_
#include <berryMacros.h>
#include <list>
#include "berryIPresentablePart.h"
#include <org_blueberry_ui_qt_Export.h>
namespace berry
{
/**
* Represents the main interface between a StackPresentation and the workbench.
*
* Not intended to be implemented by clients.
*
* @since 3.0
- * @noimplement This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IStackPresentationSite : public Object
{
berryObjectMacro(berry::IStackPresentationSite);
static int STATE_MINIMIZED; // = 0;
static int STATE_MAXIMIZED; // = 1;
static int STATE_RESTORED; // = 2;
~IStackPresentationSite() override;
/**
* Sets the state of the container. Called by the presentation when the
* user causes the the container to be minimized, maximized, etc.
*
* @param newState one of the STATE_* constants
*/
virtual void SetState(int newState) = 0;
/**
* Returns the current state of the site (one of the STATE_* constants)
*
* @return the current state of the site (one of the STATE_* constants)
*/
virtual int GetState() = 0;
/**
* Returns true iff the site supports the given state
*
* @param state one of the STATE_* constants, above
* @return true iff the site supports the given state
*/
virtual bool SupportsState(int state) = 0;
/**
* Begins dragging the given part
*
* @param beingDragged the part to drag (not null)
* @param initialPosition the mouse position at the time of the initial mousedown
* (display coordinates, not null)
* @param keyboard true iff the drag was initiated via mouse dragging,
* and false if the drag may be using the keyboard
*/
virtual void DragStart(IPresentablePart::Pointer beingDragged,
QPoint& initialPosition, bool keyboard) = 0;
/**
* Closes the given set of parts.
*
* @param toClose the set of parts to close (Not null. All of the entries must be non-null)
*/
virtual void Close(const QList<IPresentablePart::Pointer>& toClose) = 0;
/**
* Begins dragging the entire stack of parts
*
* @param initialPosition the mouse position at the time of the initial mousedown (display coordinates,
* not null)
* @param keyboard true iff the drag was initiated via mouse dragging,
* and false if the drag may be using the keyboard
*/
virtual void DragStart(QPoint& initialPosition, bool keyboard) = 0;
/**
* Returns true iff this site will allow the given part to be closed
*
* @param toClose part to test (not null)
* @return true iff the part may be closed
*/
virtual bool IsCloseable(IPresentablePart::Pointer toClose) = 0;
/**
* Returns true iff the given part can be dragged. If this
* returns false, the given part should not trigger a drag.
*
* @param toMove part to test (not null)
* @return true iff this part is a valid drag source
*/
virtual bool IsPartMoveable(IPresentablePart::Pointer toMove) = 0;
/**
* Returns true iff this entire stack can be dragged
*
* @return true iff the stack can be dragged
*/
virtual bool IsStackMoveable() = 0;
/**
* Makes the given part active
*
* @param toSelect
*/
virtual void SelectPart(IPresentablePart::Pointer toSelect) = 0;
/**
* Returns the currently selected part or null if the stack is empty
*
* @return the currently selected part or null if the stack is empty
*/
virtual IPresentablePart::Pointer GetSelectedPart() = 0;
/**
* Adds system actions to the given menu manager. The site may
* make use of the following group ids:
* <ul>
* <li><code>close</code>, for close actions</li>
* <li><code>size</code>, for resize actions</li>
* <li><code>misc</code>, for miscellaneous actions</li>
* </ul>
* The presentation can control the insertion position by creating
* these group IDs where appropriate.
*
* @param menuManager the menu manager to populate
*/
//virtual void AddSystemActions(IMenuManager menuManager);
/**
* Notifies the workbench that the preferred size of the presentation has
* changed. Hints to the workbench that it should trigger a layout at the
* next opportunity.
*
* @since 3.1
*/
virtual void FlushLayout() = 0;
/**
* Returns the list of presentable parts currently in this site
*
* @return the list of presentable parts currently in this site
* @since 3.1
*/
virtual QList<IPresentablePart::Pointer> GetPartList() = 0;
/**
* Returns the property with the given id or <code>null</code>. Folder
* properties are an extensible mechanism for perspective authors to
* customize the appearance of view stacks. The list of customizable
* properties is determined by the presentation factory, and set in the
* perspective factory.
*
* @param id
* Must not be <code>null</code>.
* @return property value, or <code>null</code> if the property is not
* set.
* @since 3.3
*/
virtual QString GetProperty(const QString& id) = 0;
};
}
#endif /* BERRYISTACKPRESENTATIONSITE_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/services/berryIDisposable.h b/Plugins/org.blueberry.ui.qt/src/services/berryIDisposable.h
index d1332c8656..31f514b014 100755
--- a/Plugins/org.blueberry.ui.qt/src/services/berryIDisposable.h
+++ b/Plugins/org.blueberry.ui.qt/src/services/berryIDisposable.h
@@ -1,63 +1,63 @@
/*============================================================================
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 BERRYIDISPOSABLE_H_
#define BERRYIDISPOSABLE_H_
#include <org_blueberry_ui_qt_Export.h>
#include <berryObject.h>
#include <berryMacros.h>
namespace berry {
/**
* <p>
* The interface that should be implemented by services that make themselves
* available through the <code>IAdaptable</code> mechanism. This is the
* interface that drives the majority of services provided at the workbench
* level.
* </p>
* <p>
* A service has life-cycle. When the constructor completes, the service must be
* fully functional. When it comes time for the service to go away, then the
- * service will receive a {@link #dispose()} call. At this point, the service
+ * service will receive a {@link #Dispose} call. At this point, the service
* must release all resources and detach all listeners. A service can only be
* disposed once; it cannot be reused.
* </p>
* <p>
* This interface has nothing to do with OSGi services.
* </p>
* <p>
* This interface can be extended or implemented by clients.
* </p>
*/
struct IDisposable : public virtual Object
{
berryObjectMacro(berry::IDisposable);
~IDisposable() override;
/**
* Disposes of this service. All resources must be freed. All listeners must
* be detached. Dispose will only be called once during the life cycle of a
* service.
*/
virtual void Dispose() = 0;
};
}
#endif /* BERRYIDISPOSABLE_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationReference.h b/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationReference.h
index 09608163c0..afcd3965b7 100644
--- a/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationReference.h
+++ b/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationReference.h
@@ -1,53 +1,53 @@
/*============================================================================
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 BERRYIEVALUATIONREFERENCE_H
#define BERRYIEVALUATIONREFERENCE_H
#include "internal/berryIEvaluationResultCache.h"
namespace berry {
struct IPropertyChangeListener;
/**
* A token representing a core expression and property change listener currently
* working in the <code>IEvaluationService</code>.
*
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
+ * @note This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be extended by clients.
*/
struct IEvaluationReference : public virtual IEvaluationResultCache
{
berryObjectMacro(berry::IEvaluationReference);
/**
* The property change listener associated with the evaluated expression.
*
* @return the listener for updates.
*/
virtual IPropertyChangeListener* GetListener() const = 0;
/**
* The property used in change notifications.
*
* @return the property name.
*/
virtual QString GetProperty() const = 0;
};
}
#endif // BERRYIEVALUATIONREFERENCE_H
diff --git a/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationService.h b/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationService.h
index 7f6c9d9f13..72334e47fe 100644
--- a/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationService.h
+++ b/Plugins/org.blueberry.ui.qt/src/services/berryIEvaluationService.h
@@ -1,209 +1,207 @@
/*============================================================================
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 BERRYIEVALUATIONSERVICE_H
#define BERRYIEVALUATIONSERVICE_H
#include <berryIServiceWithSources.h>
#include <org_blueberry_ui_qt_Export.h>
namespace berry {
struct IEvaluationContext;
struct IEvaluationReference;
struct IPropertyChangeListener;
class Expression;
/**
* Evaluate a core expression against the workbench application context and
* report updates using a Boolean property. Clients supply an
* <code>IPropertyChangeListener</code> that will be notified as changes
* occur.
* <p>
* This can be used to implement core expressions in client extension points
* similar to the &lt;enabledWhen&gt; of
* <code>org.blueberry.ui.handlers/handler</code> elements.
* </p>
* <p>
* The service will fire <code>TRUE</code> and
* <code>FALSE</code> for the oldValue and newValue in the property
* change events.
* </p>
* <p>
* Adding the evaluation listener will fire one change with oldValue=<code>null</code>
* and newValue=&quot;evaluated expression&quot;. Remove the
* <code>IEvaluationReference</code> will fire one change with
* oldValue=&quot;last evaluated value&quot; and newValue=<code>null</code>.
* </p>
* <p>
* Adding a service listener will fire the {@link #PROP_NOTIFYING} property
* change event with newValue=<code>TRUE</code> when a source change
* causes expression evaluations to update and another {@link #PROP_NOTIFYING}
* property change event with newValue=<code>FALSE</code> when the
* changes that started with a specific source change have finished. The
* {@link #PROP_NOTIFYING} change events will not be fired for source changes
* caused by the outer most recalculations.
* </p>
* <p>
* Variable sources can be provided to this service using the <code>org.blueberry.ui.services</code>
* Extension Point. This makes the available to &lt;with/&gt; expressions.
* </p>
* <p>
* This service can be acquired from your service locator:
* <pre>
* IEvaluationService::Pointer service = GetSite()->GetService(IEvaluationService::GetManifestName());
* </pre>
* <ul>
* <li>This service is available globally.</li>
* </ul>
* </p>
*
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be extended by clients.
+ * @note This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IEvaluationService : public IServiceWithSources
{
berryObjectMacro(berry::IEvaluationService);
/**
* A general property that can be used.
*/
static const QString RESULT; // = "org.blueberry.ui.services.result";
/**
* The property used to notify any service listeners.
*/
static const QString PROP_NOTIFYING; // = "org.blueberry.ui.services.notifying";
/**
* When a source change starts recalculating expressions the
* {@link #PROP_NOTIFYING} property change is fired with the newValue=<code>TRUE</code>.
* This property is not fired for any source changes caused by the outer
* recalculations.
* <p>
* <b>Note:</b> listeners should be removed when no longer necessary. If
* not, they will be removed when the IServiceLocator used to acquire this
* service is disposed.
* </p>
*
* @param listener
* The listener to be notified. Must not be <code>null</code>.
* Has no effect if the listener has already been added.
*/
virtual void AddServiceListener(IPropertyChangeListener* listener) = 0;
/**
* Remove the listener for {@link #PROP_NOTIFYING} property changes.
*
* @param listener
* The listener to remove. Must not be <code>null</code>. Has
* no effect if the listener is not currently registered.
*/
virtual void RemoveServiceListener(IPropertyChangeListener* listener) = 0;
/**
* Add a listener that can be notified when the workbench application
* context causes the expression evaluation value to change.
* <p>
* <b>Note:</b> listeners should be removed when no longer necessary. If
* not, they will be removed when the IServiceLocator used to acquire this
* service is disposed.
* </p>
*
* @param expression
* the core expression to evaluate.
* @param listener
* the listener to be notified.
* @param property
* the property contained in the notification
* @return a token that can be used to remove this listener.
- * {@link #removeEvaluationListener(IEvaluationReference)}
+ * {@link #RemoveEvaluationListener}
*/
virtual SmartPointer<IEvaluationReference> AddEvaluationListener(
const SmartPointer<Expression>& expression,
IPropertyChangeListener* listener,
const QString& property) = 0;
/**
* Re-add a property change listener that has already been removed by
- * {@link #removeEvaluationListener(IEvaluationReference)}.
+ * {@link #RemoveEvaluationListener}.
* <p>
* It will only accept IEvaluationReferences returned from a previous call
- * to
- * {@link #addEvaluationListener(Expression, IPropertyChangeListener, String)}
- * on this service.
+ * to {@link #AddEvaluationListener} on this service.
* </p>
* <p>
* <b>Note:</b> references should be removed when no longer necessary. If
* not, they will be removed when the IServiceLocator used to acquire this
* service is disposed.
* </p>
*
* @param ref
* The listener to re-add.
- * @see #removeEvaluationListener(IEvaluationReference)
+ * @see #RemoveEvaluationListener
*/
virtual void AddEvaluationReference(const SmartPointer<IEvaluationReference>& ref) = 0;
/**
* Remove the listener represented by the evaluation reference.
*
* @param ref
* the reference to be removed.
*/
virtual void RemoveEvaluationListener(const SmartPointer<IEvaluationReference>& ref) = 0;
/**
* Get an IEvaluationContext that contains the current state of the
* workbench application context. This context changes with the application
* state, but becomes invalid when the global current selection changes.
* <p>
* Note: This context should not be modified.
* </p>
*
* @return the latest context.
* @see ISources#ACTIVE_CURRENT_SELECTION_NAME
*/
virtual SmartPointer<IEvaluationContext> GetCurrentState() const = 0;
/**
* Request that this service re-evaluate all registered core expressions
* that contain a property tester for the given property name. This will
* fire a {@link #PROP_NOTIFYING} property change event to service
* listeners.
* <p>
* Notes:
* <ul>
* <li>the property must be able to return the new value before this
* re-evaluation is requested</li>
* <li>limit calls to this method to avoid unnecessary churn</li>
* <li>A re-evaluation that does not change the value of an expression will
* not fire a property change event</li>
* </ul>
* </p>
*
* @param propertyName
* The fully qualified property name, like
* <code>org.eclipse.core.resources.name</code>. Must not be
* <code>null</code>.
*/
virtual void RequestEvaluation(const QString& propertyName) = 0;
};
}
Q_DECLARE_INTERFACE(berry::IEvaluationService, "org.blueberry.ui.IEvaluationService")
#endif // BERRYIEVALUATIONSERVICE_H
diff --git a/Plugins/org.blueberry.ui.qt/src/services/berryIServiceFactory.h b/Plugins/org.blueberry.ui.qt/src/services/berryIServiceFactory.h
index e805576c54..204046e379 100755
--- a/Plugins/org.blueberry.ui.qt/src/services/berryIServiceFactory.h
+++ b/Plugins/org.blueberry.ui.qt/src/services/berryIServiceFactory.h
@@ -1,73 +1,71 @@
/*============================================================================
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 BERRYISERVICEFACTORY_H_
#define BERRYISERVICEFACTORY_H_
#include <org_blueberry_ui_qt_Export.h>
#include <QObject>
namespace berry {
struct IServiceLocator;
class Object;
/**
* A factory for creating services for use with the
* <code>org.blueberry.ui.services</code> extension point. You are given a
* service locator to look up other services, and can retrieve your parent
* service (if one has already been created).
*/
struct BERRY_UI_QT IServiceFactory {
virtual ~IServiceFactory();
/**
* When a service locator cannot find a service it will request one from the
* registry, which will call this factory create method.
* <p>
* You can use the locator to get any needed services and a parent service
* locator will be provided if you need access to the parent service. If the
* parent object return from the parent locator is not <code>null</code>
* it can be cast to the service interface that is requested. The parent
* service locator will only return the serviceInterface service.
* </p>
*
- * @param serviceInterface
- * the service we need to create. Will not be <code>null</code>.
* @param parentLocator
* A locator that can return a parent service instance if
* desired. The parent service can be cast to serviceInterface.
* Will not be <code>null</code>.
* @param locator
* the service locator which can be used to retrieve dependent
* services. Will not be <code>null</code>
* @return the created service or <code>null</code>
*/
template<class S>
S* Create(IServiceLocator* parentLocator, IServiceLocator* locator) const
{
return dynamic_cast<S*>(this->Create(qobject_interface_iid<S*>(), parentLocator, locator));
}
virtual Object* Create(const QString& serviceInterface,
IServiceLocator* parentLocator, IServiceLocator* locator) const = 0;
};
}
Q_DECLARE_INTERFACE(berry::IServiceFactory, "org.blueberry.ui.IServiceFactory")
#endif /* BERRYISERVICEFACTORY_H_ */
diff --git a/Plugins/org.blueberry.ui.qt/src/services/berryIServiceScopes.h b/Plugins/org.blueberry.ui.qt/src/services/berryIServiceScopes.h
index 85ccc77cab..7088cde36f 100644
--- a/Plugins/org.blueberry.ui.qt/src/services/berryIServiceScopes.h
+++ b/Plugins/org.blueberry.ui.qt/src/services/berryIServiceScopes.h
@@ -1,67 +1,67 @@
/*============================================================================
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 BERRYISERVICESCOPES_H
#define BERRYISERVICESCOPES_H
#include <QString>
#include <org_blueberry_ui_qt_Export.h>
namespace berry {
/**
* Different levels of service locators supported by the workbench.
*
- * @noextend This interface is not intended to be extended by clients.
- * @noimplement This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be extended by clients.
+ * @note This interface is not intended to be implemented by clients.
*/
struct BERRY_UI_QT IServiceScopes
{
/**
* The global service locator scope.
*/
static const QString WORKBENCH_SCOPE; // = "org.blueberry.ui.IWorkbench";
/**
* A sub-scope to the global scope that is not the workbench window.
*/
static const QString DIALOG_SCOPE; // = "org.blueberry.ui.IDialog";
/**
* A workbench window service locator scope.
*/
static const QString WINDOW_SCOPE; // = "org.blueberry.ui.IWorkbenchWindow";
/**
* A part site service locator scope. Found in editors and views.
*/
static const QString PARTSITE_SCOPE; // = "org.blueberry.ui.IWorkbenchPartSite";
/**
* A page site service locator scope. Found in pages in a PageBookView.
*/
static const QString PAGESITE_SCOPE; // = "org.blueberry.ui.PageSite";
/**
* An editor site within a MultiPageEditorPart.
*/
static const QString MPESITE_SCOPE; // = "org.blueberry.ui.MultiPageEditorSite";
private:
IServiceScopes();
};
}
#endif // BERRYISERVICESCOPES_H
diff --git a/Plugins/org.blueberry.ui.qt/src/services/berryISourceProviderService.h b/Plugins/org.blueberry.ui.qt/src/services/berryISourceProviderService.h
index c6d096ba9a..1ad8e2a6fd 100644
--- a/Plugins/org.blueberry.ui.qt/src/services/berryISourceProviderService.h
+++ b/Plugins/org.blueberry.ui.qt/src/services/berryISourceProviderService.h
@@ -1,85 +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 BERRYISOURCEPROVIDERSERVICE_H
#define BERRYISOURCEPROVIDERSERVICE_H
#include "org_blueberry_ui_qt_Export.h"
#include "berryObject.h"
#include <QList>
namespace berry {
template<class T> class SmartPointer;
struct ISourceProvider;
/**
* <p>
* A service from which all of the source providers can be retrieved.
* </p>
* <p>
* This service can be acquired from your service locator:
* <pre>
* ISourceProviderService* service = GetSite()->GetService<ISourceProviderService>();
* </pre>
* <ul>
* <li>This service is available globally.</li>
* </ul>
* </p>
*
- * @noimplement This interface is not intended to be implemented by clients.
- * @noextend This interface is not intended to be extended by clients.
+ * @note This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be extended by clients.
*
* @see IEvaluationService
*/
struct BERRY_UI_QT ISourceProviderService : public virtual Object
{
berryObjectMacro(berry::ISourceProviderService);
~ISourceProviderService() override;
/**
* Retrieves a source provider providing the given source. This is used by
* clients who only need specific sources.
*
* @param sourceName
* The name of the source; must not be <code>null</code>.
* @return A source provider which provides the request source, or
* <code>null</code> if no such source exists.
* @see ISources
*/
virtual SmartPointer<ISourceProvider> GetSourceProvider(const QString& sourceName) const = 0;
/**
* Retrieves all of the source providers registered with this service at the
* time of this call.
* <p>
* <code>IEvaluationService</code> can be used
* to receive notifications about source variable changes and to
* evaluate core expressions against source providers.
* </p>
*
* @return The source providers registered with this service. This value may be empty.
*/
virtual QList<SmartPointer<ISourceProvider> > GetSourceProviders() const = 0;
};
}
Q_DECLARE_INTERFACE(berry::ISourceProviderService, "org.blueberry.ui.ISourceProviderService")
#endif // BERRYISOURCEPROVIDERSERVICE_H
diff --git a/Plugins/org.blueberry.ui.qt/src/tweaklets/berryGuiWidgetsTweaklet.h b/Plugins/org.blueberry.ui.qt/src/tweaklets/berryGuiWidgetsTweaklet.h
index a5a8a7288c..ce09eb7a02 100755
--- a/Plugins/org.blueberry.ui.qt/src/tweaklets/berryGuiWidgetsTweaklet.h
+++ b/Plugins/org.blueberry.ui.qt/src/tweaklets/berryGuiWidgetsTweaklet.h
@@ -1,206 +1,208 @@
/*============================================================================
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 BERRYGUIWIDGETSTWEAKLET_H_
#define BERRYGUIWIDGETSTWEAKLET_H_
#include "internal/berryTweaklets.h"
#include "guitk/berryGuiTkISelectionListener.h"
#include "guitk/berryGuiTkIControlListener.h"
#include "berryShell.h"
//#include "commands/berryIMenu.h"
//#include "commands/berryIMenuItem.h"
namespace berry {
struct BERRY_UI_QT GuiWidgetsTweaklet
{
static Tweaklets::TweakKey<GuiWidgetsTweaklet> KEY;
virtual void AddSelectionListener(QWidget* widget, GuiTk::ISelectionListener::Pointer listener) = 0;
virtual void RemoveSelectionListener(QWidget* widget, GuiTk::ISelectionListener::Pointer listener) = 0;
/**
* Adds the listener to the collection of listeners who will
* be notified when the widget is moved or resized, by sending
* it one of the messages defined in the <code>IControlListener</code>
* interface.
*
+ * @param widget
* @param listener the listener which should be notified
*
* @see IControlListener
* @see #RemoveControlListener
*/
virtual void AddControlListener(QWidget* widget, GuiTk::IControlListener::Pointer listener) = 0;
/**
* Removes the listener from the collection of listeners who will
* be notified when the widget is moved or resized.
*
+ * @param widget
* @param listener the listener which should no longer be notified
*
* @see IControlListener
* @see #AddControlListener
*/
virtual void RemoveControlListener(QWidget* widget, GuiTk::IControlListener::Pointer listener) = 0;
virtual bool GetEnabled(QWidget* widget) = 0;
virtual void SetEnabled(QWidget* widget, bool enabled) = 0;
virtual void SetBounds(QWidget* widget, const QRect& bounds) = 0;
virtual QRect GetBounds(QWidget* widget) = 0;
virtual void SetVisible(QWidget* widget, bool visible) = 0;
virtual bool GetVisible(QWidget* widget) = 0;
virtual bool IsVisible(QWidget* widget) = 0;
virtual QRect GetClientArea(QWidget* widget) = 0;
virtual QWidget* GetParent(QWidget* widget) = 0;
virtual bool SetParent(QWidget* widget, QWidget* parent) = 0;
virtual void SetData(QWidget* widget, const QString& id, Object::Pointer data) = 0;
virtual Object::Pointer GetData(QWidget* widget, const QString& id) = 0;
virtual QPoint GetCursorLocation() = 0;
virtual QWidget* GetCursorControl() = 0;
virtual QWidget* FindControl(const QList<Shell::Pointer>& shells, const QPoint& location) = 0;
/**
* Determines if one control is a child of another. Returns true iff the second
* argument is a child of the first (or the same object).
*
* @param potentialParent
* @param childToTest
* @return
*/
virtual bool IsChild(QWidget* potentialParent, QWidget* childToTest) = 0;
/**
* Returns the control which currently has keyboard focus,
* or null if keyboard events are not currently going to
* any of the controls built by the currently running
* application.
*
* @return the control under the cursor
*/
virtual QWidget* GetFocusControl() = 0;
virtual bool IsReparentable(QWidget* widget) = 0;
virtual void MoveAbove(QWidget* widgetToMove, QWidget* widget) = 0;
virtual void MoveBelow(QWidget* widgetToMove, QWidget* widget) = 0;
virtual void Dispose(QWidget* widget) = 0;
virtual Shell::Pointer CreateShell(Shell::Pointer parent, int style) = 0;
virtual void DisposeShell(Shell::Pointer shell) = 0;
virtual QWidget* CreateComposite(QWidget* parent) = 0;
virtual QList<Shell::Pointer> GetShells() = 0;
virtual Shell::Pointer GetShell(QWidget* widget) = 0;
virtual Shell::Pointer GetActiveShell() = 0;
// command framework interface classes
//virtual IMenu::Pointer CreateMenu(QWidget*, IMenu::Style = IMenu::POP_UP) = 0;
//virtual IMenu::Pointer CreateMenu(IMenu::Pointer parent) = 0;
//virtual IMenuItem::Pointer CreateMenuItem(IMenu::Pointer, IMenuItem::Style, int index = -1) = 0;
/**
* @brief returns the coordinates of the center point of the primary screen
* (where the application starts) of the current desktop.
*
* @param i the number of the screen (if there are multiple). If i = -1
* a rectangle representing the size of the virtual desktop is returned.
* @return the screen Geometry.
* @see GetScreenNumber()
* @see GetPrimaryScreenNumber()
*/
virtual QRect GetScreenSize(int i = -1) = 0;
virtual QRect GetAvailableScreenSize(int i = -1) = 0;
virtual int GetClosestScreenNumber(const QRect&) = 0;
/**
* @brief Gets the number of available screens in a multi-screen environment.
*
* @return the number of available screens in a multi-screen environment.
*/
virtual unsigned int GetScreenNumber() = 0;
/**
* @brief Gets the number of the primary screen.
*
* @return the number of the primary screen.
*/
virtual int GetPrimaryScreenNumber() = 0;
/**
* Converts the given rectangle from display coordinates to the local coordinate system
* of the given object
*
* @param coordinateSystem local coordinate system (widget) being converted to
* @param toConvert rectangle to convert
* @return a rectangle in control coordinates
* @since 3.0
*/
virtual QRect ToControl(QWidget* coordinateSystem,
const QRect& toConvert) = 0;
/**
* Converts the given point from display coordinates to the local coordinate system
* of the given object
*
* @param coordinateSystem local coordinate system (widget) being converted to
* @param toConvert point to convert
* @return a point in control coordinates
* @since 3.0
*/
virtual QPoint ToControl(QWidget* coordinateSystem,
const QPoint& toConvert) = 0;
/**
* Converts the given rectangle from the local coordinate system of the given object
* into display coordinates.
*
* @param coordinateSystem local coordinate system (widget) being converted from
* @param toConvert rectangle to convert
* @return a rectangle in display coordinates
* @since 3.0
*/
virtual QRect ToDisplay(QWidget* coordinateSystem,
const QRect& toConvert) = 0;
/**
* Converts the given point from the local coordinate system of the given object
* into display coordinates.
*
* @param coordinateSystem local coordinate system (widget) being converted from
* @param toConvert point to convert
* @return a point in display coordinates
* @since 3.0
*/
virtual QPoint ToDisplay(QWidget* coordinateSystem,
const QPoint& toConvert) = 0;
};
}
Q_DECLARE_INTERFACE(berry::GuiWidgetsTweaklet, "org.blueberry.GuiWidgetsTweaklet")
#endif /* BERRYGUIWIDGETSTWEAKLET_H_ */
diff --git a/Plugins/org.mitk.core.ext/schema/inputdevice.exsd b/Plugins/org.mitk.core.ext/schema/inputdevice.exsd
index 6fc8bb6533..cc2159a250 100644
--- a/Plugins/org.mitk.core.ext/schema/inputdevice.exsd
+++ b/Plugins/org.mitk.core.ext/schema/inputdevice.exsd
@@ -1,153 +1,113 @@
<?xml version='1.0' encoding='UTF-8'?>
<schema targetNamespace="org.mitk.core.ext" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.mitk.core.ext" id="inputdevices" name="Input Devices"/>
</appinfo>
- <documentation>
- This extension point is used to define additional input devices.
- </documentation>
+
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence>
<element ref="inputdevice" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified identifier of the target extension point
- </documentation>
+
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
- <documentation>
- an optional identifier of the extension instance
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- an optional name of the extension instance
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="inputdevice">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<sequence>
<element ref="description" minOccurs="0" maxOccurs="1"/>
</sequence>
<attribute name="id" type="string" use="required">
<annotation>
- <documentation>
- the identifier of the input device
- </documentation>
+
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
- <documentation>
- an optional name of the input device
- </documentation>
+
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
- <documentation>
- a fully qualified name of the class that implements
-&lt;samp&gt;mitk::IInputDevice&lt;/samp&gt;.
- </documentation>
+
<appinfo>
<meta.attribute kind="java" basedOn="mitk::IInputDevice"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="description" type="string">
<annotation>
<appinfo>
<meta.element translatable="true"/>
</appinfo>
- <documentation>
- an optional subelement whose body should contain text providing a short description of the input device.
- </documentation>
+
</annotation>
</element>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
- <documentation>
- The following is an example of the extension point:
-&lt;p&gt;
-&lt;pre&gt;
- &lt;extension point=&quot;org.mitk.core.ext.inputdevices&quot;&gt;
- &lt;inputdevice
- id=&quot;com.xyz.inputdevice.XYZDevice&quot;
- name=&quot;XYZ Device&quot;
- class=&quot;ns::XYZDevice&quot; &gt;
- &lt;description&gt;My new 20-dimensional input device&lt;/description&gt;
- &lt;/inputdevice&gt;
- &lt;/extension&gt;
-&lt;/pre&gt;
-&lt;/p&gt;
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="apiInfo"/>
</appinfo>
- <documentation>
- The value of the &lt;samp&gt;class&lt;/samp&gt; attribute must be a
-fully qualified name of the class that implements
-&lt;samp&gt;mitk::IInputDevice&lt;/samp&gt;.
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
- <documentation>
- The MITK Platform can handle multiple distinct input devices by...
- </documentation>
+
</annotation>
<annotation>
<appinfo>
<meta.section type="copyright"/>
</appinfo>
- <documentation>
- Copyright (c) German Cancer Research Center (DKFZ)&lt;br&gt;
-All rights reserved.
- </documentation>
+
</annotation>
</schema>
diff --git a/Plugins/org.mitk.core.ext/src/mitkIInputDevice.h b/Plugins/org.mitk.core.ext/src/mitkIInputDevice.h
index aacf2b8093..b690331cf9 100644
--- a/Plugins/org.mitk.core.ext/src/mitkIInputDevice.h
+++ b/Plugins/org.mitk.core.ext/src/mitkIInputDevice.h
@@ -1,52 +1,52 @@
/*============================================================================
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 MITKIINPUTDEVICE_H_
#define MITKIINPUTDEVICE_H_
#include <berryObject.h>
#include <berryMacros.h>
#include <vector>
namespace mitk
{
/**
* An input device provides a method to register and unregister itself. Meaning <br>
* for example adding listeners and instianciate classes necessary to use the input device.
*
- * @noimplement This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be implemented by clients.
* @ingroup org_mitk_core_ext
*/
struct IInputDevice : public berry::Object
{
berryObjectMacro(mitk::IInputDevice);
/**
* Register the input device at one or more instances.
*/
virtual bool RegisterInputDevice() = 0;
/**
* Unregister the input device at one or more instances.
*/
virtual bool UnRegisterInputDevice() = 0;
~IInputDevice() override {}
}; // end struct IInputDevice
} // end namespace mitk
Q_DECLARE_INTERFACE(mitk::IInputDevice, "org.mitk.IInputDevice")
#endif /*MITKIINPUTDEVICE_H_*/
diff --git a/Plugins/org.mitk.core.ext/src/mitkIInputDeviceRegistry.h b/Plugins/org.mitk.core.ext/src/mitkIInputDeviceRegistry.h
index 6606d54f90..820c162582 100644
--- a/Plugins/org.mitk.core.ext/src/mitkIInputDeviceRegistry.h
+++ b/Plugins/org.mitk.core.ext/src/mitkIInputDeviceRegistry.h
@@ -1,64 +1,64 @@
/*============================================================================
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 MITKIINPUTDEVICEREGISTRY_H_
#define MITKIINPUTDEVICEREGISTRY_H_
#include <QtPlugin>
#include "mitkIInputDeviceDescriptor.h"
namespace mitk
{
/**
*
* The input device registry maintains a list of input devices explicitly registered
* against the view extension point.
* <p>
* The description of a given input device is kept in a <code>IInputDeviceDescriptor</code>.
* </p>
* <p>
* This interface is not intended to be implemented by clients.
* </p>
*
* @see mitk::IInputDeviceDescriptor
- * @noimplement This interface is not intended to be implemented by clients.
+ * @note This interface is not intended to be implemented by clients.
* @ingroup org_mitk_core_ext
*/
struct IInputDeviceRegistry
{
/**
* Return an input device descriptor with the given extension id. If no input device exists,
* with the id return <code>null</code>.
*
* @param id
* the id to search for
* @return the descriptor or <code>null</code>
*/
virtual IInputDeviceDescriptor::Pointer Find(const QString& id) const = 0;
/**
* Return a list of input devices defined in the registry.
*
* @return the input devices.
*/
virtual QList<IInputDeviceDescriptor::Pointer> GetInputDevices() const = 0;
virtual ~IInputDeviceRegistry() {}
}; // end struct IInputDeviceRegistry
} // end namespace mitk
Q_DECLARE_INTERFACE(mitk::IInputDeviceRegistry, "org.mitk.service.IInputDeviceRegistry")
#endif /*MITKIINPUTDEVICEREGISTRY_H_*/
diff --git a/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPartListener.h b/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPartListener.h
index 5539d50766..104a1be3c6 100644
--- a/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPartListener.h
+++ b/Plugins/org.mitk.gui.common/src/mitkIRenderWindowPartListener.h
@@ -1,61 +1,59 @@
/*============================================================================
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 MITKIRENDERWINDOWPARTLISTENER_H
#define MITKIRENDERWINDOWPARTLISTENER_H
#include <org_mitk_gui_common_Export.h>
namespace mitk {
struct IRenderWindowPart;
/**
* \ingroup org_mitk_gui_common
*
* \brief Interface for berry::IViewPart implementations to be notified about mitk::IRenderWindowPart lifecycle changes.
*
* This interface is intended to be implemented by subclasses of berry::IWorkbenchPart. If implemented,
* the interface methods are called automatically if a Workbench part which implementes mitk::IRenderWindowPart
* is activated or deactivated.
*
* The notion of activated and deactivated is slightly different from the usual Workbench part lifecycle.
*/
struct MITK_GUI_COMMON_PLUGIN IRenderWindowPartListener
{
virtual ~IRenderWindowPartListener();
/**
* Called when an IRenderWindowPart is activated or if it becomes visible and no
* other IRenderWindowPart was activated before.
*
* \param renderWindowPart The newly activated IRenderWindowPart.
*/
virtual void RenderWindowPartActivated(mitk::IRenderWindowPart* renderWindowPart) = 0;
/**
* Called when an IRenderWindowPart becomes invisible and if it was active before.
*
* \param renderWindowPart The deactivated IRenderWindowPart.
*/
virtual void RenderWindowPartDeactivated(mitk::IRenderWindowPart* renderWindowPart) = 0;
/**
* Called when an IRenderWindowPart changes and if it was active before.
- *
- * \param renderWindowPart The modified IRenderWindowPart.
*/
- virtual void RenderWindowPartInputChanged(mitk::IRenderWindowPart* /*renderWindowPart*/) {};
+ virtual void RenderWindowPartInputChanged(mitk::IRenderWindowPart*) {};
};
}
#endif // MITKIRENDERWINDOWPARTLISTENER_H
diff --git a/Plugins/org.mitk.gui.common/src/mitkWorkbenchUtil.cpp b/Plugins/org.mitk.gui.common/src/mitkWorkbenchUtil.cpp
index 15e460609a..cd308e32cf 100644
--- a/Plugins/org.mitk.gui.common/src/mitkWorkbenchUtil.cpp
+++ b/Plugins/org.mitk.gui.common/src/mitkWorkbenchUtil.cpp
@@ -1,471 +1,473 @@
/*============================================================================
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 "mitkWorkbenchUtil.h"
#include <berryPlatform.h>
#include <berryPlatformUI.h>
#include <berryIEditorRegistry.h>
#include <berryCoreException.h>
#include <berryIPreferencesService.h>
#include <berryIPreferences.h>
#include "mitkIDataStorageService.h"
#include "mitkDataStorageEditorInput.h"
#include "mitkRenderingManager.h"
#include "mitkIRenderingManager.h"
#include "mitkProperties.h"
#include "mitkNodePredicateData.h"
#include "mitkNodePredicateNot.h"
#include "mitkNodePredicateProperty.h"
#include "mitkCoreObjectFactory.h"
#include "QmitkIOUtil.h"
#include <QMessageBox>
#include <QApplication>
#include <QDateTime>
#include "internal/org_mitk_gui_common_Activator.h"
namespace mitk {
struct WorkbenchUtilPrivate {
/**
* Get the editor descriptor for a given name using the editorDescriptor
* passed in as a default as a starting point.
*
* @param name
* The name of the element to open.
* @param editorReg
* The editor registry to do the lookups from.
* @param defaultDescriptor
* IEditorDescriptor or <code>null</code>
* @return IEditorDescriptor
* @throws PartInitException
* if no valid editor can be found
*/
static berry::IEditorDescriptor::Pointer GetEditorDescriptor(const QString& name, berry::IEditorRegistry* editorReg, berry::IEditorDescriptor::Pointer defaultDescriptor)
{
if (defaultDescriptor.IsNotNull())
{
return defaultDescriptor;
}
berry::IEditorDescriptor::Pointer editorDesc = defaultDescriptor;
// next check the OS for in-place editor (OLE on Win32)
if (editorReg->IsSystemInPlaceEditorAvailable(name))
{
editorDesc = editorReg->FindEditor(berry::IEditorRegistry::SYSTEM_INPLACE_EDITOR_ID);
}
// next check with the OS for an external editor
if (editorDesc.IsNull() && editorReg->IsSystemExternalEditorAvailable(name))
{
editorDesc = editorReg->FindEditor(berry::IEditorRegistry::SYSTEM_EXTERNAL_EDITOR_ID);
}
// if no valid editor found, bail out
if (editorDesc.IsNull())
{
throw berry::PartInitException("No editor found");
}
return editorDesc;
}
static mitk::IDataStorageReference::Pointer GetDataStorageReference()
{
ctkPluginContext* context = mitk::PluginActivator::GetContext();
mitk::IDataStorageService* dss = nullptr;
ctkServiceReference dsRef = context->getServiceReference<mitk::IDataStorageService>();
if (dsRef)
{
dss = context->getService<mitk::IDataStorageService>(dsRef);
}
if (nullptr == dss)
{
QString msg = "IDataStorageService service not available. Unable to open files.";
MITK_WARN << msg.toStdString();
QMessageBox::warning(QApplication::activeWindow(), "Unable to open files", msg);
return mitk::IDataStorageReference::Pointer(nullptr);
}
// Get the active data storage (or the default one, if none is active)
mitk::IDataStorageReference::Pointer dataStorageRef = dss->GetDataStorage();
context->ungetService(dsRef);
return dataStorageRef;
}
}; // end struct WorkbenchUtilPrivate
+ //! [UtilLoadFiles]
void WorkbenchUtil::LoadFiles(const QStringList &fileNames, berry::IWorkbenchWindow::Pointer window, bool openEditor)
+ //! [UtilLoadFiles]
{
if (fileNames.empty())
{
return;
}
mitk::IDataStorageReference::Pointer dataStorageReference = WorkbenchUtilPrivate::GetDataStorageReference();
if (nullptr == dataStorageReference)
{
return;
}
mitk::DataStorage::Pointer dataStorage = dataStorageReference->GetDataStorage();
// Turn off ASSERT
#if defined(_MSC_VER) && !defined(NDEBUG) && defined(_DEBUG) && defined(_CRT_ERROR)
int lastCrtReportType = _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_DEBUG);
#endif
// Do the actual work of loading the data into the data storage
DataStorage::SetOfObjects::Pointer data;
try
{
data = QmitkIOUtil::Load(fileNames, *dataStorage);
}
catch (const mitk::Exception& e)
{
MITK_INFO << e;
return;
}
const bool dsmodified = !data->empty();
// Set ASSERT status back to previous status.
#if defined(_MSC_VER) && !defined(NDEBUG) && defined(_DEBUG) && defined(_CRT_ERROR)
if (lastCrtReportType)
_CrtSetReportMode(_CRT_ASSERT, lastCrtReportType);
#endif
// Check if there is an open perspective. If not, open the default perspective.
if (window->GetActivePage().IsNull())
{
QString defaultPerspId = window->GetWorkbench()->GetPerspectiveRegistry()->GetDefaultPerspective();
window->GetWorkbench()->ShowPerspective(defaultPerspId, window);
}
bool globalReinitOnNodeAdded = true;
berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
if (prefService != nullptr)
{
berry::IPreferences::Pointer prefs
= prefService->GetSystemPreferences()->Node("org.mitk.views.datamanager");
if (prefs.IsNotNull())
{
globalReinitOnNodeAdded = prefs->GetBool("Call global reinit if node is added", true);
}
}
if (openEditor && globalReinitOnNodeAdded)
{
try
{
// Activate the editor using the same data storage or open the default editor
mitk::DataStorageEditorInput::Pointer input(new mitk::DataStorageEditorInput(dataStorageReference));
berry::IEditorPart::Pointer editor = mitk::WorkbenchUtil::OpenEditor(window->GetActivePage(), input, true);
mitk::IRenderWindowPart* renderEditor = dynamic_cast<mitk::IRenderWindowPart*>(editor.GetPointer());
mitk::IRenderingManager* renderingManager = renderEditor == nullptr ? nullptr : renderEditor->GetRenderingManager();
if (dsmodified && renderingManager)
{
mitk::RenderingManager::GetInstance()->InitializeViewsByBoundingObjects(dataStorage);
}
}
catch (const berry::PartInitException& e)
{
QString msg = "An error occurred when displaying the file(s): %1";
QMessageBox::warning(QApplication::activeWindow(), "Error displaying file",
msg.arg(e.message()));
}
}
}
berry::IEditorPart::Pointer WorkbenchUtil::OpenEditor(berry::IWorkbenchPage::Pointer page, berry::IEditorInput::Pointer input, const QString &editorId, bool activate)
{
// sanity checks
if (page.IsNull())
{
throw std::invalid_argument("page argument must not be nullptr");
}
// open the editor on the input
return page->OpenEditor(input, editorId, activate);
}
berry::IEditorPart::Pointer WorkbenchUtil::OpenEditor(berry::IWorkbenchPage::Pointer page, mitk::DataStorageEditorInput::Pointer input, bool activate, bool determineContentType)
{
// sanity checks
if (page.IsNull())
{
throw std::invalid_argument("page argument must not be nullptr");
}
// open the editor on the data storage
QString name = input->GetName() + ".mitk";
berry::IEditorDescriptor::Pointer editorDesc = WorkbenchUtilPrivate::GetEditorDescriptor(name,
berry::PlatformUI::GetWorkbench()->GetEditorRegistry(),
GetDefaultEditor(name, determineContentType));
return page->OpenEditor(input, editorDesc->GetId(), activate);
}
berry::IEditorDescriptor::Pointer WorkbenchUtil::GetEditorDescriptor(const QString& name, bool /*inferContentType*/)
{
if (name.isEmpty())
{
throw std::invalid_argument("name argument must not be empty");
}
// no used for now
//IContentType contentType = inferContentType ? Platform
// .getContentTypeManager().findContentTypeFor(name) : null;
berry::IEditorRegistry* editorReg = berry::PlatformUI::GetWorkbench()->GetEditorRegistry();
return WorkbenchUtilPrivate::GetEditorDescriptor(name, editorReg, editorReg->GetDefaultEditor(name /*, contentType*/));
}
berry::IEditorDescriptor::Pointer WorkbenchUtil::GetDefaultEditor(const QString& name, bool /*determineContentType*/)
{
// Try file specific editor.
berry::IEditorRegistry* editorReg = berry::PlatformUI::GetWorkbench()->GetEditorRegistry();
try
{
QString editorID; // = file.getPersistentProperty(EDITOR_KEY);
if (!editorID.isEmpty())
{
berry::IEditorDescriptor::Pointer desc = editorReg->FindEditor(editorID);
if (desc.IsNotNull())
{
return desc;
}
}
}
catch (const berry::CoreException&)
{
// do nothing
}
// IContentType contentType = null;
// if (determineContentType)
// {
// contentType = getContentType(file);
// }
// Try lookup with filename
return editorReg->GetDefaultEditor(name); //, contentType);
}
mitk::IRenderWindowPart* WorkbenchUtil::GetRenderWindowPart(berry::IWorkbenchPage::Pointer page, IRenderWindowPartStrategies strategies)
{
// Return the active editor if it implements mitk::IRenderWindowPart
mitk::IRenderWindowPart* renderWindowPart = dynamic_cast<mitk::IRenderWindowPart*>(page->GetActiveEditor().GetPointer());
if (renderWindowPart)
{
return renderWindowPart;
}
// No suitable active editor found, check visible editors
QList<berry::IEditorReference::Pointer> editors = page->GetEditorReferences();
for (QList<berry::IEditorReference::Pointer>::iterator i = editors.begin(); i != editors.end(); ++i)
{
berry::IWorkbenchPart::Pointer part = (*i)->GetPart(false);
if (page->IsPartVisible(part))
{
renderWindowPart = dynamic_cast<mitk::IRenderWindowPart*>(part.GetPointer());
if (renderWindowPart)
{
return renderWindowPart;
}
}
}
// No suitable visible editor found, check visible views
QList<berry::IViewReference::Pointer> views = page->GetViewReferences();
for (QList<berry::IViewReference::Pointer>::iterator i = views.begin(); i != views.end(); ++i)
{
berry::IWorkbenchPart::Pointer part = (*i)->GetPart(false);
if (page->IsPartVisible(part))
{
renderWindowPart = dynamic_cast<mitk::IRenderWindowPart*>(part.GetPointer());
if (renderWindowPart)
{
return renderWindowPart;
}
}
}
// No strategies given
if (strategies == NONE)
{
return nullptr;
}
mitk::IDataStorageReference::Pointer dataStorageReference = WorkbenchUtilPrivate::GetDataStorageReference();
if (nullptr == dataStorageReference)
{
return nullptr;
}
mitk::DataStorageEditorInput::Pointer input(new mitk::DataStorageEditorInput(dataStorageReference));
bool activate = false;
if (strategies & ACTIVATE)
{
activate = true;
}
berry::IEditorPart::Pointer editorPart;
if (strategies & OPEN)
{
// This will create a default editor for the given input. If an editor
// with that input is already open, the editor is brought to the front.
try
{
editorPart = mitk::WorkbenchUtil::OpenEditor(page, input, activate);
}
catch (const berry::PartInitException&)
{
// There is no editor registered which can handle the given input.
}
}
else if (activate || (strategies & BRING_TO_FRONT))
{
// check if a suitable editor is already opened
editorPart = page->FindEditor(input);
if (editorPart)
{
if (activate)
{
page->Activate(editorPart);
}
else
{
page->BringToTop(editorPart);
}
}
}
return dynamic_cast<mitk::IRenderWindowPart*>(editorPart.GetPointer());
}
mitk::IRenderWindowPart* WorkbenchUtil::OpenRenderWindowPart(berry::IWorkbenchPage::Pointer page, bool activatedEditor/* = true*/)
{
if (activatedEditor)
{
return GetRenderWindowPart(page, ACTIVATE | OPEN);
}
else
{
return GetRenderWindowPart(page, BRING_TO_FRONT | OPEN);
}
}
bool WorkbenchUtil::SetDepartmentLogoPreference(const QString &logoResource, ctkPluginContext *context)
{
if (context == nullptr)
{
BERRY_WARN << "Plugin context invalid, unable to set custom logo.";
return false;
}
// The logo must be available in the local filesystem. We check if we have not already extracted the
// logo from the plug-in or if this plug-ins timestamp is newer then the already extracted logo timestamp.
// If one of the conditions is true, extract it and write it to the plug-in specific storage location.
const QString logoFileName = logoResource.mid(logoResource.lastIndexOf('/') + 1);
if (logoFileName.isEmpty())
{
BERRY_WARN << "Logo file name empty, unable to set custom logo.";
return false;
}
const QString logoPath = context->getDataFile("").absoluteFilePath();
bool extractLogo = true;
QFileInfo logoFileInfo(logoPath + "/" + logoFileName);
if (logoFileInfo.exists())
{
// The logo has been extracted previously. Check if the plugin timestamp is newer, which
// means it might contain an updated logo.
QString pluginLocation = QUrl(context->getPlugin()->getLocation()).toLocalFile();
if (!pluginLocation.isEmpty())
{
QFileInfo pluginFileInfo(pluginLocation);
if (logoFileInfo.lastModified() > pluginFileInfo.lastModified())
{
extractLogo = false;
}
}
}
if (extractLogo)
{
// Extract the logo from the shared library and write it to disk.
QFile logo(logoResource);
if (!logo.exists())
{
BERRY_WARN << "Custom logo '" << logoResource << "' does not exist.";
return false;
}
if (logo.open(QIODevice::ReadOnly))
{
QFile localLogo(logoPath + "/" + logoFileName);
if (localLogo.open(QIODevice::WriteOnly))
{
localLogo.write(logo.readAll());
localLogo.flush();
}
}
}
logoFileInfo.refresh();
if (logoFileInfo.exists())
{
// Get the preferences service
ctkServiceReference prefServiceRef = context->getServiceReference<berry::IPreferencesService>();
berry::IPreferencesService* prefService = nullptr;
if (prefServiceRef)
{
prefService = context->getService<berry::IPreferencesService>(prefServiceRef);
}
if (prefService)
{
prefService->GetSystemPreferences()->Put("DepartmentLogo", qPrintable(logoFileInfo.absoluteFilePath()));
}
else
{
BERRY_WARN << "Preferences service not available, unable to set custom logo.";
return false;
}
}
else
{
BERRY_WARN << "Custom logo at '" << logoFileInfo.absoluteFilePath().toStdString() << "' does not exist.";
return false;
}
return true;
}
} // namespace mitk
diff --git a/Plugins/org.mitk.gui.qt.aicpregistration/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.aicpregistration/documentation/UserManual/Manual.dox
index 4da7b4f2b5..cba634a06f 100644
--- a/Plugins/org.mitk.gui.qt.aicpregistration/documentation/UserManual/Manual.dox
+++ b/Plugins/org.mitk.gui.qt.aicpregistration/documentation/UserManual/Manual.dox
@@ -1,80 +1,80 @@
/**
\page org_mitk_gui_qt_aicpregistration The Anisotropic Iterative Closest Point Registration Plugin
-\imageMacro{"QmitkAICPRegistration_Icon.xpm","Icon of the A-ICP Registration Plugin",2}
+\imageMacro{"QmitkAICPRegistration_Icon-dox.xpm","Icon of the A-ICP Registration Plugin",2}
\tableofcontents
\section org_mitk_gui_qt_aicpregistrationOverview Overview
The Surfaceregistration plugin allows the user to compute a transformation
between two surfaces and align them in 3D space. It performs the
registration with the anisotropic iterative closest point algorithm (A-ICP)
presented in L. Maier-Hein et al. "Convergent Iterative Closest-Point Algorithm to Accomodate
Anisotropic and Inhomogenous Localization Error.", IEEE T Pattern Anal 34 (8),
1520-1532, 2012. With the plugin it's also possible to compute
the target registration error (TRE) between the two aligned surfaces with a given
set of target points. In order to register the surfaces they need to be initially
aligned to be able to run the fine registration with the A-ICP algorithm.
\imageMacro{"QmitkAICPRegistration_Plugin.png","Overview of the A-ICP Registration Plugin.",28}
\section org_mitk_gui_qt_aicpregistrationUsage Usage
In order to run a registration at least two surfaces need to be loaded into
the data manager. Once the surfaces are loaded, a moving and a
fixed surface can be selected in the associated combo boxes of the plugin.
When the <b>Register Surfaces</b> button is pressed the registration is started
and the moving surface is transformed onto the fixed surface.
\imageMacro{"QmitkAICPRegistration_Input.png","Select the surfaces to register.",28}
\section org_mitk_gui_qt_aicpregistrationTargetRegistrationErrorCalculation Target Registration Error Calculation
To compute the target registration error, enable the calculation via the checkbox
in the target registration view. Once the TRE computation is enabled the
combo boxes are activated to select the according target point sets.
\imageMacro{"QmitkAICPRegistration_TRECalculation.png","Usage of the TRE calculation view.",28}
\section org_mitk_gui_qt_aicpregistrationRegistrationSettings Registration Settings
The following additional settings are available in the plugin to configure the algorithm:
<ul>
<li>A trimmed version of the algorithm.
<li>Set the threshold for the algorithm to converge.
<li>Limit the iterations.
<li>Set the search radius.
</ul>
\imageMacro{"QmitkAICPRegistration_Settings.png","Additional registration settings.",28}
\subsection org_mitk_gui_qt_aicpregistrationTrimmedRegistration Trimmed Registration
This option enables a trimmed version of the algorithm to register partial overlapping
surfaces. Once the option is enabled the user can specify the overlapping part of the surface.
Valid values for the overlapping part lie between 0 an 1.
The trimmed version of the algorithm uses only a fixed percentage of all correspondences found
during one iteration. Only the best correspondences will be used during the registration process.
\subsection org_mitk_gui_qt_aicpregistrationThreshold Threshold
The user can specify the threshold which is used as a termination constraint for the algorithm.
When the the change of the fiducial registration error (FRE)
between to registrations falls under the specified threshold the algorithm terminates.
Larger values can speedup the registration process at the cost of a more accurate result.
\subsection org_mitk_gui_qt_aicpregistrationMaximumIterations Maximum Iterations
The maximum amount of iterations used by the algorithm can be specified by the user.
Once the algorithm reaches the maximum amount of iterations it will stop the registration process.
\subsection org_mitk_gui_qt_aicpregistrationSearchRadius Search Radius
The user can specify the search radius in mm used during the correspondence search
in a kd tree. The default value is 30 mm. A small radius can speedup the
algorithm but can in addition also lead in bad correspondences and therefore in an incorrect
alignment of the surfaces.
*/
diff --git a/Plugins/org.mitk.gui.qt.aicpregistration/documentation/UserManual/QmitkAICPRegistration_Icon.xpm b/Plugins/org.mitk.gui.qt.aicpregistration/documentation/UserManual/QmitkAICPRegistration_Icon-dox.xpm
similarity index 100%
rename from Plugins/org.mitk.gui.qt.aicpregistration/documentation/UserManual/QmitkAICPRegistration_Icon.xpm
rename to Plugins/org.mitk.gui.qt.aicpregistration/documentation/UserManual/QmitkAICPRegistration_Icon-dox.xpm
diff --git a/Plugins/org.mitk.gui.qt.application/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.application/documentation/doxygen/modules.dox
index c89ec4876f..fcf22312bd 100755
--- a/Plugins/org.mitk.gui.qt.application/documentation/doxygen/modules.dox
+++ b/Plugins/org.mitk.gui.qt.application/documentation/doxygen/modules.dox
@@ -1,23 +1,23 @@
/**
\defgroup org_mitk_gui_qt_application org.mitk.gui.qt.application
\ingroup MITKPlugins
\brief Provides utility classes for MITK application developers.
This plug-in provides QAction derived classes for common application actions
like opening files and closing the application. It also provides a central
preferences dialog.
The plug-in is usually used as a dependency for plug-ins contributing a
- \ref xp_org_blueberry_osgi_applications extension and providing workbench advisor
+ \ref BlueBerryExtPointsIndex_PlatformRuntime_App extension and providing workbench advisor
classes which customize the main application menu and toolbar.
*/
/**
\defgroup org_mitk_gui_qt_application_internal Internal
\ingroup org_mitk_gui_qt_application
\brief This subcategory includes the internal classes of the org.mitk.gui.qt.application plugin. Other
plugins must not rely on these classes. They contain implementation details and their interface
may change at any time. We mean it.
*/
diff --git a/Plugins/org.mitk.gui.qt.basicimageprocessing/documentation/UserManual/QmitkBasicImageProcessing.dox b/Plugins/org.mitk.gui.qt.basicimageprocessing/documentation/UserManual/QmitkBasicImageProcessing.dox
index e67b1b862b..8a06e1fe2a 100644
--- a/Plugins/org.mitk.gui.qt.basicimageprocessing/documentation/UserManual/QmitkBasicImageProcessing.dox
+++ b/Plugins/org.mitk.gui.qt.basicimageprocessing/documentation/UserManual/QmitkBasicImageProcessing.dox
@@ -1,126 +1,126 @@
/**
\page org_mitk_views_basicimageprocessing The Basic Image Processing
\imageMacro{QmitkBasicImageProcessing_ImageProcessing_48.png,"Icon of the Basic Image Processing Plugin",2.00}
\tableofcontents
\section QmitkBasicImageProcessingUserManualSummary Summary
This view provides an easy interface to fundamental image preprocessing and enhancement filters.
It offers filter operations on 3D and 4D images in the areas of noise suppression, morphological operations, edge detection and image arithmetics,
as well as image inversion and downsampling.
Please see \ref QmitkBasicImageProcessingUserManualOverview for more detailed information on usage and supported filters.
If you encounter problems using the view, please have a look at the \ref QmitkBasicImageProcessingUserManualTrouble page.
\section QmitkBasicImageProcessingUserManualOverview Overview
This view provides an easy interface to fundamental image preprocessing and image enhancement filters.
It offers a variety of filter operations in the areas of noise suppression, morphological operations, edge detection and image arithmetics.
Currently the view can be used with all 3D and 4D image types loadable by MITK.
2D image support will be added in the future.
All filters are encapsulated from the Insight Segmentation and Registration Toolkit (ITK, www.itk.org).
\imageMacro{QmitkBasicImageProcessing_BIP_Overview.png,"MITK with the Basic Image Processing view",16.00}
This document will tell you how to use this view, but it is assumed that you already know how to use MITK in general.
\section QmitkBasicImageProcessingUserManualFilters Filters
This section will not describe the fundamental functioning of the single filters in detail, though.
-If you want to know more about a single filter, please have a look at http://www.itk.org/Doxygen316/html/classes.html
+If you want to know more about a single filter, please have a look at https://itk.org/Doxygen/html/index.html
or in any good digital image processing book. For total denoising filter, please see Tony F. Chan et al., "The digital TV filter and nonlinear denoising".
Available filters are:
<H2>\a Single image operations</H2>
<ul>
<li><b>Noise Suppression</b></li>
<ul>
<li> Gaussian Denoising</li>
<li> Median Filtering</li>
<li> Total Variation Denoising</li>
</ul>
<li><b>Morphological Operations</b></li>
<ul>
<li> Dilation</li>
<li> Erosion</li>
<li> Opening</li>
<li> Closing</li>
</ul>
<li><b>%Edge Detection</b></li>
<ul>
<li> Gradient Image</li>
<li> Laplacian Operator (Second Derivative)</li>
<li> Sobel Operator</li>
</ul>
<li><b>Misc</b></li>
<ul>
<li> Threshold </li>
<li> Image Inversion</li>
<li> Downsampling (isotropic)</li>
</ul>
</ul>
<H2>\a Dual image operations</H2>
<ul>
<li><b>Image Arithmetics</b></li>
<ul>
<li> Add two images</li>
<li> Subtract two images</li>
<li> Multiply two images</li>
<li> Divide two images</li>
</ul>
<li><b>Binary Operations</b></li>
<ul>
<li> Logical AND</li>
<li> Logical OR</li>
<li> Logical XOR</li>
</ul>
</ul>
\section QmitkBasicImageProcessingUserManualUsage Usage
All you have to do to use a filter is to:
<ul>
<li> Load an image into MITK</li>
<li> Select it in data manager
<li> Select which filter you want to use via the drop down list</li>
<li> Press the execute button</li>
</ul>
A busy cursor appeares; when it vanishes, the operation is completed. Your filtered image is displayed and selected for further processing.
(If the checkbox "Hide original image" is not selected, you will maybe not see the filter result imideately,
because your filtered image is possibly hidden by the original.)
For two image operations, please make sure that the correct second image is selected in the drop down menu, and the image order is correct.
For sure, image order only plays a role for image subtraction and division. These are conducted (Image1 - Image2) or (Image1 / Image2), respectively.
Please Note: When you select a 4D image, you can select the time step for the filter to work on via the time slider at the top of the GUI.
The 3D image at this time step is extracted and processed. The result will also be a 3D image.
This means, a true 4D filtering is not yet supported.
\section QmitkBasicImageProcessingUserManualTrouble Troubleshooting
<B>I get an error when using a filter on a 2D image.</B><BR>
2D images are not yet supported...
<B>I use a filter on a 4D image, and the output is 3D.</B><BR>
When you select a 4D image, you can select the time step for the filter to work on via the time slider at the top of the GUI.
The 3D image at this time step is extracted and processed. The result will also be a 3D image.
This means, a true 4D filtering is not supported by now.
<B>A filter crashes during execution.</B><BR>
Maybe your image is too large. Some filter operations, like derivatives, take a lot of memory.
Try downsampling your image first.
<B>All other problems.</B><BR>
Please report to the MITK mailing list.
-See http://www.mitk.org/wiki/Mailinglist on how to do this.
+See https://www.mitk.org/wiki/MITK_Mailinglist on how to do this.
*/
diff --git a/Plugins/org.mitk.gui.qt.cest/documentation/UserManual/icon.svg b/Plugins/org.mitk.gui.qt.cest/documentation/UserManual/cest-dox.svg
similarity index 100%
rename from Plugins/org.mitk.gui.qt.cest/documentation/UserManual/icon.svg
rename to Plugins/org.mitk.gui.qt.cest/documentation/UserManual/cest-dox.svg
diff --git a/Plugins/org.mitk.gui.qt.cest/documentation/UserManual/org_mitk_gui_qt_cest.dox b/Plugins/org.mitk.gui.qt.cest/documentation/UserManual/org_mitk_gui_qt_cest.dox
index b559b0388e..58b4cccb49 100644
--- a/Plugins/org.mitk.gui.qt.cest/documentation/UserManual/org_mitk_gui_qt_cest.dox
+++ b/Plugins/org.mitk.gui.qt.cest/documentation/UserManual/org_mitk_gui_qt_cest.dox
@@ -1,66 +1,66 @@
/**
\page org_mitk_gui_qt_cest The CEST View
-\imageMacro{icon.svg,"Icon of the cest view",2.00}
+\imageMacro{cest-dox.svg,"Icon of the cest view",2.00}
\tableofcontents
\section org_mitk_gui_qt_cestOverview Overview
This view gives the option to explore and analyze CEST data. You can select a CEST data set together with either a segmentation or a point set in the datamanager. If a segmentation was selected (make sure the segmentation is the same in each time step, you can use the button at the top of the view to copy the first time step to all subsequent ones) a statistic for the selected region is shown. If a point set was selected each points grey value is plotted.
\section org_mitk_gui_qt_cestDataLoading Data Loading
CEST dicom data can be loaded either via file open or drag and drop. When a dicom file is loaded via MITK and it contains CEST meta information
the CEST Dicom Reader is offered as an option. Selecting it will parse the CEST data as follows:
An initial parsing determines whether the provided string belongs to CEST data at all.
If the "tSequenceFileName" is of the format "{WHATEVER}CEST_Rev####" it is assumed that the
data is indeed CEST data and was taken with revision #### (not limited to four digits).
Which custom parameters to save and to which property name can be controlled by a json file.
This file can be either provided as a resource for the MitkCEST module during compilation or
placed next to the MitkCEST library in your binary folder.
The expected format for the file "REVISIONNUMBER.json": <br>
{ <br>
"REVISIONNUMBER" : "revision_json", <br>
"sWiPMemBlock.alFree[1]" : "AdvancedMode", <br>
"sWiPMemBlock.alFree[2]" : "RetreatMode" <br>
} <br>
where :
<ul>
<li> REVISIONNUMBER is the revision number of this json parameter mapping (files with non digit characters in their
name will be ignored)
<li> sWiPMemBlock.alFree[1] is the name of one parameter in the private dicom tag
<li> AdvancedMode is the name of the property the content of sWiPMemBlock.alFree[1] should be saved to
</ul>
If the sampling type is list it will try to access LIST.txt at the same location as the dicom files
read the offsets.
\section org_mitk_gui_qt_cestCreatingSegmentation Creating a segmentation
You can use the segmentation view to create a segmentation for the CEST data. Drawing a segmentation will by default only add it to
the first timestep. For more information check the help of the segmentation view.
You can copy the segmentation on the first timestep to all following ones by using the copy timestep button in this view.
\section org_mitk_gui_qt_cestCreatingPointSet Creating a point set
You can use the point set interaction view to create a point set for the CEST data.
For more information check the help of the point set interaction view.
\section org_mitk_gui_qt_cestNormalizing Normalizing the CEST data
Select the CEST image in the datamanager and hit the normalize button to create a new, normalized image.
\section org_mitk_gui_qt_cestInspectProperties Investigate CEST meta data
You can inspect the CEST meta data with the properties view. You need to enable the developer mode in the "Window->Preferences" Properties menu.
When selecting a data node in the data manager with the properties view active you can change the Property List from "Data node: common" to "Base data".
The cest meta data is grouped under CEST.
*/
diff --git a/Plugins/org.mitk.gui.qt.cmdlinemodules/documentation/UserManual/cmdlinemodules.dox b/Plugins/org.mitk.gui.qt.cmdlinemodules/documentation/UserManual/cmdlinemodules.dox
index ea56159ff5..8ff0940ab7 100644
--- a/Plugins/org.mitk.gui.qt.cmdlinemodules/documentation/UserManual/cmdlinemodules.dox
+++ b/Plugins/org.mitk.gui.qt.cmdlinemodules/documentation/UserManual/cmdlinemodules.dox
@@ -1,168 +1,168 @@
/**
\page org_mitk_views_cmdlinemodules The Command Line Modules View
\imageMacro{cmdlinemodules_Icon.png,"Icon of the Command Line Modules View",2.00}
\tableofcontents
\section CLIPrefix Contribution
-This plugin was developed at the <a href="http://cmic.cs.ucl.ac.uk/">Centre For Medical Image Computing</a> (CMIC),
-part of <a href="http://www.ucl.ac.uk/">University College London</a> (UCL) and contributed back to the
-<a href="http://www.mitk.org">MITK</a> community with thanks.
+This plugin was developed at the <a href="https://www.ucl.ac.uk/medical-image-computing/">Centre For Medical Image Computing</a> (CMIC),
+part of <a href="https://www.ucl.ac.uk/">University College London</a> (UCL) and contributed back to the
+<a href="https://www.mitk.org">MITK</a> community with thanks.
\section CLIIntroduction Introduction
This view provides the facility to run third party command line programs, and load the data back
into the DataManager for immediate visualisation. All that is required is that the command line application can be called
with an argument of --xml and respond with a valid XML description of the necessary parameters,
and currently, that if the program requires images, they must be NifTI images.
This view can then generate a Graphical User Interface (GUI) dynamically from the XML to enable the
user to interact with the command line application. This provides an easy to use, and potentially
very flexible way to integrate almost any third party, medical imaging, command line application.
As a high level introduction, this view performs the following steps:
\li The view searches for available programs to run, and for each valid module, stores the XML document describing
the interface, and populates a searchable list of available programs.
\li When a program is selected, the GUI is generated.
\li The user can then set the necessary parameters and run the program.
\li Multiple programs can be launched in succession and run simultaneously, and where available on the host platform,
the user can pause, resume or cancel running jobs and see console output for each job.
As a consequence of the very flexible nature of this plugin, these instructions can only describe how to launch
command line modules in a general sense. The examples shown have been constructed by the latest version of the NiftyReg package.
Futher information on the NiftyReg package, including links to the source code, can be found on the wiki page <a href="http://cmictig.cs.ucl.ac.uk/wiki/index.php/NiftyReg">here</a>.
NiftyReg provides valid XML descriptors to enable the integration of the NiftyReg affine (RegAladin) and and non-rigid (RegF3D) image registration algorithms, as well
as utility programs to resample an image, and calculate a Jacobian image. These same XML descriptors work within
-<a href="http://www.slicer.org/">Slicer</a> and <a href="http://www.mitk.org/">MITK</a> based applications.
+<a href="https://www.slicer.org/">Slicer</a> and <a href="https://www.mitk.org/">MITK</a> based applications.
\section CLIPreferences Preferences
The first time that the Command Line Modules View is launched, it is advisable to set the user preferences for the view. Please refer
to Figure 1.
\imageMacro{cmdlinemodules_Preferences.png,"Figure 1. The Command Line Modules Preferences Page",16.00}
Each of these preferences is now explained in some detail.
\li show debug output: If checked will output more messages to the console for debugging purposes.
\li show advanced widgets: If selected, additional widgets appear in the front-end for advanced users.
\li XML time-out (secs): Sets the time-out for the retrieval of the XML.
\li XML validation mode: The user may select a different mode for XML validation. If this is changed, the application will
need to be restarted. There are 3 modes available. If the user selects "strict" mode, the XML schema produced by the
-command line application must exactly conform to <a href="http://www.slicer.org/slicerWiki/index.php/Slicer3:Execution_Model_Documentation">
+command line application must exactly conform to <a href="https://www.slicer.org/w/index.php/Slicer3:Execution_Model_Documentation">
this definition</a>. For "none", there will be no validation. For "weak" validation, the application will report errors,
but try to carry on and load as many modules as possible. The XML validation errors are available as tool-tips on
the tab widget when the module is launched. Many third party modules included with Slicer currently have
incorrect XML (typically, mis-ordered XML tags), and so the "weak" or "none" mode may assist in loading them.
By default the "weak" mode is chosen so that only valid modules are loaded.
\li max concurrent processes: Sets the maximum number of concurrent jobs that can be run via this interface. The default is 4.
When the maximum number is reached, the green "Run" button is disabled until a job finishes.
The next 7 preferences are to control where the view will search for valid command line programs. By default these are off
as the searching process can take a long time and slow down the startup time of the GUI. The options provided are:
\li scan installation dir: This is the directory where the actual application is stored.
\li scan installation dir/cli-modules: Scans the sub-directory called cli-modules under the application installation directory.
\li scan home dir: Scan the users home directory. (See QDir::homePath().)
\li scan home dir/cli-modules: Scans the sub-directory called cli-modules under the users home directory.
\li scan current dir: Scan the current working directory. (See QDir::homePath().)
\li scan current dir/cli-modules: Scans the sub-directory called cli-modules under the current working directory.
\li scan CTK_MODULE_LOAD_PATH: Scans the directory or list of directories defined by the environment variable CTK_MODULE_LOAD_PATH.
A list is colon separated on Linux/Mac, and semi-colon separated on Windows.
In most cases, it is suggested that the user will leave these options unchecked, as the user can also
specify custom directories, and even cherry-pick specific command line programs to load. Figure 2 shows
a selection box that enables the user to specify custom directories to scan, and Figure 3. shows a selection
box that enables the user to select specific modules. Picking specific directories, and specific executables
will most likely make the application quicker to launch.
\imageMacro{cmdlinemodules_PreferencesAdditionalDirectories.png,"Figure 2. The User can specify specific directories to scan.",7.90}
\imageMacro{cmdlinemodules_PreferencesAdditionalModules.png,"Figure 3. The User can specify specific command line programs to load.",7.92}
These directory and file selection boxes enable directories or files to be added, removed and updated in a similar fashion.
The user must make sure that the list of files selected in the "additional modules" section are not already contained within
the directories specified in the "additional module directories" section.
In addition, the preferences page provides:
\li temporary directory: Images stored in the DataManager are first written to a temporary folder as
-<a href="http://niftilib.sourceforge.net/">Nifti</a> images before being passed to each command line program.
+<a href="https://niftilib.sourceforge.net/">Nifti</a> images before being passed to each command line program.
This temporary directory will default to a platform specific temporary folder, but the user may select their preferred choice
of temporary workspace.
\section CLIUsage Usage
When the view is launched, a simple interface is presented, as shown in Figure 4.
\imageMacro{cmdlinemodules_Initial.png,"Figure 4. The initial interface\, with no command line programs available.",8.66}
In this example, all the above check-box preferences were off, and the "additional module directories"
was empty, and the "additional modules" list was empty so no command line applications were found.
The "Search" box displays zero entries, and there is nothing to search.
If the available search paths contain programs that are compatible (i.e. runnable) with this view,
the name of the programs are displayed in the "Search" box in a nested menu, shown in Figure 5.
\imageMacro{cmdlinemodules_WithPrograms.png,"Figure 5. When valid paths are set\, and programs are discovered\, the menu is recalculated to show available programs.",10.54}
When a program is selected, the relevant interface is displayed, by default as collapsed group boxes to save space.
Each section can be individually expanded if necessary to see the parameters.
\imageMacro{cmdlinemodules_NiftyReg.png,"Figure 6. An example program\, showing parameters for NiftyReg's program RegAladin.",10.24}
In this example, the parameters are displayed for <a href="https://sourceforge.net/projects/niftyreg/">NiftyReg</a>
-produced at <a href="http://www.ucl.ac.uk">UCL</a>, and more specifically for the affine registration program called
+produced at <a href="https://www.ucl.ac.uk">UCL</a>, and more specifically for the affine registration program called
RegAladin. The interface can contain a wide variety of controls. If a parameter for a command line program is an input image,
then the widget displayed is linked to the DataManager, so that as new images are loaded, the correct image can be easily
selected from the combo box.
At this stage, multiple tabs can be opened, with one tab for each command line program. Figure 7 shows 2 tabs,
for the RegAladin and RegF3D programs.
\imageMacro{cmdlinemodules_F3D.png,"Figure 7. Multiple tabs can be opened\, one for each command line program.",10.24}
The main view provides some simple controls:
\li Green arrow: Launch (run) the command line executable of the currently selected tab.
\li Yellow undo arrow: Resets the GUI controls of the currently selected tab to default values, if and only if the original XML specified a default value.
At this stage, nothing has been launched. When the user hits the green arrow button, a job is launched.
Each running job is shown as a new progress reporting widget under the main tabbed widget, as shown in Figure 8.
\imageMacro{cmdlinemodules_NiftyRegRunning2.png,"Figure 8. Multiple programs can be run\, each with individual controls and console output.",10.24}
The controls for each running job are:
\li Blue pause button: If supported on the host platform, this button will be enabled and can be toggled off (pause) or on (resume).
\li Red square: If supported on the host platform, this button will kill the command line program.
\li Black cross: Will remove the progress reporting widget from the GUI.
When the user hits the green arrow in the main view:
\li The currently selected tab is designated the "current" job, and contains the "current" set of parameters.
\li A new progress reporting widget is created.
\li The current parameters are copied to the progress reporting widget. In Figure 8. a parameters section
is visible, and by default is collapsed, as they are simply for referring back to.
\li All the output for the command line program is shown in the console widget, with a separate console for each job.
\li Each new progress reporting widget is simply stacked vertically (newest is top-most), and it is up to the
user to delete them when they are finished.
It is easy to run multiple jobs. The green button simply launches the job corresponding to the current tab repeatedly.
It is up to the user to make sure that any output file names are changed between successive invocations of the same command
line module to avoid overwritting output data.
In addition, each set of parameters contains an "About" section containing details of the contributors, the licence and acknowledgements and also
a "Help" section containing a description and a link to any online documentation.
These documentation features are provided by the developers of the third party plugin, and not by the host program.
If information is missing, the user must contact the third party developers.
\section CLITechnicalNotes Technical Notes
From a technical perspective, the Command Line Modules View is a simple view, harnessing the power of the CTK
-command line modules framework. For technical information see the <a href="http://www.commontk.org/index.php/Documentation/Command_Line_Interface">CTK wiki page</a>
+command line modules framework. For technical information see the <a href="https://commontk.org/index.php/Documentation/Command_Line_Interface">CTK wiki page</a>
and obviously the CTK code base.
*/
diff --git a/Plugins/org.mitk.gui.qt.cmdlinemodules/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.cmdlinemodules/documentation/doxygen/modules.dox
index d8a6d2bd25..21b3313b85 100644
--- a/Plugins/org.mitk.gui.qt.cmdlinemodules/documentation/doxygen/modules.dox
+++ b/Plugins/org.mitk.gui.qt.cmdlinemodules/documentation/doxygen/modules.dox
@@ -1,18 +1,18 @@
/**
\defgroup org_mitk_gui_qt_cmdlinemodules org.mitk.gui.qt.cmdlinemodules
\ingroup MITKPlugins
\brief This plugin, provided by University College London (UCL), written by Matt
- Clarkson (m.clarkson@ucl.ac.uk) uses the CTK (http://www.commontk.org) Command
+ Clarkson (m.clarkson@ucl.ac.uk) uses the CTK (https://commontk.org/) Command
Line Modules library to run command line programs as an external process.
*/
/**
\defgroup org_mitk_gui_qt_cmdlinemodules_internal Internal
\ingroup org_mitk_gui_qt_cmdlinemodules
\brief This subcategory includes the internal classes of the org.mitk.gui.qt.cmdlinemodules plugin. Other
plugins must not rely on these classes. They contain implementation details and their interface
may change at any time. We mean it.
*/
diff --git a/Plugins/org.mitk.gui.qt.common.legacy/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.common.legacy/documentation/doxygen/modules.dox
index f895c8411e..bd669c5afb 100755
--- a/Plugins/org.mitk.gui.qt.common.legacy/documentation/doxygen/modules.dox
+++ b/Plugins/org.mitk.gui.qt.common.legacy/documentation/doxygen/modules.dox
@@ -1,19 +1,19 @@
/**
\defgroup org_mitk_gui_qt_common_legacy org.mitk.gui.qt.common.legacy
\ingroup MITKPlugins
\brief Provides legacy classes and functionality common for MITK plug-ins.
-
+
\deprecated This plug-in is deprecated. Old plug-ins having a dependency on it should
- migrate to the org_mitk_gui_qt_common Plug-in using http://www.mitk.org/wiki/ViewsWithoutMultiWidget
-
+ migrate to the org_mitk_gui_qt_common Plug-in using https://www.mitk.org/wiki/Views_Without_Multi_Widget
+
*/
/**
\defgroup org_mitk_gui_qt_common_legacy_internal Internal
\ingroup org_mitk_gui_qt_common_legacy
\brief This subcategory includes the internal classes of the org.mitk.gui.qt.common.legacy plugin. Other
plugins must not rely on these classes. They contain implementation details and their interface
may change at any time. We mean it.
*/
diff --git a/Plugins/org.mitk.gui.qt.common.legacy/src/QmitkFunctionality.h b/Plugins/org.mitk.gui.qt.common.legacy/src/QmitkFunctionality.h
index 0565457e63..fae0b394ce 100755
--- a/Plugins/org.mitk.gui.qt.common.legacy/src/QmitkFunctionality.h
+++ b/Plugins/org.mitk.gui.qt.common.legacy/src/QmitkFunctionality.h
@@ -1,396 +1,397 @@
/*============================================================================
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 QMITKFUNCTIONALITY_H_
#define QMITKFUNCTIONALITY_H_
//# blueberry stuff
#include <berryQtViewPart.h>
#include <berryIPreferencesService.h>
#include <berryISelectionListener.h>
#include <berryIPreferences.h>
//# mitk stuff
#include <org_mitk_gui_qt_common_legacy_Export.h>
#include "mitkDataNodeSelection.h"
#include <mitkDataStorage.h>
#include <mitkIDataStorageService.h>
#include <mitkIDataStorageReference.h>
#include <QmitkAbstractMultiWidget.h>
// CTK Includes
#include <ctkServiceTracker.h>
//# forward declarations
namespace mitk {
class DataNode;
struct IDataStorageService;
}
namespace berry {
struct IBerryPreferences;
}
class QmitkFunctionalitySelectionProvider;
///
/// \ingroup org_mitk_gui_qt_common_legacy
///
/// \class QmitkFunctionality
///
/// \brief The base class of all MITK related blueberry views (~ in the old version of MITK, this was called "Functionality")
///
/// QmitkFunctionality provides several convenience methods that eases the introduction of a new view:
///
/// <ol>
/// <li> Access to the DataStorage (~ the shared data repository)
/// <li> Access to the MultiWidget
/// <li> Access to and update notification for the functionality/view preferences
/// <li> Access to and update notification for the current DataNode selection / to DataNode selection events send through the SelectionService
/// <li> Methods to send DataNode selections through the SelectionService
/// <li> Some events for unproblematic inter-View communication (e.g. when to add/remove interactors)
/// <li> Some minor important convenience methods (like changing the mouse cursor/exception handling)
/// </ol>
///
/// Please use the Activated/Deactivated method to add/remove interactors, disabling multiwidget crosshair or anything which may
/// "affect" other functionalities. For further reading please have a look at QmitkFunctionality::IsExclusiveFunctionality().
///
class MITK_QT_COMMON_LEGACY QmitkFunctionality : public berry::QtViewPart
{
//# public virtual methods which can be overwritten
public:
///
/// Creates smartpointer typedefs
///
berryObjectMacro(QmitkFunctionality);
///
/// Nothing to do in the standard ctor. <b>Initiliaze your GUI in CreateQtPartControl(QWidget*)</b>
/// \see berry::QtViewPart::CreateQtPartControl(QWidget*)
///
QmitkFunctionality();
///
/// Disconnects all standard event listeners
///
~QmitkFunctionality() override;
///
/// Called, when the WorkbenchPart gets closed
/// by the user directly or by closing the whole
/// app (e.g. for removing event listeners)
///
virtual void ClosePart();
///
/// Called when the selection in the workbench changed
///
virtual void OnSelectionChanged(std::vector<mitk::DataNode*> /*nodes*/);
///
/// Called when the preferences object of this view changed.
/// \see GetPreferences()
///
virtual void OnPreferencesChanged(const berry::IBerryPreferences*);
///
/// Make this view manage multiple DataStorage. If set to true GetDataStorage()
/// will return the currently active DataStorage (and not the default one).
/// \see GetDataStorage()
///
void SetHandleMultipleDataStorages(bool multiple);
///
/// \return true if this view handles multiple DataStorages, false otherwise
///
bool HandlesMultipleDataStorages() const;
///
/// Called when a MultiWidget is available. Should not be used anymore, see GetActiveMultiWidget()
/// \see GetActiveMultiWidget()
///
virtual void MultiWidgetAvailable(QmitkAbstractMultiWidget& multiWidget);
///
/// Called when a MultiWidget is available. Should not be used anymore, see GetActiveMultiWidget()
/// \see GetActiveMultiWidget()
///
virtual void MultiWidgetClosed(QmitkAbstractMultiWidget& multiWidget);
///
/// Called when no MultiWidget is available anymore. Should not be used anymore, see GetActiveMultiWidget()
/// \see GetActiveMultiWidget()
///
virtual void MultiWidgetNotAvailable();
///
/// Only called when IsExclusiveFunctionality() returns true.
/// \see IsExclusiveFunctionality()
///
virtual void Activated();
///
/// \return true if this view is currently activated, false otherwise
///
bool IsActivated() const;
///
/// Only called when IsExclusiveFunctionality() returns true.
/// \see IsExclusiveFunctionality()
///
virtual void Deactivated();
///
/// Some functionalities need to add special interactors, removes the crosshair from the multiwidget, etc.
/// In this case the functionality has to tidy up when changing to another functionality
/// which also wants to change the "default configuration". In the old Qt3-based
/// version of MITK, two functionalities could never be opened at the same time so that the
/// methods Activated() and Deactivated() were the right place for the functionalitites to
/// add/remove their interactors, etc. This is still true for the new MITK Workbench,
/// but as there can be several functionalities visible at the same time, the behaviour concerning
/// when Activated() and Deactivated() are called has changed:
///
/// 1. Activated() and Deactivated() are only called if IsExclusiveFunctionality() returns true
///
/// 2. If only one standalone functionality is or becomes visible, Activated() will be called on that functionality
///
/// 3. If two or more standalone functionalities are visible,
/// Activated() will be called on the functionality that receives focus, Deactivated() will be called
/// on the one that looses focus, gets hidden or closed
///
///
/// As a consequence of 1. if you overwrite IsExclusiveFunctionality() and let it return false, you
/// signalize the MITK Workbench that this functionality does nothing to the "default configuration"
/// and can easily be visible while other functionalities are also visible.
///
/// By default the method returns true.
///
/// \return true if this functionality is meant to work as a standalone view, false otherwise
///
virtual bool IsExclusiveFunctionality() const;
///
/// Informs other parts of the workbench that node is selected via the blueberry selection service.
///
void FireNodeSelected(mitk::DataNode* node);
///
/// Informs other parts of the workbench that the nodes are selected via the blueberry selection service.
///
void FireNodesSelected(std::vector<mitk::DataNode*> nodes);
///
/// Called when this functionality becomes visible ( no matter what IsExclusiveFunctionality() returns )
///
virtual void Visible();
///
/// \return true if this view is currently visible, false otherwise
///
bool IsVisible() const;
///
/// Called when this functionality is hidden ( no matter what IsExclusiveFunctionality() returns )
///
virtual void Hidden();
//# protected virtual methods which can be overwritten
protected:
///
/// Called when a DataStorage Add event was thrown. May be reimplemented
/// by deriving classes.
///
virtual void NodeAdded(const mitk::DataNode* node);
///
/// Called when a DataStorage Changed event was thrown. May be reimplemented
/// by deriving classes.
///
virtual void NodeChanged(const mitk::DataNode* /*node*/);
///
/// Called when a DataStorage Remove event was thrown. May be reimplemented
/// by deriving classes.
///
virtual void NodeRemoved(const mitk::DataNode* node);
///
/// Called when a DataStorage add *or* remove *or* change event was thrown. May be reimplemented
/// by deriving classes.
///
virtual void DataStorageChanged();
///
/// \return the selection of the currently active part of the workbench or an empty vector
/// if nothing is selected
///
std::vector<mitk::DataNode*> GetCurrentSelection() const;
///
/// Returns the current selection made in the datamanager bundle or an empty vector
/// if nothing`s selected or if the bundle does not exist
///
std::vector<mitk::DataNode*> GetDataManagerSelection() const;
///
/// Returns the Preferences object for this Functionality.
/// <b>Important</b>: When refering to this preferences, e.g. in a PreferencePage: The ID
/// for this preferences object is "/<VIEW-ID>", e.g. "/org.mitk.views.datamanager"
///
berry::IPreferences::Pointer GetPreferences() const;
///
/// Returns the default <b>or</b> the currently active DataStorage if m_HandlesMultipleDataStorages
/// is set to true
/// \see SetHandleMultipleDataStorages(bool)
/// \see HandlesMultipleDataStorages()
///
mitk::DataStorage::Pointer GetDataStorage() const;
///
/// \return always returns the default DataStorage
///
mitk::DataStorage::Pointer GetDefaultDataStorage() const;
mitk::IDataStorageReference::Pointer GetDataStorageReference() const;
///
/// Returns the default and active MultiWidget.
/// \param reCreateWidget a boolean flag to en-/disable the attempt to re-create the StdWidget
/// <b>If there is not MultiWidget yet a new one is
/// created in this method when called with default parameter!</b>
///
QmitkAbstractMultiWidget* GetActiveMultiWidget( bool reCreateWidget = true);
///
/// Outputs an error message to the console and displays a message box containing
/// the exception description.
/// \param e the exception which should be handled
+ /// \param parent
/// \param showDialog controls, whether additionally a message box should be
/// displayed to inform the user that something went wrong
///
void HandleException( std::exception& e, QWidget* parent = nullptr, bool showDialog = true ) const;
///
/// Calls HandleException ( std::exception&, QWidget*, bool ) internally
/// \see HandleException ( std::exception&, QWidget*, bool )
///
void HandleException( const char* str, QWidget* parent = nullptr, bool showDialog = true ) const;
///
/// Convenient method to set and reset a wait cursor ("hourglass")
///
void WaitCursorOn();
///
/// Convenient method to restore the standard cursor
///
void WaitCursorOff();
///
/// Convenient method to set and reset a busy cursor
///
void BusyCursorOn();
///
/// Convenient method to restore the standard cursor
///
void BusyCursorOff();
///
/// Convenient method to restore the standard cursor
///
void RestoreOverrideCursor();
//# other public methods which should not be overwritten
public:
///
/// Creates a scroll area for this view and calls CreateQtPartControl then
///
void CreatePartControl(QWidget* parent) override;
///
/// Called when this view receives the focus. Same as Activated()
/// \see Activated()
///
void SetFocus() override;
///
/// Called when a DataStorage Add Event was thrown. Sets
/// m_InDataStorageChanged to true and calls NodeAdded afterwards.
/// \see m_InDataStorageChanged
///
void NodeAddedProxy(const mitk::DataNode* node);
///
/// Called when a DataStorage remove event was thrown. Sets
/// m_InDataStorageChanged to true and calls NodeRemoved afterwards.
/// \see m_InDataStorageChanged
///
void NodeRemovedProxy(const mitk::DataNode* node);
///
/// Called when a DataStorage changed event was thrown. Sets
/// m_InDataStorageChanged to true and calls NodeChanged afterwards.
/// \see m_InDataStorageChanged
///
void NodeChangedProxy(const mitk::DataNode* node);
///
/// Toggles the visible flag m_Visible
///
void SetVisible(bool visible);
///
/// Toggles the activated flag m_Activated
///
void SetActivated(bool activated);
///
/// Called, when the WorkbenchPart gets closed for removing event listeners
/// Internally this method calls ClosePart after it removed the listeners registered
/// by QmitkFunctionality. By having this proxy method the user does not have to
/// call QmitkFunctionality::ClosePart() when overwriting ClosePart()
///
void ClosePartProxy();
//# other protected methods which should not be overwritten (or which are deprecated)
protected:
///
/// Called immediately after CreateQtPartControl().
/// Here standard event listeners for a QmitkFunctionality are registered
///
void AfterCreateQtPartControl();
///
/// code to activate the last visible functionality
///
void ActivateLastVisibleFunctionality();
///
/// reactions to selection events from data manager (and potential other senders)
///
void BlueBerrySelectionChanged(const berry::IWorkbenchPart::Pointer& sourcepart, const berry::ISelection::ConstPointer& selection);
///
/// Converts a mitk::DataNodeSelection to a std::vector<mitk::DataNode*> (possibly empty
///
std::vector<mitk::DataNode*> DataNodeSelectionToVector(mitk::DataNodeSelection::ConstPointer currentSelection) const;
//# protected fields
protected:
///
/// helper stuff to observe BlueBerry selections
///
friend struct berry::SelectionChangedAdapter<QmitkFunctionality>;
///
/// Saves the parent of this view (this is the scrollarea created in CreatePartControl(QWidget*)
/// \see CreatePartControl(QWidget*)
///
QWidget* m_Parent;
///
/// Saves if this view is the currently active one.
///
bool m_Active;
///
/// Saves if this view is visible
///
bool m_Visible;
//# private fields:
private:
///
/// Holds the current selection (selection made by this Functionality !!!)
///
QmitkFunctionalitySelectionProvider* m_SelectionProvider;
///
/// object to observe BlueBerry selections
///
QScopedPointer<berry::ISelectionListener> m_BlueBerrySelectionListener;
ctkServiceTracker<mitk::IDataStorageService*> m_DataStorageServiceTracker;
///
/// Saves if this view handles multiple datastorages
///
bool m_HandlesMultipleDataStorages;
///
/// Saves if this class is currently working on DataStorage changes.
/// This is a protector variable to avoid recursive calls on event listener functions.
bool m_InDataStorageChanged;
///
/// saves all visible functionalities
///
std::set<std::string> m_VisibleFunctionalities;
};
#endif /*QMITKFUNCTIONALITY_H_*/
diff --git a/Plugins/org.mitk.gui.qt.common/src/QmitkAbstractView.h b/Plugins/org.mitk.gui.qt.common/src/QmitkAbstractView.h
index 9cd2453c30..6fb4f65f85 100644
--- a/Plugins/org.mitk.gui.qt.common/src/QmitkAbstractView.h
+++ b/Plugins/org.mitk.gui.qt.common/src/QmitkAbstractView.h
@@ -1,362 +1,363 @@
/*============================================================================
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 QMITKABSTRACTVIEW_H_
#define QMITKABSTRACTVIEW_H_
//# blueberry stuff
#include <berryQtViewPart.h>
#include <berryIPreferencesService.h>
#include <berryISelectionListener.h>
#include <berryIPreferences.h>
//# mitk stuff
#include <org_mitk_gui_qt_common_Export.h>
#include "mitkDataNodeSelection.h"
#include "mitkIRenderWindowPart.h"
#include <mitkWorkbenchUtil.h>
#include <mitkDataStorage.h>
#include <mitkRenderingManager.h>
#include <mitkIDataStorageReference.h>
#include <QItemSelectionModel>
namespace mitk {
class DataNode;
}
namespace berry {
struct IBerryPreferences;
}
class QmitkAbstractViewPrivate;
class QmitkAbstractViewSelectionProvider;
/**
* \ingroup org_mitk_gui_qt_common
*
* \brief A convenient base class for MITK related BlueBerry Views.
*
* QmitkAbstractView provides several convenience methods that ease the introduction of a new view:
*
* <ol>
* <li> Access to the DataStorage (~ the shared data repository)
* <li> Access to the active IRenderWindowPart
* <li> Access to and update notification for the view's preferences
* <li> Access to and update notification for the current DataNode selection / to DataNode selection events send through the SelectionService
* <li> Access to and update notification for DataNode events (added/removed/modified)
* <li> Methods to send DataNode selections through the SelectionService
* <li> Some minor important convenience methods (like changing the mouse cursor/exception handling)
* </ol>
*
* Usually all MITK Views inherit from QmitkAbstractView to achieve a consistent Workbench behavior.
*
* When inheriting from QmitkAbstractView, you must implement the following methods:
* <ul>
* <li>void CreateQtPartControl(QWidget* parent)
* <li>void SetFocus()
* </ul>
*
* You may reimplement the following private virtual methods to customize your View's behavior:
* <ul>
* <li>void SetSelectionProvider()
* <li>QItemSelectionModel* GetDataNodeSelectionModel() const
* </ul>
*
* You may reimplement the following private virtual methods to be notified about certain changes:
* <ul>
* <li>void OnSelectionChanged(berry::IWorkbenchPart::Pointer part, const QList<mitk::DataNode::Pointer> &nodes)
* <li>void OnNullSelection(berry::IWorkbenchPart::Pointer part)
* <li>void OnPreferencesChanged(const berry::IBerryPreferences*)
* <li>void NodeAdded(const mitk::DataNode* node)
* <li>void NodeChanged(const mitk::DataNode* node)
* <li>void NodeRemoved(const mitk::DataNode* node)
* <li>void DataStorageModified()
* <li>void DataStorageChanged(mitk::IDataStorageReference::Pointer dsRef)
* </ul>
*
* \see mitk::ILifecycleAwarePart
* \see mitk::IZombieViewPart
* \see mitk::IRenderWindowPartListener
*/
class MITK_QT_COMMON QmitkAbstractView : public berry::QtViewPart
{
public:
/**
* Creates smartpointer typedefs
*/
berryObjectMacro(QmitkAbstractView);
/**
* Nothing to do in the standard ctor. <b>Initiliaze your GUI in CreateQtPartControl(QWidget*)</b>
* \see berry::QtViewPart::CreateQtPartControl(QWidget*)
*/
QmitkAbstractView();
/**
* Disconnects all standard event listeners
*/
~QmitkAbstractView() override;
protected:
/**
* Informs other parts of the workbench that node is selected via the blueberry selection service.
*
* \note This method should not be used if you have set your own selection provider via
* SetSelectionProvider() or your own QItemSelectionModel via GetDataNodeSelectionModel().
*/
void FireNodeSelected(mitk::DataNode::Pointer node);
/**
* Informs other parts of the workbench that the nodes are selected via the blueberry selection service.
*
* \note This method should not be used if you have set your own selection provider via
* SetSelectionProvider() or your own QItemSelectionModel via GetDataNodeSelectionModel().
*/
virtual void FireNodesSelected(const QList<mitk::DataNode::Pointer>& nodes);
/**
* \return The selection of the currently active part of the workbench or an empty list
* if there is no selection or if it is empty.
*
* \see IsCurrentSelectionValid
*/
QList<mitk::DataNode::Pointer> GetCurrentSelection() const;
/**
* Queries the state of the current selection.
*
* \return If the current selection is <code>nullptr</code>, this method returns
* <code>false</code> and <code>true</code> otherwise.
*/
bool IsCurrentSelectionValid() const;
/**
* Returns the current selection made in the datamanager bundle or an empty list
* if there is no selection or if it is empty.
*
* \see IsDataManagerSelectionValid
*/
QList<mitk::DataNode::Pointer> GetDataManagerSelection() const;
/**
* Queries the state of the current selection of the data manager view.
*
* \return If the current data manager selection is <code>nullptr</code>, this method returns
* <code>false</code> and <code>true</code> otherwise.
*/
bool IsDataManagerSelectionValid() const;
/**
* Sets the selection of the data manager view if available.
*
* \param selection The new selection for the data manager.
* \param flags The Qt selection flags for controlling the way how the selection is updated.
*/
void SetDataManagerSelection(const berry::ISelection::ConstPointer& selection,
QItemSelectionModel::SelectionFlags flags = QItemSelectionModel::ClearAndSelect) const;
/**
* Takes the current selection and sets it on the data manager. Only matching nodes in the
* data manager view will be selected.
*/
void SynchronizeDataManagerSelection() const;
/**
* Returns the Preferences object for this View.
* <b>Important</b>: When refering to this preferences, e.g. in a PreferencePage: The ID
* for this preferences object is "/<VIEW-ID>", e.g. "/org.mitk.views.datamanager"
*/
berry::IPreferences::Pointer GetPreferences() const;
/**
* Returns a reference to the currently active DataStorage.
*/
mitk::IDataStorageReference::Pointer GetDataStorageReference() const;
/**
* Returns the currently active DataStorage.
*/
mitk::DataStorage::Pointer GetDataStorage() const;
/**
* Returns the currently active mitk::IRenderWindowPart.
*
* \param strategies Strategies for returning a mitk::IRenderWindowPart instance if there
* is currently no active one.
* \return The active mitk::IRenderWindowPart.
*/
mitk::IRenderWindowPart* GetRenderWindowPart(mitk::WorkbenchUtil::IRenderWindowPartStrategies strategies = mitk::WorkbenchUtil::NONE) const;
/**
* Request an update of all render windows of the currently active IRenderWindowPart.
*
* \param requestType Specifies the type of render windows for which an update
* will be requested.
*/
void RequestRenderWindowUpdate(mitk::RenderingManager::RequestType requestType = mitk::RenderingManager::REQUEST_UPDATE_ALL);
/**
* Outputs an error message to the console and displays a message box containing
* the exception description.
* \param e the exception which should be handled
+ * \param parent
* \param showDialog controls, whether additionally a message box should be
* displayed to inform the user that something went wrong
*/
void HandleException( std::exception& e, QWidget* parent = nullptr, bool showDialog = true ) const;
/**
* Calls HandleException ( std::exception&, QWidget*, bool ) internally
* \see HandleException ( std::exception&, QWidget*, bool )
*/
void HandleException( const char* str, QWidget* parent = nullptr, bool showDialog = true ) const;
/**
* Convenient method to set and reset a wait cursor ("hourglass")
*/
void WaitCursorOn();
/**
* Convenient method to restore the standard cursor
*/
void WaitCursorOff();
/**
* Convenient method to set and reset a busy cursor
*/
void BusyCursorOn();
/**
* Convenient method to restore the standard cursor
*/
void BusyCursorOff();
/**
* Convenient method to restore the standard cursor
*/
void RestoreOverrideCursor();
private:
/**
* Reimplement this method to set a custom selection provider. This method is
* called once after CreateQtPartControl().
*
* The default implementation registers a QmitkDataNodeSelectionProvider with
* a QItemSelectionModel returned by GetDataNodeSelectionModel().
*/
virtual void SetSelectionProvider();
/**
* Reimplement this method to supply a custom Qt selection model. The custom
* model will be used with the default selection provider QmitkDataNodeSelectionProvider
* to inform the MITK Workbench about selection changes.
*
* If you reimplement this method, the methods FireNodeSelected() and FireNodesSelected()
* will have no effect. Use your custom selection model to notify the MITK Workbench
* about selection changes.
*
* The Qt item model used with the custom selection model must return mitk::DataNode::Pointer
* objects for model indexes when the role is QmitkDataNodeRole.
*/
virtual QItemSelectionModel* GetDataNodeSelectionModel() const;
/**
* Called when the selection in the workbench changed.
* May be reimplemented by deriving classes.
*
* \param part The source part responsible for the selection change.
* \param nodes A list of selected nodes.
*
* \see OnNullSelection
*/
virtual void OnSelectionChanged(berry::IWorkbenchPart::Pointer part, const QList<mitk::DataNode::Pointer> &nodes);
/**
* Called when a <code>nullptr</code> selection occurs.
*
* \param part The source part responsible for the selection change.
*/
virtual void OnNullSelection(berry::IWorkbenchPart::Pointer part);
/**
* Called when the preferences object of this view changed.
* May be reimplemented by deriving classes.
*
* \see GetPreferences()
*/
virtual void OnPreferencesChanged(const berry::IBerryPreferences*);
/**
* Called when a DataStorage Add event was thrown. May be reimplemented
* by deriving classes.
*/
virtual void NodeAdded(const mitk::DataNode* node);
/**
* Called when a DataStorage Changed event was thrown. May be reimplemented
* by deriving classes.
*/
virtual void NodeChanged(const mitk::DataNode* node);
/**
* Called when a DataStorage Remove event was thrown. May be reimplemented
* by deriving classes.
*/
virtual void NodeRemoved(const mitk::DataNode* node);
/**
* Called when a DataStorage add *or* remove *or* change event from the currently active
* data storage is thrown.
*
* May be reimplemented by deriving classes.
*/
virtual void DataStorageModified();
/**
* Called when the currently active DataStorage changed.
* May be reimplemented by deriving classes.
*
* \param dsRef A reference to the new active DataStorage.
*/
virtual void DataStorageChanged(mitk::IDataStorageReference::Pointer dsRef);
/**
* Creates a scroll area for this view and calls CreateQtPartControl then
*/
void CreatePartControl(QWidget* parent) override;
/**
* Called immediately after CreateQtPartControl().
* Here standard event listeners for a QmitkAbstractView are registered
*/
void AfterCreateQtPartControl();
private:
friend class QmitkAbstractViewPrivate;
friend class QmitkViewCoordinator;
Q_DISABLE_COPY(QmitkAbstractView)
const QScopedPointer<QmitkAbstractViewPrivate> d;
};
#endif /*QMITKABSTRACTVIEW_H_*/
diff --git a/Plugins/org.mitk.gui.qt.common/src/QmitkMultiWidgetDecorationManager.h b/Plugins/org.mitk.gui.qt.common/src/QmitkMultiWidgetDecorationManager.h
index e48319e7bb..7b42bbe25a 100644
--- a/Plugins/org.mitk.gui.qt.common/src/QmitkMultiWidgetDecorationManager.h
+++ b/Plugins/org.mitk.gui.qt.common/src/QmitkMultiWidgetDecorationManager.h
@@ -1,140 +1,140 @@
/*============================================================================
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 QMITKMULTIWIDGETDECORATIONMANAGER_H
#define QMITKMULTIWIDGETDECORATIONMANAGER_H
#include <org_mitk_gui_qt_common_Export.h>
// mitk core
#include <mitkColorProperty.h>
// mitk annotation
#include <mitkLogoAnnotation.h>
// mitk qt widgets
#include <QmitkAbstractMultiWidget.h>
// berry
#include <berryIBerryPreferences.h>
// vtk
#include <vtkImageData.h>
#include <vtkSmartPointer.h>
// qt
#include <QString>
#include <QStringList>
/**
* @brief
*
*
*/
class MITK_QT_COMMON QmitkMultiWidgetDecorationManager
{
public:
QmitkMultiWidgetDecorationManager(QmitkAbstractMultiWidget* multiWidget);
enum class Colormap
{
BlackAndWhite = 0 // black background, white decoration
};
void DecorationPreferencesChanged(const berry::IBerryPreferences* preferences);
/**
* @brief Show or hide decorations like like colored borders or background, logos, menu widgets, logos and
* text annotations.
*
* \@par Show the decorations specified in decorations if true. Hide them, if not.
* \@par A list of decoration names. If empty, all supported decorations are affected.
*/
void ShowDecorations(bool show, const QStringList& decorations);
/**
* @brief Return if a specific decoration is visible.
*
* \return True, if the specified decoration is shown, false if not.
*/
bool IsDecorationVisible(const QString &decoration) const;
QStringList GetDecorations() const;
void SetupLogo(const char* path);
void ShowLogo(bool show);
bool IsLogoVisible() const;
void SetColormap(Colormap colormap);
void SetDecorationColor(const QString& widgetID, const mitk::Color& color);
void SetAllDecorationColors(const mitk::Color& color);
mitk::Color GetDecorationColor(const QString& widgetID) const;
void ShowColoredRectangle(const QString& widgetID, bool show);
void ShowAllColoredRectangles(bool show);
bool IsColoredRectangleVisible(const QString& widgetID) const;
bool AreAllColoredRectanglesVisible() const;
/**
* @brief Set a background color gradient for a specific render window.
*
* If two different input colors are used, a gradient background is generated.
*
* @param upper The color of the gradient background.
* @param lower The color of the gradient background.
* @param widgetID The widget identifier.
*/
void SetGradientBackgroundColors(const mitk::Color& upper, const mitk::Color& lower, const QString& widgetID);
/**
* @brief Set a background color gradient for all available render windows.
*
* If two different input colors are used, a gradient background is generated.
*
* @param upper The color of the gradient background.
* @param lower The color of the gradient background.
*/
void SetAllGradientBackgroundColors(const mitk::Color& upper, const mitk::Color& lower);
void FillAllGradientBackgroundColorsWithBlack();
void ShowGradientBackground(const QString& widgetID, bool show);
void ShowAllGradientBackgrounds(bool show);
/**
- * @rief Return a render window (widget) specific background color gradient
+ * @brief Return a render window (widget) specific background color gradient
*
* @param widgetID The widget identifier.
*
* @return A color gradient as a pair of colors.
* First entry: upper color value
* Second entry: lower color value
*/
std::pair<mitk::Color, mitk::Color> GetGradientBackgroundColors(const QString& widgetID) const;
bool IsGradientBackgroundOn(const QString& widgetID) const;
bool AreAllGradientBackgroundsOn() const;
void SetCornerAnnotationText(const QString& widgetID, const std::string& cornerAnnotation);
std::string GetCornerAnnotationText(const QString& widgetID) const;
void ShowCornerAnnotation(const QString& widgetID, bool show);
void ShowAllCornerAnnotations(bool show);
bool IsCornerAnnotationVisible(const QString& widgetID) const;
bool AreAllCornerAnnotationsVisible() const;
private:
vtkSmartPointer<vtkImageData> GetVtkLogo(const char* path);
void SetLogo(vtkSmartPointer<vtkImageData> vtkLogo);
QmitkAbstractMultiWidget* m_MultiWidget;
mitk::LogoAnnotation::Pointer m_LogoAnnotation;
};
#endif // QMITKMULTIWIDGETDECORATIONMANAGER_H
diff --git a/Plugins/org.mitk.gui.qt.common/src/QmitkNodeSelectionDialog.h b/Plugins/org.mitk.gui.qt.common/src/QmitkNodeSelectionDialog.h
index c40dde3199..217e212b6d 100644
--- a/Plugins/org.mitk.gui.qt.common/src/QmitkNodeSelectionDialog.h
+++ b/Plugins/org.mitk.gui.qt.common/src/QmitkNodeSelectionDialog.h
@@ -1,146 +1,146 @@
/*============================================================================
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 QMITK_NODE_SELECTION_DIALOG_H
#define QMITK_NODE_SELECTION_DIALOG_H
#include "org_mitk_gui_qt_common_Export.h"
#include "ui_QmitkNodeSelectionDialog.h"
#include <mitkDataStorage.h>
#include <mitkWeakPointer.h>
#include <mitkNodePredicateBase.h>
#include "mitkIDataStorageInspectorProvider.h"
#include <QmitkAbstractDataStorageInspector.h>
#include <QDialog>
#include <QPushButton>
/**
* @class QmitkNodeSelectionDialog
* @brief A customized QDialog that displays different data storage inspectors and allows to
* set and get a current selection by selecting data nodes in the data storage inspectors.
*/
class MITK_QT_COMMON QmitkNodeSelectionDialog : public QDialog
{
Q_OBJECT
public:
explicit QmitkNodeSelectionDialog(QWidget* parent = nullptr, QString caption = "", QString hint = "");
/**
* @brief Set the data storage that will be used.
* The function iterates over the dialog's panels and sets the data storage of each panel accordingly.
* Each panel is a specific data storage inspector.
*
* @param dataStorage A pointer to the data storage to set.
*/
void SetDataStorage(mitk::DataStorage* dataStorage);
/**
* @brief Set the node predicate that will be used.
* The function iterates over the dialog's panels and sets the node predicate of each panel accordingly.
* Each panel is a specific data storage inspector.
*
* @param nodePredicate A pointer to node predicate.
*/
virtual void SetNodePredicate(const mitk::NodePredicateBase* nodePredicate);
const mitk::NodePredicateBase* GetNodePredicate() const;
using NodeList = QList<mitk::DataNode::Pointer>;
NodeList GetSelectedNodes() const;
/**
* @brief Helper function that is used to check the given selection for consistency.
* Returning an empty string assumes that everything is alright and the selection is valid.
* If the string is not empty, the content of the string will be used as error message.
*/
using SelectionCheckFunctionType = std::function<std::string(const NodeList &)>;
/**
* @brief A selection check function can be set. If set the dialog uses this function to check the made/set selection.
* If the selection is valid, everything is fine.
* If the selection is indicated as invalid, the dialog will display the selection check function error message.
*/
void SetSelectionCheckFunction(const SelectionCheckFunctionType &checkFunction);
bool GetSelectOnlyVisibleNodes() const;
using SelectionMode = QAbstractItemView::SelectionMode;
/**
* @brief Set the Qt selection mode (e.g. Single selection, multi selection).
* The function iterates over the dialog's panels and sets the Qt selection mode of each panel accordingly.
* Each panel is a concrete data storage inspector.
*
* @param mode The QAbstractItemView::SelectionMode to define the selection mode.
*/
void SetSelectionMode(SelectionMode mode);
SelectionMode GetSelectionMode() const;
Q_SIGNALS:
/**
* @brief A signal that will be emitted if the selected node has changed.
*
* @param nodes A list of data nodes that are newly selected.
*/
void CurrentSelectionChanged(NodeList nodes);
public Q_SLOTS:
/**
* @brief Set the selection modus to (not) include invisible nodes in the selection.
* The function iterates over the dialog's panels and sets the selection modus of each panel accordingly.
* Each panel is a concrete data storage inspector.
*
* @param selectOnlyVisibleNodes The bool value to define the selection modus.
*/
void SetSelectOnlyVisibleNodes(bool selectOnlyVisibleNodes);
/**
* @brief Set the currently selected nodes given a list of data nodes.
* The function iterates over the dialog's panels and sets the current selection of each panel accordingly.
* Each panel is a concrete data storage inspector.
*
- * @param nodes A list of data nodes that should be newly selected.
+ * @param selectedNodes A list of data nodes that should be newly selected.
*/
void SetCurrentSelection(NodeList selectedNodes);
protected Q_SLOTS:
void OnSelectionChanged(NodeList selectedNodes);
void OnFavoriteNodesButtonClicked();
void OnOK();
void OnCancel();
void OnDoubleClicked(const QModelIndex& index);
protected:
void SetErrorText(const std::string& checkResponse);
void AddPanel(const mitk::IDataStorageInspectorProvider* provider, const mitk::IDataStorageInspectorProvider::InspectorIDType &preferredID, bool &preferredFound, int &preferredIndex);
mitk::WeakPointer<mitk::DataStorage> m_DataStorage;
mitk::NodePredicateBase::ConstPointer m_NodePredicate;
bool m_SelectOnlyVisibleNodes;
NodeList m_SelectedNodes;
SelectionCheckFunctionType m_CheckFunction;
SelectionMode m_SelectionMode;
using PanelVectorType = std::vector<QmitkAbstractDataStorageInspector*>;
PanelVectorType m_Panels;
QPushButton* m_FavoriteNodesButton;
Ui_QmitkNodeSelectionDialog m_Controls;
};
#endif // QMITK_NODE_SELECTION_DIALOG_H
diff --git a/Plugins/org.mitk.gui.qt.datamanager/documentation/UserManual/QmitkDatamanager.dox b/Plugins/org.mitk.gui.qt.datamanager/documentation/UserManual/QmitkDatamanager.dox
index 78387972f7..505f2ac4bb 100644
--- a/Plugins/org.mitk.gui.qt.datamanager/documentation/UserManual/QmitkDatamanager.dox
+++ b/Plugins/org.mitk.gui.qt.datamanager/documentation/UserManual/QmitkDatamanager.dox
@@ -1,194 +1,194 @@
/**
-\page org_mitk_views_datamanager The Datamanager
+\page org_mitk_views_datamanager The Data Manager View
-\imageMacro{data-manager.svg,"Icon of the Data Manager", 2.00}
+\imageMacro{data-manager-dox.svg,"Icon of the Data Manager", 2.00}
\tableofcontents
\section DataManagerIntroduction Introduction
The Datamanager is the central component to manage medical data like images, segmentation masks, registrations, surfaces, point sets, annotations, measurements, etc..<br>
After loading data into the Datamanager the data is shown in the four-view window, the so-called <em>Standard Display</em>.
The user can now start working on the data by interacting with the data inside the <em>Standard Display</em>,
by using the MITK-plugins such as <em>Segmentation</em> or <em>Basic Image Processing</em> or by using the context menu inside the data manager.
\section DataManagerLoadingData Loading Data
There are several ways of loading data into the Datamanager as so-called <em>data nodes</em>:
<ul>
<li> drag and drop data (e.g. from a file explorer or desktop) into the Datamanager
<li> drag and drop data (e.g. from a file explorer or desktop) into one of the four windows of the <em>Standard Display</em>
<li> use the keyboard shortcut <em>Ctrl + o</em>
<li> use the <em>Open File</em> Button in the left upper corner and use the <em>Open</em> Dialog
<li> use <em>File -> Open File...</em> from the top menu
</ul>
A lot of file-formats can be loaded into MITK, for example:
<ul>
<li> 2D-images / 3D-volumes with or without several time steps (*.dcm, *.ima, *.pic, *.nrrd, ...)
<li> Surfaces (*.stl, *.vtk, ...)
<li> Point sets (*.mps)
<li> and many more
</ul>
-The user can also load a series of 2D images (e.g. image001.png, image002.png ...) to a MITK 3D volume.
+The user can also load a series of 2D images (e.g. image001.png, image002.png ...) to a MITK 3D volume.
To do this, just drag and drop one of those 2D data files into the Datamanager by holding the ALT key.
<em>Note: What really happens is that the data nodes are stored inside a "Data storage" and the Datamanager is just a visual representation of the data inside the "Data storage".
That's why the documentation sometimes uses the term "Data storage" instead of "Datamanager".</em>
\section DataManagerSavingData Saving Data
There are several ways of saving data from the Datamanager:
<ul>
<li> use the keyboard shortcut <em>Ctrl + s</em> on a single data node
<li> use the keyboard shortcut <em>Ctrl + s</em> on multiple data nodes
<li> use the context menu <em>right-click -> Save</em> on a single data node
<li> use the context menu <em>right-click -> Save</em> on multiple data nodes
<li> use <em>File -> Save...</em> from the top menu on a single data node
<li> use <em>File -> Save...</em> from the top menu on multiple data nodes
</ul>
\section DataManagerWorking Working with the Datamanager
After loading data into the Datamanager the data appears as data nodes in a sorted list inside the Datamanager.
The user can change the order of the data nodes manually by dragging one or multiple data nodes and dropping them at any position inside the Datamanager.
Data nodes can also be sorted hierarchically as a parent-child-relation.
For example after using the <em>Segmentation-Plugin</em> to create a segmentation on <em>DataNode</em>, the result is created as <em>ChildNode</em>,
which is a child of <em>DataNode</em> (see \ref ParentChild "Parent-Child-Relation" screenshot).<br>
A parent-child-relation can be changed by dragging a child of a data node and dropping it onto another data node.
For this the Property <em>Allow changing of parent nodes</em> needs to be enabled (see \ref DataManagerPreferences "Preferences").
\anchor ParentChild
\imageMacro{QmitkDatamanager_ParentChild.png, "Parent-Child-Relation", 16.00}
\subsection DataManagerNodeVisibility Visibility of data nodes
By default all loaded data nodes are visible in the <em>Standard Display</em>. The visibility is indicated by the checkbox in front of the data node name in the Datamanager.
If a data node is visible, the checkbox is filled - an empty checkbox indicates a hidden data node (see \ref ParentChild "Parent-Child-Relation" screenshot).
<em>Hint: The data nodes are rendered on top of each other, such that the topmost visible data node is always displayed on top of other data nodes. By hiding
the topmost visible data node the next data node becomes the topmost visible data node and the hidden data node is not rendered anymore.</em>
<em>Note: "Visible" does not mean that the node is correctly displayed inside the render windows. The user might have to re-initialize a data node to have it correctly displayed.</em>
\subsection DataManagerNodeSelection Selection of data nodes
Some MITK-plugins contain widgets to control the data nodes that are used for plugin-specific data processing. These widgets can be configured such that they listen to
the current selection of the Datamanager. Having such a plugin active each selection change of data nodes inside the data manager will change the respective selection of
the plugin. The data node selection widgets can have specific node predicates, which means that only specific data nodes can be controlled by the widgets. It might happen
that a selected data node will not be represented in such a selection widget or that the selection widget will be emptied.
\subsection DataManagerNodeRenaming Renaming data nodes
There are two ways of changing the name of a data node inside the Datamanager:
<ul>
<li> use the <em>F2</em> key on a single data node
<li> double-click on a single data node
</ul>
In both cases the new name can be accepted by hitting <em>Enter</em> or by clicking somewhere else.
\section DataManagerContextMenu Context Menu
The Datamanager provides a context menu for each data node that can be opened by right-clicking on a data node.
An example of the context-menu can be seen in the \ref ContextMenu "Context menu" screenshot.
The context menu allows to quickly perform common actions on data nodes. These actions differ according to the data type. Some of these actions are described here.
For more actions see the respective modules and plugins (e.g. <tt>QmitkCreatePolygonModelAction</tt> inside the <tt>org_mitk_gui_qt_segmentation</tt>-plugin.
<ul>
<li> <em>Global Reinit</em>: Re-initializes the render windows to the common bounding box of all data nodes of the data storage that
<ul>
<li> have not set <tt>"includeInBoundingBox"</tt> to false
<li> are <tt>"visible"</tt>.
</ul>
In this case it does not matter on which node this action is performed.
<li> <em>Reinit</em>: Re-initializes the render windows to the common bounding box of all selected data nodes of the data storage that
<ul>
<li> have not set <tt>"includeInBoundingBox"</tt> to false
<li> are <tt>"visible"</tt>.
</ul>
<li> <em>Save</em>: see \ref DataManagerSavingData "Saving Data" section
<li> <em>Remove</em>: Removes all selected data nodes from the data storage.
<li> <em>Show only selected nodes</em>: Enables the visibility of all selected data nodes and hides all other data nodes.
<li> <em>Toggle visibility</em>: Shows / hides each selected data node according to each node's current visibility state.
<li> <em>Show details</em>: Opens a pop-up window with detailed information about each node, like data type, geometry, DICOM information, file path etc.
<li> <em>Opacity</em>: Sets the opacity via a slider for the rendering of the selected data node.
<li> <em>Color</em>: Opens a pop-up window that allows to pick an arbitrary color for the rendering of all selected data nodes.
<li> <em>Colormap</em>: Opens another submenu with a list of different colormaps that can be chosen for the rendering of all selected data nodes.
<li> <em>Component</em>: Sets the currently visible data component for the rendering of this particular component of the selected data node.
<li> <em>Texture Interpolation</em>: Smooths the data visualization for rendering of a selected data node.
<li> <em>Surface Representation</em>: Opens another submenu with the following entries:
<ul>
<li> <em>Points</em>: Visually represents a surface (a data type) as a set of points.
<li> <em>Wireframe</em>: Visually represents a surface (a data type) as a wireframe model.
<li> <em>Surface</em>: Visually represents a surface (a data type) as a solid surface.
</ul>
</ul>
As the description of the actions showed, it is possible to open / use the context menu with a single data node or with a set of selected data nodes.
If the data types of multiple selected data nodes differ, the actions might not appear / work as expected. Also some actions are not available for a set of selected data nodes.
\anchor ContextMenu
\imageMacro{QmitkDatamanager_ContextMenu.png, "Context menu", 16.00}
\section DataManagerPreferences Preferences
The MITK Workbench provides a <em>preference page</em> for specific plugins. The preference page provided for the Datamanager can be seen in the \ref PreferencePage "Preference page" screenshot.
The user can open the preference page by
<ul>
<li> using the keyboard shortcut <em>Ctrl + p</em>
<li> using <em>Window -> Preferences...</em> from the top menu.
</ul>
It allows to set the following preferences for the Datamanager, which define the behavior of the Datamanager:
<ul>
<li> <em>Place new nodes on top</em>: If enabled, newly added data nodes will be inserted at the top of the list of data nodes inside the Datamanager.
If disabled, newly added nodes will be inserted at the bottom of the list.
<li> <em>Show helper objects</em>: If enabled, data nodes that have set <tt>"helper object"</tt> to true will be displayed in the Datamanager.
If disabled, data nodes that have set <tt>"helper object"</tt> to true will not be visible in the Datamanager.
<li> <em>Show nodes containing no data</em>: If enabled, data nodes that have no underlying base data defined will be displayed in the Datamanager.
If disabled, data nodes that have no underlying base data defined will not be visible in the Datamanager.
<li> <em>Use surface decimation</em>: If enabled, a newly created surface will be decimated to reduce the number of triangles in the triangle mesh.
Such a surface can be created as a polygon model from a segmentation (see \ref DataManagerContextMenu "Context Menu").
If disabled, the surface will have its original number of triangles in the triangle mesh.
<li> <em>Allow changing of parent node</em>: If enabled, the user can change the hierarchy of the data nodes manually by dragging one or multiple data nodes and
dropping them at any position inside the Datamanager (see \ref DataManagerWorking "Working with the Datamanager") for changing the order of the data nodes manually).
</ul>
\anchor PreferencePage
\imageMacro{QmitkDatamanager_PreferencePage.png, "Preference page", 16.00}
\section DataManagerHotkeys Hotkeys
The MITK Workbench provides hotkeys for specific plugins. The hotkeys provided for the Datamanager can be seen in the \ref Hotkeys "Hotkeys" screenshot.
They allow to expedite common operations in relation to data nodes or the Datamanager.
The user can customize the hotkeys by accessing the <em>preference page</em>:
<ul>
<li> using the keyboard shortcut <em>Ctrl + p</em>
<li> useing <em>Window -> Preferences...</em> from the top menu
</ul>
<ul>
<li> <em>Delete selected nodes</em> Removes all selected data nodes from the data storage.
<li> <em>Global reinit</em> Re-initializes the render windows to the common bounding box of all data nodes of the data storage that
<ul>
<li> have not set <tt>"includeInBoundingBox"</tt> to false
<li> are <tt>"visible"</tt>
</ul>
In this case it does not matter on which node this action is performed.
<li> <em>Make all nodes invisible</em> Hides all data nodes of the data storage.
<li> <em>Reinit selected nodes</em> Re-initializes the render windows to the common bounding box of all selected data nodes of the data storage that
<ul>
<li> have not set <tt>"includeInBoundingBox"</tt> to false
<li> are <tt>"visible"</tt>
</ul>
<li> <em>Show node information</em> Opens a pop-up window with detailed information about each node, like data type, geometry, DICOM information, file path etc.
<li> <em>Toggle visibility of selected nodes</em>: Shows / hides each selected data node according to each node's current visibility state.
</ul>
\anchor Hotkeys
\imageMacro{QmitkDatamanager_Hotkeys.png, "Hotkeys", 16.00}
*/
diff --git a/Plugins/org.mitk.gui.qt.datamanager/documentation/UserManual/data-manager.svg b/Plugins/org.mitk.gui.qt.datamanager/documentation/UserManual/data-manager-dox.svg
similarity index 100%
rename from Plugins/org.mitk.gui.qt.datamanager/documentation/UserManual/data-manager.svg
rename to Plugins/org.mitk.gui.qt.datamanager/documentation/UserManual/data-manager-dox.svg
diff --git a/Plugins/org.mitk.gui.qt.datamanager/plugin.xml b/Plugins/org.mitk.gui.qt.datamanager/plugin.xml
index 43c6e710de..703cfb91f8 100644
--- a/Plugins/org.mitk.gui.qt.datamanager/plugin.xml
+++ b/Plugins/org.mitk.gui.qt.datamanager/plugin.xml
@@ -1,29 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin>
<extension point="org.blueberry.ui.views">
<view
id="org.mitk.views.datamanager"
name="Data Manager"
category="Data"
icon="resources/data-manager.svg"
class="QmitkDataManagerView" />
</extension>
<extension point="org.blueberry.ui.preferencePages">
<page id="org.mitk.gui.qt.application.DataManagerPreferencePage" name="Data Manager" class="QmitkDataManagerPreferencePage">
<keywordreference id="org.mitk.gui.qt.application.DataManagerPreferencePageKeywords"></keywordreference>
</page>
<page id="org.mitk.gui.qt.application.DataManagerHotkeysPrefPage" name="Hotkeys" class="QmitkDataManagerHotkeysPrefPage" category="org.mitk.gui.qt.application.DataManagerPreferencePage">
<keywordreference id="org.mitk.gui.qt.application.DataManagerHotkeysPrefPageKeywords"></keywordreference>
</page>
</extension>
<extension point="org.blueberry.ui.keywords">
<keyword id="org.mitk.gui.qt.application.DataManagerPreferencePageKeywords" label="data manager global reinit surface decimation parent helper objects single click property editing nodes top show containing data deleted added call"></keyword>
<keyword id="org.mitk.gui.qt.application.DataManagerHotkeysPrefPageKeywords" label="data manager hotkeys delete selected nodes global reinit invisible show information toggle visibility selected"></keyword>
</extension>
-
- <extension-point id="contextMenuActions" name="Context menu actions"/>
-
</plugin>
diff --git a/Plugins/org.mitk.gui.qt.deformableclippingplane/documentation/UserManual/QmitkClippingPlane.dox b/Plugins/org.mitk.gui.qt.deformableclippingplane/documentation/UserManual/QmitkClippingPlane.dox
index 01adc438d8..feb3c7e1f5 100644
--- a/Plugins/org.mitk.gui.qt.deformableclippingplane/documentation/UserManual/QmitkClippingPlane.dox
+++ b/Plugins/org.mitk.gui.qt.deformableclippingplane/documentation/UserManual/QmitkClippingPlane.dox
@@ -1,73 +1,73 @@
/**
-\page org_mitk_views_deformableclippingplane The Clipping Plane
+\page org_mitk_views_deformableclippingplane The Clipping Plane View
\imageMacro{QmitkClippingPlane_Icon.png,"Icon of the Clipping Plane Plugin",5.00}
\imageMacro{QmitkClippingPlane_Overview2.png,"Clipping Plane view",16.00}
\tableofcontents
\section org_mitk_views_clippingPlaneManualOverview Overview
The <b>Clipping Plane view</b> allows you to create clipping planes and calculate the volumina of the devided parts.
\section org_mitk_views_clippingPlaneTechnicalIssue Technical Issue
To use the Update Volumina function your image should be binary.
\section org_mitk_views_clippingPlaneManualImageSelection Image Selection
The Clipping Plane view makes use of the Data Manager view to give you an overview of all images, segmentations and clipping planes.
\imageMacro{QmitkClippingPlane_DataManager.png,"Data Manager is used for selecting the current clipping plane. The reference plane is selected in the drop down box of the control area.",8.00}
To select the reference plane use the drop down box in the control area of the Clipping Plane view or the Data Manager. The clipping plane selected in the Data Manager is displayed below the drop down box. If no clipping plane exists or none is selected create a new clipping plane by using the "Create new clipping plane" button.
Some items of the graphical user interface might be disabled when no plane is selected.
In any case, the application will give you hints if a selection is needed.
\section org_mitk_views_clippingPlaneCreating Creating New Clipping Plane
If you want to create a new clipping plane select an image from the Data Manager and press the button "Create new clipping plane". Optionally you can enable the "...with surface model" option.
\section org_mitk_views_clippingPlaneInteraction Interaction with the planes
\imageMacro{QmitkClippingPlane_Interaction.png,"The interaction buttons",5.00}
You have different options to interact with the clipping planes:
\subsection org_mitk_views_clippingPlaneTranslation Translation
In Translation mode you can change the position of the clipping plane.
- Click the Translation Button
- Move mouse over the selected clipping plane (the plane changes its color from blue to green)
- Hold mouse-left button and move the mouse orthogonally to the plane
\subsection org_mitk_views_clippingPlaneRotation Rotation
In Rotation mode you can change the angle of the clipping plane.
- Click the Rotation Button
- Move mouse over the selected clipping plane (the plane changes its color from blue to green)
- Hold mouse-left button and move the mouse in the direction it should be rotated
\subsection org_mitk_views_clippingPlaneDeformation Deformation
In Deformation mode you can change the surface of the clipping plane.
- Click the Deformation Button
- Move mouse over the selected clipping plane (the plane changes its color from blue to green). The deformation area is highlighted in red and yellow.
- On mouse-scrolling you can change the size of the deformation area (Scroll-Down = smaller / Scroll-Up = bigger).
- Hold mouse-left button and move the mouse orthogonally to the plane to deformate the plane
\section org_mitk_views_clippingPlaneUpdateVolumina Update Volumina
\imageMacro{QmitkClippingPlane_UpdateVolumina.png,"The 'Update Volumina' button",5.00}
Calculating the volumina of the segmentation parts, which are devided by the clipping plane(s).
- Create a segmentation (see Segmentation-Manual)
- Create one or more clipping plane(s)
- Use the interaction buttons (Translation, Rotation, Deformation) to adjust the clipping plane for intersecting the segmentation
- (You can decide which planes shouldnt be included for the calculation by changing their visibility to invisible)
- Click button "Update Volumina" button
- The intersected parts are displayed in different colors and their volumina are shown beneath the "Update Volumina" button
**/
diff --git a/Plugins/org.mitk.gui.qt.dicombrowser/documentation/UserManual/QmitkDicom.dox b/Plugins/org.mitk.gui.qt.dicombrowser/documentation/UserManual/QmitkDicom.dox
index 233ac4a5fb..d69c4c5e55 100644
--- a/Plugins/org.mitk.gui.qt.dicombrowser/documentation/UserManual/QmitkDicom.dox
+++ b/Plugins/org.mitk.gui.qt.dicombrowser/documentation/UserManual/QmitkDicom.dox
@@ -1,118 +1,118 @@
/**
\page org_mitk_editors_dicombrowser The Dicom Browser Plugin
-\imageMacro{dicom.svg,"Icon of the DICOM Plugin",2.00}
+\imageMacro{dicombrowser-dox.svg,"Icon of the DICOM Plugin",2.00}
\note This article requires a basic knowledge of the DICOM Standard.
\tableofcontents
\section org_mitk_gui_qt_dicomOverview Overview
The DICOM editor is an experimental editor which allows for loading of DICOM images as well as server communication.
It features a highly experimental query/retrieve (you need to configure your PACS correspondingly) as well as a DICOM browser.
The DICOM browser allows you to navigate the DICOM folder/cd depending on its metadata (patient/study/series)
and import selected series for viewing in your MITK based application.
It also allows you to store your dicom data in an internal database so you can easily access often used dicom images.
-It is based on the <a href="http://www.commontk.org/index.php/Documentation/Dicom_Overview">commonTK (CTK) DICOM funcionality</a>.
+It is based on the <a href="https://commontk.org/index.php/Documentation/DICOM_Overview">commonTK (CTK) DICOM funcionality</a>.
\section org_mitk_gui_qt_dicomDataHandling Data handling
\imageMacro{QmitkDicom_PluginControls.png,"The dicom Plugin controls",7.37}
In the image above you see the start page of the dicom plugin. On top of the start page you see four buttons. The Local Storage,
the Import CD, the Import Folder and the Query Retrieve button. If you press one of these buttons, the dicom plugin will switch to your local dicom image storage or will start importing dicom images
from CD or a folder on your hard drive or it will open the query retrieve screen.
<ul>
<li> Click the 'Local Storage' button to open the local storage screen.
<li> Click the 'Import CD' button to import DICOM data from a CD.
<li> Click the 'Import Folder' button to import DICOM date from a directory.
<li> Click the 'Query Retrieve' button to open the query retrieve screen.
</ul>
\subsection org_mitk_gui_qt_dicomStorage Data storage
\imageMacro{QmitkDicom_PluginExtended.png,"The DICOM data storage",16.00}
If you open the dicom plugin the dicom data storage will be displayed. You are able to see all your stored dicom image data.
You can browse your data by clicking on the left arrow beside the name of your data. There are three levels available.
The first level is the patient level where you can see the patient data. On the second level you can see the dicom studies for the patient.
on the third level you can see all available series refering to it's study.
You can delete the data by selecting it and pressing the delete button.
Be careful if you have selected a patient or a study all refering data be deleted.
So if you delete a patient the patient and all studies and series refered to the patient will be deleted.
If you delete a study all series of the study will be deleted.
If you want to view the dicom data you have to select a series and click on the View button.
The data will appear in the DataManager and will be dispayed.
\imageMacro{QmitkDicom_DisplayDataManager.png,"Viewed image",16.00}
<ul>
<li> Click on the arrow on the left of your data to expand or hide dicom data levels.
<li> Click the 'Delete' button to delete selected DICOM data.
<li> Click the 'View' button to view DICOM data.
</ul>
\subsection org_mitk_gui_qt_dicomImport Data import
\imageMacro{QmitkDicom_ImportDialog.png,"The import dialog checked",9.53}
There are two diffrent ways to import DICOM data.
The First one is to directly imort it into your DICOM data storage. To achieve this you should toggle the checkbox 'Copy on import'.
The second approach is, to have a look at the data first before importing it.
To do that you simply don't check 'Copy on import'.
This will leed you to the leed you to the 'External Dicom Data' screen which provides you a preview of the data containing in youre choosen folder.
You can import the data here by selecting it and pressing the 'Download' button.
It is also possible to view DICOM series directly in Mitk by selecting it here and pressing the 'View' button.
<ul>
<li> Click 'Import Folder' or 'Import CD' button to open the import dialog.</li>
<ul>
<li> Enable the 'Copy on import' checkbox and choose a folder to import into data storage directly.</li>
<li> Disable the 'Copy on import' checkbox to get to the 'External Dicom Data' screen.</li>
<ul>
<li> Click on the arrow on the left of your data to expand or hide dicom data levels.
<li> Click the 'Download' button to download selected DICOM data to your DICOM data storage.
<li> Click the 'View' button to view DICOM data.
</ul>
</ul>
</ul>
\section org_mitk_gui_qt_dicomQueryRetrieve Query/Retrieve
\warning This plugin is experimental and not all of the described features behave as expected.
\note The query retrieve plugin only works if the PACS you are calling knows your machine settings.
There are also issues when you are running a firewall.
The query retrieve workflow allows you to get DICOM data from a server.
\imageMacro{QmitkDicom_QueryRetrieve.png,"The query retrieve screen",16.00}
\subsection org_mitk_gui_qt_dicomQuery Query
\imageMacro{QmitkDicom_Nodes.png,"The DICOM network configuration",11.26}
By performing a DICOM query you will ask a server for it's DICOM data.
This requires to setup the DICOM network configuration of your system and the server.
By clicking on 'Add Server' a new plain server field will appear. Now you can give it a name of your choice.
Fill the servers "DICOM name" the AETitle. Type in it's url, it's port and the specific DICOM protocoll you want to use for image transfer.
\note I recommend not to use CGET because most of the PACS systems (Image Servers) don't support that protocoll.
You can configure the DICOM network configuration of your machine by editing the 'Calling AETiltle', the 'Storage AETitle' and The 'Storage Port' text fields.
But normaly you don't have to change your configuration.
\imageMacro{QmitkDicom_FilterWidget.png,"The DICOM search options",3.66}
After you have finished your network configuration and before you start the query you should use the 'Search Options' to specify your query.
Otherwise all data on the server will be queried and you will have to wait for a long time.
You can specify your query by searching for a specific patient name or a study or a serie or a specific DICOM object by it's id.
You are allowed to include or exclude DICOM modalities from your query and you can specify a specific time in which the DICOM images you are searching fo might been captured.
When you finished that you can click the query button and the queried DICOM data will appear.
<ul>
<li> Click on the 'Add Server' button.
<ul>
<li> Edit 'Name' field.
<li> Edit 'AETitle' field.
<li> Edit 'Adress' field.
<li> Edit 'Port' field.
</ul>
<li> Set search options.
<li> Click on 'Query' button.
</ul>
\subsection org_mitk_gui_qt_dicomRetrieve Retrieve
\imageMacro{QmitkDicom_Retrieve.png,"The queried DICOM data.",15.22}
After the query you are able to select the queried data and click the 'Retrieve' button.
This will store the queried DICOM data into your DICOM storage.
Click on the 'Local Storage' button and work with your new data.
<ul>
<li> Click on the 'Retrieve' button to retrieve the data to your DICOM storage.
<li> Click on the 'Local Storage' button.
</ul>
*/
diff --git a/Plugins/org.mitk.gui.qt.dicombrowser/documentation/UserManual/dicom.svg b/Plugins/org.mitk.gui.qt.dicombrowser/documentation/UserManual/dicombrowser-dox.svg
similarity index 100%
rename from Plugins/org.mitk.gui.qt.dicombrowser/documentation/UserManual/dicom.svg
rename to Plugins/org.mitk.gui.qt.dicombrowser/documentation/UserManual/dicombrowser-dox.svg
diff --git a/Plugins/org.mitk.gui.qt.dicominspector/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.dicominspector/documentation/UserManual/Manual.dox
index e1305a43b8..9ead1145cb 100644
--- a/Plugins/org.mitk.gui.qt.dicominspector/documentation/UserManual/Manual.dox
+++ b/Plugins/org.mitk.gui.qt.dicominspector/documentation/UserManual/Manual.dox
@@ -1,12 +1,12 @@
/**
\page org_mitk_views_dicominspector The DICOM Inspector
-\imageMacro{ "inspector.png", "Icon of DICOM Inspector", 2}
+\imageMacro{ "inspector-dox.png", "Icon of DICOM Inspector", 2}
This is a simple view that displays all DICOM properties of the data of the currently selected node.
DICOM properties are all properties that have a property name starting with "DICOM".
The plugin will show the dicom values corresponding to the currently selected time point and z slice.
E.G. the value of "acquesition time" will change with changing the time step of 3d+t image or the value
of "slice position" will change with changing the current z slice of the image.
*/
diff --git a/Plugins/org.mitk.gui.qt.dicominspector/documentation/UserManual/inspector.png b/Plugins/org.mitk.gui.qt.dicominspector/documentation/UserManual/inspector-dox.png
similarity index 100%
rename from Plugins/org.mitk.gui.qt.dicominspector/documentation/UserManual/inspector.png
rename to Plugins/org.mitk.gui.qt.dicominspector/documentation/UserManual/inspector-dox.png
diff --git a/Plugins/org.mitk.gui.qt.eventrecorder/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.eventrecorder/documentation/UserManual/Manual.dox
deleted file mode 100644
index 1ac1f69e7e..0000000000
--- a/Plugins/org.mitk.gui.qt.eventrecorder/documentation/UserManual/Manual.dox
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
-\page org_mitk_gui_qt_eventrecorder The Event Recorder Plugin
-
-\imageMacro{icon.png,"Icon of Eventrecorder",2.00}
-
-\tableofcontents
-
-\section org_mitk_gui_qt_eventrecorderOverview
-Describe the features of your awesome plugin here
-<ul>
-<li>Increases productivity
-<li>Creates beautiful images
-<li>Generates PhD thesis
-<li>Brings world peace
-</ul>
-
-*/
diff --git a/Plugins/org.mitk.gui.qt.eventrecorder/documentation/UserManual/icon.png b/Plugins/org.mitk.gui.qt.eventrecorder/documentation/UserManual/icon.png
deleted file mode 100644
index 0747c53912..0000000000
Binary files a/Plugins/org.mitk.gui.qt.eventrecorder/documentation/UserManual/icon.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.eventrecorder/documentation/UserManual/icon.xpm b/Plugins/org.mitk.gui.qt.eventrecorder/documentation/UserManual/icon.xpm
deleted file mode 100644
index 9057c20bc6..0000000000
--- a/Plugins/org.mitk.gui.qt.eventrecorder/documentation/UserManual/icon.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static const char * icon_xpm[] = {
-"16 16 2 1",
-" c #FF0000",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/Plugins/org.mitk.gui.qt.eventrecorder/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.eventrecorder/documentation/doxygen/modules.dox
deleted file mode 100644
index 3e7e44cb3b..0000000000
--- a/Plugins/org.mitk.gui.qt.eventrecorder/documentation/doxygen/modules.dox
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- \defgroup org_mitk_gui_qt_eventrecorder org.mitk.gui.qt.eventrecorder
- \ingroup MITKPlugins
-
- \brief Describe your plugin here.
-
-*/
-
-/**
- \defgroup org_mitk_gui_qt_eventrecorder_internal Internal
- \ingroup org_mitk_gui_qt_eventrecorder
-
- \brief This subcategory includes the internal classes of the org.mitk.gui.qt.eventrecorder plugin. Other
- plugins must not rely on these classes. They contain implementation details and their interface
- may change at any time. We mean it.
-*/
diff --git a/Plugins/org.mitk.gui.qt.ext/documentation/UserManual/MITKUserManual.dox b/Plugins/org.mitk.gui.qt.ext/documentation/UserManual/MITKUserManual.dox
index 4c320da6eb..9918cc73ad 100644
--- a/Plugins/org.mitk.gui.qt.ext/documentation/UserManual/MITKUserManual.dox
+++ b/Plugins/org.mitk.gui.qt.ext/documentation/UserManual/MITKUserManual.dox
@@ -1,111 +1,98 @@
/**
\page MITKWorkbenchManualPage The MITK Workbench
-Welcome to the basic MITK user manual. This document tries to give a concise overview of the basic functions of MITK and be an comprehensible guide on using them.
+\tableofcontents
+Welcome to the basic MITK user manual. This document tries to give a concise overview of the basic functions of MITK and be an comprehensible guide on using them.
-<div align="center"><h1>The User Interface </h1></div>
+\section MITKWorkbenchManualPage_UserInterface The User Interface
The layout of the MITK applications is designed to give a clear distinction between the different work areas. The following figure gives an overview of the main sections of the user interface.
\imageMacro{MITKUserManual_GUICommented.png,"The Common MITK Application Graphical User Interface",16.00}
-The datamanager and the \ref MITKUserManualPagePerspectives have their own help sections. This document explains the use of:
- - The \ref Four Window View
- - The \ref Menu
- - The \ref MITKUserManualPageLevelWindow
- - The \ref MITKUserManualPageMemoryUsage
- - The \ref MITKUserManualPageViews
-
-<div align="center"><h1>Four Window View </h1></div>
-
-<h2>Overview </h2>
+\section MITKWorkbenchManualPage_FourWindowView Four Window View
+\subsection MITKWorkbenchManualPage_FourWindowView_Overview Overview
The four window view is the heart of the MITK image viewing. The standard layout is three 2D windows and one 3D window, with the axial window in the top left quarter, the sagittal window in the top right quarter, the coronal window in the lower left quarter and the 3D window in the lower right quarter. The different planes form a crosshair that can be seen in the 3D window.
Once you select a point within the picture, informations about it are displayed at the bottom of the screen.
-<h2>Navigation </h2>
-
+\subsection MITKWorkbenchManualPage_FourWindowView_Navigation Navigation
Left click in any of the 2D windows centers the crosshair on that point. Pressing the right mouse button and moving the mouse <B>zooms</B> in and out. By scrolling with the mouse wheel you can <B>navigate through</B> the slices of the active window and pressing the mouse wheel while moving the mouse <B>pans</B> the image section.
In the 3D window you can <B>rotate</B> the object by pressing the left mouse button and moving the mouse, <B>zoom</B> either with the right mouse button as in 2D or with the mouse wheel, and <B>pan</B> the object by moving the mouse while the mouse wheel is pressed. Placing the cursor within the 3D window and holding the "F" key allows <B>free flight</B> into the 3D view.
-<h2>Customizing</h2>
-
+\subsection MITKWorkbenchManualPage_FourWindowView_Customizing Customizing
By moving the cursor to the upper right corner of any window you can activate the window menu. It consists of three buttons.
\imageMacro{MITKUserManual_CrosshairModes.png,"Crosshair",8.72}
The crosshair button allows you toggle the crosshair, reset the view and change the behaviour of the planes.
Activating either of the rotation modes allows you to rotate the planes visible in a 2D window by moving the mouse cursor close to them and click and dragging once it changes to indicate that rotation can be done.
The swivel mode is recommended only for advanced users as the planes can be moved freely by clicking and dragging anywhere within a 2D window.
-
The middle button expands the corresponding window to fullscreen within the four window view.
\imageMacro{MITKUserManual_ViewsChoices.png,"Layout Choices",5.19}
The right button allows you to choose between many different layouts of the four window view to use the one most suited to your task.
-<div align="center"><h1>Menu</h1></div>
-
+\section MITKWorkbenchManualPage_Menu Menu
-<h2>File</h2>
+\subsection MITKWorkbenchManualPage_Menu_File File
This dialog allows you to save, load and clear entire projects, this includes any nodes in the data manager.
-<h2>Edit</h2>
+\subsection MITKWorkbenchManualPage_Menu_Edit Edit
+
This dialog supports undo and redo operations as well as the image navigator, which gives you sliders to navigate through the data quickly.
-<h2>Window</h2>
+\subsection MITKWorkbenchManualPage_Menu_Window Window
This dialog allows you to open a new window, change between perspectives and reset your current one to default settings.
-
If you want to use an operation of a certain perspective within another perspective the "Show View" menu allows to select a specific function that is opened and can be moved within the working areas according to your wishes. Be aware that not every function works with every perspective in a meaningful way.
The Preferences dialog allows you to adjust and save your custom settings.
\imageMacro{MITKUserManual_WindowDropdown.png,"Preferences",4.89}
-<h2>Help </h2>
+\subsection MITKWorkbenchManualPage_Menu_Help Help
This dialog contains this help, the welcome screen and information about MITK.
-<div align="center"><h1>Levelwindow</h1></div>
+\section MITKWorkbenchManualPage_Levelwindow Levelwindow
Once an image is loaded the levelwindow appears to the right hand side of the four window view. With this tool you can adjust the range of grey values displayed and the gradient between them. Moving the lower boundary up results in any pixels having a value lower than that boundary to be displayed as black. Lowering the upper boundary causes all pixels having a value higher than it to be displayed as white.
The pixels with a value between the lower and upper boundary are displayed in different shades of grey. This way a smaller levelwindow results in higher contrasts while cutting of the information outside its range whereas a larger levelwindow displays more information at the cost of contrast and detail.
You can pick the levelwindow with the mouse to move it up and down, while moving the mouse cursor to the left or right to change its size. Picking one of the boundaries with a left click allows you to change the size symmetrically. Holding CTRL and clicking a boundary adjusts only that value.
With line edit fields below you can directly adjust the levelwindow. The upper field describes the center of the levelwindow, the bottom the span of the window around the center. By selecting one of fields and typing any number you can set these two parameters.
-<div align="center"><h1>System Load Indicator</h1></div>
-
+\section MITKWorkbenchManualPage_SystemLoadIndicator System Load Indicator
The System Load Indicator in the lower right hand corner of the screen gives information about the memory currently required by the MITK application. Keep in mind that image processing is a highly memory intensive task and monitor the indicator to avoid your system freezing while constantly swapping to the hard drive.
-<div align="center"><h1>Views</h1></div>
+\section MITKWorkbenchManualPage_Views Views
Each solution for a specific problem that is self contained is realized as a single view. Thus you can create a workflow for your problem by combining the capabilities of different views to suit your needs.
One elegant way to do this is by combining views in perspectives.
By pressing and holding the left mouse button on a views tab you can move it around to suit your needs, even out of the application window.
-<div align="center"><h1>Perspectives </h1></div>
+\section MITKWorkbenchManualPage_Perspectives Perspectives
The different tasks that arise in medical imaging need very different approaches. To acknowledge this circumstance MITK supplies a framework that can be build uppon by very different solutions to those tasks. These solutions are called perspectives, each of them works independently of others although they might be used in sequence to achieve the solution of more difficult problems.
It is possible to switch between the perspectives using the "Window"->"Open Perspective" dialog.
-
See menu for more information about switching perspectives.
*/
diff --git a/Plugins/org.mitk.gui.qt.geometrytools/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.geometrytools/documentation/UserManual/Manual.dox
index 66bc02d803..3baf2840a5 100644
--- a/Plugins/org.mitk.gui.qt.geometrytools/documentation/UserManual/Manual.dox
+++ b/Plugins/org.mitk.gui.qt.geometrytools/documentation/UserManual/Manual.dox
@@ -1,18 +1,18 @@
/**
\page org_mitk_gui_qt_geometrytools The Geometry Tools
-\imageMacro{icon.png,"Icon of Geometry Tools",2.00}
+\imageMacro{geometrytools-dox.xpm,"Icon of Geometry Tools",2.00}
\tableofcontents
\section org_mitk_gui_qt_geometrytoolsOverview Overview
A plugin to modify geometry of mitkBaseData via interaction. Currently, the following
operations can be performed:
<ul>
<li>Translation
<li>Rotation
<li>Scaling (not supported for images, yet, and will not happen in coordinate origin)
</ul>
*/
diff --git a/Plugins/org.mitk.gui.qt.geometrytools/documentation/UserManual/icon.xpm b/Plugins/org.mitk.gui.qt.geometrytools/documentation/UserManual/geometrytools-dox.xpm
similarity index 100%
rename from Plugins/org.mitk.gui.qt.geometrytools/documentation/UserManual/icon.xpm
rename to Plugins/org.mitk.gui.qt.geometrytools/documentation/UserManual/geometrytools-dox.xpm
diff --git a/Plugins/org.mitk.gui.qt.igt.app.hummelprotocolmeasurements/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.igt.app.hummelprotocolmeasurements/documentation/UserManual/Manual.dox
index 426c619338..f76698f792 100644
--- a/Plugins/org.mitk.gui.qt.igt.app.hummelprotocolmeasurements/documentation/UserManual/Manual.dox
+++ b/Plugins/org.mitk.gui.qt.igt.app.hummelprotocolmeasurements/documentation/UserManual/Manual.dox
@@ -1,18 +1,18 @@
/**
\page org_mitk_views_igttrackingsemiautomaticmeasurement The IGT Tracking Semi Automatic Measurement
-\imageMacro{icon.png,"Icon of IGT Tracking Semi Automatic Measurement",2.00}
+\imageMacro{hummelprotocolmeasurements-dox.png,"Icon of IGT Tracking Semi Automatic Measurement",2.00}
\tableofcontents
\section Overview
Dieses PlugIn dient zur semiautomatischen Aufzeichnung von Messreihen mit Trackingsystemen. Entsprechend konfiguriert ist es auch für das Hummel-Protokoll einsetzbar. Zentrale Komponente des PlugIns ist eine IGT Pipeline zur Messdatenaufzeichnung, wie in Abbildung 1 dargestellt.
\imageMacro{pipeline.png,"Icon of IGT Tracking Semi Automatic Measurement",10.00}
Ein Screenshot der Benutzeroberfläche des PlugIns ist in Abbildung 2 zu sehen. Das Initialisieren und Starten des Trackingsystems erfolgt dabei im nicht dargestellten Tab "Tracking Initialization", der im Wesentlichen aus dem TrackingDeviceConfigurationWidget besteht. Zur Durchführung der Messungen unterstützt das PlugIn das Laden einer Liste mit Dateinamen für die Messungen, wie im oberen Teil des Screenshots zu sehen. Diese Liste wird abgearbeitet, wobei mit dem Button "Start Next Measurement" jeweils die nächste Messung gestartet wird. Die während der Messung aufgezeichneten Daten werden in eine Datei das Ausgabeverzeichnis geschrieben. Dabei entspricht der Dateiname dem aktuellen Namen aus der Liste. Die Anzahl der aufzuzeichnenden Messwerte pro Messung kann in den Einstellungen angegeben werden. Gab es bei einer Messung einen Fehler kann die Messung durch Auswahl des entsprechenden Buttons auch wiederholt werden.
\imageMacro{screenshot.png,"Icon of IGT Tracking Semi Automatic Measurement",10.00}
Das PlugIn unterstützt außerdem die Ansteuerung eines zweiten Trackingsystems. Dieses System soll einen am Phantom angebrachtes Tool (Reference Sensor) tracken und so sicherstellen, dass sich das Phantom während der Messung nicht bewegt. Wurde eine Bewegung des Phantoms festgestellt wird im unteren Teil des PlugIns "NOT OK" angezeigt und die Messung muss ggf. wiederholt werden.
*/
diff --git a/Plugins/org.mitk.gui.qt.igt.app.hummelprotocolmeasurements/documentation/UserManual/icon.png b/Plugins/org.mitk.gui.qt.igt.app.hummelprotocolmeasurements/documentation/UserManual/hummelprotocolmeasurements-dox.png
similarity index 100%
rename from Plugins/org.mitk.gui.qt.igt.app.hummelprotocolmeasurements/documentation/UserManual/icon.png
rename to Plugins/org.mitk.gui.qt.igt.app.hummelprotocolmeasurements/documentation/UserManual/hummelprotocolmeasurements-dox.png
diff --git a/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/documentation/UserManual/Manual.dox
deleted file mode 100644
index 4e25a77184..0000000000
--- a/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/documentation/UserManual/Manual.dox
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
-\page org_mitk_gui_qt_igt_app_echotrack The Ultrasound Navigation Plugin
-
-Available sections:
- - \ref org_mitk_gui_qt_igt_app_echotrackOverview
-
-\section org_mitk_gui_qt_igt_app_echotrackOverview Overview
-Describe the features of your awesome plugin here
-<ul>
-<li>Increases productivity
-<li>Creates beautiful images
-<li>Generates PhD thesis
-<li>Brings world peace
-</ul>
-
-*/
diff --git a/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/documentation/UserManual/icon.xpm b/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/documentation/UserManual/icon.xpm
deleted file mode 100644
index 83e48be4d8..0000000000
--- a/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/documentation/UserManual/icon.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static const char * icon_xpm[] = {
-"16 16 2 1",
-" c #FF0000",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/documentation/doxygen/modules.dox
deleted file mode 100644
index 4dee87289d..0000000000
--- a/Plugins/org.mitk.gui.qt.igt.app.ultrasoundtrackingnavigation/documentation/doxygen/modules.dox
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- \defgroup org_mbi_gui_qt_usnavigation org.mbi.gui.qt.usnavigation
- \ingroup MITKPlugins
-
- \brief Describe your plugin here.
-
-*/
-
-/**
- \defgroup org_mbi_gui_qt_usnavigation_internal Internal
- \ingroup org_mbi_gui_qt_usnavigation
-
- \brief This subcategory includes the internal classes of the org.mbi.gui.qt.usnavigation plugin. Other
- plugins must not rely on these classes. They contain implementation details and their interface
- may change at any time. We mean it.
-*/
diff --git a/Plugins/org.mitk.gui.qt.igtexamples/documentation/UserManual/QmitkIGTTrackingLab.dox b/Plugins/org.mitk.gui.qt.igtexamples/documentation/UserManual/QmitkIGTTrackingLab.dox
index 2c2a1dc362..7f8cfa4031 100644
--- a/Plugins/org.mitk.gui.qt.igtexamples/documentation/UserManual/QmitkIGTTrackingLab.dox
+++ b/Plugins/org.mitk.gui.qt.igtexamples/documentation/UserManual/QmitkIGTTrackingLab.dox
@@ -1,68 +1,68 @@
/**
\page org_igttrackinglab IGT Tutorial Step 5: The IGT-TrackingLab
Available sections:
- \ref QmitkIGTTrackingLabUsersManualOverview
- \ref QmitkIGTTrackingLabUsersManualPrel
- \ref QmitkIGTTrackingLabUsersManualConf
- \ref QmitkIGTTrackingLabUsersManualIntialReg
- \ref QmitkIGTTrackingLabUsersManualPermReg
- \ref QmitkIGTTrackingLabUsersManualPtSetRec
- \ref QmitkIGTTrackingLabUsersManualCamView
\section QmitkIGTTrackingLabUsersManualOverview Introduction
The IGT-TrackingLab is the last step of the IGT tutorial. In the following you can learn how to use the plugin by reading this manual. IGT-TrackingLab shows example usage for many IGT classes and is also an example navigation implemented with IGT.
The symbol of the Tracking Lab View is the following:
-\imageMacro{../../resources/icon_igt_tracking_lab.png,"",2}
+\imageMacro{icon_igt_tracking_lab.png,"",2}
The view looks like this:
\imageMacro{IGT_TrackingLab_PluginView.png,"",15.90}
With this tutorial you will register a book using a tracking device of your choice and the MITK's book surface file. The registration will enable you to move the book in the real world and observe its movement in the MITK display. It also allows you to record PointSets or use the CameraView which simulates a Camera at the tip of your pointer.
\section QmitkIGTTrackingLabUsersManualPrel Preliminaries
First connect your tracking device to your PC. Then start the MITK Workbench and configure your tracking device using the \ref org_mitk_views_igttrackingtoolbox "Tracking Toolbox View".
\section QmitkIGTTrackingLabUsersManualConf Configuration
Select the desired <i>Navigation Data Source</i>. Now it's time to define which tool shall be used as object marker and which tool shall be used as pointer. Next load the Book surface
provided with the example data (e.g. book.stl from the MITK-Data repository which comes with every superbuild or may also be checked out separately) into MITK. Fixate the object marker on a real book of your choice. Now we need to tell MITK that the object marker has been fixated on a physical object. To do this, select the <i>Book</i> as surface in the <i>Object Selection</i> submenu as you can see in the screenshot above.
\section QmitkIGTTrackingLabUsersManualIntialReg Initial Registration
Now we need to register the object marker to the surface it's fixed upon, in our case the book. To do this, first press the initial registration button. For MITK to be able to do this registration, we need to
1. Select landmarks on the virtual object (e.g. the corners of the book)
Press the <i>plus</i> button in the <i>Image fiducials</i> column. Shift + click on the corners on the book in the <i>MITK Display</i>.
2. Point to the corresponding landmarks in the real world using the pointer.
Now press the <i>plus</i> button in the <i>Real world fiducials</i> column and point to the corners on the real book. Press <i>Add current instrument position</i> whenever you targeted a corner to tell MITK this is the desired landmark. Make sure you select the "real" edges in the same order as the edges in the image.
-\imageMacro{IGT_TrackingLab_InitialRegistration.png,"Here the landmarks of the virtual object are already set",15.90}
+\imageMacro{IGT_TrackingLab_InitialRegistration.PNG,"Here the landmarks of the virtual object are already set",15.90}
Press <i>Register</i> to finalize the initial registration.
Now the object marker is registered onto the book. You can see this in the MITK image. If needed the FRE is shown in the widget.
\section QmitkIGTTrackingLabUsersManualPermReg Permanent Registration
Now everything is set up and registered. We can thus activate permanent registration to continuously track the object, the object marker and the pointer.
For this, simply press the <i>Permanent Registration</i> button and select <i>Activate permanent registration</i>. You can now move the book in the real world and see the same movement in the <i>MITK Display</i>. A nice test to see if everything was correctly registered is to target the corners of the book with the pointer and check if the correct corners are pointed to in the <i>MITK Display</i>.
\section QmitkIGTTrackingLabUsersManualPtSetRec PointSet Recording
A user might now want to track a tool's trajectory. For this, the <i>PointSet Recording</i> was created.
First click on <i>PointSet Recording</i>. Now select your tracking source and the tool whose trajectory shall be recorded. Activate the <i>Point Set Recording</i> checkbox. In the <i>MITK Display</i> little green points will now be drawn for every measured position. Deactivate the checkbox to stop recording. The trajectory is saved in the PointSet <i>Recorded Points</i> visible in the Data Manager.
\section QmitkIGTTrackingLabUsersManualCamView Camera View
Another possible tracking application is the Camera View. Here, a virtual camera is placed at the pointers tip and its images are shown in the MITK Display.
Select Camera View and as usual the Tracking Source and the tool you want to place the virtual camera on. Activate the "Activate Needle View" checkbox and move the pointer around the book. You can now see the book from the pointers perspective.
You may need to adjust the Needle View Direction and the View Up Vector. This is always relative to your tools coordinate center origin. An example of the NDI pointer tool coordinate system is shown below:
\imageMacro{QmitkIGTExamples_Tool.png,"The coordinate system of the NDI pointing tool",16.00}
In the above case, the camera should look in inverse z-direction, and the view up vector should probably be set to positive x. Note this is just an example and may be different depending on your pointer.
-\ref Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
+Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
*/
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.igtexamples/documentation/UserManual/QmitkIGTTutorial.dox b/Plugins/org.mitk.gui.qt.igtexamples/documentation/UserManual/QmitkIGTTutorial.dox
index d6f0f59d15..a4e65c05b9 100644
--- a/Plugins/org.mitk.gui.qt.igtexamples/documentation/UserManual/QmitkIGTTutorial.dox
+++ b/Plugins/org.mitk.gui.qt.igtexamples/documentation/UserManual/QmitkIGTTutorial.dox
@@ -1,94 +1,94 @@
/**
\page org_imageguidedtherapytutorial The MITK-IGT Tutorial View
This view is not meant as an end-user module. It contains tutorial program code that explains how to use the MITK-IGT component.
It contains only two buttons. The "Start image guided therapy" button will create a virtual tracking device and a virtual tool.
It will move the tool around on random paths in a tracking volume of 200x200x200 mm. The tool is visualized with a cone.
If you do not see a cone moving around, you will need to initialize the rendering views correctly. Use the DataManager view to perform
a global reinit.
The symbol of this view is the following:
-\imageMacro{../../resources/icon_igt_simple_example.png,"",2}
+\imageMacro{icon_igt_simple_example.png,"",2}
and the whole view looks like this:
\imageMacro{IGTExampleIGT_QT_Tutorial_PluginView.png,"",2}
In this tutorial we connect to the NDI Polaris tracking system (or alternatively use a virtual tracking device) and we will show the movement of a tool as cone in the StdMultiWidget editor.
First of all, you will have to add an IGT dependency to your cmake list. For this example, MitkIGTUI would be sufficient, but as the plugin contains several views, we have additional OpenIGTLink and US dependencies:
\code{.cpp}
project(org_mitk_gui_qt_igtexamples)
mitk_create_plugin(
EXPORT_DIRECTIVE IGTEXAMPLES_EXPORT
EXPORTED_INCLUDE_SUFFIXES src
MODULE_DEPENDS MitkQtWidgetsExt MitkIGT MitkIGTUI MitkOpenIGTLink MitkOpenIGTLinkUI MitkUS
)
\endcode
More information on how to create your own plugin can be found here: \ref NewPluginPage
When clicking the start button, a cone should move in the 3D view and stop after clicking the stop button.
The view has several fuctions. Most of them deal with the basic functionality with the plugin (e.g. CreateQTPartControl or CreateConnections). For a deeper understanding, you might have a look at the files QmitkIGTTutorialView.cpp and QmitkIGTTutorialView.h
For our IGT functionality, the following functions are important:
\li OnStartIGT: Starts the navigation pipeline
\li OnStopIGT: Disconnect the pipeline
\li OnTimer: Updates the view
Let's now have a deeper look at these functions.
\section OnStartIGT OnStartIGT
-\snippet ../../src/internal/QmitkIGTTutorialView.cpp OnStart 1
+\snippet QmitkIGTTutorialView.cpp OnStart 1
We first check in a try environment, if we should use an NDI tracking device or a virtual device. Let's start with NDI, we hardcode the parameters here and give out a warning. In your propper application, the parameters should be set via the gui aswell (see \ref org_mitk_views_igttrackingtoolbox ), but for simplicity, we just set hardcoded parameters here. If you want to try it with your own NDI device, you need to adapt these parameters here in the code:
-\snippet ../../src/internal/QmitkIGTTutorialView.cpp OnStart 2
+\snippet QmitkIGTTutorialView.cpp OnStart 2
The tracking device has to be set to a source. For more information on the tracking pipeline, please have a look at the \ref IGTTutorialStepFilterPipeline.
\snippet QmitkIGTTutorialView.cpp OnStart 3
Alternatively, we can setup a virtual tracking device. We create this device, set the bounds, add a tool and connect it to the source:
\snippet QmitkIGTTutorialView.cpp OnStart 4
Now we need to connect the tracking system
\snippet QmitkIGTTutorialView.cpp OnStart 5
For the visualisation, we need an object. Here, we create a red cone
\snippet QmitkIGTTutorialView.cpp OnStart 6
The visualization filter will actually render the cone
\snippet QmitkIGTTutorialView.cpp OnStart 7
For a continuous display, we need to call update, here we decide to do it every 100 ms using a timer.
\snippet QmitkIGTTutorialView.cpp OnStart 8
Disable the selection of tracking devices during tracking:
\snippet QmitkIGTTutorialView.cpp OnStart 8a
For propper coding, you should always catch the exceptions:
\snippet QmitkIGTTutorialView.cpp OnStart 9
\section OnTimer OnTimer
Each time, the timer is updated, the following code is executed:
\snippet QmitkIGTTutorialView.cpp OnTimer
\section OnStopIGT OnStopIGT
This function will stop the pipeline and clean up everything:
\snippet QmitkIGTTutorialView.cpp OnStop
-You now have a very simple plugin, which creates an own tracking device and starts or stops tracking. Of course, for your more advanced project, you could implement a new tracking device to be available in every plugin (see \ref IGTHowToImplementATrackingDevice) or use already implemented tracking devices via the tracking toolbox and/or microservices. This small example should just show you the most simple way to start tracking.
+You now have a very simple plugin, which creates an own tracking device and starts or stops tracking. Of course, for your more advanced project, you could implement a new tracking device to be available in every plugin (see \ref IGTHowToImplementATrackingDevice ) or use already implemented tracking devices via the tracking toolbox and/or microservices. This small example should just show you the most simple way to start tracking.
-\ref Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
+Return to the \ref IGTTutorialOverview "[IGT Tutorial Overview]"
*/
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkIGTTracking.dox b/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkIGTTracking.dox
index e94957da24..c31bc51829 100644
--- a/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkIGTTracking.dox
+++ b/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkIGTTracking.dox
@@ -1,20 +1,20 @@
/**
\page org_mitk_gui_qt_igttracking The IGT Tracking Plugin
This plugin offers basic tracking functionalities. This includes connecting to a tracking system, logging and recording of tracking data, managing tracking tools and playing recorded tracking data.
The plugin includes different views, which are described on different pages in detail.
As part of the tutorial, it is recommended to get familiar with each of the following views as they lead you through the main functionality of the IGT plugin. Please read the following pages to get familiar with them:
<ul>
<li> \subpage org_mitk_views_igttrackingtoolbox : Allows for connecting a tracking system and logging/recording the tracked data.
<li> \subpage org_mitk_views_igtnavigationtoolmanager : This view offers functionality to manage tool storages. Each tool storage holds a preconfigured tool collection. Once saved you can load a tool storage in the Tracking Toolbox and don't need to add every tool seperately.
<li> \subpage org_mitk_views_navigationdataplayer : Plays navigation data which was recorded with the Tracking Toolbox for example.
<li> \subpage org_mitk_views_calibrationtoolmanager Calibration Tool Manager. This view offers functionality to calibrate navigation tools.
<li> \subpage org_mitk_views_igtregistrationview : The IGTFiducialRegistration view allows the recording of real world landmarks and corresponding landmarks on a virtual object.
</ul>
-\ref Return to the \ref TrackingPlugins "[IGT Tutorial Overview]"
+Return to the \ref TrackingPlugins "[IGT Tutorial Overview]"
*/
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkMITKIGTNavigationToolCalibration.dox b/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkMITKIGTNavigationToolCalibration.dox
index cce10b3e82..079e6d0673 100644
--- a/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkMITKIGTNavigationToolCalibration.dox
+++ b/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkMITKIGTNavigationToolCalibration.dox
@@ -1,85 +1,85 @@
/**
\page org_mitk_views_calibrationtoolmanager The MITK-IGT Navigation Tool Calibration
-\imageMacro{../resources/iconTrackingToolCalibration.png,"Icon of the MITK-IGT Tracking Toolbox",2.00}
+\imageMacro{iconTrackingToolCalibration.png,"Icon of the MITK-IGT Tracking Toolbox",2.00}
\tableofcontents
\section QmitkMITKIGTNavigationToolCalibrationIntroduction Introduction
This view allows the calibration of navigation tools. The calibrated tools can be saved permanently and later be used for any other IGT application. The following coordinate transforms are associated with tracking of a tool:
<ul>
<li> The sensor transformation from the global tracking coordinate system to the local coordinate system of the tracked sensor (m_Position, m_Orientation).
<li> The tool tip transformation from the local sensor coordinate system to a tool tip coordinate system defined by a tool tip position and a main tool axis (m_ToolTipPosition, m_ToolAxisOrientation). The tool axis is defined as the negative z-axis of the tool tip coordinate system.
<li> The main axis of the representation object of the tool (e.g. a surface) has to be defined along the negative z-axis.
</ul>
\imageMacro{TrackingTool.png,"Coordinate transforms associated to the tracking tool.",5.00}
\section QmitkMITKIGTNavigationToolCalibrationPrerequisities Prerequisites
In the IGT Tracking Toolbox configure your tracking device with at least two tools. The tool you wish to calibrate and one tool used as a pointer during the calibration process. For details on how to configure your tracking device and your tools have a look at \ref org_mitk_views_igttrackingtoolbox .
After you configured your device and your tools connect your device and start tracking. Now switch to the IGT Navigation Tool Calibration for the calibration process.
\section QmitkMITKIGTNavigationToolCalibrationInitialization Initialization
On the tab Initialization choose the tracking device you configured in the prevois step by clicking on it in the box "Available Navigation Data Sources". Then in the box "Tools" the tools you configured for this device should appear. Click on the tool that needs to be calibrated and then on the button "Use as Tool to Calibrate". On top of the view under the headline "Tool To calibrate" you now see the tool information for the chosen tool.
For the tool used as a pointer do the same. Click on it, then click on the button "Use as Calibration Pointer" and on top of the view under the headline "Calibration pointer you should see the tool information for the pointer tool.
\imageMacro{QmitkIGTTracking_ToolCalibration_Initialization.png,"MITK Screenshot with the initialized tools for calibration",5.00}
\section QmitkMITKIGTNavigationToolCalibrationToolTipCalibration Tool Tip Calibration
After you finished the initialization of your tracking device you can proceed on to the tab Tool Tip Calibration to calibrate your tool.
For the Tool Tip Calibration you have four different options:
<ul>
<li> Manual: Enter the known Translation and Rotation for the Tool Tip manually
<li> Single Reference Tool: Use a calibrated tool as a reference to calibrate the non-calibrated tool
<li> Multiple Tools Reference: Not implemented yet
<li> Pivoting: Calibrate the tool by pivoting it around its tip. (Not fully implemented yet)
</ul>
\subsection QmitkMITKIGTNavigationToolCalibrationManual Manual Tool Tip Calibration
Use this method to calibrate a navigation tool, of which you already know the translation and rotation that determine the tool tip calibration.
Click on Start Edit Tooltip and in the new window you can enter the values for the translation and the rotation. Either by using the sliders or by entering the values into the boxes.
\imageMacro{QmitkIGTTracking_ToolCalibration_Manual_EditingWindow.png,"MITK Screenshot of the window for manual tool calibration",5.00}
After you entered the values you can click "Use Manipulated ToolTip" to perform the Calibration on the Tool to calibrate. The box "Current Tool Tip Orientation" will show you the results. It will list the resulting values of the Quaternion, the Euler Angles and the Matrix.
\imageMacro{QmitkIGTTracking_ToolCalibration_Manual_After.png,"MITK Screenshot of the Current Tool Tip Orientation Box after the tool was manually calibrated",5.00}
To save the result permanently just click "Save Calibrated Navigation Tool" and you can save the calibrated tool as an IGTTool for later use with your tracking device in a navigation application.
If you are not satisfied with the results you can click "Start Edit Tooltip" again and either change the values for the rotation and translation again or just reset everything by clicking on "Reset to Identity". To write the new values or reseted values into the tool just click "Use Manipulated Tool Tip" again. Now you can save your relust just as described above.
\subsection QmitkMITKIGTNavigationToolCalibrationReference Tool Tip Calibration with a single Reference Tool
Use this method to calibrate a navigation tool using a tool as pointer that is already calibrated.
First choose the number of tracking data you wish to collect. It is 100 by default but you may choose as many as you wish. Now place your tool to calibrate in a fixed position where it is tracked. Next place your pointing tool in a manner that its tip touches the tip and is tracked too. Fix it in this position. For a good calibration it is important that the tools move the least possible.
After you placed the tools click on the "Collect Navigation Data" Button and wait until all the data is gathered. Now you have several options to adjust the calibration to your needs. You can calibrate the position and/or the orientation or even invert the calibration transform. Calibrating the position will translate the position of the tool to calibrate to the position of the calibration pointer. The orientation calibration will copy the mean orientation of the calibration pointer to the tool the calibrate. Choose the options needed for your tool and tracker and then click on "Run Calibration".
The new Tool Tip Position and Orientation will be displayed und you can now apply them onto your tool by clicking on "Set New Tool Tip Position and/or Tool Orientation". To finally save the calibrated tool for later use just click on "Save Calibrated Navigation Tool".
If you are not satisfied with the result of the calibration just repeat the steps described above.
\imageMacro{QmitkIGTTracking_ToolCalibration_Reference.png,"MITK Screenshot of the Tool Tip Calibration Widget after a fully performed Tool Calibration using a single reference tool ",5.00}
\subsection QmitkMITKIGTNavigationToolCalibrationPivot Tool Tip Calibration via Pivoting
To calibrate your tool via pivoting place it on its tip an pivot it around its tip. Be careful not to move the tip otherwise the calibration result will be inaccurate. You can define the number of poses that should be collected. After starting the collecting process pivote the tool to different poses until the collection ends. Then click on "Comute Pivot Point" to compute the pivot point. Finally you can use the pivot result as tooltip transformation and save the calibrated tool to the hard disc for later use.
\subsection QmitkMITKIGTNavigationToolCalibration Tool Landmark Calibration
Two types of landmarks can be defined for each tool:
<ul>
<li> Control points for a later point-based registration
<li> Tool landmarks that represents features on the tool which are e.g. visible in a CT image
</ul>
Both sets of landmarks are defined in the tool coordinate space.
Control points are virtual and can only defined manually. These landmarks clearly define the tools pose only by using landmarks in the tool coordinate system. E.g., two landmarks for a 5DoF tool and three landmarks for a 6DoF tool. They may be used, e.g., for a point based registration of a tool from image space to tracking space. A typical set of three control points for a 6 DoF tool might be [1;0;0], [0;1;0], [0;0;1].
Tool landmarks are designed for representing defined landmarks on a tool. The number of these landmarks might exeed the number of control points for reasons of redundancy and averaging. They are used for, e.g., manually registering the pose of a tool by visual markers in a CT scan. If you would use these landmarks to do a point based registration from image space to tracking space later, you might overweight the tool because of two many landmarks compared to other markers. The tool landmarks can be calibrated manually or by using a second tracked pointer, move it to each landmark and press "Add Pointer Position".
Return to the overview of the IGT Tracking Plugin views: \ref org_mitk_gui_qt_igttracking
*/
diff --git a/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkMITKIGTNavigationToolManager.dox b/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkMITKIGTNavigationToolManager.dox
index 2f3d166f44..dfff505877 100644
--- a/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkMITKIGTNavigationToolManager.dox
+++ b/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkMITKIGTNavigationToolManager.dox
@@ -1,53 +1,53 @@
/**
\page org_mitk_views_igtnavigationtoolmanager The MITK-IGT Navigation Tool Manager
-\imageMacro{../resources/iconTrackingToolManager.png,"Icon of the Navigation Tool Manager",2.00}
+\imageMacro{iconTrackingToolManager.png,"Icon of the Navigation Tool Manager",2.00}
\section QmitkMITKIGTNavigationToolManager Introduction
This view allows for creating and editing NavigationToolStorages. These storages contains naviagtion tools of a tracking device, can be saved permanently and used later for any other IGT application.
\tableofcontents
\section QmitkMITKIGTNavigationToolManagerToolOverview Navigation Tools Overview
A navigation tool of MITK-IGT represents a tracking tool (e.g. an emt sensor or an optically tracked tool) and it's corresponding data, like it's name and it's surface. A navigation tool is a generalized container for any trackable object in combination with it's additional information. Every navigation tool has different properties which are:
<ul>
<li> Name
<li> Unique identifier
<li> Tool definition file
<li> Serial number
<li> Surface for visualization
<li> Type of tracking device
<li> Type of the tool
<li> Tool landmarks
</ul>
Note that not all properties are needed for all types of tools. A tool definition file, for example, is only needed by optical tracking tools (e.g. a .rom file for Polaris or a toolfile for the MicronTracker). A tool associated with the aurora system is alwalys identified by it's serial number. You can also detect Aurora tools automatically with the TrackingToolbox view and edit the automatically detected tool storage later with this view.
\section QmitkMITKIGTNavigationToolManagerManagingNavigationToolStorage Managing Navigation Tool Storage
In order to create edit a tool storage container, you can select one of the available tool storages listed in the upper part of the UI. The list shows all tool storages which are available throug the micro services concept of MITK. The list also shows the current tool storage of the IGT tracking toolbox view if it is active. In addition to the listed tool storages, you can load new storages from the hard disc which will then appear in the list and might be edited as all other storage by simply selecting it in the list. You may also save a selected tool storage to the hard disc or create a new one.
In the lower part of the UI you always see the list of tools of the tool storage which is currently selected in the upper part. Use the buttons "add", "edit" and "delete" to manage the contained navigation tools. If you click "edit" or "delete" the operation is applied on the currently selected tool, as shown in the screenshot below.
\imageMacro{QmitkIGTTracking_NavigationToolManagemantStartScreen.png,"Screenshot of the main view of NavigationToolManagent",10.90}
\section QmitkMITKIGTNavigationToolManagerAddingEditingNavigationTools Adding / Editing Navigation Tools
If you add or edit a navigation tool, an input mask, as shown in the screenshot below, appears. The tool identifier is filled automatically, if you change it, remember that it is unique in the current storage. Also, choose a valid surface for every tool, this is nessesary for correct tool visualization. By default, a cone is displayed. The other information depends on the tracking system type, e.g. choose a tool file for the Polaris or the MicronTracker system and type in a serial number for the Aurora system. Two identical tools with the same serial number are also possible, they are assigned by the order in which they are attached to the device. As long as they also have the same surface as representation, this should not be a problem for most of the use cases.
The tool type is additional information which is not needed by the tracking device but might be needed by further IGT applications. The same applies to the tool landmarks which might be defined for a tool. There are two different types of landmarks which are designed as described here:
<ul>
<li> Tool Calibration Landmarks: These landmarks may be used clearly define the tools pose only by using landmarks in the tool coordinate system. E.g., two landmarks for a 5DoF tool and three landmarks for a 6DoF tool. These landmarks may be used, e.g., for a point based registration of a tool from image space to tracking space.
<li> Tool Registration Landmarks: These landmarks are designed for representing defined landmarks on a tools surface. The number of these landmarks might exeed the number of tool calibration landmarks for reasons of redundancy and averaging. They are used for, e.g., manually registering the pose of a tool by visual markers in a CT scan. If you would use these landmarks to do a point based registration from image space to tracking space later, you might overweight the tool because of two many landmarks compared to other markers.
</ul>
\imageMacro{QmitkIGTTracking_NavigationToolManagementAddTool.png,"Screenshot of add/edit navigation tool screen",9.19}
Return to the overview of the IGT Tracking Plugin views: \ref org_mitk_gui_qt_igttracking
*/
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkMITKIGTTrackingToolbox.dox b/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkMITKIGTTrackingToolbox.dox
index 45b0d224b2..1e80ec7f9f 100644
--- a/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkMITKIGTTrackingToolbox.dox
+++ b/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkMITKIGTTrackingToolbox.dox
@@ -1,93 +1,93 @@
/**
\page org_mitk_views_igttrackingtoolbox The MITK-IGT Tracking Toolbox
-\imageMacro{../resources/iconTrackingToolbox.png,"Icon of the MITK-IGT Tracking Toolbox",2.00}
+\imageMacro{iconTrackingToolbox.png,"Icon of the MITK-IGT Tracking Toolbox",2.00}
\tableofcontents
\section QmitkMITKIGTTrackingToolboxIntroduction Introduction
The MITK-IGT Tracking Toolbox is a view which allows you to connect to a tracking device, track and visualize navigation tools and write the tracked data into a log file.
This page gives an overview of the view and is at the same time part of the IGT tutorial step \ref org_mitk_gui_qt_igttracking. All parts containing instructions
for the tutorial begin with the bold printed label <b>Tutorial</b>.
\imageMacro{QmitkIGTTracking_ScreenshotMitk.png,"MITK Screenshot with the TrackingToolbox activated",16.00}
\section QmitkMITKIGTTrackingToolboxWorkflow General workflow Introduction
-Currently the devices Polaris, Aurora (both Northern Digital Inc. (NDI); Waterloo, Ontario, Canada), MicronTracker (Claron Technology, Inc.; Toronto, Ontario, Canada) and Optitrack (NaturalPoint) are supported (see <a href="http://mitk.org/wiki/Mitk-Tracking-Device_Support_Levels"> Hardware Tracking Device Support</a>). Different tracking hardware can be used via OpenIGTLink connections (see \ref IGTTutorialStepOpenIGTLink "Open IGT Link tutorial"
+Currently the devices Polaris, Aurora (both Northern Digital Inc. (NDI); Waterloo, Ontario, Canada), MicronTracker (Claron Technology, Inc.; Toronto, Ontario, Canada) and Optitrack (NaturalPoint) are supported (see <a href="https://www.mitk.org/wiki/Mitk-Tracking-Device_Support_Levels"> Hardware Tracking Device Support</a>). Different tracking hardware can be used via OpenIGTLink connections (see \ref IGTTutorialStepOpenIGTLink "Open IGT Link tutorial"
). For this Tracking Toolbox tutorial, we will use a virtual tracking device, which allows you to use simulated tracking data. This is very helpful if you want to test or implement some tracking application and don't have the hardware always available.
A general Workflow with the Tracking Toolbox may be:
<ul>
<li> Configuration of a tracking device
<li> Adding or loading a toolfile which holds tool definitions
<li> Start tracking
<li> Logging tracked data
</ul>
<b>Tutorial:</b> In the following sections, we will get familiar with each of these points using the Virtual Tracking Device.
\section QmitkMITKIGTTrackingToolboxConnecting Tracking Device Configuration
The tracking device can be specified in the tracking device configuration section located in the upper area of the tracking tab. As shown in the screenshot below, you choose your tracking device in the drop down menu.
If you use a real tracking system, you might need to set some parameters like the serial port for Aurora or Polaris or the host name for your OpenIGTLink connection. Most implemented tracking device include an option to test your conection. Therefore you just need to press the button "test connection". The results are displayed in the small black box on the right.
<b>Tutorial:</b> For a first introduction, please select the virtual tracking device in the drop-down-menu. You should see an option to add some jittering to the simulated data.
\imageMacro{QmitkIGTTracking_ConfigurationWidget.png,"Tracking Device Configuration",8.55}
\section Tracking Tools
For tracking, you need information about your tools. You can either add single tools, load previously created tool storages or for some devices auto-detect all available tools. The best way to edit tools after creation/loading is \ref org_mitk_views_igtnavigationtoolmanager view. Creation of new tools or loading of existing tool storages can be done within the Tracking Tool Widget.
\imageMacro{QmitkIGTTracking_NavigationToolManagement_TrackingTools.png, "The tracking tool widget for adding or loading tools.",9.00}
All added or loaded tools will then be displayed in grey as shown in the screenshot below. If you start tracking they will become green if the tools were found and red if they were not found inside the tracking volume.
\imageMacro{QmitkIGTTracking_TrackingToolsWidget.png,"Added Tracking Tools",9.08}
\subsection QmitkMITKIGTTrackingToolboxAddingTools Adding tools
The most simple step to begin with is to add new tools with this widget. The same widget is also available within \ref org_mitk_views_igtnavigationtoolmanager view and the single parameters are explained there in more detail.
\imageMacro{QmitkIGTTracking_NavigationToolManagementAddTool.png,"Adding a new tool", 9.00}
<b>Tutorial:</b> Please click the "Add single tool" button and make sure, that the Virtual Tracker is selected in the drop-down-menu (the tracking device configured in the first step must always match your tools!). You might want to give your tool a new name in the "Basic Information" section and load a surface for visualization in the "Tool Visualization" section (a surface file can be found in your binary folder if you did compile MITK by yourself: MITK-superbuild\MITK-Data\IGT-Data\ClaronTool.stl). If you don't have any surface data, you can just select "use simple cone". Click on "Finished" and repeat this step to add a second tool.
\subsection QmitkMITKIGTTrackingToolboxLoadingTools Loading tools
To load tools which can be tracked you need a predefined tracking tool storage. You can use the MITK \ref org_mitk_views_igtnavigationtoolmanager view to define a navigation tool storage or to save the tools created within the last step in a toolstorage.
Navigation tool storages can be loaded by pressing the button "Load Tools". Please ensure that the tracking device type of the tools matches the chosen tracking device, otherwise you will get an error message if you try to start tracking.
\subsection QmitkMITKIGTTrackingToolboxAutoDetection Auto detection of tools (only Aurora)
If you use the Aurora system you also have the possibility to automatically detect the connected tools. In this case a tracking tool storage is created by the software.
In the Tracking Device Configuration widget, a button "Auto Detection" appears. If you press this button the software connects to the system and automatically detects all connected tools. You will then be asked whether you want to save the detected tools as a tool storage to the hard drive. You might want to do this if you want to use or modify this tool storage later. In the automatically detected tool storage the tools are named AutoDetectedTools1, AutoDetectedTools2, and so on. Small spheres are used as tool surfaces. After autodetection the detected tools are loaded automatically even if you did not save them.
\section QmitkMITKIGTTrackingToolboxStartTracking Start/stop tracking
To start tracking, you first need to connect to your tracking device ("connect" button). If your tools or tool storage don't match the tracking device or if no connection can be established, this might give an error message here.
\imageMacro{QmitkIGTTracking_TrackingControl.png,"Tracking Control to start tracking.", 9.00}
If connected succesfully, the start tracking button is enabled. As soon as you clicked this button, the tool information and tools will be highlighted red or green (un-/successful tracking) and in case of successful tracking, it's position will be updated and the tools are visualized in the 3D view of MITK.
Note that options may not be changed after connecting the tracking device.
You can start, freeze, unfreeze and stop the tracking as long as you are connected. If you want to finish your tracking, please stop an disconnect your tracking device.
<b>Tutorial:</b> Please click "connect" and "start tracking". Both tools should move within the tracking volume, the position data should be updated in the tool widget and be highlighted green. You can freeze, unfreeze and stop/restart the tracking as often as you like. When finished, please stop and disconnect.
\section QmitkMITKIGTTrackingOptions Options
In the options tab you can enable or disable the visualization of the tracking volume and of the tool quaternions. If enabled, the tool quaternions are shown in the tool information. You can also define the update rate of the tracking data. The update rate should not be set higher than the update rate of the tracking system. Other options might be available here depending on the newest developement within MITK-IGT.
\imageMacro{QmitkIGTTracking_Options.png,"Recorded logging data.", 9.00}
\section QmitkMITKIGTTrackingToolboxLogging Logging features
The logging feature of the Tracking Toolbox supports logging in XML or CSV format.
If your device is tracking, you are able to log the tracking data by using the logging tab. You first must define a file name. You can then choose whether you want comma seperated (csv) or xml format. Press "Start Logging" to start logging. You can also limit the number of logged frames, which will cause the logging to stop automatically after the given number.
\imageMacro{QmitkIGTTracking_LoggingWidget.png,"Tracking options.", 9.00}
<b>Tutorial:</b> Please connect and start tracking as you already did in the last step, switch to the logging tab, specify a csv file and start logging for a view seconds. Stop the tracking after a short period of time. You should now find the specified file which should look similar to the following screenshot and contain position data for both tools:
\imageMacro{QmitkIGTTracking_LogFile.png,"Recorded logging data.", 9.00}
Return to the overview of the IGT Tracking Plugin views: \ref org_mitk_gui_qt_igttracking
-*/
\ No newline at end of file
+*/
diff --git a/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkNavigationDataPlayer.dox b/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkNavigationDataPlayer.dox
index 24acaf66d1..89ef20256f 100644
--- a/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkNavigationDataPlayer.dox
+++ b/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/QmitkNavigationDataPlayer.dox
@@ -1,29 +1,29 @@
/**
\page org_mitk_views_navigationdataplayer The NavigationData Player
-\imageMacro{../resources/iconTrackingDataPlayer.png,"Icon of the NavigationData Player",2.00}
+\imageMacro{iconTrackingDataPlayer.png,"Icon of the NavigationData Player",2.00}
\tableofcontents
\section NavigationDataPlayerOverview
The navigation data player plays recorded or artificial navigation data of one ore more tracking tools and visualizes their trajectory.
It can also make the data available als a NavigationDataSource to Plugins that require a stream of tracking data, without having to create a tracking device.
\imageMacro{QmitkIGTTracking_NavigationDataPlayer.png, "The Navigation Data Player", 7}
To use it, select a set of recorded navigation data using the "Open File" button.
The Player will show the number of tools and the number of frames in the file.
Select the sequential player if you want to play the data with a specified tempo (set the update Interval accordingly).
Use the Time-based player to play the data in the speed they were originally acquired in.
<ul>
<li>Check "Repeat" to repeat the data as a loop indefinitely.
<li>Check "Register as Microservice" to make the data available as a microservice TrackingDataSource. Other Filters can then be connected to it from other plugins. This is useful for development purposes or to replay previously recorded Situations.
<li> Check "Display" to render the data in the render Window.
</ul>
<b>Tutorial:</b> As part of the IGT tutorial, you might try to replay your recorded data from step \ref org_mitk_views_igttrackingtoolbox. You should see two spheric tools moving within the tracking volume. Note that the tool storage is not included in the navigation data player at the moment, and hence all tools are represented as spheres.
Return to the overview of the IGT Tracking Plugin views: \ref org_mitk_gui_qt_igttracking
*/
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/TrackingTool.png b/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/TrackingTool.png
deleted file mode 100644
index 0d9066df41..0000000000
Binary files a/Plugins/org.mitk.gui.qt.igttracking/documentation/UserManual/TrackingTool.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.imagecropper/documentation/UserManual/QmitkImageCropper.dox b/Plugins/org.mitk.gui.qt.imagecropper/documentation/UserManual/QmitkImageCropper.dox
index ef2b68b13d..91a2f08bc4 100644
--- a/Plugins/org.mitk.gui.qt.imagecropper/documentation/UserManual/QmitkImageCropper.dox
+++ b/Plugins/org.mitk.gui.qt.imagecropper/documentation/UserManual/QmitkImageCropper.dox
@@ -1,52 +1,52 @@
/**
\page org_mitk_views_imagecropper The Image Cropper
-\imageMacro{crop.svg,"Icon of the Image Cropper Plugin.",20}
+\imageMacro{imagecropper-dox.svg,"Icon of the Image Cropper Plugin.",20}
\section org_mitk_views_imagecropperUsage Usage
The Image Cropper Plugin allows to crop and mask subvolumes out of the original image volume by defining a cubic bounding shape.
\imageMacro{BoundingBox_ImageCropperView.png,"Bounding Shape.",12.00}
A new bounding shape can be created by selecting an image and pressing the 'New' button. The bounding shape appears as a child node in the data manager. Alternatively, an existing bounding shape can be selected.
\imageMacro{Basic_ImageCropperView.png,"Basic Settings.",7.09}
This bounding shape can be placed at an arbitrary position in the volume and can be easily adjusted by using the handles on each of the faces. When activated, the handles are shown in red, otherwise, they are colored white. Hovering over either the shape or a single handle allows modifying the bounding shape. Moving the handles changes the respective extent of the bounding shape, whereas moving the shape itself changes its position.
As soon as the bounding shape is placed at the desired position, pressing the button 'Crop' creates a new image assigned to the original image as a child node containing only the selected subvolume. The size of the subvolume equals the size of the bounding shape.
Pressing the 'Mask' button keeps the original image size but masks out the area not contained within the bounding shape bounds.
In the case of 3D+t images, the whole time series is cropped by default.
\section org_mitk_views_imagecropperAdvanced Advanced settings
In the advanced settings view you find additional features:
\imageMacro{Advanced_ImageCropperView.png,"Advanced Settings.",7.09}
\subsection org_mitk_views_imagecropperMaskOutsidePixel Mask with outside pixel
Assigns the value of the voxels outside of the bounding shape when 'Mask' is used.
\subsection org_mitk_views_imagecropperAdvancedOverwrite Overwrite original image
By enabling this checkbox the image is replaced by the cropped subvolume. Be careful to use this option since there is no undo action available.
\subsection org_mitk_views_imagecropperAdvancedTimestep Crop current time step only
If you have an xD + t image, the whole time series (all timesteps) is cropped by default. In this case, the 'time geometry' of the current time step is used.
If the checkbox 'Only crop current time step' is ticked, the xD + t image is reduced to an xD image (e.g., 3D+t --> 3D) with the current time step only. That can be useful if you want to extract a single image or its corresponding subvolume of the time series.
\section org_mitk_views_imagecropperIssues Current issues
Cropping 2D images is not supported unless the are 3D images containing only a single slice. The user will be notified by a warning and the input is handled as a single label image.
Right now changing the shape or rotation of the bounding shape is not supported but might be integrated in the future.
Furthermore, a warning appears when the bounding shape is not aligned with the image. In this case, the handles can not be used correctly and get deactivated. You can continue to alter them by performing a 'Reinit' on the image.
*/
diff --git a/Plugins/org.mitk.gui.qt.imagecropper/documentation/UserManual/crop.svg b/Plugins/org.mitk.gui.qt.imagecropper/documentation/UserManual/imagecropper-dox.svg
similarity index 100%
rename from Plugins/org.mitk.gui.qt.imagecropper/documentation/UserManual/crop.svg
rename to Plugins/org.mitk.gui.qt.imagecropper/documentation/UserManual/imagecropper-dox.svg
diff --git a/Plugins/org.mitk.gui.qt.imagenavigator/documentation/UserManual/QmtikImageNavigator.dox b/Plugins/org.mitk.gui.qt.imagenavigator/documentation/UserManual/QmtikImageNavigator.dox
index e158d98694..d98606feaf 100644
--- a/Plugins/org.mitk.gui.qt.imagenavigator/documentation/UserManual/QmtikImageNavigator.dox
+++ b/Plugins/org.mitk.gui.qt.imagenavigator/documentation/UserManual/QmtikImageNavigator.dox
@@ -1,15 +1,15 @@
/**
\page org_mitk_views_imagenavigator The Image Navigator
-\imageMacro{image_navigator.svg,"Icon of the Image Navigator",2.00}
+\imageMacro{imagenavigator-dox.svg,"Icon of the Image Navigator",2.00}
\imageMacro{QmtikImageNavigator_ImageNavigator.png,"Image Navigator",7.47}
Fast movement through the available data can be achieved by using the Image Navigator.
By moving the sliders around you can scroll quickly through the slides and timesteps.
By entering numbers in the relevant fields you can jump directly to your point of interest.
The "Show detail" checkbox enables you to see the world coordinates in millimetres
and the index/voxel coordinates. These may be edited to jump to a specific location.
*/
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.imagenavigator/documentation/UserManual/image_navigator.svg b/Plugins/org.mitk.gui.qt.imagenavigator/documentation/UserManual/imagenavigator-dox.svg
similarity index 100%
rename from Plugins/org.mitk.gui.qt.imagenavigator/documentation/UserManual/image_navigator.svg
rename to Plugins/org.mitk.gui.qt.imagenavigator/documentation/UserManual/imagenavigator-dox.svg
diff --git a/Plugins/org.mitk.gui.qt.lasercontrol/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.lasercontrol/documentation/UserManual/Manual.dox
deleted file mode 100644
index d94dda6a62..0000000000
--- a/Plugins/org.mitk.gui.qt.lasercontrol/documentation/UserManual/Manual.dox
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
-\page org_mitk_gui_qt_lasercontrol The Laser Control
-
-\imageMacro{icon.png,"Icon of Lasercontrol",2.00}
-
-\tableofcontents
-
-\section org_mitk_gui_qt_lasercontrolOverview Overview
-Describe the features of your awesome plugin here
-<ul>
-<li>Increases productivity
-<li>Creates beautiful images
-<li>Generates PhD thesis
-<li>Brings world peace
-</ul>
-
-*/
diff --git a/Plugins/org.mitk.gui.qt.lasercontrol/documentation/UserManual/icon.xpm b/Plugins/org.mitk.gui.qt.lasercontrol/documentation/UserManual/icon.xpm
deleted file mode 100644
index 9057c20bc6..0000000000
--- a/Plugins/org.mitk.gui.qt.lasercontrol/documentation/UserManual/icon.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static const char * icon_xpm[] = {
-"16 16 2 1",
-" c #FF0000",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/Plugins/org.mitk.gui.qt.lasercontrol/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.lasercontrol/documentation/doxygen/modules.dox
deleted file mode 100644
index 1ecfa33fe9..0000000000
--- a/Plugins/org.mitk.gui.qt.lasercontrol/documentation/doxygen/modules.dox
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- \defgroup org_mitk_gui_qt_lasercontrol org.mitk.gui.qt.lasercontrol
- \ingroup MITKPlugins
-
- \brief Describe your plugin here.
-
-*/
-
-/**
- \defgroup org_mitk_gui_qt_lasercontrol_internal Internal
- \ingroup org_mitk_gui_qt_lasercontrol
-
- \brief This subcategory includes the internal classes of the org.mitk.gui.qt.lasercontrol plugin. Other
- plugins must not rely on these classes. They contain implementation details and their interface
- may change at any time. We mean it.
-*/
diff --git a/Plugins/org.mitk.gui.qt.matchpoint.evaluator/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.matchpoint.evaluator/documentation/UserManual/Manual.dox
index 2e852eeafa..0f87905d06 100644
--- a/Plugins/org.mitk.gui.qt.matchpoint.evaluator/documentation/UserManual/Manual.dox
+++ b/Plugins/org.mitk.gui.qt.matchpoint.evaluator/documentation/UserManual/Manual.dox
@@ -1,56 +1,56 @@
/**
\page org_mitk_views_matchpoint_evaluator The MatchPoint Registration Evaluation View
\imageMacro{map_evaluator_doc.svg, "Icon of the MatchPoint Registration Evaluator", 3}
\tableofcontents
\section MAP_REGEVAL_Introduction Introduction
This view offers the possibility to evaluate the quality of the registration/mapping of two given images by visual inspection.
This can either by used to assess the visual quality of a registration or to assess how well the image contents are already aligned
by default. To achieve the latter, one may select no registration. Then the images will be displayed in evaluation mode assuming an identity transform (so no mapping).
It is one of several MatchPoint registration plug-ins.\n
\section MAP_REGEVAL_Usage Usage
\imageMacro{map_view_evaluator_example.png, "Example screenshot showing the main elements of the view.", 14}
(1) The currently selected registration that should be used to map the moving image for evaluation. Click to change. If no registration is selected, a direct evaluation will be performed.\n
(2) Reset button will remove the currently selected registration.\n
(3) Auto select option. If active the view will try to deduce and automatically select (if loaded in the application) the moving and target image when the registration changes. The view assumes that the moving and target images used to determine the registration should be used.\n
(4) The currently selected moving data. Click to change.\n
(5) The currently selected target data. Click to change.\n
(6) Start/Stop button used to activate/deactivate the evaluation. This button become active when at least the moving and the target image are selected.\n
(7) Selection of the visualization style. (only visible if evaluation is active)\n
(8) Style specific settings. (only visible if evaluation is active)\n
-If the evaluation view is active you can choose between different modes of visualization. For more details see \ref MAP_REGEVAL_Styles.\n
+If the evaluation view is active you can choose between different modes of visualization. For more details see \ref MAP_REGEVAL_Styles .\n
To stop the evaluation mode, you may use the "Stop evaluation" button or just close the evaluation view.
\remark The evaluation view will use the level window settings of the used images. So to change the level windowing of the evaluation view, you must change the
level windowing of the respective input images (moving image and target image).
\section MAP_REGEVAL_Accuracy Evaluating accuracy
<b>Important note:</b> Please be aware, that a visual inspection of registration quality is only a weak surrogate for a thorough accuracy analysis based on representative and suitable ground truth data. From a visually good mapping you can not deduce a correct registration. This is especially true if the degrees of freedom of the registration increases. For a rigid registration it might by feasible to discern correct and incorrect registration. But for none rigid registrations you definitely you should use this view only for first visual inspection (to check if it SEEMS to do the right thing and is worth further exploration) or illustrating the registration effect for registration you have assessed in a sound way.
\section MAP_REGEVAL_Styles Visualization styles
You can choose from the following visualization styles to evaluate the registration/mapping quality:\n
\li "Blend": Blends the images with a user defined weight. Default is 50:50.
\imageMacro{map_view_blend_settings.png, "Settings of the Blend style", 8}
(1) Click to set the weights to 100% target image.\n
(2) Click to set the weights to 50:50 (equal blend).\n
(3) Slider to adjust the weights between target image and the mapped input image. The spin box shows the weight of the mapped input image.\n
(4) Click to set the weights to 100% mapped input image.\n
(5) Click to toggle the weight between both images.\n
\imageMacro{map_style_blend.png, "Example for mode: Blend (50:50)", 5}
\li "Checkerboard": Checkerboard style that composes both images by showing image 1 in all light squares and image 2 in all dark squares. You can define the resolution/number of squares of the checkerboard.
\imageMacro{map_style_checkerboard.png, "Example for mode: Checkerboard", 5}
\li "Color blend": Color blend of the images (blue: target image; yellow: moving). Areas where you see no color implies good intensity matchings.
\imageMacro{map_style_color_blend.png, "Example for mode: Color blend", 5}
\li "Contour": Blend mode that displays one image as blue "background" and the other image in yellow contours. You can choose the role of the images.
\imageMacro{map_style_contour.png, "Example for mode: Contour", 5}
\li "Difference": Displays the absolute difference of both images.
\li "Wipe": Blend mode that makes a rectilinear combination of the images. You can choose the mode how the images are splitted. The split is synchronized with the current selection. So you may interact with the split border to position it on interesting areas.
\imageMacro{map_style_wipe_cross.png, "Example for mode: Wipe cross", 5}
\imageMacro{map_style_wipe_horizontal.png, "Example for mode: Wipe horizontal", 5}
*/
diff --git a/Plugins/org.mitk.gui.qt.matchpoint.framereg/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.matchpoint.framereg/documentation/UserManual/Manual.dox
index 39073f4f70..ed515cb4ea 100644
--- a/Plugins/org.mitk.gui.qt.matchpoint.framereg/documentation/UserManual/Manual.dox
+++ b/Plugins/org.mitk.gui.qt.matchpoint.framereg/documentation/UserManual/Manual.dox
@@ -1,55 +1,55 @@
/**
\page org_mitk_views_matchpoint_framereg The MatchPoint Frame Correction View
\imageMacro{"map_framereg_icon_doc.svg", "Icon of the MatchPoint Algorithm Control", 3}
\tableofcontents
\section MAP_FRAME_Introduction Introduction
This view offers the user a way to use a selected registration algorithm in order to apply a frame correction to a selected 3D+t image.
This is for example useful if you have a dynamic image with motion artifacts in some time points and you want to reduce/remove these motion artifacts.
\section MAP_FRAME_Usage Usage
\imageMacro{"map_framereg_example.png" , "Example screenshot of the view.", 15}
-To use the view, a 3D+t image must be selected and a registration algorithm must be loaded. For the selection of an algorithm please see \ref org_mitk_views_matchpoint_algorithm_browser.\n
+To use the view, a 3D+t image must be selected and a registration algorithm must be loaded. For the selection of an algorithm please see \ref org_mitk_views_matchpoint_algorithm_browser .\n
The correction is performed such that every time frame of the image is registered to the first time frame. And the corrected time frames are mapped to the same geometry as the first frame.\n
If an algorithm is loaded and an input images is selected, the view will automatically switch to the <i>Execution</i> tab.
\subsection MAP_FRAME_Usage_selection Algorithm selection tab
\imageMacro{map_step1_selection.png, "Details of the algorithm selection tab.", 6}
In this tab, you can load the algorithm selected in the MatchPoint Algorithm Browser. In the area below the selection button the profile information of the registration algorithm is displayed.
For a detailed description of the profile characteristics the user is referred to \ref org_mitk_views_matchpoint_algorithm_browser .\n
When clicking the <i>Load selected algorithm</i> button, the selected algorithm will be used by the view for the frame correction and the name of the algorithm will be displayed in the text field <i>Loaded algorithm</i> at the top of the view.\n
At this point, it has no effect if you change the the selection in the algorithm browser. The view will keep the loaded algorithm until you choose to load another one.
\subsection MAP_FRAME_Usage_exec Execution tab
\imageMacro{map_step2_execution.png, "Details of the execution tab.", 6}
In this tab you can specify a name for the correction job (this will determine the names of the result nodes in the data manager).\n
Clicking the <i>Start</i> button will trigger the correction process.
\subsection MAP_FRAME_Usage_settings Settings tab
\imageMacro{map_step3_settings.png, "Details of the settings tab.", 6}
In this tab, you can configure the \ref MAP_FRAME_Mapper_Settings which are used for the corrected frames, or parameterize the loaded algorithm (before it starts), if it offers any possibility to do so.
\subsubsection MAP_FRAME_Mapper_Settings Mapping settings
For the mapping of corrected images, you have several settings available:\n
\li <b>Allow undefined pixels</b> Activate to handle pixels of the result image that are not in the field of view of the input image. These pixels will get the <i>padding value</i>.
\li <b>Allow error pixels</b> Activate to handle pixels of the result image that can not be mapped because the registration does not support this part of the output image. These pixels will get the <i>error value</i>.
\li <b>Interpolator</b> Set to choose the interpolation strategy that should be used for mapping. See details at \ref MAP_FRAME_Interpolation .
\subsubsection MAP_FRAME_Interpolation Interpolation
You can choose from the following interpolation strategies:\n
\li <b>Nearest Neighbour</b> Use the value of the nearest pixel. Fastest, but high interpolation errors for gray value images. Right choice for label images or masks.
\li <b>Linear"</b> Fast linear interpolation with often sufficient quality. Tends to blur edges.
\li <b>BSpline (3rd order)</b> Good trade off between time and quality.
\li <b>Windowed Sinc (Hamming)</b> Good interpolation quality but very time consuming.
\li <b>Windowed Sinc (Welch)</b> Good interpolation quality but very time consuming.
\subsection MAP_FRAME_Usage_frame_selection Frame selection tab
\imageMacro{map_step4_frameselection.png, "Details of the frame selection tab.", 6}
In this tab you can specify the frames of the currently selected image that should be corrected. As default all frames of an image will be selected.
If you only select specific frames, these frames will be corrected whilst all other frames will be just copied unchanged.
*/
diff --git a/Plugins/org.mitk.gui.qt.matchpoint.mapper/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.matchpoint.mapper/documentation/UserManual/Manual.dox
index c3f3652037..293ac2fd36 100644
--- a/Plugins/org.mitk.gui.qt.matchpoint.mapper/documentation/UserManual/Manual.dox
+++ b/Plugins/org.mitk.gui.qt.matchpoint.mapper/documentation/UserManual/Manual.dox
@@ -1,79 +1,79 @@
/**
\page org_mitk_views_matchpoint_mapper The MatchPoint Image Mapper View
\imageMacro{map_mapper_icon_doc.svg, "Icon of the MatchPoint Image Mapper",3}
\tableofcontents
\section MAP_MAPPER_Introduction Introduction
This view offers the possibility to map any loaded image or point set using a user selected registration object.
When mapping images the user can control the field of view (image geometry) the image should be mapped into, as well as the interpolation strategy and padding values that should be used.
It is one of several MatchPoint registration plugins.
<b>Typical usage scenarios</b>\n
You have registered image I1 onto image I2. Now you want to
\li (Most obvious) map I1 onto I2 with the registration, e.g. to make a joint statistical analysis.
\li map image I3 (e.g. an other MRI sequence of the same session) also onto I2 with the same registration.
\li map a segmentation created on I1 also onto I2 with the same registration.
\li map a point set of image I1 also onto I2 with the same registration.
\section MAP_MAPPER_Usage Usage
To use the mapper at least the input (image or point set) must be selected. Additionally, you may select a registration object and, in case the input is an image, an optional reference image.
The reference image defines the geometry (field of view, orientation, spacing) that should be used for the result image.
The view will try to automatically determine the reference image. By default it is the target image that was used to determine the selected registration.
If auto selection cannot determine the reference (e.g. because it was not specified or it is currently not loaded), the input image will be selected as reference.
The reference image can be also defined by the user explicitly by activating manual selection.
REMARK: If you map point sets you can ignore the reference image slot. It has no effect.
REMARK: The mapping results will be added as child nodes to the used input node.
REMARK: If you do not select an registration the view will assume that you make an identity transform. This is a convenient way if you
just want to resample an image into the geometry of an other image (when no registration is needed). Also in this use case you can take
advantage of the different interpolation and sub/super sampling strategies.
\imageMacro{map_mapper_instructions.png, "Main elements of the mapper view.", 7}
(1) The currently selected registration that will be used for mapping. Click to change.\n
(2) Reset button that will remove the current selected registration and switch back to an identity transform.\n
(3) The currently selected input data, that will be mapped. Click to change.\n
(4) The currently (automatically or by user) selected reference image, that defines the geometry of the result. Click to change.\n
(5) The name of the result data in the data manager.\n
-(6) The start button(s) to commence the mapping process. For details regarding the two options see \ref MAP_MAPPER_Refine.\n
+(6) The start button(s) to commence the mapping process. For details regarding the two options see \ref MAP_MAPPER_Refine .\n
(7) Log windows with messages regarding the mapping process.\n
\section MAP_MAPPER_Refine Mapping or geometry refinement
The mapper view offers two options to map images:\n
\li "Map" (default)
\li "Refine geometry"
For images "Map" fills the pixels of the output image by interpolating input image pixels using the registration object. This option always works,
but may take longer and introduces interpolation errors, because a new image is resampled.\n
The second option "Refine geometry" is only offered, if the registration (more precisely its inverse kernel) is matrix based and the selected data is an image.
In this case it just clones the image and refines its image geometry (origin and orientation) to project it to the position indicated by the registration; thus no interpolation artefacts are introduced.
\remark If you want to use a mapped image in conjunction with the image statistics plugin and a mask of the reference image (or you want to proceed any other computation that expects the voxel to be in the same grid for direct numeric comparison), you must use "Map" to ensure the same geometry
(including the same image grid; including same spacing and resolution). Otherwise operations like the images statistics plugin will fail.
\section MAP_MAPPER_Settings Settings
\imageMacro{map_mapper-settings.png, "Available settings for mapping images.", 7}
If you map the image (and not just refine the geometry), you have several settings available:\n
\li "Allow undefined pixels": Activate to handle pixels of the result image that are not in the field of view of the input image. These pixels will get the "padding value".
\li "Allow unregistered pixels": Activate to handle pixels of the result image that can not be mapped because the registration does not support this part of the output image. These pixels will get the "error value".
\li "Interpolator": Set to choose the interpolation strategy that should be used for mapping.
\li "Activate super/sub sampling": Activate if you want to use origin and orientation of the reference image but want to alter the spacing.
\section MAP_MAPPER_Interpolation Interpolation
You can choose from the following interpolation strategies:\n
\li "Nearest Neighbor": Use the value of the nearest pixel. Fastest, but high interpolation errors for gray value images. Right choice for label images or masks.
\li "Linear": Fast linear interpolation with often sufficient quality. Tends to blur edges.
\li "BSpline (3rd order)": Good trade off between time and quality.
\li "Windowed Sinc (Hamming)": Good interpolation quality but very time consuming.
\li "Windowed Sinc (Welch)": Good interpolation quality but very time consuming.
\section MAP_MAPPER_Masks Handling of masks/segmentations
If you select an mask as input image, the plugin will be automatically reconfigured to settings that are suitable for the task of mapping masks.
Most importantly the interpolator will be set to "Nearest Neighbor".
*/
diff --git a/Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/QmitkImageStatistics.dox b/Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/QmitkImageStatistics.dox
index f371747b7c..f65817f42d 100644
--- a/Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/QmitkImageStatistics.dox
+++ b/Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/QmitkImageStatistics.dox
@@ -1,63 +1,63 @@
/**
\page org_mitk_views_imagestatistics The Image Statistics View
-\imageMacro{bar-chart2.svg,"Icon of the Image Statistics View",2.00}
+\imageMacro{bar-chart2-dox.svg,"Icon of the Image Statistics View",2.00}
\section QmitkImageStatisticsUserManualSummary Summary
This view provides an easy interface to quickly compute some features of a whole image or a region of interest.
This document will tell you how to use this view, but it is assumed that you already know how to use MITK in general.
Please see \ref QmitkImageStatisticsUserManualDetails for more detailed information on usage and supported filters.
\section QmitkImageStatisticsUserManualDetails Details
Manual sections:
- \ref QmitkImageStatisticsUserManualOverview
- \ref QmitkImageStatisticsUserManualUsage
\section QmitkImageStatisticsUserManualOverview Overview
This view provides an easy interface to quickly compute some features of a whole image or a region of interest.
\imageMacro{QmitkMeasurementToolbox_Interface.png,"The interface",9.10}
\section QmitkImageStatisticsUserManualUsage Usage
To select the input data, either use the quick selection button (labeled "+"), or select the input data via the "Input Data" tab.
\imageMacro{QmitkImageStatistics_InputData.png,"Select the input data via the \"Input data\" tab (marked red) or via the quick selection button (marked yellow)",10}
\subsection QmitkImageStatisticStatistics Statistics
After selection of an image or a binary mask as input data, the image statistics are calculated and displayed in the "Statistics" section. If masks (ROIs: segmentations, planarfigures, ...) are selected, the statistics for these masks are shown. For time data the statistics for each time step are calculated correspondingly.
An example of parts of the calculated statistical features (Mean, Median, StandardDeviation, RMS, Max, MaxPosition, Min, MinPosition, Voxel, Volume [mm^3], Skewness, Kurtosis, Uniformity, Entropy, MPP, UPP and Variance) for different timesteps and different masks is pictured below.
\imageMacro{QmitkImageStatistics_statistics.png, "Example of parts of the statistics for different masks and timestamps", 1.00}
Check "Ignore zero-valued voxels" to hide voxels with grayvalue zero.
\subsection QmitkImageStatisticHistogram Histogram
Beneath the statistics window is the histogram window, which shows the histogram of the current selection.
The histogram window is currently only available for a single image and no or one ROI: When selection multiple images and/or multiple masks, the histogram window is deactivated!
Draw a rectangular window with a pressed left button to zoom in on the histogram. With a double click in the view area you can zoom out to the default viewport. You can also pan the view in horizontal or vertical direction by dragging with the left mouse button in the respective direction. Additionally, different options like "Custom Zoom", to set the maximum and minimum value, or by adjusting the number of bins, can be used to modify the view.
If the mask is not a closed planar figure or a segmentation an intensity profile is created instead of the histogram.
A tooltip is available by hovering over one of the bins.
\subsection QmitkImageStatisticsUserManualCopytoClipboard Copy to Clipboard
At the bottom of each view is a "Copy to Clipboard" button, allowing to copy the respective data in csv format to the clipboard.
Be aware of the following information regarding this functionality:
\li The values are separated by tabulator.
\li Numeric values will be converted using the system language (e.g. with German as system language the decimal separator will be ",", with English it will be '.').
\li One can directly copy'n'paste into Excel (and alike) as long as Excel supports/is configured to the system language
*/
diff --git a/Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/QmitkMeasurement.dox b/Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/QmitkMeasurement.dox
index e1372508d9..0cac52c084 100644
--- a/Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/QmitkMeasurement.dox
+++ b/Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/QmitkMeasurement.dox
@@ -1,90 +1,90 @@
/**
\page org_mitk_views_measurement The Measurement View
-\imageMacro{measurement.svg,"Icon of the Measurement View",2.00}
+\imageMacro{measurement-dox.svg,"Icon of the Measurement View",2.00}
<h1>Overview</h1>
The Measurement view allows you to measure distances, angles, paths and several geometric figures on 2D images or image slices of 3D and 4D images. The measurement view is repeatedly useable with the same or different measurement figures that are related to the chosen image and can be saved together with it for future use.
\imageMacro{QmitkMeasurementToolbox_BasicScreenEdited.jpg,"Image with measurements",16.00}
<h1>Usage</h1>
The first step to perform measurements is to select a reference image on top of the view. All resulting measurements will be assigned as child nodes of the image in the data manager. The standard working plane is 'Axial' but the other standard view planes ('Saggital' and 'Coronal') are also valid for measurements.
\imageMacro{QmitkMeasurementToolbox_MeasurementView.jpg,"Measurement View",7.60}
After selecting an image, you can click on any of the geometrical symbols. The respective measurement will appear as soon as you click on the image location you want to measure.
The view offers a variety of measurement options that are introduced in the following:
<ul>
<li> <b>Line:</b>
Draws a line between two set points and returns the distance between these points.
<li> <b>Path:</b>
Draws a line between several set points (two and more) and calculates the overall length, which is all lines length summed up. Add the final point by double left-click.
<li> <b>Angle:</b>
Draws two lines from three set points connected in the second set point and return the inner angle at the second point.
<li> <b>Four Point / Double Angle:</b>
Draws two lines that may but do not have to intersect from four set points. The returned angle is the one depicted in the icon.
<li> <b>Circle:</b>
Draws a circle by setting two points, whereas the first set point is the center and the second the radius of the circle. The measured values are the radius and the included area.
<li> <b>Ellipse:</b>
Draws an ellipse that can be modified by three points. The middle point can be used to move the whole measurement. The lower point modifies the ellipse axes. The right point can be used to modify the radius of the ellipse. The measured values are the major and minor axes and the area.
<li> <b>Double Ellipse:</b>
Draws two ellipses by adjusting four points. The middle point can be used to move the whole measurement. The left point is used to adjust the distance between the two ellipses. The lower point modifies the ellipse axes. The right point can be used to modify the radius of the ellipse. Can be used for measuring e.g. the wall thickness of a vessel. The measured values are the major and minor axes and the thickness.
<li> <b>Rectangle:</b>
Draws a rectangle by setting two points at the opposing edges of the rectangle starting with the upper left corner. The measured values are the circumference and the included area.
<li> <b>Polygon:</b>
Draws a closed polygon that can have an arbitrary number of points. New points are added by left mouse-click. To finish the drawing the user can double click on the last control point. The measured values are circumference and area.
<li> <b>Bezier curve:</b>
Draws a bezier curve by adding some control points with left mouse-click. To finish the drawing the user can double-click on the last control point. The measured value is the length of the bezier curve.
<li> <b>Subdivision Polygon:</b>
Draws a closed subdivision polygon by adding some control points with left mouse-click. To finish the drawing the user can double-click on the last control point. The measured value is the circumference of the polygon.
</ul>
<h2>Fixed sizes of measurement figures</h2>
The measurement view offers a fixed size for circle and double ellipses to preset a radius and a thickness. This is useful e.g. for diagnostic studies where you want to derive gray value statistics from a well defined region.
<h2>Modify measurements</h2>
All measurements can be modified later on by moving the respective control points. Note that they can only be modified if the view is open.
<h2>Multiple measurement figures</h2>
When applying more than one measurement figure to the image the actual measurement figure is depicted in red and the displayed values belong to this measurement figure. All other measurement figures appear white. They can be selected by a left-mouse click on the respective node.
<h2>Save the measurement information</h2>
The entire scene containing the image and the measurement figures can be saved for future use. Scenes are saved with a '.mitk' extension by pressing 'Save Project' and contain all nodes and relevant information. Alternatively, you can just save the measurement solely (with file extension '.pf') by right-click on the node in the data manager.
The content of the measurement widget can be copied to the clipboard with the corresponding button for further use in a table calculation program (e.g. Open Office Calc etc.).
<h2>Remove measurement figures or image</h2>
If the single measurement figures or the image is not needed any longer, it can be removed solely or as an entire group. The image can't be removed without simultaneously removing all the dependent measurement figures that belong to the image tree in the data manager. To remove, just select the wanted items in the data manager list by right-clicking on the respective node or, if several items wanted to be removed, right-click on all wanted by simultaneously holding the ctrl-button pressed.
*/
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/bar-chart.svg b/Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/bar-chart.svg
deleted file mode 100644
index a756ada699..0000000000
--- a/Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/bar-chart.svg
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<svg
- xmlns:dc="http://purl.org/dc/elements/1.1/"
- xmlns:cc="http://creativecommons.org/ns#"
- xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- xmlns:svg="http://www.w3.org/2000/svg"
- xmlns="http://www.w3.org/2000/svg"
- xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
- xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
- width="111.72881"
- height="83.7966"
- viewBox="0 0 111.72881 83.7966"
- id="svg2"
- version="1.1"
- inkscape:version="0.92.3 (2405546, 2018-03-11)"
- sodipodi:docname="bar-chart.svg">
- <metadata
- id="metadata10">
- <rdf:RDF>
- <cc:Work
- rdf:about="">
- <dc:format>image/svg+xml</dc:format>
- <dc:type
- rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
- <dc:title></dc:title>
- </cc:Work>
- </rdf:RDF>
- </metadata>
- <defs
- id="defs8" />
- <sodipodi:namedview
- pagecolor="#ffffff"
- bordercolor="#666666"
- borderopacity="1"
- objecttolerance="10"
- gridtolerance="10"
- guidetolerance="10"
- inkscape:pageopacity="0"
- inkscape:pageshadow="2"
- inkscape:window-width="1680"
- inkscape:window-height="988"
- id="namedview6"
- showgrid="false"
- inkscape:zoom="0.45814732"
- inkscape:cx="1024"
- inkscape:cy="768"
- inkscape:window-x="-8"
- inkscape:window-y="-8"
- inkscape:window-maximized="1"
- inkscape:current-layer="svg2"
- inkscape:snap-page="false"
- fit-margin-top="0"
- fit-margin-left="0"
- fit-margin-right="0"
- fit-margin-bottom="0" />
- <g
- id="g813"
- transform="translate(0,-1580.2034)">
- <path
- inkscape:connector-curvature="0"
- style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.05455508"
- id="path4"
- d="m 34.915254,1622.1017 v 27.9322 H 20.949153 v -27.9322 z m 20.949153,-27.9322 v 55.8644 H 41.898305 v -55.8644 z m 55.864403,62.8474 V 1664 H 0 v -83.7966 h 6.9830508 v 76.8135 z m -34.915251,-48.8813 v 41.8983 H 62.847458 v -41.8983 z m 20.949153,-20.9492 v 62.8475 H 83.79661 v -62.8475 z" />
- </g>
-</svg>
diff --git a/Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/bar-chart2.svg b/Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/bar-chart2-dox.svg
similarity index 100%
rename from Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/bar-chart2.svg
rename to Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/bar-chart2-dox.svg
diff --git a/Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/measurement.svg b/Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/measurement-dox.svg
similarity index 100%
rename from Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/measurement.svg
rename to Plugins/org.mitk.gui.qt.measurementtoolbox/documentation/UserManual/measurement-dox.svg
diff --git a/Plugins/org.mitk.gui.qt.mitkworkbench.intro/documentation/UserManual/QmitkMITKWorkbenchUserManual.dox b/Plugins/org.mitk.gui.qt.mitkworkbench.intro/documentation/UserManual/QmitkMITKWorkbenchUserManual.dox
index 66d0526156..d7ebfef0a5 100644
--- a/Plugins/org.mitk.gui.qt.mitkworkbench.intro/documentation/UserManual/QmitkMITKWorkbenchUserManual.dox
+++ b/Plugins/org.mitk.gui.qt.mitkworkbench.intro/documentation/UserManual/QmitkMITKWorkbenchUserManual.dox
@@ -1,17 +1,17 @@
/**
org_mitkworkbench Using The MITK Workbench
QMitkMitkWorkbenchManualOverview What is the MITK Workbench
The MITK Workbench is not only used by medical researchers but also by developers. As such the kind and number of views it contains is highly variable and dependent on the specific build. Typically it contains no special perspectives and whatever views the developer deemed desirable. Be aware, that it may contain views which are work in progress and may behave erratically.
-If you have been given such an executable by someone, please refer to the appropriate section of the online documentation for up to date usage information on any module.
+If you have been given such an executable by someone, please refer to the appropriate section of the online documentation for up to date usage information on any module.
-<a href="http://docs.mitk.org/nightly/PluginListPage.html">Nightly online documentation</a>
+<a href="https://docs.mitk.org/nightly/PluginListPage.html">Nightly online documentation</a>
-If you are using a nightly installer, the MITK Workbench will contain nearly all views available in MITK and as such most likely will seem confusing. Again the list of modules might be a good starting point if you want to have a rough idea of what could be of interest to you.
+If you are using a nightly installer, the MITK Workbench will contain nearly all views available in MITK and as such most likely will seem confusing. Again the list of modules might be a good starting point if you want to have a rough idea of what could be of interest to you.
For a basic guide to MITK see \ref MITKUserManualPage .
*/
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/CMakeLists.txt b/Plugins/org.mitk.gui.qt.moviemaker/CMakeLists.txt
index d38a3d1797..041e907007 100644
--- a/Plugins/org.mitk.gui.qt.moviemaker/CMakeLists.txt
+++ b/Plugins/org.mitk.gui.qt.moviemaker/CMakeLists.txt
@@ -1,10 +1,10 @@
# The project name must correspond to the directory name of your plug-in
# and must not contain periods.
project(org_mitk_gui_qt_moviemaker)
mitk_create_plugin(
EXPORT_DIRECTIVE MOVIEMAKER_EXPORT
EXPORTED_INCLUDE_SUFFIXES src
MODULE_DEPENDS MitkQtWidgetsExt
- PACKAGE_DEPENDS VTK|vtkTestingCore
+ PACKAGE_DEPENDS VTK|TestingCore+IOImage
)
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker.dox b/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker.dox
index 2cbc42acca..474d73a10f 100644
--- a/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker.dox
+++ b/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkMovieMaker.dox
@@ -1,64 +1,64 @@
/**
-\page org_mitk_views_moviemaker The Movie Maker
+\page org_mitk_views_moviemaker The Movie Maker View
\imageMacro{moviemakericon_black.svg,"Icon of the Movie Maker Plugin.",2.00}
\tableofcontents
\section org_mitk_views_moviemakerOverview Overview
The Movie Maker View allows you to create basic animations of your scene and to record them to video files.
Individual animations are arranged in a timeline and can be played back sequential or in parallel.
The Movie Maker View uses the external FFmpeg command line utility to write compressed video files.
<b>You have to manually install FFmpeg and set the corresponding path in "External Programs" in the MITK Workbench Preferences (Ctrl+P) in order to record your movies to video files.</b>
\imageMacro{QmitkMovieMaker_Preferences.png,"The External Programs preferences page.",12.00}
\section org_mitk_views_moviemakerUsage Usage
\imageMacro{QmitkMovieMaker_MovieMakerView.png,"The Movie Maker View.",16.00}
To create a movie you have to add an animation to the timeline by clicking the "Add animation" button.
You can choose between the available types of animations, e.g., Orbit or Slice.
The timeline surrounding bottons allow you to arrange, remove, or add further animations to your movie.
Each animation can be set to either begin with the previous animation, i.e., run in parallel, or to start after the previous animation, i.e., run sequential.
In combination with delays, rather complex animation arrangements are possible.
To set animation specific parameters, select the corresponding animation in the timeline first.
You can play back, pause and stop your movie with the according controls at the bottom of the Movie Maker View.
Click the "Record" button to finally record your movie to a video file with the specified number of frames per second.
You have to choose the render window which you want to record.
\subsection org_mitk_views_moviemakerOrbitUsage Orbit Animation
The Orbit animation rotates the camera in the 3D window around the scene.
Align the camera directly in the 3D window and enter the number of degrees for the orbitting.
If you are planning to have a specific view in the middle of your movie you can play the movie and pause it at the specific frame of interest.
Adjust the camera in the 3D window and restart the animation.
\imageMacro{QmitkMovieMaker_Orbit.png,"The Orbit animation.",12.00}
\subsection org_mitk_views_moviemakerSliceUsage Slice Animation
The Slice animation slices through an image.
You can choose the image plane (axial, sagittal, or coronal), as well as the start and end points of the slicing.
Use the image navigator in the bottom left of the Workbench to get an idea of the desired values.
Check "Reverse" in order to slice from the higher slice number to the lower slice number.
\imageMacro{QmitkMovieMaker_Slice.png,"The Slice animation.",12.00}
\subsection org_mitk_views_moviemakerTimeUsage Time Animation
The Time animation steps through the individual time steps of the current scene.
You can specify the range of the animated time steps.
Use the image navigator in the bottom left of the Workbench to get an idea of the desired values.
Check "Reverse" in order to step from later time steps to previous time steps.
\imageMacro{QmitkMovieMaker_Time.gif,"The Time animation.",12.00}
*/
diff --git a/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkScreenshotMaker.dox b/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkScreenshotMaker.dox
index 10230cc3cb..1c8f51d029 100644
--- a/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkScreenshotMaker.dox
+++ b/Plugins/org.mitk.gui.qt.moviemaker/documentation/UserManual/QmitkScreenshotMaker.dox
@@ -1,18 +1,18 @@
/**
-\page org_mitk_views_screenshotmaker The Screenshot Maker
+\page org_mitk_views_screenshotmaker The Screenshot Maker View
This view provides the functionality to create and save screenshots of the data.
\imageMacro{QmitkMovieMaker_ScreenshotMakerInterface.png,"The Screenshot Maker User Interface",7.09}
\section QmitkScreenshotMakerUserManualUse Usage
The first section offers the option to create a screenshot of selected view plane (axial, sagittal or coronal). Upon clicking the 'Single' button in the '2D Screenshot' section, the Screenshot Maker asks for a filename in which the screenshot is to be stored. The 'Multiplanar' button asks for a folder, in which screenshots of the three 2D views will be stored with default names.
If you tick the 'All Components' checkbox, you can take a screenshot of every channel of your multi-channel image. Otherwise, only the visible channel is captured.
The '3D Screenshots (High-res)' section works the same as the simple screenshot section, aside from the fact, that the user can choose a magnification ('Upsampling') factor. The 'Single' button creates a screenshot of the current 3D render window and the 'Multiplanar' button creates three screenshots from different perspectives.
In the 'Options' section, one can choose the background color for the screenshots, default is black.
*/
diff --git a/Plugins/org.mitk.gui.qt.multilabelsegmentation/documentation/UserManual/QmitkMultiLabelSegmentation.dox b/Plugins/org.mitk.gui.qt.multilabelsegmentation/documentation/UserManual/QmitkMultiLabelSegmentation.dox
index ed9a27078c..c0f9d94840 100644
--- a/Plugins/org.mitk.gui.qt.multilabelsegmentation/documentation/UserManual/QmitkMultiLabelSegmentation.dox
+++ b/Plugins/org.mitk.gui.qt.multilabelsegmentation/documentation/UserManual/QmitkMultiLabelSegmentation.dox
@@ -1,107 +1,118 @@
/**
\page org_mitk_views_multilabelsegmentation The Multilabel Segmentation
-\imageMacro{"multilabelsegmentation.svg", "Icon of the MultiLabelSegmentation Plugin", 12}
+\imageMacro{"multilabelsegmentation-dox.svg", "Icon of the MultiLabelSegmentation Plugin", 12}
The difference between a binary and a multi-label segmentation is that a multi-label segmentation can not only contain more than one label but also more than one layer. This allows you to create different labels for different regions of interest encapsulated in one single image. The difference between labels and layers is that labels on one layer cannot overlap but labels on different layers can.
<br>
The <b>Multilabel Segmentation plugin</b> consists of two views which can be used for:
<ul>
<li> manual and (semi-)automatic segmentation of anatomical and pathological structures in medical images via <b>the Multilabel Segmentation View</b>
<li> multilabel segmentation postprocessing via \subpage org_mitk_views_multilabelsegmentationutilities
</ul>
Hereinafter, a description is given on how multi-label segmentations can be created and modified. Please refer to \ref org_mitk_views_segmentation for a description of the general segmentation tools.
\tableofcontents
\section org_mitk_views_multilabelsegmentationUserManualCreateOpenSaveImportAdd Data Selection
-In the 'MultiLabel Segmentation' view you can first select an image. Thereafter, you can either create a new segmentation session by pressing the symbol right to the selection widget or select an existing one.
+In the 'MultiLabel Segmentation' view you can first select an image. Thereafter, you can either create a new segmentation session by pressing the symbol right to the selection widget or select an existing one.
\imageMacro{"org_mitk_views_multilabelsegmentationIMGtoolbar.png", "Data selection",12}
\section org_mitk_views_multilabelsegmentationUserManualLayerTable Segmentation Layers
-Once you started a segmentation session you can add or delete different layers. You can use the layers independently and switch layers by the left and right arrows.
+Once you started a segmentation session you can add or delete different layers. You can use the layers independently and switch layers by the left and right arrows.
\imageMacro{"org_mitk_views_multilabelsegmentationIMGlayerManager.png", "Layer selection",12}
\subsection org_mitk_views_multilabelsegmentationUserManualLayerCreation Creating a New Layer
A layer is a set of labels that occupy a non-overlapping anatomical space. The best way to describe them is by a real use case. Imagine you are working on a radiotherapy planning application. In the first layer of your segmentation
session, you would like to trace the contours of the liver and neighboring organs. You can accommodate all these segmentations in separate labels because they all occupy different anatomical regions and do not overlap. Now say you would like to segment the arteries and veins inside the liver. If you don't trace them in a different layer, you will overwrite the previous ones. You may also need a third layer for segmenting the different irrigation territories in the liver and a fourth layer to contain the lesion you would like to treat.
\section org_mitk_views_multilabelsegmentationUserManualLabelTable Segmentation Labels
For each layer, you can add one or more labels. Pressing the double arrow on the right, all created labels are shown in the 'Lable Table'. The following label properties are available:
<ul>
<li><b>Name:</b></li> the name of the label. Can be a predefined one or any other.
<li><b>Locked:</b></li> whether the label is locked or editable. A locked label cannot be overwritten by another.
<li><b>Color:</b></li> the color of the label.
<li><b>Visible:</b></li> whether the label is currently visible or hidden.
</ul>
\imageMacro{"org_mitk_views_multilabelsegmentationIMGlabeltable.png", "The 'Label Table' shows all labels in the current segmentation session", 12}
\subsection org_mitk_views_multilabelsegmentationUserManualLabelCreation Creating a New Label
Click the 'New Label' button to add a new label. A dialog will show up to enter the name and color. Preset organ names and
corresponding colors are offered while you type in, but you can set any name. The new name - if not known - will be automatically remembered and made available the next time you create a new label. In the current implementation of the plugin, the maximum number of labels is restricted to 255. If you need more, you will have to create a new segmentation session.
+\subsection org_mitk_views_multilabelsegmentationUserManualLabelPresets Saving and Loading Label Set Presets
+
+Label set presets are useful to share a certain style or scheme between different segmentation sessions or to provide templates for new segmentation sessions.
+
+The properties of all labels in all layers like their names, colors, and visibilities are saved as a label set preset by clicking on the 'Save label set preset' button.
+Label set presets are applied to any segmentation session by clicking on the 'Load label set preset' button.
+If a label for a certain value already exists, its properties are overridden by the preset.
+If a label for a certain value does not yet exist, an empty label with the label properties of the preset is created.
+The actual segmentations of labels are unaffected as label set presets only store label properties.
+
+
\subsection org_mitk_views_multilabelsegmentationUserManualLabelSearch Searching a Label
It may happen that many labels (e.g. > 200) are present in a segmentation session and therefore manual searching can be time-consuming.
The 'Label Search' edit box allows for quickly finding the label you want. Just start writing its name and you will get assistance for completing its name. If the label you were searching is found, press 'enter' and it will become the active one.
\subsection org_mitk_views_multilabelsegmentationUserManualLabelEditing Label Editing
Here the actual segmentation takes place. First of all, you have to select the active label by clicking on the corresponding row in the 'Label Table'. Note that only one label can be active at the time. Then you can select segmentation tool in the toolbox.
\imageMacro{"org_mitk_views_multilabelsegmentationIMGSegmentationToolbox.png", "Segmentation toolbox", 12}
\note Not all segmentation tools can be found here. This is because some of the semi-automatic tools can not be applied in case of multiple labels.
\subsection org_mitk_views_multilabelsegmentationUserManualOperationsOnLabels Operations on Labels
Depending on your selection in the 'Label Table', several actions are offered:
\subsubsection org_mitk_views_multilabelsegmentationUserManualOperationsOnSingleSelection Single Label Selection
If you right click on any label in the table, a pop-up menu offers the following actions to be performed on the selected label:
<ul>
<li><b>Rename...</b></li> : change the name and/or color of the selected label.
<li><b>Remove...</b></li> : delete the selected label.
<li><b>Erase...</b></li> : only clear the contents of the selected label.
<li><b>Merge...</b></li> : merge two labels by selecting a second label.
<li><b>Random color </b></li> : assign a random color to the label.
<li><b>View only </b></li> : make all labels except the current selected label invisible.
<li><b>View/Hide all </b></li> : make all labels visible / invisible
<li><b>Lock/Unlock all </b></li> : lock or unlock all labels.
<li><b>Create surface </b></li> : generate a surface out of the selected label.
<li><b>Create mask </b></li> : generate a mask out of the selected label. A mask is a binary image with "1" inside and "0" outside.
<li><b>Create cropped mask </b></li> : generate a binary mask out of the selected label. Crop changes the extent of the resulting image to the extent of the label.
</ul>
\imageMacro{"org_mitk_views_multilabelsegmentationIMGLabelTableSingleSelectionContextMenu.png", "Context menu for single label selection", 12}
\subsubsection org_mitk_views_multilabelsegmentationUserManualOperationsOnMultipleSelection Multiple Label Selection
You can select more than one label by shift-click on other labels. If more than one label is selected, different options will appear in the menu:
\imageMacro{"org_mitk_views_multilabelsegmentationIMGLabelTableMultipleSelectionContextMenu.png", "Context menu for multiple label selection", 12}
<ul>
<li><b>Merge selection on current label</b></li> : transfer the contents of the selected labels in the 'Label Table' into the current one.
<li><b>Remove selected labels</b></li> : delete the selected labels.
<li><b>Erase selected labels</b></li> : only clear the contents of the selected labels.
</ul>
*/
diff --git a/Plugins/org.mitk.gui.qt.multilabelsegmentation/documentation/UserManual/multilabelsegmentation.svg b/Plugins/org.mitk.gui.qt.multilabelsegmentation/documentation/UserManual/multilabelsegmentation-dox.svg
similarity index 100%
rename from Plugins/org.mitk.gui.qt.multilabelsegmentation/documentation/UserManual/multilabelsegmentation.svg
rename to Plugins/org.mitk.gui.qt.multilabelsegmentation/documentation/UserManual/multilabelsegmentation-dox.svg
diff --git a/Plugins/org.mitk.gui.qt.multilabelsegmentation/documentation/UserManual/multilabelsegmentation.png b/Plugins/org.mitk.gui.qt.multilabelsegmentation/documentation/UserManual/multilabelsegmentation.png
deleted file mode 100644
index b5c3bd21ff..0000000000
Binary files a/Plugins/org.mitk.gui.qt.multilabelsegmentation/documentation/UserManual/multilabelsegmentation.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.multilabelsegmentation/documentation/UserManual/org_mitk_views_multilabelsegmentationIMGlabeltable.png b/Plugins/org.mitk.gui.qt.multilabelsegmentation/documentation/UserManual/org_mitk_views_multilabelsegmentationIMGlabeltable.png
index a5987203f8..da81e871a6 100644
Binary files a/Plugins/org.mitk.gui.qt.multilabelsegmentation/documentation/UserManual/org_mitk_views_multilabelsegmentationIMGlabeltable.png and b/Plugins/org.mitk.gui.qt.multilabelsegmentation/documentation/UserManual/org_mitk_views_multilabelsegmentationIMGlabeltable.png differ
diff --git a/Plugins/org.mitk.gui.qt.openigtlink/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.openigtlink/documentation/UserManual/Manual.dox
deleted file mode 100644
index f063230e77..0000000000
--- a/Plugins/org.mitk.gui.qt.openigtlink/documentation/UserManual/Manual.dox
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
-\page org_mitk_gui_qt_igtlplugin The IGT Plugin
-
-\imageMacro{icon.png,"Icon of Igtlplugin",2.00}
-
-\tableofcontents
-
-\section org_mitk_gui_qt_igtlpluginOverview Overview
-Describe the features of your awesome plugin here
-<ul>
-<li>Increases productivity
-<li>Creates beautiful images
-<li>Generates PhD thesis
-<li>Brings world peace
-</ul>
-
-*/
diff --git a/Plugins/org.mitk.gui.qt.openigtlink/documentation/UserManual/icon.xpm b/Plugins/org.mitk.gui.qt.openigtlink/documentation/UserManual/icon.xpm
deleted file mode 100644
index 9057c20bc6..0000000000
--- a/Plugins/org.mitk.gui.qt.openigtlink/documentation/UserManual/icon.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static const char * icon_xpm[] = {
-"16 16 2 1",
-" c #FF0000",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/Plugins/org.mitk.gui.qt.openigtlink/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.openigtlink/documentation/doxygen/modules.dox
deleted file mode 100644
index 7da567195c..0000000000
--- a/Plugins/org.mitk.gui.qt.openigtlink/documentation/doxygen/modules.dox
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- \defgroup org_mitk_gui_qt_igtlplugin org.mitk.gui.qt.igtlplugin
- \ingroup MITKPlugins
-
- \brief Describe your plugin here.
-
-*/
-
-/**
- \defgroup org_mitk_gui_qt_igtlplugin_internal Internal
- \ingroup org_mitk_gui_qt_igtlplugin
-
- \brief This subcategory includes the internal classes of the org.mitk.gui.qt.igtlplugin plugin. Other
- plugins must not rely on these classes. They contain implementation details and their interface
- may change at any time. We mean it.
-*/
diff --git a/Plugins/org.mitk.gui.qt.overlaymanager/documentation/UserManual/QmitkOverlayManager.dox b/Plugins/org.mitk.gui.qt.overlaymanager/documentation/UserManual/QmitkOverlayManager.dox
index 8520e79ce4..19b6d1489b 100644
--- a/Plugins/org.mitk.gui.qt.overlaymanager/documentation/UserManual/QmitkOverlayManager.dox
+++ b/Plugins/org.mitk.gui.qt.overlaymanager/documentation/UserManual/QmitkOverlayManager.dox
@@ -1,11 +1,11 @@
/**
\page org_mitk_gui_qt_overlaymanager The Overlay Manager Plugin
-\imageMacro{icon.png,"Icon of Overlaymanager",2.00}
+\imageMacro{overlaymanager-dox.png,"Icon of Overlaymanager",2.00}
\tableofcontents
\section org_mitk_gui_qt_overlaymanagerOverview Overview
The OverlayManager plugin allows to view all annotations currently managed. Properties of added annotations can be modified. Additionally it is possible to create some basic overlays and register them.
*/
diff --git a/Plugins/org.mitk.gui.qt.overlaymanager/documentation/UserManual/icon.png b/Plugins/org.mitk.gui.qt.overlaymanager/documentation/UserManual/overlaymanager-dox.png
similarity index 100%
rename from Plugins/org.mitk.gui.qt.overlaymanager/documentation/UserManual/icon.png
rename to Plugins/org.mitk.gui.qt.overlaymanager/documentation/UserManual/overlaymanager-dox.png
diff --git a/Plugins/org.mitk.gui.qt.pharmacokinetics.mri/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.pharmacokinetics.mri/documentation/UserManual/Manual.dox
index 126c9e07f2..91ea443d33 100644
--- a/Plugins/org.mitk.gui.qt.pharmacokinetics.mri/documentation/UserManual/Manual.dox
+++ b/Plugins/org.mitk.gui.qt.pharmacokinetics.mri/documentation/UserManual/Manual.dox
@@ -1,104 +1,104 @@
/**
\page org_mitk_views_pharmacokinetics_mri The DCE MR Perfusion DataFit View
\imageMacro{pharmacokinetics_mri_doc.svg,"Icon of the DCE MR Perfusion View",3.0}
\tableofcontents
\section FIT_DCE_Introduction Introduction
-In dynamic contrast-enhanced (DCE) MRI, pharmacokinetic (PK) modeling can be used to quantify tissue physiology.
-Parameters describing the tissue microvasculature can be derived by fitting a pharmacokinetic model, e.g. a compartment model, to the dynamic data.
+In dynamic contrast-enhanced (DCE) MRI, pharmacokinetic (PK) modeling can be used to quantify tissue physiology.
+Parameters describing the tissue microvasculature can be derived by fitting a pharmacokinetic model, e.g. a compartment model, to the dynamic data.
This view offers a comprehensive set of tools to perform pharmacokinetic analysis.
\section FIT_DCE_Contact Contact information
If you have any questions, need support, find a bug or have a feature request, feel free to contact us at www.mitk.org.
\subsection FIT_DCE_Cite Citation information
If you use the view for your research please cite our work as reference:\n\n
Debus C and Floca R, Ingrisch M, Kompan I, Maier-Hein K, Abdollahi A, Nolden M, <i>MITK-ModelFit: generic open-source framework for model fits and their exploration in medical imaging – design, implementation and application on the example of DCE-MRI</i>. https://doi.org/10.1186/s12859-018-2588-1 (BMC Bioinformatics 2019 20:31)
\section FIT_DCE_Data_and_ROI_Selection Time series and mask selection
\imageMacro{dce_mri_maskAndFittingStrategy.png, "Time series and mask selection.", 10}
In principle, every model can be fitted on the entire image. However, for model configuration reasons (e.g. AIF required) and computational time cost, this is often not advisable.
Therefore, apart from the image to be fitted (<i>Selected Time Series</i>), a ROI segmentation can be defined (<i>Selected Mask</i>), within which model fitting is performed.
The view currently offers <i>Pixel based</i> and/or <i>ROI based</i> averaged fits of time-varying curves. The <i>ROI based</i> fitting option becomes enabled, if a mask is selected.
\section FIT_DCE_General_models Supported models
Currently the following pharmacokinetic models for gadolinium-based contrast agent are available:
- The Descriptive Brix model \ref FIT_DCE_lit_ref1 "[1]"
- A semi-quantitative two/three segment linear model (2SL/3SL)
- The standard tofts model \ref FIT_DCE_lit_ref2 "[2]"
- The extended Tofts model \ref FIT_DCE_lit_ref3 "[3]"
- The two compartment exchange model (2CXM) \ref FIT_DCE_lit_ref4 "[4, 5]"
\section FIT_DCE_Settings Model settings
\imageMacro{dce_mri_modelSettings.png, "Model settings of the view for the standard Tofts model.", 10}
\subsection FIT_DCE_Settings_model Model specific settings
Selecting one of the \ref FIT_DCE_General_models "supported models" will open below tabs for further configuration of the model.
- The descriptive Brix model requires only definition of the duration of the bolus, i.e. the overall time of the injection (<i>Injection Time [min]</i>).
- The 3SL is a semi-quantitative descriptive model that distinguishes three different segments of the signal: A constant baseline, the initial fast rise (wash-in) and the final slow rise / signal decrease (washout). Each of these segments is approximated by a linear curve, with change points in-between. It requires no further configuration.
- The standard Tofts model, the extended Tofts model and the 2CXM are compartment models that require the input of the concentration time curve in the tissue feeding artery, the arterial input function (AIF).
In the DCE MR Perfusion Datafit View, the arterial input function can be defined in several ways. For patient individual image derived AIFs, select the radio button <i>Select AIF from Image</i>.
In that case, a segmentation ROI for the artery has to be selected. This can be done by clicking on the <i>AIF Mask</i> selection widget and selecting a suitable AIF segmentation from the data loaded in the Data Manager. In cases where the respective artery does not lie in the same image as the investigated tissue (e.g. in animal experiments, where a slice through the heart is used for AIF extraction), a dedicated AIF image can be selected using the corresponding <i>Dedicated AIF image</i> selection widget.
-An alternative option is to define the AIF via an external file by selecting <i>Select AIF from File</i> (e.g. for population derived AIFs or AIFs from blood sampling). By clicking the <i>Browse</i> button, one can select a csv file that holds the AIF values and corresponding timepoints (in tuple format (Time, Value)).
+An alternative option is to define the AIF via an external file by selecting <i>Select AIF from File</i> (e.g. for population derived AIFs or AIFs from blood sampling). By clicking the <i>Browse</i> button, one can select a csv file that holds the AIF values and corresponding timepoints (in tuple format (Time, Value)).
Caution: the file must not contain a header line, but the first line must start with Time and Intensity values.
Furthermore, the <i>Hematocrit Level</i> has to be set (from 0 to 1) for conversion from whole blood to plasma concentration. It is set as default to the literature value of 0.45.
\subsection FIT_DCE_Settings_start Start parameter
\imageMacro{dce_mri_start.png, "Example screenshot for start parameter settings.", 10}
In cases of noisy data it can be useful to define the initial starting values of the parameter estimates, at which optimization starts, in order to prevent optimization results in local optima.
Each model has default scalar values (applied to every voxel) for initial values of each parameter, however these can be adjusted.
Moreover, initial values can also be defined locally for each individual voxel via starting value images. To load a starting value image, change the <i>Type</i> from <i>scalar</i> to <i>image</i>. This can be done by double-clicking on the type cell.
-In the <i>Value</i> column, selection of a starting value image will be available.
+In the <i>Value</i> column, selection of a starting value image will be available.
\subsection FIT_DCE_Settings_constraint Constraints settings
\imageMacro{dce_mri_constraints.png, "Example screenshot for constraints settings.", 10}
To limit the fitting search space and to exclude unphysical/illogical results for model parameter estimates, constraints to individual parameters as well as combinations can be imposed.
Each model has default constraints, however, new ones can be defined or removed by the + and – buttons in the table.
The first column specifies the parameter(s) involved in the constraint (if multiple parameters are selected, their sum will be used) by selection in the drop down menu.
The second column <i>Type</i> defines whether the constraint defines an upper or lower boundary.
<i>Value</i> defines the actual constraint value, that should not be crossed, and <i>Width</i> allows for a certain tolerance width.
\subsection FIT_DCE_Settings_concentration Signal to concentration conversion settings
\imageMacro{dce_mri_concentration.png, "Example screenshot for concentration conversion settings.", 10}
Most models require contrast agent concentration values as input rather than raw signal intensities (i.e. all compartment models).
The DCE MR Perfusion DataFit View offers a variety of tools for the conversion from signal to concentration:
by means of relative and absolute signal enhancement, via a T1-map calculated by the variable flip angle method, as well as a special conversion for turbo flash sequences.
For the conversion methods, a baseline image prior to contrast agent arrival is required.
-In many data sets, multiple baseline images are available. The <i>Baseline Range Selection</i> allows for selection of a range of time frames, from which the average image (along the time dimension) is calculated and set as baseline input image.
+In many data sets, multiple baseline images are available. The <i>Baseline Range Selection</i> allows for selection of a range of time frames, from which the average image (along the time dimension) is calculated and set as baseline input image.
Remark: The number of the first time frame is 0.
\section FIT_DCE_Fitting Executing a fit
In order to distinguish results from different model fits to the data, a <i>Fitting name</i> can be defined.
As default, the name of the model and the fitting strategy (pixel/ROI) are given. This name will then be appended by the respective parameter name.\n\n
For development purposes and evaluation of the fits, the option <i>Generate debug parameter images</i> is available.
Enabling this option will result in additional parameter maps displaying the status of the optimizer at fit termination.
In the following definitions, an <i>evaluation</i> describes the process of cost function calculation and evaluation by the optimizer for a given parameter set.
- <i>Stop condition</i>: Reasons for the fit termination, i.e. criterion reached, maximum number of iterations,...
- <i>Optimization time</i>: The overall time from fitting start to termination.
- <i>Number of iterations</i>: The number of iterations from fitting start to termination.
- <i>Constraint penalty ratio</i>: Ratio between evaluations that were penalized and all evaluations. 0.0 means no evaluation was penalized; 1.0 all evaluations were. Evaluations that hit the failure threshold count as penalized, too.
- <i>Constraint last failed parameter</i>: Ratio between evaluations that were beyond the failure threshold. 0.0 means no evaluation was a failure (but some may be penalized).
- <i>Constraint failure ratio</i>: Index of the first (in terms of index position) parameter, which failed the constraints in the last evaluation.
After all necessary configurations are set, the button <i>Start Modelling</i> is enabled, which starts the fitting routine.
Progress can be seen in the message box on the bottom. Resulting parameter maps will afterwards be added to the Data Manager as sub-nodes of the analyzed 4D image.
\section FIT_DCE_lit References/Literature
- \anchor FIT_DCE_lit_ref1 [1] Brix G, Semmler W, Port R, Schad LR, Layer G, Lorenz WJ. Pharmacokinetic parameters in CNS Gd-DTPA enhanced MR imaging. J Comput Assist Tomogr. 1991;15:621–8.
- \anchor FIT_DCE_lit_ref2 [2] Tofts PS, Kermode AG. Measurement of the blood-brain barrier permeability and leakage space using dynamic MR imaging. 1. Fundamental concepts. Magn Reson Med. 1991;17:357–67.
- \anchor FIT_DCE_lit_ref3 [3] Sourbron SP, Buckley DL. On the scope and interpretation of the Tofts models for DCE-MRI. Magn Reson Med. 2011;66:735–45.
- \anchor FIT_DCE_lit_ref4 [4] Brix G, Kiessling F, Lucht R, Darai S, Wasser K, Delorme S, et al. Microcirculation and microvasculature in breast tumors: Pharmacokinetic analysis of dynamic MR image series. Magn Reson Med. 2004;52:420–9.
-- \anchor FIT_DCE_lit_ref5 [5] Sourbron, Buckley. Tracer kinetic modelling in MRI: estimating perfusion and capillary permeability - pdf. Phys Med Biol. 2012. http://iopscience.iop.org/article/10.1088/0031-9155/57/2/R1/pdf. Accessed 1 May 2016.
+- \anchor FIT_DCE_lit_ref5 [5] Sourbron, Buckley. Tracer kinetic modelling in MRI: estimating perfusion and capillary permeability - pdf. Phys Med Biol. 2012. https://iopscience.iop.org/article/10.1088/0031-9155/57/2/R1/pdf. Accessed 1 May 2016.
*/
diff --git a/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/documentation/UserManual/Manual.dox
index ee77922748..4add60b8c5 100644
--- a/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/documentation/UserManual/Manual.dox
+++ b/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/documentation/UserManual/Manual.dox
@@ -1,66 +1,66 @@
/**
\page org_mitk_views_photoacoustics_imageprocessing The Photoacoustics Imageprocessing Plugin
-\imageMacro{pai.png,"Icon of Imageprocessing",2.00}
+\imageMacro{pai-dox.png,"Icon of Imageprocessing",2.00}
\tableofcontents
\section org_mitk_gui_qt_photoacoustics_imageprocessingOverview Overview
This plugin offers an interface to perform image processing on photoacoustic, as well as ultrasound images, i.e. to use beamforming and post-processing filters.
For convenience, image processing can be done automatically for a whole batch of files containing PA or US data.
\section org_mitk_gui_qt_photoacoustics_imageprocessingPrerequisites Prerequisites
To use the much more performant openCL filters which run on the graphics card, MITK has to be able to use openCL, for which it is necessary to install the openCL implementation provided by your graphics card vendor.
\section org_mitk_gui_qt_photoacoustics_imageprocessingFiltering Using the filters
To perform image processing, simply load an image into MITK and select it in the Data manager. Only the selected image will be processed by the filters.
\imageMacro{QmikPhotoacousticsImageProcessing_DataManager.png,"Select the image to be processed",7.62}
Before performing reconstruction or using other filters those can be configured using the plugin's settings panel.
\imageMacro{QmikPhotoacousticsImageProcessing_Settings.png,"The plugin's GUI",7.62}
\subsection org_mitk_gui_qt_photoacoustics_imageprocessingImageDetails Image Details
To create the .nrrd images necessary for the plugin from raw data, one can use e.g. <a href="https://github.com/mhe/pynrrd">pynrrd</a>, a python package for very straightforward creation of .nrrd images.
The Beamforming Filter is also able to read certain paramters, as the scan depth and the transducer pitch from the selected image. To this end, the image must have a time-axis spacing in µs and a horizontal spacing in mm.
\subsection org_mitk_gui_qt_photoacoustics_imageprocessingBeamforming The Beamforming Settings
For beamforming, three beamforming algorithms are available:
<ul>
<li>DAS (Delay And Sum)
<li>DMAS (Delay Multiply And Sum)
<li>sDMAS (signed Delay Multiply And Sum)
</ul>
Each of those can be coupled with either spherical delay calculation or a quadratic approximation for the delays. To supress noise, one of the following apodizations can be chosen to be used when beamforming:
<ul>
<li>Box (No apodization)
<li>Hamming
<li>Von Hann
</ul>
Other Standard beamforming parameters are available, which have to be chosen depending on the source image to attain a correctly reconstructed image.
As mentioned above, Plugin is able to calculate the used scan depth as well as the transducer pitch from the selected image if the time-axis spacing is in microseconds, and the horizontal spacing in mm. If such a spacing is given,
check the box "Auto Get Depth" to make the plugin read those values by itself.
If the US source or the laser used for imaging is not located at the top of the image, an option is given to cut off pixels at the top of the image until the source. This value should be calibrated by the user
to match the used hardware.
If one wishes to beamform only certain slices of a given image, those can be selected by checking "select slices" and setting the "min" and "max" values accordingly, which are to be understood as closed interval boundaries.
\subsection org_mitk_gui_qt_photoacoustics_imageprocessingBandpass The Bandpass Settings
The bandpass uses an itk implementation of an 1D Fast Fourier Transform (FFT) to transform the image vertically, then filters the image using a Tukey window in the frequency domain and performs an inverse 1D FFT to get the filtered image.
The "smoothness" of the tukey window can be chosen by using the "Tukey window alpha" parameter. The Tukey window interpolates between a Box window (alpha = 0) and a Von Hann window (alpha = 1).
The filtered frequencies can be set by defining the High and Low pass frequencies.
\subsection org_mitk_gui_qt_photoacoustics_imageprocessingCrop The Crop Filter Settings
The crop filter cuts off parts of the image at the top and the bottom. The amount of pixels cut off can be configured using the "Cut Top" and "Cut Bottom" parameters.
\subsection org_mitk_gui_qt_photoacoustics_imageprocessingBMode The BMode Filter Settings
The B-mode filters available are:
<ul>
<li>An absolute filter
<li>An envelope detection filter
</ul>
If desired, the filter can also resample the image to a given spacing; to do this, check the "Do Resampling" box and set the desired spacing in mm.
Afterwards a logarithmic filter can be applied, if "Add Logfilter" is checked.
\subsection org_mitk_gui_qt_photoacoustics_imageprocessingBatch Batch Processing
When processing large amounts of data, an option is available to automatically process multiple images by applying all filters in order to those images and saving the resulting images.
In the first row of the Batch Processing Panel one can select which filters should be applied to the image; in the second row one can select whether the resulting image from the filter should be saved.
After pressing the "Start Batch Processing" button, one can choose first the images to be processed, and then the folder where they will be saved.
*/
diff --git a/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/documentation/UserManual/pai.png b/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/documentation/UserManual/pai-dox.png
similarity index 100%
rename from Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/documentation/UserManual/pai.png
rename to Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/documentation/UserManual/pai-dox.png
diff --git a/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/files.cmake b/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/files.cmake
index e4fe8ebf7d..4b9c855389 100644
--- a/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/files.cmake
+++ b/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/files.cmake
@@ -1,37 +1,36 @@
set(SRC_CPP_FILES
)
set(INTERNAL_CPP_FILES
org_mitk_gui_qt_photoacoustics_imageprocessing_Activator.cpp
PAImageProcessing.cpp
)
set(UI_FILES
src/internal/PAImageProcessingControls.ui
)
set(MOC_H_FILES
src/internal/org_mitk_gui_qt_photoacoustics_imageprocessing_Activator.h
src/internal/PAImageProcessing.h
)
set(CACHED_RESOURCE_FILES
resources/pai.svg
- resources/photoacousticsIcon.png
plugin.xml
)
set(QRC_FILES
)
set(CPP_FILES )
foreach(file ${SRC_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/${file})
endforeach(file ${SRC_CPP_FILES})
foreach(file ${INTERNAL_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/internal/${file})
endforeach(file ${INTERNAL_CPP_FILES})
diff --git a/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/resources/pai.png b/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/resources/pai.png
deleted file mode 100644
index 1b8dc34c11..0000000000
Binary files a/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/resources/pai.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/resources/photoacousticsIcon.png b/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/resources/photoacousticsIcon.png
deleted file mode 100644
index 8c0e9f9c88..0000000000
Binary files a/Plugins/org.mitk.gui.qt.photoacoustics.imageprocessing/resources/photoacousticsIcon.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.photoacoustics.pausmotioncompensation/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.photoacoustics.pausmotioncompensation/documentation/UserManual/Manual.dox
deleted file mode 100644
index 4497cf1a23..0000000000
--- a/Plugins/org.mitk.gui.qt.photoacoustics.pausmotioncompensation/documentation/UserManual/Manual.dox
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
-\page org_mitk_gui_qt_photoacoustics_pausmotioncompensation The Pausmotioncompensation
-
-\imageMacro{icon.png,"Icon of Pausmotioncompensation",2.00}
-
-\tableofcontents
-
-\section org_mitk_gui_qt_photoacoustics_pausmotioncompensationOverview Overview
-Describe the features of your awesome plugin here
-<ul>
-<li>Increases productivity
-<li>Creates beautiful images
-<li>Generates PhD thesis
-<li>Brings world peace
-</ul>
-
-*/
diff --git a/Plugins/org.mitk.gui.qt.photoacoustics.pausmotioncompensation/documentation/UserManual/icon.xpm b/Plugins/org.mitk.gui.qt.photoacoustics.pausmotioncompensation/documentation/UserManual/icon.xpm
deleted file mode 100644
index 9057c20bc6..0000000000
--- a/Plugins/org.mitk.gui.qt.photoacoustics.pausmotioncompensation/documentation/UserManual/icon.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static const char * icon_xpm[] = {
-"16 16 2 1",
-" c #FF0000",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/Plugins/org.mitk.gui.qt.photoacoustics.pausmotioncompensation/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.photoacoustics.pausmotioncompensation/documentation/doxygen/modules.dox
deleted file mode 100644
index a8a13b7f31..0000000000
--- a/Plugins/org.mitk.gui.qt.photoacoustics.pausmotioncompensation/documentation/doxygen/modules.dox
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- \defgroup org_mitk_gui_qt_photoacoustics_pausmotioncompensation org.mitk.gui.qt.photoacoustics.pausmotioncompensation
- \ingroup MITKPlugins
-
- \brief Describe your plugin here.
-
-*/
-
-/**
- \defgroup org_mitk_gui_qt_photoacoustics_pausmotioncompensation_internal Internal
- \ingroup org_mitk_gui_qt_photoacoustics_pausmotioncompensation
-
- \brief This subcategory includes the internal classes of the org.mitk.gui.qt.photoacoustics.pausmotioncompensation plugin. Other
- plugins must not rely on these classes. They contain implementation details and their interface
- may change at any time. We mean it.
-*/
diff --git a/Plugins/org.mitk.gui.qt.photoacoustics.pausviewer/src/QmitkPAUSViewerView.cpp b/Plugins/org.mitk.gui.qt.photoacoustics.pausviewer/src/QmitkPAUSViewerView.cpp
index b3191afbf9..c5952656d8 100644
--- a/Plugins/org.mitk.gui.qt.photoacoustics.pausviewer/src/QmitkPAUSViewerView.cpp
+++ b/Plugins/org.mitk.gui.qt.photoacoustics.pausviewer/src/QmitkPAUSViewerView.cpp
@@ -1,155 +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.
============================================================================*/
// Blueberry
#include <berryISelectionService.h>
#include <berryIWorkbenchWindow.h>
#include "mitkScaleLegendAnnotation.h"
#include "mitkLayoutAnnotationRenderer.h"
#include "mitkManualPlacementAnnotationRenderer.h"
#include "mitkTextAnnotation2D.h"
#include "QmitkPAUSViewerView.h"
const std::string QmitkPAUSViewerView::VIEW_ID = "org.mitk.views.photoacoustics.pausviewer";
QmitkPAUSViewerView::QmitkPAUSViewerView() : m_PADataStorage(mitk::StandaloneDataStorage::New()), m_USDataStorage(mitk::StandaloneDataStorage::New()), m_UltrasoundReference(nullptr)
{
}
QmitkPAUSViewerView::~QmitkPAUSViewerView()
{
if(m_UltrasoundReference != nullptr)
*m_UltrasoundReference = nullptr;
}
void QmitkPAUSViewerView::InitWindows()
{
AddOverlays();
}
void QmitkPAUSViewerView::SetFocus()
{
}
void QmitkPAUSViewerView::OnSelectionChanged(berry::IWorkbenchPart::Pointer /*source*/,
const QList<mitk::DataNode::Pointer>& /*nodes*/)
{
}
void QmitkPAUSViewerView::CreateQtPartControl(QWidget *parent)
{
m_Controls = new Ui::QmitkPAUSViewerViewControls;
m_Controls->setupUi(parent);
m_Controls->m_PARenderWindow->GetRenderer()->SetDataStorage(m_PADataStorage);
m_Controls->m_USRenderWindow->GetRenderer()->SetDataStorage(m_USDataStorage);
}
void QmitkPAUSViewerView::SetPADataStorage(mitk::StandaloneDataStorage::Pointer paStore)
{
if (m_Controls == nullptr)
return;
m_PADataStorage = paStore;
m_Controls->m_PARenderWindow->GetRenderer()->SetDataStorage(m_PADataStorage);
m_Controls->m_PALevelWindow->SetDataStorage(m_PADataStorage);
}
void QmitkPAUSViewerView::SetUSDataStorage(mitk::StandaloneDataStorage::Pointer usStore)
{
if (m_Controls == nullptr)
return;
m_USDataStorage = usStore;
m_Controls->m_USRenderWindow->GetRenderer()->SetDataStorage(m_USDataStorage);
m_Controls->m_USLevelWindow->SetDataStorage(m_USDataStorage);
}
vtkRenderWindow* QmitkPAUSViewerView::GetPARenderWindow()
{
if (m_Controls == nullptr)
return nullptr;
- return m_Controls->m_PARenderWindow->GetRenderWindow();
+ return m_Controls->m_PARenderWindow->renderWindow();
}
vtkRenderWindow* QmitkPAUSViewerView::GetUSRenderWindow()
{
if (m_Controls == nullptr)
return nullptr;
- return m_Controls->m_USRenderWindow->GetRenderWindow();
+ return m_Controls->m_USRenderWindow->renderWindow();
}
void QmitkPAUSViewerView::AddOverlays()
{
//if (m_PARenderer == nullptr || /*m_PAOverlayController == nullptr||*/ m_USRenderer == nullptr /*|| m_USOverlayController == nullptr*/)
//{
m_PARenderer = mitk::BaseRenderer::GetInstance(GetPARenderWindow());
m_USRenderer = mitk::BaseRenderer::GetInstance(GetUSRenderWindow());
//}
MITK_INFO << "1111111111111111111111";
mitk::ScaleLegendAnnotation::Pointer scaleAnnotation = mitk::ScaleLegendAnnotation::New();
//scaleAnnotation->SetLeftAxisVisibility(true);
//scaleAnnotation->SetRightAxisVisibility(false);
//scaleAnnotation->SetRightAxisVisibility(false);
//scaleAnnotation->SetTopAxisVisibility(false);
//scaleAnnotation->SetCornerOffsetFactor(0);
MITK_INFO << "1111111111111111111111";
// Add Overlays
//![TextAnnotation2D]
// Create a textAnnotation2D
mitk::TextAnnotation2D::Pointer textAnnotation = mitk::TextAnnotation2D::New();
textAnnotation->SetText("Test!"); // set UTF-8 encoded text to render
textAnnotation->SetFontSize(40);
textAnnotation->SetColor(1, 0, 0); // Set text color to red
textAnnotation->SetOpacity(0.5);
MITK_INFO << "1111111111111111111111";
// The position of the Annotation can be set to a fixed coordinate on the display.
mitk::Point2D pos;
pos[0] = 10;
pos[1] = 20;
textAnnotation->SetPosition2D(pos);
MITK_INFO << "1111111111111111111111";
std::string rendererID = m_PARenderer->GetName();
// The LayoutAnnotationRenderer can place the TextAnnotation2D at some defined corner positions
mitk::LayoutAnnotationRenderer::AddAnnotation(
textAnnotation, rendererID, mitk::LayoutAnnotationRenderer::TopLeft, 5, 5, 1);
mitk::LayoutAnnotationRenderer::AddAnnotation(
textAnnotation, m_PARenderer.GetPointer(), mitk::LayoutAnnotationRenderer::TopLeft, 5, 5, 1);
mitk::ManualPlacementAnnotationRenderer::AddAnnotation(
textAnnotation, m_PARenderer.GetPointer());
MITK_INFO << "1111111111111111111111";
mitk::LayoutAnnotationRenderer::AddAnnotation(scaleAnnotation.GetPointer(), m_PARenderer->GetName(), mitk::LayoutAnnotationRenderer::TopLeft, 5, 5, 1);
mitk::LayoutAnnotationRenderer::AddAnnotation(scaleAnnotation.GetPointer(), m_USRenderer, mitk::LayoutAnnotationRenderer::TopLeft, 5, 5, 1);
MITK_INFO << "1111111111111111111111";
}
void QmitkPAUSViewerView::RemoveOverlays()
{
// m_PAOverlayManager->RemoveAllOverlays();
}
void QmitkPAUSViewerView::SetUltrasoundReference(QmitkPAUSViewerView** ultrasoundReference)
{
m_UltrasoundReference = ultrasoundReference;
}
diff --git a/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/documentation/UserManual/Manual.dox
index 177ecacda1..f0c5887d21 100644
--- a/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/documentation/UserManual/Manual.dox
+++ b/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/documentation/UserManual/Manual.dox
@@ -1,37 +1,32 @@
/**
\page org_mitk_gui_qt_photoacoustics_spectralunmixing The spectral unmixing (SU) plugin
-\imageMacro{icon.png,"Icon of Spectralunmixing",2.00}
+\imageMacro{photoacoustics_spectralunmixing-dox.png,"Icon of Spectralunmixing",2.00}
-\table of contents
-<ul>
-<li> Introduction
-<li> Overview
-<li> How to add an additional algorithm
-</ul>
+\tableofcontents
\section org_mitk_gui_qt_photoacoustics_spectralunmixingIntroduction
The spectral unmixing plugin provides a GUI tool to perform spectral unmixing of multispectral MITK images. It was designed to unmix beamformed photoacoustic images. The outputs are MITK images for every chosen absorber (endmember). Furthermore it is possible to calculate the oxygen saturation of the multispectral input if the endmembers oxy- and deoxyhemoglobin are selected in the GUI as well as an output image that contains the information about the relative error between unmixing result and the input image.
Detailed information about the Plugin, the baseclass and its subclasses can be found in their header files. If you want to call the SU filter from your own class have a look at the “mitkSpectralUnmixingTest.cpp”. There you find information about which functions are callable or have to be called from your class to guarantee the promised functionality of the SU filter.
\section org_mitk_gui_qt_photoacoustics_spectralunmixingOverview
<ul>
<li> supports several linear Eigen solvers collected in the “mitkPALinearSpectralUnmixingFilter”
<li> supports several linear Vigra solvers collected in the “mitkPASpectralUnmixingVigraFilter”
<li> calculates oxygen saturation with the “mitkPASpectralUnmixingSO2”
</ul>
\section How to add an additional algorithm:
If the algorithm fits in one of the existing classes you can ignore steps 0. – 3.
0. Have a look at the commit rMITK36cfd1731089: implement three empty classes for Simplex, Lagrange and Vigra SU algorithms. Which actually are exactly the first (not all!) steps to implement a new algorithm.
1. Add your future header and cpp file to files.cmake
-2. Create a header file which needs at least the methods shown in header.png
-\imageMacro{header.png,"empty header for a new SU algorithm",2.00}
-3. Create a cpp file which takes an Eigen endmember matrix and an Eigen input vector as inputs and returns an Eigen vector as result. A structure like in the cpp.png is recommended. If your class will consist of more than one algorithm you should have an if/else decision between them with an enum like in the cpp.png otherwise you can directly return your result.
-\imageMacro{cpp.png,"example cpp file for a new SU algorithm",2.00}
-4. In the Plugin you just have to add another “else if” like in the plugin.png. The string in the else if has to be the same then selectable in the GUI(step 5).
-\imageMacro{plugin.png,"changes of Plugin for a new SU algorithm",2.00}
-5. To make you algorithm selectable you have to add to the GUI Combobox. Klick at 1. (GUI.png), then at 2. and then name your algorithm 3. like in step 4.
-\imageMacro{GUI.png,"changes of GUI for a new SU algorithm",2.00}
+2. Create a header file which needs at least the methods shown in header.PNG
+\imageMacro{header.PNG,"empty header for a new SU algorithm",2.00}
+3. Create a cpp file which takes an Eigen endmember matrix and an Eigen input vector as inputs and returns an Eigen vector as result. A structure like in the cpp.PNG is recommended. If your class will consist of more than one algorithm you should have an if/else decision between them with an enum like in the cpp.PNG otherwise you can directly return your result.
+\imageMacro{cpp.PNG,"example cpp file for a new SU algorithm",2.00}
+4. In the Plugin you just have to add another “else if” like in the plugin.PNG. The string in the else if has to be the same then selectable in the GUI(step 5).
+\imageMacro{plugin.PNG,"changes of Plugin for a new SU algorithm",2.00}
+5. To make you algorithm selectable you have to add to the GUI Combobox. Klick at 1. (GUI.PNG), then at 2. and then name your algorithm 3. like in step 4.
+\imageMacro{GUI.PNG,"changes of GUI for a new SU algorithm",2.00}
*/
diff --git a/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/documentation/UserManual/icon.png b/Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/documentation/UserManual/photoacoustics_spectralunmixing-dox.png
similarity index 100%
rename from Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/documentation/UserManual/icon.png
rename to Plugins/org.mitk.gui.qt.photoacoustics.spectralunmixing/documentation/UserManual/photoacoustics_spectralunmixing-dox.png
diff --git a/Plugins/org.mitk.gui.qt.pointsetinteraction/documentation/UserManual/QmitkPointSetInteraction.dox b/Plugins/org.mitk.gui.qt.pointsetinteraction/documentation/UserManual/QmitkPointSetInteraction.dox
index 8145e8f5d4..a52cb52ad6 100644
--- a/Plugins/org.mitk.gui.qt.pointsetinteraction/documentation/UserManual/QmitkPointSetInteraction.dox
+++ b/Plugins/org.mitk.gui.qt.pointsetinteraction/documentation/UserManual/QmitkPointSetInteraction.dox
@@ -1,59 +1,59 @@
/**
\page org_mitk_views_pointsetinteraction The Point Set Interaction
-\imageMacro{pointset_interaction.svg,"Icon of the Point Set Interaction View",2.00}
+\imageMacro{pointset_interaction-dox.svg,"Icon of the Point Set Interaction View",2.00}
<h1>Overview</h1>
This view allows you to define multiple sets of points, to fill them with points and to save them in so called PointSets.
\imageMacro{QmitkPointSetInteraction_Screenshot.png,"PointSet Annotations in MITK",16.00}
This document will tell you how to use this view, but it is assumed that you already know how to navigate through the slices of an image using the
four window view. Please read the application manual for more information.
<h1>Usage</h1>
<h2>Create new PointSet</h2>
First of all you have to select a PointSet to use this view. You can either select an existing PointSet in the data manager or you can create a new one. This is done by clicking the 'Add pointset...' button.
\imageMacro{QmitkPointSetInteraction_AddPointSet.png,"The Add pointset... dialog",8.64}
In the pop-up dialog, you have to specify a name for the new PointSet. Afterwards, it appears as a new node in the data manager.
<h2>Add new points </h2>
To set points you have to toggle the 'Set Points' button (<b>+</b>), the leftmost of the seven buttons on the bottom of the view.
Points can be defined by performing a left mouse button click while holding the 'Shift'-key pressed in the four window view.
Alternatively, you can set a new point by pressing the button next to the left most button (<b>+ xyz</b>) and adding a new point location directly.
The 'Current pointset' area contains a list of all points in the current PointSet node with index and position.
\imageMacro{QmitkPointSetInteraction_CurrentPointSetArea.png,"PointSet Interaction View",6.52}
<h2>Remove points </h2>
To erase a point from the list press either the third button or the delete key on your keyboard.
<h2>Modify point position</h2>
By using the 'up' and 'down' arrow buttons, the index location of a point in the PointSet can be altered.
<h2>Save and load a PointSet</h2>
With the two last buttons PointSets can be saved and loaded.
With the 'save' button, the entire PointSet can be saved to the harddrive. The user is prompted to select a filename.
PointSets are saved in XML fileformat but have to have a '.mps' file extension. A previously saved PointSet can be loaded and all of its points appear in the list and the four window view as well as a node in the data manager.
<h2>Modify points</h2>
You can select a single point in the render window, if the 'Set Points' button is toggled. If you keep the mouse button pressed, you can move the points by moving the mouse and then releasing the mouse button. With the delete key you can remove the selected points.
*/
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.pointsetinteraction/documentation/UserManual/QmitkPointSetInteraction_Icon.png b/Plugins/org.mitk.gui.qt.pointsetinteraction/documentation/UserManual/QmitkPointSetInteraction_Icon.png
deleted file mode 100644
index c3d1d306ca..0000000000
Binary files a/Plugins/org.mitk.gui.qt.pointsetinteraction/documentation/UserManual/QmitkPointSetInteraction_Icon.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.pointsetinteraction/documentation/UserManual/pointset_interaction.svg b/Plugins/org.mitk.gui.qt.pointsetinteraction/documentation/UserManual/pointset_interaction-dox.svg
similarity index 100%
rename from Plugins/org.mitk.gui.qt.pointsetinteraction/documentation/UserManual/pointset_interaction.svg
rename to Plugins/org.mitk.gui.qt.pointsetinteraction/documentation/UserManual/pointset_interaction-dox.svg
diff --git a/Plugins/org.mitk.gui.qt.pointsetinteractionmultispectrum/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.pointsetinteractionmultispectrum/documentation/UserManual/Manual.dox
deleted file mode 100644
index d9fee1b600..0000000000
--- a/Plugins/org.mitk.gui.qt.pointsetinteractionmultispectrum/documentation/UserManual/Manual.dox
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
-\page org_mitk_gui_qt_pointsetinteractionmultispectrum The Point Set Interaction Multispectrum
-
-\imageMacro{icon.png,"Icon of Pointsetinteractionmultispectrum",2.00}
-
-\tableofcontents
-
-\section org_mitk_gui_qt_pointsetinteractionmultispectrumOverview Overview
-Describe the features of your awesome plugin here
-<ul>
-<li>Increases productivity
-<li>Creates beautiful images
-<li>Generates PhD thesis
-<li>Brings world peace
-</ul>
-
-*/
diff --git a/Plugins/org.mitk.gui.qt.pointsetinteractionmultispectrum/documentation/UserManual/icon.xpm b/Plugins/org.mitk.gui.qt.pointsetinteractionmultispectrum/documentation/UserManual/icon.xpm
deleted file mode 100644
index 9057c20bc6..0000000000
--- a/Plugins/org.mitk.gui.qt.pointsetinteractionmultispectrum/documentation/UserManual/icon.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static const char * icon_xpm[] = {
-"16 16 2 1",
-" c #FF0000",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/Plugins/org.mitk.gui.qt.pointsetinteractionmultispectrum/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.pointsetinteractionmultispectrum/documentation/doxygen/modules.dox
deleted file mode 100644
index 6f341778a0..0000000000
--- a/Plugins/org.mitk.gui.qt.pointsetinteractionmultispectrum/documentation/doxygen/modules.dox
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- \defgroup org_mitk_gui_qt_pointsetinteractionmultispectrum org.mitk.gui.qt.pointsetinteractionmultispectrum
- \ingroup MITKPlugins
-
- \brief Describe your plugin here.
-
-*/
-
-/**
- \defgroup org_mitk_gui_qt_pointsetinteractionmultispectrum_internal Internal
- \ingroup org_mitk_gui_qt_pointsetinteractionmultispectrum
-
- \brief This subcategory includes the internal classes of the org.mitk.gui.qt.pointsetinteractionmultispectrum plugin. Other
- plugins must not rely on these classes. They contain implementation details and their interface
- may change at any time. We mean it.
-*/
diff --git a/Plugins/org.mitk.gui.qt.properties/documentation/UserManual/PropertiesView.dox b/Plugins/org.mitk.gui.qt.properties/documentation/UserManual/PropertiesView.dox
index 2b4644144a..2450b2f9c7 100644
--- a/Plugins/org.mitk.gui.qt.properties/documentation/UserManual/PropertiesView.dox
+++ b/Plugins/org.mitk.gui.qt.properties/documentation/UserManual/PropertiesView.dox
@@ -1,57 +1,57 @@
/**
-\page org_mitk_views_properties The Properties
+\page org_mitk_views_properties The Properties View
-\imageMacro{icon.svg,"Icon of the Properties View.",2.00}
+\imageMacro{properties-dox.svg,"Icon of the Properties View.",2.00}
\tableofcontents
\section org_mitk_views_propertiesOverview Overview
The Properties View allows you to inspect and change properties of a selected data node and its attached data.
This View is only for advanced users and developers, as it is easy to alter the program state in unexpected ways.
It can be considered as a complete exposure of parts of the backend that are usually supposed to be accessed only through dedicated frontend components like the color or opacity widgets in the context menu of a data node in the Data Manager View.
\section org_mitk_views_propertiesUsage Usage
\imageMacro{view.png,"The Properties View.",12.00}
\subsection org_mitk_views_propertiesUsagePropertyListTypes Property list types
After you selected a data node, the Property View allows you to switch between several property lists that are attached to the selected data node and its actual data.
By default, you see the common data node property list.
There are two types of property lists: data node property lists and data property lists.
Data node property lists consist of properties that the application attaches mainly for rendering settings.
They are not intrinsically part of the actual data and are only persisted when saving the MITK scene as a whole.
A typical example of such a property is "visible", which decides if the data should be rendered or hidden.
The common data node property list is applied to all render windows but there are also render window specific data node property lists.
Any property that is found in both the common list and a render window specific list is overriden by the latter one.
For example, if you want to hide an image only in the 3d render window but show it in all other render windows, you check "visible" in the common list, add the same property to the 3d render window specific list, and uncheck it there.
There is only a single data property list.
It represents the true metadata of the selected data like DICOM tags of a DICOM image.
When saving specific data, most data properties are written to the data file, as long as the selected file format supports metadata.
A popular example is the NRRD image format that allows to save custom key value pairs in text format in the file header.
Not all data properties are meant for persistence, though.
To check if a certain data property will be written to a metadata-enabled file format, click on it in the properties tree view and check if there is a save icon at the bottom in the additional property info box.
\subsection org_mitk_views_propertiesUsageFilter Filter
Property lists can be quite large and complex, shown as a tree structure in the Properties View.
To quickly find properties of interest you can use the filter text box, which will filter the properties while you type.
\subsection org_mitk_views_propertiesUsageEditProperties Edit properties
Most property value types like numbers, strings, boolean values, or colors can be edited by either clicking or double-clicking in the Value column.
For example, to edit color properties, double-click on the colored Value cell.
You can either enter a color by name like "yellow", in hex notation like "#ffff00" (or abbreviated "#ff0"), or click on the "..." button to open a color picker dialog.
\subsection org_mitk_views_propertiesUsagePropertyInfos Additional property information
Some properties have additional information attached like a description, aliases, or a persistence flag.
This information is shown at the bottom of the Properties View.
When no additional information is available, the additional property info box is hidden.
*/
diff --git a/Plugins/org.mitk.gui.qt.properties/documentation/UserManual/icon.svg b/Plugins/org.mitk.gui.qt.properties/documentation/UserManual/properties-dox.svg
similarity index 100%
rename from Plugins/org.mitk.gui.qt.properties/documentation/UserManual/icon.svg
rename to Plugins/org.mitk.gui.qt.properties/documentation/UserManual/properties-dox.svg
diff --git a/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/QmitkRadiomicsArithmetricView.dox b/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/QmitkRadiomicsArithmetricView.dox
index edd1426650..fb56062e54 100644
--- a/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/QmitkRadiomicsArithmetricView.dox
+++ b/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/QmitkRadiomicsArithmetricView.dox
@@ -1,23 +1,23 @@
/**
\page org_mitk_views_radiomicsarithmetricview Image Arithmetrics
Allows to perform basic arithmetic operations with all images. By default, the resulting image will be of the same type as the first input image. This also means that all operations will be perfomed using the same datatype as the input image. This can lead to rounding errors if an integer data type is used. It is possible to avoid this problem by creating a double-based image as result image by selecting the corresponding option.
There are three different types of operations:
\li Single Image Operations: These are operations that are performed on each voxel value and do not need any additional parameter. Typical operations are calculating the absolute value of an image, or calculating an trigometric value.
\li Single Image Operations: These are operations that are performed on each voxel value and do not need any additional parameter. Typical operations are calculating the absolute value of an image, or calculating an trigometric value.
\li Single Image and Double Value Operation: These are the basic mathematical operations (add, subtract, multiply, and dividive).
\li Two Images Operations: Allows to perfom basic operations between two images.
-\subsection IA_SingleImageOperations Single Image Operations
+\section IA_SingleImageOperations Single Image Operations
Allows to perfom a arithmetic operation to each voxel of an image independently. Be aware that some operations expect a specific input range. This range is usually not tested for, and it might cause an error if the range if values outside of the expceted range occure. Also, some operations are rather expensive with respect to the calculation time and take some time to finish.
-\subsection IA_SingleImageAndDoubleValue Single Image and Double Value Operation
+\section IA_SingleImageAndDoubleValue Single Image and Double Value Operation
Performs a basic mathematical operation (add, subtract, multiply, and divide) between an image and a floating point value. The operation is execuded for each voxel independently. There are two options if the order of the input is relevant (i.e. for subtraction and division) to enable both ways.
-\subsection IA_TwoImages Two Image Operations
+\section IA_TwoImages Two Image Operations
This allows to perfom mathematical operations between two images. The second image needs to be specified within this panel. Both images must match in size, it is also assumed (but not checked) that both images share the same geometry. This means that the corresponding voxels of both images share the same geometrical space.
The first image, that would also be used for other operations, is used as "Image", while the image specified in the panel is used as "Second Image". In general, the first image is also used as first parameter in the mathematical operation.
*/
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_00_PortalPage.dox b/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_00_PortalPage.dox
index 6d7f5351bf..315c0640e1 100644
--- a/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_00_PortalPage.dox
+++ b/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_00_PortalPage.dox
@@ -1,22 +1,22 @@
/**
\page org_mitk_views_radiomicstutorial_gui_portal GUI based Radiomics Tutorial
-This is an basic tutorial to show how MITK Phenotyping can be used to perform the individual steps of an radiomics study. It assumes that you have MITK Phenotyping running on your server, and focuses on the usage of the graphical interface.
+This is an basic tutorial to show how MITK Phenotyping can be used to perform the individual steps of an radiomics study. It assumes that you have MITK Phenotyping running on your server, and focuses on the usage of the graphical interface.
-In order to use the Tutorial you need an 3D image. We will use the Pic3D.nrrd image, which can be downloaded from http://mitk.org/download/tutorial-data/Pic3D.nrrd . So if you want to have a better comparability between our results and your results, we suggest that you use this image as well. However, feel free to use your own image if you want.
+In order to use the Tutorial you need an 3D image. We will use the Pic3D.nrrd image, which can be downloaded from https://www.mitk.org/download/tutorial-data/Pic3D.nrrd . So if you want to have a better comparability between our results and your results, we suggest that you use this image as well. However, feel free to use your own image if you want.
-The tutorial is designed along the steps that would be perfomed within a radiomics study until to the point where the radiomic features are obtained and the statistical analysis would be necessary. This should be done in the tool of choice of the scientist. Please be aware: This is not a real study, and you might perfom some steps differently or additional steps in a real radiomics study. The main aim of this study is to give the reader an idea how to perfom individual steps in MITK.
+The tutorial is designed along the steps that would be perfomed within a radiomics study until to the point where the radiomic features are obtained and the statistical analysis would be necessary. This should be done in the tool of choice of the scientist. Please be aware: This is not a real study, and you might perfom some steps differently or additional steps in a real radiomics study. The main aim of this study is to give the reader an idea how to perfom individual steps in MITK.
-The first step is to make MITK Phenotyping and the MITK Workbench familiar to you. If you know the basic of the MITK Workbench, you can skip this step.
+The first step is to make MITK Phenotyping and the MITK Workbench familiar to you. If you know the basic of the MITK Workbench, you can skip this step.
\subpage org_mitk_views_radiomicstutorial_gui_01_basic
-The second step is to create a segmentation for the next steps. If you want to create the segmentations with a different tool, you can also skip this step.
+The second step is to create a segmentation for the next steps. If you want to create the segmentations with a different tool, you can also skip this step.
\subpage org_mitk_views_radiomicstutorial_gui_02_Segmentation
The third step is to preprocess the images. This step could also be perfomed before creating the segmentation, which is actually suggested. But it is common that the segmentations are already created for a study. Therefore, we put this step after the segmentation creation process.
\subpage org_mitk_views_radiomicstutorial_gui_03_preprocessing
The fourth and last step of this tutorial covers the calculation of the features with the graphical interface. We only use a limited amount of features, feel free to calculate more features in one step.
\subpage org_mitk_views_radiomicstutorial_gui_04_featurecalulation
-*/
\ No newline at end of file
+*/
diff --git a/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_01_Basic.dox b/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_01_Basic.dox
index c07b77e924..8955702e42 100644
--- a/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_01_Basic.dox
+++ b/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_01_Basic.dox
@@ -1,30 +1,27 @@
/**
\page org_mitk_views_radiomicstutorial_gui_01_basic GUI based Radiomics Tutorial - Basic handling of MITK
-\subsection Basic handling of MITK
+\section Basic handling of MITK
Open a MITK Workbench which also includes MITK Phenotyping. You should see something similar to figure 1. At the top you'll see a bar (1), (2) with different important operations like open and saving data, different important views (like DICOM Window, Image Navigator and View Navigator), and a list of all Views included in your version (2). Items are grouped, and depending on the width of your screen might be hidden behind small arrows.
The Data Manager (3) is usually placed at the left, although it could be also open at other positions. It is used to organize open images and other data items. Below it you see the Image Navigator (4) which helps to navigate through the 3D data. It allows to change the position within the data either in real-world coordinates (in mm) or by specifiying a slice number.
In the center of your application you should see the Displays (5), which will display the images. It usually consists of four views, showing axial, sagittal, coronal and a 3D view of the data. It is possible to rearange the single displays and configure them to your wishes with the three small buttons which will become visible if the mouse is in the upper right corner of display.
Beside these elements, there are various open views (6). You can close them with the cross and reopen them using the bar at the top (2). It is also possible to rearrange all Views to various positions left, right, above, or below the displays.
An important view is the "View Navigator". In figure 1 it is hidden behind the Data Manager (3) and could be made visible with a click on the corresponding bar left of the "Data Manager" bar. The View Navigator is an easy and straight forward tool to show all available views and open them. It allows to search through all views. Offering a search function it allows to find views using their name of just searching for a functionality you are looking for.
\imageMacro{RadiomicsTutorial_GUI_Step1_01_Overview.png,"Overview of MITK Workbench with active MITK Phenotyping",1}
-\subsection Loading image data
+\section Loading image data
In order to calculate the radiomics features using the graphical interface you first need to load the data into the graphical environment. This can be done in different ways. If you want to load an DICOM series, it is sufficient to load a single image if the other images of the series are within the same folder. MITK will then combine all Series DICOM Images to a single 3D Image.
\li Open an Image using the "Open File" menu item: If you click on the "Open File" item in the "File" menu or the "Open File" button in the top bar you will be presented a standard file dialog of your system. Select the image you want to load and click "Open".
\li Drag n' Drop: Select the image you want to load with your standard data managing tool, for example with the explorer on windows or finder on Mac. Drag and drop the file into the open MITK Workbench window, the image will then be loaded if possible. If you
\li DICOM Browser: MITK offers the basic possibiliy to manage and handle DICOM images using the DICOM Browser. You can enable this view by clicking on "DICOM", right of the "Redo"-Button. Within the DICOM Browser, it is possible to read complete folders, and load specific series into the workbench. For more information see \ref org_mitk_gui_qt_dicombrowser .
-
-
-
*/
diff --git a/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_02_Segmenting.dox b/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_02_Segmenting.dox
index ac82cd942d..33ebf61e73 100644
--- a/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_02_Segmenting.dox
+++ b/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_02_Segmenting.dox
@@ -1,19 +1,18 @@
/**
\page org_mitk_views_radiomicstutorial_gui_02_Segmentation GUI based Radiomics Tutorial - Creating a basic Segmentation
+\section Creating a basic Segmentation
-\subsection Creating a basic Segmentation
The first step is to create a new segmentation that can be used to calculate radiomics features. You might skip this step if you already have an segmentation at hand. Ti For this, we load the image we want to process and open the segmentation view. The easiest way to do this is to open the "View Navigator" and search for segmentation. The Segmentation view can then be opened by simply double-clicking on the view in the "View Navigator".
With this view, we will create an One-Level segmentation. It would also be possible to create a multi-label segmentation where more than one structure can be segmented using the MultiLabel segmentation. Howerver, MITK Phenotyping is currently only supporting one Label per mask, so there would be no benefit in doing so. In addition, the created segmentation could be extended further if needed.
-\imageMacro{RadiomicsTutorial_GUI_Step2_01_Preparation.png,"MITK Workbench with open Segmentation View and loaded image. If you want to have the same view, you can go to the position indicated by the 'Image Navigator'",1}
+\imageMacro{RadiomicsTutorial_GUI_Step2_01_Preparation.png,"Segmentation View and loaded image in the MITK Workbench. Go to the position indicated in the Image Navigator for the same view.",1}
To now create a segmentation, we press the "New"-Button in the Data Selection part of the "Segmentation"-View. After giving the segmentation a name and probably selecting a new color if red isn't what we want, we can see a new image in the "Data Manager", the segmentation image. The segmentation can now be edited using the segmentation tools, either slice-by-slice wise or the whole 3D volume using one of the 3D tools. A good description of the different tools and their implication can be found a \ref org_mitk_views_segmentation . The different modes and options are also described there.
We create a simple segmentation of a rib in a few slices, as indiciated by the following picture. At this point, we suggest that you play around to get used to the segmentation tool and then try to roughly reproduce our results. It is not necessary to obtain a one-to-one solution of our segmentation.
\imageMacro{RadiomicsTutorial_GUI_Step2_02_StartSegmentation.png,"Basic segmentation of a rib we created in 6 slices. The color of the segmentation is changed to orange for bone.",1}
-
*/
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_03_Preprocessing.dox b/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_03_Preprocessing.dox
index 33b6af06c5..d715dcd58d 100644
--- a/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_03_Preprocessing.dox
+++ b/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_03_Preprocessing.dox
@@ -1,23 +1,21 @@
/**
\page org_mitk_views_radiomicstutorial_gui_03_preprocessing GUI based Radiomics Tutorial - Preprocessing the data
-\subsection Preprocessing the data
+\section Preprocessing the data
The first step we take is to resample the data. To do so, we open the "Radiomics Transformation" View and select the "Resample Image" panel. We start by resampling the original image and therefore select the original picture (for us, Pic3D). Right-clicking on the image in the "Data Manager" and selecting the option "Details" gives us more information on the image. As we can see, our image has a spacing of [1, 1, 3], with an inplane resolution of 1x1mm and a out-of-plane resolution of 3 mm. We therefore decide to resample the image to an isotropic resolution of 1x1x1 mm.
\imageMacro{RadiomicsTutorial_GUI_Step3_01_DetailView.png,"Details showing the spacing of the original image.",1}
To resample the image, we de-select "Dimension X" and "Dimension Y" option and set the "Dimension Z" option to 1, as indiciated by the image above. This tells the resampling algorithm to change only the last dimension to the value we specified. We further select to have the output image as double and chose B-Spline as resampling algorithm. This is a fast and still accurate option for resampling. To learn more about the other interpolation modes, refer to \ref org_mitk_views_matchpoint_mapper .
After resampling the original image, we also need to resample the segmentation. For this, we select the segmentation, leave the dimensions unchanged. Remove the "Output as double" option, as segmentations are not double values and choose a linear interpolation, which seems to be a better solution for resampling masks. We also check the option that we are resampling a mask.
After performing those two steps, there should be two additional, resampled images in the "Data Manager".
As a second step, we calculate some Laplacian of Gaussian images of the resampled image that allow us to capture more detailed information. For this, we select the panel "Laplacian of Gaussian" of the "Radiomics Transformation"-view and perform the algorithm three times with different sigma values (we chose 1,2, and 4). Make sure that you selected the right image to calculate the image, i.e. the resampled image.
Finally, we clear the mask to obtain a clear segmentation of the target structure and remove possible resampling artifacts. To do so, we open the "Radiomics Mask Processing" View and select the resampled image and the resampled mask. We then select a lower limit only and set it to 160. Since we are working with MR, this is not a fixed value but something we manually determined. With this set, we perform the mask reducing by cklicking "Clean Mask based on Intervall". After this, we have the resampled image, three LoG images and a resampled and cleaned mask. The result should look similar to the next picture. You can also see the final image structure we obtained from our processing. It might help you to compare your results, although it is not necessary to obtain the same structure as long as you have all necessary images.
\imageMacro{RadiomicsTutorial_GUI_Step3_02_FinishedPreprocessing.png,"Final results with a completed resampling",1}
-
-
*/
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_04_FeatureCalculating.dox b/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_04_FeatureCalculating.dox
index 82077815fa..2ac32167bb 100644
--- a/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_04_FeatureCalculating.dox
+++ b/Plugins/org.mitk.gui.qt.radiomics/documentation/doxygen/tutorial_gui/RadiomicsTutorial_GUI_04_FeatureCalculating.dox
@@ -1,44 +1,41 @@
/**
\page org_mitk_views_radiomicstutorial_gui_04_featurecalulation GUI based Radiomics Tutorial - Calculating the Radiomics Features
-\subsection Calculating the Radiomics Features
+\section Calculating the Radiomics Features
The most important step of a radiomic study is the calculating of the features. With MITK Phenotyping this is done using the "Radiomics Statistic" View. Open it using the View Navigator. Within this view, we select the resampled image and the resampled and cleaned mask. In a first step, we select the features we aim to calculate. For this tutorial we chose four features:
\li Volumetric Features
\li First Order Numerics
\li Intensity Volume Histogram
\li Co-occurence Based Features
After selecting the features, we need to configure the features. We start with the "Intenstiy Volume Histogram" Features. Because this Feature class makes an uncommon use of the internal histogram, it makes sense to set the histogram parameter for this feature individually. To do so, click on the "+" next to the feature class name. You should see a list of feature specific parameter. Activate the following parameter and set them to the given parameter:
\li ivoh::minimum 159.5
\li ivoh::maximum 900.5
\li ivoh::binsize 1.0
This configures a histogram that starts from 160 and ranges to 900 with a binsize of 1. Since the minimum and maximum parameter specify the borders of the histogram, we added /subtracted the half of the binsize, so that the middle of the bins will be on a integer.
After this step switch to the "Configuration Parameter" panel. Select the default parameters for the histogram:
\li Minimum Intensity 160
\li Maximum Intensity 900
\li Number of Bins 32
You will recognize that we chose a quite different setting for the histogram this time. Instead of the histogram binsize, we selected the number of bins. Don't forget to activate the features.
As we will calculate multiple features, also activate the "Encode Parameter in Name" option. After this, you can enable the feature calculation by pressing "Execute". You should see the results of the feature calculation process in the table below the configuration list.
We will now calculate the Co-occurence based feature with a different number of bins. For this, change the "Number of Bins" to 64, and deselect all features except the "Co-occurence based Features". In order to keep the previous results, execute the algorithm this time using the button "Execute & Append". The results will be appended to the results shown at the table in the bottom.
Now select a different image and repeat the calculation of the Co-occurence feature with a bin number of 64. Then reselect the "First Order Numberics" and "Intensity Volume Histogram" again and set the number of Bins back to 32. You don't need to recalculate "Volumetric Features" as these features are based on the shape and therefore won't change if only the image is changed.
You will now have a long list of features. To further process these features, press the "Table to Clipboard" button. You can now paste the results in your favourit editor or statistic program and perfom the analysis of the radiomic study.
To give you some ideas how the results look like, here are some results from our experiment. If you used the same image and made a similar mask, you should obtain similar results, although small differences might be based on variations of the segmentation:
-\li Pic3D__Resampled;Bone__Resampled__MaskRange;Co-occurenced Based Features::Min-160_Max-900_Bins-64_Range-1::Mean Sum Average;52.5338
-\li Pic3D__Resampled;Bone__Resampled__MaskRange;Co-occurenced Based Features::Min-160_Max-900_Bins-32_Range-1::Mean Sum Average;26.7659
-\li Pic3D__Resampled__LoG__Sigma-1;Bone__Resampled__MaskRange;Co-occurenced Based Features::Min-160_Max-900_Bins-64_Range-1::Overall Sum Average;2
-\li Pic3D__Resampled__LoG__Sigma-1;Bone__Resampled__MaskRange;Co-occurenced Based Features::Min-160_Max-900_Bins-32_Range-1::Overall Sum Average;2
-\li Pic3D__Resampled;Bone__Resampled__MaskRange;First Order Numeric::Min-160_Max-900_Bins-32::Mean;420.761
-\li Pic3D__Resampled__LoG__Sigma-1;Bone__Resampled__MaskRange;First Order Numeric::Min-160_Max-900_Bins-32::Mean;-137.746
+\li Pic3D__Resampled;Bone__Resampled__MaskRange;Co-occurenced Based Features::Min-160_Max-900_Bins-64_Range-1::%Mean Sum Average;52.5338
+\li Pic3D__Resampled;Bone__Resampled__MaskRange;Co-occurenced Based Features::Min-160_Max-900_Bins-32_Range-1::%Mean Sum Average;26.7659
+\li Pic3D__Resampled__LoG__Sigma-1;Bone__Resampled__MaskRange;Co-occurenced Based Features::Min-160_Max-900_Bins-64_Range-1::%Overall Sum Average;2
+\li Pic3D__Resampled__LoG__Sigma-1;Bone__Resampled__MaskRange;Co-occurenced Based Features::Min-160_Max-900_Bins-32_Range-1::%Overall Sum Average;2
+\li Pic3D__Resampled;Bone__Resampled__MaskRange;First Order Numeric::Min-160_Max-900_Bins-32::%Mean;420.761
+\li Pic3D__Resampled__LoG__Sigma-1;Bone__Resampled__MaskRange;First Order Numeric::Min-160_Max-900_Bins-32::%Mean;-137.746
You can see that the parameters used as well as image used have a clear impact on the final features. You can also see how the name of the image, the mask, and the parameters are encoded so that you are able to reproduce how the results were obtained.
-
-
-
*/
\ No newline at end of file
diff --git a/Plugins/org.mitk.gui.qt.remeshing/CMakeLists.txt b/Plugins/org.mitk.gui.qt.remeshing/CMakeLists.txt
index 0c79a9f4d2..dcfeabfa2f 100644
--- a/Plugins/org.mitk.gui.qt.remeshing/CMakeLists.txt
+++ b/Plugins/org.mitk.gui.qt.remeshing/CMakeLists.txt
@@ -1,10 +1,7 @@
project(org_mitk_gui_qt_remeshing)
-include_directories(${CTK_INCLUDE_DIRS})
-
mitk_create_plugin(
EXPORT_DIRECTIVE REMESHING_EXPORT
EXPORTED_INCLUDE_SUFFIXES src
MODULE_DEPENDS MitkQtWidgets MitkRemeshing
- PACKAGE_DEPENDS Qt5|OpenGL+Xml
)
diff --git a/Plugins/org.mitk.gui.qt.remeshing/documentation/UserManual/QmitkRemeshing.dox b/Plugins/org.mitk.gui.qt.remeshing/documentation/UserManual/QmitkRemeshing.dox
index 884f46b296..c39a3e378e 100644
--- a/Plugins/org.mitk.gui.qt.remeshing/documentation/UserManual/QmitkRemeshing.dox
+++ b/Plugins/org.mitk.gui.qt.remeshing/documentation/UserManual/QmitkRemeshing.dox
@@ -1,19 +1,25 @@
/**
-\page org_mitk_views_remeshing The Remeshing
+\page org_mitk_views_remeshing The Remeshing View
\imageMacro{RemeshingIcon.png,"Icon of the Remeshing Plugin.",2.00}
\tableofcontents
-\section org_mitk_views_remeshingOverview Overview
+\section org_mitk_views_remeshingDecimate Decimate surfaces
-The Remeshing View allows you to remesh surfaces.
-If done right, remeshing can dramatically increase the quality of your surface mesh.
-However, you might lose precision if you reduce the vertex density of your surface mesh too strong.
-Even when you preserve the detail of your mesh, there might be a tiny distance between your original surface and the remeshed surface.
-Hence, be careful when using remeshed surfaces for evaluation purposes and always keep the original versions.
+Decimating surfaces effectively reduces their number of vertices and hence their number of polygons.
+In other words, decimating surfaces coarsens their meshes.
-\section org_mitk_views_remeshingUsage Usage
+Vertices are successively eliminated until the desired relative number of vertices remain.
+During this process, the decimation algorithm tries to keep the spatial difference between original meshes and decimated meshes to a minimum.
-The Remeshing View provides details on its parameters in its user interface. When in doubt, start with the default parameters and iterate to your desired result by reducing the density parameter.
+A surface may consist of multiple meshes in different time steps.
+The decimation is applied to all time steps.
+
+Before the actual decimation, meshes are triangulated, i. e., polygons with more than three edges like quadrilaterals are converted to triangles.
+Lines and points are ignored.
+Resulting meshes are guaranteed to consist of triangles only.
+
+Vertex normals can be optionally (re-)calculated for decimated meshes.
+To decide if you should flip normals, enable the Backface Culling property of the decimated surface in the Properties View - otherwise it is impossible to tell, as by default, both sides of polygons are shaded in MITK.
*/
diff --git a/Plugins/org.mitk.gui.qt.remeshing/files.cmake b/Plugins/org.mitk.gui.qt.remeshing/files.cmake
index ef654235b4..5f5abb5665 100644
--- a/Plugins/org.mitk.gui.qt.remeshing/files.cmake
+++ b/Plugins/org.mitk.gui.qt.remeshing/files.cmake
@@ -1,36 +1,36 @@
set(SRC_CPP_FILES
)
set(INTERNAL_CPP_FILES
- org_mitk_gui_qt_remeshing_Activator.cpp
+ QmitkPluginActivator.cpp
QmitkRemeshingView.cpp
)
set(UI_FILES
src/internal/QmitkRemeshingViewControls.ui
)
set(MOC_H_FILES
- src/internal/org_mitk_gui_qt_remeshing_Activator.h
+ src/internal/QmitkPluginActivator.h
src/internal/QmitkRemeshingView.h
)
set(CACHED_RESOURCE_FILES
resources/RemeshingIcon.svg
plugin.xml
)
set(QRC_FILES
resources/Remeshing.qrc
)
set(CPP_FILES
)
foreach(file ${SRC_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/${file})
endforeach()
foreach(file ${INTERNAL_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/internal/${file})
endforeach()
diff --git a/Plugins/org.mitk.gui.qt.remeshing/src/internal/org_mitk_gui_qt_remeshing_Activator.cpp b/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkPluginActivator.cpp
similarity index 70%
rename from Plugins/org.mitk.gui.qt.remeshing/src/internal/org_mitk_gui_qt_remeshing_Activator.cpp
rename to Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkPluginActivator.cpp
index 80e2706759..44cc9e175b 100644
--- a/Plugins/org.mitk.gui.qt.remeshing/src/internal/org_mitk_gui_qt_remeshing_Activator.cpp
+++ b/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkPluginActivator.cpp
@@ -1,23 +1,23 @@
/*============================================================================
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 "org_mitk_gui_qt_remeshing_Activator.h"
+#include "QmitkPluginActivator.h"
#include "QmitkRemeshingView.h"
-void mitk::org_mitk_gui_qt_remeshing_Activator::start(ctkPluginContext* context)
+void QmitkPluginActivator::start(ctkPluginContext* context)
{
BERRY_REGISTER_EXTENSION_CLASS(QmitkRemeshingView, context);
}
-void mitk::org_mitk_gui_qt_remeshing_Activator::stop(ctkPluginContext*)
+void QmitkPluginActivator::stop(ctkPluginContext*)
{
}
diff --git a/Plugins/org.mitk.gui.qt.remeshing/src/internal/org_mitk_gui_qt_remeshing_Activator.h b/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkPluginActivator.h
similarity index 50%
rename from Plugins/org.mitk.gui.qt.remeshing/src/internal/org_mitk_gui_qt_remeshing_Activator.h
rename to Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkPluginActivator.h
index bde213bb43..eeb34e8cb1 100644
--- a/Plugins/org.mitk.gui.qt.remeshing/src/internal/org_mitk_gui_qt_remeshing_Activator.h
+++ b/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkPluginActivator.h
@@ -1,32 +1,29 @@
/*============================================================================
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 org_mitk_gui_qt_remeshing_Activator_h
-#define org_mitk_gui_qt_remeshing_Activator_h
+#ifndef QmitkPluginActivator_h
+#define QmitkPluginActivator_h
#include <ctkPluginActivator.h>
-namespace mitk
+class QmitkPluginActivator : public QObject, public ctkPluginActivator
{
- class org_mitk_gui_qt_remeshing_Activator : public QObject, public ctkPluginActivator
- {
- Q_OBJECT
- Q_PLUGIN_METADATA(IID "org_mitk_gui_qt_remeshing")
- Q_INTERFACES(ctkPluginActivator)
-
- public:
- void start(ctkPluginContext* context) override;
- void stop(ctkPluginContext* context) override;
- };
-}
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID "org_mitk_gui_qt_remeshing")
+ Q_INTERFACES(ctkPluginActivator)
+
+public:
+ void start(ctkPluginContext* context) override;
+ void stop(ctkPluginContext* context) override;
+};
#endif
diff --git a/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkRemeshingView.cpp b/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkRemeshingView.cpp
index 9e230b5dfc..aef064d831 100644
--- a/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkRemeshingView.cpp
+++ b/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkRemeshingView.cpp
@@ -1,163 +1,123 @@
/*============================================================================
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 "QmitkRemeshingView.h"
+#include <ui_QmitkRemeshingViewControls.h>
+
#include <berryQtStyleManager.h>
-#include <mitkACVD.h>
#include <mitkNodePredicateAnd.h>
#include <mitkNodePredicateDataType.h>
#include <mitkNodePredicateNot.h>
#include <mitkNodePredicateOr.h>
#include <mitkNodePredicateProperty.h>
-#include <mitkSurface.h>
-#include <mitkVtkRepresentationProperty.h>
-
-#include <vtkPolyData.h>
-#include <vtkProperty.h>
+#include <mitkRemeshing.h>
const std::string QmitkRemeshingView::VIEW_ID = "org.mitk.views.remeshing";
QmitkRemeshingView::QmitkRemeshingView()
+ : m_Controls(new Ui::QmitkRemeshingViewControls)
{
}
QmitkRemeshingView::~QmitkRemeshingView()
{
}
void QmitkRemeshingView::CreateQtPartControl(QWidget* parent)
{
- m_Controls.setupUi(parent);
+ m_Controls->setupUi(parent);
- m_Controls.remeshPushButton->setIcon(berry::QtStyleManager::ThemeIcon(QStringLiteral(":/Remeshing/RemeshingIcon.svg")));
+ m_Controls->decimatePushButton->setIcon(berry::QtStyleManager::ThemeIcon(QStringLiteral(":/Remeshing/RemeshingIcon.svg")));
- m_Controls.selectionWidget->SetDataStorage(this->GetDataStorage());
- m_Controls.selectionWidget->SetSelectionIsOptional(true);
- m_Controls.selectionWidget->SetEmptyInfo(QStringLiteral("Select a surface"));
- m_Controls.selectionWidget->SetAutoSelectNewNodes(true);
- m_Controls.selectionWidget->SetNodePredicate(mitk::NodePredicateAnd::New(
+ m_Controls->selectionWidget->SetDataStorage(this->GetDataStorage());
+ m_Controls->selectionWidget->SetSelectionIsOptional(true);
+ m_Controls->selectionWidget->SetEmptyInfo(QStringLiteral("Select a surface"));
+ m_Controls->selectionWidget->SetAutoSelectNewNodes(true);
+ m_Controls->selectionWidget->SetNodePredicate(mitk::NodePredicateAnd::New(
mitk::TNodePredicateDataType<mitk::Surface>::New(),
mitk::NodePredicateNot::New(mitk::NodePredicateOr::New(
mitk::NodePredicateProperty::New("helper object"),
mitk::NodePredicateProperty::New("hidden object")))));
- connect(m_Controls.selectionWidget, &QmitkSingleNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkRemeshingView::OnSelectedSurfaceChanged);
- connect(m_Controls.densitySlider, SIGNAL(valueChanged(int)), this, SLOT(OnDensityChanged(int)));
- connect(m_Controls.densitySpinBox, SIGNAL(valueChanged(int)), this, SLOT(OnDensityChanged(int)));
- connect(m_Controls.remeshPushButton, SIGNAL(clicked()), this, SLOT(OnRemeshButtonClicked()));
+ connect(m_Controls->selectionWidget, &QmitkSingleNodeSelectionWidget::CurrentSelectionChanged, this, &QmitkRemeshingView::OnSurfaceChanged);
+ connect(m_Controls->vertexCountSlider, SIGNAL(valueChanged(int)), this, SLOT(OnVertexCountChanged(int)));
+ connect(m_Controls->vertexCountSpinBox, SIGNAL(valueChanged(int)), this, SLOT(OnVertexCountChanged(int)));
+ connect(m_Controls->calculateNormalsCheckBox, SIGNAL(stateChanged(int)), this, SLOT(OnCalculateNormalsChanged(int)));
+ connect(m_Controls->decimatePushButton, SIGNAL(clicked()), this, SLOT(OnDecimateButtonClicked()));
- this->OnSelectedSurfaceChanged(m_Controls.selectionWidget->GetSelectedNodes());
+ this->OnSurfaceChanged(m_Controls->selectionWidget->GetSelectedNodes());
}
-void QmitkRemeshingView::OnSelectedSurfaceChanged(const QmitkSingleNodeSelectionWidget::NodeList& nodes)
+void QmitkRemeshingView::OnSurfaceChanged(const QmitkSingleNodeSelectionWidget::NodeList& nodes)
{
- if (!nodes.empty() && nodes.front().IsNotNull())
- {
- m_MaxNumberOfVertices = static_cast<int>(static_cast<mitk::Surface*>(nodes.front()->GetData())->GetVtkPolyData()->GetNumberOfPoints());
- this->EnableWidgets(true);
- }
- else
- {
- m_MaxNumberOfVertices = 0;
- this->EnableWidgets(false);
- }
+ this->EnableWidgets(!nodes.empty() && nodes.front().IsNotNull());
}
-void QmitkRemeshingView::OnDensityChanged(int density)
+void QmitkRemeshingView::OnVertexCountChanged(int vertexCount)
{
- if (density != m_Controls.densitySlider->value())
- m_Controls.densitySlider->setValue(density);
+ if (vertexCount != m_Controls->vertexCountSlider->value())
+ m_Controls->vertexCountSlider->setValue(vertexCount);
- if (density != m_Controls.densitySpinBox->value())
- m_Controls.densitySpinBox->setValue(density);
+ if (vertexCount != m_Controls->vertexCountSpinBox->value())
+ m_Controls->vertexCountSpinBox->setValue(vertexCount);
}
-void QmitkRemeshingView::OnRemeshButtonClicked()
+void QmitkRemeshingView::OnCalculateNormalsChanged(int checkState)
{
- mitk::DataNode::Pointer selectedNode = m_Controls.selectionWidget->GetSelectedNode();
- mitk::Surface::ConstPointer surface = static_cast<mitk::Surface*>(selectedNode->GetData());
-
- int density = m_Controls.densitySpinBox->value();
- int numVertices = std::max(100, static_cast<int>(m_MaxNumberOfVertices * (density * 0.01)));
-
- double gradation = m_Controls.remeshingComboBox->currentText() == QStringLiteral("Adaptive")
- ? 1.0
- : 0.0;
-
- const QString quality = m_Controls.qualityComboBox->currentText();
- int subsampling;
-
- if (QStringLiteral("High (slow)") == quality)
- {
- subsampling = 50;
- }
- else if (QStringLiteral("Maximum (very slow)") == quality)
- {
- subsampling = 500;
- }
- else // The default is "Medium (fast)".
- {
- subsampling = 10;
- }
-
- bool boundaryFixing = m_Controls.preserveEdgesCheckBox->isChecked();
+ m_Controls->flipNormalsCheckBox->setEnabled(Qt::Unchecked != checkState);
+}
- mitk::ACVD::RemeshFilter::Pointer remesher = mitk::ACVD::RemeshFilter::New();
- remesher->SetInput(surface);
- remesher->SetTimeStep(0);
- remesher->SetNumVertices(numVertices);
- remesher->SetGradation(gradation);
- remesher->SetSubsampling(subsampling);
- remesher->SetEdgeSplitting(0.0);
- remesher->SetOptimizationLevel(1.0);
- remesher->SetForceManifold(false);
- remesher->SetBoundaryFixing(boundaryFixing);
+void QmitkRemeshingView::OnDecimateButtonClicked()
+{
+ mitk::DataNode::Pointer selectedNode = m_Controls->selectionWidget->GetSelectedNode();
+ mitk::Surface::ConstPointer input = static_cast<mitk::Surface*>(selectedNode->GetData());
+ mitk::Surface::Pointer output;
try
{
- remesher->Update();
+ output = mitk::Remeshing::Decimate(input,
+ 0.01 * m_Controls->vertexCountSpinBox->value(),
+ m_Controls->calculateNormalsCheckBox->isChecked(),
+ m_Controls->flipNormalsCheckBox->isChecked());
}
catch(const mitk::Exception& exception)
{
MITK_ERROR << exception.GetDescription();
return;
}
- mitk::Surface::Pointer remeshedSurface = remesher->GetOutput();
+ if (output.IsNull())
+ return;
- mitk::DataNode::Pointer newNode = mitk::DataNode::New();
- newNode->SetName(QString("%1 (%2%)").arg(selectedNode->GetName().c_str()).arg(density).toStdString());
- newNode->SetProperty("material.representation", mitk::VtkRepresentationProperty::New(VTK_WIREFRAME));
- newNode->SetData(remeshedSurface);
+ auto newNode = mitk::DataNode::New();
+ newNode->SetName(QString("%1 (decimated)").arg(selectedNode->GetName().c_str()).toStdString());
+ newNode->SetData(output);
this->GetDataStorage()->Add(newNode, selectedNode);
}
void QmitkRemeshingView::EnableWidgets(bool enable)
{
- m_Controls.densitySlider->setEnabled(enable);
- m_Controls.densitySpinBox->setEnabled(enable);
- m_Controls.remeshingComboBox->setEnabled(enable);
- m_Controls.qualityComboBox->setEnabled(enable);
- m_Controls.preserveEdgesCheckBox->setEnabled(enable);
- m_Controls.remeshPushButton->setEnabled(enable);
-
- m_Controls.explanationLabel->setVisible(enable);
+ m_Controls->vertexCountSlider->setEnabled(enable);
+ m_Controls->vertexCountSpinBox->setEnabled(enable);
+ m_Controls->calculateNormalsCheckBox->setEnabled(enable);
+ m_Controls->flipNormalsCheckBox->setEnabled(enable && m_Controls->calculateNormalsCheckBox->isChecked());
+ m_Controls->decimatePushButton->setEnabled(enable);
}
void QmitkRemeshingView::SetFocus()
{
- m_Controls.selectionWidget->setFocus();
+ m_Controls->selectionWidget->setFocus();
}
diff --git a/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkRemeshingView.h b/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkRemeshingView.h
index 33b384f4d6..e0f5b99b83 100644
--- a/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkRemeshingView.h
+++ b/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkRemeshingView.h
@@ -1,45 +1,49 @@
/*============================================================================
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 QmitkRemeshingView_h
#define QmitkRemeshingView_h
#include <QmitkAbstractView.h>
#include <QmitkSingleNodeSelectionWidget.h>
-#include <ui_QmitkRemeshingViewControls.h>
+
+namespace Ui
+{
+ class QmitkRemeshingViewControls;
+}
class QmitkRemeshingView : public QmitkAbstractView
{
Q_OBJECT
public:
static const std::string VIEW_ID;
QmitkRemeshingView();
~QmitkRemeshingView() override;
void CreateQtPartControl(QWidget* parent) override;
void SetFocus() override;
private slots:
- void OnSelectedSurfaceChanged(const QmitkSingleNodeSelectionWidget::NodeList& nodes);
- void OnDensityChanged(int numVertices);
- void OnRemeshButtonClicked();
+ void OnSurfaceChanged(const QmitkSingleNodeSelectionWidget::NodeList& nodes);
+ void OnVertexCountChanged(int vertexCount);
+ void OnCalculateNormalsChanged(int checkState);
+ void OnDecimateButtonClicked();
private:
void EnableWidgets(bool enable);
- Ui::QmitkRemeshingViewControls m_Controls;
- int m_MaxNumberOfVertices;
+ Ui::QmitkRemeshingViewControls* m_Controls;
};
#endif
diff --git a/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkRemeshingViewControls.ui b/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkRemeshingViewControls.ui
index 105b8e2ba4..78a31dde92 100644
--- a/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkRemeshingViewControls.ui
+++ b/Plugins/org.mitk.gui.qt.remeshing/src/internal/QmitkRemeshingViewControls.ui
@@ -1,244 +1,172 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QmitkRemeshingViewControls</class>
<widget class="QWidget" name="QmitkRemeshingViewControls">
<property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>253</width>
<height>573</height>
</rect>
</property>
<property name="windowTitle">
<string>Remeshing</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="surfaceLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Surface</string>
</property>
</widget>
</item>
- <item row="0" column="1" colspan="2">
- <widget class="QmitkSingleNodeSelectionWidget" name="selectionWidget" native="true">
- <property name="minimumSize">
- <size>
- <width>0</width>
- <height>40</height>
- </size>
+ <item row="3" column="1" colspan="2">
+ <widget class="QCheckBox" name="flipNormalsCheckBox">
+ <property name="text">
+ <string>Flip normals</string>
</property>
</widget>
</item>
<item row="1" column="0">
- <widget class="QLabel" name="densityLabel">
+ <widget class="QLabel" name="vertexCountLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
- <string>Density</string>
+ <string>Vertex count</string>
</property>
</widget>
</item>
<item row="1" column="1">
- <widget class="QSlider" name="densitySlider">
+ <widget class="QSlider" name="vertexCountSlider">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="pageStep">
<number>10</number>
</property>
<property name="value">
- <number>100</number>
+ <number>50</number>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
+ <item row="0" column="1" colspan="2">
+ <widget class="QmitkSingleNodeSelectionWidget" name="selectionWidget" native="true">
+ <property name="minimumSize">
+ <size>
+ <width>0</width>
+ <height>40</height>
+ </size>
+ </property>
+ </widget>
+ </item>
<item row="1" column="2">
- <widget class="QSpinBox" name="densitySpinBox">
+ <widget class="QSpinBox" name="vertexCountSpinBox">
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>100</number>
</property>
<property name="singleStep">
<number>1</number>
</property>
<property name="value">
- <number>100</number>
- </property>
- </widget>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="remeshingLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Remeshing</string>
+ <number>50</number>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
- <widget class="QComboBox" name="remeshingComboBox">
- <item>
- <property name="text">
- <string>Adaptive</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Regular</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="qualityLabel">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
+ <widget class="QCheckBox" name="calculateNormalsCheckBox">
<property name="text">
- <string>Quality</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1" colspan="2">
- <widget class="QComboBox" name="qualityComboBox">
- <property name="currentIndex">
- <number>0</number>
- </property>
- <item>
- <property name="text">
- <string>Medium (fast)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>High (slow)</string>
- </property>
- </item>
- <item>
- <property name="text">
- <string>Maximum (very slow)</string>
- </property>
- </item>
- </widget>
- </item>
- <item row="4" column="1" colspan="2">
- <widget class="QCheckBox" name="preserveEdgesCheckBox">
- <property name="sizePolicy">
- <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="text">
- <string>Preserve Edges</string>
+ <string>Calculate normals</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</item>
<item>
- <widget class="QPushButton" name="remeshPushButton">
+ <widget class="QPushButton" name="decimatePushButton">
<property name="enabled">
<bool>true</bool>
</property>
<property name="text">
- <string>Remesh</string>
+ <string>Decimate</string>
</property>
<property name="icon">
<iconset resource="../../resources/Remeshing.qrc">
<normaloff>:/Remeshing/RemeshingIcon.svg</normaloff>:/Remeshing/RemeshingIcon.svg</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
- <item>
- <widget class="QLabel" name="explanationLabel">
- <property name="text">
- <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Density:&lt;/span&gt; The density of the resulting surface compared to the input surface. For example, a density of 50% will effectively halve the number of vertices. It's not uncommen to choose values as low as 10% for overly dense input surfaces. The minimum number of output vertices is at least 100, though.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Remeshing:&lt;/span&gt; Adaptive remeshing results in higher density in curvy areas and less density in flat areas. This remeshing strategy can preserve fine shape details even when the overall density is heavily reduced. Regular remeshing evenly distributes the density regardless of the local shape of the surface.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Quality&lt;/span&gt;: While medium quality is sufficient for the vast majority of use cases, you can increase this setting to further optimize the mesh quality in terms of uniformly shaped triangles. However, computation time and memory consumption increase dramatically compared to very small improvements.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Preserve Edges:&lt;/span&gt; If the input surface contains holes or edges, they will be preserved very accurately by default at the cost of less uniform triangles at their direct neighborhood.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
- </property>
- <property name="wordWrap">
- <bool>true</bool>
- </property>
- </widget>
- </item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QmitkSingleNodeSelectionWidget</class>
<extends>QWidget</extends>
<header location="global">QmitkSingleNodeSelectionWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
- <tabstop>densitySpinBox</tabstop>
- <tabstop>preserveEdgesCheckBox</tabstop>
- <tabstop>remeshPushButton</tabstop>
+ <tabstop>vertexCountSpinBox</tabstop>
+ <tabstop>decimatePushButton</tabstop>
</tabstops>
<resources>
<include location="../../resources/Remeshing.qrc"/>
</resources>
<connections/>
</ui>
diff --git a/Plugins/org.mitk.gui.qt.remeshing/target_libraries.cmake b/Plugins/org.mitk.gui.qt.remeshing/target_libraries.cmake
deleted file mode 100644
index 6c71bbbf08..0000000000
--- a/Plugins/org.mitk.gui.qt.remeshing/target_libraries.cmake
+++ /dev/null
@@ -1,3 +0,0 @@
-set(target_libraries
- CTKWidgets
-)
diff --git a/Plugins/org.mitk.gui.qt.renderwindowmanager/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.renderwindowmanager/documentation/UserManual/Manual.dox
deleted file mode 100644
index 62b08443be..0000000000
--- a/Plugins/org.mitk.gui.qt.renderwindowmanager/documentation/UserManual/Manual.dox
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
-\page org_mitk_gui_qt_renderwindowmanager The Renderwindowmanager
-
-\imageMacro{icon.png,"Icon of Renderwindowmanager",2.00}
-
-\tableofcontents
-
-\section org_mitk_gui_qt_renderwindowmanagerOverview Overview
-Describe the features of your awesome plugin here
-<ul>
-<li>Increases productivity
-<li>Creates beautiful images
-<li>Generates PhD thesis
-<li>Brings world peace
-</ul>
-
-*/
diff --git a/Plugins/org.mitk.gui.qt.renderwindowmanager/documentation/UserManual/icon.xpm b/Plugins/org.mitk.gui.qt.renderwindowmanager/documentation/UserManual/icon.xpm
deleted file mode 100644
index 9057c20bc6..0000000000
--- a/Plugins/org.mitk.gui.qt.renderwindowmanager/documentation/UserManual/icon.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static const char * icon_xpm[] = {
-"16 16 2 1",
-" c #FF0000",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/Plugins/org.mitk.gui.qt.renderwindowmanager/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.renderwindowmanager/documentation/doxygen/modules.dox
deleted file mode 100644
index be02fac9a8..0000000000
--- a/Plugins/org.mitk.gui.qt.renderwindowmanager/documentation/doxygen/modules.dox
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- \defgroup org_mitk_gui_qt_renderwindowmanager org.mitk.gui.qt.renderwindowmanager
- \ingroup MITKPlugins
-
- \brief Describe your plugin here.
-
-*/
-
-/**
- \defgroup org_mitk_gui_qt_renderwindowmanager_internal Internal
- \ingroup org_mitk_gui_qt_renderwindowmanager
-
- \brief This subcategory includes the internal classes of the org.mitk.gui.qt.renderwindowmanager plugin. Other
- plugins must not rely on these classes. They contain implementation details and their interface
- may change at any time. We mean it.
-*/
diff --git a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation.dox b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation.dox
index 771ab561da..ea04956862 100644
--- a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation.dox
+++ b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation.dox
@@ -1,299 +1,299 @@
/**
\page org_mitk_views_segmentation The Segmentation View
-\imageMacro{segmentation.svg,"Icon of the segmentation view",2.00}
+\imageMacro{segmentation-dox.svg,"Icon of the segmentation view",2.00}
<i>Some of the features described below are closed source additions to the open source toolkit MITK and are not available in every application.</i>
\tableofcontents
\section org_mitk_views_segmentationUserManualOverview Overview
Segmentation is the act of partitioning an image into subsets by either manual or automated delineation to create i.e. a distinction between foreground and background.
The MITK <b>segmentation plugin</b> allows you to create segmentations of anatomical and pathological structures in medical images.
The plugin consists of a number of views:
<ul>
<li> <b>Segmentation View</b>: Manual and (semi-)automatic segmentation
<li> \subpage org_mitk_views_segmentationutilities : Segmentation post-processing
</ul>
In this documentation, the features and usage of the segmentation view will be described.
For an introduction to the segmentation utilities and clipping plane views, please be referred to the respective documentation pages.
\imageMacro{QmitkSegmentationPlugin_Overview.png,"Segmentation plugin overview", 16.00}
\section org_mitk_views_segmentationPreferences Preferences
The segmentation plugin offers a number of preferences which can be set via the MITK Workbench application preferences:
\imageMacro{QmitkSegmentationPreferences.png,"Segmentation preferences", 10.00}
<ul>
<li> <b>Slim view:</b> Allows you to show or hide the tool button description of the segmentation view
<li> <b>2D display:</b> Specify whether the segmentation is drawn as outline or as a transparent overlay
<li> <b>3D display:</b> Activate 3D volume rendering for your segmentation
<li> <b>Data node selection mode:</b> If activated the segmentation image is automatically chosen from the data manager selection.
<li> <b>Smoothed surface creation:</b> Set certain smoothing parameters for surface creation
</ul>
\section org_mitk_views_segmentationUserManualTechnical Technical Issues
The segmentation plugin makes a number of assumptions:
<ul>
<li> Images must be 2D, 3D, or 3D+t.
<li> Images must be single-values, i.e. CT, MRI or "normal" ultrasound. Images from color doppler or photographic (RGB) images are only partially supported (please be aware that some tools might not be compatible with this image type).
<li> Segmentations are handled as binary images of the same extent as the original image.
</ul>
\section org_mitk_views_segmentationUserManualImageSelection Data Selection & Creating New Segmentations
To select a reference image for the segmentation, click on the <i>Patient Image</i> selection widget and choose a suitable image from the selection available in the data manager.
By default the auto selection mode is enabled (see \ref org_mitk_views_segmentationPreferences).\n
Once a patient image is selected, a new segmentation can be created on this reference image by clicking the <i>New...</i> button to the right of the <i>Segmentation</i> selection widget.
An input field will appear which allows you to set the name and display color of the segmentation. Notice that the input field suggests names once you start typing and that it also suggests colors for known organ names.
Once generated the segmentation will be added with "binary mask" icon to the data manager as sub-node of the reference image. This item is automatically selected for you, allowing you to start editing the new segmentation right away.
\subsection org_mitk_views_segmentationUserManualManualKringeling2 Selecting Segmentations for Editing
Alternatively to creating a new segmentation, an existing one can be edited as well.
As you might have segmented multiple structures within a single image, the application needs to know which of them to use for editing.
For that you click the segmentation selection widget and a selection field will open, containing all suitable segmentations for the parent dataset available in the data manager.
\section org_mitk_views_segmentationUserManualToolOverview Segmentation Tool Overview
MITK offers a comprehensive set of slice-based 2D and (semi-)automated 3D segmentation tools.
The manual 2D tools require some user interaction and can only be applied to a single image slice whereas the 3D tools operate on the whole image. The 3D tools usually only
require a small amount of user interaction, i.e. placing seed points or setting/adjusting parameters.
You can switch between the different toolsets by selecting the 2D or 3D tab in the segmentation view.
\imageMacro{QmitkSegmentation_ToolOverview.png,"An overview of the existing 2D and 3D tools in MITK.",5.50}
\section org_mitk_views_segmentationUserManualManualKringeling 2D Segmentation Tools
With 2D manual contouring you define which voxels are part of the segmentation and which ones are not. This allows you to create segmentations of any structures of interest in an image.
You can also use manual contouring to correct segmentations that result from sub-optimal automatic methods.
The drawback of manual contouring is that you might need to define contours on many 2D slices. However, this is mitigated by the interpolation feature, which will make suggestions for a segmentation.
\subsection org_mitk_views_segmentationUserManualManualKringeling3 Selecting Editing Tools
To start using one of the editing tools, click its button from the displayed toolbox.
The selected editing tool will be active and its corresponding button will stay pressed until you click the button again.
Selecting a different tool also deactivates the previous one.\n
If you have to delineate a lot of images, shortcuts to switch between tools becomes convenient. For that, just hit the first letter of each tool to activate it (A for Add, S for Subtract, etc.).
\subsection org_mitk_views_segmentationUserManualManualKringeling4 Using Editing Tools
All of the editing tools work by the same principle: you use the mouse (left button) to click anywhere in a 2D window (any of the orientations axial, sagittal, or coronal),
move the mouse while holding the mouse button and release to finish the editing action.
Multi-step undo and redo is fully supported by all editing tools. Use the application-wide undo button in the toolbar to revert erroneous %actions.
<i>Remark</i>: If you are familiar with the MITK Workbench, you know that clicking and moving the mouse in any of the 2D render windows will move around the crosshair that defines what part of the image is displayed.
This behavior is disabled whilst any of the manual segmentation tools are active- otherwise you might have a hard time concentrating on the contour you are drawing.
\subsection org_mitk_views_segmentationUserManualAddSubtractTools Add and Subtract Tools
\imageMacro{QmitkSegmentation_IMGIconAddSubtract.png,"Add and Subtract Tools",7.70}
Use the left mouse button to draw a closed contour. When releasing the mouse button, the contour will be added (Add tool) to or removed (Subtract tool) from the current segmentation.
Adding and subtracting voxels can be iteratively repeated for the same segmentation. Holding CTRL / CMD while drawing will invert the current tool's behavior (i.e. instead of adding voxels, they will be subtracted).
\subsection org_mitk_views_segmentationUserManualPaintWipeTools Paint and Wipe Tools
\imageMacro{QmitkSegmentation_IMGIconPaintWipe.png,"Paint and Wipe Tools",7.68}
Use the <i>Size</i> slider to change the radius of the round paintbrush tool. Move the mouse in any 2D window and press the left button to draw or erase pixels.
Holding CTRL / CMD while drawing will invert the current tool's behavior (i.e. instead of painting voxels, they will be wiped).
\subsection org_mitk_views_segmentationUserManualRegionGrowingTool Region Growing Tool
\imageMacro{QmitkSegmentation_IMGIconRegionGrowing.png,"Region Growing Tool",3.81}
Click at one point in a 2D slice widget to add an image region to the segmentation with the region growing tool.
Region Growing selects all pixels around the mouse cursor that have a similar gray value as the pixel below the mouse cursor. This enables you to quickly create segmentations of structures that have a good contrast to surrounding tissue.
The tool operates based on the current level window, so changing the level window to optimize the contrast for the ROI is encouraged.
Moving the mouse up/down is different from left/right: Moving up the cursor while holding the left mouse button widens the range for the included grey values; moving it down narrows it. Moving the mouse left and right will shift the range.
The tool will select more or less pixels, corresponding to the changing gray value range.
\if THISISNOTIMPLEMENTEDATTHEMOMENT
A common issue with region growing is the so called "leakage" which happens when the structure of interest is connected to other pixels, of similar gray values, through a narrow "bridge" at the border of the structure.
The Region Growing tool comes with a "leakage detection/removal" feature. If leakage happens, you can left-click into the leakage region and the tool will try to automatically remove this region (see illustration below).
\imageMacro{QmitkSegmentation_IMGLeakage.png,"Leakage correction feature of the Region Growing tool",11.28}
\endif
\subsection org_mitk_views_segmentationUserManualCorrectionTool Correction Tool
<br>
\imageMacro{QmitkSegmentation_IMGIconCorrection.png,"Correction Tool",3.77}
You do not have to draw a closed contour to use the Correction tool and do not need to switch between the Add and Substract tool to perform
small corrective changes. The following figure shows the usage of this tool:
<ul>
<li> a) If the user draws a line which %starts and ends outside the segmenation a part of it is cut off.
<li> b) If the line is drawn fully inside the segmentation the marked region is added to the segmentation.
</ul>
\imageMacro{QmitkSegmentation_IMGCorrectionActions.png,"Usage of the Correction tool.",13.50}
<br>
\subsection org_mitk_views_segmentationUserManualFillTool Fill Tool
\imageMacro{QmitkSegmentation_IMGIconFill.png,"Fill Tool",3.81}
Left-click inside a segmentation with holes to completely fill all holes. Left-click inside a hole to fill only this specific hole.
\subsection org_mitk_views_segmentationUserManualEraseTool Erase Tool
\imageMacro{QmitkSegmentation_IMGIconErase.png,"Erase Tool",3.79}
This tool removes a connected part of pixels that form a segmentation. You may use it to remove single segmentations (left-click on specific segmentation) or to clear a whole slice at once (left-click outside a segmentation).
\subsection org_mitk_views_segmentationUserManualLiveWireTool Live Wire Tool
\imageMacro{QmitkSegmentation_IMGIconLiveWire.png,"Live Wire Tool",3.01}
The Live Wire Tool acts as a magnetic lasso with a contour snapping to edges of objects.
\imageMacro{QmitkSegmentation_IMGLiveWireUsage.PNG,"Steps for using the Live Wire Tool",16.00}
<ul>
<li>(1) To start the tool you have to double-click near the edge of the object you want to segment. The initial anchor point will snap to the edge within a 3x3 region.
<li>(2) Move the mouse. You don't have trace the edge of the object. The contour will automatically snap to it.
<li>(3) To fix a segment you can set anchor points by single left mouse button click.
<li>(4) Go on with moving the mouse and setting anchor points.
<li>(5) To close the contour double-click on the initial anchor point.
<li>(6) After closing, the contour can be edited by moving, inserting and deleting anchor points.
</ul>
The contour will be transferred to its binary image representation by deactivating the tool.
\subsection org_mitk_views_segmentationUserManual2DFastMarchingTool 2D Fast Marching Tool
\imageMacro{QmitkSegmentation_IMG2DFastMarchingUsage.png,"2D Fast Marching Tool",3.01}
Provides a fast marching based 2D interaction segmentation tool. You start with setting seed points in an image slice. Via several sliders you can adapt parameters and see the fast marching result instantly.
\subsection org_mitk_views_segmentationUserManualManualKringeling5 2D and 3D Interpolation
Creating segmentations using 2D manual contouring for large image volumes may be very time-consuming, because structures of interest may cover a large range of slices.
The segmentation view offers two helpful features to mitigate this drawback:
<ul>
<li> 2D Interpolation
<li> 3D Interpolation
</ul>
The <b>2D Interpolation</b> creates suggestions for a segmentation whenever you have a slice that
<ul>
<li> has got neighboring slices with segmentations (these do not need to be direct neighbors but could also be a couple of slices away) AND
<li> is completely clear of a manual segmentation, i.e. there will be no suggestion if there is even only a single pixel of segmentation in the current slice.
</ul>
\imageMacro{QmitkSegmentation_2DInterpolation.png,"2D Interpolation Usage",3.01}
Interpolated suggestions are displayed as outlines, until you confirm them as part of the segmentation.
To confirm single slices, click the <i>Confirm for single slice</i> button below the toolbox. You may also review the interpolations visually and then accept all of them at once by selecting <i>Confirm for all slices</i>.
The <b>3D interpolation</b> creates suggestions for 3D segmentations. That means if you start contouring, from the second contour onwards, the surface of the segmented area will be interpolated based on the given contour information.
The interpolation works with all available manual tools. Please note that this is currently a pure mathematical interpolation, i.e. image intensity information is not taken into account.
With each further contour the interpolation result will be improved, but the more contours you provide the longer the recalculation will take.
To achieve an optimal interpolation result and in this way a most accurate segmentation you should try to describe the surface with sparse contours by segmenting in arbitrary
oriented planes. The 3D interpolation is not meant to be used for parallel slice-wise segmentation, but rather segmentations in i.e. the axial, coronal and sagittal plane.
\imageMacro{QmitkSegmentation_3DInterpolationWrongRight.png,"3D Interpolation Usage",16.00}
You can accept the interpolation result by clicking the <i>Confirm</i>-button below the tool buttons.
In this case the 3D interpolation will be deactivated automatically so that the result can be post-processed without any interpolation running in the background.
Additional to the surface, black contours are shown in the 3D render window, which mark all the drawn contours used for the interpolation.
You can navigate between the drawn contours by clicking on the corresponding <i>position</i> nodes in the data manager which are stored as sub-nodes of the selected segmentation.
If you do not want to see these nodes just uncheck the <i>Show Position Nodes</i> checkbox and these nodes will be hidden.
If you want to delete a drawn contour we recommend to use the Erase-Tool since Redo/Undo is not yet working for 3D interpolation.
The current state of the 3D interpolation can be saved across application restart. For that, just click on save project during the interpolation is active.
After restarting the application and load your project you can click on "Reinit Interpolation" within the 3D interpolation GUI area.
\section org_mitk_views_segmentationUserManual3DSegmentationTools 3D Segmentation Tools
The 3D tools operate on the whole image and require usually a small amount of interaction like placing seed-points or specifying certain parameters. All 3D tools provide
an immediate segmentation feedback, which is displayed as a transparent green overlay. For accepting a preview you have to press the <i>Confirm</i> button of the selected tool.
The following 3D tools are available:
\subsection org_mitk_views_segmentationUserManual3DThresholdTool 3D Threshold Tool
The thresholding tool simply applies a 3D threshold to the patient image. All pixels with values equal or above the selected threshold are labeled as part of the segmentation.
You can change the threshold by either moving the slider of setting a certain value in the spinbox.
\imageMacro{QmitkSegmentation_3DThresholdTool.png,"3D Threshold tool",10.00}
\subsection org_mitk_views_segmentationUserManual3DULTool 3D Upper/Lower Threshold Tool
The Upper/Lower Thresholding tool works similar to the simple 3D threshold tool but allows you to define an upper and lower threshold. All pixels with
values within this threshold interval will be labeled as part of the segmentation.
\imageMacro{QmitkSegmentation_3DULThresholdTool.png,"3D Upper/Lower Threshold tool",10.00}
\subsection org_mitk_views_segmentationUserManual3DOtsuTool 3D Otsu Tool
The 3D Otsu tool provides a more sophisticated thresholding algorithm. It allows you to define a number of regions. Based on the image histogram the pixels will
then be divided into different regions. The more regions you define the longer the calculation will take. You can select afterwards which of these regions you want to confirm as segmentation.
\imageMacro{QmitkSegmentation_3DOtsuTool.png,"3D Otsu tool",10.00}
\subsection org_mitk_views_segmentationUserManual3DFMTool 3D Fast Marching Tool
The 3D Fast Marching tool works similar to the 2D pendant but on the whole image. Depending on your image size the calculation might take some time.
You can interactively set the parameters of the algorithm via the GUI. The resulting segmentation will be automatically updated.
\imageMacro{QmitkSegmentation_3DFMTool.png,"3D Fast Marching tool",10.00}
\subsection org_mitk_views_segmentationUserManual3DRGTool 3D Region Growing Tool
The 3D Region Growing tool works similar to the 2D pendant. At the beginning you have to place a seedpoint and define a threshold interval. If you press
<i>Run Segmentation</i> a preview is calculated. By moving the <i>Adapt region growing</i> slider you can interactively adapt the segmentation result.
\imageMacro{QmitkSegmentation_3DRGTool.png,"3D Region Growing tool",10.00}
\subsection org_mitk_views_segmentationUserManual3DWatershedTool 3D Watershed Tool
This tool provides a watershed based segmentation algorithm. For a detailed explanation of the parameters level and threshold, please be referred to https://itk.org/Doxygen/html/classitk_1_1WatershedImageFilter.html .
Remark: The tool is (due to its implementation) faster if you use lower levels. So in doubt you should start with high levels (supposed to undersegment) and then lower the levels until you are happy.
\imageMacro{QmitkSegmentation_3DWatershedTool.png,"3D Watershed tool",10.00}
\subsection org_mitk_views_segmentationUserManualPickingTool Picking Tool
The Picking tool allows you to select islands within your segmentation. This is especially useful if e.g. a thresholding provided you with several areas within
your image but you are just interested in one special region.
\imageMacro{QmitkSegmentation_PickingTool.png,"Picking tool",10.00}
\section org_mitk_views_segmentationUserManualPostprocessing Additional things you can do with segmentations
Segmentations are never an end in themselves. Consequently, the segmentation view adds a couple of "post-processing" actions, accessible through the context-menu of the data manager.
\imageMacro{QmitkSegmentation_IMGDataManagerContextMenu.png,"Context menu items for segmentations.",10.58}
<ul>
<li> <b>Create polygon %model</b> applies the marching cubes algorithm to the segmentation. This polygon %model can be used for visualization in 3D or other applications such as stereolithography (3D printing).
<li> <b>Create smoothed polygon %model</b> uses smoothing in addition to the marching cubes algorithm, which creates models that do not follow the exact outlines of the segmentation, but look smoother.
<li> <b>Autocrop</b> can save memory. Manual segmentations have the same extent as the patient image, even if the segmentation comprises only a small sub-volume. This invisible and meaningless margin is removed by autocropping.
</ul>
\section org_mitk_views_segmentationof3DTImages Segmentation of 3D+t images
For segmentation of 3D+t images, some tools give you the option to choose between creating dynamic and static masks.
<ul>
<li> Dynamic masks can be created on each time frame individually.
<li> Static masks will be defined on one time frame and will be the same for all other time frames.
</ul>
In general, segmentation is applied on the time frame that is selected when execution is performed. If you alter the time frame, the segmentation preview is adapted.
\section org_mitk_views_segmentationUserManualTechnicalDetail Technical Information for Developers
For technical specifications see \subpage QmitkSegmentationTechnicalPage and for information on the extensions of the tools system \subpage toolextensions .
*/
diff --git a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentationPreferences.tiff b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentationPreferences.tiff
deleted file mode 100644
index 7659e33ad7..0000000000
Binary files a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentationPreferences.tiff and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentationUtilities.dox b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentationUtilities.dox
index 2355581d0b..0d9b10b310 100644
--- a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentationUtilities.dox
+++ b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentationUtilities.dox
@@ -1,80 +1,80 @@
/**
\page org_mitk_views_segmentationutilities The Segmentation Utilities View
-\imageMacro{segmentation_utilities.svg,"Icon of the Segmentation Utilities View",5.00}
+\imageMacro{segmentation_utilities-dox.svg,"Icon of the Segmentation Utilities View",5.00}
\imageMacro{QmitkSegmentationUtilities_Overview.png,"The Segmentation Utilities View",16.00}
\tableofcontents
\section org_mitk_views_segmentationUtilitiesManualOverview Overview
The <b>Segmentation Utilities View</b> allows to postprocess existing segmentations. Currently five different operations exist:
<ul>
<li> \ref org_mitk_views_segmentationUtilitiesBooleanOperations
<li> \ref org_mitk_views_segmentationUtilitiesContourToImage
<li> \ref org_mitk_views_segmentationUtilitiesImageMasking
<li> \ref org_mitk_views_segmentationUtilitiesMorphologicalOperations
<li> \ref org_mitk_views_segmentationUtilitiesSurfaceToImage
</ul>
\section org_mitk_views_segmentationUtilitiesDataSelection Data Selection
All postprocessing operations provide one or more selection widgets, which allow to select the data for the operation.
\section org_mitk_views_segmentationUtilitiesBooleanOperations Boolean operations
Boolean operations allows to perform the following fundamental operations on two segmentations:
<ul>
<li> <b>Difference:</b> Subtracts the second segmentation from the first segmentation.
<li> <b>Intersection:</b> Extracts the overlapping areas of the two selected segmentations.
<li> <b>Union:</b> Combines the two existing segmentations.
</ul>
The selected segmentations must have the same geometry (size, spacing, ...) in order for the operations to work correctly.
The result will be stored in a new data node as a child node of the first selected segmentation.
\imageMacro{QmitkSegmentationUtilities_BooleanOperations.png,"Boolean operations",6.00}
\section org_mitk_views_segmentationUtilitiesContourToImage Contour to image
Contour to image allows to create a segmentation out of a given contour-model.
The operation requires a contour model set and a reference image.
The created segmentation image will have the same geometrical properties like the reference image (dimension, size and Geometry3D).
\imageMacro{QmitkSegmentationUtilities_ContourToImage.png,"Contour to image",6.00}
\section org_mitk_views_segmentationUtilitiesImageMasking Image masking
Image masking allows to mask an image with either an existing segmentation or a surface.
The operation requires an image and a binary image mask or a surface.
The result will be an image containing only the pixels that are covered by the respective mask.
\imageMacro{QmitkSegmentationUtilities_ImageMasking.png,"Image masking",6.00}
\section org_mitk_views_segmentationUtilitiesMorphologicalOperations Morphological operations
Morphological operations are applied to a single segmentation image. Based on a given structuring element the underlying segmentation will be modfied.
The plugin provides a <b>ball</b> and a <b>cross</b> as structuring elements. The follow operations are available:
<ul>
<li> <b>Dilation:</b> Each labeled pixel within the segmentation will be dilated based on the selected structuring element.
<li> <b>Erosion:</b> Each labeled pixel within the segmentation will be eroded based on the selected structuring element.
<li> <b>Opening:</b> A dilation followed by an erosion, used for smoothing edges or eliminating small objects.
<li> <b>Closing:</b> An erosion followed by an dilation, used for filling small holes.
<li> <b>Fill Holes:</b> Fills bigger holes within a segmentation.
</ul>
\imageMacro{QmitkSegmentationUtilities_MorphologicalOperations.png,"Morphological operations",6.00}
\section org_mitk_views_segmentationUtilitiesSurfaceToImage Surface to image
Surface to image allows to create a segmentation out of a given surface.
The operation requires a surface and a reference image.
The created segmentation image will have the same geometrical properties like the reference image (dimension, size and Geometry3D).
\imageMacro{QmitkSegmentationUtilities_SurfaceToImage.png,"Surface to image",6.00}
**/
diff --git a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_3DTools.png b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_3DTools.png
deleted file mode 100644
index 52551edad8..0000000000
Binary files a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_3DTools.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_FromSurfaceAfter.png b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_FromSurfaceAfter.png
deleted file mode 100644
index 9c840864e5..0000000000
Binary files a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_FromSurfaceAfter.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_FromSurfaceBefore.png b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_FromSurfaceBefore.png
deleted file mode 100644
index 92600569e5..0000000000
Binary files a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_FromSurfaceBefore.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGApplication.png b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGApplication.png
deleted file mode 100644
index 3fbfad5228..0000000000
Binary files a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGApplication.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGCorrectionActionsx.png b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGCorrectionActionsx.png
deleted file mode 100644
index 648dc52668..0000000000
Binary files a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGCorrectionActionsx.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGDatamanagerview.png b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGDatamanagerview.png
deleted file mode 100644
index 7f33eb723e..0000000000
Binary files a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGDatamanagerview.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGPreferences.png b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGPreferences.png
deleted file mode 100644
index ef8d4b7a63..0000000000
Binary files a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_IMGPreferences.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_Icon.png b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_Icon.png
deleted file mode 100644
index 3ebadd306f..0000000000
Binary files a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/QmitkSegmentation_Icon.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/segmentation.svg b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/segmentation-dox.svg
similarity index 100%
rename from Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/segmentation.svg
rename to Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/segmentation-dox.svg
diff --git a/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/segmentation_utilities.svg b/Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/segmentation_utilities-dox.svg
similarity index 100%
rename from Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/segmentation_utilities.svg
rename to Plugins/org.mitk.gui.qt.segmentation/documentation/UserManual/segmentation_utilities-dox.svg
diff --git a/Plugins/org.mitk.gui.qt.spectrocamrecorder/documentation/UserManual/Manual.dox b/Plugins/org.mitk.gui.qt.spectrocamrecorder/documentation/UserManual/Manual.dox
deleted file mode 100644
index 994c6468d9..0000000000
--- a/Plugins/org.mitk.gui.qt.spectrocamrecorder/documentation/UserManual/Manual.dox
+++ /dev/null
@@ -1,17 +0,0 @@
-/**
-\page org_mitk_gui_qt_spectrocamrecorder The Spectrocamrecorder
-
-\imageMacro{icon.png,"Icon of Spectrocamrecorder",2.00}
-
-\tableofcontents
-
-\section org_mitk_gui_qt_spectrocamrecorderOverview Overview
-Describe the features of your awesome plugin here
-<ul>
-<li>Increases productivity
-<li>Creates beautiful images
-<li>Generates PhD thesis
-<li>Brings world peace
-</ul>
-
-*/
diff --git a/Plugins/org.mitk.gui.qt.spectrocamrecorder/documentation/UserManual/icon.xpm b/Plugins/org.mitk.gui.qt.spectrocamrecorder/documentation/UserManual/icon.xpm
deleted file mode 100644
index 9057c20bc6..0000000000
--- a/Plugins/org.mitk.gui.qt.spectrocamrecorder/documentation/UserManual/icon.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static const char * icon_xpm[] = {
-"16 16 2 1",
-" c #FF0000",
-". c #000000",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" "};
diff --git a/Plugins/org.mitk.gui.qt.spectrocamrecorder/documentation/doxygen/modules.dox b/Plugins/org.mitk.gui.qt.spectrocamrecorder/documentation/doxygen/modules.dox
deleted file mode 100644
index cbcca5b2ac..0000000000
--- a/Plugins/org.mitk.gui.qt.spectrocamrecorder/documentation/doxygen/modules.dox
+++ /dev/null
@@ -1,16 +0,0 @@
-/**
- \defgroup org_mitk_gui_qt_spectrocamrecorder org.mitk.gui.qt.spectrocamrecorder
- \ingroup MITKPlugins
-
- \brief Describe your plugin here.
-
-*/
-
-/**
- \defgroup org_mitk_gui_qt_spectrocamrecorder_internal Internal
- \ingroup org_mitk_gui_qt_spectrocamrecorder
-
- \brief This subcategory includes the internal classes of the org.mitk.gui.qt.spectrocamrecorder plugin. Other
- plugins must not rely on these classes. They contain implementation details and their interface
- may change at any time. We mean it.
-*/
diff --git a/Plugins/org.mitk.gui.qt.toftutorial/documentation/Manual/Manual.dox b/Plugins/org.mitk.gui.qt.toftutorial/documentation/Manual/Manual.dox
index 00b0777dde..b64b37f1bb 100644
--- a/Plugins/org.mitk.gui.qt.toftutorial/documentation/Manual/Manual.dox
+++ b/Plugins/org.mitk.gui.qt.toftutorial/documentation/Manual/Manual.dox
@@ -1,13 +1,13 @@
/**
\page org_toftutorial The ToF Tutorial
-\imageMacro{icon.png,"Icon of ToFTutorial",2}
+\imageMacro{icon_tof_tutorial.png,"Icon of ToFTutorial",2}
Available sections:
- \ref ToFTutorialOverview
\section ToFTutorialOverview
This is the description for the ToFTutorial.
*/
diff --git a/Plugins/org.mitk.gui.qt.toftutorial/documentation/Manual/icon_tof_tutorial.png b/Plugins/org.mitk.gui.qt.toftutorial/documentation/Manual/icon_tof_tutorial.png
new file mode 100644
index 0000000000..13aab8a1c8
Binary files /dev/null and b/Plugins/org.mitk.gui.qt.toftutorial/documentation/Manual/icon_tof_tutorial.png differ
diff --git a/Plugins/org.mitk.gui.qt.toftutorial/files.cmake b/Plugins/org.mitk.gui.qt.toftutorial/files.cmake
index d3c0aac915..00515cb366 100644
--- a/Plugins/org.mitk.gui.qt.toftutorial/files.cmake
+++ b/Plugins/org.mitk.gui.qt.toftutorial/files.cmake
@@ -1,37 +1,36 @@
set(SRC_CPP_FILES
)
set(INTERNAL_CPP_FILES
QmitkToFTutorialView.cpp
mitkPluginActivator.cpp
)
set(UI_FILES
src/internal/QmitkToFTutorialViewControls.ui
)
set(MOC_H_FILES
src/internal/QmitkToFTutorialView.h
src/internal/mitkPluginActivator.h
)
set(CACHED_RESOURCE_FILES
plugin.xml
resources/icon_tof_tutorial.svg
)
set(QRC_FILES
- resources/QmitkToFTutorialView.qrc
)
set(CPP_FILES)
foreach(file ${SRC_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/${file})
endforeach(file ${SRC_CPP_FILES})
foreach(file ${INTERNAL_CPP_FILES})
set(CPP_FILES ${CPP_FILES} src/internal/${file})
endforeach(file ${INTERNAL_CPP_FILES})
diff --git a/Plugins/org.mitk.gui.qt.toftutorial/resources/QmitkToFTutorialView.qrc b/Plugins/org.mitk.gui.qt.toftutorial/resources/QmitkToFTutorialView.qrc
deleted file mode 100644
index 7b41198d69..0000000000
--- a/Plugins/org.mitk.gui.qt.toftutorial/resources/QmitkToFTutorialView.qrc
+++ /dev/null
@@ -1,5 +0,0 @@
-<!DOCTYPE RCC><RCC version="1.0">
- <qresource prefix="/QmitkToFTutorialView">
- <file>icon.xpm</file>
- </qresource>
- </RCC>
diff --git a/Plugins/org.mitk.gui.qt.toftutorial/resources/icon.png b/Plugins/org.mitk.gui.qt.toftutorial/resources/icon.png
deleted file mode 100644
index dfa18097dd..0000000000
Binary files a/Plugins/org.mitk.gui.qt.toftutorial/resources/icon.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.toftutorial/resources/icon.xpm b/Plugins/org.mitk.gui.qt.toftutorial/resources/icon.xpm
deleted file mode 100644
index 62b8ad5692..0000000000
--- a/Plugins/org.mitk.gui.qt.toftutorial/resources/icon.xpm
+++ /dev/null
@@ -1,2635 +0,0 @@
-/* XPM */
-static char * icon_xpm[] = {
-"100 100 2532 2",
-" c None",
-". c #F3F3F3",
-"+ c #ACACAC",
-"@ c #7E7E7E",
-"# c #7C7C7C",
-"$ c #5E5E5E",
-"% c #E3E3E4",
-"& c #A1A1A3",
-"* c #8B8B8A",
-"= c #646464",
-"- c #474747",
-"; c #121212",
-"> c #323232",
-", c #6B6B6B",
-"' c #EAEAEA",
-") c #C9CACA",
-"! c #98989A",
-"~ c #777779",
-"{ c #454547",
-"] c #4A4A4A",
-"^ c #2C2C2C",
-"/ c #3B3B3B",
-"( c #181818",
-"_ c #1D1D1D",
-": c #252526",
-"< c #343435",
-"[ c #C3C3C2",
-"} c #D5D5D5",
-"| c #B0B1B3",
-"1 c #B8B9BC",
-"2 c #707174",
-"3 c #707276",
-"4 c #414245",
-"5 c #454647",
-"6 c #444444",
-"7 c #383838",
-"8 c #2F2F2F",
-"9 c #262626",
-"0 c #202020",
-"a c #1B1C1D",
-"b c #19191B",
-"c c #161618",
-"d c #5D5D5D",
-"e c #C8C8C8",
-"f c #C5C7C9",
-"g c #B0B6B9",
-"h c #A1A4A8",
-"i c #8F8F95",
-"j c #48484D",
-"k c #505153",
-"l c #515152",
-"m c #2B2B2B",
-"n c #404040",
-"o c #222222",
-"p c #212223",
-"q c #18191A",
-"r c #232326",
-"s c #131315",
-"t c #727274",
-"u c #BFBFBE",
-"v c #D0D4D7",
-"w c #BEC3C6",
-"x c #B6BABD",
-"y c #B2B6BC",
-"z c #AEB4B9",
-"A c #909499",
-"B c #86888D",
-"C c #57585C",
-"D c #3F3F3F",
-"E c #4B4B4A",
-"F c #343434",
-"G c #414141",
-"H c #28292B",
-"I c #2F3032",
-"J c #232226",
-"K c #343438",
-"L c #201F22",
-"M c #3D3D3F",
-"N c #8F8F90",
-"O c #B9B8BA",
-"P c #C9C9CB",
-"Q c #B8B8B8",
-"R c #8B8D8E",
-"S c #D3D7DA",
-"T c #B9BDC1",
-"U c #B3B7BB",
-"V c #AAAEB2",
-"W c #A3A9AD",
-"X c #9FA3A8",
-"Y c #83878B",
-"Z c #747578",
-"` c #5B5B5D",
-" . c #434343",
-".. c #505050",
-"+. c #424242",
-"@. c #373737",
-"#. c #353637",
-"$. c #323335",
-"%. c #2F3133",
-"&. c #323235",
-"*. c #353537",
-"=. c #3C3C3E",
-"-. c #39393A",
-";. c #302F30",
-">. c #464546",
-",. c #4A4A4C",
-"'. c #F3F3F4",
-"). c #D3D4D6",
-"!. c #D0D2D5",
-"~. c #E2E5E7",
-"{. c #E2E4E6",
-"]. c #4B4A4B",
-"^. c #4F4F4F",
-"/. c #BCBFBF",
-"(. c #B6BABF",
-"_. c #A7ACB0",
-":. c #9FA4A8",
-"<. c #9CA0A4",
-"[. c #8B8F92",
-"}. c #797A7D",
-"|. c #6A6A6A",
-"1. c #595958",
-"2. c #454545",
-"3. c #3D3D3D",
-"4. c #363636",
-"5. c #323334",
-"6. c #303133",
-"7. c #333436",
-"8. c #3D3E40",
-"9. c #333335",
-"0. c #2C2C2D",
-"a. c #3A3A3A",
-"b. c #373738",
-"c. c #3B3B3E",
-"d. c #3B3B3F",
-"e. c #A0A0A1",
-"f. c #E5E7E8",
-"g. c #D0D2D3",
-"h. c #CED0D2",
-"i. c #D7DADC",
-"j. c #E3E6E8",
-"k. c #E0E4E7",
-"l. c #DADEE1",
-"m. c #D7DCE0",
-"n. c #D4DADC",
-"o. c #DCE0E1",
-"p. c #999898",
-"q. c #2A2A2B",
-"r. c #656668",
-"s. c #B0B6BA",
-"t. c #A1A5AA",
-"u. c #999BA0",
-"v. c #919297",
-"w. c #757679",
-"x. c #666667",
-"y. c #5A5A5B",
-"z. c #505051",
-"A. c #3B3B3C",
-"B. c #3C3C3C",
-"C. c #393939",
-"D. c #2F3031",
-"E. c #363739",
-"F. c #363638",
-"G. c #313136",
-"H. c #35353B",
-"I. c #38383E",
-"J. c #38373C",
-"K. c #3D3C41",
-"L. c #2F2F31",
-"M. c #636363",
-"N. c #BDBFBF",
-"O. c #AEB2B4",
-"P. c #B3B7BA",
-"Q. c #CACED1",
-"R. c #D1D6D9",
-"S. c #D9DDE0",
-"T. c #DBDFE2",
-"U. c #D6DADD",
-"V. c #D1D5D8",
-"W. c #CED2D5",
-"X. c #D3D6D8",
-"Y. c #DADDDE",
-"Z. c #616364",
-"`. c #2C2D2D",
-" + c #8D8F94",
-".+ c #9B9EA4",
-"++ c #919296",
-"@+ c #7A7B7F",
-"#+ c #6B6C6D",
-"$+ c #4E4E51",
-"%+ c #474748",
-"&+ c #333333",
-"*+ c #424241",
-"=+ c #40403F",
-"-+ c #222223",
-";+ c #2D2E30",
-">+ c #333438",
-",+ c #37383C",
-"'+ c #39383C",
-")+ c #434247",
-"!+ c #575659",
-"~+ c #4D4D4D",
-"{+ c #B1B1B1",
-"]+ c #C6C6C7",
-"^+ c #BBBDC0",
-"/+ c #A4A6A9",
-"(+ c #A6A9AC",
-"_+ c #BDC1C4",
-":+ c #BBBFC2",
-"<+ c #BABEC1",
-"[+ c #C8CCCF",
-"}+ c #D2D6D9",
-"|+ c #D2D7DA",
-"1+ c #D5D9DC",
-"2+ c #D4D7DA",
-"3+ c #D2D5D7",
-"4+ c #D7D9DB",
-"5+ c #D4D6D9",
-"6+ c #C9CED0",
-"7+ c #BFC4C7",
-"8+ c #939395",
-"9+ c #3F3F41",
-"0+ c #5B5D5F",
-"a+ c #7D7E82",
-"b+ c #8B8C8F",
-"c+ c #6D6E70",
-"d+ c #5A5A5C",
-"e+ c #333332",
-"f+ c #3E3E3D",
-"g+ c #313133",
-"h+ c #2E2E30",
-"i+ c #2D2E31",
-"j+ c #2E2F31",
-"k+ c #343538",
-"l+ c #3D3D40",
-"m+ c #454648",
-"n+ c #535353",
-"o+ c #515151",
-"p+ c #353534",
-"q+ c #AAAAA9",
-"r+ c #CCCDCC",
-"s+ c #7F8184",
-"t+ c #999B9E",
-"u+ c #9A9C9F",
-"v+ c #96989D",
-"w+ c #9CA0A3",
-"x+ c #A6ABAE",
-"y+ c #AEB2B5",
-"z+ c #ADB0B2",
-"A+ c #B5B6B9",
-"B+ c #B6B8BC",
-"C+ c #C3C5C9",
-"D+ c #CDCFD4",
-"E+ c #CED1D4",
-"F+ c #D7D8DB",
-"G+ c #D1D3D5",
-"H+ c #CFD1D3",
-"I+ c #E0E0E2",
-"J+ c #E4E5E7",
-"K+ c #D4D6D8",
-"L+ c #BCBFC3",
-"M+ c #B5B8BC",
-"N+ c #BBBEC2",
-"O+ c #A8AAAC",
-"P+ c #77787A",
-"Q+ c #3B3C3F",
-"R+ c #3A3B3C",
-"S+ c #666768",
-"T+ c #606062",
-"U+ c #515153",
-"V+ c #4A4A4B",
-"W+ c #353536",
-"X+ c #2E2E2F",
-"Y+ c #2D2D2F",
-"Z+ c #2A2B2B",
-"`+ c #2F2F30",
-" @ c #424243",
-".@ c #514F4E",
-"+@ c #535252",
-"@@ c #48494A",
-"#@ c #403F3D",
-"$@ c #51514C",
-"%@ c #434244",
-"&@ c #424143",
-"*@ c #E9E8EA",
-"=@ c #646567",
-"-@ c #565757",
-";@ c #2C2D2F",
-">@ c #7A7E7E",
-",@ c #979B9F",
-"'@ c #95989E",
-")@ c #9DA1A5",
-"!@ c #9FA3A6",
-"~@ c #A0A4A7",
-"{@ c #A9ABAD",
-"]@ c #AEAFB1",
-"^@ c #B2B3B5",
-"/@ c #C0C1C5",
-"(@ c #CECFD4",
-"_@ c #D3D4D7",
-":@ c #D2D3D5",
-"<@ c #C9CACC",
-"[@ c #CCCDCF",
-"}@ c #D6D7D9",
-"|@ c #DEDFE0",
-"1@ c #D9DADC",
-"2@ c #AEAFB4",
-"3@ c #A7AAAE",
-"4@ c #A3A7AA",
-"5@ c #9EA2A5",
-"6@ c #9D9FA2",
-"7@ c #4D4E4E",
-"8@ c #181918",
-"9@ c #404041",
-"0@ c #58585B",
-"a@ c #323234",
-"b@ c #444242",
-"c@ c #43423F",
-"d@ c #4B4B47",
-"e@ c #504E50",
-"f@ c #302C39",
-"g@ c #100A20",
-"h@ c #6A6871",
-"i@ c #C0C0C0",
-"j@ c #727475",
-"k@ c #4D5153",
-"l@ c #414547",
-"m@ c #55585A",
-"n@ c #606163",
-"o@ c #424342",
-"p@ c #191A19",
-"q@ c #6B6F6F",
-"r@ c #A2A7A9",
-"s@ c #93989B",
-"t@ c #9FA2A5",
-"u@ c #A2A4A6",
-"v@ c #ADAEB0",
-"w@ c #BDBEC0",
-"x@ c #C0C1C4",
-"y@ c #CDCED0",
-"z@ c #CECFD1",
-"A@ c #D5D6D8",
-"B@ c #D4D5D7",
-"C@ c #CECFD0",
-"D@ c #BFC0C2",
-"E@ c #B5B6B7",
-"F@ c #B1B2B5",
-"G@ c #A8A9AD",
-"H@ c #A0A3A7",
-"I@ c #9A9EA1",
-"J@ c #979A9D",
-"K@ c #939498",
-"L@ c #8A8B8B",
-"M@ c #666767",
-"N@ c #282828",
-"O@ c #1C1C1E",
-"P@ c #49494A",
-"Q@ c #494949",
-"R@ c #454548",
-"S@ c #4F4F51",
-"T@ c #4B4B4B",
-"U@ c #3D3E3D",
-"V@ c #555555",
-"W@ c #434148",
-"X@ c #2D2633",
-"Y@ c #1B1327",
-"Z@ c #201732",
-"`@ c #120C1F",
-" # c #969599",
-".# c #C2C2C2",
-"+# c #9A999D",
-"@# c #393A3D",
-"## c #303134",
-"$# c #424346",
-"%# c #45464A",
-"&# c #4C4E52",
-"*# c #505257",
-"=# c #5B5E63",
-"-# c #686C70",
-";# c #636368",
-"># c #0B0B0C",
-",# c #484848",
-"'# c #A1A2A3",
-")# c #969799",
-"!# c #9E9EA0",
-"~# c #A1A2A4",
-"{# c #A3A4A6",
-"]# c #CBCCCE",
-"^# c #CED0CF",
-"/# c #D0D1D1",
-"(# c #C3C4C4",
-"_# c #C7C9CB",
-":# c #BABBBF",
-"<# c #B7B8BD",
-"[# c #B0B1B4",
-"}# c #ABACB0",
-"|# c #A5A6AA",
-"1# c #9C9FA4",
-"2# c #93969B",
-"3# c #898A8E",
-"4# c #78797A",
-"5# c #636365",
-"6# c #070708",
-"7# c #303030",
-"8# c #4C4C4C",
-"9# c #444445",
-"0# c #3A3A3C",
-"a# c #343331",
-"b# c #5D5A59",
-"c# c #585256",
-"d# c #21162B",
-"e# c #22162D",
-"f# c #24182F",
-"g# c #261A32",
-"h# c #25192F",
-"i# c #2D2531",
-"j# c #AEAEAE",
-"k# c #737373",
-"l# c #252525",
-"m# c #151515",
-"n# c #585859",
-"o# c #2C2C2E",
-"p# c #16151A",
-"q# c #424347",
-"r# c #404146",
-"s# c #46474B",
-"t# c #494A4E",
-"u# c #4F5155",
-"v# c #55595E",
-"w# c #717379",
-"x# c #797B7E",
-"y# c #2C2D2E",
-"z# c #79797B",
-"A# c #9B9B9D",
-"B# c #9F9FA2",
-"C# c #A0A1A3",
-"D# c #BABBBD",
-"E# c #C3C4C6",
-"F# c #C9CBCC",
-"G# c #C3C4C5",
-"H# c #BABBBE",
-"I# c #B9BABF",
-"J# c #B3B4B8",
-"K# c #AFB0B4",
-"L# c #A7A8AC",
-"M# c #9FA0A4",
-"N# c #979A9F",
-"O# c #919398",
-"P# c #8E8F94",
-"Q# c #636467",
-"R# c #606162",
-"S# c #5D5D5E",
-"T# c #4C4C4B",
-"U# c #0C0C0C",
-"V# c #3D3D3C",
-"W# c #333437",
-"X# c #444248",
-"Y# c #54505B",
-"Z# c #2A2336",
-"`# c #170B27",
-" $ c #291C37",
-".$ c #2A1D34",
-"+$ c #281D32",
-"@$ c #2A1E33",
-"#$ c #251B2D",
-"$$ c #4B454F",
-"%$ c #5B5C5C",
-"&$ c #696969",
-"*$ c #000000",
-"=$ c #0C0C0D",
-"-$ c #161717",
-";$ c #121214",
-">$ c #38373B",
-",$ c #35363A",
-"'$ c #37383B",
-")$ c #414247",
-"!$ c #434448",
-"~$ c #47484B",
-"{$ c #4B4D52",
-"]$ c #525559",
-"^$ c #595C60",
-"/$ c #62656B",
-"($ c #6D6F74",
-"_$ c #7A7E81",
-":$ c #29282A",
-"<$ c #48484A",
-"[$ c #949597",
-"}$ c #9FA0A2",
-"|$ c #AAABAD",
-"1$ c #BBBCBE",
-"2$ c #BCBDC0",
-"3$ c #B9B9BD",
-"4$ c #B4B5B9",
-"5$ c #B0B1B5",
-"6$ c #ACADB1",
-"7$ c #A6A7AB",
-"8$ c #909297",
-"9$ c #8D9196",
-"0$ c #8F9296",
-"a$ c #9D9EA2",
-"b$ c #595A5C",
-"c$ c #565655",
-"d$ c #484846",
-"e$ c #50504F",
-"f$ c #161616",
-"g$ c #353535",
-"h$ c #3A3C3D",
-"i$ c #2E263B",
-"j$ c #221734",
-"k$ c #2A1E38",
-"l$ c #2E213A",
-"m$ c #2E203A",
-"n$ c #2E2139",
-"o$ c #2D2136",
-"p$ c #2E2236",
-"q$ c #291F30",
-"r$ c #69656D",
-"s$ c #CDCDCE",
-"t$ c #727374",
-"u$ c #59595A",
-"v$ c #191C1D",
-"w$ c #131518",
-"x$ c #131417",
-"y$ c #151619",
-"z$ c #121314",
-"A$ c #0D0E10",
-"B$ c #0B0C0E",
-"C$ c #252629",
-"D$ c #1F2021",
-"E$ c #0F1010",
-"F$ c #323337",
-"G$ c #3A3B3F",
-"H$ c #343539",
-"I$ c #444547",
-"J$ c #464749",
-"K$ c #4B4C50",
-"L$ c #505155",
-"M$ c #58595D",
-"N$ c #5D6064",
-"O$ c #65696C",
-"P$ c #696D71",
-"Q$ c #757779",
-"R$ c #6F6F71",
-"S$ c #343537",
-"T$ c #232324",
-"U$ c #767675",
-"V$ c #A7A8A9",
-"W$ c #B2B3B7",
-"X$ c #B9BABC",
-"Y$ c #B8B9BB",
-"Z$ c #B1B2B4",
-"`$ c #A7A8AB",
-" % c #A1A2A6",
-".% c #97989C",
-"+% c #8E8F93",
-"@% c #9DA1A4",
-"#% c #919496",
-"$% c #6E6E6F",
-"%% c #575757",
-"&% c #373636",
-"*% c #3A3B3B",
-"=% c #111214",
-"-% c #3B3C3E",
-";% c #3A3C3E",
-">% c #323036",
-",% c #30223D",
-"'% c #30233C",
-")% c #31243E",
-"!% c #32243E",
-"~% c #31253D",
-"{% c #31253B",
-"]% c #32263A",
-"^% c #34273C",
-"/% c #33283A",
-"(% c #747479",
-"_% c #E7E7E7",
-":% c #8B8A8C",
-"<% c #504F52",
-"[% c #232427",
-"}% c #1B1B1E",
-"|% c #242528",
-"1% c #1B1E21",
-"2% c #17191D",
-"3% c #16171C",
-"4% c #0A0B0D",
-"5% c #161719",
-"6% c #1B1D1E",
-"7% c #070908",
-"8% c #252627",
-"9% c #393A3F",
-"0% c #16161A",
-"a% c #444548",
-"b% c #4A4B4D",
-"c% c #4D4E52",
-"d% c #525357",
-"e% c #5B5D60",
-"f% c #5F6366",
-"g% c #64686A",
-"h% c #68696B",
-"i% c #717274",
-"j% c #727375",
-"k% c #585858",
-"l% c #1A1A1A",
-"m% c #A7A7AB",
-"n% c #B3B4B7",
-"o% c #B6B7B9",
-"p% c #B3B4B6",
-"q% c #B4B5B7",
-"r% c #A9AAAC",
-"s% c #AFB0B2",
-"t% c #A4A5A8",
-"u% c #B6B7BA",
-"v% c #8A8B8D",
-"w% c #5E5F61",
-"x% c #494A4B",
-"y% c #3D3E41",
-"z% c #3B3D3F",
-"A% c #34303B",
-"B% c #362843",
-"C% c #352841",
-"D% c #362942",
-"E% c #372A42",
-"F% c #372B40",
-"G% c #372C40",
-"H% c #362A40",
-"I% c #423847",
-"J% c #6E6E71",
-"K% c #959495",
-"L% c #464645",
-"M% c #353539",
-"N% c #343338",
-"O% c #2B2B30",
-"P% c #2D2E33",
-"Q% c #2C2D32",
-"R% c #16161B",
-"S% c #1B1A20",
-"T% c #1A1C21",
-"U% c #15171D",
-"V% c #0F1014",
-"W% c #060709",
-"X% c #191A1D",
-"Y% c #2C2D30",
-"Z% c #080808",
-"`% c #1A1B1A",
-" & c #444549",
-".& c #414246",
-"+& c #515254",
-"@& c #494A4C",
-"#& c #4E4F53",
-"$& c #575B5E",
-"%& c #5E6265",
-"&& c #5E6062",
-"*& c #808083",
-"=& c #99999A",
-"-& c #9F9F9F",
-";& c #202225",
-">& c #949598",
-",& c #AAABAF",
-"'& c #949698",
-")& c #202021",
-"!& c #A3A4A7",
-"~& c #96979B",
-"{& c #3E3E3E",
-"]& c #2B2B2D",
-"^& c #353142",
-"/& c #392B47",
-"(& c #3A2C46",
-"_& c #3A2D47",
-":& c #3A2E47",
-"<& c #3B2F47",
-"[& c #3C3045",
-"}& c #3C3145",
-"|& c #3A2D44",
-"1& c #4A414D",
-"2& c #A3A5A3",
-"3& c #8F8C8A",
-"4& c #939298",
-"5& c #212526",
-"6& c #2B2C2B",
-"7& c #3C3A3C",
-"8& c #787982",
-"9& c #30343B",
-"0& c #22262D",
-"a& c #24282E",
-"b& c #1D2125",
-"c& c #171A1F",
-"d& c #191A1E",
-"e& c #15161A",
-"f& c #0D0D11",
-"g& c #131517",
-"h& c #1E1F21",
-"i& c #313236",
-"j& c #2A2A2F",
-"k& c #3F4044",
-"l& c #58595E",
-"m& c #404145",
-"n& c #505152",
-"o& c #535357",
-"p& c #5A5B5F",
-"q& c #646368",
-"r& c #767779",
-"s& c #8F9092",
-"t& c #919294",
-"u& c #87888A",
-"v& c #868789",
-"w& c #A5A6A8",
-"x& c #4C4D50",
-"y& c #1A1C1C",
-"z& c #6E7070",
-"A& c #949496",
-"B& c #A7A7A9",
-"C& c #B9BCBF",
-"D& c #A6AAAD",
-"E& c #7A7D81",
-"F& c #1E1E1E",
-"G& c #2A2929",
-"H& c #262726",
-"I& c #2A2C2B",
-"J& c #353635",
-"K& c #3B3B3A",
-"L& c #393A3A",
-"M& c #3A3043",
-"N& c #3D314B",
-"O& c #3F324D",
-"P& c #40334C",
-"Q& c #41344A",
-"R& c #403349",
-"S& c #423648",
-"T& c #413546",
-"U& c #45394D",
-"V& c #433F4B",
-"W& c #E0DFE1",
-"X& c #676764",
-"Y& c #131413",
-"Z& c #484947",
-"`& c #222326",
-" * c #252426",
-".* c #5F6267",
-"+* c #6F7278",
-"@* c #373A41",
-"#* c #181B20",
-"$* c #1E2126",
-"%* c #191B20",
-"&* c #14151A",
-"** c #141519",
-"=* c #18191D",
-"-* c #0E0F0F",
-";* c #111212",
-">* c #1B1C1F",
-",* c #2D2F32",
-"'* c #36373B",
-")* c #3C3D41",
-"!* c #47484C",
-"~* c #4B4D4E",
-"{* c #46484A",
-"]* c #65666A",
-"^* c #717276",
-"/* c #808185",
-"(* c #818284",
-"_* c #7E7F81",
-":* c #7A7B7D",
-"<* c #808183",
-"[* c #86888A",
-"}* c #303131",
-"|* c #616365",
-"1* c #141414",
-"2* c #131313",
-"3* c #101010",
-"4* c #171817",
-"5* c #252826",
-"6* c #373938",
-"7* c #434444",
-"8* c #3C3A3F",
-"9* c #3E3249",
-"0* c #463751",
-"a* c #453652",
-"b* c #463852",
-"c* c #473850",
-"d* c #48394F",
-"e* c #483A4E",
-"f* c #47394B",
-"g* c #493D4E",
-"h* c #39343E",
-"i* c #6A696C",
-"j* c #3A393D",
-"k* c #212325",
-"l* c #201F21",
-"m* c #323438",
-"n* c #4A4D53",
-"o* c #6B6D74",
-"p* c #424449",
-"q* c #14171C",
-"r* c #171A1E",
-"s* c #1B1D21",
-"t* c #111416",
-"u* c #0F0F14",
-"v* c #1C1D21",
-"w* c #191A1C",
-"x* c #303135",
-"y* c #434447",
-"z* c #48494B",
-"A* c #48494C",
-"B* c #7F8081",
-"C* c #6F7074",
-"D* c #76777B",
-"E* c #727377",
-"F* c #737476",
-"G* c #747577",
-"H* c #78797B",
-"I* c #7A7A7C",
-"J* c #868788",
-"K* c #9C9D9F",
-"L* c #7E8081",
-"M* c #161617",
-"N* c #0A0B0B",
-"O* c #131314",
-"P* c #121211",
-"Q* c #0B0B0B",
-"R* c #0D0D0D",
-"S* c #0F0F0F",
-"T* c #111111",
-"U* c #131412",
-"V* c #1B1C1B",
-"W* c #262727",
-"X* c #2D2D2D",
-"Y* c #1D1E1E",
-"Z* c #434443",
-"`* c #3E3F3F",
-" = c #3B393F",
-".= c #433551",
-"+= c #4F3D59",
-"@= c #4E3D59",
-"#= c #4D3D58",
-"$= c #4D3D55",
-"%= c #4E3E55",
-"&= c #4D3F54",
-"*= c #4C3F52",
-"== c #3F3443",
-"-= c #868188",
-";= c #626262",
-">= c #4E4D4F",
-",= c #212125",
-"'= c #212222",
-")= c #101012",
-"!= c #616368",
-"~= c #484B50",
-"{= c #191B1F",
-"]= c #121217",
-"^= c #1B1E22",
-"/= c #15151A",
-"(= c #0A0B0F",
-"_= c #1E1F23",
-":= c #292A2E",
-"<= c #2D2E32",
-"[= c #38393A",
-"}= c #39393B",
-"|= c #3F4042",
-"1= c #4F5051",
-"2= c #6C6C6D",
-"3= c #9C9C9D",
-"4= c #696B6D",
-"5= c #6B6C70",
-"6= c #6B6C6F",
-"7= c #696A6C",
-"8= c #747473",
-"9= c #898989",
-"0= c #858586",
-"a= c #565858",
-"b= c #343636",
-"c= c #131312",
-"d= c #040404",
-"e= c #121312",
-"f= c #111110",
-"g= c #5E5E5D",
-"h= c #444545",
-"i= c #1C1C1C",
-"j= c #323433",
-"k= c #3E403F",
-"l= c #3E403E",
-"m= c #403B43",
-"n= c #4F3F5E",
-"o= c #574463",
-"p= c #554560",
-"q= c #55445E",
-"r= c #55445D",
-"s= c #53455B",
-"t= c #524458",
-"u= c #544557",
-"v= c #322A37",
-"w= c #DDDBDD",
-"x= c #6D6E6E",
-"y= c #201F24",
-"z= c #1D1F1E",
-"A= c #292A2D",
-"B= c #292A2F",
-"C= c #2D2D32",
-"D= c #26282D",
-"E= c #595C61",
-"F= c #474A4F",
-"G= c #181A1F",
-"H= c #0B0B10",
-"I= c #212327",
-"J= c #25262A",
-"K= c #28292D",
-"L= c #2E2F33",
-"M= c #2A2C2C",
-"N= c #6B6C6B",
-"O= c #525255",
-"P= c #4F5153",
-"Q= c #55585B",
-"R= c #56595C",
-"S= c #5C5D61",
-"T= c #616266",
-"U= c #5D5E62",
-"V= c #646568",
-"W= c #6E6F70",
-"X= c #797A7A",
-"Y= c #171917",
-"Z= c #131512",
-"`= c #0C0D0B",
-" - c #030303",
-".- c #11110F",
-"+- c #0F0F10",
-"@- c #1B1B1B",
-"#- c #3D3F3E",
-"$- c #413949",
-"%- c #624E74",
-"&- c #5F4D6B",
-"*- c #604D69",
-"=- c #614E69",
-"-- c #604D68",
-";- c #5D4B64",
-">- c #594A5A",
-",- c #625661",
-"'- c #4A494C",
-")- c #2B2A2C",
-"!- c #1A1A1D",
-"~- c #1F2121",
-"{- c #1A1B1D",
-"]- c #38393C",
-"^- c #26272B",
-"/- c #1E2025",
-"(- c #46484D",
-"_- c #46494D",
-":- c #1C1C21",
-"<- c #171B1F",
-"[- c #1D1F23",
-"}- c #202124",
-"|- c #232429",
-"1- c #232428",
-"2- c #28282D",
-"3- c #444645",
-"4- c #595A59",
-"5- c #37383A",
-"6- c #4B4D4F",
-"7- c #4F5255",
-"8- c #525558",
-"9- c #57595D",
-"0- c #5B5C60",
-"a- c #5B5C5D",
-"b- c #555557",
-"c- c #363738",
-"d- c #090909",
-"e- c #0E0E0E",
-"f- c #161815",
-"g- c #121412",
-"h- c #131414",
-"i- c #090809",
-"j- c #0A0A0A",
-"k- c #010101",
-"l- c #020202",
-"m- c #060606",
-"n- c #292A2A",
-"o- c #1F1F20",
-"p- c #3C3D3D",
-"q- c #3F413F",
-"r- c #4F425C",
-"s- c #725C83",
-"t- c #6C5878",
-"u- c #6D5875",
-"v- c #6D5873",
-"w- c #6A5870",
-"x- c #67596B",
-"y- c #5A555E",
-"z- c #414346",
-"A- c #999A9C",
-"B- c #6D6D6E",
-"C- c #191919",
-"D- c #1E2020",
-"E- c #151719",
-"F- c #282A2E",
-"G- c #242428",
-"H- c #2C2D31",
-"I- c #38383D",
-"J- c #24292D",
-"K- c #1D1F22",
-"L- c #1D1E22",
-"M- c #27282B",
-"N- c #2B2B2E",
-"O- c #333435",
-"P- c #353638",
-"Q- c #404143",
-"R- c #434446",
-"S- c #47484A",
-"T- c #4C4D4F",
-"U- c #565759",
-"V- c #545558",
-"W- c #404043",
-"X- c #1F1F1F",
-"Y- c #0F100F",
-"Z- c #1F2122",
-"`- c #222421",
-" ; c #1F2226",
-".; c #191A1A",
-"+; c #161818",
-"@; c #070807",
-"#; c #171718",
-"$; c #16171A",
-"%; c #18181B",
-"&; c #373736",
-"*; c #3B3B3D",
-"=; c #69577A",
-"-; c #80668C",
-";; c #806489",
-">; c #7E6883",
-",; c #736576",
-"'; c #5E575F",
-"); c #4D4C4C",
-"!; c #5B5B59",
-"~; c #6F6F6F",
-"{; c #292929",
-"]; c #1A1919",
-"^; c #1C1E1D",
-"/; c #151518",
-"(; c #27282C",
-"_; c #2A2B2F",
-":; c #28292C",
-"<; c #202023",
-"[; c #2C2C2F",
-"}; c #303234",
-"|; c #1F2024",
-"1; c #373939",
-"2; c #424444",
-"3; c #212323",
-"4; c #313234",
-"5; c #38393B",
-"6; c #424345",
-"7; c #2F3131",
-"8; c #0B0C0C",
-"9; c #252425",
-"0; c #2E302C",
-"a; c #333431",
-"b; c #3D363E",
-"c; c #232726",
-"d; c #242625",
-"e; c #202321",
-"f; c #1E1F1F",
-"g; c #070707",
-"h; c #050505",
-"i; c #211F22",
-"j; c #282A2D",
-"k; c #37353C",
-"l; c #8E779D",
-"m; c #8D7496",
-"n; c #806F82",
-"o; c #645E66",
-"p; c #514C4D",
-"q; c #5F5C58",
-"r; c #7F7F78",
-"s; c #767777",
-"t; c #191B1A",
-"u; c #191C1B",
-"v; c #18191B",
-"w; c #323338",
-"x; c #222328",
-"y; c #2B2C2E",
-"z; c #363639",
-"A; c #2D3134",
-"B; c #212528",
-"C; c #222225",
-"D; c #1A1C1A",
-"E; c #282A2C",
-"F; c #1C1C1F",
-"G; c #202223",
-"H; c #282A2B",
-"I; c #272829",
-"J; c #393A3C",
-"K; c #46474A",
-"L; c #343536",
-"M; c #1B1B1C",
-"N; c #111312",
-"O; c #202024",
-"P; c #222321",
-"Q; c #2B2D28",
-"R; c #44433D",
-"S; c #37313F",
-"T; c #3A2E50",
-"U; c #37294B",
-"V; c #2C2E2C",
-"W; c #282A29",
-"X; c #262827",
-"Y; c #232425",
-"Z; c #4C4D4D",
-"`; c #383938",
-" > c #5B595D",
-".> c #908198",
-"+> c #6A606D",
-"@> c #504E4F",
-"#> c #5A5A57",
-"$> c #7E7E7A",
-"%> c #6D6D6C",
-"&> c #161817",
-"*> c #151618",
-"=> c #2B2C2F",
-"-> c #36383C",
-";> c #1D1E21",
-">> c #2A2C2F",
-",> c #2B2F33",
-"'> c #2C2F32",
-")> c #1B1C20",
-"!> c #17181A",
-"~> c #1B1C1E",
-"{> c #222325",
-"]> c #2A2A2C",
-"^> c #0B0C0D",
-"/> c #030404",
-"(> c #2B2C2C",
-"_> c #1F1F17",
-":> c #413F3F",
-"<> c #423E4A",
-"[> c #261C3E",
-"}> c #322450",
-"|> c #362554",
-"1> c #2F2345",
-"2> c #323430",
-"3> c #313232",
-"4> c #303231",
-"5> c #2B2D2C",
-"6> c #606061",
-"7> c #787878",
-"8> c #323231",
-"9> c #3E3F3B",
-"0> c #7E7777",
-"a> c #A5A3A2",
-"b> c #AFAFAE",
-"c> c #7499A1",
-"d> c #79A1A8",
-"e> c #7EA5AC",
-"f> c #7DA4AC",
-"g> c #7AA1A8",
-"h> c #739AA1",
-"i> c #8D8C87",
-"j> c #1F1D1B",
-"k> c #171719",
-"l> c #1A1C1B",
-"m> c #0E0E10",
-"n> c #212225",
-"o> c #252628",
-"p> c #3A3B40",
-"q> c #23262A",
-"r> c #313237",
-"s> c #303237",
-"t> c #202025",
-"u> c #1D1E20",
-"v> c #121315",
-"w> c #2A2B2D",
-"x> c #232325",
-"y> c #09090C",
-"z> c #030406",
-"A> c #141518",
-"B> c #2B2C2D",
-"C> c #302E32",
-"D> c #423C4E",
-"E> c #281D42",
-"F> c #281947",
-"G> c #33264D",
-"H> c #3B2B55",
-"I> c #372A4A",
-"J> c #32342E",
-"K> c #333533",
-"L> c #363837",
-"M> c #2F302F",
-"N> c #2A2A2A",
-"O> c #313131",
-"P> c #282825",
-"Q> c #3E3E3F",
-"R> c #2E302B",
-"S> c #4C4B49",
-"T> c #474A4C",
-"U> c #879599",
-"V> c #849FA4",
-"W> c #92C5CE",
-"X> c #9CD5DF",
-"Y> c #A2DEE9",
-"Z> c #A6E3EF",
-"`> c #A8E5F2",
-" , c #AAE5F3",
-"., c #ABE5F3",
-"+, c #A9E4F2",
-"@, c #A4E1F0",
-"#, c #A1DFEF",
-"$, c #9BD8E9",
-"%, c #93CFE0",
-"&, c #89C2D1",
-"*, c #7CB0BE",
-"=, c #6B95A1",
-"-, c #161615",
-";, c #1A1A19",
-">, c #171717",
-",, c #34373A",
-"', c #2D3033",
-"), c #2D2F33",
-"!, c #1E201E",
-"~, c #191B1B",
-"{, c #181919",
-"], c #151514",
-"^, c #1B1B1A",
-"/, c #29292B",
-"(, c #292727",
-"_, c #353237",
-":, c #2E2B40",
-"<, c #271D42",
-"[, c #251742",
-"}, c #2F1F4A",
-"|, c #312249",
-"1, c #35264F",
-"2, c #3A2B52",
-"3, c #3E2C5C",
-"4, c #362D47",
-"5, c #353431",
-"6, c #2E2E2E",
-"7, c #232323",
-"8, c #040403",
-"9, c #050504",
-"0, c #404C4E",
-"a, c #608185",
-"b, c #8CBBC4",
-"c, c #A0DDE8",
-"d, c #AAE8F5",
-"e, c #AFEAF8",
-"f, c #AFE9F7",
-"g, c #AEE8F6",
-"h, c #ADE7F6",
-"i, c #ADE7F5",
-"j, c #ABE6F5",
-"k, c #AAE5F5",
-"l, c #AAE4F5",
-"m, c #A9E3F4",
-"n, c #A9E2F4",
-"o, c #A8E1F3",
-"p, c #A7E0F3",
-"q, c #A5DFF2",
-"r, c #A0DDF1",
-"s, c #97D7EB",
-"t, c #8AC8DD",
-"u, c #78B2C3",
-"v, c #6292A0",
-"w, c #616161",
-"x, c #242424",
-"y, c #141314",
-"z, c #0F0E11",
-"A, c #25252A",
-"B, c #26272C",
-"C, c #303537",
-"D, c #313538",
-"E, c #26292C",
-"F, c #212124",
-"G, c #212322",
-"H, c #1B1D1C",
-"I, c #191B19",
-"J, c #181816",
-"K, c #121210",
-"L, c #010100",
-"M, c #1A191C",
-"N, c #2B2B29",
-"O, c #2E2F2B",
-"P, c #272431",
-"Q, c #2E2A40",
-"R, c #1D1639",
-"S, c #1F173F",
-"T, c #281C45",
-"U, c #2C1F47",
-"V, c #30224A",
-"W, c #32254D",
-"X, c #382A52",
-"Y, c #3C2E57",
-"Z, c #433161",
-"`, c #372F43",
-" ' c #353533",
-".' c #37474A",
-"+' c #689197",
-"@' c #97D3DC",
-"#' c #A9EAF6",
-"$' c #AEEBF8",
-"%' c #B0EBF8",
-"&' c #AFEAF7",
-"*' c #ADE9F7",
-"=' c #AAE8F7",
-"-' c #A7E6F6",
-";' c #A3E5F5",
-">' c #9FE3F4",
-",' c #9CE1F4",
-"'' c #99E0F3",
-")' c #98DFF3",
-"!' c #99DEF2",
-"~' c #9ADDF2",
-"{' c #9CDDF2",
-"]' c #9EDDF2",
-"^' c #A0DDF2",
-"/' c #A2DDF2",
-"(' c #A2DCF1",
-"_' c #A2DBF1",
-":' c #A0D9F0",
-"<' c #98D7EF",
-"[' c #8ACEE8",
-"}' c #77B6CD",
-"|' c #6199AA",
-"1' c #A7A7A7",
-"2' c #1D1D1C",
-"3' c #0D0C0F",
-"4' c #1E1D22",
-"5' c #191D20",
-"6' c #303336",
-"7' c #35373A",
-"8' c #2F3033",
-"9' c #242527",
-"0' c #232524",
-"a' c #1E1F20",
-"b' c #1A1D1C",
-"c' c #191A18",
-"d' c #060604",
-"e' c #29282F",
-"f' c #201D2F",
-"g' c #221D37",
-"h' c #211B3C",
-"i' c #1A163A",
-"j' c #211A42",
-"k' c #261C44",
-"l' c #2C1E46",
-"m' c #30214A",
-"n' c #34254E",
-"o' c #362851",
-"p' c #3D2D57",
-"q' c #42325C",
-"r' c #493768",
-"s' c #37323F",
-"t' c #363635",
-"u' c #2B2B2C",
-"v' c #323333",
-"w' c #282929",
-"x' c #1D1E1D",
-"y' c #2C3739",
-"z' c #638B92",
-"A' c #96D6E0",
-"B' c #A6EAF7",
-"C' c #ACEAF8",
-"D' c #A9E9F7",
-"E' c #A4E7F6",
-"F' c #9FE5F6",
-"G' c #99E3F5",
-"H' c #92E0F4",
-"I' c #8CDEF2",
-"J' c #86DCF2",
-"K' c #82DAF1",
-"L' c #7FD8F0",
-"M' c #7ED7F0",
-"N' c #7ED6EF",
-"O' c #7FD5EF",
-"P' c #82D5EE",
-"Q' c #87D5EF",
-"R' c #8CD5EF",
-"S' c #91D6EF",
-"T' c #95D6EF",
-"U' c #99D6EF",
-"V' c #9BD7EF",
-"W' c #9CD6EF",
-"X' c #9BD5EE",
-"Y' c #92D1EC",
-"Z' c #81CAE7",
-"`' c #6BAEC9",
-" ) c #588FA1",
-".) c #0A0A0B",
-"+) c #28282B",
-"@) c #242529",
-"#) c #2A2C30",
-"$) c #373B3E",
-"%) c #191C1E",
-"&) c #2E3034",
-"*) c #232426",
-"=) c #262729",
-"-) c #202123",
-";) c #1C1E1F",
-">) c #131212",
-",) c #080807",
-"') c #1E1E25",
-")) c #1A1936",
-"!) c #1C1736",
-"~) c #1C1639",
-"{) c #1E183D",
-"]) c #1F1A3F",
-"^) c #231C43",
-"/) c #291B45",
-"() c #2E1F48",
-"_) c #32234C",
-":) c #372851",
-"<) c #3C2C57",
-"[) c #42305D",
-"}) c #49345E",
-"|) c #4F3A71",
-"1) c #333039",
-"2) c #383738",
-"3) c #212422",
-"4) c #272928",
-"5) c #222423",
-"6) c #2F3230",
-"7) c #0D0E0E",
-"8) c #4B676B",
-"9) c #83C1C9",
-"0) c #9EE9F6",
-"a) c #A9EBF8",
-"b) c #ABEBF8",
-"c) c #A9EAF7",
-"d) c #A5E8F7",
-"e) c #A0E7F6",
-"f) c #9AE4F5",
-"g) c #93E2F4",
-"h) c #8CE0F3",
-"i) c #84DDF2",
-"j) c #7EDBF1",
-"k) c #7AD9F1",
-"l) c #78D8F0",
-"m) c #76D6F0",
-"n) c #75D4EF",
-"o) c #73D3EE",
-"p) c #72D1EE",
-"q) c #71D0ED",
-"r) c #70CEEC",
-"s) c #71CDEC",
-"t) c #74CDEB",
-"u) c #7ACDEB",
-"v) c #81CEEC",
-"w) c #86CFEC",
-"x) c #8BD0EC",
-"y) c #90D0EC",
-"z) c #94D0ED",
-"A) c #96D0ED",
-"B) c #93CEEC",
-"C) c #83C7E8",
-"D) c #6DBBDE",
-"E) c #589DB9",
-"F) c #4F4F4D",
-"G) c #050506",
-"H) c #1C1B1F",
-"I) c #1E1E22",
-"J) c #292E2F",
-"K) c #35393D",
-"L) c #24252A",
-"M) c #1F1F22",
-"N) c #1D1D2E",
-"O) c #181836",
-"P) c #1B1733",
-"Q) c #1D1738",
-"R) c #1F193E",
-"S) c #21193F",
-"T) c #271C44",
-"U) c #2B1E47",
-"V) c #31224B",
-"W) c #392A53",
-"X) c #3E2F5A",
-"Y) c #453360",
-"Z) c #4B3662",
-"`) c #523F74",
-" ! c #323034",
-".! c #0C0C0B",
-"+! c #5C8389",
-"@! c #91DEEA",
-"#! c #9CE9F7",
-"$! c #A5EAF7",
-"%! c #A1E8F7",
-"&! c #9DE6F6",
-"*! c #97E4F6",
-"=! c #91E2F5",
-"-! c #89E0F4",
-";! c #81DDF2",
-">! c #7BDBF1",
-",! c #77D9F1",
-"'! c #76D8F0",
-")! c #74D7F0",
-"!! c #73D5EF",
-"~! c #72D4EF",
-"{! c #70D2EE",
-"]! c #6FD0ED",
-"^! c #6DCFEC",
-"/! c #6CCDEC",
-"(! c #6ACBEB",
-"_! c #69C9EA",
-":! c #67C7E9",
-"<! c #67C6E8",
-"[! c #6AC6E8",
-"}! c #71C6E8",
-"|! c #78C8E9",
-"1! c #7FC8E9",
-"2! c #84C9EA",
-"3! c #88CAEA",
-"4! c #8CCAEA",
-"5! c #8BC9E9",
-"6! c #7FC2E6",
-"7! c #67BAE3",
-"8! c #54A0C3",
-"9! c #08090A",
-"0! c #17181C",
-"a! c #1F2222",
-"b! c #1F2322",
-"c! c #303338",
-"d! c #24272B",
-"e! c #27282A",
-"f! c #212224",
-"g! c #1E1E1F",
-"h! c #111011",
-"i! c #1D1C2C",
-"j! c #181739",
-"k! c #1C1637",
-"l! c #1D1739",
-"m! c #1E193D",
-"n! c #231841",
-"o! c #2B1C45",
-"p! c #2E2048",
-"q! c #32244D",
-"r! c #3C2C56",
-"s! c #41325D",
-"t! c #483663",
-"u! c #4F3A67",
-"v! c #523F71",
-"w! c #323230",
-"x! c #0B0C0B",
-"y! c #292B2A",
-"z! c #2B2E2D",
-"A! c #282B2A",
-"B! c #2D2E2D",
-"C! c #5A5A5A",
-"D! c #171919",
-"E! c #628E93",
-"F! c #90E5F3",
-"G! c #96E8F7",
-"H! c #A0E9F7",
-"I! c #9FE8F7",
-"J! c #9AE7F6",
-"K! c #95E5F6",
-"L! c #8FE2F5",
-"M! c #88E0F4",
-"N! c #80DEF3",
-"O! c #79DBF2",
-"P! c #76DAF1",
-"Q! c #74D8F0",
-"R! c #72D7F0",
-"S! c #71D6F0",
-"T! c #70D5EF",
-"U! c #6DD0E8",
-"V! c #65C0D7",
-"W! c #5FB5CA",
-"X! c #5EB2C9",
-"Y! c #5FB9D2",
-"Z! c #63C4E1",
-"`! c #66C9EA",
-" ~ c #64C7E9",
-".~ c #62C4E8",
-"+~ c #60C3E7",
-"@~ c #5EC1E6",
-"#~ c #5FBFE6",
-"$~ c #64BFE5",
-"%~ c #6BC0E6",
-"&~ c #72C1E6",
-"*~ c #77C1E6",
-"=~ c #7CC2E6",
-"-~ c #80C3E6",
-";~ c #81C1E6",
-">~ c #76BBE4",
-",~ c #5CB1E0",
-"'~ c #4D9DC5",
-")~ c #EBEBEB",
-"!~ c #1C1D1E",
-"~~ c #1F1F23",
-"{~ c #35383C",
-"]~ c #353A3D",
-"^~ c #22272A",
-"/~ c #111013",
-"(~ c #0F0D10",
-"_~ c #1A1B2F",
-":~ c #1B163A",
-"<~ c #1C1738",
-"[~ c #1E183A",
-"}~ c #20173D",
-"|~ c #271B43",
-"1~ c #2C1D46",
-"2~ c #352550",
-"3~ c #392A56",
-"4~ c #3E2E5A",
-"5~ c #45345E",
-"6~ c #4C3A64",
-"7~ c #533D6B",
-"8~ c #4E3E65",
-"9~ c #323431",
-"0~ c #343634",
-"a~ c #2D2F2E",
-"b~ c #282A28",
-"c~ c #292A28",
-"d~ c #262A2B",
-"e~ c #3E3E3B",
-"f~ c #588086",
-"g~ c #89E3F2",
-"h~ c #8DE6F6",
-"i~ c #98E7F6",
-"j~ c #93E5F5",
-"k~ c #8EE3F5",
-"l~ c #88E1F4",
-"m~ c #81DFF4",
-"n~ c #7ADCF3",
-"o~ c #75DAF2",
-"p~ c #72D9F1",
-"q~ c #71D8F0",
-"r~ c #6FD6F0",
-"s~ c #6ED5F0",
-"t~ c #6DD1EA",
-"u~ c #5BA7B9",
-"v~ c #497C88",
-"w~ c #365258",
-"x~ c #2B3A3E",
-"y~ c #2A3A3C",
-"z~ c #304A52",
-"A~ c #3E6F7D",
-"B~ c #4F97AE",
-"C~ c #59BBDB",
-"D~ c #5CC2E7",
-"E~ c #5ABFE6",
-"F~ c #59BDE5",
-"G~ c #57BBE4",
-"H~ c #56B9E3",
-"I~ c #59B8E3",
-"J~ c #60B8E3",
-"K~ c #66B9E3",
-"L~ c #6BBAE3",
-"M~ c #70BAE3",
-"N~ c #75BBE3",
-"O~ c #75B9E3",
-"P~ c #67B1DF",
-"Q~ c #4DA7DC",
-"R~ c #4292BE",
-"S~ c #30302F",
-"T~ c #1C1D1F",
-"U~ c #1E1E20",
-"V~ c #191B1E",
-"W~ c #1F2225",
-"X~ c #262B2D",
-"Y~ c #212629",
-"Z~ c #27272B",
-"`~ c #121013",
-" { c #181A2C",
-".{ c #1B173B",
-"+{ c #20173A",
-"@{ c #23183D",
-"#{ c #2A1C45",
-"${ c #30234B",
-"%{ c #362751",
-"&{ c #3B2D55",
-"*{ c #403159",
-"={ c #46365F",
-"-{ c #4E3B66",
-";{ c #57426D",
-">{ c #49395D",
-",{ c #333430",
-"'{ c #2F3130",
-"){ c #151717",
-"!{ c #2D2F2F",
-"~{ c #709CA2",
-"{{ c #7FD4E2",
-"]{ c #82E3F5",
-"^{ c #8EE5F6",
-"/{ c #90E5F5",
-"({ c #8DE4F5",
-"_{ c #87E2F4",
-":{ c #82E0F4",
-"<{ c #7CDDF3",
-"[{ c #75DBF2",
-"}{ c #71D9F1",
-"|{ c #6FD8F1",
-"1{ c #6ED7F0",
-"2{ c #6CD6EF",
-"3{ c #6BD4EF",
-"4{ c #67C9E1",
-"5{ c #528F9C",
-"6{ c #2A3A3E",
-"7{ c #417B8D",
-"8{ c #50ADCD",
-"9{ c #55BCE5",
-"0{ c #54BAE4",
-"a{ c #52B7E3",
-"b{ c #50B5E2",
-"c{ c #4FB3E0",
-"d{ c #50B1E0",
-"e{ c #56B2E0",
-"f{ c #5BB2E0",
-"g{ c #60B2E0",
-"h{ c #66B2E0",
-"i{ c #69B2E0",
-"j{ c #66AFDF",
-"k{ c #51A4DB",
-"l{ c #409ED8",
-"m{ c #3B81AA",
-"n{ c #1F1F1E",
-"o{ c #1A1C1E",
-"p{ c #2B2D31",
-"q{ c #2E3033",
-"r{ c #25272B",
-"s{ c #24272A",
-"t{ c #0E0E0F",
-"u{ c #1A182D",
-"v{ c #1E1739",
-"w{ c #1F1537",
-"x{ c #23163C",
-"y{ c #27183F",
-"z{ c #2C1C46",
-"A{ c #2F214A",
-"B{ c #392A51",
-"C{ c #3E2E56",
-"D{ c #43335C",
-"E{ c #4C3664",
-"F{ c #503E68",
-"G{ c #5C4A73",
-"H{ c #423550",
-"I{ c #30312B",
-"J{ c #312F30",
-"K{ c #353333",
-"L{ c #171818",
-"M{ c #181718",
-"N{ c #2D2B29",
-"O{ c #7AC4CF",
-"P{ c #7AE3F5",
-"Q{ c #7FE2F5",
-"R{ c #87E3F5",
-"S{ c #86E2F4",
-"T{ c #7DDEF3",
-"U{ c #77DCF3",
-"V{ c #72DBF2",
-"W{ c #6ED9F1",
-"X{ c #6CD7F1",
-"Y{ c #6AD6F0",
-"Z{ c #69D5EF",
-"`{ c #67D3EF",
-" ] c #66CEE8",
-".] c #4F8E9B",
-"+] c #3C778A",
-"@] c #4CAFD5",
-"#] c #4FB6E3",
-"$] c #4DB4E1",
-"%] c #4BB1E0",
-"&] c #49AFDF",
-"*] c #48ACDE",
-"=] c #49ABDE",
-"-] c #4DABDE",
-";] c #51AADD",
-">] c #57AADD",
-",] c #5BAADD",
-"'] c #5CA9DC",
-")] c #51A2DA",
-"!] c #3C99D6",
-"~] c #3790C8",
-"{] c #282624",
-"]] c #151718",
-"^] c #232626",
-"/] c #272929",
-"(] c #1C1C20",
-"_] c #0E0F10",
-":] c #161716",
-"<] c #19132A",
-"[] c #1F1538",
-"}] c #221639",
-"|] c #25183E",
-"1] c #2A1C43",
-"2] c #33234C",
-"3] c #37284F",
-"4] c #3A2A50",
-"5] c #3F2F55",
-"6] c #4D3B64",
-"7] c #503F66",
-"8] c #624A7A",
-"9] c #3B2C48",
-"0] c #2F322E",
-"a] c #2D302F",
-"b] c #2D2E2F",
-"c] c #333131",
-"d] c #464442",
-"e] c #7ADCEC",
-"f] c #74E0F4",
-"g] c #7AE1F4",
-"h] c #7EE1F4",
-"i] c #7CDFF3",
-"j] c #78DDF3",
-"k] c #73DCF2",
-"l] c #6FDAF1",
-"m] c #6BD8F1",
-"n] c #69D7F0",
-"o] c #67D5EF",
-"p] c #65D4EF",
-"q] c #64D2EE",
-"r] c #63D1EE",
-"s] c #53A3B6",
-"t] c #3F89A5",
-"u] c #49B3E0",
-"v] c #48B0E0",
-"w] c #46ADDE",
-"x] c #44ABDE",
-"y] c #42A9DD",
-"z] c #41A6DC",
-"A] c #43A5DB",
-"B] c #46A4DA",
-"C] c #4BA3DA",
-"D] c #4EA3DA",
-"E] c #4FA1D9",
-"F] c #499DD8",
-"G] c #3895D5",
-"H] c #3492D3",
-"I] c #32749F",
-"J] c #333230",
-"K] c #0C0E0F",
-"L] c #161127",
-"M] c #211538",
-"N] c #25173E",
-"O] c #291B42",
-"P] c #2C1F43",
-"Q] c #322447",
-"R] c #37294D",
-"S] c #3B2C50",
-"T] c #403055",
-"U] c #47375E",
-"V] c #4B3B61",
-"W] c #533F65",
-"X] c #635078",
-"Y] c #342D3B",
-"Z] c #2D312D",
-"`] c #242623",
-" ^ c #2D2D2C",
-".^ c #69AEB8",
-"+^ c #73E0F3",
-"@^ c #6FDFF3",
-"#^ c #73DEF3",
-"$^ c #75DEF3",
-"%^ c #73DDF2",
-"&^ c #6FDBF2",
-"*^ c #6BD9F1",
-"=^ c #68D7F0",
-"-^ c #65D6F0",
-";^ c #64D4EF",
-">^ c #62D3EE",
-",^ c #60D1EE",
-"'^ c #5FD0ED",
-")^ c #5CC7E3",
-"!^ c #427883",
-"~^ c #315967",
-"{^ c #44A7D0",
-"]^ c #43ACDE",
-"^^ c #41AADD",
-"/^ c #40A8DC",
-"(^ c #3DA5DB",
-"_^ c #3CA2DA",
-":^ c #3CA0D9",
-"<^ c #3D9ED8",
-"[^ c #409DD8",
-"}^ c #439CD8",
-"|^ c #429AD7",
-"1^ c #3C96D5",
-"2^ c #3290D3",
-"3^ c #2F8DD2",
-"4^ c #2F7EB3",
-"5^ c #31302D",
-"6^ c #18112C",
-"7^ c #201539",
-"8^ c #24163A",
-"9^ c #28193F",
-"0^ c #2C1D44",
-"a^ c #2E2045",
-"b^ c #392B4E",
-"c^ c #3E2E51",
-"d^ c #423158",
-"e^ c #49385F",
-"f^ c #523E66",
-"g^ c #574763",
-"h^ c #5C5764",
-"i^ c #32342F",
-"j^ c #272923",
-"k^ c #6CC0CE",
-"l^ c #6CDEF3",
-"m^ c #6ADDF3",
-"n^ c #6ADCF3",
-"o^ c #6ADBF2",
-"p^ c #69DAF2",
-"q^ c #66D8F1",
-"r^ c #64D7F0",
-"s^ c #62D5F0",
-"t^ c #60D4EF",
-"u^ c #5ED2EE",
-"v^ c #5DD0EE",
-"w^ c #5BCFED",
-"x^ c #5ACDED",
-"y^ c #52B8D1",
-"z^ c #314E54",
-"A^ c #4399BC",
-"B^ c #3FAADD",
-"C^ c #3DA6DC",
-"D^ c #3BA4DB",
-"E^ c #39A1DA",
-"F^ c #389ED9",
-"G^ c #379CD8",
-"H^ c #369AD7",
-"I^ c #3798D6",
-"J^ c #3896D5",
-"K^ c #3693D4",
-"L^ c #318FD2",
-"M^ c #2C8BD1",
-"N^ c #2B89D0",
-"O^ c #2A81BE",
-"P^ c #32302F",
-"Q^ c #202221",
-"R^ c #27292A",
-"S^ c #25262B",
-"T^ c #2B2B2F",
-"U^ c #0B0D0D",
-"V^ c #1A1B18",
-"W^ c #190F31",
-"X^ c #22153A",
-"Y^ c #25173A",
-"Z^ c #2A1C40",
-"`^ c #2C1E42",
-" / c #312248",
-"./ c #332549",
-"+/ c #382A4D",
-"@/ c #3C2A53",
-"#/ c #493B5D",
-"$/ c #4A4259",
-"%/ c #404142",
-"&/ c #2C2F26",
-"*/ c #69C8D8",
-"=/ c #67DCF2",
-"-/ c #66DBF2",
-";/ c #65DAF2",
-">/ c #63D8F1",
-",/ c #61D7F1",
-"'/ c #60D6F0",
-")/ c #5ED4EF",
-"!/ c #5DD3EF",
-"~/ c #5BD1EE",
-"{/ c #59CFEE",
-"]/ c #58CEED",
-"^/ c #56CCEC",
-"// c #55CBEC",
-"(/ c #4CADC5",
-"_/ c #458FAE",
-":/ c #3CA7DC",
-"</ c #38A2DA",
-"[/ c #36A0D9",
-"}/ c #359DD8",
-"|/ c #349AD7",
-"1/ c #3298D6",
-"2/ c #3195D5",
-"3/ c #3193D4",
-"4/ c #2F90D3",
-"5/ c #2D8DD1",
-"6/ c #2B8AD1",
-"7/ c #2987CF",
-"8/ c #2885CE",
-"9/ c #2882C3",
-"0/ c #27282D",
-"a/ c #090B0B",
-"b/ c #1B1C1A",
-"c/ c #1A1131",
-"d/ c #21163A",
-"e/ c #26173B",
-"f/ c #2D1F43",
-"g/ c #312348",
-"h/ c #34254B",
-"i/ c #3A2C51",
-"j/ c #463D59",
-"k/ c #3D3A44",
-"l/ c #363735",
-"m/ c #434340",
-"n/ c #63C8DA",
-"o/ c #62DBF2",
-"p/ c #61D9F1",
-"q/ c #60D8F1",
-"r/ c #5ED6F1",
-"s/ c #5DD5F0",
-"t/ c #5BD3EF",
-"u/ c #59D2EE",
-"v/ c #58D0ED",
-"w/ c #56CFED",
-"x/ c #55CDEC",
-"y/ c #53CBEC",
-"z/ c #51C9EB",
-"A/ c #50C8EA",
-"B/ c #47A8C2",
-"C/ c #488DAA",
-"D/ c #38A4DA",
-"E/ c #349FD9",
-"F/ c #339CD8",
-"G/ c #3299D7",
-"H/ c #3097D5",
-"I/ c #2F94D4",
-"J/ c #2E91D4",
-"K/ c #2C8FD2",
-"L/ c #2B8CD1",
-"M/ c #2989D0",
-"N/ c #2887CF",
-"O/ c #2784CD",
-"P/ c #257FCB",
-"Q/ c #2179BE",
-"R/ c #284D65",
-"S/ c #3A3534",
-"T/ c #222021",
-"U/ c #1C1E23",
-"V/ c #26272A",
-"W/ c #292A2C",
-"X/ c #090A0A",
-"Y/ c #1E201F",
-"Z/ c #191234",
-"`/ c #23173A",
-" ( c #26193C",
-".( c #291D3D",
-"+( c #2C1C41",
-"@( c #33244C",
-"#( c #3A314B",
-"$( c #3A373F",
-"%( c #343533",
-"&( c #4B4A49",
-"*( c #5FC6D9",
-"=( c #5ED8F1",
-"-( c #5CD7F1",
-";( c #5BD6F0",
-">( c #5AD4F0",
-",( c #58D3EF",
-"'( c #56D1EE",
-")( c #55D0ED",
-"!( c #53CEED",
-"~( c #52CCEC",
-"{( c #50CAEB",
-"]( c #4EC8EB",
-"^( c #4DC7EA",
-"/( c #4CC5E9",
-"(( c #44A5C1",
-"_( c #4C95B4",
-":( c #36A1D9",
-"<( c #319BD7",
-"[( c #3098D6",
-"}( c #2F96D5",
-"|( c #2E93D4",
-"1( c #2C91D3",
-"2( c #2B8ED2",
-"3( c #2A8BD1",
-"4( c #2888D0",
-"5( c #2482CD",
-"6( c #207AC9",
-"7( c #1B71C4",
-"8( c #166AC1",
-"9( c #1566B0",
-"0( c #403D3D",
-"a( c #1E1D1E",
-"b( c #080A0B",
-"c( c #1C1E1E",
-"d( c #1C1337",
-"e( c #23193B",
-"f( c #271A3C",
-"g( c #271A43",
-"h( c #322A49",
-"i( c #35363D",
-"j( c #2D2F30",
-"k( c #413F3D",
-"l( c #5CC5D8",
-"m( c #59D7F1",
-"n( c #58D5F0",
-"o( c #56D3EF",
-"p( c #55D2EE",
-"q( c #53D0ED",
-"r( c #51CFED",
-"s( c #50CDEC",
-"t( c #4ECBEC",
-"u( c #4DCAEB",
-"v( c #4CC8EA",
-"w( c #4AC6E9",
-"x( c #49C4E9",
-"y( c #49C3E8",
-"z( c #42A5C1",
-"A( c #489CC2",
-"B( c #319CD7",
-"C( c #3198D6",
-"D( c #3196D5",
-"E( c #2D90D3",
-"F( c #2A8DD1",
-"G( c #2687CE",
-"H( c #207ECB",
-"I( c #1A75C6",
-"J( c #166DC2",
-"K( c #1367BF",
-"L( c #1265BE",
-"M( c #1264BD",
-"N( c #1660A3",
-"O( c #423C39",
-"P( c #1F1439",
-"Q( c #231839",
-"R( c #261F3E",
-"S( c #33323A",
-"T( c #33342D",
-"U( c #31322F",
-"V( c #54534B",
-"W( c #57C2D7",
-"X( c #55D5EF",
-"Y( c #54D3EF",
-"Z( c #52D2EE",
-"`( c #51D0ED",
-" _ c #4FCFEC",
-"._ c #4ECDEC",
-"+_ c #4DCBEB",
-"@_ c #4CCAEB",
-"#_ c #4BC8EA",
-"$_ c #49C6E9",
-"%_ c #48C4E8",
-"&_ c #46C2E8",
-"*_ c #46C1E7",
-"=_ c #3DA3BE",
-"-_ c #527787",
-";_ c #42A2D3",
-">_ c #3499D6",
-",_ c #3595D5",
-"'_ c #2E8FD2",
-")_ c #2485CD",
-"!_ c #1D7BC9",
-"~_ c #1772C5",
-"{_ c #146CC2",
-"]_ c #1369C1",
-"^_ c #1263BD",
-"/_ c #1164BD",
-"(_ c #1A568C",
-"__ c #1A1B1C",
-":_ c #232328",
-"<_ c #19181F",
-"[_ c #241F40",
-"}_ c #292534",
-"|_ c #333331",
-"1_ c #2F322B",
-"2_ c #4E4A4B",
-"3_ c #3F8E9C",
-"4_ c #3F92A2",
-"5_ c #3F91A1",
-"6_ c #3D8F9F",
-"7_ c #3D8E9E",
-"8_ c #3C8D9E",
-"9_ c #3B8C9D",
-"0_ c #3B8B9D",
-"a_ c #39899D",
-"b_ c #38889C",
-"c_ c #37889D",
-"d_ c #36879C",
-"e_ c #36879D",
-"f_ c #327789",
-"g_ c #5096B6",
-"h_ c #3BA0D9",
-"i_ c #3F9BD7",
-"j_ c #3994D4",
-"k_ c #2B88CF",
-"l_ c #1E7CC9",
-"m_ c #1672C5",
-"n_ c #146EC3",
-"o_ c #1161BC",
-"p_ c #1162B3",
-"q_ c #1D496A",
-"r_ c #101111",
-"s_ c #1F1E21",
-"t_ c #09090B",
-"u_ c #34332E",
-"v_ c #598FA8",
-"w_ c #51A9D9",
-"x_ c #3F99D6",
-"y_ c #378FD1",
-"z_ c #2882CC",
-"A_ c #1E79C8",
-"B_ c #1773C5",
-"C_ c #146FC3",
-"D_ c #1162BC",
-"E_ c #175893",
-"F_ c #444342",
-"G_ c #464642",
-"H_ c #5E93AB",
-"I_ c #56A6D2",
-"J_ c #4198D5",
-"K_ c #378CD0",
-"L_ c #2C84CC",
-"M_ c #237CC9",
-"N_ c #156FC3",
-"O_ c #1160BB",
-"P_ c #115EA8",
-"Q_ c #1B4566",
-"R_ c #5997B6",
-"S_ c #57A7D8",
-"T_ c #4598D4",
-"U_ c #3E90D2",
-"V_ c #3388CE",
-"W_ c #287FCA",
-"X_ c #1E77C6",
-"Y_ c #1670C4",
-"Z_ c #1162B7",
-"`_ c #1A4F7E",
-" : c #5595B2",
-".: c #56A2CC",
-"+: c #4DA2D9",
-"@: c #4C9BD6",
-"#: c #4594D3",
-"$: c #398BCF",
-"%: c #2C82CB",
-"&: c #2078C7",
-"*: c #1770C4",
-"=: c #1164BA",
-"-: c #185287",
-";: c #5692AC",
-">: c #4D9EC9",
-",: c #47A2D8",
-"': c #4F9FD8",
-"): c #509CD6",
-"!: c #4795D3",
-"~: c #3B8CD0",
-"{: c #2E83CB",
-"]: c #2279C7",
-"^: c #1871C4",
-"/: c #1163B9",
-"(: c #185388",
-"_: c #4892B7",
-":: c #40A0D6",
-"<: c #429BD6",
-"[: c #519FD7",
-"}: c #4F9BD6",
-"|: c #4694D3",
-"1: c #3A8CD0",
-"2: c #2F83CC",
-"3: c #237AC7",
-"4: c #1161BB",
-"5: c #1060B0",
-"6: c #195082",
-"7: c #4292B8",
-"8: c #3299D5",
-"9: c #4098D5",
-"0: c #4D9CD6",
-"a: c #4A99D5",
-"b: c #4192D2",
-"c: c #388ACF",
-"d: c #2D82CB",
-"e: c #1163BC",
-"f: c #125BA1",
-"g: c #1A4A73",
-"h: c #448FB5",
-"i: c #2C96D3",
-"j: c #3893D2",
-"k: c #4699D5",
-"l: c #4495D4",
-"m: c #3C8FD1",
-"n: c #3488CE",
-"o: c #2A81CA",
-"p: c #2178C7",
-"q: c #1164B7",
-"r: c #17568E",
-"s: c #1A3D58",
-"t: c #4A89A6",
-"u: c #3097D1",
-"v: c #2B8DD0",
-"w: c #3D94D3",
-"x: c #3D92D2",
-"y: c #2F85CD",
-"z: c #277FCA",
-"A: c #1165BE",
-"B: c #135CA1",
-"C: c #1B4C75",
-"D: c #3892C2",
-"E: c #1F88CE",
-"F: c #318DD0",
-"G: c #368ED1",
-"H: c #3289CF",
-"I: c #2B83CC",
-"J: c #237DC9",
-"K: c #1C76C6",
-"L: c #1266BE",
-"M: c #165896",
-"N: c #1B3F59",
-"O: c #438AAC",
-"P: c #218CCF",
-"Q: c #2184CD",
-"R: c #2E89CF",
-"S: c #2E87CE",
-"T: c #2881CB",
-"U: c #217BC8",
-"V: c #1B75C6",
-"W: c #1165BD",
-"X: c #175994",
-"Y: c #1C384C",
-"Z: c #3490C4",
-"`: c #1981CB",
-" < c #2282CC",
-".< c #2884CC",
-"+< c #2680CB",
-"@< c #1C3F59",
-"#< c #44819E",
-"$< c #238CCE",
-"%< c #187DCA",
-"&< c #1F7FCA",
-"*< c #227ECA",
-"=< c #207BC8",
-"-< c #1771C4",
-";< c #1C4F7B",
-">< c #3A88B4",
-",< c #1980CB",
-"'< c #177AC8",
-")< c #1B7AC8",
-"!< c #1D79C8",
-"~< c #156DC2",
-"{< c #1469C1",
-"]< c #1060BB",
-"^< c #135CA6",
-"/< c #1F3749",
-"(< c #318AC0",
-"_< c #177BC9",
-":< c #1677C7",
-"<< c #1876C6",
-"[< c #1A74C6",
-"}< c #166DC3",
-"|< c #105FBB",
-"1< c #105FBA",
-"2< c #175593",
-"3< c #2787C5",
-"4< c #1574C6",
-"5< c #1572C4",
-"6< c #166EC3",
-"7< c #156AC1",
-"8< c #105DB9",
-"9< c #105EB9",
-"0< c #195085",
-"a< c #2282C6",
-"b< c #1575C6",
-"c< c #1571C4",
-"d< c #105BB8",
-"e< c #0F5BB7",
-"f< c #1B4E7F",
-"g< c #39637B",
-"h< c #207EC5",
-"i< c #0F5AB7",
-"j< c #0F5AB6",
-"k< c #1B4D7F",
-"l< c #366279",
-"m< c #1F7BC4",
-"n< c #0F58B6",
-"o< c #0E58B4",
-"p< c #1B4C7E",
-"q< c #1E79C3",
-"r< c #0E56B5",
-"s< c #0D56B3",
-"t< c #1B4B7E",
-"u< c #386178",
-"v< c #1E77C2",
-"w< c #0D54B3",
-"x< c #0D54B2",
-"y< c #1B497E",
-"z< c #365F78",
-"A< c #1D74C1",
-"B< c #0D52B2",
-"C< c #0C52B1",
-"D< c #1A487D",
-"E< c #365E79",
-"F< c #1D72C0",
-"G< c #0C50B1",
-"H< c #0C50B0",
-"I< c #1A477D",
-"J< c #365C78",
-"K< c #1C70BE",
-"L< c #0F5DB8",
-"M< c #0E58B6",
-"N< c #0D57B5",
-"O< c #0D55B3",
-"P< c #0C53B2",
-"Q< c #0C51B1",
-"R< c #1A487E",
-"S< c #1E5786",
-"T< c #19517F",
-"U< c #194F7E",
-"V< c #184E7D",
-"W< c #184D7C",
-"X< c #174B7C",
-"Y< c #174A7B",
-"Z< c #17497B",
-"`< c #16477A",
-" [ c #164578",
-".[ c #164478",
-"+[ c #154379",
-"@[ c #154378",
-"#[ c #14447A",
-"$[ c #1A3B5D",
-"%[ c #4372A6",
-"&[ c #4276B5",
-"*[ c #3F75BB",
-"=[ c #3B71B9",
-"-[ c #366BB4",
-";[ c #3161A4",
-">[ c #375D8F",
-",[ c #45709F",
-"'[ c #346FB6",
-")[ c #336EBF",
-"![ c #4979C2",
-"~[ c #527EC4",
-"{[ c #527DC3",
-"][ c #4B77C1",
-"^[ c #3366B9",
-"/[ c #1F57B0",
-"([ c #204E99",
-"_[ c #426E9E",
-":[ c #2969B9",
-"<[ c #2863B9",
-"[[ c #4A79C2",
-"}[ c #547FC4",
-"|[ c #547EC4",
-"1[ c #537DC3",
-"2[ c #537CC3",
-"3[ c #4D76BF",
-"4[ c #2E5EB4",
-"5[ c #0F47AB",
-"6[ c #174697",
-"7[ c #2A67B4",
-"8[ c #1554B2",
-"9[ c #3469BA",
-"0[ c #4473BF",
-"a[ c #4774BF",
-"b[ c #4673BE",
-"c[ c #4571BD",
-"d[ c #4671BD",
-"e[ c #436EBB",
-"f[ c #3763B6",
-"g[ c #1749AA",
-"h[ c #083EA6",
-"i[ c #173E88",
-"j[ c #3468A2",
-"k[ c #0E51B2",
-"l[ c #1652B0",
-"m[ c #2C61B6",
-"n[ c #3265B8",
-"o[ c #3364B8",
-"p[ c #3262B7",
-"q[ c #3161B5",
-"r[ c #3260B5",
-"s[ c #315EB4",
-"t[ c #2C5AB1",
-"u[ c #1849A9",
-"v[ c #073AA3",
-"w[ c #0C3C98",
-"x[ c #2562AF",
-"y[ c #0A4AAD",
-"z[ c #0F4BAD",
-"A[ c #1B53B0",
-"B[ c #2056B1",
-"C[ c #2055B0",
-"D[ c #1F53AF",
-"E[ c #1F52AE",
-"F[ c #1F51AD",
-"G[ c #1E4FAC",
-"H[ c #1B4BAA",
-"I[ c #0E40A5",
-"J[ c #0538A1",
-"K[ c #0639A0",
-"L[ c #1B386D",
-"M[ c #1858B1",
-"N[ c #0A48AB",
-"O[ c #0946AA",
-"P[ c #0C47AA",
-"Q[ c #0E47AA",
-"R[ c #0F46A9",
-"S[ c #0E45A8",
-"T[ c #0E43A7",
-"U[ c #0E42A6",
-"V[ c #0D40A5",
-"W[ c #0A3DA3",
-"X[ c #0639A2",
-"Y[ c #0537A1",
-"Z[ c #0437A1",
-"`[ c #183775",
-" } c #1454AF",
-".} c #0944A9",
-"+} c #0843A8",
-"@} c #0841A7",
-"#} c #0740A6",
-"$} c #073EA5",
-"%} c #073DA4",
-"&} c #073BA3",
-"*} c #0435A0",
-"=} c #153674",
-"-} c #1351AB",
-";} c #073FA6",
-">} c #073CA4",
-",} c #063BA3",
-"'} c #04359F",
-")} c #04349E",
-"!} c #17336A",
-"~} c #164D9F",
-"{} c #0843A9",
-"]} c #03339E",
-"^} c #053396",
-"/} c #1B2F56",
-"(} c #194587",
-"_} c #0333A0",
-":} c #0D337F",
-"<} c #114193",
-"[} c #03329F",
-"}} c #06318D",
-"|} c #152B57",
-"1} c #193462",
-"2} c #0F3D91",
-"3} c #063CA4",
-"4} c #05308C",
-"5} c #122E64",
-"6} c #1B3053",
-"7} c #123A81",
-"8} c #083997",
-"9} c #0437A2",
-"0} c #0436A1",
-"a} c #053397",
-"b} c #0C317E",
-"c} c #152B58",
-"d} c #1A2E4D",
-"e} c #153266",
-"f} c #11326F",
-"g} c #0F306E",
-"h} c #132E64",
-"i} c #172A50",
-" ",
-" ",
-" ",
-" . + @ # $ ",
-" % & * = - ; > - , ",
-" ' ) ! ~ { ] ^ / ( _ : < [ ",
-" } | 1 2 3 4 5 6 7 8 9 0 a b c d e ",
-" f g h i j k l m n o 8 0 a p q r s t u ",
-" v w x y z A B C D E F G m m ^ H I J K L M N O ",
-" P Q $ R S T U V W X Y Z ` ...n +.@.#.$.%.&.*.=.-.;.>.,.'. ",
-" ).!.~.{.P ].^./.(._.:.<.[.}.|.1. .2.3.4.5.6.7.8.9.0.a.4.b.c.d.e. ",
-" f.g.h.i.j.k.l.m.n.o.p.q.r.s.t.u.v.w.x.y.z.A.4.B.C.D.I 7.E.F.G.H.I.J.K.L.M. ",
-" N.O.P.Q.R.S.T.l.U.V.R.W.X.Y.Z.`. +.+++@+#+` $+%+7 &+*+=+-+;+I 7.>+>+,+'+)+!+~+{+ ",
-" ]+^+/+(+_+:+<+[+}+|+1+2+3+4+5+6+7+2+8+9+0+a+b+c+d+,.G +.3.e+f+g+h+i+j+k+l+m+n+o+o+p+q+ ",
-" r+s+t+u+v+w+x+y+z+A+B+C+D+E+F+G+H+I+J+K+L+M+N+O+P+Q+R+S+T+U+V+G B.W+X+Y+Z+`+ @.@+@@@#@$@%@&@ ",
-" *@| =@-@;@>@,@'@)@!@~@{@]@^@/@(@_@:@<@[@}@|@1@1 2@3@4@5@6@7@8@9@0@^.+.B.b.g+a@G o+^.b@c@d@e@f@g@h@ ",
-" i@j@k@l@m@n@o@p@q@r@s@w+t@u@v@w@x@y@z@A@B@C@y@D@E@F@G@H@I@J@K@L@M@N@O@P@Q@B.A.R@S@T@a.U@V@W@X@Y@Z@`@ # ",
-" .# +#@###$#%#&#*#=#-#;#>#,#'#)#!#~#{#]@]#<@^#/#(#_#:#<#[#}#|#1#2#2#K@3#4#5#F.6#7#8#8#9#0#a#b#c#d#e#f#g#h#i# ",
-" j#k#l#m#n#o#p#,+q#r#s#t#u#v#=#w#x#y#`+z#A#B#C#~#D#E#F#G#w@H#I#J#K#L#M#H@N#O#P#Q#R#S#d T#U#V#@#W#X#Y#Z#`# $.$+$@$#$$$ ",
-" %$&$A.; *$=$-$>#;$>$,$'$)$!$~${$]$^$/$($_$d+:$<$[$}$!#|$1$2$2$3$4$5$6$7$L#M#8$9$0$a$b$n#c$d$e$f$g$h$$.i$j$k$l$m$n$o$p$q$r$ ",
-" s$t$u$F.v$w$x$y$z$A$B$C$D$E$F$G$H$I$J$K$L$M$N$O$P$Q$R$S$T$U$V$G@W$D#X$Y$Z$v@`$ %.%+%@%~@#%$%%%- f+&%*%=%-%;%>%,%'%)%!%~%{%]%^%/%(% ",
-" _%} :%<%,+[%}%|%1%2%3%=%4%5%6%7%8%9%0%,$a%$.b%b%c%d%e%f%g%h%i%j%k%l%9#m%J#n%o%p%q%r%s%t%7$u%v%w%x%3.C.7 F 7 L.q y%z%A%B%C%C%D%E%F%G%H%I%J% ",
-" K%- L%M%N%O%P%Q%R%S%T%U%V%5%x$W%X%Y%Z%`% &.&q#+&;@@&#&d%$&^$%&&&Q#*&=&-&T$;&>&,&q%Z$'&P+)&!&~&$##./ F 4.g$g$@.{&l%]&8.;%^&/&(&_&:&<&[&}&|&1&2& ",
-" 3&4&5&6&7&8&9&0&a&b&c&d&e&f&g&h&B$d&i&j&G$k& &s#l&m&@@n&o&p&q&r&s&t&u&v&w&x&y&z&A&B&C&D&E&%+F&G&H&I&J&@.@.@.4./ E$K&3.L&M&N&O&P&Q&R&S&T&U&V&W& ",
-" X&Y&Z&`& *.*+*@*#*$*%*&***=*-*;*`&>*,*,+'*)*.&!*K$l&~*{*]*^*/*(*_*:*<*_*[*.%4#}*=.A&|*#.D$1*2*3*4*5*6*U@4.8 g$@.3*7*B.8*9*0*a*b*c*d*e*f*g*h* ",
-" i*l#j*k*l*m*n*o*p*q*r*s*t*u*v*w*w*x*i&x*E.d.4 y*z*A*%$B*C*D*E*i%F*G*H*I*J*~&K*L*M*N*O*P*Q*R*S*T*U*V*W*7 D @.7 X*Y*Z*`* =.=+=@=#=$=%=&=*===-= ",
-" ;=>=,='=)=Q%P%9%!=~={=]=^=/=(=_=:=i+<=F$[=}=o#|=J$1=2=3=4=5=6=7=6=c+8=9=0=a=b=p c=d=Q*Q*R*3*T*e=f=g=h=i=4.3.a.o j=k=l=m=n=o=p=q=r=s=t=u=v=w= ",
-" x=Y+y=z=A=Q%B=C=D=E=F=G=H=v*I=J=J=K=L=<=A=M=N=m+O=P=Q=R=S=T=U=V=h%W=X=a.E$Y=Z=`=Z% -R*U#S*S*; Q*.-+-+-1*@-3.{&F&U@#-k=$-%-&-*-=---;->-,-'- ",
-" , )-!-~-{-]-^-O%Q%/-(-_-:-<-[-}-|-1-1-2-F$3-4-4#5-6-7-8-9-C 0-a-b-c-d-e-@-f-g-h-i-j-e-S*R*e-j-k-l- -m-Z%3*; n-o-l=p-q-r-s-t-u-v-w-x-y-z-A- ",
-" B-X*C-D-E-F$>+F-G-H-1-I-q#J-K-L->*M-F-N-O-P-|=Q-R-S-T-+&U-V-W-X-Y-=%Z-`- ;z=.;+;@;R*S*S*; d-l-k-k-l- -l-m-#;$;%;&;$#*;=;-;;;>;,;';);!; ",
-" ~;{;];^;/;(;_;,+:;J=J=<;[;};|%_=|;1;2;3;4;P-5;8.6;@&T-I$7;+;8;C-9;0;a;b;c;d;e;f;g;T*; ; R*d=k-k-*$k-l-l-h;Y*T-8.i;j;k;l;m;n;o;p;q;r; ",
-" s;I&t;u;v;w;x;y;z;A;B;C;)&D;E;}-F;G;H;I;;@7.J;m+K;L;M;S*N;O;P;Q;R;S;T;U;V;I&W;X;m-m#; 3*m-l-k-*$k-*$k-l- -6#Y;Z;<%`; >.>+>@>#>$> ",
-" %>V;&>t;*>=>->;>>>,>'>)>~-D;!>~>*>{-{>H ;+P-Q-]>^>/>m#(>`._>:><>[>}>|>1>2>3>4>5>Z%i=f$Z%d-d=k-k-k-*$*$l-l-l-m-S*6>7>8>];9>0>a>b> c>d>e>f>g>h> ",
-" i>j>k>l>m>n>o>p>q>j;r>s>t>{-u>!>5%v>u>w>y;x>y>z>A>B>8 m C>D>E>F>}>G>H>I>J>K>L>M>S*N>( -j-l-k-l-k-*$k-l- -d=Z%O>P>>#Q>R>-*S>T>U>V>W>X>Y>Z>`> ,., ,+,@,#,$,%,&,*,=, ",
-" %>-,;,>,s O%n>:;,,',B;),x*F;!,~,{,],U*P*g;g;^,/,8 (,_,:,<,[,},|,1,2,3,4,5,g$/ {;( 6,7,1*e-d=k-k-l-k-l- - -m-; @-8,9,d-l#0,a,b,c,d,e,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v, ",
-" w,x,y,z,A,K=|;B,C,D,E,J=F,G,H,I,J,K,L,M,N,O,o>P,Q,R,S,T,U,V,W,X,Y,Z,`, 'C.B.F&@-^ ^ m >,l-*$k-l- -l-l-l-e-m# -k-j-.'+'@'#'$'%'&'*'='-';'>',''')'!'~'{']'^'/'('_':'<'['}'|' ",
-" 1'2'3'4'G-:=,*5'6'7'8'9'0'a'b'c'P*d'0.e'f'g'h'i'j'k'l'm'n'o'p'q'r's't'C.D >,X-u'm v'w'x'Q**$d= - - - ->,g;Z%y'z'A'B'$'$'C'D'E'F'G'H'I'J'K'L'M'N'O'P'Q'R'S'T'U'V'W'X'Y'Z'`' ) ",
-" L%.)+)d&@)#)$)%)&)x**)=)-);)i=>),)')))!)~){)])^)/)()_):)<)[)})|)1)2)7 3.S*3)5>4)5)6)3>g$F&*$d=Z%h;; m#7)8)9)0)a)b)c)d)e)f)g)h)i)j)k)l)m)n)o)p)q)r)s)t)u)v)w)x)y)z)A)B)C)D)E) ",
-" F)G)H):=I)G;J)K)L)=>*)=)*)M)_ ; d-N)O)P)Q)R)S)T)U)V)n'W)X)Y)Z)`) !7 C.&+.!X;I&4)W*I&X*4.@.{;Q*k-j-j-~,+!@!#!B'$!%!&!*!=!-!;!>!,!'!)!!!~!{!]!^!/!(!_!:!<![!}!|!1!2!3!4!5!6!7!8! ",
-" E 9!F;0!_;a!b!c!c!d!9'e!|%f!g!h!Q*i!j!k!l!m!n!o!p!q!:)r!s!t!u!v!w!@.4.^ x!6&5>y!z!A!B!(>] C!C- -D!E!F!G!H!I!J!K!L!M!N!O!P!Q!R!S!T!U!V!W!X!Y!Z!`! ~.~+~@~#~$~%~&~*~=~-~;~>~,~'~ ",
-" )~*+M*!~O@v;<=~~L){~]~^~j;J=[%G;/~(~_~:~<~[~}~|~1~m'2~3~4~5~6~7~8~9~0~F x,-*a~X;b~c~d~e~ 1*f~g~h~i~i~j~k~l~m~n~o~p~q~r~s~t~u~v~w~x~y~z~A~B~C~D~E~F~G~H~I~J~K~L~M~N~O~P~Q~R~ ",
-" S~#;T~U~V~<=_;W~X~Y~Z~K=^-*)z,`~ {.{<~+{@{#{U,${%{&{*{={-{;{>{,{'{F X-){A!z=!{ ~{{{]{^{/{({_{:{<{[{}{|{1{2{3{4{5{6{ 7{8{9{0{a{b{c{d{e{f{g{h{i{j{k{l{m{ ",
-" n{`%>* *o{p{q{r{s{K=:=:=C$t{y,u{v{w{x{y{z{A{n'B{C{D{E{F{G{H{I{J{K{L{M{N{ O{P{Q{R{S{:{T{U{V{W{X{Y{Z{`{ ].] +]@]#]$]%]&]*]=]-];]>],]'])]!]~] ",
-" {]]]^]/](]L=L=1-(;(;K=(;_]:]<][]}]|]1]l'2]3]4]5]5~6]7]8]9]0]a]b]c]d] e]f]g]h]i]j]k]l]m]n]o]p]q]r]s] t]u]v]w]x]y]z]A]B]C]D]E]F]G]H]I] ",
-" J]m#p _;|;J=J=J=^-K=_;K]t;L][]M]N]O]P]Q]R]S]T]U]V]W]X]Y]Z]`] ^ .^+^@^#^$^%^&^*^=^-^;^>^,^'^)^!^ ~^{^]^^^/^(^_^:^<^[^}^|^1^2^3^4^ ",
-" 5^x'n>[%}-`&(;K=:=_;B$`%6^7^8^9^0^a^Q]b^c^d^e^f^g^h^i^j^ k^l^m^n^o^p^q^r^s^t^u^v^w^x^y^z^ A^B^C^D^E^F^G^H^I^J^K^L^M^N^O^ ",
-" P^Q^R^9'p S^(;:=T^U^V^W^X^Y^Z^`^ /./+/@/#/$/<>%/&/ */=/-/;/>/,/'/)/!/~/{/]/^///(/ _/:/</[/}/|/1/2/3/4/5/6/7/8/9/ ",
-" e+Y;u>D$|%B,0/B=a/b/c/d/e/Z^f/g/h/i/j/k/l/m/ n/o/p/q/r/s/t/u/v/w/x/y/z/A/B/ C/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/ ",
-" S/T/U/`&V/W/2-X/Y/Z/`/ (.(+(@(#($(%(&( *(=(-(;(>(,('()(!(~({(](^(/((( _(:(<([(}(|(1(2(3(4(5(6(7(8(9( ",
-" 0(a(*)9'H A=b(c(d(e(f(g(h(i(j(k( l(m(n(o(p(q(r(s(t(u(v(w(x(y(z( A(B(C(D(I/E(F(G(H(I(J(K(L(M(N( ",
-" O(h&*)H V/N*6%P(Q(R(S(T(U(V( W(X(Y(Z(`( _._+_@_#_$_%_&_*_=_ -_;_>_I^,_'_)_!_~_{_]_K(L(^_/_(_ ",
-" 4)__V/:_=$<_[_}_|_1_2_ 3_4_5_6_7_8_9_0_a_b_b_c_d_e_f_ g_h_i_j_k_l_m_n_{_]_K(L(^_o_p_q_ ",
-" r_o-s_t_o>X+u_ v_w_x_y_z_A_B_C_{_]_K(L(^_o_D_E_ ",
-" F_;$G_ H_I_J_K_L_M_I(N_{_]_K(L(^_o_O_P_Q_ ",
-" R_S_T_U_V_W_X_Y_{_]_K(L(^_o_O_Z_`_ ",
-" :.:+:@:#:$:%:&:*:{_]_K(L(^_o_O_=:-: ",
-" ;:>:,:':):!:~:{:]:^:{_]_K(L(^_o_O_/:(: ",
-" _:::<:[:}:|:1:2:3:^:{_]_K(L(^_o_4:5:6: ",
-" 7:8:9:0:a:b:c:d:]:^:{_]_K(L(^_o_e:f:g: ",
-" h:i:j:k:l:m:n:o:p:^:{_]_K(L(^_e:q:r:s: ",
-" t:u:v:w:x:K_y:z:X_*:{_]_K(L(^_A:B:C: ",
-" D:E:F:G:H:I:J:K:Y_{_]_K(L(^_L:M:N: ",
-" O:P:Q:R:S:T:U:V:Y_{_]_K(L(^_W:X:Y: ",
-" Z:`: <.<+<U:V:*:{_]_K(L(^_D_B:@< ",
-" #<$<%<&<*<=<K:-<{_]_K(L(^_o_/:;< ",
-" ><,<'<)<!<K:^:~<{<K(L(^_o_]<^</< ",
-" (<_<:<<<[<^:}<{<K(L(^_o_|<1<2< ",
-" 3<:<4<5<Y_6<7<K(L(^_o_|<8<9<0< ",
-" a<b<c<n_{_7<K(L(^_o_|<8<d<e<f< ",
-" g<h<c<n_{_{<K(L(^_o_|<8<d<i<j<k< ",
-" l<m<C_{_]_K(L(^_o_|<8<d<i<n<o<p< ",
-" l<q<{_]_K(L(^_o_|<8<d<i<n<r<s<t< ",
-" u<v<{<K(L(^_o_|<8<d<i<n<r<w<x<y< ",
-" z<A<K(L(^_o_|<8<d<i<n<r<w<B<C<D< ",
-" E<F<L(^_o_|<8<d<i<n<r<w<B<G<H<I< ",
-" J<K<L:/_D_]<9<L<e<M<N<O<P<Q<C<R< ",
-" S<T<U<V<W<X<Y<Z<`< [.[+[@[#[$[ ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" ",
-" %[&[*[=[-[;[>[ ",
-" ,['[)[![~[{[][^[/[([ ",
-" _[:[<[[[}[|[1[2[3[4[5[6[ ",
-" 7[8[9[0[a[b[c[d[e[f[g[h[i[ ",
-" j[k[l[m[n[o[p[q[r[s[t[u[v[w[ ",
-" x[y[z[A[B[C[D[E[F[G[H[I[J[K[L[ ",
-" M[N[O[P[Q[R[S[T[U[V[W[X[Y[Z[`[ ",
-" }O[.}+}@}#}$}%}&}X[J[Y[*}*}=} ",
-" -}.}+}@};}$}>},}X[J[Y['})})}!} ",
-" ~}{}@};}$}>},}X[J[Y['})}]}^}/} ",
-" (}+};}$}>},}X[J[Y['})}]}_}:} ",
-" <};}>},}X[J[Y['})}]}[}}}|} ",
-" 1}2}3}X[J[Y[*})}]}_}4}5} ",
-" 6}7}8}J[9}0}*}a}b}c} ",
-" d}e}f}g}h}i} ",
-" "};
diff --git a/Plugins/org.mitk.gui.qt.tofutil/src/internal/QmitkToFUtilView.cpp b/Plugins/org.mitk.gui.qt.tofutil/src/internal/QmitkToFUtilView.cpp
index 698f380ad3..33520df2fe 100644
--- a/Plugins/org.mitk.gui.qt.tofutil/src/internal/QmitkToFUtilView.cpp
+++ b/Plugins/org.mitk.gui.qt.tofutil/src/internal/QmitkToFUtilView.cpp
@@ -1,526 +1,526 @@
/*============================================================================
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.
============================================================================*/
// Blueberry
#include <mitkIRenderingManager.h>
#include <mitkIRenderWindowPart.h>
#include <mitkILinkedRenderWindowPart.h>
// Qmitk
#include "QmitkToFUtilView.h"
// Qt
#include <QMessageBox>
#include <QString>
#include <qmessagebox.h>
#include <qfiledialog.h>
#include <qcombobox.h>
// MITK
#include <mitkBaseRenderer.h>
#include <mitkToFDistanceImageToPointSetFilter.h>
#include <mitkTransferFunction.h>
#include <mitkTransferFunctionProperty.h>
#include <mitkToFDeviceFactoryManager.h>
#include <mitkToFCameraDevice.h>
#include <mitkCameraIntrinsicsProperty.h>
#include <mitkSmartPointerProperty.h>
#include <mitkRenderingModeProperty.h>
#include <mitkVtkScalarModeProperty.h>
// VTK
#include <vtkCamera.h>
#include <vtkPointData.h>
#include <vtkPolyData.h>
// ITK
#include <itkCommand.h>
#include <itksys/SystemTools.hxx>
const std::string QmitkToFUtilView::VIEW_ID = "org.mitk.views.tofutil";
//Constructor
QmitkToFUtilView::QmitkToFUtilView()
: QmitkAbstractView()
, m_Controls(nullptr)
, m_Framerateoutput(false)
, m_MitkDistanceImage(nullptr), m_MitkAmplitudeImage(nullptr), m_MitkIntensityImage(nullptr), m_Surface(nullptr)
, m_DistanceImageNode(nullptr), m_AmplitudeImageNode(nullptr), m_IntensityImageNode(nullptr), m_RGBImageNode(nullptr), m_SurfaceNode(nullptr)
, m_ToFImageRecorder(nullptr), m_ToFImageGrabber(nullptr), m_ToFDistanceImageToSurfaceFilter(nullptr), m_ToFCompositeFilter(nullptr)
, m_2DDisplayCount(0)
, m_RealTimeClock(nullptr)
, m_StepsForFramerate(100)
, m_2DTimeBefore(0.0)
, m_2DTimeAfter(0.0)
, m_CameraIntrinsics(nullptr)
{
this->m_Frametimer = new QTimer(this);
this->m_ToFDistanceImageToSurfaceFilter = mitk::ToFDistanceImageToSurfaceFilter::New();
this->m_ToFCompositeFilter = mitk::ToFCompositeFilter::New();
this->m_ToFImageRecorder = mitk::ToFImageRecorder::New();
}
//Destructor, specifically calling OnToFCameraStopped() and OnToFCammeraDiconnected()
QmitkToFUtilView::~QmitkToFUtilView()
{
OnToFCameraStopped();
OnToFCameraDisconnected();
}
//Createing the PartControl Signal-Slot principal
void QmitkToFUtilView::CreateQtPartControl( QWidget *parent )
{
// build up qt view, unless already done
if ( !m_Controls )
{
// create GUI widgets from the Qt Designer's .ui file
m_Controls = new Ui::QmitkToFUtilViewControls;
m_Controls->setupUi( parent );
//Looking for Input and Defining reaction
connect(m_Frametimer, SIGNAL(timeout()), this, SLOT(OnUpdateCamera()));
connect( (QObject*)(m_Controls->m_ToFConnectionWidget), SIGNAL(KinectAcquisitionModeChanged()), this, SLOT(OnKinectAcquisitionModeChanged()) ); // Todo in Widget2
connect( (QObject*)(m_Controls->m_ToFConnectionWidget), SIGNAL(ToFCameraConnected()), this, SLOT(OnToFCameraConnected()) );
connect( (QObject*)(m_Controls->m_ToFConnectionWidget), SIGNAL(ToFCameraDisconnected()), this, SLOT(OnToFCameraDisconnected()) );
connect( (QObject*)(m_Controls->m_ToFRecorderWidget), SIGNAL(ToFCameraStarted()), this, SLOT(OnToFCameraStarted()) );
connect( (QObject*)(m_Controls->m_ToFRecorderWidget), SIGNAL(ToFCameraStopped()), this, SLOT(OnToFCameraStopped()) );
connect( (QObject*)(m_Controls->m_ToFRecorderWidget), SIGNAL(RecordingStarted()), this, SLOT(OnToFCameraStopped()) );
connect( (QObject*)(m_Controls->m_ToFRecorderWidget), SIGNAL(RecordingStopped()), this, SLOT(OnToFCameraStarted()) );
}
}
//SetFocus-Method -> actually seting Focus to the Recorder
void QmitkToFUtilView::SetFocus()
{
m_Controls->m_ToFRecorderWidget->setFocus();
}
//Activated-Method->Generating RenderWindow
void QmitkToFUtilView::Activated()
{
//get the current RenderWindowPart or open a new one if there is none
if (this->GetRenderWindowPart(mitk::WorkbenchUtil::IRenderWindowPartStrategy::OPEN))
{
mitk::ILinkedRenderWindowPart* linkedRenderWindowPart = dynamic_cast<mitk::ILinkedRenderWindowPart*>(this->GetRenderWindowPart());
if (linkedRenderWindowPart == nullptr)
{
MITK_ERROR << "No linked render window part avaiable!!!";
}
else
{
linkedRenderWindowPart->EnableSlicingPlanes(false);
}
GetRenderWindowPart()->GetQmitkRenderWindow("axial")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Axial);
GetRenderWindowPart()->GetQmitkRenderWindow("axial")->GetSliceNavigationController()->SliceLockedOn();
GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Axial);
GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController()->SliceLockedOn();
GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Axial);
GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->GetSliceNavigationController()->SliceLockedOn();
mitk::RenderingManager::GetInstance()->InitializeViews();
this->UseToFVisibilitySettings(true);
if (this->m_ToFCompositeFilter)
{
m_Controls->m_ToFCompositeFilterWidget->SetToFCompositeFilter(this->m_ToFCompositeFilter);
}
if (this->GetDataStorage())
{
m_Controls->m_ToFCompositeFilterWidget->SetDataStorage(this->GetDataStorage());
}
if (this->m_ToFImageGrabber.IsNull())
{
m_Controls->m_ToFRecorderWidget->setEnabled(false);
m_Controls->m_ToFVisualisationSettingsWidget->setEnabled(false);
m_Controls->m_ToFCompositeFilterWidget->setEnabled(false);
m_Controls->m_ToFMeasurementWidget->setEnabled(false);
m_Controls->m_ToFSurfaceGenerationWidget->setEnabled(false);
}
}
}
//ZomnnieView-Method -> Resetting GUI to default. Why not just QmitkToFUtilView()?!
void QmitkToFUtilView::ActivatedZombieView(berry::IWorkbenchPartReference::Pointer /*zombieView*/)
{
ResetGUIToDefault();
}
void QmitkToFUtilView::Deactivated()
{
}
void QmitkToFUtilView::Visible()
{
}
//Reset of the ToFUtilView
void QmitkToFUtilView::Hidden()
{
ResetGUIToDefault();
}
void QmitkToFUtilView::OnToFCameraConnected()
{
MITK_DEBUG <<"OnToFCameraConnected";
this->m_2DDisplayCount = 0;
this->m_ToFImageGrabber = m_Controls->m_ToFConnectionWidget->GetToFImageGrabber();
// initialize surface generation
this->m_ToFDistanceImageToSurfaceFilter = mitk::ToFDistanceImageToSurfaceFilter::New();
// initialize ToFImageRecorder and ToFRecorderWidget
this->m_ToFImageRecorder = mitk::ToFImageRecorder::New();
this->m_ToFImageRecorder->SetCameraDevice(this->m_ToFImageGrabber->GetCameraDevice());
m_Controls->m_ToFRecorderWidget->SetParameter(this->m_ToFImageGrabber, this->m_ToFImageRecorder);
m_Controls->m_ToFRecorderWidget->setEnabled(true);
m_Controls->m_ToFRecorderWidget->ResetGUIToInitial();
m_Controls->m_ToFVisualisationSettingsWidget->setEnabled(false);
// initialize ToFCompositeFilterWidget
this->m_ToFCompositeFilter = mitk::ToFCompositeFilter::New();
if (this->m_ToFCompositeFilter)
{
m_Controls->m_ToFCompositeFilterWidget->SetToFCompositeFilter(this->m_ToFCompositeFilter);
}
if (this->GetDataStorage())
{
m_Controls->m_ToFCompositeFilterWidget->SetDataStorage(this->GetDataStorage());
}
if ( this->GetRenderWindowPart() )
// initialize measurement widget
m_Controls->m_ToFMeasurementWidget->InitializeWidget(this->GetRenderWindowPart()->GetQmitkRenderWindows(),this->GetDataStorage(), this->m_ToFDistanceImageToSurfaceFilter->GetCameraIntrinsics());
else
MITK_WARN << "No render window part available!!! MeasurementWidget will not work.";
this->m_RealTimeClock = mitk::RealTimeClock::New();
this->m_2DTimeBefore = this->m_RealTimeClock->GetCurrentStamp();
this->RequestRenderWindowUpdate();
}
void QmitkToFUtilView::ResetGUIToDefault()
{
if(this->GetRenderWindowPart())
{
mitk::ILinkedRenderWindowPart* linkedRenderWindowPart = dynamic_cast<mitk::ILinkedRenderWindowPart*>(this->GetRenderWindowPart());
if(linkedRenderWindowPart == nullptr)
{
MITK_ERROR << "No linked render window part avaiable!!!";
}
else
{
linkedRenderWindowPart->EnableSlicingPlanes(true);
}
GetRenderWindowPart()->GetQmitkRenderWindow("axial")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Axial);
GetRenderWindowPart()->GetQmitkRenderWindow("axial")->GetSliceNavigationController()->SliceLockedOff();
GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Sagittal);
GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->GetSliceNavigationController()->SliceLockedOff();
GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->GetSliceNavigationController()->SetDefaultViewDirection(mitk::SliceNavigationController::Frontal);
GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->GetSliceNavigationController()->SliceLockedOff();
this->UseToFVisibilitySettings(false);
//global reinit
mitk::RenderingManager::GetInstance()->InitializeViews();
this->RequestRenderWindowUpdate();
}
}
void QmitkToFUtilView::OnToFCameraDisconnected()
{
this->GetDataStorage()->Remove(m_DistanceImageNode);
if(m_RGBImageNode)
this->GetDataStorage()->Remove(m_RGBImageNode);
if(m_AmplitudeImageNode)
this->GetDataStorage()->Remove(m_AmplitudeImageNode);
if(m_IntensityImageNode)
this->GetDataStorage()->Remove(m_IntensityImageNode);
if(m_SurfaceNode)
this->GetDataStorage()->Remove(m_SurfaceNode);
m_Controls->m_ToFRecorderWidget->OnStop();
m_Controls->m_ToFRecorderWidget->setEnabled(false);
m_Controls->m_ToFVisualisationSettingsWidget->setEnabled(false);
m_Controls->m_ToFMeasurementWidget->setEnabled(false);
m_Controls->m_ToFSurfaceGenerationWidget->setEnabled(false);
//clean up measurement widget
m_Controls->m_ToFMeasurementWidget->CleanUpWidget();
}
void QmitkToFUtilView::OnKinectAcquisitionModeChanged()
{
if (m_ToFCompositeFilter.IsNotNull()&&m_ToFImageGrabber.IsNotNull())
{
if (m_SelectedCamera.contains("Kinect"))
{
if (m_ToFImageGrabber->GetBoolProperty("RGB"))
{
this->m_RGBImageNode = ReplaceNodeData("RGB image",this->m_ToFImageGrabber->GetOutput(3));
this->m_ToFDistanceImageToSurfaceFilter->SetInput(3,this->m_ToFImageGrabber->GetOutput(3));
}
else if (m_ToFImageGrabber->GetBoolProperty("IR"))
{
this->m_MitkAmplitudeImage = m_ToFCompositeFilter->GetOutput(1);
this->m_AmplitudeImageNode = ReplaceNodeData("Amplitude image",m_MitkAmplitudeImage);
}
}
this->UseToFVisibilitySettings(true);
}
}
void QmitkToFUtilView::OnToFCameraStarted()
{
if (m_ToFImageGrabber.IsNotNull())
{
// initialize camera intrinsics
if (this->m_ToFImageGrabber->GetProperty("CameraIntrinsics"))
{
m_CameraIntrinsics = dynamic_cast<mitk::CameraIntrinsicsProperty*>(this->m_ToFImageGrabber->GetProperty("CameraIntrinsics"))->GetValue();
MITK_INFO << m_CameraIntrinsics->ToString();
}
else
{
m_CameraIntrinsics = nullptr;
MITK_ERROR << "No camera intrinsics were found!";
}
// set camera intrinsics
if ( m_CameraIntrinsics.IsNotNull() )
{
this->m_ToFDistanceImageToSurfaceFilter->SetCameraIntrinsics(m_CameraIntrinsics);
}
// initial update of image grabber
this->m_ToFImageGrabber->Update();
bool hasRGBImage = false;
m_ToFImageGrabber->GetCameraDevice()->GetBoolProperty("HasRGBImage",hasRGBImage);
bool hasIntensityImage = false;
m_ToFImageGrabber->GetCameraDevice()->GetBoolProperty("HasIntensityImage",hasIntensityImage);
bool hasAmplitudeImage = false;
m_ToFImageGrabber->GetCameraDevice()->GetBoolProperty("HasAmplitudeImage",hasAmplitudeImage);
this->m_ToFCompositeFilter->SetInput(0,this->m_ToFImageGrabber->GetOutput(0));
if(hasAmplitudeImage)
this->m_ToFCompositeFilter->SetInput(1,this->m_ToFImageGrabber->GetOutput(1));
if(hasIntensityImage)
this->m_ToFCompositeFilter->SetInput(2,this->m_ToFImageGrabber->GetOutput(2));
// initial update of composite filter
this->m_ToFCompositeFilter->Update();
this->m_MitkDistanceImage = m_ToFCompositeFilter->GetOutput();
this->m_DistanceImageNode = ReplaceNodeData("Distance image",m_MitkDistanceImage);
std::string rgbFileName;
m_ToFImageGrabber->GetCameraDevice()->GetStringProperty("RGBImageFileName",rgbFileName);
if(hasRGBImage || (rgbFileName!=""))
{
if(m_ToFImageGrabber->GetBoolProperty("IR"))
{
this->m_MitkAmplitudeImage = m_ToFCompositeFilter->GetOutput(1);
}
else
{
this->m_RGBImageNode = ReplaceNodeData("RGB image",this->m_ToFImageGrabber->GetOutput(3));
}
}
else
{
this->m_RGBImageNode = nullptr;
}
if(hasAmplitudeImage)
{
this->m_MitkAmplitudeImage = m_ToFCompositeFilter->GetOutput(1);
this->m_AmplitudeImageNode = ReplaceNodeData("Amplitude image",m_MitkAmplitudeImage);
}
if(hasIntensityImage)
{
this->m_MitkIntensityImage = m_ToFCompositeFilter->GetOutput(2);
this->m_IntensityImageNode = ReplaceNodeData("Intensity image",m_MitkIntensityImage);
}
this->m_ToFDistanceImageToSurfaceFilter->SetInput(0,m_MitkDistanceImage);
this->m_ToFDistanceImageToSurfaceFilter->SetInput(1,m_MitkAmplitudeImage);
this->m_ToFDistanceImageToSurfaceFilter->SetInput(2,m_MitkIntensityImage);
this->UseToFVisibilitySettings(true);
this->m_SurfaceNode = ReplaceNodeData("Surface", nullptr);
m_Controls->m_ToFCompositeFilterWidget->UpdateFilterParameter();
// initialize visualization widget
m_Controls->m_ToFVisualisationSettingsWidget->Initialize(this->m_DistanceImageNode,
this->m_AmplitudeImageNode,
this->m_IntensityImageNode,
this->m_SurfaceNode);
m_Controls->m_ToFSurfaceGenerationWidget->Initialize(m_ToFDistanceImageToSurfaceFilter,
m_ToFImageGrabber,
m_CameraIntrinsics,
m_SurfaceNode,
GetRenderWindowPart()->GetQmitkRenderWindow("3d")->GetRenderer()->GetVtkRenderer()->GetActiveCamera());
// set distance image to measurement widget
m_Controls->m_ToFMeasurementWidget->SetDistanceImage(m_MitkDistanceImage);
this->m_Frametimer->start(50);
m_Controls->m_ToFVisualisationSettingsWidget->setEnabled(true);
m_Controls->m_ToFCompositeFilterWidget->setEnabled(true);
m_Controls->m_ToFMeasurementWidget->setEnabled(true);
m_Controls->m_ToFSurfaceGenerationWidget->setEnabled(true);
}
}
void QmitkToFUtilView::OnToFCameraStopped()
{
m_Controls->m_ToFVisualisationSettingsWidget->setEnabled(false);
m_Controls->m_ToFCompositeFilterWidget->setEnabled(false);
this->m_Frametimer->stop();
}
void QmitkToFUtilView::OnUpdateCamera()
{
if(!m_Controls->m_ToFSurfaceGenerationWidget->UpdateSurface())
{
// update pipeline
this->m_MitkDistanceImage->Update();
}
this->RequestRenderWindowUpdate();
if (m_Framerateoutput)
{
this->m_2DDisplayCount++;
if ((this->m_2DDisplayCount % this->m_StepsForFramerate) == 0)
{
this->m_2DTimeAfter = this->m_RealTimeClock->GetCurrentStamp() - this->m_2DTimeBefore;
MITK_INFO << " 2D-Display-framerate (fps): " << this->m_StepsForFramerate / (this->m_2DTimeAfter / 1000);
this->m_2DTimeBefore = this->m_RealTimeClock->GetCurrentStamp();
}
}
}
void QmitkToFUtilView::OnChangeCoronalWindowOutput(int index)
{
this->OnToFCameraStopped();
if(index == 0)
{
if(this->m_IntensityImageNode.IsNotNull())
this->m_IntensityImageNode->SetVisibility(false);
if(this->m_RGBImageNode.IsNotNull())
this->m_RGBImageNode->SetVisibility(true);
}
else if(index == 1)
{
if(this->m_IntensityImageNode.IsNotNull())
this->m_IntensityImageNode->SetVisibility(true);
if(this->m_RGBImageNode.IsNotNull())
this->m_RGBImageNode->SetVisibility(false);
}
this->RequestRenderWindowUpdate();
this->OnToFCameraStarted();
}
mitk::DataNode::Pointer QmitkToFUtilView::ReplaceNodeData( std::string nodeName, mitk::BaseData* data )
{
mitk::DataNode::Pointer node = this->GetDataStorage()->GetNamedNode(nodeName);
if (node.IsNull())
{
node = mitk::DataNode::New();
node->SetName(nodeName);
node->SetBoolProperty("binary",false);
node->SetData(data);
this->GetDataStorage()->Add(node);
}
else
{
node->SetData(data);
}
return node;
}
void QmitkToFUtilView::UseToFVisibilitySettings(bool useToF)
{
//We need this property for every node.
mitk::RenderingModeProperty::Pointer renderingModePropertyForTransferFunction = mitk::RenderingModeProperty::New(mitk::RenderingModeProperty::COLORTRANSFERFUNCTION_COLOR);
// set node properties
if (m_DistanceImageNode.IsNotNull())
{
this->m_DistanceImageNode->SetProperty( "visible" , mitk::BoolProperty::New( true ));
- this->m_DistanceImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->GetRenderWindow() ) );
- this->m_DistanceImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->GetRenderWindow() ) );
- this->m_DistanceImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("3d")->GetRenderWindow() ) );
+ this->m_DistanceImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->renderWindow() ) );
+ this->m_DistanceImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->renderWindow() ) );
+ this->m_DistanceImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("3d")->renderWindow() ) );
this->m_DistanceImageNode->SetProperty("Image Rendering.Mode", renderingModePropertyForTransferFunction);
}
if (m_AmplitudeImageNode.IsNotNull())
{
- this->m_AmplitudeImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("axial")->GetRenderWindow() ) );
- this->m_AmplitudeImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->GetRenderWindow() ) );
- this->m_AmplitudeImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("3d")->GetRenderWindow() ) );
+ this->m_AmplitudeImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("axial")->renderWindow() ) );
+ this->m_AmplitudeImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->renderWindow() ) );
+ this->m_AmplitudeImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("3d")->renderWindow() ) );
this->m_AmplitudeImageNode->SetProperty("Image Rendering.Mode", renderingModePropertyForTransferFunction);
}
if (m_IntensityImageNode.IsNotNull())
{
this->m_IntensityImageNode->SetProperty( "visible" , mitk::BoolProperty::New( true ));
- this->m_IntensityImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("axial")->GetRenderWindow() ) );
- this->m_IntensityImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->GetRenderWindow() ) );
- this->m_IntensityImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("3d")->GetRenderWindow() ) );
+ this->m_IntensityImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("axial")->renderWindow() ) );
+ this->m_IntensityImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->renderWindow() ) );
+ this->m_IntensityImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("3d")->renderWindow() ) );
this->m_IntensityImageNode->SetProperty("Image Rendering.Mode", renderingModePropertyForTransferFunction);
}
if ((m_RGBImageNode.IsNotNull()))
{
this->m_RGBImageNode->SetProperty( "visible" , mitk::BoolProperty::New( true ));
- this->m_RGBImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("axial")->GetRenderWindow() ) );
- this->m_RGBImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->GetRenderWindow() ) );
- this->m_RGBImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("3d")->GetRenderWindow() ) );
+ this->m_RGBImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("axial")->renderWindow() ) );
+ this->m_RGBImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("sagittal")->renderWindow() ) );
+ this->m_RGBImageNode->SetVisibility( !useToF, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("3d")->renderWindow() ) );
}
// initialize images
if (m_MitkDistanceImage.IsNotNull())
{
mitk::RenderingManager::GetInstance()->InitializeViews(
this->m_MitkDistanceImage->GetTimeGeometry(), mitk::RenderingManager::REQUEST_UPDATE_2DWINDOWS, true);
}
if(this->m_SurfaceNode.IsNotNull())
{
QHash<QString, QmitkRenderWindow*> renderWindowHashMap = this->GetRenderWindowPart()->GetQmitkRenderWindows();
QHashIterator<QString, QmitkRenderWindow*> i(renderWindowHashMap);
while (i.hasNext()){
i.next();
- this->m_SurfaceNode->SetVisibility( false, mitk::BaseRenderer::GetInstance(i.value()->GetRenderWindow()) );
+ this->m_SurfaceNode->SetVisibility( false, mitk::BaseRenderer::GetInstance(i.value()->renderWindow()) );
}
- this->m_SurfaceNode->SetVisibility( true, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("3d")->GetRenderWindow() ) );
+ this->m_SurfaceNode->SetVisibility( true, mitk::BaseRenderer::GetInstance(GetRenderWindowPart()->GetQmitkRenderWindow("3d")->renderWindow() ) );
}
//disable/enable gradient background
this->GetRenderWindowPart()->EnableDecorations(!useToF, QStringList(QString("background")));
if((this->m_RGBImageNode.IsNotNull()))
{
bool RGBImageHasDifferentResolution = false;
m_ToFImageGrabber->GetCameraDevice()->GetBoolProperty("RGBImageHasDifferentResolution",RGBImageHasDifferentResolution);
if(RGBImageHasDifferentResolution)
{
//update the display geometry by using the RBG image node. Only for renderwindow coronal
- mitk::RenderingManager::GetInstance()->InitializeView( GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->GetRenderWindow(), this->m_RGBImageNode->GetData()->GetGeometry() );
+ mitk::RenderingManager::GetInstance()->InitializeView( GetRenderWindowPart()->GetQmitkRenderWindow("coronal")->renderWindow(), this->m_RGBImageNode->GetData()->GetGeometry() );
}
}
}
diff --git a/Plugins/org.mitk.gui.qt.ultrasound/documentation/UserManual/QmitkUltrasound.dox b/Plugins/org.mitk.gui.qt.ultrasound/documentation/UserManual/QmitkUltrasound.dox
index 4abc2ba488..3db5043352 100644
--- a/Plugins/org.mitk.gui.qt.ultrasound/documentation/UserManual/QmitkUltrasound.dox
+++ b/Plugins/org.mitk.gui.qt.ultrasound/documentation/UserManual/QmitkUltrasound.dox
@@ -1,95 +1,95 @@
/**
\page org_mitk_gui_qt_ultrasound The Ultrasound Plugin
\imageMacro{QmitkUltrasound_Icon.png,"Icon of the Ultrasound Plugin",2.12}
\tableofcontents
\section org_mitk_gui_qt_ultrasoundOverview Overview
This plugin offers a simple interface to create and manage ultrasound devices.
Devices, once configured, will be stored and loaded on the next start of MITK.
One can configure several aspects of the images acquired.
Last but not least, this plugin makes the configured devices available as a
microservice, exposing them for further usage in other plugins.
\section org_mitk_gui_qt_ultrasoundPrerequisites Prerequisites
To make use of this plugin, you obviously require an ultrasound device.
The device must have a video output or must be one of the supported API devices
(at the moment only Telemed LogicScan 128 is supported as an API device.
Typical video outputs are: HDMI, DVI, VGA and S-Video.
You also need a Video-Grabber that can acquire the image data from the
ultrasound device. In principal, this plugin is compatible with any grabber
that allows the operating system to access it's functionality.
However, not all grabbers are created equal. Make sure your grabber supports
the video-out offered by your ultrasound device and that it can achieve a
satisfying framerate. We have made good experiences with epiphan Grabbers and
currently recommend the <a
-href="http://www.epiphan.com/products/dvi-frame-grabbers/dvi2usb-3-0/">Epiphan
+href="https://www.epiphan.com/products/dvi2usb-3-0/">Epiphan
DVI2USB 3.0 device</a> which supports HDMI, DVI and VGA, but less costly
grabbers certainly are an option.
\section org_mitk_gui_qt_ultrasoundCreateDevice Creating an Device
To configure an ultrasound device as a video device, connect it to the grabber
and the grabber to the computer. Start the ultrasound device and open the
ultrasound plugin. The devicemanager will open.
\imageMacro{QmitkUltrasound_DeviceManagement.png,"MITK Screenshot With the Device Manager Activated",7.54}
Any currently configured devices are listed in the box, which accordingly is
empty now.
The creation of API devices depends on the device. A Telemed device would be
listed in the box if this version of MITK was compiled with support for Telemed
-devices (see \link USHardwareTelemedPage\endlink). Such a device requires no
+devices (see \link USHardwareTelemedPage \endlink). Such a device requires no
configuration.
Click "New Video Device" if you want to create a new video device.
\imageMacro{QmitkUltrasound_NewVideoDevice.png,"The 'New Device' form",7.62}
In the appearing form, enter descriptive data on your device in the
corresponding fields. Manufacturer and model will be used to display the device
in MITK.
You may choose the video source ID if more than one is available (as is the
case on laptops with built-in webcams). Try 0 and 1. If the wrong camera is
addressed, simply try the next ID.
Most ultrasound images are grey scale, so using a grey scale conversion doesn't
take information away from the image, but makes processing images significantly
faster. Only uncheck this box if you require color.
Click "Add Video Device" to save your changes.
\imageMacro{QmitkUltrasound_DeviceManagement2.png,"Devicemanager With a Configured Device",7.64}
An ultrasound device in MITK can be activated or removed. Removing may not be
available for some API devices. The device you just created is available to all
other plugins in MITK, but does not yet generate image data. Activating the
device will start image generating.
\section org_mitk_gui_qt_ultrasoundUseDevice Using an Ultrasound Device
Click the device, then click "Activate Device". The device is now activated and
generates image data continuously. The device is listed in the box on the
bottom of the view now. Viewing of the image data can be started by selecting
the device in this list and click the "Start Viewing" button.
\imageMacro{QmitkUltrasound_Imaging.png,"US Imaging Tab for a Video Device",7.60}
You can adjust the cropping parameters to reduce the acquired image size which
will further increase speed and remove unnecessary information.
All changes are saved and restored whenever MITK is started.
If an API device was selected, buttons for controlling the b mode imaging may
be available. This depends on the implementation of a control interface for
this specific device in MITK.
\imageMacro{QmikUltrasound_BModeControls.png,"B Mode Controls for an API Device",7}
*/
diff --git a/Plugins/org.mitk.gui.qt.volumevisualization/documentation/UserManual/QmitkVolumeVisualization.dox b/Plugins/org.mitk.gui.qt.volumevisualization/documentation/UserManual/QmitkVolumeVisualization.dox
index c1c47212a6..267ea020c8 100644
--- a/Plugins/org.mitk.gui.qt.volumevisualization/documentation/UserManual/QmitkVolumeVisualization.dox
+++ b/Plugins/org.mitk.gui.qt.volumevisualization/documentation/UserManual/QmitkVolumeVisualization.dox
@@ -1,140 +1,140 @@
/**
\page org_mitk_views_volumevisualization The Volume Visualization Plugin
-\imageMacro{volume_visualization.svg,"Icon of the Volume Visualization Plugin",2.00}
+\imageMacro{volume_visualization-dox.svg,"Icon of the Volume Visualization Plugin",2.00}
\tableofcontents
\section QVV_Overview Overview
The <b> Volume Visualization Plugin </b> is a basic tool for volume rendering of three dimensional medical images.
MITK provides generic transfer function presets for medical CT and MRT data.
These functions that map the gray-value to color and opacity can be interactively edited.
Additionally, there are controls to quickly generate commonly used transfer function shapes like the threshold and bell curve to help identify a range of grey-values.
\imageMacro{QmitkVolumeVisualization_Overview.png,"",16.00}
\section QVV_EnableVRPage Volume Rendering
\subsection QVV_LoadingImage Select an image and enable volume rendering
\imageMacro{QmitkVolumeVisualization_Checkboxen.png,"",8.21}
Select an image on top of the view and click on the checkbox left of 'Volumerendering'. Please be patient, while the image is prepared for rendering, which can take up to a half minute.
\note
Volume Visualization imposes following restrictions on images:
<ul>
<li> It has to be a 3D scalar image, that means e.g. a CT or MRT image.
<li> 3D+t images are supported for rendering, but the histograms are not computed.
<li> Also be aware that volume visualization requires a huge amount of memory. Very large images may not work unless you use the 64bit version.
</ul>
\subsection QVV_LODGPU Dropdown menus for the rendering and blend modes
Two dropdown menus are located right next to the 'Volumerendering' checkbox. They allow you to select a rendering mode (Default, RayCast, GPU) and the blend mode (Composite, Max, Min, Avg, Add).
Any rendering mode requires a lot of computing resources including processor, memory and often also graphics card.
The 'Default' selection usually finds the best 'rendering' mode for the available hardware.
Alternatively, it is possible to manually specify the selections 'RayCast' and 'GPU'.
The 'RayCast' selection is based on CPU computation and therefore typically slow, but allows to render without hardware acceleration.
The 'GPU' selection uses computing resources on the graphics card to accelerate volume rendering.
It requires a powerful graphics card and OpenGL hardware support for shaders but achieves much higher frame rates than software-rendering.
Blend modes define how the volume voxels, intersected by the rendering rays, are pooled. The 'Composite' mode specifies standard volume rendering,
for which each voxel contributes equally with opacity and color. Other 'blend' modes simply visualize the voxel of the maximum /
minimum intensity and average / add the intensities along the rendering ray.
\section QVV_PresetPage Applying premade presets
\subsection QVV_Preset Internal presets
There are some internal presets given that can be used with normal CT data (given in Houndsfield units).
A large set of medical data has been tested with those presets, but they may not suit some special cases.
Click on the 'Preset' tab for using internal or custom presets.
\imageMacro{QmitkVolumeVisualization_InternalPresets.png,"",8.30}
<ul>
<li> 'CT Generic' is the default transfer function that is first applied.
<li> 'CT Black&White' does not use any colors for the volume visualization as it may be distracting on some data.
<li> 'CT Cardiac' is well-suited for CT images containing the heart.
<li> 'CT Bone' emphasizes bones and shows other areas more transparent.
<li> 'CT Bone (Gradient)' is like 'CT Bone' but shows only the surface from other organs by using the gradient.
<li> 'MR Generic' is the default transfer function that can be used on MRT data (which is not normalized like CT data).
<li> 'CT Thorax small' is useful if only a proportion of the thorax is selected to emphasize details.
<li> 'CT Thorax large' is useful if a large proportion or the entire thorax is selected to emphasize details.
</ul>
\subsection QVV_CustomPreset Saving and loading custom presets
After creating or editing a transfer function (see \ref QVV_Editing or \ref QVV_ThresholdBell),
the custom transfer function can be stored and later retrieved on the filesystem.
Click 'Save' (respectively 'Load') button below the preset selection to save (load) the threshold-, color- and gradient function combined in a single .xml file.
\section QVV_ThresholdBell Interactively create transfer functions
Besides the possibility to directly edit the transfer functions (\ref QVV_Editing), the plugin provides two commonly known shapes to quickly generate transfer functions with a few clicks. Both generators have two parameters that can be modified by first clicking on the cross and then moving the mouse up/down and left/right.
The first parameter 'center' (controlled by horizontal movement of the mouse) specifies the gray value where the center of the shape will be located.
The second parameter 'width' (controlled by vertical movement of the mouse) specifies the width (or steepness) of the shape.
\subsection Threshold
Click on the 'Threshold' tab to activate the threshold function generator.
\imageMacro{QmitkVolumeVisualization_Threshold.png,"",8.21}
A threshold shape begins with zero and raises to one across the 'center' parameter. Lower widths result in steeper threshold functions.
\subsection Bell
Click on the 'Bell' tab to activate the bell-shaped threshold function generator.
\imageMacro{QmitkVolumeVisualization_Bell.png,"",8.23}
A threshold shape begins with zero and raises to one at the 'center' parameter and then lowers again to zero. The 'width' parameter corresponds to the width of the bell.
\section QVV_Editing Customize transfer functions in detail
\subsection QVV_Navigate Choosing gray value interval to edit
\imageMacro{QmitkVolumeVisualization_Slider.png,"",8.23}
To navigate across the gray value range or to zoom in some ranges use the 'range'-slider.
All three function editors have in common following:
<ul>
<li> By left-clicking a new point is added.
<li> By right-clicking a point is deleted.
<li> By left-clicking and holding, an exisiting point can be dragged.
<li> By pressing arrow keys, the currently selected point is moved.
<li> By pressing the 'DELETE' key, the currently selected point is deleted.
<li> Between points the transferfunctions are linear interpolated.
</ul>
There are three transfer functions to customize:
\subsection QVV_GO Grayvalue -> Opacity
\imageMacro{QmitkVolumeVisualization_Opacity.png,"Gray values will be mapped to opacity.",8.04}
An opacity of 0 means total transparent, an opacity of 1 means total opaque. The opacity editor allows changing the opacity for all gray values independently. You can alter the position of control points using your mouse. You can add control points by left-clicking on the graph. To remove a control point again you can right-click on the respective point.
\subsection QVV_GC Grayvalue -> Color
\imageMacro{QmitkVolumeVisualization_Color.png,"Gray values will be mapped to color.",8.81}
The color transfer function editor also allows you to change its color by double-clicking a point. You can add color control points by left-clicking on the color bar. To remove a control point again right-click on the respective point.
\subsection QVV_GGO Grayvalue and Gradient -> Opacity
\imageMacro{QmitkVolumeVisualization_Gradient.png,"",8.85}
The gradient editor allows you to change the gradient influence for all gray values independently. You can move the existing control points using your mouse. Additionally, you can add control points by left-clicking on the graph. To remove a control point again, right-click on the respective point.
*/
diff --git a/Plugins/org.mitk.gui.qt.volumevisualization/documentation/UserManual/QmitkVolumeVisualization_Icon.png b/Plugins/org.mitk.gui.qt.volumevisualization/documentation/UserManual/QmitkVolumeVisualization_Icon.png
deleted file mode 100644
index 3813d0a639..0000000000
Binary files a/Plugins/org.mitk.gui.qt.volumevisualization/documentation/UserManual/QmitkVolumeVisualization_Icon.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.volumevisualization/documentation/UserManual/volume_visualization.svg b/Plugins/org.mitk.gui.qt.volumevisualization/documentation/UserManual/volume_visualization-dox.svg
similarity index 100%
rename from Plugins/org.mitk.gui.qt.volumevisualization/documentation/UserManual/volume_visualization.svg
rename to Plugins/org.mitk.gui.qt.volumevisualization/documentation/UserManual/volume_visualization-dox.svg
diff --git a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/QmitkXnatPluginManual.dox b/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/QmitkXnatPluginManual.dox
index c83dcee11d..d25bb1c70d 100644
--- a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/QmitkXnatPluginManual.dox
+++ b/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/QmitkXnatPluginManual.dox
@@ -1,113 +1,113 @@
/**
\page org_mitk_gui_qt_xnat The XNAT Plugin
\imageMacro{xnat-docu-icon.png,"Icon of XNAT Plugin",1.00}
\tableofcontents
\section org_mitk_gui_qt_xnatOverview Overview
This plug-in is allows the communication with a XNAT server from within MITK.
The benefits of this plug-in are:
<ul>
<li>Browsing through the XNAT data hierarchy
<li>Downloading data and visualize/process it in the MITK Workbench
<li>Uploading data from within the MITK Workbench
</ul>
\imageMacro{QmitkXnat_IMGTreeBrowser.png,"The XNAT tree-browser plugin", 6.00}
\section org_mitk_gui_qt_xnatConnection Connect to XNAT
For communicating with XNAT you have to connect to your XNAT instance.
\subsection org_mitk_gui_qt_xnatPreferences XNAT preferences
In order to establish the connection to XNAT you have to specify the XNAT server address, username and password in the XNAT preference page.
It is also possible to specify a network proxy if you are behind one (this could lead to connection errors).
Via the download path you can tell MITK where to save the data that is uploaded or downloaded.
A screenshot of the preference page can be seen below.
\imageMacro{QmitkXnat_IMGPreferences.png,"The XNAT preference page", 10.00}
\subsection org_mitk_gui_qt_xnatSessionHandling Session time-out handling
Once you are connected to XNAT, MITK takes care about the session handling. A existing XNAT session times out after a certain period of inactivity, usually after 15 minutes.
One minute before session time-out MITK asks you to renew the session:
\imageMacro{QmitkXnat_IMGSessionAboutToTimeOut.png,"Notification that the session will time-out in a minute", 6.00}
If you do not renew the session MITK notifies you if the session has expired:
\imageMacro{QmitkXnat_IMGSessionExpired.png,"Notification that the session has expired", 6.00}
\section org_mitk_gui_qt_xnatBrowsing Browse data
Once you are connected to XNAT, MITK displays the XNAT data hierachy as a tree within the XNAT tree browser.
You can browse through the data by expanding the tree items ( which ist also possible via double click).
If you hover the mouse cursor over an item you will see a tool tip with detailed information.
The following table gives an overview about the icons of the treeview and the related XNAT objects
<table>
<caption id="multi_row">XNAT Icon Overview</caption>
<tr><th>Icon <th>XNAT object
-<tr><td>\imageMacro{xnat-server.png, "" ,0.50} <td>XNAT Server
-<tr><td>\imageMacro{xnat-project.png, "" ,0.50} <td>XNAT Project
-<tr><td>\imageMacro{xnat-subject.png, "" ,0.50} <td>XNAT Subject
-<tr><td>\imageMacro{xnat-experiment.png, "" ,0.50} <td>XNAT Experiment
-<tr><td>\imageMacro{xnat-folder-icon.png, "" ,0.50} <td>XNAT Scan top-level folder
-<tr><td>\imageMacro{xnat-scan.png, "" ,0.50} <td>XNAT Scan
-<tr><td>\imageMacro{xnat-folder-icon.png, "" ,0.50} <td>XNAT Resource top-level folder
-<tr><td>\imageMacro{xnat-resource.png, "" ,0.50} <td>XNAT Resource folder
-<tr><td>\imageMacro{xnat-file.png, "" ,0.50} <td>XNAT File
+<tr><td>\image html xnat-server.png <td>XNAT Server
+<tr><td>\image html xnat-project.png <td>XNAT Project
+<tr><td>\image html xnat-subject.png <td>XNAT Subject
+<tr><td>\image html xnat-experiment.png <td>XNAT Experiment
+<tr><td>\image html xnat-folder-icon.png <td>XNAT Scan top-level folder
+<tr><td>\image html xnat-scan.png <td>XNAT Scan
+<tr><td>\image html xnat-folder-icon.png <td>XNAT Resource top-level folder
+<tr><td>\image html xnat-resource.png <td>XNAT Resource folder
+<tr><td>\image html xnat-file.png <td>XNAT File
</table>
If you have selected a XNAT project, subject or experiment, MITK displays detailed information in a separate info area below the tree browser
\section org_mitk_gui_qt_xnatDownload Download data
MITK allows you to download your data from XNAT. You can either simply download the data to your file system or your can download it and open it immediately in the workbench.
\subsection org_mitk_gui_qt_xnatDownload_file_system Download data to file system
If you just want to download data, simply right-click on a XNAT file or scan on the tree brower and select "Download". The data will be stored in the specified download location.
\subsection org_mitk_gui_qt_xnatDownload_in_MITK Download data and open it in MITK
You can download and open data in three ways:
<ul>
<li>One is via right-click on a file or scan and selecting "Download and open".
<li>You can also double-click on a file or scan. MITK will then ask you if you want to download and open the data.
<li>The other one is via selecting a file or scan with left-click and then click on the download button above the tree view
</ul>
\imageMacro{QmitkXnat_IMGDownloadButton.png,"The XNAT dowload button", 16.00}
\section org_mitk_gui_qt_xnatUpload Upload data
You can also upload data to XNAT from within the workbench. Please note that it is currently only possible to upload files as resources. Uploading DICOMs is not yet available.
\subsection org_mitk_gui_qt_xnatUpload1 Upload from file system
If you just want to upload a local file, right-click on a resource and select "Upload". A file dialog will open, which allows you to select a file for upload.
\subsection org_mitk_gui_qt_xnatUpload2 Upload via data manager
If you want to upload data from within the MITK Workbench you can simply right-click on the data node in the data manager and select "Upload to XNAT".
An "XNAT Upload dialog" will appear:
\imageMacro{QmitkXnat_IMGUploadDialog.png,"The XNAT upload dialog", 16.00}
You can then either select a existing resource folder if MITK is able to find ones or you can select the upload destination in a tree view.
\subsection org_mitk_gui_qt_xnatUpload3 Upload via drag and drop
Another way to upload the data is to drag the data node on the XNAT resource where you want to upload it to.
\subsection org_mitk_gui_qt_xnatUpload4 Upload via XNAT Plugin
Finally, if you select a data node and you select a XNAT resource, the upload button of the XNAT plugin will be enabled. If you click on that, the data will be uploaded.
\imageMacro{QmitkXnat_IMGUploadButton.png,"The XNAT upload button", 16.00}
\section org_mitk_gui_qt_xnatAddResourceFolder Create a resource folder
You can also create new resources (i.e. folders to group your files in XNAT). Therefor you can either right-click on a project, subject, experiment or scan and enter the name
of the folder in the appearing dialog. Or you simply select one of these items and click on the "Add folder button" above the tree browser.
\imageMacro{QmitkXnat_IMGAddFolderButton.png,"The XNAT add folder button", 16.00}
\subsection org_mitk_gui_qt_xnatCreateSubject Create a subject
You can create subjects by right-clicking on a project and selecting "Create new subject".
A dialog will appear where you have to enter the subject information.
\subsection org_mitk_gui_qt_xnatCreateExperiment Create a experiment
You can create experiments by right-clicking on a subject and selecting "Create new experiment".
A dialog will appear where you have to enter the experiment information.
*/
diff --git a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-experiment.png b/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-experiment.png
deleted file mode 100644
index 41ba791449..0000000000
Binary files a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-experiment.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-file.png b/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-file.png
deleted file mode 100644
index 17c7ad04e1..0000000000
Binary files a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-file.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-project.png b/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-project.png
deleted file mode 100644
index 2fc1684f99..0000000000
Binary files a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-project.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-resource.png b/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-resource.png
deleted file mode 100644
index 0b13723fb1..0000000000
Binary files a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-resource.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-scan.png b/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-scan.png
deleted file mode 100644
index 778521828e..0000000000
Binary files a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-scan.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-server.png b/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-server.png
deleted file mode 100644
index 911a7d7acc..0000000000
Binary files a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-server.png and /dev/null differ
diff --git a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-subject.png b/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-subject.png
deleted file mode 100644
index 042140d37b..0000000000
Binary files a/Plugins/org.mitk.gui.qt.xnat/documentation/UserManual/xnat-subject.png and /dev/null differ
diff --git a/SuperBuild.cmake b/SuperBuild.cmake
index 683b5634cf..9ca98ed3e1 100644
--- a/SuperBuild.cmake
+++ b/SuperBuild.cmake
@@ -1,510 +1,503 @@
#-----------------------------------------------------------------------------
# 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)
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)
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()
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)
include(mitkMacroQueryCustomEPVars)
include(mitkFunctionInstallExternalCMakeProject)
include(mitkFunctionCleanExternalProject)
option(MITK_AUTOCLEAN_EXTERNAL_PROJECTS "Experimental: Clean external project builds if updated" OFF)
mark_as_advanced(MITK_AUTOCLEAN_EXTERNAL_PROJECTS)
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()
set(gen_platform ${CMAKE_GENERATOR_PLATFORM})
# 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()
if(MITK_USE_Boost_LIBRARIES)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_ALL_DYN_LINK")
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=<INSTALL_DIR>
-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}
)
if(MSVC_VERSION)
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=<INSTALL_DIR>;${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})
set(p_hash "")
set(p_file "${CMAKE_SOURCE_DIR}/CMakeExternals/${p}.cmake")
if(EXISTS ${p_file})
file(MD5 ${p_file} p_hash)
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)
+ foreach(MITK_EXTENSION_DIR ${MITK_ABSOLUTE_EXTENSION_DIRS})
+ set(MITK_CMAKE_EXTERNALS_EXTENSION_DIR "${MITK_EXTENSION_DIR}/CMakeExternals")
set(p_file "${MITK_CMAKE_EXTERNALS_EXTENSION_DIR}/${p}.cmake")
- if(EXISTS ${p_file})
- file(MD5 ${p_file} p_hash)
+ if(EXISTS "${p_file}")
+ file(MD5 "${p_file}" p_hash)
break()
endif()
endforeach()
endif()
if(p_hash)
set(p_hash_file "${ep_prefix}/tmp/${p}-hash.txt")
if(MITK_AUTOCLEAN_EXTERNAL_PROJECTS)
- if(EXISTS ${p_hash_file})
- file(READ ${p_hash_file} p_prev_hash)
+ if(EXISTS "${p_hash_file}")
+ file(READ "${p_hash_file}" p_prev_hash)
if(NOT p_hash STREQUAL p_prev_hash)
mitkCleanExternalProject(${p})
endif()
endif()
endif()
- file(WRITE ${p_hash_file} ${p_hash})
+ file(WRITE "${p_hash_file}" ${p_hash})
endif()
- include(${p_file} OPTIONAL)
+ include("${p_file}" OPTIONAL)
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_USE_OpenMP
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_Python3)
list(APPEND mitk_optional_cache_args
-DMITK_USE_Python3:BOOL=${MITK_USE_Python3}
"-DPython3_EXECUTABLE:FILEPATH=${Python3_EXECUTABLE}"
"-DPython3_INCLUDE_DIR:PATH=${Python3_INCLUDE_DIRS}"
"-DPython3_LIBRARY:FILEPATH=${Python3_LIBRARY}"
"-DPython3_STDLIB:FILEPATH=${Python3_STDLIB}"
"-DPython3_SITELIB:FILEPATH=${Python3_SITELIB}"
)
endif()
if(OPENSSL_ROOT_DIR)
list(APPEND mitk_optional_cache_args
"-DOPENSSL_ROOT_DIR:PATH=${OPENSSL_ROOT_DIR}"
)
endif()
if(CMAKE_FRAMEWORK_PATH)
list(APPEND mitk_optional_cache_args
"-DCMAKE_FRAMEWORK_PATH:PATH=${CMAKE_FRAMEWORK_PATH}"
)
endif()
if(Eigen_INCLUDE_DIR)
list(APPEND mitk_optional_cache_args
-DEigen_INCLUDE_DIR:PATH=${Eigen_INCLUDE_DIR}
)
endif()
# Optional pass through of Doxygen
if(DOXYGEN_EXECUTABLE)
list(APPEND mitk_optional_cache_args
-DDOXYGEN_EXECUTABLE:FILEPATH=${DOXYGEN_EXECUTABLE}
)
endif()
if(MITK_DOXYGEN_BUILD_ALWAYS)
list(APPEND mitk_optional_cache_args
-DMITK_DOXYGEN_BUILD_ALWAYS:BOOL=${MITK_DOXYGEN_BUILD_ALWAYS}
)
endif()
-if(BLUEBERRY_DOC_TOOLS_DIR)
- list(APPEND mitk_optional_cache_args
- "-DBLUEBERRY_DOC_TOOLS_DIR:PATH=${BLUEBERRY_DOC_TOOLS_DIR}"
- )
-endif()
-
set(proj MITK-Configure)
ExternalProject_Add(${proj}
LIST_SEPARATOR ${sep}
DOWNLOAD_COMMAND ""
CMAKE_GENERATOR ${gen}
CMAKE_GENERATOR_PLATFORM ${gen_platform}
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}
-DMITK_FAST_TESTING:BOOL=${MITK_FAST_TESTING}
-DMITK_XVFB_TESTING:BOOL=${MITK_XVFB_TESTING}
-DMITK_XVFB_TESTING_COMMAND:STRING=${MITK_XVFB_TESTING_COMMAND}
-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}
-DMITK_CUSTOM_REVISION_DESC:STRING=${MITK_CUSTOM_REVISION_DESC}
# --------------- 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
)
diff --git a/Utilities/IpPic/mitkIpPicTypeMultiplex.h b/Utilities/IpPic/mitkIpPicTypeMultiplex.h
index 9cff7435ec..7c515e335a 100644
--- a/Utilities/IpPic/mitkIpPicTypeMultiplex.h
+++ b/Utilities/IpPic/mitkIpPicTypeMultiplex.h
@@ -1,730 +1,730 @@
/*============================================================================
Copyright (c) German Cancer Research Center (DKFZ)
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
- All advertising materials mentioning features or use of this software must
display the following acknowledgement:
"This product includes software developed by the German Cancer Research
Center (DKFZ)."
- Neither the name of the German Cancer Research Center (DKFZ) nor the names
of its contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE GERMAN CANCER RESEARCH CENTER (DKFZ) AND
CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE GERMAN
CANCER RESEARCH CENTER (DKFZ) OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
DAMAGE.
============================================================================*/
/** @file
*
*Module Name:mitkIpPicTypeMultiplex
*
*Module Klasse: ADT
*
*Beschreibung:Multiplexing a method with the image datatyp.
*The image is the first parameter.
*The method must be about a template method.
*The number of parameter is constricted by 16
*
*Method with two parameter and without a return value:
*mitkIpPicTypeMultiplex2( funktionsname, parameter1, Parameter2 );
*
*Method with one parameter and a return value:
*mitkIpPicTypeMultiplexR1( funktionsname, rückgabewert, parameter );
*
*If R is set the method return a value
*The number set the count of parameter
*
*exported classes and methods:
*no one
*
*imported classes and methods:
*std::complex
*
-*@warningThese module is not finished
+*@warning These module is not finished
*
*
-*@version1.0
+*@version 1.0
*
-* @date07.09.2000
+* @date 07.09.2000
*
-* @authorMarcus Vetter
+* @author Marcus Vetter
*
*/
#ifndef IP_PIC_TYPE_MULTIPLEX_H
#define IP_PIC_TYPE_MULTIPLEX_H
#include "mitkIpPic.h"
//#include <complex>
#define mitkIpPicTypeMultiplex0( function, pic ) \
{ \
if ( ( pic->type == mitkIpPicInt || pic->type == mitkIpPicUInt ) && pic->bpe == 1 ){ \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
function<char>( pic ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
function<unsigned char>( pic ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
function<short>( pic ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
function<unsigned short>( pic ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
function<int>( pic ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
function<unsigned int>( pic ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
function<long>( pic ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
function<unsigned long>( pic ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
function<float>( pic ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
function<double>( pic ); \
} \
}
#define mitkIpPicTypeMultiplex1( function, pic, param1 ) \
{ \
if ( ( pic->type == mitkIpPicInt || pic->type == mitkIpPicUInt ) && pic->bpe == 1 ){ \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
function<char>( pic, param1 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
function<unsigned char>( pic, param1 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
function<short>( pic, param1 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
function<unsigned short>( pic, param1 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
function<int>( pic, param1 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
function<unsigned int>( pic, param1 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
function<long>( pic, param1 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
function<unsigned long>( pic, param1 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
function<float>( pic, param1 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
function<double>( pic, param1 ); \
} \
}
/*
else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){
function<std::complex<float> >( pic, param1 );
} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){
function<std::complex<double> >( pic, param1 );
}
*/
#define mitkIpPicTypeMultiplex2( function, pic, param1, param2 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
function<char>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
function<unsigned char>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
function<short>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
function<unsigned short>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
function<int>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
function<unsigned int>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
function<long>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
function<unsigned long>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
function<float>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
function<double>( pic, param1, param2 ); \
} \
}
/*
else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){
function<std::complex<float> >( pic, param1, param2 );
} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){
function<std::complex<double> >( pic, param1, param2 );
}
*/
#define mitkIpPicTypeMultiplex3( function, pic, param1, param2, param3 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
function<char>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
function<unsigned char>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
function<short>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
function<unsigned short>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
function<int>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
function<unsigned int>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
function<long>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
function<unsigned long>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
function<float>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
function<double>( pic, param1, param2, param3 ); \
} \
}
/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){
function<std::complex<float> >( pic, param1, param2, param3 );
} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){
function<std::complex<double> >( pic, param1, param2, param3 );
}*/
#define mitkIpPicTypeMultiplex4( function, pic, param1, param2, param3, param4 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
function<char>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
function<unsigned char>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
function<short>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
function<unsigned short>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
function<int>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
function<unsigned int>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
function<long>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
function<unsigned long>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
function<float>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
function<double>( pic, param1, param2, param3, param4 ); \
} \
}
/*
else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){
function<std::complex<float> >( pic, param1, param2, param3, param4 );
} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){
function<std::complex<double> >( pic, param1, param2, param3, param4 );
}*/
#define mitkIpPicTypeMultiplex5( function, pic, param1, param2, param3, param4, param5 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
function<char>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
function<unsigned char>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
function<short>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
function<unsigned short>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
function<int>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
function<unsigned int>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
function<long>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
function<unsigned long>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
function<float>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
function<double>( pic, param1, param2, param3, param4, param5 ); \
} \
}
/* else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){
function<std::complex<float> >( pic, param1, param2, param3, param4, param5 );
} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){
function<std::complex<double> >( pic, param1, param2, param3, param4, param5 );
}
*/
#define mitkIpPicTypeMultiplex6( function, pic, param1, param2, param3, param4, param5, param6 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
function<char>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
function<unsigned char>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
function<short>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
function<unsigned short>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
function<int>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
function<unsigned int>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
function<long>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
function<unsigned long>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
function<float>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
function<double>( pic, param1, param2, param3, param4, param5, param6 ); \
} \
}
/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){
function<std::complex<float> >( pic, param1, param2, param3, param4, param5, param6 );
} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){
function<std::complex<double> >( pic, param1, param2, param3, param4, param5, param6 );
}*/
#define mitkIpPicTypeMultiplex7( function, pic, param1, param2, param3, param4, param5, param6, param7 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
function<char>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
function<unsigned char>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
function<short>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
function<unsigned short>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
function<int>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
function<unsigned int>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
function<long>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
function<unsigned long>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
function<float>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
function<double>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} \
}
/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){
function<std::complex<float> >( pic, param1, param2, param3, param4, param5, param6 );
} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){
function<std::complex<double> >( pic, param1, param2, param3, param4, param5, param6 );
}*/
#define mitkIpPicTypeMultiplex7( function, pic, param1, param2, param3, param4, param5, param6, param7 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
function<char>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
function<unsigned char>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
function<short>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
function<unsigned short>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
function<int>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
function<unsigned int>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
function<long>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
function<unsigned long>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
function<float>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
function<double>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} \
}
/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){
function<std::complex<float> >( pic, param1, param2, param3, param4, param5, param6 );
} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){
function<std::complex<double> >( pic, param1, param2, param3, param4, param5, param6 );
}*/
#define mitkIpPicTypeMultiplex8( function, pic, param1, param2, param3, param4, param5, param6, param7, param8) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
function<char>( pic, param1, param2, param3, param4, param5, param6, param7, param8); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
function<unsigned char>( pic, param1, param2, param3, param4, param5, param6, param7, param8); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
function<short>( pic, param1, param2, param3, param4, param5, param6, param7, param8); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
function<unsigned short>( pic, param1, param2, param3, param4, param5, param6, param7, param8); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
function<int>( pic, param1, param2, param3, param4, param5, param6, param7, param8); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
function<unsigned int>( pic, param1, param2, param3, param4, param5, param6, param7, param8); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
function<long>( pic, param1, param2, param3, param4, param5, param6, param7, param8); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
function<unsigned long>( pic, param1, param2, param3, param4, param5, param6, param7, param8); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
function<float>( pic, param1, param2, param3, param4, param5, param6, param7, param8); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
function<double>( pic, param1, param2, param3, param4, param5, param6, param7, param8); \
} \
}
/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){
function<std::complex<float> >( pic, param1, param2, param3, param4, param5, param6 );
} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){
function<std::complex<double> >( pic, param1, param2, param3, param4, param5, param6 );
}*/
#define mitkIpPicTypeMultiplex9( function, pic, param1, param2, param3, param4, param5, param6, param7, param8, param9) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
function<char>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
function<unsigned char>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
function<short>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
function<unsigned short>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
function<int>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
function<unsigned int>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
function<long>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
function<unsigned long>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
function<float>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
function<double>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9); \
} \
}
/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){
function<std::complex<float> >( pic, param1, param2, param3, param4, param5, param6 );
} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){
function<std::complex<double> >( pic, param1, param2, param3, param4, param5, param6 );
}*/
#define mitkIpPicTypeMultiplex10( function, pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
function<char>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
function<unsigned char>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
function<short>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
function<unsigned short>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
function<int>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
function<unsigned int>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
function<long>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
function<unsigned long>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
function<float>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
function<double>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10); \
} \
}
/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){
function<std::complex<float> >( pic, param1, param2, param3, param4, param5, param6 );
} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){
function<std::complex<double> >( pic, param1, param2, param3, param4, param5, param6 );
}*/
#define mitkIpPicTypeMultiplex16( function, pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
function<char>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
function<unsigned char>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
function<short>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
function<unsigned short>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
function<int>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
function<unsigned int>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
function<long>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
function<unsigned long>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
function<float>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
function<double>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15, param16 ); \
} \
}
/*else if ( pic->type == mitkIpPicComplex && pic->bpe == 64 ){
function<std::complex<float> >( pic, param1, param2, param3, param4, param5, param6 );
} else if ( pic->type == mitkIpPicComplex && pic->bpe == 128 ){
function<std::complex<double> >( pic, param1, param2, param3, param4, param5, param6 );
}*/
/**
* with return value
*/
#define mitkIpPicTypeMultiplexR0( function, pic, returnValue ) \
{ \
if ( ( pic->type == mitkIpPicInt || pic->type == mitkIpPicUInt ) && pic->bpe == 1 ){ \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
returnValue = function<char>( pic ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
returnValue = function<unsigned char>( pic ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
returnValue = function<short>( pic ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
returnValue = function<unsigned short>( pic ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
returnValue = function<int>( pic ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
returnValue = function<unsigned int>( pic ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
returnValue = function<long>( pic ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
returnValue = function<unsigned long>( pic ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
returnValue = function<float>( pic ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
returnValue = function<double>( pic ); \
} \
}
#define mitkIpPicTypeMultiplexR1( function, pic, returnValue, param1 ) \
{ \
if ( ( pic->type == mitkIpPicInt || pic->type == mitkIpPicUInt ) && pic->bpe == 1 ){ \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
returnValue = function<char>( pic, param1 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
returnValue = function<unsigned char>( pic, param1 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
returnValue = function<short>( pic, param1 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
returnValue = function<unsigned short>( pic, param1 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
returnValue = function<int>( pic, param1 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
returnValue = function<unsigned int>( pic, param1 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
returnValue = function<long>( pic, param1 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
returnValue = function<unsigned long>( pic, param1 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
returnValue = function<float>( pic, param1 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
returnValue = function<double>( pic, param1 ); \
} \
}
#define mitkIpPicTypeMultiplexR2( function, pic, returnValue, param1, param2 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
returnValue = function<char>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
returnValue = function<unsigned char>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
returnValue = function<short>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
returnValue = function<unsigned short>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
returnValue = function<int>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
returnValue = function<unsigned int>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
returnValue = function<long>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
returnValue = function<unsigned long>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
returnValue = function<float>( pic, param1, param2 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
returnValue = function<double>( pic, param1, param2 ); \
} \
}
#define mitkIpPicTypeMultiplexR3( function, pic, returnValue, param1, param2, param3 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
returnValue = function<char>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
returnValue = function<unsigned char>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
returnValue = function<short>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
returnValue = function<unsigned short>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
returnValue = function<int>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
returnValue = function<unsigned int>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
returnValue = function<long>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
returnValue = function<unsigned long>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
returnValue = function<float>( pic, param1, param2, param3 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
returnValue = function<double>( pic, param1, param2, param3 ); \
} \
}
#define mitkIpPicTypeMultiplexR4( function, pic, returnValue, param1, param2, param3, param4 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
returnValue = function<char>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
returnValue = function<unsigned char>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
returnValue = function<short>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
returnValue = function<unsigned short>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
returnValue = function<int>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
returnValue = function<unsigned int>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
returnValue = function<long>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
returnValue = function<unsigned long>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
returnValue = function<float>( pic, param1, param2, param3, param4 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
returnValue = function<double>( pic, param1, param2, param3, param4 ); \
} \
}
#define mitkIpPicTypeMultiplexR5( function, pic, returnValue, param1, param2, param3, param4, param5 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
returnValue = function<char>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
returnValue = function<unsigned char>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
returnValue = function<short>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
returnValue = function<unsigned short>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
returnValue = function<int>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
returnValue = function<unsigned int>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
returnValue = function<long>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
returnValue = function<unsigned long>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
returnValue = function<float>( pic, param1, param2, param3, param4, param5 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
returnValue = function<double>( pic, param1, param2, param3, param4, param5 ); \
} \
}
#define mitkIpPicTypeMultiplexR6( function, pic, returnValue, param1, param2, param3, param4, param5, param6 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
returnValue = function<char>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
returnValue = function<unsigned char>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
returnValue = function<short>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
returnValue = function<unsigned short>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
returnValue = function<int>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
returnValue = function<unsigned int>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
returnValue = function<long>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
returnValue = function<unsigned long>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
returnValue = function<float>( pic, param1, param2, param3, param4, param5, param6 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
returnValue = function<double>( pic, param1, param2, param3, param4, param5, param6 ); \
} \
}
#define mitkIpPicTypeMultiplexR7( function, pic, returnValue, param1, param2, param3, param4, param5, param6, param7 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
returnValue = function<char>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
returnValue = function<unsigned char>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
returnValue = function<short>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
returnValue = function<unsigned short>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
returnValue = function<int>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
returnValue = function<unsigned int>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
returnValue = function<long>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
returnValue = function<unsigned long>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
returnValue = function<float>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
returnValue = function<double>( pic, param1, param2, param3, param4, param5, param6, param7 ); \
} \
}
#define mitkIpPicTypeMultiplexR8( function, pic, returnValue, param1, param2, param3, param4, param5, param6, param7, param8 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
returnValue = function<char>( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
returnValue = function<unsigned char>( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
returnValue = function<short>( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
returnValue = function<unsigned short>( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
returnValue = function<int>( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
returnValue = function<unsigned int>( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
returnValue = function<long>( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
returnValue = function<unsigned long>( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
returnValue = function<float>( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
returnValue = function<double>( pic, param1, param2, param3, param4, param5, param6, param7, param8 ); \
} \
}
#define mitkIpPicTypeMultiplexR9( function, pic, returnValue, param1, param2, param3, param4, param5, param6, param7, param8, param9 ) \
{ \
if ( pic->type == mitkIpPicInt && pic->bpe == 8 ){ \
returnValue = function<char>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 8 ){ \
returnValue = function<unsigned char>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 16 ){ \
returnValue = function<short>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 16 ){ \
returnValue = function<unsigned short>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 32 ){ \
returnValue = function<int>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 32 ){ \
returnValue = function<unsigned int>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \
} else if ( pic->type == mitkIpPicInt && pic->bpe == 64 ){ \
returnValue = function<long>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \
} else if ( pic->type == mitkIpPicUInt && pic->bpe == 64 ){ \
returnValue = function<unsigned long>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 32 ){ \
returnValue = function<float>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \
} else if ( pic->type == mitkIpPicFloat && pic->bpe == 64 ){ \
returnValue = function<double>( pic, param1, param2, param3, param4, param5, param6, param7, param8, param9 ); \
} \
}
#endif // IP_PIC_TYPE_MULTIPLEX_H
diff --git a/Utilities/mbilog/mbilogBackendBase.h b/Utilities/mbilog/mbilogBackendBase.h
index f13a992b70..c82696b5e6 100644
--- a/Utilities/mbilog/mbilogBackendBase.h
+++ b/Utilities/mbilog/mbilogBackendBase.h
@@ -1,59 +1,58 @@
/*============================================================================
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 _mbilogBackendBase_H
#define _mbilogBackendBase_H
#include "mbilogExports.h"
#include "mbilogLogMessage.h"
namespace mbilog
{
- /**
- * This enum defines the type of the output of a backend.
+ /** This enum defines the type of the output of a backend.
* Console: output generated to the console
* File: output generated to a file
* Other: all other kinds of output
*/
- enum MBILOG_EXPORT OutputType
+ enum OutputType
{
Console = 0,
File,
Other = 100
};
/**
* \brief This class is an interface for logging backends that can be registered in the mbi logging mechanism.
*
* \ingroup mbilog
*/
class MBILOG_EXPORT BackendBase
{
public:
virtual ~BackendBase();
/**
* \brief This method is called by the mbi logging mechanism if the object is registered in
* the mbi logging mechanism and a logging message is emitted.
*
* \param logMessage Logging message which was emitted.
*
*/
virtual void ProcessMessage(const mbilog::LogMessage &logMessage) = 0;
/**
* @return The type of this backend.
*/
virtual OutputType GetOutputType() const = 0;
};
}
#endif
diff --git a/Utilities/mbilog/mbilogBackendCout.h b/Utilities/mbilog/mbilogBackendCout.h
index e4d290980d..daba4f6645 100644
--- a/Utilities/mbilog/mbilogBackendCout.h
+++ b/Utilities/mbilog/mbilogBackendCout.h
@@ -1,60 +1,60 @@
/*============================================================================
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 _mbilogBackendCout_H
#define _mbilogBackendCout_H
#include <iostream>
#include "mbilogExports.h"
#include "mbilogLogMessage.h"
#include "mbilogLoggingTypes.h"
#include "mbilogTextBackendBase.h"
namespace mbilog
{
/**
* \brief Default backend of the mbi logging mechanism. This backend is used if no other backend is registered.
* The backend formats the logging messages to a normal string and writes them to std::cout.
* \ingroup mbilog
*/
class MBILOG_EXPORT BackendCout : public TextBackendBase
{
public:
BackendCout();
~BackendCout() override;
/** \brief This method is called by the mbi logging mechanism if the object is registered in
* the mbi logging mechanism and a logging message is emitted. The method formats the
* logging messages to a normal string (depending on formatting mode) and writes it to std::cout.
*
- * \param logMessage Logging message.
+ * \param l Logging message.
*/
void ProcessMessage(const mbilog::LogMessage &l) override;
/** \brief Sets the formatting mode. If true long messages will be displayed. Default is false (short/smart
* messages).
* Long messages provide all informations and are also capable to be postproccessed (e.g. in a web viewer).
*/
void SetFull(bool full);
OutputType GetOutputType() const override;
private:
/** \brief The formatting mode of this backend. True is full/long message formatting mode. False is short/smart
* message formatting mode
*/
bool m_useFullOutput;
};
}
#endif
diff --git a/Utilities/mbilog/mbilogTextBackendBase.h b/Utilities/mbilog/mbilogTextBackendBase.h
index be4e072b08..46a4e9bd77 100644
--- a/Utilities/mbilog/mbilogTextBackendBase.h
+++ b/Utilities/mbilog/mbilogTextBackendBase.h
@@ -1,71 +1,77 @@
/*============================================================================
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 _mbilogTextBackendBase_H
#define _mbilogTextBackendBase_H
#include "mbilogBackendBase.h"
#include "mbilogExports.h"
namespace mbilog
{
/** Documentation
* \brief This class is an abstract superclass for logging text backends. It adds string formatting methods
* to the backend interface BackendBase. Accordingly backends that inherit from this class can be
* registered in the mbi logging mechanism.
*
* \ingroup mbilog
*/
class MBILOG_EXPORT TextBackendBase : public BackendBase
{
public:
~TextBackendBase() override;
/** \brief This method is called by the mbi logging mechanism if the object is registered in
* the mbi logging mechanism and a logging message is emitted.
*
* \param logMessage Logging message which was emitted.
*
*/
void ProcessMessage(const mbilog::LogMessage &logMessage) override = 0;
protected:
/** \brief Method formats the given LogMessage in the smart/short format and writes it to std::cout.
+ * \param l
* \param threadID Can be set to the threadID where the logging message was emitted. Is 0 by default.
*/
void FormatSmart(const LogMessage &l, int threadID = 0);
/** \brief Method formats the given LogMessage in the full/long format and writes it to std::cout.
+ * \param l
* \param threadID Can be set to the threadID where the logging message was emitted. Is 0 by default.
*/
void FormatFull(const LogMessage &l, int threadID = 0);
/** \brief Method formats the given LogMessage in the smart/short format and writes it to the given std::ostream.
+ * \param out
+ * \param l
* \param threadID Can be set to the threadID where the logging message was emitted. Is 0 by default.
*/
void FormatSmart(std::ostream &out, const LogMessage &l, int threadID = 0);
/** \brief Method formats the given LogMessage in the full/long format and writes it to the given std::ostream.
+ * \param out
+ * \param l
* \param threadID Can be set to the threadID where the logging message was emitted. Is 0 by default.
*/
void FormatFull(std::ostream &out, const LogMessage &l, int threadID = 0);
/** \brief Writes the system time to the given stream.*/
void AppendTimeStamp(std::ostream &out);
/** \brief Special variant of method FormatSmart which uses colored messages (only for windows).*/
// TODO: implement for linux?
void FormatSmartWindows(const mbilog::LogMessage &l, int /*threadID*/);
};
}
#endif

File Metadata

Mime Type
application/octet-stream
Expires
Mon, May 6, 8:05 AM (1 d, 23 h)
Storage Engine
chunks
Storage Format
Chunks
Storage Handle
OX9gh4mrfwtx
Default Alt Text
(4 MB)

Event Timeline