Repository navigation
Conversation
…rder (SimpleITK#2292) Signed-off-by: Ilyass Emssaad <[email protected]>
Contributor
Author
|
Closing in favour of the replacement PR (same diff, shorter commit subject for the ghostflow check). |
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.
Fixes #2292.
The direction-matrix bug in #2292 was fixed upstream in ITK
(InsightSoftwareConsortium/ITK#5357,
backported in
ITK#6930,
shipped in SimpleITK 2.5.7): when
ForceOrthogonalDirectionis on (thedefault), the last direction column was taken from the DICOM row/column
orientation cross product without checking its sign against the actual
slice-traversal vector, so reading a series bottom-to-top (or any order
implying negative inter-slice spacing) reported direction
(0,0,-1)where(0,0,+1)was correct, while the origin and spacing were right. Theexisting
DicomSeriesReadertest was only adapted to tolerate bothbehaviors (magnitude-only z-column check, commit 6900990); nothing in the
SimpleITK suite asserts the corrected behavior, so a reintroduction would
go unnoticed.
This adds
TEST(IO, ImageSeriesReader_DirectionFromSliceOrder)inTesting/Unit/sitkImageIOTests.cxx. It synthesizes the issue's 3-sliceaxial DICOM series (Image Position (Patient) z = 70 / -187.5 / -445, Image
Orientation (Patient) = 1 0 0 / 0 1 0) with
ImageFileWriter, in threeSpacingBetweenSlicesvariants (absent /1/-1), reads ittop-to-bottom and bottom-to-top, and asserts the exact origin, the full
direction matrix, z-spacing 257.5, and the physical z of the first and last
voxel planes against the
ImagePositionPatienttags.Test evidence
The C++ test itself was not compiled or run here — a full SimpleITK
SuperBuild is not feasible on the CPU-only machine used for this change, so
please let CI run it. What was verified instead is an exact Python mirror
of the test logic (same tags, same file layout, same assertions) against
pip-installed SimpleITK:
SpacingBetweenSlicesvariants x both file orders pass.direction is
(1,0,0, 0,1,0, 0,0,+1)instead of(…, -1)and the lastvoxel plane's physical z is wrong, in all 3 variants.
An independent pydicom-written reproduction of the issue geometry agrees:
2.5.7 passes 6/6 (order x SBS sign), 2.5.6 fails 3/6.
One deliberate limitation, documented in a NOTE comment in the test: the
test does not assert the
SpacingBetweenSlicesvalue written to the files.While validating, I observed via the Python bindings that once a DICOM read
has happened in a process, later DICOM writes stamp
SpacingBetweenSlices (0018,0088) = "1"regardless of the value set on theslice (write-only processes round-trip the value correctly). The geometry
assertions are unaffected by that — with the ITK fix the direction is
correct for every
SpacingBetweenSlicesvalue — so the test still fails onthe buggy behavior. That writer observation is separate from #2292 and is
not asserted here.
Signed-off-by: Ilyass Emssaad [email protected]