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 –
here is the result of segmentation:
Hi @sag ,
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.
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 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?
npx node ./index.mjs ./cthead.png coloroed_node.png
the resulting error apears in the screen shot.
index.mjs react code is similar to InputsOutputs pipeline example
following is the
- 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.
- write the resulting image to
ApplyColormapToAnImage.cxx --- second part of code
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.