loadable module to integrate a haptic device

Hey everyone,
I am trying to create a loadable module in order to integrate a haptic device within Slicer.
Now I currently managed to have prototypical usage of the devices framework within the module, my next issue is how to integrate the device into the slicer scene and access the mrml methods and scenes data.
I would be really glad for any advice.

Kind regards,
Leo

Cc: @Sam_Horvath @jadh4v

Could you share what haptic device you are using, and what so of interaction you are trying to achieve?

The basic method of interfacing would be to represent the position of the haptic device as a transform node.

2 Likes

Thankyou very much for your reply! So the device I am using is a 3d Systems Phantom touch. And I actually wanted to achieve a Haptic response based on the graphic data of the volume represented in Slicer. So besides the position I would need to access the data of the nodes in vtk, e.g. to use greyscale value and other values of interest for the graphic rendering. Have you got any resources that you would reccomend?

So, for interfacing with the 3D Systems Phantom Omni / Geomagic Touch, we use the OpenHaptics interface through our simulation library IMSTK. We have a prototype extension SlicerIMSTK which bundles IMSTK, and has example code for using OpenHaptics with IMSTK. Note, that the OpenHaptics support in the extension is off by default, you would need to change the CMakeLists to test it out.

1 Like

Thankyou very much for replying! I actually tried to build slicer with the IMSTK extension and before building I have done the steps you recommended, unfortunatly I was not able to build and run slicer with the extension. Do you have any advise or resources besides the git repository you could point me to?

Build started...
1>------ Build started: Project: ZERO_CHECK, Configuration: Debug x64 ------
1>Checking Build System
2>------ Build started: Project: OpenVR, Configuration: Debug x64 ------
3>------ Build started: Project: vtkRenderingVR, Configuration: Debug x64 ------
4>------ Build started: Project: Assimp, Configuration: Debug x64 ------
5>------ Build started: Project: Eigen3, Configuration: Debug x64 ------
6>------ Build started: Project: Libusb, Configuration: Debug x64 ------
7>------ Build started: Project: VegaFEM, Configuration: Debug x64 ------
8>------ Build started: Project: g3log, Configuration: Debug x64 ------
9>------ Build started: Project: tbb, Configuration: Debug x64 ------
10>------ Build started: Project: vtkRenderingExternal, Configuration: Debug x64 ------
11>------ Skipped Build: Project: Continuous, Configuration: Debug x64 ------
11>Project not selected to build for this solution configuration 
12>------ Skipped Build: Project: Experimental, Configuration: Debug x64 ------
12>Project not selected to build for this solution configuration 
13>------ Skipped Build: Project: Nightly, Configuration: Debug x64 ------
13>Project not selected to build for this solution configuration 
14>------ Skipped Build: Project: NightlyMemoryCheck, Configuration: Debug x64 ------
14>Project not selected to build for this solution configuration 
15>------ Skipped Build: Project: RUN_TESTS, Configuration: Debug x64 ------
15>Project not selected to build for this solution configuration 
2>Performing update step for 'OpenVR'
2>Skip step
2>Building Custom Rule C:/Users/Leonard/SlicerIMSTK/CMakeLists.txt
2>No patch step for 'OpenVR'
2>Performing configure step for 'OpenVR'
2>Skip step
2>Performing build step for 'OpenVR'
3>Performing configure step for 'vtkRenderingVR'
2>Skip step
2>Performing install step for 'OpenVR'
2>Skip step
2>Completed 'OpenVR'
4>Performing update step for 'Assimp'
3>loading initial cache file C:/Users/Leonard/SlicerIMSTK/vtkRenderingVR-prefix/tmp/vtkRenderingVR-cache-Debug.cmake
3>-- Setting VTK_MODULE_SOURCE_DIR to C:/D/S4D/VTK-build/../VTK/Rendering/VR
3>-- Setting VTK_MODULE_NAME to RenderingVR
3>-- Setting VTK_MODULE_CMAKE_MODULE_PATH to C:/D/S4D/VTK-build/../VTK/CMake
3>-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
4>Building Custom Rule C:/Users/Leonard/SlicerIMSTK/CMakeLists.txt
6>Performing update step for 'Libusb'
5>Building Custom Rule C:/Users/Leonard/SlicerIMSTK/CMakeLists.txt
7>Building Custom Rule C:/Users/Leonard/SlicerIMSTK/CMakeLists.txt
4>No patch step for 'Assimp'
8>Performing install step for 'g3log'
6>Skip step
6>Building Custom Rule C:/Users/Leonard/SlicerIMSTK/CMakeLists.txt
3>CMake Error at C:/D/S4D/VTK-build/lib/cmake/vtk-9.0/vtkModule.cmake:569 (message):
3>  No module files given to scan.
3>Call Stack (most recent call first):
3>  CMakeLists.txt:105 (vtk_module_scan)
3>
3>
4>Performing configure step for 'Assimp'
4>loading initial cache file C:/Users/Leonard/SlicerIMSTK/External/Assimp/tmp/Assimp-cache-Debug.cmake
4>CMake Deprecation Warning at CMakeLists.txt:39 (cmake_minimum_required):
4>  Compatibility with CMake < 2.8.12 will be removed from a future version of
4>  CMake.
4>
4>  Update the VERSION argument <min> value or use a ...<max> suffix to tell
4>  CMake that the project does not need compatibility with older versions.
4>
4>
4>-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
6>No patch step for 'Libusb'
6>Performing configure step for 'Libusb'
3>-- Configuring incomplete, errors occurred!
3>See also "C:/Users/Leonard/SlicerIMSTK/vtkRenderingVR-build/CMakeFiles/CMakeOutput.log".
3>See also "C:/Users/Leonard/SlicerIMSTK/vtkRenderingVR-build/CMakeFiles/CMakeError.log".
3>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for 'C:\Users\Leonard\SlicerIMSTK\CMakeFiles\eca52943f586b733d2b9eb7c0e350129\vtkRenderingVR-configure.rule;C:\Users\Leonard\SlicerIMSTK\CMakeFiles\eca52943f586b733d2b9eb7c0e350129\vtkRenderingVR-build.rule;C:\Users\Leonard\SlicerIMSTK\CMakeFiles\eca52943f586b733d2b9eb7c0e350129\vtkRenderingVR-install.rule;C:\Users\Leonard\SlicerIMSTK\CMakeFiles\4cd7eb71559f6efa497210c55da60646\vtkRenderingVR-complete.rule;C:\Users\Leonard\SlicerIMSTK\CMakeFiles\511a6a1116940676e843c42da3309406\vtkRenderingVR.rule;C:\Users\Leonard\SlicerIMSTK\CMakeLists.txt' exited with code 1.
3>Done building project "vtkRenderingVR.vcxproj" -- FAILED.
8>Error copying file "C:/Users/Leonard/SlicerIMSTK/g3log-build/Debug/g3loggerd.lib" to "C:/Users/Leonard/SlicerIMSTK/g3log-install/lib/g3loggerd.lib".
8>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for 'C:\Users\Leonard\SlicerIMSTK\CMakeFiles\7707c36ca0334f5c9d41006a4638df2f\g3log-install.rule;C:\Users\Leonard\SlicerIMSTK\CMakeFiles\4cd7eb71559f6efa497210c55da60646\g3log-complete.rule;C:\Users\Leonard\SlicerIMSTK\CMakeFiles\511a6a1116940676e843c42da3309406\g3log.rule;C:\Users\Leonard\SlicerIMSTK\CMakeLists.txt' exited with code 1.
8>Done building project "g3log.vcxproj" -- FAILED.
16>------ Build started: Project: vtkRenderingOpenVR, Configuration: Debug x64 ------
6>Skip step
6>Performing build step for 'Libusb'
6>Skip step
6>Performing install step for 'Libusb'
9>Generate version-tbb.txt and license-tbb.txt
4>-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
10>Building Custom Rule C:/Users/Leonard/SlicerIMSTK/CMakeLists.txt
6>Completed 'Libusb'
4>-- Looking for DirectX...
4>-- DirectX_PREFIX_PATH changed.
16>Performing configure step for 'vtkRenderingOpenVR'
4>-- Found DirectX: C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/um/x64/d3d9.lib
4>-- DX lib dir: C:/Program Files (x86)/Windows Kits/10/Lib/10.0.19041.0/um/x64
4>-- Looking for ZLIB...
4>-- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
4>-- Found ZLIB: optimized;C:/dev/vcpkg/installed/x64-windows/lib/zlib.lib;debug;C:/dev/vcpkg/installed/x64-windows/debug/lib/zlibd.lib
4>-- Build an import-only version of Assimp.
4>CMake Deprecation Warning at code/CMakeLists.txt:45 (cmake_minimum_required):
4>  Compatibility with CMake < 2.8.12 will be removed from a future version of
4>  CMake.
4>
4>  Update the VERSION argument <min> value or use a ...<max> suffix to tell
4>  CMake that the project does not need compatibility with older versions.
4>
4>
16>loading initial cache file C:/Users/Leonard/SlicerIMSTK/vtkRenderingOpenVR-prefix/tmp/vtkRenderingOpenVR-cache-Debug.cmake
16>-- Setting VTK_MODULE_SOURCE_DIR to C:/D/S4D/VTK-build/../VTK/Rendering/OpenVR
16>-- Setting VTK_MODULE_NAME to RenderingOpenVR
16>-- Setting VTK_MODULE_CMAKE_MODULE_PATH to C:/D/S4D/VTK-build/../VTK/CMake
16>-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
4>-- Enabled formats: 3DS AC ASE ASSBIN ASSXML B3D BVH COLLADA DXF CSM HMP IRRMESH IRR LWO LWS MD2 MD3 MD5 MDC MDL NFF NDO OFF OBJ OGRE OPENGEX PLY MS3D COB BLEND IFC XGL FBX Q3D Q3BSP RAW SIB SMD STL TERRAGEN 3D X GLTF 3MF
4>-- Disabled formats:
4>-- Configuring done
9>Building Custom Rule C:/Users/Leonard/SlicerIMSTK/CMakeLists.txt
9>Completed 'tbb'
4>-- Generating done
4>-- Build files have been written to: C:/Users/Leonard/SlicerIMSTK/Assimp-build
4>Performing build step for 'Assimp'
4>Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
4>Copyright (C) Microsoft Corporation. All rights reserved.
4>
16>-- Configuring done
4>  Checking Build System
16>-- Generating done
16>-- Build files have been written to: C:/Users/Leonard/SlicerIMSTK/vtkRenderingOpenVR-build
16>Building Custom Rule C:/Users/Leonard/SlicerIMSTK/CMakeLists.txt
16>Performing build step for 'vtkRenderingOpenVR'
16>Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
16>Copyright (C) Microsoft Corporation. All rights reserved.
16>
4>  assimp.vcxproj -> C:\Users\Leonard\SlicerIMSTK\Assimp-build\code\Debug\assimp.dll
4>  Building Custom Rule C:/Users/Leonard/SlicerIMSTK/Assimp/CMakeLists.txt
4>Performing install step for 'Assimp'
4>Microsoft (R) Build Engine version 16.11.2+f32259642 for .NET Framework
4>Copyright (C) Microsoft Corporation. All rights reserved.
4>
16>  Checking Build System
16>  RenderingOpenVR.vcxproj -> C:\Users\Leonard\SlicerIMSTK\bin\Debug\vtkRenderingOpenVRd.dll
16>  Building Custom Rule C:/Users/Leonard/SlicerIMSTK/VTKExternalModule/CMakeLists.txt
16>  vtkRenderingOpenVRPython.vcxproj -> C:\Users\Leonard\SlicerIMSTK\vtkRenderingOpenVR-build\bin\Lib\site-packages\vtkmodules\vtkRenderingOpenVR.cp36-win_amd64.pyd
16>  Building Custom Rule C:/Users/Leonard/SlicerIMSTK/VTKExternalModule/CMakeLists.txt
4>  assimp.vcxproj -> C:\Users\Leonard\SlicerIMSTK\Assimp-build\code\Debug\assimp.dll
16>No install step for 'vtkRenderingOpenVR'
16>Completed 'vtkRenderingOpenVR'
16>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): warning MSB8064: Custom build for item "C:\Users\Leonard\SlicerIMSTK\CMakeFiles\225a4934b41d8cf019587d3277529564\vtkRenderingOpenVR-configure.rule" succeeded, but specified dependency "c:\users\leonard\slicerimstk\vtkrenderingvr-prefix\src\vtkrenderingvr-stamp\debug\vtkrenderingvr-done" does not exist. This may cause incremental build to work incorrectly.
4>  -- Install configuration: "Debug"
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/./lib/Slicer-4.13/cmake/assimp-3.3/assimp-config.cmake
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/./lib/Slicer-4.13/cmake/assimp-3.3/assimp-config-version.cmake
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/./lib/Slicer-4.13/pkgconfig/assimp.pc
16>Done building project "vtkRenderingOpenVR.vcxproj".
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/./lib/Slicer-4.13/assimp.lib
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/./bin/assimp.dll
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/anim.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/ai_assert.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/camera.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/color4.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/color4.inl
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/config.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/defs.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/cfileio.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/light.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/material.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/material.inl
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/matrix3x3.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/matrix3x3.inl
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/matrix4x4.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/matrix4x4.inl
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/mesh.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/postprocess.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/quaternion.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/quaternion.inl
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/scene.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/metadata.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/texture.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/types.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/vector2.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/vector2.inl
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/vector3.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/vector3.inl
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/version.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/cimport.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/importerdesc.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/Importer.hpp
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/DefaultLogger.hpp
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/ProgressHandler.hpp
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/IOStream.hpp
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/IOSystem.hpp
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/Logger.hpp
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/LogStream.hpp
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/NullLogger.hpp
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/cexport.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/Exporter.hpp
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/Compiler/pushpack1.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/Compiler/poppack1.h
4>  -- Up-to-date: C:/Users/Leonard/SlicerIMSTK/Assimp-install/include/assimp/Compiler/pstdint.h
4>  -- Installing: C:/Users/Leonard/SlicerIMSTK/Assimp-install/./lib/Slicer-4.13/assimp.pdb
4>Completed 'Assimp'
17>------ Build started: Project: iMSTK, Configuration: Debug x64 ------
17>Performing configure step for 'iMSTK'
17>loading initial cache file C:/Users/Leonard/SlicerIMSTK/iMSTK-prefix/tmp/iMSTK-cache-Debug.cmake
17>-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
17>-- Setting C++ standard
17>-- Setting C++ standard - C++11
17>-- iMSTK Audio support - OFF (iMSTK_ENABLE_AUDIO is SET)
17>CMake Error at C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
17>  Could NOT find g3log (missing: g3log_LIBRARIES)
17>Call Stack (most recent call first):
17>  C:/Program Files/CMake/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:594 (_FPHSA_FAILURE_MESSAGE)
17>  CMake/Utilities/imstkFind.cmake:199 (find_package_handle_standard_args)
17>  CMake/Findg3log.cmake:14 (imstk_find_package)
17>  CMakeLists.txt:301 (find_package)
17>
17>
17>-- Configuring incomplete, errors occurred!
17>See also "C:/Users/Leonard/SlicerIMSTK/imstk-build/CMakeFiles/CMakeOutput.log".
17>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for 'C:\Users\Leonard\SlicerIMSTK\CMakeFiles\00a65ebf7df0384334e0555dc84e73f1\iMSTK-configure.rule;C:\Users\Leonard\SlicerIMSTK\CMakeFiles\00a65ebf7df0384334e0555dc84e73f1\iMSTK-build.rule;C:\Users\Leonard\SlicerIMSTK\CMakeFiles\00a65ebf7df0384334e0555dc84e73f1\iMSTK-install.rule;C:\Users\Leonard\SlicerIMSTK\CMakeFiles\4cd7eb71559f6efa497210c55da60646\iMSTK-complete.rule;C:\Users\Leonard\SlicerIMSTK\CMakeFiles\511a6a1116940676e843c42da3309406\iMSTK.rule;C:\Users\Leonard\SlicerIMSTK\CMakeLists.txt' exited with code 1.
17>Done building project "iMSTK.vcxproj" -- FAILED.
18>------ Build started: Project: inner, Configuration: Debug x64 ------
18>Performing configure step for 'inner'
18>loading initial cache file C:/Users/Leonard/SlicerIMSTK/inner-prefix/tmp/inner-cache-Debug.cmake
18>-- Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19043.
18>-- Trying to find DCMTK expecting DCMTKConfig.cmake
18>-- Trying to find DCMTK expecting DCMTKConfig.cmake - ok
18>-- Using previously found TBB::tbb
18>-- Using previously found TBB::tbbmalloc
18>-- Using previously found TBB::tbbmalloc_proxy
18>-- Using previously found TBB::tbb
18>-- Using previously found TBB::tbbmalloc
18>-- Using previously found TBB::tbbmalloc_proxy
18>-- Using previously found TBB::tbb
18>-- Using previously found TBB::tbbmalloc
18>-- Using previously found TBB::tbbmalloc_proxy
18>-- RapidJSON found. Headers: ./include/Slicer-4.13
18>-- Trying to find DCMTK expecting DCMTKConfig.cmake
18>-- Trying to find DCMTK expecting DCMTKConfig.cmake - ok
18>-- Configuring SlicerIMSTK with Qt 5.15.2 (using modules: Core, Widgets, Network, OpenGL, PrintSupport, UiTools, Xml, XmlPatterns, Svg, Sql, Multimedia, MultimediaWidgets, WebEngine, WebEngineWidgets, WebChannel, Script, Test, )
18>-- Setting QT_PLUGINS_DIR: C:/Qt/5.15.2/msvc2019_64/plugins
18>-- Setting QT_BINARY_DIR: C:/Qt/5.15.2/msvc2019_64/bin
18>-- Checking EXTENSION_NAME variable
18>-- Checking EXTENSION_NAME variable - NOTDEFINED
18>-- Checking MODULE_NAME variable
18>-- Checking MODULE_NAME variable - NOTDEFINED
18>-- Checking PROJECT_NAME variable
18>-- Checking PROJECT_NAME variable - SlicerIMSTK
18>-- Setting EXTENSION_NAME ......................: SlicerIMSTK
18>-- Adding ConfigureAdditionalLauncherSettings target
18>-- Adding ConfigureAdditionalLauncherSettings target - yes (because configuring inner-build)
18>-- Setting EXTENSION_SOURCE_DIR ................: C:/Users/Leonard/SlicerIMSTK
18>-- Setting EXTENSION_SUPERBUILD_BINARY_DIR .....: C:/Users/Leonard/SlicerIMSTK
18>-- Setting EXTENSION_BUILD_SUBDIRECTORY ........: inner-build
18>-- Setting EXTENSION_DEPENDS ...................: NA
18>-- Setting EXTENSION_BUILD_SUBDIRECTORY ........: inner-build
18>-- Setting EXTENSION_HOMEPAGE ..................: http://slicer.org/slicerWiki/index.php/Documentation/Nightly/Extensions/S [...]
18>-- Setting EXTENSION_CONTRIBUTORS ..............: Johan Andruejol (Kitware Inc.)
18>-- Setting EXTENSION_CATEGORY ..................: Simulation
18>-- Setting EXTENSION_ICONURL ...................: https://gitlab.kitware.com/iMSTK/iMSTK/blob/v1.0.0/Docs/source/media/logo [...]
18>-- Setting EXTENSION_DESCRIPTION ...............: SlicerIMSTK provides Slicer with an interface to the iMSTK simulation lib [...]
18>-- Setting EXTENSION_SCREENSHOTURLS ............: http://www.example.com/Slicer/Extensions/SlicerIMSTK/Screenshots/1.png
18>-- Setting EXTENSION_ENABLED ...................: 1
18>-- Setting EXTENSION_STATUS ....................: NOT DEFINED
18>-- Setting default for EXTENSION_STATUS ........:
18>CMake Error at iMSTK/CMakeLists.txt:24 (file):
18>  file problem creating directory: C:/Program Files (x86)/SlicerIMSTK/bin
18>
18>
18>CMake Error at iMSTK/CMakeLists.txt:25 (file):
18>  file problem creating directory: C:/Program Files (x86)/SlicerIMSTK/include
18>
18>
18>CMake Error at iMSTK/CMakeLists.txt:26 (file):
18>  file problem creating directory: C:/Program Files (x86)/SlicerIMSTK/lib
18>
18>
18>-- Setting C++ standard
18>-- Setting C++ standard - C++11
18>-- iMSTK Audio support - ON (default initialization)
18>-- Found Python: C:/Program Files/WindowsApps/PythonSoftwareFoundation.Python.3.10_3.10.1520.0_x64__qbz5n2kfra8p0/python3.10.exe (found version "3.10.5") found components: Interpreter
18>-- SuperBuild - First pass
18>-- SuperBuild - First pass - done
18>-- SuperBuild - iMSTK => Requires Uncrustify, Assimp, Eigen3, g3log, OpenVR, TBB, VegaFEM, VTK, SFML, GTest, iMSTKData,
18>-- SuperBuild -   Uncrustify[OK]
18>-- SuperBuild -   Assimp[OK]
18>-- SuperBuild -   Eigen3[OK]
18>-- SuperBuild -   g3log[OK]
18>-- SuperBuild -   OpenVR[OK]
18>-- SuperBuild -   TBB[OK]
18>-- SuperBuild -   VegaFEM[OK]
18>-- SuperBuild -   VTK => Requires OpenVR[INCLUDED],
18>-- SuperBuild -   VTK[OK]
18>-- SuperBuild -   SFML[OK]
18>-- SuperBuild -   GTest[OK]
18>-- SuperBuild -   iMSTKData[OK]
18>-- SuperBuild - iMSTK[OK]
18>-- Extension description has been written to: C:/Users/Leonard/SlicerIMSTK/SlicerIMSTK.s4ext
18>-- Checking if extension type is SuperBuild
18>-- Checking if extension type is SuperBuild - true
18>-- Setting 'CTEST_MODEL' variable with default value 'Experimental'
18>-- Setting 'SLICER_EXTENSION_MANAGER_CLIENT_EXECUTABLE' variable with default value 'SLICER_EXTENSION_MANAGER_CLIENT_EXECUTABLE-NOTDEFINED'
18>-- Setting 'SLICER_EXTENSION_MANAGER_URL' variable with default value 'SLICER_EXTENSION_MANAGER_URL-NOTDEFINED'
18>-- Setting 'SLICER_EXTENSION_MANAGER_API_KEY' variable with default value 'OBFUSCATED'
18>-- Configuring incomplete, errors occurred!
18>See also "C:/Users/Leonard/SlicerIMSTK/CMakeFiles/CMakeOutput.log".
18>C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for 'C:\Users\Leonard\SlicerIMSTK\CMakeFiles\ff5507f875e6d32e3f7224609425b2e6\inner-configure.rule;C:\Users\Leonard\SlicerIMSTK\CMakeFiles\ff5507f875e6d32e3f7224609425b2e6\inner-build.rule;C:\Users\Leonard\SlicerIMSTK\CMakeFiles\ff5507f875e6d32e3f7224609425b2e6\inner-forceconfigure.rule;C:\Users\Leonard\SlicerIMSTK\CMakeFiles\ff5507f875e6d32e3f7224609425b2e6\inner-install.rule;C:\Users\Leonard\SlicerIMSTK\CMakeFiles\4cd7eb71559f6efa497210c55da60646\inner-complete.rule;C:\Users\Leonard\SlicerIMSTK\CMakeFiles\511a6a1116940676e843c42da3309406\inner.rule;C:\Users\Leonard\SlicerIMSTK\CMakeLists.txt' exited with code 1.
18>Done building project "inner.vcxproj" -- FAILED.
19>------ Build started: Project: ALL_BUILD, Configuration: Debug x64 ------
19>Building Custom Rule C:/Users/Leonard/SlicerIMSTK/CMakeLists.txt
20>------ Skipped Build: Project: PACKAGE, Configuration: Debug x64 ------
20>Project not selected to build for this solution configuration 
========== Build: 10 succeeded, 4 failed, 0 up-to-date, 6 skipped ==========

I have tried the steps recommended in the FAQs as well just to check that this was not the problem at hand and it did not seem to be resolving the issue. I am looking forward to your reply and thanks again.

@jcfr Do these error look familiar to you for the standalone build?

@leo So, I would not recommend building in Debug, IMSTK doesn’t support that very well. What version of CMake are you using?

@Sam_Horvath I’m working with @leo on this issue, so I’ll answer on his behalf for now. We have tried building in both Debug and Release. We’re using CMake 3.22.1.

If I may ask another question: does SlicerIMSTK require specific versions of Slicer, Qt, VTK, or other dependencies? Is building standalone IMSTK required?

Thank you!

So, SlicerIMSTK should be built against a current/recent Slicer preview (we are actively developing this module for internal projects, so it is in a rather constant state of change). In our current usage of the module, we are bundling in into a custom application based on this commit of Slicer:

The extension handles building IMSTK, so you do not need to build it yourself. The Slicer version handles Qt/VTK versions.

Thank you for your quick reply. I will retry building it with this commit, but I will have to leave Slicer build running overnight today, as it takes me 4+ hours. When building Slicer, Cmake has an option to do it with VTK 8 or 9, does that make a difference? When attempting to build SlicerIMSTK, there is a notice that VTK 8.9+ is required.

Use VTK 9, that is currently most supported for Slicer / IMSTK.

1 Like

@Sam_Horvath Thank you for these instructions. Building this commit failed, although I followed the same steps that have been resulting on successful builds (Release and Debug) for Slicer 4.13.0-2021-09-12. Is there an optimal way to share the errors? I have 10 CMakeError.log files inside my S4R folder.

You could copy/paste the errors into a reply here, or you could upload the files somewhere and link them.

One question, did you build the new commit as a clean build or an incremental build on top of a previous one?

Thank you for your reply. The failed Slicer build was a clean one. It was an attempt using this command:

"C:\Program Files\CMake\bin\cmake.exe" --build . --config Release

On my last attempt, I cleaned the cache, manually deleted S4R’s contents, and tried building it using Visual Studio. This time, I got Slicer to build and produce a working Slicer.exe despite Visual Studio 2019 showing one error, although several CMakeError.log files were produced.

I tried building SlicerIMSTK against this Slicer version based on the commit you suggested, but I still had many errors in Visual Studio 2019. I organized all the CMakeError.log files from both Slicer and the extension here:

Thank you again for your support!

@jcfr, looking at the errors for SlicerIMSTK, most seem to be related to pthread - wasn’t this removed from the IMSTK build?

C:\D\SE\SlicerIMSTKR\vtkRenderingOpenVR-build\CMakeFiles\CMakeTmp\CheckIncludeFile.c(1,10): fatal error C1083: Cannot open include file: 'pthread.h': No such file or directory [C:\D\SE\SlicerIMSTKR\vtkRenderingOpenVR-build\CMakeFiles\CMakeTmp\cmTC_2ea46.vcxproj]

Thank you for your analysis. I don’t know much about pthread, but from what I understood, it should not be on Windows. I tried setting these on different CMakeLists, but it didn’t change a thing:

CMAKE_HAVE_PTHREAD_H:INTERNAL=0 FIND_PACKAGE_MESSAGE_DETAILS_Threads:INTERNAL=[FALSE][v()] set(THREADS_PREFER_PTHREAD_FLAG OFF)

Should I try making pthread available to Windows instead? Thank you.

To help move forward with this, I initiated a build of SlicerIMSTK (commit SlicerIMSTK@897ab3175) against the Slicer build tree associated with the latest release [1].

@siqueirl While I am aware that you are using Visual Studio 2019, could you still compare the output you got with tone I shared below ? More specifically, I am curious about the output associated with Looking for pthread.h and Found Threads

The following command was used:

C:\cmake-3.22.1\bin\cmake.exe ^
  -G "Visual Studio 17 2022" ^
  -A x64 ^
  -T v143
  -DSlicer_DIR:PATH=D:\D\S\S-0-build\Slicer-build ^
  ..\SlicerIMSTK
Click to see configuration output

– Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19044.
– The C compiler identification is MSVC 19.30.30709.0
– The CXX compiler identification is MSVC 19.30.30709.0
– Detecting C compiler ABI info
– Detecting C compiler ABI info - done
– Check for working C compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe - skipped
– Detecting C compile features
– Detecting C compile features - done
– Detecting CXX compiler ABI info
– Detecting CXX compiler ABI info - done
– Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.30.30705/bin/Hostx64/x64/cl.exe - skipped
– Detecting CXX compile features
– Detecting CXX compile features - done
– Looking for pthread.h
– Looking for pthread.h - not found
– Found Threads: TRUE
– Found OpenGL: opengl32 found components: OpenGL
– Found Python3: D:/D/S/S-0-build/python-install/bin/PythonSlicer.exe (found suitable version β€œ3.9.10”, minimum required is β€œ3.9”) found components: Interpreter Development.Module Development.Embed
– Found PythonLibs: D:/D/S/S-0-build/python-install/libs/python39.lib (found version β€œ3.9.10”)
– Trying to find DCMTK expecting DCMTKConfig.cmake
– Trying to find DCMTK expecting DCMTKConfig.cmake - ok
– Found CURL: D:/D/S/S-0-build/curl-install/lib/libcurl.lib (found version β€œ7.70.0-DEV”)
– RapidJSON found. Headers: ./include/Slicer-5.0
– Trying to find DCMTK expecting DCMTKConfig.cmake
– Trying to find DCMTK expecting DCMTKConfig.cmake - ok
– Found PythonInterp: D:/D/S/S-0-build/python-install/bin/PythonSlicer.exe (found version β€œ3.9.10”)
– Found SWIG: D:/D/S/S-0-build/swigwin-4.0.2/swig.exe (found version β€œ4.0.2”)
– Configuring SlicerIMSTK with Qt 5.15.2 (using modules: Core, Widgets, Network, OpenGL, PrintSupport, UiTools, Xml, XmlPatterns, Svg, Sql, Multimedia, MultimediaWidgets, WebEngine, WebEngineWidgets, WebChannel, Script, LinguistTools, Test, )
– Setting QT_PLUGINS_DIR: D:/Support/Qt2/5.15.2/msvc2019_64/plugins
– Setting QT_BINARY_DIR: D:/Support/Qt2/5.15.2/msvc2019_64/bin
– Setting QT_LIBRARY_DIR: D:/Support/Qt2/5.15.2/msvc2019_64/lib
– Checking EXTENSION_NAME variable
– Checking EXTENSION_NAME variable - NOTDEFINED
– Checking MODULE_NAME variable
– Checking MODULE_NAME variable - NOTDEFINED
– Checking PROJECT_NAME variable
– Checking PROJECT_NAME variable - SlicerIMSTK
– Setting EXTENSION_NAME …: SlicerIMSTK
– ITK is setting SlicerIMSTK’s MSVC_RUNTIME_LIBRARY to dynamic
– Checking to see if CXX compiler accepts flag -features=no%anachronisms
– Checking to see if CXX compiler accepts flag -features=no%anachronisms - No
– Adding ConfigureAdditionalLauncherSettings target
– Adding ConfigureAdditionalLauncherSettings target - no (because configuring top-level project)
– Setting EXTENSION_SOURCE_DIR …: D:/T/SlicerIMSTK
– Setting EXTENSION_SUPERBUILD_BINARY_DIR …: D:/T/SlicerIMSTK-Release
– Setting EXTENSION_BUILD_SUBDIRECTORY …: inner-build
– Setting EXTENSION_DEPENDS …: NA
– Setting EXTENSION_BUILD_SUBDIRECTORY …: inner-build
– Setting EXTENSION_HOMEPAGE …: http://slicer.org/slicerWiki/index.php/Documentation/Nightly/Extensions/S […]
– Setting EXTENSION_CONTRIBUTORS …: Johan Andruejol (Kitware Inc.)
– Setting EXTENSION_CATEGORY …: Simulation
– Setting EXTENSION_ICONURL …: Files Β· v1.0.0 Β· iMSTK / iMSTK Β· GitLab […]
– Setting EXTENSION_DESCRIPTION …: SlicerIMSTK provides Slicer with an interface to the iMSTK simulation lib […]
– Setting EXTENSION_SCREENSHOTURLS …: http://www.example.com/Slicer/Extensions/SlicerIMSTK/Screenshots/1.png
– Setting EXTENSION_ENABLED …: 1
– Setting EXTENSION_STATUS …: NOT DEFINED
– Setting default for EXTENSION_STATUS …:
– Found Git: C:/Users/svc-dashboard/AppData/Local/Programs/Git/cmd/git.exe
– SlicerIMSTK_BUILD_ViewerVTK is not defined. Defaulting to β€˜ON’
– SlicerIMSTK_EXTERNAL_PROJECT_DEPENDENCIES:iMSTK;vtkRenderingOpenVR
– Remote - iMSTK [OK]
– Remote - iMSTK_SOURCE_DIR:D:/T/SlicerIMSTK-Release/iMSTK
– Remote - VTKExternalModule [OK]
– Remote - VTKExternalModule_SOURCE_DIR:D:/T/SlicerIMSTK-Release/VTKExternalModule
– SuperBuild - First pass
– SuperBuild - First pass - done
– SuperBuild - inner => Requires iMSTK, vtkRenderingOpenVR,
– SuperBuild - iMSTK => Requires Assimp, Eigen3, g3log, Libusb, VegaFEM, OpenVR, vtkRenderingExternal, vtkRenderingOpenVR,
– SuperBuild - Assimp[OK]
– SuperBuild - Assimp_ROOT_DIR:D:/T/SlicerIMSTK-Release/Assimp-install
– SuperBuild - Assimp_LIB_DIR:./lib/Slicer-5.0
– SuperBuild - Eigen3[OK]
– SuperBuild - Eigen3_DIR:D:/T/SlicerIMSTK-Release/Eigen3-install/share/eigen3/cmake
– SuperBuild - g3log[OK]
– SuperBuild - g3log_ROOT_DIR:D:/T/SlicerIMSTK-Release/g3log-install
– SuperBuild - g3log_LIB_DIR:lib
– SuperBuild - Libusb[OK]
– SuperBuild - Libusb_ROOT_DIR:D:/T/SlicerIMSTK-Release/Libusb-install
– SuperBuild - Libusb_LIB_DIR:lib
– SuperBuild - VegaFEM[OK]
– SuperBuild - VegaFEM_DIR:D:/T/SlicerIMSTK-Release/VegaFEM-install/lib/cmake/VegaFEM
– SuperBuild - OpenVR[OK]
– SuperBuild - OpenVR_INCLUDE_DIR:D:/T/SlicerIMSTK-Release/OpenVR/headers
– SuperBuild - OpenVR_LIBRARY:D:/T/SlicerIMSTK-Release/OpenVR/lib/win64/openvr_api.lib
– SuperBuild - OpenVR_ROOT_DIR:D:/T/SlicerIMSTK-Release/OpenVR
– SuperBuild - OpenVR_LIB_DIR:lib/win64
– SuperBuild - OpenVR_INC_DIR:headers
– SuperBuild - vtkRenderingExternal[OK]
– SuperBuild - VTK_SOURCE_DIR:D:/D/S/S-0-build/VTK-build/…/VTK
– SuperBuild - vtkRenderingExternal_DIR:D:/T/SlicerIMSTK-Release/vtkRenderingExternal-build
– SuperBuild - vtkRenderingOpenVR => Requires OpenVR[INCLUDED], vtkRenderingVR,
– SuperBuild - vtkRenderingVR[OK]
– SuperBuild - VTK_SOURCE_DIR:D:/D/S/S-0-build/VTK-build/…/VTK
– SuperBuild - vtkRenderingVR_DIR:D:/T/SlicerIMSTK-Release/vtkRenderingVR-build
– SuperBuild - vtkRenderingOpenVR[OK]
– SuperBuild - VTK_SOURCE_DIR:D:/D/S/S-0-build/VTK-build/…/VTK
– SuperBuild - vtkRenderingOpenVR_DIR:D:/T/SlicerIMSTK-Release/vtkRenderingOpenVR-build
– SuperBuild - iMSTK[OK]
– SuperBuild - iMSTK[vtkRenderingExternal:ON]
– SuperBuild - iMSTK[vtkRenderingOpenVR:ON]
– SuperBuild - inner[OK]
– Configuring done
– Generating done
– Build files have been written to: D:/T/SlicerIMSTK-Release


  1. The latest release build tree was used because last night nightly failed. See CDash β†©οΈŽ

After configuring using the command-line report above, I was then able to built the extension using the following command executed within a regular windows command line terminal from the directory D:\T\SlicerIMSTK-Release:

C:\cmake-3.22.1\bin\cmake.exe --build . --config Release -- /maxcpucount:4

This message is expected, it is one of the result of the system introspection tests performed during configuration. This message was reported while attempting to check if the pthread.h header is available on the system. As expected on Windows using Visual Studio, it indicates it is not available.

Now reading the posts (especially loadable module to integrate a haptic device - #6 by leo), I am not able to clearly understand what is the actual error. Considering that Visual Studio parallelized the build, I suspect it was displayed earlier in the log.

To move forward, it would be great to provide:

  • Version of Slicer and SlicerIMSTK used
  • Commands used to configure and build Slicer and SlicerIMSTK (e.g is it a Release or Debug) build
  • Configuration or build error(s) reported

I suggest the following use at least Slicer v5.0.3. Once we sort out the issue reported on the Dashboard (link above as well as Windows preview build failing yesterday and today), using the latest version would be sensible too.

Thank you for your analysis and help!

I just managed to get back to my lab and try what you have suggested. I have finally managed to build SlicerIMSTK Release (897ab31) against Slicer 5.1.0-2022-06-17 Release using Visual Studio 2019. I configured using CMake GUI (3.23.3) and built it using cmake --build . --config Release. This was my output:

I uploaded the output and cmake files here as they were too large to paste: WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free

Oddly enough, I still get many pthread.h - not found on my output, but this time inner-build had SlicerWithSlicerIMSTK.exe launching.

So far, I haven’t managed to get a haptic response and Slicer crashes after I hit the Stop Haptics demo, but I still have a lot to try before asking more questions as at least now that the extension is running.

Please let me know if I should share any Cmake or output files to help you understand what the errors possibly were. Thank you again.