[ITK] Problem with reading dicom series using SimpleITK
Sara Gh
sg.ele.eng at gmail.com
Thu Nov 3 16:00:51 EDT 2016
Hello,
I have used MATLAB
<https://www.mathworks.com/matlabcentral/fileexchange/50974-3d-shepp-logan-phantom>
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 how I should resolve this issue?
Thanks in advance!
Best regards,
Sara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/community/attachments/20161103/50f5c1c3/attachment.html>
More information about the Community
mailing list