-
Notifications
You must be signed in to change notification settings - Fork 52
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
dcmstack.dcmstack.InvalidStackError: The DICOM stack is not valid: Slice spacings are not consistent #55
Comments
Are slice spacings inconsistent? If you read the image position attribute (0020,0032) from each slice, are the slices equally spaced (may or may not be as simple as looking at the z coordinate depending on whether your FOV is oblique)? |
I have increased the tolerance a few times (mostly to accommodate GE data). It would be good to know if this is a case of the tolerances still being too small? Or are you missing some slices? |
I have Siemens data where the values from
...but I think this is an error. Can the information in |
That looks exactly like a missing slice (one spacing is doubled), why would the DICOM meta data have the wrong position information? If you want to "fix" this you would need to edit the DICOM dataset before passing it in to dcmstack, but in this case that would mean shifting every DICOM from one side of the gap over one space. |
Good point, thank-you for your comments. I know it's strange but this is a normalized (i.e., NORM in the ImageType field) version of a series that has correct slice positions. It's just not possible to have one of them correct and the other incorrect since they come from the same data. I have other examples there the difference between slices goes from 1.5999 to -81.54999 for a single slice and then back to 1.5999. That clearly can't be correct. Visually the data look fine. I perform all my processing in python since I have to deal with ~40,000 datasets, automation is key. I have used your dcmstack code for years now and it's great! I will look into pydicom and its ability to read-edit-write DICOM files. |
It sounds like someone might have edited the DICOM meta data incorrectly then? A common mistake is for people to not update all of the UIDs when they write modified copies, and then you end up with multiple different copies of the data in the same DICOM series. I have yet to see a valid MRI data set with non-uniform slice spacing, and in fact the Nifti format doesn't support non-uniform slicing. I guess it happens with CT sometimes, and in order to support converting that to Nifti you would need some sort of resampling scheme. |
Hey!Thanks a lot for your code. I' m working on a CT dataset. |
You would need to interpolate the data onto a uniform grid before storing into a Nifti, and presumably you would want to choose the minimum spacing as the grid resolution which is potentially quite wasteful. The meta data would also need special handling, as would be introducing a bunch of "virtual slices" that don't have DICOM meta data. |
anyone help me? Thx!
The text was updated successfully, but these errors were encountered: