-
Notifications
You must be signed in to change notification settings - Fork 201
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 #2117
Comments
Have you tried generating a NIFTI with say dcm2niix, to see what it thinks the coordinate system is? |
Also if you read an individual file is the meta-data information correct? Getting a list of the DICOM tags would be useful: https://simpleitk.readthedocs.io/en/master/link_DicomImagePrintTags_docs.html Are the original images able to be shared? |
@gdevenyi I haven't used dcm2niix before, so hopefully this is correct. I installed it with pip, and then ran
@blowekamp If I've understood how I've attached the DICOM tags that were output from the script you linked. Maybe you'll be able to spot something there. At this stage I don't think the images can be shared, but I'll double check that. |
I've now been told that the images were anonymised using Materialise Mimics' standard anonymisation function. The tags that were modified were:
But again, I don't think the problem is in the DICOMs, because other programs can process the metadata correctly. My understanding was that origin and spacing depended entirely on If I was going to look into the source code myself to see if I can spot anything, where should I look? |
@chris-rapson-formus this code that does this may be the upstream https://github.com/InsightSoftwareConsortium/ITK code, perhaps a parallel issue should be opened there |
By comparing the metadata with another file that loads successfully, I realised that the problematic file is missing three relevant tags: I assume ITK works fine when optional tags are missing. (But that assumption could be wrong?) I also assumed that the Slice Thickness shouldn't be relevant for calculating the spacing or the origin. Maybe this is a result of missing a required tag? Although if that's the case, I would have hoped that
I'll try manually adding these tags and see what happens...
|
How did you determine this was the problematic file? If this file is omitted from the series it load? If the series is truncated before this file it loads correctly? Is it a viable options to load the series as individual slices, then join the series ( maybe the joint series or tile filter ) into the 3d volume with a computed spacing ( and other metadata ) manually set? |
Sorry, I should have said "problematic files". All of the files in this CT scan are missing those tags. Although, it seems like those missing tags weren't actually the root cause, since I still get the same spacing and origin after adding them in. Yes, manually calculating the spacing is a viable option, but that doesn't seem like a good way to use SimpleITK. Since there are no error/warning messages, I would have to manually calculate the spacing for every case. I'd essentially be rolling my own functionality that might have other bugs or become obsolete. |
The ITK maintainers were able to solve this for me: the issue is |
@chris-rapson-formus The development version of SimpleITK is built against the ITK v5.4rc04. You can download it for the GitHub release pages: Please let us know if that addresses the issue. |
Thanks @blowekamp yes that dev version of SimpleITK gives the correct spacing and origin using the script from my first comment in this thread :-) |
Describe the bug
When loading a Dicom series from a folder, I am getting the origin as [0, 0, 0] and spacing as [1, 1, 1], which doesn't match the true origin and spacing.
This has been observed with multiple Dicom series, which have the same source. I haven't observed this before on any Dicom series loaded with SimpleITK. I imagine there is something unusual about the Dicoms, but at the same time, the relevant metadata seems to be ok.
There is no error or warning message.
When I inspect the metadata either with SimpleITK, pydicom or MITK Workbench, the spacing is [0.503906, 0.503906, 1]. I believe the origin should be [-208.748, -260.748, 1014.1], however MITK Workbench shows the origin as [0, 0, 0]. Here is a copy of the metadata from MITK Workbench:
To Reproduce
Steps to reproduce the behavior:
pip install -r requirements.txt
(where requirements includes simpleitk==2.3.1)The text was updated successfully, but these errors were encountered: