diff --git a/Applications/CoreApp/CMakeLists.txt b/Applications/CoreApp/CMakeLists.txt index 838cd8896b..3141a952d4 100644 --- a/Applications/CoreApp/CMakeLists.txt +++ b/Applications/CoreApp/CMakeLists.txt @@ -1,35 +1,35 @@ project(CoreApp) set(_app_options) if(MITK_SHOW_CONSOLE_WINDOW) list(APPEND _app_options SHOW_CONSOLE) endif() # Create a cache entry for the provisioning file which is used to export # the file name in the MITKConfig.cmake file. This will keep external projects # which rely on this file happy. set(MITK_COREAPP_PROVISIONING_FILE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CoreApp.provisioning" CACHE INTERNAL "CoreApp provisioning file" FORCE) set(_plugins org.blueberry.compat org.mitk.gui.qt.coreapplication org.mitk.gui.qt.stdmultiwidgeteditor ) # Plug-ins listed below will not be # - added as a build-time dependency to the executable # - listed in the provisioning file for the executable # - installed if they are external plug-ins set(_exclude_plugins ) FunctionCreateBlueBerryApplication( NAME CoreApp DESCRIPTION "MITK - CoreApp Application" PLUGINS ${_plugins} ${_app_options} ) -mitk_use_modules(TARGET CoreApp QT4_MODULES QtGui) +mitk_use_modules(TARGET CoreApp PACKAGES Qt4>QtGui) # subproject support add_dependencies(MITK-CoreUI CoreApp) diff --git a/Applications/PluginGenerator/ProjectTemplate/Apps/TemplateApp/CMakeLists.txt b/Applications/PluginGenerator/ProjectTemplate/Apps/TemplateApp/CMakeLists.txt index c81c851925..d45f3907fc 100644 --- a/Applications/PluginGenerator/ProjectTemplate/Apps/TemplateApp/CMakeLists.txt +++ b/Applications/PluginGenerator/ProjectTemplate/Apps/TemplateApp/CMakeLists.txt @@ -1,22 +1,22 @@ set(_app_options) if(${MY_PROJECT_NAME}_SHOW_CONSOLE_WINDOW) list(APPEND _app_options SHOW_CONSOLE) endif() # Plug-ins listed below will not be # - added as a build-time dependency to the executable # - listed in the provisioning file for the executable # - installed if they are external plug-ins set(_exclude_plugins ) FunctionCreateBlueBerryApplication( NAME ${MY_APP_NAME} DESCRIPTION "MITK - ${MY_APP_NAME} Application" EXCLUDE_PLUGINS ${_exclude_plugins} ${_app_options} ) -mitk_use_modules(TARGET ${MY_APP_NAME} QT4_MODULES QtGui) +mitk_use_modules(TARGET ${MY_APP_NAME} PACKAGES Qt4>QtGui) diff --git a/BlueBerry/CMake/FunctionCreateBlueBerryApplication.cmake b/BlueBerry/CMake/FunctionCreateBlueBerryApplication.cmake index 892f10b661..caf575b5fb 100644 --- a/BlueBerry/CMake/FunctionCreateBlueBerryApplication.cmake +++ b/BlueBerry/CMake/FunctionCreateBlueBerryApplication.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 .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 SHOW_CONSOLE (option) Show the console output window (on Windows). #! \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 MyApp.cpp, an example call looks like: #! \code #! FunctionCreateBlueBerryApplication( #! NAME MyApp #! DESCRIPTION "MyApp - New ways to explore medical data" #! EXCLUDE_PLUGINS org.mitk.gui.qt.extapplication #! SHOW_CONSOLE #! ) #! \endcode #! function(FunctionCreateBlueBerryApplication) macro_parse_arguments(_APP "NAME;DESCRIPTION;SOURCES;PLUGINS;EXCLUDE_PLUGINS;LINK_LIBRARIES;LIBRARY_DIRS" "SHOW_CONSOLE;NO_PROVISIONING;NO_INSTALL" ${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() #------------------------------------------------------------------------ # Prerequesites #------------------------------------------------------------------------ find_package(MITK REQUIRED) find_package(Poco REQUIRED) # ----------------------------------------------------------------------- # Set up include and link dirs for the executable # ----------------------------------------------------------------------- include_directories( ${org_blueberry_osgi_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() # Work-around for linking GDCM libraries, until GDCM provides proper # target exports. foreach(dir ${MODULES_PACKAGE_DEPENDS_DIRS}) - if(EXISTS "${dir}/MITK_ITK_Config.cmake") - include("${dir}/MITK_ITK_Config.cmake") + if(EXISTS "${dir}/MITK_GDCM_Config.cmake") + include("${dir}/MITK_GDCM_Config.cmake") break() endif() endforeach() if(ALL_LIBRARY_DIRS) list(REMOVE_DUPLICATES ALL_LIBRARY_DIRS) link_directories(${ALL_LIBRARY_DIRS}) endif() if(_APP_SHOW_CONSOLE) 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() -mitk_use_modules(TARGET ${_APP_NAME} MODULES mbilog PACKAGES Poco QT4_MODULES QtCore) +mitk_use_modules(TARGET ${_APP_NAME} MODULES mbilog PACKAGES Poco Qt4>QtCore) set_target_properties(${_APP_NAME} PROPERTIES COMPILE_FLAGS "${_app_compile_flags}") target_link_libraries(${_APP_NAME} org_blueberry_osgi ${_APP_LINK_LIBRARIES}) if(WIN32) target_link_libraries(${_APP_NAME} ${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) 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") FunctionCreateProvisioningFile(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 files for Windows platforms 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() endif(WIN32) # ----------------------------------------------------------------------- # Install support # ----------------------------------------------------------------------- if(NOT _APP_NO_INSTALL) # This installs all third-party CTK plug-ins FunctionInstallThirdPartyCTKPlugins(${_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() diff --git a/CMake/PackageDepends/MITK_Boost_Config.cmake b/CMake/PackageDepends/MITK_Boost_Config.cmake index 99642d2a08..843998dc02 100644 --- a/CMake/PackageDepends/MITK_Boost_Config.cmake +++ b/CMake/PackageDepends/MITK_Boost_Config.cmake @@ -1,29 +1,29 @@ if(MITK_USE_Boost) 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) if(MITK_USE_Boost_LIBRARIES) if(NOT MITK_USE_SYSTEM_Boost) set(BOOST_INCLUDEDIR ${CMAKE_BINARY_DIR}/../Boost-install/include) set(BOOST_LIBRARYDIR ${CMAKE_BINARY_DIR}/../Boost-install/lib) set(Boost_ADDITIONAL_VERSIONS 1.54) endif() - find_package(Boost 1.54.0 REQUIRED COMPONENTS ${MITK_USE_Boost_LIBRARIES}) + find_package(Boost 1.54.0 REQUIRED COMPONENTS ${MITK_USE_Boost_LIBRARIES} QUIET) else() - find_package(Boost 1.54.0 REQUIRED) + find_package(Boost 1.54.0 REQUIRED QUIET) endif() list(APPEND ALL_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS}) if(Boost_LIBRARIES) list(APPEND ALL_LIBRARIES ${Boost_LIBRARIES}) link_directories(${Boost_LIBRARY_DIRS}) endif() endif(MITK_USE_Boost) diff --git a/CMake/PackageDepends/MITK_GDCM_Config.cmake b/CMake/PackageDepends/MITK_GDCM_Config.cmake new file mode 100644 index 0000000000..a2551c3a3b --- /dev/null +++ b/CMake/PackageDepends/MITK_GDCM_Config.cmake @@ -0,0 +1,10 @@ +if(TARGET itksys) + set(ITK_TARGETS_IMPORTED 1) +endif() + +find_package(ITK REQUIRED) +find_package(GDCM PATHS ${ITK_GDCM_DIR} REQUIRED) + +list(APPEND ALL_INCLUDE_DIRECTORIES ${GDCM_INCLUDE_DIRS}) +list(APPEND ALL_LIBRARIES ${GDCM_LIBRARIES}) +list(APPEND ALL_LIBRARY_DIRS ${GDCM_LIBRARY_DIRS}) diff --git a/CMake/PackageDepends/MITK_ITK_Config.cmake b/CMake/PackageDepends/MITK_ITK_Config.cmake index 2509e4bef4..7c16b3bb9a 100644 --- a/CMake/PackageDepends/MITK_ITK_Config.cmake +++ b/CMake/PackageDepends/MITK_ITK_Config.cmake @@ -1,25 +1,15 @@ if(TARGET itksys) set(ITK_TARGETS_IMPORTED 1) endif() -find_package(ITK REQUIRED) -# -# for some reason this does not work on windows, probably an ITK bug -# ITK_BUILD_SHARED is OFF even in shared library builds -# -#if(ITK_FOUND AND NOT ITK_BUILD_SHARED) -# message(FATAL_ERROR "MITK only supports a ITK which was built with shared libraries. Turn on BUILD_SHARED_LIBS in your ITK config.") -#endif(ITK_FOUND AND NOT ITK_BUILD_SHARED) +find_package(ITK COMPONENTS ${ITK_REQUIRED_COMPONENTS_BY_MODULE} REQUIRED) if(NOT DEFINED ITK_NO_IO_FACTORY_REGISTER_MANAGER) set(ITK_NO_IO_FACTORY_REGISTER_MANAGER 1) endif() include(${ITK_USE_FILE}) + list(APPEND ALL_LIBRARIES ${ITK_LIBRARIES}) -list(APPEND ALL_INCLUDE_DIRECTORIES ${ITK_INCLUDE_DIRS}) +#list(APPEND ALL_INCLUDE_DIRECTORIES ${ITK_INCLUDE_DIRS}) -find_package(GDCM PATHS ${ITK_GDCM_DIR} REQUIRED) -list(APPEND ALL_INCLUDE_DIRECTORIES ${GDCM_INCLUDE_DIRS}) -list(APPEND ALL_LIBRARIES ${GDCM_LIBRARIES}) -list(APPEND ALL_LIBRARY_DIRS ${GDCM_LIBRARY_DIRS}) diff --git a/CMake/PackageDepends/Qt/MITK_Qt4_Config.cmake b/CMake/PackageDepends/MITK_Qt4_Config.cmake similarity index 52% rename from CMake/PackageDepends/Qt/MITK_Qt4_Config.cmake rename to CMake/PackageDepends/MITK_Qt4_Config.cmake index 6a9dc0cdee..dd60581bdb 100644 --- a/CMake/PackageDepends/Qt/MITK_Qt4_Config.cmake +++ b/CMake/PackageDepends/MITK_Qt4_Config.cmake @@ -1,5 +1,5 @@ set(QT_DONT_USE_QTCORE 0) set(QT_DONT_USE_QTGUI 0) -find_package(Qt4 ${MITK_QT4_MINIMUM_VERSION} QUIET REQUIRED QtCore ${MODULE_QT4_MODULES}) +find_package(Qt4 ${MITK_QT4_MINIMUM_VERSION} QUIET REQUIRED QtCore ${Qt4_REQUIRED_COMPONENTS_BY_MODULE}) include(${QT_USE_FILE}) list(APPEND ALL_LIBRARIES ${QT_LIBRARIES}) diff --git a/CMake/PackageDepends/MITK_Qt5_Config.cmake b/CMake/PackageDepends/MITK_Qt5_Config.cmake new file mode 100644 index 0000000000..5c5e5002be --- /dev/null +++ b/CMake/PackageDepends/MITK_Qt5_Config.cmake @@ -0,0 +1,2 @@ +find_package(Qt5Core COMPONENTS ${Qt5_REQUIRED_COMPONENTS_BY_MODULE} REQUIRED QUIET) +qt5_use_modules(${MODULE_NAME} ${Qt5_REQUIRED_COMPONENTS_BY_MODULE}) diff --git a/CMake/PackageDepends/MITK_VTK_Config.cmake b/CMake/PackageDepends/MITK_VTK_Config.cmake index 4bb048adc6..33c599ce49 100644 --- a/CMake/PackageDepends/MITK_VTK_Config.cmake +++ b/CMake/PackageDepends/MITK_VTK_Config.cmake @@ -1,137 +1,8 @@ -find_package(VTK REQUIRED) +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() -include(${VTK_USE_FILE}) list(APPEND ALL_INCLUDE_DIRECTORIES ${VTK_INCLUDE_DIRS}) -if(VTK_FOR_MITK_LIBRARIES) - list(APPEND ALL_LIBRARIES ${VTK_FOR_MITK_LIBRARIES}) -else() - # Libraries in mitk/Utilities may depend on VTK but - # the VTK_FOR_MITK_LIBRARIES variable is not yet set. - # Supply the VTK libraries manually - ## VTK6_TODO Remove unneeded Libraries - list(APPEND ALL_LIBRARIES - vtkalglib - vtkChartsCore - vtkCommonColor - vtkCommonComputationalGeometry - vtkCommonCore - vtkCommonDataModel - vtkCommonExecutionModel - vtkCommonMath - vtkCommonMisc - vtkCommonSystem - vtkCommonTransforms - vtkDICOMParser - vtkDomainsChemistry - vtkexoIIc - vtkexpat - vtkFiltersAMR - vtkFiltersCore - vtkFiltersExtraction - vtkFiltersFlowPaths - vtkFiltersGeneral - vtkFiltersGeneric - vtkFiltersGeometry - vtkFiltersHybrid - vtkFiltersHyperTree - vtkFiltersImaging - vtkFiltersModeling - vtkFiltersParallel - vtkFiltersParallelImaging - vtkFiltersProgrammable - vtkFiltersSelection - vtkFiltersSources - vtkFiltersStatistics - vtkFiltersTexture - vtkFiltersVerdict - vtkfreetype - vtkftgl - vtkGeovisCore - vtkgl2ps - vtkhdf5 - vtkhdf5_hl - vtkImagingColor - vtkImagingCore - vtkImagingFourier - vtkImagingGeneral - vtkImagingHybrid - vtkImagingMath - vtkImagingMorphological - vtkImagingSources - vtkImagingStatistics - vtkImagingStencil - vtkInfovisCore - vtkInfovisLayout - vtkInteractionImage - vtkInteractionStyle - vtkInteractionWidgets - vtkIOAMR - vtkIOCore - vtkIOEnSight - vtkIOExodus - vtkIOExport - vtkIOGeometry - vtkIOImage - vtkIOImport - vtkIOInfovis - vtkIOLegacy - vtkIOLSDyna - vtkIOMINC - vtkIOMovie - vtkIONetCDF - vtkIOParallel - vtkIOPLY - vtkIOSQL - vtkIOVideo - vtkIOXML - vtkIOXMLParser - vtkjpeg - vtkjsoncpp - vtklibxml2 - vtkmetaio - vtkNetCDF - vtkNetCDF_cxx - vtkoggtheora - vtkParallelCore - vtkpng - vtkproj4 - vtkRenderingAnnotation - vtkRenderingContext2D - vtkRenderingCore - vtkRenderingFreeType - vtkRenderingFreeTypeOpenGL - vtkRenderingGL2PS - vtkRenderingHybridOpenGL - vtkRenderingImage - vtkRenderingLabel - vtkRenderingLOD - vtkRenderingOpenGL - vtkRenderingVolume - vtkRenderingVolumeAMR - vtkRenderingVolumeOpenGL - vtksqlite - vtksys - vtkTestingRendering - vtktiff - vtkViewsContext2D - vtkViewsCore - vtkViewsGeovis - vtkViewsInfovis - vtkzlib - ${VTK_JPEG_LIBRARIES} - ${VTK_PNG_LIBRARIES} - ${VTK_ZLIB_LIBRARIES} - ${VTK_EXPAT_LIBRARIES} - ${VTK_FREETYPE_LIBRARIES} - ) - if(MITK_USE_Qt4) - list(APPEND ALL_LIBRARIES - vtkGUISupportQt - vtkGUISupportQtOpenGL - vtkGUISupportQtWebkit - ) - endif() -endif() +list(APPEND ALL_LIBRARIES ${VTK_LIBRARIES}) +list(APPEND ALL_COMPILE_DEFINITIONS ${VTK_DEFINITIONS}) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5CLucene_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5CLucene_Config.cmake deleted file mode 100644 index 586920e958..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5CLucene_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5CLucene ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} CLucene) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Concurrent_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Concurrent_Config.cmake deleted file mode 100644 index 4664cc7dae..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Concurrent_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Concurrent ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Concurrent) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Core_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Core_Config.cmake deleted file mode 100644 index b94c7156de..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Core_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Core ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Core) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5DBus_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5DBus_Config.cmake deleted file mode 100644 index c4b5fd63f5..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5DBus_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5DBus ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} DBus) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Declarative_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Declarative_Config.cmake deleted file mode 100644 index b1f155dce5..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Declarative_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Declarative ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Declarative) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5DesignerComponents_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5DesignerComponents_Config.cmake deleted file mode 100644 index b465180e98..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5DesignerComponents_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5DesignerComponents ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} DesignerComponents) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Designer_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Designer_Config.cmake deleted file mode 100644 index e501039ad9..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Designer_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Designer ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Designer) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Gui_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Gui_Config.cmake deleted file mode 100644 index 7c5f96fc3a..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Gui_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Gui ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Gui) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Help_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Help_Config.cmake deleted file mode 100644 index f032426d34..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Help_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Help ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Help) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5MultimediaWidgets_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5MultimediaWidgets_Config.cmake deleted file mode 100644 index 159a87501f..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5MultimediaWidgets_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5MultimediaWidgets ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} MultimediaWidgets) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Multimedia_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Multimedia_Config.cmake deleted file mode 100644 index 5a5d250c04..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Multimedia_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Multimedia ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Multimedia) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Network_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Network_Config.cmake deleted file mode 100644 index 74767a32b4..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Network_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Network ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Network) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5OpenGL_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5OpenGL_Config.cmake deleted file mode 100644 index c0853856aa..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5OpenGL_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5OpenGL ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} OpenGL) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5PrintSupport_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5PrintSupport_Config.cmake deleted file mode 100644 index 60fdc5d887..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5PrintSupport_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5PrintSupport ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} PrintSupport) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Qml_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Qml_Config.cmake deleted file mode 100644 index 90308c9bf1..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Qml_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Qml ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Qml) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5QuickParticles_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5QuickParticles_Config.cmake deleted file mode 100644 index 6f69be9f58..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5QuickParticles_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5QuickParticles ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} QuickParticles) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5QuickTest_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5QuickTest_Config.cmake deleted file mode 100644 index 5349346d78..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5QuickTest_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5QuickTest ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} QuickTest) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Quick_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Quick_Config.cmake deleted file mode 100644 index 7892de1f76..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Quick_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Quick ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Quick) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5ScriptTools_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5ScriptTools_Config.cmake deleted file mode 100644 index 121481c0f0..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5ScriptTools_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5ScriptTools ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} ScriptTools) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Script_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Script_Config.cmake deleted file mode 100644 index 43d31f3403..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Script_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Script ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Script) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Sensors_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Sensors_Config.cmake deleted file mode 100644 index a6f29bde5f..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Sensors_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Sensors ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Sensors) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5SerialPort_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5SerialPort_Config.cmake deleted file mode 100644 index b5273f334b..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5SerialPort_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5SerialPort ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} SerialPort) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Sql_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Sql_Config.cmake deleted file mode 100644 index e06f19df06..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Sql_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Sql ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Sql) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Svg_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Svg_Config.cmake deleted file mode 100644 index 5e87eeea20..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Svg_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Svg ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Svg) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Test_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Test_Config.cmake deleted file mode 100644 index 44a5589c57..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Test_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Test ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Test) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5V8_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5V8_Config.cmake deleted file mode 100644 index f780d1dac1..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5V8_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5V8 ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} V8) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5WebKitWidgets_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5WebKitWidgets_Config.cmake deleted file mode 100644 index 74af72939c..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5WebKitWidgets_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5WebKitWidgets ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} WebKitWidgets) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5WebKit_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5WebKit_Config.cmake deleted file mode 100644 index 0907650477..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5WebKit_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5WebKit ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} WebKit) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Widgets_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Widgets_Config.cmake deleted file mode 100644 index 11fac5254f..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Widgets_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Widgets ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Widgets) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5X11Extras_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5X11Extras_Config.cmake deleted file mode 100644 index d4739ff366..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5X11Extras_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5X11Extras ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} X11Extras) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5XmlPatterns_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5XmlPatterns_Config.cmake deleted file mode 100644 index 8ac7945971..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5XmlPatterns_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5XmlPatterns ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} XmlPatterns) diff --git a/CMake/PackageDepends/Qt/MITK_Qt5Xml_Config.cmake b/CMake/PackageDepends/Qt/MITK_Qt5Xml_Config.cmake deleted file mode 100644 index 9e6f9d51c4..0000000000 --- a/CMake/PackageDepends/Qt/MITK_Qt5Xml_Config.cmake +++ /dev/null @@ -1,2 +0,0 @@ -find_package(Qt5Xml ${MITK_QT5_MINIMUM_VERSION} REQUIRED) -qt5_use_modules(${MODULE_NAME} Xml) diff --git a/CMake/PackageDepends/Qt/create_qt_packages.sh b/CMake/PackageDepends/Qt/create_qt_packages.sh deleted file mode 100644 index b582ed5478..0000000000 --- a/CMake/PackageDepends/Qt/create_qt_packages.sh +++ /dev/null @@ -1,15 +0,0 @@ -QT_BUILD_DIR=/opt/toolkits/ubuntu-12.04/qt-5.1/lib/ - -for lib in $QT_BUILD_DIR/libQt5*.so -do - libname=${lib/*libQt5/Qt5} - libname=${libname/.so/} - - config_filename=MITK_${libname}_Config.cmake - echo "Creating ${config_filename}" - cat << EOF > ${config_filename} -find_package($libname REQUIRED) -qt5_use_modules(\${MODULE_NAME} ${libname#Qt5}) -EOF - -done diff --git a/CMake/mitkFunctionCheckModuleDependencies.cmake b/CMake/mitkFunctionCheckModuleDependencies.cmake new file mode 100644 index 0000000000..b92a24037a --- /dev/null +++ b/CMake/mitkFunctionCheckModuleDependencies.cmake @@ -0,0 +1,89 @@ +#! Checks if all required modules and packages exist and stores missing +#! dependencies in . +#! +#! Usage: +#! +#! mitk_check_module_dependencies( +#! MODULES +#! PACKAGES +#! MISSING_DEPENDENCIES_VAR +#! MODULE_DEPENDENCIES_VAR +#! PACKAGE_DEPENDENCIES_VAR ) +#! +function(mitk_check_module_dependencies) + + set(_macro_params + MODULES # MITK modules which the given TARGET uses + PACKAGES # MITK packages which the given TARGET uses + MISSING_DEPENDENCIES_VAR # variable for storing missing dependencies + MODULE_DEPENDENCIES_VAR # variable for storing all module dependencies + PACKAGE_DEPENDENCIES_VAR # variable for storing all package dependencies + ) + + set(_macro_options ) + + MACRO_PARSE_ARGUMENTS(CHECK "${_macro_params}" "${_macro_options}" ${ARGN}) + + set(missing_deps ) + set(depends ${CHECK_MODULES}) + set(package_depends ${CHECK_PACKAGES}) + + if(depends) + set(depends_before "not initialized") + while(NOT "${depends}" STREQUAL "${depends_before}") + set(depends_before ${depends}) + foreach(dependency ${depends}) + set(_module_found 1) + if(NOT ${dependency}_CONFIG_FILE) + set(_module_found 0) + endif() + set(_dependency_file_name ${${dependency}_CONFIG_FILE}) + if(NOT EXISTS ${_dependency_file_name}) + set(_module_found 0) + endif() + + if(_module_found) + include(${_dependency_file_name}) + if(${dependency}_IS_ENABLED) + list(APPEND depends ${${dependency}_DEPENDS}) + list(APPEND package_depends ${${dependency}_PACKAGE_DEPENDS}) + else(${dependency}_IS_ENABLED) + list(APPEND missing_deps ${dependency}) + endif() + else() + list(APPEND missing_deps ${dependency}) + endif() + endforeach() + list(REMOVE_DUPLICATES depends) + list(SORT depends) + endwhile() + endif() + + set(package_names_depends) + if(package_depends) + list(REMOVE_DUPLICATES package_depends) + _mitk_parse_package_args(${package_depends}) + foreach(_package ${PACKAGE_NAMES}) + if((DEFINED MITK_USE_${_package}) AND NOT (${MITK_USE_${_package}})) + list(APPEND missing_deps ${_package}) + endif() + list(APPEND package_names_depends ${_package}) + endforeach() + endif() + + if(missing_deps) + list(REMOVE_DUPLICATES missing_deps) + if(CHECK_MISSING_DEPENDENCIES_VAR) + set(${CHECK_MISSING_DEPENDENCIES_VAR} ${missing_deps} PARENT_SCOPE) + endif() + endif() + if(CHECK_MODULE_DEPENDENCIES_VAR) + set(${CHECK_MODULE_DEPENDENCIES_VAR} ${depends} PARENT_SCOPE) + endif() + if(CHECK_PACKAGE_DEPENDENCIES_VAR) + if(package_depends) + list(REMOVE_DUPLICATES package_names_depends) + endif() + set(${CHECK_PACKAGE_DEPENDENCIES_VAR} ${package_names_depends} PARENT_SCOPE) + endif() +endfunction() diff --git a/CMake/mitkMacroCreateModule.cmake b/CMake/mitkFunctionCreateModule.cmake similarity index 87% rename from CMake/mitkMacroCreateModule.cmake rename to CMake/mitkFunctionCreateModule.cmake index 2d3585f942..cde0a7422b 100644 --- a/CMake/mitkMacroCreateModule.cmake +++ b/CMake/mitkFunctionCreateModule.cmake @@ -1,562 +1,544 @@ +function(_link_directories_for_packages) + set(ALL_LIBRARY_DIRS ) + foreach(package ${ARGN}) + if(NOT ${package} MATCHES "^(Qt[45].*|ITK|VTK)$") + foreach(dir ${MODULES_PACKAGE_DEPENDS_DIRS}) + if(EXISTS "${dir}/MITK_${package}_Config.cmake") + include("${dir}/MITK_${package}_Config.cmake") + break() + endif() + endforeach() + endif() + endforeach() + if(ALL_LIBRARY_DIRS) + list(REMOVE_DUPLICATES ALL_LIBRARY_DIRS) + link_directories(${ALL_LIBRARY_DIRS}) + endif() +endfunction() + ################################################################## # -# MITK_CREATE_MODULE +# mitk_create_module # #! Creates a module for the automatic module dependency system within MITK. #! Configurations are generated in the moduleConf directory. #! #! USAGE: #! #! \code #! MITK_CREATE_MODULE( #! [INCLUDE_DIRS ] #! [INTERNAL_INCLUDE_DIRS ] #! [DEPENDS ] #! [PACKAGE_DEPENDS ] #! [TARGET_DEPENDS #! [EXPORT_DEFINE ] #! [QT_MODULE] #! [HEADERS_ONLY] #! [WARNINGS_AS_ERRORS] #! \endcode #! #! 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_IS_ENABLED +#! #! \param MODULE_NAME_IN The name for the new module #! \param HEADERS_ONLY specify this if the modules just contains header files. ################################################################## -macro(MITK_CREATE_MODULE MODULE_NAME_IN) +function(mitk_create_module MODULE_NAME_IN) set(_macro_params SUBPROJECTS # list of CDash labels VERSION # module version number, e.g. "1.2.0" INCLUDE_DIRS # exported include dirs (used in mitkMacroCreateModuleConf.cmake) INTERNAL_INCLUDE_DIRS # include dirs internal to this module DEPENDS # list of modules this module depends on DEPENDS_INTERNAL # list of modules this module internally depends on PACKAGE_DEPENDS # list of "packages this module depends on (e.g. Qt, VTK, etc.) TARGET_DEPENDS # list of CMake targets this module should depend on EXPORT_DEFINE # export macro name for public symbols of this module AUTOLOAD_WITH # a module target name identifying the module which will trigger the # automatic loading of this module ADDITIONAL_LIBS # list of addidtional libraries linked to this module FILES_CMAKE # file name of a CMake file setting source list variables # (defaults to files.cmake) GENERATED_CPP # not used (?) - QT4_MODULES # the module depends on a given list of Qt 4 modules - QT5_MODULES # the module depends on a given list of Qt 5 modules DEPRECATED_SINCE # marks this modules as deprecated ) set(_macro_options QT_MODULE # the module makes use of Qt4 features and needs moc and ui generated files 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_INIT # do not create CppMicroServices initialization code WARNINGS_AS_ERRORS # treat all compiler warnings as errors EXECUTABLE # create an executable; do not use directly, use mitk_create_executable() instead ) MACRO_PARSE_ARGUMENTS(MODULE "${_macro_params}" "${_macro_options}" ${ARGN}) set(MODULE_NAME ${MODULE_NAME_IN}) 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() if (MODULE_QT_MODULE) - message(WARNING "QT_MODULE keyword is deprecated (in module ${MODULE_NAME}). Please replace QT_MODULE by the more specific QT4_MODULES / QT5_MODULES!") - if (NOT MODULE_QT4_MODULES) - set(MODULE_QT4_MODULES QtGui) - endif() - endif() - - if (MODULE_QT4_MODULES) - set (MODULE_QT_MODULE TRUE) # defines that we want to process UIC_FILES, QRC_FILES etc. from files.cmake - if (MITK_USE_Qt4) - list(APPEND MODULE_PACKAGE_DEPENDS Qt4) # QT4_MODULES will create package dependencies to Qt4 modules and define a list of Qt 4 components - endif() - endif() - if (MODULE_QT5_MODULES) - set (MODULE_QT_MODULE TRUE) - if (MITK_USE_Qt5) - list(APPEND MODULE_PACKAGE_DEPENDS ${MODULE_QT5_MODULES}) # QT5_MODULES is just an alias for PACKAGE_DEPENDS + message(WARNING "QT_MODULE keyword is deprecated (in module ${MODULE_NAME}). Please use PACKAGE_DEPENDS Qt4>QtCore and/or PACKAGE_DEPENDS Qt5>Core instead") + if (NOT "${MODULE_PACKAGE_DEPENDS}" MATCHES "^.*Qt4.*$") + list(APPEND MODULE_PACKAGE_DEPENDS Qt4>QtGui) endif() endif() if(MODULE_HEADERS_ONLY) set(MODULE_PROVIDES ) if(MODULE_AUTOLOAD_WITH) message(SEND_ERROR "A headers only module cannot be auto-loaded") endif() else() set(MODULE_PROVIDES ${MODULE_NAME}) if(NOT MODULE_NO_INIT AND NOT MODULE_NAME STREQUAL "Mitk") # Add a dependency to the "Mitk" module #list(APPEND MODULE_DEPENDS Mitk) endif() endif() if(MODULE_DEPRECATED_SINCE) set(MODULE_IS_DEPRECATED 1) else() set(MODULE_IS_DEPRECATED 0) endif() if(NOT MODULE_SUBPROJECTS) if(MITK_DEFAULT_SUBPROJECTS) set(MODULE_SUBPROJECTS ${MITK_DEFAULT_SUBPROJECTS}) endif() endif() # check if the subprojects exist as targets if(MODULE_SUBPROJECTS) foreach(subproject ${MODULE_SUBPROJECTS}) if(NOT TARGET ${subproject}) message(SEND_ERROR "The subproject ${subproject} does not have a corresponding target") endif() endforeach() endif() # 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() # create a meta-target if it does not already exist set(_module_autoload_meta_target "${MODULE_AUTOLOAD_WITH}-autoload") if(NOT TARGET ${_module_autoload_meta_target}) add_custom_target(${_module_autoload_meta_target}) endif() endif() # 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 AND NOT (MODULE_QT_MODULE AND NOT MITK_USE_QT)) + + if(NOT MODULE_IS_EXCLUDED) # first of all we check for the dependencies - MITK_CHECK_MODULE(_MISSING_DEP ${MODULE_DEPENDS} ${MODULE_PACKAGE_DEPENDS}) + _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) message("Module ${MODULE_NAME} won't be built, missing dependency: ${_MISSING_DEP}") set(MODULE_IS_ENABLED 0) - else(_MISSING_DEP) + else() set(MODULE_IS_ENABLED 1) # now check for every package if it is enabled. This overlaps a bit with # MITK_CHECK_MODULE ... - foreach(_package ${MODULE_PACKAGE_DEPENDS}) + foreach(_package ${PACKAGE_NAMES}) if((DEFINED MITK_USE_${_package}) AND NOT (MITK_USE_${_package})) - if (${_package} MATCHES "Qt[45]") - message("Module ${MODULE_NAME} won't be built because we lack ${_package}. Check CMake switches MITK_USE_QT and DESIRED_QT_VERSION.") - else() - message("Module ${MODULE_NAME} won't be built. Turn on MITK_USE_${_package} if you want to use it.") - endif() + message("Module ${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() - if (MODULE_QT_MODULE) # disable module if it 1. needs Qt 2. has only one of QT4_MODULES/QT5_MODULES set and 3. DESIRED_QT_VERSION does not match the module - if (MITK_USE_Qt4) - if (NOT MODULE_QT4_MODULES) - set (MODULE_IS_ENABLED 0) - endif() - endif() - - if (MITK_USE_Qt5) - if (NOT MODULE_QT5_MODULES) - set (MODULE_IS_ENABLED 0) - endif() - endif() - endif() - 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 ) # Convert relative include dirs to absolute dirs set(_include_dirs . ${MODULE_INCLUDE_DIRS}) set(MODULE_INCLUDE_DIRS) foreach(dir ${_include_dirs}) get_filename_component(_abs_dir ${dir} ABSOLUTE) list(APPEND MODULE_INCLUDE_DIRS ${_abs_dir}) endforeach() list(APPEND MODULE_INCLUDE_DIRS ${MITK_BINARY_DIR} ${MODULES_CONF_DIRS}) # Convert relative internal include dirs to absolute dirs set(_include_dirs ${MODULE_INTERNAL_INCLUDE_DIRS}) set(MODULE_INTERNAL_INCLUDE_DIRS) foreach(dir ${_include_dirs}) get_filename_component(_abs_dir ${dir} ABSOLUTE) list(APPEND MODULE_INTERNAL_INCLUDE_DIRS ${_abs_dir}) endforeach() # Qt generates headers in the binary tree - if(MODULE_QT4_MODULES OR MODULE_QT5_MODULES) - list(APPEND MODULE_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}) - endif() + list(APPEND MODULE_INCLUDE_DIRS ${CMAKE_CURRENT_BINARY_DIR}) # Add the module specific include dirs include_directories(${MODULE_INCLUDE_DIRS} ${MODULE_INTERNAL_INCLUDE_DIRS}) if(NOT MODULE_EXECUTABLE) _MITK_CREATE_MODULE_CONF() endif() if(NOT MODULE_EXPORT_DEFINE) set(MODULE_EXPORT_DEFINE ${MODULE_NAME}_EXPORT) endif(NOT MODULE_EXPORT_DEFINE) 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) # ok, now create the module itself include(${MODULE_FILES_CMAKE}) 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) set(use_visibility_flags 0) else() # We only support hidden visibility for gcc for now. Clang 3.0 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 if(CMAKE_COMPILER_IS_GNUCXX) set(use_visibility_flags 1) else() # set(use_visibility_flags 0) endif() endif() if(CMAKE_COMPILER_IS_GNUCXX) # MinGW does not export all symbols automatically, so no need to set flags. # # With gcc < 4.5, RTTI symbols from classes declared in third-party libraries # which are not "gcc visibility aware" are marked with hidden visibility in # DSOs which include the class declaration and which are compiled with # hidden visibility. This leads to dynamic_cast and exception handling problems. # While this problem could be worked around by sandwiching the include # directives for the third-party headers between "#pragma visibility push/pop" # statements, it is generally safer to just use default visibility with # gcc < 4.5. if(${GCC_VERSION} VERSION_LESS "4.5" OR MINGW) set(use_visibility_flags 0) endif() endif() if(use_visibility_flags) mitkFunctionCheckCAndCXXCompilerFlags("-fvisibility=hidden" module_c_flags module_cxx_flags) mitkFunctionCheckCAndCXXCompilerFlags("-fvisibility-inlines-hidden" module_c_flags module_cxx_flags) endif() configure_file(${MITK_SOURCE_DIR}/CMake/moduleExports.h.in ${CMAKE_BINARY_DIR}/${MODULES_CONF_DIRNAME}/${MODULE_NAME}Exports.h @ONLY) if(MODULE_WARNINGS_AS_ERRORS) if(MSVC_VERSION) mitkFunctionCheckCAndCXXCompilerFlags("/WX" 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) # VNL headers throw a lot of these, not fixable for us at least in ITK 3 mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=unused-parameter" module_c_flags module_cxx_flags) # Some DICOM header file in ITK mitkFunctionCheckCAndCXXCompilerFlags("-Wno-error=cast-align" module_c_flags module_cxx_flags) endif() endif(MODULE_WARNINGS_AS_ERRORS) if(MODULE_FORCE_STATIC) set(_STATIC STATIC) else() set(_STATIC ) endif(MODULE_FORCE_STATIC) if(NOT MODULE_HEADERS_ONLY) set(MODULE_LIBNAME ${MODULE_PROVIDES}) if(NOT MODULE_NO_INIT) find_package(CppMicroServices QUIET NO_MODULE REQUIRED) if(MODULE_EXECUTABLE) usFunctionGenerateExecutableInit(CPP_FILES IDENTIFIER ${MODULE_NAME} ) else() usFunctionGenerateModuleInit(CPP_FILES NAME ${MODULE_NAME} LIBRARY_NAME ${MODULE_LIBNAME} ) endif() endif() if(RESOURCE_FILES) set(res_dir Resources) set(binary_res_files ) set(source_res_files ) 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() set(res_macro_args ) if(binary_res_files) list(APPEND res_macro_args ROOT_DIR ${CMAKE_CURRENT_BINARY_DIR}/${res_dir} FILES ${binary_res_files}) endif() if(source_res_files) list(APPEND res_macro_args ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/${res_dir} FILES ${source_res_files}) endif() usFunctionEmbedResources(CPP_FILES LIBRARY_NAME ${MODULE_LIBNAME} ${res_macro_args}) endif() endif() # Qt 4 case if(MITK_USE_Qt4) if(UI_FILES) qt4_wrap_ui(Q${KITNAME}_GENERATED_UI_CPP ${UI_FILES}) endif() if(MOC_H_FILES) qt4_wrap_cpp(Q${KITNAME}_GENERATED_MOC_CPP ${MOC_H_FILES} OPTIONS -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) endif() if(QRC_FILES) qt4_add_resources(Q${KITNAME}_GENERATED_QRC_CPP ${QRC_FILES}) endif() endif() # all the same for Qt 5 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}) ORGANIZE_SOURCES(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}) if(MODULE_SUBPROJECTS) set_property(SOURCE ${coverage_sources} APPEND PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK) endif() if(NOT MODULE_HEADERS_ONLY) # We have to include the MITK__Config.cmake files here because # some external packages do not provide exported targets with an # absolute path to link to. So we need to add link directories *before* # add_library() or add_executable() is called. So far, this is needed only # for GDCM and ACVD. - # The PACKAGE_DEPENDS variable is filled in the MITK_CHECK_MODULE() macro - foreach(package ${PACKAGE_DEPENDS}) - if(NOT ${package} MATCHES "^Qt[45].*$") - foreach(dir ${MODULES_PACKAGE_DEPENDS_DIRS}) - if(EXISTS "${dir}/MITK_${package}_Config.cmake") - include("${dir}/MITK_${package}_Config.cmake") - break() - endif() - endforeach() - endif() - endforeach() - if(ALL_LIBRARY_DIRS) - list(REMOVE_DUPLICATES ALL_LIBRARY_DIRS) - link_directories(${ALL_LIBRARY_DIRS}) - endif() + _link_directories_for_packages(${PACKAGE_NAMES}) if(MODULE_EXECUTABLE) add_executable(${MODULE_PROVIDES} ${coverage_sources} ${CPP_FILES_GENERATED} ${Q${KITNAME}_GENERATED_CPP} ${DOX_FILES} ${UI_FILES} ${QRC_FILES}) else() add_library(${MODULE_PROVIDES} ${_STATIC} ${coverage_sources} ${CPP_FILES_GENERATED} ${Q${KITNAME}_GENERATED_CPP} ${DOX_FILES} ${UI_FILES} ${QRC_FILES}) endif() if(MODULE_TARGET_DEPENDS) add_dependencies(${MODULE_PROVIDES} ${MODULE_TARGET_DEPENDS}) endif() if(MODULE_SUBPROJECTS) set_property(TARGET ${MODULE_PROVIDES} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK) foreach(subproject ${MODULE_SUBPROJECTS}) add_dependencies(${subproject} ${MODULE_PROVIDES}) endforeach() endif() set(DEPENDS "${MODULE_DEPENDS}") if(NOT MODULE_NO_INIT) # Add a CppMicroServices dependency implicitly, since it is # needed for the generated "module initialization" code. set(DEPENDS "CppMicroServices;${DEPENDS}") endif() - mitk_use_modules(TARGET ${MODULE_PROVIDES} - MODULES ${DEPENDS} - PACKAGES ${MODULE_PACKAGE_DEPENDS} - QT4_MODULES ${MODULE_QT4_MODULES} - QT5_MODULES ${MODULE_QT5_MODULES} - ) + if(DEPENDS OR MODULE_PACKAGE_DEPENDS) + mitk_use_modules(TARGET ${MODULE_PROVIDES} + MODULES ${DEPENDS} + PACKAGES ${MODULE_PACKAGE_DEPENDS} + ) + endif() if(MINGW) target_link_libraries(${MODULE_PROVIDES} ssp) # add stack smash protection lib endif() # Apply properties to the module target. # We cannot use set_target_properties like below since there is no way to # differentiate C/C++ and Releas/Debug flags using target properties. # See http://www.cmake.org/Bug/view.php?id=6493 #set_target_properties(${MODULE_PROVIDES} PROPERTIES # COMPILE_FLAGS "${module_compile_flags}") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${module_c_flags}") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${module_c_flags_debug}") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${module_c_flags_release}") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${module_cxx_flags}") set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} ${module_cxx_flags_debug}") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${module_cxx_flags_release}") # 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_PROVIDES} ${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_PROVIDES}) if(MODULE_AUTOLOAD_WITH) # for auto-loaded modules, adapt the output directory add_dependencies(${_module_autoload_meta_target} ${MODULE_PROVIDES}) 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_PROVIDES} PROPERTIES ${_module_output_prop} ${_module_output_dir}/${MODULE_AUTOLOAD_WITH}) else() set_target_properties(${MODULE_PROVIDES} PROPERTIES ${_module_output_prop} ${CMAKE_${_module_output_prop}}/${MODULE_AUTOLOAD_WITH}) endif() set_target_properties(${MODULE_PROVIDES} 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_PROVIDES}) endif() endif() endif() endif() endif() if(NOT MODULE_IS_ENABLED AND NOT MODULE_EXECUTABLE) _MITK_CREATE_MODULE_CONF() endif() - unset(MODULE_IS_DEPRECATED) + set(MODULE_NAME ${MODULE_NAME} PARENT_SCOPE) + set(MODULE_IS_ENABLED ${MODULE_IS_ENABLED} PARENT_SCOPE) -endmacro(MITK_CREATE_MODULE) +endfunction() diff --git a/CMake/mitkFunctionUseModules.cmake b/CMake/mitkFunctionUseModules.cmake index 7ce13b8c14..1a282c1e82 100644 --- a/CMake/mitkFunctionUseModules.cmake +++ b/CMake/mitkFunctionUseModules.cmake @@ -1,164 +1,180 @@ +function(_mitk_parse_package_args) + set(packages ${ARGN}) + set(PACKAGE_NAMES ) + foreach(_package ${packages}) + string(REPLACE ">" ";" _package_list ${_package}) + if("${_package_list}" STREQUAL "${_package}") + list(APPEND PACKAGE_NAMES ${_package}) + else() + list(GET _package_list 0 _package_name) + list(GET _package_list 1 _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() + list(APPEND PACKAGE_NAMES ${_package_name}) + endif() + endforeach() + + if(PACKAGE_NAMES) + set(package_names_normalized ) + list(REMOVE_DUPLICATES PACKAGE_NAMES) + list(FIND PACKAGE_NAMES Qt4 _has_qt4_dep) + list(FIND PACKAGE_NAMES Qt5 _has_qt5_dep) + foreach(_package_name ${PACKAGE_NAMES}) + set(${_package_name}_REQUIRED_COMPONENTS ) + # Special filter for exclusive OR Qt4 / Qt5 dependency + if(_package_name STREQUAL "Qt4") + if(MITK_USE_Qt4) + list(APPEND package_names_normalized ${_package_name}) + elseif(MITK_USE_Qt5 AND _has_qt5_dep EQUAL -1) + list(APPEND package_names_normalized ${_package_name}) + endif() + elseif(_package_name STREQUAL "Qt5") + if(MITK_USE_Qt5) + list(APPEND package_names_normalized ${_package_name}) + elseif(MITK_USE_Qt4 AND _has_qt4_dep EQUAL -1) + list(APPEND package_names_normalized ${_package_name}) + endif() + else() + list(APPEND package_names_normalized ${_package_name}) + endif() + endforeach() + set(PACKAGE_NAMES ${package_names_normalized}) + endif() + + foreach(_package ${packages}) + string(REPLACE ">" ";" _package_list ${_package}) + if(NOT "${_package_list}" STREQUAL "${_package}") + list(GET _package_list 0 _package_name) + list(GET _package_list 1 _package_components) + string(REPLACE "|" ";" _package_components_list "${_package_components}") + list(APPEND ${_package_name}_REQUIRED_COMPONENTS ${_package_components_list}) + endif() + endforeach() + + foreach(_package_name ${PACKAGE_NAMES}) + if(${_package_name}_REQUIRED_COMPONENTS) + list(REMOVE_DUPLICATES ${_package_name}_REQUIRED_COMPONENTS) + endif() + set(${_package_name}_REQUIRED_COMPONENTS ${${_package_name}_REQUIRED_COMPONENTS} PARENT_SCOPE) + endforeach() + set(PACKAGE_NAMES ${PACKAGE_NAMES} 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, packages, and Qt4 and/or Qt5 -#! components. +#! depends on a set of MITK modules or packages. +#! +#! A package argument is of the form +#! +#! 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) MODULES # MITK modules which the given TARGET uses PACKAGES # MITK packages which the given TARGET uses - QT4_MODULES # Qt4 components the TARGET depends on - QT5_MODULES # Qt5 components the TARGET depends on ) set(_macro_options ) MACRO_PARSE_ARGUMENTS(USE "${_macro_params}" "${_macro_options}" ${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(all_deps ${USE_MODULES} ${USE_PACKAGES}) - set(all_args MODULES PACKAGES) - if(MITK_USE_Qt4) - list(APPEND all_deps ${USE_QT4_MODULES}) - list(APPEND all_args QT4_MODULES) - elseif(MITK_USE_Qt5) - list(APPEND all_deps ${USE_QT5_MODULES}) - list(APPEND all_args QT5_MODULES) - endif() - if(NOT all_deps) - message(SEND_ERROR "The arguments ${all_args} must not all be empty.") - endif() - # The MODULE_NAME variable is used for example in the MITK_Qt5*_Config.cmake files - set(MODULE_NAME ${USE_TARGET}) + set(ALL_INCLUDE_DIRECTORIES) + set(ALL_LIBRARIES) + set(ALL_COMPILE_DEFINITIONS) + set(ALL_META_DEPENDENCIES) - set(depends "") - # check for each parameter if it is a package (3rd party) - set(package_candidates ${USE_MODULES} ${USE_PACKAGES}) - if(MITK_USE_Qt4 AND USE_QT4_MODULES) - list(APPEND package_candidates Qt4) - endif() - if(MITK_USE_Qt5 AND USE_QT5_MODULES) - list(APPEND package_candidates ${USE_QT5_MODULES}) - endif() - set(package_depends ) - if(package_candidates) - foreach(package ${package_candidates}) - set(is_package) - foreach(dir ${MODULES_PACKAGE_DEPENDS_DIRS}) - if(EXISTS "${dir}/MITK_${package}_Config.cmake") - list(APPEND package_depends ${package}) - set(is_package 1) - break() + set(depends ${USE_MODULES}) + set(package_depends ${USE_PACKAGES}) + + # Get transitive MODULE and PACKAGE dependencies + if(depends) + set(depends_before "not initialized") + while(NOT "${depends}" STREQUAL "${depends_before}") + set(depends_before ${depends}) + foreach(dependency ${depends}) + if(NOT ${dependency}_CONFIG_FILE) + message(SEND_ERROR "Missing module: ${dependency}") endif() + include(${${dependency}_CONFIG_FILE}) + list(APPEND package_depends ${${dependency}_PACKAGE_DEPENDS}) + list(APPEND depends ${${dependency}_DEPENDS}) endforeach() - if(NOT is_package) - list(APPEND depends ${package}) - endif() - endforeach() - endif() - set(first_level_module_deps ${depends}) - set(depends_before "not initialized") - while(NOT "${depends}" STREQUAL "${depends_before}") - set(depends_before ${depends}) - foreach(dependency ${depends}) - if(NOT ${dependency}_CONFIG_FILE) - message(SEND_ERROR "Missing module: ${dependency}") - endif() - include(${${dependency}_CONFIG_FILE}) - list(APPEND depends ${${dependency}_DEPENDS}) - list(APPEND package_depends ${${dependency}_PACKAGE_DEPENDS}) - if(MITK_USE_Qt4 AND ${dependency}_QT4_MODULES) - list(APPEND package_depends Qt4) - endif() - if(MITK_USE_Qt5 AND ${dependency}_QT5_MODULES) - list(APPEND package_depends ${${dependency}_QT5_MODULES}) - endif() - endforeach() - - if(depends) list(REMOVE_DUPLICATES depends) list(SORT depends) - endif() - endwhile() - - if(package_depends) - list(REMOVE_DUPLICATES package_depends) - endif() + endwhile() - set(ALL_INCLUDE_DIRECTORIES) - set(ALL_LIBRARIES) - set(ALL_QT4_MODULES ${USE_QT4_MODULES}) - set(ALL_QT5_MODULES ${USE_QT5_MODULES}) - set(ALL_META_DEPENDENCIES) - - foreach(dependency ${depends}) - if(NOT ${dependency}_CONFIG_FILE) - message(SEND_ERROR "Missing module ${dependency}") - endif() - include(${${dependency}_CONFIG_FILE}) - if(${dependency}_IS_DEPRECATED AND NOT MODULE_IS_DEPRECATED) - # Only print the message if the dependent module - # is not deprecated itself and if it is a first-level dependency. - if(first_level_module_deps) - list(FIND first_level_module_deps ${dependency} _index) + # Iterate over all module dependencies + foreach(dependency ${depends}) + if(${dependency}_IS_DEPRECATED AND NOT MODULE_IS_DEPRECATED) + # Only print the message if the dependent module + # is not deprecated itself and if it is a first-level dependency. + list(FIND USE_MODULES ${dependency} _index) if(_index GREATER -1) message(WARNING "Module ${dependency} is deprecated since ${${dependency}_DEPRECATED_SINCE}") endif() endif() - endif() - list(APPEND ALL_INCLUDE_DIRECTORIES ${${dependency}_INCLUDE_DIRS}) - list(APPEND ALL_LIBRARIES ${${dependency}_PROVIDES}) - list(APPEND ALL_QT4_MODULES ${${dependency}_QT4_MODULES}) - list(APPEND ALL_QT5_MODULES ${${dependency}_QT5_MODULES}) - if(TARGET ${dependency}-autoload) - list(APPEND ALL_META_DEPENDENCIES ${dependency}-autoload) - endif() - endforeach(dependency) + list(APPEND ALL_INCLUDE_DIRECTORIES ${${dependency}_INCLUDE_DIRS}) + list(APPEND ALL_LIBRARIES ${${dependency}_PROVIDES}) + if(TARGET ${dependency}-autoload) + list(APPEND ALL_META_DEPENDENCIES ${dependency}-autoload) + endif() + endforeach() - if(ALL_QT4_MODULES) - list(REMOVE_DUPLICATES ALL_QT4_MODULES) - endif() - if(ALL_QT5_MODULES) - list(REMOVE_DUPLICATES ALL_QT5_MODULES) + list(APPEND ALL_INCLUDE_DIRECTORIES ${MODULES_CONF_DIRS}) endif() - set(MODULE_QT4_MODULES ${ALL_QT4_MODULES}) - foreach(package ${package_depends}) - foreach(dir ${MODULES_PACKAGE_DEPENDS_DIRS}) - if(EXISTS "${dir}/MITK_${package}_Config.cmake") - include("${dir}/MITK_${package}_Config.cmake") - break() + # Parse package dependencies + if(package_depends) + _mitk_parse_package_args(${package_depends}) + + # Read all package information + foreach(_package ${PACKAGE_NAMES}) + set(${_package}_REQUIRED_COMPONENTS_BY_MODULE ${${_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("${dir}/MITK_${_package}_Config.cmake") + set(_package_found 1) + break() + endif() + endforeach() + if(NOT _package_found) + message(SEND_ERROR "Missing package: ${_package}") endif() endforeach() - endforeach() - - if(depends) - list(APPEND ALL_INCLUDE_DIRECTORIES ${MODULES_CONF_DIRS}) endif() if(ALL_INCLUDE_DIRECTORIES) - list(REMOVE_DUPLICATES ALL_INCLUDE_DIRECTORIES) include_directories(${ALL_INCLUDE_DIRECTORIES}) endif() + if(ALL_COMPILE_DEFINITIONS) + set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS ${ALL_COMPILE_DEFINITIONS}) + endif() + if(ALL_LIBRARIES) target_link_libraries(${USE_TARGET} ${ALL_LIBRARIES}) endif() set(ALL_INCLUDE_DIRECTORIES ${ALL_INCLUDE_DIRECTORIES} PARENT_SCOPE) set(ALL_LIBRARIES ${ALL_LIBRARIES} PARENT_SCOPE) - set(ALL_QT4_MODULES ${ALL_QT4_MODULES} PARENT_SCOPE) - set(ALL_QT5_MODULES ${ALL_QT5_MODULES} PARENT_SCOPE) set(ALL_META_DEPENDENCIES ${ALL_META_DEPENDENCIES} PARENT_SCOPE) endfunction() diff --git a/CMake/mitkMacroCheckModule.cmake b/CMake/mitkMacroCheckModule.cmake index 0c9f4054ca..950e607421 100644 --- a/CMake/mitkMacroCheckModule.cmake +++ b/CMake/mitkMacroCheckModule.cmake @@ -1,63 +1,64 @@ # Usage: MITK_CHECK_MODULE(RESULT_VAR [dependencies ...] ) # check if all required modules exist and stores missing module names in RESULT_VAR. macro(MITK_CHECK_MODULE RESULT_VAR) + message(WARNING "This macro is deprecated since 2014.03. Please use mitk_check_module_dependencies() instead.") set(${RESULT_VAR} "") set(DEPENDS "") set(DEPENDS_BEFORE "not initialized") set(PACKAGE_DEPENDS "") # check for each parameter if it is a package (3rd party) foreach(package ${ARGN}) set(is_package) foreach(dir ${MODULES_PACKAGE_DEPENDS_DIRS}) if(EXISTS "${dir}/MITK_${package}_Config.cmake") list(APPEND PACKAGE_DEPENDS ${package}) set(is_package 1) break() endif() endforeach() if(NOT is_package) list(APPEND DEPENDS ${package}) endif() endforeach(package) while(NOT "${DEPENDS}" STREQUAL "${DEPENDS_BEFORE}") set(DEPENDS_BEFORE ${DEPENDS}) foreach(dependency ${DEPENDS}) set(_module_found 1) if(NOT ${dependency}_CONFIG_FILE) set(_module_found 0) endif() set(_dependency_file_name ${${dependency}_CONFIG_FILE}) if(NOT EXISTS ${_dependency_file_name}) set(_module_found 0) endif() if(_module_found) include(${_dependency_file_name}) if(${dependency}_IS_ENABLED) list(APPEND DEPENDS ${${dependency}_DEPENDS}) list(APPEND PACKAGE_DEPENDS ${${dependency}_PACKAGE_DEPENDS}) else(${dependency}_IS_ENABLED) list(APPEND ${RESULT_VAR} ${dependency}) list(REMOVE_DUPLICATES ${RESULT_VAR}) endif(${dependency}_IS_ENABLED) else() list(APPEND ${RESULT_VAR} ${dependency}) list(REMOVE_DUPLICATES ${RESULT_VAR}) endif() endforeach(dependency) list(REMOVE_DUPLICATES DEPENDS) list(REMOVE_DUPLICATES PACKAGE_DEPENDS) list(SORT DEPENDS) list(SORT PACKAGE_DEPENDS) endwhile() foreach(_package ${PACKAGE_DEPENDS}) if((DEFINED MITK_USE_${_package}) AND NOT (${MITK_USE_${_package}})) list(APPEND ${RESULT_VAR} ${_package}) endif() endforeach() endmacro(MITK_CHECK_MODULE) diff --git a/CMake/mitkMacroCreateCTKPlugin.cmake b/CMake/mitkMacroCreateCTKPlugin.cmake index b0c6ca3108..3e58dd5010 100644 --- a/CMake/mitkMacroCreateCTKPlugin.cmake +++ b/CMake/mitkMacroCreateCTKPlugin.cmake @@ -1,100 +1,86 @@ macro(MACRO_CREATE_MITK_CTK_PLUGIN) - MACRO_PARSE_ARGUMENTS(_PLUGIN "EXPORT_DIRECTIVE;EXPORTED_INCLUDE_SUFFIXES;MODULE_DEPENDENCIES;SUBPROJECTS" "TEST_PLUGIN;NO_INSTALL" ${ARGN}) + MACRO_PARSE_ARGUMENTS(_PLUGIN "EXPORT_DIRECTIVE;EXPORTED_INCLUDE_SUFFIXES;MODULE_DEPENDENCIES;MODULE_DEPENDS;PACKAGE_DEPENDS;SUBPROJECTS" "TEST_PLUGIN;NO_INSTALL" ${ARGN}) - if (MITK_USE_Qt4 AND PLUGIN_QT4_MODULES) - list(APPEND _PLUGIN_MODULE_DEPENDENCIES Qt4) - endif() - if (MITK_USE_Qt5 AND PLUGIN_QT5_MODULES) - list(APPEND _PLUGIN_MODULE_DEPENDENCIES Qt5) + mitk_check_module_dependencies(MODULES Mitk ${_PLUGIN_MODULE_DEPENDENCIES} ${_PLUGIN_MODULE_DEPENDS} + PACKAGES ${_PLUGIN_PACKAGE_DEPENDS} + MISSING_DEPENDENCIES_VAR _missing_deps + PACKAGE_DEPENDENCIES_VAR _package_deps) + + if(_PLUGIN_MODULE_DEPENDENCIES) + message(WARNING "The MODULE_DEPENDENCIES argument is deprecated since 2014.03. Please use MODULE_DEPENDS instead.") endif() - MITK_CHECK_MODULE(_MODULE_CHECK_RESULT Mitk ${_PLUGIN_MODULE_DEPENDENCIES}) - if(NOT _MODULE_CHECK_RESULT) + if(NOT _missing_deps) if(_PLUGIN_TEST_PLUGIN) set(is_test_plugin "TEST_PLUGIN") set(_PLUGIN_NO_INSTALL 1) else() set(is_test_plugin) endif() if(_PLUGIN_NO_INSTALL) set(plugin_no_install "NO_INSTALL") else() set(plugin_no_install) endif() - # The PACKAGE_DEPENDS variable is filled in the MITK_CHECK_MODULE() macro - foreach(package ${PACKAGE_DEPENDS}) - if(NOT ${package} MATCHES "^Qt[45].*$") - foreach(dir ${MODULES_PACKAGE_DEPENDS_DIRS}) - if(EXISTS "${dir}/MITK_${package}_Config.cmake") - include("${dir}/MITK_${package}_Config.cmake") - break() - endif() - endforeach() - endif() - endforeach() - if(ALL_LIBRARY_DIRS) - list(REMOVE_DUPLICATES ALL_LIBRARY_DIRS) - link_directories(${ALL_LIBRARY_DIRS}) - endif() + _link_directories_for_packages(${_package_deps}) MACRO_CREATE_CTK_PLUGIN(EXPORT_DIRECTIVE ${_PLUGIN_EXPORT_DIRECTIVE} EXPORTED_INCLUDE_SUFFIXES ${_PLUGIN_EXPORTED_INCLUDE_SUFFIXES} DOXYGEN_TAGFILES ${_PLUGIN_DOXYGEN_TAGFILES} MOC_OPTIONS -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -DBOOST_TT_HAS_OPERATOR_HPP_INCLUDED ${is_test_plugin} ${plugin_no_install}) mitk_use_modules(TARGET ${PLUGIN_TARGET} - MODULES Mitk ${_PLUGIN_MODULE_DEPENDENCIES} - QT4_MODULES ${PLUGIN_QT4_MODULES} - QT5_MODULES ${PLUGIN_QT5_MODULES} + MODULES Mitk ${_PLUGIN_MODULE_DEPENDENCIES} ${_PLUGIN_MODULE_DEPENDS} + PACKAGES ${_PLUGIN_PACKAGE_DEPENDS} ) if(ALL_META_DEPENDENCIES) add_dependencies(${PLUGIN_TARGET} ${ALL_META_DEPENDENCIES}) endif() if(MITK_DEFAULT_SUBPROJECTS AND NOT MY_SUBPROJECTS) set(MY_SUBPROJECTS ${MITK_DEFAULT_SUBPROJECTS}) endif() if(MY_SUBPROJECTS) set_property(TARGET ${PLUGIN_TARGET} PROPERTY LABELS ${MY_SUBPROJECTS}) foreach(subproject ${MY_SUBPROJECTS}) add_dependencies(${subproject} ${PLUGIN_TARGET}) endforeach() endif() #------------------------------------------------------------# #------------------ Installer support -----------------------# if(NOT _PLUGIN_NO_INSTALL) set(_autoload_targets ) foreach(_dependency ${ALL_DEPENDENCIES}) 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() - else(NOT _MODULE_CHECK_RESULT) + else() if(NOT MITK_BUILD_ALL_PLUGINS) - message(SEND_ERROR "${PROJECT_NAME} is missing requirements and won't be built. Missing: ${_MODULE_CHECK_RESULT}") + 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: ${_MODULE_CHECK_RESULT}") + message(STATUS "${PROJECT_NAME} is missing requirements and won't be built. Missing: ${_missing_deps}") endif() - endif(NOT _MODULE_CHECK_RESULT) + endif() endmacro() diff --git a/CMake/mitkMacroCreateExecutable.cmake b/CMake/mitkMacroCreateExecutable.cmake index 7a199728a9..e8e31739d8 100644 --- a/CMake/mitkMacroCreateExecutable.cmake +++ b/CMake/mitkMacroCreateExecutable.cmake @@ -1,95 +1,91 @@ ################################################################## # # MITK_CREATE_EXECUTABLE # #! Creates an executable with MITK dependencies and batch files #! for proper application start-up. #! #! USAGE: #! #! \code #! MITK_CREATE_EXECUTABLE( #! [DEPENDS ] #! [PACKAGE_DEPENDS ] #! [INCLUDE_DIRS ] #! [TARGET_DEPENDS #! [WARNINGS_AS_ERRORS] #! \endcode #! #! \param EXECUTABLE_NAME The name for the new executable target ################################################################## macro(mitk_create_executable EXECUTABLE_NAME) set(_macro_params SUBPROJECTS # list of CDash labels VERSION # version number, e.g. "1.2.0" INCLUDE_DIRS # additional include dirs DEPENDS # list of modules this module depends on PACKAGE_DEPENDS # list of "packages" this module depends on (e.g. Qt, VTK, etc.) TARGET_DEPENDS # list of CMake targets this executable should depend on ADDITIONAL_LIBS # list of additional libraries linked to this executable FILES_CMAKE # file name of a CMake file setting source list variables # (defaults to files.cmake) - QT4_MODULES # the executable depends on a given list of Qt 4 modules - QT5_MODULES # the executable depends on a given list of Qt 5 modules ) set(_macro_options NO_INIT # do not create CppMicroServices initialization code NO_BATCH_FILE # do not create batch files on Windows WARNINGS_AS_ERRORS # treat all compiler warnings as errors ) MACRO_PARSE_ARGUMENTS(EXEC "${_macro_params}" "${_macro_options}" ${ARGN}) set(EXEC_NAME ${EXECUTABLE_NAME}) set(_EXEC_OPTIONS EXECUTABLE) if(EXEC_NO_INIT) list(APPEND _EXEC_OPTIONS NO_INIT) endif() if(EXEC_WARNINGS_AS_ERRORS) list(APPEND _EXEC_OPTIONS WARNINGS_AS_ERRORS) endif() mitk_create_module(${EXEC_NAME} SUBPROJECTS ${EXEC_SUBPROJECTS} VERSION ${EXEC_VERSION} INCLUDE_DIRS ${EXEC_INCLUDE_DIRS} DEPENDS ${EXEC_DEPENDS} PACKAGE_DEPENDS ${EXEC_PACKAGE_DEPENDS} TARGET_DEPENDS ${EXEC_TARGET_DEPENDS} ADDITIONAL_LIBS ${EXEC_ADDITIONAL_LIBS} FILES_CMAKE ${EXEC_FILES_CMAKE} - QT4_MODULES ${EXEC_QT4_MODULES} - QT5_MODULES ${EXEC_QT5_MODULES} ${_EXEC_OPTIONS} ) # Add meta dependencies (e.g. on auto-load modules from depending modules) if(ALL_META_DEPENDENCIES) add_dependencies(${EXEC_NAME} ${ALL_META_DEPENDENCIES}) endif() # Create batch files for Windows platforms if(WIN32) set(_batch_file_in "${CMAKE_CURRENT_SOURCE_DIR}/${EXEC_NAME}.bat.in") if(NOT EXISTS "${_batch_file_in}") set(_batch_file_in "${MITK_CMAKE_DIR}/StartApp.bat.in") endif() if(CMAKE_RUNTIME_OUTPUT_DIRECTORY) set(_batch_file_out_dir "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}") else() set(_batch_file_out_dir "${CMAKE_CURRENT_BINARY_DIR}") endif() if(NOT EXEC_NO_BATCH_FILE) foreach(BUILD_TYPE debug release) mitkFunctionCreateWindowsBatchScript( ${_batch_file_in} ${_batch_file_out_dir}/${EXEC_NAME}_${BUILD_TYPE}.bat ${BUILD_TYPE} ) endforeach() endif() endif() endmacro() diff --git a/CMake/mitkMacroCreateModuleConf.cmake b/CMake/mitkMacroCreateModuleConf.cmake index 0807acc01c..3070974beb 100644 --- a/CMake/mitkMacroCreateModuleConf.cmake +++ b/CMake/mitkMacroCreateModuleConf.cmake @@ -1,35 +1,35 @@ ################################################################### # # MITK_CREATE_MODULE_CONF # # This can be called in a similar way like MITK_CREATE_MODULE # but it just creates the module configuration files without # actually building it. It is used for integration of legacy libraries # into the MITK module build system # ################################################################## macro(MITK_CREATE_MODULE_CONF MODULE_NAME_IN) - MACRO_PARSE_ARGUMENTS(MODULE "INCLUDE_DIRS;DEPENDS;PACKAGE_DEPENDS;QT4_MODULES;QT5_MODULES" "QT_MODULE;HEADERS_ONLY" ${ARGN}) + MACRO_PARSE_ARGUMENTS(MODULE "INCLUDE_DIRS;DEPENDS;PACKAGE_DEPENDS" "QT_MODULE;HEADERS_ONLY" ${ARGN}) set(MODULE_NAME ${MODULE_NAME_IN}) if(MODULE_HEADERS_ONLY) set(MODULE_PROVIDES ) else() set(MODULE_PROVIDES ${MODULE_NAME}) endif() set(MODULE_IS_ENABLED 1) if(MODULE_QT_MODULE) - message(WARNING "The QT_MODULE option is deprecated. Use QT4_MODULES and/or QT5_MODULES instead.") - if(NOT MODULE_QT4_MODULES) - set(MODULE_QT4_MODULES QtGui) + message(WARNING "The QT_MODULE option is deprecated. Please use PACKAGE_DEPENDS Qt4>QtCore and/or PACKAGE_DEPENDS Qt5>Core instead.") + if (NOT "${MODULE_PACKAGE_DEPENDS}" MATCHES "^.*Qt4.*$") + list(APPEND MODULE_PACKAGE_DEPENDS Qt4>QtGui) endif() endif() list(APPEND MODULE_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}) _MITK_CREATE_MODULE_CONF() endmacro(MITK_CREATE_MODULE_CONF) macro(_MITK_CREATE_MODULE_CONF) set(${MODULE_NAME}_CONFIG_FILE "${CMAKE_BINARY_DIR}/${MODULES_CONF_DIRNAME}/${MODULE_NAME}Config.cmake" CACHE INTERNAL "Path to module config" FORCE) configure_file(${MITK_SOURCE_DIR}/CMake/moduleConf.cmake.in ${${MODULE_NAME}_CONFIG_FILE} @ONLY) endmacro(_MITK_CREATE_MODULE_CONF) diff --git a/CMake/mitkMacroCreateModuleTests.cmake b/CMake/mitkMacroCreateModuleTests.cmake index c8a19ace0b..72125773fe 100644 --- a/CMake/mitkMacroCreateModuleTests.cmake +++ b/CMake/mitkMacroCreateModuleTests.cmake @@ -1,149 +1,132 @@ # # 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) MACRO_PARSE_ARGUMENTS(MODULE_TEST "EXTRA_DRIVER_INIT;EXTRA_DRIVER_INCLUDE;EXTRA_DEPENDS" "" ${ARGN}) if(BUILD_TESTING AND MODULE_IS_ENABLED) set(OLD_MOC_H_FILES ${MOC_H_FILES}) set(MOC_H_FILES) include(files.cmake) include_directories(.) - if(MODULE_TEST_EXTRA_DEPENDS) - message(WARNING "The keyword EXTRA_DEPENDS is deprecated. Use a separate call to mitk_use_modules instead.") - endif() - if(DEFINED MOC_H_FILES) QT4_WRAP_CPP(MODULE_TEST_GENERATED_MOC_CPP ${MOC_H_FILES} OPTIONS -DBOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) endif(DEFINED MOC_H_FILES) - # The PACKAGE_DEPENDS variable is filled in the MITK_CHECK_MODULE() macro - foreach(package ${PACKAGE_DEPENDS}) - if(NOT ${package} MATCHES "^Qt[45].*$") - foreach(dir ${MODULES_PACKAGE_DEPENDS_DIRS}) - if(EXISTS "${dir}/MITK_${package}_Config.cmake") - include("${dir}/MITK_${package}_Config.cmake") - break() - endif() - endforeach() - endif() - endforeach() - if(ALL_LIBRARY_DIRS) - list(REMOVE_DUPLICATES ALL_LIBRARY_DIRS) - link_directories(${ALL_LIBRARY_DIRS}) - endif() + mitk_check_module_dependencies(MODULES ${MODULE_NAME} MitkTestingHelper ${MODULE_TEST_EXTRA_DEPENDS} + PACKAGE_DEPENDENCIES_VAR package_deps) + _link_directories_for_packages(${package_deps}) set(TESTDRIVER ${MODULE_NAME}TestDriver) set(MODULE_TEST_EXTRA_DRIVER_INIT "${MODULE_TEST_EXTRA_DRIVER_INIT}") # Write a header file containing include directives and custom code # for the test driver. - set(_extra_include_content ) + 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(_extra_include_content "${_extra_include_content} + set(TESTDRIVER_EXTRA_INCLUDES "${TESTDRIVER_EXTRA_INCLUDES} #include <${_include}>") endforeach() - set(_extra_include_content "${_extra_include_content} + set(TESTDRIVER_EXTRA_INCLUDES "${TESTDRIVER_EXTRA_INCLUDES} #include std::vector globalCmdLineArgs;") set(_extra_include_file ${CMAKE_CURRENT_BINARY_DIR}/${TESTDRIVER}_extras.h) - file(WRITE ${_extra_include_file} "${_extra_include_content}") + 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(MODULETEST_SOURCE ${MODULE_NAME}TestDriver.cpp ${MODULE_TESTS} ${MODULE_IMAGE_TESTS} ${MODULE_SURFACE_TESTS} ${MODULE_CUSTOM_TESTS} EXTRA_INCLUDE ${_extra_include_file} ) add_executable(${TESTDRIVER} ${MODULETEST_SOURCE} ${MODULE_TEST_GENERATED_MOC_CPP} ${TEST_CPP_FILES}) mitk_use_modules(TARGET ${TESTDRIVER} - MODULES ${MODULE_PROVIDES} ${MODULE_TEST_EXTRA_DEPENDS} - PACKAGES CppUnit + MODULES ${MODULE_NAME} MitkTestingHelper ${MODULE_TEST_EXTRA_DEPENDS} ) if(MODULE_SUBPROJECTS) foreach(subproject ${MODULE_SUBPROJECTS}) add_dependencies(${subproject} ${TESTDRIVER}) endforeach() endif() # # 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. # foreach( test ${MODULE_TESTS} ) get_filename_component(TName ${test} NAME_WE) add_test(${TName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} ${TName}) # Add labels for CDash subproject support if(MODULE_SUBPROJECTS) set_property(TEST ${TName} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK) endif() endforeach( test ) foreach(image ${MODULE_TESTIMAGES} ${ADDITIONAL_TEST_IMAGES} ) if(EXISTS ${image}) set(IMAGE_FULL_PATH ${image}) else(EXISTS ${image}) # todo: maybe search other paths as well # yes, please in mitk/Testing/Data, too set(IMAGE_FULL_PATH ${MITK_DATA_DIR}/${image}) endif(EXISTS ${image}) if(EXISTS ${IMAGE_FULL_PATH}) foreach( test ${MODULE_IMAGE_TESTS} ) get_filename_component(TName ${test} NAME_WE) get_filename_component(ImageName ${IMAGE_FULL_PATH} NAME) add_test(${TName}_${ImageName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} ${TName} ${IMAGE_FULL_PATH}) # Add labels for CDash subproject support if(MODULE_SUBPROJECTS) set_property(TEST ${TName}_${ImageName} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK) endif() endforeach( test ) else(EXISTS ${IMAGE_FULL_PATH}) message("!!!!! No such file: ${IMAGE_FULL_PATH} !!!!!") endif(EXISTS ${IMAGE_FULL_PATH}) endforeach( image ) foreach(surface ${MODULE_TESTSURFACES} ${ADDITIONAL_TEST_SURFACES} ) if(EXISTS ${surface}) set(SURFACE_FULL_PATH ${surface}) else(EXISTS ${surface}) # todo: maybe search other paths as well # yes, please in mitk/Testing/Data, too set(SURFACE_FULL_PATH ${MITK_DATA_DIR}/${surface}) endif(EXISTS ${surface}) if(EXISTS ${SURFACE_FULL_PATH}) foreach( test ${MODULE_SURFACE_TESTS} ) get_filename_component(TName ${test} NAME_WE) get_filename_component(SurfaceName ${SURFACE_FULL_PATH} NAME) add_test(${TName}_${SurfaceName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} ${TName} ${SURFACE_FULL_PATH}) # Add labels for CDash subproject support if(MODULE_SUBPROJECTS) set_property(TEST ${TName}_${SurfaceName} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK) endif() endforeach( test ) else(EXISTS ${SURFACE_FULL_PATH}) message("!!!!! No such surface file: ${SURFACE_FULL_PATH} !!!!!") endif(EXISTS ${SURFACE_FULL_PATH}) endforeach( surface ) set(MOC_H_FILES ${OLD_MOC_H_FILES}) endif(BUILD_TESTING AND MODULE_IS_ENABLED) endmacro(MITK_CREATE_MODULE_TESTS) diff --git a/CMake/mitkMacroUseModule.cmake b/CMake/mitkMacroUseModule.cmake index 1e0968bfbd..396f637361 100644 --- a/CMake/mitkMacroUseModule.cmake +++ b/CMake/mitkMacroUseModule.cmake @@ -1,88 +1,86 @@ macro(MITK_USE_MODULE) message(WARNING "The MITK_USE_MODULE macro is deprecated, use the mitk_use_modules macro instead.") set(MODULE_FIRST_LEVEL_DEPENDS ${ARGN}) set(DEPENDS "") set(DEPENDS_BEFORE "not initialized") # check for each parameter if it is a package (3rd party) foreach(package ${MODULE_FIRST_LEVEL_DEPENDS}) set(is_package) foreach(dir ${MODULES_PACKAGE_DEPENDS_DIRS}) if(EXISTS "${dir}/MITK_${package}_Config.cmake") list(APPEND PACKAGE_DEPENDS ${package}) set(is_package 1) break() endif() endforeach() if(NOT is_package) list(APPEND DEPENDS ${package}) endif() endforeach(package) while(NOT "${DEPENDS}" STREQUAL "${DEPENDS_BEFORE}") set(DEPENDS_BEFORE ${DEPENDS}) foreach(dependency ${DEPENDS}) if(NOT ${dependency}_CONFIG_FILE) message(SEND_ERROR "Missing module: ${dependency}") endif() include(${${dependency}_CONFIG_FILE}) list(APPEND DEPENDS ${${dependency}_DEPENDS}) list(APPEND PACKAGE_DEPENDS ${${dependency}_PACKAGE_DEPENDS}) endforeach(dependency) if(DEPENDS) list(REMOVE_DUPLICATES DEPENDS) list(SORT DEPENDS) endif(DEPENDS) if(PACKAGE_DEPENDS) list(REMOVE_DUPLICATES PACKAGE_DEPENDS) list(SORT PACKAGE_DEPENDS) endif(PACKAGE_DEPENDS) endwhile() # CMake Debug set(ALL_DEPENDENCIES ${DEPENDS}) foreach(dependency ${DEPENDS} ${MODULE_DEPENDS_INTERNAL}) if(NOT ${dependency}_CONFIG_FILE) message(SEND_ERROR "Missing module ${dependency}") endif() include(${${dependency}_CONFIG_FILE}) if(${dependency}_IS_DEPRECATED AND NOT MODULE_IS_DEPRECATED) # Only print the message if the dependent module # is not deprecated itself and if it is a first-level dependency. if(MODULE_FIRST_LEVEL_DEPENDS) list(FIND MODULE_FIRST_LEVEL_DEPENDS ${dependency} _index) if(_index GREATER -1) message(WARNING "Module ${dependency} is deprecated since ${${dependency}_DEPRECATED_SINCE}") endif() endif() endif() list(APPEND ALL_INCLUDE_DIRECTORIES ${${dependency}_INCLUDE_DIRS}) list(APPEND ALL_LIBRARIES ${${dependency}_PROVIDES}) list(APPEND ALL_LIBRARY_DIRS ${${dependency}_LIBRARY_DIRS}) - list(APPEND MODULE_QT4_MODULES ${${dependency}_QT4_MODULES}) - list(APPEND MODULE_QT5_MODULES ${${dependency}_QT5_MODULES}) if(TARGET ${dependency}-autoload) list(APPEND ALL_META_DEPENDENCIES ${dependency}-autoload) endif() endforeach(dependency) foreach(package ${PACKAGE_DEPENDS}) foreach(dir ${MODULES_PACKAGE_DEPENDS_DIRS}) if(EXISTS "${dir}/MITK_${package}_Config.cmake") include("${dir}/MITK_${package}_Config.cmake") break() endif() endforeach() #set(ALL_INCLUDE_DIRECTORIES ${ALL_INCLUDE_DIRECTORIES} ${${package}_INCLUDE_DIRS}) # set(ALL_LIBRARIES ${ALL_LIBRARIES} ${${package}_LIBRARIES}) endforeach(package) set(ALL_LIBRARIES ${ALL_LIBRARIES} ${MODULE_ADDITIONAL_LIBS}) set(ALL_INCLUDE_DIRECTORIES ${MITK_BINARY_DIR} ${ALL_INCLUDE_DIRECTORIES} ${MODULE_INCLUDE_DIRS} ${MODULE_INTERNAL_INCLUDE_DIRS} ${MODULES_CONF_DIRS}) if(ALL_INCLUDE_DIRECTORIES) list(REMOVE_DUPLICATES ALL_INCLUDE_DIRECTORIES) endif() if(ALL_LIBRARY_DIRS) list(REMOVE_DUPLICATES ALL_LIBRARY_DIRS) endif(ALL_LIBRARY_DIRS) endmacro(MITK_USE_MODULE) diff --git a/CMake/mitkTestDriverExtraIncludes.h.in b/CMake/mitkTestDriverExtraIncludes.h.in new file mode 100644 index 0000000000..ae152a86cd --- /dev/null +++ b/CMake/mitkTestDriverExtraIncludes.h.in @@ -0,0 +1 @@ +@TESTDRIVER_EXTRA_INCLUDES@ diff --git a/CMake/moduleConf.cmake.in b/CMake/moduleConf.cmake.in index 4fea866d81..38d759039d 100644 --- a/CMake/moduleConf.cmake.in +++ b/CMake/moduleConf.cmake.in @@ -1,14 +1,12 @@ set(@MODULE_NAME@_IS_ENABLED "@MODULE_IS_ENABLED@") set(@MODULE_NAME@_IS_DEPRECATED "@MODULE_IS_DEPRECATED@") set(@MODULE_NAME@_DEPRECATED_SINCE "@MODULE_DEPRECATED_SINCE@") if(@MODULE_NAME@_IS_ENABLED) @MODULE_EXTRA_CMAKE_CODE@ set(@MODULE_NAME@_INCLUDE_DIRS "@MODULE_INCLUDE_DIRS@") set(@MODULE_NAME@_PROVIDES "@MODULE_PROVIDES@") set(@MODULE_NAME@_DEPENDS "@MODULE_DEPENDS@") set(@MODULE_NAME@_PACKAGE_DEPENDS "@MODULE_PACKAGE_DEPENDS@") - set(@MODULE_NAME@_QT4_MODULES "@MODULE_QT4_MODULES@") - set(@MODULE_NAME@_QT5_MODULES "@MODULE_QT5_MODULES@") set(@MODULE_NAME@_LIBRARY_DIRS "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@") endif(@MODULE_NAME@_IS_ENABLED) diff --git a/CMakeLists.txt b/CMakeLists.txt index 69a2afc50d..c1637cda1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,1016 +1,1011 @@ if(MITK_USE_QT AND DESIRED_QT_VERSION MATCHES 5) cmake_minimum_required(VERSION 2.8.9) elseif(APPLE) # With XCode 4.3, the SDK location changed. Older CMake # versions are not able to find it. cmake_minimum_required(VERSION 2.8.8) else() cmake_minimum_required(VERSION 2.8.5) endif() #----------------------------------------------------------------------------- # Include ctest launchers for dashboard in case of makefile generator #----------------------------------------------------------------------------- if(${CMAKE_VERSION} VERSION_GREATER "2.8.9") include(CTestUseLaunchers) endif() #----------------------------------------------------------------------------- # 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() #----------------------------------------------------------------------------- # 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) endif() #----------------------------------------------------------------------------- # 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 43) # _src_dir_length_max - strlen(ITK-src) 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() #----------------------------------------------------------------------------- # See http://cmake.org/cmake/help/cmake-2-8-docs.html#section_Policies for details #----------------------------------------------------------------------------- set(project_policies CMP0001 # NEW: CMAKE_BACKWARDS_COMPATIBILITY should no longer be used. CMP0002 # NEW: Logical target names must be globally unique. CMP0003 # NEW: Libraries linked via full path no longer produce linker search paths. CMP0004 # NEW: Libraries linked may NOT have leading or trailing whitespace. CMP0005 # NEW: Preprocessor definition values are now escaped automatically. CMP0006 # NEW: Installing MACOSX_BUNDLE targets requires a BUNDLE DESTINATION. CMP0007 # NEW: List command no longer ignores empty elements. CMP0008 # NEW: Libraries linked by full-path must have a valid library file name. CMP0009 # NEW: FILE GLOB_RECURSE calls should not follow symlinks by default. CMP0010 # NEW: Bad variable reference syntax is an error. CMP0011 # NEW: Included scripts do automatic cmake_policy PUSH and POP. CMP0012 # NEW: if() recognizes numbers and boolean constants. CMP0013 # NEW: Duplicate binary directories are not allowed. CMP0014 # NEW: Input directories must have CMakeLists.txt CMP0020 # NEW: Automatically link Qt executables to qtmain target on Windows ) foreach(policy ${project_policies}) if(POLICY ${policy}) cmake_policy(SET ${policy} NEW) endif() endforeach() #----------------------------------------------------------------------------- # Update CMake module path #------------------------------------------------------------------------------ set(MITK_CMAKE_DIR ${MITK_SOURCE_DIR}/CMake) set(CMAKE_MODULE_PATH ${MITK_CMAKE_DIR} ${CMAKE_MODULE_PATH} ) #----------------------------------------------------------------------------- # CMake function(s) and macro(s) #----------------------------------------------------------------------------- include(mitkMacroEmptyExternalProject) include(mitkFunctionGenerateProjectXml) include(mitkFunctionSuppressWarnings) SUPPRESS_VC_DEPRECATED_WARNINGS() #----------------------------------------------------------------------------- # Output directories. #----------------------------------------------------------------------------- foreach(type LIBRARY RUNTIME ARCHIVE) # Make sure the directory exists if(DEFINED 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_USE_SUPERBUILD) set(output_dir ${MITK_BINARY_DIR}/bin) if(NOT DEFINED MITK_CMAKE_${type}_OUTPUT_DIRECTORY) set(MITK_CMAKE_${type}_OUTPUT_DIRECTORY ${MITK_BINARY_DIR}/MITK-build/bin) endif() else() if(NOT DEFINED MITK_CMAKE_${type}_OUTPUT_DIRECTORY) set(output_dir ${MITK_BINARY_DIR}/bin) else() set(output_dir ${MITK_CMAKE_${type}_OUTPUT_DIRECTORY}) endif() endif() set(CMAKE_${type}_OUTPUT_DIRECTORY ${output_dir} CACHE INTERNAL "Single output directory for building all libraries.") mark_as_advanced(CMAKE_${type}_OUTPUT_DIRECTORY) endforeach() #----------------------------------------------------------------------------- # Additional MITK Options (also shown during superbuild) #----------------------------------------------------------------------------- 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_BUILD_ALL_APPS "Build all MITK applications" OFF) set(MITK_BUILD_TUTORIAL OFF CACHE INTERNAL "Deprecated! Use MITK_BUILD_EXAMPLES instead!") option(MITK_BUILD_EXAMPLES "Build the MITK Examples" ${MITK_BUILD_TUTORIAL}) option(MITK_USE_ACVD "Use Approximated Centroidal Voronoi Diagrams" OFF) option(MITK_USE_GLEW "Use the GLEW library" ON) option(MITK_USE_Boost "Use the Boost C++ library" OFF) option(MITK_USE_BLUEBERRY "Build the BlueBerry platform" ON) option(MITK_USE_CTK "Use CTK in MITK" ${MITK_USE_BLUEBERRY}) option(MITK_USE_QT "Use Nokia's Qt library" ${MITK_USE_CTK}) set(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of Qt to use: 4 or 5") set(MITK_DESIRED_QT_VERSION ${DESIRED_QT_VERSION}) option(MITK_USE_DCMTK "EXPERIMENTAL, superbuild only: Use DCMTK in MITK" ${MITK_USE_CTK}) option(MITK_USE_OpenCV "Use Intel's OpenCV library" OFF) option(MITK_USE_OpenCL "Use OpenCL GPU-Computing library" OFF) option(MITK_USE_Poco "Use the Poco library" ON) option(MITK_USE_SOFA "Use Simulation Open Framework Architecture" OFF) option(MITK_USE_Python "Use Python wrapping in MITK" OFF) set(MITK_USE_CableSwig ${MITK_USE_Python}) option(MITK_ENABLE_PIC_READER "Enable support for reading the DKFZ pic file format." ON) mark_as_advanced(MITK_BUILD_ALL_APPS MITK_USE_GLEW MITK_USE_CTK MITK_USE_DCMTK MITK_ENABLE_PIC_READER ) if(MITK_USE_Python) FIND_PACKAGE(PythonLibs REQUIRED) FIND_PACKAGE(PythonInterp REQUIRED) endif() if(MITK_USE_Boost) 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") endif() if(MITK_USE_BLUEBERRY) if(NOT DESIRED_QT_VERSION MATCHES 4) message("Forcing MITK_USE_BLUEBERRY to OFF because of DESIRED_QT_VERSION ${DESIRED_QT_VERSION}") set(MITK_USE_BLUEBERRY OFF CACHE BOOL "Build the BlueBerry application platform" FORCE) endif() 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() if(MITK_USE_CTK) if(NOT MITK_USE_QT) message("Forcing MITK_USE_QT to ON because of MITK_USE_CTK") set(MITK_USE_QT ON CACHE BOOL "Use Nokia's Qt library in MITK" FORCE) else() if(NOT DESIRED_QT_VERSION MATCHES 4) message("Forcing MITK_USE_CTK to OFF because of DESIRED_QT_VERSION ${DESIRED_QT_VERSION}") set(MITK_USE_CTK OFF CACHE BOOL "Use CTK in MITK" FORCE) endif() endif() if(NOT MITK_USE_DCMTK) message("Setting MITK_USE_DCMTK to ON because DCMTK needs to be build for CTK") set(MITK_USE_DCMTK ON CACHE BOOL "Use DCMTK in MITK" FORCE) endif() endif() if(MITK_USE_QT) # find the package at the very beginning, so that QT4_FOUND is available if(DESIRED_QT_VERSION MATCHES 4) set(MITK_QT4_MINIMUM_VERSION 4.6.2) find_package(Qt4 ${MITK_QT4_MINIMUM_VERSION} REQUIRED) set(MITK_USE_Qt4 TRUE) set(MITK_USE_Qt5 FALSE) endif(DESIRED_QT_VERSION MATCHES 4) if(DESIRED_QT_VERSION MATCHES 5) set(MITK_QT5_MINIMUM_VERSION 5.0.0) set(MITK_USE_Qt4 FALSE) set(MITK_USE_Qt5 TRUE) endif(DESIRED_QT_VERSION MATCHES 5) +else() + set(MITK_USE_Qt4 FALSE) + set(MITK_USE_Qt5 FALSE) endif() if(MITK_USE_SOFA) # SOFA requires at least CMake 2.8.8 set(SOFA_CMAKE_VERSION 2.8.8) if(${CMAKE_VERSION} VERSION_LESS ${SOFA_CMAKE_VERSION}) set(MITK_USE_SOFA OFF CACHE BOOL "" FORCE) message(WARNING "Switched off MITK_USE_SOFA\n Minimum required CMake version: ${SOFA_CMAKE_VERSION}\n Installed CMake version: ${CMAKE_VERSION}") endif() # SOFA doesn't support Clang if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") set(MITK_USE_SOFA OFF CACHE BOOL "" FORCE) message(WARNING "Switched off MITK_USE_SOFA\n Clang is not supported, use GCC instead.") endif() # SOFA/ITK combination requires at least MSVC 2010 if(MSVC_VERSION AND MSVC_VERSION LESS 1600) set(MITK_USE_SOFA OFF CACHE BOOL "" FORCE) message(WARNING "Switched off MITK_USE_SOFA\n MSVC versions less than 2010 are not supported.") endif() # SOFA requires boost library if(MITK_USE_SOFA AND NOT MITK_USE_Boost) message("Forcing MITK_USE_Boost to ON because of MITK_USE_SOFA") set(MITK_USE_Boost ON CACHE BOOL "" FORCE) endif() # SOFA requires boost system library list(FIND MITK_USE_Boost_LIBRARIES system _result) if(_result LESS 0) message("Adding 'system' to MITK_USE_Boost_LIBRARIES.") list(APPEND MITK_USE_Boost_LIBRARIES system) endif() # SOFA requires boost thread library list(FIND MITK_USE_Boost_LIBRARIES thread _result) if(_result LESS 0) message("Adding 'thread' to MITK_USE_Boost_LIBRARIES.") list(APPEND MITK_USE_Boost_LIBRARIES thread) endif() set(MITK_USE_Boost_LIBRARIES ${MITK_USE_Boost_LIBRARIES} CACHE STRING "" FORCE) endif() # 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, itk::RGBAPixel" 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, itk::RGBAPixel" CACHE STRING "List of composite pixel types used in AccessByItk and InstantiateAccessFunction macros" 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() #----------------------------------------------------------------------------- # Project.xml #----------------------------------------------------------------------------- # A list of topologically ordered targets set(CTEST_PROJECT_SUBPROJECTS) if(MITK_USE_BLUEBERRY) list(APPEND CTEST_PROJECT_SUBPROJECTS BlueBerry) endif() list(APPEND CTEST_PROJECT_SUBPROJECTS MITK-Core MITK-CoreUI MITK-IGT MITK-ToF MITK-DTI MITK-Registration MITK-Modules # all modules not contained in a specific subproject MITK-Plugins # all plugins not contained in a specific subproject MITK-Examples Unlabeled # special "subproject" catching all unlabeled targets and tests ) # Configure CTestConfigSubProject.cmake that could be used by CTest scripts configure_file(${MITK_SOURCE_DIR}/CTestConfigSubProject.cmake.in ${MITK_BINARY_DIR}/CTestConfigSubProject.cmake) if(CTEST_PROJECT_ADDITIONAL_TARGETS) # those targets will be executed at the end of the ctest driver script # and they also get their own subproject label set(subproject_list "${CTEST_PROJECT_SUBPROJECTS};${CTEST_PROJECT_ADDITIONAL_TARGETS}") else() set(subproject_list "${CTEST_PROJECT_SUBPROJECTS}") endif() # Generate Project.xml file expected by the CTest driver script mitkFunctionGenerateProjectXml(${MITK_BINARY_DIR} MITK "${subproject_list}" ${MITK_USE_SUPERBUILD}) #----------------------------------------------------------------------------- # Superbuild script #----------------------------------------------------------------------------- if(MITK_USE_SUPERBUILD) include("${CMAKE_CURRENT_SOURCE_DIR}/SuperBuild.cmake") return() endif() #***************************************************************************** #**************************** END OF SUPERBUILD **************************** #***************************************************************************** #----------------------------------------------------------------------------- # CMake function(s) and macro(s) #----------------------------------------------------------------------------- include(CheckCXXSourceCompiles) include(mitkFunctionCheckCompilerFlags) include(mitkFunctionGetGccVersion) include(MacroParseArguments) include(mitkFunctionSuppressWarnings) # includes several functions include(mitkFunctionOrganizeSources) include(mitkFunctionGetVersion) include(mitkFunctionGetVersionDescription) include(mitkFunctionCreateWindowsBatchScript) include(mitkFunctionInstallProvisioningFiles) include(mitkFunctionInstallAutoLoadModules) include(mitkFunctionGetLibrarySearchPaths) include(mitkFunctionCompileSnippets) include(mitkFunctionUseModules) include(mitkMacroCreateModuleConf) -include(mitkMacroCreateModule) +include(mitkFunctionCheckModuleDependencies) +include(mitkFunctionCreateModule) include(mitkMacroCreateExecutable) include(mitkMacroCheckModule) include(mitkMacroCreateModuleTests) include(mitkFunctionAddCustomModuleTest) include(mitkMacroUseModule) include(mitkMacroMultiplexPicType) include(mitkMacroInstall) include(mitkMacroInstallHelperApp) include(mitkMacroInstallTargets) include(mitkMacroGenerateToolsLibrary) include(mitkMacroGetLinuxDistribution) include(mitkMacroGetPMDPlatformString) -#----------------------------------------------------------------------------- -# Prerequesites -#----------------------------------------------------------------------------- - -find_package(ITK REQUIRED) -find_package(VTK REQUIRED) - -find_package(GDCM PATHS ${ITK_GDCM_DIR} REQUIRED) - #----------------------------------------------------------------------------- # Set MITK specific options and variables (NOT available during superbuild) #----------------------------------------------------------------------------- # ASK THE USER TO SHOW THE CONSOLE WINDOW FOR CoreApp and mitkWorkbench 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(DEFINED MITK_CTEST_SCRIPT_MODE AND (MITK_CTEST_SCRIPT_MODE STREQUAL "continuous" OR MITK_CTEST_SCRIPT_MODE STREQUAL "experimental") ) set(MITK_FAST_TESTING 1) endif() endif() #----------------------------------------------------------------------------- # Get MITK version info #----------------------------------------------------------------------------- mitkFunctionGetVersion(${MITK_SOURCE_DIR} MITK) mitkFunctionGetVersionDescription(${MITK_SOURCE_DIR} MITK) #----------------------------------------------------------------------------- # Installation preparation # # These should be set before any MITK install macros are used #----------------------------------------------------------------------------- # on Mac OSX all BlueBerry plugins get copied into every # application bundle (.app directory) specified here if(MITK_USE_BLUEBERRY AND APPLE) include("${CMAKE_CURRENT_SOURCE_DIR}/Applications/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} ${app_name}) endif() endforeach() endif() #----------------------------------------------------------------------------- # Set symbol visibility Flags #----------------------------------------------------------------------------- # MinGW does not export all symbols automatically, so no need to set flags if(CMAKE_COMPILER_IS_GNUCXX AND NOT MINGW) set(VISIBILITY_CXX_FLAGS ) #"-fvisibility=hidden -fvisibility-inlines-hidden") 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 "${VISIBILITY_CXX_FLAGS} ${COVERAGE_CXX_FLAGS}") 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} -D_WIN32_WINNT=0x0501 -DPOCO_NO_UNWINDOWS -DWIN32_LEAN_AND_MEAN") set(MITK_CXX_FLAGS "${MITK_CXX_FLAGS} /wd4231") # warning C4231: nonstandard extension used : 'extern' before template explicit instantiation 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 # the following two lines should be removed after ITK-3097 has # been resolved, see also MITK bug 15279 -Wno-unused-local-typedefs -Wno-array-bounds -fdiagnostics-show-option ) mitkFunctionCheckCAndCXXCompilerFlags(${_flag} MITK_C_FLAGS MITK_CXX_FLAGS) endforeach() endif() mitkFunctionCheckCompilerFlags("-Wl,--no-undefined" MITK_SHARED_LINKER_FLAGS) mitkFunctionCheckCompilerFlags("-Wl,--as-needed" MITK_SHARED_LINKER_FLAGS) if(CMAKE_COMPILER_IS_GNUCXX) mitkFunctionGetGccVersion(${CMAKE_CXX_COMPILER} GCC_VERSION) # With older version of gcc supporting the flag -fstack-protector-all, an extra dependency to libssp.so # is introduced. If gcc is smaller than 4.4.0 and the build type is Release let's not include the flag. # Doing so should allow to build package made for distribution using older linux distro. if(${GCC_VERSION} VERSION_GREATER "4.4.0" OR (CMAKE_BUILD_TYPE STREQUAL "Debug" AND ${GCC_VERSION} VERSION_LESS "4.4.0")) mitkFunctionCheckCAndCXXCompilerFlags("-fstack-protector-all" MITK_C_FLAGS MITK_CXX_FLAGS) endif() if(MINGW) # suppress warnings about auto imported symbols set(MITK_SHARED_LINKER_FLAGS "-Wl,--enable-auto-import ${MITK_SHARED_LINKER_FLAGS}") endif() set(MITK_CXX_FLAGS_RELEASE "-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} ${MITK_MODULES_PACKAGE_DEPENDS_DIR}/Qt) +set(MODULES_PACKAGE_DEPENDS_DIRS ${MITK_MODULES_PACKAGE_DEPENDS_DIR}) #----------------------------------------------------------------------------- # Testing #----------------------------------------------------------------------------- if(BUILD_TESTING) enable_testing() include(CTest) mark_as_advanced(TCL_TCLSH DART_ROOT) option(MITK_ENABLE_RENDERING_TESTING OFF "Enable the MITK rendering tests. Requires x-server in Linux.") #Rendering testing does not work for Linux nightlies, thus it is disabled per default #and activated for Mac and Windows. if(WIN32 OR APPLE) set(MITK_ENABLE_RENDERING_TESTING ON) endif() mark_as_advanced( MITK_ENABLE_RENDERING_TESTING ) # Setup file for setting custom ctest vars configure_file( CMake/CTestCustom.cmake.in ${MITK_BINARY_DIR}/CTestCustom.cmake @ONLY ) # Configuration for the CMake-generated test driver set(CMAKE_TESTDRIVER_EXTRA_INCLUDES "#include ") set(CMAKE_TESTDRIVER_BEFORE_TESTMAIN " try {") set(CMAKE_TESTDRIVER_AFTER_TESTMAIN " } catch( std::exception & excp ) { fprintf(stderr,\"%s\\n\",excp.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 external project template if(MITK_USE_BLUEBERRY) include(mitkTestProjectTemplate) 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() #----------------------------------------------------------------------------- # Compile Utilities and set-up MITK variables #----------------------------------------------------------------------------- include(mitkSetupVariables) #----------------------------------------------------------------------------- # Cleanup #----------------------------------------------------------------------------- file(GLOB _MODULES_CONF_FILES ${PROJECT_BINARY_DIR}/${MODULES_CONF_DIRNAME}/*.cmake) if(_MODULES_CONF_FILES) file(REMOVE ${_MODULES_CONF_FILES}) endif() add_subdirectory(Utilities) if(MITK_USE_BLUEBERRY) # We need to hack a little bit because MITK applications may need # to enable certain BlueBerry plug-ins. However, these plug-ins # are validated separately from the MITK plug-ins and know nothing # about potential MITK plug-in dependencies of the applications. Hence # we cannot pass the MITK application list to the BlueBerry # ctkMacroSetupPlugins call but need to extract the BlueBerry dependencies # from the applications and set them explicitly. include("${CMAKE_CURRENT_SOURCE_DIR}/Applications/AppList.cmake") foreach(mitk_app ${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) # check if the application is enabled and if target_libraries.cmake exists if((${option_name} OR MITK_BUILD_ALL_APPS) AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Applications/${target_dir}/target_libraries.cmake") include("${CMAKE_CURRENT_SOURCE_DIR}/Applications/${target_dir}/target_libraries.cmake") foreach(_target_dep ${target_libraries}) if(_target_dep MATCHES org_blueberry_) string(REPLACE _ . _app_bb_dep ${_target_dep}) # explicitly set the build option for the BlueBerry plug-in set(BLUEBERRY_BUILD_${_app_bb_dep} ON CACHE BOOL "Build the ${_app_bb_dep} plug-in") endif() endforeach() endif() endforeach() set(mbilog_DIR "${mbilog_BINARY_DIR}") if(MITK_BUILD_ALL_PLUGINS) set(BLUEBERRY_BUILD_ALL_PLUGINS ON) endif() set(BLUEBERRY_XPDOC_OUTPUT_DIR ${MITK_DOXYGEN_OUTPUT_DIR}/html/extension-points/html/) add_subdirectory(BlueBerry) set(BlueBerry_DIR ${CMAKE_CURRENT_BINARY_DIR}/BlueBerry CACHE PATH "The directory containing a CMake configuration file for BlueBerry" FORCE) include(mitkMacroCreateCTKPlugin) 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 custom targets representing CDash subprojects #----------------------------------------------------------------------------- foreach(subproject ${CTEST_PROJECT_SUBPROJECTS}) if(NOT TARGET ${subproject} AND NOT subproject MATCHES "Unlabeled") add_custom_target(${subproject}) endif() endforeach() #----------------------------------------------------------------------------- # Add subdirectories #----------------------------------------------------------------------------- add_subdirectory(Core) add_subdirectory(Modules) if(MITK_USE_BLUEBERRY) find_package(BlueBerry REQUIRED) set(MITK_DEFAULT_SUBPROJECTS MITK-Plugins) # Plug-in testing (needs some work to be enabled again) if(BUILD_TESTING) include(berryTestingHelpers) set(BLUEBERRY_UI_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CoreApp") get_target_property(_is_macosx_bundle CoreApp MACOSX_BUNDLE) if(APPLE AND _is_macosx_bundle) set(BLUEBERRY_UI_TEST_APP "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/CoreApp.app/Contents/MacOS/CoreApp") endif() set(BLUEBERRY_TEST_APP_ID "org.mitk.qt.coreapplication") endif() include("${CMAKE_CURRENT_SOURCE_DIR}/Plugins/PluginList.cmake") set(mitk_plugins_fullpath ) foreach(mitk_plugin ${MITK_EXT_PLUGINS}) list(APPEND mitk_plugins_fullpath Plugins/${mitk_plugin}) 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 OUTPUT_VARIABLE ${varname}) endmacro() # Get infos about application directories and build options include("${CMAKE_CURRENT_SOURCE_DIR}/Applications/AppList.cmake") set(mitk_apps_fullpath ) foreach(mitk_app ${MITK_APPS}) list(APPEND mitk_apps_fullpath "${CMAKE_CURRENT_SOURCE_DIR}/Applications/${mitk_app}") 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() # 11.3.13, change, muellerm: activate python bundle if python and blueberry is active if( MITK_USE_Python ) set(MITK_BUILD_org.mitk.gui.qt.python ON) endif() endif() #----------------------------------------------------------------------------- # Python Wrapping #----------------------------------------------------------------------------- option(MITK_USE_Python "Build Python integration for MITK (requires CableSwig)." OFF) #----------------------------------------------------------------------------- # Documentation #----------------------------------------------------------------------------- add_subdirectory(Documentation) #----------------------------------------------------------------------------- # Installation #----------------------------------------------------------------------------- # set MITK cpack variables # These are the default variables, which can be overwritten ( see below ) include(mitkSetupCPack) set(use_default_config ON) # MITK_APPS is set in Applications/AppList.cmake (included somewhere above # if MITK_USE_BLUEBERRY is set to ON). if(MITK_APPS) set(activated_apps_no 0) list(LENGTH MITK_APPS app_count) # Check how many apps have been enabled # If more than one app has been activated, the we use the # default CPack configuration. Otherwise that apps configuration # will be used, if present. 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) # check if the application is enabled if(${option_name} OR MITK_BUILD_ALL_APPS) MATH(EXPR activated_apps_no "${activated_apps_no} + 1") endif() endforeach() 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 ${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) # 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 "${CMAKE_CURRENT_SOURCE_DIR}/Applications/${target_dir}/CPackOptions.cmake") include("${CMAKE_CURRENT_SOURCE_DIR}/Applications/${target_dir}/CPackOptions.cmake") endif() if(EXISTS "${PROJECT_SOURCE_DIR}/Applications/${target_dir}/CPackConfig.cmake.in") set(CPACK_PROJECT_CONFIG_FILE "${PROJECT_BINARY_DIR}/Applications/${target_dir}/CPackConfig.cmake") configure_file(${PROJECT_SOURCE_DIR}/Applications/${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 "${target_dir}") endif() endforeach() endif() # 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 #----------------------------------------------------------------------------- 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() endforeach() get_property(MITK_ADDITIONAL_LIBRARY_SEARCH_PATHS_CONFIG GLOBAL PROPERTY MITK_ADDITIONAL_LIBRARY_SEARCH_PATHS) 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) set(VISIBILITY_AVAILABLE 0) set(visibility_test_flag "") mitkFunctionCheckCompilerFlags("-fvisibility=hidden" visibility_test_flag) if(visibility_test_flag) # The compiler understands -fvisiblity=hidden (probably gcc >= 4 or Clang) set(VISIBILITY_AVAILABLE 1) endif() configure_file(mitkExportMacros.h.in ${MITK_BINARY_DIR}/mitkExportMacros.h) 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) file(GLOB _MODULES_CONF_FILES RELATIVE ${PROJECT_BINARY_DIR}/${MODULES_CONF_DIRNAME} ${PROJECT_BINARY_DIR}/${MODULES_CONF_DIRNAME}/*.cmake) set(MITK_MODULE_NAMES) foreach(_module ${_MODULES_CONF_FILES}) string(REPLACE Config.cmake "" _module_name ${_module}) list(APPEND MITK_MODULE_NAMES ${_module_name}) endforeach() configure_file(mitkConfig.h.in ${MITK_BINARY_DIR}/mitkConfig.h) configure_file(MITKConfig.cmake.in ${MITK_BINARY_DIR}/MITKConfig.cmake @ONLY) # If we are under Windows, create two batch files which correctly # set up the environment for the application and for Visual Studio if(WIN32) include(mitkFunctionCreateWindowsBatchScript) set(VS_SOLUTION_FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}.sln") foreach(VS_BUILD_TYPE debug release) mitkFunctionCreateWindowsBatchScript("${MITK_SOURCE_DIR}/CMake/StartVS.bat.in" ${PROJECT_BINARY_DIR}/StartVS_${VS_BUILD_TYPE}.bat ${VS_BUILD_TYPE}) endforeach() endif(WIN32) #----------------------------------------------------------------------------- # MITK Applications #----------------------------------------------------------------------------- # This must come after MITKConfig.h was generated, since applications # might do a find_package(MITK REQUIRED). add_subdirectory(Applications) #----------------------------------------------------------------------------- # 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() diff --git a/Core/Code/CMakeLists.txt b/Core/Code/CMakeLists.txt index 3a787ab342..ec59632e28 100644 --- a/Core/Code/CMakeLists.txt +++ b/Core/Code/CMakeLists.txt @@ -1,56 +1,60 @@ set(TOOL_CPPS "") # temporary suppress warnings in the following files until image accessors are fully integrated. set_source_files_properties( DataManagement/mitkImage.cpp COMPILE_FLAGS -DMITK_NO_DEPRECATED_WARNINGS ) set_source_files_properties( Controllers/mitkSliceNavigationController.cpp COMPILE_FLAGS -DMITK_NO_DEPRECATED_WARNINGS ) # In MITK_ITK_Config.cmake, we set ITK_NO_IO_FACTORY_REGISTER_MANAGER to 1 unless # the variable is already defined. Setting it to 1 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(ITK_NO_IO_FACTORY_REGISTER_MANAGER 0) MITK_CREATE_MODULE( Mitk INCLUDE_DIRS Algorithms Common DataManagement Controllers Interactions Interfaces IO Rendering ${MITK_BINARY_DIR} INTERNAL_INCLUDE_DIRS ${OPENGL_INCLUDE_DIR} DEPENDS mbilog CppMicroServices - PACKAGE_DEPENDS tinyxml ITK VTK OpenGL + PACKAGE_DEPENDS tinyxml GDCM + ITK>ITKTransform|ITKImageGrid|ITKImageFeature|ITKTestKernel|ITKIORAW + VTK>vtkFiltersTexture|vtkFiltersParallel|vtkImagingStencil|vtkImagingMath|vtkInteractionStyle|vtkRenderingOpenGL|vtkRenderingLabel|vtkInteractionWidgets|vtkIOGeometry|vtkIOXML + OpenGL EXPORT_DEFINE MITK_CORE_EXPORT WARNINGS_AS_ERRORS # 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 ) # this is needed for libraries which link to Mitk and need # symbols from explicitly instantiated templates if(MINGW) get_target_property(_mitkCore_MINGW_linkflags Mitk LINK_FLAGS) if(NOT _mitkCore_MINGW_linkflags) set(_mitkCore_MINGW_linkflags "") endif(NOT _mitkCore_MINGW_linkflags) set_target_properties(Mitk PROPERTIES LINK_FLAGS "${_mitkCore_MINGW_linkflags} -Wl,--export-all-symbols") endif(MINGW) if(MSVC_IDE OR MSVC_VERSION OR MINGW) target_link_libraries(Mitk psapi.lib) endif(MSVC_IDE OR MSVC_VERSION OR MINGW) # build tests? if(BUILD_TESTING) + add_subdirectory(TestingHelper) add_subdirectory(Testing) ENDIF() diff --git a/Core/Code/Common/mitkServiceBaseObject.h b/Core/Code/Common/mitkServiceBaseObject.h deleted file mode 100644 index d95907d02d..0000000000 --- a/Core/Code/Common/mitkServiceBaseObject.h +++ /dev/null @@ -1,30 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ - -#ifndef MITKSERVICEBASEOBJECT_H -#define MITKSERVICEBASEOBJECT_H - -#include - -#include - -/** Documentation - * @brief This template is used to test the C++ micro services in MITK. - */ -template<> inline const char* us_service_impl_name(itk::LightObject* impl) -{ return impl->GetNameOfClass(); } - -#endif // USERVICESBASEOBJECT_H diff --git a/Core/Code/Common/mitkTesting.h b/Core/Code/Common/mitkTesting.h deleted file mode 100644 index f6b4884c3b..0000000000 --- a/Core/Code/Common/mitkTesting.h +++ /dev/null @@ -1,130 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ - -#ifndef MITKTESTING_H_HEADER_INCLUDED -#define MITKTESTING_H_HEADER_INCLUDED - -#include -#include -#include - -namespace mitk { - -/** - * @brief Equal Verbose version of the mitk::Equal method in mitkVector.h - * @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(double scalar1, double scalar2, ScalarType eps, bool verbose) -{ - bool isEqual = mitk::Equal(scalar1, scalar2, eps); - - if(( !isEqual ) && verbose) - { - MITK_INFO << "Scalars not equal. Lefthandside " << std::setprecision(12) << scalar1 << " - Righthandside " << scalar2 << " - epsilon " << eps; - } - return isEqual; -} - -/** - * @brief Equal Verbose version of the mitk::Equal method in mitkVector.h - * @ingroup MITKTestingAPI - * @param vector1 Vector to compare. - * @param vector2 Vector to compare. - * @param eps Tolerance for floating point comparison. - * @param verbose Flag indicating detailed console output. - * @return True if vectors are equal. - */ -template -inline bool Equal(const itk::Vector& vector1, const itk::Vector& vector2, TCoordRep eps, bool verbose) -{ - bool isEqual = mitk::Equal( vector1, vector2, eps ); - - if(( !isEqual ) && verbose) - { - MITK_INFO << "Vectors not equal. Lefthandside " << std::setprecision(12) << vector1 << " - Righthandside " << vector2 << " - epsilon " << eps; - } - return isEqual; -} - -/** - * @brief Equal Verbose version of the mitk::Equal method in mitkVector.h - * @ingroup MITKTestingAPI - * @param point1 Point to compare. - * @param point2 Point to compare. - * @param eps Tolerance for floating point comparison. - * @param verbose Flag indicating detailed console output. - * @return True if points are equal. - */ -template -inline bool Equal(const itk::Point& point1, const itk::Point& point2, TCoordRep eps, bool verbose) -{ - bool isEqual = mitk::Equal( point1, point2, eps ); - - if(( !isEqual ) && verbose) - { - MITK_INFO << "Points not equal. Lefthandside " << std::setprecision(12) << point1 << " - Righthandside " << point2 << " - epsilon " << eps; - } - return isEqual; -} - -/** - * @brief Equal Verbose version of the mitk::Equal method in mitkVector.h - * @ingroup MITKTestingAPI - * @param vector1 Vector to compare. - * @param vector2 Vector to compare. - * @param eps Tolerance for floating point comparison. - * @param verbose Flag indicating detailed console output. - * @return True if vectors are equal. - */ -inline bool Equal(const mitk::VnlVector& vector1, const mitk::VnlVector& vector2, bool verbose, ScalarType eps) -{ - bool isEqual = mitk::Equal( vector1, vector2, eps ); - - if(( !isEqual ) && verbose) - { - MITK_INFO << "Vectors not equal. Lefthandside " << std::setprecision(12) << vector1 << " - Righthandside " << vector2 << " - epsilon " << eps; - } - return isEqual; -} - -/** - * @brief Equal Verbose version of the mitk::Equal method in mitkVector.h - * @ingroup MITKTestingAPI - * @param vector1 Vector to compare. - * @param vector2 Vector to compare. - * @param eps Tolerance for floating point comparison. - * @param verbose Flag indicating detailed console output. - * @return True if vectors are equal. - */ -template -inline bool Equal(const vnl_vector_fixed & vector1, const vnl_vector_fixed& vector2, TCoordRep eps, bool verbose) -{ - bool isEqual = mitk::Equal( vector1, vector2, eps ); - - if(( !isEqual ) && verbose) - { - MITK_INFO << "Vectors not equal. Lefthandside " << std::setprecision(12) << vector1 << " - Righthandside " << vector2 << " - epsilon " << eps; - } - return isEqual; -} -} - -#endif //MITKTESTING_H_HEADER_INCLUDED diff --git a/Core/Code/DataManagement/mitkPointSet.cpp b/Core/Code/DataManagement/mitkPointSet.cpp index c52abbad92..c14e2a18fe 100755 --- a/Core/Code/DataManagement/mitkPointSet.cpp +++ b/Core/Code/DataManagement/mitkPointSet.cpp @@ -1,884 +1,884 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkPointSet.h" #include "mitkPointOperation.h" #include "mitkInteractionConst.h" -#include +#include #include mitk::PointSet::PointSet() { this->InitializeEmpty(); } mitk::PointSet::PointSet(const PointSet &other) : BaseData(other) , m_PointSetSeries(other.GetPointSetSeriesSize()) , m_CalculateBoundingBox(true) { // Copy points for (std::size_t t = 0; t < m_PointSetSeries.size(); ++t) { m_PointSetSeries[t] = DataType::New(); DataType::Pointer otherPts = other.GetPointSet(t); for (PointsConstIterator i = other.Begin(t); i != other.End(t); ++i) { m_PointSetSeries[t]->SetPoint(i.Index(), i.Value()); PointDataType pointData; if (otherPts->GetPointData(i.Index(), &pointData)) { m_PointSetSeries[t]->SetPointData(i.Index(), pointData); } } } } mitk::PointSet::~PointSet() { this->ClearData(); } void mitk::PointSet::ClearData() { m_PointSetSeries.clear(); Superclass::ClearData(); } void mitk::PointSet::InitializeEmpty() { m_PointSetSeries.resize( 1 ); m_PointSetSeries[0] = DataType::New(); PointDataContainer::Pointer pointData = PointDataContainer::New(); m_PointSetSeries[0]->SetPointData( pointData ); m_CalculateBoundingBox = false; Superclass::InitializeTimeGeometry(1); m_Initialized = true; } bool mitk::PointSet::IsEmptyTimeStep(unsigned int t) const { return IsInitialized() && (GetSize(t) == 0); } void mitk::PointSet::Expand( unsigned int timeSteps ) { // Check if the vector is long enough to contain the new element // at the given position. If not, expand it with sufficient pre-initialized // elements. // // NOTE: This method will never REDUCE the vector size; it should only // be used to make sure that the vector has enough elements to include the // specified time step. unsigned int oldSize = m_PointSetSeries.size(); if ( timeSteps > oldSize ) { Superclass::Expand( timeSteps ); m_PointSetSeries.resize( timeSteps ); for ( unsigned int i = oldSize; i < timeSteps; ++i ) { m_PointSetSeries[i] = DataType::New(); PointDataContainer::Pointer pointData = PointDataContainer::New(); m_PointSetSeries[i]->SetPointData( pointData ); } //if the size changes, then compute the bounding box m_CalculateBoundingBox = true; this->InvokeEvent( PointSetExtendTimeRangeEvent() ); } } unsigned int mitk::PointSet::GetPointSetSeriesSize() const { return m_PointSetSeries.size(); } int mitk::PointSet::GetSize( unsigned int t ) const { if ( t < m_PointSetSeries.size() ) { return m_PointSetSeries[t]->GetNumberOfPoints(); } else { return 0; } } mitk::PointSet::DataType::Pointer mitk::PointSet::GetPointSet( int t ) const { if ( t < (int)m_PointSetSeries.size() ) { return m_PointSetSeries[t]; } else { return NULL; } } mitk::PointSet::PointsIterator mitk::PointSet::Begin( int t ) { if (t >= 0 && t < static_cast(m_PointSetSeries.size())) { return m_PointSetSeries[t]->GetPoints()->Begin(); } return PointsIterator(); } mitk::PointSet::PointsConstIterator mitk::PointSet::Begin(int t) const { if (t >= 0 && t < static_cast(m_PointSetSeries.size())) { return m_PointSetSeries[t]->GetPoints()->Begin(); } return PointsConstIterator(); } mitk::PointSet::PointsIterator mitk::PointSet::End( int t ) { if (t >= 0 && t < static_cast(m_PointSetSeries.size())) { return m_PointSetSeries[t]->GetPoints()->End(); } return PointsIterator(); } mitk::PointSet::PointsConstIterator mitk::PointSet::End(int t) const { if (t >= 0 && t < static_cast(m_PointSetSeries.size())) { return m_PointSetSeries[t]->GetPoints()->End(); } return PointsConstIterator(); } int mitk::PointSet::SearchPoint( Point3D point, ScalarType distance, int t ) const { if ( t >= (int)m_PointSetSeries.size() ) { return -1; } // Out is the point which is checked to be the searched point PointType out; out.Fill( 0 ); PointType indexPoint; this->GetGeometry( t )->WorldToIndex(point, indexPoint); // Searching the first point in the Set, that is +- distance far away fro // the given point unsigned int i; PointsContainer::Iterator it, end; end = m_PointSetSeries[t]->GetPoints()->End(); int bestIndex = -1; distance = distance * distance; // To correct errors from converting index to world and world to index if (distance == 0.0) { distance = 0.000001; } ScalarType bestDist = distance; ScalarType dist, tmp; for ( it = m_PointSetSeries[t]->GetPoints()->Begin(), i = 0; it != end; ++it, ++i ) { bool ok = m_PointSetSeries[t]->GetPoints() ->GetElementIfIndexExists( it->Index(), &out ); if ( !ok ) { return -1; } else if ( indexPoint == out ) //if totally equal { return it->Index(); } //distance calculation tmp = out[0] - indexPoint[0]; dist = tmp * tmp; tmp = out[1] - indexPoint[1]; dist += tmp * tmp; tmp = out[2] - indexPoint[2]; dist += tmp * tmp; if ( dist < bestDist ) { bestIndex = it->Index(); bestDist = dist; } } return bestIndex; } mitk::PointSet::PointType mitk::PointSet::GetPoint( PointIdentifier id, int t ) const { PointType out; out.Fill(0); if ( (unsigned int) t >= m_PointSetSeries.size() ) { return out; } if ( m_PointSetSeries[t]->GetPoints()->IndexExists(id) ) { m_PointSetSeries[t]->GetPoint( id, &out ); this->GetGeometry(t)->IndexToWorld( out, out ); return out; } else { return out; } } bool mitk::PointSet ::GetPointIfExists( PointIdentifier id, PointType* point, int t ) const { if ( (unsigned int) t >= m_PointSetSeries.size() ) { return false; } if ( m_PointSetSeries[t]->GetPoints()->GetElementIfIndexExists(id, point) ) { this->GetGeometry( t )->IndexToWorld( *point, *point ); return true; } else { return false; } } void mitk::PointSet::SetPoint( PointIdentifier id, PointType point, int t ) { // Adapt the size of the data vector if necessary this->Expand( t+1 ); mitk::Point3D indexPoint; this->GetGeometry( t )->WorldToIndex( point, indexPoint ); m_PointSetSeries[t]->SetPoint( id, indexPoint ); PointDataType defaultPointData; defaultPointData.id = id; defaultPointData.selected = false; defaultPointData.pointSpec = mitk::PTUNDEFINED; m_PointSetSeries[t]->SetPointData( id, defaultPointData ); //boundingbox has to be computed anyway m_CalculateBoundingBox = true; this->Modified(); } void mitk::PointSet::SetPoint( PointIdentifier id, PointType point, PointSpecificationType spec, int t ) { // Adapt the size of the data vector if necessary this->Expand( t+1 ); mitk::Point3D indexPoint; this->GetGeometry( t )->WorldToIndex( point, indexPoint ); m_PointSetSeries[t]->SetPoint( id, indexPoint ); PointDataType defaultPointData; defaultPointData.id = id; defaultPointData.selected = false; defaultPointData.pointSpec = spec; m_PointSetSeries[t]->SetPointData( id, defaultPointData ); //boundingbox has to be computed anyway m_CalculateBoundingBox = true; this->Modified(); } void mitk::PointSet::InsertPoint( PointIdentifier id, PointType point, int t ) { this->InsertPoint(id, point, mitk::PTUNDEFINED, t); } void mitk::PointSet::InsertPoint( PointIdentifier id, PointType point, PointSpecificationType spec, int t ) { if ( (unsigned int) t < m_PointSetSeries.size() ) { mitk::Point3D indexPoint; mitk::Geometry3D* tempGeometry = this->GetGeometry( t ); if (tempGeometry == NULL) { MITK_INFO<< __FILE__ << ", l." << __LINE__ << ": GetGeometry of "<< t <<" returned NULL!" << std::endl; return; } tempGeometry->WorldToIndex( point, indexPoint ); m_PointSetSeries[t]->GetPoints()->InsertElement( id, indexPoint ); PointDataType defaultPointData; defaultPointData.id = id; defaultPointData.selected = false; defaultPointData.pointSpec = spec; m_PointSetSeries[t]->GetPointData()->InsertElement(id, defaultPointData); //boundingbox has to be computed anyway m_CalculateBoundingBox = true; this->Modified(); } } bool mitk::PointSet::SwapPointPosition( PointIdentifier id, bool moveUpwards, int t ) { if(IndexExists(id, t) ) { PointType point = GetPoint(id,t); if(moveUpwards) {//up if(IndexExists(id-1,t)) { InsertPoint(id, GetPoint(id - 1, t), t); InsertPoint(id-1,point,t); this->Modified(); return true; } } else {//down if(IndexExists(id+1,t)) { InsertPoint(id, GetPoint(id + 1, t), t); InsertPoint(id+1,point,t); this->Modified(); return true; } } } return false; } bool mitk::PointSet::IndexExists( int position, int t ) const { if ( (unsigned int) t < m_PointSetSeries.size() ) { return m_PointSetSeries[t]->GetPoints()->IndexExists( position ); } else { return false; } } bool mitk::PointSet::GetSelectInfo( int position, int t ) const { if ( this->IndexExists( position, t ) ) { PointDataType pointData = { 0, false, PTUNDEFINED }; m_PointSetSeries[t]->GetPointData( position, &pointData ); return pointData.selected; } else { return false; } } void mitk::PointSet::SetSelectInfo( int position, bool selected, int t ) { if ( this->IndexExists( position, t ) ) { // timeStep to ms TimePointType timeInMS = this->GetTimeGeometry()->TimeStepToTimePoint( t ); // point Point3D point = this->GetPoint( position, t ); std::auto_ptr op; if (selected) { op.reset(new mitk::PointOperation(OpSELECTPOINT, timeInMS, point, position )); } else { op.reset(new mitk::PointOperation(OpDESELECTPOINT, timeInMS, point, position )); } this->ExecuteOperation( op.get() ); } } mitk::PointSpecificationType mitk::PointSet::GetSpecificationTypeInfo( int position, int t ) const { if ( this->IndexExists( position, t ) ) { PointDataType pointData = { 0, false, PTUNDEFINED }; m_PointSetSeries[t]->GetPointData( position, &pointData ); return pointData.pointSpec; } else { return PTUNDEFINED; } } int mitk::PointSet::GetNumberOfSelected( int t ) const { if ( (unsigned int) t >= m_PointSetSeries.size() ) { return 0; } int numberOfSelected = 0; PointDataIterator it; for ( it = m_PointSetSeries[t]->GetPointData()->Begin(); it != m_PointSetSeries[t]->GetPointData()->End(); it++ ) { if (it->Value().selected == true) { ++numberOfSelected; } } return numberOfSelected; } int mitk::PointSet::SearchSelectedPoint( int t ) const { if ( (unsigned int) t >= m_PointSetSeries.size() ) { return -1; } PointDataIterator it; for ( it = m_PointSetSeries[t]->GetPointData()->Begin(); it != m_PointSetSeries[t]->GetPointData()->End(); it++ ) { if ( it->Value().selected == true ) { return it->Index(); } } return -1; } void mitk::PointSet::ExecuteOperation( Operation* operation ) { int timeStep = -1; mitkCheckOperationTypeMacro(PointOperation, operation, pointOp); if ( pointOp ) { timeStep = this->GetTimeGeometry()->TimePointToTimeStep( pointOp->GetTimeInMS() ); } if ( timeStep < 0 ) { MITK_ERROR << "Time step (" << timeStep << ") outside of PointSet time bounds" << std::endl; return; } switch (operation->GetOperationType()) { case OpNOTHING: break; case OpINSERT://inserts the point at the given position and selects it. { int position = pointOp->GetIndex(); PointType pt; pt.CastFrom(pointOp->GetPoint()); //transfer from world to index coordinates mitk::Geometry3D* geometry = this->GetGeometry( timeStep ); if (geometry == NULL) { MITK_INFO<<"GetGeometry returned NULL!\n"; return; } geometry->WorldToIndex(pt, pt); m_PointSetSeries[timeStep]->GetPoints()->InsertElement(position, pt); PointDataType pointData = { static_cast(pointOp->GetIndex()), pointOp->GetSelected(), pointOp->GetPointType() }; m_PointSetSeries[timeStep]->GetPointData() ->InsertElement(position, pointData); this->Modified(); //boundingbox has to be computed m_CalculateBoundingBox = true; this->InvokeEvent( PointSetAddEvent() ); this->OnPointSetChange(); } break; case OpMOVE://moves the point given by index { PointType pt; pt.CastFrom(pointOp->GetPoint()); //transfer from world to index coordinates this->GetGeometry( timeStep )->WorldToIndex(pt, pt); // Copy new point into container m_PointSetSeries[timeStep]->SetPoint(pointOp->GetIndex(), pt); // Insert a default point data object to keep the containers in sync // (if no point data object exists yet) PointDataType pointData; if ( !m_PointSetSeries[timeStep]->GetPointData( pointOp->GetIndex(), &pointData ) ) { m_PointSetSeries[timeStep]->SetPointData( pointOp->GetIndex(), pointData ); } this->OnPointSetChange(); this->Modified(); //boundingbox has to be computed anyway m_CalculateBoundingBox = true; this->InvokeEvent( PointSetMoveEvent() ); } break; case OpREMOVE://removes the point at given by position { m_PointSetSeries[timeStep]->GetPoints()->DeleteIndex((unsigned)pointOp->GetIndex()); m_PointSetSeries[timeStep]->GetPointData()->DeleteIndex((unsigned)pointOp->GetIndex()); this->OnPointSetChange(); this->Modified(); //boundingbox has to be computed anyway m_CalculateBoundingBox = true; this->InvokeEvent( PointSetRemoveEvent() ); } break; case OpSELECTPOINT://select the given point { PointDataType pointData = {0, false, PTUNDEFINED}; m_PointSetSeries[timeStep]->GetPointData(pointOp->GetIndex(), &pointData); pointData.selected = true; m_PointSetSeries[timeStep]->SetPointData(pointOp->GetIndex(), pointData); this->Modified(); } break; case OpDESELECTPOINT://unselect the given point { PointDataType pointData = {0, false, PTUNDEFINED}; m_PointSetSeries[timeStep]->GetPointData(pointOp->GetIndex(), &pointData); pointData.selected = false; m_PointSetSeries[timeStep]->SetPointData(pointOp->GetIndex(), pointData); this->Modified(); } break; case OpSETPOINTTYPE: { PointDataType pointData = {0, false, PTUNDEFINED}; m_PointSetSeries[timeStep]->GetPointData(pointOp->GetIndex(), &pointData); pointData.pointSpec = pointOp->GetPointType(); m_PointSetSeries[timeStep]->SetPointData(pointOp->GetIndex(), pointData); this->Modified(); } break; case OpMOVEPOINTUP: // swap content of point with ID pointOp->GetIndex() with the point preceding it in the container // move point position within the pointset { PointIdentifier currentID = pointOp->GetIndex(); /* search for point with this id and point that precedes this one in the data container */ PointsContainer::STLContainerType points = m_PointSetSeries[timeStep]->GetPoints()->CastToSTLContainer(); PointsContainer::STLContainerType::iterator it = points.find(currentID); if (it == points.end()) // ID not found break; if (it == points.begin()) // we are at the first element, there is no previous element break; /* get and cache current point & pointdata and previous point & pointdata */ --it; PointIdentifier prevID = it->first; if (this->SwapPointContents(prevID, currentID, timeStep) == true) this->Modified(); } break; case OpMOVEPOINTDOWN: // move point position within the pointset { PointIdentifier currentID = pointOp->GetIndex(); /* search for point with this id and point that succeeds this one in the data container */ PointsContainer::STLContainerType points = m_PointSetSeries[timeStep]->GetPoints()->CastToSTLContainer(); PointsContainer::STLContainerType::iterator it = points.find(currentID); if (it == points.end()) // ID not found break; ++it; if (it == points.end()) // ID is already the last element, there is no succeeding element break; /* get and cache current point & pointdata and previous point & pointdata */ PointIdentifier nextID = it->first; if (this->SwapPointContents(nextID, currentID, timeStep) == true) this->Modified(); } break; default: itkWarningMacro("mitkPointSet could not understrand the operation. Please check!"); break; } //to tell the mappers, that the data is modified and has to be updated //only call modified if anything is done, so call in cases //this->Modified(); mitk::OperationEndEvent endevent(operation); ((const itk::Object*)this)->InvokeEvent(endevent); //*todo has to be done here, cause of update-pipeline not working yet // As discussed lately, don't mess with the rendering from inside data structures //mitk::RenderingManager::GetInstance()->RequestUpdateAll(); } void mitk::PointSet::UpdateOutputInformation() { if ( this->GetSource( ) ) { this->GetSource( )->UpdateOutputInformation( ); } // // first make sure, that the associated time sliced geometry has // the same number of geometry 3d's as PointSets are present // TimeGeometry* timeGeometry = GetTimeGeometry(); if ( timeGeometry->CountTimeSteps() != m_PointSetSeries.size() ) { itkExceptionMacro(<<"timeGeometry->CountTimeSteps() != m_PointSetSeries.size() -- use Initialize(timeSteps) with correct number of timeSteps!"); } // This is needed to detect zero objects mitk::ScalarType nullpoint[]={0,0,0,0,0,0}; BoundingBox::BoundsArrayType itkBoundsNull(nullpoint); // // Iterate over the PointSets and update the Geometry // information of each of the items. // if (m_CalculateBoundingBox) { for ( unsigned int i = 0 ; i < m_PointSetSeries.size() ; ++i ) { const DataType::BoundingBoxType *bb = m_PointSetSeries[i]->GetBoundingBox(); BoundingBox::BoundsArrayType itkBounds = bb->GetBounds(); if ( m_PointSetSeries[i].IsNull() || (m_PointSetSeries[i]->GetNumberOfPoints() == 0) || (itkBounds == itkBoundsNull) ) { itkBounds = itkBoundsNull; continue; } // Ensure minimal bounds of 1.0 in each dimension for ( unsigned int j = 0; j < 3; ++j ) { if ( itkBounds[j*2+1] - itkBounds[j*2] < 1.0 ) { BoundingBox::CoordRepType center = (itkBounds[j*2] + itkBounds[j*2+1]) / 2.0; itkBounds[j*2] = center - 0.5; itkBounds[j*2+1] = center + 0.5; } } this->GetGeometry(i)->SetBounds(itkBounds); } m_CalculateBoundingBox = false; } this->GetTimeGeometry()->Update(); } void mitk::PointSet::SetRequestedRegionToLargestPossibleRegion() { } bool mitk::PointSet::RequestedRegionIsOutsideOfTheBufferedRegion() { return false; } bool mitk::PointSet::VerifyRequestedRegion() { return true; } void mitk::PointSet::SetRequestedRegion(const DataObject * ) { } void mitk::PointSet::PrintSelf( std::ostream& os, itk::Indent indent ) const { Superclass::PrintSelf(os, indent); os << indent << "Number timesteps: " << m_PointSetSeries.size() << "\n"; unsigned int i = 0; for (PointSetSeries::const_iterator it = m_PointSetSeries.begin(); it != m_PointSetSeries.end(); ++it) { os << indent << "Timestep " << i++ << ": \n"; MeshType::Pointer ps = *it; itk::Indent nextIndent = indent.GetNextIndent(); ps->Print(os, nextIndent); MeshType::PointsContainer* points = ps->GetPoints(); MeshType::PointDataContainer* datas = ps->GetPointData(); MeshType::PointDataContainer::Iterator dataIterator = datas->Begin(); for (MeshType::PointsContainer::Iterator pointIterator = points->Begin(); pointIterator != points->End(); ++pointIterator, ++dataIterator) { os << nextIndent << "Point " << pointIterator->Index() << ": ["; os << pointIterator->Value().GetElement(0); for (unsigned int i = 1; i < PointType::GetPointDimension(); ++i) { os << ", " << pointIterator->Value().GetElement(i); } os << "]"; os << ", selected: " << dataIterator->Value().selected << ", point spec: " << dataIterator->Value().pointSpec << "\n"; } } } bool mitk::PointSet::SwapPointContents(PointIdentifier id1, PointIdentifier id2, int timeStep) { /* search and cache contents */ PointType p1; if (m_PointSetSeries[timeStep]->GetPoint(id1, &p1) == false) return false; PointDataType data1; if (m_PointSetSeries[timeStep]->GetPointData(id1, &data1) == false) return false; PointType p2; if (m_PointSetSeries[timeStep]->GetPoint(id2, &p2) == false) return false; PointDataType data2; if (m_PointSetSeries[timeStep]->GetPointData(id2, &data2) == false) return false; /* now swap contents */ m_PointSetSeries[timeStep]->SetPoint(id1, p2); m_PointSetSeries[timeStep]->SetPointData(id1, data2); m_PointSetSeries[timeStep]->SetPoint(id2, p1); m_PointSetSeries[timeStep]->SetPointData(id2, data1); return true; } bool mitk::PointSet::PointDataType::operator ==(const mitk::PointSet::PointDataType &other) const { return id == other.id && selected == other.selected && pointSpec == other.pointSpec; } bool mitk::Equal( const mitk::PointSet* leftHandSide, const mitk::PointSet* rightHandSide, mitk::ScalarType eps, bool verbose ) { bool result = true; if( rightHandSide == NULL ) { if(verbose) { MITK_INFO << "[( PointSet )] rightHandSide NULL."; } return false; } if( leftHandSide == NULL ) { if(verbose) MITK_INFO << "[( PointSet )] leftHandSide NULL."; return false; } if( !mitk::Equal(leftHandSide->GetGeometry(), rightHandSide->GetGeometry(), eps, verbose) ) { if(verbose) MITK_INFO << "[( PointSet )] Geometries differ."; result = false; } if ( leftHandSide->GetSize() != rightHandSide->GetSize()) { if(verbose) MITK_INFO << "[( PointSet )] Number of points differ."; result = false; } else { //if the size is equal, we compare the point values mitk::Point3D pointLeftHandSide; mitk::Point3D pointRightHandSide; int numberOfIncorrectPoints = 0; //Iterate over both pointsets in order to compare all points pair-wise mitk::PointSet::PointsConstIterator end = leftHandSide->End(); for( mitk::PointSet::PointsConstIterator pointSetIteratorLeft = leftHandSide->Begin(), pointSetIteratorRight = rightHandSide->Begin(); pointSetIteratorLeft != end; ++pointSetIteratorLeft, ++pointSetIteratorRight) //iterate simultaneously over both sets { pointLeftHandSide = pointSetIteratorLeft.Value(); pointRightHandSide = pointSetIteratorRight.Value(); if( !mitk::Equal( pointLeftHandSide, pointRightHandSide, eps, verbose ) ) { if(verbose) MITK_INFO << "[( PointSet )] Point values are different."; result = false; numberOfIncorrectPoints++; } } if((numberOfIncorrectPoints > 0) && verbose) { MITK_INFO << numberOfIncorrectPoints <<" of a total of " << leftHandSide->GetSize() << " points are different."; } } return result; } diff --git a/Core/Code/DataManagement/mitkSurface.cpp b/Core/Code/DataManagement/mitkSurface.cpp index 220d65e688..0d56124140 100644 --- a/Core/Code/DataManagement/mitkSurface.cpp +++ b/Core/Code/DataManagement/mitkSurface.cpp @@ -1,541 +1,540 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkSurface.h" #include "mitkInteractionConst.h" #include "mitkSurfaceOperation.h" #include #include -#include static vtkPolyData* DeepCopy(vtkPolyData* other) { if (other == NULL) return NULL; vtkPolyData* copy = vtkPolyData::New(); copy->DeepCopy(other); return copy; } static void Delete(vtkPolyData* polyData) { if (polyData != NULL) polyData->Delete(); } static void Update(vtkPolyData* /*polyData*/) { // if (polyData != NULL) // polyData->Update(); //VTK6_TODO vtk pipeline } mitk::Surface::Surface() : m_CalculateBoundingBox(false) { this->InitializeEmpty(); } mitk::Surface::Surface(const mitk::Surface& other) : BaseData(other), m_LargestPossibleRegion(other.m_LargestPossibleRegion), m_RequestedRegion(other.m_RequestedRegion), m_CalculateBoundingBox(other.m_CalculateBoundingBox) { if(!other.m_PolyDatas.empty()) { m_PolyDatas.resize(other.m_PolyDatas.size()); std::transform(other.m_PolyDatas.begin(), other.m_PolyDatas.end(), m_PolyDatas.begin(), DeepCopy); } else { this->InitializeEmpty(); } } void mitk::Surface::Swap(mitk::Surface& other) { std::swap(m_PolyDatas, other.m_PolyDatas); std::swap(m_LargestPossibleRegion, other.m_LargestPossibleRegion); std::swap(m_RequestedRegion, other.m_RequestedRegion); std::swap(m_CalculateBoundingBox, other.m_CalculateBoundingBox); } mitk::Surface& mitk::Surface::operator=(Surface other) { this->Swap(other); return *this; } mitk::Surface::~Surface() { this->ClearData(); } void mitk::Surface::ClearData() { using ::Delete; std::for_each(m_PolyDatas.begin(), m_PolyDatas.end(), Delete); m_PolyDatas.clear(); Superclass::ClearData(); } const mitk::Surface::RegionType& mitk::Surface::GetLargestPossibleRegion() const { m_LargestPossibleRegion.SetIndex(3, 0); m_LargestPossibleRegion.SetSize(3, GetTimeGeometry()->CountTimeSteps()); return m_LargestPossibleRegion; } const mitk::Surface::RegionType& mitk::Surface::GetRequestedRegion() const { return m_RequestedRegion; } void mitk::Surface::InitializeEmpty() { if (!m_PolyDatas.empty()) this->ClearData(); Superclass::InitializeTimeGeometry(); m_PolyDatas.push_back(NULL); m_Initialized = true; } void mitk::Surface::SetVtkPolyData(vtkPolyData* polyData, unsigned int t) { this->Expand(t + 1); if (m_PolyDatas[t] != NULL) { if (m_PolyDatas[t] == polyData) return; m_PolyDatas[t]->Delete(); } m_PolyDatas[t] = polyData; if(polyData != NULL) polyData->Register(NULL); m_CalculateBoundingBox = true; this->Modified(); this->UpdateOutputInformation(); } bool mitk::Surface::IsEmptyTimeStep(unsigned int t) const { if(!IsInitialized()) return false; vtkPolyData* polyData = const_cast(this)->GetVtkPolyData(t); return polyData == NULL || ( polyData->GetNumberOfLines() == 0 && polyData->GetNumberOfPolys() == 0 && polyData->GetNumberOfStrips() == 0 && polyData->GetNumberOfVerts() == 0 ); } vtkPolyData* mitk::Surface::GetVtkPolyData(unsigned int t) { if (t < m_PolyDatas.size()) { if(m_PolyDatas[t] == NULL && this->GetSource().IsNotNull()) { RegionType requestedRegion; requestedRegion.SetIndex(3, t); requestedRegion.SetSize(3, 1); this->SetRequestedRegion(&requestedRegion); this->GetSource()->Update(); } return m_PolyDatas[t]; } return NULL; } void mitk::Surface::UpdateOutputInformation() { if (this->GetSource().IsNotNull()) this->GetSource()->UpdateOutputInformation(); if (m_CalculateBoundingBox == true && !m_PolyDatas.empty()) this->CalculateBoundingBox(); else this->GetTimeGeometry()->Update(); } void mitk::Surface::CalculateBoundingBox() { TimeGeometry* timeGeometry = this->GetTimeGeometry(); if (timeGeometry->CountTimeSteps() != m_PolyDatas.size()) mitkThrow() << "Number of geometry time steps is inconsistent with number of poly data pointers."; for (unsigned int i = 0; i < m_PolyDatas.size(); ++i) { vtkPolyData* polyData = m_PolyDatas[i]; double bounds[6] = {0}; if (polyData != NULL && polyData->GetNumberOfPoints() > 0) { // polyData->Update(); //VTK6_TODO vtk pipeline polyData->ComputeBounds(); polyData->GetBounds(bounds); } Geometry3D::Pointer geometry = timeGeometry->GetGeometryForTimeStep(i); if (geometry.IsNull()) mitkThrow() << "Time-sliced geometry is invalid (equals NULL)."; geometry->SetFloatBounds(bounds); } timeGeometry->Update(); m_CalculateBoundingBox = false; } void mitk::Surface::SetRequestedRegionToLargestPossibleRegion() { m_RequestedRegion = GetLargestPossibleRegion(); } bool mitk::Surface::RequestedRegionIsOutsideOfTheBufferedRegion() { RegionType::IndexValueType end = m_RequestedRegion.GetIndex(3) + m_RequestedRegion.GetSize(3); if(static_cast(m_PolyDatas.size()) < end) return true; for(RegionType::IndexValueType t = m_RequestedRegion.GetIndex(3); t < end; ++t) { if(m_PolyDatas[t] == NULL) return true; } return false; } bool mitk::Surface::VerifyRequestedRegion() { if(m_RequestedRegion.GetIndex(3) >= 0 && m_RequestedRegion.GetIndex(3) + m_RequestedRegion.GetSize(3) <= m_PolyDatas.size()) return true; return false; } void mitk::Surface::SetRequestedRegion(const itk::DataObject* data ) { const mitk::Surface *surface = dynamic_cast(data); if (surface != NULL) m_RequestedRegion = surface->GetRequestedRegion(); else mitkThrow() << "Data object used to get requested region is not a mitk::Surface."; } void mitk::Surface::SetRequestedRegion(Surface::RegionType* region) { if (region == NULL) mitkThrow() << "Requested region is invalid (equals NULL)"; m_RequestedRegion = *region; } void mitk::Surface::CopyInformation(const itk::DataObject* data) { Superclass::CopyInformation(data); const mitk::Surface* surface = dynamic_cast(data); if (surface == NULL) mitkThrow() << "Data object used to get largest possible region is not a mitk::Surface."; m_LargestPossibleRegion = surface->GetLargestPossibleRegion(); } void mitk::Surface::Update() { using ::Update; if (this->GetSource().IsNull()) std::for_each(m_PolyDatas.begin(), m_PolyDatas.end(), Update); Superclass::Update(); } void mitk::Surface::Expand(unsigned int timeSteps) { if (timeSteps > m_PolyDatas.size()) { Superclass::Expand(timeSteps); m_PolyDatas.resize(timeSteps); m_CalculateBoundingBox = true; } } void mitk::Surface::ExecuteOperation(Operation* operation) { switch (operation->GetOperationType()) { case OpSURFACECHANGED: { mitk::SurfaceOperation* surfaceOperation = dynamic_cast(operation); if(surfaceOperation == NULL) break; unsigned int timeStep = surfaceOperation->GetTimeStep(); if(m_PolyDatas[timeStep] != NULL) { vtkPolyData* updatedPolyData = surfaceOperation->GetVtkPolyData(); if(updatedPolyData != NULL) { this->SetVtkPolyData(updatedPolyData, timeStep); this->CalculateBoundingBox(); this->Modified(); } } break; } default: return; } } unsigned int mitk::Surface::GetSizeOfPolyDataSeries() const { return m_PolyDatas.size(); } void mitk::Surface::Graft(const DataObject* data) { const Surface* surface = dynamic_cast(data); if(surface == NULL) mitkThrow() << "Data object used to graft surface is not a mitk::Surface."; this->CopyInformation(data); m_PolyDatas.clear(); for (unsigned int i = 0; i < surface->GetSizeOfPolyDataSeries(); ++i) { m_PolyDatas.push_back(vtkPolyData::New()); m_PolyDatas.back()->DeepCopy(const_cast(surface)->GetVtkPolyData(i)); } } void mitk::Surface::PrintSelf(std::ostream& os, itk::Indent indent) const { Superclass::PrintSelf(os, indent); os << indent << "\nNumber PolyDatas: " << m_PolyDatas.size() << "\n"; unsigned int count = 0; for (std::vector::const_iterator it = m_PolyDatas.begin(); it != m_PolyDatas.end(); ++it) { os << "\n"; if(*it != NULL) { os << indent << "PolyData at time step " << count << ":\n"; os << indent << "Number of cells: " << (*it)->GetNumberOfCells() << "\n"; os << indent << "Number of points: " << (*it)->GetNumberOfPoints() << "\n\n"; os << indent << "VTKPolyData:\n"; (*it)->Print(os); } else { os << indent << "Empty PolyData at time step " << count << "\n"; } ++count; } } bool mitk::Equal( vtkPolyData* leftHandSide, vtkPolyData* rightHandSide, mitk::ScalarType eps, bool verbose ) { bool noDifferenceFound = true; if( rightHandSide == NULL ) { if(verbose) { MITK_INFO << "[Equal( vtkPolyData*, vtkPolyData* )] rightHandSide NULL."; } return false; } if( leftHandSide == NULL ) { if(verbose) { MITK_INFO << "[Equal( vtkPolyData*, vtkPolyData* )] leftHandSide NULL."; } return false; } if( ! mitk::Equal( leftHandSide->GetNumberOfCells(), rightHandSide->GetNumberOfCells(), eps, verbose ) ) { if(verbose) MITK_INFO << "[Equal( vtkPolyData*, vtkPolyData* )] Number of cells not equal"; noDifferenceFound = false; } if( ! mitk::Equal( leftHandSide->GetNumberOfVerts(), rightHandSide->GetNumberOfVerts(), eps, verbose )) { if(verbose) MITK_INFO << "[Equal( vtkPolyData*, vtkPolyData* )] Number of vertices not equal"; noDifferenceFound = false; } if( ! mitk::Equal( leftHandSide->GetNumberOfLines(), rightHandSide->GetNumberOfLines(), eps, verbose ) ) { if(verbose) MITK_INFO << "[Equal( vtkPolyData*, vtkPolyData* )] Number of lines not equal"; noDifferenceFound = false; } if( ! mitk::Equal( leftHandSide->GetNumberOfPolys(), rightHandSide->GetNumberOfPolys(), eps, verbose ) ) { if(verbose) MITK_INFO << "[Equal( vtkPolyData*, vtkPolyData* )] Number of polys not equal"; noDifferenceFound = false; } if( ! mitk::Equal( leftHandSide->GetNumberOfStrips(), rightHandSide->GetNumberOfStrips(), eps, verbose ) ) { if(verbose) MITK_INFO << "[Equal( vtkPolyData*, vtkPolyData* )] Number of strips not equal"; noDifferenceFound = false; } { unsigned int numberOfPointsRight = rightHandSide->GetPoints()->GetNumberOfPoints(); unsigned int numberOfPointsLeft = leftHandSide->GetPoints()->GetNumberOfPoints(); if(! mitk::Equal( numberOfPointsLeft, numberOfPointsRight, eps, verbose )) { if(verbose) MITK_INFO << "[Equal( vtkPolyData*, vtkPolyData* )] Number of points not equal"; noDifferenceFound = false; } else { for( unsigned int i( 0 ); i < numberOfPointsRight; i++ ) { bool pointFound = false; double pointOne[3]; rightHandSide->GetPoints()->GetPoint(i, pointOne); for( unsigned int j( 0 ); j < numberOfPointsLeft; j++ ) { double pointTwo[3]; leftHandSide->GetPoints()->GetPoint(j, pointTwo); double x = pointOne[0] - pointTwo[0]; double y = pointOne[1] - pointTwo[1]; double z = pointOne[2] - pointTwo[2]; double distance = x*x + y*y + z*z; if( distance < eps ) { pointFound = true; break; } } if( !pointFound ) { if(verbose) { MITK_INFO << "[Equal( vtkPolyData*, vtkPolyData* )] Right hand side point with id " << i << " and coordinates ( " << std::setprecision(12) << pointOne[0] << " ; " << pointOne[1] << " ; " << pointOne[2] << " ) could not be found in left hand side with epsilon " << eps << "."; } noDifferenceFound = false; break; } } } } return noDifferenceFound; } bool mitk::Equal( mitk::Surface* leftHandSide, mitk::Surface* rightHandSide, mitk::ScalarType eps, bool verbose ) { bool noDifferenceFound = true; if( rightHandSide == NULL ) { if(verbose) MITK_INFO << "[Equal( mitk::surface*, mitk::surface* )] rightHandSide NULL."; return false; } if( leftHandSide == NULL ) { if(verbose) MITK_INFO << "[Equal( mitk::surface*, mitk::surface* )] leftHandSide NULL."; return false; } if( ! mitk::Equal( leftHandSide->GetSizeOfPolyDataSeries(), rightHandSide->GetSizeOfPolyDataSeries(), eps, verbose ) ) { if(verbose) MITK_INFO << "[Equal( mitk::surface*, mitk::surface* )] Size of PolyData series not equal."; noDifferenceFound = false; } // No mitk::Equal for TimeGeometry implemented. //if( ! mitk::Equal( leftHandSide->GetTimeGeometry(), rightHandSide->GetTimeGeometry(), eps, verbose ) ) //{ // if(verbose) // MITK_INFO << "[Equal( mitk::surface*, mitk::surface* )] Time sliced geometries not equal"; // noDifferenceFound = false; //} for( unsigned int i( 0 ); i < rightHandSide->GetSizeOfPolyDataSeries(); i++ ) { if( ! mitk::Equal( leftHandSide->GetVtkPolyData( i ), rightHandSide->GetVtkPolyData( i ), eps, verbose ) ) { if(verbose) MITK_INFO << "[Equal( mitk::surface*, mitk::surface* )] Poly datas not equal."; noDifferenceFound = false; } } return noDifferenceFound; } diff --git a/Core/Code/DataManagement/mitkVector.h b/Core/Code/DataManagement/mitkVector.h index 914ee0959e..b0b4cec500 100644 --- a/Core/Code/DataManagement/mitkVector.h +++ b/Core/Code/DataManagement/mitkVector.h @@ -1,465 +1,552 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef MITKVECTOR_H_HEADER_INCLUDED_C1EBD0AD #define MITKVECTOR_H_HEADER_INCLUDED_C1EBD0AD -// this is needed for memcopy in ITK -// can be removed when fixed in ITK -#include +#include +#include #include #include #include #include #include #include #include #include -#include + +#include #ifndef DOXYGEN_SKIP namespace mitk { typedef double ScalarType; typedef itk::Matrix Matrix3D; typedef itk::Matrix Matrix4D; typedef vnl_matrix_fixed VnlMatrix3D; typedef itk::Transform Transform3D; typedef vnl_vector VnlVector; typedef vnl_vector_ref VnlVectorRef; typedef itk::Point Point2D; typedef itk::Point Point3D; typedef itk::Point Point4D; typedef itk::Point Point2I; typedef itk::Point Point3I; typedef itk::Point Point4I; typedef itk::Vector Vector2D; typedef itk::Vector Vector3D; typedef itk::Index<3> Index3D; typedef itk::ContinuousIndex ContinuousIndex3D; typedef vnl_quaternion Quaternion; //##Documentation //##@brief enumeration of the type a point can be enum PointSpecificationType { PTUNDEFINED = 0, PTSTART, PTCORNER, PTEDGE, PTEND }; typedef itk::NumericTraits ScalarTypeNumericTraits; MITK_CORE_EXPORT extern const ScalarType eps; MITK_CORE_EXPORT extern const ScalarType sqrteps; MITK_CORE_EXPORT extern const double large; template class VectorTraits { public: typedef T ValueType; }; template <> class VectorTraits { public: typedef ScalarType ValueType; }; template<> class VectorTraits { public: typedef float ValueType; }; template<> class VectorTraits< itk::Index<5> > { public: typedef itk::Index<5>::IndexValueType ValueType; }; template<> class VectorTraits< itk::Index<3> > { public: typedef itk::Index<3>::IndexValueType ValueType; }; template<> class VectorTraits< long int [3]> { public: typedef long int ValueType; }; template<> class VectorTraits< float [3]> { public: typedef float ValueType; }; template<> class VectorTraits< double [3]> { public: typedef double ValueType; }; template<> class VectorTraits< vnl_vector_fixed > { public: typedef ScalarType ValueType; }; template<> class VectorTraits< long unsigned int[3]> { public: typedef long unsigned int ValueType; }; template<> class VectorTraits< unsigned int *> { public: typedef unsigned int ValueType; }; template<> class VectorTraits< double[4] > { public: typedef double ValueType; }; template<> class VectorTraits< itk::Vector > { public: typedef float ValueType; }; template<> class VectorTraits< itk::Point > { public: typedef float ValueType; }; template<> class VectorTraits< itk::Point > { public: typedef float ValueType; }; template<> class VectorTraits< itk::Vector > { public: typedef double ValueType; }; template<> class VectorTraits< itk::Point > { public: typedef double ValueType; }; template<> class VectorTraits< itk::Point > { public: typedef double ValueType; }; template<> class VectorTraits< itk::Vector > { public: typedef int ValueType; }; template<> class VectorTraits< itk::Point > { public: typedef int ValueType; }; template inline void itk2vtk(const Tin& in, Tout& out) { out[0]=(typename VectorTraits::ValueType)(in[0]); out[1]=(typename VectorTraits::ValueType)(in[1]); out[2]=(typename VectorTraits::ValueType)(in[2]); } template inline void vtk2itk(const Tin& in, Tout& out) { out[0]=(typename VectorTraits::ValueType)(in[0]); out[1]=(typename VectorTraits::ValueType)(in[1]); out[2]=(typename VectorTraits::ValueType)(in[2]); } template inline void FillVector3D(Tout& out, ScalarType x, ScalarType y, ScalarType z) { out[0] = (typename VectorTraits::ValueType)x; out[1] = (typename VectorTraits::ValueType)y; out[2] = (typename VectorTraits::ValueType)z; } template inline void FillVector4D(Tout& out, ScalarType x, ScalarType y, ScalarType z, ScalarType t) { out[0] = (typename VectorTraits::ValueType)x; out[1] = (typename VectorTraits::ValueType)y; out[2] = (typename VectorTraits::ValueType)z; out[3] = (typename VectorTraits::ValueType)t; } template inline void vnl2vtk(const vnl_vector& in, Tout *out) { unsigned int i; for(i=0; i inline void vtk2vnl(const Tin *in, vnl_vector& out) { unsigned int i; for(i=0; i inline void vtk2vnlref(const Tin *in, vnl_vector_ref& out) { unsigned int i; for(i=0; i inline void vnl2vtk(const vnl_vector_fixed& in, Tout *out) { unsigned int i; for(i=0; i inline void vtk2vnl(const Tin *in, vnl_vector_fixed& out) { unsigned int i; for(i=0; i itk::Vector operator+(const itk::Vector &vector, const itk::Point &point) { itk::Vector sub; for( unsigned int i=0; i inline itk::Vector& operator+=(itk::Vector &vector, const itk::Point &point) { for( unsigned int i=0; i itk::Vector operator-(const itk::Vector &vector, const itk::Point &point) { itk::Vector sub; for( unsigned int i=0; i inline itk::Vector& operator-=(itk::Vector &vector, const itk::Point &point) { for( unsigned int i=0; i inline bool MatrixEqualRMS(const vnl_matrix_fixed& matrix1,const vnl_matrix_fixed& matrix2,mitk::ScalarType epsilon=mitk::eps) { if ( (matrix1.rows() == matrix2.rows()) && (matrix1.cols() == matrix2.cols()) ) { vnl_matrix_fixed differenceMatrix = matrix1-matrix2; if (differenceMatrix.rms() inline bool MatrixEqualRMS(const itk::Matrix& matrix1,const itk::Matrix& matrix2,mitk::ScalarType epsilon=mitk::eps) { return mitk::MatrixEqualRMS(matrix1.GetVnlMatrix(),matrix2.GetVnlMatrix(),epsilon); } /*! \brief Check for element-wise matrix equality with a user defined accuracy. \param matrix1 first vnl matrix \param matrix2 second vnl matrix \param epsilon user defined accuracy bounds */ template inline bool MatrixEqualElementWise(const vnl_matrix_fixed& matrix1,const vnl_matrix_fixed& matrix2,mitk::ScalarType epsilon=mitk::eps) { if ( (matrix1.rows() == matrix2.rows()) && (matrix1.cols() == matrix2.cols()) ) { for( unsigned int r=0; repsilon) { return false; } } } return true; } else { return false; } } /*! \brief Check for element-wise matrix equality with a user defined accuracy. \param matrix1 first itk matrix \param matrix2 second itk matrix \param epsilon user defined accuracy bounds */ template inline bool MatrixEqualElementWise(const itk::Matrix& matrix1,const itk::Matrix& matrix2,mitk::ScalarType epsilon=mitk::eps) { return mitk::MatrixEqualElementWise(matrix1.GetVnlMatrix(),matrix2.GetVnlMatrix(),epsilon); } +/** + * @ingroup MITKTestingAPI + * + * @param vector1 Vector to compare. + * @param vector2 Vector to compare. + * @param eps Tolerance for floating point comparison. + * @param verbose Flag indicating detailed console output. + * @return True if vectors are equal. + */ template -inline bool Equal(const itk::Vector& vector1, const itk::Vector& vector2, TCoordRep eps=mitk::eps) +inline bool Equal(const itk::Vector& vector1, const itk::Vector& vector2, TCoordRep eps=mitk::eps, bool verbose=false) { + bool isEqual = true; typename itk::Vector::VectorType diff = vector1-vector2; for (unsigned int i=0; ieps || diff[i]<-eps) - return false; - return true; + { + if (diff[i]>eps || diff[i]<-eps) + { + isEqual = false; + break; + } + } + + if(verbose && !isEqual) + { + MITK_INFO << "Vectors not equal. Lefthandside " << std::setprecision(12) << vector1 << " - Righthandside " << vector2 << " - epsilon " << eps; + } + return isEqual; } +/** + * @ingroup MITKTestingAPI + * + * @param point1 Point to compare. + * @param point2 Point to compare. + * @param eps Tolerance for floating point comparison. + * @param verbose Flag indicating detailed console output. + * @return True if points are equal. + */ template - inline bool Equal(const itk::Point& vector1, const itk::Point& vector2, TCoordRep eps=mitk::eps) + inline bool Equal(const itk::Point& point1, const itk::Point& point2, TCoordRep eps=mitk::eps, bool verbose=false) { - typename itk::Point::VectorType diff = vector1-vector2; + bool isEqual = true; + typename itk::Point::VectorType diff = point1-point2; for (unsigned int i=0; ieps || diff[i]<-eps) - return false; - return true; + { + isEqual = false; + break; + } + } + + if(verbose && !isEqual) + { + MITK_INFO << "Points not equal. Lefthandside " << std::setprecision(12) << point1 << " - Righthandside " << point2 << " - epsilon " << eps; + } + return isEqual; } -inline bool Equal(const mitk::VnlVector& vector1, const mitk::VnlVector& vector2, ScalarType eps=mitk::eps) +/** + * @ingroup MITKTestingAPI + * + * @param vector1 Vector to compare. + * @param vector2 Vector to compare. + * @param eps Tolerance for floating point comparison. + * @param verbose Flag indicating detailed console output. + * @return True if vectors are equal. + */ +inline bool Equal(const mitk::VnlVector& vector1, const mitk::VnlVector& vector2, ScalarType eps=mitk::eps, bool verbose=false) { + bool isEqual = true; mitk::VnlVector diff = vector1-vector2; for (unsigned int i=0; ieps || diff[i]<-eps) - return false; - return true; + { + isEqual = false; + break; + } + } + + if(verbose && !isEqual) + { + MITK_INFO << "Vectors not equal. Lefthandside " << std::setprecision(12) << vector1 << " - Righthandside " << vector2 << " - epsilon " << eps; + } + return isEqual; } -inline bool Equal(ScalarType scalar1, ScalarType scalar2, ScalarType eps=mitk::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( fabs(scalar1-scalar2) < eps ); + if(verbose && !isEqual) + { + MITK_INFO << "Scalars not equal. Lefthandside " << std::setprecision(12) << scalar1 << " - Righthandside " << scalar2 << " - epsilon " << eps; + } return isEqual; } +/** + * @ingroup MITKTestingAPI + * + * @param vector1 Vector to compare. + * @param vector2 Vector to compare. + * @param eps Tolerance for floating point comparison. + * @param verbose Flag indicating detailed console output. + * @return True if vectors are equal. + */ template - inline bool Equal(const vnl_vector_fixed & vector1, const vnl_vector_fixed& vector2, TCoordRep eps=mitk::eps) + inline bool Equal(const vnl_vector_fixed & vector1, const vnl_vector_fixed& vector2, TCoordRep eps=mitk::eps, bool verbose=false) { vnl_vector_fixed diff = vector1-vector2; - bool returnValue = true; + bool isEqual = true; for( unsigned int i=0; ieps || diff[i]<-eps) { - returnValue = false; + isEqual = false; + break; } } - return returnValue; + if(verbose && !isEqual) + { + MITK_INFO << "Vectors not equal. Lefthandside " << std::setprecision(12) << vector1 << " - Righthandside " << vector2 << " - epsilon " << eps; + } + return isEqual; } template inline void TransferMatrix(const itk::Matrix& in, itk::Matrix& out) { for (unsigned int i = 0; i < in.RowDimensions; ++i) for (unsigned int j = 0; j < in.ColumnDimensions; ++j) out[i][j] = in[i][j]; } } // namespace mitk #endif //DOXYGEN_SKIP /* * This part of the code has been shifted here to avoid compiler clashes * caused by including before the declaration of * the Equal() methods above. This problem occurs when using MSVC and is * probably related to a compiler bug. */ #include namespace mitk { typedef itk::AffineGeometryFrame::TransformType AffineTransform3D; } #define mitkSetConstReferenceMacro(name,type) \ virtual void Set##name (const type & _arg) \ { \ itkDebugMacro("setting " << #name " to " << _arg ); \ if (this->m_##name != _arg) \ { \ this->m_##name = _arg; \ this->Modified(); \ } \ } #define mitkSetVectorMacro(name,type) \ mitkSetConstReferenceMacro(name,type) #define mitkGetVectorMacro(name,type) \ itkGetConstReferenceMacro(name,type) #endif /* MITKVECTOR_H_HEADER_INCLUDED_C1EBD0AD */ diff --git a/Core/Code/Testing/CMakeLists.txt b/Core/Code/Testing/CMakeLists.txt index a880e9e3d4..4ef4ad90fb 100644 --- a/Core/Code/Testing/CMakeLists.txt +++ b/Core/Code/Testing/CMakeLists.txt @@ -1,263 +1,263 @@ # 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(LABELS MITK-Core) -# MITK_INSTALL_TARGETS(EXECUTABLES MitkTestDriver) +mitk_use_modules(TARGET ${TESTDRIVER} PACKAGES ITK>ITKThresholding) mitkAddCustomModuleTest(mitkVolumeCalculatorTest_Png2D-bw mitkVolumeCalculatorTest ${MITK_DATA_DIR}/Png2D-bw.png ${MITK_DATA_DIR}/Pic2DplusT.nrrd ) mitkAddCustomModuleTest(mitkEventMapperTest_Test1And2 mitkEventMapperTest ${MITK_DATA_DIR}/TestStateMachine1.xml ${MITK_DATA_DIR}/TestStateMachine2.xml ) mitkAddCustomModuleTest(mitkEventConfigTest_CreateObjectInDifferentWays mitkEventConfigTest ${MITK_SOURCE_DIR}/Core/Code/Testing/Resources/Interactions/StatemachineConfigTest.xml ) mitkAddCustomModuleTest(mitkNodeDependentPointSetInteractorTest mitkNodeDependentPointSetInteractorTest ${MITK_DATA_DIR}/Pic3D.nrrd ${MITK_DATA_DIR}/BallBinary30x30x30.nrrd ) mitkAddCustomModuleTest(mitkDataStorageTest_US4DCyl mitkDataStorageTest ${MITK_DATA_DIR}/US4DCyl.nrrd ) mitkAddCustomModuleTest(mitkStateMachineFactoryTest_TestStateMachine1_2 mitkStateMachineFactoryTest ${MITK_DATA_DIR}/TestStateMachine1.xml ${MITK_DATA_DIR}/TestStateMachine2.xml ) mitkAddCustomModuleTest(mitkDicomSeriesReaderTest_CTImage mitkDicomSeriesReaderTest ${MITK_DATA_DIR}/TinyCTAbdomen ${MITK_DATA_DIR}/DICOMReader/Broken-Series ) 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(mitkImageTest_3DImageData mitkImageGeneratorTest ${MITK_DATA_DIR}/Pic3D.nrrd ) 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 ) if(MITK_ENABLE_RENDERING_TESTING) ### since the rendering test's do not run in ubuntu, yet, we build them only for other systems or if the user explicitly sets the variable MITK_ENABLE_RENDERING_TESTING mitkAddCustomModuleTest(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 ${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 ${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 ${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 ${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 ${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 ${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 ${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 ${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 ) #Test reslice interpolation #note: nearest mode is already tested by swivel test mitkAddCustomModuleTest(ResliceInterpolationIsLinear mitkImageVtkMapper2DResliceInterpolationPropertyTest 1 #linear ${MITK_DATA_DIR}/Pic3D.nrrd -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/pic3dRefLinear.png #corresponding reference screenshot LINEAR ) mitkAddCustomModuleTest(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 #Overlays mitkAddCustomModuleTest(mitkLabelOverlay3DRendering2DTest mitkLabelOverlay3DRendering2DTest #OverlayTest -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/mitkLabelOverlay3DRendering2DTest.png #corresponding reference screenshot ) mitkAddCustomModuleTest(mitkLabelOverlay3DRendering3DTest mitkLabelOverlay3DRendering3DTest #OverlayTest -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/mitkLabelOverlay3DRendering3DTest.png #corresponding reference screenshot ) mitkAddCustomModuleTest(mitkTextOverlay2DRenderingTest_ball mitkTextOverlay2DRenderingTest #OverlayTest ${MITK_DATA_DIR}/ball.stl #input image to load in data storage -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/mitkTextOverlay2DRenderingTest_ball.png #corresponding reference screenshot ) #mitkAddCustomModuleTest(mitkTextOverlay2DLayouterRenderingTest_ball mitkTextOverlay2DLayouterRenderingTest #OverlayTest # ${MITK_DATA_DIR}/ball.stl #input image to load in data storage # -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/mitkTextOverlay2DLayouterRenderingTest_ball.png #corresponding reference screenshot #) mitkAddCustomModuleTest(mitkTextOverlay3DRendering2DTest_ball mitkTextOverlay3DRendering2DTest #OverlayTest ${MITK_DATA_DIR}/ball.stl #input image to load in data storage -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/mitkTextOverlay3DRendering2DTest_ball.png #corresponding reference screenshot ) mitkAddCustomModuleTest(mitkTextOverlay3DRendering3DTest_ball mitkTextOverlay3DRendering3DTest #OverlayTest ${MITK_DATA_DIR}/ball.stl #input image to load in data storage -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/mitkTextOverlay3DRendering3DTest_ball.png #corresponding reference screenshot ) mitkAddCustomModuleTest(mitkTextOverlay3DColorRenderingTest_ball mitkTextOverlay3DColorRenderingTest #OverlayTest ${MITK_DATA_DIR}/ball.stl #input image to load in data storage -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/mitkTextOverlay3DColorRenderingTest_ball.png #corresponding reference screenshot ) #End of overlayTests # Testing of the rendering of binary images #mitkAddCustomModuleTest(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 # ${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 ${MITK_DATA_DIR}/ToF-Data/Kinect_LiverPhantom.vtp ${MITK_DATA_DIR}/ToF-Data/Kinect_LiverPhantom_RGBImage.nrrd -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/texturedLiver640x480REF.png #corresponding reference screenshot ) mitkAddCustomModuleTest(mitkImageVtkMapper2DTransferFunctionTest_Png2D-bw mitkImageVtkMapper2DTransferFunctionTest ${MITK_DATA_DIR}/Png2D-bw.png -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/Png2D-bw-TransferFunctionRGBImage640x480REF.png #corresponding reference screenshot ) mitkAddCustomModuleTest(mitkSurfaceGLMapper2DColorTest_RedBall mitkSurfaceGLMapper2DColorTest ${MITK_DATA_DIR}/ball.stl -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/ballColorRed640x480REF.png #corresponding reference screenshot ) mitkAddCustomModuleTest(mitkSurfaceGLMapper2DColorTest_DasArmeSchwein mitkSurfaceGLMapper2DColorTest ${MITK_DATA_DIR}/binary.stl -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/binaryColorRed640x480REF.png #corresponding reference screenshot ) mitkAddCustomModuleTest(mitkSurfaceGLMapper2DOpacityTest_BallOpacity mitkSurfaceGLMapper2DOpacityTest #opacity = 50% (0.5) ${MITK_DATA_DIR}/ball.stl -V ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/ballOpacity640x480REF.png #corresponding reference screenshot ) ############################## DISABLED TESTS #Removed due to high rendering error. #mitkAddCustomModuleTest(mitkSurfaceVtkMapper3DTexturedSphereTest_Football mitkSurfaceVtkMapper3DTexturedSphereTest # ${MITK_DATA_DIR}/RenderingTestData/texture.jpg #input texture # -V # ${MITK_DATA_DIR}/RenderingTestData/ReferenceScreenshots/texturedSphere640x480REF.png corresponding reference screenshot #) #mitkAddCustomModuleTest(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 # ${MITK_DATA_DIR}/NrrdWritingTestImage.jpg #) #mitkAddCustomModuleTest(mitkNodeDependentPointSetInteractorTest mitkNodeDependentPointSetInteractorTest # ${MITK_DATA_DIR}/Pic3D.pic.gz ${MITK_DATA_DIR}/BallBinary30x30x30.pic.gz #) SET_PROPERTY(TEST mitkImageVtkMapper2D_rgbaImage640x480 mitkImageVtkMapper2D_pic3d640x480 mitkImageVtkMapper2D_pic3dColorBlue640x480 mitkImageVtkMapper2D_pic3dLevelWindow640x480 mitkImageVtkMapper2D_pic3dSwivel640x480 mitkImageVtkMapper2DTransferFunctionTest_Png2D-bw # mitkImageVtkMapper2D_pic3dOpacity640x480 mitkSurfaceGLMapper2DOpacityTest_BallOpacity mitkSurfaceGLMapper2DColorTest_DasArmeSchwein mitkSurfaceGLMapper2DColorTest_RedBall mitkSurfaceVtkMapper3DTest_TextureProperty mitkPointSetVtkMapper2D_Pic3DPointSetForPic3D640x480 mitkPointSetVtkMapper2D_openMeAlone640x480 mitkPointSetVtkMapper2D_openMeAloneGlyphType640x480 mitkPointSetVtkMapper2D_openMeAloneTransformed640x480 #mitkSurfaceVtkMapper3DTexturedSphereTest_Football PROPERTY RUN_SERIAL TRUE) endif() add_test(mitkPointSetLocaleTest ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} mitkPointSetLocaleTest ${MITK_DATA_DIR}/pointSet.mps) set_property(TEST mitkPointSetLocaleTest PROPERTY LABELS MITK-Core) add_test(mitkImageWriterTest_nrrdImage ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} mitkImageWriterTest ${MITK_DATA_DIR}/NrrdWritingTestImage.jpg) add_test(mitkImageWriterTest_2DPNGImage ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} mitkImageWriterTest ${MITK_DATA_DIR}/Png2D-bw.png) add_test(mitkImageWriterTest_rgbPNGImage ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} mitkImageWriterTest ${MITK_DATA_DIR}/RenderingTestData/rgbImage.png) add_test(mitkImageWriterTest_rgbaPNGImage ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${TESTDRIVER} mitkImageWriterTest ${MITK_DATA_DIR}/RenderingTestData/rgbaImage.png) set_property(TEST mitkImageWriterTest_nrrdImage PROPERTY LABELS MITK-Core) set_property(TEST mitkImageWriterTest_2DPNGImage PROPERTY LABELS MITK-Core) set_property(TEST mitkImageWriterTest_rgbPNGImage PROPERTY LABELS MITK-Core) set_property(TEST mitkImageWriterTest_rgbaPNGImage PROPERTY LABELS MITK-Core) add_subdirectory(DICOMTesting) diff --git a/Core/Code/Testing/DICOMTesting/CMakeLists.txt b/Core/Code/Testing/DICOMTesting/CMakeLists.txt index 3dd800979d..45802db9d1 100644 --- a/Core/Code/Testing/DICOMTesting/CMakeLists.txt +++ b/Core/Code/Testing/DICOMTesting/CMakeLists.txt @@ -1,40 +1,36 @@ if(BUILD_TESTING) if(GDCM_DIR) # clear variables from prior files.cmake # Else CMake would use the content of these variables and would try to create tests (which are not present in DICOMTesting). set(MODULE_TESTS) set(MODULE_IMAGE_TESTS) set(MODULE_SURFACE_TESTS) set(MODULE_TESTIMAGES) set(MODULE_TESTSURFACES) set(MODULE_CUSTOM_TESTS) set(H_FILES) set(CPP_FILES) # now create a new module only for testing purposes MITK_CREATE_MODULE( mitkDICOMTesting DEPENDS Mitk # Mitk.so ) -MITK_CHECK_MODULE(_RESULT mitkDICOMTesting) -if(_RESULT) - message(STATUS "mitkDICOMTesting application won't be built. Missing: ${_RESULT}") -else(_RESULT) - +if(MODULE_IS_ENABLED) # add helpful applications include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) # dumps out image information add_executable(DumpDICOMMitkImage DumpDICOMMitkImage.cpp) mitk_use_modules(TARGET DumpDICOMMitkImage MODULES mitkDICOMTesting) # compares dumped out image information against reference dump add_executable(VerifyDICOMMitkImageDump VerifyDICOMMitkImageDump.cpp) mitk_use_modules(TARGET VerifyDICOMMitkImageDump MODULES mitkDICOMTesting) add_subdirectory(Testing) endif() endif() endif() diff --git a/Core/Code/Testing/files.cmake b/Core/Code/Testing/files.cmake index 3032e20546..fe9ae32ce0 100644 --- a/Core/Code/Testing/files.cmake +++ b/Core/Code/Testing/files.cmake @@ -1,183 +1,179 @@ # tests with no extra command line parameter set(MODULE_TESTS mitkAccessByItkTest.cpp mitkCoreObjectFactoryTest.cpp mitkMaterialTest.cpp mitkActionTest.cpp mitkDispatcherTest.cpp mitkEnumerationPropertyTest.cpp mitkEventTest.cpp mitkFocusManagerTest.cpp mitkGenericPropertyTest.cpp mitkGeometry2DTest.cpp mitkGeometry3DTest.cpp mitkGeometry3DEqualTest.cpp mitkGeometryDataToSurfaceFilterTest.cpp mitkGlobalInteractionTest.cpp mitkImageEqualTest.cpp mitkImageDataItemTest.cpp mitkImageGeneratorTest.cpp mitkBaseDataTest.cpp mitkImportItkImageTest.cpp mitkGrabItkImageMemoryTest.cpp mitkInstantiateAccessFunctionTest.cpp mitkInteractorTest.cpp mitkLevelWindowTest.cpp mitkMessageTest.cpp mitkPixelTypeTest.cpp mitkPlaneGeometryTest.cpp mitkPointSetEqualTest.cpp mitkPointSetFileIOTest.cpp mitkPointSetTest.cpp mitkPointSetWriterTest.cpp mitkPointSetReaderTest.cpp mitkPointSetInteractorTest.cpp mitkPropertyTest.cpp mitkPropertyListTest.cpp mitkSlicedGeometry3DTest.cpp mitkSliceNavigationControllerTest.cpp mitkStateMachineTest.cpp mitkStateTest.cpp mitkSurfaceTest.cpp mitkSurfaceEqualTest.cpp mitkSurfaceToSurfaceFilterTest.cpp mitkTimeGeometryTest.cpp mitkTransitionTest.cpp mitkUndoControllerTest.cpp mitkVtkWidgetRenderingTest.cpp mitkVerboseLimitedLinearUndoTest.cpp mitkWeakPointerTest.cpp mitkTransferFunctionTest.cpp mitkStepperTest.cpp itkTotalVariationDenoisingImageFilterTest.cpp mitkRenderingManagerTest.cpp vtkMitkThickSlicesFilterTest.cpp mitkNodePredicateSourceTest.cpp mitkVectorTest.cpp mitkClippedSurfaceBoundsCalculatorTest.cpp mitkExceptionTest.cpp mitkExtractSliceFilterTest.cpp mitkLogTest.cpp mitkImageDimensionConverterTest.cpp mitkLoggingAdapterTest.cpp mitkUIDGeneratorTest.cpp mitkShaderRepositoryTest.cpp mitkPlanePositionManagerTest.cpp mitkAffineTransformBaseTest.cpp mitkPropertyAliasesTest.cpp mitkPropertyDescriptionsTest.cpp mitkPropertyExtensionsTest.cpp mitkPropertyFiltersTest.cpp mitkTinyXMLTest.cpp mitkRawImageFileReaderTest.cpp mitkInteractionEventTest.cpp mitkLookupTableTest.cpp mitkSTLFileReaderTest.cpp ################## 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. ) # 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 mitkDataNodeFactoryTest.cpp #runs on all types of data ) set(MODULE_SURFACE_TESTS mitkSurfaceVtkWriterTest.cpp #only runs on surfaces mitkDataNodeFactoryTest.cpp #runs on all types of data ) # list of images for which the tests are run set(MODULE_TESTIMAGES US4DCyl.nrrd Pic3D.nrrd Pic2DplusT.nrrd BallBinary30x30x30.nrrd Png2D-bw.png ) set(MODULE_TESTSURFACES binary.stl ball.stl ) set(MODULE_CUSTOM_TESTS mitkDataStorageTest.cpp mitkDataNodeTest.cpp mitkDicomSeriesReaderTest.cpp mitkDICOMLocaleTest.cpp mitkEventMapperTest.cpp mitkEventConfigTest.cpp mitkNodeDependentPointSetInteractorTest.cpp mitkStateMachineFactoryTest.cpp mitkPointSetLocaleTest.cpp mitkImageTest.cpp mitkImageWriterTest.cpp mitkImageVtkMapper2DTest.cpp mitkImageVtkMapper2DLevelWindowTest.cpp mitkImageVtkMapper2DOpacityTest.cpp mitkImageVtkMapper2DResliceInterpolationPropertyTest.cpp mitkImageVtkMapper2DColorTest.cpp mitkImageVtkMapper2DSwivelTest.cpp mitkImageVtkMapper2DTransferFunctionTest.cpp mitkImageVtkMapper2DLookupTableTest.cpp mitkIOUtilTest.cpp mitkSurfaceVtkMapper3DTest mitkSurfaceVtkMapper3DTexturedSphereTest.cpp mitkSurfaceGLMapper2DColorTest.cpp mitkSurfaceGLMapper2DOpacityTest.cpp mitkVolumeCalculatorTest.cpp mitkLevelWindowManagerTest.cpp mitkPointSetVtkMapper2DTest.cpp mitkPointSetVtkMapper2DImageTest.cpp mitkPointSetVtkMapper2DGlyphTypeTest.cpp mitkPointSetVtkMapper2DTransformedPointsTest.cpp mitkLabelOverlay3DRendering2DTest.cpp mitkLabelOverlay3DRendering3DTest.cpp mitkTextOverlay2DRenderingTest.cpp mitkTextOverlay2DLayouterRenderingTest.cpp mitkTextOverlay3DRendering2DTest.cpp mitkTextOverlay3DRendering3DTest.cpp mitkTextOverlay3DColorRenderingTest.cpp mitkVTKRenderWindowSizeTest.cpp mitkMultiComponentImageDataComparisonFilterTest.cpp mitkImageToItkTest.cpp mitkImageSliceSelectorTest.cpp ) -if (${VTK_MAJOR_VERSION} VERSION_LESS 6) # test can be removed with VTK 6 - set(MODULE_TESTS ${MODULE_TESTS} mitkVTKRenderWindowSizeTest.cpp) -endif() - set(MODULE_RESOURCE_FILES Interactions/AddAndRemovePoints.xml Interactions/globalConfig.xml Interactions/StatemachineTest.xml Interactions/StatemachineConfigTest.xml ) # Create an artificial module initializing class for # the usServiceListenerTest.cpp usFunctionGenerateExecutableInit(testdriver_init_file IDENTIFIER ${MODULE_NAME}TestDriver ) # Embed the resources set(testdriver_resources ) usFunctionEmbedResources(testdriver_resources EXECUTABLE_NAME ${MODULE_NAME}TestDriver ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Resources FILES ${MODULE_RESOURCE_FILES} ) set(TEST_CPP_FILES ${testdriver_init_file} ${testdriver_resources}) diff --git a/Core/Code/Testing/mitkImageTimeSelectorTest.cpp b/Core/Code/Testing/mitkImageTimeSelectorTest.cpp index 249c9a3514..ac9bcf0d02 100644 --- a/Core/Code/Testing/mitkImageTimeSelectorTest.cpp +++ b/Core/Code/Testing/mitkImageTimeSelectorTest.cpp @@ -1,120 +1,119 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkImage.h" #include "mitkDataNodeFactory.h" #include "mitkImageTimeSelector.h" #include "mitkImageGenerator.h" -#include "mitkTesting.h" #include "mitkTestingMacros.h" #include "mitkIOUtil.h" #include #include /** Global members common for all subtests */ namespace { std::string m_Filename; mitk::Image::Pointer m_Image; } // end of anonymous namespace /** @brief Global test setup */ static void Setup( ) { try { m_Image = mitk::IOUtil::LoadImage( m_Filename ); } catch( const itk::ExceptionObject &e) { MITK_TEST_FAILED_MSG(<< "(Setup) Caught exception from IOUtil while loading input : " << m_Filename <<"\n") } } static void Valid_AllInputTimesteps_ReturnsTrue() { Setup(); mitk::ImageTimeSelector::Pointer timeSelector = mitk::ImageTimeSelector::New(); timeSelector->SetInput(m_Image); // test all timesteps const unsigned int maxTimeStep = m_Image->GetTimeSteps(); for( unsigned int t=0; tSetTimeNr(t); timeSelector->Update(); mitk::Image::Pointer currentTimestepImage = timeSelector->GetOutput(); std::stringstream ss; ss << " : Valid image in timestep " << t ; MITK_TEST_CONDITION_REQUIRED( currentTimestepImage.IsNotNull() , ss.str().c_str() ); } } static void Valid_ImageExpandedByTimestep_ReturnsTrue() { Setup(); mitk::ImageTimeSelector::Pointer timeSelector = mitk::ImageTimeSelector::New(); const unsigned int maxTimeStep = m_Image->GetTimeSteps(); mitk::TimeGeometry* tsg = m_Image->GetTimeGeometry(); mitk::ProportionalTimeGeometry* ptg = dynamic_cast(tsg); ptg->Expand(maxTimeStep+1); ptg->SetTimeStepGeometry( ptg->GetGeometryForTimeStep(0), maxTimeStep ); mitk::Image::Pointer expandedImage = mitk::Image::New(); expandedImage->Initialize( m_Image->GetPixelType(0), *tsg ); timeSelector->SetInput(expandedImage); for( unsigned int t=0; tSetTimeNr(t); timeSelector->Update(); mitk::Image::Pointer currentTimestepImage = timeSelector->GetOutput(); std::stringstream ss; ss << " : Valid image in timestep " << t ; MITK_TEST_CONDITION_REQUIRED( currentTimestepImage.IsNotNull() , ss.str().c_str() ); } } int mitkImageTimeSelectorTest(int argc, char* argv[]) { MITK_TEST_BEGIN(mitkImageTimeSelectorTest); m_Filename = std::string( argv[1] ); Valid_AllInputTimesteps_ReturnsTrue(); Valid_ImageExpandedByTimestep_ReturnsTrue(); MITK_TEST_END(); } diff --git a/Core/Code/Testing/mitkTinyXMLTest.cpp b/Core/Code/Testing/mitkTinyXMLTest.cpp index 3131519700..01729491db 100644 --- a/Core/Code/Testing/mitkTinyXMLTest.cpp +++ b/Core/Code/Testing/mitkTinyXMLTest.cpp @@ -1,157 +1,162 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkTestingMacros.h" +#include + #include -#include +#include +#include +#include + #include static const std::string filename = itksys::SystemTools::GetCurrentWorkingDirectory() + "/TinyXMLTest.txt"; static const std::string elementToStoreAttributeName = "DoubleTest"; static const std::string attributeToStoreName = "CommaValue"; static double calcPrecision(const unsigned int requiredDecimalPlaces) { return pow(10.0, -1.0 * ((double) requiredDecimalPlaces)); } /** * create a simple xml document which stores the values * @param valueToWrite value which should be stored * @return true, if document was successfully created. */ static bool Setup(double valueToWrite) { // 1. create simple document TiXmlDocument document; TiXmlDeclaration* decl = new TiXmlDeclaration( "1.0", "", "" ); // TODO what to write here? encoding? etc.... document.LinkEndChild( decl ); TiXmlElement* version = new TiXmlElement("Version"); version->SetAttribute("Writer", __FILE__ ); version->SetAttribute("CVSRevision", "$Revision: 17055 $" ); version->SetAttribute("FileVersion", 1 ); document.LinkEndChild(version); // 2. store one element containing a double value with potentially many after comma digits. TiXmlElement* vElement = new TiXmlElement( elementToStoreAttributeName ); vElement->SetDoubleAttribute( attributeToStoreName, valueToWrite ); document.LinkEndChild(vElement); // 3. store in file. return document.SaveFile( filename ); } static int readValueFromSetupDocument(double& readOutValue) { TiXmlDocument document; if (!document.LoadFile(filename)) { MITK_TEST_CONDITION_REQUIRED(false, "Test Setup failed, could not open " << filename); return TIXML_NO_ATTRIBUTE; } else { TiXmlElement* doubleTest = document.FirstChildElement(elementToStoreAttributeName); return doubleTest->QueryDoubleAttribute(attributeToStoreName, &readOutValue); } } /** * * @return true if TearDown was successful. */ static bool TearDown() { return !remove(filename.c_str()); } static void Test_Setup_works() { MITK_TEST_CONDITION_REQUIRED(Setup(1.0) && TearDown(), "Test if setup and teardown correctly writes data to " << filename << " and deletes the file after the test"); } /** * this first test ensures we can correctly readout values from the * TinyXMLDocument. */ static void Test_ReadOutValue_works() { Setup(1.0); double readValue; MITK_TEST_CONDITION_REQUIRED(TIXML_SUCCESS == readValueFromSetupDocument(readValue), "checking if readout mechanism works."); } static void Test_DoubleValueWriteOut() { const double valueToWrite = -1.123456; const int validDigitsAfterComma = 6; // indicates the number of valid digits after comma of valueToWrite const double neededPrecision = calcPrecision(validDigitsAfterComma + 1); double readValue; Setup(valueToWrite); readValueFromSetupDocument(readValue); MITK_TEST_CONDITION_REQUIRED(mitk::Equal(valueToWrite, readValue, neededPrecision), std::setprecision(validDigitsAfterComma) << "Testing if value " << valueToWrite << " equals " << readValue << " which was retrieved from TinyXML document"); TearDown(); } static void Test_DoubleValueWriteOut_manyDecimalPlaces() { const double valueToWrite = -1.12345678910111; const int validDigitsAfterComma = 14; // indicates the number of valid digits after comma of valueToWrite const double neededPrecision = calcPrecision(validDigitsAfterComma + 1); double readValue; Setup(valueToWrite); readValueFromSetupDocument(readValue); MITK_TEST_CONDITION_REQUIRED(mitk::Equal(valueToWrite, readValue, neededPrecision), std::setprecision(validDigitsAfterComma) << "Testing if value " << valueToWrite << " equals " << readValue << " which was retrieved from TinyXML document"); TearDown(); } int mitkTinyXMLTest(int /* argc */, char* /*argv*/[]) { MITK_TEST_BEGIN("TinyXMLTest"); Test_Setup_works(); Test_ReadOutValue_works(); Test_DoubleValueWriteOut(); Test_DoubleValueWriteOut_manyDecimalPlaces(); MITK_TEST_END() } diff --git a/Core/Code/Testing/mitkVectorTest.cpp b/Core/Code/Testing/mitkVectorTest.cpp index 4bd07595f6..9f2b8c4256 100644 --- a/Core/Code/Testing/mitkVectorTest.cpp +++ b/Core/Code/Testing/mitkVectorTest.cpp @@ -1,137 +1,139 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include #include +#include + int mitkVectorTest(int /*argc*/, char* /*argv*/[]) { MITK_TEST_BEGIN("mitkVector"); // test itk vector equality methods itk::Vector itkVector_1; itkVector_1[0] = 4.6; itkVector_1[1] = 9.76543; itkVector_1[2] = 746.09; itk::Vector itkVector_2; itk::Vector itkVector_3; for (int i=0; i<3; i++) { itkVector_2[i] = itkVector_1[i] - mitk::eps*1.1; itkVector_3[i] = itkVector_1[i] - mitk::eps*0.9; } MITK_TEST_CONDITION(mitk::Equal(itkVector_1,itkVector_1), "Test vector equality using the same vector with mitk::eps"); MITK_TEST_CONDITION(!mitk::Equal(itkVector_1,itkVector_2), "Test vector equality using different vectors with an element-wise difference greater than mitk::eps"); MITK_TEST_CONDITION( mitk::Equal(itkVector_1, itkVector_2, mitk::eps*1.2), "Vectors are equal for higher epsilon tolerance ( 1.2 * mitk::eps )"); MITK_TEST_CONDITION(mitk::Equal(itkVector_1,itkVector_3), "Test vector equality using different vectors with an element-wise difference less than mitk::eps"); // test itk point equality methods itk::Point itkPoint_1; itk::Point itkPoint_2; itk::Point itkPoint_3; for (int i=0; i<3; i++) { itkPoint_1[i] = itkVector_1[i]; itkPoint_2[i] = itkVector_2[i]; itkPoint_3[i] = itkVector_3[i]; } MITK_TEST_CONDITION(mitk::Equal(itkPoint_1,itkPoint_1), "Test point equality using the same point with mitk::eps"); MITK_TEST_CONDITION(!mitk::Equal(itkPoint_1,itkPoint_2), "Test point equality using different points with an element-wise difference greater than mitk::eps"); MITK_TEST_CONDITION( mitk::Equal(itkPoint_1, itkPoint_2, mitk::eps * 1.2), "Points are equal for higher epsilon tolerance ( 1.2 * mitk::eps )"); MITK_TEST_CONDITION(mitk::Equal(itkPoint_1,itkPoint_3), "Test point equality using different points with an element-wise difference less than mitk::eps"); // test mitk vnl vector equality methods mitk::VnlVector mitk_vnl_vector_1(3); mitk::VnlVector mitk_vnl_vector_2(3); mitk::VnlVector mitk_vnl_vector_3(3); for (int i=0; i<3; i++) { mitk_vnl_vector_1.put(i,itkVector_1[i]); mitk_vnl_vector_2.put(i,itkVector_2[i]); mitk_vnl_vector_3.put(i,itkVector_1[i]); } MITK_TEST_CONDITION(mitk::Equal(mitk_vnl_vector_1,mitk_vnl_vector_1), "Test mitk vnl vector equality using the same mitk vnl vector with mitk::eps"); MITK_TEST_CONDITION(!mitk::Equal(mitk_vnl_vector_1,mitk_vnl_vector_2), "Test mitk vnl vector equality using different mitk vnl vectors with an element-wise difference greater than mitk::eps"); - MITK_TEST_CONDITION( mitk::Equal(mitk_vnl_vector_1, mitk_vnl_vector_2, true, mitk::eps*1.2), "Vnl vectors are equal for higher epsilon tolerance ( 1.2 * mitk::eps )"); + MITK_TEST_CONDITION( mitk::Equal(mitk_vnl_vector_1, mitk_vnl_vector_2, mitk::eps*1.2), "Vnl vectors are equal for higher epsilon tolerance ( 1.2 * mitk::eps )"); MITK_TEST_CONDITION(mitk::Equal(mitk_vnl_vector_1,mitk_vnl_vector_3), "Test mitk vnl vector equality using different mitk vnl vectors with an element-wise difference less than mitk::eps"); // test vnl_vector equality method typedef mitk::ScalarType VnlValueType; vnl_vector_fixed vnlVector_1; vnlVector_1[3] = 56.98; vnlVector_1[4] = 22.32; vnlVector_1[5] = 1.00; vnlVector_1[6] = 746.09; vnl_vector_fixed vnlVector_2; vnl_vector_fixed vnlVector_3; for (int i=0; i<7; i++) { if (i<3) { vnlVector_1.put(i,itkVector_1[i]); } vnlVector_2[i] = vnlVector_1[i] - mitk::eps * 1.1f; vnlVector_3[i] = vnlVector_1[i] - mitk::eps * 0.9f; } MITK_TEST_CONDITION( (mitk::Equal(vnlVector_1,vnlVector_1)), "vnl_fixed : v_1 == v_1 "); // the v_2 is constructed so that the equality test fails for mitk::eps, the norm of the difference between the vectors is 7 * eps/6.9 MITK_TEST_CONDITION(!(mitk::Equal(vnlVector_1,vnlVector_2)), "vnl_fixed : v_1 != v_2 with mitk::eps "); // increase the epsilon value used for testing equality - should now pass ( 1.2 * mitk::eps > 7 * mitk::eps/6.9 ) MITK_TEST_CONDITION( (mitk::Equal(vnlVector_1,vnlVector_2, mitk::eps*1.2f)) , "vnl_fixed : v_1 == v_2 with eps = 1.2 * mitk::eps "); MITK_TEST_CONDITION( (mitk::Equal(vnlVector_1,vnlVector_3, mitk::eps)), "vnl_fixed : v_1 == v_3 with eps = 0.8 * mitk::eps "); MITK_TEST_CONDITION(!(mitk::Equal(vnlVector_1,vnlVector_3, mitk::eps*0.8f)), "vnl_fixed : v_1 != v_3 with eps = 0.8 * mitk::eps "); // test scalar equality method mitk::ScalarType scalar1 = 0.5689; mitk::ScalarType scalar2 = scalar1 + mitk::eps; mitk::ScalarType scalar3 = scalar1 + mitk::eps*0.95; MITK_TEST_CONDITION(mitk::Equal(scalar1,scalar1), "Test scalar equality using the same scalar with mitk::eps"); MITK_TEST_CONDITION(!mitk::Equal(scalar1,scalar2), "Test scalar equality using the different scalars with a difference greater than mitk::eps"); MITK_TEST_CONDITION(mitk::Equal(scalar1,scalar3), "Test scalar equality using the different scalars with a difference less than mitk::eps"); // test matrix equality methods vnl_matrix_fixed vnlMatrix3x3_1; vnlMatrix3x3_1(0,0) = 1.1; vnlMatrix3x3_1(0,1) = 0.4; vnlMatrix3x3_1(0,2) = 5.3; vnlMatrix3x3_1(1,0) = 2.7; vnlMatrix3x3_1(1,1) = 3578.56418; vnlMatrix3x3_1(1,2) = 123.56; vnlMatrix3x3_1(2,0) = 546.89; vnlMatrix3x3_1(2,1) = 0.0001; vnlMatrix3x3_1(2,2) = 1.0; vnl_matrix_fixed vnlMatrix3x3_2; vnlMatrix3x3_2(0,0) = 1.1000009; vnlMatrix3x3_2(0,1) = 0.4000009; vnlMatrix3x3_2(0,2) = 5.3000009; vnlMatrix3x3_2(1,0) = 2.7000009; vnlMatrix3x3_2(1,1) = 3578.5641809; vnlMatrix3x3_2(1,2) = 123.5600009; vnlMatrix3x3_2(2,0) = 546.8900009; vnlMatrix3x3_2(2,1) = 0.0001009; vnlMatrix3x3_2(2,2) = 1.0000009; mitk::ScalarType epsilon = 0.000001; MITK_TEST_CONDITION(mitk::MatrixEqualElementWise(vnlMatrix3x3_1,vnlMatrix3x3_1,0.0),"Test for matrix equality with given epsilon=0.0 and exactly the same matrix elements"); MITK_TEST_CONDITION(!mitk::MatrixEqualElementWise(vnlMatrix3x3_1,vnlMatrix3x3_2,0.0),"Test for matrix equality with given epsilon=0.0 and slightly different matrix elements"); MITK_TEST_CONDITION(mitk::MatrixEqualElementWise(vnlMatrix3x3_1,vnlMatrix3x3_2,epsilon),"Test for matrix equality with given epsilon and slightly different matrix elements"); MITK_TEST_CONDITION(!mitk::MatrixEqualRMS(vnlMatrix3x3_1,vnlMatrix3x3_2,0.0),"Test for matrix equality with given epsilon=0.0 and slightly different matrix elements"); MITK_TEST_CONDITION(mitk::MatrixEqualRMS(vnlMatrix3x3_1,vnlMatrix3x3_2,epsilon),"Test for matrix equality with given epsilon and slightly different matrix elements"); MITK_TEST_END(); } diff --git a/Core/Code/TestingHelper/CMakeLists.txt b/Core/Code/TestingHelper/CMakeLists.txt new file mode 100644 index 0000000000..0efd4dbda5 --- /dev/null +++ b/Core/Code/TestingHelper/CMakeLists.txt @@ -0,0 +1,7 @@ +mitk_create_module(MitkTestingHelper + DEPENDS Mitk + PACKAGE_DEPENDS VTK>vtkTestingRendering CppUnit + EXPORT_DEFINE MITK_TESTINGHELPER_EXPORT + WARNINGS_AS_ERRORS +) + diff --git a/Core/Code/TestingHelper/files.cmake b/Core/Code/TestingHelper/files.cmake new file mode 100644 index 0000000000..89d9b62a64 --- /dev/null +++ b/Core/Code/TestingHelper/files.cmake @@ -0,0 +1,10 @@ +set(H_FILES + mitkTestCaller.h + mitkTestFixture.h + mitkTestingMacros.h +) + +set(CPP_FILES + mitkRenderingTestHelper.cpp +) + diff --git a/Core/Code/Rendering/mitkRenderingTestHelper.cpp b/Core/Code/TestingHelper/mitkRenderingTestHelper.cpp similarity index 100% rename from Core/Code/Rendering/mitkRenderingTestHelper.cpp rename to Core/Code/TestingHelper/mitkRenderingTestHelper.cpp diff --git a/Core/Code/Rendering/mitkRenderingTestHelper.h b/Core/Code/TestingHelper/mitkRenderingTestHelper.h similarity index 98% rename from Core/Code/Rendering/mitkRenderingTestHelper.h rename to Core/Code/TestingHelper/mitkRenderingTestHelper.h index 22f0a69d50..2fceea9b11 100644 --- a/Core/Code/Rendering/mitkRenderingTestHelper.h +++ b/Core/Code/TestingHelper/mitkRenderingTestHelper.h @@ -1,171 +1,171 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #ifndef mitkRenderingTestHelper_h #define mitkRenderingTestHelper_h #include #include #include #include -#include +#include class vtkRenderWindow; class vtkRenderer; namespace mitk { -class MITK_CORE_EXPORT RenderingTestHelper +class MITK_TESTINGHELPER_EXPORT RenderingTestHelper { public: /** @brief Generate a rendering test helper object including a render window of the size width * height (in pixel). @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(). **/ RenderingTestHelper(int width, int height, int argc, char *argv[]); /** @brief Generate a rendering test helper object including a render window of the size width * height (in pixel).*/ RenderingTestHelper(int width, int height); /** 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 (true). Usefull for debugging. */ void SetAutomaticallyCloseRenderWindow(bool automaticallyCloseRenderWindow); /** @brief This method set the property of the member datastorage @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); protected: /** * @brief Initialize Internal method to initialize the renderwindow and set the datastorage. * @param width Height of renderwindow. * @param height Width of renderwindow. */ void Initialize(int width, int height); /** @brief Prints the opengl information, e.g. version, vendor and extensions, * This function can only be called after an opengl context is active. * It only prints the context after the vtkRenderwindow is fully initialized. **/ void PrintGLInfo(); /** @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). **/ 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/Core/Code/Common/mitkTestCaller.h b/Core/Code/TestingHelper/mitkTestCaller.h similarity index 100% rename from Core/Code/Common/mitkTestCaller.h rename to Core/Code/TestingHelper/mitkTestCaller.h diff --git a/Core/Code/Common/mitkTestFixture.h b/Core/Code/TestingHelper/mitkTestFixture.h similarity index 100% rename from Core/Code/Common/mitkTestFixture.h rename to Core/Code/TestingHelper/mitkTestFixture.h diff --git a/Core/Code/Common/mitkTestingMacros.h b/Core/Code/TestingHelper/mitkTestingMacros.h similarity index 99% rename from Core/Code/Common/mitkTestingMacros.h rename to Core/Code/TestingHelper/mitkTestingMacros.h index 5948b205b7..1a566265b6 100644 --- a/Core/Code/Common/mitkTestingMacros.h +++ b/Core/Code/TestingHelper/mitkTestingMacros.h @@ -1,374 +1,373 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include #include #include #include #include -#include #include #include -#include "cppunit/ui/text/TestRunner.h" +#include 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 (mitk::TestFailedException ex) { \ MITK_TEST_OUTPUT(<< "Further test execution skipped.") \ mitk::TestManager::GetInstance()->TestFailed(); \ } catch (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 > 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 (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. * * @deprecatedSince{2013_09} Use MITK_ASSERT_EQUAL instead. * * @param OBJ1 First object. * @param OBJ2 Second object. * @param MSG Message to appear with the test. */ #define MITK_TEST_EQUAL(OBJ1,OBJ2,MSG) \ MITK_TEST_CONDITION_REQUIRED( mitk::Equal(OBJ1, OBJ2, mitk::eps, true)==true, MSG) /** * @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. */ #define MITK_ASSERT_EQUAL(EXPECTED, ACTUAL, MSG) \ 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) \ MITK_TEST_CONDITION_REQUIRED( mitk::Equal(OBJ1, OBJ2, mitk::eps, true)==false, MSG) /** * @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. * * \sa MITK_ASSERT_EQUAL */ #define MITK_ASSERT_NOT_EQUAL(OBJ1, OBJ2, MSG) \ 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*/[]) \ { \ CppUnit::TextUi::TestRunner runner; \ runner.addTest(TESTSUITE_NAME ## TestSuite::suite()); \ runner.run(); \ return EXIT_SUCCESS; \ } /** * @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 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( \ 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( \ 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 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. * * @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 args; \ args.push_back(arg1); \ args.push_back(arg2); \ MITK_PARAMETERIZED_TEST(TESTMETHOD, args) \ } diff --git a/Core/Code/files.cmake b/Core/Code/files.cmake index 8a676f0f98..c991bfedc4 100644 --- a/Core/Code/files.cmake +++ b/Core/Code/files.cmake @@ -1,415 +1,407 @@ set(H_FILES Algorithms/itkImportMitkImageContainer.h Algorithms/itkImportMitkImageContainer.txx Algorithms/itkLocalVariationImageFilter.h Algorithms/itkLocalVariationImageFilter.txx Algorithms/itkMITKScalarImageToHistogramGenerator.h Algorithms/itkMITKScalarImageToHistogramGenerator.txx Algorithms/itkTotalVariationDenoisingImageFilter.h Algorithms/itkTotalVariationDenoisingImageFilter.txx Algorithms/itkTotalVariationSingleIterationImageFilter.h Algorithms/itkTotalVariationSingleIterationImageFilter.txx Algorithms/mitkBilateralFilter.h Algorithms/mitkBilateralFilter.cpp Algorithms/mitkInstantiateAccessFunctions.h Algorithms/mitkPixelTypeList.h Algorithms/mitkPPArithmeticDec.h Algorithms/mitkPPArgCount.h Algorithms/mitkPPCat.h Algorithms/mitkPPConfig.h Algorithms/mitkPPControlExprIIf.h Algorithms/mitkPPControlIf.h Algorithms/mitkPPControlIIf.h Algorithms/mitkPPDebugError.h Algorithms/mitkPPDetailAutoRec.h Algorithms/mitkPPDetailDMCAutoRec.h Algorithms/mitkPPExpand.h Algorithms/mitkPPFacilitiesEmpty.h Algorithms/mitkPPFacilitiesExpand.h Algorithms/mitkPPLogicalBool.h Algorithms/mitkPPRepetitionDetailDMCFor.h Algorithms/mitkPPRepetitionDetailEDGFor.h Algorithms/mitkPPRepetitionDetailFor.h Algorithms/mitkPPRepetitionDetailMSVCFor.h Algorithms/mitkPPRepetitionFor.h Algorithms/mitkPPSeqElem.h Algorithms/mitkPPSeqForEach.h Algorithms/mitkPPSeqForEachProduct.h Algorithms/mitkPPSeq.h Algorithms/mitkPPSeqEnum.h Algorithms/mitkPPSeqSize.h Algorithms/mitkPPSeqToTuple.h Algorithms/mitkPPStringize.h Algorithms/mitkPPTupleEat.h Algorithms/mitkPPTupleElem.h Algorithms/mitkPPTupleRem.h Algorithms/mitkClippedSurfaceBoundsCalculator.h Algorithms/mitkExtractSliceFilter.h Algorithms/mitkConvert2Dto3DImageFilter.h Algorithms/mitkPlaneClipping.h Common/mitkCommon.h Common/mitkExceptionMacro.h - Common/mitkServiceBaseObject.h - Common/mitkTestCaller.h - Common/mitkTestFixture.h - Common/mitkTesting.h - Common/mitkTestingMacros.h DataManagement/mitkProportionalTimeGeometry.h DataManagement/mitkTimeGeometry.h DataManagement/mitkImageAccessByItk.h DataManagement/mitkImageCast.h DataManagement/mitkImagePixelAccessor.h DataManagement/mitkImagePixelReadAccessor.h DataManagement/mitkImagePixelWriteAccessor.h DataManagement/mitkImageReadAccessor.h DataManagement/mitkImageWriteAccessor.h DataManagement/mitkITKImageImport.h DataManagement/mitkITKImageImport.txx DataManagement/mitkImageToItk.h DataManagement/mitkImageToItk.txx DataManagement/mitkTimeSlicedGeometry.h # Deprecated, empty for compatibilty reasons. Interactions/mitkEventMapperAddOn.h Interfaces/mitkIDataNodeReader.h Rendering/mitkLocalStorageHandler.h IO/mitkPixelTypeTraits.h ) set(CPP_FILES Algorithms/mitkBaseDataSource.cpp Algorithms/mitkCompareImageDataFilter.cpp Algorithms/mitkMultiComponentImageDataComparisonFilter.cpp Algorithms/mitkDataNodeSource.cpp Algorithms/mitkGeometry2DDataToSurfaceFilter.cpp Algorithms/mitkHistogramGenerator.cpp Algorithms/mitkImageChannelSelector.cpp Algorithms/mitkImageSliceSelector.cpp Algorithms/mitkImageSource.cpp Algorithms/mitkImageTimeSelector.cpp Algorithms/mitkImageToImageFilter.cpp Algorithms/mitkImageToSurfaceFilter.cpp Algorithms/mitkPointSetSource.cpp Algorithms/mitkPointSetToPointSetFilter.cpp Algorithms/mitkRGBToRGBACastImageFilter.cpp Algorithms/mitkSubImageSelector.cpp Algorithms/mitkSurfaceSource.cpp Algorithms/mitkSurfaceToImageFilter.cpp Algorithms/mitkSurfaceToSurfaceFilter.cpp Algorithms/mitkUIDGenerator.cpp Algorithms/mitkVolumeCalculator.cpp Algorithms/mitkClippedSurfaceBoundsCalculator.cpp Algorithms/mitkExtractSliceFilter.cpp Algorithms/mitkConvert2Dto3DImageFilter.cpp Controllers/mitkBaseController.cpp Controllers/mitkCallbackFromGUIThread.cpp Controllers/mitkCameraController.cpp Controllers/mitkCameraRotationController.cpp Controllers/mitkCoreActivator.cpp Controllers/mitkFocusManager.cpp Controllers/mitkLimitedLinearUndo.cpp Controllers/mitkOperationEvent.cpp Controllers/mitkPlanePositionManager.cpp Controllers/mitkProgressBar.cpp Controllers/mitkRenderingManager.cpp Controllers/mitkSliceNavigationController.cpp Controllers/mitkSlicesCoordinator.cpp Controllers/mitkSlicesRotator.cpp Controllers/mitkSlicesSwiveller.cpp Controllers/mitkStatusBar.cpp Controllers/mitkStepper.cpp Controllers/mitkTestManager.cpp Controllers/mitkUndoController.cpp Controllers/mitkVerboseLimitedLinearUndo.cpp Controllers/mitkVtkInteractorCameraController.cpp Controllers/mitkVtkLayerController.cpp DataManagement/mitkProportionalTimeGeometry.cpp DataManagement/mitkTimeGeometry.cpp DataManagement/mitkAbstractTransformGeometry.cpp DataManagement/mitkAnnotationProperty.cpp DataManagement/mitkApplicationCursor.cpp DataManagement/mitkBaseData.cpp DataManagement/mitkBaseProperty.cpp DataManagement/mitkClippingProperty.cpp DataManagement/mitkChannelDescriptor.cpp DataManagement/mitkColorProperty.cpp DataManagement/mitkDataStorage.cpp # DataManagement/mitkDataTree.cpp DataManagement/mitkDataNode.cpp DataManagement/mitkDataNodeFactory.cpp # DataManagement/mitkDataTreeStorage.cpp DataManagement/mitkDisplayGeometry.cpp DataManagement/mitkEnumerationProperty.cpp DataManagement/mitkGeometry2D.cpp DataManagement/mitkGeometry2DData.cpp DataManagement/mitkGeometry3D.cpp DataManagement/mitkGeometryData.cpp DataManagement/mitkGroupTagProperty.cpp DataManagement/mitkImage.cpp DataManagement/mitkImageAccessorBase.cpp DataManagement/mitkImageCaster.cpp DataManagement/mitkImageCastPart1.cpp DataManagement/mitkImageCastPart2.cpp DataManagement/mitkImageCastPart3.cpp DataManagement/mitkImageCastPart4.cpp DataManagement/mitkImageDataItem.cpp DataManagement/mitkImageDescriptor.cpp DataManagement/mitkImageVtkAccessor.cpp DataManagement/mitkImageStatisticsHolder.cpp DataManagement/mitkLandmarkBasedCurvedGeometry.cpp DataManagement/mitkLandmarkProjectorBasedCurvedGeometry.cpp DataManagement/mitkLandmarkProjector.cpp DataManagement/mitkLevelWindow.cpp DataManagement/mitkLevelWindowManager.cpp DataManagement/mitkLevelWindowPreset.cpp DataManagement/mitkLevelWindowProperty.cpp DataManagement/mitkLookupTable.cpp DataManagement/mitkLookupTables.cpp # specializations of GenericLookupTable DataManagement/mitkMemoryUtilities.cpp DataManagement/mitkModalityProperty.cpp DataManagement/mitkModeOperation.cpp DataManagement/mitkNodePredicateAnd.cpp DataManagement/mitkNodePredicateBase.cpp DataManagement/mitkNodePredicateCompositeBase.cpp DataManagement/mitkNodePredicateData.cpp DataManagement/mitkNodePredicateDataType.cpp DataManagement/mitkNodePredicateDimension.cpp DataManagement/mitkNodePredicateFirstLevel.cpp DataManagement/mitkNodePredicateNot.cpp DataManagement/mitkNodePredicateOr.cpp DataManagement/mitkNodePredicateProperty.cpp DataManagement/mitkNodePredicateSource.cpp DataManagement/mitkPlaneOrientationProperty.cpp DataManagement/mitkPlaneGeometry.cpp DataManagement/mitkPlaneOperation.cpp DataManagement/mitkPointOperation.cpp DataManagement/mitkPointSet.cpp DataManagement/mitkProperties.cpp DataManagement/mitkPropertyList.cpp DataManagement/mitkPropertyObserver.cpp DataManagement/mitkRestorePlanePositionOperation.cpp DataManagement/mitkApplyTransformMatrixOperation.cpp DataManagement/mitkRotationOperation.cpp DataManagement/mitkSlicedData.cpp DataManagement/mitkSlicedGeometry3D.cpp DataManagement/mitkSmartPointerProperty.cpp DataManagement/mitkStandaloneDataStorage.cpp DataManagement/mitkStateTransitionOperation.cpp DataManagement/mitkStringProperty.cpp DataManagement/mitkSurface.cpp DataManagement/mitkSurfaceOperation.cpp DataManagement/mitkThinPlateSplineCurvedGeometry.cpp DataManagement/mitkTransferFunction.cpp DataManagement/mitkTransferFunctionProperty.cpp DataManagement/mitkTransferFunctionInitializer.cpp DataManagement/mitkVector.cpp DataManagement/mitkVtkInterpolationProperty.cpp DataManagement/mitkVtkRepresentationProperty.cpp DataManagement/mitkVtkResliceInterpolationProperty.cpp DataManagement/mitkVtkScalarModeProperty.cpp DataManagement/mitkVtkVolumeRenderingProperty.cpp DataManagement/mitkWeakPointerProperty.cpp DataManagement/mitkRenderingModeProperty.cpp DataManagement/mitkShaderProperty.cpp DataManagement/mitkResliceMethodProperty.cpp DataManagement/mitkMaterial.cpp DataManagement/mitkPointSetShapeProperty.cpp DataManagement/mitkFloatPropertyExtension.cpp DataManagement/mitkIntPropertyExtension.cpp DataManagement/mitkPropertyExtension.cpp DataManagement/mitkPropertyFilter.cpp DataManagement/mitkPropertyAliases.cpp DataManagement/mitkPropertyDescriptions.cpp DataManagement/mitkPropertyExtensions.cpp DataManagement/mitkPropertyFilters.cpp Interactions/mitkAction.cpp Interactions/mitkAffineInteractor.cpp Interactions/mitkBindDispatcherInteractor.cpp Interactions/mitkCoordinateSupplier.cpp Interactions/mitkDataInteractor.cpp Interactions/mitkDispatcher.cpp Interactions/mitkDisplayCoordinateOperation.cpp Interactions/mitkDisplayInteractor.cpp Interactions/mitkDisplayPositionEvent.cpp # Interactions/mitkDisplayVectorInteractorLevelWindow.cpp # legacy, prob even now unneeded # Interactions/mitkDisplayVectorInteractorScroll.cpp Interactions/mitkEvent.cpp Interactions/mitkEventConfig.cpp Interactions/mitkEventDescription.cpp Interactions/mitkEventFactory.cpp Interactions/mitkInteractionEventHandler.cpp Interactions/mitkEventMapper.cpp Interactions/mitkEventStateMachine.cpp Interactions/mitkGlobalInteraction.cpp Interactions/mitkInteractor.cpp Interactions/mitkInternalEvent.cpp Interactions/mitkInteractionEvent.cpp Interactions/mitkInteractionEventConst.cpp Interactions/mitkInteractionPositionEvent.cpp Interactions/mitkInteractionKeyEvent.cpp Interactions/mitkMousePressEvent.cpp Interactions/mitkMouseMoveEvent.cpp Interactions/mitkMouseReleaseEvent.cpp Interactions/mitkMouseWheelEvent.cpp Interactions/mitkMouseDoubleClickEvent.cpp Interactions/mitkMouseModeSwitcher.cpp Interactions/mitkMouseMovePointSetInteractor.cpp Interactions/mitkMoveBaseDataInteractor.cpp Interactions/mitkNodeDepententPointSetInteractor.cpp Interactions/mitkPointSetDataInteractor.cpp Interactions/mitkPointSetInteractor.cpp Interactions/mitkPositionEvent.cpp Interactions/mitkPositionTracker.cpp Interactions/mitkStateMachineAction.cpp Interactions/mitkStateMachineCondition.cpp Interactions/mitkStateMachineState.cpp Interactions/mitkStateMachineTransition.cpp Interactions/mitkState.cpp Interactions/mitkStateMachineContainer.cpp Interactions/mitkStateEvent.cpp Interactions/mitkStateMachine.cpp Interactions/mitkStateMachineFactory.cpp Interactions/mitkTransition.cpp Interactions/mitkWheelEvent.cpp Interactions/mitkKeyEvent.cpp Interactions/mitkVtkEventAdapter.cpp Interactions/mitkVtkInteractorStyle.cxx Interactions/mitkCrosshairPositionEvent.cpp Interfaces/mitkInteractionEventObserver.cpp Interfaces/mitkIShaderRepository.cpp Interfaces/mitkIPropertyAliases.cpp Interfaces/mitkIPropertyDescriptions.cpp Interfaces/mitkIPropertyExtensions.cpp Interfaces/mitkIPropertyFilters.cpp IO/mitkBaseDataIOFactory.cpp IO/mitkCoreDataNodeReader.cpp IO/mitkDicomSeriesReader.cpp IO/mitkDicomSR_LoadDICOMScalar.cpp IO/mitkDicomSR_LoadDICOMScalar4D.cpp IO/mitkDicomSR_LoadDICOMRGBPixel.cpp IO/mitkDicomSR_LoadDICOMRGBPixel4D.cpp IO/mitkDicomSR_ImageBlockDescriptor.cpp IO/mitkDicomSR_GantryTiltInformation.cpp IO/mitkDicomSR_SliceGroupingResult.cpp IO/mitkFileReader.cpp IO/mitkFileSeriesReader.cpp IO/mitkFileWriter.cpp # IO/mitkIpPicGet.c IO/mitkImageGenerator.cpp IO/mitkImageWriter.cpp IO/mitkImageWriterFactory.cpp IO/mitkItkImageFileIOFactory.cpp IO/mitkItkImageFileReader.cpp IO/mitkItkLoggingAdapter.cpp IO/mitkItkPictureWrite.cpp IO/mitkIOUtil.cpp IO/mitkLookupTableProperty.cpp IO/mitkOperation.cpp # IO/mitkPicFileIOFactory.cpp # IO/mitkPicFileReader.cpp # IO/mitkPicFileWriter.cpp # IO/mitkPicHelper.cpp # IO/mitkPicVolumeTimeSeriesIOFactory.cpp # IO/mitkPicVolumeTimeSeriesReader.cpp IO/mitkPixelType.cpp IO/mitkPointSetIOFactory.cpp IO/mitkPointSetReader.cpp IO/mitkPointSetWriter.cpp IO/mitkPointSetWriterFactory.cpp IO/mitkRawImageFileReader.cpp IO/mitkStandardFileLocations.cpp IO/mitkSTLFileIOFactory.cpp IO/mitkSTLFileReader.cpp IO/mitkSurfaceVtkWriter.cpp IO/mitkSurfaceVtkWriterFactory.cpp IO/mitkVtkLoggingAdapter.cpp IO/mitkVtiFileIOFactory.cpp IO/mitkVtiFileReader.cpp IO/mitkVtkImageIOFactory.cpp IO/mitkVtkImageReader.cpp IO/mitkVtkSurfaceIOFactory.cpp IO/mitkVtkSurfaceReader.cpp IO/vtkPointSetXMLParser.cpp IO/mitkLog.cpp Rendering/mitkBaseRenderer.cpp Rendering/mitkVtkMapper.cpp Rendering/mitkRenderWindowFrame.cpp Rendering/mitkGeometry2DDataMapper2D.cpp Rendering/mitkGeometry2DDataVtkMapper3D.cpp Rendering/mitkGLMapper.cpp Rendering/mitkGradientBackground.cpp Rendering/mitkManufacturerLogo.cpp Rendering/mitkMapper.cpp Rendering/mitkPointSetGLMapper2D.cpp Rendering/mitkPointSetVtkMapper2D.cpp Rendering/mitkPointSetVtkMapper3D.cpp Rendering/mitkPolyDataGLMapper2D.cpp Rendering/mitkSurfaceGLMapper2D.cpp Rendering/mitkSurfaceVtkMapper3D.cpp Rendering/mitkVolumeDataVtkMapper3D.cpp Rendering/mitkVtkPropRenderer.cpp Rendering/mitkVtkWidgetRendering.cpp Rendering/vtkMitkRectangleProp.cpp Rendering/vtkMitkRenderProp.cpp Rendering/mitkVtkEventProvider.cpp Rendering/mitkRenderWindow.cpp Rendering/mitkRenderWindowBase.cpp Rendering/mitkShaderRepository.cpp Rendering/mitkImageVtkMapper2D.cpp Rendering/vtkMitkThickSlicesFilter.cpp Rendering/vtkMitkLevelWindowFilter.cpp Rendering/vtkNeverTranslucentTexture.cpp - Rendering/mitkRenderingTestHelper.cpp Rendering/mitkOverlay.cpp Rendering/mitkVtkOverlay.cpp Rendering/mitkVtkOverlay2D.cpp Rendering/mitkVtkOverlay3D.cpp Rendering/mitkOverlayManager.cpp Rendering/mitkAbstractOverlayLayouter.cpp Rendering/mitkTextOverlay2D.cpp Rendering/mitkTextOverlay3D.cpp Rendering/mitkLabelOverlay3D.cpp Rendering/mitkOverlay2DLayouter.cpp Rendering/mitkScaleLegendOverlay Common/mitkException.cpp Common/mitkCommon.h Common/mitkCoreObjectFactoryBase.cpp Common/mitkCoreObjectFactory.cpp Common/mitkCoreServices.cpp ) -list(APPEND CPP_FILES ${CppMicroServices_SOURCES}) - set(RESOURCE_FILES Interactions/globalConfig.xml Interactions/DisplayInteraction.xml Interactions/DisplayConfig.xml Interactions/DisplayConfigPACS.xml Interactions/DisplayConfigPACSPan.xml Interactions/DisplayConfigPACSScroll.xml Interactions/DisplayConfigPACSZoom.xml Interactions/DisplayConfigPACSLevelWindow.xml Interactions/DisplayConfigMITK.xml Interactions/PointSet.xml Interactions/Legacy/StateMachine.xml Interactions/Legacy/DisplayConfigMITKTools.xml Interactions/PointSetConfig.xml Shaders/mitkShaderLighting.xml mitkLevelWindowPresets.xml ) diff --git a/Examples/BlueBerryExampleLauncher/CMakeLists.txt b/Examples/BlueBerryExampleLauncher/CMakeLists.txt index 751333a12e..eda5d842b2 100644 --- a/Examples/BlueBerryExampleLauncher/CMakeLists.txt +++ b/Examples/BlueBerryExampleLauncher/CMakeLists.txt @@ -1,85 +1,85 @@ project(BlueBerryExampleLauncher) set(_source_files BlueBerryExampleLauncher.cpp BlueBerryExampleLauncherDialog.cpp ) set(_source_moc_h_files BlueBerryExampleLauncherDialog.h ) set(_source_ui_files BlueBerryExampleLauncherDialog.ui ) # this is a workaround for Visual Studio. The relative include paths in the generated # moc files can get very long and can't be resolved by the MSVC compiler. foreach(_moc_src ${_source_moc_h_files}) qt4_wrap_cpp(_source_files ${_moc_src} OPTIONS -f${_moc_src}) endforeach() qt4_wrap_ui(_source_files ${_source_ui_files}) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) #----------------------------------------------------------------------------- # Create provisioning files #----------------------------------------------------------------------------- set(_plugins_for_all_demos org.blueberry.compat ) file(GLOB _demo_configurations Configurations/*.cmake) set(ALL_REQUIRED_PLUGINS ${_plugins_for_all_demos}) foreach(_demo_config_file ${_demo_configurations}) set(REQUIRED_PLUGINS ) set(DESCRIPTION ) include(${_demo_config_file}) get_filename_component(_name ${_demo_config_file} NAME_WE) FunctionCreateProvisioningFile(FILE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}_${_name}.provisioning PLUGINS ${REQUIRED_PLUGINS} ${_plugins_for_all_demos} NO_INSTALL ) if(DESCRIPTION) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/BlueBerryExampleDescription.txt ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${PROJECT_NAME}_${_name}.txt @ONLY) endif() list(APPEND ALL_REQUIRED_PLUGINS ${REQUIRED_PLUGINS}) endforeach() list(REMOVE_DUPLICATES ALL_REQUIRED_PLUGINS) set(ALL_REQUIRED_PLUGIN_TARGETS ) foreach(req_plugin ${ALL_REQUIRED_PLUGINS}) string(REPLACE "." "_" _plugin_target ${req_plugin}) if(TARGET ${_plugin_target}) list(APPEND ALL_REQUIRED_PLUGIN_TARGETS ${_plugin_target}) endif() endforeach() #----------------------------------------------------------------------------- # Create the example launcher #----------------------------------------------------------------------------- FunctionCreateBlueBerryApplication( NAME ${PROJECT_NAME} DESCRIPTION "MITK Application Framework Demo" SOURCES ${_source_files} # PLUGINS ${ALL_REQUIRED_PLUGIN_TARGETS} NO_PROVISIONING NO_INSTALL SHOW_CONSOLE ) -mitk_use_modules(TARGET ${PROJECT_NAME} QT4_MODULES QtGui) +mitk_use_modules(TARGET ${PROJECT_NAME} PACKAGES Qt4>QtGui) add_dependencies(${PROJECT_NAME} ${ALL_REQUIRED_PLUGIN_TARGETS}) # subproject support set_property(TARGET ${PROJECT_NAME} PROPERTY LABELS ${MITK_DEFAULT_SUBPROJECTS}) foreach(subproject ${MITK_DEFAULT_SUBPROJECTS}) add_dependencies(${subproject} ${PROJECT_NAME}) endforeach() diff --git a/Examples/CMakeLists.txt b/Examples/CMakeLists.txt index 91566467e6..4584ba8cba 100644 --- a/Examples/CMakeLists.txt +++ b/Examples/CMakeLists.txt @@ -1,58 +1,61 @@ set(MITK_DEFAULT_SUBPROJECTS MITK-Examples) #----------------------------------------------------------------------------- # Set-up example plugins #----------------------------------------------------------------------------- if(MITK_USE_BLUEBERRY) # Specify which plug-ins belong to this project macro(GetMyTargetLibraries all_target_libraries varname) set(re_ctkplugin_mitk "^org_mitk_example_[a-zA-Z0-9_]+$") set(_tmp_list) list(APPEND _tmp_list ${all_target_libraries}) ctkMacroListFilter(_tmp_list re_ctkplugin_mitk OUTPUT_VARIABLE ${varname}) endmacro() set(MITK_EXAMPLE_PLUGIN_TARGETS ) foreach(mitk_example_plugin ${MITK_EXAMPLE_PLUGINS}) ctkFunctionExtractOptionNameAndValue(${mitk_example_plugin} plugin_name plugin_value) string(REPLACE "." "_" _plugin_target ${plugin_name}) list(APPEND MITK_EXAMPLE_PLUGIN_TARGETS ${_plugin_target}) mark_as_advanced(${${_plugin_target}_option_name}) endforeach() endif() #----------------------------------------------------------------------------- # Add example executables #----------------------------------------------------------------------------- set(MITK_DIR ${PROJECT_BINARY_DIR}) set(MITK_EXPORTS_FILE_INCLUDED 1) set(_example_dirs MbiLog QtFreeRender - QtAppExample Tutorial # Overlays# depends on QmitkExt.. ) # some examples depend on Qt 5 if (MITK_USE_Qt5) list(APPEND _example_dirs QuickRender ) +elseif (MITK_USE_Qt4) + list(APPEND _example_dirs + QtAppExample + ) endif() if(MITK_USE_BLUEBERRY) list(APPEND _example_dirs BlueBerryExampleLauncher ) endif() foreach(_example_dir ${_example_dirs}) add_subdirectory(${_example_dir}) endforeach() diff --git a/Examples/Plugins/org.mitk.example.gui.customviewer.views/CMakeLists.txt b/Examples/Plugins/org.mitk.example.gui.customviewer.views/CMakeLists.txt index d38750bd36..b04afb4fdc 100644 --- a/Examples/Plugins/org.mitk.example.gui.customviewer.views/CMakeLists.txt +++ b/Examples/Plugins/org.mitk.example.gui.customviewer.views/CMakeLists.txt @@ -1,8 +1,8 @@ project(org_mitk_example_gui_customviewer_views) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE org_mitk_example_gui_customviewer_views_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt mitkDicomUI + MODULE_DEPENDS QmitkExt mitkDicomUI NO_INSTALL ) diff --git a/Examples/Plugins/org.mitk.example.gui.imaging/CMakeLists.txt b/Examples/Plugins/org.mitk.example.gui.imaging/CMakeLists.txt index 2fea55d352..e083249913 100644 --- a/Examples/Plugins/org.mitk.example.gui.imaging/CMakeLists.txt +++ b/Examples/Plugins/org.mitk.example.gui.imaging/CMakeLists.txt @@ -1,7 +1,7 @@ project(org_mitk_example_gui_imaging) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE EXAMPLES_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt Segmentation + MODULE_DEPENDS QmitkExt Segmentation ) diff --git a/Examples/Plugins/org.mitk.example.gui.opencv/CMakeLists.txt b/Examples/Plugins/org.mitk.example.gui.opencv/CMakeLists.txt index 451ab71074..70f0111369 100644 --- a/Examples/Plugins/org.mitk.example.gui.opencv/CMakeLists.txt +++ b/Examples/Plugins/org.mitk.example.gui.opencv/CMakeLists.txt @@ -1,9 +1,9 @@ # The project name must correspond to the directory name of your plug-in # and must not contain periods. project(org_mitk_example_gui_opencv) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE EXAMPLESOPENCV_EXPORTS EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES mitkOpenCVVideoSupportUI + MODULE_DEPENDS mitkOpenCVVideoSupportUI ) diff --git a/Examples/Plugins/org.mitk.example.gui.regiongrowing/CMakeLists.txt b/Examples/Plugins/org.mitk.example.gui.regiongrowing/CMakeLists.txt index 7727603c2f..deb19b8040 100644 --- a/Examples/Plugins/org.mitk.example.gui.regiongrowing/CMakeLists.txt +++ b/Examples/Plugins/org.mitk.example.gui.regiongrowing/CMakeLists.txt @@ -1,8 +1,9 @@ project(org_mitk_example_gui_regiongrowing) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE REGIONGROWING_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt + MODULE_DEPENDS QmitkExt + PACKAGE_DEPENDS ITK>ITKRegionGrowing NO_INSTALL ) diff --git a/Examples/Plugins/org.mitk.example.gui.selectionservicemitk.views/CMakeLists.txt b/Examples/Plugins/org.mitk.example.gui.selectionservicemitk.views/CMakeLists.txt index a70fde93f8..41d118eced 100644 --- a/Examples/Plugins/org.mitk.example.gui.selectionservicemitk.views/CMakeLists.txt +++ b/Examples/Plugins/org.mitk.example.gui.selectionservicemitk.views/CMakeLists.txt @@ -1,8 +1,8 @@ project(org_mitk_example_gui_selectionservicemitk_views) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE org_mitk_example_gui_selectionservicemitk_views_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES Qmitk + MODULE_DEPENDS Qmitk NO_INSTALL ) diff --git a/Examples/Tutorial/Step6/CMakeLists.txt b/Examples/Tutorial/Step6/CMakeLists.txt index 09833d2525..4a900ffe92 100644 --- a/Examples/Tutorial/Step6/CMakeLists.txt +++ b/Examples/Tutorial/Step6/CMakeLists.txt @@ -1,3 +1,4 @@ mitk_create_executable(Step6 DEPENDS QmitkExt + PACKAGE_DEPENDS ITK>ITKCurvatureFlow|ITKRegionGrowing ) diff --git a/Examples/Tutorial/Step7/CMakeLists.txt b/Examples/Tutorial/Step7/CMakeLists.txt index be05fd8c9e..cebe0c36ae 100644 --- a/Examples/Tutorial/Step7/CMakeLists.txt +++ b/Examples/Tutorial/Step7/CMakeLists.txt @@ -1,5 +1,6 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../Step6) mitk_create_executable(Step7 DEPENDS QmitkExt + PACKAGE_DEPENDS ITK>ITKCurvatureFlow|ITKRegionGrowing ) diff --git a/Examples/Tutorial/Step8/CMakeLists.txt b/Examples/Tutorial/Step8/CMakeLists.txt index 79c2d2352f..6d140bff09 100644 --- a/Examples/Tutorial/Step8/CMakeLists.txt +++ b/Examples/Tutorial/Step8/CMakeLists.txt @@ -1,8 +1,9 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../Step6 ${CMAKE_CURRENT_SOURCE_DIR}/../Step7 ) mitk_create_executable(Step8 DEPENDS QmitkExt + PACKAGE_DEPENDS ITK>ITKCurvatureFlow|ITKRegionGrowing ) diff --git a/MITKConfig.cmake.in b/MITKConfig.cmake.in index 4683de37c8..ee35cbf3cb 100644 --- a/MITKConfig.cmake.in +++ b/MITKConfig.cmake.in @@ -1,194 +1,195 @@ # Update the CMake module path set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "@MITK_SOURCE_DIR@/CMake") set(CppMicroServices_DIR "@MITK_BINARY_DIR@/Core/CppMicroServices") # Include MITK macros include(MacroParseArguments) include(mitkFunctionCheckMitkCompatibility) include(mitkFunctionOrganizeSources) include(mitkFunctionCreateWindowsBatchScript) include(mitkFunctionInstallProvisioningFiles) include(mitkFunctionInstallAutoLoadModules) include(mitkFunctionGetLibrarySearchPaths) include(mitkFunctionUseModules) include(mitkMacroCreateModuleConf) -include(mitkMacroCreateModule) +include(mitkFunctionCheckModuleDependencies) +include(mitkFunctionCreateModule) include(mitkMacroCreateExecutable) include(mitkMacroCheckModule) include(mitkMacroCreateModuleTests) include(mitkFunctionAddCustomModuleTest) include(mitkMacroUseModule) include(mitkMacroMultiplexPicType) include(mitkMacroInstall) include(mitkMacroInstallHelperApp) include(mitkMacroInstallTargets) include(mitkMacroGenerateToolsLibrary) include(mitkMacroCreateCTKPlugin) include(mitkMacroGetPMDPlatformString) # The MITK version number set(MITK_VERSION_MAJOR "@MITK_VERSION_MAJOR@") set(MITK_VERSION_MINOR "@MITK_VERSION_MINOR@") set(MITK_VERSION_PATCH "@MITK_VERSION_PATCH@") set(MITK_VERSION_STRING "@MITK_VERSION_STRING@") # MITK compiler flags set(MITK_C_FLAGS "@MITK_C_FLAGS@") set(MTTK_C_FLAGS_DEBUG "@MITK_C_FLAGS_DEBUG@") set(MITK_C_FLAGS_RELEASE "@MITK_C_FLAGS_RELEASE@") set(MITK_CXX_FLAGS "@MITK_CXX_FLAGS@") set(MTTK_CXX_FLAGS_DEBUG "@MITK_CXX_FLAGS_DEBUG@") set(MITK_CXX_FLAGS_RELEASE "@MITK_CXX_FLAGS_RELEASE@") set(MITK_EXE_LINKER_FLAGS "@MITK_EXE_LINKER_FLAGS@") set(MITK_SHARED_LINKER_FLAGS "@MITK_SHARED_LINKER_FLAGS@") set(MITK_MODULE_LINKER_FLAGS "@MITK_MODULE_LINKER_FLAGS@") # Internal version numbers, used for approximate compatibility checks # of a MITK development version (non-release). set(MITK_VERSION_PLUGIN_SYSTEM 2) # dropped legacy BlueBerry plug-in CMake support # MITK specific variables set(MITK_SOURCE_DIR "@MITK_SOURCE_DIR@") set(MITK_BINARY_DIR "@MITK_BINARY_DIR@") set(MITK_CMAKE_DIR "@MITK_CMAKE_DIR@") set(UTILITIES_DIR "@UTILITIES_DIR@") set(REGISTER_QFUNCTIONALITY_CPP_IN "@REGISTER_QFUNCTIONALITY_CPP_IN@") set(MITK_MODULES_PACKAGE_DEPENDS_DIR "@MITK_MODULES_PACKAGE_DEPENDS_DIR@") set(MODULES_PACKAGE_DEPENDS_DIRS "@MODULES_PACKAGE_DEPENDS_DIRS@") set(MITK_DOXYGEN_TAGFILE_NAME "@MITK_DOXYGEN_TAGFILE_NAME@") if(MODULES_CONF_DIRS) list(APPEND MODULES_CONF_DIRS "@MODULES_CONF_DIRS@") list(REMOVE_DUPLICATES MODULES_CONF_DIRS) else() set(MODULES_CONF_DIRS "@MODULES_CONF_DIRS@") endif() set(MODULES_CONF_DIRNAME "@MODULES_CONF_DIRNAME@") foreach(_module @MITK_MODULE_NAMES@) set(${_module}_CONFIG_FILE "@MITK_BINARY_DIR@/@MODULES_CONF_DIRNAME@/${_module}Config.cmake") endforeach() # External projects set(ANN_DIR "@ANN_DIR@") set(CppUnit_DIR "@CppUnit_DIR@") set(GLEW_DIR "@GLEW_DIR@") set(tinyxml_DIR "@tinyxml_DIR@") set(ITK_DIR "@ITK_DIR@") set(VTK_DIR "@VTK_DIR@") set(DCMTK_DIR "@DCMTK_DIR@") set(GDCM_DIR "@GDCM_DIR@") set(BOOST_ROOT "@BOOST_ROOT@") set(OpenCV_DIR "@OpenCV_DIR@") set(Poco_DIR "@Poco_DIR@") set(SOFA_DIR "@SOFA_DIR@") set(Qwt_DIR "@Qwt_DIR@") set(Qxt_DIR "@Qxt_DIR@") set(MITK_QMAKE_EXECUTABLE "@QT_QMAKE_EXECUTABLE@") set(MITK_DATA_DIR "@MITK_DATA_DIR@") # External SDK directories set(MITK_PMD_SDK_DIR @MITK_PMD_SDK_DIR@) # MITK use variables set(MITK_USE_QT @MITK_USE_QT@) set(MITK_USE_Qt4 @MITK_USE_Qt4@) set(MITK_USE_Qt5 @MITK_USE_Qt5@) set(MITK_DESIRED_QT_VERSION @DESIRED_QT_VERSION@) set(MITK_USE_BLUEBERRY @MITK_USE_BLUEBERRY@) set(MITK_USE_SYSTEM_Boost @MITK_USE_SYSTEM_Boost@) set(MITK_USE_Boost @MITK_USE_Boost@) set(MITK_USE_Boost_LIBRARIES @MITK_USE_Boost_LIBRARIES@) set(MITK_USE_CTK @MITK_USE_CTK@) set(MITK_USE_DCMTK @MITK_USE_DCMTK@) set(MITK_USE_OpenCV @MITK_USE_OpenCV@) set(MITK_USE_SOFA @MITK_USE_SOFA@) set(MITK_USE_Python @MITK_USE_Python@) if(MITK_USE_Qt4) set(MITK_QT4_MINIMUM_VERSION @MITK_QT4_MINIMUM_VERSION@) find_package(Qt4 ${MITK_QT4_MINIMUM_VERSION} REQUIRED) elseif(MITK_USE_Qt5) set(MITK_QT5_MINIMUM_VERSION @MITK_QT5_MINIMUM_VERSION@) find_package(Qt5Core ${MITK_QT5_MINIMUM_VERSION} REQUIRED) endif() # MITK ToF use variables set(MITK_TOF_PMDCAMCUBE_AVAILABLE @MITK_USE_TOF_PMDCAMCUBE@) if(MITK_TOF_PMDCAMCUBE_AVAILABLE AND NOT ${PROJECT_NAME} STREQUAL "MITK") option(MITK_USE_TOF_PMDCAMCUBE "Enable support for PMD Cam Cube" @MITK_USE_TOF_PMDCAMCUBE@) mark_as_advanced(MITK_USE_TOF_PMDCAMCUBE) endif() set(MITK_TOF_PMDCAMBOARD_AVAILABLE @MITK_USE_TOF_PMDCAMBOARD@) if(MITK_TOF_PMDCAMBOARD_AVAILABLE AND NOT ${PROJECT_NAME} STREQUAL "MITK") option(MITK_USE_TOF_PMDCAMBOARD "Enable support for PMD Cam Board" @MITK_USE_TOF_PMDCAMBOARD@) mark_as_advanced(MITK_USE_TOF_PMDCAMBOARD) endif() set(MITK_TOF_PMDO3_AVAILABLE @MITK_USE_TOF_PMDO3@) if(MITK_TOF_PMDO3_AVAILABLE AND NOT ${PROJECT_NAME} STREQUAL "MITK") option(MITK_USE_TOF_PMDO3 "Enable support for PMD =3" @MITK_USE_TOF_PMDO3@) mark_as_advanced(MITK_USE_TOF_PMDO3) endif() set(MITK_TOF_KINECT_AVAILABLE @MITK_USE_TOF_KINECT@) if(MITK_TOF_KINECT_AVAILABLE AND NOT ${PROJECT_NAME} STREQUAL "MITK") option(MITK_USE_TOF_KINECT "Enable support for Kinect" @MITK_USE_TOF_KINECT@) mark_as_advanced(MITK_USE_TOF_KINECT) endif() set(MITK_TOF_MESASR4000_AVAILABLE @MITK_USE_TOF_MESASR4000@) if(MITK_TOF_MESASR4000_AVAILABLE AND NOT ${PROJECT_NAME} STREQUAL "MITK") option(MITK_USE_TOF_MESASR4000 "Enable support for MESA SR4000" @MITK_USE_TOF_MESASR4000@) mark_as_advanced(MITK_USE_TOF_MESASR4000) endif() if(MITK_USE_IGT) #include(${MITK_DIR}/mitkIGTConfig.cmake) endif() # Install rules for ToF libraries loaded at runtime include(@MITK_BINARY_DIR@/mitkToFHardwareInstallRules.cmake) if(NOT MITK_EXPORTS_FILE_INCLUDED) if(EXISTS "@MITK_EXPORTS_FILE@") set(MITK_EXPORTS_FILE_INCLUDED 1) include("@MITK_EXPORTS_FILE@") endif(EXISTS "@MITK_EXPORTS_FILE@") endif() # BlueBerry support if(MITK_USE_BLUEBERRY) set(BlueBerry_DIR "@MITK_BINARY_DIR@/BlueBerry") # Don't include the BlueBerry exports file, since the targets are # also exported in the MITK exports file set(BB_PLUGIN_EXPORTS_FILE_INCLUDED 1) find_package(BlueBerry) if(NOT BlueBerry_FOUND) message(SEND_ERROR "MITK does not seem to be configured with BlueBerry support. Set MITK_USE_BLUEBERRY to ON in your MITK build configuration.") endif(NOT BlueBerry_FOUND) set(MITK_PLUGIN_USE_FILE @MITK_PLUGIN_USE_FILE@) if(MITK_PLUGIN_USE_FILE) if(EXISTS ${MITK_PLUGIN_USE_FILE}) include(${MITK_PLUGIN_USE_FILE}) endif() endif() set(MITK_PLUGIN_PROVISIONING_FILE "@MITK_EXTAPP_PROVISIONING_FILE@") set(MITK_PROVISIONING_FILES "${BLUEBERRY_PLUGIN_PROVISIONING_FILE}" "${MITK_PLUGIN_PROVISIONING_FILE}") endif(MITK_USE_BLUEBERRY) # Set properties on exported targets @MITK_EXPORTED_TARGET_PROPERTIES@ diff --git a/Modules/DeformableRegistration/CMakeLists.txt b/Modules/DeformableRegistration/CMakeLists.txt index a2557c5cc0..713d889005 100644 --- a/Modules/DeformableRegistration/CMakeLists.txt +++ b/Modules/DeformableRegistration/CMakeLists.txt @@ -1,7 +1,8 @@ MITK_CREATE_MODULE(MitkDeformableRegistration SUBPROJECTS MITK-Registration DEPENDS Mitk MitkRigidRegistration + PACKAGE_DEPENDS ITK>ITKPDEDeformableRegistration EXPORT_DEFINE MITK_DEFORMABLEREGISTRATION_EXPORT ) add_subdirectory(Testing) diff --git a/Modules/DeformableRegistrationUI/CMakeLists.txt b/Modules/DeformableRegistrationUI/CMakeLists.txt index 96b8ee467d..e2be3ee135 100644 --- a/Modules/DeformableRegistrationUI/CMakeLists.txt +++ b/Modules/DeformableRegistrationUI/CMakeLists.txt @@ -1,6 +1,5 @@ MITK_CREATE_MODULE(MitkDeformableRegistrationUI SUBPROJECTS MITK-Registration DEPENDS Qmitk MitkDeformableRegistration - QT4_MODULES QtGui EXPORT_DEFINE MITK_DEFORMABLEREGISTRATION_UI_EXPORT ) diff --git a/Modules/DicomUI/CMakeLists.txt b/Modules/DicomUI/CMakeLists.txt index e8cbcdf183..0c2f24b411 100644 --- a/Modules/DicomUI/CMakeLists.txt +++ b/Modules/DicomUI/CMakeLists.txt @@ -1,8 +1,7 @@ include_directories(${CTK_INCLUDE_DIRS}) MITK_CREATE_MODULE(mitkDicomUI DEPENDS Mitk - PACKAGE_DEPENDS CTK - QT4_MODULES QtGui QtSql + PACKAGE_DEPENDS CTK Qt4>QtGui|QtSql EXPORT_DEFINE MITK_DICOMUI_EXPORT ) diff --git a/Modules/DiffusionImaging/Connectomics/CMakeLists.txt b/Modules/DiffusionImaging/Connectomics/CMakeLists.txt index 4094285b4a..a9d70db50a 100644 --- a/Modules/DiffusionImaging/Connectomics/CMakeLists.txt +++ b/Modules/DiffusionImaging/Connectomics/CMakeLists.txt @@ -1,7 +1,8 @@ MITK_CREATE_MODULE( Connectomics SUBPROJECTS MITK-DTI INCLUDE_DIRS Algorithms IODataStructures Rendering ${CMAKE_CURRENT_BINARY_DIR} DEPENDS DiffusionCore FiberTracking QmitkExt + PACKAGE_DEPENDS VTK>vtkInfovisLayout ) add_subdirectory(Testing) diff --git a/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt b/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt index 3852d30c64..9e54a3939a 100644 --- a/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt +++ b/Modules/DiffusionImaging/DiffusionCore/CMakeLists.txt @@ -1,17 +1,17 @@ find_package(ITK) if(ITK_GDCM_DIR) include(${ITK_GDCM_DIR}/GDCMConfig.cmake) if(GDCM_MAJOR_VERSION EQUAL 2) add_definitions(-DGDCM2) set(ITK_USES_GDCM2 1) endif(GDCM_MAJOR_VERSION EQUAL 2) endif(ITK_GDCM_DIR) MITK_CREATE_MODULE( DiffusionCore SUBPROJECTS MITK-DTI INCLUDE_DIRS Algorithms Algorithms/Reconstruction Algorithms/Registration Algorithms/Reconstruction/MultishellProcessing DicomImport IODataStructures/DiffusionWeightedImages IODataStructures/QBallImages IODataStructures/TensorImages IODataStructures Rendering ${CMAKE_CURRENT_BINARY_DIR} DEPENDS MitkMapperExt PlanarFigure ImageExtraction SceneSerializationBase - PACKAGE_DEPENDS Boost + PACKAGE_DEPENDS VTK>vtkFiltersProgrammable ITK>ITKDistanceMap|ITKRegistrationCommon|ITKLabelVoting Boost ) add_subdirectory(Testing) diff --git a/Modules/DiffusionImaging/FiberTracking/CMakeLists.txt b/Modules/DiffusionImaging/FiberTracking/CMakeLists.txt index 833650d9e1..eade0ebece 100644 --- a/Modules/DiffusionImaging/FiberTracking/CMakeLists.txt +++ b/Modules/DiffusionImaging/FiberTracking/CMakeLists.txt @@ -1,44 +1,46 @@ -MITK_CHECK_MODULE(_missing_deps DiffusionCore MitkGraphAlgorithms) +mitk_check_module_dependencies(MODULES DiffusionCore MitkGraphAlgorithms + MISSING_DEPENDENCIES_VAR _missing_deps) if(NOT _missing_deps) set(lut_url http://mitk.org/download/data/FibertrackingLUT.tar.gz) set(lut_tarball ${CMAKE_CURRENT_BINARY_DIR}/FibertrackingLUT.tar.gz) message("Downloading FiberTracking LUT ${lut_url}...") file(DOWNLOAD ${lut_url} ${lut_tarball} EXPECTED_MD5 38ecb6d4a826c9ebb0f4965eb9aeee44 TIMEOUT 20 STATUS status SHOW_PROGRESS ) list(GET status 0 status_code) list(GET status 1 status_msg) if(NOT status_code EQUAL 0) message(SEND_ERROR "${status_msg} (error code ${status_code})") else() message("done.") endif() file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Resources) message("Unpacking FiberTracking LUT tarball...") execute_process(COMMAND ${CMAKE_COMMAND} -E tar xzf ../FibertrackingLUT.tar.gz WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/Resources RESULT_VARIABLE result ERROR_VARIABLE err_msg) if(result) message(SEND_ERROR "Unpacking FibertrackingLUT.tar.gz failed: ${err_msg}") else() message("done.") endif() endif() MITK_CREATE_MODULE( FiberTracking SUBPROJECTS MITK-DTI INCLUDE_DIRS Algorithms Algorithms/GibbsTracking Algorithms/StochasticTracking IODataStructures IODataStructures/FiberBundleX IODataStructures/PlanarFigureComposite Interactions SignalModels Rendering ${CMAKE_CURRENT_BINARY_DIR} DEPENDS DiffusionCore MitkGraphAlgorithms + PACKAGE_DEPENDS ITK>ITKFFT ) if(MODULE_IS_ENABLED) add_subdirectory(Testing) endif() diff --git a/Modules/GPGPU/CMakeLists.txt b/Modules/GPGPU/CMakeLists.txt index 77bb6396f6..60eb3e3ed7 100644 --- a/Modules/GPGPU/CMakeLists.txt +++ b/Modules/GPGPU/CMakeLists.txt @@ -1,20 +1,19 @@ if(APPLE) message(STATUS "Module GPGPU is not ported to MacOS yet") else(APPLE) set(package_deps) if(UNIX) list(APPEND package_deps X11) endif() MITK_CREATE_MODULE(mitkGPGPU # INCLUDE_DIRS . DEPENDS Mitk - PACKAGE_DEPENDS ${package_deps} GLEW + PACKAGE_DEPENDS ${package_deps} GLEW Qt4>QtGui EXPORT_DEFINE GPGPU_DLL_API - QT4_MODULES QtCore QtGui WARNINGS_AS_ERRORS ) endif(APPLE) diff --git a/Modules/IGT/CMakeLists.txt b/Modules/IGT/CMakeLists.txt index cef332e937..dda2083b9b 100644 --- a/Modules/IGT/CMakeLists.txt +++ b/Modules/IGT/CMakeLists.txt @@ -1,51 +1,50 @@ include(MITKIGTHardware.cmake) if(MITK_USE_MICRON_TRACKER) set(INCLUDE_DIRS_INTERNAL ${INCLUDE_DIRS_INTERNAL} ${MITK_MICRON_TRACKER_INCLUDE_DIR}) set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${MITK_MICRON_TRACKER_LIB}) endif(MITK_USE_MICRON_TRACKER) if(MITK_USE_MICROBIRD_TRACKER) set(INCLUDE_DIRS_INTERNAL ${INCLUDE_DIRS_INTERNAL} ${MITK_USE_MICROBIRD_TRACKER_INCLUDE_DIR}) set(ADDITIONAL_LIBS ${ADDITIONAL_LIBS} ${MITK_USE_MICROBIRD_TRACKER_LIB}) endif(MITK_USE_MICROBIRD_TRACKER) MITK_CREATE_MODULE(MitkIGT SUBPROJECTS MITK-IGT INCLUDE_DIRS Algorithms Common DataManagement ExceptionHandling IO Rendering TrackingDevices INTERNAL_INCLUDE_DIRS ${INCLUDE_DIRS_INTERNAL} DEPENDS Mitk ImageStatistics SceneSerialization MitkIGTBase - PACKAGE_DEPENDS tinyxml + PACKAGE_DEPENDS ITK>ITKRegistrationCommon tinyxml ADDITIONAL_LIBS "${ADDITIONAL_LIBS}" WARNINGS_AS_ERRORS ) if(MitkIGT_IS_ENABLED) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Modules/IGT/Resources/ClaronMicron.stl ) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Modules/IGT/Resources/IntuitiveDaVinci.stl ) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Modules/IGT/Resources/NDIAurora.stl ) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Modules/IGT/Resources/NDIAurora_Dome.stl ) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Modules/IGT/Resources/NDIAuroraCompactFG_Dome.stl ) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Modules/IGT/Resources/NDIAuroraPlanarFG_Dome.stl ) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Modules/IGT/Resources/NDIAuroraTabletopFG_Dome.stl ) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Modules/IGT/Resources/NDIAuroraTabletopFG_Prototype_Dome.stl ) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Modules/IGT/Resources/NDIPolarisOldModel.stl ) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Modules/IGT/Resources/NDIPolarisSpectra.stl ) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Modules/IGT/Resources/NDIPolarisSpectraExtendedPyramid.stl ) MITK_INSTALL(FILES ${MITK_SOURCE_DIR}/Modules/IGT/Resources/NDIPolarisVicra.stl ) endif() -MITK_CHECK_MODULE(_RESULT MitkIGT) -if(_RESULT) +if(NOT MODULE_IS_ENABLED) message(STATUS "IGTTutorialStep1 won't be built. Missing: ${_RESULT}") -else(_RESULT) +else() ## create IGT config configure_file(mitkIGTConfig.h.in ${PROJECT_BINARY_DIR}/mitkIGTConfig.h @ONLY) # add test programm for serial communication classADD_EXECUTABLE(SerialCommunicationTest IGTTrackingDevices/mitkSerialCommunicationTest.cpp)target_link_libraries(SerialCommunicationTest mitkIGT Mitk tinyxml PocoXML) add_subdirectory(Tutorial) add_subdirectory(Testing) -endif(_RESULT) +endif() diff --git a/Modules/IGTUI/CMakeLists.txt b/Modules/IGTUI/CMakeLists.txt index 8403a57dab..546833f782 100644 --- a/Modules/IGTUI/CMakeLists.txt +++ b/Modules/IGTUI/CMakeLists.txt @@ -1,12 +1,11 @@ MITK_CREATE_MODULE(MitkIGTUI SUBPROJECTS MITK-IGT INCLUDE_DIRS Qmitk DEPENDS MitkIGT Qmitk QmitkExt - QT4_MODULES QtGui GENERATED_CPP ${TOOL_GUI_CPPS} ${TOOL_CPPS} ) ## create IGTUI config configure_file(mitkIGTUIConfig.h.in ${PROJECT_BINARY_DIR}/mitkIGTUIConfig.h @ONLY) diff --git a/Modules/ImageStatistics/CMakeLists.txt b/Modules/ImageStatistics/CMakeLists.txt index bbc12f2033..92681cdbb9 100644 --- a/Modules/ImageStatistics/CMakeLists.txt +++ b/Modules/ImageStatistics/CMakeLists.txt @@ -1,10 +1,11 @@ MITK_CREATE_MODULE( ImageStatistics - DEPENDS Mitk ImageExtraction PlanarFigure + DEPENDS ImageExtraction PlanarFigure + PACKAGE_DEPENDS ITK>ITKVTK WARNINGS_AS_ERRORS ) if(BUILD_TESTING) add_subdirectory(Testing) endif(BUILD_TESTING) diff --git a/Modules/ImageStatistics/files.cmake b/Modules/ImageStatistics/files.cmake index b28f38e6ea..7b16237156 100644 --- a/Modules/ImageStatistics/files.cmake +++ b/Modules/ImageStatistics/files.cmake @@ -1,13 +1,6 @@ set(CPP_FILES mitkImageStatisticsCalculator.cpp mitkPointSetStatisticsCalculator.cpp mitkPointSetDifferenceStatisticsCalculator.cpp ) -if( ${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION} VERSION_LESS 5.8 ) - message(STATUS "Using VTK 5.8 classes from MITK respository") - set(CPP_FILES ${CPP_FILES} - vtkImageStencilRaster.cxx - vtkLassoStencilSource.cxx - ) -endif( ${VTK_MAJOR_VERSION}.${VTK_MINOR_VERSION} VERSION_LESS 5.8 ) diff --git a/Modules/ImageStatistics/mitkImageStatisticsCalculator.cpp b/Modules/ImageStatistics/mitkImageStatisticsCalculator.cpp index 3f1dc4ca68..272bb44c98 100644 --- a/Modules/ImageStatistics/mitkImageStatisticsCalculator.cpp +++ b/Modules/ImageStatistics/mitkImageStatisticsCalculator.cpp @@ -1,1226 +1,1219 @@ /*=================================================================== The Medical Imaging Interaction Toolkit (MITK) Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See LICENSE.txt or http://www.mitk.org for details. ===================================================================*/ #include "mitkImageStatisticsCalculator.h" #include "mitkImageAccessByItk.h" #include "mitkImageCast.h" #include "mitkExtractImageFilter.h" #include #include #include #include #include #include #include +#include +#include + #include #include #include #include #include #include #include #include #include #include #include #include #include - -#include -#include +#include +#include #include -#if ( ( VTK_MAJOR_VERSION <= 5 ) && ( VTK_MINOR_VERSION<=8) ) - #include "mitkvtkLassoStencilSource.h" -#else - #include "vtkLassoStencilSource.h" -#endif - - -#include - #include namespace mitk { ImageStatisticsCalculator::ImageStatisticsCalculator() : m_MaskingMode( MASKING_MODE_NONE ), m_MaskingModeChanged( false ), m_IgnorePixelValue(0.0), m_DoIgnorePixelValue(false), m_IgnorePixelValueChanged(false), m_PlanarFigureAxis (0), m_PlanarFigureSlice (0), m_PlanarFigureCoordinate0 (0), m_PlanarFigureCoordinate1 (0) { m_EmptyHistogram = HistogramType::New(); m_EmptyHistogram->SetMeasurementVectorSize(1); HistogramType::SizeType histogramSize(1); histogramSize.Fill( 256 ); m_EmptyHistogram->Initialize( histogramSize ); m_EmptyStatistics.Reset(); } ImageStatisticsCalculator::~ImageStatisticsCalculator() { } void ImageStatisticsCalculator::SetImage( const mitk::Image *image ) { if ( m_Image != image ) { m_Image = image; this->Modified(); unsigned int numberOfTimeSteps = image->GetTimeSteps(); // Initialize vectors to time-size of this image m_ImageHistogramVector.resize( numberOfTimeSteps ); m_MaskedImageHistogramVector.resize( numberOfTimeSteps ); m_PlanarFigureHistogramVector.resize( numberOfTimeSteps ); m_ImageStatisticsVector.resize( numberOfTimeSteps ); m_MaskedImageStatisticsVector.resize( numberOfTimeSteps ); m_PlanarFigureStatisticsVector.resize( numberOfTimeSteps ); m_ImageStatisticsTimeStampVector.resize( numberOfTimeSteps ); m_MaskedImageStatisticsTimeStampVector.resize( numberOfTimeSteps ); m_PlanarFigureStatisticsTimeStampVector.resize( numberOfTimeSteps ); m_ImageStatisticsCalculationTriggerVector.resize( numberOfTimeSteps ); m_MaskedImageStatisticsCalculationTriggerVector.resize( numberOfTimeSteps ); m_PlanarFigureStatisticsCalculationTriggerVector.resize( numberOfTimeSteps ); for ( unsigned int t = 0; t < image->GetTimeSteps(); ++t ) { m_ImageStatisticsTimeStampVector[t].Modified(); m_ImageStatisticsCalculationTriggerVector[t] = true; } } } void ImageStatisticsCalculator::SetImageMask( const mitk::Image *imageMask ) { if ( m_Image.IsNull() ) { itkExceptionMacro( << "Image needs to be set first!" ); } if ( m_Image->GetTimeSteps() != imageMask->GetTimeSteps() ) { itkExceptionMacro( << "Image and image mask need to have equal number of time steps!" ); } if ( m_ImageMask != imageMask ) { m_ImageMask = imageMask; this->Modified(); for ( unsigned int t = 0; t < m_Image->GetTimeSteps(); ++t ) { m_MaskedImageStatisticsTimeStampVector[t].Modified(); m_MaskedImageStatisticsCalculationTriggerVector[t] = true; } } } void ImageStatisticsCalculator::SetPlanarFigure( mitk::PlanarFigure *planarFigure ) { if ( m_Image.IsNull() ) { itkExceptionMacro( << "Image needs to be set first!" ); } if ( m_PlanarFigure != planarFigure ) { m_PlanarFigure = planarFigure; this->Modified(); for ( unsigned int t = 0; t < m_Image->GetTimeSteps(); ++t ) { m_PlanarFigureStatisticsTimeStampVector[t].Modified(); m_PlanarFigureStatisticsCalculationTriggerVector[t] = true; } } } void ImageStatisticsCalculator::SetMaskingMode( unsigned int mode ) { if ( m_MaskingMode != mode ) { m_MaskingMode = mode; m_MaskingModeChanged = true; this->Modified(); } } void ImageStatisticsCalculator::SetMaskingModeToNone() { if ( m_MaskingMode != MASKING_MODE_NONE ) { m_MaskingMode = MASKING_MODE_NONE; m_MaskingModeChanged = true; this->Modified(); } } void ImageStatisticsCalculator::SetMaskingModeToImage() { if ( m_MaskingMode != MASKING_MODE_IMAGE ) { m_MaskingMode = MASKING_MODE_IMAGE; m_MaskingModeChanged = true; this->Modified(); } } void ImageStatisticsCalculator::SetMaskingModeToPlanarFigure() { if ( m_MaskingMode != MASKING_MODE_PLANARFIGURE ) { m_MaskingMode = MASKING_MODE_PLANARFIGURE; m_MaskingModeChanged = true; this->Modified(); } } void ImageStatisticsCalculator::SetIgnorePixelValue(double value) { if ( m_IgnorePixelValue != value ) { m_IgnorePixelValue = value; if(m_DoIgnorePixelValue) { m_IgnorePixelValueChanged = true; } this->Modified(); } } double ImageStatisticsCalculator::GetIgnorePixelValue() { return m_IgnorePixelValue; } void ImageStatisticsCalculator::SetDoIgnorePixelValue(bool value) { if ( m_DoIgnorePixelValue != value ) { m_DoIgnorePixelValue = value; m_IgnorePixelValueChanged = true; this->Modified(); } } bool ImageStatisticsCalculator::GetDoIgnorePixelValue() { return m_DoIgnorePixelValue; } bool ImageStatisticsCalculator::ComputeStatistics( unsigned int timeStep ) { if (m_Image.IsNull() ) { mitkThrow() << "Image not set!"; } if (!m_Image->IsInitialized()) { mitkThrow() << "Image not initialized!"; } if ( m_Image->GetReferenceCount() == 1 ) { // Image no longer valid; we are the only ones to still hold a reference on it return false; } if ( timeStep >= m_Image->GetTimeSteps() ) { throw std::runtime_error( "Error: invalid time step!" ); } // If a mask was set but we are the only ones to still hold a reference on // it, delete it. if ( m_ImageMask.IsNotNull() && (m_ImageMask->GetReferenceCount() == 1) ) { m_ImageMask = NULL; } // Check if statistics is already up-to-date unsigned long imageMTime = m_ImageStatisticsTimeStampVector[timeStep].GetMTime(); unsigned long maskedImageMTime = m_MaskedImageStatisticsTimeStampVector[timeStep].GetMTime(); unsigned long planarFigureMTime = m_PlanarFigureStatisticsTimeStampVector[timeStep].GetMTime(); bool imageStatisticsCalculationTrigger = m_ImageStatisticsCalculationTriggerVector[timeStep]; bool maskedImageStatisticsCalculationTrigger = m_MaskedImageStatisticsCalculationTriggerVector[timeStep]; bool planarFigureStatisticsCalculationTrigger = m_PlanarFigureStatisticsCalculationTriggerVector[timeStep]; if ( !m_IgnorePixelValueChanged && ((m_MaskingMode != MASKING_MODE_NONE) || (imageMTime > m_Image->GetMTime() && !imageStatisticsCalculationTrigger)) && ((m_MaskingMode != MASKING_MODE_IMAGE) || (maskedImageMTime > m_ImageMask->GetMTime() && !maskedImageStatisticsCalculationTrigger)) && ((m_MaskingMode != MASKING_MODE_PLANARFIGURE) || (planarFigureMTime > m_PlanarFigure->GetMTime() && !planarFigureStatisticsCalculationTrigger)) ) { // Statistics is up to date! if ( m_MaskingModeChanged ) { m_MaskingModeChanged = false; return true; } else { return false; } } // Reset state changed flag m_MaskingModeChanged = false; m_IgnorePixelValueChanged = false; // Depending on masking mode, extract and/or generate the required image // and mask data from the user input this->ExtractImageAndMask( timeStep ); StatisticsContainer *statisticsContainer; HistogramContainer *histogramContainer; switch ( m_MaskingMode ) { case MASKING_MODE_NONE: default: if(!m_DoIgnorePixelValue) { statisticsContainer = &m_ImageStatisticsVector[timeStep]; histogramContainer = &m_ImageHistogramVector[timeStep]; m_ImageStatisticsTimeStampVector[timeStep].Modified(); m_ImageStatisticsCalculationTriggerVector[timeStep] = false; } else { statisticsContainer = &m_MaskedImageStatisticsVector[timeStep]; histogramContainer = &m_MaskedImageHistogramVector[timeStep]; m_MaskedImageStatisticsTimeStampVector[timeStep].Modified(); m_MaskedImageStatisticsCalculationTriggerVector[timeStep] = false; } break; case MASKING_MODE_IMAGE: statisticsContainer = &m_MaskedImageStatisticsVector[timeStep]; histogramContainer = &m_MaskedImageHistogramVector[timeStep]; m_MaskedImageStatisticsTimeStampVector[timeStep].Modified(); m_MaskedImageStatisticsCalculationTriggerVector[timeStep] = false; break; case MASKING_MODE_PLANARFIGURE: statisticsContainer = &m_PlanarFigureStatisticsVector[timeStep]; histogramContainer = &m_PlanarFigureHistogramVector[timeStep]; m_PlanarFigureStatisticsTimeStampVector[timeStep].Modified(); m_PlanarFigureStatisticsCalculationTriggerVector[timeStep] = false; break; } // Calculate statistics and histogram(s) if ( m_InternalImage->GetDimension() == 3 ) { if ( m_MaskingMode == MASKING_MODE_NONE && !m_DoIgnorePixelValue ) { AccessFixedDimensionByItk_2( m_InternalImage, InternalCalculateStatisticsUnmasked, 3, statisticsContainer, histogramContainer ); } else { AccessFixedDimensionByItk_3( m_InternalImage, InternalCalculateStatisticsMasked, 3, m_InternalImageMask3D.GetPointer(), statisticsContainer, histogramContainer ); } } else if ( m_InternalImage->GetDimension() == 2 ) { if ( m_MaskingMode == MASKING_MODE_NONE && !m_DoIgnorePixelValue ) { AccessFixedDimensionByItk_2( m_InternalImage, InternalCalculateStatisticsUnmasked, 2, statisticsContainer, histogramContainer ); } else { AccessFixedDimensionByItk_3( m_InternalImage, InternalCalculateStatisticsMasked, 2, m_InternalImageMask2D.GetPointer(), statisticsContainer, histogramContainer ); } } else { MITK_ERROR << "ImageStatistics: Image dimension not supported!"; } // Release unused image smart pointers to free memory m_InternalImage = mitk::Image::ConstPointer(); m_InternalImageMask3D = MaskImage3DType::Pointer(); m_InternalImageMask2D = MaskImage2DType::Pointer(); return true; } const ImageStatisticsCalculator::HistogramType * ImageStatisticsCalculator::GetHistogram( unsigned int timeStep, unsigned int label ) const { if ( m_Image.IsNull() || (timeStep >= m_Image->GetTimeSteps()) ) { return NULL; } switch ( m_MaskingMode ) { case MASKING_MODE_NONE: default: { if(m_DoIgnorePixelValue) return m_MaskedImageHistogramVector[timeStep][label]; return m_ImageHistogramVector[timeStep][label]; } case MASKING_MODE_IMAGE: return m_MaskedImageHistogramVector[timeStep][label]; case MASKING_MODE_PLANARFIGURE: return m_PlanarFigureHistogramVector[timeStep][label]; } } const ImageStatisticsCalculator::HistogramContainer & ImageStatisticsCalculator::GetHistogramVector( unsigned int timeStep ) const { if ( m_Image.IsNull() || (timeStep >= m_Image->GetTimeSteps()) ) { return m_EmptyHistogramContainer; } switch ( m_MaskingMode ) { case MASKING_MODE_NONE: default: { if(m_DoIgnorePixelValue) return m_MaskedImageHistogramVector[timeStep]; return m_ImageHistogramVector[timeStep]; } case MASKING_MODE_IMAGE: return m_MaskedImageHistogramVector[timeStep]; case MASKING_MODE_PLANARFIGURE: return m_PlanarFigureHistogramVector[timeStep]; } } const ImageStatisticsCalculator::Statistics & ImageStatisticsCalculator::GetStatistics( unsigned int timeStep, unsigned int label ) const { if ( m_Image.IsNull() || (timeStep >= m_Image->GetTimeSteps()) ) { return m_EmptyStatistics; } switch ( m_MaskingMode ) { case MASKING_MODE_NONE: default: { if(m_DoIgnorePixelValue) return m_MaskedImageStatisticsVector[timeStep][label]; return m_ImageStatisticsVector[timeStep][label]; } case MASKING_MODE_IMAGE: return m_MaskedImageStatisticsVector[timeStep][label]; case MASKING_MODE_PLANARFIGURE: return m_PlanarFigureStatisticsVector[timeStep][label]; } } const ImageStatisticsCalculator::StatisticsContainer & ImageStatisticsCalculator::GetStatisticsVector( unsigned int timeStep ) const { if ( m_Image.IsNull() || (timeStep >= m_Image->GetTimeSteps()) ) { return m_EmptyStatisticsContainer; } switch ( m_MaskingMode ) { case MASKING_MODE_NONE: default: { if(m_DoIgnorePixelValue) return m_MaskedImageStatisticsVector[timeStep]; return m_ImageStatisticsVector[timeStep]; } case MASKING_MODE_IMAGE: return m_MaskedImageStatisticsVector[timeStep]; case MASKING_MODE_PLANARFIGURE: return m_PlanarFigureStatisticsVector[timeStep]; } } void ImageStatisticsCalculator::ExtractImageAndMask( unsigned int timeStep ) { if ( m_Image.IsNull() ) { throw std::runtime_error( "Error: image empty!" ); } if ( timeStep >= m_Image->GetTimeSteps() ) { throw std::runtime_error( "Error: invalid time step!" ); } ImageTimeSelector::Pointer imageTimeSelector = ImageTimeSelector::New(); imageTimeSelector->SetInput( m_Image ); imageTimeSelector->SetTimeNr( timeStep ); imageTimeSelector->UpdateLargestPossibleRegion(); mitk::Image *timeSliceImage = imageTimeSelector->GetOutput(); switch ( m_MaskingMode ) { case MASKING_MODE_NONE: { m_InternalImage = timeSliceImage; m_InternalImageMask2D = NULL; m_InternalImageMask3D = NULL; if(m_DoIgnorePixelValue) { if( m_InternalImage->GetDimension() == 3 ) { CastToItkImage( timeSliceImage, m_InternalImageMask3D ); m_InternalImageMask3D->FillBuffer(1); } if( m_InternalImage->GetDimension() == 2 ) { CastToItkImage( timeSliceImage, m_InternalImageMask2D ); m_InternalImageMask2D->FillBuffer(1); } } break; } case MASKING_MODE_IMAGE: { if ( m_ImageMask.IsNotNull() && (m_ImageMask->GetReferenceCount() > 1) ) { if ( timeStep < m_ImageMask->GetTimeSteps() ) { ImageTimeSelector::Pointer maskedImageTimeSelector = ImageTimeSelector::New(); maskedImageTimeSelector->SetInput( m_ImageMask ); maskedImageTimeSelector->SetTimeNr( timeStep ); maskedImageTimeSelector->UpdateLargestPossibleRegion(); mitk::Image *timeSliceMaskedImage = maskedImageTimeSelector->GetOutput(); m_InternalImage = timeSliceImage; CastToItkImage( timeSliceMaskedImage, m_InternalImageMask3D ); } else { throw std::runtime_error( "Error: image mask has not enough time steps!" ); } } else { throw std::runtime_error( "Error: image mask empty!" ); } break; } case MASKING_MODE_PLANARFIGURE: { m_InternalImageMask2D = NULL; if ( m_PlanarFigure.IsNull() ) { throw std::runtime_error( "Error: planar figure empty!" ); } if ( !m_PlanarFigure->IsClosed() ) { throw std::runtime_error( "Masking not possible for non-closed figures" ); } const Geometry3D *imageGeometry = timeSliceImage->GetGeometry(); if ( imageGeometry == NULL ) { throw std::runtime_error( "Image geometry invalid!" ); } const Geometry2D *planarFigureGeometry2D = m_PlanarFigure->GetGeometry2D(); if ( planarFigureGeometry2D == NULL ) { throw std::runtime_error( "Planar-Figure not yet initialized!" ); } const PlaneGeometry *planarFigureGeometry = dynamic_cast< const PlaneGeometry * >( planarFigureGeometry2D ); if ( planarFigureGeometry == NULL ) { throw std::runtime_error( "Non-planar planar figures not supported!" ); } // Find principal direction of PlanarFigure in input image unsigned int axis; if ( !this->GetPrincipalAxis( imageGeometry, planarFigureGeometry->GetNormal(), axis ) ) { throw std::runtime_error( "Non-aligned planar figures not supported!" ); } m_PlanarFigureAxis = axis; // Find slice number corresponding to PlanarFigure in input image MaskImage3DType::IndexType index; imageGeometry->WorldToIndex( planarFigureGeometry->GetOrigin(), index ); unsigned int slice = index[axis]; m_PlanarFigureSlice = slice; // Extract slice with given position and direction from image unsigned int dimension = timeSliceImage->GetDimension(); if (dimension != 2) { ExtractImageFilter::Pointer imageExtractor = ExtractImageFilter::New(); imageExtractor->SetInput( timeSliceImage ); imageExtractor->SetSliceDimension( axis ); imageExtractor->SetSliceIndex( slice ); imageExtractor->Update(); m_InternalImage = imageExtractor->GetOutput(); } else { m_InternalImage = timeSliceImage; } // Compute mask from PlanarFigure AccessFixedDimensionByItk_1( m_InternalImage, InternalCalculateMaskFromPlanarFigure, 2, axis ); } } if(m_DoIgnorePixelValue) { if ( m_InternalImage->GetDimension() == 3 ) { AccessFixedDimensionByItk_1( m_InternalImage, InternalMaskIgnoredPixels, 3, m_InternalImageMask3D.GetPointer() ); } else if ( m_InternalImage->GetDimension() == 2 ) { AccessFixedDimensionByItk_1( m_InternalImage, InternalMaskIgnoredPixels, 2, m_InternalImageMask2D.GetPointer() ); } } } bool ImageStatisticsCalculator::GetPrincipalAxis( const Geometry3D *geometry, Vector3D vector, unsigned int &axis ) { vector.Normalize(); for ( unsigned int i = 0; i < 3; ++i ) { Vector3D axisVector = geometry->GetAxisVector( i ); axisVector.Normalize(); if ( fabs( fabs( axisVector * vector ) - 1.0) < mitk::eps ) { axis = i; return true; } } return false; } template < typename TPixel, unsigned int VImageDimension > void ImageStatisticsCalculator::InternalCalculateStatisticsUnmasked( const itk::Image< TPixel, VImageDimension > *image, StatisticsContainer *statisticsContainer, HistogramContainer* histogramContainer ) { typedef itk::Image< TPixel, VImageDimension > ImageType; typedef itk::Image< unsigned short, VImageDimension > MaskImageType; typedef typename ImageType::IndexType IndexType; typedef itk::Statistics::ScalarImageToHistogramGenerator< ImageType > HistogramGeneratorType; statisticsContainer->clear(); histogramContainer->clear(); // Progress listening... typedef itk::SimpleMemberCommand< ImageStatisticsCalculator > ITKCommandType; ITKCommandType::Pointer progressListener; progressListener = ITKCommandType::New(); progressListener->SetCallbackFunction( this, &ImageStatisticsCalculator::UnmaskedStatisticsProgressUpdate ); // Issue 100 artificial progress events since ScalarIMageToHistogramGenerator // does not (yet?) support progress reporting this->InvokeEvent( itk::StartEvent() ); for ( unsigned int i = 0; i < 100; ++i ) { this->UnmaskedStatisticsProgressUpdate(); } // Calculate statistics (separate filter) typedef itk::StatisticsImageFilter< ImageType > StatisticsFilterType; typename StatisticsFilterType::Pointer statisticsFilter = StatisticsFilterType::New(); statisticsFilter->SetInput( image ); unsigned long observerTag = statisticsFilter->AddObserver( itk::ProgressEvent(), progressListener ); statisticsFilter->Update(); statisticsFilter->RemoveObserver( observerTag ); this->InvokeEvent( itk::EndEvent() ); // Calculate minimum and maximum typedef itk::MinimumMaximumImageCalculator< ImageType > MinMaxFilterType; typename MinMaxFilterType::Pointer minMaxFilter = MinMaxFilterType::New(); minMaxFilter->SetImage( image ); unsigned long observerTag2 = minMaxFilter->AddObserver( itk::ProgressEvent(), progressListener ); minMaxFilter->Compute(); minMaxFilter->RemoveObserver( observerTag2 ); this->InvokeEvent( itk::EndEvent() ); Statistics statistics; statistics.Reset(); statistics.Label = 1; statistics.N = image->GetBufferedRegion().GetNumberOfPixels(); statistics.Min = statisticsFilter->GetMinimum(); statistics.Max = statisticsFilter->GetMaximum(); statistics.Mean = statisticsFilter->GetMean(); statistics.Median = 0.0; statistics.Sigma = statisticsFilter->GetSigma(); statistics.RMS = sqrt( statistics.Mean * statistics.Mean + statistics.Sigma * statistics.Sigma ); statistics.MinIndex.set_size(image->GetImageDimension()); statistics.MaxIndex.set_size(image->GetImageDimension()); for (unsigned int i=0; iGetIndexOfMaximum()[i]; statistics.MinIndex[i] = minMaxFilter->GetIndexOfMinimum()[i]; } statisticsContainer->push_back( statistics ); // Calculate histogram typename HistogramGeneratorType::Pointer histogramGenerator = HistogramGeneratorType::New(); histogramGenerator->SetInput( image ); histogramGenerator->SetMarginalScale( 100 ); histogramGenerator->SetNumberOfBins( 768 ); histogramGenerator->SetHistogramMin( statistics.Min ); histogramGenerator->SetHistogramMax( statistics.Max ); histogramGenerator->Compute(); histogramContainer->push_back( histogramGenerator->GetOutput() ); } template < typename TPixel, unsigned int VImageDimension > void ImageStatisticsCalculator::InternalMaskIgnoredPixels( const itk::Image< TPixel, VImageDimension > *image, itk::Image< unsigned short, VImageDimension > *maskImage ) { typedef itk::Image< TPixel, VImageDimension > ImageType; typedef itk::Image< unsigned short, VImageDimension > MaskImageType; itk::ImageRegionIterator itmask(maskImage, maskImage->GetLargestPossibleRegion()); itk::ImageRegionConstIterator itimage(image, image->GetLargestPossibleRegion()); itmask.GoToBegin(); itimage.GoToBegin(); while( !itmask.IsAtEnd() ) { if(m_IgnorePixelValue == itimage.Get()) { itmask.Set(0); } ++itmask; ++itimage; } } template < typename TPixel, unsigned int VImageDimension > void ImageStatisticsCalculator::InternalCalculateStatisticsMasked( const itk::Image< TPixel, VImageDimension > *image, itk::Image< unsigned short, VImageDimension > *maskImage, StatisticsContainer* statisticsContainer, HistogramContainer* histogramContainer ) { typedef itk::Image< TPixel, VImageDimension > ImageType; typedef itk::Image< unsigned short, VImageDimension > MaskImageType; typedef typename ImageType::IndexType IndexType; typedef typename ImageType::PointType PointType; typedef typename ImageType::SpacingType SpacingType; typedef itk::LabelStatisticsImageFilter< ImageType, MaskImageType > LabelStatisticsFilterType; typedef itk::ChangeInformationImageFilter< MaskImageType > ChangeInformationFilterType; typedef itk::ExtractImageFilter< ImageType, ImageType > ExtractImageFilterType; statisticsContainer->clear(); histogramContainer->clear(); // Make sure that mask is set if ( maskImage == NULL ) { itkExceptionMacro( << "Mask image needs to be set!" ); } // Make sure that spacing of mask and image are the same SpacingType imageSpacing = image->GetSpacing(); SpacingType maskSpacing = maskImage->GetSpacing(); PointType zeroPoint; zeroPoint.Fill( 0.0 ); if ( (zeroPoint + imageSpacing).SquaredEuclideanDistanceTo( (zeroPoint + maskSpacing) ) > mitk::eps ) { itkExceptionMacro( << "Mask needs to have same spacing as image! (Image spacing: " << imageSpacing << "; Mask spacing: " << maskSpacing << ")" ); } // Make sure that orientation of mask and image are the same typedef typename ImageType::DirectionType DirectionType; DirectionType imageDirection = image->GetDirection(); DirectionType maskDirection = maskImage->GetDirection(); for( int i = 0; i < imageDirection.ColumnDimensions; ++i ) { for( int j = 0; j < imageDirection.ColumnDimensions; ++j ) { double differenceDirection = imageDirection[i][j] - maskDirection[i][j]; if ( fabs( differenceDirection ) > mitk::eps ) { itkExceptionMacro( << "Mask needs to have same direction as image! (Image direction: " << imageDirection << "; Mask direction: " << maskDirection << ")" ); } } } // Make sure that the voxels of mask and image are correctly "aligned", i.e., voxel boundaries are the same in both images PointType imageOrigin = image->GetOrigin(); PointType maskOrigin = maskImage->GetOrigin(); long offset[ImageType::ImageDimension]; typedef itk::ContinuousIndex ContinousIndexType; ContinousIndexType maskOriginContinousIndex, imageOriginContinousIndex; image->TransformPhysicalPointToContinuousIndex(maskOrigin, maskOriginContinousIndex); image->TransformPhysicalPointToContinuousIndex(imageOrigin, imageOriginContinousIndex); for ( unsigned int i = 0; i < ImageType::ImageDimension; ++i ) { double misalignment = maskOriginContinousIndex[i] - floor( maskOriginContinousIndex[i] + 0.5 ); if ( fabs( misalignment ) > mitk::eps ) { itkExceptionMacro( << "Pixels/voxels of mask and image are not sufficiently aligned! (Misalignment: " << misalignment << ")" ); } double indexCoordDistance = maskOriginContinousIndex[i] - imageOriginContinousIndex[i]; offset[i] = (int) indexCoordDistance + image->GetBufferedRegion().GetIndex()[i]; } // Adapt the origin and region (index/size) of the mask so that the origin of both are the same typename ChangeInformationFilterType::Pointer adaptMaskFilter; adaptMaskFilter = ChangeInformationFilterType::New(); adaptMaskFilter->ChangeOriginOn(); adaptMaskFilter->ChangeRegionOn(); adaptMaskFilter->SetInput( maskImage ); adaptMaskFilter->SetOutputOrigin( image->GetOrigin() ); adaptMaskFilter->SetOutputOffset( offset ); adaptMaskFilter->Update(); typename MaskImageType::Pointer adaptedMaskImage = adaptMaskFilter->GetOutput(); // Make sure that mask region is contained within image region if ( !image->GetLargestPossibleRegion().IsInside( adaptedMaskImage->GetLargestPossibleRegion() ) ) { itkExceptionMacro( << "Mask region needs to be inside of image region! (Image region: " << image->GetLargestPossibleRegion() << "; Mask region: " << adaptedMaskImage->GetLargestPossibleRegion() << ")" ); } // If mask region is smaller than image region, extract the sub-sampled region from the original image typename ImageType::SizeType imageSize = image->GetBufferedRegion().GetSize(); typename ImageType::SizeType maskSize = maskImage->GetBufferedRegion().GetSize(); bool maskSmallerImage = false; for ( unsigned int i = 0; i < ImageType::ImageDimension; ++i ) { if ( maskSize[i] < imageSize[i] ) { maskSmallerImage = true; } } typename ImageType::ConstPointer adaptedImage; if ( maskSmallerImage ) { typename ExtractImageFilterType::Pointer extractImageFilter = ExtractImageFilterType::New(); extractImageFilter->SetInput( image ); extractImageFilter->SetExtractionRegion( adaptedMaskImage->GetBufferedRegion() ); extractImageFilter->Update(); adaptedImage = extractImageFilter->GetOutput(); } else { adaptedImage = image; } // Initialize Filter typedef itk::StatisticsImageFilter< ImageType > StatisticsFilterType; typename StatisticsFilterType::Pointer statisticsFilter = StatisticsFilterType::New(); statisticsFilter->SetInput( adaptedImage ); statisticsFilter->Update(); int numberOfBins = ( m_DoIgnorePixelValue && (m_MaskingMode == MASKING_MODE_NONE) ) ? 768 : 384; typename LabelStatisticsFilterType::Pointer labelStatisticsFilter; labelStatisticsFilter = LabelStatisticsFilterType::New(); labelStatisticsFilter->SetInput( adaptedImage ); labelStatisticsFilter->SetLabelInput( adaptedMaskImage ); labelStatisticsFilter->UseHistogramsOn(); labelStatisticsFilter->SetHistogramParameters( numberOfBins, statisticsFilter->GetMinimum(), statisticsFilter->GetMaximum() ); // Add progress listening typedef itk::SimpleMemberCommand< ImageStatisticsCalculator > ITKCommandType; ITKCommandType::Pointer progressListener; progressListener = ITKCommandType::New(); progressListener->SetCallbackFunction( this, &ImageStatisticsCalculator::MaskedStatisticsProgressUpdate ); unsigned long observerTag = labelStatisticsFilter->AddObserver( itk::ProgressEvent(), progressListener ); // Execute filter this->InvokeEvent( itk::StartEvent() ); // Make sure that only the mask region is considered (otherwise, if the mask region is smaller // than the image region, the Update() would result in an exception). labelStatisticsFilter->GetOutput()->SetRequestedRegion( adaptedMaskImage->GetLargestPossibleRegion() ); // Execute the filter labelStatisticsFilter->Update(); this->InvokeEvent( itk::EndEvent() ); labelStatisticsFilter->RemoveObserver( observerTag ); // Find all relevant labels of mask (other than 0) std::list< int > relevantLabels; bool maskNonEmpty = false; unsigned int i; for ( i = 1; i < 4096; ++i ) { if ( labelStatisticsFilter->HasLabel( i ) ) { relevantLabels.push_back( i ); maskNonEmpty = true; } } if ( maskNonEmpty ) { std::list< int >::iterator it; for ( it = relevantLabels.begin(), i = 0; it != relevantLabels.end(); ++it, ++i ) { histogramContainer->push_back( HistogramType::ConstPointer( labelStatisticsFilter->GetHistogram( (*it) ) ) ); Statistics statistics; statistics.Label = (*it); statistics.N = labelStatisticsFilter->GetCount( *it ); statistics.Min = labelStatisticsFilter->GetMinimum( *it ); statistics.Max = labelStatisticsFilter->GetMaximum( *it ); statistics.Mean = labelStatisticsFilter->GetMean( *it ); statistics.Median = labelStatisticsFilter->GetMedian( *it ); statistics.Sigma = labelStatisticsFilter->GetSigma( *it ); statistics.RMS = sqrt( statistics.Mean * statistics.Mean + statistics.Sigma * statistics.Sigma ); // restrict image to mask area for min/max index calculation typedef itk::MaskImageFilter< ImageType, MaskImageType, ImageType > MaskImageFilterType; typename MaskImageFilterType::Pointer masker = MaskImageFilterType::New(); masker->SetOutsideValue( (statistics.Min+statistics.Max)/2 ); masker->SetInput1(adaptedImage); masker->SetInput2(adaptedMaskImage); masker->Update(); // get index of minimum and maximum typedef itk::MinimumMaximumImageCalculator< ImageType > MinMaxFilterType; typename MinMaxFilterType::Pointer minMaxFilter = MinMaxFilterType::New(); minMaxFilter->SetImage( masker->GetOutput() ); unsigned long observerTag2 = minMaxFilter->AddObserver( itk::ProgressEvent(), progressListener ); minMaxFilter->Compute(); minMaxFilter->RemoveObserver( observerTag2 ); this->InvokeEvent( itk::EndEvent() ); statistics.MinIndex.set_size(adaptedImage->GetImageDimension()); statistics.MaxIndex.set_size(adaptedImage->GetImageDimension()); typename MinMaxFilterType::IndexType tempMaxIndex = minMaxFilter->GetIndexOfMaximum(); typename MinMaxFilterType::IndexType tempMinIndex = minMaxFilter->GetIndexOfMinimum(); // FIX BUG 14644 //If a PlanarFigure is used for segmentation the //adaptedImage is a single slice (2D). Adding the // 3. dimension. if (m_MaskingMode == MASKING_MODE_PLANARFIGURE && m_Image->GetDimension()==3) { statistics.MaxIndex.set_size(m_Image->GetDimension()); statistics.MaxIndex[m_PlanarFigureCoordinate0]=tempMaxIndex[0]; statistics.MaxIndex[m_PlanarFigureCoordinate1]=tempMaxIndex[1]; statistics.MaxIndex[m_PlanarFigureAxis]=m_PlanarFigureSlice; statistics.MinIndex.set_size(m_Image->GetDimension()); statistics.MinIndex[m_PlanarFigureCoordinate0]=tempMinIndex[0]; statistics.MinIndex[m_PlanarFigureCoordinate1]=tempMinIndex[1]; statistics.MinIndex[m_PlanarFigureAxis]=m_PlanarFigureSlice; } else { for (unsigned int i = 0; ipush_back( statistics ); } } else { histogramContainer->push_back( HistogramType::ConstPointer( m_EmptyHistogram ) ); statisticsContainer->push_back( Statistics() );; } } template < typename TPixel, unsigned int VImageDimension > void ImageStatisticsCalculator::InternalCalculateMaskFromPlanarFigure( const itk::Image< TPixel, VImageDimension > *image, unsigned int axis ) { typedef itk::Image< TPixel, VImageDimension > ImageType; typedef itk::CastImageFilter< ImageType, MaskImage2DType > CastFilterType; // Generate mask image as new image with same header as input image and // initialize with "1". typename CastFilterType::Pointer castFilter = CastFilterType::New(); castFilter->SetInput( image ); castFilter->Update(); castFilter->GetOutput()->FillBuffer( 1 ); // all PolylinePoints of the PlanarFigure are stored in a vtkPoints object. // These points are used by the vtkLassoStencilSource to create // a vtkImageStencil. const mitk::Geometry2D *planarFigureGeometry2D = m_PlanarFigure->GetGeometry2D(); const typename PlanarFigure::PolyLineType planarFigurePolyline = m_PlanarFigure->GetPolyLine( 0 ); const mitk::Geometry3D *imageGeometry3D = m_Image->GetGeometry( 0 ); // Determine x- and y-dimensions depending on principal axis int i0, i1; switch ( axis ) { case 0: i0 = 1; i1 = 2; break; case 1: i0 = 0; i1 = 2; break; case 2: default: i0 = 0; i1 = 1; break; } m_PlanarFigureCoordinate0= i0; m_PlanarFigureCoordinate1= i1; // store the polyline contour as vtkPoints object bool outOfBounds = false; vtkSmartPointer points = vtkSmartPointer::New(); typename PlanarFigure::PolyLineType::const_iterator it; for ( it = planarFigurePolyline.begin(); it != planarFigurePolyline.end(); ++it ) { Point3D point3D; // Convert 2D point back to the local index coordinates of the selected // image planarFigureGeometry2D->Map( it->Point, point3D ); // Polygons (partially) outside of the image bounds can not be processed // further due to a bug in vtkPolyDataToImageStencil if ( !imageGeometry3D->IsInside( point3D ) ) { outOfBounds = true; } imageGeometry3D->WorldToIndex( point3D, point3D ); points->InsertNextPoint( point3D[i0], point3D[i1], 0 ); } // mark a malformed 2D planar figure ( i.e. area = 0 ) as out of bounds // this can happen when all control points of a rectangle lie on the same line = two of the three extents are zero double bounds[6] = {0, 0, 0, 0, 0, 0}; points->GetBounds( bounds ); bool extent_x = (fabs(bounds[0] - bounds[1])) < mitk::eps; bool extent_y = (fabs(bounds[2] - bounds[3])) < mitk::eps; bool extent_z = (fabs(bounds[4] - bounds[5])) < mitk::eps; // throw an exception if a closed planar figure is deformed, i.e. has only one non-zero extent if ( m_PlanarFigure->IsClosed() && ((extent_x && extent_y) || (extent_x && extent_z) || (extent_y && extent_z))) { mitkThrow() << "Figure has a zero area and cannot be used for masking."; } if ( outOfBounds ) { throw std::runtime_error( "Figure at least partially outside of image bounds!" ); } // create a vtkLassoStencilSource and set the points of the Polygon vtkSmartPointer lassoStencil = vtkSmartPointer::New(); lassoStencil->SetShapeToPolygon(); lassoStencil->SetPoints( points ); // Export from ITK to VTK (to use a VTK filter) typedef itk::VTKImageImport< MaskImage2DType > ImageImportType; typedef itk::VTKImageExport< MaskImage2DType > ImageExportType; typename ImageExportType::Pointer itkExporter = ImageExportType::New(); itkExporter->SetInput( castFilter->GetOutput() ); vtkSmartPointer vtkImporter = vtkSmartPointer::New(); this->ConnectPipelines( itkExporter, vtkImporter ); // Apply the generated image stencil to the input image vtkSmartPointer imageStencilFilter = vtkSmartPointer::New(); imageStencilFilter->SetInputConnection( vtkImporter->GetOutputPort() ); imageStencilFilter->SetStencilConnection(lassoStencil->GetOutputPort()); imageStencilFilter->ReverseStencilOff(); imageStencilFilter->SetBackgroundValue( 0 ); imageStencilFilter->Update(); // Export from VTK back to ITK vtkSmartPointer vtkExporter = vtkImageExport::New(); // TODO: this is WRONG, should be vtkSmartPointer::New(), but bug # 14455 //vtkSmartPointer vtkExporter = vtkSmartPointer::New(); vtkExporter->SetInputConnection( imageStencilFilter->GetOutputPort() ); vtkExporter->Update(); typename ImageImportType::Pointer itkImporter = ImageImportType::New(); this->ConnectPipelines( vtkExporter, itkImporter ); itkImporter->Update(); // Store mask m_InternalImageMask2D = itkImporter->GetOutput(); } void ImageStatisticsCalculator::UnmaskedStatisticsProgressUpdate() { // Need to throw away every second progress event to reach a final count of // 100 since two consecutive filters are used in this case static int updateCounter = 0; if ( updateCounter++ % 2 == 0 ) { this->InvokeEvent( itk::ProgressEvent() ); } } void ImageStatisticsCalculator::MaskedStatisticsProgressUpdate() { this->InvokeEvent( itk::ProgressEvent() ); } } diff --git a/Modules/ImageStatistics/mitkvtkImageStencilRaster.h b/Modules/ImageStatistics/mitkvtkImageStencilRaster.h deleted file mode 100644 index ef7ff96029..0000000000 --- a/Modules/ImageStatistics/mitkvtkImageStencilRaster.h +++ /dev/null @@ -1,113 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkImageStencilData.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -// .NAME vtkImageStencilData - efficient description of an image stencil -// .SECTION Description -// vtkImageStencilData describes an image stencil in a manner which is -// efficient both in terms of speed and storage space. The stencil extents -// are stored for each x-row across the image (multiple extents per row if -// necessary) and can be retrieved via the GetNextExtent() method. -// .SECTION see also -// vtkImageStencilSource vtkImageStencil - -#ifndef __vtkImageStencilRaster_h -#define __vtkImageStencilRaster_h - -#include "vtkImageStencilData.h" -#include "vtkDataObject.h" -#include "ImageStatisticsExports.h" - - -//BTX -// Description: -// This is a helper class for stencil creation. It is a raster with -// infinite resolution in the X direction (approximately, since it uses -// double precision). Lines that represent polygon edges can be drawn -// into this raster, and then filled given a tolerance. -class ImageStatistics_EXPORT vtkImageStencilRaster -{ -public: - // Description: - // Create a raster with the specified whole y extent. - vtkImageStencilRaster(const int wholeExtent[2]); - - // Description: - // Destructor. - ~vtkImageStencilRaster(); - - // Description: - // Reset the raster to its original state, but keep the same whole - // extent. Pre-allocate the specified 1D allocateExtent, which must be - // within the whole extent. - void PrepareForNewData(const int allocateExtent[2] = 0); - - // Description: - // Insert a line into the raster, given the two end points. - // The "inflect1" and "inflect2" should be set if you want - // to add a small vertical tolerance to either endpoints. - void InsertLine(const double p1[2], const double p2[2], - bool inflect1, bool inflect2); - - // Description: - // Fill the specified extent of a vtkImageStencilData with the raster, - // after permuting the raster according to xj and yj. - void FillStencilData(vtkImageStencilData *data, const int extent[6], - int xj = 0, int yj = 1); - - // Description: - // The tolerance for float-to-int conversions. - void SetTolerance(double tol) { this->Tolerance = tol; } - double GetTolerance() { return this->Tolerance; } - -protected: - // Description: - // Ensure that the raster is initialized for the specified range - // of y values, which must be within the Extent. - void PrepareExtent(int ymin, int ymax); - - // Description: - // Insert an x point into the raster. If the y value is larger - // than the y extent, the extent will grow automatically. - void InsertPoint(int y, double x); - - int Extent[2]; - int UsedExtent[2]; - double **Raster; - double Tolerance; - -private: - vtkImageStencilRaster(const vtkImageStencilRaster&); // Not implemented. - void operator=(const vtkImageStencilRaster&); // Not implemented. -}; -//ETX - -#endif - - - diff --git a/Modules/ImageStatistics/mitkvtkLassoStencilSource.h b/Modules/ImageStatistics/mitkvtkLassoStencilSource.h deleted file mode 100644 index c809dbf151..0000000000 --- a/Modules/ImageStatistics/mitkvtkLassoStencilSource.h +++ /dev/null @@ -1,122 +0,0 @@ -/*=================================================================== - -The Medical Imaging Interaction Toolkit (MITK) - -Copyright (c) German Cancer Research Center, -Division of Medical and Biological Informatics. -All rights reserved. - -This software is distributed WITHOUT ANY WARRANTY; without -even the implied warranty of MERCHANTABILITY or FITNESS FOR -A PARTICULAR PURPOSE. - -See LICENSE.txt or http://www.mitk.org for details. - -===================================================================*/ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkLassoStencilSource.h - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -// .NAME vtkLassoStencilSource - Create a stencil from a contour -// .SECTION Description -// vtkLassoStencilSource will create an image stencil from a -// set of points that define a contour. Its output can be -// used with vtkImageStecil or other vtk classes that apply -// a stencil to an image. -// .SECTION See Also -// vtkROIStencilSource vtkPolyDataToImageStencil -// .SECTION Thanks -// Thanks to David Gobbi for contributing this class to VTK. - -#ifndef __vtkLassoStencilSource_h -#define __vtkLassoStencilSource_h - - -#include "vtkImageStencilSource.h" -#include "ImageStatisticsExports.h" - -class vtkPoints; -class vtkSpline; -class vtkLSSPointMap; - -class ImageStatistics_EXPORT vtkLassoStencilSource : public vtkImageStencilSource -{ -public: - static vtkLassoStencilSource *New(); - vtkTypeMacro(vtkLassoStencilSource, vtkImageStencilSource); - void PrintSelf(ostream& os, vtkIndent indent); - -//BTX - enum { - POLYGON = 0, - SPLINE = 1, - }; -//ETX - - // Description: - // The shape to use, default is "Polygon". The spline is a - // cardinal spline. Bezier splines are not yet supported. - vtkGetMacro(Shape, int); - vtkSetClampMacro(Shape, int, POLYGON, SPLINE); - void SetShapeToPolygon() { this->SetShape(POLYGON); }; - void SetShapeToSpline() { this->SetShape(SPLINE); }; - virtual const char *GetShapeAsString(); - - // Description: - // The points that make up the lassoo. The loop does not - // have to be closed, the last point will automatically be - // connected to the first point by a straight line segment. - virtual void SetPoints(vtkPoints *points); - vtkGetObjectMacro(Points, vtkPoints); - - // Description: - // The slice orientation. The default is 2, which is XY. - // Other values are 0, which is YZ, and 1, which is XZ. - vtkGetMacro(SliceOrientation, int); - vtkSetClampMacro(SliceOrientation, int, 0, 2); - - // Description: - // The points for a particular slice. This will override the - // points that were set by calling SetPoints() for the slice. - // To clear the setting, call SetSlicePoints(slice, NULL). - virtual void SetSlicePoints(int i, vtkPoints *points); - virtual vtkPoints *GetSlicePoints(int i); - - // Description: - // Remove points from all slices. - virtual void RemoveAllSlicePoints(); - - // Description: - // Overload GetMTime() to include the timestamp on the points. - unsigned long GetMTime(); - -protected: - vtkLassoStencilSource(); - ~vtkLassoStencilSource(); - - virtual int RequestData(vtkInformation *, vtkInformationVector **, - vtkInformationVector *); - - int Shape; - int SliceOrientation; - vtkPoints *Points; - vtkSpline *SplineX; - vtkSpline *SplineY; - vtkLSSPointMap *PointMap; - -private: - vtkLassoStencilSource(const vtkLassoStencilSource&); // Not implemented. - void operator=(const vtkLassoStencilSource&); // Not implemented. -}; - -#endif diff --git a/Modules/ImageStatistics/vtkImageStencilRaster.cxx b/Modules/ImageStatistics/vtkImageStencilRaster.cxx deleted file mode 100644 index 6b00e1f26f..0000000000 --- a/Modules/ImageStatistics/vtkImageStencilRaster.cxx +++ /dev/null @@ -1,452 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkImageStencilData.cxx - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -#include "mitkvtkImageStencilRaster.h" - -#include "vtkImageStencilSource.h" -#include "vtkInformation.h" -#include "vtkInformationVector.h" -#include "vtkDemandDrivenPipeline.h" -#include "vtkDataSetAttributes.h" -#include "vtkDataArray.h" -#include "vtkObjectFactory.h" -#include "vtkMath.h" - -#include -#include - -//---------------------------------------------------------------------------- -// tolerance for float-to-int conversion in stencil operations - -#define VTK_STENCIL_TOL 7.62939453125e-06 - -//---------------------------------------------------------------------------- -vtkImageStencilRaster::vtkImageStencilRaster(const int extent[2]) -{ - int rsize = extent[1] - extent[0] + 1; - - // the "raster" is a sequence of pointer-pairs, where the first pointer - // points to the first value in the raster line, and the second pointer - // points to one location past the last vale in the raster line. The - // difference is the number of x values stored in the raster line. - this->Raster = new double*[2*static_cast(rsize)]; - - // the extent is the range of y values (one line per y) - this->Extent[0] = extent[0]; - this->Extent[1] = extent[1]; - - // tolerance should be larger than expected roundoff errors - this->Tolerance = VTK_STENCIL_TOL; - - // no extent is used initially - this->UsedExtent[0] = 0; - this->UsedExtent[1] = -1; -} - -//---------------------------------------------------------------------------- -vtkImageStencilRaster::~vtkImageStencilRaster() -{ - if (this->UsedExtent[1] >= this->UsedExtent[0]) - { - size_t i = 2*static_cast(this->UsedExtent[0] - this->Extent[0]); - size_t imax = 2*static_cast(this->UsedExtent[1] - this->Extent[0]); - - do - { - if (this->Raster[i]) - { - delete [] this->Raster[i]; - } - i += 2; - } - while (i <= imax); - } - delete [] this->Raster; -} - -//---------------------------------------------------------------------------- -void vtkImageStencilRaster::PrepareForNewData(const int allocateExtent[2]) -{ - if (this->UsedExtent[1] >= this->UsedExtent[0]) - { - // reset and re-use the allocated raster lines - size_t i = 2*static_cast(this->UsedExtent[0]-this->Extent[0]); - size_t imax=2*static_cast(this->UsedExtent[1]-this->Extent[0]); - do - { - this->Raster[i+1] = this->Raster[i]; - i += 2; - } - while (i <= imax); - } - - if (allocateExtent && allocateExtent[1] >= allocateExtent[1]) - { - this->PrepareExtent(allocateExtent[0], allocateExtent[1]); - } -} - -//---------------------------------------------------------------------------- -void vtkImageStencilRaster::PrepareExtent(int ymin, int ymax) -{ - // this does not do any allocation, it just initializes any - // raster lines are not already part of the UsedExtent, and - // then expands the UsedExtent to include [ymin, ymax] - - if (this->UsedExtent[1] < this->UsedExtent[0]) - { - size_t i = 2*static_cast(ymin - this->Extent[0]); - size_t imax = 2*static_cast(ymax - this->Extent[0]); - - do - { - this->Raster[i] = 0; - } - while (++i <= imax); - - this->UsedExtent[0] = ymin; - this->UsedExtent[1] = ymax; - - return; - } - - if (ymin < this->UsedExtent[0]) - { - size_t i = 2*static_cast(ymin - this->Extent[0]); - size_t imax = 2*static_cast(this->UsedExtent[0]-this->Extent[0]-1); - - do - { - this->Raster[i] = 0; - } - while (++i <= imax); - - this->UsedExtent[0] = ymin; - } - - if (ymax > this->UsedExtent[1]) - { - size_t i = 2*static_cast(this->UsedExtent[1]+1 - this->Extent[0]); - size_t imax = 2*static_cast(ymax - this->Extent[0]); - - do - { - this->Raster[i] = 0; - } - while (++i <= imax); - - this->UsedExtent[1] = ymax; - } -} - -//---------------------------------------------------------------------------- -void vtkImageStencilRaster::InsertPoint(int y, double x) -{ - size_t pos = 2*static_cast(y - this->Extent[0]); - double* &rhead = this->Raster[pos]; - double* &rtail = this->Raster[pos+1]; - - // current size is the diff between the tail and the head - size_t n = rtail - rhead; - - // no allocation on this raster line yet - if (rhead == 0) - { - rhead = new double[2]; - rtail = rhead; - } - // grow whenever size reaches a power of two - else if (n > 1 && (n & (n-1)) == 0) - { - double *ptr = new double[2*n]; - for (size_t i = 0; i < n; i++) - { - ptr[i] = rhead[i]; - } - delete [] rhead; - rhead = ptr; - rtail = ptr + n; - } - - // insert the value - *rtail++ = x; -} - -//---------------------------------------------------------------------------- -void vtkImageStencilRaster::InsertLine( - const double pt1[2], const double pt2[2], - bool inflection1, bool inflection2) -{ - double x1 = pt1[0]; - double x2 = pt2[0]; - double y1 = pt1[1]; - double y2 = pt2[1]; - - // swap end points if necessary - if (y1 > y2) - { - x1 = pt2[0]; - x2 = pt1[0]; - y1 = pt2[1]; - y2 = pt1[1]; - bool tmp = inflection1; - inflection1 = inflection2; - inflection2 = tmp; - } - - // find min and max of x values - double xmin = x1; - double xmax = x2; - if (x1 > x2) - { - xmin = x2; - xmax = x1; - } - - // check for parallel to the x-axis - if (y1 == y2) - { - return; - } - - double ymin = y1; - double ymax = y2; - - // if an end is an inflection point, include a tolerance - ymin -= inflection1*this->Tolerance; - ymax += inflection2*this->Tolerance; - - // Integer y values for start and end of line - int iy1, iy2; - iy1 = this->Extent[0]; - iy2 = this->Extent[1]; - - // Check for out of bounds - if (ymax < iy1 || ymin >= iy2) - { - return; - } - - // Guard against extentY - if (ymin >= iy1) - { - iy1 = vtkMath::Floor(ymin) + 1; - } - if (ymax < iy2) - { - iy2 = vtkMath::Floor(ymax); - } - - // Expand allocated extent if necessary - if (iy1 < this->UsedExtent[0] || - iy2 > this->UsedExtent[1]) - { - this->PrepareExtent(iy1, iy2); - } - - // Precompute values for a Bresenham-like line algorithm - double grad = (x2 - x1)/(y2 - y1); - double delta = (iy1 - y1)*grad; - - // Go along y and place each x in the proper raster line - for (int y = iy1; y <= iy2; y++) - { - double x = x1 + delta; - // incrementing delta has less roundoff error than incrementing x, - // since delta will typically be smaller than x - delta += grad; - - // clamp x (because of tolerance, it might not be in range) - if (x < xmin) - { - x = xmin; - } - else if (x > xmax) - { - x = xmax; - } - - this->InsertPoint(y, x); - } -} - -//---------------------------------------------------------------------------- -void vtkImageStencilRaster::FillStencilData( - vtkImageStencilData *data, const int extent[6], int xj, int yj) -{ - if (xj != 0) - { - // slices are stacked in the x direction - int xmin = extent[2*xj]; - int xmax = extent[2*xj+1]; - int ymin = this->UsedExtent[0]; - int ymax = this->UsedExtent[1]; - int zmin = extent[0]; - int zmax = extent[1]; - - for (int idY = ymin; idY <= ymax; idY++) - { - size_t pos = 2*static_cast(idY - this->Extent[0]); - double *rline = this->Raster[pos]; - double *rlineEnd = this->Raster[pos+1]; - - if (rline == 0) - { - continue; - } - - vtkstd::sort(rline, rlineEnd); - - int xy[2]; - xy[2-xj] = idY; - - int lastr = VTK_INT_MIN; - - size_t l = rlineEnd - rline; - l = l - (l & 1); // force l to be an even number - for (size_t k = 0; k < l; k += 2) - { - double x1 = rline[k] - this->Tolerance; - double x2 = rline[k+1] + this->Tolerance; - - // make sure one of the ends is in bounds - if (x2 < xmin || x1 >= xmax) - { - continue; - } - - // clip the line segment with the bounds - int r1 = xmin; - int r2 = xmax; - - if (x1 >= xmin) - { - r1 = vtkMath::Floor(x1) + 1; - } - if (x2 < xmax) - { - r2 = vtkMath::Floor(x2); - } - - // ensure no overlap occurs with previous - if (r1 <= lastr) - { - r1 = lastr + 1; - } - lastr = r2; - - for (int idX = r1; idX <= r2; idX++) - { - xy[xj-1] = idX; - data->InsertNextExtent(zmin, zmax, xy[0], xy[1]); - } - } - } - } - else - { - // slices stacked in the y or z direction - int zj = 3 - yj; - int xmin = extent[0]; - int xmax = extent[1]; - int ymin = this->UsedExtent[0]; - int ymax = this->UsedExtent[1]; - int zmin = extent[2*zj]; - int zmax = extent[2*zj+1]; - - // convert each raster line into extents for the stencil - for (int idY = ymin; idY <= ymax; idY++) - { - size_t pos = 2*static_cast(idY - this->Extent[0]); - double *rline = this->Raster[pos]; - double *rlineEnd = this->Raster[pos+1]; - - if (rline == 0) - { - continue; - } - - vtkstd::sort(rline, rlineEnd); - - int lastr = VTK_INT_MIN; - - // go through each raster line and fill the stencil - size_t l = rlineEnd - rline; - l = l - (l & 1); // force l to be an even number - for (size_t k = 0; k < l; k += 2) - { - int yz[2]; - - yz[yj-1] = idY; - yz[2-yj] = zmin; - - double x1 = rline[k] - this->Tolerance; - double x2 = rline[k+1] + this->Tolerance; - - if (x2 < xmin || x1 >= xmax) - { - continue; - } - - int r1 = xmin; - int r2 = xmax; - - if (x1 >= xmin) - { - r1 = vtkMath::Floor(x1) + 1; - } - if (x2 < xmax) - { - r2 = vtkMath::Floor(x2); - } - - // ensure no overlap occurs between extents - if (r1 <= lastr) - { - r1 = lastr + 1; - } - lastr = r2; - - if (r2 >= r1) - { - data->InsertNextExtent(r1, r2, yz[0], yz[1]); - } - } - } - - // copy the result to all other slices - if (zmin < zmax) - { - for (int idY = ymin; idY <= ymax; idY++) - { - int r1, r2; - int yz[2]; - - yz[yj-1] = idY; - yz[2-yj] = zmin; - - int iter = 0; - while (data->GetNextExtent(r1, r2, xmin, xmax, yz[0], yz[1], iter)) - { - for (int idZ = zmin + 1; idZ <= zmax; idZ++) - { - yz[2-yj] = idZ; - data->InsertNextExtent(r1, r2, yz[0], yz[1]); - } - yz[2-yj] = zmin; - } - } - } - } -} diff --git a/Modules/ImageStatistics/vtkLassoStencilSource.cxx b/Modules/ImageStatistics/vtkLassoStencilSource.cxx deleted file mode 100644 index dbe66d903d..0000000000 --- a/Modules/ImageStatistics/vtkLassoStencilSource.cxx +++ /dev/null @@ -1,609 +0,0 @@ -/*========================================================================= - - Program: Visualization Toolkit - Module: vtkLassoStencilSource.cxx - - Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen - All rights reserved. - See Copyright.txt or http://www.kitware.com/Copyright.htm for details. - - This software is distributed WITHOUT ANY WARRANTY; without even - the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR - PURPOSE. See the above copyright notice for more information. - -=========================================================================*/ -#include "mitkvtkLassoStencilSource.h" - -#include "vtkMath.h" -#include "vtkPoints.h" -#include "vtkCardinalSpline.h" -#include "vtkDataArray.h" -#include "vtkImageData.h" -#include "vtkImageStencilData.h" -#include "vtkInformation.h" -#include "vtkInformationVector.h" -#include "vtkObjectFactory.h" -#include "vtkStreamingDemandDrivenPipeline.h" -#include "vtkSmartPointer.h" - -#include "mitkvtkImageStencilRaster.h" - -#include -#include - -vtkStandardNewMacro(vtkLassoStencilSource); -vtkCxxSetObjectMacro(vtkLassoStencilSource, Points, vtkPoints); - -//---------------------------------------------------------------------------- -class vtkLSSPointMap : public vtkstd::map > -{ -}; - -//---------------------------------------------------------------------------- -vtkLassoStencilSource::vtkLassoStencilSource() -{ - this->SetNumberOfInputPorts(0); - - this->Shape = vtkLassoStencilSource::POLYGON; - this->SliceOrientation = 2; - this->Points = NULL; - this->SplineX = vtkCardinalSpline::New(); - this->SplineY = vtkCardinalSpline::New(); - - this->PointMap = new vtkLSSPointMap(); -} - -//---------------------------------------------------------------------------- -vtkLassoStencilSource::~vtkLassoStencilSource() -{ - this->SetPoints(NULL); - if (this->SplineX) - { - this->SplineX->Delete(); - this->SplineX = NULL; - } - if (this->SplineY) - { - this->SplineY->Delete(); - this->SplineY = NULL; - } - if (this->PointMap) - { - delete this->PointMap; - this->PointMap = NULL; - } -} - -//---------------------------------------------------------------------------- -void vtkLassoStencilSource::PrintSelf(ostream& os, vtkIndent indent) -{ - this->Superclass::PrintSelf(os,indent); - - os << indent << "Shape: " << this->GetShapeAsString() << "\n"; - os << indent << "Points: " << this->Points << "\n"; - os << indent << "SliceOrientation: " << this->GetSliceOrientation() << "\n"; - os << indent << "SlicePoints: " << this->PointMap->size() << "\n"; -} - -//---------------------------------------------------------------------------- -const char *vtkLassoStencilSource::GetShapeAsString() -{ - switch (this->Shape) - { - case vtkLassoStencilSource::POLYGON: - return "Polygon"; - case vtkLassoStencilSource::SPLINE: - return "Spline"; - } - return ""; -} - -//---------------------------------------------------------------------------- -unsigned long int vtkLassoStencilSource::GetMTime() -{ - unsigned long mTime = this->vtkImageStencilSource::GetMTime(); - - if ( this->Points != NULL ) - { - unsigned long t = this->Points->GetMTime(); - if (t > mTime) - { - mTime = t; - } - } - - if ( !this->PointMap->empty() ) - { - vtkLSSPointMap::iterator iter = this->PointMap->begin(); - while ( iter != this->PointMap->end() ) - { - unsigned long t = iter->second->GetMTime(); - if (t > mTime) - { - mTime = t; - } - iter++; - } - } - - return mTime; -} - -//---------------------------------------------------------------------------- -void vtkLassoStencilSource::SetSlicePoints(int i, vtkPoints *points) -{ - vtkLSSPointMap::iterator iter = this->PointMap->find(i); - if (iter != this->PointMap->end()) - { - if (iter->second == points) - { - return; - } - else if (points == 0) - { - this->PointMap->erase(iter); - } - else - { - iter->second = points; - } - } - else - { - if (points == NULL) - { - return; - } - else - { - this->PointMap->insert(iter, vtkLSSPointMap::value_type(i, points)); - } - } - - this->Modified(); -} - -//---------------------------------------------------------------------------- -void vtkLassoStencilSource::RemoveAllSlicePoints() -{ - this->PointMap->clear(); -} - -//---------------------------------------------------------------------------- -vtkPoints *vtkLassoStencilSource::GetSlicePoints(int i) -{ - vtkLSSPointMap::iterator iter = this->PointMap->find(i); - if (iter != this->PointMap->end()) - { - return iter->second; - } - return NULL; -} - -//---------------------------------------------------------------------------- -// tolerance for stencil operations - -#define VTK_STENCIL_TOL 7.62939453125e-06 - -//---------------------------------------------------------------------------- -// Compute a reduced extent based on the bounds of the shape. -static void vtkLassoStencilSourceSubExtent( - vtkPoints *points, - const double origin[3], const double spacing[3], - const int extent[6], int subextent[6]) -{ - double bounds[6]; - points->GetBounds(bounds); - - for (int i = 0; i < 3; i++) - { - double emin = (bounds[2*i] - origin[i])/spacing[i] - VTK_STENCIL_TOL; - double emax = (bounds[2*i+1] - origin[i])/spacing[i] + VTK_STENCIL_TOL; - - subextent[2*i] = extent[2*i]; - subextent[2*i+1] = extent[2*i+1]; - - if (extent[2*i] < emin) - { - subextent[2*i] = VTK_INT_MAX; - if (extent[2*i+1] >= emin) - { - subextent[2*i] = vtkMath::Floor(emin) + 1; - } - } - - if (extent[2*i+1] > emax) - { - subextent[2*i+1] = VTK_INT_MIN; - if (extent[2*i] <= emax) - { - subextent[2*i+1] = vtkMath::Floor(emax); - } - } - - } -} - -//---------------------------------------------------------------------------- -// Rasterize a polygon into the stencil -static int vtkLassoStencilSourcePolygon( - vtkPoints *points, vtkImageStencilData *data, vtkImageStencilRaster *raster, - const int extent[6], const double origin[3], const double spacing[3], - int xj, int yj) -{ - // get the bounds of the polygon - int subextent[6]; - vtkLassoStencilSourceSubExtent(points, origin, spacing, extent, subextent); - - // allocate the raster - raster->PrepareForNewData(&subextent[2*yj]); - - // rasterize each line - vtkIdType n = points->GetNumberOfPoints(); - double p[3]; - double p0[2], p1[2], p2[2], p3[2]; - - points->GetPoint(n-1, p); - p0[0] = (p[xj] - origin[xj])/spacing[xj]; - p0[1] = (p[yj] - origin[yj])/spacing[yj]; - - points->GetPoint(0, p); - p1[0] = (p[xj] - origin[xj])/spacing[xj]; - p1[1] = (p[yj] - origin[yj])/spacing[yj]; - - double dx = p1[0] - p0[0]; - double dy = p1[1] - p0[1]; - if (dx*dx + dy*dy <= VTK_STENCIL_TOL*VTK_STENCIL_TOL) - { - n -= 1; - points->GetPoint(n-1, p); - p0[0] = (p[xj] - origin[xj])/spacing[xj]; - p0[1] = (p[yj] - origin[yj])/spacing[yj]; - } - - points->GetPoint(1, p); - p2[0] = (p[xj] - origin[xj])/spacing[xj]; - p2[1] = (p[yj] - origin[yj])/spacing[yj]; - - // inflection means the line changes vertical direction - bool inflection1, inflection2; - inflection1 = ( (p1[1] - p0[1])*(p2[1] - p1[1]) <= 0 ); - - for (vtkIdType i = 0; i < n; i++) - { - points->GetPoint((i+2)%n, p); - p3[0] = (p[xj] - origin[xj])/spacing[xj]; - p3[1] = (p[yj] - origin[yj])/spacing[yj]; - - inflection2 = ( (p2[1] - p1[1])*(p3[1] - p2[1]) <= 0 ); - - raster->InsertLine(p1, p2, inflection1, inflection2); - - p0[0] = p1[0]; p0[1] = p1[1]; - p1[0] = p2[0]; p1[1] = p2[1]; - p2[0] = p3[0]; p2[1] = p3[1]; - inflection1 = inflection2; - } - - raster->FillStencilData(data, extent, xj, yj); - - return 1; -} - - -//---------------------------------------------------------------------------- -// Generate the splines for the given set of points. The splines -// will be closed if the final point is equal to the first point. -// The parametric value for the resulting spline will be valid over -// the range [0, tmax] where the tmax value is returned by reference. -static void vtkLassoStencilSourceCreateSpline(vtkPoints *points, - const double origin[3], const double spacing[3], - int xj, int yj, vtkSpline *xspline, vtkSpline *yspline, - double &tmax, double &dmax) -{ - // initialize the spline - xspline->RemoveAllPoints(); - yspline->RemoveAllPoints(); - xspline->ClosedOff(); - yspline->ClosedOff(); - - // get the number of points and the first/last point - vtkIdType n = points->GetNumberOfPoints(); - double p[3]; - double p0[2], p1[2]; - - points->GetPoint(n-1, p); - p0[0] = (p[xj] - origin[xj])/spacing[xj]; - p0[1] = (p[yj] - origin[yj])/spacing[yj]; - - points->GetPoint(0, p); - p1[0] = (p[xj] - origin[xj])/spacing[xj]; - p1[1] = (p[yj] - origin[yj])/spacing[yj]; - - // factor between real distance and parametric distance - double f = 1.0; - // the length of the implicit segment for closed loops - double lastd = 0; - - // aspect ratio - double xf = 1.0; - double yf = 1.0; - if (spacing[xj] > spacing[yj]) - { - xf = spacing[xj]/spacing[yj]; - } - else - { - yf = spacing[yj]/spacing[xj]; - } - - // if first and last point are same, spline is closed - double dx = (p1[0] - p0[0])*xf; - double dy = (p1[1] - p0[1])*yf; - double d2 = dx*dx + dy*dy; - while (d2 <= VTK_STENCIL_TOL*VTK_STENCIL_TOL && n > 1) - { - n -= 1; - points->GetPoint(n-1, p); - p0[0] = (p[xj] - origin[xj])/spacing[xj]; - p0[1] = (p[yj] - origin[yj])/spacing[yj]; - - xspline->ClosedOn(); - yspline->ClosedOn(); - - // vtkSpline considers the parametric length of the implicit - // segment of closed loops to be unity, so set "f" so that - // multiplying the real length of that segment by "f" gives unity. - dx = (p1[0] - p0[0])*xf; - dy = (p1[1] - p0[1])*yf; - d2 = dx*dx + dy*dy; - lastd = sqrt(d2); - if (lastd > 0) - { - f = 1.0/lastd; - } - } - - // Add all the points to the spline. - double d = 0.0; - for (vtkIdType i = 0; i < n; i++) - { - p0[0] = p1[0]; p0[1] = p1[1]; - - points->GetPoint(i, p); - p1[0] = (p[xj] - origin[xj])/spacing[xj]; - p1[1] = (p[yj] - origin[yj])/spacing[yj]; - - dx = (p1[0] - p0[0])*xf; - dy = (p1[1] - p0[1])*yf; - - d += sqrt(dx*dx + dy*dy); - - double t = f*d; - - xspline->AddPoint(t, p1[0]); - yspline->AddPoint(t, p1[1]); - } - - // Do the spline precomputations - xspline->Compute(); - yspline->Compute(); - - // The spline is valid over t = [0, tmax] - d += lastd; - tmax = f*d; - dmax = d; -} - -//---------------------------------------------------------------------------- -// Rasterize a spline contour into the stencil -static int vtkLassoStencilSourceSpline( - vtkPoints *points, vtkImageStencilData *data, vtkImageStencilRaster *raster, - const int extent[6], const double origin[3], const double spacing[3], - int xj, int yj, vtkSpline *xspline, vtkSpline *yspline) -{ - // create the splines - double tmax, dmax; - vtkLassoStencilSourceCreateSpline( - points, origin, spacing, xj, yj, xspline, yspline, tmax, dmax); - - if (dmax <= VTK_STENCIL_TOL) - { - return 1; - } - - // get the bounds of the polygon as a first guess of the spline bounds - int subextent[6]; - vtkLassoStencilSourceSubExtent(points, origin, spacing, extent, subextent); - - // allocate the raster - raster->PrepareForNewData(&subextent[2*yj]); - - // go around the spline - vtkIdType n = vtkMath::Floor(dmax)+1; - double delta = tmax/n; - - double p0[2], p1[2], p2[2], p3[2]; - - double t = tmax; - if (xspline->GetClosed()) - { - t = (n-1)*tmax/n; - } - else - { - n = n + 1; - } - - p0[0] = xspline->Evaluate(t); - p0[1] = yspline->Evaluate(t); - - t = 0; - p1[0] = xspline->Evaluate(t); - p1[1] = yspline->Evaluate(t); - - t = delta; - p2[0] = xspline->Evaluate(t); - p2[1] = yspline->Evaluate(t); - - // inflection means the line changes vertical direction - bool inflection1, inflection2; - inflection1 = ( (p1[1] - p0[1])*(p2[1] - p1[1]) <= 0 ); - - for (vtkIdType i = 0; i < n; i++) - { - t += delta; - if (i == n-2) - { - t = 0; - } - - p3[0] = xspline->Evaluate(t); - p3[1] = yspline->Evaluate(t); - - inflection2 = ( (p2[1] - p1[1])*(p3[1] - p2[1]) <= 0 ); - - raster->InsertLine(p1, p2, inflection1, inflection2); - - p0[0] = p1[0]; p0[1] = p1[1]; - p1[0] = p2[0]; p1[1] = p2[1]; - p2[0] = p3[0]; p2[1] = p3[1]; - inflection1 = inflection2; - } - - raster->FillStencilData(data, extent, xj, yj); - - return 1; -} - -//---------------------------------------------------------------------------- -static int vtkLassoStencilSourceExecute( - vtkPoints *points, vtkImageStencilData *data, vtkImageStencilRaster *raster, - int extent[6], double origin[3], double spacing[3], int shape, - int xj, int yj, vtkSpline *xspline, vtkSpline *yspline) -{ - int result = 1; - - if (points == 0 || points->GetNumberOfPoints() < 3) - { - return 1; - } - - switch (shape) - { - case vtkLassoStencilSource::POLYGON: - result = vtkLassoStencilSourcePolygon( - points, data, raster, extent, origin, spacing, xj, yj); - break; - case vtkLassoStencilSource::SPLINE: - result = vtkLassoStencilSourceSpline( - points, data, raster, extent, origin, spacing, xj, yj, - xspline, yspline); - break; - } - - return result; -} - - -//---------------------------------------------------------------------------- -int vtkLassoStencilSource::RequestData( - vtkInformation *request, - vtkInformationVector **inputVector, - vtkInformationVector *outputVector) -{ - int extent[6]; - double origin[3]; - double spacing[3]; - int result = 1; - - this->Superclass::RequestData(request, inputVector, outputVector); - - vtkInformation *outInfo = outputVector->GetInformationObject(0); - vtkImageStencilData *data = vtkImageStencilData::SafeDownCast( - outInfo->Get(vtkDataObject::DATA_OBJECT())); - - outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_EXTENT(), extent); - outInfo->Get(vtkDataObject::ORIGIN(), origin); - outInfo->Get(vtkDataObject::SPACING(), spacing); - - int slabExtent[6]; - slabExtent[0] = extent[0]; slabExtent[1] = extent[1]; - slabExtent[2] = extent[2]; slabExtent[3] = extent[3]; - slabExtent[4] = extent[4]; slabExtent[5] = extent[5]; - - int xj = 0; - int yj = 1; - int zj = 2; - - if (this->SliceOrientation == 0) - { - xj = 1; - yj = 2; - zj = 0; - } - else if (this->SliceOrientation == 1) - { - xj = 0; - yj = 2; - zj = 1; - } - - vtkImageStencilRaster raster(&extent[2*yj]); - raster.SetTolerance(VTK_STENCIL_TOL); - - int zmin = extent[2*zj]; - int zmax = extent[2*zj+1]; - - vtkLSSPointMap::iterator iter = this->PointMap->lower_bound(zmin); - vtkLSSPointMap::iterator maxiter = this->PointMap->upper_bound(zmax); - - while (iter != maxiter && result != 0) - { - this->SetProgress((slabExtent[2*zj] - zmin)*1.0/(zmax - zmin + 1)); - - int i = iter->first; - vtkPoints *points = iter->second; - - // fill in the slices with no SlicePoints - if (this->Points && i > slabExtent[2*zj]) - { - slabExtent[2*zj+1] = i-1; - - result = vtkLassoStencilSourceExecute( - this->Points, data, &raster, slabExtent, origin, spacing, - this->Shape, xj, yj, this->SplineX, this->SplineY); - } - - // do the slice with its SlicePoints - if (result) - { - slabExtent[2*zj] = i; - slabExtent[2*zj+1] = i; - - result = vtkLassoStencilSourceExecute( - points, data, &raster, slabExtent, origin, spacing, - this->Shape, xj, yj, this->SplineX, this->SplineY); - - slabExtent[2*zj] = slabExtent[2*zj+1] + 1; - } - - ++iter; - } - - this->SetProgress((slabExtent[2*zj] - zmin)*1.0/(zmax - zmin + 1)); - - // fill in the rest - if (result && slabExtent[2*zj] <= zmax) - { - slabExtent[2*zj+1] = zmax; - - result = vtkLassoStencilSourceExecute( - this->Points, data, &raster, slabExtent, origin, spacing, - this->Shape, xj, yj, this->SplineX, this->SplineY); - - this->SetProgress(1.0); - } - - return result; -} diff --git a/Modules/MitkAlgorithmsExt/CMakeLists.txt b/Modules/MitkAlgorithmsExt/CMakeLists.txt index f4d266ae14..e2c520aa4c 100644 --- a/Modules/MitkAlgorithmsExt/CMakeLists.txt +++ b/Modules/MitkAlgorithmsExt/CMakeLists.txt @@ -1,9 +1,9 @@ MITK_CREATE_MODULE(MitkAlgorithmsExt DEPENDS MitkDataTypesExt - PACKAGE_DEPENDS ANN + PACKAGE_DEPENDS ITK>ITKThresholding ANN WARNINGS_AS_ERRORS ) if(BUILD_TESTING) add_subdirectory(Testing) endif() diff --git a/Modules/MitkExt/CMakeLists.txt b/Modules/MitkExt/CMakeLists.txt index e40e112367..c8ad0522a8 100644 --- a/Modules/MitkExt/CMakeLists.txt +++ b/Modules/MitkExt/CMakeLists.txt @@ -1,19 +1,19 @@ #if(WIN32) # option(MITK_USE_TD_MOUSE "Enable support for 3D Connexion SpaceNavigator" OFF) #endif(WIN32) configure_file(${PROJECT_SOURCE_DIR}/CMake/ToolExtensionITKFactory.cpp.in ${PROJECT_BINARY_DIR}/ToolExtensionITKFactory.cpp.in COPYONLY) configure_file(${PROJECT_SOURCE_DIR}/CMake/ToolExtensionITKFactoryLoader.cpp.in ${PROJECT_BINARY_DIR}/ToolExtensionITKFactoryLoader.cpp.in COPYONLY) configure_file(${PROJECT_SOURCE_DIR}/CMake/ToolGUIExtensionITKFactory.cpp.in ${PROJECT_BINARY_DIR}/ToolGUIExtensionITKFactory.cpp.in COPYONLY) MITK_CREATE_MODULE( MitkExt INCLUDE_DIRS Algorithms Controllers DataManagement Interactions IO Rendering DEPENDS MitkDataTypesExt ImageExtraction IpPicSupport - PACKAGE_DEPENDS ANN + PACKAGE_DEPENDS ANN ITK>ITKConnectedComponents|ITKBinaryMathematicalMorphology DEPRECATED_SINCE 2014.03 ) if(BUILD_TESTING) add_subdirectory(Testing) endif() diff --git a/Modules/MitkMapperExt/CMakeLists.txt b/Modules/MitkMapperExt/CMakeLists.txt index 73b3b901cf..84903014fa 100644 --- a/Modules/MitkMapperExt/CMakeLists.txt +++ b/Modules/MitkMapperExt/CMakeLists.txt @@ -1,8 +1,9 @@ MITK_CREATE_MODULE(MitkMapperExt DEPENDS MitkDataTypesExt + PACKAGE_DEPENDS VTK>vtkRenderingVolumeOpenGL WARNINGS_AS_ERRORS ) if(BUILD_TESTING) #add_subdirectory(Testing) endif() diff --git a/Modules/OpenCVVideoSupport/CMakeLists.txt b/Modules/OpenCVVideoSupport/CMakeLists.txt index d53d6bd68b..d678a22119 100644 --- a/Modules/OpenCVVideoSupport/CMakeLists.txt +++ b/Modules/OpenCVVideoSupport/CMakeLists.txt @@ -1,24 +1,24 @@ if(MITK_USE_OpenCV) - set(dependencies OpenCV) + set(dependencies ITK>ITKVideoBridgeOpenCV OpenCV) if(MITK_USE_videoInput) set(dependencies ${dependencies} videoInput) endif(MITK_USE_videoInput) MITK_CREATE_MODULE(mitkOpenCVVideoSupport INCLUDE_DIRS Commands DEPENDS MitkAlgorithmsExt PACKAGE_DEPENDS ${dependencies} ADDITIONAL_LIBS ${OPENCVVIDEOSUPPORT_ADDITIONAL_LIBS} EXPORT_DEFINE MITK_OPENCVVIDEOSUPPORT_EXPORT ) if(MITK_USE_QT) add_subdirectory(UI) endif(MITK_USE_QT) if(BUILD_TESTING) add_subdirectory(Testing) endif(BUILD_TESTING) endif(MITK_USE_OpenCV) diff --git a/Modules/OpenCVVideoSupport/UI/CMakeLists.txt b/Modules/OpenCVVideoSupport/UI/CMakeLists.txt index de4a3b1299..c875933b20 100644 --- a/Modules/OpenCVVideoSupport/UI/CMakeLists.txt +++ b/Modules/OpenCVVideoSupport/UI/CMakeLists.txt @@ -1,10 +1,9 @@ MITK_CREATE_MODULE(mitkOpenCVVideoSupportUI DEPENDS QmitkExt mitkOpenCVVideoSupport - QT4_MODULES QtGui EXPORT_DEFINE MITK_OPENCVVIDEOSUPPORTUI_EXPORT ) # no tests yet #if(BUILD_TESTING) #add_subdirectory(Testing) #endif(BUILD_TESTING) diff --git a/Modules/OpenViewCore/CMakeLists.txt b/Modules/OpenViewCore/CMakeLists.txt index 3d8aa20d86..5296787a3a 100644 --- a/Modules/OpenViewCore/CMakeLists.txt +++ b/Modules/OpenViewCore/CMakeLists.txt @@ -1,6 +1,5 @@ MITK_CREATE_MODULE(OpenViewCore - PACKAGE_DEPENDS VTK OpenGL + PACKAGE_DEPENDS Qt5>Core|Quick VTK OpenGL EXPORT_DEFINE OVCORE_EXPORT - QT5_MODULES Qt5Core Qt5Quick ) diff --git a/Modules/Overlays/CMakeLists.txt b/Modules/Overlays/CMakeLists.txt index 2855d35fd4..c1a58d19ac 100644 --- a/Modules/Overlays/CMakeLists.txt +++ b/Modules/Overlays/CMakeLists.txt @@ -1,5 +1,4 @@ MITK_CREATE_MODULE( Overlays DEPENDS Qmitk - QT4_MODULES QtGui WARNINGS_AS_ERRORS ) diff --git a/Modules/Qmitk/CMakeLists.txt b/Modules/Qmitk/CMakeLists.txt index 3a2b57ed34..af33055204 100644 --- a/Modules/Qmitk/CMakeLists.txt +++ b/Modules/Qmitk/CMakeLists.txt @@ -1,8 +1,8 @@ MITK_CREATE_MODULE( Qmitk DEPENDS Mitk PlanarFigure - QT4_MODULES QtCore QtGui + PACKAGE_DEPENDS VTK>vtkGUISupportQt Qt4>QtGui SUBPROJECTS MITK-CoreUI EXPORT_DEFINE QMITK_EXPORT ) add_subdirectory(Testing) diff --git a/Modules/QmitkExt/CMakeLists.txt b/Modules/QmitkExt/CMakeLists.txt index d06c076bfe..0eba53165d 100644 --- a/Modules/QmitkExt/CMakeLists.txt +++ b/Modules/QmitkExt/CMakeLists.txt @@ -1,8 +1,7 @@ include_directories(${CTK_INCLUDE_DIRS}) MITK_CREATE_MODULE( QmitkExt INCLUDE_DIRS QmitkApplicationBase QmitkPropertyObservers QmitkFunctionalityComponents DEPENDS MitkAlgorithmsExt Qmitk - PACKAGE_DEPENDS Qwt Qxt - QT4_MODULES QtCore QtGui + PACKAGE_DEPENDS Qt4>QtWebKit Qwt Qxt ) diff --git a/Modules/QmitkExt/files.cmake b/Modules/QmitkExt/files.cmake index b140d03b24..6ed25fb208 100644 --- a/Modules/QmitkExt/files.cmake +++ b/Modules/QmitkExt/files.cmake @@ -1,133 +1,131 @@ set(CPP_FILES QmitkApplicationBase/QmitkIOUtil.cpp QmitkAboutDialog/QmitkAboutDialog.cpp QmitkPropertyObservers/QmitkBasePropertyView.cpp QmitkPropertyObservers/QmitkBoolPropertyWidget.cpp QmitkPropertyObservers/QmitkColorPropertyEditor.cpp QmitkPropertyObservers/QmitkColorPropertyView.cpp QmitkPropertyObservers/QmitkEnumerationPropertyWidget.cpp QmitkPropertyObservers/QmitkNumberPropertyEditor.cpp QmitkPropertyObservers/QmitkNumberPropertyView.cpp QmitkPropertyObservers/QmitkPropertyViewFactory.cpp QmitkPropertyObservers/QmitkStringPropertyEditor.cpp QmitkPropertyObservers/QmitkStringPropertyOnDemandEdit.cpp QmitkPropertyObservers/QmitkStringPropertyView.cpp QmitkPropertyObservers/QmitkNumberPropertySlider.cpp QmitkPropertyObservers/QmitkUGCombinedRepresentationPropertyWidget.cpp qclickablelabel.cpp QmitkCallbackFromGUIThread.cpp QmitkEditPointDialog.cpp QmitkExtRegisterClasses.cpp QmitkFileChooser.cpp QmitkFloatingPointSpanSlider.cpp QmitkColorTransferFunctionCanvas.cpp QmitkStandardViews.cpp QmitkStepperAdapter.cpp QmitkPiecewiseFunctionCanvas.cpp QmitkSliderNavigatorWidget.cpp QmitkTransferFunctionCanvas.cpp QmitkCrossWidget.cpp QmitkSliceWidget.cpp QmitkTransferFunctionWidget.cpp QmitkTransferFunctionGeneratorWidget.cpp QmitkSelectableGLWidget.cpp QmitkPrimitiveMovieNavigatorWidget.cpp QmitkHistogram.cpp QmitkHistogramWidget.cpp QmitkPlotWidget.cpp QmitkPlotDialog.cpp QmitkPointListModel.cpp QmitkPointListView.cpp QmitkPointListWidget.cpp QmitkPointListViewWidget.cpp QmitkCorrespondingPointSetsView.cpp QmitkCorrespondingPointSetsModel.cpp QmitkCorrespondingPointSetsWidget.cpp QmitkVideoBackground.cpp QmitkHotkeyLineEdit.cpp QmitkBoundingObjectWidget.cpp QmitkModuleTableModel.cpp QmitkModulesDialog.cpp QmitkHistogramJSWidget.cpp QmitkWebPage.cpp QmitkLineEdit.cpp ) -QT4_ADD_RESOURCES(CPP_FILES resources/QmitkResources.qrc) - - set(MOC_H_FILES QmitkPropertyObservers/QmitkBasePropertyView.h QmitkPropertyObservers/QmitkBoolPropertyWidget.h QmitkPropertyObservers/QmitkColorPropertyEditor.h QmitkPropertyObservers/QmitkColorPropertyView.h QmitkPropertyObservers/QmitkEnumerationPropertyWidget.h QmitkPropertyObservers/QmitkNumberPropertyEditor.h QmitkPropertyObservers/QmitkNumberPropertyView.h QmitkPropertyObservers/QmitkStringPropertyEditor.h QmitkPropertyObservers/QmitkStringPropertyOnDemandEdit.h QmitkPropertyObservers/QmitkStringPropertyView.h QmitkPropertyObservers/QmitkNumberPropertySlider.h QmitkPropertyObservers/QmitkUGCombinedRepresentationPropertyWidget.h qclickablelabel.h QmitkCallbackFromGUIThread.h QmitkEditPointDialog.h QmitkStandardViews.h QmitkStepperAdapter.h QmitkSliderNavigatorWidget.h QmitkSliceWidget.h QmitkColorTransferFunctionCanvas.h QmitkPiecewiseFunctionCanvas.h QmitkTransferFunctionCanvas.h QmitkFloatingPointSpanSlider.h QmitkCrossWidget.h QmitkTransferFunctionWidget.h QmitkTransferFunctionGeneratorWidget.h QmitkPrimitiveMovieNavigatorWidget.h QmitkPlotWidget.h QmitkPointListModel.h QmitkPointListView.h QmitkPointListWidget.h QmitkPointListViewWidget.h QmitkCorrespondingPointSetsView.h QmitkCorrespondingPointSetsModel.h QmitkCorrespondingPointSetsWidget.h QmitkHistogramWidget.h QmitkVideoBackground.h QmitkFileChooser.h QmitkHotkeyLineEdit.h QmitkAboutDialog/QmitkAboutDialog.h QmitkBoundingObjectWidget.h QmitkPlotWidget.h QmitkHistogramJSWidget.h QmitkWebPage.h QmitkLineEdit.h ) set(UI_FILES QmitkSliderNavigator.ui QmitkSliceWidget.ui QmitkTransferFunctionWidget.ui QmitkTransferFunctionGeneratorWidget.ui QmitkSelectableGLWidget.ui QmitkPrimitiveMovieNavigatorWidget.ui QmitkAboutDialog/QmitkAboutDialogGUI.ui ) set(QRC_FILES QmitkExt.qrc + resources/QmitkResources.qrc ) diff --git a/Modules/QmlMitk/CMakeLists.txt b/Modules/QmlMitk/CMakeLists.txt index 3ee6fc3523..91aa95c5e9 100644 --- a/Modules/QmlMitk/CMakeLists.txt +++ b/Modules/QmlMitk/CMakeLists.txt @@ -1,5 +1,5 @@ MITK_CREATE_MODULE(QmlMitk INCLUDE_DIRS InteractionLegacy DEPENDS Mitk OpenViewCore - QT5_MODULES Qt5Quick + PACKAGE_DEPENDS Qt5>Quick ) diff --git a/Modules/Qt4Qt5TestModule/CMakeLists.txt b/Modules/Qt4Qt5TestModule/CMakeLists.txt index b3f53bdb73..ca6135f4df 100644 --- a/Modules/Qt4Qt5TestModule/CMakeLists.txt +++ b/Modules/Qt4Qt5TestModule/CMakeLists.txt @@ -1,8 +1,8 @@ MITK_CREATE_MODULE(Qt4Qt5TestModule - QT4_MODULES QtCore # we want something in the Qt 4 case - QT5_MODULES Qt5Core # we want something else in the Qt 5 case + PACKAGE_DEPENDS Qt4>QtCore Qt5>Core SUBPROJECTS MITK-CoreUI WARNINGS_AS_ERRORS ) add_subdirectory(Testing) + diff --git a/Modules/Qt4Qt5TestModule/Testing/CMakeLists.txt b/Modules/Qt4Qt5TestModule/Testing/CMakeLists.txt index c26edbc7d0..dc15b118bd 100644 --- a/Modules/Qt4Qt5TestModule/Testing/CMakeLists.txt +++ b/Modules/Qt4Qt5TestModule/Testing/CMakeLists.txt @@ -1,5 +1,5 @@ -list(APPEND PACKAGE_DEPENDS ITK) - MITK_CREATE_MODULE_TESTS() -mitk_use_modules(TARGET ${TESTDRIVER} MODULES Mitk QT4_MODULES QtTest QT5_MODULES Qt5Test) +if(TESTDRIVER AND TARGET ${TESTDRIVER}) + mitk_use_modules(TARGET ${TESTDRIVER} PACKAGES Qt4>QtTest Qt5>Test) +endif() diff --git a/Modules/Remeshing/CMakeLists.txt b/Modules/Remeshing/CMakeLists.txt index e9a1809222..334f990354 100644 --- a/Modules/Remeshing/CMakeLists.txt +++ b/Modules/Remeshing/CMakeLists.txt @@ -1,8 +1,8 @@ if(MITK_USE_ACVD) MITK_CREATE_MODULE(Remeshing DEPENDS Mitk - PACKAGE_DEPENDS ACVD + PACKAGE_DEPENDS ACVD VTK>vtkIOPLY|vtkIOMINC ) add_subdirectory(Testing) endif() diff --git a/Modules/RigidRegistration/CMakeLists.txt b/Modules/RigidRegistration/CMakeLists.txt index ae71051393..e5997507ca 100644 --- a/Modules/RigidRegistration/CMakeLists.txt +++ b/Modules/RigidRegistration/CMakeLists.txt @@ -1,8 +1,8 @@ MITK_CREATE_MODULE(MitkRigidRegistration SUBPROJECTS MITK-Registration DEPENDS Mitk - QT4_MODULES QtGui + PACKAGE_DEPENDS ITK>ITKRegistrationCommon EXPORT_DEFINE MITK_RIGIDREGISTRATION_EXPORT ) add_subdirectory(Testing) diff --git a/Modules/RigidRegistrationUI/CMakeLists.txt b/Modules/RigidRegistrationUI/CMakeLists.txt index 871aa796a3..c5b3465744 100644 --- a/Modules/RigidRegistrationUI/CMakeLists.txt +++ b/Modules/RigidRegistrationUI/CMakeLists.txt @@ -1,7 +1,6 @@ MITK_CREATE_MODULE(MitkRigidRegistrationUI SUBPROJECTS MITK-Registration INCLUDE_DIRS RigidRegistrationMetrics RigidRegistrationOptimizer RigidRegistrationTransforms DEPENDS Qmitk MitkRigidRegistration - QT4_MODULES QtGui EXPORT_DEFINE MITK_RIGIDREGISTRATION_UI_EXPORT ) diff --git a/Modules/Segmentation/CMakeLists.txt b/Modules/Segmentation/CMakeLists.txt index bea90f5bdf..3e735781d2 100644 --- a/Modules/Segmentation/CMakeLists.txt +++ b/Modules/Segmentation/CMakeLists.txt @@ -1,6 +1,7 @@ MITK_CREATE_MODULE(Segmentation INCLUDE_DIRS Algorithms Controllers DataManagement Interactions IO Rendering SegmentationUtilities/BooleanOperations SegmentationUtilities/MorphologicalOperations DEPENDS MitkAlgorithmsExt ipSegmentation mitkIpFunc LegacyAdaptors SurfaceInterpolation MitkGraphAlgorithms ContourModel + PACKAGE_DEPENDS ITK>ITKBinaryMathematicalMorphology|ITKLabelVoting|ITKRegionGrowing|ITKFastMarching|ITKAnisotropicSmoothing|ITKWatersheds ) add_subdirectory(Testing) diff --git a/Modules/SegmentationUI/CMakeLists.txt b/Modules/SegmentationUI/CMakeLists.txt index a6a331c06e..095e400d1b 100644 --- a/Modules/SegmentationUI/CMakeLists.txt +++ b/Modules/SegmentationUI/CMakeLists.txt @@ -1,6 +1,5 @@ MITK_CREATE_MODULE ( SegmentationUI INCLUDE_DIRS Qmitk DEPENDS Qmitk Segmentation QmitkExt PACKAGE_DEPENDS CTK -QT4_MODULES QtCore QtGui ) diff --git a/Modules/ToFUI/CMakeLists.txt b/Modules/ToFUI/CMakeLists.txt index 07b31b76c8..9c0235f423 100644 --- a/Modules/ToFUI/CMakeLists.txt +++ b/Modules/ToFUI/CMakeLists.txt @@ -1,8 +1,7 @@ MITK_CREATE_MODULE(mitkTOFUI SUBPROJECTS MITK-ToF INCLUDE_DIRS Qmitk DEPENDS mitkToFHardware mitkToFProcessing Qmitk QmitkExt Overlays - QT4_MODULES QtGui GENERATED_CPP ${TOOL_GUI_CPPS} ${TOOL_CPPS} ) diff --git a/Modules/USUI/CMakeLists.txt b/Modules/USUI/CMakeLists.txt index 586355d8a6..97ca520acc 100644 --- a/Modules/USUI/CMakeLists.txt +++ b/Modules/USUI/CMakeLists.txt @@ -1,8 +1,7 @@ MITK_CREATE_MODULE(MitkUSUI #SUBPROJECTS MITK-US INCLUDE_DIRS Qmitk DEPENDS Mitk MitkUS Qmitk QmitkExt - QT4_MODULES QtGui GENERATED_CPP ${TOOL_GUI_CPPS} ${TOOL_CPPS} ) diff --git a/Plugins/org.mitk.core.ext/CMakeLists.txt b/Plugins/org.mitk.core.ext/CMakeLists.txt index 70e4d3cc8e..f3aa14ab27 100755 --- a/Plugins/org.mitk.core.ext/CMakeLists.txt +++ b/Plugins/org.mitk.core.ext/CMakeLists.txt @@ -1,8 +1,8 @@ project(org_mitk_core_ext) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MITKCOREEXT_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES Mitk + MODULE_DEPENDS Mitk ) diff --git a/Plugins/org.mitk.diffusionimaging/CMakeLists.txt b/Plugins/org.mitk.diffusionimaging/CMakeLists.txt index ba767e783a..a9f047722b 100644 --- a/Plugins/org.mitk.diffusionimaging/CMakeLists.txt +++ b/Plugins/org.mitk.diffusionimaging/CMakeLists.txt @@ -1,7 +1,7 @@ project(org_mitk_diffusionimaging) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE ORG_MITK_DIFFUSIONIMAGING_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES DiffusionCore Quantification FiberTracking Connectomics QmitkExt + MODULE_DEPENDS DiffusionCore Quantification FiberTracking Connectomics QmitkExt ) diff --git a/Plugins/org.mitk.gui.qt.application/CMakeLists.txt b/Plugins/org.mitk.gui.qt.application/CMakeLists.txt index 13f1aa6dff..79e396590d 100644 --- a/Plugins/org.mitk.gui.qt.application/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.application/CMakeLists.txt @@ -1,8 +1,8 @@ project(org_mitk_gui_qt_application) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MITK_QT_APP EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES Qmitk + MODULE_DEPENDS Qmitk SUBPROJECTS MITK-CoreUI ) diff --git a/Plugins/org.mitk.gui.qt.basicimageprocessing/CMakeLists.txt b/Plugins/org.mitk.gui.qt.basicimageprocessing/CMakeLists.txt index 912d6149e0..4241199834 100644 --- a/Plugins/org.mitk.gui.qt.basicimageprocessing/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.basicimageprocessing/CMakeLists.txt @@ -1,10 +1,11 @@ #MACRO_CREATE_MITK_PLUGIN(QmitkExt) project(org_mitk_gui_qt_basicimageprocessing) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE BASICIMAGEPROCESSING_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt MitkMapperExt + MODULE_DEPENDS QmitkExt MitkMapperExt + PACKAGE_DEPENDS ITK>ITKMathematicalMorphology ) diff --git a/Plugins/org.mitk.gui.qt.cmdlinemodules/CMakeLists.txt b/Plugins/org.mitk.gui.qt.cmdlinemodules/CMakeLists.txt index 04dbdb5f28..0b92480228 100644 --- a/Plugins/org.mitk.gui.qt.cmdlinemodules/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.cmdlinemodules/CMakeLists.txt @@ -1,9 +1,8 @@ project(org_mitk_gui_qt_cmdlinemodules) -set(PLUGIN_QT4_MODULES QtUiTools) - MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE CLI_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES CTK QmitkExt + MODULE_DEPENDS QmitkExt + PACKAGE_DEPENDS CTK Qt4>QtUiTools ) diff --git a/Plugins/org.mitk.gui.qt.common.legacy/CMakeLists.txt b/Plugins/org.mitk.gui.qt.common.legacy/CMakeLists.txt index 44b99188a2..1402ea96ab 100755 --- a/Plugins/org.mitk.gui.qt.common.legacy/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.common.legacy/CMakeLists.txt @@ -1,8 +1,8 @@ project(org_mitk_gui_qt_common_legacy) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MITK_QT_COMMON_LEGACY EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES Qmitk + MODULE_DEPENDS Qmitk SUBPROJECTS MITK-CoreUI ) diff --git a/Plugins/org.mitk.gui.qt.common/CMakeLists.txt b/Plugins/org.mitk.gui.qt.common/CMakeLists.txt index a87e750b5c..ab83281f83 100755 --- a/Plugins/org.mitk.gui.qt.common/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.common/CMakeLists.txt @@ -1,8 +1,8 @@ project(org_mitk_gui_qt_common) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MITK_QT_COMMON EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES Qmitk + MODULE_DEPENDS Qmitk SUBPROJECTS MITK-CoreUI ) diff --git a/Plugins/org.mitk.gui.qt.common/testing/CMakeLists.txt b/Plugins/org.mitk.gui.qt.common/testing/CMakeLists.txt index 699b815cce..eb5562eaf1 100644 --- a/Plugins/org.mitk.gui.qt.common/testing/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.common/testing/CMakeLists.txt @@ -1,13 +1,13 @@ project(org_mitk_gui_qt_common_tests) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE org_mitk_gui_qt_common_tests_EXPORT EXPORTED_INCLUDE_SUFFIXES src src/api - MODULE_DEPENDENCIES Qmitk + MODULE_DEPENDS Qmitk TEST_PLUGIN ) target_link_libraries(${PROJECT_NAME} optimized CppUnit debug CppUnitd) MACRO_TEST_UIPLUGIN(${MITK_DEFAULT_SUBPROJECTS}) diff --git a/Plugins/org.mitk.gui.qt.coreapplication/CMakeLists.txt b/Plugins/org.mitk.gui.qt.coreapplication/CMakeLists.txt index ec694bbe8f..a730054072 100644 --- a/Plugins/org.mitk.gui.qt.coreapplication/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.coreapplication/CMakeLists.txt @@ -1,8 +1,8 @@ project(org_mitk_gui_qt_coreapplication) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MITK_QT_COREAPP EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES Qmitk + MODULE_DEPENDS Qmitk SUBPROJECTS MITK-CoreUI ) diff --git a/Plugins/org.mitk.gui.qt.datamanager/CMakeLists.txt b/Plugins/org.mitk.gui.qt.datamanager/CMakeLists.txt index 7c2993de13..4cbc1392c0 100644 --- a/Plugins/org.mitk.gui.qt.datamanager/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.datamanager/CMakeLists.txt @@ -1,6 +1,6 @@ project(org_mitk_gui_qt_datamanager) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MITK_QT_DATAMANAGER EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt) + MODULE_DEPENDS QmitkExt) diff --git a/Plugins/org.mitk.gui.qt.dicom/CMakeLists.txt b/Plugins/org.mitk.gui.qt.dicom/CMakeLists.txt index f379e7d3ab..7e63b2f934 100644 --- a/Plugins/org.mitk.gui.qt.dicom/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.dicom/CMakeLists.txt @@ -1,20 +1,20 @@ project(org_mitk_gui_qt_dicom) find_program(DCMTK_STORESCP storescp PATHS "${DCMTK_DIR}/bin" PATH_SUFFIXES Release Debug DOC "Dcmtk storage provider which is used to store dicom files which are transfered over network." NO_DEFAULT_PATH) mark_as_advanced(DCMTK_STORESCP) if(NOT EXISTS ${DCMTK_STORESCP}) message(WARNING "Couldn't find program storescp without the program query retrieve of the dicom plugin won't work!") else(NOT EXISTS ${DCMTK_STORESCP}) configure_file( org_mitk_gui_qt_dicom_config.h.in org_mitk_gui_qt_dicom_config.h @ONLY) MITK_INSTALL_HELPER_APP(${DCMTK_STORESCP}) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE DICOM_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt mitkDicomUI + MODULE_DEPENDS QmitkExt mitkDicomUI ) endif() diff --git a/Plugins/org.mitk.gui.qt.diffusionimaging/CMakeLists.txt b/Plugins/org.mitk.gui.qt.diffusionimaging/CMakeLists.txt index 0d9ded573b..d9209a1716 100644 --- a/Plugins/org.mitk.gui.qt.diffusionimaging/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.diffusionimaging/CMakeLists.txt @@ -1,7 +1,8 @@ project(org_mitk_gui_qt_diffusionimaging) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE DIFFUSIONIMAGING_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt Connectomics FiberTracking DiffusionCore Quantification + MODULE_DEPENDS QmitkExt Connectomics FiberTracking DiffusionCore Quantification + PACKAGE_DEPENDS ITK>ITKDiffusionTensorImage ) diff --git a/Plugins/org.mitk.gui.qt.diffusionimagingapp/CMakeLists.txt b/Plugins/org.mitk.gui.qt.diffusionimagingapp/CMakeLists.txt index c4498d22fd..2a74e0d53f 100644 --- a/Plugins/org.mitk.gui.qt.diffusionimagingapp/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.diffusionimagingapp/CMakeLists.txt @@ -1,15 +1,11 @@ # The project name must correspond to the directory name of your plug-in # and must not contain periods. project(org_mitk_gui_qt_diffusionimagingapp) -set(PLUGIN_QT4_MODULES QtWebKit) - MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE DIFFUSIONIMAGING_APP_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES Qmitk SceneSerialization + MODULE_DEPENDS Qmitk SceneSerialization + PACKAGE_DEPENDS Qt4>QtWebKit ) -if(QT_QTWEBKIT_FOUND) - add_definitions(-DQT_WEBKIT) -endif(QT_QTWEBKIT_FOUND) diff --git a/Plugins/org.mitk.gui.qt.dtiatlasapp/CMakeLists.txt b/Plugins/org.mitk.gui.qt.dtiatlasapp/CMakeLists.txt index 4119f8f41d..2908a91dc1 100644 --- a/Plugins/org.mitk.gui.qt.dtiatlasapp/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.dtiatlasapp/CMakeLists.txt @@ -1,15 +1,11 @@ # The project name must correspond to the directory name of your plug-in # and must not contain periods. project(org_mitk_gui_qt_dtiatlasapp) -set(PLUGIN_QT4_MODULES QtWebKit) - MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE DTIATLAS_APP_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES Qmitk SceneSerialization + MODULE_DEPENDS Qmitk SceneSerialization + PACKAGE_DEPENDS Qt4>QtWebKit ) -if(QT_QTWEBKIT_FOUND) - add_definitions(-DQT_WEBKIT) -endif(QT_QTWEBKIT_FOUND) diff --git a/Plugins/org.mitk.gui.qt.ext/CMakeLists.txt b/Plugins/org.mitk.gui.qt.ext/CMakeLists.txt index 10fc9463f2..fe67cce6d7 100644 --- a/Plugins/org.mitk.gui.qt.ext/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.ext/CMakeLists.txt @@ -1,7 +1,7 @@ project(org_mitk_gui_qt_ext) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MITK_QT_COMMON_EXT_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt SceneSerialization + MODULE_DEPENDS QmitkExt SceneSerialization ) diff --git a/Plugins/org.mitk.gui.qt.extapplication/CMakeLists.txt b/Plugins/org.mitk.gui.qt.extapplication/CMakeLists.txt index bc737494af..f090f401cd 100644 --- a/Plugins/org.mitk.gui.qt.extapplication/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.extapplication/CMakeLists.txt @@ -1,12 +1,8 @@ project(org_mitk_gui_qt_extapplication) -set(PLUGIN_QT4_MODULES QtWebKit QtGui) - MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MITK_QT_EXTAPP EXPORTED_INCLUDE_SUFFIXES src + PACKAGE_DEPENDS Qt4>QtWebKit ) -if(QT_QTWEBKIT_FOUND) - add_definitions(-DQT_WEBKIT) -endif(QT_QTWEBKIT_FOUND) diff --git a/Plugins/org.mitk.gui.qt.igtexamples/CMakeLists.txt b/Plugins/org.mitk.gui.qt.igtexamples/CMakeLists.txt index 4b6474cfa4..5fc3370cb2 100644 --- a/Plugins/org.mitk.gui.qt.igtexamples/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.igtexamples/CMakeLists.txt @@ -1,9 +1,9 @@ # The project name must correspond to the directory name of your plug-in # and must not contain periods. project(org_mitk_gui_qt_igtexamples) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE IGTEXAMPLES_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt MitkIGT MitkIGTUI + MODULE_DEPENDS QmitkExt MitkIGT MitkIGTUI ) \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.igttracking/CMakeLists.txt b/Plugins/org.mitk.gui.qt.igttracking/CMakeLists.txt index ebf61bfd66..224b64770a 100644 --- a/Plugins/org.mitk.gui.qt.igttracking/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.igttracking/CMakeLists.txt @@ -1,7 +1,7 @@ project(org_mitk_gui_qt_igttracking) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE IGTTRACKING_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt MitkMapperExt MitkIGT MitkIGTUI + MODULE_DEPENDS QmitkExt MitkMapperExt MitkIGT MitkIGTUI ) diff --git a/Plugins/org.mitk.gui.qt.imagecropper/CMakeLists.txt b/Plugins/org.mitk.gui.qt.imagecropper/CMakeLists.txt index abba489ac9..0029ae83d8 100644 --- a/Plugins/org.mitk.gui.qt.imagecropper/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.imagecropper/CMakeLists.txt @@ -1,12 +1,8 @@ project(org_mitk_gui_qt_imagecropper) MACRO_CREATE_MITK_CTK_PLUGIN( - EXPORT_DIRECTIVE MITK_QT_IMAGECROPPER - EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt + EXPORT_DIRECTIVE MITK_QT_IMAGECROPPER + EXPORTED_INCLUDE_SUFFIXES src + MODULE_DEPENDS QmitkExt ) - - - -#MACRO_CREATE_MITK_PLUGIN(QmitkExt) diff --git a/Plugins/org.mitk.gui.qt.imagenavigator/CMakeLists.txt b/Plugins/org.mitk.gui.qt.imagenavigator/CMakeLists.txt index 023147478a..5bc7ef417f 100644 --- a/Plugins/org.mitk.gui.qt.imagenavigator/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.imagenavigator/CMakeLists.txt @@ -1,9 +1,9 @@ # The project name must correspond to the directory name of your plug-in # and must not contain periods. project(org_mitk_gui_qt_imagenavigator) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE IMAGENAVIGATOR_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt + MODULE_DEPENDS QmitkExt ) diff --git a/Plugins/org.mitk.gui.qt.materialeditor/CMakeLists.txt b/Plugins/org.mitk.gui.qt.materialeditor/CMakeLists.txt index 93d46f514d..4826896474 100644 --- a/Plugins/org.mitk.gui.qt.materialeditor/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.materialeditor/CMakeLists.txt @@ -1,9 +1,9 @@ # The project name must correspond to the directory name of your plug-in # and must not contain periods. project(org_mitk_gui_qt_materialeditor) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MATERIALEDITOR_EXPORTS EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES Qmitk + MODULE_DEPENDS Qmitk ) diff --git a/Plugins/org.mitk.gui.qt.measurementtoolbox/CMakeLists.txt b/Plugins/org.mitk.gui.qt.measurementtoolbox/CMakeLists.txt index c5df7dc217..fa3393d9bc 100644 --- a/Plugins/org.mitk.gui.qt.measurementtoolbox/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.measurementtoolbox/CMakeLists.txt @@ -1,9 +1,9 @@ # The project name must correspond to the directory name of your plug-in # and must not contain periods. project(org_mitk_gui_qt_measurementtoolbox) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MITK_QT_MEASUREMENTTOOLBOX EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt ImageStatistics PlanarFigure + MODULE_DEPENDS QmitkExt ImageStatistics PlanarFigure ) diff --git a/Plugins/org.mitk.gui.qt.meshdecimation/CMakeLists.txt b/Plugins/org.mitk.gui.qt.meshdecimation/CMakeLists.txt index 514256f123..ba6d66ccd3 100644 --- a/Plugins/org.mitk.gui.qt.meshdecimation/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.meshdecimation/CMakeLists.txt @@ -1,8 +1,8 @@ PROJECT(org_mitk_gui_qt_meshdecimation) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MESHDECIMATION_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt + MODULE_DEPENDS QmitkExt ) diff --git a/Plugins/org.mitk.gui.qt.moviemaker/CMakeLists.txt b/Plugins/org.mitk.gui.qt.moviemaker/CMakeLists.txt index 2302510722..d81f06050c 100644 --- a/Plugins/org.mitk.gui.qt.moviemaker/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.moviemaker/CMakeLists.txt @@ -1,9 +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) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MOVIEMAKER_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt -) \ No newline at end of file + MODULE_DEPENDS QmitkExt + PACKAGE_DEPENDS VTK>vtkTestingCore +) diff --git a/Plugins/org.mitk.gui.qt.pointsetinteraction/CMakeLists.txt b/Plugins/org.mitk.gui.qt.pointsetinteraction/CMakeLists.txt index de2c794a1b..3bc6e1e10e 100644 --- a/Plugins/org.mitk.gui.qt.pointsetinteraction/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.pointsetinteraction/CMakeLists.txt @@ -1,9 +1,9 @@ # The project name must correspond to the directory name of your plug-in # and must not contain periods. project(org_mitk_gui_qt_pointsetinteraction) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE POINTSETINTERACTION_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt + MODULE_DEPENDS QmitkExt ) \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.properties/CMakeLists.txt b/Plugins/org.mitk.gui.qt.properties/CMakeLists.txt index c81f7a67fa..b4cc07b87a 100644 --- a/Plugins/org.mitk.gui.qt.properties/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.properties/CMakeLists.txt @@ -1,7 +1,7 @@ project(org_mitk_gui_qt_properties) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE PROPERTIES_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt + MODULE_DEPENDS QmitkExt ) diff --git a/Plugins/org.mitk.gui.qt.python/CMakeLists.txt b/Plugins/org.mitk.gui.qt.python/CMakeLists.txt index 352805d7d5..a2f8984da0 100644 --- a/Plugins/org.mitk.gui.qt.python/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.python/CMakeLists.txt @@ -1,6 +1,6 @@ project(org_mitk_gui_qt_python) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE org_mitk_gui_qt_python_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt mitkPython) \ No newline at end of file + MODULE_DEPENDS QmitkExt mitkPython) \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.registration/CMakeLists.txt b/Plugins/org.mitk.gui.qt.registration/CMakeLists.txt index 467a796e1d..8478efd578 100644 --- a/Plugins/org.mitk.gui.qt.registration/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.registration/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_registration) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE REGISTRATION_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt MitkMapperExt MitkDeformableRegistration MitkDeformableRegistrationUI MitkRigidRegistration MitkRigidRegistrationUI Segmentation + MODULE_DEPENDS QmitkExt MitkMapperExt MitkDeformableRegistration MitkDeformableRegistrationUI MitkRigidRegistration MitkRigidRegistrationUI Segmentation ) diff --git a/Plugins/org.mitk.gui.qt.remeshing/CMakeLists.txt b/Plugins/org.mitk.gui.qt.remeshing/CMakeLists.txt index 975bb55eb2..15534b3f66 100644 --- a/Plugins/org.mitk.gui.qt.remeshing/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.remeshing/CMakeLists.txt @@ -1,9 +1,9 @@ project(org_mitk_gui_qt_remeshing) include_directories(${CTK_INCLUDE_DIRS}) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE REMESHING_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES Qmitk Remeshing + MODULE_DEPENDS Qmitk Remeshing ) diff --git a/Plugins/org.mitk.gui.qt.segmentation/CMakeLists.txt b/Plugins/org.mitk.gui.qt.segmentation/CMakeLists.txt index a93da2b458..66fe95907b 100644 --- a/Plugins/org.mitk.gui.qt.segmentation/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.segmentation/CMakeLists.txt @@ -1,9 +1,9 @@ project(org_mitk_gui_qt_segmentation) include_directories(${CTK_INCLUDE_DIRS}) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MITK_QT_SEGMENTATION EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt ClippingTools Segmentation SegmentationUI + MODULE_DEPENDS QmitkExt ClippingTools Segmentation SegmentationUI ) diff --git a/Plugins/org.mitk.gui.qt.simulation/CMakeLists.txt b/Plugins/org.mitk.gui.qt.simulation/CMakeLists.txt index e075434c20..7e164298b4 100644 --- a/Plugins/org.mitk.gui.qt.simulation/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.simulation/CMakeLists.txt @@ -1,7 +1,7 @@ project(org_mitk_gui_qt_simulation) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE SIMULATION_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES Qmitk Simulation + MODULE_DEPENDS Qmitk Simulation ) diff --git a/Plugins/org.mitk.gui.qt.stdmultiwidgeteditor/CMakeLists.txt b/Plugins/org.mitk.gui.qt.stdmultiwidgeteditor/CMakeLists.txt index 6b09099b4b..2c75288405 100755 --- a/Plugins/org.mitk.gui.qt.stdmultiwidgeteditor/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.stdmultiwidgeteditor/CMakeLists.txt @@ -1,8 +1,8 @@ project(org_mitk_gui_qt_stdmultiwidgeteditor) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE ORG_MITK_GUI_QT_STDMULTIWIDGETEDITOR EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES Qmitk + MODULE_DEPENDS Qmitk SUBPROJECTS MITK-CoreUI ) diff --git a/Plugins/org.mitk.gui.qt.toftutorial/CMakeLists.txt b/Plugins/org.mitk.gui.qt.toftutorial/CMakeLists.txt index 938ad4a72b..c5db3007cd 100644 --- a/Plugins/org.mitk.gui.qt.toftutorial/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.toftutorial/CMakeLists.txt @@ -1,9 +1,9 @@ # The project name must correspond to the directory name of your plug-in # and must not contain periods. project(org_mitk_gui_qt_toftutorial) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE TOFTUTORIAL_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt mitkToFHardware mitkToFProcessing + MODULE_DEPENDS QmitkExt mitkToFHardware mitkToFProcessing ) \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.tofutil/CMakeLists.txt b/Plugins/org.mitk.gui.qt.tofutil/CMakeLists.txt index 72549cb9df..d8760f7738 100644 --- a/Plugins/org.mitk.gui.qt.tofutil/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.tofutil/CMakeLists.txt @@ -1,11 +1,11 @@ # The project name must correspond to the directory name of your plug-in # and must not contain periods. project(org_mitk_gui_qt_tofutil) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE TOFUTIL_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES mitkToFHardware Qmitk QmitkExt mitkTOFUI + MODULE_DEPENDS mitkToFHardware Qmitk QmitkExt mitkTOFUI ) diff --git a/Plugins/org.mitk.gui.qt.ugvisualization/CMakeLists.txt b/Plugins/org.mitk.gui.qt.ugvisualization/CMakeLists.txt index ccda3e814a..85a164d073 100644 --- a/Plugins/org.mitk.gui.qt.ugvisualization/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.ugvisualization/CMakeLists.txt @@ -1,7 +1,7 @@ project(org_mitk_gui_qt_ugvisualization) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE UGVISUALIZATION_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt + MODULE_DEPENDS QmitkExt ) diff --git a/Plugins/org.mitk.gui.qt.ultrasound/CMakeLists.txt b/Plugins/org.mitk.gui.qt.ultrasound/CMakeLists.txt index 1cb2c03cc0..031ac75b5a 100644 --- a/Plugins/org.mitk.gui.qt.ultrasound/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.ultrasound/CMakeLists.txt @@ -1,9 +1,9 @@ project(org_mitk_gui_qt_ultrasound) include_directories(${CTK_INCLUDE_DIRS}) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE ULTRASOUND_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt MitkUS MitkUSUI + MODULE_DEPENDS QmitkExt MitkUS MitkUSUI ) \ No newline at end of file diff --git a/Plugins/org.mitk.gui.qt.volumevisualization/CMakeLists.txt b/Plugins/org.mitk.gui.qt.volumevisualization/CMakeLists.txt index b49d0c7069..8e60f1ea38 100755 --- a/Plugins/org.mitk.gui.qt.volumevisualization/CMakeLists.txt +++ b/Plugins/org.mitk.gui.qt.volumevisualization/CMakeLists.txt @@ -1,7 +1,7 @@ project(org_mitk_gui_qt_volumevisualization) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE MITK_QT_VOLUMEVISUALIZATION EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES QmitkExt + MODULE_DEPENDS QmitkExt ) diff --git a/Plugins/org.mitk.planarfigure/CMakeLists.txt b/Plugins/org.mitk.planarfigure/CMakeLists.txt index 447864ee61..44b1c8b801 100644 --- a/Plugins/org.mitk.planarfigure/CMakeLists.txt +++ b/Plugins/org.mitk.planarfigure/CMakeLists.txt @@ -1,7 +1,7 @@ project(org_mitk_planarfigure) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE ORG_MITK_PLANARFIGURE_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES PlanarFigure Qmitk + MODULE_DEPENDS PlanarFigure Qmitk ) diff --git a/Plugins/org.mitk.simulation/CMakeLists.txt b/Plugins/org.mitk.simulation/CMakeLists.txt index ead588d2af..d1d6187945 100644 --- a/Plugins/org.mitk.simulation/CMakeLists.txt +++ b/Plugins/org.mitk.simulation/CMakeLists.txt @@ -1,7 +1,7 @@ project(org_mitk_simulation) MACRO_CREATE_MITK_CTK_PLUGIN( EXPORT_DIRECTIVE SIMULATION_INIT_EXPORT EXPORTED_INCLUDE_SUFFIXES src - MODULE_DEPENDENCIES Qmitk Simulation + MODULE_DEPENDS Qmitk Simulation ) diff --git a/Utilities/qtsingleapplication/CMakeLists.txt b/Utilities/qtsingleapplication/CMakeLists.txt index ab36cd105f..d48468e504 100644 --- a/Utilities/qtsingleapplication/CMakeLists.txt +++ b/Utilities/qtsingleapplication/CMakeLists.txt @@ -1,38 +1,38 @@ if(MITK_USE_Qt4) # only if MITK is built with Qt 4 project(QtSingleApplication) set(_MOC_HEADERS qtlocalpeer.h qtsingleapplication.h qtsinglecoreapplication.h ) set(_HEADERS qthandlenewappinstance.h qtlockedfile.h ) set(_SOURCES qthandlenewappinstance.cpp qtlocalpeer.cpp qtsingleapplication.cpp qtsinglecoreapplication.cpp ) find_package(Qt4 REQUIRED) set(QT_USE_QTNETWORK 1) include(${QT_USE_FILE}) qt4_wrap_cpp(_SOURCES ${_MOC_HEADERS}) include_directories(${CMAKE_CURRENT_SOURCE_DIR}) add_library(qtsingleapplication STATIC ${_SOURCES}) target_link_libraries(qtsingleapplication ${QT_LIBRARIES}) MITK_CREATE_MODULE_CONF(qtsingleapplication INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} - QT4_MODULES QtNetwork QtGui) + PACKAGE_DEPENDS Qt4>QtNetwork|QtGui) endif(MITK_USE_Qt4) # only if MITK is built with Qt 4