how to build watershed segmentation using itk-wasm

@matt.mccormick

Hi,

I already appreciate your help matt.

I have a big question about build watershed segmentation in itk-wasm/emscripten(JS). i did manage to get the wasi-build working and segmented several png images, but i did build for emscripten (JS) and ran it as like InputsOutputs example(which worked just fine) i get a crash with lots of javascript logged out on screen.

Here is the screen shot:

that is why i contacted you about Debugging example which took me couple of days to run it, yet not complete and i send you the report about it. I wanted to use debugging to step into c++ code (which compiled to JS).
you responded use bindgen to generate typescript and run it in dev tools and step into the javascript and c++ code.
bindgen needs a @itk-wasm/watershed which i dont have it. I know how to pubish package but i dont know how to make one like you did in @itk-wasm/mean-squares-versor-registration package. i did look at that example and could not figure it out how to make similar one for watershed that can generate typescript folder

i have following concerns:

  1. created account on npmjs.com sohrab123 and i published regular and scoped packages, i could not npm install @sohrab123/package?! May be because i am the publisher of the package but i could npm install package in another node.js program without @sohrab123/package. I have published @sohrab123/itk-wasm-segmentation-watershed-morphological on npm site, hoping i could use it as bingen package, do you think you could install it in your node.js then tell me how to make it a bindgen package, is there a program automatically generates bindgen package?

  2. I studied and built mean-squares-versor-registration but wasi test failed?! i checked the test folder and no registered image output found, obviously, program wasi failed the test. i checked the typescript folder all the .ts files, package.json, and rest of the scripts but could not figure out how to write one similar to that so i can use it for build:bindgen:typescript? as @sohrab123/watershed similar to @itk-wasm/mean-square-versor-registration

  3. If i use the typescript folder in mean-squares-versor-registration generated by bindgen, would that work? if so what would i need to change in that folder? replace names of mean-squares-versor-registration with itk-wasm-segmentation-watershed-morphological ? what else would i need to change to make one bindgen package for my application i really need help about this.

  4. do i need to change names, image file names, i probably need one input image rather than two fixed and moving images, what else should i change?

  5. the mean-squares-versor-morphological is not working properly, what am i doing wrong? If you could see into it and tell me the problem: i did:
    I git clone the mean-squares-versor-registration, next > npm install next > npm run build
    a. cd typescript folder
    b. npm install
    c. npm run build
    d. npm run test:wasi > test had error
    e. I stopped here to get advice from you

here is the segmentation cxx file:

SegmWatShedMorph.cxx (15.6 KB)

png watersheded image from wasi test:

WatershedSegmentationHeadSliceOuput

I guess i am close to be able to run the watershed on web browser, debug it, and then with dev tools and step into c++, javascript, and go from there. I just need some directions and help.

p.s.: if it is not trouble please npm install @sohrab123/itk-wasm-segmentation-watershed-morphological package, if you can can you modify the @itk-wasm/mean-squares-versor-registration and send it to me so i can use it for other applications?
greatly appreciated matt.

BR
@sag

Hi @sag,

Here is the screen shot:

Building with -DCMAKE_BUILD_TYPE:STRING=Debug may help. Also, build against the *-debug tagged itkwasm/emscripten build image:

https://hub.docker.com/r/itkwasm/emscripten/tags

I see the package here:

:clap:

As noted, it can be installed:

image

npm i itk-wasm-segmentation-watershed-morphological

how to make it a bindgen package, is there a program automatically generates bindgen package?

The itk-wasm CLI has a bindgen subcommand.

I studied and built mean-squares-versor-registration but wasi test failed?!

It may help to examine how it is tested via CI:

If i use the typescript folder in mean-squares-versor-registration generated by bindgen, would that work? if so what would i need to change in that folder?

It is recommended to use the package.json build script produced by bindgen that will convert TypeScript to JavaScript and bundle the JavaScript.