0
votes

I am using SimpleITK on Python 3.7.3 on Anaconda Spyder on CentOS 7. I have also installed Aliza and am trying to read a sample volume, /usr/share/aliza/datasets/DICOM/00_MR/PS_0.dcm into Python to process it with numpy. However the following Python code.

import SimpleITK as sitk

reader = sitk.ImageSeriesReader()
dicom_names = reader.GetGDCMSeriesFileNames( inputSeriesName )
reader.SetFileNames(dicom_names)
image = reader.Execute()

results in

Traceback (most recent call last):

  File "<ipython-input-38-8c1737986203>", line 1, in <module>
    image = reader.Execute()

  File "/home/peter/anaconda3/lib/python3.7/site-packages/SimpleITK/SimpleITK.py", line 8473, in Execute
    return _SimpleITK.ImageSeriesReader_Execute(self)

RuntimeError: Exception thrown in SimpleITK ImageSeriesReader_Execute: ../../Code/IO/src/sitkImageSeriesReader.cxx:163:
sitk::ERROR: The file in the series have unsupported 3 dimensions.

I can read in a series of 2D images, that can stack to a volume, but not all DICOM volumes come that way

1

1 Answers

1
votes

I guess that when you use the ImageSeriesReader class, SimpleITK is expecting a series of 2d images. Since you don't have a series of images, but rather a single 3d image, try using the ReadImage function, like so:

import SimpleITK as sitk
image = sitk.ReadImage('/usr/share/aliza/datasets/DICOM/00_MR/PS_0.dcm' )