moloney / dcmstack

DICOM to Nifti conversion with meta data preservation
Other
72 stars 51 forks source link

Fail to convert DICOM files #24

Closed chrisgorgo closed 9 years ago

chrisgorgo commented 10 years ago

I have a problem converting a set of dicom files:

/scr/adenauer1/virtualenv/devel/local/lib/python2.7/site-packages/dcmstack-0.7.dev-py2.7.egg/dcmstack/dcmstack.py:1073: UserWarning: Error adding file /tmp/test/1.2.840.113619.2.134.1762873053.2072.1145902912.846_0006_000003_11467783150be0.v2 to stack: 
Traceback (most recent call last):
  File "/scr/adenauer1/virtualenv/devel/bin/dcmstack", line 9, in <module>
    load_entry_point('dcmstack==0.7.dev', 'console_scripts', 'dcmstack')()
  File "build/bdist.linux-x86_64/egg/dcmstack/dcmstack_cli.py", line 315, in main
  File "build/bdist.linux-x86_64/egg/dcmstack/dcmstack.py", line 851, in to_nifti
  File "build/bdist.linux-x86_64/egg/dcmstack/dcmstack.py", line 757, in get_data
  File "build/bdist.linux-x86_64/egg/dcmstack/dcmstack.py", line 650, in get_shape
dcmstack.dcmstack.InvalidStackError: The DICOM stack is not valid: No (non-dummy) files in the stack

Here you can find the DICOM files and expected nifti output (provided by dcm2nii) here: https://docs.google.com/uc?id=0B77zr9yIiKOTcDh4Y1hHdUdVUEE&export=download

Thanks in advance for looking into this!

Best, Chris

moloney commented 10 years ago

This is fixed in nibabel here: https://github.com/nipy/nibabel/pull/167

chrisgorgo commented 10 years ago

Hi, I'm using the master branch of nibabel (pulled today) and I am still getting this error. Is there any more information about my environment I can provide that could help?

Best, Chris

chrisgorgo commented 10 years ago

@amadeuskanaan you might be interested in this

moloney commented 10 years ago

Ah sorry, will look into it some more soon

usernameneurold commented 10 years ago

Hi Moloney,

Were you able to figure out what the problem is with these data sets?

Best, Kanaan

moloney commented 10 years ago

With the nibabel master branch I get different errors, basically saying the PixelSpacing and ImageOrientationPatient values do not match, which is true.

The differences are small, but there is currently not any threshold for differences in the DICOM values. I have never seen a scanner produce different values for these tags within a series. Were these images somehow altered after coming off the scanner? Or are the images from different series?

moloney commented 10 years ago

@amadeuskanaan - Any more info here?

moloney commented 10 years ago

@chrisfilo @amadeuskanaan - Any update here?

usernameneurold commented 10 years ago

Sorry @moloney, haven't had the chance to take a look. Will do soon. Thanks for your help.

chrisgorgo commented 10 years ago

Hi, Sorry for late reply. I just updated nibabel and dicom downloaded the files from this PR and run dcmstack on it. I'm still getting the same as you:

(devel)adenauer:/tmp/dcmstack_test$ dcmstack --dest-dir /tmp/test_kanaan --force-read --file-ext ".v2" test/
Traceback (most recent call last):
  File "/scr/adenauer1/virtualenv/devel/bin/dcmstack", line 9, in <module>
    load_entry_point('dcmstack==0.7.dev', 'console_scripts', 'dcmstack')()
  File "build/bdist.linux-x86_64/egg/dcmstack/dcmstack_cli.py", line 315, in main
  File "build/bdist.linux-x86_64/egg/dcmstack/dcmstack.py", line 851, in to_nifti
  File "build/bdist.linux-x86_64/egg/dcmstack/dcmstack.py", line 757, in get_data
  File "build/bdist.linux-x86_64/egg/dcmstack/dcmstack.py", line 664, in get_shape
dcmstack.dcmstack.InvalidStackError: The DICOM stack is not valid: Slice spacings are not consistent

The images are from the same series (part of longer session though, but the scanner dumps everything into one folder). They were not modified. Dcm2nii somehow manages to convert them though. I hope this helps.

moloney commented 9 years ago

Should be fixed in master, provided you are also using nibabel master. Please test it out.

moloney commented 9 years ago

I had fixed the stacking part previously, but now I also have the grouping working. Works on the provided test data set. Reopen if you still have issues.