I am using insighttoolkit/itk-js in docker and it works great for both examples mentioned there (Hello World and Median filter test). I can build javascript (as well as wasm), run it with runPipelineNode and runPipelineBrowser.
I need to use vtkItkLevelTracingImageFilter to generate vtkPolyData. However, I do not know if I can convert vtkItk Library with Emscripten to js at all.
I did a small experiment : just added #include “vtkItkLevelTracingImageFilter.h” to MedianFilterTest.cxx code and then I had error as below
Yes, it should be possible. A Docker image is provided with both ITK and VTK available, and if your CMakeList.txt contains find_package(ITK) or find_package(VTK), they will be found without any other steps required. To use this kitware/itk-js-vtk image, specify it via the itk-js CLI:
@Andrzej_Marciniak
Hi,
I am new to itk-wasm and itk.js. I want to use both in my application. i am trying NodeHelloWorld example from itk-wasm. this is what i have done:
if you read the example in the itk-wasm you would see after you do npx itk-wasm build the running docker downloads and calls itk-wasm/emscripten toolchain and build everything into web-build folder. at the last stage i have following code in index.js file:
E:\Projects\vs2019\react\ITK-JS\NodeHelloWorld_1\index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (E:\Projects\vs2019\react\ITK-JS\NodeHelloWorld_1\index.js:2:25)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions…js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
code: ‘MODULE_NOT_FOUND’,
requireStack: [ ‘E:\Projects\vs2019\react\ITK-JS\NodeHelloWorld_1\index.js’ ]
why it does not run the helloworld example in node.js? am i missing something here? should i import 'itk/runPipelineNode?
i appreciate if you send me these examples you shared with matt maccormic, I am basically image processing developer, and i need to work with web as well to build an application, so i need some median filter from itk or some segmentation or registration example.
I could not find itk.js repo? because i get forwarded to the itk-wasm?!
Hi,
I am sorry that I will not be able to help you much, but I haven’t been touching itk for over a year, and I do not remember details. Since the .js code generated by Emscripten was not meeting my performance requirements, I have decided to not use it (implement my own filters in js).
Moreover, I have never been using itk-wasm - I was just using itk v.“9.3.2”. According to what you wrote, it seems to me that you just do not have dependecies in node_modules. Please look at my package.json and package-lock.json files below - I had installed itk in node_modules with “runPipelineNode”. Maybe npm i itk
would make it work?
As I wrote, I do not remember what exactly I was doing, but I made this short instruction for myself (below you will find files) so maybe this will help:
Compilation and running of pipelines with Emscripten
Be sure that docker is running.
Use Ubuntu or git bash
cd ../WebstormProjects/nodehelloworld
Prepare CMakeLists.txt file (see examples) and execute in Ubuntu bash:
./insighttoolkit-itk-js-latest web-build
Prepare runPipelineNode (see index.js, medianTest.js) and execute for example:
npx node ./medianTest.js
or npx node ./index.js
etc.
Links
Example of segmentation pipeline written ITK / C++ (see links inside):
I really appreciate your attention to my issue. your exaplanations are very nice and professional.
I could not get to download any of the sample code from the links though because of access limitation. If you could resolve that and send me the sample codes again i appreciate that.
I did manage to build ThresholdingAnImageUsingOtsu sample using itk-js build --image kitware/itk-js-vtk /source and i used the same cmake file as the windows/Linu/macos.
i have a problem passing parameters of images command line parameters from nodejs, BTW. I use WSL2/UBUNTU20.04.1 and it builds beautifully, eventhough not yet back to itk-wasm to check that as well.
My javascript is junior level and i am learing it. Do you know how to pass png images to the runPipelineNode(pipelinepath, [args array], testoutfile,testinputfile). how to pass in and out the images when calling webassembly module like HelloWorld.js, DO YOU PASS IT AS IMAGE.PNG.JSON, how to convert and image in javascript to jason and then pass it to c++ webassembly module and the convert it bakc to png?
or should we pass it as png? i have not seen much code related to these?why? i dont know.
I also want to develop in javascript my ITK/VTK pipeline, do you have any article or sample codes quick way to translate c++ pipeline to javascript pipeline, where are the libraries, it is so scattered here and there.