Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Regression for scans with negative spacing in DICOM #7987

Merged
merged 1 commit into from
Oct 8, 2024

Conversation

pieper
Copy link
Member

@pieper pieper commented Oct 8, 2024

Fixes #7937

See original report here about a dataset being scrambled that loaded well in the 5.6.2 release:

https://discourse.slicer.org/t/regression-in-the-dicom-data-base/37913

This corresponds to the change in behavior described here, where spacing from ITK that used to be 1 is now, for example 5 or -1:

InsightSoftwareConsortium/ITK#4794

Which is believed to be due to the changes here, which was added so that for Secondary Capture files the spacing would be respected if present:

InsightSoftwareConsortium/ITK#4521

However adding this code in GDCM meant that if the SpacingBetweenSlices tag is present, even in a CT, it is being used by ITK to calculate spacing, and also ITKToRAS transforms when trying to orthogonalize the transform.

Since Slicer doesn't rely on orthogonal IJKToRAS transforms, this change tells ITK to skip that step and instead it relies on the positions and orientations of the slices to calculate the IJKToRAS transform, which is compatible with what Slicer expects.

This code was tested on both the CT scan with the negative spacing that was reported in the original issue, and on other CT cans without that tag and the geometry matches what was obtained in 5.6.2.

This change was discussed in the Slicer developer meeting 2024-10-08 and determined to be the best course of action. Further fixes in GDCM or ITK were not pursued because it was unclear whta the correct behavior should be at the library level considering that a negative spacing between slices is technically invalid for CT scans according to the DICOM standard.

Fixes Slicer#7937

See original report here about a dataset being scrambled that loaded well
in the 5.6.2 release:

https://discourse.slicer.org/t/regression-in-the-dicom-data-base/37913

This corresponds to the change in behavior described here, where spacing
from ITK that used to be 1 is now, for example 5 or -1:

InsightSoftwareConsortium/ITK#4794

Which is believed to be due to the changes here, which was
added so that for Secondary Capture files the spacing would
be respected if present:

InsightSoftwareConsortium/ITK#4521

However adding this code in GDCM meant that if the SpacingBetweenSlices
tag is present, even in a CT, it is being used by ITK to calculate
spacing, and also ITKToRAS transforms when trying to orthogonalize
the transform.

Since Slicer doesn't rely on orthogonal IJKToRAS transforms, this change
tells ITK to skip that step and instead it relies on the positions
and orientations of the slices to calculate the IJKToRAS transform, which
is compatible with what Slicer expects.

This code was tested on both the CT scan with the negative spacing that
was reported in the original issue, and on other CT cans without that
tag and the geometry matches what was obtained in 5.6.2.

This change was discussed in the Slicer developer meeting 2024-10-08 and
determined to be the best course of action.  Further fixes in GDCM or
ITK were not pursued because it was unclear whta the correct behavior
should be at the library level considering that a negative spacing
between slices is technically invalid for CT scans according to
the DICOM standard.
@pieper pieper requested a review from lassoan October 8, 2024 20:22
Copy link
Contributor

@lassoan lassoan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me.

@pieper pieper enabled auto-merge (squash) October 8, 2024 20:25
@pieper pieper merged commit 9b3954c into Slicer:main Oct 8, 2024
5 checks passed
@pieper pieper deleted the 7937-dicom-regression branch October 8, 2024 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Update ITK to include regression fix related to DICOM spacing
2 participants