Edit this page

NA-MIC Project Weeks

Back to Projects List


Key Investigators

Project Description

Explore the utility of using WebGPU from python in Slicer.

A working prototype already exists here: https://github.com/pieper/SlicerWGPU


  1. Bounce the idea off people as a sanity check
  2. Collect ideas for possible use cases
  3. See if anyone wants to try implementing something practical

Progress and Next Steps



Figure 1: Simple compute shader example that inverts the values of a volume.

@group(0) @binding(0)
var<storage,read> data1: array<i32>;
@group(0) @binding(1)
var<storage,read_write> data2: array<i32>;
fn main(@builtin(global_invocation_id) index: vec3<u32>) {
    let i: u32 = index.x * @@SLICE_SIZE@@ + index.y * @@ROW_SIZE@@ + index.z;
    data2[i] = -1 * data1[i];

Figure 2: Example WGSL compute shader code.


Figure 3: Off-screen GPU render example.

Background and References

See the README for links and background.