itk-wasm icon indicating copy to clipboard operation
itk-wasm copied to clipboard

GPU based Image registration with itk-wasm

Open sedghi opened this issue 2 years ago • 2 comments

I have a question about WASM and GPU. On the web, JavaScript is currently the primary means of interacting with the GPU, I believe. Therefore, JavaScript should inject functions into WASM in order to achieve this. Am I right?

Does itk-wasm support porting the GPU methods in ITK? I'm mainly interested in GPU based image registration. For instance this one GPUDemonsRegistrationFilter

And lastly, do you happen to know any other ITK non-linear GPU based image registration methods? gpu based rigid or affine

sedghi avatar Oct 19 '23 16:10 sedghi

Hi,

Yes, WebAssembly currently does not have general GPU support. However, it does support calling function references that are provided as imports. In the browser, these are JavaScript functions. General compute support in web browsers is available through WebGPU, which has JavaScript APIs, which can be called in WebAssembly (and the Emscripten toolchain has some nice tooling to help automate some of this).

The GPU methods in ITK are OpenCL-based, which is not available in the browser. In the future, these will be migrated to WebGPU.

However, if you are just looking for "fast" registration, algorithms often out-perform brute force compute. The @itk-wasm/elastix package is a good place to look:

https://itk-wasm-elastix-app-js.on.fleek.co/

https://github.com/InsightSoftwareConsortium/ITKElastix

thewtex avatar Oct 20 '23 01:10 thewtex

The itk-wasm-elastix is exactly what I'm looking for. I prioritize a fast browser-based registration and don't require a GPU-based solution, as you mentioned.

Thank you for your prompt response!

sedghi avatar Oct 20 '23 02:10 sedghi