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

Behaviour change between ITK 5.3 and 5.4 with DICOM spacing #4794

Open
seanm opened this issue Aug 2, 2024 · 4 comments
Open

Behaviour change between ITK 5.3 and 5.4 with DICOM spacing #4794

seanm opened this issue Aug 2, 2024 · 4 comments
Labels
type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances

Comments

@seanm
Copy link
Contributor

seanm commented Aug 2, 2024

Further to some discussions in #4647 and #4521, we still have a situation that isn't quite clear to us, and since those are merged already, we thought we'd create a new ticket.

Basically, there is a change in behaviour between ITK 5.3 and 5.4 that we are trying to understand if it's a bug or deliberate & correct.

If we query a DICOM file for its image spacing information, we get different results depending on:

  • using itk::ImageSeriesReader vs using itk::GDCMImageIO
  • having 1 DICOM file in the folder vs having multiple

A small C++ test case is attached: inconsistency_in_spacing.zip

It uses a DICOM file named D_CLUNIE_CT1_J2KR1.dcm, from the GDCM test suite I think, but from David Clunie's collection ultimately I suppose.

In ITK 5.3:

Number of files ImageSeriesReader GDCMImageIO
Single [0.661468, 0.661468, 1] [0.661468, 0.661468, 1]
Multiple [0.661468, 0.661468, 1] [0.661468, 0.661468, 1]

Notice everything agrees: the z spacing is 1.

In ITK 5.4 / master:

Number of files ImageSeriesReader GDCMImageIO
Single [0.661468, 0.661468, 5] [0.661468, 0.661468, 5]
Multiple [0.661468, 0.661468, 1] [0.661468, 0.661468, 5]

Notice now everything does not agree.

The change from 1 to 5 is presumably deliberate from #4521.

But then shouldn't that lone 1 (in the bottom left) also be 5?

Thanks.

@seanm seanm added the type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances label Aug 2, 2024
@issakomi
Copy link
Member

issakomi commented Aug 2, 2024

The behavior change may probably be related to these lines introduced in the commit malaterre/GDCM@836f7a7. In fact ImageHelper::SecondaryCaptureImagePlaneModule variable seems to affect the several MediaStorage classes above, maybe there should be logic + break before? I don't know. Even if I am on the list of co-authors, I didn't make
the change, we started with very simple proposal https://github.com/InsightSoftwareConsortium/ITK/pull/4120/files. If I remember correctly this particular change was done by the GDCM owner, but I am not sure.

BTW, the 'Multiple' series is just duplicated file, both with the same Instance UID (this is invalid) and z-spacing is just a matter of fallback (it is 0 or undefined).

@issakomi
Copy link
Member

issakomi commented Aug 3, 2024

I mean:

bb

FYI, I will not do any PRs or other actions related to this issue

Edit: if it is still not clear: this looks for me as a fall-through bug in switch, the value of ImageHelper::SecondaryCaptureImagePlaneModule (hard-coded to true in GDCM IO) should not affect other IODs.

@issakomi
Copy link
Member

@thewtex
Copy link
Member

thewtex commented Aug 23, 2024

CC @dclunie

zivy added a commit to zivy/SimpleITK-Notebooks that referenced this issue Aug 26, 2024
The spacing parameter on the z axis when reading a single image
changed between ITK 5.3 and 5.4. Issue with change raised here:
InsightSoftwareConsortium/ITK#4794

This is due to the underlying change in GDCM
(MediaStorage::SecondaryCaptureImageStorage deriving the z spacing
from this information):
malaterre/GDCM@836f7a7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances
Projects
None yet
Development

No branches or pull requests

3 participants