fix(compare-images): collapse the preview slice direction with Guess - #1582
Merged
thewtex merged 2 commits intoAug 18, 2026
Merged
Conversation
vboussot
force-pushed
the
fix/compare-images-direction-collapse
branch
from
August 6, 2026 15:21
bc98dec to
a819f9f
Compare
Collaborator
Author
|
CI note: the only real failure is itkwasm-python (windows-2022, 11, compare-images), the other red jobs are fail-fast cancellations. The two new permuted tests run against the committed .wasi.wasm, which CI only rebuilds on ubuntu-24.04, so windows and macOS still test the pre-fix module. Locally I get 12 passed with the module rebuilt from this branch, and the same 2 failures with the committed one, so this needs a compare-images rebuild and release like #1581. |
vboussot
force-pushed
the
fix/compare-images-direction-collapse
branch
from
August 11, 2026 14:42
a819f9f to
568fa47
Compare
compare-double-images extracts a middle 2D slice of the difference image for a rescaled preview, with SetDirectionCollapseToSubmatrix(). That mode throws when the collapsed sub-matrix is singular, which it is for the axis permutations that are normal in 3D medical images: NRRD space directions (0,1,0) (0,0,-1) (-1.3,0,0) collapse to a 2x2 with determinant 0. Comparing such an image against itself therefore aborted the module. Guess keeps the sub-matrix when it is valid, so images that work today are unaffected, and falls back to the identity otherwise. The slice only feeds a preview, so its direction carries no meaning either way. Adds tests over identity, permuted and flipped directions, covering both a self-comparison and a single-voxel difference so the path is exercised rather than merely silenced. Closes InsightSoftwareConsortium#1579
vboussot
force-pushed
the
fix/compare-images-direction-collapse
branch
from
August 13, 2026 15:40
568fa47 to
2cc0057
Compare
Member
…module The Windows and macOS Python jobs test the wasm binary committed in wasm_modules rather than rebuilding it, so the direction-collapse fix needs the regenerated module alongside the source change. Built with docker.io/itkwasm/wasi:latest; the new direction tests pass against it.
thewtex
approved these changes
Aug 18, 2026
thewtex
merged commit Aug 18, 2026
f2195c9
into
InsightSoftwareConsortium:main
74 of 109 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1579.
compare-double-imagesextracts a middle 2D slice of the difference image for arescaled preview, with
SetDirectionCollapseToSubmatrix(). That mode throws whenthe collapsed sub-matrix is singular, which it is for the axis permutations that
are normal in 3D medical images. The NRRD space directions from the report,
(0,1,0) (0,0,-1) (-1.3,0,0), collapse to a 2x2 with determinant 0, so comparingsuch an image against itself aborted the module.
Guesskeeps the sub-matrix when it is valid, so images that work today areunaffected, and falls back to the identity otherwise. The slice only feeds a
preview, so its direction carries no meaning either way.
Verification
Isolated natively first, on the extract alone:
Then end to end, rebuilding the WASI module and swapping only the
.wasmin anotherwise identical environment, using the reproduction from the issue:
The new
test_compare_images_directionself-compares over identity, permutedand flipped directions; it fails on the current module and passes on the patched
one. No test exercised a non-identity 3D direction before.
Note the package's existing
ctesttargets fail on this tree both before andafter this change: the
test:data:downloadtarball is pinned toitk-wasm-v1.0.0-b.171and no longer matches the pipelines, giving anout-of-bounds read. That looks like a separate issue.