We assembled a widget from 3D Slicer in the browser

We assembled a widget from 3D Slicer in the browser, and if you’re interested, we can share the instructions.


2 Likes

Hi Daniel,
Would you mind share the instructions how to assemble a widget from 3D Slicer in the browser ?

Thanks

Hi, link to instruction and source code Instruction by 3dSlicer - Google Docs

I follow the instructions, but when I execute command, it throws error as below

~/workingspace/example_for_community/Cone on  master! ⌚ 10:46:32
$ npx itk-wasm -i  my-vtk-wasm -b ./build-emscripten -s . build

Build environment image not found, pulling my-vtk-wasm...
Using default tag: latest
Error response from daemon: pull access denied for my-vtk-wasm, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Could not pull docker image my-vtk-wasm

Does it need to build image my-vtk-wasm ? How to do that ?

To build a Docker container from the root directory, you need to use the command: docker build -t my-vtk-wasm .

Did you build the project?

Yes, I did build. However I got this error where executing command

➜ Cone git:(master) ✗ npx itk-wasm -i my-vtk-wasm -b ./build-emscripten -s . build

VTK_OPENGL_USE_GLES: 
emscripten_link_options = SHELL:-s EXPORT_NAME=vtkRenderingApplicationExport-lembindSHELL:-s ALLOW_MEMORY_GROWTH=1SHELL:-s DEMANGLE_SUPPORT=1SHELL:-s MODULARIZE=1SHELL:-s WASM=1SHELL:-s DEMANGLE_SUPPORT=1--closure 1
emscripten_optimizations = -Oz
emscripten_debug_options = -g2
-- Configuring done
CMake Warning (dev) at CMakeLists.txt:376 (add_library):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /work/slicer_mrml_repository/Core/vtkMRMLDisplayNode.cxx
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /work/build-emscripten
[1/3] Building CXX object CMakeFiles/mrml_core.dir/src/Line/Line.cxx.o
FAILED: CMakeFiles/mrml_core.dir/src/Line/Line.cxx.o 
/emsdk/upstream/emscripten/em++ -DDIY_NO_THREADS -DGLEW_STATIC -DVTK_ENABLE_WEBGPU -DVTK_HAS_OGGTHEORA_SUPPORT -Dkiss_fft_scalar=double -I/work/./slicer_mrml_repository/teem -I/work/./slicer_mrml_repository -I/work/./slicer_mrml_repository/MRML -I/work/./slicer_mrml_repository/vtkTeem -I/work/./slicer_mrml_repository/Core -I/work/./slicer_mrml_repository/ITK-5.3 -I/work/./slicer_mrml_repository/libarchive -I/work/./slicer_mrml_repository/vtkSegmentationCore -I/work/./slicer_mrml_repository/vtkITK -I/work/./slicer_mrml_repository/slicerITK/ITK/Modules/Core/Common -I/work/./slicer_mrml_repository/slicerITK/ITK/Modules/Core/Common/src -I/work/./slicer_mrml_repository/CMake -I/work/./vtk_new/ThirdParty/freetype/vtkfreetype/include -I/work/./slicer_mrml_repository/VTK -I/work/./slicer_mrml_repository/GL -I/work/./slicer_mrml_repository/Qt5CoreConfig -I/work/./slicer_mrml_repository/config_qt/Qt5 -I/work/./slicer_mrml_repository/qt5/QtCore -I/work/./slicer_mrml_repository/qt5 -I/work/./slicer_mrml_repository/qt5/QtWidgets -I/work/./slicer_mrml_repository/qt5/QtGui -I/work/install/include/vtk-9.2 -I/work/./vtk_new/Utilities/KWSys/vtksys -I/work/./vtk_new/Utilities/KWSys -I/work/./vtk_new/Rendering/Core -I/work/./build-vtk-wasm-2/Common/Core -I/work/./build-vtk-wasm-2/Rendering/FreeType -I/work/./vtk_new/Common/ExecutionModel -I/work/./vtk_new/IO/Export -I/work/./vtk_new/Utilities/KWIML -I/work/./build-vtk-wasm-2/Common/ExecutionModel -I/work/./build-vtk-wasm-2/Filters/Sources -I/work/./build-vtk-wasm-2/Filters/Parallel -I/work/./vtk_new/cmake-build-debug/IO/Geometry -I/work/./vtk_new/IO

It full error?

The attachment is the full log . I am using node version : 14.x
error.txt (39.2 KB)

Sorry, there was an error in the source code, upload example with fixes. without_error.tar.gz - Google Drive

Please tell me if you fix error :slight_smile:

H Daniel,
Yes, I run the new source code without errors.

VTK_LIB: VTK::CommonCore
Current project directory: /work
INTERFACE_INCLUDE_DIRECTORIES. 
VTK_OPENGL_USE_GLES: 
emscripten_link_options = SHELL:-s EXPORT_NAME=vtkRenderingApplicationExport-lembindSHELL:-s ALLOW_MEMORY_GROWTH=1SHELL:-s DEMANGLE_SUPPORT=1SHELL:-s MODULARIZE=1SHELL:-s WASM=1SHELL:-s DEMANGLE_SUPPORT=1--closure 1
emscripten_optimizations = -Oz
emscripten_debug_options = -g2
-- Configuring done
CMake Warning (dev) at CMakeLists.txt:376 (add_library):
  Policy CMP0115 is not set: Source file extensions must be explicit.  Run
  "cmake --help-policy CMP0115" for policy details.  Use the cmake_policy
  command to set the policy and suppress this warning.

  File:

    /work/slicer_mrml_repository/Core/vtkMRMLDisplayNode.cxx
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /work/build-emscripten
ninja: no work to do.

What is the next step to run app in browser ?

Hi, you need run server (for example python3 -m http.server 8000) in folder build-emscripten. Please tell me about results this

I see a black screen,

Click by second button in row please

Still got a black screen, I opened the devtool and see many error like these ones

It is strange behavior, need to reaserch beacuse problems with WebGL lost