Running Pipeline Inputs/Outputs Tutorial in Browser

Hi all,

I’ve been following the ITK-Wasm tutorials and would like to start using ITK-Wasm in some browser-based applications I’m building. As a first step, I’m attempting to compile and run the median filtering code from Pipeline Inputs/Outputs tutorial in a web browser. My code for this can be found here: GitHub - kgoettler/itk-wasm-example: ITK-Wasm Example Project.

Unfortunately I’m stuck trying to get the pipeline to complete successfully. The pipeline, when invoked, always crashes due to a segmentation fault. I’ve attached the full stacktrace in an image below (if the full text would be more helpful, please let me know!)

I can see the segfault is occuring at this line in itkWasmImageToImageFilter.hxx but am unsure why it’s happening. I can’t tell where bufferedRegion is supposed to be set and/or what it’s supposed to be set to.

Curious if anyone can point me in the right direction here? If I can get this working, I’d be happy to contribute some documentation or expand the tutorial docs to include this use case.

Thanks in advance!

(I’m running Chrome 129.0.6668.101, building on a MBP w/ M2 Pro)

@matt.mccormick, @jadh4v and/or @PaulHax might provide some advice.

Can confirm that I am able to reproduce this. I will need to debug this further to find out where exactly the seg fault happens. It might be worth building itk-wasm docker image locally to help debug it.

1 Like

Thanks both for the prompt replies.

I was able to build the itk-wasm Docker images last night, and I believe I’ve narrowed down the source of the segfault. I’ve opened a PR in itk-wasm to fix this: fix(include): avoid segfault when calculating totalSize by kgoettler · Pull Request #1260 · InsightSoftwareConsortium/ITK-Wasm · GitHub

1 Like

@kgoettler well done, and thank you for the contribution! :raised_hands:

The buffered region was added after the example was created, and can be consider optional. Your change is correct and improves robustness for when the buffered region is not present.

1 Like