I fixed it. I know now why you did the following: npx itk-wasm -b wasi-build run morphological.wasi.wasm -- -- VisibleWomanEyeSlice.png WatershedSegmentation1Output1.png
we dont need any options like --inputFileName, we just pass –
npx itk-wasm -b wasi-build run morphological.wasi.wasm – – VisibleWomanEyeSlice.png WatershedSegmentation1Output1.png
There are two programs running:
The WASI WebAssembly interpreter
Your WebAssembly module
The double dash -- serves the purpose here (and it is also command in other command line programs) to separate the options between the two. Before the double dash are the WASM interpreter arguments. After are the WASM module arguments.
Hi @matt.mccormick
Thank you for theory behind WASI I understand the subject better now.
one thing to point out is that i can not figure out and get it to work for running watershed segmentation or ApplyColormapToAnImage in Node.js
I need to pass input image file name or path and output image name or path to the WASM module and call that module via index.mjs javascript module. and it fails.However it perfectly works for WASI passing path for input/output file names.
I want to run ApplyColormapToAnImage example in node.js and i have run into problem. The following is the error i get:
I followed the same code in InputsOutpus pipeline example except instead of passing images in c++ code i pass filenames, as WASI AND WASM module arguments. would that be the problem?
I firstly import some function for the pipeline to execute the WASM module.
I build my args array passing WASM module argument which are two png image file name cthead1.png which is input image and colored_node.png is the output image file names.
I find the path to the ApplyColormapToAnImage.wasm module and run it using runPipelineNode function.
what am i doing wrong here? It seems i dont understand pipeline mechanism properly. am passing my WASM module arguments properly via args in index.mjs, do i need to place doubel dash -- before my command line arguments which i did and it did not remove the error? pleas help me understand how node.js runs the WASM module via index.mjs module. do args parameter in index.mjs correctly passing my file names to the ApplyColormapToAnImage.wasm corretly? what is going on here?
mat i already appreciate your help
A late note here in case it is helpful to someone, the error message about the itk-wasm package not being found is related to how Node.js finds dependencies. Typically for node.js projects, a “package” is created for a script, defined with a package.json file, that defines an entry module, e.g. index.mjs, and dependencies. Then the dependencies are installed and available in a local node_modules/ directory.