Repository navigation
Conversation
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.
Problem
For a multi-file DICOM series without
SpacingBetweenSlices(0018,0088) orGridFrameOffsetVector(3004,000C),read_dicomset the z spacing from thedistance between the first two slices.
When
ImagePositionPatientis stored with limited precision, that distance isrounded, and the error is multiplied by the number of slices. Example with a
true pitch of 1.64557 mm:
The origin was correct; only the spacing was affected. The ITK series reader
gives 1.6456 on the same files. We saw the effect on whole-body PET series,
as a PET/CT mismatch growing from feet to head.
Change
series_slice_spacing(slices, io): distance between the first and lastslice positions along the slice normal, divided by (number of slices − 1).
read_dicomuses it for the z spacing when neither tag is present, in placeof the distance between the first two slices.
with the slice positions (last slice more than 10 % of a slice away).
10 % off the mean), e.g. a missing slice.
Behaviour change
Series without a spacing tag can get a slightly different z spacing than
before. Series with a tag are converted as before.
Unchanged: origin, direction, slice order, single-slice input, and
read_3d_dicom(single-file images such as RT dose or SPECT).Tests
Four tests added to
Test_Convert, using synthetic series written withpydicom (no download):
test_convert_unsigned_char,test_convert_unsigned_shortandtest_convert_dicom_flipfail in my environment (Python 3.14, itk 5.4.7,pydicom 3.0.2) with and without this change.