diff --git a/CMake/mitkMacroCreateModule.cmake b/CMake/mitkMacroCreateModule.cmake index 92de6363bb..24ff53b602 100644 --- a/CMake/mitkMacroCreateModule.cmake +++ b/CMake/mitkMacroCreateModule.cmake @@ -1,186 +1,186 @@ ################################################################## # # MITK_CREATE_MODULE # # Creates a module for the automatic module dependeny system within MITK. # Configurations are generated in the moduleConf directory. # # USAGE: # # MITK_CREATE_MODULE( # [INCLUDE_DIRS ] # [INTERNAL_INCLUDE_DIRS ] # [DEPENDS ] # [PROVIDES ] # [PACKAGE_DEPENDS ] # [EXPORT_DEFINE ] # [QT_MODULE] # ################################################################## MACRO(MITK_CREATE_MODULE MODULE_NAME_IN) MACRO_PARSE_ARGUMENTS(MODULE "SUBPROJECTS;INCLUDE_DIRS;INTERNAL_INCLUDE_DIRS;DEPENDS;DEPENDS_INTERNAL;PROVIDES;PACKAGE_DEPENDS;EXPORT_DEFINE;ADDITIONAL_LIBS;GENERATED_CPP" "QT_MODULE;FORCE_STATIC;HEADERS_ONLY" ${ARGN}) SET(MODULE_NAME ${MODULE_NAME_IN}) 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() # assume worst case SET(MODULE_IS_ENABLED 0) # first of all we check for the dependencies MITK_CHECK_MODULE(_MISSING_DEP ${MODULE_DEPENDS}) IF(_MISSING_DEP) MESSAGE("Module ${MODULE_NAME} won't be built, missing dependency: ${_MISSING_DEP}") SET(MODULE_IS_ENABLED 0) ELSE(_MISSING_DEP) SET(MODULE_IS_ENABLED 1) # now check for every package if it is enabled. This overlaps a bit with # MITK_CHECK_MODULE ... FOREACH(_package ${MODULE_PACKAGE_DEPENDS}) IF((DEFINED MITK_USE_${_package}) AND NOT (MITK_USE_${_package})) MESSAGE("Module ${MODULE_NAME} won't be built. Turn on MITK_USE_${_package} if you want to use it.") SET(MODULE_IS_ENABLED 0) ENDIF() ENDFOREACH() IF(MODULE_IS_ENABLED) IF(NOT MODULE_QT_MODULE OR MITK_USE_QT) SET(MODULE_IS_ENABLED 1) _MITK_CREATE_MODULE_CONF() IF(NOT MODULE_EXPORT_DEFINE) SET(MODULE_EXPORT_DEFINE ${MODULE_NAME}_EXPORT) ENDIF(NOT MODULE_EXPORT_DEFINE) CONFIGURE_FILE(${MITK_SOURCE_DIR}/CMake/moduleExports.h.in ${MITK_MODULES_CONF_DIR}/${MODULE_NAME}Exports.h @ONLY) 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) SET(DEPENDS "${MODULE_DEPENDS}") SET(DEPENDS_BEFORE "not initialized") SET(PACKAGE_DEPENDS "${MODULE_PACKAGE_DEPENDS}") MITK_USE_MODULE("${MODULE_DEPENDS}") # ok, now create the module itself INCLUDE_DIRECTORIES(. ${ALL_INCLUDE_DIRECTORIES}) INCLUDE(files.cmake) IF(NOT MODULE_QT_MODULE) ORGANIZE_SOURCES(SOURCE ${CPP_FILES} HEADER ${H_FILES} TXX ${TXX_FILES} DOC ${DOX_FILES} ) IF(MODULE_FORCE_STATIC) SET(_STATIC ${MITK_WIN32_FORCE_STATIC}) ENDIF(MODULE_FORCE_STATIC) SET(coverage_sources ${CPP_FILES} ${H_FILES} ${GLOBBED__H_FILES} ${CORRESPONDING__H_FILES} ${TXX_FILES} ${TOOL_CPPS}) IF(MODULE_SUBPROJECTS) SET_PROPERTY(SOURCE ${coverage_sources} APPEND PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK) ENDIF() IF(NOT MODULE_HEADERS_ONLY) IF(ALL_LIBRARY_DIRS) # LINK_DIRECTORIES applies only to targets which are added after the call to LINK_DIRECTORIES LINK_DIRECTORIES(${ALL_LIBRARY_DIRS}) ENDIF(ALL_LIBRARY_DIRS) ADD_LIBRARY(${MODULE_PROVIDES} ${_STATIC} ${coverage_sources} ${CPP_FILES_GENERATED} ${DOX_FILES} ${UI_FILES}) IF(MODULE_SUBPROJECTS) SET_PROPERTY(TARGET ${MODULE_PROVIDES} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK) FOREACH(subproject ${MODULE_SUBPROJECTS}) ADD_DEPENDENCIES(${subproject} ${MODULE_PROVIDES}) ENDFOREACH() ENDIF() IF(ALL_LIBRARIES) TARGET_LINK_LIBRARIES(${MODULE_PROVIDES} ${ALL_LIBRARIES}) ENDIF(ALL_LIBRARIES) ENDIF() ELSE(NOT MODULE_QT_MODULE) INCLUDE(files.cmake) IF(UI_FILES) QT4_WRAP_UI(Q${KITNAME}_GENERATED_UI_CPP ${UI_FILES}) ENDIF(UI_FILES) IF(MOC_H_FILES) QT4_WRAP_CPP(Q${KITNAME}_GENERATED_MOC_CPP ${MOC_H_FILES}) ENDIF(MOC_H_FILES) IF(QRC_FILES) QT4_ADD_RESOURCES(Q${KITNAME}_GENERATED_QRC_CPP ${QRC_FILES}) ENDIF(QRC_FILES) 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}) # MITK_GENERATE_TOOLS_LIBRARY(Qmitk${LIBPOSTFIX} "NO") SET(coverage_sources ${CPP_FILES} ${CORRESPONDING__H_FILES} ${GLOBBED__H_FILES} ${TXX_FILES} ${TOOL_GUI_CPPS}) SET_PROPERTY(SOURCE ${coverage_sources} APPEND PROPERTY LABELS ${MODULE_SUBPROJECTS}) IF(NOT MODULE_HEADERS_ONLY) IF(ALL_LIBRARY_DIRS) # LINK_DIRECTORIES applies only to targets which are added after the call to LINK_DIRECTORIES LINK_DIRECTORIES(${ALL_LIBRARY_DIRS}) ENDIF(ALL_LIBRARY_DIRS) ADD_LIBRARY(${MODULE_PROVIDES} ${coverage_sources} ${CPP_FILES_GENERATED} ${Q${KITNAME}_GENERATED_CPP} ${DOX_FILES} ${UI_FILES} ${QRC_FILES}) TARGET_LINK_LIBRARIES(${MODULE_PROVIDES} ${QT_LIBRARIES} ${ALL_LIBRARIES} QVTK) IF(MODULE_SUBPROJECTS) SET_PROPERTY(TARGET ${MODULE_PROVIDES} PROPERTY LABELS ${MODULE_SUBPROJECTS} MITK) FOREACH(subproject ${MODULE_SUBPROJECTS}) ADD_DEPENDENCIES(${subproject} ${MODULE_PROVIDES}) ENDFOREACH() ENDIF() ENDIF() ENDIF(NOT MODULE_QT_MODULE) - IF(NOT MODULE_HEADERS_ONLY AND TARGET EP_MITK) - ADD_DEPENDENCIES(${MODULE_PROVIDES} EP_MITK) - ENDIF() + #IF(NOT MODULE_HEADERS_ONLY AND TARGET EP_MITK) + # ADD_DEPENDENCIES(${MODULE_PROVIDES} EP_MITK) + #ENDIF() # install only if shared lib (for now) IF(NOT _STATIC OR MINGW) IF(NOT MODULE_HEADERS_ONLY) # # deprecated: MITK_INSTALL_TARGETS(${MODULE_PROVIDES}) ENDIF() ENDIF(NOT _STATIC OR MINGW) ENDIF(NOT MODULE_QT_MODULE OR MITK_USE_QT) ENDIF(MODULE_IS_ENABLED) ENDIF(_MISSING_DEP) IF(NOT MODULE_IS_ENABLED) _MITK_CREATE_MODULE_CONF() ENDIF(NOT MODULE_IS_ENABLED) ENDMACRO(MITK_CREATE_MODULE) diff --git a/CMakeLists.txt b/CMakeLists.txt index a18b8ade7a..73248027f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,473 +1,474 @@ cmake_minimum_required(VERSION 2.8.2) #----------------------------------------------------------------------------- # 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() #----------------------------------------------------------------------------- # 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 ) foreach(policy ${project_policies}) if(POLICY ${policy}) cmake_policy(SET ${policy} NEW) endif() endforeach() #----------------------------------------------------------------------------- # Update CMake module path #------------------------------------------------------------------------------ set(CMAKE_MODULE_PATH ${MITK_SOURCE_DIR}/CMake ${CMAKE_MODULE_PATH} ) #----------------------------------------------------------------------------- # CMake Function(s) and Macro(s) #----------------------------------------------------------------------------- include(mitkMacroEmptyExternalProject) include(mitkFunctionGenerateProjectXml) #----------------------------------------------------------------------------- # 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(FATAL_ERROR "MITK_CMAKE_${type}_OUTPUT_DIRECTORY is set to a non-existing 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) # some targets in Utilities also depend on Qt. Use this option # to decide if they should be build option(MITK_USE_QT "Use Trolltech's Qt library" ON) if(MITK_USE_QT) # find the package at the very beginning, so that QT4_FOUND is available find_package(Qt4 4.6.0 REQUIRED) endif() option(MITK_INSTALL_RPATH_RELATIVE "Use relative rpath entries for installation packages" OFF) option(MITK_BUILD_ALL_PLUGINS "Build all MITK plugins" OFF) option(MITK_BUILD_TUTORIAL "Build the MITK tutorial" ON) option(MITK_USE_Boost "Use the Boost C++ library" OFF) option(MITK_USE_GDCMIO "Use the GDCMIO class instead of ImageIO2 for DICOM" ON) option(MITK_USE_BLUEBERRY "Build the BlueBerry platform" ON) option(MITK_USE_CTK "EXEPERIMENTAL, superbuild only: Use CTK in MITK" OFF) option(MITK_USE_DCMTK "EXEPERIMENTAL, superbuild only: Use DCMTK in MITK" OFF) option(MITK_USE_OPEN_CV "Use Intel's OpenCV library" OFF) mark_as_advanced(MITK_INSTALL_RPATH_RELATIVE MITK_BUILD_ALL_PLUGINS MITK_USE_CTK MITK_USE_DCMTK ) #----------------------------------------------------------------------------- # Additional CXX/C Flags #----------------------------------------------------------------------------- set(ADDITIONAL_C_FLAGS "" CACHE STRING "Additional C Flags") mark_as_advanced(ADDITIONAL_C_FLAGS) set(ADDITIONAL_CXX_FLAGS "" CACHE STRING "Additional CXX Flags") mark_as_advanced(ADDITIONAL_CXX_FLAGS) #----------------------------------------------------------------------------- # 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 ) # Configure CTestConfigSubProject.cmake that could be used by CTest scripts configure_file(${MITK_SOURCE_DIR}/CTestConfigSubProject.cmake.in ${MITK_BINARY_DIR}/CTestConfigSubProject.cmake) # Generate Project.xml file expected by the CTest driver script mitkFunctionGenerateProjectXml(${MITK_BINARY_DIR} ${PROJECT_NAME} "${CTEST_PROJECT_SUBPROJECTS}" ${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(mitkFunctionCheckCompilerFlags) include(mitkFunctionGetGccVersion) include(MacroParseArguments) include(mitkFunctionSuppressWarnings) # includes several functions include(mitkFunctionOrganizeSources) include(mitkFunctionGetVersion) include(mitkFunctionCreateWindowsBatchScript) include(mitkMacroCreateModuleConf) include(mitkMacroCreateModule) include(mitkMacroCheckModule) include(mitkMacroCreateModuleTests) include(mitkMacroUseModule) include(mitkMacroMultiplexPicType) include(mitkMacroInstall) include(mitkMacroInstallHelperApp) include(mitkMacroInstallTargets) include(mitkMacroGenerateToolsLibrary) #----------------------------------------------------------------------------- # Prerequesites #----------------------------------------------------------------------------- find_package(ITK REQUIRED) find_package(VTK REQUIRED) #----------------------------------------------------------------------------- # Set MITK specific options and variables (NOT available during superbuild) #----------------------------------------------------------------------------- # ASK THE USER TO SHOW THE CONSOLE WINDOW FOR CoreApp and ExtApp 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) #----------------------------------------------------------------------------- # Get MITK version info #----------------------------------------------------------------------------- mitkFunctionGetVersion(${MITK_SOURCE_DIR} MITK) #----------------------------------------------------------------------------- # 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 "${CMAKE_C_FLAGS} ${COVERAGE_C_FLAGS} ${ADDITIONAL_C_FLAGS}") set(MITK_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${VISIBILITY_CXX_FLAGS} ${COVERAGE_CXX_FLAGS} ${ADDITIONAL_CXX_FLAGS}") if(CMAKE_COMPILER_IS_GNUCXX) set(cflags "-Wall -Wextra -Wpointer-arith -Winvalid-pch -Wcast-align -Wwrite-strings -D_FORTIFY_SOURCE=2") mitkFunctionCheckCompilerFlags("-fdiagnostics-show-option" cflags) mitkFunctionCheckCompilerFlags("-Wl,--no-undefined" cflags) 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")) mitkFunctionCheckCompilerFlags("-fstack-protector-all" cflags) endif() if(MINGW) # suppress warnings about auto imported symbols set(MITK_CXX_FLAGS "-Wl,--enable-auto-import ${MITK_CXX_FLAGS}") # we need to define a Windows version set(MITK_CXX_FLAGS "-D_WIN32_WINNT=0x0500 ${MITK_CXX_FLAGS}") endif() set(MITK_C_FLAGS "${cflags} ${MITK_C_FLAGS}") #set(MITK_CXX_FLAGS "${cflags} -Woverloaded-virtual -Wold-style-cast -Wstrict-null-sentinel -Wsign-promo ${MITK_CXX_FLAGS}") set(MITK_CXX_FLAGS "${cflags} -Woverloaded-virtual -Wstrict-null-sentinel ${MITK_CXX_FLAGS}") endif() #----------------------------------------------------------------------------- # MITK Modules #----------------------------------------------------------------------------- set(MITK_MODULES_CONF_DIR ${MITK_BINARY_DIR}/modulesConf CACHE INTERNAL "Modules Conf") set(MITK_MODULES_PACKAGE_DEPENDS_DIR ${MITK_SOURCE_DIR}/CMake/PackageDepends) 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_GUI_TESTING OFF "Enable the MITK GUI tests") # 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() - configure_file(mitkTestingConfig.h.in ${MITK_BINARY_DIR}/mitkTestingConfig.h) 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 #----------------------------------------------------------------------------- add_subdirectory(Utilities) include(mitkSetupVariables) if(MITK_USE_BLUEBERRY) include(mitkSetupBlueBerry) endif() #----------------------------------------------------------------------------- # Set C/CXX Flags for MITK code #----------------------------------------------------------------------------- set(CMAKE_CXX_FLAGS ${MITK_CXX_FLAGS}) set(CMAKE_C_FLAGS ${MITK_C_FLAGS}) if(MITK_USE_QT) add_definitions(-DQWT_DLL) endif() #----------------------------------------------------------------------------- # Add custom targets representing CDash subprojects #----------------------------------------------------------------------------- foreach(subproject ${CTEST_PROJECT_SUBPROJECTS}) if(NOT TARGET ${subproject}) add_custom_target(${subproject}) endif() endforeach() #----------------------------------------------------------------------------- # Add subdirectories #----------------------------------------------------------------------------- link_directories(${MITK_LINK_DIRECTORIES}) add_subdirectory(Core) add_subdirectory(CoreUI) add_subdirectory(Modules) add_subdirectory(Applications) #----------------------------------------------------------------------------- # Python Wrapping #----------------------------------------------------------------------------- set(MITK_WRAPPING_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Wrapping) set(MITK_WRAPPING_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Wrapping) option(MITK_USE_PYTHON "Build cswig Python wrapper support (requires CableSwig)." OFF) if(MITK_USE_PYTHON) add_subdirectory(Wrapping) endif() #----------------------------------------------------------------------------- # Documentation #----------------------------------------------------------------------------- add_subdirectory(Documentation) #----------------------------------------------------------------------------- # Installation #----------------------------------------------------------------------------- if(MITK_INSTALL_RPATH_RELATIVE) set(CMAKE_INSTALL_RPATH ".") else() set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/bin") endif() # on Mac OSX all BlueBerry plugins get copied into every # application bundle (.app directory) specified here if(APPLE) if(MITK_BUILD_org.mitk.gui.qt.extapplication) set(MACOSX_BUNDLE_NAMES ${MACOSX_BUNDLE_NAMES} ExtApp) endif() if(MITK_BUILD_org.mitk.gui.qt.application) set(MACOSX_BUNDLE_NAMES ${MACOSX_BUNDLE_NAMES} CoreApp) endif() endif(APPLE) # set MITK cpack variables include(mitkSetupCPack) if(MITK_BUILD_org.mitk.gui.qt.application) list(APPEND CPACK_CREATE_DESKTOP_LINKS "CoreApp") endif() if(MITK_BUILD_org.mitk.gui.qt.extapplication) list(APPEND CPACK_CREATE_DESKTOP_LINKS "ExtApp") endif() configure_file(${MITK_SOURCE_DIR}/MITKCPackOptions.cmake.in ${MITK_BINARY_DIR}/MITKCPackOptions.cmake @ONLY) set(CPACK_PROJECT_CONFIG_FILE "${MITK_BINARY_DIR}/MITKCPackOptions.cmake") # 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}) if(MITK_USE_BLUEBERRY) set(enabled_plugins ${BLUEBERRY_ENABLED_PLUGINS} ${MITK_CORE_ENABLED_PLUGINS} ${MITK_MODULES_ENABLED_PLUGINS} ) # This is for installation support of external projects depending on # MITK plugins. The export file should not be used for linking to MITK # libraries without using LINK_DIRECTORIES, since the exports are incomplete # yet(depending libraries are not exported). foreach(plugin ${enabled_plugins}) string(REPLACE "." "_" plugin_target ${plugin}) export(TARGETS ${plugin_target} APPEND FILE ${MITK_EXPORTS_FILE}) endforeach() endif() configure_file(${MITK_SOURCE_DIR}/CMake/ToolExtensionITKFactory.cpp.in ${MITK_BINARY_DIR}/ToolExtensionITKFactory.cpp.in COPYONLY) configure_file(${MITK_SOURCE_DIR}/CMake/ToolExtensionITKFactoryLoader.cpp.in ${MITK_BINARY_DIR}/ToolExtensionITKFactoryLoader.cpp.in COPYONLY) configure_file(${MITK_SOURCE_DIR}/CMake/ToolGUIExtensionITKFactory.cpp.in ${MITK_BINARY_DIR}/ToolGUIExtensionITKFactory.cpp.in COPYONLY) configure_file(mitkVersion.h.in ${MITK_BINARY_DIR}/mitkVersion.h) configure_file(mitkConfig.h.in ${MITK_BINARY_DIR}/mitkConfig.h) set(VECMATH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/vecmath) set(IPFUNC_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities/ipFunc) set(UTILITIES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Utilities) configure_file(mitkConfig.h.in ${MITK_BINARY_DIR}/mitkConfig.h) configure_file(MITKConfig.cmake.in ${MITK_BINARY_DIR}/MITKConfig.cmake @ONLY) diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleView.h b/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleView.h index a0bc56036a..30326f8c7b 100644 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleView.h +++ b/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTExampleView.h @@ -1,259 +1,258 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-06 10:44:43 +0200 (Mi, 06 Mai 2009) $ Version: $Revision: 17109 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html 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 notices for more information. =========================================================================*/ #if !defined(QmitkIGTExampleView_H__INCLUDED) #define QmitkIGTExampleView_H__INCLUDED #include "QmitkFunctionality.h" -#include "mitkTestingConfig.h" #include "mitkTrackingDeviceSource.h" #include "mitkNavigationDataDisplacementFilter.h" #include "mitkTrackingDevice.h" #include "mitkNavigationDataRecorder.h" #include "mitkNavigationDataPlayer.h" #include "mitkNavigationDataToPointSetFilter.h" #include "mitkNavigationDataToMessageFilter.h" #include "QmitkPlotWidget.h" #include "ui_QmitkIGTExampleViewControls.h" #include "../IgtexampleDll.h" class QmitkStdMultiWidget; class QmitkIGTExampleViewControls; class QTextEdit; /*! \brief QmitkIGTExampleView Example functionality that shows the usage of the MITK-IGT component \sa QmitkFunctionality \ingroup Functionalities */ class QmitkIGTExampleView : public QObject, public QmitkFunctionality { Q_OBJECT public: /*! \brief default constructor */ QmitkIGTExampleView(QObject *parent=0, const char *name=0); /*! \brief default destructor */ virtual ~QmitkIGTExampleView(); /*! \brief method for creating the widget containing the application controls, like sliders, buttons etc. */ virtual void CreateQtPartControl(QWidget *parent); virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget); virtual void StdMultiWidgetNotAvailable(); /*! \brief method for creating the connections of main and control widget */ virtual void CreateConnections(); virtual void AddToFunctionalityOptionsList(mitk::PropertyList* p); /*! \brief method for creating an QAction object, i.e. button & menu entry @param parent the parent QWidget */ //Port virtual QAction * CreateAction(QActionGroup *parent); /*! \brief method is called when the bundle is started */ virtual void Activated(); /*! \brief method is called when the bundle is closed */ virtual void Deactivated(); #ifdef BUILD_TESTING /** * \brief This method performs an automated functionality test. */ virtual int TestYourself(); #endif protected slots: /**Documentation * \brief executes MITK-IGT-Tracking code * * This method will create and initialize a mitk::NDITrackingDevice with one tool. * It will start the tracking, read the tracking data from the tool 50 times and * then clean up everything. */ void OnTestTracking(); /**Documentation * \brief executes MITK-IGT-Navigation code * * This method will create and initialize a mitk::NDITrackingDevice with one tool. * Then it builds an example MITK-IGT filter pipeline: * - TrackingDeviceSource filter initialized with the NDITrackingDevice as source of the pipeline * - NavigationDataDisplacementFilter * The Offset parameter of the displacement filter is searched in the functionality's options list. * It can be written to that list either by the method OnParametersChanged() that gets called after * the user changes the parameter in the GUI or by the persistence mechanism of MITK (the complete * options list will be saved to disk on application exit and restored on the next application restart). * if the Offset parameter is not found in the list, a default value is used. * After building the filter pipeline, it is initialized and tracking is started, so that following * calls to OnMeasure() can trigger pipeline updates and retrieve NavigationData objects. */ void OnTestNavigation(); /**Documentation * \brief performs one measurement using the navigation pipeline * * This method uses the MITK-IGT pipeline that was set up by OnTestNavigation() before. * it iterates over all outputs of the last filter in the pipeline, updates each and writes * its transformed tracking data to the GUI. */ void OnMeasure(); /**Documentation * \brief performs continuous measurements using the navigation pipeline * * This method calls the above OnMeasure() */ void OnMeasureContinuously(); /** * \brief stops the navigation pipeline and perform clean up */ void OnStop(); /**Documentation * \brief reads the filter parameters from the GUI after they were changed * * The Control widget will store all parameters of the displacement filter * in a mitk::PropertyList. OnParametersChanged() gets called after the user * changed the parameters. It will add that list to the functionality's own * m_Options PropertyList, overwriting any properties that might exist with * the same name (all MITK-IGT filters should use unique property names). * OnTestNavigation() will use the functionality's m_Options list to initialize * the DisplacementFilter. */ void OnParametersChanged(); /**Documentation * \brief Starts recording of tracking data * * This method sets up a IGT pipeline that connects a tracking device * with a NavigationDataRecorder filter and then starts a timer that * updates the recorder periodically if parameter toggled is TRUE. If it is FALSE the recorder will be stopped. */ void OnRecordingToggle(bool toggled); /**Documentation * \brief Stops the recording of tracking data and starts the replay * * This method sets up a new pipeline that connects a NavigationDataPlayer with a * NavigationDataToPointSetFilter as an example for an alternative visualization * method and then starts a Replay timer that updates the recorder periodically if parameter toggled is TRUE. If it is FALSE the Replay timer will be stopped. */ void OnPlayingToggle(bool toggled); /**Documentation * \brief Timer update method for recording of tracking data * * updates the recording filter and displays a message in the status bar */ void OnRecording(); /**Documentation * \brief Timer update method for replaying of tracking data * * updates the replay filter, rerenders the 3D render window and * displays a message in the status bar */ void OnPlaying(); /**Documentation * \brief Display a graph and progress bar that shows error values from the first navigation data * * This method is an example of how to use NavigationDataToMessageFilter to update * GUI elements from a IGT pipeline. It creates a NavigationDataToMessageFilter, * sets its input to the first output of the displacement filter * and registers the OnErrorValueChanged() method as a callback whenever the * error value of the input navigation data changes. */ void OnShowErrorPlot(); /**Documentation * \brief Callback method of the NavigationDataToMessageFilter * * This method will be called by NavigationDataToMessageFilter when the * error value of its input navigation data object changes. * The method calculates an overall error value and adds it both to an * error plot widget and to a progress bar. If the error is above a hardcoded * threshold, a warning is also displayed in the text output widget */ void OnErrorValueChanged(mitk::NavigationData::CovarianceMatrixType v, unsigned int index); /**Documentation * \brief Shows a file dialog for choosing tool description files * * This method is called when the m_ToolBtn is pressed and a tracking * device was selected which needs tool description data. * */ void OnLoadTool(); /**Documentation * \brief Chooses the current tracking device * * This method is called when the m_TrackingDevice selector changed. */ void OnTrackingDeviceTextChanged( const QString & ); protected: mitk::TrackingDevice::Pointer ConfigureTrackingDevice(); ///< create the selected tracker object and configure it (using values from m_Controls) QmitkStdMultiWidget * m_MultiWidget; ///< default render widget Ui::QmitkIGTExampleControls * m_Controls; ///< GUI widget for this functionality mitk::TrackingDeviceSource::Pointer m_Source; ///< first filter in the pipeline mitk::NavigationDataDisplacementFilter::Pointer m_Displacer; ///< displacement filter that adds an offset to NDs mitk::NavigationDataToNavigationDataFilter::Pointer m_EndOfPipeline; // Pointer to last filter in the pipeline mitk::NavigationDataRecorder::Pointer m_Recorder; ///< records NDs to a XML file mitk::NavigationDataPlayer::Pointer m_Player; ///< plays a XML file mitk::NavigationDataToPointSetFilter::Pointer m_PointSetFilter; ///< has a NDs as input and a PointSet as output mitk::NavigationDataToMessageFilter::Pointer m_MessageFilter; ///< calls OnErrorValueChanged when the error value of its input changes mitk::PointSet::Pointer m_PointSet; ///< stores the output of the pointsetfilter QmitkPlotWidget::DataVector m_XValues; ///< X-Values of the error plot (timestamp of navigation data) QmitkPlotWidget::DataVector m_YValues; ///< Y-Values of the error plot (error value of navigation data QTextEdit* out; ///< pointer to output widget QTimer* m_Timer; ///< timer for continuous tracking update QTimer* m_RecordingTimer; ///< timer for continuous recording QTimer* m_PlayingTimer; ///< timer for continuous playing QStringList m_ToolList; ///< list to the tool description files }; #endif // !defined(QmitkIGTExampleView_H__INCLUDED) diff --git a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTRecorderView.h b/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTRecorderView.h index 6d5be4f9b0..e15e60bb21 100644 --- a/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTRecorderView.h +++ b/Modules/Bundles/org.mitk.gui.qt.igtexample/src/internal/QmitkIGTRecorderView.h @@ -1,109 +1,108 @@ /*========================================================================= Program: Medical Imaging & Interaction Toolkit Language: C++ Date: $Date: 2009-05-06 10:44:43 +0200 (Mi, 06 Mai 2009) $ Version: $Revision: 17109 $ Copyright (c) German Cancer Research Center, Division of Medical and Biological Informatics. All rights reserved. See MITKCopyright.txt or http://www.mitk.org/copyright.html 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 notices for more information. =========================================================================*/ #if !defined(QmitkIGTRecorderView_H__INCLUDED) #define QmitkIGTRecorderView_H__INCLUDED #include "QmitkFunctionality.h" -#include "mitkTestingConfig.h" #include "mitkTrackingDeviceSource.h" #include "mitkTrackingDevice.h" #include "mitkNavigationDataRecorder.h" #include "mitkNavigationDataPlayer.h" #include "mitkNavigationDataToPointSetFilter.h" #include "mitkNavigationDataToMessageFilter.h" #include "mitkNavigationDataObjectVisualizationFilter.h" #include "ui_QmitkIGTRecorderViewControls.h" #include "../IgtexampleDll.h" class QmitkStdMultiWidget; class QmitkIGTRecorderViewControls; class QTextEdit; class QmitkNDIConfigurationWidget; /*! \brief QmitkIGTRecorderView Example functionality that shows the usage of the MITK-IGT component \sa QmitkFunctionality \ingroup Functionalities */ class QmitkIGTRecorderView : public QObject, public QmitkFunctionality { Q_OBJECT public: /*! \brief default constructor */ QmitkIGTRecorderView(QObject *parent=0, const char *name=0); /*! \brief default destructor */ virtual ~QmitkIGTRecorderView(); /*! \brief method for creating the widget containing the application controls, like sliders, buttons etc. */ virtual void CreateQtPartControl(QWidget *parent); virtual void StdMultiWidgetAvailable (QmitkStdMultiWidget &stdMultiWidget); virtual void StdMultiWidgetNotAvailable(); /*! \brief method for creating the connections of main and control widget */ virtual void CreateConnections(); protected slots: void OnStartRecording(); void OnStopRecording(); void OnPauseRecording(bool pause); void OnStartReplaying(); void OnStopReplaying(); void RecordFrame(); void OnConnect(); void OnDisconnect(); protected: mitk::TrackingDevice::Pointer ConfigureTrackingDevice(); ///< create the selected tracker object and configure it (using values from m_Controls) void SetupIGTPipeline(mitk::TrackingDevice::Pointer tracker, QString fileName); mitk::DataNode::Pointer CreateInstrumentVisualization(const char* label); QmitkStdMultiWidget * m_MultiWidget; ///< default render widget Ui::QmitkIGTRecorderControls * m_Controls; ///< GUI widget for this functionality mitk::TrackingDeviceSource::Pointer m_Source; ///< first filter in the pipeline mitk::NavigationDataObjectVisualizationFilter::Pointer m_Visualizer; mitk::NavigationDataRecorder::Pointer m_Recorder; ///< records NDs to a XML file mitk::NavigationDataToPointSetFilter::Pointer m_PointSetFilter; ///< has a NDs as input and a PointSet as output mitk::NavigationDataToMessageFilter::Pointer m_MessageFilter; ///< calls OnErrorValueChanged when the error value of its input changes //mitk::NavigationDataPlayer::Pointer m_Player; ///< plays a XML file QTimer* m_Timer; ///< timer for continuous tracking update QTimer* m_RecordingTimer; ///< timer for continuous recording QTimer* m_PlayingTimer; ///< timer for continuous playing QStringList m_ToolList; ///< list to the tool description files QmitkNDIConfigurationWidget* m_ConfigWidget; }; #endif // !defined(QmitkIGTRecorderView_H__INCLUDED)