Comments (8)
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)?
from dcmstack.
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?
from dcmstack.
I have Siemens data where the values from ._slice_pos_val
indicate non-uniform slice thickness; e.g.,
Difference between slices
[1.59999994 1.59999994 1.59999994 1.59999994 1.59999994 1.59999994
1.59999994 1.59999994 1.59999994 1.59999994 1.59999994 1.59999994
1.59999994 1.59999994 1.59999994 1.59999994 1.59999994 1.59999994
1.59999994 1.59999994 1.59999994 3.19999988 1.59999994 1.59999994
1.59999994 1.59999994 1.59999994 1.59999994 1.59999994 1.59999994
1.59999994 1.59999994 1.59999994 1.59999994 1.59999994 1.59999994
1.59999994 1.59999994 1.59999994 1.59999994 1.59999994 1.59999994
1.59999994 1.59999994 1.59999994 1.59999994 1.59999994 1.59999994
1.59999994 1.59999994]
...but I think this is an error. Can the information in ._slice_pos_val
be modified by providing it a new vector/list/set?
from dcmstack.
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.
from dcmstack.
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.
from dcmstack.
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.
from dcmstack.
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.
I stored all the files in different folders according to StudyInstanceID, and most of them can be processed correctly, but when processing some files, same error will be prompted.
and What do you mean by re-sampling CT?
from dcmstack.
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.
from dcmstack.
Related Issues (20)
- Bug to convert philips DTI dcm files HOT 1
- Consider making me a collaborator on dcmstack?
- Explanation for json file, PhaseEncodingDirectionPositive HOT 1
- DICOM sort
- test_get_elem_value UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 5136: character maps to <undefined>
- dcmstack doesn't save unscaled data
- ValueError: could not convert string to float HOT 1
- pytest errors HOT 1
- cut new release? HOT 4
- test error with Python3.8 HOT 4
- nitool with no arguments throws an error instead of displaying help with Python 3 argparse HOT 1
- Object of type DcmMetaExtension is not JSON serializable HOT 1
- Update documentation with respect to pydicom
- What is the current state with respect to enhanced MRI (3D DICOMs)? HOT 8
- Embedding of meta data does not work for multi channel (RGB) data HOT 3
- needs a release HOT 2
- MetaExtractor only works with pydicom.dataset HOT 1
- MetaExtractor fails in case some DICOM fields are empty HOT 2
- test failures on big endian systems
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dcmstack.