[ITK-users] Problem with reading dicom series using SimpleITK

Sara Gh sg.ele.eng at gmail.com
Thu Nov 3 20:46:45 EDT 2016


Hello,

I have used this MATLAB
<https://www.mathworks.com/matlabcentral/fileexchange/50974-3d-shepp-logan-phantom>
code
to create a stack of images using Shepp-Logan Phantom and saved all these
images in dicom format using *dicomwrite* function:

sizeP = [128 128 128]

[p,ellipse]=phantom3dAniso(sizeP);

outDir = './SLPData/';

for i=1:sizeP(3)

    fname = [outDir sprintf('SLP%06d.dcm', i)];

    dicomwrite(p(:,:,i), fname)
end

So, I have 128 dicom files ('SLP000001.dcm', 'SLP000002.dcm', ... ,
'SLP000128.dcm' ) in the 'SLPData' folder. Now, I am trying to read
these dicom images in Python using SimpleITK:

pathDicomA = '/SLPData'
reader = sitk.ImageSeriesReader()
dicom_namesA = reader.GetGDCMSeriesFileNames(pathDicomA)
reader.SetFileNames(dicom_namesA)
imageA = reader.Execute()

However, when I run the code, it only reads in one of the images instead of
the whole series:

dicom_namesA => ('.../SLPData/SLP000108.dcm',)
imageA.GetSize()  => (128, 128, 1)

I am wondering what is causing this issue and how I should resolve it?

Thanks in advance!

Best regards,
Sara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-users/attachments/20161103/514c5789/attachment.html>


More information about the Insight-users mailing list