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

Dicom series loaded with incorrect origin and spacing (linked from SimpleITK) #4677

Closed
chris-rapson-formus opened this issue May 16, 2024 · 8 comments
Labels
type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances

Comments

@chris-rapson-formus
Copy link

Description

I am using SimpleITK to load DICOMs, and raised a ticket with them when some anonymised DICOMs loaded with incorrect origin and spacing. The relevant metadata seems fine, and can be read by other software. It was suggested that I should raise the ticket here.

For more details, please see the SimpleITK ticket.

@chris-rapson-formus chris-rapson-formus added the type:Bug Inconsistencies or issues which will cause an incorrect result under some or all circumstances label May 16, 2024
Copy link

Thank you for contributing an issue! 🙏

Welcome to the ITK community! 🤗👋☀️

We are glad you are here and appreciate your contribution. Please keep in mind our community participation guidelines. 📜
Also, please check existing open issues and consider discussion on the ITK Discourse. 📖

This is an automatic message. Allow for time for the ITK community to be able to read the issue and comment on it.

@thewtex
Copy link
Member

thewtex commented May 17, 2024

Hi @chris-rapson-formus ,

There were a number of DICOM origin and spacing improvements made in ITK 5.4rc4. You could try:

pip install --upgrade --pre itk
import itk

image = itk.imread(dicom_folder)
print(itk.origin(image))
print(itk.spacing(image))

@chris-rapson-formus
Copy link
Author

@thewtex Thanks for the suggestion. Unfortunately, itk v5.4 is still giving me the same origin and spacing.

>>> import itk
>>> image = itk.imread(dicom_folder)
>>> print(itk.origin(image))
itkPointD3 ([0, 0, 0])
>>> print(itk.spacing(image))
itkVectorD3 ([1, 1, 1])
>>> print(itk.__version__)
5.4.0

@thewtex
Copy link
Member

thewtex commented May 17, 2024

Note that the tags can be listed with print(dict(image)).

@chris-rapson-formus based on your comment:

SimpleITK/SimpleITK#2117 (comment)

The issue may be a removed 0018,0050 tag? See, for example, the discussion and DICOM standard links here: #4521 . Tag interpretation is also modality dependent.

@issakomi
Copy link
Member

issakomi commented May 18, 2024

What is the value of 'SOP Class UID' (0x0008, 0x0016)? And 0x0002,0x0002? Please prefer dcmdump or gdcmdump for reading attributes.

@chris-rapson-formus
Copy link
Author

chris-rapson-formus commented May 19, 2024

@thewtex
Thanks for linking that discussion. It does look very similar, and the DICOMs were missing the 0018,0050 tags when I initially processed them. However, even after adding this tag, the spacing is still (1., 1., 1.) and the origin is still (0., 0., 0.,). The modality is CT, and that is also what is shown in 0008,0060.

@issakomi
0008,0016 SOP Class UID: 1.2.840.10008.5.1.4.1.1.7
0002,0002 Media Storage SOP Class UID: 1.2.840.10008.5.1.4.1.1.7
I've attached the dcmdump output from a file where I have manually added data for the three missing tags which I suspected were causing the problem (0018,0050, 0018,0088, 0020,1041). As noted above, the symptoms are unchanged even after adding in these tags using dcmodify.

@issakomi
Copy link
Member

0008,0016 SOP Class UID: 1.2.840.10008.5.1.4.1.1.7
0002,0002 Media Storage SOP Class UID: 1.2.840.10008.5.1.4.1.1.7

Thank you. Support for Secondary Capture Image Storage has recently been improved (IPP/IOP will be read). It's likely that the ITK 5.4 version you're using doesn't have it (5.4 hasn't been released yet).

@chris-rapson-formus
Copy link
Author

Thanks @issakomi, that makes sense. And I was able to confirm it - using the instructions from @thewtex, I had installed 5.4rc2. After updating pip, I was able to install 5.4rc4. Now I get the correct origin and spacing:

>>> import itk
>>> print(itk.__version__)
5.4.0
>>> image = itk.imread('dicom')
>>> print(itk.origin(image))
itkPointD3 ([-208.748, -260.748, 1014.1])
>>> print(itk.spacing(image))
itkVectorD3 ([0.503906, 0.503906, 0.6])

So it looks like there is already a fix and I should just wait for the ITK release (and for that release to filter through to SimpleITK). I'll close this ticket now.

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