InsightSoftwareConsortium / InsightSoftwareConsortium/ITK-Wasm

[Bug] `readImage` crashes on malformed json

Open
#1,561 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
235
Forks
61
Avg merge
4d 19h
Merged PRs (30d)
4

Description

This one test image crashes due to malformed JSON but other viewers (like ImageJ) can open it (but maybe they're catching/continuing silently?)

[5mg_20x_k14_ki67_5.tif](https://github.com/user-attachments/files/30198764/5mg_20x_k14_ki67_5.tif)

The image is from the image.sc forums so I'm assuming not sensitive. https://forum.image.sc/t/errors-in-piximi/116413. It's a pretty recent thread but the microscope/software could just be old.

```
Uncaught (in promise) SyntaxError: Unterminated string in JSON at position 525 (line 30 column 30) (at index-CNKmEHeQ.js:3638:594)
at JSON.parse ()
at sA (itk-wasm-pipeline.worker-Cr898qMX.js:13:54785)
at itk-wasm-pipeline.worker-Cr898qMX.js:13:59757
at Array.forEach ()
at cn (itk-wasm-pipeline.worker-Cr898qMX.js:13:58744)
at yn (itk-wasm-pipeline.worker-Cr898qMX.js:13:62566)
at Object.runPipeline (itk-wasm-pipeline.worker-Cr898qMX.js:13:62974)
```

I'm not able to reproduce with `readImageNode` but I am able to reproduce using the [official documentation's](https://insightsoftwareconsortium.github.io/ITK-Wasm/image-io/ts/docs/#/) "Live API Demo"

Image

Contributor guide

Open the contributing guide

Research direction

Start with the official ITK-Wasm image-io Live API Demo and the supplied 5mg_20x_k14_ki67_5.tif file, then compare the reported readImage failure with the readImageNode behavior. Trace the JSON parsing error in the image-reading path; done means the malformed file no longer crashes the demo and its handling is covered by an appropriate test or reproducible check.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript, wasm
Domain
web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.