diff --git a/CMakeExternals/SOFA.cmake b/CMakeExternals/SOFA.cmake index f42e40fed6..d5cf6001e0 100644 --- a/CMakeExternals/SOFA.cmake +++ b/CMakeExternals/SOFA.cmake @@ -1,176 +1,176 @@ #----------------------------------------------------------------------------- # SOFA #----------------------------------------------------------------------------- if(MITK_USE_SOFA) # Sanity checks if(DEFINED SOFA_DIR AND NOT EXISTS ${SOFA_DIR}) message(FATAL_ERROR "SOFA_DIR variable is defined but corresponds to non-existing directory") endif() function(write_downloadfile_script script_filename remote local md5) file(WRITE ${script_filename} "message(STATUS \"downloading... src='${remote}' dst='${local}'\") file(DOWNLOAD \"${remote}\" \"${local}\" SHOW_PROGRESS EXPECTED_MD5 ${md5} STATUS status LOG log) list(GET status 0 status_code) list(GET status 1 status_string) if(NOT status_code EQUAL 0) message(FATAL_ERROR \"error: downloading '${remote}' failed status_code: \${status_code} status_string: \${status_string} log: \${log}\") endif() message(STATUS \"downloading... done\")") endfunction() function(write_extractfile_script script_filename filename directory) set(args "") if(filename MATCHES "(\\.|=)(bz2|tar\\.gz|tgz|zip)$") set(args "xfz") elseif(filename MATCHES "(\\.|=)tar$") set(args "xf") else() message(SEND_ERROR "error: do not know how to extract '${filename}' -- known types are .bz2, .tar, .tar.gz, .tgz, and .zip") return() endif() file(WRITE ${script_filename} "get_filename_component(filename \"${filename}\" ABSOLUTE) get_filename_component(directory \"${directory}\" ABSOLUTE) message(STATUS \"extracting... src='\${filename}' dst='\${directory}'\") if(NOT EXISTS \"\${filename}\") message(FATAL_ERROR \"error: file to extract does not exists: '\${filename}'\") endif() set(i 0) while(EXISTS \"\${directory}/../tmp-\${i}\") math(EXPR i \"\${i} + 1\") endwhile() set(ut_dir \"\${directory}/../tmp-\${i}\") file(MAKE_DIRECTORY \"\${ut_dir}\") message(STATUS \"extracting... [tar ${args}]\") execute_process(COMMAND \${CMAKE_COMMAND} -E tar ${args} \${filename} WORKING_DIRECTORY \${ut_dir} RESULT_VARIABLE rv) if(NOT rv EQUAL 0) message(STATUS \"extracting... [error clean up]\") file(REMOVE_RECURSE \"\${ut_dir}\") message(FATAL_ERROR \"error: extract of '\${filename}' failed\") endif() message(STATUS \"extracting... [copy]\") file(GLOB contents \"\${ut_dir}/*\") file(COPY \${contents} DESTINATION \${directory}) message(STATUS \"extracting... [clean up]\") file(REMOVE_RECURSE \"\${ut_dir}\") message(STATUS \"extracting... done\")") endfunction() set(proj SOFA) set(proj_DEPENDENCIES) set(SOFA_DEPENDS ${proj}) set(stamp_dir "${CMAKE_BINARY_DIR}/${proj}-cmake/src/${proj}-stamp") set(download_dir "${CMAKE_BINARY_DIR}/${proj}-cmake/src") set(source_dir "${CMAKE_BINARY_DIR}/${proj}-src") set(url_base "http://dl.dropbox.com/u/5822501/") set(rev "8935") set(file "sofa-rev${rev}.zip") set(md5 "3d151df2b797130a9b8fa4fd60cc4cab") write_downloadfile_script( "${stamp_dir}/download-sofa.cmake" "${url_base}${file}" "${download_dir}/${file}" "${md5}" ) write_extractfile_script( "${stamp_dir}/extract-sofa.cmake" "${download_dir}/${file}" "${source_dir}" ) set(download_cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-sofa.cmake) list(APPEND download_cmd ${CMAKE_COMMAND} -P ${stamp_dir}/extract-sofa.cmake) set(file "sofa-rev${rev}-gl.zip") - set(md5 "5e21312e2bff45cbff1979bfb6249a9f") + set(md5 "0eb29af3eb1de3779c9afa2ff825aed0") write_downloadfile_script( "${stamp_dir}/download-gl.cmake" "${url_base}${file}" "${download_dir}/${file}" "${md5}" ) write_extractfile_script( "${stamp_dir}/extract-gl.cmake" "${download_dir}/${file}" "${source_dir}" ) list(APPEND download_cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-gl.cmake) list(APPEND download_cmd ${CMAKE_COMMAND} -P ${stamp_dir}/extract-gl.cmake) set(file "sofa-rev${rev}-cmake.zip") set(md5 "8381ec98ad47b48f34d19b836bc1063c") write_downloadfile_script( "${stamp_dir}/download-cmake.cmake" "${url_base}${file}" "${download_dir}/${file}" "${md5}" ) write_extractfile_script( "${stamp_dir}/extract-cmake.cmake" "${download_dir}/${file}" "${source_dir}" ) list(APPEND download_cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-cmake.cmake) list(APPEND download_cmd ${CMAKE_COMMAND} -P ${stamp_dir}/extract-cmake.cmake) set(SOFA_PATCH_COMMAND ${CMAKE_COMMAND} -DTEMPLATE_FILE:FILEPATH=${MITK_SOURCE_DIR}/CMakeExternals/EmptyFileForPatching.dummy -P ${MITK_SOURCE_DIR}/CMakeExternals/PatchSOFA-rev8935.cmake) if(NOT DEFINED SOFA_DIR) ExternalProject_Add(${proj} SOURCE_DIR ${source_dir} BINARY_DIR ${proj}-build PREFIX ${proj}-cmake DOWNLOAD_COMMAND "${download_cmd}" PATCH_COMMAND ${SOFA_PATCH_COMMAND} INSTALL_COMMAND "" CMAKE_GENERATOR ${gen} CMAKE_ARGS ${ep_common_args} ${additional_cmake_args} DEPENDS ${proj_DEPENDENCIES} ) set(SOFA_DIR ${CMAKE_CURRENT_BINARY_DIR}/${proj}-build) else() mitkMacroEmptyExternalProject(${proj} "${proj}_DEPENDENCIES}") endif() endif() diff --git a/Modules/Simulation/Documentation/doxygen/Manual.dox b/Modules/Simulation/Documentation/doxygen/Manual.dox index 868f719df9..a40c6389e4 100644 --- a/Modules/Simulation/Documentation/doxygen/Manual.dox +++ b/Modules/Simulation/Documentation/doxygen/Manual.dox @@ -1,56 +1,53 @@ /** \page SimulationManualPage The MITK Simulation Module The MITK Simulation Module provides medical simulation capabilities by integrating the Simulation Open Framework Architecture (SOFA) into MITK. \section SimulationManualBuildInstructions Build Instructions Activate the %CMake option MITK_USE_SOFA to automatically download and build SOFA as well as the MITK Simulation Module during the superbuild process. Afterwards you can activate simulation-enabled plugins during the MITK build configuration, e.g. MITK_BUILD_org.mitk.gui.qt.simulation. \section SimulationManualIntroduction Introduction It is strongly recommended that you are at least familiar with the basic concepts of SOFA before you proceed reading. -SOFA is intended to be used as a framework by itself. It is split into the following three packages: +SOFA is intended to be used as a framework by itself. It is split into the following three parts: -While the former two packages make up the actual framework, the latter package is built on top of them and provides end user applications, e.g. runSofa. +While the former two parts make up the actual framework, the latter part is built on top of them and provides end user applications, e.g. runSofa. To be able to integrate SOFA into MITK, the MITK Simulation Module conceptionally replaces the application layer and solely uses the framework and module layer as a toolkit. \section SimulationManualDrawing Drawing Drawing is done by SOFA at three different places: These cases are handled by the MITK Simulation Module as follows. \subsection SimulationManualDrawingVisualModel sofa::component::visualmodel -The most important class is OglModel since it makes up most of the visual part of a simulation scene. It inherits from VisualModel (which encapsulates all API-independent drawing code) and contains OpenGL-related code to ultimately draw the visual model. +One of the most important drawing classes is OglModel since it makes up most of the visual part of a simulation scene. It inherits from VisualModel (which encapsulates all API-independent drawing code) and contains OpenGL-related code to draw the visual model. -To hook into the drawing of visual models, the MITK Simulation Module creates an alias in the SOFA object system so that every OglModel node found in a scene file is used to instantiate a MITK SimulationModel class instead. This class creates VTK actors that contain the visual model rather than draw it directly. The simulation mapper, which is responsible for drawing the simulation scene, utilizes the visitor mechanism of SOFA to collect all VTK actors and finally draws them. - -Other classes which are injected by aliases into the SOFA object system include all lighting-related classes. These are currently replaced by empty placeholder classes (customized lighting might be supported in the future). +To hook into the drawing of visual models, the MITK Simulation Module creates an alias in the SOFA object system so that every OglModel and VisualModel node found in a scene file is used to instantiate a MITK SimulationModel class instead. This class creates VTK actors that contain the visual model rather than drawing it directly. The simulation mapper, which is responsible for drawing a simulation scene, utilizes the visitor mechanism of SOFA to collect all VTK actors of the scene tree and finally draws them. \subsection SimulationManualDrawingDrawToolGL sofa::core::visual::DrawTool -The abstract class DrawTool (and its default OpenGL implementation DrawToolGL) provides the interface to draw basic primitives, e.g. points, lines, spheres, arrows and so forth. It is usually set by a call to sofa::core::visual::VisualParams::defaultInstance()->drawTool() at application initialization. +The abstract class DrawTool and its default OpenGL implementation DrawToolGL provide the interface to draw basic primitives, e.g. points, lines, spheres, arrows, and so forth. It is usually set by a call to sofa::core::visual::VisualParams::defaultInstance()->drawTool() at application initialization. -The MITK Simulation Module provide its own VTK-based implementation SimulationDrawTool. This class creates VTK actors instead of drawing anything directly. There is one SimulationDrawTool per simulation and the simulation mapper draws all these VTK actors according to which simulation scene is drawn. +The MITK Simulation Module provide its own VTK-based implementation of DrawTool, namely SimulationDrawTool. This class creates VTK actors instead of drawing anything directly. There is one SimulationDrawTool per simulation scene and the simulation mapper draws all current VTK actors according to which simulation scene is drawn. \subsection SimulationManualDrawingGL sofa::helper::gl -All classes in this namespace are problematic since they don't support the SOFA object system and therefore cannot be easily replaced by own implementations. Currently they are not handled by MITK at all. A future workaround might include patching of SOFA during the superbuild process. The cleanest approach would be to get rid these classes completely and use the draw tool instead. - +Classes and functions in this namespace are problematic since they don't support the SOFA object system and therefore cannot be easily replaced by own implementations. Currently they are not handled by MITK at all and an OpenGL stub is injected into SOFA so that all draw related methods and functions in this namespace do practically nothing. This stub is automatically downloaded during the MITK superbuild process (sofa-rev****-gl.zip). However, a patch is additionally applied by the superbuild script to SOFA which alters a few header files to include the stub header files instead of the original OpenGL/GLUT/GLEW ones. */ \ No newline at end of file